Search in sources :

Example 16 with Jaxb2Marshaller

use of org.springframework.oxm.jaxb.Jaxb2Marshaller in project citrus-samples by christophd.

the class EndpointConfig method marshaller.

@Bean
public Marshaller marshaller() {
    Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
    marshaller.setContextPath("com.consol.citrus.samples.todolist.model");
    return marshaller;
}
Also used : Jaxb2Marshaller(org.springframework.oxm.jaxb.Jaxb2Marshaller) Bean(org.springframework.context.annotation.Bean)

Example 17 with Jaxb2Marshaller

use of org.springframework.oxm.jaxb.Jaxb2Marshaller 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 18 with Jaxb2Marshaller

use of org.springframework.oxm.jaxb.Jaxb2Marshaller 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 19 with Jaxb2Marshaller

use of org.springframework.oxm.jaxb.Jaxb2Marshaller 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)

Example 20 with Jaxb2Marshaller

use of org.springframework.oxm.jaxb.Jaxb2Marshaller in project nextprot-api by calipho-sib.

the class SiteMapMarshaller method afterPropertiesSet.

@Override
public void afterPropertiesSet() throws Exception {
    Jaxb2Marshaller m = new Jaxb2Marshaller();
    m.setClassesToBeBound(SitemapUrlSet.class, SitemapUrl.class);
    this.setMarshaller(m);
}
Also used : Jaxb2Marshaller(org.springframework.oxm.jaxb.Jaxb2Marshaller)

Aggregations

Jaxb2Marshaller (org.springframework.oxm.jaxb.Jaxb2Marshaller)35 Bean (org.springframework.context.annotation.Bean)13 Test (org.junit.Test)7 MarshallingView (org.springframework.web.servlet.view.xml.MarshallingView)7 Test (org.junit.jupiter.api.Test)6 ArrayList (java.util.ArrayList)4 HashMap (java.util.HashMap)4 View (org.springframework.web.servlet.View)4 MappingJackson2JsonView (org.springframework.web.servlet.view.json.MappingJackson2JsonView)4 SimpleXml (com.hack23.cia.service.external.common.impl.test.SimpleXml)3 IOException (java.io.IOException)3 FilterRegistrationBean (org.springframework.boot.web.servlet.FilterRegistrationBean)3 ContentNegotiationManager (org.springframework.web.accept.ContentNegotiationManager)3 FixedContentNegotiationStrategy (org.springframework.web.accept.FixedContentNegotiationStrategy)3 HeaderContentNegotiationStrategy (org.springframework.web.accept.HeaderContentNegotiationStrategy)3 ContentNegotiatingViewResolver (org.springframework.web.servlet.view.ContentNegotiatingViewResolver)3 InternalResourceViewResolver (org.springframework.web.servlet.view.InternalResourceViewResolver)3 InputStream (java.io.InputStream)2 URISyntaxException (java.net.URISyntaxException)2 lombok.val (lombok.val)2