Class NamespaceManager


  • public class NamespaceManager
    extends Object
    • Constructor Detail

      • NamespaceManager

        public NamespaceManager()
    • Method Detail

      • createIfDoesNotExistsProject

        public static boolean createIfDoesNotExistsProject()
        Creates namespace with name returned by @see #getNamespace if it does not exist
        Returns:
        true if successful, false otherwise
      • createIfDoesNotExistsProject

        public static boolean createIfDoesNotExistsProject​(String namespace)
        Creates namespace if it does not exist
        Returns:
        true if newly created, false otherwise (failed or namespace already present)
      • deleteProject

        public static boolean deleteProject​(boolean waitForDeletion)
        Deletes namespace as returned by @see #getNamespace
        Parameters:
        waitForDeletion - whether to wait for deletion (timeout 2 min)
        Returns:
        true if successful, false otherwise
      • deleteProject

        public static boolean deleteProject​(String namespace,
                                            boolean waitForDeletion)
        Deletes namespace
        Parameters:
        namespace - namespace name to delete
        waitForDeletion - whether to wait for deletion (timeout 2 min)
        Returns:
        true if successful, false otherwise
      • deleteProjectIfUsedNamespacePerTestCase

        public static boolean deleteProjectIfUsedNamespacePerTestCase​(boolean waitForDeletion)
        Deletes namespace as returned by @see #getNamespace. Deletes namespace only if @see OpenShiftConfig.useNamespacePerTestCase() is true.
        Parameters:
        waitForDeletion - wait for deletion of namespace
        Returns:
        true if successful, false otherwise
      • addTestCaseToNamespaceEntryIfAbsent

        public static void addTestCaseToNamespaceEntryIfAbsent​(org.junit.platform.engine.TestDescriptor testDescriptor)
        Add mapping test case name -> (automatically generated) namespace for given test case if absent
        Parameters:
        testDescriptor - test descriptor
      • getNamespace

        public static String getNamespace()
        Returns:
        Returns default namespace as defined in xtf.openshift.namespace property or namespace for currently running test case when: -Dxtf.openshift.namespace.per.testcase=true. In case when current thread does not have associated test case (for example when initializing Openshift instance in static variable or static block) then RuntimeException exception is thrown.