Search in sources :

Example 11 with DefaultArtifactRepository

use of org.apache.maven.artifact.repository.DefaultArtifactRepository in project maven-plugins by apache.

the class BundlePackMojoTest method testPack_PomPackaging.

public void testPack_PomPackaging() throws Exception {
    File testPom = new File(getBasedir(), "src/test/resources/unit/bundle-pack-parent/pom.xml");
    BundlePackMojo mojo = (BundlePackMojo) lookupMojo("bundle-pack", testPom);
    URL repoURL = new File(getBasedir(), "src/test/resources/repo").toURL();
    mojo.localRepository = new DefaultArtifactRepository("test", repoURL.toString(), new DefaultRepositoryLayout());
    File generatedFilesDir = new File(getBasedir(), "target/bundle-pack-parent-tests");
    mojo.basedir = generatedFilesDir.getAbsolutePath();
    // NOTE: This is sensitive to the lookupMojo method timing...
    TestInputHandler ih = (TestInputHandler) lookup(InputHandler.ROLE, "default");
    Stack<String> responses = new Stack<String>();
    responses.push("http://foo/");
    responses.push("scm:svn:http://foo/");
    responses.push("2,3");
    responses.push("0");
    ih.setLineResponses(responses);
    mojo.execute();
    File bundleSource = new File(generatedFilesDir, "testparent-1.0-bundle.jar");
    Set<String> entryNames = new HashSet<String>();
    entryNames.add("pom.xml");
    entryNames.add("META-INF/MANIFEST.MF");
    entryNames.add("META-INF/");
    assertZipContents(entryNames, Assertions.EMPTY_ENTRY_NAMES, bundleSource);
}
Also used : DefaultArtifactRepository(org.apache.maven.artifact.repository.DefaultArtifactRepository) DefaultRepositoryLayout(org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout) File(java.io.File) TestInputHandler(org.apache.maven.plugins.repository.testutil.TestInputHandler) URL(java.net.URL) Stack(java.util.Stack) HashSet(java.util.HashSet)

Example 12 with DefaultArtifactRepository

use of org.apache.maven.artifact.repository.DefaultArtifactRepository in project maven-plugins by apache.

the class BundlePackMojoTest method testPack_RemoveTwoWithSpace.

public void testPack_RemoveTwoWithSpace() throws Exception {
    File testPom = new File(getBasedir(), "src/test/resources/unit/bundle-pack/pom.xml");
    BundlePackMojo mojo = (BundlePackMojo) lookupMojo("bundle-pack", testPom);
    URL repoURL = new File(getBasedir(), "src/test/resources/repo").toURL();
    mojo.localRepository = new DefaultArtifactRepository("test", repoURL.toString(), new DefaultRepositoryLayout());
    // NOTE: This is sensitive to the lookupMojo method timing...
    TestInputHandler ih = (TestInputHandler) lookup(InputHandler.ROLE, "default");
    Stack<String> responses = new Stack<String>();
    responses.push("2, 3");
    ih.setLineResponses(responses);
    File generatedFilesDir = new File(getBasedir(), "target/bundle-pack-tests");
    mojo.basedir = generatedFilesDir.getAbsolutePath();
    mojo.execute();
    File bundleSource = new File(generatedFilesDir, "testartifact-1.0-bundle.jar");
    Set<String> entryNames = new HashSet<String>();
    entryNames.add("testartifact-1.0.jar");
    entryNames.add("pom.xml");
    entryNames.add("META-INF/MANIFEST.MF");
    entryNames.add("META-INF/");
    Set<String> bannedNames = new HashSet<String>();
    // determined experimentally, so this could change!
    bannedNames.add("testartifact-1.0-sources.jar");
    bannedNames.add("testartifact-1.0-javadoc.jar");
    assertZipContents(entryNames, bannedNames, bundleSource);
}
Also used : DefaultArtifactRepository(org.apache.maven.artifact.repository.DefaultArtifactRepository) DefaultRepositoryLayout(org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout) File(java.io.File) TestInputHandler(org.apache.maven.plugins.repository.testutil.TestInputHandler) URL(java.net.URL) Stack(java.util.Stack) HashSet(java.util.HashSet)

Example 13 with DefaultArtifactRepository

use of org.apache.maven.artifact.repository.DefaultArtifactRepository in project cuke4duke by cucumber.

the class CucumberMojoTest method setUp.

@Before
public void setUp() {
    mojo = new CucumberMojo();
    mojo.launchDirectory = new File(".");
    mojo.mavenProject = new MavenProject();
    mojo.mavenProject.setFile(new File("../."));
    mojo.compileClasspathElements = new ArrayList<String>();
    mojo.pluginArtifacts = new ArrayList<Artifact>();
    mojo.testClasspathElements = new ArrayList<String>();
    mojo.localRepository = new DefaultArtifactRepository("", "", new DefaultRepositoryLayout());
}
Also used : MavenProject(org.apache.maven.project.MavenProject) DefaultArtifactRepository(org.apache.maven.artifact.repository.DefaultArtifactRepository) DefaultRepositoryLayout(org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout) File(java.io.File) Artifact(org.apache.maven.artifact.Artifact) Before(org.junit.Before)

Aggregations

DefaultArtifactRepository (org.apache.maven.artifact.repository.DefaultArtifactRepository)13 DefaultRepositoryLayout (org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout)10 File (java.io.File)8 URL (java.net.URL)6 HashSet (java.util.HashSet)6 Stack (java.util.Stack)5 TestInputHandler (org.apache.maven.plugins.repository.testutil.TestInputHandler)5 Artifact (org.apache.maven.artifact.Artifact)4 ArtifactRepository (org.apache.maven.artifact.repository.ArtifactRepository)4 IOException (java.io.IOException)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)2 DefaultArtifact (org.apache.maven.artifact.DefaultArtifact)2 ArtifactRepositoryLayout (org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout)2 ArtifactNotFoundException (org.apache.maven.artifact.resolver.ArtifactNotFoundException)2 ArtifactResolutionException (org.apache.maven.artifact.resolver.ArtifactResolutionException)2 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)2 MavenProject (org.apache.maven.project.MavenProject)2 ProcessCanceledException (com.intellij.openapi.progress.ProcessCanceledException)1 FileReader (java.io.FileReader)1 InvocationHandler (java.lang.reflect.InvocationHandler)1