use of org.apache.maven.plugins.assembly.model.Assembly in project maven-plugins by apache.
the class AssemblyInterpolatorTest method testShouldNotTouchUnresolvedExpression.
public void testShouldNotTouchUnresolvedExpression() throws AssemblyInterpolationException, InvalidAssemblerConfigurationException, AssemblyReadException, IOException {
final Model model = new Model();
model.setArtifactId("artifact-id");
model.setGroupId("group.id");
model.setVersion("1");
model.setPackaging("jar");
final Assembly assembly = new Assembly();
assembly.setId("assembly.${unresolved}");
final PojoConfigSource configSourceStub = new PojoConfigSource();
configSourceStub.setRootInterpolator(FixedStringSearchInterpolator.create());
configSourceStub.setEnvironmentInterpolator(FixedStringSearchInterpolator.create());
final MavenProject project = new MavenProject(model);
configSourceStub.setMavenProject(project);
final Assembly result = roundTripInterpolation(assembly, configSourceStub);
assertEquals("assembly.${unresolved}", result.getId());
}
use of org.apache.maven.plugins.assembly.model.Assembly in project maven-plugins by apache.
the class DefaultDependencyResolverTest method test_getRepositoryResolutionRequirements.
public void test_getRepositoryResolutionRequirements() {
final List<Repository> repositories = new ArrayList<Repository>();
{
final Repository r = new Repository();
r.setScope(Artifact.SCOPE_COMPILE);
repositories.add(r);
}
{
final Repository r = new Repository();
r.setScope(Artifact.SCOPE_SYSTEM);
repositories.add(r);
}
final MavenProject project = createMavenProject("group", "artifact", "1.0", null);
final Assembly assembly = new Assembly();
assembly.setRepositories(repositories);
final ResolutionManagementInfo info = new ResolutionManagementInfo(project);
resolver.updateRepositoryResolutionRequirements(assembly, info);
assertTrue(info.isResolutionRequired());
assertTrue(info.getScopeFilter().getIncluded().contains(Artifact.SCOPE_COMPILE));
assertTrue(info.getScopeFilter().getIncluded().contains(Artifact.SCOPE_SYSTEM));
assertTrue(info.getScopeFilter().getIncluded().contains(Artifact.SCOPE_PROVIDED));
assertFalse(info.getScopeFilter().getIncluded().contains(Artifact.SCOPE_RUNTIME));
assertFalse(info.getScopeFilter().getIncluded().contains(Artifact.SCOPE_TEST));
}
use of org.apache.maven.plugins.assembly.model.Assembly in project maven-plugins by apache.
the class AssemblyInterpolatorTest method testShouldInterpolateMultiDotProjectExpression.
public void testShouldInterpolateMultiDotProjectExpression() throws AssemblyInterpolationException, InvalidAssemblerConfigurationException, AssemblyReadException, IOException {
final Build build = new Build();
build.setFinalName("final-name");
final Model model = new Model();
model.setBuild(build);
final Assembly assembly = new Assembly();
assembly.setId("assembly.${project.build.finalName}");
final PojoConfigSource configSourceStub = new PojoConfigSource();
configSourceStub.setRootInterpolator(FixedStringSearchInterpolator.create());
configSourceStub.setEnvironmentInterpolator(FixedStringSearchInterpolator.create());
final MavenProject project = new MavenProject(model);
configSourceStub.setMavenProject(project);
final Assembly result = roundTripInterpolation(assembly, configSourceStub);
assertEquals("assembly.final-name", result.getId());
}
use of org.apache.maven.plugins.assembly.model.Assembly in project maven-plugins by apache.
the class DefaultAssemblyReaderTest method testReadAssembly_ShouldReadAssemblyWithSiteDirInclusionFromAssemblyWithoutComponentsOrInterpolation.
public void testReadAssembly_ShouldReadAssemblyWithSiteDirInclusionFromAssemblyWithoutComponentsOrInterpolation() throws IOException, AssemblyReadException, InvalidAssemblerConfigurationException {
final Assembly assembly = new Assembly();
assembly.setId("test");
assembly.setIncludeSiteDirectory(true);
final StringReader sr = writeToStringReader(assembly);
final File siteDir = fileManager.createTempDir();
expect(configSource.getSiteDirectory()).andReturn(siteDir).anyTimes();
final File basedir = fileManager.createTempDir();
expect(configSource.getBasedir()).andReturn(basedir).anyTimes();
final Model model = new Model();
model.setGroupId("group");
model.setArtifactId("artifact");
model.setVersion("version");
final MavenProject project = new MavenProject(model);
expect(configSource.getProject()).andReturn(project).anyTimes();
DefaultAssemblyArchiverTest.setupInterpolators(configSource);
mockManager.replayAll();
final Assembly result = new DefaultAssemblyReader().readAssembly(sr, "testLocation", null, configSource);
assertEquals(assembly.getId(), result.getId());
final List<FileSet> fileSets = result.getFileSets();
assertEquals(1, fileSets.size());
assertEquals("/site", fileSets.get(0).getOutputDirectory());
mockManager.verifyAll();
}
use of org.apache.maven.plugins.assembly.model.Assembly in project maven-plugins by apache.
the class DefaultAssemblyReaderTest method testReadAssemblies_ShouldGetAssemblyDescriptorFromDirectory.
public void testReadAssemblies_ShouldGetAssemblyDescriptorFromDirectory() 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();
writeAssembliesToFile(assemblies, basedir);
final List<Assembly> results = performReadAssemblies(basedir, null, null, basedir);
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());
}
Aggregations