Package org.switchyard.transform

Examples of org.switchyard.transform.Transformer


        XMLUnit.compareXML(PO_XML, resultXML);
    }

    @Test
    public void test_configRead() throws IOException {
        Transformer unmarshalingTransformer = getTransformer("switchyard-config-01.xml");
        Assert.assertEquals("A", unmarshalingTransformer.getFrom().toString());
        Assert.assertEquals("java:org.switchyard.transform.jaxb.internal.POType", unmarshalingTransformer.getTo().toString());

        Transformer marshalingTransformer = getTransformer("switchyard-config-02.xml");
        Assert.assertEquals("java:org.switchyard.transform.jaxb.internal.POType", marshalingTransformer.getFrom().toString());
        Assert.assertEquals("A", marshalingTransformer.getTo().toString());
    }
View Full Code Here


    @Test
  public void test_JSONResultPerson() {
    try {
     
      Transformer transformer = getTransformer("switchyard-config-01.xml");
      Object expected = toObject(JSON_PERSON, Person.class);
      Object result = toObject((String)transformer.transform(new Person("Alejandro", 31)), Person.class);
      assertEquals(expected, result);

    } catch (Exception e) {
      Assert.fail("caught an exception " + e.getMessage());
    }
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

    }

    @Test
  public void test_JSONResultUser() {
    try {
      Transformer transformer = getTransformer("switchyard-config-03.xml");
      Object expected = toObject(JSON_USER,User.class);
      Object result = toObject((String)transformer.transform(getUser()), User.class);
      assertEquals(expected, result);
    } catch (Exception e) {
      Assert.fail("caught an exception " + e.getMessage());
    }
  }
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_WrongFromInstance() {
    try {
      Transformer transformer = getTransformer("switchyard-config-03.xml");
      Object expected = toObject(JSON_USER,User.class);
      Object result = toObject((String)transformer.transform(new Person()), User.class);
      assertEquals(expected, result);
    } catch (Exception e) {
      boolean exceptionMatches = e.getMessage().contains("SWITCHYARD016828");
      Assert.assertTrue(exceptionMatches);
    }
View Full Code Here

    if (jsonTransformModel == null) {
      Assert.fail("No json config.");
    }

    Transformer transformer = new JSONTransformFactory().newTransformer(null, jsonTransformModel);

    if (!(transformer instanceof JSON2JavaTransformer ||transformer instanceof Java2JSONTransformer)) {
      Assert.fail("Not an instance of a JSONTransformer.");
    }
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.transform.Transformer

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.