Package org.apache.cxf.jaxb

Examples of org.apache.cxf.jaxb.JAXBDataBinding$CachedClassOrNull


        } catch (JAXBException jbe) {
            throw new IllegalStateException("Unable to create JAXBContext for generated packages: "
                                            + jbe.getMessage(), jbe);
        }
        
        JAXBDataBinding databinding = new JAXBDataBinding();
        databinding.setContext(context);
        svc.setDataBinding(databinding);

        ServiceInfo svcfo = client.getEndpoint().getEndpointInfo().getService();

        // Setup the new classloader!
View Full Code Here


                s.setInstanceId(instanceId);
                s.setMessageNumber(msgId.getAndIncrement());
                JAXBElement<AppSequenceType> seq = new ObjectFactory().createAppSequence(s);
                Header h = new Header(seq.getName(),
                                      seq,
                                      new JAXBDataBinding(getJAXBContext()));
                List<Header> headers = new ArrayList<Header>();
                headers.add(h);
                p.getRequestContext()
                    .put(Header.HEADER_LIST, headers);
            }
View Full Code Here

        baos.close();
    }
   
    @Test
    public void testSetProperty() throws Exception {
        JAXBDataBinding db = getTestWriterFactory();
              
        DataWriterImpl<XMLStreamWriter> dw = (DataWriterImpl<XMLStreamWriter>)db.createWriter(XMLStreamWriter.class);
        assertNotNull(dw);
       
        // Build message to set custom event handler
        org.apache.cxf.message.Message message = new org.apache.cxf.message.MessageImpl();
        message.put("jaxb-writer-validation-event-handler", new MyCustomHandler());
View Full Code Here

        assertTrue(((MyCustomHandler)dw.veventHandler).getUsed());      
    }

    @Test
    public void testWriteRPCLit1() throws Exception {
        JAXBDataBinding db = getTestWriterFactory();
       
        DataWriter<XMLStreamWriter> dw = db.createWriter(XMLStreamWriter.class);
        assertNotNull(dw);
       
        String val = new String("TESTOUTPUTMESSAGE");
        QName elName = new QName("http://apache.org/hello_world_rpclit/types",
                                 "in");
View Full Code Here

        assertEquals("TESTOUTPUTMESSAGE", reader.getText());
    }

    @Test
    public void testWriteRPCLit2() throws Exception {
        JAXBDataBinding db = getTestWriterFactory(MyComplexStruct.class);
       
        DataWriter<XMLStreamWriter> dw = db.createWriter(XMLStreamWriter.class);
        assertNotNull(dw);
       
        MyComplexStruct val = new MyComplexStruct();
        val.setElem1("This is element 1");
        val.setElem2("This is element 2");
View Full Code Here

        assertEquals("This is element 1", reader.getText());
    }

    @Test
    public void testWriteBare() throws Exception {
        JAXBDataBinding db = getTestWriterFactory(TradePriceData.class);
       
        DataWriter<XMLStreamWriter> dw = db.createWriter(XMLStreamWriter.class);
        assertNotNull(dw);
       
        TradePriceData val = new TradePriceData();
        val.setTickerSymbol("This is a symbol");
        val.setTickerPrice(1.0f);
View Full Code Here

        assertEquals("This is a symbol", reader.getText());
    }
   
    @Test
    public void testWriteWrapper() throws Exception {
        JAXBDataBinding db = getTestWriterFactory(GreetMe.class);
       
        DataWriter<XMLStreamWriter> dw = db.createWriter(XMLStreamWriter.class);
        assertNotNull(dw);

        GreetMe val = new GreetMe();
        val.setRequestType("Hello");
       
View Full Code Here

        assertEquals("Hello", reader.getText());
    }

    @Test
    public void testWriteWrapperReturn() throws Exception {
        JAXBDataBinding db = getTestWriterFactory(GreetMeResponse.class);
       
        DataWriter<XMLStreamWriter> dw = db.createWriter(XMLStreamWriter.class);
        assertNotNull(dw);

        GreetMeResponse retVal = new GreetMeResponse();
        retVal.setResponseType("TESTOUTPUTMESSAGE");
       
View Full Code Here

        assertEquals("TESTOUTPUTMESSAGE", reader.getText());
    }

    @Test
    public void testWriteWithNamespacePrefixMapping() throws Exception {
        JAXBDataBinding db = getTestWriterFactory(GreetMe.class);
        Map<String, String> nspref = new HashMap<String, String>();
        nspref.put("http://apache.org/hello_world_soap_http/types", "x");
        db.setNamespaceMap(nspref);
       
        // use the output stream instead of XMLStreamWriter to test
        DataWriter<OutputStream> dw = db.createWriter(OutputStream.class);
        assertNotNull(dw);

        GreetMe val = new GreetMe();
        val.setRequestType("Hello");
        dw.write(val, baos);
View Full Code Here

        assertEquals("Hello", reader.getText());
    }

    @Test
    public void testWriteWithContextualNamespaceDecls() throws Exception {
        JAXBDataBinding db = getTestWriterFactory(GreetMe.class);
        Map<String, String> nspref = new HashMap<String, String>();
        nspref.put("http://apache.org/hello_world_soap_http/types", "x");
        db.setNamespaceMap(nspref);
        db.setContextualNamespaceMap(nspref);
       
        // use the output stream instead of XMLStreamWriter to test
        DataWriter<OutputStream> dw = db.createWriter(OutputStream.class);
        assertNotNull(dw);

        GreetMe val = new GreetMe();
        val.setRequestType("Hello");
        dw.write(val, baos);
       
        String xstr = new String(baos.toByteArray());
       
        // there should be no namespace decls
        if (!db.getContext().getClass().getName().contains("eclipse")) {
            //bug in eclipse moxy
            //https://bugs.eclipse.org/bugs/show_bug.cgi?id=421463
           
            assertEquals("<x:greetMe><x:requestType>Hello</x:requestType></x:greetMe>", xstr);
        }
View Full Code Here

TOP

Related Classes of org.apache.cxf.jaxb.JAXBDataBinding$CachedClassOrNull

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.