Examples of TestException


Examples of com.sun.jini.qa.harness.TestException

                    || tc == CL_MIN_PR_TYPE__ARRAY__EMPTY
                    || tc == CL_MIN_PR_TYPE__ARRAY__PRIM_TYPE
                    || tc == CL_MIN_PR_TYPE__ARRAY__ARRAY_TYPE
                    || tc == CL_MIN_PR_TYPE__ARRAY__NOT_PRINCIPAL) {
                logger.log(Level.FINE, "Expected Exception type:: " + ex);
                throw new TestException("Instead of " + ex + " no Exception"
                        + " has been thrown while invoking constructor");
            }
        } catch (Exception e) {
            logger.log(Level.FINE, "Exception while invoking constructor " + e);
            // If no Exception is expected
            if (       tc == CL_MAX_PR_TYPE__CLASS
                    || tc == CL_MIN_PR_TYPE__CLASS
                    || tc == CL_MAX_PR_TYPE__ARRAY
                    || tc == CL_MIN_PR_TYPE__ARRAY) {
                throw new TestException("Exception while invoking constructor ",
                        e);
            }

            // If some Exception is expected
            if (!ex.equals(e.getClass())) {
                logger.log(Level.FINE, "Expected Exception:: " + ex);
                logger.log(Level.FINE, "Thrown   Exception:: " + e.getClass());
                throw new TestException("Instead of " + ex + " "
                        + e.getClass() + " has been thrown while"
                        + " invoking constructor");
            } else {
                return;
            }
        }

        // logger.log(Level.INFO, "Returned object: " + ic.toString());

        /*
         * Verify that the corresponding constraint object is created.
         */
        if (ic == null) {
            logger.log(Level.FINE, "Constraint object hasn't been created");
            throw new TestException("Constraint object hasn't been created");
        }

        if (       (tc == CL_MAX_PR_TYPE__CLASS
                 || tc == CL_MAX_PR_TYPE__ARRAY)
                && !(ic instanceof ClientMaxPrincipalType)) {
            logger.log(Level.FINE,
                    "Instead of ClientMaxPrincipalType " + ic.getClass()
                    + " object is returned");
            throw new TestException("Instead of ClientMaxPrincipalType "
                    + ic.getClass() + " object is returned");
        } else if ((tc == CL_MIN_PR_TYPE__CLASS
                 || tc == CL_MIN_PR_TYPE__ARRAY)
                && !(ic instanceof ClientMinPrincipalType)) {
            logger.log(Level.FINE,
                    "Instead of ClientMinPrincipalType " + ic.getClass()
                    + " object is returned");
            throw new TestException("Instead of ClientMinPrincipalType "
                    + ic.getClass() + " object is returned");
        }

        /*
         * Verify that the argument passed to the constructor isn't modified.
         * Compare argument for the constructor before and after invoking the
         * constructor.
         */

        // logger.log(Level.INFO, "Argument before invoking the constructor:");
        // for (int i = 0; i < cl_copy.length; i++) {
        // logger.log(Level.INFO, "cl_copy[" + i + "]:: " + cl_copy[i]);
        // }
        // logger.log(Level.INFO, "Argument after invoking the constructor :");
        // for (int i = 0; i < cl.length; i++) {
        // logger.log(Level.INFO, "cl[" + i + "]:: " + cl[i]);
        // }
        if (!Arrays.equals(cl, cl_copy)) {
            logger.log(Level.FINE,
                    "The argument passed to the constructor is modified");
            throw new TestException("The argument passed to the constructor"
                    + " is modified");
        }
        logger.log(Level.FINE,
                "The argument passed to the constructor isn't modified");

        /*
         * Verify that the argument passed to the constructor isn't retained;
         * subsequent changes to that argument have no effect on the instance
         * created. Compare set of all of the classes from the created
         * object before and after changing the argument.
         */
        Set icSet_before = null;

        try {
            Class icClass = ic.getClass();
            Method elementsMethod = icClass.getMethod("elements", null);
            // Get set of classes from the created constraint
            icSet_before = (Set) elementsMethod.invoke(ic, null);

            /*
             * Change argument passed to the constructor while creating
             * the constraint
             */
            for (int i = 0; i < cl.length; i++) {
                cl[i] = Exception.class;
            }

            // Get set of classes from the created constraint
            Set icSet_after = (Set) elementsMethod.invoke(ic, null);
            // logger.log(Level.INFO, "Set of all of the classes of created object"
            // + " before modification of arg passed to the constructor: "
            // + icSet_before);
            // logger.log(Level.INFO, "Set of all of the classes of created object"
            // + " after modification of arg passed to the constructor : "
            // + icSet_after);
            if (!icSet_after.equals(icSet_before)) {
                logger.log(Level.FINE,
                        "The argument passed to the constructor is retained");
                throw new TestException("The argument passed to the"
                        + " constructor is retained");
            }
        } catch (Exception e) {
            logger.log(Level.FINE,
                    "Exception is thrown while invoking elements() method using"
                    + " reflection: " + e);
            throw new TestException("Exception is thrown while invoking"
                    + " elements() method using reflection.", e);
        }
        logger.log(Level.FINE,
                "The argument passed to the constructor isn't retained");

