Split the composite test suite
Add the annotation test suite (checking annotations processing)
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@652169 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/ipojo/tests/pom.xml b/ipojo/tests/pom.xml
index 0f42790..04c9532 100644
--- a/ipojo/tests/pom.xml
+++ b/ipojo/tests/pom.xml
@@ -31,10 +31,36 @@
<module>tests.core.service.providing</module>
<module>tests.core.lifecycle.callback</module>
<module>tests.core.service.dependency</module>
+ <module>tests.core.service.dependency.bindingpolicy</module>
+ <module>tests.core.service.dependency.filter</module>
<module>tests.core.configuration</module>
<module>tests.core.external.handlers</module>
<module>tests.core.bad.configurations</module>
<module>tests.composite</module>
+ <module>tests.composite.service.import-export</module>
+ <module>tests.composite.service.instance</module>
+ <module>tests.composite.service.providing</module>
</modules>
+
+ <profiles>
+ <profile>
+ <id>java5</id>
+ <activation>
+ <jdk>1.5</jdk>
+ </activation>
+ <modules>
+ <module>tests.core.annotations</module>
+ </modules>
+ </profile>
+ <profile>
+ <id>java6</id>
+ <activation>
+ <jdk>1.6</jdk>
+ </activation>
+ <modules>
+ <module>tests.core.annotations</module>
+ </modules>
+ </profile>
+ </profiles>
</project>
\ No newline at end of file
diff --git a/ipojo/tests/tests.composite.service.import-export/pom.xml b/ipojo/tests/tests.composite.service.import-export/pom.xml
new file mode 100644
index 0000000..50fdc8d
--- /dev/null
+++ b/ipojo/tests/tests.composite.service.import-export/pom.xml
@@ -0,0 +1,101 @@
+<!--
+ 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 Composite (Service Import/Export) Test Suite</name>
+ <artifactId>tests.composite.service.import-export</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.composite</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>
+ <dependency>
+ <groupId>ipojo.tests</groupId>
+ <artifactId>tests.composite</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>
+ <Bundle-SymbolicName>
+ ${pom.artifactId}
+ </Bundle-SymbolicName>
+ <Private-Package>
+ org.apache.felix.ipojo.test.composite.exporter, org.apache.felix.ipojo.test.composite.importer
+ </Private-Package>
+ <Test-Suite>
+ org.apache.felix.ipojo.test.composite.importer.ImportTestSuite, org.apache.felix.ipojo.test.composite.exporter.ExportTestSuite
+ </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>
+ </plugins>
+ </build>
+</project>
diff --git a/ipojo/tests/tests.composite/src/main/java/org/apache/felix/ipojo/test/composite/exporter/ExportTestSuite.java b/ipojo/tests/tests.composite.service.import-export/src/main/java/org/apache/felix/ipojo/test/composite/exporter/ExportTestSuite.java
similarity index 100%
rename from ipojo/tests/tests.composite/src/main/java/org/apache/felix/ipojo/test/composite/exporter/ExportTestSuite.java
rename to ipojo/tests/tests.composite.service.import-export/src/main/java/org/apache/felix/ipojo/test/composite/exporter/ExportTestSuite.java
diff --git a/ipojo/tests/tests.composite/src/main/java/org/apache/felix/ipojo/test/composite/exporter/FilteredExport.java b/ipojo/tests/tests.composite.service.import-export/src/main/java/org/apache/felix/ipojo/test/composite/exporter/FilteredExport.java
similarity index 100%
rename from ipojo/tests/tests.composite/src/main/java/org/apache/felix/ipojo/test/composite/exporter/FilteredExport.java
rename to ipojo/tests/tests.composite.service.import-export/src/main/java/org/apache/felix/ipojo/test/composite/exporter/FilteredExport.java
diff --git a/ipojo/tests/tests.composite/src/main/java/org/apache/felix/ipojo/test/composite/exporter/MultipleExport.java b/ipojo/tests/tests.composite.service.import-export/src/main/java/org/apache/felix/ipojo/test/composite/exporter/MultipleExport.java
similarity index 100%
rename from ipojo/tests/tests.composite/src/main/java/org/apache/felix/ipojo/test/composite/exporter/MultipleExport.java
rename to ipojo/tests/tests.composite.service.import-export/src/main/java/org/apache/felix/ipojo/test/composite/exporter/MultipleExport.java
diff --git a/ipojo/tests/tests.composite/src/main/java/org/apache/felix/ipojo/test/composite/exporter/OptionalExport.java b/ipojo/tests/tests.composite.service.import-export/src/main/java/org/apache/felix/ipojo/test/composite/exporter/OptionalExport.java
similarity index 100%
rename from ipojo/tests/tests.composite/src/main/java/org/apache/felix/ipojo/test/composite/exporter/OptionalExport.java
rename to ipojo/tests/tests.composite.service.import-export/src/main/java/org/apache/felix/ipojo/test/composite/exporter/OptionalExport.java
diff --git a/ipojo/tests/tests.composite/src/main/java/org/apache/felix/ipojo/test/composite/exporter/OptionalMultipleExport.java b/ipojo/tests/tests.composite.service.import-export/src/main/java/org/apache/felix/ipojo/test/composite/exporter/OptionalMultipleExport.java
similarity index 100%
rename from ipojo/tests/tests.composite/src/main/java/org/apache/felix/ipojo/test/composite/exporter/OptionalMultipleExport.java
rename to ipojo/tests/tests.composite.service.import-export/src/main/java/org/apache/felix/ipojo/test/composite/exporter/OptionalMultipleExport.java
diff --git a/ipojo/tests/tests.composite/src/main/java/org/apache/felix/ipojo/test/composite/exporter/SimpleExport.java b/ipojo/tests/tests.composite.service.import-export/src/main/java/org/apache/felix/ipojo/test/composite/exporter/SimpleExport.java
similarity index 100%
rename from ipojo/tests/tests.composite/src/main/java/org/apache/felix/ipojo/test/composite/exporter/SimpleExport.java
rename to ipojo/tests/tests.composite.service.import-export/src/main/java/org/apache/felix/ipojo/test/composite/exporter/SimpleExport.java
diff --git a/ipojo/tests/tests.composite/src/main/java/org/apache/felix/ipojo/test/composite/importer/DelayedFilteredImport.java b/ipojo/tests/tests.composite.service.import-export/src/main/java/org/apache/felix/ipojo/test/composite/importer/DelayedFilteredImport.java
similarity index 100%
rename from ipojo/tests/tests.composite/src/main/java/org/apache/felix/ipojo/test/composite/importer/DelayedFilteredImport.java
rename to ipojo/tests/tests.composite.service.import-export/src/main/java/org/apache/felix/ipojo/test/composite/importer/DelayedFilteredImport.java
diff --git a/ipojo/tests/tests.composite/src/main/java/org/apache/felix/ipojo/test/composite/importer/DelayedMultipleImport.java b/ipojo/tests/tests.composite.service.import-export/src/main/java/org/apache/felix/ipojo/test/composite/importer/DelayedMultipleImport.java
similarity index 100%
rename from ipojo/tests/tests.composite/src/main/java/org/apache/felix/ipojo/test/composite/importer/DelayedMultipleImport.java
rename to ipojo/tests/tests.composite.service.import-export/src/main/java/org/apache/felix/ipojo/test/composite/importer/DelayedMultipleImport.java
diff --git a/ipojo/tests/tests.composite/src/main/java/org/apache/felix/ipojo/test/composite/importer/DelayedOptionalImport.java b/ipojo/tests/tests.composite.service.import-export/src/main/java/org/apache/felix/ipojo/test/composite/importer/DelayedOptionalImport.java
similarity index 100%
rename from ipojo/tests/tests.composite/src/main/java/org/apache/felix/ipojo/test/composite/importer/DelayedOptionalImport.java
rename to ipojo/tests/tests.composite.service.import-export/src/main/java/org/apache/felix/ipojo/test/composite/importer/DelayedOptionalImport.java
diff --git a/ipojo/tests/tests.composite/src/main/java/org/apache/felix/ipojo/test/composite/importer/DelayedOptionalMultipleImport.java b/ipojo/tests/tests.composite.service.import-export/src/main/java/org/apache/felix/ipojo/test/composite/importer/DelayedOptionalMultipleImport.java
similarity index 100%
rename from ipojo/tests/tests.composite/src/main/java/org/apache/felix/ipojo/test/composite/importer/DelayedOptionalMultipleImport.java
rename to ipojo/tests/tests.composite.service.import-export/src/main/java/org/apache/felix/ipojo/test/composite/importer/DelayedOptionalMultipleImport.java
diff --git a/ipojo/tests/tests.composite/src/main/java/org/apache/felix/ipojo/test/composite/importer/DelayedSimpleImport.java b/ipojo/tests/tests.composite.service.import-export/src/main/java/org/apache/felix/ipojo/test/composite/importer/DelayedSimpleImport.java
similarity index 100%
rename from ipojo/tests/tests.composite/src/main/java/org/apache/felix/ipojo/test/composite/importer/DelayedSimpleImport.java
rename to ipojo/tests/tests.composite.service.import-export/src/main/java/org/apache/felix/ipojo/test/composite/importer/DelayedSimpleImport.java
diff --git a/ipojo/tests/tests.composite/src/main/java/org/apache/felix/ipojo/test/composite/importer/FilteredImport.java b/ipojo/tests/tests.composite.service.import-export/src/main/java/org/apache/felix/ipojo/test/composite/importer/FilteredImport.java
similarity index 100%
rename from ipojo/tests/tests.composite/src/main/java/org/apache/felix/ipojo/test/composite/importer/FilteredImport.java
rename to ipojo/tests/tests.composite.service.import-export/src/main/java/org/apache/felix/ipojo/test/composite/importer/FilteredImport.java
diff --git a/ipojo/tests/tests.composite/src/main/java/org/apache/felix/ipojo/test/composite/importer/ImportTestSuite.java b/ipojo/tests/tests.composite.service.import-export/src/main/java/org/apache/felix/ipojo/test/composite/importer/ImportTestSuite.java
similarity index 100%
rename from ipojo/tests/tests.composite/src/main/java/org/apache/felix/ipojo/test/composite/importer/ImportTestSuite.java
rename to ipojo/tests/tests.composite.service.import-export/src/main/java/org/apache/felix/ipojo/test/composite/importer/ImportTestSuite.java
diff --git a/ipojo/tests/tests.composite/src/main/java/org/apache/felix/ipojo/test/composite/importer/MultipleImport.java b/ipojo/tests/tests.composite.service.import-export/src/main/java/org/apache/felix/ipojo/test/composite/importer/MultipleImport.java
similarity index 100%
rename from ipojo/tests/tests.composite/src/main/java/org/apache/felix/ipojo/test/composite/importer/MultipleImport.java
rename to ipojo/tests/tests.composite.service.import-export/src/main/java/org/apache/felix/ipojo/test/composite/importer/MultipleImport.java
diff --git a/ipojo/tests/tests.composite/src/main/java/org/apache/felix/ipojo/test/composite/importer/OptionalImport.java b/ipojo/tests/tests.composite.service.import-export/src/main/java/org/apache/felix/ipojo/test/composite/importer/OptionalImport.java
similarity index 100%
rename from ipojo/tests/tests.composite/src/main/java/org/apache/felix/ipojo/test/composite/importer/OptionalImport.java
rename to ipojo/tests/tests.composite.service.import-export/src/main/java/org/apache/felix/ipojo/test/composite/importer/OptionalImport.java
diff --git a/ipojo/tests/tests.composite/src/main/java/org/apache/felix/ipojo/test/composite/importer/OptionalMultipleImport.java b/ipojo/tests/tests.composite.service.import-export/src/main/java/org/apache/felix/ipojo/test/composite/importer/OptionalMultipleImport.java
similarity index 100%
rename from ipojo/tests/tests.composite/src/main/java/org/apache/felix/ipojo/test/composite/importer/OptionalMultipleImport.java
rename to ipojo/tests/tests.composite.service.import-export/src/main/java/org/apache/felix/ipojo/test/composite/importer/OptionalMultipleImport.java
diff --git a/ipojo/tests/tests.composite/src/main/java/org/apache/felix/ipojo/test/composite/importer/SimpleImport.java b/ipojo/tests/tests.composite.service.import-export/src/main/java/org/apache/felix/ipojo/test/composite/importer/SimpleImport.java
similarity index 100%
rename from ipojo/tests/tests.composite/src/main/java/org/apache/felix/ipojo/test/composite/importer/SimpleImport.java
rename to ipojo/tests/tests.composite.service.import-export/src/main/java/org/apache/felix/ipojo/test/composite/importer/SimpleImport.java
diff --git a/ipojo/tests/tests.composite.service.import-export/src/main/resources/metadata.xml b/ipojo/tests/tests.composite.service.import-export/src/main/resources/metadata.xml
new file mode 100644
index 0000000..cb1e07f
--- /dev/null
+++ b/ipojo/tests/tests.composite.service.import-export/src/main/resources/metadata.xml
@@ -0,0 +1,82 @@
+<ipojo
+ xmlns:cs="org.apache.felix.ipojo.test.composite.handler.CheckServiceHandler">
+ <composite name="composite.requires.1" architecture="true">
+ <subservice action="import"
+ specification="org.apache.felix.ipojo.test.composite.service.FooService"
+ scope="composite" />
+ </composite>
+
+ <composite name="composite.requires.2" architecture="true">
+ <subservice action="import"
+ specification="org.apache.felix.ipojo.test.composite.service.FooService"
+ aggregate="true" scope="composite" />
+ </composite>
+
+ <composite name="composite.requires.3" architecture="true">
+ <subservice action="import"
+ specification="org.apache.felix.ipojo.test.composite.service.FooService"
+ optional="true" scope="composite" />
+ </composite>
+
+ <composite name="composite.requires.4" architecture="true">
+ <subservice action="import"
+ specification="org.apache.felix.ipojo.test.composite.service.FooService"
+ optional="true" aggregate="true" scope="composite" />
+ </composite>
+
+ <composite name="composite.requires.5" architecture="true">
+ <subservice action="import"
+ specification="org.apache.felix.ipojo.test.composite.service.FooService"
+ filter="(&(int=2)(long=40))" scope="composite" />
+ </composite>
+
+ <composite name="composite.export.1" architecture="true">
+ <subservice action="import"
+ specification="org.apache.felix.ipojo.test.composite.service.BazService"
+ aggregate="true" optional="true" filter="(!(instance.name=export))"
+ scope="composite" />
+ <provides action="export"
+ specification="org.apache.felix.ipojo.test.composite.service.BazService" />
+ </composite>
+
+ <composite name="composite.export.2" architecture="true">
+ <subservice action="import"
+ specification="org.apache.felix.ipojo.test.composite.service.BazService"
+ scope="composite" aggregate="true" optional="true"
+ filter="(!(instance.name=export))" />
+ <provides action="export"
+ specification="org.apache.felix.ipojo.test.composite.service.BazService"
+ optional="true" />
+ </composite>
+
+ <composite name="composite.export.3" architecture="true">
+ <subservice action="import"
+ specification="org.apache.felix.ipojo.test.composite.service.BazService"
+ scope="composite" aggregate="true" optional="true"
+ filter="(!(instance.name=export))" />
+ <provides action="export"
+ specification="org.apache.felix.ipojo.test.composite.service.BazService"
+ aggregate="true" />
+ </composite>
+
+ <composite name="composite.export.4" architecture="true">
+ <subservice action="import"
+ specification="org.apache.felix.ipojo.test.composite.service.BazService"
+ aggregate="true" optional="true" filter="(!(instance.name=export))"
+ scope="composite" />
+ <provides action="export"
+ specification="org.apache.felix.ipojo.test.composite.service.BazService"
+ aggregate="true" optional="true" />
+ </composite>
+
+ <composite name="composite.export.5" architecture="true">
+ <subservice action="import"
+ specification="org.apache.felix.ipojo.test.composite.service.BazService"
+ aggregate="true" optional="true" filter="(!(instance.name=export))"
+ scope="composite" />
+ <provides action="export"
+ specification="org.apache.felix.ipojo.test.composite.service.BazService"
+ filter="(instance.name=foo1)" />
+ </composite>
+
+</ipojo>
diff --git a/ipojo/tests/tests.composite.service.instance/pom.xml b/ipojo/tests/tests.composite.service.instance/pom.xml
new file mode 100644
index 0000000..8e07d00
--- /dev/null
+++ b/ipojo/tests/tests.composite.service.instance/pom.xml
@@ -0,0 +1,101 @@
+<!--
+ 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 Composite (Service Instance) Test Suite</name>
+ <artifactId>tests.composite.service.instance</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.composite</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>
+ <dependency>
+ <groupId>ipojo.tests</groupId>
+ <artifactId>tests.composite</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>
+ <Bundle-SymbolicName>
+ ${pom.artifactId}
+ </Bundle-SymbolicName>
+ <Private-Package>
+ org.apache.felix.ipojo.test.composite.instantiator*, org.apache.felix.ipojo.test.composite.instance
+ </Private-Package>
+ <Test-Suite>
+ org.apache.felix.ipojo.test.composite.instantiator.InstantiatorTestSuite
+ </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>
+ </plugins>
+ </build>
+</project>
diff --git a/ipojo/tests/tests.composite/src/main/java/org/apache/felix/ipojo/test/composite/instance/SimpleInstance.java b/ipojo/tests/tests.composite.service.instance/src/main/java/org/apache/felix/ipojo/test/composite/instance/SimpleInstance.java
similarity index 100%
rename from ipojo/tests/tests.composite/src/main/java/org/apache/felix/ipojo/test/composite/instance/SimpleInstance.java
rename to ipojo/tests/tests.composite.service.instance/src/main/java/org/apache/felix/ipojo/test/composite/instance/SimpleInstance.java
diff --git a/ipojo/tests/tests.composite/src/main/java/org/apache/felix/ipojo/test/composite/instantiator/ConfigurableInstantiation.java b/ipojo/tests/tests.composite.service.instance/src/main/java/org/apache/felix/ipojo/test/composite/instantiator/ConfigurableInstantiation.java
similarity index 100%
rename from ipojo/tests/tests.composite/src/main/java/org/apache/felix/ipojo/test/composite/instantiator/ConfigurableInstantiation.java
rename to ipojo/tests/tests.composite.service.instance/src/main/java/org/apache/felix/ipojo/test/composite/instantiator/ConfigurableInstantiation.java
diff --git a/ipojo/tests/tests.composite/src/main/java/org/apache/felix/ipojo/test/composite/instantiator/InstantiatorTestSuite.java b/ipojo/tests/tests.composite.service.instance/src/main/java/org/apache/felix/ipojo/test/composite/instantiator/InstantiatorTestSuite.java
similarity index 92%
rename from ipojo/tests/tests.composite/src/main/java/org/apache/felix/ipojo/test/composite/instantiator/InstantiatorTestSuite.java
rename to ipojo/tests/tests.composite.service.instance/src/main/java/org/apache/felix/ipojo/test/composite/instantiator/InstantiatorTestSuite.java
index 7497b3a..796bb62 100644
--- a/ipojo/tests/tests.composite/src/main/java/org/apache/felix/ipojo/test/composite/instantiator/InstantiatorTestSuite.java
+++ b/ipojo/tests/tests.composite.service.instance/src/main/java/org/apache/felix/ipojo/test/composite/instantiator/InstantiatorTestSuite.java
@@ -21,6 +21,7 @@
import junit.framework.Test;
import org.apache.felix.ipojo.junit4osgi.OSGiTestSuite;
+import org.apache.felix.ipojo.test.composite.instance.SimpleInstance;
import org.osgi.framework.BundleContext;
public class InstantiatorTestSuite {
@@ -32,6 +33,7 @@
ots.addTestSuite(MultipleInstantiation.class);
ots.addTestSuite(OptionalMultipleInstantiation.class);
ots.addTestSuite(ConfigurableInstantiation.class);
+ ots.addTestSuite(SimpleInstance.class);
return ots;
}
diff --git a/ipojo/tests/tests.composite/src/main/java/org/apache/felix/ipojo/test/composite/instantiator/MultipleInstantiation.java b/ipojo/tests/tests.composite.service.instance/src/main/java/org/apache/felix/ipojo/test/composite/instantiator/MultipleInstantiation.java
similarity index 100%
rename from ipojo/tests/tests.composite/src/main/java/org/apache/felix/ipojo/test/composite/instantiator/MultipleInstantiation.java
rename to ipojo/tests/tests.composite.service.instance/src/main/java/org/apache/felix/ipojo/test/composite/instantiator/MultipleInstantiation.java
diff --git a/ipojo/tests/tests.composite/src/main/java/org/apache/felix/ipojo/test/composite/instantiator/OptionalInstantiation.java b/ipojo/tests/tests.composite.service.instance/src/main/java/org/apache/felix/ipojo/test/composite/instantiator/OptionalInstantiation.java
similarity index 100%
rename from ipojo/tests/tests.composite/src/main/java/org/apache/felix/ipojo/test/composite/instantiator/OptionalInstantiation.java
rename to ipojo/tests/tests.composite.service.instance/src/main/java/org/apache/felix/ipojo/test/composite/instantiator/OptionalInstantiation.java
diff --git a/ipojo/tests/tests.composite/src/main/java/org/apache/felix/ipojo/test/composite/instantiator/OptionalMultipleInstantiation.java b/ipojo/tests/tests.composite.service.instance/src/main/java/org/apache/felix/ipojo/test/composite/instantiator/OptionalMultipleInstantiation.java
similarity index 100%
rename from ipojo/tests/tests.composite/src/main/java/org/apache/felix/ipojo/test/composite/instantiator/OptionalMultipleInstantiation.java
rename to ipojo/tests/tests.composite.service.instance/src/main/java/org/apache/felix/ipojo/test/composite/instantiator/OptionalMultipleInstantiation.java
diff --git a/ipojo/tests/tests.composite/src/main/java/org/apache/felix/ipojo/test/composite/instantiator/SimpleInstantiation.java b/ipojo/tests/tests.composite.service.instance/src/main/java/org/apache/felix/ipojo/test/composite/instantiator/SimpleInstantiation.java
similarity index 100%
rename from ipojo/tests/tests.composite/src/main/java/org/apache/felix/ipojo/test/composite/instantiator/SimpleInstantiation.java
rename to ipojo/tests/tests.composite.service.instance/src/main/java/org/apache/felix/ipojo/test/composite/instantiator/SimpleInstantiation.java
diff --git a/ipojo/tests/tests.composite.service.instance/src/main/resources/metadata.xml b/ipojo/tests/tests.composite.service.instance/src/main/resources/metadata.xml
new file mode 100644
index 0000000..dc1c764
--- /dev/null
+++ b/ipojo/tests/tests.composite.service.instance/src/main/resources/metadata.xml
@@ -0,0 +1,54 @@
+<ipojo xmlns:cs="org.apache.felix.ipojo.test.composite.handler.CheckServiceHandler">
+ <composite name="composite.bar.1" architecture="true">
+ <subservice action="instantiate" specification="org.apache.felix.ipojo.test.composite.service.BarService"/>
+ </composite>
+
+ <composite name="composite.bar.2" architecture="true">
+ <subservice action="instantiate" specification="org.apache.felix.ipojo.test.composite.service.BarService" aggregate="true"/>
+ </composite>
+
+ <composite name="composite.bar.3" architecture="true">
+ <subservice action="instantiate" specification="org.apache.felix.ipojo.test.composite.service.BarService" optional="true"/>
+ </composite>
+
+ <composite name="composite.bar.4" architecture="true">
+ <subservice action="instantiate" specification="org.apache.felix.ipojo.test.composite.service.FooService" aggregate="true" optional="true"/>
+ </composite>
+
+ <composite name="composite.bar.5-accept" architecture="true">
+ <subservice action="instantiate" specification="org.apache.felix.ipojo.test.composite.service.FooService">
+ <property name="boolean" value="true"/>
+ <property name="string" value="foo"/>
+ <property name="strAprop" value="{foo, bar, baz}"/>
+ <property name="int" value="5"/>
+ </subservice>
+ </composite>
+
+ <composite name="composite.bar.5-refuse1" architecture="true">
+ <subservice action="instantiate" specification="org.apache.felix.ipojo.test.composite.service.BarService">
+ <property name="foo" value="bar"/>
+ <property name="boolean" value="true"/>
+ <property name="string" value="foo"/>
+ <property name="strAprop" value="{foo, bar, baz}"/>
+ <property name="int" value="5"/>
+ </subservice>
+ </composite>
+
+ <composite name="composite.bar.5-refuse2" architecture="true">
+ <subservice action="instantiate" specification="org.apache.felix.ipojo.test.composite.service.BarService">
+ <property name="string" value="foo"/>
+ <property name="strAprop" value="{foo, bar, baz}"/>
+ </subservice>
+ </composite>
+
+ <!-- Instance of a specified component -->
+ <composite name="composite.inst.1" factory="true" architecture="true">
+ <instance component="COMPO-FooProviderType-1" /> <!-- name="FooProv" -->
+ <instance component="COMPO-FooProviderType-Dyn2">
+ <property name="boolean" value="true"/>
+ <property name="string" value="foo"/>
+ <property name="strAProp" value="{a,b,c}"/>
+ </instance>
+ </composite>
+
+</ipojo>
diff --git a/ipojo/tests/tests.composite/pom.xml b/ipojo/tests/tests.composite/pom.xml
index 9162a38..7661528 100644
--- a/ipojo/tests/tests.composite/pom.xml
+++ b/ipojo/tests/tests.composite/pom.xml
@@ -65,7 +65,7 @@
<configuration>
<instructions>
<Export-Package>
- org.apache.felix.ipojo.test.composite.service
+ org.apache.felix.ipojo.test.composite.service, org.apache.felix.ipojo.test.composite.component, org.apache.felix.ipojo.test.composite.util
</Export-Package>
<Bundle-SymbolicName>
${pom.artifactId}
diff --git a/ipojo/tests/tests.composite/src/main/java/org/apache/felix/ipojo/test/composite/CompositeTestSuite.java b/ipojo/tests/tests.composite/src/main/java/org/apache/felix/ipojo/test/composite/CompositeTestSuite.java
index efa9de3..a3bd8df 100644
--- a/ipojo/tests/tests.composite/src/main/java/org/apache/felix/ipojo/test/composite/CompositeTestSuite.java
+++ b/ipojo/tests/tests.composite/src/main/java/org/apache/felix/ipojo/test/composite/CompositeTestSuite.java
@@ -21,13 +21,7 @@
import junit.framework.Test;
import org.apache.felix.ipojo.junit4osgi.OSGiTestSuite;
-import org.apache.felix.ipojo.test.composite.exporter.ExportTestSuite;
-import org.apache.felix.ipojo.test.composite.importer.ImportTestSuite;
import org.apache.felix.ipojo.test.composite.infrastructure.InfrastructureTestSuite;
-import org.apache.felix.ipojo.test.composite.instance.SimpleInstance;
-import org.apache.felix.ipojo.test.composite.instantiator.InstantiatorTestSuite;
-import org.apache.felix.ipojo.test.composite.provides.ProvidesTestSuite;
-import org.apache.felix.ipojo.test.composite.test.CompositeTest;
import org.osgi.framework.BundleContext;
public class CompositeTestSuite {
@@ -35,13 +29,6 @@
public static Test suite(BundleContext bc) {
OSGiTestSuite ots = new OSGiTestSuite("iPOJO Composites Test Suite", bc);
ots.addTest(InfrastructureTestSuite.suite(bc));
- ots.addTest(InstantiatorTestSuite.suite(bc));
- ots.addTest(ImportTestSuite.suite(bc));
- ots.addTest(ExportTestSuite.suite(bc));
- ots.addTestSuite(CompositeTest.class);
- ots.addTestSuite(SimpleInstance.class);
- ots.addTest(ProvidesTestSuite.suite(bc));
-
return ots;
}
diff --git a/ipojo/tests/tests.composite/src/main/java/org/apache/felix/ipojo/test/composite/provides/ProvidesTestSuite.java b/ipojo/tests/tests.composite/src/main/java/org/apache/felix/ipojo/test/composite/provides/ProvidesTestSuite.java
deleted file mode 100644
index 413ff58..0000000
--- a/ipojo/tests/tests.composite/src/main/java/org/apache/felix/ipojo/test/composite/provides/ProvidesTestSuite.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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.composite.provides;
-
-import junit.framework.Test;
-
-import org.apache.felix.ipojo.junit4osgi.OSGiTestSuite;
-import org.osgi.framework.BundleContext;
-
-public class ProvidesTestSuite {
-
- public static Test suite(BundleContext bc) {
- OSGiTestSuite ots = new OSGiTestSuite("Composite Service Providing Test Suite", bc);
- ots.addTestSuite(TestComp0.class);
- ots.addTestSuite(TestComp1.class);
- ots.addTestSuite(TestComp2.class);
- ots.addTestSuite(TestComp3.class);
- ots.addTestSuite(TestComp4.class);
- ots.addTestSuite(TestComp5.class);
- ots.addTestSuite(TestComp6.class);
- ots.addTestSuite(TestComp7.class);
- ots.addTestSuite(TestComp8.class);
-
- return ots;
- }
-
-}
diff --git a/ipojo/tests/tests.composite/src/main/java/org/apache/felix/ipojo/test/composite/provides/TestComp0.java b/ipojo/tests/tests.composite/src/main/java/org/apache/felix/ipojo/test/composite/provides/TestComp0.java
deleted file mode 100644
index d3e26a8..0000000
--- a/ipojo/tests/tests.composite/src/main/java/org/apache/felix/ipojo/test/composite/provides/TestComp0.java
+++ /dev/null
@@ -1,339 +0,0 @@
-/*
- * 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.composite.provides;
-
-import java.util.Properties;
-
-import org.apache.felix.ipojo.ComponentFactory;
-import org.apache.felix.ipojo.ComponentInstance;
-import org.apache.felix.ipojo.Factory;
-import org.apache.felix.ipojo.architecture.Architecture;
-import org.apache.felix.ipojo.junit4osgi.OSGiTestCase;
-import org.apache.felix.ipojo.test.composite.component.TotoProvider;
-import org.apache.felix.ipojo.test.composite.service.Tota;
-import org.apache.felix.ipojo.test.composite.service.Toto;
-import org.apache.felix.ipojo.test.composite.util.Utils;
-import org.osgi.framework.ServiceReference;
-
-public class TestComp0 extends OSGiTestCase {
-
- private ComponentFactory tataFactory;
- private ComponentFactory totoFactory;
- private ComponentFactory tataFactory2;
-
- private ComponentInstance totoProv, totoProv2;
- private ComponentInstance under;
-
- public void setUp() {
- tataFactory = (ComponentFactory) Utils.getFactoryByName(context, "tata");
- totoFactory = (ComponentFactory) Utils.getFactoryByName(context, "toto");
- tataFactory2 = (ComponentFactory) Utils.getFactoryByName(context, "comp-6");
- tataFactory2.stop();
- tataFactory.stop();
-
- Properties props = new Properties();
- props.put("name", "toto provider");
- try {
- totoProv = totoFactory.createComponentInstance(props);
- } catch(Exception e) {
- fail("Cannot create an instance : " + e.getMessage());
- }
-
- Properties props3 = new Properties();
- props3.put("name", "toto provider 2");
- try {
- totoProv2 = totoFactory.createComponentInstance(props3);
- } catch(Exception e) {
- fail("Cannot create an instance : " + e.getMessage());
- }
-
- totoProv.stop();
- totoProv2.stop();
-
- Factory factory = Utils.getFactoryByName(context, "comp-0");
- Properties props2 = new Properties();
- props2.put("name", "ff");
- try {
- under = factory.createComponentInstance(props2);
- } catch(Exception e) {
- e.printStackTrace();
- fail("Cannot create an instance : " + e.getMessage());
- }
- }
-
- public void tearDown() {
- tataFactory.start();
- totoProv.dispose();
- totoProv = null;
- totoProv2.dispose();
- totoProv2 = null;
- tataFactory2.start();
-
- // Reset counters
- TotoProvider.toto = 0;
- TotoProvider.toto_2 = 0;
- TotoProvider.toto_3 = 0;
- TotoProvider.toto_4 = 0;
- TotoProvider.toto1 = 0;
- }
-
- public void testSimple() {
- // Neither factory nor instance
- assertTrue("Assert under state - 1", under.getState() == ComponentInstance.INVALID);
- assertNull("Assert no tota service - 1", context.getServiceReference(Tota.class.getName()));
-
- // Start the importer
- totoProv.start();
- assertNotNull("Assert toto service - 1", context.getServiceReference(Toto.class.getName()));
- assertTrue("Assert under state - 2", under.getState() == ComponentInstance.INVALID);
- assertNull("Assert no tota service - 2", context.getServiceReference(Tota.class.getName()));
-
- // Start the factory
- tataFactory.start();
- assertTrue("Assert under state - 3", under.getState() == ComponentInstance.VALID);
- assertNotNull("Assert tota service - 3", context.getServiceReference(Tota.class.getName()));
- ServiceReference ref = context.getServiceReference(Tota.class.getName());
- Tota tota = (Tota) context.getService(ref);
- invokeAll(tota);
- // Check toto
- Properties props = tota.getProps();
- Integer toto = (Integer) props.get("toto");
- Integer toto_2 = (Integer) props.get("toto_2");
- Integer toto_3 = (Integer) props.get("toto_3");
- Integer toto_4 = (Integer) props.get("toto_4");
- assertEquals("Assert toto - 3", toto.intValue(), 1);
- assertEquals("Assert toto_2 - 3", toto_2.intValue(), 1);
- assertEquals("Assert toto_3 - 3", toto_3.intValue(), 1);
- assertEquals("Assert toto_4 - 3", toto_4.intValue(), 0);
- //Check tata
- props = tota.getPropsTata();
- Integer tata = (Integer) props.get("tata");
- Integer tataStr = (Integer) props.get("tataStr");
- Integer tataStrs = (Integer) props.get("tataStrs");
- Integer tata_2 = (Integer) props.get("tata_2");
- Integer tata_3 = (Integer) props.get("tata_3");
- Integer tata1 = (Integer) props.get("tata1");
- Integer tata1_1 = (Integer) props.get("tata1_1");
- Integer tata5 = (Integer) props.get("tata5");
- Integer tata5_1 = (Integer) props.get("tata5_1");
- Integer tata5_2 = (Integer) props.get("tata5_2");
- assertEquals("Assert tata - 3", tata.intValue(), 1);
- assertEquals("Assert tataStr - 3", tataStr.intValue(), 1);
- assertEquals("Assert tataStrs - 3", tataStrs.intValue(), 0);
- assertEquals("Assert tata_2 - 3", tata_2.intValue(), 1);
- assertEquals("Assert tata_3 - 3", tata_3.intValue(), 1);
- assertEquals("Assert tata1 - 3", tata1.intValue(), 1);
- assertEquals("Assert tata1_1 - 3", tata1_1.intValue(), 1);
- assertEquals("Assert tata5 - 3", tata5.intValue(), 1);
- assertEquals("Assert tata5_1 - 3", tata5_1.intValue(), 1);
- assertEquals("Assert tata5_2 - 3", tata5_2.intValue(), 1);
-
- context.ungetService(ref);
- tota = null;
-
- // Start a second import
- totoProv2.start();
- assertTrue("Assert under state - 4", under.getState() == ComponentInstance.VALID);
- assertNotNull("Assert tota service - 4", context.getServiceReference(Tota.class.getName()));
- ref = context.getServiceReference(Tota.class.getName());
- tota = (Tota) context.getService(ref);
- invokeAll(tota);
- // Check toto
- props = tota.getProps();
- toto = (Integer) props.get("toto");
- toto_2 = (Integer) props.get("toto_2");
- toto_3 = (Integer) props.get("toto_3");
- toto_4 = (Integer) props.get("toto_4");
- assertEquals("Assert toto - 4", toto.intValue(), 2);
- assertEquals("Assert toto_2 - 4", toto_2.intValue(), 2);
- assertEquals("Assert toto_3 - 4", toto_3.intValue(), 2);
- assertEquals("Assert toto_4 - 4", toto_4.intValue(), 0);
- //Check tata
- props = tota.getPropsTata();
- tata = (Integer) props.get("tata");
- tataStr = (Integer) props.get("tataStr");
- tataStrs = (Integer) props.get("tataStrs");
- tata_2 = (Integer) props.get("tata_2");
- tata_3 = (Integer) props.get("tata_3");
- tata1 = (Integer) props.get("tata1");
- tata1_1 = (Integer) props.get("tata1_1");
- tata5 = (Integer) props.get("tata5");
- tata5_1 = (Integer) props.get("tata5_1");
- tata5_2 = (Integer) props.get("tata5_2");
- assertEquals("Assert tata - 4", tata.intValue(), 2);
- assertEquals("Assert tataStr - 4", tataStr.intValue(), 2);
- assertEquals("Assert tataStrs - 4", tataStrs.intValue(), 0);
- assertEquals("Assert tata_2 - 4", tata_2.intValue(), 2);
- assertEquals("Assert tata_3 - 4", tata_3.intValue(), 2);
- assertEquals("Assert tata1 - 4", tata1.intValue(), 2);
- assertEquals("Assert tata1_1 - 4", tata1_1.intValue(), 2);
- assertEquals("Assert tata5 - 4", tata5.intValue(), 2);
- assertEquals("Assert tata5_1 - 4", tata5_1.intValue(), 2);
- assertEquals("Assert tata5_2 - 4", tata5_2.intValue(), 2);
-
- context.ungetService(ref);
- tota = null;
-
- tataFactory.stop();
- assertTrue("Assert under state - 5", under.getState() == ComponentInstance.INVALID);
- assertNull("Assert no tota service - 5", context.getServiceReference(Tota.class.getName()));
-
- totoProv2.stop();
- tataFactory.start();
- assertTrue("Assert under state - 6", under.getState() == ComponentInstance.VALID);
- assertNotNull("Assert tota service - 6", context.getServiceReference(Tota.class.getName()));
- ref = context.getServiceReference(Tota.class.getName());
- tota = (Tota) context.getService(ref);
- invokeAll(tota);
- // Check toto
- props = tota.getProps();
- toto = (Integer) props.get("toto");
- toto_2 = (Integer) props.get("toto_2");
- toto_3 = (Integer) props.get("toto_3");
- toto_4 = (Integer) props.get("toto_4");
- assertEquals("Assert toto - 6", toto.intValue(), 3);
- assertEquals("Assert toto_2 - 6", toto_2.intValue(), 3);
- assertEquals("Assert toto_3 - 6", toto_3.intValue(), 3);
- assertEquals("Assert toto_4 - 6", toto_4.intValue(), 0);
- //Check tata
- props = tota.getPropsTata();
- tata = (Integer) props.get("tata");
- tataStr = (Integer) props.get("tataStr");
- tataStrs = (Integer) props.get("tataStrs");
- tata_2 = (Integer) props.get("tata_2");
- tata_3 = (Integer) props.get("tata_3");
- tata1 = (Integer) props.get("tata1");
- tata1_1 = (Integer) props.get("tata1_1");
- tata5 = (Integer) props.get("tata5");
- tata5_1 = (Integer) props.get("tata5_1");
- tata5_2 = (Integer) props.get("tata5_2");
- assertEquals("Assert tata - 6", tata.intValue(), 1);
- assertEquals("Assert tataStr - 6", tataStr.intValue(), 1);
- assertEquals("Assert tataStrs - 6", tataStrs.intValue(), 0);
- assertEquals("Assert tata_2 - 6", tata_2.intValue(), 1);
- assertEquals("Assert tata_3 - 6", tata_3.intValue(), 1);
- assertEquals("Assert tata1 - 6", tata1.intValue(), 1);
- assertEquals("Assert tata1_1 - 6", tata1_1.intValue(), 1);
- assertEquals("Assert tata5 - 6", tata5.intValue(), 1);
- assertEquals("Assert tata5_1 - 6", tata5_1.intValue(), 1);
- assertEquals("Assert tata5_2 - 6", tata5_2.intValue(), 1);
-
- context.ungetService(ref);
- tota = null;
-
- // Is arch exposed
- assertNotNull("Test arch", Utils.getServiceReferenceByName(context, Architecture.class.getName(), "ff"));
-
- totoProv.stop();
-
- assertTrue("Assert under state - 7", under.getState() == ComponentInstance.INVALID);
- assertNotNull("Test arch-2", Utils.getServiceReferenceByName(context, Architecture.class.getName(), "ff"));
- assertNull("Assert no tota service - 7", context.getServiceReference(Tota.class.getName()));
-
- under.dispose();
- under = null;
- }
-
-
-
- private void invoke(Tota tota) {
- tota.tata();
-
- assertEquals("Assert invoke tataint", tota.tataInt(2), 2);
- assertEquals("Assert invoke tataLong", tota.tataLong(2), 2);
- assertEquals("Assert invoke tataDouble", tota.tataDouble(2), 2);
- assertEquals("Assert invoke tataChar", tota.tataChar('a'), 'a');
- assertTrue("Assert invoke tataBoolean", tota.tataBoolean(true));
- assertEquals("Assert invoke tataByte", tota.tataByte((byte)2), 2);
- assertEquals("Assert invoke tataShort", tota.tataShort((short)5), 5);
- assertEquals("Assert invoke tataFloat", tota.tataFloat(5), 5);
-
- }
-
- private void invokeArrays(Tota tota) {
-
- int[] a = new int[] {1,2,3};
- assertEquals("Assert invoke tataint[]", tota.tataInts(a), a);
-
- long[] b = new long[] {1,2,3};
- assertEquals("Assert invoke tataLong[]", tota.tataLongs(b), b);
-
- double[] c = new double[] {1,2,3};
- assertEquals("Assert invoke tataDouble[]", tota.tataDoubles(c), c);
-
- char[] d = new char[] {'a','b', 'c'};
- assertEquals("Assert invoke tataChar[]", tota.tataChars(d), d);
-
- boolean[] e = new boolean[] {true, false};
- assertEquals("Assert invoke tataBoolean[]", tota.tataBooleans(e), e);
-
- byte[] f = new byte[] {(byte) 1};
- assertEquals("Assert invoke tataByte[]", tota.tataBytes(f), f);
-
- short[] g = new short[] {(short) 1};
- assertEquals("Assert invoke tataShort[]", tota.tataShorts(g), g);
-
- float[] h = new float[] {5,6,7};
- assertEquals("Assert invoke tataFloat[]", tota.tataFloats(h), h);
-
- }
-
- private void invokeStr(Tota tota) {
- tota.tataStr();
- }
-
- private void invokeTata(Tota tota) {
- tota.tata(1,2);
- tota.tata("tototototo");
- }
-
- private void invokeTata1(Tota tota) {
- assertEquals("Assert tata1", tota.tata1("foo"), "foo");
- assertEquals("Assert tata1 - 2", tota.tata1(new char[] {'a','b','c'}), "abc");
- }
-
- private void invokeTata5(Tota tota) {
- assertEquals("Assert tata5 -1", tota.tata5("foo",1), "foo"+1);
- assertEquals("Assert tata5 - 2", tota.tata5(new String[] {"a","b","c"}, 1), "31");
- assertEquals("Assert tata5 - 3", tota.tata5("foo", new int[] {1,2,3}), "foo3");
- }
-
- private void invokeAdd(Tota tota) {
- assertEquals("Assert add", tota.add(1,1,1), 3);
- }
-
- private void invokeToto(Tota tota) {
- tota.toto();
- assertEquals("Assert toto", tota.toto("foo"), "foo");
- tota.toto(1,2);
- }
-
- private void invokeAll(Tota tota) {
- invoke(tota);
- invokeArrays(tota);
- invokeStr(tota);
- invokeTata(tota);
- invokeTata1(tota);
- invokeTata5(tota);
- invokeAdd(tota);
- invokeToto(tota);
- }
-
-
-}
diff --git a/ipojo/tests/tests.composite/src/main/java/org/apache/felix/ipojo/test/composite/provides/TestComp1.java b/ipojo/tests/tests.composite/src/main/java/org/apache/felix/ipojo/test/composite/provides/TestComp1.java
deleted file mode 100644
index 95d64be..0000000
--- a/ipojo/tests/tests.composite/src/main/java/org/apache/felix/ipojo/test/composite/provides/TestComp1.java
+++ /dev/null
@@ -1,337 +0,0 @@
-/*
- * 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.composite.provides;
-
-import java.util.Properties;
-
-import org.apache.felix.ipojo.ComponentFactory;
-import org.apache.felix.ipojo.ComponentInstance;
-import org.apache.felix.ipojo.Factory;
-import org.apache.felix.ipojo.architecture.Architecture;
-import org.apache.felix.ipojo.junit4osgi.OSGiTestCase;
-import org.apache.felix.ipojo.test.composite.component.TotoProvider;
-import org.apache.felix.ipojo.test.composite.service.Tota;
-import org.apache.felix.ipojo.test.composite.util.Utils;
-import org.osgi.framework.ServiceReference;
-
-public class TestComp1 extends OSGiTestCase {
-
- private ComponentFactory tataFactory;
- private ComponentFactory totoFactory;
-
- private ComponentInstance totoProv, totoProv2;
- private ComponentInstance under;
- private ComponentFactory tataFactory2;
-
- public void setUp() {
- tataFactory = (ComponentFactory) Utils.getFactoryByName(context, "tata");
- totoFactory = (ComponentFactory) Utils.getFactoryByName(context, "toto");
- tataFactory2 = (ComponentFactory) Utils.getFactoryByName(context, "comp-6");
- tataFactory2.stop();
-
- tataFactory.stop();
-
- Properties props = new Properties();
- props.put("name", "toto provider");
- try {
- totoProv = totoFactory.createComponentInstance(props);
- } catch(Exception e) {
- e.printStackTrace();
- }
-
- Properties props3 = new Properties();
- props3.put("name", "toto provider 2");
- try {
- totoProv2 = totoFactory.createComponentInstance(props3);
- } catch(Exception e) {
- e.printStackTrace();
- }
-
- totoProv.stop();
- totoProv2.stop();
-
- Factory factory = Utils.getFactoryByName(context, "comp-1");
- Properties props2 = new Properties();
- try {
- under = factory.createComponentInstance(props2);
- } catch(Exception e) {
- fail("Cannot create the instance : " + e.getMessage());
- }
-
- }
-
- public void tearDown() {
- tataFactory.start();
- totoProv.dispose();
- totoProv = null;
- totoProv2.dispose();
- totoProv2 = null;
- tataFactory2.start();
-
- // Reset counters
- TotoProvider.toto = 0;
- TotoProvider.toto_2 = 0;
- TotoProvider.toto_3 = 0;
- TotoProvider.toto_4 = 0;
- TotoProvider.toto1 = 0;
- }
-
- public void testSimple() {
- // Neither factory nor instance
- assertTrue("Assert under state - 1", under.getState() == ComponentInstance.INVALID);
- assertNull("Assert no tota service - 1", context.getServiceReference(Tota.class.getName()));
-
- // Start the importer
- totoProv.start();
- assertTrue("Assert under state - 2 ("+under.getState()+")", under.getState() == ComponentInstance.INVALID);
- assertNull("Assert no tota service - 2", context.getServiceReference(Tota.class.getName()));
-
- // Start the factory
- tataFactory.start();
- assertTrue("Assert under state - 3", under.getState() == ComponentInstance.VALID);
- assertNotNull("Assert tota service - 3", context.getServiceReference(Tota.class.getName()));
- ServiceReference ref = context.getServiceReference(Tota.class.getName());
- Tota tota = (Tota) context.getService(ref);
- invokeAll(tota);
- // Check toto
- Properties props = tota.getProps();
- Integer toto = (Integer) props.get("toto");
- Integer toto_2 = (Integer) props.get("toto_2");
- Integer toto_3 = (Integer) props.get("toto_3");
- Integer toto_4 = (Integer) props.get("toto_4");
- assertEquals("Assert toto - 3 ("+toto.intValue()+")", toto.intValue(), 1);
- assertEquals("Assert toto_2 - 3", toto_2.intValue(), 1);
- assertEquals("Assert toto_3 - 3", toto_3.intValue(), 1);
- assertEquals("Assert toto_4 - 3", toto_4.intValue(), 0);
- //Check tata
- props = tota.getPropsTata();
- Integer tata = (Integer) props.get("tata");
- Integer tataStr = (Integer) props.get("tataStr");
- Integer tataStrs = (Integer) props.get("tataStrs");
- Integer tata_2 = (Integer) props.get("tata_2");
- Integer tata_3 = (Integer) props.get("tata_3");
- Integer tata1 = (Integer) props.get("tata1");
- Integer tata1_1 = (Integer) props.get("tata1_1");
- Integer tata5 = (Integer) props.get("tata5");
- Integer tata5_1 = (Integer) props.get("tata5_1");
- Integer tata5_2 = (Integer) props.get("tata5_2");
- assertEquals("Assert tata - 3", tata.intValue(), 1);
- assertEquals("Assert tataStr - 3", tataStr.intValue(), 1);
- assertEquals("Assert tataStrs - 3", tataStrs.intValue(), 0);
- assertEquals("Assert tata_2 - 3", tata_2.intValue(), 1);
- assertEquals("Assert tata_3 - 3", tata_3.intValue(), 1);
- assertEquals("Assert tata1 - 3", tata1.intValue(), 1);
- assertEquals("Assert tata1_1 - 3", tata1_1.intValue(), 1);
- assertEquals("Assert tata5 - 3", tata5.intValue(), 1);
- assertEquals("Assert tata5_1 - 3", tata5_1.intValue(), 1);
- assertEquals("Assert tata5_2 - 3", tata5_2.intValue(), 1);
-
- context.ungetService(ref);
- tota = null;
-
- // Start a second import
- totoProv2.start();
- assertTrue("Assert under state - 4", under.getState() == ComponentInstance.VALID);
- assertNotNull("Assert tota service - 4", context.getServiceReference(Tota.class.getName()));
- ref = context.getServiceReference(Tota.class.getName());
- tota = (Tota) context.getService(ref);
- invokeAll(tota);
- // Check toto
- props = tota.getProps();
- toto = (Integer) props.get("toto");
- toto_2 = (Integer) props.get("toto_2");
- toto_3 = (Integer) props.get("toto_3");
- toto_4 = (Integer) props.get("toto_4");
- assertEquals("Assert toto - 4", toto.intValue(), 2);
- assertEquals("Assert toto_2 - 4", toto_2.intValue(), 2);
- assertEquals("Assert toto_3 - 4", toto_3.intValue(), 2);
- assertEquals("Assert toto_4 - 4", toto_4.intValue(), 0);
- //Check tata
- props = tota.getPropsTata();
- tata = (Integer) props.get("tata");
- tataStr = (Integer) props.get("tataStr");
- tataStrs = (Integer) props.get("tataStrs");
- tata_2 = (Integer) props.get("tata_2");
- tata_3 = (Integer) props.get("tata_3");
- tata1 = (Integer) props.get("tata1");
- tata1_1 = (Integer) props.get("tata1_1");
- tata5 = (Integer) props.get("tata5");
- tata5_1 = (Integer) props.get("tata5_1");
- tata5_2 = (Integer) props.get("tata5_2");
- assertEquals("Assert tata - 4", tata.intValue(), 2);
- assertEquals("Assert tataStr - 4", tataStr.intValue(), 2);
- assertEquals("Assert tataStrs - 4", tataStrs.intValue(), 0);
- assertEquals("Assert tata_2 - 4", tata_2.intValue(), 2);
- assertEquals("Assert tata_3 - 4", tata_3.intValue(), 2);
- assertEquals("Assert tata1 - 4", tata1.intValue(), 2);
- assertEquals("Assert tata1_1 - 4", tata1_1.intValue(), 2);
- assertEquals("Assert tata5 - 4", tata5.intValue(), 2);
- assertEquals("Assert tata5_1 - 4", tata5_1.intValue(), 2);
- assertEquals("Assert tata5_2 - 4", tata5_2.intValue(), 2);
-
- context.ungetService(ref);
- tota = null;
-
- tataFactory.stop();
- assertTrue("Assert under state - 5", under.getState() == ComponentInstance.INVALID);
- assertNull("Assert no tota service - 5", context.getServiceReference(Tota.class.getName()));
-
- totoProv2.stop();
- tataFactory.start();
- assertTrue("Assert under state - 6", under.getState() == ComponentInstance.VALID);
- assertNotNull("Assert tota service - 6", context.getServiceReference(Tota.class.getName()));
- ref = context.getServiceReference(Tota.class.getName());
- tota = (Tota) context.getService(ref);
- invokeAll(tota);
- // Check toto
- props = tota.getProps();
- toto = (Integer) props.get("toto");
- toto_2 = (Integer) props.get("toto_2");
- toto_3 = (Integer) props.get("toto_3");
- toto_4 = (Integer) props.get("toto_4");
- assertEquals("Assert toto - 6", toto.intValue(), 3);
- assertEquals("Assert toto_2 - 6", toto_2.intValue(), 3);
- assertEquals("Assert toto_3 - 6", toto_3.intValue(), 3);
- assertEquals("Assert toto_4 - 6", toto_4.intValue(), 0);
- //Check tata
- props = tota.getPropsTata();
- tata = (Integer) props.get("tata");
- tataStr = (Integer) props.get("tataStr");
- tataStrs = (Integer) props.get("tataStrs");
- tata_2 = (Integer) props.get("tata_2");
- tata_3 = (Integer) props.get("tata_3");
- tata1 = (Integer) props.get("tata1");
- tata1_1 = (Integer) props.get("tata1_1");
- tata5 = (Integer) props.get("tata5");
- tata5_1 = (Integer) props.get("tata5_1");
- tata5_2 = (Integer) props.get("tata5_2");
- assertEquals("Assert tata - 6", tata.intValue(), 1);
- assertEquals("Assert tataStr - 6", tataStr.intValue(), 1);
- assertEquals("Assert tataStrs - 6", tataStrs.intValue(), 0);
- assertEquals("Assert tata_2 - 6", tata_2.intValue(), 1);
- assertEquals("Assert tata_3 - 6", tata_3.intValue(), 1);
- assertEquals("Assert tata1 - 6", tata1.intValue(), 1);
- assertEquals("Assert tata1_1 - 6", tata1_1.intValue(), 1);
- assertEquals("Assert tata5 - 6", tata5.intValue(), 1);
- assertEquals("Assert tata5_1 - 6", tata5_1.intValue(), 1);
- assertEquals("Assert tata5_2 - 6", tata5_2.intValue(), 1);
-
- context.ungetService(ref);
- tota = null;
-
- // Is arch exposed
- assertNotNull("Test arch", Utils.getServiceReferenceByName(context, Architecture.class.getName(), under.getInstanceName()));
-
- totoProv.stop();
-
- assertTrue("Assert under state - 7", under.getState() == ComponentInstance.INVALID);
- assertNotNull("Test arch-2", Utils.getServiceReferenceByName(context, Architecture.class.getName(), under.getInstanceName()));
- assertNull("Assert no tota service - 7", context.getServiceReference(Tota.class.getName()));
-
- under.dispose();
- under = null;
- }
-
-
-
- private void invoke(Tota tota) {
- tota.tata();
-
- assertEquals("Assert invoke tataint", tota.tataInt(2), 2);
- assertEquals("Assert invoke tataLong", tota.tataLong(2), 2);
- assertEquals("Assert invoke tataDouble", tota.tataDouble(2), 2);
- assertEquals("Assert invoke tataChar", tota.tataChar('a'), 'a');
- assertTrue("Assert invoke tataBoolean", tota.tataBoolean(true));
- assertEquals("Assert invoke tataByte", tota.tataByte((byte)2), 2);
- assertEquals("Assert invoke tataShort", tota.tataShort((short)5), 5);
- assertEquals("Assert invoke tataFloat", tota.tataFloat(5), 5);
-
- }
-
- private void invokeArrays(Tota tota) {
-
- int[] a = new int[] {1,2,3};
- assertEquals("Assert invoke tataint[]", tota.tataInts(a), a);
-
- long[] b = new long[] {1,2,3};
- assertEquals("Assert invoke tataLong[]", tota.tataLongs(b), b);
-
- double[] c = new double[] {1,2,3};
- assertEquals("Assert invoke tataDouble[]", tota.tataDoubles(c), c);
-
- char[] d = new char[] {'a','b', 'c'};
- assertEquals("Assert invoke tataChar[]", tota.tataChars(d), d);
-
- boolean[] e = new boolean[] {true, false};
- assertEquals("Assert invoke tataBoolean[]", tota.tataBooleans(e), e);
-
- byte[] f = new byte[] {(byte) 1};
- assertEquals("Assert invoke tataByte[]", tota.tataBytes(f), f);
-
- short[] g = new short[] {(short) 1};
- assertEquals("Assert invoke tataShort[]", tota.tataShorts(g), g);
-
- float[] h = new float[] {5,6,7};
- assertEquals("Assert invoke tataFloat[]", tota.tataFloats(h), h);
-
- }
-
- private void invokeStr(Tota tota) {
- tota.tataStr();
- }
-
- private void invokeTata(Tota tota) {
- tota.tata(1,2);
- tota.tata("tototototo");
- }
-
- private void invokeTata1(Tota tota) {
- assertEquals("Assert tata1", tota.tata1("foo"), "foo");
- assertEquals("Assert tata1 - 2", tota.tata1(new char[] {'a','b','c'}), "abc");
- }
-
- private void invokeTata5(Tota tota) {
- assertEquals("Assert tata5 -1", tota.tata5("foo",1), "foo"+1);
- assertEquals("Assert tata5 - 2", tota.tata5(new String[] {"a","b","c"}, 1), "31");
- assertEquals("Assert tata5 - 3", tota.tata5("foo", new int[] {1,2,3}), "foo3");
- }
-
- private void invokeAdd(Tota tota) {
- assertEquals("Assert add", tota.add(1,1,1), 3);
- }
-
- private void invokeToto(Tota tota) {
- tota.toto();
- assertEquals("Assert toto", tota.toto("foo"), "foo");
- tota.toto(1,2);
- }
-
- private void invokeAll(Tota tota) {
- invoke(tota);
- invokeArrays(tota);
- invokeStr(tota);
- invokeTata(tota);
- invokeTata1(tota);
- invokeTata5(tota);
- invokeAdd(tota);
- invokeToto(tota);
- }
-
-
-}
diff --git a/ipojo/tests/tests.composite/src/main/java/org/apache/felix/ipojo/test/composite/provides/TestComp2.java b/ipojo/tests/tests.composite/src/main/java/org/apache/felix/ipojo/test/composite/provides/TestComp2.java
deleted file mode 100644
index 763080f..0000000
--- a/ipojo/tests/tests.composite/src/main/java/org/apache/felix/ipojo/test/composite/provides/TestComp2.java
+++ /dev/null
@@ -1,232 +0,0 @@
-/*
- * 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.composite.provides;
-
-import java.util.Properties;
-
-import org.apache.felix.ipojo.ComponentFactory;
-import org.apache.felix.ipojo.ComponentInstance;
-import org.apache.felix.ipojo.Factory;
-import org.apache.felix.ipojo.architecture.Architecture;
-import org.apache.felix.ipojo.junit4osgi.OSGiTestCase;
-import org.apache.felix.ipojo.test.composite.component.TotoProvider;
-import org.apache.felix.ipojo.test.composite.service.Tota;
-import org.apache.felix.ipojo.test.composite.util.Utils;
-import org.osgi.framework.ServiceReference;
-
-public class TestComp2 extends OSGiTestCase {
-
- private ComponentFactory tataFactory;
- private ComponentFactory totoFactory;
-
- private ComponentInstance totoProv, totoProv2;
- private ComponentInstance under;
- private ComponentFactory tataFactory2;
-
- public void setUp() {
- tataFactory = (ComponentFactory) Utils.getFactoryByName(context, "tata");
- totoFactory = (ComponentFactory) Utils.getFactoryByName(context, "toto");
- tataFactory2 = (ComponentFactory) Utils.getFactoryByName(context, "comp-6");
- tataFactory2.stop();
- tataFactory.stop();
-
- Properties props = new Properties();
- props.put("name", "toto provider");
- try {
- totoProv = totoFactory.createComponentInstance(props);
- } catch(Exception e) {
- e.printStackTrace();
- }
-
- Properties props3 = new Properties();
- props3.put("name", "toto provider 2");
- try {
- totoProv2 = totoFactory.createComponentInstance(props3);
- } catch(Exception e) {
- e.printStackTrace();
- }
-
- totoProv.stop();
- totoProv2.stop();
-
- Factory factory = Utils.getFactoryByName(context, "comp-2");
- Properties props2 = new Properties();
- props2.put("name", "ff");
- try {
- under = factory.createComponentInstance(props2);
- } catch(Exception e) {
- e.printStackTrace();
- }
-
- }
-
- public void tearDown() {
- tataFactory.start();
- totoProv.dispose();
- totoProv = null;
- totoProv2.dispose();
- totoProv2 = null;
- tataFactory2.start();
-
- // Reset counters
- TotoProvider.toto = 0;
- TotoProvider.toto_2 = 0;
- TotoProvider.toto_3 = 0;
- TotoProvider.toto_4 = 0;
- TotoProvider.toto1 = 0;
- }
-
- public void testSimple() {
- // Neither factory nor instance
- assertTrue("Assert under state - 1", under.getState() == ComponentInstance.INVALID);
- assertNull("Assert no tota service - 1", context.getServiceReference(Tota.class.getName()));
-
- // Start the importer
- totoProv.start();
- assertTrue("Assert under state - 2 ("+under.getState()+")", under.getState() == ComponentInstance.INVALID);
- assertNull("Assert no tota service - 2", context.getServiceReference(Tota.class.getName()));
-
- // Start the factory
- tataFactory.start();
- assertTrue("Assert under state - 3", under.getState() == ComponentInstance.VALID);
- assertNotNull("Assert tota service - 3", context.getServiceReference(Tota.class.getName()));
- ServiceReference ref = context.getServiceReference(Tota.class.getName());
- Tota tota = (Tota) context.getService(ref);
-
- invokeAll(tota);
-
- // Check toto
- Properties props = tota.getProps();
- Integer toto = (Integer) props.get("toto");
- Integer toto_2 = (Integer) props.get("toto_2");
- Integer toto_3 = (Integer) props.get("toto_3");
- Integer toto_4 = (Integer) props.get("toto_4");
- Integer toto_1 = (Integer) props.get("toto1");
- assertEquals("Assert toto - 3 ("+toto.intValue()+")", toto.intValue(), 1);
- assertEquals("Assert toto_2 - 3", toto_2.intValue(), 1);
- assertEquals("Assert toto_3 - 3", toto_3.intValue(), 1);
- assertEquals("Assert toto_4 - 3", toto_4.intValue(), 0);
- assertEquals("Assert toto1 - 3 (" + toto_1.intValue() + ")", toto_1.intValue(), 1);
- //Check tata
- props = tota.getPropsTata();
- Integer tata = (Integer) props.get("tata");
- assertEquals("Assert tata - 3", tata.intValue(), 1);
-
- context.ungetService(ref);
- tota = null;
-
- // Start a second import
- totoProv2.start();
- assertTrue("Assert under state - 4", under.getState() == ComponentInstance.VALID);
- assertNotNull("Assert tota service - 4", context.getServiceReference(Tota.class.getName()));
- ref = context.getServiceReference(Tota.class.getName());
- tota = (Tota) context.getService(ref);
- invokeAll(tota);
- // Check toto
- props = tota.getProps();
- toto = (Integer) props.get("toto");
- toto_2 = (Integer) props.get("toto_2");
- toto_3 = (Integer) props.get("toto_3");
- toto_4 = (Integer) props.get("toto_4");
- toto_1 = (Integer) props.get("toto1");
- assertEquals("Assert toto - 4 ("+toto.intValue()+")", toto.intValue(), 2);
- assertEquals("Assert toto_2 - 4 ("+toto_2.intValue()+")", toto_2.intValue(), 2);
- assertEquals("Assert toto_3 - 4", toto_3.intValue(), 2);
- assertEquals("Assert toto_4 - 4", toto_4.intValue(), 0);
- assertEquals("Assert toto1 - 4", toto_1.intValue(), 3);
- //Check tata
- props = tota.getPropsTata();
- tata = (Integer) props.get("tata");
- assertEquals("Assert tata - 4", tata.intValue(), 2);
-
- context.ungetService(ref);
- tota = null;
-
- tataFactory.stop();
- assertTrue("Assert under state - 5", under.getState() == ComponentInstance.INVALID);
- assertNull("Assert no tota service - 5", context.getServiceReference(Tota.class.getName()));
-
- totoProv2.stop();
- tataFactory.start();
- assertTrue("Assert under state - 6", under.getState() == ComponentInstance.VALID);
- assertNotNull("Assert tota service - 6", context.getServiceReference(Tota.class.getName()));
- ref = context.getServiceReference(Tota.class.getName());
- tota = (Tota) context.getService(ref);
- invokeAll(tota);
- // Check toto
- props = tota.getProps();
- toto = (Integer) props.get("toto");
- toto_2 = (Integer) props.get("toto_2");
- toto_3 = (Integer) props.get("toto_3");
- toto_4 = (Integer) props.get("toto_4");
- toto_1 = (Integer) props.get("toto1");
- assertEquals("Assert toto - 6 ("+toto.intValue()+")", toto.intValue(), 3);
- assertEquals("Assert toto_2 - 6 ("+toto_2.intValue()+")", toto_2.intValue(), 3);
- assertEquals("Assert toto_3 - 6", toto_3.intValue(), 3);
- assertEquals("Assert toto_4 - 6", toto_4.intValue(), 0);
- assertEquals("Assert toto1 - 6", toto_1.intValue(), 4);
- //Check tata
- props = tota.getPropsTata();
- tata = (Integer) props.get("tata");
- assertEquals("Assert tata - 6", tata.intValue(), 1);
-
- context.ungetService(ref);
- tota = null;
-
- // Is arch exposed
- assertNotNull("Test arch", Utils.getServiceReferenceByName(context, Architecture.class.getName(), "ff"));
-
- totoProv.stop();
-
- assertTrue("Assert under state - 7", under.getState() == ComponentInstance.INVALID);
- assertNotNull("Test arch-2", Utils.getServiceReferenceByName(context, Architecture.class.getName(), "ff"));
- assertNull("Assert no tota service - 7", context.getServiceReference(Tota.class.getName()));
-
- under.dispose();
- under = null;
- }
-
- private void invoke(Tota tota) {
- tota.tata();
-
- assertEquals("Assert invoke tataint", tota.tataInt(2), 2);
- assertEquals("Assert invoke tataLong", tota.tataLong(2), 2);
- assertEquals("Assert invoke tataDouble", tota.tataDouble(2), 2);
- assertEquals("Assert invoke tataChar", tota.tataChar('a'), 'a');
- assertTrue("Assert invoke tataBoolean", tota.tataBoolean(true));
- assertEquals("Assert invoke tataByte", tota.tataByte((byte)2), 2);
- assertEquals("Assert invoke tataShort", tota.tataShort((short)5), 5);
- assertEquals("Assert invoke tataFloat", tota.tataFloat(5), 5);
-
- }
-
- private void invokeToto(Tota tota) {
- tota.toto();
- assertEquals("Assert toto", tota.toto("foo"), "foo");
- tota.toto(1,2);
- tota.toto1("foo2");
- }
-
- private void invokeAll(Tota tota) {
- invoke(tota);
- invokeToto(tota);
- }
-
-
-}
diff --git a/ipojo/tests/tests.composite/src/main/java/org/apache/felix/ipojo/test/composite/provides/TestComp3.java b/ipojo/tests/tests.composite/src/main/java/org/apache/felix/ipojo/test/composite/provides/TestComp3.java
deleted file mode 100644
index 07ac5d3..0000000
--- a/ipojo/tests/tests.composite/src/main/java/org/apache/felix/ipojo/test/composite/provides/TestComp3.java
+++ /dev/null
@@ -1,262 +0,0 @@
-/*
- * 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.composite.provides;
-
-import java.util.Properties;
-
-import org.apache.felix.ipojo.ComponentFactory;
-import org.apache.felix.ipojo.ComponentInstance;
-import org.apache.felix.ipojo.Factory;
-import org.apache.felix.ipojo.architecture.Architecture;
-import org.apache.felix.ipojo.junit4osgi.OSGiTestCase;
-import org.apache.felix.ipojo.test.composite.component.TotoProvider;
-import org.apache.felix.ipojo.test.composite.service.Tota;
-import org.apache.felix.ipojo.test.composite.util.Utils;
-import org.osgi.framework.ServiceReference;
-
-public class TestComp3 extends OSGiTestCase {
-
- private ComponentFactory tataFactory;
- private ComponentFactory totoFactory;
-
- private ComponentInstance totoProv, totoProv2;
- private ComponentInstance under;
- private ComponentFactory tataFactory2;
-
- public void setUp() {
- tataFactory = (ComponentFactory) Utils.getFactoryByName(context, "tata");
- totoFactory = (ComponentFactory) Utils.getFactoryByName(context, "toto");
- tataFactory2 = (ComponentFactory) Utils.getFactoryByName(context, "comp-6");
- tataFactory2.stop();
- tataFactory.stop();
-
- Properties props = new Properties();
- props.put("name", "toto provider");
- try {
- totoProv = totoFactory.createComponentInstance(props);
- } catch(Exception e) {
- e.printStackTrace();
- }
-
- Properties props3 = new Properties();
- props3.put("name", "toto provider 2");
- try {
- totoProv2 = totoFactory.createComponentInstance(props3);
- } catch(Exception e) {
- e.printStackTrace();
- }
-
- totoProv.stop();
- totoProv2.stop();
-
- Factory factory = Utils.getFactoryByName(context, "comp-3");
- Properties props2 = new Properties();
- props2.put("name", "ff");
- try {
- under = factory.createComponentInstance(props2);
- } catch(Exception e) {
- e.printStackTrace();
- }
-
- }
-
- public void tearDown() {
- tataFactory.start();
- totoProv.dispose();
- totoProv = null;
- totoProv2.dispose();
- totoProv2 = null;
- tataFactory2.start();
-
- // Reset counters
- TotoProvider.toto = 0;
- TotoProvider.toto_2 = 0;
- TotoProvider.toto_3 = 0;
- TotoProvider.toto_4 = 0;
- TotoProvider.toto1 = 0;
- }
-
- public void testSimple() {
- // Neither factory nor instance
- assertTrue("Assert under state - 1", under.getState() == ComponentInstance.INVALID);
- assertNull("Assert no tota service - 1", context.getServiceReference(Tota.class.getName()));
-
- // Start the importer
- totoProv.start();
- assertTrue("Assert under state - 2 ("+under.getState()+")", under.getState() == ComponentInstance.INVALID);
- assertNull("Assert no tota service - 2", context.getServiceReference(Tota.class.getName()));
-
- // Start the factory
- tataFactory.start();
- assertTrue("Assert under state - 3", under.getState() == ComponentInstance.VALID);
- assertNotNull("Assert tota service - 3", context.getServiceReference(Tota.class.getName()));
- ServiceReference ref = context.getServiceReference(Tota.class.getName());
- Tota tota = (Tota) context.getService(ref);
- invokeAll(tota);
- // Check toto
- Properties props = tota.getProps();
- Integer toto = (Integer) props.get("toto");
- Integer toto_2 = (Integer) props.get("toto_2");
- Integer toto_3 = (Integer) props.get("toto_3");
- Integer toto_4 = (Integer) props.get("toto_4");
- Integer toto_1 = (Integer) props.get("toto1");
- assertEquals("Assert toto - 3 ("+toto.intValue()+")", toto.intValue(), 1);
- assertEquals("Assert toto_2 - 3", toto_2.intValue(), 1);
- assertEquals("Assert toto_3 - 3", toto_3.intValue(), 1);
- assertEquals("Assert toto_4 - 3", toto_4.intValue(), 0);
- assertEquals("Assert toto1 - 3 (" + toto_1.intValue() + ")", toto_1.intValue(), 1);
- //Check tata
- props = tota.getPropsTata();
- Integer tata = (Integer) props.get("tata");
- assertEquals("Assert tata - 3", tata.intValue(), 1);
-
- context.ungetService(ref);
- tota = null;
-
- // Start a second import
- totoProv2.start();
- assertTrue("Assert under state - 4", under.getState() == ComponentInstance.VALID);
- assertNotNull("Assert tota service - 4", context.getServiceReference(Tota.class.getName()));
- ref = context.getServiceReference(Tota.class.getName());
- tota = (Tota) context.getService(ref);
- invokeAll(tota);
- props = tota.getProps();
- toto = (Integer) props.get("toto");
- toto_2 = (Integer) props.get("toto_2");
- toto_3 = (Integer) props.get("toto_3");
- toto_4 = (Integer) props.get("toto_4");
- toto_1 = (Integer) props.get("toto1");
- assertEquals("Assert toto - 4 ("+toto.intValue()+")", toto.intValue(), 2);
- assertEquals("Assert toto_2 - 4 ("+toto_2.intValue()+")", toto_2.intValue(), 2);
- assertEquals("Assert toto_3 - 4", toto_3.intValue(), 2);
- assertEquals("Assert toto_4 - 4", toto_4.intValue(), 0);
- assertEquals("Assert toto1 - 4", toto_1.intValue(), 2);
- //Check tata
- props = tota.getPropsTata();
- tata = (Integer) props.get("tata");
- assertEquals("Assert tata - 4", tata.intValue(), 2);
- context.ungetService(ref);
- tota = null;
-
- // Stop the factory
- tataFactory.stop();
- assertTrue("Assert under state - 5", under.getState() == ComponentInstance.INVALID);
- assertNull("Assert no tota service - 5", context.getServiceReference(Tota.class.getName()));
-
- totoProv2.stop();
- totoProv.stop();
- tataFactory.start();
- assertTrue("Assert under state - 6", under.getState() == ComponentInstance.VALID);
- assertNotNull("Assert tota service - 6", context.getServiceReference(Tota.class.getName()));
- ref = context.getServiceReference(Tota.class.getName());
- tota = (Tota) context.getService(ref);
- invokeAllOpt(tota);
- //Check tata
- props = tota.getPropsTata();
- tata = (Integer) props.get("tata");
- assertEquals("Assert tata - 4", tata.intValue(), 1);
- context.ungetService(ref);
- tota = null;
-
- // Is arch exposed
- assertNotNull("Test arch", Utils.getServiceReferenceByName(context, Architecture.class.getName(), "ff"));
-
- tataFactory.stop();
-
- assertTrue("Assert under state - 7", under.getState() == ComponentInstance.INVALID);
- assertNotNull("Test arch-2", Utils.getServiceReferenceByName(context, Architecture.class.getName(), "ff"));
- assertNull("Assert no tota service - 7", context.getServiceReference(Tota.class.getName()));
-
- under.dispose();
- under = null;
- }
-
- private void invoke(Tota tota) {
- tota.tata();
-
- assertEquals("Assert invoke tataint", tota.tataInt(2), 2);
- assertEquals("Assert invoke tataLong", tota.tataLong(2), 2);
- assertEquals("Assert invoke tataDouble", tota.tataDouble(2), 2);
- assertEquals("Assert invoke tataChar", tota.tataChar('a'), 'a');
- assertTrue("Assert invoke tataBoolean", tota.tataBoolean(true));
- assertEquals("Assert invoke tataByte", tota.tataByte((byte)2), 2);
- assertEquals("Assert invoke tataShort", tota.tataShort((short)5), 5);
- assertEquals("Assert invoke tataFloat", tota.tataFloat(5), 5);
-
- }
-
-
- private void invokeStr(Tota tota) {
- tota.tataStr();
- }
-
- private void invokeToto(Tota tota) {
- tota.toto();
- assertEquals("Assert toto", tota.toto("foo"), "foo");
- tota.toto(1,2);
- tota.toto1("foo");
- }
-
- private void invokeAll(Tota tota) {
- invoke(tota);
- //invokeArrays(tota);
- invokeStr(tota);
- //invokeTata(tota);
- //invokeTata1(tota);
- //invokeTata5(tota);
- //invokeAdd(tota);
- invokeToto(tota);
- }
-
- private void invokeAllOpt(Tota tota) {
- invoke(tota);
- //invokeArrays(tota);
- invokeStr(tota);
- //invokeTata(tota);
- //invokeTata1(tota);
- //invokeTata5(tota);
- //invokeAdd(tota);
- invokeTotoOpt(tota);
- }
-
- private void invokeTotoOpt(Tota tota) {
- try {
- tota.toto();
- fail("UnsupportedOperationException expected");
- } catch(UnsupportedOperationException e) { }
-
- try {
- assertEquals("Assert toto", tota.toto("foo"), "foo");
- fail("UnsupportedOperationException expected");
- } catch(UnsupportedOperationException e) { }
-
-
- try {
- tota.toto(1,2);
- fail("UnsupportedOperationException expected");
- } catch(UnsupportedOperationException e) { }
-
- try {
- tota.toto1("foo");
- fail("UnsupportedOperationException expected");
- } catch(UnsupportedOperationException e) { }
- }
-
-
-}
diff --git a/ipojo/tests/tests.composite/src/main/java/org/apache/felix/ipojo/test/composite/provides/TestComp4.java b/ipojo/tests/tests.composite/src/main/java/org/apache/felix/ipojo/test/composite/provides/TestComp4.java
deleted file mode 100644
index 0d0f36c..0000000
--- a/ipojo/tests/tests.composite/src/main/java/org/apache/felix/ipojo/test/composite/provides/TestComp4.java
+++ /dev/null
@@ -1,261 +0,0 @@
-/*
- * 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.composite.provides;
-
-import java.util.Properties;
-
-import org.apache.felix.ipojo.ComponentFactory;
-import org.apache.felix.ipojo.ComponentInstance;
-import org.apache.felix.ipojo.Factory;
-import org.apache.felix.ipojo.architecture.Architecture;
-import org.apache.felix.ipojo.junit4osgi.OSGiTestCase;
-import org.apache.felix.ipojo.test.composite.component.TotoProvider;
-import org.apache.felix.ipojo.test.composite.service.Tota;
-import org.apache.felix.ipojo.test.composite.util.Utils;
-import org.osgi.framework.ServiceReference;
-
-public class TestComp4 extends OSGiTestCase {
-
- private ComponentFactory tataFactory;
- private ComponentFactory totoFactory;
-
- private ComponentInstance totoProv, totoProv2;
- private ComponentInstance under;
- private ComponentFactory tataFactory2;
-
- public void setUp() {
- tataFactory = (ComponentFactory) Utils.getFactoryByName(context, "tata");
- totoFactory = (ComponentFactory) Utils.getFactoryByName(context, "toto");
- tataFactory2 = (ComponentFactory) Utils.getFactoryByName(context, "comp-6");
- tataFactory2.stop();
- tataFactory.stop();
-
- Properties props = new Properties();
- props.put("name", "toto provider");
- try {
- totoProv = totoFactory.createComponentInstance(props);
- } catch(Exception e) {
- e.printStackTrace();
- }
-
- Properties props3 = new Properties();
- props3.put("name", "toto provider 2");
- try {
- totoProv2 = totoFactory.createComponentInstance(props3);
- } catch(Exception e) {
- e.printStackTrace();
- }
-
- totoProv.stop();
- totoProv2.stop();
-
- Factory factory = Utils.getFactoryByName(context, "comp-4");
- Properties props2 = new Properties();
- props2.put("name", "ff");
- try {
- under = factory.createComponentInstance(props2);
- } catch(Exception e) {
- e.printStackTrace();
- }
-
- }
-
- public void tearDown() {
- tataFactory2.start();
- tataFactory.start();
- totoProv.dispose();
- totoProv = null;
- totoProv2.dispose();
- totoProv2 = null;
-
- // Reset counters
- TotoProvider.toto = 0;
- TotoProvider.toto_2 = 0;
- TotoProvider.toto_3 = 0;
- TotoProvider.toto_4 = 0;
- TotoProvider.toto1 = 0;
- }
-
- public void testSimple() {
- // Neither factory nor instance
- assertTrue("Assert under state - 1", under.getState() == ComponentInstance.INVALID);
- assertNull("Assert no tota service - 1", context.getServiceReference(Tota.class.getName()));
-
- // Start the importer
- totoProv.start();
- assertTrue("Assert under state - 2 ("+under.getState()+")", under.getState() == ComponentInstance.INVALID);
- assertNull("Assert no tota service - 2", context.getServiceReference(Tota.class.getName()));
-
- // Start the factory
- tataFactory.start();
- assertTrue("Assert under state - 3", under.getState() == ComponentInstance.VALID);
- assertNotNull("Assert tota service - 3", context.getServiceReference(Tota.class.getName()));
- ServiceReference ref = context.getServiceReference(Tota.class.getName());
- Tota tota = (Tota) context.getService(ref);
- invokeAll(tota);
- // Check toto
- Properties props = tota.getProps();
- Integer toto = (Integer) props.get("toto");
- Integer toto_2 = (Integer) props.get("toto_2");
- Integer toto_3 = (Integer) props.get("toto_3");
- Integer toto_4 = (Integer) props.get("toto_4");
- Integer toto_1 = (Integer) props.get("toto1");
- assertEquals("Assert toto - 3 ("+toto.intValue()+")", toto.intValue(), 1);
- assertEquals("Assert toto_2 - 3", toto_2.intValue(), 1);
- assertEquals("Assert toto_3 - 3", toto_3.intValue(), 1);
- assertEquals("Assert toto_4 - 3", toto_4.intValue(), 0);
- assertEquals("Assert toto1 - 3 (" + toto_1.intValue() + ")", toto_1.intValue(), 1);
- //Check tata
- props = tota.getPropsTata();
- Integer tata = (Integer) props.get("tata");
- assertEquals("Assert tata - 3", tata.intValue(), 1);
- context.ungetService(ref);
- tota = null;
-
- // Start a second import
- totoProv2.start();
- assertTrue("Assert under state - 4", under.getState() == ComponentInstance.VALID);
- assertNotNull("Assert tota service - 4", context.getServiceReference(Tota.class.getName()));
- ref = context.getServiceReference(Tota.class.getName());
- tota = (Tota) context.getService(ref);
- invokeAll(tota);
- props = tota.getProps();
- toto = (Integer) props.get("toto");
- toto_2 = (Integer) props.get("toto_2");
- toto_3 = (Integer) props.get("toto_3");
- toto_4 = (Integer) props.get("toto_4");
- toto_1 = (Integer) props.get("toto1");
- assertEquals("Assert toto - 4 ("+toto.intValue()+")", toto.intValue(), 2);
- assertEquals("Assert toto_2 - 4 ("+toto_2.intValue()+")", toto_2.intValue(), 2);
- assertEquals("Assert toto_3 - 4", toto_3.intValue(), 2);
- assertEquals("Assert toto_4 - 4", toto_4.intValue(), 0);
- assertEquals("Assert toto1 - 4", toto_1.intValue(), 2);
- //Check tata
- props = tota.getPropsTata();
- tata = (Integer) props.get("tata");
- assertEquals("Assert tata - 4", tata.intValue(), 2);
- context.ungetService(ref);
- tota = null;
-
- // Stop the factory
- tataFactory.stop();
- assertTrue("Assert under state - 5", under.getState() == ComponentInstance.INVALID);
- assertNull("Assert no tota service - 5", context.getServiceReference(Tota.class.getName()));
-
- totoProv2.stop();
- totoProv.stop();
- tataFactory.start();
- assertTrue("Assert under state - 6", under.getState() == ComponentInstance.VALID);
- assertNotNull("Assert tota service - 6", context.getServiceReference(Tota.class.getName()));
- ref = context.getServiceReference(Tota.class.getName());
- tota = (Tota) context.getService(ref);
- invokeAllOpt(tota);
- // Check tata
- props = tota.getPropsTata();
- tata = (Integer) props.get("tata");
- assertEquals("Assert tata - 6", tata.intValue(), 1);
- context.ungetService(ref);
- tota = null;
-
- // Is arch exposed
- assertNotNull("Test arch", Utils.getServiceReferenceByName(context, Architecture.class.getName(), "ff"));
-
- tataFactory.stop();
-
- assertTrue("Assert under state - 7", under.getState() == ComponentInstance.INVALID);
- assertNotNull("Test arch-2", Utils.getServiceReferenceByName(context, Architecture.class.getName(), "ff"));
- assertNull("Assert no tota service - 7", context.getServiceReference(Tota.class.getName()));
-
- under.dispose();
- under = null;
- }
-
- private void invoke(Tota tota) {
- tota.tata();
-
- assertEquals("Assert invoke tataint", tota.tataInt(2), 2);
- assertEquals("Assert invoke tataLong", tota.tataLong(2), 2);
- assertEquals("Assert invoke tataDouble", tota.tataDouble(2), 2);
- assertEquals("Assert invoke tataChar", tota.tataChar('a'), 'a');
- assertTrue("Assert invoke tataBoolean", tota.tataBoolean(true));
- assertEquals("Assert invoke tataByte", tota.tataByte((byte)2), 2);
- assertEquals("Assert invoke tataShort", tota.tataShort((short)5), 5);
- assertEquals("Assert invoke tataFloat", tota.tataFloat(5), 5);
-
- }
-
-
- private void invokeStr(Tota tota) {
- tota.tataStr();
- }
-
- private void invokeToto(Tota tota) {
- tota.toto();
- assertEquals("Assert toto", tota.toto("foo"), "foo");
- tota.toto(1,2);
- tota.toto1("foo");
- }
-
- private void invokeAll(Tota tota) {
- invoke(tota);
- //invokeArrays(tota);
- invokeStr(tota);
- //invokeTata(tota);
- //invokeTata1(tota);
- //invokeTata5(tota);
- //invokeAdd(tota);
- invokeToto(tota);
- }
-
- private void invokeAllOpt(Tota tota) {
- invoke(tota);
- //invokeArrays(tota);
- invokeStr(tota);
- //invokeTata(tota);
- //invokeTata1(tota);
- //invokeTata5(tota);
- //invokeAdd(tota);
- invokeTotoOpt(tota);
- }
-
- private void invokeTotoOpt(Tota tota) {
- try {
- tota.toto();
- fail("UnsupportedOperationException expected");
- } catch(UnsupportedOperationException e) { }
-
- try {
- assertEquals("Assert toto", tota.toto("foo"), "foo");
- fail("UnsupportedOperationException expected");
- } catch(UnsupportedOperationException e) { }
-
-
- try {
- tota.toto(1,2);
- fail("UnsupportedOperationException expected");
- } catch(UnsupportedOperationException e) { }
-
- try {
- tota.toto1("foo");
- fail("UnsupportedOperationException expected");
- } catch(UnsupportedOperationException e) { }
- }
-
-
-}
diff --git a/ipojo/tests/tests.composite/src/main/java/org/apache/felix/ipojo/test/composite/provides/TestComp5.java b/ipojo/tests/tests.composite/src/main/java/org/apache/felix/ipojo/test/composite/provides/TestComp5.java
deleted file mode 100644
index 7dd11f7..0000000
--- a/ipojo/tests/tests.composite/src/main/java/org/apache/felix/ipojo/test/composite/provides/TestComp5.java
+++ /dev/null
@@ -1,265 +0,0 @@
-/*
- * 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.composite.provides;
-
-import java.util.Properties;
-
-import org.apache.felix.ipojo.ComponentFactory;
-import org.apache.felix.ipojo.ComponentInstance;
-import org.apache.felix.ipojo.Factory;
-import org.apache.felix.ipojo.architecture.Architecture;
-import org.apache.felix.ipojo.junit4osgi.OSGiTestCase;
-import org.apache.felix.ipojo.test.composite.component.TotoProvider;
-import org.apache.felix.ipojo.test.composite.service.Tota;
-import org.apache.felix.ipojo.test.composite.util.Utils;
-import org.osgi.framework.ServiceReference;
-
-public class TestComp5 extends OSGiTestCase {
-
- private ComponentFactory tataFactory;
- private ComponentFactory totoFactory;
-
- private ComponentInstance totoProv, totoProv2;
- private ComponentInstance under;
- private ComponentFactory tataFactory2;
-
- public void setUp() {
- tataFactory = (ComponentFactory) Utils.getFactoryByName(context, "tata");
- totoFactory = (ComponentFactory) Utils.getFactoryByName(context, "toto");
- tataFactory2 = (ComponentFactory) Utils.getFactoryByName(context, "comp-6");
- tataFactory2.stop();
- tataFactory.stop();
-
- Properties props = new Properties();
- props.put("name", "toto provider");
- try {
- totoProv = totoFactory.createComponentInstance(props);
- } catch(Exception e) {
- e.printStackTrace();
- }
-
- Properties props3 = new Properties();
- props3.put("name", "toto provider 2");
- try {
- totoProv2 = totoFactory.createComponentInstance(props3);
- } catch(Exception e) {
- e.printStackTrace();
- }
-
- totoProv.stop();
- totoProv2.stop();
-
- Factory factory = Utils.getFactoryByName(context, "comp-5");
- Properties props2 = new Properties();
- props2.put("name", "ff");
- try {
- under = factory.createComponentInstance(props2);
- } catch(Exception e) {
- e.printStackTrace();
- fail("Cannot create an instance from comp-5 : " + e.getMessage());
- }
-
- }
-
- public void tearDown() {
- tataFactory2.start();
- tataFactory.start();
- totoProv.dispose();
- totoProv = null;
- totoProv2.dispose();
- totoProv2 = null;
-
- // Reset counters
- TotoProvider.toto = 0;
- TotoProvider.toto_2 = 0;
- TotoProvider.toto_3 = 0;
- TotoProvider.toto_4 = 0;
- TotoProvider.toto1 = 0;
- }
-
- public void testSimple() {
- // Neither factory nor instance
- assertTrue("Assert under state - 1", under.getState() == ComponentInstance.INVALID);
- assertNull("Assert no tota service - 1", context.getServiceReference(Tota.class.getName()));
-
- // Start the importer
- totoProv.start();
- assertTrue("Assert under state - 2 ("+under.getState()+")", under.getState() == ComponentInstance.INVALID);
- assertNull("Assert no tota service - 2", context.getServiceReference(Tota.class.getName()));
-
- // Start the factory
- tataFactory.start();
- assertTrue("Assert under state - 3", under.getState() == ComponentInstance.VALID);
- assertNotNull("Assert tota service - 3", context.getServiceReference(Tota.class.getName()));
- ServiceReference ref = context.getServiceReference(Tota.class.getName());
- Tota tota = (Tota) context.getService(ref);
- invokeAll(tota);
- // Check toto
- Properties props = tota.getProps();
- Integer toto = (Integer) props.get("toto");
- Integer toto_2 = (Integer) props.get("toto_2");
- Integer toto_3 = (Integer) props.get("toto_3");
- Integer toto_4 = (Integer) props.get("toto_4");
- Integer toto_1 = (Integer) props.get("toto1");
- assertEquals("Assert toto - 3 ("+toto.intValue()+")", toto.intValue(), 1);
- assertEquals("Assert toto_2 - 3", toto_2.intValue(), 1);
- assertEquals("Assert toto_3 - 3", toto_3.intValue(), 1);
- assertEquals("Assert toto_4 - 3", toto_4.intValue(), 0);
- assertEquals("Assert toto1 - 3 (" + toto_1.intValue() + ")", toto_1.intValue(), 1);
- //Check tata
- props = tota.getPropsTata();
- Integer tata = (Integer) props.get("tata");
- assertEquals("Assert tata - 3", tata.intValue(), 1);
- context.ungetService(ref);
- tota = null;
-
- // Start a second import
- totoProv2.start();
- assertTrue("Assert under state - 4", under.getState() == ComponentInstance.VALID);
- assertNotNull("Assert tota service - 4", context.getServiceReference(Tota.class.getName()));
- ref = context.getServiceReference(Tota.class.getName());
- tota = (Tota) context.getService(ref);
- invokeAll(tota);
- // Check toto
- props = tota.getProps();
- toto = (Integer) props.get("toto");
- toto_2 = (Integer) props.get("toto_2");
- toto_3 = (Integer) props.get("toto_3");
- toto_4 = (Integer) props.get("toto_4");
- toto_1 = (Integer) props.get("toto1");
- assertEquals("Assert toto - 4 ("+toto.intValue()+")", toto.intValue(), 2);
- assertEquals("Assert toto_2 - 4 ("+toto_2.intValue()+")", toto_2.intValue(), 2);
- assertEquals("Assert toto_3 - 4", toto_3.intValue(), 2);
- assertEquals("Assert toto_4 - 4", toto_4.intValue(), 0);
- assertEquals("Assert toto1 - 4", toto_1.intValue(), 3);
- //Check tata
- props = tota.getPropsTata();
- tata = (Integer) props.get("tata");
- assertEquals("Assert tata - 4", tata.intValue(), 2);
- context.ungetService(ref);
- tota = null;
-
- // Stop the factory
- tataFactory.stop();
- assertTrue("Assert under state - 5", under.getState() == ComponentInstance.INVALID);
- assertNull("Assert no tota service - 5", context.getServiceReference(Tota.class.getName()));
-
- totoProv2.stop();
- totoProv.stop();
- tataFactory.start();
- assertTrue("Assert under state - 6", under.getState() == ComponentInstance.VALID);
- assertNotNull("Assert tota service - 6", context.getServiceReference(Tota.class.getName()));
- ref = context.getServiceReference(Tota.class.getName());
- tota = (Tota) context.getService(ref);
- invokeAllOpt(tota);
- //Check tata
- props = tota.getPropsTata();
- tata = (Integer) props.get("tata");
- assertEquals("Assert tata - 6", tata.intValue(), 1);
- context.ungetService(ref);
- tota = null;
-
- // Is arch exposed
- assertNotNull("Test arch", Utils.getServiceReferenceByName(context, Architecture.class.getName(), "ff"));
-
- tataFactory.stop();
-
- assertTrue("Assert under state - 7", under.getState() == ComponentInstance.INVALID);
- assertNotNull("Test arch-2", Utils.getServiceReferenceByName(context, Architecture.class.getName(), "ff"));
- assertNull("Assert no tota service - 7", context.getServiceReference(Tota.class.getName()));
-
- under.dispose();
- under = null;
- }
-
-
-
- private void invoke(Tota tota) {
- tota.tata();
-
- assertEquals("Assert invoke tataint", tota.tataInt(2), 2);
- assertEquals("Assert invoke tataLong", tota.tataLong(2), 2);
- assertEquals("Assert invoke tataDouble", tota.tataDouble(2), 2);
- assertEquals("Assert invoke tataChar", tota.tataChar('a'), 'a');
- assertTrue("Assert invoke tataBoolean", tota.tataBoolean(true));
- assertEquals("Assert invoke tataByte", tota.tataByte((byte)2), 2);
- assertEquals("Assert invoke tataShort", tota.tataShort((short)5), 5);
- assertEquals("Assert invoke tataFloat", tota.tataFloat(5), 5);
-
- }
-
-
- private void invokeStr(Tota tota) {
- tota.tataStr();
- }
-
- private void invokeToto(Tota tota) {
- tota.toto();
- assertEquals("Assert toto", tota.toto("foo"), "foo");
- tota.toto(1,2);
- tota.toto1("foo");
- }
-
- private void invokeAll(Tota tota) {
- invoke(tota);
- //invokeArrays(tota);
- invokeStr(tota);
- //invokeTata(tota);
- //invokeTata1(tota);
- //invokeTata5(tota);
- //invokeAdd(tota);
- invokeToto(tota);
- }
-
- private void invokeAllOpt(Tota tota) {
- invoke(tota);
- //invokeArrays(tota);
- invokeStr(tota);
- //invokeTata(tota);
- //invokeTata1(tota);
- //invokeTata5(tota);
- //invokeAdd(tota);
- invokeTotoOpt(tota);
- }
-
- private void invokeTotoOpt(Tota tota) {
- try {
- tota.toto();
- fail("UnsupportedOperationException expected");
- } catch(UnsupportedOperationException e) { }
-
- try {
- assertEquals("Assert toto", tota.toto("foo"), "foo");
- fail("UnsupportedOperationException expected");
- } catch(UnsupportedOperationException e) { }
-
-
- try {
- tota.toto(1,2);
- fail("UnsupportedOperationException expected");
- } catch(UnsupportedOperationException e) { }
-
- try {
- tota.toto1("foo");
- fail("UnsupportedOperationException expected");
- } catch(UnsupportedOperationException e) { }
- }
-
-
-}
diff --git a/ipojo/tests/tests.composite/src/main/java/org/apache/felix/ipojo/test/composite/provides/TestComp6.java b/ipojo/tests/tests.composite/src/main/java/org/apache/felix/ipojo/test/composite/provides/TestComp6.java
deleted file mode 100644
index 609c23c..0000000
--- a/ipojo/tests/tests.composite/src/main/java/org/apache/felix/ipojo/test/composite/provides/TestComp6.java
+++ /dev/null
@@ -1,284 +0,0 @@
-/*
- * 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.composite.provides;
-
-import java.util.Properties;
-
-import org.apache.felix.ipojo.ComponentFactory;
-import org.apache.felix.ipojo.ComponentInstance;
-import org.apache.felix.ipojo.Factory;
-import org.apache.felix.ipojo.architecture.Architecture;
-import org.apache.felix.ipojo.junit4osgi.OSGiTestCase;
-import org.apache.felix.ipojo.test.composite.component.TotoProvider;
-import org.apache.felix.ipojo.test.composite.service.Tata;
-import org.apache.felix.ipojo.test.composite.service.Toto;
-import org.apache.felix.ipojo.test.composite.util.Utils;
-import org.osgi.framework.ServiceReference;
-
-public class TestComp6 extends OSGiTestCase {
-
- private ComponentFactory tataFactory;
- private ComponentFactory totoFactory;
-
- private ComponentInstance totoProv, totoProv2;
- private ComponentInstance under;
-
- public void setUp() {
- tataFactory = (ComponentFactory) Utils.getFactoryByName(context, "tata");
- totoFactory = (ComponentFactory) Utils.getFactoryByName(context, "toto");
-
- tataFactory.stop();
-
- Properties props = new Properties();
- props.put("name", "toto provider");
- try {
- totoProv = totoFactory.createComponentInstance(props);
- } catch(Exception e) {
- e.printStackTrace();
- }
-
- Properties props3 = new Properties();
- props3.put("name", "toto provider 2");
- try {
- totoProv2 = totoFactory.createComponentInstance(props3);
- } catch(Exception e) {
- e.printStackTrace();
- }
-
- totoProv.stop();
- totoProv2.stop();
-
- Factory factory = Utils.getFactoryByName(context, "comp-6");
- Properties props2 = new Properties();
- props2.put("name", "ff");
- try {
- under = factory.createComponentInstance(props2);
- } catch(Exception e) {
- e.printStackTrace();
- }
-
- }
-
- public void tearDown() {
- tataFactory.start();
- totoProv.dispose();
- totoProv = null;
- totoProv2.dispose();
- totoProv2 = null;
-
- // Reset counters
- TotoProvider.toto = 0;
- TotoProvider.toto_2 = 0;
- TotoProvider.toto_3 = 0;
- TotoProvider.toto_4 = 0;
- TotoProvider.toto1 = 0;
- }
-
- public void testSimple() {
- // Neither factory nor instance
- assertTrue("Assert under state - 1", under.getState() == ComponentInstance.INVALID);
- ServiceReference refToto = Utils.getServiceReferenceByName(context, Toto.class.getName(), "ff");
- ServiceReference refTata = Utils.getServiceReferenceByName(context, Tata.class.getName(), "ff");
- assertNull("Assert no toto service - 1", refToto);
- assertNull("Assert no tata service - 1", refTata);
-
- // Start the importer
- totoProv.start();
- assertTrue("Assert under state - 2 ("+under.getState()+")", under.getState() == ComponentInstance.INVALID);
- refToto = Utils.getServiceReferenceByName(context, Toto.class.getName(), "ff");
- refTata = Utils.getServiceReferenceByName(context, Tata.class.getName(), "ff");
- assertNull("Assert no toto service - 2", refToto);
- assertNull("Assert no tata service - 2", refTata);
-
- // Start the factory
- tataFactory.start();
- assertTrue("Assert under state - 3", under.getState() == ComponentInstance.VALID);
- refToto = Utils.getServiceReferenceByName(context, Toto.class.getName(), "ff");
- refTata = Utils.getServiceReferenceByName(context, Tata.class.getName(), "ff");
- assertNotNull("Assert toto service - 3", refToto);
- assertNotNull("Assert tata service - 3", refTata);
- Toto toto = (Toto) context.getService(refToto);
- Tata tata = (Tata) context.getService(refTata);
-
- invokeAll(tata);
- invokeToto(toto);
-
- // Check toto
- Properties props = toto.getProps();
- Integer toto_0 = (Integer) props.get("toto");
- Integer toto_2 = (Integer) props.get("toto_2");
- Integer toto_3 = (Integer) props.get("toto_3");
- Integer toto_4 = (Integer) props.get("toto_4");
- Integer toto_1 = (Integer) props.get("toto1");
- assertEquals("Assert toto - 3 ("+toto_0.intValue()+")", toto_0.intValue(), 1);
- assertEquals("Assert toto_2 - 3", toto_2.intValue(), 1);
- assertEquals("Assert toto_3 - 3", toto_3.intValue(), 1);
- assertEquals("Assert toto_4 - 3", toto_4.intValue(), 0);
- assertEquals("Assert toto1 - 3 (" + toto_1.intValue() + ")", toto_1.intValue(), 1);
- //Check tata
- props = tata.getPropsTata();
- Integer tata_0 = (Integer) props.get("tata");
- assertEquals("Assert tata - 3", tata_0.intValue(), 1);
-
- context.ungetService(refToto);
- context.ungetService(refTata);
- toto = null;
- tata = null;
-
- // Start a second import
- totoProv2.start();
- assertTrue("Assert under state - 4", under.getState() == ComponentInstance.VALID);
- refToto = Utils.getServiceReferenceByName(context, Toto.class.getName(), "ff");
- refTata = Utils.getServiceReferenceByName(context, Tata.class.getName(), "ff");
- assertNotNull("Assert toto service - 4", refToto);
- assertNotNull("Assert tata service - 4", refTata);
-
- toto = (Toto) context.getService(refToto);
- tata = (Tata) context.getService(refTata);
- invokeAll(tata);
- invokeToto(toto);
-
- // Check toto
- props = toto.getProps();
- toto_0 = (Integer) props.get("toto");
- toto_2 = (Integer) props.get("toto_2");
- toto_3 = (Integer) props.get("toto_3");
- toto_4 = (Integer) props.get("toto_4");
- toto_1 = (Integer) props.get("toto1");
- assertEquals("Assert toto - 4 ("+toto_0.intValue()+")", toto_0.intValue(), 2);
- assertEquals("Assert toto_2 - 4 ("+toto_2.intValue()+")", toto_2.intValue(), 2);
- assertEquals("Assert toto_3 - 4", toto_3.intValue(), 2);
- assertEquals("Assert toto_4 - 4", toto_4.intValue(), 0);
- assertEquals("Assert toto1 - 4", toto_1.intValue(), 3);
- //Check tata
- props = tata.getPropsTata();
- tata_0 = (Integer) props.get("tata");
- assertEquals("Assert tata - 4", tata_0.intValue(), 2);
- context.ungetService(refToto);
- context.ungetService(refTata);
- toto = null;
- tata = null;
-
- // Stop the factory
- tataFactory.stop();
- assertTrue("Assert under state - 5", under.getState() == ComponentInstance.INVALID);
- refToto = Utils.getServiceReferenceByName(context, Toto.class.getName(), "ff");
- refTata = Utils.getServiceReferenceByName(context, Tata.class.getName(), "ff");
- assertNull("Assert no toto service - 5", refToto);
- assertNull("Assert no tata service - 5", refTata);
-
- totoProv2.stop();
- totoProv.stop();
- tataFactory.start();
- assertTrue("Assert under state - 6", under.getState() == ComponentInstance.VALID);
- refToto = Utils.getServiceReferenceByName(context, Toto.class.getName(), "ff");
- refTata = Utils.getServiceReferenceByName(context, Tata.class.getName(), "ff");
- assertNotNull("Assert toto service - 6", refToto);
- assertNotNull("Assert tata service - 6", refTata);
- toto = (Toto) context.getService(refToto);
- tata = (Tata) context.getService(refTata);
-
- invokeAll(tata);
- invokeTotoOpt(toto);
- // Check tata
- props = tata.getPropsTata();
- tata_0 = (Integer) props.get("tata");
- assertEquals("Assert tata - 6", tata_0.intValue(), 1);
- context.ungetService(refToto);
- context.ungetService(refTata);
- toto = null;
- tata = null;
-
- // Is arch exposed
- assertNotNull("Test arch", Utils.getServiceReferenceByName(context, Architecture.class.getName(), "ff"));
-
- tataFactory.stop();
-
- assertTrue("Assert under state - 7", under.getState() == ComponentInstance.INVALID);
- assertNotNull("Test arch-2", Utils.getServiceReferenceByName(context, Architecture.class.getName(), "ff"));
- refToto = Utils.getServiceReferenceByName(context, Toto.class.getName(), "ff");
- refTata = Utils.getServiceReferenceByName(context, Tata.class.getName(), "ff");
- assertNull("Assert no toto service - 7", refToto);
- assertNull("Assert no tata service - 7", refTata);
-
- under.dispose();
- under = null;
- }
-
- private void invoke(Tata tota) {
- tota.tata();
-
- assertEquals("Assert invoke tataint", tota.tataInt(2), 2);
- assertEquals("Assert invoke tataLong", tota.tataLong(2), 2);
- assertEquals("Assert invoke tataDouble", tota.tataDouble(2), 2);
- assertEquals("Assert invoke tataChar", tota.tataChar('a'), 'a');
- assertTrue("Assert invoke tataBoolean", tota.tataBoolean(true));
- assertEquals("Assert invoke tataByte", tota.tataByte((byte)2), 2);
- assertEquals("Assert invoke tataShort", tota.tataShort((short)5), 5);
- assertEquals("Assert invoke tataFloat", tota.tataFloat(5), 5);
-
- }
-
-
- private void invokeStr(Tata tota) {
- tota.tataStr();
- }
-
- private void invokeToto(Toto tota) {
- tota.toto();
- assertEquals("Assert toto", tota.toto("foo"), "foo");
- tota.toto(1,2);
- tota.toto1("foo");
- }
-
- private void invokeAll(Tata tota) {
- invoke(tota);
- //invokeArrays(tota);
- invokeStr(tota);
- //invokeTata(tota);
- //invokeTata1(tota);
- //invokeTata5(tota);
- //invokeAdd(tota);
- }
-
- private void invokeTotoOpt(Toto tota) {
- try {
- tota.toto();
- fail("UnsupportedOperationException expected");
- } catch(UnsupportedOperationException e) { }
-
- try {
- assertEquals("Assert toto", tota.toto("foo"), "foo");
- fail("UnsupportedOperationException expected");
- } catch(UnsupportedOperationException e) { }
-
-
- try {
- tota.toto(1,2);
- fail("UnsupportedOperationException expected");
- } catch(UnsupportedOperationException e) { }
-
- try {
- tota.toto1("foo");
- fail("UnsupportedOperationException expected");
- } catch(UnsupportedOperationException e) { }
- }
-
-
-}
diff --git a/ipojo/tests/tests.composite/src/main/java/org/apache/felix/ipojo/test/composite/provides/TestComp7.java b/ipojo/tests/tests.composite/src/main/java/org/apache/felix/ipojo/test/composite/provides/TestComp7.java
deleted file mode 100644
index 67a6c19..0000000
--- a/ipojo/tests/tests.composite/src/main/java/org/apache/felix/ipojo/test/composite/provides/TestComp7.java
+++ /dev/null
@@ -1,333 +0,0 @@
-/*
- * 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.composite.provides;
-
-import java.util.Properties;
-
-import org.apache.felix.ipojo.ComponentFactory;
-import org.apache.felix.ipojo.ComponentInstance;
-import org.apache.felix.ipojo.Factory;
-import org.apache.felix.ipojo.architecture.Architecture;
-import org.apache.felix.ipojo.junit4osgi.OSGiTestCase;
-import org.apache.felix.ipojo.test.composite.component.TotoProvider;
-import org.apache.felix.ipojo.test.composite.service.Tota;
-import org.apache.felix.ipojo.test.composite.util.Utils;
-import org.osgi.framework.ServiceReference;
-
-public class TestComp7 extends OSGiTestCase {
-
- private ComponentFactory tataFactory;
- private ComponentFactory totoFactory;
- private ComponentFactory tataFactory2;
-
- private ComponentInstance totoProv, totoProv2;
- private ComponentInstance under;
-
- public void setUp() {
- tataFactory = (ComponentFactory) Utils.getFactoryByName(context, "tata");
- totoFactory = (ComponentFactory) Utils.getFactoryByName(context, "toto");
- tataFactory2 = (ComponentFactory) Utils.getFactoryByName(context, "comp-6");
- tataFactory2.stop();
-
- Properties props = new Properties();
- props.put("name", "toto provider");
- try {
- totoProv = totoFactory.createComponentInstance(props);
- } catch(Exception e) {
- e.printStackTrace();
- }
-
- Properties props3 = new Properties();
- props3.put("name", "toto provider 2");
- try {
- totoProv2 = totoFactory.createComponentInstance(props3);
- } catch(Exception e) {
- e.printStackTrace();
- }
-
- totoProv.stop();
- totoProv2.stop();
-
- Factory factory = Utils.getFactoryByName(context, "comp-7");
- Properties props2 = new Properties();
- props2.put("name", "ff");
- try {
- under = factory.createComponentInstance(props2);
- } catch(Exception e) {
- e.printStackTrace();
- }
- tataFactory.stop();
-
- }
-
- public void tearDown() {
- tataFactory.start();
- totoProv.dispose();
- totoProv = null;
- totoProv2.dispose();
- totoProv2 = null;
- tataFactory2.start();
-
- // Reset counters
- TotoProvider.toto = 0;
- TotoProvider.toto_2 = 0;
- TotoProvider.toto_3 = 0;
- TotoProvider.toto_4 = 0;
- TotoProvider.toto1 = 0;
- }
-
- public void testSimple() {
- // Neither factory nor instance
- assertTrue("Assert under state - 1", under.getState() == ComponentInstance.INVALID);
- assertNull("Assert no tota service - 1", context.getServiceReference(Tota.class.getName()));
-
- // Start the importer
- totoProv.start();
- assertTrue("Assert under state - 2", under.getState() == ComponentInstance.INVALID);
- assertNull("Assert no tota service - 2", context.getServiceReference(Tota.class.getName()));
-
- // Start the factory
- tataFactory.start();
- assertTrue("Assert under state - 3", under.getState() == ComponentInstance.VALID);
- assertNotNull("Assert tota service - 3", context.getServiceReference(Tota.class.getName()));
- ServiceReference ref = context.getServiceReference(Tota.class.getName());
- Tota tota = (Tota) context.getService(ref);
- invokeAll(tota);
- // Check toto
- Properties props = tota.getProps();
- Integer toto = (Integer) props.get("toto");
- Integer toto_2 = (Integer) props.get("toto_2");
- Integer toto_3 = (Integer) props.get("toto_3");
- Integer toto_4 = (Integer) props.get("toto_4");
- assertEquals("Assert toto - 3 ("+toto.intValue()+")", toto.intValue(), 1);
- assertEquals("Assert toto_2 - 3", toto_2.intValue(), 1);
- assertEquals("Assert toto_3 - 3", toto_3.intValue(), 1);
- assertEquals("Assert toto_4 - 3", toto_4.intValue(), 0);
- //Check tata
- props = tota.getPropsTata();
- Integer tata = (Integer) props.get("tata");
- Integer tataStr = (Integer) props.get("tataStr");
- Integer tataStrs = (Integer) props.get("tataStrs");
- Integer tata_2 = (Integer) props.get("tata_2");
- Integer tata_3 = (Integer) props.get("tata_3");
- Integer tata1 = (Integer) props.get("tata1");
- Integer tata1_1 = (Integer) props.get("tata1_1");
- Integer tata5 = (Integer) props.get("tata5");
- Integer tata5_1 = (Integer) props.get("tata5_1");
- Integer tata5_2 = (Integer) props.get("tata5_2");
- assertEquals("Assert tata - 3", tata.intValue(), 1);
- assertEquals("Assert tataStr - 3", tataStr.intValue(), 1);
- assertEquals("Assert tataStrs - 3", tataStrs.intValue(), 0);
- assertEquals("Assert tata_2 - 3", tata_2.intValue(), 1);
- assertEquals("Assert tata_3 - 3", tata_3.intValue(), 1);
- assertEquals("Assert tata1 - 3", tata1.intValue(), 1);
- assertEquals("Assert tata1_1 - 3", tata1_1.intValue(), 1);
- assertEquals("Assert tata5 - 3", tata5.intValue(), 1);
- assertEquals("Assert tata5_1 - 3", tata5_1.intValue(), 1);
- assertEquals("Assert tata5_2 - 3", tata5_2.intValue(), 1);
- context.ungetService(ref);
- tota = null;
-
- // Start a second import
- totoProv2.start();
- assertTrue("Assert under state - 4", under.getState() == ComponentInstance.VALID);
- assertNotNull("Assert tota service - 4", context.getServiceReference(Tota.class.getName()));
- ref = context.getServiceReference(Tota.class.getName());
- tota = (Tota) context.getService(ref);
- invokeAll(tota);
- // Check toto
- props = tota.getProps();
- toto = (Integer) props.get("toto");
- toto_2 = (Integer) props.get("toto_2");
- toto_3 = (Integer) props.get("toto_3");
- toto_4 = (Integer) props.get("toto_4");
- assertEquals("Assert toto - 4", toto.intValue(), 2);
- assertEquals("Assert toto_2 - 4", toto_2.intValue(), 2);
- assertEquals("Assert toto_3 - 4", toto_3.intValue(), 2);
- assertEquals("Assert toto_4 - 4", toto_4.intValue(), 0);
- //Check tata
- props = tota.getPropsTata();
- tata = (Integer) props.get("tata");
- tataStr = (Integer) props.get("tataStr");
- tataStrs = (Integer) props.get("tataStrs");
- tata_2 = (Integer) props.get("tata_2");
- tata_3 = (Integer) props.get("tata_3");
- tata1 = (Integer) props.get("tata1");
- tata1_1 = (Integer) props.get("tata1_1");
- tata5 = (Integer) props.get("tata5");
- tata5_1 = (Integer) props.get("tata5_1");
- tata5_2 = (Integer) props.get("tata5_2");
- assertEquals("Assert tata - 4", tata.intValue(), 2);
- assertEquals("Assert tataStr - 4", tataStr.intValue(), 2);
- assertEquals("Assert tataStrs - 4", tataStrs.intValue(), 0);
- assertEquals("Assert tata_2 - 4", tata_2.intValue(), 2);
- assertEquals("Assert tata_3 - 4", tata_3.intValue(), 2);
- assertEquals("Assert tata1 - 4", tata1.intValue(), 2);
- assertEquals("Assert tata1_1 - 4", tata1_1.intValue(), 2);
- assertEquals("Assert tata5 - 4", tata5.intValue(), 2);
- assertEquals("Assert tata5_1 - 4", tata5_1.intValue(), 2);
- assertEquals("Assert tata5_2 - 4", tata5_2.intValue(), 2);
-
- context.ungetService(ref);
- tota = null;
-
- tataFactory.stop();
- assertTrue("Assert under state - 5", under.getState() == ComponentInstance.INVALID);
- assertNull("Assert no tota service - 5", context.getServiceReference(Tota.class.getName()));
-
- totoProv2.stop();
- tataFactory.start();
- assertTrue("Assert under state - 6", under.getState() == ComponentInstance.VALID);
- assertNotNull("Assert tota service - 6", context.getServiceReference(Tota.class.getName()));
- ref = context.getServiceReference(Tota.class.getName());
- tota = (Tota) context.getService(ref);
- invokeAll(tota);
- // Check toto
- props = tota.getProps();
- toto = (Integer) props.get("toto");
- toto_2 = (Integer) props.get("toto_2");
- toto_3 = (Integer) props.get("toto_3");
- toto_4 = (Integer) props.get("toto_4");
- assertEquals("Assert toto - 6", toto.intValue(), 3);
- assertEquals("Assert toto_2 - 6", toto_2.intValue(), 3);
- assertEquals("Assert toto_3 - 6", toto_3.intValue(), 3);
- assertEquals("Assert toto_4 - 6", toto_4.intValue(), 0);
- //Check tata
- props = tota.getPropsTata();
- tata = (Integer) props.get("tata");
- tataStr = (Integer) props.get("tataStr");
- tataStrs = (Integer) props.get("tataStrs");
- tata_2 = (Integer) props.get("tata_2");
- tata_3 = (Integer) props.get("tata_3");
- tata1 = (Integer) props.get("tata1");
- tata1_1 = (Integer) props.get("tata1_1");
- tata5 = (Integer) props.get("tata5");
- tata5_1 = (Integer) props.get("tata5_1");
- tata5_2 = (Integer) props.get("tata5_2");
- assertEquals("Assert tata - 6", 1, tata.intValue());
- assertEquals("Assert tataStr - 6", tataStr.intValue(), 1);
- assertEquals("Assert tataStrs - 6", tataStrs.intValue(), 0);
- assertEquals("Assert tata_2 - 6", tata_2.intValue(), 1);
- assertEquals("Assert tata_3 - 6", tata_3.intValue(), 1);
- assertEquals("Assert tata1 - 6", tata1.intValue(), 1);
- assertEquals("Assert tata1_1 - 6", tata1_1.intValue(), 1);
- assertEquals("Assert tata5 - 6", tata5.intValue(), 1);
- assertEquals("Assert tata5_1 - 6", tata5_1.intValue(), 1);
- assertEquals("Assert tata5_2 - 6", tata5_2.intValue(), 1);
- context.ungetService(ref);
- tota = null;
-
- // Is arch exposed
- assertNotNull("Test arch", Utils.getServiceReferenceByName(context, Architecture.class.getName(), "ff"));
-
- totoProv.stop();
-
- assertTrue("Assert under state - 7", under.getState() == ComponentInstance.INVALID);
- assertNotNull("Test arch-2", Utils.getServiceReferenceByName(context, Architecture.class.getName(), "ff"));
- assertNull("Assert no tota service - 7", context.getServiceReference(Tota.class.getName()));
-
- under.dispose();
- under = null;
- }
-
- private void invoke(Tota tota) {
- tota.tata();
-
- assertEquals("Assert invoke tataint", tota.tataInt(2), 2);
- assertEquals("Assert invoke tataLong", tota.tataLong(2), 2);
- assertEquals("Assert invoke tataDouble", tota.tataDouble(2), 2);
- assertEquals("Assert invoke tataChar", tota.tataChar('a'), 'a');
- assertTrue("Assert invoke tataBoolean", tota.tataBoolean(true));
- assertEquals("Assert invoke tataByte", tota.tataByte((byte)2), 2);
- assertEquals("Assert invoke tataShort", tota.tataShort((short)5), 5);
- assertEquals("Assert invoke tataFloat", tota.tataFloat(5), 5);
-
- }
-
- private void invokeArrays(Tota tota) {
-
- int[] a = new int[] {1,2,3};
- assertEquals("Assert invoke tataint[]", tota.tataInts(a), a);
-
- long[] b = new long[] {1,2,3};
- assertEquals("Assert invoke tataLong[]", tota.tataLongs(b), b);
-
- double[] c = new double[] {1,2,3};
- assertEquals("Assert invoke tataDouble[]", tota.tataDoubles(c), c);
-
- char[] d = new char[] {'a','b', 'c'};
- assertEquals("Assert invoke tataChar[]", tota.tataChars(d), d);
-
- boolean[] e = new boolean[] {true, false};
- assertEquals("Assert invoke tataBoolean[]", tota.tataBooleans(e), e);
-
- byte[] f = new byte[] {(byte) 1};
- assertEquals("Assert invoke tataByte[]", tota.tataBytes(f), f);
-
- short[] g = new short[] {(short) 1};
- assertEquals("Assert invoke tataShort[]", tota.tataShorts(g), g);
-
- float[] h = new float[] {5,6,7};
- assertEquals("Assert invoke tataFloat[]", tota.tataFloats(h), h);
-
- }
-
- private void invokeStr(Tota tota) {
- tota.tataStr();
- }
-
- private void invokeTata(Tota tota) {
- tota.tata(1,2);
- tota.tata("tototototo");
- }
-
- private void invokeTata1(Tota tota) {
- assertEquals("Assert tata1", tota.tata1("foo"), "foo");
- assertEquals("Assert tata1 - 2", tota.tata1(new char[] {'a','b','c'}), "abc");
- }
-
- private void invokeTata5(Tota tota) {
- assertEquals("Assert tata5 -1", tota.tata5("foo",1), "foo"+1);
- assertEquals("Assert tata5 - 2", tota.tata5(new String[] {"a","b","c"}, 1), "31");
- assertEquals("Assert tata5 - 3", tota.tata5("foo", new int[] {1,2,3}), "foo3");
- }
-
- private void invokeAdd(Tota tota) {
- assertEquals("Assert add", tota.add(1,1,1), 3);
- }
-
- private void invokeToto(Tota tota) {
- tota.toto();
- assertEquals("Assert toto", tota.toto("foo"), "foo");
- tota.toto(1,2);
- }
-
- private void invokeAll(Tota tota) {
- invoke(tota);
- invokeArrays(tota);
- invokeStr(tota);
- invokeTata(tota);
- invokeTata1(tota);
- invokeTata5(tota);
- invokeAdd(tota);
- invokeToto(tota);
- }
-
-
-}
diff --git a/ipojo/tests/tests.composite/src/main/java/org/apache/felix/ipojo/test/composite/provides/TestComp8.java b/ipojo/tests/tests.composite/src/main/java/org/apache/felix/ipojo/test/composite/provides/TestComp8.java
deleted file mode 100644
index f9ceb09..0000000
--- a/ipojo/tests/tests.composite/src/main/java/org/apache/felix/ipojo/test/composite/provides/TestComp8.java
+++ /dev/null
@@ -1,365 +0,0 @@
-/*
- * 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.composite.provides;
-
-import java.util.Properties;
-
-import org.apache.felix.ipojo.ComponentFactory;
-import org.apache.felix.ipojo.ComponentInstance;
-import org.apache.felix.ipojo.Factory;
-import org.apache.felix.ipojo.architecture.Architecture;
-import org.apache.felix.ipojo.junit4osgi.OSGiTestCase;
-import org.apache.felix.ipojo.test.composite.component.TotoProvider;
-import org.apache.felix.ipojo.test.composite.component.TotoProviderGlue;
-import org.apache.felix.ipojo.test.composite.service.Tota;
-import org.apache.felix.ipojo.test.composite.util.Utils;
-import org.osgi.framework.ServiceReference;
-
-public class TestComp8 extends OSGiTestCase {
-
- private ComponentFactory tataFactory;
- private ComponentFactory totoFactory;
- private ComponentFactory tataFactory2;
-
- private ComponentInstance totoProv, totoProv2;
- private ComponentInstance under;
-
- public void setUp() {
- tataFactory = (ComponentFactory) Utils.getFactoryByName(context, "tata");
- totoFactory = (ComponentFactory) Utils.getFactoryByName(context, "toto");
- tataFactory2 = (ComponentFactory) Utils.getFactoryByName(context, "comp-6");
- tataFactory2.stop();
-
- Properties props = new Properties();
- props.put("name", "toto provider");
- try {
- totoProv = totoFactory.createComponentInstance(props);
- } catch(Exception e) {
- e.printStackTrace();
- }
-
- Properties props3 = new Properties();
- props3.put("name", "toto provider 2");
- try {
- totoProv2 = totoFactory.createComponentInstance(props3);
- } catch(Exception e) {
- e.printStackTrace();
- }
-
- totoProv.stop();
- totoProv2.stop();
-
- Factory factory = Utils.getFactoryByName(context, "comp-8");
- Properties props2 = new Properties();
- props2.put("name", "ff");
- try {
- under = factory.createComponentInstance(props2);
- } catch(Exception e) {
- e.printStackTrace();
- }
- tataFactory.stop();
-
- }
-
- public void tearDown() {
- tataFactory.start();
- totoProv.dispose();
- totoProv = null;
- totoProv2.dispose();
- totoProv2 = null;
- tataFactory2.start();
-
- // Reset counters
- TotoProvider.toto = 0;
- TotoProvider.toto_2 = 0;
- TotoProvider.toto_3 = 0;
- TotoProvider.toto_4 = 0;
- TotoProvider.toto1 = 0;
- TotoProviderGlue.toto = 0;
- TotoProviderGlue.toto_2 = 0;
- TotoProviderGlue.toto_3 = 0;
- TotoProviderGlue.toto_4 = 0;
- TotoProviderGlue.toto1 = 0;
- }
-
- public void testSimple() {
- // Neither factory nor instance
- assertTrue("Assert under state - 1", under.getState() == ComponentInstance.INVALID);
- assertNull("Assert no tota service - 1", context.getServiceReference(Tota.class.getName()));
-
- // Start the importer
- totoProv.start();
- assertTrue("Assert under state - 2", under.getState() == ComponentInstance.INVALID);
- assertNull("Assert no tota service - 2", context.getServiceReference(Tota.class.getName()));
-
- // Start the factory
- tataFactory.start();
- assertTrue("Assert under state - 3", under.getState() == ComponentInstance.VALID);
- assertNotNull("Assert tota service - 3", context.getServiceReference(Tota.class.getName()));
- ServiceReference ref = context.getServiceReference(Tota.class.getName());
- Tota tota = (Tota) context.getService(ref);
- invokeAll(tota);
- // Check toto
- Properties props = tota.getProps();
- Integer toto = (Integer) props.get("toto");
- Integer toto_2 = (Integer) props.get("toto_2");
- Integer toto_3 = (Integer) props.get("toto_3");
- Integer toto_4 = (Integer) props.get("toto_4");
- Integer gtoto = (Integer) props.get("gtoto");
- Integer gtoto_2 = (Integer) props.get("gtoto_2");
- Integer gtoto_3 = (Integer) props.get("gtoto_3");
- Integer gtoto_4 = (Integer) props.get("gtoto_4");
- assertEquals("Assert toto - 3 ("+toto.intValue()+")", toto.intValue(), 1);
- assertEquals("Assert toto_2 - 3", toto_2.intValue(), 1);
- assertEquals("Assert toto_3 - 3", toto_3.intValue(), 0);
- assertEquals("Assert toto_4 - 3", toto_4.intValue(), 0);
- assertEquals("Assert gtoto - 3 ("+gtoto.intValue()+")", gtoto.intValue(), 1);
- assertEquals("Assert gtoto_2 - 3", gtoto_2.intValue(), 1);
- assertEquals("Assert gtoto_3 - 3", gtoto_3.intValue(), 1);
- assertEquals("Assert gtoto_4 - 3", gtoto_4.intValue(), 0);
- //Check tata
- props = tota.getPropsTata();
- Integer tata = (Integer) props.get("tata");
- Integer tataStr = (Integer) props.get("tataStr");
- Integer tataStrs = (Integer) props.get("tataStrs");
- Integer tata_2 = (Integer) props.get("tata_2");
- Integer tata_3 = (Integer) props.get("tata_3");
- Integer tata1 = (Integer) props.get("tata1");
- Integer tata1_1 = (Integer) props.get("tata1_1");
- Integer tata5 = (Integer) props.get("tata5");
- Integer tata5_1 = (Integer) props.get("tata5_1");
- Integer tata5_2 = (Integer) props.get("tata5_2");
- assertEquals("Assert tata - 3", tata.intValue(), 1);
- assertEquals("Assert tataStr - 3", tataStr.intValue(), 1);
- assertEquals("Assert tataStrs - 3", tataStrs.intValue(), 0);
- assertEquals("Assert tata_2 - 3", tata_2.intValue(), 1);
- assertEquals("Assert tata_3 - 3", tata_3.intValue(), 1);
- assertEquals("Assert tata1 - 3", tata1.intValue(), 1);
- assertEquals("Assert tata1_1 - 3", tata1_1.intValue(), 1);
- assertEquals("Assert tata5 - 3", tata5.intValue(), 1);
- assertEquals("Assert tata5_1 - 3", tata5_1.intValue(), 1);
- assertEquals("Assert tata5_2 - 3", tata5_2.intValue(), 1);
- context.ungetService(ref);
- tota = null;
-
- // Start a second import
- totoProv2.start();
- assertTrue("Assert under state - 4", under.getState() == ComponentInstance.VALID);
- assertNotNull("Assert tota service - 4", context.getServiceReference(Tota.class.getName()));
- ref = context.getServiceReference(Tota.class.getName());
- tota = (Tota) context.getService(ref);
- invokeAll(tota);
- // Check toto
- props = tota.getProps();
- toto = (Integer) props.get("toto");
- toto_2 = (Integer) props.get("toto_2");
- toto_3 = (Integer) props.get("toto_3");
- toto_4 = (Integer) props.get("toto_4");
- gtoto = (Integer) props.get("gtoto");
- gtoto_2 = (Integer) props.get("gtoto_2");
- gtoto_3 = (Integer) props.get("gtoto_3");
- gtoto_4 = (Integer) props.get("gtoto_4");
- assertEquals("Assert toto - 4", toto.intValue(), 2);
- assertEquals("Assert toto_2 - 4", toto_2.intValue(), 2);
- assertEquals("Assert toto_3 - 4", toto_3.intValue(), 0);
- assertEquals("Assert toto_4 - 4", toto_4.intValue(), 0);
- assertEquals("Assert gtoto - 4 ("+gtoto.intValue()+")", gtoto.intValue(), 2);
- assertEquals("Assert gtoto_2 - 4", gtoto_2.intValue(), 2);
- assertEquals("Assert gtoto_3 - 4", gtoto_3.intValue(), 2);
- assertEquals("Assert gtoto_4 - 4", gtoto_4.intValue(), 0);
- //Check tata
- props = tota.getPropsTata();
- tata = (Integer) props.get("tata");
- tataStr = (Integer) props.get("tataStr");
- tataStrs = (Integer) props.get("tataStrs");
- tata_2 = (Integer) props.get("tata_2");
- tata_3 = (Integer) props.get("tata_3");
- tata1 = (Integer) props.get("tata1");
- tata1_1 = (Integer) props.get("tata1_1");
- tata5 = (Integer) props.get("tata5");
- tata5_1 = (Integer) props.get("tata5_1");
- tata5_2 = (Integer) props.get("tata5_2");
- assertEquals("Assert tata - 4", tata.intValue(), 2);
- assertEquals("Assert tataStr - 4", tataStr.intValue(), 2);
- assertEquals("Assert tataStrs - 4", tataStrs.intValue(), 0);
- assertEquals("Assert tata_2 - 4", tata_2.intValue(), 2);
- assertEquals("Assert tata_3 - 4", tata_3.intValue(), 2);
- assertEquals("Assert tata1 - 4", tata1.intValue(), 2);
- assertEquals("Assert tata1_1 - 4", tata1_1.intValue(), 2);
- assertEquals("Assert tata5 - 4", tata5.intValue(), 2);
- assertEquals("Assert tata5_1 - 4", tata5_1.intValue(), 2);
- assertEquals("Assert tata5_2 - 4", tata5_2.intValue(), 2);
-
- context.ungetService(ref);
- tota = null;
-
- tataFactory.stop();
- assertTrue("Assert under state - 5", under.getState() == ComponentInstance.INVALID);
- assertNull("Assert no tota service - 5", context.getServiceReference(Tota.class.getName()));
-
- totoProv2.stop();
- tataFactory.start();
- assertTrue("Assert under state - 6", under.getState() == ComponentInstance.VALID);
- assertNotNull("Assert tota service - 6", context.getServiceReference(Tota.class.getName()));
- ref = context.getServiceReference(Tota.class.getName());
- tota = (Tota) context.getService(ref);
- invokeAll(tota);
- // Check toto
- props = tota.getProps();
- toto = (Integer) props.get("toto");
- toto_2 = (Integer) props.get("toto_2");
- toto_3 = (Integer) props.get("toto_3");
- toto_4 = (Integer) props.get("toto_4");
- gtoto = (Integer) props.get("gtoto");
- gtoto_2 = (Integer) props.get("gtoto_2");
- gtoto_3 = (Integer) props.get("gtoto_3");
- gtoto_4 = (Integer) props.get("gtoto_4");
- assertEquals("Assert toto - 6", toto.intValue(), 3);
- assertEquals("Assert toto_2 - 6", toto_2.intValue(), 3);
- assertEquals("Assert toto_3 - 6", toto_3.intValue(), 0);
- assertEquals("Assert toto_4 - 6", toto_4.intValue(), 0);
- assertEquals("Assert gtoto - 6 ("+gtoto.intValue()+")", gtoto.intValue(), 3);
- assertEquals("Assert gtoto_2 - 6", gtoto_2.intValue(), 3);
- assertEquals("Assert gtoto_3 - 6", gtoto_3.intValue(), 3);
- assertEquals("Assert gtoto_4 - 6", gtoto_4.intValue(), 0);
- //Check tata
- props = tota.getPropsTata();
- tata = (Integer) props.get("tata");
- tataStr = (Integer) props.get("tataStr");
- tataStrs = (Integer) props.get("tataStrs");
- tata_2 = (Integer) props.get("tata_2");
- tata_3 = (Integer) props.get("tata_3");
- tata1 = (Integer) props.get("tata1");
- tata1_1 = (Integer) props.get("tata1_1");
- tata5 = (Integer) props.get("tata5");
- tata5_1 = (Integer) props.get("tata5_1");
- tata5_2 = (Integer) props.get("tata5_2");
- assertEquals("Assert tata - 6", tata.intValue(), 1);
- assertEquals("Assert tataStr - 6", tataStr.intValue(), 1);
- assertEquals("Assert tataStrs - 6", tataStrs.intValue(), 0);
- assertEquals("Assert tata_2 - 6", tata_2.intValue(), 1);
- assertEquals("Assert tata_3 - 6", tata_3.intValue(), 1);
- assertEquals("Assert tata1 - 6", tata1.intValue(), 1);
- assertEquals("Assert tata1_1 - 6", tata1_1.intValue(), 1);
- assertEquals("Assert tata5 - 6", tata5.intValue(), 1);
- assertEquals("Assert tata5_1 - 6", tata5_1.intValue(), 1);
- assertEquals("Assert tata5_2 - 6", tata5_2.intValue(), 1);
- context.ungetService(ref);
- tota = null;
-
- // Is arch exposed
- assertNotNull("Test arch", Utils.getServiceReferenceByName(context, Architecture.class.getName(), "ff"));
-
- totoProv.stop();
-
- assertTrue("Assert under state - 7", under.getState() == ComponentInstance.INVALID);
- assertNotNull("Test arch-2", Utils.getServiceReferenceByName(context, Architecture.class.getName(), "ff"));
- assertNull("Assert no tota service - 7", context.getServiceReference(Tota.class.getName()));
-
- under.dispose();
- under = null;
- }
-
-
-
- private void invoke(Tota tota) {
- tota.tata();
-
- assertEquals("Assert invoke tataint", tota.tataInt(2), 2);
- assertEquals("Assert invoke tataLong", tota.tataLong(2), 2);
- assertEquals("Assert invoke tataDouble", tota.tataDouble(2), 2);
- assertEquals("Assert invoke tataChar", tota.tataChar('a'), 'a');
- assertTrue("Assert invoke tataBoolean", tota.tataBoolean(true));
- assertEquals("Assert invoke tataByte", tota.tataByte((byte)2), 2);
- assertEquals("Assert invoke tataShort", tota.tataShort((short)5), 5);
- assertEquals("Assert invoke tataFloat", tota.tataFloat(5), 5);
-
- }
-
- private void invokeArrays(Tota tota) {
-
- int[] a = new int[] {1,2,3};
- assertEquals("Assert invoke tataint[]", tota.tataInts(a), a);
-
- long[] b = new long[] {1,2,3};
- assertEquals("Assert invoke tataLong[]", tota.tataLongs(b), b);
-
- double[] c = new double[] {1,2,3};
- assertEquals("Assert invoke tataDouble[]", tota.tataDoubles(c), c);
-
- char[] d = new char[] {'a','b', 'c'};
- assertEquals("Assert invoke tataChar[]", tota.tataChars(d), d);
-
- boolean[] e = new boolean[] {true, false};
- assertEquals("Assert invoke tataBoolean[]", tota.tataBooleans(e), e);
-
- byte[] f = new byte[] {(byte) 1};
- assertEquals("Assert invoke tataByte[]", tota.tataBytes(f), f);
-
- short[] g = new short[] {(short) 1};
- assertEquals("Assert invoke tataShort[]", tota.tataShorts(g), g);
-
- float[] h = new float[] {5,6,7};
- assertEquals("Assert invoke tataFloat[]", tota.tataFloats(h), h);
-
- }
-
- private void invokeStr(Tota tota) {
- tota.tataStr();
- }
-
- private void invokeTata(Tota tota) {
- tota.tata(1,2);
- tota.tata("tototototo");
- }
-
- private void invokeTata1(Tota tota) {
- assertEquals("Assert tata1", tota.tata1("foo"), "foo");
- assertEquals("Assert tata1 - 2", tota.tata1(new char[] {'a','b','c'}), "abc");
- }
-
- private void invokeTata5(Tota tota) {
- assertEquals("Assert tata5 -1", tota.tata5("foo",1), "foo"+1);
- assertEquals("Assert tata5 - 2", tota.tata5(new String[] {"a","b","c"}, 1), "31");
- assertEquals("Assert tata5 - 3", tota.tata5("foo", new int[] {1,2,3}), "foo3");
- }
-
- private void invokeAdd(Tota tota) {
- assertEquals("Assert add", tota.add(1,1,1), 3);
- }
-
- private void invokeToto(Tota tota) {
- tota.toto();
- assertEquals("Assert toto", tota.toto("foo"), "foo");
- tota.toto(1,2);
- }
-
- private void invokeAll(Tota tota) {
- invoke(tota);
- invokeArrays(tota);
- invokeStr(tota);
- invokeTata(tota);
- invokeTata1(tota);
- invokeTata5(tota);
- invokeAdd(tota);
- invokeToto(tota);
- }
-
-
-}
diff --git a/ipojo/tests/tests.composite/src/main/java/org/apache/felix/ipojo/test/composite/test/CompositeTest.java b/ipojo/tests/tests.composite/src/main/java/org/apache/felix/ipojo/test/composite/test/CompositeTest.java
deleted file mode 100644
index e7f73bb..0000000
--- a/ipojo/tests/tests.composite/src/main/java/org/apache/felix/ipojo/test/composite/test/CompositeTest.java
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- * 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.composite.test;
-
-import java.util.Properties;
-
-import org.apache.felix.ipojo.ComponentInstance;
-import org.apache.felix.ipojo.Factory;
-import org.apache.felix.ipojo.ServiceContext;
-import org.apache.felix.ipojo.junit4osgi.OSGiTestCase;
-import org.apache.felix.ipojo.test.composite.service.BazService;
-import org.apache.felix.ipojo.test.composite.service.CheckService;
-import org.apache.felix.ipojo.test.composite.service.FooService;
-import org.apache.felix.ipojo.test.composite.util.Utils;
-import org.osgi.framework.InvalidSyntaxException;
-import org.osgi.framework.ServiceReference;
-
-public class CompositeTest extends OSGiTestCase {
-
- public void testAPI() {
- Factory fact1 = Utils.getFactoryByName(context, "composite.empty");
- Properties p = new Properties();
- p.put("name", "empty-1");
- ComponentInstance empty = null;
- try {
- empty = fact1.createComponentInstance(p);
- } catch(Exception e) {
- e.printStackTrace();
- fail(e.getMessage());
- }
-
- ServiceContext sc = Utils.getServiceContext(empty);
-
- Factory fact2 = Utils.getFactoryByName(context, "composite.test.2");
- Properties props2 = new Properties();
- props2.put("name", "2"); // 2
- Factory fact3 = Utils.getFactoryByName(context, "composite.test.3");
- Properties props3 = new Properties();
- props3.put("name", "3");
- ComponentInstance comp2 = null;
- ComponentInstance comp3 = null;
- try {
- comp2 = fact2.createComponentInstance(props2, sc);
- comp3 = fact3.createComponentInstance(props3, sc);
- } catch(Throwable e) {
- e.printStackTrace();
- fail(e.getMessage());
- }
-
- assertTrue("Test comp3", comp3.getState() == ComponentInstance.VALID);
- assertTrue("Test comp2", comp2.getState() == ComponentInstance.VALID);
-
- ServiceReference ref = null;
-
- ref = Utils.getServiceReferenceByName(sc, CheckService.class.getName(), "2"); // 2
-
- assertNotNull("Check ref", ref);
- CheckService cs = (CheckService) sc.getService(ref);
- assertTrue("Check invoke", cs.check());
-
- comp3.dispose();
- comp2.dispose();
- empty.dispose();
- }
-
- public void testInstantiator() {
- String type = "composite.instantiator";
- Factory fact = Utils.getFactoryByName(context, type);
- ComponentInstance ci = null;
- Properties p = new Properties();
- p.put("name", "mon_coeur");
- try {
- ci = fact.createComponentInstance(p);
- } catch(Exception e) {
- e.printStackTrace();
- }
-
- assertTrue("Check ci", ci.getState() == ComponentInstance.VALID);
- ServiceReference ref = Utils.getServiceReferenceByName(context, BazService.class.getName(), "mon_coeur");
- assertNotNull("Check ref",ref);
- BazService bs = (BazService) context.getService(ref);
- assertTrue("Check invocation", bs.foo());
- context.ungetService(ref);
- ref = Utils.getServiceReferenceByName(context, FooService.class.getName(), "mon_coeur");
- assertNotNull("Check ref 2 ",ref);
- FooService fs = (FooService) context.getService(ref);
- assertTrue("Check invocation", fs.foo());
- context.ungetService(ref);
- ci.dispose();
- }
-
- public void testAPI2() {
- Factory fact1 = Utils.getFactoryByName(context, "composite.empty");
- Properties p = new Properties();
- p.put("name", "empty-2");
- ComponentInstance empty = null;
- try {
- empty = fact1.createComponentInstance(p);
- } catch(Exception e) {
- e.printStackTrace();
- }
-
- ServiceContext sc = Utils.getServiceContext(empty);
-
- Factory fact2 = Utils.getFactoryByName(sc, "composite.test.2");
- Properties props2 = new Properties();
- props2.put("name", "4");
- Factory fact3 = Utils.getFactoryByName(sc, "composite.test.3");
- Properties props3 = new Properties();
- props3.put("name", "5");
- ComponentInstance comp2 = null;
- ComponentInstance comp3 = null;
- try {
- comp2 = fact2.createComponentInstance(props2, sc);
- comp3 = fact3.createComponentInstance(props3, sc);
- } catch(Exception e) {
- e.printStackTrace();
- }
-
- assertTrue("Test comp3", comp3.getState() == ComponentInstance.VALID);
- assertTrue("Test comp2", comp2.getState() == ComponentInstance.VALID);
-
- ServiceReference ref = null;
-
- ref = Utils.getServiceReferenceByName(sc, CheckService.class.getName(), "4");
-
- assertNotNull("Check ref", ref);
- CheckService cs = (CheckService) sc.getService(ref);
- assertTrue("Check invoke", cs.check());
-
- comp3.dispose();
- comp2.dispose();
- empty.dispose();
- }
-
-
- public void testApplication() {
- Factory factory = Utils.getFactoryByName(context, "composite.test.1");
- ComponentInstance ci = null;
- Properties props = new Properties();
- props.put("name", "Test");
- try {
- ci = factory.createComponentInstance(props);
- } catch(Exception e) {
- fail("Cannot instantiate Test " + e.getMessage());
- }
-
- assertTrue("Check ci state", ci.getState() == ComponentInstance.VALID );
-
- ServiceReference[] refs = null;
- try {
- refs = context.getServiceReferences(CheckService.class.getName(), "(instance.name=Test)");
- } catch (InvalidSyntaxException e) {
- fail("Invalid filter : " + e.getMessage());
- }
- assertNotNull("Check refs not null", refs);
- CheckService cs = (CheckService) context.getService(refs[0]);
-
- assertTrue("Check invocation", cs.check());
- ci.dispose();
-
- }
-
-}
diff --git a/ipojo/tests/tests.composite/src/main/resources/metadata.xml b/ipojo/tests/tests.composite/src/main/resources/metadata.xml
index 23636cf..49b8637 100644
--- a/ipojo/tests/tests.composite/src/main/resources/metadata.xml
+++ b/ipojo/tests/tests.composite/src/main/resources/metadata.xml
@@ -71,223 +71,37 @@
</provides>
</component>
- <!-- Composite -->
- <composite name="composite.empty" factory="true" architecture="true">
- </composite>
-
- <composite name="composite.bar.1" architecture="true">
- <subservice action="instantiate" specification="org.apache.felix.ipojo.test.composite.service.BarService"/>
- </composite>
-
- <composite name="composite.bar.2" architecture="true">
- <subservice action="instantiate" specification="org.apache.felix.ipojo.test.composite.service.BarService" aggregate="true"/>
- </composite>
-
- <composite name="composite.bar.3" architecture="true">
- <subservice action="instantiate" specification="org.apache.felix.ipojo.test.composite.service.BarService" optional="true"/>
- </composite>
-
- <composite name="composite.bar.4" architecture="true">
- <subservice action="instantiate" specification="org.apache.felix.ipojo.test.composite.service.FooService" aggregate="true" optional="true"/>
- </composite>
-
- <composite name="composite.bar.5-accept" architecture="true">
- <subservice action="instantiate" specification="org.apache.felix.ipojo.test.composite.service.FooService">
- <property name="boolean" value="true"/>
- <property name="string" value="foo"/>
- <property name="strAprop" value="{foo, bar, baz}"/>
- <property name="int" value="5"/>
- </subservice>
- </composite>
-
- <composite name="composite.bar.5-refuse1" architecture="true">
- <subservice action="instantiate" specification="org.apache.felix.ipojo.test.composite.service.BarService">
- <property name="foo" value="bar"/>
- <property name="boolean" value="true"/>
- <property name="string" value="foo"/>
- <property name="strAprop" value="{foo, bar, baz}"/>
- <property name="int" value="5"/>
- </subservice>
- </composite>
-
- <composite name="composite.bar.5-refuse2" architecture="true">
- <subservice action="instantiate" specification="org.apache.felix.ipojo.test.composite.service.BarService">
- <property name="string" value="foo"/>
- <property name="strAprop" value="{foo, bar, baz}"/>
- </subservice>
- </composite>
-
- <composite name="composite.inst.1" factory="true" architecture="true">
- <instance component="COMPO-FooProviderType-1" /> <!-- name="FooProv" -->
- <instance component="COMPO-FooProviderType-Dyn2">
- <property name="boolean" value="true"/>
- <property name="string" value="foo"/>
- <property name="strAProp" value="{a,b,c}"/>
- </instance>
- </composite>
-
- <composite name="composite.requires.1" architecture="true">
- <subservice action="import" specification="org.apache.felix.ipojo.test.composite.service.FooService" scope="composite"/>
- </composite>
-
- <composite name="composite.requires.2" architecture="true">
- <subservice action="import" specification="org.apache.felix.ipojo.test.composite.service.FooService" aggregate="true" scope="composite"/>
- </composite>
-
- <composite name="composite.requires.3" architecture="true">
- <subservice action="import" specification="org.apache.felix.ipojo.test.composite.service.FooService" optional="true" scope="composite"/>
- </composite>
-
- <composite name="composite.requires.4" architecture="true">
- <subservice action="import" specification="org.apache.felix.ipojo.test.composite.service.FooService" optional="true" aggregate="true" scope="composite"/>
- </composite>
-
- <composite name="composite.requires.5" architecture="true">
- <subservice action="import" specification="org.apache.felix.ipojo.test.composite.service.FooService" filter="(&(int=2)(long=40))" scope="composite"/>
- </composite>
-
- <component className="org.apache.felix.ipojo.test.composite.component.BazProviderType1" factory="BazProviderType" scope="composite">
- <provides/>
+ <component
+ className="org.apache.felix.ipojo.test.composite.component.BazProviderType1"
+ factory="BazProviderType" scope="composite">
+ <provides />
</component>
- <composite name="composite.export.1" architecture="true">
- <subservice action="import" specification="org.apache.felix.ipojo.test.composite.service.BazService" aggregate="true" optional="true" filter="(!(instance.name=export))" scope="composite"/>
- <provides action="export" specification="org.apache.felix.ipojo.test.composite.service.BazService"/>
- </composite>
+ <component
+ classname="org.apache.felix.ipojo.test.composite.component.TataProvider"
+ factory="tata">
+ <provides />
+ </component>
+
+ <component
+ classname="org.apache.felix.ipojo.test.composite.component.TotoProvider"
+ factory="toto" architecture="true">
+ <provides />
+ </component>
+
+ <component
+ classname="org.apache.felix.ipojo.test.composite.component.TotoProviderGlue"
+ factory="totoglue">
+ <requires field="m_toto" scope="composite" />
+ </component>
- <composite name="composite.export.2" architecture="true">
- <subservice action="import" specification="org.apache.felix.ipojo.test.composite.service.BazService" scope="composite" aggregate="true" optional="true" filter="(!(instance.name=export))"/>
- <provides action="export" specification="org.apache.felix.ipojo.test.composite.service.BazService" optional="true"/>
- </composite>
-
- <composite name="composite.export.3" architecture="true">
- <subservice action="import" specification="org.apache.felix.ipojo.test.composite.service.BazService" scope="composite" aggregate="true" optional="true" filter="(!(instance.name=export))"/>
- <provides action="export" specification="org.apache.felix.ipojo.test.composite.service.BazService" aggregate="true"/>
- </composite>
-
- <composite name="composite.export.4" architecture="true">
- <subservice action="import" specification="org.apache.felix.ipojo.test.composite.service.BazService" aggregate="true" optional="true" filter="(!(instance.name=export))" scope="composite"/>
- <provides action="export" specification="org.apache.felix.ipojo.test.composite.service.BazService" aggregate="true" optional="true"/>
- </composite>
-
- <composite name="composite.export.5" architecture="true">
- <subservice action="import" specification="org.apache.felix.ipojo.test.composite.service.BazService" aggregate="true" optional="true" filter="(!(instance.name=export))" scope="composite"/>
- <provides action="export" specification="org.apache.felix.ipojo.test.composite.service.BazService" filter="(instance.name=foo1)"/>
+ <!-- Composite -->
+ <composite name="composite.empty" factory="true" architecture="true">
</composite>
<component className="org.apache.felix.ipojo.test.composite.component.Baz2CheckProvider" factory="Baz2CheckProvider" architecture="true">
<requires field="fs" scope="composite"/>
<provides/>
</component>
-
- <composite name="composite.test.3" architecture="true">
- <subservice action="instantiate" specification="org.apache.felix.ipojo.test.composite.service.BazService" aggregate="true" filter="(factory.name=BazProviderType)"/>
- <provides action="export" specification="org.apache.felix.ipojo.test.composite.service.BazService"/>
- </composite>
-
- <composite name="composite.test.2" architecture="true">
- <subservice action="instantiate" specification="org.apache.felix.ipojo.test.composite.service.CheckService" filter="(factory.name=Baz2CheckProvider)"/>
- <provides action="export" specification="org.apache.felix.ipojo.test.composite.service.CheckService"/>
- <subservice action="import" specification="org.apache.felix.ipojo.test.composite.service.BazService" scope="composite"/>
- </composite>
-
- <composite name="composite.test.1" architecture="true">
- <subservice action="instantiate" specification="org.apache.felix.ipojo.test.composite.service.BazService" filter="(factory.name=composite.test.3)" />
- <subservice action="instantiate" specification="org.apache.felix.ipojo.test.composite.service.CheckService" filter="(factory.name=composite.test.2)"/>
- <provides action="export" specification="org.apache.felix.ipojo.test.composite.service.CheckService"/>
- </composite>
-
- <composite name="composite.instantiator" architecture="true">
- <subservice action="instantiate" specification="org.apache.felix.ipojo.test.composite.service.BazService" filter="(factory.name=composite.test.3)"/>
- <subservice action="instantiate" specification="org.apache.felix.ipojo.test.composite.service.FooService"/>
- <provides action="export" specification="org.apache.felix.ipojo.test.composite.service.BazService"/>
- <provides action="export" specification="org.apache.felix.ipojo.test.composite.service.FooService"/>
- </composite>
-
- <!-- Test composition provides -->
- <component classname="org.apache.felix.ipojo.test.composite.component.TataProvider" factory="tata">
- <provides/>
- </component>
-
- <component classname="org.apache.felix.ipojo.test.composite.component.TotoProvider" factory="toto" architecture="true">
- <provides/>
- </component>
-
- <component classname="org.apache.felix.ipojo.test.composite.component.TotoProviderGlue" factory="totoglue">
- <requires field="m_toto" scope="composite"/>
- </component>
-
- <composite name="comp-0" architecture="true">
- <subservice action="instantiate" specification="org.apache.felix.ipojo.test.composite.service.Tata"/>
- <subservice action="import" specification="org.apache.felix.ipojo.test.composite.service.Toto"/>
- <provides action="implement" specification="org.apache.felix.ipojo.test.composite.service.Tota"/>
- </composite>
-
- <composite name="comp-1" architecture="true">
- <subservice action="instantiate" specification="org.apache.felix.ipojo.test.composite.service.Tata"/>
- <subservice action="import" specification="org.apache.felix.ipojo.test.composite.service.Toto"/>
- <provides action="implement" specification="org.apache.felix.ipojo.test.composite.service.Tota">
- <delegation method="tataInt" policy="One"/>
- <delegation method="toto1" policy="All"/>
- </provides>
- </composite>
-
- <composite name="comp-2" architecture="true">
- <subservice action="instantiate" specification="org.apache.felix.ipojo.test.composite.service.Tata" aggregate="true"/>
- <subservice action="import" specification="org.apache.felix.ipojo.test.composite.service.Toto" aggregate="true"/>
- <provides action="implement" specification="org.apache.felix.ipojo.test.composite.service.Tota">
- <delegation method="tataInt" policy="One"/>
- <delegation method="toto1" policy="All"/>
- </provides>
- </composite>
-
- <composite name="comp-3" architecture="true">
- <subservice action="instantiate" specification="org.apache.felix.ipojo.test.composite.service.Tata"/>
- <subservice action="import" specification="org.apache.felix.ipojo.test.composite.service.Toto" optional="true"/>
- <provides action="implement" specification="org.apache.felix.ipojo.test.composite.service.Tota">
- </provides>
- </composite>
-
- <composite name="comp-4" architecture="true">
- <subservice action="instantiate" specification="org.apache.felix.ipojo.test.composite.service.Tata"/>
- <subservice action="import" specification="org.apache.felix.ipojo.test.composite.service.Toto" optional="true"/>
- <provides action="implement" specification="org.apache.felix.ipojo.test.composite.service.Tota">
- <delegation method="tataInt" policy="One"/>
- <delegation method="toto1" policy="All"/>
- </provides>
- </composite>
-
- <composite name="comp-5" architecture="true">
- <subservice action="instantiate" specification="org.apache.felix.ipojo.test.composite.service.Tata" aggregate="true"/>
- <!-- <subservice action="import" specification="org.apache.felix.ipojo.test.composite.service.Toto" aggregate ="true" optional="true"/> -->
- <provides action="implement" specification="org.apache.felix.ipojo.test.composite.service.Tota">
- <delegation method="tataInt" policy="One"/>
- <delegation method="toto1" policy="All"/>
- </provides>
- </composite>
-
- <composite name="comp-6" architecture="true">
- <subservice action="instantiate" specification="org.apache.felix.ipojo.test.composite.service.Tata" aggregate="true"/>
- <subservice action="import" specification="org.apache.felix.ipojo.test.composite.service.Toto" aggregate="true" optional="true"/>
- <provides action="implement" specification="org.apache.felix.ipojo.test.composite.service.Toto">
- <delegation method="toto1" policy="All"/>
- </provides>
- <provides action="implement" specification="org.apache.felix.ipojo.test.composite.service.Tata">
- <delegation method="tataInt" policy="One"/>
- </provides>
- </composite>
-
- <composite name="comp-7" architecture="true">
- <instance component="tata"/>
- <subservice action="import" specification="org.apache.felix.ipojo.test.composite.service.Toto"/>
- <provides action="implement" specification="org.apache.felix.ipojo.test.composite.service.Tota"/>
- </composite>
-
- <composite name="comp-8" architecture="true">
- <instance component="tata"/>
- <instance component="totoglue"/>
- <subservice action="import" specification="org.apache.felix.ipojo.test.composite.service.Toto"/>
- <provides action="implement" specification="org.apache.felix.ipojo.test.composite.service.Tota"/>
- </composite>
</ipojo>
diff --git a/ipojo/tests/tests.core.annotations/pom.xml b/ipojo/tests/tests.core.annotations/pom.xml
new file mode 100644
index 0000000..342ca61
--- /dev/null
+++ b/ipojo/tests/tests.core.annotations/pom.xml
@@ -0,0 +1,106 @@
+<!--
+ 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 Annotations Test Suite</name>
+ <artifactId>tests.core.annotations</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>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.ipojo.annotations</artifactId>
+ <version>0.7.6-SNAPSHOT</version>
+ </dependency>
+
+
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ <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.annotations.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.annotations.AnnotationsTestSuite
+ </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>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/AggregateDependency.java b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/AggregateDependency.java
new file mode 100644
index 0000000..f51485a
--- /dev/null
+++ b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/AggregateDependency.java
@@ -0,0 +1,78 @@
+package org.apache.felix.ipojo.test.scenarios.annotations;
+
+import org.apache.felix.ipojo.junit4osgi.OSGiTestCase;
+import org.apache.felix.ipojo.metadata.Element;
+import org.apache.felix.ipojo.test.scenarios.util.Utils;
+
+public class AggregateDependency extends OSGiTestCase {
+
+ private Element[] deps ;
+
+ public void setUp() {
+ Element meta = Utils.getMetatadata(context, "org.apache.felix.ipojo.test.scenarios.component.AggregateDependency");
+ deps = meta.getElements("requires");
+ }
+
+
+ public void testCallbackBind() {
+ Element dep = getDependencyById(deps, "Bar");
+ String opt = dep.getAttribute("aggregate");
+ assertEquals("Check aggregate", "true", opt);
+ }
+
+ public void testCallbackUnbind() {
+ Element dep = getDependencyById(deps, "Baz");
+ String opt = dep.getAttribute("aggregate");
+ assertEquals("Check aggregate", "true", opt);
+ }
+
+ public void testBindOnly() {
+ Element dep = getDependencyById(deps, "bindonly");
+ String opt = dep.getAttribute("aggregate");
+ assertEquals("Check aggregate", "true", opt);
+ }
+
+ public void testUnbindOnly() {
+ Element dep = getDependencyById(deps, "unbindonly");
+ String opt = dep.getAttribute("aggregate");
+ assertEquals("Check aggregate", "true", opt);
+ }
+
+
+
+ private Element getDependencyById(Element[] deps, String name) {
+ for (int i = 0; i < deps.length; i++) {
+ String na = deps[i].getAttribute("id");
+ String field = deps[i].getAttribute("field");
+ if (na != null && na.equalsIgnoreCase(name)) {
+ return deps[i];
+ }
+ if (field != null && field.equalsIgnoreCase(name)) {
+ return deps[i];
+ }
+ }
+ fail("Dependency " + name + " not found");
+ return null;
+ }
+
+ private String getBind(Element dep) {
+ Element[] elem = dep.getElements("callback");
+ for (int i = 0; elem != null && i < elem.length; i++) {
+ if (elem[i].getAttribute("type").equalsIgnoreCase("bind")) {
+ return elem[i].getAttribute("method");
+ }
+ }
+ return null;
+ }
+
+ private String getUnbind(Element dep) {
+ Element[] elem = dep.getElements("callback");
+ for (int i = 0; elem != null && i < elem.length; i++) {
+ if (elem[i].getAttribute("type").equalsIgnoreCase("unbind")) {
+ return elem[i].getAttribute("method");
+ }
+ }
+ return null;
+ }
+
+}
diff --git a/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/AnnotationsTestSuite.java b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/AnnotationsTestSuite.java
new file mode 100644
index 0000000..ff7292b
--- /dev/null
+++ b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/AnnotationsTestSuite.java
@@ -0,0 +1,47 @@
+/*
+ * 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.annotations;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.apache.felix.ipojo.junit4osgi.OSGiTestSuite;
+import org.osgi.framework.BundleContext;
+
+public class AnnotationsTestSuite extends TestSuite {
+
+ public static Test suite(BundleContext bc) {
+ OSGiTestSuite ots = new OSGiTestSuite("Annotations Test Suite", bc);
+ ots.addTestSuite(ServiceProdiving.class);
+ ots.addTestSuite(LifecycleController.class);
+ ots.addTestSuite(LifecycleCallbacks.class);
+ ots.addTestSuite(Properties.class);
+ ots.addTestSuite(Architecture.class);
+ ots.addTestSuite(Factory.class);
+ ots.addTestSuite(Dependency.class);
+ ots.addTestSuite(OptionalDependency.class);
+ ots.addTestSuite(AggregateDependency.class);
+ ots.addTestSuite(PolicyDependency.class);
+ ots.addTestSuite(FilteredDependency.class);
+ ots.addTestSuite(RankedDependency.class);
+ return ots;
+ }
+
+}
+
diff --git a/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/Architecture.java b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/Architecture.java
new file mode 100644
index 0000000..c4ca4fb
--- /dev/null
+++ b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/Architecture.java
@@ -0,0 +1,26 @@
+package org.apache.felix.ipojo.test.scenarios.annotations;
+
+import org.apache.felix.ipojo.junit4osgi.OSGiTestCase;
+import org.apache.felix.ipojo.metadata.Element;
+import org.apache.felix.ipojo.test.scenarios.util.Utils;
+
+public class Architecture extends OSGiTestCase {
+
+ public void testArch() {
+ Element meta = Utils.getMetatadata(context, "org.apache.felix.ipojo.test.scenarios.component.Arch");
+ String arch = meta.getAttribute("architecture");
+ assertNotNull("Architecture exists ", arch);
+ assertEquals("Architecture value", "true", arch);
+ }
+
+ public void testNoArch() {
+ Element meta = Utils.getMetatadata(context, "org.apache.felix.ipojo.test.scenarios.component.NoArch");
+ String arch = meta.getAttribute("architecture");
+ assertNotNull("Architecture exists ", arch);
+ assertEquals("Architecture value", "false", arch);
+ }
+
+
+
+}
+
diff --git a/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/Dependency.java b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/Dependency.java
new file mode 100644
index 0000000..a939d95
--- /dev/null
+++ b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/Dependency.java
@@ -0,0 +1,106 @@
+package org.apache.felix.ipojo.test.scenarios.annotations;
+
+import org.apache.felix.ipojo.junit4osgi.OSGiTestCase;
+import org.apache.felix.ipojo.metadata.Element;
+import org.apache.felix.ipojo.test.scenarios.util.Utils;
+
+public class Dependency extends OSGiTestCase {
+
+ public void testDependencyDeclaration() {
+ Element meta = Utils.getMetatadata(context, "org.apache.felix.ipojo.test.scenarios.component.Dependency");
+ Element[] deps = meta.getElements("requires");
+
+ // Check fs
+ Element dep = getDependencyById(deps, "fs");
+ String field = dep.getAttribute("field");
+ String id = dep.getAttribute("id");
+ String bind = getBind(dep);
+ String unbind = getUnbind(dep);
+ assertNotNull("Check fs field", field);
+ assertEquals("Check fs field", "fs", field);
+ assertNull("Check fs bind", bind);
+ assertNull("Check fs unbind", unbind);
+ assertNull("Check fs id", id);
+
+ // Check bar
+ dep = getDependencyById(deps, "Bar");
+ field = dep.getAttribute("field");
+ id = dep.getAttribute("id");
+ bind = getBind(dep);
+ unbind = getUnbind(dep);
+ assertNull("Check bar field", field);
+ assertEquals("Check bar bind", "bindBar", bind);
+ assertEquals("Check bar unbind", "unbindBar", unbind);
+ assertEquals("Check bar id", "Bar", id);
+
+ // Check baz
+ dep = getDependencyById(deps, "Baz");
+ field = dep.getAttribute("field");
+ id = dep.getAttribute("id");
+ bind = getBind(dep);
+ unbind = getUnbind(dep);
+ assertNull("Check baz field", field);
+ assertEquals("Check baz bind", "bindBaz", bind);
+ assertEquals("Check baz unbind", "unbindBaz", unbind);
+ assertEquals("Check baz id", "Baz", id);
+
+ // Check fs2
+ dep = getDependencyById(deps, "fs2");
+ field = dep.getAttribute("field");
+ id = dep.getAttribute("id");
+ bind = getBind(dep);
+ unbind = getUnbind(dep);
+ assertNotNull("Check fs2 field", field);
+ assertEquals("Check fs2 field", "fs2", field);
+ assertEquals("Check fs2 bind", "bindFS2", bind);
+ assertEquals("Check fs2 unbind", "unbindFS2", unbind);
+
+ // Check fs2inv
+ dep = getDependencyById(deps, "fs2inv");
+ field = dep.getAttribute("field");
+ id = dep.getAttribute("id");
+ bind = getBind(dep);
+ unbind = getUnbind(dep);
+ assertNotNull("Check fs2inv field", field);
+ assertEquals("Check fs2 field", "fs2inv", field);
+ assertEquals("Check fs2 bind", "bindFS2Inv", bind);
+ assertEquals("Check fs2 unbind", "unbindFS2Inv", unbind);
+ assertEquals("Check fs2 id", "inv", id);
+ }
+
+ private Element getDependencyById(Element[] deps, String name) {
+ for (int i = 0; i < deps.length; i++) {
+ String na = deps[i].getAttribute("id");
+ String field = deps[i].getAttribute("field");
+ if (na != null && na.equalsIgnoreCase(name)) {
+ return deps[i];
+ }
+ if (field != null && field.equalsIgnoreCase(name)) {
+ return deps[i];
+ }
+ }
+ fail("Dependency " + name + " not found");
+ return null;
+ }
+
+ private String getBind(Element dep) {
+ Element[] elem = dep.getElements("callback");
+ for (int i = 0; elem != null && i < elem.length; i++) {
+ if (elem[i].getAttribute("type").equalsIgnoreCase("bind")) {
+ return elem[i].getAttribute("method");
+ }
+ }
+ return null;
+ }
+
+ private String getUnbind(Element dep) {
+ Element[] elem = dep.getElements("callback");
+ for (int i = 0; elem != null && i < elem.length; i++) {
+ if (elem[i].getAttribute("type").equalsIgnoreCase("unbind")) {
+ return elem[i].getAttribute("method");
+ }
+ }
+ return null;
+ }
+
+}
diff --git a/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/Factory.java b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/Factory.java
new file mode 100644
index 0000000..a6098ef
--- /dev/null
+++ b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/Factory.java
@@ -0,0 +1,32 @@
+package org.apache.felix.ipojo.test.scenarios.annotations;
+
+import org.apache.felix.ipojo.junit4osgi.OSGiTestCase;
+import org.apache.felix.ipojo.metadata.Element;
+import org.apache.felix.ipojo.test.scenarios.util.Utils;
+
+public class Factory extends OSGiTestCase {
+
+ public void testArch() {
+ Element meta = Utils.getMetatadata(context, "org.apache.felix.ipojo.test.scenarios.component.Factory");
+ String fact = meta.getAttribute("factory");
+ String name = meta.getAttribute("name");
+ assertNotNull("Factory exists ", fact);
+ assertEquals("Factory value", "true", fact);
+ assertNotNull("Name exists ", name);
+ assertEquals("Name value", "factory", name);
+ }
+
+ public void testNoArch() {
+ Element meta = Utils.getMetatadata(context, "org.apache.felix.ipojo.test.scenarios.component.NoFactory");
+ String fact = meta.getAttribute("factory");
+ String name = meta.getAttribute("name");
+ assertNotNull("Factory exists ", fact);
+ assertEquals("Factory value", "false", fact);
+ assertNotNull("Name exists ", name);
+ assertEquals("Name value", "nofactory", name);
+ }
+
+
+
+}
+
diff --git a/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/FilteredDependency.java b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/FilteredDependency.java
new file mode 100644
index 0000000..b557d0a
--- /dev/null
+++ b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/FilteredDependency.java
@@ -0,0 +1,89 @@
+package org.apache.felix.ipojo.test.scenarios.annotations;
+
+import org.apache.felix.ipojo.junit4osgi.OSGiTestCase;
+import org.apache.felix.ipojo.metadata.Element;
+import org.apache.felix.ipojo.test.scenarios.util.Utils;
+
+public class FilteredDependency extends OSGiTestCase {
+
+ private Element[] deps ;
+
+ public void setUp() {
+ Element meta = Utils.getMetatadata(context, "org.apache.felix.ipojo.test.scenarios.component.FilteredDependency");
+ deps = meta.getElements("requires");
+ }
+
+ public void testField() {
+ Element dep = getDependencyById(deps, "fs");
+ String opt = dep.getAttribute("filter");
+ assertEquals("Check filter", "(foo=bar)", opt);
+ }
+
+ public void testCallbackBind() {
+ Element dep = getDependencyById(deps, "Bar");
+ String opt = dep.getAttribute("filter");
+ assertEquals("Check filter", "(foo=bar)", opt);
+ }
+
+ public void testCallbackUnbind() {
+ Element dep = getDependencyById(deps, "Baz");
+ String opt = dep.getAttribute("filter");
+ assertEquals("Check filter", "(foo=bar)", opt);
+ }
+
+ public void testBoth() {
+ Element dep = getDependencyById(deps, "inv");
+ String opt = dep.getAttribute("filter");
+ assertEquals("Check filter", "(foo=bar)", opt);
+ }
+
+ public void testBindOnly() {
+ Element dep = getDependencyById(deps, "bindonly");
+ String opt = dep.getAttribute("filter");
+ assertEquals("Check filter", "(foo=bar)", opt);
+ }
+
+ public void testUnbindOnly() {
+ Element dep = getDependencyById(deps, "unbindonly");
+ String opt = dep.getAttribute("filter");
+ assertEquals("Check filter", "(foo=bar)", opt);
+ }
+
+
+
+ private Element getDependencyById(Element[] deps, String name) {
+ for (int i = 0; i < deps.length; i++) {
+ String na = deps[i].getAttribute("id");
+ String field = deps[i].getAttribute("field");
+ if (na != null && na.equalsIgnoreCase(name)) {
+ return deps[i];
+ }
+ if (field != null && field.equalsIgnoreCase(name)) {
+ return deps[i];
+ }
+ }
+ fail("Dependency " + name + " not found");
+ return null;
+ }
+
+ private String getBind(Element dep) {
+ Element[] elem = dep.getElements("callback");
+ for (int i = 0; elem != null && i < elem.length; i++) {
+ if (elem[i].getAttribute("type").equalsIgnoreCase("bind")) {
+ return elem[i].getAttribute("method");
+ }
+ }
+ return null;
+ }
+
+ private String getUnbind(Element dep) {
+ Element[] elem = dep.getElements("callback");
+ for (int i = 0; elem != null && i < elem.length; i++) {
+ if (elem[i].getAttribute("type").equalsIgnoreCase("unbind")) {
+ return elem[i].getAttribute("method");
+ }
+ }
+ return null;
+ }
+
+}
diff --git a/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/LifecycleCallbacks.java b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/LifecycleCallbacks.java
new file mode 100644
index 0000000..d1e8ea6
--- /dev/null
+++ b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/LifecycleCallbacks.java
@@ -0,0 +1,49 @@
+package org.apache.felix.ipojo.test.scenarios.annotations;
+
+import org.apache.felix.ipojo.junit4osgi.OSGiTestCase;
+import org.apache.felix.ipojo.metadata.Element;
+import org.apache.felix.ipojo.test.scenarios.util.Utils;
+
+public class LifecycleCallbacks extends OSGiTestCase {
+
+ public void testCallbacks() {
+ Element meta = Utils.getMetatadata(context, "org.apache.felix.ipojo.test.scenarios.component.Lifecycle");
+ Element[] cbs = meta.getElements("callback");
+ assertNotNull("Callbacks exists ", cbs);
+ assertEquals("Callbacks count ", 2, cbs.length);
+
+ Element elem = getCallbackByMethodName(cbs, "start");
+ assertEquals("Check start method", "start", elem.getAttribute("method"));
+ assertEquals("Check start transition", "validate", elem.getAttribute("transition"));
+
+ elem = getCallbackByMethodName(cbs, "stop");
+ assertEquals("Check stop method", "stop", elem.getAttribute("method"));
+ assertEquals("Check stop transition", "invalidate", elem.getAttribute("transition"));
+ }
+
+ public void testImmediate() {
+ Element meta = Utils.getMetatadata(context, "org.apache.felix.ipojo.test.scenarios.component.Immediate");
+ assertNotNull("Immediate attribute", meta.getAttribute("immediate"));
+ assertEquals("Immediate attribute value", "true", meta.getAttribute("immediate"));
+ }
+
+ public void testNoImmediate() {
+ Element meta = Utils.getMetatadata(context, "org.apache.felix.ipojo.test.scenarios.component.NoImmediate");
+ assertNotNull("Immediate attribute", meta.getAttribute("immediate"));
+ assertEquals("Immediate attribute value", "false", meta.getAttribute("immediate"));
+ }
+
+ private Element getCallbackByMethodName(Element[] cbs, String method) {
+ for (int i = 0; i < cbs.length; i++) {
+ String met = cbs[i].getAttribute("method");
+ if (met != null && met.equalsIgnoreCase(method)) {
+ return cbs[i];
+ }
+ }
+ fail("Cannot found the callback with the method " + method);
+ return null;
+ }
+
+
+
+}
diff --git a/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/LifecycleController.java b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/LifecycleController.java
new file mode 100644
index 0000000..06ac132
--- /dev/null
+++ b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/LifecycleController.java
@@ -0,0 +1,21 @@
+package org.apache.felix.ipojo.test.scenarios.annotations;
+
+import org.apache.felix.ipojo.junit4osgi.OSGiTestCase;
+import org.apache.felix.ipojo.metadata.Element;
+import org.apache.felix.ipojo.test.scenarios.util.Utils;
+
+public class LifecycleController extends OSGiTestCase {
+
+ public void testLFC() {
+ Element meta = Utils.getMetatadata(context, "org.apache.felix.ipojo.test.scenarios.component.Lifecycle");
+ Element[] ctrls = meta.getElements("controller");
+ assertNotNull("Controller exists ", ctrls);
+ Element ctrl = ctrls[0];
+ assertNotNull("Field", ctrl.getAttribute("field"));
+ assertEquals("Field", "lfc", ctrl.getAttribute("field"));
+ }
+
+
+
+}
+
diff --git a/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/OptionalDependency.java b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/OptionalDependency.java
new file mode 100644
index 0000000..0466402
--- /dev/null
+++ b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/OptionalDependency.java
@@ -0,0 +1,123 @@
+package org.apache.felix.ipojo.test.scenarios.annotations;
+
+import org.apache.felix.ipojo.junit4osgi.OSGiTestCase;
+import org.apache.felix.ipojo.metadata.Element;
+import org.apache.felix.ipojo.test.scenarios.component.ProvidesSimple;
+import org.apache.felix.ipojo.test.scenarios.util.Utils;
+
+public class OptionalDependency extends OSGiTestCase {
+
+ private Element[] deps ;
+
+ public void setUp() {
+ Element meta = Utils.getMetatadata(context, "org.apache.felix.ipojo.test.scenarios.component.OptionalDependency");
+ deps = meta.getElements("requires");
+ }
+
+ public void testField() {
+ Element dep = getDependencyById(deps, "fs");
+ String opt = dep.getAttribute("optional");
+ assertEquals("Check optionality", "true", opt);
+ }
+
+ public void testFieldNoOptional() {
+ Element dep = getDependencyById(deps, "fs2");
+ String opt = dep.getAttribute("optional");
+ assertEquals("Check optionality", "false", opt);
+ }
+
+ public void testCallbackBind() {
+ Element dep = getDependencyById(deps, "Bar");
+ String opt = dep.getAttribute("optional");
+ assertEquals("Check optionality", "true", opt);
+ }
+
+ public void testCallbackUnbind() {
+ Element dep = getDependencyById(deps, "Baz");
+ String opt = dep.getAttribute("optional");
+ assertEquals("Check optionality", "true", opt);
+ }
+
+ public void testBoth() {
+ Element dep = getDependencyById(deps, "inv");
+ String opt = dep.getAttribute("optional");
+ assertEquals("Check optionality", "true", opt);
+ }
+
+ public void testBindOnly() {
+ Element dep = getDependencyById(deps, "bindonly");
+ String opt = dep.getAttribute("optional");
+ assertEquals("Check optionality", "true", opt);
+ }
+
+ public void testUnbindOnly() {
+ Element dep = getDependencyById(deps, "unbindonly");
+ String opt = dep.getAttribute("optional");
+ assertEquals("Check optionality", "true", opt);
+ }
+
+ public void testNullable() {
+ Element meta = Utils.getMetatadata(context, "org.apache.felix.ipojo.test.scenarios.component.NullableDependency");
+ Element[] deps = meta.getElements("requires");
+ Element fs = getDependencyById(deps, "fs");
+ String nullable = fs.getAttribute("nullable");
+ assertNotNull("Check nullable", nullable);
+ assertEquals("Check nullable value", "true", nullable);
+ }
+
+ public void testNoNullable() {
+ Element meta = Utils.getMetatadata(context, "org.apache.felix.ipojo.test.scenarios.component.NullableDependency");
+ Element[] deps = meta.getElements("requires");
+ Element fs = getDependencyById(deps, "fs2");
+ String nullable = fs.getAttribute("nullable");
+ assertNotNull("Check nullable", nullable);
+ assertEquals("Check nullable value", "false", nullable);
+ }
+
+ public void testDefaultImplmentation() {
+ Element meta = Utils.getMetatadata(context, "org.apache.felix.ipojo.test.scenarios.component.DefaultImplementationDependency");
+ Element[] deps = meta.getElements("requires");
+ Element fs = getDependencyById(deps, "fs");
+ String di = fs.getAttribute("default-implementation");
+ assertNotNull("Check DI", di);
+ assertEquals("Check DI value", ProvidesSimple.class.getName(), di);
+ }
+
+
+
+ private Element getDependencyById(Element[] deps, String name) {
+ for (int i = 0; i < deps.length; i++) {
+ String na = deps[i].getAttribute("id");
+ String field = deps[i].getAttribute("field");
+ if (na != null && na.equalsIgnoreCase(name)) {
+ return deps[i];
+ }
+ if (field != null && field.equalsIgnoreCase(name)) {
+ return deps[i];
+ }
+ }
+ fail("Dependency " + name + " not found");
+ return null;
+ }
+
+ private String getBind(Element dep) {
+ Element[] elem = dep.getElements("callback");
+ for (int i = 0; elem != null && i < elem.length; i++) {
+ if (elem[i].getAttribute("type").equalsIgnoreCase("bind")) {
+ return elem[i].getAttribute("method");
+ }
+ }
+ return null;
+ }
+
+ private String getUnbind(Element dep) {
+ Element[] elem = dep.getElements("callback");
+ for (int i = 0; elem != null && i < elem.length; i++) {
+ if (elem[i].getAttribute("type").equalsIgnoreCase("unbind")) {
+ return elem[i].getAttribute("method");
+ }
+ }
+ return null;
+ }
+
+}
diff --git a/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/PolicyDependency.java b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/PolicyDependency.java
new file mode 100644
index 0000000..3dd0b13
--- /dev/null
+++ b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/PolicyDependency.java
@@ -0,0 +1,95 @@
+package org.apache.felix.ipojo.test.scenarios.annotations;
+
+import org.apache.felix.ipojo.junit4osgi.OSGiTestCase;
+import org.apache.felix.ipojo.metadata.Element;
+import org.apache.felix.ipojo.test.scenarios.util.Utils;
+
+public class PolicyDependency extends OSGiTestCase {
+
+ private Element[] deps ;
+
+ public void setUp() {
+ Element meta = Utils.getMetatadata(context, "org.apache.felix.ipojo.test.scenarios.component.PolicyDependency");
+ deps = meta.getElements("requires");
+ }
+
+ public void testField() {
+ Element dep = getDependencyById(deps, "fs");
+ String opt = dep.getAttribute("policy");
+ assertEquals("Check policy", "static", opt);
+ }
+
+ public void testFieldDPpolicy() {
+ Element dep = getDependencyById(deps, "fs2");
+ String opt = dep.getAttribute("policy");
+ assertEquals("Check policy", "dynamic-priority", opt);
+ }
+
+ public void testCallbackBind() {
+ Element dep = getDependencyById(deps, "Bar");
+ String opt = dep.getAttribute("policy");
+ assertEquals("Check policy", "static", opt);
+ }
+
+ public void testCallbackUnbind() {
+ Element dep = getDependencyById(deps, "Baz");
+ String opt = dep.getAttribute("policy");
+ assertEquals("Check policy", "static", opt);
+ }
+
+ public void testBoth() {
+ Element dep = getDependencyById(deps, "inv");
+ String opt = dep.getAttribute("policy");
+ assertEquals("Check policy", "static", opt);
+ }
+
+ public void testBindOnly() {
+ Element dep = getDependencyById(deps, "bindonly");
+ String opt = dep.getAttribute("policy");
+ assertEquals("Check policy", "static", opt);
+ }
+
+ public void testUnbindOnly() {
+ Element dep = getDependencyById(deps, "unbindonly");
+ String opt = dep.getAttribute("policy");
+ assertEquals("Check policy", "static", opt);
+ }
+
+
+
+ private Element getDependencyById(Element[] deps, String name) {
+ for (int i = 0; i < deps.length; i++) {
+ String na = deps[i].getAttribute("id");
+ String field = deps[i].getAttribute("field");
+ if (na != null && na.equalsIgnoreCase(name)) {
+ return deps[i];
+ }
+ if (field != null && field.equalsIgnoreCase(name)) {
+ return deps[i];
+ }
+ }
+ fail("Dependency " + name + " not found");
+ return null;
+ }
+
+ private String getBind(Element dep) {
+ Element[] elem = dep.getElements("callback");
+ for (int i = 0; elem != null && i < elem.length; i++) {
+ if (elem[i].getAttribute("type").equalsIgnoreCase("bind")) {
+ return elem[i].getAttribute("method");
+ }
+ }
+ return null;
+ }
+
+ private String getUnbind(Element dep) {
+ Element[] elem = dep.getElements("callback");
+ for (int i = 0; elem != null && i < elem.length; i++) {
+ if (elem[i].getAttribute("type").equalsIgnoreCase("unbind")) {
+ return elem[i].getAttribute("method");
+ }
+ }
+ return null;
+ }
+
+}
diff --git a/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/Properties.java b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/Properties.java
new file mode 100644
index 0000000..285334e
--- /dev/null
+++ b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/Properties.java
@@ -0,0 +1,131 @@
+package org.apache.felix.ipojo.test.scenarios.annotations;
+
+import org.apache.felix.ipojo.junit4osgi.OSGiTestCase;
+import org.apache.felix.ipojo.metadata.Element;
+import org.apache.felix.ipojo.test.scenarios.util.Utils;
+
+public class Properties extends OSGiTestCase {
+
+ public void testProperties() {
+ Element meta = Utils.getMetatadata(context, "org.apache.felix.ipojo.test.scenarios.component.Properties");
+ Element[] provs = meta.getElements("properties");
+ assertNotNull("Properties exists ", provs);
+ Element prov = provs[0];
+ Element[] props = prov.getElements("property");
+ assertEquals("Number of properties", props.length, 5);
+ //Foo
+ Element foo = getPropertyByName(props, "foo");
+ assertEquals("Check foo field", "m_foo", foo.getAttribute("field"));
+ assertEquals("Check foo name", "foo", foo.getAttribute("name"));
+ //Bar
+ Element bar = getPropertyByName(props, "bar");
+ assertEquals("Check bar field", "bar", bar.getAttribute("field"));
+ assertEquals("Check bar value", "4", bar.getAttribute("value"));
+ //Boo
+ Element boo = getPropertyByName(props, "boo");
+ assertEquals("Check boo field", "boo", boo.getAttribute("field"));
+ assertEquals("Check boo method", "setboo", boo.getAttribute("method"));
+ //Baa
+ Element baa = getPropertyByName(props, "baa");
+ assertEquals("Check baa field", "m_baa", baa.getAttribute("field"));
+ assertEquals("Check baa name", "baa", baa.getAttribute("name"));
+ assertEquals("Check baa method", "setbaa", baa.getAttribute("method"));
+
+ //Bar
+ Element baz = getPropertyByName(props, "baz");
+ assertEquals("Check baz method", "setbaz", baz.getAttribute("method"));
+ assertEquals("Check baz name", "baz", baz.getAttribute("name"));
+ }
+
+ public void testAbsentPropagation() {
+ Element meta = Utils.getMetatadata(context, "org.apache.felix.ipojo.test.scenarios.component.Properties");
+ Element[] provs = meta.getElements("properties");
+ assertNotNull("Properties exists ", provs);
+ Element prov = provs[0];
+ String att = prov.getAttribute("propagation");
+ assertNull("Propagation", att);
+ }
+
+ public void testPropagation() {
+ Element meta = Utils.getMetatadata(context, "org.apache.felix.ipojo.test.scenarios.component.Propagation");
+ Element[] provs = meta.getElements("properties");
+ assertNotNull("Properties exists ", provs);
+ Element prov = provs[0];
+ String att = prov.getAttribute("propagation");
+ assertNotNull("Propagation", att);
+ assertEquals("Propagation value", "true", att);
+ }
+
+ public void testNoPropagation() {
+ Element meta = Utils.getMetatadata(context, "org.apache.felix.ipojo.test.scenarios.component.NoPropagation");
+ Element[] provs = meta.getElements("properties");
+ assertNotNull("Properties exists ", provs);
+ Element prov = provs[0];
+ String att = prov.getAttribute("propagation");
+ assertNotNull("Propagation", att);
+ assertEquals("Propagation value", "false", att);
+ }
+
+ public void testPID() {
+ Element meta = Utils.getMetatadata(context, "org.apache.felix.ipojo.test.scenarios.component.ManagedServicePID");
+ Element[] provs = meta.getElements("properties");
+ assertNotNull("Properties exists ", provs);
+ Element prov = provs[0];
+ String att = prov.getAttribute("pid");
+ assertNotNull("PID", att);
+ assertEquals("PID Value", "MyPID", att);
+ }
+
+ public void testAbsentPID() {
+ Element meta = Utils.getMetatadata(context, "org.apache.felix.ipojo.test.scenarios.component.Properties");
+ Element[] provs = meta.getElements("properties");
+ assertNotNull("Properties exists ", provs);
+ Element prov = provs[0];
+ String att = prov.getAttribute("pid");
+ assertNull("PID", att);
+ }
+
+ public void testPropagationAndPID() {
+ Element meta = Utils.getMetatadata(context, "org.apache.felix.ipojo.test.scenarios.component.PropagationandPID");
+ Element[] provs = meta.getElements("properties");
+ assertNotNull("Properties exists ", provs);
+ Element prov = provs[0];
+ String att = prov.getAttribute("pid");
+ assertNotNull("PID", att);
+ assertEquals("PID Value", "MyPID", att);
+ att = prov.getAttribute("propagation");
+ assertNotNull("Propagation", att);
+ assertEquals("Propagation value", "true", att);
+ }
+
+ public void testPIDAndPropagation() {
+ Element meta = Utils.getMetatadata(context, "org.apache.felix.ipojo.test.scenarios.component.PIDandPropagation");
+ Element[] provs = meta.getElements("properties");
+ assertNotNull("Properties exists ", provs);
+ Element prov = provs[0];
+ String att = prov.getAttribute("pid");
+ assertNotNull("PID", att);
+ assertEquals("PID Value", "MyPID", att);
+ att = prov.getAttribute("propagation");
+ assertNotNull("Propagation", att);
+ assertEquals("Propagation value", "true", att);
+ }
+
+ private Element getPropertyByName(Element[] props, String name) {
+ for (int i = 0; i < props.length; i++) {
+ String na = props[i].getAttribute("name");
+ String field = props[i].getAttribute("field");
+ if (na != null && na.equalsIgnoreCase(name)) {
+ return props[i];
+ }
+ if (field != null && field.equalsIgnoreCase(name)) {
+ return props[i];
+ }
+ }
+ fail("Property " + name + " not found");
+ return null;
+ }
+
+
+
+}
diff --git a/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/RankedDependency.java b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/RankedDependency.java
new file mode 100644
index 0000000..228bce7
--- /dev/null
+++ b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/RankedDependency.java
@@ -0,0 +1,90 @@
+package org.apache.felix.ipojo.test.scenarios.annotations;
+
+import org.apache.felix.ipojo.junit4osgi.OSGiTestCase;
+import org.apache.felix.ipojo.metadata.Element;
+import org.apache.felix.ipojo.test.scenarios.component.MyComparator;
+import org.apache.felix.ipojo.test.scenarios.util.Utils;
+
+public class RankedDependency extends OSGiTestCase {
+
+ private Element[] deps ;
+
+ public void setUp() {
+ Element meta = Utils.getMetatadata(context, "org.apache.felix.ipojo.test.scenarios.component.RankedDependency");
+ deps = meta.getElements("requires");
+ }
+
+ public void testField() {
+ Element dep = getDependencyById(deps, "fs");
+ String opt = dep.getAttribute("comparator");
+ assertEquals("Check comparator", MyComparator.class.getName(), opt);
+ }
+
+ public void testCallbackBind() {
+ Element dep = getDependencyById(deps, "Bar");
+ String opt = dep.getAttribute("comparator");
+ assertEquals("Check comparator", MyComparator.class.getName(), opt);
+ }
+
+ public void testCallbackUnbind() {
+ Element dep = getDependencyById(deps, "Baz");
+ String opt = dep.getAttribute("comparator");
+ assertEquals("Check comparator", MyComparator.class.getName(), opt);
+ }
+
+ public void testBoth() {
+ Element dep = getDependencyById(deps, "inv");
+ String opt = dep.getAttribute("comparator");
+ assertEquals("Check comparator", MyComparator.class.getName(), opt);
+ }
+
+ public void testBindOnly() {
+ Element dep = getDependencyById(deps, "bindonly");
+ String opt = dep.getAttribute("comparator");
+ assertEquals("Check comparator", MyComparator.class.getName(), opt);
+ }
+
+ public void testUnbindOnly() {
+ Element dep = getDependencyById(deps, "unbindonly");
+ String opt = dep.getAttribute("comparator");
+ assertEquals("Check comparator", MyComparator.class.getName(), opt);
+ }
+
+
+
+ private Element getDependencyById(Element[] deps, String name) {
+ for (int i = 0; i < deps.length; i++) {
+ String na = deps[i].getAttribute("id");
+ String field = deps[i].getAttribute("field");
+ if (na != null && na.equalsIgnoreCase(name)) {
+ return deps[i];
+ }
+ if (field != null && field.equalsIgnoreCase(name)) {
+ return deps[i];
+ }
+ }
+ fail("Dependency " + name + " not found");
+ return null;
+ }
+
+ private String getBind(Element dep) {
+ Element[] elem = dep.getElements("callback");
+ for (int i = 0; elem != null && i < elem.length; i++) {
+ if (elem[i].getAttribute("type").equalsIgnoreCase("bind")) {
+ return elem[i].getAttribute("method");
+ }
+ }
+ return null;
+ }
+
+ private String getUnbind(Element dep) {
+ Element[] elem = dep.getElements("callback");
+ for (int i = 0; elem != null && i < elem.length; i++) {
+ if (elem[i].getAttribute("type").equalsIgnoreCase("unbind")) {
+ return elem[i].getAttribute("method");
+ }
+ }
+ return null;
+ }
+
+}
diff --git a/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/ServiceProdiving.java b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/ServiceProdiving.java
new file mode 100644
index 0000000..74a893d
--- /dev/null
+++ b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/ServiceProdiving.java
@@ -0,0 +1,101 @@
+package org.apache.felix.ipojo.test.scenarios.annotations;
+
+import java.util.List;
+
+import org.apache.felix.ipojo.junit4osgi.OSGiTestCase;
+import org.apache.felix.ipojo.metadata.Element;
+import org.apache.felix.ipojo.parser.ParseUtils;
+import org.apache.felix.ipojo.test.scenarios.annotations.service.CheckService;
+import org.apache.felix.ipojo.test.scenarios.annotations.service.FooService;
+import org.apache.felix.ipojo.test.scenarios.util.Utils;
+
+public class ServiceProdiving extends OSGiTestCase {
+
+ public void testProvidesSimple() {
+ Element meta = Utils.getMetatadata(context, "org.apache.felix.ipojo.test.scenarios.component.ProvidesSimple");
+ Element[] provs = meta.getElements("provides");
+ assertNotNull("Provides exists ", provs);
+ Element prov = provs[0];
+ }
+
+ public void testProvidesDouble() {
+ Element meta = Utils.getMetatadata(context, "org.apache.felix.ipojo.test.scenarios.component.ProvidesDouble");
+ Element[] provs = meta.getElements("provides");
+ assertNotNull("Provides exists ", provs);
+ Element prov = provs[0];
+ }
+
+ public void testProvidesTriple() {
+ Element meta = Utils.getMetatadata(context, "org.apache.felix.ipojo.test.scenarios.component.ProvidesTriple");
+ Element[] provs = meta.getElements("provides");
+ assertNotNull("Provides exists ", provs);
+ Element prov = provs[0];
+ String itfs = prov.getAttribute("interface");
+ List list = ParseUtils.parseArraysAsList(itfs);
+ assertTrue("Provides CS ", list.contains(CheckService.class.getName()));
+ }
+
+ public void testProvidesQuatro() {
+ Element meta = Utils.getMetatadata(context, "org.apache.felix.ipojo.test.scenarios.component.ProvidesQuatro");
+ Element[] provs = meta.getElements("provides");
+ assertNotNull("Provides exists ", provs);
+ Element prov = provs[0];
+ String itfs = prov.getAttribute("interface");
+ List list = ParseUtils.parseArraysAsList(itfs);
+ assertTrue("Provides CS ", list.contains(CheckService.class.getName()));
+ assertTrue("Provides Foo ", list.contains(FooService.class.getName()));
+ }
+
+ public void testProperties() {
+ Element meta = Utils.getMetatadata(context, "org.apache.felix.ipojo.test.scenarios.component.ProvidesProperties");
+ Element[] provs = meta.getElements("provides");
+ assertNotNull("Provides exists ", provs);
+ Element prov = provs[0];
+ Element[] props = prov.getElements("property");
+ assertEquals("Number of properties", props.length, 5);
+ //Foo
+ Element foo = getPropertyByName(props, "foo");
+ assertEquals("Check foo field", "m_foo", foo.getAttribute("field"));
+ assertEquals("Check foo name", "foo", foo.getAttribute("name"));
+ //Bar
+ Element bar = getPropertyByName(props, "bar");
+ assertEquals("Check bar field", "bar", bar.getAttribute("field"));
+ assertEquals("Check bar value", "4", bar.getAttribute("value"));
+ //Boo
+ Element boo = getPropertyByName(props, "boo");
+ assertEquals("Check boo field", "boo", boo.getAttribute("field"));
+ assertEquals("Check boo method", "setboo", boo.getAttribute("method"));
+ //Baa
+ Element baa = getPropertyByName(props, "baa");
+ assertEquals("Check baa field", "m_baa", baa.getAttribute("field"));
+ assertEquals("Check baa name", "baa", baa.getAttribute("name"));
+ assertEquals("Check baa method", "setbaa", baa.getAttribute("method"));
+
+ //Bar
+ Element baz = getPropertyByName(props, "baz");
+ assertEquals("Check baz field", "m_baz", baz.getAttribute("field"));
+ assertEquals("Check baz method", "setBaz", baz.getAttribute("method"));
+ assertEquals("Check baz name", "baz", baz.getAttribute("name"));
+
+
+
+ }
+
+ private Element getPropertyByName(Element[] props, String name) {
+ for (int i = 0; i < props.length; i++) {
+ String na = props[i].getAttribute("name");
+ String field = props[i].getAttribute("field");
+ if (na != null && na.equalsIgnoreCase(name)) {
+ return props[i];
+ }
+ if (field != null && field.equalsIgnoreCase(name)) {
+ return props[i];
+ }
+ }
+ fail("Property " + name + " not found");
+ return null;
+ }
+
+
+
+}
diff --git a/ipojo/tests/tests.core.service.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/dynamic/priority/DynamicPriorityDependencyTestSuite.java b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/service/BarService.java
similarity index 63%
copy from ipojo/tests/tests.core.service.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/dynamic/priority/DynamicPriorityDependencyTestSuite.java
copy to ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/service/BarService.java
index c60fe79..ac52244 100644
--- a/ipojo/tests/tests.core.service.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/dynamic/priority/DynamicPriorityDependencyTestSuite.java
+++ b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/service/BarService.java
@@ -16,19 +16,14 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.felix.ipojo.test.scenarios.service.dependency.dynamic.priority;
+package org.apache.felix.ipojo.test.scenarios.annotations.service;
-import junit.framework.Test;
+import java.util.Properties;
-import org.apache.felix.ipojo.junit4osgi.OSGiTestSuite;
-import org.osgi.framework.BundleContext;
-
-public class DynamicPriorityDependencyTestSuite {
-
- public static Test suite(BundleContext bc) {
- OSGiTestSuite ots = new OSGiTestSuite("Dynamic-Priority Dependency Test Suite", bc);
- ots.addTestSuite( SimpleDependencies.class);
- return ots;
- }
+public interface BarService {
+
+ public boolean bar();
+
+ public Properties getProps();
}
diff --git a/ipojo/tests/tests.core.service.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/dynamic/priority/DynamicPriorityDependencyTestSuite.java b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/service/CheckService.java
similarity index 63%
copy from ipojo/tests/tests.core.service.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/dynamic/priority/DynamicPriorityDependencyTestSuite.java
copy to ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/service/CheckService.java
index c60fe79..7eb16a7 100644
--- a/ipojo/tests/tests.core.service.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/dynamic/priority/DynamicPriorityDependencyTestSuite.java
+++ b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/service/CheckService.java
@@ -16,19 +16,16 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.felix.ipojo.test.scenarios.service.dependency.dynamic.priority;
+package org.apache.felix.ipojo.test.scenarios.annotations.service;
-import junit.framework.Test;
+import java.util.Properties;
-import org.apache.felix.ipojo.junit4osgi.OSGiTestSuite;
-import org.osgi.framework.BundleContext;
-
-public class DynamicPriorityDependencyTestSuite {
-
- public static Test suite(BundleContext bc) {
- OSGiTestSuite ots = new OSGiTestSuite("Dynamic-Priority Dependency Test Suite", bc);
- ots.addTestSuite( SimpleDependencies.class);
- return ots;
- }
+public interface CheckService {
+
+ public static final String foo = "foo";
+
+ public boolean check();
+
+ public Properties getProps();
}
diff --git a/ipojo/tests/tests.core.service.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/dynamic/priority/DynamicPriorityDependencyTestSuite.java b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/service/ChildInterface.java
similarity index 63%
copy from ipojo/tests/tests.core.service.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/dynamic/priority/DynamicPriorityDependencyTestSuite.java
copy to ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/service/ChildInterface.java
index c60fe79..f35b4f9 100644
--- a/ipojo/tests/tests.core.service.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/dynamic/priority/DynamicPriorityDependencyTestSuite.java
+++ b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/service/ChildInterface.java
@@ -16,19 +16,10 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.felix.ipojo.test.scenarios.service.dependency.dynamic.priority;
+package org.apache.felix.ipojo.test.scenarios.annotations.service;
-import junit.framework.Test;
-
-import org.apache.felix.ipojo.junit4osgi.OSGiTestSuite;
-import org.osgi.framework.BundleContext;
-
-public class DynamicPriorityDependencyTestSuite {
-
- public static Test suite(BundleContext bc) {
- OSGiTestSuite ots = new OSGiTestSuite("Dynamic-Priority Dependency Test Suite", bc);
- ots.addTestSuite( SimpleDependencies.class);
- return ots;
- }
+public interface ChildInterface extends ParentInterface1, ParentInterface2 {
+
+ public void processChild();
}
diff --git a/ipojo/tests/tests.core.service.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/dynamic/priority/DynamicPriorityDependencyTestSuite.java b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/service/FooService.java
similarity index 63%
copy from ipojo/tests/tests.core.service.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/dynamic/priority/DynamicPriorityDependencyTestSuite.java
copy to ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/service/FooService.java
index c60fe79..c542725 100644
--- a/ipojo/tests/tests.core.service.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/dynamic/priority/DynamicPriorityDependencyTestSuite.java
+++ b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/service/FooService.java
@@ -16,19 +16,24 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.felix.ipojo.test.scenarios.service.dependency.dynamic.priority;
+package org.apache.felix.ipojo.test.scenarios.annotations.service;
-import junit.framework.Test;
+import java.util.Properties;
-import org.apache.felix.ipojo.junit4osgi.OSGiTestSuite;
-import org.osgi.framework.BundleContext;
+public interface FooService {
-public class DynamicPriorityDependencyTestSuite {
-
- public static Test suite(BundleContext bc) {
- OSGiTestSuite ots = new OSGiTestSuite("Dynamic-Priority Dependency Test Suite", bc);
- ots.addTestSuite( SimpleDependencies.class);
- return ots;
- }
-
+ boolean foo();
+
+ Properties fooProps();
+
+ Boolean getObject();
+
+ boolean getBoolean();
+
+ int getInt();
+
+ long getLong();
+
+ double getDouble();
+
}
diff --git a/ipojo/tests/tests.core.service.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/dynamic/priority/DynamicPriorityDependencyTestSuite.java b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/service/ParentInterface1.java
similarity index 63%
copy from ipojo/tests/tests.core.service.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/dynamic/priority/DynamicPriorityDependencyTestSuite.java
copy to ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/service/ParentInterface1.java
index c60fe79..05680f9 100644
--- a/ipojo/tests/tests.core.service.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/dynamic/priority/DynamicPriorityDependencyTestSuite.java
+++ b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/service/ParentInterface1.java
@@ -16,19 +16,10 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.felix.ipojo.test.scenarios.service.dependency.dynamic.priority;
+package org.apache.felix.ipojo.test.scenarios.annotations.service;
-import junit.framework.Test;
-
-import org.apache.felix.ipojo.junit4osgi.OSGiTestSuite;
-import org.osgi.framework.BundleContext;
-
-public class DynamicPriorityDependencyTestSuite {
-
- public static Test suite(BundleContext bc) {
- OSGiTestSuite ots = new OSGiTestSuite("Dynamic-Priority Dependency Test Suite", bc);
- ots.addTestSuite( SimpleDependencies.class);
- return ots;
- }
+public interface ParentInterface1 extends ParentParentInterface {
+
+ public void processParent1();
}
diff --git a/ipojo/tests/tests.core.service.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/dynamic/priority/DynamicPriorityDependencyTestSuite.java b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/service/ParentInterface2.java
similarity index 63%
copy from ipojo/tests/tests.core.service.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/dynamic/priority/DynamicPriorityDependencyTestSuite.java
copy to ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/service/ParentInterface2.java
index c60fe79..7553397 100644
--- a/ipojo/tests/tests.core.service.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/dynamic/priority/DynamicPriorityDependencyTestSuite.java
+++ b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/service/ParentInterface2.java
@@ -16,19 +16,10 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.felix.ipojo.test.scenarios.service.dependency.dynamic.priority;
+package org.apache.felix.ipojo.test.scenarios.annotations.service;
-import junit.framework.Test;
-
-import org.apache.felix.ipojo.junit4osgi.OSGiTestSuite;
-import org.osgi.framework.BundleContext;
-
-public class DynamicPriorityDependencyTestSuite {
-
- public static Test suite(BundleContext bc) {
- OSGiTestSuite ots = new OSGiTestSuite("Dynamic-Priority Dependency Test Suite", bc);
- ots.addTestSuite( SimpleDependencies.class);
- return ots;
- }
+public interface ParentInterface2 {
+
+ public void processParent2();
}
diff --git a/ipojo/tests/tests.core.service.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/dynamic/priority/DynamicPriorityDependencyTestSuite.java b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/service/ParentParentInterface.java
similarity index 63%
copy from ipojo/tests/tests.core.service.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/dynamic/priority/DynamicPriorityDependencyTestSuite.java
copy to ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/service/ParentParentInterface.java
index c60fe79..85eff5e 100644
--- a/ipojo/tests/tests.core.service.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/dynamic/priority/DynamicPriorityDependencyTestSuite.java
+++ b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/service/ParentParentInterface.java
@@ -16,19 +16,10 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.felix.ipojo.test.scenarios.service.dependency.dynamic.priority;
+package org.apache.felix.ipojo.test.scenarios.annotations.service;
-import junit.framework.Test;
-
-import org.apache.felix.ipojo.junit4osgi.OSGiTestSuite;
-import org.osgi.framework.BundleContext;
-
-public class DynamicPriorityDependencyTestSuite {
-
- public static Test suite(BundleContext bc) {
- OSGiTestSuite ots = new OSGiTestSuite("Dynamic-Priority Dependency Test Suite", bc);
- ots.addTestSuite( SimpleDependencies.class);
- return ots;
- }
+public interface ParentParentInterface {
+
+ public void processParentParent();
}
diff --git a/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/AggregateDependency.java b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/AggregateDependency.java
new file mode 100644
index 0000000..cfc5ddd
--- /dev/null
+++ b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/AggregateDependency.java
@@ -0,0 +1,25 @@
+package org.apache.felix.ipojo.test.scenarios.component;
+
+import org.apache.felix.ipojo.annotations.Bind;
+import org.apache.felix.ipojo.annotations.Component;
+import org.apache.felix.ipojo.annotations.Unbind;
+
+@Component
+public class AggregateDependency {
+
+ @Unbind(aggregate=true)
+ public void unbindBar() { }
+ @Bind
+ public void bindBar() { }
+
+ @Unbind
+ public void unbindBaz() { }
+ @Bind(aggregate=true)
+ public void bindBaz() { }
+
+ @Unbind(aggregate=true, id="unbindonly")
+ public void unbind() { }
+
+ @Bind(aggregate=true, id="bindonly")
+ public void bind() { }
+}
diff --git a/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/Arch.java b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/Arch.java
new file mode 100644
index 0000000..0ac0e1a
--- /dev/null
+++ b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/Arch.java
@@ -0,0 +1,7 @@
+package org.apache.felix.ipojo.test.scenarios.component;
+
+import org.apache.felix.ipojo.annotations.Component;
+
+@Component(architecture=true)
+public class Arch {
+}
diff --git a/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/DefaultImplementationDependency.java b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/DefaultImplementationDependency.java
new file mode 100644
index 0000000..b43540a
--- /dev/null
+++ b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/DefaultImplementationDependency.java
@@ -0,0 +1,12 @@
+package org.apache.felix.ipojo.test.scenarios.component;
+
+import org.apache.felix.ipojo.annotations.Component;
+import org.apache.felix.ipojo.annotations.Requires;
+import org.apache.felix.ipojo.test.scenarios.annotations.service.FooService;
+
+@Component
+public class DefaultImplementationDependency {
+
+ @Requires(defaultimplementation=ProvidesSimple.class, optional=true)
+ public FooService fs;
+}
diff --git a/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/Dependency.java b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/Dependency.java
new file mode 100644
index 0000000..97b053f
--- /dev/null
+++ b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/Dependency.java
@@ -0,0 +1,64 @@
+package org.apache.felix.ipojo.test.scenarios.component;
+
+import org.apache.felix.ipojo.annotations.Bind;
+import org.apache.felix.ipojo.annotations.Component;
+import org.apache.felix.ipojo.annotations.Requires;
+import org.apache.felix.ipojo.annotations.Unbind;
+import org.apache.felix.ipojo.test.scenarios.annotations.service.FooService;
+
+@Component
+public class Dependency {
+
+ @Requires
+ public FooService fs;
+
+ @Unbind
+ public void unbindBar() {
+
+ }
+
+ @Bind
+ public void bindBar() {
+
+ }
+
+ @Unbind
+ public void unbindBaz() {
+
+ }
+
+ @Bind
+ public void bindBaz() {
+
+ }
+
+
+ @Requires
+ public FooService fs2;
+
+ @Bind(id="fs2")
+ public void bindFS2() {
+
+ }
+
+ @Unbind(id="fs2")
+ public void unbindFS2() {
+
+ }
+
+ @Requires(id="inv")
+ public FooService fs2inv;
+
+ @Bind(id="inv")
+ public void bindFS2Inv() {
+
+ }
+
+ @Unbind(id="inv")
+ public void unbindFS2Inv() {
+
+ }
+
+
+
+}
diff --git a/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/Factory.java b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/Factory.java
new file mode 100644
index 0000000..a0b6cda
--- /dev/null
+++ b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/Factory.java
@@ -0,0 +1,7 @@
+package org.apache.felix.ipojo.test.scenarios.component;
+
+import org.apache.felix.ipojo.annotations.Component;
+
+@Component(name="factory", factory=true)
+public class Factory {
+}
diff --git a/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FilteredDependency.java b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FilteredDependency.java
new file mode 100644
index 0000000..d064ec3
--- /dev/null
+++ b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FilteredDependency.java
@@ -0,0 +1,37 @@
+package org.apache.felix.ipojo.test.scenarios.component;
+
+import org.apache.felix.ipojo.annotations.Bind;
+import org.apache.felix.ipojo.annotations.Component;
+import org.apache.felix.ipojo.annotations.Requires;
+import org.apache.felix.ipojo.annotations.Unbind;
+import org.apache.felix.ipojo.test.scenarios.annotations.service.FooService;
+
+@Component
+public class FilteredDependency {
+
+ @Requires(filter="(foo=bar)")
+ public FooService fs;
+
+ @Unbind(filter="(foo=bar)")
+ public void unbindBar() { }
+ @Bind
+ public void bindBar() { }
+
+ @Unbind
+ public void unbindBaz() { }
+ @Bind(filter="(foo=bar)")
+ public void bindBaz() { }
+
+ @Requires(id="inv")
+ public FooService fs2inv;
+ @Bind(id="inv", filter="(foo=bar)")
+ public void bindFS2Inv() { }
+ @Unbind(id="inv")
+ public void unbindFS2Inv() { }
+
+ @Unbind(filter="(foo=bar)", id="unbindonly")
+ public void unbind() { }
+
+ @Bind(filter="(foo=bar)", id="bindonly")
+ public void bind() { }
+}
diff --git a/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/Immediate.java b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/Immediate.java
new file mode 100644
index 0000000..db0f161
--- /dev/null
+++ b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/Immediate.java
@@ -0,0 +1,7 @@
+package org.apache.felix.ipojo.test.scenarios.component;
+
+import org.apache.felix.ipojo.annotations.Component;
+
+@Component(immediate=true)
+public class Immediate {
+}
diff --git a/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/Lifecycle.java b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/Lifecycle.java
new file mode 100644
index 0000000..dc28af1
--- /dev/null
+++ b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/Lifecycle.java
@@ -0,0 +1,22 @@
+package org.apache.felix.ipojo.test.scenarios.component;
+
+import org.apache.felix.ipojo.annotations.Component;
+import org.apache.felix.ipojo.annotations.Controller;
+import org.apache.felix.ipojo.annotations.Invalidate;
+import org.apache.felix.ipojo.annotations.Validate;
+
+@Component
+public class Lifecycle {
+ @Controller
+ boolean lfc;
+
+ @Validate
+ public void start() {
+
+ }
+
+ @Invalidate
+ public void stop() {
+
+ }
+}
diff --git a/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/ManagedServicePID.java b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/ManagedServicePID.java
new file mode 100644
index 0000000..66bf0c1
--- /dev/null
+++ b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/ManagedServicePID.java
@@ -0,0 +1,74 @@
+package org.apache.felix.ipojo.test.scenarios.component;
+
+import org.apache.felix.ipojo.annotations.Component;
+import org.apache.felix.ipojo.annotations.Property;
+import org.apache.felix.ipojo.test.scenarios.annotations.service.BarService;
+import org.apache.felix.ipojo.test.scenarios.annotations.service.FooService;
+
+@Component(managedservice="MyPID")
+public class ManagedServicePID implements FooService, BarService {
+
+ @Property(name="foo")
+ public int m_foo = 0;
+
+ @Property(value = "4")
+ public int bar;
+
+ @Property
+ public void setboo(int boo) {
+
+ }
+
+ @Property
+ public void setbaz(int baz) {
+
+ }
+
+ @Property
+ public int boo;
+
+ @Property(name="baa")
+ public int m_baa;
+
+ @Property(value="5")
+ public void setbaa(int baa) {
+
+ }
+
+ public boolean foo() {
+ return false;
+ }
+
+ public java.util.Properties fooProps() {
+ return null;
+ }
+
+ public boolean getBoolean() {
+ return false;
+ }
+
+ public double getDouble() {
+ return 0;
+ }
+
+ public int getInt() {
+ return 0;
+ }
+
+ public long getLong() {
+ return 0;
+ }
+
+ public Boolean getObject() {
+ return null;
+ }
+
+ public boolean bar() {
+ return false;
+ }
+
+ public java.util.Properties getProps() {
+ return null;
+ }
+
+}
diff --git a/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/MyComparator.java b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/MyComparator.java
new file mode 100644
index 0000000..085390f
--- /dev/null
+++ b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/MyComparator.java
@@ -0,0 +1,11 @@
+package org.apache.felix.ipojo.test.scenarios.component;
+
+import java.util.Comparator;
+
+public class MyComparator implements Comparator {
+
+ public int compare(Object o1, Object o2) {
+ return 0;
+ }
+
+}
diff --git a/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/NoArch.java b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/NoArch.java
new file mode 100644
index 0000000..4b5f1a3
--- /dev/null
+++ b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/NoArch.java
@@ -0,0 +1,7 @@
+package org.apache.felix.ipojo.test.scenarios.component;
+
+import org.apache.felix.ipojo.annotations.Component;
+
+@Component(architecture=false)
+public class NoArch {
+}
diff --git a/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/NoFactory.java b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/NoFactory.java
new file mode 100644
index 0000000..9226a19
--- /dev/null
+++ b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/NoFactory.java
@@ -0,0 +1,7 @@
+package org.apache.felix.ipojo.test.scenarios.component;
+
+import org.apache.felix.ipojo.annotations.Component;
+
+@Component(name="nofactory", factory=false)
+public class NoFactory {
+}
diff --git a/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/NoImmediate.java b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/NoImmediate.java
new file mode 100644
index 0000000..54d1021
--- /dev/null
+++ b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/NoImmediate.java
@@ -0,0 +1,7 @@
+package org.apache.felix.ipojo.test.scenarios.component;
+
+import org.apache.felix.ipojo.annotations.Component;
+
+@Component(immediate=false)
+public class NoImmediate {
+}
diff --git a/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/NoPropagation.java b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/NoPropagation.java
new file mode 100644
index 0000000..f1003a0
--- /dev/null
+++ b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/NoPropagation.java
@@ -0,0 +1,74 @@
+package org.apache.felix.ipojo.test.scenarios.component;
+
+import org.apache.felix.ipojo.annotations.Component;
+import org.apache.felix.ipojo.annotations.Property;
+import org.apache.felix.ipojo.test.scenarios.annotations.service.BarService;
+import org.apache.felix.ipojo.test.scenarios.annotations.service.FooService;
+
+@Component(propagation=false)
+public class NoPropagation implements FooService, BarService {
+
+ @Property(name="foo")
+ public int m_foo = 0;
+
+ @Property(value = "4")
+ public int bar;
+
+ @Property
+ public void setboo(int boo) {
+
+ }
+
+ @Property
+ public void setbaz(int baz) {
+
+ }
+
+ @Property
+ public int boo;
+
+ @Property(name="baa")
+ public int m_baa;
+
+ @Property(value="5")
+ public void setbaa(int baa) {
+
+ }
+
+ public boolean foo() {
+ return false;
+ }
+
+ public java.util.Properties fooProps() {
+ return null;
+ }
+
+ public boolean getBoolean() {
+ return false;
+ }
+
+ public double getDouble() {
+ return 0;
+ }
+
+ public int getInt() {
+ return 0;
+ }
+
+ public long getLong() {
+ return 0;
+ }
+
+ public Boolean getObject() {
+ return null;
+ }
+
+ public boolean bar() {
+ return false;
+ }
+
+ public java.util.Properties getProps() {
+ return null;
+ }
+
+}
diff --git a/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/NullableDependency.java b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/NullableDependency.java
new file mode 100644
index 0000000..7a5b5de
--- /dev/null
+++ b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/NullableDependency.java
@@ -0,0 +1,17 @@
+package org.apache.felix.ipojo.test.scenarios.component;
+
+import org.apache.felix.ipojo.annotations.Component;
+import org.apache.felix.ipojo.annotations.Requires;
+import org.apache.felix.ipojo.test.scenarios.annotations.service.FooService;
+
+@Component
+public class NullableDependency {
+
+ @Requires(nullable=true)
+ public FooService fs;
+
+ @Requires(nullable=false)
+ public FooService fs2;
+
+
+}
diff --git a/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/OptionalDependency.java b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/OptionalDependency.java
new file mode 100644
index 0000000..3ce2b08
--- /dev/null
+++ b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/OptionalDependency.java
@@ -0,0 +1,40 @@
+package org.apache.felix.ipojo.test.scenarios.component;
+
+import org.apache.felix.ipojo.annotations.Bind;
+import org.apache.felix.ipojo.annotations.Component;
+import org.apache.felix.ipojo.annotations.Requires;
+import org.apache.felix.ipojo.annotations.Unbind;
+import org.apache.felix.ipojo.test.scenarios.annotations.service.FooService;
+
+@Component
+public class OptionalDependency {
+
+ @Requires(optional=true)
+ public FooService fs;
+
+ @Requires(optional=false)
+ public FooService fs2;
+
+ @Unbind(optional=true)
+ public void unbindBar() { }
+ @Bind
+ public void bindBar() { }
+
+ @Unbind
+ public void unbindBaz() { }
+ @Bind(optional=true)
+ public void bindBaz() { }
+
+ @Requires(id="inv")
+ public FooService fs2inv;
+ @Bind(id="inv", optional=true)
+ public void bindFS2Inv() { }
+ @Unbind(id="inv")
+ public void unbindFS2Inv() { }
+
+ @Unbind(optional=true, id="unbindonly")
+ public void unbind() { }
+
+ @Bind(optional=true, id="bindonly")
+ public void bind() { }
+}
diff --git a/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/PIDandPropagation.java b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/PIDandPropagation.java
new file mode 100644
index 0000000..168439f
--- /dev/null
+++ b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/PIDandPropagation.java
@@ -0,0 +1,74 @@
+package org.apache.felix.ipojo.test.scenarios.component;
+
+import org.apache.felix.ipojo.annotations.Component;
+import org.apache.felix.ipojo.annotations.Property;
+import org.apache.felix.ipojo.test.scenarios.annotations.service.BarService;
+import org.apache.felix.ipojo.test.scenarios.annotations.service.FooService;
+
+@Component(managedservice="MyPID", propagation=true)
+public class PIDandPropagation implements FooService, BarService {
+
+ @Property(name="foo")
+ public int m_foo = 0;
+
+ @Property(value = "4")
+ public int bar;
+
+ @Property
+ public void setboo(int boo) {
+
+ }
+
+ @Property
+ public void setbaz(int baz) {
+
+ }
+
+ @Property
+ public int boo;
+
+ @Property(name="baa")
+ public int m_baa;
+
+ @Property(value="5")
+ public void setbaa(int baa) {
+
+ }
+
+ public boolean foo() {
+ return false;
+ }
+
+ public java.util.Properties fooProps() {
+ return null;
+ }
+
+ public boolean getBoolean() {
+ return false;
+ }
+
+ public double getDouble() {
+ return 0;
+ }
+
+ public int getInt() {
+ return 0;
+ }
+
+ public long getLong() {
+ return 0;
+ }
+
+ public Boolean getObject() {
+ return null;
+ }
+
+ public boolean bar() {
+ return false;
+ }
+
+ public java.util.Properties getProps() {
+ return null;
+ }
+
+}
diff --git a/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/PolicyDependency.java b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/PolicyDependency.java
new file mode 100644
index 0000000..d4c1213
--- /dev/null
+++ b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/PolicyDependency.java
@@ -0,0 +1,40 @@
+package org.apache.felix.ipojo.test.scenarios.component;
+
+import org.apache.felix.ipojo.annotations.Bind;
+import org.apache.felix.ipojo.annotations.Component;
+import org.apache.felix.ipojo.annotations.Requires;
+import org.apache.felix.ipojo.annotations.Unbind;
+import org.apache.felix.ipojo.test.scenarios.annotations.service.FooService;
+
+@Component
+public class PolicyDependency {
+
+ @Requires(policy="static")
+ public FooService fs;
+
+ @Requires(policy="dynamic-priority")
+ public FooService fs2;
+
+ @Unbind(policy="static")
+ public void unbindBar() { }
+ @Bind
+ public void bindBar() { }
+
+ @Unbind
+ public void unbindBaz() { }
+ @Bind(policy="static")
+ public void bindBaz() { }
+
+ @Requires(id="inv")
+ public FooService fs2inv;
+ @Bind(id="inv", policy="static")
+ public void bindFS2Inv() { }
+ @Unbind(id="inv")
+ public void unbindFS2Inv() { }
+
+ @Unbind(policy="static", id="unbindonly")
+ public void unbind() { }
+
+ @Bind(policy="static", id="bindonly")
+ public void bind() { }
+}
diff --git a/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/Propagation.java b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/Propagation.java
new file mode 100644
index 0000000..51caaf6
--- /dev/null
+++ b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/Propagation.java
@@ -0,0 +1,74 @@
+package org.apache.felix.ipojo.test.scenarios.component;
+
+import org.apache.felix.ipojo.annotations.Component;
+import org.apache.felix.ipojo.annotations.Property;
+import org.apache.felix.ipojo.test.scenarios.annotations.service.BarService;
+import org.apache.felix.ipojo.test.scenarios.annotations.service.FooService;
+
+@Component(propagation=true)
+public class Propagation implements FooService, BarService {
+
+ @Property(name="foo")
+ public int m_foo = 0;
+
+ @Property(value = "4")
+ public int bar;
+
+ @Property
+ public void setboo(int boo) {
+
+ }
+
+ @Property
+ public void setbaz(int baz) {
+
+ }
+
+ @Property
+ public int boo;
+
+ @Property(name="baa")
+ public int m_baa;
+
+ @Property(value="5")
+ public void setbaa(int baa) {
+
+ }
+
+ public boolean foo() {
+ return false;
+ }
+
+ public java.util.Properties fooProps() {
+ return null;
+ }
+
+ public boolean getBoolean() {
+ return false;
+ }
+
+ public double getDouble() {
+ return 0;
+ }
+
+ public int getInt() {
+ return 0;
+ }
+
+ public long getLong() {
+ return 0;
+ }
+
+ public Boolean getObject() {
+ return null;
+ }
+
+ public boolean bar() {
+ return false;
+ }
+
+ public java.util.Properties getProps() {
+ return null;
+ }
+
+}
diff --git a/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/PropagationandPID.java b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/PropagationandPID.java
new file mode 100644
index 0000000..7c6287f
--- /dev/null
+++ b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/PropagationandPID.java
@@ -0,0 +1,74 @@
+package org.apache.felix.ipojo.test.scenarios.component;
+
+import org.apache.felix.ipojo.annotations.Component;
+import org.apache.felix.ipojo.annotations.Property;
+import org.apache.felix.ipojo.test.scenarios.annotations.service.BarService;
+import org.apache.felix.ipojo.test.scenarios.annotations.service.FooService;
+
+@Component(managedservice="MyPID", propagation=true)
+public class PropagationandPID implements FooService, BarService {
+
+ @Property(name="foo")
+ public int m_foo = 0;
+
+ @Property(value = "4")
+ public int bar;
+
+ @Property
+ public void setboo(int boo) {
+
+ }
+
+ @Property
+ public void setbaz(int baz) {
+
+ }
+
+ @Property
+ public int boo;
+
+ @Property(name="baa")
+ public int m_baa;
+
+ @Property(value="5")
+ public void setbaa(int baa) {
+
+ }
+
+ public boolean foo() {
+ return false;
+ }
+
+ public java.util.Properties fooProps() {
+ return null;
+ }
+
+ public boolean getBoolean() {
+ return false;
+ }
+
+ public double getDouble() {
+ return 0;
+ }
+
+ public int getInt() {
+ return 0;
+ }
+
+ public long getLong() {
+ return 0;
+ }
+
+ public Boolean getObject() {
+ return null;
+ }
+
+ public boolean bar() {
+ return false;
+ }
+
+ public java.util.Properties getProps() {
+ return null;
+ }
+
+}
diff --git a/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/Properties.java b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/Properties.java
new file mode 100644
index 0000000..f4455a4
--- /dev/null
+++ b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/Properties.java
@@ -0,0 +1,74 @@
+package org.apache.felix.ipojo.test.scenarios.component;
+
+import org.apache.felix.ipojo.annotations.Component;
+import org.apache.felix.ipojo.annotations.Property;
+import org.apache.felix.ipojo.test.scenarios.annotations.service.BarService;
+import org.apache.felix.ipojo.test.scenarios.annotations.service.FooService;
+
+@Component
+public class Properties implements FooService, BarService {
+
+ @Property(name="foo")
+ public int m_foo = 0;
+
+ @Property(value = "4")
+ public int bar;
+
+ @Property
+ public void setboo(int boo) {
+
+ }
+
+ @Property
+ public void setbaz(int baz) {
+
+ }
+
+ @Property
+ public int boo;
+
+ @Property(name="baa")
+ public int m_baa;
+
+ @Property(value="5")
+ public void setbaa(int baa) {
+
+ }
+
+ public boolean foo() {
+ return false;
+ }
+
+ public java.util.Properties fooProps() {
+ return null;
+ }
+
+ public boolean getBoolean() {
+ return false;
+ }
+
+ public double getDouble() {
+ return 0;
+ }
+
+ public int getInt() {
+ return 0;
+ }
+
+ public long getLong() {
+ return 0;
+ }
+
+ public Boolean getObject() {
+ return null;
+ }
+
+ public boolean bar() {
+ return false;
+ }
+
+ public java.util.Properties getProps() {
+ return null;
+ }
+
+}
diff --git a/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/ProvidesDouble.java b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/ProvidesDouble.java
new file mode 100644
index 0000000..56c06e9
--- /dev/null
+++ b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/ProvidesDouble.java
@@ -0,0 +1,41 @@
+package org.apache.felix.ipojo.test.scenarios.component;
+
+import java.util.Properties;
+
+import org.apache.felix.ipojo.annotations.Component;
+import org.apache.felix.ipojo.annotations.Provides;
+import org.apache.felix.ipojo.test.scenarios.annotations.service.FooService;
+
+@Component
+@Provides
+public class ProvidesDouble implements FooService {
+
+ public boolean foo() {
+ return false;
+ }
+
+ public Properties fooProps() {
+ return null;
+ }
+
+ public boolean getBoolean() {
+ return false;
+ }
+
+ public double getDouble() {
+ return 0;
+ }
+
+ public int getInt() {
+ return 0;
+ }
+
+ public long getLong() {
+ return 0;
+ }
+
+ public Boolean getObject() {
+ return null;
+ }
+
+}
diff --git a/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/ProvidesProperties.java b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/ProvidesProperties.java
new file mode 100644
index 0000000..081e8c9
--- /dev/null
+++ b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/ProvidesProperties.java
@@ -0,0 +1,81 @@
+package org.apache.felix.ipojo.test.scenarios.component;
+
+import java.util.Properties;
+
+import org.apache.felix.ipojo.annotations.Component;
+import org.apache.felix.ipojo.annotations.Provides;
+import org.apache.felix.ipojo.annotations.ServiceProperty;
+import org.apache.felix.ipojo.test.scenarios.annotations.service.BarService;
+import org.apache.felix.ipojo.test.scenarios.annotations.service.FooService;
+
+@Component
+@Provides(specifications= {FooService.class, BarService.class})
+public class ProvidesProperties implements FooService, BarService {
+
+ @ServiceProperty(name = "foo")
+ public int m_foo = 0;
+
+ @ServiceProperty(value = "4")
+ public int bar;
+
+ @ServiceProperty
+ public void setboo(int boo) {
+
+ }
+
+ @ServiceProperty(name="baz")
+ public void setBaz(int baz) {
+
+ }
+
+ @ServiceProperty(name="baz")
+ int m_baz;
+
+ @ServiceProperty
+ public int boo;
+
+ @ServiceProperty(name="baa")
+ public int m_baa;
+
+ @ServiceProperty(value="5")
+ public void setbaa(int baa) {
+
+ }
+
+ public boolean foo() {
+ return false;
+ }
+
+ public Properties fooProps() {
+ return null;
+ }
+
+ public boolean getBoolean() {
+ return false;
+ }
+
+ public double getDouble() {
+ return 0;
+ }
+
+ public int getInt() {
+ return 0;
+ }
+
+ public long getLong() {
+ return 0;
+ }
+
+ public Boolean getObject() {
+ return null;
+ }
+
+ public boolean bar() {
+ return false;
+ }
+
+ public Properties getProps() {
+ return null;
+ }
+
+}
diff --git a/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/ProvidesQuatro.java b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/ProvidesQuatro.java
new file mode 100644
index 0000000..49d2f02
--- /dev/null
+++ b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/ProvidesQuatro.java
@@ -0,0 +1,55 @@
+package org.apache.felix.ipojo.test.scenarios.component;
+
+import java.util.Properties;
+
+import org.apache.felix.ipojo.annotations.Component;
+import org.apache.felix.ipojo.annotations.Provides;
+import org.apache.felix.ipojo.test.scenarios.annotations.service.BarService;
+import org.apache.felix.ipojo.test.scenarios.annotations.service.CheckService;
+import org.apache.felix.ipojo.test.scenarios.annotations.service.FooService;
+
+@Component
+@Provides(specifications= {FooService.class, CheckService.class})
+public class ProvidesQuatro implements FooService, BarService, CheckService {
+
+ public boolean foo() {
+ return false;
+ }
+
+ public Properties fooProps() {
+ return null;
+ }
+
+ public boolean getBoolean() {
+ return false;
+ }
+
+ public double getDouble() {
+ return 0;
+ }
+
+ public int getInt() {
+ return 0;
+ }
+
+ public long getLong() {
+ return 0;
+ }
+
+ public Boolean getObject() {
+ return null;
+ }
+
+ public boolean bar() {
+ return false;
+ }
+
+ public Properties getProps() {
+ return null;
+ }
+
+ public boolean check() {
+ return false;
+ }
+
+}
diff --git a/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/ProvidesSimple.java b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/ProvidesSimple.java
new file mode 100644
index 0000000..56e877c
--- /dev/null
+++ b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/ProvidesSimple.java
@@ -0,0 +1,50 @@
+package org.apache.felix.ipojo.test.scenarios.component;
+
+import java.util.Properties;
+
+import org.apache.felix.ipojo.annotations.Component;
+import org.apache.felix.ipojo.annotations.Provides;
+import org.apache.felix.ipojo.test.scenarios.annotations.service.BarService;
+import org.apache.felix.ipojo.test.scenarios.annotations.service.FooService;
+
+@Component
+@Provides(specifications= {FooService.class, BarService.class})
+public class ProvidesSimple implements FooService, BarService {
+
+ public boolean foo() {
+ return false;
+ }
+
+ public Properties fooProps() {
+ return null;
+ }
+
+ public boolean getBoolean() {
+ return false;
+ }
+
+ public double getDouble() {
+ return 0;
+ }
+
+ public int getInt() {
+ return 0;
+ }
+
+ public long getLong() {
+ return 0;
+ }
+
+ public Boolean getObject() {
+ return null;
+ }
+
+ public boolean bar() {
+ return false;
+ }
+
+ public Properties getProps() {
+ return null;
+ }
+
+}
diff --git a/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/ProvidesTriple.java b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/ProvidesTriple.java
new file mode 100644
index 0000000..c6fbe89
--- /dev/null
+++ b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/ProvidesTriple.java
@@ -0,0 +1,55 @@
+package org.apache.felix.ipojo.test.scenarios.component;
+
+import java.util.Properties;
+
+import org.apache.felix.ipojo.annotations.Component;
+import org.apache.felix.ipojo.annotations.Provides;
+import org.apache.felix.ipojo.test.scenarios.annotations.service.BarService;
+import org.apache.felix.ipojo.test.scenarios.annotations.service.CheckService;
+import org.apache.felix.ipojo.test.scenarios.annotations.service.FooService;
+
+@Component
+@Provides(specifications= {CheckService.class})
+public class ProvidesTriple implements FooService, BarService, CheckService {
+
+ public boolean foo() {
+ return false;
+ }
+
+ public Properties fooProps() {
+ return null;
+ }
+
+ public boolean getBoolean() {
+ return false;
+ }
+
+ public double getDouble() {
+ return 0;
+ }
+
+ public int getInt() {
+ return 0;
+ }
+
+ public long getLong() {
+ return 0;
+ }
+
+ public Boolean getObject() {
+ return null;
+ }
+
+ public boolean bar() {
+ return false;
+ }
+
+ public Properties getProps() {
+ return null;
+ }
+
+ public boolean check() {
+ return false;
+ }
+
+}
diff --git a/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/RankedDependency.java b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/RankedDependency.java
new file mode 100644
index 0000000..5d84262
--- /dev/null
+++ b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/RankedDependency.java
@@ -0,0 +1,50 @@
+package org.apache.felix.ipojo.test.scenarios.component;
+
+import org.apache.felix.ipojo.annotations.Bind;
+import org.apache.felix.ipojo.annotations.Component;
+import org.apache.felix.ipojo.annotations.Requires;
+import org.apache.felix.ipojo.annotations.Unbind;
+import org.apache.felix.ipojo.test.scenarios.annotations.service.FooService;
+
+@Component
+public class RankedDependency {
+
+ @Requires(comparator = MyComparator.class)
+ public FooService fs;
+
+ @Unbind(comparator = MyComparator.class)
+ public void unbindBar() {
+ }
+
+ @Bind
+ public void bindBar() {
+ }
+
+ @Unbind
+ public void unbindBaz() {
+ }
+
+ @Bind(comparator = MyComparator.class)
+ public void bindBaz() {
+ }
+
+ @Requires(id = "inv")
+ public FooService fs2inv;
+
+ @Bind(id = "inv", comparator = MyComparator.class)
+ public void bindFS2Inv() {
+ }
+
+ @Unbind(id = "inv")
+ public void unbindFS2Inv() {
+ }
+
+ @Unbind(comparator = MyComparator.class, id = "unbindonly")
+ public void unbind() {
+ }
+
+ @Bind(comparator = MyComparator.class, id = "bindonly")
+ public void bind() {
+ }
+
+}
diff --git a/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/util/Utils.java b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/util/Utils.java
new file mode 100644
index 0000000..5eb2dc4
--- /dev/null
+++ b/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/util/Utils.java
@@ -0,0 +1,354 @@
+/*
+ * 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.parser.ManifestMetadataParser;
+import org.apache.felix.ipojo.parser.ParseException;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.cm.ManagedServiceFactory;
+
+import org.apache.felix.ipojo.metadata.Element;
+
+public class Utils {
+
+ public static Element getMetatadata(BundleContext bc, String component) {
+ String elem = (String) bc.getBundle().getHeaders().get("iPOJO-Components");
+ Assert.assertNotNull("iPOJO Components exists", elem);
+ try {
+ Element element = ManifestMetadataParser.parseHeaderMetadata(elem);
+ Element[] childs = element.getElements("component");
+ for (int i = 0; i < childs.length; i++) {
+ String name = childs[i].getAttribute("name");
+ String clazz = childs[i].getAttribute("classname");
+ if (name != null && name.equalsIgnoreCase(component)) {
+ return childs[i];
+ }
+ if (clazz.equalsIgnoreCase(component)) {
+ return childs[i];
+ }
+ }
+ Assert.fail("Component " + component + " not found in " + bc.getBundle().getSymbolicName());
+ } catch (ParseException e) {
+ Assert.fail("Cannot parse the components from " + bc.getBundle().getSymbolicName() + ": " + e.getMessage());
+ }
+
+ return null;
+
+ }
+
+ 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.dependency.bindingpolicy/pom.xml b/ipojo/tests/tests.core.service.dependency.bindingpolicy/pom.xml
new file mode 100644
index 0000000..de0f802
--- /dev/null
+++ b/ipojo/tests/tests.core.service.dependency.bindingpolicy/pom.xml
@@ -0,0 +1,104 @@
+<!--
+ 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 Dependency (Binding Policy) Test Suite</name>
+ <artifactId>tests.core.service.dependency.bindingpolicy</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>
+ <dependency>
+ <groupId>ipojo.tests</groupId>
+ <artifactId>tests.core.service.dependency</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>
+ <Bundle-SymbolicName>
+ ${pom.artifactId}
+ </Bundle-SymbolicName>
+ <Private-Package>
+ org.apache.felix.ipojo.test.scenarios.service.dependency.dynamic.priority, org.apache.felix.ipojo.test.scenarios.service.dependency.policies, org.apache.felix.ipojo.test.scenarios.service.dependency.statics, org.apache.felix.ipojo.test.scenarios.util
+ </Private-Package>
+ <Test-Suite>
+ org.apache.felix.ipojo.test.scenarios.service.dependency.policies.DependencyTestSuite
+ </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.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/dynamic/priority/DynamicPriorityDependencyTestSuite.java b/ipojo/tests/tests.core.service.dependency.bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/dynamic/priority/DynamicPriorityDependencyTestSuite.java
similarity index 95%
rename from ipojo/tests/tests.core.service.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/dynamic/priority/DynamicPriorityDependencyTestSuite.java
rename to ipojo/tests/tests.core.service.dependency.bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/dynamic/priority/DynamicPriorityDependencyTestSuite.java
index c60fe79..4fb517e 100644
--- a/ipojo/tests/tests.core.service.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/dynamic/priority/DynamicPriorityDependencyTestSuite.java
+++ b/ipojo/tests/tests.core.service.dependency.bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/dynamic/priority/DynamicPriorityDependencyTestSuite.java
@@ -27,7 +27,7 @@
public static Test suite(BundleContext bc) {
OSGiTestSuite ots = new OSGiTestSuite("Dynamic-Priority Dependency Test Suite", bc);
- ots.addTestSuite( SimpleDependencies.class);
+ ots.addTestSuite( SimpleDPDependencies.class);
return ots;
}
diff --git a/ipojo/tests/tests.core.service.dependency.bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/dynamic/priority/RankedFooProviderType1.java b/ipojo/tests/tests.core.service.dependency.bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/dynamic/priority/RankedFooProviderType1.java
new file mode 100644
index 0000000..2ea33d0
--- /dev/null
+++ b/ipojo/tests/tests.core.service.dependency.bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/dynamic/priority/RankedFooProviderType1.java
@@ -0,0 +1,52 @@
+/*
+ * 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.service.dependency.dynamic.priority;
+
+import java.util.Properties;
+
+import org.apache.felix.ipojo.test.scenarios.service.dependency.service.FooService;
+
+public class RankedFooProviderType1 implements FooService {
+ private int m_grade;
+
+
+ public boolean foo() {
+ m_grade = m_grade + 2;
+ return true;
+ }
+
+ public Properties fooProps() {
+ Properties p = new Properties();
+ p.put("grade", new Integer(m_grade));
+
+ return p;
+ }
+
+ public boolean getBoolean() { return true; }
+
+ public double getDouble() { return 1.0; }
+
+ public int getInt() {
+ return m_grade; }
+
+ public long getLong() { return 1; }
+
+ public Boolean getObject() { return new Boolean(true); }
+
+}
diff --git a/ipojo/tests/tests.core.service.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/dynamic/priority/SimpleDependencies.java b/ipojo/tests/tests.core.service.dependency.bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/dynamic/priority/SimpleDPDependencies.java
similarity index 98%
rename from ipojo/tests/tests.core.service.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/dynamic/priority/SimpleDependencies.java
rename to ipojo/tests/tests.core.service.dependency.bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/dynamic/priority/SimpleDPDependencies.java
index f942819..67d8292 100644
--- a/ipojo/tests/tests.core.service.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/dynamic/priority/SimpleDependencies.java
+++ b/ipojo/tests/tests.core.service.dependency.bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/dynamic/priority/SimpleDPDependencies.java
@@ -30,7 +30,7 @@
import org.apache.felix.ipojo.test.scenarios.service.dependency.service.CheckService;
import org.apache.felix.ipojo.test.scenarios.service.dependency.service.FooService;
-public class SimpleDependencies extends OSGiTestCase {
+public class SimpleDPDependencies extends OSGiTestCase {
ComponentInstance instance1, instance3;
ComponentInstance fooProvider;
diff --git a/ipojo/tests/tests.core.service.dependency.bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/policies/CheckProviderParentClass.java b/ipojo/tests/tests.core.service.dependency.bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/policies/CheckProviderParentClass.java
new file mode 100644
index 0000000..94e2ef7
--- /dev/null
+++ b/ipojo/tests/tests.core.service.dependency.bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/policies/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.service.dependency.policies;
+
+import org.apache.felix.ipojo.test.scenarios.service.dependency.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.dependency.bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/policies/CheckServiceProvider.java b/ipojo/tests/tests.core.service.dependency.bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/policies/CheckServiceProvider.java
new file mode 100644
index 0000000..0e125d3
--- /dev/null
+++ b/ipojo/tests/tests.core.service.dependency.bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/policies/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.service.dependency.policies;
+
+import java.util.Properties;
+
+import org.apache.felix.ipojo.test.scenarios.service.dependency.service.CheckService;
+import org.apache.felix.ipojo.test.scenarios.service.dependency.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.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/dynamic/priority/DynamicPriorityDependencyTestSuite.java b/ipojo/tests/tests.core.service.dependency.bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/policies/DependencyTestSuite.java
similarity index 68%
copy from ipojo/tests/tests.core.service.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/dynamic/priority/DynamicPriorityDependencyTestSuite.java
copy to ipojo/tests/tests.core.service.dependency.bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/policies/DependencyTestSuite.java
index c60fe79..89c7c08 100644
--- a/ipojo/tests/tests.core.service.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/dynamic/priority/DynamicPriorityDependencyTestSuite.java
+++ b/ipojo/tests/tests.core.service.dependency.bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/policies/DependencyTestSuite.java
@@ -16,18 +16,21 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.felix.ipojo.test.scenarios.service.dependency.dynamic.priority;
+package org.apache.felix.ipojo.test.scenarios.service.dependency.policies;
import junit.framework.Test;
import org.apache.felix.ipojo.junit4osgi.OSGiTestSuite;
+import org.apache.felix.ipojo.test.scenarios.service.dependency.dynamic.priority.DynamicPriorityDependencyTestSuite;
+import org.apache.felix.ipojo.test.scenarios.service.dependency.statics.StaticDependencyTestSuite;
import org.osgi.framework.BundleContext;
-public class DynamicPriorityDependencyTestSuite {
+public class DependencyTestSuite {
public static Test suite(BundleContext bc) {
- OSGiTestSuite ots = new OSGiTestSuite("Dynamic-Priority Dependency Test Suite", bc);
- ots.addTestSuite( SimpleDependencies.class);
+ OSGiTestSuite ots = new OSGiTestSuite("Service Dependencies (Binding Policy) Test Suite", bc);
+ ots.addTest(StaticDependencyTestSuite.suite(bc));
+ ots.addTest(DynamicPriorityDependencyTestSuite.suite(bc));
return ots;
}
diff --git a/ipojo/tests/tests.core.service.dependency.bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/policies/DynCheckServiceProvider.java b/ipojo/tests/tests.core.service.dependency.bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/policies/DynCheckServiceProvider.java
new file mode 100644
index 0000000..a8b6310
--- /dev/null
+++ b/ipojo/tests/tests.core.service.dependency.bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/policies/DynCheckServiceProvider.java
@@ -0,0 +1,79 @@
+/*
+ * 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.service.dependency.policies;
+
+import java.util.Properties;
+
+import org.apache.felix.ipojo.test.scenarios.service.dependency.service.CheckService;
+import org.apache.felix.ipojo.test.scenarios.service.dependency.service.FooService;
+import org.osgi.framework.ServiceReference;
+
+public class DynCheckServiceProvider 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("int", new Integer(fs.getInt()));
+ 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.dependency.bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/policies/MethodCheckServiceProvider.java b/ipojo/tests/tests.core.service.dependency.bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/policies/MethodCheckServiceProvider.java
new file mode 100644
index 0000000..a09290a
--- /dev/null
+++ b/ipojo/tests/tests.core.service.dependency.bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/policies/MethodCheckServiceProvider.java
@@ -0,0 +1,107 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.ipojo.test.scenarios.service.dependency.policies;
+
+import java.util.Properties;
+
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+
+import org.apache.felix.ipojo.test.scenarios.service.dependency.service.CheckService;
+import org.apache.felix.ipojo.test.scenarios.service.dependency.service.FooService;
+
+public class MethodCheckServiceProvider implements CheckService {
+
+ FooService fs;
+
+ BundleContext context;
+
+ int simpleB = 0;
+ int objectB = 0;
+ int refB = 0;
+ int bothB = 0;
+ int simpleU = 0;
+ int objectU = 0;
+ int refU = 0;
+ int bothU = 0;
+
+
+ public MethodCheckServiceProvider(BundleContext bc) {
+ context = bc;
+ }
+
+ public boolean check() {
+ return fs.foo();
+ }
+
+ public Properties getProps() {
+ Properties props = new Properties();
+ 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()));
+ } else {
+ props.put("result", new Boolean(false));
+ }
+ 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) {
+ if(fs.getObject() != null) { props.put("object", fs.getObject()); }
+ }
+
+ return props;
+ }
+
+ protected void objectBind(FooService o) {
+ if(o != null && o instanceof FooService) { objectB++; }
+ fs = o;
+ }
+ protected void objectUnbind(FooService o) {
+ if(o != null && o instanceof FooService) { objectU++; }
+ fs = null;
+ }
+
+ public void refBind(ServiceReference sr) {
+ if(sr != null) { refB++; }
+ fs = (FooService) context.getService(sr);
+ }
+ public void refUnbind(ServiceReference sr) {
+ if(sr != null) { refU++; }
+ context.ungetService(sr);
+ fs = null;
+ }
+
+ protected void bothBind(FooService o, ServiceReference ref) {
+ if(ref != null && o != null && o instanceof FooService) { bothB++; }
+ fs = o;
+ }
+ protected void bothUnbind(FooService o, ServiceReference ref) {
+ if(ref != null && o != null && o instanceof FooService) { bothU++; }
+ fs = null;
+ }
+}
diff --git a/ipojo/tests/tests.core.service.dependency.bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/policies/MethodMultipleCheckService.java b/ipojo/tests/tests.core.service.dependency.bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/policies/MethodMultipleCheckService.java
new file mode 100644
index 0000000..db0ae19
--- /dev/null
+++ b/ipojo/tests/tests.core.service.dependency.bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/policies/MethodMultipleCheckService.java
@@ -0,0 +1,154 @@
+/*
+ * 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.service.dependency.policies;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+
+import org.apache.felix.ipojo.test.scenarios.service.dependency.service.CheckService;
+import org.apache.felix.ipojo.test.scenarios.service.dependency.service.FooService;
+
+public class MethodMultipleCheckService implements CheckService {
+
+ List fs = new ArrayList();
+ BundleContext context;
+
+ int simpleB = 0;
+
+ int objectB = 0;
+
+ int refB = 0;
+
+ int bothB = 0;
+
+ int simpleU = 0;
+
+ int objectU = 0;
+
+ int refU = 0;
+
+ int bothU = 0;
+
+ public MethodMultipleCheckService(BundleContext bc) {
+ context = bc;
+ }
+
+ public boolean check() {
+ boolean r = fs.size() != 0;
+ for(int i = 0; i < fs.size(); i++) {
+ r = r & ((FooService) fs.get(i)).foo();
+ }
+ return r;
+ }
+
+ private boolean getBoolean() {
+ return check();
+ }
+
+ private int getInt() {
+ int r = 0;
+ for(int i = 0; i < fs.size(); i++) {
+ r = r + ((FooService) fs.get(i)).getInt();
+ }
+ return r;
+ }
+
+ private long getLong() {
+ long r = 0;
+ for(int i = 0; i < fs.size(); i++) {
+ r = r + ((FooService) fs.get(i)).getLong();
+ }
+ return r;
+ }
+
+ private double getDouble() {
+ double r = 0.0;
+ for(int i = 0; i < fs.size(); i++) {
+ r = r + ((FooService) fs.get(i)).getInt();
+ }
+ return r;
+ }
+
+ protected Object doNothing(Object o, String s) { return null; }
+
+// private Object getObject() {
+// boolean r = true;
+// for(int i = 0; i < fs.length; i++) {
+// r = r && ((Boolean) fs[i].getObject()).booleanValue();
+// }
+// return new Boolean(r);
+// }
+
+ public Properties getProps() {
+ Properties props = new Properties();
+ props.put("result", new Boolean(check()));
+ props.put("voidB", new Integer(simpleB));
+ props.put("objectB", new Integer(objectB));
+ props.put("refB", new Integer(refB));
+ props.put("bothB", new Integer(bothB));
+ props.put("voidU", new Integer(simpleU));
+ props.put("objectU", new Integer(objectU));
+ props.put("refU", new Integer(refU));
+ props.put("bothU", new Integer(bothU));
+ props.put("boolean", new Boolean(getBoolean()));
+ props.put("int", new Integer(getInt()));
+ props.put("long", new Long(getLong()));
+ props.put("double", new Double(getDouble()));
+
+ return props;
+ }
+
+ public void objectBind(FooService o) {
+ if(o != null && o instanceof FooService) { objectB++; }
+ fs.add(o);
+ }
+ public void objectUnbind(FooService o) {
+ if(o != null && o instanceof FooService) { objectU++; }
+ fs.remove(o);
+ }
+
+ public void refBind(ServiceReference sr) {
+ if(sr != null) { refB++; }
+ fs.add(context.getService(sr));
+ }
+ public void refUnbind(ServiceReference sr) {
+ if(sr != null) { refU++; }
+ fs.remove(context.getService(sr));
+ context.ungetService(sr);
+ }
+
+ public void bothBind(FooService o, ServiceReference sr) {
+ if (o != null && o instanceof FooService && sr != null) {
+ fs.add(o);
+ bothB++;
+ }
+ }
+
+ public void bothUnbind(FooService o, ServiceReference sr) {
+ if (o != null && o instanceof FooService && sr != null) {
+ fs.remove(o);
+ bothU++;
+ }
+ }
+
+}
diff --git a/ipojo/tests/tests.core.service.dependency.bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/policies/MultipleCheckService.java b/ipojo/tests/tests.core.service.dependency.bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/policies/MultipleCheckService.java
new file mode 100644
index 0000000..37cb9b1
--- /dev/null
+++ b/ipojo/tests/tests.core.service.dependency.bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/policies/MultipleCheckService.java
@@ -0,0 +1,159 @@
+/*
+ * 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.service.dependency.policies;
+
+import java.util.Properties;
+
+import org.osgi.framework.ServiceReference;
+
+import org.apache.felix.ipojo.test.scenarios.service.dependency.service.CheckService;
+import org.apache.felix.ipojo.test.scenarios.service.dependency.service.FooService;
+
+public class MultipleCheckService implements CheckService {
+
+ FooService fs[];
+
+ int simpleB = 0;
+
+ int objectB = 0;
+
+ int refB = 0;
+
+ int bothB = 0;
+
+ int simpleU = 0;
+
+ int objectU = 0;
+
+ int refU = 0;
+
+ int bothU = 0;
+
+ public boolean check() {
+ boolean r = fs.length != 0;
+ for (int i = 0; i < fs.length; i++) {
+ r = r & fs[i].foo();
+ }
+ return r;
+ }
+
+ private boolean getBoolean() {
+ return check();
+ }
+
+ private int getInt() {
+ int r = 0;
+ for (int i = 0; i < fs.length; i++) {
+ r = r + fs[i].getInt();
+ }
+ return r;
+ }
+
+ private long getLong() {
+ long r = 0;
+ for (int i = 0; i < fs.length; i++) {
+ r = r + fs[i].getLong();
+ }
+ return r;
+ }
+
+ private double getDouble() {
+ double r = 0.0;
+ for (int i = 0; i < fs.length; i++) {
+ r = r + fs[i].getInt();
+ }
+ return r;
+ }
+
+ protected Object doNothing(Object o, String s) {
+ return null;
+ }
+
+ // private Object getObject() {
+ // boolean r = true;
+ // for(int i = 0; i < fs.length; i++) {
+ // r = r && ((Boolean) fs[i].getObject()).booleanValue();
+ // }
+ // return new Boolean(r);
+ // }
+
+ public Properties getProps() {
+ Properties props = new Properties();
+ props.put("result", new Boolean(check()));
+ props.put("voidB", new Integer(simpleB));
+ props.put("objectB", new Integer(objectB));
+ props.put("refB", new Integer(refB));
+ props.put("bothB", new Integer(bothB));
+ props.put("voidU", new Integer(simpleU));
+ props.put("objectU", new Integer(objectU));
+ props.put("refU", new Integer(refU));
+ props.put("bothU", new Integer(bothU));
+ props.put("boolean", new Boolean(getBoolean()));
+ props.put("int", new Integer(getInt()));
+ props.put("long", new Long(getLong()));
+ props.put("double", new Double(getDouble()));
+
+ return props;
+ }
+
+ public void voidBind() {
+ simpleB++;
+ }
+
+ public void voidUnbind() {
+ simpleU++;
+ }
+
+ public void objectBind(FooService o) {
+ if (o != null && o instanceof FooService) {
+ objectB++;
+ }
+ }
+
+ public void objectUnbind(FooService o) {
+ if (o != null && o instanceof FooService) {
+ objectU++;
+ }
+ }
+
+ public void refBind(ServiceReference sr) {
+ if (sr != null) {
+ refB++;
+ }
+ }
+
+ public void refUnbind(ServiceReference sr) {
+ if (sr != null) {
+ refU++;
+ }
+ }
+
+ public void bothBind(FooService o, ServiceReference sr) {
+ if (o != null && o instanceof FooService && sr != null) {
+ bothB++;
+ }
+ }
+
+ public void bothUnbind(FooService o, ServiceReference sr) {
+ if (o != null && o instanceof FooService && sr != null) {
+ bothU++;
+ }
+ }
+
+}
diff --git a/ipojo/tests/tests.core.service.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/statics/MethodOptionalDependencies.java b/ipojo/tests/tests.core.service.dependency.bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/statics/MethodOptionalDependencies.java
similarity index 100%
rename from ipojo/tests/tests.core.service.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/statics/MethodOptionalDependencies.java
rename to ipojo/tests/tests.core.service.dependency.bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/statics/MethodOptionalDependencies.java
diff --git a/ipojo/tests/tests.core.service.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/statics/MethodSimpleDependencies.java b/ipojo/tests/tests.core.service.dependency.bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/statics/MethodSimpleDependencies.java
similarity index 100%
rename from ipojo/tests/tests.core.service.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/statics/MethodSimpleDependencies.java
rename to ipojo/tests/tests.core.service.dependency.bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/statics/MethodSimpleDependencies.java
diff --git a/ipojo/tests/tests.core.service.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/statics/MultipleDependencies.java b/ipojo/tests/tests.core.service.dependency.bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/statics/MultipleDependencies.java
similarity index 100%
rename from ipojo/tests/tests.core.service.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/statics/MultipleDependencies.java
rename to ipojo/tests/tests.core.service.dependency.bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/statics/MultipleDependencies.java
diff --git a/ipojo/tests/tests.core.service.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/statics/OptionalDependencies.java b/ipojo/tests/tests.core.service.dependency.bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/statics/OptionalDependencies.java
similarity index 100%
rename from ipojo/tests/tests.core.service.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/statics/OptionalDependencies.java
rename to ipojo/tests/tests.core.service.dependency.bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/statics/OptionalDependencies.java
diff --git a/ipojo/tests/tests.core.service.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/statics/SimpleDependencies.java b/ipojo/tests/tests.core.service.dependency.bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/statics/SimpleDependencies.java
similarity index 100%
rename from ipojo/tests/tests.core.service.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/statics/SimpleDependencies.java
rename to ipojo/tests/tests.core.service.dependency.bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/statics/SimpleDependencies.java
diff --git a/ipojo/tests/tests.core.service.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/statics/StaticDependencyTestSuite.java b/ipojo/tests/tests.core.service.dependency.bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/statics/StaticDependencyTestSuite.java
similarity index 75%
rename from ipojo/tests/tests.core.service.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/statics/StaticDependencyTestSuite.java
rename to ipojo/tests/tests.core.service.dependency.bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/statics/StaticDependencyTestSuite.java
index 0d8ea4b..33d6487 100644
--- a/ipojo/tests/tests.core.service.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/statics/StaticDependencyTestSuite.java
+++ b/ipojo/tests/tests.core.service.dependency.bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/statics/StaticDependencyTestSuite.java
@@ -21,6 +21,11 @@
import junit.framework.Test;
import org.apache.felix.ipojo.junit4osgi.OSGiTestSuite;
+import org.apache.felix.ipojo.test.scenarios.service.dependency.statics.MethodOptionalDependencies;
+import org.apache.felix.ipojo.test.scenarios.service.dependency.statics.MethodSimpleDependencies;
+import org.apache.felix.ipojo.test.scenarios.service.dependency.statics.MultipleDependencies;
+import org.apache.felix.ipojo.test.scenarios.service.dependency.statics.OptionalDependencies;
+import org.apache.felix.ipojo.test.scenarios.service.dependency.statics.SimpleDependencies;
import org.osgi.framework.BundleContext;
public class StaticDependencyTestSuite {
diff --git a/ipojo/tests/tests.core.service.dependency.bindingpolicy/src/main/resources/metadata.xml b/ipojo/tests/tests.core.service.dependency.bindingpolicy/src/main/resources/metadata.xml
new file mode 100644
index 0000000..5599af5
--- /dev/null
+++ b/ipojo/tests/tests.core.service.dependency.bindingpolicy/src/main/resources/metadata.xml
@@ -0,0 +1,260 @@
+<ipojo>
+
+ <!-- Static Dependencies -->
+ <component
+ className="org.apache.felix.ipojo.test.scenarios.service.dependency.policies.CheckServiceProvider"
+ factory="StaticSimpleCheckServiceProvider" architecture="true">
+ <requires field="fs" policy="static" />
+ <provides />
+ </component>
+ <component
+ className="org.apache.felix.ipojo.test.scenarios.service.dependency.policies.CheckServiceProvider"
+ factory="StaticVoidCheckServiceProvider" architecture="true">
+ <requires field="fs" policy="static">
+ <callback type="bind" method="voidBind" />
+ <callback type="unbind" method="voidUnbind" />
+ </requires>
+ <provides />
+ </component>
+ <component
+ className="org.apache.felix.ipojo.test.scenarios.service.dependency.policies.CheckServiceProvider"
+ factory="StaticObjectCheckServiceProvider" architecture="true">
+ <requires field="fs" policy="static">
+ <callback type="bind" method="objectBind" />
+ <callback type="unbind" method="objectUnbind" />
+ </requires>
+ <provides />
+ </component>
+ <component
+ className="org.apache.felix.ipojo.test.scenarios.service.dependency.policies.CheckServiceProvider"
+ factory="StaticRefCheckServiceProvider" architecture="true">
+ <requires field="fs" policy="static">
+ <callback type="bind" method="refBind" />
+ <callback type="unbind" method="refUnbind" />
+ </requires>
+ <provides />
+ </component>
+ <component
+ className="org.apache.felix.ipojo.test.scenarios.service.dependency.policies.CheckServiceProvider"
+ factory="StaticBothCheckServiceProvider" architecture="true">
+ <requires field="fs" policy="static">
+ <callback type="bind" method="bothBind" />
+ <callback type="unbind" method="bothUnbind" />
+ </requires>
+ <provides />
+ </component>
+ <component
+ className="org.apache.felix.ipojo.test.scenarios.service.dependency.policies.MethodCheckServiceProvider"
+ factory="StaticMObjectCheckServiceProvider" architecture="true">
+ <requires policy="static">
+ <callback type="bind" method="objectBind" />
+ <callback type="unbind" method="objectUnbind" />
+ </requires>
+ <provides />
+ </component>
+ <component
+ className="org.apache.felix.ipojo.test.scenarios.service.dependency.policies.MethodCheckServiceProvider"
+ factory="StaticMRefCheckServiceProvider" architecture="true">
+ <requires
+ interface="org.apache.felix.ipojo.test.scenarios.service.dependency.service.FooService"
+ policy="static">
+ <callback type="bind" method="refBind" />
+ <callback type="unbind" method="refUnbind" />
+ </requires>
+ <provides />
+ </component>
+ <component
+ className="org.apache.felix.ipojo.test.scenarios.service.dependency.policies.MethodCheckServiceProvider"
+ factory="StaticMBothCheckServiceProvider" architecture="true">
+ <requires policy="static">
+ <callback type="bind" method="bothBind" />
+ <callback type="unbind" method="bothUnbind" />
+ </requires>
+ <provides />
+ </component>
+
+ <!-- Static Simple & Optional Dependencies -->
+ <component
+ className="org.apache.felix.ipojo.test.scenarios.service.dependency.policies.CheckServiceProvider"
+ factory="StaticSimpleOptionalCheckServiceProvider"
+ architecture="true">
+ <requires field="fs" optional="true" policy="static" />
+ <provides />
+ </component>
+ <component
+ className="org.apache.felix.ipojo.test.scenarios.service.dependency.policies.CheckServiceProvider"
+ factory="StaticVoidOptionalCheckServiceProvider"
+ architecture="true">
+ <requires field="fs" optional="true" policy="static">
+ <callback type="bind" method="voidBind" />
+ <callback type="unbind" method="voidUnbind" />
+ </requires>
+ <provides />
+ </component>
+ <component
+ className="org.apache.felix.ipojo.test.scenarios.service.dependency.policies.CheckServiceProvider"
+ factory="StaticObjectOptionalCheckServiceProvider"
+ architecture="true">
+ <requires field="fs" optional="true" policy="static">
+ <callback type="bind" method="objectBind" />
+ <callback type="unbind" method="objectUnbind" />
+ </requires>
+ <provides />
+ </component>
+ <component
+ className="org.apache.felix.ipojo.test.scenarios.service.dependency.policies.CheckServiceProvider"
+ factory="StaticRefOptionalCheckServiceProvider" architecture="true">
+ <requires field="fs" optional="true" policy="static">
+ <callback type="bind" method="refBind" />
+ <callback type="unbind" method="refUnbind" />
+ </requires>
+ <provides />
+ </component>
+ <component
+ className="org.apache.felix.ipojo.test.scenarios.service.dependency.policies.CheckServiceProvider"
+ factory="StaticBothOptionalCheckServiceProvider"
+ architecture="true">
+ <requires field="fs" optional="true" policy="static">
+ <callback type="bind" method="bothBind" />
+ <callback type="unbind" method="bothUnbind" />
+ </requires>
+ <provides />
+ </component>
+ <component
+ className="org.apache.felix.ipojo.test.scenarios.service.dependency.policies.MethodCheckServiceProvider"
+ factory="StaticMObjectOptionalCheckServiceProvider"
+ architecture="true">
+ <requires optional="true" policy="static">
+ <callback type="bind" method="objectBind" />
+ <callback type="unbind" method="objectUnbind" />
+ </requires>
+ <provides />
+ </component>
+ <component
+ className="org.apache.felix.ipojo.test.scenarios.service.dependency.policies.MethodCheckServiceProvider"
+ factory="StaticMRefOptionalCheckServiceProvider"
+ architecture="true">
+ <requires
+ interface="org.apache.felix.ipojo.test.scenarios.service.dependency.service.FooService"
+ optional="true" policy="static">
+ <callback type="bind" method="refBind" />
+ <callback type="unbind" method="refUnbind" />
+ </requires>
+ <provides />
+ </component>
+ <component
+ className="org.apache.felix.ipojo.test.scenarios.service.dependency.policies.MethodCheckServiceProvider"
+ factory="StaticMBothOptionalCheckServiceProvider"
+ architecture="true">
+ <requires
+ interface="org.apache.felix.ipojo.test.scenarios.service.dependency.service.FooService"
+ optional="true" policy="static">
+ <callback type="bind" method="bothBind" />
+ <callback type="unbind" method="bothUnbind" />
+ </requires>
+ <provides />
+ </component>
+ <!-- Static Multiple Dependencies -->
+ <component
+ className="org.apache.felix.ipojo.test.scenarios.service.dependency.policies.MultipleCheckService"
+ factory="StaticSimpleMultipleCheckServiceProvider"
+ architecture="true">
+ <requires field="fs" policy="static" />
+ <provides />
+ </component>
+ <component
+ className="org.apache.felix.ipojo.test.scenarios.service.dependency.policies.MultipleCheckService"
+ factory="StaticVoidMultipleCheckServiceProvider"
+ architecture="true">
+ <requires field="fs" policy="static">
+ <callback type="bind" method="voidBind" />
+ <callback type="unbind" method="voidUnbind" />
+ </requires>
+ <provides />
+ </component>
+ <component
+ className="org.apache.felix.ipojo.test.scenarios.service.dependency.policies.MultipleCheckService"
+ factory="StaticObjectMultipleCheckServiceProvider"
+ architecture="true">
+ <requires field="fs" policy="static">
+ <callback type="bind" method="objectBind" />
+ <callback type="unbind" method="objectUnbind" />
+ </requires>
+ <provides />
+ </component>
+ <component
+ className="org.apache.felix.ipojo.test.scenarios.service.dependency.policies.MultipleCheckService"
+ factory="StaticRefMultipleCheckServiceProvider" architecture="true">
+ <requires field="fs" policy="static">
+ <callback type="bind" method="refBind" />
+ <callback type="unbind" method="refUnbind" />
+ </requires>
+ <provides />
+ </component>
+ <component
+ className="org.apache.felix.ipojo.test.scenarios.service.dependency.policies.MultipleCheckService"
+ factory="StaticBothMultipleCheckServiceProvider"
+ architecture="true">
+ <requires field="fs" policy="static">
+ <callback type="bind" method="bothBind" />
+ <callback type="unbind" method="bothUnbind" />
+ </requires>
+ <provides />
+ </component>
+ <component
+ className="org.apache.felix.ipojo.test.scenarios.service.dependency.policies.MethodMultipleCheckService"
+ factory="StaticMObjectMultipleCheckServiceProvider"
+ architecture="true">
+ <requires aggregate="true" policy="static">
+ <callback type="bind" method="objectBind" />
+ <callback type="unbind" method="objectUnbind" />
+ </requires>
+ <provides />
+ </component>
+ <component
+ className="org.apache.felix.ipojo.test.scenarios.service.dependency.policies.MethodMultipleCheckService"
+ factory="StaticMRefMultipleCheckServiceProvider"
+ architecture="true">
+ <requires
+ interface="org.apache.felix.ipojo.test.scenarios.service.dependency.service.FooService"
+ aggregate="true" policy="static">
+ <callback type="bind" method="refBind" />
+ <callback type="unbind" method="refUnbind" />
+ </requires>
+ <provides />
+ </component>
+ <component
+ className="org.apache.felix.ipojo.test.scenarios.service.dependency.policies.MethodMultipleCheckService"
+ factory="StaticMBothMultipleCheckServiceProvider"
+ architecture="true">
+ <requires aggregate="true" policy="static">
+ <callback type="bind" method="bothBind" />
+ <callback type="unbind" method="bothUnbind" />
+ </requires>
+ <provides />
+ </component>
+
+ <!-- Dynamic-Priority -->
+ <component
+ className="org.apache.felix.ipojo.test.scenarios.service.dependency.dynamic.priority.RankedFooProviderType1"
+ factory="RankedFooProviderType" architecture="true">
+ <provides>
+ <property field="m_grade" name="service.ranking"/>
+ </provides>
+ </component>
+ <component
+ className="org.apache.felix.ipojo.test.scenarios.service.dependency.policies.DynCheckServiceProvider"
+ factory="DPSimpleCheckServiceProvider" architecture="true">
+ <requires field="fs" policy="dynamic-priority" />
+ <provides />
+ </component>
+ <component
+ className="org.apache.felix.ipojo.test.scenarios.service.dependency.policies.DynCheckServiceProvider"
+ factory="DPObjectCheckServiceProvider" architecture="true">
+ <requires field="fs" policy="dynamic-priority">
+ <callback type="bind" method="objectBind" />
+ <callback type="unbind" method="objectUnbind" />
+ </requires>
+ <provides />
+ </component>
+</ipojo>
diff --git a/ipojo/tests/tests.core.service.dependency.filter/pom.xml b/ipojo/tests/tests.core.service.dependency.filter/pom.xml
new file mode 100644
index 0000000..c0b144a
--- /dev/null
+++ b/ipojo/tests/tests.core.service.dependency.filter/pom.xml
@@ -0,0 +1,104 @@
+<!--
+ 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 Dependency (Filter) Test Suite</name>
+ <artifactId>tests.core.service.dependency.filter</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>
+ <dependency>
+ <groupId>ipojo.tests</groupId>
+ <artifactId>tests.core.service.dependency</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>
+ <Bundle-SymbolicName>
+ ${pom.artifactId}
+ </Bundle-SymbolicName>
+ <Private-Package>
+ org.apache.felix.ipojo.test.scenarios.service.dependency.filter, org.apache.felix.ipojo.test.scenarios.service.dependency.filter.component, org.apache.felix.ipojo.test.scenarios.util
+ </Private-Package>
+ <Test-Suite>
+ org.apache.felix.ipojo.test.scenarios.service.dependency.filter.FilteredDependencyTestSuite
+ </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.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/dynamic/priority/DynamicPriorityDependencyTestSuite.java b/ipojo/tests/tests.core.service.dependency.filter/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/filter/FilteredDependencyTestSuite.java
similarity index 72%
copy from ipojo/tests/tests.core.service.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/dynamic/priority/DynamicPriorityDependencyTestSuite.java
copy to ipojo/tests/tests.core.service.dependency.filter/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/filter/FilteredDependencyTestSuite.java
index c60fe79..182f526 100644
--- a/ipojo/tests/tests.core.service.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/dynamic/priority/DynamicPriorityDependencyTestSuite.java
+++ b/ipojo/tests/tests.core.service.dependency.filter/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/filter/FilteredDependencyTestSuite.java
@@ -16,18 +16,21 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.felix.ipojo.test.scenarios.service.dependency.dynamic.priority;
+package org.apache.felix.ipojo.test.scenarios.service.dependency.filter;
import junit.framework.Test;
import org.apache.felix.ipojo.junit4osgi.OSGiTestSuite;
import org.osgi.framework.BundleContext;
-public class DynamicPriorityDependencyTestSuite {
+public class FilteredDependencyTestSuite {
public static Test suite(BundleContext bc) {
- OSGiTestSuite ots = new OSGiTestSuite("Dynamic-Priority Dependency Test Suite", bc);
- ots.addTestSuite( SimpleDependencies.class);
+ OSGiTestSuite ots = new OSGiTestSuite("iPOJO Filtered Service Dependency Test Suite", bc);
+ ots.addTestSuite(SimpleFilterDependencies.class);
+ ots.addTestSuite(OptionalSimpleFilterDependencies.class);
+ ots.addTestSuite(MultipleFilterDependencies.class);
+ ots.addTestSuite(OptionalMultipleFilterDependencies.class);
return ots;
}
diff --git a/ipojo/tests/tests.core.service.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/MultipleFilterDependencies.java b/ipojo/tests/tests.core.service.dependency.filter/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/filter/MultipleFilterDependencies.java
similarity index 99%
rename from ipojo/tests/tests.core.service.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/MultipleFilterDependencies.java
rename to ipojo/tests/tests.core.service.dependency.filter/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/filter/MultipleFilterDependencies.java
index 580f60c..c784e0c 100644
--- a/ipojo/tests/tests.core.service.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/MultipleFilterDependencies.java
+++ b/ipojo/tests/tests.core.service.dependency.filter/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/filter/MultipleFilterDependencies.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.felix.ipojo.test.scenarios.service.dependency;
+package org.apache.felix.ipojo.test.scenarios.service.dependency.filter;
import java.util.Properties;
diff --git a/ipojo/tests/tests.core.service.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/OptionalMultipleFilterDependencies.java b/ipojo/tests/tests.core.service.dependency.filter/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/filter/OptionalMultipleFilterDependencies.java
similarity index 99%
rename from ipojo/tests/tests.core.service.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/OptionalMultipleFilterDependencies.java
rename to ipojo/tests/tests.core.service.dependency.filter/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/filter/OptionalMultipleFilterDependencies.java
index 298bce6..5616931 100644
--- a/ipojo/tests/tests.core.service.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/OptionalMultipleFilterDependencies.java
+++ b/ipojo/tests/tests.core.service.dependency.filter/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/filter/OptionalMultipleFilterDependencies.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.felix.ipojo.test.scenarios.service.dependency;
+package org.apache.felix.ipojo.test.scenarios.service.dependency.filter;
import java.util.Properties;
diff --git a/ipojo/tests/tests.core.service.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/OptionalSimpleFilterDependencies.java b/ipojo/tests/tests.core.service.dependency.filter/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/filter/OptionalSimpleFilterDependencies.java
similarity index 99%
rename from ipojo/tests/tests.core.service.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/OptionalSimpleFilterDependencies.java
rename to ipojo/tests/tests.core.service.dependency.filter/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/filter/OptionalSimpleFilterDependencies.java
index 07cab6f..57db4ec 100644
--- a/ipojo/tests/tests.core.service.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/OptionalSimpleFilterDependencies.java
+++ b/ipojo/tests/tests.core.service.dependency.filter/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/filter/OptionalSimpleFilterDependencies.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.felix.ipojo.test.scenarios.service.dependency;
+package org.apache.felix.ipojo.test.scenarios.service.dependency.filter;
import java.util.Properties;
diff --git a/ipojo/tests/tests.core.service.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/SimpleFilterDependencies.java b/ipojo/tests/tests.core.service.dependency.filter/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/filter/SimpleFilterDependencies.java
similarity index 99%
rename from ipojo/tests/tests.core.service.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/SimpleFilterDependencies.java
rename to ipojo/tests/tests.core.service.dependency.filter/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/filter/SimpleFilterDependencies.java
index db8103a..d836312 100644
--- a/ipojo/tests/tests.core.service.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/SimpleFilterDependencies.java
+++ b/ipojo/tests/tests.core.service.dependency.filter/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/filter/SimpleFilterDependencies.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.felix.ipojo.test.scenarios.service.dependency;
+package org.apache.felix.ipojo.test.scenarios.service.dependency.filter;
import java.util.Properties;
diff --git a/ipojo/tests/tests.core.service.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FilterCheckProvider.java b/ipojo/tests/tests.core.service.dependency.filter/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/filter/component/FilterCheckProvider.java
similarity index 96%
rename from ipojo/tests/tests.core.service.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FilterCheckProvider.java
rename to ipojo/tests/tests.core.service.dependency.filter/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/filter/component/FilterCheckProvider.java
index 7d5313d..2a81c23 100644
--- a/ipojo/tests/tests.core.service.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FilterCheckProvider.java
+++ b/ipojo/tests/tests.core.service.dependency.filter/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/filter/component/FilterCheckProvider.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.felix.ipojo.test.scenarios.component;
+package org.apache.felix.ipojo.test.scenarios.service.dependency.filter.component;
import java.util.Properties;
diff --git a/ipojo/tests/tests.core.service.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FilterCheckSubscriber.java b/ipojo/tests/tests.core.service.dependency.filter/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/filter/component/FilterCheckSubscriber.java
similarity index 94%
rename from ipojo/tests/tests.core.service.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FilterCheckSubscriber.java
rename to ipojo/tests/tests.core.service.dependency.filter/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/filter/component/FilterCheckSubscriber.java
index a3ffe20..cfd1be8 100644
--- a/ipojo/tests/tests.core.service.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FilterCheckSubscriber.java
+++ b/ipojo/tests/tests.core.service.dependency.filter/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/filter/component/FilterCheckSubscriber.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.felix.ipojo.test.scenarios.component;
+package org.apache.felix.ipojo.test.scenarios.service.dependency.filter.component;
import java.util.Properties;
diff --git a/ipojo/tests/tests.core.service.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FilterCheckSubscriber.java b/ipojo/tests/tests.core.service.dependency.filter/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/filter/component/MultipleFilterCheckSubscriber.java
similarity index 78%
copy from ipojo/tests/tests.core.service.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FilterCheckSubscriber.java
copy to ipojo/tests/tests.core.service.dependency.filter/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/filter/component/MultipleFilterCheckSubscriber.java
index a3ffe20..ca4b3ff 100644
--- a/ipojo/tests/tests.core.service.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FilterCheckSubscriber.java
+++ b/ipojo/tests/tests.core.service.dependency.filter/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/filter/component/MultipleFilterCheckSubscriber.java
@@ -16,33 +16,33 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.felix.ipojo.test.scenarios.component;
+package org.apache.felix.ipojo.test.scenarios.service.dependency.filter.component;
import java.util.Properties;
-import org.apache.felix.ipojo.Nullable;
-
import org.apache.felix.ipojo.test.scenarios.service.dependency.service.CheckService;
import org.apache.felix.ipojo.test.scenarios.service.dependency.service.FooService;
-public class FilterCheckSubscriber implements CheckService {
+public class MultipleFilterCheckSubscriber implements CheckService {
- private FooService m_foo;
+ private FooService[] m_foo;
private int binded;
- public FilterCheckSubscriber(){
+ public MultipleFilterCheckSubscriber(){
}
public boolean check() {
- m_foo.foo();
+ for (int i = 0; i < m_foo.length; i++) {
+ m_foo[i].foo();
+ }
return true;
}
public Properties getProps() {
Properties props = new Properties();
props.put("Bind", new Integer(binded));
- props.put("Nullable", new Boolean(m_foo instanceof Nullable));
+ props.put("Size", new Integer(m_foo.length));
return props;
}
diff --git a/ipojo/tests/tests.core.service.dependency.filter/src/main/resources/metadata.xml b/ipojo/tests/tests.core.service.dependency.filter/src/main/resources/metadata.xml
new file mode 100644
index 0000000..f1a8254
--- /dev/null
+++ b/ipojo/tests/tests.core.service.dependency.filter/src/main/resources/metadata.xml
@@ -0,0 +1,100 @@
+<ipojo>
+ <!-- Simple Filter Dependencies -->
+ <component
+ className="org.apache.felix.ipojo.test.scenarios.service.dependency.filter.component.FilterCheckProvider"
+ factory="SimpleFilterCheckServiceProvider" architecture="true">
+ <provides>
+ <property field="m_toto" name="toto" value="A" />
+ </provides>
+ </component>
+
+ <component
+ className="org.apache.felix.ipojo.test.scenarios.service.dependency.filter.component.FilterCheckSubscriber"
+ factory="SimpleFilterCheckServiceSubscriber" architecture="true">
+ <requires field="m_foo" filter="(toto=B)" id="id1">
+ <callback type="bind" method="Bind" />
+ <callback type="unbind" method="Unbind" />
+ </requires>
+ <provides />
+ </component>
+
+ <component
+ className="org.apache.felix.ipojo.test.scenarios.service.dependency.filter.component.FilterCheckSubscriber"
+ factory="SimpleFilterCheckServiceSubscriber2" architecture="true">
+ <requires field="m_foo" id="id2">
+ <callback type="bind" method="Bind" />
+ <callback type="unbind" method="Unbind" />
+ </requires>
+ <provides />
+ </component>
+
+ <!-- Optional Simple Filter Dependencies -->
+ <component
+ className="org.apache.felix.ipojo.test.scenarios.service.dependency.filter.component.FilterCheckSubscriber"
+ factory="OptionalSimpleFilterCheckServiceSubscriber"
+ architecture="true">
+ <requires field="m_foo" filter="(toto=B)" id="id1"
+ optional="true">
+ <callback type="bind" method="Bind" />
+ <callback type="unbind" method="Unbind" />
+ </requires>
+ <provides />
+ </component>
+
+ <component
+ className="org.apache.felix.ipojo.test.scenarios.service.dependency.filter.component.FilterCheckSubscriber"
+ factory="OptionalSimpleFilterCheckServiceSubscriber2"
+ architecture="true">
+ <requires field="m_foo" id="id2" optional="true">
+ <callback type="bind" method="Bind" />
+ <callback type="unbind" method="Unbind" />
+ </requires>
+ <provides />
+ </component>
+
+ <!-- Aggregate filter Dependencies-->
+ <component
+ className="org.apache.felix.ipojo.test.scenarios.service.dependency.filter.component.MultipleFilterCheckSubscriber"
+ factory="MultipleFilterCheckServiceSubscriber" architecture="true">
+ <requires field="m_foo" filter="(toto=B)" id="id1">
+ <callback type="bind" method="Bind" />
+ <callback type="unbind" method="Unbind" />
+ </requires>
+ <provides />
+ </component>
+
+ <component
+ className="org.apache.felix.ipojo.test.scenarios.service.dependency.filter.component.MultipleFilterCheckSubscriber"
+ factory="MultipleFilterCheckServiceSubscriber2" architecture="true">
+ <requires field="m_foo" id="id2">
+ <callback type="bind" method="Bind" />
+ <callback type="unbind" method="Unbind" />
+ </requires>
+ <provides />
+ </component>
+
+ <!-- Optional Aggregate Filter Dependencies -->
+ <component
+ className="org.apache.felix.ipojo.test.scenarios.service.dependency.filter.component.MultipleFilterCheckSubscriber"
+ factory="OptionalMultipleFilterCheckServiceSubscriber"
+ architecture="true">
+ <requires field="m_foo" filter="(toto=B)" id="id1"
+ optional="true">
+ <callback type="bind" method="Bind" />
+ <callback type="unbind" method="Unbind" />
+ </requires>
+ <provides />
+ </component>
+
+ <component
+ className="org.apache.felix.ipojo.test.scenarios.service.dependency.filter.component.MultipleFilterCheckSubscriber"
+ factory="OptionalMultipleFilterCheckServiceSubscriber2"
+ architecture="true">
+ <requires field="m_foo" id="id2" optional="true">
+ <callback type="bind" method="Bind" />
+ <callback type="unbind" method="Unbind" />
+ </requires>
+ <provides />
+ </component>
+
+</ipojo>
diff --git a/ipojo/tests/tests.core.service.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/DependencyTestSuite.java b/ipojo/tests/tests.core.service.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/DependencyTestSuite.java
index 5a63567..d19c752 100644
--- a/ipojo/tests/tests.core.service.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/DependencyTestSuite.java
+++ b/ipojo/tests/tests.core.service.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/DependencyTestSuite.java
@@ -22,8 +22,6 @@
import org.apache.felix.ipojo.junit4osgi.OSGiTestSuite;
import org.apache.felix.ipojo.test.scenarios.service.dependency.di.DefaultImplementationTestSuite;
-import org.apache.felix.ipojo.test.scenarios.service.dependency.dynamic.priority.DynamicPriorityDependencyTestSuite;
-import org.apache.felix.ipojo.test.scenarios.service.dependency.statics.StaticDependencyTestSuite;
import org.osgi.framework.BundleContext;
public class DependencyTestSuite {
@@ -47,14 +45,8 @@
ots.addTestSuite(MethodDelayedOptionalDependencies.class);
ots.addTestSuite(MethodDelayedMultipleDependencies.class);
ots.addTestSuite(MethodDelayedOptionalMultipleDependencies.class);
- ots.addTestSuite(SimpleFilterDependencies.class);
- ots.addTestSuite(OptionalSimpleFilterDependencies.class);
- ots.addTestSuite(MultipleFilterDependencies.class);
- ots.addTestSuite(OptionalMultipleFilterDependencies.class);
- ots.addTest(StaticDependencyTestSuite.suite(bc));
ots.addTest(DefaultImplementationTestSuite.suite(bc));
ots.addTestSuite(DependencyArchitectureTest.class);
- ots.addTest(DynamicPriorityDependencyTestSuite.suite(bc));
return ots;
}
diff --git a/ipojo/tests/tests.core.service.dependency/src/main/resources/metadata.xml b/ipojo/tests/tests.core.service.dependency/src/main/resources/metadata.xml
index 6b84847..3660654 100644
--- a/ipojo/tests/tests.core.service.dependency/src/main/resources/metadata.xml
+++ b/ipojo/tests/tests.core.service.dependency/src/main/resources/metadata.xml
@@ -423,361 +423,5 @@
</requires>
<provides />
</component>
-
- <!-- Static Dependencies -->
- <component
- className="org.apache.felix.ipojo.test.scenarios.component.CheckServiceProvider"
- factory="StaticSimpleCheckServiceProvider" architecture="true">
- <requires field="fs" policy="static" />
- <provides />
- </component>
- <component
- className="org.apache.felix.ipojo.test.scenarios.component.CheckServiceProvider"
- factory="StaticVoidCheckServiceProvider" architecture="true">
- <requires field="fs" policy="static">
- <callback type="bind" method="voidBind" />
- <callback type="unbind" method="voidUnbind" />
- </requires>
- <provides />
- </component>
- <component
- className="org.apache.felix.ipojo.test.scenarios.component.CheckServiceProvider"
- factory="StaticObjectCheckServiceProvider" architecture="true">
- <requires field="fs" policy="static">
- <callback type="bind" method="objectBind" />
- <callback type="unbind" method="objectUnbind" />
- </requires>
- <provides />
- </component>
- <component
- className="org.apache.felix.ipojo.test.scenarios.component.CheckServiceProvider"
- factory="StaticRefCheckServiceProvider" architecture="true">
- <requires field="fs" policy="static">
- <callback type="bind" method="refBind" />
- <callback type="unbind" method="refUnbind" />
- </requires>
- <provides />
- </component>
- <component
- className="org.apache.felix.ipojo.test.scenarios.component.CheckServiceProvider"
- factory="StaticBothCheckServiceProvider" architecture="true">
- <requires field="fs" policy="static">
- <callback type="bind" method="bothBind" />
- <callback type="unbind" method="bothUnbind" />
- </requires>
- <provides />
- </component>
- <component
- className="org.apache.felix.ipojo.test.scenarios.component.MethodCheckServiceProvider"
- factory="StaticMObjectCheckServiceProvider" architecture="true">
- <requires policy="static">
- <callback type="bind" method="objectBind" />
- <callback type="unbind" method="objectUnbind" />
- </requires>
- <provides />
- </component>
- <component
- className="org.apache.felix.ipojo.test.scenarios.component.MethodCheckServiceProvider"
- factory="StaticMRefCheckServiceProvider" architecture="true">
- <requires
- interface="org.apache.felix.ipojo.test.scenarios.service.dependency.service.FooService"
- policy="static">
- <callback type="bind" method="refBind" />
- <callback type="unbind" method="refUnbind" />
- </requires>
- <provides />
- </component>
- <component
- className="org.apache.felix.ipojo.test.scenarios.component.MethodCheckServiceProvider"
- factory="StaticMBothCheckServiceProvider" architecture="true">
- <requires policy="static">
- <callback type="bind" method="bothBind" />
- <callback type="unbind" method="bothUnbind" />
- </requires>
- <provides />
- </component>
-
- <!-- Static Simple & Optional Dependencies -->
- <component
- className="org.apache.felix.ipojo.test.scenarios.component.CheckServiceProvider"
- factory="StaticSimpleOptionalCheckServiceProvider"
- architecture="true">
- <requires field="fs" optional="true" policy="static" />
- <provides />
- </component>
- <component
- className="org.apache.felix.ipojo.test.scenarios.component.CheckServiceProvider"
- factory="StaticVoidOptionalCheckServiceProvider"
- architecture="true">
- <requires field="fs" optional="true" policy="static">
- <callback type="bind" method="voidBind" />
- <callback type="unbind" method="voidUnbind" />
- </requires>
- <provides />
- </component>
- <component
- className="org.apache.felix.ipojo.test.scenarios.component.CheckServiceProvider"
- factory="StaticObjectOptionalCheckServiceProvider"
- architecture="true">
- <requires field="fs" optional="true" policy="static">
- <callback type="bind" method="objectBind" />
- <callback type="unbind" method="objectUnbind" />
- </requires>
- <provides />
- </component>
- <component
- className="org.apache.felix.ipojo.test.scenarios.component.CheckServiceProvider"
- factory="StaticRefOptionalCheckServiceProvider" architecture="true">
- <requires field="fs" optional="true" policy="static">
- <callback type="bind" method="refBind" />
- <callback type="unbind" method="refUnbind" />
- </requires>
- <provides />
- </component>
- <component
- className="org.apache.felix.ipojo.test.scenarios.component.CheckServiceProvider"
- factory="StaticBothOptionalCheckServiceProvider"
- architecture="true">
- <requires field="fs" optional="true" policy="static">
- <callback type="bind" method="bothBind" />
- <callback type="unbind" method="bothUnbind" />
- </requires>
- <provides />
- </component>
- <component
- className="org.apache.felix.ipojo.test.scenarios.component.MethodCheckServiceProvider"
- factory="StaticMObjectOptionalCheckServiceProvider"
- architecture="true">
- <requires optional="true" policy="static">
- <callback type="bind" method="objectBind" />
- <callback type="unbind" method="objectUnbind" />
- </requires>
- <provides />
- </component>
- <component
- className="org.apache.felix.ipojo.test.scenarios.component.MethodCheckServiceProvider"
- factory="StaticMRefOptionalCheckServiceProvider"
- architecture="true">
- <requires
- interface="org.apache.felix.ipojo.test.scenarios.service.dependency.service.FooService"
- optional="true" policy="static">
- <callback type="bind" method="refBind" />
- <callback type="unbind" method="refUnbind" />
- </requires>
- <provides />
- </component>
- <component
- className="org.apache.felix.ipojo.test.scenarios.component.MethodCheckServiceProvider"
- factory="StaticMBothOptionalCheckServiceProvider"
- architecture="true">
- <requires
- interface="org.apache.felix.ipojo.test.scenarios.service.dependency.service.FooService"
- optional="true" policy="static">
- <callback type="bind" method="bothBind" />
- <callback type="unbind" method="bothUnbind" />
- </requires>
- <provides />
- </component>
- <!-- Static Multiple Dependencies -->
- <component
- className="org.apache.felix.ipojo.test.scenarios.component.MultipleCheckService"
- factory="StaticSimpleMultipleCheckServiceProvider"
- architecture="true">
- <requires field="fs" policy="static" />
- <provides />
- </component>
- <component
- className="org.apache.felix.ipojo.test.scenarios.component.MultipleCheckService"
- factory="StaticVoidMultipleCheckServiceProvider"
- architecture="true">
- <requires field="fs" policy="static">
- <callback type="bind" method="voidBind" />
- <callback type="unbind" method="voidUnbind" />
- </requires>
- <provides />
- </component>
- <component
- className="org.apache.felix.ipojo.test.scenarios.component.MultipleCheckService"
- factory="StaticObjectMultipleCheckServiceProvider"
- architecture="true">
- <requires field="fs" policy="static">
- <callback type="bind" method="objectBind" />
- <callback type="unbind" method="objectUnbind" />
- </requires>
- <provides />
- </component>
- <component
- className="org.apache.felix.ipojo.test.scenarios.component.MultipleCheckService"
- factory="StaticRefMultipleCheckServiceProvider" architecture="true">
- <requires field="fs" policy="static">
- <callback type="bind" method="refBind" />
- <callback type="unbind" method="refUnbind" />
- </requires>
- <provides />
- </component>
- <component
- className="org.apache.felix.ipojo.test.scenarios.component.MultipleCheckService"
- factory="StaticBothMultipleCheckServiceProvider"
- architecture="true">
- <requires field="fs" policy="static">
- <callback type="bind" method="bothBind" />
- <callback type="unbind" method="bothUnbind" />
- </requires>
- <provides />
- </component>
- <component
- className="org.apache.felix.ipojo.test.scenarios.component.MethodMultipleCheckService"
- factory="StaticMObjectMultipleCheckServiceProvider"
- architecture="true">
- <requires aggregate="true" policy="static">
- <callback type="bind" method="objectBind" />
- <callback type="unbind" method="objectUnbind" />
- </requires>
- <provides />
- </component>
- <component
- className="org.apache.felix.ipojo.test.scenarios.component.MethodMultipleCheckService"
- factory="StaticMRefMultipleCheckServiceProvider"
- architecture="true">
- <requires
- interface="org.apache.felix.ipojo.test.scenarios.service.dependency.service.FooService"
- aggregate="true" policy="static">
- <callback type="bind" method="refBind" />
- <callback type="unbind" method="refUnbind" />
- </requires>
- <provides />
- </component>
- <component
- className="org.apache.felix.ipojo.test.scenarios.component.MethodMultipleCheckService"
- factory="StaticMBothMultipleCheckServiceProvider"
- architecture="true">
- <requires aggregate="true" policy="static">
- <callback type="bind" method="bothBind" />
- <callback type="unbind" method="bothUnbind" />
- </requires>
- <provides />
- </component>
- <!-- Simple Filter Dependencies -->
- <component
- className="org.apache.felix.ipojo.test.scenarios.component.FilterCheckProvider"
- factory="SimpleFilterCheckServiceProvider" architecture="true">
- <provides>
- <property field="m_toto" name="toto" value="A" />
- </provides>
- </component>
-
- <component
- className="org.apache.felix.ipojo.test.scenarios.component.FilterCheckSubscriber"
- factory="SimpleFilterCheckServiceSubscriber" architecture="true">
- <requires field="m_foo" filter="(toto=B)" id="id1">
- <callback type="bind" method="Bind" />
- <callback type="unbind" method="Unbind" />
- </requires>
- <provides />
- </component>
-
- <component
- className="org.apache.felix.ipojo.test.scenarios.component.FilterCheckSubscriber"
- factory="SimpleFilterCheckServiceSubscriber2" architecture="true">
- <requires field="m_foo" id="id2">
- <callback type="bind" method="Bind" />
- <callback type="unbind" method="Unbind" />
- </requires>
- <provides />
- </component>
-
- <!-- Optional Simple Filter Dependencies -->
- <component
- className="org.apache.felix.ipojo.test.scenarios.component.FilterCheckSubscriber"
- factory="OptionalSimpleFilterCheckServiceSubscriber"
- architecture="true">
- <requires field="m_foo" filter="(toto=B)" id="id1"
- optional="true">
- <callback type="bind" method="Bind" />
- <callback type="unbind" method="Unbind" />
- </requires>
- <provides />
- </component>
-
- <component
- className="org.apache.felix.ipojo.test.scenarios.component.FilterCheckSubscriber"
- factory="OptionalSimpleFilterCheckServiceSubscriber2"
- architecture="true">
- <requires field="m_foo" id="id2" optional="true">
- <callback type="bind" method="Bind" />
- <callback type="unbind" method="Unbind" />
- </requires>
- <provides />
- </component>
-
- <!-- Aggregate filter Dependencies-->
- <component
- className="org.apache.felix.ipojo.test.scenarios.component.MultipleFilterCheckSubscriber"
- factory="MultipleFilterCheckServiceSubscriber" architecture="true">
- <requires field="m_foo" filter="(toto=B)" id="id1">
- <callback type="bind" method="Bind" />
- <callback type="unbind" method="Unbind" />
- </requires>
- <provides />
- </component>
-
- <component
- className="org.apache.felix.ipojo.test.scenarios.component.MultipleFilterCheckSubscriber"
- factory="MultipleFilterCheckServiceSubscriber2" architecture="true">
- <requires field="m_foo" id="id2">
- <callback type="bind" method="Bind" />
- <callback type="unbind" method="Unbind" />
- </requires>
- <provides />
- </component>
-
- <!-- Optional Aggregate Filter Dependencies -->
- <component
- className="org.apache.felix.ipojo.test.scenarios.component.MultipleFilterCheckSubscriber"
- factory="OptionalMultipleFilterCheckServiceSubscriber"
- architecture="true">
- <requires field="m_foo" filter="(toto=B)" id="id1"
- optional="true">
- <callback type="bind" method="Bind" />
- <callback type="unbind" method="Unbind" />
- </requires>
- <provides />
- </component>
-
- <component
- className="org.apache.felix.ipojo.test.scenarios.component.MultipleFilterCheckSubscriber"
- factory="OptionalMultipleFilterCheckServiceSubscriber2"
- architecture="true">
- <requires field="m_foo" id="id2" optional="true">
- <callback type="bind" method="Bind" />
- <callback type="unbind" method="Unbind" />
- </requires>
- <provides />
- </component>
-
-
- <!-- Dynamic-Priority -->
- <component
- className="org.apache.felix.ipojo.test.scenarios.component.RankedFooProviderType1"
- factory="RankedFooProviderType" architecture="true">
- <provides>
- <property field="m_grade" name="service.ranking"/>
- </provides>
- </component>
- <component
- className="org.apache.felix.ipojo.test.scenarios.component.DynCheckServiceProvider"
- factory="DPSimpleCheckServiceProvider" architecture="true">
- <requires field="fs" policy="dynamic-priority" />
- <provides />
- </component>
- <component
- className="org.apache.felix.ipojo.test.scenarios.component.DynCheckServiceProvider"
- factory="DPObjectCheckServiceProvider" architecture="true">
- <requires field="fs" policy="dynamic-priority">
- <callback type="bind" method="objectBind" />
- <callback type="unbind" method="objectUnbind" />
- </requires>
- <provides />
- </component>
</ipojo>