Skip to content

Commit

Permalink
add new source code for video
Browse files Browse the repository at this point in the history
  • Loading branch information
rieckpil committed Dec 28, 2019
1 parent 37fc044 commit 5138fe9
Show file tree
Hide file tree
Showing 14 changed files with 183 additions and 0 deletions.
22 changes: 22 additions & 0 deletions deployment-to-payara-intellij/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/target/
!.mvn/wrapper/maven-wrapper.jar

.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache

.idea
*.iws
*.iml
*.ipr

/nbproject/private/
/build/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
3 changes: 3 additions & 0 deletions deployment-to-payara-intellij/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM open-liberty:kernel-java11
COPY --chown=1001:0 target/deployment-to-payara-intellij.war /config/dropins/
COPY --chown=1001:0 server.xml /config
8 changes: 8 additions & 0 deletions deployment-to-payara-intellij/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Project de.rieckpil.quickstarts/deployment-to-payara-intellij

Steps to run this project:

1. Start your Docker daemon
2. Execute `./buildAndRun.sh` (Linux/MacOs) or `buildAndRun.bat` (Windows)
3. Wait until Open Liberty is up- and running (e.g. use `docker logs -f CONTAINER_ID`)
4. Visit http://localhost:9080/resources/sample
5 changes: 5 additions & 0 deletions deployment-to-payara-intellij/buildAndRun.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@echo off
call mvn clean package
call docker build -t de.rieckpil.quickstarts/deployment-to-payara-intellij .
call docker rm -f deployment-to-payara-intellij
call docker run -d -p 9080:9080 -p 9443:9443 --name deployment-to-payara-intellij de.rieckpil.quickstarts/deployment-to-payara-intellij
3 changes: 3 additions & 0 deletions deployment-to-payara-intellij/buildAndRun.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh
mvn clean package && docker build -t de.rieckpil.quickstarts/deployment-to-payara-intellij .
docker rm -f deployment-to-payara-intellij || true && docker run -d -p 9080:9080 -p 9443:9443 --name deployment-to-payara-intellij de.rieckpil.quickstarts/deployment-to-payara-intellij
64 changes: 64 additions & 0 deletions deployment-to-payara-intellij/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>de.rieckpil.quickstarts</groupId>
<artifactId>deployment-to-payara-intellij</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>

<properties>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<failOnMissingWebXml>false</failOnMissingWebXml>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<jakarta.jakartaee-api.version>8.0.0</jakarta.jakartaee-api.version>
<microprofile.version>3.0</microprofile.version>
<mockito-core.version>3.1.0</mockito-core.version>
<junit-jupiter.version>5.5.0</junit-jupiter.version>
</properties>

<dependencies>
<dependency>
<groupId>jakarta.platform</groupId>
<artifactId>jakarta.jakartaee-api</artifactId>
<version>${jakarta.jakartaee-api.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.microprofile</groupId>
<artifactId>microprofile</artifactId>
<version>${microprofile.version}</version>
<type>pom</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>${junit-jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>${mockito-core.version}</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<finalName>deployment-to-payara-intellij</finalName>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
</plugin>
</plugins>
</build>
</project>
12 changes: 12 additions & 0 deletions deployment-to-payara-intellij/server.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<server description="new server">

<featureManager>
<feature>javaee-8.0</feature>
<feature>microProfile-3.0</feature>
</featureManager>

<httpEndpoint id="defaultHttpEndpoint" httpPort="9080" httpsPort="9443"/>

<quickStartSecurity userName="duke" userPassword="dukeduke"/>
</server>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package de.rieckpil.quickstarts;

import javax.ws.rs.ApplicationPath;
import javax.ws.rs.core.Application;

@ApplicationPath("resources")
public class JAXRSConfiguration extends Application {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package de.rieckpil.quickstarts;

import javax.inject.Inject;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.core.Response;

import org.eclipse.microprofile.config.inject.ConfigProperty;

@Path("sample")
public class SampleResource {

@Inject
@ConfigProperty(name = "message")
private String message;

@GET
public Response message() {
return Response.ok(message).build();
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
message=Hello World Jakarta EE 8
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.2"
xmlns="http://xmlns.jcp.org/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_2.xsd">
<persistence-unit name="prod" transaction-type="JTA" />
</persistence>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/beans_2_0.xsd"
bean-discovery-mode="all">
</beans>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<web-ext
xmlns="http://websphere.ibm.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://websphere.ibm.com/xml/ns/javaee http://websphere.ibm.com/xml/ns/javaee/ibm-web-ext_1_0.xsd"
version="1.0">
<context-root uri="/"/>
</web-ext>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package de.rieckpil.quickstarts;

import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;

public class SampleTest {

@Test
public void simpleJUnit5Test() {
String result = "duke";
assertEquals("duke", result);
}
}

0 comments on commit 5138fe9

Please sign in to comment.