yhs0092 commented on a change in pull request #785: [SCB-705] consumer don't 
cache ReferenceConfig of an unregistered provider
URL: 
https://github.com/apache/incubator-servicecomb-java-chassis/pull/785#discussion_r199121183
 
 

 ##########
 File path: 
core/src/test/java/org/apache/servicecomb/core/provider/consumer/TestConsumerProviderManager.java
 ##########
 @@ -96,4 +108,42 @@ public void createReferenceConfig_config() {
     Assert.assertEquals("1.0.0+", 
referenceConfig.getMicroserviceVersionRule().getVersionRule().getVersionRule());
     Assert.assertEquals(Const.RESTFUL, referenceConfig.getTransport());
   }
+
+  @Test
+  public void createReferenceConfig_ProviderNotFound() {
+    EventBus eventBus = new EventBus();
+    AppManager appManager = new AppManager(eventBus);
+
+    ConsumerProviderManager consumerProviderManager = new 
ConsumerProviderManager();
+    consumerProviderManager.setAppManager(appManager);
+
+    new Expectations(RegistryUtils.class) {
+      {
+        RegistryUtils.findServiceInstances(anyString, anyString, 
DefinitionConst.VERSION_RULE_ALL, null);
+        result = Collections.emptyList();
+      }
+    };
+
+    new MockUp<MicroserviceVersionRule>() {
+      @Mock
+      String getAppId() {
+        return "aId";
+      }
+
+      @Mock
+      String getMicroserviceName() {
+        return "ms";
+      }
+    };
+
+    try {
+      ReferenceConfig referenceConfig = 
consumerProviderManager.createReferenceConfig("app:ms");
 
 Review comment:
   fixed, please review again.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to