public class ImportTestUtils extends Object
| Constructor and Description |
|---|
ImportTestUtils() |
| Modifier and Type | Method and Description |
|---|---|
static ImportError |
error(ErrorCode code,
String msg)
Simulates an import error with the specified error code and the message.
|
static ImportError |
error(String msg)
Simulates an import error with the specified message.
|
static Collection<ImportError> |
errors(String... messages)
Simulates an import error for each message submitted.
|
static ImportResult |
importResult(String impexFileLoc)
Mocks an import result, which is wired up with the CronJobModel and WorkMedia.
|
static ImportResult |
importResultWithLogErrors(String impexFileLoc,
String errLogText)
Mocks an import result with errors present in the error log.
|
static ImportResult |
importResultWithUnresolvedLineErrors(String impexFileLoc,
String errLogText,
InputStream mediaStream)
Mocks an import result with errors present in the unresolved lines.
|
static void |
makeResultSuccessful(ImportResult result)
Takes mock of an
ImportResult and finishes stubbing to simulate success import result. |
static void |
makeResultWithErrors(ImportResult res,
String errLogText)
Takes mock of an
ImportResult and finishes stubbing to simulate errors present in the result. |
static void |
makeResultWithErrors(ImportResult res,
String errLogText,
MediaService mediaService,
InputStream mediaStream)
Takes mock of an
ImportResult and finishes stubbing to simulate errors present in the result. |
static void |
makeResultWithMediaServiceException(ImportResult res,
MediaService mediaService)
Takes mock of an
ImportResult and throws an IOException when calling the mediaService |
static ImportResult |
successfulImportResult()
Mocks a successful import result.
|
static InputStream |
toInputStream(String... lines) |
static String |
toText(String... lines)
Converts separate strings into a multi-line text, where each string becomes a separate line.
|
public static ImportError error(String msg)
msg - an error message for the error.public static ImportError error(ErrorCode code, String msg)
code - an error code to use for the error.msg - an error message for the error.public static Collection<ImportError> errors(String... messages)
messages - an array of messages to convert to import errorspublic static ImportResult importResult(String impexFileLoc)
impexFileLoc - path to the source of the impex file being imported, which is relative to the hybris server data
directory.public static ImportResult successfulImportResult()
public static void makeResultSuccessful(ImportResult result)
ImportResult and finishes stubbing to simulate success import result.result - a result mock to stub.public static ImportResult importResultWithLogErrors(String impexFileLoc, String errLogText)
impexFileLoc - location of the impex source file being imported.errLogText - content of the error log to mock in the result.public static ImportResult importResultWithUnresolvedLineErrors(String impexFileLoc, String errLogText, InputStream mediaStream)
impexFileLoc - location of the impex source file being imported.errLogText - content of the error log to mock in the result.mediaStream - content of the unresolved lines to mock in the result.public static void makeResultWithErrors(ImportResult res, String errLogText)
ImportResult and finishes stubbing to simulate errors present in the result.res - a mock of the ImportResult to finish stubbing.errLogText - content of the error log to mock in the import result.public static void makeResultWithErrors(ImportResult res, String errLogText, MediaService mediaService, InputStream mediaStream)
ImportResult and finishes stubbing to simulate errors present in the result.res - a mock of the ImportResult to finish stubbing.errLogText - content of the error log to mock in the import result.mediaService - the mediaServicemediaStream - c
should be simulated.public static void makeResultWithMediaServiceException(ImportResult res, MediaService mediaService)
ImportResult and throws an IOException when calling the mediaServiceres - a mock of the ImportResult to finish stubbing.mediaService - a mock of the ImportResult to finish stubbing.public static String toText(String... lines)
lines - lines of text to merge together. Pass empty strings for empty (blank) lines in the resulting text.public static InputStream toInputStream(String... lines)
Copyright © 2017 SAP SE. All Rights Reserved.