Package com.sun.jini.test.spec.jeri.transport.util

Examples of com.sun.jini.test.spec.jeri.transport.util.GetDeliveryDispatcher


public class GetDeliveryStatusTest extends AbstractEndpointTest {

    public void run() throws Exception {
        ServerEndpoint se = getServerEndpoint();
        GetDeliveryDispatcher dispatcher = new GetDeliveryDispatcher();
        GetDeliveryContext lc = new GetDeliveryContext(dispatcher);
        Endpoint e =
            se.enumerateListenEndpoints(lc);
        dispatcher.accept();
        OutboundRequestIterator ori =
            e.newRequest(InvocationConstraints.EMPTY);
        OutboundRequest or = null;
        while (ori.hasNext()) {
            or = ori.next();
            ObjectOutputStream oos = new ObjectOutputStream(
                or.getRequestOutputStream());
            oos.writeInt(1);
            oos.close();
        }
        if (dispatcher.dispatchCalled()!=1){
            throw new TestException("Dispatcher did not receive"
                + " the value sent");
        }
        if (!or.getDeliveryStatus()) {
            throw new TestException("Call on OutboundRequest"
                + ".getDeliveryStatus() returned false for an accepted"
                + " request");
        }
        ArrayList endpoints = lc.getEndpoints();
        Iterator it = endpoints.iterator();
        while (it.hasNext()){
            ((EndpointHolder)it.next()).getListenHandle().close();
        }
        dispatcher.reject();
        try {
            ori = e.newRequest(InvocationConstraints.EMPTY);
            while (ori.hasNext()) {
                or = ori.next();
                ObjectOutputStream oos = new ObjectOutputStream(
View Full Code Here


public class RobustnessTest extends AbstractEndpointTest {

    public void run() throws Exception {
        ServerEndpoint se = getServerEndpoint();
        GetDeliveryDispatcher dispatcher = new GetDeliveryDispatcher();
        GetDeliveryContext lc = new GetDeliveryContext(dispatcher);
        Endpoint e =
            se.enumerateListenEndpoints(lc);
        dispatcher.reject();
        try {
            OutboundRequestIterator ori =
                e.newRequest(InvocationConstraints.EMPTY);
            while (ori.hasNext()){
                OutboundRequest or = ori.next();
                ObjectOutputStream oos = new ObjectOutputStream(
                    or.getRequestOutputStream());
                oos.writeInt(1);
                oos.close();
            }
        } catch (Exception e2) {
            //Expected exception
            log.finest("Expected exception " + e2.getMessage());
        }
        if (dispatcher.dispatchCalled()!=-1){
            throw new TestException("Exception from the "
                + "dispatcher was not propagated");
        }
        dispatcher.accept();
        try {
            OutboundRequestIterator ori =
                e.newRequest(InvocationConstraints.EMPTY);
            while (ori.hasNext()) {
               OutboundRequest or = ori.next();
               ObjectOutputStream oos = new ObjectOutputStream(
               or.getRequestOutputStream());
               oos.writeInt(2);
               oos.close();
            }
        } catch (IOException ioe) {
            throw new TestException("Endpoint unavailable after"
                + " exception in previous remote call");
        }
        if (dispatcher.dispatchCalled()!=2){
            throw new TestException("Disaptcher was not called"
                + " after failure on previous remote call");
        }
    }
View Full Code Here

TOP

Related Classes of com.sun.jini.test.spec.jeri.transport.util.GetDeliveryDispatcher

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.