-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from OpenLiberty/dev
Merge dev to master: pulbish the dev content
- Loading branch information
Showing
13 changed files
with
607 additions
and
228 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,3 +34,4 @@ branches: | |
only: | ||
- master | ||
- qa | ||
- dev |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,92 +1,91 @@ | ||
<?xml version='1.0' encoding='utf-8'?> | ||
<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> | ||
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>io.openliberty.guides</groupId> | ||
<artifactId>guide-microshed-testing</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
<packaging>war</packaging> | ||
<groupId>io.openliberty.guides</groupId> | ||
<artifactId>guide-microshed-testing</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
<packaging>war</packaging> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> | ||
<maven.compiler.source>1.8</maven.compiler.source> | ||
<maven.compiler.target>1.8</maven.compiler.target> | ||
</properties> | ||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> | ||
<maven.compiler.source>1.8</maven.compiler.source> | ||
<maven.compiler.target>1.8</maven.compiler.target> | ||
</properties> | ||
|
||
<dependencies> | ||
<!-- Dependencies for the application code --> | ||
<dependency> | ||
<groupId>javax</groupId> | ||
<artifactId>javaee-api</artifactId> | ||
<version>8.0</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.eclipse.microprofile</groupId> | ||
<artifactId>microprofile</artifactId> | ||
<version>3.0</version> | ||
<type>pom</type> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependencies> | ||
<!-- Dependencies for the application code --> | ||
<dependency> | ||
<groupId>javax</groupId> | ||
<artifactId>javaee-api</artifactId> | ||
<version>8.0</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.eclipse.microprofile</groupId> | ||
<artifactId>microprofile</artifactId> | ||
<version>3.0</version> | ||
<type>pom</type> | ||
<scope>provided</scope> | ||
</dependency> | ||
|
||
<!-- Test dependencies --> | ||
<dependency> | ||
<groupId>org.microshed</groupId> | ||
<artifactId>microshed-testing-liberty</artifactId> | ||
<version>0.4.1</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-log4j12</artifactId> | ||
<version>1.7.26</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.junit.jupiter</groupId> | ||
<artifactId>junit-jupiter</artifactId> | ||
<version>5.4.2</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
<!-- Test dependencies --> | ||
<dependency> | ||
<groupId>org.microshed</groupId> | ||
<artifactId>microshed-testing-liberty</artifactId> | ||
<version>0.4.1</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-log4j12</artifactId> | ||
<version>1.7.26</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.junit.jupiter</groupId> | ||
<artifactId>junit-jupiter</artifactId> | ||
<version>5.4.2</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<finalName>${project.artifactId}</finalName> | ||
<plugins> | ||
<plugin> | ||
<artifactId>maven-war-plugin</artifactId> | ||
<version>3.2.2</version> | ||
</plugin> | ||
<plugin> | ||
<groupId>io.openliberty.tools</groupId> | ||
<artifactId>liberty-maven-plugin</artifactId> | ||
<version>3.0.1</version> | ||
</plugin> | ||
<!-- Plugin to run integration tests --> | ||
<plugin> | ||
<artifactId>maven-failsafe-plugin</artifactId> | ||
<version>3.0.0-M3</version> | ||
<executions> | ||
<execution> | ||
<id>integration-test</id> | ||
<goals> | ||
<goal>integration-test</goal> | ||
</goals> | ||
<configuration> | ||
<trimStackTrace>false</trimStackTrace> | ||
</configuration> | ||
</execution> | ||
<execution> | ||
<id>verify</id> | ||
<goals> | ||
<goal>verify</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
<build> | ||
<finalName>${project.artifactId}</finalName> | ||
<plugins> | ||
<plugin> | ||
<artifactId>maven-war-plugin</artifactId> | ||
<version>3.2.2</version> | ||
</plugin> | ||
<plugin> | ||
<groupId>io.openliberty.tools</groupId> | ||
<artifactId>liberty-maven-plugin</artifactId> | ||
</plugin> | ||
<!-- Plugin to run integration tests --> | ||
<plugin> | ||
<artifactId>maven-failsafe-plugin</artifactId> | ||
<version>3.0.0-M3</version> | ||
<executions> | ||
<execution> | ||
<id>integration-test</id> | ||
<goals> | ||
<goal>integration-test</goal> | ||
</goals> | ||
<configuration> | ||
<trimStackTrace>false</trimStackTrace> | ||
</configuration> | ||
</execution> | ||
<execution> | ||
<id>verify</id> | ||
<goals> | ||
<goal>verify</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
81 changes: 81 additions & 0 deletions
81
hotspots/src/test/java/io/openliberty/guides/testing/ErrorPathIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
// tag::copyright[] | ||
/* | ||
* Copyright (c) 2019 IBM Corporation and others | ||
* | ||
* See the NOTICE file(s) distributed with this work for additional | ||
* information regarding copyright ownership. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* You may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* 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. | ||
*/ | ||
// end::copyright[] | ||
package io.openliberty.guides.testing; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertThrows; | ||
|
||
import javax.inject.Inject; | ||
import javax.ws.rs.BadRequestException; | ||
import javax.ws.rs.NotFoundException; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.microshed.testing.jupiter.MicroShedTest; | ||
// tag::importSharedContainerConfig[] | ||
import org.microshed.testing.SharedContainerConfig; | ||
// end::importSharedContainerConfig[] | ||
// tag::importMPApp[] | ||
import org.microshed.testing.testcontainers.MicroProfileApplication; | ||
// end::importMPApp[] | ||
// tag::importContainer[] | ||
import org.testcontainers.junit.jupiter.Container; | ||
// end::importContainer[] | ||
|
||
@MicroShedTest | ||
// tag::sharedContainerConfig[] | ||
@SharedContainerConfig(AppDeploymentConfig.class) | ||
// end::sharedContainerConfig[] | ||
public class ErrorPathIT { | ||
|
||
// tag::container[] | ||
@Container | ||
public static MicroProfileApplication app = new MicroProfileApplication() | ||
.withAppContextRoot("/guide-microshed-testing") | ||
.withReadinessPath("/health/ready"); | ||
// end::container[] | ||
|
||
// tag::personSvc[] | ||
@Inject | ||
public static PersonService personSvc; | ||
// end::personSvc[] | ||
|
||
@Test | ||
public void testGetUnknownPerson() { | ||
assertThrows(NotFoundException.class, () -> personSvc.getPerson(-1L)); | ||
} | ||
|
||
@Test | ||
public void testCreateBadPersonNullName() { | ||
assertThrows(BadRequestException.class, () -> personSvc.createPerson(null, 5)); | ||
} | ||
|
||
@Test | ||
public void testCreateBadPersonNegativeAge() { | ||
assertThrows(BadRequestException.class, () -> | ||
personSvc.createPerson("NegativeAgePersoN", -1)); | ||
} | ||
|
||
@Test | ||
public void testCreateBadPersonNameTooLong() { | ||
assertThrows(BadRequestException.class, () -> | ||
personSvc.createPerson("NameTooLongPersonNameTooLongPersonNameTooLongPerson", | ||
5)); | ||
} | ||
} |
Oops, something went wrong.