Examples of JoinAdmin


Examples of net.jini.admin.JoinAdmin

        logger.log(Level.FINE, "run()");
        if(discoverySrvc == null) {
            throw new TestException("could not successfully start service "
          + serviceName);
        }
  JoinAdmin joinAdmin = JoinAdminUtil.getJoinAdmin(discoverySrvc);
  LookupLocator[] curLocators = joinAdmin.getLookupLocators();
  LocatorsUtil.displayLocatorSet(curLocators,"curLocators",
               Level.FINE);
  if (!LocatorsUtil.compareLocatorSets(expectedLocators,
               curLocators,
               Level.FINE))
View Full Code Here

Examples of net.jini.admin.JoinAdmin

        logger.log(Level.FINE, "run()");
        if(discoverySrvc == null) {
            throw new TestException("could not successfully start service "
          + serviceName);
        }
  JoinAdmin joinAdmin = JoinAdminUtil.getJoinAdmin(discoverySrvc);
  String[] curGroups = joinAdmin.getLookupGroups();
  GroupsUtil.displayGroupSet(curGroups, "curGroups", Level.FINE);
  if (!GroupsUtil.compareGroupSets(expectedGroups,curGroups,Level.FINE)) {
      throw new TestException("Group sets are not equivalent");
  }
    }
View Full Code Here

Examples of net.jini.admin.JoinAdmin

        logger.log(Level.FINE, "run()");
        if(discoverySrvc == null) {
            throw new TestException("could not successfully start service "
          + serviceName);
        }
  JoinAdmin joinAdmin = JoinAdminUtil.getJoinAdmin(discoverySrvc);
  String[] oldGroups = joinAdmin.getLookupGroups();
  GroupsUtil.displayGroupSet(oldGroups, "oldGroups", Level.FINE);
  GroupsUtil.displayGroupSet(newGroupSet, "setGroups", Level.FINE);
  joinAdmin.setLookupGroups(newGroupSet);
  String[] newGroups = joinAdmin.getLookupGroups();
  GroupsUtil.displayGroupSet(newGroups, "newGroups", Level.FINE);
  if (!GroupsUtil.compareGroupSets(expectedGroups,newGroups,Level.FINE)) {
      throw new TestException("Group sets are not equivalent");
  }
    }
View Full Code Here

