Package org.switchyard.internal

Examples of org.switchyard.internal.DefaultMessage


    @Test
    public void test() throws IOException {
        final QName A = new QName("a");

        DefaultMessage message = new DefaultMessage().setContent(A);
        MessageValidator<Message> validator = new MessageValidator<Message>();

        ValidationResult result = validator.validate(message);
        Assert.assertTrue(result.isValid());
        Assert.assertNull(result.getDetail());
View Full Code Here


        final QName B = new QName("b");

        BaseTransformerRegistry xformReg = new BaseTransformerRegistry();
        TransformSequence transSequence = TransformSequence.from(A).to(B);

        DefaultMessage message = new DefaultMessage().setContent(A);
        Message2MessageTransformer transformer = new Message2MessageTransformer();

        xformReg.addTransformer(transformer, A, B);
        transSequence.apply(message, xformReg);
View Full Code Here

        final QName B = new QName("b");

        BaseTransformerRegistry xformReg = new BaseTransformerRegistry();
        TransformSequence transSequence = TransformSequence.from(A).to(B);

        DefaultMessage message = new DefaultMessage().setContent("testNull");
        Message2NullTransformer transformer = new Message2NullTransformer();

        xformReg.addTransformer(transformer, A, B);
        transSequence.apply(message, xformReg);
        System.out.println(message.getContent());
        Assert.assertNull(message.getContent());
    }
View Full Code Here

                new QName("purchaseOrder"), JavaTypes.toMessageType(POType.class), null);
       
        JAXBMarshalTransformer marshalTransformer = new JAXBMarshalTransformer(
                JavaTypes.toMessageType(POType.class), new QName("purchaseOrder"), null);

        DefaultMessage message = new DefaultMessage();
        message.setContent(new StreamSource(new StringReader(PO_XML)));

        // Transform XML to Java POType and back to XML...
        unmarshalTransformer.transform(message);
        marshalTransformer.transform(message);

        // Check the round trip...
        String resultXML = message.getContent(String.class);
        XMLUnit.setIgnoreWhitespace(true);
        XMLUnit.compareXML(PO_XML, resultXML);
    }
View Full Code Here

  }
 
  @Test
  public void test_JAVAResultPerson() {
        try {
            DefaultMessage message = newMessage(JSON_PERSON);
            Transformer transformer = getTransformer("switchyard-config-02.xml");

            transformer.transform(message);
      assertEquals(new Person("Alejandro", 31), message.getContent());
    } catch (Exception e) {
      Assert.fail("caught an exception " + e.getMessage());
    }
  }
View Full Code Here

      Assert.fail("caught an exception " + e.getMessage());
    }
  }

    private DefaultMessage newMessage(Object content) {
        DefaultMessage message = new DefaultMessage().setContent(content);
        message.setTransformerRegistry(xformReg);
        return message;
    }
View Full Code Here

  }
 
  @Test
  public void test_JAVAResultUser() {
    try {
            DefaultMessage message = newMessage(JSON_USER);
      Transformer transformer = getTransformer("switchyard-config-04.xml");
            transformer.transform(message);
      assertEquals(getUser(), message.getContent());
    } catch (Exception e) {
      Assert.fail("caught an exception " + e.getMessage());
    }
  }
View Full Code Here

  }
 
  @Test
  public void test_JAVAResultList() {
    try {
            DefaultMessage message = newMessage(JSON_USER_LIST);
      Transformer transformer = getTransformer("switchyard-config-05.xml");
            transformer.transform(message);
      assertEquals(toObject(JSON_USER_LIST, List.class), message.getContent());
    } catch (Exception e) {
      Assert.fail("caught an exception " + e.getMessage());
    }
  }
View Full Code Here

  }
 
  @Test
  public void test_JAVAResultMap() {
    try {
            DefaultMessage message = newMessage(JSON_USER);
      Transformer transformer = getTransformer("switchyard-config-06.xml");
            transformer.transform(message);
      assertEquals(toObject(JSON_USER, Map.class), message.getContent());
    } catch (Exception e) {
      Assert.fail("caught an exception " + e.getMessage());
    }
  }
View Full Code Here

    }

    @Test
    public void test_xslt_result() throws IOException, SAXException {
        Transformer transformer = getTransformer("xslt-config-03.xml");
        DefaultMessage message = newMessage(INITIAL);
        transformer.transform(message);
        String result = message.getContent(String.class);

        XMLUnit.setIgnoreWhitespace(true);
        Diff diff = new Diff(EXPECTED, result);
        Assert.assertTrue(diff.toString(), diff.identical());
    }
View Full Code Here

TOP

Related Classes of org.switchyard.internal.DefaultMessage

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.