You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by cl...@apache.org on 2008/03/03 16:53:06 UTC

svn commit: r633144 - in /felix/sandbox/clement/ipojo/tests: ./ tests.core/src/main/java/org/apache/felix/ipojo/test/log/ tests.core/src/main/java/org/apache/felix/ipojo/test/scenarios/factory/ tests.core/src/main/java/org/apache/felix/ipojo/test/scena...

Author: clement
Date: Mon Mar  3 07:53:05 2008
New Revision: 633144

URL: http://svn.apache.org/viewvc?rev=633144&view=rev
Log:
Modify wrong tests (Integer injection instead of Long objects).
Update the iPOJO API call in some tests.

Modified:
    felix/sandbox/clement/ipojo/tests/pom.xml
    felix/sandbox/clement/ipojo/tests/tests.core/src/main/java/org/apache/felix/ipojo/test/log/LogImpl.java
    felix/sandbox/clement/ipojo/tests/tests.core/src/main/java/org/apache/felix/ipojo/test/scenarios/factory/ConfigAdminTest.java
    felix/sandbox/clement/ipojo/tests/tests.core/src/main/java/org/apache/felix/ipojo/test/scenarios/factory/UnacceptableConfigurationTest.java
    felix/sandbox/clement/ipojo/tests/tests.core/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/ManipulationMetadataAPI.java
    felix/sandbox/clement/ipojo/tests/tests.core/src/main/java/org/apache/felix/ipojo/test/scenarios/util/Utils.java

Modified: felix/sandbox/clement/ipojo/tests/pom.xml
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo/tests/pom.xml?rev=633144&r1=633143&r2=633144&view=diff
==============================================================================
--- felix/sandbox/clement/ipojo/tests/pom.xml (original)
+++ felix/sandbox/clement/ipojo/tests/pom.xml Mon Mar  3 07:53:05 2008
@@ -11,9 +11,26 @@
   <artifactId>ipojo.tests</artifactId>
   <name>Apache Felix iPOJO Tests</name>
   <packaging>pom</packaging>
-  <modules>
-	<module>tests.core</module>
-	<module>tests.composite</module>
-  </modules>
-  
+  <profiles>
+      <profile>
+              <id>java5</id>
+              <activation>
+                      <jdk>1.5</jdk>
+              </activation>
+              <modules>
+                     <module>tests.core</module>
+					<module>tests.composite</module>
+              </modules>
+      </profile>
+      <profile>
+              <id>java6</id>
+              <activation>
+                      <jdk>1.6</jdk>
+              </activation>
+              <modules>
+                      <module>tests.core</module>
+					  <module>tests.composite</module>
+              </modules>
+      </profile>
+</profiles>  
 </project>

Modified: felix/sandbox/clement/ipojo/tests/tests.core/src/main/java/org/apache/felix/ipojo/test/log/LogImpl.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo/tests/tests.core/src/main/java/org/apache/felix/ipojo/test/log/LogImpl.java?rev=633144&r1=633143&r2=633144&view=diff
==============================================================================
--- felix/sandbox/clement/ipojo/tests/tests.core/src/main/java/org/apache/felix/ipojo/test/log/LogImpl.java (original)
+++ felix/sandbox/clement/ipojo/tests/tests.core/src/main/java/org/apache/felix/ipojo/test/log/LogImpl.java Mon Mar  3 07:53:05 2008
@@ -18,17 +18,34 @@
        add(new LogEntryImpl(arg0, arg1, null, null));
     }
 
