This is an automated email from the ASF dual-hosted git repository.
albumenj pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/dubbo-integration-cases.git
The following commit(s) were added to refs/heads/main by this push:
new aced5f85 Add test cases to verify apache/dubbo#13560 (#5)
aced5f85 is described below
commit aced5f8545c6f8769d838ce20d7779dd8efe3b21
Author: Albumen Kevin <[email protected]>
AuthorDate: Mon Mar 11 15:56:17 2024 +0800
Add test cases to verify apache/dubbo#13560 (#5)
* Add test cases to verify apache/dubbo#13560
* Trigger
---
.../case-configuration.yml | 23 ++++
.../dubbo-samples-test-13560/case-versions.conf | 24 ++++
99-integration/dubbo-samples-test-13560/pom.xml | 134 +++++++++++++++++++++
.../apache/dubbo/samples/api/GreetingsService.java | 22 ++++
.../apache/dubbo/samples/provider/Application.java | 33 +++++
.../samples/provider/GreetingsServiceImpl.java | 28 +++++
.../samples/provider/ProviderDeployListener.java | 63 ++++++++++
.../org.apache.dubbo.common.deploy.DeployListener | 1 +
...apache.dubbo.common.deploy.ModuleDeployListener | 1 +
.../src/main/resources/dubbo.xml | 33 +++++
.../src/main/resources/log4j2.xml | 29 +++++
.../dubbo/samples/client/GreetingServiceIT.java | 42 +++++++
99-integration/pom.xml | 1 +
13 files changed, 434 insertions(+)
diff --git a/99-integration/dubbo-samples-test-13560/case-configuration.yml
b/99-integration/dubbo-samples-test-13560/case-configuration.yml
new file mode 100644
index 00000000..f3c06f5b
--- /dev/null
+++ b/99-integration/dubbo-samples-test-13560/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-13560
+ main_class: org.apache.dubbo.samples.provider.Application
+ dubbo_port: 20880
+ check_log: "dubbo service started"
diff --git a/99-integration/dubbo-samples-test-13560/case-versions.conf
b/99-integration/dubbo-samples-test-13560/case-versions.conf
new file mode 100644
index 00000000..3f3f58a0
--- /dev/null
+++ b/99-integration/dubbo-samples-test-13560/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.*
+java.version= [ >= 8 ]
diff --git a/99-integration/dubbo-samples-test-13560/pom.xml
b/99-integration/dubbo-samples-test-13560/pom.xml
new file mode 100644
index 00000000..6793b09c
--- /dev/null
+++ b/99-integration/dubbo-samples-test-13560/pom.xml
@@ -0,0 +1,134 @@
+<?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-13560</artifactId>
+ <name>Dubbo Samples Test for 13560</name>
+ <description>Dubbo Samples Test for 13560</description>
+
+ <properties>
+ <dubbo.version>3.2.11-SNAPSHOT</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>
+ <log4j2.version>2.20.0</log4j2.version>
+ <awaitility.version>4.2.0</awaitility.version>
+ <spring.version>5.1.3.RELEASE</spring.version>
+ </properties>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-framework-bom</artifactId>
+ <version>${spring.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <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>
+ <exclusions>
+ <exclusion>
+ <artifactId>logback-classic</artifactId>
+ <groupId>ch.qos.logback</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>logback-core</artifactId>
+ <groupId>ch.qos.logback</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>log4j</artifactId>
+ <groupId>log4j</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>slf4j-log4j12</artifactId>
+ <groupId>org.slf4j</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-slf4j-impl</artifactId>
+ <version>${log4j2.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>com.google.protobuf</groupId>
+ <artifactId>protobuf-java</artifactId>
+ <version>3.22.2</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.awaitility</groupId>
+ <artifactId>awaitility</artifactId>
+ <version>${awaitility.version}</version>
+ </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>
+ </dependencies>
+</project>
diff --git
a/99-integration/dubbo-samples-test-13560/src/main/java/org/apache/dubbo/samples/api/GreetingsService.java
b/99-integration/dubbo-samples-test-13560/src/main/java/org/apache/dubbo/samples/api/GreetingsService.java
new file mode 100644
index 00000000..03ab7315
--- /dev/null
+++
b/99-integration/dubbo-samples-test-13560/src/main/java/org/apache/dubbo/samples/api/GreetingsService.java
@@ -0,0 +1,22 @@
+/*
+ * 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 echo(String data);
+}
diff --git
a/99-integration/dubbo-samples-test-13560/src/main/java/org/apache/dubbo/samples/provider/Application.java
b/99-integration/dubbo-samples-test-13560/src/main/java/org/apache/dubbo/samples/provider/Application.java
new file mode 100644
index 00000000..b4868125
--- /dev/null
+++
b/99-integration/dubbo-samples-test-13560/src/main/java/org/apache/dubbo/samples/provider/Application.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.springframework.context.support.ClassPathXmlApplicationContext;
+
+import java.util.concurrent.CountDownLatch;
+
+public class Application {
+
+ public static void main(String[] args) throws InterruptedException {
+ ClassPathXmlApplicationContext context = new
ClassPathXmlApplicationContext("dubbo.xml");
+ context.start();
+
+ System.out.println("dubbo service started");
+ new CountDownLatch(1).await();
+ }
+}
diff --git
a/99-integration/dubbo-samples-test-13560/src/main/java/org/apache/dubbo/samples/provider/GreetingsServiceImpl.java
b/99-integration/dubbo-samples-test-13560/src/main/java/org/apache/dubbo/samples/provider/GreetingsServiceImpl.java
new file mode 100644
index 00000000..a34fbdcf
--- /dev/null
+++
b/99-integration/dubbo-samples-test-13560/src/main/java/org/apache/dubbo/samples/provider/GreetingsServiceImpl.java
@@ -0,0 +1,28 @@
+/*
+ * 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;
+
+public class GreetingsServiceImpl implements GreetingsService {
+ @Override
+ public String echo(String data) {
+ return data;
+ }
+
+}
diff --git
a/99-integration/dubbo-samples-test-13560/src/main/java/org/apache/dubbo/samples/provider/ProviderDeployListener.java
b/99-integration/dubbo-samples-test-13560/src/main/java/org/apache/dubbo/samples/provider/ProviderDeployListener.java
new file mode 100644
index 00000000..8cb4e0ae
--- /dev/null
+++
b/99-integration/dubbo-samples-test-13560/src/main/java/org/apache/dubbo/samples/provider/ProviderDeployListener.java
@@ -0,0 +1,63 @@
+/*
+ * 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.common.deploy.ModuleDeployListener;
+import org.apache.dubbo.config.ServiceConfigBase;
+import org.apache.dubbo.rpc.model.ModuleModel;
+
+public class ProviderDeployListener implements ModuleDeployListener {
+ @Override
+ public void onInitialize(ModuleModel scopeModel) {
+
+ }
+
+ @Override
+ public void onStarting(ModuleModel scopeModel) {
+
+ }
+
+ @Override
+ public void onStarted(ModuleModel scopeModel) {
+ // make sure the provider is exported
+ for (ServiceConfigBase service :
scopeModel.getConfigManager().getServices()) {
+ while (!service.isExported()) {
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+ }
+
+ @Override
+ public void onStopping(ModuleModel scopeModel) {
+
+ }
+
+ @Override
+ public void onStopped(ModuleModel scopeModel) {
+
+ }
+
+ @Override
+ public void onFailure(ModuleModel scopeModel, Throwable cause) {
+
+ }
+
+}
diff --git
a/99-integration/dubbo-samples-test-13560/src/main/resources/META-INF/dubbo/org.apache.dubbo.common.deploy.DeployListener
b/99-integration/dubbo-samples-test-13560/src/main/resources/META-INF/dubbo/org.apache.dubbo.common.deploy.DeployListener
new file mode 100644
index 00000000..54672ea6
--- /dev/null
+++
b/99-integration/dubbo-samples-test-13560/src/main/resources/META-INF/dubbo/org.apache.dubbo.common.deploy.DeployListener
@@ -0,0 +1 @@
+test=org.apache.dubbo.samples.provider.ProviderDeployListener
diff --git
a/99-integration/dubbo-samples-test-13560/src/main/resources/META-INF/dubbo/org.apache.dubbo.common.deploy.ModuleDeployListener
b/99-integration/dubbo-samples-test-13560/src/main/resources/META-INF/dubbo/org.apache.dubbo.common.deploy.ModuleDeployListener
new file mode 100644
index 00000000..54672ea6
--- /dev/null
+++
b/99-integration/dubbo-samples-test-13560/src/main/resources/META-INF/dubbo/org.apache.dubbo.common.deploy.ModuleDeployListener
@@ -0,0 +1 @@
+test=org.apache.dubbo.samples.provider.ProviderDeployListener
diff --git
a/99-integration/dubbo-samples-test-13560/src/main/resources/dubbo.xml
b/99-integration/dubbo-samples-test-13560/src/main/resources/dubbo.xml
new file mode 100644
index 00000000..9cf71f3a
--- /dev/null
+++ b/99-integration/dubbo-samples-test-13560/src/main/resources/dubbo.xml
@@ -0,0 +1,33 @@
+<?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.
+ -->
+
+<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:dubbo="http://dubbo.apache.org/schema/dubbo"
+ xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://dubbo.apache.org/schema/dubbo
http://dubbo.apache.org/schema/dubbo/dubbo.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd">
+ <context:property-placeholder/>
+
+ <dubbo:application name="merge-consumer"/>
+
+ <dubbo:registry address="zookeeper://${zookeeper.address:127.0.0.1}:2181"/>
+
+ <bean id="greeting"
class="org.apache.dubbo.samples.provider.GreetingsServiceImpl"/>
+ <dubbo:service interface="org.apache.dubbo.samples.api.GreetingsService"
ref="greeting" delay="3000"/>
+
+</beans>
diff --git
a/99-integration/dubbo-samples-test-13560/src/main/resources/log4j2.xml
b/99-integration/dubbo-samples-test-13560/src/main/resources/log4j2.xml
new file mode 100644
index 00000000..69e1321d
--- /dev/null
+++ b/99-integration/dubbo-samples-test-13560/src/main/resources/log4j2.xml
@@ -0,0 +1,29 @@
+<?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.
+ -->
+<Configuration status="WARN">
+ <Appenders>
+ <Console name="Console" target="SYSTEM_OUT" follow="true">
+ <PatternLayout pattern="%style{%d{HH:mm:ss.SSS}}{Magenta}
%style{|-}{White}%highlight{%-5p} [%t] %style{%40.40c}{Cyan}:%style{%-3L}{Blue}
%style{-|}{White}
%m%n%rEx{filters(jdk.internal.reflect,java.lang.reflect,sun.reflect)}"
disableAnsi="false" charset="UTF-8"/>
+ </Console>
+ </Appenders>
+ <Loggers>
+ <Root level="info">
+ <AppenderRef ref="Console"/>
+ </Root>
+ </Loggers>
+</Configuration>
diff --git
a/99-integration/dubbo-samples-test-13560/src/test/java/org/apache/dubbo/samples/client/GreetingServiceIT.java
b/99-integration/dubbo-samples-test-13560/src/test/java/org/apache/dubbo/samples/client/GreetingServiceIT.java
new file mode 100644
index 00000000..d74ff1f2
--- /dev/null
+++
b/99-integration/dubbo-samples-test-13560/src/test/java/org/apache/dubbo/samples/client/GreetingServiceIT.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.client;
+
+import org.apache.dubbo.config.ApplicationConfig;
+import org.apache.dubbo.config.ReferenceConfig;
+import org.apache.dubbo.config.RegistryConfig;
+import org.apache.dubbo.rpc.model.FrameworkModel;
+import org.apache.dubbo.samples.api.GreetingsService;
+
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+public class GreetingServiceIT {
+ private static String zookeeperHost =
System.getProperty("zookeeper.address", "127.0.0.1");
+
+ @Test
+ public void test1() {
+ ReferenceConfig<GreetingsService> referenceConfig = new
ReferenceConfig<>();
+ referenceConfig.setApplication(new
ApplicationConfig("first-dubbo-consumer"));
+ referenceConfig.setRegistry(new RegistryConfig("zookeeper://" +
zookeeperHost + ":2181"));
+ referenceConfig.setInterface(GreetingsService.class);
+ GreetingsService greetingsService = referenceConfig.get();
+ Assertions.assertEquals("World", greetingsService.echo("World"));
+ FrameworkModel.destroyAll();
+ }
+}
diff --git a/99-integration/pom.xml b/99-integration/pom.xml
index 0993646a..643658d1 100644
--- a/99-integration/pom.xml
+++ b/99-integration/pom.xml
@@ -84,6 +84,7 @@
<module>dubbo-samples-test-13441-5</module>
<module>dubbo-samples-test-13441-6</module>
<module>dubbo-samples-test-13441-7</module>
+ <module>dubbo-samples-test-13560</module>
<module>dubbo-samples-test-13580</module>
<module>dubbo-samples-test-13751</module>
<module>dubbo-samples-test-register</module>