new-integration-tests/src/test/java/oracle/weblogic/kubernetes/ItMonitoringExporter.java
@BeforeAll

  public static void initAll(@Namespaces(6) List<String> namespaces) {

    logger = getLogger();
    // create standard, reusable retry/backoff policy
    withStandardRetryPolicy = with().pollDelay(2, SECONDS)
        .and().with().pollInterval(10, SECONDS)
        .atMost(5, MINUTES).await();

    logger.info("Get a unique namespace for operator");
    assertNotNull(namespaces.get(0), "Namespace list is null");
    final String opNamespace = namespaces.get(0);

    logger.info("Get a unique namespace for WebLogic domain1");
    assertNotNull(namespaces.get(1), "Namespace list is null");
    domain1Namespace = namespaces.get(1);

    logger.info("Get a unique namespace for WebLogic domain2");
    assertNotNull(namespaces.get(2), "Namespace list is null");
    domain2Namespace = namespaces.get(2);

    logger.info("Get a unique namespace for monitoring");
    assertNotNull(namespaces.get(3), "Namespace list is null");
    monitoringNS = namespaces.get(3);

    logger.info("Get a unique namespace for webhook");
    assertNotNull(namespaces.get(4), "Namespace list is null");
    webhookNS = namespaces.get(4);

    logger.info("Get a unique namespace for NGINX");
    assertNotNull(namespaces.get(5), "Namespace list is null");
    final String nginxNamespace = namespaces.get(5);


    logger.info("install and verify operator");
    installAndVerifyOperator(opNamespace, domain1Namespace,domain2Namespace);

    logger.info("nstall monitoring exporter");
    installMonitoringExporter();

    logger.info("create and verify WebLogic domain image using model in image with model files");
    miiImage = createAndVerifyMiiImage();

    // create and verify one cluster mii domain
    logger.info("Create domain and verify that it's running");
    createAndVerifyDomain(miiImage, domain1Uid, domain1Namespace, "FromModel", 1);


    // install and verify NGINX
    nginxHelmParams = installAndVerifyNginx(nginxNamespace, 0, 0);
    String nginxServiceName = nginxHelmParams.getReleaseName() + "-nginx-ingress-controller";
    logger.info("NGINX service name: {0}", nginxServiceName);
    nodeportshttp = getServiceNodePort(nginxNamespace, nginxServiceName, "http");
    logger.info("NGINX http node port: {0}", nodeportshttp);

    // create ingress for the domain
    logger.info("Creating ingress for domain {0} in namespace {1}", domain1Uid, domain1Namespace);
    clusterNameMsPortMap = new HashMap<>();
    clusterNameMsPortMap.put(clusterName, managedServerPort);
    ingressHost1List =
        createIngressForDomainAndVerify(domain1Uid, domain1Namespace,clusterNameMsPortMap, false);

    exporterUrl = String.format("http://%s:%s/wls-exporter/",K8S_NODEPORT_HOST,nodeportshttp);

    logger.info("create pv and pvc for monitoring");
    HashMap<String, String> labels = new HashMap<>();
    labels.put("app", "monitoring");
    labels.put("weblogic.domainUid", domain1Uid);
    assertDoesNotThrow(() -> createPvAndPvc("prometheus", monitoringNS, labels));
    assertDoesNotThrow(() -> createPvAndPvc("alertmanager",monitoringNS, labels));
    assertDoesNotThrow(() -> createPvAndPvc("grafana", monitoringNS, labels));

  }
/**
   * Install operator and NGINX. Create model in image domain with multiple clusters.
   * Create ingress for the domain.
   *
   * @param namespaces list of namespaces created by the IntegrationTestWatcher by the
   *                   JUnit engine parameter resolution mechanism
   */
Install operator and NGINX. Create model in image domain with multiple clusters.
Create ingress for the domain.

@param namespaces list of namespaces created by the IntegrationTestWatcher by the
JUnit engine parameter resolution mechanism
Install operator and NGINX . Create model in image domain with multiple clusters . Create ingress for the domain . @param namespaces list of namespaces created by the IntegrationTestWatcher by the JUnit engine parameter resolution mechanism
@BeforeAll
  public static void initAll(@Namespaces(6) List<String> namespaces) {
    logger = getLogger();
    withStandardRetryPolicy = with().pollDelay(2, SECONDS)
        .and().with().pollInterval(10, SECONDS)
        .atMost(5, MINUTES).await();
    logger.info("Get a unique namespace for operator");
    assertNotNull(namespaces.get(0), "Namespace list is null");
    final String opNamespace = namespaces.get(0);
    logger.info("Get a unique namespace for WebLogic domain1");
    assertNotNull(namespaces.get(1), "Namespace list is null");
    domain1Namespace = namespaces.get(1);
    logger.info("Get a unique namespace for WebLogic domain2");
    assertNotNull(namespaces.get(2), "Namespace list is null");
    domain2Namespace = namespaces.get(2);
    logger.info("Get a unique namespace for monitoring");
    assertNotNull(namespaces.get(3), "Namespace list is null");
    monitoringNS = namespaces.get(3);
    logger.info("Get a unique namespace for webhook");
    assertNotNull(namespaces.get(4), "Namespace list is null");
    webhookNS = namespaces.get(4);
    logger.info("Get a unique namespace for NGINX");
    assertNotNull(namespaces.get(5), "Namespace list is null");
    final String nginxNamespace = namespaces.get(5);
    logger.info("install and verify operator");
    installAndVerifyOperator(opNamespace, domain1Namespace,domain2Namespace);
    logger.info("nstall monitoring exporter");
    installMonitoringExporter();
    logger.info("create and verify WebLogic domain image using model in image with model files");
    miiImage = createAndVerifyMiiImage();
    logger.info("Create domain and verify that it's running");
    createAndVerifyDomain(miiImage, domain1Uid, domain1Namespace, "FromModel", 1);
    nginxHelmParams = installAndVerifyNginx(nginxNamespace, 0, 0);
    String nginxServiceName = nginxHelmParams.getReleaseName() + "-nginx-ingress-controller";
    logger.info("NGINX service name: {0}", nginxServiceName);
    nodeportshttp = getServiceNodePort(nginxNamespace, nginxServiceName, "http");
    logger.info("NGINX http node port: {0}", nodeportshttp);
    logger.info("Creating ingress for domain {0} in namespace {1}", domain1Uid, domain1Namespace);
    clusterNameMsPortMap = new HashMap<>();
    clusterNameMsPortMap.put(clusterName, managedServerPort);
    ingressHost1List =
        createIngressForDomainAndVerify(domain1Uid, domain1Namespace,clusterNameMsPortMap, false);
    exporterUrl = String.format("http://%s:%s/wls-exporter/",K8S_NODEPORT_HOST,nodeportshttp);
    logger.info("create pv and pvc for monitoring");
    HashMap<String, String> labels = new HashMap<>();
    labels.put("app", "monitoring");
    labels.put("weblogic.domainUid", domain1Uid);
    assertDoesNotThrow(() -> createPvAndPvc("prometheus", monitoringNS, labels));
    assertDoesNotThrow(() -> createPvAndPvc("alertmanager",monitoringNS, labels));
    assertDoesNotThrow(() -> createPvAndPvc("grafana", monitoringNS, labels));
  }
