Package com.sun.jini.qa.harness

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


        long timeout = leaseForeverTime;
        long leaseTime;

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

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

        // create the non null transaction with finite time
        leaseTime = timeout2;
        txn = getTransaction(leaseTime);

        /*
         * take written entry from the space within the transaction
         * to lock take operations outside the transaction
         */
        space.take(sampleEntry1, txn, timeout);

        /*
         * take an entry from the space with timeout less then
         * transaction's lease time, check that take request will return
         * null value in time specified in read request
         */
        curTime1 = System.currentTimeMillis();
        result = (SimpleEntry) space.take(sampleEntry1, null, timeout1);
        curTime2 = System.currentTimeMillis();

        if (result != null) {
            throw new TestException(
                    "performed take with template " + sampleEntry1 + " and "
                    + timeout1 + " timeout, expected null result but took "
                    + result);
        }

        if ((curTime2 - curTime1) < timeout1
                || (curTime2 - curTime1) >= leaseTime) {
            throw new TestException(
                    "performed take with " + timeout1
                    + " timeout, expected return time is greater then "
                    + timeout1 + " and less then " + leaseTime
                    + ", but has returned in " + (curTime2 - curTime1));
        }
        logDebugText("Take with " + timeout1 + " timeout has returned in "
                + (curTime2 - curTime1));

        // commit the transaction and clean the space
        try {
            txnCommit(txn);
        } catch (Exception ex) {}
        cleanSpace(space);

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

        // create the non null transaction with finite time
        leaseTime = timeout1;
        curTime1 = System.currentTimeMillis();
        txn = getTransaction(leaseTime);

        /*
         * take written entry from the space within the transaction
         * to lock read operations outside the transaction
         */
        space.take(sampleEntry1, txn, timeout);

        /*
         * take an entry from the space with timeout greater then
         * transaction's lease time, check that take request will return
         * non null entry after transaction's expiration
         */
        result = (SimpleEntry) space.take(sampleEntry1, null, timeout2);
        curTime2 = System.currentTimeMillis();

        if (!sampleEntry1.equals(result)) {
            throw new TestException(
                    "performed take with template " + sampleEntry1 + " and "
                    + timeout2 + " timeout, expected " + sampleEntry1
                    + " result but took " + result);
        }

        if ((curTime2 - curTime1) < leaseTime
                || (curTime2 - curTime1) >= timeout2) {
            throw new TestException(
                    "performed take with " + timeout2
                    + " timeout, expected return time is greater then "
                    + leaseTime + " and less then " + timeout2
                    + ", but has returned in " + (curTime2 - curTime1));
        }
        logDebugText("Take with " + timeout2 + " timeout has returned in "
                + (curTime2 - curTime1));

        // clean the space
        cleanSpace(space);

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

        // create the non null transaction with finite time
        leaseTime = timeout2 * 2;
        curTime1 = System.currentTimeMillis();
        txn = getTransaction(leaseTime);

        /*
         * take written entry from the space within the transaction
         * to lock read operations outside the transaction
         */
        space.take(sampleEntry1, txn, leaseForeverTime);

        /*
         * start thread which will write 2-nd sample entry
         * to the space in timeout1 ms
         */
        EntryWriter writer = new EntryWriter(sampleEntry2, timeout1, space);
        writer.start();

        // take any entry from the space
        result = (SimpleEntry) space.take(null, null, timeout2 * 2);
        curTime2 = System.currentTimeMillis();

        // check that take request has returned required entry
        if (!sampleEntry2.equals(result)) {
            throw new TestException(
                    "performed take with null template and "
                    + (timeout2 * 2) + " timeout, expected " + sampleEntry1
                    + " result but read " + result);
        }

        /*
         * check that take request returns 2-nd written entry before
         * transaction's and take's expirations
         */
        if ((curTime2 - curTime1) > leaseTime
                || (curTime2 - curTime1) < timeout1) {
            throw new TestException(
                    "performed take with " + (timeout2 * 2)
                    + " timeout, expected return time is greater then "
                    + leaseTime + " and less then " + timeout1
                    + ", but has returned in " + (curTime2 - curTime1));
        }
