Search in sources :

Example 1 with Order

use of org.apache.axiom.ts.om.document.jaxb.Order in project webservices-axiom by apache.

the class TestGetSAXResultJAXB method runTest.

@Override
protected void runTest() throws Throwable {
    List<OrderItem> items = new ArrayList<OrderItem>(2);
    OrderItem item = new OrderItem();
    item.setPartId("P85-137-19");
    item.setQuantity(2);
    items.add(item);
    item = new OrderItem();
    item.setPartId("O85-554-66");
    item.setQuantity(1);
    items.add(item);
    Order order = new Order();
    order.setCustomerId("73107481");
    order.setItems(items);
    Marshaller marshaller = JAXBContext.newInstance(Order.class).createMarshaller();
    StringWriter out = new StringWriter();
    marshaller.marshal(order, out);
    OMDocument document = metaFactory.getOMFactory().createOMDocument();
    marshaller.marshal(order, document.getSAXResult().getHandler());
    assertAbout(xml()).that(xml(OMDocument.class, document)).hasSameContentAs(out.toString());
}
Also used : Order(org.apache.axiom.ts.om.document.jaxb.Order) Marshaller(javax.xml.bind.Marshaller) StringWriter(java.io.StringWriter) OrderItem(org.apache.axiom.ts.om.document.jaxb.OrderItem) ArrayList(java.util.ArrayList) OMDocument(org.apache.axiom.om.OMDocument)

Aggregations

StringWriter (java.io.StringWriter)1 ArrayList (java.util.ArrayList)1 Marshaller (javax.xml.bind.Marshaller)1 OMDocument (org.apache.axiom.om.OMDocument)1 Order (org.apache.axiom.ts.om.document.jaxb.Order)1 OrderItem (org.apache.axiom.ts.om.document.jaxb.OrderItem)1