context Add test framework (#205)
diff --git a/dubbo-samples-context/case-configuration.yml b/dubbo-samples-context/case-configuration.yml
new file mode 100644
index 0000000..08d43fe
--- /dev/null
+++ b/dubbo-samples-context/case-configuration.yml
@@ -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.
+
+from: app-builtin-zookeeper.yml
+
+props:
+ project_name: dubbo-samples-context
+ main_class: org.apache.dubbo.samples.context.ContextProvider
+ zookeeper_port: 2181
+ dubbo_port: 20880
+
diff --git a/dubbo-samples-context/pom.xml b/dubbo-samples-context/pom.xml
index d1bd109..4286090 100644
--- a/dubbo-samples-context/pom.xml
+++ b/dubbo-samples-context/pom.xml
@@ -32,25 +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>
- <image.name>${project.artifactId}:${dubbo.version}</image.name>
- <java-image.name>openjdk:8</java-image.name>
- <dubbo.port>20890</dubbo.port>
- <zookeeper.port>2181</zookeeper.port>
- <main-class>org.apache.dubbo.samples.context.ContextProvider</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>
@@ -64,45 +81,13 @@
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
- <version>${spring.version}</version>
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>org.testcontainers</groupId>
- <artifactId>testcontainers</artifactId>
- <version>1.12.3</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-context/src/main/resources/spring/dubbo-context-provider.xml b/dubbo-samples-context/src/main/resources/spring/dubbo-context-provider.xml
index ea83535..b037292 100644
--- a/dubbo-samples-context/src/main/resources/spring/dubbo-context-provider.xml
+++ b/dubbo-samples-context/src/main/resources/spring/dubbo-context-provider.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="contextServiceImpl" class="org.apache.dubbo.samples.context.impl.ContextServiceImpl"/>
diff --git a/dubbo-samples-context/src/test/java/org/apache/dubbo/samples/context/ContextServiceIT.java b/dubbo-samples-context/src/test/java/org/apache/dubbo/samples/context/ContextServiceIT.java
index aa13fa9..6421ad9 100644
--- a/dubbo-samples-context/src/test/java/org/apache/dubbo/samples/context/ContextServiceIT.java
+++ b/dubbo-samples-context/src/test/java/org/apache/dubbo/samples/context/ContextServiceIT.java
@@ -20,24 +20,16 @@
import org.apache.dubbo.samples.context.api.ContextService;
import org.junit.Assert;
-import org.junit.ClassRule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-import org.testcontainers.containers.FixedHostPortGenericContainer;
-import org.testcontainers.containers.GenericContainer;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath*:/spring/dubbo-context-consumer.xml", "classpath*:/spring/dubbo-context-provider.xml"})
public class ContextServiceIT {
- @ClassRule
- public static GenericContainer zookeeper = new FixedHostPortGenericContainer("zookeeper:3.4.9")
- .withFixedExposedPort(2181, 2181);
-
-
@Autowired
private ContextService contextService;