Package test

Examples of test.EchoString


        TestLogger.logger.debug("---------------------------------------");
        TestLogger.logger.debug("test: " + getName());

        // Create the input param
        ObjectFactory factory = new ObjectFactory();
        EchoString echoString = factory.createEchoString();        
        echoString.setInput("SYNC JAXB MESSAGETEST");
       
        JAXBElement<Envelope> request = createJAXBEnvelope();
        request.getValue().getBody().getAny().add(echoString);
       
        jbc.createMarshaller().marshal(request,System.out);
View Full Code Here


        TestLogger.logger.debug("---------------------------------------");
        TestLogger.logger.debug("test: " + getName());
       
        // Create the input param
        ObjectFactory factory = new ObjectFactory();
        EchoString echoString = factory.createEchoString();        
        echoString.setInput("ASYNC(CALLBACK) JAXB MESSAGE TEST");
       
        JAXBElement<Envelope> request = createJAXBEnvelope();
        request.getValue().getBody().getAny().add(echoString);
       
       
View Full Code Here

        TestLogger.logger.debug("---------------------------------------");
        TestLogger.logger.debug("test: " + getName());

        // Create the input param
        ObjectFactory factory = new ObjectFactory();
        EchoString echoString = factory.createEchoString();        
        echoString.setInput("ONE-WAY JAXB MESSAGE TEST");
       
        JAXBElement<Envelope> request = createJAXBEnvelope();
        request.getValue().getBody().getAny().add(echoString);
       
        // Invoke the Dispatch<Object> one-way
View Full Code Here

    * @throws Exception
    */
   public void testSimple() throws Exception {
       Dispatch<Object> dispatch = getDispatch();
       ObjectFactory factory = new ObjectFactory();
       EchoString request = factory.createEchoString();        
       request.setInput("SYNC JAXB XML PAYLOAD TEST");
      
       // Invoke the Dispatch<Object>
       TestLogger.logger.debug(">> Invoking sync Dispatch with JAX-B Parameter");
       EchoString response = (EchoString) dispatch.invoke(request);
      
       assertNotNull(response);

       TestLogger.logger.debug(">> Response content: " + response.getInput());
      
       assertTrue("[ERROR] - Response object was null", response != null);
       assertTrue("[ERROR] - No content in response object", response.getInput() != null);
       assertTrue("[ERROR] - Zero length content in response", response.getInput().length() > 0);
       assertTrue(response.getInput().equals(request.getInput()));
      
       // Test a second time to verify
       // Invoke the Dispatch<Object>
       TestLogger.logger.debug(">> Invoking sync Dispatch with JAX-B Parameter");
       response = (EchoString) dispatch.invoke(request);
      
       assertNotNull(response);

       TestLogger.logger.debug(">> Response content: " + response.getInput());
      
       assertTrue("[ERROR] - Response object was null", response != null);
       assertTrue("[ERROR] - No content in response object", response.getInput() != null);
       assertTrue("[ERROR] - Zero length content in response", response.getInput().length() > 0);
       assertTrue(response.getInput().equals(request.getInput()));

   }
View Full Code Here

        JAXBBlockFactory f = (JAXBBlockFactory)
        FactoryRegistry.getFactory(JAXBBlockFactory.class);

        // Create a jaxb object
        ObjectFactory factory = new ObjectFactory();
        EchoString jaxb = factory.createEchoString();
        jaxb.setInput("Hello World");
        JAXBBlockContext context = new JAXBBlockContext(EchoString.class.getPackage().getName());

        JAXBIntrospector jbi = JAXBUtils.getJAXBIntrospector(context.getJAXBContext());
        QName expectedQName = jbi.getElementName(jaxb);
View Full Code Here

        JAXBBlockFactory f = (JAXBBlockFactory)
        FactoryRegistry.getFactory(JAXBBlockFactory.class);

        // Create a jaxb object
        ObjectFactory factory = new ObjectFactory();
        EchoString jaxb = factory.createEchoString();
        jaxb.setInput("Hello World");
        JAXBBlockContext context = new JAXBBlockContext(EchoString.class.getPackage().getName());

        JAXBIntrospector jbi = JAXBUtils.getJAXBIntrospector(context.getJAXBContext());
        QName expectedQName = jbi.getElementName(jaxb);
