You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by cl...@apache.org on 2013/02/22 19:55:34 UTC

svn commit: r1449171 [4/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...

Added: felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestGenericList.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestGenericList.java?rev=1449171&view=auto
==============================================================================
--- felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestGenericList.java (added)
+++ felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestGenericList.java Fri Feb 22 18:55:31 2013
@@ -0,0 +1,60 @@
+package org.apache.felix.ipojo.runtime.core;
+
+import org.apache.felix.ipojo.ComponentInstance;
+import org.apache.felix.ipojo.runtime.core.services.CheckService;
+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.List;
+import java.util.Properties;
+
+import static junit.framework.Assert.assertEquals;
+import static org.junit.Assert.*;
+
+public class TestGenericList extends Common {
+
+    ComponentInstance foo1, foo2;
+    ComponentInstance checker;
+
+    @Before
+    public void setUp() {
+        foo1 = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.runtime.core.components.FooServiceImpl", "foo1");
+        foo2 = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.runtime.core.components.FooServiceImpl", "foo2");
+        checker = ipojoHelper.createComponentInstance("TypedList", "checker");
+        foo1.stop();
+        foo2.stop();
+    }
+
+    @Test
+    public void testTypedList() {
+        ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), checker.getInstanceName());
+        CheckService check = (CheckService) osgiHelper.getServiceObject(ref);
+        assertNotNull("Checker availability", check);
+        // Check without providers
+        assertFalse("Empty list", check.check());
+
+        // Start the first provider
+        foo1.start();
+        assertTrue("List with one element", check.check());
+        Properties props = check.getProps();
+        List<FooService> list = (List<FooService>) props.get("list");
+        assertEquals("Check size - 1", 1, list.size());
+
+        // Start the second provider 
+        foo2.start();
+        assertTrue("List with two element", check.check());
+        props = check.getProps();
+        list = (List<FooService>) props.get("list");
+        assertEquals("Check size - 2", 2, list.size());
+
+        // Stop the first one
+        foo1.stop();
+        assertTrue("List with one element (2)", check.check());
+        props = check.getProps();
+        list = (List<FooService>) props.get("list");
+        assertEquals("Check size - 3", 1, list.size());
+    }
+
+}

Added: felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestGetComponentInstance.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestGetComponentInstance.java?rev=1449171&view=auto
==============================================================================
--- felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestGetComponentInstance.java (added)
+++ felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestGetComponentInstance.java Fri Feb 22 18:55:31 2013
@@ -0,0 +1,92 @@
+/* 
+ * 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.Factory;
+import org.apache.felix.ipojo.Pojo;
+import org.apache.felix.ipojo.PrimitiveInstanceDescription;
+import org.apache.felix.ipojo.runtime.core.services.FooService;
+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 getComponentInstance method on a POJO
+ */
+public class TestGetComponentInstance extends Common {
+
+    /**
+     * Check if a pojo can correctly be cast in POJO.
+     * Check the getComponentInstance method.
+     */
+    @Test
+    public void testGetComponentInstance() {
+        String factName = "Manipulation-FooProviderType-1";
+        String compName = "FooProvider-1";
+        ServiceReference ref = null;
+
+        // Get the factory to create a component instance
+        Factory fact = ipojoHelper.getFactory(factName);
+        assertNotNull("Cannot find the factory FooProvider-1", fact);
+
+        Properties props = new Properties();
+        props.put("instance.name", compName);
+        ComponentInstance ci = null;
+        try {
+            ci = fact.createComponentInstance(props);
+        } catch (Exception e1) {
+            fail(e1.getMessage());
+        }
+
+        assertEquals("Check instance name", compName, ci.getInstanceName());
+
+        // Get a FooService provider
+        ref = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), compName);
+
+        assertNotNull("FS not available", ref);
+
+        // Get foo object
+        FooService fs = (FooService) osgiHelper.getServiceObject(ref);
+
+        // Cast to POJO
+        Pojo pojo = (Pojo) fs;
+
+        // GetComponentInstance
+        ComponentInstance instance = pojo.getComponentInstance();
+        assertEquals("Check component instance name", instance.getInstanceName(), compName);
+        assertEquals("Check component factory name", instance.getFactory().getName(), factName);
+        assertNotNull("Instance description not null", instance.getInstanceDescription());
+        PrimitiveInstanceDescription id = (PrimitiveInstanceDescription) instance.getInstanceDescription();
+        assertTrue("Check instance state", id.getState() == ComponentInstance.VALID);
+        assertEquals("Check created pojo count", id.getCreatedObjects().length, 1);
+        assertEquals("Check instance description name", id.getName(), compName);
+
+        ci.dispose();
+
+        // Check that there is no more FooService
+        ref = osgiHelper.getServiceReference(FooService.class.getName());
+        assertNull("FS available, but component instance stopped", ref);
+    }
+
+}

