-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add runtime groupId and artifactId properties (#1287)
* Adding groupId and artifactId properties * Add runtime property override tests * Use default value for empty runtime property * Update default OL version and bump runtime property test versions * Updating docs with new runtime property info * Add runtime property information to installation-configuration documentation
- Loading branch information
Showing
11 changed files
with
252 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
liberty-maven-plugin/src/it/basic-runtime-properties-override-it/invoker.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# prove the runtime version can be overridden | ||
invoker.goals.1 = clean install -Dliberty.runtime.groupId=io.openliberty -Dliberty.runtime.artifactId=openliberty-runtime -Dliberty.runtime.version=21.0.0.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
...s-override-it/src/test/java/net/wasdev/wlp/maven/test/app/LibertyRuntimePropertiesIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
package net.wasdev.wlp.maven.test.app; | ||
|
||
import java.io.File; | ||
|
||
import org.junit.Test; | ||
|
||
import java.io.FileInputStream; | ||
import java.io.IOException; | ||
import java.io.InputStream; | ||
import java.io.InputStreamReader; | ||
import java.util.Properties; | ||
import java.util.Scanner; | ||
|
||
import static junit.framework.Assert.*; | ||
|
||
// Check that the liberty runtime groupId, artifactId, and version were successfully overridden by the | ||
// -Dliberty.runtime.groupId, -Dliberty.runtime.artifactId, and -Dliberty.runtime.version properties | ||
public class LibertyRuntimePropertiesIT { | ||
|
||
@Test | ||
public void testLibertyVersionInstalled() throws Exception { | ||
File f = new File("./liberty/wlp/lib/versions/openliberty.properties"); | ||
assertTrue(f.getCanonicalFile() + " doesn't exist.", f.exists()); | ||
|
||
FileInputStream input = new FileInputStream(f); | ||
Properties libertyProductProperties = new Properties(); | ||
|
||
libertyProductProperties.load(input); | ||
String version = libertyProductProperties.getProperty("com.ibm.websphere.productVersion"); | ||
assertNotNull("The com.ibm.websphere.productVersion property does not exist.",version); | ||
assertEquals("The com.ibm.websphere.productVersion property has an unexpected value.","21.0.0.3",version); | ||
} | ||
|
||
@Test | ||
public void buildLogCheck() throws Exception { | ||
File buildLog = new File("../build.log"); | ||
assertTrue(buildLog.exists()); | ||
|
||
InputStream buildOutput = null; | ||
InputStreamReader in = null; | ||
Scanner s = null; | ||
|
||
final String GROUPID_MESSAGE = "[INFO] The runtimeArtifact groupId io.openliberty is overwritten by the liberty.runtime.groupId value io.openliberty."; | ||
boolean GROUPID_MESSAGE_FOUND = false; | ||
|
||
final String ARTIFACTID_MESSAGE = "[INFO] The runtimeArtifact artifactId openliberty-webProfile8 is overwritten by the liberty.runtime.artifactId value openliberty-runtime."; | ||
boolean ARTIFACTID_MESSAGE_FOUND = false; | ||
|
||
final String VERSION_MESSAGE = "[INFO] The runtimeArtifact version 19.0.0.6 is overwritten by the liberty.runtime.version value 21.0.0.3."; | ||
boolean VERSION_MESSAGE_FOUND = false; | ||
|
||
try { | ||
buildOutput = new FileInputStream(buildLog); | ||
in = new InputStreamReader(buildOutput); | ||
s = new Scanner(in); | ||
|
||
while (s.hasNextLine()) { | ||
String line = s.nextLine(); | ||
if (line.equals(GROUPID_MESSAGE)) { | ||
GROUPID_MESSAGE_FOUND = true; | ||
} else if (line.equals(ARTIFACTID_MESSAGE)) { | ||
ARTIFACTID_MESSAGE_FOUND = true; | ||
} else if (line.equals(VERSION_MESSAGE)) { | ||
VERSION_MESSAGE_FOUND = true; | ||
} | ||
} | ||
} catch (Exception e) { | ||
|
||
} | ||
|
||
assertTrue(GROUPID_MESSAGE_FOUND && ARTIFACTID_MESSAGE_FOUND && VERSION_MESSAGE_FOUND); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
...m-override-it/src/test/java/net/wasdev/wlp/maven/test/app/LibertyRuntimePropertiesIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
package net.wasdev.wlp.maven.test.app; | ||
|
||
import java.io.File; | ||
|
||
import org.junit.Test; | ||
|
||
import java.io.FileInputStream; | ||
import java.io.IOException; | ||
import java.io.InputStream; | ||
import java.io.InputStreamReader; | ||
import java.util.Properties; | ||
import java.util.Scanner; | ||
|
||
import static junit.framework.Assert.*; | ||
|
||
// Check that the liberty runtime groupId, artifactId, and version were successfully overridden by the | ||
// liberty.runtime.groupId, liberty.runtime.artifactId, and liberty.runtime.version properties in the pom.xml | ||
public class LibertyRuntimePropertiesIT { | ||
|
||
@Test | ||
public void testLibertyVersionInstalled() throws Exception { | ||
File f = new File("./liberty/wlp/lib/versions/openliberty.properties"); | ||
assertTrue(f.getCanonicalFile() + " doesn't exist.", f.exists()); | ||
|
||
FileInputStream input = new FileInputStream(f); | ||
Properties libertyProductProperties = new Properties(); | ||
|
||
libertyProductProperties.load(input); | ||
String version = libertyProductProperties.getProperty("com.ibm.websphere.productVersion"); | ||
assertNotNull("The com.ibm.websphere.productVersion property does not exist.",version); | ||
assertEquals("The com.ibm.websphere.productVersion property has an unexpected value.","21.0.0.3",version); | ||
} | ||
|
||
@Test | ||
public void buildLogCheck() throws Exception { | ||
File buildLog = new File("../build.log"); | ||
assertTrue(buildLog.exists()); | ||
|
||
InputStream buildOutput = null; | ||
InputStreamReader in = null; | ||
Scanner s = null; | ||
|
||
final String GROUPID_MESSAGE = "[INFO] The runtimeArtifact groupId io.openliberty is overwritten by the liberty.runtime.groupId value io.openliberty."; | ||
boolean GROUPID_MESSAGE_FOUND = false; | ||
|
||
final String ARTIFACTID_MESSAGE = "[INFO] The runtimeArtifact artifactId openliberty-webProfile8 is overwritten by the liberty.runtime.artifactId value openliberty-runtime."; | ||
boolean ARTIFACTID_MESSAGE_FOUND = false; | ||
|
||
final String VERSION_MESSAGE = "[INFO] The runtimeArtifact version 19.0.0.6 is overwritten by the liberty.runtime.version value 21.0.0.3."; | ||
boolean VERSION_MESSAGE_FOUND = false; | ||
|
||
try { | ||
buildOutput = new FileInputStream(buildLog); | ||
in = new InputStreamReader(buildOutput); | ||
s = new Scanner(in); | ||
|
||
while (s.hasNextLine()) { | ||
String line = s.nextLine(); | ||
if (line.equals(GROUPID_MESSAGE)) { | ||
GROUPID_MESSAGE_FOUND = true; | ||
} else if (line.equals(ARTIFACTID_MESSAGE)) { | ||
ARTIFACTID_MESSAGE_FOUND = true; | ||
} else if (line.equals(VERSION_MESSAGE)) { | ||
VERSION_MESSAGE_FOUND = true; | ||
} | ||
} | ||
} catch (Exception e) { | ||
|
||
} | ||
|
||
assertTrue(GROUPID_MESSAGE_FOUND && ARTIFACTID_MESSAGE_FOUND && VERSION_MESSAGE_FOUND); | ||
} | ||
|
||
} |
32 changes: 0 additions & 32 deletions
32
...-pom-override-it/src/test/java/net/wasdev/wlp/maven/test/app/LibertyRuntimeVersionIT.java
This file was deleted.
Oops, something went wrong.
2 changes: 0 additions & 2 deletions
2
liberty-maven-plugin/src/it/basic-runtime-version-property-override-it/invoker.properties
This file was deleted.
Oops, something went wrong.
32 changes: 0 additions & 32 deletions
32
...erty-override-it/src/test/java/net/wasdev/wlp/maven/test/app/LibertyRuntimeVersionIT.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters