beiwei30 closed pull request #1794: clean up work for config-api unit test
URL: https://github.com/apache/incubator-dubbo/pull/1794
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/AbstractConfigTest.java
 
b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/AbstractConfigTest.java
index 7cd83f0b28..5366b90910 100644
--- 
a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/AbstractConfigTest.java
+++ 
b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/AbstractConfigTest.java
@@ -18,6 +18,7 @@
 
 import com.alibaba.dubbo.common.Constants;
 import com.alibaba.dubbo.common.utils.ConfigUtils;
+import com.alibaba.dubbo.config.api.Greeting;
 import com.alibaba.dubbo.config.support.Parameter;
 import junit.framework.TestCase;
 import org.junit.Test;
diff --git 
a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/AbstractInterfaceConfigTest.java
 
b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/AbstractInterfaceConfigTest.java
index 94578b2cfd..f34c31ffbe 100644
--- 
a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/AbstractInterfaceConfigTest.java
+++ 
b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/AbstractInterfaceConfigTest.java
@@ -19,6 +19,12 @@
 import com.alibaba.dubbo.common.Constants;
 import com.alibaba.dubbo.common.URL;
 import com.alibaba.dubbo.common.utils.ConfigUtils;
+import com.alibaba.dubbo.config.api.Greeting;
+import com.alibaba.dubbo.config.mock.GreetingLocal1;
+import com.alibaba.dubbo.config.mock.GreetingLocal2;
+import com.alibaba.dubbo.config.mock.GreetingLocal3;
+import com.alibaba.dubbo.config.mock.GreetingMock1;
+import com.alibaba.dubbo.config.mock.GreetingMock2;
 import com.alibaba.dubbo.monitor.MonitorService;
 import com.alibaba.dubbo.registry.RegistryService;
 import junit.framework.TestCase;
diff --git 
a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/ProtocolConfigTest.java
 
b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/ProtocolConfigTest.java
index 43f3621e28..c9d904622e 100644
--- 
a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/ProtocolConfigTest.java
+++ 
b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/ProtocolConfigTest.java
@@ -18,6 +18,7 @@
 package com.alibaba.dubbo.config;
 
 import com.alibaba.dubbo.common.extension.ExtensionLoader;
+import com.alibaba.dubbo.config.mock.MockProtocol2;
 import com.alibaba.dubbo.rpc.Protocol;
 import org.junit.Test;
 import org.mockito.Mockito;
diff --git 
a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/RegistryConfigTest.java
 
b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/RegistryConfigTest.java
new file mode 100644
index 0000000000..1d9bbe2038
--- /dev/null
+++ 
b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/RegistryConfigTest.java
@@ -0,0 +1,174 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.alibaba.dubbo.config;
+
+import com.alibaba.dubbo.common.Constants;
+import org.junit.Test;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.Matchers.equalTo;
+import static org.hamcrest.Matchers.hasEntry;
+import static org.hamcrest.Matchers.hasKey;
+import static org.hamcrest.Matchers.not;
+import static org.junit.Assert.assertThat;
+
+public class RegistryConfigTest {
+    @Test
+    public void testProtocol() throws Exception {
+        RegistryConfig registry = new RegistryConfig();
+        registry.setProtocol("protocol");
+        assertThat(registry.getProtocol(), equalTo(registry.getProtocol()));
+    }
+
+    @Test
+    public void testAddress() throws Exception {
+        RegistryConfig registry = new RegistryConfig();
+        registry.setAddress("localhost");
+        assertThat(registry.getAddress(), equalTo("localhost"));
+        Map<String, String> parameters = new HashMap<String, String>();
+        RegistryConfig.appendParameters(parameters, registry);
+        assertThat(parameters, not(hasKey("address")));
+    }
+
+    @Test
+    public void testUsername() throws Exception {
+        RegistryConfig registry = new RegistryConfig();
+        registry.setUsername("username");
+        assertThat(registry.getUsername(), equalTo("username"));
+    }
+
+    @Test
+    public void testPassword() throws Exception {
+        RegistryConfig registry = new RegistryConfig();
+        registry.setPassword("password");
+        assertThat(registry.getPassword(), equalTo("password"));
+    }
+
+    @Test
+    public void testWait() throws Exception {
+        RegistryConfig registry = new RegistryConfig();
+        registry.setWait(10);
+        assertThat(registry.getWait(), is(10));
+        assertThat(System.getProperty(Constants.SHUTDOWN_WAIT_KEY), 
equalTo("10"));
+    }
+
+    @Test
+    public void testCheck() throws Exception {
+        RegistryConfig registry = new RegistryConfig();
+        registry.setCheck(true);
+        assertThat(registry.isCheck(), is(true));
+    }
+
+    @Test
+    public void testFile() throws Exception {
+        RegistryConfig registry = new RegistryConfig();
+        registry.setFile("file");
+        assertThat(registry.getFile(), equalTo("file"));
+    }
+
+    @Test
+    public void testTransporter() throws Exception {
+        RegistryConfig registry = new RegistryConfig();
+        registry.setTransporter("transporter");
+        assertThat(registry.getTransporter(), equalTo("transporter"));
+    }
+
+    @Test
+    public void testClient() throws Exception {
+        RegistryConfig registry = new RegistryConfig();
+        registry.setClient("client");
+        assertThat(registry.getClient(), equalTo("client"));
+    }
+
+    @Test
+    public void testTimeout() throws Exception {
+        RegistryConfig registry = new RegistryConfig();
+        registry.setTimeout(10);
+        assertThat(registry.getTimeout(), is(10));
+    }
+
+    @Test
+    public void testSession() throws Exception {
+        RegistryConfig registry = new RegistryConfig();
+        registry.setSession(10);
+        assertThat(registry.getSession(), is(10));
+    }
+
+    @Test
+    public void testDynamic() throws Exception {
+        RegistryConfig registry = new RegistryConfig();
+        registry.setDynamic(true);
+        assertThat(registry.isDynamic(), is(true));
+    }
+
+    @Test
+    public void testRegister() throws Exception {
+        RegistryConfig registry = new RegistryConfig();
+        registry.setRegister(true);
+        assertThat(registry.isRegister(), is(true));
+    }
+
+    @Test
+    public void testSubscribe() throws Exception {
+        RegistryConfig registry = new RegistryConfig();
+        registry.setSubscribe(true);
+        assertThat(registry.isSubscribe(), is(true));
+    }
+
+    @Test
+    public void testCluster() throws Exception {
+        RegistryConfig registry = new RegistryConfig();
+        registry.setCluster("cluster");
+        assertThat(registry.getCluster(), equalTo("cluster"));
+    }
+
+    @Test
+    public void testGroup() throws Exception {
+        RegistryConfig registry = new RegistryConfig();
+        registry.setGroup("group");
+        assertThat(registry.getGroup(), equalTo("group"));
+    }
+
+    @Test
+    public void testVersion() throws Exception {
+        RegistryConfig registry = new RegistryConfig();
+        registry.setVersion("1.0.0");
+        assertThat(registry.getVersion(), equalTo("1.0.0"));
+    }
+
+    @Test
+    public void testParameters() throws Exception {
+        RegistryConfig registry = new RegistryConfig();
+        registry.setParameters(Collections.singletonMap("k1", "v1"));
+        assertThat(registry.getParameters(), hasEntry("k1", "v1"));
+        Map<String, String> parameters = new HashMap<String, String>();
+        RegistryConfig.appendParameters(parameters, registry);
+        assertThat(parameters, hasEntry("k1", "v1"));
+    }
+
+    @Test
+    public void testDefault() throws Exception {
+        RegistryConfig registry = new RegistryConfig();
+        registry.setDefault(true);
+        assertThat(registry.isDefault(), is(true));
+    }
+}
diff --git 
a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/ServiceConfigTest.java
 
