use of org.apache.maven.plugins.assembly.model.Assembly in project maven-plugins by apache.
the class DefaultAssemblyReaderTest method testIncludeSiteInAssembly_ShouldFailIfSiteDirectoryNonExistent.
public void testIncludeSiteInAssembly_ShouldFailIfSiteDirectoryNonExistent() throws IOException {
final File siteDir = File.createTempFile("assembly-reader.", ".test");
siteDir.delete();
expect(configSource.getSiteDirectory()).andReturn(siteDir).anyTimes();
final Assembly assembly = new Assembly();
mockManager.replayAll();
try {
new DefaultAssemblyReader().includeSiteInAssembly(assembly, configSource);
fail("Should fail when site directory is non-existent.");
} catch (final InvalidAssemblerConfigurationException e) {
// this should happen.
}
mockManager.verifyAll();
}
use of org.apache.maven.plugins.assembly.model.Assembly in project maven-plugins by apache.
the class DefaultAssemblyReaderTest method testReadAssemblies_ShouldGetAssemblyDescriptorFromFileArray.
public void testReadAssemblies_ShouldGetAssemblyDescriptorFromFileArray() throws IOException, AssemblyReadException, InvalidAssemblerConfigurationException {
final Assembly assembly1 = new Assembly();
assembly1.setId("test");
final Assembly assembly2 = new Assembly();
assembly2.setId("test2");
final List<Assembly> assemblies = new ArrayList<Assembly>();
assemblies.add(assembly1);
assemblies.add(assembly2);
final File basedir = fileManager.createTempDir();
final List<String> files = writeAssembliesToFile(assemblies, basedir);
final List<Assembly> results = performReadAssemblies(basedir, files.toArray(new String[files.size()]), null, null);
assertNotNull(results);
assertEquals(2, results.size());
final Assembly result1 = assemblies.get(0);
assertEquals(assembly1.getId(), result1.getId());
final Assembly result2 = assemblies.get(1);
assertEquals(assembly2.getId(), result2.getId());
}
use of org.apache.maven.plugins.assembly.model.Assembly in project maven-plugins by apache.
the class DefaultAssemblyReaderTest method performReadAssemblies.
private List<Assembly> performReadAssemblies(final File basedir, final String[] descriptors, final String[] descriptorRefs, final File descriptorDir, final boolean ignoreMissing) throws AssemblyReadException, InvalidAssemblerConfigurationException {
expect(configSource.getDescriptorReferences()).andReturn(descriptorRefs);
expect(configSource.getDescriptors()).andReturn(descriptors);
expect(configSource.getDescriptorSourceDirectory()).andReturn(descriptorDir);
expect(configSource.getBasedir()).andReturn(basedir).anyTimes();
expect(configSource.getProject()).andReturn(new MavenProject(new Model())).anyTimes();
expect(configSource.isIgnoreMissingDescriptor()).andReturn(ignoreMissing).anyTimes();
DefaultAssemblyArchiverTest.setupInterpolators(configSource);
mockManager.replayAll();
final List<Assembly> assemblies = new DefaultAssemblyReader().readAssemblies(configSource);
mockManager.verifyAll();
return assemblies;
}
use of org.apache.maven.plugins.assembly.model.Assembly in project maven-plugins by apache.
the class DefaultAssemblyReaderTest method testReadAssembly_ShouldReadAssemblyWithoutComponentsInterpolationOrSiteDirInclusion.
public void testReadAssembly_ShouldReadAssemblyWithoutComponentsInterpolationOrSiteDirInclusion() throws IOException, AssemblyReadException, InvalidAssemblerConfigurationException {
final Assembly assembly = new Assembly();
assembly.setId("test");
final Assembly result = doReadAssembly(assembly);
assertEquals(assembly.getId(), result.getId());
mockManager.verifyAll();
}
use of org.apache.maven.plugins.assembly.model.Assembly in project maven-plugins by apache.
the class DefaultAssemblyReaderTest method testGetAssemblyForDescriptorReference_ShouldReadBinaryAssemblyRef.
public void testGetAssemblyForDescriptorReference_ShouldReadBinaryAssemblyRef() throws IOException, AssemblyReadException, InvalidAssemblerConfigurationException {
final File basedir = fileManager.createTempDir();
expect(configSource.getBasedir()).andReturn(basedir).anyTimes();
expect(configSource.getProject()).andReturn(new MavenProject(new Model())).anyTimes();
expect(configSource.isIgnoreMissingDescriptor()).andReturn(false).anyTimes();
DefaultAssemblyArchiverTest.setupInterpolators(configSource);
mockManager.replayAll();
final Assembly result = new DefaultAssemblyReader().getAssemblyForDescriptorReference("bin", configSource);
assertEquals("bin", result.getId());
mockManager.verifyAll();
}
Aggregations