felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clem...@apache.org
Subject svn commit: r701978 [3/5] - in /felix/trunk/ipojo/tests: ./ core/configadmin/ core/configadmin/src/main/java/org/apache/felix/ipojo/test/scenarios/configadmin/ core/configadmin/src/main/java/org/apache/felix/ipojo/test/scenarios/configuration/ core/con...
Date Mon, 06 Oct 2008 07:55:43 GMT
Added: felix/trunk/ipojo/tests/manipulator/creation/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/service/BarService.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/manipulator/creation/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/service/BarService.java?rev=701978&view=auto
==============================================================================
--- felix/trunk/ipojo/tests/manipulator/creation/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/service/BarService.java (added)
+++ felix/trunk/ipojo/tests/manipulator/creation/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/service/BarService.java Mon Oct  6 00:55:39 2008
@@ -0,0 +1,29 @@
+/* 
+ * 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.test.scenarios.manipulation.service;
+
+import java.util.Properties;
+
+public interface BarService {
+	
+	public boolean bar();
+	
+	public Properties getProps();
+
+}

Added: felix/trunk/ipojo/tests/manipulator/creation/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/service/CheckService.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/manipulator/creation/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/service/CheckService.java?rev=701978&view=auto
==============================================================================
--- felix/trunk/ipojo/tests/manipulator/creation/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/service/CheckService.java (added)
+++ felix/trunk/ipojo/tests/manipulator/creation/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/service/CheckService.java Mon Oct  6 00:55:39 2008
@@ -0,0 +1,31 @@
+/* 
+ * 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.test.scenarios.manipulation.service;
+
+import java.util.Properties;
+
+public interface CheckService {
+    
+    public static final String foo = "foo";
+	
+	public boolean check();
+	
+	public Properties getProps();
+
+}

Added: felix/trunk/ipojo/tests/manipulator/creation/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/service/FooService.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/manipulator/creation/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/service/FooService.java?rev=701978&view=auto
==============================================================================
--- felix/trunk/ipojo/tests/manipulator/creation/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/service/FooService.java (added)
+++ felix/trunk/ipojo/tests/manipulator/creation/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/service/FooService.java Mon Oct  6 00:55:39 2008
@@ -0,0 +1,39 @@
+/* 
+ * 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.test.scenarios.manipulation.service;
+
+import java.util.Properties;
+
+public interface FooService {
+
+	boolean foo();
+	
+	Properties fooProps();
+	
+	Boolean getObject();
+	
+	boolean getBoolean();
+	
+	int getInt();
+	
+	long getLong();
+	
+	double getDouble();
+	
+}

Added: felix/trunk/ipojo/tests/manipulator/creation/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/service/Plop.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/manipulator/creation/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/service/Plop.java?rev=701978&view=auto
==============================================================================
--- felix/trunk/ipojo/tests/manipulator/creation/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/service/Plop.java (added)
+++ felix/trunk/ipojo/tests/manipulator/creation/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/service/Plop.java Mon Oct  6 00:55:39 2008
@@ -0,0 +1,7 @@
+package org.apache.felix.ipojo.test.scenarios.manipulation.service;
+
+public interface Plop {
+    
+   Object getPlop();
+
+}

Added: felix/trunk/ipojo/tests/manipulator/creation/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/service/PrimitiveManipulationTestService.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/manipulator/creation/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/service/PrimitiveManipulationTestService.java?rev=701978&view=auto
==============================================================================
--- felix/trunk/ipojo/tests/manipulator/creation/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/service/PrimitiveManipulationTestService.java (added)
+++ felix/trunk/ipojo/tests/manipulator/creation/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/service/PrimitiveManipulationTestService.java Mon Oct  6 00:55:39 2008
@@ -0,0 +1,75 @@
+/* 
+ * 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.test.scenarios.manipulation.service;
+
+public interface PrimitiveManipulationTestService {
+	
+	byte getByte();
+	void setByte(byte b);
+	
+	short getShort();
+	void setShort(short s);
+	
+	int getInt();
+	void setInt(int i);
+	
+	long getLong();
+	void setLong(long l);
+	
+	float getFloat();
+	void setFloat(float f);
+	
+	double getDouble();
+	void setDouble(double d);
+	
+	char getChar();
+	void setChar(char c);
+	
+	boolean getBoolean();
+	void setBoolean(boolean b);
+	
+	// Array types
+	byte[] getBytes();
+	void setBytes(byte[] bs);
+	
+	short[] getShorts();
+	void setShorts(short[] ss);
+	
+	int[] getInts();
+	void setInts(int is[]);
+	
+	long[] getLongs();
+	void setLongs(long[] ls);
+	
+	float[] getFloats();
+	void setFloats(float[] fs);
+	
+	double[] getDoubles();
+	void setDoubles(double[] ds);
+	
+	char[] getChars();
+	void setChars(char[] cs);
+	
+	boolean[] getBooleans();
+	void setBooleans(boolean[] bs);	
+	
+	// This method has been added to test an issue when autoboxing.
+	void setLong(long l, String s);
+
+}

Added: felix/trunk/ipojo/tests/manipulator/creation/src/main/java/org/apache/felix/ipojo/test/scenarios/util/Utils.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/manipulator/creation/src/main/java/org/apache/felix/ipojo/test/scenarios/util/Utils.java?rev=701978&view=auto
==============================================================================
--- felix/trunk/ipojo/tests/manipulator/creation/src/main/java/org/apache/felix/ipojo/test/scenarios/util/Utils.java (added)
+++ felix/trunk/ipojo/tests/manipulator/creation/src/main/java/org/apache/felix/ipojo/test/scenarios/util/Utils.java Mon Oct  6 00:55:39 2008
@@ -0,0 +1,329 @@
+/* 
+ * 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.test.scenarios.util;
+
+import java.util.Dictionary;
+import java.util.Properties;
+
+import junit.framework.Assert;
+
+import org.apache.felix.ipojo.ComponentInstance;
+import org.apache.felix.ipojo.Factory;
+import org.apache.felix.ipojo.Handler;
+import org.apache.felix.ipojo.HandlerManagerFactory;
+import org.apache.felix.ipojo.ServiceContext;
+import org.apache.felix.ipojo.architecture.Architecture;
+//import org.apache.felix.ipojo.composite.CompositeManager;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.cm.ManagedServiceFactory;
+
+public class Utils {
+
+    public static Factory getFactoryByName(BundleContext bc, String factoryName) {
+        ServiceReference[] refs;
+        try {
+            refs = bc.getServiceReferences(Factory.class.getName(), "(factory.name=" + factoryName + ")");
+            if (refs == null) {
+                System.err.println("Cannot get the factory " + factoryName);
+                return null;
+            }
+            return ((Factory) bc.getService(refs[0]));
+        } catch (InvalidSyntaxException e) {
+            System.err.println("Cannot get the factory " + factoryName + " : " + e.getMessage());
+            return null;
+        }
+    }
+
+    public static HandlerManagerFactory getHandlerFactoryByName(BundleContext bc, String factoryName) {
+        ServiceReference[] refs;
+        try {
+            refs = bc.getServiceReferences(Factory.class.getName(), "(" + Handler.HANDLER_NAME_PROPERTY + "=" + factoryName + ")");
+            if (refs == null) {
+                System.err.println("Cannot get the factory " + factoryName);
+                return null;
+            }
+            return (HandlerManagerFactory) bc.getService(refs[0]);
+        } catch (InvalidSyntaxException e) {
+            System.err.println("Cannot get the factory " + factoryName + " : " + e.getMessage());
+            return null;
+        }
+    }
+
+    public static ComponentInstance getComponentInstance(BundleContext bc, String factoryName, Dictionary configuration) {
+        Factory fact = getFactoryByName(bc, factoryName);
+
+        if (fact == null) {
+            System.err.println("Factory " + factoryName + " not found");
+            return null;
+        }
+
+        // if(fact.isAcceptable(configuration)) {
+        try {
+            return fact.createComponentInstance(configuration);
+        } catch (Exception e) {
+            e.printStackTrace();
+            Assert.fail("Cannot create the instance from " + factoryName + " : " + e.getMessage());
+            return null;
+        }
+        // }
+        // else {
+        // System.err.println("Configuration not accepted by : " + factoryName);
+        // return null;
+        // }
+    }
+
+    public static ComponentInstance getComponentInstanceByName(BundleContext bc, String factoryName, String name) {
+        Factory fact = getFactoryByName(bc, factoryName);
+
+        if (fact == null) {
+            System.err.println("Factory " + factoryName + " not found");
+            return null;
+        }
+
+        try {
+            Properties props = new Properties();
+            props.put("instance.name",name);
+            return fact.createComponentInstance(props);
+        } catch (Exception e) {
+            System.err.println("Cannot create the instance from " + factoryName + " : " + e.getMessage());
+            e.printStackTrace();
+            return null;
+        }
+    }
+
+    public static ServiceReference[] getServiceReferences(BundleContext bc, String itf, String filter) {
+        ServiceReference[] refs = null;
+        try {
+            refs = bc.getServiceReferences(itf, filter);
+        } catch (InvalidSyntaxException e) {
+            System.err.println("Invalid Filter : " + filter);
+        }
+        if (refs == null) {
+            return new ServiceReference[0];
+        } else {
+            return refs;
+        }
+    }
+
+    public static ServiceReference getServiceReference(BundleContext bc, String itf, String filter) {
+        ServiceReference[] refs = null;
+        try {
+            refs = bc.getServiceReferences(itf, filter);
+        } catch (InvalidSyntaxException e) {
+            System.err.println("Invalid Filter : " + filter);
+        }
+        if (refs == null) {
+            return null;
+        } else {
+            return refs[0];
+        }
+    }
+
+    public static ServiceReference getServiceReferenceByName(BundleContext bc, String itf, String name) {
+        ServiceReference[] refs = null;
+        String filter = null;
+        if (itf.equals(Factory.class.getName()) || itf.equals(ManagedServiceFactory.class.getName())) {
+            filter = "(" + "factory.name" + "=" + name + ")";
+        } else if (itf.equals(Architecture.class.getName())) {
+            filter = "(" + "architecture.instance" + "=" + name + ")";
+        } else {
+            filter = "(" + "instance.name" + "=" + name + ")";
+        }
+        try {
+            refs = bc.getServiceReferences(itf, filter);
+        } catch (InvalidSyntaxException e) {
+            System.err.println("Invalid Filter : " + filter);
+        }
+        if (refs == null) {
+            return null;
+        } else {
+            return refs[0];
+        }
+    }
+    
+    public static ServiceReference getServiceReferenceByPID(BundleContext bc, String itf, String pid) {
+        ServiceReference[] refs = null;
+        String filter = "(" + "service.pid" + "=" + pid + ")";
+        try {
+            refs = bc.getServiceReferences(itf, filter);
+        } catch (InvalidSyntaxException e) {
+            System.err.println("Invalid Filter : " + filter);
+        }
+        if (refs == null) {
+            return null;
+        } else if (refs.length == 1) {
+            return refs[0];
+        } else {
+            Assert.fail("A service lookup by PID returned several providers (" + refs.length + ")" + " for " + itf + " with " + pid);
+            return null;
+        }
+    }
+
+    public static Object getServiceObject(BundleContext bc, String itf, String filter) {
+        ServiceReference ref = getServiceReference(bc, itf, filter);
+        if (ref != null) {
+            return bc.getService(ref);
+        } else {
+            return null;
+        }
+    }
+
+    public static Object[] getServiceObjects(BundleContext bc, String itf, String filter) {
+        ServiceReference[] refs = getServiceReferences(bc, itf, filter);
+        if (refs != null) {
+            Object[] list = new Object[refs.length];
+            for (int i = 0; i < refs.length; i++) {
+                list[i] = bc.getService(refs[i]);
+            }
+            return list;
+        } else {
+            return new Object[0];
+        }
+    }
+
+//    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;
+        try {
+            refs = bc.getServiceReferences(Factory.class.getName(), "(factory.name=" + factoryName + ")");
+            if (refs == null) { return null; }
+            return ((Factory) bc.getService(refs[0]));
+        } catch (InvalidSyntaxException e) {
+            System.err.println("Cannot get the factory " + factoryName + " : " + e.getMessage());
+            return null;
+        }
+    }
+
+    public static ComponentInstance getComponentInstance(ServiceContext bc, String factoryName, Dictionary configuration) {
+        Factory fact = getFactoryByName(bc, factoryName);
+
+        if (fact == null) { return null; }
+
+        if (fact.isAcceptable(configuration)) {
+            try {
+                return fact.createComponentInstance(configuration);
+            } catch (Exception e) {
+                System.err.println(e.getMessage());
+                e.printStackTrace();
+                return null;
+            }
+        } else {
+            System.err.println("Configuration not accepted by : " + factoryName);
+            return null;
+        }
+    }
+
+    public static ServiceReference[] getServiceReferences(ServiceContext bc, String itf, String filter) {
+        ServiceReference[] refs = null;
+        try {
+            refs = bc.getServiceReferences(itf, filter);
+        } catch (InvalidSyntaxException e) {
+            System.err.println("Invalid Filter : " + filter);
+        }
+        if (refs == null) {
+            return new ServiceReference[0];
+        } else {
+            return refs;
+        }
+    }
+
+    public static ServiceReference getServiceReference(ServiceContext bc, String itf, String filter) {
+        ServiceReference[] refs = null;
+        try {
+            refs = bc.getServiceReferences(itf, filter);
+        } catch (InvalidSyntaxException e) {
+            System.err.println("Invalid Filter : " + filter);
+        }
+        if (refs == null) {
+            return null;
+        } else {
+            return refs[0];
+        }
+    }
+
+    public static ServiceReference getServiceReferenceByName(ServiceContext bc, String itf, String name) {
+        ServiceReference[] refs = null;
+        String filter = null;
+        if (itf.equals(Factory.class.getName()) || itf.equals(ManagedServiceFactory.class.getName())) {
+            filter = "(" + "factory.name" + "=" + name + ")";
+        } else {
+            filter = "(" + "instance.name" + "=" + name + ")";
+        }
+        try {
+            refs = bc.getServiceReferences(itf, filter);
+        } catch (InvalidSyntaxException e) {
+            System.err.println("Invalid Filter : " + filter);
+        }
+        if (refs == null) {
+            return null;
+        } else {
+            return refs[0];
+        }
+    }
+
+    public static Object getServiceObject(ServiceContext bc, String itf, String filter) {
+        ServiceReference ref = getServiceReference(bc, itf, filter);
+        if (ref != null) {
+            return bc.getService(ref);
+        } else {
+            return null;
+        }
+    }
+
+    public static Object[] getServiceObjects(ServiceContext bc, String itf, String filter) {
+        ServiceReference[] refs = getServiceReferences(bc, itf, filter);
+        if (refs != null) {
+            Object[] list = new Object[refs.length];
+            for (int i = 0; i < refs.length; i++) {
+                list[i] = bc.getService(refs[i]);
+            }
+            return list;
+        } else {
+            return new Object[0];
+        }
+    }
+    
+    public static boolean contains(String string, String[] array) {
+        for (int i = 0; array != null && i < array.length; i++) {
+            if (array[i] != null  && array[i].equals(string)) {
+                return true;
+            }
+        }
+        return false;
+    }
+    
+    public static boolean contains(int value, int[] array) {
+        for (int i = 0; array != null && i < array.length; i++) {
+            if (array[i] == value) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+}

Added: felix/trunk/ipojo/tests/manipulator/creation/src/main/resources/metadata.xml
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/manipulator/creation/src/main/resources/metadata.xml?rev=701978&view=auto
==============================================================================
--- felix/trunk/ipojo/tests/manipulator/creation/src/main/resources/metadata.xml (added)
+++ felix/trunk/ipojo/tests/manipulator/creation/src/main/resources/metadata.xml Mon Oct  6 00:55:39 2008
@@ -0,0 +1,60 @@
+<ipojo
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="org.apache.felix.ipojo http://people.apache.org/~clement/ipojo/schemas/core.xsd"
+    xmlns="org.apache.felix.ipojo"
+>
+	<!-- Simple provider  used for manipulation analysis -->
+	<component
+		classname="org.apache.felix.ipojo.test.scenarios.component.FooProviderType1"
+		name="ManipulationCreation-FooProviderType-1" architecture="true">
+		<provides />
+	</component>
+	
+	<!-- Non lazzy service provider, to check instantiation -->
+	<component
+		classname="org.apache.felix.ipojo.test.scenarios.component.FooProviderType1"
+		name="ManipulationCreation-ImmediateFooProviderType" immediate="true"
+		architecture="true">
+		<provides />
+	</component>
+	
+	<!-- Type checking different creation policy -->
+	<component
+		classname="org.apache.felix.ipojo.test.scenarios.component.FooProviderType1"
+		name="ManipulationCreation-FooProviderType-1-Sing" factory-method="singleton"
+		architecture="true">
+		<provides />
+	</component>
+	
+	<component
+		classname="org.apache.felix.ipojo.test.scenarios.component.FooProviderType1"
+		name="ManipulationCreation-FooProviderType-1-Sev" factory-method="several"
+		architecture="true">
+		<provides />
+	</component>
+	
+	<component
+		classname="org.apache.felix.ipojo.test.scenarios.component.FooProviderType1"
+		name="ManipulationCreation-FooProviderType-1-SingM" factory-method="singleton"
+		architecture="true">
+		<provides/>
+	</component>
+	
+	<component
+		classname="org.apache.felix.ipojo.test.scenarios.component.FooProviderType1"
+		name="ManipulationCreation-FooProviderType-1-SevM" factory-method="several"
+		architecture="true">
+		<provides/>
+	</component>
+	
+	<component
+		classname="org.apache.felix.ipojo.test.scenarios.component.FooProviderType1"
+		name="ManipulationCreation-ImmediateFooProviderTypeSingleton" immediate="true"
+		factory-method="singleton" architecture="true">
+		<provides />
+	</component>
+	
+	
+	<!-- Try calling super constructors -->
+	 <component classname="org.apache.felix.ipojo.test.scenarios.component.CallSuperConstructor" immediate="true"/>
+</ipojo>

Modified: felix/trunk/ipojo/tests/manipulator/manipulation/pom.xml
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/manipulator/manipulation/pom.xml?rev=701978&r1=701977&r2=701978&view=diff
==============================================================================
--- felix/trunk/ipojo/tests/manipulator/manipulation/pom.xml (original)
+++ felix/trunk/ipojo/tests/manipulator/manipulation/pom.xml Mon Oct  6 00:55:39 2008
@@ -93,8 +93,8 @@
 				<groupId>org.apache.maven.plugins</groupId>
 				<artifactId>maven-compiler-plugin</artifactId>
 				<configuration>
-					<source>1.5</source>
-					<target>1.5</target>
+					<source>1.4</source>
+					<target>1.4</target>
 				</configuration>
 			</plugin>
 		</plugins>

Modified: felix/trunk/ipojo/tests/manipulator/manipulation/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/ManipulationTestSuite.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/manipulator/manipulation/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/ManipulationTestSuite.java?rev=701978&r1=701977&r2=701978&view=diff
==============================================================================
--- felix/trunk/ipojo/tests/manipulator/manipulation/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/ManipulationTestSuite.java (original)
+++ felix/trunk/ipojo/tests/manipulator/manipulation/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/ManipulationTestSuite.java Mon Oct  6 00:55:39 2008
@@ -27,15 +27,9 @@
 
 	public static Test suite(BundleContext bc) {
 		OSGiTestSuite ots = new OSGiTestSuite("Manipulation Test Suite", bc);
-		ots.addTestSuite(ManipulationMetadata.class);
-		ots.addTestSuite(PrimitiveTypeTest.class);
-		ots.addTestSuite(PrimitiveTypeTest2.class);
 		ots.addTestSuite(GetComponentInstanceTest.class);
-        ots.addTestSuite(ManipulationMetadataAPI.class);
         ots.addTestSuite(ExceptionTest.class);
-        ots.addTestSuite(POJOCreation.class);
         ots.addTestSuite(NestedClassesTests.class);
-        ots.addTestSuite(DuplicateMethod.class);
 		return ots;
 	}
 

Modified: felix/trunk/ipojo/tests/manipulator/manipulation/src/main/resources/metadata.xml
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/manipulator/manipulation/src/main/resources/metadata.xml?rev=701978&r1=701977&r2=701978&view=diff
==============================================================================
--- felix/trunk/ipojo/tests/manipulator/manipulation/src/main/resources/metadata.xml (original)
+++ felix/trunk/ipojo/tests/manipulator/manipulation/src/main/resources/metadata.xml Mon Oct  6 00:55:39 2008
@@ -18,87 +18,6 @@
 		<provides />
 	</component>
 	
-	<!-- Provider providing 2 services -->
-	<component
-		classname="org.apache.felix.ipojo.test.scenarios.component.FooBarProviderType1"
-		name="Manipulation-FooBarProviderType-1" architecture="true">
-		<provides />
-	</component>
-	
-	<!-- Provider with dynamic property -->
-	<component
-		classname="org.apache.felix.ipojo.test.scenarios.component.FooProviderTypeDyn"
-		name="Manipulation-FooProviderType-Dyn" architecture="true">
-		<provides>
-			<property name="int" field="intProp" value="2" />
-			<property name="boolean" field="boolProp" value="false" />
-			<property name="string" field="strProp" value="foo" />
-			<property name="strAProp" field="strAProp"
-				value="[foo, bar]" />
-			<property name="intAProp" field="intAProp" value="[ 1,2,3]" />
-		</provides>
-	</component>
-	
-	<!-- Manipulation -->
-	<component
-		classname="org.apache.felix.ipojo.test.scenarios.component.Manipulation23Tester"
-		name="Manipulation-PrimitiveManipulationTester" architecture="true">
-		<provides />
-	</component>
-
-	<!-- Manipulation with numbers -->
-	<component
-		classname="org.apache.felix.ipojo.test.scenarios.component.A123.Manipulation23Tester"
-		name="Manipulation-PrimitiveManipulationTesterA" architecture="true">
-		<provides />
-	</component>
-	
-	<component
-		classname="org.apache.felix.ipojo.test.scenarios.component.MultipleCheckService"
-		name="Manipulation-SimpleMultipleCheckServiceProvider" architecture="true">
-		<requires field="fs" />
-		<provides />
-	</component>
-	
-	<!-- Type checking different creation policy -->
-	<component
-		classname="org.apache.felix.ipojo.test.scenarios.component.FooProviderType1"
-		name="Manipulation-FooProviderType-1-Sing" factory-method="singleton"
-		architecture="true">
-		<provides />
-	</component>
-	
-	<component
-		classname="org.apache.felix.ipojo.test.scenarios.component.FooProviderType1"
-		name="Manipulation-FooProviderType-1-Sev" factory-method="several"
-		architecture="true">
-		<provides />
-	</component>
-	
-	<component
-		classname="org.apache.felix.ipojo.test.scenarios.component.FooProviderType1"
-		name="Manipulation-FooProviderType-1-SingM" factory-method="singleton"
-		architecture="true">
-		<provides/>
-	</component>
-	
-	<component
-		classname="org.apache.felix.ipojo.test.scenarios.component.FooProviderType1"
-		name="Manipulation-FooProviderType-1-SevM" factory-method="several"
-		architecture="true">
-		<provides/>
-	</component>
-	
-	<component
-		classname="org.apache.felix.ipojo.test.scenarios.component.FooProviderType1"
-		name="Manipulation-ImmediateFooProviderTypeSingleton" immediate="true"
-		factory-method="singleton" architecture="true">
-		<provides />
-	</component>
-	
-	<!-- Try calling super constructors -->
-	 <component classname="org.apache.felix.ipojo.test.scenarios.component.CallSuperConstructor" immediate="true"/>
-
 	<!-- Nested & Inner classes -->
 	<component name="inners" classname="org.apache.felix.ipojo.test.scenarios.component.InnerClasses">
 		<provides>
@@ -115,9 +34,4 @@
 			<property field="publicInt"/>
 		</provides>
 	</component>
-	
-	<!-- Check duplicate method issue -->
-	<component classname="org.apache.felix.ipojo.test.scenarios.component.PlopImpl" name="plopimpl">
-		<provides></provides>
-	</component>
 </ipojo>

Propchange: felix/trunk/ipojo/tests/manipulator/manipulator-java5/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Oct  6 00:55:39 2008
@@ -0,0 +1,4 @@
+.classpath
+.project
+.settings
+target

Added: felix/trunk/ipojo/tests/manipulator/manipulator-java5/pom.xml
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/manipulator/manipulator-java5/pom.xml?rev=701978&view=auto
==============================================================================
--- felix/trunk/ipojo/tests/manipulator/manipulator-java5/pom.xml (added)
+++ felix/trunk/ipojo/tests/manipulator/manipulator-java5/pom.xml Mon Oct  6 00:55:39 2008
@@ -0,0 +1,102 @@
+<!--
+	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.
+-->
+<project>
+	<modelVersion>4.0.0</modelVersion>
+	<packaging>bundle</packaging>
+	<name>iPOJO Manipulation Test Suite For Java 5</name>
+	<artifactId>tests.manipulation.java5</artifactId>
+	<groupId>ipojo.tests</groupId>
+	<version>0.9.0-SNAPSHOT</version>
+	<dependencies>
+		<dependency>
+			<groupId>org.apache.felix</groupId>
+			<artifactId>org.apache.felix.ipojo</artifactId>
+			<version>0.9.0-SNAPSHOT</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.felix</groupId>
+			<artifactId>org.apache.felix.ipojo.metadata</artifactId>
+			<version>0.9.0-SNAPSHOT</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.felix</groupId>
+			<artifactId>org.osgi.core</artifactId>
+			<version>1.0.0</version>
+		</dependency>
+		<dependency>
+			<groupId>junit</groupId>
+			<artifactId>junit</artifactId>
+			<version>3.8.1</version>
+		</dependency>
+		<dependency>
+			<groupId>ipojo.examples</groupId>
+			<artifactId>org.apache.felix.ipojo.junit4osgi</artifactId>
+			<version>0.9.0-SNAPSHOT</version>
+		</dependency>
+	</dependencies>
+	<build>
+		<plugins>
+			<plugin>
+				<groupId>org.apache.felix</groupId>
+				<artifactId>maven-bundle-plugin</artifactId>
+				<version>1.4.2</version>
+				<extensions>true</extensions>
+				<configuration>
+					<instructions>
+						<Export-Package>
+							org.apache.felix.ipojo.test.scenarios.manipulation.service
+						</Export-Package>
+						<Bundle-SymbolicName>
+							${pom.artifactId}
+						</Bundle-SymbolicName>
+						<Private-Package>
+							org.apache.felix.ipojo.test*
+						</Private-Package>
+						<Test-Suite>
+							org.apache.felix.ipojo.test.scenarios.manipulation.ManipulationTestSuite
+						</Test-Suite>
+					</instructions>
+				</configuration>
+			</plugin>
+			<plugin>
+				<groupId>org.apache.felix</groupId>
+				<artifactId>maven-ipojo-plugin</artifactId>
+				<version>0.9.0-SNAPSHOT</version>
+				<executions>
+					<execution>
+						<goals>
+							<goal>ipojo-bundle</goal>
+						</goals>
+						<configuration>
+							<ignoreAnnotations>true</ignoreAnnotations>
+						</configuration>
+					</execution>
+				</executions>
+			</plugin>
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-compiler-plugin</artifactId>
+				<configuration>
+					<source>1.5</source>
+					<target>1.5</target>
+				</configuration>
+			</plugin>
+		</plugins>
+	</build>
+</project>

Added: felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/component/Annotation.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/component/Annotation.java?rev=701978&view=auto
==============================================================================
--- felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/component/Annotation.java (added)
+++ felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/component/Annotation.java Mon Oct  6 00:55:39 2008
@@ -0,0 +1,29 @@
+package org.apache.felix.ipojo.test.scenarios.component;
+
+import org.apache.felix.ipojo.test.scenarios.component.Marker.Type;
+
+public class Annotation {
+    
+    @Marker(name="marker", type=Type.BAR, 
+            sub=@SubMarker(subname="foo"),
+            arrayOfObjects={"foo", "bar", "baz"},
+            arrayOfAnnotations= {@SubMarker(subname="foo")}
+    )
+    @SubMarker(subname="bar")
+    @Invisible
+    public void doSomething() {
+        System.out.println("Foo ...");
+    }
+    
+    @Marker(name="marker", type=Type.BAR, 
+            sub=@SubMarker(subname="foo"),
+            arrayOfObjects={"foo", "bar", "baz"},
+            arrayOfAnnotations= {@SubMarker(subname="foo")}
+    )
+    @SubMarker(subname="bar")
+    @Invisible
+    public Annotation() {
+        
+    }
+
+}

Added: felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/component/Invisible.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/component/Invisible.java?rev=701978&view=auto
==============================================================================
--- felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/component/Invisible.java (added)
+++ felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/component/Invisible.java Mon Oct  6 00:55:39 2008
@@ -0,0 +1,5 @@
+package org.apache.felix.ipojo.test.scenarios.component;
+
+public @interface Invisible {
+
+}

Added: felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/component/Manipulation23Tester.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/component/Manipulation23Tester.java?rev=701978&view=auto
==============================================================================
--- felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/component/Manipulation23Tester.java (added)
+++ felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/component/Manipulation23Tester.java Mon Oct  6 00:55:39 2008
@@ -0,0 +1,124 @@
+/* 
+ * 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.test.scenarios.component;
+
+import org.apache.felix.ipojo.test.scenarios.manipulation.service.PrimitiveManipulationTestService;
+
+
+public class Manipulation23Tester implements PrimitiveManipulationTestService {
+	
+	// Integer types
+	byte b = 1;
+	short s = 1;
+	int i = 1;
+	long l = 1;
+	
+	// Floatting types
+	double d = 1.1;
+	float f = 1.1f;
+	
+	// Character
+	char c = 'a';
+	
+	// Boolean
+	boolean bool = false;
+	
+	// Integer arrays 
+	byte[] bs = new byte[] {0,1,2};
+	short[] ss = new short[] {0,1,2};
+	int[] is = new int[] {0,1,2};
+	long[] ls = new long[] {0,1,2};
+	
+	double[] ds = new double[] {0.0, 1.1, 2.2};
+	float[] fs = new float[] {0.0f, 1.1f, 2.2f};
+	
+	char[] cs = new char[] {'a', 'b', 'c'};
+	
+	boolean[] bools = new boolean[] {false, true, false};
+
+	public boolean getBoolean() { return bool; }
+
+	public boolean[] getBooleans() { return bools; }
+
+	public byte getByte() { return b; }
+
+	public byte[] getBytes() { return bs; }
+
+	public char getChar() { return c; }
+
+	public char[] getChars() { return cs; }
+
+	public double getDouble() { return d; }
+
+	public double[] getDoubles() { return ds; }
+
+	public float getFloat() { return f; }
+
+	public float[] getFloats() { return fs; }
+
+	public int getInt() { return i; }
+
+	public int[] getInts() { return is; }
+
+	public long getLong() { return l; }
+
+	public long[] getLongs() { return ls; }
+
+	public short getShort() { return s; }
+
+	public short[] getShorts() { return ss; }
+
+	public void setBoolean(boolean b) { this.bool = b; }
+
+	public void setBooleans(boolean[] bs) { this.bools = bs; }
+
+	public void setByte(byte b) { this.b = b; }
+
+	public void setBytes(byte[] bs) { this.bs = bs; }
+
+	public void setChar(char c) { this.c = c; }
+
+	public void setChars(char[] cs) { this.cs = cs; }
+
+	public void setDouble(double d) { this.d = d; }
+
+	public void setDoubles(double[] ds) { this.ds = ds; }
+
+	public void setFloat(float f) { this.f = f; }
+
+	public void setFloats(float[] fs) { this.fs = fs; }
+
+	public void setInt(int i) { this.i = i; }
+
+	public void setInts(int[] is) { this.is = is; }
+
+	public void setLong(long l) { this.l = l; }
+
+	public void setLongs(long[] ls) { this.ls = ls; }
+
+ 	public void setShort(short s) { this.s = s; }
+
+	public void setShorts(short[] ss) { this.ss = ss; }	
+	
+	// This method has been added to test an issue when autoboxing.
+	public void setLong(long l, String s) {
+	    this.l = l;
+	}
+
+}

Added: felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/component/Marker.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/component/Marker.java?rev=701978&view=auto
==============================================================================
--- felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/component/Marker.java (added)
+++ felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/component/Marker.java Mon Oct  6 00:55:39 2008
@@ -0,0 +1,21 @@
+package org.apache.felix.ipojo.test.scenarios.component;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Marker {
+    
+    String name();
+    
+    String[] arrayOfObjects();
+    
+    SubMarker sub();
+    
+    SubMarker[] arrayOfAnnotations();
+    
+    Type type();
+    
+    public enum Type {FOO, BAR, BAZ};
+
+}

Added: felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/component/PlopImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/component/PlopImpl.java?rev=701978&view=auto
==============================================================================
--- felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/component/PlopImpl.java (added)
+++ felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/component/PlopImpl.java Mon Oct  6 00:55:39 2008
@@ -0,0 +1,11 @@
+package org.apache.felix.ipojo.test.scenarios.component;
+
+import org.apache.felix.ipojo.test.scenarios.manipulation.service.Plop;
+//TODO this test requires source compatibility 1.5
+public class PlopImpl implements Plop {
+
+    public String getPlop() {
+        return "plop";
+    }
+
+}

Added: felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/component/SubMarker.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/component/SubMarker.java?rev=701978&view=auto
==============================================================================
--- felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/component/SubMarker.java (added)
+++ felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/component/SubMarker.java Mon Oct  6 00:55:39 2008
@@ -0,0 +1,12 @@
+package org.apache.felix.ipojo.test.scenarios.component;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+@Retention(RetentionPolicy.RUNTIME)
+public @interface SubMarker {
+    
+    String subname();
+
+
+}

Added: felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/Annotation.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/Annotation.java?rev=701978&view=auto
==============================================================================
--- felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/Annotation.java (added)
+++ felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/Annotation.java Mon Oct  6 00:55:39 2008
@@ -0,0 +1,120 @@
+package org.apache.felix.ipojo.test.scenarios.manipulation;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+
+import org.apache.felix.ipojo.junit4osgi.OSGiTestCase;
+import org.apache.felix.ipojo.test.scenarios.component.Marker;
+import org.apache.felix.ipojo.test.scenarios.component.SubMarker;
+
+public class Annotation extends OSGiTestCase {
+    
+    private Class clazz;
+    
+    public void setUp() {
+        try {
+            clazz = context.getBundle().
+                loadClass("org.apache.felix.ipojo.test.scenarios.component.Annotation");
+        } catch (ClassNotFoundException e) {
+            fail("Cannot load the annotation class : " + e.getMessage());
+        }
+    }
+    
+    public void testAnnotationOnMethod() {
+        Method method = null;
+        try {
+            method = this.clazz.getMethod("doSomething", new Class[0]);
+        } catch (Exception e) {
+            fail("Cannot find the doSomething method : " + e.getMessage());
+        } 
+        assertNotNull("Check method existence", method);
+        
+        java.lang.annotation.Annotation[] annotations = method.getDeclaredAnnotations();
+        assertNotNull("Check annotations size - 1", annotations);
+        assertEquals("Check annotations size - 2", 2, annotations.length); // Invisible is not visible
+        
+        /*
+            @Marker(name="marker", type=Type.BAR, 
+            sub=@SubMarker(subname="foo"),
+            arrayOfObjects={"foo", "bar", "baz"},
+            arrayOfAnnotations= {@SubMarker(subname="foo")}
+            )
+            @SubMarker(subname="bar")
+            @Invisible
+         */
+        
+        Marker marker = getMarkerAnnotation(annotations);
+        assertNotNull("Check marker", marker);
+        
+        assertEquals("Check marker name", "marker", marker.name());
+        assertEquals("Check marker type", Marker.Type.BAR, marker.type());
+        assertEquals("Check sub marker attribute", "foo", marker.sub().subname());
+        assertEquals("Check objects [0]", "foo", marker.arrayOfObjects()[0]);
+        assertEquals("Check objects [1]", "bar", marker.arrayOfObjects()[1]);
+        assertEquals("Check objects [2]", "baz", marker.arrayOfObjects()[2]);
+        assertEquals("Check annotations[0]", "foo", marker.arrayOfAnnotations()[0].subname());
+        
+        SubMarker sub = getSubMarkerAnnotation(annotations);
+        assertNotNull("Check submarker", sub);
+        assertEquals("Check submarker", "bar", sub.subname());
+        
+    }
+    
+    public void testAnnotationOnConstructor() {
+        Constructor method = null;
+        try {
+            method = clazz.getConstructor(new Class[0]);
+        } catch (Exception e) {
+            fail("Cannot find the constructor method : " + e.getMessage());
+        } 
+        assertNotNull("Check method existence", method);
+        
+        java.lang.annotation.Annotation[] annotations = method.getDeclaredAnnotations();
+        assertNotNull("Check annotations size - 1", annotations);
+        assertEquals("Check annotations size - 2", 2, annotations.length); // Invisible is not visible
+        
+        /*
+            @Marker(name="marker", type=Type.BAR, 
+            sub=@SubMarker(subname="foo"),
+            arrayOfObjects={"foo", "bar", "baz"},
+            arrayOfAnnotations= {@SubMarker(subname="foo")}
+            )
+            @SubMarker(subname="bar")
+            @Invisible
+         */
+        
+        Marker marker = getMarkerAnnotation(annotations);
+        assertNotNull("Check marker", marker);
+        
+        assertEquals("Check marker name", "marker", marker.name());
+        assertEquals("Check marker type", Marker.Type.BAR, marker.type());
+        assertEquals("Check sub marker attribute", "foo", marker.sub().subname());
+        assertEquals("Check objects [0]", "foo", marker.arrayOfObjects()[0]);
+        assertEquals("Check objects [1]", "bar", marker.arrayOfObjects()[1]);
+        assertEquals("Check objects [2]", "baz", marker.arrayOfObjects()[2]);
+        assertEquals("Check annotations[0]", "foo", marker.arrayOfAnnotations()[0].subname());
+        
+        SubMarker sub = getSubMarkerAnnotation(annotations);
+        assertNotNull("Check submarker", sub);
+        assertEquals("Check submarker", "bar", sub.subname());
+    }
+    
+    private Marker getMarkerAnnotation(java.lang.annotation.Annotation[] annotations) {
+        for (int i = 0; i < annotations.length; i++) {
+            if (annotations[i].annotationType().getName().equals("org.apache.felix.ipojo.test.scenarios.component.Marker")) {
+                return (Marker) annotations[i];
+            }
+        }
+        return null;
+    }
+    
+    private SubMarker getSubMarkerAnnotation(java.lang.annotation.Annotation[] annotations) {
+        for (int i = 0; i < annotations.length; i++) {
+            if (annotations[i].annotationType().getName().equals("org.apache.felix.ipojo.test.scenarios.component.SubMarker")) {
+                return (SubMarker) annotations[i];
+            }
+        }
+        return null;
+    }
+
+}