View Full Code Here


   * comes back false.
   */
  if (lrs01.equals(lrs02)) {
      String message = "Proxies for two different LR services ";
      message += "match.";
      throw new TestException(message);
  }

  // and test equals reflexive property
  if (lrs02.equals(lrs01)) {
      String message = "The equals method() is not reflexive!";
      throw new TestException(message);
  }

  /* ensure that comparing two proxies from the same LRS service
   * comes back true.
   */

  // service proxies from the same service must be equal
  if (lrs01.equals(lrs03) == false) {
      String message = "Two proxies for the same LR service ";
      message += "do not match.";
      throw new TestException(message);
  }

  // and test the reflexive property
  if (lrs03.equals(lrs01) == false) {
      String message = "The equals method() is not reflexive!";
      throw new TestException(message);
  }

  // test hashCode implementation
  if (lrs01.hashCode() != lrs03.hashCode()) {
      String message = "LRS bad hashCode() implementation!";
      throw new TestException(message);
  }

  // and just to be absolutely certain test identity
  if (lrs01.equals(lrs01) == false) {
      String message = "The equals method() is not enforce ";
      message += "the identity property.";
      throw new TestException(message);
  }
    }
View Full Code Here

        long curTime2;
        long leaseTime;

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

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

        // create the non null transaction with finite time
        leaseTime = timeout2;
        txn = getTransaction(leaseTime);

        /*
         * take written entry from the space within the transaction
         * to lock read operations outside the transaction
         */
        space.take(sampleEntry1, txn, checkTime);

        /*
         * readIfExists an entry from the space with timeout less then
         * transaction's lease time, check that readIfExists request will
         * return null value in time specified in this request
         */
        curTime1 = System.currentTimeMillis();
        result = (SimpleEntry) space.readIfExists(sampleEntry1, null,
                timeout1);
        curTime2 = System.currentTimeMillis();

        if (result != null) {
            throw new TestException(
                    "performed readIfExists of " + sampleEntry1 + " with "
                    + timeout1 + " timeout, expected null result but read "
                    + result);
        }

        if (((curTime2 - curTime1) < timeout1)
                || ((curTime2 - curTime1) >= leaseTime)) {
            throw new TestException(
                    "performed readIfExists with " + timeout1
                    + " timeout, transaction's lease time is " + leaseTime
                    + ", expected return time is greater then " + timeout1
                    + " and less then " + leaseTime
                    + ", but has returned in " + (curTime2 - curTime1));
        }
        logDebugText("readIfExists with " + timeout1 + " timeout and"
                + " transaction with " + leaseTime + " lease time"
                + " works as expected.");

        // commit the transaction and clean the space
        try {
            txnCommit(txn);
        } catch (Exception ex) {}
        cleanSpace(space);

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

        // create the non null transaction with finite time
        curTime1 = System.currentTimeMillis();
        leaseTime = timeout1;
        txn = getTransaction(leaseTime);

        /*
         * take written entry from the space within the transaction
         * to lock read operations outside the transaction
         */
        space.take(sampleEntry1, txn, checkTime);

        /*
         * readIfExists an entry from the space with timeout greater
         * then transaction's lease time, check that readIfExists request
         * will return non null entry after transaction's expiration
         */
        result = (SimpleEntry) space.readIfExists(sampleEntry1, null,
                timeout2);
        curTime2 = System.currentTimeMillis();

        if (result == null) {
            throw new TestException(
                    "performed readIfExists of " + sampleEntry1 + " with "
                    + timeout2 + " timeout, expected non null but read"
                    + " null result.");
        }

        if (((curTime2 - curTime1) < leaseTime)
                || ((curTime2 - curTime1) >= timeout2)) {
            throw new TestException(
                    "performed readIfExists with " + timeout2
                    + " timeout, transaction's lease time is " + leaseTime
                    + ", expected return time is greater then " + leaseTime
                    + " and less then " + timeout2
                    + ", but has returned in " + (curTime2 - curTime1));
        }
        logDebugText("readIfExists with " + timeout2 + " timeout and"
                + " transaction with " + leaseTime + " lease time"
                + " works as expected.");

        // clean the space
        cleanSpace(space);

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

        // create the non null transaction with finite time
        curTime1 = System.currentTimeMillis();
        leaseTime = timeout2 * 2;
        txn = getTransaction(leaseTime);

        /*
         * take written entry from the space within the transaction
         * to lock read operations outside the transaction
         */
        space.take(sampleEntry1, txn, checkTime);

        /*
         * start thread which will write 2-nd sample entry
         * to the space in timeout1 ms
         */
        EntryWriter writer = new EntryWriter(sampleEntry2, timeout1, space);
        writer.start();

        // readIfExists any entry from the space
        result = (SimpleEntry) space.readIfExists(null, null, timeout2);
        curTime2 = System.currentTimeMillis();

        /*
         * check that readIfExists request returns 2-nd written entry
         * before transaction's and readIfExists expirations
         */
        if (result == null) {
            throw new TestException(
                    "performed readIfExists with null template and "
                    + timeout2 + " timeout, expected non null but read"
                    + " null result.");
        }

        if (((curTime2 - curTime1) < timeout1)
                || ((curTime2 - curTime1) >= timeout2)) {
            throw new TestException(
                    "performed readIfExists with " + timeout2
                    + " timeout, transaction's lease time is " + leaseTime
                    + " 2-nd entry has been written to the space in "
                    + timeout1 + " ms,"
                    + " expected return time is greater then " + timeout1
View Full Code Here

            ServiceItem srvcItem = srvcDiscoveryMgr.lookup(template,
                                                           firstStageFilter);

            if(expectedService == null) {
                if(srvcItem != null) {
                    throw new TestException(" -- filter failed -- unexpected "
              +"non-null service item returned "
              +"on lookup of test service "+i);
                } else {
                    logger.log(Level.FINE, "  OK -- both null as expected");
                }
            } else { //expectedService != null
                if(srvcItem == null) {
                    throw new TestException(" -- filter failed -- unexpected "
              +"null service item returned on "
              +"lookup of test service "+i);
                } else if(srvcItem.service == null) {
                    throw new TestException
      (" -- null service component returned "
       +"on lookup of test service "+i);
                } else {
                    if( !(srvcItem.service).equals(expectedService) ) {
                        logger.log(Level.FINE, "  FAILURE -- "
                               +"expectedService.i = "+expectedService.i+", "
                               +"(srvcItem.service).i = "
                               +((TestService)(srvcItem.service)).i);
                        throw new TestException(" -- filter failed -- service "
            +"returned from lookup not "
            +"equivalent to expected test "
            +"service "+i);
                    } else {
                        logger.log(Level.FINE, "  OK -- "
View Full Code Here

        Transaction txn;
        String msg;

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

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

        // write three sample entries into the space
        space.write(sampleEntry1, txn, leaseForeverTime);
        space.write(sampleEntry2, txn, leaseForeverTime);
        space.write(sampleEntry3, txn, leaseForeverTime);

        /*
         * take 1-st entry from the space using the same one
         * as a template within the transaction
         */
        msg = testTemplate(sampleEntry1, txn, Long.MAX_VALUE, 0, 0, false);

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

        // write taken entry back to the space
        space.write(sampleEntry1, txn, leaseForeverTime);

        /*
         * take sample entry from the space
         * using different wrong template entries
         * within the transaction
         */
        template = new SimpleEntry("TestEntry #3", 1);
        msg = testWrongTemplate(template, txn, checkTime, 0, 0, false);

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

        // 2-nd wrong template
        template = new SimpleEntry("TestEntry #1", 3);
        msg = testWrongTemplate(template, txn, timeout1, 0, 0, false);

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

        // 3-rd wrong template
        template = new SimpleEntry("TestEntry #3", 3);
        msg = testWrongTemplate(template, txn, timeout2, 0, 0, false);

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

        // 4-th wrong template
        template = new SimpleEntry(null, 3);
        msg = testWrongTemplate(template, txn, checkTime, 0, 0, false);

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

        // 5-th wrong template
        template = new SimpleEntry("TestEntry #3", null);
        msg = testWrongTemplate(template, txn, timeout2, 0, 0, false);

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

        /*
         * take entry from the space using null as a template
         * within the transaction
         */
        msg = testTemplate(null, txn, checkTime, 0, 0, false);

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

        // clean the space and write 3 entries again
        cleanSpace(space, txn);
        space.write(sampleEntry1, txn, leaseForeverTime);
        space.write(sampleEntry2, txn, leaseForeverTime);
        space.write(sampleEntry3, txn, leaseForeverTime);

        /*
         * take sample entries from the space using templates with
         * null as a wildcard for different fields within the transaction
         */
        template = new SimpleEntry("TestEntry #1", null);
        msg = testTemplate(template, txn, checkTime, 0, 0, false);

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

        // clean the space and write 3 entries again
        cleanSpace(space, txn);
        space.write(sampleEntry1, txn, leaseForeverTime);
        space.write(sampleEntry2, txn, leaseForeverTime);
        space.write(sampleEntry3, txn, leaseForeverTime);

        // try 2-nd template
        template = new SimpleEntry(null, 2);
        msg = testTemplate(template, txn, timeout1, 0, 0, false);

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

        // clean the space and write 3 entries again
        cleanSpace(space, txn);
        space.write(sampleEntry1, txn, leaseForeverTime);
        space.write(sampleEntry2, txn, leaseForeverTime);
        space.write(sampleEntry3, txn, leaseForeverTime);

        // 3-rd template
        template = new SimpleEntry(null, null);
        msg = testTemplate(template, txn, timeout2, 0, 0, false);

        if (msg != null) {
            throw new TestException(msg);
        }
    }
View Full Code Here

        Transaction txn;
        long leaseFor = timeout2;

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

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

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

        // take written entry from the space within the transaction
        SimpleEntry preCondition = (SimpleEntry) space
            .take(sampleEntry, txn, checkTime);

        //check to make sure that an entry was returned
        if (preCondition!=null) {
            // abort the transaction
            txnAbort(txn);

            // check that taken entry is still available in the space
            result = (SimpleEntry) space.read(sampleEntry, null, checkTime);

            if (result == null) {
                throw new TestException(
                        "Take operation within the transaction has removed"
                        + " taken entry from the space after"
                        + " transaction's aborting.");
            }
            logDebugText("abort works as expected.");
        } else {
            throw new TestException( "Take operation within"
                                    + " the transaction has failed to"
                                    + " return a valid entry.");
        }

        // create the non null transaction with finite lease time
        txn = getTransaction(leaseFor);

        // take written entry from the space within the transaction
        space.take(sampleEntry, txn, checkTime);

        // sleep to let the transaction expire
        Thread.sleep(leaseFor + 1000);

        // check that taken entry is still available in the space
        result = (SimpleEntry) space.read(sampleEntry, null, checkTime);

        if (result == null) {
            throw new TestException(
                    "Take operation within the transaction has removed"
                    + " taken entry from the space after"
                    + " transaction's expiration.");
        }
        logDebugText("transaction's expiration works as expected.");

        // create another non null transaction.
        txn = getTransaction();

        // take written entry within the transaction.
        space.take(sampleEntry, txn, checkTime);

        /*
         * create fake TransactionParticipant which
         * will prevent normal commit completion
         */
        TransactionParticipant tp = new ParticipantImpl();
        ((ServerTransaction) txn).join(tp, System.currentTimeMillis());

        // run thread which will prevent normal commit completion
        Committer committer = new Committer(tp, (ServerTransaction) txn,
                mgr);
        committer.start();

        // try to commit the operation
        try {
            txnCommit(txn);
            throw new TestException(
                    "Commit completes with no exceptions.");
        } catch (Exception ex) {
            logDebugText("commit produces"
                    + " the following exception, as expected: " + ex);
        }

        result = (SimpleEntry) space.read(sampleEntry, null, checkTime);
        if (result == null) {
            throw new TestException(
                    "Take operation within the transaction has removed"
                    + " taken entry from the space after"
                    + " unsuccessfull transaction's committing.");
        }
    }
View Full Code Here

  logger.log(Level.FINE, "Lease is " + setLease);
  try {
      set01.renewFor(setLease, renewGrant);
      String message = "An attempt to add a renewal set's lease\n";
      message += " to itself has succeeded.";
      throw new TestException(message);
  } catch (IllegalArgumentException ex) {
      // success, keep on trucking ...
  }     

  /* assert that attempting to add the set01's lease to set02
     generates an IllegalArgumentException */
  try {
      set02.renewFor(setLease, renewGrant);
      String message = "An attempt to add a renewal set's lease\n";
      message += " to another set has succeeded.";
      throw new TestException(message);
  } catch (IllegalArgumentException ex) {
      // success, keep on trucking ...
  }     

  // create a lease that renews normally
  logger.log(Level.FINE, "Creating the lease to be managed.");
  logger.log(Level.FINE, "Duration == " + renewGrant);
  TestLease testLease =
      leaseProvider.createNewLease(leaseOwner,
           rstUtil.durToExp(renewGrant));

  // add the lease to set01
  set01.renewFor(testLease, renewGrant);

  /* assert that attempting to add the test lease to set02
     succeeds. */
  try {
      set02.renewFor(testLease, renewGrant);
      // success
  } catch (IllegalArgumentException ex) {
      String message = "An attempt to add a client lease\n";
      message += " to two different sets has failed.";
      throw new TestException(message, ex);
  }     

  /*
   * Assert that adding set01's lease to set02 succeeds if set01's
   * lease has been cancelled.
   */
  setLease.cancel();
  try {
      set02.renewFor(setLease, renewGrant);
  } catch (IllegalArgumentException ex) {
    throw new TestException("Failed to add an expired set "
          + "lease to another set",
          ex);
  }
    }
View Full Code Here

        Transaction txn;
        String msg;

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

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

        // write three sample entries into the space
        space.write(sampleEntry1, txn, leaseForeverTime);
        space.write(sampleEntry2, txn, leaseForeverTime);
        space.write(sampleEntry3, txn, leaseForeverTime);

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

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

        // write taken entry back to the space
        space.write(sampleEntry1, txn, leaseForeverTime);

        /*
         * take sample entry from the space using
         * 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, 0,
                false);

        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, 0,
                false);

        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, 0,
                false);

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

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

        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, 0,
                false);

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

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

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

        // clean the space and write 3 entries again
        cleanSpace(space, txn);
        space.write(sampleEntry1, txn, leaseForeverTime);
        space.write(sampleEntry2, txn, leaseForeverTime);
        space.write(sampleEntry3, txn, leaseForeverTime);

        /*
         * take sample entries from the space using 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, 0, false);

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

        // clean the space and write 3 entries again
        cleanSpace(space, txn);
        space.write(sampleEntry1, txn, leaseForeverTime);
        space.write(sampleEntry2, txn, leaseForeverTime);
        space.write(sampleEntry3, txn, leaseForeverTime);

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

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

        // clean the space and write 3 entries again
        cleanSpace(space, txn);
        space.write(sampleEntry1, txn, leaseForeverTime);
        space.write(sampleEntry2, txn, leaseForeverTime);
        space.write(sampleEntry3, txn, leaseForeverTime);

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

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

        // commit the transaction
        txnCommit(txn);
    }
View Full Code Here

  logger.log(Level.FINE, ""
       +":   srvcItems.length = "+srvcItems.length);
  if(nExpectedSrvcs < minMatches) {//block full amount
      /* Blocking time should be within epsilon of full amount */
      if(waitError<-3) {
    throw new TestException(" -- failed to block requested "
          +"time -- requested block = "
          +waitDurSecs+" second(s), actual "
          +"block = "+(actualBlockTime/1000)
          +" second(s)");
      } else if(waitError>30) {
    throw new TestException(" -- exceeded requested block "
          +"time -- requested block = "
          +waitDurSecs+" second(s), actual "
          +"block = "+(actualBlockTime/1000)
          +" second(s)");
      }//endif
  } else { //(nExpectedSrvcs>=minMatches)
      /* Blocking time should be less than the full amount */
      if(waitError >= 0) {
    throw new TestException(" -- blocked longer than expected "
          +"-- requested block = "
          +waitDurSecs+" second(s), actual "
          +"block = "+(actualBlockTime/1000)
          +" second(s)");
      }
View Full Code Here

            long          waitDur,
            long          actualBlockTime)
  throws Exception
    {
        if(srvcItems == null) {
            throw new TestException(" -- unexpected null service item array "
                              +"returned");
        } else if(srvcItems.length != nExpectedSrvcs) {
            logger.log(Level.FINE, ""+": lookup failed -- "
                              +"returned unexpected number of "
                              +"service items (expected = "
                              +nExpectedSrvcs+", but "
                              +"returned = "+srvcItems.length+")");
            throw new TestException(" -- lookup returned unexpected "
                              +"number of service items "
                              +"(expected = "
                              +nExpectedSrvcs+", but "
                              +"returned = "+srvcItems.length+")");
        } else {/* Compare returned array to expected services set */
      label_i:
            for(int i=0;i<srvcItems.length;i++) {
                logger.log(Level.FINE, ""+": comparing sevice item "+i);
                if( srvcItems[i] == null ) {
                    throw new TestException(" -- returned service item "+i
                                      +" is null");
                } else if(srvcItems[i].service == null) {
                    throw new TestException(" -- service component of "
                                      +"returned service item "+i
                                      +" is null");
                } else {
                    for(int j=0;j<expectedSrvcs.size();j++) {
                        if( (srvcItems[i].service).equals
                                                     (expectedSrvcs.get(j)) )
                        {
                            continue label_i; // next srvcItems[i]
                        }//endif
                    }//end loop (j)
                    throw new TestException(" -- returned service item "+i
                                      +" is not contained in the "
                                      +" expected set of services");
                }//endif
            }//end loop (i)
            logger.log(Level.FINE, ""+": all expected "
View Full Code Here

TOP

Related Classes of com.sun.jini.qa.harness.TestException

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.