Package com.sun.jini.qa.harness

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


    private void doLookupNoMatch() throws TestException, RemoteException {
        Object serviceObj = null;
        ServiceMatches matches = null;
        for (int i=0; i<srvcIDTmpls.length; i++) {
      if(proxy.lookup(srvcIDTmpls[i]) != null) {
    throw new TestException("srvcIDTmpls["+i+"] != null");
      }
      matches = proxy.lookup(srvcIDTmpls[i],Integer.MAX_VALUE);
            if ( matches.totalMatches != 0) {
                throw new TestException("totalMatches != 0");
      }
  }
    }
View Full Code Here


    {
        long dur = baseT0 + deltaT - System.currentTimeMillis();
  if(dur > 0) {
      Thread.sleep(dur);
  } else {
            throw new TestException("Environment problem; this configuration"
                                    + " does not allow for the timing"
                                    + " assumptions made by the test");
                                   
  }
    }
View Full Code Here

                                         ServiceRegistration[] serviceRegs)
                                                         throws Exception
    {
        ServiceEvent evnt = null;
        if (eventVector.size() != nExpectedEvnts) {
            throw new TestException("# of Events Received ("+
                                             eventVector.size()+
                                             ") != # of Events Expected ("+
                                             nExpectedEvnts+")");
  } else {
            ServiceID evntSrvcID;
            ServiceID expdSrvcID;
            ServiceID handbackSrvcID;
      for(int i=0; i<eventVector.size(); i++) {
                evnt = (ServiceEvent)eventVector.elementAt(i);
                if (evnt == null) {
                    throw new TestException
                             ("null Event returned from Vector at element "+i);
       } else {
                    if (evnt.getTransition() != expectedTransition) {
      dumpEventIDs(eventVector, serviceRegs);
                        throw new TestException("Unexpected Transition returned ("+
            evnt.getTransition()+")");
        } else {
                        evntSrvcID = evnt.getServiceID();
                        expdSrvcID = serviceRegs[i].getServiceID();
                        if ( !(evntSrvcID.equals(expdSrvcID)) ) {
                            throw new TestException("Service ID Received ("+
                evntSrvcID+
                ") != Service ID Expected ("+
                expdSrvcID+")");
      } else {
          handbackSrvcID =
        (ServiceID)(evnt.getRegistrationObject().get());

          if ( !(handbackSrvcID.equals(expdSrvcID)) ) {
        throw new TestException
            ("Handback Service ID ("+
             handbackSrvcID+
             ") != Service ID Expected ("+
             expdSrvcID+")");
          }
View Full Code Here

                  proxy);
      ServiceMatches matches;
      matches = proxy.lookup(tmpl, 1);
      if (item == null) {
    if (matches.items.length != 0)
        throw new TestException(
            "verifyEventItems: event item is null, lookup returns non-null");
      } else {
    if (matches.items.length == 0)
        throw new TestException(
            "verifyEventItems: event item is non-null, lookup returns null");
    ServiceItem litem = matches.items[0];
    if (!item.service.equals(litem.service))
        throw new TestException(
            "verifyEventItems: event item service does not equal lookup value");
    if (!attrsEqual(item.attributeSets, litem.attributeSets))
         throw new TestException(
            "verifyEventItems: event item attrs do not equal lookup value");
      }
  }
    }
View Full Code Here

        Object serviceObj = null;
        ServiceMatches matches = null;
        for (int i=0; i<templates.length; i++) {
      serviceObj = proxy.lookup(templates[i]);
            if (!srvcItems[i].service.equals(serviceObj)) {
                throw new TestException("srvcItems["+i+
          "] != serviceObj returned by lookup()");
      }

      matches = proxy.lookup(templates[i],Integer.MAX_VALUE);
            if (matches.totalMatches != 1) {
                throw new TestException
        ("totalMatches != EXPECTED_N_MATCHES");
      } else {
                if (!srvcItems[i].service.equals(matches.items[0].service)) {
                    throw new TestException("srvcItems["+i+
              "] != items[0].service returned by lookup()");
    }
      }
  }
    }
View Full Code Here

    public static void verifyLeases(Lease[] leases,
                                    long minExpirationthrows Exception
    {
  for(int i=0; i<leases.length; i++) {
      if(leases[i].getExpiration() < minExpiration) {
                throw new TestException("verifyLeases: expiration of lease ["
          +i+"] ("+leases[i].getExpiration()+
          " ms) < expected min expiration ("
          +minExpiration+" ms)");
      } else {
    minExpiration = leases[i].getExpiration();
View Full Code Here

      }
            if (receivedTuples.size() != expectedTuples.size()) {
          if (nMsWaited < maxWaitTime) {
                    nMsWaited = nMsWaited + waitDeltaT;
    } else {
                    throw new TestException
                     ("# of Events Received ("+receivedTuples.size()+
                      ") != # of Events Expected ("+expectedTuples.size()+")");
    }
      } else {
                break;
View Full Code Here

      } catch (InterruptedException e) { }
            if (receivedTuples.size() != expectedTuples.size()) {
          if (nMsWaited < maxWaitTime) {
                    nMsWaited = nMsWaited + waitDeltaT;
    } else {
                    throw new TestException
                     ("# of Events Received ("+receivedTuples.size()+
                      ") != # of Events Expected ("+expectedTuples.size()+")");
    }
      } else {
                break;
View Full Code Here

                if((receivedTuples.get(i)).equals(expectedTuples.get(j))) {
                    expectedTuples.removeElementAt(j);
                    continue iLoop;
    }
      }
            throw new TestException
                   ("Received an UNEXPECTED Event\nSrvc  = "
                    +(((SrvcAttrTuple)receivedTuples.get(i)).getSrvcObj())+
                    ",\nAttr  = "
                    +(((SrvcAttrTuple)receivedTuples.get(i)).getAttrObj())+
                    ",\nTrans = "
View Full Code Here

     */
    public void run() throws Exception {
  ServiceMatches matches = null;
  matches = proxy.lookup(tmpl,0);
  if (matches.totalMatches != expectedNMatches) {
      throw new TestException
                ("totalMatches ("+matches.totalMatches+
                 ") != expectedNMatches ("+expectedNMatches+")");
  }
    }
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.