The getting-started
project is a simple Jakarta EE application with a HTTP endpoint that is running in
WildFly.
The src/main
folder contains a simple 'Hello world' style Jakarta EE application using JAX-RS.
To run the application, you use Maven:
mvn clean package
Maven will compile the application, provision a WildFly server
The WildFly server is created in target/server
with the application deployed in it.
To run the application, run the commands:
cd target/server
./bin/standalone.sh
Once WildFly is running, the application can be accessed at http://localhost:8080/
To run integration tests to verify the application, you use Maven:
mvn clean package verify
Tests in src/test
are run against the server in target/server
.
Tag thr image:
podman tag myapp localhost:5000/myapp
Start a local registry:
podman run --rm -p 5000:5000 --name registry registry:latest
podman run --rm -p 5000:5000 --volume ~/.registry/storage:/var/lib/registry registry:latest
podman push localhost:5000/myapp --tls-verify=false
Start PostgreSQL:
podman run --rm --name my-postgres -p 5432:5432 -e POSTGRES_PASSWORD=admin -e POSTGRES_USER=postgres -e POSTGRES_DB=postgres postgres
Add some data to PostgreSQL:
podman exec -it my-postgres bash
psql -U postgres
CREATE TABLE TEST_TABLE (
id SERIAL PRIMARY KEY,
SOME_FIELD1 VARCHAR (50) NOT NULL,
SOME_FIELD2 VARCHAR (50) NOT NULL
);
insert into test_table values (1, 'prova1', 'prova1');
insert into test_table values (2, 'prova2', 'prova2');
insert into test_table values (3, 'prova3', 'prova3');
commit;
select * from TEST_TABLE;
quit
exit
export POSTGRESQL_USER=postgres
export POSTGRESQL_PASSWORD=admin
export POSTGRESQL_HOST=localhost
export POSTGRESQL_PORT=5432
export POSTGRESQL_DATABASE=postgres
export POSTGRESQL_JNDI=java:jboss/datasources/PostgreSQLDS
mvn clean install
./target/server/bin/standalone.sh
curl -X POST http://localhost:8080/hello/test-table/insert/somedata1/somedata2
curl http://localhost:8080/hello/test-table/list