You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by zo...@apache.org on 2011/02/27 21:20:30 UTC
svn commit: r1075132 [17/18] - in /aries/tags/application-0.3: ./
application-api/ application-api/src/ application-api/src/main/
application-api/src/main/java/ application-api/src/main/java/org/
application-api/src/main/java/org/apache/ application-ap...
Added: aries/tags/application-0.3/application-utils/src/test/java/org/apache/aries/application/impl/VersionRangeTest.java
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-utils/src/test/java/org/apache/aries/application/impl/VersionRangeTest.java?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-utils/src/test/java/org/apache/aries/application/impl/VersionRangeTest.java (added)
+++ aries/tags/application-0.3/application-utils/src/test/java/org/apache/aries/application/impl/VersionRangeTest.java Sun Feb 27 20:20:13 2011
@@ -0,0 +1,296 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIESOR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.aries.application.impl;
+
+import static org.junit.Assert.*;
+
+import org.apache.aries.application.VersionRange;
+import org.junit.Test;
+import org.osgi.framework.Version;
+
+public class VersionRangeTest
+{
+ /**
+ * Test the version range created correctly
+ * @throws Exception
+ */
+
+ @Test
+ public void testVersionRange() throws Exception {
+ String version1 = "[1.2.3, 4.5.6]";
+ String version2="(1, 2]";
+ String version3="[2,4)";
+ String version4="(1,2)";
+ String version5="2";
+ String version6 = "2.3";
+ String version7="[1.2.3.q, 2.3.4.p)";
+ String version8="1.2.2.5";
+ String version9="a.b.c";
+ String version10=null;
+ String version11="";
+ String version12="\"[1.2.3, 4.5.6]\"";
+
+ VersionRange vr = new VersionRangeImpl(version1);
+ assertEquals("The value is wrong", "1.2.3", vr.getMinimumVersion().toString());
+ assertFalse("The value is wrong", vr.isMinimumExclusive());
+ assertEquals("The value is wrong", "4.5.6", vr.getMaximumVersion().toString());
+ assertFalse("The value is wrong", vr.isMaximumExclusive());
+
+ vr = new VersionRangeImpl(version2);
+ assertEquals("The value is wrong", "1.0.0", vr.getMinimumVersion().toString());
+ assertTrue("The value is wrong", vr.isMinimumExclusive());
+ assertEquals("The value is wrong", "2.0.0", vr.getMaximumVersion().toString());
+ assertFalse("The value is wrong", vr.isMaximumExclusive());
+
+ vr = new VersionRangeImpl(version3);
+
+ assertEquals("The value is wrong", "2.0.0", vr.getMinimumVersion().toString());
+ assertFalse("The value is wrong", vr.isMinimumExclusive());
+ assertEquals("The value is wrong", "4.0.0", vr.getMaximumVersion().toString());
+ assertTrue("The value is wrong", vr.isMaximumExclusive());
+
+ vr = new VersionRangeImpl(version4);
+
+ assertEquals("The value is wrong", "1.0.0", vr.getMinimumVersion().toString());
+ assertTrue("The value is wrong", vr.isMinimumExclusive());
+ assertEquals("The value is wrong", "2.0.0", vr.getMaximumVersion().toString());
+ assertTrue("The value is wrong", vr.isMaximumExclusive());
+
+ vr = new VersionRangeImpl(version5);
+ assertEquals("The value is wrong", "2.0.0", vr.getMinimumVersion().toString());
+ assertFalse("The value is wrong", vr.isMinimumExclusive());
+ assertNull("The value is wrong", vr.getMaximumVersion());
+ assertFalse("The value is wrong", vr.isMaximumExclusive());
+
+ vr = new VersionRangeImpl(version6);
+ assertEquals("The value is wrong", "2.3.0", vr.getMinimumVersion().toString());
+ assertFalse("The value is wrong", vr.isMinimumExclusive());
+ assertNull("The value is wrong", vr.getMaximumVersion());
+ assertFalse("The value is wrong", vr.isMaximumExclusive());
+
+ vr = new VersionRangeImpl(version7);
+ assertEquals("The value is wrong", "1.2.3.q", vr.getMinimumVersion().toString());
+ assertFalse("The value is wrong", vr.isMinimumExclusive());
+ assertEquals("The value is wrong", "2.3.4.p", vr.getMaximumVersion().toString());
+ assertTrue("The value is wrong", vr.isMaximumExclusive());
+
+ vr = new VersionRangeImpl(version8);
+ assertEquals("The value is wrong", "1.2.2.5", vr.getMinimumVersion().toString());
+ assertFalse("The value is wrong", vr.isMinimumExclusive());
+ assertNull("The value is wrong", vr.getMaximumVersion());
+ assertFalse("The value is wrong", vr.isMaximumExclusive());
+ boolean exception = false;
+ try {
+ vr = new VersionRangeImpl(version9);
+ } catch (Exception e){
+ exception = true;
+ }
+
+ assertTrue("The value is wrong", exception);
+ boolean exceptionNull = false;
+ try {
+ vr = new VersionRangeImpl(version10);
+ } catch (Exception e){
+ exceptionNull = true;
+ }
+ assertTrue("The value is wrong", exceptionNull);
+ // empty version should be defaulted to >=0.0.0
+ vr = new VersionRangeImpl(version11);
+ assertEquals("The value is wrong", "0.0.0", vr.getMinimumVersion().toString());
+ assertFalse("The value is wrong", vr.isMinimumExclusive());
+ assertNull("The value is wrong", vr.getMaximumVersion());
+ assertFalse("The value is wrong", vr.isMaximumExclusive());
+
+ vr = new VersionRangeImpl(version12);
+ assertEquals("The value is wrong", "1.2.3", vr.getMinimumVersion().toString());
+ assertFalse("The value is wrong", vr.isMinimumExclusive());
+ assertEquals("The value is wrong", "4.5.6", vr.getMaximumVersion().toString());
+ assertFalse("The value is wrong", vr.isMaximumExclusive());
+ }
+
+ @Test
+ public void testInvalidVersions() throws Exception
+ {
+ try {
+ new VersionRangeImpl("a");
+ assertTrue("Should have thrown an exception", false);
+ } catch (IllegalArgumentException e) {
+ }
+
+ try {
+ new VersionRangeImpl("[1.0.0,1.0.1]", true);
+ assertTrue("Should have thrown an exception", false);
+ } catch (IllegalArgumentException e) {
+ }
+ }
+
+ @Test
+ public void testExactVersion() throws Exception
+ {
+ VersionRange vr;
+ try {
+ vr = new VersionRangeImpl("[1.0.0, 2.0.0]", true);
+ fail("from 1 to 2 not excludsive is not an exact range");
+ } catch (IllegalArgumentException e) {
+ // expected
+ }
+
+ vr = new VersionRangeImpl("[1.0.0, 1.0.0]", true);
+ assertTrue(vr.isExactVersion());
+
+ try {
+ vr = new VersionRangeImpl("(1.0.0, 1.0.0]", true);
+ fail("from 1 (not including 1) to 1, is not valid");
+ } catch (IllegalArgumentException e) {
+ // expected
+ }
+
+ try {
+ vr = new VersionRangeImpl("[1.0.0, 1.0.0)", true);
+ fail("sfrom 1 to 1 (not including 1), is not valid");
+ } catch (IllegalArgumentException e) {
+ // expected
+ }
+
+ vr = new VersionRangeImpl("1.0.0", true);
+ assertTrue(vr.isExactVersion());
+
+ vr = new VersionRangeImpl("1.0.0", false);
+ assertFalse(vr.isExactVersion());
+
+ vr = new VersionRangeImpl("[1.0.0, 2.0.0]");
+ assertFalse(vr.isExactVersion());
+
+ vr = new VersionRangeImpl("[1.0.0, 1.0.0]");
+ assertTrue(vr.isExactVersion());
+
+ vr = new VersionRangeImpl("1.0.0", true);
+ assertEquals(new Version("1.0.0"), vr.getMinimumVersion());
+ assertTrue(vr.isExactVersion());
+
+ vr = new VersionRangeImpl("1.0.0", false);
+ assertEquals(new Version("1.0.0"), vr.getMinimumVersion());
+ assertNull(vr.getMaximumVersion());
+ assertFalse(vr.isExactVersion());
+
+ // don't throw any silly exceptions
+ vr = new VersionRangeImpl("[1.0.0,2.0.0)", false);
+ assertFalse(vr.isExactVersion());
+
+ vr = new VersionRangeImpl("[1.0.0, 2.0.0]");
+ assertFalse(vr.isExactVersion());
+
+ vr = new VersionRangeImpl("[1.0.0, 1.0.0]");
+ assertTrue(vr.isExactVersion());
+
+ }
+
+ @Test
+ public void testMatches()
+ {
+ VersionRange vr = new VersionRangeImpl("[1.0.0, 2.0.0]");
+
+ assertFalse(vr.matches(new Version(0,9,0)));
+ assertFalse(vr.matches(new Version(2,1,0)));
+ assertTrue(vr.matches(new Version(2,0,0)));
+ assertTrue(vr.matches(new Version(1,0,0)));
+ assertTrue(vr.matches(new Version(1,5,0)));
+
+ vr = new VersionRangeImpl("[1.0.0, 2.0.0)");
+
+ assertFalse(vr.matches(new Version(0,9,0)));
+ assertFalse(vr.matches(new Version(2,1,0)));
+ assertFalse(vr.matches(new Version(2,0,0)));
+ assertTrue(vr.matches(new Version(1,0,0)));
+ assertTrue(vr.matches(new Version(1,5,0)));
+
+ vr = new VersionRangeImpl("(1.0.0, 2.0.0)");
+
+ assertFalse(vr.matches(new Version(0,9,0)));
+ assertFalse(vr.matches(new Version(2,1,0)));
+ assertFalse(vr.matches(new Version(2,0,0)));
+ assertFalse(vr.matches(new Version(1,0,0)));
+ assertTrue(vr.matches(new Version(1,5,0)));
+
+ vr = new VersionRangeImpl("[1.0.0, 1.0.0]");
+ assertFalse(vr.matches(new Version(0,9,0)));
+ assertFalse(vr.matches(new Version(2,0,0)));
+ assertTrue(vr.matches(new Version(1,0,0)));
+ assertFalse(vr.matches(new Version(1,5,0)));
+ assertFalse(vr.matches(new Version(1,9,9)));
+ }
+
+ @Test
+ public void testIntersectVersionRange_Valid1()
+ {
+ VersionRange v1 = new VersionRangeImpl("[1.0.0,3.0.0]");
+ VersionRange v2 = new VersionRangeImpl("[2.0.0,3.0.0)");
+ VersionRange result = v1.intersect(v2);
+ assertNotNull(result);
+ assertEquals("[2.0.0,3.0.0)", result.toString());
+ }
+
+ @Test
+ public void testIntersectVersionRange_Valid2()
+ {
+ VersionRange v1 = new VersionRangeImpl("[1.0.0,3.0.0)");
+ VersionRange v2 = new VersionRangeImpl("(2.0.0,3.0.0]");
+ VersionRange result = v1.intersect(v2);
+ assertNotNull(result);
+ assertEquals("(2.0.0,3.0.0)", result.toString());
+ }
+
+ @Test
+ public void testIntersectVersionRange_Valid3()
+ {
+ VersionRange v1 = new VersionRangeImpl("[2.0.0,2.0.0]");
+ VersionRange v2 = new VersionRangeImpl("[1.0.0,3.0.0]");
+ VersionRange result = v1.intersect(v2);
+ assertNotNull(result);
+ assertEquals("[2.0.0,2.0.0]", result.toString());
+ }
+
+ @Test
+ public void testIntersectVersionRange_Invalid1()
+ {
+ VersionRange v1 = new VersionRangeImpl("[1.0.0,2.0.0]");
+ VersionRange v2 = new VersionRangeImpl("(2.0.0,3.0.0]");
+ VersionRange result = v1.intersect(v2);
+ assertNull(result);
+ }
+
+ @Test
+ public void testIntersectVersionRange_Invalid2()
+ {
+ VersionRange v1 = new VersionRangeImpl("[1.0.0,2.0.0)");
+ VersionRange v2 = new VersionRangeImpl("[2.0.0,3.0.0]");
+ VersionRange result = v1.intersect(v2);
+ assertNull(result);
+ }
+
+ @Test
+ public void testIntersectVersionRange_Invalid3()
+ {
+ VersionRange v1 = new VersionRangeImpl("[1.0.0,1.0.0]");
+ VersionRange v2 = new VersionRangeImpl("[2.0.0,2.0.0]");
+ VersionRange result = v1.intersect(v2);
+ assertNull(result);
+ }
+
+}
\ No newline at end of file
Added: aries/tags/application-0.3/application-utils/src/test/java/org/apache/aries/application/utils/filesystem/FileSystemTest.java
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-utils/src/test/java/org/apache/aries/application/utils/filesystem/FileSystemTest.java?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-utils/src/test/java/org/apache/aries/application/utils/filesystem/FileSystemTest.java (added)
+++ aries/tags/application-0.3/application-utils/src/test/java/org/apache/aries/application/utils/filesystem/FileSystemTest.java Sun Feb 27 20:20:13 2011
@@ -0,0 +1,288 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIESOR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.aries.application.utils.filesystem;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Iterator;
+import java.util.List;
+import java.util.jar.Manifest;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipOutputStream;
+
+import org.apache.aries.application.filesystem.IDirectory;
+import org.apache.aries.application.filesystem.IFile;
+import org.apache.aries.application.utils.AppConstants;
+import org.apache.aries.unittest.junit.Assert;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+
+/**
+ * This class contains tests for the virtual file system.
+ */
+public class FileSystemTest
+{
+ /**
+ * Make sure we correctly understand the content of the application when the
+ * application is an exploded directory. This test just checks that the
+ * root directory returns the expected information.
+ *
+ * @throws IOException
+ */
+ @Test(expected=UnsupportedOperationException.class)
+ public void basicRootDirTestsWithFiles() throws IOException
+ {
+ File baseDir = new File("../src/test/resources/app1");
+ File manifest = new File(baseDir, AppConstants.APPLICATION_MF);
+ IDirectory dir = FileSystem.getFSRoot(baseDir);
+
+ runBasicRootDirTests(dir, baseDir.length(), manifest.lastModified());
+ }
+
+ /**
+ * Make sure we correctly understand the directory structure for exploded
+ * directories.
+ *
+ * @throws IOException
+ */
+ @Test
+ public void basicDirTestsWithFiles() throws IOException
+ {
+ File baseDir = new File("../src/test/resources/app1");
+ IDirectory dir = FileSystem.getFSRoot(baseDir);
+
+ File desiredFile = new File(baseDir, AppConstants.APPLICATION_MF);
+
+ runBasicDirTest(dir, desiredFile.length(), desiredFile.lastModified());
+ }
+
+ /**
+ * Make sure we correctly understand the content of the application when the
+ * application is a zip. This test just checks that the
+ * root directory returns the expected information.
+ *
+ * @throws IOException
+ */
+ @Test(expected=UnsupportedOperationException.class)
+ public void basicRootDirTestsWithZip() throws IOException
+ {
+ File baseDir = new File("fileSystemTest/app2.zip");
+ IDirectory dir = FileSystem.getFSRoot(baseDir);
+
+ runBasicRootDirTests(dir, baseDir.length(), baseDir.lastModified());
+ }
+
+ /**
+ * Make sure we correctly understand the directory structure for zips.
+ *
+ * @throws IOException
+ */
+ @Test
+ public void basicDirTestsWithZip() throws IOException
+ {
+ File baseDir = new File("fileSystemTest/app2.zip");
+ IDirectory dir = FileSystem.getFSRoot(baseDir);
+
+ File desiredFile = new File(new File("../src/test/resources/app1"), AppConstants.APPLICATION_MF);
+
+ runBasicDirTest(dir, desiredFile.length(), desiredFile.lastModified());
+ }
+
+ /**
+ * Zip up the app1 directory to create a zippped version before running any
+ * tests.
+ *
+ * @throws IOException
+ */
+ @BeforeClass
+ public static void makeZip() throws IOException
+ {
+ File zipFile = new File("fileSystemTest/app2.zip");
+ zipFile.getParentFile().mkdirs();
+ ZipOutputStream out = new ZipOutputStream(new FileOutputStream(zipFile));
+
+ int index = new File("../src/test/resources/app1").getAbsolutePath().length();
+
+ writeEnties(out, new File("../src/test/resources/app1"), index);
+
+ out.close();
+ }
+
+ /**
+ * Make sure the test zip is deleted afterwards.
+ */
+ @AfterClass
+ public static void destroyZip()
+ {
+ IOUtils.deleteRecursive(new File("fileSystemTest/"));
+ }
+
+ /**
+ * This method writes the given directory into the provided zip output stream.
+ * It removes the first <code>index</code> bytes from the absolute path name
+ * when building the zip.
+ *
+ * @param zos the zip output stream to use
+ * @param f the directory to write into the zip.
+ * @param index how much of the file name to chop off.
+ * @throws IOException
+ */
+ public static void writeEnties(ZipOutputStream zos, File f, int index) throws IOException {
+ File[] files = f.listFiles();
+
+ if (files != null) {
+ for (File file : files) {
+ String fileName = file.getAbsolutePath().substring(index + 1);
+
+ // Bug 1954: replace any '\' characters with '/' - required by ZipEntry
+ fileName = fileName.replace('\\', '/');
+
+ if (file.isDirectory()) fileName = fileName + "/";
+
+ ZipEntry ze = new ZipEntry(fileName);
+ ze.setSize(file.length());
+ ze.setTime(file.lastModified());
+ zos.putNextEntry(ze);
+
+ if (file.isFile()) {
+ InputStream is = new FileInputStream(file);
+ byte[] buffer = new byte[(int)file.length()];
+ int len = is.read(buffer);
+ zos.write(buffer, 0, len);
+ is.close(); // Bug 1594
+ }
+
+ zos.closeEntry();
+
+ if (file.isDirectory()) {
+ writeEnties(zos, file, index);
+ }
+ }
+ }
+ }
+
+ /**
+ * This method makes sure that the data is correctly understood from disk. It
+ * is called for both the file and zip versions of the test to ensure we have
+ * consistent results.
+ *
+ * @param dir The IDirectory for the root of the vFS.
+ * @param len The size of the file.
+ * @param time The time the file was last updated.
+ * @throws IOException
+ */
+ public void runBasicRootDirTests(IDirectory dir, long len, long time) throws IOException
+ {
+ assertEquals("The root file system name is not correct", "", dir.getName());
+ assertEquals("The size of the file is not correct", len, dir.getSize());
+
+ // This assertion just isn't working on Hudson as of build #79
+ // assertEquals("The last modified time of the file is not correct", time, dir.getLastModified());
+
+ assertNull("I managed to get a parent of a root", dir.getParent());
+ assertTrue("The root dir does not know it is a dir", dir.isDirectory());
+ assertFalse("The root dir has an identity crisis and thinks it is a file", dir.isFile());
+
+ dir.open();
+ }
+
+ /**
+ * This method makes sure that the data is correctly understood from disk. It
+ * is called for both the file and zip versions of the test to ensure we have
+ * consistent results.
+ *
+ * @param dir The IDirectory for the root of the vFS.
+ * @param len The size of the file.
+ * @param time The time the file was last updated.
+ * @throws IOException
+ */
+ public void runBasicDirTest(IDirectory dir, long len, long time) throws IOException
+ {
+ assertNull("for some reason our fake app has a fake blueprint file.", dir.getFile("OSGI-INF/blueprint/aries.xml"));
+
+ IFile file = dir.getFile(AppConstants.APPLICATION_MF);
+
+ assertNotNull("we could not find the application manifest", file);
+
+ assertEquals(AppConstants.APPLICATION_MF, file.getName().replace('\\', '/'));
+ assertTrue("The last update time is not within 2 seconds of the expected value. Expected: " + time + " Actual: " + file.getLastModified(), Math.abs(time - file.getLastModified()) < 2000);
+ assertEquals(len, file.getSize());
+ assertEquals("META-INF", file.getParent().getName());
+ assertFalse(file.isDirectory());
+ assertTrue(file.isFile());
+
+ List<IFile> files = dir.listFiles();
+ Iterator<IFile> it = files.iterator();
+ while (it.hasNext()) {
+ IFile f = it.next();
+ if (f.getName().equalsIgnoreCase(".svn")) {
+ it.remove();
+ }
+ }
+
+ assertEquals(1, files.size());
+ List<IFile> allFiles = dir.listAllFiles();
+ Iterator<IFile> its = allFiles.iterator();
+ while (its.hasNext()) {
+ IFile f = its.next();
+ if (f.getName().toLowerCase().contains(".svn")) {
+ its.remove();
+ }
+ }
+
+ assertEquals(3, allFiles.size());
+ IFile metaInf = files.get(0);
+
+ assertTrue(metaInf.isDirectory());
+ assertEquals("META-INF", metaInf.getName());
+ assertNotNull(metaInf.convert());
+
+ for (IFile aFile : dir) {
+ if (!aFile.getName().equalsIgnoreCase(".svn")) {
+ assertTrue(aFile.isDirectory());
+ assertEquals("META-INF", aFile.getName());
+ assertNotNull(aFile.convert());
+ }
+ }
+
+ InputStream is = file.open();
+
+ Manifest man = new Manifest(is);
+ //remember to close the input stream after use
+ is.close();
+ assertEquals("com.travel.reservation", man.getMainAttributes().getValue("Application-SymbolicName"));
+
+ IFile applicationMF2 = dir.getFile(AppConstants.APPLICATION_MF);
+
+ Assert.assertEqualsContract(file, applicationMF2, dir);
+ Assert.assertHashCodeEquals(file, applicationMF2, true);
+ }
+}
Added: aries/tags/application-0.3/application-utils/src/test/java/org/apache/aries/application/utils/filesystem/IOUtilsTest.java
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-utils/src/test/java/org/apache/aries/application/utils/filesystem/IOUtilsTest.java?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-utils/src/test/java/org/apache/aries/application/utils/filesystem/IOUtilsTest.java (added)
+++ aries/tags/application-0.3/application-utils/src/test/java/org/apache/aries/application/utils/filesystem/IOUtilsTest.java Sun Feb 27 20:20:13 2011
@@ -0,0 +1,231 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIESOR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.aries.application.utils.filesystem;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.StringBufferInputStream;
+import java.util.zip.ZipFile;
+
+import org.apache.aries.application.filesystem.IDirectory;
+import org.apache.aries.application.filesystem.IFile;
+import org.junit.AfterClass;
+import org.junit.Test;
+
+public class IOUtilsTest
+{
+ @AfterClass
+ public static void cleanUp()
+ {
+ new File("ioUtilsTest/test.zip").delete();
+ IOUtils.deleteRecursive(new File("ioUtilsTest"));
+ }
+
+ @Test
+ public void testZipUpAndUnzipAndDeleteRecursive() throws IOException
+ {
+ new File ("ioUtilsTest").mkdir();
+ IOUtils.zipUp(new File("../src/test/resources/zip"), new File("ioUtilsTest/test.zip"));
+
+ ZipFile zip = new ZipFile("ioUtilsTest/test.zip");
+ assertNotNull(zip.getEntry("file.txt"));
+ assertNotNull(zip.getEntry("subdir/someFile.txt"));
+ zip.close();
+
+ IDirectory dir = FileSystem.getFSRoot(new File("ioUtilsTest"));
+ IFile izip = dir.getFile("test.zip");
+ File output = new File("ioUtilsTest/zipout");
+ output.mkdirs();
+ IOUtils.unpackZip(izip, output);
+ File a = new File(output,"file.txt");
+ File b = new File(output,"subdir");
+ File c = new File(b,"someFile.txt");
+ assertTrue(output.exists());
+ assertTrue(a.exists() && a.isFile());
+ assertTrue(b.exists() && b.isDirectory());
+ assertTrue(c.exists() && c.isFile());
+
+ IOUtils.deleteRecursive(output);
+ assertFalse(output.exists());
+ }
+
+ @Test
+ public void testWriteOut() throws IOException
+ {
+ File tmpDir = new File("ioUtilsTest/tmp");
+ tmpDir.mkdir();
+
+ IOUtils.writeOut(tmpDir, "simple.txt", new StringBufferInputStream("abc"));
+ IOUtils.writeOut(tmpDir, "some/relative/directory/complex.txt", new StringBufferInputStream("def"));
+ IOUtils.writeOut(tmpDir, "some/relative/directory/complex2.txt", new StringBufferInputStream("ghi"));
+
+ File simple = new File("ioUtilsTest/tmp/simple.txt");
+ assertTrue(simple.exists());
+
+ File complex = new File("ioUtilsTest/tmp/some/relative/directory/complex.txt");
+ assertTrue(complex.exists());
+
+ File complex2 = new File("ioUtilsTest/tmp/some/relative/directory/complex2.txt");
+ assertTrue(complex2.exists());
+
+ BufferedReader r = new BufferedReader(new FileReader(simple));
+ assertEquals("abc", r.readLine());
+ assertNull(r.readLine());
+ r.close();
+
+ r = new BufferedReader(new FileReader(complex));
+ assertEquals("def", r.readLine());
+ assertNull(r.readLine());
+ r.close();
+
+ r = new BufferedReader(new FileReader(complex2));
+ assertEquals("ghi", r.readLine());
+ assertNull(r.readLine());
+ r.close();
+ }
+
+ @Test
+ public void testWriteOutAndDoNotCloseInputStream() throws IOException{
+ InputStream is = new InputStream(){
+ int idx=0;
+ int data[]=new int[]{1,2,3,4,5,-1};
+ @Override
+ public int read() throws IOException
+ {
+ if(idx<data.length)
+ return data[idx++];
+ else
+ return -1;
+ }
+ @Override
+ public void close() throws IOException
+ {
+ fail("Close was invoked");
+ }
+ };
+ File f = new File("ioUtilsTest/outtest1");
+ f.mkdirs();
+ IOUtils.writeOutAndDontCloseInputStream(f, "/fred", is);
+ File fred = new File(f,"/fred");
+ assertTrue(fred.exists());
+ File outtest = fred.getParentFile();
+ fred.delete();
+ outtest.delete();
+
+ }
+
+ @Test
+ public void testCopy() throws IOException{
+ InputStream is = new InputStream(){
+ boolean closed=false;
+ int idx=0;
+ int data[]=new int[]{1,2,3,4,5,-1};
+ @Override
+ public int read() throws IOException
+ {
+ if(idx<data.length)
+ return data[idx++];
+ else
+ return -1;
+ }
+ @Override
+ public void close() throws IOException
+ {
+ closed=true;
+ }
+ @Override
+ public int available() throws IOException
+ {
+ if(!closed)
+ return super.available();
+ else
+ return 123456789;
+ }
+
+ };
+
+ OutputStream os = new OutputStream(){
+ int idx=0;
+ int data[]=new int[]{1,2,3,4,5,-1};
+ @Override
+ public void write(int b) throws IOException
+ {
+ if(b!=data[idx++]){
+ fail("Data written to outputstream was not as expected");
+ }
+ }
+ };
+
+ IOUtils.copy(is,os);
+ if(is.available()!=123456789){
+ fail("close was not invoked");
+ }
+
+
+ }
+
+ @Test
+ public void testCopyAndDoNotClose() throws IOException{
+
+ InputStream is = new InputStream(){
+ int idx=0;
+ int data[]=new int[]{1,2,3,4,5,-1};
+ @Override
+ public int read() throws IOException
+ {
+ if(idx<data.length)
+ return data[idx++];
+ else
+ return -1;
+ }
+ @Override
+ public void close() throws IOException
+ {
+ fail("Close invoked");
+ }
+ };
+
+ OutputStream os = new OutputStream(){
+ int idx=0;
+ int data[]=new int[]{1,2,3,4,5,-1};
+ @Override
+ public void write(int b) throws IOException
+ {
+ if(b!=data[idx++]){
+ fail("Data written to outputstream was not as expected");
+ }
+ }
+ };
+
+ IOUtils.copyAndDoNotCloseInputStream(is,os);
+
+ }
+}
Added: aries/tags/application-0.3/application-utils/src/test/java/org/apache/aries/application/utils/manifest/BundleManifestTest.java
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-utils/src/test/java/org/apache/aries/application/utils/manifest/BundleManifestTest.java?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-utils/src/test/java/org/apache/aries/application/utils/manifest/BundleManifestTest.java (added)
+++ aries/tags/application-0.3/application-utils/src/test/java/org/apache/aries/application/utils/manifest/BundleManifestTest.java Sun Feb 27 20:20:13 2011
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIESOR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.aries.application.utils.manifest;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.util.jar.JarInputStream;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipOutputStream;
+
+import org.apache.aries.application.utils.filesystem.IOUtils;
+import org.apache.aries.application.utils.manifest.BundleManifest;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class BundleManifestTest
+{
+ private static File _testfile;
+
+ @BeforeClass
+ public static void setup() throws Exception
+ {
+ _testfile = new File ("./bundleManifestTest/nonExploded.jar");
+ _testfile.getParentFile().mkdirs();
+
+ ZipOutputStream out = new ZipOutputStream(new FileOutputStream(_testfile));
+ ZipEntry ze = new ZipEntry("META-INF/");
+ out.putNextEntry(ze);
+
+ File f = new File("../src/test/resources/bundles/exploded.jar/META-INF/beforeManifest.file");
+ ze = new ZipEntry("META-INF/beforeManifest.file");
+ ze.setSize(f.length());
+ out.putNextEntry(ze);
+ IOUtils.copy(new FileInputStream(f), out);
+
+ f = new File("../src/test/resources/bundles/exploded.jar/META-INF/MANIFEST.MF");
+ ze = new ZipEntry("META-INF/MANIFEST.MF");
+ ze.setSize(f.length());
+ out.putNextEntry(ze);
+ IOUtils.copy(new FileInputStream(f), out);
+
+ out.close();
+ }
+
+ @AfterClass
+ public static void cleanup()
+ {
+ IOUtils.deleteRecursive(new File("bundleManifestTest/"));
+ }
+
+ @Test
+ public void testExploded()
+ {
+ BundleManifest sut = BundleManifest.fromBundle(new File("../src/test/resources/bundles/exploded.jar"));
+ assertEquals("com.ibm.test", sut.getSymbolicName());
+ assertEquals("1.0.0", sut.getVersion().toString());
+ }
+
+ @Test
+ public void testZip() throws Exception
+ {
+ // make sure that the manifest is not the first file in the jar archive
+ JarInputStream jarIs = new JarInputStream(new FileInputStream(_testfile));
+ assertNull(jarIs.getManifest());
+ jarIs.close();
+
+ BundleManifest sut = BundleManifest.fromBundle(_testfile);
+ assertEquals("com.ibm.test", sut.getSymbolicName());
+ assertEquals("1.0.0", sut.getVersion().toString());
+ }
+}
+
Added: aries/tags/application-0.3/application-utils/src/test/java/org/apache/aries/application/utils/manifest/ManifestHeaderProcessorTest.java
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-utils/src/test/java/org/apache/aries/application/utils/manifest/ManifestHeaderProcessorTest.java?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-utils/src/test/java/org/apache/aries/application/utils/manifest/ManifestHeaderProcessorTest.java (added)
+++ aries/tags/application-0.3/application-utils/src/test/java/org/apache/aries/application/utils/manifest/ManifestHeaderProcessorTest.java Sun Feb 27 20:20:13 2011
@@ -0,0 +1,541 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIESOR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.aries.application.utils.manifest;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotSame;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.aries.application.VersionRange;
+import org.apache.aries.application.utils.internal.MessageUtil;
+import org.apache.aries.application.utils.manifest.ManifestHeaderProcessor.NameValueMap;
+import org.apache.aries.application.utils.manifest.ManifestHeaderProcessor.NameValuePair;
+import org.junit.Test;
+
+public class ManifestHeaderProcessorTest
+{
+ @Test
+ public void testNameValuePair() throws Exception {
+ NameValuePair<String, String> nvp = new NameValuePair<String, String>("key", "value");
+ assertEquals("The name value pair is not set properly.", nvp.getName(), "key");
+ assertEquals("The value is not set properly.", nvp.getValue(), "value");
+ NameValuePair<String, String> anotherNvp = new NameValuePair<String, String>("key", "value");
+ assertEquals("The two objects of NameValuePair is not equal.", nvp, anotherNvp);
+ nvp.setName("newKey");
+ nvp.setValue("newValue");
+ assertEquals("The name value pair is not set properly.", nvp.getName(), "newKey");
+ assertEquals("The value is not set properly.", nvp.getValue(), "newValue");
+
+ NameValueMap<String,String> nvm1 = new NameValueMap<String,String>();
+ nvm1.put("a","b");
+ nvm1.put("c","d");
+ NameValueMap<String,String> nvm2 = new NameValueMap<String,String>();
+ nvm2.put("c","d");
+ nvm2.put("a","b");
+ assertEquals("The maps are not equal.", nvm1, nvm2);
+ nvm2.put("e","f");
+ assertNotSame("The maps are the same.", nvm1, nvm2);
+
+ NameValuePair<String, NameValueMap<String,String>> nvp1 = new NameValuePair<String,NameValueMap<String,String>>("one",nvm1);
+ NameValuePair<String, NameValueMap<String,String>> nvp2 = new NameValuePair<String,NameValueMap<String,String>>("one",nvm2);
+
+ assertNotSame("The pairs are identical ",nvp1,nvp2);
+ nvm1.put("e","f");
+ assertEquals("The pairs are not equal.", nvp1,nvp2);
+
+ List<NameValuePair<String, NameValueMap<String,String>>> bundleInfoList1 = new ArrayList<NameValuePair<String, NameValueMap<String,String>>>();
+ bundleInfoList1.add(nvp1);
+
+ List<NameValuePair<String, NameValueMap<String,String>>> bundleInfoList2 = new ArrayList<NameValuePair<String, NameValueMap<String,String>>>();
+ bundleInfoList2.add(nvp1);
+
+ bundleInfoList1.removeAll(bundleInfoList2);
+ assertEquals("The List should be empty", bundleInfoList1.isEmpty(), true);
+
+
+ assertNotSame("The two objects of NameValuePair is not equal.", nvp, anotherNvp);
+ }
+
+
+ /**
+ * Test the Bundle manifest header entry of
+ * Bundle-SymbolicName: com.acme.foo;singleton:=true
+ */
+ @Test
+ public void testParseBundleSymbolicName()
+ {
+ String bundleSymbolicNameEntry = "com.acme.foo;singleton:=true;fragment-attachment:=always";
+ NameValuePair<String, NameValueMap<String, String>> nvp = ManifestHeaderProcessor.parseBundleSymbolicName(bundleSymbolicNameEntry);
+ assertEquals("The symbolic name is wrong.", nvp.getName(), "com.acme.foo");
+ assertEquals("The value is wrong.", "true", nvp.getValue().get("singleton:") );
+ assertEquals("The directive is wrong.", "always", nvp.getValue().get("fragment-attachment:") );
+
+ String bundleSymbolicNameEntry2 = "com.acme.foo";
+ NameValuePair<String, NameValueMap<String, String>> nvp2 = ManifestHeaderProcessor.parseBundleSymbolicName(bundleSymbolicNameEntry2);
+ assertEquals("The symbolic name is wrong.", nvp2.getName(), "com.acme.foo");
+
+
+
+
+ }
+
+
+
+ /**
+ * Test the import package and import service
+ * Import-Package: com.acme.foo;come.acm,e.bar;version="[1.23,1.24.5]";resolution:=mandatory
+ */
+ @Test
+ public void testParseImportString()
+ {
+ String importPackage = "com.acme.foo,come.acm.e.bar;version=\"[1.23,1.24.5]\";resolution:=mandatory;company=\"ACME\",a.b.c;version=1.2.3;company=com";
+
+ Map<String, NameValueMap<String, String>> importPackageReturn = ManifestHeaderProcessor.parseImportString(importPackage);
+
+ assertTrue("The package is not set.", importPackageReturn.containsKey("com.acme.foo"));
+ assertTrue("The package is not set.", importPackageReturn.containsKey("come.acm.e.bar"));
+ assertTrue("The package is not set.", importPackageReturn.containsKey("come.acm.e.bar"));
+ assertTrue("The package is not set.", importPackageReturn.containsKey("a.b.c"));
+ assertTrue("The package should not contain any attributes.", importPackageReturn.get("com.acme.foo").isEmpty());
+ assertEquals("The directive is not set correctly.", "[1.23,1.24.5]", importPackageReturn.get("come.acm.e.bar").get("version"));
+ assertEquals("The directive is not set correctly.", "mandatory", importPackageReturn.get("come.acm.e.bar").get("resolution:"));
+ assertEquals("The directive is not set correctly.", "ACME", importPackageReturn.get("come.acm.e.bar").get("company"));
+ assertEquals("The directive is not set correctly.", "1.2.3", importPackageReturn.get("a.b.c").get("version"));
+ assertEquals("The directive is not set correctly.", "com", importPackageReturn.get("a.b.c").get("company"));
+
+ importPackage="com.acme.foo";
+
+ assertTrue("The package is not set.", importPackageReturn.containsKey("com.acme.foo"));
+ assertTrue("The package should not contain any attributes.", importPackageReturn.get("com.acme.foo").isEmpty());
+
+ importPackage="com.acme.foo;com.acme.bar;version=2";
+ Map<String, NameValueMap<String, String>> importPackageReturn2 = ManifestHeaderProcessor.parseImportString(importPackage);
+ assertTrue("The package is not set.", importPackageReturn2.containsKey("com.acme.foo"));
+ assertTrue("The package is not set.", importPackageReturn2.containsKey("com.acme.bar"));
+ assertEquals("The directive is not set correctly.", "2", importPackageReturn2.get("com.acme.foo").get("version"));
+ assertEquals("The directive is not set correctly.", "2", importPackageReturn2.get("com.acme.bar").get("version"));
+ }
+ @Test
+ public void testParseExportString()
+ {
+ String exportPackage = "com.acme.foo,com.acme.bar;version=1,com.acme.bar;version=2;uses:=\"a.b.c,d.e.f\";security=false;mandatory:=security";
+
+ List<NameValuePair<String, NameValueMap<String, String>>> exportPackageReturn = ManifestHeaderProcessor.parseExportString(exportPackage);
+
+ int i =0;
+ assertEquals("The number of the packages is wrong.", 3, exportPackageReturn.size());
+ for (NameValuePair<String, NameValueMap<String, String>> nvp : exportPackageReturn) {
+ if (nvp.getName().equals("com.acme.foo")) {
+ i++;
+
+ assertTrue("The directive or attribute should not be set.", nvp.getValue().isEmpty() );
+ } else if ((nvp.getName().equals("com.acme.bar")) && ("2".equals(nvp.getValue().get("version")))) {
+
+
+ i++;
+ assertEquals("The directive is wrong.", "a.b.c,d.e.f", nvp.getValue().get("uses:"));
+ assertEquals("The directive is wrong.", "false", nvp.getValue().get("security"));
+ assertEquals("The directive is wrong.", "security", nvp.getValue().get("mandatory:"));
+ } else if ((nvp.getName().equals("com.acme.bar")) && ("1".equals(nvp.getValue().get("version")))) {
+ i++;
+
+ assertNull("The directive is wrong.", nvp.getValue().get("uses:"));
+ assertNull("The directive is wrong.", nvp.getValue().get("security"));
+ assertNull("The directive is wrong.", nvp.getValue().get("mandatory:"));
+ }
+ }
+ // make sure all three packages stored
+ assertEquals("The names of the packages are wrong.", 3, i);
+
+ exportPackage = "com.acme.foo";
+
+ exportPackageReturn = ManifestHeaderProcessor.parseExportString(exportPackage);
+
+ int k =0;
+ assertEquals("The number of the packages is wrong.", 1, exportPackageReturn.size());
+ for (NameValuePair<String, NameValueMap<String, String>> nvp : exportPackageReturn) {
+ if (nvp.getName().equals("com.acme.foo")) {
+ k++;
+
+ assertTrue("The directive or attribute should not be set.", nvp.getValue().isEmpty() );
+ }
+ }
+ assertEquals("The names of the packages are wrong.", 1, k);
+
+ // test multiple packages separated by ;
+
+ exportPackage = "com.acme.foo;com.acme.bar;version=\"2\";resolution:=optional";
+
+ exportPackageReturn = ManifestHeaderProcessor.parseExportString(exportPackage);
+
+ k =0;
+ assertEquals("The number of the packages is wrong.", 2, exportPackageReturn.size());
+ for (NameValuePair<String, NameValueMap<String, String>> nvp : exportPackageReturn) {
+ if (nvp.getName().equals("com.acme.foo")) {
+ k++;
+
+ assertEquals("The attribute is wrong.", "2", nvp.getValue().get("version") );
+ assertEquals("The attribute is wrong.", "optional", nvp.getValue().get("resolution:"));
+ } else if (nvp.getName().equals("com.acme.bar")) {
+ k++;
+
+ assertEquals("The attribute is wrong.", "2", nvp.getValue().get("version") );
+ assertEquals("The attribute is wrong.", "optional", nvp.getValue().get("resolution:"));
+ }
+ }
+ assertEquals("The names of the packages are wrong.", 2, k);
+
+
+
+ }
+
+ @Test
+ public void testExportMandatoryAttributes() {
+ String exportPackage = "com.acme.foo,com.acme.bar;version=2;company=dodo;security=false;mandatory:=\"security,company\"";
+
+ List<NameValuePair<String, NameValueMap<String, String>>> exportPackageReturn = ManifestHeaderProcessor.parseExportString(exportPackage);
+
+ int i =0;
+ assertEquals("The number of the packages is wrong.", 2, exportPackageReturn.size());
+ for (NameValuePair<String, NameValueMap<String, String>> nvp : exportPackageReturn) {
+ if (nvp.getName().equals("com.acme.foo")) {
+ i++;
+
+ assertTrue("The directive or attribute should not be set.", nvp.getValue().isEmpty() );
+ } else if ((nvp.getName().equals("com.acme.bar")) && ("2".equals(nvp.getValue().get("version")))) {
+
+
+ i++;
+ assertEquals("The directive is wrong.", "dodo", nvp.getValue().get("company"));
+ assertEquals("The directive is wrong.", "false", nvp.getValue().get("security"));
+ assertEquals("The directive is wrong.", "security,company", nvp.getValue().get("mandatory:"));
+ }
+ }
+ // make sure all three packages stored
+ assertEquals("The names of the packages are wrong.", 2, i);
+
+ }
+
+ private String createExpectedFilter(NameValueMap<String, String> values, String ... parts)
+ {
+ StringBuilder builder = new StringBuilder(parts[0]);
+
+ for (Map.Entry<String, String> entry : values.entrySet()) {
+ if ("version".equals(entry.getKey())) builder.append(parts[2]);
+ else if ("company".equals(entry.getKey())) builder.append(parts[1]);
+ }
+
+ builder.append(parts[3]);
+
+ return builder.toString();
+ }
+
+ /**
+ * Test the filter generated correctly
+ * @throws Exception
+ */
+ @Test
+ public void testGenerateFilter() throws Exception {
+ NameValueMap<String, String> valueMap = new NameValueMap<String, String>();
+ valueMap.addToCollection("version", "[1.2, 2.3]");
+ valueMap.addToCollection("resulution:", "mandatory");
+ valueMap.addToCollection("company", "com");
+ String filter = ManifestHeaderProcessor.generateFilter("symbolic-name", "com.ibm.foo", valueMap);
+ String expected = createExpectedFilter(valueMap, "(&(symbolic-name=com.ibm.foo)", "(company=com)", "(version>=1.2.0)(version<=2.3.0)", "(mandatory:<*company))");
+ assertEquals("The filter is wrong.", expected, filter );
+
+
+ valueMap.clear();
+
+ valueMap.addToCollection("version", "(1.2, 2.3]");
+ valueMap.addToCollection("resulution:", "mandatory");
+ valueMap.addToCollection("company", "com");
+ filter = ManifestHeaderProcessor.generateFilter("symbolic-name", "com.ibm.foo", valueMap);
+ expected = createExpectedFilter(valueMap, "(&(symbolic-name=com.ibm.foo)", "(company=com)", "(version>=1.2.0)(version<=2.3.0)(!(version=1.2.0))", "(mandatory:<*company))");
+ assertEquals("The filter is wrong.", expected, filter );
+
+ valueMap.clear();
+
+ valueMap.addToCollection("version", "(1.2, 2.3)");
+ valueMap.addToCollection("resulution:", "mandatory");
+ valueMap.addToCollection("company", "com");
+ filter = ManifestHeaderProcessor.generateFilter("symbolic-name", "com.ibm.foo", valueMap);
+ expected = createExpectedFilter(valueMap, "(&(symbolic-name=com.ibm.foo)", "(company=com)", "(version>=1.2.0)(version<=2.3.0)(!(version=1.2.0))(!(version=2.3.0))", "(mandatory:<*company))");
+ assertEquals("The filter is wrong.", expected, filter );
+
+ valueMap.clear();
+
+ valueMap.addToCollection("version", "1.2");
+ valueMap.addToCollection("resulution:", "mandatory");
+ valueMap.addToCollection("company", "com");
+ filter = ManifestHeaderProcessor.generateFilter("symbolic-name", "com.ibm.foo", valueMap);
+ expected = createExpectedFilter(valueMap, "(&(symbolic-name=com.ibm.foo)", "(company=com)", "(version>=1.2.0)", "(mandatory:<*company))");
+ assertEquals("The filter is wrong.", expected, filter );
+
+ valueMap.clear();
+
+ valueMap.addToCollection("resulution:", "mandatory");
+ valueMap.addToCollection("company", "com");
+ filter = ManifestHeaderProcessor.generateFilter("symbolic-name", "com.ibm.foo", valueMap);
+ expected = createExpectedFilter(valueMap, "(&(symbolic-name=com.ibm.foo)", "(company=com)", "", "(mandatory:<*company))");
+ assertEquals("The filter is wrong.", expected, filter );
+ }
+
+ /**
+ * Test the version range created correctly
+ * @throws Exception
+ */
+
+ @Test
+ public void testVersionRange() throws Exception {
+ String version1 = "[1.2.3, 4.5.6]";
+ String version2="(1, 2]";
+ String version3="[2,4)";
+ String version4="(1,2)";
+ String version5="2";
+ String version6 = "2.3";
+ String version7="[1.2.3.q, 2.3.4.p)";
+ String version8="1.2.2.5";
+ String version9="a.b.c";
+ String version10=null;
+ String version11="";
+ String version12="\"[1.2.3, 4.5.6]\"";
+
+ VersionRange vr = ManifestHeaderProcessor.parseVersionRange(version1);
+ assertEquals("The value is wrong", "1.2.3", vr.getMinimumVersion().toString());
+ assertFalse("The value is wrong", vr.isMinimumExclusive());
+ assertEquals("The value is wrong", "4.5.6", vr.getMaximumVersion().toString());
+ assertFalse("The value is wrong", vr.isMaximumExclusive());
+
+ vr = ManifestHeaderProcessor.parseVersionRange(version2);
+ assertEquals("The value is wrong", "1.0.0", vr.getMinimumVersion().toString());
+ assertTrue("The value is wrong", vr.isMinimumExclusive());
+ assertEquals("The value is wrong", "2.0.0", vr.getMaximumVersion().toString());
+ assertFalse("The value is wrong", vr.isMaximumExclusive());
+
+ vr = ManifestHeaderProcessor.parseVersionRange(version3);
+
+ assertEquals("The value is wrong", "2.0.0", vr.getMinimumVersion().toString());
+ assertFalse("The value is wrong", vr.isMinimumExclusive());
+ assertEquals("The value is wrong", "4.0.0", vr.getMaximumVersion().toString());
+ assertTrue("The value is wrong", vr.isMaximumExclusive());
+
+ vr = ManifestHeaderProcessor.parseVersionRange(version4);
+
+ assertEquals("The value is wrong", "1.0.0", vr.getMinimumVersion().toString());
+ assertTrue("The value is wrong", vr.isMinimumExclusive());
+ assertEquals("The value is wrong", "2.0.0", vr.getMaximumVersion().toString());
+ assertTrue("The value is wrong", vr.isMaximumExclusive());
+
+ vr = ManifestHeaderProcessor.parseVersionRange(version5);
+ assertEquals("The value is wrong", "2.0.0", vr.getMinimumVersion().toString());
+ assertFalse("The value is wrong", vr.isMinimumExclusive());
+ assertNull("The value is wrong", vr.getMaximumVersion());
+ assertFalse("The value is wrong", vr.isMaximumExclusive());
+
+ vr = ManifestHeaderProcessor.parseVersionRange(version6);
+ assertEquals("The value is wrong", "2.3.0", vr.getMinimumVersion().toString());
+ assertFalse("The value is wrong", vr.isMinimumExclusive());
+ assertNull("The value is wrong", vr.getMaximumVersion());
+ assertFalse("The value is wrong", vr.isMaximumExclusive());
+
+ vr = ManifestHeaderProcessor.parseVersionRange(version7);
+ assertEquals("The value is wrong", "1.2.3.q", vr.getMinimumVersion().toString());
+ assertFalse("The value is wrong", vr.isMinimumExclusive());
+ assertEquals("The value is wrong", "2.3.4.p", vr.getMaximumVersion().toString());
+ assertTrue("The value is wrong", vr.isMaximumExclusive());
+
+ vr = ManifestHeaderProcessor.parseVersionRange(version8);
+ assertEquals("The value is wrong", "1.2.2.5", vr.getMinimumVersion().toString());
+ assertFalse("The value is wrong", vr.isMinimumExclusive());
+ assertNull("The value is wrong", vr.getMaximumVersion());
+ assertFalse("The value is wrong", vr.isMaximumExclusive());
+ boolean exception = false;
+ try {
+ vr = ManifestHeaderProcessor.parseVersionRange(version9);
+ } catch (Exception e){
+ exception = true;
+ }
+
+ assertTrue("The value is wrong", exception);
+ boolean exceptionNull = false;
+ try {
+ vr = ManifestHeaderProcessor.parseVersionRange(version10);
+ } catch (Exception e){
+ exceptionNull = true;
+ }
+ assertTrue("The value is wrong", exceptionNull);
+ // empty version should be defaulted to >=0.0.0
+ vr = ManifestHeaderProcessor.parseVersionRange(version11);
+ assertEquals("The value is wrong", "0.0.0", vr.getMinimumVersion().toString());
+ assertFalse("The value is wrong", vr.isMinimumExclusive());
+ assertNull("The value is wrong", vr.getMaximumVersion());
+ assertFalse("The value is wrong", vr.isMaximumExclusive());
+
+
+ vr = ManifestHeaderProcessor.parseVersionRange(version12);
+ assertEquals("The value is wrong", "1.2.3", vr.getMinimumVersion().toString());
+ assertFalse("The value is wrong", vr.isMinimumExclusive());
+ assertEquals("The value is wrong", "4.5.6", vr.getMaximumVersion().toString());
+ assertFalse("The value is wrong", vr.isMaximumExclusive());
+ }
+
+ @Test
+ public void testInvalidVersions() throws Exception
+ {
+ try {
+ ManifestHeaderProcessor.parseVersionRange("a");
+ assertTrue("Should have thrown an exception", false);
+ } catch (IllegalArgumentException e) {
+ // assertEquals(MessageUtil.getMessage("APPUTILS0009E", "a"), e.getMessage());
+ }
+
+ try {
+ ManifestHeaderProcessor.parseVersionRange("[1.0.0,1.0.1]", true);
+ assertTrue("Should have thrown an exception", false);
+ } catch (IllegalArgumentException e) {
+ // assertEquals(MessageUtil.getMessage("APPUTILS0011E", "[1.0.0,1.0.1]"), e.getMessage());
+ }
+
+ }
+
+ @Test
+ public void testSplit() throws Exception {
+ String export = "com.ibm.ws.eba.obr.fep.bundle122;version=\"3\";company=mood;local=yes;security=yes;mandatory:=\"mood,security\"";
+ List<String> result = ManifestHeaderProcessor.split(export, ",");
+ assertEquals("The result is wrong.", export, result.get(0));
+ assertEquals("The result is wrong.", 1, result.size());
+
+ String aString = "com.acme.foo;weirdAttr=\"one;two;three\";weirdDir:=\"1;2;3\"";
+ result = ManifestHeaderProcessor.split(aString, ";");
+ assertEquals("The result is wrong.", "com.acme.foo", result.get(0));
+ assertEquals("The result is wrong.", "weirdAttr=\"one;two;three\"", result.get(1));
+ assertEquals("The result is wrong.", "weirdDir:=\"1;2;3\"", result.get(2));
+
+ assertEquals("The result is wrong.", 3, result.size());
+
+
+
+
+ String pkg1 = "com.ibm.ws.eba.example.helloIsolation;version=\"1.0.0\" ";
+ String pkg2 = "com.ibm.ws.eba.helloWorldService;version=\"[1.0.0,1.0.0]\"";
+ String pkg3 = " com.ibm.ws.eba.helloWorldService;version=\"1.0.0\"";
+ String pkg4 = "com.ibm.ws.eba.helloWorldService;version=\"[1.0.0,1.0.0]\";sharing:=shared" ;
+ String pkg5 = "com.ibm.ws.eba.helloWorldService;sharing:=shared;version=\"[1.0.0,1.0.0]\"";
+ String appContent1 = pkg1 + ", " + pkg2 + ", " + pkg3;
+ String appContent2 = pkg2 + ", " + pkg1 + ", " + pkg3;
+ String appContent3 = pkg1 + ", " + pkg3 + ", " + pkg2;
+ String appContent4 = pkg1 + ", " + pkg3 + ", " + pkg4;
+ String appContent5 = pkg1 + ", " + pkg3 + ", " + pkg5;
+
+ List<String> splitList = ManifestHeaderProcessor.split(appContent1, ",");
+ assertEquals(pkg1.trim(), splitList.get(0));
+ assertEquals(pkg2.trim(), splitList.get(1));
+ assertEquals(pkg3.trim(), splitList.get(2));
+
+ splitList = ManifestHeaderProcessor.split(appContent2, ",");
+ assertEquals(pkg2.trim(), splitList.get(0));
+ assertEquals(pkg1.trim(), splitList.get(1));
+ assertEquals(pkg3.trim(), splitList.get(2));
+
+ splitList = ManifestHeaderProcessor.split(appContent3, ",");
+ assertEquals(pkg1.trim(), splitList.get(0));
+ assertEquals(pkg3.trim(), splitList.get(1));
+ assertEquals(pkg2.trim(), splitList.get(2));
+
+ splitList = ManifestHeaderProcessor.split(appContent4, ",");
+ assertEquals(pkg1.trim(), splitList.get(0));
+ assertEquals(pkg3.trim(), splitList.get(1));
+ assertEquals(pkg4.trim(), splitList.get(2));
+
+ splitList = ManifestHeaderProcessor.split(appContent5, ",");
+ assertEquals(pkg1.trim(), splitList.get(0));
+ assertEquals(pkg3.trim(), splitList.get(1));
+ assertEquals(pkg5.trim(), splitList.get(2));
+ }
+
+ @Test
+ public void testParseFilter()
+ {
+ Map<String,String> attrs = ManifestHeaderProcessor.parseFilter("(package=com.ibm.test)");
+ assertEquals("com.ibm.test", attrs.get("package"));
+
+ attrs = ManifestHeaderProcessor.parseFilter("(&(package=com.ibm.test)(attr=value))");
+ assertEquals("com.ibm.test", attrs.get("package"));
+ assertEquals("value", attrs.get("attr"));
+ assertEquals(2, attrs.size());
+
+ attrs = ManifestHeaderProcessor.parseFilter("(&(version>=1.0.0))");
+ assertEquals("1.0.0", attrs.get("version"));
+
+ attrs = ManifestHeaderProcessor.parseFilter("(&(version>=1.0.0)(version<=2.0.0))");
+ assertEquals("[1.0.0,2.0.0]", attrs.get("version"));
+
+ attrs = ManifestHeaderProcessor.parseFilter("(&(version>=1.0.0)(version<=2.0.0)(!(version=1.0.0)))");
+ assertEquals("(1.0.0,2.0.0]", attrs.get("version"));
+
+ attrs = ManifestHeaderProcessor.parseFilter("(&(!(version=2.0.0))(!(version=1.0.0))(version>=1.0.0)(version<=2.0.0))");
+ assertEquals("(1.0.0,2.0.0)", attrs.get("version"));
+ }
+
+ @Test
+ public void testExactVersion() throws Exception
+ {
+ VersionRange vr;
+ try {
+ vr = ManifestHeaderProcessor.parseVersionRange("[1.0.0, 2.0.0]", true);
+ fail("should not get here 1");
+ } catch (IllegalArgumentException e) {
+ // expected
+ }
+
+ vr = ManifestHeaderProcessor.parseVersionRange("[1.0.0, 1.0.0]", true);
+ assertTrue(vr.isExactVersion());
+
+ try {
+ vr = ManifestHeaderProcessor.parseVersionRange("(1.0.0, 1.0.0]", true);
+ fail("should not get here 2");
+ } catch (IllegalArgumentException e) {
+ // expected
+ }
+
+ try {
+ vr = ManifestHeaderProcessor.parseVersionRange("[1.0.0, 1.0.0)", true);
+ fail("should not get here 3");
+ } catch (IllegalArgumentException e) {
+ // expected
+ }
+
+ vr = ManifestHeaderProcessor.parseVersionRange("[1.0.0, 2.0.0]");
+ assertFalse(vr.isExactVersion());
+
+ vr = ManifestHeaderProcessor.parseVersionRange("[1.0.0, 1.0.0]");
+ assertTrue(vr.isExactVersion());
+
+
+ }
+}
Added: aries/tags/application-0.3/application-utils/src/test/java/org/apache/aries/application/utils/manifest/ManifestProcessorTest.java
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-utils/src/test/java/org/apache/aries/application/utils/manifest/ManifestProcessorTest.java?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-utils/src/test/java/org/apache/aries/application/utils/manifest/ManifestProcessorTest.java (added)
+++ aries/tags/application-0.3/application-utils/src/test/java/org/apache/aries/application/utils/manifest/ManifestProcessorTest.java Sun Feb 27 20:20:13 2011
@@ -0,0 +1,153 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIESOR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.aries.application.utils.manifest;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.jar.Manifest;
+
+import org.apache.aries.application.ApplicationMetadata;
+import org.apache.aries.application.Content;
+import org.apache.aries.application.VersionRange;
+import org.apache.aries.application.impl.ApplicationMetadataFactoryImpl;
+import org.apache.aries.application.utils.manifest.ManifestProcessor;
+import org.junit.Test;
+import org.osgi.framework.Version;
+
+public class ManifestProcessorTest
+{
+
+ private String appName = "Travel Reservation";
+
+ /**
+ * Check a simple manifest can be read.
+ * @throws Exception
+ */
+ @Test
+ public void testSimpleManifest() throws Exception
+ {
+ //the values of the manifest
+ //intentionally include a couple of long lines
+ Map<String, String> pairs = new HashMap<String, String>();
+ pairs.put("Manifest-Version", "1.0");
+ pairs.put("Application-ManifestVersion", "1.0");
+ pairs.put("Application-Name", appName );
+ pairs.put("Application-SymbolicName", "com.travel.reservation");
+ pairs.put("Application-Version", "1.2");
+ pairs.put("Application-Content", "com.travel.reservation.web;version=\"[1.1.0,1.2.0)\",com.travel.reservation.business");
+ pairs.put("Export-Package", "com.travel.reservation.api;version=1.2");
+ pairs.put("Import-Package", "com.travel.flight.api;version=\"[2.1.1,3.0.0)\",com.travel.rail.api;version=\"[1.0.0,2.0.0)\"");
+ pairs.put("Application-Services", "services.xml");
+
+ InputStream in = getClass().getClassLoader().getResourceAsStream("META-INF/APPLICATION.MF");
+ Manifest mf = new Manifest(in);
+ Map<String, String> map = ManifestProcessor.readManifestIntoMap(mf);
+ assertNotNull(map);
+
+ //check all the expected keys and values
+ for (String key : pairs.keySet()){
+ assertTrue("Key: " + key + " was not found",map.containsKey(key));
+ String value = map.get(key);
+ assertNotNull("Value was not present for key: " + key ,value);
+ assertEquals("Value was not correct for key: " + key ,pairs.get(key),value);
+ }
+ //check there aren't any extra entries in the map that weren't expected
+ assertEquals("The maps did not match",pairs,map);
+ }
+
+ /**
+ * Check metadata can be extracted from a simple manifest.
+ */
+ @Test
+ public void testManifestMetadata() throws Exception
+ {
+ ApplicationMetadataFactoryImpl manager = new ApplicationMetadataFactoryImpl();
+ InputStream in = getClass().getClassLoader().getResourceAsStream("META-INF/APPLICATION.MF");
+ ApplicationMetadata am = manager.parseApplicationMetadata(in);
+ assertNotNull(am);
+
+ assertEquals(am.getApplicationName(),appName);
+
+ //"com.travel.reservation.web;version=\"[1.1.0,1.2.0)\",com.travel.reservation.business",
+ List<Content> contents = am.getApplicationContents();
+ for (Content content : contents){
+ if ("com.travel.reservation.web".equals(content.getContentName())){
+ VersionRange vr = content.getVersion();
+ assertEquals(vr.getMinimumVersion(),new Version("1.1.0"));
+ assertEquals(vr.getMaximumVersion(),new Version("1.2.0"));
+ } else if("com.travel.reservation.business".equals(content.getContentName())){
+ VersionRange vr = content.getVersion();
+ assertEquals(new Version(0,0,0), vr.getMinimumVersion());
+ } else
+ fail("Unexepcted content name " + content.getContentName());
+ }
+ }
+
+ /**
+ * Check metadata can be extracted from a manifest that uses multiple lines
+ * for a single manifest attribute.
+ */
+ @Test
+ public void testManifestMetadataWithMultiLineEntries() throws Exception
+ {
+ ApplicationMetadataFactoryImpl manager = new ApplicationMetadataFactoryImpl();
+
+ InputStream in = getClass().getClassLoader().getResourceAsStream("META-INF/APPLICATION2.MF");
+
+ ApplicationMetadata am = manager.parseApplicationMetadata(in);
+ assertNotNull(am);
+
+ assertEquals(am.getApplicationName(),appName);
+
+ //"com.travel.reservation.web;version=\"[1.1.0,1.2.0)\",com.travel.reservation.business",
+ List<Content> contents = am.getApplicationContents();
+ for (Content content : contents){
+ if ("com.travel.reservation.web".equals(content.getContentName())){
+ VersionRange vr = content.getVersion();
+ assertEquals(vr.getMinimumVersion(),new Version("1.1.0"));
+ assertEquals(vr.getMaximumVersion(),new Version("1.2.0"));
+ } else if("com.travel.reservation.business".equals(content.getContentName())){
+ VersionRange vr = content.getVersion();
+ assertEquals(new Version(0,0,0), vr.getMinimumVersion());
+ } else
+ fail("Unexepcted content name " + content.getContentName());
+ }
+ }
+
+ @Test
+ public void testManifestWithoutEndingInNewLine() throws Exception
+ {
+ ApplicationMetadataFactoryImpl manager = new ApplicationMetadataFactoryImpl();
+
+ InputStream in = getClass().getClassLoader().getResourceAsStream("META-INF/APPLICATION3.MF");
+
+ ApplicationMetadata am = manager.parseApplicationMetadata(in);
+ assertNotNull(am);
+
+ assertEquals("Wrong number of bundles are in the application", 1, am.getApplicationContents().size());
+ assertEquals("Wrong bundle name", "org.apache.aries.applications.test.bundle", am.getApplicationContents().get(0).getContentName());
+ }
+}
\ No newline at end of file
Added: aries/tags/application-0.3/application-utils/src/test/resources/META-INF/APPLICATION.MF
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-utils/src/test/resources/META-INF/APPLICATION.MF?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-utils/src/test/resources/META-INF/APPLICATION.MF (added)
+++ aries/tags/application-0.3/application-utils/src/test/resources/META-INF/APPLICATION.MF Sun Feb 27 20:20:13 2011
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Application-ManifestVersion: 1.0
+Application-Name: Travel Reservation
+Application-SymbolicName: com.travel.reservation
+Application-Version: 1.2
+Application-Content: com.travel.reservation.web;version="[1.1.0,1.2.0)",
+ com.travel.reservation.business
+Export-Package: com.travel.reservation.api;version=1.2
+Import-Package: com.travel.flight.api;version="[2.1.1,3.0.0)",com.travel.rail.api;version="[1.0.0,2.0.0)"
+Application-Services: services.xml
Propchange: aries/tags/application-0.3/application-utils/src/test/resources/META-INF/APPLICATION.MF
------------------------------------------------------------------------------
svn:executable = *
Added: aries/tags/application-0.3/application-utils/src/test/resources/META-INF/APPLICATION2.MF
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-utils/src/test/resources/META-INF/APPLICATION2.MF?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-utils/src/test/resources/META-INF/APPLICATION2.MF (added)
+++ aries/tags/application-0.3/application-utils/src/test/resources/META-INF/APPLICATION2.MF Sun Feb 27 20:20:13 2011
@@ -0,0 +1,13 @@
+Manifest-Version: 1.0
+Application-ManifestVersion: 1.0
+Application-Name: Travel Reservation
+Application-SymbolicName: com.travel.reservation
+Application-Version: 1.2
+Application-Content: com.travel.reservation.web;version="[1.1.0,1.2.0)",
+ com.travel.reservation.business,
+Export-Package: com.travel.reservation.api;version=1.2
+Import-Package: com.travel.flight.api;version="[2.1.1,3.0.0)",
+ com.travel.rail.api;version="[1.0.0,2.0.0)",
+ com.travel.credit.api;version="[2.1.0,2.1.0]",
+ com.travel.hotel.api;version="[1.5.0,2.0.0)"
+Application-Services: services.xml
Added: aries/tags/application-0.3/application-utils/src/test/resources/META-INF/APPLICATION3.MF
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-utils/src/test/resources/META-INF/APPLICATION3.MF?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-utils/src/test/resources/META-INF/APPLICATION3.MF (added)
+++ aries/tags/application-0.3/application-utils/src/test/resources/META-INF/APPLICATION3.MF Sun Feb 27 20:20:13 2011
@@ -0,0 +1,3 @@
+Application-SymbolicName: org.apache.aries.applications.test.app
+Application-Version: 1.4.0
+Application-Content: org.apache.aries.applications.test.bundle
Added: aries/tags/application-0.3/application-utils/src/test/resources/META-INF/APPLICATION4.MF
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-utils/src/test/resources/META-INF/APPLICATION4.MF?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-utils/src/test/resources/META-INF/APPLICATION4.MF (added)
+++ aries/tags/application-0.3/application-utils/src/test/resources/META-INF/APPLICATION4.MF Sun Feb 27 20:20:13 2011
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Application-ManifestVersion: 1.0
+Application-Name: Travel Reservation
+Application-SymbolicName: com.travel.reservation
+Application-Version: 1.2
+Application-Content: com.travel.reservation.web;version="[1.1.0,1.2.0)",
+ com.travel.reservation.business
+Use-Bundle: com.travel.reservation.api;version="[1.0.0,2.0.0)"
+Application-ImportService: com.travel.flight.api,com.travel.rail.api
+Application-ExportService: com.travel.reservation
Added: aries/tags/application-0.3/application-utils/src/test/resources/META-INF/DEPLOYMENT.MF
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-utils/src/test/resources/META-INF/DEPLOYMENT.MF?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-utils/src/test/resources/META-INF/DEPLOYMENT.MF (added)
+++ aries/tags/application-0.3/application-utils/src/test/resources/META-INF/DEPLOYMENT.MF Sun Feb 27 20:20:13 2011
@@ -0,0 +1,16 @@
+Manifest-Version: 1.0
+Application-SymbolicName: com.travel.reservation
+Application-Version: 1.2
+Deployed-Content: com.travel.reservation.web;deployed-version="1.1.0",
+ com.travel.reservation.business;deployed-version=2.0,
+ com.travel.reservation.data;deployed-version=2.1.1
+Provision-Bundle: com.travel.meal;deployed-version=1.0.0, com.ibm.travel.water;deployed-version=2.0.0
+Deployed-Use-Bundle: com.travel.insurance;deployed-version=1.0.0
+Import-Package: com.travel.insurance;version="1.0.0";bundle-symbolic-name="com.travel.insurance";bundle-version="[1.0.0,1.0.0]",org.osgi.framework;vers
+ ion="0.0.0",javax.naming;version="0.0.0",org.osgi.util.tracker;versio
+ n="1.4.0",com.travel.meal;version="[1.0.0,2.0.0)",javax.servlet;
+ version="2.5.0"
+DeployedService-Import: (&(objectClass=aries.test.filter.SimplePr
+ oxyFilter)(com=aries)), (&(objectClass=aries.test.filter2)(com=apache))
+Custom-Entry: com.travel.thirdparty
+Custom-Entry2: com.travel.meal
Added: aries/tags/application-0.3/application-utils/src/test/resources/app1/META-INF/APPLICATION.MF
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-utils/src/test/resources/app1/META-INF/APPLICATION.MF?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-utils/src/test/resources/app1/META-INF/APPLICATION.MF (added)
+++ aries/tags/application-0.3/application-utils/src/test/resources/app1/META-INF/APPLICATION.MF Sun Feb 27 20:20:13 2011
@@ -0,0 +1,16 @@
+Manifest-Version: 1.0
+Application-ManifestVersion: 1.0
+Application-Name: Travel Reservation
+Application-SymbolicName: com.travel.reservation
+Application-Version: 1.2
+Application-Content: com.travel.reservation.web;version="[1.1.0,1.2.0)",
+ com.travel.reservation.business,
+ com.travel.reservation.data
+Export-Package: com.travel.reservation.api;version=1.2
+Import-Package: com.travel.flight.api;version="[2.1.1,3.0.0)",
+ com.travel.rail.api;version="[1.0.0,2.0.0)",
+ com.travel.credit.api;version="[2.1.0,2.1.0]",
+ com.travel.hotel.api;version="[1.5.0,2.0.0)"
+Application-Services: services.xml
+
+
Added: aries/tags/application-0.3/application-utils/src/test/resources/app1/META-INF/DEPLOYMENT.MF
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-utils/src/test/resources/app1/META-INF/DEPLOYMENT.MF?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-utils/src/test/resources/app1/META-INF/DEPLOYMENT.MF (added)
+++ aries/tags/application-0.3/application-utils/src/test/resources/app1/META-INF/DEPLOYMENT.MF Sun Feb 27 20:20:13 2011
@@ -0,0 +1,6 @@
+Manifest-Version: 1.0
+Application-SymbolicName: com.travel.reservation
+Application-Version: 1.2
+Deployed-Content: com.travel.reservation.web;deployed-version="1.1.0",
+ com.travel.reservation.business;deployed-version=2.0
+ com.travel.reservation.data;deployed-version=2.1.1
Added: aries/tags/application-0.3/application-utils/src/test/resources/bundles/exploded.jar/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-utils/src/test/resources/bundles/exploded.jar/META-INF/MANIFEST.MF?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-utils/src/test/resources/bundles/exploded.jar/META-INF/MANIFEST.MF (added)
+++ aries/tags/application-0.3/application-utils/src/test/resources/bundles/exploded.jar/META-INF/MANIFEST.MF Sun Feb 27 20:20:13 2011
@@ -0,0 +1,2 @@
+Bundle-SymbolicName: com.ibm.test;singleton:=true
+Bundle-Version: 1.0.0
Added: aries/tags/application-0.3/application-utils/src/test/resources/bundles/exploded.jar/META-INF/beforeManifest.file
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-utils/src/test/resources/bundles/exploded.jar/META-INF/beforeManifest.file?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-utils/src/test/resources/bundles/exploded.jar/META-INF/beforeManifest.file (added)
+++ aries/tags/application-0.3/application-utils/src/test/resources/bundles/exploded.jar/META-INF/beforeManifest.file Sun Feb 27 20:20:13 2011
@@ -0,0 +1,19 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
Added: aries/tags/application-0.3/application-utils/src/test/resources/zip/file.txt
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-utils/src/test/resources/zip/file.txt?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-utils/src/test/resources/zip/file.txt (added)
+++ aries/tags/application-0.3/application-utils/src/test/resources/zip/file.txt Sun Feb 27 20:20:13 2011
@@ -0,0 +1,19 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+abc
\ No newline at end of file
Added: aries/tags/application-0.3/application-utils/src/test/resources/zip/subdir/someFile.txt
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-utils/src/test/resources/zip/subdir/someFile.txt?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-utils/src/test/resources/zip/subdir/someFile.txt (added)
+++ aries/tags/application-0.3/application-utils/src/test/resources/zip/subdir/someFile.txt Sun Feb 27 20:20:13 2011
@@ -0,0 +1,19 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+def
\ No newline at end of file