use of org.mule.tck.ZipUtils.ZipResource in project mule by mulesoft.
the class FileUtilsTestCase method unzipsFileWithoutParentFolderEntry.
@Test
public void unzipsFileWithoutParentFolderEntry() throws Exception {
final String resourceName = "dummy.xml";
final String resourceAlias = "folder" + File.separator + resourceName;
final File compressedFile = new File(toDir, "test.zip");
compress(compressedFile, new ZipResource[] { new ZipResource(resourceName, resourceAlias) });
unzip(compressedFile, toDir);
assertThat(new File(new File(toDir, "folder"), resourceName).exists(), is(true));
}
use of org.mule.tck.ZipUtils.ZipResource in project mule by mulesoft.
the class AbstractArtifactFileBuilder method createPropertiesFile.
protected ZipResource createPropertiesFile(Properties props, String propertiesFileName, String zipAlias) {
ZipResource result = null;
if (!props.isEmpty()) {
final File applicationPropertiesFile = new File(getTempFolder(), propertiesFileName);
applicationPropertiesFile.deleteOnExit();
createPropertiesFile(applicationPropertiesFile, props);
result = new ZipResource(applicationPropertiesFile.getAbsolutePath(), zipAlias);
}
return result;
}
use of org.mule.tck.ZipUtils.ZipResource in project mule by mulesoft.
the class ApplicationFileBuilder method usingResource.
/**
* Adds a resource file to the artifact folder.
*
* @param resourceFile class file from a external file or test resource. Non empty.
* @param targetFile name to use on the added resource. Non empty.
* @return the same builder instance
*/
public ApplicationFileBuilder usingResource(String resourceFile, String targetFile) {
checkImmutable();
checkArgument(!isEmpty(resourceFile), "Resource file cannot be empty");
resources.add(new ZipResource(resourceFile, targetFile));
return getThis();
}
use of org.mule.tck.ZipUtils.ZipResource in project mule by mulesoft.
the class ApplicationFileBuilder method definedBy.
/**
* Sets the configuration file used for the application.
*
* @param configFile application configuration from a external file or test resource. Non empty.
* @return the same builder instance
*/
public ApplicationFileBuilder definedBy(String configFile) {
checkImmutable();
checkArgument(!StringUtils.isEmpty(configFile), "Config file cannot be empty");
this.resources.add(new ZipResource(configFile, DEFAULT_CONFIGURATION_RESOURCE));
return this;
}
use of org.mule.tck.ZipUtils.ZipResource in project mule by mulesoft.
the class ArtifactPluginFileBuilder method containingClass.
/**
* Adds a class file to the artifact classes folder.
*
* @param classFile class file to include. Non null.
* @param alias path where the file must be added inside the app file
* @return the same builder instance
*/
@Override
public ArtifactPluginFileBuilder containingClass(File classFile, String alias) {
checkImmutable();
checkArgument(classFile != null, "Class file cannot be null");
resources.add(new ZipResource(classFile.getAbsolutePath(), alias));
return getThis();
}
Aggregations