|
78 | 78 | import static oracle.weblogic.kubernetes.utils.CommonTestUtils.getNextFreePort;
|
79 | 79 | import static oracle.weblogic.kubernetes.utils.CommonTestUtils.testUntil;
|
80 | 80 | import static oracle.weblogic.kubernetes.utils.DomainUtils.createDomainAndVerify;
|
81 |
| -import static oracle.weblogic.kubernetes.utils.FileUtils.checkDirectory; |
82 | 81 | import static oracle.weblogic.kubernetes.utils.FileUtils.checkFile;
|
83 | 82 | import static oracle.weblogic.kubernetes.utils.FileUtils.replaceStringInFile;
|
84 | 83 | import static oracle.weblogic.kubernetes.utils.ImageUtils.createMiiImageAndVerify;
|
@@ -111,48 +110,44 @@ public class MonitoringUtils {
|
111 | 110 | */
|
112 | 111 | public static void downloadMonitoringExporterApp(String configFile, String applicationDir) {
|
113 | 112 | //version of wls-exporter.war published in https://github.com/oracle/weblogic-monitoring-exporter/releases/
|
114 |
| - String monitoringExporterWebAppVersion = MONITORING_EXPORTER_WEBAPP_VERSION; |
115 |
| - |
116 |
| - String monitoringExporterBuildFile = String.format( |
117 |
| - "%s/get%s.sh", applicationDir, monitoringExporterWebAppVersion); |
118 |
| - checkDirectory(applicationDir); |
119 |
| - logger.info("Download a monitoring exporter build file {0} ", monitoringExporterBuildFile); |
120 |
| - String monitoringExporterRelease = |
121 |
| - monitoringExporterWebAppVersion.equals("2.0") ? "2.0.0" : monitoringExporterWebAppVersion; |
| 113 | + String monitoringExporterRelease = MONITORING_EXPORTER_WEBAPP_VERSION; |
| 114 | + String monitoringExporterWebAppScriptVersion = monitoringExporterRelease.substring(0, |
| 115 | + monitoringExporterRelease.length() - 2); |
122 | 116 | String curlDownloadCmd = String.format("cd %s && "
|
123 |
| - + "curl -O -L -k https://github.com/oracle/weblogic-monitoring-exporter/releases/download/v%s/get%s.sh", |
124 |
| - applicationDir, |
125 |
| - monitoringExporterRelease, |
126 |
| - monitoringExporterWebAppVersion); |
| 117 | + + "curl -O -L -k https://github.com/oracle/weblogic-monitoring-exporter/releases/download/v%s/get%s.sh", |
| 118 | + applicationDir, |
| 119 | + monitoringExporterRelease, |
| 120 | + monitoringExporterWebAppScriptVersion); |
| 121 | + String monitoringExporterBuildFile = String.format( |
| 122 | + "%s/get%s.sh", applicationDir, monitoringExporterWebAppScriptVersion); |
127 | 123 | logger.info("execute command a monitoring exporter curl command {0} ", curlDownloadCmd);
|
128 | 124 | assertTrue(Command
|
129 |
| - .withParams(new CommandParams() |
130 |
| - .command(curlDownloadCmd)) |
131 |
| - .execute(), "Failed to download monitoring exporter webapp"); |
| 125 | + .withParams(new CommandParams() |
| 126 | + .command(curlDownloadCmd)) |
| 127 | + .execute(), "Failed to download monitoring exporter webapp"); |
132 | 128 | String command = String.format("chmod 777 %s ", monitoringExporterBuildFile);
|
133 | 129 | assertTrue(Command
|
134 |
| - .withParams(new CommandParams() |
135 |
| - .command(command)) |
136 |
| - .execute(), "Failed to download monitoring exporter webapp"); |
| 130 | + .withParams(new CommandParams() |
| 131 | + .command(command)) |
| 132 | + .execute(), "Failed to download monitoring exporter webapp"); |
137 | 133 |
|
138 | 134 | String command1 = String.format("cd %s && %s %s",
|
139 |
| - applicationDir, |
140 |
| - monitoringExporterBuildFile, |
141 |
| - configFile); |
142 |
| - |
| 135 | + applicationDir, |
| 136 | + monitoringExporterBuildFile, |
| 137 | + configFile); |
143 | 138 | testUntil(
|
144 |
| - (() -> Command |
145 |
| - .withParams( |
146 |
| - new CommandParams() |
147 |
| - .verbose(true) |
148 |
| - .command(command1)) |
149 |
| - .executeAndVerify("adding: config.yml") |
150 |
| - ), |
151 |
| - logger, |
152 |
| - "Downloading monitoring exporter webapp"); |
| 139 | + (() -> Command |
| 140 | + .withParams( |
| 141 | + new CommandParams() |
| 142 | + .verbose(true) |
| 143 | + .command(command1)) |
| 144 | + .executeAndVerify("adding: config.yml") |
| 145 | + ), |
| 146 | + logger, |
| 147 | + "Downloading monitoring exporter webapp"); |
153 | 148 |
|
154 | 149 | assertDoesNotThrow(() -> checkFile(applicationDir + "/wls-exporter.war"),
|
155 |
| - "Monitoring Exporter web application file was not found"); |
| 150 | + "Monitoring Exporter web application file was not found"); |
156 | 151 | }
|
157 | 152 |
|
158 | 153 | /**
|
|
0 commit comments