Examples of FakeInboundRequest


Examples of com.sun.jini.test.spec.jeri.util.FakeInboundRequest

        // initialize FakeInboundRequest
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        out.write(0x00); //protocol version
        out.close();
        request = new FakeInboundRequest(
            new ByteArrayInputStream(out.toByteArray()));

        // call dispatch and verify the proper result
        dispatcher.dispatch(impl,request,context);
        response = request.getResponseStream();
        assertion(response.read() == -1);
        assertion(request.isAbortCalled());

        // iterate over test cases
        for (int i = 0; i < cases.length; i++) {
            logger.log(Level.FINE,"=================================");
            byte secondRequestByte = cases[i];
            logger.log(Level.FINE,"test case " + (counter++)
                + ": " + secondRequestByte);
            logger.log(Level.FINE,"");

            // initialize context
            context = new ArrayList();

            // initialize FakeInboundRequest
            request = new FakeInboundRequest(0,null,0x00,secondRequestByte);

            // call dispatch and verify the proper result
            dispatcher.dispatch(impl,request,context);
            assertion(context.size() > 0);
            Object contextElement = context.get(0);
View Full Code Here

Examples of com.sun.jini.test.spec.jeri.util.FakeInboundRequest

            + ": IOException thrown from FakeArgument.readObject()");
        logger.log(Level.FINE,"");

        // initialize FakeInboundRequest
        Object[] args = { new FakeArgument(null, new IOException()) };
        request = new FakeInboundRequest(methodHash,args,0x00,0x00);

        // call dispatch and verify the proper result
        dispatcher.dispatch(impl,request,context);
        response = request.getResponseStream();
        assertion(response.read() == 0x02);
        checkUnmarshallingException(new IOException(), response);

        // iterate over test cases
        for (int i = 0; i < cases.length; i++) {
            logger.log(Level.FINE,"=================================");
            Throwable unmarshalArgumentsException = cases[i];
            logger.log(Level.FINE,"test case " + (counter++)
                +": unmarshalArgs exception: "+unmarshalArgumentsException);
            logger.log(Level.FINE,"");

            // initialize FakeBasicInvocationDispatcher
            dispatcher.setUnmarshalArgumentsException(
                unmarshalArgumentsException);

            // initialize FakeInboundRequest
            request = new FakeInboundRequest(methodHash,nullArgs,0x00,0x00);

            // call dispatch and verify the proper result
            dispatcher.dispatch(impl,request,context);
            response = request.getResponseStream();
            assertion(response.read() == 0x02);
View Full Code Here

Examples of com.sun.jini.test.spec.jeri.util.FakeInboundRequest

            // initialize FakeBasicInvocationDispatcher
            dispatcher.setCreateMarshalOutputStreamException(
                createMarshalOutputStreamException);

            // initialize FakeInboundRequest
            request = new FakeInboundRequest(methodHash,nullArgs,0x00,0x00);

            // call dispatch and verify the proper result
            dispatcher.dispatch(impl,request,context);
            response = request.getResponseStream();
            int read = response.read();
View Full Code Here

Examples of com.sun.jini.test.spec.jeri.util.FakeInboundRequest

        TrustVerifier rVerifier = new FakeTrustVerifier();
        Method mSend = ProxyTrust.class.getMethod("getProxyVerifier",null);
        Method mReceive = fic.getMethod("getProxyVerifier",null);
        handler.init(null,mReceive,null,rVerifier);
        long methodHash = Util.computeMethodHash(mSend);
        request = new FakeInboundRequest(methodHash,null,0x00,0x00);
        dispatcher.dispatch(fi,request,context);
        check(request,mReceive,rVerifier);
    }
View Full Code Here

Examples of com.sun.jini.test.spec.jeri.util.FakeInboundRequest

    private void initTestCase(Method method, Object[] args,
        Object returnObject) throws IOException
    {
        handler.init(null,method,args,returnObject);
        long methodHash = Util.computeMethodHash(method);
        request = new FakeInboundRequest(methodHash,args,0x00,0x00);
    }
View Full Code Here

