integration-tests/src/test/java/oracle/kubernetes/operator/ItUsabilityOperatorHelmChart.java
@Test
  public void testSecondOpSharingSameTargetDomainsNsNegativeInstall() throws Exception {
    Assumptions.assumeTrue(FULLTEST);
    String testMethodName = new Object() {
    }.getClass().getEnclosingMethod().getName();
    logTestBegin(testMethodName);

    LoggerHelper.getLocal().log(Level.INFO, "Creating first operator");
    Operator firstoperator =
        new Operator(createOperatorMap(getNewSuffixCount(), true, "usab"), RestCertType.SELF_SIGNED);
    firstoperator.callHelmInstall();

    Map<String, Object> operatorMap = createOperatorMap(getNewSuffixCount(), false, "usab");
    ArrayList<String> targetDomainsNS =
        (ArrayList<String>) firstoperator.getOperatorMap().get("domainNamespaces");
    operatorMap.put("domainNamespaces", targetDomainsNS);
    Operator secondoperator = new Operator(operatorMap, true, true, false, RestCertType.SELF_SIGNED);
    String oprelease = (String)(secondoperator.getOperatorMap()).get("releaseName");
    String opnamespace = (String)(secondoperator.getOperatorMap()).get("namespace");
    boolean installFailed = true;
    boolean gotExpectedInfo = true;
    try {
      secondoperator.callHelmInstall();
      installFailed = false;
    } catch (Exception ex) {
      LoggerHelper.getLocal().log(Level.INFO, "Caught exception " + ex.getMessage() + ex.getStackTrace());
      if (!ex.getMessage()
          .contains("weblogic-operator-rolebinding-namespace")) {
        gotExpectedInfo = false;
      }
    } finally {
      if (firstoperator != null) {
        firstoperator.destroy();
      }
    }
    Assertions.assertTrue(installFailed, "Second operator helm installation should fail");
    Assertions.assertTrue(gotExpectedInfo, "Helm installation should fail with correct exception string");
    LoggerHelper.getLocal().log(Level.INFO, "SUCCESS - " + testMethodName);
  }
/**
   * Install operator usab-1 with target DomainNameSpace [usab-domainns-1].
   * Install operator usab-2 with same target DomainNamesapce [usab-domainns-1].
   * Second operator should fail to install with following exception 
   * Error: rendered manifests contain a resource that already exists. 
   * Unable to continue with install: existing resource conflict: 
   * kind: RoleBinding, namespace: usab-domainns-1, 
   * name: weblogic-operator-rolebinding-namespace
   *
   * @throws Exception when second operator installation does not fail
   */
Install operator usab-1 with target DomainNameSpace [usab-domainns-1].
Install operator usab-2 with same target DomainNamesapce [usab-domainns-1].
Second operator should fail to install with following exception
Error: rendered manifests contain a resource that already exists.

@throws Exception when second operator installation does not fail
Install operator usab - 1 with target DomainNameSpace [ usab - domainns - 1 ] . Install operator usab - 2 with same target DomainNamesapce [ usab - domainns - 1 ] . Second operator should fail to install with following exception Error : rendered manifests contain a resource that already exists . @throws Exception when second operator installation does not fail
@Test
  public void testSecondOpSharingSameTargetDomainsNsNegativeInstall() throws Exception {
    Assumptions.assumeTrue(FULLTEST);
    String testMethodName = new Object() {
    }.getClass().getEnclosingMethod().getName();
    logTestBegin(testMethodName);
    LoggerHelper.getLocal().log(Level.INFO, "Creating first operator");
    Operator firstoperator =
        new Operator(createOperatorMap(getNewSuffixCount(), true, "usab"), RestCertType.SELF_SIGNED);
    firstoperator.callHelmInstall();
    Map<String, Object> operatorMap = createOperatorMap(getNewSuffixCount(), false, "usab");
    ArrayList<String> targetDomainsNS =
        (ArrayList<String>) firstoperator.getOperatorMap().get("domainNamespaces");
    operatorMap.put("domainNamespaces", targetDomainsNS);
    Operator secondoperator = new Operator(operatorMap, true, true, false, RestCertType.SELF_SIGNED);
    String oprelease = (String)(secondoperator.getOperatorMap()).get("releaseName");
    String opnamespace = (String)(secondoperator.getOperatorMap()).get("namespace");
    boolean installFailed = true;
    boolean gotExpectedInfo = true;
    try {
      secondoperator.callHelmInstall();
      installFailed = false;
    } catch (Exception ex) {
      LoggerHelper.getLocal().log(Level.INFO, "Caught exception " + ex.getMessage() + ex.getStackTrace());
      if (!ex.getMessage()
          .contains("weblogic-operator-rolebinding-namespace")) {
        gotExpectedInfo = false;
      }
    } finally {
      if (firstoperator != null) {
        firstoperator.destroy();
      }
    }
    Assertions.assertTrue(installFailed, "Second operator helm installation should fail");
    Assertions.assertTrue(gotExpectedInfo, "Helm installation should fail with correct exception string");
    LoggerHelper.getLocal().log(Level.INFO, "SUCCESS - " + testMethodName);
  }
@ Test public void testSecondOpSharingSameTargetDomainsNsNegativeInstall ( ) throws Exception { Assumptions . assumeTrue ( FULLTEST ) ; String testMethodName = new Object ( ) { } . getClass ( ) . getEnclosingMethod ( ) . getName ( ) ; logTestBegin ( testMethodName ) ; LoggerHelper . getLocal ( ) . log ( Level . INFO , "Creating first operator" ) ; Operator firstoperator = new Operator ( createOperatorMap ( getNewSuffixCount ( ) , true , "usab" ) , RestCertType . SELF_SIGNED ) ; firstoperator . callHelmInstall ( ) ; Map < String , Object > operatorMap = createOperatorMap ( getNewSuffixCount ( ) , false , "usab" ) ; ArrayList < String > targetDomainsNS = ( ArrayList < String > ) firstoperator . getOperatorMap ( ) . get ( "domainNamespaces" ) ; operatorMap . put ( "domainNamespaces" , targetDomainsNS ) ; Operator secondoperator = new Operator ( operatorMap , true , true , false , RestCertType . SELF_SIGNED ) ; String oprelease = ( String ) ( secondoperator . getOperatorMap ( ) ) . get ( "releaseName" ) ; String opnamespace = ( String ) ( secondoperator . getOperatorMap ( ) ) . get ( "namespace" ) ; boolean installFailed = true ; boolean gotExpectedInfo = true ; try { secondoperator . callHelmInstall ( ) ; installFailed = false ; } catch ( Exception ex ) { LoggerHelper . getLocal ( ) . log ( Level . INFO , "Caught exception " + ex . getMessage ( ) + ex . getStackTrace ( ) ) ; if ( ! ex . getMessage ( ) . contains ( "weblogic-operator-rolebinding-namespace" ) ) { gotExpectedInfo = false ; } } finally { if ( firstoperator != null ) { firstoperator . destroy ( ) ; } } Assertions . assertTrue ( installFailed , "Second operator helm installation should fail" ) ; Assertions . assertTrue ( gotExpectedInfo , "Helm installation should fail with correct exception string" ) ; LoggerHelper . getLocal ( ) . log ( Level . INFO , "SUCCESS - " + testMethodName ) ; }
Install operator usab-1 with target DomainNameSpace [usab-domainns-1].
Install operator usab - 1 with target DomainNameSpace [ usab - domainns - 1 ] .