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/04 07:54:28 UTC

[dubbo-samples] branch master updated: a first integration test based on docker env

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 ab50fd1  a first integration test based on docker env
ab50fd1 is described below

commit ab50fd11d4cde79116fa78a8792e893d170bf935
Author: Ian Luo <ia...@gmail.com>
AuthorDate: Tue Jun 4 15:54:03 2019 +0800

    a first integration test based on docker env
---
 dubbo-samples-api/pom.xml                          | 98 +++++++++++++++++++++-
 .../dubbo/samples/provider/ApplicationIT.java      | 40 +++++++++
 2 files changed, 137 insertions(+), 1 deletion(-)

diff --git a/dubbo-samples-api/pom.xml b/dubbo-samples-api/pom.xml
index 4463575..442e55b 100644
--- a/dubbo-samples-api/pom.xml
+++ b/dubbo-samples-api/pom.xml
@@ -29,7 +29,7 @@
     <properties>
         <source.level>1.8</source.level>
         <target.level>1.8</target.level>
-        <dubbo.version>2.7.0</dubbo.version>
+        <dubbo.version>2.7.2-SNAPSHOT</dubbo.version>
     </properties>
 
     <dependencies>
@@ -38,6 +38,13 @@
             <artifactId>dubbo</artifactId>
             <version>${dubbo.version}</version>
         </dependency>
+
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>4.12</version>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 
     <build>
@@ -51,6 +58,95 @@
                     <target>${target.level}</target>
                 </configuration>
             </plugin>
+
+
+            <plugin>
+                <groupId>com.google.cloud.tools</groupId>
+                <artifactId>jib-maven-plugin</artifactId>
+                <version>1.2.0</version>
+                <configuration>
+                    <from>
+                        <image>gcr.io/distroless/java:debug</image>
+                    </from>
+                    <to>
+                        <image>dubbo-samples-api:${dubbo.version}</image>
+                    </to>
+                    <container>
+                        <jvmFlags>
+                            <jvmFlag>-Djava.net.preferIPv4Stack=true</jvmFlag>
+                        </jvmFlags>
+                        <mainClass>org.apache.dubbo.samples.provider.Application</mainClass>
+                        <ports>
+                            <port>20880</port>
+                        </ports>
+                    </container>
+                </configuration>
+                <executions>
+                    <execution>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>dockerBuild</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+
+            <plugin>
+                <groupId>io.fabric8</groupId>
+                <artifactId>docker-maven-plugin</artifactId>
+                <version>0.30.0</version>
+                <configuration>
+                    <images>
+                        <image>
+                            <name>dubbo-samples-api:${dubbo.version}</name>
+                            <run>
+                                <ports>
+                                    <port>20880:20880</port>
+                                </ports>
+                            </run>
+                        </image>
+                    </images>
+                </configuration>
+                <executions>
+                    <execution>
+                        <id>start</id>
+                        <phase>pre-integration-test</phase>
+                        <goals>
+                            <goal>start</goal>
+                        </goals>
+                    </execution>
+                    <execution>
+                        <id>stop</id>
+                        <phase>post-integration-test</phase>
+                        <goals>
+                            <goal>stop</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+
+
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-failsafe-plugin</artifactId>
+                <version>3.0.0-M3</version>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>integration-test</goal>
+                            <goal>verify</goal>
+                        </goals>
+                        <configuration>
+                            <systemPropertyVariables>
+                                <java.net.preferIPv4Stack>true</java.net.preferIPv4Stack>
+                            </systemPropertyVariables>
+                            <includes>
+                                <include>**/*IT.*</include>
+                            </includes>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
         </plugins>
     </build>
 </project>
diff --git a/dubbo-samples-api/src/test/java/org/apache/dubbo/samples/provider/ApplicationIT.java b/dubbo-samples-api/src/test/java/org/apache/dubbo/samples/provider/ApplicationIT.java
new file mode 100644
index 0000000..f576820
--- /dev/null
+++ b/dubbo-samples-api/src/test/java/org/apache/dubbo/samples/provider/ApplicationIT.java
@@ -0,0 +1,40 @@
+/*
+ * 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.ReferenceConfig;
+import org.apache.dubbo.config.RegistryConfig;
+import org.apache.dubbo.samples.api.GreetingsService;
+
+import junit.framework.TestCase;
+import org.junit.Test;
+
+public class ApplicationIT {
+
+    @Test
+    public void test() {
+        ReferenceConfig<GreetingsService> reference = new ReferenceConfig<>();
+        reference.setApplication(new ApplicationConfig("first-dubbo-consumer"));
+        reference.setRegistry(new RegistryConfig("multicast://224.5.6.7:1234"));
+        reference.setInterface(GreetingsService.class);
+        GreetingsService service = reference.get();
+        String message = service.sayHi("dubbo");
+        TestCase.assertEquals(message, "hi, dubbo");
+    }
+}


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org