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

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


        endpoint.enumerateListenEndpoints(context);
        ArrayList endpoints = context.getEndpoints();
        log.finest(endpoints.size() + " endpoints returned");
        Iterator i = endpoints.iterator();
        while (i.hasNext()) {
            EndpointHolder holder = (EndpointHolder) i.next();
            ServerEndpoint.ListenEndpoint le = holder.getListenEndpoint();
            exceptionThrown = false;
            try {
                log.finest("Testing ListenEndpoint.listen(null)");
                le.listen(null);
            } catch (NullPointerException e) {
                holder.getListenHandle().close();
                log.finest("ListenEndpoint.listen(null) throws exception");
                exceptionThrown = true;
            }
            if (!exceptionThrown) {
                throw new TestException("Passing in null to"
View Full Code Here


                + " NoSuchElementException");
        }

        Iterator it = endpoints.iterator();
        while(it.hasNext()) {
            EndpointHolder eph = (EndpointHolder) it.next();
            SETRequestHandler rh = (SETRequestHandler)
                eph.getRequestHandler();
            if (response != rh.hashCode()){
                throw new TestException("The response received"
                    + "does not match the response sent by the server"
                    + "side of the connection.  Server sent "
                    + rh.hashCode() + ", but the client got " + response);
            }
            ArrayList requests = rh.getRequests();
            if (requests.size()!=1){
                throw new TestException("The RequestDisptcher"
                    + " received the incorrect number of requests.  "
                    + "Expected 1 and received " + requests.size());
            }
            Iterator requestIterator = requests.iterator();
            while (requestIterator.hasNext()){
                Integer value = (Integer) requestIterator.next();
                if (value.intValue()!=this.hashCode()){
                    throw new TestException("The data read from"
                        + " the InboundRequest does not match the data"
                        + " written to the OutboundRequest.  Wrote "
                        + this.hashCode() + " read " + value);
                }
            }
            ServerEndpoint.ListenHandle lh = eph.getListenHandle();
            //Close the listen operation
            lh.close();
        }
        //Verify that new requests are not received after close has
        //been called on the ListenHandle
        try {
            ori = e.newRequest(InvocationConstraints.EMPTY);
            while (ori.hasNext()) {
                OutboundRequest or = ori.next();
                ObjectOutputStream oos =
                    new ObjectOutputStream(or.getRequestOutputStream());
                oos.writeInt(this.hashCode());
                oos.close();
            }
            it = endpoints.iterator();
            while(it.hasNext()) {
                EndpointHolder eph = (EndpointHolder) it.next();
                SETRequestHandler rh = (SETRequestHandler)
                    eph.getRequestHandler();
                ArrayList requests = rh.getRequests();
                if (requests.size()!=1){
                    throw new TestException("Requests were"
                        + " delivered to the server after a close operation"
                        + " on the ListenHandle");
View Full Code Here

        // to reuse socket
        Thread.currentThread().sleep(1000 * 30);
        se2.enumerateListenEndpoints(lc2);
        ArrayList endpoints2 = lc2.getEndpoints();
        for (int i=0; i<endpoints.size(); i++){
            EndpointHolder eph = (EndpointHolder) endpoints.get(i);
            EndpointHolder eph2 = (EndpointHolder) endpoints2.get(i);
            ServerEndpoint.ListenEndpoint le = eph.getListenEndpoint();
            ServerEndpoint.ListenEndpoint le2 = eph2.getListenEndpoint();
            if (!le.equals(le2)){
                throw new TestException("ListenEndpoint " + le
                    + " on ServerEndpoint " + se + " is not considered"
                    + " equal to ListenEndpoint " + le2 + " on functionally"
                    + " equivalent ServerEndpoint " + se2);
            }
            if (!le2.equals(le)){
                throw new TestException("ListenEndpoint " + le
                    + " on ServerEndpoint " + se + " is not considered"
                    + " equal to ListenEndpoint " + le2 + " on functionally"
                    + " equivalent ServerEndpoint " + se2);
            }
        }
        //Verify that endpoints that are not functionally equivalent
        //are not considered equal
        se2 = (ServerEndpoint) getConfigObject(
            ServerEndpoint.class,"diffEndpoint");
        if (se.equals(se2)) {
            throw new TestException("Functionally different"
                + " endpoints are considered equal");
        }
        if (se2.equals(se)){
             throw new TestException("Functionally different"
                + " endpoints are considered equal");
        }
        //Verify that ListenEndpoint on functionally equivalent
        //ServerEndpoint instances are considered equal.
        lc2 = new EqualityContext();
        se2.enumerateListenEndpoints(lc2);
        endpoints2 = lc2.getEndpoints();
        for (int i=0; i<endpoints.size(); i++){
            EndpointHolder eph = (EndpointHolder) endpoints.get(i);
            EndpointHolder eph2 = (EndpointHolder) endpoints2.get(i);
            ServerEndpoint.ListenEndpoint le = eph.getListenEndpoint();
            ServerEndpoint.ListenEndpoint le2 = eph2.getListenEndpoint();
            if (le.equals(le2)){
                throw new TestException("ListenEndpoint " + le
                    + " on ServerEndpoint " + se + " not considered"
                    + " equal to ListenEndpoint " + le2 + " on functionally"
                    + " different ServerEndpoint " + se2);
View Full Code Here

TOP

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

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.