felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clem...@apache.org
Subject svn commit: r1449171 [2/4] - in /felix/trunk/ipojo/manipulator/manipulator-it: ./ src/ src/it/ src/it/ipojo-manipulator-creation-test/ src/it/ipojo-manipulator-creation-test/src/ src/it/ipojo-manipulator-creation-test/src/main/ src/it/ipojo-manipulator...
Date Fri, 22 Feb 2013 18:55:34 GMT
Added: felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-creation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestPOJOCreation.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-creation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestPOJOCreation.java?rev=1449171&view=auto
==============================================================================
--- felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-creation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestPOJOCreation.java (added)
+++ felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-creation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestPOJOCreation.java Fri Feb 22 18:55:31 2013
@@ -0,0 +1,274 @@
+/*
+ * 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.runtime.core;
+
+import org.apache.felix.ipojo.ComponentInstance;
+import org.apache.felix.ipojo.PrimitiveInstanceDescription;
+import org.apache.felix.ipojo.architecture.Architecture;
+import org.apache.felix.ipojo.runtime.core.components.FooProviderType1;
+import org.apache.felix.ipojo.runtime.core.services.FooService;
+import org.junit.Before;
+import org.junit.Test;
+import org.osgi.framework.ServiceReference;
+
+import java.util.Properties;
+
+import static junit.framework.Assert.assertEquals;
+import static org.junit.Assert.*;
+
+/**
+ * Check the different method to create POJO object.
+ */
+public class TestPOJOCreation extends Common {
+
+    private ComponentInstance ci_lazzy;
+    private ComponentInstance ci_immediate;
+    private ComponentInstance ci_immediate_singleton;
+
+    private Architecture lazzyArch;
+    private Architecture immeArch;
+    private Architecture immeArchSing;
+
+
+    private ComponentInstance ci_lazzy_sing;
+    private ComponentInstance ci_lazzy_sev;
+
+    private Architecture lazzyArchSing;
+    private Architecture lazzyArchSev;
+    private ComponentInstance ci_lazzy_singM;
+    private ComponentInstance ci_lazzy_sevM;
+
+    private Architecture lazzyArchSingM;
+    private Architecture lazzyArchSevM;
+
+    @Before
+    public void setUp() {
+        String factName = "ManipulationCreation-FooProviderType-1";
+        String compName = "FooProvider-1";
+        ci_lazzy = ipojoHelper.createComponentInstance(factName, compName);
+
+        String factName2 = "ManipulationCreation-ImmediateFooProviderType";
+        String compName2 = "FooProvider-2";
+        ci_immediate = ipojoHelper.createComponentInstance(factName2, compName2);
+
+        String factName3 = "ManipulationCreation-ImmediateFooProviderTypeSingleton";
+        String compName3 = "FooProvider-3";
+        ci_immediate_singleton = ipojoHelper.createComponentInstance(factName3, compName3);
+
+        String factName4 = "ManipulationCreation-FooProviderType-1-Sing";
+        String compName4 = "FooProvider-1-Sing";
+        ci_lazzy_sing = ipojoHelper.createComponentInstance(factName4, compName4);
+
+        String factName5 = "ManipulationCreation-FooProviderType-1-Sev";
+        String compName5 = "FooProvider-1-Sev";
+        ci_lazzy_sev = ipojoHelper.createComponentInstance(factName5, compName5);
+
+        String factName6 = "ManipulationCreation-FooProviderType-1-SingM";
+        String compName6 = "FooProvider-1-SingM";
+        ci_lazzy_singM = ipojoHelper.createComponentInstance(factName6, compName6);
+
+        String factName7 = "ManipulationCreation-FooProviderType-1-SevM";
+        String compName7 = "FooProvider-1-SevM";
+        ci_lazzy_sevM = ipojoHelper.createComponentInstance(factName7, compName7);
+
+        lazzyArch = (Architecture) osgiHelper.getServiceObject(Architecture.class.getName(), "(architecture.instance=" + compName + ")");
+        immeArch = (Architecture) osgiHelper.getServiceObject(Architecture.class.getName(), "(architecture.instance=" + compName2 + ")");
+        immeArchSing = (Architecture) osgiHelper.getServiceObject(Architecture.class.getName(), "(architecture.instance=" + compName3 + ")");
+        lazzyArchSing = (Architecture) osgiHelper.getServiceObject(Architecture.class.getName(), "(architecture.instance=" + compName4 + ")");
+        lazzyArchSev = (Architecture) osgiHelper.getServiceObject(Architecture.class.getName(), "(architecture.instance=" + compName5 + ")");
+        lazzyArchSingM = (Architecture) osgiHelper.getServiceObject(Architecture.class.getName(), "(architecture.instance=" + compName6 + ")");
+        lazzyArchSevM = (Architecture) osgiHelper.getServiceObject(Architecture.class.getName(), "(architecture.instance=" + compName7 + ")");
+    }
+
+    public void tearDown() {
+        lazzyArch = null;
+        immeArch = null;
+        immeArchSing = null;
+        lazzyArchSing = null;
+        lazzyArchSev = null;
+        lazzyArchSingM = null;
+        lazzyArchSevM = null;
+        ipojoHelper.dispose();
+    }
+
+    /**
+     * Check lazy creation.
+     */
+    @Test
+    public void testLazyCreation() {
+        assertEquals("Check that no objects are created ", 0, ((PrimitiveInstanceDescription) lazzyArch.getInstanceDescription()).getCreatedObjects().length);
+        ServiceReference ref = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), ci_lazzy.getInstanceName());
+        assertNotNull("Check that a FooService from " + ci_lazzy.getInstanceName() + " is available", ref);
+        FooService fs = (FooService) osgiHelper.getServiceObject(ref);
+        assertTrue("Check the FooService invocation", fs.foo());
+        assertEquals("Check the creation of 1 object", 1, ((PrimitiveInstanceDescription) lazzyArch.getInstanceDescription()).getCreatedObjects().length);
+    }
+
+    /**
+     * Check lazy and singleton creation.
+     */
+    @Test
+    public void testLazyCreationSingleton() {
+        assertEquals("Check that no objects are created ", 0, ((PrimitiveInstanceDescription) lazzyArchSing.getInstanceDescription()).getCreatedObjects().length);
+        ServiceReference ref = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), ci_lazzy_sing.getInstanceName());
+        assertNotNull("Check that a FooService from " + ci_lazzy_sing.getInstanceName() + " is available", ref);
+        FooService fs = (FooService) osgiHelper.getServiceObject(ref);
+        assertTrue("Check the FooService invocation", fs.foo());
+        assertEquals("Check the creation of 1 object", 1, ((PrimitiveInstanceDescription) lazzyArchSing.getInstanceDescription()).getCreatedObjects().length);
+    }
+
+    /**
+     * Check lazy and "several" creation.
+     */
+    @Test
+    public void testLazyCreationSeveral() {
+        assertEquals("Check that no objects are created ", 0, ((PrimitiveInstanceDescription) lazzyArchSev.getInstanceDescription()).getCreatedObjects().length);
+        ServiceReference ref = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), ci_lazzy_sev.getInstanceName());
+        assertNotNull("Check that a FooService from " + ci_lazzy_sev.getInstanceName() + " is available", ref);
+        FooService fs = (FooService) osgiHelper.getServiceObject(ref);
+        FooService fs2 = (FooService) osgiHelper.getServiceObject(ref);
+        assertTrue("Check the FooService invocation", fs.foo());
+        assertTrue("Check the FooService invocation-2", fs2.foo());
+        assertEquals("Check the creation of 1 object", 1, ((PrimitiveInstanceDescription) lazzyArchSev.getInstanceDescription()).getCreatedObjects().length);
+    }
+
+    /**
+     * Check immediate creation.
+     */
+    @Test
+    public void testImmediateCreation() {
+        assertEquals("Check that one object is created ", 1, ((PrimitiveInstanceDescription) immeArch.getInstanceDescription()).getCreatedObjects().length);
+        ServiceReference ref = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), ci_immediate.getInstanceName());
+        assertNotNull("Check that a FooService from " + ci_immediate.getInstanceName() + " is available", ref);
+        FooService fs = (FooService) osgiHelper.getServiceObject(ref);
+        assertTrue("Check the FooService invocation", fs.foo());
+        assertEquals("Check the creation of 1 object", 1, ((PrimitiveInstanceDescription) immeArch.getInstanceDescription()).getCreatedObjects().length);
+    }
+
+    /**
+     * Check bundle context injection.
+     */
+    @Test
+    public void testBundleContext() {
+        ServiceReference ref = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), ci_lazzy.getInstanceName());
+        assertNotNull("Check that a FooService from " + ci_lazzy.getInstanceName() + " is available", ref);
+        FooService fs = (FooService) osgiHelper.getServiceObject(ref);
+        Properties p = fs.fooProps();
+        assertNotNull("Check the bundle context", p.get("context"));
+        assertEquals("Check the creation of 1 object", 1, ((PrimitiveInstanceDescription) lazzyArch.getInstanceDescription()).getCreatedObjects().length);
+    }
+
+    /**
+     * Test immediate singleton creation.
+     */
+    @Test
+    public void testImmediateSingletonCreation() {
+        assertEquals("Check that one object is created ", 1, ((PrimitiveInstanceDescription) immeArchSing.getInstanceDescription()).getCreatedObjects().length);
+        ServiceReference ref = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), ci_immediate_singleton.getInstanceName());
+        assertNotNull("Check that a FooService from " + ci_immediate_singleton.getInstanceName() + " is available", ref);
+        FooService fs = (FooService) osgiHelper.getServiceObject(ref);
+        assertTrue("Check the FooService invocation", fs.foo());
+        assertEquals("Check the creation of 1 object", 1, ((PrimitiveInstanceDescription) immeArchSing.getInstanceDescription()).getCreatedObjects().length);
+    }
+
+    /**
+     * Check creation through a factory method.
+     * (lazy & singleton creation)
+     */
+    @Test
+    public void testLazyCreationSingletonM() {
+        assertEquals("Check that no objects are created ", 0, ((PrimitiveInstanceDescription) lazzyArchSingM.getInstanceDescription()).getCreatedObjects().length);
+        ServiceReference ref = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), ci_lazzy_singM.getInstanceName());
+        assertNotNull("Check that a FooService from " + ci_lazzy_singM.getInstanceName() + " is available", ref);
+        FooService fs = (FooService) osgiHelper.getServiceObject(ref);
+        FooService fs2 = (FooService) osgiHelper.getServiceObject(ref);
+        assertTrue("Check the FooService invocation", fs.foo());
+        assertTrue("Check the FooService invocation", fs2.foo());
+        assertEquals("Check the creation of 1 object", 1, ((PrimitiveInstanceDescription) lazzyArchSingM.getInstanceDescription()).getCreatedObjects().length);
+    }
+
+    /**
+     * Check creation through a factory method.
+     * (lazy & several creation)
+     */
+    @Test
+    public void testLazyCreationSeveralM() {
+        assertEquals("Check that no objects are created ", 0, ((PrimitiveInstanceDescription) lazzyArchSevM.getInstanceDescription()).getCreatedObjects().length);
+        ServiceReference ref = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), ci_lazzy_sevM.getInstanceName());
+        assertNotNull("Check that a FooService from " + ci_lazzy_sevM.getInstanceName() + " is available", ref);
+        FooService fs = (FooService) osgiHelper.getServiceObject(ref);
+        assertTrue("Check the FooService invocation", fs.foo());
+        assertEquals("Check the creation of 1 object", 1, ((PrimitiveInstanceDescription) lazzyArchSevM.getInstanceDescription()).getCreatedObjects().length);
+        FooService fs2 = (FooService) osgiHelper.getServiceObject(ref);
+        assertTrue("Check the FooService invocation-2", fs2.foo());
+        // Only one object as the getService method is called only once (service factory) despite the policy="method".
+        assertEquals("Check the creation of 1 object", 1, ((PrimitiveInstanceDescription) lazzyArchSevM.getInstanceDescription()).getCreatedObjects().length);
+    }
+
+    /**
+     * Test a custom constructor.
+     * Not manipulated.
+     */
+    @Test
+    public void testCustomConstuctor() {
+        FooService fs = new FooProviderType1(0, "foo", bc);
+        Properties props = fs.fooProps();
+        assertEquals("Check bar", 0, ((Integer) props.get("bar")).intValue());
+        assertEquals("Check foo", "foo", props.get("foo"));
+        assertEquals("Check context", bc, props.get("context"));
+    }
+
+    @Test
+    public void testSuperCall() {
+        try {
+            ipojoHelper.createComponentInstance("org.apache.felix.ipojo.runtime.core.components.CallSuperConstructor");
+        } catch (Throwable e) {
+            fail(e.getMessage());
+        }
+    }
+
+    @Test
+    public void testSuperCallWithNew() {
+        try {
+            ipojoHelper.createComponentInstance("org.apache.felix.ipojo.runtime.core.components.CallSuperConstructorWithNew");
+        } catch (Throwable e) {
+            fail(e.getMessage());
+        }
+    }
+
+    @Test
+    public void testSuperSuperCallWithNew() {
+        try {
+            ipojoHelper.createComponentInstance("org.apache.felix.ipojo.runtime.core.components.CallSuperSuperConstructorWithNew");
+        } catch (Throwable e) {
+            fail(e.getMessage());
+        }
+    }
+
+    @Test
+    public void testSuperCallWithBC() {
+        try {
+            ipojoHelper.createComponentInstance("org.apache.felix.ipojo.runtime.core.components.CallSuperConstructorWithBC");
+        } catch (Throwable e) {
+            fail(e.getMessage());
+        }
+    }
+
+
+}
\ No newline at end of file

