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

albumenj pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo-samples.git


The following commit(s) were added to refs/heads/master by this push:
     new 94c1eb15 Add test cases to verify apache/dubbo#12376 (#853)
94c1eb15 is described below

commit 94c1eb15df6143ffb469a4ca441f12975f224163
Author: Albumen Kevin <[email protected]>
AuthorDate: Sun Jul 2 09:37:18 2023 +0800

    Add test cases to verify apache/dubbo#12376 (#853)
    
    * Add test cases to verify apache/dubbo#12376
    
    * enhance test cases
    
    * Set interface mode
    
    * Update case-versions.conf
    
    * Fix test case
---
 .../case-configuration.yml                         | 23 ++++++
 .../dubbo-samples-test-12376/case-versions.conf    | 24 ++++++
 99-integration/dubbo-samples-test-12376/pom.xml    | 84 +++++++++++++++++++
 .../apache/dubbo/samples/api/BackendService.java   | 24 ++++++
 .../apache/dubbo/samples/api/GreetingsService.java | 24 ++++++
 .../org/apache/dubbo/samples/api/HelloService.java | 24 ++++++
 .../org/apache/dubbo/samples/api/QosService.java   | 21 +++++
 .../samples/filter/ConsumerAlibabaFilter.java      | 56 +++++++++++++
 .../samples/filter/ConsumerClusterFilter.java      | 56 +++++++++++++
 .../dubbo/samples/filter/ConsumerFilter.java       | 56 +++++++++++++
 .../samples/filter/ProviderAlibabaFilter.java      | 56 +++++++++++++
 .../dubbo/samples/filter/ProviderFilter.java       | 56 +++++++++++++
 .../samples/loadbalance/AlibabaLoadBalance.java    | 42 ++++++++++
 .../samples/loadbalance/ApacheLoadBalance.java     | 41 ++++++++++
 .../apache/dubbo/samples/provider/Application.java | 94 ++++++++++++++++++++++
 .../dubbo/samples/provider/BackendServiceImpl.java | 26 ++++++
 .../samples/provider/GreetingsServiceImpl.java     | 34 ++++++++
 .../dubbo/samples/provider/HelloServiceImpl.java   | 33 ++++++++
 .../dubbo/samples/provider/QosServiceImpl.java     | 50 ++++++++++++
 .../apache/dubbo/samples/router/AlibabaRouter.java | 57 +++++++++++++
 .../dubbo/samples/router/AlibabaRouterFactory.java | 31 +++++++
 .../apache/dubbo/samples/router/ApacheRouter.java  | 66 +++++++++++++++
 .../dubbo/samples/router/ApacheRouterFactory.java  | 30 +++++++
 .../dubbo/samples/router/ApacheStateRouter.java    | 53 ++++++++++++
 .../samples/router/ApacheStateRouterFactory.java   | 30 +++++++
 .../META-INF/dubbo/com.alibaba.dubbo.rpc.Filter    |  2 +
 .../com.alibaba.dubbo.rpc.cluster.LoadBalance      |  2 +
 .../com.alibaba.dubbo.rpc.cluster.RouterFactory    |  1 +
 .../META-INF/dubbo/org.apache.dubbo.rpc.Filter     |  2 +
 .../org.apache.dubbo.rpc.cluster.RouterFactory     |  1 +
 ...g.apache.dubbo.rpc.cluster.filter.ClusterFilter |  1 +
 ...bbo.rpc.cluster.router.state.StateRouterFactory |  1 +
 .../src/main/resources/log4j.properties            | 25 ++++++
 .../dubbo/samples/client/GreetingServiceIT.java    | 84 +++++++++++++++++++
 99-integration/pom.xml                             |  1 +
 35 files changed, 1211 insertions(+)

