Examples of TagVO


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

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

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

    }
   
    @Test
    public void testWriteToSingleTag() throws Exception {
        JSONProvider p = new JSONProvider();
        TagVO tag = createTag("a", "b");
       
        ByteArrayOutputStream os = new ByteArrayOutputStream();
       
        p.writeTo(tag, (Class)TagVO.class, TagVO.class, TagVO.class.getAnnotations(),
                  MediaType.APPLICATION_JSON_TYPE, new MetadataMap<String, Object>(), os);
View Full Code Here

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

   
    @Test
    public void testWriteToSingleTagBadgerFish() throws Exception {
        JSONProvider p = new JSONProvider();
        p.setConvention("badgerfish");
        TagVO tag = createTag("a", "b");
       
        ByteArrayOutputStream os = new ByteArrayOutputStream();
       
        p.writeTo(tag, (Class)TagVO.class, TagVO.class, TagVO.class.getAnnotations(),
                  MediaType.APPLICATION_JSON_TYPE, new MetadataMap<String, Object>(), os);
View Full Code Here

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

        Object o = provider.readFrom((Class)ManyTags.class, ManyTags.class,
                      new Annotation[0], MediaType.APPLICATION_JSON_TYPE,
                      new MetadataMap<String, String>(), is);
        ManyTags holder = (ManyTags)o;
        assertNotNull(holder);   
        TagVO tag = holder.getTags().getTags().get(0);
        assertEquals("a", tag.getName());
        assertEquals("b", tag.getGroup());
    }
View Full Code Here

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

        Object o = provider.readFrom((Class)ManyTags.class, ManyTags.class,
                      new Annotation[0], MediaType.APPLICATION_JSON_TYPE,
                      new MetadataMap<String, String>(), is);
        ManyTags holder = (ManyTags)o;
        assertNotNull(holder);   
        TagVO tag = holder.getTags().getTags().get(0);
        assertEquals("a", tag.getName());
        assertEquals("b", tag.getGroup());
    }
View Full Code Here

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

        provider.setNamespaceMap(nsmap);
        ByteArrayInputStream is = new ByteArrayInputStream(data.getBytes());
        Object o = provider.readFrom((Class)TagVO.class, TagVO.class,
                      new Annotation[0], MediaType.APPLICATION_JSON_TYPE, new MetadataMap<String, String>(),
                      is);
        TagVO tag2 = (TagVO)o;
        assertEquals("A", tag2.getName());
        assertEquals("B", tag2.getGroup());   
    }
View Full Code Here

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

        list.add("list");
        list.add("tags");
        provider.setOutDropElements(list);
        ManyTags many = new ManyTags();
        Tags tags = new Tags();
        tags.addTag(new TagVO("A", "B"));
        tags.addTag(new TagVO("C", "D"));
        many.setTags(tags);
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        provider.writeTo(many, ManyTags.class, ManyTags.class,
                       new Annotation[0], MediaType.TEXT_XML_TYPE, new MetadataMap<String, Object>(), bos);
        System.out.println(bos.toString());
View Full Code Here

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

        list.add("ManyTags");
        list.add("tags");
        provider.setOutDropElements(list);
        ManyTags many = new ManyTags();
        Tags tags = new Tags();
        tags.addTag(new TagVO("A", "B"));
        tags.addTag(new TagVO("C", "D"));
        many.setTags(tags);
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        provider.writeTo(many, ManyTags.class, ManyTags.class,
                       new Annotation[0], MediaType.TEXT_XML_TYPE, new MetadataMap<String, Object>(), bos);
        String expected = "{\"list\":[{\"group\":\"B\",\"name\":\"A\"},"
View Full Code Here

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

        provider.setOutAppendElements(map);
        Map<String, String> nsmap = new HashMap<String, String>();
        nsmap.put("http://tagsvo2", "ps1");
        provider.setNamespaceMap(nsmap);
       
        TagVO tag = new TagVO("A", "B");
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        provider.writeTo(tag, TagVO.class, TagVO.class,
                       new Annotation[0], MediaType.TEXT_XML_TYPE, new MetadataMap<String, Object>(), bos);
        String expected = "{\"ps1.t\":{\"tagVO\":{\"group\":\"B\",\"name\":\"A\"}}}";
        assertEquals(expected, bos.toString());
View Full Code Here

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

    public void testOutAppendLocalBeforeLocal() throws Exception {
        JSONProvider provider = new JSONProvider();
        Map<String, String> map = new HashMap<String, String>();
        map.put("tagVO", "supertag");
        provider.setOutAppendElements(map);
        TagVO tag = new TagVO("A", "B");
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        provider.writeTo(tag, TagVO.class, TagVO.class,
                       new Annotation[0], MediaType.TEXT_XML_TYPE, new MetadataMap<String, Object>(), bos);
        String expected = "{\"supertag\":{\"tagVO\":{\"group\":\"B\",\"name\":\"A\"}}}";
        assertEquals(expected, bos.toString());
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.