use of io.servicecomb.serviceregistry.api.MicroserviceKey in project java-chassis by ServiceComb.
the class TestCacheRegistryListener method testonMicroserviceInstanceChangedUPDATE.
@Test
public void testonMicroserviceInstanceChangedUPDATE() {
MicroserviceInstanceChangedEvent changedEvent = new MicroserviceInstanceChangedEvent();
changedEvent.setAction(WatchAction.UPDATE);
MicroserviceKey key = Mockito.mock(MicroserviceKey.class);
changedEvent.setKey(key);
MicroserviceInstance mInstance = Mockito.mock(MicroserviceInstance.class);
changedEvent.setInstance(mInstance);
instance.onMicroserviceInstanceChanged(changedEvent);
}
use of io.servicecomb.serviceregistry.api.MicroserviceKey in project java-chassis by ServiceComb.
the class TestInstanceCacheManager method testInstanceUpdate.
@Test
public void testInstanceUpdate() {
Microservice oInstance = RegistryUtils.getMicroservice();
InstanceCacheManager oInstanceCacheManager = new InstanceCacheManager();
MicroserviceInstanceChangedEvent oChangedEnvent = new MicroserviceInstanceChangedEvent();
oChangedEnvent.setAction(WatchAction.UPDATE);
MicroserviceKey oKey = new MicroserviceKey();
oKey.setAppId(oInstance.getAppId());
oKey.setVersion(oInstance.getVersion());
oKey.setServiceName(oInstance.getServiceName());
oChangedEnvent.setKey(oKey);
oChangedEnvent.setInstance(RegistryUtils.getMicroserviceInstance());
oInstanceCacheManager.onInstanceUpdate(oChangedEnvent);
oChangedEnvent.setAction(WatchAction.DELETE);
oInstanceCacheManager.onInstanceUpdate(oChangedEnvent);
oChangedEnvent.setAction(WatchAction.CREATE);
oInstanceCacheManager.onInstanceUpdate(oChangedEnvent);
Assert.assertEquals("UP", RegistryUtils.getMicroserviceInstance().getStatus().toString());
}
use of io.servicecomb.serviceregistry.api.MicroserviceKey in project java-chassis by ServiceComb.
the class TestCacheRegistryListener method testonMicroserviceInstanceChangedCREATE.
@Test
public void testonMicroserviceInstanceChangedCREATE() {
MicroserviceInstanceChangedEvent changedEvent = new MicroserviceInstanceChangedEvent();
changedEvent.setAction(WatchAction.CREATE);
MicroserviceKey key = Mockito.mock(MicroserviceKey.class);
changedEvent.setKey(key);
MicroserviceInstance mInstance = Mockito.mock(MicroserviceInstance.class);
changedEvent.setInstance(mInstance);
instance.onMicroserviceInstanceChanged(changedEvent);
}
use of io.servicecomb.serviceregistry.api.MicroserviceKey in project java-chassis by ServiceComb.
the class TestCacheRegistryListener method testonMicroserviceInstanceChangedDELETE.
@Test
public void testonMicroserviceInstanceChangedDELETE() {
MicroserviceInstanceChangedEvent changedEvent = new MicroserviceInstanceChangedEvent();
changedEvent.setAction(WatchAction.DELETE);
MicroserviceKey key = Mockito.mock(MicroserviceKey.class);
changedEvent.setKey(key);
MicroserviceInstance mInstance = Mockito.mock(MicroserviceInstance.class);
changedEvent.setInstance(mInstance);
instance.onMicroserviceInstanceChanged(changedEvent);
}
Aggregations