Search in sources :

Example 1 with ServiceDiscoveryDestroyingEvent

use of org.apache.dubbo.registry.client.event.ServiceDiscoveryDestroyingEvent in project dubbo by alibaba.

the class LoggingEventListenerTest method testOnEvent.

@Test
public void testOnEvent() throws Exception {
    URL connectionURL = URL.valueOf("file:///Users/Home");
    ServiceDiscovery serviceDiscovery = new FileSystemServiceDiscovery();
    serviceDiscovery.initialize(connectionURL);
    // ServiceDiscoveryStartingEvent
    listener.onEvent(new ServiceDiscoveryInitializingEvent(serviceDiscovery, serviceDiscovery));
    // ServiceDiscoveryStartedEvent
    listener.onEvent(new ServiceDiscoveryInitializedEvent(serviceDiscovery, serviceDiscovery));
    // ServiceInstancePreRegisteredEvent
    listener.onEvent(new ServiceInstancePreRegisteredEvent(serviceDiscovery, createInstance()));
    // ServiceInstanceRegisteredEvent
    listener.onEvent(new ServiceInstanceRegisteredEvent(serviceDiscovery, createInstance()));
    // ServiceInstancesChangedEvent
    listener.onEvent(new ServiceInstancesChangedEvent("test", Arrays.asList(createInstance())));
    // ServiceInstancePreUnregisteredEvent
    listener.onEvent(new ServiceInstancePreUnregisteredEvent(serviceDiscovery, createInstance()));
    // ServiceInstanceUnregisteredEvent
    listener.onEvent(new ServiceInstanceUnregisteredEvent(serviceDiscovery, createInstance()));
    // ServiceDiscoveryStoppingEvent
    listener.onEvent(new ServiceDiscoveryDestroyingEvent(serviceDiscovery, serviceDiscovery));
    // ServiceDiscoveryStoppedEvent
    listener.onEvent(new ServiceDiscoveryDestroyedEvent(serviceDiscovery, serviceDiscovery));
}
Also used : ServiceDiscoveryInitializingEvent(org.apache.dubbo.registry.client.event.ServiceDiscoveryInitializingEvent) ServiceInstancePreUnregisteredEvent(org.apache.dubbo.registry.client.event.ServiceInstancePreUnregisteredEvent) ServiceDiscoveryInitializedEvent(org.apache.dubbo.registry.client.event.ServiceDiscoveryInitializedEvent) ServiceInstancePreRegisteredEvent(org.apache.dubbo.registry.client.event.ServiceInstancePreRegisteredEvent) ServiceDiscoveryDestroyingEvent(org.apache.dubbo.registry.client.event.ServiceDiscoveryDestroyingEvent) ServiceInstanceRegisteredEvent(org.apache.dubbo.registry.client.event.ServiceInstanceRegisteredEvent) ServiceInstancesChangedEvent(org.apache.dubbo.registry.client.event.ServiceInstancesChangedEvent) ServiceInstanceUnregisteredEvent(org.apache.dubbo.registry.client.event.ServiceInstanceUnregisteredEvent) ServiceDiscoveryDestroyedEvent(org.apache.dubbo.registry.client.event.ServiceDiscoveryDestroyedEvent) FileSystemServiceDiscovery(org.apache.dubbo.registry.client.FileSystemServiceDiscovery) URL(org.apache.dubbo.common.URL) FileSystemServiceDiscovery(org.apache.dubbo.registry.client.FileSystemServiceDiscovery) ServiceDiscovery(org.apache.dubbo.registry.client.ServiceDiscovery) Test(org.junit.jupiter.api.Test)

Aggregations

URL (org.apache.dubbo.common.URL)1 FileSystemServiceDiscovery (org.apache.dubbo.registry.client.FileSystemServiceDiscovery)1 ServiceDiscovery (org.apache.dubbo.registry.client.ServiceDiscovery)1 ServiceDiscoveryDestroyedEvent (org.apache.dubbo.registry.client.event.ServiceDiscoveryDestroyedEvent)1 ServiceDiscoveryDestroyingEvent (org.apache.dubbo.registry.client.event.ServiceDiscoveryDestroyingEvent)1 ServiceDiscoveryInitializedEvent (org.apache.dubbo.registry.client.event.ServiceDiscoveryInitializedEvent)1 ServiceDiscoveryInitializingEvent (org.apache.dubbo.registry.client.event.ServiceDiscoveryInitializingEvent)1 ServiceInstancePreRegisteredEvent (org.apache.dubbo.registry.client.event.ServiceInstancePreRegisteredEvent)1 ServiceInstancePreUnregisteredEvent (org.apache.dubbo.registry.client.event.ServiceInstancePreUnregisteredEvent)1 ServiceInstanceRegisteredEvent (org.apache.dubbo.registry.client.event.ServiceInstanceRegisteredEvent)1 ServiceInstanceUnregisteredEvent (org.apache.dubbo.registry.client.event.ServiceInstanceUnregisteredEvent)1 ServiceInstancesChangedEvent (org.apache.dubbo.registry.client.event.ServiceInstancesChangedEvent)1 Test (org.junit.jupiter.api.Test)1