use of org.apache.maven.plugins.assembly.testutils.PojoConfigSource in project maven-plugins by apache.
the class ReaderFormatterTest method lineDosFeed_withoutFiltering.
@Test
public void lineDosFeed_withoutFiltering() throws IOException, AssemblyFormattingException {
final PojoConfigSource cfg = getPojoConfigSource();
InputStreamTransformer fileSetTransformers = ReaderFormatter.getFileSetTransformers(cfg, false, "dos");
InputStream fud = fileSetTransformers.transform(dummyResource(), payload("This is a\ntest."));
assertEquals("This is a\r\ntest.", readResultStream(fud));
}
use of org.apache.maven.plugins.assembly.testutils.PojoConfigSource in project maven-plugins by apache.
the class ReaderFormatterTest method getPojoConfigSource.
private PojoConfigSource getPojoConfigSource() {
final PojoConfigSource cfg = new PojoConfigSource();
cfg.setEncoding("UTF-8");
DefaultMavenReaderFilter mavenReaderFilter = new DefaultMavenReaderFilter();
mavenReaderFilter.enableLogging(new ConsoleLogger(2, "fud"));
cfg.setMavenReaderFilter(mavenReaderFilter);
cfg.setEscapeString(null);
cfg.setMavenProject(createBasicMavenProject());
/* expect( configSource.getFilters()).andReturn( filters );
expect( configSource.isIncludeProjectBuildFilters()).andReturn( includeProjectBuildFilters );
expect( configSource.getDelimiters()).andReturn( delimiters );
*/
return cfg;
}
use of org.apache.maven.plugins.assembly.testutils.PojoConfigSource in project maven-plugins by apache.
the class AssemblyInterpolatorTest method testShouldResolveContextValueBeforeModelPropertyOrModelGroupIdInAssemblyId.
public void testShouldResolveContextValueBeforeModelPropertyOrModelGroupIdInAssemblyId() 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 Assembly assembly = new Assembly();
assembly.setId("assembly.${groupId}");
final EasyMockSupport mm = new EasyMockSupport();
final MavenSession session = mm.createMock(MavenSession.class);
final Properties execProps = new Properties();
execProps.setProperty("groupId", "still.another.id");
expect(session.getExecutionProperties()).andReturn(execProps).anyTimes();
expect(session.getUserProperties()).andReturn(new Properties()).anyTimes();
final PojoConfigSource cs = new PojoConfigSource();
final ArtifactRepository lr = mm.createMock(ArtifactRepository.class);
cs.setLocalRepository(lr);
cs.setMavenSession(session);
cs.setRootInterpolator(FixedStringSearchInterpolator.create());
cs.setEnvironmentInterpolator(FixedStringSearchInterpolator.create(new PropertiesBasedValueSource(execProps)));
cs.setEnvInterpolator(FixedStringSearchInterpolator.empty());
expect(lr.getBasedir()).andReturn("/path/to/local/repo").anyTimes();
mm.replayAll();
final MavenProject project = new MavenProject(model);
cs.setMavenProject(project);
final Assembly result = roundTripInterpolation(assembly, cs);
assertEquals("assembly.still.another.id", result.getId());
mm.verifyAll();
mm.resetAll();
}
use of org.apache.maven.plugins.assembly.testutils.PojoConfigSource 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.testutils.PojoConfigSource 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());
}
Aggregations