Skip to content

Commit 6c15736

Browse files
committed
add comments and more tests
1 parent 6533946 commit 6c15736

File tree

2 files changed

+88
-4
lines changed

2 files changed

+88
-4
lines changed

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,11 @@
66

77
import com.oracle.weblogic.imagetool.integration.utils.ExecCommand;
88
import com.oracle.weblogic.imagetool.integration.utils.ExecResult;
9-
109
import java.io.File;
1110
import java.util.logging.Logger;
1211

1312
public class BaseTest {
1413

15-
1614
protected static final Logger logger = Logger.getLogger(ITImagetool.class.getName());
1715
protected static final String VERSION = "1.0.1";
1816
protected static final String PS = File.pathSeparator;
@@ -21,14 +19,12 @@ public class BaseTest {
2119
private static final String OCIR_TENENT = "weblogick8s";
2220
protected static final String BASE_OS_IMG = "phx.ocir.io/weblogick8s/oraclelinux";
2321
protected static final String BASE_OS_IMG_TAG = "7-4imagetooltest";
24-
2522
private static String projectRoot = "";
2623
protected static String wlsImgBldDir = "";
2724
protected static String wlsImgCacheDir = "";
2825
protected static String imagetool = "";
2926
private static String imagetoolZipfile = "";
3027

31-
3228
protected static void initialize() throws Exception {
3329
logger.info("Initializing the tests ...");
3430

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

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,23 @@
1717
public class ITImagetool extends BaseTest {
1818

1919
private static final String JDK_INSTALLER = "jdk-8u202-linux-x64.tar.gz";
20+
private static final String JDK_INSTALLER_8u212 = "jdk-8u212-linux-x64.tar.gz";
2021
private static final String WLS_INSTALLER = "fmw_12.2.1.3.0_wls_Disk1_1of1.zip";
2122
private static final String P27342434_INSTALLER = "p27342434_122130_Generic.zip";
2223
private static final String P28186730_INSTALLER = "p28186730_139400_Generic.zip";
24+
private static final String P22987840_INSTALLER = "p22987840_122100_Generic.zip";
2325
private static final String WDT_INSTALLER = "weblogic-deploy.zip";
2426
private static final String FMW_INSTALLER = "fmw_12.2.1.3.0_infrastructure_Disk1_1of1.zip";
27+
private static final String FMW_INSTALLER_1221 = "fmw_12.2.1.0.0_infrastructure_Disk1_1of1.zip";
2528
private static final String TEST_ENTRY_KEY = "mytestEntryKey";
2629
private static final String P27342434_ID = "27342434";
2730
private static final String P28186730_ID = "28186730";
31+
private static final String P22987840_ID = "22987840";
2832
private static final String WLS_VERSION = "12.2.1.3.0";
33+
private static final String WLS_VERSION_1221 = "12.2.1.0.0";
2934
private static final String OPATCH_VERSION = "13.9.4.0.0";
3035
private static final String JDK_VERSION = "8u202";
36+
private static final String JDK_VERSION_8u212 = "8u212";
3137
private static final String WDT_VERSION = "1.1.1";
3238
private static final String WDT_ARCHIVE = "archive.zip";
3339
private static final String WDT_VARIABLES = "domain.properties";
@@ -56,6 +62,10 @@ public static void staticUnprepare() throws Exception {
5662
cleanup();
5763
}
5864

65+
/**
66+
* test cache listItems
67+
* @throws Exception - if any error occurs
68+
*/
5969
@Test
6070
public void test1CacheListItems() throws Exception {
6171
String testMethodName = new Object() {}.getClass().getEnclosingMethod().getName();
@@ -70,6 +80,10 @@ public void test1CacheListItems() throws Exception {
7080
logTestEnd(testMethodName);
7181
}
7282

83+
/**
84+
* add JDK installer to the cache
85+
* @throws Exception - if any error occurs
86+
*/
7387
@Test
7488
public void test2CacheAddInstallerJDK() throws Exception {
7589
String testMethodName = new Object() {}.getClass().getEnclosingMethod().getName();
@@ -85,6 +99,10 @@ public void test2CacheAddInstallerJDK() throws Exception {
8599
logTestEnd(testMethodName);
86100
}
87101

102+
/**
103+
* add WLS installer to the cache
104+
* @throws Exception - if any error occurs
105+
*/
88106
@Test
89107
public void test3CacheAddInstallerWLS() throws Exception {
90108
String testMethodName = new Object() {}.getClass().getEnclosingMethod().getName();
@@ -100,6 +118,10 @@ public void test3CacheAddInstallerWLS() throws Exception {
100118
logTestEnd(testMethodName);
101119
}
102120

121+
/**
122+
* create a WLS image with default WLS version
123+
* @throws Exception
124+
*/
103125
@Test
104126
public void test4CreateWLSImg() throws Exception {
105127
String testMethodName = new Object() {}.getClass().getEnclosingMethod().getName();
@@ -115,6 +137,10 @@ public void test4CreateWLSImg() throws Exception {
115137
logTestEnd(testMethodName);
116138
}
117139

140+
/**
141+
* add Patch to the cache
142+
* @throws Exception - if any error occurs
143+
*/
118144
@Test
119145
public void test5CacheAddPatch() throws Exception {
120146
String testMethodName = new Object() {}.getClass().getEnclosingMethod().getName();
@@ -132,6 +158,10 @@ public void test5CacheAddPatch() throws Exception {
132158
logTestEnd(testMethodName);
133159
}
134160

161+
/**
162+
* add an entry to the cache
163+
* @throws Exception - if any error occurs
164+
*/
135165
@Test
136166
public void test6CacheAddEntry() throws Exception {
137167
String testMethodName = new Object() {}.getClass().getEnclosingMethod().getName();
@@ -148,6 +178,10 @@ public void test6CacheAddEntry() throws Exception {
148178
logTestEnd(testMethodName);
149179
}
150180

181+
/**
182+
* test delete an entry from the cache
183+
* @throws Exception - if any error occurs
184+
*/
151185
@Test
152186
public void test7CacheDeleteEntry() throws Exception {
153187
String testMethodName = new Object() {}.getClass().getEnclosingMethod().getName();
@@ -164,6 +198,11 @@ public void test7CacheDeleteEntry() throws Exception {
164198
logTestEnd(testMethodName);
165199
}
166200

201+
/**
202+
* create a WLS image without internet connection
203+
* you need to have OCIR credentials to download the base OS docker image
204+
* @throws Exception - if any error occurs
205+
*/
167206
@Test
168207
public void test8CreateWLSImgUseCache() throws Exception {
169208
String testMethodName = new Object() {}.getClass().getEnclosingMethod().getName();
@@ -185,6 +224,10 @@ public void test8CreateWLSImgUseCache() throws Exception {
185224
logTestEnd(testMethodName);
186225
}
187226

227+
/**
228+
* update a WLS image with a patch
229+
* @throws Exception - if any error occurs
230+
*/
188231
@Test
189232
public void test9UpdateWLSImg() throws Exception {
190233
String testMethodName = new Object() {}.getClass().getEnclosingMethod().getName();
@@ -201,6 +244,10 @@ public void test9UpdateWLSImg() throws Exception {
201244
logTestEnd(testMethodName);
202245
}
203246

247+
/**
248+
* create a WLS image using Weblogic Deploying Tool
249+
* @throws Exception - if any error occurs
250+
*/
204251
@Test
205252
public void testACreateWLSImgUsingWDT() throws Exception {
206253

@@ -251,6 +298,11 @@ public void testACreateWLSImgUsingWDT() throws Exception {
251298
logTestEnd(testMethodName);
252299
}
253300

301+
/**
302+
* create a FMW image with full internet access
303+
* You need to provide Oracle Support credentials to download the patches
304+
* @throws Exception - if any error occurs
305+
*/
254306
@Test
255307
public void testBCreateFMWImgFullInternetAccess() throws Exception {
256308
String testMethodName = new Object() {}.getClass().getEnclosingMethod().getName();
@@ -287,4 +339,40 @@ public void testBCreateFMWImgFullInternetAccess() throws Exception {
287339
verifyDockerImages(testMethodName);
288340
logTestEnd(testMethodName);
289341
}
342+
343+
/**
344+
* create a FMW image with non default JDK, FMW versions
345+
* You need to download the jdk, fmw and patch installers from Oracle first
346+
* @throws Exception - if any error occurs
347+
*/
348+
@Test
349+
public void testCCreateFMWImgNonDefault() throws Exception {
350+
String testMethodName = new Object() {}.getClass().getEnclosingMethod().getName();
351+
logTestBegin(testMethodName);
352+
353+
// download the installers with non default version
354+
downloadInstallers(JDK_INSTALLER_8u212, FMW_INSTALLER_1221, P22987840_INSTALLER);
355+
356+
// add fmw installer to the cache
357+
String fmwPath = getInstallerCacheDir() + FS + FMW_INSTALLER_1221;
358+
addInstallerToCache("fmw", WLS_VERSION_1221, fmwPath);
359+
360+
// add jdk installer to the cache
361+
String jdkPath = getInstallerCacheDir() + FS + JDK_INSTALLER_8u212;
362+
addInstallerToCache("jdk", JDK_VERSION_8u212, jdkPath);
363+
364+
// add the patch to the cache
365+
String patchPath = getInstallerCacheDir() + FS + P22987840_INSTALLER;
366+
addPatchToCache("fmw", P22987840_ID, WLS_VERSION_1221, patchPath);
367+
368+
String command = imagetool + " create --jdkVersion " + JDK_VERSION_8u212 + " --version=" + WLS_VERSION_1221 +
369+
" --tag imagetool:" + testMethodName + " --patches " + P22987840_ID + " --type fmw";
370+
logger.info("Executing command: " + command);
371+
ExecCommand.exec(command, true);
372+
373+
// verify the docker image is created
374+
verifyDockerImages(testMethodName);
375+
376+
logTestEnd(testMethodName);
377+
}
290378
}

0 commit comments

Comments
 (0)