continuing FELIX-3903
Fix test on java 7.
Try to reproduce tests about enumeration.
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1453923 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/InnerClasses.java b/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/InnerClasses.java
index 8e94123..ac33a79 100644
--- a/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/InnerClasses.java
+++ b/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/InnerClasses.java
@@ -1,6 +1,7 @@
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.Job;
import java.util.HashMap;
import java.util.Map;
@@ -37,6 +38,7 @@
props.put("privateInner", new PrivateNested().doSomething());
props.put("constructorInner", new ConstructorNested().doSomething());
props.put("staticInner", new StaticNested().doSomething());
+ props.put("packageStaticInner", new PackageStaticNested().doSomething());
Job anonymous = new Job() {
public Map doSomething() {
@@ -139,6 +141,16 @@
return map;
}
}
+
+ static class PackageStaticNested implements Job {
+ private Map map = new HashMap();
+
+ public Map doSomething() {
+ map.put("static", new Boolean(true));
+ map.put("staticint", new Integer(staticint));
+ return map;
+ }
+ }
protected class ConstructorNested implements Job {
Map map = new HashMap();
@@ -163,6 +175,3 @@
}
-interface Job {
- public Map doSomething();
-}
diff --git a/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Switches.java b/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Switches.java
new file mode 100644
index 0000000..9667de4
--- /dev/null
+++ b/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Switches.java
@@ -0,0 +1,69 @@
+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.Color;
+
+import java.util.Properties;
+
+/**
+ * A component checking switch construct with integer and enumeration.
+ */
+public class Switches implements CheckService {
+
+ private static enum Stuff {
+ FOO,
+ BAR
+ }
+
+ private String switchOnInteger(int i) {
+ switch (i) {
+ case 0:
+ return "0";
+ case 1:
+ return "1";
+ case 2:
+ return "2";
+ default:
+ return "3";
+ }
+ }
+
+ private String switchOnEnum(Color color) {
+ switch (color) {
+ case RED:
+ return "RED";
+ case GREEN:
+ return "GREEN";
+ case BLUE:
+ return "BLUE";
+ default:
+ return "COLOR";
+ }
+ }
+
+ private String switchOnStuff(Stuff stuff) {
+ switch (stuff) {
+ case FOO : return "foo";
+ case BAR : return "bar";
+ default: return "";
+ }
+ }
+
+ @Override
+ public boolean check() {
+ return true;
+ }
+
+ @Override
+ public Properties getProps() {
+ Properties properties = new Properties();
+ properties.put("switchOnInteger1", switchOnInteger(1));
+ properties.put("switchOnInteger4", switchOnInteger(4));
+
+ properties.put("switchOnEnumRed", switchOnEnum(Color.RED));
+
+ properties.put("switchOnStuffFoo", switchOnStuff(Stuff.FOO));
+
+ return properties;
+ }
+}
diff --git a/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Color.java b/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Color.java
new file mode 100644
index 0000000..b47f9a6
--- /dev/null
+++ b/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Color.java
@@ -0,0 +1,11 @@
+package org.apache.felix.ipojo.runtime.core.services;
+
+/**
+ * An enumeration.
+ */
+public enum Color {
+
+ RED,
+ GREEN,
+ BLUE
+}
diff --git a/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Job.java b/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Job.java
new file mode 100644
index 0000000..3f9c3cf
--- /dev/null
+++ b/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Job.java
@@ -0,0 +1,10 @@
+package org.apache.felix.ipojo.runtime.core.services;
+
+import java.util.Map;
+
+/**
+ *
+ */
+public interface Job {
+ public Map doSomething();
+}
diff --git a/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/main/resources/metadata.xml b/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/main/resources/metadata.xml
index 7650c4f..3bf8562 100644
--- a/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/main/resources/metadata.xml
+++ b/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/main/resources/metadata.xml
@@ -34,4 +34,8 @@
<property field="publicInt"/>
</provides>
</component>
+
+ <component classname="org.apache.felix.ipojo.runtime.core.components.Switches">
+ <provides/>
+ </component>
</ipojo>
diff --git a/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestNestedClasses.java b/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestNestedClasses.java
index 0baa6a7..7dfd220 100644
--- a/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestNestedClasses.java
+++ b/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestNestedClasses.java
@@ -145,6 +145,16 @@
}
@Test
+ public void testPackageStaticInnerClass() {
+ Map data = (Map) service.getProps().get("packageStaticInner");
+ 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);
diff --git a/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestPrimitiveTypes.java b/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestPrimitiveTypes.java
index 303175c..ff1a9a1 100644
--- a/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestPrimitiveTypes.java
+++ b/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestPrimitiveTypes.java
@@ -77,16 +77,16 @@
@Test
public void testFloat() {
- assertEquals("Check - 1", prim.getFloat(), 1.1f);
+ assertEquals("Check - 1", prim.getFloat(), 1.1f, 0);
prim.setFloat(2.2f);
- assertEquals("Check - 2", prim.getFloat(), 2.2f);
+ assertEquals("Check - 2", prim.getFloat(), 2.2f, 0);
}
@Test
public void testDouble() {
- assertEquals("Check - 1", prim.getDouble(), 1.1);
+ assertEquals("Check - 1", prim.getDouble(), 1.1, 0);
prim.setDouble(2.2);
- assertEquals("Check - 2", prim.getDouble(), 2.2);
+ assertEquals("Check - 2", prim.getDouble(), 2.2, 0);
}
@Test
diff --git a/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestPrimitiveTypesWithNumberInNames.java b/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestPrimitiveTypesWithNumberInNames.java
index 709cbbe..5fb5138 100644
--- a/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestPrimitiveTypesWithNumberInNames.java
+++ b/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestPrimitiveTypesWithNumberInNames.java
@@ -82,16 +82,16 @@
@Test
public void testFloat() {
- assertEquals("Check - 1", prim.getFloat(), 1.1f);
+ assertEquals("Check - 1", prim.getFloat(), 1.1f, 0);
prim.setFloat(2.2f);
- assertEquals("Check - 2", prim.getFloat(), 2.2f);
+ assertEquals("Check - 2", prim.getFloat(), 2.2f, 0);
}
@Test
public void testDouble() {
- assertEquals("Check - 1", prim.getDouble(), 1.1);
+ assertEquals("Check - 1", prim.getDouble(), 1.1, 0);
prim.setDouble(2.2);
- assertEquals("Check - 2", prim.getDouble(), 2.2);
+ assertEquals("Check - 2", prim.getDouble(), 2.2, 0);
}
@Test
diff --git a/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestSwitches.java b/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestSwitches.java
new file mode 100644
index 0000000..2ba51d9
--- /dev/null
+++ b/ipojo/manipulator/manipulator-it/src/it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestSwitches.java
@@ -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.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.ops4j.pax.exam.ProbeBuilder;
+import org.ops4j.pax.exam.TestProbeBuilder;
+import org.osgi.framework.Constants;
+import org.osgi.framework.ServiceReference;
+
+import java.util.Properties;
+
+import static junit.framework.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+public class TestSwitches extends Common {
+
+ private ComponentInstance instance;
+ private CheckService service;
+
+ @Before
+ public void setUp() {
+ instance = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.runtime.core.components.Switches");
+
+ 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;
+ }
+
+ @ProbeBuilder
+ public TestProbeBuilder probe(TestProbeBuilder builder) {
+ builder.setHeader(Constants.IMPORT_PACKAGE, "org.osgi.framework, org.apache.felix.ipojo, " +
+ "org.ow2.chameleon.testing.helpers," +
+ "org.apache.felix.ipojo.architecture, org.apache.felix.ipojo.handlers.dependency," +
+ "org.apache.felix.ipojo.runtime.core.services, org.apache.felix.ipojo.runtime.core.components");
+ builder.setHeader(Constants.DYNAMICIMPORT_PACKAGE, "org.ops4j.pax.exam,org.junit,javax.inject," +
+ "org.ops4j.pax.exam.options,junit.framework");
+ builder.setHeader("Bundle-ManifestVersion", "2");
+ return builder;
+ }
+
+ @Test
+ public void testSwitches() {
+ Properties properties = service.getProps();
+ assertEquals(properties.get("switchOnInteger1"), "1");
+ assertEquals(properties.get("switchOnInteger4"), "3");
+
+
+ assertEquals(properties.get("switchOnEnumRed"), "RED");
+ }
+
+
+}
diff --git a/ipojo/manipulator/manipulator/pom.xml b/ipojo/manipulator/manipulator/pom.xml
index 35a5636..69d624f 100644
--- a/ipojo/manipulator/manipulator/pom.xml
+++ b/ipojo/manipulator/manipulator/pom.xml
@@ -61,6 +61,12 @@
<version>4.2.0</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>2.4</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
<plugins>
diff --git a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulation/ManipulatedClassLoader.java b/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulation/ManipulatedClassLoader.java
index 12afa5f..995f07e 100644
--- a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulation/ManipulatedClassLoader.java
+++ b/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulation/ManipulatedClassLoader.java
@@ -18,27 +18,44 @@
*/
package org.apache.felix.ipojo.manipulation;
+import java.util.HashMap;
+import java.util.Map;
+
/**
* A classloader used to load manipulated classes.
*/
-class ManipulatedClassLoader extends ClassLoader {
+public class ManipulatedClassLoader extends ClassLoader {
private String name;
private byte[] clazz;
+ private Map<String, byte[]> inners = new HashMap<String, byte[]>();
+
public ManipulatedClassLoader(String name, byte[] clazz) {
this.name = name;
this.clazz = clazz;
}
+ public void addInnerClasses(Map<String, byte[]> inn) {
+ inners = inn;
+ }
+
public Class findClass(String name) throws ClassNotFoundException {
if (name.equals(this.name)) {
return defineClass(name, clazz, 0, clazz.length);
}
+ if (inners.containsKey(name)) {
+ return defineClass(name, inners.get(name), 0, inners.get(name).length);
+
+ }
return super.findClass(name);
}
public Class loadClass(String arg0) throws ClassNotFoundException {
+ if (inners.containsKey(arg0)) {
+ return defineClass(arg0, inners.get(arg0), 0, inners.get(arg0).length);
+
+ }
return super.loadClass(arg0);
}
}
diff --git a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulation/ManipulatorTest.java b/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulation/ManipulatorTest.java
index a6d333c..b1ff382 100644
--- a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulation/ManipulatorTest.java
+++ b/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulation/ManipulatorTest.java
@@ -195,8 +195,7 @@
}
- //TODO CE - 19/10/2011 Why do we have a classloader issue in this test
- public void _testManipulatingTheInner() throws Exception {
+ public void testManipulatingTheInner() throws Exception {
Manipulator manipulator = new Manipulator();
byte[] clazz = manipulator.manipulate(getBytesFromFile(new File("target/test-classes/test/PojoWithInner.class")));
ManipulatedClassLoader classloader = new ManipulatedClassLoader("test.PojoWithInner", clazz);
diff --git a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulation/switches/TestSwitches.java b/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulation/switches/TestSwitches.java
new file mode 100644
index 0000000..f98264b
--- /dev/null
+++ b/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulation/switches/TestSwitches.java
@@ -0,0 +1,99 @@
+package org.apache.felix.ipojo.manipulation.switches;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.felix.ipojo.manipulation.ManipulatedClassLoader;
+import org.apache.felix.ipojo.manipulation.Manipulator;
+import org.junit.Assert;
+import org.junit.Test;
+import org.objectweb.asm.ClassReader;
+import org.objectweb.asm.util.CheckClassAdapter;
+import test.switches.Color;
+
+import java.io.*;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Checks the manipulation of switch constructs
+ */
+public class TestSwitches {
+
+
+ @Test
+ public void testSwitchOnInteger() throws IOException, ClassNotFoundException, IllegalAccessException, InstantiationException, NoSuchMethodException, InvocationTargetException {
+ Manipulator manipulator = new Manipulator();
+ byte[] clazz = manipulator.manipulate(getBytesFromFile(new File
+ ("target/test-classes/test/switches/Switches.class")));
+ ManipulatedClassLoader classloader = new ManipulatedClassLoader("test.switches.Switches", clazz);
+
+ ClassReader reader = new ClassReader(clazz);
+ CheckClassAdapter.verify(reader, false, new PrintWriter(new File("/tmp/class_dump")));
+
+ Class cl = classloader.findClass("test.switches.Switches");
+ Object o = cl.newInstance();
+
+ Method method = cl.getMethod("switchOnInteger", new Class[] { Integer.TYPE});
+ int zero = (Integer) method.invoke(o, 0);
+ int one = (Integer) method.invoke(o, 1);
+ int two = (Integer) method.invoke(o, 2);
+ int three = (Integer) method.invoke(o, 4);
+
+ Assert.assertEquals(zero, 0);
+ Assert.assertEquals(one, 1);
+ Assert.assertEquals(two, 2);
+ Assert.assertEquals(three, 3);
+ }
+
+ @Test
+ public void testSwitchOnEnum() throws IOException, ClassNotFoundException, IllegalAccessException,
+ InstantiationException, NoSuchMethodException, InvocationTargetException {
+ Manipulator manipulator = new Manipulator();
+ byte[] clazz = manipulator.manipulate(getBytesFromFile(new File
+ ("target/test-classes/test/switches/Switches.class")));
+ ManipulatedClassLoader classloader = new ManipulatedClassLoader("test.switches.Switches", clazz);
+ Map<String, byte[]> inners = new HashMap<String, byte[]>();
+
+ inners.put("test.switches.Switches$1", getBytesFromFile(new File
+ ("target/test-classes/test/switches/Switches$1.class")));
+ classloader.addInnerClasses(inners);
+
+ FileUtils.writeByteArrayToFile(new File("target/Switches.class"), clazz);
+
+ Class cl = classloader.findClass("test.switches.Switches");
+ Object o = cl.newInstance();
+
+ Method method = cl.getMethod("switchOnEnum", new Class[] { Color.class});
+ int one = (Integer) method.invoke(o, Color.RED);
+ int two = (Integer) method.invoke(o, Color.GREEN);
+ int three = (Integer) method.invoke(o, Color.BLUE);
+
+ Assert.assertEquals(one, 1);
+ Assert.assertEquals(two, 2);
+ Assert.assertEquals(three, 3);
+ }
+
+ public static byte[] getBytesFromFile(File file) throws IOException {
+ InputStream is = new FileInputStream(file);
+ long length = file.length();
+ byte[] bytes = new byte[(int)length];
+
+ // Read in the bytes
+ int offset = 0;
+ int numRead = 0;
+ while (offset < bytes.length
+ && (numRead=is.read(bytes, offset, bytes.length-offset)) >= 0) {
+ offset += numRead;
+ }
+
+ // Ensure all the bytes have been read in
+ if (offset < bytes.length) {
+ throw new IOException("Could not completely read file "+file.getName());
+ }
+
+ // Close the input stream and return bytes
+ is.close();
+ return bytes;
+ }
+}
diff --git a/ipojo/manipulator/manipulator/src/test/java/test/PojoWithInner.java b/ipojo/manipulator/manipulator/src/test/java/test/PojoWithInner.java
index 8094889..2170541 100644
--- a/ipojo/manipulator/manipulator/src/test/java/test/PojoWithInner.java
+++ b/ipojo/manipulator/manipulator/src/test/java/test/PojoWithInner.java
@@ -25,9 +25,14 @@
// This is a simple POJO
public boolean doSomething() {
+ System.out.println(new MySecondInner().i);
return m_result.getInner();
}
+ class MySecondInner {
+ int i = 0;
+ }
+
public class MyInner {
public boolean getInner() {
diff --git a/ipojo/manipulator/manipulator/src/test/java/test/switches/Color.java b/ipojo/manipulator/manipulator/src/test/java/test/switches/Color.java
new file mode 100644
index 0000000..462e742
--- /dev/null
+++ b/ipojo/manipulator/manipulator/src/test/java/test/switches/Color.java
@@ -0,0 +1,8 @@
+package test.switches;
+
+/**
+ * An enum.
+ */
+public enum Color {
+ RED, GREEN, BLUE
+}
diff --git a/ipojo/manipulator/manipulator/src/test/java/test/switches/Switches.java b/ipojo/manipulator/manipulator/src/test/java/test/switches/Switches.java
new file mode 100644
index 0000000..a4ef6cf
--- /dev/null
+++ b/ipojo/manipulator/manipulator/src/test/java/test/switches/Switches.java
@@ -0,0 +1,25 @@
+package test.switches;
+
+/**
+ * A component using switch on integers and enum.
+ */
+public class Switches {
+
+
+ public int switchOnInteger(int i) {
+ switch (i) {
+ case 0 : return 0;
+ case 1 : return 1;
+ case 2 : return 2;
+ default: return 3;
+ }
+ }
+
+ public int switchOnEnum(Color c) {
+ switch (c) {
+ case RED: return 1;
+ case GREEN: return 2;
+ default: return 3;
+ }
+ }
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestBothProperties.java b/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestBothProperties.java
index ec56790..29ef311 100644
--- a/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestBothProperties.java
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestBothProperties.java
@@ -102,8 +102,8 @@
assertEquals("Check s", s, new Short("1"));
assertEquals("Check i", i, new Integer("1"));
assertEquals("Check l", l, new Long("1"));
- assertEquals("Check d", d, new Double("1"));
- assertEquals("Check f", f, new Float("1"));
+ assertEquals("Check d", d, new Double("1"), 0);
+ assertEquals("Check f", f, new Float("1"), 0);
assertEquals("Check c", c, new Character('a'));
assertEquals("Check bool", bool, new Boolean("true"));
@@ -145,8 +145,8 @@
assertEquals("2) Check s", s, new Short("2"));
assertEquals("2) Check i", i, new Integer("2"));
assertEquals("2) Check l", l, new Long("2"));
- assertEquals("2) Check d", d, new Double("2"));
- assertEquals("2) Check f", f, new Float("2"));
+ assertEquals("2) Check d", d, new Double("2"), 0);
+ assertEquals("2) Check f", f, new Float("2"), 0);
assertEquals("2) Check c", c, new Character('b'));
assertEquals("2) Check bool", bool, new Boolean("false"));
@@ -190,8 +190,8 @@
assertEquals("Check s", s, new Short("1"));
assertEquals("Check i", i, new Integer("1"));
assertEquals("Check l", l, new Long("1"));
- assertEquals("Check d", d, new Double("1"));
- assertEquals("Check f", f, new Float("1"));
+ assertEquals("Check d", d, new Double("1"), 0);
+ assertEquals("Check f", f, new Float("1"), 0);
assertEquals("Check c", c, new Character('a'));
assertEquals("Check bool", bool, new Boolean("true"));
@@ -233,8 +233,8 @@
assertEquals("2) Check s", s, new Short("2"));
assertEquals("2) Check i", i, new Integer("2"));
assertEquals("2) Check l", l, new Long("2"));
- assertEquals("2) Check d", d, new Double("2"));
- assertEquals("2) Check f", f, new Float("2"));
+ assertEquals("2) Check d", d, new Double("2"), 0);
+ assertEquals("2) Check f", f, new Float("2"), 0);
assertEquals("2) Check c", c, new Character('b'));
assertEquals("2) Check bool", bool, new Boolean("false"));
@@ -286,9 +286,9 @@
assertEquals("Check l 0", l[0], 1);
assertEquals("Check l 1", l[1], 2);
assertEquals("Check l 2", l[2], 3);
- assertEquals("Check d 0", d[0], 1.0);
- assertEquals("Check d 1", d[1], 2.0);
- assertEquals("Check d 2", d[2], 3.0);
+ assertEquals("Check d 0", d[0], 1.0, 0);
+ assertEquals("Check d 1", d[1], 2.0, 0);
+ assertEquals("Check d 2", d[2], 3.0, 0);
assertEquals("Check f 0", f[0], 1.0, 0);
assertEquals("Check f 1", f[1], 2.0, 0);
assertEquals("Check f 2", f[2], 3.0, 0);
@@ -345,9 +345,9 @@
assertEquals("2) Check l 0", l[0], 3);
assertEquals("2) Check l 1", l[1], 2);
assertEquals("2) Check l 2", l[2], 1);
- assertEquals("2) Check d 0", d[0], 3.0);
- assertEquals("2) Check d 1", d[1], 2.0);
- assertEquals("2) Check d 2", d[2], 1.0);
+ assertEquals("2) Check d 0", d[0], 3.0, 0);
+ assertEquals("2) Check d 1", d[1], 2.0, 0);
+ assertEquals("2) Check d 2", d[2], 1.0, 0);
assertEquals("2) Check f 0", f[0], 3.0, 0);
assertEquals("2) Check f 1", f[1], 2.0, 0);
assertEquals("2) Check f 2", f[2], 1.0, 0);
@@ -406,9 +406,9 @@
assertEquals("Check l 0", l[0], 1);
assertEquals("Check l 1", l[1], 2);
assertEquals("Check l 2", l[2], 3);
- assertEquals("Check d 0", d[0], 1.0);
- assertEquals("Check d 1", d[1], 2.0);
- assertEquals("Check d 2", d[2], 3.0);
+ assertEquals("Check d 0", d[0], 1.0, 0);
+ assertEquals("Check d 1", d[1], 2.0, 0);
+ assertEquals("Check d 2", d[2], 3.0, 0);
assertEquals("Check f 0", f[0], 1, 0);
assertEquals("Check f 1", f[1], 2, 0);
assertEquals("Check f 2", f[2], 3, 0);
@@ -465,9 +465,9 @@
assertEquals("2) Check l 0", l[0], 3);
assertEquals("2) Check l 1", l[1], 2);
assertEquals("2) Check l 2", l[2], 1);
- assertEquals("2) Check d 0", d[0], 3.0);
- assertEquals("2) Check d 1", d[1], 2.0);
- assertEquals("2) Check d 2", d[2], 1.0);
+ assertEquals("2) Check d 0", d[0], 3.0, 0);
+ assertEquals("2) Check d 1", d[1], 2.0, 0);
+ assertEquals("2) Check d 2", d[2], 1.0, 0);
assertEquals("2) Check f 0", f[0], 3, 0);
assertEquals("2) Check f 1", f[1], 2, 0);
assertEquals("2) Check f 2", f[2], 1, 0);
@@ -652,8 +652,8 @@
assertEquals("Check s", s, new Short("0"));
assertEquals("Check i", i, new Integer("0"));
assertEquals("Check l", l, new Long("0"));
- assertEquals("Check d", d, new Double("0"));
- assertEquals("Check f", f, new Float("0"));
+ assertEquals("Check d", d, new Double("0"), 0);
+ assertEquals("Check f", f, new Float("0"), 0);
assertEquals("Check c", c, new Character((char) 0));
assertEquals("Check bool", bool, new Boolean(false));
@@ -695,8 +695,8 @@
assertEquals("2) Check s", s, new Short("2"));
assertEquals("2) Check i", i, new Integer("2"));
assertEquals("2) Check l", l, new Long("2"));
- assertEquals("2) Check d", d, new Double("2"));
- assertEquals("2) Check f", f, new Float("2"));
+ assertEquals("2) Check d", d, new Double("2"), 0);
+ assertEquals("2) Check f", f, new Float("2"), 0);
assertEquals("2) Check c", c, new Character('b'));
assertEquals("2) Check bool", bool, new Boolean("false"));
@@ -791,9 +791,9 @@
assertEquals("2) Check l 0", l[0], 3);
assertEquals("2) Check l 1", l[1], 2);
assertEquals("2) Check l 2", l[2], 1);
- assertEquals("2) Check d 0", d[0], 3.0);
- assertEquals("2) Check d 1", d[1], 2.0);
- assertEquals("2) Check d 2", d[2], 1.0);
+ assertEquals("2) Check d 0", d[0], 3.0, 0);
+ assertEquals("2) Check d 1", d[1], 2.0, 0);
+ assertEquals("2) Check d 2", d[2], 1.0, 0);
assertEquals("2) Check f 0", f[0], 3, 0);
assertEquals("2) Check f 1", f[1], 2, 0);
assertEquals("2) Check f 2", f[2], 1, 0);
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-service-dependency-optional-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/di/TestDelayedOptionalDependencies.java b/ipojo/runtime/core-it/src/it/ipojo-core-service-dependency-optional-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/di/TestDelayedOptionalDependencies.java
index 93b6291..838a2f7 100644
--- a/ipojo/runtime/core-it/src/it/ipojo-core-service-dependency-optional-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/di/TestDelayedOptionalDependencies.java
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-service-dependency-optional-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/di/TestDelayedOptionalDependencies.java
@@ -119,7 +119,7 @@
assertNotNull("Check FS invocation (object) - 1", props.get("object"));
assertEquals("Check FS invocation (int) - 1", ((Integer) props.get("int")).intValue(), 1);
assertEquals("Check FS invocation (long) - 1", ((Long) props.get("long")).longValue(), 1);
- assertEquals("Check FS invocation (double) - 1", ((Double) props.get("double")).doubleValue(), 1.0);
+ assertEquals("Check FS invocation (double) - 1", ((Double) props.get("double")).doubleValue(), 1.0, 0);
fooProvider.stop();
@@ -142,7 +142,7 @@
assertNull("Check FS invocation (object) - 2", props.get("object"));
assertEquals("Check FS invocation (int) - 2", ((Integer) props.get("int")).intValue(), 5);
assertEquals("Check FS invocation (long) - 2", ((Long) props.get("long")).longValue(), 5);
- assertEquals("Check FS invocation (double) - 2", ((Double) props.get("double")).doubleValue(), 5.0);
+ assertEquals("Check FS invocation (double) - 2", ((Double) props.get("double")).doubleValue(), 5.0, 0);
id = null;
cs = null;
@@ -177,7 +177,7 @@
assertNotNull("Check FS invocation (object) - 1", props.get("object"));
assertEquals("Check FS invocation (int) - 1", ((Integer) props.get("int")).intValue(), 1);
assertEquals("Check FS invocation (long) - 1", ((Long) props.get("long")).longValue(), 1);
- assertEquals("Check FS invocation (double) - 1", ((Double) props.get("double")).doubleValue(), 1.0);
+ assertEquals("Check FS invocation (double) - 1", ((Double) props.get("double")).doubleValue(), 1.0, 0);
fooProvider.stop();
@@ -200,7 +200,7 @@
assertNull("Check FS invocation (object) - 2", props.get("object"));
assertEquals("Check FS invocation (int) - 2", ((Integer) props.get("int")).intValue(), 5);
assertEquals("Check FS invocation (long) - 2", ((Long) props.get("long")).longValue(), 5);
- assertEquals("Check FS invocation (double) - 2", ((Double) props.get("double")).doubleValue(), 5.0);
+ assertEquals("Check FS invocation (double) - 2", ((Double) props.get("double")).doubleValue(), 5.0, 0);
id = null;
cs = null;
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-service-dependency-policies/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/policies/TestStaticMultipleDependencies.java b/ipojo/runtime/core-it/src/it/ipojo-core-service-dependency-policies/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/policies/TestStaticMultipleDependencies.java
index a24591e..e1c36e8 100644
--- a/ipojo/runtime/core-it/src/it/ipojo-core-service-dependency-policies/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/policies/TestStaticMultipleDependencies.java
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-service-dependency-policies/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/policies/TestStaticMultipleDependencies.java
@@ -114,7 +114,7 @@
assertEquals("check ref unbind callback invocation - 1", ((Integer) props.get("refU")).intValue(), 0);
assertEquals("Check FS invocation (int) - 1", ((Integer) props.get("int")).intValue(), 1);
assertEquals("Check FS invocation (long) - 1", ((Long) props.get("long")).longValue(), 1);
- assertEquals("Check FS invocation (double) - 1", ((Double) props.get("double")).doubleValue(), 1.0);
+ assertEquals("Check FS invocation (double) - 1", ((Double) props.get("double")).doubleValue(), 1.0, 0);
fooProvider2.start();
ipojoHelper.getServiceReferenceByName(Architecture.class.getName(), instance1.getInstanceName());
@@ -133,7 +133,7 @@
assertEquals("check ref unbind callback invocation - 2", ((Integer) props.get("refU")).intValue(), 0);
assertEquals("Check FS invocation (int) - 2", ((Integer) props.get("int")).intValue(), 1);
assertEquals("Check FS invocation (long) - 2", ((Long) props.get("long")).longValue(), 1);
- assertEquals("Check FS invocation (double) - 2", ((Double) props.get("double")).doubleValue(), 1.0);
+ assertEquals("Check FS invocation (double) - 2", ((Double) props.get("double")).doubleValue(), 1.0, 0);
fooProvider1.stop();
// instance is stopped and then restarted, so bound to fooprovider 2.
@@ -173,7 +173,7 @@
assertEquals("check ref unbind callback invocation - 1", ((Integer) props.get("refU")).intValue(), 0);
assertEquals("Check FS invocation (int) - 1", ((Integer) props.get("int")).intValue(), 1);
assertEquals("Check FS invocation (long) - 1", ((Long) props.get("long")).longValue(), 1);
- assertEquals("Check FS invocation (double) - 1", ((Double) props.get("double")).doubleValue(), 1.0);
+ assertEquals("Check FS invocation (double) - 1", ((Double) props.get("double")).doubleValue(), 1.0, 0);
fooProvider2.start();
id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
@@ -191,7 +191,7 @@
assertEquals("check ref unbind callback invocation - 2", ((Integer) props.get("refU")).intValue(), 0);
assertEquals("Check FS invocation (int) - 2", ((Integer) props.get("int")).intValue(), 1);
assertEquals("Check FS invocation (long) - 2", ((Long) props.get("long")).longValue(), 1);
- assertEquals("Check FS invocation (double) - 2", ((Double) props.get("double")).doubleValue(), 1.0);
+ assertEquals("Check FS invocation (double) - 2", ((Double) props.get("double")).doubleValue(), 1.0, 0);
fooProvider1.stop();
@@ -231,7 +231,7 @@
assertEquals("check ref unbind callback invocation - 1", ((Integer) props.get("refU")).intValue(), 0);
assertEquals("Check FS invocation (int) - 1", ((Integer) props.get("int")).intValue(), 1);
assertEquals("Check FS invocation (long) - 1", ((Long) props.get("long")).longValue(), 1);
- assertEquals("Check FS invocation (double) - 1", ((Double) props.get("double")).doubleValue(), 1.0);
+ assertEquals("Check FS invocation (double) - 1", ((Double) props.get("double")).doubleValue(), 1.0, 0);
fooProvider2.start();
id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
@@ -249,7 +249,7 @@
assertEquals("check ref unbind callback invocation - 2", ((Integer) props.get("refU")).intValue(), 0);
assertEquals("Check FS invocation (int) - 2", ((Integer) props.get("int")).intValue(), 1);
assertEquals("Check FS invocation (long) - 2", ((Long) props.get("long")).longValue(), 1);
- assertEquals("Check FS invocation (double) - 2", ((Double) props.get("double")).doubleValue(), 1.0);
+ assertEquals("Check FS invocation (double) - 2", ((Double) props.get("double")).doubleValue(), 1.0, 0);
fooProvider1.stop();
// Instance stopped and then restarted, bound to foo provider 2.
@@ -289,7 +289,7 @@
assertEquals("check ref unbind callback invocation - 1", ((Integer) props.get("refU")).intValue(), 0);
assertEquals("Check FS invocation (int) - 1", ((Integer) props.get("int")).intValue(), 1);
assertEquals("Check FS invocation (long) - 1", ((Long) props.get("long")).longValue(), 1);
- assertEquals("Check FS invocation (double) - 1", ((Double) props.get("double")).doubleValue(), 1.0);
+ assertEquals("Check FS invocation (double) - 1", ((Double) props.get("double")).doubleValue(), 1.0, 0);
fooProvider2.start();
id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
@@ -307,7 +307,7 @@
assertEquals("check ref unbind callback invocation - 2", ((Integer) props.get("refU")).intValue(), 0);
assertEquals("Check FS invocation (int) - 2", ((Integer) props.get("int")).intValue(), 1);
assertEquals("Check FS invocation (long) - 2", ((Long) props.get("long")).longValue(), 1);
- assertEquals("Check FS invocation (double) - 2", ((Double) props.get("double")).doubleValue(), 1.0);
+ assertEquals("Check FS invocation (double) - 2", ((Double) props.get("double")).doubleValue(), 1.0, 0);
fooProvider1.stop();
// Stop and then restarted, bound to foo provider 2.