Added: felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-creation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestSeveralConstructor.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-creation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestSeveralConstructor.java?rev=1449171&view=auto
==============================================================================
--- felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-creation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestSeveralConstructor.java (added)
+++ felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-creation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestSeveralConstructor.java Fri Feb 22 18:55:31 2013
@@ -0,0 +1,53 @@
+package org.apache.felix.ipojo.runtime.core;
+
+import org.apache.felix.ipojo.ComponentInstance;
+import org.apache.felix.ipojo.runtime.core.services.CheckService;
+import org.junit.Before;
+import org.junit.Test;
+import org.osgi.framework.ServiceReference;
+
+import static junit.framework.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+public class TestSeveralConstructor extends Common {
+
+    private ComponentInstance ci, ci2, ci3;
+
+    @Before
+    public void setUp() {
+        ci = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.runtime.core.components.SeveralConstructors");
+        ci2 = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.runtime.core.components.NoEmptyConstructor");
+        ci3 = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.runtime.core.components.NoEmptyConstructorWithParentClass");
+
+    }
+
+    @Test
+    public void testSeveralConstructor() {
+        ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), ci.getInstanceName());
+        CheckService cs = (CheckService) osgiHelper.getServiceObject(ref);
+        assertTrue("Check assignation", cs.check());
+        String name = (String) cs.getProps().get("name");
+        assertEquals("Check message", "hello world", name);
+        //assertNull("Check message", name);
+    }
+
+    @Test
+    public void testNoEmptyConstructor() {
+        ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), ci2.getInstanceName());
+        CheckService cs = (CheckService) osgiHelper.getServiceObject(ref);
+        assertFalse("Check assignation", cs.check());
+        String name = (String) cs.getProps().get("name");
+        assertEquals("Check message", "NULL", name);
+    }
+
+    @Test
+    public void testNoEmptyConstructorWithAParentClass() {
+        ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), ci3.getInstanceName());
+        CheckService cs = (CheckService) osgiHelper.getServiceObject(ref);
+        assertTrue("Check assignation", cs.check()); // super set name to "hello"
+        String name = (String) cs.getProps().get("name");
+        assertEquals("Check message", "hello", name);
+    }
+
+}