Examples of net.jini.admin.JoinAdmin

  // before it gets destroyed at the end of this test.

  //waitOnInput(); // wait

  logger.log(Level.INFO, "\tCalling JoinAdmin methods");
  JoinAdmin ja = (JoinAdmin)admin;
  Entry[] attrs = ja.getLookupAttributes();
  logger.log(Level.INFO, "Calling JoinAdmin::getLookupAttributes: got " +
      attrs.length + " items");
  String name = "Spanguini";
  Entry[] newAttrs = { new Name(name) };
  logger.log(Level.INFO, "Calling JoinAdmin::addLookupAttributes()");
  ja.addLookupAttributes(newAttrs);
  logger.log(Level.INFO, "Checking addLookupAttributes call via get call");
  attrs = ja.getLookupAttributes();
  if (!assertContainsName(attrs, name)) {
      throw new TestException(
    "Did not receive proper attribute setting for Name " +
    "after adding");
  }
  name = name + "2";
  Entry[] templates = { new Name() };
  newAttrs[0] = new Name(name);
  logger.log(Level.INFO, "Calling JoinAdmin::modifyLookupAttributes()");
  ja.modifyLookupAttributes(templates, newAttrs);
  attrs = ja.getLookupAttributes();
  if (!assertContainsName(attrs, name)) {
      throw new TestException("Did not receive proper attribute setting for Name after modifying");
  }
  // double check assert mechanism
  if (assertContainsName(attrs, name + "2")) {
      throw new TestException("assertContainsName returned true for a bogus value");
  }
  //
  // LookupGroups
  //
  String[] luGroups = null;
  /*
   * TestBase utilities automatically create and join the service(s)
   * under test to at one (unique) group. So, this section of of code
   * is no longer valid.
  luGroups = ja.getLookupGroups();
  logger.log(Level.INFO, "Calling JoinAdmin::getLookupGroups got " +
      luGroups.length + " items");
  dumpGroups(luGroups);
  if (!assertLookupGroups(luGroups, LookupDiscovery.NO_GROUPS))
      throw new TestException(
    "getLookupGroups did not return NO_GROUPS upon startup");
   */

  String[] groups = { "group1", "group2", "group3" };
  logger.log(Level.INFO, "Calling JoinAdmin::addLookupGroups()");
  dumpGroups(groups);
  ja.addLookupGroups(groups);
  logger.log(Level.INFO, "Verifying group set: ");
  luGroups = ja.getLookupGroups();
  dumpGroups(luGroups);
  if (luGroups.length < groups.length)
      throw new TestException(
    "Invalid length for returned group set after add");
  if (!assertLookupGroups(luGroups, groups))
      throw new TestException(
    "getLookupGroups did not contain added group set");

  logger.log(Level.INFO, "Calling JoinAdmin::removeLookupGroups()");
  dumpGroups(groups);
  ja.removeLookupGroups(groups);
  logger.log(Level.INFO, "Verifying returned groups: ");
  luGroups = ja.getLookupGroups();
  dumpGroups(luGroups);
  if (assertLookupGroups(luGroups, groups))
      throw new TestException("getLookupGroups contained removed group ");

  logger.log(Level.INFO, "Calling JoinAdmin::setLookupGroups()");
  dumpGroups(groups);
  ja.setLookupGroups(groups);
  logger.log(Level.INFO, "Verifying group set: ");
  luGroups = ja.getLookupGroups();
  dumpGroups(luGroups);
  if (groups.length != luGroups.length)
      throw new TestException("Invalid length for returned group set after set");
  if (!assertLookupGroups(luGroups, groups))
      throw new TestException("getLookupGroups did not contain required group set");
  // double check assert mechanism
  String[] bogus = { groups[0], "bogusGroup", groups[1] };
  if (assertLookupGroups(luGroups, bogus))
      throw new TestException("assertLookupGroups returned true for bogus data");
  /*
   * The following test causes cross-talk between concurrently
   * running test suite -- resulting in spurrious failures.
   * Setting grops=ALL causes the service to register with
   * other LUS w/i multicast radius. Other tests can potentially
   * get references to the service, which goes away shortly
   * thereafter.
  logger.log(Level.INFO, "Calling JoinAdmin::setLookupGroups(ALL_GROUPS) ");
  ja.setLookupGroups(LookupDiscovery.ALL_GROUPS);
  logger.log(Level.INFO, "Verifying group set: ");
  luGroups = ja.getLookupGroups();
  dumpGroups(luGroups);
  if (!assertLookupGroups(luGroups, LookupDiscovery.ALL_GROUPS))
      throw new TestException("getLookupGroups did not contain ALL_GROUPS after set");
   */

  //
  // Locators
  //
  logger.log(Level.INFO, "Calling JoinAdmin::getLookupLocators ");
  if (!assertLocators(ja.getLookupLocators(), new LookupLocator[0]))
      throw new TestException("Did not receive empty set of locators upon startup");
  logger.log(Level.INFO, "Calling JoinAdmin::addLookupLocators()");
  LookupLocator[] locators = {
      QAConfig.getConstrainedLocator("jini://resendes:8080/"),
      QAConfig.getConstrainedLocator("jini://resendes:8081/"),
  };
  ja.addLookupLocators(locators);
  logger.log(Level.INFO, "Verifying JoinAdmin::addLookupLocators()");
  if (!assertLocators(ja.getLookupLocators(), locators))
      throw new TestException("Did not receive expected set of locators after add");
  logger.log(Level.INFO, "Calling JoinAdmin::removeLookupLocators()");
  ja.removeLookupLocators(locators);
  if (!assertLocators(ja.getLookupLocators(), new LookupLocator[0]))
      throw new TestException("Did not receive empty set of locators after remove");
  logger.log(Level.INFO, "Calling JoinAdmin::setLookupLocators()");
  ja.setLookupLocators(locators);
  if (!assertLocators(ja.getLookupLocators(), locators))
      throw new TestException("Did not receive expected set of locators after set");
  // double check assert mechanism
  LookupLocator[] bogusLoc = {
      locators[1],
      QAConfig.getConstrainedLocator("jini://bogus:8080/"),
      locators[0],
  };
  if (assertLocators(ja.getLookupLocators(), bogusLoc))
      throw new TestException("assertLocators returned true for bogus values");


  /////////////////////////
  // DestroyAdmin Methods
View Full Code Here