-    public void log(int arg0, String arg1, Throwable arg2) {
-        add(new LogEntryImpl(arg0, arg1, arg2, null));
+    public void log(final int arg0, final String arg1, final Throwable arg2) {
+        Runnable runnable = new Runnable() {
+            public void run() {
+                add(new LogEntryImpl(arg0, arg1, arg2, null));
+            }
+        };
+        Thread thread = new Thread(runnable);
+        thread.start();
     }
 
-    public void log(ServiceReference arg0, int arg1, String arg2) {
-        add(new LogEntryImpl(arg1, arg2, null, arg0));
-
+    public void log(final ServiceReference arg0, final int arg1, final String arg2) {
+        Runnable runnable = new Runnable() {
+            public void run() {
+                add(new LogEntryImpl(arg1, arg2, null, arg0));
+            }
+        };
+        Thread thread = new Thread(runnable);
+        thread.start();
     }
 
-    public void log(ServiceReference arg0, int arg1, String arg2, Throwable arg3) {
-        add(new LogEntryImpl(arg1, arg2, arg3, arg0));
+    public void log(final ServiceReference arg0, final int arg1, final String arg2, final Throwable arg3) {
+        Runnable runnable = new Runnable() {
+            public void run() {
+                add(new LogEntryImpl(arg1, arg2, arg3, arg0));
+            }
+        };
+        Thread thread = new Thread(runnable);
+        thread.start();
     }
     
     private void add(LogEntry entry) {

Modified: felix/sandbox/clement/ipojo/tests/tests.core/src/main/java/org/apache/felix/ipojo/test/scenarios/factory/ConfigAdminTest.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo/tests/tests.core/src/main/java/org/apache/felix/ipojo/test/scenarios/factory/ConfigAdminTest.java?rev=633144&r1=633143&r2=633144&view=diff
==============================================================================
--- felix/sandbox/clement/ipojo/tests/tests.core/src/main/java/org/apache/felix/ipojo/test/scenarios/factory/ConfigAdminTest.java (original)
+++ felix/sandbox/clement/ipojo/tests/tests.core/src/main/java/org/apache/felix/ipojo/test/scenarios/factory/ConfigAdminTest.java Mon Mar  3 07:53:05 2008
@@ -29,7 +29,7 @@
 		
 		Properties  p = new Properties();
 		p.put("int", new Integer(3));
-		p.put("long", new Integer(42));
+		p.put("long", new Long(42));
 		p.put("string", "absdir");
 		p.put("strAProp", new String[] {"a"});
 		p.put("intAProp", new int[] {1,2});
@@ -73,7 +73,7 @@
 		
 		Properties  p = new Properties();
 		p.put("int", new Integer(3));
-		p.put("long", new Integer(42));
+		p.put("long", new Long(42));
 		p.put("string", "absdir");
 		p.put("strAProp", new String[] {"a"});
 		p.put("intAProp", new int[] {1,2});

Modified: felix/sandbox/clement/ipojo/tests/tests.core/src/main/java/org/apache/felix/ipojo/test/scenarios/factory/UnacceptableConfigurationTest.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo/tests/tests.core/src/main/java/org/apache/felix/ipojo/test/scenarios/factory/UnacceptableConfigurationTest.java?rev=633144&r1=633143&r2=633144&view=diff
==============================================================================
--- felix/sandbox/clement/ipojo/tests/tests.core/src/main/java/org/apache/felix/ipojo/test/scenarios/factory/UnacceptableConfigurationTest.java (original)
+++ felix/sandbox/clement/ipojo/tests/tests.core/src/main/java/org/apache/felix/ipojo/test/scenarios/factory/UnacceptableConfigurationTest.java Mon Mar  3 07:53:05 2008
@@ -14,7 +14,7 @@
 		
 		Properties  p = new Properties();
 		p.put("int", new Integer(3));
-		p.put("long", new Integer(42));
+		p.put("long", new Long(42));
 		p.put("string", "absdir");
 		p.put("strAProp", new String[] {"a"});
 		p.put("intAProp", new int[] {1,2});
@@ -23,7 +23,7 @@
 		try {
 			ci = f.createComponentInstance(p);
 			ci.dispose();
-		} catch(Exception e) { fail("an acceptable configuration is refused"); }
+		} catch(Exception e) { fail("an acceptable configuration is refused : " + e.getMessage()); }
 		
 	}
 	
@@ -79,7 +79,7 @@
 		Properties  p = new Properties();
 		p.put("name", "ok");
 		p.put("int", new Integer(3));
-		p.put("long", new Integer(42));
+		p.put("long", new Long(42));
 		p.put("string", "absdir");
 		p.put("strAProp", new String[] {"a"});
 		p.put("intAProp", new int[] {1,2});
@@ -109,6 +109,7 @@
 			ci = f.createComponentInstance(p);
 			ci.dispose();
 		} catch(Exception e) {
+		    e.printStackTrace();
 			fail("An acceptable configuration is rejected : " + e.getMessage());
 		}
 	}
@@ -119,7 +120,7 @@
 		Properties  p = new Properties();
 		p.put("name", "ok");
 		p.put("int", new Integer(3));
-		p.put("long", new Integer(42));
+		p.put("long", new Long(42));
 		p.put("string", "absdir");
 		p.put("strAProp", new String[] {"a"});
 		p.put("intAProp", new int[] {1,2});

Modified: felix/sandbox/clement/ipojo/tests/tests.core/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/ManipulationMetadataAPI.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo/tests/tests.core/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/ManipulationMetadataAPI.java?rev=633144&r1=633143&r2=633144&view=diff
==============================================================================
--- felix/sandbox/clement/ipojo/tests/tests.core/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/ManipulationMetadataAPI.java (original)
+++ felix/sandbox/clement/ipojo/tests/tests.core/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/ManipulationMetadataAPI.java Mon Mar  3 07:53:05 2008
@@ -88,7 +88,7 @@
 		field = manip.getField("intProp");		
 		assertEquals("Check field name : " + field.getFieldName(), field.getFieldName(), "intProp");
 		assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "int");
