Package net.jini.core.constraint

Examples of net.jini.core.constraint.MethodConstraints


        for (int i = 0; i < cases.length; ++i) {
            int testCase = cases[i];
            logger.log(Level.INFO, "--> " + testCase);
           
            MethodConstraints mc = null;
            Permission[] perm = null;
            if (testCase > 2000) {
                perm = new Permission[] {
                        new RuntimePermission("getClassLoader")};
                testCase -= 2000;
View Full Code Here


        // 1 If proxy is null, throws a NullPointerException
        boolean verify = true;
        Permission[] perm = new Permission[] {
                    new RuntimePermission("setClassLoader")};
        MethodConstraints mc = new FakeMethodConstraints(
                    new InvocationConstraint[] {Integrity.YES});
        FakeBasicProxyPreparer fbpp = callFakeConstructor(
                3, verify, mc, perm);
        try {
            fbpp.prepareProxy(null);
View Full Code Here

        for (int i = 0; i < cases.length; ++i) {
            int testCase = cases[i];
            logger.log(Level.INFO, "--> " + testCase);
           
            MethodConstraints mc = null;
            Permission[] perm = null;
            if (testCase > 2000) {
                perm = new Permission[] {
                        new RuntimePermission("getClassLoader")};
                testCase -= 2000;
View Full Code Here

        // 1 If proxy is null, throws a NullPointerException
        boolean verify = true;
        Permission[] perm = new Permission[] {
                    new RuntimePermission("setClassLoader")};
        MethodConstraints mc = new FakeMethodConstraints(
                    new InvocationConstraint[] {Integrity.YES});
        FakeBasicProxyPreparer fbpp = callFakeConstructor(
                3, verify, mc, perm);
        try {
            fbpp.setConstraints(null);
View Full Code Here

        // 1 Returns the permissions to grant to proxies
        boolean verify = true;
        Permission[] perm = new Permission[] {
                    new RuntimePermission("setClassLoader")};
        MethodConstraints mc = new FakeMethodConstraints(
                    new InvocationConstraint[] {Integrity.YES});
        FakeBasicProxyPreparer fbpp = callFakeConstructor(
                3, verify, mc, perm);
        Object proxy = new Object();
        if (!equals(fbpp.getPermissions(proxy), perm)) {
View Full Code Here

        for (int i = 0; i < cases.length; ++i) {
            int testCase = cases[i];
            logger.log(Level.INFO, "--> " + testCase);
           
            MethodConstraints mc = null;
            Permission[] perm = null;
            if (testCase > 2000) {
                perm = new Permission[] {
                        new RuntimePermission("getClassLoader")};
                testCase -= 2000;
            } else if (testCase > 1000) {
                perm = new Permission[] {};
                testCase -= 1000;
            }
            if (testCase > 200) {
                mc = new FakeMethodConstraints(
                        new InvocationConstraint[] {Integrity.NO});
                testCase -= 200;
            } else if (testCase > 100) {
                mc = new FakeMethodConstraints(null);
                testCase -= 100;
            }
            boolean verify = false;
            if (testCase > 10) {
                verify = true;
                testCase -= 10;
            }
           
            // a - same object
            BasicProxyPreparer bpp = callConstructor(
                    testCase, verify, mc, perm);
            if (!bpp.equals(bpp)) {
                throw new TestException(
                        "equals method should return true (a)");
            }    
           
            // b - eqaul object
            bpp = callConstructor(
                    testCase, verify, mc, perm);
            BasicProxyPreparer bpp2 = callConstructor(
                    testCase, verify, mc, perm);
            if (!bpp.equals(bpp2)) {
                throw new TestException(
                        "equals method should return true (b)");
            }
           
            // c - different class
            bpp = callFakeConstructor(
                    testCase, verify, mc, perm);
            BasicProxyPreparer fbpp = callConstructor(
                    testCase, verify, mc, perm);
            if (bpp.equals(bpp2)) {
                throw new TestException(
                        "equals method should return false (c)");
            }
            if (bpp2.equals(bpp)) {
                throw new TestException(
                        "equals method should return false (c)");
            }

            if (testCase == 0) { continue; }
           
            // d - not the same value for "verify"
            bpp = callConstructor(
                    testCase, verify, mc, perm);
            bpp2 = callConstructor(
                    testCase, !verify, mc, perm);
            if (bpp.equals(bpp2)) {
                throw new TestException(
                        "equals method should return false (d)");
            }
            if (bpp2.equals(bpp)) {
                throw new TestException(
                        "equals method should return false (d)");
            }
           
            // g - permissions containing not the same elements
            bpp = callConstructor(
                    testCase, verify, mc, perm);
            Permission[] perm2 = new Permission[] {
                        new RuntimePermission("setClassLoader")};
            bpp2 = callConstructor(
                    testCase, verify, mc, perm2);
            if (bpp.equals(bpp2)) {
                throw new TestException(
                        "equals method should return false (g)");
            }
            if (bpp2.equals(bpp)) {
                throw new TestException(
                        "equals method should return false (g)");
            }
           
            // h - permissions containing the same elements, but in
            //      the another order
            Permission[] perm3 = new Permission[] {
                        new RuntimePermission("getClassLoader"),
                        new RuntimePermission("setClassLoader")};
            bpp = callConstructor(
                    testCase, verify, mc, perm3);
            Permission[] perm4 = new Permission[] {
                        new RuntimePermission("setClassLoader"),
                        new RuntimePermission("getClassLoader")};
            bpp2 = callConstructor(
                    testCase, verify, mc, perm4);
            if (!bpp.equals(bpp2)) {
                throw new TestException(
                        "equals method should return true (h)");
            }
            if (!bpp2.equals(bpp)) {
                throw new TestException(
                        "equals method should return true (h)");
            }
           
            if (testCase == 2) { continue; }
           
            // e, f - not equal method constraints
            bpp = callConstructor(
                    testCase, verify, mc, perm);
            MethodConstraints mc2 = new FakeMethodConstraints(
                        new InvocationConstraint[] {Integrity.YES});
            bpp2 = callConstructor(
                    testCase, verify, mc2, perm);
            if (bpp.equals(bpp2)) {
                throw new TestException(
View Full Code Here

        // 4 dynamic permission grants are not supported
        boolean verify = true;
        Permission[] perm = new Permission[] {
                    new RuntimePermission("setClassLoader")};
        MethodConstraints mc = new FakeMethodConstraints(
                    new InvocationConstraint[] {Integrity.YES});
        FakeBasicProxyPreparer fbpp = callFakeConstructor(
                3, verify, mc, perm);
        Object proxy = new Object();
        try {
View Full Code Here

        for (int i = 0; i < cases.length; ++i) {
            int testCase = cases[i];
            logger.log(Level.INFO, "--> " + testCase);
           
            MethodConstraints mc = null;
            if (testCase > 200) {
                mc = new FakeMethodConstraints(
                        new InvocationConstraint[] {Integrity.NO});
                testCase -= 200;
            } else if (testCase > 100) {
View Full Code Here

         *  applied to the given client method constraints.
         */
        private static Fiddler constrainServer( Fiddler server,
                                                MethodConstraints constraints )
        {
            MethodConstraints newConstraints
               = ConstrainableProxyUtil.translateConstraints(constraints,
                                                             methodMapArray);
            RemoteMethodControl constrainedServer =
                ((RemoteMethodControl)server).setConstraints(newConstraints);

View Full Code Here

        ServiceBeanConfig sc = svcElement.getServiceBeanConfig();
        Map<String, Object> configParameters = sc.getConfigurationParameters();

        String[] args = (String[])configParameters.get(ServiceBeanConfig.SERVICE_PROVISION_CONFIG);
        MethodConstraints serviceListenerConstraints=
                new BasicMethodConstraints(new InvocationConstraints(new ConnectionRelativeTime(30000), null));
        ProxyPreparer defaultProxyPreparer =  new BasicProxyPreparer(false, serviceListenerConstraints, null);

        if(args==null) {
            proxyPreparer = defaultProxyPreparer;
View Full Code Here

TOP

Related Classes of net.jini.core.constraint.MethodConstraints

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.