use of org.codehaus.plexus.archiver.zip.ZipFile in project aries by apache.
the class EsaMojoTest method testManifestSubsystemContentContainsAllTransitiveDependencies.
public void testManifestSubsystemContentContainsAllTransitiveDependencies() throws Exception {
File testPom = new File(getBasedir(), "target/test-classes/unit/basic-esa-content-type-all-transitive/plugin-config.xml");
EsaMojo mojo = (EsaMojo) lookupMojo("esa", testPom);
assertNotNull(mojo);
String finalName = (String) getVariableValueFromObject(mojo, "finalName");
String workDir = (String) getVariableValueFromObject(mojo, "workDirectory");
String outputDir = (String) getVariableValueFromObject(mojo, "outputDirectory");
mojo.execute();
// check the generated esa file
File esaFile = new File(outputDir, finalName + ".esa");
assertTrue(esaFile.exists());
ZipFile esa = new ZipFile(esaFile);
Manifest mf = getSubsystemManifest(esa);
Map<String, Map<String, String>> header = getHeader(mf, "Subsystem-Content");
System.out.println(header);
Map<String, String> attributes = null;
attributes = header.get("maven-artifact01-1.0-SNAPSHOT");
assertNotNull(attributes);
assertEquals("[1.0.0.SNAPSHOT,1.0.0.SNAPSHOT]", attributes.get("version"));
assertNull(attributes.get("type"));
attributes = header.get("maven-artifact02-1.0-SNAPSHOT");
assertNotNull(attributes);
assertEquals("[1.0.0.SNAPSHOT,1.0.0.SNAPSHOT]", attributes.get("version"));
assertNull(attributes.get("type"));
attributes = header.get("maven-artifact03");
assertNotNull(attributes);
assertEquals("[1.1.0.SNAPSHOT.NNN,1.1.0.SNAPSHOT.NNN]", attributes.get("version"));
assertEquals("osgi.fragment", attributes.get("type"));
assertEquals(3, header.size());
}
use of org.codehaus.plexus.archiver.zip.ZipFile in project aries by apache.
the class EsaMojoTest method testArchiveContentConfigurationNoBundles.
public void testArchiveContentConfigurationNoBundles() throws Exception {
File testPom = new File(getBasedir(), "target/test-classes/unit/basic-esa-no-bundles/plugin-config.xml");
EsaMojo mojo = (EsaMojo) lookupMojo("esa", testPom);
assertNotNull(mojo);
String finalName = (String) getVariableValueFromObject(mojo, "finalName");
String workDir = (String) getVariableValueFromObject(mojo, "workDirectory");
String outputDir = (String) getVariableValueFromObject(mojo, "outputDirectory");
mojo.execute();
//check the generated esa file
File esaFile = new File(outputDir, finalName + ".esa");
assertTrue(esaFile.exists());
//expected files/directories inside the esa file
List expectedFiles = new ArrayList();
expectedFiles.add("META-INF/maven/org.apache.maven.test/maven-esa-test/pom.properties");
expectedFiles.add("META-INF/maven/org.apache.maven.test/maven-esa-test/pom.xml");
expectedFiles.add("META-INF/maven/org.apache.maven.test/maven-esa-test/");
expectedFiles.add("META-INF/maven/org.apache.maven.test/");
expectedFiles.add("META-INF/maven/");
expectedFiles.add("META-INF/");
expectedFiles.add("OSGI-INF/SUBSYSTEM.MF");
expectedFiles.add("OSGI-INF/");
ZipFile esa = new ZipFile(esaFile);
Enumeration entries = esa.getEntries();
assertTrue(entries.hasMoreElements());
int missing = getSizeOfExpectedFiles(entries, expectedFiles);
assertEquals("Missing files: " + expectedFiles, 0, missing);
}
use of org.codehaus.plexus.archiver.zip.ZipFile in project aries by apache.
the class EsaMojoTest method testBasicEsaWithManifest.
public void testBasicEsaWithManifest() throws Exception {
File testPom = new File(getBasedir(), "target/test-classes/unit/basic-esa-with-manifest/plugin-config.xml");
EsaMojo mojo = (EsaMojo) lookupMojo("esa", testPom);
assertNotNull(mojo);
String finalName = (String) getVariableValueFromObject(mojo, "finalName");
String workDir = (String) getVariableValueFromObject(mojo, "workDirectory");
String outputDir = (String) getVariableValueFromObject(mojo, "outputDirectory");
mojo.execute();
//check the generated esa file
File esaFile = new File(outputDir, finalName + ".esa");
assertTrue(esaFile.exists());
//expected files/directories inside the esa file
List expectedFiles = new ArrayList();
expectedFiles.add("META-INF/maven/org.apache.maven.test/maven-esa-test/pom.properties");
expectedFiles.add("META-INF/maven/org.apache.maven.test/maven-esa-test/pom.xml");
expectedFiles.add("META-INF/maven/org.apache.maven.test/maven-esa-test/");
expectedFiles.add("META-INF/maven/org.apache.maven.test/");
expectedFiles.add("META-INF/maven/");
expectedFiles.add("META-INF/");
expectedFiles.add("META-INF/MANIFEST.MF");
expectedFiles.add("OSGI-INF/SUBSYSTEM.MF");
expectedFiles.add("OSGI-INF/");
expectedFiles.add("maven-artifact01-1.0-SNAPSHOT.jar");
expectedFiles.add("maven-artifact02-1.0-SNAPSHOT.jar");
ZipFile esa = new ZipFile(esaFile);
Enumeration entries = esa.getEntries();
assertTrue(entries.hasMoreElements());
int missing = getSizeOfExpectedFiles(entries, expectedFiles);
assertEquals("Missing files: " + expectedFiles, 0, missing);
}
use of org.codehaus.plexus.archiver.zip.ZipFile in project aries by apache.
the class EsaMojoTest method testArchiveContentConfigurationSubsystemContentAll.
public void testArchiveContentConfigurationSubsystemContentAll() throws Exception {
File testPom = new File(getBasedir(), "target/test-classes/unit/basic-esa-content-all-transitive/plugin-config.xml");
EsaMojo mojo = (EsaMojo) lookupMojo("esa", testPom);
assertNotNull(mojo);
String finalName = (String) getVariableValueFromObject(mojo, "finalName");
String workDir = (String) getVariableValueFromObject(mojo, "workDirectory");
String outputDir = (String) getVariableValueFromObject(mojo, "outputDirectory");
mojo.execute();
//check the generated esa file
File esaFile = new File(outputDir, finalName + ".esa");
assertTrue(esaFile.exists());
//expected files/directories inside the esa file
List expectedFiles = new ArrayList();
expectedFiles.add("META-INF/maven/org.apache.maven.test/maven-esa-test/pom.properties");
expectedFiles.add("META-INF/maven/org.apache.maven.test/maven-esa-test/pom.xml");
expectedFiles.add("META-INF/maven/org.apache.maven.test/maven-esa-test/");
expectedFiles.add("META-INF/maven/org.apache.maven.test/");
expectedFiles.add("META-INF/maven/");
expectedFiles.add("META-INF/");
expectedFiles.add("OSGI-INF/SUBSYSTEM.MF");
expectedFiles.add("OSGI-INF/");
expectedFiles.add("maven-artifact01-1.0-SNAPSHOT.jar");
expectedFiles.add("maven-artifact02-1.0-SNAPSHOT.jar");
expectedFiles.add("maven-artifact03-1.1-SNAPSHOT.jar");
ZipFile esa = new ZipFile(esaFile);
Enumeration entries = esa.getEntries();
assertTrue(entries.hasMoreElements());
int missing = getSizeOfExpectedFiles(entries, expectedFiles);
assertEquals("Missing files: " + expectedFiles, 0, missing);
}
use of org.codehaus.plexus.archiver.zip.ZipFile in project aries by apache.
the class EsaMojoTest method testBasicEsaWithoutNonBundleJars.
public void testBasicEsaWithoutNonBundleJars() throws Exception {
File testPom = new File(getBasedir(), "target/test-classes/unit/basic-esa-exclude-non-bundle-jars/plugin-config.xml");
EsaMojo mojo = (EsaMojo) lookupMojo("esa", testPom);
assertNotNull(mojo);
String finalName = (String) getVariableValueFromObject(mojo, "finalName");
String workDir = (String) getVariableValueFromObject(mojo, "workDirectory");
String outputDir = (String) getVariableValueFromObject(mojo, "outputDirectory");
mojo.execute();
//check the generated esa file
File esaFile = new File(outputDir, finalName + ".esa");
assertTrue(esaFile.exists());
//expected files/directories inside the esa file
List expectedFiles = new ArrayList();
expectedFiles.add("maven-artifact01-1.0-SNAPSHOT.jar");
expectedFiles.add("META-INF/maven/org.apache.maven.test/maven-esa-test/pom.properties");
expectedFiles.add("META-INF/maven/org.apache.maven.test/maven-esa-test/pom.xml");
expectedFiles.add("META-INF/maven/org.apache.maven.test/maven-esa-test/");
expectedFiles.add("META-INF/maven/org.apache.maven.test/");
expectedFiles.add("META-INF/maven/");
expectedFiles.add("META-INF/");
expectedFiles.add("OSGI-INF/SUBSYSTEM.MF");
expectedFiles.add("OSGI-INF/");
ZipFile esa = new ZipFile(esaFile);
Enumeration entries = esa.getEntries();
assertTrue(entries.hasMoreElements());
int missing = getSizeOfExpectedFiles(entries, expectedFiles);
assertEquals("Missing files: " + expectedFiles, 0, missing);
}
Aggregations