Propchange: felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-metadata-test/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Feb 22 18:55:31 2013
@@ -0,0 +1,2 @@
+*.iml
+target

Added: felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-metadata-test/pom.xml
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-metadata-test/pom.xml?rev=1449171&view=auto
==============================================================================
--- felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-metadata-test/pom.xml (added)
+++ felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-metadata-test/pom.xml Fri Feb 22 18:55:31 2013
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+    <parent>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>org.apache.felix.ipojo.manipulator.manipulator-it</artifactId>
+        <version>1.9.0-SNAPSHOT</version>
+        <relativePath>../../../pom.xml</relativePath>
+    </parent>
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <groupId>org.apache.felix</groupId>
+    <artifactId>ipojo-manipulator-manipulation-metadata-test</artifactId>
+
+    <name>${project.artifactId}</name>
+    
+</project>
\ No newline at end of file

Added: felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Child.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Child.java?rev=1449171&view=auto
==============================================================================
--- felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Child.java (added)
+++ felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Child.java Fri Feb 22 18:55:31 2013
@@ -0,0 +1,9 @@
+package org.apache.felix.ipojo.runtime.core.components;
+
+public class Child extends Parent {
+
+	public Child(String s) {
+		super(s);
+	}
+
+}

Added: felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooBarProviderType1.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooBarProviderType1.java?rev=1449171&view=auto
==============================================================================
--- felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooBarProviderType1.java (added)
+++ felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooBarProviderType1.java Fri Feb 22 18:55:31 2013
@@ -0,0 +1,64 @@
+/* 
+ * 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.runtime.core.components;
+
+import org.apache.felix.ipojo.runtime.core.services.BarService;
+import org.apache.felix.ipojo.runtime.core.services.FooService;
+
+import java.util.Properties;
+
+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);
+    }
+
+}

Added: felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderType1.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderType1.java?rev=1449171&view=auto
==============================================================================
--- felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderType1.java (added)
+++ felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderType1.java Fri Feb 22 18:55:31 2013
@@ -0,0 +1,128 @@
+/* 
+ * 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.runtime.core.components;
+
+import org.apache.felix.ipojo.runtime.core.services.FooService;
+import org.osgi.framework.BundleContext;
+
+import java.util.Properties;
+
+public class FooProviderType1 implements FooService {
+
+    private int m_bar;
+    private String m_foo;
+
+    private BundleContext m_context;
+
+    private static FooProviderType1 singleton;
+    private static int count = 0;
+
+    private static FooProviderType1 singleton(BundleContext bc) {
+        if (singleton == null) {
+            count++;
+            singleton = new FooProviderType1(bc);
+        }
+        return singleton;
+    }
+
+    public static FooProviderType1 several(BundleContext bc) {
+        count++;
+        return new FooProviderType1(bc);
+    }
+
+    public FooProviderType1(BundleContext bc) {
+        if (bc == null) {
+            throw new RuntimeException("Injected bundle context null");
+        }
+        m_context = bc;
+    }
+
+    public boolean foo() {
+        return true;
+    }
+
+    public Properties fooProps() {
+        Properties p = new Properties();
+        p.put("bar", new Integer(m_bar));
+        if (m_foo != null) {
+            p.put("foo", m_foo);
+        }
+        p.put("context", m_context);
+
+        p.put("count", new Integer(count));
+        return p;
+    }
+
+    public void testException() throws Exception {
+        String a = "foobarbaz";
+        throw new Exception("foo" + a);
+    }
+
+    public void testTry() {
+        String a = "foo";
+        a.charAt(0);
+    }
+
+    public void testTry2(String s) {
+        String a = "foo";
+        a.charAt(0);
+    }
+
+    private void nexttry(String s) {
+        try {
+            s += "foo";
+        } catch (RuntimeException e) {
+
+        }
+    }
+
+    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);
+    }
+
+    /**
+     * Custom constructor.
+     *
+     * @param bar
+     * @param foo
+     * @param bc
+     */
+    public FooProviderType1(int bar, String foo, BundleContext bc) {
+        m_bar = bar;
+        m_foo = foo;
+        m_context = bc;
+    }
+
+}

