44
55package oracle .kubernetes .operator ;
66
7- import static org .junit .Assert .assertFalse ;
8- import static org .junit .Assert .assertNotNull ;
9- import static org .junit .Assert .assertTrue ;
10-
11- import com .gargoylesoftware .htmlunit .FailingHttpStatusCodeException ;
12- import com .gargoylesoftware .htmlunit .WebClient ;
13- import com .gargoylesoftware .htmlunit .html .HtmlFileInput ;
14- import com .gargoylesoftware .htmlunit .html .HtmlForm ;
15- import com .gargoylesoftware .htmlunit .html .HtmlPage ;
16- import com .gargoylesoftware .htmlunit .html .HtmlRadioButtonInput ;
17- import com .gargoylesoftware .htmlunit .html .HtmlSubmitInput ;
187import java .io .File ;
198import java .io .IOException ;
209import java .nio .charset .Charset ;
2615import java .util .Map ;
2716import java .util .logging .Level ;
2817import javax .xml .bind .DatatypeConverter ;
18+
19+ import com .gargoylesoftware .htmlunit .FailingHttpStatusCodeException ;
20+ import com .gargoylesoftware .htmlunit .WebClient ;
21+ import com .gargoylesoftware .htmlunit .html .HtmlFileInput ;
22+ import com .gargoylesoftware .htmlunit .html .HtmlForm ;
23+ import com .gargoylesoftware .htmlunit .html .HtmlPage ;
24+ import com .gargoylesoftware .htmlunit .html .HtmlRadioButtonInput ;
25+ import com .gargoylesoftware .htmlunit .html .HtmlSubmitInput ;
2926import oracle .kubernetes .operator .utils .Domain ;
3027import oracle .kubernetes .operator .utils .ExecCommand ;
3128import oracle .kubernetes .operator .utils .ExecResult ;
3936import org .junit .Test ;
4037import org .junit .runners .MethodSorters ;
4138
39+ import static org .junit .Assert .assertFalse ;
40+ import static org .junit .Assert .assertNotNull ;
41+ import static org .junit .Assert .assertTrue ;
42+
4243/** This test is used for testing Monitoring Exporter with Operator(s) . */
4344@ FixMethodOrder (MethodSorters .NAME_ASCENDING )
4445public class ItMonitoringExporter extends BaseTest {
@@ -797,7 +798,7 @@ public void test18_ChangeConfigEmptyPass() throws Exception {
797798 }
798799
799800 /**
800- * Test End to End example from MonitoringExporter github project
801+ * Test End to End example from MonitoringExporter github project.
801802 *
802803 * @throws Exception if test fails
803804 */
@@ -814,12 +815,12 @@ public void test19_EndToEndViaChart() throws Exception {
814815 }
815816 gitCloneMonitoringExporter ();
816817 try {
817- setupPVMYSQL ();
818+ setupPvMysql ();
818819 } catch (Exception ex ) {
819820 deletePvDir ();
820821 throw new RuntimeException ("FAILURE: failed to install database " );
821822 }
822- createWLSImageAndDeploy ();
823+ createWlsImageAndDeploy ();
823824 installWebHookAndAlertManager ();
824825 installPrometheusGrafanaViaChart ();
825826 fireAlert ();
@@ -860,7 +861,7 @@ private void fireAlert() throws Exception {
860861 String command = "kubectl -n webhook logs " + webhookPod ;
861862 ExecResult webhookResult = TestUtils .exec (command );
862863 logger .info (" webhook log " + webhookResult .stdout ());
863- assertTrue ( webhookResult .stdout ().contains ("Some WLS cluster has only one running server for more than 1 minutes" ));
864+ assertTrue (webhookResult .stdout ().contains ("Some WLS cluster has only one running server for more than 1 minutes" ));
864865 }
865866
866867 private static String getPodName (String app , String namespace ) throws Exception {
@@ -954,11 +955,11 @@ private HtmlPage submitConfigureForm(
954955
955956 /**
956957 * Remove monitoring exporter directory if exists and clone latest from github for monitoring
957- * exporter code
958+ * exporter code.
958959 *
959960 * @throws Exception if could not run the command successfully to install database
960961 */
961- private static void setupPVMYSQL () throws Exception {
962+ private static void setupPvMysql () throws Exception {
962963 String pvDir = monitoringExporterEndToEndDir + "pvDir" ;
963964 if (new File (pvDir ).exists ()) {
964965 logger .info (" PV dir already exists , cleaning " );
@@ -1044,11 +1045,11 @@ private static void setupPVMYSQL() throws Exception {
10441045 }
10451046
10461047 /**
1047- * Install wls image tool and update wls pods
1048+ * Install wls image tool and update wls pods.
10481049 *
10491050 * @throws Exception if could not run the command successfully to create WLSImage and deploy
10501051 */
1051- private static void createWLSImageAndDeploy () throws Exception {
1052+ private static void createWlsImageAndDeploy () throws Exception {
10521053 operator1 = TestUtils .createOperator (OPERATOR1_YAML );
10531054
10541055 String command =
@@ -1088,7 +1089,7 @@ private static void createWLSImageAndDeploy() throws Exception {
10881089 }
10891090
10901091 /**
1091- * Install Prometheus and Grafana using helm chart
1092+ * Install Prometheus and Grafana using helm chart.
10921093 *
10931094 * @throws Exception if could not run the command successfully to install Prometheus and Grafana
10941095 */
@@ -1114,7 +1115,8 @@ private static void installPrometheusGrafanaViaChart() throws Exception {
11141115 crdCmd = "kubectl apply -f " + monitoringExporterEndToEndDir + "/grafana/persistence.yaml" ;
11151116 TestUtils .exec (crdCmd );
11161117 crdCmd =
1117- "kubectl --namespace monitoring create secret generic grafana-secret --from-literal=username=admin --from-literal=password=12345678" ;
1118+ "kubectl --namespace monitoring create secret generic grafana-secret"
1119+ + " --from-literal=username=admin --from-literal=password=12345678" ;
11181120 TestUtils .exec (crdCmd );
11191121 logger .info ("calling helm install for grafana" );
11201122 crdCmd =
@@ -1147,7 +1149,7 @@ private static void installPrometheusGrafanaViaChart() throws Exception {
11471149 }
11481150
11491151 /**
1150- * Install Prometheus and Grafana using helm chart
1152+ * Install Prometheus and Grafana using helm chart.
11511153 *
11521154 * @throws Exception if could not run the command successfully to install webhook and alert manager
11531155 */
@@ -1170,7 +1172,7 @@ private static void installWebHookAndAlertManager() throws Exception {
11701172 }
11711173
11721174 /**
1173- * Uninstall Prometheus and Grafana using helm chart
1175+ * Uninstall Prometheus and Grafana using helm chart.
11741176 *
11751177 * @throws Exception if could not run the command successfully to uninstall deployments
11761178 */
@@ -1207,7 +1209,7 @@ private static void uninstallWebHookPrometheusGrafanaViaChart() throws Exception
12071209 }
12081210
12091211 /**
1210- * Unnstall MYSQL
1212+ * Uninstall MYSQL.
12111213 *
12121214 * @throws Exception if could not run the command successfully to uninstall MySQL
12131215 */
@@ -1226,7 +1228,7 @@ private static void uninstallMySQL() throws Exception {
12261228 }
12271229
12281230 /**
1229- * Delete PvDir via docker
1231+ * Delete PvDir via docker.
12301232 *
12311233 * @throws Exception if could not run the command successfully to delete PV
12321234 */
@@ -1246,7 +1248,7 @@ private static void deletePvDir() throws Exception {
12461248 }
12471249
12481250 /**
1249- * A utility method to sed files
1251+ * A utility method to sed files.
12501252 *
12511253 * @throws IOException when copying files from source location to staging area fails
12521254 */
@@ -1263,7 +1265,7 @@ private static void replaceStringInFile(String filePath, String oldValue, String
12631265
12641266 /**
12651267 * A utility method to copy Cross Namespaces RBAC yaml template file replacing the DOMAIN_NS,
1266- * OPERATOR_NS
1268+ * OPERATOR_NS.
12671269 *
12681270 * @throws IOException when copying files from source location to staging area fails
12691271 */
@@ -1283,7 +1285,7 @@ private static void createCrossNSRBACFile(String domainNS, String operatorNS) th
12831285 }
12841286
12851287 /**
1286- * call operator to scale to specified number of replicas
1288+ * call operator to scale to specified number of replicas.
12871289 *
12881290 * @param replicas - number of managed servers
12891291 * @throws Exception if scaling fails
0 commit comments