16
16
@ FixMethodOrder (MethodSorters .NAME_ASCENDING )
17
17
public class ITImagetool extends BaseTest {
18
18
19
- private static final String JDK_INSTALLER = "jdk-8u212 -linux-x64.tar.gz" ;
19
+ private static final String JDK_INSTALLER = "jdk-8u202 -linux-x64.tar.gz" ;
20
20
private static final String WLS_INSTALLER = "fmw_12.2.1.3.0_wls_Disk1_1of1.zip" ;
21
21
private static final String P27342434_INSTALLER = "p27342434_122130_Generic.zip" ;
22
22
private static final String P28186730_INSTALLER = "p28186730_139400_Generic.zip" ;
23
+ private static final String WDT_INSTALLER = "weblogic-deploy.zip" ;
23
24
private static final String TEST_ENTRY_KEY = "mytestEntryKey" ;
24
25
private static final String P27342434_ID = "27342434" ;
25
26
private static final String P28186730_ID = "28186730" ;
26
27
private static final String WLS_VERSION = "12.2.1.3.0" ;
27
- private static final String JDK_VERSION = "8u212" ;
28
+ private static final String OPATCH_VERSION = "13.9.4.0.0" ;
29
+ private static final String JDK_VERSION = "8u202" ;
30
+ private static final String WDT_VERSION = "1.1.1" ;
31
+ private static final String WDT_ARCHIVE = "archive.zip" ;
32
+ private static final String WDT_VARIABLES = "domain.properties" ;
33
+ private static final String WDT_MODEL = "simple-topology.yaml" ;
28
34
29
35
@ BeforeClass
30
36
public static void staticPrepare () throws Exception {
31
37
logger .info ("prepare for image tool test ..." );
38
+
32
39
initialize ();
40
+ // clean up the env first
41
+ cleanup ();
42
+
33
43
setup ();
34
44
// pull base OS docker image used for test
35
45
pullDockerImage ();
@@ -38,6 +48,7 @@ public static void staticPrepare() throws Exception {
38
48
@ AfterClass
39
49
public static void staticUnprepare () throws Exception {
40
50
logger .info ("cleaning up after the test ..." );
51
+ cleanup ();
41
52
}
42
53
43
54
@ Test
@@ -94,11 +105,7 @@ public void test4CreateWLSImg() throws Exception {
94
105
ExecCommand .exec (command , true );
95
106
96
107
// verify the docker image is created
97
- ExecResult result = ExecCommand .exec ("docker images | grep imagetool | grep " + testMethodName +
98
- "| wc -l" );
99
- if (Integer .parseInt (result .stdout ()) != 1 ) {
100
- throw new Exception ("wls docker image is not created as expected" );
101
- }
108
+ verifyDockerImages (testMethodName );
102
109
103
110
logTestEnd (testMethodName );
104
111
}
@@ -109,7 +116,8 @@ public void test5CacheAddPatch() throws Exception {
109
116
logTestBegin (testMethodName );
110
117
111
118
String patchPath = getProjectRoot () + FS + ".." + FS + "caches" + FS + P27342434_INSTALLER ;
112
- addPatchToCache ("wls" , "p" + P27342434_ID , WLS_VERSION , patchPath );
119
+ deleteEntryFromCache (P27342434_ID + "_" + WLS_VERSION );
120
+ addPatchToCache ("wls" , P27342434_ID , WLS_VERSION , patchPath );
113
121
114
122
// verify the result
115
123
ExecResult result = listItemsInCache ();
@@ -158,20 +166,16 @@ public void test8CreateWLSImgUseCache() throws Exception {
158
166
159
167
// need to add the required patches 28186730 for Opatch before create wls images
160
168
String patchPath = getProjectRoot () + FS + ".." + FS + "caches" + FS + P28186730_INSTALLER ;
161
- addPatchToCache ("wls" , "p" + P28186730_ID , WLS_VERSION , patchPath );
169
+ addPatchToCache ("wls" , P28186730_ID , OPATCH_VERSION , patchPath );
162
170
163
171
String command = imagetool + " create --jdkVersion " + JDK_VERSION + " --fromImage " +
164
172
BASE_OS_IMG + ":" + BASE_OS_IMG_TAG + " --tag imagetool:" + testMethodName +
165
- " --version " + WLS_VERSION + " --useCache always" ;
173
+ " --version " + WLS_VERSION ;
166
174
logger .info ("Executing command: " + command );
167
175
ExecCommand .exec (command , true );
168
176
169
177
// verify the docker image is created
170
- ExecResult result = ExecCommand .exec ("docker images | grep imagetool | grep " + testMethodName +
171
- "| wc -l" );
172
- if (Integer .parseInt (result .stdout ()) != 1 ) {
173
- throw new Exception ("wls docker image is not created as expected" );
174
- }
178
+ verifyDockerImages (testMethodName );
175
179
176
180
logTestEnd (testMethodName );
177
181
}
@@ -182,16 +186,60 @@ public void test9UpdateWLSImg() throws Exception {
182
186
logTestBegin (testMethodName );
183
187
184
188
String command = imagetool + " update --fromImage imagetool:test8CreateWLSImgUseCache --tag imagetool:" +
185
- testMethodName + " --patches " + P27342434_ID + " --useCache always" ;
189
+ testMethodName + " --patches " + P27342434_ID ;
186
190
logger .info ("Executing command: " + command );
187
191
ExecCommand .exec (command , true );
188
192
189
193
// verify the docker image is created
190
- ExecResult result = ExecCommand .exec ("docker images | grep imagetool | grep " + testMethodName +
191
- "| wc -l" );
192
- if (Integer .parseInt (result .stdout ()) != 1 ) {
193
- throw new Exception ("wls docker image is not created as expected" );
194
- }
194
+ verifyDockerImages (testMethodName );
195
+
196
+ logTestEnd (testMethodName );
197
+ }
198
+
199
+ @ Test
200
+ public void testACreateWLSImgUsingWDT () throws Exception {
201
+
202
+ String testMethodName = new Object () {}.getClass ().getEnclosingMethod ().getName ();
203
+ logTestBegin (testMethodName );
204
+
205
+ // add WDT installer to the cache
206
+ String wdtPath = getProjectRoot () + FS + ".." + FS + "caches" + FS + WDT_INSTALLER ;
207
+ addInstallerToCache ("wdt" , WDT_VERSION , wdtPath );
208
+
209
+ // add WLS installer to the cache
210
+ String wlsPath = getProjectRoot () + FS + ".." + FS + "caches" + FS + WLS_INSTALLER ;
211
+ addInstallerToCache ("wls" , WLS_VERSION , wlsPath );
212
+
213
+ // add jdk installer to the cache
214
+ String jdkPath = getProjectRoot () + FS + ".." + FS + "caches" + FS + JDK_INSTALLER ;
215
+ addInstallerToCache ("jdk" , JDK_VERSION , jdkPath );
216
+
217
+ // need to add the required patches 28186730 for Opatch before create wls images
218
+ // delete the cache entry first
219
+ deleteEntryFromCache (P28186730_ID + "_opatch" );
220
+ String patchPath = getProjectRoot () + FS + ".." + FS + "caches" + FS + P28186730_INSTALLER ;
221
+ addPatchToCache ("wls" , P28186730_ID , OPATCH_VERSION , patchPath );
222
+
223
+ // add the patch to the cache
224
+ deleteEntryFromCache (P27342434_ID + "_" + WLS_VERSION );
225
+ patchPath = getProjectRoot () + FS + ".." + FS + "caches" + FS + P27342434_INSTALLER ;
226
+ addPatchToCache ("wls" , P27342434_ID , WLS_VERSION , patchPath );
227
+
228
+ String wdtResourcePath = getProjectRoot () + FS + "src" + FS + "test" + FS + "resources" + FS + "wdt" + FS ;
229
+ String wdtArchive = wdtResourcePath + WDT_ARCHIVE ;
230
+ String wdtModel = wdtResourcePath + WDT_MODEL ;
231
+ String wdtVariables = wdtResourcePath + WDT_VARIABLES ;
232
+ String command = imagetool + " create --fromImage " +
233
+ BASE_OS_IMG + ":" + BASE_OS_IMG_TAG + " --tag imagetool:" + testMethodName +
234
+ " --version " + WLS_VERSION + " --patches " + P27342434_ID + " --wdtVersion " + WDT_VERSION +
235
+ " --wdtArchive " + wdtArchive + " --wdtDomainHome /u01/domains/simple_domain --wdtModel " +
236
+ wdtModel + " --wdtVariables " + wdtVariables ;
237
+
238
+ logger .info ("Executing command: " + command );
239
+ ExecCommand .exec (command , true );
240
+
241
+ // verify the docker image is created
242
+ verifyDockerImages (testMethodName );
195
243
196
244
logTestEnd (testMethodName );
197
245
}
0 commit comments