-        assertEquals("Check field reflective type : " + field.getFieldName(), field.getReflectionType(), "int");
+        assertEquals("Check field reflective type : " + field.getFieldName(), FieldMetadata.getReflectionType(field.getFieldType()), "int");
         
         field = manip.getField("intProp", "int");      
         assertEquals("Check field name : " + field.getFieldName(), field.getFieldName(), "intProp");
@@ -100,7 +100,7 @@
 		field = manip.getField("strProp");
 		assertEquals("Check field name : " + field.getFieldName(), field.getFieldName(), "strProp");
 		assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "java.lang.String");
-        assertEquals("Check field reflective type : " + field.getFieldName(), field.getReflectionType(), "java.lang.String");
+        assertEquals("Check field reflective type : " + field.getFieldName(), FieldMetadata.getReflectionType(field.getFieldType()), "java.lang.String");
         
         field = manip.getField("strProp", "String");
         assertNull("Check bad field", field);
@@ -112,7 +112,7 @@
 		field = manip.getField("strAProp");
 		assertEquals("Check field name : " + field.getFieldName(), field.getFieldName(), "strAProp");
 		assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "java.lang.String[]");
-        assertEquals("Check field reflective type : " + field.getFieldName() + " -> " + field.getReflectionType(), field.getReflectionType(), "[Ljava.lang.String;");
+        assertEquals("Check field reflective type : " + field.getFieldName() + " -> " + FieldMetadata.getReflectionType(field.getFieldType()), FieldMetadata.getReflectionType(field.getFieldType()), "[Ljava.lang.String;");
         
         field = manip.getField("strAProp", "java.lang.String[]");
         assertEquals("Check field name : " + field.getFieldName(), field.getFieldName(), "strAProp");
@@ -124,7 +124,7 @@
 		field = manip.getField("intAProp");
 		assertEquals("Check field name : " + field.getFieldName(), field.getFieldName(), "intAProp");
 		assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "int[]");
-        assertEquals("Check field reflective type : " + field.getFieldName() + " -> " + field.getReflectionType(), field.getReflectionType(), "[I");
+        assertEquals("Check field reflective type : " + field.getFieldName() + " -> " + FieldMetadata.getReflectionType(field.getFieldType()), FieldMetadata.getReflectionType(field.getFieldType()), "[I");
         
         field = manip.getField("intAProp", "int[]");
         assertEquals("Check field name : " + field.getFieldName(), field.getFieldName(), "intAProp");
@@ -136,7 +136,7 @@
 		field = manip.getField("boolProp");
 		assertEquals("Check field name : " + field.getFieldName(), field.getFieldName(), "boolProp");
 		assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "boolean");
-        assertEquals("Check field reflective type : " + field.getFieldName(), field.getReflectionType(), "boolean");
+        assertEquals("Check field reflective type : " + field.getFieldName(), FieldMetadata.getReflectionType(field.getFieldType()), "boolean");
         
         field = manip.getField("boolProp", "boolean");
         assertEquals("Check field name : " + field.getFieldName(), field.getFieldName(), "boolProp");

Modified: felix/sandbox/clement/ipojo/tests/tests.core/src/main/java/org/apache/felix/ipojo/test/scenarios/util/Utils.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo/tests/tests.core/src/main/java/org/apache/felix/ipojo/test/scenarios/util/Utils.java?rev=633144&r1=633143&r2=633144&view=diff
==============================================================================
--- felix/sandbox/clement/ipojo/tests/tests.core/src/main/java/org/apache/felix/ipojo/test/scenarios/util/Utils.java (original)
+++ felix/sandbox/clement/ipojo/tests/tests.core/src/main/java/org/apache/felix/ipojo/test/scenarios/util/Utils.java Mon Mar  3 07:53:05 2008
@@ -10,7 +10,7 @@
 import org.apache.felix.ipojo.Handler;
 import org.apache.felix.ipojo.HandlerFactory;
 import org.apache.felix.ipojo.ServiceContext;
-import org.apache.felix.ipojo.composite.CompositeManager;
+//import org.apache.felix.ipojo.composite.CompositeManager;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.InvalidSyntaxException;
 import org.osgi.framework.ServiceReference;
@@ -159,13 +159,13 @@
         }
     }
 
-    public static ServiceContext getServiceContext(ComponentInstance ci) {
-        if (ci instanceof CompositeManager) {
-            return ((CompositeManager) ci).getServiceContext();
-        } else {
-            throw new RuntimeException("Cannot get the service context form an non composite instance");
-        }
-    }
+//    public static ServiceContext getServiceContext(ComponentInstance ci) {
+//        if (ci instanceof CompositeManager) {
+//            return ((CompositeManager) ci).getServiceContext();
+//        } else {
+//            throw new RuntimeException("Cannot get the service context form an non composite instance");
+//        }
+//    }
 
     public static Factory getFactoryByName(ServiceContext bc, String factoryName) {
         ServiceReference[] refs;