/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package io.trino.tests.product.launcher.env;

import io.trino.tests.product.launcher.suite.suites.Suite1;
import io.trino.tests.product.launcher.suite.suites.Suite6NonGeneric;
import io.trino.tests.product.launcher.suite.suites.SuiteTpcds;
import org.testng.annotations.Test;

import static io.trino.tests.product.launcher.Configurations.canonicalName;
import static io.trino.tests.product.launcher.Configurations.nameForSuiteClass;
import static org.assertj.core.api.Assertions.assertThat;

public class TestConfigurations
{
    @Test
    public void testCanonicalName()
    {
        assertThat(canonicalName("ala")).isEqualTo("ala");
        assertThat(canonicalName("Ala")).isEqualTo("ala");
        assertThat(canonicalName("DuzaAla")).isEqualTo("duza-ala");
        assertThat(canonicalName("duza-ala")).isEqualTo("duza-ala");
        assertThat(canonicalName("duza-Ala")).isEqualTo("duza-ala");
        assertThat(canonicalName("duza----Ala")).isEqualTo("duza-ala");
    }

    @Test
    public void testSuiteName()
    {
        // suite name with a number
        assertThat(nameForSuiteClass(Suite1.class)).isEqualTo("suite-1");
        // suite name with a word
        assertThat(nameForSuiteClass(SuiteTpcds.class)).isEqualTo("suite-tpcds");
        // suite name with a number  and then a word
        assertThat(nameForSuiteClass(Suite6NonGeneric.class)).isEqualTo("suite-6-non-generic");
    }
}

@@ -601,16 +601,92 @@
 r.env;%0A%0A
+import io.trino.tests.product.launcher.env.environment.SinglenodeSqlserver;%0A
 import i
@@ -1201,32 +1201,93 @@
 calName()%0A    %7B%0A
+        // canonical environment name should be retain as is%0A
         assertTh
@@ -1363,17 +1363,22 @@
 alName(%22
-A
+duza-a
 la%22)).is
@@ -1378,32 +1378,37 @@
 a%22)).isEqualTo(%22
+duza-
 ala%22);%0A        a
@@ -1436,12 +1436,13 @@
 me(%22
-D
+d
 uza
+-
 Ala%22
@@ -1458,32 +1458,137 @@
 lTo(%22duza-ala%22);
+%0A%0A        // a name of the class (as if copy-pasted from IDE) should result in canonical environment name
 %0A        assertT
@@ -1598,38 +1598,33 @@
 (canonicalName(%22
-duza-a
+A
 la%22)).isEqualTo(
@@ -1616,37 +1616,32 @@
 a%22)).isEqualTo(%22
-duza-
 ala%22);%0A        a
@@ -1657,37 +1657,36 @@
 (canonicalName(%22
-d
+D
 uza
--
 Ala%22)).isEqualTo
@@ -1691,32 +1691,271 @@
 To(%22duza-ala%22);%0A
+        // real life example%0A        assertThat(canonicalName(SinglenodeSqlserver.class.getSimpleName())).isEqualTo(%22singlenode-sqlserver%22);%0A%0A        // document current state; this behavior is neither intentional or (currently) forbidden%0A
         assertTh

Update environment name canonicalization tests