You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by il...@apache.org on 2019/06/26 07:46:10 UTC
[dubbo-samples] branch master updated: integration test for
dubbo-samples-local
This is an automated email from the ASF dual-hosted git repository.
iluo 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 7bc69fb integration test for dubbo-samples-local
7bc69fb is described below
commit 7bc69fb78a27ccea3e4b2f7574a0e18ba3c972d3
Author: Ian Luo <ia...@gmail.com>
AuthorDate: Wed Jun 26 15:45:03 2019 +0800
integration test for dubbo-samples-local
---
dubbo-samples-local/pom.xml | 160 +++++++--------------
.../org/apache/dubbo/samples/local/LocalDemo.java | 2 +-
.../dubbo/samples/local/impl/DemoServiceImpl.java | 2 +-
.../src/main/resources/spring/dubbo-demo.xml | 7 +-
.../apache/dubbo/samples/local/DemoServiceIT.java | 46 ++++++
5 files changed, 102 insertions(+), 115 deletions(-)
diff --git a/dubbo-samples-local/pom.xml b/dubbo-samples-local/pom.xml
index b05d61f..0a312c0 100644
--- a/dubbo-samples-local/pom.xml
+++ b/dubbo-samples-local/pom.xml
@@ -28,137 +28,63 @@
<properties>
<source.level>1.8</source.level>
<target.level>1.8</target.level>
- <dubbo.version>2.7.1</dubbo.version>
- <maven_checkstyle_version>3.0.0</maven_checkstyle_version>
- <apache-rat-plugin.version>0.12</apache-rat-plugin.version>
+ <dubbo.version>2.7.2</dubbo.version>
+ <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.apache.dubbo</groupId>
- <artifactId>dubbo-dependencies-bom</artifactId>
- <version>${dubbo.version}</version>
- <type>pom</type>
- <scope>import</scope>
- </dependency>
- </dependencies>
- </dependencyManagement>
-
<dependencies>
<dependency>
- <groupId>org.apache.curator</groupId>
- <artifactId>curator-recipes</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.zookeeper</groupId>
- <artifactId>zookeeper</artifactId>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo</artifactId>
+ <version>${dubbo.version}</version>
</dependency>
+
<dependency>
<groupId>org.apache.dubbo</groupId>
- <artifactId>dubbo</artifactId>
+ <artifactId>dubbo-dependencies-zookeeper</artifactId>
<version>${dubbo.version}</version>
+ <type>pom</type>
</dependency>
- </dependencies>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>3.7.0</version>
- <configuration>
- <source>${source.level}</source>
- <target>${target.level}</target>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.rat</groupId>
- <artifactId>apache-rat-plugin</artifactId>
- <version>${apache-rat-plugin.version}</version>
- <executions>
- <execution>
- <id>verify.rat</id>
- <phase>verify</phase>
- <goals>
- <goal>check</goal>
- </goals>
- <configuration>
- <excludes>
- <exclude>**/*.versionsBackup</exclude>
- <exclude>**/.idea/</exclude>
- <exclude>**/*.iml</exclude>
- <exclude>**/*.txt</exclude>
- <exclude>**/*.load</exclude>
- <exclude>**/*.flex</exclude>
- <exclude>**/*.fc</exclude>
- <exclude>**/*.javascript</exclude>
- <exclude>**/*.properties</exclude>
- <exclude>**/*.thrift</exclude>
- <exclude>**/*.sh</exclude>
- <exclude>**/*.bat</exclude>
- <exclude>**/*.md</exclude>
- <exclude>.git/</exclude>
- <exclude>.gitignore</exclude>
- <!-- ASF jenkins box puts the Maven repo in our root directory. -->
- <exclude>.repository/</exclude>
- <exclude>**/.settings/*</exclude>
- <exclude>**/.classpath</exclude>
- <exclude>**/.project</exclude>
- <exclude>**/target/**</exclude>
- <exclude>**/*.log</exclude>
- <exclude>CODE_OF_CONDUCT.md</exclude>
- <exclude>.codecov.yml</exclude>
- <exclude>.travis.yml</exclude>
- <exclude>PULL_REQUEST_TEMPLATE.md</exclude>
- <exclude>CONTRIBUTING.md</exclude>
- <exclude>README.md</exclude>
- <exclude>**/codestyle/*</exclude>
- <exclude>**/resources/META-INF/**</exclude>
- <exclude>**/webapp/swagger/**</exclude>
- <exclude>**/org/apache/dubbo/samples/rpc/nativethrift/api/DemoService.java</exclude>
- </excludes>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>${junit.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-test</artifactId>
+ <version>${spring.version}</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
<profiles>
<profile>
- <id>checkstyle</id>
- <activation>
- <jdk>[1.8,)</jdk>
- </activation>
+ <id>dubbo-integration-test</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-checkstyle-plugin</artifactId>
- <version>${maven_checkstyle_version}</version>
- <dependencies>
- <dependency>
- <groupId>com.puppycrawl.tools</groupId>
- <artifactId>checkstyle</artifactId>
- <version>8.9</version>
- </dependency>
- </dependencies>
+ <artifactId>maven-failsafe-plugin</artifactId>
+ <version>${maven-failsafe-plugin.version}</version>
<executions>
<execution>
- <id>checkstyle-validation</id>
- <phase>validate</phase>
- <configuration>
- <configLocation>../codestyle/checkstyle.xml</configLocation>
- <suppressionsLocation>../codestyle/checkstyle-suppressions.xml
- </suppressionsLocation>
- <encoding>UTF-8</encoding>
- <consoleOutput>true</consoleOutput>
- <failOnViolation>true</failOnViolation>
- </configuration>
<goals>
- <goal>check</goal>
+ <goal>integration-test</goal>
+ <goal>verify</goal>
</goals>
+ <configuration>
+ <includes>
+ <include>**/*IT.java</include>
+ </includes>
+ </configuration>
</execution>
</executions>
</plugin>
@@ -166,4 +92,18 @@
</build>
</profile>
</profiles>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>${maven-compiler-plugin.version}</version>
+ <configuration>
+ <source>${source.level}</source>
+ <target>${target.level}</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
</project>
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 029ef0a..249ee6d 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
@@ -27,7 +27,7 @@ public class LocalDemo {
public static void main(String[] args) {
new EmbeddedZooKeeper(2181, true).start();
- ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(new String[]{"spring/dubbo-demo.xml"});
+ ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("spring/dubbo-demo.xml");
context.start();
DemoService demoService = context.getBean("demoService", DemoService.class);
diff --git a/dubbo-samples-local/src/main/java/org/apache/dubbo/samples/local/impl/DemoServiceImpl.java b/dubbo-samples-local/src/main/java/org/apache/dubbo/samples/local/impl/DemoServiceImpl.java
index 4d850f2..19f2376 100644
--- a/dubbo-samples-local/src/main/java/org/apache/dubbo/samples/local/impl/DemoServiceImpl.java
+++ b/dubbo-samples-local/src/main/java/org/apache/dubbo/samples/local/impl/DemoServiceImpl.java
@@ -19,7 +19,7 @@
package org.apache.dubbo.samples.local.impl;
-import com.alibaba.dubbo.rpc.RpcContext;
+import org.apache.dubbo.rpc.RpcContext;
import org.apache.dubbo.samples.local.api.DemoService;
import java.text.SimpleDateFormat;
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 780aa5f..f3ad4f8 100644
--- a/dubbo-samples-local/src/main/resources/spring/dubbo-demo.xml
+++ b/dubbo-samples-local/src/main/resources/spring/dubbo-demo.xml
@@ -18,13 +18,14 @@
<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="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://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="demo-provider"/>
- <dubbo:registry address="zookeeper://127.0.0.1:2181"/>
+ <dubbo:registry address="zookeeper://${zookeeper.address:127.0.0.1}:2181"/>
<dubbo:protocol name="dubbo" port="20890"/>
diff --git a/dubbo-samples-local/src/test/java/org/apache/dubbo/samples/local/DemoServiceIT.java b/dubbo-samples-local/src/test/java/org/apache/dubbo/samples/local/DemoServiceIT.java
new file mode 100644
index 0000000..61cb87e
--- /dev/null
+++ b/dubbo-samples-local/src/test/java/org/apache/dubbo/samples/local/DemoServiceIT.java
@@ -0,0 +1,46 @@
+/*
+ * 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.local;
+
+import org.apache.dubbo.samples.local.api.DemoService;
+
+import org.junit.Assert;
+import org.junit.BeforeClass;
+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;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(locations = {"classpath:/spring/dubbo-demo.xml"})
+public class DemoServiceIT {
+ @Autowired
+ private DemoService demoService;
+
+ @BeforeClass
+ public static void setUp() throws Exception {
+ new EmbeddedZooKeeper(2181, false).start();
+ }
+
+ @Test
+ public void test() throws Exception {
+ Assert.assertTrue(demoService.sayHello("world").startsWith("Hello world"));
+ }
+
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org