<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">

<suite verbose="1" name="VID API Tests" annotations="JDK">

    <listeners>
        <listener class-name="vid.automation.test.infra.SkipTestsTestngTransformer" />
    </listeners>

    <test name="test">
        <method-selectors>
            <method-selector>
                <script language="beanshell">
                    <![CDATA[

                        //these tests call to MaintenanceController which is restricted to localhost, so it can not run on jenkins pipeline

                        String [] exclusionGroups = new String [] {
                            "worksOnlyWithLocalASDC",
                            "worksOnlyWithLocalhostVID",
                            "underDevelopment"
                        };

                        String [] testClassesToRunAlways = new String [] {
                            "LoggerFormatTest"
                        };

                        String [] classes1 = new String [] {
                            "AsyncInstantiationALaCarteApiTest"
                        };
                        int selectPart = 0;

                        for (g: exclusionGroups) {
                            if (groups.containsKey(g)) return false;
                        }
                        if (selectPart == 0) return true;

                        methodClass = method.getDeclaringClass().toString();

                        if (methodClass.contains("org.onap.vid.api.Base")) return true;

                        for (c: testClassesToRunAlways) {
                            if (methodClass.endsWith(c)) return true; // repeat in any selectPart value
                        }

                        for (c: classes1) {
                            if (methodClass.endsWith(c)) return selectPart==1;
                        }

                        // else
                        return selectPart==2;
                    ]]>
                </script>
            </method-selector>
        </method-selectors>
        <packages>
            <package name="org.onap.vid.*"/>
        </packages>
    </test>
</suite>
