Package net.jini.core.constraint

Examples of net.jini.core.constraint.ConnectionAbsoluteTime


            InvocationConstraint constraint = null;

            try {
               
                if (       constructorType == CONNECTION_ABSOLUTE_TIME) {
                    constraint = new ConnectionAbsoluteTime(argument);
                    retTime = ((ConnectionAbsoluteTime) constraint).getTime();
                } else if (constructorType == CONNECTION_RELATIVE_TIME) {
                    constraint = new ConnectionRelativeTime(argument);
                    retTime = ((ConnectionRelativeTime) constraint).getTime();
                }
View Full Code Here


  long getValue(InvocationConstraint absTime) {
      return ((ConnectionAbsoluteTime) absTime).getTime();
  }
 
  InvocationConstraint getConstraintInstance(long value) {
      return new ConnectionAbsoluteTime(value);
  }
View Full Code Here

  long getValue(InvocationConstraint absTime) {
      return ((ConnectionAbsoluteTime) absTime).getTime();
  }
 
  InvocationConstraint getConstraintInstance(long value) {
      return new ConnectionAbsoluteTime(value);
  }
View Full Code Here

      /* -- 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(
View Full Code Here

      ))
  ));

  tryProxy(proxy.setConstraints(
      new BasicMethodConstraints(new InvocationConstraints(
    new ConnectionAbsoluteTime(System.currentTimeMillis()),
    null
      ))
  ));

  tryProxy(proxy.setConstraints(
      new BasicMethodConstraints(new InvocationConstraints(
    ConstraintAlternatives.create(new InvocationConstraint[] {
        new ConnectionAbsoluteTime(System.currentTimeMillis()),
        new ConnectionAbsoluteTime(System.currentTimeMillis() + 1)
    }),
    null
      ))
  ));

  tryProxy(proxy.setConstraints(
      new BasicMethodConstraints(new InvocationConstraints(
    null,
    new ConnectionAbsoluteTime(System.currentTimeMillis())
      ))
  ));

  tryProxy(proxy.setConstraints(
      new BasicMethodConstraints(new InvocationConstraints(
    null,
    ConstraintAlternatives.create(new InvocationConstraint[] {
        new ConnectionAbsoluteTime(System.currentTimeMillis()),
        new ConnectionAbsoluteTime(System.currentTimeMillis() + 1)
    })
      ))
  ));

  System.err.println("TEST PASSED");
View Full Code Here

        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));
            expColl.add(new ConnectionRelativeTime((long) 1));
            expColl.add(new DelegationAbsoluteTime((long) 0, (long) 0, (long) 0,
                    (long) 0));
            expColl.add(new DelegationAbsoluteTime((long) 1, (long) 1, (long) 1,
View Full Code Here

            InvocationConstraint constraint = null;

            try {
               
                if (       constructorType == CONNECTION_ABSOLUTE_TIME) {
                    constraint = new ConnectionAbsoluteTime(argument);
                    retTime = ((ConnectionAbsoluteTime) constraint).getTime();
                } else if (constructorType == CONNECTION_RELATIVE_TIME) {
                    constraint = new ConnectionRelativeTime(argument);
                    retTime = ((ConnectionRelativeTime) constraint).getTime();
                }
View Full Code Here

         */
        logger.log(Level.FINE,
                "\n\t+++++ TestCase #7:"
                + "  net.jini.core.constraint.ConnectionAbsoluteTime");
        {
            ConnectionAbsoluteTime obj1 = new
                    ConnectionAbsoluteTime(Long.MAX_VALUE);
            ConnectionAbsoluteTime obj2 = new
                    ConnectionAbsoluteTime(Long.MAX_VALUE);
            ConnectionAbsoluteTime obj3 = new ConnectionAbsoluteTime((long) 0);

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

TOP

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

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.