Examples of TestException


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<nAttrClasses;j++){
    classTypes = proxy.getEntryClasses(tmpls[i][j]);
    if (!QATestUtils.classTypesEqualTypeDescriptors(classTypes,
                   expectedTypeDescs[j]))
          {
        throw new TestException("not ALL service type "
              + "descriptors were returned");
    }
      }
  }
    }
View Full Code Here

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

    case QATestRegistrar.SELECT_METHOD_SAME_ONE:
              /* Verify that the service returned is always the
               * same service each time lookup() is called.
         */
              if (histogram[j].size() != 1) {
                  throw new TestException
                                ("histogram["+j+"].size ("
                                       +histogram[j].size()+") != 1" );
        }
              break;
    case QATestRegistrar.SELECT_METHOD_RANDOM:
              /* Test for randomness. A formal test for randomness (such
               * as a test for a Guassian Distribution) is not used.
               * For the purposes of this test, it is enough that at
               * least half of the number of possible matches have been
               * returned. This is true if the number of "hits" in the
               * histogram is at least half the value of
               * expectedNMatchesExact.
         */
              if (histogram[j].size()<(RN*expectedNMatchesExact[j])/RD) {
                  throw new TestException
                     (" histogram["+j+"].size() ("
                             +histogram[j].size()+") < ("
                             +RN+"*"+expectedNMatchesExact[j]+")/"+RD+
                            " (= "+(RN*expectedNMatchesExact[j])/RD+")");
        }
              break;
    default:
              throw new TestException
             ("INVALID Selection Method Value ("+selectMethod+")");
      }
  }
    }
View Full Code Here

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

        SimpleEntry result;
        Transaction txn1, txn2;

        // first check that space is empty
        if (!checkSpace(space)) {
            throw new TestException(
                    "Space is not empty in the beginning.");
        }

        // create snapshot
        snapshot = space.snapshot(sampleEntry);

        // write sample entry to the space
        space.write(sampleEntry, null, leaseForeverTime);

        // create two non null transactions
        txn1 = getTransaction();
        txn2 = getTransaction();

        /*
         * take written entry from the space within 1-st transaction
         * using it's snapshot
         */
        space.take(snapshot, txn1, checkTime);

        // check that we can not read the entry outside both transactions
        result = (SimpleEntry) space.read(sampleEntry, null, checkTime);

        if (result != null) {
            throw new TestException(
                    "performed read with template " + sampleEntry
                    + " outside both transactions while taking it within"
                    + " 1-st one, expected null but read " + result);
        }
        logDebugText("Entry can't be read outside both transactions.");

        /*
         * check that we can not read the entry outside both transactions
         * using it's snapshot
         */
        result = (SimpleEntry) space.read(snapshot, null, checkTime);

        if (result != null) {
            throw new TestException(
                    "performed read with template " + sampleEntry
                    + " outside both transactions using it's snapshot"
                    + " while taking it within"
                    + " 1-st one, expected null but read " + result);
        }
        logDebugText("Entry can't be read outside both transactions"
                + " using it's snapshot.");

        // check that we can not read the entry within another transaction
        result = (SimpleEntry) space.read(sampleEntry, txn2, checkTime);

        if (result != null) {
            throw new TestException(
                    "performed read with template " + sampleEntry
                    + " within 2-nd transaction while taking it"
                    + " within 1-st one, expected null but read " + result);
        }
        logDebugText("Entry can't be read in 2-nd transaction.");

        /*
         * check that we can not read the entry within another transaction
         * using it's snapshot
         */
        result = (SimpleEntry) space.read(snapshot, txn2, checkTime);

        if (result != null) {
            throw new TestException(
                    "performed read with template " + sampleEntry
                    + " within 2-nd transaction using it's snapshot"
                    + " while taking it"
                    + " within 1-st one, expected null but read " + result);
        }
        logDebugText("Entry can't be read in 2-nd transaction"
                + " using it's snapshot.");

        // check that we can not take the entry outside both transactions
        result = (SimpleEntry) space.take(sampleEntry, null, checkTime);

        if (result != null) {
            throw new TestException(
                    "performed take with template " + sampleEntry
                    + " outside both transactions while taking it"
                    + " within 1-st one, expected null but took " + result);
        }
        logDebugText("Entry can't be taken outside both transactions.");

        /*
         * check that we can not take the entry outside both transactions
         * using it's snapshot
         */
        result = (SimpleEntry) space.take(snapshot, null, checkTime);

        if (result != null) {
            throw new TestException(
                    "performed take with template " + sampleEntry
                    + " outside both transactions using it's snapshot"
                    + " while taking it"
                    + " within 1-st one, expected null but took " + result);
        }
        logDebugText("Entry can't be taken outside both transactions"
                + " using it's snapshot.");

        // check that we can not take the entry within another transaction
        result = (SimpleEntry) space.take(sampleEntry, txn2, checkTime);

        if (result != null) {
            throw new TestException(
                    "performed take with template " + sampleEntry
                    + " within 2-nd transaction while taking it"
                    + " within 1-st one, expected null but took " + result);
        }
        logDebugText("Entry can't be taken in 2-nd transaction.");

        /*
         * check that we can not take the entry within another transaction
         * using it's snapshot
         */
        result = (SimpleEntry) space.take(snapshot, txn2, checkTime);

        if (result != null) {
            throw new TestException(
                    "performed take with template " + sampleEntry
                    + " within 2-nd transaction using it's snapshot"
                    + " while taking it"
                    + " within 1-st one, expected null but took " + result);
        }
View Full Code Here

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

  for (int i=0; i<nClasses; i++) {
      classTypes = proxy.getServiceTypes(classTmpls[i],null);     
      if (!QATestUtils.classTypesEqualTypeDescriptors(classTypes,
                  expectedTypeDescs[i]))
      {
    throw new TestException("For Attribute["+i+ "], "
            + "not all service type "
            + "descriptors were returned");
      }
  }
    }
View Full Code Here

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

      classTypes = proxy.getEntryClasses(tmpls[i]);
      if (!QATestUtils.classTypesEqualTypeDescriptors
                                    (classTypes,
                                                 expectedTypeDescs[i]))
      {
    throw new TestException("not ALL expected service type "
          + "descriptors were returned");
      }
  }
    }
View Full Code Here

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

   */
  if (evntVec.size() != 0) {
      String message = "evntVec.size() != 0\n" +
    "Event leases expired yet " + evntVec.size() +
    " event(s) arrived.";
      throw new TestException(message);
  }
    }
View Full Code Here

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

  // assert we received exactly one event
  RemoteEvent[] events = rrl.getEvents();
  if (events.length != 1) {
      String message = "Listener received " + events.length +
    " events but is required to receive exactly 1.";
      throw new TestException(message);
  }

  // the encapsulated Throwable should be null
  RenewalFailureEvent rfe = (RenewalFailureEvent) events[0];
  Throwable except = rfe.getThrowable();
  if (except != null) {
      String message = "The event encapsulated a Throwable of " +
    "type " + except.getClass() + " but should have returned" +
    " a value of null.";
      throw new TestException(message);
  }
    }
View Full Code Here

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

        Transaction txn;
        String msg;

        // first check that space is empty
        if (!checkSpace(space)) {
            throw new TestException("Space is not empty in the beginning.");
        }

        // write three sample entries twice to the space
        space.write(sampleEntry1, null, leaseForeverTime);
        space.write(sampleEntry1, null, leaseForeverTime);
        space.write(sampleEntry2, null, leaseForeverTime);
        space.write(sampleEntry2, null, leaseForeverTime);
        space.write(sampleEntry3, null, leaseForeverTime);
        space.write(sampleEntry3, null, leaseForeverTime);

        // create the non null transaction
        txn = getTransaction();

        /*
         * readIfExists 1-st entry from the space using snapshot of
         * the same one as a template with JavaSpace.NO_WAIT timeout
         * within the transaction
         */
        msg = testTemplate(sampleEntry1, txn, JavaSpace.NO_WAIT, 0, true);

        if (msg != null) {
            throw new TestException(msg);
        }

        /*
         * readIfExists sample entry from the space using snapshots of
         * wrong template entries and JavaSpace.NO_WAIT timeout
         * within the transaction
         */
        template = new SimpleEntry("TestEntry #3", 1);
        msg = testWrongTemplate(template, txn, JavaSpace.NO_WAIT, 0, true);

        if (msg != null) {
            throw new TestException(msg);
        }

        // 2-nd wrong template
        template = new SimpleEntry("TestEntry #1", 3);
        msg = testWrongTemplate(template, txn, JavaSpace.NO_WAIT, 0, true);

        if (msg != null) {
            throw new TestException(msg);
        }

        // 3-rd wrong template
        template = new SimpleEntry("TestEntry #3", 3);
        msg = testWrongTemplate(template, txn, JavaSpace.NO_WAIT, 0, true);

        if (msg != null) {
            throw new TestException(msg);
        }

        // 4-th wrong template
        template = new SimpleEntry(null, 3);
        msg = testWrongTemplate(template, txn, JavaSpace.NO_WAIT, 0, true);

        if (msg != null) {
            throw new TestException(msg);
        }

        // 5-th wrong template
        template = new SimpleEntry("TestEntry #3", null);
        msg = testWrongTemplate(template, txn, JavaSpace.NO_WAIT, 0, true);

        if (msg != null) {
            throw new TestException(msg);
        }

        /*
         * readIfExists entry from the space using snapshot of null as a
         * template and JavaSpace.NO_WAIT timeout within the transaction
         */
        msg = testTemplate(null, txn, JavaSpace.NO_WAIT, 0, true);

        if (msg != null) {
            throw new TestException(msg);
        }

        /*
         * readIfExists sample entries from the space using snapshots of
         * templates with null as a wildcard for different fields
         * and JavaSpace.NO_WAIT timeout within the transaction
         */
        template = new SimpleEntry("TestEntry #1", null);
        msg = testTemplate(template, txn, JavaSpace.NO_WAIT, 0, true);

        if (msg != null) {
            throw new TestException(msg);
        }

        // try 2-nd template
        template = new SimpleEntry(null, 2);
        msg = testTemplate(template, txn, JavaSpace.NO_WAIT, 0, true);

        if (msg != null) {
            throw new TestException(msg);
        }

        // 3-rd template
        template = new SimpleEntry(null, null);
        msg = testTemplate(template, txn, JavaSpace.NO_WAIT, 0, true);

        if (msg != null) {
            throw new TestException(msg);
        }

        // commit the transaction
        txnCommit(txn);
    }
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.