use of org.apache.servicecomb.serviceregistry.client.http.MicroserviceInstances in project incubator-servicecomb-java-chassis by apache.
the class MicroserviceVersions method pullInstances.
public void pullInstances() {
if (pendingPullCount.decrementAndGet() != 0) {
return;
}
MicroserviceInstances microserviceInstances = RegistryUtils.findServiceInstances(appId, microserviceName, DefinitionConst.VERSION_RULE_ALL, revision);
if (microserviceInstances == null) {
return;
}
if (!microserviceInstances.isNeedRefresh()) {
return;
}
List<MicroserviceInstance> pulledInstances = microserviceInstances.getInstancesResponse().getInstances();
String rev = microserviceInstances.getRevision();
safeSetInstances(pulledInstances, rev);
}
use of org.apache.servicecomb.serviceregistry.client.http.MicroserviceInstances in project incubator-servicecomb-java-chassis by apache.
the class TestMicroserviceVersions method setUp.
@Before
public void setUp() throws Exception {
microserviceInstances = new MicroserviceInstances();
findInstancesResponse = new FindInstancesResponse();
}
use of org.apache.servicecomb.serviceregistry.client.http.MicroserviceInstances in project incubator-servicecomb-java-chassis by apache.
the class LocalServiceRegistryClientImplTest method testLoadRegistryFile.
@Test
public void testLoadRegistryFile() {
Assert.assertNotNull(registryClient);
Assert.assertThat(registryClient.getAllMicroservices().size(), Is.is(1));
List<MicroserviceInstance> m = registryClient.findServiceInstance("", "myapp", "springmvctest", DefinitionConst.VERSION_RULE_ALL);
Assert.assertEquals(1, m.size());
MicroserviceInstances microserviceInstances = registryClient.findServiceInstances("", "myapp", "springmvctest", DefinitionConst.VERSION_RULE_ALL, null);
List<MicroserviceInstance> mi = microserviceInstances.getInstancesResponse().getInstances();
Assert.assertEquals(1, mi.size());
}
use of org.apache.servicecomb.serviceregistry.client.http.MicroserviceInstances in project incubator-servicecomb-java-chassis by apache.
the class AbstractServiceRegistry method findServiceInstances.
public MicroserviceInstances findServiceInstances(String appId, String serviceName, String versionRule, String revision) {
MicroserviceInstances microserviceInstances = srClient.findServiceInstances(microservice.getServiceId(), appId, serviceName, versionRule, revision);
if (microserviceInstances == null) {
LOGGER.error("Can not find any instances from service center due to previous errors. service={}/{}/{}", appId, serviceName, versionRule);
return null;
}
if (!microserviceInstances.isNeedRefresh()) {
LOGGER.debug("instances revision is not changed, service={}/{}/{}", appId, serviceName, versionRule);
return microserviceInstances;
}
List<MicroserviceInstance> instances = microserviceInstances.getInstancesResponse().getInstances();
LOGGER.info("find instances[{}] from service center success. service={}/{}/{}", instances.size(), appId, serviceName, versionRule);
for (MicroserviceInstance instance : instances) {
LOGGER.info("service id={}, instance id={}, endpoints={}", instance.getServiceId(), instance.getInstanceId(), instance.getEndpoints());
}
return microserviceInstances;
}
use of org.apache.servicecomb.serviceregistry.client.http.MicroserviceInstances in project incubator-servicecomb-java-chassis by apache.
the class TestAppManager method setUp.
@Before
public void setUp() throws Exception {
microserviceInstances = new MicroserviceInstances();
findInstancesResponse = new FindInstancesResponse();
findInstancesResponse.setInstances(Collections.emptyList());
microserviceInstances.setInstancesResponse(findInstancesResponse);
}
Aggregations