Add sample local test case (#194)
diff --git a/dubbo-samples-local/case-configuration.yml b/dubbo-samples-local/case-configuration.yml
new file mode 100644
index 0000000..5eb95cd
--- /dev/null
+++ b/dubbo-samples-local/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-builtin-zookeeper.yml
+
+props:
+ project_name: dubbo-samples-local
+ main_class: org.apache.dubbo.samples.local.LocalDemo
+ zookeeper_port: 2181
+ dubbo_port: 20880
diff --git a/dubbo-samples-local/pom.xml b/dubbo-samples-local/pom.xml
index a55fe2a..fde1abe 100644
--- a/dubbo-samples-local/pom.xml
+++ b/dubbo-samples-local/pom.xml
@@ -32,21 +32,42 @@
<spring.version>4.3.16.RELEASE</spring.version>
<junit.version>4.12</junit.version>
<maven-compiler-plugin.version>3.7.0</maven-compiler-plugin.version>
- <maven-failsafe-plugin.version>2.21.0</maven-failsafe-plugin.version>
- <main-class>org.apache.dubbo.samples.http.HttpProvider</main-class>
</properties>
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-framework-bom</artifactId>
+ <version>${spring.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-bom</artifactId>
+ <version>${dubbo.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-dependencies-zookeeper</artifactId>
+ <version>${dubbo.version}</version>
+ <type>pom</type>
+ </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</artifactId>
- <version>${dubbo.version}</version>
<type>pom</type>
</dependency>
@@ -60,37 +81,11 @@
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
- <version>${spring.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<profiles>
- <profile>
- <id>dubbo-integration-test</id>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-failsafe-plugin</artifactId>
- <version>${maven-failsafe-plugin.version}</version>
- <executions>
- <execution>
- <goals>
- <goal>integration-test</goal>
- <goal>verify</goal>
- </goals>
- <configuration>
- <includes>
- <include>**/*IT.java</include>
- </includes>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
<!-- For jdk 11 above JavaEE annotation -->
<profile>
<id>javax.annotation</id>
diff --git a/dubbo-samples-local/src/main/java/org/apache/dubbo/samples/local/LocalDemo.java b/dubbo-samples-local/src/main/java/org/apache/dubbo/samples/local/LocalDemo.java
index 249ee6d..fa6b0e0 100644
--- a/dubbo-samples-local/src/main/java/org/apache/dubbo/samples/local/LocalDemo.java
+++ b/dubbo-samples-local/src/main/java/org/apache/dubbo/samples/local/LocalDemo.java
@@ -23,9 +23,11 @@
import org.springframework.context.support.ClassPathXmlApplicationContext;
+import java.util.concurrent.CountDownLatch;
+
public class LocalDemo {
- public static void main(String[] args) {
+ public static void main(String[] args) throws InterruptedException {
new EmbeddedZooKeeper(2181, true).start();
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("spring/dubbo-demo.xml");
context.start();
@@ -33,5 +35,6 @@
DemoService demoService = context.getBean("demoService", DemoService.class);
String hello = demoService.sayHello("world");
System.out.println(hello);
+ new CountDownLatch(1).await();
}
}
diff --git a/dubbo-samples-local/src/main/resources/spring/dubbo-demo.xml b/dubbo-samples-local/src/main/resources/spring/dubbo-demo.xml
index f3ad4f8..6f33dbf 100644
--- a/dubbo-samples-local/src/main/resources/spring/dubbo-demo.xml
+++ b/dubbo-samples-local/src/main/resources/spring/dubbo-demo.xml
@@ -27,7 +27,7 @@
<dubbo:registry address="zookeeper://${zookeeper.address:127.0.0.1}:2181"/>
- <dubbo:protocol name="dubbo" port="20890"/>
+ <dubbo:protocol name="dubbo" port="20880"/>
<bean id="target" class="org.apache.dubbo.samples.local.impl.DemoServiceImpl"/>