View Full Code Here

Examples of com.sun.jini.qa.harness.TestException

                    || tc == CL_MIN_PR_TYPE__COLL__ILL_EL
                    || tc == CL_MIN_PR_TYPE__COLL__PRIM_TYPE
                    || tc == CL_MIN_PR_TYPE__COLL__ARRAY_TYPE
                    || tc == CL_MIN_PR_TYPE__COLL__NOT_PRINCIPAL) {
                logger.log(Level.FINE, "Expected Exception type:: " + ex);
                throw new TestException("Instead of " + ex + " no Exception"
                        + " has been thrown while invoking constructor");
            }
        } catch (Exception e) {
            logger.log(Level.FINE, "Exception while invoking constructor: " + e);
            // If no Exception is expected
            if (       tc == CL_MAX_PR_TYPE__COLL
                    || tc == CL_MIN_PR_TYPE__COLL) {
                throw new TestException(
                        "Exception while invoking constructor", e);
            }

            // If some Exception is expected
            if (!ex.equals(e.getClass())) {
                logger.log(Level.FINE, "Expected Exception:: " + ex);
                logger.log(Level.FINE, "Thrown   Exception:: " + e.getClass());
                throw new TestException("Instead of " + ex + " "
                        + e.getClass() + " has been thrown while"
                        + " invoking constructor");
            } else {
                return;
            }
        }

        // logger.log(Level.INFO, "Returned object: " + ic.toString());

        /*
         * Verify that the corresponding constraint object is created.
         */
        if (ic == null) {
            logger.log(Level.FINE, "Constraint object hasn't been created");
            throw new TestException("Constraint object hasn't been created");
        }

        if (       tc == CL_MAX_PR_TYPE__COLL
                && !(ic instanceof ClientMaxPrincipalType)) {
            logger.log(Level.FINE,
                    "Instead of ClientMaxPrincipalType " + ic.getClass()
                    + " object is returned");
            throw new TestException("Instead of ClientMaxPrincipalType "
                    + ic.getClass() + " object is returned");
        } else if (tc == CL_MIN_PR_TYPE__COLL
                && !(ic instanceof ClientMinPrincipalType)) {
            logger.log(Level.FINE,
                    "Instead of ClientMinPrincipalType " + ic.getClass()
                    + " object is returned");
            throw new TestException("Instead of ClientMinPrincipalType "
                    + ic.getClass() + " object is returned");
        }

        /*
         * Verify that the argument passed to the constructor isn't modified.
         * Compare argument for the constructor before and after invoking the
         * constructor.
         */

        // logger.log(Level.INFO, "Argument before invoking the constructor: "
        // + cl_copy);
        // logger.log(Level.INFO, "Argument after invoking the constructor : "
        // + cl);
        if (!cl.equals(cl_copy)) {
            logger.log(Level.FINE,
                    "The argument passed to the constructor is modified");
            throw new TestException("The argument passed to the constructor"
                    + " is modified");
        }
        logger.log(Level.FINE,
                "The argument passed to the constructor isn't modified");

        /*
         * Verify that the argument passed to the constructor isn't retained;
         * subsequent changes to that argument have no effect on the instance
         * created. Compare set of all of the classes from the created
         * object before and after changing the argument.
         */
        Set icSet_before = null;

        try {
            Class icClass = ic.getClass();
            Method elementsMethod = icClass.getMethod("elements", null);
            // Get set of classes from the created constraint
            icSet_before = (Set) elementsMethod.invoke(ic, null);

            /*
             * Change argument passed to the constructor while creating
             * the constraint
             */
            cl.clear();
            // Get set of classes from the created constraint
            Set icSet_after = (Set) elementsMethod.invoke(ic, null);
            // logger.log(Level.INFO, "Set of all of the classes of created object"
            // + " before modification of arg passed to the constructor: "
            // + icSet_before);
            // logger.log(Level.INFO, "Set of all of the classes of created object"
            // + " after modification of arg passed to the constructor : "
            // + icSet_after);
            if (!icSet_after.equals(icSet_before)) {
                logger.log(Level.FINE,
                        "The argument passed to the constructor is retained");
                throw new TestException("The argument passed to the"
                        + " constructor is retained");
            }
        } catch (Exception e) {
            logger.log(Level.FINE,
                    "Exception is thrown while invoking elements() method using"
                    + " reflection: " + e);
            throw new TestException("Exception is thrown while invoking"
                    + " elements() method using reflection.", e);
        }
        logger.log(Level.FINE,
                "The argument passed to the constructor isn't retained");