Added: felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/Boxing.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/Boxing.java?rev=701978&view=auto
==============================================================================
--- felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/Boxing.java (added)
+++ felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/Boxing.java Mon Oct  6 00:55:39 2008
@@ -0,0 +1,50 @@
+package org.apache.felix.ipojo.test.scenarios.manipulation;
+
+import java.util.Properties;
+
+import org.apache.felix.ipojo.ComponentInstance;
+import org.apache.felix.ipojo.junit4osgi.OSGiTestCase;
+import org.apache.felix.ipojo.test.scenarios.manipulation.service.PrimitiveManipulationTestService;
+import org.apache.felix.ipojo.test.scenarios.util.Utils;
+import org.osgi.framework.ServiceReference;
+
+public class Boxing extends OSGiTestCase {
+    
+    ComponentInstance instance; // Instance under test
+
+    PrimitiveManipulationTestService prim;
+
+    ServiceReference prim_ref;
+
+    public void setUp() {
+        Properties p1 = new Properties();
+        p1.put("instance.name","primitives");
+        instance = Utils.getComponentInstance(context, "ManipulationPrimitives5-PrimitiveManipulationTester", p1);
+        assertTrue("check instance state", instance.getState() == ComponentInstance.VALID);
+        prim_ref = Utils.getServiceReferenceByName(context, PrimitiveManipulationTestService.class.getName(), instance.getInstanceName());
+        assertNotNull("Check prim availability", prim_ref);
+        prim = (PrimitiveManipulationTestService) context.getService(prim_ref);
+    }
+
+    public void tearDown() {
+        context.ungetService(prim_ref);
+        prim = null;
+        instance.dispose();
+        instance = null;
+    }
+    
+  public void testLongFromObject() {
+      assertEquals("Check - 1", prim.getLong(), 1);
+      Long l = new Long(2);
+      prim.setLong(l);
+      assertEquals("Check - 2", prim.getLong(), 2);
+  }
+
+  public void testLongFromObject2() {
+      assertEquals("Check - 1", prim.getLong(), 1);
+      Long l = new Long(2);
+      prim.setLong(l, "ss");
+      assertEquals("Check - 2", prim.getLong(), 2);
+  }
+
+}

Added: felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/DuplicateMethod.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/DuplicateMethod.java?rev=701978&view=auto
==============================================================================
--- felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/DuplicateMethod.java (added)
+++ felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/DuplicateMethod.java Mon Oct  6 00:55:39 2008
@@ -0,0 +1,22 @@
+package org.apache.felix.ipojo.test.scenarios.manipulation;
+
+import org.apache.felix.ipojo.ComponentInstance;
+import org.apache.felix.ipojo.junit4osgi.OSGiTestCase;
+import org.apache.felix.ipojo.test.scenarios.manipulation.service.Plop;
+import org.apache.felix.ipojo.test.scenarios.util.Utils;
+import org.osgi.framework.ServiceReference;
+
+public class DuplicateMethod extends OSGiTestCase {
+    
+    
+    public void testDuplicateMethod() {
+        ComponentInstance instance = Utils.getComponentInstanceByName(context, "plopimpl", "plop");
+        ServiceReference ref = Utils.getServiceReferenceByName(context, Plop.class.getName(), "plop");
+        assertNotNull("Check plop", ref);
+        Plop plop = (Plop) context.getService(ref);
+        Object o = plop.getPlop();
+        assertEquals("Check result", "plop", o);
+        context.ungetService(ref);
+        instance.dispose();
+    }
+}

