Commit 2754a0d
authored
Cloud Run + Cloud Endpoints (GoogleCloudPlatform#3406)
Fixes GoogleCloudPlatform#3095
> It's a good idea to open an issue first for discussion.
- [x] I have followed [Sample Format Guide](https://github.com/GoogleCloudPlatform/java-docs-samples/blob/master/SAMPLE_FORMAT.md)
- [X] `pom.xml` parent set to latest `shared-configuration`
- [x] Appropriate changes to README are included in PR
- [X] API's need to be enabled to test (tell us)
- [ ] Environment Variables need to be set (ask us to set them)
- [X] **Tests** pass: `mvn clean verify` **required**
- [X] **Lint** passes: `mvn -P lint checkstyle:check` **required**
- [X] **Static Analysis**: `mvn -P lint clean compile pmd:cpd-check spotbugs:check` **advisory only**
- [X] Please **merge** this PR for me once it is approved.
<details>
<summary>mvn clean verify</summary>
<pre>
aubre@DESKTOP-F4APIAI ~/Projects/java-docs-samples/run/endpoints-v2-backend (run-endpoints)
$ mvn clean verify
[INFO] Scanning for projects...
[INFO]
[INFO] -----------------------< com.example:endpoints >------------------------
[INFO] Building rest 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ endpoints ---
[INFO] Deleting /mnt/c/Users/aubre/Projects/java-docs-samples/run/endpoints-v2-backend/target
[INFO]
[INFO] --- jacoco-maven-plugin:0.8.5:prepare-agent (default) @ endpoints ---
[INFO] argLine set to -javaagent:/mnt/c/Users/aubre/.m2/repository/org/jacoco/org.jacoco.agent/0.8.5/org.jacoco.agent-0.8.5-runtime.jar=destfile=/mnt/c/Users/aubre/Projects/java-docs-samples/run/endpoints-v2-backend/target/jacoco.ex
ec
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ endpoints ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ endpoints ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 2 source files to /mnt/c/Users/aubre/Projects/java-docs-samples/run/endpoints-v2-backend/target/classes
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ endpoints ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /mnt/c/Users/aubre/Projects/java-docs-samples/run/endpoints-v2-backend/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ endpoints ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:3.0.0-M4:test (default-test) @ endpoints ---
[INFO] No tests to run.
[INFO]
[INFO] --- jacoco-maven-plugin:0.8.5:report (report) @ endpoints ---
[INFO] Skipping JaCoCo execution due to missing execution data file.
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ endpoints ---
[INFO] Building jar: /mnt/c/Users/aubre/Projects/java-docs-samples/run/endpoints-v2-backend/target/endpoints-1.0-SNAPSHOT.jar
[INFO]
[INFO] --- spring-boot-maven-plugin:2.3.1.RELEASE:start (pre-integration-test) @ endpoints ---
[INFO] Attaching agents: []
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.3.1.RELEASE)
2020-07-22 23:44:57.590 INFO 23566 --- [ main] c.e.endpoints.EndpointsApplication : Starting EndpointsApplication on DESKTOP-F4APIAI with PID 23566 (/mnt/c/Users/aubre/Projects/java-docs-samples/run/endpoints-v2-bac
kend/target/classes started by aubre in /mnt/c/Users/aubre/Projects/java-docs-samples/run/endpoints-v2-backend)
2020-07-22 23:44:57.597 INFO 23566 --- [ main] c.e.endpoints.EndpointsApplication : No active profile set, falling back to default profiles: default
2020-07-22 23:45:01.012 INFO 23566 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2020-07-22 23:45:01.042 INFO 23566 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2020-07-22 23:45:01.042 INFO 23566 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.36]
2020-07-22 23:45:01.397 INFO 23566 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2020-07-22 23:45:01.397 INFO 23566 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 3661 ms
2020-07-22 23:45:02.025 INFO 23566 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2020-07-22 23:45:03.723 INFO 23566 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2020-07-22 23:45:03.753 INFO 23566 --- [ main] c.e.endpoints.EndpointsApplication : Started EndpointsApplication in 7.509 seconds (JVM running for 9.314)
[INFO]
[INFO] --- maven-failsafe-plugin:3.0.0-M4:integration-test (default) @ endpoints ---
[INFO] No tests to run.
[INFO]
[INFO] --- springdoc-openapi-maven-plugin:1.0:generate (integration-test) @ endpoints ---
2020-07-22 23:45:06.712 INFO 23566 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet'
2020-07-22 23:45:06.713 INFO 23566 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'
2020-07-22 23:45:06.728 INFO 23566 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 15 ms
2020-07-22 23:45:07.120 INFO 23566 --- [nio-8080-exec-1] o.springdoc.api.AbstractOpenApiResource : Init duration for springdoc-openapi is: 280 ms
[INFO]
[INFO] --- openapi-converter-maven-plugin:1.0.0-SNAPSHOT:convertOpenApiDocs (integration-test) @ endpoints ---
[INFO]
[INFO] --- spring-boot-maven-plugin:2.3.1.RELEASE:stop (post-integration-test) @ endpoints ---
[INFO] Stopping application...
2020-07-22 23:45:08.039 INFO 23566 --- [on(2)-127.0.0.1] inMXBeanRegistrar$SpringApplicationAdmin : Application shutdown requested.
2020-07-22 23:45:08.083 INFO 23566 --- [on(2)-127.0.0.1] o.s.s.concurrent.ThreadPoolTaskExecutor : Shutting down ExecutorService 'applicationTaskExecutor'
[INFO]
[INFO] --- maven-failsafe-plugin:3.0.0-M4:verify (default) @ endpoints ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 38.060 s
[INFO] Finished at: 2020-07-22T23:45:08-04:00
[INFO] ------------------------------------------------------------------------
</pre>
</details>
<details>
<summary>mvn -P lint checkstyle:check</summary>
<pre>
aubre@DESKTOP-F4APIAI ~/Projects/java-docs-samples/run/endpoints-v2-backend (run-endpoints)
$ mvn -P lint checkstyle:check
[INFO] Scanning for projects...
[INFO]
[INFO] -----------------------< com.example:endpoints >------------------------
[INFO] Building rest 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-checkstyle-plugin:3.1.1:check (default-cli) @ endpoints ---
[INFO] Starting audit...
Audit done.
[INFO] You have 0 Checkstyle violations.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 12.978 s
[INFO] Finished at: 2020-07-22T23:57:47-04:00
[INFO] ------------------------------------------------------------------------
</pre>
</details>
<details>
<summary>mvn -P lint clean compile pmd:cpd-check spotbugs:check</summary>
<pre>
aubre@DESKTOP-F4APIAI ~/Projects/java-docs-samples/run/endpoints-v2-backend (run-endpoints)
$ mvn -P lint clean compile pmd:cpd-check spotbugs:check
[INFO] Scanning for projects...
[INFO]
[INFO] -----------------------< com.example:endpoints >------------------------
[INFO] Building rest 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ endpoints ---
[INFO] Deleting /mnt/c/Users/aubre/Projects/java-docs-samples/run/endpoints-v2-backend/target
[INFO]
[INFO] --- jacoco-maven-plugin:0.8.5:prepare-agent (default) @ endpoints ---
[INFO] argLine set to -javaagent:/mnt/c/Users/aubre/.m2/repository/org/jacoco/org.jacoco.agent/0.8.5/org.jacoco.agent-0.8.5-runtime.jar=destfile=/mnt/c/Users/aubre/Projects/java-docs-samples/run/endpoints-v2-backend/target/jacoco.ex
ec
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ endpoints ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ endpoints ---
...
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 2 source files to /mnt/c/Users/aubre/Projects/java-docs-samples/run/endpoints-v2-backend/target/classes
[INFO]
[INFO] >>> spotbugs-maven-plugin:4.0.0:check (analyze-compile) > :spotbugs @ endpoints >>>
[INFO]
[INFO] --- spotbugs-maven-plugin:4.0.0:spotbugs (spotbugs) @ endpoints ---
...
[INFO] Done SpotBugs Analysis....
[INFO]
[INFO] <<< spotbugs-maven-plugin:4.0.0:check (analyze-compile) < :spotbugs @ endpoints <<<
[INFO]
[INFO]
[INFO] --- spotbugs-maven-plugin:4.0.0:check (analyze-compile) @ endpoints ---
[INFO] BugInstance size is 2
[INFO] Error size is 0
[INFO] Total bugs: 2
[ERROR] com.example.endpoints.controllers.RepeatController is a Spring endpoint (Controller) [com.example.endpoints.controllers.RepeatController] At RepeatController.java:[lines 34-40] SPRING_ENDPOINT
[ERROR] Method com.example.endpoints.controllers.RepeatController.repeat(String, Integer) passes constant String of length 1 to character overridden method [com.example.endpoints.controllers.RepeatController] At RepeatController.jav
a:[line 38] UCPM_USE_CHARACTER_PARAMETERIZED_METHOD
[INFO]
To see bug detail using the Spotbugs GUI, use the following command "mvn spotbugs:gui"
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:11 min
[INFO] Finished at: 2020-07-23T00:00:14-04:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.github.spotbugs:spotbugs-maven-plugin:4.0.0:check (analyze-compile) on project endpoints: failed with 2 bugs and 0 errors -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
</pre>
</details>
~~This pull request is **not** final. I wanted to get the functional part of the code approved before writing a detailed instructional README.~~1 parent 08ef8bf commit 2754a0d
File tree
8 files changed
+534
-0
lines changed- run/endpoints-v2-backend
- src
- main
- java/com/example/endpoints
- controllers
- resources
- test/java/com/example/controllers
8 files changed
+534
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
Lines changed: 51 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
Lines changed: 42 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
Lines changed: 15 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
0 commit comments