Package org.mojavemvc.marshalling

Examples of org.mojavemvc.marshalling.XMLEntityMarshaller


    }
   
    @Test
    public void xmlEntityMarshallerSupportsXMLContentType() {
       
        XMLEntityMarshaller m = new XMLEntityMarshaller();
        String[] contentTypes = m.contentTypesHandled();
        assertEquals(2, contentTypes.length);
        Set<String> contentTypeSet = new HashSet<String>(Arrays.asList(contentTypes));
        assertTrue(contentTypeSet.contains("application/xml"));
        assertTrue(contentTypeSet.contains("text/xml"));
    }
View Full Code Here


    }
   
    @Test
    public void xmlEntityMarshallerReturnsView() {
       
        XMLEntityMarshaller m = new XMLEntityMarshaller();
        SimplePojo entity = new SimplePojo("test");
        View v = m.marshall(entity);
        assertTrue(v instanceof XML);
        assertEquals(new XML(entity).toString(), ((XML)v).toString());
    }
View Full Code Here

    }
   
    @Test
    public void xmlEntityMarshallerUnmarshalls() {
       
        XMLEntityMarshaller m = new XMLEntityMarshaller();
        String xml = "<SimplePojo><val>test</val></SimplePojo>";
        ByteArrayInputStream in = new ByteArrayInputStream(xml.getBytes());
        SimplePojo entity = m.unmarshall(in, SimplePojo.class);
        assertNotNull(entity);
        assertEquals("test", entity.getVal());
    }
View Full Code Here

    }
   
    @Test
    public void xmlEntityMarshallerHandlesMarshallable() {
       
        XMLEntityMarshaller m = new XMLEntityMarshaller();
        SimplePojo entity = new SimplePojo("test");
        MarshallablePojo<SimplePojo> marshallable =
                new MarshallablePojo<SimplePojo>(entity);
        View v = m.marshall(marshallable);
        assertTrue(v instanceof XML);
        assertEquals(new XML(entity).toString(), ((XML)v).toString());
    }
View Full Code Here

    }
   
    @Test
    public void xmlEntityMarshallerHandlesMarshallAnnotation() {
       
        XMLEntityMarshaller m = new XMLEntityMarshaller();
        SimplePojo entity = new SimplePojo("test");
        AnnotatedPojo marshallable = new AnnotatedPojo(entity);
        View v = m.marshall(marshallable);
        assertTrue(v instanceof XML);
        assertEquals(new XML(entity).toString(), ((XML)v).toString());
    }
View Full Code Here

       
        /* place the framework marshallers in the map first so that they
         * can be overridden by user's marshallers */
        addToEntityMarshallerMap(new PlainTextEntityMarshaller(), marshallerMap);
        addToEntityMarshallerMap(new JSONEntityMarshaller(), marshallerMap);
        addToEntityMarshallerMap(new XMLEntityMarshaller(), marshallerMap);
       
        String marshallersNamespaces = config.getInitParameter(ENTITY_MARSHALLERS);
        if (!isEmpty(marshallersNamespaces)) {
            List<String> packages = new ArrayList<String>();
            addNamespaces(marshallersNamespaces, packages);
View Full Code Here

TOP

Related Classes of org.mojavemvc.marshalling.XMLEntityMarshaller

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.