Package org.objectweb.handler_test.types

Examples of org.objectweb.handler_test.types.PingResponse


                    Boolean outbound = (Boolean)ctx.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
                    if (outbound) {
                        LogicalMessage msg = ctx.getMessage();
                        assertNotNull("logical message is null", msg);
                        JAXBContext jaxbCtx = JAXBContext.newInstance(GreetMe.class.getPackage().getName());
                        PingResponse resp = new PingResponse();
                        resp.getHandlersInfo().add(clientHandlerMessage);

                        msg.setPayload(resp, jaxbCtx);
                    }

                } catch (Exception e) {
                    e.printStackTrace();
                    fail(e.toString());
                }
                return false;
            }
        };       
       
        addHandlersToChain((BindingProvider)handlerTest, handler1, handler2);

        List<String> resp = handlerTest.ping();
        assertEquals(clientHandlerMessage, resp.get(0));
       
        assertEquals("handler must be invoked for inbound & outbound message",
                     2, handler1.getHandleMessageInvoked());
        assertEquals("second handler must be invoked exactly once", 1, handler2.getHandleMessageInvoked());
        assertTrue("close must be  called", handler1.isCloseInvoked());
View Full Code Here


            if (getHandlerId().equals(hid)
                && "inbound".equals(direction)) {
               
                if ("stop".equals(command)) {
                    PingResponse resp = new PingResponse();
                    getHandlerInfoList(ctx).add(getHandlerId());
                    resp.getHandlersInfo().addAll(getHandlerInfoList(ctx));
                    msg.setPayload(resp, jaxbCtx);
                    ret = false;
                } else if ("throw".equals(command)) {
                    throwException(strtok.nextToken());
                }
View Full Code Here

    private void addHandlerId(LogicalMessage msg, T ctx, boolean outbound) {

        Object obj = msg.getPayload(jaxbCtx);
        if (obj instanceof PingResponse) {
            PingResponse origResp = (PingResponse)obj;
            PingResponse newResp = new PingResponse();
            newResp.getHandlersInfo().addAll(origResp.getHandlersInfo());
            newResp.getHandlersInfo().add(getHandlerId());
            msg.setPayload(newResp, jaxbCtx);
        } else if (!outbound && obj == null) {
            getHandlerInfoList(ctx).add(getHandlerId());
        }
    }
View Full Code Here

    public void testSetWrappedPartList() throws Exception {
        List<String> list = new ArrayList<String>();
        list.add("arg0");
        list.add("arg1");
       
        PingResponse wrapper = new PingResponse();
        assertNotNull(wrapper.getHandlersInfo());
        assertEquals(0, wrapper.getHandlersInfo().size());
        WrapperHelper.setWrappedPart("handlersInfo", wrapper, list);
        assertEquals(2, wrapper.getHandlersInfo().size());
        assertEquals(list, wrapper.getHandlersInfo());
    }
View Full Code Here

TOP

Related Classes of org.objectweb.handler_test.types.PingResponse

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.