Package cz.xtf.core.namespace
Class NamespaceManager
- java.lang.Object
-
- cz.xtf.core.namespace.NamespaceManager
-
public class NamespaceManager extends Object
-
-
Constructor Summary
Constructors Constructor Description NamespaceManager()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidaddTestCaseToNamespaceEntryIfAbsent(org.junit.platform.engine.TestDescriptor testDescriptor)Add mapping test case name -> (automatically generated) namespace for given test case if absentstatic booleancreateIfDoesNotExistsProject()Creates namespace with name returned by @see #getNamespace if it does not existstatic booleancreateIfDoesNotExistsProject(String namespace)Creates namespace if it does not existstatic booleandeleteProject(boolean waitForDeletion)Deletes namespace as returned by @see #getNamespacestatic booleandeleteProject(String namespace, boolean waitForDeletion)Deletes namespacestatic booleandeleteProjectIfUsedNamespacePerTestCase(boolean waitForDeletion)Deletes namespace as returned by @see #getNamespace.static StringgetNamespace()
-
-
-
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 deletewaitForDeletion- 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 @seeOpenShiftConfig.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
RuntimeExceptionexception is thrown.
-
-