use of java.util.Stack in project maven-plugins by apache.
the class BundleCreateMojoTest method testDefaultconfiguration_RemoveTwoWithSpace.
public void testDefaultconfiguration_RemoveTwoWithSpace() throws Exception {
try {
createTestJars("default-configuration", true, true, getBasedir() + "/target/test/unit/default-configuration/target");
} catch (IOException ie) {
ie.printStackTrace();
}
File testPom = new File(getBasedir(), "src/test/resources/unit/default-configuration/pom.xml");
try {
BundleCreateMojo mojo = (BundleCreateMojo) lookupMojo("bundle-create", testPom);
// 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);
mojo.execute();
} catch (Exception e) {
e.printStackTrace();
}
File bundleSource = new File(getBasedir(), "target/test/unit/default-configuration/target/default-configuration-bundle.jar");
assertTrue(FileUtils.fileExists(bundleSource.getAbsolutePath()));
Set<String> entryNames = new HashSet<String>();
entryNames.add("default-configuration.jar");
entryNames.add("pom.xml");
entryNames.add("META-INF/MANIFEST.MF");
entryNames.add("META-INF/");
Set<String> bannedNames = new HashSet<String>();
bannedNames.add("default-configuration-javadoc.jar");
bannedNames.add("default-configuration-sources.jar");
assertZipContents(entryNames, bannedNames, bundleSource);
}
use of java.util.Stack in project maven-plugins by apache.
the class BundleCreateMojoTest method testDefaultconfiguration_RemoveOne.
public void testDefaultconfiguration_RemoveOne() throws Exception {
try {
createTestJars("default-configuration", true, true, getBasedir() + "/target/test/unit/default-configuration/target");
} catch (IOException ie) {
ie.printStackTrace();
}
File testPom = new File(getBasedir(), "src/test/resources/unit/default-configuration/pom.xml");
try {
BundleCreateMojo mojo = (BundleCreateMojo) lookupMojo("bundle-create", testPom);
// 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");
ih.setLineResponses(responses);
mojo.execute();
} catch (Exception e) {
e.printStackTrace();
}
File bundleSource = new File(getBasedir(), "target/test/unit/default-configuration/target/default-configuration-bundle.jar");
assertTrue(FileUtils.fileExists(bundleSource.getAbsolutePath()));
Set<String> entryNames = new HashSet<String>();
entryNames.add("default-configuration-sources.jar");
entryNames.add("default-configuration.jar");
entryNames.add("pom.xml");
entryNames.add("META-INF/MANIFEST.MF");
entryNames.add("META-INF/");
Set<String> bannedNames = new HashSet<String>();
bannedNames.add("default-configuration-javadoc.jar");
assertZipContents(entryNames, bannedNames, bundleSource);
}
use of java.util.Stack in project maven-plugins by apache.
the class BundleCreateMojoTest method testDefaultconfiguration_RemoveTwoUnordered.
public void testDefaultconfiguration_RemoveTwoUnordered() throws Exception {
try {
createTestJars("default-configuration", true, true, getBasedir() + "/target/test/unit/default-configuration/target");
} catch (IOException ie) {
ie.printStackTrace();
}
File testPom = new File(getBasedir(), "src/test/resources/unit/default-configuration/pom.xml");
try {
BundleCreateMojo mojo = (BundleCreateMojo) lookupMojo("bundle-create", testPom);
// NOTE: This is sensitive to the lookupMojo method timing...
TestInputHandler ih = (TestInputHandler) lookup(InputHandler.ROLE, "default");
Stack<String> responses = new Stack<String>();
responses.push("3,2");
ih.setLineResponses(responses);
mojo.execute();
} catch (Exception e) {
e.printStackTrace();
}
File bundleSource = new File(getBasedir(), "target/test/unit/default-configuration/target/default-configuration-bundle.jar");
assertTrue(FileUtils.fileExists(bundleSource.getAbsolutePath()));
Set<String> entryNames = new HashSet<String>();
entryNames.add("default-configuration.jar");
entryNames.add("pom.xml");
entryNames.add("META-INF/MANIFEST.MF");
entryNames.add("META-INF/");
Set<String> bannedNames = new HashSet<String>();
bannedNames.add("default-configuration-javadoc.jar");
bannedNames.add("default-configuration-sources.jar");
assertZipContents(entryNames, bannedNames, bundleSource);
}
use of java.util.Stack in project maven-plugins by apache.
the class BundlePackMojoTest method testPack_RemoveTwo.
public void testPack_RemoveTwo() 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 java.util.Stack in project maven-plugins by apache.
the class BundlePackMojoTest method testPack_RemoveTwoUnordered.
public void testPack_RemoveTwoUnordered() 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("3,2");
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);
}
Aggregations