@ BeforeAll public static void initAll ( @ Namespaces ( 6 ) List < String > namespaces ) { logger = getLogger ( ) ; withStandardRetryPolicy = with ( ) . pollDelay ( 2 , SECONDS ) . and ( ) . with ( ) . pollInterval ( 10 , SECONDS ) . atMost ( 5 , MINUTES ) . await ( ) ; logger . info ( "Get a unique namespace for operator" ) ; assertNotNull ( namespaces . get ( 0 ) , "Namespace list is null" ) ; final String opNamespace = namespaces . get ( 0 ) ; logger . info ( "Get a unique namespace for WebLogic domain1" ) ; assertNotNull ( namespaces . get ( 1 ) , "Namespace list is null" ) ; domain1Namespace = namespaces . get ( 1 ) ; logger . info ( "Get a unique namespace for WebLogic domain2" ) ; assertNotNull ( namespaces . get ( 2 ) , "Namespace list is null" ) ; domain2Namespace = namespaces . get ( 2 ) ; logger . info ( "Get a unique namespace for monitoring" ) ; assertNotNull ( namespaces . get ( 3 ) , "Namespace list is null" ) ; monitoringNS = namespaces . get ( 3 ) ; logger . info ( "Get a unique namespace for webhook" ) ; assertNotNull ( namespaces . get ( 4 ) , "Namespace list is null" ) ; webhookNS = namespaces . get ( 4 ) ; logger . info ( "Get a unique namespace for NGINX" ) ; assertNotNull ( namespaces . get ( 5 ) , "Namespace list is null" ) ; final String nginxNamespace = namespaces . get ( 5 ) ; logger . info ( "install and verify operator" ) ; installAndVerifyOperator ( opNamespace , domain1Namespace , domain2Namespace ) ; logger . info ( "nstall monitoring exporter" ) ; installMonitoringExporter ( ) ; logger . info ( "create and verify WebLogic domain image using model in image with model files" ) ; miiImage = createAndVerifyMiiImage ( ) ; logger . info ( "Create domain and verify that it's running" ) ; createAndVerifyDomain ( miiImage , domain1Uid , domain1Namespace , "FromModel" , 1 ) ; nginxHelmParams = installAndVerifyNginx ( nginxNamespace , 0 , 0 ) ; String nginxServiceName = nginxHelmParams . getReleaseName ( ) + "-nginx-ingress-controller" ; logger . info ( "NGINX service name: {0}" , nginxServiceName ) ; nodeportshttp = getServiceNodePort ( nginxNamespace , nginxServiceName , "http" ) ; logger . info ( "NGINX http node port: {0}" , nodeportshttp ) ; logger . info ( "Creating ingress for domain {0} in namespace {1}" , domain1Uid , domain1Namespace ) ; clusterNameMsPortMap = new HashMap < > ( ) ; clusterNameMsPortMap . put ( clusterName , managedServerPort ) ; ingressHost1List = createIngressForDomainAndVerify ( domain1Uid , domain1Namespace , clusterNameMsPortMap , false ) ; exporterUrl = String . format ( "http://%s:%s/wls-exporter/" , K8S_NODEPORT_HOST , nodeportshttp ) ; logger . info ( "create pv and pvc for monitoring" ) ; HashMap < String , String > labels = new HashMap < > ( ) ; labels . put ( "app" , "monitoring" ) ; labels . put ( "weblogic.domainUid" , domain1Uid ) ; assertDoesNotThrow ( ( ) -> createPvAndPvc ( "prometheus" , monitoringNS , labels ) ) ; assertDoesNotThrow ( ( ) -> createPvAndPvc ( "alertmanager" , monitoringNS , labels ) ) ; assertDoesNotThrow ( ( ) -> createPvAndPvc ( "grafana" , monitoringNS , labels ) ) ; }
Install operator and NGINX.
Install operator and NGINX .
// create standard, reusable retry/backoff policy // create and verify one cluster mii domain // install and verify NGINX // create ingress for the domain