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 7cd83f0b28d..5366b909109 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 94578b2cfd4..f34c31ffbe3 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 43f3621e287..c9d904622ec 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/ServiceConfigTest.java b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/ServiceConfigTest.java index 632cbd18eae..d0eb6bc8d0c 100644 --- 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 @@ -20,7 +20,10 @@ 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; @@ -55,7 +58,7 @@ public class ServiceConfigTest { @Before public void setUp() throws Exception { MockProtocol2.delegate = protocolDelegate; - MockRegistryFactory.registry = registryDelegate; + MockRegistryFactory2.registry = registryDelegate; Mockito.when(protocolDelegate.export(Mockito.any(Invoker.class))).thenReturn(exporter); ApplicationConfig app = new ApplicationConfig("app"); 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 65ab0f3b522..0ceca89d9fa 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 00000000000..2e390329a1c --- /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 invoker; + + @Before + public void setUp() throws Exception { + service = Mockito.mock(ServiceConfig.class); + invoker = Mockito.mock(Invoker.class); + } + + @Test + public void testDelegate() throws Exception { + DelegateProviderMetaDataInvoker delegate = + new DelegateProviderMetaDataInvoker(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 0bcfe0634e1..9c024b0c1a4 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 768ac7870ce..a3ed63d030c 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 8c041a39980..e6d20220bc4 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 edfcc58ec32..b24008ca97d 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 c3d504419a9..f296b126d86 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 cef8061edfe..34553ed61ca 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 51867ae008b..a818f4b7586 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 7691f31150d..7f3f91bc23d 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 32ff0faad66..f4fe17f8168 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 f7b26f3dfe5..7a56719eca6 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 4701590c2d3..6a9fbbf15ef 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 00f925a032b..2c6d065a976 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 b6c75738ed1..ee7851c034c 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 83d03b8c85d..ea03f943070 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 be819782a51..d25c428ec18 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 f656c58d314..3de2e3a9833 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 deba44a2561..4737d20d21e 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 b3b364f0872..922fb0f5a65 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/MockRegistryFactory.java b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/mock/MockRegistryFactory2.java similarity index 91% rename from dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/MockRegistryFactory.java rename to dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/mock/MockRegistryFactory2.java index 1534d30f23e..9cda53b80d6 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/MockRegistryFactory.java +++ b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/mock/MockRegistryFactory2.java @@ -15,13 +15,13 @@ * 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.registry.Registry; import com.alibaba.dubbo.registry.RegistryFactory; -public class MockRegistryFactory implements RegistryFactory { +public class MockRegistryFactory2 implements RegistryFactory { public static Registry registry; @Override 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 29e77518377..c77498a4d5c 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 3c02f8c39d0..3f982e845a4 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 ec6fc50355d..18b2084927c 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 97% 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 0651c2a1cbe..108c40f170e 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; 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 70ec71bc9c8..00000000000 --- 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 getUsers(List 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 9a6437e6f40..00000000000 --- 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 ee93600f966..00000000000 --- 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 getUsers(List 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 7fbfa4cc722..9df0759fede 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 @@ public class ExporterSideConfigUrlTest extends UrlTestBase { // ====================================================== @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 e05ae460566..b9bfab24ffb 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 @@ public class InvokerSideConfigUrlTest extends UrlTestBase { @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 d4d5d21628b..9d0b6413e5e 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 2f1331e835c..d9bee91f799 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 231d56b1c98..1be5bbc6cf0 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 14fc47be4ce..97ad4faf2ba 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 3bfd1aba965..c93baf9327c 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 970c6c7735e..e03669547b2 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,2 +1,2 @@ -mockregistry=com.alibaba.dubbo.config.support.MockRegistryFactory -mockprotocol2=com.alibaba.dubbo.config.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 df9bb1531d0..26dcb6179b9 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 1b6be40d9cf..40c3bf732fa 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 d17c7847536..8928497c315 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 3a8ecb9484f..57281fbea6b 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 28104b4bcf0..5b021778ac7 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 f24c7089f7d..6d072faffc3 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 3ad1d56bec5..f39afb61314 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 00616035a96..b8d6724427f 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 30b82bf3a3e..2cb5bdb2b0d 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 370be716cb5..0ae5c21f89f 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 9ef684e92d5..04e227cfa81 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 427ec50184f..65c98e2cef8 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