networknt / light-example-4j Goto Github PK
View Code? Open in Web Editor NEWExample APIs or services to demo all feature of the light-4j framework
License: Apache License 2.0
Example APIs or services to demo all feature of the light-4j framework
License: Apache License 2.0
Which environment uses for benchmarks (OS, memory, cpu, java version)? What about moving benchmarks execution inside vm/containers with constant OS, resources for +- reproducible benchmarks?
In the light-bot integration test, we need to use a different port for different servers so that they won't conflict each other. This is due to we have implemented the graceful shutdown in the server and the previous server might not have been shut down completely when you start another one with the same port.
The relaytodo cannot be upgraded without code change. Need more time to see what are the broken changes in 3.0.0.
The documentation refers to some database examples, but they're missing from the repository.
They can be restored from git history with the following:
git checkout 2bd8e8c -- database
Seems like they need to be upgraded to the most recent version of light-4j. I could take a look at this if you want.
It would be good to move performance
out of light-java-example
I believe a lot of person fork the repository only because of the performance
benchmark set
From 0.1.7 so that all projects are using 0.1.10 and we can use light-bot to update all of them to the latest version with regex-replace task.
The image names are changed due to build.sh script.
https://www.techempower.com/benchmarks/
It's fun to run your own benchmark, but this is pretty much the standard now since it actually cover some semi-real world use cases.
23:10:21.601 [main] ERROR com.networknt.tram.todolist.command.TodoRepositoryImpl - SqlException:
org.h2.jdbc.JdbcSQLException: Schema "TODO_DB" not found; SQL statement:
INSERT INTO todo_db.TODO (ID, TITLE, COMPLETED, ORDER_ID) VALUES (?, ?, ?, ?) [90079-176]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:344)
at org.h2.message.DbException.get(DbException.java:178)
at org.h2.message.DbException.get(DbException.java:154)
at org.h2.command.Parser.getSchema(Parser.java:655)
at org.h2.command.Parser.getSchema(Parser.java:662)
at org.h2.command.Parser.readTableOrView(Parser.java:5196)
at org.h2.command.Parser.readTableOrView(Parser.java:5190)
at org.h2.command.Parser.parseInsert(Parser.java:1024)
at org.h2.command.Parser.parsePrepared(Parser.java:402)
at org.h2.command.Parser.parse(Parser.java:306)
at org.h2.command.Parser.parse(Parser.java:278)
at org.h2.command.Parser.prepareCommand(Parser.java:243)
at org.h2.engine.Session.prepareLocal(Session.java:442)
at org.h2.engine.Session.prepareCommand(Session.java:384)
at org.h2.jdbc.JdbcConnection.prepareCommand(JdbcConnection.java:1188)
at org.h2.jdbc.JdbcPreparedStatement.<init>(JdbcPreparedStatement.java:73)
at org.h2.jdbc.JdbcConnection.prepareStatement(JdbcConnection.java:276)
at com.zaxxer.hikari.pool.ProxyConnection.prepareStatement(ProxyConnection.java:312)
at com.zaxxer.hikari.pool.HikariProxyConnection.prepareStatement(HikariProxyConnection.java)
at com.networknt.tram.todolist.command.TodoRepositoryImpl.save(TodoRepositoryImpl.java:77)
at com.networknt.tram.todolist.CommandModuleTest.testUpdate(CommandModuleTest.java:56)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
java.lang.NullPointerException
at com.networknt.tram.todolist.CommandModuleTest.testUpdate(CommandModuleTest.java:58)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
instead of using real IP address, use environment variable for more flexibility.
add comments on the API for java doc API document
Hi @stevehu ,
I can start some example light-4j from my localhost, but for docker container, I tried to "docker exec" into its container but no lucky.
I see that containers of light-4j inherits from insideo:uc-linux, and I found it support bash command line, I tried these things below:
docker exec -it bash
docker exec -it /bin/bash
docker exec -it /tools/bash
Can you shed some light on it? Thanks.
Cannot pass the unit test cases.
For the performance tests. I am not sure if it is fair for the containers which use dependency injection to not use @singleton or similar annotation to prevent redundant instances of the resource.
Looking specifically at: https://github.com/networknt/light-java-example/blob/master/performance/dropwizard/src/main/java/com/mycompany/HelloWorldResource.java
I followed the directions for the light-example-4j/eventuate/account-management/ demo. I got the following error. The error was consistent on a new Ubuntu VM as well as a Linux Mint laptop.
[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO] Inspecting build with total of 10 modules...
[INFO] Installing Nexus Staging features:
[INFO] ... total of 10 executions of maven-deploy-plugin replaced with nexus-staging-maven-plugin
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] Parent POM
[INFO] eventuate-account-common
[INFO] eventuate-account-command
[INFO] eventuate-account-query
[INFO] eventuate-account-e2etest
[INFO] eventuate-account-service
[INFO] eventuate-account-view-service
[INFO] eventuate-customer-service
[INFO] eventuate-customer-view-service
[INFO] eventuate-transaction-service
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Parent POM 0.1.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ light-eventuate-account ---
[INFO] Deleting /home/jtang/data/shared/light-4j/light-example-4j/eventuate/account-management/target
[INFO]
[INFO] --- jacoco-maven-plugin:0.7.4.201502262128:prepare-agent (pre-unit-test) @ light-eventuate-account ---
[INFO] surefireArgLine set to -javaagent:/home/jtang/.m2/repository/org/jacoco/org.jacoco.agent/0.7.4.201502262128/org.jacoco.agent-0.7.4.201502262128-runtime.jar=destfile=/home/jtang/data/shared/light-4j/light-example-4j/eventuate/account-management/target/jacoco.exec
[INFO]
[INFO] --- jacoco-maven-plugin:0.7.4.201502262128:report (post-unit-test) @ light-eventuate-account ---
[INFO] Skipping JaCoCo execution due to missing execution data file:/home/jtang/data/shared/light-4j/light-example-4j/eventuate/account-management/target/jacoco.exec
[INFO]
[INFO] --- maven-jar-plugin:2.6:test-jar (default) @ light-eventuate-account ---
[WARNING] JAR will be empty - no content was marked for inclusion!
[INFO] Building jar: /home/jtang/data/shared/light-4j/light-example-4j/eventuate/account-management/target/light-eventuate-account-0.1.0-tests.jar
[INFO]
[INFO] >>> maven-source-plugin:3.0.1:jar (attach-sources) > generate-sources @ light-eventuate-account >>>
[INFO]
[INFO] --- jacoco-maven-plugin:0.7.4.201502262128:prepare-agent (pre-unit-test) @ light-eventuate-account ---
[INFO] surefireArgLine set to -javaagent:/home/jtang/.m2/repository/org/jacoco/org.jacoco.agent/0.7.4.201502262128/org.jacoco.agent-0.7.4.201502262128-runtime.jar=destfile=/home/jtang/data/shared/light-4j/light-example-4j/eventuate/account-management/target/jacoco.exec
[INFO]
[INFO] <<< maven-source-plugin:3.0.1:jar (attach-sources) < generate-sources @ light-eventuate-account <<<
[INFO]
[INFO] --- maven-source-plugin:3.0.1:jar (attach-sources) @ light-eventuate-account ---
[INFO]
[INFO] --- maven-javadoc-plugin:2.10.4:jar (attach-javadocs) @ light-eventuate-account ---
[INFO] Not executing Javadoc as the project is not a Java classpath-capable package
[INFO]
[INFO] --- maven-install-plugin:2.5.2:install (default-install) @ light-eventuate-account ---
[INFO] Installing /home/jtang/data/shared/light-4j/light-example-4j/eventuate/account-management/pom.xml to /home/jtang/.m2/repository/com/networknt/light-eventuate-account/0.1.0/light-eventuate-account-0.1.0.pom
[INFO] Installing /home/jtang/data/shared/light-4j/light-example-4j/eventuate/account-management/target/light-eventuate-account-0.1.0-tests.jar to /home/jtang/.m2/repository/com/networknt/light-eventuate-account/0.1.0/light-eventuate-account-0.1.0-tests.jar
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building eventuate-account-common 0.1.0
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for com.networknt:eventuate-common:jar:1.5.13 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[WARNING] The POM for org.mockito:mockito-core:jar:2.1.0-beta.124 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ eventuate-account-common ---
[INFO] Deleting /home/jtang/data/shared/light-4j/light-example-4j/eventuate/account-management/common/target
[INFO]
[INFO] --- jacoco-maven-plugin:0.7.4.201502262128:prepare-agent (pre-unit-test) @ eventuate-account-common ---
[INFO] surefireArgLine set to -javaagent:/home/jtang/.m2/repository/org/jacoco/org.jacoco.agent/0.7.4.201502262128/org.jacoco.agent-0.7.4.201502262128-runtime.jar=destfile=/home/jtang/data/shared/light-4j/light-example-4j/eventuate/account-management/common/target/jacoco.exec
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ eventuate-account-common ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/jtang/data/shared/light-4j/light-example-4j/eventuate/account-management/common/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) @ eventuate-account-common ---
[INFO] Compiling 37 source files to /home/jtang/data/shared/light-4j/light-example-4j/eventuate/account-management/common/target/classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] error: error reading /home/jtang/.m2/repository/com/networknt/eventuate-common/1.5.13/eventuate-common-1.5.13.jar; error in opening zip file
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Parent POM ......................................... SUCCESS [ 1.223 s]
[INFO] eventuate-account-common ........................... FAILURE [ 0.406 s]
[INFO] eventuate-account-command .......................... SKIPPED
[INFO] eventuate-account-query ............................ SKIPPED
[INFO] eventuate-account-e2etest .......................... SKIPPED
[INFO] eventuate-account-service .......................... SKIPPED
[INFO] eventuate-account-view-service ..................... SKIPPED
[INFO] eventuate-customer-service ......................... SKIPPED
[INFO] eventuate-customer-view-service .................... SKIPPED
[INFO] eventuate-transaction-service ...................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.393 s
[INFO] Finished at: 2018-05-02T08:07:11-07:00
[INFO] Final Memory: 28M/399M
[INFO] ------------------------------------------------------------------------
Any plan to support the integration with spring-boot?
This demo has been covered by the TechEmpower test cases and it is not necessary anymore.
release update
It looks like the petstore example no longer runs with the described command:
java -jar target/codegen-cli.jar -f light-rest-4j -o ~/networknt/light-example-4j/rest/petstore -m ~/networknt/model-config/rest/petstore/swagger.json -c ~/networknt/model-config/rest/petstore/config.json
It looks like theconfig.json and swagger.json are at least in a 2.0.0 path under petstore. Even with that change though it fails.
The documentation on https://networknt.github.io/light-4j/example/petstore/ is also incomplete.
Just wondering where the source is for these dependencies if I want to build locally:
https://github.com/networknt/light-example-4j/blob/master/rest/openapi/petstore/pom.xml#L161-L175
I know that the 1.5.8 version of each are uploaded to maven central, so there is no issue with building.. but from the develop branch, 1.5.9 is not available. Everything still works in the develop branch if those are updated to 1.5.8 so it's not a big issue.
Hello,
New microservices applications use mongoDB.
Can you add an example with mongodb connexion pool please :)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.