diff --git a/99-integration/dubbo-samples-test-12376/case-configuration.yml 
b/99-integration/dubbo-samples-test-12376/case-configuration.yml
new file mode 100644
index 00000000..64c2161d
--- /dev/null
+++ b/99-integration/dubbo-samples-test-12376/case-configuration.yml
@@ -0,0 +1,23 @@
+# 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.
+
+from: app-external-zookeeper.yml
+
+props:
+  project_name: dubbo-samples-test-12376
+  main_class: org.apache.dubbo.samples.provider.Application
+  dubbo_port: 20881
+  check_log: "DubboBootstrap awaiting ..."
diff --git a/99-integration/dubbo-samples-test-12376/case-versions.conf 
b/99-integration/dubbo-samples-test-12376/case-versions.conf
new file mode 100644
index 00000000..0ad1517e
--- /dev/null
+++ b/99-integration/dubbo-samples-test-12376/case-versions.conf
@@ -0,0 +1,24 @@
+#
+#
+#   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.
+#
+
+
+# Supported component versions of the test case
+
+# Spring app
+dubbo.version= [ >= 3.2.0 ]
+java.version= [ >= 8 ]
diff --git a/99-integration/dubbo-samples-test-12376/pom.xml 
b/99-integration/dubbo-samples-test-12376/pom.xml
new file mode 100644
index 00000000..d49208e4
--- /dev/null
+++ b/99-integration/dubbo-samples-test-12376/pom.xml
@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0";
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+    <parent>
+        <groupId>org.apache</groupId>
+        <artifactId>apache</artifactId>
+        <version>23</version>
+        <relativePath/>
+    </parent>
+
+    <groupId>org.apache.dubbo</groupId>
+    <version>1.0-SNAPSHOT</version>
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>dubbo-samples-test-12376</artifactId>
+    <name>Dubbo Samples Test For Issue 12376</name>
+    <description>Dubbo Samples Test For Issue 12376</description>
+
+    <properties>
+        <dubbo.version>3.2.0</dubbo.version>
+        <junit5.version>5.9.2</junit5.version>
+        <maven.compiler.source>1.8</maven.compiler.source>
+        <maven.compiler.target>1.8</maven.compiler.target>
+        <awaitility.version>4.2.0</awaitility.version>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.dubbo</groupId>
+            <artifactId>dubbo</artifactId>
+            <version>${dubbo.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.dubbo</groupId>
+            <artifactId>dubbo-dependencies-zookeeper-curator5</artifactId>
+            <version>${dubbo.version}</version>
+            <type>pom</type>
+        </dependency>
+
+        <dependency>
+            <groupId>org.junit.jupiter</groupId>
+            <artifactId>junit-jupiter-engine</artifactId>
+            <version>${junit5.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.junit.jupiter</groupId>
+            <artifactId>junit-jupiter-api</artifactId>
+            <version>${junit5.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.junit.jupiter</groupId>
+            <artifactId>junit-jupiter-params</artifactId>
+            <version>${junit5.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.awaitility</groupId>
+            <artifactId>awaitility</artifactId>
+            <version>${awaitility.version}</version>
+        </dependency>
+    </dependencies>
+</project>
diff --git 
a/99-integration/dubbo-samples-test-12376/src/main/java/org/apache/dubbo/samples/api/BackendService.java
 
b/99-integration/dubbo-samples-test-12376/src/main/java/org/apache/dubbo/samples/api/BackendService.java
new file mode 100644
index 00000000..c557cdda
--- /dev/null
+++ 
b/99-integration/dubbo-samples-test-12376/src/main/java/org/apache/dubbo/samples/api/BackendService.java
@@ -0,0 +1,24 @@
+/*
+ * 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 org.apache.dubbo.samples.api;
+
+public interface BackendService {
+
+    String sayHi(String name);
+
+}
diff --git 
a/99-integration/dubbo-samples-test-12376/src/main/java/org/apache/dubbo/samples/api/GreetingsService.java
 
b/99-integration/dubbo-samples-test-12376/src/main/java/org/apache/dubbo/samples/api/GreetingsService.java
new file mode 100644
index 00000000..06e28773
--- /dev/null
+++ 
b/99-integration/dubbo-samples-test-12376/src/main/java/org/apache/dubbo/samples/api/GreetingsService.java
@@ -0,0 +1,24 @@
+/*
+ * 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 org.apache.dubbo.samples.api;
+
+public interface GreetingsService {
+
+    String sayHi(String name);
+
+}
diff --git 
a/99-integration/dubbo-samples-test-12376/src/main/java/org/apache/dubbo/samples/api/HelloService.java
 
b/99-integration/dubbo-samples-test-12376/src/main/java/org/apache/dubbo/samples/api/HelloService.java
new file mode 100644
index 00000000..c2697bc5
--- /dev/null
+++ 
b/99-integration/dubbo-samples-test-12376/src/main/java/org/apache/dubbo/samples/api/HelloService.java
@@ -0,0 +1,24 @@
+/*
+ * 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 org.apache.dubbo.samples.api;
+
+public interface HelloService {
+
+    String sayHi(String name);
+
+}
diff --git 
a/99-integration/dubbo-samples-test-12376/src/main/java/org/apache/dubbo/samples/api/QosService.java
 
b/99-integration/dubbo-samples-test-12376/src/main/java/org/apache/dubbo/samples/api/QosService.java
new file mode 100644
index 00000000..58e2c1b3
--- /dev/null
+++ 
b/99-integration/dubbo-samples-test-12376/src/main/java/org/apache/dubbo/samples/api/QosService.java
@@ -0,0 +1,21 @@
+/*
+ * 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 org.apache.dubbo.samples.api;
+
+public interface QosService {
+    boolean expected();
+}
diff --git 
a/99-integration/dubbo-samples-test-12376/src/main/java/org/apache/dubbo/samples/filter/ConsumerAlibabaFilter.java
 
b/99-integration/dubbo-samples-test-12376/src/main/java/org/apache/dubbo/samples/filter/ConsumerAlibabaFilter.java
new file mode 100644
index 00000000..3ab42cba
--- /dev/null
+++ 
b/99-integration/dubbo-samples-test-12376/src/main/java/org/apache/dubbo/samples/filter/ConsumerAlibabaFilter.java
@@ -0,0 +1,56 @@
+/*
+ * 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 org.apache.dubbo.samples.filter;
+
+import com.alibaba.dubbo.common.extension.Activate;
+import com.alibaba.dubbo.rpc.Filter;
+import com.alibaba.dubbo.rpc.Invocation;
+import com.alibaba.dubbo.rpc.Invoker;
+import com.alibaba.dubbo.rpc.Result;
+import com.alibaba.dubbo.rpc.RpcContext;
+import com.alibaba.dubbo.rpc.RpcException;
+
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import static org.apache.dubbo.common.constants.CommonConstants.CONSUMER_SIDE;
+import static org.apache.dubbo.common.constants.CommonConstants.SIDE_KEY;
+
+@Activate(group = "consumer")
+public class ConsumerAlibabaFilter implements Filter {
+    private static final AtomicBoolean expected = new AtomicBoolean(true);
+    private static final AtomicBoolean invoked = new AtomicBoolean(false);
+
+    @Override
+    public Result invoke(Invoker<?> invoker, Invocation invocation) throws 
RpcException {
+        invoked.set(true);
+        if (!RpcContext.getContext().isConsumerSide()) {
+            expected.set(false);
+        }
+        if (RpcContext.getContext().isProviderSide()) {
+            expected.set(false);
+        }
+        if 
(!CONSUMER_SIDE.equals(RpcContext.getContext().getUrl().getParameter(SIDE_KEY)))
 {
+            expected.set(false);
+        }
+
+        return invoker.invoke(invocation);
+    }
+
+    public static boolean expected() {
+        return expected.get() && invoked.get();
+    }
+}
diff --git 
a/99-integration/dubbo-samples-test-12376/src/main/java/org/apache/dubbo/samples/filter/ConsumerClusterFilter.java
 
b/99-integration/dubbo-samples-test-12376/src/main/java/org/apache/dubbo/samples/filter/ConsumerClusterFilter.java
new file mode 100644
index 00000000..ff74fc77
--- /dev/null
+++ 
b/99-integration/dubbo-samples-test-12376/src/main/java/org/apache/dubbo/samples/filter/ConsumerClusterFilter.java
@@ -0,0 +1,56 @@
+/*
+ * 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 org.apache.dubbo.samples.filter;
+
+import org.apache.dubbo.common.extension.Activate;
+import org.apache.dubbo.rpc.Invocation;
+import org.apache.dubbo.rpc.Invoker;
+import org.apache.dubbo.rpc.Result;
+import org.apache.dubbo.rpc.RpcContext;
+import org.apache.dubbo.rpc.RpcException;
+import org.apache.dubbo.rpc.cluster.filter.ClusterFilter;
+
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import static org.apache.dubbo.common.constants.CommonConstants.CONSUMER_SIDE;
+import static org.apache.dubbo.common.constants.CommonConstants.SIDE_KEY;
+
+@Activate(group = "consumer")
+public class ConsumerClusterFilter implements ClusterFilter {
+    private static final AtomicBoolean expected = new AtomicBoolean(true);
+    private static final AtomicBoolean invoked = new AtomicBoolean(false);
+
+    @Override
+    public Result invoke(Invoker<?> invoker, Invocation invocation) throws 
RpcException {
+        invoked.set(true);
+        if (!RpcContext.getContext().isConsumerSide()) {
+            expected.set(false);
+        }
+        if (RpcContext.getContext().isProviderSide()) {
+            expected.set(false);
+        }
+        if 
(!CONSUMER_SIDE.equals(RpcContext.getContext().getUrl().getParameter(SIDE_KEY)))
 {
+            expected.set(false);
+        }
+
+        return invoker.invoke(invocation);
+    }
+
+    public static boolean expected() {
+        return expected.get() && invoked.get();
+    }
+}
diff --git 
a/99-integration/dubbo-samples-test-12376/src/main/java/org/apache/dubbo/samples/filter/ConsumerFilter.java
 
b/99-integration/dubbo-samples-test-12376/src/main/java/org/apache/dubbo/samples/filter/ConsumerFilter.java
new file mode 100644
index 00000000..42c11d17
--- /dev/null
+++ 
b/99-integration/dubbo-samples-test-12376/src/main/java/org/apache/dubbo/samples/filter/ConsumerFilter.java
@@ -0,0 +1,56 @@
+/*
+ * 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 org.apache.dubbo.samples.filter;
+
+import org.apache.dubbo.common.extension.Activate;
+import org.apache.dubbo.rpc.Filter;
+import org.apache.dubbo.rpc.Invocation;
+import org.apache.dubbo.rpc.Invoker;
+import org.apache.dubbo.rpc.Result;
+import org.apache.dubbo.rpc.RpcContext;
+import org.apache.dubbo.rpc.RpcException;
+
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import static org.apache.dubbo.common.constants.CommonConstants.CONSUMER_SIDE;
+import static org.apache.dubbo.common.constants.CommonConstants.SIDE_KEY;
+
+@Activate(group = "consumer")
+public class ConsumerFilter implements Filter {
+    private static final AtomicBoolean expected = new AtomicBoolean(true);
+    private static final AtomicBoolean invoked = new AtomicBoolean(false);
+
+    @Override
+    public Result invoke(Invoker<?> invoker, Invocation invocation) throws 
RpcException {
+        invoked.set(true);
+        if (!RpcContext.getContext().isConsumerSide()) {
+            expected.set(false);
+        }
+        if (RpcContext.getContext().isProviderSide()) {
+            expected.set(false);
+        }
+        if 
(!CONSUMER_SIDE.equals(RpcContext.getContext().getUrl().getParameter(SIDE_KEY)))
 {
+            expected.set(false);
+        }
+
+        return invoker.invoke(invocation);
+    }
+
+    public static boolean expected() {
+        return expected.get() && invoked.get();
+    }
+}
diff --git 
a/99-integration/dubbo-samples-test-12376/src/main/java/org/apache/dubbo/samples/filter/ProviderAlibabaFilter.java
 
b/99-integration/dubbo-samples-test-12376/src/main/java/org/apache/dubbo/samples/filter/ProviderAlibabaFilter.java
new file mode 100644
index 00000000..9d66ee24
--- /dev/null
+++ 
b/99-integration/dubbo-samples-test-12376/src/main/java/org/apache/dubbo/samples/filter/ProviderAlibabaFilter.java
@@ -0,0 +1,56 @@
+/*
+ * 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 org.apache.dubbo.samples.filter;
+
+import com.alibaba.dubbo.common.extension.Activate;
+import com.alibaba.dubbo.rpc.Filter;
+import com.alibaba.dubbo.rpc.Invocation;
+import com.alibaba.dubbo.rpc.Invoker;
+import com.alibaba.dubbo.rpc.Result;
+import com.alibaba.dubbo.rpc.RpcContext;
+import com.alibaba.dubbo.rpc.RpcException;
+
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import static org.apache.dubbo.common.constants.CommonConstants.CONSUMER_SIDE;
+import static org.apache.dubbo.common.constants.CommonConstants.SIDE_KEY;
+
+@Activate(group = "provider")
+public class ProviderAlibabaFilter implements Filter {
+    private static final AtomicBoolean expected = new AtomicBoolean(true);
+    private static final AtomicBoolean invoked = new AtomicBoolean(false);
+
+    @Override
+    public Result invoke(Invoker<?> invoker, Invocation invocation) throws 
RpcException {
+        invoked.set(true);
+        if (RpcContext.getContext().isConsumerSide()) {
+            expected.set(false);
+        }
+        if (!RpcContext.getContext().isProviderSide()) {
+            expected.set(false);
+        }
+        if 
(CONSUMER_SIDE.equals(RpcContext.getContext().getUrl().getParameter(SIDE_KEY))) 
{
+            expected.set(false);
+        }
+
+        return invoker.invoke(invocation);
+    }
+
+    public static boolean expected() {
+        return expected.get() && invoked.get();
+    }
+}
diff --git 
a/99-integration/dubbo-samples-test-12376/src/main/java/org/apache/dubbo/samples/filter/ProviderFilter.java
 
b/99-integration/dubbo-samples-test-12376/src/main/java/org/apache/dubbo/samples/filter/ProviderFilter.java
new file mode 100644
index 00000000..b266bba5
--- /dev/null
+++ 
b/99-integration/dubbo-samples-test-12376/src/main/java/org/apache/dubbo/samples/filter/ProviderFilter.java
@@ -0,0 +1,56 @@
+/*
+ * 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 org.apache.dubbo.samples.filter;
+
+import org.apache.dubbo.common.extension.Activate;
+import org.apache.dubbo.rpc.Filter;
+import org.apache.dubbo.rpc.Invocation;
+import org.apache.dubbo.rpc.Invoker;
+import org.apache.dubbo.rpc.Result;
+import org.apache.dubbo.rpc.RpcContext;
+import org.apache.dubbo.rpc.RpcException;
+
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import static org.apache.dubbo.common.constants.CommonConstants.CONSUMER_SIDE;
+import static org.apache.dubbo.common.constants.CommonConstants.SIDE_KEY;
+
+@Activate(group = "provider")
+public class ProviderFilter implements Filter {
+    private static final AtomicBoolean expected = new AtomicBoolean(true);
+    private static final AtomicBoolean invoked = new AtomicBoolean(false);
+
+    @Override
+    public Result invoke(Invoker<?> invoker, Invocation invocation) throws 
RpcException {
+        invoked.set(true);
+        if (RpcContext.getContext().isConsumerSide()) {
+            expected.set(false);
+        }
+        if (!RpcContext.getContext().isProviderSide()) {
+            expected.set(false);
+        }
+        if 
(CONSUMER_SIDE.equals(RpcContext.getContext().getUrl().getParameter(SIDE_KEY))) 
{
+            expected.set(false);
+        }
+
+        return invoker.invoke(invocation);
+    }
+
+    public static boolean expected() {
+        return expected.get() && invoked.get();
+    }
+}
diff --git 
a/99-integration/dubbo-samples-test-12376/src/main/java/org/apache/dubbo/samples/loadbalance/AlibabaLoadBalance.java
 
b/99-integration/dubbo-samples-test-12376/src/main/java/org/apache/dubbo/samples/loadbalance/AlibabaLoadBalance.java
new file mode 100644
index 00000000..b44ecb5b
--- /dev/null
+++ 
b/99-integration/dubbo-samples-test-12376/src/main/java/org/apache/dubbo/samples/loadbalance/AlibabaLoadBalance.java
@@ -0,0 +1,42 @@
+/*
+ * 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 org.apache.dubbo.samples.loadbalance;
+
+import org.apache.dubbo.rpc.RpcException;
+
+import com.alibaba.dubbo.common.URL;
+import com.alibaba.dubbo.rpc.Invocation;
+import com.alibaba.dubbo.rpc.Invoker;
+import com.alibaba.dubbo.rpc.cluster.LoadBalance;
+
+import java.util.List;
+import java.util.concurrent.ThreadLocalRandom;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+public class AlibabaLoadBalance implements LoadBalance {
+    private static final AtomicBoolean invoked = new AtomicBoolean(false);
+    @Override
+    public <T> Invoker<T> select(List<Invoker<T>> invokers, URL url, 
Invocation invocation) throws RpcException {
+        invoked.set(true);
+        return 
invokers.get(ThreadLocalRandom.current().nextInt(invokers.size()));
+    }
+
+    public static boolean isInvoked() {
+        return invoked.get();
+    }
+}
diff --git 
a/99-integration/dubbo-samples-test-12376/src/main/java/org/apache/dubbo/samples/loadbalance/ApacheLoadBalance.java
 
b/99-integration/dubbo-samples-test-12376/src/main/java/org/apache/dubbo/samples/loadbalance/ApacheLoadBalance.java
new file mode 100644
index 00000000..23bfb342
--- /dev/null
+++ 
b/99-integration/dubbo-samples-test-12376/src/main/java/org/apache/dubbo/samples/loadbalance/ApacheLoadBalance.java
@@ -0,0 +1,41 @@
+/*
+ * 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 org.apache.dubbo.samples.loadbalance;
+
+import org.apache.dubbo.common.URL;
+import org.apache.dubbo.rpc.Invocation;
+import org.apache.dubbo.rpc.Invoker;
+import org.apache.dubbo.rpc.RpcException;
+import org.apache.dubbo.rpc.cluster.LoadBalance;
+
+import java.util.List;
+import java.util.concurrent.ThreadLocalRandom;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+public class ApacheLoadBalance implements LoadBalance {
+    private static final AtomicBoolean invoked = new AtomicBoolean(false);
+    @Override
+    public <T> Invoker<T> select(List<Invoker<T>> invokers, URL url, 
Invocation invocation) throws RpcException {
+        invoked.set(true);
+        return 
invokers.get(ThreadLocalRandom.current().nextInt(invokers.size()));
+    }
+
+    public static boolean isInvoked() {
+        return invoked.get();
+    }
+}
diff --git 
a/99-integration/dubbo-samples-test-12376/src/main/java/org/apache/dubbo/samples/provider/Application.java
 
b/99-integration/dubbo-samples-test-12376/src/main/java/org/apache/dubbo/samples/provider/Application.java
new file mode 100644
index 00000000..38895c79
--- /dev/null
+++ 
b/99-integration/dubbo-samples-test-12376/src/main/java/org/apache/dubbo/samples/provider/Application.java
@@ -0,0 +1,94 @@
+/*
+ * 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 org.apache.dubbo.samples.provider;
+
+import org.apache.dubbo.config.ApplicationConfig;
+import org.apache.dubbo.config.ProtocolConfig;
+import org.apache.dubbo.config.ReferenceConfig;
+import org.apache.dubbo.config.RegistryConfig;
+import org.apache.dubbo.config.ServiceConfig;
+import org.apache.dubbo.config.bootstrap.DubboBootstrap;
+import org.apache.dubbo.rpc.model.ApplicationModel;
+import org.apache.dubbo.rpc.model.FrameworkModel;
+import org.apache.dubbo.samples.api.BackendService;
+import org.apache.dubbo.samples.api.GreetingsService;
+import org.apache.dubbo.samples.api.HelloService;
+import org.apache.dubbo.samples.api.QosService;
+
+public class Application {
+    private static final String ZOOKEEPER_HOST = 
System.getProperty("zookeeper.address", "127.0.0.1");
+    private static final String ZOOKEEPER_PORT = 
System.getProperty("zookeeper.port", "2181");
+    private static final String ZOOKEEPER_ADDRESS = "zookeeper://" + 
ZOOKEEPER_HOST + ":" + ZOOKEEPER_PORT;
+
+    public static void main(String[] args) {
+        System.setProperty("dubbo.application.metadata.publish.delay", "1");
+        DubboBootstrap dubboBootstrap1 = export(20881);
+        DubboBootstrap dubboBootstrap2 = export(20882);
+        DubboBootstrap dubboBootstrap3 = export(20883);
+
+        dubboBootstrap1.await();
+    }
+
+    private static DubboBootstrap export(int port) {
+        DubboBootstrap dubboBootstrap;
+        FrameworkModel frameworkModel = new FrameworkModel();
+        ApplicationModel applicationModel = frameworkModel.newApplication();
+
+        ServiceConfig<BackendService> backendService = new ServiceConfig<>();
+        backendService.setInterface(BackendService.class);
+        backendService.setRef(new BackendServiceImpl());
+
+        ServiceConfig<QosService> qosService = new ServiceConfig<>();
+        qosService.setInterface(QosService.class);
+        qosService.setRef(new QosServiceImpl());
+        qosService.setVersion(String.valueOf(port));
+
+        ReferenceConfig<BackendService> backendRef = new ReferenceConfig<>();
+        backendRef.setInterface(BackendService.class);
+        backendRef.setLoadbalance("alibaba-test");
+        backendRef.setScope("remote");
+
+        ApplicationConfig applicationConfig = new 
ApplicationConfig("first-dubbo-provider");
+        applicationConfig.setRegisterMode("interface");
+
+        dubboBootstrap = DubboBootstrap.getInstance(applicationModel)
+                .application(applicationConfig)
+                .registry(new RegistryConfig(ZOOKEEPER_ADDRESS))
+                .protocol(new ProtocolConfig("dubbo", port))
+                .service(backendService)
+                .service(qosService)
+                .reference(backendRef)
+                .start();
+
+        ServiceConfig<HelloService> helloService = new 
ServiceConfig<>(applicationModel.getDefaultModule());
+        helloService.setInterface(HelloService.class);
+        helloService.setRef(new HelloServiceImpl(backendRef.get()));
+        helloService.export();
+
+        ReferenceConfig<HelloService> helloRef = new 
ReferenceConfig<>(applicationModel.getDefaultModule());
+        helloRef.setInterface(HelloService.class);
+        helloRef.setLoadbalance("apache-test");
+        helloRef.setScope("remote");
+
+        ServiceConfig<GreetingsService> greetService = new 
ServiceConfig<>(applicationModel.getDefaultModule());
+        greetService.setInterface(GreetingsService.class);
+        greetService.setRef(new GreetingsServiceImpl(helloRef.get()));
+        greetService.export();
+        return dubboBootstrap;
+    }
+}
diff --git 
a/99-integration/dubbo-samples-test-12376/src/main/java/org/apache/dubbo/samples/provider/BackendServiceImpl.java
 
b/99-integration/dubbo-samples-test-12376/src/main/java/org/apache/dubbo/samples/provider/BackendServiceImpl.java
new file mode 100644
index 00000000..80b29008
--- /dev/null
+++ 
b/99-integration/dubbo-samples-test-12376/src/main/java/org/apache/dubbo/samples/provider/BackendServiceImpl.java
@@ -0,0 +1,26 @@
+/*
+ * 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 org.apache.dubbo.samples.provider;
+
+import org.apache.dubbo.samples.api.BackendService;
+
+public class BackendServiceImpl implements BackendService {
+    @Override
+    public String sayHi(String name) {
+        return "hi, " + name;
+    }
+}
diff --git 
a/99-integration/dubbo-samples-test-12376/src/main/java/org/apache/dubbo/samples/provider/GreetingsServiceImpl.java
 
b/99-integration/dubbo-samples-test-12376/src/main/java/org/apache/dubbo/samples/provider/GreetingsServiceImpl.java
new file mode 100644
index 00000000..6baa6642
--- /dev/null
+++ 
b/99-integration/dubbo-samples-test-12376/src/main/java/org/apache/dubbo/samples/provider/GreetingsServiceImpl.java
@@ -0,0 +1,34 @@
+/*
+ * 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 org.apache.dubbo.samples.provider;
+
+import org.apache.dubbo.samples.api.GreetingsService;
+import org.apache.dubbo.samples.api.HelloService;
+
+public class GreetingsServiceImpl implements GreetingsService {
+    private final HelloService helloService;
+
+    public GreetingsServiceImpl(HelloService helloService) {
+        this.helloService = helloService;
+    }
+
+    @Override
+    public String sayHi(String name) {
+        return helloService.sayHi(name);
+    }
+}
diff --git 
a/99-integration/dubbo-samples-test-12376/src/main/java/org/apache/dubbo/samples/provider/HelloServiceImpl.java
 
b/99-integration/dubbo-samples-test-12376/src/main/java/org/apache/dubbo/samples/provider/HelloServiceImpl.java
new file mode 100644
index 00000000..ac653e80
--- /dev/null
+++ 
b/99-integration/dubbo-samples-test-12376/src/main/java/org/apache/dubbo/samples/provider/HelloServiceImpl.java
@@ -0,0 +1,33 @@
+/*
+ * 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 org.apache.dubbo.samples.provider;
+
+import org.apache.dubbo.samples.api.BackendService;
+import org.apache.dubbo.samples.api.HelloService;
+
+public class HelloServiceImpl implements HelloService {
+    private final BackendService backendService;
+
+    public HelloServiceImpl(BackendService backendService) {
+        this.backendService = backendService;
+    }
+
+    @Override
+    public String sayHi(String name) {
+        return backendService.sayHi(name);
+    }
+}
diff --git 
a/99-integration/dubbo-samples-test-12376/src/main/java/org/apache/dubbo/samples/provider/QosServiceImpl.java
 
b/99-integration/dubbo-samples-test-12376/src/main/java/org/apache/dubbo/samples/provider/QosServiceImpl.java
new file mode 100644
index 00000000..356abaf7
--- /dev/null
+++ 
b/99-integration/dubbo-samples-test-12376/src/main/java/org/apache/dubbo/samples/provider/QosServiceImpl.java
@@ -0,0 +1,50 @@
+/*
+ * 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 org.apache.dubbo.samples.provider;
+
+import org.apache.dubbo.samples.api.QosService;
+import org.apache.dubbo.samples.filter.ConsumerAlibabaFilter;
+import org.apache.dubbo.samples.filter.ConsumerClusterFilter;
+import org.apache.dubbo.samples.filter.ConsumerFilter;
+import org.apache.dubbo.samples.filter.ProviderAlibabaFilter;
+import org.apache.dubbo.samples.filter.ProviderFilter;
+import org.apache.dubbo.samples.loadbalance.AlibabaLoadBalance;
+import org.apache.dubbo.samples.loadbalance.ApacheLoadBalance;
+import org.apache.dubbo.samples.router.AlibabaRouter;
+import org.apache.dubbo.samples.router.ApacheRouter;
+import org.apache.dubbo.samples.router.ApacheStateRouter;
+
+public class QosServiceImpl implements QosService {
+    @Override
+    public boolean expected() {
+        System.out.println("ProviderAlibabaFilter.expected(): " + 
ProviderAlibabaFilter.expected());
+        System.out.println("ProviderFilter.expected(): " + 
ProviderFilter.expected());
+        System.out.println("ConsumerAlibabaFilter.expected(): " + 
ConsumerAlibabaFilter.expected());
+        System.out.println("ConsumerFilter.expected(): " + 
ConsumerFilter.expected());
+        System.out.println("ConsumerClusterFilter.expected(): " + 
ConsumerClusterFilter.expected());
+        System.out.println("AlibabaRouter.isInvoked(): " + 
AlibabaRouter.isInvoked());
+        System.out.println("ApacheRouter.isInvoked(): " + 
ApacheRouter.isInvoked());
+        System.out.println("ApacheStateRouter.isInvoked(): " + 
ApacheStateRouter.isInvoked());
+        System.out.println("AlibabaLoadBalance.isInvoked(): " + 
AlibabaLoadBalance.isInvoked());
+        System.out.println("ApacheLoadBalance.isInvoked(): " + 
ApacheLoadBalance.isInvoked());
+
+        return ProviderAlibabaFilter.expected() && ProviderFilter.expected()
+                && ConsumerAlibabaFilter.expected() && 
ConsumerFilter.expected() && ConsumerClusterFilter.expected()
+                && AlibabaRouter.isInvoked() && ApacheRouter.isInvoked() && 
ApacheStateRouter.isInvoked()
+                && AlibabaLoadBalance.isInvoked() && 
ApacheLoadBalance.isInvoked();
+    }
+}
diff --git 
a/99-integration/dubbo-samples-test-12376/src/main/java/org/apache/dubbo/samples/router/AlibabaRouter.java
 
b/99-integration/dubbo-samples-test-12376/src/main/java/org/apache/dubbo/samples/router/AlibabaRouter.java
new file mode 100644
index 00000000..2196612f
--- /dev/null
+++ 
b/99-integration/dubbo-samples-test-12376/src/main/java/org/apache/dubbo/samples/router/AlibabaRouter.java
@@ -0,0 +1,57 @@
+/*
+ * 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 org.apache.dubbo.samples.router;
+
+import com.alibaba.dubbo.common.URL;
+import com.alibaba.dubbo.rpc.Invocation;
+import com.alibaba.dubbo.rpc.Invoker;
+import com.alibaba.dubbo.rpc.RpcException;
+import com.alibaba.dubbo.rpc.cluster.Router;
+
+import java.util.List;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+public class AlibabaRouter implements Router {
+    private final URL url;
+
+    private static final AtomicBoolean invoked = new AtomicBoolean(false);
+
+    public AlibabaRouter(URL url) {
+        this.url = url;
+    }
+
+    @Override
+    public URL getUrl() {
+        return url;
+    }
+
+    @Override
+    public <T> List<Invoker<T>> route(List<Invoker<T>> invokers, URL url, 
Invocation invocation) throws RpcException {
+        invoked.set(true);
+        return invokers;
+    }
+
+    @Override
+    public int compareTo(Router o) {
+        return 0;
+    }
+
+    public static boolean isInvoked() {
+        return invoked.get();
+    }
+}
diff --git 
a/99-integration/dubbo-samples-test-12376/src/main/java/org/apache/dubbo/samples/router/AlibabaRouterFactory.java
 
b/99-integration/dubbo-samples-test-12376/src/main/java/org/apache/dubbo/samples/router/AlibabaRouterFactory.java
new file mode 100644
index 00000000..244f0f88
--- /dev/null
+++ 
b/99-integration/dubbo-samples-test-12376/src/main/java/org/apache/dubbo/samples/router/AlibabaRouterFactory.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 org.apache.dubbo.samples.router;
+
+import org.apache.dubbo.common.extension.Activate;
+
+import com.alibaba.dubbo.common.URL;
+import com.alibaba.dubbo.rpc.cluster.Router;
+import com.alibaba.dubbo.rpc.cluster.RouterFactory;
+
+@Activate
+public class AlibabaRouterFactory implements RouterFactory {
+    @Override
+    public Router getRouter(URL url) {
+        return new AlibabaRouter(url);
+    }
+}
diff --git 
a/99-integration/dubbo-samples-test-12376/src/main/java/org/apache/dubbo/samples/router/ApacheRouter.java
 
b/99-integration/dubbo-samples-test-12376/src/main/java/org/apache/dubbo/samples/router/ApacheRouter.java
new file mode 100644
index 00000000..b6302f87
--- /dev/null
+++ 
b/99-integration/dubbo-samples-test-12376/src/main/java/org/apache/dubbo/samples/router/ApacheRouter.java
@@ -0,0 +1,66 @@
+/*
+ * 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 org.apache.dubbo.samples.router;
+
+import org.apache.dubbo.common.URL;
+import org.apache.dubbo.rpc.Invocation;
+import org.apache.dubbo.rpc.Invoker;
+import org.apache.dubbo.rpc.RpcException;
+import org.apache.dubbo.rpc.cluster.Router;
+
+import java.util.List;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+public class ApacheRouter implements Router {
+    private final URL url;
+
+    private static final AtomicBoolean invoked = new AtomicBoolean(false);
+
+    public ApacheRouter(URL url) {
+        this.url = url;
+    }
+
+    @Override
+    public URL getUrl() {
+        return url;
+    }
+
+    @Override
+    public <T> List<Invoker<T>> route(List<Invoker<T>> invokers, URL url, 
Invocation invocation) throws RpcException {
+        invoked.set(true);
+        return invokers;
+    }
+
+    @Override
+    public boolean isRuntime() {
+        return false;
+    }
+
+    @Override
+    public boolean isForce() {
+        return false;
+    }
+
+    @Override
+    public int getPriority() {
+        return 0;
+    }
+
+    public static boolean isInvoked() {
+        return invoked.get();
+    }
+}
diff --git 
a/99-integration/dubbo-samples-test-12376/src/main/java/org/apache/dubbo/samples/router/ApacheRouterFactory.java
 
b/99-integration/dubbo-samples-test-12376/src/main/java/org/apache/dubbo/samples/router/ApacheRouterFactory.java
new file mode 100644
index 00000000..dac65b2e
--- /dev/null
+++ 
b/99-integration/dubbo-samples-test-12376/src/main/java/org/apache/dubbo/samples/router/ApacheRouterFactory.java
@@ -0,0 +1,30 @@
+/*
+ * 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 org.apache.dubbo.samples.router;
+
+import org.apache.dubbo.common.URL;
+import org.apache.dubbo.common.extension.Activate;
+import org.apache.dubbo.rpc.cluster.Router;
+import org.apache.dubbo.rpc.cluster.RouterFactory;
+
+@Activate
+public class ApacheRouterFactory implements RouterFactory {
+    @Override
+    public Router getRouter(URL url) {
+        return new ApacheRouter(url);
+    }
+}
diff --git 
a/99-integration/dubbo-samples-test-12376/src/main/java/org/apache/dubbo/samples/router/ApacheStateRouter.java
 
b/99-integration/dubbo-samples-test-12376/src/main/java/org/apache/dubbo/samples/router/ApacheStateRouter.java
new file mode 100644
index 00000000..95965905
--- /dev/null
+++ 
b/99-integration/dubbo-samples-test-12376/src/main/java/org/apache/dubbo/samples/router/ApacheStateRouter.java
@@ -0,0 +1,53 @@
+/*
+ * 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 org.apache.dubbo.samples.router;
+
+import org.apache.dubbo.common.URL;
+import org.apache.dubbo.common.utils.Holder;
+import org.apache.dubbo.rpc.Invocation;
+import org.apache.dubbo.rpc.Invoker;
+import org.apache.dubbo.rpc.RpcException;
+import org.apache.dubbo.rpc.cluster.router.RouterSnapshotNode;
+import org.apache.dubbo.rpc.cluster.router.state.AbstractStateRouter;
+import org.apache.dubbo.rpc.cluster.router.state.BitList;
+
+import java.util.concurrent.atomic.AtomicBoolean;
+
+public class ApacheStateRouter<T> extends AbstractStateRouter<T> {
+    private volatile BitList<Invoker<T>> notified;
+
+    private static final AtomicBoolean invoked = new AtomicBoolean(false);
+
+    public ApacheStateRouter(URL url) {
+        super(url);
+    }
+
+    @Override
+    protected BitList<Invoker<T>> doRoute(BitList<Invoker<T>> invokers, URL 
url, Invocation invocation, boolean needToPrintMessage, 
Holder<RouterSnapshotNode<T>> routerSnapshotNodeHolder, Holder<String> 
messageHolder) throws RpcException {
+        invoked.set(true);
+        return invokers.and(notified);
+    }
+
+    @Override
+    public void notify(BitList<Invoker<T>> invokers) {
+        this.notified = invokers;
+    }
+
+    public static boolean isInvoked() {
+        return invoked.get();
+    }
+}
diff --git 
a/99-integration/dubbo-samples-test-12376/src/main/java/org/apache/dubbo/samples/router/ApacheStateRouterFactory.java
 
b/99-integration/dubbo-samples-test-12376/src/main/java/org/apache/dubbo/samples/router/ApacheStateRouterFactory.java
new file mode 100644
index 00000000..c9defc20
--- /dev/null
+++ 
b/99-integration/dubbo-samples-test-12376/src/main/java/org/apache/dubbo/samples/router/ApacheStateRouterFactory.java
@@ -0,0 +1,30 @@
+/*
+ * 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 org.apache.dubbo.samples.router;
+
+import org.apache.dubbo.common.URL;
+import org.apache.dubbo.common.extension.Activate;
+import org.apache.dubbo.rpc.cluster.router.state.StateRouter;
+import org.apache.dubbo.rpc.cluster.router.state.StateRouterFactory;
+
+@Activate
+public class ApacheStateRouterFactory implements StateRouterFactory {
+    @Override
+    public <T> StateRouter<T> getRouter(Class<T> interfaceClass, URL url) {
+        return new ApacheStateRouter<>(url);
+    }
+}
diff --git 
a/99-integration/dubbo-samples-test-12376/src/main/resources/META-INF/dubbo/com.alibaba.dubbo.rpc.Filter
 
b/99-integration/dubbo-samples-test-12376/src/main/resources/META-INF/dubbo/com.alibaba.dubbo.rpc.Filter
new file mode 100644
index 00000000..e39f2608
--- /dev/null
+++ 
b/99-integration/dubbo-samples-test-12376/src/main/resources/META-INF/dubbo/com.alibaba.dubbo.rpc.Filter
@@ -0,0 +1,2 @@
+org.apache.dubbo.samples.filter.ConsumerAlibabaFilter
+org.apache.dubbo.samples.filter.ProviderAlibabaFilter
diff --git 
a/99-integration/dubbo-samples-test-12376/src/main/resources/META-INF/dubbo/com.alibaba.dubbo.rpc.cluster.LoadBalance
 
b/99-integration/dubbo-samples-test-12376/src/main/resources/META-INF/dubbo/com.alibaba.dubbo.rpc.cluster.LoadBalance
new file mode 100644
index 00000000..4930146c
--- /dev/null
+++ 
b/99-integration/dubbo-samples-test-12376/src/main/resources/META-INF/dubbo/com.alibaba.dubbo.rpc.cluster.LoadBalance
@@ -0,0 +1,2 @@
+apache-test=org.apache.dubbo.samples.loadbalance.ApacheLoadBalance
+alibaba-test=org.apache.dubbo.samples.loadbalance.AlibabaLoadBalance
diff --git 
a/99-integration/dubbo-samples-test-12376/src/main/resources/META-INF/dubbo/com.alibaba.dubbo.rpc.cluster.RouterFactory
 
b/99-integration/dubbo-samples-test-12376/src/main/resources/META-INF/dubbo/com.alibaba.dubbo.rpc.cluster.RouterFactory
new file mode 100644
index 00000000..68175b64
--- /dev/null
+++ 
b/99-integration/dubbo-samples-test-12376/src/main/resources/META-INF/dubbo/com.alibaba.dubbo.rpc.cluster.RouterFactory
@@ -0,0 +1 @@
+org.apache.dubbo.samples.router.AlibabaRouterFactory
diff --git 
a/99-integration/dubbo-samples-test-12376/src/main/resources/META-INF/dubbo/org.apache.dubbo.rpc.Filter
 
b/99-integration/dubbo-samples-test-12376/src/main/resources/META-INF/dubbo/org.apache.dubbo.rpc.Filter
new file mode 100644
index 00000000..ac4c3432
--- /dev/null
+++ 
b/99-integration/dubbo-samples-test-12376/src/main/resources/META-INF/dubbo/org.apache.dubbo.rpc.Filter
@@ -0,0 +1,2 @@
+org.apache.dubbo.samples.filter.ConsumerFilter
+org.apache.dubbo.samples.filter.ProviderFilter
diff --git 
a/99-integration/dubbo-samples-test-12376/src/main/resources/META-INF/dubbo/org.apache.dubbo.rpc.cluster.RouterFactory
 
b/99-integration/dubbo-samples-test-12376/src/main/resources/META-INF/dubbo/org.apache.dubbo.rpc.cluster.RouterFactory
new file mode 100644
index 00000000..8812775d
--- /dev/null
+++ 
b/99-integration/dubbo-samples-test-12376/src/main/resources/META-INF/dubbo/org.apache.dubbo.rpc.cluster.RouterFactory
@@ -0,0 +1 @@
+org.apache.dubbo.samples.router.ApacheRouterFactory
diff --git 
a/99-integration/dubbo-samples-test-12376/src/main/resources/META-INF/dubbo/org.apache.dubbo.rpc.cluster.filter.ClusterFilter
 
b/99-integration/dubbo-samples-test-12376/src/main/resources/META-INF/dubbo/org.apache.dubbo.rpc.cluster.filter.ClusterFilter
new file mode 100644
index 00000000..a1e06888
--- /dev/null
+++ 
b/99-integration/dubbo-samples-test-12376/src/main/resources/META-INF/dubbo/org.apache.dubbo.rpc.cluster.filter.ClusterFilter
@@ -0,0 +1 @@
+org.apache.dubbo.samples.filter.ConsumerClusterFilter
diff --git 
a/99-integration/dubbo-samples-test-12376/src/main/resources/META-INF/dubbo/org.apache.dubbo.rpc.cluster.router.state.StateRouterFactory
 
b/99-integration/dubbo-samples-test-12376/src/main/resources/META-INF/dubbo/org.apache.dubbo.rpc.cluster.router.state.StateRouterFactory
new file mode 100644
index 00000000..52cffa0b
--- /dev/null
+++ 
b/99-integration/dubbo-samples-test-12376/src/main/resources/META-INF/dubbo/org.apache.dubbo.rpc.cluster.router.state.StateRouterFactory
@@ -0,0 +1 @@
+org.apache.dubbo.samples.router.ApacheStateRouterFactory
diff --git 
a/99-integration/dubbo-samples-test-12376/src/main/resources/log4j.properties 
b/99-integration/dubbo-samples-test-12376/src/main/resources/log4j.properties
new file mode 100644
index 00000000..e976f5c2
--- /dev/null
+++ 
b/99-integration/dubbo-samples-test-12376/src/main/resources/log4j.properties
@@ -0,0 +1,25 @@
+#
+#
+#   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.
+#  
+#
+###set log levels###
+log4j.rootLogger=info, stdout
+###output to the console###
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.Target=System.out
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=[%d{dd/MM/yy hh:mm:ss:sss z}] 
%t %5p %c{2}: %m%n
\ No newline at end of file
diff --git 
a/99-integration/dubbo-samples-test-12376/src/test/java/org/apache/dubbo/samples/client/GreetingServiceIT.java
 
b/99-integration/dubbo-samples-test-12376/src/test/java/org/apache/dubbo/samples/client/GreetingServiceIT.java
new file mode 100644
index 00000000..d1d85848
--- /dev/null
+++ 
b/99-integration/dubbo-samples-test-12376/src/test/java/org/apache/dubbo/samples/client/GreetingServiceIT.java
@@ -0,0 +1,84 @@
+/*
+ * 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 org.apache.dubbo.samples.client;
+
+import org.apache.dubbo.config.ApplicationConfig;
+import org.apache.dubbo.config.ReferenceConfig;
+import org.apache.dubbo.config.RegistryConfig;
+import org.apache.dubbo.config.bootstrap.DubboBootstrap;
+import org.apache.dubbo.samples.api.GreetingsService;
+import org.apache.dubbo.samples.api.QosService;
+import org.apache.dubbo.samples.filter.ConsumerAlibabaFilter;
+import org.apache.dubbo.samples.filter.ConsumerClusterFilter;
+import org.apache.dubbo.samples.filter.ConsumerFilter;
+import org.apache.dubbo.samples.router.AlibabaRouter;
+import org.apache.dubbo.samples.router.ApacheRouter;
+import org.apache.dubbo.samples.router.ApacheStateRouter;
+
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+class GreetingServiceIT {
+    private static String zookeeperHost = 
System.getProperty("zookeeper.address", "127.0.0.1");
+
+    @Test
+    void test() {
+        ReferenceConfig<GreetingsService> reference = new ReferenceConfig<>();
+        reference.setInterface(GreetingsService.class);
+
+        ReferenceConfig<QosService> qosReference1 = new ReferenceConfig<>();
+        qosReference1.setInterface(QosService.class);
+        qosReference1.setVersion("20881");
+        ReferenceConfig<QosService> qosReference2 = new ReferenceConfig<>();
+        qosReference2.setInterface(QosService.class);
+        qosReference2.setVersion("20882");
+        ReferenceConfig<QosService> qosReference3 = new ReferenceConfig<>();
+        qosReference3.setInterface(QosService.class);
+        qosReference3.setVersion("20883");
+
+        DubboBootstrap.getInstance()
+                .application(new ApplicationConfig("first-dubbo-consumer"))
+                .registry(new RegistryConfig("zookeeper://" + zookeeperHost + 
":2181?enable-empty-protection=false"))
+                .reference(reference)
+                .reference(qosReference1)
+                .reference(qosReference2)
+                .reference(qosReference3)
+                .start();
+
+        QosService qosService1 = qosReference1.get();
+        QosService qosService2 = qosReference2.get();
+        QosService qosService3 = qosReference3.get();
+
+        GreetingsService service = reference.get();
+
+        for (int i = 0; i < 100; i++) {
+            Assertions.assertEquals("hi, dubbo", service.sayHi("dubbo"));
+        }
+
+        Assertions.assertTrue(qosService1.expected());
+        Assertions.assertTrue(qosService2.expected());
+        Assertions.assertTrue(qosService3.expected());
+        Assertions.assertTrue(ConsumerAlibabaFilter.expected());
+        Assertions.assertTrue(ConsumerClusterFilter.expected());
+        Assertions.assertTrue(ConsumerFilter.expected());
+
+        Assertions.assertTrue(AlibabaRouter.isInvoked());
+        Assertions.assertTrue(ApacheRouter.isInvoked());
+        Assertions.assertTrue(ApacheStateRouter.isInvoked());
+    }
+}
diff --git a/99-integration/pom.xml b/99-integration/pom.xml
index 1f8d1ce3..ad16602d 100644
--- a/99-integration/pom.xml
+++ b/99-integration/pom.xml
@@ -63,6 +63,7 @@
         <module>dubbo-samples-test-11782</module>
         <module>dubbo-samples-test-11716</module>
         <module>dubbo-samples-test-12208</module>
+        <module>dubbo-samples-test-12376</module>
         <module>dubbo-samples-test-register</module>
         <module>dubbo-samples-test-register-3-3</module>
         <module>dubbo-samples-transaction</module>


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to