Examples of FakeOutboundRequest


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

    }

    // inherit javadoc
    public void run() throws Exception {
        FakeEndpoint ep1 = new FakeEndpoint(new FakeOutboundRequestIterator(
            new FakeOutboundRequest(),false));
        FakeEndpoint ep2 = new FakeEndpoint(new FakeOutboundRequestIterator(
            new FakeOutboundRequest(),false));
        Uuid uuid1 = UuidFactory.create(1,2);
        Uuid uuid2 = UuidFactory.create(2,1);

        logger.log(Level.FINE,"=================================");
        logger.log(Level.FINE,"test case 1: "
View Full Code Here

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

    // inherit javadoc
    public void setup(QAConfig sysConfig) throws Exception {
        // setup infrastructure needed by test
        counter = 1;

        request = new FakeOutboundRequest();
        iterator = new FakeOutboundRequestIterator(request);
        objectEndpoint = new FakeObjectEndpoint(iterator);
        handler = new FakeBasicInvocationHandler(
            objectEndpoint,      // objectEndpoint
            null);               // serverConstraints
View Full Code Here

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

    // inherit javadoc
    public void run() throws Exception {
        int counter = 1;
        OutboundRequest request;

        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 throws IOException");
        logger.log(Level.FINE,"");

        // OutboundRequest.getResponseInputStream.read throws IOException

        fakeRequest.setResponseInputStream(
            new FakeInputStream(new IOException(),0));
        request = boe.newCall(InvocationConstraints.EMPTY).next();
        try {
            boe.executeCall(request);
            throw new AssertionError("executeCall() should fail");
        } catch (IOException ignore) {
        }

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

        // OutboundRequest.getResponseInputStream.read returns -1

        iterator.init();
        fakeRequest.setResponseInputStream(new FakeInputStream(null,-1));

        request = boe.newCall(InvocationConstraints.EMPTY).next();
        try {
            boe.executeCall(request);
            throw new AssertionError("executeCall() should fail");
View Full Code Here

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

        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);
View Full Code Here

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

        extends FakeEndpoint implements TrustEquivalence
    {
        private boolean trusted;
        public FakeTrustedEndpoint(boolean trusted) {
            super(new FakeOutboundRequestIterator(
                new FakeOutboundRequest(),false));
            this.trusted = trusted;
        }
View Full Code Here

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

    // 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,"");

        assertion(iterator.hasNext() == true);

        logger.log(Level.FINE,"=================================");
        logger.log(Level.FINE,"test case " + (counter++)
            + ": next returns correct OutboundRequest");
        logger.log(Level.FINE,"");

        assertion(iterator.next() == request);

        logger.log(Level.FINE,"=================================");
        logger.log(Level.FINE,"test case " + (counter++)
            + ": uuid writen to OutboundRequest output stream");
        logger.log(Level.FINE,"");

        Uuid writtenUuid = UuidFactory.read(request.getRequestStream());
        assertion(uuid.equals(writtenUuid));

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

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

    // inherit javadoc
    public void run() throws Exception {
        int counter = 1;
        OutboundRequest request;

        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

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

    // 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)");
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.