Package org.megatome.frame2.jaxbgen

Examples of org.megatome.frame2.jaxbgen.ObjectFactory


  @SuppressWarnings("unchecked")
  static public RequestProcessor instance(Configuration config,
      Element[] elements, String eventPkg) {

    RequestProcessorDef requestProcessorDef = config
        .getSoapRequestProcessor();
    if (requestProcessorDef != null) {

      Class c = createClass(requestProcessorDef.getType());
      if (c == null) {
        return null;
      }

      Object[] objects = { config, elements, eventPkg };
View Full Code Here


            }

            if (eventProxy.isParent()) {
              // put eventNames in arraylist for iteration
              // put events in list mapped by eventName
              JaxbEventBase evt = unmarshall(unmarshaller, DOMStreamConverter
                  .toInputStream(element));
              evt.setValidatingSchema(s);
              eventList.add(evt);
              /*
               * eventList.add((Event)unmarshaller
               * .unmarshal(DOMStreamConverter
               * .toInputStream(this.elements[i])));
               */
              event.setResolve(ResolveType.PARENT);
              event.setEvents(eventList);
              events.add(event);
            } else if (eventProxy.isChildren()) {
              NodeList nodeList = element.getChildNodes();

              for (int j = 0; j < nodeList.getLength(); j++) {
                if (nodeList.item(j).getNodeType() == Node.ELEMENT_NODE) {
                  JaxbEventBase evt = unmarshall(unmarshaller,
                      DOMStreamConverter
                          .toInputStream(nodeList
                              .item(j)));
                  evt.setValidatingSchema(s);
                  eventList.add(evt);
                  /*
                   * eventList.add((Event)unmarshaller
                   * .unmarshal(DOMStreamConverter
                   * .toInputStream(nodeList .item(j))));
View Full Code Here

        Marshaller marshaller = jcontext.createMarshaller();

        Document doc = getTargetDocument();
       
        if (obj instanceof JaxbEventBase) {
          JaxbEventBase jeb = (JaxbEventBase)obj;
          marshaller.marshal(jeb.getMarshallableType(), doc);
        } else {
          marshaller.marshal(obj, doc);
        }
        result = doc.getDocumentElement();
      } catch (JAXBException e) {
View Full Code Here

    USAddress address = po.getShipTo();

    assertNotNull(address);
    assertEquals("Alice Smith", address.getName()); //$NON-NLS-1$

    Items items = po.getItems();

    assertNotNull(items);
    assertEquals(2, items.getItem().size());
  }
View Full Code Here

    Items.Item item = po.getItems().getItem().get(0);

    item.setComment("This comment has been changed"); //$NON-NLS-1$

    ObjectFactory of = new ObjectFactory();
    OutputStream ostream = Helper.marshall(of.createPurchaseOrder(po),
        TARGET_PACKAGE, getClass().getClassLoader());

    assertTrue(ostream.toString().indexOf("This comment has been changed") > 0); //$NON-NLS-1$
  }
View Full Code Here

  public void testMarshalResponse() throws Exception {
    SoapRequestProcessor processor = (SoapRequestProcessor) RequestProcessorFactory
        .instance(this.config, this.elements, TARGET_PKG);

    PurchaseOrderType poi = getResponseObject("org/megatome/frame2/jaxb/po.xml"); //$NON-NLS-1$
    ObjectFactory of = new ObjectFactory();

    Element element = processor.marshallResponse(of
        .createPurchaseOrder(poi));

    assertNotNull(element);
  }
View Full Code Here

  private static final String TARGET_PACKAGE = "org.megatome.frame2.jaxbgen"; //$NON-NLS-1$

  @SuppressWarnings("boxing")
  @Test
  public void testUnmarshall_InputStream() throws Exception {
    PurchaseOrderType po = unmarshall();

    assertNotNull(po);

    assertEquals("1999-10-20", Helper.calendarToString(po.getOrderDate())); //$NON-NLS-1$

    USAddress address = po.getShipTo();

    assertNotNull(address);
    assertEquals("Alice Smith", address.getName()); //$NON-NLS-1$

    Items items = po.getItems();

    assertNotNull(items);
    assertEquals(2, items.getItem().size());
  }
View Full Code Here

    assertEquals(2, items.getItem().size());
  }

  @Test
  public void testMarshall() throws Exception {
    PurchaseOrderType po = unmarshall();

    Items.Item item = po.getItems().getItem().get(0);

    item.setComment("This comment has been changed"); //$NON-NLS-1$

    ObjectFactory of = new ObjectFactory();
    OutputStream ostream = Helper.marshall(of.createPurchaseOrder(po),
View Full Code Here

  }

  @SuppressWarnings("boxing")
  @Test
  public void testValidate() throws Exception {
    PurchaseOrderType po = unmarshall();
    Schema s = loadSchema();
   
    Errors errors = ErrorsFactory.newInstance();

    Items.Item item1 = po.getItems().getItem().get(0);
   
    //assertTrue(po.validate(errors));
    roundTripValidate(po, s, errors);
    assertEquals(0, errors.size());
View Full Code Here

   public POResponderHandler() {
      super();
   }

   public String handle(Event event, Context context) {
      PurchaseOrderType po = (PurchaseOrderType) event;

      po.setComment(NEW_COMMENT);

      context.setRequestAttribute("key1",po); //$NON-NLS-1$
      return null;
   }
View Full Code Here

TOP

Related Classes of org.megatome.frame2.jaxbgen.ObjectFactory

Copyright © 2018 www.massapicom. 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.