Package net.jini.jeri

Examples of net.jini.jeri.BasicObjectEndpoint$AckListener


        int counter = 1;
        Uuid uuid;
        FakeEndpoint endpoint;
        FakeOutboundRequestIterator fakeIterator;
        OutboundRequestIterator iterator;
        BasicObjectEndpoint boe;
        FakeOutputStream fos;
        FakeOutboundRequest request;

        logger.log(Level.FINE,"=================================");
        logger.log(Level.FINE,"test case " + (counter++)
            + ": newCall with null InvocationConstraints");
        logger.log(Level.FINE,"");

        uuid = UuidFactory.create(1,2);
        endpoint = new FakeEndpoint(new FakeOutboundRequestIterator(null));
        boe = new BasicObjectEndpoint(endpoint,uuid,false);
        try {
            boe.newCall(null);
            throw new AssertionError("newCall(null) should fail");
        } catch (NullPointerException ignore) {}

        for (int i = 0; i < cases.length; i++) {
            logger.log(Level.FINE,"=================================");
            Throwable nextException = cases[i];
            logger.log(Level.FINE,"test case " + (counter++)
                + ": nextException:" + nextException);
            logger.log(Level.FINE,"");

            // Test Case: OutboundRequestIterator.next throws exception

            uuid = UuidFactory.create(1,2);
            fakeIterator = new FakeOutboundRequestIterator(null);
            fakeIterator.setNextException(nextException);
            endpoint = new FakeEndpoint(fakeIterator);
            boe = new BasicObjectEndpoint(endpoint,uuid,false);

            iterator = boe.newCall(InvocationConstraints.EMPTY);
            try {
                iterator.next();
                throw new AssertionError("next() should fail");
            } catch (Throwable caught) {
                assertion(nextException.equals(caught),
                    caught.toString());
            }

            // Test Case: Uuid.write throws exception

            fos = new FakeOutputStream(nextException);
            request = new FakeOutboundRequest();
            request.setRequestOutputStream(fos);
            fakeIterator = new FakeOutboundRequestIterator(request);
            endpoint = new FakeEndpoint(fakeIterator);
            boe = new BasicObjectEndpoint(endpoint,uuid,false);

            iterator = boe.newCall(InvocationConstraints.EMPTY);
            try {
                iterator.next();
                throw new AssertionError("next() should fail");
            } catch (Throwable caught) {
                assertion(nextException.equals(caught),
View Full Code Here


    }

    // inherit javadoc
    public void run() throws Exception {
        int counter = 1;
        BasicObjectEndpoint boe1;
        BasicObjectEndpoint boe2;

        logger.log(Level.FINE,"=================================");
        boe1 = new BasicObjectEndpoint(fakeTrustedEndpoint,uuid1,false);
        logger.log(Level.FINE,"test case " + (counter++) + ": "
            + ",BasicObjectEndpoint1: " + boe1
            + ",BasicObjectEndpoint2: new Object()");
        logger.log(Level.FINE,"");

        assertion(! boe1.checkTrustEquivalence(new Object()));

        for (int i = 0; i < cases.length; i++) {
            for (int j = 0; j < cases.length; j++) {
                boe1 = new BasicObjectEndpoint(
                    (FakeEndpoint)cases[i][0],
                    (Uuid)cases[i][1],
                    ((Boolean)cases[i][2]).booleanValue());
                boe2 = new BasicObjectEndpoint(
                    (FakeEndpoint)cases[j][0],
                    (Uuid)cases[j][1],
                    ((Boolean)cases[j][2]).booleanValue());

                logger.log(Level.FINE,"=================================");
View Full Code Here

    // inherit javadoc
    public void run() throws Exception {
        int counter = 1;
        Uuid uuid = UuidFactory.create(1,2);
        FakeOutboundRequest request = new FakeOutboundRequest();
        BasicObjectEndpoint boe = new BasicObjectEndpoint(
             new FakeEndpoint(new FakeOutboundRequestIterator(request)),
             uuid,false);
        OutboundRequestIterator iterator =
            boe.newCall(InvocationConstraints.EMPTY);

        logger.log(Level.FINE,"=================================");
        logger.log(Level.FINE,"test case " + (counter++)
            + ": hasNext returns true");
        logger.log(Level.FINE,"");
View Full Code Here

        FakeOutboundRequest fakeRequest = new FakeOutboundRequest();
        FakeOutboundRequestIterator iterator =
            new FakeOutboundRequestIterator(fakeRequest);
        FakeEndpoint ep = new FakeEndpoint(iterator);
        Uuid uuid = UuidFactory.create(1,2);
        BasicObjectEndpoint boe = new BasicObjectEndpoint(ep,uuid,false);

        logger.log(Level.FINE,"=================================");
        logger.log(Level.FINE,"test case " + (counter++)
            + ": reading response input stream returns 0x00");
        logger.log(Level.FINE,"");

        iterator.init();
        fakeRequest.setResponseInputStream(new FakeInputStream(null,0x00));
        request = boe.newCall(InvocationConstraints.EMPTY).next();
        assertion(
            boe.executeCall(request) instanceof NoSuchObjectException);

        logger.log(Level.FINE,"=================================");
        logger.log(Level.FINE,"test case " + (counter++)
            + ": reading response input stream returns 0x01");
        logger.log(Level.FINE,"");

        iterator.init();
        fakeRequest.setResponseInputStream(new FakeInputStream(null,0x01));
        request = boe.newCall(InvocationConstraints.EMPTY).next();
        assertion(boe.executeCall(request) == null);

        logger.log(Level.FINE,"=================================");
        logger.log(Level.FINE,"test case " + (counter++)
            + ": reading response input stream returns 0x02");
        logger.log(Level.FINE,"");

        iterator.init();
        fakeRequest.setResponseInputStream(new FakeInputStream(null,0x02));
        request = boe.newCall(InvocationConstraints.EMPTY).next();
        assertion(
            boe.executeCall(request) instanceof UnmarshalException);
    }
View Full Code Here

    public void setup(QAConfig sysConfig) throws Exception {
    }

    // inherit javadoc
    public void run() throws Exception {
        BasicObjectEndpoint boe;
        Endpoint ep = new FakeEndpoint(new FakeOutboundRequestIterator(
            new FakeOutboundRequest(),false));
        Uuid uuid = UuidFactory.create(1,2);

        logger.log(Level.FINE,"=================================");
        logger.log(Level.FINE,"test case 1: "
            + "BasicObjectEndpoint(null,null,false)");
        logger.log(Level.FINE,"");

        try {
            boe = new BasicObjectEndpoint(null,null,false);
            assertion(false);
        } catch (NullPointerException ignore) {
        }

        logger.log(Level.FINE,"=================================");
        logger.log(Level.FINE,"test case 2: "
            + "BasicObjectEndpoint(Endpoint,null,false)");
        logger.log(Level.FINE,"");

        try {
            boe = new BasicObjectEndpoint(ep,null,false);
            assertion(false);
        } catch (NullPointerException ignore) {
        }

        logger.log(Level.FINE,"=================================");
        logger.log(Level.FINE,"test case 3: "
            + "BasicObjectEndpoint(null,Uuid,false)");
        logger.log(Level.FINE,"");

        try {
            boe = new BasicObjectEndpoint(null,uuid,false);
            assertion(false);
        } catch (NullPointerException ignore) {
        }

        logger.log(Level.FINE,"=================================");
        logger.log(Level.FINE,"test case 4: "
            + "accessor methods return constructor args");
        logger.log(Level.FINE,"");

        boe = new BasicObjectEndpoint(ep,uuid,true);
        assertion(boe.getEndpoint() == ep);
        assertion(boe.getObjectIdentifier() == uuid);
        assertion(boe.getEnableDGC() == true);

        boe = new BasicObjectEndpoint(ep,uuid,false);
        assertion(boe.getEnableDGC() == false);
    }
View Full Code Here

            if (handler instanceof BasicInvocationHandler){
                //Verify that the underlying endpoint is an instance of
                //TcpEnpoint.
                //!!!This code assumes implementation detail: ObjectEnpoint
                //implementation class is BasicObjectEndpoint
                BasicObjectEndpoint oe = (BasicObjectEndpoint)
                    ((BasicInvocationHandler) handler).getObjectEndpoint();
                Endpoint ep = oe.getEndpoint();
                if (ep instanceof TcpEndpoint) {
                    //OK
                } else {
                    throw new TestException( "The Enpoint "
                        + " contained in the stub is not an instance"
View Full Code Here

TOP

Related Classes of net.jini.jeri.BasicObjectEndpoint$AckListener

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.