Package org.objectweb.celtix.context

Examples of org.objectweb.celtix.context.InputStreamMessageContext


                   + "  received : " + client.getTargetEndpoint(),
                   address.equals(client.getTargetEndpoint().getAddress().getValue()));

        OutputStreamMessageContext octx = null;
        byte outBytes[] = "Hello World!!!".getBytes();
        InputStreamMessageContext ictx = doClientInvoke(client, octx, outBytes, false);

        byte bytes[] = new byte[10000];
        int len = ictx.getInputStream().read(bytes);
        assertTrue("Did not read anything " + len, len > 0);
        assertEquals(new String(outBytes), new String(bytes, 0, len));

        //long request
        outBytes = new byte[5000];
        for (int x = 0; x < outBytes.length; x++) {
            outBytes[x] = (byte)('a' + (x % 26));
        }

        ictx = doClientInvoke(client, octx, outBytes, false);
        int total = readBytes(bytes, ictx.getInputStream());

        assertTrue("Did not read anything " + total, total > 0);
        assertEquals(new String(outBytes), new String(bytes, 0, total));

        outBytes = "Hello World!!!".getBytes();

        server.deactivate();

        try {
            ictx = doClientInvoke(client, octx, outBytes, true);
            len = ictx.getInputStream().read(bytes);

            if (len != -1) {
                fail("was able to process a message after the servant was deactivated: " + len
                     + " - " + new String(bytes));
            }
        } catch (IOException ex) {
            //ignore - this is what we want
        }

        server.activate(callback);

        outBytes = "New String and must match with response".getBytes();
        ictx = doClientInvoke(client, octx, outBytes, false);
        len = ictx.getInputStream().read(bytes);
        assertTrue("Did not read anything " + len, len > 0);
        assertEquals(new String(outBytes), new String(bytes, 0, len));
        server.shutdown();
        client.shutdown();
    }
View Full Code Here


        HTTPClientTransport client = (HTTPClientTransport)
            createClientTransport(WSDL_URL, SERVICE_NAME, PORT_NAME, ADDRESS, false);

        Callable c = client.getInputStreamMessageContextCallable(octx);
        assertNotNull(c);
        InputStreamMessageContext result = (InputStreamMessageContext)c.call();
        assertEquals(result, ictx);
    }
View Full Code Here

        try {
            OutputStreamMessageContext octx = client.createOutputStreamContext(new GenericMessageContext());
            client.finalPrepareOutputStreamContext(octx);
            octx.getOutputStream().write(outBytes);
            octx.getOutputStream().close();
            InputStreamMessageContext ictx = client.invoke(octx);
            byte bytes[] = new byte[10000];
            int len = ictx.getInputStream().read(bytes);
            if (len != -1
                && new String(bytes, 0, len).indexOf("HTTP Status 503") == -1
                && new String(bytes, 0, len).indexOf("Error 404") == -1) {
                fail("was able to process a message after the servant was deactivated: " + len
                     + " - " + new String(bytes));
View Full Code Here

                break;
            }
            i++;
        }
        assertTrue(f.isDone());
        InputStreamMessageContext ictx = f.get();
        doResponse(client, ictx, outBytes, decoupled);

        // blocking read (on new thread)
        octx = doRequest(client, outBytes, false, decoupled);
        f = client.invokeAsync(octx, executor);
View Full Code Here

                                   byte outBytes[],
                                   boolean initial,
                                   boolean decoupled)
        throws Exception {
        OutputStreamMessageContext octx = doRequest(client, outBytes, initial, decoupled);
        InputStreamMessageContext ictx = client.invoke(octx);
        doResponse(client, ictx, outBytes, decoupled);
    }
View Full Code Here

        assertTrue(invoker.getInvokedHandlers().contains(protocolHandlers[1]));
    }
   
    protected void checkStreamHandlersInvoked(boolean outboundProperty, boolean requestorProperty) {
       
        InputStreamMessageContext istreamCtx = new TestInputStreamMessageContext(ctx);   
        invoker.invokeStreamHandlers(istreamCtx);
                
        assertNotNull(ctx.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY));
        assertEquals(outboundProperty, ctx.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY));
        assertNotNull(ctx.get(ObjectMessageContext.REQUESTOR_ROLE_PROPERTY));
View Full Code Here

        try {
            OutputStreamMessageContext ostreamCtx = request.process(null);

            if (null != ostreamCtx) {

                InputStreamMessageContext responseContext = clientTransport().invoke(ostreamCtx);
                Response fullResponse = null;
                if (BindingContextUtils.retrieveDecoupledResponse(responseContext)) {
                    // partial response traverses complete handler chain first
                    Response partialResponse = new Response(request);
                    partialResponse.processProtocol(responseContext);
View Full Code Here

               
                if (BindingContextUtils.isOnewayTransport(ostreamCtx)) {
                    clientTransport().invokeOneway(ostreamCtx);
                } else {
                    LOG.fine("Sending message as a twoway request as required by system handlers.");
                    InputStreamMessageContext istreamCtx = clientTransport().invoke(ostreamCtx);
                    Response response = new Response(request);    
                    response.processProtocol(istreamCtx);
                    response.processLogical(null);
                }               
            }
View Full Code Here

        public TestClientTransport(Bus mybus, EndpointReferenceType ref)
            throws WSDLException, IOException {      
        }

        public void invokeOneway(OutputStreamMessageContext context) throws IOException {
            InputStreamMessageContext ismc = context.getCorrespondingInputStreamContext();
            InputStream in = ismc.getInputStream();           
            try {
                SOAPMessage soapMessage = MessageFactory.newInstance().createMessage(null, in);
                assertEquals("Message should contain TestSOAPInputMessage",
                             soapMessage.getSOAPBody().getTextContent(),
                             "TestSOAPInputMessage");               
View Full Code Here

           
        }

        public Future<InputStreamMessageContext> invokeAsync(OutputStreamMessageContext context,
                                                             Executor e) throws IOException {
            InputStreamMessageContext ismc = context.getCorrespondingInputStreamContext();
            return new TestInputStreamMessageContextFuture(ismc);
        }
View Full Code Here

TOP

Related Classes of org.objectweb.celtix.context.InputStreamMessageContext

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.