new-integration-tests/src/test/java/oracle/weblogic/kubernetes/ItMiiDomain.java
@ParameterizedTest
  @DisplayName("Create model in image domain using different WebLogic version images as parameters")
  @MethodSource("oracle.weblogic.kubernetes.utils.Params#webLogicImageTags")
  public void testParamsCreateMiiDomain(String imageTag, @Namespaces(1) List<String> namespaces) {
    imageTag = imageTag.trim();
    assertTrue(!imageTag.isEmpty(), "imageTag can not be empty string");
    logger.info("Using imageTag {0}", imageTag);

    logger.info("Getting unique namespace for Domain");
    assertNotNull(namespaces.get(0), "Namespace list is null");
    domainNamespace = namespaces.get(0);

    // upgrade Operator for the new domain namespace
    assertTrue(upgradeAndVerifyOperator(opNamespace, domainNamespace),
        String.format("Failed to upgrade operator in namespace %s", opNamespace));

    // admin/managed server name here should match with model yaml in MII_BASIC_WDT_MODEL_FILE
    final String adminServerPodName = domainUid + "-" + ADMIN_SERVER_NAME_BASE;
    final String managedServerPrefix = domainUid + "-managed-server";
    final int replicaCount = 2;

    // create image with model files
    logger.info("Creating image with model file and verify");
    miiImage = createMiiImageAndVerify(
        "mii-image",
        MII_BASIC_WDT_MODEL_FILE,
        MII_BASIC_APP_NAME,
        WLS_BASE_IMAGE_NAME,
        imageTag,
        WLS);

    // docker login and push image to docker registry if necessary
    dockerLoginAndPushImageToRegistry(miiImage);

    // Create the repo secret to pull the image
    assertDoesNotThrow(() -> createDockerRegistrySecret(domainNamespace),
        String.format("createSecret failed for %s", REPO_SECRET_NAME));

    // create secret for admin credentials
    logger.info("Create secret for admin credentials");
    String adminSecretName = "weblogic-credentials";
    assertDoesNotThrow(() -> createSecretWithUsernamePassword(adminSecretName, domainNamespace, "weblogic",
        "welcome1"),
        String.format("createSecret failed for %s", adminSecretName));

    // create encryption secret
    logger.info("Create encryption secret");
    String encryptionSecretName = "encryptionsecret";
    assertDoesNotThrow(() -> createSecretWithUsernamePassword(encryptionSecretName, domainNamespace, "weblogicenc",
        "weblogicenc"),
        String.format("createSecret failed for %s", encryptionSecretName));

    // create the domain object
    Domain domain = createDomainResource(domainUid, domainNamespace, adminSecretName, REPO_SECRET_NAME,
        encryptionSecretName, replicaCount, miiImage);

    // create model in image domain
    logger.info("Creating model in image domain {0} in namespace {1} using docker image {2}",
        domainUid, domainNamespace, miiImage);
    createDomainAndVerify(domain, domainNamespace);

    // check admin server pod is ready
    logger.info("Wait for admin server pod {0} to be ready in namespace {1}",
        adminServerPodName, domainNamespace);
    checkPodReady(adminServerPodName, domainUid, domainNamespace);

    // check managed server pods are ready
    for (int i = 1; i <= replicaCount; i++) {
      logger.info("Wait for managed server pod {0} to be ready in namespace {1}",
          managedServerPrefix + i, domainNamespace);
      checkPodReady(managedServerPrefix + i, domainUid, domainNamespace);
    }

    logger.info("Check admin service {0} is created in namespace {1}",
        adminServerPodName, domainNamespace);
    checkServiceExists(adminServerPodName, domainNamespace);

    // check managed server services created
    for (int i = 1; i <= replicaCount; i++) {
      logger.info("Check managed server service {0} is created in namespace {1}",
          managedServerPrefix + i, domainNamespace);
      checkServiceExists(managedServerPrefix + i, domainNamespace);
    }

    // check and wait for the application to be accessible in all server pods
    for (int i = 1; i <= replicaCount; i++) {
      checkAppRunning(
          domainNamespace,
          managedServerPrefix + i,
          "8001",
          "sample-war/index.jsp",
          MII_APP_RESPONSE_V1 + i);
    }

    logger.info("Domain {0} is fully started - servers are running and application is available",
        domainUid);

  }
