Search in sources :

Example 21 with FindInstancesResponse

use of org.apache.servicecomb.registry.api.registry.FindInstancesResponse in project incubator-servicecomb-java-chassis by apache.

the class TestFindInstancesResponse method setUp.

@Before
public void setUp() throws Exception {
    oFindInstancesResponse = new FindInstancesResponse();
    oListMicroserviceInstance = new ArrayList<>();
    oListMicroserviceInstance.add(Mockito.mock(MicroserviceInstance.class));
}
Also used : MicroserviceInstance(org.apache.servicecomb.registry.api.registry.MicroserviceInstance) FindInstancesResponse(org.apache.servicecomb.registry.api.registry.FindInstancesResponse) Before(org.junit.Before)

Example 22 with FindInstancesResponse

use of org.apache.servicecomb.registry.api.registry.FindInstancesResponse in project incubator-servicecomb-java-chassis by apache.

the class MicroserviceStore method findServiceInstances.

public MicroserviceInstances findServiceInstances(String revision) {
    if (instancesRevision.equals(revision)) {
        return new MicroserviceInstances().setRevision(instancesRevision).setNeedRefresh(false);
    }
    List<MicroserviceInstance> instances = instancesById.values().stream().map(InstanceStore::getInstance).collect(Collectors.toList());
    FindInstancesResponse response = new FindInstancesResponse().setInstances(instances);
    return new MicroserviceInstances().setRevision(instancesRevision).setInstancesResponse(response);
}
Also used : MicroserviceInstances(org.apache.servicecomb.registry.api.registry.MicroserviceInstances) MicroserviceInstance(org.apache.servicecomb.registry.api.registry.MicroserviceInstance) FindInstancesResponse(org.apache.servicecomb.registry.api.registry.FindInstancesResponse)

Aggregations

FindInstancesResponse (org.apache.servicecomb.registry.api.registry.FindInstancesResponse)22 MicroserviceInstances (org.apache.servicecomb.registry.api.registry.MicroserviceInstances)18 MicroserviceInstance (org.apache.servicecomb.registry.api.registry.MicroserviceInstance)16 ArrayList (java.util.ArrayList)8 Microservice (org.apache.servicecomb.registry.api.registry.Microservice)6 Before (org.junit.Before)6 Test (org.junit.Test)4 VisibleForTesting (com.google.common.annotations.VisibleForTesting)2 IOException (java.io.IOException)2 InputStream (java.io.InputStream)2 URL (java.net.URL)2 Enumeration (java.util.Enumeration)2 HashMap (java.util.HashMap)2 List (java.util.List)2 Map (java.util.Map)2 Entry (java.util.Map.Entry)2 UUID (java.util.UUID)2 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)2 Collectors (java.util.stream.Collectors)2 MockUp (mockit.MockUp)2