LoggingEventListener extends GenericEventListener { public void onEvent(ServiceDiscoveryInitializingEvent event) { info("%s is initializing...", event.getServiceDiscovery()); }  void onEvent(ServiceDiscoveryInitializingEvent event); void onEvent(ServiceDiscoveryInitializedEvent event); void onEvent(ServiceInstancePreRegisteredEvent event); void onEvent(ServiceInstanceRegisteredEvent event); void onEvent(ServiceInstancesChangedEvent event); void onEvent(ServiceInstancePreUnregisteredEvent event); void onEvent(ServiceInstanceUnregisteredEvent event); void onEvent(ServiceDiscoveryDestroyingEvent event); void onEvent(ServiceDiscoveryDestroyedEvent event);  }
@Test public void testOnEvent() throws Exception { URL connectionURL = URL.valueOf("file: ServiceDiscovery serviceDiscovery = new FileSystemServiceDiscovery(); serviceDiscovery.initialize(connectionURL); listener.onEvent(new ServiceDiscoveryInitializingEvent(serviceDiscovery, serviceDiscovery)); listener.onEvent(new ServiceDiscoveryInitializedEvent(serviceDiscovery, serviceDiscovery)); listener.onEvent(new ServiceInstancePreRegisteredEvent(serviceDiscovery, createInstance())); listener.onEvent(new ServiceInstanceRegisteredEvent(serviceDiscovery, createInstance())); listener.onEvent(new ServiceInstancesChangedEvent("test", Arrays.asList(createInstance()))); listener.onEvent(new ServiceInstancePreUnregisteredEvent(serviceDiscovery, createInstance())); listener.onEvent(new ServiceInstanceUnregisteredEvent(serviceDiscovery, createInstance())); listener.onEvent(new ServiceDiscoveryDestroyingEvent(serviceDiscovery, serviceDiscovery)); listener.onEvent(new ServiceDiscoveryDestroyedEvent(serviceDiscovery, serviceDiscovery)); }