Search in sources :

Example 6 with MavenProjectResourcesStub

use of org.apache.maven.plugin.resources.remote.stub.MavenProjectResourcesStub in project maven-plugins by apache.

the class RemoteResourcesMojoTest method testNoBundles.

public void testNoBundles() throws Exception {
    final MavenProjectResourcesStub project = createTestProject("default-nobundles");
    final ProcessRemoteResourcesMojo mojo = lookupProcessMojoWithDefaultSettings(project);
    setupDefaultProject(project);
    mojo.execute();
}
Also used : MavenProjectResourcesStub(org.apache.maven.plugin.resources.remote.stub.MavenProjectResourcesStub)

Example 7 with MavenProjectResourcesStub

use of org.apache.maven.plugin.resources.remote.stub.MavenProjectResourcesStub in project maven-plugins by apache.

the class RemoteResourcesMojoTest method testSimpleBundles.

public void testSimpleBundles() throws Exception {
    final MavenProjectResourcesStub project = createTestProject("default-simplebundles");
    final ProcessRemoteResourcesMojo mojo = lookupProcessMojoWithSettings(project, new String[] { "test:test:1.0" });
    setupDefaultProject(project);
    ArtifactRepository repo = (ArtifactRepository) getVariableValueFromObject(mojo, "localRepository");
    String path = repo.pathOf(new DefaultArtifact("test", "test", VersionRange.createFromVersion("1.0"), null, "jar", "", new DefaultArtifactHandler()));
    File file = new File(repo.getBasedir() + "/" + path + ".jar");
    file.getParentFile().mkdirs();
    buildResourceBundle("default-simplebundles-create", null, new String[] { "SIMPLE.txt" }, file);
    mojo.execute();
    file = (File) getVariableValueFromObject(mojo, "outputDirectory");
    file = new File(file, "SIMPLE.txt");
    assertTrue(file.exists());
}
Also used : MavenProjectResourcesStub(org.apache.maven.plugin.resources.remote.stub.MavenProjectResourcesStub) DefaultArtifactHandler(org.apache.maven.artifact.handler.DefaultArtifactHandler) ArtifactRepository(org.apache.maven.artifact.repository.ArtifactRepository) File(java.io.File) DefaultArtifact(org.apache.maven.artifact.DefaultArtifact)

Example 8 with MavenProjectResourcesStub

use of org.apache.maven.plugin.resources.remote.stub.MavenProjectResourcesStub in project maven-plugins by apache.

the class RemoteResourcesMojoTest method testFilteredBundles.

public void testFilteredBundles() throws Exception {
    final MavenProjectResourcesStub project = createTestProject("default-filterbundles");
    final ProcessRemoteResourcesMojo mojo = lookupProcessMojoWithSettings(project, new String[] { "test:test:1.1" });
    setupDefaultProject(project);
    ArtifactRepository repo = (ArtifactRepository) getVariableValueFromObject(mojo, "localRepository");
    String path = repo.pathOf(new DefaultArtifact("test", "test", VersionRange.createFromVersion("1.1"), null, "jar", "", new DefaultArtifactHandler()));
    File file = new File(repo.getBasedir() + "/" + path + ".jar");
    file.getParentFile().mkdirs();
    buildResourceBundle("default-filterbundles-create", null, new String[] { "FILTER.txt.vm" }, file);
    mojo.execute();
    // executing a second time (example: forked lifecycle) should still work
    mojo.execute();
    file = (File) getVariableValueFromObject(mojo, "outputDirectory");
    file = new File(file, "FILTER.txt");
    assertTrue(file.exists());
    String data = FileUtils.fileRead(file);
    assertTrue(data.contains("2007"));
    assertTrue(data.contains("default-filterbundles"));
}
Also used : MavenProjectResourcesStub(org.apache.maven.plugin.resources.remote.stub.MavenProjectResourcesStub) DefaultArtifactHandler(org.apache.maven.artifact.handler.DefaultArtifactHandler) ArtifactRepository(org.apache.maven.artifact.repository.ArtifactRepository) File(java.io.File) DefaultArtifact(org.apache.maven.artifact.DefaultArtifact)

Example 9 with MavenProjectResourcesStub

use of org.apache.maven.plugin.resources.remote.stub.MavenProjectResourcesStub in project maven-plugins by apache.

the class RemoteResourcesMojoTest method testSimpleBundlesWithClassifier.

public void testSimpleBundlesWithClassifier() throws Exception {
    final MavenProjectResourcesStub project = createTestProject("default-simplebundles");
    final ProcessRemoteResourcesMojo mojo = lookupProcessMojoWithSettings(project, new String[] { "test:test:1.0:jar:test" });
    setupDefaultProject(project);
    ArtifactRepository repo = (ArtifactRepository) getVariableValueFromObject(mojo, "localRepository");
    String path = repo.pathOf(new DefaultArtifact("test", "test", VersionRange.createFromVersion("1.0"), null, "jar", "test", new DefaultArtifactHandler()));
    File file = new File(repo.getBasedir() + "/" + path + ".jar");
    file.getParentFile().mkdirs();
    buildResourceBundle("default-simplebundles-create", null, new String[] { "SIMPLE.txt" }, file);
    mojo.execute();
    file = (File) getVariableValueFromObject(mojo, "outputDirectory");
    file = new File(file, "SIMPLE.txt");
    assertTrue(file.exists());
}
Also used : MavenProjectResourcesStub(org.apache.maven.plugin.resources.remote.stub.MavenProjectResourcesStub) DefaultArtifactHandler(org.apache.maven.artifact.handler.DefaultArtifactHandler) ArtifactRepository(org.apache.maven.artifact.repository.ArtifactRepository) File(java.io.File) DefaultArtifact(org.apache.maven.artifact.DefaultArtifact)

Aggregations

MavenProjectResourcesStub (org.apache.maven.plugin.resources.remote.stub.MavenProjectResourcesStub)9 File (java.io.File)8 DefaultArtifact (org.apache.maven.artifact.DefaultArtifact)7 DefaultArtifactHandler (org.apache.maven.artifact.handler.DefaultArtifactHandler)7 ArtifactRepository (org.apache.maven.artifact.repository.ArtifactRepository)7 FileInputStream (java.io.FileInputStream)3 InputStream (java.io.InputStream)3 FileOutputStream (java.io.FileOutputStream)1 URL (java.net.URL)1 JarOutputStream (java.util.jar.JarOutputStream)1 ZipEntry (java.util.zip.ZipEntry)1