Split the iPOJO test suite in several bundles.
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@651646 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/ipojo/tests/tests.core.service.providing/pom.xml b/ipojo/tests/tests.core.service.providing/pom.xml
new file mode 100644
index 0000000..ad48a52
--- /dev/null
+++ b/ipojo/tests/tests.core.service.providing/pom.xml
@@ -0,0 +1,102 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <packaging>bundle</packaging>
+ <name>iPOJO Service Providing Test Suite</name>
+ <artifactId>tests.core.ps</artifactId>
+ <groupId>ipojo.tests</groupId>
+ <version>0.7.6-SNAPSHOT</version>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.ipojo</artifactId>
+ <version>0.7.6-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.ipojo.metadata</artifactId>
+ <version>0.7.6-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <version>1.0.0</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ </dependency>
+ <dependency>
+ <groupId>ipojo.examples</groupId>
+ <artifactId>org.apache.felix.ipojo.junit4osgi</artifactId>
+ <version>0.7.6-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <version>1.4.0</version>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Export-Package>
+ org.apache.felix.ipojo.test.scenarios.ps.service
+ </Export-Package>
+ <Bundle-SymbolicName>
+ ${pom.artifactId}
+ </Bundle-SymbolicName>
+ <Private-Package>
+ org.apache.felix.ipojo.test*
+ </Private-Package>
+ <Test-Suite>
+ org.apache.felix.ipojo.test.scenarios.ps.ProvidedServiceTestSuite
+ </Test-Suite>
+ </instructions>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-ipojo-plugin</artifactId>
+ <version>0.7.6-SNAPSHOT</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>ipojo-bundle</goal>
+ </goals>
+ <configuration>
+ <ignoreAnnotations>true</ignoreAnnotations>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.4</source>
+ <target>1.4</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/ipojo/tests/tests.core.service.providing/src/main/java/org/apache/felix/ipojo/test/scenarios/component/CheckProviderParentClass.java b/ipojo/tests/tests.core.service.providing/src/main/java/org/apache/felix/ipojo/test/scenarios/component/CheckProviderParentClass.java
new file mode 100644
index 0000000..cef0891
--- /dev/null
+++ b/ipojo/tests/tests.core.service.providing/src/main/java/org/apache/felix/ipojo/test/scenarios/component/CheckProviderParentClass.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.ipojo.test.scenarios.component;
+
+import org.apache.felix.ipojo.test.scenarios.ps.service.FooService;
+import org.osgi.framework.ServiceReference;
+
+public abstract class CheckProviderParentClass {
+
+ int simpleU = 0;
+ int objectU = 0;
+ int refU = 0;
+ int bothU = 0;
+
+
+ public void bothUnbind(FooService o, ServiceReference sr) {
+ if(sr != null && o != null && o instanceof FooService) { bothU++; }
+ }
+
+ public void refUnbind(ServiceReference sr) {
+ if(sr != null) { refU++; }
+ }
+
+ public void objectUnbind(FooService o) {
+ if(o != null && o instanceof FooService) { objectU++; }
+ else {
+ System.err.println("Unbind null : " + o);
+ }
+ }
+
+ public void voidUnbind() {
+ simpleU++;
+ }
+
+}
diff --git a/ipojo/tests/tests.core.service.providing/src/main/java/org/apache/felix/ipojo/test/scenarios/component/CheckServiceProvider.java b/ipojo/tests/tests.core.service.providing/src/main/java/org/apache/felix/ipojo/test/scenarios/component/CheckServiceProvider.java
new file mode 100644
index 0000000..a41f977
--- /dev/null
+++ b/ipojo/tests/tests.core.service.providing/src/main/java/org/apache/felix/ipojo/test/scenarios/component/CheckServiceProvider.java
@@ -0,0 +1,83 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.ipojo.test.scenarios.component;
+
+import java.util.Properties;
+
+import org.apache.felix.ipojo.test.scenarios.ps.service.CheckService;
+import org.apache.felix.ipojo.test.scenarios.ps.service.FooService;
+import org.osgi.framework.ServiceReference;
+
+public class CheckServiceProvider extends CheckProviderParentClass implements CheckService {
+
+ FooService fs;
+
+ int simpleB = 0;
+ int objectB = 0;
+ int refB = 0;
+ int bothB = 0;
+
+ public boolean check() {
+ return fs.foo();
+ }
+
+ public Properties getProps() {
+ Properties props = new Properties();
+ 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));
+ if (fs != null) {
+ props.put("result", new Boolean(fs.foo()));
+ props.put("boolean", new Boolean(fs.getBoolean()));
+ props.put("int", new Integer(fs.getInt()));
+ props.put("long", new Long(fs.getLong()));
+ props.put("double", new Double(fs.getDouble()));
+ if(fs.getObject() != null) { props.put("object", fs.getObject()); }
+ }
+ props.put("static", CheckService.foo);
+ props.put("class", CheckService.class.getName());
+ return props;
+ }
+
+ private void voidBind() {
+ simpleB++;
+ }
+
+ protected void objectBind(FooService o) {
+ if (o == null) {
+ System.err.println("Bind receive null !!! ");
+ return;
+ }
+ if(o != null && o instanceof FooService) { objectB++; }
+ }
+
+ public void refBind(ServiceReference sr) {
+ if(sr != null) { refB++; }
+ }
+
+ public void bothBind(FooService o, ServiceReference sr) {
+ if(sr != null && o != null && o instanceof FooService) { bothB++; }
+ }
+
+}
diff --git a/ipojo/tests/tests.core.service.providing/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FooBarProviderType1.java b/ipojo/tests/tests.core.service.providing/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FooBarProviderType1.java
new file mode 100644
index 0000000..5fbac9f
--- /dev/null
+++ b/ipojo/tests/tests.core.service.providing/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FooBarProviderType1.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.ipojo.test.scenarios.component;
+
+import java.util.Properties;
+
+import org.apache.felix.ipojo.test.scenarios.ps.service.BarService;
+import org.apache.felix.ipojo.test.scenarios.ps.service.FooService;
+
+public class FooBarProviderType1 implements FooService, BarService {
+
+ public boolean foo() {
+ return true;
+ }
+
+ public Properties fooProps() {
+ return new Properties();
+ }
+
+ public boolean bar() {
+ return true;
+ }
+
+ public Properties getProps() {
+ return new Properties();
+ }
+
+ public boolean getBoolean() { return true; }
+
+ public double getDouble() { return 1.0; }
+
+ public int getInt() { return 1; }
+
+ public long getLong() { return 1; }
+
+ public Boolean getObject() { return new Boolean(true); }
+
+}
diff --git a/ipojo/tests/tests.core.service.providing/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FooProviderType1.java b/ipojo/tests/tests.core.service.providing/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FooProviderType1.java
new file mode 100644
index 0000000..6abb0b1
--- /dev/null
+++ b/ipojo/tests/tests.core.service.providing/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FooProviderType1.java
@@ -0,0 +1,117 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.ipojo.test.scenarios.component;
+
+import java.util.Properties;
+
+import org.apache.felix.ipojo.test.scenarios.ps.service.FooService;
+import org.osgi.framework.BundleContext;
+
+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;
+ }
+
+}
diff --git a/ipojo/tests/tests.core.service.providing/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FooProviderTypeDyn.java b/ipojo/tests/tests.core.service.providing/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FooProviderTypeDyn.java
new file mode 100644
index 0000000..a83cd7a
--- /dev/null
+++ b/ipojo/tests/tests.core.service.providing/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FooProviderTypeDyn.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.scenarios.component;
+
+import java.util.Properties;
+
+import org.apache.felix.ipojo.test.scenarios.ps.service.FooService;
+
+
+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); }
+
+}
diff --git a/ipojo/tests/tests.core.service.providing/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FooProviderTypeDyn2.java b/ipojo/tests/tests.core.service.providing/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FooProviderTypeDyn2.java
new file mode 100644
index 0000000..40f6698
--- /dev/null
+++ b/ipojo/tests/tests.core.service.providing/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FooProviderTypeDyn2.java
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.ipojo.test.scenarios.component;
+
+import java.util.Properties;
+
+import org.apache.felix.ipojo.test.scenarios.ps.service.FooService;
+
+public class FooProviderTypeDyn2 implements FooService {
+
+ private int intProp = 2;
+ private boolean boolProp = true;
+ private String strProp = "foo";
+ private String[] strAProp = new String[] {"foo", "bar"};
+ private int[] intAProp = new int[] {1, 2, 3};
+
+ public boolean foo() {
+ intAProp = null;
+ 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); }
+
+}
diff --git a/ipojo/tests/tests.core.service.providing/src/main/java/org/apache/felix/ipojo/test/scenarios/component/inherited/ProcessImplementation1.java b/ipojo/tests/tests.core.service.providing/src/main/java/org/apache/felix/ipojo/test/scenarios/component/inherited/ProcessImplementation1.java
new file mode 100644
index 0000000..46488a8
--- /dev/null
+++ b/ipojo/tests/tests.core.service.providing/src/main/java/org/apache/felix/ipojo/test/scenarios/component/inherited/ProcessImplementation1.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.ipojo.test.scenarios.component.inherited;
+
+import org.apache.felix.ipojo.test.scenarios.ps.service.ChildInterface;
+
+public class ProcessImplementation1 implements ChildInterface {
+
+ public void processChild() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void processParent1() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void processParentParent() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void processParent2() {
+ // TODO Auto-generated method stub
+
+ }
+
+}
diff --git a/ipojo/tests/tests.core.service.providing/src/main/java/org/apache/felix/ipojo/test/scenarios/component/inherited/ProcessImplementation2.java b/ipojo/tests/tests.core.service.providing/src/main/java/org/apache/felix/ipojo/test/scenarios/component/inherited/ProcessImplementation2.java
new file mode 100644
index 0000000..49e9267
--- /dev/null
+++ b/ipojo/tests/tests.core.service.providing/src/main/java/org/apache/felix/ipojo/test/scenarios/component/inherited/ProcessImplementation2.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.ipojo.test.scenarios.component.inherited;
+
+
+public class ProcessImplementation2 extends ProcessParentImplementation {
+
+ public void processChild() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void processParent1() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void processParentParent() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void processParent2() {
+ // TODO Auto-generated method stub
+
+ }
+
+}
diff --git a/ipojo/tests/tests.core.service.providing/src/main/java/org/apache/felix/ipojo/test/scenarios/component/inherited/ProcessImplementation3.java b/ipojo/tests/tests.core.service.providing/src/main/java/org/apache/felix/ipojo/test/scenarios/component/inherited/ProcessImplementation3.java
new file mode 100644
index 0000000..d59adbd
--- /dev/null
+++ b/ipojo/tests/tests.core.service.providing/src/main/java/org/apache/felix/ipojo/test/scenarios/component/inherited/ProcessImplementation3.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.ipojo.test.scenarios.component.inherited;
+
+import java.util.Properties;
+
+import org.apache.felix.ipojo.test.scenarios.ps.service.FooService;
+
+public class ProcessImplementation3 extends ProcessParentImplementation implements FooService {
+
+ public void processChild() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void processParent1() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void processParentParent() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void processParent2() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public boolean foo() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public Properties fooProps() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public boolean getBoolean() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public double getDouble() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ public int getInt() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ public long getLong() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ public Boolean getObject() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
diff --git a/ipojo/tests/tests.core.service.providing/src/main/java/org/apache/felix/ipojo/test/scenarios/component/inherited/ProcessParentImplementation.java b/ipojo/tests/tests.core.service.providing/src/main/java/org/apache/felix/ipojo/test/scenarios/component/inherited/ProcessParentImplementation.java
new file mode 100644
index 0000000..4872be4
--- /dev/null
+++ b/ipojo/tests/tests.core.service.providing/src/main/java/org/apache/felix/ipojo/test/scenarios/component/inherited/ProcessParentImplementation.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.ipojo.test.scenarios.component.inherited;
+
+import org.apache.felix.ipojo.test.scenarios.ps.service.ChildInterface;
+
+public class ProcessParentImplementation implements ChildInterface {
+
+ public void processChild() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void processParent1() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void processParentParent() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void processParent2() {
+ // TODO Auto-generated method stub
+
+ }
+
+
+}
diff --git a/ipojo/tests/tests.core.service.providing/src/main/java/org/apache/felix/ipojo/test/scenarios/ps/DynamicProps.java b/ipojo/tests/tests.core.service.providing/src/main/java/org/apache/felix/ipojo/test/scenarios/ps/DynamicProps.java
new file mode 100644
index 0000000..4437f1b
--- /dev/null
+++ b/ipojo/tests/tests.core.service.providing/src/main/java/org/apache/felix/ipojo/test/scenarios/ps/DynamicProps.java
@@ -0,0 +1,231 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.ipojo.test.scenarios.ps;
+
+import java.util.Properties;
+
+import org.apache.felix.ipojo.ComponentInstance;
+import org.apache.felix.ipojo.junit4osgi.OSGiTestCase;
+import org.apache.felix.ipojo.test.scenarios.ps.service.FooService;
+import org.apache.felix.ipojo.test.scenarios.util.Utils;
+import org.osgi.framework.ServiceReference;
+
+public class DynamicProps extends OSGiTestCase {
+
+ ComponentInstance fooProvider1;
+ ComponentInstance fooProvider2;
+ ComponentInstance fooProvider3;
+
+ public void setUp() {
+ String type = "PS-FooProviderType-Dyn";
+
+ Properties p1 = new Properties();
+ p1.put("name", "FooProvider-1");
+ fooProvider1 = Utils.getComponentInstance(context, type, p1);
+
+ Properties p2 = new Properties();
+ p2.put("name", "FooProvider-2");
+ p2.put("int", new Integer(4));
+ p2.put("boolean", new Boolean(false));
+ p2.put("string", new String("bar"));
+ p2.put("strAProp", new String[] {"bar", "foo"});
+ p2.put("intAProp", new int[] {1, 2, 3});
+ fooProvider2 = Utils.getComponentInstance(context, type, p2);
+
+ String type2 = "PS-FooProviderType-Dyn2";
+ Properties p3 = new Properties();
+ p3.put("name", "FooProvider-3");
+ p3.put("int", new Integer(0));
+ p3.put("boolean", new Boolean(true));
+ p3.put("string", new String(""));
+ p3.put("strAProp", new String[0]);
+ p3.put("intAProp", new int[0]);
+ fooProvider3 = Utils.getComponentInstance(context, type2, p3);
+
+ }
+
+ public void tearDown() {
+ fooProvider1.dispose();
+ fooProvider1 = null;
+ fooProvider2.dispose();
+ fooProvider2 = null;
+ fooProvider3.dispose();
+ fooProvider3 = null;
+ }
+
+ public void testProperties1() {
+ ServiceReference sr = Utils.getServiceReferenceByName(context, FooService.class.getName(), "FooProvider-1");
+ assertNotNull("Check the availability of the FS service", sr);
+
+ // Check service properties
+ Integer intProp = (Integer) sr.getProperty("int");
+ Boolean boolProp = (Boolean) sr.getProperty("boolean");
+ String strProp = (String) sr.getProperty("string");
+ String[] strAProp = (String[]) sr.getProperty("strAProp");
+ int[] intAProp = (int[]) sr.getProperty("intAProp");
+
+ assertEquals("Check intProp equality (1)", intProp, new Integer(2));
+ assertEquals("Check longProp equality (1)", boolProp, new Boolean(false));
+ assertEquals("Check strProp equality (1)", strProp, new String("foo"));
+ assertNotNull("Check strAProp not nullity (1)", strAProp);
+ String[] v = new String[] {"foo", "bar"};
+ for (int i = 0; i < strAProp.length; i++) {
+ if(!strAProp[i].equals(v[i])) { fail("Check the strAProp Equality (1)"); }
+ }
+ assertNotNull("Check intAProp not nullity", intAProp);
+ int[] v2 = new int[] {1, 2, 3};
+ for (int i = 0; i < intAProp.length; i++) {
+ if(intAProp[i] != v2[i]) { fail("Check the intAProp Equality (1)"); }
+ }
+
+ // Invoke
+ FooService fs = (FooService) context.getService(sr);
+ assertTrue("invoke fs", fs.foo());
+
+ // Re-check the property (change)
+ intProp = (Integer) sr.getProperty("int");
+ boolProp = (Boolean) sr.getProperty("boolean");
+ strProp = (String) sr.getProperty("string");
+ strAProp = (String[]) sr.getProperty("strAProp");
+ intAProp = (int[]) sr.getProperty("intAProp");
+
+ assertEquals("Check intProp equality (2)", intProp, new Integer(3));
+ assertEquals("Check longProp equality (2)", boolProp, new Boolean(true));
+ assertEquals("Check strProp equality (2)", strProp, new String("bar"));
+ assertNotNull("Check strAProp not nullity (2)", strAProp);
+ v = new String[] {"foo", "bar", "baz"};
+ for (int i = 0; i < strAProp.length; i++) {
+ if(!strAProp[i].equals(v[i])) { fail("Check the strAProp Equality (2)"); }
+ }
+ assertNotNull("Check intAProp not nullity (2)", intAProp);
+ v2 = new int[] {3, 2, 1};
+ for (int i = 0; i < intAProp.length; i++) {
+ if(intAProp[i] != v2[i]) { fail("Check the intAProp Equality (2)"); }
+ }
+
+ fs = null;
+ context.ungetService(sr);
+ }
+
+ public void testProperties2() {
+ ServiceReference sr = Utils.getServiceReferenceByName(context, FooService.class.getName(), "FooProvider-2");
+ assertNotNull("Check the availability of the FS service", sr);
+
+ // Check service properties
+ Integer intProp = (Integer) sr.getProperty("int");
+ Boolean boolProp = (Boolean) sr.getProperty("boolean");
+ String strProp = (String) sr.getProperty("string");
+ String[] strAProp = (String[]) sr.getProperty("strAProp");
+ int[] intAProp = (int[]) sr.getProperty("intAProp");
+
+ assertEquals("Check intProp equality", intProp, new Integer(4));
+ assertEquals("Check longProp equality", boolProp, new Boolean(false));
+ assertEquals("Check strProp equality", strProp, new String("bar"));
+ assertNotNull("Check strAProp not nullity", strAProp);
+ String[] v = new String[] {"bar", "foo"};
+ for (int i = 0; i < strAProp.length; i++) {
+ if(!strAProp[i].equals(v[i])) { fail("Check the strAProp Equality"); }
+ }
+ assertNotNull("Check intAProp not nullity", intAProp);
+ int[] v2 = new int[] {1, 2, 3};
+ for (int i = 0; i < intAProp.length; i++) {
+ if(intAProp[i] != v2[i]) { fail("Check the intAProp Equality"); }
+ }
+
+ // Invoke
+ FooService fs = (FooService) context.getService(sr);
+ assertTrue("invoke fs", fs.foo());
+
+ // Re-check the property (change)
+ intProp = (Integer) sr.getProperty("int");
+ boolProp = (Boolean) sr.getProperty("boolean");
+ strProp = (String) sr.getProperty("string");
+ strAProp = (String[]) sr.getProperty("strAProp");
+ intAProp = (int[]) sr.getProperty("intAProp");
+
+ assertEquals("Check intProp equality", intProp, new Integer(3));
+ assertEquals("Check longProp equality", boolProp, new Boolean(true));
+ assertEquals("Check strProp equality", strProp, new String("foo"));
+ assertNotNull("Check strAProp not nullity", strAProp);
+ v = new String[] {"foo", "bar", "baz"};
+ for (int i = 0; i < strAProp.length; i++) {
+ if(!strAProp[i].equals(v[i])) { fail("Check the strAProp Equality"); }
+ }
+ assertNotNull("Check intAProp not nullity", intAProp);
+ v2 = new int[] {3, 2, 1};
+ for (int i = 0; i < intAProp.length; i++) {
+ if(intAProp[i] != v2[i]) { fail("Check the intAProp Equality"); }
+ }
+
+ fs = null;
+ context.ungetService(sr);
+ }
+
+ public void testProperties3() {
+ ServiceReference sr = Utils.getServiceReferenceByName(context, FooService.class.getName(), "FooProvider-3");
+ assertNotNull("Check the availability of the FS service", sr);
+
+ // Check service properties
+ Integer intProp = (Integer) sr.getProperty("int");
+ Boolean boolProp = (Boolean) sr.getProperty("boolean");
+ String strProp = (String) sr.getProperty("string");
+ String[] strAProp = (String[]) sr.getProperty("strAProp");
+ int[] intAProp = (int[]) sr.getProperty("intAProp");
+
+ assertEquals("Check intProp equality", intProp, new Integer(0));
+ assertEquals("Check longProp equality", boolProp, new Boolean(true));
+ assertEquals("Check strProp equality", strProp, new String(""));
+ assertNotNull("Check strAProp not nullity", strAProp);
+ String[] v = new String[0];
+ for (int i = 0; i < strAProp.length; i++) {
+ if(!strAProp[i].equals(v[i])) { fail("Check the strAProp Equality"); }
+ }
+ assertNotNull("Check intAProp not nullity", intAProp);
+ int[] v2 = new int[0];
+ for (int i = 0; i < intAProp.length; i++) {
+ if(intAProp[i] != v2[i]) { fail("Check the intAProp Equality"); }
+ }
+
+ // Invoke
+ FooService fs = (FooService) context.getService(sr);
+ assertTrue("invoke fs", fs.foo());
+
+ // Re-check the property (change)
+ intProp = (Integer) sr.getProperty("int");
+ boolProp = (Boolean) sr.getProperty("boolean");
+ strProp = (String) sr.getProperty("string");
+ strAProp = (String[]) sr.getProperty("strAProp");
+ intAProp = (int[]) sr.getProperty("intAProp");
+
+ assertEquals("Check intProp equality", intProp, new Integer(2));
+ assertEquals("Check longProp equality", boolProp, new Boolean(true));
+ assertEquals("Check strProp equality", strProp, new String("foo"));
+ assertNotNull("Check strAProp not nullity", strAProp);
+ v = new String[] {"foo", "bar"};
+ for (int i = 0; i < strAProp.length; i++) {
+ if(!strAProp[i].equals(v[i])) { fail("Check the strAProp Equality"); }
+ }
+ assertNull("Check intAProp hidding (no value)", intAProp);
+
+ fs = null;
+ context.ungetService(sr);
+
+ }
+
+}
diff --git a/ipojo/tests/tests.core.service.providing/src/main/java/org/apache/felix/ipojo/test/scenarios/ps/DynamicPropsReconfiguration.java b/ipojo/tests/tests.core.service.providing/src/main/java/org/apache/felix/ipojo/test/scenarios/ps/DynamicPropsReconfiguration.java
new file mode 100644
index 0000000..4384b23
--- /dev/null
+++ b/ipojo/tests/tests.core.service.providing/src/main/java/org/apache/felix/ipojo/test/scenarios/ps/DynamicPropsReconfiguration.java
@@ -0,0 +1,577 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.ipojo.test.scenarios.ps;
+
+import java.util.Properties;
+
+import org.apache.felix.ipojo.ComponentInstance;
+import org.apache.felix.ipojo.Factory;
+import org.apache.felix.ipojo.junit4osgi.OSGiTestCase;
+import org.apache.felix.ipojo.test.scenarios.ps.service.FooService;
+import org.apache.felix.ipojo.test.scenarios.util.Utils;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.cm.ConfigurationException;
+import org.osgi.service.cm.ManagedServiceFactory;
+
+public class DynamicPropsReconfiguration extends OSGiTestCase {
+ ComponentInstance fooProvider3;
+
+ public void setUp() {
+ String type2 = "PS-FooProviderType-Dyn2";
+ Properties p3 = new Properties();
+ p3.put("name", "FooProvider-3");
+ p3.put("int", new Integer(0));
+ p3.put("boolean", new Boolean(true));
+ p3.put("string", new String(""));
+ p3.put("strAProp", new String[0]);
+ p3.put("intAProp", new int[0]);
+ fooProvider3 = Utils.getComponentInstance(context, type2, p3);
+ }
+
+ public void tearDown() {
+ fooProvider3.dispose();
+ fooProvider3 = null;
+ }
+
+ public void testFactoryReconf() {
+ ServiceReference sr = Utils.getServiceReferenceByName(context, FooService.class.getName(), "FooProvider-3");
+ assertNotNull("Check the availability of the FS service", sr);
+
+ // Check service properties
+ Integer intProp = (Integer) sr.getProperty("int");
+ Boolean boolProp = (Boolean) sr.getProperty("boolean");
+ String strProp = (String) sr.getProperty("string");
+ String[] strAProp = (String[]) sr.getProperty("strAProp");
+ int[] intAProp = (int[]) sr.getProperty("intAProp");
+
+ assertEquals("Check intProp equality", intProp, new Integer(0));
+ assertEquals("Check longProp equality", boolProp, new Boolean(true));
+ assertEquals("Check strProp equality", strProp, new String(""));
+ assertNotNull("Check strAProp not nullity", strAProp);
+ String[] v = new String[0];
+ for (int i = 0; i < strAProp.length; i++) {
+ if(!strAProp[i].equals(v[i])) { fail("Check the strAProp Equality"); }
+ }
+ assertNotNull("Check intAProp not nullity", intAProp);
+ int[] v2 = new int[0];
+ for (int i = 0; i < intAProp.length; i++) {
+ if(intAProp[i] != v2[i]) { fail("Check the intAProp Equality"); }
+ }
+
+ // Reconfiguration
+ ServiceReference fact_ref = Utils.getServiceReferenceByName(context, Factory.class.getName() , "PS-FooProviderType-Dyn2");
+ Factory fact = (Factory) context.getService(fact_ref);
+ Properties p3 = new Properties();
+ p3.put("name", "FooProvider-3");
+ p3.put("int", new Integer(1));
+ p3.put("boolean", new Boolean(true));
+ p3.put("string", new String("foo"));
+ p3.put("strAProp", new String[] {"foo", "bar", "baz"});
+ p3.put("intAProp", new int[] { 1, 2, 3});
+ try {
+ fact.reconfigure(p3);
+ } catch(Exception e) {
+ fail("Unable to reconfigure the instance with : " + p3);
+ }
+
+ sr = Utils.getServiceReferenceByName(context, FooService.class.getName(), "FooProvider-3");
+ assertNotNull("Check the availability of the FS service", sr);
+
+ // Check service properties
+ intProp = (Integer) sr.getProperty("int");
+ boolProp = (Boolean) sr.getProperty("boolean");
+ strProp = (String) sr.getProperty("string");
+ strAProp = (String[]) sr.getProperty("strAProp");
+ intAProp = (int[]) sr.getProperty("intAProp");
+
+ assertEquals("Check intProp equality", intProp, new Integer(1));
+ assertEquals("Check longProp equality", boolProp, new Boolean(true));
+ assertEquals("Check strProp equality", strProp, new String("foo"));
+ assertNotNull("Check strAProp not nullity", strAProp);
+ v = new String[] {"foo", "bar", "baz"};
+ for (int i = 0; i < strAProp.length; i++) {
+ if(!strAProp[i].equals(v[i])) { fail("Check the strAProp Equality"); }
+ }
+ assertNotNull("Check intAProp not nullity", intAProp);
+ v2 = new int[] { 1, 2, 3};
+ for (int i = 0; i < intAProp.length; i++) {
+ if(intAProp[i] != v2[i]) { fail("Check the intAProp Equality"); }
+ }
+
+ // Invoke
+ FooService fs = (FooService) context.getService(sr);
+ assertTrue("invoke fs", fs.foo());
+
+ // Re-check the property (change)
+ intProp = (Integer) sr.getProperty("int");
+ boolProp = (Boolean) sr.getProperty("boolean");
+ strProp = (String) sr.getProperty("string");
+ strAProp = (String[]) sr.getProperty("strAProp");
+ intAProp = (int[]) sr.getProperty("intAProp");
+
+ assertEquals("Check intProp equality", intProp, new Integer(2));
+ assertEquals("Check longProp equality", boolProp, new Boolean(true));
+ assertEquals("Check strProp equality", strProp, new String("foo"));
+ assertNotNull("Check strAProp not nullity", strAProp);
+ v = new String[] {"foo", "bar"};
+ for (int i = 0; i < strAProp.length; i++) {
+ if(!strAProp[i].equals(v[i])) { fail("Check the strAProp Equality"); }
+ }
+ assertNull("Check intAProp hidding (no value)", intAProp);
+
+ // Reconfiguration
+ fact_ref = Utils.getServiceReferenceByName(context, Factory.class.getName() , "PS-FooProviderType-Dyn2");
+ fact = (Factory) context.getService(fact_ref);
+ p3 = new Properties();
+ p3.put("name", "FooProvider-3");
+ p3.put("int", new Integer(1));
+ p3.put("boolean", new Boolean(true));
+ p3.put("string", new String("foo"));
+ p3.put("strAProp", new String[] {"foo", "bar", "baz"});
+ p3.put("intAProp", new int[] { 1, 2, 3});
+ try {
+ fact.reconfigure(p3);
+ } catch(Exception e) {
+ fail("Unable to reconfigure the instance with : " + p3);
+ }
+
+ sr = Utils.getServiceReferenceByName(context, FooService.class.getName(), "FooProvider-3");
+ assertNotNull("Check the availability of the FS service", sr);
+
+ // Check service properties
+ intProp = (Integer) sr.getProperty("int");
+ boolProp = (Boolean) sr.getProperty("boolean");
+ strProp = (String) sr.getProperty("string");
+ strAProp = (String[]) sr.getProperty("strAProp");
+ intAProp = (int[]) sr.getProperty("intAProp");
+
+ assertEquals("Check intProp equality", intProp, new Integer(1));
+ assertEquals("Check longProp equality", boolProp, new Boolean(true));
+ assertEquals("Check strProp equality", strProp, new String("foo"));
+ assertNotNull("Check strAProp not nullity", strAProp);
+ v = new String[] {"foo", "bar", "baz"};
+ for (int i = 0; i < strAProp.length; i++) {
+ if(!strAProp[i].equals(v[i])) { fail("Check the strAProp Equality"); }
+ }
+ assertNotNull("Check intAProp not nullity", intAProp);
+ v2 = new int[] { 1, 2, 3};
+ for (int i = 0; i < intAProp.length; i++) {
+ if(intAProp[i] != v2[i]) { fail("Check the intAProp Equality"); }
+ }
+
+ fact = null;
+ context.ungetService(fact_ref);
+ fs = null;
+ context.ungetService(sr);
+ }
+
+ public void testFactoryReconfString() {
+ ServiceReference sr = Utils.getServiceReferenceByName(context, FooService.class.getName(), "FooProvider-3");
+ assertNotNull("Check the availability of the FS service", sr);
+
+ // Check service properties
+ Integer intProp = (Integer) sr.getProperty("int");
+ Boolean boolProp = (Boolean) sr.getProperty("boolean");
+ String strProp = (String) sr.getProperty("string");
+ String[] strAProp = (String[]) sr.getProperty("strAProp");
+ int[] intAProp = (int[]) sr.getProperty("intAProp");
+
+ assertEquals("Check intProp equality", intProp, new Integer(0));
+ assertEquals("Check longProp equality", boolProp, new Boolean(true));
+ assertEquals("Check strProp equality", strProp, new String(""));
+ assertNotNull("Check strAProp not nullity", strAProp);
+ String[] v = new String[0];
+ for (int i = 0; i < strAProp.length; i++) {
+ if(!strAProp[i].equals(v[i])) { fail("Check the strAProp Equality"); }
+ }
+ assertNotNull("Check intAProp not nullity", intAProp);
+ int[] v2 = new int[0];
+ for (int i = 0; i < intAProp.length; i++) {
+ if(intAProp[i] != v2[i]) { fail("Check the intAProp Equality"); }
+ }
+
+ // Reconfiguration
+ ServiceReference fact_ref = Utils.getServiceReferenceByName(context, Factory.class.getName() , "PS-FooProviderType-Dyn2");
+ Factory fact = (Factory) context.getService(fact_ref);
+ Properties p3 = new Properties();
+ p3.put("name", "FooProvider-3");
+ p3.put("int", "1");
+ p3.put("boolean", "true");
+ p3.put("string", "foo");
+ p3.put("strAProp", "{foo, bar, baz}");
+ p3.put("intAProp", "{1, 2, 3}");
+ try {
+ fact.reconfigure(p3);
+ } catch(Exception e) {
+ fail("Unable to reconfigure the instance with : " + p3);
+ }
+
+ sr = Utils.getServiceReferenceByName(context, FooService.class.getName(), "FooProvider-3");
+ assertNotNull("Check the availability of the FS service", sr);
+
+ // Check service properties
+ intProp = (Integer) sr.getProperty("int");
+ boolProp = (Boolean) sr.getProperty("boolean");
+ strProp = (String) sr.getProperty("string");
+ strAProp = (String[]) sr.getProperty("strAProp");
+ intAProp = (int[]) sr.getProperty("intAProp");
+
+ assertEquals("Check intProp equality", intProp, new Integer(1));
+ assertEquals("Check longProp equality", boolProp, new Boolean(true));
+ assertEquals("Check strProp equality", strProp, new String("foo"));
+ assertNotNull("Check strAProp not nullity", strAProp);
+ v = new String[] {"foo", "bar", "baz"};
+ for (int i = 0; i < strAProp.length; i++) {
+ if(!strAProp[i].equals(v[i])) { fail("Check the strAProp Equality"); }
+ }
+ assertNotNull("Check intAProp not nullity", intAProp);
+ v2 = new int[] { 1, 2, 3};
+ for (int i = 0; i < intAProp.length; i++) {
+ if(intAProp[i] != v2[i]) { fail("Check the intAProp Equality"); }
+ }
+
+ // Invoke
+ FooService fs = (FooService) context.getService(sr);
+ assertTrue("invoke fs", fs.foo());
+
+ // Re-check the property (change)
+ intProp = (Integer) sr.getProperty("int");
+ boolProp = (Boolean) sr.getProperty("boolean");
+ strProp = (String) sr.getProperty("string");
+ strAProp = (String[]) sr.getProperty("strAProp");
+ intAProp = (int[]) sr.getProperty("intAProp");
+
+ assertEquals("Check intProp equality", intProp, new Integer(2));
+ assertEquals("Check longProp equality", boolProp, new Boolean(true));
+ assertEquals("Check strProp equality", strProp, new String("foo"));
+ assertNotNull("Check strAProp not nullity", strAProp);
+ v = new String[] {"foo", "bar"};
+ for (int i = 0; i < strAProp.length; i++) {
+ if(!strAProp[i].equals(v[i])) { fail("Check the strAProp Equality"); }
+ }
+ assertNull("Check intAProp hidding (no value)", intAProp);
+
+ // Reconfiguration
+ fact_ref = Utils.getServiceReferenceByName(context, Factory.class.getName() , "PS-FooProviderType-Dyn2");
+ fact = (Factory) context.getService(fact_ref);
+ p3 = new Properties();
+ p3.put("name", "FooProvider-3");
+ p3.put("int", "1");
+ p3.put("boolean", "true");
+ p3.put("string", "foo");
+ p3.put("strAProp", "{foo, bar, baz}");
+ p3.put("intAProp", "{ 1, 2, 3}");
+ try {
+ fact.reconfigure(p3);
+ } catch(Exception e) {
+ fail("Unable to reconfigure the instance with : " + p3);
+ }
+
+ sr = Utils.getServiceReferenceByName(context, FooService.class.getName(), "FooProvider-3");
+ assertNotNull("Check the availability of the FS service", sr);
+
+ // Check service properties
+ intProp = (Integer) sr.getProperty("int");
+ boolProp = (Boolean) sr.getProperty("boolean");
+ strProp = (String) sr.getProperty("string");
+ strAProp = (String[]) sr.getProperty("strAProp");
+ intAProp = (int[]) sr.getProperty("intAProp");
+
+ assertEquals("Check intProp equality", intProp, new Integer(1));
+ assertEquals("Check longProp equality", boolProp, new Boolean(true));
+ assertEquals("Check strProp equality", strProp, new String("foo"));
+ assertNotNull("Check strAProp not nullity", strAProp);
+ v = new String[] {"foo", "bar", "baz"};
+ for (int i = 0; i < strAProp.length; i++) {
+ if(!strAProp[i].equals(v[i])) { fail("Check the strAProp Equality"); }
+ }
+ assertNotNull("Check intAProp not nullity", intAProp);
+ v2 = new int[] { 1, 2, 3};
+ for (int i = 0; i < intAProp.length; i++) {
+ if(intAProp[i] != v2[i]) { fail("Check the intAProp Equality"); }
+ }
+
+ fact = null;
+ context.ungetService(fact_ref);
+ fs = null;
+ context.ungetService(sr);
+ }
+
+ public void testMSFReconf() {
+ ServiceReference sr = Utils.getServiceReferenceByName(context, FooService.class.getName(), "FooProvider-3");
+ assertNotNull("Check the availability of the FS service", sr);
+
+ // Check service properties
+ Integer intProp = (Integer) sr.getProperty("int");
+ Boolean boolProp = (Boolean) sr.getProperty("boolean");
+ String strProp = (String) sr.getProperty("string");
+ String[] strAProp = (String[]) sr.getProperty("strAProp");
+ int[] intAProp = (int[]) sr.getProperty("intAProp");
+
+ assertEquals("Check intProp equality", intProp, new Integer(0));
+ assertEquals("Check longProp equality", boolProp, new Boolean(true));
+ assertEquals("Check strProp equality", strProp, new String(""));
+ assertNotNull("Check strAProp not nullity", strAProp);
+ String[] v = new String[0];
+ for (int i = 0; i < strAProp.length; i++) {
+ if(!strAProp[i].equals(v[i])) { fail("Check the strAProp Equality"); }
+ }
+ assertNotNull("Check intAProp not nullity", intAProp);
+ int[] v2 = new int[0];
+ for (int i = 0; i < intAProp.length; i++) {
+ if(intAProp[i] != v2[i]) { fail("Check the intAProp Equality"); }
+ }
+
+ // Reconfiguration
+ ServiceReference fact_ref = Utils.getServiceReferenceByName(context, ManagedServiceFactory.class.getName() , "PS-FooProviderType-Dyn2");
+ ManagedServiceFactory fact = (ManagedServiceFactory) context.getService(fact_ref);
+ Properties p3 = new Properties();
+ p3.put("int", new Integer(1));
+ p3.put("boolean", new Boolean(true));
+ p3.put("string", new String("foo"));
+ p3.put("strAProp", new String[] {"foo", "bar", "baz"});
+ p3.put("intAProp", new int[] { 1, 2, 3});
+ try {
+ fact.updated("FooProvider-3", p3);
+ } catch (ConfigurationException e) {
+ fail("Unable to reconfigure the instance with : " + p3);
+ }
+
+ sr = Utils.getServiceReferenceByName(context, FooService.class.getName(), "FooProvider-3");
+ assertNotNull("Check the availability of the FS service", sr);
+
+ // Check service properties
+ intProp = (Integer) sr.getProperty("int");
+ boolProp = (Boolean) sr.getProperty("boolean");
+ strProp = (String) sr.getProperty("string");
+ strAProp = (String[]) sr.getProperty("strAProp");
+ intAProp = (int[]) sr.getProperty("intAProp");
+
+ assertEquals("Check intProp equality", intProp, new Integer(1));
+ assertEquals("Check longProp equality", boolProp, new Boolean(true));
+ assertEquals("Check strProp equality", strProp, new String("foo"));
+ assertNotNull("Check strAProp not nullity", strAProp);
+ v = new String[] {"foo", "bar", "baz"};
+ for (int i = 0; i < strAProp.length; i++) {
+ if(!strAProp[i].equals(v[i])) { fail("Check the strAProp Equality"); }
+ }
+ assertNotNull("Check intAProp not nullity", intAProp);
+ v2 = new int[] { 1, 2, 3};
+ for (int i = 0; i < intAProp.length; i++) {
+ if(intAProp[i] != v2[i]) { fail("Check the intAProp Equality"); }
+ }
+
+ // Invoke
+ FooService fs = (FooService) context.getService(sr);
+ assertTrue("invoke fs", fs.foo());
+
+ // Re-check the property (change)
+ intProp = (Integer) sr.getProperty("int");
+ boolProp = (Boolean) sr.getProperty("boolean");
+ strProp = (String) sr.getProperty("string");
+ strAProp = (String[]) sr.getProperty("strAProp");
+ intAProp = (int[]) sr.getProperty("intAProp");
+
+ assertEquals("Check intProp equality", intProp, new Integer(2));
+ assertEquals("Check longProp equality", boolProp, new Boolean(true));
+ assertEquals("Check strProp equality", strProp, new String("foo"));
+ assertNotNull("Check strAProp not nullity", strAProp);
+ v = new String[] {"foo", "bar"};
+ for (int i = 0; i < strAProp.length; i++) {
+ if(!strAProp[i].equals(v[i])) { fail("Check the strAProp Equality"); }
+ }
+ assertNull("Check intAProp hidding (no value)", intAProp);
+
+ // Reconfiguration
+ fact_ref = Utils.getServiceReferenceByName(context, ManagedServiceFactory.class.getName() , "PS-FooProviderType-Dyn2");
+ fact = (ManagedServiceFactory) context.getService(fact_ref);
+ p3 = new Properties();
+ p3.put("int", new Integer(1));
+ p3.put("boolean", new Boolean(true));
+ p3.put("string", new String("foo"));
+ p3.put("strAProp", new String[] {"foo", "bar", "baz"});
+ p3.put("intAProp", new int[] { 1, 2, 3});
+ try {
+ fact.updated("FooProvider-3", p3);
+ } catch (ConfigurationException e) {
+ fail("Unable to reconfigure the instance with : " + p3);
+ }
+
+ sr = Utils.getServiceReferenceByName(context, FooService.class.getName(), "FooProvider-3");
+ assertNotNull("Check the availability of the FS service", sr);
+
+ // Check service properties
+ intProp = (Integer) sr.getProperty("int");
+ boolProp = (Boolean) sr.getProperty("boolean");
+ strProp = (String) sr.getProperty("string");
+ strAProp = (String[]) sr.getProperty("strAProp");
+ intAProp = (int[]) sr.getProperty("intAProp");
+
+ assertEquals("Check intProp equality", intProp, new Integer(1));
+ assertEquals("Check longProp equality", boolProp, new Boolean(true));
+ assertEquals("Check strProp equality", strProp, new String("foo"));
+ assertNotNull("Check strAProp not nullity", strAProp);
+ v = new String[] {"foo", "bar", "baz"};
+ for (int i = 0; i < strAProp.length; i++) {
+ if(!strAProp[i].equals(v[i])) { fail("Check the strAProp Equality"); }
+ }
+ assertNotNull("Check intAProp not nullity", intAProp);
+ v2 = new int[] { 1, 2, 3};
+ for (int i = 0; i < intAProp.length; i++) {
+ if(intAProp[i] != v2[i]) { fail("Check the intAProp Equality"); }
+ }
+
+ fact = null;
+ context.ungetService(fact_ref);
+ fs = null;
+ context.ungetService(sr);
+ }
+
+ public void testMSFReconfString() {
+ ServiceReference sr = Utils.getServiceReferenceByName(context, FooService.class.getName(), "FooProvider-3");
+ assertNotNull("Check the availability of the FS service", sr);
+
+ // Check service properties
+ Integer intProp = (Integer) sr.getProperty("int");
+ Boolean boolProp = (Boolean) sr.getProperty("boolean");
+ String strProp = (String) sr.getProperty("string");
+ String[] strAProp = (String[]) sr.getProperty("strAProp");
+ int[] intAProp = (int[]) sr.getProperty("intAProp");
+
+ assertEquals("Check intProp equality", intProp, new Integer(0));
+ assertEquals("Check longProp equality", boolProp, new Boolean(true));
+ assertEquals("Check strProp equality", strProp, new String(""));
+ assertNotNull("Check strAProp not nullity", strAProp);
+ String[] v = new String[0];
+ for (int i = 0; i < strAProp.length; i++) {
+ if(!strAProp[i].equals(v[i])) { fail("Check the strAProp Equality"); }
+ }
+ assertNotNull("Check intAProp not nullity", intAProp);
+ int[] v2 = new int[0];
+ for (int i = 0; i < intAProp.length; i++) {
+ if(intAProp[i] != v2[i]) { fail("Check the intAProp Equality"); }
+ }
+
+ // Reconfiguration
+ ServiceReference fact_ref = Utils.getServiceReferenceByName(context, ManagedServiceFactory.class.getName() , "PS-FooProviderType-Dyn2");
+ ManagedServiceFactory fact = (ManagedServiceFactory) context.getService(fact_ref);
+ Properties p3 = new Properties();
+ p3.put("int", "1");
+ p3.put("boolean", "true");
+ p3.put("string", "foo");
+ p3.put("strAProp", "{foo, bar, baz}");
+ p3.put("intAProp", "{ 1, 2, 3}");
+ try {
+ fact.updated("FooProvider-3", p3);
+ } catch (ConfigurationException e) {
+ fail("Unable to reconfigure the instance with : " + p3);
+ }
+
+ sr = Utils.getServiceReferenceByName(context, FooService.class.getName(), "FooProvider-3");
+ assertNotNull("Check the availability of the FS service", sr);
+
+ // Check service properties
+ intProp = (Integer) sr.getProperty("int");
+ boolProp = (Boolean) sr.getProperty("boolean");
+ strProp = (String) sr.getProperty("string");
+ strAProp = (String[]) sr.getProperty("strAProp");
+ intAProp = (int[]) sr.getProperty("intAProp");
+
+ assertEquals("Check intProp equality", intProp, new Integer(1));
+ assertEquals("Check longProp equality", boolProp, new Boolean(true));
+ assertEquals("Check strProp equality", strProp, new String("foo"));
+ assertNotNull("Check strAProp not nullity", strAProp);
+ v = new String[] {"foo", "bar", "baz"};
+ for (int i = 0; i < strAProp.length; i++) {
+ if(!strAProp[i].equals(v[i])) { fail("Check the strAProp Equality"); }
+ }
+ assertNotNull("Check intAProp not nullity", intAProp);
+ v2 = new int[] { 1, 2, 3};
+ for (int i = 0; i < intAProp.length; i++) {
+ if(intAProp[i] != v2[i]) { fail("Check the intAProp Equality"); }
+ }
+
+ // Invoke
+ FooService fs = (FooService) context.getService(sr);
+ assertTrue("invoke fs", fs.foo());
+
+ // Re-check the property (change)
+ intProp = (Integer) sr.getProperty("int");
+ boolProp = (Boolean) sr.getProperty("boolean");
+ strProp = (String) sr.getProperty("string");
+ strAProp = (String[]) sr.getProperty("strAProp");
+ intAProp = (int[]) sr.getProperty("intAProp");
+
+ assertEquals("Check intProp equality", intProp, new Integer(2));
+ assertEquals("Check longProp equality", boolProp, new Boolean(true));
+ assertEquals("Check strProp equality", strProp, new String("foo"));
+ assertNotNull("Check strAProp not nullity", strAProp);
+ v = new String[] {"foo", "bar"};
+ for (int i = 0; i < strAProp.length; i++) {
+ if(!strAProp[i].equals(v[i])) { fail("Check the strAProp Equality"); }
+ }
+ assertNull("Check intAProp hidding (no value)", intAProp);
+
+ // Reconfiguration
+ fact_ref = Utils.getServiceReferenceByName(context, ManagedServiceFactory.class.getName() , "PS-FooProviderType-Dyn2");
+ fact = (ManagedServiceFactory) context.getService(fact_ref);
+ p3 = new Properties();
+ p3.put("int", "1");
+ p3.put("boolean", "true");
+ p3.put("string", "foo");
+ p3.put("strAProp", "{foo, bar, baz}");
+ p3.put("intAProp", "{ 1, 2, 3}");
+ try {
+ fact.updated("FooProvider-3", p3);
+ } catch (ConfigurationException e) {
+ fail("Unable to reconfigure the instance with : " + p3);
+ }
+
+ sr = Utils.getServiceReferenceByName(context, FooService.class.getName(), "FooProvider-3");
+ assertNotNull("Check the availability of the FS service", sr);
+
+ // Check service properties
+ intProp = (Integer) sr.getProperty("int");
+ boolProp = (Boolean) sr.getProperty("boolean");
+ strProp = (String) sr.getProperty("string");
+ strAProp = (String[]) sr.getProperty("strAProp");
+ intAProp = (int[]) sr.getProperty("intAProp");
+
+ assertEquals("Check intProp equality", intProp, new Integer(1));
+ assertEquals("Check longProp equality", boolProp, new Boolean(true));
+ assertEquals("Check strProp equality", strProp, new String("foo"));
+ assertNotNull("Check strAProp not nullity", strAProp);
+ v = new String[] {"foo", "bar", "baz"};
+ for (int i = 0; i < strAProp.length; i++) {
+ if(!strAProp[i].equals(v[i])) { fail("Check the strAProp Equality"); }
+ }
+ assertNotNull("Check intAProp not nullity", intAProp);
+ v2 = new int[] { 1, 2, 3};
+ for (int i = 0; i < intAProp.length; i++) {
+ if(intAProp[i] != v2[i]) { fail("Check the intAProp Equality"); }
+ }
+
+ fact = null;
+ context.ungetService(fact_ref);
+ fs = null;
+ context.ungetService(sr);
+ }
+
+
+}
diff --git a/ipojo/tests/tests.core.service.providing/src/main/java/org/apache/felix/ipojo/test/scenarios/ps/Exposition.java b/ipojo/tests/tests.core.service.providing/src/main/java/org/apache/felix/ipojo/test/scenarios/ps/Exposition.java
new file mode 100644
index 0000000..69dca5d
--- /dev/null
+++ b/ipojo/tests/tests.core.service.providing/src/main/java/org/apache/felix/ipojo/test/scenarios/ps/Exposition.java
@@ -0,0 +1,193 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.ipojo.test.scenarios.ps;
+
+import java.util.Properties;
+
+import org.apache.felix.ipojo.ComponentInstance;
+import org.apache.felix.ipojo.junit4osgi.OSGiTestCase;
+import org.apache.felix.ipojo.test.scenarios.ps.service.BarService;
+import org.apache.felix.ipojo.test.scenarios.ps.service.FooService;
+import org.apache.felix.ipojo.test.scenarios.util.Utils;
+import org.osgi.framework.ServiceReference;
+
+public class Exposition extends OSGiTestCase {
+
+ private ComponentInstance fooProviderSimple;
+ private ComponentInstance fooProviderItf;
+ private ComponentInstance fooBarProvider;
+ private ComponentInstance fooBarProvider2;
+ private ComponentInstance fooBarProvider3;
+
+ public void setUp(){
+ Properties p1 = new Properties();
+ p1.put("name", "fooProviderSimple");
+ fooProviderSimple = Utils.getComponentInstance(context, "PS-FooProviderType-1", p1);
+
+ Properties p2 = new Properties();
+ p2.put("name", "fooProviderItf");
+ fooProviderItf = Utils.getComponentInstance(context, "PS-FooProviderType-itf", p2);
+
+ Properties p3 = new Properties();
+ p3.put("name", "fooProviderItfs");
+ fooBarProvider = Utils.getComponentInstance(context, "PS-FooBarProviderType-1", p3);
+
+ Properties p4 = new Properties();
+ p4.put("name", "fooProviderItfs2");
+ fooBarProvider2 = Utils.getComponentInstance(context, "PS-FooBarProviderType-2", p4);
+
+ Properties p5 = new Properties();
+ p5.put("name", "fooProviderItfs3");
+ fooBarProvider3 = Utils.getComponentInstance(context, "PS-FooBarProviderType-3", p5);
+
+ assertNotNull("Check the instance creation of fooProviderSimple", fooProviderSimple);
+ assertNotNull("Check the instance creation of fooProviderItf", fooProviderItf);
+ assertNotNull("Check the instance creation of fooProviderItfs", fooBarProvider);
+ assertNotNull("Check the instance creation of fooProviderItfs2", fooBarProvider2);
+ assertNotNull("Check the instance creation of fooProviderItfs3", fooBarProvider3);
+
+ }
+
+ public void tearDown() {
+ fooProviderSimple.dispose();
+ fooProviderItf.dispose();
+ fooBarProvider.dispose();
+ fooBarProvider2.dispose();
+ fooBarProvider3.dispose();
+ fooProviderSimple = null;
+ fooProviderItf = null;
+ fooBarProvider = null;
+ fooBarProvider2 = null;
+ fooBarProvider3 = null;
+ }
+
+ public void testSimpleExposition() {
+ ServiceReference ref = Utils.getServiceReferenceByName(context, FooService.class.getName(), fooProviderSimple.getInstanceName());
+ assertNotNull("Check the availability of the FS from "+fooProviderSimple.getInstanceName(), ref);
+ FooService fs = (FooService) context.getService(ref);
+ assertTrue("Check fs invocation", fs.foo());
+ fs = null;
+ context.ungetService(ref);
+ fooProviderSimple.stop();
+ ref = Utils.getServiceReferenceByName(context, FooService.class.getName(), fooProviderSimple.getInstanceName());
+ assertNull("Check the absence of the FS from "+fooProviderSimple.getInstanceName(), ref);
+
+ }
+
+ public void testItfExposition() {
+ ServiceReference ref = Utils.getServiceReferenceByName(context, FooService.class.getName(), fooProviderItf.getInstanceName());
+ assertNotNull("Check the availability of the FS from "+fooProviderItf.getInstanceName(), ref);
+ FooService fs = (FooService) context.getService(ref);
+ assertTrue("Check fs invocation", fs.foo());
+ fs = null;
+ context.ungetService(ref);
+ fooProviderItf.stop();
+
+ ref = Utils.getServiceReferenceByName(context, FooService.class.getName(), fooProviderItf.getInstanceName());
+ assertNull("Check the absence of the FS from "+fooProviderItf.getInstanceName(), ref);
+ }
+
+ public void testItfsExposition() {
+ ServiceReference refFoo = Utils.getServiceReferenceByName(context, FooService.class.getName(), fooBarProvider.getInstanceName());
+ assertNotNull("Check the availability of the FS from "+fooBarProvider.getInstanceName(), refFoo);
+ ServiceReference refBar = Utils.getServiceReferenceByName(context, BarService.class.getName(), fooBarProvider.getInstanceName());
+ assertNotNull("Check the availability of the BS from "+fooBarProvider.getInstanceName(), refBar);
+
+ assertSame("Check service reference equality", refFoo, refBar);
+
+ FooService fs = (FooService) context.getService(refFoo);
+ assertTrue("Check fs invocation", fs.foo());
+ fs = null;
+ context.ungetService(refFoo);
+
+ BarService bs = (BarService) context.getService(refBar);
+ assertTrue("Check bs invocation", bs.bar());
+ bs = null;
+ context.ungetService(refBar);
+
+ fooBarProvider.stop();
+
+ refFoo = Utils.getServiceReferenceByName(context, FooService.class.getName(), fooBarProvider.getInstanceName());
+ refBar = Utils.getServiceReferenceByName(context, BarService.class.getName(), fooBarProvider.getInstanceName());
+ assertNull("Check the absence of the FS from "+fooBarProvider.getInstanceName(), refFoo);
+ assertNull("Check the absence of the BS from "+fooBarProvider.getInstanceName(), refBar);
+ }
+
+ public void testItfsExposition2() {
+ ServiceReference refFoo = Utils.getServiceReferenceByName(context, FooService.class.getName(), fooBarProvider2.getInstanceName());
+ assertNotNull("Check the availability of the FS from "+fooBarProvider2.getInstanceName(), refFoo);
+ ServiceReference refBar = Utils.getServiceReferenceByName(context, BarService.class.getName(), fooBarProvider2.getInstanceName());
+ assertNotNull("Check the availability of the BS from "+fooBarProvider2.getInstanceName(), refBar);
+
+ assertSame("Check service reference equality", refFoo, refBar);
+
+ FooService fs = (FooService) context.getService(refFoo);
+ assertTrue("Check fs invocation", fs.foo());
+ fs = null;
+ context.ungetService(refFoo);
+
+ BarService bs = (BarService) context.getService(refBar);
+ assertTrue("Check bs invocation", bs.bar());
+ bs = null;
+ context.ungetService(refBar);
+
+ fooBarProvider2.stop();
+
+ refFoo = Utils.getServiceReferenceByName(context, FooService.class.getName(), fooBarProvider2.getInstanceName());
+ refBar = Utils.getServiceReferenceByName(context, BarService.class.getName(), fooBarProvider2.getInstanceName());
+ assertNull("Check the absence of the FS from "+fooBarProvider.getInstanceName(), refFoo);
+ assertNull("Check the absence of the BS from "+fooBarProvider.getInstanceName(), refBar);
+ }
+
+ public void testItfsExposition3() {
+ ServiceReference refFoo = Utils.getServiceReferenceByName(context, FooService.class.getName(), fooBarProvider3.getInstanceName());
+ assertNotNull("Check the availability of the FS from "+fooBarProvider3.getInstanceName(), refFoo);
+ ServiceReference refBar = Utils.getServiceReferenceByName(context, BarService.class.getName(), fooBarProvider3.getInstanceName());
+ assertNotNull("Check the availability of the BS from "+fooBarProvider3.getInstanceName(), refBar);
+
+ assertNotSame("Check service reference inequality", refFoo, refBar);
+
+ FooService fs = (FooService) context.getService(refFoo);
+ assertTrue("Check fs invocation", fs.foo());
+ fs = null;
+ context.ungetService(refFoo);
+
+ BarService bs = (BarService) context.getService(refBar);
+ assertTrue("Check bs invocation", bs.bar());
+ bs = null;
+ context.ungetService(refBar);
+
+ // Check properties
+ String baz1 = (String) refFoo.getProperty("baz");
+ String baz2 = (String) refBar.getProperty("baz");
+
+ assertEquals("Check Baz Property 1", baz1, "foo");
+ assertEquals("Check Baz Property 2", baz2, "bar");
+
+ fooBarProvider3.stop();
+
+ refFoo = Utils.getServiceReferenceByName(context, FooService.class.getName(), fooBarProvider3.getInstanceName());
+ refBar = Utils.getServiceReferenceByName(context, BarService.class.getName(), fooBarProvider3.getInstanceName());
+ assertNull("Check the absence of the FS from "+fooBarProvider.getInstanceName(), refFoo);
+ assertNull("Check the absence of the BS from "+fooBarProvider.getInstanceName(), refBar);
+ }
+
+
+
+}
diff --git a/ipojo/tests/tests.core.service.providing/src/main/java/org/apache/felix/ipojo/test/scenarios/ps/InheritedTest.java b/ipojo/tests/tests.core.service.providing/src/main/java/org/apache/felix/ipojo/test/scenarios/ps/InheritedTest.java
new file mode 100644
index 0000000..0653496
--- /dev/null
+++ b/ipojo/tests/tests.core.service.providing/src/main/java/org/apache/felix/ipojo/test/scenarios/ps/InheritedTest.java
@@ -0,0 +1,193 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.ipojo.test.scenarios.ps;
+
+import org.apache.felix.ipojo.ComponentInstance;
+import org.apache.felix.ipojo.Factory;
+import org.apache.felix.ipojo.junit4osgi.OSGiTestCase;
+import org.apache.felix.ipojo.test.scenarios.ps.service.ChildInterface;
+import org.apache.felix.ipojo.test.scenarios.ps.service.FooService;
+import org.apache.felix.ipojo.test.scenarios.ps.service.ParentInterface1;
+import org.apache.felix.ipojo.test.scenarios.ps.service.ParentInterface2;
+import org.apache.felix.ipojo.test.scenarios.ps.service.ParentParentInterface;
+import org.apache.felix.ipojo.test.scenarios.util.Utils;
+import org.osgi.framework.ServiceReference;
+
+public class InheritedTest extends OSGiTestCase {
+
+ private Factory pi1, pi11, pi12, pi2, pi21, pi3;
+
+ public void setUp() {
+ pi1 = Utils.getFactoryByName(context, "PS-PI1");
+ pi11 = Utils.getFactoryByName(context, "PS-PI1-1");
+ pi12 = Utils.getFactoryByName(context, "PS-PI1-2");
+
+ pi2 = Utils.getFactoryByName(context, "PS-PI2");
+ pi21 = Utils.getFactoryByName(context, "PS-PI2-1");
+
+ pi3 = Utils.getFactoryByName(context, "PS-PI3");
+ }
+
+ private boolean contains(String[] arr, String txt) {
+ for (int i = 0; i < arr.length; i++) {
+ if (arr[i].equals(txt)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public void testPI1Factory() {
+ String[] specs = pi1.getComponentDescription().getprovidedServiceSpecification();
+ assertEquals("Check provides count", specs.length, 4);
+ assertTrue("Check Child", contains(specs, ChildInterface.class.getName()));
+ assertTrue("Check Parent1", contains(specs, ParentInterface1.class.getName()));
+ assertTrue("Check Parent2", contains(specs, ParentInterface2.class.getName()));
+ assertTrue("Check ParentParent", contains(specs, ParentParentInterface.class.getName()));
+ }
+
+ public void testPI11Factory() {
+ String[] specs = pi11.getComponentDescription().getprovidedServiceSpecification();
+ assertEquals("Check provides count", specs.length, 1);
+ assertTrue("Check ParentParent", contains(specs, ParentParentInterface.class.getName()));
+ }
+
+ public void testPI12Factory() {
+ String[] specs = pi12.getComponentDescription().getprovidedServiceSpecification();
+ assertEquals("Check provides count", specs.length, 2);
+ assertTrue("Check Parent2", contains(specs, ParentInterface2.class.getName()));
+ assertTrue("Check ParentParent", contains(specs, ParentParentInterface.class.getName()));
+ }
+
+ public void testPI2Factory() {
+ String[] specs = pi2.getComponentDescription().getprovidedServiceSpecification();
+ assertEquals("Check provides count ("+specs.length+")", specs.length, 4);
+ assertTrue("Check Child", contains(specs, ChildInterface.class.getName()));
+ assertTrue("Check Parent1", contains(specs, ParentInterface1.class.getName()));
+ assertTrue("Check Parent2", contains(specs, ParentInterface2.class.getName()));
+ assertTrue("Check ParentParent", contains(specs, ParentParentInterface.class.getName()));
+ }
+
+ public void testPI21Factory() {
+ String[] specs = pi21.getComponentDescription().getprovidedServiceSpecification();
+ assertEquals("Check provides count", specs.length, 1);
+ assertTrue("Check ParentParent", contains(specs, ParentParentInterface.class.getName()));
+ }
+
+ public void testPI3Factory() {
+ String[] specs = pi3.getComponentDescription().getprovidedServiceSpecification();
+ assertEquals("Check provides count", specs.length, 5);
+ assertTrue("Check Child", contains(specs, ChildInterface.class.getName()));
+ assertTrue("Check Parent1", contains(specs, ParentInterface1.class.getName()));
+ assertTrue("Check Parent2", contains(specs, ParentInterface2.class.getName()));
+ assertTrue("Check ParentParent", contains(specs, ParentParentInterface.class.getName()));
+ assertTrue("Check FS", contains(specs, FooService.class.getName()));
+ }
+
+ public void testIP1() {
+ ComponentInstance ci = Utils.getComponentInstanceByName(context, pi1.getName(), "ci");
+
+ ServiceReference ref1 = Utils.getServiceReferenceByName(context, ChildInterface.class.getName(), "ci");
+ assertNotNull("Check Child", ref1);
+
+ ServiceReference ref2 = Utils.getServiceReferenceByName(context, ParentInterface1.class.getName(), "ci");
+ assertNotNull("Check Parent1", ref2);
+
+ ServiceReference ref3 = Utils.getServiceReferenceByName(context, ParentInterface2.class.getName(), "ci");
+ assertNotNull("Check Parent2", ref3);
+
+ ServiceReference ref4 = Utils.getServiceReferenceByName(context, ParentParentInterface.class.getName(), "ci");
+ assertNotNull("Check PP", ref4);
+
+ ci.dispose();
+ }
+
+ public void testIP11() {
+ ComponentInstance ci = Utils.getComponentInstanceByName(context, pi11.getName(), "ci");
+
+ ServiceReference ref4 = Utils.getServiceReferenceByName(context, ParentParentInterface.class.getName(), "ci");
+ assertNotNull("Check PP", ref4);
+
+ ci.dispose();
+ }
+
+ public void testIP12() {
+ ComponentInstance ci = Utils.getComponentInstanceByName(context, pi12.getName(), "ci");
+
+ ServiceReference ref3 = Utils.getServiceReferenceByName(context, ParentInterface2.class.getName(), "ci");
+ assertNotNull("Check Parent2", ref3);
+
+ ServiceReference ref4 = Utils.getServiceReferenceByName(context, ParentParentInterface.class.getName(), "ci");
+ assertNotNull("Check PP", ref4);
+
+ ci.dispose();
+ }
+
+ public void testIP2() {
+ ComponentInstance ci = Utils.getComponentInstanceByName(context, pi2.getName(), "ci");
+
+ ServiceReference ref1 = Utils.getServiceReferenceByName(context, ChildInterface.class.getName(), "ci");
+ assertNotNull("Check Child", ref1);
+
+ ServiceReference ref2 = Utils.getServiceReferenceByName(context, ParentInterface1.class.getName(), "ci");
+ assertNotNull("Check Parent1", ref2);
+
+ ServiceReference ref3 = Utils.getServiceReferenceByName(context, ParentInterface2.class.getName(), "ci");
+ assertNotNull("Check Parent2", ref3);
+
+ ServiceReference ref4 = Utils.getServiceReferenceByName(context, ParentParentInterface.class.getName(), "ci");
+ assertNotNull("Check PP", ref4);
+
+ ci.dispose();
+ }
+
+ public void testIP21() {
+ ComponentInstance ci = Utils.getComponentInstanceByName(context, pi21.getName(), "ci");
+
+ ServiceReference ref4 = Utils.getServiceReferenceByName(context, ParentParentInterface.class.getName(), "ci");
+ assertNotNull("Check PP", ref4);
+
+ ci.dispose();
+ }
+
+ public void testIP3() {
+ ComponentInstance ci = Utils.getComponentInstanceByName(context, pi3.getName(), "ci");
+
+ ServiceReference ref1 = Utils.getServiceReferenceByName(context, ChildInterface.class.getName(), "ci");
+ assertNotNull("Check Child", ref1);
+
+ ServiceReference ref2 = Utils.getServiceReferenceByName(context, ParentInterface1.class.getName(), "ci");
+ assertNotNull("Check Parent1", ref2);
+
+ ServiceReference ref3 = Utils.getServiceReferenceByName(context, ParentInterface2.class.getName(), "ci");
+ assertNotNull("Check Parent2", ref3);
+
+ ServiceReference ref4 = Utils.getServiceReferenceByName(context, ParentParentInterface.class.getName(), "ci");
+ assertNotNull("Check PP", ref4);
+
+ ServiceReference ref5 = Utils.getServiceReferenceByName(context, FooService.class.getName(), "ci");
+ assertNotNull("Check FS", ref5);
+
+ ci.dispose();
+ }
+
+
+
+
+}
diff --git a/ipojo/tests/tests.core.service.providing/src/main/java/org/apache/felix/ipojo/test/scenarios/ps/ProvidedServiceArchitectureTest.java b/ipojo/tests/tests.core.service.providing/src/main/java/org/apache/felix/ipojo/test/scenarios/ps/ProvidedServiceArchitectureTest.java
new file mode 100644
index 0000000..21627d3
--- /dev/null
+++ b/ipojo/tests/tests.core.service.providing/src/main/java/org/apache/felix/ipojo/test/scenarios/ps/ProvidedServiceArchitectureTest.java
@@ -0,0 +1,199 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.ipojo.test.scenarios.ps;
+
+import java.util.Properties;
+
+import org.apache.felix.ipojo.ComponentInstance;
+import org.apache.felix.ipojo.Factory;
+import org.apache.felix.ipojo.architecture.Architecture;
+import org.apache.felix.ipojo.architecture.HandlerDescription;
+import org.apache.felix.ipojo.architecture.InstanceDescription;
+import org.apache.felix.ipojo.handlers.providedservice.ProvidedServiceDescription;
+import org.apache.felix.ipojo.handlers.providedservice.ProvidedServiceHandlerDescription;
+import org.apache.felix.ipojo.junit4osgi.OSGiTestCase;
+import org.apache.felix.ipojo.test.scenarios.ps.service.BarService;
+import org.apache.felix.ipojo.test.scenarios.ps.service.FooService;
+import org.apache.felix.ipojo.test.scenarios.util.Utils;
+import org.osgi.framework.ServiceReference;
+
+public class ProvidedServiceArchitectureTest extends OSGiTestCase {
+
+
+ public void testExposition() {
+ String factName = "PS-FooProviderType-1";
+ String compName = "FooProvider-1";
+
+ // Get the factory to create a component instance
+ Factory fact = Utils.getFactoryByName(context, factName);
+ assertNotNull("Cannot find the factory FooProvider-1", fact);
+
+ Properties props = new Properties();
+ props.put("name", compName);
+ ComponentInstance ci = null;
+ try {
+ ci = fact.createComponentInstance(props);
+ } catch (Exception e) {
+ fail(e.getMessage());
+ }
+
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), "FooProvider-1");
+ assertNotNull("Architecture not available", arch_ref);
+
+ Architecture arch = (Architecture) context.getService(arch_ref);
+ InstanceDescription id = arch.getInstanceDescription();
+
+ assertEquals("Check component instance name (" + id.getName() + ")", id.getName(), compName);
+ assertEquals("Check component type implementation class", id.getComponentDescription().getClassName(), "org.apache.felix.ipojo.test.scenarios.component.FooProviderType1");
+
+ HandlerDescription[] handlers = id.getHandlers();
+ assertEquals("Number of handlers", handlers.length, 2);
+
+ //Look for the ProvidedService Handler
+ ProvidedServiceHandlerDescription pshd = null;
+ for(int i = 0; i < handlers.length; i++) {
+ if(handlers[i].getHandlerName().equals("org.apache.felix.ipojo.handlers.providedservice.ProvidedServiceHandler")) {
+ pshd = (ProvidedServiceHandlerDescription) handlers[i];
+ }
+ }
+
+ assertNotNull("Check ProvidedServiceHandlerDescription", pshd);
+ ProvidedServiceDescription[] ps = pshd.getProvidedServices();
+
+ assertEquals("Check ProvidedService number", ps.length, 1);
+ assertEquals("Check Provided Service Specs - 1", ps[0].getServiceSpecification().length, 1);
+ assertEquals("Check Provided Service Specs - 2", ps[0].getServiceSpecification()[0], FooService.class.getName());
+ assertEquals("Check Provided Service availability", ps[0].getState(), ProvidedServiceDescription.REGISTERED);
+ Properties prop = ps[0].getProperties();
+ assertNotNull("Check Props", prop);
+ assertEquals("Check service properties number", prop.size(), 2);
+ assertEquals("Check instance.name property", prop.getProperty("instance.name"), compName);
+ assertEquals("Check factory.name property", prop.getProperty("factory.name"), factName);
+
+ ci.dispose();
+ }
+
+ public void testProps() {
+ String factName = "PS-FooProviderType-3";
+ String compName = "FooProvider";
+
+ // Get the factory to create a component instance
+ Factory fact = Utils.getFactoryByName(context, factName);
+ assertNotNull("Cannot find the factory FooProvider", fact);
+
+ Properties props = new Properties();
+ props.put("name", compName);
+ props.put("foo", "foo");
+ props.put("bar", "2");
+ props.put("baz", "baz");
+ ComponentInstance ci = null;
+ try {
+ ci = fact.createComponentInstance(props);
+ } catch (Exception e) { fail(e.getMessage()); }
+
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), compName);
+ assertNotNull("Architecture not available", arch_ref);
+
+ Architecture arch = (Architecture) context.getService(arch_ref);
+ InstanceDescription id = arch.getInstanceDescription();
+
+ assertEquals("Check component instance name (" + id.getName() + ")", id.getName(), compName);
+ assertEquals("Check component type implementation class", id.getComponentDescription().getClassName(), "org.apache.felix.ipojo.test.scenarios.component.FooProviderType1");
+
+ HandlerDescription[] handlers = id.getHandlers();
+ assertEquals("Number of handlers", handlers.length, 3);
+
+ //Look for the ProvidedService Handler
+ ProvidedServiceHandlerDescription pshd = null;
+ for(int i = 0; i < handlers.length; i++) {
+ if(handlers[i].getHandlerName().equals("org.apache.felix.ipojo.handlers.providedservice.ProvidedServiceHandler")) {
+ pshd = (ProvidedServiceHandlerDescription) handlers[i];
+ }
+ }
+
+ assertNotNull("Check ProvidedServiceHandlerDescription", pshd);
+ ProvidedServiceDescription[] ps = pshd.getProvidedServices();
+
+ assertEquals("Check ProvidedService number", ps.length, 1);
+ assertEquals("Check Provided Service Specs - 1", ps[0].getServiceSpecification().length, 1);
+ assertEquals("Check Provided Service Specs - 2", ps[0].getServiceSpecification()[0], FooService.class.getName());
+ assertEquals("Check Provided Service availability", ps[0].getState(), ProvidedServiceDescription.REGISTERED);
+
+ Properties prop = ps[0].getProperties();
+ assertNotNull("Check Props", prop);
+ assertEquals("Check service properties number (#" + prop + "?=5)" , prop.size(), 5);
+ assertEquals("Check instance.name property", prop.getProperty("instance.name"), compName);
+ assertEquals("Check factory.name property", prop.getProperty("factory.name"), factName);
+ assertEquals("Check foo property", prop.getProperty("foo"), "foo");
+ assertEquals("Check bar property", prop.getProperty("bar"), "2");
+ assertEquals("Check baz property", prop.getProperty("baz"), "baz");
+
+ ci.dispose();
+ }
+
+ public void testDoubleProviding() {
+ String factName = "PS-FooBarProviderType-1";
+ String compName = "FooProvider";
+
+ // Get the factory to create a component instance
+ Factory fact = Utils.getFactoryByName(context, factName);
+ assertNotNull("Cannot find the factory FooProvider", fact);
+
+ Properties props = new Properties();
+ props.put("name", compName);
+ ComponentInstance ci = null;
+ try {
+ ci = fact.createComponentInstance(props);
+ } catch (Exception e) {
+ fail(e.getMessage());
+ }
+
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), compName);
+ assertNotNull("Architecture not available", arch_ref);
+
+ Architecture arch = (Architecture) context.getService(arch_ref);
+ InstanceDescription id = arch.getInstanceDescription();
+
+ assertEquals("Check component instance name (" + id.getName() + ")", id.getName(), compName);
+ assertEquals("Check component type implementation class", id.getComponentDescription().getClassName(), "org.apache.felix.ipojo.test.scenarios.component.FooBarProviderType1");
+
+ HandlerDescription[] handlers = id.getHandlers();
+ assertEquals("Number of handlers", handlers.length, 2);
+
+ //Look for the ProvidedService Handler
+ ProvidedServiceHandlerDescription pshd = null;
+ for(int i = 0; i < handlers.length; i++) {
+ if(handlers[i].getHandlerName().equals("org.apache.felix.ipojo.handlers.providedservice.ProvidedServiceHandler")) {
+ pshd = (ProvidedServiceHandlerDescription) handlers[i];
+ }
+ }
+
+ assertNotNull("Check ProvidedServiceHandlerDescription", pshd);
+ ProvidedServiceDescription[] ps = pshd.getProvidedServices();
+
+ assertEquals("Check ProvidedService number", ps.length, 1);
+ assertEquals("Check Provided Service Specs - 1", ps[0].getServiceSpecification().length, 2);
+ assertContains("Check provided service specs - 2", ps[0].getServiceSpecification(), FooService.class.getName());;
+ assertContains("Check provided service specs - 2", ps[0].getServiceSpecification(), BarService.class.getName());
+ assertEquals("Check Provided Service availability", ps[0].getState(), ProvidedServiceDescription.REGISTERED);
+
+ ci.dispose();
+ }
+
+}
diff --git a/ipojo/tests/tests.core.service.providing/src/main/java/org/apache/felix/ipojo/test/scenarios/ps/ProvidedServiceTestSuite.java b/ipojo/tests/tests.core.service.providing/src/main/java/org/apache/felix/ipojo/test/scenarios/ps/ProvidedServiceTestSuite.java
new file mode 100644
index 0000000..c5d8866
--- /dev/null
+++ b/ipojo/tests/tests.core.service.providing/src/main/java/org/apache/felix/ipojo/test/scenarios/ps/ProvidedServiceTestSuite.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.ipojo.test.scenarios.ps;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.apache.felix.ipojo.junit4osgi.OSGiTestSuite;
+import org.osgi.framework.BundleContext;
+
+public class ProvidedServiceTestSuite extends TestSuite {
+
+ public static Test suite(BundleContext bc) {
+ OSGiTestSuite ots = new OSGiTestSuite("Provided Service Test Suite", bc);
+ ots.addTestSuite(Exposition.class);
+ ots.addTestSuite(SimplePS.class);
+ ots.addTestSuite(StaticProps.class);
+ ots.addTestSuite(DynamicProps.class);
+ ots.addTestSuite(StaticPropsReconfiguration.class);
+ ots.addTestSuite(DynamicPropsReconfiguration.class);
+ ots.addTestSuite(InheritedTest.class);
+ ots.addTestSuite(ProvidedServiceArchitectureTest.class);
+ return ots;
+ }
+
+}
diff --git a/ipojo/tests/tests.core.service.providing/src/main/java/org/apache/felix/ipojo/test/scenarios/ps/SimplePS.java b/ipojo/tests/tests.core.service.providing/src/main/java/org/apache/felix/ipojo/test/scenarios/ps/SimplePS.java
new file mode 100644
index 0000000..6f1f8c2
--- /dev/null
+++ b/ipojo/tests/tests.core.service.providing/src/main/java/org/apache/felix/ipojo/test/scenarios/ps/SimplePS.java
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.ipojo.test.scenarios.ps;
+
+import java.util.Properties;
+
+import org.apache.felix.ipojo.ComponentInstance;
+import org.apache.felix.ipojo.Factory;
+import org.apache.felix.ipojo.junit4osgi.OSGiTestCase;
+import org.apache.felix.ipojo.test.scenarios.ps.service.FooService;
+import org.apache.felix.ipojo.test.scenarios.util.Utils;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceReference;
+
+public class SimplePS extends OSGiTestCase {
+
+ public void testPS() {
+ String factName = "PS-FooProviderType-1";
+ String compName = "FooProvider-1";
+ ServiceReference[] refs = null;
+
+ // Check that no Foo Service are available
+ try {
+ refs = context.getServiceReferences(FooService.class.getName(), null);
+ } catch (InvalidSyntaxException e) { fail("Service query failed : " + e); }
+
+ assertNull("FS already available", refs);
+
+ // Get the factory to create a component instance
+ Factory fact = Utils.getFactoryByName(context, factName);
+ assertNotNull("Cannot find the factory FooProvider-1", fact);
+
+ Properties props = new Properties();
+ props.put("name", compName);
+ ComponentInstance ci = null;
+ try {
+ ci = fact.createComponentInstance(props);
+ } catch (Exception e1) { fail(e1.getMessage()); }
+
+ // Get a FooService provider
+ try {
+ refs = context.getServiceReferences(FooService.class.getName(), "(" + "instance.name" + "=" + compName + ")");
+ } catch (InvalidSyntaxException e) { fail("Service query failed (2) " + e); }
+
+ assertNotNull("FS not available", refs);
+
+ // Test foo invocation
+ FooService fs = (FooService) context.getService(refs[0]);
+ assertTrue("FooService invocation failed", fs.foo());
+
+ // Unget the service
+ context.ungetService(refs[0]);
+
+ ci.dispose();
+
+ // Check that there is no more FooService
+ try {
+ refs = context.getServiceReferences(FooService.class.getName(), null);
+ } catch (InvalidSyntaxException e) { fail("Service query failed (3) : " + e.getMessage()); }
+
+ assertNull("FS available, but component instance stopped", refs);
+ }
+
+}
diff --git a/ipojo/tests/tests.core.service.providing/src/main/java/org/apache/felix/ipojo/test/scenarios/ps/StaticProps.java b/ipojo/tests/tests.core.service.providing/src/main/java/org/apache/felix/ipojo/test/scenarios/ps/StaticProps.java
new file mode 100644
index 0000000..afcfe08
--- /dev/null
+++ b/ipojo/tests/tests.core.service.providing/src/main/java/org/apache/felix/ipojo/test/scenarios/ps/StaticProps.java
@@ -0,0 +1,112 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.ipojo.test.scenarios.ps;
+
+import java.util.Properties;
+
+import org.apache.felix.ipojo.ComponentInstance;
+import org.apache.felix.ipojo.junit4osgi.OSGiTestCase;
+import org.apache.felix.ipojo.test.scenarios.ps.service.FooService;
+import org.apache.felix.ipojo.test.scenarios.util.Utils;
+import org.osgi.framework.ServiceReference;
+
+public class StaticProps extends OSGiTestCase {
+
+ ComponentInstance fooProvider1;
+ ComponentInstance fooProvider2;
+
+ public void setUp() {
+ String type = "PS-FooProviderType-2";
+
+ Properties p1 = new Properties();
+ p1.put("name", "FooProvider-1");
+ fooProvider1 = Utils.getComponentInstance(context, type, p1);
+
+ Properties p2 = new Properties();
+ p2.put("name", "FooProvider-2");
+ p2.put("int", new Integer(4));
+ p2.put("long", new Long(42));
+ p2.put("string", new String("bar"));
+ p2.put("strAProp", new String[] {"bar", "foo"});
+ p2.put("intAProp", new int[] {1, 2, 3});
+ fooProvider2 = Utils.getComponentInstance(context, type, p2);
+
+ }
+
+ public void tearDown() {
+ fooProvider1.dispose();
+ fooProvider1 = null;
+ fooProvider2.dispose();
+ fooProvider2 = null;
+ }
+
+ public void testProperties1() {
+ ServiceReference sr = Utils.getServiceReferenceByName(context, FooService.class.getName(), "FooProvider-1");
+ assertNotNull("Check the availability of the FS service", sr);
+
+ // Check service properties
+ Integer intProp = (Integer) sr.getProperty("int");
+ Long longProp = (Long) sr.getProperty("long");
+ String strProp = (String) sr.getProperty("string");
+ String[] strAProp = (String[]) sr.getProperty("strAProp");
+ int[] intAProp = (int[]) sr.getProperty("intAProp");
+
+ assertEquals("Check intProp equality", intProp, new Integer(2));
+ assertEquals("Check longProp equality", longProp, new Long(40));
+ assertEquals("Check strProp equality", strProp, new String("foo"));
+ assertNotNull("Check strAProp not nullity", strAProp);
+ String[] v = new String[] {"foo", "bar"};
+ for (int i = 0; i < strAProp.length; i++) {
+ if(!strAProp[i].equals(v[i])) { fail("Check the strAProp Equality"); }
+ }
+ assertNotNull("Check intAProp not nullity", intAProp);
+ int[] v2 = new int[] {1, 2, 3};
+ for (int i = 0; i < intAProp.length; i++) {
+ if(intAProp[i] != v2[i]) { fail("Check the intAProp Equality"); }
+ }
+
+ }
+
+ public void testProperties2() {
+ ServiceReference sr = Utils.getServiceReferenceByName(context, FooService.class.getName(), "FooProvider-2");
+ assertNotNull("Check the availability of the FS service", sr);
+
+ // Check service properties
+ Integer intProp = (Integer) sr.getProperty("int");
+ Long longProp = (Long) sr.getProperty("long");
+ String strProp = (String) sr.getProperty("string");
+ String[] strAProp = (String[]) sr.getProperty("strAProp");
+ int[] intAProp = (int[]) sr.getProperty("intAProp");
+
+ assertEquals("Check intProp equality", intProp, new Integer(4));
+ assertEquals("Check longProp equality", longProp, new Long(42));
+ assertEquals("Check strProp equality", strProp, new String("bar"));
+
+ assertNotNull("Check strAProp not nullity", strAProp);
+ String[] v = new String[] {"bar", "foo"};
+ for (int i = 0; i < strAProp.length; i++) {
+ if(!strAProp[i].equals(v[i])) { fail("Check the strAProp Equality"); }
+ }
+ assertNotNull("Check intAProp not nullity", intAProp);
+ int[] v2 = new int[] {1, 2, 3};
+ for (int i = 0; i < intAProp.length; i++) {
+ if(intAProp[i] != v2[i]) { fail("Check the intAProp Equality"); }
+ }
+ }
+}
diff --git a/ipojo/tests/tests.core.service.providing/src/main/java/org/apache/felix/ipojo/test/scenarios/ps/StaticPropsReconfiguration.java b/ipojo/tests/tests.core.service.providing/src/main/java/org/apache/felix/ipojo/test/scenarios/ps/StaticPropsReconfiguration.java
new file mode 100644
index 0000000..5f9baf9
--- /dev/null
+++ b/ipojo/tests/tests.core.service.providing/src/main/java/org/apache/felix/ipojo/test/scenarios/ps/StaticPropsReconfiguration.java
@@ -0,0 +1,337 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.ipojo.test.scenarios.ps;
+
+import java.util.Dictionary;
+import java.util.Properties;
+
+import org.apache.felix.ipojo.ComponentInstance;
+import org.apache.felix.ipojo.Factory;
+import org.apache.felix.ipojo.junit4osgi.OSGiTestCase;
+import org.apache.felix.ipojo.test.scenarios.ps.service.FooService;
+import org.apache.felix.ipojo.test.scenarios.util.Utils;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.cm.ConfigurationException;
+import org.osgi.service.cm.ManagedServiceFactory;
+
+public class StaticPropsReconfiguration extends OSGiTestCase {
+
+ ComponentInstance fooProvider1;
+ ComponentInstance fooProvider2;
+
+ public void setUp() {
+ String type = "PS-FooProviderType-2";
+
+ Properties p1 = new Properties();
+ p1.put("name", "FooProvider-1");
+ fooProvider1 = Utils.getComponentInstance(context, type, p1);
+
+ Properties p2 = new Properties();
+ p2.put("name", "FooProvider-2");
+ p2.put("int", new Integer(4));
+ p2.put("long", new Long(42));
+ p2.put("string", new String("bar"));
+ p2.put("strAProp", new String[] {"bar", "foo"});
+ p2.put("intAProp", new int[] {1, 2, 3});
+ fooProvider2 = Utils.getComponentInstance(context, type, p2);
+
+ }
+
+ public void tearDown() {
+ fooProvider1.dispose();
+ fooProvider1 = null;
+ fooProvider2.dispose();
+ fooProvider2 = null;
+ }
+
+ public void testReconfFactory1() {
+ ServiceReference sr = Utils.getServiceReferenceByName(context, FooService.class.getName(), "FooProvider-1");
+ assertNotNull("Check the availability of the FS service", sr);
+
+ // Check service properties
+ Integer intProp = (Integer) sr.getProperty("int");
+ Long longProp = (Long) sr.getProperty("long");
+ String strProp = (String) sr.getProperty("string");
+ String[] strAProp = (String[]) sr.getProperty("strAProp");
+ int[] intAProp = (int[]) sr.getProperty("intAProp");
+
+ assertEquals("Check intProp equality", intProp, new Integer(2));
+ assertEquals("Check longProp equality", longProp, new Long(40));
+ assertEquals("Check strProp equality", strProp, new String("foo"));
+ assertNotNull("Check strAProp not nullity", strAProp);
+ String[] v = new String[] {"foo", "bar"};
+ for (int i = 0; i < strAProp.length; i++) {
+ if(!strAProp[i].equals(v[i])) { fail("Check the strAProp Equality"); }
+ }
+ assertNotNull("Check intAProp not nullity", intAProp);
+ int[] v2 = new int[] {1, 2, 3};
+ for (int i = 0; i < intAProp.length; i++) {
+ if(intAProp[i] != v2[i]) { fail("Check the intAProp Equality"); }
+ }
+
+ // Reconfiguration
+ ServiceReference fact_ref = Utils.getServiceReferenceByName(context, Factory.class.getName(), "PS-FooProviderType-2");
+ Dictionary reconf = new Properties();
+ reconf.put("name", "FooProvider-1");
+ reconf.put("int", new Integer(5));
+ reconf.put("long", new Long(43));
+ reconf.put("string", new String("toto"));
+ reconf.put("strAProp", new String[] {"foo", "baz"});
+ reconf.put("intAProp", new int[] {3, 2, 1});
+ Factory fact = (Factory) context.getService(fact_ref);
+ try {
+ fact.reconfigure(reconf);
+ } catch(Exception e) {
+ fail("Configuration non acceptable : " + reconf);
+ }
+
+ sr = Utils.getServiceReferenceByName(context, FooService.class.getName(), "FooProvider-1");
+ assertNotNull("Check the availability of the FS service", sr);
+
+ // Check service properties after the reconfiguration
+ intProp = (Integer) sr.getProperty("int");
+ longProp = (Long) sr.getProperty("long");
+ strProp = (String) sr.getProperty("string");
+ strAProp = (String[]) sr.getProperty("strAProp");
+ intAProp = (int[]) sr.getProperty("intAProp");
+
+ assertEquals("Check intProp equality after reconfiguration", intProp, new Integer(5));
+ assertEquals("Check longProp equality after reconfiguration", longProp, new Long(43));
+ assertEquals("Check strProp equality after reconfiguration", strProp, new String("toto"));
+ assertNotNull("Check strAProp not nullity after reconfiguration", strAProp);
+ v = new String[] {"foo", "baz"};
+ for (int i = 0; i < strAProp.length; i++) {
+ if(!strAProp[i].equals(v[i])) { fail("Check the strAProp Equality"); }
+ }
+ assertNotNull("Check intAProp not nullity", intAProp);
+ v2 = new int[] {3, 2, 1};
+ for (int i = 0; i < intAProp.length; i++) {
+ if(intAProp[i] != v2[i]) { fail("Check the intAProp Equality"); }
+ }
+
+ context.ungetService(fact_ref);
+ fact = null;
+
+ }
+
+ public void testReconfFactory2() {
+ ServiceReference sr = Utils.getServiceReferenceByName(context, FooService.class.getName(), "FooProvider-2");
+ assertNotNull("Check the availability of the FS service", sr);
+
+ // Check service properties
+ Integer intProp = (Integer) sr.getProperty("int");
+ Long longProp = (Long) sr.getProperty("long");
+ String strProp = (String) sr.getProperty("string");
+ String[] strAProp = (String[]) sr.getProperty("strAProp");
+ int[] intAProp = (int[]) sr.getProperty("intAProp");
+
+ assertEquals("Check intProp equality", intProp, new Integer(4));
+ assertEquals("Check longProp equality", longProp, new Long(42));
+ assertEquals("Check strProp equality", strProp, new String("bar"));
+
+ assertNotNull("Check strAProp not nullity", strAProp);
+ String[] v = new String[] {"bar", "foo"};
+ for (int i = 0; i < strAProp.length; i++) {
+ if(!strAProp[i].equals(v[i])) { fail("Check the strAProp Equality"); }
+ }
+ assertNotNull("Check intAProp not nullity", intAProp);
+ int[] v2 = new int[] {1, 2, 3};
+ for (int i = 0; i < intAProp.length; i++) {
+ if(intAProp[i] != v2[i]) { fail("Check the intAProp Equality"); }
+ }
+
+ // Reconfiguration
+ ServiceReference fact_ref = Utils.getServiceReferenceByName(context, Factory.class.getName(), "PS-FooProviderType-2");
+ Dictionary reconf = new Properties();
+ reconf.put("name", "FooProvider-2");
+ reconf.put("int", new Integer(5));
+ reconf.put("long", new Long(43));
+ reconf.put("string", new String("toto"));
+ reconf.put("strAProp", new String[] {"foo", "baz"});
+ reconf.put("intAProp", new int[] {3, 2, 1});
+ Factory fact = (Factory) context.getService(fact_ref);
+ try {
+ fact.reconfigure(reconf);
+ } catch(Exception e) {
+ fail("Configuration non acceptable : " + reconf);
+ }
+
+ // Check service properties after the reconfiguration
+ intProp = (Integer) sr.getProperty("int");
+ longProp = (Long) sr.getProperty("long");
+ strProp = (String) sr.getProperty("string");
+ strAProp = (String[]) sr.getProperty("strAProp");
+ intAProp = (int[]) sr.getProperty("intAProp");
+
+ assertEquals("Check intProp equality after reconfiguration", intProp, new Integer(5));
+ assertEquals("Check longProp equality after reconfiguration", longProp, new Long(43));
+ assertEquals("Check strProp equality after reconfiguration", strProp, new String("toto"));
+ assertNotNull("Check strAProp not nullity after reconfiguration", strAProp);
+ v = new String[] {"foo", "baz"};
+ for (int i = 0; i < strAProp.length; i++) {
+ if(!strAProp[i].equals(v[i])) { fail("Check the strAProp Equality"); }
+ }
+ assertNotNull("Check intAProp not nullity", intAProp);
+ v2 = new int[] {3, 2, 1};
+ for (int i = 0; i < intAProp.length; i++) {
+ if(intAProp[i] != v2[i]) { fail("Check the intAProp Equality"); }
+ }
+
+ context.ungetService(fact_ref);
+ fact = null;
+ }
+
+ public void testMSFFactory1() {
+ ServiceReference sr = Utils.getServiceReferenceByName(context, FooService.class.getName(), "FooProvider-1");
+ assertNotNull("Check the availability of the FS service", sr);
+
+ // Check service properties
+ Integer intProp = (Integer) sr.getProperty("int");
+ Long longProp = (Long) sr.getProperty("long");
+ String strProp = (String) sr.getProperty("string");
+ String[] strAProp = (String[]) sr.getProperty("strAProp");
+ int[] intAProp = (int[]) sr.getProperty("intAProp");
+
+ assertEquals("Check intProp equality", intProp, new Integer(2));
+ assertEquals("Check longProp equality", longProp, new Long(40));
+ assertEquals("Check strProp equality", strProp, new String("foo"));
+ assertNotNull("Check strAProp not nullity", strAProp);
+ String[] v = new String[] {"foo", "bar"};
+ for (int i = 0; i < strAProp.length; i++) {
+ if(!strAProp[i].equals(v[i])) { fail("Check the strAProp Equality"); }
+ }
+ assertNotNull("Check intAProp not nullity", intAProp);
+ int[] v2 = new int[] {1, 2, 3};
+ for (int i = 0; i < intAProp.length; i++) {
+ if(intAProp[i] != v2[i]) { fail("Check the intAProp Equality"); }
+ }
+
+ // Reconfiguration
+ ServiceReference fact_ref = Utils.getServiceReferenceByName(context, ManagedServiceFactory.class.getName(), "PS-FooProviderType-2");
+ Dictionary reconf = new Properties();
+ reconf.put("int", new Integer(5));
+ reconf.put("long", new Long(43));
+ reconf.put("string", new String("toto"));
+ reconf.put("strAProp", new String[] {"foo", "baz"});
+ reconf.put("intAProp", new int[] {3, 2, 1});
+ ManagedServiceFactory fact = (ManagedServiceFactory) context.getService(fact_ref);
+ try {
+ fact.updated("FooProvider-1", reconf);
+ } catch (ConfigurationException e) {
+ fail("Configuration non acceptable : " + reconf);
+ }
+
+ sr = Utils.getServiceReferenceByName(context, FooService.class.getName(), "FooProvider-1");
+ assertNotNull("Check the availability of the FS service", sr);
+
+ // Check service properties after the reconfiguration
+ intProp = (Integer) sr.getProperty("int");
+ longProp = (Long) sr.getProperty("long");
+ strProp = (String) sr.getProperty("string");
+ strAProp = (String[]) sr.getProperty("strAProp");
+ intAProp = (int[]) sr.getProperty("intAProp");
+
+ assertEquals("Check intProp equality after reconfiguration", intProp, new Integer(5));
+ assertEquals("Check longProp equality after reconfiguration", longProp, new Long(43));
+ assertEquals("Check strProp equality after reconfiguration", strProp, new String("toto"));
+ assertNotNull("Check strAProp not nullity after reconfiguration", strAProp);
+ v = new String[] {"foo", "baz"};
+ for (int i = 0; i < strAProp.length; i++) {
+ if(!strAProp[i].equals(v[i])) { fail("Check the strAProp Equality"); }
+ }
+ assertNotNull("Check intAProp not nullity", intAProp);
+ v2 = new int[] {3, 2, 1};
+ for (int i = 0; i < intAProp.length; i++) {
+ if(intAProp[i] != v2[i]) { fail("Check the intAProp Equality"); }
+ }
+
+ context.ungetService(fact_ref);
+ fact = null;
+
+ }
+
+ public void testReconfMSF2() {
+ ServiceReference sr = Utils.getServiceReferenceByName(context, FooService.class.getName(), "FooProvider-2");
+ assertNotNull("Check the availability of the FS service", sr);
+
+ // Check service properties
+ Integer intProp = (Integer) sr.getProperty("int");
+ Long longProp = (Long) sr.getProperty("long");
+ String strProp = (String) sr.getProperty("string");
+ String[] strAProp = (String[]) sr.getProperty("strAProp");
+ int[] intAProp = (int[]) sr.getProperty("intAProp");
+
+ assertEquals("Check intProp equality", intProp, new Integer(4));
+ assertEquals("Check longProp equality", longProp, new Long(42));
+ assertEquals("Check strProp equality", strProp, new String("bar"));
+
+ assertNotNull("Check strAProp not nullity", strAProp);
+ String[] v = new String[] {"bar", "foo"};
+ for (int i = 0; i < strAProp.length; i++) {
+ if(!strAProp[i].equals(v[i])) { fail("Check the strAProp Equality"); }
+ }
+ assertNotNull("Check intAProp not nullity", intAProp);
+ int[] v2 = new int[] {1, 2, 3};
+ for (int i = 0; i < intAProp.length; i++) {
+ if(intAProp[i] != v2[i]) { fail("Check the intAProp Equality"); }
+ }
+
+ // Reconfiguration
+ ServiceReference fact_ref = Utils.getServiceReferenceByName(context, ManagedServiceFactory.class.getName(), "PS-FooProviderType-2");
+ Dictionary reconf = new Properties();
+ reconf.put("int", new Integer(5));
+ reconf.put("long", new Long(43));
+ reconf.put("string", new String("toto"));
+ reconf.put("strAProp", new String[] {"foo", "baz"});
+ reconf.put("intAProp", new int[] {3, 2, 1});
+ ManagedServiceFactory fact = (ManagedServiceFactory) context.getService(fact_ref);
+ try {
+ fact.updated("FooProvider-2", reconf);
+ } catch (ConfigurationException e) {
+ fail("Configuration non acceptable : " + reconf);
+ }
+
+ // Check service properties after the reconfiguration
+ intProp = (Integer) sr.getProperty("int");
+ longProp = (Long) sr.getProperty("long");
+ strProp = (String) sr.getProperty("string");
+ strAProp = (String[]) sr.getProperty("strAProp");
+ intAProp = (int[]) sr.getProperty("intAProp");
+
+ assertEquals("Check intProp equality after reconfiguration", intProp, new Integer(5));
+ assertEquals("Check longProp equality after reconfiguration", longProp, new Long(43));
+ assertEquals("Check strProp equality after reconfiguration", strProp, new String("toto"));
+ assertNotNull("Check strAProp not nullity after reconfiguration", strAProp);
+ v = new String[] {"foo", "baz"};
+ for (int i = 0; i < strAProp.length; i++) {
+ if(!strAProp[i].equals(v[i])) { fail("Check the strAProp Equality"); }
+ }
+ assertNotNull("Check intAProp not nullity", intAProp);
+ v2 = new int[] {3, 2, 1};
+ for (int i = 0; i < intAProp.length; i++) {
+ if(intAProp[i] != v2[i]) { fail("Check the intAProp Equality"); }
+ }
+
+ context.ungetService(fact_ref);
+ fact = null;
+ }
+
+
+
+}
diff --git a/ipojo/tests/tests.core.service.providing/src/main/java/org/apache/felix/ipojo/test/scenarios/ps/service/BarService.java b/ipojo/tests/tests.core.service.providing/src/main/java/org/apache/felix/ipojo/test/scenarios/ps/service/BarService.java
new file mode 100644
index 0000000..7ccee67
--- /dev/null
+++ b/ipojo/tests/tests.core.service.providing/src/main/java/org/apache/felix/ipojo/test/scenarios/ps/service/BarService.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.ipojo.test.scenarios.ps.service;
+
+import java.util.Properties;
+
+public interface BarService {
+
+ public boolean bar();
+
+ public Properties getProps();
+
+}
diff --git a/ipojo/tests/tests.core.service.providing/src/main/java/org/apache/felix/ipojo/test/scenarios/ps/service/CheckService.java b/ipojo/tests/tests.core.service.providing/src/main/java/org/apache/felix/ipojo/test/scenarios/ps/service/CheckService.java
new file mode 100644
index 0000000..f500f79
--- /dev/null
+++ b/ipojo/tests/tests.core.service.providing/src/main/java/org/apache/felix/ipojo/test/scenarios/ps/service/CheckService.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.ipojo.test.scenarios.ps.service;
+
+import java.util.Properties;
+
+public interface CheckService {
+
+ public static final String foo = "foo";
+
+ public boolean check();
+
+ public Properties getProps();
+
+}
diff --git a/ipojo/tests/tests.core.service.providing/src/main/java/org/apache/felix/ipojo/test/scenarios/ps/service/ChildInterface.java b/ipojo/tests/tests.core.service.providing/src/main/java/org/apache/felix/ipojo/test/scenarios/ps/service/ChildInterface.java
new file mode 100644
index 0000000..b3d8974
--- /dev/null
+++ b/ipojo/tests/tests.core.service.providing/src/main/java/org/apache/felix/ipojo/test/scenarios/ps/service/ChildInterface.java
@@ -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.test.scenarios.ps.service;
+
+public interface ChildInterface extends ParentInterface1, ParentInterface2 {
+
+ public void processChild();
+
+}
diff --git a/ipojo/tests/tests.core.service.providing/src/main/java/org/apache/felix/ipojo/test/scenarios/ps/service/FooService.java b/ipojo/tests/tests.core.service.providing/src/main/java/org/apache/felix/ipojo/test/scenarios/ps/service/FooService.java
new file mode 100644
index 0000000..7bf3e25
--- /dev/null
+++ b/ipojo/tests/tests.core.service.providing/src/main/java/org/apache/felix/ipojo/test/scenarios/ps/service/FooService.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.ipojo.test.scenarios.ps.service;
+
+import java.util.Properties;
+
+public interface FooService {
+
+ boolean foo();
+
+ Properties fooProps();
+
+ Boolean getObject();
+
+ boolean getBoolean();
+
+ int getInt();
+
+ long getLong();
+
+ double getDouble();
+
+}
diff --git a/ipojo/tests/tests.core.service.providing/src/main/java/org/apache/felix/ipojo/test/scenarios/ps/service/ParentInterface1.java b/ipojo/tests/tests.core.service.providing/src/main/java/org/apache/felix/ipojo/test/scenarios/ps/service/ParentInterface1.java
new file mode 100644
index 0000000..f032f3e
--- /dev/null
+++ b/ipojo/tests/tests.core.service.providing/src/main/java/org/apache/felix/ipojo/test/scenarios/ps/service/ParentInterface1.java
@@ -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.test.scenarios.ps.service;
+
+public interface ParentInterface1 extends ParentParentInterface {
+
+ public void processParent1();
+
+}
diff --git a/ipojo/tests/tests.core.service.providing/src/main/java/org/apache/felix/ipojo/test/scenarios/ps/service/ParentInterface2.java b/ipojo/tests/tests.core.service.providing/src/main/java/org/apache/felix/ipojo/test/scenarios/ps/service/ParentInterface2.java
new file mode 100644
index 0000000..8369a14
--- /dev/null
+++ b/ipojo/tests/tests.core.service.providing/src/main/java/org/apache/felix/ipojo/test/scenarios/ps/service/ParentInterface2.java
@@ -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.test.scenarios.ps.service;
+
+public interface ParentInterface2 {
+
+ public void processParent2();
+
+}
diff --git a/ipojo/tests/tests.core.service.providing/src/main/java/org/apache/felix/ipojo/test/scenarios/ps/service/ParentParentInterface.java b/ipojo/tests/tests.core.service.providing/src/main/java/org/apache/felix/ipojo/test/scenarios/ps/service/ParentParentInterface.java
new file mode 100644
index 0000000..d9fa406
--- /dev/null
+++ b/ipojo/tests/tests.core.service.providing/src/main/java/org/apache/felix/ipojo/test/scenarios/ps/service/ParentParentInterface.java
@@ -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.test.scenarios.ps.service;
+
+public interface ParentParentInterface {
+
+ public void processParentParent();
+
+}
diff --git a/ipojo/tests/tests.core.service.providing/src/main/java/org/apache/felix/ipojo/test/scenarios/util/Utils.java b/ipojo/tests/tests.core.service.providing/src/main/java/org/apache/felix/ipojo/test/scenarios/util/Utils.java
new file mode 100644
index 0000000..cb87c86
--- /dev/null
+++ b/ipojo/tests/tests.core.service.providing/src/main/java/org/apache/felix/ipojo/test/scenarios/util/Utils.java
@@ -0,0 +1,326 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.ipojo.test.scenarios.util;
+
+import java.util.Dictionary;
+import java.util.Properties;
+
+import junit.framework.Assert;
+
+import org.apache.felix.ipojo.ComponentInstance;
+import org.apache.felix.ipojo.Factory;
+import org.apache.felix.ipojo.Handler;
+import org.apache.felix.ipojo.HandlerFactory;
+import org.apache.felix.ipojo.ServiceContext;
+//import org.apache.felix.ipojo.composite.CompositeManager;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.cm.ManagedServiceFactory;
+
+public class Utils {
+
+ public static Factory getFactoryByName(BundleContext bc, String factoryName) {
+ ServiceReference[] refs;
+ try {
+ refs = bc.getServiceReferences(Factory.class.getName(), "(factory.name=" + factoryName + ")");
+ if (refs == null) {
+ System.err.println("Cannot get the factory " + factoryName);
+ return null;
+ }
+ return ((Factory) bc.getService(refs[0]));
+ } catch (InvalidSyntaxException e) {
+ System.err.println("Cannot get the factory " + factoryName + " : " + e.getMessage());
+ return null;
+ }
+ }
+
+ public static HandlerFactory getHandlerFactoryByName(BundleContext bc, String factoryName) {
+ ServiceReference[] refs;
+ try {
+ refs = bc.getServiceReferences(Factory.class.getName(), "(" + Handler.HANDLER_NAME_PROPERTY + "=" + factoryName + ")");
+ if (refs == null) {
+ System.err.println("Cannot get the factory " + factoryName);
+ return null;
+ }
+ return (HandlerFactory) bc.getService(refs[0]);
+ } catch (InvalidSyntaxException e) {
+ System.err.println("Cannot get the factory " + factoryName + " : " + e.getMessage());
+ return null;
+ }
+ }
+
+ public static ComponentInstance getComponentInstance(BundleContext bc, String factoryName, Dictionary configuration) {
+ Factory fact = getFactoryByName(bc, factoryName);
+
+ if (fact == null) {
+ System.err.println("Factory " + factoryName + " not found");
+ return null;
+ }
+
+ // if(fact.isAcceptable(configuration)) {
+ try {
+ return fact.createComponentInstance(configuration);
+ } catch (Exception e) {
+ e.printStackTrace();
+ Assert.fail("Cannot create the instance from " + factoryName + " : " + e.getMessage());
+ return null;
+ }
+ // }
+ // else {
+ // System.err.println("Configuration not accepted by : " + factoryName);
+ // return null;
+ // }
+ }
+
+ public static ComponentInstance getComponentInstanceByName(BundleContext bc, String factoryName, String name) {
+ Factory fact = getFactoryByName(bc, factoryName);
+
+ if (fact == null) {
+ System.err.println("Factory " + factoryName + " not found");
+ return null;
+ }
+
+ try {
+ Properties props = new Properties();
+ props.put("name", name);
+ return fact.createComponentInstance(props);
+ } catch (Exception e) {
+ System.err.println("Cannot create the instance from " + factoryName + " : " + e.getMessage());
+ e.printStackTrace();
+ return null;
+ }
+ }
+
+ public static ServiceReference[] getServiceReferences(BundleContext bc, String itf, String filter) {
+ ServiceReference[] refs = null;
+ try {
+ refs = bc.getServiceReferences(itf, filter);
+ } catch (InvalidSyntaxException e) {
+ System.err.println("Invalid Filter : " + filter);
+ }
+ if (refs == null) {
+ return new ServiceReference[0];
+ } else {
+ return refs;
+ }
+ }
+
+ public static ServiceReference getServiceReference(BundleContext bc, String itf, String filter) {
+ ServiceReference[] refs = null;
+ try {
+ refs = bc.getServiceReferences(itf, filter);
+ } catch (InvalidSyntaxException e) {
+ System.err.println("Invalid Filter : " + filter);
+ }
+ if (refs == null) {
+ return null;
+ } else {
+ return refs[0];
+ }
+ }
+
+ public static ServiceReference getServiceReferenceByName(BundleContext bc, String itf, String name) {
+ ServiceReference[] refs = null;
+ String filter = null;
+ if (itf.equals(Factory.class.getName()) || itf.equals(ManagedServiceFactory.class.getName())) {
+ filter = "(" + "factory.name" + "=" + name + ")";
+ } else {
+ filter = "(" + "instance.name" + "=" + name + ")";
+ }
+ try {
+ refs = bc.getServiceReferences(itf, filter);
+ } catch (InvalidSyntaxException e) {
+ System.err.println("Invalid Filter : " + filter);
+ }
+ if (refs == null) {
+ return null;
+ } else {
+ return refs[0];
+ }
+ }
+
+ public static ServiceReference getServiceReferenceByPID(BundleContext bc, String itf, String pid) {
+ ServiceReference[] refs = null;
+ String filter = "(" + "service.pid" + "=" + pid + ")";
+ try {
+ refs = bc.getServiceReferences(itf, filter);
+ } catch (InvalidSyntaxException e) {
+ System.err.println("Invalid Filter : " + filter);
+ }
+ if (refs == null) {
+ return null;
+ } else if (refs.length == 1) {
+ return refs[0];
+ } else {
+ Assert.fail("A service lookup by PID returned several providers (" + refs.length + ")" + " for " + itf + " with " + pid);
+ return null;
+ }
+ }
+
+ public static Object getServiceObject(BundleContext bc, String itf, String filter) {
+ ServiceReference ref = getServiceReference(bc, itf, filter);
+ if (ref != null) {
+ return bc.getService(ref);
+ } else {
+ return null;
+ }
+ }
+
+ public static Object[] getServiceObjects(BundleContext bc, String itf, String filter) {
+ ServiceReference[] refs = getServiceReferences(bc, itf, filter);
+ if (refs != null) {
+ Object[] list = new Object[refs.length];
+ for (int i = 0; i < refs.length; i++) {
+ list[i] = bc.getService(refs[i]);
+ }
+ return list;
+ } else {
+ return new Object[0];
+ }
+ }
+
+// public static ServiceContext getServiceContext(ComponentInstance ci) {
+// if (ci instanceof CompositeManager) {
+// return ((CompositeManager) ci).getServiceContext();
+// } else {
+// throw new RuntimeException("Cannot get the service context form an non composite instance");
+// }
+// }
+
+ public static Factory getFactoryByName(ServiceContext bc, String factoryName) {
+ ServiceReference[] refs;
+ try {
+ refs = bc.getServiceReferences(Factory.class.getName(), "(factory.name=" + factoryName + ")");
+ if (refs == null) { return null; }
+ return ((Factory) bc.getService(refs[0]));
+ } catch (InvalidSyntaxException e) {
+ System.err.println("Cannot get the factory " + factoryName + " : " + e.getMessage());
+ return null;
+ }
+ }
+
+ public static ComponentInstance getComponentInstance(ServiceContext bc, String factoryName, Dictionary configuration) {
+ Factory fact = getFactoryByName(bc, factoryName);
+
+ if (fact == null) { return null; }
+
+ if (fact.isAcceptable(configuration)) {
+ try {
+ return fact.createComponentInstance(configuration);
+ } catch (Exception e) {
+ System.err.println(e.getMessage());
+ e.printStackTrace();
+ return null;
+ }
+ } else {
+ System.err.println("Configuration not accepted by : " + factoryName);
+ return null;
+ }
+ }
+
+ public static ServiceReference[] getServiceReferences(ServiceContext bc, String itf, String filter) {
+ ServiceReference[] refs = null;
+ try {
+ refs = bc.getServiceReferences(itf, filter);
+ } catch (InvalidSyntaxException e) {
+ System.err.println("Invalid Filter : " + filter);
+ }
+ if (refs == null) {
+ return new ServiceReference[0];
+ } else {
+ return refs;
+ }
+ }
+
+ public static ServiceReference getServiceReference(ServiceContext bc, String itf, String filter) {
+ ServiceReference[] refs = null;
+ try {
+ refs = bc.getServiceReferences(itf, filter);
+ } catch (InvalidSyntaxException e) {
+ System.err.println("Invalid Filter : " + filter);
+ }
+ if (refs == null) {
+ return null;
+ } else {
+ return refs[0];
+ }
+ }
+
+ public static ServiceReference getServiceReferenceByName(ServiceContext bc, String itf, String name) {
+ ServiceReference[] refs = null;
+ String filter = null;
+ if (itf.equals(Factory.class.getName()) || itf.equals(ManagedServiceFactory.class.getName())) {
+ filter = "(" + "factory.name" + "=" + name + ")";
+ } else {
+ filter = "(" + "instance.name" + "=" + name + ")";
+ }
+ try {
+ refs = bc.getServiceReferences(itf, filter);
+ } catch (InvalidSyntaxException e) {
+ System.err.println("Invalid Filter : " + filter);
+ }
+ if (refs == null) {
+ return null;
+ } else {
+ return refs[0];
+ }
+ }
+
+ public static Object getServiceObject(ServiceContext bc, String itf, String filter) {
+ ServiceReference ref = getServiceReference(bc, itf, filter);
+ if (ref != null) {
+ return bc.getService(ref);
+ } else {
+ return null;
+ }
+ }
+
+ public static Object[] getServiceObjects(ServiceContext bc, String itf, String filter) {
+ ServiceReference[] refs = getServiceReferences(bc, itf, filter);
+ if (refs != null) {
+ Object[] list = new Object[refs.length];
+ for (int i = 0; i < refs.length; i++) {
+ list[i] = bc.getService(refs[i]);
+ }
+ return list;
+ } else {
+ return new Object[0];
+ }
+ }
+
+ public static boolean contains(String string, String[] array) {
+ for (int i = 0; array != null && i < array.length; i++) {
+ if (array[i] != null && array[i].equals(string)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public static boolean contains(int value, int[] array) {
+ for (int i = 0; array != null && i < array.length; i++) {
+ if (array[i] == value) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+}
diff --git a/ipojo/tests/tests.core.service.providing/src/main/resources/metadata.xml b/ipojo/tests/tests.core.service.providing/src/main/resources/metadata.xml
new file mode 100644
index 0000000..3588872
--- /dev/null
+++ b/ipojo/tests/tests.core.service.providing/src/main/resources/metadata.xml
@@ -0,0 +1,135 @@
+<ipojo>
+ <!-- Simple provider -->
+ <component
+ className="org.apache.felix.ipojo.test.scenarios.component.FooProviderType1"
+ factory="PS-FooProviderType-1" architecture="true">
+ <provides />
+ </component>
+
+ <component
+ className="org.apache.felix.ipojo.test.scenarios.component.FooProviderType1"
+ factory="PS-FooProviderType-itf" architecture="true">
+ <provides
+ interface="org.apache.felix.ipojo.test.scenarios.ps.service.FooService" />
+ </component>
+
+ <component
+ className="org.apache.felix.ipojo.test.scenarios.component.FooProviderType1"
+ factory="PS-FooProviderType-3" architecture="true">
+ <provides>
+ <property name="foo" field="m_foo" />
+ <property name="bar" field="m_bar" />
+ <property name="baz" type="java.lang.String" />
+ </provides>
+ <properties propagation="true">
+ <property name="foo" field="m_foo" />
+ <property name="bar" field="m_bar" />
+ </properties>
+ </component>
+
+ <!-- Providers providing 2 services -->
+ <component
+ className="org.apache.felix.ipojo.test.scenarios.component.FooBarProviderType1"
+ factory="PS-FooBarProviderType-1" architecture="true">
+ <provides />
+ </component>
+ <component
+ className="org.apache.felix.ipojo.test.scenarios.component.FooBarProviderType1"
+ factory="PS-FooBarProviderType-2" architecture="true">
+ <provides
+ interface="{org.apache.felix.ipojo.test.scenarios.ps.service.FooService, org.apache.felix.ipojo.test.scenarios.ps.service.BarService }" />
+ </component>
+ <component
+ className="org.apache.felix.ipojo.test.scenarios.component.FooBarProviderType1"
+ factory="PS-FooBarProviderType-3" architecture="true">
+ <provides
+ interface="{org.apache.felix.ipojo.test.scenarios.ps.service.FooService}">
+ <property name="baz" type="java.lang.String" value="foo" />
+ </provides>
+ <provides
+ interface="{org.apache.felix.ipojo.test.scenarios.ps.service.BarService}">
+ <property name="baz" type="java.lang.String" value="bar" />
+ </provides>
+ </component>
+
+
+ <!-- Provider with dynamic property -->
+ <component
+ className="org.apache.felix.ipojo.test.scenarios.component.FooProviderTypeDyn"
+ name="PS-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>
+
+ <component
+ className="org.apache.felix.ipojo.test.scenarios.component.FooProviderType1"
+ name="PS-FooProviderType-2" architecture="true">
+ <provides>
+ <property name="int" type="int" value="2" />
+ <property name="long" type="long" value="40" />
+ <property name="string" type="java.lang.String" value="foo" />
+ <property name="strAProp" type="java.lang.String[]"
+ value="{foo, bar}" />
+ <property name="intAProp" type="int[]" value="{1,2,3}" />
+ </provides>
+ </component>
+
+ <component
+ className="org.apache.felix.ipojo.test.scenarios.component.FooProviderTypeDyn2"
+ name="PS-FooProviderType-Dyn2" factory="true" architecture="true">
+ <provides>
+ <property name="int" field="intProp" value="4" />
+ <property name="boolean" field="boolProp" />
+ <property name="string" field="strProp" />
+ <property name="strAProp" field="strAProp" />
+ <property name="intAProp" field="intAProp"
+ value="{1, 2,3 }" />
+ </provides>
+ </component>
+
+ <!-- Inherited Provides -->
+ <component
+ classname="org.apache.felix.ipojo.test.scenarios.component.inherited.ProcessImplementation1"
+ name="PS-PI1" architecture="true">
+ <provides />
+ </component>
+
+ <component
+ classname="org.apache.felix.ipojo.test.scenarios.component.inherited.ProcessImplementation1"
+ name="PS-PI1-1" architecture="true">
+ <provides
+ interface="org.apache.felix.ipojo.test.scenarios.ps.service.ParentParentInterface" />
+ </component>
+
+ <component
+ classname="org.apache.felix.ipojo.test.scenarios.component.inherited.ProcessImplementation1"
+ name="PS-PI1-2" architecture="true">
+ <provides
+ interface="{org.apache.felix.ipojo.test.scenarios.ps.service.ParentParentInterface, org.apache.felix.ipojo.test.scenarios.ps.service.ParentInterface2}" />
+ </component>
+
+ <component
+ classname="org.apache.felix.ipojo.test.scenarios.component.inherited.ProcessImplementation2"
+ name="PS-PI2" architecture="true">
+ <provides />
+ </component>
+
+ <component
+ classname="org.apache.felix.ipojo.test.scenarios.component.inherited.ProcessImplementation2"
+ name="PS-PI2-1" architecture="true">
+ <provides
+ interface="org.apache.felix.ipojo.test.scenarios.ps.service.ParentParentInterface" />
+ </component>
+
+ <component
+ classname="org.apache.felix.ipojo.test.scenarios.component.inherited.ProcessImplementation3"
+ name="PS-PI3" architecture="true">
+ <provides />
+ </component>
+</ipojo>