Added: felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestNestedClasses.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestNestedClasses.java?rev=1449171&view=auto
==============================================================================
--- felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestNestedClasses.java (added)
+++ felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestNestedClasses.java Fri Feb 22 18:55:31 2013
@@ -0,0 +1,186 @@
+package org.apache.felix.ipojo.runtime.core;
+
+import org.apache.felix.ipojo.ComponentInstance;
+import org.apache.felix.ipojo.runtime.core.components.InnerClasses;
+import org.apache.felix.ipojo.runtime.core.services.CheckService;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.osgi.framework.ServiceReference;
+
+import java.util.Map;
+import java.util.Properties;
+
+import static junit.framework.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+public class TestNestedClasses extends Common {
+
+    private ComponentInstance instance;
+    private CheckService service;
+
+    @Before
+    public void setUp() {
+        Properties map = new Properties();
+        map.put("publicObject", "publicObject");
+        map.put("publicInt", new Integer(0));
+        map.put("packageObject", "packageObject");
+        map.put("packageInt", new Integer(1));
+        map.put("protectedObject", "protectedObject");
+        map.put("protectedInt", new Integer(2));
+        map.put("privateObject", "privateObject");
+        map.put("privateInt", new Integer(3));
+        map.put("nonObject", "nonObject");
+        map.put("nonInt", new Integer(4));
+        instance = ipojoHelper.createComponentInstance("inners", map);
+
+        ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName());
+        assertNotNull("Check service availability", ref);
+        service = (CheckService) osgiHelper.getServiceObject(ref);
+    }
+
+    @After
+    public void tearDown() {
+        service = null;
+    }
+
+    @Test
+    public void testPrivateInnerClass() {
+        Map data = (Map) service.getProps().get("privateInner");
+        assertNotNull("Check data existence", data);
+
+        assertEquals("Check public object", "publicObject", data.get("publicObject"));
+        assertEquals("Check public int", new Integer(0), data.get("publicInt"));
+        assertEquals("Check protected object", "protectedObject", data.get("protectedObject"));
+        assertEquals("Check protected int", new Integer(2), data.get("protectedInt"));
+        assertEquals("Check package object", "packageObject", data.get("packageObject"));
+        assertEquals("Check package int", new Integer(1), data.get("packageInt"));
+        assertEquals("Check private object", "privateObject", data.get("privateObject"));
+        assertEquals("Check private int", new Integer(3), data.get("privateInt"));
+        assertEquals("Check non-managed object", "not-managed", data.get("nonObject"));
+        assertEquals("Check non-managed int", new Integer(5), data.get("nonInt"));
+
+    }
+
+    @Test
+    public void testProtectedInnerClass() {
+        Map data = (Map) service.getProps().get("protectedInner");
+        assertNotNull("Check data existence", data);
+
+        assertEquals("Check public object", "publicObject", data.get("publicObject"));
+        assertEquals("Check public int", new Integer(0), data.get("publicInt"));
+        assertEquals("Check protected object", "protectedObject", data.get("protectedObject"));
+        assertEquals("Check protected int", new Integer(2), data.get("protectedInt"));
+        assertEquals("Check package object", "packageObject", data.get("packageObject"));
+        assertEquals("Check package int", new Integer(1), data.get("packageInt"));
+        assertEquals("Check private object", "privateObject", data.get("privateObject"));
+        assertEquals("Check private int", new Integer(3), data.get("privateInt"));
+        assertEquals("Check non-managed object", "not-managed", data.get("nonObject"));
+        assertEquals("Check non-managed int", new Integer(5), data.get("nonInt"));
+
+    }
+
+    @Test
+    public void testPackageInnerClass() {
+        Map data = (Map) service.getProps().get("packageInner");
+        assertNotNull("Check data existence", data);
+
+        assertEquals("Check public object", "publicObject", data.get("publicObject"));
+        assertEquals("Check public int", new Integer(0), data.get("publicInt"));
+        assertEquals("Check protected object", "protectedObject", data.get("protectedObject"));
+        assertEquals("Check protected int", new Integer(2), data.get("protectedInt"));
+        assertEquals("Check package object", "packageObject", data.get("packageObject"));
+        assertEquals("Check package int", new Integer(1), data.get("packageInt"));
+        assertEquals("Check private object", "privateObject", data.get("privateObject"));
+        assertEquals("Check private int", new Integer(3), data.get("privateInt"));
+        assertEquals("Check non-managed object", "not-managed", data.get("nonObject"));
+        assertEquals("Check non-managed int", new Integer(5), data.get("nonInt"));
+
+    }
+
+    @Test
+    public void testPublicInnerClass() {
+        Map data = (Map) service.getProps().get("publicInner");
+        assertNotNull("Check data existence", data);
+
+        assertEquals("Check public object", "publicObject", data.get("publicObject"));
+        assertEquals("Check public int", new Integer(0), data.get("publicInt"));
+        assertEquals("Check protected object", "protectedObject", data.get("protectedObject"));
+        assertEquals("Check protected int", new Integer(2), data.get("protectedInt"));
+        assertEquals("Check package object", "packageObject", data.get("packageObject"));
+        assertEquals("Check package int", new Integer(1), data.get("packageInt"));
+        assertEquals("Check private object", "privateObject", data.get("privateObject"));
+        assertEquals("Check private int", new Integer(3), data.get("privateInt"));
+        assertEquals("Check non-managed object", "not-managed", data.get("nonObject"));
+        assertEquals("Check non-managed int", new Integer(5), data.get("nonInt"));
+
+    }
+
+    @Test
+    public void testConstructorInnerClass() {
+        Map data = (Map) service.getProps().get("constructorInner");
+        assertNotNull("Check data existence", data);
+
+        assertEquals("Check public object", "publicObject", data.get("publicObject"));
+        assertEquals("Check public int", new Integer(0), data.get("publicInt"));
+        assertEquals("Check protected object", "protectedObject", data.get("protectedObject"));
+        assertEquals("Check protected int", new Integer(2), data.get("protectedInt"));
+        assertEquals("Check package object", "packageObject", data.get("packageObject"));
+        assertEquals("Check package int", new Integer(1), data.get("packageInt"));
+        assertEquals("Check private object", "privateObject", data.get("privateObject"));
+        assertEquals("Check private int", new Integer(3), data.get("privateInt"));
+        assertEquals("Check non-managed object", "not-managed", data.get("nonObject"));
+        assertEquals("Check non-managed int", new Integer(5), data.get("nonInt"));
+
+    }
+
+    @Test
+    public void testStaticInnerClass() {
+        Map data = (Map) service.getProps().get("staticInner");
+        assertNotNull("Check data existence", data);
+
+        assertEquals("Check static", new Boolean(true), data.get("static"));
+        assertEquals("Check static int", new Integer(6), data.get("staticint"));
+
+    }
+
+    @Test
+    public void testAnonymousInnerClass() {
+        Map data = (Map) service.getProps().get("anonymous");
+        assertNotNull("Check data existence", data);
+
+        assertEquals("Check public object", "publicObject", data.get("publicObject"));
+        assertEquals("Check public int", new Integer(0), data.get("publicInt"));
+        assertEquals("Check protected object", "protectedObject", data.get("protectedObject"));
+        assertEquals("Check protected int", new Integer(2), data.get("protectedInt"));
+        assertEquals("Check package object", "packageObject", data.get("packageObject"));
+        assertEquals("Check package int", new Integer(1), data.get("packageInt"));
+        assertEquals("Check private object", "privateObject", data.get("privateObject"));
+        assertEquals("Check private int", new Integer(3), data.get("privateInt"));
+        assertEquals("Check non-managed object", "not-managed", data.get("nonObject"));
+        assertEquals("Check non-managed int", new Integer(5), data.get("nonInt"));
+
+    }
+
+    @Test
+    public void testInnerAccess() {
+        Map map = (Map) service.getProps();
+        assertNotNull("Check map existence", map);
+
+        InnerClasses.PublicNested p = (InnerClasses.PublicNested) map.get("public");
+        Map data = p.doSomething();
+
+        assertEquals("Check public object", "publicObject", data.get("publicObject"));
+        assertEquals("Check public int", new Integer(0), data.get("publicInt"));
+        assertEquals("Check protected object", "protectedObject", data.get("protectedObject"));
+        assertEquals("Check protected int", new Integer(2), data.get("protectedInt"));
+        assertEquals("Check package object", "packageObject", data.get("packageObject"));
+        assertEquals("Check package int", new Integer(1), data.get("packageInt"));
+        assertEquals("Check private object", "privateObject", data.get("privateObject"));
+        assertEquals("Check private int", new Integer(3), data.get("privateInt"));
+        assertEquals("Check non-managed object", "not-managed", data.get("nonObject"));
+        assertEquals("Check non-managed int", new Integer(5), data.get("nonInt"));
+
+    }
+
+}

