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);
}
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);
}
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());
}
Aggregations