Add compatibility tests against Equinox Declarative Services 1.4.100

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1524322 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/ipojo/runtime/core-it/ipojo-compatibility-test/src/test/java/org/apache/felix/ipojo/test/compatibility/Common.java b/ipojo/runtime/core-it/ipojo-compatibility-test/src/test/java/org/apache/felix/ipojo/test/compatibility/Common.java
index c51f593..161ea5e 100644
--- a/ipojo/runtime/core-it/ipojo-compatibility-test/src/test/java/org/apache/felix/ipojo/test/compatibility/Common.java
+++ b/ipojo/runtime/core-it/ipojo-compatibility-test/src/test/java/org/apache/felix/ipojo/test/compatibility/Common.java
@@ -30,6 +30,7 @@
 import org.ops4j.pax.tinybundles.core.TinyBundles;
 import org.osgi.framework.Constants;
 import org.ow2.chameleon.testing.helpers.BaseTest;
+import org.ow2.chameleon.testing.helpers.FrameworkHelper;
 import org.ow2.chameleon.testing.tinybundles.ipojo.IPOJOStrategy;
 
 import java.io.*;
@@ -294,4 +295,8 @@
             return null;
         }
     }
+
+    public boolean isEquinox() {
+        return FrameworkHelper.isEquinox(context)  || context.toString().contains("eclipse");
+    }
 }
diff --git a/ipojo/runtime/core-it/ipojo-compatibility-test/src/test/java/org/apache/felix/ipojo/test/compatibility/TestBeingConsumedByEquinoxSCR1_4_100.java b/ipojo/runtime/core-it/ipojo-compatibility-test/src/test/java/org/apache/felix/ipojo/test/compatibility/TestBeingConsumedByEquinoxSCR1_4_100.java
new file mode 100644
index 0000000..2f7afa5
--- /dev/null
+++ b/ipojo/runtime/core-it/ipojo-compatibility-test/src/test/java/org/apache/felix/ipojo/test/compatibility/TestBeingConsumedByEquinoxSCR1_4_100.java
@@ -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.test.compatibility;
+
+import org.apache.felix.ipojo.test.compatibility.service.CheckService;
+import org.junit.Test;
+import org.ops4j.pax.exam.Option;
+
+import static org.fest.assertions.Assertions.assertThat;
+import static org.ops4j.pax.exam.CoreOptions.bundle;
+
+/**
+ * Check a configuration using Equinox SCR 1.4.100 (Declarative Services).
+ * iPOJO provider is consumed by a component using SCR.
+ *
+ *
+ * This test is intended to pass on Equinox only.
+ */
+public class TestBeingConsumedByEquinoxSCR1_4_100 extends Common {
+
+    public static String DS_URL = "http://www.dynamis-technologies.com/ipojo/bundles/org.eclipse.equinox.ds_1.4.100" +
+            ".v20130515-2026.jar";
+
+    public static String UTILS_URL = "http://www.dynamis-technologies.com/ipojo/bundles/org.eclipse.equinox.util_1.0" +
+            ".500.v20130404-1337.jar";
+
+    @Override
+    public Option[] bundles() {
+        return new Option[] {
+                bundle(DS_URL),
+                bundle(UTILS_URL),
+                iPOJOHelloProvider(),
+                SCRHelloConsumer()
+        };
+    }
+
+    @Test
+    public void test() {
+        if (! isEquinox()) {
+            System.out.println("Test executed on Equinox only");
+            return;
+        }
+        CheckService checker = osgiHelper.getServiceObject(CheckService.class);
+        assertThat(checker).isNotNull();
+        assertThat(checker.data().get("result")).isEqualTo("hello john doe");
+    }
+}
diff --git a/ipojo/runtime/core-it/ipojo-compatibility-test/src/test/java/org/apache/felix/ipojo/test/compatibility/TestConsumingProviderUsingEquinoxSCR1_4_100.java b/ipojo/runtime/core-it/ipojo-compatibility-test/src/test/java/org/apache/felix/ipojo/test/compatibility/TestConsumingProviderUsingEquinoxSCR1_4_100.java
new file mode 100644
index 0000000..63f3c98
--- /dev/null
+++ b/ipojo/runtime/core-it/ipojo-compatibility-test/src/test/java/org/apache/felix/ipojo/test/compatibility/TestConsumingProviderUsingEquinoxSCR1_4_100.java
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.ipojo.test.compatibility;
+
+import org.apache.felix.ipojo.test.compatibility.service.CheckService;
+import org.junit.Test;
+import org.ops4j.pax.exam.Option;
+
+import static org.fest.assertions.Assertions.assertThat;
+import static org.ops4j.pax.exam.CoreOptions.bundle;
+import static org.ops4j.pax.exam.CoreOptions.maven;
+
+/**
+ * Check a configuration using Equinox SCR 1.4.100 (Declarative Services).
+ * iPOJO consumer is bound to a Hello Service implementation using SCR.
+ *
+ *
+ * This test is intended to pass on Equinox only.
+ */
+public class TestConsumingProviderUsingEquinoxSCR1_4_100 extends Common {
+
+    public static String DS_URL = "http://www.dynamis-technologies.com/ipojo/bundles/org.eclipse.equinox.ds_1.4.100" +
+            ".v20130515-2026.jar";
+
+    public static String UTILS_URL = "http://www.dynamis-technologies.com/ipojo/bundles/org.eclipse.equinox.util_1.0" +
+            ".500.v20130404-1337.jar";
+
+    @Override
+    public Option[] bundles() {
+        return new Option[] {
+                bundle(DS_URL),
+                bundle(UTILS_URL),
+                SCRHelloProvider(),
+                iPOJOHelloConsumer()
+        };
+    }
+
+    @Test
+    public void test() {
+        if (! isEquinox()) {
+            System.out.println("Test executed on Equinox only");
+            return;
+        }
+        CheckService checker = osgiHelper.getServiceObject(CheckService.class);
+        assertThat(checker).isNotNull();
+        assertThat(checker.data().get("result")).isEqualTo("hello john doe");
+    }
+}