Examples of com.sun.jini.test.spec.jeri.util.FakeInboundRequest

            + ": no integrity"
            + ",checkConstraints return: " + checkConstraintsReturn);
        logger.log(Level.FINE,"");

        // initialize FakeInboundRequest
        request = new FakeInboundRequest(methodHash,nullArgs,0x00,0x00);
        request.setCheckConstraintsReturn(checkConstraintsReturn);

        // call dispatch and verify the proper result
        dispatcher.dispatch(impl,request,context);
        response = request.getResponseStream();
        assertion(response.read() == 0x02);
        checkUnmarshallingException(
            new UnsupportedConstraintException(""), response);

        checkConstraintsReturn =
            new InvocationConstraints(new InvocationConstraint[]
                {Integrity.NO, Confidentiality.YES}, null);
        logger.log(Level.FINE,"=================================");
        logger.log(Level.FINE,"test case " + (counter++)
            + ": integrity"
            + ",checkConstraints return: " + checkConstraintsReturn);
        logger.log(Level.FINE,"");

        // initialize FakeInboundRequest
        request = new FakeInboundRequest(methodHash,nullArgs,0x00,0x01);
        request.setCheckConstraintsReturn(checkConstraintsReturn);

        // call dispatch and verify the proper result
        dispatcher.dispatch(impl,request,context);
        response = request.getResponseStream();
View Full Code Here

Examples of com.sun.jini.test.spec.jeri.util.FakeInboundRequest

            // initialize FakeRemoteImpl
            impl.setFakeMethodException(invokeException);

            // initialize FakeInboundRequest
            request = new FakeInboundRequest(methodHash,nullArgs,0x00,0x00);

            // call dispatch and verify the proper result
            dispatcher.dispatch(impl,request,context);
            response = request.getResponseStream();
            assertion(response.read() == 0x02);
View Full Code Here

Examples of com.sun.jini.test.spec.jeri.util.FakeInboundRequest

            logger.log(Level.FINE,"test case " + (counter++)
                + ": checkAccess exception: " + checkAccessException);
            logger.log(Level.FINE,"");

            // initialize FakeInboundRequest
            request = new FakeInboundRequest(methodHash,nullArgs,0x00,0x00);

            // initialize FakeBasicInvocationDispatcher
            dispatcher.setCheckAccessException(checkAccessException);

            // call dispatch and verify the proper result
View Full Code Here

Examples of com.sun.jini.test.spec.jeri.util.FakeInboundRequest

            logger.log(Level.FINE,"test case " + (counter++)
                +": checkConstraints exception:"+checkConstraintsException);
            logger.log(Level.FINE,"");

            // initialize FakeInboundRequest
            request = new FakeInboundRequest(methodHash,nullArgs,0x00,0x00);
            request.setCheckConstraintsException(checkConstraintsException);

            // call dispatch and verify the proper result
            dispatcher.dispatch(impl,request,context);
            response = request.getResponseStream();
View Full Code Here

Examples of com.sun.jini.test.spec.jeri.util.FakeInboundRequest

        logger.log(Level.FINE,"test case " + (counter++)
            + ": bogus method hash");
        logger.log(Level.FINE,"");

        // initialize FakeInboundRequest
        request = new FakeInboundRequest(0,null,0x00,0x00);

        // call dispatch and verify the proper result
        dispatcher.dispatch(impl,request,context);
        response = request.getResponseStream();
        assertion(response.read() == 0x02);
        checkUnmarshallingException(new NoSuchMethodException(), response);

        // iterate over test cases
        for (int i = 0; i < cases.length; i++) {
            logger.log(Level.FINE,"=================================");
            Throwable unmarshalMethodException = cases[i];
            logger.log(Level.FINE,"test case " + (counter++)
                + ": unmarshalMethod exception:" +unmarshalMethodException);
            logger.log(Level.FINE,"");

            // initialize FakeBasicInvocationDispatcher
            dispatcher.setUnmarshalMethodException(
                unmarshalMethodException);

            // initialize FakeInboundRequest
            request = new FakeInboundRequest(0,null,0x00,0x00);

            // call dispatch and verify the proper result
            dispatcher.dispatch(impl,request,context);
            response = request.getResponseStream();
            assertion(response.read() == 0x02);
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.