This is an automated email from the ASF dual-hosted git repository.

liujun pushed a commit to branch 3.0-metadata-refactor
in repository https://gitbox.apache.org/repos/asf/dubbo.git


The following commit(s) were added to refs/heads/3.0-metadata-refactor by this 
push:
     new 6416891  fix ut
6416891 is described below

commit 6416891a860ec0a13ac9c6d6241c1d68b1480788
Author: ken.lj <[email protected]>
AuthorDate: Wed Dec 8 12:07:37 2021 +0800

    fix ut
---
 .../apache/dubbo/qos/command/impl/PublishMetadataTest.java   | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git 
a/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/impl/PublishMetadataTest.java
 
b/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/impl/PublishMetadataTest.java
index 0c87008..4aaee6f 100644
--- 
a/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/impl/PublishMetadataTest.java
+++ 
b/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/impl/PublishMetadataTest.java
@@ -16,10 +16,8 @@
  */
 package org.apache.dubbo.qos.command.impl;
 
-import org.apache.dubbo.config.deploy.DefaultApplicationDeployer;
+import org.apache.dubbo.config.ApplicationConfig;
 import org.apache.dubbo.qos.command.CommandContext;
-import org.apache.dubbo.registry.client.DefaultServiceInstance;
-import org.apache.dubbo.registry.client.ServiceInstance;
 import org.apache.dubbo.rpc.model.ApplicationModel;
 import org.apache.dubbo.rpc.model.FrameworkModel;
 
@@ -29,8 +27,6 @@ import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 import org.mockito.Mockito;
 
-import java.lang.reflect.Field;
-
 public class PublishMetadataTest {
     private FrameworkModel frameworkModel;
 
@@ -39,11 +35,7 @@ public class PublishMetadataTest {
         frameworkModel = new FrameworkModel();
         for (int i = 0; i < 3; i++) {
             ApplicationModel applicationModel = 
frameworkModel.newApplication();
-            DefaultApplicationDeployer deployer = 
applicationModel.getBeanFactory().getBean(DefaultApplicationDeployer.class);
-            ServiceInstance serviceInstance = new 
DefaultServiceInstance("APP_" + i, applicationModel);
-            Field serviceInstanceField = 
deployer.getClass().getDeclaredField("serviceInstance");
-            serviceInstanceField.setAccessible(true);
-            serviceInstanceField.set(deployer, serviceInstance);
+            applicationModel.getApplicationConfigManager().setApplication(new 
ApplicationConfig("APP_" + i));
         }
 
     }

Reply via email to