View Full Code Here

        JAXBBlockFactory f = (JAXBBlockFactory)
        FactoryRegistry.getFactory(JAXBBlockFactory.class);

        // Create a jaxb object
        ObjectFactory factory = new ObjectFactory();
        EchoString jaxb = factory.createEchoString();
        jaxb.setInput("Hello World");
        JAXBBlockContext context = new JAXBBlockContext(EchoString.class.getPackage().getName());

        // On inbound, there will already be a XMLStreamReader (probably from OM)
        // which represents the message.  We will simulate this with inflow.
        StringWriter sw = new StringWriter();
        XMLStreamWriter writer = outputFactory.createXMLStreamWriter(sw);
        Marshaller marshaller = JAXBUtils.getJAXBMarshaller(context.getJAXBContext());
        marshaller.marshal(jaxb, writer);
        JAXBUtils.releaseJAXBMarshaller(context.getJAXBContext(), marshaller);
        writer.flush();
        sw.flush();
        StringReader sr = new StringReader(sw.toString());
        XMLStreamReader inflow = inputFactory.createXMLStreamReader(sr);

        // Create a Block from the inflow. 
        Block block = f.createFrom(inflow, context, null);

        // Assuming no handlers are installed, the next thing that will happen
        // is the proxy code will ask for the business object.
        Object bo = block.getBusinessObject(true);
        assertTrue(bo instanceof EchoString);

        // The block should be consumed
        assertTrue(block.isConsumed());

        // Check for accuracy
        assertTrue("Unexpected:" + ((EchoString)bo).getInput(), ((EchoString)bo).getInput().equals(jaxb.getInput()));

    }
View Full Code Here

        JAXBBlockFactory f = (JAXBBlockFactory)
        FactoryRegistry.getFactory(JAXBBlockFactory.class);

        // Create a jaxb object
        ObjectFactory factory = new ObjectFactory();
        EchoString jaxb = factory.createEchoString();
        jaxb.setInput("Hello World");
        JAXBBlockContext context = new JAXBBlockContext(EchoString.class.getPackage().getName());

        JAXBIntrospector jbi = JAXBUtils.getJAXBIntrospector(context.getJAXBContext());
        QName expectedQName = jbi.getElementName(jaxb);

        // On inbound, there will already be a XMLStreamReader (probably from OM)
        // which represents the message.  We will simulate this with inflow.
        StringWriter sw = new StringWriter();
        XMLStreamWriter writer = outputFactory.createXMLStreamWriter(sw);
        Marshaller marshaller = JAXBUtils.getJAXBMarshaller(context.getJAXBContext());
        marshaller.marshal(jaxb, writer);
        JAXBUtils.releaseJAXBMarshaller(context.getJAXBContext(), marshaller);
        writer.flush();
        sw.flush();
        StringReader sr = new StringReader(sw.toString());
        XMLStreamReader inflow = inputFactory.createXMLStreamReader(sr);

        // Create a Block from the inflow. 
        Block block = f.createFrom(inflow, context, null);

        // Assume that we need to find the QName (perhaps to identify the operation and
        // determine if handlers are installed).   This is not very perfomant since
        // it causes an underlying parse of the String...but we need to support this.
        QName qName = block.getQName();
        assertTrue("Expected: " + expectedQName + " but found: " + qName, expectedQName.equals(qName));

        // Assuming no handlers are installed, the next thing that will happen
        // is the proxy code will ask for the business object.
        Object bo = block.getBusinessObject(true);
        assertTrue(bo instanceof EchoString);

        // The block should be consumed
        assertTrue(block.isConsumed());

        // Check for accuracy
        assertTrue("Unexpected:" + ((EchoString)bo).getInput(), ((EchoString)bo).getInput().equals(jaxb.getInput()));

    }
