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

[GitHub] WillemJiang closed pull request #590: [SCB-386] Update all java chassis samples ReadMe file add "how to verify" chapter and fix small mistakes

WillemJiang closed pull request #590: [SCB-386] Update all java chassis samples ReadMe file add "how to verify" chapter and fix small mistakes
URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/590
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/samples/auth-sample/README.md b/samples/auth-sample/README.md
index fbf78217e..7f7e4b83f 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 230ea765a..c3993dddf 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.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 static void main(String[] args) throws Exception {
         "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 9ea88c305..355d67df7 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 b756ae984..f74ba6468 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 72223e767..9343f51da 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 0f3f5a6fa..f8042776a 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 6baef03ca..4b44c1501 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 8ae65f171..c2c278fab 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 15f0e0e0e..2ff14c619 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 fdb156dd1..0c9d2619c 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 d47454f5c..1571aa856 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 static void main(String[] args) throws Exception {
 
     // 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 {


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services