Examples of TagVO2


Examples of org.apache.cxf.jaxrs.resources.TagVO2

        p.setNamespaceMap(namespaceMap);
        byte[] bytes = "{\"ns1.thetag\":{\"group\":\"b\",\"name\":\"a\"}}"
            .getBytes();
        Object tagsObject = p.readFrom(TagVO2.class, null, null,
                                       null, null, new ByteArrayInputStream(bytes));
        TagVO2 tag = (TagVO2)tagsObject;
        assertEquals("a", tag.getName());
        assertEquals("b", tag.getGroup());
    }
View Full Code Here

Examples of org.apache.cxf.jaxrs.resources.TagVO2

       
        byte[] bytes = "{\"group\":\"b\",\"name\":\"a\"}"
            .getBytes();
        Object tagsObject = p.readFrom(TagVO2.class, null, null,
                                          null, null, new ByteArrayInputStream(bytes));
        TagVO2 tag = (TagVO2)tagsObject;
        assertEquals("a", tag.getName());
        assertEquals("b", tag.getGroup());
    }
View Full Code Here

Examples of org.apache.cxf.jaxrs.resources.TagVO2

   
    @Test
    public void testWriteToSingleTag2NoNs() throws Exception {
        JSONProvider<TagVO2> p = new JSONProvider<TagVO2>();
        p.setIgnoreNamespaces(true);
        TagVO2 tag = createTag2("a", "b");
       
        ByteArrayOutputStream os = new ByteArrayOutputStream();
       
        p.writeTo(tag, TagVO2.class, TagVO2.class, TagVO2.class.getAnnotations(),
                  MediaType.APPLICATION_JSON_TYPE, new MetadataMap<String, Object>(), os);
View Full Code Here

Examples of org.apache.cxf.jaxrs.resources.TagVO2

    public void testWriteToSingleQualifiedTag() throws Exception {
        JSONProvider<TagVO2> p = new JSONProvider<TagVO2>();
        Map<String, String> namespaceMap = new HashMap<String, String>();
        namespaceMap.put("http://tags", "ns1");
        p.setNamespaceMap(namespaceMap);
        TagVO2 tag = createTag2("a", "b");
       
        ByteArrayOutputStream os = new ByteArrayOutputStream();
       
        p.writeTo(tag, TagVO2.class, TagVO2.class, TagVO2.class.getAnnotations(),
                  MediaType.APPLICATION_JSON_TYPE, new MetadataMap<String, Object>(), os);
View Full Code Here

Examples of org.apache.cxf.jaxrs.resources.TagVO2

        Map<String, String> namespaceMap = new HashMap<String, String>();
        namespaceMap.put("http://tags", "ns2");
        p.setNamespaceMap(namespaceMap);

        p.setConvention("badgerfish");
        TagVO2 tag = createTag2("a", "b");
       
        ByteArrayOutputStream os = new ByteArrayOutputStream();
       
        p.writeTo(tag, TagVO2.class, TagVO2.class, TagVO2.class.getAnnotations(),
                  MediaType.APPLICATION_JSON_TYPE, new MetadataMap<String, Object>(), os);
View Full Code Here

Examples of org.apache.cxf.jaxrs.resources.TagVO2

        p.setDropRootElement(true);
        p.setIgnoreNamespaces(true);
        Map<String, String> namespaceMap = new HashMap<String, String>();
        namespaceMap.put("http://tags", "ns1");
        p.setNamespaceMap(namespaceMap);
        TagVO2 tag = createTag2("a", "b");
       
        ByteArrayOutputStream os = new ByteArrayOutputStream();
       
        p.writeTo(tag, TagVO2.class, TagVO2.class, TagVO2.class.getAnnotations(),
                  MediaType.APPLICATION_JSON_TYPE, new MetadataMap<String, Object>(), os);
View Full Code Here

Examples of org.apache.cxf.jaxrs.resources.TagVO2

        Object o = provider.readFrom(
                       m.getParameterTypes()[0], m.getGenericParameterTypes()[0],
                       new Annotation[0], MediaType.APPLICATION_JSON_TYPE,
                       new MetadataMap<String, String>(), is);
        assertNotNull(o);
        TagVO2 t1 = null;
        TagVO2 t2 = null;
        if (!isArray) {
            assertEquals(2, ((List<?>)o).size());
            t1 = (TagVO2)((List<?>)o).get(0);
            t2 = (TagVO2)((List<?>)o).get(1);
        } else {
            assertEquals(2, ((Object[])o).length);
            t1 = (TagVO2)((Object[])o)[0];
            t2 = (TagVO2)((Object[])o)[1];
        }
        assertEquals("a", t1.getName());
        assertEquals("b", t1.getGroup());
       
        assertEquals("c", t2.getName());
        assertEquals("d", t2.getGroup());
    }
View Full Code Here

Examples of org.apache.cxf.jaxrs.resources.TagVO2

   
    @Test
    public void testWriteToSingleQualifiedTag2() throws Exception {
        JSONProvider<TagVO2> p = new JSONProvider<TagVO2>();
        p.setNamespaceMap(Collections.singletonMap("http://tags", "ns1"));
        TagVO2 tag = createTag2("a", "b");
       
        ByteArrayOutputStream os = new ByteArrayOutputStream();
       
        p.writeTo(tag, TagVO2.class, TagVO2.class, TagVO2.class.getAnnotations(),
                  MediaType.APPLICATION_JSON_TYPE, new MetadataMap<String, Object>(), os);
View Full Code Here

Examples of org.apache.cxf.jaxrs.resources.TagVO2

    @Test
    public void testWriteArrayAndNamespaceOnObject() throws Exception {
        JSONProvider<TagVO2> p = new JSONProvider<TagVO2>();
        p.setIgnoreNamespaces(true);
        p.setSerializeAsArray(true);
        TagVO2 tag = new TagVO2("a", "b");
        ByteArrayOutputStream os = new ByteArrayOutputStream();
       
        p.writeTo(tag, TagVO2.class, TagVO2.class, TagVO2.class.getAnnotations(),
                  MediaType.APPLICATION_JSON_TYPE, new MetadataMap<String, Object>(), os);
       
View Full Code Here

Examples of org.apache.cxf.jaxrs.resources.TagVO2

        provider.setInTransformElements(map);
        ByteArrayInputStream is = new ByteArrayInputStream(data.getBytes());
        Object o = provider.readFrom(TagVO2.class, TagVO2.class,
                      new Annotation[0], MediaType.APPLICATION_JSON_TYPE, new MetadataMap<String, String>(),
                      is);
        TagVO2 tag2 = (TagVO2)o;
        assertEquals("A", tag2.getName());
        assertEquals("B", tag2.getGroup());   
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.