Added: felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestPrimitiveTypes.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestPrimitiveTypes.java?rev=1449171&view=auto
==============================================================================
--- felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestPrimitiveTypes.java (added)
+++ felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestPrimitiveTypes.java Fri Feb 22 18:55:31 2013
@@ -0,0 +1,107 @@
+/* 
+ * 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.runtime.core.services.PrimitiveManipulationTestService;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import static junit.framework.Assert.assertEquals;
+import static org.junit.Assert.*;
+
+/**
+ * Check the manipulation of primitive type (boxed and unboxed).
+ */
+public class TestPrimitiveTypes extends Common {
+
+    PrimitiveManipulationTestService prim;
+
+    @Before
+    public void setUp() {
+        ComponentInstance instance = ipojoHelper.createComponentInstance("ManipulationPrimitives-PrimitiveManipulationTester");
+        assertTrue("check instance state", instance.getState() == ComponentInstance.VALID);
+        prim = (PrimitiveManipulationTestService) osgiHelper.getServiceObject(PrimitiveManipulationTestService.class.getName(), "(instance.name=" + instance.getInstanceName() + ")");
+        assertNotNull("Check prim availability", prim);
+    }
+
+    @After
+    public void tearDown() {
+        prim = null;
+    }
+
+    @Test
+    public void testByte() {
+        assertEquals("Check - 1", prim.getByte(), 1);
+        prim.setByte((byte) 2);
+        assertEquals("Check - 2", prim.getByte(), 2);
+    }
+
+    @Test
+    public void testShort() {
+        assertEquals("Check - 1", prim.getShort(), 1);
+        prim.setShort((short) 2);
+        assertEquals("Check - 2", prim.getShort(), 2);
+    }
+
+    @Test
+    public void testInt() {
+        assertEquals("Check - 1", prim.getInt(), 1);
+        prim.setInt((int) 2);
+        assertEquals("Check - 2", prim.getInt(), 2);
+    }
+
+    @Test
+    public void testLong() {
+        assertEquals("Check - 1", prim.getLong(), 1);
+        prim.setLong((long) 2);
+        assertEquals("Check - 2", prim.getLong(), 2);
+    }
+
+    @Test
+    public void testFloat() {
+        assertEquals("Check - 1", prim.getFloat(), 1.1f);
+        prim.setFloat(2.2f);
+        assertEquals("Check - 2", prim.getFloat(), 2.2f);
+    }
+
+    @Test
+    public void testDouble() {
+        assertEquals("Check - 1", prim.getDouble(), 1.1);
+        prim.setDouble(2.2);
+        assertEquals("Check - 2", prim.getDouble(), 2.2);
+    }
+
+    @Test
+    public void testBoolean() {
+        assertFalse("Check - 1", prim.getBoolean());
+        prim.setBoolean(true);
+        assertTrue("Check - 2", prim.getBoolean());
+    }
+
+    @Test
+    public void testChar() {
+        assertEquals("Check - 1", prim.getChar(), 'a');
+        prim.setChar('b');
+        assertEquals("Check - 2", prim.getChar(), 'b');
+    }
+
+
+}