b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/ServiceConfigTest.java
new file mode 100644
index 0000000000..d0eb6bc8d0
--- /dev/null
+++ 
b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/ServiceConfigTest.java
@@ -0,0 +1,186 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.alibaba.dubbo.config;
+
+import com.alibaba.dubbo.common.Constants;
+import com.alibaba.dubbo.common.URL;
+import com.alibaba.dubbo.config.api.DemoService;
+import com.alibaba.dubbo.config.api.Greeting;
+import com.alibaba.dubbo.config.provider.impl.DemoServiceImpl;
+import com.alibaba.dubbo.config.mock.MockProtocol2;
+import com.alibaba.dubbo.config.mock.MockRegistryFactory2;
+import com.alibaba.dubbo.registry.Registry;
+import com.alibaba.dubbo.rpc.Exporter;
+import com.alibaba.dubbo.rpc.Invoker;
+import com.alibaba.dubbo.rpc.Protocol;
+import com.alibaba.dubbo.rpc.service.GenericService;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.mockito.Mockito;
+
+import java.util.Collections;
+
+import static com.alibaba.dubbo.common.Constants.GENERIC_SERIALIZATION_BEAN;
+import static com.alibaba.dubbo.common.Constants.GENERIC_SERIALIZATION_DEFAULT;
+import static 
com.alibaba.dubbo.common.Constants.GENERIC_SERIALIZATION_NATIVE_JAVA;
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.Matchers.hasEntry;
+import static org.hamcrest.Matchers.hasKey;
+import static org.hamcrest.Matchers.hasSize;
+import static org.junit.Assert.assertThat;
+import static org.mockito.Mockito.withSettings;
+
+public class ServiceConfigTest {
+    private Protocol protocolDelegate = Mockito.mock(Protocol.class);
+    private Registry registryDelegate = Mockito.mock(Registry.class);
+    private Exporter exporter = Mockito.mock(Exporter.class);
+    private ServiceConfig<DemoServiceImpl> service = new 
ServiceConfig<DemoServiceImpl>();
+
+
+    @Before
+    public void setUp() throws Exception {
+        MockProtocol2.delegate = protocolDelegate;
+        MockRegistryFactory2.registry = registryDelegate;
+        
Mockito.when(protocolDelegate.export(Mockito.any(Invoker.class))).thenReturn(exporter);
+
+        ApplicationConfig app = new ApplicationConfig("app");
+
+        ProtocolConfig protocolConfig = new ProtocolConfig();
+        protocolConfig.setName("mockprotocol2");
+
+        ProviderConfig provider = new ProviderConfig();
+        provider.setExport(true);
+        provider.setProtocol(protocolConfig);
+
+        RegistryConfig registry = new RegistryConfig();
+        registry.setProtocol("mockprotocol2");
+
+        ArgumentConfig argument = new ArgumentConfig();
+        argument.setIndex(0);
+        argument.setCallback(false);
+
+        MethodConfig method = new MethodConfig();
+        method.setName("echo");
+        method.setArguments(Collections.singletonList(argument));
+
+        service.setProvider(provider);
+        service.setApplication(app);
+        service.setRegistry(registry);
+        service.setInterface(DemoService.class);
+        service.setRef(new DemoServiceImpl());
+        service.setMethods(Collections.singletonList(method));
+    }
+
+    @Test
+    public void testExport() throws Exception {
+        service.export();
+
+        assertThat(service.getExportedUrls(), hasSize(1));
+        URL url = service.toUrl();
+        assertThat(url.getProtocol(), equalTo("mockprotocol2"));
+        assertThat(url.getPath(), equalTo(DemoService.class.getName()));
+        assertThat(url.getParameters(), hasEntry(Constants.ANYHOST_KEY, 
"true"));
+        assertThat(url.getParameters(), hasEntry(Constants.APPLICATION_KEY, 
"app"));
+        assertThat(url.getParameters(), hasKey(Constants.BIND_IP_KEY));
+        assertThat(url.getParameters(), hasKey(Constants.BIND_PORT_KEY));
+        assertThat(url.getParameters(), hasEntry(Constants.DEFAULT_KEY + "." + 
Constants.EXPORT_KEY, "true"));
+        assertThat(url.getParameters(), hasEntry(Constants.EXPORT_KEY, 
"true"));
+        assertThat(url.getParameters(), hasEntry("echo.0.callback", "false"));
+        assertThat(url.getParameters(), hasEntry(Constants.GENERIC_KEY, 
"false"));
+        assertThat(url.getParameters(), hasEntry(Constants.INTERFACE_KEY, 
DemoService.class.getName()));
+        assertThat(url.getParameters(), hasKey(Constants.METHODS_KEY));
+        assertThat(url.getParameters().get(Constants.METHODS_KEY), 
containsString("echo"));
+        assertThat(url.getParameters(), hasEntry(Constants.SIDE_KEY, 
Constants.PROVIDER));
+        Mockito.verify(protocolDelegate).export(Mockito.any(Invoker.class));
+    }
+
+    @Test
+    @Ignore("cannot pass in travis")
+    public void testUnexport() throws Exception {
+        System.setProperty(Constants.SHUTDOWN_WAIT_KEY, "0");
+        try {
+            service.export();
+            service.unexport();
+            Thread.sleep(1000);
+            Mockito.verify(exporter, Mockito.atLeastOnce()).unexport();
+        } finally {
+            System.clearProperty(Constants.SHUTDOWN_TIMEOUT_KEY);
+        }
+    }
+
+    @Test
+    public void testInterfaceClass() throws Exception {
+        ServiceConfig<Greeting> service = new ServiceConfig<Greeting>();
+        service.setInterface(Greeting.class.getName());
+        service.setRef(Mockito.mock(Greeting.class));
+        assertThat(service.getInterfaceClass() == Greeting.class, is(true));
+        service = new ServiceConfig<Greeting>();
+        service.setRef(Mockito.mock(Greeting.class, 
withSettings().extraInterfaces(GenericService.class)));
+        assertThat(service.getInterfaceClass() == GenericService.class, 
is(true));
+    }
+
+    @Test(expected = IllegalStateException.class)
+    public void testInterface1() throws Exception {
+        ServiceConfig<DemoService> service = new ServiceConfig<DemoService>();
+        service.setInterface(DemoServiceImpl.class);
+    }
+
+    @Test
+    public void testInterface2() throws Exception {
+        ServiceConfig<DemoService> service = new ServiceConfig<DemoService>();
+        service.setInterface(DemoService.class);
+        assertThat(service.getInterface(), 
equalTo(DemoService.class.getName()));
+    }
+
+    @Test
+    public void testProvider() throws Exception {
+        ServiceConfig service = new ServiceConfig();
+        ProviderConfig provider = new ProviderConfig();
+        service.setProvider(provider);
+        assertThat(service.getProvider(), is(provider));
+    }
+
+    @Test
+    public void testGeneric1() throws Exception {
+        ServiceConfig service = new ServiceConfig();
+        service.setGeneric(GENERIC_SERIALIZATION_DEFAULT);
+        assertThat(service.getGeneric(), 
equalTo(GENERIC_SERIALIZATION_DEFAULT));
+        service.setGeneric(GENERIC_SERIALIZATION_NATIVE_JAVA);
+        assertThat(service.getGeneric(), 
equalTo(GENERIC_SERIALIZATION_NATIVE_JAVA));
+        service.setGeneric(GENERIC_SERIALIZATION_BEAN);
+        assertThat(service.getGeneric(), equalTo(GENERIC_SERIALIZATION_BEAN));
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void testGeneric2() throws Exception {
+        ServiceConfig service = new ServiceConfig();
+        service.setGeneric("illegal");
+    }
+
+    @Test
+    public void testUniqueServiceName() throws Exception {
+        ServiceConfig<Greeting> service = new ServiceConfig<Greeting>();
+        service.setGroup("dubbo");
+        service.setInterface(Greeting.class);
+        service.setVersion("1.0.0");
+        assertThat(service.getUniqueServiceName(), equalTo("dubbo/" + 
Greeting.class.getName() + ":1.0.0"));
+    }
+}
diff --git 
a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/Greeting.java
 
b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/api/Greeting.java
similarity index 87%
rename from 
dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/Greeting.java
rename to 
dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/api/Greeting.java
index 65ab0f3b52..0ceca89d9f 100644
--- 
a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/Greeting.java
+++ 
b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/api/Greeting.java
@@ -6,7 +6,7 @@
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
  *
- *     http://www.apache.org/licenses/LICENSE-2.0
+ *      http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
@@ -14,11 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.alibaba.dubbo.config;
+package com.alibaba.dubbo.config.api;
 
 import com.alibaba.dubbo.common.extension.SPI;
 
 @SPI
-interface Greeting {
+public interface Greeting {
     String hello();
 }
diff --git 
a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/invoker/DelegateProviderMetaDataInvokerTest.java
 
b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/invoker/DelegateProviderMetaDataInvokerTest.java
new file mode 100644
index 0000000000..2e390329a1
--- /dev/null
+++ 
b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/invoker/DelegateProviderMetaDataInvokerTest.java
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.alibaba.dubbo.config.invoker;
+
+import com.alibaba.dubbo.config.api.Greeting;
+import com.alibaba.dubbo.config.ServiceConfig;
+import com.alibaba.dubbo.rpc.Invocation;
+import com.alibaba.dubbo.rpc.Invoker;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mockito;
+
+import static org.hamcrest.Matchers.sameInstance;
+import static org.junit.Assert.assertThat;
+
+public class DelegateProviderMetaDataInvokerTest {
+    private ServiceConfig service;
+    private Invoker<Greeting> invoker;
+
+    @Before
+    public void setUp() throws Exception {
+        service = Mockito.mock(ServiceConfig.class);
+        invoker = Mockito.mock(Invoker.class);
+    }
+
+    @Test
+    public void testDelegate() throws Exception {
+        DelegateProviderMetaDataInvoker<Greeting> delegate =
+                new DelegateProviderMetaDataInvoker<Greeting>(invoker, 
service);
+        delegate.getInterface();
+        Mockito.verify(invoker).getInterface();
+        delegate.getUrl();
+        Mockito.verify(invoker).getUrl();
+        delegate.isAvailable();
+        Mockito.verify(invoker).isAvailable();
+        Invocation invocation = Mockito.mock(Invocation.class);
+        delegate.invoke(invocation);
+        Mockito.verify(invoker).invoke(invocation);
+        delegate.destroy();
+        Mockito.verify(invoker).destroy();
+        assertThat(delegate.getMetadata(), sameInstance(service));
+    }
+
+}
diff --git 
a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/GreetingLocal1.java
 
b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/mock/GreetingLocal1.java
similarity index 86%
rename from 
dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/GreetingLocal1.java
rename to 
dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/mock/GreetingLocal1.java
index 0bcfe0634e..9c024b0c1a 100644
--- 
a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/GreetingLocal1.java
+++ 
b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/mock/GreetingLocal1.java
@@ -6,7 +6,7 @@
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
  *
- *     http://www.apache.org/licenses/LICENSE-2.0
+ *      http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
@@ -14,8 +14,8 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.alibaba.dubbo.config;
+package com.alibaba.dubbo.config.mock;
 
-class GreetingLocal1 {
+public class GreetingLocal1 {
 
 }
diff --git 
a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/GreetingLocal2.java
 
b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/mock/GreetingLocal2.java
similarity index 81%
rename from 
dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/GreetingLocal2.java
rename to 
dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/mock/GreetingLocal2.java
index 768ac7870c..a3ed63d030 100644
--- 
a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/GreetingLocal2.java
+++ 
b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/mock/GreetingLocal2.java
@@ -6,7 +6,7 @@
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
  *
- *     http://www.apache.org/licenses/LICENSE-2.0
+ *      http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
@@ -14,9 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.alibaba.dubbo.config;
+package com.alibaba.dubbo.config.mock;
 
-class GreetingLocal2 implements Greeting {
+import com.alibaba.dubbo.config.api.Greeting;
+
+public class GreetingLocal2 implements Greeting {
     @Override
     public String hello() {
         return "local";
diff --git 
a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/GreetingLocal3.java
 
b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/mock/GreetingLocal3.java
similarity index 83%
rename from 
dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/GreetingLocal3.java
rename to 
dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/mock/GreetingLocal3.java
index 8c041a3998..e6d20220bc 100644
--- 
a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/GreetingLocal3.java
+++ 
b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/mock/GreetingLocal3.java
@@ -6,7 +6,7 @@
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
  *
- *     http://www.apache.org/licenses/LICENSE-2.0
+ *      http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
@@ -14,9 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.alibaba.dubbo.config;
+package com.alibaba.dubbo.config.mock;
 
-class GreetingLocal3 implements Greeting {
+import com.alibaba.dubbo.config.api.Greeting;
+
+public class GreetingLocal3 implements Greeting {
     private Greeting greeting;
 
     public GreetingLocal3(Greeting greeting) {
diff --git 
a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/GreetingMock1.java
 
b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/mock/GreetingMock1.java
similarity index 89%
rename from 
dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/GreetingMock1.java
rename to 
dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/mock/GreetingMock1.java
index edfcc58ec3..b24008ca97 100644
--- 
a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/GreetingMock1.java
+++ 
b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/mock/GreetingMock1.java
@@ -6,7 +6,7 @@
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
  *
- *     http://www.apache.org/licenses/LICENSE-2.0
+ *      http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.alibaba.dubbo.config;
+package com.alibaba.dubbo.config.mock;
 
 public class GreetingMock1 {
 }
diff --git 
a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/GreetingMock2.java
 
b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/mock/GreetingMock2.java
similarity index 86%
rename from 
dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/GreetingMock2.java
rename to 
dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/mock/GreetingMock2.java
index c3d504419a..f296b126d8 100644
--- 
a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/GreetingMock2.java
+++ 
b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/mock/GreetingMock2.java
@@ -6,7 +6,7 @@
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
  *
- *     http://www.apache.org/licenses/LICENSE-2.0
+ *      http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
@@ -14,7 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.alibaba.dubbo.config;
+package com.alibaba.dubbo.config.mock;
+
+import com.alibaba.dubbo.config.api.Greeting;
 
 public class GreetingMock2 implements Greeting {
     private GreetingMock2() {
diff --git 
a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/MockCluster.java
 
b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/mock/MockCluster.java
similarity index 92%
rename from 
dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/MockCluster.java
rename to 
dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/mock/MockCluster.java
index cef8061edf..34553ed61c 100644
--- 
a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/MockCluster.java
+++ 
b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/mock/MockCluster.java
@@ -6,7 +6,7 @@
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
  *
- *     http://www.apache.org/licenses/LICENSE-2.0
+ *      http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.alibaba.dubbo.config;
+package com.alibaba.dubbo.config.mock;
 
 import com.alibaba.dubbo.rpc.Invoker;
 import com.alibaba.dubbo.rpc.RpcException;
diff --git 
a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/MockCodec.java
 
b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/mock/MockCodec.java
similarity index 97%
rename from 
dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/MockCodec.java
rename to 
dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/mock/MockCodec.java
index 51867ae008..a818f4b758 100644
--- 
a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/MockCodec.java
+++ 
b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/mock/MockCodec.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package com.alibaba.dubbo.config;
+package com.alibaba.dubbo.config.mock;
 
 import com.alibaba.dubbo.remoting.Channel;
 import com.alibaba.dubbo.remoting.Codec;
diff --git 
a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/MockDispatcher.java
 
b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/mock/MockDispatcher.java
similarity index 96%
rename from 
dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/MockDispatcher.java
rename to 
dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/mock/MockDispatcher.java
index 7691f31150..7f3f91bc23 100644
--- 
a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/MockDispatcher.java
+++ 
b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/mock/MockDispatcher.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package com.alibaba.dubbo.config;
+package com.alibaba.dubbo.config.mock;
 
 import com.alibaba.dubbo.common.URL;
 import com.alibaba.dubbo.remoting.ChannelHandler;
diff --git 
a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/MockExchanger.java
 
b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/mock/MockExchanger.java
similarity index 97%
rename from 
dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/MockExchanger.java
rename to 
dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/mock/MockExchanger.java
index 32ff0faad6..f4fe17f816 100644
--- 
a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/MockExchanger.java
+++ 
b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/mock/MockExchanger.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package com.alibaba.dubbo.config;
+package com.alibaba.dubbo.config.mock;
 
 import com.alibaba.dubbo.common.URL;
 import com.alibaba.dubbo.remoting.RemotingException;
diff --git 
a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/MockExporterListener.java
 
b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/mock/MockExporterListener.java
similarity index 96%
rename from 
dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/MockExporterListener.java
rename to 
dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/mock/MockExporterListener.java
index f7b26f3dfe..7a56719eca 100644
--- 
a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/MockExporterListener.java
+++ 
b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/mock/MockExporterListener.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package com.alibaba.dubbo.config;
+package com.alibaba.dubbo.config.mock;
 
 import com.alibaba.dubbo.rpc.Exporter;
 import com.alibaba.dubbo.rpc.ExporterListener;
diff --git 
a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/MockFilter.java
 
b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/mock/MockFilter.java
similarity index 92%
rename from 
dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/MockFilter.java
rename to 
dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/mock/MockFilter.java
index 4701590c2d..6a9fbbf15e 100644
--- 
a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/MockFilter.java
+++ 
b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/mock/MockFilter.java
@@ -6,7 +6,7 @@
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
  *
- *     http://www.apache.org/licenses/LICENSE-2.0
+ *      http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.alibaba.dubbo.config;
+package com.alibaba.dubbo.config.mock;
 
 import com.alibaba.dubbo.rpc.Filter;
 import com.alibaba.dubbo.rpc.Invocation;
diff --git 
a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/MockInvokerListener.java
 
b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/mock/MockInvokerListener.java
similarity index 92%
rename from 
dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/MockInvokerListener.java
rename to 
dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/mock/MockInvokerListener.java
index 00f925a032..2c6d065a97 100644
--- 
a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/MockInvokerListener.java
+++ 
b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/mock/MockInvokerListener.java
@@ -6,7 +6,7 @@
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
  *
- *     http://www.apache.org/licenses/LICENSE-2.0
+ *      http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.alibaba.dubbo.config;
+package com.alibaba.dubbo.config.mock;
 
 import com.alibaba.dubbo.rpc.Invoker;
 import com.alibaba.dubbo.rpc.InvokerListener;
diff --git 
a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/MockLoadBalance.java
 
b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/mock/MockLoadBalance.java
similarity index 93%
rename from 
dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/MockLoadBalance.java
rename to 
dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/mock/MockLoadBalance.java
index b6c75738ed..ee7851c034 100644
--- 
a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/MockLoadBalance.java
+++ 
b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/mock/MockLoadBalance.java
@@ -6,7 +6,7 @@
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
  *
- *     http://www.apache.org/licenses/LICENSE-2.0
+ *      http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.alibaba.dubbo.config;
+package com.alibaba.dubbo.config.mock;
 
 import com.alibaba.dubbo.common.URL;
 import com.alibaba.dubbo.rpc.Invocation;
diff --git 
a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/support/MockProtocol.java
 
b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/mock/MockProtocol.java
similarity index 98%
rename from 
dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/support/MockProtocol.java
rename to 
dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/mock/MockProtocol.java
index 83d03b8c85..ea03f94307 100644
--- 
a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/support/MockProtocol.java
+++ 
b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/mock/MockProtocol.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.alibaba.dubbo.config.support;
+package com.alibaba.dubbo.config.mock;
 
 import com.alibaba.dubbo.common.URL;
 import com.alibaba.dubbo.rpc.Exporter;
diff --git 
a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/MockProtocol2.java
 
b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/mock/MockProtocol2.java
similarity index 97%
rename from 
dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/MockProtocol2.java
rename to 
dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/mock/MockProtocol2.java
index be819782a5..d25c428ec1 100644
--- 
a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/MockProtocol2.java
+++ 
b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/mock/MockProtocol2.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package com.alibaba.dubbo.config;
+package com.alibaba.dubbo.config.mock;
 
 import com.alibaba.dubbo.common.URL;
 import com.alibaba.dubbo.rpc.Exporter;
diff --git 
a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/MockProxyFactory.java
 
b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/mock/MockProxyFactory.java
similarity index 93%
rename from 
dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/MockProxyFactory.java
rename to 
dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/mock/MockProxyFactory.java
index f656c58d31..3de2e3a983 100644
--- 
a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/MockProxyFactory.java
+++ 
b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/mock/MockProxyFactory.java
@@ -6,7 +6,7 @@
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
  *
- *     http://www.apache.org/licenses/LICENSE-2.0
+ *      http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.alibaba.dubbo.config;
+package com.alibaba.dubbo.config.mock;
 
 import com.alibaba.dubbo.common.URL;
 import com.alibaba.dubbo.rpc.Invoker;
diff --git 
a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/support/MockRegistry.java
 
b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/mock/MockRegistry.java
similarity index 98%
rename from 
dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/support/MockRegistry.java
rename to 
dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/mock/MockRegistry.java
index deba44a256..4737d20d21 100644
--- 
a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/support/MockRegistry.java
+++ 
b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/mock/MockRegistry.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.alibaba.dubbo.config.support;
+package com.alibaba.dubbo.config.mock;
 
 import com.alibaba.dubbo.common.Constants;
 import com.alibaba.dubbo.common.URL;
diff --git 
a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/support/MockRegistryFactory.java
 
b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/mock/MockRegistryFactory.java
similarity index 96%
rename from 
dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/support/MockRegistryFactory.java
rename to 
dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/mock/MockRegistryFactory.java
index b3b364f087..922fb0f5a6 100644
--- 
a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/support/MockRegistryFactory.java
+++ 
b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/mock/MockRegistryFactory.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.alibaba.dubbo.config.support;
+package com.alibaba.dubbo.config.mock;
 
 import com.alibaba.dubbo.common.URL;
 import com.alibaba.dubbo.registry.Registry;
diff --git 
a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/mock/MockRegistryFactory2.java
 
b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/mock/MockRegistryFactory2.java
new file mode 100644
index 0000000000..9cda53b80d
--- /dev/null
+++ 
b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/mock/MockRegistryFactory2.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.alibaba.dubbo.config.mock;
+
+import com.alibaba.dubbo.common.URL;
+import com.alibaba.dubbo.registry.Registry;
+import com.alibaba.dubbo.registry.RegistryFactory;
+
+public class MockRegistryFactory2 implements RegistryFactory {
+    public static Registry registry;
+
+    @Override
+    public Registry getRegistry(URL url) {
+        return registry;
+    }
+}
diff --git 
a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/MockStatusChecker.java
 
b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/mock/MockStatusChecker.java
similarity index 96%
rename from 
dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/MockStatusChecker.java
rename to 
dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/mock/MockStatusChecker.java
index 29e7751837..c77498a4d5 100644
--- 
a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/MockStatusChecker.java
+++ 
b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/mock/MockStatusChecker.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package com.alibaba.dubbo.config;
+package com.alibaba.dubbo.config.mock;
 
 import com.alibaba.dubbo.common.status.Status;
 import com.alibaba.dubbo.common.status.StatusChecker;
diff --git 
a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/MockTelnetHandler.java
 
b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/mock/MockTelnetHandler.java
similarity index 96%
rename from 
dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/MockTelnetHandler.java
rename to 
dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/mock/MockTelnetHandler.java
index 3c02f8c39d..3f982e845a 100644
--- 
a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/MockTelnetHandler.java
+++ 
b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/mock/MockTelnetHandler.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package com.alibaba.dubbo.config;
+package com.alibaba.dubbo.config.mock;
 
 import com.alibaba.dubbo.remoting.Channel;
 import com.alibaba.dubbo.remoting.RemotingException;
diff --git 
a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/MockThreadPool.java
 
b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/mock/MockThreadPool.java
similarity index 96%
rename from 
dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/MockThreadPool.java
rename to 
dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/mock/MockThreadPool.java
index ec6fc50355..18b2084927 100644
--- 
a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/MockThreadPool.java
+++ 
b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/mock/MockThreadPool.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package com.alibaba.dubbo.config;
+package com.alibaba.dubbo.config.mock;
 
 import com.alibaba.dubbo.common.URL;
 import com.alibaba.dubbo.common.threadpool.ThreadPool;
diff --git 
a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/MockTransporter.java
 
b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/mock/MockTransporter.java
similarity index 85%
rename from 
dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/MockTransporter.java
rename to 
dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/mock/MockTransporter.java
index 749b9095ef..108c40f170 100644
--- 
a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/MockTransporter.java
+++ 
b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/mock/MockTransporter.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package com.alibaba.dubbo.config;
+package com.alibaba.dubbo.config.mock;
 
 import com.alibaba.dubbo.common.URL;
 import com.alibaba.dubbo.remoting.ChannelHandler;
@@ -23,15 +23,19 @@
 import com.alibaba.dubbo.remoting.RemotingException;
 import com.alibaba.dubbo.remoting.Server;
 import com.alibaba.dubbo.remoting.Transporter;
+import org.mockito.Mockito;
 
 public class MockTransporter implements Transporter {
+    private Server server = Mockito.mock(Server.class);
+    private Client client = Mockito.mock(Client.class);
+
     @Override
     public Server bind(URL url, ChannelHandler handler) throws 
RemotingException {
-        return null;
+        return server;
     }
 
     @Override
     public Client connect(URL url, ChannelHandler handler) throws 
RemotingException {
-        return null;
+        return client;
     }
 }
diff --git 
a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/provider/impl/DemoServiceImpl_LongWaiting.java
 
b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/provider/impl/DemoServiceImpl_LongWaiting.java
deleted file mode 100644
index 70ec71bc9c..0000000000
--- 
a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/provider/impl/DemoServiceImpl_LongWaiting.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.alibaba.dubbo.config.provider.impl;
-
-import com.alibaba.dubbo.config.api.Box;
-import com.alibaba.dubbo.config.api.DemoException;
-import com.alibaba.dubbo.config.api.DemoService;
-import com.alibaba.dubbo.config.api.User;
-
-import java.util.List;
-
-/**
- * DemoServiceImpl
- */
-public class DemoServiceImpl_LongWaiting implements DemoService {
-
-    public String sayName(String name) {
-        try {
-            Thread.sleep(100 * 1000);
-        } catch (InterruptedException e) {
-        }
-
-        return "say:" + name;
-    }
-
-    public Box getBox() {
-        return null;
-    }
-
-    public void throwDemoException() throws DemoException {
-        throw new DemoException("LongWaiting");
-    }
-
-    public List<User> getUsers(List<User> users) {
-        return users;
-    }
-
-    public int echo(int i) {
-        return i;
-    }
-
-}
\ No newline at end of file
diff --git 
a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/provider/impl/UnserializableBox.java
 
b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/provider/impl/UnserializableBox.java
deleted file mode 100644
index 9a6437e6f4..0000000000
--- 
a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/provider/impl/UnserializableBox.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.alibaba.dubbo.config.provider.impl;
-
-import com.alibaba.dubbo.config.api.Box;
-
-public class UnserializableBox implements Box {
-    private static final long serialVersionUID = -4141012025649711421L;
-
-    private int count = 3;
-    private String name = "Jerry";
-
-    public int getCount() {
-        return count;
-    }
-
-    public void setCount(int count) {
-        this.count = count;
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    public void setName(String name) {
-        this.name = name;
-    }
-
-    @Override
-    public String toString() {
-        return "Box [count=" + count + ", name=" + name + "]";
-    }
-}
\ No newline at end of file
diff --git 
a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/provider/impl/UnserializableBoxDemoServiceImpl.java
 
b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/provider/impl/UnserializableBoxDemoServiceImpl.java
deleted file mode 100644
index ee93600f96..0000000000
--- 
a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/provider/impl/UnserializableBoxDemoServiceImpl.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.alibaba.dubbo.config.provider.impl;
-
-import com.alibaba.dubbo.config.api.Box;
-import com.alibaba.dubbo.config.api.DemoException;
-import com.alibaba.dubbo.config.api.DemoService;
-import com.alibaba.dubbo.config.api.User;
-
-import java.util.List;
-
-/**
- * DemoServiceImpl
- */
-public class UnserializableBoxDemoServiceImpl implements DemoService {
-
-    public String sayName(String name) {
-        return "say:" + name;
-    }
-
-    public Box getBox() {
-        return new UnserializableBox();
-    }
-
-    public void throwDemoException() throws DemoException {
-        throw new DemoException("Unserializable");
-    }
-
-    public List<User> getUsers(List<User> users) {
-        return users;
-    }
-
-    public int echo(int i) {
-        return i;
-    }
-
-}
\ No newline at end of file
diff --git 
a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/url/test/ExporterSideConfigUrlTest.java
 
b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/url/ExporterSideConfigUrlTest.java
similarity index 96%
rename from 
dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/url/test/ExporterSideConfigUrlTest.java
rename to 
dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/url/ExporterSideConfigUrlTest.java
index 7fbfa4cc72..9df0759fed 100644
--- 
a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/url/test/ExporterSideConfigUrlTest.java
+++ 
b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/url/ExporterSideConfigUrlTest.java
@@ -6,7 +6,7 @@
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
  *
- *     http://www.apache.org/licenses/LICENSE-2.0
+ *      http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.alibaba.dubbo.config.url.test;
+package com.alibaba.dubbo.config.url;
 
 
 import com.alibaba.dubbo.common.logger.Logger;
@@ -37,17 +37,12 @@
     // ======================================================  
     @BeforeClass
     public static void start() {
-
-
     }
 
 
     @Before
     public void setUp() {
-
         initServConf();
-
-        return;
     }
 
     @After()
@@ -56,13 +51,11 @@ public void teardown() {
 
     @Test
     public void exporterMethodConfigUrlTest() {
-
         verifyExporterUrlGeneration(methodConfForService, 
methodConfForServiceTable);
     }
 
     @Test
     public void exporterServiceConfigUrlTest() {
-
         verifyExporterUrlGeneration(servConf, servConfTable);
     }
 
diff --git 
a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/url/test/InvokerSideConfigUrlTest.java
 
b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/url/InvokerSideConfigUrlTest.java
similarity index 98%
rename from 
dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/url/test/InvokerSideConfigUrlTest.java
rename to 
dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/url/InvokerSideConfigUrlTest.java
index e05ae46056..b9bfab24ff 100644
--- 
a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/url/test/InvokerSideConfigUrlTest.java
+++ 
b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/url/InvokerSideConfigUrlTest.java
@@ -6,7 +6,7 @@
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
  *
- *     http://www.apache.org/licenses/LICENSE-2.0
+ *      http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.alibaba.dubbo.config.url.test;
+package com.alibaba.dubbo.config.url;
 
 import com.alibaba.dubbo.common.Constants;
 import com.alibaba.dubbo.common.logger.Logger;
@@ -25,7 +25,7 @@
 import com.alibaba.dubbo.config.ReferenceConfig;
 import com.alibaba.dubbo.config.RegistryConfig;
 import com.alibaba.dubbo.config.api.DemoService;
-import com.alibaba.dubbo.config.support.MockRegistry;
+import com.alibaba.dubbo.config.mock.MockRegistry;
 
 import org.junit.After;
 import org.junit.Before;
@@ -137,23 +137,18 @@
 
     @BeforeClass
     public static void start() {
-
         //RegistryController.startRegistryIfAbsence(1);
     }
 
 
     @Before
     public void setUp() {
-
         initServConf();
         initRefConf();
-
-        return;
     }
 
     @After()
     public void teardown() {
-
         //RegistryServer.reloadCache();
     }
 
@@ -171,9 +166,7 @@ public void refConfUrlTest() {
     @Ignore("parameter on register center will not be merged any longer with 
query parameter request from the consumer")
     @Test
     public void regConfForConsumerUrlTest() {
-
         verifyInvokerUrlGeneration(regConfForConsumer, 
regConfForConsumerTable);
-
     }
 
     // ======================================================
diff --git 
a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/RpcConfigGetSetProxy.java
 
b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/url/RpcConfigGetSetProxy.java
similarity index 97%
rename from 
dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/RpcConfigGetSetProxy.java
rename to 
dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/url/RpcConfigGetSetProxy.java
index d4d5d21628..9d0b6413e5 100644
--- 
a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/RpcConfigGetSetProxy.java
+++ 
b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/url/RpcConfigGetSetProxy.java
@@ -6,7 +6,7 @@
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
  *
- *     http://www.apache.org/licenses/LICENSE-2.0
+ *      http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
@@ -14,10 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.alibaba.dubbo.config;
+package com.alibaba.dubbo.config.url;
 
 import com.alibaba.dubbo.common.logger.Logger;
 import com.alibaba.dubbo.common.logger.LoggerFactory;
+import com.alibaba.dubbo.config.AbstractConfig;
 
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
diff --git 
a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/url/test/UrlTestBase.java
 
b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/url/UrlTestBase.java
similarity index 97%
rename from 
dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/url/test/UrlTestBase.java
rename to 
dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/url/UrlTestBase.java
index 2f1331e835..d9bee91f79 100644
--- 
a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/url/test/UrlTestBase.java
+++ 
b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/url/UrlTestBase.java
@@ -6,7 +6,7 @@
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
  *
- *     http://www.apache.org/licenses/LICENSE-2.0
+ *      http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.alibaba.dubbo.config.url.test;
+package com.alibaba.dubbo.config.url;
 
 
 import com.alibaba.dubbo.common.logger.Logger;
@@ -24,15 +24,14 @@
 import com.alibaba.dubbo.config.ProtocolConfig;
 import com.alibaba.dubbo.config.ProviderConfig;
 import com.alibaba.dubbo.config.RegistryConfig;
-import com.alibaba.dubbo.config.RpcConfigGetSetProxy;
 import com.alibaba.dubbo.config.ServiceConfig;
 import com.alibaba.dubbo.config.api.DemoService;
 import com.alibaba.dubbo.config.provider.impl.DemoServiceImpl;
 
-import org.junit.Assert;
-
 import java.util.Arrays;
 
+import static junit.framework.TestCase.fail;
+
 @SuppressWarnings("unused")
 public class UrlTestBase {
 
@@ -205,7 +204,7 @@ protected void assertUrlStringWithLocalTable(String 
paramStringFromDb,
         }
 
         if (!failLog.equals(FAILLOG_HEADER)) {
-            Assert.fail(failLog);
+            fail(failLog);
         }
     }
 
diff --git 
a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/utils/ReferenceConfigCacheTest.java
 
b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/utils/ReferenceConfigCacheTest.java
index 231d56b1c9..1be5bbc6cf 100644
--- 
a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/utils/ReferenceConfigCacheTest.java
+++ 
b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/utils/ReferenceConfigCacheTest.java
@@ -31,109 +31,60 @@ public void setUp() throws Exception {
     }
 
     @Test
-    public void testGetCache_SameReference() throws Exception {
+    public void testGetCacheSameReference() throws Exception {
         ReferenceConfigCache cache = ReferenceConfigCache.getCache();
-
-        {
-            MockReferenceConfig config = new MockReferenceConfig();
-            config.setInterface("FooService");
-            config.setGroup("group1");
-            config.setVersion("1.0.0");
-
-            String value = cache.get(config);
-            assertTrue(config.isGetMethodRun());
-            assertEquals("0", value);
-        }
-
-        {
-            MockReferenceConfig configCopy = new MockReferenceConfig();
-            configCopy.setInterface("FooService");
-            configCopy.setGroup("group1");
-            configCopy.setVersion("1.0.0");
-
-            String value = cache.get(configCopy);
-            assertFalse(configCopy.isGetMethodRun());
-            assertEquals("0", value);
-        }
+        MockReferenceConfig config = buildMockReferenceConfig("FooService", 
"group1", "1.0.0");
+        String value = cache.get(config);
+        assertTrue(config.isGetMethodRun());
+        assertEquals("0", value);
+
+        MockReferenceConfig configCopy = 
buildMockReferenceConfig("FooService", "group1", "1.0.0");
+        value = cache.get(configCopy);
+        assertFalse(configCopy.isGetMethodRun());
+        assertEquals("0", value);
     }
 
     @Test
-    public void testGetCache_DiffReference() throws Exception {
+    public void testGetCacheDiffReference() throws Exception {
         ReferenceConfigCache cache = ReferenceConfigCache.getCache();
-
-        {
-            MockReferenceConfig config = new MockReferenceConfig();
-            config.setInterface("FooService");
-            config.setGroup("group1");
-            config.setVersion("1.0.0");
-
-            String value = cache.get(config);
-            assertTrue(config.isGetMethodRun());
-            assertEquals("0", value);
-        }
-
-        {
-            MockReferenceConfig configCopy = new MockReferenceConfig();
-            configCopy.setInterface("XxxService");
-            configCopy.setGroup("group1");
-            configCopy.setVersion("1.0.0");
-
-            String value = cache.get(configCopy);
-            assertTrue(configCopy.isGetMethodRun());
-            assertEquals("1", value);
-        }
+        MockReferenceConfig config = buildMockReferenceConfig("FooService", 
"group1", "1.0.0");
+        String value = cache.get(config);
+        assertTrue(config.isGetMethodRun());
+        assertEquals("0", value);
+
+        MockReferenceConfig configCopy = 
buildMockReferenceConfig("XxxService", "group1", "1.0.0");
+        value = cache.get(configCopy);
+        assertTrue(configCopy.isGetMethodRun());
+        assertEquals("1", value);
     }
 
     @Test
-    public void testGetCache_DiffName() throws Exception {
-        {
-            ReferenceConfigCache cache = ReferenceConfigCache.getCache();
-
-            MockReferenceConfig config = new MockReferenceConfig();
-            config.setInterface("FooService");
-            config.setGroup("group1");
-            config.setVersion("1.0.0");
-
-            String value = cache.get(config);
-            assertTrue(config.isGetMethodRun());
-            assertEquals("0", value);
-        }
-        {
-            ReferenceConfigCache cache = ReferenceConfigCache.getCache("foo");
-
-            MockReferenceConfig config = new MockReferenceConfig();
-            config.setInterface("FooService");
-            config.setGroup("group1");
-            config.setVersion("1.0.0");
-
-            String value = cache.get(config);
-            // still init for the same ReferenceConfig if the cache is 
different
-            assertTrue(config.isGetMethodRun());
-            assertEquals("1", value);
-        }
+    public void testGetCacheDiffName() throws Exception {
+        ReferenceConfigCache cache = ReferenceConfigCache.getCache();
+        MockReferenceConfig config = buildMockReferenceConfig("FooService", 
"group1", "1.0.0");
+        String value = cache.get(config);
+        assertTrue(config.isGetMethodRun());
+        assertEquals("0", value);
+
+        cache = ReferenceConfigCache.getCache("foo");
+        config = buildMockReferenceConfig("FooService", "group1", "1.0.0");
+        value = cache.get(config);
+        // still init for the same ReferenceConfig if the cache is different
+        assertTrue(config.isGetMethodRun());
+        assertEquals("1", value);
     }
 
     @Test
     public void testDestroy() throws Exception {
         ReferenceConfigCache cache = ReferenceConfigCache.getCache();
-
-        MockReferenceConfig config = new MockReferenceConfig();
-        config.setInterface("FooService");
-        config.setGroup("group1");
-        config.setVersion("1.0.0");
+        MockReferenceConfig config = buildMockReferenceConfig("FooService", 
"group1", "1.0.0");
         cache.get(config);
-        MockReferenceConfig configCopy = new MockReferenceConfig();
-        configCopy.setInterface("XxxService");
-        configCopy.setGroup("group1");
-        configCopy.setVersion("1.0.0");
+        MockReferenceConfig configCopy = 
buildMockReferenceConfig("XxxService", "group1", "1.0.0");
         cache.get(configCopy);
-
         assertEquals(2, cache.cache.size());
-
         cache.destroy(config);
         assertTrue(config.isDestroyMethodRun());
         assertEquals(1, cache.cache.size());
-
         cache.destroy(configCopy);
         assertTrue(configCopy.isDestroyMethodRun());
         assertEquals(0, cache.cache.size());
@@ -142,23 +93,22 @@ public void testDestroy() throws Exception {
     @Test
     public void testDestroyAll() throws Exception {
         ReferenceConfigCache cache = ReferenceConfigCache.getCache();
-
-        MockReferenceConfig config = new MockReferenceConfig();
-        config.setInterface("FooService");
-        config.setGroup("group1");
-        config.setVersion("1.0.0");
+        MockReferenceConfig config = buildMockReferenceConfig("FooService", 
"group1", "1.0.0");
         cache.get(config);
-        MockReferenceConfig configCopy = new MockReferenceConfig();
-        configCopy.setInterface("XxxService");
-        configCopy.setGroup("group1");
-        configCopy.setVersion("1.0.0");
+        MockReferenceConfig configCopy = 
buildMockReferenceConfig("XxxService", "group1", "1.0.0");
         cache.get(configCopy);
-
         assertEquals(2, cache.cache.size());
-
         cache.destroyAll();
         assertTrue(config.isDestroyMethodRun());
         assertTrue(configCopy.isDestroyMethodRun());
         assertEquals(0, cache.cache.size());
     }
+
+    private MockReferenceConfig buildMockReferenceConfig(String service, 
String group, String version) {
+        MockReferenceConfig config = new MockReferenceConfig();
+        config.setInterface(service);
+        config.setGroup(group);
+        config.setVersion(version);
+        return config;
+    }
 }
diff --git 
a/dubbo-config/dubbo-config-api/src/test/resources/META-INF/services/com.alibaba.dubbo.common.status.StatusChecker
 
b/dubbo-config/dubbo-config-api/src/test/resources/META-INF/services/com.alibaba.dubbo.common.status.StatusChecker
index 14fc47be4c..97ad4faf2b 100644
--- 
a/dubbo-config/dubbo-config-api/src/test/resources/META-INF/services/com.alibaba.dubbo.common.status.StatusChecker
+++ 
b/dubbo-config/dubbo-config-api/src/test/resources/META-INF/services/com.alibaba.dubbo.common.status.StatusChecker
@@ -15,4 +15,4 @@
 # limitations under the License.
 #
 
-mockstatuschecker=com.alibaba.dubbo.config.MockStatusChecker
\ No newline at end of file
+mockstatuschecker=com.alibaba.dubbo.config.mock.MockStatusChecker
\ No newline at end of file
diff --git 
a/dubbo-config/dubbo-config-api/src/test/resources/META-INF/services/com.alibaba.dubbo.common.threadpool.ThreadPool
 
b/dubbo-config/dubbo-config-api/src/test/resources/META-INF/services/com.alibaba.dubbo.common.threadpool.ThreadPool
index 3bfd1aba96..c93baf9327 100644
--- 
a/dubbo-config/dubbo-config-api/src/test/resources/META-INF/services/com.alibaba.dubbo.common.threadpool.ThreadPool
+++ 
b/dubbo-config/dubbo-config-api/src/test/resources/META-INF/services/com.alibaba.dubbo.common.threadpool.ThreadPool
@@ -15,4 +15,4 @@
 # limitations under the License.
 #
 
-mockthreadpool=com.alibaba.dubbo.config.MockThreadPool
\ No newline at end of file
+mockthreadpool=com.alibaba.dubbo.config.mock.MockThreadPool
\ No newline at end of file
diff --git 
a/dubbo-config/dubbo-config-api/src/test/resources/META-INF/services/com.alibaba.dubbo.registry.RegistryFactory
 
b/dubbo-config/dubbo-config-api/src/test/resources/META-INF/services/com.alibaba.dubbo.registry.RegistryFactory
index 6dd0bbd0c1..e03669547b 100644
--- 
a/dubbo-config/dubbo-config-api/src/test/resources/META-INF/services/com.alibaba.dubbo.registry.RegistryFactory
+++ 
b/dubbo-config/dubbo-config-api/src/test/resources/META-INF/services/com.alibaba.dubbo.registry.RegistryFactory
@@ -1 +1,2 @@
-mockregistry=com.alibaba.dubbo.config.support.MockRegistryFactory
+mockregistry=com.alibaba.dubbo.config.mock.MockRegistryFactory
+mockprotocol2=com.alibaba.dubbo.config.mock.MockRegistryFactory2
diff --git 
a/dubbo-config/dubbo-config-api/src/test/resources/META-INF/services/com.alibaba.dubbo.remoting.Codec
 
b/dubbo-config/dubbo-config-api/src/test/resources/META-INF/services/com.alibaba.dubbo.remoting.Codec
index df9bb1531d..26dcb6179b 100644
--- 
a/dubbo-config/dubbo-config-api/src/test/resources/META-INF/services/com.alibaba.dubbo.remoting.Codec
+++ 
b/dubbo-config/dubbo-config-api/src/test/resources/META-INF/services/com.alibaba.dubbo.remoting.Codec
@@ -15,4 +15,4 @@
 # limitations under the License.
 #
 
-mockcodec=com.alibaba.dubbo.config.MockCodec
\ No newline at end of file
+mockcodec=com.alibaba.dubbo.config.mock.MockCodec
\ No newline at end of file
diff --git 
a/dubbo-config/dubbo-config-api/src/test/resources/META-INF/services/com.alibaba.dubbo.remoting.Dispatcher
 
b/dubbo-config/dubbo-config-api/src/test/resources/META-INF/services/com.alibaba.dubbo.remoting.Dispatcher
index 1b6be40d9c..40c3bf732f 100644
--- 
a/dubbo-config/dubbo-config-api/src/test/resources/META-INF/services/com.alibaba.dubbo.remoting.Dispatcher
+++ 
b/dubbo-config/dubbo-config-api/src/test/resources/META-INF/services/com.alibaba.dubbo.remoting.Dispatcher
@@ -15,4 +15,4 @@
 # limitations under the License.
 #
 
-mockdispatcher=com.alibaba.dubbo.config.MockDispatcher
\ No newline at end of file
+mockdispatcher=com.alibaba.dubbo.config.mock.MockDispatcher
\ No newline at end of file
diff --git 
a/dubbo-config/dubbo-config-api/src/test/resources/META-INF/services/com.alibaba.dubbo.remoting.Transporter
 
b/dubbo-config/dubbo-config-api/src/test/resources/META-INF/services/com.alibaba.dubbo.remoting.Transporter
index d17c784753..8928497c31 100644
--- 
a/dubbo-config/dubbo-config-api/src/test/resources/META-INF/services/com.alibaba.dubbo.remoting.Transporter
+++ 
b/dubbo-config/dubbo-config-api/src/test/resources/META-INF/services/com.alibaba.dubbo.remoting.Transporter
@@ -15,4 +15,4 @@
 # limitations under the License.
 #
 
-mocktransporter=com.alibaba.dubbo.config.MockTransporter
\ No newline at end of file
+mocktransporter=com.alibaba.dubbo.config.mock.MockTransporter
\ No newline at end of file
diff --git 
a/dubbo-config/dubbo-config-api/src/test/resources/META-INF/services/com.alibaba.dubbo.remoting.exchange.Exchanger
 
b/dubbo-config/dubbo-config-api/src/test/resources/META-INF/services/com.alibaba.dubbo.remoting.exchange.Exchanger
index 3a8ecb9484..57281fbea6 100644
--- 
a/dubbo-config/dubbo-config-api/src/test/resources/META-INF/services/com.alibaba.dubbo.remoting.exchange.Exchanger
+++ 
b/dubbo-config/dubbo-config-api/src/test/resources/META-INF/services/com.alibaba.dubbo.remoting.exchange.Exchanger
@@ -15,4 +15,4 @@
 # limitations under the License.
 #
 
-mockexchanger=com.alibaba.dubbo.config.MockExchanger
\ No newline at end of file
+mockexchanger=com.alibaba.dubbo.config.mock.MockExchanger
\ No newline at end of file
diff --git 
a/dubbo-config/dubbo-config-api/src/test/resources/META-INF/services/com.alibaba.dubbo.remoting.telnet.TelnetHandler
 
b/dubbo-config/dubbo-config-api/src/test/resources/META-INF/services/com.alibaba.dubbo.remoting.telnet.TelnetHandler
index 28104b4bcf..5b021778ac 100644
--- 
a/dubbo-config/dubbo-config-api/src/test/resources/META-INF/services/com.alibaba.dubbo.remoting.telnet.TelnetHandler
+++ 
b/dubbo-config/dubbo-config-api/src/test/resources/META-INF/services/com.alibaba.dubbo.remoting.telnet.TelnetHandler
@@ -14,5 +14,5 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
-mocktelnethandler=com.alibaba.dubbo.config.MockTelnetHandler
+mocktelnethandler=com.alibaba.dubbo.config.mock.MockTelnetHandler
 
diff --git 
a/dubbo-config/dubbo-config-api/src/test/resources/META-INF/services/com.alibaba.dubbo.rpc.ExporterListener
 
b/dubbo-config/dubbo-config-api/src/test/resources/META-INF/services/com.alibaba.dubbo.rpc.ExporterListener
index f24c7089f7..6d072faffc 100644
--- 
a/dubbo-config/dubbo-config-api/src/test/resources/META-INF/services/com.alibaba.dubbo.rpc.ExporterListener
+++ 
b/dubbo-config/dubbo-config-api/src/test/resources/META-INF/services/com.alibaba.dubbo.rpc.ExporterListener
@@ -15,4 +15,4 @@
 # limitations under the License.
 #
 
-mockexporterlistener=com.alibaba.dubbo.config.MockExporterListener
\ No newline at end of file
+mockexporterlistener=com.alibaba.dubbo.config.mock.MockExporterListener
\ No newline at end of file
diff --git 
a/dubbo-config/dubbo-config-api/src/test/resources/META-INF/services/com.alibaba.dubbo.rpc.Filter
 
b/dubbo-config/dubbo-config-api/src/test/resources/META-INF/services/com.alibaba.dubbo.rpc.Filter
index 3ad1d56bec..f39afb6131 100644
--- 
a/dubbo-config/dubbo-config-api/src/test/resources/META-INF/services/com.alibaba.dubbo.rpc.Filter
+++ 
b/dubbo-config/dubbo-config-api/src/test/resources/META-INF/services/com.alibaba.dubbo.rpc.Filter
@@ -1 +1 @@
-mockfilter=com.alibaba.dubbo.config.MockFilter
\ No newline at end of file
+mockfilter=com.alibaba.dubbo.config.mock.MockFilter
\ No newline at end of file
diff --git 
a/dubbo-config/dubbo-config-api/src/test/resources/META-INF/services/com.alibaba.dubbo.rpc.InvokerListener
 
b/dubbo-config/dubbo-config-api/src/test/resources/META-INF/services/com.alibaba.dubbo.rpc.InvokerListener
index 00616035a9..b8d6724427 100644
--- 
a/dubbo-config/dubbo-config-api/src/test/resources/META-INF/services/com.alibaba.dubbo.rpc.InvokerListener
+++ 
b/dubbo-config/dubbo-config-api/src/test/resources/META-INF/services/com.alibaba.dubbo.rpc.InvokerListener
@@ -1 +1 @@
-mockinvokerlistener=com.alibaba.dubbo.config.MockInvokerListener
\ No newline at end of file
+mockinvokerlistener=com.alibaba.dubbo.config.mock.MockInvokerListener
\ No newline at end of file
diff --git 
a/dubbo-config/dubbo-config-api/src/test/resources/META-INF/services/com.alibaba.dubbo.rpc.Protocol
 
b/dubbo-config/dubbo-config-api/src/test/resources/META-INF/services/com.alibaba.dubbo.rpc.Protocol
index 30b82bf3a3..2cb5bdb2b0 100644
--- 
a/dubbo-config/dubbo-config-api/src/test/resources/META-INF/services/com.alibaba.dubbo.rpc.Protocol
+++ 
b/dubbo-config/dubbo-config-api/src/test/resources/META-INF/services/com.alibaba.dubbo.rpc.Protocol
@@ -1,2 +1,2 @@
-mockprotocol=com.alibaba.dubbo.config.support.MockProtocol
-mockprotocol2=com.alibaba.dubbo.config.MockProtocol2
\ No newline at end of file
+mockprotocol=com.alibaba.dubbo.config.mock.MockProtocol
+mockprotocol2=com.alibaba.dubbo.config.mock.MockProtocol2
\ No newline at end of file
diff --git 
a/dubbo-config/dubbo-config-api/src/test/resources/META-INF/services/com.alibaba.dubbo.rpc.ProxyFactory
 
b/dubbo-config/dubbo-config-api/src/test/resources/META-INF/services/com.alibaba.dubbo.rpc.ProxyFactory
index 370be716cb..0ae5c21f89 100644
--- 
a/dubbo-config/dubbo-config-api/src/test/resources/META-INF/services/com.alibaba.dubbo.rpc.ProxyFactory
+++ 
b/dubbo-config/dubbo-config-api/src/test/resources/META-INF/services/com.alibaba.dubbo.rpc.ProxyFactory
@@ -1 +1 @@
-mockproxyfactory=com.alibaba.dubbo.config.MockProxyFactory
\ No newline at end of file
+mockproxyfactory=com.alibaba.dubbo.config.mock.MockProxyFactory
\ No newline at end of file
diff --git 
a/dubbo-config/dubbo-config-api/src/test/resources/META-INF/services/com.alibaba.dubbo.rpc.cluster.Cluster
 
b/dubbo-config/dubbo-config-api/src/test/resources/META-INF/services/com.alibaba.dubbo.rpc.cluster.Cluster
index 9ef684e92d..04e227cfa8 100644
--- 
a/dubbo-config/dubbo-config-api/src/test/resources/META-INF/services/com.alibaba.dubbo.rpc.cluster.Cluster
+++ 
b/dubbo-config/dubbo-config-api/src/test/resources/META-INF/services/com.alibaba.dubbo.rpc.cluster.Cluster
@@ -1 +1 @@
-mockcluster=com.alibaba.dubbo.config.MockCluster
\ No newline at end of file
+mockcluster=com.alibaba.dubbo.config.mock.MockCluster
\ No newline at end of file
diff --git 
a/dubbo-config/dubbo-config-api/src/test/resources/META-INF/services/com.alibaba.dubbo.rpc.cluster.LoadBalance
 
b/dubbo-config/dubbo-config-api/src/test/resources/META-INF/services/com.alibaba.dubbo.rpc.cluster.LoadBalance
index 427ec50184..65c98e2cef 100644
--- 
a/dubbo-config/dubbo-config-api/src/test/resources/META-INF/services/com.alibaba.dubbo.rpc.cluster.LoadBalance
+++ 
b/dubbo-config/dubbo-config-api/src/test/resources/META-INF/services/com.alibaba.dubbo.rpc.cluster.LoadBalance
@@ -1 +1 @@
-mockloadbalance=com.alibaba.dubbo.config.MockLoadBalance
\ No newline at end of file
+mockloadbalance=com.alibaba.dubbo.config.mock.MockLoadBalance
\ No newline at end of file


 

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@dubbo.apache.org
For additional commands, e-mail: notifications-h...@dubbo.apache.org

Reply via email to