Package net.jini.core.constraint

Examples of net.jini.core.constraint.ClientMinPrincipal


        new InvocationConstraint[] {
      new ClientMaxPrincipal(
                            new Principal[] {cps[0], cps[1], cps[2]})},
        new InvocationConstraint[] {
      Integrity.NO, // will be ignored
      new ClientMinPrincipal(cps[1]),
      Delegation.YES}),
    emptyConstraints, /* clientUnfulfilledConstraints */
    null,
    emptyConstraints, /* serverUnfulfilledConstraints */
    new KerberosPrincipal[] {cps[1]}, null, false, true),
      new EndpointTest( // test preference, delegation not necessary
    "PreferenceConstraintTestDelegationNotPreferred",
    new InvocationConstraints(
        new InvocationConstraint[] {
      new ClientMaxPrincipal(
                            new Principal[] {cps[0], cps[1], cps[2]})},
        new InvocationConstraint[] {
      new ClientMinPrincipal(cps[2]), // not necessary
      Integrity.YES,
      Confidentiality.YES}), // preferred, but not necessary
    integrityPreferredConstraints, /* clientUnfulfilledCs */
    null,
    emptyConstraints, /* serverUnfulfilledConstraints */
    new KerberosPrincipal[] {cps[2]}, null, true, false),
      /* -- permission tests -- */
      new EndpointTest(
    "ClientPermissionNoSocketPermTest",
    new Permission[0],   /* clientPerms = default + auth */
    false,
    null,         /* serverPerms, default to the right set */
    true,
    defaultPermsNoSocketPerm),
      new EndpointTest(
    "ServerPermissionNoSocketPermTest",
    null,         /* clientPerms, default to the right set */
    true,
    new Permission[0],   /* serverPerms = default + auth */
    false,
    defaultPermsNoSocketPerm),
      new EndpointTest(
    "ClientPermissionNoAuthPermTest",
    defaultPermsWithSocketPerm, /* clientPerms */
    false,
    null,         /* serverPerms, default to the right set */
    true,
    null),
      new EndpointTest(
    "ServerPermissionNoAuthPermtest",
    null,         /* clientPerms, default to the right set */
    true,
    defaultPermsWithSocketPerm, /* serverPerms */
    false,
    null),
      /* -- connection time constraint tests -- */
      new EndpointTest(
    "ConnectionAbsoluteTimeConstraintClientPassTest",
    new InvocationConstraints(
        new InvocationConstraint[] {
      new ConnectionAbsoluteTime(
          System.currentTimeMillis() + 1000 * 1800)},
        null),
    emptyConstraints, /* clientUnfulfilledConstraints */
    null,
    emptyConstraints, /* serverUnfulfilledConstraints */
    null, null, false, false),
      new EndpointTest(
    "ConnectionAbsoluteTimeConstraintAlternativesClientPassTest",
    new InvocationConstraints(
        new ConstraintAlternatives(
      new InvocationConstraint[] {
          new ConnectionAbsoluteTime(
        System.currentTimeMillis() + 1000 * 1800),
          new ConnectionAbsoluteTime(3)}),
        null),
    emptyConstraints, /* clientUnfulfilledConstraints */
    null,
    emptyConstraints, /* serverUnfulfilledConstraints */
    null, null, false, false),
      new EndpointTest(
    "ConnectionAbsoluteTimeConstraintClientFailTest1",
    new InvocationConstraints(
        new InvocationConstraint[] {
      new ConnectionAbsoluteTime(3)},
        null),
    null, // clientUnfulfilledConstraints, null indicates failure
    null,
    emptyConstraints, /* serverUnfulfilledConstraints */
    null, null, false, false),
      new EndpointTest(
    "ConnectionAbsoluteTimeConstraintClientFailTest2",
    new InvocationConstraints(
        new InvocationConstraint[] {
      new ConnectionAbsoluteTime(
          System.currentTimeMillis() + 1000 * 1800),
      new ConnectionAbsoluteTime(3)},
        null),
    null, // clientUnfulfilledConstraints, null indicates failure
    null,
    emptyConstraints, /* serverUnfulfilledConstraints */
    null, null, false, false),
      new EndpointTest(
    "ConnectionAbsoluteTimeConstraintServerPassTest1",
    null,
    emptyConstraints, /* clientUnfulfilledConstraints */
    new InvocationConstraints(
        new InvocationConstraint[] {
      new ConnectionAbsoluteTime(3)},
        null),
    emptyConstraints, /* serverUnfulfilledConstraints */
    null, null, false, false),
      new EndpointTest(
    "ConnectionAbsoluteTimeConstraintServerPassTest2",
    null,
    emptyConstraints, /* clientUnfulfilledConstraints */
    new InvocationConstraints(
        new InvocationConstraint[] {
      new ConnectionAbsoluteTime(
          System.currentTimeMillis() + 1000 * 1800)},
        null),
    emptyConstraints, /* serverUnfulfilledConstraints */
    null, null, false, false),
      new EndpointTest(
    "ConnectionRelativeTimeConstraintClientPassTest",
    new InvocationConstraints(
        new InvocationConstraint[] {
      new ConnectionRelativeTime(1000 * 1800)},
        null),
    emptyConstraints, /* clientUnfulfilledConstraints */
    null,
    emptyConstraints, /* serverUnfulfilledConstraints */
    null, null, false, false),
      new EndpointTest(
    "ConnectionRelativeTimeConstraintServerFailTest",
    null,
    emptyConstraints, /* clientUnfulfilledConstraints */
    new InvocationConstraints(
        new InvocationConstraint[] {
      new ConnectionRelativeTime(1000 * 1800)},
        null),
    emptyConstraints, /* clientUnfulfilledConstraints */
    null, null, false, false),
      /* -- authentication tests -- */
      new EndpointTest(
    "AuthenticatonYESTest",
    new InvocationConstraints(
        new InvocationConstraint[] {ClientAuthentication.YES},
        null),
    emptyConstraints, /* clientUnfulfilledCs */
    new InvocationConstraints(
        new InvocationConstraint[] {ServerAuthentication.YES},
        null),
    emptyConstraints, /* serverUnfulfilledConstraints */
    null, null, false, false),
      new EndpointTest(
    "AuthenticationNOTest1",
    new InvocationConstraints(
        new InvocationConstraint[] {ClientAuthentication.NO},
        null),
    null, // clientUnfulfilledConstraints, null indicates failure
    null,
    emptyConstraints, /* serverUnfulfilledConstraints */
    null, null, false, false),
      new EndpointTest(
    "AuthenticationNOTest2",
    null,
    emptyConstraints, /* clientUnfulfilledConstraints */
    new InvocationConstraints(
        new InvocationConstraint[] {ServerAuthentication.NO},
        null),
    null, // serverUnfulfilledConstraints, null indicates failure
    null, null, false, false),
      /* -- unfulfilled constraints tests -- */
      new EndpointTest(
    "UnfulfilledConstraintClientIntegrityRequiredTest",
    new InvocationConstraints(
        new InvocationConstraint[] {
      ClientAuthentication.YES, Integrity.YES},
        null),
    integrityRequiredConstraints, /* clientUnfulfilledCs */
    new InvocationConstraints(
        new InvocationConstraint[] {ServerAuthentication.YES},
        null),
    emptyConstraints, /* serverUnfulfilledConstraints */
    null, null, false, false),
      new EndpointTest(
    "UnfulfilledConstraintClientIntegrityPreferredTest",
    new InvocationConstraints(
        null, new InvocationConstraint[] {Integrity.YES}),
    integrityPreferredConstraints, /* clientUnfulfilledCs */
    new InvocationConstraints(
        new InvocationConstraint[] {ServerAuthentication.YES},
        null),
    emptyConstraints, /* serverUnfulfilledConstraints */
    null, null, false, false),
      new EndpointTest(
    "UnfulfilledConstraintServerIntegrityRequiredTest",
    new InvocationConstraints(
        new InvocationConstraint[] {ClientAuthentication.YES},
        null),
    emptyConstraints, /* serverUnfulfilledConstraints */
    new InvocationConstraints(
        new InvocationConstraint[] {Integrity.YES},
        null),
    integrityRequiredConstraints, /* clientUnfulfilledCs */
    null, null, false, false),
      new EndpointTest(
    "UnfulfilledConstraintServerIntegrityPreferredTest",
    new InvocationConstraints(
        new InvocationConstraint[] {ClientAuthentication.YES},
        null),
    emptyConstraints, /* serverUnfulfilledConstraints */
    new InvocationConstraints(
        null, new InvocationConstraint[] {Integrity.YES}),
    integrityPreferredConstraints, /* clientUnfulfilledCs */
    null, null, false, false),
      /* -- principal constraint tests -- */
      new EndpointTest(
    "ClientPrincipalConstraintValidMinMaxTest",
    new InvocationConstraints(
        new InvocationConstraint[] {
      new ClientMinPrincipal(cps[1]),
      new ClientMaxPrincipal(
                            new Principal[] {cps[1], cps[2], cps[3]})},
        null),
    emptyConstraints, /* clientUnfulfilledConstraints */
    null,
    emptyConstraints, /* serverUnfulfilledConstraints */
    new KerberosPrincipal[] {cps[1]}, null, false, false),
      new EndpointTest(
    "ClientPrincipalConstraintInvalidMinMaxTest",
    new InvocationConstraints(
        new InvocationConstraint[] {
      new ClientMinPrincipal(cps[2]),
      new ClientMaxPrincipal(
                            new Principal[] {cps[1], cps[3]})},
        null),
    null, // clientUnfulfilledConstraints, null indicates failure
    null,
    emptyConstraints, /* serverUnfulfilledConstraints */
    new KerberosPrincipal[] {cps[2]}, null, false, false),
      new EndpointTest(
    "ClientPrincipalConstraintNonKerberosPrincipalTest",
    new InvocationConstraints(
        new InvocationConstraint[] {
      new ClientMinPrincipal(
          new TestPrincipal("CPCT3testPrincipal"))},
        null),
    null, // clientUnfulfilledConstraints, null indicates failure
    null,
    emptyConstraints, /* serverUnfulfilledConstraints */
    new KerberosPrincipal[] {cps[2]}, null, false, false),
      new EndpointTest(
    "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 */
 
View Full Code Here


                "\n\t+++++ TestCase #13:: "
                + "Only duplicate ClientMinPrincipal constraints exist");

        try {
            Collection argColl = new ArrayList();
            ClientMinPrincipal ic = new ClientMinPrincipal(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"
                    + " ClientMinPrincipal object: "
                    + e);
            throw new TestException(
                    "" + " test failed");
        }

        // TestCase #14
        logger.log(Level.FINE,
                "\n\t+++++ TestCase #14:: "
                + "Only duplicate ClientMinPrincipalType constraints exist");

        try {
            Collection argColl = new ArrayList();
            ClientMinPrincipalType ic = new
                    ClientMinPrincipalType(KerberosPrincipal.class);
            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"
                    + " ClientMinPrincipalType object: "
                    + e);
            throw new TestException(
                    "" + " test failed");
        }

        // TestCase #15
        logger.log(Level.FINE,
                "\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
View Full Code Here

                + "  net.jini.core.constraint.ClientMinPrincipal");

        try {
            HashSet set = new HashSet();
            set.add(new KerberosPrincipal("duke@FOO.COM"));
            ClientMinPrincipal obj1 = new ClientMinPrincipal(set);
            ClientMinPrincipal obj2 = new ClientMinPrincipal(set);
            set.add(new
                    X500Principal(
                    "CN=Duke, OU=JavaSoft, O=Sun Microsystems, C=US"));
            ClientMinPrincipal obj3 = new ClientMinPrincipal(set);

            if (!checker(obj1, obj2, obj3)) {
                throw new TestException(
                        "" + " test failed");
            }
View Full Code Here

TOP

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

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.