diff --git a/boost-common/src/main/java/boost/common/runtimes/RuntimeI.java b/boost-common/src/main/java/boost/common/runtimes/RuntimeI.java index b59993c9..c00bafa2 100644 --- a/boost-common/src/main/java/boost/common/runtimes/RuntimeI.java +++ b/boost-common/src/main/java/boost/common/runtimes/RuntimeI.java @@ -10,18 +10,22 @@ *******************************************************************************/ package boost.common.runtimes; +import java.util.List; + import boost.common.BoostException; +import boost.common.boosters.AbstractBoosterConfig; public abstract interface RuntimeI { + //Will need to pass in plugin mojo/task to Maven/Gradle along with project object + + public void doPackage(List boosterConfigs, Object project, Object pluginTask) throws BoostException; - public void doPackage() throws BoostException; - - public void doDebug(boolean clean) throws BoostException; + public void doDebug(Object project, Object pluginTask) throws BoostException; - public void doRun(boolean clean) throws BoostException; + public void doRun(Object project, Object pluginTask) throws BoostException; - public void doStart(boolean clean, int verifyTimeout, int serverStartTimeout) throws BoostException; + public void doStart(Object project, Object pluginTask) throws BoostException; - public void doStop() throws BoostException; + public void doStop(Object project, Object pluginTask) throws BoostException; } diff --git a/boost-gradle/build.gradle b/boost-gradle/build.gradle index 9b46bd72..b7119cd2 100644 --- a/boost-gradle/build.gradle +++ b/boost-gradle/build.gradle @@ -6,7 +6,7 @@ plugins { } archivesBaseName = 'boost-gradle-plugin' -group = 'io.openliberty.boost' +group = 'boost' version = '0.1.1-SNAPSHOT' def boosterVersion = '0.1.3-SNAPSHOT' @@ -24,9 +24,9 @@ repositories { dependencies { compile localGroovy() - compile 'net.wasdev.wlp.gradle.plugins:liberty-gradle-plugin:2.6.6-SNAPSHOT' + compile 'net.wasdev.wlp.gradle.plugins:liberty-gradle-plugin:2.6.7-SNAPSHOT' compile group: 'commons-io', name: 'commons-io', version: '2.6' - compile 'io.openliberty.boost:boost-common:0.1.3-SNAPSHOT' + compile 'boost:boost-common:0.1.3-SNAPSHOT' compile 'com.spotify:docker-client:8.11.7' testCompile 'junit:junit:4.12' @@ -39,15 +39,11 @@ test { doFirst { //Copying gradle.properties with plugin version to test projects String runtimeGroup String runtimeArtifactId - String libertyRuntime = System.getProperty('runtime') - String runtimeVersion = System.getProperty('runtimeVersion') + String runtime = System.getProperty('runtime') - if (libertyRuntime == null || libertyRuntime.isEmpty()) { + if (runtime == null || runtime.isEmpty()) { throw new GradleException('Tests could not be run. Please specify a Liberty runtime. Choose either wlp or ol.') } - if (runtimeVersion == null || runtimeVersion.isEmpty()) { - throw new GradleException('Tests could not be run. Please specify a Liberty runtime version.') - } Properties prop = new Properties() OutputStream output = null @@ -55,12 +51,9 @@ test { try { output = new FileOutputStream("${buildDir}/gradle.properties") - if (libertyRuntime == "ol") { - runtimeGroup = "io.openliberty" - runtimeArtifactId = "openliberty-runtime" - } else { - runtimeGroup = "com.ibm.websphere.appserver.runtime" - runtimeArtifactId = "wlp-javaee7" + if (runtime == "ol") { + runtimeGroup = "boost.runtimes" + runtimeArtifactId = "openliberty-gradle" } // set the properties value @@ -68,7 +61,6 @@ test { prop.setProperty("boosterVersion", boosterVersion) prop.setProperty("runtimeGroup", runtimeGroup) prop.setProperty("runtimeArtifactId", runtimeArtifactId) - prop.setProperty("runtimeVersion", runtimeVersion) // save properties to project root folder prop.store(output, null) @@ -165,8 +157,8 @@ if (project.hasProperty('ossrhUsername') && project.hasProperty('ossrhPassword') gradlePlugin { plugins { boostPlugin { - id = 'io.openliberty.boost' - implementationClass = 'io.openliberty.boost.gradle.Boost' + id = 'boost' + implementationClass = 'boost.gradle.Boost' } } } diff --git a/boost-gradle/gradle/wrapper/gradle-wrapper.jar b/boost-gradle/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 87b738cb..00000000 Binary files a/boost-gradle/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/boost-gradle/gradle/wrapper/gradle-wrapper.properties b/boost-gradle/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index 558870da..00000000 --- a/boost-gradle/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,5 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-bin.zip -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists diff --git a/boost-gradle/openliberty-gradle/build.gradle b/boost-gradle/openliberty-gradle/build.gradle new file mode 100644 index 00000000..4a81e0b9 --- /dev/null +++ b/boost-gradle/openliberty-gradle/build.gradle @@ -0,0 +1,27 @@ +apply plugin: 'java' +apply plugin: 'maven' + +repositories { + mavenLocal() + mavenCentral() +} + +dependencies { + compile "boost:boost-common:0.1.3-SNAPSHOT" + compile "boost.runtimes:liberty-common:0.1-SNAPSHOT" + compile "boost:boost-gradle-plugin:0.1.1-SNAPSHOT" + compile 'net.wasdev.wlp.gradle.plugins:liberty-gradle-plugin:2.6.6-SNAPSHOT' + compile "commons-io:commons-io:2.6" + compile localGroovy() + compile gradleApi() +} + +group = 'boost.runtimes' +archivesBaseName = 'openliberty-gradle' +version = '0.1.3-SNAPSHOT' + +jar { + from ('./src/main/resources') { + include 'META-INF/services/boost.common.runtimes.GradleRuntimeI' + } +} \ No newline at end of file diff --git a/boost-gradle/openliberty-gradle/src/main/java/boost/runtimes/openliberty/LibertyGradleRuntime.java b/boost-gradle/openliberty-gradle/src/main/java/boost/runtimes/openliberty/LibertyGradleRuntime.java new file mode 100644 index 00000000..ccaa2f34 --- /dev/null +++ b/boost-gradle/openliberty-gradle/src/main/java/boost/runtimes/openliberty/LibertyGradleRuntime.java @@ -0,0 +1,294 @@ +/******************************************************************************* + * Copyright (c) 2019 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package boost.runtimes.openliberty; + +import java.io.BufferedReader; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.lang.reflect.Array; +import java.lang.reflect.Field; +import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; +import java.util.Properties; + +import org.apache.commons.io.FileUtils; + +import org.codehaus.plexus.util.xml.Xpp3Dom; + +import org.gradle.api.Action; +import org.gradle.api.GradleException; +import org.gradle.api.Project; +import org.gradle.api.artifacts.Configuration; +import org.gradle.api.plugins.WarPlugin; +import org.gradle.api.tasks.bundling.War; + +import groovy.lang.Closure; + +import boost.common.BoostException; +import boost.common.boosters.AbstractBoosterConfig; +import boost.common.config.BoostProperties; +import boost.common.config.BoosterConfigurator; +import boost.common.config.ConfigConstants; +import boost.gradle.runtimes.GradleRuntimeI; +import boost.gradle.utils.BoostLogger; +import boost.gradle.utils.GradleProjectUtil; +import boost.runtimes.openliberty.boosters.LibertyBoosterI; +import boost.runtimes.openliberty.LibertyServerConfigGenerator; + +import net.wasdev.wlp.gradle.plugins.extensions.LibertyExtension; + +public class LibertyGradleRuntime implements GradleRuntimeI { + + private final String serverName = "BoostServer"; + private final String OPEN_LIBERTY_VERSION = "19.0.0.3"; + + private String projectBuildDir; + private String libertyServerPath; + + public LibertyGradleRuntime() {} + + public void configureRuntimePlugin(Project project) throws GradleException { + project.getPluginManager().apply("net.wasdev.wlp.gradle.plugins.Liberty"); + + project.getTasks().getByName("libertyPackage").dependsOn("installApps", "installFeature"); + project.getTasks().getByName("installApps").mustRunAfter("installFeature"); + + project.getDependencies().add("libertyRuntime", "io.openliberty:openliberty-runtime:" + OPEN_LIBERTY_VERSION); + //The rest of this method is used to set the server name in the ServerExtension. + + //Creating a closure to call on the ServerExtension in the LibertyExtension + //Other properties aside from the server name can be configured here as well + Closure serverClosure = new Closure(this) { + @Override + public Object call() { + try { + Field nameField = getDelegate().getClass().getDeclaredField("name"); + nameField.setAccessible(true); + nameField.set(getDelegate(), serverName); + } catch (Exception e) { + throw new GradleException("Error configuring Liberty Gradle Plugin.", e); + } + + return this.getDelegate(); + } + }; + //Configuring the LibertyExtension's server ServerExtension + project.getExtensions().configure("liberty", new Action() { + @Override + public void execute(LibertyExtension liberty) { + liberty.server(serverClosure); + } + }); + + this.projectBuildDir = project.getBuildDir().toString(); + this.libertyServerPath = projectBuildDir + "/wlp/usr/servers/" + serverName; + } + + public void doPackage(List boosterConfigs, Object project, Object pluginTask) throws BoostException { + Project gradleProject = (Project)project; + System.setProperty(BoostProperties.INTERNAL_COMPILER_TARGET, gradleProject.findProperty("targetCompatibility").toString()); + try { + packageLiberty(boosterConfigs, gradleProject); + } catch (GradleException e) { + throw new BoostException("Error packaging Liberty server", e); + } + } + + private void packageLiberty(List boosterConfigs, Project project) throws BoostException { + try { + runTask("installLiberty", project); + runTask("libertyCreate", project); + + // targeting a liberty install + copyBoosterDependencies(boosterConfigs, project); + + generateServerConfig(boosterConfigs, project); + + installMissingFeatures(project); + + // Create the Liberty runnable jar + createUberJar(project); + } catch(Exception e) { + throw new BoostException("Error packaging Liberty server", e); + } + + } + + /** + * Get all booster dependencies and copy them to the Liberty server. + * + * @throws GradleException + * + */ + private void copyBoosterDependencies(List boosterConfigs, Project project) throws IOException { + List dependenciesToCopy = BoosterConfigurator.getDependenciesToCopy(boosterConfigs, + BoostLogger.getInstance()); + + project.getConfigurations().maybeCreate("boosterDependencies"); + for (String dep : dependenciesToCopy) { + project.getDependencies().add("boosterDependencies", dep); + } + + File resouresDir = new File(libertyServerPath, "resources"); + + for (File dep : project.getConfigurations().getByName("boosterDependencies").resolve()) { + FileUtils.copyFileToDirectory(dep, resouresDir); + } + } + + /** + * Generate config for the Liberty server based on the Gradle project. + * + * @throws GradleException + */ + private void generateServerConfig(List boosterConfigs, Project project) throws GradleException { + + try { + // Generate server config + generateLibertyServerConfig(boosterConfigs, project); + + } catch (Exception e) { + throw new GradleException("Unable to generate server configuration for the Liberty server.", e); + } + } + + private List getWarNames(Project project) { + String warName = null; + + if (project.getPlugins().hasPlugin("war")) { + WarPlugin warPlugin = (WarPlugin)(project.getPlugins().findPlugin("war")); + War warTask = (War)(project.getTasks().findByPath(warPlugin.WAR_TASK_NAME)); + warName = warTask.getArchiveFileName().get().substring(0, warTask.getArchiveFileName().get().length() - 4); + } + + return Arrays.asList(warName); + } + + /** + * Configure the Liberty runtime + * + * @param boosterConfigurators + * @throws Exception + */ + private void generateLibertyServerConfig(List boosterConfigurators, Project project) throws Exception { + + List warNames = getWarNames(project); + LibertyServerConfigGenerator libertyConfig = new LibertyServerConfigGenerator(libertyServerPath, + BoostLogger.getInstance()); + + // Add default http endpoint configuration + Properties boostConfigProperties = BoostProperties.getConfiguredBoostProperties(BoostLogger.getInstance()); + + String host = (String) boostConfigProperties.getOrDefault(BoostProperties.ENDPOINT_HOST, "*"); + libertyConfig.addHostname(host); + + String httpPort = (String) boostConfigProperties.getOrDefault(BoostProperties.ENDPOINT_HTTP_PORT, "9080"); + libertyConfig.addHttpPort(httpPort); + + String httpsPort = (String) boostConfigProperties.getOrDefault(BoostProperties.ENDPOINT_HTTPS_PORT, "9443"); + libertyConfig.addHttpsPort(httpsPort); + + // Add war configuration if necessary + if (!warNames.isEmpty()) { + for (String warName : warNames) { + libertyConfig.addApplication(warName); + } + } else { + throw new Exception( + "No war files were found. The project must have a war packaging type or specify war dependencies."); + } + + // Loop through configuration objects and add config and + // the corresponding Liberty feature + for (AbstractBoosterConfig configurator : boosterConfigurators) { + if (configurator instanceof LibertyBoosterI) { + ((LibertyBoosterI) configurator).addServerConfig(libertyConfig); + libertyConfig.addFeature(((LibertyBoosterI) configurator).getFeature()); + } + } + + libertyConfig.writeToServer(); + } + + //Liberty Gradle Plugin Execution + + /** + * Invoke the liberty-gradle-plugin to run the install-feature goal. + * + * This will install any missing features defined in the server.xml or + * configDropins. + * + */ + private void installMissingFeatures(Project project) throws GradleException { + runTask("installFeature", project); + } + + /** + * Invoke the liberty-gradle-plugin to package the server into a runnable Liberty + * JAR + */ + private void createUberJar(Project project) throws BoostException { + try { + runTask("libertyPackage", project); + } catch (GradleException e) { + throw new BoostException("Error creating Liberty uber jar", e); + } + } + + public void doDebug(Object project, Object pluginTask) throws BoostException { + try { + runTask("libertyDebug", (Project)project); + } catch (GradleException e) { + throw new BoostException("Error debugging Liberty server", e); + } + } + + public void doRun(Object project, Object pluginTask) throws BoostException { + try { + runTask("LibertyRun", (Project)project); + } catch (GradleException e) { + throw new BoostException("Error running Liberty server", e); + } + } + + public void doStart(Object project, Object pluginTask) throws BoostException { + try { + runTask("libertyStart", (Project)project); + } catch (GradleException e) { + throw new BoostException("Error starting Liberty server", e); + } + } + + public void doStop(Object project, Object pluginTask) throws BoostException { + try { + runTask("libertyStop", (Project)project); + } catch (GradleException e) { + throw new BoostException("Error stopping Liberty server", e); + } + } + + private void runTask(String taskName, Project project) throws GradleException { + //String command = project.getProjectDir().toString() + "/gradlew"; + try { + ProcessBuilder pb = new ProcessBuilder("gradle", taskName, "-i", "-s"); + System.out.println("Executing task " + pb.command().get(1)); + pb.directory(project.getProjectDir()); + Process p = pb.start(); + p.waitFor(); + } catch (IOException | InterruptedException e) { + throw new GradleException("Unable to execute the " + taskName + " task.", e); + } + } + +} diff --git a/boost-gradle/openliberty-gradle/src/main/resources/META-INF/services/boost.gradle.runtimes.GradleRuntimeI b/boost-gradle/openliberty-gradle/src/main/resources/META-INF/services/boost.gradle.runtimes.GradleRuntimeI new file mode 100644 index 00000000..f4bcc36b --- /dev/null +++ b/boost-gradle/openliberty-gradle/src/main/resources/META-INF/services/boost.gradle.runtimes.GradleRuntimeI @@ -0,0 +1 @@ +boost.runtimes.openliberty.LibertyGradleRuntime \ No newline at end of file diff --git a/boost-gradle/src/main/groovy/io/openliberty/boost/gradle/Boost.groovy b/boost-gradle/src/main/groovy/io/openliberty/boost/gradle/Boost.groovy index 08b3b506..d16c0f78 100644 --- a/boost-gradle/src/main/groovy/io/openliberty/boost/gradle/Boost.groovy +++ b/boost-gradle/src/main/groovy/io/openliberty/boost/gradle/Boost.groovy @@ -8,44 +8,52 @@ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ -package io.openliberty.boost.gradle +package boost.gradle import org.gradle.api.* import net.wasdev.wlp.gradle.plugins.extensions.ServerExtension -import io.openliberty.boost.gradle.extensions.BoostExtension -import io.openliberty.boost.gradle.utils.BoostLogger +import boost.gradle.tasks.AbstractBoostTask +import boost.gradle.extensions.BoostExtension +import boost.gradle.utils.BoostLogger public class Boost implements Plugin { final String BOOST_SERVER_NAME = 'BoostServer' - final String OPEN_LIBERTY_VERSION = '[18.0.0.3,)' + // final String OPEN_LIBERTY_VERSION = '[18.0.0.3,)' void apply(Project project) { project.extensions.create('boost', BoostExtension) + // project.configurations.create("boosterDependency"); BoostLogger.init(project) new BoostTaskFactory(project).createTasks() - project.pluginManager.apply('net.wasdev.wlp.gradle.plugins.Liberty') - - project.liberty.server = configureBoostServerProperties() - configureRuntimeArtifact(project) + project.afterEvaluate { + AbstractBoostTask.resetRuntime() + AbstractBoostTask.getRuntimeInstance(project).configureRuntimePlugin(project) + } } +} - //Overwritten by any liberty configuration in build file - ServerExtension configureBoostServerProperties() { - ServerExtension boostServer = new ServerExtension() - boostServer.name = BOOST_SERVER_NAME - boostServer.looseApplication = false - return boostServer - } - void configureRuntimeArtifact(Project project) { - //The libertyRuntime configuration won't be null. It is added with the Liberty plugin. - //A libertyRuntime configuration in the build.gradle will overwrite this. - project.dependencies.add('libertyRuntime', "io.openliberty:openliberty-runtime:$OPEN_LIBERTY_VERSION") - } -} +// project.liberty.server = configureBoostServerProperties() +// configureRuntimeArtifact(project) +// } + +// //Overwritten by any liberty configuration in build file +// ServerExtension configureBoostServerProperties() { +// ServerExtension boostServer = new ServerExtension() +// boostServer.name = BOOST_SERVER_NAME +// boostServer.looseApplication = false +// return boostServer +// } + +// void configureRuntimeArtifact(Project project) { +// //The libertyRuntime configuration won't be null. It is added with the Liberty plugin. +// //A libertyRuntime configuration in the build.gradle will overwrite this. +// project.dependencies.add('libertyRuntime', "io.openliberty:openliberty-runtime:$OPEN_LIBERTY_VERSION") +// } +// } diff --git a/boost-gradle/src/main/groovy/io/openliberty/boost/gradle/BoostTaskFactory.groovy b/boost-gradle/src/main/groovy/io/openliberty/boost/gradle/BoostTaskFactory.groovy index 39ffc916..f12aaa5f 100644 --- a/boost-gradle/src/main/groovy/io/openliberty/boost/gradle/BoostTaskFactory.groovy +++ b/boost-gradle/src/main/groovy/io/openliberty/boost/gradle/BoostTaskFactory.groovy @@ -8,17 +8,15 @@ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ -package io.openliberty.boost.gradle +package boost.gradle import org.gradle.api.Project -import io.openliberty.boost.gradle.tasks.BoostStartTask -import io.openliberty.boost.gradle.tasks.BoostRunTask -import io.openliberty.boost.gradle.tasks.BoostStopTask -import io.openliberty.boost.gradle.tasks.BoostPackageTask -import io.openliberty.boost.gradle.tasks.BoostDebugTask -import io.openliberty.boost.gradle.tasks.docker.BoostDockerBuildTask -import io.openliberty.boost.gradle.tasks.docker.BoostDockerPushTask +import boost.gradle.tasks.BoostStartTask +import boost.gradle.tasks.BoostRunTask +import boost.gradle.tasks.BoostStopTask +import boost.gradle.tasks.BoostPackageTask +import boost.gradle.tasks.BoostDebugTask class BoostTaskFactory { Project project @@ -33,8 +31,6 @@ class BoostTaskFactory { project.tasks.create('boostStop', BoostStopTask) project.tasks.create('boostPackage', BoostPackageTask) project.tasks.create('boostDebug', BoostDebugTask) - project.tasks.create('boostDockerBuild', BoostDockerBuildTask) - project.tasks.create('boostDockerPush', BoostDockerPushTask) } } \ No newline at end of file diff --git a/boost-gradle/src/main/groovy/io/openliberty/boost/gradle/extensions/BoostExtension.groovy b/boost-gradle/src/main/groovy/io/openliberty/boost/gradle/extensions/BoostExtension.groovy index 9353789e..393f0744 100644 --- a/boost-gradle/src/main/groovy/io/openliberty/boost/gradle/extensions/BoostExtension.groovy +++ b/boost-gradle/src/main/groovy/io/openliberty/boost/gradle/extensions/BoostExtension.groovy @@ -9,19 +9,12 @@ * IBM Corporation - initial API and implementation *******************************************************************************/ -package io.openliberty.boost.gradle.extensions +package boost.gradle.extensions import org.gradle.util.ConfigureUtil class BoostExtension { - BoostDockerExtension docker - - def docker(Closure closure){ - docker = new BoostDockerExtension() - ConfigureUtil.configure(closure, docker) - } - BoostPackageExtension packaging def packaging(Closure closure){ diff --git a/boost-gradle/src/main/groovy/io/openliberty/boost/gradle/extensions/BoostPackageExtension.groovy b/boost-gradle/src/main/groovy/io/openliberty/boost/gradle/extensions/BoostPackageExtension.groovy index 0a1e709c..848eb712 100644 --- a/boost-gradle/src/main/groovy/io/openliberty/boost/gradle/extensions/BoostPackageExtension.groovy +++ b/boost-gradle/src/main/groovy/io/openliberty/boost/gradle/extensions/BoostPackageExtension.groovy @@ -9,7 +9,7 @@ * IBM Corporation - initial API and implementation *******************************************************************************/ -package io.openliberty.boost.gradle.extensions +package boost.gradle.extensions class BoostPackageExtension { diff --git a/boost-gradle/src/main/groovy/io/openliberty/boost/gradle/runtimes/GradleRuntimeI.groovy b/boost-gradle/src/main/groovy/io/openliberty/boost/gradle/runtimes/GradleRuntimeI.groovy new file mode 100644 index 00000000..639e338c --- /dev/null +++ b/boost-gradle/src/main/groovy/io/openliberty/boost/gradle/runtimes/GradleRuntimeI.groovy @@ -0,0 +1,8 @@ +package boost.gradle.runtimes + +import boost.common.runtimes.RuntimeI +import org.gradle.api.Project + +public interface GradleRuntimeI extends RuntimeI { + public void configureRuntimePlugin(Project project) +} \ No newline at end of file diff --git a/boost-gradle/src/main/groovy/io/openliberty/boost/gradle/tasks/AbstractBoostTask.groovy b/boost-gradle/src/main/groovy/io/openliberty/boost/gradle/tasks/AbstractBoostTask.groovy index 6d6b52b3..1a553e1d 100644 --- a/boost-gradle/src/main/groovy/io/openliberty/boost/gradle/tasks/AbstractBoostTask.groovy +++ b/boost-gradle/src/main/groovy/io/openliberty/boost/gradle/tasks/AbstractBoostTask.groovy @@ -8,15 +8,96 @@ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ -package io.openliberty.boost.gradle.tasks +package boost.gradle.tasks + +import java.io.File +import java.lang.reflect.InvocationTargetException +import java.util.ArrayList +import java.util.List +import java.util.Map +import java.util.ServiceLoader + +import java.net.URL +import java.net.URLClassLoader import org.gradle.api.DefaultTask +import org.gradle.api.GradleException import org.gradle.api.Project +import boost.common.boosters.AbstractBoosterConfig +import boost.common.config.BoosterConfigurator +import boost.gradle.runtimes.GradleRuntimeI +import boost.gradle.utils.BoostLogger +import boost.gradle.utils.GradleProjectUtil + abstract class AbstractBoostTask extends DefaultTask { - protected boolean isDockerConfigured() { - return project.boost.docker != null + private static GradleRuntimeI runtime + private static ClassLoader projectClassLoader + private static List boosterConfigs + + protected static Map dependencies + + private static void init(Project project) throws GradleException { + try { + // TODO move this into getRuntimeInstance() + dependencies = GradleProjectUtil.getAllDependencies(project, BoostLogger.getInstance()) + + List compileClasspathJars = new ArrayList() + + List pathUrls = new ArrayList() + for (File compilePathElement : project.configurations.compileClasspath.resolve()) { + pathUrls.add(compilePathElement.toURI().toURL()) + if (compilePathElement.toString().endsWith(".jar")) { + compileClasspathJars.add(compilePathElement) + } + } + Class thisClass = new Object(){}.getClass().getEnclosingClass(); + URL[] urlsForClassLoader = pathUrls.toArray(new URL[pathUrls.size()]) + projectClassLoader = new URLClassLoader(urlsForClassLoader, thisClass.getClassLoader()) + + boosterConfigs = BoosterConfigurator.getBoosterConfigs(compileClasspathJars, projectClassLoader, + dependencies, BoostLogger.getInstance()) + + } catch (Exception e) { + throw new GradleException(e.getMessage(), e) + } + } + + public static GradleRuntimeI getRuntimeInstance(Project project) throws GradleException { + if (runtime == null) { + init(project) + try { + ServiceLoader runtimes = ServiceLoader.load(GradleRuntimeI.class, projectClassLoader) + if (!runtimes.iterator().hasNext()) { + throw new GradleException( + "No target Boost runtime was detected. Please add a runtime and restart the build.") + } + for (GradleRuntimeI runtimeI : runtimes) { + if (runtime != null) { + throw new GradleException( + "There are multiple Boost runtimes on the classpath. Configure the project to use one runtime and restart the build.") + } + runtime = runtimeI.getClass().newInstance() + } + } catch (IllegalAccessException | InstantiationException | InvocationTargetException + | NoSuchMethodException e) { + throw new GradleException("Error while looking for Boost runtime.") + } + } + return runtime + } + + public static void resetRuntime() { + runtime = null + } + + public static List getBoosterConfigs() { + return boosterConfigs; + } + + protected ClassLoader getProjectClassLoader() { + return projectClassLoader } protected boolean isPackageConfigured() { diff --git a/boost-gradle/src/main/groovy/io/openliberty/boost/gradle/tasks/BoostDebugTask.groovy b/boost-gradle/src/main/groovy/io/openliberty/boost/gradle/tasks/BoostDebugTask.groovy index 8dfd0a1e..ada1ec52 100644 --- a/boost-gradle/src/main/groovy/io/openliberty/boost/gradle/tasks/BoostDebugTask.groovy +++ b/boost-gradle/src/main/groovy/io/openliberty/boost/gradle/tasks/BoostDebugTask.groovy @@ -8,7 +8,7 @@ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ -package io.openliberty.boost.gradle.tasks +package boost.gradle.tasks import org.gradle.api.logging.LogLevel @@ -20,10 +20,8 @@ public class BoostDebugTask extends AbstractBoostTask { logging.level = LogLevel.INFO group 'Boost' - finalizedBy 'libertyDebug' - doFirst { - logger.info('Running the application in debug mode.') + AbstractBoostTask.getRuntimeInstance(project).doDebug(project, this) } }) } diff --git a/boost-gradle/src/main/groovy/io/openliberty/boost/gradle/tasks/BoostPackageTask.groovy b/boost-gradle/src/main/groovy/io/openliberty/boost/gradle/tasks/BoostPackageTask.groovy index e1b32083..0b2acf5e 100644 --- a/boost-gradle/src/main/groovy/io/openliberty/boost/gradle/tasks/BoostPackageTask.groovy +++ b/boost-gradle/src/main/groovy/io/openliberty/boost/gradle/tasks/BoostPackageTask.groovy @@ -9,7 +9,7 @@ * IBM Corporation - initial API and implementation *******************************************************************************/ -package io.openliberty.boost.gradle.tasks +package boost.gradle.tasks import org.codehaus.groovy.GroovyException @@ -33,288 +33,26 @@ import org.gradle.maven.MavenPomArtifact import org.gradle.api.artifacts.ModuleVersionIdentifier import org.gradle.api.tasks.Copy -import io.openliberty.boost.gradle.utils.BoostLogger -import io.openliberty.boost.gradle.utils.GradleProjectUtil -import io.openliberty.boost.common.boosters.AbstractBoosterConfig; -import io.openliberty.boost.common.config.BoosterConfigurator -import io.openliberty.boost.common.config.BoostProperties; -import io.openliberty.boost.common.utils.BoostUtil -import io.openliberty.boost.common.utils.SpringBootUtil +import boost.gradle.utils.BoostLogger +import boost.gradle.utils.GradleProjectUtil +import boost.common.boosters.AbstractBoosterConfig; +import boost.common.config.BoosterConfigurator +import boost.common.config.BoostProperties; +import boost.common.utils.BoostUtil import org.gradle.api.Task import net.wasdev.wlp.gradle.plugins.extensions.PackageAndDumpExtension public class BoostPackageTask extends AbstractBoostTask { - - List boosterPackConfigurators - - String springBootVersion = GradleProjectUtil.findSpringBootVersion(this.project) - - String libertyServerPath = null - BoostPackageTask() { configure({ description 'Packages the application into an executable Liberty jar.' logging.level = LogLevel.INFO group 'Boost' - dependsOn 'libertyCreate' - - mustRunAfter 'boostDockerBuild' - - //There are some things that this task does before we can package up the server into a JAR - PackageAndDumpExtension boostPackage = new PackageAndDumpExtension() - - //We have to check these properties after the build.gradle file has been evaluated. - //Some properties could get set after our plugin is applied. - project.afterEvaluate { - //Configuring spring plugin task dependencies - if (isSpringProject()) { - Task springBootTask = findSpringBootTask(springBootVersion) - - boostPackage.archive = getSpringBootArchivePath(springBootTask) - - if (springBootVersion.startsWith('2.')) { - if (project.plugins.hasPlugin('war')) { - dependsOn 'bootWar' - } else if (project.plugins.hasPlugin('java')) { - dependsOn 'bootJar' - } - } else if (springBootVersion.startsWith('1.')){ - dependsOn 'bootRepackage' - } - - //Skipping if Docker is configured - if (!isDockerConfigured() || isPackageConfigured()) { - springBootTask.finalizedBy 'boostPackage' - } - - } else { - if (project.plugins.hasPlugin('war')) { - boostPackage.archive = project.war.archiveName.substring(0, project.war.archiveName.lastIndexOf(".")) - - //Skipping if Docker is configured - if (!isDockerConfigured() || isPackageConfigured()) { - //Assemble works for the ear task too - project.war.finalizedBy 'boostPackage' - } - } //ear check here when supported - } - //Configuring liberty plugin task dependencies and parameters - //installFeature should check the server.xml in the server directory and install the missing feature - project.tasks.getByName('libertyPackage').dependsOn 'installApps', 'installFeature' - project.tasks.getByName('installApps').mustRunAfter 'installFeature' - boostPackage.include = "runnable, minify" - if (!project.plugins.hasPlugin('war')) { - finalizedBy 'libertyPackage' - } - } - - //The task will perform this before any other task actions doFirst { - - libertyServerPath = "${project.buildDir}/wlp/usr/servers/${project.liberty.server.name}" - if (isPackageConfigured()) { - if(project.boost.packaging.packageName != null && !project.boost.packaging.packageName.isEmpty()) { - boostPackage.archive = "${project.buildDir}/libs/${project.boost.packaging.packageName}" - } - } - - project.liberty.server.packageLiberty = boostPackage - - if (isSpringProject()) { - Task springBootTask = findSpringBootTask(springBootVersion) - File springBootUberJar = new File(getSpringBootArchivePath(springBootTask)) - - if (springBootUberJar != null && !springBootUberJar.exists()) { - throw new GradleException(springBootUberJar.getAbsolutePath() + " Spring Boot Uber JAR does not exist"); - } - - validateSpringBootUberJAR(springBootUberJar) - copySpringBootUberJar(springBootUberJar) - generateServerConfigSpringBoot() - - } else if (project.plugins.hasPlugin('war')) { - // Get booster dependencies from project - Map dependencies = GradleProjectUtil.getAllDependencies(project, BoostLogger.getInstance()) - - // Determine the Java compiler target version and set this internally - System.setProperty(BoostProperties.INTERNAL_COMPILER_TARGET, project.findProperty("targetCompatibility").toString()) - - boosterPackConfigurators = BoosterConfigurator.getBoosterPackConfigurators(dependencies, BoostLogger.getInstance()) - - copyBoosterDependencies() - - generateServerConfigEE() - - } else { - throw new GradleException('Could not package the project with boostPackage. The boostPackage task must be used with a SpringBoot or Java EE project.') - } - - logger.info('Packaging the applicaiton.') + AbstractBoostTask.getRuntimeInstance(project).doPackage(AbstractBoostTask.getBoosterConfigs(), project, this) } }) } - - public boolean isSpringProject() { - return springBootVersion != null && !springBootVersion.isEmpty() - } - - public Task findSpringBootTask(String springBootVersion) { - Task task - - if (springBootVersion == null) { - throw new GradleException("Spring Boot version cannot be null") - } - - //Do not change the order of war and java - if (springBootVersion.startsWith('2.')) { - if (project.plugins.hasPlugin('war')) { - task = project.bootWar - } else if (project.plugins.hasPlugin('java')) { - task = project.bootJar - } - } else if (springBootVersion.startsWith('1.')) { - if (project.plugins.hasPlugin('war')) { - task = project.war - } else if (project.plugins.hasPlugin('java')) { - task = project.jar - } - } - return task - } - - public String getSpringBootArchivePath(Task springBootTask) { - String archiveOutputPath; - - if (springBootVersion.startsWith('2.')) { - archiveOutputPath = springBootTask.archivePath.getAbsolutePath() - } - else if(springBootVersion.startsWith('1.')) { - archiveOutputPath = springBootTask.archivePath.getAbsolutePath() - if (project.bootRepackage.classifier != null && !project.bootRepackage.classifier.isEmpty()) { - archiveOutputPath = archiveOutputPath.substring(0, archiveOutputPath.lastIndexOf(".")) + "-" + project.bootRepackage.classifier + "." + springBootTask.extension - } - } - return archiveOutputPath - } - - public String getClassifier() { - String classifier = null - - if (isSpringProject()) { - if (springBootVersion.startsWith('2.')) { - classifier = project.tasks.getByName('bootJar').classifier - } else if (springBootVersion.startsWith('1.')) { - classifier = project.tasks.getByName('bootRepackage').classifier - } - } - - return classifier - } - - protected void generateServerConfigEE() throws GradleException { - String warName = null - - if (project.war != null) { - - if (project.war.version == null) { - warName = project.war.baseName - } else { - warName = project.war.baseName + "-" + project.war.version - } - } - - try { - - BoosterConfigurator.generateLibertyServerConfig(libertyServerPath, boosterPackConfigurators, Arrays.asList(warName), BoostLogger.getInstance()); - - } catch (Exception e) { - throw new GradleException("Unable to generate server configuration for the Liberty server.", e); - } - } - - protected void generateServerConfigSpringBoot() throws GradleException { - - try { - // Get Spring Boot starters from Maven project - Map dependencies = GradleProjectUtil.getAllDependencies(project, BoostLogger.getInstance()); - - // Generate server config - SpringBootUtil.generateLibertyServerConfig("${project.buildDir}/resources/main", libertyServerPath, - springBootVersion, dependencies, BoostLogger.getInstance()); - - } catch (Exception e) { - throw new GradleException("Unable to generate server configuration for the Liberty server.", e); - } - } - - protected void copySpringBootUberJar(File springBootUberJar) throws GradleException { - try { - File springBootUberJarCopy = null - if (springBootUberJar != null) { // Only copy the Uber JAR if it is valid - springBootUberJarCopy = SpringBootUtil.copySpringBootUberJar(springBootUberJar, - BoostLogger.getInstance()) - } - - if (springBootUberJarCopy == null) { - logger.info('Plugin should replace the project archive: ' + shouldReplaceProjectArchive()) - if (shouldReplaceProjectArchive()) { - if (!project.configurations.archives.allArtifacts.isEmpty()) { - File springJar = new File( - SpringBootUtil.getBoostedSpringBootUberJarPath(project.configurations.archives.allArtifacts[0].getFile())) - if (net.wasdev.wlp.common.plugins.util.SpringBootUtil.isSpringBootUberJar(springJar)) { - logger.info("Copying back Spring Boot Uber JAR as project artifact.") - FileUtils.copyFile(springJar, project.configurations.archives.allArtifacts[0].getFile()) - } - } - } - } else { - logger.info("Copied Spring Boot Uber JAR to " + springBootUberJarCopy.getCanonicalPath()) - } - } catch (BuildException | IOException e) { - throw new GradleException(e.getMessage(), e) - } - - } - - protected void validateSpringBootUberJAR(File springBootUberJar) throws GradleException { - if (!project.configurations.archives.allArtifacts.isEmpty()) { - if (!BoostUtil.isLibertyJar(project.configurations.archives.allArtifacts[0].getFile(), BoostLogger.getInstance()) - && springBootUberJar == null) { - throw new GradleException ( - "A valid Spring Boot Uber JAR was not found. Run the 'bootJar' task and try again.") - } - } - } - - //returns true if bootJar is using the same archiveName as jar - private boolean shouldReplaceProjectArchive() { - if (project.plugins.hasPlugin('java')) { - if (springBootVersion.startsWith('2.')) { - return project.jar.archiveName == project.bootJar.archiveName - } - } - return false - } - - protected void copyBoosterDependencies() { - - List dependenciesToCopy = BoosterConfigurator.getDependenciesToCopy(boosterPackConfigurators, BoostLogger.getInstance()); - - def boosterConfig = project.getConfigurations().create('boosterDependency') - - dependenciesToCopy.each { dep -> - - project.getDependencies().add(boosterConfig.name, dep) - - } - - project.copy { - from project.configurations.boosterDependency - into "${project.buildDir}/wlp/usr/servers/BoostServer/resources" - include '*.jar' - } - } - } diff --git a/boost-gradle/src/main/groovy/io/openliberty/boost/gradle/tasks/BoostRunTask.groovy b/boost-gradle/src/main/groovy/io/openliberty/boost/gradle/tasks/BoostRunTask.groovy index f327ace1..575b9695 100644 --- a/boost-gradle/src/main/groovy/io/openliberty/boost/gradle/tasks/BoostRunTask.groovy +++ b/boost-gradle/src/main/groovy/io/openliberty/boost/gradle/tasks/BoostRunTask.groovy @@ -8,7 +8,7 @@ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ -package io.openliberty.boost.gradle.tasks +package boost.gradle.tasks import org.gradle.api.logging.LogLevel @@ -20,10 +20,8 @@ public class BoostRunTask extends AbstractBoostTask { logging.level = LogLevel.INFO group 'Boost' - finalizedBy 'libertyRun' - doFirst { - logger.info('Running the application in the foreground.') + AbstractBoostTask.getRuntimeInstance(project).doRun(project, this) } }) } diff --git a/boost-gradle/src/main/groovy/io/openliberty/boost/gradle/tasks/BoostStartTask.groovy b/boost-gradle/src/main/groovy/io/openliberty/boost/gradle/tasks/BoostStartTask.groovy index e4930a9a..dd1b5969 100644 --- a/boost-gradle/src/main/groovy/io/openliberty/boost/gradle/tasks/BoostStartTask.groovy +++ b/boost-gradle/src/main/groovy/io/openliberty/boost/gradle/tasks/BoostStartTask.groovy @@ -8,7 +8,7 @@ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ -package io.openliberty.boost.gradle.tasks +package boost.gradle.tasks import org.gradle.api.logging.LogLevel @@ -20,10 +20,9 @@ public class BoostStartTask extends AbstractBoostTask { logging.level = LogLevel.INFO group 'Boost' - dependsOn 'libertyStart' - doFirst { logger.info('Starting the application.') + AbstractBoostTask.getRuntimeInstance(project).doStart(project, this) } }) } diff --git a/boost-gradle/src/main/groovy/io/openliberty/boost/gradle/tasks/BoostStopTask.groovy b/boost-gradle/src/main/groovy/io/openliberty/boost/gradle/tasks/BoostStopTask.groovy index 82d2d316..cc41c0ff 100644 --- a/boost-gradle/src/main/groovy/io/openliberty/boost/gradle/tasks/BoostStopTask.groovy +++ b/boost-gradle/src/main/groovy/io/openliberty/boost/gradle/tasks/BoostStopTask.groovy @@ -8,7 +8,7 @@ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ -package io.openliberty.boost.gradle.tasks +package boost.gradle.tasks import org.gradle.api.logging.LogLevel @@ -20,10 +20,8 @@ public class BoostStopTask extends AbstractBoostTask { logging.level = LogLevel.INFO group 'Boost' - dependsOn 'libertyStop' - doFirst { - logger.info('Stopping the application.') + AbstractBoostTask.getRuntimeInstance(project).doStop(project, this) } }) } diff --git a/boost-gradle/src/main/groovy/io/openliberty/boost/gradle/tasks/docker/AbstractBoostDockerTask.groovy b/boost-gradle/src/main/groovy/io/openliberty/boost/gradle/tasks/docker/AbstractBoostDockerTask.groovy deleted file mode 100644 index d8d3af5e..00000000 --- a/boost-gradle/src/main/groovy/io/openliberty/boost/gradle/tasks/docker/AbstractBoostDockerTask.groovy +++ /dev/null @@ -1,69 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2018 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package io.openliberty.boost.gradle.tasks.docker - -import com.spotify.docker.client.auth.RegistryAuthSupplier -import com.spotify.docker.client.auth.ConfigFileRegistryAuthSupplier - -import io.openliberty.boost.gradle.tasks.AbstractBoostTask -import io.openliberty.boost.gradle.utils.BoostLogger -import io.openliberty.boost.common.BoostException -import io.openliberty.boost.common.docker.AbstractDockerI - -import java.io.File - -import org.gradle.api.Project -import org.gradle.api.GradleException - -public abstract class AbstractBoostDockerTask extends AbstractBoostTask implements AbstractDockerI { - - void doExecute(String artifactId) throws GradleException { - try { - if(isValidDockerConfig(BoostLogger.getInstance(), project.boost.docker.repository, project.boost.docker.tag, artifactId)) { - execute(getDockerClient(project.boost.docker.useProxy)); - } - } catch (BoostException e) { - throw new GradleException(e.getMessage(), e); - } - } - - @Override - public RegistryAuthSupplier createRegistryAuthSupplier() throws BoostException { - return new ConfigFileRegistryAuthSupplier() - } - - public String getArtifactId(Project project, String springBootVersion) throws GradleException { - File appFile - if (springBootVersion != null) { - if (project.plugins.hasPlugin('java')) { - if (springBootVersion.startsWith("2.")) { - appFile = project.bootJar.archivePath - } else if (springBootVersion.startsWith("1.")){ - appFile = project.jar.archivePath - //Checking for classifier in bootRepackage and adding to archiveName - if (project.bootRepackage.classifier != null && !project.bootRepackage.classifier.isEmpty()) { - String appArchiveName = //Adding classifier to the appArchive name - appFile.getName().substring(0, appFile.getName().lastIndexOf(".")) + - '-' + - project.bootRepackage.classifier.toString() + - appFile.getName().substring(appFile.getName().lastIndexOf(".")) - appFile = new File(appFile.getParent(), appArchiveName) - } - } - } else { - throw new GradleException ('Unable to determine the project artifact name to add to the container. Please use the java plugin.') - } - - //Getting image name from boost docker extension if it is set, otherwise we use the file name w/o extension - return appFile.getName().substring(0, appFile.getName().lastIndexOf(".")) - } - } -} \ No newline at end of file diff --git a/boost-gradle/src/main/groovy/io/openliberty/boost/gradle/tasks/docker/BoostDockerBuildTask.groovy b/boost-gradle/src/main/groovy/io/openliberty/boost/gradle/tasks/docker/BoostDockerBuildTask.groovy deleted file mode 100644 index 1b99a53b..00000000 --- a/boost-gradle/src/main/groovy/io/openliberty/boost/gradle/tasks/docker/BoostDockerBuildTask.groovy +++ /dev/null @@ -1,123 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2018 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package io.openliberty.boost.gradle.tasks.docker - -import org.gradle.api.GradleException -import org.gradle.api.logging.LogLevel - -import com.spotify.docker.client.DockerClient - -import io.openliberty.boost.common.BoostException -import io.openliberty.boost.common.docker.DockerBuildI -import io.openliberty.boost.common.docker.DockerParameters -import io.openliberty.boost.gradle.utils.GradleProjectUtil -import io.openliberty.boost.gradle.utils.BoostLogger - -import net.wasdev.wlp.common.plugins.util.SpringBootUtil - -import java.nio.file.FileAlreadyExistsException -import java.nio.file.Files -import java.nio.charset.Charset -import java.util.ArrayList -import java.io.File - -import io.openliberty.boost.gradle.extensions.BoostDockerExtension - -public class BoostDockerBuildTask extends AbstractBoostDockerTask implements DockerBuildI { - - String springBootVersion - String appName - File appFile - - BoostDockerBuildTask() { - configure({ - description 'Dockerizes a Boost project.' - logging.level = LogLevel.INFO - group 'Boost' - - project.afterEvaluate { - springBootVersion = GradleProjectUtil.findSpringBootVersion(project) - if (springBootVersion != null) { - if (project.plugins.hasPlugin('java')) { - if (springBootVersion.startsWith("2.")) { - dependsOn 'bootJar' - appFile = project.bootJar.archivePath - if (isDockerConfigured()) { //We won't add the project to the build lifecycle if Docker isn't configured - project.bootJar.finalizedBy 'boostDockerBuild' - } - } else if (springBootVersion.startsWith("1.")){ - appFile = project.jar.archivePath - //Checking for classifier in bootRepackage and adding to archiveName - if (project.bootRepackage.classifier != null && !project.bootRepackage.classifier.isEmpty()) { - String appArchiveName = //Adding classifier to the appArchive name - appFile.getName().substring(0, appFile.getName().lastIndexOf(".")) + - '-' + - project.bootRepackage.classifier.toString() + - appFile.getName().substring(appFile.getName().lastIndexOf(".")) - appFile = new File(appFile.getParent(), appArchiveName) - } - - dependsOn 'bootRepackage' - - if (isDockerConfigured()) { - project.bootRepackage.finalizedBy 'boostDockerBuild' - } - } - } else { - throw new GradleException ('Unable to determine the project artifact name to add to the container. Please use the java plugin.') - } - - //Getting image name from boost docker extension if it is set, otherwise we use the file name w/o extension - appName = appFile.getName().substring(0, appFile.getName().lastIndexOf(".")) - } - } - - doFirst { - if (appFile == null) { //if we didn't set the appName during configuration we can get it from the project, will be set for springboot projects - if (!project.configurations.archives.allArtifacts.isEmpty()) { - appFile = project.configurations.archives.allArtifacts[0].getFile() - appName = appFile.getName().substring(0, appFile.getName().lastIndexOf(".")) - } else { - throw new GradleException ('Unable to determine the project artifact name.') - } - } - if (!isDockerConfigured()) { - project.boost.docker = new BoostDockerExtension() - } - if (project.boost.docker.repository == null || project.boost.docker.repository.isEmpty()) { - project.boost.docker.repository = appName - } - doExecute(appName) - } - }) - } - - @Override - public void execute(DockerClient dockerClient) throws BoostException { - File projectDirectory = project.projectDir - File outputDirectory = new File(project.buildDir.getAbsolutePath(), 'libs') - - DockerParameters params = new DockerParameters("build/dependency") - - dockerBuild(project.boost.docker.dockerizer, dockerClient, projectDirectory, outputDirectory, springBootVersion, project.boost.docker.pullNewerImage, - project.boost.docker.noCache, project.boost.docker.buildArgs, project.boost.docker.repository, project.boost.docker.tag, params, BoostLogger.getInstance()) - } - - /** - * Find the location of the Spring Boot Uber JAR - * - * @throws BoostException - */ - @Override - public File getAppArchive() throws BoostException { - return appFile - } -} \ No newline at end of file diff --git a/boost-gradle/src/main/groovy/io/openliberty/boost/gradle/tasks/docker/BoostDockerPushTask.groovy b/boost-gradle/src/main/groovy/io/openliberty/boost/gradle/tasks/docker/BoostDockerPushTask.groovy deleted file mode 100644 index 1e1d430c..00000000 --- a/boost-gradle/src/main/groovy/io/openliberty/boost/gradle/tasks/docker/BoostDockerPushTask.groovy +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2018 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package io.openliberty.boost.gradle.tasks.docker - -import org.gradle.api.logging.LogLevel - -import com.spotify.docker.client.DockerClient - -import io.openliberty.boost.common.BoostException -import io.openliberty.boost.common.docker.DockerPushI - -import io.openliberty.boost.gradle.utils.BoostLogger -import io.openliberty.boost.gradle.utils.GradleProjectUtil - -public class BoostDockerPushTask extends AbstractBoostDockerTask implements DockerPushI { - - String appName - - BoostDockerPushTask() { - configure({ - description 'Dockerizes a Boost project.' - logging.level = LogLevel.INFO - group 'Boost' - - dependsOn 'boostDockerBuild' - - project.afterEvaluate { - appName = getArtifactId(project, GradleProjectUtil.findSpringBootVersion(project)) - } - - doFirst { - doExecute(appName) - } - }) - } - - @Override - public void execute(DockerClient dockerClient) throws BoostException { - dockerPush(dockerClient, appName, - project.boost.docker.repository, project.boost.docker.tag, BoostLogger.getInstance()) - } -} \ No newline at end of file diff --git a/boost-gradle/src/main/groovy/io/openliberty/boost/gradle/utils/BoostLogger.groovy b/boost-gradle/src/main/groovy/io/openliberty/boost/gradle/utils/BoostLogger.groovy index 52d83c9f..0ffcaa43 100644 --- a/boost-gradle/src/main/groovy/io/openliberty/boost/gradle/utils/BoostLogger.groovy +++ b/boost-gradle/src/main/groovy/io/openliberty/boost/gradle/utils/BoostLogger.groovy @@ -9,9 +9,9 @@ * IBM Corporation - initial API and implementation *******************************************************************************/ -package io.openliberty.boost.gradle.utils +package boost.gradle.utils -import io.openliberty.boost.common.BoostLoggerI +import boost.common.BoostLoggerI import org.gradle.api.Project diff --git a/boost-gradle/src/main/groovy/io/openliberty/boost/gradle/utils/GradleProjectUtil.groovy b/boost-gradle/src/main/groovy/io/openliberty/boost/gradle/utils/GradleProjectUtil.groovy index 89466019..603b2735 100644 --- a/boost-gradle/src/main/groovy/io/openliberty/boost/gradle/utils/GradleProjectUtil.groovy +++ b/boost-gradle/src/main/groovy/io/openliberty/boost/gradle/utils/GradleProjectUtil.groovy @@ -8,7 +8,7 @@ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ -package io.openliberty.boost.gradle.utils +package boost.gradle.utils import org.gradle.api.Project import org.gradle.api.artifacts.Dependency @@ -19,27 +19,6 @@ import org.gradle.api.artifacts.ModuleVersionIdentifier import groovy.lang.MissingPropertyException public class GradleProjectUtil { - - /** - * Detect spring boot version dependency - */ - public static String findSpringBootVersion(Project project) { - String version = null - - try { - for (Dependency dep : project.buildscript.configurations.classpath.getAllDependencies().toArray()) { - if ("org.springframework.boot".equals(dep.getGroup()) && "spring-boot-gradle-plugin".equals(dep.getName())) { - version = dep.getVersion() - break - } - } - } catch (MissingPropertyException e) { - project.getLogger().warn('No buildscript configuration found.') - return version - } - - return version - } public static Map getAllDependencies(Project project, BoostLogger logger) { Map dependencies = new HashMap() diff --git a/boost-gradle/src/test/groovy/AbstractBoostDockerTest.groovy b/boost-gradle/src/test/groovy/AbstractBoostDockerTest.groovy deleted file mode 100644 index 679de3c2..00000000 --- a/boost-gradle/src/test/groovy/AbstractBoostDockerTest.groovy +++ /dev/null @@ -1,121 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2018 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -import org.junit.Test - -import org.junit.AfterClass - - -import com.github.dockerjava.api.DockerClient -import com.github.dockerjava.api.command.CreateContainerResponse -import com.github.dockerjava.api.model.Container -import com.github.dockerjava.api.model.PortBinding -import com.github.dockerjava.api.model.ExposedPort - -import io.openliberty.boost.common.docker.dockerizer.Dockerizer - -import static org.junit.Assert.assertEquals -import static org.junit.Assert.assertTrue -import static org.gradle.testkit.runner.TaskOutcome.SUCCESS - -public abstract class AbstractBoostDockerTest extends AbstractBoostTest { - protected static final String OL_SPRING_15_IMAGE = "open-liberty:springBoot1" - protected static final String OL_SPRING_20_IMAGE = "open-liberty:springBoot2" - - protected static final String OPEN_J9_IMAGE = "adoptopenjdk/openjdk8-openj9" - - protected static File dockerFile - protected static DockerClient dockerClient - - protected static String containerId - - protected static String repository - protected static String libertyImage - protected static String dockerPort - - @AfterClass - public static void cleanup() throws Exception { - dockerClient.stopContainerCmd(containerId).exec() - - dockerClient.removeContainerCmd(containerId).exec() - } - - @Test - public void testDockerSuccess() throws IOException { - assertEquals(SUCCESS, result.task(":boostDockerBuild").getOutcome()) - } - - @Test - public void testDockerizeCreatesDockerfile() throws Exception { - assertTrue(dockerFile.getCanonicalPath() + " was not created", dockerFile.exists()) - } - - @Test - public void testDockerfileContainsCorrectLibertyImage() throws Exception { - BufferedReader reader = new BufferedReader(new FileReader(dockerFile)) - - assertTrue("Expected Liberty generated Dockerfile line ${Dockerizer.BOOST_GEN} was not found in " + dockerFile.getCanonicalPath(), reader.readLine().contains(Dockerizer.BOOST_GEN)) - assertTrue("Expected Open liberty base image ${libertyImage} was not found in " + dockerFile.getCanonicalPath(), reader.readLine().contains(libertyImage)) - } - - @Test - public void runDockerContainerAndVerifyAppOnEndpoint() throws Exception { - ExposedPort exposedPort = ExposedPort.tcp(Integer.valueOf(dockerPort)) - - CreateContainerResponse container = dockerClient.createContainerCmd("${repository}:latest") - .withPortBindings(PortBinding.parse(dockerPort + ":" + dockerPort)).withExposedPorts(exposedPort).exec() - Thread.sleep(3000) - - containerId = container.getId() - - dockerClient.startContainerCmd(containerId).exec() - - Thread.sleep(10000) - testDockerContainerRunning() - - Thread.sleep(10000) - testAppRunningOnEndpoint() - } - - public void testDockerContainerRunning() throws Exception { - List containers = dockerClient.listContainersCmd().exec() - // docker local registry conatiner and image container - assertEquals("Expected number of running containers not found", 2, containers.size()) - } - - public void testAppRunningOnEndpoint() throws Exception { - URL requestUrl = new URL("http://" + getTestDockerHost() + ":" + dockerPort) - HttpURLConnection conn = (HttpURLConnection) requestUrl.openConnection() - - if (conn != null) { - assertEquals("Expected response code not found.", 200, conn.getResponseCode()) - } - - StringBuffer response = new StringBuffer() - - BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream())) - String line; - while ((line = br.readLine()) != null) { - response.append(line) - } - assertEquals("Expected body not found.", "Greetings from Spring Boot!", response.toString()) - } - - private static String getTestDockerHost() { - String dockerHostEnv = System.getenv("DOCKER_HOST"); - if (dockerHostEnv == null || dockerHostEnv.isEmpty()) { - return "localhost"; - } else { - URI dockerHostURI = URI.create(dockerHostEnv); - return dockerHostURI.getHost(); - } - } - -} \ No newline at end of file diff --git a/boost-gradle/src/test/groovy/BoostFunctionalTest.groovy b/boost-gradle/src/test/groovy/BoostFunctionalTest.groovy deleted file mode 100644 index 6d3253f6..00000000 --- a/boost-gradle/src/test/groovy/BoostFunctionalTest.groovy +++ /dev/null @@ -1,66 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2018 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -import org.gradle.testkit.runner.BuildResult -import org.gradle.testkit.runner.GradleRunner -import org.junit.Before -import org.junit.Test - -import java.io.File -import java.io.IOException - -import static org.junit.Assert.assertEquals -import static org.junit.Assert.assertTrue - -import static org.gradle.testkit.runner.TaskOutcome.* - -public class BoostFunctionalTest extends AbstractBoostTest { - - String buildFileContent = "buildscript {\n\t" + - "repositories {\n\t\t" + - "mavenLocal()\n\t\t" + - "mavenCentral()\n\t\t" + - "maven {\n\t\t\t" + - "url 'https://oss.sonatype.org/content/repositories/snapshots/'\n\t\t" + - "}\n\t" + - "}\n\t" + - "dependencies {\n\t\t" + - "classpath \"io.openliberty.boost:boost-gradle-plugin:\$boostVersion\"\n\t" + - "}\n" + - "}\n\n" + - "apply plugin: 'boost'\n\n" + - "repositories {\n\t" + - "mavenLocal()\n\t" + - "mavenCentral()\n" + - "}\n\n" + - "dependencies {\n\t" + - "libertyRuntime \"\$runtimeGroup:\$runtimeArtifactId:\$runtimeVersion\"\n" + - "}" - - @Before - void setup () { - testProjectDir = new File(integTestDir, 'BoostFunctionalTest') - - createDir(testProjectDir) - writeFile(new File(testProjectDir, 'build.gradle'), buildFileContent) - copyFile(new File("build/gradle.properties"), new File(testProjectDir, 'gradle.properties')) - } - - @Test - public void testStartAndStopTasks() throws IOException { - BuildResult result = GradleRunner.create() - .withProjectDir(testProjectDir) - .withArguments("boostStart", "boostStop") - .build() - - assertEquals(SUCCESS, result.task(":boostStart").getOutcome()) - assertEquals(SUCCESS, result.task(":boostStop").getOutcome()) - } -} diff --git a/boost-gradle/src/test/groovy/BoostPackageJPA21Test.groovy b/boost-gradle/src/test/groovy/BoostPackageJPA21Test.groovy index f817a3ae..eb0eeefe 100644 --- a/boost-gradle/src/test/groovy/BoostPackageJPA21Test.groovy +++ b/boost-gradle/src/test/groovy/BoostPackageJPA21Test.groovy @@ -51,8 +51,6 @@ public class BoostPackageJPA21Test extends AbstractBoostTest { @Test public void testPackageSuccess() throws IOException { - assertEquals(SUCCESS, result.task(":installLiberty").getOutcome()) - assertEquals(SUCCESS, result.task(":libertyCreate").getOutcome()) assertEquals(SUCCESS, result.task(":boostPackage").getOutcome()) assertEquals(SUCCESS, result.task(":boostStart").getOutcome()) diff --git a/boost-gradle/src/test/groovy/BoostPackageJPA22Test.groovy b/boost-gradle/src/test/groovy/BoostPackageJPA22Test.groovy index 569806df..c416de43 100644 --- a/boost-gradle/src/test/groovy/BoostPackageJPA22Test.groovy +++ b/boost-gradle/src/test/groovy/BoostPackageJPA22Test.groovy @@ -51,8 +51,6 @@ public class BoostPackageJPA22Test extends AbstractBoostTest { @Test public void testPackageSuccess() throws IOException { - assertEquals(SUCCESS, result.task(":installLiberty").getOutcome()) - assertEquals(SUCCESS, result.task(":libertyCreate").getOutcome()) assertEquals(SUCCESS, result.task(":boostPackage").getOutcome()) assertEquals(SUCCESS, result.task(":boostStart").getOutcome()) diff --git a/boost-gradle/src/test/groovy/BoostPackageJaxRS20Test.groovy b/boost-gradle/src/test/groovy/BoostPackageJaxRS20Test.groovy index a920f6ed..6c1e7854 100644 --- a/boost-gradle/src/test/groovy/BoostPackageJaxRS20Test.groovy +++ b/boost-gradle/src/test/groovy/BoostPackageJaxRS20Test.groovy @@ -54,8 +54,6 @@ public class BoostPackageJaxRS20Test extends AbstractBoostTest { @Test public void testPackageSuccess() throws IOException { - assertEquals(SUCCESS, result.task(":installLiberty").getOutcome()) - assertEquals(SUCCESS, result.task(":libertyCreate").getOutcome()) assertEquals(SUCCESS, result.task(":boostPackage").getOutcome()) assertEquals(SUCCESS, result.task(":boostStart").getOutcome()) diff --git a/boost-gradle/src/test/groovy/BoostPackageJaxRS21Test.groovy b/boost-gradle/src/test/groovy/BoostPackageJaxRS21Test.groovy index d8d787d8..601c88e0 100644 --- a/boost-gradle/src/test/groovy/BoostPackageJaxRS21Test.groovy +++ b/boost-gradle/src/test/groovy/BoostPackageJaxRS21Test.groovy @@ -51,8 +51,6 @@ public class BoostPackageJaxRS21Test extends AbstractBoostTest { @Test public void testPackageSuccess() throws IOException { - assertEquals(SUCCESS, result.task(":installLiberty").getOutcome()) - assertEquals(SUCCESS, result.task(":libertyCreate").getOutcome()) assertEquals(SUCCESS, result.task(":boostPackage").getOutcome()) assertEquals(SUCCESS, result.task(":boostStart").getOutcome()) diff --git a/boost-gradle/src/test/groovy/BoostPackageSpring15Test.groovy b/boost-gradle/src/test/groovy/BoostPackageSpring15Test.groovy deleted file mode 100644 index 3369007b..00000000 --- a/boost-gradle/src/test/groovy/BoostPackageSpring15Test.groovy +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2018 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -import org.gradle.testkit.runner.GradleRunner -import org.junit.BeforeClass -import org.junit.Test - -import static org.junit.Assert.assertTrue - -public class PackageSpring15Test extends AbstractBoostTest { - - @BeforeClass - public static void setup() { - resourceDir = new File("build/resources/test/test-spring-boot") - testProjectDir = new File(integTestDir, "PackageSpring15Test") - buildFilename = "springApp-15.gradle" - createDir(testProjectDir) - createTestProject(testProjectDir, resourceDir, buildFilename) - - result = GradleRunner.create() - .withProjectDir(testProjectDir) - .forwardOutput() - .withArguments("build", "boostStart", "boostStop", "-i", "-s") - .build() - } - - @Test - public void testPackageSuccess() throws IOException { - testPackageTask() - assertTrue(new File(testProjectDir, "build/libs/test-spring15.jar").exists()) - } - - @Test - public void testPackageContents() throws IOException { - testPackageContentsforSpring15() - } -} diff --git a/boost-gradle/src/test/groovy/BoostPackageSpring20Test.groovy b/boost-gradle/src/test/groovy/BoostPackageSpring20Test.groovy deleted file mode 100644 index 4544be23..00000000 --- a/boost-gradle/src/test/groovy/BoostPackageSpring20Test.groovy +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2018 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -import org.gradle.testkit.runner.GradleRunner -import org.junit.BeforeClass -import org.junit.Test - -import static org.junit.Assert.assertTrue - -public class PackageSpring20Test extends AbstractBoostTest { - - @BeforeClass - public static void setup() { - resourceDir = new File("build/resources/test/test-spring-boot") - testProjectDir = new File(integTestDir, "PackageSpring20Test") - buildFilename = "springApp-20.gradle" - - createDir(testProjectDir) - createTestProject(testProjectDir, resourceDir, buildFilename) - - result = GradleRunner.create() - .withProjectDir(testProjectDir) - .forwardOutput() - .withArguments("build", "boostStart", "boostStop", "-i", "-s") - .build() - } - - @Test - public void testPackageSuccess() throws IOException { - testPackageTask() - assertTrue(new File(testProjectDir, "build/libs/gs-spring-boot-0.1.0.jar").exists()) - } - - @Test - public void testPackageContents() throws IOException { - testPackageContentsforSpring20() - } -} diff --git a/boost-gradle/src/test/groovy/BoostPackageSpringSSLTest.groovy b/boost-gradle/src/test/groovy/BoostPackageSpringSSLTest.groovy deleted file mode 100644 index 81663ba2..00000000 --- a/boost-gradle/src/test/groovy/BoostPackageSpringSSLTest.groovy +++ /dev/null @@ -1,103 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2018 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -import org.gradle.testkit.runner.GradleRunner -import org.junit.BeforeClass -import org.junit.AfterClass -import org.junit.Test - -import javax.net.ssl.SSLContext; -import javax.net.ssl.TrustManager; -import javax.net.ssl.X509TrustManager; - -import org.apache.http.HttpResponse; -import org.apache.http.HttpStatus; - -import org.apache.http.client.ResponseHandler; -import org.apache.http.impl.client.BasicResponseHandler; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.conn.ssl.NoopHostnameVerifier; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClients; -import org.gradle.testkit.runner.TaskOutcome - -import static org.junit.Assert.assertEquals -import static org.junit.Assert.assertTrue -import static org.gradle.testkit.runner.TaskOutcome.SUCCESS - -public class BoostPackageSpringSSLTest extends AbstractBoostTest { - - private static String URL = "https://localhost:8443/"; - - @BeforeClass - public static void setup() { - resourceDir = new File("build/resources/test/test-spring-boot-ssl") - testProjectDir = new File(integTestDir, "PackageSpringSSLTest") - buildFilename = "build.gradle" - - createDir(testProjectDir) - createTestProject(testProjectDir, resourceDir, buildFilename) - - result = GradleRunner.create() - .withProjectDir(testProjectDir) - .forwardOutput() - .withArguments("boostPackage", "boostStart", "-i", "-s") - .build() - - assertEquals(SUCCESS, result.task(":boostPackage").getOutcome()) - assertEquals(SUCCESS, result.task(":boostStart").getOutcome()) - } - - @AfterClass - public static void teardown() { - - result = GradleRunner.create() - .withProjectDir(testProjectDir) - .forwardOutput() - .withArguments("boostStop", "-i", "-s") - .build() - - assertEquals(SUCCESS, result.task(":boostStop").getOutcome()) - } - - @Test - public void testServlet() throws Exception { - - def nullTrustManager = [ - checkClientTrusted: { chain, authType -> }, - checkServerTrusted: { chain, authType -> }, - getAcceptedIssuers: { null } - ] - - def nullHostnameVerifier = [ - verify: { hostname, session -> true } - ] - - SSLContext sslContext = SSLContext.getInstance("SSL") - sslContext.init(null, [nullTrustManager as X509TrustManager] as TrustManager[], null) - - 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 handler = new BasicResponseHandler(); - String body = handler.handleResponse(response); - - assertTrue("Unexpected response body", body.contains("Greetings from Spring Boot!")); - } -} diff --git a/boost-gradle/src/test/groovy/DockerBuild15Test.groovy b/boost-gradle/src/test/groovy/DockerBuild15Test.groovy deleted file mode 100644 index f6816f02..00000000 --- a/boost-gradle/src/test/groovy/DockerBuild15Test.groovy +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2018 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -import org.gradle.testkit.runner.GradleRunner -import org.junit.BeforeClass -import com.github.dockerjava.core.DockerClientBuilder - -public class DockerBuild15Test extends AbstractBoostDockerTest { - - @BeforeClass - public static void setup() { - resourceDir = new File("build/resources/test/test-spring-boot") - testProjectDir = new File(integTestDir, "DockerBuild15Test") - buildFilename = "docker15Test.gradle" - libertyImage = OL_SPRING_15_IMAGE - repository = "localhost:5000/test-image15" - dockerPort = "9080" - - createDir(testProjectDir) - createTestProject(testProjectDir, resourceDir, buildFilename) - dockerFile = new File(testProjectDir, "Dockerfile") - dockerClient = DockerClientBuilder.getInstance().build() - - result = GradleRunner.create() - .withProjectDir(testProjectDir) - .forwardOutput() - .withArguments("build", "-i", "-s") - .build() - } -} \ No newline at end of file diff --git a/boost-gradle/src/test/groovy/DockerBuild20Test.groovy b/boost-gradle/src/test/groovy/DockerBuild20Test.groovy deleted file mode 100644 index d3c1f9ba..00000000 --- a/boost-gradle/src/test/groovy/DockerBuild20Test.groovy +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2018 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -import org.gradle.testkit.runner.GradleRunner -import org.junit.BeforeClass -import com.github.dockerjava.core.DockerClientBuilder - -public class DockerBuild20Test extends AbstractBoostDockerTest { - - @BeforeClass - public static void setup() { - resourceDir = new File("build/resources/test/test-spring-boot") - testProjectDir = new File(integTestDir, "DockerBuild20Test") - buildFilename = "docker20Test.gradle" - libertyImage = OL_SPRING_20_IMAGE - repository = "localhost:5000/test-image20" - dockerPort = "9080" - - createDir(testProjectDir) - createTestProject(testProjectDir, resourceDir, buildFilename) - dockerFile = new File(testProjectDir, "Dockerfile") - dockerClient = DockerClientBuilder.getInstance().build() - - result = GradleRunner.create() - .withProjectDir(testProjectDir) - .forwardOutput() - .withArguments("build", "-i", "-s") - .build() - } -} \ No newline at end of file diff --git a/boost-gradle/src/test/groovy/DockerBuildDockerizerClasspath15Test.groovy b/boost-gradle/src/test/groovy/DockerBuildDockerizerClasspath15Test.groovy deleted file mode 100644 index 0a826beb..00000000 --- a/boost-gradle/src/test/groovy/DockerBuildDockerizerClasspath15Test.groovy +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2018 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -import org.gradle.testkit.runner.GradleRunner -import org.junit.BeforeClass -import com.github.dockerjava.core.DockerClientBuilder - -public class DockerBuildDockerizerClasspath15Test extends AbstractBoostDockerTest { - - @BeforeClass - public static void setup() { - resourceDir = new File("build/resources/test/test-spring-boot") - testProjectDir = new File(integTestDir, "DockerBuildDockerizerClasspath15Test") - buildFilename = "dockerDockerizerClasspath15Test.gradle" - libertyImage = OPEN_J9_IMAGE - repository = "localhost:5000/test-classpath15" - dockerPort = "8080" - - createDir(testProjectDir) - createTestProject(testProjectDir, resourceDir, buildFilename) - dockerFile = new File(testProjectDir, "Dockerfile") - dockerClient = DockerClientBuilder.getInstance().build() - - result = GradleRunner.create() - .withProjectDir(testProjectDir) - .forwardOutput() - .withArguments("build", "-i", "-s") - .build() - } -} \ No newline at end of file diff --git a/boost-gradle/src/test/groovy/DockerBuildDockerizerClasspath20Test.groovy b/boost-gradle/src/test/groovy/DockerBuildDockerizerClasspath20Test.groovy deleted file mode 100644 index f2732fa9..00000000 --- a/boost-gradle/src/test/groovy/DockerBuildDockerizerClasspath20Test.groovy +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2018 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -import org.gradle.testkit.runner.GradleRunner -import org.junit.BeforeClass -import com.github.dockerjava.core.DockerClientBuilder - -public class DockerBuildDockerizerClasspath20Test extends AbstractBoostDockerTest { - - @BeforeClass - public static void setup() { - resourceDir = new File("build/resources/test/test-spring-boot") - testProjectDir = new File(integTestDir, "DockerBuildDockerizerClasspath20Test") - buildFilename = "dockerDockerizerClasspath20Test.gradle" - libertyImage = OPEN_J9_IMAGE - repository = "localhost:5000/test-classpath20" - dockerPort = "8080" - - createDir(testProjectDir) - createTestProject(testProjectDir, resourceDir, buildFilename) - dockerFile = new File(testProjectDir, "Dockerfile") - dockerClient = DockerClientBuilder.getInstance().build() - - result = GradleRunner.create() - .withProjectDir(testProjectDir) - .forwardOutput() - .withArguments("build", "-i", "-s") - .build() - } -} \ No newline at end of file diff --git a/boost-gradle/src/test/groovy/DockerBuildDockerizerJar15Test.groovy b/boost-gradle/src/test/groovy/DockerBuildDockerizerJar15Test.groovy deleted file mode 100644 index eb29fce5..00000000 --- a/boost-gradle/src/test/groovy/DockerBuildDockerizerJar15Test.groovy +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2018 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -import org.gradle.testkit.runner.GradleRunner -import org.junit.BeforeClass -import com.github.dockerjava.core.DockerClientBuilder - -public class DockerBuildDockerizerJar15Test extends AbstractBoostDockerTest { - - @BeforeClass - public static void setup() { - resourceDir = new File("build/resources/test/test-spring-boot") - testProjectDir = new File(integTestDir, "DockerBuildDockerizerJar15Test") - buildFilename = "dockerDockerizerJar15Test.gradle" - libertyImage = OPEN_J9_IMAGE - repository = "localhost:5000/test-jar15" - dockerPort = "8080" - - createDir(testProjectDir) - createTestProject(testProjectDir, resourceDir, buildFilename) - dockerFile = new File(testProjectDir, "Dockerfile") - dockerClient = DockerClientBuilder.getInstance().build() - - result = GradleRunner.create() - .withProjectDir(testProjectDir) - .forwardOutput() - .withArguments("build", "-i", "-s") - .build() - } -} \ No newline at end of file diff --git a/boost-gradle/src/test/groovy/DockerBuildDockerizerJar20Test.groovy b/boost-gradle/src/test/groovy/DockerBuildDockerizerJar20Test.groovy deleted file mode 100644 index c730f81a..00000000 --- a/boost-gradle/src/test/groovy/DockerBuildDockerizerJar20Test.groovy +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2018 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -import org.gradle.testkit.runner.GradleRunner -import org.junit.BeforeClass - -import com.github.dockerjava.core.DockerClientBuilder - -public class DockerBuildDockerizerJar20Test extends AbstractBoostDockerTest { - - @BeforeClass - public static void setup() { - resourceDir = new File("build/resources/test/test-spring-boot") - testProjectDir = new File(integTestDir, "DockerBuildDockerizerJar20Test") - buildFilename = "dockerDockerizerJar20Test.gradle" - libertyImage = OPEN_J9_IMAGE - repository = "localhost:5000/test-jar20" - dockerPort = "8080" - - createDir(testProjectDir) - createTestProject(testProjectDir, resourceDir, buildFilename) - dockerFile = new File(testProjectDir, "Dockerfile") - dockerClient = DockerClientBuilder.getInstance().build() - - result = GradleRunner.create() - .withProjectDir(testProjectDir) - .forwardOutput() - .withArguments("build", "-i", "-s") - .build() - } -} \ No newline at end of file diff --git a/boost-gradle/src/test/groovy/DockerClassifier15Test.groovy b/boost-gradle/src/test/groovy/DockerClassifier15Test.groovy deleted file mode 100644 index f454e09e..00000000 --- a/boost-gradle/src/test/groovy/DockerClassifier15Test.groovy +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2018 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -import org.gradle.testkit.runner.GradleRunner -import org.junit.BeforeClass -import com.github.dockerjava.core.DockerClientBuilder - -//Tests creating a Docker image with an extension -public class DockerClassifier15Test extends AbstractBoostDockerTest { - - @BeforeClass - public static void setup() { - resourceDir = new File("build/resources/test/test-spring-boot") - testProjectDir = new File(integTestDir, "DockerClassifier15Test") - buildFilename = "dockerClassifier15Test.gradle" - libertyImage = OL_SPRING_15_IMAGE - repository = "test-docker15-test" - dockerPort = "9080" - - createDir(testProjectDir) - createTestProject(testProjectDir, resourceDir, buildFilename) - dockerFile = new File(testProjectDir, "Dockerfile") - dockerClient = DockerClientBuilder.getInstance().build() - - result = GradleRunner.create() - .withProjectDir(testProjectDir) - .forwardOutput() - .withArguments("build", "-i", "-s") - .build() - } -} \ No newline at end of file diff --git a/boost-gradle/src/test/groovy/DockerClassifier20Test.groovy b/boost-gradle/src/test/groovy/DockerClassifier20Test.groovy deleted file mode 100644 index 62997247..00000000 --- a/boost-gradle/src/test/groovy/DockerClassifier20Test.groovy +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2018 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -import org.gradle.testkit.runner.GradleRunner -import org.junit.BeforeClass -import com.github.dockerjava.core.DockerClientBuilder - -//Tests creating a Docker image with an extension -public class DockerClassifier20Test extends AbstractBoostDockerTest { - - @BeforeClass - public static void setup() { - resourceDir = new File("build/resources/test/test-spring-boot") - testProjectDir = new File(integTestDir, "DockerClassifier20Test") - buildFilename = "dockerClassifier20Test.gradle" - libertyImage = OL_SPRING_20_IMAGE - repository = "test-docker20-test" - dockerPort = "9080" - - createDir(testProjectDir) - createTestProject(testProjectDir, resourceDir, buildFilename) - dockerFile = new File(testProjectDir, "Dockerfile") - dockerClient = DockerClientBuilder.getInstance().build() - - result = GradleRunner.create() - .withProjectDir(testProjectDir) - .forwardOutput() - .withArguments("build", "-i", "-s") - .build() - } - -} \ No newline at end of file diff --git a/boost-gradle/src/test/groovy/DockerEmpty15Test.groovy b/boost-gradle/src/test/groovy/DockerEmpty15Test.groovy deleted file mode 100644 index 0ea6b78c..00000000 --- a/boost-gradle/src/test/groovy/DockerEmpty15Test.groovy +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2018 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -import org.gradle.testkit.runner.GradleRunner -import org.junit.BeforeClass -import com.github.dockerjava.core.DockerClientBuilder - -public class DockerEmpty15Test extends AbstractBoostDockerTest { - - @BeforeClass - public static void setup() { - resourceDir = new File("build/resources/test/test-spring-boot") - testProjectDir = new File(integTestDir, "DockerEmpty15Test") - buildFilename = "dockerEmpty15Test.gradle" - libertyImage = OL_SPRING_15_IMAGE - repository = "test-docker15" - dockerPort = "9080" - - createDir(testProjectDir) - createTestProject(testProjectDir, resourceDir, buildFilename) - dockerFile = new File(testProjectDir, "Dockerfile") - dockerClient = DockerClientBuilder.getInstance().build() - - result = GradleRunner.create() - .withProjectDir(testProjectDir) - .forwardOutput() - .withArguments("build", "-i", "-s") - .build() - } -} \ No newline at end of file diff --git a/boost-gradle/src/test/groovy/DockerEmpty20Test.groovy b/boost-gradle/src/test/groovy/DockerEmpty20Test.groovy deleted file mode 100644 index 91922a4f..00000000 --- a/boost-gradle/src/test/groovy/DockerEmpty20Test.groovy +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2018 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -import org.gradle.testkit.runner.GradleRunner -import org.junit.BeforeClass -import com.github.dockerjava.core.DockerClientBuilder - -public class DockerEmpty20Test extends AbstractBoostDockerTest { - - @BeforeClass - public static void setup() { - resourceDir = new File("build/resources/test/test-spring-boot") - testProjectDir = new File(integTestDir, "DockerEmpty20Test") - buildFilename = "dockerEmpty20Test.gradle" - libertyImage = OL_SPRING_20_IMAGE - repository = "test-docker20" - dockerPort = "9080" - - createDir(testProjectDir) - createTestProject(testProjectDir, resourceDir, buildFilename) - dockerFile = new File(testProjectDir, "Dockerfile") - dockerClient = DockerClientBuilder.getInstance().build() - - result = GradleRunner.create() - .withProjectDir(testProjectDir) - .forwardOutput() - .withArguments("build", "-i", "-s") - .build() - } -} \ No newline at end of file diff --git a/boost-gradle/src/test/groovy/DockerPush15Test.groovy b/boost-gradle/src/test/groovy/DockerPush15Test.groovy deleted file mode 100644 index 3258e964..00000000 --- a/boost-gradle/src/test/groovy/DockerPush15Test.groovy +++ /dev/null @@ -1,101 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2018 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -import static org.gradle.testkit.runner.TaskOutcome.SUCCESS -import static org.junit.Assert.assertEquals -import static org.junit.Assert.assertNull -import static org.junit.Assert.assertNotNull - -import org.gradle.testkit.runner.GradleRunner -import java.util.concurrent.TimeUnit -import org.junit.BeforeClass -import org.junit.Test - -import com.github.dockerjava.core.DockerClientBuilder -import com.github.dockerjava.api.model.Image -import com.github.dockerjava.core.command.PullImageResultCallback - -public class DockerPush15Test extends AbstractBoostDockerTest { - - private static String imageName = "localhost:5000/test-image15:latest" - - @BeforeClass - public static void setup() { - - resourceDir = new File("build/resources/test/test-spring-boot") - testProjectDir = new File(integTestDir, "DockerPush15Test") - buildFilename = "docker15Test.gradle" - libertyImage = OL_SPRING_15_IMAGE - repository = "localhost:5000/test-image15" - dockerPort = "9080" - - createDir(testProjectDir) - createTestProject(testProjectDir, resourceDir, buildFilename) - dockerFile = new File(testProjectDir, "Dockerfile") - dockerClient = DockerClientBuilder.getInstance().build() - - result = GradleRunner.create() - .withProjectDir(testProjectDir) - .forwardOutput() - .withArguments("boostDockerPush", "-i", "-s") - .build() - } - - @Test - public void testPushSuccess() throws Exception { - assertEquals(SUCCESS, result.task(":boostDockerPush").getOutcome()) - } - - @Test - public void testPushDockerImageToLocalRegistry() throws Exception { - Image pushedImage = getImage(imageName) - assertNotNull(imageName + " was not built.", pushedImage) - - long sizeOfPushedImage = pushedImage.getSize() - String idOfPushedImage = pushedImage.getId() - - // Remove the local image. - removeImage(imageName) - - // Pull the image from the local repository which got pushed by the plugin. This - // is possible if the plugin successfully pushed to the registry. - dockerClient.pullImageCmd("${repository}").withTag("latest").exec(new PullImageResultCallback()) - .awaitCompletion(10, TimeUnit.SECONDS) - - Image pulledImage = getImage(imageName) - assertNotNull(repository + " was not pulled.", pulledImage) - - long sizeOfPulledImage = pulledImage.getSize() - String idOfPulledImage = pulledImage.getId() - - assertEquals("Expected image was not pulled, size doesn't match.", sizeOfPushedImage, sizeOfPulledImage) - assertEquals("Expected image was not pulled, id doesn't match.", idOfPushedImage, idOfPulledImage) - } - - private Image getImage(String repository) throws Exception { - List images = dockerClient.listImagesCmd().exec() - for (Image image : images) { - String[] repoTags = image.getRepoTags() - if (repoTags != null) { - String repoTag = repoTags[0] - if (repoTag != null && repoTag.equals(repository)) { - return image - } - } - } - return null; - } - - private void removeImage(String repository) throws Exception { - dockerClient.removeImageCmd(repository).exec() - Image removedImage = getImage(repository) - assertNull(repository + " was not removed.", removedImage) - } -} \ No newline at end of file diff --git a/boost-gradle/src/test/groovy/DockerPush20Test.groovy b/boost-gradle/src/test/groovy/DockerPush20Test.groovy deleted file mode 100644 index 0d47f9c3..00000000 --- a/boost-gradle/src/test/groovy/DockerPush20Test.groovy +++ /dev/null @@ -1,102 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2018 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -import org.gradle.testkit.runner.GradleRunner -import static org.gradle.testkit.runner.TaskOutcome.SUCCESS -import org.junit.BeforeClass -import org.junit.Test -import java.util.concurrent.TimeUnit - -import com.github.dockerjava.core.DockerClientBuilder -import com.github.dockerjava.api.model.Image -import com.github.dockerjava.core.command.PullImageResultCallback - -import static org.junit.Assert.assertEquals -import static org.junit.Assert.assertNull -import static org.junit.Assert.assertNotNull - -public class DockerPush20Test extends AbstractBoostDockerTest { - - private static String imageName = "localhost:5000/test-image20:latest" - - @BeforeClass - public static void setup() { - - resourceDir = new File("build/resources/test/test-spring-boot") - testProjectDir = new File(integTestDir, "DockerPush20Test") - buildFilename = "docker20Test.gradle" - libertyImage = OL_SPRING_20_IMAGE - repository = "localhost:5000/test-image20" - dockerPort = "9080" - - createDir(testProjectDir) - createTestProject(testProjectDir, resourceDir, buildFilename) - dockerFile = new File(testProjectDir, "Dockerfile") - dockerClient = DockerClientBuilder.getInstance().build() - - result = GradleRunner.create() - .withProjectDir(testProjectDir) - .forwardOutput() - .withArguments("boostDockerPush", "-i", "-s") - .build() - } - - @Test - public void testPushSuccess() throws Exception { - assertEquals(SUCCESS, result.task(":boostDockerPush").getOutcome()) - } - - @Test - public void testPushDockerImageToLocalRegistry() throws Exception { - Image pushedImage = getImage(imageName) - assertNotNull(imageName + " was not built.", pushedImage) - - long sizeOfPushedImage = pushedImage.getSize() - String idOfPushedImage = pushedImage.getId() - - // Remove the local image. - removeImage(imageName) - - // Pull the image from the local repository which got pushed by the plugin. This - // is possible if the plugin successfully pushed to the registry. - dockerClient.pullImageCmd("${repository}").withTag("latest").exec(new PullImageResultCallback()) - .awaitCompletion(10, TimeUnit.SECONDS) - - Image pulledImage = getImage(imageName) - assertNotNull(repository + " was not pulled.", pulledImage) - - long sizeOfPulledImage = pulledImage.getSize() - String idOfPulledImage = pulledImage.getId() - - assertEquals("Expected image was not pulled, size doesn't match.", sizeOfPushedImage, sizeOfPulledImage) - assertEquals("Expected image was not pulled, id doesn't match.", idOfPushedImage, idOfPulledImage) - } - - private Image getImage(String repository) throws Exception { - List images = dockerClient.listImagesCmd().exec() - for (Image image : images) { - String[] repoTags = image.getRepoTags() - if (repoTags != null) { - String repoTag = repoTags[0] - if (repoTag != null && repoTag.equals(repository)) { - return image - } - } - } - return null; - } - - private void removeImage(String repository) throws Exception { - dockerClient.removeImageCmd(repository).exec() - Image removedImage = getImage(repository) - assertNull(repository + " was not removed.", removedImage) - } -} \ No newline at end of file diff --git a/boost-gradle/src/test/groovy/PackageAndDockerize15Test.groovy b/boost-gradle/src/test/groovy/PackageAndDockerize15Test.groovy deleted file mode 100644 index 3eba4f4b..00000000 --- a/boost-gradle/src/test/groovy/PackageAndDockerize15Test.groovy +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2018 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -import org.gradle.testkit.runner.GradleRunner -import org.junit.Test -import org.junit.BeforeClass -import static org.junit.Assert.assertTrue - -import com.github.dockerjava.core.DockerClientBuilder - -public class PackageAndDockerize15Test extends AbstractBoostDockerTest { - - @BeforeClass - public static void setup() { - resourceDir = new File("build/resources/test/test-spring-boot") - testProjectDir = new File(integTestDir, "PackageAndDockerize15Test") - buildFilename = "springApp-15.gradle" - libertyImage = OL_SPRING_15_IMAGE - repository = "test-spring15" - dockerPort = "9080" - - createDir(testProjectDir) - createTestProject(testProjectDir, resourceDir, buildFilename) - - dockerFile = new File(testProjectDir, "Dockerfile") - dockerClient = DockerClientBuilder.getInstance().build() - - result = GradleRunner.create() - .withProjectDir(testProjectDir) - .forwardOutput() - .withArguments("boostDockerBuild", "boostPackage", "boostStart", "boostStop", "-i", "-s") - .build() - } - - @Test - public void testBuildSuccess() throws IOException { - testDockerPackageTask() - assertTrue(new File(testProjectDir, "build/libs/${repository}.jar").exists()) - } - - @Test - public void testPackageContents() throws IOException { - testPackageContentsforSpring15() - } -} diff --git a/boost-gradle/src/test/groovy/PackageAndDockerize20Test.groovy b/boost-gradle/src/test/groovy/PackageAndDockerize20Test.groovy deleted file mode 100644 index 43bb990f..00000000 --- a/boost-gradle/src/test/groovy/PackageAndDockerize20Test.groovy +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2018 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -import org.gradle.testkit.runner.GradleRunner -import org.junit.Test -import org.junit.BeforeClass -import com.github.dockerjava.core.DockerClientBuilder - -import static org.junit.Assert.assertTrue - -public class PackageAndDockerize20Test extends AbstractBoostDockerTest { - - @BeforeClass - public static void setup() { - resourceDir = new File("build/resources/test/test-spring-boot") - testProjectDir = new File(integTestDir, "PackageAndDockerize20Test") - buildFilename = "springApp-20.gradle" - libertyImage = OL_SPRING_20_IMAGE - repository = "gs-spring-boot-0.1.0" - dockerPort = "9080" - - createDir(testProjectDir) - createTestProject(testProjectDir, resourceDir, buildFilename) - - dockerFile = new File(testProjectDir, "Dockerfile") - dockerClient = DockerClientBuilder.getInstance().build() - - result = GradleRunner.create() - .withProjectDir(testProjectDir) - .forwardOutput() - .withArguments("boostDockerBuild", "boostPackage", "boostStart", "boostStop", "-i", "-s") - .build() - } - - @Test - public void testBuildSuccess() throws IOException { - testDockerPackageTask() - assertTrue(new File(testProjectDir, "build/libs/${repository}.jar").exists()) - } - - @Test - public void testPackageContents() throws IOException { - testPackageContentsforSpring20() - } -} diff --git a/boost-gradle/src/test/groovy/PackageExtensionTest.groovy b/boost-gradle/src/test/groovy/PackageExtensionTest.groovy deleted file mode 100644 index 2520cfef..00000000 --- a/boost-gradle/src/test/groovy/PackageExtensionTest.groovy +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2018 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -import org.gradle.testkit.runner.GradleRunner -import org.gradle.testkit.runner.TaskOutcome -import org.junit.BeforeClass -import org.junit.Test - -import static org.junit.Assert.assertEquals -import static org.junit.Assert.assertTrue - - -public class PackageExtensionTest extends AbstractBoostTest { - - @BeforeClass - public static void setup() { - resourceDir = new File("build/resources/test/test-spring-boot") - testProjectDir = new File(integTestDir, "PackageExtensionTest") - buildFilename = "packageExtensionTest.gradle" - createDir(testProjectDir) - createTestProject(testProjectDir, resourceDir, buildFilename) - - result = GradleRunner.create() - .withProjectDir(testProjectDir) - .forwardOutput() - .withArguments("build", "-i", "-s") - .build() - } - - @Test - public void testPackageSuccess() throws IOException { - assertEquals(TaskOutcome.SUCCESS, result.task(":boostPackage").getOutcome()) - - assertTrue(new File(testProjectDir, "build/libs/extensionTest.jar").exists()) - } -} diff --git a/boost-gradle/src/test/groovy/PackageSpringClassifier15Test.groovy b/boost-gradle/src/test/groovy/PackageSpringClassifier15Test.groovy deleted file mode 100644 index eb55d826..00000000 --- a/boost-gradle/src/test/groovy/PackageSpringClassifier15Test.groovy +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2018 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -import org.gradle.testkit.runner.GradleRunner -import org.junit.BeforeClass -import org.junit.Test - -import static org.junit.Assert.assertTrue - -public class PackageSpringClassifier15Test extends AbstractBoostTest { - - @BeforeClass - public static void setup() { - resourceDir = new File("build/resources/test/test-spring-boot") - testProjectDir = new File(integTestDir, "PackageSpringClassifier15Test") - buildFilename = "springAppClassifier-15.gradle" - createDir(testProjectDir) - createTestProject(testProjectDir, resourceDir, buildFilename) - - result = GradleRunner.create() - .withProjectDir(testProjectDir) - .forwardOutput() - .withArguments("build", "boostStart", "boostStop", "-i", "-s") - .build() - } - - @Test - public void testPackageSuccess() throws IOException { - testPackageTask() - File output = new File(testProjectDir, "build/libs/PackageSpringClassifier15Test-test.jar") - assertTrue(output.exists()) - testSpringBootEndpoint(output) - } - - @Test - public void testPackageContents() throws IOException { - testPackageContentsforSpring15() - } -} diff --git a/boost-gradle/src/test/groovy/PackageSpringClassifier20Test.groovy b/boost-gradle/src/test/groovy/PackageSpringClassifier20Test.groovy deleted file mode 100644 index 03624c7f..00000000 --- a/boost-gradle/src/test/groovy/PackageSpringClassifier20Test.groovy +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2018 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -import org.gradle.testkit.runner.GradleRunner -import org.junit.BeforeClass -import org.junit.Test - -import static org.junit.Assert.assertTrue - -public class PackageSpringClassifier20Test extends AbstractBoostTest { - - @BeforeClass - public static void setup() { - resourceDir = new File("build/resources/test/test-spring-boot") - testProjectDir = new File(integTestDir, "PackageSpringClassifier20Test") - buildFilename = "springAppClassifier-20.gradle" - createDir(testProjectDir) - createTestProject(testProjectDir, resourceDir, buildFilename) - - result = GradleRunner.create() - .withProjectDir(testProjectDir) - .forwardOutput() - .withArguments("build", "boostStart", "boostStop", "-i", "-s") - .build() - } - - @Test - public void testPackageSuccess() throws IOException { - testPackageTask() - File output = new File(testProjectDir, "build/libs/gs-spring-boot-0.1.0-test.jar") - assertTrue(output.exists()) - testSpringBootEndpoint(output) - } - - @Test - public void testPackageContents() throws IOException { - testPackageContentsforSpring20() - } -} diff --git a/boost-gradle/src/test/groovy/PackageSpringWar20Test.groovy b/boost-gradle/src/test/groovy/PackageSpringWar20Test.groovy deleted file mode 100644 index b41e07b3..00000000 --- a/boost-gradle/src/test/groovy/PackageSpringWar20Test.groovy +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2018 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -import org.gradle.testkit.runner.GradleRunner -import org.junit.BeforeClass -import org.junit.Test - -import static org.junit.Assert.assertTrue - -public class PackageSpringWar20Test extends AbstractBoostTest { - - @BeforeClass - public static void setup() { - resourceDir = new File("build/resources/test/test-spring-boot") - testProjectDir = new File(integTestDir, "PackageSpringWar20Test") - buildFilename = "springWarApp-20.gradle" - createDir(testProjectDir) - createTestProject(testProjectDir, resourceDir, buildFilename) - - result = GradleRunner.create() - .withProjectDir(testProjectDir) - .forwardOutput() - .withArguments("build", "boostStart", "boostStop", "-i", "-s") - .build() - } - - @Test - public void testPackageSuccess() throws IOException { - testPackageTask() - assertTrue(new File(testProjectDir, "build/libs/gs-spring-boot-0.1.0.war").exists()) - } - - @Test - public void testPackageContents() throws IOException { - testPackageContentsforSpring20() - } -} diff --git a/boost-gradle/src/test/resources/test-jaxrs/settings.gradle b/boost-gradle/src/test/resources/test-jaxrs/settings.gradle new file mode 100644 index 00000000..e69de29b diff --git a/boost-gradle/src/test/resources/test-jaxrs/testJaxrs20.gradle b/boost-gradle/src/test/resources/test-jaxrs/testJaxrs20.gradle index 095ef018..1cc7bbc2 100644 --- a/boost-gradle/src/test/resources/test-jaxrs/testJaxrs20.gradle +++ b/boost-gradle/src/test/resources/test-jaxrs/testJaxrs20.gradle @@ -8,7 +8,7 @@ buildscript { maven { url 'https://repo.spring.io/plugins-snapshot' } } dependencies { - classpath("io.openliberty.boost:boost-gradle-plugin:$boostVersion") + classpath("boost:boost-gradle-plugin:$boostVersion") classpath 'io.spring.gradle:dependency-management-plugin:1.0.6.RELEASE' } } @@ -31,12 +31,12 @@ targetCompatibility = 1.8 dependencyManagement { imports { - mavenBom "io.openliberty.boosters:ee7-bom:$boosterVersion" + mavenBom "boost.boosters:ee7-bom:$boosterVersion" } } dependencies { - compile "io.openliberty.boosters:jaxrs" + compile "boost.boosters:jaxrs" - libertyRuntime "$runtimeGroup:$runtimeArtifactId:$runtimeVersion" + compile "$runtimeGroup:$runtimeArtifactId:$boosterVersion" } diff --git a/boost-gradle/src/test/resources/test-jaxrs/testJaxrs21.gradle b/boost-gradle/src/test/resources/test-jaxrs/testJaxrs21.gradle index 94b1412c..4ea1fb2a 100644 --- a/boost-gradle/src/test/resources/test-jaxrs/testJaxrs21.gradle +++ b/boost-gradle/src/test/resources/test-jaxrs/testJaxrs21.gradle @@ -8,7 +8,7 @@ buildscript { maven { url 'https://repo.spring.io/plugins-snapshot' } } dependencies { - classpath("io.openliberty.boost:boost-gradle-plugin:$boostVersion") + classpath("boost:boost-gradle-plugin:$boostVersion") classpath 'io.spring.gradle:dependency-management-plugin:1.0.6.RELEASE' } } @@ -31,12 +31,12 @@ targetCompatibility = 1.8 dependencyManagement { imports { - mavenBom "io.openliberty.boosters:ee8-bom:$boosterVersion" + mavenBom "boost.boosters:ee8-bom:$boosterVersion" } } dependencies { - compile "io.openliberty.boosters:jaxrs" + compile "boost.boosters:jaxrs" - libertyRuntime "$runtimeGroup:$runtimeArtifactId:$runtimeVersion" + compile "$runtimeGroup:$runtimeArtifactId:$boosterVersion" } diff --git a/boost-gradle/src/test/resources/test-jdbc/db2.gradle b/boost-gradle/src/test/resources/test-jdbc/db2.gradle index 6f5e8f65..71cb5b92 100644 --- a/boost-gradle/src/test/resources/test-jdbc/db2.gradle +++ b/boost-gradle/src/test/resources/test-jdbc/db2.gradle @@ -8,7 +8,7 @@ buildscript { maven { url 'https://repo.spring.io/plugins-snapshot' } } dependencies { - classpath("io.openliberty.boost:boost-gradle-plugin:$boostVersion") + classpath("boost:boost-gradle-plugin:$boostVersion") classpath 'io.spring.gradle:dependency-management-plugin:1.0.6.RELEASE' } } @@ -31,17 +31,17 @@ targetCompatibility = 1.8 dependencyManagement { imports { - mavenBom "io.openliberty.boosters:ee8-bom:$boosterVersion" + mavenBom "boost.boosters:ee8-bom:$boosterVersion" } } dependencies { - compile "io.openliberty.boosters:jaxrs" - compile "io.openliberty.boosters:jdbc" + compile "boost.boosters:jaxrs" + compile "boost.boosters:jdbc" compile "com.ibm.db2.jcc:db2jcc:db2jcc4" compile("org.apache.httpcomponents:httpclient:4.5.6") compile("org.apache.httpcomponents:httpcore:4.4.10") compile "javax.servlet:javax.servlet-api:4.0.0" - libertyRuntime "$runtimeGroup:$runtimeArtifactId:$runtimeVersion" + compile "$runtimeGroup:$runtimeArtifactId:$boosterVersion" } diff --git a/boost-gradle/src/test/resources/test-jdbc/derby-default.gradle b/boost-gradle/src/test/resources/test-jdbc/derby-default.gradle index 74d36ea1..46bc9dad 100644 --- a/boost-gradle/src/test/resources/test-jdbc/derby-default.gradle +++ b/boost-gradle/src/test/resources/test-jdbc/derby-default.gradle @@ -8,7 +8,7 @@ buildscript { maven { url 'https://repo.spring.io/plugins-snapshot' } } dependencies { - classpath("io.openliberty.boost:boost-gradle-plugin:$boostVersion") + classpath("boost:boost-gradle-plugin:$boostVersion") classpath 'io.spring.gradle:dependency-management-plugin:1.0.6.RELEASE' } } @@ -31,16 +31,16 @@ targetCompatibility = 1.8 dependencyManagement { imports { - mavenBom "io.openliberty.boosters:ee8-bom:$boosterVersion" + mavenBom "boost.boosters:ee8-bom:$boosterVersion" } } dependencies { - compile "io.openliberty.boosters:jaxrs" - compile "io.openliberty.boosters:jdbc" + compile "boost.boosters:jaxrs" + compile "boost.boosters:jdbc" compile("org.apache.httpcomponents:httpclient:4.5.6") compile("org.apache.httpcomponents:httpcore:4.4.10") compile "javax.servlet:javax.servlet-api:4.0.0" - libertyRuntime "$runtimeGroup:$runtimeArtifactId:$runtimeVersion" + compile "$runtimeGroup:$runtimeArtifactId:$boosterVersion" } diff --git a/boost-gradle/src/test/resources/test-jdbc/derby-defined.gradle b/boost-gradle/src/test/resources/test-jdbc/derby-defined.gradle index 0b880c21..29443fe0 100644 --- a/boost-gradle/src/test/resources/test-jdbc/derby-defined.gradle +++ b/boost-gradle/src/test/resources/test-jdbc/derby-defined.gradle @@ -8,7 +8,7 @@ buildscript { maven { url 'https://repo.spring.io/plugins-snapshot' } } dependencies { - classpath("io.openliberty.boost:boost-gradle-plugin:$boostVersion") + classpath("boost:boost-gradle-plugin:$boostVersion") classpath 'io.spring.gradle:dependency-management-plugin:1.0.6.RELEASE' } } @@ -31,17 +31,17 @@ targetCompatibility = 1.8 dependencyManagement { imports { - mavenBom "io.openliberty.boosters:ee8-bom:$boosterVersion" + mavenBom "boost.boosters:ee8-bom:$boosterVersion" } } dependencies { - compile "io.openliberty.boosters:jaxrs" - compile "io.openliberty.boosters:jdbc" + compile "boost.boosters:jaxrs" + compile "boost.boosters:jdbc" compile "org.apache.derby:derby:10.11.1.1" compile("org.apache.httpcomponents:httpclient:4.5.6") compile("org.apache.httpcomponents:httpcore:4.4.10") compile "javax.servlet:javax.servlet-api:4.0.0" - libertyRuntime "$runtimeGroup:$runtimeArtifactId:$runtimeVersion" + compile "$runtimeGroup:$runtimeArtifactId:$boosterVersion" } diff --git a/boost-gradle/src/test/resources/test-jdbc/mysql.gradle b/boost-gradle/src/test/resources/test-jdbc/mysql.gradle index 02b8904c..6c2afeff 100644 --- a/boost-gradle/src/test/resources/test-jdbc/mysql.gradle +++ b/boost-gradle/src/test/resources/test-jdbc/mysql.gradle @@ -8,7 +8,7 @@ buildscript { maven { url 'https://repo.spring.io/plugins-snapshot' } } dependencies { - classpath("io.openliberty.boost:boost-gradle-plugin:$boostVersion") + classpath("boost:boost-gradle-plugin:$boostVersion") classpath 'io.spring.gradle:dependency-management-plugin:1.0.6.RELEASE' } } @@ -31,17 +31,17 @@ targetCompatibility = 1.8 dependencyManagement { imports { - mavenBom "io.openliberty.boosters:ee8-bom:$boosterVersion" + mavenBom "boost.boosters:ee8-bom:$boosterVersion" } } dependencies { - compile "io.openliberty.boosters:jaxrs" - compile "io.openliberty.boosters:jdbc" + compile "boost.boosters:jaxrs" + compile "boost.boosters:jdbc" compile "mysql:mysql-connector-java:8.0.15" compile("org.apache.httpcomponents:httpclient:4.5.6") compile("org.apache.httpcomponents:httpcore:4.4.10") compile "javax.servlet:javax.servlet-api:4.0.0" - libertyRuntime "$runtimeGroup:$runtimeArtifactId:$runtimeVersion" + compile "$runtimeGroup:$runtimeArtifactId:$boosterVersion" } diff --git a/boost-gradle/src/test/resources/test-jdbc/settings.gradle b/boost-gradle/src/test/resources/test-jdbc/settings.gradle new file mode 100644 index 00000000..e69de29b diff --git a/boost-gradle/src/test/resources/test-jpa/settings.gradle b/boost-gradle/src/test/resources/test-jpa/settings.gradle new file mode 100644 index 00000000..e69de29b diff --git a/boost-gradle/src/test/resources/test-jpa/testJPA21.gradle b/boost-gradle/src/test/resources/test-jpa/testJPA21.gradle index 4b71d9f4..b0d171f0 100644 --- a/boost-gradle/src/test/resources/test-jpa/testJPA21.gradle +++ b/boost-gradle/src/test/resources/test-jpa/testJPA21.gradle @@ -8,7 +8,7 @@ buildscript { maven { url 'https://repo.spring.io/plugins-snapshot' } } dependencies { - classpath("io.openliberty.boost:boost-gradle-plugin:$boostVersion") + classpath("boost:boost-gradle-plugin:$boostVersion") classpath 'io.spring.gradle:dependency-management-plugin:1.0.6.RELEASE' } } @@ -31,15 +31,15 @@ targetCompatibility = 1.8 dependencyManagement { imports { - mavenBom "io.openliberty.boosters:ee7-bom:$boosterVersion" + mavenBom "boost.boosters:ee7-bom:$boosterVersion" } } dependencies { - compile "io.openliberty.boosters:jpa" - compile "io.openliberty.boosters:jaxrs" + compile "boost.boosters:jpa" + compile "boost.boosters:jaxrs" compile "javax.activation:javax.activation-api:1.2.0" compile "javax.xml.bind:jaxb-api:2.3.0" - libertyRuntime "$runtimeGroup:$runtimeArtifactId:$runtimeVersion" + compile "$runtimeGroup:$runtimeArtifactId:$boosterVersion" } diff --git a/boost-gradle/src/test/resources/test-jpa/testJPA22.gradle b/boost-gradle/src/test/resources/test-jpa/testJPA22.gradle index a7ae12c6..98b9c56f 100644 --- a/boost-gradle/src/test/resources/test-jpa/testJPA22.gradle +++ b/boost-gradle/src/test/resources/test-jpa/testJPA22.gradle @@ -8,7 +8,7 @@ buildscript { maven { url 'https://repo.spring.io/plugins-snapshot' } } dependencies { - classpath("io.openliberty.boost:boost-gradle-plugin:$boostVersion") + classpath("boost:boost-gradle-plugin:$boostVersion") classpath 'io.spring.gradle:dependency-management-plugin:1.0.6.RELEASE' } } @@ -31,15 +31,15 @@ targetCompatibility = 1.8 dependencyManagement { imports { - mavenBom "io.openliberty.boosters:ee8-bom:$boosterVersion" + mavenBom "boost.boosters:ee8-bom:$boosterVersion" } } dependencies { - compile "io.openliberty.boosters:jpa" - compile "io.openliberty.boosters:jaxrs" + compile "boost.boosters:jpa" + compile "boost.boosters:jaxrs" compile "javax.activation:javax.activation-api:1.2.0" compile "javax.xml.bind:jaxb-api:2.3.0" - libertyRuntime "$runtimeGroup:$runtimeArtifactId:$runtimeVersion" + compile "$runtimeGroup:$runtimeArtifactId:$boosterVersion" } diff --git a/boost-gradle/src/test/resources/test-spring-boot-ssl/build.gradle b/boost-gradle/src/test/resources/test-spring-boot-ssl/build.gradle deleted file mode 100644 index 127450bb..00000000 --- a/boost-gradle/src/test/resources/test-spring-boot-ssl/build.gradle +++ /dev/null @@ -1,39 +0,0 @@ -buildscript { - repositories { - mavenCentral() - mavenLocal() - maven { - url 'https://oss.sonatype.org/content/repositories/snapshots/' - } - } - dependencies { - classpath("org.springframework.boot:spring-boot-gradle-plugin:2.0.4.RELEASE") - classpath("io.openliberty.boost:boost-gradle-plugin:$boostVersion") - classpath("org.apache.httpcomponents:httpclient:4.5.6") - classpath("org.apache.httpcomponents:httpcore:4.4.10") - } -} - -apply plugin: 'java' -apply plugin: 'boost' -apply plugin: 'org.springframework.boot' -apply plugin: 'io.spring.dependency-management' - -bootJar { - baseName = 'test-spring-boot-ssl' - mainClassName = 'hello.Application' -} - -repositories { - mavenCentral() - mavenLocal() -} - -sourceCompatibility = 1.8 -targetCompatibility = 1.8 - -dependencies { - compile("org.springframework.boot:spring-boot-starter-web") - compile("org.apache.httpcomponents:httpclient:4.5.6") - compile("org.apache.httpcomponents:httpcore:4.4.10") -} diff --git a/boost-gradle/src/test/resources/test-spring-boot-ssl/src/main/java/hello/Application.java b/boost-gradle/src/test/resources/test-spring-boot-ssl/src/main/java/hello/Application.java deleted file mode 100644 index 5a129e46..00000000 --- a/boost-gradle/src/test/resources/test-spring-boot-ssl/src/main/java/hello/Application.java +++ /dev/null @@ -1,33 +0,0 @@ -package hello; - -import java.util.Arrays; - -import org.springframework.boot.CommandLineRunner; -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.context.ApplicationContext; -import org.springframework.context.annotation.Bean; - -@SpringBootApplication -public class Application { - - public static void main(String[] args) { - SpringApplication.run(Application.class, args); - } - - @Bean - public CommandLineRunner commandLineRunner(ApplicationContext ctx) { - return args -> { - - System.out.println("Let's inspect the beans provided by Spring Boot:"); - - String[] beanNames = ctx.getBeanDefinitionNames(); - Arrays.sort(beanNames); - for (String beanName : beanNames) { - System.out.println(beanName); - } - - }; - } - -} diff --git a/boost-gradle/src/test/resources/test-spring-boot-ssl/src/main/java/hello/HelloController.java b/boost-gradle/src/test/resources/test-spring-boot-ssl/src/main/java/hello/HelloController.java deleted file mode 100644 index 8a85245c..00000000 --- a/boost-gradle/src/test/resources/test-spring-boot-ssl/src/main/java/hello/HelloController.java +++ /dev/null @@ -1,14 +0,0 @@ -package hello; - -import org.springframework.web.bind.annotation.RestController; -import org.springframework.web.bind.annotation.RequestMapping; - -@RestController -public class HelloController { - - @RequestMapping("/") - public String index() { - return "Greetings from Spring Boot!"; - } - -} diff --git a/boost-gradle/src/test/resources/test-spring-boot-ssl/src/main/resources/application.properties b/boost-gradle/src/test/resources/test-spring-boot-ssl/src/main/resources/application.properties deleted file mode 100644 index 37199bfd..00000000 --- a/boost-gradle/src/test/resources/test-spring-boot-ssl/src/main/resources/application.properties +++ /dev/null @@ -1,4 +0,0 @@ -server.port = 8443 -server.ssl.key-store = classpath:sample.jks -server.ssl.key-store-password = secret -server.ssl.key-password = password diff --git a/boost-gradle/src/test/resources/test-spring-boot-ssl/src/main/resources/sample.jks b/boost-gradle/src/test/resources/test-spring-boot-ssl/src/main/resources/sample.jks deleted file mode 100755 index 6aa9a280..00000000 Binary files a/boost-gradle/src/test/resources/test-spring-boot-ssl/src/main/resources/sample.jks and /dev/null differ diff --git a/boost-gradle/src/test/resources/test-spring-boot/docker15Test.gradle b/boost-gradle/src/test/resources/test-spring-boot/docker15Test.gradle deleted file mode 100644 index 41300aa3..00000000 --- a/boost-gradle/src/test/resources/test-spring-boot/docker15Test.gradle +++ /dev/null @@ -1,46 +0,0 @@ -buildscript { - repositories { - mavenCentral() - mavenLocal() - maven { - url 'https://oss.sonatype.org/content/repositories/snapshots/' - } - } - dependencies { - classpath("org.springframework.boot:spring-boot-gradle-plugin:1.5.19.RELEASE") - classpath("io.openliberty.boost:boost-gradle-plugin:$boostVersion") - } -} - -apply plugin: 'java' -apply plugin: 'boost' -apply plugin: 'eclipse' -apply plugin: 'idea' -apply plugin: 'org.springframework.boot' -apply plugin: 'io.spring.dependency-management' - -jar { - baseName = 'test-docker15' -} - -bootRepackage { - mainClass = 'hello.Application' -} - -boost { - docker { - repository = 'localhost:5000/test-image15' - } -} - -repositories { - mavenCentral() - mavenLocal() -} - -sourceCompatibility = 1.8 -targetCompatibility = 1.8 - -dependencies { - compile("org.springframework.boot:spring-boot-starter-web") -} diff --git a/boost-gradle/src/test/resources/test-spring-boot/docker20Test.gradle b/boost-gradle/src/test/resources/test-spring-boot/docker20Test.gradle deleted file mode 100644 index 33f09157..00000000 --- a/boost-gradle/src/test/resources/test-spring-boot/docker20Test.gradle +++ /dev/null @@ -1,43 +0,0 @@ -buildscript { - repositories { - mavenCentral() - mavenLocal() - maven { - url 'https://oss.sonatype.org/content/repositories/snapshots/' - } - } - dependencies { - classpath("org.springframework.boot:spring-boot-gradle-plugin:2.0.4.RELEASE") - classpath("io.openliberty.boost:boost-gradle-plugin:$boostVersion") - } -} - -apply plugin: 'java' -apply plugin: 'boost' -apply plugin: 'eclipse' -apply plugin: 'idea' -apply plugin: 'org.springframework.boot' -apply plugin: 'io.spring.dependency-management' - -bootJar { - baseName = 'test-docker20' - mainClassName = 'hello.Application' -} - -boost { - docker { - repository = 'localhost:5000/test-image20' - } -} - -repositories { - mavenCentral() - mavenLocal() -} - -sourceCompatibility = 1.8 -targetCompatibility = 1.8 - -dependencies { - compile("org.springframework.boot:spring-boot-starter-web") -} diff --git a/boost-gradle/src/test/resources/test-spring-boot/dockerClassifier15Test.gradle b/boost-gradle/src/test/resources/test-spring-boot/dockerClassifier15Test.gradle deleted file mode 100644 index 25a790e3..00000000 --- a/boost-gradle/src/test/resources/test-spring-boot/dockerClassifier15Test.gradle +++ /dev/null @@ -1,45 +0,0 @@ -buildscript { - repositories { - mavenCentral() - mavenLocal() - maven { - url 'https://oss.sonatype.org/content/repositories/snapshots/' - } - } - dependencies { - classpath("org.springframework.boot:spring-boot-gradle-plugin:1.5.19.RELEASE") - classpath("io.openliberty.boost:boost-gradle-plugin:$boostVersion") - } -} - -apply plugin: 'java' -apply plugin: 'boost' -apply plugin: 'eclipse' -apply plugin: 'idea' -apply plugin: 'org.springframework.boot' -apply plugin: 'io.spring.dependency-management' - -jar { - baseName = 'test-docker15' -} - -bootRepackage { - mainClass = 'hello.Application' - classifier = 'test' -} - -boost { - docker {} -} - -repositories { - mavenCentral() - mavenLocal() -} - -sourceCompatibility = 1.8 -targetCompatibility = 1.8 - -dependencies { - compile("org.springframework.boot:spring-boot-starter-web") -} diff --git a/boost-gradle/src/test/resources/test-spring-boot/dockerClassifier20Test.gradle b/boost-gradle/src/test/resources/test-spring-boot/dockerClassifier20Test.gradle deleted file mode 100644 index 286c8121..00000000 --- a/boost-gradle/src/test/resources/test-spring-boot/dockerClassifier20Test.gradle +++ /dev/null @@ -1,42 +0,0 @@ -buildscript { - repositories { - mavenCentral() - mavenLocal() - maven { - url 'https://oss.sonatype.org/content/repositories/snapshots/' - } - } - dependencies { - classpath("org.springframework.boot:spring-boot-gradle-plugin:2.0.4.RELEASE") - classpath("io.openliberty.boost:boost-gradle-plugin:$boostVersion") - } -} - -apply plugin: 'java' -apply plugin: 'boost' -apply plugin: 'eclipse' -apply plugin: 'idea' -apply plugin: 'org.springframework.boot' -apply plugin: 'io.spring.dependency-management' - -bootJar { - baseName = 'test-docker20' - classifier = 'test' - mainClassName = 'hello.Application' -} - -boost { - docker {} -} - -repositories { - mavenCentral() - mavenLocal() -} - -sourceCompatibility = 1.8 -targetCompatibility = 1.8 - -dependencies { - compile("org.springframework.boot:spring-boot-starter-web") -} diff --git a/boost-gradle/src/test/resources/test-spring-boot/dockerDockerizerClasspath15Test.gradle b/boost-gradle/src/test/resources/test-spring-boot/dockerDockerizerClasspath15Test.gradle deleted file mode 100644 index 61d1eb43..00000000 --- a/boost-gradle/src/test/resources/test-spring-boot/dockerDockerizerClasspath15Test.gradle +++ /dev/null @@ -1,47 +0,0 @@ -buildscript { - repositories { - mavenCentral() - mavenLocal() - maven { - url 'https://oss.sonatype.org/content/repositories/snapshots/' - } - } - dependencies { - classpath("org.springframework.boot:spring-boot-gradle-plugin:1.5.19.RELEASE") - classpath("io.openliberty.boost:boost-gradle-plugin:$boostVersion") - } -} - -apply plugin: 'java' -apply plugin: 'boost' -apply plugin: 'eclipse' -apply plugin: 'idea' -apply plugin: 'org.springframework.boot' -apply plugin: 'io.spring.dependency-management' - -jar { - baseName = 'test-docker15' -} - -bootRepackage { - mainClass = 'hello.Application' -} - -boost { - docker { - repository = 'localhost:5000/test-classpath15' - dockerizer = 'classpath' - } -} - -repositories { - mavenCentral() - mavenLocal() -} - -sourceCompatibility = 1.8 -targetCompatibility = 1.8 - -dependencies { - compile("org.springframework.boot:spring-boot-starter-web") -} diff --git a/boost-gradle/src/test/resources/test-spring-boot/dockerDockerizerClasspath20Test.gradle b/boost-gradle/src/test/resources/test-spring-boot/dockerDockerizerClasspath20Test.gradle deleted file mode 100644 index 4808066f..00000000 --- a/boost-gradle/src/test/resources/test-spring-boot/dockerDockerizerClasspath20Test.gradle +++ /dev/null @@ -1,44 +0,0 @@ -buildscript { - repositories { - mavenCentral() - mavenLocal() - maven { - url 'https://oss.sonatype.org/content/repositories/snapshots/' - } - } - dependencies { - classpath("org.springframework.boot:spring-boot-gradle-plugin:2.0.4.RELEASE") - classpath("io.openliberty.boost:boost-gradle-plugin:$boostVersion") - } -} - -apply plugin: 'java' -apply plugin: 'boost' -apply plugin: 'eclipse' -apply plugin: 'idea' -apply plugin: 'org.springframework.boot' -apply plugin: 'io.spring.dependency-management' - -bootJar { - baseName = 'test-docker20' - mainClassName = 'hello.Application' -} - -boost { - docker { - repository = 'localhost:5000/test-classpath20' - dockerizer = 'classpath' - } -} - -repositories { - mavenCentral() - mavenLocal() -} - -sourceCompatibility = 1.8 -targetCompatibility = 1.8 - -dependencies { - compile("org.springframework.boot:spring-boot-starter-web") -} diff --git a/boost-gradle/src/test/resources/test-spring-boot/dockerDockerizerJar15Test.gradle b/boost-gradle/src/test/resources/test-spring-boot/dockerDockerizerJar15Test.gradle deleted file mode 100644 index bfff0cab..00000000 --- a/boost-gradle/src/test/resources/test-spring-boot/dockerDockerizerJar15Test.gradle +++ /dev/null @@ -1,47 +0,0 @@ -buildscript { - repositories { - mavenCentral() - mavenLocal() - maven { - url 'https://oss.sonatype.org/content/repositories/snapshots/' - } - } - dependencies { - classpath("org.springframework.boot:spring-boot-gradle-plugin:1.5.19.RELEASE") - classpath("io.openliberty.boost:boost-gradle-plugin:$boostVersion") - } -} - -apply plugin: 'java' -apply plugin: 'boost' -apply plugin: 'eclipse' -apply plugin: 'idea' -apply plugin: 'org.springframework.boot' -apply plugin: 'io.spring.dependency-management' - -jar { - baseName = 'test-docker15' -} - -bootRepackage { - mainClass = 'hello.Application' -} - -boost { - docker { - repository = 'localhost:5000/test-jar15' - dockerizer = 'jar' - } -} - -repositories { - mavenCentral() - mavenLocal() -} - -sourceCompatibility = 1.8 -targetCompatibility = 1.8 - -dependencies { - compile("org.springframework.boot:spring-boot-starter-web") -} diff --git a/boost-gradle/src/test/resources/test-spring-boot/dockerDockerizerJar20Test.gradle b/boost-gradle/src/test/resources/test-spring-boot/dockerDockerizerJar20Test.gradle deleted file mode 100644 index e3329236..00000000 --- a/boost-gradle/src/test/resources/test-spring-boot/dockerDockerizerJar20Test.gradle +++ /dev/null @@ -1,44 +0,0 @@ -buildscript { - repositories { - mavenCentral() - mavenLocal() - maven { - url 'https://oss.sonatype.org/content/repositories/snapshots/' - } - } - dependencies { - classpath("org.springframework.boot:spring-boot-gradle-plugin:2.0.4.RELEASE") - classpath("io.openliberty.boost:boost-gradle-plugin:$boostVersion") - } -} - -apply plugin: 'java' -apply plugin: 'boost' -apply plugin: 'eclipse' -apply plugin: 'idea' -apply plugin: 'org.springframework.boot' -apply plugin: 'io.spring.dependency-management' - -bootJar { - baseName = 'test-docker20' - mainClassName = 'hello.Application' -} - -boost { - docker { - repository = 'localhost:5000/test-jar20' - dockerizer = 'jar' - } -} - -repositories { - mavenCentral() - mavenLocal() -} - -sourceCompatibility = 1.8 -targetCompatibility = 1.8 - -dependencies { - compile("org.springframework.boot:spring-boot-starter-web") -} diff --git a/boost-gradle/src/test/resources/test-spring-boot/dockerEmpty15Test.gradle b/boost-gradle/src/test/resources/test-spring-boot/dockerEmpty15Test.gradle deleted file mode 100644 index 4bda518c..00000000 --- a/boost-gradle/src/test/resources/test-spring-boot/dockerEmpty15Test.gradle +++ /dev/null @@ -1,44 +0,0 @@ -buildscript { - repositories { - mavenCentral() - mavenLocal() - maven { - url 'https://oss.sonatype.org/content/repositories/snapshots/' - } - } - dependencies { - classpath("org.springframework.boot:spring-boot-gradle-plugin:1.5.19.RELEASE") - classpath("io.openliberty.boost:boost-gradle-plugin:$boostVersion") - } -} - -apply plugin: 'java' -apply plugin: 'boost' -apply plugin: 'eclipse' -apply plugin: 'idea' -apply plugin: 'org.springframework.boot' -apply plugin: 'io.spring.dependency-management' - -jar { - baseName = 'test-docker15' -} - -bootRepackage { - mainClass = 'hello.Application' -} - -boost { - docker {} -} - -repositories { - mavenCentral() - mavenLocal() -} - -sourceCompatibility = 1.8 -targetCompatibility = 1.8 - -dependencies { - compile("org.springframework.boot:spring-boot-starter-web") -} \ No newline at end of file diff --git a/boost-gradle/src/test/resources/test-spring-boot/dockerEmpty20Test.gradle b/boost-gradle/src/test/resources/test-spring-boot/dockerEmpty20Test.gradle deleted file mode 100644 index cd9a82f9..00000000 --- a/boost-gradle/src/test/resources/test-spring-boot/dockerEmpty20Test.gradle +++ /dev/null @@ -1,41 +0,0 @@ -buildscript { - repositories { - mavenCentral() - mavenLocal() - maven { - url 'https://oss.sonatype.org/content/repositories/snapshots/' - } - } - dependencies { - classpath("org.springframework.boot:spring-boot-gradle-plugin:2.0.4.RELEASE") - classpath("io.openliberty.boost:boost-gradle-plugin:$boostVersion") - } -} - -apply plugin: 'java' -apply plugin: 'boost' -apply plugin: 'eclipse' -apply plugin: 'idea' -apply plugin: 'org.springframework.boot' -apply plugin: 'io.spring.dependency-management' - -bootJar { - baseName = 'test-docker20' - mainClassName = 'hello.Application' -} - -boost { - docker {} -} - -repositories { - mavenCentral() - mavenLocal() -} - -sourceCompatibility = 1.8 -targetCompatibility = 1.8 - -dependencies { - compile("org.springframework.boot:spring-boot-starter-web") -} diff --git a/boost-gradle/src/test/resources/test-spring-boot/packageExtensionTest.gradle b/boost-gradle/src/test/resources/test-spring-boot/packageExtensionTest.gradle deleted file mode 100644 index df743154..00000000 --- a/boost-gradle/src/test/resources/test-spring-boot/packageExtensionTest.gradle +++ /dev/null @@ -1,46 +0,0 @@ -buildscript { - repositories { - mavenCentral() - mavenLocal() - maven { - url 'https://oss.sonatype.org/content/repositories/snapshots/' - } - } - dependencies { - classpath("org.springframework.boot:spring-boot-gradle-plugin:2.0.4.RELEASE") - classpath("io.openliberty.boost:boost-gradle-plugin:$boostVersion") - } -} - -apply plugin: 'java' -apply plugin: 'boost' -apply plugin: 'eclipse' -apply plugin: 'idea' -apply plugin: 'org.springframework.boot' -apply plugin: 'io.spring.dependency-management' - -bootJar { - baseName = 'gs-spring-boot' - version = '0.1.0' - mainClassName = 'hello.Application' -} - -boost { - packaging { - packageName = 'extensionTest' - } -} - -repositories { - mavenCentral() - mavenLocal() -} - -sourceCompatibility = 1.8 -targetCompatibility = 1.8 - -dependencies { - compile("org.springframework.boot:spring-boot-starter-web") - - libertyRuntime "$runtimeGroup:$runtimeArtifactId:$runtimeVersion" -} diff --git a/boost-gradle/src/test/resources/test-spring-boot/springApp-15.gradle b/boost-gradle/src/test/resources/test-spring-boot/springApp-15.gradle deleted file mode 100644 index e58ee879..00000000 --- a/boost-gradle/src/test/resources/test-spring-boot/springApp-15.gradle +++ /dev/null @@ -1,42 +0,0 @@ -buildscript { - repositories { - mavenCentral() - mavenLocal() - maven { - url 'https://oss.sonatype.org/content/repositories/snapshots/' - } - } - dependencies { - classpath("org.springframework.boot:spring-boot-gradle-plugin:1.5.19.RELEASE") - classpath("io.openliberty.boost:boost-gradle-plugin:$boostVersion") - } -} - -apply plugin: 'java' -apply plugin: 'boost' -apply plugin: 'eclipse' -apply plugin: 'idea' -apply plugin: 'org.springframework.boot' -apply plugin: 'io.spring.dependency-management' - -jar { - baseName = 'test-spring15' -} - -bootRepackage { - mainClass = 'hello.Application' -} - -repositories { - mavenCentral() - mavenLocal() -} - -sourceCompatibility = 1.8 -targetCompatibility = 1.8 - -dependencies { - compile("org.springframework.boot:spring-boot-starter-web") - - libertyRuntime "$runtimeGroup:$runtimeArtifactId:$runtimeVersion" -} diff --git a/boost-gradle/src/test/resources/test-spring-boot/springApp-20.gradle b/boost-gradle/src/test/resources/test-spring-boot/springApp-20.gradle deleted file mode 100644 index c5db9cb9..00000000 --- a/boost-gradle/src/test/resources/test-spring-boot/springApp-20.gradle +++ /dev/null @@ -1,40 +0,0 @@ -buildscript { - repositories { - mavenCentral() - mavenLocal() - maven { - url 'https://oss.sonatype.org/content/repositories/snapshots/' - } - } - dependencies { - classpath("org.springframework.boot:spring-boot-gradle-plugin:2.0.4.RELEASE") - classpath("io.openliberty.boost:boost-gradle-plugin:$boostVersion") - } -} - -apply plugin: 'java' -apply plugin: 'boost' -apply plugin: 'eclipse' -apply plugin: 'idea' -apply plugin: 'org.springframework.boot' -apply plugin: 'io.spring.dependency-management' - -bootJar { - baseName = 'gs-spring-boot' - version = '0.1.0' - mainClassName = 'hello.Application' -} - -repositories { - mavenCentral() - mavenLocal() -} - -sourceCompatibility = 1.8 -targetCompatibility = 1.8 - -dependencies { - compile("org.springframework.boot:spring-boot-starter-web") - - libertyRuntime "$runtimeGroup:$runtimeArtifactId:$runtimeVersion" -} diff --git a/boost-gradle/src/test/resources/test-spring-boot/springAppClassifier-15.gradle b/boost-gradle/src/test/resources/test-spring-boot/springAppClassifier-15.gradle deleted file mode 100644 index 8130b55c..00000000 --- a/boost-gradle/src/test/resources/test-spring-boot/springAppClassifier-15.gradle +++ /dev/null @@ -1,39 +0,0 @@ -buildscript { - repositories { - mavenCentral() - mavenLocal() - maven { - url 'https://oss.sonatype.org/content/repositories/snapshots/' - } - } - dependencies { - classpath("org.springframework.boot:spring-boot-gradle-plugin:1.5.19.RELEASE") - classpath("io.openliberty.boost:boost-gradle-plugin:$boostVersion") - } -} - -apply plugin: 'java' -apply plugin: 'boost' -apply plugin: 'eclipse' -apply plugin: 'idea' -apply plugin: 'org.springframework.boot' -apply plugin: 'io.spring.dependency-management' - -bootRepackage { - mainClass = 'hello.Application' - classifier = 'test' -} - -repositories { - mavenCentral() - mavenLocal() -} - -sourceCompatibility = 1.8 -targetCompatibility = 1.8 - -dependencies { - compile("org.springframework.boot:spring-boot-starter-web") - - libertyRuntime "$runtimeGroup:$runtimeArtifactId:$runtimeVersion" -} diff --git a/boost-gradle/src/test/resources/test-spring-boot/springAppClassifier-20.gradle b/boost-gradle/src/test/resources/test-spring-boot/springAppClassifier-20.gradle deleted file mode 100644 index 1854fba2..00000000 --- a/boost-gradle/src/test/resources/test-spring-boot/springAppClassifier-20.gradle +++ /dev/null @@ -1,41 +0,0 @@ -buildscript { - repositories { - mavenCentral() - mavenLocal() - maven { - url 'https://oss.sonatype.org/content/repositories/snapshots/' - } - } - dependencies { - classpath("org.springframework.boot:spring-boot-gradle-plugin:2.0.4.RELEASE") - classpath("io.openliberty.boost:boost-gradle-plugin:$boostVersion") - } -} - -apply plugin: 'java' -apply plugin: 'boost' -apply plugin: 'eclipse' -apply plugin: 'idea' -apply plugin: 'org.springframework.boot' -apply plugin: 'io.spring.dependency-management' - -bootJar { - baseName = 'gs-spring-boot' - version = '0.1.0' - mainClassName = 'hello.Application' - classifier = 'test' -} - -repositories { - mavenCentral() - mavenLocal() -} - -sourceCompatibility = 1.8 -targetCompatibility = 1.8 - -dependencies { - compile("org.springframework.boot:spring-boot-starter-web") - - libertyRuntime "$runtimeGroup:$runtimeArtifactId:$runtimeVersion" -} diff --git a/boost-gradle/src/test/resources/test-spring-boot/springWarApp-20.gradle b/boost-gradle/src/test/resources/test-spring-boot/springWarApp-20.gradle deleted file mode 100644 index c14fe02f..00000000 --- a/boost-gradle/src/test/resources/test-spring-boot/springWarApp-20.gradle +++ /dev/null @@ -1,40 +0,0 @@ -buildscript { - repositories { - mavenCentral() - mavenLocal() - maven { - url 'https://oss.sonatype.org/content/repositories/snapshots/' - } - } - dependencies { - classpath("org.springframework.boot:spring-boot-gradle-plugin:2.0.4.RELEASE") - classpath("io.openliberty.boost:boost-gradle-plugin:$boostVersion") - } -} - -apply plugin: 'war' -apply plugin: 'boost' -apply plugin: 'eclipse' -apply plugin: 'idea' -apply plugin: 'org.springframework.boot' -apply plugin: 'io.spring.dependency-management' - -bootWar { - baseName = 'gs-spring-boot' - version = '0.1.0' - mainClassName = 'hello.Application' -} - -repositories { - mavenCentral() - mavenLocal() -} - -sourceCompatibility = 1.8 -targetCompatibility = 1.8 - -dependencies { - compile("org.springframework.boot:spring-boot-starter-web") - - libertyRuntime "$runtimeGroup:$runtimeArtifactId:$runtimeVersion" -} diff --git a/boost-gradle/src/test/resources/test-spring-boot/src/main/java/hello/Application.java b/boost-gradle/src/test/resources/test-spring-boot/src/main/java/hello/Application.java deleted file mode 100644 index 5a129e46..00000000 --- a/boost-gradle/src/test/resources/test-spring-boot/src/main/java/hello/Application.java +++ /dev/null @@ -1,33 +0,0 @@ -package hello; - -import java.util.Arrays; - -import org.springframework.boot.CommandLineRunner; -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.context.ApplicationContext; -import org.springframework.context.annotation.Bean; - -@SpringBootApplication -public class Application { - - public static void main(String[] args) { - SpringApplication.run(Application.class, args); - } - - @Bean - public CommandLineRunner commandLineRunner(ApplicationContext ctx) { - return args -> { - - System.out.println("Let's inspect the beans provided by Spring Boot:"); - - String[] beanNames = ctx.getBeanDefinitionNames(); - Arrays.sort(beanNames); - for (String beanName : beanNames) { - System.out.println(beanName); - } - - }; - } - -} diff --git a/boost-gradle/src/test/resources/test-spring-boot/src/main/java/hello/HelloController.java b/boost-gradle/src/test/resources/test-spring-boot/src/main/java/hello/HelloController.java deleted file mode 100644 index 8a85245c..00000000 --- a/boost-gradle/src/test/resources/test-spring-boot/src/main/java/hello/HelloController.java +++ /dev/null @@ -1,14 +0,0 @@ -package hello; - -import org.springframework.web.bind.annotation.RestController; -import org.springframework.web.bind.annotation.RequestMapping; - -@RestController -public class HelloController { - - @RequestMapping("/") - public String index() { - return "Greetings from Spring Boot!"; - } - -} diff --git a/boost-maven/boost-boms/booster-runtimes-bom/pom.xml b/boost-maven/boost-boms/booster-runtimes-bom/pom.xml index d8f86067..5734e859 100644 --- a/boost-maven/boost-boms/booster-runtimes-bom/pom.xml +++ b/boost-maven/boost-boms/booster-runtimes-bom/pom.xml @@ -28,8 +28,12 @@ openliberty 1.0-M1-SNAPSHOT - + + boost.runtimes + wlp + 0.1-SNAPSHOT + provided + boost.runtimes tomee diff --git a/boost-maven/boost-maven-plugin/src/main/java/boost/maven/plugin/AbstractMojo.java b/boost-maven/boost-maven-plugin/src/main/java/boost/maven/plugin/AbstractMojo.java index aa6dc2f4..9a7aa4a8 100644 --- a/boost-maven/boost-maven-plugin/src/main/java/boost/maven/plugin/AbstractMojo.java +++ b/boost-maven/boost-maven-plugin/src/main/java/boost/maven/plugin/AbstractMojo.java @@ -41,7 +41,6 @@ import boost.common.boosters.AbstractBoosterConfig; import boost.common.config.BoosterConfigurator; import boost.common.runtimes.RuntimeI; -import boost.maven.runtimes.RuntimeParams; import boost.maven.utils.BoostLogger; import boost.maven.utils.MavenProjectUtil; @@ -81,10 +80,14 @@ protected Plugin getMavenDependencyPlugin() throws MojoExecutionException { return plugin(groupId(mavenDependencyPluginGroupId), artifactId(mavenDependencyPluginArtifactId)); } - protected ExecutionEnvironment getExecutionEnvironment() { + public ExecutionEnvironment getExecutionEnvironment() { return executionEnvironment(project, session, pluginManager); } + public List getBoosterConfigs() { + return boosterConfigs; + } + @Override public void execute() throws MojoExecutionException { try { @@ -114,8 +117,6 @@ public void execute() throws MojoExecutionException { protected RuntimeI getRuntimeInstance() throws MojoExecutionException { if (runtime == null) { - RuntimeParams params = new RuntimeParams(boosterConfigs, getExecutionEnvironment(), project, getLog(), - repoSystem, repoSession, remoteRepos, getMavenDependencyPlugin()); try { ServiceLoader runtimes = ServiceLoader.load(RuntimeI.class, projectClassLoader); if (!runtimes.iterator().hasNext()) { @@ -127,7 +128,7 @@ protected RuntimeI getRuntimeInstance() throws MojoExecutionException { throw new MojoExecutionException( "There are multiple Boost runtimes on the classpath. Configure the project to use one runtime and restart the build."); } - runtime = runtimeI.getClass().getConstructor(params.getClass()).newInstance(params); + runtime = runtimeI.getClass().getDeclaredConstructor().newInstance(); } } catch (IllegalAccessException | InstantiationException | InvocationTargetException | NoSuchMethodException e) { diff --git a/boost-maven/boost-maven-plugin/src/main/java/boost/maven/plugin/DebugMojo.java b/boost-maven/boost-maven-plugin/src/main/java/boost/maven/plugin/DebugMojo.java index 18c1d4fc..8564ada8 100644 --- a/boost-maven/boost-maven-plugin/src/main/java/boost/maven/plugin/DebugMojo.java +++ b/boost-maven/boost-maven-plugin/src/main/java/boost/maven/plugin/DebugMojo.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2018 IBM Corporation and others. + * Copyright (c) 2018, 2019 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -11,6 +11,7 @@ package boost.maven.plugin; import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugins.annotations.*; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; @@ -21,7 +22,7 @@ * debugger connects to debug port 7777. * */ -@Mojo(name = "debug") +@Mojo(name = "debug", requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME, requiresDependencyCollection = ResolutionScope.COMPILE_PLUS_RUNTIME) public class DebugMojo extends AbstractMojo { /** @@ -34,7 +35,7 @@ public class DebugMojo extends AbstractMojo { public void execute() throws MojoExecutionException { super.execute(); try { - this.getRuntimeInstance().doDebug(clean); + this.getRuntimeInstance().doDebug(project, this); } catch (BoostException e) { throw new MojoExecutionException("Error debugging server", e); } diff --git a/boost-maven/boost-maven-plugin/src/main/java/boost/maven/plugin/PackageMojo.java b/boost-maven/boost-maven-plugin/src/main/java/boost/maven/plugin/PackageMojo.java index db7ab02d..c810c129 100644 --- a/boost-maven/boost-maven-plugin/src/main/java/boost/maven/plugin/PackageMojo.java +++ b/boost-maven/boost-maven-plugin/src/main/java/boost/maven/plugin/PackageMojo.java @@ -30,7 +30,7 @@ public class PackageMojo extends AbstractMojo { public void execute() throws MojoExecutionException { super.execute(); try { - this.getRuntimeInstance().doPackage(); + this.getRuntimeInstance().doPackage(getBoosterConfigs(), project, this); } catch (BoostException e) { throw new MojoExecutionException("Error performing server package", e); } diff --git a/boost-maven/boost-maven-plugin/src/main/java/boost/maven/plugin/RunMojo.java b/boost-maven/boost-maven-plugin/src/main/java/boost/maven/plugin/RunMojo.java index e119a3f5..ba95d40e 100644 --- a/boost-maven/boost-maven-plugin/src/main/java/boost/maven/plugin/RunMojo.java +++ b/boost-maven/boost-maven-plugin/src/main/java/boost/maven/plugin/RunMojo.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2018 IBM Corporation and others. + * Copyright (c) 2018, 2019 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -34,7 +34,7 @@ public void execute() throws MojoExecutionException { super.execute(); try { - this.getRuntimeInstance().doRun(clean); + this.getRuntimeInstance().doRun(project, this); } catch (BoostException e) { throw new MojoExecutionException("Error running server", e); } diff --git a/boost-maven/boost-maven-plugin/src/main/java/boost/maven/plugin/StartMojo.java b/boost-maven/boost-maven-plugin/src/main/java/boost/maven/plugin/StartMojo.java index eb780707..4ac7c071 100644 --- a/boost-maven/boost-maven-plugin/src/main/java/boost/maven/plugin/StartMojo.java +++ b/boost-maven/boost-maven-plugin/src/main/java/boost/maven/plugin/StartMojo.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2018 IBM Corporation and others. + * Copyright (c) 2018, 2019 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -47,7 +47,7 @@ public void execute() throws MojoExecutionException { super.execute(); try { - this.getRuntimeInstance().doStart(clean, verifyTimeout, serverStartTimeout); + this.getRuntimeInstance().doStart(project, this); } catch (BoostException e) { throw new MojoExecutionException("Error starting server", e); } diff --git a/boost-maven/boost-maven-plugin/src/main/java/boost/maven/plugin/StopMojo.java b/boost-maven/boost-maven-plugin/src/main/java/boost/maven/plugin/StopMojo.java index 993b4d82..00524df4 100644 --- a/boost-maven/boost-maven-plugin/src/main/java/boost/maven/plugin/StopMojo.java +++ b/boost-maven/boost-maven-plugin/src/main/java/boost/maven/plugin/StopMojo.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2018 IBM Corporation and others. + * Copyright (c) 2018, 2019 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -28,7 +28,7 @@ public void execute() throws MojoExecutionException { super.execute(); try { - this.getRuntimeInstance().doStop(); + this.getRuntimeInstance().doStop(project, this); } catch (BoostException e) { throw new MojoExecutionException("Error stopping server", e); } diff --git a/boost-maven/boost-maven-plugin/src/main/java/boost/maven/runtimes/RuntimeParams.java b/boost-maven/boost-maven-plugin/src/main/java/boost/maven/runtimes/RuntimeParams.java deleted file mode 100644 index 7c95f680..00000000 --- a/boost-maven/boost-maven-plugin/src/main/java/boost/maven/runtimes/RuntimeParams.java +++ /dev/null @@ -1,87 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2019 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package boost.maven.runtimes; - -import java.util.List; - -import org.apache.maven.model.Plugin; -import org.apache.maven.plugin.logging.Log; -import org.apache.maven.project.MavenProject; - -import org.eclipse.aether.RepositorySystem; -import org.eclipse.aether.RepositorySystemSession; -import org.eclipse.aether.repository.RemoteRepository; -import org.twdata.maven.mojoexecutor.MojoExecutor.ExecutionEnvironment; - -import boost.common.boosters.AbstractBoosterConfig; - -public class RuntimeParams { - - List boosterConfigs; - ExecutionEnvironment env; - MavenProject project; - Log log; - RepositorySystem repoSystem; - RepositorySystemSession repoSession; - List remoteRepos; - Plugin mavenDepPlugin; - String projectBuildDir; - - public RuntimeParams(List boosterConfigs, ExecutionEnvironment env, MavenProject project, - Log log, RepositorySystem repoSystem, RepositorySystemSession repoSession, - List remoteRepos, Plugin mavenDepPlugin) { - this.log = log; - this.boosterConfigs = boosterConfigs; - this.env = env; - this.project = project; - this.projectBuildDir = project.getBuild().getDirectory(); - this.repoSystem = repoSystem; - this.repoSession = repoSession; - this.remoteRepos = remoteRepos; - this.mavenDepPlugin = mavenDepPlugin; - } - - public Log getLog() { - return this.log; - } - - public List getBoosterConfigs() { - return this.boosterConfigs; - } - - public ExecutionEnvironment getEnv() { - return this.env; - } - - public MavenProject getProject() { - return this.project; - } - - public String getProjectBuildDir() { - return this.projectBuildDir; - } - - public RepositorySystem getRepoSystem() { - return this.repoSystem; - } - - public RepositorySystemSession getRepoSession() { - return this.repoSession; - } - - public List getRemoteRepos() { - return this.remoteRepos; - } - - public Plugin getMavenDepPlugin() { - return this.mavenDepPlugin; - } -} diff --git a/boost-maven/boost-runtimes/pom.xml b/boost-maven/boost-runtimes/pom.xml index 424d4728..7b74c6f7 100644 --- a/boost-maven/boost-runtimes/pom.xml +++ b/boost-maven/boost-runtimes/pom.xml @@ -13,9 +13,8 @@ pom - runtime-openliberty - - runtime-tomee + runtime-liberty + runtime-tomee diff --git a/boost-maven/boost-runtimes/runtime-liberty/pom.xml b/boost-maven/boost-runtimes/runtime-liberty/pom.xml new file mode 100644 index 00000000..df5d890f --- /dev/null +++ b/boost-maven/boost-runtimes/runtime-liberty/pom.xml @@ -0,0 +1,21 @@ + + + 4.0.0 + + + boost + boost-runtimes + 0.1.3-SNAPSHOT + + + runtime-liberty + pom + + + runtime-liberty-common + runtime-openliberty + runtime-wlp + + + diff --git a/boost-maven/boost-runtimes/runtime-liberty/runtime-liberty-common/pom.xml b/boost-maven/boost-runtimes/runtime-liberty/runtime-liberty-common/pom.xml new file mode 100644 index 00000000..79b0f583 --- /dev/null +++ b/boost-maven/boost-runtimes/runtime-liberty/runtime-liberty-common/pom.xml @@ -0,0 +1,94 @@ + + + 4.0.0 + + boost.runtimes + liberty-common + 0.1-SNAPSHOT + jar + + + UTF-8 + UTF-8 + 1.8 + 1.8 + + + + + boost + boost-common + 0.1.3-SNAPSHOT + + + boost + boost-maven-plugin + 0.1.3-SNAPSHOT + + + net.wasdev.wlp.maven.plugins + liberty-maven-plugin + 2.6.3 + + + org.apache.maven + maven-plugin-api + 2.0 + + + org.apache.maven.plugin-tools + maven-plugin-annotations + 3.4 + provided + + + org.twdata.maven + mojo-executor + 2.3.0 + + + com.spotify + docker-client + 8.11.7 + + + org.eclipse.aether + aether-api + 0.9.0.M2 + + + junit + junit + 4.12 + test + + + com.github.stefanbirkner + system-rules + 1.16.0 + test + + + org.codehaus.mojo + plugin-support + 1.0-alpha-1 + + + org.apache.maven + maven-project + + + org.apache.maven + maven-artifact + + + org.apache.maven + maven-plugin-api + + + + + + \ No newline at end of file diff --git a/boost-maven/boost-runtimes/runtime-openliberty/src/main/java/boost/runtimes/openliberty/LibertyRuntime.java b/boost-maven/boost-runtimes/runtime-liberty/runtime-liberty-common/src/main/java/boost/runtimes/liberty/LibertyRuntime.java similarity index 81% rename from boost-maven/boost-runtimes/runtime-openliberty/src/main/java/boost/runtimes/openliberty/LibertyRuntime.java rename to boost-maven/boost-runtimes/runtime-liberty/runtime-liberty-common/src/main/java/boost/runtimes/liberty/LibertyRuntime.java index 7dbd5cf0..02546ecd 100644 --- a/boost-maven/boost-runtimes/runtime-openliberty/src/main/java/boost/runtimes/openliberty/LibertyRuntime.java +++ b/boost-maven/boost-runtimes/runtime-liberty/runtime-liberty-common/src/main/java/boost/runtimes/liberty/LibertyRuntime.java @@ -37,45 +37,35 @@ import boost.common.config.BoosterConfigurator; import boost.common.config.ConfigConstants; import boost.common.runtimes.RuntimeI; -import boost.maven.runtimes.RuntimeParams; +import boost.maven.plugin.AbstractMojo; import boost.maven.utils.BoostLogger; import boost.maven.utils.MavenProjectUtil; import boost.runtimes.openliberty.boosters.LibertyBoosterI; -public class LibertyRuntime implements RuntimeI { - private final List boosterConfigs; - private final ExecutionEnvironment env; - private final MavenProject project; - private final Plugin mavenDepPlugin; - +public abstract class LibertyRuntime implements RuntimeI { private final String serverName = "BoostServer"; - private final String projectBuildDir; - private final String libertyServerPath; + private final String serversDir = "/liberty/wlp/usr/servers/"; + + private final String runtimeGroupId; + private final String runtimeArtifactId; + private final String runtimeVersion; - private final String runtimeGroupId = "io.openliberty"; - private final String runtimeArtifactId = "openliberty-runtime"; - private final String runtimeVersion = "19.0.0.3"; + private String libertyServerPath; + + private MavenProject project; + private ExecutionEnvironment env; private String libertyMavenPluginGroupId = "net.wasdev.wlp.maven.plugins"; private String libertyMavenPluginArtifactId = "liberty-maven-plugin"; private String libertyMavenPluginVersion = "2.6.3"; - public LibertyRuntime() { - this.boosterConfigs = null; - this.env = null; - this.project = null; - this.projectBuildDir = null; - this.libertyServerPath = null; - this.mavenDepPlugin = null; - } + private String mavenDependencyPluginGroupId = "org.apache.maven.plugins"; + private String mavenDependencyPluginArtifactId = "maven-dependency-plugin"; - public LibertyRuntime(RuntimeParams runtimeParams) { - this.boosterConfigs = runtimeParams.getBoosterConfigs(); - this.env = runtimeParams.getEnv(); - this.project = runtimeParams.getProject(); - this.projectBuildDir = project.getBuild().getDirectory(); - this.libertyServerPath = projectBuildDir + "/liberty/wlp/usr/servers/" + serverName; - this.mavenDepPlugin = runtimeParams.getMavenDepPlugin(); + public LibertyRuntime(String runtimeGroupId, String runtimeArtifactId, String runtimeVersion) { + this.runtimeGroupId = runtimeGroupId; + this.runtimeArtifactId = runtimeArtifactId; + this.runtimeVersion = runtimeVersion; } private Plugin getPlugin() throws MojoExecutionException { @@ -83,8 +73,15 @@ private Plugin getPlugin() throws MojoExecutionException { version(libertyMavenPluginVersion)); } + public ExecutionEnvironment getExecutionEnvironment() { + return env; + } + @Override - public void doPackage() throws BoostException { + public void doPackage(List boosterConfigs, Object mavenProject, Object pluginTask) throws BoostException { + project = (MavenProject)mavenProject; + env = ((AbstractMojo)pluginTask).getExecutionEnvironment(); + libertyServerPath = project.getBuild().getDirectory() + serversDir + serverName; String javaCompilerTargetVersion = MavenProjectUtil.getJavaCompilerTargetVersion(project); System.setProperty(BoostProperties.INTERNAL_COMPILER_TARGET, javaCompilerTargetVersion); try { @@ -133,6 +130,8 @@ private void copyBoosterDependencies(List boosterConfigs) List dependenciesToCopy = BoosterConfigurator.getDependenciesToCopy(boosterConfigs, BoostLogger.getInstance()); + Plugin mavenDepPlugin = plugin(groupId(mavenDependencyPluginGroupId), artifactId(mavenDependencyPluginArtifactId)); + for (String dep : dependenciesToCopy) { String[] dependencyInfo = dep.split(":"); @@ -143,7 +142,7 @@ private void copyBoosterDependencies(List boosterConfigs) element(name("artifactItem"), element(name("groupId"), dependencyInfo[0]), element(name("artifactId"), dependencyInfo[1]), element(name("version"), dependencyInfo[2])))), - env); + getExecutionEnvironment()); } } @@ -236,7 +235,7 @@ private void generateLibertyServerConfig(List boosterConf */ private void createLibertyServer() throws MojoExecutionException { executeMojo(getPlugin(), goal("create-server"), - configuration(element(name("serverName"), serverName), getRuntimeArtifactElement()), env); + configuration(element(name("serverName"), serverName), getRuntimeArtifactElement()), getExecutionEnvironment()); } /** @@ -248,7 +247,7 @@ private void createLibertyServer() throws MojoExecutionException { */ private void installMissingFeatures() throws MojoExecutionException { executeMojo(getPlugin(), goal("install-feature"), configuration(element(name("serverName"), serverName), - element(name("features"), element(name("acceptLicense"), "false"))), env); + element(name("features"), element(name("acceptLicense"), "false"))), getExecutionEnvironment()); } /** @@ -262,7 +261,7 @@ private void installApp(String installAppPackagesVal) throws MojoExecutionExcept configuration.addChild(element(name("appsDirectory"), "apps").toDom()); configuration.addChild(element(name("looseApplication"), "true").toDom()); - executeMojo(getPlugin(), goal("install-apps"), configuration, env); + executeMojo(getPlugin(), goal("install-apps"), configuration, getExecutionEnvironment()); } private Element getRuntimeArtifactElement() { @@ -280,24 +279,26 @@ private void createUberJar() throws MojoExecutionException { configuration(element(name("isInstall"), "false"), element(name("include"), "minify,runnable"), element(name("outputDirectory"), "target/liberty-alt-output-dir"), element(name("packageFile"), ""), element(name("serverName"), serverName)), - env); + getExecutionEnvironment()); } @Override - public void doDebug(boolean clean) throws BoostException { + public void doDebug(Object project, Object pluginTask) throws BoostException { try { - executeMojo(getPlugin(), goal("debug"), configuration(element(name("serverName"), serverName), - element(name("clean"), String.valueOf(clean)), getRuntimeArtifactElement()), env); + env = ((AbstractMojo)pluginTask).getExecutionEnvironment(); + executeMojo(getPlugin(), goal("debug"), configuration(element(name("serverName"), serverName), getRuntimeArtifactElement()), + getExecutionEnvironment()); } catch (MojoExecutionException e) { throw new BoostException("Error debugging Liberty server", e); } } @Override - public void doRun(boolean clean) throws BoostException { + public void doRun(Object project, Object pluginTask) throws BoostException { try { - executeMojo(getPlugin(), goal("run"), configuration(element(name("serverName"), serverName), - element(name("clean"), String.valueOf(clean)), getRuntimeArtifactElement()), env); + env = ((AbstractMojo)pluginTask).getExecutionEnvironment(); + executeMojo(getPlugin(), goal("run"), configuration(element(name("serverName"), serverName), getRuntimeArtifactElement()), + getExecutionEnvironment()); } catch (MojoExecutionException e) { throw new BoostException("Error running Liberty server", e); } @@ -305,24 +306,24 @@ public void doRun(boolean clean) throws BoostException { } @Override - public void doStart(boolean clean, int verifyTimeout, int serverStartTimeout) throws BoostException { + public void doStart(Object project, Object pluginTask) throws BoostException { try { + env = ((AbstractMojo)pluginTask).getExecutionEnvironment(); executeMojo(getPlugin(), goal("start"), - configuration(element(name("serverName"), serverName), - element(name("verifyTimeout"), String.valueOf(verifyTimeout)), - element(name("serverStartTimeout"), String.valueOf(serverStartTimeout)), - element(name("clean"), String.valueOf(clean)), getRuntimeArtifactElement()), - env); + configuration(element(name("serverName"), serverName), getRuntimeArtifactElement()), + getExecutionEnvironment()); } catch (MojoExecutionException e) { throw new BoostException("Error starting Liberty server", e); } } @Override - public void doStop() throws BoostException { + public void doStop(Object project, Object pluginTask) throws BoostException { try { + env = ((AbstractMojo)pluginTask).getExecutionEnvironment(); executeMojo(getPlugin(), goal("stop"), - configuration(element(name("serverName"), serverName), getRuntimeArtifactElement()), env); + configuration(element(name("serverName"), serverName), getRuntimeArtifactElement()), + getExecutionEnvironment()); } catch (MojoExecutionException e) { throw new BoostException("Error stopping Liberty server", e); } diff --git a/boost-maven/boost-runtimes/runtime-openliberty/src/main/java/boost/runtimes/openliberty/LibertyServerConfigGenerator.java b/boost-maven/boost-runtimes/runtime-liberty/runtime-liberty-common/src/main/java/boost/runtimes/liberty/LibertyServerConfigGenerator.java similarity index 100% rename from boost-maven/boost-runtimes/runtime-openliberty/src/main/java/boost/runtimes/openliberty/LibertyServerConfigGenerator.java rename to boost-maven/boost-runtimes/runtime-liberty/runtime-liberty-common/src/main/java/boost/runtimes/liberty/LibertyServerConfigGenerator.java diff --git a/boost-maven/boost-runtimes/runtime-openliberty/src/main/java/boost/runtimes/openliberty/boosters/LibertyBoosterI.java b/boost-maven/boost-runtimes/runtime-liberty/runtime-liberty-common/src/main/java/boost/runtimes/liberty/boosters/LibertyBoosterI.java similarity index 100% rename from boost-maven/boost-runtimes/runtime-openliberty/src/main/java/boost/runtimes/openliberty/boosters/LibertyBoosterI.java rename to boost-maven/boost-runtimes/runtime-liberty/runtime-liberty-common/src/main/java/boost/runtimes/liberty/boosters/LibertyBoosterI.java diff --git a/boost-maven/boost-runtimes/runtime-openliberty/src/main/java/boost/runtimes/openliberty/boosters/LibertyCDIBoosterConfig.java b/boost-maven/boost-runtimes/runtime-liberty/runtime-liberty-common/src/main/java/boost/runtimes/liberty/boosters/LibertyCDIBoosterConfig.java similarity index 100% rename from boost-maven/boost-runtimes/runtime-openliberty/src/main/java/boost/runtimes/openliberty/boosters/LibertyCDIBoosterConfig.java rename to boost-maven/boost-runtimes/runtime-liberty/runtime-liberty-common/src/main/java/boost/runtimes/liberty/boosters/LibertyCDIBoosterConfig.java diff --git a/boost-maven/boost-runtimes/runtime-openliberty/src/main/java/boost/runtimes/openliberty/boosters/LibertyJAXRSBoosterConfig.java b/boost-maven/boost-runtimes/runtime-liberty/runtime-liberty-common/src/main/java/boost/runtimes/liberty/boosters/LibertyJAXRSBoosterConfig.java similarity index 100% rename from boost-maven/boost-runtimes/runtime-openliberty/src/main/java/boost/runtimes/openliberty/boosters/LibertyJAXRSBoosterConfig.java rename to boost-maven/boost-runtimes/runtime-liberty/runtime-liberty-common/src/main/java/boost/runtimes/liberty/boosters/LibertyJAXRSBoosterConfig.java diff --git a/boost-maven/boost-runtimes/runtime-openliberty/src/main/java/boost/runtimes/openliberty/boosters/LibertyJDBCBoosterConfig.java b/boost-maven/boost-runtimes/runtime-liberty/runtime-liberty-common/src/main/java/boost/runtimes/liberty/boosters/LibertyJDBCBoosterConfig.java similarity index 100% rename from boost-maven/boost-runtimes/runtime-openliberty/src/main/java/boost/runtimes/openliberty/boosters/LibertyJDBCBoosterConfig.java rename to boost-maven/boost-runtimes/runtime-liberty/runtime-liberty-common/src/main/java/boost/runtimes/liberty/boosters/LibertyJDBCBoosterConfig.java diff --git a/boost-maven/boost-runtimes/runtime-openliberty/src/main/java/boost/runtimes/openliberty/boosters/LibertyJPABoosterConfig.java b/boost-maven/boost-runtimes/runtime-liberty/runtime-liberty-common/src/main/java/boost/runtimes/liberty/boosters/LibertyJPABoosterConfig.java similarity index 100% rename from boost-maven/boost-runtimes/runtime-openliberty/src/main/java/boost/runtimes/openliberty/boosters/LibertyJPABoosterConfig.java rename to boost-maven/boost-runtimes/runtime-liberty/runtime-liberty-common/src/main/java/boost/runtimes/liberty/boosters/LibertyJPABoosterConfig.java diff --git a/boost-maven/boost-runtimes/runtime-openliberty/src/main/java/boost/runtimes/openliberty/boosters/LibertyJSONBBoosterConfig.java b/boost-maven/boost-runtimes/runtime-liberty/runtime-liberty-common/src/main/java/boost/runtimes/liberty/boosters/LibertyJSONBBoosterConfig.java similarity index 100% rename from boost-maven/boost-runtimes/runtime-openliberty/src/main/java/boost/runtimes/openliberty/boosters/LibertyJSONBBoosterConfig.java rename to boost-maven/boost-runtimes/runtime-liberty/runtime-liberty-common/src/main/java/boost/runtimes/liberty/boosters/LibertyJSONBBoosterConfig.java diff --git a/boost-maven/boost-runtimes/runtime-openliberty/src/main/java/boost/runtimes/openliberty/boosters/LibertyJSONPBoosterConfig.java b/boost-maven/boost-runtimes/runtime-liberty/runtime-liberty-common/src/main/java/boost/runtimes/liberty/boosters/LibertyJSONPBoosterConfig.java similarity index 100% rename from boost-maven/boost-runtimes/runtime-openliberty/src/main/java/boost/runtimes/openliberty/boosters/LibertyJSONPBoosterConfig.java rename to boost-maven/boost-runtimes/runtime-liberty/runtime-liberty-common/src/main/java/boost/runtimes/liberty/boosters/LibertyJSONPBoosterConfig.java diff --git a/boost-maven/boost-runtimes/runtime-openliberty/src/main/java/boost/runtimes/openliberty/boosters/LibertyMPConfigBoosterConfig.java b/boost-maven/boost-runtimes/runtime-liberty/runtime-liberty-common/src/main/java/boost/runtimes/liberty/boosters/LibertyMPConfigBoosterConfig.java similarity index 100% rename from boost-maven/boost-runtimes/runtime-openliberty/src/main/java/boost/runtimes/openliberty/boosters/LibertyMPConfigBoosterConfig.java rename to boost-maven/boost-runtimes/runtime-liberty/runtime-liberty-common/src/main/java/boost/runtimes/liberty/boosters/LibertyMPConfigBoosterConfig.java diff --git a/boost-maven/boost-runtimes/runtime-openliberty/src/main/java/boost/runtimes/openliberty/boosters/LibertyMPFaultToleranceBoosterConfig.java b/boost-maven/boost-runtimes/runtime-liberty/runtime-liberty-common/src/main/java/boost/runtimes/liberty/boosters/LibertyMPFaultToleranceBoosterConfig.java similarity index 100% rename from boost-maven/boost-runtimes/runtime-openliberty/src/main/java/boost/runtimes/openliberty/boosters/LibertyMPFaultToleranceBoosterConfig.java rename to boost-maven/boost-runtimes/runtime-liberty/runtime-liberty-common/src/main/java/boost/runtimes/liberty/boosters/LibertyMPFaultToleranceBoosterConfig.java diff --git a/boost-maven/boost-runtimes/runtime-openliberty/src/main/java/boost/runtimes/openliberty/boosters/LibertyMPHealthBoosterConfig.java b/boost-maven/boost-runtimes/runtime-liberty/runtime-liberty-common/src/main/java/boost/runtimes/liberty/boosters/LibertyMPHealthBoosterConfig.java similarity index 100% rename from boost-maven/boost-runtimes/runtime-openliberty/src/main/java/boost/runtimes/openliberty/boosters/LibertyMPHealthBoosterConfig.java rename to boost-maven/boost-runtimes/runtime-liberty/runtime-liberty-common/src/main/java/boost/runtimes/liberty/boosters/LibertyMPHealthBoosterConfig.java diff --git a/boost-maven/boost-runtimes/runtime-openliberty/src/main/java/boost/runtimes/openliberty/boosters/LibertyMPMetricsBoosterConfig.java b/boost-maven/boost-runtimes/runtime-liberty/runtime-liberty-common/src/main/java/boost/runtimes/liberty/boosters/LibertyMPMetricsBoosterConfig.java similarity index 100% rename from boost-maven/boost-runtimes/runtime-openliberty/src/main/java/boost/runtimes/openliberty/boosters/LibertyMPMetricsBoosterConfig.java rename to boost-maven/boost-runtimes/runtime-liberty/runtime-liberty-common/src/main/java/boost/runtimes/liberty/boosters/LibertyMPMetricsBoosterConfig.java diff --git a/boost-maven/boost-runtimes/runtime-openliberty/src/main/java/boost/runtimes/openliberty/boosters/LibertyMPOpenAPIBoosterConfig.java b/boost-maven/boost-runtimes/runtime-liberty/runtime-liberty-common/src/main/java/boost/runtimes/liberty/boosters/LibertyMPOpenAPIBoosterConfig.java similarity index 100% rename from boost-maven/boost-runtimes/runtime-openliberty/src/main/java/boost/runtimes/openliberty/boosters/LibertyMPOpenAPIBoosterConfig.java rename to boost-maven/boost-runtimes/runtime-liberty/runtime-liberty-common/src/main/java/boost/runtimes/liberty/boosters/LibertyMPOpenAPIBoosterConfig.java diff --git a/boost-maven/boost-runtimes/runtime-openliberty/src/main/java/boost/runtimes/openliberty/boosters/LibertyMPOpenTracingBoosterConfig.java b/boost-maven/boost-runtimes/runtime-liberty/runtime-liberty-common/src/main/java/boost/runtimes/liberty/boosters/LibertyMPOpenTracingBoosterConfig.java similarity index 100% rename from boost-maven/boost-runtimes/runtime-openliberty/src/main/java/boost/runtimes/openliberty/boosters/LibertyMPOpenTracingBoosterConfig.java rename to boost-maven/boost-runtimes/runtime-liberty/runtime-liberty-common/src/main/java/boost/runtimes/liberty/boosters/LibertyMPOpenTracingBoosterConfig.java diff --git a/boost-maven/boost-runtimes/runtime-openliberty/src/main/java/boost/runtimes/openliberty/boosters/LibertyMPRestClientBoosterConfig.java b/boost-maven/boost-runtimes/runtime-liberty/runtime-liberty-common/src/main/java/boost/runtimes/liberty/boosters/LibertyMPRestClientBoosterConfig.java similarity index 100% rename from boost-maven/boost-runtimes/runtime-openliberty/src/main/java/boost/runtimes/openliberty/boosters/LibertyMPRestClientBoosterConfig.java rename to boost-maven/boost-runtimes/runtime-liberty/runtime-liberty-common/src/main/java/boost/runtimes/liberty/boosters/LibertyMPRestClientBoosterConfig.java diff --git a/boost-maven/boost-runtimes/runtime-openliberty/src/test/java/io/openliberty/boost/runtimes/boosters/CDIBoosterTest.java b/boost-maven/boost-runtimes/runtime-liberty/runtime-liberty-common/src/test/java/io/openliberty/boost/runtimes/boosters/CDIBoosterTest.java similarity index 100% rename from boost-maven/boost-runtimes/runtime-openliberty/src/test/java/io/openliberty/boost/runtimes/boosters/CDIBoosterTest.java rename to boost-maven/boost-runtimes/runtime-liberty/runtime-liberty-common/src/test/java/io/openliberty/boost/runtimes/boosters/CDIBoosterTest.java diff --git a/boost-maven/boost-runtimes/runtime-openliberty/src/test/java/io/openliberty/boost/runtimes/boosters/JAXRSBoosterTest.java b/boost-maven/boost-runtimes/runtime-liberty/runtime-liberty-common/src/test/java/io/openliberty/boost/runtimes/boosters/JAXRSBoosterTest.java similarity index 100% rename from boost-maven/boost-runtimes/runtime-openliberty/src/test/java/io/openliberty/boost/runtimes/boosters/JAXRSBoosterTest.java rename to boost-maven/boost-runtimes/runtime-liberty/runtime-liberty-common/src/test/java/io/openliberty/boost/runtimes/boosters/JAXRSBoosterTest.java diff --git a/boost-maven/boost-runtimes/runtime-openliberty/src/test/java/io/openliberty/boost/runtimes/boosters/JDBCBoosterTest.java b/boost-maven/boost-runtimes/runtime-liberty/runtime-liberty-common/src/test/java/io/openliberty/boost/runtimes/boosters/JDBCBoosterTest.java similarity index 100% rename from boost-maven/boost-runtimes/runtime-openliberty/src/test/java/io/openliberty/boost/runtimes/boosters/JDBCBoosterTest.java rename to boost-maven/boost-runtimes/runtime-liberty/runtime-liberty-common/src/test/java/io/openliberty/boost/runtimes/boosters/JDBCBoosterTest.java diff --git a/boost-maven/boost-runtimes/runtime-openliberty/src/test/java/io/openliberty/boost/runtimes/boosters/JSONBBoosterTest.java b/boost-maven/boost-runtimes/runtime-liberty/runtime-liberty-common/src/test/java/io/openliberty/boost/runtimes/boosters/JSONBBoosterTest.java similarity index 100% rename from boost-maven/boost-runtimes/runtime-openliberty/src/test/java/io/openliberty/boost/runtimes/boosters/JSONBBoosterTest.java rename to boost-maven/boost-runtimes/runtime-liberty/runtime-liberty-common/src/test/java/io/openliberty/boost/runtimes/boosters/JSONBBoosterTest.java diff --git a/boost-maven/boost-runtimes/runtime-openliberty/src/test/java/io/openliberty/boost/runtimes/boosters/JSONPBoosterTest.java b/boost-maven/boost-runtimes/runtime-liberty/runtime-liberty-common/src/test/java/io/openliberty/boost/runtimes/boosters/JSONPBoosterTest.java similarity index 100% rename from boost-maven/boost-runtimes/runtime-openliberty/src/test/java/io/openliberty/boost/runtimes/boosters/JSONPBoosterTest.java rename to boost-maven/boost-runtimes/runtime-liberty/runtime-liberty-common/src/test/java/io/openliberty/boost/runtimes/boosters/JSONPBoosterTest.java diff --git a/boost-maven/boost-runtimes/runtime-openliberty/src/test/java/io/openliberty/boost/runtimes/boosters/MPConfigBoosterTest.java b/boost-maven/boost-runtimes/runtime-liberty/runtime-liberty-common/src/test/java/io/openliberty/boost/runtimes/boosters/MPConfigBoosterTest.java similarity index 100% rename from boost-maven/boost-runtimes/runtime-openliberty/src/test/java/io/openliberty/boost/runtimes/boosters/MPConfigBoosterTest.java rename to boost-maven/boost-runtimes/runtime-liberty/runtime-liberty-common/src/test/java/io/openliberty/boost/runtimes/boosters/MPConfigBoosterTest.java diff --git a/boost-maven/boost-runtimes/runtime-openliberty/src/test/java/io/openliberty/boost/runtimes/boosters/MPFaultToleranceBoosterTest.java b/boost-maven/boost-runtimes/runtime-liberty/runtime-liberty-common/src/test/java/io/openliberty/boost/runtimes/boosters/MPFaultToleranceBoosterTest.java similarity index 100% rename from boost-maven/boost-runtimes/runtime-openliberty/src/test/java/io/openliberty/boost/runtimes/boosters/MPFaultToleranceBoosterTest.java rename to boost-maven/boost-runtimes/runtime-liberty/runtime-liberty-common/src/test/java/io/openliberty/boost/runtimes/boosters/MPFaultToleranceBoosterTest.java diff --git a/boost-maven/boost-runtimes/runtime-openliberty/src/test/java/io/openliberty/boost/runtimes/boosters/MPHealthBoosterTest.java b/boost-maven/boost-runtimes/runtime-liberty/runtime-liberty-common/src/test/java/io/openliberty/boost/runtimes/boosters/MPHealthBoosterTest.java similarity index 100% rename from boost-maven/boost-runtimes/runtime-openliberty/src/test/java/io/openliberty/boost/runtimes/boosters/MPHealthBoosterTest.java rename to boost-maven/boost-runtimes/runtime-liberty/runtime-liberty-common/src/test/java/io/openliberty/boost/runtimes/boosters/MPHealthBoosterTest.java diff --git a/boost-maven/boost-runtimes/runtime-openliberty/src/test/java/io/openliberty/boost/runtimes/boosters/MPMetricsBoosterTest.java b/boost-maven/boost-runtimes/runtime-liberty/runtime-liberty-common/src/test/java/io/openliberty/boost/runtimes/boosters/MPMetricsBoosterTest.java similarity index 100% rename from boost-maven/boost-runtimes/runtime-openliberty/src/test/java/io/openliberty/boost/runtimes/boosters/MPMetricsBoosterTest.java rename to boost-maven/boost-runtimes/runtime-liberty/runtime-liberty-common/src/test/java/io/openliberty/boost/runtimes/boosters/MPMetricsBoosterTest.java diff --git a/boost-maven/boost-runtimes/runtime-openliberty/src/test/java/io/openliberty/boost/runtimes/boosters/MPOpenAPIBoosterTest.java b/boost-maven/boost-runtimes/runtime-liberty/runtime-liberty-common/src/test/java/io/openliberty/boost/runtimes/boosters/MPOpenAPIBoosterTest.java similarity index 100% rename from boost-maven/boost-runtimes/runtime-openliberty/src/test/java/io/openliberty/boost/runtimes/boosters/MPOpenAPIBoosterTest.java rename to boost-maven/boost-runtimes/runtime-liberty/runtime-liberty-common/src/test/java/io/openliberty/boost/runtimes/boosters/MPOpenAPIBoosterTest.java diff --git a/boost-maven/boost-runtimes/runtime-openliberty/src/test/java/io/openliberty/boost/runtimes/boosters/MPOpenTracingBoosterTest.java b/boost-maven/boost-runtimes/runtime-liberty/runtime-liberty-common/src/test/java/io/openliberty/boost/runtimes/boosters/MPOpenTracingBoosterTest.java similarity index 100% rename from boost-maven/boost-runtimes/runtime-openliberty/src/test/java/io/openliberty/boost/runtimes/boosters/MPOpenTracingBoosterTest.java rename to boost-maven/boost-runtimes/runtime-liberty/runtime-liberty-common/src/test/java/io/openliberty/boost/runtimes/boosters/MPOpenTracingBoosterTest.java diff --git a/boost-maven/boost-runtimes/runtime-openliberty/src/test/java/io/openliberty/boost/runtimes/boosters/MPRestClientBoosterTest.java b/boost-maven/boost-runtimes/runtime-liberty/runtime-liberty-common/src/test/java/io/openliberty/boost/runtimes/boosters/MPRestClientBoosterTest.java similarity index 100% rename from boost-maven/boost-runtimes/runtime-openliberty/src/test/java/io/openliberty/boost/runtimes/boosters/MPRestClientBoosterTest.java rename to boost-maven/boost-runtimes/runtime-liberty/runtime-liberty-common/src/test/java/io/openliberty/boost/runtimes/boosters/MPRestClientBoosterTest.java diff --git a/boost-maven/boost-runtimes/runtime-openliberty/src/test/java/io/openliberty/boost/runtimes/config/LibertyServerConfigGeneratorTest.java b/boost-maven/boost-runtimes/runtime-liberty/runtime-liberty-common/src/test/java/io/openliberty/boost/runtimes/config/LibertyServerConfigGeneratorTest.java similarity index 100% rename from boost-maven/boost-runtimes/runtime-openliberty/src/test/java/io/openliberty/boost/runtimes/config/LibertyServerConfigGeneratorTest.java rename to boost-maven/boost-runtimes/runtime-liberty/runtime-liberty-common/src/test/java/io/openliberty/boost/runtimes/config/LibertyServerConfigGeneratorTest.java diff --git a/boost-maven/boost-runtimes/runtime-openliberty/src/test/java/io/openliberty/boost/runtimes/utils/BoosterUtil.java b/boost-maven/boost-runtimes/runtime-liberty/runtime-liberty-common/src/test/java/io/openliberty/boost/runtimes/utils/BoosterUtil.java similarity index 100% rename from boost-maven/boost-runtimes/runtime-openliberty/src/test/java/io/openliberty/boost/runtimes/utils/BoosterUtil.java rename to boost-maven/boost-runtimes/runtime-liberty/runtime-liberty-common/src/test/java/io/openliberty/boost/runtimes/utils/BoosterUtil.java diff --git a/boost-maven/boost-runtimes/runtime-openliberty/src/test/java/io/openliberty/boost/runtimes/utils/CommonLogger.java b/boost-maven/boost-runtimes/runtime-liberty/runtime-liberty-common/src/test/java/io/openliberty/boost/runtimes/utils/CommonLogger.java similarity index 100% rename from boost-maven/boost-runtimes/runtime-openliberty/src/test/java/io/openliberty/boost/runtimes/utils/CommonLogger.java rename to boost-maven/boost-runtimes/runtime-liberty/runtime-liberty-common/src/test/java/io/openliberty/boost/runtimes/utils/CommonLogger.java diff --git a/boost-maven/boost-runtimes/runtime-openliberty/src/test/java/io/openliberty/boost/runtimes/utils/ConfigFileUtils.java b/boost-maven/boost-runtimes/runtime-liberty/runtime-liberty-common/src/test/java/io/openliberty/boost/runtimes/utils/ConfigFileUtils.java similarity index 100% rename from boost-maven/boost-runtimes/runtime-openliberty/src/test/java/io/openliberty/boost/runtimes/utils/ConfigFileUtils.java rename to boost-maven/boost-runtimes/runtime-liberty/runtime-liberty-common/src/test/java/io/openliberty/boost/runtimes/utils/ConfigFileUtils.java diff --git a/boost-maven/boost-runtimes/runtime-openliberty/src/test/java/io/openliberty/boost/runtimes/utils/DOMUtils.java b/boost-maven/boost-runtimes/runtime-liberty/runtime-liberty-common/src/test/java/io/openliberty/boost/runtimes/utils/DOMUtils.java similarity index 100% rename from boost-maven/boost-runtimes/runtime-openliberty/src/test/java/io/openliberty/boost/runtimes/utils/DOMUtils.java rename to boost-maven/boost-runtimes/runtime-liberty/runtime-liberty-common/src/test/java/io/openliberty/boost/runtimes/utils/DOMUtils.java diff --git a/boost-maven/boost-runtimes/runtime-liberty/runtime-openliberty/pom.xml b/boost-maven/boost-runtimes/runtime-liberty/runtime-openliberty/pom.xml new file mode 100644 index 00000000..aeb3a913 --- /dev/null +++ b/boost-maven/boost-runtimes/runtime-liberty/runtime-openliberty/pom.xml @@ -0,0 +1,27 @@ + + + 4.0.0 + + boost.runtimes + openliberty + 1.0-M1-SNAPSHOT + jar + + + UTF-8 + UTF-8 + 1.8 + 1.8 + + + + + boost.runtimes + liberty-common + 0.1-SNAPSHOT + + + + diff --git a/boost-gradle/src/main/groovy/io/openliberty/boost/gradle/extensions/BoostDockerExtension.groovy b/boost-maven/boost-runtimes/runtime-liberty/runtime-openliberty/src/main/java/boost/runtimes/openliberty/OpenLibertyRuntime.java similarity index 57% rename from boost-gradle/src/main/groovy/io/openliberty/boost/gradle/extensions/BoostDockerExtension.groovy rename to boost-maven/boost-runtimes/runtime-liberty/runtime-openliberty/src/main/java/boost/runtimes/openliberty/OpenLibertyRuntime.java index 6fc5ccfa..180d3558 100644 --- a/boost-gradle/src/main/groovy/io/openliberty/boost/gradle/extensions/BoostDockerExtension.groovy +++ b/boost-maven/boost-runtimes/runtime-liberty/runtime-openliberty/src/main/java/boost/runtimes/openliberty/OpenLibertyRuntime.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2018 IBM Corporation and others. + * Copyright (c) 2019 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -8,17 +8,12 @@ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ +package boost.runtimes.openliberty; -package io.openliberty.boost.gradle.extensions +public class OpenLibertyRuntime extends LibertyRuntime { -class BoostDockerExtension { + public OpenLibertyRuntime() { + super("io.openliberty", "openliberty-runtime", "19.0.0.3"); + } - String dockerizer = "liberty" - String repository = null - String tag = "latest" - boolean useProxy = false - boolean pullNewerImage = false - boolean noCache = false - Map buildArgs = new HashMap() - -} \ No newline at end of file +} diff --git a/boost-maven/boost-runtimes/runtime-liberty/runtime-openliberty/src/main/resources/META-INF/services/boost.common.runtimes.RuntimeI b/boost-maven/boost-runtimes/runtime-liberty/runtime-openliberty/src/main/resources/META-INF/services/boost.common.runtimes.RuntimeI new file mode 100644 index 00000000..409569f3 --- /dev/null +++ b/boost-maven/boost-runtimes/runtime-liberty/runtime-openliberty/src/main/resources/META-INF/services/boost.common.runtimes.RuntimeI @@ -0,0 +1 @@ +boost.runtimes.openliberty.OpenLibertyRuntime \ No newline at end of file diff --git a/boost-maven/boost-runtimes/runtime-liberty/runtime-wlp/pom.xml b/boost-maven/boost-runtimes/runtime-liberty/runtime-wlp/pom.xml new file mode 100644 index 00000000..162fe127 --- /dev/null +++ b/boost-maven/boost-runtimes/runtime-liberty/runtime-wlp/pom.xml @@ -0,0 +1,25 @@ + + + 4.0.0 + + boost.runtimes + wlp + 1.0-M1-SNAPSHOT + + + UTF-8 + UTF-8 + 1.8 + 1.8 + + + + + boost.runtimes + liberty-common + 0.1-SNAPSHOT + + + + diff --git a/boost-maven/boost-runtimes/runtime-liberty/runtime-wlp/src/main/java/boost/runtimes/openliberty/WLPRuntime.java b/boost-maven/boost-runtimes/runtime-liberty/runtime-wlp/src/main/java/boost/runtimes/openliberty/WLPRuntime.java new file mode 100644 index 00000000..675c643f --- /dev/null +++ b/boost-maven/boost-runtimes/runtime-liberty/runtime-wlp/src/main/java/boost/runtimes/openliberty/WLPRuntime.java @@ -0,0 +1,19 @@ +/******************************************************************************* + * Copyright (c) 2019 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package boost.runtimes.openliberty; + +public class WLPRuntime extends LibertyRuntime { + + public WLPRuntime() { + super("com.ibm.websphere.appserver.runtime", "wlp-webProfile8", "19.0.0.7"); + } + +} diff --git a/boost-maven/boost-runtimes/runtime-liberty/runtime-wlp/src/main/resources/META-INF/services/boost.common.runtimes.RuntimeI b/boost-maven/boost-runtimes/runtime-liberty/runtime-wlp/src/main/resources/META-INF/services/boost.common.runtimes.RuntimeI new file mode 100644 index 00000000..c4092749 --- /dev/null +++ b/boost-maven/boost-runtimes/runtime-liberty/runtime-wlp/src/main/resources/META-INF/services/boost.common.runtimes.RuntimeI @@ -0,0 +1 @@ +boost.runtimes.openliberty.WLPRuntime \ No newline at end of file diff --git a/boost-maven/boost-runtimes/runtime-openliberty/pom.xml b/boost-maven/boost-runtimes/runtime-openliberty/pom.xml deleted file mode 100644 index 49a52b33..00000000 --- a/boost-maven/boost-runtimes/runtime-openliberty/pom.xml +++ /dev/null @@ -1,93 +0,0 @@ - - - 4.0.0 - - boost.runtimes - openliberty - 1.0-M1-SNAPSHOT - jar - - - UTF-8 - UTF-8 - 1.8 - 1.8 - - - - - boost - boost-common - 0.1.3-SNAPSHOT - - - boost - boost-maven-plugin - 0.1.3-SNAPSHOT - - - net.wasdev.wlp.maven.plugins - liberty-maven-plugin - 2.6.3 - - - org.apache.maven - maven-plugin-api - 2.0 - - - org.apache.maven.plugin-tools - maven-plugin-annotations - 3.4 - provided - - - org.twdata.maven - mojo-executor - 2.3.0 - - - com.spotify - docker-client - 8.11.7 - - - org.eclipse.aether - aether-api - 0.9.0.M2 - - - junit - junit - 4.12 - test - - - com.github.stefanbirkner - system-rules - 1.16.0 - test - - - org.codehaus.mojo - plugin-support - 1.0-alpha-1 - - - org.apache.maven - maven-project - - - org.apache.maven - maven-artifact - - - org.apache.maven - maven-plugin-api - - - - - - diff --git a/boost-maven/boost-runtimes/runtime-openliberty/src/main/resources/META-INF/services/boost.common.runtimes.RuntimeI b/boost-maven/boost-runtimes/runtime-openliberty/src/main/resources/META-INF/services/boost.common.runtimes.RuntimeI deleted file mode 100644 index 159f4bd2..00000000 --- a/boost-maven/boost-runtimes/runtime-openliberty/src/main/resources/META-INF/services/boost.common.runtimes.RuntimeI +++ /dev/null @@ -1 +0,0 @@ -boost.runtimes.openliberty.LibertyRuntime \ No newline at end of file diff --git a/boost-maven/boost-runtimes/runtime-tomee/src/main/java/boost/runtimes/tomee/TomeeRuntime.java b/boost-maven/boost-runtimes/runtime-tomee/src/main/java/boost/runtimes/tomee/TomeeRuntime.java index c815290b..943b0b9b 100644 --- a/boost-maven/boost-runtimes/runtime-tomee/src/main/java/boost/runtimes/tomee/TomeeRuntime.java +++ b/boost-maven/boost-runtimes/runtime-tomee/src/main/java/boost/runtimes/tomee/TomeeRuntime.java @@ -25,6 +25,7 @@ import org.apache.maven.model.Plugin; import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.project.MavenProject; import org.twdata.maven.mojoexecutor.MojoExecutor.ExecutionEnvironment; import boost.common.BoostException; @@ -32,45 +33,42 @@ import boost.common.config.BoostProperties; import boost.common.config.BoosterConfigurator; import boost.common.runtimes.RuntimeI; -import boost.maven.runtimes.RuntimeParams; +import boost.maven.plugin.AbstractMojo; import boost.maven.utils.BoostLogger; public class TomeeRuntime implements RuntimeI { - private final List boosterConfigs; - private final ExecutionEnvironment env; - private final String tomeeMavenPluginGroupId = "org.apache.tomee.maven"; private final String tomeeMavenPluginArtifactId = "tomee-maven-plugin"; - private final String installDir; - private final String configDir; - private final Plugin mavenDepPlugin; + private final String mavenDependencyPluginGroupId = "org.apache.maven.plugins"; + private final String mavenDependencyPluginArtifactId = "maven-dependency-plugin"; - public TomeeRuntime() { - this.boosterConfigs = null; - this.env = null; + private String installDir; + private String configDir; - this.installDir = null; - this.configDir = null; + private MavenProject project; + private ExecutionEnvironment env; - this.mavenDepPlugin = null; - } + public TomeeRuntime() {} - public TomeeRuntime(RuntimeParams params) { - this.boosterConfigs = params.getBoosterConfigs(); - this.env = params.getEnv(); + public ExecutionEnvironment getExecutionEnvironment() { + return env; + } - this.installDir = params.getProjectBuildDir() + "/apache-tomee/"; - this.configDir = installDir + "conf"; - this.mavenDepPlugin = params.getMavenDepPlugin(); + private Plugin getMavenDependencyPlugin() throws MojoExecutionException { + return plugin(groupId(mavenDependencyPluginGroupId), artifactId(mavenDependencyPluginArtifactId)); } private Plugin getPlugin() throws MojoExecutionException { return plugin(groupId(tomeeMavenPluginGroupId), artifactId(tomeeMavenPluginArtifactId), version("8.0.0-M2")); } - public void doPackage() throws BoostException { + public void doPackage(List boosterConfigs, Object mavenProject, Object pluginTask) throws BoostException { try { + project = (MavenProject)mavenProject; + env = ((AbstractMojo)pluginTask).getExecutionEnvironment(); + this.installDir = project.getBuild().getDirectory() + "/apache-tomee/"; + this.configDir = installDir + "conf"; createTomeeServer(); configureTomeeServer(boosterConfigs); copyTomeeJarDependencies(boosterConfigs); @@ -85,7 +83,7 @@ public void doPackage() throws BoostException { */ private void createTomeeServer() throws MojoExecutionException { executeMojo(getPlugin(), goal("build"), configuration(element(name("context"), "ROOT"), - element(name("tomeeVersion"), "8.0.0-M2"), element(name("tomeeClassifier"), "plus")), env); + element(name("tomeeVersion"), "8.0.0-M2"), element(name("tomeeClassifier"), "plus")), getExecutionEnvironment()); } /** @@ -128,13 +126,13 @@ private void copyTomeeJarDependencies(List boosterConfigs for (String dep : tomeeDependencyJarsToCopy) { String[] dependencyInfo = dep.split(":"); - executeMojo(mavenDepPlugin, goal("copy"), + executeMojo(getMavenDependencyPlugin(), goal("copy"), configuration(element(name("outputDirectory"), installDir + "boost"), element(name("artifactItems"), element(name("artifactItem"), element(name("groupId"), dependencyInfo[0]), element(name("artifactId"), dependencyInfo[1]), element(name("version"), dependencyInfo[2])))), - env); + getExecutionEnvironment()); } } @@ -147,41 +145,52 @@ private void createUberJar() throws MojoExecutionException { element(name("classpaths"), "[]"), element(name("context"), "ROOT"), element(name("tomeeVersion"), "8.0.0-M2"), element(name("tomeeClassifier"), "plus"), element(name("catalinaBase"), installDir), element(name("config"), configDir)), - env); + getExecutionEnvironment()); } - public void doDebug(boolean clean) throws BoostException { - // TODO No debug in TomEE yet + public void doDebug(Object mavenProject, Object pluginTask) throws BoostException { + try { + env = ((AbstractMojo)pluginTask).getExecutionEnvironment(); + executeMojo(getPlugin(), goal("debug"), + configuration(element(name("tomeeAlreadyInstalled"), "true"), element(name("context"), "ROOT"), + element(name("tomeeVersion"), "8.0.0-M2"), element(name("tomeeClassifier"), "plus")), + getExecutionEnvironment()); + } catch (MojoExecutionException e) { + throw new BoostException("Error running TomEE server in debug", e); + } } - public void doRun(boolean clean) throws BoostException { + public void doRun(Object mavenProject, Object pluginTask) throws BoostException { try { + env = ((AbstractMojo)pluginTask).getExecutionEnvironment(); executeMojo(getPlugin(), goal("run"), configuration(element(name("tomeeAlreadyInstalled"), "true"), element(name("context"), "ROOT"), element(name("tomeeVersion"), "8.0.0-M2"), element(name("tomeeClassifier"), "plus")), - env); + getExecutionEnvironment()); } catch (MojoExecutionException e) { throw new BoostException("Error running TomEE server", e); } } - public void doStart(boolean clean, int verifyTimeout, int serverStartTimeout) throws BoostException { + public void doStart(Object mavenProject, Object pluginTask) throws BoostException { try { + env = ((AbstractMojo)pluginTask).getExecutionEnvironment(); executeMojo(getPlugin(), goal("start"), configuration(element(name("tomeeAlreadyInstalled"), "true"), element(name("context"), "ROOT"), element(name("tomeeVersion"), "8.0.0-M2"), element(name("tomeeClassifier"), "plus")), - env); + getExecutionEnvironment()); } catch (MojoExecutionException e) { throw new BoostException("Error starting TomEE server", e); } } - public void doStop() throws BoostException { + public void doStop(Object mavenProject, Object pluginTask) throws BoostException { try { + env = ((AbstractMojo)pluginTask).getExecutionEnvironment(); executeMojo(getPlugin(), goal("stop"), configuration(element(name("tomeeAlreadyInstalled"), "true"), element(name("context"), "ROOT"), element(name("tomeeVersion"), "8.0.0-M2"), element(name("tomeeClassifier"), "plus")), - env); + getExecutionEnvironment()); } catch (MojoExecutionException e) { throw new BoostException("Error stopping TomEE server", e); } diff --git a/boost-maven/boost-runtimes/runtime-wlp/pom.xml b/boost-maven/boost-runtimes/runtime-wlp/pom.xml deleted file mode 100644 index 8c10f554..00000000 --- a/boost-maven/boost-runtimes/runtime-wlp/pom.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - 4.0.0 - - boost.runtimes - wlp - 1.0-M1-SNAPSHOT - -