felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gokt...@apache.org
Subject svn commit: r1346941 - in /felix/trunk/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulation: DirManipulationTest.java RemanipulationTest.java
Date Wed, 06 Jun 2012 15:22:59 GMT
Author: gokturk
Date: Wed Jun  6 15:22:59 2012
New Revision: 1346941

URL: http://svn.apache.org/viewvc?rev=1346941&view=rev
Log:
* Forgot to add ASF License Header to DirManipulationTest in last commit, and some cosmetic
changes.
* Added missing license header to RemanipulationTest.

Modified:
    felix/trunk/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulation/DirManipulationTest.java
    felix/trunk/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulation/RemanipulationTest.java

Modified: felix/trunk/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulation/DirManipulationTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulation/DirManipulationTest.java?rev=1346941&r1=1346940&r2=1346941&view=diff
==============================================================================
--- felix/trunk/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulation/DirManipulationTest.java
(original)
+++ felix/trunk/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulation/DirManipulationTest.java
Wed Jun  6 15:22:59 2012
@@ -1,3 +1,21 @@
+/*
+ * 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.
+ */
 package org.apache.felix.ipojo.manipulation;
 
 import java.io.BufferedReader;
@@ -16,68 +34,70 @@ import test.AnnotatedComponent;
 
 import junit.framework.TestCase;
 
+/**
+ * Test cases for Pojoization.directoryManipulation() 
+ *
+ */
 public class DirManipulationTest extends TestCase {
 
+	/**
+	 * Test case for FELIX-3466.
+	 * 
+	 * Checks if directory manipulation, uses the supplied manifest file as
+	 * output.
+	 * 
+	 * @throws IOException
+	 */
 	@Test
-	public void testManifestLocationKept() {
-
+	public void testManifestLocationKept() throws IOException {
 		Pojoization pojoizator = new Pojoization();
 		File tmpDir = null, manifestFile = null, testClass = null;
-		try {
-			// To obtain OS's temp directory.
-			File tmpFile = File.createTempFile("pojodir", ".dir");
-			String tmpPath = tmpFile.getAbsolutePath();
-			tmpFile.delete();
-
-			// Creating directory on temp location
-			tmpDir = new File(tmpPath);
-			tmpDir.mkdir();
-			tmpDir.deleteOnExit();
-
-			// Create manifest file under temp directory
-			manifestFile = new File(tmpDir, "MANIFEST.MF");
-			new FileOutputStream(manifestFile)
-					.write("Manifest-Version: 1.0\r\n".getBytes());
-			manifestFile.deleteOnExit();
-
-			// Just to ensure it is not deleted later from test classes.
-			AnnotatedComponent safe;
-
-			// Annotated Class File
-			File annotedClassPackage = new File(tmpDir, "test");
-			annotedClassPackage.deleteOnExit();
-			annotedClassPackage.mkdir();
-			testClass = new File(annotedClassPackage,
-					"AnnotatedComponent.class");
-			testClass.deleteOnExit();
-			FileOutputStream os = new FileOutputStream(testClass);
-			os.write(ManipulatorTest.getBytesFromFile(new File(
-					"target/test-classes/test/AnnotatedComponent.class")));
-			os.close();
-
-			// Issue directory manipulation
-			pojoizator.directoryPojoization(tmpDir, null, manifestFile);
-
-			// Check if supplied manifest file is altered in place
-			BufferedReader fi = new BufferedReader(new FileReader(manifestFile));
-			String manifestLine;
-			while ((manifestLine = fi.readLine()) != null) {
-				if (manifestLine.contains("iPOJO-Components")) {
-					assertTrue(true);
-					return;
-				}
-			}
 
-			assertTrue(
-					"Directory Manipulation didn't use supplied manifest file as output",
-					false);
-
-		} catch (IOException e) {
-			assertTrue(
-					"File system error occured while testing directory manipulation",
-					false);
+		// To obtain OS's temp directory.
+		File tmpFile = File.createTempFile("pojodir", ".dir");
+		String tmpPath = tmpFile.getAbsolutePath();
+		tmpFile.delete();
+
+		// Creating directory on temp location
+		tmpDir = new File(tmpPath);
+		tmpDir.mkdir();
+		tmpDir.deleteOnExit();
+
+		// Create manifest file under temp directory
+		manifestFile = new File(tmpDir, "MANIFEST.MF");
+		new FileOutputStream(manifestFile).write("Manifest-Version: 1.0\r\n"
+				.getBytes());
+		manifestFile.deleteOnExit();
+
+		// Just to ensure it is not deleted later from test classes.
+		AnnotatedComponent safe;
+
+		// Annotated Class File
+		File annotedClassPackage = new File(tmpDir, "test");
+		annotedClassPackage.deleteOnExit();
+		annotedClassPackage.mkdir();
+		testClass = new File(annotedClassPackage, "AnnotatedComponent.class");
+		testClass.deleteOnExit();
+		FileOutputStream os = new FileOutputStream(testClass);
+		os.write(ManipulatorTest.getBytesFromFile(new File(
+				"target/test-classes/test/AnnotatedComponent.class")));
+		os.close();
+
+		// Issue directory manipulation
+		pojoizator.directoryPojoization(tmpDir, null, manifestFile);
+
+		// Check if supplied manifest file is altered in place
+		BufferedReader fi = new BufferedReader(new FileReader(manifestFile));
+		String manifestLine;
+		while ((manifestLine = fi.readLine()) != null) {
+			if (manifestLine.contains("iPOJO-Components")) {
+				assertTrue(true);
+				return;
+			}
 		}
 
+		assertTrue(
+				"Directory Manipulation didn't use supplied manifest file as output",
+				false);
 	}
-
 }

Modified: felix/trunk/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulation/RemanipulationTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulation/RemanipulationTest.java?rev=1346941&r1=1346940&r2=1346941&view=diff
==============================================================================
--- felix/trunk/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulation/RemanipulationTest.java
(original)
+++ felix/trunk/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulation/RemanipulationTest.java
Wed Jun  6 15:22:59 2012
@@ -1,3 +1,21 @@
+/*
+ * 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.
+ */
 package org.apache.felix.ipojo.manipulation;
 
 import junit.framework.Assert;



Mime
View raw message