|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ro.isdc.wro.util.WroTestUtils
public class WroTestUtils
WroTestUtils.
Constructor Summary | |
---|---|
WroTestUtils()
|
Method Summary | |
---|---|
static void |
assertProcessorSupportResourceTypes(ResourcePreProcessor processor,
ResourceType... expectedResourceTypes)
Asserts that a processor supports provided resource types. |
static void |
compare(InputStream expected,
InputStream actual)
Compare if content of expected stream is the same as content of the actual stream. |
static void |
compare(InputStream input,
InputStream expected,
ResourcePostProcessor processor)
|
static void |
compare(Reader resultReader,
Reader expectedReader,
ResourcePostProcessor processor)
Compare contents of two resources (files) by performing some sort of processing on input resource. |
static void |
compare(String expected,
String actual)
Compares two strings by removing trailing spaces & tabs for correct comparison. |
static void |
compareFromDifferentFolders(File sourceFolder,
File targetFolder,
ResourcePreProcessor processor)
Process and compare all the files from the sourceFolder and compare them with the files from the targetFolder. |
static void |
compareFromDifferentFoldersByExtension(File sourceFolder,
File targetFolder,
String extension,
ResourcePostProcessor processor)
TODO run tests in parallel |
static void |
compareFromDifferentFoldersByExtension(File sourceFolder,
File targetFolder,
String extension,
ResourcePreProcessor processor)
|
static void |
compareFromDifferentFoldersByName(File sourceFolder,
File targetFolder,
String srcExtension,
String targetExtension,
ResourcePostProcessor processor)
Compares files with the same name from sourceFolder against it's counterpart in targetFolder, but allows source and target files to have different extensions. |
static void |
compareFromSameFolder(File sourceFolder,
org.apache.commons.io.filefilter.IOFileFilter sourceFileFilter,
Transformer<String> toTargetFileName,
ResourcePreProcessor processor)
|
static void |
compareProcessedResourceContents(String inputResourceUri,
String expectedContentResourceUri,
ResourcePostProcessor processor)
Compare contents of two resources (files) by performing some sort of processing on input resource. |
static Injector |
createInjector()
|
static UriLocator |
createResourceMockingLocator()
|
static UriLocatorFactory |
createResourceMockingLocatorFactory()
|
static void |
forEachFileInFolder(File folder,
Function<File,Void> function)
Applies a function for each file from a folder. |
static InputStream |
getInputStream(String uri)
|
static void |
init(WroModelFactory factory)
|
static void |
initProcessor(ResourcePostProcessor processor)
|
static void |
initProcessor(ResourcePreProcessor processor)
|
static void |
runConcurrently(Callable<Void> task)
Run the task concurrently 50 times. |
static void |
runConcurrently(Callable<Void> task,
int times)
Runs a task concurrently. |
static BaseWroManagerFactory |
simpleManagerFactory()
|
static WroModelFactory |
simpleModelFactory(WroModel model)
Creates a model factory for a given model. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public WroTestUtils()
Method Detail |
---|
public static BaseWroManagerFactory simpleManagerFactory()
BaseWroManagerFactory
which uses an empty model.public static void compareProcessedResourceContents(String inputResourceUri, String expectedContentResourceUri, ResourcePostProcessor processor) throws IOException
inputResourceUri
- uri of the resource to process.expectedContentResourceUri
- uri of the resource to compare with processed content.processor
- a closure used to process somehow the input content.
IOException
public static InputStream getInputStream(String uri) throws IOException
IOException
public static void init(WroModelFactory factory)
public static void initProcessor(ResourcePreProcessor processor)
public static void initProcessor(ResourcePostProcessor processor)
public static void compare(Reader resultReader, Reader expectedReader, ResourcePostProcessor processor) throws IOException
inputResourceUri
- uri of the resource to process.expectedContentResourceUri
- uri of the resource to compare with processed content.processor
- a closure used to process somehow the input content.
IOException
public static void compare(InputStream input, InputStream expected, ResourcePostProcessor processor) throws IOException
IOException
public static void compare(InputStream expected, InputStream actual) throws IOException
expected
- InputStream
of the expected content.actual
- InputStream
of the actual content.
IOException
public static void compare(String expected, String actual)
public static void compareFromSameFolder(File sourceFolder, org.apache.commons.io.filefilter.IOFileFilter sourceFileFilter, Transformer<String> toTargetFileName, ResourcePreProcessor processor)
public static void compareFromDifferentFolders(File sourceFolder, File targetFolder, ResourcePreProcessor processor) throws IOException
IOException
public static void compareFromDifferentFoldersByExtension(File sourceFolder, File targetFolder, String extension, ResourcePreProcessor processor) throws IOException
IOException
public static void compareFromDifferentFoldersByExtension(File sourceFolder, File targetFolder, String extension, ResourcePostProcessor processor) throws IOException
IOException
public static void compareFromDifferentFoldersByName(File sourceFolder, File targetFolder, String srcExtension, String targetExtension, ResourcePostProcessor processor) throws IOException
IOException
public static void forEachFileInFolder(File folder, Function<File,Void> function)
folder
- File
representing the folder where the files will be used from processing.function
- Function
to apply on each found file.public static void runConcurrently(Callable<Void> task, int times) throws Exception
task
- a Callable
to run concurrently.
Exception
- if any of the executed tasks fails.public static void runConcurrently(Callable<Void> task) throws Exception
Exception
public static Injector createInjector()
Injector
to be used by test classes.public static WroModelFactory simpleModelFactory(WroModel model)
public static void assertProcessorSupportResourceTypes(ResourcePreProcessor processor, ResourceType... expectedResourceTypes)
public static UriLocatorFactory createResourceMockingLocatorFactory()
UriLocatorFactory
which always return a valid stream which contains the
resource uri as content.public static UriLocator createResourceMockingLocator()
UriLocator
which always return a valid stream which contains the resource uri
as content.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |