Skip to content

Commit

Permalink
Merge branch 'master' into mpSupportReviewComments
Browse files Browse the repository at this point in the history
  • Loading branch information
ajm01 authored Jan 3, 2019
2 parents 3f0cf6f + 380c122 commit 22a9524
Show file tree
Hide file tree
Showing 32 changed files with 86 additions and 92 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ public JDBCBoosterPackConfigurator(BoosterDependencyInfo depInfo, LibertyServerC
private final String DEPENDENCY_ARTIFACT = "org.apache.derby:derby:10.14.2.0";

/**
* writes out jdbc default config data when selected by the presence of a
* jdbc boost dependency
* writes out jdbc default config data when selected by the presence of a jdbc
* boost dependency
*/
@Override
public void addServerConfig(Document doc) {
Expand Down Expand Up @@ -90,4 +90,4 @@ public String getDependencyToCopy() {

return DEPENDENCY_ARTIFACT;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,7 @@ public void addFeatures(List<String> features) {
}

/**
* Write the server.xml and bootstrap.properties to the server config
* directory
* Write the server.xml and bootstrap.properties to the server config directory
*
* @throws TransformerException
* @throws IOException
Expand Down Expand Up @@ -223,4 +222,4 @@ public void addApplication(String appName) {
serverRoot.appendChild(appCfg);

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@
import io.openliberty.boost.common.BoostLoggerI;

public interface AbstractDockerI {

public void execute(DockerClient dockerClient) throws BoostException;

public RegistryAuthSupplier createRegistryAuthSupplier() throws BoostException;

// Default methods

default public String getImageName(String repository, String tag) {
return repository + ":" + tag;
}
Expand All @@ -45,7 +45,7 @@ default public boolean isRepositoryValid(String repository) {

return Pattern.matches(repositoryRegExp, repository);
}

default public DockerClient getDockerClient(boolean useProxy) throws BoostException {
final RegistryAuthSupplier authSupplier = createRegistryAuthSupplier();
try {
Expand All @@ -55,7 +55,8 @@ default public DockerClient getDockerClient(boolean useProxy) throws BoostExcept
}
}

default public boolean isValidDockerConfig(BoostLoggerI log, String repository, String tag, String artifactId) throws BoostException {
default public boolean isValidDockerConfig(BoostLoggerI log, String repository, String tag, String artifactId)
throws BoostException {
if (repository.equals(artifactId) && !repository.equals(repository.toLowerCase())) {
repository = artifactId.toLowerCase();
log.debug(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@
import io.openliberty.boost.common.BoostLoggerI;

public interface DockerPushI extends AbstractDockerI {

default public void dockerPush(DockerClient dockerClient, String artifactId, String repository, String tag, BoostLoggerI log) throws BoostException {

default public void dockerPush(DockerClient dockerClient, String artifactId, String repository, String tag,
BoostLoggerI log) throws BoostException {
final DockerLoggingProgressHandler progressHandler = new DockerLoggingProgressHandler(log);
final String currentImage = getImageName(repository, tag);
String newImage = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,4 +146,4 @@ private boolean isFileGeneratedByPlugin(File file) throws IOException {
return false;
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import io.openliberty.boost.common.docker.DockerParameters;

public class DockerizeSpringBootClasspath extends SpringDockerizer {

public DockerizeSpringBootClasspath(File projectDirectory, File outputDirectory, File appArchive,
String springBootVersion, DockerParameters params, BoostLoggerI log) {
super(projectDirectory, outputDirectory, appArchive, springBootVersion, params, log);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public DockerizeSpringBootJar(File projectDirectory, File outputDirectory, File

public Map<String, String> getBuildArgs() {
Map<String, String> buildArgs = new HashMap<String, String>();
buildArgs.put("JAR_FILE", getAppPathString() + "/" + appArchive.getName());
buildArgs.put("JAR_FILE", getAppPathString() + "/" + appArchive.getName());
return buildArgs;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,12 @@
import net.wasdev.wlp.common.plugins.util.SpringBootUtil;

public abstract class SpringDockerizer extends Dockerizer {

public final String SPRING_BOOT_VERSION;
public final DockerParameters params;

public SpringDockerizer(File projectDirectory, File outputDirectory, File appArchive, String springBootVersion, DockerParameters params, BoostLoggerI log) {
public SpringDockerizer(File projectDirectory, File outputDirectory, File appArchive, String springBootVersion,
DockerParameters params, BoostLoggerI log) {
super(projectDirectory, outputDirectory, appArchive, log);
this.SPRING_BOOT_VERSION = springBootVersion;
this.params = params;
Expand Down Expand Up @@ -62,7 +63,7 @@ public void createDockerFile() throws BoostException {
throw new BoostException("Unable to create a Dockerfile because application type is not supported");
}
}

protected String getAppPathString() {

Path projPath = projectDirectory.toPath();
Expand All @@ -82,12 +83,10 @@ protected String getSpringStartClass() throws BoostException {
Attributes attributes = manifest.getMainAttributes();
return attributes.getValue("Start-Class");
} else {
throw new BoostException(
"Could not get Spring Boot start class due to error getting app manifest.");
throw new BoostException("Could not get Spring Boot start class due to error getting app manifest.");
}
} catch (IOException e) {
throw new BoostException("Could not get Spring Boot start class due to error opening app archive.",
e);
throw new BoostException("Could not get Spring Boot start class due to error opening app archive.", e);
}
}

Expand All @@ -113,4 +112,4 @@ private void writeSpringBootDockerFile(File dockerFile, String startClass) throw
}
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ public LibertyBoosterUtil(String libertyServerPath, List<BoosterDependencyInfo>
}

/**
* take a list of pom boost dependency strings and map to liberty features
* for config. return a list of feature configuration objects for each found
* take a list of pom boost dependency strings and map to liberty features for
* config. return a list of feature configuration objects for each found
* dependency.
*
* @param dependencies
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,9 @@ public class SpringBootUtil {
private static final String SPRING_WEBSOCKET = "spring-websocket";

/**
* Get the expected path of the Spring Boot Uber JAR (with .spring
* extension) that was preserved during the Boost packaging process. No
* guarantee that the path exists or the artifact is indeed a Spring Boot
* Uber JAR.
* Get the expected path of the Spring Boot Uber JAR (with .spring extension)
* that was preserved during the Boost packaging process. No guarantee that the
* path exists or the artifact is indeed a Spring Boot Uber JAR.
*
* @param artifact
* @return the canonical path
Expand Down Expand Up @@ -115,8 +114,8 @@ public static File copySpringBootUberJar(File artifact, BoostLoggerI logger) thr
}

/**
* Add the Spring Boot Version property to the Manifest file in the Liberty
* Uber JAR. This is to trick Spring Boot into not repackaging it.
* Add the Spring Boot Version property to the Manifest file in the Liberty Uber
* JAR. This is to trick Spring Boot into not repackaging it.
*
* @param artifact
* @param springBootVersion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,4 @@ public void testZeroFeaturesInDefaultServerConfig()
assertEquals("Didn't find empty list of features", 0, featureList.size());
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ public class HelloResource {
public String getInformation() throws Exception, IOException {
return "Hello World From Your Friends at Liberty Boost EE!";
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@

@RestController
public class HelloController {

@RequestMapping("/")
public String index() {
return "Greetings from Spring Boot!";
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@

@RestController
public class HelloController {

@RequestMapping("/")
public String index() {
return "Greetings from Spring Boot!";
}

}
2 changes: 1 addition & 1 deletion boost-maven/boost-maven-plugin/src/it/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<module>test-spring-boot-ssl</module>
<module>test-jaxrs-2.0</module>
<module>test-jaxrs-2.1</module>
<module>test-context</module>
<module>test-dynamic-update</module>
</modules>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>

<groupId>io.openliberty.boost</groupId>
<artifactId>test-context</artifactId>
<artifactId>test-dynamic-update</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,15 @@
//import com.ibm.json.java.JSONArray;
//import com.ibm.json.java.JSONObject;


// This class define the RESTful API to fetch the database service information
// <basepath>/api/hello

@Path("/hello")
public class HelloResource {

@GET
@Produces("text/plain")
public String getInformation() throws Exception, IOException {
return "Hello World From Your Friends at Liberty Boost EE! - pass 1";
}
}
@GET
@Produces("text/plain")
public String getInformation() throws Exception, IOException {
return "Hello World From Your Friends at Liberty Boost EE! - pass 1";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ public class HelloResource {
public String getInformation() throws Exception, IOException {
return "Hello World From Your Friends at Liberty Boost EE!";
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ public class HelloResource {
public String getInformation() throws Exception, IOException {
return "Hello World From Your Friends at Liberty Boost EE!";
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ public String hello() {
return "Greetings from Spring Boot!";
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ public void testDockerContainerRunning() throws Exception {
}

public void testAppRunningOnEndpoint() throws Exception {
URL requestUrl = new URL("http://" + getTestDockerHost() + ":" + port + "/spring/");
URL requestUrl = new URL("http://" + getTestDockerHost() + ":" + port + "/spring");
HttpURLConnection conn = (HttpURLConnection) requestUrl.openConnection();

if (conn != null) {
Expand Down Expand Up @@ -185,4 +185,4 @@ private static String getTestDockerHost() {
}
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,4 @@ private void removeImage(String imageName) throws Exception {
Image removedImage = getImage(imageName);
assertNull(imageName + " was not removed.", removedImage);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,22 +39,20 @@ public static void init() {

@Test
public void testServlet() throws Exception {

SSLContext sslContext = new SSLContextBuilder()
.loadTrustMaterial(null, (certificate, authType) -> true).build();

CloseableHttpClient client = HttpClients.custom()
.setSSLContext(sslContext)
.setSSLHostnameVerifier(new NoopHostnameVerifier())
.build();


SSLContext sslContext = new SSLContextBuilder().loadTrustMaterial(null, (certificate, authType) -> true)
.build();

CloseableHttpClient client = HttpClients.custom().setSSLContext(sslContext)
.setSSLHostnameVerifier(new NoopHostnameVerifier()).build();

HttpGet httpGet = new HttpGet(URL);
httpGet.setHeader("Accept", "application/xml");

HttpResponse response = client.execute(httpGet);

assertEquals("HTTP GET failed", HttpStatus.SC_OK, response.getStatusLine().getStatusCode());

ResponseHandler<String> handler = new BasicResponseHandler();
String body = handler.handleResponse(response);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ public void registerStompEndpoints(StompEndpointRegistry registry) {
registry.addEndpoint("/gs-guide-websocket").withSockJS();
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public abstract class AbstractDockerMojo extends AbstractMojo implements Abstrac
@Override
public void execute() throws MojoExecutionException {
try {
if(isValidDockerConfig(BoostLogger.getInstance(), repository, tag, project.getArtifactId())) {
if (isValidDockerConfig(BoostLogger.getInstance(), repository, tag, project.getArtifactId())) {
execute(getDockerClient(useProxy));
}
} catch (BoostException e) {
Expand Down
Loading

0 comments on commit 22a9524

Please sign in to comment.