Search in sources :

Example 1 with SimpleXml

use of com.hack23.cia.service.external.common.impl.test.SimpleXml in project cia by Hack23.

the class XmlAgentImplITest method unmarshallXmlMissingNamespaceSuccessTest.

/**
 * Unmarshall xml missing namespace success test.
 *
 * @throws XmlAgentException
 *             the xml agent exception
 */
@Test
public void unmarshallXmlMissingNamespaceSuccessTest() throws XmlAgentException {
    final Jaxb2Marshaller jaxb2Marshaller = new Jaxb2Marshaller();
    jaxb2Marshaller.setClassesToBeBound(SimpleXml.class);
    final SimpleXml simpleXml = (SimpleXml) xmlAgent.unmarshallXml(jaxb2Marshaller, XmlAgentImplITest.class.getResource("/simplexml-missing-namespace.xml").toString(), "com.hack23.cia.service.external.common.impl.test", null, null);
    assertEquals(new SimpleXml("abc123"), simpleXml);
}
Also used : SimpleXml(com.hack23.cia.service.external.common.impl.test.SimpleXml) Jaxb2Marshaller(org.springframework.oxm.jaxb.Jaxb2Marshaller) Test(org.junit.Test)

Example 2 with SimpleXml

use of com.hack23.cia.service.external.common.impl.test.SimpleXml in project cia by Hack23.

the class XmlAgentImplITest method unmarshallXmlSuccessTest.

/**
 * Unmarshall xml success test.
 *
 * @throws XmlAgentException
 *             the xml agent exception
 */
@Test
public void unmarshallXmlSuccessTest() throws XmlAgentException {
    final Jaxb2Marshaller jaxb2Marshaller = new Jaxb2Marshaller();
    jaxb2Marshaller.setClassesToBeBound(SimpleXml.class);
    final SimpleXml simpleXml = (SimpleXml) xmlAgent.unmarshallXml(jaxb2Marshaller, XmlAgentImplITest.class.getResource("/simplexml.xml").toString());
    assertEquals(new SimpleXml("abc123"), simpleXml);
}
Also used : SimpleXml(com.hack23.cia.service.external.common.impl.test.SimpleXml) Jaxb2Marshaller(org.springframework.oxm.jaxb.Jaxb2Marshaller) Test(org.junit.Test)

Example 3 with SimpleXml

use of com.hack23.cia.service.external.common.impl.test.SimpleXml in project cia by Hack23.

the class XmlAgentImplITest method unmarshallXmlMissingNamespaceAndReplaceSuccessTest.

/**
 * Unmarshall xml missing namespace and replace success test.
 *
 * @throws XmlAgentException
 *             the xml agent exception
 */
@Test
public void unmarshallXmlMissingNamespaceAndReplaceSuccessTest() throws XmlAgentException {
    final Jaxb2Marshaller jaxb2Marshaller = new Jaxb2Marshaller();
    jaxb2Marshaller.setClassesToBeBound(SimpleXml.class);
    final SimpleXml simpleXml = (SimpleXml) xmlAgent.unmarshallXml(jaxb2Marshaller, XmlAgentImplITest.class.getResource("/simplexml-missing-namespace.xml").toString(), "com.hack23.cia.service.external.common.impl.test", "abc123", "ABC123");
    assertEquals(new SimpleXml("ABC123"), simpleXml);
}
Also used : SimpleXml(com.hack23.cia.service.external.common.impl.test.SimpleXml) Jaxb2Marshaller(org.springframework.oxm.jaxb.Jaxb2Marshaller) Test(org.junit.Test)

Aggregations

SimpleXml (com.hack23.cia.service.external.common.impl.test.SimpleXml)3 Test (org.junit.Test)3 Jaxb2Marshaller (org.springframework.oxm.jaxb.Jaxb2Marshaller)3