@@ -21,6 +21,7 @@ public class ITImagetool extends BaseTest {
2121 private static final String P27342434_INSTALLER = "p27342434_122130_Generic.zip" ;
2222 private static final String P28186730_INSTALLER = "p28186730_139400_Generic.zip" ;
2323 private static final String WDT_INSTALLER = "weblogic-deploy.zip" ;
24+ private static final String FMW_INSTALLER = "fmw_12.2.1.3.0_infrastructure_Disk1_1of1.zip" ;
2425 private static final String TEST_ENTRY_KEY = "mytestEntryKey" ;
2526 private static final String P27342434_ID = "27342434" ;
2627 private static final String P28186730_ID = "28186730" ;
@@ -43,6 +44,9 @@ public static void staticPrepare() throws Exception {
4344 setup ();
4445 // pull base OS docker image used for test
4546 pullDockerImage ();
47+
48+ // download the installers for the test
49+ downloadInstallers (JDK_INSTALLER , WLS_INSTALLER , WDT_INSTALLER , P27342434_INSTALLER , P28186730_INSTALLER );
4650 }
4751
4852 @ AfterClass
@@ -70,7 +74,7 @@ public void test2CacheAddInstallerJDK() throws Exception {
7074 String testMethodName = new Object () {}.getClass ().getEnclosingMethod ().getName ();
7175 logTestBegin (testMethodName );
7276
73- String jdkPath = getProjectRoot () + FS + ".." + FS + "caches" + FS + JDK_INSTALLER ;
77+ String jdkPath = getInstallerCacheDir () + FS + JDK_INSTALLER ;
7478 addInstallerToCache ("jdk" , JDK_VERSION , jdkPath );
7579
7680 ExecResult result = listItemsInCache ();
@@ -85,7 +89,7 @@ public void test3CacheAddInstallerWLS() throws Exception {
8589 String testMethodName = new Object () {}.getClass ().getEnclosingMethod ().getName ();
8690 logTestBegin (testMethodName );
8791
88- String wlsPath = getProjectRoot () + FS + ".." + FS + "caches" + FS + WLS_INSTALLER ;
92+ String wlsPath = getInstallerCacheDir () + FS + WLS_INSTALLER ;
8993 addInstallerToCache ("wls" , WLS_VERSION , wlsPath );
9094
9195 ExecResult result = listItemsInCache ();
@@ -115,7 +119,7 @@ public void test5CacheAddPatch() throws Exception {
115119 String testMethodName = new Object () {}.getClass ().getEnclosingMethod ().getName ();
116120 logTestBegin (testMethodName );
117121
118- String patchPath = getProjectRoot () + FS + ".." + FS + "caches" + FS + P27342434_INSTALLER ;
122+ String patchPath = getInstallerCacheDir () + FS + P27342434_INSTALLER ;
119123 deleteEntryFromCache (P27342434_ID + "_" + WLS_VERSION );
120124 addPatchToCache ("wls" , P27342434_ID , WLS_VERSION , patchPath );
121125
@@ -132,7 +136,7 @@ public void test6CacheAddEntry() throws Exception {
132136 String testMethodName = new Object () {}.getClass ().getEnclosingMethod ().getName ();
133137 logTestBegin (testMethodName );
134138
135- String mytestEntryValue = getProjectRoot () + FS + ".." + FS + "caches" + FS + P27342434_INSTALLER ;
139+ String mytestEntryValue = getInstallerCacheDir () + FS + P27342434_INSTALLER ;
136140 addEntryToCache (TEST_ENTRY_KEY , mytestEntryValue );
137141
138142 // verify the result
@@ -165,7 +169,7 @@ public void test8CreateWLSImgUseCache() throws Exception {
165169 logTestBegin (testMethodName );
166170
167171 // need to add the required patches 28186730 for Opatch before create wls images
168- String patchPath = getProjectRoot () + FS + ".." + FS + "caches" + FS + P28186730_INSTALLER ;
172+ String patchPath = getInstallerCacheDir () + FS + P28186730_INSTALLER ;
169173 addPatchToCache ("wls" , P28186730_ID , OPATCH_VERSION , patchPath );
170174
171175 String command = imagetool + " create --jdkVersion " + JDK_VERSION + " --fromImage " +
@@ -203,32 +207,34 @@ public void testACreateWLSImgUsingWDT() throws Exception {
203207 logTestBegin (testMethodName );
204208
205209 // add WDT installer to the cache
206- String wdtPath = getProjectRoot () + FS + ".." + FS + "caches" + FS + WDT_INSTALLER ;
210+ String wdtPath = getInstallerCacheDir () + FS + WDT_INSTALLER ;
207211 addInstallerToCache ("wdt" , WDT_VERSION , wdtPath );
208212
209213 // add WLS installer to the cache
210- String wlsPath = getProjectRoot () + FS + ".." + FS + "caches" + FS + WLS_INSTALLER ;
214+ String wlsPath = getInstallerCacheDir () + FS + WLS_INSTALLER ;
211215 addInstallerToCache ("wls" , WLS_VERSION , wlsPath );
212216
213217 // add jdk installer to the cache
214- String jdkPath = getProjectRoot () + FS + ".." + FS + "caches" + FS + JDK_INSTALLER ;
218+ String jdkPath = getInstallerCacheDir () + FS + JDK_INSTALLER ;
215219 addInstallerToCache ("jdk" , JDK_VERSION , jdkPath );
216220
217221 // need to add the required patches 28186730 for Opatch before create wls images
218222 // delete the cache entry first
219223 deleteEntryFromCache (P28186730_ID + "_opatch" );
220- String patchPath = getProjectRoot () + FS + ".." + FS + "caches" + FS + P28186730_INSTALLER ;
224+ String patchPath = getInstallerCacheDir () + FS + P28186730_INSTALLER ;
221225 addPatchToCache ("wls" , P28186730_ID , OPATCH_VERSION , patchPath );
222226
223227 // add the patch to the cache
224228 deleteEntryFromCache (P27342434_ID + "_" + WLS_VERSION );
225- patchPath = getProjectRoot () + FS + ".." + FS + "caches" + FS + P27342434_INSTALLER ;
229+ patchPath = getInstallerCacheDir () + FS + P27342434_INSTALLER ;
226230 addPatchToCache ("wls" , P27342434_ID , WLS_VERSION , patchPath );
227231
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+ // build the wdt archive
233+ buildWDTArchive ();
234+
235+ String wdtArchive = getWDTResourcePath () + FS + WDT_ARCHIVE ;
236+ String wdtModel = getWDTResourcePath () + FS + WDT_MODEL ;
237+ String wdtVariables = getWDTResourcePath () + FS + WDT_VARIABLES ;
232238 String command = imagetool + " create --fromImage " +
233239 BASE_OS_IMG + ":" + BASE_OS_IMG_TAG + " --tag imagetool:" + testMethodName +
234240 " --version " + WLS_VERSION + " --patches " + P27342434_ID + " --wdtVersion " + WDT_VERSION +
@@ -243,4 +249,41 @@ public void testACreateWLSImgUsingWDT() throws Exception {
243249
244250 logTestEnd (testMethodName );
245251 }
252+
253+ @ Test
254+ public void testBCreateFMWImgFullInternetAccess () throws Exception {
255+ String testMethodName = new Object () {}.getClass ().getEnclosingMethod ().getName ();
256+ logTestBegin (testMethodName );
257+
258+ String user = System .getenv ("ORACLE_SUPPORT_USERNAME" );
259+ String password = System .getenv ("ORACLE_SUPPORT_PASSWORD" );
260+ if (user == null || password == null ) {
261+ throw new Exception ("Please set environment variables ORACLE_SUPPORT_USERNAME and ORACLE_SUPPORT_PASSWORD" +
262+ " for Oracle Support credentials to download the patches." );
263+ }
264+
265+ String httpProxy = System .getenv ("HTTP_PROXY" );
266+ String httpsProxy = System .getenv ("HTTPS_PROXY" );
267+ if (httpProxy == null || httpsProxy == null ) {
268+ throw new Exception ("Please set environment variable HTTP_PROXY and HTTPS_PROXY" );
269+ }
270+
271+ // add fmw installer to the cache
272+ String fmwPath = getInstallerCacheDir () + FS + FMW_INSTALLER ;
273+ addInstallerToCache ("fmw" , WLS_VERSION , fmwPath );
274+
275+ // add jdk installer to the cache
276+ String jdkPath = getInstallerCacheDir () + FS + JDK_INSTALLER ;
277+ addInstallerToCache ("jdk" , JDK_VERSION , jdkPath );
278+
279+ String command = imagetool + " create --version=" + WLS_VERSION + " --tag imagetool:" + testMethodName +
280+ " --latestPSU --user " + user + " --passwordEnv ORACLE_SUPPORT_PASSWORD --httpProxyUrl " +
281+ httpProxy + " --httpsProxyUrl " + httpsProxy + " --type fmw" ;
282+ logger .info ("Executing command: " + command );
283+ ExecCommand .exec (command , true );
284+
285+ // verify the docker image is created
286+ verifyDockerImages (testMethodName );
287+ logTestEnd (testMethodName );
288+ }
246289}
0 commit comments