You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by ni...@apache.org on 2018/03/13 01:06:30 UTC

[incubator-servicecomb-java-chassis] branch master updated: SCB-386 Update all java chassis samples ReadMe file add "how to verify" chapter (#590)

This is an automated email from the ASF dual-hosted git repository.

ningjiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-servicecomb-java-chassis.git


The following commit(s) were added to refs/heads/master by this push:
     new 0c2e8d5  SCB-386 Update all java chassis samples ReadMe file add "how to verify" chapter (#590)
0c2e8d5 is described below

commit 0c2e8d55f10e55174427429f58376a06be9cf5b2
Author: zhengyangyong <ya...@huawei.com>
AuthorDate: Tue Mar 13 09:06:28 2018 +0800

    SCB-386 Update all java chassis samples ReadMe file add "how to verify" chapter (#590)
---
 samples/auth-sample/README.md                             | 11 ++++++++++-
 .../samples/springmvc/consumer/AuthConsumerMain.java      |  5 ++---
 .../auth-provider/src/main/resources/microservice.yaml    |  2 +-
 samples/codefirst-sample/README.md                        | 15 ++++++++++++++-
 samples/custom-handler-sample/README.md                   | 11 ++++++++++-
 samples/jaxrs-sample/README.md                            | 11 ++++++++++-
 samples/metrics-extend-healthcheck/pom.xml                |  9 +++++++++
 .../metrics-write-file-log4j2-springboot/pom.xml          |  9 +++++++++
 samples/pojo-sample/README.md                             | 10 ++++++++++
 samples/springmvc-sample/README.md                        | 13 ++++++++++++-
 .../samples/springmvc/consumer/SpringmvcConsumerMain.java |  2 +-
 11 files changed, 88 insertions(+), 10 deletions(-)

diff --git a/samples/auth-sample/README.md b/samples/auth-sample/README.md
index fbf7821..7f7e4b8 100644
--- a/samples/auth-sample/README.md
+++ b/samples/auth-sample/README.md
@@ -88,4 +88,13 @@ Auth sample use `RestTemplate` to present RSA communication between provider and
    mvn exec:java -Dexec.mainClass="org.apache.servicecomb.samples.springmvc.consumer.AuthConsumerMain"
    ```
 
-   ​
\ No newline at end of file
+4. How to verify
+   On the producer side, the output should contain the following stuffs if the producer starts up successfully:
+   1. *'swagger: 2.0 info: version: 1.0.0 ...'* means the producer generated swagger contracts
+   2. *'rest listen success. address=0.0.0.0:8080'* means the rest endpoint is listening on port 8080
+   3. *'highway listen success. address=0.0.0.0:7070'* means the highway endpoint is listening on port 7070
+   4. *'Register microservice instance success'* means the producer has registered successfully to service center
+   
+   On the consumer side, you can see the following outputs if the consumer can invoke the producer:
+   1. *'Hello Authenticate'* means the consumer calls sayhi with name=Authenticate successfully
+   2. *'Hello person ServiceComb/Authenticate'* means the consumer calls sayhello successfully
\ No newline at end of file
diff --git a/samples/auth-sample/auth-consumer/src/main/java/org/apache/servicecomb/samples/springmvc/consumer/AuthConsumerMain.java b/samples/auth-sample/auth-consumer/src/main/java/org/apache/servicecomb/samples/springmvc/consumer/AuthConsumerMain.java
index 230ea76..c3993dd 100644
--- a/samples/auth-sample/auth-consumer/src/main/java/org/apache/servicecomb/samples/springmvc/consumer/AuthConsumerMain.java
+++ b/samples/auth-sample/auth-consumer/src/main/java/org/apache/servicecomb/samples/springmvc/consumer/AuthConsumerMain.java
@@ -21,7 +21,6 @@ import org.apache.servicecomb.foundation.common.utils.Log4jUtils;
 import org.apache.servicecomb.provider.springmvc.reference.RestTemplateBuilder;
 import org.apache.servicecomb.samples.common.schema.models.Person;
 import org.springframework.stereotype.Component;
-import org.springframework.util.Assert;
 import org.springframework.web.client.RestTemplate;
 
 @Component
@@ -44,8 +43,8 @@ public class AuthConsumerMain {
         "cse://auth-provider/springmvchello/sayhello",
         person,
         String.class);
-    Assert.isTrue("Hello Authenticate".equals(sayHiResult));
-    Assert.isTrue("Hello person ServiceComb/Authenticate".equals(sayHelloResult));
+    System.out.println(sayHiResult);
+    System.out.println(sayHelloResult);
   }
 
   public static void init() throws Exception {
diff --git a/samples/auth-sample/auth-provider/src/main/resources/microservice.yaml b/samples/auth-sample/auth-provider/src/main/resources/microservice.yaml
index 9ea88c3..355d67d 100644
--- a/samples/auth-sample/auth-provider/src/main/resources/microservice.yaml
+++ b/samples/auth-sample/auth-provider/src/main/resources/microservice.yaml
@@ -28,6 +28,6 @@ cse:
       Provider:
         default: auth-provider
   rest:
-    address: 0.0.0.0:8082
+    address: 0.0.0.0:8080
   highway:
     address: 0.0.0.0:7070
diff --git a/samples/codefirst-sample/README.md b/samples/codefirst-sample/README.md
index b756ae9..f74ba64 100644
--- a/samples/codefirst-sample/README.md
+++ b/samples/codefirst-sample/README.md
@@ -48,4 +48,17 @@ For detail information please refer to [Doc](http://servicecomb.incubator.apache
    mvn exec:java -Dexec.mainClass="org.apache.servicecomb.samples.codefirst.consumer.CodeFirstConsumerMain"
    ```
 
-   ​
\ No newline at end of file
+4. How to verify
+   On the producer side, the output should contain the following stuffs if the producer starts up successfully:
+   1. *'swagger: 2.0 info: version: 1.0.0 ...'* means the producer generated swagger contracts
+   2. *'rest listen success. address=0.0.0.0:8080'* means the rest endpoint is listening on port 8080
+   3. *'highway listen success. address=0.0.0.0:7070'* means the highway endpoint is listening on port 7070
+   4. *'Register microservice instance success'* means the producer has registered successfully to service center
+   
+   On the consumer side, you can see the following outputs if the consumer can invoke the producer:
+   1. *'Pojo Hello Java Chassis'* means the consumer calls sayhi successfully 
+   2. *'Jaxrs Hello Java Chassis'* means the consumer calls Jaxrs sayhi successfully
+   3. *'Spring mvc Hello Java Chassis'* means the consumer calls SpringMvc sayhi successfully
+   4. *'Pojo Hello person ServiceComb/Java Chassis'* means the consumer calls sayhello successfully
+   5. *'Jaxrs Hello person ServiceComb/Java Chassis'* means the consumer calls Jaxrs sayhello successfully
+   6. *'Spring mvc Hello person ServiceComb/Java Chassis'* means the consumer calls SpringMvc sayhello successfully
\ No newline at end of file
diff --git a/samples/custom-handler-sample/README.md b/samples/custom-handler-sample/README.md
index 72223e7..9343f51 100644
--- a/samples/custom-handler-sample/README.md
+++ b/samples/custom-handler-sample/README.md
@@ -79,4 +79,13 @@ ServiceComb support users to define a customized handler and and invoke the hand
    mvn exec:java -Dexec.mainClass="org.apache.servicecomb.samples.customerhandler.consumer.CustomHandlerCustomerMain"
    ```
 
-   ​
\ No newline at end of file
+4. How to verify
+   On the producer side, the output should contain the following stuffs if the producer starts up successfully:
+   1. *'swagger: 2.0 info: version: 1.0.0 ...'* means the producer generated swagger contracts
+   2. *'rest listen success. address=0.0.0.0:8080'* means the rest endpoint is listening on port 8080
+   3. *'highway listen success. address=0.0.0.0:7070'* means the highway endpoint is listening on port 7070
+   4. *'Register microservice instance success'* means the producer has registered successfully to service center
+   
+   On the consumer side, you can see the following outputs:
+   1. *'It's my handler!'* means custom handler had take effect
+  
\ No newline at end of file
diff --git a/samples/jaxrs-sample/README.md b/samples/jaxrs-sample/README.md
index 0f3f5a6..f804277 100644
--- a/samples/jaxrs-sample/README.md
+++ b/samples/jaxrs-sample/README.md
@@ -55,4 +55,13 @@ To consume a provider-service, only need to decalare a member of a service API t
    mvn exec:java -Dexec.mainClass="org.apache.servicecomb.samples.jaxrs.consumer.JaxrsConsumerMain"
    ```
 
-   ​
\ No newline at end of file
+4. How to verify
+   On the producer side, the output should contain the following stuffs if the producer starts up successfully:
+   1. *'swagger: 2.0 info: version: 1.0.0 ...'* means the producer generated swagger contracts
+   2. *'rest listen success. address=0.0.0.0:8080'* means the rest endpoint is listening on port 8080
+   3. *'highway listen success. address=0.0.0.0:7070'* means the highway endpoint is listening on port 7070
+   4. *'Register microservice instance success'* means the producer has registered successfully to service center
+   
+   On the consumer side, you can see the following outputs if the consumer can invoke the producer:
+   1. *'Hello Java Chassis'* means the consumer calls sayhi by RpcReference successfully
+   2. *'Hello person ServiceComb/Java Chassis'* means the consumer calls sayhello by RpcReference successfully
\ No newline at end of file
diff --git a/samples/metrics-extend-healthcheck/pom.xml b/samples/metrics-extend-healthcheck/pom.xml
index 6baef03..4b44c15 100644
--- a/samples/metrics-extend-healthcheck/pom.xml
+++ b/samples/metrics-extend-healthcheck/pom.xml
@@ -50,4 +50,13 @@
       <artifactId>metrics-core</artifactId>
     </dependency>
   </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-maven-plugin</artifactId>
+      </plugin>
+    </plugins>
+  </build>
 </project>
diff --git a/samples/metrics-write-file-sample/metrics-write-file-log4j2-springboot/pom.xml b/samples/metrics-write-file-sample/metrics-write-file-log4j2-springboot/pom.xml
index 8ae65f1..c2c278f 100644
--- a/samples/metrics-write-file-sample/metrics-write-file-log4j2-springboot/pom.xml
+++ b/samples/metrics-write-file-sample/metrics-write-file-log4j2-springboot/pom.xml
@@ -70,4 +70,13 @@
       <artifactId>metrics-write-file</artifactId>
     </dependency>
   </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-maven-plugin</artifactId>
+      </plugin>
+    </plugins>
+  </build>
 </project>
diff --git a/samples/pojo-sample/README.md b/samples/pojo-sample/README.md
index 15f0e0e..2ff14c6 100644
--- a/samples/pojo-sample/README.md
+++ b/samples/pojo-sample/README.md
@@ -78,4 +78,14 @@ public class CodeFirstConsumerMain {
    mvn exec:java -Dexec.mainClass="org.apache.servicecomb.samples.pojo.consumer.PojoConsumerMain"
    ```
 
+4. How to verify
+   On the producer side, the output should contain the following stuffs if the producer starts up successfully:
+   1. *'swagger: 2.0 info: version: 1.0.0 ...'* means the producer generated swagger contracts
+   2. *'rest listen success. address=0.0.0.0:8080'* means the rest endpoint is listening on port 8080
+   3. *'highway listen success. address=0.0.0.0:7070'* means the highway endpoint is listening on port 7070
+   4. *'Register microservice instance success'* means the producer has registered successfully to service center
+   
+   On the consumer side, you can see the following outputs if the consumer can invoke the producer:
+   1. *'Hello person ServiceComb/Java Chassis'* means the consumer calls sayHello by RpcReference successfully
+   2. *'a=1, b=2, result=3'* means the consumer calls compute.add by RpcReference successfully
    ​
\ No newline at end of file
diff --git a/samples/springmvc-sample/README.md b/samples/springmvc-sample/README.md
index fdb156d..0c9d261 100644
--- a/samples/springmvc-sample/README.md
+++ b/samples/springmvc-sample/README.md
@@ -45,8 +45,19 @@
    mvn exec:java -Dexec.mainClass="org.apache.servicecomb.samples.springmvc.consumer.SpringmvcConsumerMain"
    ```
 
+4. How to verify
+   On the producer side, the output should contain the following stuffs if the producer starts up successfully:
+   1. *'swagger: 2.0 info: version: 1.0.0 ...'* means the producer generated swagger contracts
+   2. *'rest listen success. address=0.0.0.0:8080'* means the rest endpoint is listening on port 8080
+   3. *'highway listen success. address=0.0.0.0:7070'* means the highway endpoint is listening on port 7070
+   4. *'Register microservice instance success'* means the producer has registered successfully to service center
+   
+   On the consumer side, you can see the following outputs if the consumer can invoke the producer:
+   1. *'RestTemplate consumer sayhi services: Hello Java Chassis'* means the consumer calls sayhi by RestTemplate successfully
+   2. *'RestTemplate consumer sayhello services: Hello person ServiceComb/Java Chassis'* means the consumer calls sayhello by RestTemplate successfully
+   3. *'POJO consumer sayhi services: Hello Java Chassis'* means the consumer calls sayhi by RpcReference successfully
+   4. *'POJO consumer sayhello services: Hello person ServiceComb/Java Chassis'* means the consumer calls sayhello by RpcReference successfully
    ​
-
 ## More
 
 [Develop with RestTemplate](http://servicecomb.incubator.apache.org/users/develop-with-rest-template/)
\ No newline at end of file
diff --git a/samples/springmvc-sample/springmvc-consumer/src/main/java/org/apache/servicecomb/samples/springmvc/consumer/SpringmvcConsumerMain.java b/samples/springmvc-sample/springmvc-consumer/src/main/java/org/apache/servicecomb/samples/springmvc/consumer/SpringmvcConsumerMain.java
index d47454f..1571aa8 100644
--- a/samples/springmvc-sample/springmvc-consumer/src/main/java/org/apache/servicecomb/samples/springmvc/consumer/SpringmvcConsumerMain.java
+++ b/samples/springmvc-sample/springmvc-consumer/src/main/java/org/apache/servicecomb/samples/springmvc/consumer/SpringmvcConsumerMain.java
@@ -49,7 +49,7 @@ public class SpringmvcConsumerMain {
 
     // POJO Consumer
     System.out.println("POJO consumer sayhi services: " + hello.sayHi("Java Chassis"));
-    System.out.println("POJO consumer sayhi services: " + hello.sayHello(person));
+    System.out.println("POJO consumer sayhello services: " + hello.sayHello(person));
   }
 
   public static void init() throws Exception {

-- 
To stop receiving notification emails like this one, please contact
ningjiang@apache.org.