use of org.apache.servicecomb.serviceregistry.api.registry.Microservice in project incubator-servicecomb-java-chassis by apache.
the class TestAbstractRegisterTask method setup.
@Before
public void setup() {
eventBus = new EventBus();
microservice = new Microservice();
microservice.setAppId("app");
microservice.setServiceName("ms");
microservice.setInstance(new MicroserviceInstance());
}
use of org.apache.servicecomb.serviceregistry.api.registry.Microservice in project incubator-servicecomb-java-chassis by apache.
the class TestMicroserviceInstanceHeartbeatTask method setup.
@Before
public void setup() {
eventBus = new EventBus();
heartbeatTaskList = new ArrayList<>();
eventBus.register(new Object() {
@Subscribe
public void onEvent(MicroserviceInstanceHeartbeatTask task) {
heartbeatTaskList.add(task);
}
});
microservice = new Microservice();
microservice.setAppId("app");
microservice.setServiceName("ms");
microservice.setServiceId("serviceId");
microservice.setInstance(new MicroserviceInstance());
microservice.getInstance().setInstanceId("instanceId");
}
use of org.apache.servicecomb.serviceregistry.api.registry.Microservice in project incubator-servicecomb-java-chassis by apache.
the class TestMicroserviceRegisterTask method testAlreadyRegisteredGetSchemaIdSetFailed.
@Test
public void testAlreadyRegisteredGetSchemaIdSetFailed(@Mocked ServiceRegistryClient srClient) {
Microservice otherMicroservice = new Microservice();
otherMicroservice.setAppId(microservice.getAppId());
otherMicroservice.setServiceName("ms1");
otherMicroservice.addSchema("s1", "");
new Expectations() {
{
srClient.getMicroserviceId(anyString, anyString, anyString);
result = "serviceId";
srClient.getMicroservice(anyString);
result = null;
}
};
MicroserviceRegisterTask registerTask = new MicroserviceRegisterTask(eventBus, srClient, microservice);
registerTask.run();
Assert.assertEquals(false, registerTask.isRegistered());
Assert.assertEquals(false, registerTask.isSchemaIdSetMatch());
Assert.assertEquals("serviceId", microservice.getServiceId());
Assert.assertEquals(1, taskList.size());
}
use of org.apache.servicecomb.serviceregistry.api.registry.Microservice in project incubator-servicecomb-java-chassis by apache.
the class TestMicroserviceVersions method createMicroservice.
private void createMicroservice(String microserviceId) {
Microservice microservice = new Microservice();
microservice.setServiceId(microserviceId);
microservice.setVersion(microserviceId + ".0.0");
microservices.put(microserviceId, microservice);
}
use of org.apache.servicecomb.serviceregistry.api.registry.Microservice in project incubator-servicecomb-java-chassis by apache.
the class LocalServiceRegistryClientImplTest method getMicroserviceId_latest.
@Test
public void getMicroserviceId_latest() {
Microservice v2 = mockRegisterMicroservice(appId, microserviceName, "2.0.0");
mockRegisterMicroservice(appId, microserviceName, "1.0.0");
String serviceId = registryClient.getMicroserviceId(appId, microserviceName, DefinitionConst.VERSION_RULE_LATEST);
Assert.assertEquals(v2.getServiceId(), serviceId);
}
Aggregations