Examples of net.jini.admin.JoinAdmin

  // before it gets destroyed at the end of this test.

  //waitOnInput(); // wait

  logger.log(Level.INFO, "\tCalling JoinAdmin methods");
  JoinAdmin ja = (JoinAdmin)admin;
  Entry[] attrs = ja.getLookupAttributes();
  logger.log(Level.INFO, "Calling JoinAdmin::getLookupAttributes: got " +
      attrs.length + "items");
  String name = "Spanguini";
  Entry[] newAttrs = { new Name(name) };
  logger.log(Level.INFO, "Calling JoinAdmin::addLookupAttributes()");
  ja.addLookupAttributes(newAttrs);
  logger.log(Level.INFO, "Checking addLookupAttributes call via get call");
  attrs = ja.getLookupAttributes();
  if (!assertContainsName(attrs, name)) {
      throw new TestException("Did not receive proper attribute setting for Name " +
         "after adding");
  }

  shutdown(0);

  logger.log(Level.INFO, "Checking addLookupAttributes call after shutdown");
  attrs = ja.getLookupAttributes();
  if (!assertContainsName(attrs, name)) {
      throw new TestException("Did not receive proper attribute setting for Name " +
         "after shutdown");
  }

  name = name + "2";
  Entry[] templates = { new Name() };
  newAttrs[0] = new Name(name);
  logger.log(Level.INFO, "Calling JoinAdmin::modifyLookupAttributes()");
  ja.modifyLookupAttributes(templates, newAttrs);
  logger.log(Level.INFO, "Checking modifyLookupAttributes call via "
        + "getLookupAttributes");
  attrs = ja.getLookupAttributes();
  if (!assertContainsName(attrs, name)) {
      throw new TestException("Did not receive proper attribute setting for Name after "
         + "modifying");
  }

  shutdown(0);

  logger.log(Level.INFO, "Checking modifyLookupAttributes call via "
        + "getLookupAttributes after shutdown");
  attrs = ja.getLookupAttributes();
  if (!assertContainsName(attrs, name)) {
      throw new TestException("Did not receive proper attribute setting for Name after "
         + "shutdown");
  }

  // double check assert mechanism
  if (assertContainsName(attrs, name + "2")) {
      throw new TestException("assertContainsName returned true for a bogus value");
  }

  //
  // LookupGroups
  //
  String[] luGroups = null;
  /*
   * TestBase utilities automatically create and join the service(s)
   * under test to one (unique) group. So, this section of of code
   * is no longer valid.
  luGroups = ja.getLookupGroups();
  logger.log(Level.INFO, "Calling JoinAdmin::getLookupGroups got " +
        luGroups.length + " items");
  dumpGroups(luGroups);
  if (!assertLookupGroups(luGroups, LookupDiscovery.NO_GROUPS))
      throw new TestException("getLookupGroups did not return NO_GROUPS upon startup");
   */

  String[] groups = { "group1", "group2", "group3" };
  logger.log(Level.INFO, "Calling JoinAdmin::addLookupGroups()");
  dumpGroups(groups);
  ja.addLookupGroups(groups);
  logger.log(Level.INFO, "Verifying group set: ");
  luGroups = ja.getLookupGroups();
  dumpGroups(luGroups);
  if (luGroups.length < groups.length)
      throw new TestException("Invalid length for returned group set after add");
  if (!assertLookupGroups(luGroups, groups))
      throw new TestException("getLookupGroups did not contain added group set");

  shutdown(0);

  luGroups = ja.getLookupGroups();
  dumpGroups(luGroups);
  if (luGroups.length < groups.length)
      throw new TestException("Invalid length for returned group set after shutdown");
  if (!assertLookupGroups(luGroups, groups))
      throw new TestException("getLookupGroups did not contain added group after shutdown");

  logger.log(Level.INFO, "Calling JoinAdmin::removeLookupGroups()");
  dumpGroups(groups);
  ja.removeLookupGroups(groups);
  logger.log(Level.INFO, "Verifying returned groups: ");
  luGroups = ja.getLookupGroups();
  dumpGroups(luGroups);
  if (assertLookupGroups(luGroups, groups))
      throw new TestException("getLookupGroups contained removed group ");

  shutdown(0);

  String[] recoveredluGroups = ja.getLookupGroups();
  dumpGroups(recoveredluGroups);
  if (!assertLookupGroups(recoveredluGroups, luGroups))
      throw new TestException("group set didn't match after shutdown");

  logger.log(Level.INFO, "Calling JoinAdmin::setLookupGroups()");
  dumpGroups(groups);
  ja.setLookupGroups(groups);
  logger.log(Level.INFO, "Verifying group set: ");
  luGroups = ja.getLookupGroups();
  dumpGroups(luGroups);
  if (groups.length != luGroups.length)
      throw new TestException("Invalid length for returned group set after set");
  if (!assertLookupGroups(luGroups, groups))
      throw new TestException("getLookupGroups did not contain required group set");
  // double check assert mechanism
  String[] bogus = { groups[0], "bogusGroup", groups[1] };
  if (assertLookupGroups(luGroups, bogus))
      throw new TestException("assertLookupGroups returned true for bogus data");

  shutdown(0);

  recoveredluGroups = ja.getLookupGroups();
  dumpGroups(recoveredluGroups);
  if (!assertLookupGroups(recoveredluGroups, groups))
      throw new TestException("group set didn't match after shutdown");


  /*
   * The following test causes cross-talk between concurrently
   * running test suite -- resulting in spurrious failures.
   * Setting grops=ALL causes the service to register with
   * other LUS w/i multicast radius. Other tests can potentially
   * get references to the service, which goes away shortly
   * thereafter.
  logger.log(Level.INFO, "Calling JoinAdmin::setLookupGroups(ALL_GROUPS) ");
  ja.setLookupGroups(LookupDiscovery.ALL_GROUPS);
  logger.log(Level.INFO, "Verifying group set: ");
  luGroups = ja.getLookupGroups();
  dumpGroups(luGroups);
  if (!assertLookupGroups(luGroups, LookupDiscovery.ALL_GROUPS))
      throw new TestException("getLookupGroups did not contain ALL_GROUPS after set");

  shutdown(0);

  recoveredluGroups = ja.getLookupGroups();
  dumpGroups(recoveredluGroups);
  if (!assertLookupGroups(recoveredluGroups, LookupDiscovery.ALL_GROUPS))
      throw new TestException("getLookupGroups did not contain ALL_GROUPS after shutdown");
   */

  //
  // Locators
  //
  logger.log(Level.INFO, "Calling JoinAdmin::getLookupLocators ");
  if (!assertLocators(ja.getLookupLocators(), new LookupLocator[0]))
      throw new TestException("Did not receive empty set of locators upon startup");
  logger.log(Level.INFO, "Calling JoinAdmin::addLookupLocators()");
  LookupLocator[] locators = {
      QAConfig.getConstrainedLocator("jini://resendes:8080/"),
      QAConfig.getConstrainedLocator("jini://resendes:8081/"),
      };
  ja.addLookupLocators(locators);
  logger.log(Level.INFO, "Verifying JoinAdmin::addLookupLocators()");
  if (!assertLocators(ja.getLookupLocators(), locators))
      throw new TestException("Did not receive expected set of locators after add");

  shutdown(0);

  if (!assertLocators(ja.getLookupLocators(), locators))
      throw new TestException("Did not receive expected set of locators after shutdown");

  logger.log(Level.INFO, "Calling JoinAdmin::removeLookupLocators()");
  ja.removeLookupLocators(locators);
  if (!assertLocators(ja.getLookupLocators(), new LookupLocator[0]))
      throw new TestException("Did not receive empty set of locators after remove");

  shutdown(0);

  if (!assertLocators(ja.getLookupLocators(), new LookupLocator[0]))
      throw new TestException("Did not receive empty set of locators after shutdown");

  logger.log(Level.INFO, "Calling JoinAdmin::setLookupLocators()");
  ja.setLookupLocators(locators);
  if (!assertLocators(ja.getLookupLocators(), locators))
      throw new TestException("Did not receive expected set of locators after set");
  // double check assert mechanism
  LookupLocator[] bogusLoc = {
      locators[1],
      QAConfig.getConstrainedLocator("jini://bogus:8080/"),
      locators[0],
      };
  if (assertLocators(ja.getLookupLocators(), bogusLoc))
      throw new TestException("assertLocators returned true for bogus values");

  shutdown(0);

  if (!assertLocators(ja.getLookupLocators(), locators))
      throw new TestException("Did not receive expected set of locators after shutdown");


  /////////////////////////
  // DestroyAdmin Methods
View Full Code Here

Examples of net.jini.admin.JoinAdmin

     *  condition because at this point the test has completed.
     */
    public void tearDown() {
  if (!noCleanup) {
      try {
    JoinAdmin joinAdmin = (JoinAdmin)admin;

    // In case something from the orginal state got removed
    int nonCtrlCount = 0;
    for (int i=0; i<originalState.length; i++)
        if (!(originalState[i] instanceof ServiceControlled))
      nonCtrlCount++;

    Entry[] subState = new Entry[nonCtrlCount];
    int s = 0; // Index into substate
    for (int i=0; i<originalState.length; i++)
        if (!(originalState[i] instanceof ServiceControlled))
      subState[s++] = originalState[i];
    // Add is idempotent, so even if was still there
    // adding it again won't hurt
    joinAdmin.addLookupAttributes(subState);


    Entry[] curAttrs = joinAdmin.getLookupAttributes();
    int numToRemove = curAttrs.length - originalState.length;

    if (numToRemove > 0) {
        Entry[] templates = new Entry[numToRemove];
        // These are all null
        Entry[] newAttrs = new Entry[numToRemove];

        int t = 0; // index into templates
        // For each attribute in curAttrs, but not in
        // originalState stick it into template
        for (int i=0; i<curAttrs.length; i++) {
      boolean match = false;
      for (int j=0; j<originalState.length; j++) {
          if (curAttrs[i].equals(originalState[j])) {
        match = true;
        break;
          }
      }

      if (!match)
          // Must not have been in original state
          templates[t++] = curAttrs[i];
        }
        joinAdmin.modifyLookupAttributes(templates, newAttrs);
    }
      } catch (Throwable t) {
    try {
        cleanupFailure("Could not restore inital state", t);
    } catch (Exception ex) {
View Full Code Here

Examples of net.jini.admin.JoinAdmin

  // before it gets destroyed at the end of this test.

  //waitOnInput(); // wait

  logger.log(Level.INFO, "\tCalling JoinAdmin methods");
  JoinAdmin ja = (JoinAdmin)admin;
  Entry[] attrs = ja.getLookupAttributes();
  logger.log(Level.INFO, "Calling JoinAdmin::getLookupAttributes: got " +
      attrs.length + "items");
  String name = "Spanguini";
  Entry[] newAttrs = { new Name(name) };
  logger.log(Level.INFO, "Calling JoinAdmin::addLookupAttributes()");
  ja.addLookupAttributes(newAttrs);
  logger.log(Level.INFO,
       "Checking addLookupAttributes call via get call");
  attrs = ja.getLookupAttributes();
  if (!assertContainsName(attrs, name)) {
      throw new TestException( "Did not receive proper attribute "
           + "setting for Name after adding");
  }

  shutdown(0);

  logger.log(Level.INFO,
       "Checking addLookupAttributes call after shutdown");
  attrs = ja.getLookupAttributes();
  if (!assertContainsName(attrs, name)) {
      throw new TestException( "Did not receive proper attribute "
           + "setting for Name after shutdown");
  }

  name = name + "2";
  Entry[] templates = { new Name() };
  newAttrs[0] = new Name(name);
  logger.log(Level.INFO, "Calling JoinAdmin::modifyLookupAttributes()");
  ja.modifyLookupAttributes(templates, newAttrs);
  logger.log(Level.INFO, "Checking modifyLookupAttributes call via "
                 + "getLookupAttributes");
  attrs = ja.getLookupAttributes();
  if (!assertContainsName(attrs, name)) {
      throw new TestException("Did not receive proper attribute "
          + "setting for Name after modifying");
  }

  shutdown(0);

  logger.log(Level.INFO, "Checking modifyLookupAttributes call via "
                 + "getLookupAttributes after shutdown");
  attrs = ja.getLookupAttributes();
  if (!assertContainsName(attrs, name)) {
      throw new TestException("Did not receive proper attribute "
          + "setting for Name after shutdown");
  }

  // double check assert mechanism
  if (assertContainsName(attrs, name + "2")) {
      throw new TestException( "assertContainsName returned true "
           + "for a bogus value");
  }

  //
  // LookupGroups
  //
  String[] luGroups = null;
  /*
   * TestBase utilities automatically create and join the service(s)
   * under test to one (unique) group. So, this section of of code
   * is no longer valid.
  luGroups = ja.getLookupGroups();
  logger.log(Level.INFO, "Calling JoinAdmin::getLookupGroups got " +
        luGroups.length + " items");
  dumpGroups(luGroups);
  if (!assertLookupGroups(luGroups, LookupDiscovery.NO_GROUPS))
      throw new TestException( "getLookupGroups did not return NO_GROUPS upon startup");
   */

  String[] groups = { "group1", "group2", "group3" };
  logger.log(Level.INFO, "Calling JoinAdmin::addLookupGroups()");
  dumpGroups(groups);
  ja.addLookupGroups(groups);
  logger.log(Level.INFO, "Verifying group set: ");
  luGroups = ja.getLookupGroups();
  dumpGroups(luGroups);
  if (luGroups.length < groups.length)
      throw new TestException( "Invalid length for returned group "
           + "set after add");
  if (!assertLookupGroups(luGroups, groups))
      throw new TestException( "getLookupGroups did not contain "
           + "added group set");

  shutdown(0);

  luGroups = ja.getLookupGroups();
  dumpGroups(luGroups);
  if (luGroups.length < groups.length)
      throw new TestException( "Invalid length for returned group "
           + "set after shutdown");
  if (!assertLookupGroups(luGroups, groups))
      throw new TestException( "getLookupGroups did not contain "
           + "added group after shutdown");

  logger.log(Level.INFO, "Calling JoinAdmin::removeLookupGroups()");
  dumpGroups(groups);
  ja.removeLookupGroups(groups);
  logger.log(Level.INFO, "Verifying returned groups: ");
  luGroups = ja.getLookupGroups();
  dumpGroups(luGroups);
  if (assertLookupGroups(luGroups, groups))
      throw new TestException("getLookupGroups contained removed group ");

  shutdown(0);

  String[] recoveredluGroups = ja.getLookupGroups();
  dumpGroups(recoveredluGroups);
  if (!assertLookupGroups(recoveredluGroups, luGroups))
      throw new TestException( "group set didn't match after shutdown");

  logger.log(Level.INFO, "Calling JoinAdmin::setLookupGroups()");
  dumpGroups(groups);
  ja.setLookupGroups(groups);
  logger.log(Level.INFO, "Verifying group set: ");
  luGroups = ja.getLookupGroups();
  dumpGroups(luGroups);
  if (groups.length != luGroups.length)
      throw new TestException( "Invalid length for returned group "
           + "set after set");
  if (!assertLookupGroups(luGroups, groups))
      throw new TestException( "getLookupGroups did not contain "
           + "required group set");
  // double check assert mechanism
  String[] bogus = { groups[0], "bogusGroup", groups[1] };
  if (assertLookupGroups(luGroups, bogus))
      throw new TestException( "assertLookupGroups returned true "
           + "for bogus data");

  shutdown(0);

  recoveredluGroups = ja.getLookupGroups();
  dumpGroups(recoveredluGroups);
  if (!assertLookupGroups(recoveredluGroups, groups))
      throw new TestException( "group set didn't match after shutdown");


  /*
   * The following test causes cross-talk between concurrently
   * running test suite -- resulting in spurrious failures.
   * Setting grops=ALL causes the service to register with
   * other LUS w/i multicast radius. Other tests can potentially
   * get references to the service, which goes away shortly
   * thereafter.
  logger.log(Level.INFO, "Calling JoinAdmin::setLookupGroups(ALL_GROUPS) ");
  ja.setLookupGroups(LookupDiscovery.ALL_GROUPS);
  logger.log(Level.INFO, "Verifying group set: ");
  luGroups = ja.getLookupGroups();
  dumpGroups(luGroups);
  if (!assertLookupGroups(luGroups, LookupDiscovery.ALL_GROUPS))
      throw new TestException( "getLookupGroups did not contain ALL_GROUPS after set");

  shutdown(0);

  recoveredluGroups = ja.getLookupGroups();
  dumpGroups(recoveredluGroups);
  if (!assertLookupGroups(recoveredluGroups, LookupDiscovery.ALL_GROUPS))
      throw new TestException( "getLookupGroups did not contain ALL_GROUPS after shutdown");
   */

  //
  // Locators
  //
  logger.log(Level.INFO, "Calling JoinAdmin::getLookupLocators ");
  if (!assertLocators(ja.getLookupLocators(), new LookupLocator[0]))
      throw new TestException( "Did not receive empty set of "
           + "locators upon startup");
  logger.log(Level.INFO, "Calling JoinAdmin::addLookupLocators()");
  LookupLocator[] locators = {
      QAConfig.getConstrainedLocator("jini://resendes:8080/"),
      QAConfig.getConstrainedLocator("jini://resendes:8081/"),
      };
  ja.addLookupLocators(locators);
  logger.log(Level.INFO, "Verifying JoinAdmin::addLookupLocators()");
  if (!assertLocators(ja.getLookupLocators(), locators))
      throw new TestException( "Did not receive expected set of "
           + "locators after add");

  shutdown(0);

  if (!assertLocators(ja.getLookupLocators(), locators))
      throw new TestException( "Did not receive expected set of "
           + "locators after shutdown");

  logger.log(Level.INFO, "Calling JoinAdmin::removeLookupLocators()");
  ja.removeLookupLocators(locators);
  if (!assertLocators(ja.getLookupLocators(), new LookupLocator[0]))
      throw new TestException( "Did not receive empty set of locators "
           + "after remove");

  shutdown(0);

  if (!assertLocators(ja.getLookupLocators(), new LookupLocator[0]))
      throw new TestException( "Did not receive empty set of "
           + "locators after shutdown");

  logger.log(Level.INFO, "Calling JoinAdmin::setLookupLocators()");
  ja.setLookupLocators(locators);
  if (!assertLocators(ja.getLookupLocators(), locators))
      throw new TestException( "Did not receive expected set of "
           + "locators after set");
  // double check assert mechanism
  LookupLocator[] bogusLoc = {
      locators[1],
      QAConfig.getConstrainedLocator("jini://bogus:8080/"),
      locators[0],
      };
  if (assertLocators(ja.getLookupLocators(), bogusLoc))
      throw new TestException( "assertLocators returned true "
           + "for bogus values");

  shutdown(0);

  if (!assertLocators(ja.getLookupLocators(), locators))
      throw new TestException( "Did not receive expected set "
           + "of locators after shutdown");


  /////////////////////////
View Full Code Here

Examples of net.jini.admin.JoinAdmin

        logger.log(Level.FINE, "run()");
        if(discoverySrvc == null) {
            throw new TestException("could not successfully start service "
          + serviceName);
        }
  JoinAdmin joinAdmin = JoinAdminUtil.getJoinAdmin(discoverySrvc);

  Entry[] initialAttributes = getInitialAttributeSet();
  joinAdmin.addLookupAttributes(initialAttributes);

  Entry[] oldAttributes = joinAdmin.getLookupAttributes();
  AttributesUtil.displayAttributeSet(oldAttributes,
             "oldAttributes",
             Level.FINE);
  Entry[] attrSetTmpls = getAttributeSetTemplates();
  AttributesUtil.displayAttributeSet(attrSetTmpls,
             "attrSetTmpls",
             Level.FINE);
  AttributesUtil.displayAttributeSet(newAttributeSet,
             "newAttributeSet",
             Level.FINE);
  joinAdmin.modifyLookupAttributes(attrSetTmpls,newAttributeSet);
  Entry[] newAttributes = joinAdmin.getLookupAttributes();
  AttributesUtil.displayAttributeSet(newAttributes,
             "newAttributes",
             Level.FINE);
  if (!AttributesUtil.compareAttributeSets(expectedAttributes,
             newAttributes,
View Full Code Here

Examples of net.jini.admin.JoinAdmin

        logger.log(Level.FINE, "run()");
        if(discoverySrvc == null) {
            throw new TestException("could not successfully start service "
          + serviceName);
        }
  JoinAdmin joinAdmin = JoinAdminUtil.getJoinAdmin(discoverySrvc);
  LookupLocator[] oldLocators = joinAdmin.getLookupLocators();
  LocatorsUtil.displayLocatorSet(oldLocators, "oldLocators", Level.FINE);
  LocatorsUtil.displayLocatorSet(newLocatorSet,"setLocators", Level.FINE);
  joinAdmin.setLookupLocators(newLocatorSet);
  LookupLocator[] newLocators = joinAdmin.getLookupLocators();
  LocatorsUtil.displayLocatorSet(newLocators,"newLocators", Level.FINE);
  if (!LocatorsUtil.compareLocatorSets(expectedLocators,
               newLocators,
               Level.FINE))
        {
View Full Code Here

Examples of net.jini.admin.JoinAdmin

  // before it gets destroyed at the end of this test.

  //waitOnInput(); // wait

  logger.log(Level.INFO, "\tCalling JoinAdmin methods");
  JoinAdmin ja = (JoinAdmin)admin;
  Entry[] attrs = ja.getLookupAttributes();
  logger.log(Level.INFO, "Calling JoinAdmin::getLookupAttributes: got " +
      attrs.length + " items");
  String name = "Spanguini";
  Entry[] newAttrs = { new Name(name) };
  logger.log(Level.INFO, "Calling JoinAdmin::addLookupAttributes()");
  ja.addLookupAttributes(newAttrs);
  logger.log(Level.INFO, "Checking addLookupAttributes call via get call");
  attrs = ja.getLookupAttributes();
  if (!assertContainsName(attrs, name)) {
      throw new TestException(
    "Did not receive proper attribute setting for Name " +
    "after adding");
  }
  name = name + "2";
  Entry[] templates = { new Name() };
  newAttrs[0] = new Name(name);
  logger.log(Level.INFO, "Calling JoinAdmin::modifyLookupAttributes()");
  ja.modifyLookupAttributes(templates, newAttrs);
  attrs = ja.getLookupAttributes();
  if (!assertContainsName(attrs, name)) {
      throw new TestException("Did not receive proper attribute setting for Name after modifying");
  }
  // double check assert mechanism
  if (assertContainsName(attrs, name + "2")) {
      throw new TestException("assertContainsName returned true for a bogus value");
  }
  //
  // LookupGroups
  //
  String[] luGroups = null;
  /*
   * TestBase utilities automatically create and join the service(s)
   * under test to at one (unique) group. So, this section of of code
   * is no longer valid.
  luGroups = ja.getLookupGroups();
  logger.log(Level.INFO, "Calling JoinAdmin::getLookupGroups got " +
      luGroups.length + " items");
  dumpGroups(luGroups);
  if (!assertLookupGroups(luGroups, LookupDiscovery.NO_GROUPS))
      throw new TestException(
    "getLookupGroups did not return NO_GROUPS upon startup");
   */

  String[] groups = { "group1", "group2", "group3" };
  logger.log(Level.INFO, "Calling JoinAdmin::addLookupGroups()");
  dumpGroups(groups);
  ja.addLookupGroups(groups);
  logger.log(Level.INFO, "Verifying group set: ");
  luGroups = ja.getLookupGroups();
  dumpGroups(luGroups);
  if (luGroups.length < groups.length)
      throw new TestException(
    "Invalid length for returned group set after add");
  if (!assertLookupGroups(luGroups, groups))
      throw new TestException(
    "getLookupGroups did not contain added group set");

  logger.log(Level.INFO, "Calling JoinAdmin::removeLookupGroups()");
  dumpGroups(groups);
  ja.removeLookupGroups(groups);
  logger.log(Level.INFO, "Verifying returned groups: ");
  luGroups = ja.getLookupGroups();
  dumpGroups(luGroups);
  if (assertLookupGroups(luGroups, groups))
      throw new TestException("getLookupGroups contained removed group ");

  logger.log(Level.INFO, "Calling JoinAdmin::setLookupGroups()");
  dumpGroups(groups);
  ja.setLookupGroups(groups);
  logger.log(Level.INFO, "Verifying group set: ");
  luGroups = ja.getLookupGroups();
  dumpGroups(luGroups);
  if (groups.length != luGroups.length)
      throw new TestException("Invalid length for returned group set after set");
  if (!assertLookupGroups(luGroups, groups))
      throw new TestException("getLookupGroups did not contain required group set");
  // double check assert mechanism
  String[] bogus = { groups[0], "bogusGroup", groups[1] };
  if (assertLookupGroups(luGroups, bogus))
      throw new TestException("assertLookupGroups returned true for bogus data");
  /*
   * The following test causes cross-talk between concurrently
   * running test suite -- resulting in spurrious failures.
   * Setting grops=ALL causes the service to register with
   * other LUS w/i multicast radius. Other tests can potentially
   * get references to the service, which goes away shortly
   * thereafter.
  logger.log(Level.INFO, "Calling JoinAdmin::setLookupGroups(ALL_GROUPS) ");
  ja.setLookupGroups(LookupDiscovery.ALL_GROUPS);
  logger.log(Level.INFO, "Verifying group set: ");
  luGroups = ja.getLookupGroups();
  dumpGroups(luGroups);
  if (!assertLookupGroups(luGroups, LookupDiscovery.ALL_GROUPS))
      throw new TestException("getLookupGroups did not contain ALL_GROUPS after set");
   */

  //
  // Locators
  //
  logger.log(Level.INFO, "Calling JoinAdmin::getLookupLocators ");
  if (!assertLocators(ja.getLookupLocators(), new LookupLocator[0]))
      throw new TestException("Did not receive empty set of locators upon startup");
  logger.log(Level.INFO, "Calling JoinAdmin::addLookupLocators()");
  LookupLocator[] locators = {
      QAConfig.getConstrainedLocator("jini://resendes:8080/"),
      QAConfig.getConstrainedLocator("jini://resendes:8081/"),
  };
  ja.addLookupLocators(locators);
  logger.log(Level.INFO, "Verifying JoinAdmin::addLookupLocators()");
  if (!assertLocators(ja.getLookupLocators(), locators))
      throw new TestException("Did not receive expected set of locators after add");
  logger.log(Level.INFO, "Calling JoinAdmin::removeLookupLocators()");
  ja.removeLookupLocators(locators);
  if (!assertLocators(ja.getLookupLocators(), new LookupLocator[0]))
      throw new TestException("Did not receive empty set of locators after remove");
  logger.log(Level.INFO, "Calling JoinAdmin::setLookupLocators()");
  ja.setLookupLocators(locators);
  if (!assertLocators(ja.getLookupLocators(), locators))
      throw new TestException("Did not receive expected set of locators after set");
  // double check assert mechanism
  LookupLocator[] bogusLoc = {
      locators[1],
      QAConfig.getConstrainedLocator("jini://bogus:8080/"),
      locators[0],
  };
  if (assertLocators(ja.getLookupLocators(), bogusLoc))
      throw new TestException("assertLocators returned true for bogus values");


  /////////////////////////
  // DestroyAdmin Methods
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.