Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update starter #2

Merged
merged 15 commits into from
Oct 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Maven
/target/

# Eclipse
.project
.factorypath
.settings/
.metadata
/.apt_generated/
/bin/
/.apt_generated_tests/

# Odo
.odo/
## Looks like dups but will prevent odo from re-adding
.odo/env
.odo/odo-file-index.json
.odo\env
.odo\odo-file-index.json


33 changes: 16 additions & 17 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,29 +14,26 @@
See the License for the specific language governing permissions and
limitations under the License.
-->

<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>

<properties>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.source>11</maven.compiler.source>
<version.maven-war-plugin>3.2.2</version.maven-war-plugin>
<version.maven-surefire-plugin>3.0.0-M1</version.maven-surefire-plugin>
<version.maven-failsafe-plugin>3.0.0-M1</version.maven-failsafe-plugin>
<version.liberty-maven-plugin>3.3-M3</version.liberty-maven-plugin>

<liberty.defaultVar.default.http.port>9080</liberty.defaultVar.default.http.port>
<liberty.defaultVar.default.https.port>9443</liberty.defaultVar.default.https.port>
<!-- Workaround for https://github.com/OpenLiberty/ci.maven/issues/936 -->
<liberty.env.lmp936>foo</liberty.env.lmp936>
</properties>

<groupId>dev.odo.starter.java-openliberty</groupId>
<artifactId>starter</artifactId>
<artifactId>starter-default</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>

Expand All @@ -49,6 +46,12 @@
<type>pom</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jakarta.platform</groupId>
<artifactId>jakarta.jakartaee-api</artifactId>
<version>8.0.0</version>
<scope>provided</scope>
</dependency>
<!-- For tests -->
<dependency>
<groupId>org.junit.jupiter</groupId>
Expand Down Expand Up @@ -105,6 +108,13 @@
<version>0.9</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<version>4.2.0</version>
<scope>test</scope>
</dependency>

</dependencies>

<build>
Expand Down Expand Up @@ -133,9 +143,6 @@
<mergeServerEnv>true</mergeServerEnv>
<stripVersion>true</stripVersion>
<serverStartTimeout>360</serverStartTimeout>
<bootstrapProperties>
<app.context.root>${app.name}</app.context.root>
</bootstrapProperties>
</configuration>
</plugin>
<!-- Plugin to run unit tests -->
Expand All @@ -148,9 +155,6 @@
<phase>test</phase>
<id>default-test</id>
<configuration>
<excludes>
<exclude>**/it/**</exclude>
</excludes>
<reportsDirectory>
${project.build.directory}/test-reports/unit
</reportsDirectory>
Expand All @@ -173,11 +177,6 @@
<goals>
<goal>integration-test</goal>
</goals>
<configuration>
<includes>
<include>**/it/**</include>
</includes>
</configuration>
</execution>
<execution>
<id>verify-results</id>
Expand Down
28 changes: 0 additions & 28 deletions src/main/java/dev/appsody/starter/StarterResource.java

This file was deleted.

41 changes: 0 additions & 41 deletions src/main/java/dev/appsody/starter/health/StarterLivenessCheck.java

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
limitations under the License.
*******************************************************************************/

package dev.appsody.starter;
package dev.odo.starter;

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

@ApplicationPath("/starter")
@ApplicationPath("/")
public class StarterApplication extends Application {

}
19 changes: 12 additions & 7 deletions src/main/liberty/config/server.xml
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
<server description="Liberty server">
<server description="starter-default">

<featureManager>
<feature>cdi-2.0 </feature>
<feature>jaxrs-2.1</feature>
<feature>mpMetrics-2.3</feature>
<feature>mpHealth-2.2</feature>
<feature>mpConfig-1.4</feature>
</featureManager>
<keyStore id="defaultKeyStore" location="key.jks" type="jks" password="mpKeystore"/>
<httpEndpoint host="*" httpPort="${default.http.port}"
httpsPort="${default.https.port}" id="defaultHttpEndpoint"/>

<httpDispatcher enableWelcomePage="false" />
<httpEndpoint host="*" httpPort="9080"
httpsPort="9443" id="defaultHttpEndpoint"/>

<webApplication contextRoot="/" location="starter-default.war" />

<!--Automatically expand WAR files and EAR files -->
<applicationManager autoExpand="true"/>

<webApplication contextRoot="/" location="starter.war" />

<!--Default SSL configuration enables trust for default certificates from the Java runtime -->
<ssl id="defaultSSLConfig" trustDefaultCerts="true" />

</server>
27 changes: 0 additions & 27 deletions src/main/webapp/index.html

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -12,39 +12,37 @@
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*******************************************************************************/
package it.dev.appsody.starter;


import static org.junit.jupiter.api.Assertions.*;
*******************************************************************************/
package dev.odo.starter.it;


import static io.restassured.RestAssured.*;

import org.junit.jupiter.api.Test;
import org.microshed.testing.jaxrs.RESTClient;
import org.microshed.testing.jupiter.MicroShedTest;
import org.microshed.testing.testcontainers.ApplicationContainer;
import org.testcontainers.junit.jupiter.Container;
import dev.appsody.starter.StarterResource;

import io.restassured.http.ContentType;
import static org.hamcrest.Matchers.*;

@MicroShedTest
public class JaxrsTestit {
public class EndpointIT {

@Container
public static ApplicationContainer app = new ApplicationContainer()
.withAppContextRoot("/")
.withReadinessPath("/health/ready")
.withEnv("DEFAULT_HTTP_PORT", "9080")
.withEnv("DEFAULT_HTTPS_PORT", "9443");


@RESTClient
public static StarterResource appService;


public static ApplicationContainer app = new ApplicationContainer()
.withAppContextRoot("/")
.withReadinessPath("/health/ready");

/**
* Ping readiness health check. See samples for more detail.
*/
@Test
public void testAppResponse() {
assertEquals("Hello! Welcome to Openliberty", appService.getRequest());
public void testReassured() {
expect()
.statusCode(200)
.contentType(ContentType.JSON)
.when().get("/health/ready");
}

}