Examples of SuperBook


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

            = new JSONProvider<List<SuperBook>>();
        provider.setCollectionWrapperName("{http://superbooks}SuperBooks");
        provider.setJaxbElementClassMap(Collections.singletonMap(
                SuperBook.class.getName(),
                "{http://superbooks}SuperBook"));
        SuperBook b =
            new SuperBook("CXF in Action", 123L, 124L);
        List<SuperBook> books =
            Collections.singletonList(b);
       
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        provider.writeTo(books, List.class,
View Full Code Here

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

        Map<String, String> namespaceMap = new HashMap<String, String>();
        namespaceMap.put("http://www.w3.org/2001/XMLSchema-instance", "xsins");
        p.setNamespaceMap(namespaceMap);
        Books2 books2 = new Books2();
        books2.setBooks(Collections.singletonList(
                            new SuperBook("CXF Rocks", 123L, 124L)));
        ByteArrayOutputStream os = new ByteArrayOutputStream();
       
        p.writeTo(books2, Books2.class, Books2.class, Books2.class.getAnnotations(),
                  MediaType.APPLICATION_JSON_TYPE, new MetadataMap<String, Object>(), os);
        String s = os.toString();
View Full Code Here

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

        Object books2Object = p.readFrom(Books2.class, null, null,
                                          null, null, new ByteArrayInputStream(bytes));
        Books2 books = (Books2)books2Object;
        List<? extends Book> list = books.getBooks();
        assertEquals(1, list.size());
        SuperBook book = (SuperBook)list.get(0);
        assertEquals(124L, book.getSuperId());
        assertEquals(123L, book.getId());
        assertEquals("CXF Rocks", book.getName());
    }
View Full Code Here

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

        Object books2Object = p.readFrom(Books2.class, null, null,
                                          null, null, new ByteArrayInputStream(bytes));
        Books2 books = (Books2)books2Object;
        List<? extends Book> list = books.getBooks();
        assertEquals(1, list.size());
        SuperBook book = (SuperBook)list.get(0);
        assertEquals(124L, book.getSuperId());
        assertEquals(0, book.getName().length());
    }
View Full Code Here

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

        Map<String, String> namespaceMap = new HashMap<String, String>();
        namespaceMap.put("http://www.w3.org/2001/XMLSchema-instance", "xsins");
        p.setNamespaceMap(namespaceMap);
        Books2 books2 = new Books2();
        books2.setBooks(Collections.singletonList(
                            new SuperBook("CXF Rocks", 123L, 124L)));
        ByteArrayOutputStream os = new ByteArrayOutputStream();
       
        p.writeTo(books2, (Class)Books2.class, Books2.class, Books2.class.getAnnotations(),
                  MediaType.APPLICATION_JSON_TYPE, new MetadataMap<String, Object>(), os);
        String s = os.toString();
View Full Code Here

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

        Object books2Object = p.readFrom((Class)Books2.class, null, null,
                                          null, null, new ByteArrayInputStream(bytes));
        Books2 books = (Books2)books2Object;
        List<? extends Book> list = books.getBooks();
        assertEquals(1, list.size());
        SuperBook book = (SuperBook)list.get(0);
        assertEquals(124L, book.getSuperId());
        assertEquals(123L, book.getId());
        assertEquals("CXF Rocks", book.getName());
    }
View Full Code Here

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

        Object books2Object = p.readFrom((Class)Books2.class, null, null,
                                          null, null, new ByteArrayInputStream(bytes));
        Books2 books = (Books2)books2Object;
        List<? extends Book> list = books.getBooks();
        assertEquals(1, list.size());
        SuperBook book = (SuperBook)list.get(0);
        assertEquals(124L, book.getSuperId());
        assertEquals(0, book.getName().length());
    }
View Full Code Here

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

        provider.setExtraClass(new Class[]{SuperBook.class});
        provider.init(Collections.singletonList(cri));
        JAXBContext bookContext = provider.getJAXBContext(Book.class, Book.class);
       
        ByteArrayOutputStream os = new ByteArrayOutputStream();
        bookContext.createMarshaller().marshal(new SuperBook("name", 1L, 2L), os);
        SuperBook book = (SuperBook)bookContext.createUnmarshaller()
                             .unmarshal(new ByteArrayInputStream(os.toByteArray()));
        assertEquals(2L, book.getSuperId());       
    }
View Full Code Here

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

   
    @Test
    public void testWriteDerivedType() throws Exception {
        JAXBElementProvider<Book> provider = new JAXBElementProvider<Book>();
        provider.setJaxbElementClassNames(Collections.singletonList(Book.class.getName()));
        Book b = new SuperBook("CXF in Action", 123L, 124L);
       
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        provider.writeTo(b, Book.class, Book.class,
                       new Annotation[0], MediaType.TEXT_XML_TYPE, new MetadataMap<String, Object>(), bos);
        readSuperBook(bos.toString(), true);
View Full Code Here

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

    }
   
    @Test
    public void testWriteDerivedType2() throws Exception {
        JAXBElementProvider<Book> provider = new JAXBElementProvider<Book>();
        Book b = new SuperBook("CXF in Action", 123L, 124L);
       
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        provider.writeTo(b, Book.class, Book.class,
                       new Annotation[0], MediaType.TEXT_XML_TYPE, new MetadataMap<String, Object>(), bos);
       
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.