コード例 #1
0
  @Before
  public void setUp() {
    mgr = new GroupManager();
    groupService = mgr;
    // mgr.deviceService = new DeviceManager();
    mgr.deviceService = new TestDeviceService();
    mgr.cfgService = new ComponentConfigAdapter();
    mgr.store = new SimpleGroupStore();
    injectEventDispatcher(mgr, new TestEventDispatcher());
    providerRegistry = mgr;

    mgr.activate(null);
    mgr.addListener(listener);

    driverService = new TestDriverManager();
    driverService.addDriver(
        new DefaultDriver(
            "foo",
            ImmutableList.of(),
            "",
            "",
            "",
            ImmutableMap.of(GroupProgrammable.class, TestGroupProgrammable.class),
            ImmutableMap.of()));

    internalProvider = new TestGroupProvider(PID);
    provider = internalProvider;
    providerService = providerRegistry.register(provider);
    appId = new DefaultApplicationId(2, "org.groupmanager.test");
    assertTrue(
        "provider should be registered", providerRegistry.getProviders().contains(provider.id()));
  }
コード例 #2
0
 @After
 public void tearDown() {
   providerRegistry.unregister(provider);
   assertFalse(
       "provider should not be registered",
       providerRegistry.getProviders().contains(provider.id()));
   mgr.removeListener(listener);
   mgr.deactivate();
   injectEventDispatcher(mgr, null);
 }