Skip to content

Commit

Permalink
Merge pull request #107 from aguibert/serverAdapter-priority
Browse files Browse the repository at this point in the history
Use consistent priority in runtime modules
  • Loading branch information
aguibert committed Nov 11, 2019
2 parents 1554e13 + 0737428 commit 86c8696
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Optional;

import org.microshed.testing.testcontainers.spi.ServerAdapter;
import org.testcontainers.images.builder.ImageFromDockerfile;
Expand All @@ -46,7 +45,7 @@ public static void setBaseDockerImage(String imageName) {

@Override
public int getPriority() {
return -50;
return PRIORITY_RUNTIME_MODULE;
}

@Override
Expand Down Expand Up @@ -113,8 +112,4 @@ public ImageFromDockerfile getDefaultImage(File appFile) {
return image;
}

@Override
public Optional<String> getReadinessPath() {
return Optional.empty();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@
import java.util.Optional;

public class PayaraMicroAdapter implements ServerAdapter {

@Override
public int getPriority() {
return PRIORITY_RUNTIME_MODULE;
}

@Override
public int getDefaultHttpPort() {
return 8080;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@
import java.util.Optional;

public class PayaraServerAdapter implements ServerAdapter {

@Override
public int getPriority() {
return PRIORITY_RUNTIME_MODULE;
}

@Override
public int getDefaultHttpPort() {
return 8080;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,12 @@
*/
public interface ServerAdapter {

static final int PRIORITY_USER_DEFAULT = 50;
static final int PRIORITY_DEFAULT = 0;
static final int PRIORITY_RUNTIME_MODULE = -50;

default int getPriority() {
return 0;
return PRIORITY_DEFAULT;
}

/**
Expand Down Expand Up @@ -91,8 +95,10 @@ default ImageFromDockerfile getDefaultImage(File appFile) {

/**
* Defines the readiness path for the Server which will be used by default when the developer did not specify such value.
* The implementation can choose to return null and then no value is defined by default.
* @return the readiness path to be used by default.
*
* @return the readiness path to be used by default, or an empty Optional if no default value is provided.
*/
Optional<String> getReadinessPath();
default Optional<String> getReadinessPath() {
return Optional.empty();
}
}
1 change: 0 additions & 1 deletion sample-apps/liberty-app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ plugins {
dependencies {
providedCompile 'javax:javaee-api:8.0.1'
providedCompile 'org.eclipse.microprofile:microprofile:3.0'
testCompile project(':microshed-testing-testcontainers')
testCompile project(':microshed-testing-liberty')
testCompile group: 'org.slf4j', name: 'slf4j-log4j12', version: '1.7.29'
testImplementation 'org.junit.jupiter:junit-jupiter:5.5.2'
Expand Down
4 changes: 0 additions & 4 deletions sample-apps/payara-app/Dockerfile

This file was deleted.

2 changes: 1 addition & 1 deletion sample-apps/payara-app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {
dependencies {
providedCompile 'javax:javaee-api:8.0.1'
providedCompile 'org.eclipse.microprofile:microprofile:2.1'
testCompile project(':microshed-testing-testcontainers')
testCompile project(':microshed-testing-payara-server')
testCompile group: 'org.slf4j', name: 'slf4j-log4j12', version: '1.7.29'
testImplementation 'org.junit.jupiter:junit-jupiter:5.5.2'
}
Expand Down

0 comments on commit 86c8696

Please sign in to comment.