Package net.jini.core.constraint

Examples of net.jini.core.constraint.ServerMinPrincipal


    public ConstraintAlternatives getServerMinPrincipal() {
        return sminp;
    }

    public ServerMinPrincipal getServerMainPrincipal() {
        return new ServerMinPrincipal(new X500Principal(serverDSA));
    }
View Full Code Here


        });
    }

    public ConstraintAlternatives getServerMinPrincipal() {
        return new ConstraintAlternatives(new InvocationConstraint[] {
            new ServerMinPrincipal(serverSubject.getPrincipals()),
            new ServerMinPrincipal(new KerberosPrincipal("dummy"))
        });
    }
View Full Code Here

            new ServerMinPrincipal(new KerberosPrincipal("dummy"))
        });
    }

    public ServerMinPrincipal getServerMainPrincipal() {
        return new ServerMinPrincipal(serverSubject.getPrincipals());
    }
View Full Code Here

                ic = new ClientMinPrincipal((Principal[]) pr);
            } else if (tc == SRV_MIN_PR__PRINCIPALS_ARRAY
                    || tc == SRV_MIN_PR__PRINCIPALS_NULL_ARRAY
                    || tc == SRV_MIN_PR__PRINCIPALS_ARRAY_NULL_EL
                    || tc == SRV_MIN_PR__PRINCIPALS_EMPTY_ARRAY) {
                ic = new ServerMinPrincipal((Principal[]) pr);
            }

            // If some Exception is expected
            if (       tc == CL_MAX_PR__PRINCIPALS_NULL_ARRAY
                    || tc == CL_MAX_PR__PRINCIPALS_ARRAY_NULL_EL
View Full Code Here

            } else if (tc == SRV_MIN_PR__PRINCIPALS_COLL
                    || tc == SRV_MIN_PR__PRINCIPALS_NULL_COLL
                    || tc == SRV_MIN_PR__PRINCIPALS_COLL_NULL_EL
                    || tc == SRV_MIN_PR__PRINCIPALS_EMPTY_COLL
                    || tc == SRV_MIN_PR__PRINCIPALS_COLL_ILL_EL) {
                ic = new ServerMinPrincipal((Collection) pr);
            }

            // If some Exception is expected
            if (       tc == CL_MAX_PR__PRINCIPALS_NULL_COLL
                    || tc == CL_MAX_PR__PRINCIPALS_COLL_NULL_EL
View Full Code Here

         * Create ServerMinPrincipal object
         */
        set[4] = set[0];

        try {
            obj[4] = new ServerMinPrincipal(set[4]);
        } catch (Exception e) {
            throw new TestException("Exception has been thrown while creating"
                    + " ServerMinPrincipal object", e);
        }
    }