Added: felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/ManipulationTestSuite.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/ManipulationTestSuite.java?rev=701978&view=auto
==============================================================================
--- felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/ManipulationTestSuite.java (added)
+++ felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/ManipulationTestSuite.java Mon Oct  6 00:55:39 2008
@@ -0,0 +1,36 @@
+/* 
+ * 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.test.scenarios.manipulation;
+
+import junit.framework.Test;
+
+import org.apache.felix.ipojo.junit4osgi.OSGiTestSuite;
+import org.osgi.framework.BundleContext;
+
+public class ManipulationTestSuite {
+
+	public static Test suite(BundleContext bc) {
+		OSGiTestSuite ots = new OSGiTestSuite("Manipulation Test Suite for Java 5", bc);
+        ots.addTestSuite(DuplicateMethod.class);
+        ots.addTestSuite(Boxing.class);
+        ots.addTestSuite(Annotation.class);
+		return ots;
+	}
+
+}

Added: felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/service/BarService.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/service/BarService.java?rev=701978&view=auto
==============================================================================
--- felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/service/BarService.java (added)
+++ felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/service/BarService.java Mon Oct  6 00:55:39 2008
@@ -0,0 +1,29 @@
+/* 
+ * 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.test.scenarios.manipulation.service;
+
+import java.util.Properties;
+
+public interface BarService {
+	
+	public boolean bar();
+	
+	public Properties getProps();
+
+}

Added: felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/service/CheckService.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/service/CheckService.java?rev=701978&view=auto
==============================================================================
--- felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/service/CheckService.java (added)
+++ felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/service/CheckService.java Mon Oct  6 00:55:39 2008
@@ -0,0 +1,31 @@
+/* 
+ * 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.test.scenarios.manipulation.service;
+
+import java.util.Properties;
+
+public interface CheckService {
+    
+    public static final String foo = "foo";
+	
+	public boolean check();
+	
+	public Properties getProps();
+
+}

Added: felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/service/FooService.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/service/FooService.java?rev=701978&view=auto
==============================================================================
--- felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/service/FooService.java (added)
+++ felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/service/FooService.java Mon Oct  6 00:55:39 2008
@@ -0,0 +1,39 @@
+/* 
+ * 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.test.scenarios.manipulation.service;
+
+import java.util.Properties;
+
+public interface FooService {
+
+	boolean foo();
+	
+	Properties fooProps();
+	
+	Boolean getObject();
+	
+	boolean getBoolean();
+	
+	int getInt();
+	
+	long getLong();
+	
+	double getDouble();
+	
+}

Added: felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/service/Plop.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/service/Plop.java?rev=701978&view=auto
==============================================================================
--- felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/service/Plop.java (added)
+++ felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/service/Plop.java Mon Oct  6 00:55:39 2008
@@ -0,0 +1,7 @@
+package org.apache.felix.ipojo.test.scenarios.manipulation.service;
+
+public interface Plop {
+    
+   Object getPlop();
+
+}

Added: felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/service/PrimitiveManipulationTestService.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/service/PrimitiveManipulationTestService.java?rev=701978&view=auto
==============================================================================
--- felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/service/PrimitiveManipulationTestService.java (added)
+++ felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/service/PrimitiveManipulationTestService.java Mon Oct  6 00:55:39 2008
@@ -0,0 +1,75 @@
+/* 
+ * 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.test.scenarios.manipulation.service;
+
+public interface PrimitiveManipulationTestService {
+	
+	byte getByte();
+	void setByte(byte b);
+	
+	short getShort();
+	void setShort(short s);
+	
+	int getInt();
+	void setInt(int i);
+	
+	long getLong();
+	void setLong(long l);
+	
+	float getFloat();
+	void setFloat(float f);
+	
+	double getDouble();
+	void setDouble(double d);
+	
+	char getChar();
+	void setChar(char c);
+	
+	boolean getBoolean();
+	void setBoolean(boolean b);
+	
+	// Array types
+	byte[] getBytes();
+	void setBytes(byte[] bs);
+	
+	short[] getShorts();
+	void setShorts(short[] ss);
+	
+	int[] getInts();
+	void setInts(int is[]);
+	
+	long[] getLongs();
+	void setLongs(long[] ls);
+	
+	float[] getFloats();
+	void setFloats(float[] fs);
+	
+	double[] getDoubles();
+	void setDoubles(double[] ds);
+	
+	char[] getChars();
+	void setChars(char[] cs);
+	
+	boolean[] getBooleans();
+	void setBooleans(boolean[] bs);	
+	
+	// This method has been added to test an issue when autoboxing.
+	void setLong(long l, String s);
+
+}

Added: felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/util/Utils.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/util/Utils.java?rev=701978&view=auto
==============================================================================
--- felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/util/Utils.java (added)
+++ felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/util/Utils.java Mon Oct  6 00:55:39 2008
@@ -0,0 +1,329 @@
+/* 
+ * 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.test.scenarios.util;
+
+import java.util.Dictionary;
+import java.util.Properties;
+
+import junit.framework.Assert;
+
+import org.apache.felix.ipojo.ComponentInstance;
+import org.apache.felix.ipojo.Factory;
+import org.apache.felix.ipojo.Handler;
+import org.apache.felix.ipojo.HandlerManagerFactory;
+import org.apache.felix.ipojo.ServiceContext;
+import org.apache.felix.ipojo.architecture.Architecture;
+//import org.apache.felix.ipojo.composite.CompositeManager;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.cm.ManagedServiceFactory;
+
+public class Utils {
+
+    public static Factory getFactoryByName(BundleContext bc, String factoryName) {
+        ServiceReference[] refs;
+        try {
+            refs = bc.getServiceReferences(Factory.class.getName(), "(factory.name=" + factoryName + ")");
+            if (refs == null) {
+                System.err.println("Cannot get the factory " + factoryName);
+                return null;
+            }
+            return ((Factory) bc.getService(refs[0]));
+        } catch (InvalidSyntaxException e) {
+            System.err.println("Cannot get the factory " + factoryName + " : " + e.getMessage());
+            return null;
+        }
+    }
+
+    public static HandlerManagerFactory getHandlerFactoryByName(BundleContext bc, String factoryName) {
+        ServiceReference[] refs;
+        try {
+            refs = bc.getServiceReferences(Factory.class.getName(), "(" + Handler.HANDLER_NAME_PROPERTY + "=" + factoryName + ")");
+            if (refs == null) {
+                System.err.println("Cannot get the factory " + factoryName);
+                return null;
+            }
+            return (HandlerManagerFactory) bc.getService(refs[0]);
+        } catch (InvalidSyntaxException e) {
+            System.err.println("Cannot get the factory " + factoryName + " : " + e.getMessage());
+            return null;
+        }
+    }
+
+    public static ComponentInstance getComponentInstance(BundleContext bc, String factoryName, Dictionary configuration) {
+        Factory fact = getFactoryByName(bc, factoryName);
+
+        if (fact == null) {
+            System.err.println("Factory " + factoryName + " not found");
+            return null;
+        }
+
+        // if(fact.isAcceptable(configuration)) {
+        try {
+            return fact.createComponentInstance(configuration);
+        } catch (Exception e) {
+            e.printStackTrace();
+            Assert.fail("Cannot create the instance from " + factoryName + " : " + e.getMessage());
+            return null;
+        }
+        // }
+        // else {
+        // System.err.println("Configuration not accepted by : " + factoryName);
+        // return null;
+        // }
+    }
+
+    public static ComponentInstance getComponentInstanceByName(BundleContext bc, String factoryName, String name) {
+        Factory fact = getFactoryByName(bc, factoryName);
+
+        if (fact == null) {
+            System.err.println("Factory " + factoryName + " not found");
+            return null;
+        }
+
+        try {
+            Properties props = new Properties();
+            props.put("instance.name",name);
+            return fact.createComponentInstance(props);
+        } catch (Exception e) {
+            System.err.println("Cannot create the instance from " + factoryName + " : " + e.getMessage());
+            e.printStackTrace();
+            return null;
+        }
+    }
+
+    public static ServiceReference[] getServiceReferences(BundleContext bc, String itf, String filter) {
+        ServiceReference[] refs = null;
+        try {
+            refs = bc.getServiceReferences(itf, filter);
+        } catch (InvalidSyntaxException e) {
+            System.err.println("Invalid Filter : " + filter);
+        }
+        if (refs == null) {
+            return new ServiceReference[0];
+        } else {
+            return refs;
+        }
+    }
+
+    public static ServiceReference getServiceReference(BundleContext bc, String itf, String filter) {
+        ServiceReference[] refs = null;
+        try {
+            refs = bc.getServiceReferences(itf, filter);
+        } catch (InvalidSyntaxException e) {
+            System.err.println("Invalid Filter : " + filter);
+        }
+        if (refs == null) {
+            return null;
+        } else {
+            return refs[0];
+        }
+    }
+
+    public static ServiceReference getServiceReferenceByName(BundleContext bc, String itf, String name) {
+        ServiceReference[] refs = null;
+        String filter = null;
+        if (itf.equals(Factory.class.getName()) || itf.equals(ManagedServiceFactory.class.getName())) {
+            filter = "(" + "factory.name" + "=" + name + ")";
+        } else if (itf.equals(Architecture.class.getName())) {
+            filter = "(" + "architecture.instance" + "=" + name + ")";
+        } else {
+            filter = "(" + "instance.name" + "=" + name + ")";
+        }
+        try {
+            refs = bc.getServiceReferences(itf, filter);
+        } catch (InvalidSyntaxException e) {
+            System.err.println("Invalid Filter : " + filter);
+        }
+        if (refs == null) {
+            return null;
+        } else {
+            return refs[0];
+        }
+    }
+    
+    public static ServiceReference getServiceReferenceByPID(BundleContext bc, String itf, String pid) {
+        ServiceReference[] refs = null;
+        String filter = "(" + "service.pid" + "=" + pid + ")";
+        try {
+            refs = bc.getServiceReferences(itf, filter);
+        } catch (InvalidSyntaxException e) {
+            System.err.println("Invalid Filter : " + filter);
+        }
+        if (refs == null) {
+            return null;
+        } else if (refs.length == 1) {
+            return refs[0];
+        } else {
+            Assert.fail("A service lookup by PID returned several providers (" + refs.length + ")" + " for " + itf + " with " + pid);
+            return null;
+        }
+    }
+
+    public static Object getServiceObject(BundleContext bc, String itf, String filter) {
+        ServiceReference ref = getServiceReference(bc, itf, filter);
+        if (ref != null) {
+            return bc.getService(ref);
+        } else {
+            return null;
+        }
+    }
+
+    public static Object[] getServiceObjects(BundleContext bc, String itf, String filter) {
+        ServiceReference[] refs = getServiceReferences(bc, itf, filter);
+        if (refs != null) {
+            Object[] list = new Object[refs.length];
+            for (int i = 0; i < refs.length; i++) {
+                list[i] = bc.getService(refs[i]);
+            }
+            return list;
+        } else {
+            return new Object[0];
+        }
+    }
+
+//    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;
+        try {
+            refs = bc.getServiceReferences(Factory.class.getName(), "(factory.name=" + factoryName + ")");
+            if (refs == null) { return null; }
+            return ((Factory) bc.getService(refs[0]));
+        } catch (InvalidSyntaxException e) {
+            System.err.println("Cannot get the factory " + factoryName + " : " + e.getMessage());
+            return null;
+        }
+    }
+
+    public static ComponentInstance getComponentInstance(ServiceContext bc, String factoryName, Dictionary configuration) {
+        Factory fact = getFactoryByName(bc, factoryName);
+
+        if (fact == null) { return null; }
+
+        if (fact.isAcceptable(configuration)) {
+            try {
+                return fact.createComponentInstance(configuration);
+            } catch (Exception e) {
+                System.err.println(e.getMessage());
+                e.printStackTrace();
+                return null;
+            }
+        } else {
+            System.err.println("Configuration not accepted by : " + factoryName);
+            return null;
+        }
+    }
+
+    public static ServiceReference[] getServiceReferences(ServiceContext bc, String itf, String filter) {
+        ServiceReference[] refs = null;
+        try {
+            refs = bc.getServiceReferences(itf, filter);
+        } catch (InvalidSyntaxException e) {
+            System.err.println("Invalid Filter : " + filter);
+        }
+        if (refs == null) {
+            return new ServiceReference[0];
+        } else {
+            return refs;
+        }
+    }
+
+    public static ServiceReference getServiceReference(ServiceContext bc, String itf, String filter) {
+        ServiceReference[] refs = null;
+        try {
+            refs = bc.getServiceReferences(itf, filter);
+        } catch (InvalidSyntaxException e) {
+            System.err.println("Invalid Filter : " + filter);
+        }
+        if (refs == null) {
+            return null;
+        } else {
+            return refs[0];
+        }
+    }
+
+    public static ServiceReference getServiceReferenceByName(ServiceContext bc, String itf, String name) {
+        ServiceReference[] refs = null;
+        String filter = null;
+        if (itf.equals(Factory.class.getName()) || itf.equals(ManagedServiceFactory.class.getName())) {
+            filter = "(" + "factory.name" + "=" + name + ")";
+        } else {
+            filter = "(" + "instance.name" + "=" + name + ")";
+        }
+        try {
+            refs = bc.getServiceReferences(itf, filter);
+        } catch (InvalidSyntaxException e) {
+            System.err.println("Invalid Filter : " + filter);
+        }
+        if (refs == null) {
+            return null;
+        } else {
+            return refs[0];
+        }
+    }
+
+    public static Object getServiceObject(ServiceContext bc, String itf, String filter) {
+        ServiceReference ref = getServiceReference(bc, itf, filter);
+        if (ref != null) {
+            return bc.getService(ref);
+        } else {
+            return null;
+        }
+    }
+
+    public static Object[] getServiceObjects(ServiceContext bc, String itf, String filter) {
+        ServiceReference[] refs = getServiceReferences(bc, itf, filter);
+        if (refs != null) {
+            Object[] list = new Object[refs.length];
+            for (int i = 0; i < refs.length; i++) {
+                list[i] = bc.getService(refs[i]);
+            }
+            return list;
+        } else {
+            return new Object[0];
+        }
+    }
+    
+    public static boolean contains(String string, String[] array) {
+        for (int i = 0; array != null && i < array.length; i++) {
+            if (array[i] != null  && array[i].equals(string)) {
+                return true;
+            }
+        }
+        return false;
+    }
+    
+    public static boolean contains(int value, int[] array) {
+        for (int i = 0; array != null && i < array.length; i++) {
+            if (array[i] == value) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+}

Added: felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/resources/metadata.xml
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/resources/metadata.xml?rev=701978&view=auto
==============================================================================
--- felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/resources/metadata.xml (added)
+++ felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/resources/metadata.xml Mon Oct  6 00:55:39 2008
@@ -0,0 +1,21 @@
+<ipojo
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="org.apache.felix.ipojo http://people.apache.org/~clement/ipojo/schemas/core.xsd"
+    xmlns="org.apache.felix.ipojo"
+>
+	
+	<!-- Check duplicate method issue -->
+	<component classname="org.apache.felix.ipojo.test.scenarios.component.PlopImpl" name="plopimpl">
+		<provides></provides>
+	</component>
+	
+	<component
+		classname="org.apache.felix.ipojo.test.scenarios.component.Manipulation23Tester"
+		name="ManipulationPrimitives5-PrimitiveManipulationTester" architecture="true">
+		<provides />
+	</component>
+	
+	<component
+	    classname="org.apache.felix.ipojo.test.scenarios.component.Annotation"
+	    name="Manipulation-Annotations"/>
+</ipojo>

Propchange: felix/trunk/ipojo/tests/manipulator/metadata/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Oct  6 00:55:39 2008
@@ -0,0 +1,5 @@
+.classpath
+.project
+.settings
+bin
+target

Added: felix/trunk/ipojo/tests/manipulator/metadata/pom.xml
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/manipulator/metadata/pom.xml?rev=701978&view=auto
==============================================================================
--- felix/trunk/ipojo/tests/manipulator/metadata/pom.xml (added)
+++ felix/trunk/ipojo/tests/manipulator/metadata/pom.xml Mon Oct  6 00:55:39 2008
@@ -0,0 +1,102 @@
+<!--
+	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.
+-->
+<project>
+	<modelVersion>4.0.0</modelVersion>
+	<packaging>bundle</packaging>
+	<name>iPOJO Manipulation Metadata Test Suite</name>
+	<artifactId>tests.manipulation.metadata</artifactId>
+	<groupId>ipojo.tests</groupId>
+	<version>0.9.0-SNAPSHOT</version>
+	<dependencies>
+		<dependency>
+			<groupId>org.apache.felix</groupId>
+			<artifactId>org.apache.felix.ipojo</artifactId>
+			<version>0.9.0-SNAPSHOT</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.felix</groupId>
+			<artifactId>org.apache.felix.ipojo.metadata</artifactId>
+			<version>0.9.0-SNAPSHOT</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.felix</groupId>
+			<artifactId>org.osgi.core</artifactId>
+			<version>1.0.0</version>
+		</dependency>
+		<dependency>
+			<groupId>junit</groupId>
+			<artifactId>junit</artifactId>
+			<version>3.8.1</version>
+		</dependency>
+		<dependency>
+			<groupId>ipojo.examples</groupId>
+			<artifactId>org.apache.felix.ipojo.junit4osgi</artifactId>
+			<version>0.9.0-SNAPSHOT</version>
+		</dependency>
+	</dependencies>
+	<build>
+		<plugins>
+			<plugin>
+				<groupId>org.apache.felix</groupId>
+				<artifactId>maven-bundle-plugin</artifactId>
+				<version>1.4.2</version>
+				<extensions>true</extensions>
+				<configuration>
+					<instructions>
+						<Export-Package>
+							org.apache.felix.ipojo.test.scenarios.manipulation.service
+						</Export-Package>
+						<Bundle-SymbolicName>
+							${pom.artifactId}
+						</Bundle-SymbolicName>
+						<Private-Package>
+							org.apache.felix.ipojo.test*
+						</Private-Package>
+						<Test-Suite>
+							org.apache.felix.ipojo.test.scenarios.manipulation.ManipulationTestSuite
+						</Test-Suite>
+					</instructions>
+				</configuration>
+			</plugin>
+			<plugin>
+				<groupId>org.apache.felix</groupId>
+				<artifactId>maven-ipojo-plugin</artifactId>
+				<version>0.9.0-SNAPSHOT</version>
+				<executions>
+					<execution>
+						<goals>
+							<goal>ipojo-bundle</goal>
+						</goals>
+						<configuration>
+							<ignoreAnnotations>true</ignoreAnnotations>
+						</configuration>
+					</execution>
+				</executions>
+			</plugin>
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-compiler-plugin</artifactId>
+				<configuration>
+					<source>1.4</source>
+					<target>1.4</target>
+				</configuration>
+			</plugin>
+		</plugins>
+	</build>
+</project>

Added: felix/trunk/ipojo/tests/manipulator/metadata/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FooBarProviderType1.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/manipulator/metadata/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FooBarProviderType1.java?rev=701978&view=auto
==============================================================================
--- felix/trunk/ipojo/tests/manipulator/metadata/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FooBarProviderType1.java (added)
+++ felix/trunk/ipojo/tests/manipulator/metadata/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FooBarProviderType1.java Mon Oct  6 00:55:39 2008
@@ -0,0 +1,54 @@
+/* 
+ * 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.test.scenarios.component;
+
+import java.util.Properties;
+
+import org.apache.felix.ipojo.test.scenarios.manipulation.service.BarService;
+import org.apache.felix.ipojo.test.scenarios.manipulation.service.FooService;
+
+public class FooBarProviderType1 implements FooService, BarService {
+
+	public boolean foo() {
+		return true;
+	}
+
+	public Properties fooProps() {
+		return new Properties();
+	}
+
+	public boolean bar() {
+		return true;
+	}
+
+	public Properties getProps() {
+		return new Properties();
+	}
+
+	public boolean getBoolean() { return true; }
+
+	public double getDouble() { return 1.0; }
+
+	public int getInt() { return 1; }
+
+	public long getLong() { return 1; }
+
+	public Boolean getObject() { return new Boolean(true); }
+
+}



Mime
View raw message