Added: felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestPrimitiveTypesWithNumberInNames.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestPrimitiveTypesWithNumberInNames.java?rev=1449171&view=auto
==============================================================================
--- felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestPrimitiveTypesWithNumberInNames.java (added)
+++ felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestPrimitiveTypesWithNumberInNames.java Fri Feb 22 18:55:31 2013
@@ -0,0 +1,111 @@
+/* 
+ * 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.runtime.core.services.PrimitiveManipulationTestService;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.osgi.framework.ServiceReference;
+
+import static junit.framework.Assert.assertEquals;
+import static org.junit.Assert.*;
+
+/**
+ * Check the manipulation of primitive type (boxed and unboxed).
+ * The targeted implementation contains numbers in the package and class name.
+ */
+public class TestPrimitiveTypesWithNumberInNames extends Common {
+
+    PrimitiveManipulationTestService prim;
+
+    @Before
+    public void setUp() {
+        ComponentInstance instance =
+                ipojoHelper.createComponentInstance("ManipulationPrimitives-PrimitiveManipulationTesterA");
+        assertTrue("check instance state", instance.getState() == ComponentInstance.VALID);
+        ServiceReference ref = ipojoHelper.getServiceReferenceByName(PrimitiveManipulationTestService.class.getName(),
+                instance.getInstanceName());
+        assertNotNull("Check prim availability", ref);
+        prim = (PrimitiveManipulationTestService) osgiHelper.getServiceObject(ref);
+    }
+
+    @After
+    public void tearDown() {
+        prim = null;
+    }
+
+    @Test
+    public void testByte() {
+        assertEquals("Check - 1", prim.getByte(), 1);
+        prim.setByte((byte) 2);
+        assertEquals("Check - 2", prim.getByte(), 2);
+    }
+
+    @Test
+    public void testShort() {
+        assertEquals("Check - 1", prim.getShort(), 1);
+        prim.setShort((short) 2);
+        assertEquals("Check - 2", prim.getShort(), 2);
+    }
+
+    @Test
+    public void testInt() {
+        assertEquals("Check - 1", prim.getInt(), 1);
+        prim.setInt((int) 2);
+        assertEquals("Check - 2", prim.getInt(), 2);
+    }
+
+    @Test
+    public void testLong() {
+        assertEquals("Check - 1", prim.getLong(), 1);
+        prim.setLong((long) 2);
+        assertEquals("Check - 2", prim.getLong(), 2);
+    }
+
+    @Test
+    public void testFloat() {
+        assertEquals("Check - 1", prim.getFloat(), 1.1f);
+        prim.setFloat(2.2f);
+        assertEquals("Check - 2", prim.getFloat(), 2.2f);
+    }
+
+    @Test
+    public void testDouble() {
+        assertEquals("Check - 1", prim.getDouble(), 1.1);
+        prim.setDouble(2.2);
+        assertEquals("Check - 2", prim.getDouble(), 2.2);
+    }
+
+    @Test
+    public void testBoolean() {
+        assertFalse("Check - 1", prim.getBoolean());
+        prim.setBoolean(true);
+        assertTrue("Check - 2", prim.getBoolean());
+    }
+
+    @Test
+    public void testChar() {
+        assertEquals("Check - 1", prim.getChar(), 'a');
+        prim.setChar('b');
+        assertEquals("Check - 2", prim.getChar(), 'b');
+    }
+
+}

