Skip to content

Commit bc3f6c8

Browse files
xiancaoddsharpe
authored andcommitted
remove the constant VERSION number (#48)
* remove the constant VERSION number * get the imagetool version string from pom.xml
1 parent d3b2589 commit bc3f6c8

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

imagetool/pom.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,12 @@
140140
<argLine>
141141
-Xmx1024m -XX:MaxPermSize=256m
142142
</argLine>
143+
<systemProperties>
144+
<property>
145+
<name>imagetoolversion</name>
146+
<value>${project.version}</value>
147+
</property>
148+
</systemProperties>
143149
</configuration>
144150
<executions>
145151
<execution>

imagetool/src/test/java/com/oracle/weblogic/imagetool/integration/BaseTest.java

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
public class BaseTest {
1616

1717
protected static final Logger logger = Logger.getLogger(ITImagetool.class.getName());
18-
protected static final String VERSION = "1.0.1";
1918
protected static final String PS = File.pathSeparator;
2019
protected static final String FS = File.separator;
2120
private static final String OCIR_SERVER = "phx.ocir.io";
@@ -33,6 +32,8 @@ public class BaseTest {
3332
private static String imagetoolZipfile = "";
3433
private static int maxIterations = 50;
3534
private static int waitTime = 5;
35+
private static String IMAGETOOLZIPFILE_PREFIX = "imagetool-";
36+
private static String IMAGETOOLZIPFILE_SUFFIX = ".zip";
3637

3738
protected static void initialize() throws Exception {
3839
logger.info("Initializing the tests ...");
@@ -50,7 +51,7 @@ protected static void initialize() throws Exception {
5051
wlsImgCacheDir = System.getenv("HOME") + FS + "cache";
5152
}
5253

53-
imagetoolZipfile = "imagetool-" + VERSION + "-SNAPSHOT.zip";
54+
imagetoolZipfile = getImagetoolZipfile();
5455

5556
imagetool = "java -cp \"" + getImagetoolHome() + FS + "lib" + FS + "*\" -Djava.util.logging.config.file=" +
5657
getImagetoolHome() + FS + "bin" + FS + "logging.properties com.oracle.weblogic.imagetool.cli.CLIDriver";
@@ -153,8 +154,10 @@ protected static String getTargetDir() {
153154
return getProjectRoot() + FS + "target";
154155
}
155156

156-
protected static String getImagetoolHome() {
157-
return getProjectRoot() + FS + "imagetool-" + VERSION + "-SNAPSHOT";
157+
protected static String getImagetoolHome() throws Exception {
158+
int endIndex = getImagetoolZipfile().length() - IMAGETOOLZIPFILE_SUFFIX.length();
159+
String imagetooldir = getImagetoolZipfile().substring(0, endIndex);
160+
return getProjectRoot() + FS + imagetooldir;
158161
}
159162

160163
protected static String getInstallerCacheDir() {
@@ -316,4 +319,9 @@ private static void checkCmdInLoop(String cmd, String matchStr)
316319
}
317320
}
318321
}
322+
323+
private static String getImagetoolZipfile() throws Exception {
324+
String version = System.getProperty("imagetoolversion");
325+
return IMAGETOOLZIPFILE_PREFIX + version + IMAGETOOLZIPFILE_SUFFIX;
326+
}
319327
}

0 commit comments

Comments
 (0)