Package de.nava.informa.utils

Examples of de.nava.informa.utils.PersistChanGrpMgr


   * time.
   *
   * @throws Exception
   */
  public void testRemoveChannelsFromGroup() throws Exception {
    PersistChanGrpMgr theGrp;
    int count = 5;
    theGrp = makeEmptyGroup("The Group");
    addGenChannels(theGrp, count, 5);

    for (int i = 0; i < count; i++) {
      ChannelBuilder bld = theGrp.getBuilder();
      bld.beginTransaction();
      bld.update(theGrp.getChannelGroup());

      // Check that we have the right number of Channels
      assertValidGroup(theGrp, "The Group", count - i);

      // Identify the first channel after ensuring that there is at least one.
      Channel channelToDelete;
      Collection chans = theGrp.getChannelGroup().getChannels();
      Iterator iter = chans.iterator();
      assertTrue(chans.size() > 0);
      channelToDelete = (Channel) iter.next();

      bld.endTransaction();

      // And delete it from the group
      theGrp.deleteChannel(channelToDelete);
    }
  }
View Full Code Here


   * Test activation and deactivation, with thread handling too/
   *
   * @throws Exception
   */
  public void testStartStopGroup() throws Exception {
    PersistChanGrpMgr groupStopStart;
    groupStopStart = makeEmptyGroup("stopStartGroup");

    // Start and stop a few times
    for (int i = 0; i < 2; i++) {
      groupStopStart.activate();
      assertTrue("Channel Group is supposed to be activated", groupStopStart.isActivated());
      groupStopStart.deActivate(true);
      assertFalse("ChannelGroup is not supposed to be activated", groupStopStart.isActivated());
      Thread.sleep(500);
    }
  }
View Full Code Here

   *
   * @throws Exception
   */
  public void testItemCount() throws Exception {
    // Create a ChannelGroup and populate it with channels and items
    PersistChanGrpMgr countedGrp;
    countedGrp = makeEmptyGroup("Item Count Group");
    int count = 10;
    addGenChannels(countedGrp, count, 5);

    Object[] channels = countedGrp.getChannelGroup().getChannels().toArray();
    assertEquals("Wrong number of channels in group", channels.length, count);

    // Iterate through all the new channels
    for (int i = 0; i < count; i++) {
      Channel aChan = (Channel) channels[i];
      Object[] items = aChan.getItems().toArray();
      int howManyItems = items.length;
      assertEquals("Wrong Count returned", howManyItems, countedGrp.getItemCount(aChan));
    }
  }
View Full Code Here

   *
   * @param name - Name to use
   * @return created empty group
   */
  public PersistChanGrpMgr makeEmptyGroup(String name) {
    PersistChanGrpMgr res;
    logger.info("Creating group: " + name);
    res = new PersistChanGrpMgr(handler, false);
    res.createGroup(name);
    logger.info("Result: " + res);
    assertEquals("Newly created group has non-zero Channels", 0, res.getChannelGroup()
        .getChannels().size());
    return res;
  }
View Full Code Here

TOP

Related Classes of de.nava.informa.utils.PersistChanGrpMgr

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.