@@ -17,22 +17,20 @@ public class BaseTest {
1717 protected static final Logger logger = Logger .getLogger (ITImagetool .class .getName ());
1818 protected static final String PS = File .pathSeparator ;
1919 protected static final String FS = File .separator ;
20- private static final String OCIR_SERVER = "phx.ocir.io" ;
21- private static final String OCIR_TENENT = "weblogick8s" ;
22- private static final String OCR_SERVER = "container-registry.oracle.com" ;
2320 protected static final String BASE_OS_IMG = "phx.ocir.io/weblogick8s/oraclelinux" ;
2421 protected static final String BASE_OS_IMG_TAG = "7-4imagetooltest" ;
25- protected static final String ORACLE_DB_IMG = "container-registry.oracle.com /database/enterprise" ;
22+ protected static final String ORACLE_DB_IMG = "phx.ocir.io/weblogick8s /database/enterprise" ;
2623 protected static final String ORACLE_DB_IMG_TAG = "12.2.0.1-slim" ;
27- private static final String DB_CONTAINER_NAME = "InfraDB" ;
24+ protected static final String DB_CONTAINER_NAME = "InfraDB" ;
2825 private static String projectRoot = "" ;
2926 protected static String wlsImgBldDir = "" ;
3027 protected static String wlsImgCacheDir = "" ;
3128 protected static String imagetool = "" ;
3229 private static int maxIterations = 50 ;
3330 private static int waitTime = 5 ;
34- private static String IMAGETOOLZIPFILE = "imagetool.zip" ;
35- private static String IMAGETOOLDIR = "imagetool" ;
31+ private static final String IMAGETOOLZIPFILE = "imagetool.zip" ;
32+ private static final String IMAGETOOLDIR = "imagetool" ;
33+ private static final String INSTALLERCACHEDIR = "/scratch/artifacts/imagetool" ;
3634
3735 protected static void initialize () throws Exception {
3836 logger .info ("Initializing the tests ..." );
@@ -61,11 +59,11 @@ protected static void initialize() throws Exception {
6159 protected static void setup () throws Exception {
6260
6361 logger .info ("Setting up the test environment ..." );
64- String command = "/bin/ rm -rf " + getImagetoolHome ();
62+ String command = "rm -rf " + getImagetoolHome ();
6563 executeNoVerify (command );
6664
6765 // unzip the weblogic-image-tool/imagetool/target/imagetool.zip
68- command = "/bin/ unzip " + getTargetDir () + FS + IMAGETOOLZIPFILE ;
66+ command = "unzip " + getTargetDir () + FS + IMAGETOOLZIPFILE ;
6967 executeNoVerify (command );
7068
7169 command = "source " + getImagetoolHome () + FS + "bin" + FS + "setup.sh" ;
@@ -74,10 +72,10 @@ protected static void setup() throws Exception {
7472
7573 protected static void cleanup () throws Exception {
7674 logger .info ("cleaning up the test environment ..." );
77- String command = "/bin/ rm -rf " + wlsImgCacheDir ;
75+ String command = "rm -rf " + wlsImgCacheDir ;
7876 executeNoVerify (command );
7977
80- command = "/bin/ mkdir " + wlsImgCacheDir ;
78+ command = "mkdir " + wlsImgCacheDir ;
8179 executeNoVerify (command );
8280
8381 // clean up the docker images
@@ -88,35 +86,18 @@ protected static void cleanup() throws Exception {
8886 executeNoVerify (command );
8987
9088 // clean up the possible left over wlsimgbuilder_temp*
91- command = "/bin/ rm -rf " + wlsImgBldDir + FS + "wlsimgbuilder_temp*" ;
89+ command = "rm -rf " + wlsImgBldDir + FS + "wlsimgbuilder_temp*" ;
9290 executeNoVerify (command );
9391 }
9492
9593 protected static void pullBaseOSDockerImage () throws Exception {
9694 logger .info ("Pulling OS base images from OCIR ..." );
97- String ocir_username = System .getenv ("OCIR_USERNAME" );
98- String ocir_password = System .getenv ("OCIR_PASSWORD" );
99-
100- if (ocir_username == null || ocir_password == null ) {
101- throw new Exception ("You need to set OCIR_USERNAME and OCIR_PASSWORD environment variable to pull base" +
102- " OS image " + BASE_OS_IMG + ":" + BASE_OS_IMG_TAG );
103- }
104-
105- pullDockerImage (OCIR_SERVER , OCIR_TENENT + "/" + ocir_username , ocir_password , BASE_OS_IMG ,
106- BASE_OS_IMG_TAG );
95+ pullDockerImage (BASE_OS_IMG , BASE_OS_IMG_TAG );
10796 }
10897
10998 protected static void pullOracleDBDockerImage () throws Exception {
110- logger .info ("Pulling Oracle DB image from OCR ..." );
111- String ocr_username = System .getenv ("OCR_USERNAME" );
112- String ocr_password = System .getenv ("OCR_PASSWORD" );
113-
114- if (ocr_username == null || ocr_password == null ) {
115- throw new Exception ("You need to set OCR_USERNAME and OCR_PASSWORD environment variable to pull DB " +
116- "image " + ORACLE_DB_IMG + ":" + ORACLE_DB_IMG_TAG );
117- }
118-
119- pullDockerImage (OCR_SERVER , ocr_username , ocr_password , ORACLE_DB_IMG , ORACLE_DB_IMG_TAG );
99+ logger .info ("Pulling Oracle DB image from OCIR ..." );
100+ pullDockerImage (ORACLE_DB_IMG , ORACLE_DB_IMG_TAG );
120101 }
121102
122103 protected static void downloadInstallers (String ... installers ) throws Exception {
@@ -157,7 +138,7 @@ protected static String getImagetoolHome() throws Exception {
157138 }
158139
159140 protected static String getInstallerCacheDir () {
160- return getProjectRoot () + FS + "caches" ;
141+ return INSTALLERCACHEDIR ;
161142 }
162143
163144 protected static String getWDTResourcePath () {
@@ -265,11 +246,8 @@ private ExecResult executeAndVerify(String command, boolean isRedirectToOut) thr
265246 return result ;
266247 }
267248
268- private static void pullDockerImage (String repoServer , String username , String password ,
269- String imagename , String imagetag ) throws Exception {
249+ private static void pullDockerImage (String imagename , String imagetag ) throws Exception {
270250
271- ExecCommand .exec ("docker login " + repoServer + " -u " + username +
272- " -p " + password );
273251 ExecCommand .exec ("docker pull " + imagename + ":" + imagetag );
274252
275253 // verify the docker image is pulled
0 commit comments