Package net.jini.core.constraint

Examples of net.jini.core.constraint.ConstraintAlternatives


        try {
            HashSet set = new HashSet();
            set.add(ClientAuthentication.YES);
            set.add(ClientAuthentication.NO);
            ConstraintAlternatives obj1 = new ConstraintAlternatives(set);
            ConstraintAlternatives obj2 = new ConstraintAlternatives(set);
            set.add(Confidentiality.YES);
            ConstraintAlternatives obj3 = new ConstraintAlternatives(set);

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


  }
    }

    private static boolean supported(InvocationConstraint ic) {
  if (ic instanceof ConstraintAlternatives) {
      ConstraintAlternatives ca = (ConstraintAlternatives) ic;
      for (Iterator i = ca.elements().iterator(); i.hasNext(); ) {
    if (supported((InvocationConstraint) i.next())) {
        return true;
    }
      }
      return false;
View Full Code Here

            expColl.add(new DelegationRelativeTime((long) 0, (long) 0, (long) 0,
                    (long) 0));
            expColl.add(new DelegationRelativeTime((long) 1, (long) 1, (long) 1,
                    (long) 1));

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

        // TestCase #21
        logger.log(Level.FINE,
                "\n\t+++++ TestCase #21:: "
                + "Argument passed to ConstraintAlternatives.create() methods"
                + " is null");
        {
            if (!checkException((Collection) null,
                    java.lang.NullPointerException.class)) {
                throw new TestException(
                        "" + " test failed");
            }

            if (!checkException((InvocationConstraint[]) null,
                    java.lang.NullPointerException.class)) {
                throw new TestException(
                        "" + " test failed");
            }
        }

        // TestCase #22
        logger.log(Level.FINE,
                "\n\t+++++ TestCase #22:: "
                + "Argument passed to ConstraintAlternatives.create() methods"
                + " is non-null, but contains null element");
        {
            Collection argColl = new ArrayList();
            argColl.add(ClientAuthentication.YES);
            argColl.add(null);

            if (!checkException(argColl,
                    java.lang.NullPointerException.class)) {
                throw new TestException(
                        "" + " test failed");
            }
            InvocationConstraint[] argArray = (InvocationConstraint[])
                    argColl.toArray(new InvocationConstraint[0]);

            if (!checkException(argArray,
                    java.lang.NullPointerException.class)) {
                throw new TestException(
                        "" + " test failed");
            }
        }

        // TestCase #23
        logger.log(Level.FINE,
                "\n\t+++++ TestCase #23:: "
                + "Argument passed to ConstraintAlternatives.create() methods"
                + " is empty");
        {
            if (!checkException(Collections.EMPTY_LIST,
                    java.lang.IllegalArgumentException.class)) {
                throw new TestException(
                        "" + " test failed");
            }

            if (!checkException(new InvocationConstraint[0],
                    java.lang.IllegalArgumentException.class)) {
                throw new TestException(
                        "" + " test failed");
            }
        }

        // TestCase #24
        logger.log(Level.FINE,
                "\n\t+++++ TestCase #24:: "
                + "Argument passed to ConstraintAlternatives.create() methods"
                + " contain element that is an instance of"
                + " ConstraintAlternatives");

        try {
            // Temporary Collection
            Collection tmpColl = new ArrayList();
            tmpColl.add(ClientAuthentication.YES);
            tmpColl.add(Confidentiality.YES);

            // Arguments
            Collection argColl = new ArrayList();
            argColl.add(ClientAuthentication.YES);
            argColl.add(Confidentiality.YES);
            argColl.add(new ConstraintAlternatives(tmpColl));
            InvocationConstraint[] argArray = (InvocationConstraint[])
                    argColl.toArray(new InvocationConstraint[0]);

            if (!checkException(argColl,
                    java.lang.IllegalArgumentException.class)) {
View Full Code Here

TOP

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

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.