Added: felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestTypeBoxing.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestTypeBoxing.java?rev=1449171&view=auto
==============================================================================
--- felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestTypeBoxing.java (added)
+++ felix/trunk/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestTypeBoxing.java Fri Feb 22 18:55:31 2013
@@ -0,0 +1,57 @@
+package org.apache.felix.ipojo.runtime.core;
+
+import org.apache.felix.ipojo.ComponentInstance;
+import org.apache.felix.ipojo.runtime.core.services.PrimitiveManipulationTestService;
+import org.junit.After;
+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.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+public class TestTypeBoxing extends Common {
+
+    ComponentInstance instance; // Instance under test
+
+    PrimitiveManipulationTestService prim;
+
+    ServiceReference prim_ref;
+
+    @Before
+    public void setUp() {
+        Properties p1 = new Properties();
+        p1.put("instance.name", "primitives");
+        instance = ipojoHelper.createComponentInstance("ManipulationPrimitives5-PrimitiveManipulationTester", p1);
+        assertTrue("check instance state", instance.getState() == ComponentInstance.VALID);
+        prim_ref = ipojoHelper.getServiceReferenceByName(PrimitiveManipulationTestService.class.getName(), instance.getInstanceName());
+        assertNotNull("Check prim availability", prim_ref);
+        prim = (PrimitiveManipulationTestService) osgiHelper.getServiceObject(prim_ref);
+    }
+
+    @After
+    public void tearDown() {
+        prim = null;
+    }
+
+
+    @Test
+    public void testLongFromObject() {
+        assertEquals("Check - 1", prim.getLong(), 1);
+        Long l = new Long(2);
+        prim.setLong(l);
+        assertEquals("Check - 2", prim.getLong(), 2);
+    }
+
+    @Test
+    public void testLongFromObject2() {
+        assertEquals("Check - 1", prim.getLong(), 1);
+        Long l = new Long(2);
+        prim.setLong(l, "ss");
+        assertEquals("Check - 2", prim.getLong(), 2);
+    }
+
+}