use of org.apache.maven.plugins.assembly.testutils.PojoConfigSource in project maven-plugins by apache.
the class AssemblyInterpolatorTest method testShouldResolveModelPropertyBeforeModelGroupIdInAssemblyId.
public void testShouldResolveModelPropertyBeforeModelGroupIdInAssemblyId() 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 Properties props = new Properties();
props.setProperty("groupId", "other.id");
model.setProperties(props);
final PojoConfigSource configSourceStub = new PojoConfigSource();
configSourceStub.setRootInterpolator(FixedStringSearchInterpolator.create());
configSourceStub.setEnvironmentInterpolator(FixedStringSearchInterpolator.create());
final Assembly assembly = new Assembly();
assembly.setId("assembly.${groupId}");
final MavenProject project = new MavenProject(model);
configSourceStub.setMavenProject(project);
final Assembly result = roundTripInterpolation(assembly, configSourceStub);
assertEquals("assembly.other.id", result.getId());
}
use of org.apache.maven.plugins.assembly.testutils.PojoConfigSource in project maven-plugins by apache.
the class AssemblyInterpolatorTest method testDependencySetOutputDirectoryIsNotInterpolated.
public void testDependencySetOutputDirectoryIsNotInterpolated() throws IOException, AssemblyInterpolationException, AssemblyReadException, InvalidAssemblerConfigurationException {
final Model model = new Model();
model.setArtifactId("artifact-id");
model.setGroupId("group.id");
model.setVersion("1");
model.setPackaging("jar");
final Assembly assembly = new Assembly();
final String outputDirectory = "${artifactId}.${packaging}";
final DependencySet set = new DependencySet();
set.setOutputDirectory(outputDirectory);
assembly.addDependencySet(set);
final PojoConfigSource configSourceStub = new PojoConfigSource();
configSourceStub.setRootInterpolator(FixedStringSearchInterpolator.create());
configSourceStub.setEnvironmentInterpolator(FixedStringSearchInterpolator.create());
final MavenProject project = new MavenProject(model);
configSourceStub.setMavenProject(project);
final Assembly outputAssembly = roundTripInterpolation(assembly, configSourceStub);
final List<DependencySet> outputDependencySets = outputAssembly.getDependencySets();
assertEquals(1, outputDependencySets.size());
final DependencySet outputSet = outputDependencySets.get(0);
assertEquals("${artifactId}.${packaging}", outputSet.getOutputDirectory());
}
use of org.apache.maven.plugins.assembly.testutils.PojoConfigSource in project maven-plugins by apache.
the class ReaderFormatterTest method lineUnixFeedWithInterpolation.
@Test
public void lineUnixFeedWithInterpolation() throws IOException, AssemblyFormattingException {
final PojoConfigSource cfg = getPojoConfigSource();
InputStreamTransformer fileSetTransformers = ReaderFormatter.getFileSetTransformers(cfg, true, "unix");
InputStream fud = fileSetTransformers.transform(dummyResource(), payload("This is a test for project: ${artifactId} @artifactId@."));
assertEquals("This is a test for project: anArtifact anArtifact.", readResultStream(fud));
}
use of org.apache.maven.plugins.assembly.testutils.PojoConfigSource in project maven-plugins by apache.
the class AssemblyInterpolatorTest method testShouldResolveModelGroupIdInAssemblyId.
public void testShouldResolveModelGroupIdInAssemblyId() 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.${groupId}");
final MavenProject project = new MavenProject(model);
final PojoConfigSource configSourceStub = new PojoConfigSource();
configSourceStub.setRootInterpolator(FixedStringSearchInterpolator.create());
configSourceStub.setEnvironmentInterpolator(FixedStringSearchInterpolator.create());
configSourceStub.setMavenProject(project);
final Assembly outputAssembly = roundTripInterpolation(assembly, configSourceStub);
assertEquals("assembly.group.id", outputAssembly.getId());
}
use of org.apache.maven.plugins.assembly.testutils.PojoConfigSource in project maven-plugins by apache.
the class AssemblyInterpolatorTest method testDependencySetOutputFileNameMappingsAreNotInterpolated.
public void testDependencySetOutputFileNameMappingsAreNotInterpolated() throws IOException, AssemblyInterpolationException, AssemblyReadException, InvalidAssemblerConfigurationException {
final Model model = new Model();
model.setArtifactId("artifact-id");
model.setGroupId("group.id");
model.setVersion("1");
model.setPackaging("jar");
final MavenProject project = new MavenProject(model);
final Assembly assembly = new Assembly();
// artifactId is blacklisted, but packaging is not.
final String outputFileNameMapping = "${artifactId}.${packaging}";
final DependencySet set = new DependencySet();
set.setOutputFileNameMapping(outputFileNameMapping);
assembly.addDependencySet(set);
final PojoConfigSource configSourceStub = new PojoConfigSource();
configSourceStub.setRootInterpolator(FixedStringSearchInterpolator.create());
configSourceStub.setEnvironmentInterpolator(FixedStringSearchInterpolator.create());
configSourceStub.setMavenProject(project);
final Assembly outputAssembly = roundTripInterpolation(assembly, configSourceStub);
final List<DependencySet> outputDependencySets = outputAssembly.getDependencySets();
assertEquals(1, outputDependencySets.size());
final DependencySet outputSet = outputDependencySets.get(0);
assertEquals("${artifactId}.${packaging}", outputSet.getOutputFileNameMapping());
}
Aggregations