예제 #1
0
  @Test
  public void testGetSetEnabled() {
    // combines set and get tests. These are important in this instance,
    // because getEnabled allows an optional callback Filter.
    ServiceProxy.getInstance().setEnabled(true);
    assertTrue(ServiceProxy.getInstance().getEnabled(null));

    AAAFilter testFilter = new AAAFilter();
    // register the filter
    ServiceProxy.getInstance().getEnabled(testFilter);
    assertTrue(testFilter.isEnabled());

    ServiceProxy.getInstance().setEnabled(false);
    assertFalse(ServiceProxy.getInstance().getEnabled(testFilter));
    assertFalse(testFilter.isEnabled());
  }
예제 #2
0
 /**
  * Enables/disables the feature, cascading the state information to the AAAFilter.
  *
  * @param enabled
  */
 public synchronized void setEnabled(final boolean enabled) {
   this.enabled = enabled;
   final String SERVICE_ENABLED_INFO_MESSAGE = "Setting ServiceProxy enabled to " + enabled;
   LOG.info(SERVICE_ENABLED_INFO_MESSAGE);
   // check for null because of non-determinism in bundle load
   if (filter != null) {
     filter.setEnabled(enabled);
   }
 }