Search in sources :

Example 1 with RegistrationManager

use of org.apache.servicecomb.registry.RegistrationManager in project java-chassis by ServiceComb.

the class PriorityInstancePropertyDiscoveryFilterTest method setUp.

@Before
public void setUp() {
    filter = new PriorityInstancePropertyDiscoveryFilter();
    instances = new HashMap<>();
    self = new MicroserviceInstance();
    self.setInstanceId("self");
    MicroserviceInstance instance1 = new MicroserviceInstance();
    instance1.setInstanceId("instance.empty");
    MicroserviceInstance instance2 = new MicroserviceInstance();
    instance2.getProperties().put(PROPERTY_KEY, "local");
    instance2.setInstanceId("instance.local");
    MicroserviceInstance instance3 = new MicroserviceInstance();
    instance3.getProperties().put(PROPERTY_KEY, "local.feature1");
    instance3.setInstanceId("instance.local.feature1");
    MicroserviceInstance instance4 = new MicroserviceInstance();
    instance4.getProperties().put(PROPERTY_KEY, "local.feature1.sprint1");
    instance4.setInstanceId("instance.local.feature1.sprint1");
    instances.put(instance1.getInstanceId(), instance1);
    instances.put(instance2.getInstanceId(), instance2);
    instances.put(instance3.getInstanceId(), instance3);
    instances.put(instance4.getInstanceId(), instance4);
    original = Deencapsulation.getField(RegistrationManager.class, "INSTANCE");
    Deencapsulation.setField(RegistrationManager.class, "INSTANCE", registrationManager);
    new Expectations() {

        {
            registrationManager.getMicroserviceInstance();
            result = self;
        }
    };
}
Also used : Expectations(mockit.Expectations) RegistrationManager(org.apache.servicecomb.registry.RegistrationManager) MicroserviceInstance(org.apache.servicecomb.registry.api.registry.MicroserviceInstance) Before(org.junit.Before)

Aggregations

Expectations (mockit.Expectations)1 RegistrationManager (org.apache.servicecomb.registry.RegistrationManager)1 MicroserviceInstance (org.apache.servicecomb.registry.api.registry.MicroserviceInstance)1 Before (org.junit.Before)1