Examples of Book2


Examples of org.apache.cxf.jaxrs.fortest.jaxb.packageinfo.Book2

   
    @Path("book2")
    @GET
    @XMLName(value = "{http://books}thesuperbook2", prefix = "p1")
    public Book2 getBook2() {
        return new Book2();
    }
View Full Code Here

Examples of org.apache.cxf.jaxrs.fortest.jaxb.packageinfo.Book2

    }
   
    @Test
    public void testWriteWithXmlRootElementAndPackageInfo() throws Exception {
        JAXBElementProvider<Book2> provider = new JAXBElementProvider<Book2>();
        Book2 book = new Book2(333);
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        provider.writeTo(book, Book2.class,
                         Book2.class,
                         new Annotation[0], MediaType.TEXT_XML_TYPE,
                         new MetadataMap<String, Object>(), bos);
        assertTrue(bos.toString().contains("thebook2"));
        assertTrue(bos.toString().contains("http://superbooks"));
        ByteArrayInputStream is = new ByteArrayInputStream(bos.toByteArray());
        Book2 book2 = provider.readFrom(
                       Book2.class,
                       Book2.class,
                       new Annotation[0], MediaType.TEXT_XML_TYPE, new MetadataMap<String, String>(), is);
        assertEquals(book2.getId(), book.getId());
    }
View Full Code Here

Examples of org.apache.cxf.jaxrs.fortest.jaxb.packageinfo.Book2

        assertNotNull("schema can not be read from disk", s);
       
        provider.setValidateOutput(true);
        provider.setValidateBeforeWrite(true);
       
        Book2 book2 = new Book2();
       
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        provider.writeTo(book2, Book2.class, Book2.class, new Annotation[]{}, MediaType.TEXT_XML_TYPE,
                         new MetadataMap<String, Object>(), bos);
       
View Full Code Here

Examples of org.apache.cxf.jaxrs.fortest.jaxb.packageinfo.Book2

       
        provider.setValidateOutput(true);
        provider.setValidateBeforeWrite(true);

        try {
            provider.writeTo(new Book2(), Book2.class, Book2.class, new Annotation[]{},
                             MediaType.TEXT_XML_TYPE,
                             new MetadataMap<String, Object>(), new ByteArrayOutputStream());
            fail("Validation exception expected");
        } catch (Exception ex) {
            Throwable cause = ex.getCause();
View Full Code Here

Examples of org.apache.cxf.jaxrs.fortest.jaxb.packageinfo.Book2

    }
   
    @Path("book2")
    @GET
    public Book2 getBook2() {
        return new Book2();
    }
View Full Code Here

Examples of org.apache.cxf.jaxrs.fortest.jaxb.packageinfo.Book2

   
    @Path("book2")
    @GET
    @XMLName(value = "{http://books}thesuperbook2", prefix = "p1")
    public Book2 getBook2() {
        return new Book2();
    }
View Full Code Here

Examples of org.apache.cxf.jaxrs.fortest.jaxb.packageinfo.Book2

   
    @SuppressWarnings("unchecked")
    @Test
    public void testWriteWithXmlRootElementAndPackageInfo() throws Exception {
        JAXBElementProvider provider = new JAXBElementProvider();
        Book2 book = new Book2(333);
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        provider.writeTo(book, Book2.class,
                         Book2.class,
                         new Annotation[0], MediaType.TEXT_XML_TYPE,
                         new MetadataMap<String, Object>(), bos);
        assertTrue(bos.toString().contains("thebook2"));
        assertTrue(bos.toString().contains("http://superbooks"));
       
        ByteArrayInputStream is = new ByteArrayInputStream(bos.toByteArray());
        Book2 book2 =
            (Book2)provider.readFrom(
                       (Class)Book2.class,
                       Book2.class,
                       new Annotation[0], MediaType.TEXT_XML_TYPE, new MetadataMap<String, String>(), is);
        assertEquals(book2.getId(), book.getId());
    }
View Full Code Here

Examples of org.apache.cxf.jaxrs.fortest.jaxb.packageinfo.Book2

        assertNotNull("schema can not be read from disk", s);
       
        provider.setValidateOutput(true);
        provider.setValidateBeforeWrite(true);
       
        Book2 book2 = new Book2();
       
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        provider.writeTo(book2, Book2.class, Book2.class, new Annotation[]{}, MediaType.TEXT_XML_TYPE,
                         new MetadataMap<String, Object>(), bos);
       
View Full Code Here

Examples of org.apache.cxf.jaxrs.fortest.jaxb.packageinfo.Book2

       
        provider.setValidateOutput(true);
        provider.setValidateBeforeWrite(true);

        try {
            provider.writeTo(new Book2(), Book2.class, Book2.class, new Annotation[]{},
                             MediaType.TEXT_XML_TYPE,
                             new MetadataMap<String, Object>(), new ByteArrayOutputStream());
            fail("Validation exception expected");
        } catch (Exception ex) {
            Throwable cause = ex.getCause();
View Full Code Here

Examples of org.apache.cxf.jaxrs.fortest.jaxb.packageinfo.Book2

   
    @Path("book2")
    @GET
    @XMLName(value = "{http://books}thesuperbook2", prefix = "p1")
    public Book2 getBook2() {
        return new Book2();
    }
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.