Package commonj.sdo.helper

Examples of commonj.sdo.helper.XMLHelper.save()


      TestUtil.equalXmlFiles(
        new ByteArrayInputStream(baos.toByteArray()),
        getClass().getResource(CUSTOMER1_XML)));
   
    baos = new ByteArrayOutputStream();
    xmlHelper.save(
      customer2,
      "http://example.com/customer",
      "Customer", baos);
    assertTrue(
        TestUtil.equalXmlFiles(
View Full Code Here


    sequence.add("price", new BigDecimal("1000.0"));

    sequence.addText("\n");

    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    xmlHelper.save(quote, "http://www.example.com/mixed", "mixedStockQuote", baos);
    assertTrue(TestUtil.equalXmlFiles(new ByteArrayInputStream(baos.toByteArray()), getClass().getResource(MIXED_XML)));
  }
 
  public void testDefineSequencedOpenType() throws Exception
  {
View Full Code Here

    sequence.add("price", new BigDecimal("1000.0"));

    sequence.addText("\n");

    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    xmlHelper.save(quote, "http://www.example.com/mixed", "mixedOpenStockQuote", baos);
    assertTrue(TestUtil.equalXmlFiles(new ByteArrayInputStream(baos.toByteArray()), getClass().getResource(MIXEDOPEN_XML)));
  }

 
  public void testDefineOpenType() throws Exception
View Full Code Here

    openQuote.setBigDecimal(definedPriceProperty, new BigDecimal("1000.0"));
   
    assertEquals(definedPriceProperty.getType(), decimalType);
   
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    xmlHelper.save(
      openQuote,
      "http://www.example.com/open",
      "openStockQuote", baos);
    assertTrue(
      TestUtil.equalXmlFiles(
View Full Code Here

    lastNameProperty.set("name", "lastName");
    lastNameProperty.set("type", stringType);
    lastNameProperty.setBoolean(xmlElementProp, false);

    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    xmlHelper.save(customerType, "commonj.sdo", "type", baos);
   
    ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
    XMLDocument xdoc = xmlHelper.load(bais);

    customerType = xdoc.getRootObject();
View Full Code Here

    assertEquals(type.getProperty("custNum").getType(), intType);
    assertEquals(type.getProperty("firstName").getType(), stringType);
    assertEquals(type.getProperty("lastName").getType(), stringType);
   
    baos = new ByteArrayOutputStream();
    xmlHelper.save(
      customer1,
      "http://example.com/customer",
      "Customer", baos);
    assertTrue(
      TestUtil.equalXmlFiles(
View Full Code Here

      TestUtil.equalXmlFiles(
        new ByteArrayInputStream(baos.toByteArray()),
        getClass().getResource(CUSTOMER1_XML)));
   
    baos = new ByteArrayOutputStream();
    xmlHelper.save(
      customer2,
      "http://example.com/customer",
      "Customer", baos);
    assertTrue(
        TestUtil.equalXmlFiles(
View Full Code Here

    createdObject.setString("nonGroupHead", loadedObject.getString("nonGroupHead"));
  
    assertTrue(hc.getEqualityHelper().equal(loadedObject, createdObject));
   
    ByteArrayOutputStream loadedBaos = new ByteArrayOutputStream();
    xmlHelper.save(loadedObject, nsURI, "testObject", loadedBaos);
    ByteArrayOutputStream createdBaos = new ByteArrayOutputStream();
    xmlHelper.save(createdObject, nsURI, "testObject", createdBaos);
    assertTrue(
        TestUtil.equalXmlFiles(
            new ByteArrayInputStream(loadedBaos.toByteArray()),
View Full Code Here

    assertTrue(hc.getEqualityHelper().equal(loadedObject, createdObject));
   
    ByteArrayOutputStream loadedBaos = new ByteArrayOutputStream();
    xmlHelper.save(loadedObject, nsURI, "testObject", loadedBaos);
    ByteArrayOutputStream createdBaos = new ByteArrayOutputStream();
    xmlHelper.save(createdObject, nsURI, "testObject", createdBaos);
    assertTrue(
        TestUtil.equalXmlFiles(
            new ByteArrayInputStream(loadedBaos.toByteArray()),
            new ByteArrayInputStream(createdBaos.toByteArray())));
   
View Full Code Here

    public String transform(DataObject source, TransformationContext context) {
        try {
            HelperContext helperContext = SDOContextHelper.getHelperContext(context);
            XMLHelper xmlHelper = helperContext.getXMLHelper();
            QName elementName = SDOContextHelper.getElement(context.getSourceDataType());
            return xmlHelper.save(source, elementName.getNamespaceURI(), elementName.getLocalPart());
        } catch (Exception e) {
            throw new TransformationException(e);
        }
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.