Added: felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderTypeDyn.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderTypeDyn.java?rev=1449171&view=auto
==============================================================================
--- felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderTypeDyn.java (added)
+++ felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderTypeDyn.java Fri Feb 22 18:55:31 2013
@@ -0,0 +1,76 @@
+/* 
+ * 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.runtime.core.components;
+
+import org.apache.felix.ipojo.runtime.core.services.FooService;
+
+import java.util.Properties;
+
+public class FooProviderTypeDyn implements FooService {
+
+    private int intProp;
+    private String strProp;
+    private String[] strAProp;
+    private int[] intAProp;
+    private boolean boolProp;
+
+    public boolean foo() {
+        intProp = 3;
+        boolProp = true;
+        if (strProp.equals("foo")) {
+            strProp = "bar";
+        } else {
+            strProp = "foo";
+        }
+        strAProp = new String[]{"foo", "bar", "baz"};
+        intAProp = new int[]{3, 2, 1};
+        return true;
+    }
+
+    public Properties fooProps() {
+        Properties p = new Properties();
+        p.put("intProp", new Integer(intProp));
+        p.put("boolProp", new Boolean(boolProp));
+        p.put("strProp", strProp);
+        p.put("strAProp", strAProp);
+        p.put("intAProp", intAProp);
+        return p;
+    }
+
+    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);
+    }
+
+}

Added: felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Manipulation23Tester.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Manipulation23Tester.java?rev=1449171&view=auto
==============================================================================
--- felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Manipulation23Tester.java (added)
+++ felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Manipulation23Tester.java Fri Feb 22 18:55:31 2013
@@ -0,0 +1,188 @@
+/* 
+ * 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.runtime.core.components;
+
+import org.apache.felix.ipojo.runtime.core.services.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/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Multiconstructor.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Multiconstructor.java?rev=1449171&view=auto
==============================================================================
--- felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Multiconstructor.java (added)
+++ felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Multiconstructor.java Fri Feb 22 18:55:31 2013
@@ -0,0 +1,17 @@
+package org.apache.felix.ipojo.runtime.core.components;
+
+public class Multiconstructor {
+
+	public Multiconstructor(String s1, String s2) {
+		this(s1, s2, -1);
+	}
+
+	public Multiconstructor(String s1, int s2) {
+		this(s1, "" + s2, s2);
+	}
+
+	public Multiconstructor(String s1, String s2, int i) {
+		//...
+	}
+
+}

Added: felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/MultipleCheckService.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/MultipleCheckService.java?rev=1449171&view=auto
==============================================================================
--- felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/MultipleCheckService.java (added)
+++ felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/MultipleCheckService.java Fri Feb 22 18:55:31 2013
@@ -0,0 +1,158 @@
+/* 
+ * 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.runtime.core.components;
+
+import org.apache.felix.ipojo.runtime.core.services.CheckService;
+import org.apache.felix.ipojo.runtime.core.services.FooService;
+import org.osgi.framework.ServiceReference;
+
+import java.util.Properties;
+
+public class MultipleCheckService implements CheckService {
+
+    FooService fs[];
+
+    int simpleB = 0;
+
+    int objectB = 0;
+
+    int refB = 0;
+
+    int bothB = 0;
+
+    int simpleU = 0;
+
+    int objectU = 0;
+
+    int refU = 0;
+
+    int bothU = 0;
+
+    public boolean check() {
+        boolean r = fs.length != 0;
+        for (int i = 0; i < fs.length; i++) {
+            r = r & fs[i].foo();
+        }
+        return r;
+    }
+
+    private boolean getBoolean() {
+        return check();
+    }
+
+    private int getInt() {
+        int r = 0;
+        for (int i = 0; i < fs.length; i++) {
+            r = r + fs[i].getInt();
+        }
+        return r;
+    }
+
+    private long getLong() {
+        long r = 0;
+        for (int i = 0; i < fs.length; i++) {
+            r = r + fs[i].getLong();
+        }
+        return r;
+    }
+
+    private double getDouble() {
+        double r = 0.0;
+        for (int i = 0; i < fs.length; i++) {
+            r = r + fs[i].getInt();
+        }
+        return r;
+    }
+
+    protected Object doNothing(Object o, String s) {
+        return null;
+    }
+
+    // private Object getObject() {
+    // boolean r = true;
+    // for(int i = 0; i < fs.length; i++) {
+    // r = r && ((Boolean) fs[i].getObject()).booleanValue();
+    // }
+    // return new Boolean(r);
+    // }
+
+    public Properties getProps() {
+        Properties props = new Properties();
+        props.put("result", new Boolean(check()));
+        props.put("voidB", new Integer(simpleB));
+        props.put("objectB", new Integer(objectB));
+        props.put("refB", new Integer(refB));
+        props.put("bothB", new Integer(bothB));
+        props.put("voidU", new Integer(simpleU));
+        props.put("objectU", new Integer(objectU));
+        props.put("refU", new Integer(refU));
+        props.put("bothU", new Integer(bothU));
+        props.put("boolean", new Boolean(getBoolean()));
+        props.put("int", new Integer(getInt()));
+        props.put("long", new Long(getLong()));
+        props.put("double", new Double(getDouble()));
+
+        return props;
+    }
+
+    public void voidBind() {
+        simpleB++;
+    }
+
+    public void voidUnbind() {
+        simpleU++;
+    }
+
+    public void objectBind(FooService o) {
+        if (o != null && o instanceof FooService) {
+            objectB++;
+        }
+    }
+
+    public void objectUnbind(FooService o) {
+        if (o != null && o instanceof FooService) {
+            objectU++;
+        }
+    }
+
+    public void refBind(ServiceReference sr) {
+        if (sr != null) {
+            refB++;
+        }
+    }
+
+    public void refUnbind(ServiceReference sr) {
+        if (sr != null) {
+            refU++;
+        }
+    }
+
+    public void bothBind(FooService o, ServiceReference sr) {
+        if (o != null && o instanceof FooService && sr != null) {
+            bothB++;
+        }
+    }
+
+    public void bothUnbind(FooService o, ServiceReference sr) {
+        if (o != null && o instanceof FooService && sr != null) {
+            bothU++;
+        }
+    }
+
+}

Added: felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Parent.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Parent.java?rev=1449171&view=auto
==============================================================================
--- felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Parent.java (added)
+++ felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Parent.java Fri Feb 22 18:55:31 2013
@@ -0,0 +1,15 @@
+package org.apache.felix.ipojo.runtime.core.components;
+
+public class Parent {
+
+	private String s;
+
+	public Parent(String s) {
+		this.s = s;
+	}
+
+	public String getS() {
+		return s;
+	}
+
+}

Added: felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/A123/CheckService2.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/A123/CheckService2.java?rev=1449171&view=auto
==============================================================================
--- felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/A123/CheckService2.java (added)
+++ felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/A123/CheckService2.java Fri Feb 22 18:55:31 2013
@@ -0,0 +1,25 @@
+/* 
+ * 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.runtime.core.services.A123;
+
+public interface CheckService2 {
+	
+	public boolean check();
+
+}

Added: felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/BarService.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/BarService.java?rev=1449171&view=auto
==============================================================================
--- felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/BarService.java (added)
+++ felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/BarService.java Fri Feb 22 18:55:31 2013
@@ -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.runtime.core.services;
+
+import java.util.Properties;
+
+public interface BarService {
+	
+	public boolean bar();
+	
+	public Properties getProps();
+
+}

Added: felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/CheckService.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/CheckService.java?rev=1449171&view=auto
==============================================================================
--- felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/CheckService.java (added)
+++ felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/CheckService.java Fri Feb 22 18:55:31 2013
@@ -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.runtime.core.services;
+
+import java.util.Properties;
+
+public interface CheckService {
+    
+    public static final String foo = "foo";
+	
+	public boolean check();
+	
+	public Properties getProps();
+
+}

Added: felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/FooService.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/FooService.java?rev=1449171&view=auto
==============================================================================
--- felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/FooService.java (added)
+++ felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/FooService.java Fri Feb 22 18:55:31 2013
@@ -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.runtime.core.services;
+
+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/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Plop.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Plop.java?rev=1449171&view=auto
==============================================================================
--- felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Plop.java (added)
+++ felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Plop.java Fri Feb 22 18:55:31 2013
@@ -0,0 +1,7 @@
+package org.apache.felix.ipojo.runtime.core.services;
+
+public interface Plop {
+    
+   Object getPlop();
+
+}

Added: felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/PrimitiveManipulationTestService.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/PrimitiveManipulationTestService.java?rev=1449171&view=auto
==============================================================================
--- felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/PrimitiveManipulationTestService.java (added)
+++ felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/PrimitiveManipulationTestService.java Fri Feb 22 18:55:31 2013
@@ -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.runtime.core.services;
+
+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/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-metadata-test/src/main/resources/metadata.xml
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-metadata-test/src/main/resources/metadata.xml?rev=1449171&view=auto
==============================================================================
--- felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-metadata-test/src/main/resources/metadata.xml (added)
+++ felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-metadata-test/src/main/resources/metadata.xml Fri Feb 22 18:55:31 2013
@@ -0,0 +1,57 @@
+<ipojo
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="org.apache.felix.ipojo hhttp://felix.apache.org/ipojo/schemas/SNAPSHOT/core.xsd"
+    xmlns="org.apache.felix.ipojo"
+>
+	<!-- Simple provider  used for manipulation analysis -->
+	<component
+		classname="org.apache.felix.ipojo.runtime.core.components.FooProviderType1"
+		name="ManipulationMetadata-FooProviderType-1" architecture="true">
+		<provides />
+	</component>
+
+	<!-- Provider providing 2 services -->
+	<component
+		classname="org.apache.felix.ipojo.runtime.core.components.FooBarProviderType1"
+		name="ManipulationMetadata-FooBarProviderType-1" architecture="true">
+		<provides />
+	</component>
+
+	<!-- Provider with dynamic property -->
+	<component
+		classname="org.apache.felix.ipojo.runtime.core.components.FooProviderTypeDyn"
+		name="ManipulationMetadata-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.runtime.core.components.Manipulation23Tester"
+		name="ManipulationMetadata-PrimitiveManipulationTester" architecture="true">
+		<provides />
+	</component>
+
+
+	<component
+		classname="org.apache.felix.ipojo.runtime.core.components.MultipleCheckService"
+		name="ManipulationMetadata-SimpleMultipleCheckServiceProvider" architecture="true">
+		<requires field="fs" />
+		<provides />
+	</component>
+
+
+	<component
+		classname="org.apache.felix.ipojo.runtime.core.components.Child">
+	</component>
+
+	<component
+		classname="org.apache.felix.ipojo.runtime.core.components.Multiconstructor">
+    </component>
+</ipojo>

Added: felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-metadata-test/src/test/java/org/apache/felix/ipojo/runtime/core/Common.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-metadata-test/src/test/java/org/apache/felix/ipojo/runtime/core/Common.java?rev=1449171&view=auto
==============================================================================
--- felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-metadata-test/src/test/java/org/apache/felix/ipojo/runtime/core/Common.java (added)
+++ felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-metadata-test/src/test/java/org/apache/felix/ipojo/runtime/core/Common.java Fri Feb 22 18:55:31 2013
@@ -0,0 +1,200 @@
+package org.apache.felix.ipojo.runtime.core;
+
+import ch.qos.logback.classic.Level;
+import ch.qos.logback.classic.Logger;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.filefilter.TrueFileFilter;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.Configuration;
+import org.ops4j.pax.exam.CoreOptions;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.junit.PaxExam;
+import org.ops4j.pax.exam.options.CompositeOption;
+import org.ops4j.pax.exam.options.DefaultCompositeOption;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerClass;
+import org.ops4j.pax.exam.spi.reactors.PerMethod;
+import org.ops4j.pax.tinybundles.core.TinyBundle;
+import org.ops4j.pax.tinybundles.core.TinyBundles;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Constants;
+import org.ow2.chameleon.testing.helpers.IPOJOHelper;
+import org.ow2.chameleon.testing.helpers.OSGiHelper;
+import org.ow2.chameleon.testing.tinybundles.ipojo.IPOJOStrategy;
+import org.slf4j.LoggerFactory;
+
+import javax.inject.Inject;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import static junit.framework.Assert.fail;
+import static org.ops4j.pax.exam.CoreOptions.*;
+
+/**
+ * Bootstrap the test from this project
+ */
+@RunWith(PaxExam.class)
+@ExamReactorStrategy(PerMethod.class)
+public class Common {
+
+    @Inject
+    BundleContext bc;
+
+    protected OSGiHelper osgiHelper;
+    protected IPOJOHelper ipojoHelper;
+    protected Bundle testedBundle;
+
+    @Configuration
+    public Option[] config() throws IOException {
+        Logger root = (Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
+        root.setLevel(Level.INFO);
+
+        return options(
+                ipojoBundles(),
+                junitBundles(),
+                testedBundle(),
+                systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("WARN")
+        );
+    }
+
+    public static Option junitAndMockitoBundles() {
+        return new DefaultCompositeOption(
+                // Repository required to load harmcrest (OSGi-fied version).
+                repository("http://repository.springsource.com/maven/bundles/external").id(
+                        "com.springsource.repository.bundles.external"),
+
+                // Mockito without Hamcrest and Objenesis
+                mavenBundle("org.mockito", "mockito-core", "1.9.5"),
+
+                // Hamcrest with a version matching the range expected by Mockito
+                mavenBundle("org.hamcrest", "com.springsource.org.hamcrest.core", "1.1.0"),
+
+                // Objenesis with a version matching the range expected by Mockito
+                wrappedBundle(mavenBundle("org.objenesis", "objenesis", "1.2"))
+                        .exports("*;version=1.2"),
+
+                // The default JUnit bundle also exports Hamcrest, but with an (incorrect) version of
+                // 4.9 which does not match the Mockito import.
+                CoreOptions.junitBundles(),
+
+                /*
+                 * Felix has implicit boot delegation enabled by default. It conflicts with Mockito:
+                 * java.lang.LinkageError: loader constraint violation in interface itable initialization:
+                 * when resolving method "org.osgi.service.useradmin.User$$EnhancerByMockitoWithCGLIB$$dd2f81dc
+                 * .newInstance(Lorg/mockito/cglib/proxy/Callback;)Ljava/lang/Object;" the class loader
+                 * (instance of org/mockito/internal/creation/jmock/SearchingClassLoader) of the current class,
+                 * org/osgi/service/useradmin/User$$EnhancerByMockitoWithCGLIB$$dd2f81dc, and the class loader
+                 * (instance of org/apache/felix/framework/BundleWiringImpl$BundleClassLoaderJava5) for interface
+                 * org/mockito/cglib/proxy/Factory have different Class objects for the type org/mockito/cglib/
+                 * proxy/Callback used in the signature
+                 *
+                 * So we disable the bootdelegation.
+                 */
+                frameworkProperty("felix.bootdelegation.implicit").value("false")
+        );
+    }
+
+
+    @Before
+    public void commonSetUp() {
+        osgiHelper = new OSGiHelper(bc);
+        ipojoHelper = new IPOJOHelper(bc);
+
+        testedBundle = osgiHelper.getBundle("test.bundle");
+
+        // Dump OSGi Framework information
+        String vendor = (String) osgiHelper.getBundle(0).getHeaders().get(Constants.BUNDLE_VENDOR);
+        if (vendor == null) {
+            vendor = (String) osgiHelper.getBundle(0).getHeaders().get(Constants.BUNDLE_SYMBOLICNAME);
+        }
+        String version = (String) osgiHelper.getBundle(0).getHeaders().get(Constants.BUNDLE_VERSION);
+        System.out.println("OSGi Framework : " + vendor + " - " + version);
+    }
+
+    @After
+    public void commonTearDown() {
+        ipojoHelper.dispose();
+        osgiHelper.dispose();
+    }
+
+    public CompositeOption ipojoBundles() {
+        return new DefaultCompositeOption(
+                mavenBundle("org.apache.felix", "org.apache.felix.ipojo").versionAsInProject(),
+                mavenBundle("org.ow2.chameleon.testing", "osgi-helpers").versionAsInProject(),
+                // configuration admin
+                mavenBundle("org.apache.felix",  "org.apache.felix.configadmin").versionAsInProject()
+        );
+    }
+
+    public Option testedBundle() throws MalformedURLException {
+        File out = new File("target/tested/bundle.jar");
+        if (out.exists()) {
+            return bundle(out.toURI().toURL().toExternalForm());
+        }
+
+        TinyBundle tested = TinyBundles.bundle();
+
+        // We look inside target/classes to find the class and resources
+        File classes = new File("target/classes");
+        Collection<File> files = FileUtils.listFilesAndDirs(classes, TrueFileFilter.INSTANCE, TrueFileFilter.INSTANCE);
+        List<File> services = new ArrayList<File>();
+        for (File file : files) {
+            if (file.isDirectory()) {
+                // By convention we export of .services and .service package
+                if (file.getAbsolutePath().contains("/services")  || file.getAbsolutePath().contains("/service")) {
+                    services.add(file);
+                }
+            } else {
+                // We need to compute the path
+                String path = file.getAbsolutePath().substring(classes.getAbsolutePath().length() +1);
+                tested.add(path, file.toURI().toURL());
+                System.out.println(file.getName() + " added to " + path);
+            }
+        }
+
+        // We export components.
+        String export = "org.apache.felix.ipojo.runtime.core.components";
+        for (File file : services) {
+            if (export.length() > 0) { export += ", "; }
+            String path = file.getAbsolutePath().substring(classes.getAbsolutePath().length() +1);
+            String packageName = path.replace('/', '.');
+            export += packageName;
+        }
+
+        System.out.println("Exported packages : " + export);
+
+        InputStream inputStream = tested
+                .set(Constants.BUNDLE_SYMBOLICNAME, "test.bundle")
+                .set(Constants.IMPORT_PACKAGE, "*")
+                .set(Constants.EXPORT_PACKAGE, export)
+                .build(IPOJOStrategy.withiPOJO(new File("src/main/resources")));
+
+        try {
+            org.apache.commons.io.FileUtils.copyInputStreamToFile(inputStream, out);
+            return bundle(out.toURI().toURL().toExternalForm());
+        } catch (MalformedURLException e) {
+            throw new RuntimeException("Cannot compute the url of the manipulated bundle");
+        } catch (IOException e) {
+            throw new RuntimeException("Cannot write of the manipulated bundle");
+        }
+    }
+
+    public void assertContains(String s, String[] arrays, String object) {
+        for (String suspect : arrays) {
+            if (object.equals(suspect)) {
+                return;
+            }
+        }
+        fail("Assertion failed : " + s);
+    }
+
+
+}

Added: felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-metadata-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestManipulationMetadata.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-metadata-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestManipulationMetadata.java?rev=1449171&view=auto
==============================================================================
--- felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-metadata-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestManipulationMetadata.java (added)
+++ felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-metadata-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestManipulationMetadata.java Fri Feb 22 18:55:31 2013
@@ -0,0 +1,251 @@
+/* 
+ * 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.runtime.core;
+
+import org.apache.felix.ipojo.metadata.Element;
+import org.apache.felix.ipojo.parser.ManifestMetadataParser;
+import org.apache.felix.ipojo.parser.ParseException;
+import org.apache.felix.ipojo.parser.ParseUtils;
+import org.apache.felix.ipojo.runtime.core.services.BarService;
+import org.apache.felix.ipojo.runtime.core.services.FooService;
+import org.junit.Test;
+
+import static junit.framework.Assert.assertEquals;
+import static org.junit.Assert.*;
+
+/**
+ * Check manipulation metadata written in the manifest.
+ */
+public class TestManipulationMetadata extends Common {
+
+    @Test
+    public void testGetMetadata() {
+        String header = (String) testedBundle.getHeaders().get("iPOJO-Components");
+        Element elem = null;
+        try {
+            elem = ManifestMetadataParser.parseHeaderMetadata(header);
+        } catch (ParseException e) {
+            fail("Parse Exception when parsing iPOJO-Component");
+        }
+
+        assertNotNull("Check elem not null", elem);
+
+
+        Element manip = getManipulationForComponent(elem, "ManipulationMetadata-FooProviderType-1");
+        assertNotNull("Check manipulation metadata not null for " + "FooProviderType-1", manip);
+    }
+
+    @Test
+    public void testInterface() {
+        String comp_name = "ManipulationMetadata-FooProviderType-1";
+        Element manip = getManipulationForComponent(comp_name);
+        Element[] itf = manip.getElements("Interface");
+        assertEquals("Check interfaces number", itf.length, 1);
+        assertEquals("Check itf name", itf[0].getAttribute("name"), FooService.class.getName());
+    }
+
+    @Test
+    public void testInterfaces() {
+        String comp_name = "ManipulationMetadata-FooBarProviderType-1";
+        Element manip = getManipulationForComponent(comp_name);
+        Element[] itf = manip.getElements("Interface");
+        assertEquals("Check interfaces number", itf.length, 2);
+        assertEquals("Check itf name", itf[0].getAttribute("name"), FooService.class.getName());
+        assertEquals("Check itf name", itf[1].getAttribute("name"), BarService.class.getName());
+    }
+
+    @Test
+    public void testFields() {
+        String comp_name = "ManipulationMetadata-FooProviderType-Dyn";
+        Element manip = getManipulationForComponent(comp_name);
+        Element[] fields = manip.getElements("field");
+        assertEquals("Check field count " + fields.length, fields.length, 5);
+        /*
+        private int intProp;
+		private String strProp;
+		private String[] strAProp;
+		private int[] intAProp;
+		private boolean boolProp;
+		 */
+
+        Element field;
+
+        field = getFieldFromName(manip, "intProp");
+        assertEquals("Check field name : " + field.getAttribute("name"), field.getAttribute("name"), "intProp");
+        assertEquals("Check field type : " + field.getAttribute("name"), field.getAttribute("type"), "int");
+
+        field = getFieldFromName(manip, "strProp");
+        assertEquals("Check field name : " + field.getAttribute("name"), field.getAttribute("name"), "strProp");
+        assertEquals("Check field type : " + field.getAttribute("name"), field.getAttribute("type"), "java.lang.String");
+
+        field = getFieldFromName(manip, "strAProp");
+        assertEquals("Check field name : " + field.getAttribute("name"), field.getAttribute("name"), "strAProp");
+        assertEquals("Check field type : " + field.getAttribute("name"), field.getAttribute("type"), "java.lang.String[]");
+
+        field = getFieldFromName(manip, "intAProp");
+        assertEquals("Check field name : " + field.getAttribute("name"), field.getAttribute("name"), "intAProp");
+        assertEquals("Check field type : " + field.getAttribute("name"), field.getAttribute("type"), "int[]");
+
+        field = getFieldFromName(manip, "boolProp");
+        assertEquals("Check field name : " + field.getAttribute("name"), field.getAttribute("name"), "boolProp");
+        assertEquals("Check field type : " + field.getAttribute("name"), field.getAttribute("type"), "boolean");
+    }
+
+    @Test
+    public void testPrimitivesFields() {
+        String comp_name = "ManipulationMetadata-PrimitiveManipulationTester";
+        Element manip = getManipulationForComponent(comp_name);
+        Element[] fields = manip.getElements("Field");
+        assertEquals("Check field count", fields.length, 16);
+		/*
+		byte b = 1;
+		short s = 1;
+		int i = 1;
+		long l = 1;
+		double d = 1.1;
+		float f = 1.1f;
+		char c = 'a';
+		boolean bool = false;
+		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};
+		 */
+        Element field;
+
+        field = getFieldFromName(manip, "b");
+        assertEquals("Check field type : " + field.getAttribute("name"), field.getAttribute("type"), "byte");
+        field = getFieldFromName(manip, "s");
+        assertEquals("Check field type : " + field.getAttribute("name"), field.getAttribute("type"), "short");
+        field = getFieldFromName(manip, "i");
+        assertEquals("Check field type : " + field.getAttribute("name"), field.getAttribute("type"), "int");
+        field = getFieldFromName(manip, "l");
+        assertEquals("Check field type : " + field.getAttribute("name"), field.getAttribute("type"), "long");
+        field = getFieldFromName(manip, "d");
+        assertEquals("Check field type : " + field.getAttribute("name"), field.getAttribute("type"), "double");
+        field = getFieldFromName(manip, "f");
+        assertEquals("Check field type : " + field.getAttribute("name"), field.getAttribute("type"), "float");
+        field = getFieldFromName(manip, "c");
+        assertEquals("Check field type : " + field.getAttribute("name"), field.getAttribute("type"), "char");
+        field = getFieldFromName(manip, "bool");
+        assertEquals("Check field type : " + field.getAttribute("name"), field.getAttribute("type"), "boolean");
+
+        field = getFieldFromName(manip, "bs");
+        assertEquals("Check field type : " + field.getAttribute("name"), field.getAttribute("type"), "byte[]");
+        field = getFieldFromName(manip, "ss");
+        assertEquals("Check field type : " + field.getAttribute("name"), field.getAttribute("type"), "short[]");
+        field = getFieldFromName(manip, "is");
+        assertEquals("Check field type : " + field.getAttribute("name"), field.getAttribute("type"), "int[]");
+        field = getFieldFromName(manip, "ls");
+        assertEquals("Check field type : " + field.getAttribute("name"), field.getAttribute("type"), "long[]");
+        field = getFieldFromName(manip, "ds");
+        assertEquals("Check field type : " + field.getAttribute("name"), field.getAttribute("type"), "double[]");
+        field = getFieldFromName(manip, "fs");
+        assertEquals("Check field type : " + field.getAttribute("name"), field.getAttribute("type"), "float[]");
+        field = getFieldFromName(manip, "cs");
+        assertEquals("Check field type : " + field.getAttribute("name"), field.getAttribute("type"), "char[]");
+        field = getFieldFromName(manip, "bools");
+        assertEquals("Check field type : " + field.getAttribute("name"), field.getAttribute("type"), "boolean[]");
+    }
+
+    @Test
+    public void testNoArgMethod() {
+        String comp_name = "ManipulationMetadata-SimpleMultipleCheckServiceProvider";
+        Element manip = getManipulationForComponent(comp_name);
+        Element method = getMethodFromName(manip, "check");
+        assertFalse("Check no args", method.containsAttribute("arguments"));
+        assertEquals("Check return", method.getAttribute("return"), "boolean");
+    }
+
+    @Test
+    public void testOneArgsMethod() {
+        String comp_name = "ManipulationMetadata-SimpleMultipleCheckServiceProvider";
+        Element manip = getManipulationForComponent(comp_name);
+        Element method = getMethodFromName(manip, "refBind");
+        assertEquals("Check args", method.getAttribute("arguments"), "{org.osgi.framework.ServiceReference}");
+        assertEquals("Check args count", 1, ParseUtils.parseArrays("{org.osgi.framework.ServiceReference}").length);
+        assertFalse("Check return", method.containsAttribute("return"));
+    }
+
+    @Test
+    public void testTwoArgsMethod() {
+        String comp_name = "ManipulationMetadata-SimpleMultipleCheckServiceProvider";
+        Element manip = getManipulationForComponent(comp_name);
+        Element method = getMethodFromName(manip, "doNothing");
+        assertEquals("Check args", method.getAttribute("arguments"), "{java.lang.Object,java.lang.String}");
+        assertEquals("Check args count", 2, ParseUtils.parseArrays("{java.lang.Object,java.lang.String}").length);
+        assertEquals("Check return", method.getAttribute("return"), "java.lang.Object");
+    }
+
+    private Element getManipulationForComponent(Element metadata, String comp_name) {
+        Element[] comps = metadata.getElements("component");
+        for (Element comp : comps) {
+            if (comp.containsAttribute("factory") && comp.getAttribute("factory").equals(comp_name)) {
+                return comp.getElements("manipulation")[0];
+            }
+            if (comp.containsAttribute("name") && comp.getAttribute("name").equals(comp_name)) {
+                return comp.getElements("manipulation")[0];
+            }
+        }
+        return null;
+    }
+
+    private Element getManipulationForComponent(String comp_name) {
+        String header = (String) testedBundle.getHeaders().get("iPOJO-Components");
+        Element elem = null;
+        try {
+            elem = ManifestMetadataParser.parseHeaderMetadata(header);
+        } catch (ParseException e) {
+            fail("Parse Exception when parsing iPOJO-Component");
+        }
+
+        assertNotNull("Check elem not null", elem);
+        Element manip = getManipulationForComponent(elem, comp_name);
+        assertNotNull("Check manipulation metadata not null for " + comp_name, manip);
+        return manip;
+    }
+
+    private Element getMethodFromName(Element manip, String name) {
+        Element methods[] = manip.getElements("Method");
+        for (int i = 0; i < methods.length; i++) {
+            if (methods[i].containsAttribute("name") && methods[i].getAttribute("name").equals(name)) {
+                return methods[i];
+            }
+        }
+        fail("Method " + name + " not found");
+        return null;
+    }
+
+    private Element getFieldFromName(Element manip, String name) {
+        Element fields[] = manip.getElements("Field");
+        for (int i = 0; i < fields.length; i++) {
+            if (fields[i].containsAttribute("name") && fields[i].getAttribute("name").equals(name)) {
+                return fields[i];
+            }
+        }
+        fail("Field " + name + " not found");
+        return null;
+    }
+
+
+}



Mime
View raw message