public class BambooTestUtils extends Object
Modifier and Type | Field and Description |
---|---|
static String |
NL
Convenience constant for new line
|
static String |
SEP
Convenice constant for file separators
|
static boolean |
USE_FAST_LOGIN
Whether fast login via URL parameters should be used by tests.
|
Modifier and Type | Method and Description |
---|---|
static void |
assertFormError(ErrorCollection errorCollection,
String field,
String errorMessage) |
static void |
createActionContext() |
static <T> Set<T> |
createSet(T... items)
Varargs to set.
|
static Path |
createTempDirectory(String prefix) |
static void |
destroyActionContext() |
static File |
getFileFromResourceDirectory(Class<?> ref,
String fileName) |
static File |
getFileFromResourceDirectory(Object object,
String fileName) |
static InputStream |
getInputStream(String resourceName)
Obtains the given fileName as an input stream.
|
static InputStream |
getInputStream(String resourceName,
Class<?> clazz)
Obtains the given fileName as an input stream.
|
static InputStream |
getInputStream(String resourceName,
Object object)
Obtains the given fileName as an input stream.
|
static com.fasterxml.jackson.databind.JsonNode |
getJsonResource(String resourceName,
Class<?> clazz) |
static Reader |
getReader(String resourceName) |
static Path |
getShortTempDir() |
static String |
getSubstitutedResource(String resourceName,
Object object,
Properties subs) |
static File |
getTestDataFile(String fileName)
Get file from test data directory.
|
static String |
readFileFromResource(Class<?> clazz,
String fileName) |
static String |
readFileFromResource(Object object,
String fileName)
Deprecated.
since 6.3 use
readFileFromResource(Class, String) instead |
static <T extends Serializable> |
serializeAndDeserialize(T object) |
static String |
toVariableUsage(String variableName)
Converts variable name to a variable usage string using the default namespace "bamboo".
|
static String |
toVariableUsage(String variableNamespace,
String variableName)
Converts variable name to a variable usage string using the provided namespace.
|
public static final String NL
public static final String SEP
public static final boolean USE_FAST_LOGIN
false
, tests should fall back
to standard login.
The value is false
by default, unless a system property is specified.
public static Path getShortTempDir()
public static Path createTempDirectory(String prefix) throws IOException
IOException
public static String getSubstitutedResource(@NotNull String resourceName, @NotNull Object object, @NotNull Properties subs)
public static InputStream getInputStream(String resourceName)
resourceName
- The file to read as a streampublic static InputStream getInputStream(@NotNull String resourceName, @NotNull Object object)
resourceName
- The file to read as a streamobject
- This object's class is used to load resourcepublic static InputStream getInputStream(String resourceName, Class<?> clazz)
resourceName
- The resource nameclazz
- The class to be used to load resourcepublic static com.fasterxml.jackson.databind.JsonNode getJsonResource(String resourceName, Class<?> clazz) throws IOException
IOException
public static void assertFormError(ErrorCollection errorCollection, String field, String errorMessage)
public static File getFileFromResourceDirectory(Object object, String fileName)
public static File getFileFromResourceDirectory(Class<?> ref, String fileName)
public static File getTestDataFile(String fileName)
@Deprecated public static String readFileFromResource(Object object, String fileName) throws IOException
readFileFromResource(Class, String)
insteadIOException
public static String readFileFromResource(Class<?> clazz, String fileName) throws IOException
IOException
public static void createActionContext()
public static void destroyActionContext()
public static <T extends Serializable> T serializeAndDeserialize(@NotNull T object) throws IOException, ClassNotFoundException
IOException
ClassNotFoundException
@NotNull public static String toVariableUsage(@NotNull String variableName)
variableName
- variable namepublic static String toVariableUsage(@NotNull String variableNamespace, @NotNull String variableName)
variableNamespace
- variable namespacevariableName
- variable namepublic static <T> Set<T> createSet(T... items)
Copyright © 2019 Atlassian Software Systems Pty Ltd. All rights reserved.