use of org.mule.tck.ZipUtils.ZipResource in project mule by mulesoft.
the class DomainFileBuilder method definedBy.
/**
* Sets the configuration file used for the domain.
*
* @param configFile domain configuration from a external file or test resource. Non empty.
* @return the same builder instance
*/
public DomainFileBuilder 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 AbstractArtifactFileBuilder method containingResource.
/**
* Adds a resource file to the plugin root folder.
*
* @param resourceFile resource file from a external file or test resource.
* @return the same builder instance
*/
public T containingResource(String resourceFile, String alias) {
checkImmutable();
checkArgument(!isEmpty(resourceFile), "Resource file cannot be empty");
resources.add(new ZipResource(resourceFile, alias));
return getThis();
}
use of org.mule.tck.ZipUtils.ZipResource in project mule by mulesoft.
the class AbstractArtifactFileBuilder method usingLibrary.
/**
* Adds a jar file to the artifact lib folder.
*
* @param jarFile jar file from a external file or test resource.
* @return the same builder instance
*/
public T usingLibrary(String jarFile) {
checkImmutable();
checkArgument(!isEmpty(jarFile), "Jar file cannot be empty");
resources.add(new ZipResource(jarFile, "lib/" + getName(jarFile)));
return getThis();
}
use of org.mule.tck.ZipUtils.ZipResource in project mule by mulesoft.
the class AbstractArtifactFileBuilder 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
*/
public T containingClass(File classFile, String alias) {
checkImmutable();
checkArgument(classFile != null, "Class file cannot be null");
resources.add(new ZipResource(classFile.getAbsolutePath(), alias));
return getThis();
}
use of org.mule.tck.ZipUtils.ZipResource in project mule by mulesoft.
the class AbstractArtifactFileBuilder method getArtifactFile.
@Override
public File getArtifactFile() {
if (artifactFile == null) {
String fileName = getArtifactFileName();
final File tempFile = new File(getTempFolder(), fileName);
tempFile.deleteOnExit();
if (corrupted) {
buildBrokenJarFile(tempFile);
} else {
final List<ZipResource> zipResources = new LinkedList<>(resources);
zipResources.add(new ZipResource(getArtifactPomFile().getAbsolutePath(), getArtifactFileBundledPomPath()));
zipResources.addAll(getCustomResources());
compress(tempFile, zipResources.toArray(new ZipResource[0]));
}
artifactFile = new File(tempFile.getAbsolutePath());
}
return artifactFile;
}
Aggregations