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

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


               + " return equal hashcodes");
        }

        //Verify that ListenEndpoint on functionally equivalent
        //ServerEndpoint instances are considered equal.
        EqualityContext lc = new EqualityContext();
        EqualityContext lc2 = new EqualityContext();
        se.enumerateListenEndpoints(lc);
        ArrayList endpoints = lc.getEndpoints();
        //close the listen operations to avoid problems when obtaining
        //the listen endpoints for the functionally equivalent endpoint
        Iterator it = endpoints.iterator();
        while (it.hasNext()){
            ((EndpointHolder)it.next()).getListenHandle().close();
        }
        // wait to make sure resources released before attempting
        // 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();
View Full Code Here

TOP

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

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.