View Full Code Here

        JAXBBlockFactory f = (JAXBBlockFactory)
        FactoryRegistry.getFactory(JAXBBlockFactory.class);

        // Create a jaxb object
        ObjectFactory factory = new ObjectFactory();
        EchoString jaxb = factory.createEchoString();
        jaxb.setInput("Hello World");
        JAXBBlockContext context = new JAXBBlockContext(EchoString.class.getPackage().getName());

        JAXBIntrospector jbi = JAXBUtils.getJAXBIntrospector(context.getJAXBContext());
        QName expectedQName = jbi.getElementName(jaxb);

        // On inbound, there will already be a XMLStreamReader (probably from OM)
        // which represents the message.  We will simulate this with inflow.
        StringWriter sw = new StringWriter();
        XMLStreamWriter writer = outputFactory.createXMLStreamWriter(sw);
        Marshaller marshaller = JAXBUtils.getJAXBMarshaller(context.getJAXBContext());
        marshaller.marshal(jaxb, writer);
        JAXBUtils.releaseJAXBMarshaller(context.getJAXBContext(), marshaller);
        writer.flush();
        sw.flush();
        StringReader sr = new StringReader(sw.toString());
        XMLStreamReader inflow = inputFactory.createXMLStreamReader(sr);

        // Create a Block from the inflow. 
        Block block = f.createFrom(inflow, context, expectedQName);

        // We passed in a qname, so the following should return true
        assertTrue(block.isQNameAvailable());

        // Assume that we need to find the QName (perhaps to identify the operation and
        // determine if handlers are installed).   This is not very perfomant since
        // it causes an underlying parse of the String...but we need to support this.
        QName qName = block.getQName();
        assertTrue("Expected: " + expectedQName + " but found: " + qName, expectedQName.equals(qName));

        // Assuming no handlers are installed, the next thing that will happen
        // is the proxy code will ask for the business object.
        Object bo = block.getBusinessObject(true);
        assertTrue(bo instanceof EchoString);
        assertTrue(bo != jaxb);

        // The block should be consumed
        assertTrue(block.isConsumed());

        // Check for accuracy
        assertTrue("Unexpected:" + ((EchoString)bo).getInput(), ((EchoString)bo).getInput().equals(jaxb.getInput()));

    }
View Full Code Here

        JAXBBlockFactory f = (JAXBBlockFactory)
        FactoryRegistry.getFactory(JAXBBlockFactory.class);

        // Create a jaxb object
        ObjectFactory factory = new ObjectFactory();
        EchoString jaxb = factory.createEchoString();
        jaxb.setInput("Hello World");
        JAXBBlockContext context = new JAXBBlockContext(EchoString.class.getPackage().getName());
        JAXBContext jaxbContext = context.getJAXBContext();

        JAXBIntrospector jbi = JAXBUtils.getJAXBIntrospector(jaxbContext);
        QName expectedQName = jbi.getElementName(jaxb);

        // On inbound, there will already be a probably be an OM
        // which represents the message.  In this scenario, the OM contains
        // a OMSourcedElement that is backed by EchoString.
        OMFactory omFactory = OMAbstractFactory.getOMFactory();
        JAXBDSContext dsContext = new JAXBDSContext(jaxbContext);
        JAXBDataSource ds = new JAXBDataSource(jaxb, dsContext);
        OMNamespace ns = omFactory.createOMNamespace(expectedQName.getNamespaceURI(), "pre");
        OMElement om = omFactory.createOMElement(ds, expectedQName.getLocalPart(), ns);
       

        // Create a Block from the inflow. 
        Block block = f.createFrom(om, context, expectedQName);

        // We passed in a qname, so the following should return true
        assertTrue(block.isQNameAvailable());

        // Assume that we need to find the QName (perhaps to identify the operation and
        // determine if handlers are installed).  
        QName qName = block.getQName();
        assertTrue("Expected: " + expectedQName + " but found: " + qName, expectedQName.equals(qName));

        // Assuming no handlers are installed, the next thing that will happen
        // is the proxy code will ask for the business object.
        Object bo = block.getBusinessObject(true);
        assertTrue(bo instanceof EchoString);
       
        // Since the EchoString was already provided in a data source, this
        // object should be same as the original echoString
        assertTrue(bo == jaxb);

        // The block should be consumed
        assertTrue(block.isConsumed());

        // Check for accuracy
        assertTrue("Unexpected:" + ((EchoString)bo).getInput(), ((EchoString)bo).getInput().equals(jaxb.getInput()));

    }
View Full Code Here

TOP

Related Classes of test.EchoString

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.