View Full Code Here

Examples of com.sun.jini.qa.harness.TestException

            for (int i = j + 1; i < arr.length; i++) {
                if (arr[i].equals(arr[j])) {
                    logger.log(Level.FINE, "Duplicates aren't removed");
                    logger.log(Level.FINE, "arr[" + j + "]:: " + arr[j]);
                    logger.log(Level.FINE, "arr[" + i + "]:: " + arr[i]);
                    throw new TestException("Duplicates aren't removed");
                }
            }
        }
    }
View Full Code Here

Examples of com.sun.jini.qa.harness.TestException

         * no questions asked. If explicit ports were set in config, then
         * verify that what was started equals what was wanted.
         */
        if(lookupsToStart.size() > 0) {//explicit ports were set in config
            if(!collectionsEqual(lookupsToStart,locatorsStarted)) {
                throw new TestException("locators started != locators "
                                          +"wanted");

            }//endif
        }//endif
        nStarted = genMap.size();
View Full Code Here

Examples of com.sun.jini.qa.harness.TestException

            DiscoveryServiceUtil.delayMS(1000);
        }//end loop(timerLoop)
        logger.log(Level.FINE, "DISCOVERY wait period complete");
        /* Verify discovery was successful */
        if(nGoodDiscoverySets != nCurRegistrations) {
            throw new TestException("discovery failed -- "
                                      +"waited "+nSecsToWait1
                                      +" seconds ("+(nSecsToWait1/60)
                                      +" minutes) -- "
                                      +nCurRegistrations
                                      +" registration(s) with lookup "
View Full Code Here

Examples of com.sun.jini.qa.harness.TestException

        }//end loop(timerLoop)
        logger.log(Level.FINE, "DISCARD wait period complete -- "
                          +"waited an extra "+n+" seconds");
        /* Verify discard was successful */
        if(nGoodSets != nCurRegistrations) {
            throw new TestException("discard failed -- "
                                      +"waited "
                                      +(nSecsToWait0+nSecsToWait1)
                                      +" seconds ("
                                      +((nSecsToWait0+nSecsToWait1)/60)
                                      +" minutes) -- "
View Full Code Here

Examples of com.sun.jini.qa.harness.TestException

            for(int i=0;iter.hasNext();i++) {
                Object key = iter.next();
                String[] groups0 = (String[])newMap0.get(key);
                String[] groups1 = (String[])newMap1.get(key);
                if( (groups0 == null) || (groups1 == null) ) {
                    throw new TestException("failure -- "
                                         +" no mapping for lookup service "+i);
                }
                if( !GroupsUtil.compareGroupSets(groups0,groups1,Level.OFF) ) {
                    GroupsUtil.displayGroupSet(groups0,"groups0",
                                               Level.FINE);
                    GroupsUtil.displayGroupSet(groups1,"groups1",
                                               Level.FINE);
                    throw new TestException("failure -- "
                                   +" groups not equal for lookup service "+i);
                }
            }//end loop
        }//end sync
    }//end testGroupSetContainment
View Full Code Here

Examples of com.sun.jini.qa.harness.TestException

      for(int j=0;j<fieldStr[i].length;j++) {
    try {
              fieldValues = proxy.getFieldValues(tmpl,i,fieldStr[i][j]);
              if (!(fieldValuesEqualExpected(fieldValues,i,j)))
        {
                  throw new TestException
                              ("For Attr["+i+"], Field ("+fieldStr[i][j]+
                                                  "): Unexpected Value");
        }
    } catch (NoSuchFieldException e) {  // is this necessary??
              if (!(fieldValuesEqualExpected(fieldValues,i,j)))
        {
                  throw new TestException
                              ("For Attr["+i+"], Field ("+fieldStr[i][j]+
                                                  "): Unexpected Value");
        }
       }
      }
View Full Code Here

Examples of com.sun.jini.qa.harness.TestException

         * no questions asked. If explicit ports were set in config, then
         * verify that what was started equals what was wanted.
         */
        if(lookupsToStart.size() > 0) {//explicit ports were set in config
            if(!collectionsEqual(lookupsToStart,locatorsStarted)) {
                throw new TestException("locators started != locators "
                                          +"wanted");

            }//endif
        }//endif
        nStarted = genMap.size();
View Full Code Here

Examples of com.sun.jini.qa.harness.TestException

            DiscoveryServiceUtil.delayMS(1000);
        }//end loop(timerLoop)
        logger.log(Level.FINE, "DISCOVERY wait period complete");
        /* Verify discovery was successful */
        if(nGoodDiscoverySets != nCurRegistrations) {
            throw new TestException("discovery failed -- "
                                      +"waited "+nSecsToWait1
                                      +" seconds ("+(nSecsToWait1/60)
                                      +" minutes) -- "
                                      +nCurRegistrations
                                      +" registration(s) with lookup "
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.