Skip to content

OpenLiberty/demo-devex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OpenLiberty Developer Experience Demo

Build Status License

Demo highlights

  1. Liberty "dev mode"
  2. MicroShed Boost
  3. MicroShed Testing

How to run:

# One time setup
./setup.sh

mvn install -DboostRuntime=ol -Dboost_db_serverName=localhost -Dboost_db_portNumber=5432 -Dboost_db_password=test -Dboost_db_databaseName=test -Dboost_db_user=test

Scenarios

Dev mode

  1. Start dev mode with: mvn liberty:dev -DboostRuntime=ol -Dboost_db_serverName=localhost -Dboost_db_portNumber=5432 -Dboost_db_password=test -Dboost_db_databaseName=test -Dboost_db_user=test
Hot deployment
  1. In a browser, go to http://localhost:9080/openapi/ui to view the OpenAPI UI which is now available.

  2. In the Java file src/main/java/org/eclipse/microprofile/system/test/app/PersonService.java, add the following annotations above the getAllPeople() method:

    @APIResponse(
        responseCode = "200",
        description = "All of people that have been added.",
        content = @Content(
            mediaType = "application/json",
            schema = @Schema(
                type = SchemaType.OBJECT,
                implementation = Person.class)))
    @Operation(
        summary = "Get all people.",
        description = "Returns all of the people that have been added.")
  1. Save the file. Notice the console shows compilation errors because imports were not added.

  2. Add the following imports:

import org.eclipse.microprofile.openapi.annotations.Operation;
import org.eclipse.microprofile.openapi.annotations.enums.SchemaType;
import org.eclipse.microprofile.openapi.annotations.media.Content;
import org.eclipse.microprofile.openapi.annotations.media.Schema;
import org.eclipse.microprofile.openapi.annotations.responses.APIResponse;
  1. Save the file. Notice the console shows compilation was successful and the application gets updated.

  2. In a browser, go to http://localhost:9080/openapi/ui, expand GET /people, and notice the summary, description, and 200 response code which has been added.

Hot testing
  1. Above the method getAllPeople(), delete the @GET annotation.

  2. Save the file. Notice the console shows compilation was successful.

  3. In the console, press Enter to run tests. Notice a test has an error.

  4. Above the method getAllPeople(), restore the @GET annotation.

  5. Save the file. Notice the console shows compilation was successful.

  6. In the console, press Enter to run tests. Notice the tests pass.

Hot debugging
  1. Inside the method getAllPeople(), set a breakpoint.

  2. In your IDE, attach a debugger to port 7777.

  3. In your browser, go to http://localhost:9080/myservice/people.

  4. Notice your IDE pauses at the breakpoint that you set, allowing you to debug.

  5. Disconnect the debugger.

Database support with Boost

  • Boost is used to configure the application to use a DB.

MicroShed Testing

  • The integration tests are written using MicroShed Testing with PostgreSQL in container as a shared dependency.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published