/**
   * Parameterized test to create model in image domain using different WebLogic version images
   * as parameters.
   *
   * @param imageTag WebLogic image tag
   * @param namespaces domain namespace
   */
Parameterized test to create model in image domain using different WebLogic version images
as parameters.

@param imageTag WebLogic image tag
@param namespaces domain namespace
Parameterized test to create model in image domain using different WebLogic version images as parameters . @param imageTag WebLogic image tag @param namespaces domain namespace
@ParameterizedTest
  @DisplayName("Create model in image domain using different WebLogic version images as parameters")
  @MethodSource("oracle.weblogic.kubernetes.utils.Params#webLogicImageTags")
  public void testParamsCreateMiiDomain(String imageTag, @Namespaces(1) List<String> namespaces) {
    imageTag = imageTag.trim();
    assertTrue(!imageTag.isEmpty(), "imageTag can not be empty string");
    logger.info("Using imageTag {0}", imageTag);
    logger.info("Getting unique namespace for Domain");
    assertNotNull(namespaces.get(0), "Namespace list is null");
    domainNamespace = namespaces.get(0);
    assertTrue(upgradeAndVerifyOperator(opNamespace, domainNamespace),
        String.format("Failed to upgrade operator in namespace %s", opNamespace));
    final String adminServerPodName = domainUid + "-" + ADMIN_SERVER_NAME_BASE;
    final String managedServerPrefix = domainUid + "-managed-server";
    final int replicaCount = 2;
    logger.info("Creating image with model file and verify");
    miiImage = createMiiImageAndVerify(
        "mii-image",
        MII_BASIC_WDT_MODEL_FILE,
        MII_BASIC_APP_NAME,
        WLS_BASE_IMAGE_NAME,
        imageTag,
        WLS);
    dockerLoginAndPushImageToRegistry(miiImage);
    assertDoesNotThrow(() -> createDockerRegistrySecret(domainNamespace),
        String.format("createSecret failed for %s", REPO_SECRET_NAME));
    logger.info("Create secret for admin credentials");
    String adminSecretName = "weblogic-credentials";
    assertDoesNotThrow(() -> createSecretWithUsernamePassword(adminSecretName, domainNamespace, "weblogic",
        "welcome1"),
        String.format("createSecret failed for %s", adminSecretName));
    logger.info("Create encryption secret");
    String encryptionSecretName = "encryptionsecret";
    assertDoesNotThrow(() -> createSecretWithUsernamePassword(encryptionSecretName, domainNamespace, "weblogicenc",
        "weblogicenc"),
        String.format("createSecret failed for %s", encryptionSecretName));
    Domain domain = createDomainResource(domainUid, domainNamespace, adminSecretName, REPO_SECRET_NAME,
        encryptionSecretName, replicaCount, miiImage);
    logger.info("Creating model in image domain {0} in namespace {1} using docker image {2}",
        domainUid, domainNamespace, miiImage);
    createDomainAndVerify(domain, domainNamespace);
    logger.info("Wait for admin server pod {0} to be ready in namespace {1}",
        adminServerPodName, domainNamespace);
    checkPodReady(adminServerPodName, domainUid, domainNamespace);
    for (int i = 1; i <= replicaCount; i++) {
      logger.info("Wait for managed server pod {0} to be ready in namespace {1}",
          managedServerPrefix + i, domainNamespace);
      checkPodReady(managedServerPrefix + i, domainUid, domainNamespace);
    }
    logger.info("Check admin service {0} is created in namespace {1}",
        adminServerPodName, domainNamespace);
    checkServiceExists(adminServerPodName, domainNamespace);
    for (int i = 1; i <= replicaCount; i++) {
      logger.info("Check managed server service {0} is created in namespace {1}",
          managedServerPrefix + i, domainNamespace);
      checkServiceExists(managedServerPrefix + i, domainNamespace);
    }
    for (int i = 1; i <= replicaCount; i++) {
      checkAppRunning(
          domainNamespace,
          managedServerPrefix + i,
          "8001",
          "sample-war/index.jsp",
          MII_APP_RESPONSE_V1 + i);
    }
    logger.info("Domain {0} is fully started - servers are running and application is available",
        domainUid);
  }
@ ParameterizedTest @ DisplayName ( "Create model in image domain using different WebLogic version images as parameters" ) @ MethodSource ( "oracle.weblogic.kubernetes.utils.Params#webLogicImageTags" ) public void testParamsCreateMiiDomain ( String imageTag , @ Namespaces ( 1 ) List < String > namespaces ) { imageTag = imageTag . trim ( ) ; assertTrue ( ! imageTag . isEmpty ( ) , "imageTag can not be empty string" ) ; logger . info ( "Using imageTag {0}" , imageTag ) ; logger . info ( "Getting unique namespace for Domain" ) ; assertNotNull ( namespaces . get ( 0 ) , "Namespace list is null" ) ; domainNamespace = namespaces . get ( 0 ) ; assertTrue ( upgradeAndVerifyOperator ( opNamespace , domainNamespace ) , String . format ( "Failed to upgrade operator in namespace %s" , opNamespace ) ) ; final String adminServerPodName = domainUid + "-" + ADMIN_SERVER_NAME_BASE ; final String managedServerPrefix = domainUid + "-managed-server" ; final int replicaCount = 2 ; logger . info ( "Creating image with model file and verify" ) ; miiImage = createMiiImageAndVerify ( "mii-image" , MII_BASIC_WDT_MODEL_FILE , MII_BASIC_APP_NAME , WLS_BASE_IMAGE_NAME , imageTag , WLS ) ; dockerLoginAndPushImageToRegistry ( miiImage ) ; assertDoesNotThrow ( ( ) -> createDockerRegistrySecret ( domainNamespace ) , String . format ( "createSecret failed for %s" , REPO_SECRET_NAME ) ) ; logger . info ( "Create secret for admin credentials" ) ; String adminSecretName = "weblogic-credentials" ; assertDoesNotThrow ( ( ) -> createSecretWithUsernamePassword ( adminSecretName , domainNamespace , "weblogic" , "welcome1" ) , String . format ( "createSecret failed for %s" , adminSecretName ) ) ; logger . info ( "Create encryption secret" ) ; String encryptionSecretName = "encryptionsecret" ; assertDoesNotThrow ( ( ) -> createSecretWithUsernamePassword ( encryptionSecretName , domainNamespace , "weblogicenc" , "weblogicenc" ) , String . format ( "createSecret failed for %s" , encryptionSecretName ) ) ; Domain domain = createDomainResource ( domainUid , domainNamespace , adminSecretName , REPO_SECRET_NAME , encryptionSecretName , replicaCount , miiImage ) ; logger . info ( "Creating model in image domain {0} in namespace {1} using docker image {2}" , domainUid , domainNamespace , miiImage ) ; createDomainAndVerify ( domain , domainNamespace ) ; logger . info ( "Wait for admin server pod {0} to be ready in namespace {1}" , adminServerPodName , domainNamespace ) ; checkPodReady ( adminServerPodName , domainUid , domainNamespace ) ; for ( int i = 1 ; i <= replicaCount ; i ++ ) { logger . info ( "Wait for managed server pod {0} to be ready in namespace {1}" , managedServerPrefix + i , domainNamespace ) ; checkPodReady ( managedServerPrefix + i , domainUid , domainNamespace ) ; } logger . info ( "Check admin service {0} is created in namespace {1}" , adminServerPodName , domainNamespace ) ; checkServiceExists ( adminServerPodName , domainNamespace ) ; for ( int i = 1 ; i <= replicaCount ; i ++ ) { logger . info ( "Check managed server service {0} is created in namespace {1}" , managedServerPrefix + i , domainNamespace ) ; checkServiceExists ( managedServerPrefix + i , domainNamespace ) ; } for ( int i = 1 ; i <= replicaCount ; i ++ ) { checkAppRunning ( domainNamespace , managedServerPrefix + i , "8001" , "sample-war/index.jsp" , MII_APP_RESPONSE_V1 + i ) ; } logger . info ( "Domain {0} is fully started - servers are running and application is available" , domainUid ) ; }
Parameterized test to create model in image domain using different WebLogic version images
 as parameters.
Parameterized test to create model in image domain using different WebLogic version images as parameters .
// upgrade Operator for the new domain namespace // admin/managed server name here should match with model yaml in MII_BASIC_WDT_MODEL_FILE // create image with model files // docker login and push image to docker registry if necessary // Create the repo secret to pull the image // create secret for admin credentials // create encryption secret // create the domain object // create model in image domain // check admin server pod is ready // check managed server pods are ready // check managed server services created // check and wait for the application to be accessible in all server pods