View Full Code Here

            new ClientMinPrincipalType(TestPrincipal.class),
            new DelegationRelativeTime(1000, 2000, 3000, 4000),
            new DelegationAbsoluteTime(1000, 2000, 3000, 4000),
            new ClientMinPrincipal(new Principal[] { tp1, tp2 }),
            new ClientMaxPrincipal(new Principal[] { tp1, tp2 }),
            new ServerMinPrincipal(new Principal[] { tp1, tp2 }),
            new ClientMinPrincipal(new Principal[] { tp1, tp3, tp2 }),
            new ClientMaxPrincipal(new Principal[] { tp1, tp3, tp2 }),
            new ServerMinPrincipal(new Principal[] { tp1, tp3, tp2 }),
            new ConstraintAlternatives(new InvocationConstraint[] {
                Delegation.YES,
                Integrity.YES,
                ClientAuthentication.YES }),
            new ConstraintAlternatives(new InvocationConstraint[] {
View Full Code Here

            } else if (tc == CL_MIN_PR__PRINCIPAL
                    || tc == CL_MIN_PR__PRINCIPAL_NULL) {
                ic = new ClientMinPrincipal((Principal) pr);
            } else if (tc == SRV_MIN_PR__PRINCIPAL
                    || tc == SRV_MIN_PR__PRINCIPAL_NULL) {
                ic = new ServerMinPrincipal((Principal) pr);
            }

            // If some Exception is expected
            if (       tc == CL_MAX_PR__PRINCIPAL_NULL
                    || tc == CL_MIN_PR__PRINCIPAL_NULL
View Full Code Here

    "ServerPrincipalConstraintValidServerMinTest",
    null,
    emptyConstraints, /* clientUnfulfilledConstraints */
    new InvocationConstraints(
        new InvocationConstraint[] {
      new ServerMinPrincipal(defaultServerPrincipal)},
        null),
    emptyConstraints, /* serverUnfulfilledConstraints */
    null, null, false, false),
      new EndpointTest(
    "ServerPrincipalConstraintInvalidServerMinTest",
    null,
    emptyConstraints, /* clientUnfulfilledConstraints */
    new InvocationConstraints(
        new InvocationConstraint[] {
      new ServerMinPrincipal(sps[0])},
        null),
    null, // serverUnfulfilledConstraints, null indicates failure
    null, null, false, false),
      new EndpointTest(
    "ServerPrincipalConstraintNonKerberosServerMinTest",
    null,
    emptyConstraints, /* clientUnfulfilledConstraints */
    new InvocationConstraints(
        new InvocationConstraint[] {
      new ClientMinPrincipal(
          new TestPrincipal("SPCT3testPrincipal"))},
        null),
    null, // serverUnfulfilledConstraints, null indicates failure
    null, null, false, false),
      new EndpointTest(
    "ClientMaxPrincipalConstraintClientSideTest",
    new InvocationConstraints(
        new InvocationConstraint[] {
      new ClientMaxPrincipal(
          new Principal[] {cps[1], cps[2], cps[3]}),
      new ClientMaxPrincipal(
          new Principal[] {cps[1], cps[2]}),
      new ClientMaxPrincipal(cps[3])},
        null),
    null, // clientUnfulfilledConstraints, null indicates failure
    null,
    emptyConstraints, /* serverUnfulfilledConstraints */
    null, null, false, false),
      new EndpointTest(
    "ClientMaxPrincipalConstraintServerSideTest",
    null,
    emptyConstraints, /* clientUnfulfilledConstraints */
    new InvocationConstraints(
        new InvocationConstraint[] {
      new ClientMaxPrincipal(
          new Principal[] {cps[1], cps[2], cps[3]}),
      new ClientMaxPrincipal(
          new Principal[] {cps[1], cps[3]}),
      new ClientMaxPrincipal(cps[2])},
        null),
    null, // serverUnfulfilledConstraints, null indicates failure
    null, null, false, false),
      /* -- integrity tests -- */
      new EndpointTest(
    "IntegrityYESRequiredTest",
    new InvocationConstraints(
        new InvocationConstraint[] {
      new ClientMinPrincipal(cps[1]),
      new ClientMaxPrincipal(
                            new Principal[] {cps[0], cps[1], cps[2]}),
      Integrity.YES},
        null),
    integrityRequiredConstraints, /* clientUnfulfilledConstrain */
    new InvocationConstraints(
        new InvocationConstraint[] {
      new ClientMinPrincipal(cps[1]),
      new ClientMaxPrincipal(
                            new Principal[] {cps[0], cps[1]}),
      new ServerMinPrincipal(defaultServerPrincipal),
      Integrity.YES},
        null),
    integrityRequiredConstraints, /* serverUnfulfilledConstrain */
    new KerberosPrincipal[] {cps[1]},
    new KerberosPrincipal[] {defaultServerPrincipal},
    false, false),
      new EndpointTest(
    "IntegrityYESPreferredTest",
    new InvocationConstraints(
        null,
        new InvocationConstraint[] {
      new ClientMinPrincipal(cps[1]),
      new ClientMaxPrincipal(
                            new Principal[] {cps[0], cps[1], cps[2]}),
      Integrity.YES}),
    integrityPreferredConstraints, /* clientUnfulfilledConstrain */
    new InvocationConstraints(
        null,
        new InvocationConstraint[] {
      new ClientMinPrincipal(cps[1]),
      new ClientMaxPrincipal(
                            new Principal[] {cps[0], cps[1]}),
      new ServerMinPrincipal(defaultServerPrincipal),
      Integrity.YES}),
    integrityPreferredConstraints, /* serverUnfulfilledConstrain */
    new KerberosPrincipal[] {cps[1]},
    new KerberosPrincipal[] {defaultServerPrincipal},
    false, false),
      new EndpointTest(
    "ClientIntegrityNOTest",
    new InvocationConstraints(
        new InvocationConstraint[] {
      new ClientMinPrincipal(cps[1]),
      new ClientMaxPrincipal(
                            new Principal[] {cps[0], cps[1], cps[2]}),
      Integrity.NO},
        null),
    null, // clientUnfulfilledConstraints, null indicates failure
    null,
    emptyConstraints, /* serverUnfulfilledConstraints */
    new KerberosPrincipal[] {cps[1]}, null, false, false),
      new EndpointTest(
    "ServerIntegrityNOTest",
    new InvocationConstraints(
        new InvocationConstraint[] {
      new ClientMinPrincipal(cps[1])}, null),
    emptyConstraints, /* clientUnfulfilledConstraints */
    new InvocationConstraints(
        new InvocationConstraint[] {
      new ClientMinPrincipal(cps[1]),
      new ClientMaxPrincipal(
                            new Principal[] {cps[0], cps[1]}),
      new ServerMinPrincipal(defaultServerPrincipal),
      Integrity.NO},
        null),
    null, // serverUnfulfilledConstraints, null indicates failure
    new KerberosPrincipal[] {cps[1]},
    new KerberosPrincipal[] {defaultServerPrincipal},
    false, false),
      /* -- constraint alternatives tests -- */
      new EndpointTest(
    "ClientConstraintAlternativesPassTest",
    new InvocationConstraints(
        new InvocationConstraint[] {
      new ClientMinPrincipal(cps[2]),
      new ConstraintAlternatives(
          new InvocationConstraint[] {
        new ServerMinPrincipal(sps[3]),
        new ClientMaxPrincipal(
            new Principal[] {cps[1], cps[2]}),
        new ClientMaxPrincipal(cps[3])})},
        null),
    emptyConstraints, /* clientUnfulfilledConstraints */
    null,
    emptyConstraints, /* serverUnfulfilledConstraints */
    new KerberosPrincipal[] {cps[2]}, null, false, false),
      new EndpointTest(
    "ClientConstraintAlternativesFailTest",
    new InvocationConstraints(
        new InvocationConstraint[] {
      new ClientMinPrincipal(cps[0]),
      new ConstraintAlternatives(
          new InvocationConstraint[] {
        new ServerMinPrincipal(sps[3]),
        new ClientMaxPrincipal(
            new Principal[] {cps[1], cps[2]}),
        new ClientMaxPrincipal(cps[3])})},
        null),
    null, // clientUnfulfilledConstraints, null indicates failure
    null,
    emptyConstraints, /* serverUnfulfilledConstraints */
    new KerberosPrincipal[] {cps[2]}, null, false, false),
      new EndpointTest(
    "ServerConstraintAlternativesPassTest",
    new InvocationConstraints(
        new InvocationConstraint[] {
      new ClientMinPrincipal(cps[2])},
        null),
    emptyConstraints, /* clientUnfulfilledConstraints */
    new InvocationConstraints(
        new InvocationConstraint[] {
      new ConstraintAlternatives(
          new InvocationConstraint[] {
        new ServerMinPrincipal(sps[3]),
        new ClientMinPrincipal(
            new Principal[] {cps[1], cps[2]}),
        new ClientMaxPrincipal(
            new Principal[] {cps[2], cps[3]})}),
      new ServerMinPrincipal(defaultServerPrincipal)},
        null),
    emptyConstraints, /* serverUnfulfilledConstraints */
    new KerberosPrincipal[] {cps[2]}, null, false, false),
      new EndpointTest(
    "ServerConstraintAlternativesFailTest1",
    new InvocationConstraints(
        new InvocationConstraint[] {
      new ClientMinPrincipal(cps[0])},
        null),
    emptyConstraints, /* clientUnfulfilledConstraints */
    new InvocationConstraints(
        new InvocationConstraint[] {
      new ConstraintAlternatives(
          new InvocationConstraint[] {
        new ServerMinPrincipal(sps[3]),
        new ClientMinPrincipal(
            new Principal[] {cps[1], cps[2]}),
        new ClientMaxPrincipal(
            new Principal[] {cps[2], cps[3]})}),
      new ServerMinPrincipal(defaultServerPrincipal)},
        null),
    null, // serverUnfulfilledConstraints, null indicates failure
    new KerberosPrincipal[] {cps[0]}, null, false, false),
      new EndpointTest(
    "ServerConstraintAlternativesFailTest2",
    new InvocationConstraints(
        new InvocationConstraint[] {
      new ClientMinPrincipal(cps[0])},
        null),
    emptyConstraints, /* clientUnfulfilledConstraints */
    new InvocationConstraints(
        new InvocationConstraint[] {
      new ConstraintAlternatives(
          new InvocationConstraint[] {
        new ClientMinPrincipal(
            new Principal[] {cps[0], cps[2]}),
        new ClientMinPrincipal(
            new Principal[] {cps[0], cps[3]})}),
      new ServerMinPrincipal(defaultServerPrincipal)},
        null),
    null, // serverUnfulfilledConstraints, null indicates failure
    new KerberosPrincipal[] {cps[0]}, null, false, false),
      /* -- confidentiality tests -- */
      new EndpointTest(
    "ConfidentialityYESTest1", // only client requests
    new InvocationConstraints(
        new InvocationConstraint[] {
      new ClientMinPrincipal(cps[1]),
      new ClientMaxPrincipal(
                            new Principal[] {cps[0], cps[1], cps[2]}),
      Confidentiality.YES},
        null),
    emptyConstraints, /* clientUnfulfilledConstraints */
    new InvocationConstraints(
        new InvocationConstraint[] {
      new ClientMinPrincipal(cps[1]),
      new ClientMaxPrincipal(
                            new Principal[] {cps[0], cps[1]}),
      new ServerMinPrincipal(defaultServerPrincipal),
      Integrity.YES},
        null),
    integrityRequiredConstraints, /* serverUnfulfilledConstrain */
    new KerberosPrincipal[] {cps[1]},
    new KerberosPrincipal[] {defaultServerPrincipal},
    true, false),
      new EndpointTest(
    "ConfidentialityYESTest2", // only server requests
    new InvocationConstraints(
        new InvocationConstraint[] {
      new ClientMinPrincipal(cps[1]),
      new ClientMaxPrincipal(
                            new Principal[] {cps[0], cps[1], cps[2]})},
        null),
    emptyConstraints, /* clientUnfulfilledConstraints */
    new InvocationConstraints(
        new InvocationConstraint[] {
      new ClientMinPrincipal(cps[1]),
      new ClientMaxPrincipal(
                            new Principal[] {cps[0], cps[1]}),
      new ServerMinPrincipal(defaultServerPrincipal),
      Confidentiality.YES},
        null),
    null, // serverUnfulfilledConstraints, null indicates failure
    new KerberosPrincipal[] {cps[1]},
    new KerberosPrincipal[] {defaultServerPrincipal},
    false, false),
      new EndpointTest(
    "ConfidentialityYESTest3", // both client and server request
    new InvocationConstraints(
        new InvocationConstraint[] {
      new ClientMinPrincipal(cps[1]),
      new ClientMaxPrincipal(
                            new Principal[] {cps[0], cps[1], cps[2]}),
      Confidentiality.YES},
        null),
    emptyConstraints, /* clientUnfulfilledConstraints */
    new InvocationConstraints(
        new InvocationConstraint[] {
      new ClientMinPrincipal(cps[1]),
      new ClientMaxPrincipal(
                            new Principal[] {cps[0], cps[1]}),
      new ServerMinPrincipal(defaultServerPrincipal),
      Confidentiality.YES},
        null),
    emptyConstraints, /* serverUnfulfilledConstraints */
    new KerberosPrincipal[] {cps[1]},
    new KerberosPrincipal[] {defaultServerPrincipal},
    true, false),
      new EndpointTest(
    "ClientConfidentialityNOTest",
    new InvocationConstraints(
        new InvocationConstraint[] {
      new ClientMinPrincipal(cps[1]),
      new ClientMaxPrincipal(
                            new Principal[] {cps[0], cps[1], cps[2]}),
      Confidentiality.NO},
        null),
    emptyConstraints, /* clientUnfulfilledConstraints */
    null,
    emptyConstraints, /* serverUnfulfilledConstraints */
    new KerberosPrincipal[] {cps[1]}, null, false, false),
      new EndpointTest(
    "ServerConfidentialityNOTest",
    new InvocationConstraints(
        new InvocationConstraint[] {
      new ClientMinPrincipal(cps[1])}, null),
    emptyConstraints, /* clientUnfulfilledConstraints */
    new InvocationConstraints(
        new InvocationConstraint[] {
      new ClientMinPrincipal(cps[1]),
      new ClientMaxPrincipal(
                            new Principal[] {cps[0], cps[1]}),
      new ServerMinPrincipal(defaultServerPrincipal),
      Confidentiality.NO},
        null),
    emptyConstraints, /* serverUnfulfilledConstraints */
    new KerberosPrincipal[] {cps[1]},
    new KerberosPrincipal[] {defaultServerPrincipal},
    false, false),
      /* -- delegation tests -- */
      new EndpointTest(
    "DelegationYESTest",
    new InvocationConstraints(
        new InvocationConstraint[] {
      new ClientMinPrincipal(cps[2]),
      new ClientMaxPrincipal(
                            new Principal[] {cps[1], cps[2], cps[3]}),
      Delegation.YES},
        null),
    emptyConstraints, /* clientUnfulfilledConstraints */
    null,
    emptyConstraints, /* serverUnfulfilledConstraints */
    new KerberosPrincipal[] {cps[2]}, null, false, true),
      new EndpointTest(
    "DelegationNOTest",
    new InvocationConstraints(
        new InvocationConstraint[] {
      new ClientMinPrincipal(cps[2]),
      new ClientMaxPrincipal(
                            new Principal[] {cps[1], cps[2], cps[3]}),
      Delegation.NO},
        null),
    emptyConstraints, /* clientUnfulfilledConstraints */
    null,
    emptyConstraints, /* serverUnfulfilledConstraints */
    new KerberosPrincipal[] {cps[2]}, null, false, false),
      /* -- data tests -- */
      new EndpointTest(
    "OneWriteShortDataNoEncryptionTest",
    oneShortArray1, null, true,
    new InvocationConstraints(
        new InvocationConstraint[] {
      new ClientMinPrincipal(cps[1]),
      Delegation.YES},
        null),
    emptyConstraints, /* clientUnfulfilledConstraints */
    oneShortArray2, null, true,
    null,
    emptyConstraints, /* serverUnfulfilledConstraints */
    new KerberosPrincipal[] {cps[1]}, null, false, true, null),
      new EndpointTest(
    "MultiWriteShortDataNoEncryptionTest",
    multiShortArray1, null, true,
    new InvocationConstraints(
        new InvocationConstraint[] {
      new ClientMinPrincipal(cps[1]),
      Delegation.YES},
        null),
    emptyConstraints, /* clientUnfulfilledConstraints */
    multiShortArray2, null, true,
    null,
    emptyConstraints, /* serverUnfulfilledConstraints */
    new KerberosPrincipal[] {cps[1]}, null, false, true, null),
      new EndpointTest(
    "OneWriteLongDataNoEncryptionTest1",
    oneLongArray1, null, true,
    new InvocationConstraints(
        new InvocationConstraint[] {
      new ClientMinPrincipal(cps[1]),
      Delegation.YES},
        null),
    emptyConstraints, /* clientUnfulfilledConstraints */
    oneLongArray2, null, true,
    null,
    emptyConstraints, /* serverUnfulfilledConstraints */
    new KerberosPrincipal[] {cps[1]}, null, false, true, null),
      new EndpointTest(
    "OneWriteLongDataNoEncryptionTest2",
    oneLongArray3, null, true,
    new InvocationConstraints(
        new InvocationConstraint[] {
      new ClientMinPrincipal(cps[1]),
      Delegation.YES},
        null),
    emptyConstraints, /* clientUnfulfilledConstraints */
    oneLongArray4, null, true,
    null,
    emptyConstraints, /* serverUnfulfilledConstraints */
    new KerberosPrincipal[] {cps[1]}, null, false, true, null),
      new EndpointTest(
    "MultiWriteLongDataNoEncryptionTest",
    multiLongArray1, null, true,
    new InvocationConstraints(
        new InvocationConstraint[] {
      new ClientMinPrincipal(cps[1]),
      Delegation.YES},
        null),
    emptyConstraints, /* clientUnfulfilledConstraints */
    multiLongArray2, null, true,
    null,
    emptyConstraints, /* serverUnfulfilledConstraints */
    new KerberosPrincipal[] {cps[1]}, null, false, true, null),
      new EndpointTest(
    "OneWriteShortDataWithEncryptionTest",
    oneShortArray1, null, true,
    new InvocationConstraints(
        new InvocationConstraint[] {
      new ClientMinPrincipal(cps[1]),
      Confidentiality.YES,
      Delegation.YES},
        null),
    emptyConstraints, /* clientUnfulfilledConstraints */
    oneShortArray2, null, true,
    null,
    emptyConstraints, /* serverUnfulfilledConstraints */
    new KerberosPrincipal[] {cps[1]}, null, true, true, null),
      new EndpointTest(
    "MultiWriteShortDataWithEncryptionTest",
    multiShortArray1, null, true,
    new InvocationConstraints(
        new InvocationConstraint[] {
      new ClientMinPrincipal(cps[1]),
      Confidentiality.YES,
      Delegation.YES},
        null),
    emptyConstraints, /* clientUnfulfilledConstraints */
    multiShortArray2, null, true,
    null,
    emptyConstraints, /* serverUnfulfilledConstraints */
    new KerberosPrincipal[] {cps[1]}, null, true, true, null),
      new EndpointTest(
    "OneWriteLongDataWithEncryptionTest1",
    oneLongArray1, null, true,
    new InvocationConstraints(
        new InvocationConstraint[] {
      new ClientMinPrincipal(cps[1]),
      Confidentiality.YES,
      Delegation.YES},
        null),
    emptyConstraints, /* clientUnfulfilledConstraints */
    oneLongArray2, null, true,
    null,
    emptyConstraints, /* serverUnfulfilledConstraints */
    new KerberosPrincipal[] {cps[1]}, null, true, true, null),
      new EndpointTest(
    "OneWriteLongDataWithEncryptionTest2",
    oneLongArray3, null, true,
    new InvocationConstraints(
        new InvocationConstraint[] {
      new ClientMinPrincipal(cps[1]),
      Confidentiality.YES,
      Delegation.YES},
        null),
    emptyConstraints, /* clientUnfulfilledConstraints */
    oneLongArray4, null, true,
    null,
    emptyConstraints, /* serverUnfulfilledConstraints */
    new KerberosPrincipal[] {cps[1]}, null, true, true, null),
      new EndpointTest(
    "MultiWriteLongDataWithEncryptionTest",
    multiLongArray1, null, true,
    new InvocationConstraints(
        new InvocationConstraint[] {
      new ClientMinPrincipal(cps[1]),
      Confidentiality.YES,
      Delegation.YES},
        null),
    emptyConstraints, /* clientUnfulfilledConstraints */
    multiLongArray2, null, true,
    null,
    emptyConstraints, /* serverUnfulfilledConstraints */
    new KerberosPrincipal[] {cps[1]}, null, true, true, null),
      /* -- server capability tests -- */
      new ServerCapabilityTest(
    "ServerCapabilityNullConstraintsTest",
    serverEndpoint, null,
    null,             /* constraints */
    emptyConstraints, /* unfulfilledConstraints */
    "null constraints, should not return", /* returnErrMsg */
    null,             /* nullPointerExceptionErrMsg */
    "unsupportedConstraintException thrown",
    "SecurityException thrown when perms granted"),
      new ServerCapabilityTest(
    "ServerCapabilityNoAuthenticationPermissionTest",
    serverEndpoint, defaultPermsNoSocketPerm,
    null,             /* constraints */
    emptyConstraints, /* unfulfilledConstraints */
    "null constraints, should not return", /* returnErrMsg */
    "NullPointerException thrown", /* nullPointerExceptionErrMsg */
    "unsupportedConstraintException thrown",
    null),            /* securityExceptionErrMsg */
      new ServerCapabilityTest(
    "ServerCapabilitySubjectNoCredentialPermissionTest",
    serverEndpointNoCred, null,
    null,             /* constraints */
    emptyConstraints, /* unfulfilledConstraints */
    "null constraints, should not return", /* returnErrMsg */
    "NullPointerException thrown", /* nullPointerExceptionErrMsg */
    null,             /* unsupportedConstraintExceptionErrMsg */
    "SecurityException thrown when perms granted"),
      new ServerCapabilityTest(
    "ServerCapabilityValidPrincipalConstraintsTest",
    serverEndpoint, null,
    new InvocationConstraints(
        new InvocationConstraint[] {
      new ClientMinPrincipal(cps[1]),
      new ClientMaxPrincipal(
                            new Principal[] {cps[1], cps[2], cps[3]}),
      new ServerMinPrincipal(defaultServerPrincipal)},
        null),
    emptyConstraints, /* unfulfilledConstraints */
    null,             /* returnErrMsg */
    "NullPointerException thrown", /* nullPointerExceptionErrMsg */
    "unsupportedConstraintException thrown",
    "SecurityException thrown when perms granted"),
      new ServerCapabilityTest(
    "ServerCapabilityConstraintAlternativesPassTest",
    serverEndpoint, null,
    new InvocationConstraints(
        new InvocationConstraint[] {
      new ConstraintAlternatives(
          new InvocationConstraint[] {
        new ServerMinPrincipal(sps[3]),
        new ClientMinPrincipal(
            new Principal[] {cps[1], cps[2]}),
        new ClientMaxPrincipal(cps[3])}),
      new ServerMinPrincipal(defaultServerPrincipal)},
        null),
    emptyConstraints, /* unfulfilledConstraints */
    null,             /* returnErrMsg */
    "NullPointerException thrown", /* nullPointerExceptionErrMsg */
    "unsupportedConstraintException thrown",
    "SecurityException thrown when perms granted"),
      new ServerCapabilityTest(
    "ServerCapabilityConstraintAlternativesFailTest",
    serverEndpoint, null,
    new InvocationConstraints(
        new InvocationConstraint[] {
      new ConstraintAlternatives(
          new InvocationConstraint[] {
        new ServerMinPrincipal(sps[3]),
        new ClientMinPrincipal(
            new Principal[] {cps[1], cps[2]}),
        new ClientMinPrincipal(
            new Principal[] {cps[2], cps[3]})}),
      new ServerMinPrincipal(defaultServerPrincipal)},
        null),
    null,             /* unfulfilledConstraints */
    "invalid constraints, should not return", /* returnErrMsg */
    "NullPointerException thrown", /* nullPointerExceptionErrMsg */
    null,             /* unsupportedConstraintExceptionErrMsg */
    "SecurityException thrown when perms granted"),
      new ServerCapabilityTest(
    "ServerCapabilityInvalidPrincipalConstraintsTest1",
    serverEndpoint, null,
    new InvocationConstraints(
        new InvocationConstraint[] {
      new ClientMinPrincipal(
          new Principal[] {cps[1], cps[2]}),
      new ClientMaxPrincipal(cps[3]),
      new ServerMinPrincipal(defaultServerPrincipal)},
        null),
    emptyConstraints, /* unfulfilledConstraints */
    "conflict constraints, should not return", /* returnErrMsg */
    "NullPointerException thrown", /* nullPointerExceptionErrMsg */
    null,             /* unsupportedConstraintExceptionErrMsg */
    "SecurityException thrown when perms granted"),
      new ServerCapabilityTest(
    "ServerCapabilityInvalidPrincipalConstraintsTest2",
    serverEndpoint, null,
    new InvocationConstraints(
        new InvocationConstraint[] {
      new ClientMinPrincipal(cps[1]),
      new ClientMaxPrincipal(
                            new Principal[] {cps[1], cps[2], cps[3]}),
      new ServerMinPrincipal(sps[2])},
        null),
    emptyConstraints, /* unfulfilledConstraints */
    "conflict constraints, should not return", /* returnErrMsg */
    "NullPointerException thrown", /* nullPointerExceptionErrMsg */
    null,             /* unsupportedConstraintExceptionErrMsg */
 
View Full Code Here

                "\n\t+++++ TestCase #15:: "
                + "Only duplicate ServerMinPrincipal constraints exist");

        try {
            Collection argColl = new ArrayList();
            ServerMinPrincipal ic = new ServerMinPrincipal(new
                    KerberosPrincipal("duke@FOO.COM"));
            argColl.add(ic);
            argColl.add(ic);

            if (!checker(argColl, ic)) {
                throw new TestException(
                        "" + " test failed");
            }
        } catch (Exception e) {
            logger.log(Level.FINE,
                    "Exception has been thrown while creating"
                    + " ServerMinPrincipal object: "
                    + e);
            throw new TestException(
                    "" + " test failed");
        }

        // TestCase #16
        logger.log(Level.FINE,
                "\n\t+++++ TestCase #16:: "
                + "Only duplicate ConnectionAbsoluteTime constraints exist");
        {
            Collection argColl = new ArrayList();
            ConnectionAbsoluteTime ic = new ConnectionAbsoluteTime((long) 0);
            argColl.add(ic);
            argColl.add(ic);

            if (!checker(argColl, ic)) {
                throw new TestException(
                        "" + " test failed");
            }
        }

        // TestCase #17
        logger.log(Level.FINE,
                "\n\t+++++ TestCase #17:: "
                + "Only duplicate ConnectionRelativeTime constraints exist");
        {
            Collection argColl = new ArrayList();
            ConnectionRelativeTime ic = new ConnectionRelativeTime((long) 0);
            argColl.add(ic);
            argColl.add(ic);

            if (!checker(argColl, ic)) {
                throw new TestException(
                        "" + " test failed");
            }
        }

        // TestCase #18
        logger.log(Level.FINE,
                "\n\t+++++ TestCase #18:: "
                + "Only duplicate DelegationAbsoluteTime constraints exist");
        {
            Collection argColl = new ArrayList();
            DelegationAbsoluteTime ic = new DelegationAbsoluteTime((long) 0,
                    (long) 0, (long) 0, (long) 0);
            argColl.add(ic);
            argColl.add(ic);

            if (!checker(argColl, ic)) {
                throw new TestException(
                        "" + " test failed");
            }
        }

        // TestCase #19
        logger.log(Level.FINE,
                "\n\t+++++ TestCase #19:: "
                + "Only duplicate DelegationRelativeTime constraints exist");
        {
            Collection argColl = new ArrayList();
            DelegationRelativeTime ic = new DelegationRelativeTime((long) 0,
                    (long) 0, (long) 0, (long) 0);
            argColl.add(ic);
            argColl.add(ic);

            if (!checker(argColl, ic)) {
                throw new TestException(
                        "" + " test failed");
            }
        }

        // TestCase #20
        logger.log(Level.FINE,
                "\n\t+++++ TestCase #20:: "
                + "There are several duplicate and non-duplicate constraints");

        try {
            // Argument for ConstraintAlternatives.create() methods
            Collection argColl = new ArrayList();
            argColl.add(ClientAuthentication.YES);
            argColl.add(ClientAuthentication.YES);
            argColl.add(ClientAuthentication.NO);
            argColl.add(Confidentiality.YES);
            argColl.add(Confidentiality.YES);
            argColl.add(Confidentiality.NO);
            argColl.add(Delegation.YES);
            argColl.add(Delegation.YES);
            argColl.add(Delegation.NO);
            argColl.add(Integrity.YES);
            argColl.add(Integrity.YES);
            argColl.add(Integrity.NO);
            argColl.add(ServerAuthentication.YES);
            argColl.add(ServerAuthentication.YES);
            argColl.add(ServerAuthentication.NO);
            argColl.add(new ClientMaxPrincipal(new
                    KerberosPrincipal("duke@FOO.COM")));
            argColl.add(new ClientMaxPrincipal(new
                    KerberosPrincipal("duke@FOO.COM")));
            argColl.add(new ClientMaxPrincipal(new
                    X500Principal(
                    "CN=Duke, OU=JavaSoft, O=Sun Microsystems, C=US")));
            argColl.add(new ClientMaxPrincipalType(KerberosPrincipal.class));
            argColl.add(new ClientMaxPrincipalType(KerberosPrincipal.class));
            argColl.add(new ClientMaxPrincipalType(X500Principal.class));
            argColl.add(new ClientMinPrincipal(new
                    KerberosPrincipal("duke@FOO.COM")));
            argColl.add(new ClientMinPrincipal(new
                    KerberosPrincipal("duke@FOO.COM")));
            argColl.add(new ClientMinPrincipal(new
                    X500Principal(
                    "CN=Duke, OU=JavaSoft, O=Sun Microsystems, C=US")));
            argColl.add(new ClientMinPrincipalType(KerberosPrincipal.class));
            argColl.add(new ClientMinPrincipalType(KerberosPrincipal.class));
            argColl.add(new ClientMinPrincipalType(X500Principal.class));
            argColl.add(new ServerMinPrincipal(new
                    KerberosPrincipal("duke@FOO.COM")));
            argColl.add(new ServerMinPrincipal(new
                    KerberosPrincipal("duke@FOO.COM")));
            argColl.add(new ServerMinPrincipal(new
                    X500Principal(
                    "CN=Duke, OU=JavaSoft, O=Sun Microsystems, C=US")));
            argColl.add(new ConnectionAbsoluteTime((long) 0));
            argColl.add(new ConnectionAbsoluteTime((long) 0));
            argColl.add(new ConnectionAbsoluteTime((long) 1));
            argColl.add(new ConnectionRelativeTime((long) 0));
            argColl.add(new ConnectionRelativeTime((long) 0));
            argColl.add(new ConnectionRelativeTime((long) 1));
            argColl.add(new DelegationAbsoluteTime((long) 0, (long) 0, (long) 0,
                    (long) 0));
            argColl.add(new DelegationAbsoluteTime((long) 0, (long) 0, (long) 0,
                    (long) 0));
            argColl.add(new DelegationAbsoluteTime((long) 1, (long) 1, (long) 1,
                    (long) 1));
            argColl.add(new DelegationRelativeTime((long) 0, (long) 0, (long) 0,
                    (long) 0));
            argColl.add(new DelegationRelativeTime((long) 0, (long) 0, (long) 0,
                    (long) 0));
            argColl.add(new DelegationRelativeTime((long) 1, (long) 1, (long) 1,
                    (long) 1));

            // Expected result of ConstraintAlternatives.create() methods
            Collection expColl = new ArrayList();
            expColl.add(ClientAuthentication.YES);
            expColl.add(ClientAuthentication.NO);
            expColl.add(Confidentiality.YES);
            expColl.add(Confidentiality.NO);
            expColl.add(Delegation.YES);
            expColl.add(Delegation.NO);
            expColl.add(Integrity.YES);
            expColl.add(Integrity.NO);
            expColl.add(ServerAuthentication.YES);
            expColl.add(ServerAuthentication.NO);
            expColl.add(new ClientMaxPrincipal(new
                    KerberosPrincipal("duke@FOO.COM")));
            expColl.add(new ClientMaxPrincipal(new
                    X500Principal(
                    "CN=Duke, OU=JavaSoft, O=Sun Microsystems, C=US")));
            expColl.add(new ClientMaxPrincipalType(KerberosPrincipal.class));
            expColl.add(new ClientMaxPrincipalType(X500Principal.class));
            expColl.add(new ClientMinPrincipal(new
                    KerberosPrincipal("duke@FOO.COM")));
            expColl.add(new ClientMinPrincipal(new
                    X500Principal(
                    "CN=Duke, OU=JavaSoft, O=Sun Microsystems, C=US")));
            expColl.add(new ClientMinPrincipalType(KerberosPrincipal.class));
            expColl.add(new ClientMinPrincipalType(X500Principal.class));
            expColl.add(new ServerMinPrincipal(new
                    KerberosPrincipal("duke@FOO.COM")));
            expColl.add(new ServerMinPrincipal(new
                    X500Principal(
                    "CN=Duke, OU=JavaSoft, O=Sun Microsystems, C=US")));
            expColl.add(new ConnectionAbsoluteTime((long) 0));
            expColl.add(new ConnectionAbsoluteTime((long) 1));
            expColl.add(new ConnectionRelativeTime((long) 0));
View Full Code Here

TOP

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

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.