Migrate some core tests to pax exam 3
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1445708 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/ipojo/runtime/core-it/pom.xml b/ipojo/runtime/core-it/pom.xml
new file mode 100644
index 0000000..d53e5e3
--- /dev/null
+++ b/ipojo/runtime/core-it/pom.xml
@@ -0,0 +1,285 @@
+<!--
+ 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 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://maven.apache.org/POM/4.0.0"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>felix-parent</artifactId>
+ <version>1.2.1</version>
+ <relativePath>../../../pom/pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>org.apache.felix.ipojo.runtime.core-it</artifactId>
+ <version>1.9.0-SNAPSHOT</version>
+ <name>Apache Felix iPOJO Runtime Project ~ Core Integration Tests</name>
+ <packaging>pom</packaging>
+
+ <build>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ </resource>
+ <resource>
+ <directory>.</directory>
+ <targetPath>META-INF</targetPath>
+ <includes>
+ <include>LICENSE*</include>
+ <include>NOTICE*</include>
+ <include>DEPENDENCIES*</include>
+ </includes>
+ </resource>
+ </resources>
+ </build>
+
+ <profiles>
+ <profile>
+ <id>release</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>make-assembly</id>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ <configuration>
+ <descriptorRefs>
+ <descriptorRef>project</descriptorRef>
+ </descriptorRefs>
+ <!-- we don't want to attach all the assemblies, such as bz2 -->
+ <attach>false</attach>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <!-- only attach the project and bin assemblies, in tar.gz and zip flavors -->
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-assemblies</id>
+ <phase>package</phase>
+ <goals>
+ <goal>attach-artifact</goal>
+ </goals>
+ <configuration>
+ <artifacts>
+ <artifact>
+ <file>
+ ${project.build.directory}/${project.artifactId}-${project.version}-project.tar.gz
+ </file>
+ <classifier>project</classifier>
+ <type>tar.gz</type>
+ </artifact>
+ <artifact>
+ <file>
+ ${project.build.directory}/${project.artifactId}-${project.version}-project.zip
+ </file>
+ <classifier>project</classifier>
+ <type>zip</type>
+ </artifact>
+ </artifacts>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
+ <profile>
+ <id>knopflerfish</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ <property>
+ <name>pax.exam.framework</name>
+ <value>knopflerfish</value>
+ </property>
+ </activation>
+ <properties>
+ <pax.exam.framework>knopflerfish</pax.exam.framework>
+ </properties>
+ <repositories>
+ <repository>
+ <id>knopflerfish-releases</id>
+ <url>http://www.knopflerfish.org/maven2</url>
+ </repository>
+ </repositories>
+ <dependencies>
+ <dependency>
+ <groupId>org.knopflerfish</groupId>
+ <artifactId>framework</artifactId>
+ <version>5.2.0</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </profile>
+
+ <profile>
+ <id>equinox</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ <property>
+ <name>pax.exam.framework</name>
+ <value>equinox</value>
+ </property>
+ </activation>
+ <properties>
+ <pax.exam.framework>equinox</pax.exam.framework>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>org.eclipse.osgi</artifactId>
+ <version>3.8.1.v20120830-144521</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </profile>
+
+ <profile>
+ <id>felix</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ <property>
+ <name>pax.exam.framework</name>
+ <value>felix</value>
+ </property>
+ </activation>
+ <properties>
+ <pax.exam.framework>felix</pax.exam.framework>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.framework</artifactId>
+ <version>4.2.0</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </profile>
+
+ <profile>
+ <id>test</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-invoker-plugin</artifactId>
+ <version>1.8</version>
+ <configuration>
+ <streamLogs>true</streamLogs>
+ <goals>
+ <goal>clean</goal>
+ <goal>test</goal>
+ </goals>
+ <cloneClean>true</cloneClean>
+ </configuration>
+ <executions>
+ <execution>
+ <id>regular</id>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <profiles>
+ <profile>felix</profile>
+ </profiles>
+ <cloneProjectsTo>${project.build.directory}/regular</cloneProjectsTo>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
+ <profile>
+ <id>test-all</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-invoker-plugin</artifactId>
+ <version>1.8</version>
+ <configuration>
+ <streamLogs>true</streamLogs>
+ <goals>
+ <goal>clean</goal>
+ <goal>test</goal>
+ </goals>
+ <cloneClean>true</cloneClean>
+ </configuration>
+ <executions>
+ <execution>
+ <id>equinox-native</id>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <profiles>
+ <profile>equinox</profile>
+ </profiles>
+ <cloneProjectsTo>${project.build.directory}/equinox-native</cloneProjectsTo>
+
+ </configuration>
+ </execution>
+ <execution>
+ <id>felix-native</id>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <profiles>
+ <profile>felix</profile>
+ </profiles>
+ <cloneProjectsTo>${project.build.directory}/felix-native</cloneProjectsTo>
+ </configuration>
+ </execution>
+ <execution>
+ <id>knopflerfish-native</id>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <profiles>
+ <profile>knopflerfish</profile>
+ </profiles>
+ <cloneProjectsTo>${project.build.directory}/knopflerfish-native</cloneProjectsTo>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+</project>
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/ipojo-core-annotations-test.iml b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/ipojo-core-annotations-test.iml
new file mode 100644
index 0000000..738d4c6
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/ipojo-core-annotations-test.iml
@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
+ <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_6" inherit-compiler-output="false">
+ <output url="file://$MODULE_DIR$/target/classes" />
+ <output-test url="file://$MODULE_DIR$/target/test-classes" />
+ <content url="file://$MODULE_DIR$">
+ <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
+ <excludeFolder url="file://$MODULE_DIR$/target" />
+ </content>
+ <orderEntry type="inheritedJdk" />
+ <orderEntry type="sourceFolder" forTests="false" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.ops4j.pax.exam:pax-exam-container-native:3.0.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.ops4j.pax.exam:pax-exam:3.0.0" level="project" />
+ <orderEntry type="library" name="Maven: org.ops4j.base:ops4j-base-lang:1.4.0" level="project" />
+ <orderEntry type="library" name="Maven: org.ops4j.base:ops4j-base-store:1.2.3" level="project" />
+ <orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.5.11" level="project" />
+ <orderEntry type="library" name="Maven: org.ops4j.base:ops4j-base-io:1.2.3" level="project" />
+ <orderEntry type="library" name="Maven: org.ops4j.base:ops4j-base-monitors:1.4.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.ops4j.base:ops4j-base-util-property:1.4.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.ops4j.pax.exam:pax-exam-spi:3.0.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.ops4j.base:ops4j-base-spi:1.4.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: com.google.guava:guava:12.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: com.google.code.findbugs:jsr305:1.3.9" level="project" />
+ <orderEntry type="library" name="Maven: org.ops4j.pax.tinybundles:tinybundles:1.0.0" level="project" />
+ <orderEntry type="library" name="Maven: biz.aQute:bndlib:1.43.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.glassfish.main.common:scattered-archive-api:3.1.2.2" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.ops4j.pax.swissbox:pax-swissbox-core:1.6.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.ops4j.pax.swissbox:pax-swissbox-lifecycle:1.6.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.ops4j.pax.swissbox:pax-swissbox-tracker:1.6.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.ops4j.base:ops4j-base-net:1.4.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.ops4j.pax.url:pax-url-link:1.5.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.ops4j.pax.url:pax-url-commons:1.5.1" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.ops4j.pax.swissbox:pax-swissbox-property:1.5.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.ops4j.pax.url:pax-url-classpath:1.5.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.ops4j.pax.swissbox:pax-swissbox-optional-jcl:1.5.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.ops4j.pax.exam:pax-exam-junit4:3.0.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.9" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.1" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.ops4j.pax.exam:pax-exam-link-mvn:3.0.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.ops4j.pax.url:pax-url-aether:1.5.1" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.ops4j.pax.url:pax-url-maven-commons:1.5.1" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.ops4j.base:ops4j-base-util-xml:1.3.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.ops4j.base:ops4j-base-util-collections:1.3.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.sonatype.aether:aether-api:1.13.1" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.sonatype.aether:aether-spi:1.13.1" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.sonatype.aether:aether-util:1.13.1" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.sonatype.aether:aether-impl:1.13.1" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.sonatype.aether:aether-connector-wagon:1.13.1" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.apache.maven.wagon:wagon-provider-api:1.0-beta-7" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.codehaus.plexus:plexus-utils:3.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.codehaus.plexus:plexus-classworlds:2.4" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.sonatype.sisu:sisu-inject-plexus:2.2.3" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.codehaus.plexus:plexus-component-annotations:1.5.5" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.sonatype.sisu:sisu-inject-bean:2.2.3" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.sonatype.sisu:sisu-guice:no_aop:3.0.3" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.apache.maven:maven-aether-provider:3.0.4" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.apache.maven:maven-model:3.0.4" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.apache.maven:maven-model-builder:3.0.4" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.codehaus.plexus:plexus-interpolation:1.14" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.apache.maven:maven-repository-metadata:3.0.4" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.apache.maven.wagon:wagon-file:1.0-beta-7" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.apache.maven.wagon:wagon-http-lightweight:1.0-beta-7" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.apache.maven.wagon:wagon-http-shared:1.0-beta-7" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.codehaus.plexus:plexus-container-default:1.5.5" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.apache.xbean:xbean-reflect:3.4" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: com.google.collections:google-collections:1.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: commons-httpclient:commons-httpclient:3.1" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: commons-codec:commons-codec:1.2" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: commons-logging:commons-logging:1.0.4" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.apache.felix:org.apache.felix.framework:4.2.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: ch.qos.logback:logback-core:0.9.6" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: ch.qos.logback:logback-classic:0.9.6" level="project" />
+ <orderEntry type="library" name="Maven: org.apache.felix:org.apache.felix.ipojo:1.9.0-SNAPSHOT" level="project" />
+ <orderEntry type="library" name="Maven: org.osgi:org.osgi.core:4.3.1" level="project" />
+ <orderEntry type="library" name="Maven: org.osgi:org.osgi.compendium:4.0.0" level="project" />
+ <orderEntry type="library" name="Maven: org.apache.felix:org.apache.felix.ipojo.metadata:1.6.0" level="project" />
+ <orderEntry type="library" name="Maven: org.apache.felix:org.apache.felix.ipojo.manipulator:1.9.0-SNAPSHOT" level="project" />
+ <orderEntry type="library" name="Maven: asm:asm-all:3.3.1" level="project" />
+ <orderEntry type="library" name="Maven: org.apache.felix:org.apache.felix.ipojo.annotations:1.8.0" level="project" />
+ <orderEntry type="library" name="Maven: commons-io:commons-io:2.4" level="project" />
+ <orderEntry type="module" module-name="osgi-helpers" scope="TEST" />
+ <orderEntry type="module" module-name="tinybundles-ipojo" />
+ <orderEntry type="library" name="Maven: xerces:xercesImpl:2.4.0" level="project" />
+ <orderEntry type="library" name="Maven: org.apache.felix:org.apache.felix.ipojo.handler.eventadmin:1.8.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.easymock:easymock:2.4" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.mockito:mockito-all:1.7" level="project" />
+ </component>
+</module>
+
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/pom.xml b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/pom.xml
new file mode 100644
index 0000000..17a5e25
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/pom.xml
@@ -0,0 +1,159 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <parent>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.ipojo.runtime.core-it</artifactId>
+ <version>1.9.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.apache.felix</groupId>
+ <artifactId>ipojo-core-annotations-test</artifactId>
+ <version>1.0-SNAPSHOT</version>
+
+ <name>${project.artifactId}</name>
+
+ <properties>
+ <exam.version>3.0.0</exam.version>
+ <url.version>1.5.1</url.version>
+ </properties>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.ops4j.pax.exam</groupId>
+ <artifactId>pax-exam-container-native</artifactId>
+ <version>${exam.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.ops4j.pax.exam</groupId>
+ <artifactId>pax-exam-junit4</artifactId>
+ <version>${exam.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.ops4j.pax.exam</groupId>
+ <artifactId>pax-exam-link-mvn</artifactId>
+ <version>${exam.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.ops4j.pax.url</groupId>
+ <artifactId>pax-url-aether</artifactId>
+ <version>${url.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.framework</artifactId>
+ <version>4.2.0</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-core</artifactId>
+ <version>0.9.6</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-classic</artifactId>
+ <version>0.9.6</version>
+ <scope>test</scope>
+ </dependency>
+
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.9</version>
+ <scope>test</scope>
+ </dependency>
+
+
+ <dependency>
+ <groupId>org.ops4j.pax.tinybundles</groupId>
+ <artifactId>tinybundles</artifactId>
+ <version>1.0.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.ipojo</artifactId>
+ <version>1.9.0-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.ipojo.manipulator</artifactId>
+ <version>1.9.0-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>2.4</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.ow2.chameleon.testing</groupId>
+ <artifactId>osgi-helpers</artifactId>
+ <version>0.5.0-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.ow2.chameleon.testing</groupId>
+ <artifactId>tinybundles-ipojo</artifactId>
+ <version>0.3.0-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.ipojo.handler.eventadmin</artifactId>
+ <version>1.8.0</version>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.5.1</version>
+ <configuration>
+ <source>1.6</source>
+ <target>1.6</target>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.servicemix.tooling</groupId>
+ <artifactId>depends-maven-plugin</artifactId>
+ <version>1.2</version>
+ <executions>
+ <execution>
+ <id>generate-config</id>
+ <goals>
+ <goal>generate-depends-file</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
\ No newline at end of file
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/foo/Foo.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/foo/Foo.java
new file mode 100644
index 0000000..aa8d383
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/foo/Foo.java
@@ -0,0 +1,10 @@
+package foo;
+
+
+/**
+ * Creates a simple annotation to create the processing of non-matching
+ * annotations
+ */
+public @interface Foo {
+ String bar();
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/foo/RGB.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/foo/RGB.java
new file mode 100644
index 0000000..ec43bc7
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/foo/RGB.java
@@ -0,0 +1,9 @@
+package foo;
+
+/**
+ * Checks the enum support in custom handler.
+ */
+public enum RGB {
+
+ RED, GREEN, BLUE
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/foo/ipojo/IPOJOFoo.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/foo/ipojo/IPOJOFoo.java
new file mode 100644
index 0000000..553ae17
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/foo/ipojo/IPOJOFoo.java
@@ -0,0 +1,16 @@
+package foo.ipojo;
+
+
+import foo.RGB;
+
+/**
+ * Creates a simple annotation to create the processing of matching
+ * annotations
+ */
+public @interface IPOJOFoo {
+ String bar();
+
+ RGB rgb() default RGB.BLUE;
+
+ RGB[] colors() default {};
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/AggregateDependency.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/AggregateDependency.java
new file mode 100644
index 0000000..72389a3
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/AggregateDependency.java
@@ -0,0 +1,25 @@
+package org.apache.felix.ipojo.runtime.core.test.components;
+
+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/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/Arch.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/Arch.java
new file mode 100644
index 0000000..ae7c3ef
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/Arch.java
@@ -0,0 +1,7 @@
+package org.apache.felix.ipojo.runtime.core.test.components;
+
+import org.apache.felix.ipojo.annotations.Component;
+
+@Component(architecture=true)
+public class Arch {
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/ComponentTypeVersion.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/ComponentTypeVersion.java
new file mode 100644
index 0000000..713489a
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/ComponentTypeVersion.java
@@ -0,0 +1,9 @@
+package org.apache.felix.ipojo.runtime.core.test.components;
+
+import org.apache.felix.ipojo.annotations.Component;
+
+
+@Component(version="1.0.0")
+public class ComponentTypeVersion {
+
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/CustomAnnotationWithEnum.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/CustomAnnotationWithEnum.java
new file mode 100644
index 0000000..e85d197
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/CustomAnnotationWithEnum.java
@@ -0,0 +1,11 @@
+package org.apache.felix.ipojo.runtime.core.test.components;
+
+import foo.RGB;
+import foo.ipojo.IPOJOFoo;
+import org.apache.felix.ipojo.annotations.Component;
+
+@Component
+@IPOJOFoo(bar="bar", rgb = RGB.RED, colors = {RGB.BLUE, RGB.RED})
+public class CustomAnnotationWithEnum {
+
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/DefaultImplementationDependency.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/DefaultImplementationDependency.java
new file mode 100644
index 0000000..e67be77
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/DefaultImplementationDependency.java
@@ -0,0 +1,13 @@
+package org.apache.felix.ipojo.runtime.core.test.components;
+
+import org.apache.felix.ipojo.annotations.Component;
+import org.apache.felix.ipojo.annotations.Requires;
+import org.apache.felix.ipojo.runtime.core.test.services.FooService;
+import org.apache.felix.ipojo.runtime.core.test.services.FooService;
+
+@Component
+public class DefaultImplementationDependency {
+
+ @Requires(defaultimplementation=ProvidesSimple.class, optional=true)
+ public FooService fs;
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/Dependency.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/Dependency.java
new file mode 100644
index 0000000..1a59683
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/Dependency.java
@@ -0,0 +1,84 @@
+package org.apache.felix.ipojo.runtime.core.test.components;
+
+import org.apache.felix.ipojo.annotations.Bind;
+import org.apache.felix.ipojo.annotations.Component;
+import org.apache.felix.ipojo.annotations.Modified;
+import org.apache.felix.ipojo.annotations.Requires;
+import org.apache.felix.ipojo.annotations.Unbind;
+import org.apache.felix.ipojo.runtime.core.test.services.FooService;
+import org.apache.felix.ipojo.runtime.core.test.services.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() {
+
+ }
+
+ @Bind(id="mod")
+ public void bindMod() {
+
+ }
+
+ @Unbind(id="mod")
+ public void unbindMod() {
+
+ }
+
+ @Modified(id="mod")
+ public void modifiedMod() {
+
+ }
+
+
+ @Requires(proxy=false, id="notproxied")
+ FooService myFoo;
+
+
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/Factory.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/Factory.java
new file mode 100644
index 0000000..6f850d7
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/Factory.java
@@ -0,0 +1,7 @@
+package org.apache.felix.ipojo.runtime.core.test.components;
+
+import org.apache.felix.ipojo.annotations.Component;
+
+@Component(name="factory", publicFactory=true)
+public class Factory {
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/FactoryDeprecated.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/FactoryDeprecated.java
new file mode 100644
index 0000000..c2a04cc
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/FactoryDeprecated.java
@@ -0,0 +1,7 @@
+package org.apache.felix.ipojo.runtime.core.test.components;
+
+import org.apache.felix.ipojo.annotations.Component;
+
+@Component(public_factory=true)
+public class FactoryDeprecated {
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/FactoryMethod.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/FactoryMethod.java
new file mode 100644
index 0000000..e9fafa9
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/FactoryMethod.java
@@ -0,0 +1,11 @@
+package org.apache.felix.ipojo.runtime.core.test.components;
+
+import org.apache.felix.ipojo.annotations.Component;
+
+@Component(factoryMethod="create")
+public class FactoryMethod {
+
+ public static FactoryMethod create() {
+ return new FactoryMethod();
+ }
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/FactoryMethodDeprecated.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/FactoryMethodDeprecated.java
new file mode 100644
index 0000000..ff94f2e
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/FactoryMethodDeprecated.java
@@ -0,0 +1,11 @@
+package org.apache.felix.ipojo.runtime.core.test.components;
+
+import org.apache.felix.ipojo.annotations.Component;
+
+@Component(factory_method="create")
+public class FactoryMethodDeprecated {
+
+ public static FactoryMethodDeprecated create() {
+ return new FactoryMethodDeprecated();
+ }
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/FilteredDependency.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/FilteredDependency.java
new file mode 100644
index 0000000..f5b251f
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/FilteredDependency.java
@@ -0,0 +1,37 @@
+package org.apache.felix.ipojo.runtime.core.test.components;
+
+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.runtime.core.test.services.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/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/FromDependency.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/FromDependency.java
new file mode 100644
index 0000000..0ce27ac
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/FromDependency.java
@@ -0,0 +1,64 @@
+package org.apache.felix.ipojo.runtime.core.test.components;
+
+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.runtime.core.test.services.FooService;
+
+@Component
+public class FromDependency {
+
+ @Requires(from="X")
+ public FooService fs;
+
+ @Unbind
+ public void unbindBar() {
+
+ }
+
+ @Bind
+ public void bindBar() {
+
+ }
+
+ @Unbind(from="both")
+ public void unbindBaz() {
+
+ }
+
+ @Bind(from="both")
+ public void bindBaz() {
+
+ }
+
+
+ @Requires
+ public FooService fs2;
+
+ @Bind(id="fs2", from="X")
+ public void bindFS2() {
+
+ }
+
+ @Unbind(id="fs2")
+ public void unbindFS2() {
+
+ }
+
+ @Requires(id="inv")
+ public FooService fs2inv;
+
+ @Bind(id="inv")
+ public void bindFS2Inv() {
+
+ }
+
+ @Unbind(id="inv", from="X")
+ public void unbindFS2Inv() {
+
+ }
+
+
+
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/Immediate.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/Immediate.java
new file mode 100644
index 0000000..e8fcfc0
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/Immediate.java
@@ -0,0 +1,7 @@
+package org.apache.felix.ipojo.runtime.core.test.components;
+
+import org.apache.felix.ipojo.annotations.Component;
+
+@Component(immediate=true)
+public class Immediate {
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/InstantiateSimple.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/InstantiateSimple.java
new file mode 100644
index 0000000..676b2ec
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/InstantiateSimple.java
@@ -0,0 +1,11 @@
+package org.apache.felix.ipojo.runtime.core.test.components;
+
+import org.apache.felix.ipojo.annotations.Component;
+import org.apache.felix.ipojo.annotations.Instantiate;
+
+
+@Instantiate
+@Component
+public class InstantiateSimple {
+
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/InstantiateWithName.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/InstantiateWithName.java
new file mode 100644
index 0000000..e05f2d1
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/InstantiateWithName.java
@@ -0,0 +1,11 @@
+package org.apache.felix.ipojo.runtime.core.test.components;
+
+import org.apache.felix.ipojo.annotations.Component;
+import org.apache.felix.ipojo.annotations.Instantiate;
+
+
+@Instantiate(name="myInstantiatedInstance")
+@Component
+public class InstantiateWithName {
+
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/Lifecycle.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/Lifecycle.java
new file mode 100644
index 0000000..81e3244
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/Lifecycle.java
@@ -0,0 +1,22 @@
+package org.apache.felix.ipojo.runtime.core.test.components;
+
+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/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/ManagedServicePID.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/ManagedServicePID.java
new file mode 100644
index 0000000..6253316
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/ManagedServicePID.java
@@ -0,0 +1,74 @@
+package org.apache.felix.ipojo.runtime.core.test.components;
+
+import org.apache.felix.ipojo.annotations.Component;
+import org.apache.felix.ipojo.annotations.Property;
+import org.apache.felix.ipojo.runtime.core.test.services.BarService;
+import org.apache.felix.ipojo.runtime.core.test.services.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/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/MyComparator.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/MyComparator.java
new file mode 100644
index 0000000..83aea2f
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/MyComparator.java
@@ -0,0 +1,11 @@
+package org.apache.felix.ipojo.runtime.core.test.components;
+
+import java.util.Comparator;
+
+public class MyComparator implements Comparator {
+
+ public int compare(Object o1, Object o2) {
+ return 0;
+ }
+
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/NoAnnotation.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/NoAnnotation.java
new file mode 100644
index 0000000..5c1ea40
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/NoAnnotation.java
@@ -0,0 +1,5 @@
+package org.apache.felix.ipojo.runtime.core.test.components;
+
+public class NoAnnotation {
+
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/NoArch.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/NoArch.java
new file mode 100644
index 0000000..4f5bead
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/NoArch.java
@@ -0,0 +1,7 @@
+package org.apache.felix.ipojo.runtime.core.test.components;
+
+import org.apache.felix.ipojo.annotations.Component;
+
+@Component(architecture=false)
+public class NoArch {
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/NoFactory.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/NoFactory.java
new file mode 100644
index 0000000..feb1b94
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/NoFactory.java
@@ -0,0 +1,7 @@
+package org.apache.felix.ipojo.runtime.core.test.components;
+
+import org.apache.felix.ipojo.annotations.Component;
+
+@Component(name="nofactory", public_factory=false)
+public class NoFactory {
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/NoImmediate.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/NoImmediate.java
new file mode 100644
index 0000000..eff554a
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/NoImmediate.java
@@ -0,0 +1,7 @@
+package org.apache.felix.ipojo.runtime.core.test.components;
+
+import org.apache.felix.ipojo.annotations.Component;
+
+@Component(immediate=false)
+public class NoImmediate {
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/NoPropagation.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/NoPropagation.java
new file mode 100644
index 0000000..a99e979
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/NoPropagation.java
@@ -0,0 +1,74 @@
+package org.apache.felix.ipojo.runtime.core.test.components;
+
+import org.apache.felix.ipojo.annotations.Component;
+import org.apache.felix.ipojo.annotations.Property;
+import org.apache.felix.ipojo.runtime.core.test.services.BarService;
+import org.apache.felix.ipojo.runtime.core.test.services.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/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/NullableDependency.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/NullableDependency.java
new file mode 100644
index 0000000..4e3d860
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/NullableDependency.java
@@ -0,0 +1,17 @@
+package org.apache.felix.ipojo.runtime.core.test.components;
+
+import org.apache.felix.ipojo.annotations.Component;
+import org.apache.felix.ipojo.annotations.Requires;
+import org.apache.felix.ipojo.runtime.core.test.services.FooService;
+
+@Component
+public class NullableDependency {
+
+ @Requires(nullable=true)
+ public FooService fs;
+
+ @Requires(nullable=false)
+ public FooService fs2;
+
+
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/OnlyFoo.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/OnlyFoo.java
new file mode 100644
index 0000000..1ec34e2
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/OnlyFoo.java
@@ -0,0 +1,8 @@
+package org.apache.felix.ipojo.runtime.core.test.components;
+
+import foo.Foo;
+
+@Foo(bar="bar")
+public class OnlyFoo {
+
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/OnlyiPOJOFoo.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/OnlyiPOJOFoo.java
new file mode 100644
index 0000000..e8a1294
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/OnlyiPOJOFoo.java
@@ -0,0 +1,8 @@
+package org.apache.felix.ipojo.runtime.core.test.components;
+
+import foo.ipojo.IPOJOFoo;
+
+@IPOJOFoo(bar="bar")
+public class OnlyiPOJOFoo {
+
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/OptionalDependency.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/OptionalDependency.java
new file mode 100644
index 0000000..dd505b0
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/OptionalDependency.java
@@ -0,0 +1,41 @@
+package org.apache.felix.ipojo.runtime.core.test.components;
+
+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.runtime.core.test.services.FooService;
+import org.apache.felix.ipojo.runtime.core.test.services.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/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/PIDandPropagation.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/PIDandPropagation.java
new file mode 100644
index 0000000..ec3cc9b
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/PIDandPropagation.java
@@ -0,0 +1,75 @@
+package org.apache.felix.ipojo.runtime.core.test.components;
+
+import org.apache.felix.ipojo.annotations.Component;
+import org.apache.felix.ipojo.annotations.Property;
+import org.apache.felix.ipojo.runtime.core.test.services.FooService;
+import org.apache.felix.ipojo.runtime.core.test.services.BarService;
+import org.apache.felix.ipojo.runtime.core.test.services.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/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/PSServiceController.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/PSServiceController.java
new file mode 100644
index 0000000..2fad434
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/PSServiceController.java
@@ -0,0 +1,56 @@
+package org.apache.felix.ipojo.runtime.core.test.components;
+
+import java.util.Properties;
+
+import org.apache.felix.ipojo.annotations.Component;
+import org.apache.felix.ipojo.annotations.Provides;
+import org.apache.felix.ipojo.annotations.ServiceController;
+import org.apache.felix.ipojo.runtime.core.test.services.BarService;
+import org.apache.felix.ipojo.runtime.core.test.services.FooService;
+import org.apache.felix.ipojo.runtime.core.test.services.BarService;
+import org.apache.felix.ipojo.runtime.core.test.services.FooService;
+
+@Component
+@Provides(specifications= {FooService.class, BarService.class})
+public class PSServiceController implements FooService, BarService {
+
+ @ServiceController(value=false)
+ public boolean controller;
+
+ 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/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/PSServiceControllerSpec.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/PSServiceControllerSpec.java
new file mode 100644
index 0000000..18ec716
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/PSServiceControllerSpec.java
@@ -0,0 +1,59 @@
+package org.apache.felix.ipojo.runtime.core.test.components;
+
+import java.util.Properties;
+
+import org.apache.felix.ipojo.annotations.Component;
+import org.apache.felix.ipojo.annotations.Provides;
+import org.apache.felix.ipojo.annotations.ServiceController;
+import org.apache.felix.ipojo.runtime.core.test.services.BarService;
+import org.apache.felix.ipojo.runtime.core.test.services.FooService;
+import org.apache.felix.ipojo.runtime.core.test.services.BarService;
+import org.apache.felix.ipojo.runtime.core.test.services.FooService;
+
+@Component
+@Provides(specifications= {FooService.class, BarService.class})
+public class PSServiceControllerSpec implements FooService, BarService {
+
+ @ServiceController(value=false, specification=FooService.class)
+ public boolean controller1;
+
+ @ServiceController(value=true)
+ public boolean controller2;
+
+ 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/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/PolicyDependency.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/PolicyDependency.java
new file mode 100644
index 0000000..a1686b4
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/PolicyDependency.java
@@ -0,0 +1,40 @@
+package org.apache.felix.ipojo.runtime.core.test.components;
+
+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.runtime.core.test.services.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/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/Propagation.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/Propagation.java
new file mode 100644
index 0000000..c5fd572
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/Propagation.java
@@ -0,0 +1,75 @@
+package org.apache.felix.ipojo.runtime.core.test.components;
+
+import org.apache.felix.ipojo.annotations.Component;
+import org.apache.felix.ipojo.annotations.Property;
+import org.apache.felix.ipojo.runtime.core.test.services.FooService;
+import org.apache.felix.ipojo.runtime.core.test.services.BarService;
+import org.apache.felix.ipojo.runtime.core.test.services.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/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/PropagationandPID.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/PropagationandPID.java
new file mode 100644
index 0000000..3f13a67
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/PropagationandPID.java
@@ -0,0 +1,75 @@
+package org.apache.felix.ipojo.runtime.core.test.components;
+
+import org.apache.felix.ipojo.annotations.Component;
+import org.apache.felix.ipojo.annotations.Property;
+import org.apache.felix.ipojo.runtime.core.test.services.BarService;
+import org.apache.felix.ipojo.runtime.core.test.services.FooService;
+import org.apache.felix.ipojo.runtime.core.test.services.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/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/Properties.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/Properties.java
new file mode 100644
index 0000000..c08ca5a
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/Properties.java
@@ -0,0 +1,74 @@
+package org.apache.felix.ipojo.runtime.core.test.components;
+
+import org.apache.felix.ipojo.annotations.Component;
+import org.apache.felix.ipojo.annotations.Property;
+import org.apache.felix.ipojo.runtime.core.test.services.BarService;
+import org.apache.felix.ipojo.runtime.core.test.services.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", mandatory=true)
+ 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/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/ProvidesDouble.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/ProvidesDouble.java
new file mode 100644
index 0000000..58d7293
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/ProvidesDouble.java
@@ -0,0 +1,42 @@
+package org.apache.felix.ipojo.runtime.core.test.components;
+
+import java.util.Properties;
+
+import org.apache.felix.ipojo.annotations.Component;
+import org.apache.felix.ipojo.annotations.Provides;
+import org.apache.felix.ipojo.runtime.core.test.services.FooService;
+import org.apache.felix.ipojo.runtime.core.test.services.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/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/ProvidesProperties.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/ProvidesProperties.java
new file mode 100644
index 0000000..fac9e41
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/ProvidesProperties.java
@@ -0,0 +1,67 @@
+package org.apache.felix.ipojo.runtime.core.test.components;
+
+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.runtime.core.test.services.BarService;
+import org.apache.felix.ipojo.runtime.core.test.services.BarService;
+import org.apache.felix.ipojo.runtime.core.test.services.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", mandatory=true)
+ public int bar;
+
+ @ServiceProperty(name="baz")
+ int m_baz;
+
+ @ServiceProperty
+ public int boo;
+
+ @ServiceProperty(name="baa", value="5")
+ public int m_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/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/ProvidesQuatro.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/ProvidesQuatro.java
new file mode 100644
index 0000000..93f66b6
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/ProvidesQuatro.java
@@ -0,0 +1,58 @@
+package org.apache.felix.ipojo.runtime.core.test.components;
+
+import java.util.Properties;
+
+import org.apache.felix.ipojo.annotations.Component;
+import org.apache.felix.ipojo.annotations.Provides;
+import org.apache.felix.ipojo.runtime.core.test.services.BarService;
+import org.apache.felix.ipojo.runtime.core.test.services.CheckService;
+import org.apache.felix.ipojo.runtime.core.test.services.FooService;
+import org.apache.felix.ipojo.runtime.core.test.services.BarService;
+import org.apache.felix.ipojo.runtime.core.test.services.CheckService;
+import org.apache.felix.ipojo.runtime.core.test.services.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/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/ProvidesSimple.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/ProvidesSimple.java
new file mode 100644
index 0000000..31198cb
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/ProvidesSimple.java
@@ -0,0 +1,51 @@
+package org.apache.felix.ipojo.runtime.core.test.components;
+
+import java.util.Properties;
+
+import org.apache.felix.ipojo.annotations.Component;
+import org.apache.felix.ipojo.annotations.Provides;
+import org.apache.felix.ipojo.runtime.core.test.services.FooService;
+import org.apache.felix.ipojo.runtime.core.test.services.BarService;
+import org.apache.felix.ipojo.runtime.core.test.services.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/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/ProvidesStaticProperties.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/ProvidesStaticProperties.java
new file mode 100644
index 0000000..b84ab05
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/ProvidesStaticProperties.java
@@ -0,0 +1,75 @@
+package org.apache.felix.ipojo.runtime.core.test.components;
+
+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.annotations.StaticServiceProperty;
+import org.apache.felix.ipojo.runtime.core.test.services.BarService;
+import org.apache.felix.ipojo.runtime.core.test.services.BarService;
+import org.apache.felix.ipojo.runtime.core.test.services.FooService;
+
+@Component
+@Provides(
+ specifications= {FooService.class, BarService.class},
+ properties= {
+ @StaticServiceProperty(name="prop1", value="prop1", type="java.lang.String"),
+ @StaticServiceProperty(name="prop2", type="java.lang.String"),
+ @StaticServiceProperty(name="props", value="{prop1, prop2}", type="string[]"),
+ @StaticServiceProperty(name="mandatory1", mandatory=true, type="string")
+ })
+public class ProvidesStaticProperties implements FooService, BarService {
+
+ @ServiceProperty(name = "foo")
+ public int m_foo = 0;
+
+ @ServiceProperty(value = "4", mandatory=true)
+ public int bar;
+
+ @ServiceProperty(name="baz")
+ int m_baz;
+
+ @ServiceProperty
+ public int boo;
+
+ @ServiceProperty(name="baa", value="5")
+ public int m_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/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/ProvidesTriple.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/ProvidesTriple.java
new file mode 100644
index 0000000..430f89a
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/ProvidesTriple.java
@@ -0,0 +1,57 @@
+package org.apache.felix.ipojo.runtime.core.test.components;
+
+import java.util.Properties;
+
+import org.apache.felix.ipojo.annotations.Component;
+import org.apache.felix.ipojo.annotations.Provides;
+import org.apache.felix.ipojo.runtime.core.test.services.BarService;
+import org.apache.felix.ipojo.runtime.core.test.services.CheckService;
+import org.apache.felix.ipojo.runtime.core.test.services.BarService;
+import org.apache.felix.ipojo.runtime.core.test.services.CheckService;
+import org.apache.felix.ipojo.runtime.core.test.services.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/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/RankedDependency.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/RankedDependency.java
new file mode 100644
index 0000000..6e1bb7d
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/RankedDependency.java
@@ -0,0 +1,50 @@
+package org.apache.felix.ipojo.runtime.core.test.components;
+
+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.runtime.core.test.services.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/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/UpdatedWithManagedService.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/UpdatedWithManagedService.java
new file mode 100644
index 0000000..b2aff5e
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/UpdatedWithManagedService.java
@@ -0,0 +1,83 @@
+package org.apache.felix.ipojo.runtime.core.test.components;
+
+import java.util.Dictionary;
+
+import org.apache.felix.ipojo.annotations.Component;
+import org.apache.felix.ipojo.annotations.Property;
+import org.apache.felix.ipojo.annotations.Updated;
+import org.apache.felix.ipojo.runtime.core.test.services.BarService;
+import org.apache.felix.ipojo.runtime.core.test.services.BarService;
+import org.apache.felix.ipojo.runtime.core.test.services.FooService;
+
+@Component(managedservice="MyPID")
+public class UpdatedWithManagedService 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;
+ }
+
+ @Updated
+ public void after(Dictionary conf) {
+ // ...
+ }
+
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/UpdatedWithProperties.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/UpdatedWithProperties.java
new file mode 100644
index 0000000..551e293
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/UpdatedWithProperties.java
@@ -0,0 +1,85 @@
+package org.apache.felix.ipojo.runtime.core.test.components;
+
+import java.util.Dictionary;
+
+import org.apache.felix.ipojo.annotations.Component;
+import org.apache.felix.ipojo.annotations.Property;
+import org.apache.felix.ipojo.annotations.Updated;
+import org.apache.felix.ipojo.runtime.core.test.services.BarService;
+import org.apache.felix.ipojo.runtime.core.test.services.FooService;
+import org.apache.felix.ipojo.runtime.core.test.services.BarService;
+import org.apache.felix.ipojo.runtime.core.test.services.FooService;
+
+
+@Component
+public class UpdatedWithProperties implements FooService, BarService {
+
+ @Updated
+ public void after(Dictionary dict) {
+ // ...
+ }
+
+ @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", mandatory=true)
+ 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/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/error/AbstractClass.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/error/AbstractClass.java
new file mode 100644
index 0000000..2e305ec
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/error/AbstractClass.java
@@ -0,0 +1,10 @@
+package org.apache.felix.ipojo.runtime.core.test.components.error;
+
+import org.apache.felix.ipojo.annotations.Requires;
+
+public abstract class AbstractClass {
+
+ @Requires
+ private Runnable run;
+
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/event/PubSub.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/event/PubSub.java
new file mode 100644
index 0000000..c2d3f6e
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/event/PubSub.java
@@ -0,0 +1,37 @@
+package org.apache.felix.ipojo.runtime.core.test.components.event;
+
+import org.apache.felix.ipojo.annotations.Component;
+import org.apache.felix.ipojo.handlers.event.Subscriber;
+import org.osgi.service.event.Event;
+
+
+@Component
+public class PubSub {
+ @org.apache.felix.ipojo.handlers.event.Publisher(name="p1", synchronous=true)
+ org.apache.felix.ipojo.handlers.event.publisher.Publisher publisher1;
+
+ @org.apache.felix.ipojo.handlers.event.Publisher(name="p2", synchronous=false, topics="foo,bar", dataKey="data")
+ org.apache.felix.ipojo.handlers.event.publisher.Publisher publisher2;
+
+ @org.apache.felix.ipojo.handlers.event.Publisher(name="p3", synchronous=true, topics="bar")
+ org.apache.felix.ipojo.handlers.event.publisher.Publisher publisher3;
+
+ @Subscriber(name="s1", dataKey="data")
+ public void receive1(Object foo) {
+ // Nothing
+ }
+
+ @Subscriber(name="s2", topics="foo,bar", filter="(foo=true)")
+ public void receive2(Event foo) {
+ // Nothing
+ }
+
+
+ @Subscriber(name="s3", topics="foo", dataKey="data", dataType="java.lang.String")
+ public void receive3(String foo) {
+ // Nothing
+ }
+
+
+
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/event/PubSubDeprecated.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/event/PubSubDeprecated.java
new file mode 100644
index 0000000..e59c3b1
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/event/PubSubDeprecated.java
@@ -0,0 +1,37 @@
+package org.apache.felix.ipojo.runtime.core.test.components.event;
+
+import org.apache.felix.ipojo.annotations.Component;
+import org.apache.felix.ipojo.handlers.event.Subscriber;
+import org.osgi.service.event.Event;
+
+
+@Component
+public class PubSubDeprecated {
+ @org.apache.felix.ipojo.handlers.event.Publisher(name="p1", synchronous=true)
+ org.apache.felix.ipojo.handlers.event.publisher.Publisher publisher1;
+
+ @org.apache.felix.ipojo.handlers.event.Publisher(name="p2", synchronous=false, topics="foo,bar", data_key="data")
+ org.apache.felix.ipojo.handlers.event.publisher.Publisher publisher2;
+
+ @org.apache.felix.ipojo.handlers.event.Publisher(name="p3", synchronous=true, topics="bar")
+ org.apache.felix.ipojo.handlers.event.publisher.Publisher publisher3;
+
+ @Subscriber(name="s1", data_key="data")
+ public void receive1(Object foo) {
+ // Nothing
+ }
+
+ @Subscriber(name="s2", topics="foo,bar", filter="(foo=true)")
+ public void receive2(Event foo) {
+ // Nothing
+ }
+
+
+ @Subscriber(name="s3", topics="foo", data_key="data", data_type="java.lang.String")
+ public void receive3(String foo) {
+ // Nothing
+ }
+
+
+
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/event/PubSubWithPublishes.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/event/PubSubWithPublishes.java
new file mode 100644
index 0000000..04dd487
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/event/PubSubWithPublishes.java
@@ -0,0 +1,38 @@
+package org.apache.felix.ipojo.runtime.core.test.components.event;
+
+import org.apache.felix.ipojo.annotations.Component;
+import org.apache.felix.ipojo.handlers.event.Publishes;
+import org.apache.felix.ipojo.handlers.event.Subscriber;
+import org.osgi.service.event.Event;
+
+
+@Component
+public class PubSubWithPublishes {
+ @Publishes(name="p1", synchronous=true)
+ org.apache.felix.ipojo.handlers.event.publisher.Publisher publisher1;
+
+ @Publishes(name="p2", synchronous=false, topics="foo,bar", dataKey="data")
+ org.apache.felix.ipojo.handlers.event.publisher.Publisher publisher2;
+
+ @Publishes(name="p3", synchronous=true, topics="bar")
+ org.apache.felix.ipojo.handlers.event.publisher.Publisher publisher3;
+
+ @Subscriber(name="s1", dataKey="data")
+ public void receive1(Object foo) {
+ // Nothing
+ }
+
+ @Subscriber(name="s2", topics="foo,bar", filter="(foo=true)")
+ public void receive2(Event foo) {
+ // Nothing
+ }
+
+
+ @Subscriber(name="s3", topics="foo", dataKey="data", dataType="java.lang.String")
+ public void receive3(String foo) {
+ // Nothing
+ }
+
+
+
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/extender/Extender.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/extender/Extender.java
new file mode 100644
index 0000000..2599d3b
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/extender/Extender.java
@@ -0,0 +1,18 @@
+package org.apache.felix.ipojo.runtime.core.test.components.extender;
+
+import org.apache.felix.ipojo.annotations.Component;
+import org.osgi.framework.Bundle;
+
+
+@Component
+@org.apache.felix.ipojo.extender.Extender(extension="foo", onArrival="onArrival", onDeparture="onDeparture")
+public class Extender {
+
+ public void onArrival(Bundle bundle, String foo) {
+ // nothing
+ }
+
+ public void onDeparture(Bundle bundle) {
+ // nothing
+ }
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/jmx/JMXDeprecated.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/jmx/JMXDeprecated.java
new file mode 100644
index 0000000..41cc65c
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/jmx/JMXDeprecated.java
@@ -0,0 +1,25 @@
+package org.apache.felix.ipojo.runtime.core.test.components.jmx;
+
+import org.apache.felix.ipojo.annotations.Component;
+import org.apache.felix.ipojo.handlers.jmx.Config;
+import org.apache.felix.ipojo.handlers.jmx.Method;
+import org.apache.felix.ipojo.handlers.jmx.Property;
+
+@Component
+@Config(domain="my-domain", usesMOSGi=false)
+public class JMXDeprecated {
+
+ @Property(name="prop", notification=true, rights="w")
+ String m_foo;
+
+ @Method(description="set the foo prop")
+ public void setFoo(String mes) {
+ System.out.println("Set foo to " + mes);
+ m_foo = mes;
+ }
+
+ @Method(description="get the foo prop")
+ public String getFoo() {
+ return m_foo;
+ }
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/jmx/JMXSimple.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/jmx/JMXSimple.java
new file mode 100644
index 0000000..9ed5b52
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/jmx/JMXSimple.java
@@ -0,0 +1,25 @@
+package org.apache.felix.ipojo.runtime.core.test.components.jmx;
+
+import org.apache.felix.ipojo.annotations.Component;
+import org.apache.felix.ipojo.handlers.jmx.Config;
+import org.apache.felix.ipojo.handlers.jmx.JMXMethod;
+import org.apache.felix.ipojo.handlers.jmx.JMXProperty;
+
+@Component
+@Config(domain="my-domain", usesMOSGi=false)
+public class JMXSimple {
+
+ @JMXProperty(name="prop", notification=true, rights="w")
+ String m_foo;
+
+ @JMXMethod(description="set the foo prop")
+ public void setFoo(String mes) {
+ System.out.println("Set foo to " + mes);
+ m_foo = mes;
+ }
+
+ @JMXMethod(description="get the foo prop")
+ public String getFoo() {
+ return m_foo;
+ }
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/temporal/Temporal.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/temporal/Temporal.java
new file mode 100644
index 0000000..959888b
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/temporal/Temporal.java
@@ -0,0 +1,14 @@
+package org.apache.felix.ipojo.runtime.core.test.components.temporal;
+
+import org.apache.felix.ipojo.annotations.Component;
+import org.apache.felix.ipojo.handler.temporal.Requires;
+import org.apache.felix.ipojo.runtime.core.test.services.FooService;
+import org.apache.felix.ipojo.runtime.core.test.services.FooService;
+
+@Component
+public class Temporal {
+
+ @org.apache.felix.ipojo.handler.temporal.Temporal
+ private FooService fs;
+
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/temporal/TemporalCollection.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/temporal/TemporalCollection.java
new file mode 100644
index 0000000..74ed17c
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/temporal/TemporalCollection.java
@@ -0,0 +1,25 @@
+package org.apache.felix.ipojo.runtime.core.test.components.temporal;
+
+import java.util.Collection;
+
+import org.apache.felix.ipojo.annotations.Component;
+import org.apache.felix.ipojo.handler.temporal.Requires;
+
+@Component
+public class TemporalCollection {
+
+ @Requires(specification="org.apache.felix.ipojo.runtime.core.test.services.FooService")
+ private Collection fs1;
+
+ @Requires(specification="org.apache.felix.ipojo.runtime.core.test.services.FooService", timeout=300)
+ private Collection fs2;
+
+ @Requires(onTimeout="empty", specification="org.apache.felix.ipojo.runtime.core.test.services.FooService")
+ private Collection fs3;
+
+ @Requires(proxy=true, specification="org.apache.felix.ipojo.runtime.core.test.services.FooService")
+ private Collection fs4;
+
+
+
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/temporal/TemporalSimple.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/temporal/TemporalSimple.java
new file mode 100644
index 0000000..39859d0
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/temporal/TemporalSimple.java
@@ -0,0 +1,13 @@
+package org.apache.felix.ipojo.runtime.core.test.components.temporal;
+
+import org.apache.felix.ipojo.annotations.Component;
+import org.apache.felix.ipojo.handler.temporal.Requires;
+import org.apache.felix.ipojo.runtime.core.test.services.FooService;
+
+@Component
+public class TemporalSimple {
+
+ @Requires
+ private FooService fs;
+
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/temporal/TemporalWithDI.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/temporal/TemporalWithDI.java
new file mode 100644
index 0000000..9282aa1
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/temporal/TemporalWithDI.java
@@ -0,0 +1,13 @@
+package org.apache.felix.ipojo.runtime.core.test.components.temporal;
+
+import org.apache.felix.ipojo.annotations.Component;
+import org.apache.felix.ipojo.handler.temporal.Requires;
+import org.apache.felix.ipojo.runtime.core.test.services.FooService;
+
+@Component
+public class TemporalWithDI {
+
+ @Requires(onTimeout="org.apache.felix.ipojo.runtime.core.test.components.ProvidesSimple")
+ private FooService fs;
+
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/temporal/TemporalWithEmptyArray.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/temporal/TemporalWithEmptyArray.java
new file mode 100644
index 0000000..a28af85
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/temporal/TemporalWithEmptyArray.java
@@ -0,0 +1,13 @@
+package org.apache.felix.ipojo.runtime.core.test.components.temporal;
+
+import org.apache.felix.ipojo.annotations.Component;
+import org.apache.felix.ipojo.handler.temporal.Requires;
+import org.apache.felix.ipojo.runtime.core.test.services.FooService;
+
+@Component
+public class TemporalWithEmptyArray {
+
+ @Requires(onTimeout="empty-array")
+ private FooService fs[];
+
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/temporal/TemporalWithFilter.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/temporal/TemporalWithFilter.java
new file mode 100644
index 0000000..a605b77
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/temporal/TemporalWithFilter.java
@@ -0,0 +1,13 @@
+package org.apache.felix.ipojo.runtime.core.test.components.temporal;
+
+import org.apache.felix.ipojo.annotations.Component;
+import org.apache.felix.ipojo.handler.temporal.Requires;
+import org.apache.felix.ipojo.runtime.core.test.services.FooService;
+
+@Component
+public class TemporalWithFilter {
+
+ @Requires(filter="(vendor=clement)")
+ private FooService fs;
+
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/temporal/TemporalWithNull.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/temporal/TemporalWithNull.java
new file mode 100644
index 0000000..9b4fa20
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/temporal/TemporalWithNull.java
@@ -0,0 +1,13 @@
+package org.apache.felix.ipojo.runtime.core.test.components.temporal;
+
+import org.apache.felix.ipojo.annotations.Component;
+import org.apache.felix.ipojo.handler.temporal.Requires;
+import org.apache.felix.ipojo.runtime.core.test.services.FooService;
+
+@Component
+public class TemporalWithNull {
+
+ @Requires(onTimeout="null")
+ private FooService fs;
+
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/temporal/TemporalWithNullable.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/temporal/TemporalWithNullable.java
new file mode 100644
index 0000000..d17c17c
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/temporal/TemporalWithNullable.java
@@ -0,0 +1,14 @@
+package org.apache.felix.ipojo.runtime.core.test.components.temporal;
+
+import org.apache.felix.ipojo.annotations.Component;
+import org.apache.felix.ipojo.handler.temporal.Requires;
+import org.apache.felix.ipojo.runtime.core.test.services.FooService;
+import org.apache.felix.ipojo.runtime.core.test.services.FooService;
+
+@Component
+public class TemporalWithNullable {
+
+ @Requires(onTimeout="nullable")
+ private FooService fs;
+
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/temporal/TemporalWithTimeout.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/temporal/TemporalWithTimeout.java
new file mode 100644
index 0000000..9a20b40
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/temporal/TemporalWithTimeout.java
@@ -0,0 +1,16 @@
+package org.apache.felix.ipojo.runtime.core.test.components.temporal;
+
+import org.apache.felix.ipojo.annotations.Component;
+import org.apache.felix.ipojo.handler.temporal.Requires;
+import org.apache.felix.ipojo.runtime.core.test.services.FooService;
+import org.apache.felix.ipojo.runtime.core.test.services.FooService;
+
+@Component
+public class TemporalWithTimeout {
+
+ @Requires(timeout=100)
+ private FooService fs;
+
+
+
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/whiteboard/WhiteBoardWIModification.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/whiteboard/WhiteBoardWIModification.java
new file mode 100644
index 0000000..6dc2a91
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/whiteboard/WhiteBoardWIModification.java
@@ -0,0 +1,25 @@
+package org.apache.felix.ipojo.runtime.core.test.components.whiteboard;
+
+import org.apache.felix.ipojo.annotations.Component;
+import org.osgi.framework.ServiceReference;
+
+@Component
+@org.apache.felix.ipojo.whiteboard.Wbp(filter="(foo=true)",
+ onArrival="onArrival",
+ onDeparture="onDeparture",
+ onModification="onModification")
+public class WhiteBoardWIModification {
+
+ public void onArrival(ServiceReference ref) {
+ // nothing
+ }
+
+ public void onDeparture(ServiceReference ref) {
+ // nothing
+ }
+
+ public void onModification(ServiceReference ref) {
+ // nothing
+ }
+
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/whiteboard/WhiteBoardWOModification.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/whiteboard/WhiteBoardWOModification.java
new file mode 100644
index 0000000..687b9b0
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/whiteboard/WhiteBoardWOModification.java
@@ -0,0 +1,18 @@
+package org.apache.felix.ipojo.runtime.core.test.components.whiteboard;
+
+import org.apache.felix.ipojo.annotations.Component;
+import org.osgi.framework.ServiceReference;
+
+@Component
+@org.apache.felix.ipojo.whiteboard.Wbp(filter="(foo=true)", onArrival="onArrival", onDeparture="onDeparture")
+public class WhiteBoardWOModification {
+
+ public void onArrival(ServiceReference ref) {
+ // nothing
+ }
+
+ public void onDeparture(ServiceReference ref) {
+ // nothing
+ }
+
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/whiteboard/WhiteBoards.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/whiteboard/WhiteBoards.java
new file mode 100644
index 0000000..f96fb08
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/whiteboard/WhiteBoards.java
@@ -0,0 +1,27 @@
+package org.apache.felix.ipojo.runtime.core.test.components.whiteboard;
+
+import org.apache.felix.ipojo.annotations.Component;
+import org.apache.felix.ipojo.whiteboard.Whiteboards;
+import org.apache.felix.ipojo.whiteboard.Wbp;
+import org.osgi.framework.ServiceReference;
+
+@Component
+@Whiteboards(whiteboards={
+ @Wbp(filter="(foo=true)", onArrival="onArrival", onDeparture="onDeparture"),
+ @Wbp(filter="(foo=true)", onArrival="onArrival", onDeparture="onDeparture", onModification="onModification")
+ })
+public class WhiteBoards {
+
+ public void onArrival(ServiceReference ref) {
+ // nothing
+ }
+
+ public void onDeparture(ServiceReference ref) {
+ // nothing
+ }
+
+ public void onModification(ServiceReference ref) {
+ // nothing
+ }
+
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/services/BarService.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/services/BarService.java
new file mode 100644
index 0000000..4e7d03e
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/services/BarService.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.ipojo.runtime.core.test.services;
+
+import java.util.Properties;
+
+public interface BarService {
+
+ public boolean bar();
+
+ public Properties getProps();
+
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/services/CheckService.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/services/CheckService.java
new file mode 100644
index 0000000..ecb327b
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/services/CheckService.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.ipojo.runtime.core.test.services;
+
+import java.util.Properties;
+
+public interface CheckService {
+
+ public static final String foo = "foo";
+
+ public boolean check();
+
+ public Properties getProps();
+
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/services/ChildInterface.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/services/ChildInterface.java
new file mode 100644
index 0000000..38b4848
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/services/ChildInterface.java
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.ipojo.runtime.core.test.services;
+
+public interface ChildInterface extends ParentInterface1, ParentInterface2 {
+
+ public void processChild();
+
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/services/FooService.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/services/FooService.java
new file mode 100644
index 0000000..4c5b3b4
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/services/FooService.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.ipojo.runtime.core.test.services;
+
+import java.util.Properties;
+
+public interface FooService {
+
+ boolean foo();
+
+ Properties fooProps();
+
+ Boolean getObject();
+
+ boolean getBoolean();
+
+ int getInt();
+
+ long getLong();
+
+ double getDouble();
+
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/services/ParentInterface1.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/services/ParentInterface1.java
new file mode 100644
index 0000000..4e30881
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/services/ParentInterface1.java
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.ipojo.runtime.core.test.services;
+
+public interface ParentInterface1 extends ParentParentInterface {
+
+ public void processParent1();
+
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/services/ParentInterface2.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/services/ParentInterface2.java
new file mode 100644
index 0000000..c18bb2a
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/services/ParentInterface2.java
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.ipojo.runtime.core.test.services;
+
+public interface ParentInterface2 {
+
+ public void processParent2();
+
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/services/ParentParentInterface.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/services/ParentParentInterface.java
new file mode 100644
index 0000000..a16fa94
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/services/ParentParentInterface.java
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.ipojo.runtime.core.test.services;
+
+public interface ParentParentInterface {
+
+ public void processParentParent();
+
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/Common.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/Common.java
new file mode 100644
index 0000000..3933aa0
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/Common.java
@@ -0,0 +1,154 @@
+package org.apache.felix.ipojo.runtime.core.test.annotations;
+
+import ch.qos.logback.classic.Level;
+import ch.qos.logback.classic.Logger;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.filefilter.TrueFileFilter;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.Configuration;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.junit.PaxExam;
+import org.ops4j.pax.exam.options.CompositeOption;
+import org.ops4j.pax.exam.options.DefaultCompositeOption;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerClass;
+import org.ops4j.pax.tinybundles.core.TinyBundle;
+import org.ops4j.pax.tinybundles.core.TinyBundles;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Constants;
+import org.ow2.chameleon.testing.helpers.IPOJOHelper;
+import org.ow2.chameleon.testing.helpers.OSGiHelper;
+import org.ow2.chameleon.testing.tinybundles.ipojo.IPOJOStrategy;
+import org.slf4j.LoggerFactory;
+
+import javax.inject.Inject;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import static org.ops4j.pax.exam.CoreOptions.*;
+
+/**
+ * Bootstrap the test from this project
+ */
+@RunWith(PaxExam.class)
+@ExamReactorStrategy(PerClass.class)
+public class Common {
+
+ @Inject
+ BundleContext bc;
+
+ OSGiHelper osgiHelper;
+ IPOJOHelper ipojoHelper;
+
+ Bundle testedBundle;
+
+ @Configuration
+ public Option[] config() throws MalformedURLException {
+ Logger root = (Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
+ root.setLevel(Level.INFO);
+
+ return options(
+ ipojoBundles(),
+ junitBundles(),
+ testedBundle(),
+ eventadmin(),
+ systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("WARN")
+ );
+ }
+
+ @Before
+ public void commonSetUp() {
+ osgiHelper = new OSGiHelper(bc);
+ ipojoHelper = new IPOJOHelper(bc);
+
+ testedBundle = osgiHelper.getBundle("test.bundle");
+
+ // Dump OSGi Framework information
+ String vendor = (String) osgiHelper.getBundle(0).getHeaders().get(Constants.BUNDLE_VENDOR);
+ if (vendor == null) {
+ vendor = (String) osgiHelper.getBundle(0).getHeaders().get(Constants.BUNDLE_SYMBOLICNAME);
+ }
+ String version = (String) osgiHelper.getBundle(0).getHeaders().get(Constants.BUNDLE_VERSION);
+ System.out.println("OSGi Framework : " + vendor + " - " + version);
+ }
+
+ @After
+ public void commonTearDown() {
+ osgiHelper.dispose();
+ ipojoHelper.dispose();
+ }
+
+ public CompositeOption ipojoBundles() {
+ return new DefaultCompositeOption(
+ mavenBundle("org.apache.felix", "org.apache.felix.ipojo").versionAsInProject(),
+ mavenBundle("org.ow2.chameleon.testing", "osgi-helpers").versionAsInProject());
+ }
+
+ public CompositeOption eventadmin() {
+ return new DefaultCompositeOption(
+ mavenBundle("org.apache.felix", "org.apache.felix.eventadmin", "1.3.0"),
+ mavenBundle("org.apache.felix", "org.apache.felix.ipojo.handler.eventadmin",
+ "1.8.0").versionAsInProject());
+ }
+
+ public Option testedBundle() throws MalformedURLException {
+ File out = new File("target/tested/bundle.jar");
+ if (out.exists()) { return bundle(out.toURI().toURL().toExternalForm()); }
+
+ TinyBundle tested = TinyBundles.bundle();
+
+ // We look inside target/classes to find the class and resources
+ File classes = new File("target/classes");
+ Collection<File> files = FileUtils.listFilesAndDirs(classes, TrueFileFilter.INSTANCE, TrueFileFilter.INSTANCE);
+ List<File> services = new ArrayList<File>();
+ for (File file : files) {
+ if (file.isDirectory()) {
+ // By convention we export of .services and .service package
+ if (file.getName().endsWith("services") || file.getName().endsWith("service")) {
+ services.add(file);
+ }
+ } else {
+ // We need to compute the path
+ String path = file.getAbsolutePath().substring(classes.getAbsolutePath().length() + 1);
+ tested.add(path, file.toURI().toURL());
+ System.out.println(file.getName() + " added to " + path);
+ }
+ }
+
+ String export = "";
+ for (File file : services) {
+ if (export.length() > 0) {
+ export += ", ";
+ }
+ String path = file.getAbsolutePath().substring(classes.getAbsolutePath().length() + 1);
+ String packageName = path.replace('/', '.');
+ export += packageName;
+ }
+
+ System.out.println("Exported packages : " + export);
+
+ InputStream inputStream = tested
+ .set(Constants.BUNDLE_SYMBOLICNAME, "test.bundle")
+ .set(Constants.IMPORT_PACKAGE, "*")
+ .set(Constants.EXPORT_PACKAGE, export)
+ .build(IPOJOStrategy.withiPOJO(new File("src/main/resources")));
+
+ try {
+ org.apache.commons.io.FileUtils.copyInputStreamToFile(inputStream, out);
+ return bundle(out.toURI().toURL().toExternalForm());
+ } catch (MalformedURLException e) {
+ throw new RuntimeException("Cannot compute the url of the manipulated bundle");
+ } catch (IOException e) {
+ throw new RuntimeException("Cannot write of the manipulated bundle");
+ }
+ }
+
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestAggregateDependency.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestAggregateDependency.java
new file mode 100644
index 0000000..4b70d81
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestAggregateDependency.java
@@ -0,0 +1,63 @@
+package org.apache.felix.ipojo.runtime.core.test.annotations;
+
+import org.apache.felix.ipojo.metadata.Element;
+import org.junit.Before;
+import org.junit.Test;
+
+import static junit.framework.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+public class TestAggregateDependency extends Common {
+
+ private Element[] deps;
+
+ @Before
+ public void setUp() {
+ Element meta = ipojoHelper.getMetadata(testedBundle, "org.apache.felix.ipojo.runtime.core.test.components.AggregateDependency");
+ deps = meta.getElements("requires");
+ }
+
+ @Test
+ public void testCallbackBind() {
+ Element dep = getDependencyById(deps, "Bar");
+ String opt = dep.getAttribute("aggregate");
+ assertEquals("Check aggregate", "true", opt);
+ }
+
+ @Test
+ public void testCallbackUnbind() {
+ Element dep = getDependencyById(deps, "Baz");
+ String opt = dep.getAttribute("aggregate");
+ assertEquals("Check aggregate", "true", opt);
+ }
+
+ @Test
+ public void testBindOnly() {
+ Element dep = getDependencyById(deps, "bindonly");
+ String opt = dep.getAttribute("aggregate");
+ assertEquals("Check aggregate", "true", opt);
+ }
+
+ @Test
+ 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;
+ }
+
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestArchitecture.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestArchitecture.java
new file mode 100644
index 0000000..5925726
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestArchitecture.java
@@ -0,0 +1,31 @@
+package org.apache.felix.ipojo.runtime.core.test.annotations;
+
+import org.apache.felix.ipojo.metadata.Element;
+import org.junit.Test;
+
+import static junit.framework.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+public class TestArchitecture extends Common {
+
+ @Test
+ public void testArch() {
+ Element meta = ipojoHelper.getMetadata(testedBundle, "org.apache.felix.ipojo.runtime.core.test.components" +
+ ".Arch");
+ String arch = meta.getAttribute("architecture");
+ assertNotNull("Architecture exists ", arch);
+ assertEquals("Architecture value", "true", arch);
+ }
+
+ @Test
+ public void testNoArch() {
+ Element meta = ipojoHelper.getMetadata(testedBundle, "org.apache.felix.ipojo.runtime.core.test.components" +
+ ".NoArch");
+ String arch = meta.getAttribute("architecture");
+ assertNotNull("Architecture exists ", arch);
+ assertEquals("Architecture value", "false", arch);
+ }
+
+
+}
+
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestCustomAnnotations.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestCustomAnnotations.java
new file mode 100644
index 0000000..f060997
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestCustomAnnotations.java
@@ -0,0 +1,36 @@
+package org.apache.felix.ipojo.runtime.core.test.annotations;
+
+import org.apache.felix.ipojo.metadata.Element;
+import org.junit.Test;
+
+import static junit.framework.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+/**
+ * Checks the support of the custom annotation handlinig.
+ */
+public class TestCustomAnnotations extends Common {
+
+
+ @Test
+ public void testThatCustomAnnotationAreCorrectlyAdded() {
+ Element meta = ipojoHelper.getMetadata(testedBundle, "org.apache.felix.ipojo.runtime.core.test.components.CustomAnnotationWithEnum");
+ Element[] ann = meta.getElements("IPOJOFoo", "foo.ipojo");
+ assertNotNull("Annotation exists ", ann);
+ }
+
+ @Test
+ public void testThatCustomAnnotationAreSupportingEnums() {
+ Element meta = ipojoHelper.getMetadata(testedBundle, "org.apache.felix.ipojo.runtime.core.test.components.CustomAnnotationWithEnum");
+ Element[] ann = meta.getElements("IPOJOFoo", "foo.ipojo");
+ assertNotNull("Annotation exists ", ann);
+ Element element = ann[0];
+ // Simple value
+ assertEquals("RED", element.getAttribute("rgb"));
+ // Array (FELIX-3508).
+ assertEquals("{BLUE,RED}", element.getAttribute("colors"));
+ }
+
+
+}
+
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestDependency.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestDependency.java
new file mode 100644
index 0000000..00db575
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestDependency.java
@@ -0,0 +1,135 @@
+package org.apache.felix.ipojo.runtime.core.test.annotations;
+
+import org.apache.felix.ipojo.metadata.Element;
+import org.junit.Test;
+
+import static junit.framework.Assert.assertEquals;
+import static org.junit.Assert.*;
+
+public class TestDependency extends Common {
+
+
+ @Test
+ public void testDependencyDeclaration() {
+ Element meta = ipojoHelper.getMetadata(testedBundle, "org.apache.felix.ipojo.runtime.core.test.components.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);
+
+ // Check mod
+ dep = getDependencyById(deps, "mod");
+ id = dep.getAttribute("id");
+ bind = getBind(dep);
+ unbind = getUnbind(dep);
+ String mod = getModified(dep);
+ assertEquals("Check mod bind", "bindMod", bind);
+ assertEquals("Check mod unbind", "unbindMod", unbind);
+ assertEquals("Check mod modified", "modifiedMod", mod);
+ assertEquals("Check mod id", "mod", id);
+
+ // Check not proxied
+ dep = getDependencyById(deps, "notproxied");
+ assertEquals("Check not proxied", "false", dep.getAttribute("proxy"));
+ }
+
+ 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;
+ }
+
+ private String getModified(Element dep) {
+ Element[] elem = dep.getElements("callback");
+ for (int i = 0; elem != null && i < elem.length; i++) {
+ if (elem[i].getAttribute("type").equalsIgnoreCase("modified")) {
+ return elem[i].getAttribute("method");
+ }
+ }
+ return null;
+ }
+
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestDependencyPolicy.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestDependencyPolicy.java
new file mode 100644
index 0000000..4c7f732
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestDependencyPolicy.java
@@ -0,0 +1,85 @@
+package org.apache.felix.ipojo.runtime.core.test.annotations;
+
+import org.apache.felix.ipojo.metadata.Element;
+import org.junit.Before;
+import org.junit.Test;
+
+import static junit.framework.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+public class TestDependencyPolicy extends Common {
+
+ private Element[] deps;
+
+ @Before
+ public void setUp() {
+ Element meta = ipojoHelper.getMetadata(testedBundle, "org.apache.felix.ipojo.runtime.core.test.components.PolicyDependency");
+ deps = meta.getElements("requires");
+ }
+
+ @Test
+ public void testField() {
+ Element dep = getDependencyById(deps, "fs");
+ String opt = dep.getAttribute("policy");
+ assertEquals("Check policy", "static", opt);
+ }
+
+ @Test
+ public void testFieldDPpolicy() {
+ Element dep = getDependencyById(deps, "fs2");
+ String opt = dep.getAttribute("policy");
+ assertEquals("Check policy", "dynamic-priority", opt);
+ }
+
+ @Test
+ public void testCallbackBind() {
+ Element dep = getDependencyById(deps, "Bar");
+ String opt = dep.getAttribute("policy");
+ assertEquals("Check policy", "static", opt);
+ }
+
+ @Test
+ public void testCallbackUnbind() {
+ Element dep = getDependencyById(deps, "Baz");
+ String opt = dep.getAttribute("policy");
+ assertEquals("Check policy", "static", opt);
+ }
+
+ @Test
+ public void testBoth() {
+ Element dep = getDependencyById(deps, "inv");
+ String opt = dep.getAttribute("policy");
+ assertEquals("Check policy", "static", opt);
+ }
+
+ @Test
+ public void testBindOnly() {
+ Element dep = getDependencyById(deps, "bindonly");
+ String opt = dep.getAttribute("policy");
+ assertEquals("Check policy", "static", opt);
+ }
+
+ @Test
+ 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;
+ }
+
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestEventAdmin.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestEventAdmin.java
new file mode 100644
index 0000000..3b0a878
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestEventAdmin.java
@@ -0,0 +1,268 @@
+package org.apache.felix.ipojo.runtime.core.test.annotations;
+
+import org.apache.felix.ipojo.metadata.Element;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import static junit.framework.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+public class TestEventAdmin extends Common {
+ String type = "org.apache.felix.ipojo.runtime.core.test.components.event.PubSub";
+ String deprecated = "org.apache.felix.ipojo.runtime.core.test.components.event.PubSubDeprecated";
+ String publishes = "org.apache.felix.ipojo.runtime.core.test.components.event.PubSubWithPublishes";
+
+ String namespace = "org.apache.felix.ipojo.handlers.event";
+
+ Element component;
+ Element componentDeprecated;
+ Element componentWithPublishes;
+
+ @Before
+ public void setUp() {
+ component = ipojoHelper.getMetadata(testedBundle, type);
+ componentDeprecated = ipojoHelper.getMetadata(testedBundle, deprecated);
+ componentWithPublishes = ipojoHelper.getMetadata(testedBundle, publishes);
+ assertNotNull("Check component", component);
+ assertNotNull("Check deprecated", componentDeprecated);
+ assertNotNull("Check publishes", componentWithPublishes);
+
+ }
+
+ @After
+ public void tearDown() {
+ component = null;
+ componentDeprecated = null;
+ componentWithPublishes = null;
+ }
+
+ @Test
+ public void testP1() {
+ //P1, synchronous
+ Element elem = getElementByName("p1");
+ checkPublisher(elem);
+ assertNull("Check topics", elem.getAttribute("topics"));
+ assertEquals("Check synchronous", "true", elem.getAttribute("synchronous"));
+ assertEquals("Check field", "publisher1", elem.getAttribute("field"));
+ assertNull("Check data_key", elem.getAttribute("dataKey"));
+ }
+
+ @Test
+ public void testP1WithPublishes() {
+ //P1, synchronous
+ Element elem = getPublishesByName("p1");
+ checkPublishes(elem);
+ assertNull("Check topics", elem.getAttribute("topics"));
+ assertEquals("Check synchronous", "true", elem.getAttribute("synchronous"));
+ assertEquals("Check field", "publisher1", elem.getAttribute("field"));
+ assertNull("Check data_key", elem.getAttribute("dataKey"));
+ }
+
+ @Test
+ public void testP1Deprecated() {
+ //P1, synchronous
+ Element elem = getDeprecatedElementByName("p1");
+ checkPublisher(elem);
+ assertNull("Check topics", elem.getAttribute("topics"));
+ assertEquals("Check synchronous", "true", elem.getAttribute("synchronous"));
+ assertEquals("Check field", "publisher1", elem.getAttribute("field"));
+ assertNull("Check data_key", elem.getAttribute("data_key"));
+ }
+
+ @Test
+ public void testP2() {
+ //name="p2", synchronous=false, topics="foo,bar", data_key="data"
+ Element elem = getElementByName("p2");
+ checkPublisher(elem);
+ assertEquals("Check topics (" + elem.getAttribute("topics") + ")", "foo,bar", elem.getAttribute("topics"));
+ assertEquals("Check synchronous", "false", elem.getAttribute("synchronous"));
+ assertEquals("Check field", "publisher2", elem.getAttribute("field"));
+ assertEquals("Check data_key", "data", elem.getAttribute("dataKey"));
+ }
+
+ @Test
+ public void testP2WithPublishes() {
+ //name="p2", synchronous=false, topics="foo,bar", data_key="data"
+ Element elem = getPublishesByName("p2");
+ checkPublishes(elem);
+ assertEquals("Check topics (" + elem.getAttribute("topics") + ")", "foo,bar", elem.getAttribute("topics"));
+ assertEquals("Check synchronous", "false", elem.getAttribute("synchronous"));
+ assertEquals("Check field", "publisher2", elem.getAttribute("field"));
+ assertEquals("Check data_key", "data", elem.getAttribute("dataKey"));
+ }
+
+ @Test
+ public void testP2Deprecated() {
+ //name="p2", synchronous=false, topics="foo,bar", data_key="data"
+ Element elem = getDeprecatedElementByName("p2");
+ checkPublisher(elem);
+ assertEquals("Check topics (" + elem.getAttribute("topics") + ")", "foo,bar", elem.getAttribute("topics"));
+ assertEquals("Check synchronous", "false", elem.getAttribute("synchronous"));
+ assertEquals("Check field", "publisher2", elem.getAttribute("field"));
+ assertEquals("Check data_key", "data", elem.getAttribute("data_key"));
+ }
+
+ @Test
+ public void testP3() {
+ //name="p3", synchronous=true, topics="bar"
+ Element elem = getElementByName("p3");
+ checkPublisher(elem);
+ assertEquals("Check topics", "bar", elem.getAttribute("topics"));
+ assertEquals("Check synchronous", "true", elem.getAttribute("synchronous"));
+ assertEquals("Check field", "publisher3", elem.getAttribute("field"));
+ assertNull("Check data_key", elem.getAttribute("dataKey"));
+ }
+
+ @Test
+ public void testWithPublishesP3() {
+ //name="p3", synchronous=true, topics="bar"
+ Element elem = getPublishesByName("p3");
+ checkPublishes(elem);
+ assertEquals("Check topics", "bar", elem.getAttribute("topics"));
+ assertEquals("Check synchronous", "true", elem.getAttribute("synchronous"));
+ assertEquals("Check field", "publisher3", elem.getAttribute("field"));
+ assertNull("Check data_key", elem.getAttribute("dataKey"));
+ }
+
+ @Test
+ public void testP3Deprecated() {
+ //name="p3", synchronous=true, topics="bar"
+ Element elem = getDeprecatedElementByName("p3");
+ checkPublisher(elem);
+ assertEquals("Check topics", "bar", elem.getAttribute("topics"));
+ assertEquals("Check synchronous", "true", elem.getAttribute("synchronous"));
+ assertEquals("Check field", "publisher3", elem.getAttribute("field"));
+ assertNull("Check data_key", elem.getAttribute("data_key"));
+ }
+
+ @Test
+ public void testS1() {
+ //name="s1", data_key="data"
+ Element elem = getElementByName("s1");
+ checkSubscriber(elem);
+ assertNull("Check topics", elem.getAttribute("topics"));
+ assertEquals("Check method", "receive1", elem.getAttribute("method"));
+ assertEquals("Check data_key", "data", elem.getAttribute("dataKey"));
+ assertNull("Check data_type", elem.getAttribute("dataType"));
+ assertNull("Check filter", elem.getAttribute("filter"));
+ }
+
+ @Test
+ public void testS1Deprecated() {
+ //name="s1", data_key="data"
+ Element elem = getDeprecatedElementByName("s1");
+ checkSubscriber(elem);
+ assertNull("Check topics", elem.getAttribute("topics"));
+ assertEquals("Check method", "receive1", elem.getAttribute("method"));
+ assertEquals("Check data_key", "data", elem.getAttribute("data_key"));
+ assertNull("Check data_type", elem.getAttribute("data_type"));
+ assertNull("Check filter", elem.getAttribute("filter"));
+ }
+
+ @Test
+ public void testS2() {
+ //name="s2", topics="foo,bar", filter="(foo=true)"
+ Element elem = getElementByName("s2");
+ checkSubscriber(elem);
+ assertEquals("Check topics", "foo,bar", elem.getAttribute("topics"));
+ assertEquals("Check method", "receive2", elem.getAttribute("method"));
+ assertNull("Check data_key", elem.getAttribute("dataKey"));
+ assertNull("Check data_type", elem.getAttribute("dataType"));
+ assertEquals("Check filter", "(foo=true)", elem.getAttribute("filter"));
+ }
+
+ @Test
+ public void testS2Deprecated() {
+ //name="s2", topics="foo,bar", filter="(foo=true)"
+ Element elem = getDeprecatedElementByName("s2");
+ checkSubscriber(elem);
+ assertEquals("Check topics", "foo,bar", elem.getAttribute("topics"));
+ assertEquals("Check method", "receive2", elem.getAttribute("method"));
+ assertNull("Check data_key", elem.getAttribute("data_key"));
+ assertNull("Check data_type", elem.getAttribute("data_type"));
+ assertEquals("Check filter", "(foo=true)", elem.getAttribute("filter"));
+ }
+
+ @Test
+ public void testS3() {
+ //name="s3", topics="foo", data_key="data", data_type="java.lang.String"
+ Element elem = getElementByName("s3");
+ checkSubscriber(elem);
+ assertEquals("Check topics", "foo", elem.getAttribute("topics"));
+ assertEquals("Check method", "receive3", elem.getAttribute("method"));
+ assertEquals("Check data_key", "data", elem.getAttribute("dataKey"));
+ assertEquals("Check data_type", "java.lang.String", elem.getAttribute("dataType"));
+ assertNull("Check filter", elem.getAttribute("filter"));
+ }
+
+ @Test
+ public void testS3Deprecated() {
+ //name="s3", topics="foo", data_key="data", data_type="java.lang.String"
+ Element elem = getDeprecatedElementByName("s3");
+ checkSubscriber(elem);
+ assertEquals("Check topics", "foo", elem.getAttribute("topics"));
+ assertEquals("Check method", "receive3", elem.getAttribute("method"));
+ assertEquals("Check data_key", "data", elem.getAttribute("data_key"));
+ assertEquals("Check data_type", "java.lang.String", elem.getAttribute("data_type"));
+ assertNull("Check filter", elem.getAttribute("filter"));
+ }
+
+
+ public Element getElementByName(String name) {
+ Element[] elems = component.getElements();
+ for (int i = 0; i < elems.length; i++) {
+ if (elems[i].containsAttribute("name") && elems[i].getAttribute("name").equals(name)) {
+ return elems[i];
+ }
+ }
+ return null;
+ }
+
+ public Element getPublishesByName(String name) {
+ Element[] elems = componentWithPublishes.getElements();
+ for (int i = 0; i < elems.length; i++) {
+ if (elems[i].containsAttribute("name") && elems[i].getAttribute("name").equals(name)) {
+ return elems[i];
+ }
+ }
+ return null;
+ }
+
+ public Element getDeprecatedElementByName(String name) {
+ Element[] elems = componentDeprecated.getElements();
+ for (int i = 0; i < elems.length; i++) {
+ if (elems[i].containsAttribute("name") && elems[i].getAttribute("name").equals(name)) {
+ return elems[i];
+ }
+ }
+ return null;
+ }
+
+ public void checkSubscriber(Element elem) {
+ assertNotNull("Can't check subscriber : null element", elem);
+ String ns = elem.getNameSpace();
+ String nm = elem.getName();
+ assertEquals("Elem is not a subscriber : bad namespace", namespace, ns);
+ assertEquals("Elem is not a subscriber : bad name", "subscriber", nm);
+
+ }
+
+ public void checkPublisher(Element elem) {
+ assertNotNull("Can't check publisher : null element", elem);
+ String ns = elem.getNameSpace();
+ String nm = elem.getName();
+ assertEquals("Elem is not a publisher : bad namespace", namespace, ns);
+ assertEquals("Elem is not a publisher : bad name", "publisher", nm);
+ }
+
+ public void checkPublishes(Element elem) {
+ assertNotNull("Can't check publisher : null element", elem);
+ String ns = elem.getNameSpace();
+ String nm = elem.getName();
+ assertEquals("Elem is not a publisher : bad namespace", namespace, ns);
+ assertEquals("Elem is not a publisher : bad name", "publishes", nm);
+ }
+
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestExtender.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestExtender.java
new file mode 100644
index 0000000..16056f5
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestExtender.java
@@ -0,0 +1,30 @@
+package org.apache.felix.ipojo.runtime.core.test.annotations;
+
+import org.apache.felix.ipojo.metadata.Element;
+import org.junit.Test;
+
+import static junit.framework.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+public class TestExtender extends Common {
+
+ String type = "org.apache.felix.ipojo.runtime.core.test.components.extender.Extender";
+ String namespace = "org.apache.felix.ipojo.extender";
+
+
+ @Test
+ public void testMetadata() {
+ Element meta = ipojoHelper.getMetadata(testedBundle, type);
+ assertNotNull("Check meta", meta);
+ Element[] ext = meta.getElements("extender", namespace);
+ assertEquals("Check size", 1, ext.length);
+ String extension = ext[0].getAttribute("extension");
+ String onArr = ext[0].getAttribute("onArrival");
+ String onDep = ext[0].getAttribute("onDeparture");
+
+ assertEquals("Check extension", "foo", extension);
+ assertEquals("Check onArrival", "onArrival", onArr);
+ assertEquals("Check onDeparture", "onDeparture", onDep);
+ }
+
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestFactory.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestFactory.java
new file mode 100644
index 0000000..18868b0
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestFactory.java
@@ -0,0 +1,79 @@
+package org.apache.felix.ipojo.runtime.core.test.annotations;
+
+import org.apache.felix.ipojo.metadata.Element;
+import org.junit.Test;
+
+import static junit.framework.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+public class TestFactory extends Common {
+
+
+ @Test
+ public void testArchDeprecated() {
+ Element meta = ipojoHelper.getMetadata(testedBundle, "org.apache.felix.ipojo.runtime.core.test.components.FactoryDeprecated");
+ String fact = meta.getAttribute("public");
+ String name = meta.getAttribute("name");
+ assertNotNull("Factory exists ", fact);
+ assertEquals("Factory value", "true", fact);
+ assertNotNull("Name exists ", name);
+ assertEquals("Name value", "org.apache.felix.ipojo.runtime.core.test.components.FactoryDeprecated", name);
+ }
+
+ @Test
+ public void testArch() {
+ Element meta = ipojoHelper.getMetadata(testedBundle, "org.apache.felix.ipojo.runtime.core.test.components.Factory");
+ String fact = meta.getAttribute("public");
+ String name = meta.getAttribute("name");
+ assertNotNull("Factory exists ", fact);
+ assertEquals("Factory value", "true", fact);
+ assertNotNull("Name exists ", name);
+ assertEquals("Name value", "factory", name);
+ }
+
+ @Test
+ public void testNoArch() {
+ Element meta = ipojoHelper.getMetadata(testedBundle, "org.apache.felix.ipojo.runtime.core.test.components.NoFactory");
+ String fact = meta.getAttribute("public");
+ String name = meta.getAttribute("name");
+ assertNotNull("Factory exists ", fact);
+ assertEquals("Factory value", "false", fact);
+ assertNotNull("Name exists ", name);
+ assertEquals("Name value", "nofactory", name);
+ }
+
+ @Test
+ public void testFactoryMethod() {
+ Element meta = ipojoHelper.getMetadata(testedBundle, "org.apache.felix.ipojo.runtime.core.test.components.FactoryMethod");
+ String method = meta.getAttribute("factory-method");
+ assertNotNull("Method exists ", method);
+ assertEquals("Method value", "create", method);
+ }
+
+ @Test
+ public void testFactoryMethodDeprecated() {
+ Element meta = ipojoHelper.getMetadata(testedBundle, "org.apache.felix.ipojo.runtime.core.test.components.FactoryMethodDeprecated");
+ String method = meta.getAttribute("factory-method");
+ assertNotNull("Method exists ", method);
+ assertEquals("Method value", "create", method);
+ }
+
+ @Test
+ public void testVersion() {
+ Element meta = ipojoHelper.getMetadata(testedBundle, "org.apache.felix.ipojo.runtime.core.test.components.ComponentTypeVersion");
+ String version = meta.getAttribute("version");
+ assertNotNull("Version exist", version);
+ assertEquals("Version value", "1.0.0", version);
+ }
+
+ @Test
+ public void testNoVersion() {
+ Element meta = ipojoHelper.getMetadata(testedBundle, "org.apache.felix.ipojo.runtime.core.test.components.FactoryMethod");
+ String version = meta.getAttribute("version");
+ assertNull("No Version", version);
+ }
+
+
+}
+
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestFilteredDependency.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestFilteredDependency.java
new file mode 100644
index 0000000..abedaaf
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestFilteredDependency.java
@@ -0,0 +1,113 @@
+package org.apache.felix.ipojo.runtime.core.test.annotations;
+
+import org.apache.felix.ipojo.metadata.Element;
+import org.junit.Before;
+import org.junit.Test;
+
+import static junit.framework.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.fail;
+
+public class TestFilteredDependency extends Common {
+
+ private Element[] deps;
+ private Element[] froms;
+
+
+ @Before
+ public void setUp() {
+ Element meta = ipojoHelper.getMetadata(testedBundle, "org.apache.felix.ipojo.runtime.core.test.components.FilteredDependency");
+ deps = meta.getElements("requires");
+
+ Element meta2 = ipojoHelper.getMetadata(testedBundle, "org.apache.felix.ipojo.runtime.core.test.components.FromDependency");
+ froms = meta2.getElements("requires");
+ }
+
+ @Test
+ public void testField() {
+ Element dep = getDependencyById(deps, "fs");
+ String opt = dep.getAttribute("filter");
+ assertEquals("Check filter", "(foo=bar)", opt);
+ }
+
+ @Test
+ public void testCallbackBind() {
+ Element dep = getDependencyById(deps, "Bar");
+ String opt = dep.getAttribute("filter");
+ assertEquals("Check filter", "(foo=bar)", opt);
+ }
+
+ @Test
+ public void testCallbackUnbind() {
+ Element dep = getDependencyById(deps, "Baz");
+ String opt = dep.getAttribute("filter");
+ assertEquals("Check filter", "(foo=bar)", opt);
+ }
+
+ @Test
+ public void testBoth() {
+ Element dep = getDependencyById(deps, "inv");
+ String opt = dep.getAttribute("filter");
+ assertEquals("Check filter", "(foo=bar)", opt);
+ }
+
+ @Test
+ public void testBindOnly() {
+ Element dep = getDependencyById(deps, "bindonly");
+ String opt = dep.getAttribute("filter");
+ assertEquals("Check filter", "(foo=bar)", opt);
+ }
+
+ @Test
+ public void testUnbindOnly() {
+ Element dep = getDependencyById(deps, "unbindonly");
+ String opt = dep.getAttribute("filter");
+ assertEquals("Check filter", "(foo=bar)", opt);
+ }
+
+ @Test
+ public void testFromField() {
+ Element dep = getDependencyById(froms, "fs");
+ String from = dep.getAttribute("from");
+ assertEquals("Check from", "X", from);
+ }
+
+ @Test
+ public void testFromBind() {
+ Element dep = getDependencyById(froms, "fs2");
+ String from = dep.getAttribute("from");
+ assertEquals("Check from", "X", from);
+ }
+
+ @Test
+ public void testFromUnbind() {
+ Element dep = getDependencyById(froms, "inv");
+ String from = dep.getAttribute("from");
+ assertEquals("Check from", "X", from);
+ }
+
+ @Test
+ public void testNoFrom() {
+ Element dep = getDependencyById(froms, "Bar");
+ String from = dep.getAttribute("from");
+ assertNull("Check from", from);
+ }
+
+
+ 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;
+ }
+
+
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestInstantiate.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestInstantiate.java
new file mode 100644
index 0000000..f9a653b
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestInstantiate.java
@@ -0,0 +1,109 @@
+package org.apache.felix.ipojo.runtime.core.test.annotations;
+
+import org.apache.felix.ipojo.metadata.Element;
+import org.apache.felix.ipojo.parser.ManifestMetadataParser;
+import org.apache.felix.ipojo.parser.ParseException;
+import org.junit.Test;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceReference;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import static junit.framework.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+public class TestInstantiate extends Common {
+
+
+ @Test
+ public void testInstantiateSimple() {
+ Element[] meta = getInstanceMetadata(testedBundle,
+ "org.apache.felix.ipojo.runtime.core.test" +
+ ".components" +
+ ".InstantiateSimple");
+ assertNotNull(meta);
+ assertEquals(1, meta.length);
+ assertNull(meta[0].getAttribute("name"));
+ assertEquals(0, meta[0].getElements().length);
+ }
+
+ @Test
+ public void testInstantiateWithName() {
+ // Check instance tag
+ Element[] meta = getInstanceMetadata(testedBundle, "org.apache.felix.ipojo.runtime.core.test.components" +
+ ".InstantiateWithName");
+ assertNotNull(meta);
+ assertEquals(1, meta.length);
+ assertNotNull(meta[0].getAttribute("name"));
+ assertEquals("myInstantiatedInstance", meta[0].getAttribute("name"));
+ assertEquals(0, meta[0].getElements().length);
+ }
+
+ @Test
+ public void testInstanceCreation() throws InvalidSyntaxException {
+ String in = "org.apache.felix.ipojo.runtime.core.test.components.InstantiateSimple-0";
+ ServiceReference ref = ipojoHelper.getServiceReferenceByName(org.apache.felix.ipojo.architecture.Architecture.class.getName(),
+ in);
+ assertNotNull(ref);
+ }
+
+ @Test
+ public void testInstanceCreationWithName() {
+ String in = "myInstantiatedInstance";
+ ServiceReference ref = ipojoHelper.getServiceReferenceByName(org.apache.felix.ipojo.architecture.Architecture.class.getName(),
+ in);
+ assertNotNull(ref);
+ }
+
+ /**
+ * Returns the instance metadatas of the component with the given name,
+ * defined in the given bundle.
+ *
+ * @param bundle the bundle from which the component is defined.
+ * @param component the name of the defined component.
+ * @return the list of instance metadata of the component with the given name,
+ * defined in the given bundle, or {@code null} if not found.
+ */
+ public static Element[] getInstanceMetadata(Bundle bundle, String component) {
+
+ // Retrieves the component description from the bundle's manifest.
+ String elem = (String) bundle.getHeaders().get("iPOJO-Components");
+ if (elem == null) {
+ throw new IllegalArgumentException(
+ "Cannot find iPOJO-Components descriptor in the specified bundle ("
+ + bundle.getSymbolicName()
+ + "). Not an iPOJO bundle.");
+ }
+
+ // Parses the retrieved description and find the component with the
+ // given name.
+ List<Element> list = new ArrayList<Element>();
+ try {
+ Element element = ManifestMetadataParser.parseHeaderMetadata(elem);
+ Element[] childs = element.getElements("instance");
+ for (int i = 0; i < childs.length; i++) {
+ String name = childs[i].getAttribute("component");
+ if (name != null && name.equalsIgnoreCase(component)) {
+ list.add(childs[i]);
+ }
+ }
+
+ if (list.isEmpty()) {
+ // Component not found...
+ return null;
+ } else {
+ return (Element[]) list.toArray(new Element[list.size()]);
+ }
+
+ } catch (ParseException e) {
+ throw new IllegalStateException(
+ "Cannot parse the components from specified bundle ("
+ + bundle.getSymbolicName() + "): " + e.getMessage());
+ }
+ }
+
+}
+
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestJMX.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestJMX.java
new file mode 100644
index 0000000..11666f1
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestJMX.java
@@ -0,0 +1,66 @@
+package org.apache.felix.ipojo.runtime.core.test.annotations;
+
+import org.apache.felix.ipojo.metadata.Element;
+import org.junit.Test;
+
+import static junit.framework.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+public class TestJMX extends Common {
+
+
+ @Test
+ public void testDeprecated() {
+ Element meta = ipojoHelper.getMetadata(testedBundle, "org.apache.felix.ipojo.runtime.core.test.components.jmx.JMXDeprecated");
+ /*
+ * org.apache.felix.ipojo.handlers.jmx:config domain="my-domain" usesmosgi="false"
+ org.apache.felix.ipojo.handlers.jmx:property field="m_foo" name="prop" rights="w" notification="true"
+ org.apache.felix.ipojo.handlers.jmx:method description="get the foo prop" method="getFoo"
+ org.apache.felix.ipojo.handlers.jmx:method description="set the foo prop" method="setFoo"
+ */
+
+ Element[] ele = meta.getElements("config", "org.apache.felix.ipojo.handlers.jmx");
+ assertNotNull("ele not null", ele);
+ assertEquals("Ele size", 1, ele.length);
+ String domain = ele[0].getAttribute("domain");
+ String mosgi = ele[0].getAttribute("usesmosgi");
+ assertEquals("domain", "my-domain", domain);
+ assertEquals("mosgi", "false", mosgi);
+
+ Element[] props = ele[0].getElements("property", "org.apache.felix.ipojo.handlers.jmx");
+ assertNotNull("props not null", props);
+ assertEquals("props size", 1, props.length);
+
+ Element[] methods = ele[0].getElements("method", "org.apache.felix.ipojo.handlers.jmx");
+ assertNotNull("methods not null", methods);
+ assertEquals("methods size", 2, methods.length);
+ }
+
+ @Test
+ public void test() {
+ Element meta = ipojoHelper.getMetadata(testedBundle, "org.apache.felix.ipojo.runtime.core.test.components.jmx.JMXSimple");
+ /*
+ * org.apache.felix.ipojo.handlers.jmx:config domain="my-domain" usesmosgi="false"
+ org.apache.felix.ipojo.handlers.jmx:property field="m_foo" name="prop" rights="w" notification="true"
+ org.apache.felix.ipojo.handlers.jmx:method description="get the foo prop" method="getFoo"
+ org.apache.felix.ipojo.handlers.jmx:method description="set the foo prop" method="setFoo"
+ */
+
+ Element[] ele = meta.getElements("config", "org.apache.felix.ipojo.handlers.jmx");
+ assertNotNull("ele not null", ele);
+ assertEquals("Ele size", 1, ele.length);
+ String domain = ele[0].getAttribute("domain");
+ String mosgi = ele[0].getAttribute("usesmosgi");
+ assertEquals("domain", "my-domain", domain);
+ assertEquals("mosgi", "false", mosgi);
+
+ Element[] props = ele[0].getElements("JMXProperty", "org.apache.felix.ipojo.handlers.jmx");
+ assertNotNull("props not null", props);
+ assertEquals("props size", 1, props.length);
+
+ Element[] methods = ele[0].getElements("JMXMethod", "org.apache.felix.ipojo.handlers.jmx");
+ assertNotNull("methods not null", methods);
+ assertEquals("methods size", 2, methods.length);
+ }
+
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestLifecycleCallbacks.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestLifecycleCallbacks.java
new file mode 100644
index 0000000..b114b11
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestLifecycleCallbacks.java
@@ -0,0 +1,55 @@
+package org.apache.felix.ipojo.runtime.core.test.annotations;
+
+import org.apache.felix.ipojo.metadata.Element;
+import org.junit.Test;
+
+import static junit.framework.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
+
+public class TestLifecycleCallbacks extends Common {
+
+
+ @Test
+ public void testCallbacks() {
+ Element meta = ipojoHelper.getMetadata(testedBundle, "org.apache.felix.ipojo.runtime.core.test.components.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"));
+ }
+
+ @Test
+ public void testImmediate() {
+ Element meta = ipojoHelper.getMetadata(testedBundle, "org.apache.felix.ipojo.runtime.core.test.components.Immediate");
+ assertNotNull("Immediate attribute", meta.getAttribute("immediate"));
+ assertEquals("Immediate attribute value", "true", meta.getAttribute("immediate"));
+ }
+
+ @Test
+ public void testNoImmediate() {
+ Element meta = ipojoHelper.getMetadata(testedBundle, "org.apache.felix.ipojo.runtime.core.test.components.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/runtime/core-it/src/it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestLifecycleController.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestLifecycleController.java
new file mode 100644
index 0000000..d460262
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestLifecycleController.java
@@ -0,0 +1,23 @@
+package org.apache.felix.ipojo.runtime.core.test.annotations;
+
+import org.apache.felix.ipojo.metadata.Element;
+import org.junit.Test;
+
+import static junit.framework.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+public class TestLifecycleController extends Common {
+
+ @Test
+ public void testLFC() {
+ Element meta = ipojoHelper.getMetadata(testedBundle, "org.apache.felix.ipojo.runtime.core.test.components.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/runtime/core-it/src/it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestOptionalDependency.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestOptionalDependency.java
new file mode 100644
index 0000000..eb4e190
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestOptionalDependency.java
@@ -0,0 +1,117 @@
+package org.apache.felix.ipojo.runtime.core.test.annotations;
+
+import org.apache.felix.ipojo.metadata.Element;
+import org.apache.felix.ipojo.runtime.core.test.components.ProvidesSimple;
+import org.junit.Before;
+import org.junit.Test;
+
+import static junit.framework.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
+
+public class TestOptionalDependency extends Common {
+
+ private Element[] deps;
+
+ @Before
+ public void setUp() {
+ Element meta = ipojoHelper.getMetadata(testedBundle, "org.apache.felix.ipojo.runtime.core.test.components.OptionalDependency");
+ deps = meta.getElements("requires");
+ }
+
+ @Test
+ public void testField() {
+ Element dep = getDependencyById(deps, "fs");
+ String opt = dep.getAttribute("optional");
+ assertEquals("Check optionality", "true", opt);
+ }
+
+ @Test
+ public void testFieldNoOptional() {
+ Element dep = getDependencyById(deps, "fs2");
+ String opt = dep.getAttribute("optional");
+ assertEquals("Check optionality", "false", opt);
+ }
+
+ @Test
+ public void testCallbackBind() {
+ Element dep = getDependencyById(deps, "Bar");
+ String opt = dep.getAttribute("optional");
+ assertEquals("Check optionality", "true", opt);
+ }
+
+ @Test
+ public void testCallbackUnbind() {
+ Element dep = getDependencyById(deps, "Baz");
+ String opt = dep.getAttribute("optional");
+ assertEquals("Check optionality", "true", opt);
+ }
+
+ @Test
+ public void testBoth() {
+ Element dep = getDependencyById(deps, "inv");
+ String opt = dep.getAttribute("optional");
+ assertEquals("Check optionality", "true", opt);
+ }
+
+ @Test
+ public void testBindOnly() {
+ Element dep = getDependencyById(deps, "bindonly");
+ String opt = dep.getAttribute("optional");
+ assertEquals("Check optionality", "true", opt);
+ }
+
+ @Test
+ public void testUnbindOnly() {
+ Element dep = getDependencyById(deps, "unbindonly");
+ String opt = dep.getAttribute("optional");
+ assertEquals("Check optionality", "true", opt);
+ }
+
+ @Test
+ public void testNullable() {
+ Element meta = ipojoHelper.getMetadata(testedBundle, "org.apache.felix.ipojo.runtime.core.test.components.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);
+ }
+
+ @Test
+ public void testNoNullable() {
+ Element meta = ipojoHelper.getMetadata(testedBundle, "org.apache.felix.ipojo.runtime.core.test.components.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);
+ }
+
+ @Test
+ public void testDefaultImplementation() {
+ Element meta = ipojoHelper.getMetadata(testedBundle, "org.apache.felix.ipojo.runtime.core.test.components.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", "org.apache.felix.ipojo.runtime.core.test.components.ProvidesSimple", 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;
+ }
+
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestProperties.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestProperties.java
new file mode 100644
index 0000000..0618b57
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestProperties.java
@@ -0,0 +1,170 @@
+package org.apache.felix.ipojo.runtime.core.test.annotations;
+
+import org.apache.felix.ipojo.metadata.Element;
+import org.junit.Test;
+
+import static junit.framework.Assert.*;
+
+public class TestProperties extends Common {
+
+ @Test
+ public void testProperties() {
+ Element meta = ipojoHelper.getMetadata(testedBundle, "org.apache.felix.ipojo.runtime.core.test.components.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"));
+ assertEquals("Check mandatory", "true", baa.getAttribute("mandatory"));
+
+
+ //Bar
+ Element baz = getPropertyByName(props, "baz");
+ assertEquals("Check baz method", "setbaz", baz.getAttribute("method"));
+ assertEquals("Check baz name", "baz", baz.getAttribute("name"));
+ }
+
+ @Test
+ public void testAbsentPropagation() {
+ Element meta = ipojoHelper.getMetadata(testedBundle, "org.apache.felix.ipojo.runtime.core.test.components.Properties");
+ Element[] provs = meta.getElements("properties");
+ assertNotNull("Properties exists ", provs);
+ Element prov = provs[0];
+ String att = prov.getAttribute("propagation");
+ assertNull("Propagation", att);
+ }
+
+ @Test
+ public void testPropagation() {
+ Element meta = ipojoHelper.getMetadata(testedBundle, "org.apache.felix.ipojo.runtime.core.test.components.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);
+ }
+
+ @Test
+ public void testNoPropagation() {
+ Element meta = ipojoHelper.getMetadata(testedBundle, "org.apache.felix.ipojo.runtime.core.test.components.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);
+ }
+
+ @Test
+ public void testPID() {
+ Element meta = ipojoHelper.getMetadata(testedBundle, "org.apache.felix.ipojo.runtime.core.test.components.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);
+ }
+
+ @Test
+ public void testAbsentPID() {
+ Element meta = ipojoHelper.getMetadata(testedBundle, "org.apache.felix.ipojo.runtime.core.test.components.Properties");
+ Element[] provs = meta.getElements("properties");
+ assertNotNull("Properties exists ", provs);
+ Element prov = provs[0];
+ String att = prov.getAttribute("pid");
+ assertNull("PID", att);
+ }
+
+ @Test
+ public void testPropagationAndPID() {
+ Element meta = ipojoHelper.getMetadata(testedBundle, "org.apache.felix.ipojo.runtime.core.test.components.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);
+ }
+
+ @Test
+ public void testPIDAndPropagation() {
+ Element meta = ipojoHelper.getMetadata(testedBundle, "org.apache.felix.ipojo.runtime.core.test.components.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);
+ }
+
+ @Test
+ public void testUpdatedAndPID() {
+ Element meta = ipojoHelper.getMetadata(testedBundle, "org.apache.felix.ipojo.runtime.core.test.components.UpdatedWithManagedService");
+ 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("updated");
+ assertNotNull("att", att);
+ assertEquals("Updated Value", "after", att);
+ }
+
+ @Test
+ public void testUpdatedAndProperties() {
+ Element meta = ipojoHelper.getMetadata(testedBundle, "org.apache.felix.ipojo.runtime.core.test.components.UpdatedWithProperties");
+ Element[] provs = meta.getElements("properties");
+ assertNotNull("Properties exists ", provs);
+ Element prov = provs[0];
+ String att = prov.getAttribute("pid");
+ assertNull("PID", att);
+
+ att = prov.getAttribute("updated");
+ assertNotNull("att", att);
+ assertEquals("Updated Value", "after", 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/runtime/core-it/src/it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestRankedDependency.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestRankedDependency.java
new file mode 100644
index 0000000..fd7b83f
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestRankedDependency.java
@@ -0,0 +1,79 @@
+package org.apache.felix.ipojo.runtime.core.test.annotations;
+
+import org.apache.felix.ipojo.metadata.Element;
+import org.apache.felix.ipojo.runtime.core.test.components.MyComparator;
+import org.junit.Before;
+import org.junit.Test;
+
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.fail;
+
+public class TestRankedDependency extends Common {
+
+ private Element[] deps;
+
+ @Before
+ public void setUp() {
+ Element meta = ipojoHelper.getMetadata(testedBundle, "org.apache.felix.ipojo.runtime.core.test.components.RankedDependency");
+ deps = meta.getElements("requires");
+ }
+
+ @Test
+ public void testField() {
+ Element dep = getDependencyById(deps, "fs");
+ String opt = dep.getAttribute("comparator");
+ assertEquals("Check comparator", "org.apache.felix.ipojo.runtime.core.test.components.MyComparator", opt);
+ }
+
+ @Test
+ public void testCallbackBind() {
+ Element dep = getDependencyById(deps, "Bar");
+ String opt = dep.getAttribute("comparator");
+ assertEquals("Check comparator", "org.apache.felix.ipojo.runtime.core.test.components.MyComparator", opt);
+ }
+
+ @Test
+ public void testCallbackUnbind() {
+ Element dep = getDependencyById(deps, "Baz");
+ String opt = dep.getAttribute("comparator");
+ assertEquals("Check comparator", "org.apache.felix.ipojo.runtime.core.test.components.MyComparator", opt);
+ }
+
+ @Test
+ public void testBoth() {
+ Element dep = getDependencyById(deps, "inv");
+ String opt = dep.getAttribute("comparator");
+ assertEquals("Check comparator", "org.apache.felix.ipojo.runtime.core.test.components.MyComparator", opt);
+ }
+
+ @Test
+ public void testBindOnly() {
+ Element dep = getDependencyById(deps, "bindonly");
+ String opt = dep.getAttribute("comparator");
+ assertEquals("Check comparator", "org.apache.felix.ipojo.runtime.core.test.components.MyComparator", opt);
+ }
+
+ @Test
+ public void testUnbindOnly() {
+ Element dep = getDependencyById(deps, "unbindonly");
+ String opt = dep.getAttribute("comparator");
+ assertEquals("Check comparator", "org.apache.felix.ipojo.runtime.core.test.components.MyComparator", 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;
+ }
+
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestServiceProdiving.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestServiceProdiving.java
new file mode 100644
index 0000000..a3409e3
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestServiceProdiving.java
@@ -0,0 +1,170 @@
+package org.apache.felix.ipojo.runtime.core.test.annotations;
+
+import org.apache.felix.ipojo.metadata.Element;
+import org.apache.felix.ipojo.parser.ParseUtils;
+import org.apache.felix.ipojo.runtime.core.test.services.CheckService;
+import org.apache.felix.ipojo.runtime.core.test.services.FooService;
+import org.junit.Test;
+
+import java.util.List;
+
+import static junit.framework.Assert.*;
+
+public class TestServiceProdiving extends Common {
+
+ @Test
+ public void testProvidesSimple() {
+ Element meta = ipojoHelper.getMetadata(testedBundle, "org.apache.felix.ipojo.runtime.core.test.components.ProvidesSimple");
+ Element[] provs = meta.getElements("provides");
+ assertNotNull("Provides exists ", provs);
+ }
+
+ @Test
+ public void testProvidesDouble() {
+ Element meta = ipojoHelper.getMetadata(testedBundle, "org.apache.felix.ipojo.runtime.core.test.components.ProvidesDouble");
+ Element[] provs = meta.getElements("provides");
+ assertNotNull("Provides exists ", provs);
+ }
+
+ @Test
+ public void testProvidesTriple() {
+ Element meta = ipojoHelper.getMetadata(testedBundle, "org.apache.felix.ipojo.runtime.core.test.components.ProvidesTriple");
+ Element[] provs = meta.getElements("provides");
+ assertNotNull("Provides exists ", provs);
+ Element prov = provs[0];
+ String itfs = prov.getAttribute("specifications");
+ List list = ParseUtils.parseArraysAsList(itfs);
+ assertTrue("Provides CS ", list.contains(CheckService.class.getName()));
+ }
+
+ @Test
+ public void testProvidesQuatro() {
+ Element meta = ipojoHelper.getMetadata(testedBundle, "org.apache.felix.ipojo.runtime.core.test.components.ProvidesQuatro");
+ Element[] provs = meta.getElements("provides");
+ assertNotNull("Provides exists ", provs);
+ Element prov = provs[0];
+ String itfs = prov.getAttribute("specifications");
+ List list = ParseUtils.parseArraysAsList(itfs);
+ assertTrue("Provides CS ", list.contains(CheckService.class.getName()));
+ assertTrue("Provides Foo ", list.contains(FooService.class.getName()));
+ }
+
+ @Test
+ public void testProperties() {
+ Element meta = ipojoHelper.getMetadata(testedBundle, "org.apache.felix.ipojo.runtime.core.test.components.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"));
+ assertEquals("Check mandatory value", "true", bar.getAttribute("mandatory"));
+ //Boo
+ Element boo = getPropertyByName(props, "boo");
+ assertEquals("Check boo field", "boo", boo.getAttribute("field"));
+ //Baa
+ Element baa = getPropertyByName(props, "baa");
+ assertEquals("Check baa field", "m_baa", baa.getAttribute("field"));
+ assertEquals("Check baa name", "baa", baa.getAttribute("name"));
+
+ //Bar
+ Element baz = getPropertyByName(props, "baz");
+ assertEquals("Check baz field", "m_baz", baz.getAttribute("field"));
+ assertEquals("Check baz name", "baz", baz.getAttribute("name"));
+ }
+
+ @Test
+ public void testStaticProperties() {
+ Element meta = ipojoHelper.getMetadata(testedBundle, "org.apache.felix.ipojo.runtime.core.test.components.ProvidesStaticProperties");
+ Element[] provs = meta.getElements("provides");
+ assertNotNull("Provides exists ", provs);
+ Element prov = provs[0];
+ Element[] props = prov.getElements("property");
+ assertEquals("Number of properties", props.length, 9);
+ //Prop1
+ Element foo = getPropertyByName(props, "prop1");
+ assertNull(foo.getAttribute("field"));
+ assertEquals("prop1", foo.getAttribute("value"));
+
+ //Prop2
+ Element prop2 = getPropertyByName(props, "prop2");
+ assertNull(prop2.getAttribute("field"));
+ assertNull(prop2.getAttribute("value"));
+
+ // Props
+ Element prop = getPropertyByName(props, "props");
+ assertNull(prop.getAttribute("field"));
+ assertEquals("{prop1, prop2}", prop.getAttribute("value"));
+
+ // Mandatory
+ Element mandatory = getPropertyByName(props, "mandatory1");
+ assertNull(mandatory.getAttribute("field"));
+ assertNull(mandatory.getAttribute("value"));
+ assertEquals("true", mandatory.getAttribute("mandatory"));
+
+ //Bar
+ Element bar = getPropertyByName(props, "bar");
+ assertEquals("Check bar field", "bar", bar.getAttribute("field"));
+ assertEquals("Check bar value", "4", bar.getAttribute("value"));
+ assertEquals("Check mandatory value", "true", bar.getAttribute("mandatory"));
+ //Boo
+ Element boo = getPropertyByName(props, "boo");
+ assertEquals("Check boo field", "boo", boo.getAttribute("field"));
+ //Baa
+ Element baa = getPropertyByName(props, "baa");
+ assertEquals("Check baa field", "m_baa", baa.getAttribute("field"));
+ assertEquals("Check baa name", "baa", baa.getAttribute("name"));
+
+ //Bar
+ Element baz = getPropertyByName(props, "baz");
+ assertEquals("Check baz field", "m_baz", baz.getAttribute("field"));
+ assertEquals("Check baz name", "baz", baz.getAttribute("name"));
+ }
+
+ @Test
+ public void testServiceController() {
+ Element meta = ipojoHelper.getMetadata(testedBundle, "org.apache.felix.ipojo.runtime.core.test.components.PSServiceController");
+ Element[] provs = meta.getElements("provides");
+ assertNotNull("Provides exists ", provs);
+ System.out.println(provs[0].toString());
+ assertNotNull(provs[0].getElements("controller"));
+ assertEquals(1, provs[0].getElements("controller").length);
+ assertEquals("false", provs[0].getElements("controller")[0].getAttribute("value"));
+ }
+
+ @Test
+ public void testServiceControllerWithSpecification() {
+ Element meta = ipojoHelper.getMetadata(testedBundle, "org.apache.felix.ipojo.runtime.core.test.components.PSServiceControllerSpec");
+ Element[] provs = meta.getElements("provides");
+ assertNotNull("Provides exists ", provs);
+ System.out.println(provs[0].toString());
+ assertNotNull(provs[0].getElements("controller"));
+ assertEquals(2, provs[0].getElements("controller").length);
+ assertEquals("false", provs[0].getElements("controller")[0].getAttribute("value"));
+ assertEquals(FooService.class.getName(), provs[0].getElements("controller")[0].getAttribute("specification"));
+ }
+
+ 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/runtime/core-it/src/it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestTemporalDependencies.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestTemporalDependencies.java
new file mode 100644
index 0000000..7531180
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestTemporalDependencies.java
@@ -0,0 +1,178 @@
+package org.apache.felix.ipojo.runtime.core.test.annotations;
+
+import org.apache.felix.ipojo.metadata.Element;
+import org.junit.Test;
+
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertNull;
+import static org.junit.Assert.assertNotNull;
+
+public class TestTemporalDependencies extends Common {
+
+
+ @Test
+ public void testSimple() {
+ Element meta = ipojoHelper.getMetadata(testedBundle, "org.apache.felix.ipojo.runtime.core.test.components.temporal.TemporalSimple");
+ Element[] provs = meta.getElements("requires", "org.apache.felix.ipojo.handler.temporal");
+ assertNotNull("Temporal exists ", provs);
+ String field = provs[0].getAttribute("field");
+ assertNotNull("Field not null", field);
+ assertEquals("Field is fs", "fs", field);
+ String to = provs[0].getAttribute("timeout");
+ assertNull("No timeout", to);
+ String oto = provs[0].getAttribute("onTimeout");
+ assertNull("No onTimeout", oto);
+ }
+
+ @Test
+ public void testTemporal() {
+ Element meta = ipojoHelper.getMetadata(testedBundle, "org.apache.felix.ipojo.runtime.core.test.components.temporal.Temporal");
+ Element[] provs = meta.getElements("temporal", "org.apache.felix.ipojo.handler.temporal");
+ assertNotNull("Temporal exists ", provs);
+ String field = provs[0].getAttribute("field");
+ assertNotNull("Field not null", field);
+ assertEquals("Field is fs", "fs", field);
+ String to = provs[0].getAttribute("timeout");
+ assertNull("No timeout", to);
+ String oto = provs[0].getAttribute("onTimeout");
+ assertNull("No onTimeout", oto);
+ }
+
+ @Test
+ public void testDI() {
+ Element meta = ipojoHelper.getMetadata(testedBundle, "org.apache.felix.ipojo.runtime.core.test.components.temporal.TemporalWithDI");
+ Element[] provs = meta.getElements("requires", "org.apache.felix.ipojo.handler.temporal");
+ assertNotNull("Temporal exists ", provs);
+ String field = provs[0].getAttribute("field");
+ assertNotNull("Field not null", field);
+ assertEquals("Field is fs", "fs", field);
+
+ String oto = provs[0].getAttribute("onTimeout");
+ assertEquals("onTimeout is the DI", "org.apache.felix.ipojo.runtime.core.test.components.ProvidesSimple", oto);
+
+ }
+
+ @Test
+ public void testEmptyArray() {
+ Element meta = ipojoHelper.getMetadata(testedBundle, "org.apache.felix.ipojo.runtime.core.test.components.temporal.TemporalWithEmptyArray");
+ Element[] provs = meta.getElements("requires", "org.apache.felix.ipojo.handler.temporal");
+ assertNotNull("Temporal exists ", provs);
+ String field = provs[0].getAttribute("field");
+ assertNotNull("Field not null", field);
+ assertEquals("Field is fs", "fs", field);
+
+ String oto = provs[0].getAttribute("onTimeout");
+ assertEquals("onTimeout is empty-array", "empty-array", oto);
+
+ }
+
+ @Test
+ public void testNull() {
+ Element meta = ipojoHelper.getMetadata(testedBundle, "org.apache.felix.ipojo.runtime.core.test.components.temporal.TemporalWithNull");
+ Element[] provs = meta.getElements("requires", "org.apache.felix.ipojo.handler.temporal");
+ assertNotNull("Temporal exists ", provs);
+ String field = provs[0].getAttribute("field");
+ assertNotNull("Field not null", field);
+ assertEquals("Field is fs", "fs", field);
+
+ String oto = provs[0].getAttribute("onTimeout");
+ assertEquals("onTimeout is null", "null", oto);
+
+ }
+
+ @Test
+ public void testNullable() {
+ Element meta = ipojoHelper.getMetadata(testedBundle, "org.apache.felix.ipojo.runtime.core.test.components.temporal.TemporalWithNullable");
+ Element[] provs = meta.getElements("requires", "org.apache.felix.ipojo.handler.temporal");
+ assertNotNull("Temporal exists ", provs);
+ String field = provs[0].getAttribute("field");
+ assertNotNull("Field not null", field);
+ assertEquals("Field is fs", "fs", field);
+
+ String oto = provs[0].getAttribute("onTimeout");
+ assertEquals("onTimeout is nullable", "nullable", oto);
+
+ }
+
+ @Test
+ public void testFilter() {
+ Element meta = ipojoHelper.getMetadata(testedBundle, "org.apache.felix.ipojo.runtime.core.test.components.temporal.TemporalWithFilter");
+ Element[] provs = meta.getElements("requires", "org.apache.felix.ipojo.handler.temporal");
+ assertNotNull("Temporal exists ", provs);
+ String field = provs[0].getAttribute("field");
+ assertNotNull("Field not null", field);
+ assertEquals("Field is fs", "fs", field);
+
+ String filter = provs[0].getAttribute("filter");
+ assertEquals("Filter", "(vendor=clement)", filter);
+
+ }
+
+ @Test
+ public void testTimeout() {
+ Element meta = ipojoHelper.getMetadata(testedBundle, "org.apache.felix.ipojo.runtime.core.test.components.temporal.TemporalWithTimeout");
+ Element[] provs = meta.getElements("requires", "org.apache.felix.ipojo.handler.temporal");
+ assertNotNull("Temporal exists ", provs);
+ String field = provs[0].getAttribute("field");
+ assertNotNull("Field not null", field);
+ assertEquals("Field is fs", "fs", field);
+
+ String to = provs[0].getAttribute("timeout");
+ assertEquals("Check timeout", "100", to);
+
+ }
+
+ @Test
+ public void testSimpleCollection() {
+ Element meta = ipojoHelper.getMetadata(testedBundle, "org.apache.felix.ipojo.runtime.core.test.components.temporal.TemporalCollection");
+ Element dep = getElementPerField(meta, "fs1");
+ String spec = dep.getAttribute("specification");
+ assertNotNull("Specification not null", spec);
+ assertEquals("Check specification", "org.apache.felix.ipojo.runtime.core.test.services.FooService", spec);
+ }
+
+ @Test
+ public void testCollectionWithTimeout() {
+ Element meta = ipojoHelper.getMetadata(testedBundle, "org.apache.felix.ipojo.runtime.core.test.components.temporal.TemporalCollection");
+ Element dep = getElementPerField(meta, "fs2");
+ String spec = dep.getAttribute("specification");
+ assertNotNull("Specification not null", spec);
+ assertEquals("Check specification", "org.apache.felix.ipojo.runtime.core.test.services.FooService", spec);
+ String to = dep.getAttribute("timeout");
+ assertEquals("Check timeout", "300", to);
+ }
+
+ @Test
+ public void testCollectionWithPolicy() {
+ Element meta = ipojoHelper.getMetadata(testedBundle, "org.apache.felix.ipojo.runtime.core.test.components.temporal.TemporalCollection");
+ Element dep = getElementPerField(meta, "fs3");
+ String spec = dep.getAttribute("specification");
+ assertNotNull("Specification not null", spec);
+ assertEquals("Check specification", "org.apache.felix.ipojo.runtime.core.test.services.FooService", spec);
+ String to = dep.getAttribute("ontimeout");
+ assertEquals("Check policy", "empty", to);
+ }
+
+ @Test
+ public void testCollectionWithProxy() {
+ Element meta = ipojoHelper.getMetadata(testedBundle, "org.apache.felix.ipojo.runtime.core.test.components.temporal.TemporalCollection");
+ Element dep = getElementPerField(meta, "fs4");
+ String spec = dep.getAttribute("specification");
+ assertNotNull("Specification not null", spec);
+ assertEquals("Check specification", "org.apache.felix.ipojo.runtime.core.test.services.FooService", spec);
+ String proxy = dep.getAttribute("proxy");
+ assertEquals("Check proxy", "true", proxy);
+ }
+
+ private Element getElementPerField(Element elem, String field) {
+ Element[] provs = elem.getElements("requires", "org.apache.felix.ipojo.handler.temporal");
+ assertNotNull("Temporal exists ", provs);
+ for (int i = 0; i < provs.length; i++) {
+ if (provs[i].getAttribute("field").equals(field)) {
+ return provs[i];
+ }
+ }
+ return null;
+ }
+
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestWhiteBoard.java b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestWhiteBoard.java
new file mode 100644
index 0000000..32ce6d2
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestWhiteBoard.java
@@ -0,0 +1,89 @@
+package org.apache.felix.ipojo.runtime.core.test.annotations;
+
+import org.apache.felix.ipojo.metadata.Element;
+import org.junit.Test;
+
+import static junit.framework.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+public class TestWhiteBoard extends Common {
+
+ String typeWI = "org.apache.felix.ipojo.runtime.core.test.components.whiteboard.WhiteBoardWIModification";
+ String typeWO = "org.apache.felix.ipojo.runtime.core.test.components.whiteboard.WhiteBoardWOModification";
+ String typeWhiteboards = "org.apache.felix.ipojo.runtime.core.test.components.whiteboard.WhiteBoards";
+ String namespace = "org.apache.felix.ipojo.whiteboard";
+
+
+ @Test
+ public void testMetadataWithOnModification() {
+ Element meta = ipojoHelper.getMetadata(testedBundle, typeWI);
+ assertNotNull("Check meta", meta);
+ Element[] ext = meta.getElements("wbp", namespace);
+ assertEquals("Check size", 1, ext.length);
+ String filter = ext[0].getAttribute("filter");
+ String onArr = ext[0].getAttribute("onArrival");
+ String onDep = ext[0].getAttribute("onDeparture");
+ String onMod = ext[0].getAttribute("onModification");
+
+
+ assertEquals("Check filter", "(foo=true)", filter);
+ assertEquals("Check onArrival", "onArrival", onArr);
+ assertEquals("Check onDeparture", "onDeparture", onDep);
+ assertEquals("Check onModification", "onModification", onMod);
+
+ }
+
+ @Test
+ public void testMetadataWithoutOnModification() {
+ Element meta = ipojoHelper.getMetadata(testedBundle, typeWO);
+ assertNotNull("Check meta", meta);
+ Element[] ext = meta.getElements("wbp", namespace);
+ assertEquals("Check size", 1, ext.length);
+ String filter = ext[0].getAttribute("filter");
+ String onArr = ext[0].getAttribute("onArrival");
+ String onDep = ext[0].getAttribute("onDeparture");
+ String onMod = ext[0].getAttribute("onModification");
+
+
+ assertEquals("Check filter", "(foo=true)", filter);
+ assertEquals("Check onArrival", "onArrival", onArr);
+ assertEquals("Check onDeparture", "onDeparture", onDep);
+ assertNull("Check onModification", onMod);
+
+ }
+
+ @Test
+ public void testWhiteboards() {
+ Element meta = ipojoHelper.getMetadata(testedBundle, typeWhiteboards);
+ assertNotNull("Check meta", meta);
+ Element[] ext = meta.getElements("whiteboards", namespace);
+ assertEquals("Check size", 1, ext.length);
+
+ // Two sub-element
+ Element[] wbps = ext[0].getElements("wbp", namespace);
+ assertEquals("Check size", 2, wbps.length);
+
+ String filter = wbps[0].getAttribute("filter");
+ String onArr = wbps[0].getAttribute("onArrival");
+ String onDep = wbps[0].getAttribute("onDeparture");
+ String onMod = wbps[0].getAttribute("onModification");
+
+ assertEquals("Check filter", "(foo=true)", filter);
+ assertEquals("Check onArrival", "onArrival", onArr);
+ assertEquals("Check onDeparture", "onDeparture", onDep);
+ assertNull("Check onModification", onMod);
+
+ filter = wbps[1].getAttribute("filter");
+ onArr = wbps[1].getAttribute("onArrival");
+ onDep = wbps[1].getAttribute("onDeparture");
+ onMod = wbps[1].getAttribute("onModification");
+
+ assertEquals("Check filter", "(foo=true)", filter);
+ assertEquals("Check onArrival", "onArrival", onArr);
+ assertEquals("Check onDeparture", "onDeparture", onDep);
+ assertEquals("Check onModification", "onModification", onMod);
+ }
+
+
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/ipojo-core-configuration-test.iml b/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/ipojo-core-configuration-test.iml
new file mode 100644
index 0000000..55ea078
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/ipojo-core-configuration-test.iml
@@ -0,0 +1,91 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
+ <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_6" inherit-compiler-output="false">
+ <output url="file://$MODULE_DIR$/target/classes" />
+ <output-test url="file://$MODULE_DIR$/target/test-classes" />
+ <content url="file://$MODULE_DIR$">
+ <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/src/main/resources" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
+ <sourceFolder url="file://$MODULE_DIR$/src/test/resources" isTestSource="true" />
+ <excludeFolder url="file://$MODULE_DIR$/target" />
+ </content>
+ <orderEntry type="inheritedJdk" />
+ <orderEntry type="sourceFolder" forTests="false" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.ops4j.pax.exam:pax-exam-container-native:3.0.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.ops4j.pax.exam:pax-exam:3.0.0" level="project" />
+ <orderEntry type="library" name="Maven: org.ops4j.base:ops4j-base-lang:1.4.0" level="project" />
+ <orderEntry type="library" name="Maven: org.ops4j.base:ops4j-base-store:1.2.3" level="project" />
+ <orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.5.11" level="project" />
+ <orderEntry type="library" name="Maven: org.ops4j.base:ops4j-base-io:1.2.3" level="project" />
+ <orderEntry type="library" name="Maven: org.ops4j.base:ops4j-base-monitors:1.4.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.ops4j.base:ops4j-base-util-property:1.4.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.ops4j.pax.exam:pax-exam-spi:3.0.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.ops4j.base:ops4j-base-spi:1.4.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: com.google.guava:guava:12.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: com.google.code.findbugs:jsr305:1.3.9" level="project" />
+ <orderEntry type="library" name="Maven: org.ops4j.pax.tinybundles:tinybundles:1.0.0" level="project" />
+ <orderEntry type="library" name="Maven: biz.aQute:bndlib:1.43.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.glassfish.main.common:scattered-archive-api:3.1.2.2" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.ops4j.pax.swissbox:pax-swissbox-core:1.6.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.ops4j.pax.swissbox:pax-swissbox-lifecycle:1.6.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.ops4j.pax.swissbox:pax-swissbox-tracker:1.6.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.ops4j.base:ops4j-base-net:1.4.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.ops4j.pax.url:pax-url-link:1.5.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.ops4j.pax.url:pax-url-commons:1.5.1" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.ops4j.pax.swissbox:pax-swissbox-property:1.5.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.ops4j.pax.url:pax-url-classpath:1.5.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.ops4j.pax.swissbox:pax-swissbox-optional-jcl:1.5.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.ops4j.pax.exam:pax-exam-junit4:3.0.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.9" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.1" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.ops4j.pax.exam:pax-exam-link-mvn:3.0.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.ops4j.pax.url:pax-url-aether:1.5.1" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.ops4j.pax.url:pax-url-maven-commons:1.5.1" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.ops4j.base:ops4j-base-util-xml:1.3.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.ops4j.base:ops4j-base-util-collections:1.3.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.sonatype.aether:aether-api:1.13.1" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.sonatype.aether:aether-spi:1.13.1" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.sonatype.aether:aether-util:1.13.1" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.sonatype.aether:aether-impl:1.13.1" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.sonatype.aether:aether-connector-wagon:1.13.1" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.apache.maven.wagon:wagon-provider-api:1.0-beta-7" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.codehaus.plexus:plexus-utils:3.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.codehaus.plexus:plexus-classworlds:2.4" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.sonatype.sisu:sisu-inject-plexus:2.2.3" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.codehaus.plexus:plexus-component-annotations:1.5.5" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.sonatype.sisu:sisu-inject-bean:2.2.3" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.sonatype.sisu:sisu-guice:no_aop:3.0.3" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.apache.maven:maven-aether-provider:3.0.4" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.apache.maven:maven-model:3.0.4" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.apache.maven:maven-model-builder:3.0.4" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.codehaus.plexus:plexus-interpolation:1.14" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.apache.maven:maven-repository-metadata:3.0.4" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.apache.maven.wagon:wagon-file:1.0-beta-7" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.apache.maven.wagon:wagon-http-lightweight:1.0-beta-7" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.apache.maven.wagon:wagon-http-shared:1.0-beta-7" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.codehaus.plexus:plexus-container-default:1.5.5" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.apache.xbean:xbean-reflect:3.4" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: com.google.collections:google-collections:1.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: commons-httpclient:commons-httpclient:3.1" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: commons-codec:commons-codec:1.2" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: commons-logging:commons-logging:1.0.4" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.apache.felix:org.apache.felix.framework:4.2.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: ch.qos.logback:logback-core:0.9.6" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: ch.qos.logback:logback-classic:0.9.6" level="project" />
+ <orderEntry type="library" name="Maven: org.apache.felix:org.apache.felix.ipojo:1.9.0-SNAPSHOT" level="project" />
+ <orderEntry type="library" name="Maven: org.osgi:org.osgi.core:4.3.1" level="project" />
+ <orderEntry type="library" name="Maven: org.osgi:org.osgi.compendium:4.0.0" level="project" />
+ <orderEntry type="library" name="Maven: org.apache.felix:org.apache.felix.ipojo.metadata:1.6.0" level="project" />
+ <orderEntry type="library" name="Maven: org.apache.felix:org.apache.felix.ipojo.manipulator:1.9.0-SNAPSHOT" level="project" />
+ <orderEntry type="library" name="Maven: asm:asm-all:3.3.1" level="project" />
+ <orderEntry type="library" name="Maven: org.apache.felix:org.apache.felix.ipojo.annotations:1.8.0" level="project" />
+ <orderEntry type="library" name="Maven: commons-io:commons-io:2.4" level="project" />
+ <orderEntry type="module" module-name="osgi-helpers" scope="TEST" />
+ <orderEntry type="module" module-name="tinybundles-ipojo" />
+ <orderEntry type="library" name="Maven: xerces:xercesImpl:2.4.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.easymock:easymock:2.4" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.mockito:mockito-all:1.7" level="project" />
+ </component>
+</module>
+
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/pom.xml b/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/pom.xml
new file mode 100644
index 0000000..192c01d
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/pom.xml
@@ -0,0 +1,153 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <parent>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.ipojo.runtime.core-it</artifactId>
+ <version>1.9.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.apache.felix</groupId>
+ <artifactId>ipojo-core-configuration-test</artifactId>
+ <version>1.0-SNAPSHOT</version>
+
+ <name>${project.artifactId}</name>
+
+ <properties>
+ <exam.version>3.0.0</exam.version>
+ <url.version>1.5.1</url.version>
+ </properties>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.ops4j.pax.exam</groupId>
+ <artifactId>pax-exam-container-native</artifactId>
+ <version>${exam.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.ops4j.pax.exam</groupId>
+ <artifactId>pax-exam-junit4</artifactId>
+ <version>${exam.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.ops4j.pax.exam</groupId>
+ <artifactId>pax-exam-link-mvn</artifactId>
+ <version>${exam.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.ops4j.pax.url</groupId>
+ <artifactId>pax-url-aether</artifactId>
+ <version>${url.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.framework</artifactId>
+ <version>4.2.0</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-core</artifactId>
+ <version>0.9.6</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-classic</artifactId>
+ <version>0.9.6</version>
+ <scope>test</scope>
+ </dependency>
+
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.9</version>
+ <scope>test</scope>
+ </dependency>
+
+
+ <dependency>
+ <groupId>org.ops4j.pax.tinybundles</groupId>
+ <artifactId>tinybundles</artifactId>
+ <version>1.0.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.ipojo</artifactId>
+ <version>1.9.0-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.ipojo.manipulator</artifactId>
+ <version>1.9.0-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>2.4</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.ow2.chameleon.testing</groupId>
+ <artifactId>osgi-helpers</artifactId>
+ <version>0.5.0-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.ow2.chameleon.testing</groupId>
+ <artifactId>tinybundles-ipojo</artifactId>
+ <version>0.3.0-SNAPSHOT</version>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.5.1</version>
+ <configuration>
+ <source>1.6</source>
+ <target>1.6</target>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.servicemix.tooling</groupId>
+ <artifactId>depends-maven-plugin</artifactId>
+ <version>1.2</version>
+ <executions>
+ <execution>
+ <id>generate-config</id>
+ <goals>
+ <goal>generate-depends-file</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
\ No newline at end of file
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CheckProviderParentClass.java b/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CheckProviderParentClass.java
new file mode 100644
index 0000000..7d18712
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/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.runtime.core.components;
+
+import org.apache.felix.ipojo.runtime.core.services.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/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CheckServiceProvider.java b/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CheckServiceProvider.java
new file mode 100644
index 0000000..eee88a2
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/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.runtime.core.components;
+
+import org.apache.felix.ipojo.runtime.core.services.CheckService;
+import org.apache.felix.ipojo.runtime.core.services.FooService;
+import org.osgi.framework.ServiceReference;
+
+import java.util.Properties;
+
+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/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ComplexConfiguration.java b/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ComplexConfiguration.java
new file mode 100644
index 0000000..b7018b6
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ComplexConfiguration.java
@@ -0,0 +1,38 @@
+package org.apache.felix.ipojo.runtime.core.components;
+
+import org.apache.felix.ipojo.runtime.core.services.CheckService;
+
+import java.util.Dictionary;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+public class ComplexConfiguration implements CheckService {
+
+ private List m_list;
+ private Map m_map;
+ private Dictionary m_dict;
+ private String[] m_array;
+
+ private List m_complexList;
+ private Map m_complexMap;
+ private Object[] m_complexArray;
+
+ public boolean check() {
+ return true;
+ }
+
+
+ public Properties getProps() {
+ Properties props = new Properties();
+ props.put("list", m_list);
+ props.put("map", m_map);
+ props.put("dict", m_dict);
+ props.put("array", m_array);
+ props.put("complex-list", m_complexList);
+ props.put("complex-map", m_complexMap);
+ props.put("complex-array", m_complexArray);
+ return props;
+ }
+
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ConfigurableCheckServiceProvider.java b/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ConfigurableCheckServiceProvider.java
new file mode 100644
index 0000000..5666059
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ConfigurableCheckServiceProvider.java
@@ -0,0 +1,223 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.ipojo.runtime.core.components;
+
+import org.apache.felix.ipojo.runtime.core.services.CheckService;
+
+import java.util.Properties;
+
+public class ConfigurableCheckServiceProvider implements CheckService {
+
+ // Integer types
+ byte b;
+ short s;
+ int i;
+ long l;
+
+ // Floatting types
+ double d;
+ float f;
+
+ // Character
+ char c;
+
+ // Boolean
+ boolean bool;
+
+ // Integer arrays
+ byte[] bs;
+ short[] ss;
+ int[] is;
+ long[] ls;
+
+ double[] ds;
+ float[] fs;
+
+ char[] cs;
+
+ boolean[] bools;
+
+ String string;
+ String[] strings;
+
+ int upB, upS, upI, upL, upD, upF, upC, upBool, upBs, upSs, upIs, upLs, upDs, upFs, upCs, upBools, upString, upStrings;
+
+
+ public boolean check() {
+ return true;
+ }
+
+ public Properties getProps() {
+ Properties props = new Properties();
+ props.put("b", new Byte(b));
+ props.put("s", new Short(s));
+ props.put("i", new Integer(i));
+ props.put("l", new Long(l));
+ props.put("d", new Double(d));
+ props.put("f", new Float(f));
+ props.put("c", new Character(c));
+ props.put("bool", new Boolean(bool));
+
+ if (bs != null) {
+ props.put("bs", bs);
+ }
+ if (ss != null) {
+ props.put("ss", ss);
+ }
+ if (is != null) {
+ props.put("is", is);
+ }
+ if (ls != null) {
+ props.put("ls", ls);
+ }
+ if (ds != null) {
+ props.put("ds", ds);
+ }
+ if (fs != null) {
+ props.put("fs", fs);
+ }
+ if (cs != null) {
+ props.put("cs", cs);
+ }
+ if (bools != null) {
+ props.put("bools", bools);
+ }
+
+ props.put("upb", new Integer(upB));
+ props.put("ups", new Integer(upS));
+ props.put("upi", new Integer(upI));
+ props.put("upl", new Integer(upL));
+ props.put("upd", new Integer(upD));
+ props.put("upf", new Integer(upF));
+ props.put("upc", new Integer(upC));
+ props.put("upbool", new Integer(upBool));
+
+ props.put("upbs", new Integer(upBs));
+ props.put("upss", new Integer(upSs));
+ props.put("upis", new Integer(upIs));
+ props.put("upls", new Integer(upLs));
+ props.put("upds", new Integer(upDs));
+ props.put("upfs", new Integer(upFs));
+ props.put("upcs", new Integer(upCs));
+ props.put("upbools", new Integer(upBools));
+
+ if (string != null) {
+ props.put("string", string);
+ }
+ if (string != null) {
+ props.put("strings", strings);
+ }
+
+ props.put("upstring", new Integer(upString));
+ props.put("upstrings", new Integer(upStrings));
+
+ return props;
+ }
+
+ public void updateB(byte bb) {
+ b = bb;
+ upB++;
+ }
+
+ public void updateS(short bb) {
+ s = bb;
+ upS++;
+ }
+
+ public void updateI(int bb) {
+ i = bb;
+ upI++;
+ }
+
+ public void updateL(long bb) {
+ l = bb;
+ upL++;
+ }
+
+ public void updateD(double bb) {
+ d = bb;
+ upD++;
+ }
+
+ public void updateF(float bb) {
+ f = bb;
+ upF++;
+ }
+
+ public void updateC(char bb) {
+ c = bb;
+ upC++;
+ }
+
+ public void updateBool(boolean bb) {
+ bool = bb;
+ upBool++;
+ }
+
+ public void updateBs(byte[] bb) {
+ bs = bb;
+ upBs++;
+ }
+
+ public void updateSs(short[] bb) {
+ ss = bb;
+ upSs++;
+ }
+
+ public void updateIs(int[] bb) {
+ is = bb;
+ upIs++;
+ }
+
+ public void updateLs(long[] bb) {
+ ls = bb;
+ upLs++;
+ }
+
+ public void updateDs(double[] bb) {
+ ds = bb;
+ upDs++;
+ }
+
+ public void updateFs(float[] bb) {
+ fs = bb;
+ upFs++;
+ }
+
+ public void updateCs(char[] bb) {
+ cs = bb;
+ upCs++;
+ }
+
+ public void updateBools(boolean[] bb) {
+ bools = bb;
+ upBools++;
+ }
+
+ public void updateStrings(String[] bb) {
+ strings = bb;
+ upStrings++;
+ }
+
+ public void updateString(String bb) {
+ string = bb;
+ upString++;
+ }
+
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderType1.java b/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderType1.java
new file mode 100644
index 0000000..43725ab
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderType1.java
@@ -0,0 +1,133 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.ipojo.runtime.core.components;
+
+import org.apache.felix.ipojo.runtime.core.services.FooService;
+import org.osgi.framework.BundleContext;
+
+import java.util.Dictionary;
+import java.util.Properties;
+
+public class FooProviderType1 implements FooService {
+
+ private int m_bar;
+ private String m_foo;
+
+ private BundleContext m_context;
+
+ private static FooProviderType1 singleton;
+ private static int count = 0;
+
+ private int updated;
+ private Dictionary lastupdated;
+
+ private static FooProviderType1 singleton(BundleContext bc) {
+ if (singleton == null) {
+ count++;
+ singleton = new FooProviderType1(bc);
+ }
+ return singleton;
+ }
+
+ public static FooProviderType1 several(BundleContext bc) {
+ count++;
+ return new FooProviderType1(bc);
+ }
+
+ public FooProviderType1(BundleContext bc) {
+ if (bc ==null) {
+ throw new RuntimeException("Injected bundle context null");
+ }
+ m_context = bc;
+ }
+
+ public boolean foo() {
+ return true;
+ }
+
+ public Properties fooProps() {
+ Properties p = new Properties();
+ p.put("bar", new Integer(m_bar));
+ if(m_foo != null) {
+ p.put("foo", m_foo);
+ }
+ p.put("context", m_context);
+
+ p.put("count", new Integer(count));
+
+ p.put("updated", new Integer(updated));
+ if (lastupdated != null) {
+ p.put("lastupdated", lastupdated);
+ }
+
+
+ return p;
+ }
+
+ public void testException() throws Exception {
+ String a = "foobarbaz";
+ throw new Exception("foo"+a);
+ }
+
+ public void testTry() {
+ String a = "foo";
+ a.charAt(0);
+ }
+
+ public void testTry2(String s) {
+ String a = "foo";
+ a.charAt(0);
+ }
+
+ private void nexttry(String s) {
+ try {
+ s += "foo";
+ } catch(RuntimeException e) {
+
+ }
+ }
+
+ public boolean getBoolean() { return true; }
+
+ public double getDouble() { return 1.0; }
+
+ public int getInt() { return 1; }
+
+ public long getLong() { return 1; }
+
+ public Boolean getObject() { return new Boolean(true); }
+
+ /**
+ * Custom constructor.
+ * @param bar
+ * @param foo
+ * @param bc
+ */
+ public FooProviderType1(int bar, String foo, BundleContext bc) {
+ m_bar = bar;
+ m_foo = foo;
+ m_context = bc;
+ }
+
+ public void updated(Dictionary props) {
+ updated++;
+ lastupdated = props;
+ }
+
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderType2.java b/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderType2.java
new file mode 100644
index 0000000..97d20d5
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderType2.java
@@ -0,0 +1,114 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.ipojo.runtime.core.components;
+
+import org.apache.felix.ipojo.runtime.core.services.FooService;
+import org.osgi.framework.BundleContext;
+
+import java.util.Properties;
+
+public class FooProviderType2 implements FooService {
+
+ private int m_bar;
+ private String m_foo;
+
+ private BundleContext m_context;
+
+ private static int count = 0;
+
+ private int updated;
+
+
+ public FooProviderType2(BundleContext bc) {
+ if (bc ==null) {
+ throw new RuntimeException("Injected bundle context null");
+ }
+ m_context = bc;
+ }
+
+ public boolean foo() {
+ return true;
+ }
+
+ public Properties fooProps() {
+ Properties p = new Properties();
+ p.put("bar", new Integer(m_bar));
+ if(m_foo != null) {
+ p.put("foo", m_foo);
+ }
+ p.put("context", m_context);
+
+ p.put("count", new Integer(count));
+
+ p.put("updated", new Integer(updated));
+
+
+ return p;
+ }
+
+ public void testException() throws Exception {
+ String a = "foobarbaz";
+ throw new Exception("foo"+a);
+ }
+
+ public void testTry() {
+ String a = "foo";
+ a.charAt(0);
+ }
+
+ public void testTry2(String s) {
+ String a = "foo";
+ a.charAt(0);
+ }
+
+ private void nexttry(String s) {
+ try {
+ s += "foo";
+ } catch(RuntimeException e) {
+
+ }
+ }
+
+ public boolean getBoolean() { return true; }
+
+ public double getDouble() { return 1.0; }
+
+ public int getInt() { return 1; }
+
+ public long getLong() { return 1; }
+
+ public Boolean getObject() { return new Boolean(true); }
+
+ /**
+ * Custom constructor.
+ * @param bar
+ * @param foo
+ * @param bc
+ */
+ public FooProviderType2(int bar, String foo, BundleContext bc) {
+ m_bar = bar;
+ m_foo = foo;
+ m_context = bc;
+ }
+
+ public void updated() {
+ updated++;
+ }
+
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderTypeDyn.java b/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderTypeDyn.java
new file mode 100644
index 0000000..9c7d088
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderTypeDyn.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.runtime.core.components;
+
+import org.apache.felix.ipojo.runtime.core.services.FooService;
+
+import java.util.Dictionary;
+import java.util.Properties;
+
+public class FooProviderTypeDyn implements FooService {
+
+ private int intProp;
+ private String strProp;
+ private String[] strAProp;
+ private int[] intAProp;
+ private boolean boolProp;
+ private int updated;
+ private Dictionary lastUpdate;
+
+ public boolean foo() {
+ intProp = 3;
+ boolProp = true;
+ if(strProp == null || strProp.equals("foo")) { strProp = "bar"; }
+ else { strProp = "foo"; }
+ strAProp = new String[] {"foo", "bar", "baz"};
+ intAProp = new int[] {3, 2, 1};
+ return true;
+ }
+
+ public Properties fooProps() {
+ Properties p = new Properties();
+ p.put("intProp", new Integer(intProp));
+ p.put("boolProp", new Boolean(boolProp));
+ if (strProp != null) {
+ p.put("strProp", strProp);
+ }
+ if (strAProp != null) {
+ p.put("strAProp", strAProp);
+ }
+ if (intAProp != null) {
+ p.put("intAProp", intAProp);
+ }
+
+ p.put("updated", new Integer(updated));
+ if (lastUpdate != null) {
+ p.put("lastupdated", lastUpdate);
+ }
+
+ return p;
+ }
+
+ public boolean getBoolean() { return true; }
+
+ public double getDouble() { return 1.0; }
+
+ public int getInt() { return 1; }
+
+ public long getLong() { return 1; }
+
+ public Boolean getObject() { return new Boolean(true); }
+
+ public void updated(Dictionary props) {
+ updated++;
+ lastUpdate = props;
+ }
+
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ParentClass.java b/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ParentClass.java
new file mode 100644
index 0000000..7f77bd1
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ParentClass.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.runtime.core.components;
+
+public class ParentClass {
+
+ public void parentStart() {
+
+ }
+
+ public void parentStop() {
+
+ }
+
+ protected String[] strings;
+
+ protected String string;
+
+ protected int upStrings;
+
+ protected int upString;
+
+ public void updateStrings(String[] bb) {
+ strings = bb;
+ upStrings++;
+ }
+
+ public void updateString(String bb) {
+ string = bb;
+ upString++;
+ }
+
+
+
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ParentConfigurableCheckServiceProvider.java b/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ParentConfigurableCheckServiceProvider.java
new file mode 100644
index 0000000..8a4de5d
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ParentConfigurableCheckServiceProvider.java
@@ -0,0 +1,194 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.ipojo.runtime.core.components;
+
+import org.apache.felix.ipojo.runtime.core.services.CheckService;
+
+import java.util.Properties;
+
+public class ParentConfigurableCheckServiceProvider extends ParentClass implements CheckService {
+
+ // Integer types
+ byte b;
+ short s;
+ int i;
+ long l;
+
+ // Floatting types
+ double d;
+ float f;
+
+ // Character
+ char c;
+
+ // Boolean
+ boolean bool;
+
+ // Integer arrays
+ byte[] bs;
+ short[] ss;
+ int[] is;
+ long[] ls;
+
+ double[] ds;
+ float[] fs;
+
+ char[] cs;
+
+ boolean[] bools;
+
+ //String string;
+ //String[] strings;
+
+ int upB, upS, upI, upL, upD, upF, upC, upBool, upBs, upSs, upIs, upLs, upDs, upFs, upCs, upBools/*, upString, upStrings*/;
+
+
+ public boolean check() {
+ return true;
+ }
+
+ public Properties getProps() {
+ Properties props = new Properties();
+ props.put("b", new Byte(b));
+ props.put("s", new Short(s));
+ props.put("i", new Integer(i));
+ props.put("l", new Long(l));
+ props.put("d", new Double(d));
+ props.put("f", new Float(f));
+ props.put("c", new Character(c));
+ props.put("bool", new Boolean(bool));
+
+ props.put("bs", bs);
+ props.put("ss", ss);
+ props.put("is", is);
+ props.put("ls", ls);
+ props.put("ds", ds);
+ props.put("fs", fs);
+ props.put("cs", cs);
+ props.put("bools", bools);
+
+ props.put("upb", new Integer(upB));
+ props.put("ups", new Integer(upS));
+ props.put("upi", new Integer(upI));
+ props.put("upl", new Integer(upL));
+ props.put("upd", new Integer(upD));
+ props.put("upf", new Integer(upF));
+ props.put("upc", new Integer(upC));
+ props.put("upbool", new Integer(upBool));
+
+ props.put("upbs", new Integer(upBs));
+ props.put("upss", new Integer(upSs));
+ props.put("upis", new Integer(upIs));
+ props.put("upls", new Integer(upLs));
+ props.put("upds", new Integer(upDs));
+ props.put("upfs", new Integer(upFs));
+ props.put("upcs", new Integer(upCs));
+ props.put("upbools", new Integer(upBools));
+
+ props.put("string", string);
+ props.put("strings", strings);
+ props.put("upstring", new Integer(upString));
+ props.put("upstrings", new Integer(upStrings));
+
+ return props;
+ }
+
+ public void updateB(byte bb) {
+ b = bb;
+ upB++;
+ }
+
+ public void updateS(short bb) {
+ s = bb;
+ upS++;
+ }
+
+ public void updateI(int bb) {
+ i = bb;
+ upI++;
+ }
+
+ public void updateL(long bb) {
+ l = bb;
+ upL++;
+ }
+
+ public void updateD(double bb) {
+ d = bb;
+ upD++;
+ }
+
+ public void updateF(float bb) {
+ f = bb;
+ upF++;
+ }
+
+ public void updateC(char bb) {
+ c = bb;
+ upC++;
+ }
+
+ public void updateBool(boolean bb) {
+ bool = bb;
+ upBool++;
+ }
+
+ public void updateBs(byte[] bb) {
+ bs = bb;
+ upBs++;
+ }
+
+ public void updateSs(short[] bb) {
+ ss = bb;
+ upSs++;
+ }
+
+ public void updateIs(int[] bb) {
+ is = bb;
+ upIs++;
+ }
+
+ public void updateLs(long[] bb) {
+ ls = bb;
+ upLs++;
+ }
+
+ public void updateDs(double[] bb) {
+ ds = bb;
+ upDs++;
+ }
+
+ public void updateFs(float[] bb) {
+ fs = bb;
+ upFs++;
+ }
+
+ public void updateCs(char[] bb) {
+ cs = bb;
+ upCs++;
+ }
+
+ public void updateBools(boolean[] bb) {
+ bools = bb;
+ upBools++;
+ }
+
+
+
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/PropertyModifier.java b/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/PropertyModifier.java
new file mode 100644
index 0000000..9f2fbae
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/PropertyModifier.java
@@ -0,0 +1,41 @@
+package org.apache.felix.ipojo.runtime.core.components;
+
+import org.apache.felix.ipojo.runtime.core.services.CheckService;
+import org.osgi.framework.BundleContext;
+
+import java.util.Properties;
+
+public class PropertyModifier implements CheckService {
+
+ private Class[] classes;
+ private BundleContext context;
+
+ PropertyModifier(BundleContext bc) {
+ context = bc;
+ }
+
+ public boolean check() {
+ return classes != null;
+ }
+
+ public void setClasses(String[] classes) throws ClassNotFoundException {
+ Class[] cls = new Class[classes.length];
+ for (int i = 0; i < classes.length; i++) {
+ try {
+ cls[i] = context.getBundle().loadClass(classes[i]);
+ } catch (ClassNotFoundException e) {
+ e.printStackTrace();
+ throw e;
+ }
+ }
+
+ this.classes = cls;
+ }
+
+ public Properties getProps() {
+ Properties props = new Properties();
+ props.put("classes", classes);
+ return props;
+ }
+
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/CheckService.java b/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/CheckService.java
new file mode 100644
index 0000000..eca0faa
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/CheckService.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.ipojo.runtime.core.services;
+
+import java.util.Properties;
+
+public interface CheckService {
+
+ public static final String foo = "foo";
+
+ public boolean check();
+
+ public Properties getProps();
+
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/FooService.java b/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/FooService.java
new file mode 100644
index 0000000..37c1a65
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/FooService.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.ipojo.runtime.core.services;
+
+import java.util.Properties;
+
+public interface FooService {
+
+ boolean foo();
+
+ Properties fooProps();
+
+ Boolean getObject();
+
+ boolean getBoolean();
+
+ int getInt();
+
+ long getLong();
+
+ double getDouble();
+
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/resources/metadata.xml b/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/resources/metadata.xml
new file mode 100644
index 0000000..cb81ef9
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/resources/metadata.xml
@@ -0,0 +1,248 @@
+<ipojo>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.components.FooProviderTypeDyn"
+ name="CONFIG-FooProviderType-Conf" architecture="true">
+ <provides />
+ <properties propagation="false">
+ <property name="int" field="intProp" value="2" />
+ <property name="boolean" field="boolProp" value="false" />
+ <property name="string" field="strProp" value="foo" />
+ <property name="strAProp" field="strAProp"
+ value="{foo, bar}" />
+ <property name="intAProp" field="intAProp" value="{1,2, 3}" />
+ </properties>
+ </component>
+
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.components.FooProviderTypeDyn"
+ name="CONFIG-FooProviderType-ConfNoValue" architecture="true">
+ <provides />
+ <properties propagation="false">
+ <property name="int" field="intProp"/>
+ <property name="boolean" field="boolProp"/>
+ <property name="string" field="strProp"/>
+ <property name="strAProp" field="strAProp"/>
+ <property name="intAProp" field="intAProp"/>
+ </properties>
+ </component>
+
+
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.components.FooProviderType1"
+ name="CONFIG-FooProviderType-3" architecture="true">
+ <provides>
+ <property name="foo" field="m_foo" />
+ <property name="bar" field="m_bar" />
+ <property name="baz" type="java.lang.String" />
+ </provides>
+ <properties propagation="true">
+ <property name="foo" field="m_foo" />
+ <property name="bar" field="m_bar" />
+ </properties>
+ </component>
+ <!-- Configuration Management Test -->
+ <component name="CONFIG-FieldConfigurableCheckService"
+ classname="org.apache.felix.ipojo.runtime.core.components.ConfigurableCheckServiceProvider"
+ architecture="true">
+ <provides />
+ <properties propagation="true">
+ <property field="b" />
+ <property field="s" />
+ <property field="i" />
+ <property field="l" />
+ <property field="d" />
+ <property field="f" />
+ <property field="c" />
+ <property field="bool" />
+ <property field="bs" />
+ <property field="ss" />
+ <property field="is" />
+ <property field="ls" />
+ <property field="ds" />
+ <property field="fs" />
+ <property field="cs" />
+ <property field="bools" />
+ <property field="string" />
+ <property field="strings" />
+ </properties>
+ </component>
+
+ <component name="CONFIG-BothConfigurableCheckService"
+ classname="org.apache.felix.ipojo.runtime.core.components.ConfigurableCheckServiceProvider"
+ architecture="true">
+ <provides />
+ <properties propagation="true">
+ <property field="b" method="updateB" />
+ <property field="s" method="updateS" />
+ <property field="i" method="updateI" />
+ <property field="l" method="updateL" />
+ <property field="d" method="updateD" />
+ <property field="f" method="updateF" />
+ <property field="c" method="updateC" />
+ <property field="bool" method="updateBool" />
+ <property field="bs" method="updateBs" />
+ <property field="ss" method="updateSs" />
+ <property field="is" method="updateIs" />
+ <property field="ls" method="updateLs" />
+ <property field="ds" method="updateDs" />
+ <property field="fs" method="updateFs" />
+ <property field="cs" method="updateCs" />
+ <property field="bools" method="updateBools" />
+ <property field="string" method="updateString" />
+ <property field="strings" method="updateStrings" />
+ </properties>
+ </component>
+
+ <component name="CONFIG-MethodConfigurableCheckService"
+ classname="org.apache.felix.ipojo.runtime.core.components.ConfigurableCheckServiceProvider"
+ architecture="true">
+ <provides />
+ <properties propagation="true">
+ <property method="updateB" name="b" />
+ <property method="updateS" name="s" />
+ <property method="updateI" name="i" />
+ <property method="updateL" name="l" />
+ <property method="updateD" name="d" />
+ <property method="updateF" name="f" />
+ <property method="updateC" name="c" />
+ <property method="updateBool" name="bool" />
+ <property method="updateBs" name="bs" />
+ <property method="updateSs" name="ss" />
+ <property method="updateIs" name="is" />
+ <property method="updateLs" name="ls" />
+ <property method="updateDs" name="ds" />
+ <property method="updateFs" name="fs" />
+ <property method="updateCs" name="cs" />
+ <property method="updateBools" name="bools" />
+ <property method="updateString" name="string" />
+ <property method="updateStrings" name="strings" />
+ </properties>
+ </component>
+
+ <component name="CONFIG-ParentMethodConfigurableCheckService"
+ classname="org.apache.felix.ipojo.runtime.core.components.ParentConfigurableCheckServiceProvider"
+ architecture="true">
+ <provides />
+ <properties propagation="true">
+ <property method="updateB" name="b" />
+ <property method="updateS" name="s" />
+ <property method="updateI" name="i" />
+ <property method="updateL" name="l" />
+ <property method="updateD" name="d" />
+ <property method="updateF" name="f" />
+ <property method="updateC" name="c" />
+ <property method="updateBool" name="bool" />
+ <property method="updateBs" name="bs" />
+ <property method="updateSs" name="ss" />
+ <property method="updateIs" name="is" />
+ <property method="updateLs" name="ls" />
+ <property method="updateDs" name="ds" />
+ <property method="updateFs" name="fs" />
+ <property method="updateCs" name="cs" />
+ <property method="updateBools" name="bools" />
+ <property method="updateString" name="string" type="string" />
+ <property method="updateStrings" name="strings"
+ type="java.lang.String[]" />
+ </properties>
+ </component>
+
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.components.FooProviderType1"
+ name="CONFIG-FooProviderType-4" architecture="true">
+ <provides>
+ <property name="foo" field="m_foo" />
+ <property name="bar" field="m_bar" />
+ <property name="baz" type="java.lang.String" />
+ </provides>
+ <properties propagation="true" pid="FooProvider-3">
+ <property name="foo" field="m_foo" />
+ <property name="bar" field="m_bar" />
+ </properties>
+ </component>
+
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.components.ComplexConfiguration">
+ <provides>
+ <property name="array" field="m_array"/>
+ <property name="complex-array" field="m_complexArray"/>
+ <property name="list" field="m_list"/>
+ <property name="complex-list" field="m_complexList"/>
+ <property name="map" field="m_map"/>
+ <property name="complex-map" field="m_complexMap"/>
+ <property name="dict" field="m_dict"/>
+ <property name="empty-array" type="String[]"/>
+ <property name="empty-map" type="java.util.HashMap"/>
+ <property name="empty-list" type="java.util.List"/>
+ </provides>
+ <properties>
+ <property name="array" field="m_array"/>
+ <property name="complex-array" field="m_complexArray"/>
+ <property name="list" field="m_list"/>
+ <property name="complex-list" field="m_complexList"/>
+ <property name="map" field="m_map"/>
+ <property name="complex-map" field="m_complexMap"/>
+ <property name="dict" field="m_dict"/>
+ </properties>
+ </component>
+
+ <instance component="org.apache.felix.ipojo.runtime.core.components.ComplexConfiguration" name="complex">
+ <property name="array" type="array">
+ <property value="a"/>
+ <property value="b"/>
+ </property>
+ <property name="list" type="list">
+ <property value="a"/>
+ <property value="b"/>
+ </property>
+ <property name="dict" type="dictionary">
+ <property name="a" value="a"/>
+ <property name="b" value="b"/>
+ </property>
+ <property name="map" type="map">
+ <property name="a" value="a"/>
+ <property name="b" value="b"/>
+ </property>
+ <property name="complex-array" type="array">
+ <property type="list">
+ <property value="a"/>
+ <property value="b"/>
+ </property>
+ <property type="list">
+ <property value="c"/>
+ <property value="d"/>
+ </property>
+ </property>
+ <property name="complex-list" type="list">
+ <property type="list">
+ <property value="a"/>
+ <property value="b"/>
+ </property>
+ <property type="list">
+ <property value="c"/>
+ <property value="d"/>
+ </property>
+ </property>
+ <property name="complex-map" type="map">
+ <property name="a" type="list">
+ <property value="a"/>
+ <property value="b"/>
+ </property>
+ <property name="b" type="list">
+ <property value="c"/>
+ <property value="d"/>
+ </property>
+ </property>
+ <property name="empty-array" type="array"/>
+ <property name="empty-list" type="list"/>
+ <property name="empty-map" type="map"/>
+ </instance>
+
+ <component classname="org.apache.felix.ipojo.runtime.core.components.PropertyModifier">
+ <provides>
+ <property field="classes"/>
+ </provides>
+ <properties>
+ <property method="setClasses" name="cls"/>
+ </properties>
+ </component>
+</ipojo>
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/resources/updated.xml b/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/resources/updated.xml
new file mode 100644
index 0000000..d5d96de
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/resources/updated.xml
@@ -0,0 +1,84 @@
+<ipojo>
+ <!-- updated -->
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.components.FooProviderTypeDyn"
+ name="CONFIG-FooProviderType-ConfUpdated" architecture="true">
+ <provides />
+ <properties updated="updated">
+ <property name="int" field="intProp" value="2" />
+ <property name="boolean" field="boolProp" value="false" />
+ <property name="string" field="strProp" value="foo" />
+ <property name="strAProp" field="strAProp"
+ value="{foo, bar}" />
+ <property name="intAProp" field="intAProp" value="{1,2, 3}" />
+ </properties>
+ </component>
+
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.components.FooProviderTypeDyn"
+ name="CONFIG-FooProviderType-ConfNoValueUpdated" architecture="true">
+ <provides />
+ <properties updated="updated">
+ <property name="int" field="intProp"/>
+ <property name="boolean" field="boolProp"/>
+ <property name="string" field="strProp"/>
+ <property name="strAProp" field="strAProp"/>
+ <property name="intAProp" field="intAProp"/>
+ </properties>
+ </component>
+
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.components.FooProviderType1"
+ name="CONFIG-FooProviderType-4Updated" architecture="true">
+ <provides>
+ <property name="foo" field="m_foo" />
+ <property name="bar" field="m_bar" />
+ <property name="baz" type="java.lang.String" />
+ </provides>
+ <properties propagation="true" pid="FooProvider-3" updated="updated">
+ <property name="foo" field="m_foo" />
+ <property name="bar" field="m_bar" />
+ </properties>
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.components.FooProviderType2"
+ name="CONFIG-FooProviderType-4Updated2" architecture="true">
+ <provides>
+ <property name="foo" field="m_foo" />
+ <property name="bar" field="m_bar" />
+ <property name="baz" type="java.lang.String" />
+ </provides>
+ <properties propagation="true" pid="FooProvider-3" updated="updated">
+ <property name="foo" field="m_foo" />
+ <property name="bar" field="m_bar" />
+ </properties>
+ </component>
+
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.components.FooProviderType1"
+ name="CONFIG-FooProviderType-3Updated" architecture="true">
+ <provides>
+ <property name="foo" field="m_foo" />
+ <property name="bar" field="m_bar" />
+ <property name="baz" type="java.lang.String" />
+ </provides>
+ <properties propagation="true" updated="updated">
+ <property name="foo" field="m_foo" />
+ <property name="bar" field="m_bar" />
+ </properties>
+ </component>
+ <component
+ classname="org.apache.felix.ipojo.runtime.core.components.FooProviderType2"
+ name="CONFIG-FooProviderType-3Updated2" architecture="true">
+ <provides>
+ <property name="foo" field="m_foo" />
+ <property name="bar" field="m_bar" />
+ <property name="baz" type="java.lang.String" />
+ </provides>
+ <properties propagation="true" updated="updated">
+ <property name="foo" field="m_foo" />
+ <property name="bar" field="m_bar" />
+ </properties>
+ </component>
+
+</ipojo>
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/Common.java b/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/Common.java
new file mode 100644
index 0000000..9732697
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/Common.java
@@ -0,0 +1,142 @@
+package org.apache.felix.ipojo.runtime.core;
+
+import ch.qos.logback.classic.Level;
+import ch.qos.logback.classic.Logger;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.filefilter.TrueFileFilter;
+import org.apache.felix.ipojo.runtime.core.components.*;
+import org.apache.felix.ipojo.runtime.core.services.CheckService;
+import org.apache.felix.ipojo.runtime.core.services.FooService;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.Configuration;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.junit.PaxExam;
+import org.ops4j.pax.exam.options.CompositeOption;
+import org.ops4j.pax.exam.options.DefaultCompositeOption;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerClass;
+import org.ops4j.pax.tinybundles.core.TinyBundle;
+import org.ops4j.pax.tinybundles.core.TinyBundles;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Constants;
+import org.ow2.chameleon.testing.helpers.IPOJOHelper;
+import org.ow2.chameleon.testing.helpers.OSGiHelper;
+import org.ow2.chameleon.testing.tinybundles.ipojo.IPOJOStrategy;
+import org.slf4j.LoggerFactory;
+
+import javax.inject.Inject;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import static org.ops4j.pax.exam.CoreOptions.*;
+
+/**
+ * Bootstrap the test from this project
+ */
+@RunWith(PaxExam.class)
+@ExamReactorStrategy(PerClass.class)
+public class Common {
+
+ @Inject
+ BundleContext bc;
+
+ OSGiHelper osgiHelper;
+ IPOJOHelper ipojoHelper;
+
+ @Configuration
+ public Option[] config() throws MalformedURLException {
+ Logger root = (Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
+ root.setLevel(Level.INFO);
+
+ return options(
+ ipojoBundles(),
+ junitBundles(),
+ testedBundle(),
+ systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("WARN")
+ );
+ }
+
+ @Before
+ public void commonSetUp() {
+ osgiHelper = new OSGiHelper(bc);
+ ipojoHelper = new IPOJOHelper(bc);
+
+ // Dump OSGi Framework information
+ String vendor = (String) osgiHelper.getBundle(0).getHeaders().get(Constants.BUNDLE_VENDOR);
+ if (vendor == null) {
+ vendor = (String) osgiHelper.getBundle(0).getHeaders().get(Constants.BUNDLE_SYMBOLICNAME);
+ }
+ String version = (String) osgiHelper.getBundle(0).getHeaders().get(Constants.BUNDLE_VERSION);
+ System.out.println("OSGi Framework : " + vendor + " - " + version);
+ }
+
+ @After
+ public void commonTearDown() {
+ ipojoHelper.dispose();
+ osgiHelper.dispose();
+ }
+
+ public CompositeOption ipojoBundles() {
+ return new DefaultCompositeOption(
+ mavenBundle("org.apache.felix", "org.apache.felix.ipojo").versionAsInProject(),
+ mavenBundle("org.ow2.chameleon.testing", "osgi-helpers").versionAsInProject());
+ }
+
+ public Option testedBundle() throws MalformedURLException {
+ File out = new File("target/tested/bundle.jar");
+
+ TinyBundle tested = TinyBundles.bundle();
+
+ // We look inside target/classes to find the class and resources
+ File classes = new File("target/classes");
+ Collection<File> files = FileUtils.listFilesAndDirs(classes, TrueFileFilter.INSTANCE, TrueFileFilter.INSTANCE);
+ List<File> services = new ArrayList<File>();
+ for (File file : files) {
+ if (file.isDirectory()) {
+ // By convention we export of .services and .service package
+ if (file.getName().endsWith("services") || file.getName().endsWith("service")) {
+ services.add(file);
+ }
+ } else {
+ // We need to compute the path
+ String path = file.getAbsolutePath().substring(classes.getAbsolutePath().length() +1);
+ tested.add(path, file.toURI().toURL());
+ System.out.println(file.getName() + " added to " + path);
+ }
+ }
+
+ String export = "";
+ for (File file : services) {
+ if (export.length() > 0) { export += ", "; }
+ String path = file.getAbsolutePath().substring(classes.getAbsolutePath().length() +1);
+ String packageName = path.replace('/', '.');
+ export += packageName;
+ }
+
+ System.out.println("Exported packages : " + export);
+
+ InputStream inputStream = tested
+ .set(Constants.BUNDLE_SYMBOLICNAME, "test.bundle")
+ .set(Constants.IMPORT_PACKAGE, "*")
+ .set(Constants.EXPORT_PACKAGE, export)
+ .build(IPOJOStrategy.withiPOJO(new File("src/main/resources")));
+
+ try {
+ org.apache.commons.io.FileUtils.copyInputStreamToFile(inputStream, out);
+ return bundle(out.toURI().toURL().toExternalForm());
+ } catch (MalformedURLException e) {
+ throw new RuntimeException("Cannot compute the url of the manipulated bundle");
+ } catch (IOException e) {
+ throw new RuntimeException("Cannot write of the manipulated bundle");
+ }
+ }
+
+
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestArchitecture.java b/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestArchitecture.java
new file mode 100644
index 0000000..3c3d2b0
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestArchitecture.java
@@ -0,0 +1,103 @@
+package org.apache.felix.ipojo.runtime.core;
+
+import org.apache.felix.ipojo.ComponentInstance;
+import org.apache.felix.ipojo.architecture.Architecture;
+import org.apache.felix.ipojo.handlers.configuration.ConfigurationHandlerDescription;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertTrue;
+import static org.junit.Assert.assertNotNull;
+
+public class TestArchitecture extends Common {
+
+ /**
+ * Instance where the ManagedServicePID is provided by the component type.
+ */
+ ComponentInstance instance1;
+ /**
+ * Instance where the ManagedServicePID is provided by the instance.
+ */
+ ComponentInstance instance2;
+
+ /**
+ * Instance without configuration.
+ */
+ ComponentInstance instance3;
+
+ @Before
+ public void setUp() {
+ String type = "CONFIG-FooProviderType-4";
+ Dictionary<String, String> p = new Hashtable<String, String>();
+ p.put("instance.name", "instance");
+ p.put("foo", "foo");
+ p.put("bar", "2");
+ p.put("baz", "baz");
+ instance1 = ipojoHelper.createComponentInstance(type, p);
+ assertEquals("instance1 created", ComponentInstance.VALID, instance1.getState());
+
+ type = "CONFIG-FooProviderType-3";
+ Dictionary<String, String> p1 = new Hashtable<String, String>();
+ p1.put("instance.name", "instance-2");
+ p1.put("foo", "foo");
+ p1.put("bar", "2");
+ p1.put("baz", "baz");
+ p1.put("managed.service.pid", "instance");
+ instance2 = ipojoHelper.createComponentInstance(type, p1);
+
+ }
+
+ @After
+ public void tearDown() {
+ instance1.dispose();
+ instance2.dispose();
+
+ instance1 = null;
+ instance2 = null;
+ }
+
+ @Test
+ public void testArchitectureForInstance1() {
+
+ Architecture arch = osgiHelper.getServiceObject(Architecture.class,
+ "(architecture.instance=instance)");
+ assertNotNull(arch);
+
+ // Test on String representation.
+ String desc = arch.getInstanceDescription().getDescription().toString();
+ assertTrue(desc.contains("managed.service.pid=\"FooProvider-3\""));
+
+ // Test on handler description
+ ConfigurationHandlerDescription hd = (ConfigurationHandlerDescription) arch.getInstanceDescription().getHandlerDescription("org.apache.felix.ipojo:properties");
+ assertNotNull(hd);
+
+ assertEquals(2, hd.getProperties().length);
+ assertEquals("FooProvider-3", hd.getManagedServicePid());
+
+ }
+
+ @Test
+ public void testArchitectureForInstance2() {
+ Architecture arch = osgiHelper.getServiceObject(Architecture.class, "(architecture.instance=instance-2)");
+ assertNotNull(arch);
+
+ // Test on String representation.
+ String desc = arch.getInstanceDescription().getDescription().toString();
+ assertTrue(desc.contains("managed.service.pid=\"instance\""));
+
+ // Test on handler description
+ ConfigurationHandlerDescription hd = (ConfigurationHandlerDescription) arch.getInstanceDescription().getHandlerDescription("org.apache.felix.ipojo:properties");
+ assertNotNull(hd);
+
+ assertEquals(2, hd.getProperties().length);
+ assertEquals("instance", hd.getManagedServicePid());
+
+ }
+
+
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestBothProperties.java b/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestBothProperties.java
new file mode 100644
index 0000000..ec56790
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestBothProperties.java
@@ -0,0 +1,870 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.ipojo.runtime.core;
+
+import org.apache.felix.ipojo.ComponentInstance;
+import org.apache.felix.ipojo.Factory;
+import org.apache.felix.ipojo.runtime.core.services.CheckService;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.osgi.framework.ServiceReference;
+
+import java.util.Properties;
+
+import static junit.framework.Assert.assertEquals;
+import static org.junit.Assert.*;
+
+public class TestBothProperties extends Common {
+
+ ComponentInstance instance, instance2;
+
+ @Before
+ public void setUp() {
+ Factory fact = ipojoHelper.getFactory("CONFIG-BothConfigurableCheckService");
+ Properties props = new Properties();
+ props.put("instance.name", "under-test");
+ props.put("b", "1");
+ props.put("s", "1");
+ props.put("i", "1");
+ props.put("l", "1");
+ props.put("d", "1");
+ props.put("f", "1");
+ props.put("c", "a");
+ props.put("bool", "true");
+ props.put("bs", "{1,2,3}");
+ props.put("ss", "{1,2,3}");
+ props.put("is", "{1,2,3}");
+ props.put("ls", "{1,2,3}");
+ props.put("ds", "{1,2,3}");
+ props.put("fs", "{1,2,3}");
+ props.put("cs", "{a,b,c}");
+ props.put("bools", "{true,true,true}");
+ props.put("string", "foo");
+ props.put("strings", "{foo, bar, baz}");
+
+ try {
+ instance = fact.createComponentInstance(props);
+ } catch (Exception e) {
+ fail("Cannot create the under-test instance : " + e.getMessage());
+ }
+
+ try {
+ instance2 = fact.createComponentInstance(null);
+ } catch (Exception e) {
+ fail("Cannot create the under-test instance2 : " + e.getMessage());
+ }
+
+
+ }
+
+ @After
+ public void tearDown() {
+ instance.dispose();
+ instance2.dispose();
+ instance = null;
+ instance2 = null;
+ }
+
+ @Test
+ public void testConfigurationPrimitive() {
+ ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ CheckService check = (CheckService) osgiHelper.getServiceObject(ref);
+ Properties props = check.getProps();
+
+ Byte b = (Byte) props.get("b");
+ Short s = (Short) props.get("s");
+ Integer i = (Integer) props.get("i");
+ Long l = (Long) props.get("l");
+ Double d = (Double) props.get("d");
+ Float f = (Float) props.get("f");
+ Character c = (Character) props.get("c");
+ Boolean bool = (Boolean) props.get("bool");
+
+ assertEquals("Check b", b, new Byte("1"));
+ assertEquals("Check s", s, new Short("1"));
+ assertEquals("Check i", i, new Integer("1"));
+ assertEquals("Check l", l, new Long("1"));
+ assertEquals("Check d", d, new Double("1"));
+ assertEquals("Check f", f, new Float("1"));
+ assertEquals("Check c", c, new Character('a'));
+ assertEquals("Check bool", bool, new Boolean("true"));
+
+ Integer upb = (Integer) props.get("upb");
+ Integer ups = (Integer) props.get("ups");
+ Integer upi = (Integer) props.get("upi");
+ Integer upl = (Integer) props.get("upl");
+ Integer upd = (Integer) props.get("upd");
+ Integer upf = (Integer) props.get("upf");
+ Integer upc = (Integer) props.get("upc");
+ Integer upbool = (Integer) props.get("upbool");
+
+ assertEquals("Check upb", upb, new Integer(1));
+ assertEquals("Check ups", ups, new Integer(1));
+ assertEquals("Check upi", upi, new Integer(1));
+ assertEquals("Check upl", upl, new Integer(1));
+ assertEquals("Check upd", upd, new Integer(1));
+ assertEquals("Check upf", upf, new Integer(1));
+ assertEquals("Check upc", upc, new Integer(1));
+ assertEquals("Check upbool", upbool, new Integer(1));
+
+ reconfigure(instance);
+
+ ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ check = (CheckService) osgiHelper.getServiceObject(ref);
+ props = check.getProps();
+
+ b = (Byte) props.get("b");
+ s = (Short) props.get("s");
+ i = (Integer) props.get("i");
+ l = (Long) props.get("l");
+ d = (Double) props.get("d");
+ f = (Float) props.get("f");
+ c = (Character) props.get("c");
+ bool = (Boolean) props.get("bool");
+
+ assertEquals("2) Check b (" + b + ")", b, new Byte("2"));
+ assertEquals("2) Check s", s, new Short("2"));
+ assertEquals("2) Check i", i, new Integer("2"));
+ assertEquals("2) Check l", l, new Long("2"));
+ assertEquals("2) Check d", d, new Double("2"));
+ assertEquals("2) Check f", f, new Float("2"));
+ assertEquals("2) Check c", c, new Character('b'));
+ assertEquals("2) Check bool", bool, new Boolean("false"));
+
+ upb = (Integer) props.get("upb");
+ ups = (Integer) props.get("ups");
+ upi = (Integer) props.get("upi");
+ upl = (Integer) props.get("upl");
+ upd = (Integer) props.get("upd");
+ upf = (Integer) props.get("upf");
+ upc = (Integer) props.get("upc");
+ upbool = (Integer) props.get("upbool");
+
+ assertEquals("2) Check upb", upb, new Integer(2));
+ assertEquals("2) Check ups", ups, new Integer(2));
+ assertEquals("2) Check upi", upi, new Integer(2));
+ assertEquals("2) Check upl", upl, new Integer(2));
+ assertEquals("2) Check upd", upd, new Integer(2));
+ assertEquals("2) Check upf", upf, new Integer(2));
+ assertEquals("2) Check upc", upc, new Integer(2));
+ assertEquals("2) Check upbool", upbool, new Integer(2));
+
+ }
+
+ @Test
+ public void testConfigurationPrimitiveString() {
+ ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ CheckService check = (CheckService) osgiHelper.getServiceObject(ref);
+ Properties props = check.getProps();
+
+ Byte b = (Byte) props.get("b");
+ Short s = (Short) props.get("s");
+ Integer i = (Integer) props.get("i");
+ Long l = (Long) props.get("l");
+ Double d = (Double) props.get("d");
+ Float f = (Float) props.get("f");
+ Character c = (Character) props.get("c");
+ Boolean bool = (Boolean) props.get("bool");
+
+ assertEquals("Check b", b, new Byte("1"));
+ assertEquals("Check s", s, new Short("1"));
+ assertEquals("Check i", i, new Integer("1"));
+ assertEquals("Check l", l, new Long("1"));
+ assertEquals("Check d", d, new Double("1"));
+ assertEquals("Check f", f, new Float("1"));
+ assertEquals("Check c", c, new Character('a'));
+ assertEquals("Check bool", bool, new Boolean("true"));
+
+ Integer upb = (Integer) props.get("upb");
+ Integer ups = (Integer) props.get("ups");
+ Integer upi = (Integer) props.get("upi");
+ Integer upl = (Integer) props.get("upl");
+ Integer upd = (Integer) props.get("upd");
+ Integer upf = (Integer) props.get("upf");
+ Integer upc = (Integer) props.get("upc");
+ Integer upbool = (Integer) props.get("upbool");
+
+ assertEquals("Check upb", upb, new Integer(1));
+ assertEquals("Check ups", ups, new Integer(1));
+ assertEquals("Check upi", upi, new Integer(1));
+ assertEquals("Check upl", upl, new Integer(1));
+ assertEquals("Check upd", upd, new Integer(1));
+ assertEquals("Check upf", upf, new Integer(1));
+ assertEquals("Check upc", upc, new Integer(1));
+ assertEquals("Check upbool", upbool, new Integer(1));
+
+ reconfigureString(instance);
+
+ ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ check = (CheckService) osgiHelper.getServiceObject(ref);
+ props = check.getProps();
+
+ b = (Byte) props.get("b");
+ s = (Short) props.get("s");
+ i = (Integer) props.get("i");
+ l = (Long) props.get("l");
+ d = (Double) props.get("d");
+ f = (Float) props.get("f");
+ c = (Character) props.get("c");
+ bool = (Boolean) props.get("bool");
+
+ assertEquals("2) Check b (" + b + ")", b, new Byte("2"));
+ assertEquals("2) Check s", s, new Short("2"));
+ assertEquals("2) Check i", i, new Integer("2"));
+ assertEquals("2) Check l", l, new Long("2"));
+ assertEquals("2) Check d", d, new Double("2"));
+ assertEquals("2) Check f", f, new Float("2"));
+ assertEquals("2) Check c", c, new Character('b'));
+ assertEquals("2) Check bool", bool, new Boolean("false"));
+
+ upb = (Integer) props.get("upb");
+ ups = (Integer) props.get("ups");
+ upi = (Integer) props.get("upi");
+ upl = (Integer) props.get("upl");
+ upd = (Integer) props.get("upd");
+ upf = (Integer) props.get("upf");
+ upc = (Integer) props.get("upc");
+ upbool = (Integer) props.get("upbool");
+
+ assertEquals("2) Check upb", upb, new Integer(2));
+ assertEquals("2) Check ups", ups, new Integer(2));
+ assertEquals("2) Check upi", upi, new Integer(2));
+ assertEquals("2) Check upl", upl, new Integer(2));
+ assertEquals("2) Check upd", upd, new Integer(2));
+ assertEquals("2) Check upf", upf, new Integer(2));
+ assertEquals("2) Check upc", upc, new Integer(2));
+ assertEquals("2) Check upbool", upbool, new Integer(2));
+
+ }
+
+ @Test
+ public void testConfigurationPrimitiveArrays() {
+ ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ CheckService check = (CheckService) osgiHelper.getServiceObject(ref);
+ Properties props = check.getProps();
+
+ byte[] b = (byte[]) props.get("bs");
+ short[] s = (short[]) props.get("ss");
+ int[] i = (int[]) props.get("is");
+ long[] l = (long[]) props.get("ls");
+ double[] d = (double[]) props.get("ds");
+ float[] f = (float[]) props.get("fs");
+ char[] c = (char[]) props.get("cs");
+ boolean[] bool = (boolean[]) props.get("bools");
+
+ assertEquals("Check b 0", b[0], 1);
+ assertEquals("Check b 1", b[1], 2);
+ assertEquals("Check b 2", b[2], 3);
+ assertEquals("Check s 0", s[0], 1);
+ assertEquals("Check s 1", s[1], 2);
+ assertEquals("Check s 2", s[2], 3);
+ assertEquals("Check i 0", i[0], 1);
+ assertEquals("Check i 1", i[1], 2);
+ assertEquals("Check i 2", i[2], 3);
+ assertEquals("Check l 0", l[0], 1);
+ assertEquals("Check l 1", l[1], 2);
+ assertEquals("Check l 2", l[2], 3);
+ assertEquals("Check d 0", d[0], 1.0);
+ assertEquals("Check d 1", d[1], 2.0);
+ assertEquals("Check d 2", d[2], 3.0);
+ assertEquals("Check f 0", f[0], 1.0, 0);
+ assertEquals("Check f 1", f[1], 2.0, 0);
+ assertEquals("Check f 2", f[2], 3.0, 0);
+ assertEquals("Check c 0", c[0], 'a');
+ assertEquals("Check c 1", c[1], 'b');
+ assertEquals("Check c 2", c[2], 'c');
+ assertTrue("Check bool 0", bool[0]);
+ assertTrue("Check bool 1", bool[0]);
+ assertTrue("Check bool 2", bool[0]);
+
+ Integer upb = (Integer) props.get("upbs");
+ Integer ups = (Integer) props.get("upss");
+ Integer upi = (Integer) props.get("upis");
+ Integer upl = (Integer) props.get("upls");
+ Integer upd = (Integer) props.get("upds");
+ Integer upf = (Integer) props.get("upfs");
+ Integer upc = (Integer) props.get("upcs");
+ Integer upbool = (Integer) props.get("upbools");
+
+ assertEquals("Check upb", upb, new Integer(1));
+ assertEquals("Check ups", ups, new Integer(1));
+ assertEquals("Check upi", upi, new Integer(1));
+ assertEquals("Check upl", upl, new Integer(1));
+ assertEquals("Check upd", upd, new Integer(1));
+ assertEquals("Check upf", upf, new Integer(1));
+ assertEquals("Check upc", upc, new Integer(1));
+ assertEquals("Check upbool", upbool, new Integer(1));
+
+ reconfigure(instance);
+
+ ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ check = (CheckService) osgiHelper.getServiceObject(ref);
+ props = check.getProps();
+
+ b = (byte[]) props.get("bs");
+ s = (short[]) props.get("ss");
+ i = (int[]) props.get("is");
+ l = (long[]) props.get("ls");
+ d = (double[]) props.get("ds");
+ f = (float[]) props.get("fs");
+ c = (char[]) props.get("cs");
+ bool = (boolean[]) props.get("bools");
+
+ assertEquals("2) Check b 0", b[0], 3);
+ assertEquals("2) Check b 1", b[1], 2);
+ assertEquals("2) Check b 2", b[2], 1);
+ assertEquals("2) Check s 0", s[0], 3);
+ assertEquals("2) Check s 1", s[1], 2);
+ assertEquals("2) Check s 2", s[2], 1);
+ assertEquals("2) Check i 0", i[0], 3);
+ assertEquals("2) Check i 1", i[1], 2);
+ assertEquals("2) Check i 2", i[2], 1);
+ assertEquals("2) Check l 0", l[0], 3);
+ assertEquals("2) Check l 1", l[1], 2);
+ assertEquals("2) Check l 2", l[2], 1);
+ assertEquals("2) Check d 0", d[0], 3.0);
+ assertEquals("2) Check d 1", d[1], 2.0);
+ assertEquals("2) Check d 2", d[2], 1.0);
+ assertEquals("2) Check f 0", f[0], 3.0, 0);
+ assertEquals("2) Check f 1", f[1], 2.0, 0);
+ assertEquals("2) Check f 2", f[2], 1.0, 0);
+ assertEquals("2) Check c 0", c[0], 'c');
+ assertEquals("2) Check c 1", c[1], 'b');
+ assertEquals("2) Check c 2", c[2], 'a');
+ assertFalse("2) Check bool 0", bool[0]);
+ assertFalse("2) Check bool 1", bool[0]);
+ assertFalse("2) Check bool 2", bool[0]);
+
+ upb = (Integer) props.get("upbs");
+ ups = (Integer) props.get("upss");
+ upi = (Integer) props.get("upis");
+ upl = (Integer) props.get("upls");
+ upd = (Integer) props.get("upds");
+ upf = (Integer) props.get("upfs");
+ upc = (Integer) props.get("upcs");
+ upbool = (Integer) props.get("upbools");
+
+ assertEquals("2) Check upb", upb, new Integer(2));
+ assertEquals("2) Check ups", ups, new Integer(2));
+ assertEquals("2) Check upi", upi, new Integer(2));
+ assertEquals("2) Check upl", upl, new Integer(2));
+ assertEquals("2) Check upd", upd, new Integer(2));
+ assertEquals("2) Check upf", upf, new Integer(2));
+ assertEquals("2) Check upc", upc, new Integer(2));
+ assertEquals("2) Check upbool", upbool, new Integer(2));
+
+ }
+
+ @Test
+ public void testConfigurationPrimitiveArraysString() {
+ ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ CheckService check = (CheckService) osgiHelper.getServiceObject(ref);
+ Properties props = check.getProps();
+
+ byte[] b = (byte[]) props.get("bs");
+ short[] s = (short[]) props.get("ss");
+ int[] i = (int[]) props.get("is");
+ long[] l = (long[]) props.get("ls");
+ double[] d = (double[]) props.get("ds");
+ float[] f = (float[]) props.get("fs");
+ char[] c = (char[]) props.get("cs");
+ boolean[] bool = (boolean[]) props.get("bools");
+
+ assertEquals("Check b 0", b[0], 1);
+ assertEquals("Check b 1", b[1], 2);
+ assertEquals("Check b 2", b[2], 3);
+ assertEquals("Check s 0", s[0], 1);
+ assertEquals("Check s 1", s[1], 2);
+ assertEquals("Check s 2", s[2], 3);
+ assertEquals("Check i 0", i[0], 1);
+ assertEquals("Check i 1", i[1], 2);
+ assertEquals("Check i 2", i[2], 3);
+ assertEquals("Check l 0", l[0], 1);
+ assertEquals("Check l 1", l[1], 2);
+ assertEquals("Check l 2", l[2], 3);
+ assertEquals("Check d 0", d[0], 1.0);
+ assertEquals("Check d 1", d[1], 2.0);
+ assertEquals("Check d 2", d[2], 3.0);
+ assertEquals("Check f 0", f[0], 1, 0);
+ assertEquals("Check f 1", f[1], 2, 0);
+ assertEquals("Check f 2", f[2], 3, 0);
+ assertEquals("Check c 0", c[0], 'a');
+ assertEquals("Check c 1", c[1], 'b');
+ assertEquals("Check c 2", c[2], 'c');
+ assertTrue("Check bool 0", bool[0]);
+ assertTrue("Check bool 1", bool[0]);
+ assertTrue("Check bool 2", bool[0]);
+
+ Integer upb = (Integer) props.get("upbs");
+ Integer ups = (Integer) props.get("upss");
+ Integer upi = (Integer) props.get("upis");
+ Integer upl = (Integer) props.get("upls");
+ Integer upd = (Integer) props.get("upds");
+ Integer upf = (Integer) props.get("upfs");
+ Integer upc = (Integer) props.get("upcs");
+ Integer upbool = (Integer) props.get("upbools");
+
+ assertEquals("Check upb", upb, new Integer(1));
+ assertEquals("Check ups", ups, new Integer(1));
+ assertEquals("Check upi", upi, new Integer(1));
+ assertEquals("Check upl", upl, new Integer(1));
+ assertEquals("Check upd", upd, new Integer(1));
+ assertEquals("Check upf", upf, new Integer(1));
+ assertEquals("Check upc", upc, new Integer(1));
+ assertEquals("Check upbool", upbool, new Integer(1));
+
+ reconfigureString(instance);
+
+ ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ check = (CheckService) osgiHelper.getServiceObject(ref);
+ props = check.getProps();
+
+ b = (byte[]) props.get("bs");
+ s = (short[]) props.get("ss");
+ i = (int[]) props.get("is");
+ l = (long[]) props.get("ls");
+ d = (double[]) props.get("ds");
+ f = (float[]) props.get("fs");
+ c = (char[]) props.get("cs");
+ bool = (boolean[]) props.get("bools");
+
+ assertEquals("2) Check b 0", b[0], 3);
+ assertEquals("2) Check b 1", b[1], 2);
+ assertEquals("2) Check b 2", b[2], 1);
+ assertEquals("2) Check s 0", s[0], 3);
+ assertEquals("2) Check s 1", s[1], 2);
+ assertEquals("2) Check s 2", s[2], 1);
+ assertEquals("2) Check i 0", i[0], 3);
+ assertEquals("2) Check i 1", i[1], 2);
+ assertEquals("2) Check i 2", i[2], 1);
+ assertEquals("2) Check l 0", l[0], 3);
+ assertEquals("2) Check l 1", l[1], 2);
+ assertEquals("2) Check l 2", l[2], 1);
+ assertEquals("2) Check d 0", d[0], 3.0);
+ assertEquals("2) Check d 1", d[1], 2.0);
+ assertEquals("2) Check d 2", d[2], 1.0);
+ assertEquals("2) Check f 0", f[0], 3, 0);
+ assertEquals("2) Check f 1", f[1], 2, 0);
+ assertEquals("2) Check f 2", f[2], 1, 0);
+ assertEquals("2) Check c 0", c[0], 'c');
+ assertEquals("2) Check c 1", c[1], 'b');
+ assertEquals("2) Check c 2", c[2], 'a');
+ assertFalse("2) Check bool 0", bool[0]);
+ assertFalse("2) Check bool 1", bool[0]);
+ assertFalse("2) Check bool 2", bool[0]);
+
+ upb = (Integer) props.get("upbs");
+ ups = (Integer) props.get("upss");
+ upi = (Integer) props.get("upis");
+ upl = (Integer) props.get("upls");
+ upd = (Integer) props.get("upds");
+ upf = (Integer) props.get("upfs");
+ upc = (Integer) props.get("upcs");
+ upbool = (Integer) props.get("upbools");
+
+ assertEquals("2) Check upb", upb, new Integer(2));
+ assertEquals("2) Check ups", ups, new Integer(2));
+ assertEquals("2) Check upi", upi, new Integer(2));
+ assertEquals("2) Check upl", upl, new Integer(2));
+ assertEquals("2) Check upd", upd, new Integer(2));
+ assertEquals("2) Check upf", upf, new Integer(2));
+ assertEquals("2) Check upc", upc, new Integer(2));
+ assertEquals("2) Check upbool", upbool, new Integer(2));
+
+ }
+
+ @Test
+ public void testConfigurationObj() {
+ ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ CheckService check = (CheckService) osgiHelper.getServiceObject(ref);
+ Properties props = check.getProps();
+
+ String s = (String) props.get("string");
+ String[] ss = (String[]) props.get("strings");
+
+ assertEquals("Check string", s, "foo");
+ assertEquals("Check strings 0", ss[0], "foo");
+ assertEquals("Check strings 1", ss[1], "bar");
+ assertEquals("Check strings 2", ss[2], "baz");
+
+ Integer upString = (Integer) props.get("upstring");
+ Integer upStrings = (Integer) props.get("upstrings");
+
+ assertEquals("Check upString", upString, new Integer(1));
+ assertEquals("Check upStrings", upStrings, new Integer(1));
+
+ reconfigure(instance);
+
+ ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ check = (CheckService) osgiHelper.getServiceObject(ref);
+ props = check.getProps();
+
+ s = (String) props.get("string");
+ ss = (String[]) props.get("strings");
+
+ assertEquals("2) Check string", s, "bar");
+ assertEquals("2) Check strings 0", ss[0], "baz");
+ assertEquals("2) Check strings 1", ss[1], "bar");
+ assertEquals("2) Check strings 2", ss[2], "foo");
+
+ upString = (Integer) props.get("upstring");
+ upStrings = (Integer) props.get("upstrings");
+
+ assertEquals("2) Check upstring", upString, new Integer(2));
+ assertEquals("2) Check upstrings", upStrings, new Integer(2));
+ }
+
+ @Test
+ public void testConfigurationObjString() {
+ ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ CheckService check = (CheckService) osgiHelper.getServiceObject(ref);
+ Properties props = check.getProps();
+
+ String s = (String) props.get("string");
+ String[] ss = (String[]) props.get("strings");
+
+ assertEquals("Check string", s, "foo");
+ assertEquals("Check strings 0", ss[0], "foo");
+ assertEquals("Check strings 1", ss[1], "bar");
+ assertEquals("Check strings 2", ss[2], "baz");
+
+ Integer upString = (Integer) props.get("upstring");
+ Integer upStrings = (Integer) props.get("upstrings");
+
+ assertEquals("Check upString", upString, new Integer(1));
+ assertEquals("Check upStrings", upStrings, new Integer(1));
+
+ reconfigureString(instance);
+
+ ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ check = (CheckService) osgiHelper.getServiceObject(ref);
+ props = check.getProps();
+
+ s = (String) props.get("string");
+ ss = (String[]) props.get("strings");
+
+ assertEquals("2) Check string", s, "bar");
+ assertEquals("2) Check strings 0", ss[0], "baz");
+ assertEquals("2) Check strings 1", ss[1], "bar");
+ assertEquals("2) Check strings 2", ss[2], "foo");
+
+ upString = (Integer) props.get("upstring");
+ upStrings = (Integer) props.get("upstrings");
+
+ assertEquals("2) Check upstring", upString, new Integer(2));
+ assertEquals("2) Check upstrings", upStrings, new Integer(2));
+ }
+
+ private void reconfigure(ComponentInstance ci) {
+ Properties props2 = new Properties();
+ props2.put("b", new Byte("2"));
+ props2.put("s", new Short("2"));
+ props2.put("i", new Integer("2"));
+ props2.put("l", new Long("2"));
+ props2.put("d", new Double("2"));
+ props2.put("f", new Float("2"));
+ props2.put("c", new Character('b'));
+ props2.put("bool", new Boolean(false));
+ props2.put("bs", new byte[]{(byte) 3, (byte) 2, (byte) 1});
+ props2.put("ss", new short[]{(short) 3, (short) 2, (short) 1});
+ props2.put("is", new int[]{3, 2, 1});
+ props2.put("ls", new long[]{3, 2, 1});
+ props2.put("ds", new double[]{3, 2, 1});
+ props2.put("fs", new float[]{3, 2, 1});
+ props2.put("cs", new char[]{'c', 'b', 'a'});
+ props2.put("bools", new boolean[]{false, false, false});
+ props2.put("string", "bar");
+ props2.put("strings", new String[]{"baz", "bar", "foo"});
+
+ ci.reconfigure(props2);
+ }
+
+ private void reconfigureString(ComponentInstance ci) {
+ Properties props2 = new Properties();
+ props2.put("b", "2");
+ props2.put("s", "2");
+ props2.put("i", "2");
+ props2.put("l", "2");
+ props2.put("d", "2");
+ props2.put("f", "2");
+ props2.put("c", "b");
+ props2.put("bool", "false");
+ props2.put("bs", "{3, 2,1}");
+ props2.put("ss", "{3, 2,1}");
+ props2.put("is", "{3, 2,1}");
+ props2.put("ls", "{3, 2,1}");
+ props2.put("ds", "{3, 2,1}");
+ props2.put("fs", "{3, 2,1}");
+ props2.put("cs", "{c, b , a}");
+ props2.put("bools", "{false,false,false}");
+ props2.put("string", "bar");
+ props2.put("strings", "{baz, bar, foo}");
+
+ ci.reconfigure(props2);
+ }
+
+ @Test
+ public void testConfigurationPrimitiveNoValue() {
+ ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance2.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ CheckService check = (CheckService) osgiHelper.getServiceObject(ref);
+ Properties props = check.getProps();
+
+ Byte b = (Byte) props.get("b");
+ Short s = (Short) props.get("s");
+ Integer i = (Integer) props.get("i");
+ Long l = (Long) props.get("l");
+ Double d = (Double) props.get("d");
+ Float f = (Float) props.get("f");
+ Character c = (Character) props.get("c");
+ Boolean bool = (Boolean) props.get("bool");
+
+ assertEquals("Check b", b, new Byte("0"));
+ assertEquals("Check s", s, new Short("0"));
+ assertEquals("Check i", i, new Integer("0"));
+ assertEquals("Check l", l, new Long("0"));
+ assertEquals("Check d", d, new Double("0"));
+ assertEquals("Check f", f, new Float("0"));
+ assertEquals("Check c", c, new Character((char) 0));
+ assertEquals("Check bool", bool, new Boolean(false));
+
+ Integer upb = (Integer) props.get("upb");
+ Integer ups = (Integer) props.get("ups");
+ Integer upi = (Integer) props.get("upi");
+ Integer upl = (Integer) props.get("upl");
+ Integer upd = (Integer) props.get("upd");
+ Integer upf = (Integer) props.get("upf");
+ Integer upc = (Integer) props.get("upc");
+ Integer upbool = (Integer) props.get("upbool");
+
+ assertEquals("Check upb", upb, new Integer(0));
+ assertEquals("Check ups", ups, new Integer(0));
+ assertEquals("Check upi", upi, new Integer(0));
+ assertEquals("Check upl", upl, new Integer(0));
+ assertEquals("Check upd", upd, new Integer(0));
+ assertEquals("Check upf", upf, new Integer(0));
+ assertEquals("Check upc", upc, new Integer(0));
+ assertEquals("Check upbool", upbool, new Integer(0));
+
+ reconfigure(instance2);
+
+ ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance2.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ check = (CheckService) osgiHelper.getServiceObject(ref);
+ props = check.getProps();
+
+ b = (Byte) props.get("b");
+ s = (Short) props.get("s");
+ i = (Integer) props.get("i");
+ l = (Long) props.get("l");
+ d = (Double) props.get("d");
+ f = (Float) props.get("f");
+ c = (Character) props.get("c");
+ bool = (Boolean) props.get("bool");
+
+ assertEquals("2) Check b (" + b + ")", b, new Byte("2"));
+ assertEquals("2) Check s", s, new Short("2"));
+ assertEquals("2) Check i", i, new Integer("2"));
+ assertEquals("2) Check l", l, new Long("2"));
+ assertEquals("2) Check d", d, new Double("2"));
+ assertEquals("2) Check f", f, new Float("2"));
+ assertEquals("2) Check c", c, new Character('b'));
+ assertEquals("2) Check bool", bool, new Boolean("false"));
+
+ upb = (Integer) props.get("upb");
+ ups = (Integer) props.get("ups");
+ upi = (Integer) props.get("upi");
+ upl = (Integer) props.get("upl");
+ upd = (Integer) props.get("upd");
+ upf = (Integer) props.get("upf");
+ upc = (Integer) props.get("upc");
+ upbool = (Integer) props.get("upbool");
+
+ assertEquals("2) Check upb", upb, new Integer(1));
+ assertEquals("2) Check ups", ups, new Integer(1));
+ assertEquals("2) Check upi", upi, new Integer(1));
+ assertEquals("2) Check upl", upl, new Integer(1));
+ assertEquals("2) Check upd", upd, new Integer(1));
+ assertEquals("2) Check upf", upf, new Integer(1));
+ assertEquals("2) Check upc", upc, new Integer(1));
+ //assertEquals("2) Check upbool", upbool, new Integer(1)); // TODO Why 0 ???
+
+ }
+
+ @Test
+ public void testConfigurationPrimitiveArraysNoValue() {
+ ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance2.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ CheckService check = (CheckService) osgiHelper.getServiceObject(ref);
+ Properties props = check.getProps();
+
+ byte[] b = (byte[]) props.get("bs");
+ short[] s = (short[]) props.get("ss");
+ int[] i = (int[]) props.get("is");
+ long[] l = (long[]) props.get("ls");
+ double[] d = (double[]) props.get("ds");
+ float[] f = (float[]) props.get("fs");
+ char[] c = (char[]) props.get("cs");
+ boolean[] bool = (boolean[]) props.get("bools");
+
+ assertNull("Check b nullity", b);
+ assertNull("Check s nullity", s);
+ assertNull("Check i nullity", i);
+ assertNull("Check l nullity", l);
+ assertNull("Check d nullity", d);
+ assertNull("Check f nullity", f);
+ assertNull("Check c nullity", c);
+ assertNull("Check bool nullity", bool);
+
+ Integer upb = (Integer) props.get("upbs");
+ Integer ups = (Integer) props.get("upss");
+ Integer upi = (Integer) props.get("upis");
+ Integer upl = (Integer) props.get("upls");
+ Integer upd = (Integer) props.get("upds");
+ Integer upf = (Integer) props.get("upfs");
+ Integer upc = (Integer) props.get("upcs");
+ Integer upbool = (Integer) props.get("upbools");
+
+ assertEquals("Check upb", upb, new Integer(0));
+ assertEquals("Check ups", ups, new Integer(0));
+ assertEquals("Check upi", upi, new Integer(0));
+ assertEquals("Check upl", upl, new Integer(0));
+ assertEquals("Check upd", upd, new Integer(0));
+ assertEquals("Check upf", upf, new Integer(0));
+ assertEquals("Check upc", upc, new Integer(0));
+ assertEquals("Check upbool", upbool, new Integer(0));
+
+ reconfigure(instance2);
+
+ ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance2.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ check = (CheckService) osgiHelper.getServiceObject(ref);
+ props = check.getProps();
+
+ b = (byte[]) props.get("bs");
+ s = (short[]) props.get("ss");
+ i = (int[]) props.get("is");
+ l = (long[]) props.get("ls");
+ d = (double[]) props.get("ds");
+ f = (float[]) props.get("fs");
+ c = (char[]) props.get("cs");
+ bool = (boolean[]) props.get("bools");
+
+ assertEquals("2) Check b 0", b[0], 3);
+ assertEquals("2) Check b 1", b[1], 2);
+ assertEquals("2) Check b 2", b[2], 1);
+ assertEquals("2) Check s 0", s[0], 3);
+ assertEquals("2) Check s 1", s[1], 2);
+ assertEquals("2) Check s 2", s[2], 1);
+ assertEquals("2) Check i 0", i[0], 3);
+ assertEquals("2) Check i 1", i[1], 2);
+ assertEquals("2) Check i 2", i[2], 1);
+ assertEquals("2) Check l 0", l[0], 3);
+ assertEquals("2) Check l 1", l[1], 2);
+ assertEquals("2) Check l 2", l[2], 1);
+ assertEquals("2) Check d 0", d[0], 3.0);
+ assertEquals("2) Check d 1", d[1], 2.0);
+ assertEquals("2) Check d 2", d[2], 1.0);
+ assertEquals("2) Check f 0", f[0], 3, 0);
+ assertEquals("2) Check f 1", f[1], 2, 0);
+ assertEquals("2) Check f 2", f[2], 1, 0);
+ assertEquals("2) Check c 0", c[0], 'c');
+ assertEquals("2) Check c 1", c[1], 'b');
+ assertEquals("2) Check c 2", c[2], 'a');
+ assertFalse("2) Check bool 0", bool[0]);
+ assertFalse("2) Check bool 1", bool[0]);
+ assertFalse("2) Check bool 2", bool[0]);
+
+ upb = (Integer) props.get("upbs");
+ ups = (Integer) props.get("upss");
+ upi = (Integer) props.get("upis");
+ upl = (Integer) props.get("upls");
+ upd = (Integer) props.get("upds");
+ upf = (Integer) props.get("upfs");
+ upc = (Integer) props.get("upcs");
+ upbool = (Integer) props.get("upbools");
+
+ assertEquals("2) Check upb", upb, new Integer(1));
+ assertEquals("2) Check ups", ups, new Integer(1));
+ assertEquals("2) Check upi", upi, new Integer(1));
+ assertEquals("2) Check upl", upl, new Integer(1));
+ assertEquals("2) Check upd", upd, new Integer(1));
+ assertEquals("2) Check upf", upf, new Integer(1));
+ assertEquals("2) Check upc", upc, new Integer(1));
+ assertEquals("2) Check upbool", upbool, new Integer(1));
+
+ }
+
+ @Test
+ public void testConfigurationObjNoValue() {
+ ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance2.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ CheckService check = (CheckService) osgiHelper.getServiceObject(ref);
+ Properties props = check.getProps();
+
+
+ String s = (String) props.get("string");
+ String[] ss = (String[]) props.get("strings");
+
+ assertEquals("Check string", s, null);
+ assertEquals("Check strings", ss, null);
+
+
+ Integer upString = (Integer) props.get("upstring");
+ Integer upStrings = (Integer) props.get("upstrings");
+
+ assertEquals("Check upString", upString, new Integer(0));
+ assertEquals("Check upStrings", upStrings, new Integer(0));
+
+ reconfigure(instance2);
+
+ ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance2.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ check = (CheckService) osgiHelper.getServiceObject(ref);
+ props = check.getProps();
+
+ s = (String) props.get("string");
+ ss = (String[]) props.get("strings");
+
+ assertEquals("2) Check string", s, "bar");
+ assertEquals("2) Check strings 0", ss[0], "baz");
+ assertEquals("2) Check strings 1", ss[1], "bar");
+ assertEquals("2) Check strings 2", ss[2], "foo");
+
+ upString = (Integer) props.get("upstring");
+ upStrings = (Integer) props.get("upstrings");
+
+ assertEquals("2) Check upstring", upString, new Integer(1));
+ assertEquals("2) Check upstrings", upStrings, new Integer(1));
+ }
+
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestComplexProperties.java b/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestComplexProperties.java
new file mode 100644
index 0000000..b784302
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestComplexProperties.java
@@ -0,0 +1,215 @@
+package org.apache.felix.ipojo.runtime.core;
+
+import org.apache.felix.ipojo.runtime.core.services.CheckService;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.osgi.framework.ServiceReference;
+
+import java.util.Dictionary;
+import java.util.List;
+import java.util.Map;
+
+import static junit.framework.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+
+public class TestComplexProperties extends Common {
+
+
+ private ServiceReference m_ref;
+ private CheckService m_check;
+
+ @Before
+ public void setUp() {
+ m_ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), "complex");
+ assertNotNull("Complex service availability", m_ref);
+ m_check = (CheckService) osgiHelper.getServiceObject(m_ref);
+ }
+
+ @After
+ public void tearDown() {
+ m_check = null;
+
+ }
+
+ @Test
+ public void testArray() {
+ String[] array = (String[]) m_check.getProps().get("array");
+ assertEquals("Array size", 2, array.length);
+ assertEquals("Array[0]", "a", array[0]);
+ assertEquals("Array[1]", "b", array[1]);
+ }
+
+ @Test
+ public void testList() {
+ List list = (List) m_check.getProps().get("list");
+ assertEquals("List size", 2, list.size());
+ assertEquals("List[0]", "a", list.get(0));
+ assertEquals("List[1]", "b", list.get(1));
+ }
+
+ @Test
+ public void testMap() {
+ Map map = (Map) m_check.getProps().get("map");
+ assertEquals("Map size", 2, map.size());
+ assertEquals("Map[a]", "a", map.get("a"));
+ assertEquals("Map[b]", "b", map.get("b"));
+ }
+
+ @Test
+ public void testDictionary() {
+ Dictionary dict = (Dictionary) m_check.getProps().get("dict");
+ assertEquals("Map size", 2, dict.size());
+ assertEquals("Map[a]", "a", dict.get("a"));
+ assertEquals("Map[b]", "b", dict.get("b"));
+ }
+
+ @Test
+ public void testComplexArray() {
+ Object[] array = (Object[]) m_check.getProps().get("complex-array");
+ assertEquals("Array size", 2, array.length);
+ assertTrue("Array[0] type", array[0] instanceof List);
+ assertTrue("Array[1] type", array[1] instanceof List);
+ List list = (List) array[0];
+ assertEquals("List size", 2, list.size());
+ assertEquals("List[0]", "a", list.get(0));
+ assertEquals("List[1]", "b", list.get(1));
+ list = (List) array[1];
+ assertEquals("List size - 2", 2, list.size());
+ assertEquals("List[0] - 2", "c", list.get(0));
+ assertEquals("List[1] - 2", "d", list.get(1));
+ }
+
+ @Test
+ public void testComplexList() {
+ List list = (List) m_check.getProps().get("complex-list");
+ assertEquals("List size", 2, list.size());
+ assertTrue("List[0] type", list.get(0) instanceof List);
+ assertTrue("List[1] type", list.get(1) instanceof List);
+ List list1 = (List) list.get(0);
+ assertEquals("List size - 1", 2, list1.size());
+ assertEquals("List[0] - 1", "a", list1.get(0));
+ assertEquals("List[1] - 1", "b", list1.get(1));
+ list1 = (List) list.get(1);
+ assertEquals("List size - 2", 2, list1.size());
+ assertEquals("List[0] - 2", "c", list1.get(0));
+ assertEquals("List[1] - 2", "d", list1.get(1));
+ }
+
+ @Test
+ public void testComplexMap() {
+ Map map = (Map) m_check.getProps().get("complex-map");
+ assertEquals("List size", 2, map.size());
+ assertTrue("List[0] type", map.get("a") instanceof List);
+ assertTrue("List[1] type", map.get("b") instanceof List);
+ List list = (List) map.get("a");
+ assertEquals("List size - 1", 2, list.size());
+ assertEquals("List[0] - 1", "a", list.get(0));
+ assertEquals("List[1] - 1", "b", list.get(1));
+ list = (List) map.get("b");
+ assertEquals("List size - 2", 2, list.size());
+ assertEquals("List[0] - 2", "c", list.get(0));
+ assertEquals("List[1] - 2", "d", list.get(1));
+ }
+
+ @Test
+ public void testServiceArray() {
+ String[] array = (String[]) m_ref.getProperty("array");
+ assertEquals("Array size", 2, array.length);
+ assertEquals("Array[0]", "a", array[0]);
+ assertEquals("Array[1]", "b", array[1]);
+ }
+
+ @Test
+ public void testServiceList() {
+ List list = (List) m_ref.getProperty("list");
+ assertEquals("List size", 2, list.size());
+ assertEquals("List[0]", "a", list.get(0));
+ assertEquals("List[1]", "b", list.get(1));
+ }
+
+ @Test
+ public void testServiceMap() {
+ Map map = (Map) m_ref.getProperty("map");
+ assertEquals("Map size", 2, map.size());
+ assertEquals("Map[a]", "a", map.get("a"));
+ assertEquals("Map[b]", "b", map.get("b"));
+ }
+
+ @Test
+ public void testServiceDictionary() {
+ Dictionary dict = (Dictionary) m_ref.getProperty("dict");
+ assertEquals("Map size", 2, dict.size());
+ assertEquals("Map[a]", "a", dict.get("a"));
+ assertEquals("Map[b]", "b", dict.get("b"));
+ }
+
+ @Test
+ public void testServiceComplexArray() {
+ Object[] array = (Object[]) m_ref.getProperty("complex-array");
+ assertEquals("Array size", 2, array.length);
+ assertTrue("Array[0] type", array[0] instanceof List);
+ assertTrue("Array[1] type", array[1] instanceof List);
+ List list = (List) array[0];
+ assertEquals("List size", 2, list.size());
+ assertEquals("List[0]", "a", list.get(0));
+ assertEquals("List[1]", "b", list.get(1));
+ list = (List) array[1];
+ assertEquals("List size - 2", 2, list.size());
+ assertEquals("List[0] - 2", "c", list.get(0));
+ assertEquals("List[1] - 2", "d", list.get(1));
+ }
+
+ @Test
+ public void testServiceComplexList() {
+ List list = (List) m_ref.getProperty("complex-list");
+ assertEquals("List size", 2, list.size());
+ assertTrue("List[0] type", list.get(0) instanceof List);
+ assertTrue("List[1] type", list.get(1) instanceof List);
+ List list1 = (List) list.get(0);
+ assertEquals("List size - 1", 2, list1.size());
+ assertEquals("List[0] - 1", "a", list1.get(0));
+ assertEquals("List[1] - 1", "b", list1.get(1));
+ list1 = (List) list.get(1);
+ assertEquals("List size - 2", 2, list1.size());
+ assertEquals("List[0] - 2", "c", list1.get(0));
+ assertEquals("List[1] - 2", "d", list1.get(1));
+ }
+
+ @Test
+ public void testServiceComplexMap() {
+ Map map = (Map) m_ref.getProperty("complex-map");
+ assertEquals("List size", 2, map.size());
+ assertTrue("List[0] type", map.get("a") instanceof List);
+ assertTrue("List[1] type", map.get("b") instanceof List);
+ List list = (List) map.get("a");
+ assertEquals("List size - 1", 2, list.size());
+ assertEquals("List[0] - 1", "a", list.get(0));
+ assertEquals("List[1] - 1", "b", list.get(1));
+ list = (List) map.get("b");
+ assertEquals("List size - 2", 2, list.size());
+ assertEquals("List[0] - 2", "c", list.get(0));
+ assertEquals("List[1] - 2", "d", list.get(1));
+ }
+
+ @Test
+ public void testServiceEmptyArray() {
+ String[] array = (String[]) m_ref.getProperty("empty-array");
+ assertEquals("Array size", 0, array.length);
+ }
+
+ @Test
+ public void testServiceEmptyList() {
+ List list = (List) m_ref.getProperty("empty-list");
+ assertEquals("List size", 0, list.size());
+ }
+
+ @Test
+ public void testServiceEmptyMap() {
+ Map map = (Map) m_ref.getProperty("empty-map");
+ assertEquals("Map size", 0, map.size());
+ }
+
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestDynamicallyConfigurableProperties.java b/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestDynamicallyConfigurableProperties.java
new file mode 100644
index 0000000..345eed9
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestDynamicallyConfigurableProperties.java
@@ -0,0 +1,392 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.ipojo.runtime.core;
+
+import org.apache.felix.ipojo.ComponentInstance;
+import org.apache.felix.ipojo.runtime.core.services.FooService;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.cm.ConfigurationException;
+import org.osgi.service.cm.ManagedServiceFactory;
+
+import java.util.Hashtable;
+import java.util.Properties;
+
+import static junit.framework.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
+
+public class TestDynamicallyConfigurableProperties extends Common {
+
+ ComponentInstance instance, instance2;
+
+ @Before
+ public void setUp() {
+ String type = "CONFIG-FooProviderType-3";
+
+ Hashtable<String, String> p1 = new Hashtable<String, String>();
+ p1.put("instance.name", "instance");
+ p1.put("foo", "foo");
+ p1.put("bar", "2");
+ p1.put("baz", "baz");
+ instance = ipojoHelper.createComponentInstance(type, p1);
+
+ Hashtable<String, String> p2 = new Hashtable<String, String>();
+ p2.put("instance.name", "instance2");
+
+ instance2 = ipojoHelper.createComponentInstance(type, p2);
+ }
+
+ @After
+ public void tearDown() {
+ instance.dispose();
+ instance2.dispose();
+ instance2 = null;
+ instance = null;
+ }
+
+ @Test
+ public void testStatic() {
+ ServiceReference fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance.getInstanceName());
+ assertNotNull("Check FS availability", fooRef);
+ String fooP = (String) fooRef.getProperty("foo");
+ Integer barP = (Integer) fooRef.getProperty("bar");
+ String bazP = (String) fooRef.getProperty("baz");
+ assertEquals("Check foo equality -1", fooP, "foo");
+ assertEquals("Check bar equality -1", barP, new Integer(2));
+ assertEquals("Check baz equality -1", bazP, "baz");
+
+ ServiceReference msRef = ipojoHelper.getServiceReferenceByName(ManagedServiceFactory.class.getName(), instance.getFactory().getName());
+ assertNotNull("Check ManagedServiceFactory availability", msRef);
+
+
+ // Configuration of baz
+ Properties conf = new Properties();
+ conf.put("baz", "zab");
+ conf.put("bar", new Integer(2));
+ conf.put("foo", "foo");
+ ManagedServiceFactory ms = (ManagedServiceFactory) osgiHelper.getContext().getService(msRef);
+ try {
+ ms.updated(instance.getInstanceName(), conf);
+ } catch (ConfigurationException e) {
+ fail("Configuration Exception : " + e);
+ }
+
+ // Recheck props
+ fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance.getInstanceName());
+ fooP = (String) fooRef.getProperty("foo");
+ barP = (Integer) fooRef.getProperty("bar");
+ bazP = (String) fooRef.getProperty("baz");
+ assertEquals("Check foo equality -2", fooP, "foo");
+ assertEquals("Check bar equality -2", barP, new Integer(2));
+ assertEquals("Check baz equality -2", bazP, "zab");
+ osgiHelper.getContext().ungetService(msRef);
+ }
+
+
+ @Test
+ public void testStaticNoValue() {
+ ServiceReference fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance2.getInstanceName());
+ assertNotNull("Check FS availability", fooRef);
+ Object fooP = fooRef.getProperty("foo");
+ Object barP = fooRef.getProperty("bar");
+ Object bazP = fooRef.getProperty("baz");
+ assertEquals("Check foo equality -1", fooP, null);
+ assertEquals("Check bar equality -1", barP, null);
+ assertEquals("Check baz equality -1", bazP, null);
+
+ ServiceReference msRef = ipojoHelper.getServiceReferenceByName(ManagedServiceFactory.class.getName(), instance2.getFactory().getName());
+ assertNotNull("Check ManagedServiceFactory availability", msRef);
+
+
+ // Configuration of baz
+ Properties conf = new Properties();
+ conf.put("baz", "zab");
+ conf.put("bar", new Integer(2));
+ conf.put("foo", "foo");
+ ManagedServiceFactory ms = (ManagedServiceFactory) osgiHelper.getContext().getService(msRef);
+ try {
+ ms.updated(instance2.getInstanceName(), conf);
+ } catch (ConfigurationException e) {
+ fail("Configuration Exception : " + e);
+ }
+
+ // Recheck props
+ fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance2.getInstanceName());
+ fooP = (String) fooRef.getProperty("foo");
+ barP = (Integer) fooRef.getProperty("bar");
+ bazP = (String) fooRef.getProperty("baz");
+ assertEquals("Check foo equality -2", fooP, "foo");
+ assertEquals("Check bar equality -2", barP, new Integer(2));
+ assertEquals("Check baz equality -2", bazP, "zab");
+ osgiHelper.getContext().ungetService(msRef);
+ }
+
+ @Test
+ public void testDynamic() {
+ ServiceReference fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance.getInstanceName());
+ assertNotNull("Check FS availability", fooRef);
+
+ String fooP = (String) fooRef.getProperty("foo");
+ Integer barP = (Integer) fooRef.getProperty("bar");
+ String bazP = (String) fooRef.getProperty("baz");
+
+ assertEquals("Check foo equality", fooP, "foo");
+ assertEquals("Check bar equality", barP, new Integer(2));
+ assertEquals("Check baz equality", bazP, "baz");
+
+ ServiceReference msRef = ipojoHelper.getServiceReferenceByName(ManagedServiceFactory.class.getName(), instance.getFactory().getName());
+ assertNotNull("Check ManagedServiceFactory availability", msRef);
+
+ // Configuration of baz
+ Properties conf = new Properties();
+ conf.put("baz", "zab");
+ conf.put("foo", "oof");
+ conf.put("bar", new Integer(0));
+ ManagedServiceFactory ms = (ManagedServiceFactory) osgiHelper.getContext().getService(msRef);
+ try {
+ ms.updated(instance.getInstanceName(), conf);
+ } catch (ConfigurationException e) {
+ fail("Configuration Exception : " + e);
+ }
+
+ // Recheck props
+ fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance.getInstanceName());
+ fooP = (String) fooRef.getProperty("foo");
+ barP = (Integer) fooRef.getProperty("bar");
+ bazP = (String) fooRef.getProperty("baz");
+
+ assertEquals("Check foo equality", fooP, "oof");
+ assertEquals("Check bar equality", barP, new Integer(0));
+ assertEquals("Check baz equality", bazP, "zab");
+
+ // Check field value
+ FooService fs = (FooService) osgiHelper.getContext().getService(fooRef);
+ Properties p = fs.fooProps();
+ fooP = (String) p.get("foo");
+ barP = (Integer) p.get("bar");
+
+ assertEquals("Check foo field equality", fooP, "oof");
+ assertEquals("Check bar field equality", barP, new Integer(0));
+
+ osgiHelper.getContext().ungetService(fooRef);
+ osgiHelper.getContext().ungetService(msRef);
+ }
+
+ @Test
+ public void testDynamicNoValue() {
+ ServiceReference fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance2.getInstanceName());
+ assertNotNull("Check FS availability", fooRef);
+
+ Object fooP = fooRef.getProperty("foo");
+ Object barP = fooRef.getProperty("bar");
+ Object bazP = fooRef.getProperty("baz");
+ assertEquals("Check foo equality -1", fooP, null);
+ assertEquals("Check bar equality -1", barP, null);
+ assertEquals("Check baz equality -1", bazP, null);
+
+ ServiceReference msRef = ipojoHelper.getServiceReferenceByName(ManagedServiceFactory.class.getName(), instance2.getFactory().getName());
+ assertNotNull("Check ManagedServiceFactory availability", msRef);
+
+ // Configuration of baz
+ Properties conf = new Properties();
+ conf.put("baz", "zab");
+ conf.put("foo", "oof");
+ conf.put("bar", new Integer(0));
+ ManagedServiceFactory ms = (ManagedServiceFactory) osgiHelper.getContext().getService(msRef);
+ try {
+ ms.updated(instance2.getInstanceName(), conf);
+ } catch (ConfigurationException e) {
+ fail("Configuration Exception : " + e);
+ }
+
+ // Recheck props
+ fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance2.getInstanceName());
+ fooP = (String) fooRef.getProperty("foo");
+ barP = (Integer) fooRef.getProperty("bar");
+ bazP = (String) fooRef.getProperty("baz");
+
+ assertEquals("Check foo equality", fooP, "oof");
+ assertEquals("Check bar equality", barP, new Integer(0));
+ assertEquals("Check baz equality", bazP, "zab");
+
+ // Check field value
+ FooService fs = (FooService) osgiHelper.getContext().getService(fooRef);
+ Properties p = fs.fooProps();
+ fooP = (String) p.get("foo");
+ barP = (Integer) p.get("bar");
+
+ assertEquals("Check foo field equality", fooP, "oof");
+ assertEquals("Check bar field equality", barP, new Integer(0));
+
+ osgiHelper.getContext().ungetService(fooRef);
+ osgiHelper.getContext().ungetService(msRef);
+ }
+
+ @Test
+ public void testDynamicString() {
+ ServiceReference fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance.getInstanceName());
+ assertNotNull("Check FS availability", fooRef);
+
+ String fooP = (String) fooRef.getProperty("foo");
+ Integer barP = (Integer) fooRef.getProperty("bar");
+ String bazP = (String) fooRef.getProperty("baz");
+
+ assertEquals("Check foo equality", fooP, "foo");
+ assertEquals("Check bar equality", barP, new Integer(2));
+ assertEquals("Check baz equality", bazP, "baz");
+
+ ServiceReference msRef = ipojoHelper.getServiceReferenceByName(ManagedServiceFactory.class.getName(), instance.getFactory().getName());
+ assertNotNull("Check ManagedServiceFactory availability", msRef);
+
+ // Configuration of baz
+ Properties conf = new Properties();
+ conf.put("baz", "zab");
+ conf.put("foo", "oof");
+ conf.put("bar", "0");
+ ManagedServiceFactory ms = (ManagedServiceFactory) osgiHelper.getContext().getService(msRef);
+ try {
+ ms.updated(instance.getInstanceName(), conf);
+ } catch (ConfigurationException e) {
+ fail("Configuration Exception : " + e);
+ }
+
+ // Recheck props
+ fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance.getInstanceName());
+ fooP = (String) fooRef.getProperty("foo");
+ barP = (Integer) fooRef.getProperty("bar");
+ bazP = (String) fooRef.getProperty("baz");
+
+ assertEquals("Check foo equality", fooP, "oof");
+ assertEquals("Check bar equality", barP, new Integer(0));
+ assertEquals("Check baz equality", bazP, "zab");
+
+ // Check field value
+ FooService fs = (FooService) osgiHelper.getContext().getService(fooRef);
+ Properties p = fs.fooProps();
+ fooP = (String) p.get("foo");
+ barP = (Integer) p.get("bar");
+
+ assertEquals("Check foo field equality", fooP, "oof");
+ assertEquals("Check bar field equality", barP, new Integer(0));
+
+ osgiHelper.getContext().ungetService(fooRef);
+ osgiHelper.getContext().ungetService(msRef);
+ }
+
+ @Test
+ public void testPropagation() {
+ ServiceReference fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance.getInstanceName());
+ assertNotNull("Check FS availability", fooRef);
+
+ String fooP = (String) fooRef.getProperty("foo");
+ Integer barP = (Integer) fooRef.getProperty("bar");
+ String bazP = (String) fooRef.getProperty("baz");
+
+ assertEquals("Check foo equality", fooP, "foo");
+ assertEquals("Check bar equality", barP, new Integer(2));
+ assertEquals("Check baz equality", bazP, "baz");
+
+ ServiceReference msRef = ipojoHelper.getServiceReferenceByName(ManagedServiceFactory.class.getName(), instance.getFactory().getName());
+ assertNotNull("Check ManagedServiceFactory availability", msRef);
+
+ // Configuration of baz
+ Properties conf = new Properties();
+ conf.put("baz", "zab");
+ conf.put("foo", "foo");
+ conf.put("bar", new Integer(2));
+ conf.put("propagated1", "propagated");
+ conf.put("propagated2", new Integer(1));
+ ManagedServiceFactory ms = (ManagedServiceFactory) osgiHelper.getContext().getService(msRef);
+ try {
+ ms.updated(instance.getInstanceName(), conf);
+ } catch (ConfigurationException e) {
+ fail("Configuration Exception : " + e);
+ }
+
+ // Recheck props
+ fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance.getInstanceName());
+ fooP = (String) fooRef.getProperty("foo");
+ barP = (Integer) fooRef.getProperty("bar");
+ bazP = (String) fooRef.getProperty("baz");
+ assertNotNull("Check the propagated1 existency", fooRef.getProperty("propagated1"));
+ String prop1 = (String) fooRef.getProperty("propagated1");
+ assertNotNull("Check the propagated2 existency", fooRef.getProperty("propagated2"));
+ Integer prop2 = (Integer) fooRef.getProperty("propagated2");
+
+ assertEquals("Check foo equality", fooP, "foo");
+ assertEquals("Check bar equality", barP, new Integer(2));
+ assertEquals("Check baz equality", bazP, "zab");
+ assertEquals("Check propagated1 equality", prop1, "propagated");
+ assertEquals("Check propagated2 equality", prop2, new Integer(1));
+
+ osgiHelper.getContext().ungetService(msRef);
+ }
+
+ @Test
+ public void testPropagationNoValue() {
+ ServiceReference fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance2.getInstanceName());
+ assertNotNull("Check FS availability", fooRef);
+
+ Object fooP = fooRef.getProperty("foo");
+ Object barP = fooRef.getProperty("bar");
+ Object bazP = fooRef.getProperty("baz");
+ assertEquals("Check foo equality -1", fooP, null);
+ assertEquals("Check bar equality -1", barP, null);
+ assertEquals("Check baz equality -1", bazP, null);
+
+ ServiceReference msRef = ipojoHelper.getServiceReferenceByName(ManagedServiceFactory.class.getName(), instance2.getFactory().getName());
+ assertNotNull("Check ManagedServiceFactory availability", msRef);
+
+ // Configuration of baz
+ Properties conf = new Properties();
+ conf.put("baz", "zab");
+ conf.put("foo", "foo");
+ conf.put("bar", new Integer(2));
+ conf.put("propagated1", "propagated");
+ conf.put("propagated2", new Integer(1));
+ ManagedServiceFactory ms = (ManagedServiceFactory) osgiHelper.getContext().getService(msRef);
+ try {
+ ms.updated(instance2.getInstanceName(), conf);
+ } catch (ConfigurationException e) {
+ fail("Configuration Exception : " + e);
+ }
+
+ // Recheck props
+ fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance2.getInstanceName());
+ fooP = (String) fooRef.getProperty("foo");
+ barP = (Integer) fooRef.getProperty("bar");
+ bazP = (String) fooRef.getProperty("baz");
+ assertNotNull("Check the propagated1 existency", fooRef.getProperty("propagated1"));
+ String prop1 = (String) fooRef.getProperty("propagated1");
+ assertNotNull("Check the propagated2 existency", fooRef.getProperty("propagated2"));
+ Integer prop2 = (Integer) fooRef.getProperty("propagated2");
+
+ assertEquals("Check foo equality", fooP, "foo");
+ assertEquals("Check bar equality", barP, new Integer(2));
+ assertEquals("Check baz equality", bazP, "zab");
+ assertEquals("Check propagated1 equality", prop1, "propagated");
+ assertEquals("Check propagated2 equality", prop2, new Integer(1));
+
+ osgiHelper.getContext().ungetService(msRef);
+ }
+
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestFieldProperties.java b/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestFieldProperties.java
new file mode 100644
index 0000000..47b20fe
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestFieldProperties.java
@@ -0,0 +1,775 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.ipojo.runtime.core;
+
+import org.apache.felix.ipojo.ComponentInstance;
+import org.apache.felix.ipojo.Factory;
+import org.apache.felix.ipojo.runtime.core.services.CheckService;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.osgi.framework.ServiceReference;
+import org.ow2.chameleon.testing.helpers.IPOJOHelper;
+import org.ow2.chameleon.testing.helpers.OSGiHelper;
+
+import java.util.Properties;
+
+import static junit.framework.Assert.assertEquals;
+import static org.junit.Assert.*;
+
+
+public class TestFieldProperties extends Common {
+
+ ComponentInstance instance;
+ ComponentInstance instance2;
+
+ @Before
+ public void setUp() {
+ osgiHelper = new OSGiHelper(bc);
+ ipojoHelper = new IPOJOHelper(bc);
+ Factory fact = ipojoHelper.getFactory("CONFIG-FieldConfigurableCheckService");
+ Properties props = new Properties();
+ props.put("instance.name", "under-test");
+ props.put("b", "1");
+ props.put("s", "1");
+ props.put("i", "1");
+ props.put("l", "1");
+ props.put("d", "1");
+ props.put("f", "1");
+ props.put("c", "a");
+ props.put("bool", "true");
+ props.put("bs", "{1,2,3}");
+ props.put("ss", "{1,2,3}");
+ props.put("is", "{1,2,3}");
+ props.put("ls", "{1,2,3}");
+ props.put("ds", "{1,2,3}");
+ props.put("fs", "{1,2,3}");
+ props.put("cs", "{a,b,c}");
+ props.put("bools", "{true,true,true}");
+ props.put("string", "foo");
+ props.put("strings", "{foo, bar, baz}");
+
+ try {
+ instance = fact.createComponentInstance(props);
+ } catch (Exception e) {
+ fail("Cannot create the under-test instance : " + e.getMessage());
+ }
+
+ try {
+ instance2 = fact.createComponentInstance(null);
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail("Cannot create the instance : " + e.getMessage());
+
+ }
+
+
+ }
+
+ @After
+ public void tearDown() {
+ ipojoHelper.dispose();
+ osgiHelper.dispose();
+ instance.dispose();
+ instance2.dispose();
+ instance = null;
+ instance2 = null;
+ }
+
+ @Test
+ public void testConfigurationPrimitive() {
+ ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ CheckService check = (CheckService) osgiHelper.getServiceObject(ref);
+ Properties props = check.getProps();
+
+ Byte b = (Byte) props.get("b");
+ Short s = (Short) props.get("s");
+ Integer i = (Integer) props.get("i");
+ Long l = (Long) props.get("l");
+ Double d = (Double) props.get("d");
+ Float f = (Float) props.get("f");
+ Character c = (Character) props.get("c");
+ Boolean bool = (Boolean) props.get("bool");
+
+ assertEquals("Check b", b, new Byte("1"));
+ assertEquals("Check s", s, new Short("1"));
+ assertEquals("Check i", i, new Integer("1"));
+ assertEquals("Check l", l, new Long("1"));
+ assertEquals("Check d", d, new Double("1"));
+ assertEquals("Check f", f, new Float("1"));
+ assertEquals("Check c", c, new Character('a'));
+ assertEquals("Check bool", bool, new Boolean("true"));
+
+ reconfigure(instance);
+
+ ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ check = (CheckService) osgiHelper.getServiceObject(ref);
+ props = check.getProps();
+
+ b = (Byte) props.get("b");
+ s = (Short) props.get("s");
+ i = (Integer) props.get("i");
+ l = (Long) props.get("l");
+ d = (Double) props.get("d");
+ f = (Float) props.get("f");
+ c = (Character) props.get("c");
+ bool = (Boolean) props.get("bool");
+
+ assertEquals("2) Check b", b, new Byte("2"));
+ assertEquals("2) Check s", s, new Short("2"));
+ assertEquals("2) Check i", i, new Integer("2"));
+ assertEquals("2) Check l", l, new Long("2"));
+ assertEquals("2) Check d", d, new Double("2"));
+ assertEquals("2) Check f", f, new Float("2"));
+ assertEquals("2) Check c", c, new Character('b'));
+ assertEquals("2) Check bool", bool, new Boolean("false"));
+
+ }
+
+ @Test
+ public void testConfigurationPrimitiveNoValue() {
+ ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance2.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ CheckService check = (CheckService) osgiHelper.getServiceObject(ref);
+ Properties props = check.getProps();
+
+ Byte b = (Byte) props.get("b");
+ Short s = (Short) props.get("s");
+ Integer i = (Integer) props.get("i");
+ Long l = (Long) props.get("l");
+ Double d = (Double) props.get("d");
+ Float f = (Float) props.get("f");
+ Character c = (Character) props.get("c");
+ Boolean bool = (Boolean) props.get("bool");
+
+ assertEquals("Check b", b, new Byte("0"));
+ assertEquals("Check s", s, new Short("0"));
+ assertEquals("Check i", i, new Integer("0"));
+ assertEquals("Check l", l, new Long("0"));
+ assertEquals("Check d", d, new Double("0"));
+ assertEquals("Check f", f, new Float("0"));
+ assertEquals("Check c", c, new Character((char) 0));
+ assertEquals("Check bool", bool, new Boolean(false));
+
+ reconfigure(instance2);
+
+ ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance2.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ check = (CheckService) osgiHelper.getServiceObject(ref);
+ props = check.getProps();
+
+ b = (Byte) props.get("b");
+ s = (Short) props.get("s");
+ i = (Integer) props.get("i");
+ l = (Long) props.get("l");
+ d = (Double) props.get("d");
+ f = (Float) props.get("f");
+ c = (Character) props.get("c");
+ bool = (Boolean) props.get("bool");
+
+ assertEquals("2) Check b", b, new Byte("2"));
+ assertEquals("2) Check s", s, new Short("2"));
+ assertEquals("2) Check i", i, new Integer("2"));
+ assertEquals("2) Check l", l, new Long("2"));
+ assertEquals("2) Check d", d, new Double("2"));
+ assertEquals("2) Check f", f, new Float("2"));
+ assertEquals("2) Check c", c, new Character('b'));
+ assertEquals("2) Check bool", bool, new Boolean("false"));
+
+ }
+
+ @Test
+ public void testConfigurationPrimitiveString() {
+ ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ CheckService check = (CheckService) osgiHelper.getServiceObject(ref);
+ Properties props = check.getProps();
+
+ Byte b = (Byte) props.get("b");
+ Short s = (Short) props.get("s");
+ Integer i = (Integer) props.get("i");
+ Long l = (Long) props.get("l");
+ Double d = (Double) props.get("d");
+ Float f = (Float) props.get("f");
+ Character c = (Character) props.get("c");
+ Boolean bool = (Boolean) props.get("bool");
+
+ assertEquals("Check b", b, new Byte("1"));
+ assertEquals("Check s", s, new Short("1"));
+ assertEquals("Check i", i, new Integer("1"));
+ assertEquals("Check l", l, new Long("1"));
+ assertEquals("Check d", d, new Double("1"));
+ assertEquals("Check f", f, new Float("1"));
+ assertEquals("Check c", c, new Character('a'));
+ assertEquals("Check bool", bool, new Boolean("true"));
+
+ reconfigureString(instance);
+
+ ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ check = (CheckService) osgiHelper.getServiceObject(ref);
+ props = check.getProps();
+
+ b = (Byte) props.get("b");
+ s = (Short) props.get("s");
+ i = (Integer) props.get("i");
+ l = (Long) props.get("l");
+ d = (Double) props.get("d");
+ f = (Float) props.get("f");
+ c = (Character) props.get("c");
+ bool = (Boolean) props.get("bool");
+
+ assertEquals("2) Check b", b, new Byte("2"));
+ assertEquals("2) Check s", s, new Short("2"));
+ assertEquals("2) Check i", i, new Integer("2"));
+ assertEquals("2) Check l", l, new Long("2"));
+ assertEquals("2) Check d", d, new Double("2"));
+ assertEquals("2) Check f", f, new Float("2"));
+ assertEquals("2) Check c", c, new Character('b'));
+ assertEquals("2) Check bool", bool, new Boolean("false"));
+
+ }
+
+ @Test
+ public void testConfigurationPrimitiveStringNoValue() {
+ ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance2.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ CheckService check = (CheckService) osgiHelper.getServiceObject(ref);
+ Properties props = check.getProps();
+
+ Byte b = (Byte) props.get("b");
+ Short s = (Short) props.get("s");
+ Integer i = (Integer) props.get("i");
+ Long l = (Long) props.get("l");
+ Double d = (Double) props.get("d");
+ Float f = (Float) props.get("f");
+ Character c = (Character) props.get("c");
+ Boolean bool = (Boolean) props.get("bool");
+
+ assertEquals("Check b", b, new Byte("0"));
+ assertEquals("Check s", s, new Short("0"));
+ assertEquals("Check i", i, new Integer("0"));
+ assertEquals("Check l", l, new Long("0"));
+ assertEquals("Check d", d, new Double("0"));
+ assertEquals("Check f", f, new Float("0"));
+ assertEquals("Check c", c, new Character((char) 0));
+ assertEquals("Check bool", bool, new Boolean(false));
+
+ reconfigureString(instance2);
+
+ ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance2.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ check = (CheckService) osgiHelper.getServiceObject(ref);
+ props = check.getProps();
+
+ b = (Byte) props.get("b");
+ s = (Short) props.get("s");
+ i = (Integer) props.get("i");
+ l = (Long) props.get("l");
+ d = (Double) props.get("d");
+ f = (Float) props.get("f");
+ c = (Character) props.get("c");
+ bool = (Boolean) props.get("bool");
+
+ assertEquals("2) Check b", b, new Byte("2"));
+ assertEquals("2) Check s", s, new Short("2"));
+ assertEquals("2) Check i", i, new Integer("2"));
+ assertEquals("2) Check l", l, new Long("2"));
+ assertEquals("2) Check d", d, new Double("2"));
+ assertEquals("2) Check f", f, new Float("2"));
+ assertEquals("2) Check c", c, new Character('b'));
+ assertEquals("2) Check bool", bool, new Boolean("false"));
+
+ }
+
+ @Test
+ public void testConfigurationPrimitiveArrays() {
+ ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ CheckService check = (CheckService) osgiHelper.getServiceObject(ref);
+ Properties props = check.getProps();
+
+ byte[] b = (byte[]) props.get("bs");
+ short[] s = (short[]) props.get("ss");
+ int[] i = (int[]) props.get("is");
+ long[] l = (long[]) props.get("ls");
+ double[] d = (double[]) props.get("ds");
+ float[] f = (float[]) props.get("fs");
+ char[] c = (char[]) props.get("cs");
+ boolean[] bool = (boolean[]) props.get("bools");
+
+ assertEquals("Check b 0", b[0], 1);
+ assertEquals("Check b 1", b[1], 2);
+ assertEquals("Check b 2", b[2], 3);
+ assertEquals("Check s 0", s[0], 1);
+ assertEquals("Check s 1", s[1], 2);
+ assertEquals("Check s 2", s[2], 3);
+ assertEquals("Check i 0", i[0], 1);
+ assertEquals("Check i 1", i[1], 2);
+ assertEquals("Check i 2", i[2], 3);
+ assertEquals("Check l 0", l[0], 1);
+ assertEquals("Check l 1", l[1], 2);
+ assertEquals("Check l 2", l[2], 3);
+ assertEquals("Check d 0", d[0], 1, 0);
+ assertEquals("Check d 1", d[1], 2, 0);
+ assertEquals("Check d 2", d[2], 3, 0);
+ assertEquals("Check f 0", f[0], 1, 0);
+ assertEquals("Check f 1", f[1], 2, 0);
+ assertEquals("Check f 2", f[2], 3, 0);
+ assertEquals("Check c 0", c[0], 'a');
+ assertEquals("Check c 1", c[1], 'b');
+ assertEquals("Check c 2", c[2], 'c');
+ assertTrue("Check bool 0", bool[0]);
+ assertTrue("Check bool 1", bool[0]);
+ assertTrue("Check bool 2", bool[0]);
+
+ reconfigure(instance);
+
+ ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ check = (CheckService) osgiHelper.getServiceObject(ref);
+ props = check.getProps();
+
+ b = (byte[]) props.get("bs");
+ s = (short[]) props.get("ss");
+ i = (int[]) props.get("is");
+ l = (long[]) props.get("ls");
+ d = (double[]) props.get("ds");
+ f = (float[]) props.get("fs");
+ c = (char[]) props.get("cs");
+ bool = (boolean[]) props.get("bools");
+
+ assertEquals("2) Check b 0", b[0], 3);
+ assertEquals("2) Check b 1", b[1], 2);
+ assertEquals("2) Check b 2", b[2], 1);
+ assertEquals("2) Check s 0", s[0], 3);
+ assertEquals("2) Check s 1", s[1], 2);
+ assertEquals("2) Check s 2", s[2], 1);
+ assertEquals("2) Check i 0", i[0], 3);
+ assertEquals("2) Check i 1", i[1], 2);
+ assertEquals("2) Check i 2", i[2], 1);
+ assertEquals("2) Check l 0", l[0], 3);
+ assertEquals("2) Check l 1", l[1], 2);
+ assertEquals("2) Check l 2", l[2], 1);
+ assertEquals("2) Check d 0", d[0], 3, 0);
+ assertEquals("2) Check d 1", d[1], 2, 0);
+ assertEquals("2) Check d 2", d[2], 1, 0);
+ assertEquals("2) Check f 0", f[0], 3, 0);
+ assertEquals("2) Check f 1", f[1], 2, 0);
+ assertEquals("2) Check f 2", f[2], 1, 0);
+ assertEquals("2) Check c 0", c[0], 'c');
+ assertEquals("2) Check c 1", c[1], 'b');
+ assertEquals("2) Check c 2", c[2], 'a');
+ assertFalse("2) Check bool 0", bool[0]);
+ assertFalse("2) Check bool 1", bool[0]);
+ assertFalse("2) Check bool 2", bool[0]);
+
+ }
+
+ @Test
+ public void testConfigurationPrimitiveArraysNoValue() {
+ ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance2.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ CheckService check = (CheckService) osgiHelper.getServiceObject(ref);
+ Properties props = check.getProps();
+
+ byte[] b = (byte[]) props.get("bs");
+ short[] s = (short[]) props.get("ss");
+ int[] i = (int[]) props.get("is");
+ long[] l = (long[]) props.get("ls");
+ double[] d = (double[]) props.get("ds");
+ float[] f = (float[]) props.get("fs");
+ char[] c = (char[]) props.get("cs");
+ boolean[] bool = (boolean[]) props.get("bools");
+
+ assertNull("Check b nullity", b);
+ assertNull("Check s nullity", s);
+ assertNull("Check i nullity", i);
+ assertNull("Check l nullity", l);
+ assertNull("Check d nullity", d);
+ assertNull("Check f nullity", f);
+ assertNull("Check c nullity", c);
+ assertNull("Check bool nullity", bool);
+
+ reconfigure(instance2);
+
+ ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance2.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ check = (CheckService) osgiHelper.getServiceObject(ref);
+ props = check.getProps();
+
+ b = (byte[]) props.get("bs");
+ s = (short[]) props.get("ss");
+ i = (int[]) props.get("is");
+ l = (long[]) props.get("ls");
+ d = (double[]) props.get("ds");
+ f = (float[]) props.get("fs");
+ c = (char[]) props.get("cs");
+ bool = (boolean[]) props.get("bools");
+
+ assertEquals("2) Check b 0", b[0], 3);
+ assertEquals("2) Check b 1", b[1], 2);
+ assertEquals("2) Check b 2", b[2], 1);
+ assertEquals("2) Check s 0", s[0], 3);
+ assertEquals("2) Check s 1", s[1], 2);
+ assertEquals("2) Check s 2", s[2], 1);
+ assertEquals("2) Check i 0", i[0], 3);
+ assertEquals("2) Check i 1", i[1], 2);
+ assertEquals("2) Check i 2", i[2], 1);
+ assertEquals("2) Check l 0", l[0], 3);
+ assertEquals("2) Check l 1", l[1], 2);
+ assertEquals("2) Check l 2", l[2], 1);
+ assertEquals("2) Check d 0", d[0], 3, 0);
+ assertEquals("2) Check d 1", d[1], 2, 0);
+ assertEquals("2) Check d 2", d[2], 1, 0);
+ assertEquals("2) Check f 0", f[0], 3, 0);
+ assertEquals("2) Check f 1", f[1], 2, 0);
+ assertEquals("2) Check f 2", f[2], 1, 0);
+ assertEquals("2) Check c 0", c[0], 'c');
+ assertEquals("2) Check c 1", c[1], 'b');
+ assertEquals("2) Check c 2", c[2], 'a');
+ assertFalse("2) Check bool 0", bool[0]);
+ assertFalse("2) Check bool 1", bool[0]);
+ assertFalse("2) Check bool 2", bool[0]);
+
+ }
+
+ @Test
+ public void testConfigurationPrimitiveArraysString() {
+ ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ CheckService check = (CheckService) osgiHelper.getServiceObject(ref);
+ Properties props = check.getProps();
+
+ byte[] b = (byte[]) props.get("bs");
+ short[] s = (short[]) props.get("ss");
+ int[] i = (int[]) props.get("is");
+ long[] l = (long[]) props.get("ls");
+ double[] d = (double[]) props.get("ds");
+ float[] f = (float[]) props.get("fs");
+ char[] c = (char[]) props.get("cs");
+ boolean[] bool = (boolean[]) props.get("bools");
+
+ assertEquals("Check b 0", b[0], 1);
+ assertEquals("Check b 1", b[1], 2);
+ assertEquals("Check b 2", b[2], 3);
+ assertEquals("Check s 0", s[0], 1);
+ assertEquals("Check s 1", s[1], 2);
+ assertEquals("Check s 2", s[2], 3);
+ assertEquals("Check i 0", i[0], 1);
+ assertEquals("Check i 1", i[1], 2);
+ assertEquals("Check i 2", i[2], 3);
+ assertEquals("Check l 0", l[0], 1);
+ assertEquals("Check l 1", l[1], 2);
+ assertEquals("Check l 2", l[2], 3);
+ assertEquals("Check d 0", d[0], 1, 0);
+ assertEquals("Check d 1", d[1], 2, 0);
+ assertEquals("Check d 2", d[2], 3, 0);
+ assertEquals("Check f 0", f[0], 1, 0);
+ assertEquals("Check f 1", f[1], 2, 0);
+ assertEquals("Check f 2", f[2], 3, 0);
+ assertEquals("Check c 0", c[0], 'a');
+ assertEquals("Check c 1", c[1], 'b');
+ assertEquals("Check c 2", c[2], 'c');
+ assertTrue("Check bool 0", bool[0]);
+ assertTrue("Check bool 1", bool[0]);
+ assertTrue("Check bool 2", bool[0]);
+
+ reconfigureString(instance);
+
+ ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ check = (CheckService) osgiHelper.getServiceObject(ref);
+ props = check.getProps();
+
+ b = (byte[]) props.get("bs");
+ s = (short[]) props.get("ss");
+ i = (int[]) props.get("is");
+ l = (long[]) props.get("ls");
+ d = (double[]) props.get("ds");
+ f = (float[]) props.get("fs");
+ c = (char[]) props.get("cs");
+ bool = (boolean[]) props.get("bools");
+
+ assertEquals("2) Check b 0", b[0], 3);
+ assertEquals("2) Check b 1", b[1], 2);
+ assertEquals("2) Check b 2", b[2], 1);
+ assertEquals("2) Check s 0", s[0], 3);
+ assertEquals("2) Check s 1", s[1], 2);
+ assertEquals("2) Check s 2", s[2], 1);
+ assertEquals("2) Check i 0", i[0], 3);
+ assertEquals("2) Check i 1", i[1], 2);
+ assertEquals("2) Check i 2", i[2], 1);
+ assertEquals("2) Check l 0", l[0], 3);
+ assertEquals("2) Check l 1", l[1], 2);
+ assertEquals("2) Check l 2", l[2], 1);
+ assertEquals("2) Check d 0", d[0], 3, 0);
+ assertEquals("2) Check d 1", d[1], 2, 0);
+ assertEquals("2) Check d 2", d[2], 1, 0);
+ assertEquals("2) Check f 0", f[0], 3, 0);
+ assertEquals("2) Check f 1", f[1], 2, 0);
+ assertEquals("2) Check f 2", f[2], 1, 0);
+ assertEquals("2) Check c 0", c[0], 'c');
+ assertEquals("2) Check c 1", c[1], 'b');
+ assertEquals("2) Check c 2", c[2], 'a');
+ assertFalse("2) Check bool 0", bool[0]);
+ assertFalse("2) Check bool 1", bool[0]);
+ assertFalse("2) Check bool 2", bool[0]);
+
+ }
+
+ @Test
+ public void testConfigurationPrimitiveArraysStringNoValue() {
+ ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance2.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ CheckService check = (CheckService) osgiHelper.getServiceObject(ref);
+ Properties props = check.getProps();
+
+ byte[] b = (byte[]) props.get("bs");
+ short[] s = (short[]) props.get("ss");
+ int[] i = (int[]) props.get("is");
+ long[] l = (long[]) props.get("ls");
+ double[] d = (double[]) props.get("ds");
+ float[] f = (float[]) props.get("fs");
+ char[] c = (char[]) props.get("cs");
+ boolean[] bool = (boolean[]) props.get("bools");
+
+ assertNull("Check b nullity", b);
+ assertNull("Check s nullity", s);
+ assertNull("Check i nullity", i);
+ assertNull("Check l nullity", l);
+ assertNull("Check d nullity", d);
+ assertNull("Check f nullity", f);
+ assertNull("Check c nullity", c);
+ assertNull("Check bool nullity", bool);
+
+ reconfigureString(instance2);
+
+ ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance2.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ check = (CheckService) osgiHelper.getServiceObject(ref);
+ props = check.getProps();
+
+ b = (byte[]) props.get("bs");
+ s = (short[]) props.get("ss");
+ i = (int[]) props.get("is");
+ l = (long[]) props.get("ls");
+ d = (double[]) props.get("ds");
+ f = (float[]) props.get("fs");
+ c = (char[]) props.get("cs");
+ bool = (boolean[]) props.get("bools");
+
+ assertEquals("2) Check b 0", b[0], 3);
+ assertEquals("2) Check b 1", b[1], 2);
+ assertEquals("2) Check b 2", b[2], 1);
+ assertEquals("2) Check s 0", s[0], 3);
+ assertEquals("2) Check s 1", s[1], 2);
+ assertEquals("2) Check s 2", s[2], 1);
+ assertEquals("2) Check i 0", i[0], 3);
+ assertEquals("2) Check i 1", i[1], 2);
+ assertEquals("2) Check i 2", i[2], 1);
+ assertEquals("2) Check l 0", l[0], 3);
+ assertEquals("2) Check l 1", l[1], 2);
+ assertEquals("2) Check l 2", l[2], 1);
+ assertEquals("2) Check d 0", d[0], 3, 0);
+ assertEquals("2) Check d 1", d[1], 2, 0);
+ assertEquals("2) Check d 2", d[2], 1, 0);
+ assertEquals("2) Check f 0", f[0], 3, 0);
+ assertEquals("2) Check f 1", f[1], 2, 0);
+ assertEquals("2) Check f 2", f[2], 1, 0);
+ assertEquals("2) Check c 0", c[0], 'c');
+ assertEquals("2) Check c 1", c[1], 'b');
+ assertEquals("2) Check c 2", c[2], 'a');
+ assertFalse("2) Check bool 0", bool[0]);
+ assertFalse("2) Check bool 1", bool[0]);
+ assertFalse("2) Check bool 2", bool[0]);
+
+ }
+
+ @Test
+ public void testConfigurationObj() {
+ ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ CheckService check = (CheckService) osgiHelper.getServiceObject(ref);
+ Properties props = check.getProps();
+
+ String s = (String) props.get("string");
+ String[] ss = (String[]) props.get("strings");
+
+ assertEquals("Check string", s, "foo");
+ assertEquals("Check strings 0", ss[0], "foo");
+ assertEquals("Check strings 1", ss[1], "bar");
+ assertEquals("Check strings 2", ss[2], "baz");
+
+ reconfigure(instance);
+
+ ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ check = (CheckService) osgiHelper.getServiceObject(ref);
+ props = check.getProps();
+
+ s = (String) props.get("string");
+ ss = (String[]) props.get("strings");
+
+ assertEquals("2) Check string", s, "bar");
+ assertEquals("2) Check strings 0", ss[0], "baz");
+ assertEquals("2) Check strings 1", ss[1], "bar");
+ assertEquals("2) Check strings 2", ss[2], "foo");
+ }
+
+ @Test
+ public void testConfigurationObjNoValue() {
+ ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance2.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ CheckService check = (CheckService) osgiHelper.getServiceObject(ref);
+ Properties props = check.getProps();
+
+ String s = (String) props.get("string");
+ String[] ss = (String[]) props.get("strings");
+
+ assertEquals("Check string", s, null);
+ assertEquals("Check strings", ss, null);
+
+ reconfigure(instance2);
+
+ ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance2.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ check = (CheckService) osgiHelper.getServiceObject(ref);
+ props = check.getProps();
+
+ s = (String) props.get("string");
+ ss = (String[]) props.get("strings");
+
+ assertEquals("2) Check string", s, "bar");
+ assertEquals("2) Check strings 0", ss[0], "baz");
+ assertEquals("2) Check strings 1", ss[1], "bar");
+ assertEquals("2) Check strings 2", ss[2], "foo");
+ }
+
+ @Test
+ public void testConfigurationObjString() {
+ ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ CheckService check = (CheckService) osgiHelper.getServiceObject(ref);
+ Properties props = check.getProps();
+
+ String s = (String) props.get("string");
+ String[] ss = (String[]) props.get("strings");
+
+ assertEquals("Check string", s, "foo");
+ assertEquals("Check strings 0", ss[0], "foo");
+ assertEquals("Check strings 1", ss[1], "bar");
+ assertEquals("Check strings 2", ss[2], "baz");
+
+ reconfigureString(instance);
+
+ ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ check = (CheckService) osgiHelper.getServiceObject(ref);
+ props = check.getProps();
+
+ s = (String) props.get("string");
+ ss = (String[]) props.get("strings");
+
+ assertEquals("2) Check string", s, "bar");
+ assertEquals("2) Check strings 0", ss[0], "baz");
+ assertEquals("2) Check strings 1", ss[1], "bar");
+ assertEquals("2) Check strings 2", ss[2], "foo");
+ }
+
+ @Test
+ public void testConfigurationObjStringNoValue() {
+ ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance2.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ CheckService check = (CheckService) osgiHelper.getServiceObject(ref);
+ Properties props = check.getProps();
+
+ String s = (String) props.get("string");
+ String[] ss = (String[]) props.get("strings");
+
+ assertEquals("Check string", s, null);
+ assertEquals("Check strings", ss, null);
+
+ reconfigureString(instance2);
+
+ ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance2.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ check = (CheckService) osgiHelper.getServiceObject(ref);
+ props = check.getProps();
+
+ s = (String) props.get("string");
+ ss = (String[]) props.get("strings");
+
+ assertEquals("2) Check string", s, "bar");
+ assertEquals("2) Check strings 0", ss[0], "baz");
+ assertEquals("2) Check strings 1", ss[1], "bar");
+ assertEquals("2) Check strings 2", ss[2], "foo");
+ }
+
+ private void reconfigure(ComponentInstance ci) {
+ Properties props2 = new Properties();
+ props2.put("b", new Byte("2"));
+ props2.put("s", new Short("2"));
+ props2.put("i", new Integer("2"));
+ props2.put("l", new Long("2"));
+ props2.put("d", new Double("2"));
+ props2.put("f", new Float("2"));
+ props2.put("c", new Character('b'));
+ props2.put("bool", new Boolean(false));
+ props2.put("bs", new byte[]{(byte) 3, (byte) 2, (byte) 1});
+ props2.put("ss", new short[]{(short) 3, (short) 2, (short) 1});
+ props2.put("is", new int[]{3, 2, 1});
+ props2.put("ls", new long[]{3, 2, 1});
+ props2.put("ds", new double[]{3, 2, 1});
+ props2.put("fs", new float[]{3, 2, 1});
+ props2.put("cs", new char[]{'c', 'b', 'a'});
+ props2.put("bools", new boolean[]{false, false, false});
+ props2.put("string", "bar");
+ props2.put("strings", new String[]{"baz", "bar", "foo"});
+
+ ci.reconfigure(props2);
+ }
+
+ private void reconfigureString(ComponentInstance ci) {
+ Properties props2 = new Properties();
+ props2.put("b", "2");
+ props2.put("s", "2");
+ props2.put("i", "2");
+ props2.put("l", "2");
+ props2.put("d", "2");
+ props2.put("f", "2");
+ props2.put("c", "b");
+ props2.put("bool", "false");
+ props2.put("bs", "{3, 2,1}");
+ props2.put("ss", "{3, 2,1}");
+ props2.put("is", "{3, 2,1}");
+ props2.put("ls", "{3, 2,1}");
+ props2.put("ds", "{3, 2,1}");
+ props2.put("fs", "{3, 2,1}");
+ props2.put("cs", "{c, b , a}");
+ props2.put("bools", "{false,false,false}");
+ props2.put("string", "bar");
+ props2.put("strings", "{baz, bar, foo}");
+
+ ci.reconfigure(props2);
+ }
+
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestManagedServiceConfigurableProperties.java b/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestManagedServiceConfigurableProperties.java
new file mode 100644
index 0000000..7d97e55
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestManagedServiceConfigurableProperties.java
@@ -0,0 +1,626 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.ipojo.runtime.core;
+
+import org.apache.felix.ipojo.ComponentInstance;
+import org.apache.felix.ipojo.PrimitiveHandler;
+import org.apache.felix.ipojo.runtime.core.services.FooService;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.cm.ConfigurationException;
+import org.osgi.service.cm.ManagedService;
+import org.ow2.chameleon.testing.helpers.IPOJOHelper;
+import org.ow2.chameleon.testing.helpers.OSGiHelper;
+
+import java.util.Hashtable;
+import java.util.Properties;
+
+import static junit.framework.Assert.assertEquals;
+import static org.junit.Assert.*;
+
+
+public class TestManagedServiceConfigurableProperties extends Common {
+
+
+ /**
+ * Instance where the ManagedServicePID is provided by the component type.
+ */
+ ComponentInstance instance1;
+ /**
+ * Instance where the ManagedServicePID is provided by the instance.
+ */
+ ComponentInstance instance2;
+
+ /**
+ * Instance without configuration.
+ */
+ ComponentInstance instance3;
+
+
+
+ @Before
+ public void setUp() {
+ osgiHelper = new OSGiHelper(bc);
+ ipojoHelper = new IPOJOHelper(bc);
+
+ String type = "CONFIG-FooProviderType-4";
+ Hashtable<String, String> p = new Hashtable<String, String>();
+ p.put("instance.name", "instance");
+ p.put("foo", "foo");
+ p.put("bar", "2");
+ p.put("baz", "baz");
+ instance1 = ipojoHelper.createComponentInstance(type, p);
+ assertEquals("instance1 created", ComponentInstance.VALID, instance1.getState());
+
+ type = "CONFIG-FooProviderType-3";
+ Hashtable<String, String> p1 = new Hashtable<String, String>();
+ p1.put("instance.name", "instance-2");
+ p1.put("foo", "foo");
+ p1.put("bar", "2");
+ p1.put("baz", "baz");
+ p1.put("managed.service.pid", "instance");
+ instance2 = ipojoHelper.createComponentInstance(type, p1);
+
+ type = "CONFIG-FooProviderType-3";
+ Hashtable<String, String> p2 = new Hashtable<String, String>();
+ p2.put("instance.name", "instance-3");
+ p2.put("managed.service.pid", "instance-3");
+ instance3 = ipojoHelper.createComponentInstance(type, p2);
+ }
+
+ @After
+ public void tearDown() {
+ instance1.dispose();
+ instance2.dispose();
+ instance3.dispose();
+ instance1 = null;
+ instance2 = null;
+ instance3 = null;
+ }
+
+ @Test
+ public void testStaticInstance1() {
+ ServiceReference fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance1.getInstanceName());
+ assertNotNull("Check FS availability", fooRef);
+ String fooP = (String) fooRef.getProperty("foo");
+ Integer barP = (Integer) fooRef.getProperty("bar");
+ String bazP = (String) fooRef.getProperty("baz");
+ assertEquals("Check foo equality -1", fooP, "foo");
+ assertEquals("Check bar equality -1", barP, new Integer(2));
+ assertEquals("Check baz equality -1", bazP, "baz");
+
+ ServiceReference msRef = osgiHelper.getServiceReferenceByPID(
+ ManagedService.class.getName(), "FooProvider-3");
+ assertNotNull("Check ManagedServiceFactory availability", msRef);
+
+ // Configuration of baz
+ Properties conf = new Properties();
+ conf.put("baz", "zab");
+ conf.put("bar", new Integer(2));
+ conf.put("foo", "foo");
+ ManagedService ms = (ManagedService) osgiHelper.getContext().getService(msRef);
+ try {
+ ms.updated(conf);
+ } catch (ConfigurationException e) {
+ fail("Configuration Exception : " + e);
+ }
+
+ // Re-check props
+ fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance1.getInstanceName());
+ fooP = (String) fooRef.getProperty("foo");
+ barP = (Integer) fooRef.getProperty("bar");
+ bazP = (String) fooRef.getProperty("baz");
+ assertEquals("Check foo equality -2", fooP, "foo");
+ assertEquals("Check bar equality -2", barP, new Integer(2));
+ assertEquals("Check baz equality -2", bazP, "zab");
+ osgiHelper.getContext().ungetService(msRef);
+ }
+
+ @Test
+ public void testStaticInstance2() {
+ ServiceReference fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance2.getInstanceName());
+ assertNotNull("Check FS availability", fooRef);
+ String fooP = (String) fooRef.getProperty("foo");
+ Integer barP = (Integer) fooRef.getProperty("bar");
+ String bazP = (String) fooRef.getProperty("baz");
+ assertEquals("Check foo equality -1", fooP, "foo");
+ assertEquals("Check bar equality -1", barP, new Integer(2));
+ assertEquals("Check baz equality -1", bazP, "baz");
+
+ ServiceReference msRef = osgiHelper.getServiceReferenceByPID(ManagedService.class.getName(), "instance");
+ assertNotNull("Check ManagedService availability", msRef);
+
+
+ // Configuration of baz
+ Properties conf = new Properties();
+ conf.put("baz", "zab");
+ conf.put("bar", new Integer(2));
+ conf.put("foo", "foo");
+ ManagedService ms = (ManagedService) osgiHelper.getContext().getService(msRef);
+ try {
+ ms.updated(conf);
+ } catch (ConfigurationException e) {
+ fail("Configuration Exception : " + e);
+ }
+
+ // Recheck props
+ fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance2.getInstanceName());
+ fooP = (String) fooRef.getProperty("foo");
+ barP = (Integer) fooRef.getProperty("bar");
+ bazP = (String) fooRef.getProperty("baz");
+ assertEquals("Check foo equality -2", fooP, "foo");
+ assertEquals("Check bar equality -2", barP, new Integer(2));
+ assertEquals("Check baz equality -2", bazP, "zab");
+ osgiHelper.getContext().ungetService(fooRef);
+ osgiHelper.getContext().ungetService(msRef);
+ }
+
+ @Test
+ public void testStaticInstance3() {
+ ServiceReference fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance3.getInstanceName());
+ assertNotNull("Check FS availability", fooRef);
+ Object fooP = fooRef.getProperty("foo");
+ Object barP = fooRef.getProperty("bar");
+ Object bazP = fooRef.getProperty("baz");
+ // No values ... no properties.
+ assertEquals("Check foo equality -1", fooP, null);
+ assertEquals("Check bar equality -1", barP, null);
+ assertEquals("Check baz equality -1", bazP, null);
+
+ ServiceReference msRef = osgiHelper.getServiceReferenceByPID(ManagedService.class.getName(), "instance-3");
+ assertNotNull("Check ManagedService availability", msRef);
+
+
+ // Configuration of baz
+ Properties conf = new Properties();
+ conf.put("baz", "zab");
+ conf.put("bar", new Integer(2));
+ conf.put("foo", "foo");
+ ManagedService ms = (ManagedService) osgiHelper.getContext().getService(msRef);
+ try {
+ ms.updated(conf);
+ } catch (ConfigurationException e) {
+ fail("Configuration Exception : " + e);
+ }
+
+ // Recheck props
+ fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance3.getInstanceName());
+ fooP = (String) fooRef.getProperty("foo");
+ barP = (Integer) fooRef.getProperty("bar");
+ bazP = (String) fooRef.getProperty("baz");
+ assertEquals("Check foo equality -2", fooP, "foo");
+ assertEquals("Check bar equality -2", barP, new Integer(2));
+ assertEquals("Check baz equality -2", bazP, "zab");
+ osgiHelper.getContext().ungetService(fooRef);
+ osgiHelper.getContext().ungetService(msRef);
+ }
+
+ @Test
+ public void testDynamicInstance1() {
+ ServiceReference fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance1.getInstanceName());
+ assertNotNull("Check FS availability", fooRef);
+
+ String fooP = (String) fooRef.getProperty("foo");
+ Integer barP = (Integer) fooRef.getProperty("bar");
+ String bazP = (String) fooRef.getProperty("baz");
+
+ assertEquals("Check foo equality", fooP, "foo");
+ assertEquals("Check bar equality", barP, new Integer(2));
+ assertEquals("Check baz equality", bazP, "baz");
+
+ ServiceReference msRef = osgiHelper.getServiceReferenceByPID(ManagedService.class.getName(), "FooProvider-3");
+ assertNotNull("Check ManagedServiceFactory availability", msRef);
+
+ // Configuration of baz
+ Properties conf = new Properties();
+ conf.put("baz", "zab");
+ conf.put("foo", "oof");
+ conf.put("bar", new Integer(0));
+ ManagedService ms = (ManagedService) osgiHelper.getContext().getService(msRef);
+ try {
+ ms.updated(conf);
+ } catch (ConfigurationException e) {
+ fail("Configuration Exception : " + e);
+ }
+
+ // Re-check props
+ fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance1.getInstanceName());
+ fooP = (String) fooRef.getProperty("foo");
+ barP = (Integer) fooRef.getProperty("bar");
+ bazP = (String) fooRef.getProperty("baz");
+
+ assertEquals("Check foo equality", fooP, "oof");
+ assertEquals("Check bar equality", barP, new Integer(0));
+ assertEquals("Check baz equality", bazP, "zab");
+
+ // Check field value
+ FooService fs = (FooService) osgiHelper.getContext().getService(fooRef);
+ Properties p = fs.fooProps();
+ fooP = (String) p.get("foo");
+ barP = (Integer) p.get("bar");
+
+ assertEquals("Check foo field equality", fooP, "oof");
+ assertEquals("Check bar field equality", barP, new Integer(0));
+
+ osgiHelper.getContext().ungetService(fooRef);
+ osgiHelper.getContext().ungetService(msRef);
+ }
+
+ @Test
+ public void testDynamicInstance2() {
+ ServiceReference fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance2.getInstanceName());
+ assertNotNull("Check FS availability", fooRef);
+
+ String fooP = (String) fooRef.getProperty("foo");
+ Integer barP = (Integer) fooRef.getProperty("bar");
+ String bazP = (String) fooRef.getProperty("baz");
+
+ assertEquals("Check foo equality", fooP, "foo");
+ assertEquals("Check bar equality", barP, new Integer(2));
+ assertEquals("Check baz equality", bazP, "baz");
+
+ ServiceReference msRef = osgiHelper.getServiceReferenceByPID(ManagedService.class.getName(), "instance");
+ assertNotNull("Check ManagedServiceFactory availability", msRef);
+
+ // Configuration of baz
+ Properties conf = new Properties();
+ conf.put("baz", "zab");
+ conf.put("foo", "oof");
+ conf.put("bar", new Integer(0));
+ ManagedService ms = (ManagedService) osgiHelper.getContext().getService(msRef);
+ try {
+ ms.updated(conf);
+ } catch (ConfigurationException e) {
+ fail("Configuration Exception : " + e);
+ }
+
+ // Recheck props
+ fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance2.getInstanceName());
+ fooP = (String) fooRef.getProperty("foo");
+ barP = (Integer) fooRef.getProperty("bar");
+ bazP = (String) fooRef.getProperty("baz");
+
+ assertEquals("Check foo equality", fooP, "oof");
+ assertEquals("Check bar equality", barP, new Integer(0));
+ assertEquals("Check baz equality", bazP, "zab");
+
+ // Check field value
+ FooService fs = (FooService) osgiHelper.getContext().getService(fooRef);
+ Properties p = fs.fooProps();
+ fooP = (String) p.get("foo");
+ barP = (Integer) p.get("bar");
+
+ assertEquals("Check foo field equality", fooP, "oof");
+ assertEquals("Check bar field equality", barP, new Integer(0));
+
+ osgiHelper.getContext().ungetService(fooRef);
+ osgiHelper.getContext().ungetService(msRef);
+ }
+
+ @Test
+ public void testDynamicInstance3() {
+ ServiceReference fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance3.getInstanceName());
+ assertNotNull("Check FS availability", fooRef);
+
+ Object fooP = fooRef.getProperty("foo");
+ Object barP = fooRef.getProperty("bar");
+ Object bazP = fooRef.getProperty("baz");
+ // No values ... no properties.
+ assertEquals("Check foo equality", fooP, null);
+ assertEquals("Check bar equality", barP, null);
+ assertEquals("Check baz equality", bazP, null);
+
+ ServiceReference msRef = osgiHelper.getServiceReferenceByPID(ManagedService.class.getName(), "instance-3");
+ assertNotNull("Check ManagedServiceFactory availability", msRef);
+
+ // Configuration of baz
+ Properties conf = new Properties();
+ conf.put("baz", "zab");
+ conf.put("foo", "oof");
+ conf.put("bar", new Integer(0));
+ ManagedService ms = (ManagedService) osgiHelper.getContext().getService(msRef);
+ try {
+ ms.updated(conf);
+ } catch (ConfigurationException e) {
+ fail("Configuration Exception : " + e);
+ }
+
+ // Recheck props
+ fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance3.getInstanceName());
+ fooP = (String) fooRef.getProperty("foo");
+ barP = (Integer) fooRef.getProperty("bar");
+ bazP = (String) fooRef.getProperty("baz");
+
+ assertEquals("Check foo equality", fooP, "oof");
+ assertEquals("Check bar equality", barP, new Integer(0));
+ assertEquals("Check baz equality", bazP, "zab");
+
+ // Check field value
+ FooService fs = (FooService) osgiHelper.getContext().getService(fooRef);
+ Properties p = fs.fooProps();
+ fooP = (String) p.get("foo");
+ barP = (Integer) p.get("bar");
+
+ assertEquals("Check foo field equality", fooP, "oof");
+ assertEquals("Check bar field equality", barP, new Integer(0));
+
+ osgiHelper.getContext().ungetService(fooRef);
+ osgiHelper.getContext().ungetService(msRef);
+ }
+
+ @Test
+ public void testDynamicStringInstance1() {
+ assertEquals("Check instance1 state", ComponentInstance.VALID, instance1.getState());
+ ServiceReference fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance1.getInstanceName());
+ assertNotNull("Check FS availability", fooRef);
+
+ String fooP = (String) fooRef.getProperty("foo");
+ Integer barP = (Integer) fooRef.getProperty("bar");
+ String bazP = (String) fooRef.getProperty("baz");
+
+ assertEquals("Check foo equality - 1", fooP, "foo");
+ assertEquals("Check bar equality - 1", barP, new Integer(2));
+ assertEquals("Check baz equality - 1", bazP, "baz");
+
+ ServiceReference msRef = osgiHelper.getServiceReferenceByPID(ManagedService.class.getName(), "FooProvider-3");
+ assertNotNull("Check ManagedService availability", msRef);
+
+ // Configuration of baz
+ Properties conf = new Properties();
+ conf.put("baz", "zab");
+ conf.put("foo", "oof");
+ conf.put("bar", "0");
+ assertEquals("Check instance1 state (2)", ComponentInstance.VALID, instance1.getState());
+ ManagedService ms = (ManagedService) osgiHelper.getContext().getService(msRef);
+
+ PrimitiveHandler ph = (PrimitiveHandler) ms;
+ assertSame("Check the correct instance", ph.getInstanceManager(), instance1);
+
+ try {
+ ms.updated(conf);
+ } catch (ConfigurationException e) {
+ fail("Configuration Exception : " + e);
+ }
+ assertEquals("Check instance1 state (3)", ComponentInstance.VALID, instance1.getState());
+
+ // Recheck props
+ fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance1.getInstanceName());
+ fooP = (String) fooRef.getProperty("foo");
+ barP = (Integer) fooRef.getProperty("bar");
+ bazP = (String) fooRef.getProperty("baz");
+
+ assertEquals("Check foo equality - 2", fooP, "oof");
+ assertEquals("Check bar equality - 2", barP, new Integer(0));
+ assertEquals("Check baz equality - 2", bazP, "zab");
+
+ // Check field value
+ FooService fs = (FooService) osgiHelper.getContext().getService(fooRef);
+ Properties p = fs.fooProps();
+ fooP = (String) p.get("foo");
+ barP = (Integer) p.get("bar");
+
+ assertEquals("Check foo field equality", fooP, "oof");
+ assertEquals("Check bar field equality", barP, new Integer(0));
+
+ osgiHelper.getContext().ungetService(fooRef);
+ osgiHelper.getContext().ungetService(msRef);
+ }
+
+ @Test
+ public void testDynamicStringInstance2() {
+ ServiceReference fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance2.getInstanceName());
+ assertNotNull("Check FS availability", fooRef);
+
+ String fooP = (String) fooRef.getProperty("foo");
+ Integer barP = (Integer) fooRef.getProperty("bar");
+ String bazP = (String) fooRef.getProperty("baz");
+
+ assertEquals("Check foo equality", fooP, "foo");
+ assertEquals("Check bar equality", barP, new Integer(2));
+ assertEquals("Check baz equality", bazP, "baz");
+
+ ServiceReference msRef = osgiHelper.getServiceReferenceByPID(ManagedService.class.getName(), "instance");
+ assertNotNull("Check ManagedService availability", msRef);
+
+ // Configuration of baz
+ Properties conf = new Properties();
+ conf.put("baz", "zab");
+ conf.put("foo", "oof");
+ conf.put("bar", "0");
+ ManagedService ms = (ManagedService) osgiHelper.getContext().getService(msRef);
+ try {
+ ms.updated(conf);
+ } catch (ConfigurationException e) {
+ fail("Configuration Exception : " + e);
+ }
+
+ // Recheck props
+ fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance2.getInstanceName());
+ fooP = (String) fooRef.getProperty("foo");
+ barP = (Integer) fooRef.getProperty("bar");
+ bazP = (String) fooRef.getProperty("baz");
+
+ assertEquals("Check foo equality", fooP, "oof");
+ assertEquals("Check bar equality", barP, new Integer(0));
+ assertEquals("Check baz equality", bazP, "zab");
+
+ // Check field value
+ FooService fs = (FooService) osgiHelper.getContext().getService(fooRef);
+ Properties p = fs.fooProps();
+ fooP = (String) p.get("foo");
+ barP = (Integer) p.get("bar");
+
+ assertEquals("Check foo field equality", fooP, "oof");
+ assertEquals("Check bar field equality", barP, new Integer(0));
+
+ osgiHelper.getContext().ungetService(fooRef);
+ osgiHelper.getContext().ungetService(msRef);
+ }
+
+ @Test
+ public void testPropagationInstance1() {
+ ServiceReference fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance1.getInstanceName());
+ assertNotNull("Check FS availability", fooRef);
+
+ String fooP = (String) fooRef.getProperty("foo");
+ Integer barP = (Integer) fooRef.getProperty("bar");
+ String bazP = (String) fooRef.getProperty("baz");
+
+ assertEquals("Check foo equality", fooP, "foo");
+ assertEquals("Check bar equality", barP, new Integer(2));
+ assertEquals("Check baz equality", bazP, "baz");
+
+ ServiceReference msRef = osgiHelper.getServiceReferenceByPID(ManagedService.class.getName(), "FooProvider-3");
+ assertNotNull("Check ManagedService availability", msRef);
+
+ // Configuration of baz
+ Properties conf = new Properties();
+ conf.put("baz", "zab");
+ conf.put("foo", "foo");
+ conf.put("bar", new Integer(2));
+ conf.put("propagated1", "propagated");
+ conf.put("propagated2", new Integer(1));
+ ManagedService ms = (ManagedService) osgiHelper.getContext().getService(msRef);
+ try {
+ ms.updated(conf);
+ } catch (ConfigurationException e) {
+ fail("Configuration Exception : " + e);
+ }
+
+ // Recheck props
+ fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance1.getInstanceName());
+ fooP = (String) fooRef.getProperty("foo");
+ barP = (Integer) fooRef.getProperty("bar");
+ bazP = (String) fooRef.getProperty("baz");
+ assertNotNull("Check the propagated1 existency", fooRef.getProperty("propagated1"));
+ String prop1 = (String) fooRef.getProperty("propagated1");
+ assertNotNull("Check the propagated2 existency", fooRef.getProperty("propagated2"));
+ Integer prop2 = (Integer) fooRef.getProperty("propagated2");
+
+ assertEquals("Check foo equality", fooP, "foo");
+ assertEquals("Check bar equality", barP, new Integer(2));
+ assertEquals("Check baz equality", bazP, "zab");
+ assertEquals("Check propagated1 equality", prop1, "propagated");
+ assertEquals("Check propagated2 equality", prop2, new Integer(1));
+
+ osgiHelper.getContext().ungetService(msRef);
+ }
+
+ @Test
+ public void testPropagationInstance2() {
+ ServiceReference fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance2.getInstanceName());
+ assertNotNull("Check FS availability", fooRef);
+
+ String fooP = (String) fooRef.getProperty("foo");
+ Integer barP = (Integer) fooRef.getProperty("bar");
+ String bazP = (String) fooRef.getProperty("baz");
+
+ assertEquals("Check foo equality", fooP, "foo");
+ assertEquals("Check bar equality", barP, new Integer(2));
+ assertEquals("Check baz equality", bazP, "baz");
+
+ ServiceReference msRef = osgiHelper.getServiceReferenceByPID(ManagedService.class.getName(), "instance");
+ assertNotNull("Check ManagedService availability", msRef);
+
+ // Configuration of baz
+ Properties conf = new Properties();
+ conf.put("baz", "zab");
+ conf.put("foo", "foo");
+ conf.put("bar", new Integer(2));
+ conf.put("propagated1", "propagated");
+ conf.put("propagated2", new Integer(1));
+ ManagedService ms = (ManagedService) osgiHelper.getContext().getService(msRef);
+ try {
+ ms.updated(conf);
+ } catch (ConfigurationException e) {
+ fail("Configuration Exception : " + e);
+ }
+
+ // Recheck props
+ fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance2.getInstanceName());
+ fooP = (String) fooRef.getProperty("foo");
+ barP = (Integer) fooRef.getProperty("bar");
+ bazP = (String) fooRef.getProperty("baz");
+ assertNotNull("Check the propagated1 existency", fooRef.getProperty("propagated1"));
+ String prop1 = (String) fooRef.getProperty("propagated1");
+ assertNotNull("Check the propagated2 existency", fooRef.getProperty("propagated2"));
+ Integer prop2 = (Integer) fooRef.getProperty("propagated2");
+
+ assertEquals("Check foo equality", fooP, "foo");
+ assertEquals("Check bar equality", barP, new Integer(2));
+ assertEquals("Check baz equality", bazP, "zab");
+ assertEquals("Check propagated1 equality", prop1, "propagated");
+ assertEquals("Check propagated2 equality", prop2, new Integer(1));
+
+ osgiHelper.getContext().ungetService(msRef);
+ }
+
+ @Test
+ public void testPropagationInstance3() {
+ ServiceReference fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance3.getInstanceName());
+ assertNotNull("Check FS availability", fooRef);
+
+ Object fooP = fooRef.getProperty("foo");
+ Object barP = fooRef.getProperty("bar");
+ Object bazP = fooRef.getProperty("baz");
+
+ assertEquals("Check foo equality", fooP, null);
+ assertEquals("Check bar equality", barP, null);
+ assertEquals("Check baz equality", bazP, null);
+
+ ServiceReference msRef = osgiHelper.getServiceReferenceByPID(ManagedService.class.getName(), "instance-3");
+ assertNotNull("Check ManagedService availability", msRef);
+
+ // Configuration of baz
+ Properties conf = new Properties();
+ conf.put("baz", "zab");
+ conf.put("foo", "foo");
+ conf.put("bar", new Integer(2));
+ conf.put("propagated1", "propagated");
+ conf.put("propagated2", new Integer(1));
+ ManagedService ms = (ManagedService) osgiHelper.getContext().getService(msRef);
+ try {
+ ms.updated(conf);
+ } catch (ConfigurationException e) {
+ fail("Configuration Exception : " + e);
+ }
+
+ // Recheck props
+ fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance3.getInstanceName());
+ fooP = (String) fooRef.getProperty("foo");
+ barP = (Integer) fooRef.getProperty("bar");
+ bazP = (String) fooRef.getProperty("baz");
+ assertNotNull("Check the propagated1 existency", fooRef.getProperty("propagated1"));
+ String prop1 = (String) fooRef.getProperty("propagated1");
+ assertNotNull("Check the propagated2 existency", fooRef.getProperty("propagated2"));
+ Integer prop2 = (Integer) fooRef.getProperty("propagated2");
+
+ assertEquals("Check foo equality", fooP, "foo");
+ assertEquals("Check bar equality", barP, new Integer(2));
+ assertEquals("Check baz equality", bazP, "zab");
+ assertEquals("Check propagated1 equality", prop1, "propagated");
+ assertEquals("Check propagated2 equality", prop2, new Integer(1));
+
+ osgiHelper.getContext().ungetService(msRef);
+ }
+
+
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestMethodProperties.java b/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestMethodProperties.java
new file mode 100644
index 0000000..d23bbc3
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestMethodProperties.java
@@ -0,0 +1,1651 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.ipojo.runtime.core;
+
+import org.apache.felix.ipojo.ComponentInstance;
+import org.apache.felix.ipojo.Factory;
+import org.apache.felix.ipojo.runtime.core.services.CheckService;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.osgi.framework.ServiceReference;
+import org.ow2.chameleon.testing.helpers.IPOJOHelper;
+import org.ow2.chameleon.testing.helpers.OSGiHelper;
+
+import java.util.Properties;
+
+import static junit.framework.Assert.assertEquals;
+import static org.junit.Assert.*;
+
+
+public class TestMethodProperties extends Common {
+
+ ComponentInstance instance;
+
+ ComponentInstance instance2;
+
+ ComponentInstance instance3;
+
+
+
+ @Before
+ public void setUp() {
+ osgiHelper = new OSGiHelper(bc);
+ ipojoHelper = new IPOJOHelper(bc);
+ Factory fact = ipojoHelper.getFactory("CONFIG-MethodConfigurableCheckService");
+ Properties props = new Properties();
+ props.put("instance.name", "under-test");
+ props.put("b", "1");
+ props.put("s", "1");
+ props.put("i", "1");
+ props.put("l", "1");
+ props.put("d", "1");
+ props.put("f", "1");
+ props.put("c", "a");
+ props.put("bool", "true");
+ props.put("bs", "{1,2,3}");
+ props.put("ss", "{1,2,3}");
+ props.put("is", "{1,2,3}");
+ props.put("ls", "{1,2,3}");
+ props.put("ds", "{1,2,3}");
+ props.put("fs", "{1,2,3}");
+ props.put("cs", "{a,b,c}");
+ props.put("bools", "{true,true,true}");
+ props.put("string", "foo");
+ props.put("strings", "{foo, bar, baz}");
+
+ try {
+ instance = fact.createComponentInstance(props);
+ } catch (Exception e) {
+ fail("Cannot create the under-test instance : " + e.getMessage());
+ }
+
+ Properties props2 = new Properties();
+ props2.put("instance.name", "under-test-2");
+ props2.put("b", new Byte("1"));
+ props2.put("s", new Short("1"));
+ props2.put("i", new Integer("1"));
+ props2.put("l", new Long("1"));
+ props2.put("d", new Double("1"));
+ props2.put("f", new Float("1"));
+ props2.put("c", new Character('a'));
+ props2.put("bool", new Boolean(true));
+ props2.put("bs", new byte[]{1, 2, 3});
+ props2.put("ss", new short[]{1, 2, 3});
+ props2.put("is", new int[]{1, 2, 3});
+ props2.put("ls", new long[]{1, 2, 3});
+ props2.put("ds", new double[]{1, 2, 3});
+ props2.put("fs", new float[]{1, 2, 3});
+ props2.put("cs", new char[]{'a', 'b', 'c'});
+ props2.put("bools", new boolean[]{true, true, true});
+ props2.put("string", "foo");
+ props2.put("strings", new String[]{"foo", "bar", "baz"});
+
+ try {
+ instance2 = fact.createComponentInstance(props2);
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail("Cannot create the under-test instance 2 : " + e.getMessage());
+ }
+
+ try {
+ instance3 = fact.createComponentInstance(null);
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail("Cannot create the under-test instance 3 : " + e.getMessage());
+ }
+
+
+ }
+
+ @After
+ public void tearDown() {
+ ipojoHelper.dispose();
+ osgiHelper.dispose();
+ instance.dispose();
+ instance2.dispose();
+ instance3.dispose();
+ instance = null;
+ instance2 = null;
+ instance3 = null;
+ }
+
+ @Test
+ public void testConfigurationPrimitive() {
+ ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ CheckService check = (CheckService) osgiHelper.getServiceObject(ref);
+ Properties props = check.getProps();
+
+ Byte b = (Byte) props.get("b");
+ Short s = (Short) props.get("s");
+ Integer i = (Integer) props.get("i");
+ Long l = (Long) props.get("l");
+ Double d = (Double) props.get("d");
+ Float f = (Float) props.get("f");
+ Character c = (Character) props.get("c");
+ Boolean bool = (Boolean) props.get("bool");
+
+ assertEquals("Check b", b, new Byte("1"));
+ assertEquals("Check s", s, new Short("1"));
+ assertEquals("Check i", i, new Integer("1"));
+ assertEquals("Check l", l, new Long("1"));
+ assertEquals("Check d", d, new Double("1"));
+ assertEquals("Check f", f, new Float("1"));
+ assertEquals("Check c", c, new Character('a'));
+ assertEquals("Check bool", bool, new Boolean("true"));
+
+// Integer upb = (Integer) props.get("upb");
+// Integer ups = (Integer) props.get("ups");
+// Integer upi = (Integer) props.get("upi");
+// Integer upl = (Integer) props.get("upl");
+// Integer upd = (Integer) props.get("upd");
+// Integer upf = (Integer) props.get("upf");
+// Integer upc = (Integer) props.get("upc");
+// Integer upbool = (Integer) props.get("upbool");
+//
+// assertEquals("Check upb", upb, new Integer(1));
+// assertEquals("Check ups", ups, new Integer(1));
+// assertEquals("Check upi", upi, new Integer(1));
+// assertEquals("Check upl", upl, new Integer(1));
+// assertEquals("Check upd", upd, new Integer(1));
+// assertEquals("Check upf", upf, new Integer(1));
+// assertEquals("Check upc", upc, new Integer(1));
+// assertEquals("Check upbool", upbool, new Integer(1));
+
+ reconfigure(instance);
+
+ ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ check = (CheckService) osgiHelper.getServiceObject(ref);
+ props = check.getProps();
+
+ b = (Byte) props.get("b");
+ s = (Short) props.get("s");
+ i = (Integer) props.get("i");
+ l = (Long) props.get("l");
+ d = (Double) props.get("d");
+ f = (Float) props.get("f");
+ c = (Character) props.get("c");
+ bool = (Boolean) props.get("bool");
+
+ assertEquals("2) Check b (" + b + ")", b, new Byte("2"));
+ assertEquals("2) Check s", s, new Short("2"));
+ assertEquals("2) Check i", i, new Integer("2"));
+ assertEquals("2) Check l", l, new Long("2"));
+ assertEquals("2) Check d", d, new Double("2"));
+ assertEquals("2) Check f", f, new Float("2"));
+ assertEquals("2) Check c", c, new Character('b'));
+ assertEquals("2) Check bool", bool, new Boolean("false"));
+
+// upb = (Integer) props.get("upb");
+// ups = (Integer) props.get("ups");
+// upi = (Integer) props.get("upi");
+// upl = (Integer) props.get("upl");
+// upd = (Integer) props.get("upd");
+// upf = (Integer) props.get("upf");
+// upc = (Integer) props.get("upc");
+// upbool = (Integer) props.get("upbool");
+//
+// assertEquals("2) Check upb", upb, new Integer(2));
+// assertEquals("2) Check ups", ups, new Integer(2));
+// assertEquals("2) Check upi", upi, new Integer(2));
+// assertEquals("2) Check upl", upl, new Integer(2));
+// assertEquals("2) Check upd", upd, new Integer(2));
+// assertEquals("2) Check upf", upf, new Integer(2));
+// assertEquals("2) Check upc", upc, new Integer(2));
+// assertEquals("2) Check upbool", upbool, new Integer(2));
+
+ }
+
+ @Test
+ public void testConfigurationPrimitiveString() {
+ ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ CheckService check = (CheckService) osgiHelper.getServiceObject(ref);
+ Properties props = check.getProps();
+
+ Byte b = (Byte) props.get("b");
+ Short s = (Short) props.get("s");
+ Integer i = (Integer) props.get("i");
+ Long l = (Long) props.get("l");
+ Double d = (Double) props.get("d");
+ Float f = (Float) props.get("f");
+ Character c = (Character) props.get("c");
+ Boolean bool = (Boolean) props.get("bool");
+
+ assertEquals("Check b", b, new Byte("1"));
+ assertEquals("Check s", s, new Short("1"));
+ assertEquals("Check i", i, new Integer("1"));
+ assertEquals("Check l", l, new Long("1"));
+ assertEquals("Check d", d, new Double("1"));
+ assertEquals("Check f", f, new Float("1"));
+ assertEquals("Check c", c, new Character('a'));
+ assertEquals("Check bool", bool, new Boolean("true"));
+
+// Integer upb = (Integer) props.get("upb");
+// Integer ups = (Integer) props.get("ups");
+// Integer upi = (Integer) props.get("upi");
+// Integer upl = (Integer) props.get("upl");
+// Integer upd = (Integer) props.get("upd");
+// Integer upf = (Integer) props.get("upf");
+// Integer upc = (Integer) props.get("upc");
+// Integer upbool = (Integer) props.get("upbool");
+//
+// assertEquals("Check upb", upb, new Integer(1));
+// assertEquals("Check ups", ups, new Integer(1));
+// assertEquals("Check upi", upi, new Integer(1));
+// assertEquals("Check upl", upl, new Integer(1));
+// assertEquals("Check upd", upd, new Integer(1));
+// assertEquals("Check upf", upf, new Integer(1));
+// assertEquals("Check upc", upc, new Integer(1));
+// assertEquals("Check upbool", upbool, new Integer(1));
+//
+ reconfigureString(instance);
+
+ ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ check = (CheckService) osgiHelper.getServiceObject(ref);
+ props = check.getProps();
+
+ b = (Byte) props.get("b");
+ s = (Short) props.get("s");
+ i = (Integer) props.get("i");
+ l = (Long) props.get("l");
+ d = (Double) props.get("d");
+ f = (Float) props.get("f");
+ c = (Character) props.get("c");
+ bool = (Boolean) props.get("bool");
+
+ assertEquals("2) Check b (" + b + ")", b, new Byte("2"));
+ assertEquals("2) Check s", s, new Short("2"));
+ assertEquals("2) Check i", i, new Integer("2"));
+ assertEquals("2) Check l", l, new Long("2"));
+ assertEquals("2) Check d", d, new Double("2"));
+ assertEquals("2) Check f", f, new Float("2"));
+ assertEquals("2) Check c", c, new Character('b'));
+ assertEquals("2) Check bool", bool, new Boolean("false"));
+
+// upb = (Integer) props.get("upb");
+// ups = (Integer) props.get("ups");
+// upi = (Integer) props.get("upi");
+// upl = (Integer) props.get("upl");
+// upd = (Integer) props.get("upd");
+// upf = (Integer) props.get("upf");
+// upc = (Integer) props.get("upc");
+// upbool = (Integer) props.get("upbool");
+//
+// assertEquals("2) Check upb", upb, new Integer(2));
+// assertEquals("2) Check ups", ups, new Integer(2));
+// assertEquals("2) Check upi", upi, new Integer(2));
+// assertEquals("2) Check upl", upl, new Integer(2));
+// assertEquals("2) Check upd", upd, new Integer(2));
+// assertEquals("2) Check upf", upf, new Integer(2));
+// assertEquals("2) Check upc", upc, new Integer(2));
+// assertEquals("2) Check upbool", upbool, new Integer(2));
+
+ }
+
+ @Test
+ public void testConfigurationPrimitiveArrays() {
+ ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ CheckService check = (CheckService) osgiHelper.getServiceObject(ref);
+ Properties props = check.getProps();
+
+ byte[] b = (byte[]) props.get("bs");
+ short[] s = (short[]) props.get("ss");
+ int[] i = (int[]) props.get("is");
+ long[] l = (long[]) props.get("ls");
+ double[] d = (double[]) props.get("ds");
+ float[] f = (float[]) props.get("fs");
+ char[] c = (char[]) props.get("cs");
+ boolean[] bool = (boolean[]) props.get("bools");
+
+ assertEquals("Check b 0", b[0], 1);
+ assertEquals("Check b 1", b[1], 2);
+ assertEquals("Check b 2", b[2], 3);
+ assertEquals("Check s 0", s[0], 1);
+ assertEquals("Check s 1", s[1], 2);
+ assertEquals("Check s 2", s[2], 3);
+ assertEquals("Check i 0", i[0], 1);
+ assertEquals("Check i 1", i[1], 2);
+ assertEquals("Check i 2", i[2], 3);
+ assertEquals("Check l 0", l[0], 1);
+ assertEquals("Check l 1", l[1], 2);
+ assertEquals("Check l 2", l[2], 3);
+ assertEquals("Check d 0", d[0], 1, 0);
+ assertEquals("Check d 1", d[1], 2, 0);
+ assertEquals("Check d 2", d[2], 3, 0);
+ assertEquals("Check f 0", f[0], 1, 0);
+ assertEquals("Check f 1", f[1], 2, 0);
+ assertEquals("Check f 2", f[2], 3, 0);
+ assertEquals("Check c 0", c[0], 'a');
+ assertEquals("Check c 1", c[1], 'b');
+ assertEquals("Check c 2", c[2], 'c');
+ assertTrue("Check bool 0", bool[0]);
+ assertTrue("Check bool 1", bool[0]);
+ assertTrue("Check bool 2", bool[0]);
+
+// Integer upb = (Integer) props.get("upbs");
+// Integer ups = (Integer) props.get("upss");
+// Integer upi = (Integer) props.get("upis");
+// Integer upl = (Integer) props.get("upls");
+// Integer upd = (Integer) props.get("upds");
+// Integer upf = (Integer) props.get("upfs");
+// Integer upc = (Integer) props.get("upcs");
+// Integer upbool = (Integer) props.get("upbools");
+//
+// assertEquals("Check upb", upb, new Integer(1));
+// assertEquals("Check ups", ups, new Integer(1));
+// assertEquals("Check upi", upi, new Integer(1));
+// assertEquals("Check upl", upl, new Integer(1));
+// assertEquals("Check upd", upd, new Integer(1));
+// assertEquals("Check upf", upf, new Integer(1));
+// assertEquals("Check upc", upc, new Integer(1));
+// assertEquals("Check upbool", upbool, new Integer(1));
+
+ reconfigure(instance);
+
+ ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ check = (CheckService) osgiHelper.getServiceObject(ref);
+ props = check.getProps();
+
+ b = (byte[]) props.get("bs");
+ s = (short[]) props.get("ss");
+ i = (int[]) props.get("is");
+ l = (long[]) props.get("ls");
+ d = (double[]) props.get("ds");
+ f = (float[]) props.get("fs");
+ c = (char[]) props.get("cs");
+ bool = (boolean[]) props.get("bools");
+
+ assertEquals("2) Check b 0", b[0], 3);
+ assertEquals("2) Check b 1", b[1], 2);
+ assertEquals("2) Check b 2", b[2], 1);
+ assertEquals("2) Check s 0", s[0], 3);
+ assertEquals("2) Check s 1", s[1], 2);
+ assertEquals("2) Check s 2", s[2], 1);
+ assertEquals("2) Check i 0", i[0], 3);
+ assertEquals("2) Check i 1", i[1], 2);
+ assertEquals("2) Check i 2", i[2], 1);
+ assertEquals("2) Check l 0", l[0], 3);
+ assertEquals("2) Check l 1", l[1], 2);
+ assertEquals("2) Check l 2", l[2], 1);
+ assertEquals("2) Check d 0", d[0], 3, 0);
+ assertEquals("2) Check d 1", d[1], 2, 0);
+ assertEquals("2) Check d 2", d[2], 1, 0);
+ assertEquals("2) Check f 0", f[0], 3, 0);
+ assertEquals("2) Check f 1", f[1], 2, 0);
+ assertEquals("2) Check f 2", f[2], 1, 0);
+ assertEquals("2) Check c 0", c[0], 'c');
+ assertEquals("2) Check c 1", c[1], 'b');
+ assertEquals("2) Check c 2", c[2], 'a');
+ assertFalse("2) Check bool 0", bool[0]);
+ assertFalse("2) Check bool 1", bool[0]);
+ assertFalse("2) Check bool 2", bool[0]);
+
+// upb = (Integer) props.get("upbs");
+// ups = (Integer) props.get("upss");
+// upi = (Integer) props.get("upis");
+// upl = (Integer) props.get("upls");
+// upd = (Integer) props.get("upds");
+// upf = (Integer) props.get("upfs");
+// upc = (Integer) props.get("upcs");
+// upbool = (Integer) props.get("upbools");
+//
+// assertEquals("2) Check upb", upb, new Integer(2));
+// assertEquals("2) Check ups", ups, new Integer(2));
+// assertEquals("2) Check upi", upi, new Integer(2));
+// assertEquals("2) Check upl", upl, new Integer(2));
+// assertEquals("2) Check upd", upd, new Integer(2));
+// assertEquals("2) Check upf", upf, new Integer(2));
+// assertEquals("2) Check upc", upc, new Integer(2));
+// assertEquals("2) Check upbool", upbool, new Integer(2));
+
+ }
+
+ @Test
+ public void testConfigurationPrimitiveArraysString() {
+ ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ CheckService check = (CheckService) osgiHelper.getServiceObject(ref);
+ Properties props = check.getProps();
+
+ byte[] b = (byte[]) props.get("bs");
+ short[] s = (short[]) props.get("ss");
+ int[] i = (int[]) props.get("is");
+ long[] l = (long[]) props.get("ls");
+ double[] d = (double[]) props.get("ds");
+ float[] f = (float[]) props.get("fs");
+ char[] c = (char[]) props.get("cs");
+ boolean[] bool = (boolean[]) props.get("bools");
+
+ assertEquals("Check b 0", b[0], 1);
+ assertEquals("Check b 1", b[1], 2);
+ assertEquals("Check b 2", b[2], 3);
+ assertEquals("Check s 0", s[0], 1);
+ assertEquals("Check s 1", s[1], 2);
+ assertEquals("Check s 2", s[2], 3);
+ assertEquals("Check i 0", i[0], 1);
+ assertEquals("Check i 1", i[1], 2);
+ assertEquals("Check i 2", i[2], 3);
+ assertEquals("Check l 0", l[0], 1);
+ assertEquals("Check l 1", l[1], 2);
+ assertEquals("Check l 2", l[2], 3);
+ assertEquals("Check d 0", d[0], 1, 0);
+ assertEquals("Check d 1", d[1], 2, 0);
+ assertEquals("Check d 2", d[2], 3, 0);
+ assertEquals("Check f 0", f[0], 1, 0);
+ assertEquals("Check f 1", f[1], 2, 0);
+ assertEquals("Check f 2", f[2], 3, 0);
+ assertEquals("Check c 0", c[0], 'a');
+ assertEquals("Check c 1", c[1], 'b');
+ assertEquals("Check c 2", c[2], 'c');
+ assertTrue("Check bool 0", bool[0]);
+ assertTrue("Check bool 1", bool[0]);
+ assertTrue("Check bool 2", bool[0]);
+
+// Integer upb = (Integer) props.get("upbs");
+// Integer ups = (Integer) props.get("upss");
+// Integer upi = (Integer) props.get("upis");
+// Integer upl = (Integer) props.get("upls");
+// Integer upd = (Integer) props.get("upds");
+// Integer upf = (Integer) props.get("upfs");
+// Integer upc = (Integer) props.get("upcs");
+// Integer upbool = (Integer) props.get("upbools");
+//
+// assertEquals("Check upb", upb, new Integer(1));
+// assertEquals("Check ups", ups, new Integer(1));
+// assertEquals("Check upi", upi, new Integer(1));
+// assertEquals("Check upl", upl, new Integer(1));
+// assertEquals("Check upd", upd, new Integer(1));
+// assertEquals("Check upf", upf, new Integer(1));
+// assertEquals("Check upc", upc, new Integer(1));
+// assertEquals("Check upbool", upbool, new Integer(1));
+
+ reconfigureString(instance);
+
+ ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ check = (CheckService) osgiHelper.getServiceObject(ref);
+ props = check.getProps();
+
+ b = (byte[]) props.get("bs");
+ s = (short[]) props.get("ss");
+ i = (int[]) props.get("is");
+ l = (long[]) props.get("ls");
+ d = (double[]) props.get("ds");
+ f = (float[]) props.get("fs");
+ c = (char[]) props.get("cs");
+ bool = (boolean[]) props.get("bools");
+
+ assertEquals("2) Check b 0", b[0], 3);
+ assertEquals("2) Check b 1", b[1], 2);
+ assertEquals("2) Check b 2", b[2], 1);
+ assertEquals("2) Check s 0", s[0], 3);
+ assertEquals("2) Check s 1", s[1], 2);
+ assertEquals("2) Check s 2", s[2], 1);
+ assertEquals("2) Check i 0", i[0], 3);
+ assertEquals("2) Check i 1", i[1], 2);
+ assertEquals("2) Check i 2", i[2], 1);
+ assertEquals("2) Check l 0", l[0], 3);
+ assertEquals("2) Check l 1", l[1], 2);
+ assertEquals("2) Check l 2", l[2], 1);
+ assertEquals("2) Check d 0", d[0], 3, 0);
+ assertEquals("2) Check d 1", d[1], 2, 0);
+ assertEquals("2) Check d 2", d[2], 1, 0);
+ assertEquals("2) Check f 0", f[0], 3, 0);
+ assertEquals("2) Check f 1", f[1], 2, 0);
+ assertEquals("2) Check f 2", f[2], 1, 0);
+ assertEquals("2) Check c 0", c[0], 'c');
+ assertEquals("2) Check c 1", c[1], 'b');
+ assertEquals("2) Check c 2", c[2], 'a');
+ assertFalse("2) Check bool 0", bool[0]);
+ assertFalse("2) Check bool 1", bool[0]);
+ assertFalse("2) Check bool 2", bool[0]);
+
+// upb = (Integer) props.get("upbs");
+// ups = (Integer) props.get("upss");
+// upi = (Integer) props.get("upis");
+// upl = (Integer) props.get("upls");
+// upd = (Integer) props.get("upds");
+// upf = (Integer) props.get("upfs");
+// upc = (Integer) props.get("upcs");
+// upbool = (Integer) props.get("upbools");
+//
+// assertEquals("2) Check upb", upb, new Integer(2));
+// assertEquals("2) Check ups", ups, new Integer(2));
+// assertEquals("2) Check upi", upi, new Integer(2));
+// assertEquals("2) Check upl", upl, new Integer(2));
+// assertEquals("2) Check upd", upd, new Integer(2));
+// assertEquals("2) Check upf", upf, new Integer(2));
+// assertEquals("2) Check upc", upc, new Integer(2));
+// assertEquals("2) Check upbool", upbool, new Integer(2));
+
+ }
+
+ @Test
+ public void testConfigurationObj() {
+ ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ CheckService check = (CheckService) osgiHelper.getServiceObject(ref);
+ Properties props = check.getProps();
+
+ String s = (String) props.get("string");
+ String[] ss = (String[]) props.get("strings");
+
+ assertEquals("Check string", s, "foo");
+ assertEquals("Check strings 0", ss[0], "foo");
+ assertEquals("Check strings 1", ss[1], "bar");
+ assertEquals("Check strings 2", ss[2], "baz");
+
+// Integer upString = (Integer) props.get("upstring");
+// Integer upStrings = (Integer) props.get("upstrings");
+//
+// assertEquals("Check upString", upString, new Integer(1));
+// assertEquals("Check upStrings", upStrings, new Integer(1));
+
+ reconfigure(instance);
+
+ ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ check = (CheckService) osgiHelper.getServiceObject(ref);
+ props = check.getProps();
+
+ s = (String) props.get("string");
+ ss = (String[]) props.get("strings");
+
+ assertEquals("2) Check string", s, "bar");
+ assertEquals("2) Check strings 0", ss[0], "baz");
+ assertEquals("2) Check strings 1", ss[1], "bar");
+ assertEquals("2) Check strings 2", ss[2], "foo");
+
+// upString = (Integer) props.get("upstring");
+// upStrings = (Integer) props.get("upstrings");
+//
+// assertEquals("2) Check upString", upString, new Integer(2));
+// assertEquals("2) Check upStrings", upStrings, new Integer(2));
+ }
+
+ @Test
+ public void testConfigurationObjString() {
+ ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ CheckService check = (CheckService) osgiHelper.getServiceObject(ref);
+ Properties props = check.getProps();
+
+ String s = (String) props.get("string");
+ String[] ss = (String[]) props.get("strings");
+
+ assertEquals("Check string", s, "foo");
+ assertEquals("Check strings 0", ss[0], "foo");
+ assertEquals("Check strings 1", ss[1], "bar");
+ assertEquals("Check strings 2", ss[2], "baz");
+
+// Integer upString = (Integer) props.get("upstring");
+// Integer upStrings = (Integer) props.get("upstrings");
+//
+// assertEquals("Check upString", upString, new Integer(1));
+// assertEquals("Check upStrings", upStrings, new Integer(1));
+
+ reconfigureString(instance);
+
+ ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ check = (CheckService) osgiHelper.getServiceObject(ref);
+ props = check.getProps();
+
+ s = (String) props.get("string");
+ ss = (String[]) props.get("strings");
+
+ assertEquals("2) Check string", s, "bar");
+ assertEquals("2) Check strings 0", ss[0], "baz");
+ assertEquals("2) Check strings 1", ss[1], "bar");
+ assertEquals("2) Check strings 2", ss[2], "foo");
+
+// upString = (Integer) props.get("upstring");
+// upStrings = (Integer) props.get("upstrings");
+//
+// assertEquals("2) Check upString", upString, new Integer(2));
+// assertEquals("2) Check upStrings", upStrings, new Integer(2));
+ }
+
+ @Test
+ public void testConfigurationPrimitive2() {
+ ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance2.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ CheckService check = (CheckService) osgiHelper.getServiceObject(ref);
+ Properties props = check.getProps();
+
+ Byte b = (Byte) props.get("b");
+ Short s = (Short) props.get("s");
+ Integer i = (Integer) props.get("i");
+ Long l = (Long) props.get("l");
+ Double d = (Double) props.get("d");
+ Float f = (Float) props.get("f");
+ Character c = (Character) props.get("c");
+ Boolean bool = (Boolean) props.get("bool");
+
+ assertEquals("Check b", b, new Byte("1"));
+ assertEquals("Check s", s, new Short("1"));
+ assertEquals("Check i", i, new Integer("1"));
+ assertEquals("Check l", l, new Long("1"));
+ assertEquals("Check d", d, new Double("1"));
+ assertEquals("Check f", f, new Float("1"));
+ assertEquals("Check c", c, new Character('a'));
+ assertEquals("Check bool", bool, new Boolean("true"));
+
+// Integer upb = (Integer) props.get("upb");
+// Integer ups = (Integer) props.get("ups");
+// Integer upi = (Integer) props.get("upi");
+// Integer upl = (Integer) props.get("upl");
+// Integer upd = (Integer) props.get("upd");
+// Integer upf = (Integer) props.get("upf");
+// Integer upc = (Integer) props.get("upc");
+// Integer upbool = (Integer) props.get("upbool");
+//
+// assertEquals("Check upb", upb, new Integer(1));
+// assertEquals("Check ups", ups, new Integer(1));
+// assertEquals("Check upi", upi, new Integer(1));
+// assertEquals("Check upl", upl, new Integer(1));
+// assertEquals("Check upd", upd, new Integer(1));
+// assertEquals("Check upf", upf, new Integer(1));
+// assertEquals("Check upc", upc, new Integer(1));
+// assertEquals("Check upbool", upbool, new Integer(1));
+
+ reconfigure(instance2);
+
+ ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance2.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ check = (CheckService) osgiHelper.getServiceObject(ref);
+ props = check.getProps();
+
+ b = (Byte) props.get("b");
+ s = (Short) props.get("s");
+ i = (Integer) props.get("i");
+ l = (Long) props.get("l");
+ d = (Double) props.get("d");
+ f = (Float) props.get("f");
+ c = (Character) props.get("c");
+ bool = (Boolean) props.get("bool");
+
+ assertEquals("2) Check b (" + b + ")", b, new Byte("2"));
+ assertEquals("2) Check s", s, new Short("2"));
+ assertEquals("2) Check i", i, new Integer("2"));
+ assertEquals("2) Check l", l, new Long("2"));
+ assertEquals("2) Check d", d, new Double("2"));
+ assertEquals("2) Check f", f, new Float("2"));
+ assertEquals("2) Check c", c, new Character('b'));
+ assertEquals("2) Check bool", bool, new Boolean("false"));
+
+// upb = (Integer) props.get("upb");
+// ups = (Integer) props.get("ups");
+// upi = (Integer) props.get("upi");
+// upl = (Integer) props.get("upl");
+// upd = (Integer) props.get("upd");
+// upf = (Integer) props.get("upf");
+// upc = (Integer) props.get("upc");
+// upbool = (Integer) props.get("upbool");
+//
+// assertEquals("2) Check upb", upb, new Integer(2));
+// assertEquals("2) Check ups", ups, new Integer(2));
+// assertEquals("2) Check upi", upi, new Integer(2));
+// assertEquals("2) Check upl", upl, new Integer(2));
+// assertEquals("2) Check upd", upd, new Integer(2));
+// assertEquals("2) Check upf", upf, new Integer(2));
+// assertEquals("2) Check upc", upc, new Integer(2));
+// assertEquals("2) Check upbool", upbool, new Integer(2));
+
+ }
+
+ @Test
+ public void testConfigurationPrimitive2String() {
+ ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance2.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ CheckService check = (CheckService) osgiHelper.getServiceObject(ref);
+ Properties props = check.getProps();
+
+ Byte b = (Byte) props.get("b");
+ Short s = (Short) props.get("s");
+ Integer i = (Integer) props.get("i");
+ Long l = (Long) props.get("l");
+ Double d = (Double) props.get("d");
+ Float f = (Float) props.get("f");
+ Character c = (Character) props.get("c");
+ Boolean bool = (Boolean) props.get("bool");
+
+ assertEquals("Check b", b, new Byte("1"));
+ assertEquals("Check s", s, new Short("1"));
+ assertEquals("Check i", i, new Integer("1"));
+ assertEquals("Check l", l, new Long("1"));
+ assertEquals("Check d", d, new Double("1"));
+ assertEquals("Check f", f, new Float("1"));
+ assertEquals("Check c", c, new Character('a'));
+ assertEquals("Check bool", bool, new Boolean("true"));
+
+// Integer upb = (Integer) props.get("upb");
+// Integer ups = (Integer) props.get("ups");
+// Integer upi = (Integer) props.get("upi");
+// Integer upl = (Integer) props.get("upl");
+// Integer upd = (Integer) props.get("upd");
+// Integer upf = (Integer) props.get("upf");
+// Integer upc = (Integer) props.get("upc");
+// Integer upbool = (Integer) props.get("upbool");
+//
+// assertEquals("Check upb", upb, new Integer(1));
+// assertEquals("Check ups", ups, new Integer(1));
+// assertEquals("Check upi", upi, new Integer(1));
+// assertEquals("Check upl", upl, new Integer(1));
+// assertEquals("Check upd", upd, new Integer(1));
+// assertEquals("Check upf", upf, new Integer(1));
+// assertEquals("Check upc", upc, new Integer(1));
+// assertEquals("Check upbool", upbool, new Integer(1));
+
+ reconfigureString(instance2);
+
+ ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance2.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ check = (CheckService) osgiHelper.getServiceObject(ref);
+ props = check.getProps();
+
+ b = (Byte) props.get("b");
+ s = (Short) props.get("s");
+ i = (Integer) props.get("i");
+ l = (Long) props.get("l");
+ d = (Double) props.get("d");
+ f = (Float) props.get("f");
+ c = (Character) props.get("c");
+ bool = (Boolean) props.get("bool");
+
+ assertEquals("2) Check b (" + b + ")", b, new Byte("2"));
+ assertEquals("2) Check s", s, new Short("2"));
+ assertEquals("2) Check i", i, new Integer("2"));
+ assertEquals("2) Check l", l, new Long("2"));
+ assertEquals("2) Check d", d, new Double("2"));
+ assertEquals("2) Check f", f, new Float("2"));
+ assertEquals("2) Check c", c, new Character('b'));
+ assertEquals("2) Check bool", bool, new Boolean("false"));
+
+// upb = (Integer) props.get("upb");
+// ups = (Integer) props.get("ups");
+// upi = (Integer) props.get("upi");
+// upl = (Integer) props.get("upl");
+// upd = (Integer) props.get("upd");
+// upf = (Integer) props.get("upf");
+// upc = (Integer) props.get("upc");
+// upbool = (Integer) props.get("upbool");
+//
+// assertEquals("2) Check upb", upb, new Integer(2));
+// assertEquals("2) Check ups", ups, new Integer(2));
+// assertEquals("2) Check upi", upi, new Integer(2));
+// assertEquals("2) Check upl", upl, new Integer(2));
+// assertEquals("2) Check upd", upd, new Integer(2));
+// assertEquals("2) Check upf", upf, new Integer(2));
+// assertEquals("2) Check upc", upc, new Integer(2));
+// assertEquals("2) Check upbool", upbool, new Integer(2));
+
+ }
+
+ @Test
+ public void testConfigurationPrimitiveArrays2() {
+ ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance2.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ CheckService check = (CheckService) osgiHelper.getServiceObject(ref);
+ Properties props = check.getProps();
+
+ byte[] b = (byte[]) props.get("bs");
+ short[] s = (short[]) props.get("ss");
+ int[] i = (int[]) props.get("is");
+ long[] l = (long[]) props.get("ls");
+ double[] d = (double[]) props.get("ds");
+ float[] f = (float[]) props.get("fs");
+ char[] c = (char[]) props.get("cs");
+ boolean[] bool = (boolean[]) props.get("bools");
+
+ assertEquals("Check b 0", b[0], 1);
+ assertEquals("Check b 1", b[1], 2);
+ assertEquals("Check b 2", b[2], 3);
+ assertEquals("Check s 0", s[0], 1);
+ assertEquals("Check s 1", s[1], 2);
+ assertEquals("Check s 2", s[2], 3);
+ assertEquals("Check i 0", i[0], 1);
+ assertEquals("Check i 1", i[1], 2);
+ assertEquals("Check i 2", i[2], 3);
+ assertEquals("Check l 0", l[0], 1);
+ assertEquals("Check l 1", l[1], 2);
+ assertEquals("Check l 2", l[2], 3);
+ assertEquals("Check d 0", d[0], 1, 0);
+ assertEquals("Check d 1", d[1], 2, 0);
+ assertEquals("Check d 2", d[2], 3, 0);
+ assertEquals("Check f 0", f[0], 1, 0);
+ assertEquals("Check f 1", f[1], 2, 0);
+ assertEquals("Check f 2", f[2], 3, 0);
+ assertEquals("Check c 0", c[0], 'a');
+ assertEquals("Check c 1", c[1], 'b');
+ assertEquals("Check c 2", c[2], 'c');
+ assertTrue("Check bool 0", bool[0]);
+ assertTrue("Check bool 1", bool[0]);
+ assertTrue("Check bool 2", bool[0]);
+
+// Integer upb = (Integer) props.get("upbs");
+// Integer ups = (Integer) props.get("upss");
+// Integer upi = (Integer) props.get("upis");
+// Integer upl = (Integer) props.get("upls");
+// Integer upd = (Integer) props.get("upds");
+// Integer upf = (Integer) props.get("upfs");
+// Integer upc = (Integer) props.get("upcs");
+// Integer upbool = (Integer) props.get("upbools");
+//
+// assertEquals("Check upb", upb, new Integer(1));
+// assertEquals("Check ups", ups, new Integer(1));
+// assertEquals("Check upi", upi, new Integer(1));
+// assertEquals("Check upl", upl, new Integer(1));
+// assertEquals("Check upd", upd, new Integer(1));
+// assertEquals("Check upf", upf, new Integer(1));
+// assertEquals("Check upc", upc, new Integer(1));
+// assertEquals("Check upbool", upbool, new Integer(1));
+
+ reconfigure(instance2);
+
+ ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance2.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ check = (CheckService) osgiHelper.getServiceObject(ref);
+ props = check.getProps();
+
+ b = (byte[]) props.get("bs");
+ s = (short[]) props.get("ss");
+ i = (int[]) props.get("is");
+ l = (long[]) props.get("ls");
+ d = (double[]) props.get("ds");
+ f = (float[]) props.get("fs");
+ c = (char[]) props.get("cs");
+ bool = (boolean[]) props.get("bools");
+
+ assertEquals("2) Check b 0", b[0], 3);
+ assertEquals("2) Check b 1", b[1], 2);
+ assertEquals("2) Check b 2", b[2], 1);
+ assertEquals("2) Check s 0", s[0], 3);
+ assertEquals("2) Check s 1", s[1], 2);
+ assertEquals("2) Check s 2", s[2], 1);
+ assertEquals("2) Check i 0", i[0], 3);
+ assertEquals("2) Check i 1", i[1], 2);
+ assertEquals("2) Check i 2", i[2], 1);
+ assertEquals("2) Check l 0", l[0], 3);
+ assertEquals("2) Check l 1", l[1], 2);
+ assertEquals("2) Check l 2", l[2], 1);
+ assertEquals("2) Check d 0", d[0], 3, 0);
+ assertEquals("2) Check d 1", d[1], 2, 0);
+ assertEquals("2) Check d 2", d[2], 1, 0);
+ assertEquals("2) Check f 0", f[0], 3, 0);
+ assertEquals("2) Check f 1", f[1], 2, 0);
+ assertEquals("2) Check f 2", f[2], 1, 0);
+ assertEquals("2) Check c 0", c[0], 'c');
+ assertEquals("2) Check c 1", c[1], 'b');
+ assertEquals("2) Check c 2", c[2], 'a');
+ assertFalse("2) Check bool 0", bool[0]);
+ assertFalse("2) Check bool 1", bool[0]);
+ assertFalse("2) Check bool 2", bool[0]);
+
+// upb = (Integer) props.get("upbs");
+// ups = (Integer) props.get("upss");
+// upi = (Integer) props.get("upis");
+// upl = (Integer) props.get("upls");
+// upd = (Integer) props.get("upds");
+// upf = (Integer) props.get("upfs");
+// upc = (Integer) props.get("upcs");
+// upbool = (Integer) props.get("upbools");
+//
+// assertEquals("2) Check upb", upb, new Integer(2));
+// assertEquals("2) Check ups", ups, new Integer(2));
+// assertEquals("2) Check upi", upi, new Integer(2));
+// assertEquals("2) Check upl", upl, new Integer(2));
+// assertEquals("2) Check upd", upd, new Integer(2));
+// assertEquals("2) Check upf", upf, new Integer(2));
+// assertEquals("2) Check upc", upc, new Integer(2));
+// assertEquals("2) Check upbool", upbool, new Integer(2));
+
+ }
+
+ @Test
+ public void testConfigurationPrimitiveArrays2String() {
+ ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance2.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ CheckService check = (CheckService) osgiHelper.getServiceObject(ref);
+ Properties props = check.getProps();
+
+ byte[] b = (byte[]) props.get("bs");
+ short[] s = (short[]) props.get("ss");
+ int[] i = (int[]) props.get("is");
+ long[] l = (long[]) props.get("ls");
+ double[] d = (double[]) props.get("ds");
+ float[] f = (float[]) props.get("fs");
+ char[] c = (char[]) props.get("cs");
+ boolean[] bool = (boolean[]) props.get("bools");
+
+ assertEquals("Check b 0", b[0], 1);
+ assertEquals("Check b 1", b[1], 2);
+ assertEquals("Check b 2", b[2], 3);
+ assertEquals("Check s 0", s[0], 1);
+ assertEquals("Check s 1", s[1], 2);
+ assertEquals("Check s 2", s[2], 3);
+ assertEquals("Check i 0", i[0], 1);
+ assertEquals("Check i 1", i[1], 2);
+ assertEquals("Check i 2", i[2], 3);
+ assertEquals("Check l 0", l[0], 1);
+ assertEquals("Check l 1", l[1], 2);
+ assertEquals("Check l 2", l[2], 3);
+ assertEquals("Check d 0", d[0], 1, 0);
+ assertEquals("Check d 1", d[1], 2, 0);
+ assertEquals("Check d 2", d[2], 3, 0);
+ assertEquals("Check f 0", f[0], 1, 0);
+ assertEquals("Check f 1", f[1], 2, 0);
+ assertEquals("Check f 2", f[2], 3, 0);
+ assertEquals("Check c 0", c[0], 'a');
+ assertEquals("Check c 1", c[1], 'b');
+ assertEquals("Check c 2", c[2], 'c');
+ assertTrue("Check bool 0", bool[0]);
+ assertTrue("Check bool 1", bool[0]);
+ assertTrue("Check bool 2", bool[0]);
+
+// Integer upb = (Integer) props.get("upbs");
+// Integer ups = (Integer) props.get("upss");
+// Integer upi = (Integer) props.get("upis");
+// Integer upl = (Integer) props.get("upls");
+// Integer upd = (Integer) props.get("upds");
+// Integer upf = (Integer) props.get("upfs");
+// Integer upc = (Integer) props.get("upcs");
+// Integer upbool = (Integer) props.get("upbools");
+//
+// assertEquals("Check upb", upb, new Integer(1));
+// assertEquals("Check ups", ups, new Integer(1));
+// assertEquals("Check upi", upi, new Integer(1));
+// assertEquals("Check upl", upl, new Integer(1));
+// assertEquals("Check upd", upd, new Integer(1));
+// assertEquals("Check upf", upf, new Integer(1));
+// assertEquals("Check upc", upc, new Integer(1));
+// assertEquals("Check upbool", upbool, new Integer(1));
+
+ reconfigureString(instance2);
+
+ ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance2.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ check = (CheckService) osgiHelper.getServiceObject(ref);
+ props = check.getProps();
+
+ b = (byte[]) props.get("bs");
+ s = (short[]) props.get("ss");
+ i = (int[]) props.get("is");
+ l = (long[]) props.get("ls");
+ d = (double[]) props.get("ds");
+ f = (float[]) props.get("fs");
+ c = (char[]) props.get("cs");
+ bool = (boolean[]) props.get("bools");
+
+ assertEquals("2) Check b 0", b[0], 3);
+ assertEquals("2) Check b 1", b[1], 2);
+ assertEquals("2) Check b 2", b[2], 1);
+ assertEquals("2) Check s 0", s[0], 3);
+ assertEquals("2) Check s 1", s[1], 2);
+ assertEquals("2) Check s 2", s[2], 1);
+ assertEquals("2) Check i 0", i[0], 3);
+ assertEquals("2) Check i 1", i[1], 2);
+ assertEquals("2) Check i 2", i[2], 1);
+ assertEquals("2) Check l 0", l[0], 3);
+ assertEquals("2) Check l 1", l[1], 2);
+ assertEquals("2) Check l 2", l[2], 1);
+ assertEquals("2) Check d 0", d[0], 3, 0);
+ assertEquals("2) Check d 1", d[1], 2, 0);
+ assertEquals("2) Check d 2", d[2], 1, 0);
+ assertEquals("2) Check f 0", f[0], 3, 0);
+ assertEquals("2) Check f 1", f[1], 2, 0);
+ assertEquals("2) Check f 2", f[2], 1, 0);
+ assertEquals("2) Check c 0", c[0], 'c');
+ assertEquals("2) Check c 1", c[1], 'b');
+ assertEquals("2) Check c 2", c[2], 'a');
+ assertFalse("2) Check bool 0", bool[0]);
+ assertFalse("2) Check bool 1", bool[0]);
+ assertFalse("2) Check bool 2", bool[0]);
+
+// upb = (Integer) props.get("upbs");
+// ups = (Integer) props.get("upss");
+// upi = (Integer) props.get("upis");
+// upl = (Integer) props.get("upls");
+// upd = (Integer) props.get("upds");
+// upf = (Integer) props.get("upfs");
+// upc = (Integer) props.get("upcs");
+// upbool = (Integer) props.get("upbools");
+//
+// assertEquals("2) Check upb", upb, new Integer(2));
+// assertEquals("2) Check ups", ups, new Integer(2));
+// assertEquals("2) Check upi", upi, new Integer(2));
+// assertEquals("2) Check upl", upl, new Integer(2));
+// assertEquals("2) Check upd", upd, new Integer(2));
+// assertEquals("2) Check upf", upf, new Integer(2));
+// assertEquals("2) Check upc", upc, new Integer(2));
+// assertEquals("2) Check upbool", upbool, new Integer(2));
+
+ }
+
+ @Test
+ public void testConfigurationObj2() {
+ ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance2.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ CheckService check = (CheckService) osgiHelper.getServiceObject(ref);
+ Properties props = check.getProps();
+
+ String s = (String) props.get("string");
+ String[] ss = (String[]) props.get("strings");
+
+ assertEquals("Check string", s, "foo");
+ assertEquals("Check strings 0", ss[0], "foo");
+ assertEquals("Check strings 1", ss[1], "bar");
+ assertEquals("Check strings 2", ss[2], "baz");
+
+// Integer upString = (Integer) props.get("upstring");
+// Integer upStrings = (Integer) props.get("upstrings");
+//
+// assertEquals("Check upString", upString, new Integer(1));
+// assertEquals("Check upStrings", upStrings, new Integer(1));
+
+ reconfigure(instance2);
+
+ ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance2.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ check = (CheckService) osgiHelper.getServiceObject(ref);
+ props = check.getProps();
+
+ s = (String) props.get("string");
+ ss = (String[]) props.get("strings");
+
+ assertEquals("2) Check string", s, "bar");
+ assertEquals("2) Check strings 0", ss[0], "baz");
+ assertEquals("2) Check strings 1", ss[1], "bar");
+ assertEquals("2) Check strings 2", ss[2], "foo");
+
+// upString = (Integer) props.get("upstring");
+// upStrings = (Integer) props.get("upstrings");
+//
+// assertEquals("2) Check upString", upString, new Integer(2));
+// assertEquals("2) Check upStrings", upStrings, new Integer(2));
+ }
+
+ @Test
+ public void testConfigurationObj2String() {
+ ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance2.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ CheckService check = (CheckService) osgiHelper.getServiceObject(ref);
+ Properties props = check.getProps();
+
+ String s = (String) props.get("string");
+ String[] ss = (String[]) props.get("strings");
+
+ assertEquals("Check string", s, "foo");
+ assertEquals("Check strings 0", ss[0], "foo");
+ assertEquals("Check strings 1", ss[1], "bar");
+ assertEquals("Check strings 2", ss[2], "baz");
+
+// Integer upString = (Integer) props.get("upstring");
+// Integer upStrings = (Integer) props.get("upstrings");
+//
+// assertEquals("Check upString", upString, new Integer(1));
+// assertEquals("Check upStrings", upStrings, new Integer(1));
+
+ reconfigureString(instance2);
+
+ ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance2.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ check = (CheckService) osgiHelper.getServiceObject(ref);
+ props = check.getProps();
+
+ s = (String) props.get("string");
+ ss = (String[]) props.get("strings");
+
+ assertEquals("2) Check string", s, "bar");
+ assertEquals("2) Check strings 0", ss[0], "baz");
+ assertEquals("2) Check strings 1", ss[1], "bar");
+ assertEquals("2) Check strings 2", ss[2], "foo");
+
+// upString = (Integer) props.get("upstring");
+// upStrings = (Integer) props.get("upstrings");
+//
+// assertEquals("2) Check upString", upString, new Integer(2));
+// assertEquals("2) Check upStrings", upStrings, new Integer(2));
+ }
+
+ private void reconfigure(ComponentInstance ci) {
+ Properties props2 = new Properties();
+ props2.put("b", new Byte("2"));
+ props2.put("s", new Short("2"));
+ props2.put("i", new Integer("2"));
+ props2.put("l", new Long("2"));
+ props2.put("d", new Double("2"));
+ props2.put("f", new Float("2"));
+ props2.put("c", new Character('b'));
+ props2.put("bool", new Boolean(false));
+ props2.put("bs", new byte[]{(byte) 3, (byte) 2, (byte) 1});
+ props2.put("ss", new short[]{(short) 3, (short) 2, (short) 1});
+ props2.put("is", new int[]{3, 2, 1});
+ props2.put("ls", new long[]{3, 2, 1});
+ props2.put("ds", new double[]{3, 2, 1});
+ props2.put("fs", new float[]{3, 2, 1});
+ props2.put("cs", new char[]{'c', 'b', 'a'});
+ props2.put("bools", new boolean[]{false, false, false});
+ props2.put("string", "bar");
+ props2.put("strings", new String[]{"baz", "bar", "foo"});
+
+ ci.reconfigure(props2);
+ }
+
+ private void reconfigureString(ComponentInstance ci) {
+ Properties props2 = new Properties();
+ props2.put("b", "2");
+ props2.put("s", "2");
+ props2.put("i", "2");
+ props2.put("l", "2");
+ props2.put("d", "2");
+ props2.put("f", "2");
+ props2.put("c", "b");
+ props2.put("bool", "false");
+ props2.put("bs", "{3, 2,1}");
+ props2.put("ss", "{3, 2,1}");
+ props2.put("is", "{3, 2,1}");
+ props2.put("ls", "{3, 2,1}");
+ props2.put("ds", "{3, 2,1}");
+ props2.put("fs", "{3, 2,1}");
+ props2.put("cs", "{c, b , a}");
+ props2.put("bools", "{false,false,false}");
+ props2.put("string", "bar");
+ props2.put("strings", "{baz, bar, foo}");
+
+ ci.reconfigure(props2);
+ }
+
+ @Test
+ public void testConfigurationPrimitiveNoValue() {
+ ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance3.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ CheckService check = (CheckService) osgiHelper.getServiceObject(ref);
+ Properties props = check.getProps();
+
+ Byte b = (Byte) props.get("b");
+ Short s = (Short) props.get("s");
+ Integer i = (Integer) props.get("i");
+ Long l = (Long) props.get("l");
+ Double d = (Double) props.get("d");
+ Float f = (Float) props.get("f");
+ Character c = (Character) props.get("c");
+ Boolean bool = (Boolean) props.get("bool");
+
+ assertEquals("Check b", b, new Byte("0"));
+ assertEquals("Check s", s, new Short("0"));
+ assertEquals("Check i", i, new Integer("0"));
+ assertEquals("Check l", l, new Long("0"));
+ assertEquals("Check d", d, new Double("0"));
+ assertEquals("Check f", f, new Float("0"));
+ assertEquals("Check c", c, new Character((char) 0));
+ assertEquals("Check bool", bool, new Boolean("false"));
+
+ Integer upb = (Integer) props.get("upb");
+ Integer ups = (Integer) props.get("ups");
+ Integer upi = (Integer) props.get("upi");
+ Integer upl = (Integer) props.get("upl");
+ Integer upd = (Integer) props.get("upd");
+ Integer upf = (Integer) props.get("upf");
+ Integer upc = (Integer) props.get("upc");
+ Integer upbool = (Integer) props.get("upbool");
+
+ assertEquals("Check upb", upb, new Integer(0));
+ assertEquals("Check ups", ups, new Integer(0));
+ assertEquals("Check upi", upi, new Integer(0));
+ assertEquals("Check upl", upl, new Integer(0));
+ assertEquals("Check upd", upd, new Integer(0));
+ assertEquals("Check upf", upf, new Integer(0));
+ assertEquals("Check upc", upc, new Integer(0));
+ assertEquals("Check upbool", upbool, new Integer(0));
+
+ reconfigure(instance3);
+
+ ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance3.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ check = (CheckService) osgiHelper.getServiceObject(ref);
+ props = check.getProps();
+
+ b = (Byte) props.get("b");
+ s = (Short) props.get("s");
+ i = (Integer) props.get("i");
+ l = (Long) props.get("l");
+ d = (Double) props.get("d");
+ f = (Float) props.get("f");
+ c = (Character) props.get("c");
+ bool = (Boolean) props.get("bool");
+
+ assertEquals("2) Check b (" + b + ")", b, new Byte("2"));
+ assertEquals("2) Check s", s, new Short("2"));
+ assertEquals("2) Check i", i, new Integer("2"));
+ assertEquals("2) Check l", l, new Long("2"));
+ assertEquals("2) Check d", d, new Double("2"));
+ assertEquals("2) Check f", f, new Float("2"));
+ assertEquals("2) Check c", c, new Character('b'));
+ assertEquals("2) Check bool", bool, new Boolean("false"));
+
+ upb = (Integer) props.get("upb");
+ ups = (Integer) props.get("ups");
+ upi = (Integer) props.get("upi");
+ upl = (Integer) props.get("upl");
+ upd = (Integer) props.get("upd");
+ upf = (Integer) props.get("upf");
+ upc = (Integer) props.get("upc");
+ upbool = (Integer) props.get("upbool");
+
+ assertEquals("2) Check upb", upb, new Integer(1));
+ assertEquals("2) Check ups", ups, new Integer(1));
+ assertEquals("2) Check upi", upi, new Integer(1));
+ assertEquals("2) Check upl", upl, new Integer(1));
+ assertEquals("2) Check upd", upd, new Integer(1));
+ assertEquals("2) Check upf", upf, new Integer(1));
+ assertEquals("2) Check upc", upc, new Integer(1));
+ assertEquals("2) Check upbool", upbool, new Integer(1));
+
+ }
+
+ @Test
+ public void testConfigurationPrimitiveStringNoValue() {
+ ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance3.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ CheckService check = (CheckService) osgiHelper.getServiceObject(ref);
+ Properties props = check.getProps();
+
+ Byte b = (Byte) props.get("b");
+ Short s = (Short) props.get("s");
+ Integer i = (Integer) props.get("i");
+ Long l = (Long) props.get("l");
+ Double d = (Double) props.get("d");
+ Float f = (Float) props.get("f");
+ Character c = (Character) props.get("c");
+ Boolean bool = (Boolean) props.get("bool");
+
+ assertEquals("Check b", b, new Byte("0"));
+ assertEquals("Check s", s, new Short("0"));
+ assertEquals("Check i", i, new Integer("0"));
+ assertEquals("Check l", l, new Long("0"));
+ assertEquals("Check d", d, new Double("0"));
+ assertEquals("Check f", f, new Float("0"));
+ assertEquals("Check c", c, new Character((char) 0));
+ assertEquals("Check bool", bool, new Boolean("false"));
+
+ Integer upb = (Integer) props.get("upb");
+ Integer ups = (Integer) props.get("ups");
+ Integer upi = (Integer) props.get("upi");
+ Integer upl = (Integer) props.get("upl");
+ Integer upd = (Integer) props.get("upd");
+ Integer upf = (Integer) props.get("upf");
+ Integer upc = (Integer) props.get("upc");
+ Integer upbool = (Integer) props.get("upbool");
+
+ assertEquals("Check upb", upb, new Integer(0));
+ assertEquals("Check ups", ups, new Integer(0));
+ assertEquals("Check upi", upi, new Integer(0));
+ assertEquals("Check upl", upl, new Integer(0));
+ assertEquals("Check upd", upd, new Integer(0));
+ assertEquals("Check upf", upf, new Integer(0));
+ assertEquals("Check upc", upc, new Integer(0));
+ assertEquals("Check upbool", upbool, new Integer(0));
+
+ reconfigureString(instance3);
+
+ ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance3.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ check = (CheckService) osgiHelper.getServiceObject(ref);
+ props = check.getProps();
+
+ b = (Byte) props.get("b");
+ s = (Short) props.get("s");
+ i = (Integer) props.get("i");
+ l = (Long) props.get("l");
+ d = (Double) props.get("d");
+ f = (Float) props.get("f");
+ c = (Character) props.get("c");
+ bool = (Boolean) props.get("bool");
+
+ assertEquals("2) Check b (" + b + ")", b, new Byte("2"));
+ assertEquals("2) Check s", s, new Short("2"));
+ assertEquals("2) Check i", i, new Integer("2"));
+ assertEquals("2) Check l", l, new Long("2"));
+ assertEquals("2) Check d", d, new Double("2"));
+ assertEquals("2) Check f", f, new Float("2"));
+ assertEquals("2) Check c", c, new Character('b'));
+ assertEquals("2) Check bool", bool, new Boolean("false"));
+
+ upb = (Integer) props.get("upb");
+ ups = (Integer) props.get("ups");
+ upi = (Integer) props.get("upi");
+ upl = (Integer) props.get("upl");
+ upd = (Integer) props.get("upd");
+ upf = (Integer) props.get("upf");
+ upc = (Integer) props.get("upc");
+ upbool = (Integer) props.get("upbool");
+
+ assertEquals("2) Check upb", upb, new Integer(1));
+ assertEquals("2) Check ups", ups, new Integer(1));
+ assertEquals("2) Check upi", upi, new Integer(1));
+ assertEquals("2) Check upl", upl, new Integer(1));
+ assertEquals("2) Check upd", upd, new Integer(1));
+ assertEquals("2) Check upf", upf, new Integer(1));
+ assertEquals("2) Check upc", upc, new Integer(1));
+ assertEquals("2) Check upbool", upbool, new Integer(1));
+
+ }
+
+ @Test
+ public void testConfigurationPrimitiveArraysNoValue() {
+ ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance3.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ CheckService check = (CheckService) osgiHelper.getServiceObject(ref);
+ Properties props = check.getProps();
+
+
+ byte[] b = (byte[]) props.get("bs");
+ short[] s = (short[]) props.get("ss");
+ int[] i = (int[]) props.get("is");
+ long[] l = (long[]) props.get("ls");
+ double[] d = (double[]) props.get("ds");
+ float[] f = (float[]) props.get("fs");
+ char[] c = (char[]) props.get("cs");
+ boolean[] bool = (boolean[]) props.get("bools");
+
+ assertNull("Check b nullity", b);
+ assertNull("Check s nullity", s);
+ assertNull("Check i nullity", i);
+ assertNull("Check l nullity", l);
+ assertNull("Check d nullity", d);
+ assertNull("Check f nullity", f);
+ assertNull("Check c nullity", c);
+ assertNull("Check bool nullity", bool);
+
+ Integer upb = (Integer) props.get("upbs");
+ Integer ups = (Integer) props.get("upss");
+ Integer upi = (Integer) props.get("upis");
+ Integer upl = (Integer) props.get("upls");
+ Integer upd = (Integer) props.get("upds");
+ Integer upf = (Integer) props.get("upfs");
+ Integer upc = (Integer) props.get("upcs");
+ Integer upbool = (Integer) props.get("upbools");
+
+ assertEquals("Check upb", upb, new Integer(0));
+ assertEquals("Check ups", ups, new Integer(0));
+ assertEquals("Check upi", upi, new Integer(0));
+ assertEquals("Check upl", upl, new Integer(0));
+ assertEquals("Check upd", upd, new Integer(0));
+ assertEquals("Check upf", upf, new Integer(0));
+ assertEquals("Check upc", upc, new Integer(0));
+ assertEquals("Check upbool", upbool, new Integer(0));
+
+ reconfigure(instance3);
+
+ ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance3.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ check = (CheckService) osgiHelper.getServiceObject(ref);
+ props = check.getProps();
+
+ b = (byte[]) props.get("bs");
+ s = (short[]) props.get("ss");
+ i = (int[]) props.get("is");
+ l = (long[]) props.get("ls");
+ d = (double[]) props.get("ds");
+ f = (float[]) props.get("fs");
+ c = (char[]) props.get("cs");
+ bool = (boolean[]) props.get("bools");
+
+ assertEquals("2) Check b 0", b[0], 3);
+ assertEquals("2) Check b 1", b[1], 2);
+ assertEquals("2) Check b 2", b[2], 1);
+ assertEquals("2) Check s 0", s[0], 3);
+ assertEquals("2) Check s 1", s[1], 2);
+ assertEquals("2) Check s 2", s[2], 1);
+ assertEquals("2) Check i 0", i[0], 3);
+ assertEquals("2) Check i 1", i[1], 2);
+ assertEquals("2) Check i 2", i[2], 1);
+ assertEquals("2) Check l 0", l[0], 3);
+ assertEquals("2) Check l 1", l[1], 2);
+ assertEquals("2) Check l 2", l[2], 1);
+ assertEquals("2) Check d 0", d[0], 3, 0);
+ assertEquals("2) Check d 1", d[1], 2, 0);
+ assertEquals("2) Check d 2", d[2], 1, 0);
+ assertEquals("2) Check f 0", f[0], 3, 0);
+ assertEquals("2) Check f 1", f[1], 2, 0);
+ assertEquals("2) Check f 2", f[2], 1, 0);
+ assertEquals("2) Check c 0", c[0], 'c');
+ assertEquals("2) Check c 1", c[1], 'b');
+ assertEquals("2) Check c 2", c[2], 'a');
+ assertFalse("2) Check bool 0", bool[0]);
+ assertFalse("2) Check bool 1", bool[0]);
+ assertFalse("2) Check bool 2", bool[0]);
+
+ upb = (Integer) props.get("upbs");
+ ups = (Integer) props.get("upss");
+ upi = (Integer) props.get("upis");
+ upl = (Integer) props.get("upls");
+ upd = (Integer) props.get("upds");
+ upf = (Integer) props.get("upfs");
+ upc = (Integer) props.get("upcs");
+ upbool = (Integer) props.get("upbools");
+
+ assertEquals("2) Check upb", upb, new Integer(1));
+ assertEquals("2) Check ups", ups, new Integer(1));
+ assertEquals("2) Check upi", upi, new Integer(1));
+ assertEquals("2) Check upl", upl, new Integer(1));
+ assertEquals("2) Check upd", upd, new Integer(1));
+ assertEquals("2) Check upf", upf, new Integer(1));
+ assertEquals("2) Check upc", upc, new Integer(1));
+ assertEquals("2) Check upbool", upbool, new Integer(1));
+
+ }
+
+ @Test
+ public void testConfigurationPrimitiveArraysStringNoValue() {
+ ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance3.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ CheckService check = (CheckService) osgiHelper.getServiceObject(ref);
+ Properties props = check.getProps();
+
+ byte[] b = (byte[]) props.get("bs");
+ short[] s = (short[]) props.get("ss");
+ int[] i = (int[]) props.get("is");
+ long[] l = (long[]) props.get("ls");
+ double[] d = (double[]) props.get("ds");
+ float[] f = (float[]) props.get("fs");
+ char[] c = (char[]) props.get("cs");
+ boolean[] bool = (boolean[]) props.get("bools");
+
+ assertNull("Check b nullity", b);
+ assertNull("Check s nullity", s);
+ assertNull("Check i nullity", i);
+ assertNull("Check l nullity", l);
+ assertNull("Check d nullity", d);
+ assertNull("Check f nullity", f);
+ assertNull("Check c nullity", c);
+ assertNull("Check bool nullity", bool);
+
+ Integer upb = (Integer) props.get("upbs");
+ Integer ups = (Integer) props.get("upss");
+ Integer upi = (Integer) props.get("upis");
+ Integer upl = (Integer) props.get("upls");
+ Integer upd = (Integer) props.get("upds");
+ Integer upf = (Integer) props.get("upfs");
+ Integer upc = (Integer) props.get("upcs");
+ Integer upbool = (Integer) props.get("upbools");
+
+ assertEquals("Check upb", upb, new Integer(0));
+ assertEquals("Check ups", ups, new Integer(0));
+ assertEquals("Check upi", upi, new Integer(0));
+ assertEquals("Check upl", upl, new Integer(0));
+ assertEquals("Check upd", upd, new Integer(0));
+ assertEquals("Check upf", upf, new Integer(0));
+ assertEquals("Check upc", upc, new Integer(0));
+ assertEquals("Check upbool", upbool, new Integer(0));
+
+
+ reconfigureString(instance3);
+
+ ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance3.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ check = (CheckService) osgiHelper.getServiceObject(ref);
+ props = check.getProps();
+
+ b = (byte[]) props.get("bs");
+ s = (short[]) props.get("ss");
+ i = (int[]) props.get("is");
+ l = (long[]) props.get("ls");
+ d = (double[]) props.get("ds");
+ f = (float[]) props.get("fs");
+ c = (char[]) props.get("cs");
+ bool = (boolean[]) props.get("bools");
+
+ assertEquals("2) Check b 0", b[0], 3);
+ assertEquals("2) Check b 1", b[1], 2);
+ assertEquals("2) Check b 2", b[2], 1);
+ assertEquals("2) Check s 0", s[0], 3);
+ assertEquals("2) Check s 1", s[1], 2);
+ assertEquals("2) Check s 2", s[2], 1);
+ assertEquals("2) Check i 0", i[0], 3);
+ assertEquals("2) Check i 1", i[1], 2);
+ assertEquals("2) Check i 2", i[2], 1);
+ assertEquals("2) Check l 0", l[0], 3);
+ assertEquals("2) Check l 1", l[1], 2);
+ assertEquals("2) Check l 2", l[2], 1);
+ assertEquals("2) Check d 0", d[0], 3, 0);
+ assertEquals("2) Check d 1", d[1], 2, 0);
+ assertEquals("2) Check d 2", d[2], 1, 0);
+ assertEquals("2) Check f 0", f[0], 3, 0);
+ assertEquals("2) Check f 1", f[1], 2, 0);
+ assertEquals("2) Check f 2", f[2], 1, 0);
+ assertEquals("2) Check c 0", c[0], 'c');
+ assertEquals("2) Check c 1", c[1], 'b');
+ assertEquals("2) Check c 2", c[2], 'a');
+ assertFalse("2) Check bool 0", bool[0]);
+ assertFalse("2) Check bool 1", bool[0]);
+ assertFalse("2) Check bool 2", bool[0]);
+
+ upb = (Integer) props.get("upbs");
+ ups = (Integer) props.get("upss");
+ upi = (Integer) props.get("upis");
+ upl = (Integer) props.get("upls");
+ upd = (Integer) props.get("upds");
+ upf = (Integer) props.get("upfs");
+ upc = (Integer) props.get("upcs");
+ upbool = (Integer) props.get("upbools");
+
+ assertEquals("2) Check upb", upb, new Integer(1));
+ assertEquals("2) Check ups", ups, new Integer(1));
+ assertEquals("2) Check upi", upi, new Integer(1));
+ assertEquals("2) Check upl", upl, new Integer(1));
+ assertEquals("2) Check upd", upd, new Integer(1));
+ assertEquals("2) Check upf", upf, new Integer(1));
+ assertEquals("2) Check upc", upc, new Integer(1));
+ assertEquals("2) Check upbool", upbool, new Integer(1));
+
+ }
+
+ @Test
+ public void testConfigurationObjNoValue() {
+ ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance3.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ CheckService check = (CheckService) osgiHelper.getServiceObject(ref);
+ Properties props = check.getProps();
+
+ String s = (String) props.get("string");
+ String[] ss = (String[]) props.get("strings");
+
+ assertEquals("Check string", s, null);
+ assertEquals("Check strings", ss, null);
+
+
+ Integer upString = (Integer) props.get("upstring");
+ Integer upStrings = (Integer) props.get("upstrings");
+
+ assertEquals("Check upString", upString, new Integer(0));
+ assertEquals("Check upStrings", upStrings, new Integer(0));
+
+ reconfigure(instance3);
+
+ ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance3.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ check = (CheckService) osgiHelper.getServiceObject(ref);
+ props = check.getProps();
+
+ s = (String) props.get("string");
+ ss = (String[]) props.get("strings");
+
+ assertEquals("2) Check string", s, "bar");
+ assertEquals("2) Check strings 0", ss[0], "baz");
+ assertEquals("2) Check strings 1", ss[1], "bar");
+ assertEquals("2) Check strings 2", ss[2], "foo");
+
+ upString = (Integer) props.get("upstring");
+ upStrings = (Integer) props.get("upstrings");
+
+ assertEquals("2) Check upString", upString, new Integer(1));
+ assertEquals("2) Check upStrings", upStrings, new Integer(1));
+ }
+
+ @Test
+ public void testConfigurationObjStringNoValue() {
+ ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance3.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ CheckService check = (CheckService) osgiHelper.getServiceObject(ref);
+ Properties props = check.getProps();
+
+ String s = (String) props.get("string");
+ String[] ss = (String[]) props.get("strings");
+
+ assertEquals("Check string", s, null);
+ assertEquals("Check strings", ss, null);
+
+
+ Integer upString = (Integer) props.get("upstring");
+ Integer upStrings = (Integer) props.get("upstrings");
+
+ assertEquals("Check upString", upString, new Integer(0));
+ assertEquals("Check upStrings", upStrings, new Integer(0));
+
+ reconfigureString(instance3);
+
+ ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance3.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ check = (CheckService) osgiHelper.getServiceObject(ref);
+ props = check.getProps();
+
+ s = (String) props.get("string");
+ ss = (String[]) props.get("strings");
+
+ assertEquals("2) Check string", s, "bar");
+ assertEquals("2) Check strings 0", ss[0], "baz");
+ assertEquals("2) Check strings 1", ss[1], "bar");
+ assertEquals("2) Check strings 2", ss[2], "foo");
+
+ upString = (Integer) props.get("upstring");
+ upStrings = (Integer) props.get("upstrings");
+
+ assertEquals("2) Check upString", upString, new Integer(1));
+ assertEquals("2) Check upStrings", upStrings, new Integer(1));
+ }
+
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestPropertyModifier.java b/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestPropertyModifier.java
new file mode 100644
index 0000000..9fdf689
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestPropertyModifier.java
@@ -0,0 +1,89 @@
+package org.apache.felix.ipojo.runtime.core;
+
+import org.apache.felix.ipojo.ComponentInstance;
+import org.apache.felix.ipojo.Factory;
+import org.apache.felix.ipojo.runtime.core.services.CheckService;
+import org.apache.felix.ipojo.runtime.core.services.FooService;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.ops4j.pax.exam.Configuration;
+import org.ops4j.pax.exam.Option;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.ow2.chameleon.testing.helpers.IPOJOHelper;
+import org.ow2.chameleon.testing.helpers.OSGiHelper;
+
+import javax.inject.Inject;
+import java.util.Properties;
+
+import static org.junit.Assert.*;
+import static org.ops4j.pax.exam.CoreOptions.junitBundles;
+import static org.ops4j.pax.exam.CoreOptions.options;
+
+
+public class TestPropertyModifier extends Common {
+
+ @Test
+ public void testPropertyModifier() {
+
+ ComponentInstance ci = null;
+ Factory factory = ipojoHelper.getFactory("org.apache.felix.ipojo.runtime.core.components.PropertyModifier");
+ Properties props = new Properties();
+ props.put("cls", new String[]{FooService.class.getName()});
+ try {
+ ci = factory.createComponentInstance(props);
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ }
+
+ ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), ci.getInstanceName());
+ assertNotNull("Check ref", ref);
+
+ // Check the service property
+ // Not exposed here:
+ assertNull("Classes -0", ref.getProperty("classes"));
+
+ CheckService check = (CheckService) osgiHelper.getServiceObject(ref);
+ assertTrue(check.check());
+
+ // Property exposed now.
+ ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), ci.getInstanceName());
+ Class[] str = (Class[]) ref.getProperty("classes");
+ assertEquals("Classes size", 1, str.length);
+ assertEquals("Classes[0]", FooService.class.getName(), str[0].getName());
+
+ Properties p = check.getProps();
+ Class[] str2 = (Class[]) p.get("classes");
+ assertEquals("Classes size -2", 1, str2.length);
+ assertEquals("Classes[0] -2", FooService.class.getName(), str2[0].getName());
+
+ Properties props2 = new Properties();
+ props2.put("cls", new String[]{FooService.class.getName(), CheckService.class.getName()});
+ try {
+ ci.reconfigure(props2);
+ } catch (Exception e) {
+ fail(e.getMessage());
+ }
+
+ // Check the service property
+ ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), ci.getInstanceName());
+ assertNotNull("Check ref", ref);
+ str = (Class[]) ref.getProperty("classes");
+ assertEquals("Classes size -3", 2, str.length);
+ assertEquals("Classes[0] -3", FooService.class.getName(), str[0].getName());
+ assertEquals("Classes[1] -3", CheckService.class.getName(), str[1].getName());
+
+
+ check = (CheckService) osgiHelper.getServiceObject(ref);
+ p = check.getProps();
+ str2 = (Class[]) p.get("classes");
+ assertEquals("Classes size -4", 2, str2.length);
+ assertEquals("Classes[0] -4", FooService.class.getName(), str2[0].getName());
+ assertEquals("Classes[1] -4", CheckService.class.getName(), str2[1].getName());
+
+ ci.dispose();
+ }
+
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestSimpleProperties.java b/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestSimpleProperties.java
new file mode 100644
index 0000000..314522f
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestSimpleProperties.java
@@ -0,0 +1,265 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.ipojo.runtime.core;
+
+import org.apache.felix.ipojo.ComponentInstance;
+import org.apache.felix.ipojo.runtime.core.services.FooService;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.osgi.framework.ServiceReference;
+import org.ow2.chameleon.testing.helpers.IPOJOHelper;
+import org.ow2.chameleon.testing.helpers.OSGiHelper;
+
+import java.util.Hashtable;
+import java.util.Properties;
+
+import static junit.framework.Assert.assertEquals;
+import static org.junit.Assert.*;
+
+
+public class TestSimpleProperties extends Common {
+
+
+ ComponentInstance fooProvider1;
+ ComponentInstance fooProvider2;
+ ComponentInstance fooProvider3;
+
+
+
+ @Before
+ public void setUp() {
+ osgiHelper = new OSGiHelper(bc);
+ ipojoHelper = new IPOJOHelper(bc);
+ String type = "CONFIG-FooProviderType-Conf";
+
+ Hashtable<String, String> p1 = new Hashtable<String, String>();
+ p1.put("instance.name", "FooProvider-1");
+ fooProvider1 = ipojoHelper.createComponentInstance(type, p1);
+
+ Properties p2 = new Properties();
+ p2.put("instance.name", "FooProvider-2");
+ p2.put("int", new Integer(4));
+ p2.put("boolean", new Boolean(false));
+ p2.put("string", new String("bar"));
+ p2.put("strAProp", new String[]{"bar", "foo"});
+ p2.put("intAProp", new int[]{1, 2, 3});
+ fooProvider2 = ipojoHelper.createComponentInstance(bc.getBundle(), type, p2);
+
+ Hashtable<String, String> p3 = new Hashtable<String, String>();
+ p3.put("instance.name", "FooProvider-3");
+ fooProvider3 = ipojoHelper.createComponentInstance("CONFIG-FooProviderType-ConfNoValue", p3);
+ }
+
+ @After
+ public void tearDown() {
+ fooProvider1.dispose();
+ fooProvider2.dispose();
+ fooProvider3.dispose();
+ fooProvider1 = null;
+ fooProvider2 = null;
+ fooProvider3 = null;
+ }
+
+ @Test
+ public void testComponentTypeConfiguration() {
+ ServiceReference ref = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), fooProvider1.getInstanceName());
+ assertNotNull("Check FooService availability", ref);
+ FooService fs = (FooService) osgiHelper.getContext().getService(ref);
+ Properties toCheck = fs.fooProps();
+
+ Integer intProp = (Integer) toCheck.get("intProp");
+ Boolean boolProp = (Boolean) toCheck.get("boolProp");
+ String strProp = (String) toCheck.get("strProp");
+ String[] strAProp = (String[]) toCheck.get("strAProp");
+ int[] intAProp = (int[]) toCheck.get("intAProp");
+
+ assertEquals("Check intProp equality (1)", intProp, new Integer(2));
+ assertEquals("Check longProp equality (1)", boolProp, new Boolean(false));
+ assertEquals("Check strProp equality (1)", strProp, new String("foo"));
+ assertNotNull("Check strAProp not nullity (1)", strAProp);
+ String[] v = new String[]{"foo", "bar"};
+ for (int i = 0; i < strAProp.length; i++) {
+ if (!strAProp[i].equals(v[i])) {
+ fail("Check the strAProp Equality (1) : " + strAProp[i] + " != " + v[i]);
+ }
+ }
+ assertNotNull("Check intAProp not nullity", intAProp);
+ int[] v2 = new int[]{1, 2, 3};
+ for (int i = 0; i < intAProp.length; i++) {
+ if (intAProp[i] != v2[i]) {
+ fail("Check the intAProp Equality (1) : " + intAProp[i] + " != " + v2[i]);
+ }
+ }
+
+ // change the field value
+ assertTrue("Invoke the fs service", fs.foo());
+ toCheck = fs.fooProps();
+
+
+ // Re-check the property (change)
+ intProp = (Integer) toCheck.get("intProp");
+ boolProp = (Boolean) toCheck.get("boolProp");
+ strProp = (String) toCheck.get("strProp");
+ strAProp = (String[]) toCheck.get("strAProp");
+ intAProp = (int[]) toCheck.get("intAProp");
+
+ assertEquals("Check intProp equality (2) (" + intProp + ")", intProp, new Integer(3));
+ assertEquals("Check longProp equality (2)", boolProp, new Boolean(true));
+ assertEquals("Check strProp equality (2)", strProp, new String("bar"));
+ assertNotNull("Check strAProp not nullity (2)", strAProp);
+ v = new String[]{"foo", "bar", "baz"};
+ for (int i = 0; i < strAProp.length; i++) {
+ if (!strAProp[i].equals(v[i])) {
+ fail("Check the strAProp Equality (2)");
+ }
+ }
+ assertNotNull("Check intAProp not nullity (2)", intAProp);
+ v2 = new int[]{3, 2, 1};
+ for (int i = 0; i < intAProp.length; i++) {
+ if (intAProp[i] != v2[i]) {
+ fail("Check the intAProp Equality (2) : " + intAProp[i] + " != " + v2[i]);
+ }
+ }
+
+ fs = null;
+ osgiHelper.getContext().ungetService(ref);
+ }
+
+
+ @Test
+ public void testInstanceConfiguration() {
+ ServiceReference sr = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), "FooProvider-2");
+ assertNotNull("Check the availability of the FS service", sr);
+
+ FooService fs = (FooService) osgiHelper.getContext().getService(sr);
+ Properties toCheck = fs.fooProps();
+
+ // Check service properties
+ Integer intProp = (Integer) toCheck.get("intProp");
+ Boolean boolProp = (Boolean) toCheck.get("boolProp");
+ String strProp = (String) toCheck.get("strProp");
+ String[] strAProp = (String[]) toCheck.get("strAProp");
+ int[] intAProp = (int[]) toCheck.get("intAProp");
+
+ assertEquals("Check intProp equality", intProp, new Integer(4));
+ assertEquals("Check longProp equality", boolProp, new Boolean(false));
+ assertEquals("Check strProp equality", strProp, new String("bar"));
+ assertNotNull("Check strAProp not nullity", strAProp);
+ String[] v = new String[]{"bar", "foo"};
+ for (int i = 0; i < strAProp.length; i++) {
+ if (!strAProp[i].equals(v[i])) {
+ fail("Check the strAProp Equality");
+ }
+ }
+ assertNotNull("Check intAProp not nullity", intAProp);
+ int[] v2 = new int[]{1, 2, 3};
+ for (int i = 0; i < intAProp.length; i++) {
+ if (intAProp[i] != v2[i]) {
+ fail("Check the intAProp Equality");
+ }
+ }
+
+
+ assertTrue("invoke fs", fs.foo());
+ toCheck = fs.fooProps();
+
+ // Re-check the property (change)
+ intProp = (Integer) toCheck.get("intProp");
+ boolProp = (Boolean) toCheck.get("boolProp");
+ strProp = (String) toCheck.get("strProp");
+ strAProp = (String[]) toCheck.get("strAProp");
+ intAProp = (int[]) toCheck.get("intAProp");
+
+ assertEquals("Check intProp equality", intProp, new Integer(3));
+ assertEquals("Check longProp equality", boolProp, new Boolean(true));
+ assertEquals("Check strProp equality", strProp, new String("foo"));
+ assertNotNull("Check strAProp not nullity", strAProp);
+ v = new String[]{"foo", "bar", "baz"};
+ for (int i = 0; i < strAProp.length; i++) {
+ if (!strAProp[i].equals(v[i])) {
+ fail("Check the strAProp Equality");
+ }
+ }
+ assertNotNull("Check intAProp not nullity", intAProp);
+ v2 = new int[]{3, 2, 1};
+ for (int i = 0; i < intAProp.length; i++) {
+ if (intAProp[i] != v2[i]) {
+ fail("Check the intAProp Equality");
+ }
+ }
+
+ fs = null;
+ osgiHelper.getContext().ungetService(sr);
+ }
+
+ @Test
+ public void testNoValue() {
+ ServiceReference sr = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), "FooProvider-3");
+ assertNotNull("Check the availability of the FS service", sr);
+
+ FooService fs = (FooService) osgiHelper.getContext().getService(sr);
+ Properties toCheck = fs.fooProps();
+
+ // Check service properties
+ Integer intProp = (Integer) toCheck.get("intProp");
+ Boolean boolProp = (Boolean) toCheck.get("boolProp");
+ String strProp = (String) toCheck.get("strProp");
+ String[] strAProp = (String[]) toCheck.get("strAProp");
+ int[] intAProp = (int[]) toCheck.get("intAProp");
+
+ assertEquals("Check intProp equality", intProp, new Integer(0));
+ assertEquals("Check longProp equality", boolProp, new Boolean(false));
+ assertEquals("Check strProp equality", strProp, null);
+ assertNull("Check strAProp nullity", strAProp);
+ assertNull("Check intAProp nullity", intAProp);
+
+ assertTrue("invoke fs", fs.foo());
+ toCheck = fs.fooProps();
+
+ // Re-check the property (change)
+ intProp = (Integer) toCheck.get("intProp");
+ boolProp = (Boolean) toCheck.get("boolProp");
+ strProp = (String) toCheck.get("strProp");
+ strAProp = (String[]) toCheck.get("strAProp");
+ intAProp = (int[]) toCheck.get("intAProp");
+
+ assertEquals("Check intProp equality", intProp, new Integer(3));
+ assertEquals("Check longProp equality", boolProp, new Boolean(true));
+ assertEquals("Check strProp equality", strProp, new String("bar"));
+ assertNotNull("Check strAProp not nullity", strAProp);
+ String[] v = new String[]{"foo", "bar", "baz"};
+ for (int i = 0; i < strAProp.length; i++) {
+ if (!strAProp[i].equals(v[i])) {
+ fail("Check the strAProp Equality");
+ }
+ }
+ assertNotNull("Check intAProp not nullity", intAProp);
+ int[] v2 = new int[]{3, 2, 1};
+ for (int i = 0; i < intAProp.length; i++) {
+ if (intAProp[i] != v2[i]) {
+ fail("Check the intAProp Equality");
+ }
+ }
+
+ fs = null;
+ osgiHelper.getContext().ungetService(sr);
+ }
+
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestSuperMethodProperties.java b/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestSuperMethodProperties.java
new file mode 100644
index 0000000..9777171
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestSuperMethodProperties.java
@@ -0,0 +1,638 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.ipojo.runtime.core;
+
+import org.apache.felix.ipojo.ComponentInstance;
+import org.apache.felix.ipojo.Factory;
+import org.apache.felix.ipojo.runtime.core.services.CheckService;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.osgi.framework.ServiceReference;
+import org.ow2.chameleon.testing.helpers.IPOJOHelper;
+import org.ow2.chameleon.testing.helpers.OSGiHelper;
+
+import java.util.Properties;
+
+import static org.junit.Assert.*;
+
+
+public class TestSuperMethodProperties extends Common {
+
+
+
+ ComponentInstance instance;
+
+
+
+ @Before
+ public void setUp() {
+ osgiHelper = new OSGiHelper(bc);
+ ipojoHelper = new IPOJOHelper(bc);
+ Factory fact = ipojoHelper.getFactory("CONFIG-ParentMethodConfigurableCheckService");
+ Properties props = new Properties();
+ props.put("instance.name", "under-test");
+ props.put("b", "1");
+ props.put("s", "1");
+ props.put("i", "1");
+ props.put("l", "1");
+ props.put("d", "1");
+ props.put("f", "1");
+ props.put("c", "a");
+ props.put("bool", "true");
+ props.put("bs", "{1,2,3}");
+ props.put("ss", "{1,2,3}");
+ props.put("is", "{1,2,3}");
+ props.put("ls", "{1,2,3}");
+ props.put("ds", "{1,2,3}");
+ props.put("fs", "{1,2,3}");
+ props.put("cs", "{a,b,c}");
+ props.put("bools", "{true,true,true}");
+ props.put("string", "foo");
+ props.put("strings", "{foo, bar, baz}");
+
+ try {
+ instance = fact.createComponentInstance(props);
+ } catch (Exception e) {
+ fail("Cannot create the under-test instance : " + e.getMessage());
+ }
+
+
+ }
+
+ @After
+ public void tearDown() {
+
+ instance.dispose();
+ instance = null;
+ }
+
+ @Test
+ public void testConfigurationPrimitive() {
+ ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ CheckService check = (CheckService) osgiHelper.getServiceObject(ref);
+ Properties props = check.getProps();
+
+ Byte b = (Byte) props.get("b");
+ Short s = (Short) props.get("s");
+ Integer i = (Integer) props.get("i");
+ Long l = (Long) props.get("l");
+ Double d = (Double) props.get("d");
+ Float f = (Float) props.get("f");
+ Character c = (Character) props.get("c");
+ Boolean bool = (Boolean) props.get("bool");
+
+ assertEquals("Check b", b, new Byte("1"));
+ assertEquals("Check s", s, new Short("1"));
+ assertEquals("Check i", i, new Integer("1"));
+ assertEquals("Check l", l, new Long("1"));
+ assertEquals("Check d", d, new Double("1"));
+ assertEquals("Check f", f, new Float("1"));
+ assertEquals("Check c", c, new Character('a'));
+ assertEquals("Check bool", bool, new Boolean("true"));
+
+// Integer upb = (Integer) props.get("upb");
+// Integer ups = (Integer) props.get("ups");
+// Integer upi = (Integer) props.get("upi");
+// Integer upl = (Integer) props.get("upl");
+// Integer upd = (Integer) props.get("upd");
+// Integer upf = (Integer) props.get("upf");
+// Integer upc = (Integer) props.get("upc");
+// Integer upbool = (Integer) props.get("upbool");
+//
+// assertEquals("Check upb", upb, new Integer(1));
+// assertEquals("Check ups", ups, new Integer(1));
+// assertEquals("Check upi", upi, new Integer(1));
+// assertEquals("Check upl", upl, new Integer(1));
+// assertEquals("Check upd", upd, new Integer(1));
+// assertEquals("Check upf", upf, new Integer(1));
+// assertEquals("Check upc", upc, new Integer(1));
+// assertEquals("Check upbool", upbool, new Integer(1));
+
+ reconfigure();
+
+ ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ check = (CheckService) osgiHelper.getServiceObject(ref);
+ props = check.getProps();
+
+ b = (Byte) props.get("b");
+ s = (Short) props.get("s");
+ i = (Integer) props.get("i");
+ l = (Long) props.get("l");
+ d = (Double) props.get("d");
+ f = (Float) props.get("f");
+ c = (Character) props.get("c");
+ bool = (Boolean) props.get("bool");
+
+ assertEquals("2) Check b (" + b + ")", b, new Byte("2"));
+ assertEquals("2) Check s", s, new Short("2"));
+ assertEquals("2) Check i", i, new Integer("2"));
+ assertEquals("2) Check l", l, new Long("2"));
+ assertEquals("2) Check d", d, new Double("2"));
+ assertEquals("2) Check f", f, new Float("2"));
+ assertEquals("2) Check c", c, new Character('b'));
+ assertEquals("2) Check bool", bool, new Boolean("false"));
+
+// upb = (Integer) props.get("upb");
+// ups = (Integer) props.get("ups");
+// upi = (Integer) props.get("upi");
+// upl = (Integer) props.get("upl");
+// upd = (Integer) props.get("upd");
+// upf = (Integer) props.get("upf");
+// upc = (Integer) props.get("upc");
+// upbool = (Integer) props.get("upbool");
+//
+// assertEquals("2) Check upb", upb, new Integer(2));
+// assertEquals("2) Check ups", ups, new Integer(2));
+// assertEquals("2) Check upi", upi, new Integer(2));
+// assertEquals("2) Check upl", upl, new Integer(2));
+// assertEquals("2) Check upd", upd, new Integer(2));
+// assertEquals("2) Check upf", upf, new Integer(2));
+// assertEquals("2) Check upc", upc, new Integer(2));
+// assertEquals("2) Check upbool", upbool, new Integer(2));
+
+ }
+
+ @Test
+ public void testConfigurationPrimitiveString() {
+ ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ CheckService check = (CheckService) osgiHelper.getServiceObject(ref);
+ Properties props = check.getProps();
+
+ Byte b = (Byte) props.get("b");
+ Short s = (Short) props.get("s");
+ Integer i = (Integer) props.get("i");
+ Long l = (Long) props.get("l");
+ Double d = (Double) props.get("d");
+ Float f = (Float) props.get("f");
+ Character c = (Character) props.get("c");
+ Boolean bool = (Boolean) props.get("bool");
+
+ assertEquals("Check b", b, new Byte("1"));
+ assertEquals("Check s", s, new Short("1"));
+ assertEquals("Check i", i, new Integer("1"));
+ assertEquals("Check l", l, new Long("1"));
+ assertEquals("Check d", d, new Double("1"));
+ assertEquals("Check f", f, new Float("1"));
+ assertEquals("Check c", c, new Character('a'));
+ assertEquals("Check bool", bool, new Boolean("true"));
+
+// Integer upb = (Integer) props.get("upb");
+// Integer ups = (Integer) props.get("ups");
+// Integer upi = (Integer) props.get("upi");
+// Integer upl = (Integer) props.get("upl");
+// Integer upd = (Integer) props.get("upd");
+// Integer upf = (Integer) props.get("upf");
+// Integer upc = (Integer) props.get("upc");
+// Integer upbool = (Integer) props.get("upbool");
+//
+// assertEquals("Check upb", upb, new Integer(1));
+// assertEquals("Check ups", ups, new Integer(1));
+// assertEquals("Check upi", upi, new Integer(1));
+// assertEquals("Check upl", upl, new Integer(1));
+// assertEquals("Check upd", upd, new Integer(1));
+// assertEquals("Check upf", upf, new Integer(1));
+// assertEquals("Check upc", upc, new Integer(1));
+// assertEquals("Check upbool", upbool, new Integer(1));
+
+ reconfigureString();
+
+ ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ check = (CheckService) osgiHelper.getServiceObject(ref);
+ props = check.getProps();
+
+ b = (Byte) props.get("b");
+ s = (Short) props.get("s");
+ i = (Integer) props.get("i");
+ l = (Long) props.get("l");
+ d = (Double) props.get("d");
+ f = (Float) props.get("f");
+ c = (Character) props.get("c");
+ bool = (Boolean) props.get("bool");
+
+ assertEquals("2) Check b (" + b + ")", b, new Byte("2"));
+ assertEquals("2) Check s", s, new Short("2"));
+ assertEquals("2) Check i", i, new Integer("2"));
+ assertEquals("2) Check l", l, new Long("2"));
+ assertEquals("2) Check d", d, new Double("2"));
+ assertEquals("2) Check f", f, new Float("2"));
+ assertEquals("2) Check c", c, new Character('b'));
+ assertEquals("2) Check bool", bool, new Boolean("false"));
+
+// upb = (Integer) props.get("upb");
+// ups = (Integer) props.get("ups");
+// upi = (Integer) props.get("upi");
+// upl = (Integer) props.get("upl");
+// upd = (Integer) props.get("upd");
+// upf = (Integer) props.get("upf");
+// upc = (Integer) props.get("upc");
+// upbool = (Integer) props.get("upbool");
+//
+// assertEquals("2) Check upb", upb, new Integer(2));
+// assertEquals("2) Check ups", ups, new Integer(2));
+// assertEquals("2) Check upi", upi, new Integer(2));
+// assertEquals("2) Check upl", upl, new Integer(2));
+// assertEquals("2) Check upd", upd, new Integer(2));
+// assertEquals("2) Check upf", upf, new Integer(2));
+// assertEquals("2) Check upc", upc, new Integer(2));
+// assertEquals("2) Check upbool", upbool, new Integer(2));
+
+ }
+
+ @Test
+ public void testConfigurationPrimitiveArrays() {
+ ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ CheckService check = (CheckService) osgiHelper.getServiceObject(ref);
+ Properties props = check.getProps();
+
+ byte[] b = (byte[]) props.get("bs");
+ short[] s = (short[]) props.get("ss");
+ int[] i = (int[]) props.get("is");
+ long[] l = (long[]) props.get("ls");
+ double[] d = (double[]) props.get("ds");
+ float[] f = (float[]) props.get("fs");
+ char[] c = (char[]) props.get("cs");
+ boolean[] bool = (boolean[]) props.get("bools");
+
+ assertEquals("Check b 0", b[0], 1);
+ assertEquals("Check b 1", b[1], 2);
+ assertEquals("Check b 2", b[2], 3);
+ assertEquals("Check s 0", s[0], 1);
+ assertEquals("Check s 1", s[1], 2);
+ assertEquals("Check s 2", s[2], 3);
+ assertEquals("Check i 0", i[0], 1);
+ assertEquals("Check i 1", i[1], 2);
+ assertEquals("Check i 2", i[2], 3);
+ assertEquals("Check l 0", l[0], 1);
+ assertEquals("Check l 1", l[1], 2);
+ assertEquals("Check l 2", l[2], 3);
+ assertEquals("Check d 0", d[0], 1, 0);
+ assertEquals("Check d 1", d[1], 2, 0);
+ assertEquals("Check d 2", d[2], 3, 0);
+ assertEquals("Check f 0", f[0], 1, 0);
+ assertEquals("Check f 1", f[1], 2, 0);
+ assertEquals("Check f 2", f[2], 3, 0);
+ assertEquals("Check c 0", c[0], 'a');
+ assertEquals("Check c 1", c[1], 'b');
+ assertEquals("Check c 2", c[2], 'c');
+ assertTrue("Check bool 0", bool[0]);
+ assertTrue("Check bool 1", bool[0]);
+ assertTrue("Check bool 2", bool[0]);
+
+// Integer upb = (Integer) props.get("upbs");
+// Integer ups = (Integer) props.get("upss");
+// Integer upi = (Integer) props.get("upis");
+// Integer upl = (Integer) props.get("upls");
+// Integer upd = (Integer) props.get("upds");
+// Integer upf = (Integer) props.get("upfs");
+// Integer upc = (Integer) props.get("upcs");
+// Integer upbool = (Integer) props.get("upbools");
+//
+// assertEquals("Check upb", upb, new Integer(1));
+// assertEquals("Check ups", ups, new Integer(1));
+// assertEquals("Check upi", upi, new Integer(1));
+// assertEquals("Check upl", upl, new Integer(1));
+// assertEquals("Check upd", upd, new Integer(1));
+// assertEquals("Check upf", upf, new Integer(1));
+// assertEquals("Check upc", upc, new Integer(1));
+// assertEquals("Check upbool", upbool, new Integer(1));
+
+ reconfigure();
+
+ ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ check = (CheckService) osgiHelper.getServiceObject(ref);
+ props = check.getProps();
+
+ b = (byte[]) props.get("bs");
+ s = (short[]) props.get("ss");
+ i = (int[]) props.get("is");
+ l = (long[]) props.get("ls");
+ d = (double[]) props.get("ds");
+ f = (float[]) props.get("fs");
+ c = (char[]) props.get("cs");
+ bool = (boolean[]) props.get("bools");
+
+ assertEquals("2) Check b 0", b[0], 3);
+ assertEquals("2) Check b 1", b[1], 2);
+ assertEquals("2) Check b 2", b[2], 1);
+ assertEquals("2) Check s 0", s[0], 3);
+ assertEquals("2) Check s 1", s[1], 2);
+ assertEquals("2) Check s 2", s[2], 1);
+ assertEquals("2) Check i 0", i[0], 3);
+ assertEquals("2) Check i 1", i[1], 2);
+ assertEquals("2) Check i 2", i[2], 1);
+ assertEquals("2) Check l 0", l[0], 3);
+ assertEquals("2) Check l 1", l[1], 2);
+ assertEquals("2) Check l 2", l[2], 1);
+ assertEquals("2) Check d 0", d[0], 3, 0);
+ assertEquals("2) Check d 1", d[1], 2, 0);
+ assertEquals("2) Check d 2", d[2], 1, 0);
+ assertEquals("2) Check f 0", f[0], 3, 0);
+ assertEquals("2) Check f 1", f[1], 2, 0);
+ assertEquals("2) Check f 2", f[2], 1, 0);
+ assertEquals("2) Check c 0", c[0], 'c');
+ assertEquals("2) Check c 1", c[1], 'b');
+ assertEquals("2) Check c 2", c[2], 'a');
+ assertFalse("2) Check bool 0", bool[0]);
+ assertFalse("2) Check bool 1", bool[0]);
+ assertFalse("2) Check bool 2", bool[0]);
+
+// upb = (Integer) props.get("upbs");
+// ups = (Integer) props.get("upss");
+// upi = (Integer) props.get("upis");
+// upl = (Integer) props.get("upls");
+// upd = (Integer) props.get("upds");
+// upf = (Integer) props.get("upfs");
+// upc = (Integer) props.get("upcs");
+// upbool = (Integer) props.get("upbools");
+//
+// assertEquals("2) Check upb", upb, new Integer(2));
+// assertEquals("2) Check ups", ups, new Integer(2));
+// assertEquals("2) Check upi", upi, new Integer(2));
+// assertEquals("2) Check upl", upl, new Integer(2));
+// assertEquals("2) Check upd", upd, new Integer(2));
+// assertEquals("2) Check upf", upf, new Integer(2));
+// assertEquals("2) Check upc", upc, new Integer(2));
+// assertEquals("2) Check upbool", upbool, new Integer(2));
+
+ }
+
+ @Test
+ public void testConfigurationPrimitiveArraysString() {
+ ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ CheckService check = (CheckService) osgiHelper.getServiceObject(ref);
+ Properties props = check.getProps();
+
+ byte[] b = (byte[]) props.get("bs");
+ short[] s = (short[]) props.get("ss");
+ int[] i = (int[]) props.get("is");
+ long[] l = (long[]) props.get("ls");
+ double[] d = (double[]) props.get("ds");
+ float[] f = (float[]) props.get("fs");
+ char[] c = (char[]) props.get("cs");
+ boolean[] bool = (boolean[]) props.get("bools");
+
+ assertEquals("Check b 0", b[0], 1);
+ assertEquals("Check b 1", b[1], 2);
+ assertEquals("Check b 2", b[2], 3);
+ assertEquals("Check s 0", s[0], 1);
+ assertEquals("Check s 1", s[1], 2);
+ assertEquals("Check s 2", s[2], 3);
+ assertEquals("Check i 0", i[0], 1);
+ assertEquals("Check i 1", i[1], 2);
+ assertEquals("Check i 2", i[2], 3);
+ assertEquals("Check l 0", l[0], 1);
+ assertEquals("Check l 1", l[1], 2);
+ assertEquals("Check l 2", l[2], 3);
+ assertEquals("Check d 0", d[0], 1, 0);
+ assertEquals("Check d 1", d[1], 2, 0);
+ assertEquals("Check d 2", d[2], 3, 0);
+ assertEquals("Check f 0", f[0], 1, 0);
+ assertEquals("Check f 1", f[1], 2, 0);
+ assertEquals("Check f 2", f[2], 3, 0);
+ assertEquals("Check c 0", c[0], 'a');
+ assertEquals("Check c 1", c[1], 'b');
+ assertEquals("Check c 2", c[2], 'c');
+ assertTrue("Check bool 0", bool[0]);
+ assertTrue("Check bool 1", bool[0]);
+ assertTrue("Check bool 2", bool[0]);
+
+// Integer upb = (Integer) props.get("upbs");
+// Integer ups = (Integer) props.get("upss");
+// Integer upi = (Integer) props.get("upis");
+// Integer upl = (Integer) props.get("upls");
+// Integer upd = (Integer) props.get("upds");
+// Integer upf = (Integer) props.get("upfs");
+// Integer upc = (Integer) props.get("upcs");
+// Integer upbool = (Integer) props.get("upbools");
+//
+// assertEquals("Check upb", upb, new Integer(1));
+// assertEquals("Check ups", ups, new Integer(1));
+// assertEquals("Check upi", upi, new Integer(1));
+// assertEquals("Check upl", upl, new Integer(1));
+// assertEquals("Check upd", upd, new Integer(1));
+// assertEquals("Check upf", upf, new Integer(1));
+// assertEquals("Check upc", upc, new Integer(1));
+// assertEquals("Check upbool", upbool, new Integer(1));
+
+ reconfigureString();
+
+ ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ check = (CheckService) osgiHelper.getServiceObject(ref);
+ props = check.getProps();
+
+ b = (byte[]) props.get("bs");
+ s = (short[]) props.get("ss");
+ i = (int[]) props.get("is");
+ l = (long[]) props.get("ls");
+ d = (double[]) props.get("ds");
+ f = (float[]) props.get("fs");
+ c = (char[]) props.get("cs");
+ bool = (boolean[]) props.get("bools");
+
+ assertEquals("2) Check b 0", b[0], 3);
+ assertEquals("2) Check b 1", b[1], 2);
+ assertEquals("2) Check b 2", b[2], 1);
+ assertEquals("2) Check s 0", s[0], 3);
+ assertEquals("2) Check s 1", s[1], 2);
+ assertEquals("2) Check s 2", s[2], 1);
+ assertEquals("2) Check i 0", i[0], 3);
+ assertEquals("2) Check i 1", i[1], 2);
+ assertEquals("2) Check i 2", i[2], 1);
+ assertEquals("2) Check l 0", l[0], 3);
+ assertEquals("2) Check l 1", l[1], 2);
+ assertEquals("2) Check l 2", l[2], 1);
+ assertEquals("2) Check d 0", d[0], 3, 0);
+ assertEquals("2) Check d 1", d[1], 2, 0);
+ assertEquals("2) Check d 2", d[2], 1, 0);
+ assertEquals("2) Check f 0", f[0], 3, 0);
+ assertEquals("2) Check f 1", f[1], 2, 0);
+ assertEquals("2) Check f 2", f[2], 1, 0);
+ assertEquals("2) Check c 0", c[0], 'c');
+ assertEquals("2) Check c 1", c[1], 'b');
+ assertEquals("2) Check c 2", c[2], 'a');
+ assertFalse("2) Check bool 0", bool[0]);
+ assertFalse("2) Check bool 1", bool[0]);
+ assertFalse("2) Check bool 2", bool[0]);
+
+// upb = (Integer) props.get("upbs");
+// ups = (Integer) props.get("upss");
+// upi = (Integer) props.get("upis");
+// upl = (Integer) props.get("upls");
+// upd = (Integer) props.get("upds");
+// upf = (Integer) props.get("upfs");
+// upc = (Integer) props.get("upcs");
+// upbool = (Integer) props.get("upbools");
+//
+// assertEquals("2) Check upb", upb, new Integer(2));
+// assertEquals("2) Check ups", ups, new Integer(2));
+// assertEquals("2) Check upi", upi, new Integer(2));
+// assertEquals("2) Check upl", upl, new Integer(2));
+// assertEquals("2) Check upd", upd, new Integer(2));
+// assertEquals("2) Check upf", upf, new Integer(2));
+// assertEquals("2) Check upc", upc, new Integer(2));
+// assertEquals("2) Check upbool", upbool, new Integer(2));
+
+ }
+
+ @Test
+ public void testConfigurationObj() {
+ ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ CheckService check = (CheckService) osgiHelper.getServiceObject(ref);
+ Properties props = check.getProps();
+
+ String s = (String) props.get("string");
+ String[] ss = (String[]) props.get("strings");
+
+ assertEquals("Check string", s, "foo");
+ assertEquals("Check strings 0", ss[0], "foo");
+ assertEquals("Check strings 1", ss[1], "bar");
+ assertEquals("Check strings 2", ss[2], "baz");
+
+// Integer upString = (Integer) props.get("upstring");
+// Integer upStrings = (Integer) props.get("upstrings");
+//
+// assertEquals("Check upString", upString, new Integer(1));
+// assertEquals("Check upStrings", upStrings, new Integer(1));
+
+ reconfigure();
+
+ ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ check = (CheckService) osgiHelper.getServiceObject(ref);
+ props = check.getProps();
+
+ s = (String) props.get("string");
+ ss = (String[]) props.get("strings");
+
+ assertEquals("2) Check string", s, "bar");
+ assertEquals("2) Check strings 0", ss[0], "baz");
+ assertEquals("2) Check strings 1", ss[1], "bar");
+ assertEquals("2) Check strings 2", ss[2], "foo");
+
+// upString = (Integer) props.get("upstring");
+// upStrings = (Integer) props.get("upstrings");
+//
+// assertEquals("2) Check upString", upString, new Integer(2));
+// assertEquals("2) Check upStrings", upStrings, new Integer(2));
+ }
+
+ @Test
+ public void testConfigurationObjString() {
+ ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ CheckService check = (CheckService) osgiHelper.getServiceObject(ref);
+ Properties props = check.getProps();
+
+ String s = (String) props.get("string");
+ String[] ss = (String[]) props.get("strings");
+
+ assertEquals("Check string", s, "foo");
+ assertEquals("Check strings 0", ss[0], "foo");
+ assertEquals("Check strings 1", ss[1], "bar");
+ assertEquals("Check strings 2", ss[2], "baz");
+
+// Integer upString = (Integer) props.get("upstring");
+// Integer upStrings = (Integer) props.get("upstrings");
+//
+// assertEquals("Check upString", upString, new Integer(1));
+// assertEquals("Check upStrings", upStrings, new Integer(1));
+
+ reconfigureString();
+
+ ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName());
+ assertNotNull("Test check service availability", ref);
+ check = (CheckService) osgiHelper.getServiceObject(ref);
+ props = check.getProps();
+
+ s = (String) props.get("string");
+ ss = (String[]) props.get("strings");
+
+ assertEquals("2) Check string", s, "bar");
+ assertEquals("2) Check strings 0", ss[0], "baz");
+ assertEquals("2) Check strings 1", ss[1], "bar");
+ assertEquals("2) Check strings 2", ss[2], "foo");
+
+// upString = (Integer) props.get("upstring");
+// upStrings = (Integer) props.get("upstrings");
+//
+// assertEquals("2) Check upString", upString, new Integer(2));
+// assertEquals("2) Check upStrings", upStrings, new Integer(2));
+ }
+
+ private void reconfigure() {
+ Properties props2 = new Properties();
+ props2.put("instance.name", "under-test");
+ props2.put("b", new Byte("2"));
+ props2.put("s", new Short("2"));
+ props2.put("i", new Integer("2"));
+ props2.put("l", new Long("2"));
+ props2.put("d", new Double("2"));
+ props2.put("f", new Float("2"));
+ props2.put("c", new Character('b'));
+ props2.put("bool", new Boolean(false));
+ props2.put("bs", new byte[]{(byte) 3, (byte) 2, (byte) 1});
+ props2.put("ss", new short[]{(short) 3, (short) 2, (short) 1});
+ props2.put("is", new int[]{3, 2, 1});
+ props2.put("ls", new long[]{3, 2, 1});
+ props2.put("ds", new double[]{3, 2, 1});
+ props2.put("fs", new float[]{3, 2, 1});
+ props2.put("cs", new char[]{'c', 'b', 'a'});
+ props2.put("bools", new boolean[]{false, false, false});
+ props2.put("string", "bar");
+ props2.put("strings", new String[]{"baz", "bar", "foo"});
+
+ instance.reconfigure(props2);
+ }
+
+ private void reconfigureString() {
+ Properties props2 = new Properties();
+ props2.put("instance.name", "under-test");
+ props2.put("b", "2");
+ props2.put("s", "2");
+ props2.put("i", "2");
+ props2.put("l", "2");
+ props2.put("d", "2");
+ props2.put("f", "2");
+ props2.put("c", "b");
+ props2.put("bool", "false");
+ props2.put("bs", "{3, 2,1}");
+ props2.put("ss", "{3, 2,1}");
+ props2.put("is", "{3, 2,1}");
+ props2.put("ls", "{3, 2,1}");
+ props2.put("ds", "{3, 2,1}");
+ props2.put("fs", "{3, 2,1}");
+ props2.put("cs", "{c, b , a}");
+ props2.put("bools", "{false,false,false}");
+ props2.put("string", "bar");
+ props2.put("strings", "{baz, bar, foo}");
+
+ instance.reconfigure(props2);
+ }
+
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestUpdatedMethod.java b/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestUpdatedMethod.java
new file mode 100644
index 0000000..b8a9351
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestUpdatedMethod.java
@@ -0,0 +1,224 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.ipojo.runtime.core;
+
+import org.apache.felix.ipojo.ComponentInstance;
+import org.apache.felix.ipojo.runtime.core.services.FooService;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.osgi.framework.ServiceReference;
+import org.ow2.chameleon.testing.helpers.IPOJOHelper;
+import org.ow2.chameleon.testing.helpers.OSGiHelper;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+import java.util.Properties;
+
+import static org.junit.Assert.*;
+
+
+public class TestUpdatedMethod extends Common {
+
+
+
+ ComponentInstance fooProvider1;
+ ComponentInstance fooProvider2;
+ ComponentInstance fooProvider3;
+
+
+
+ @Before
+ public void setUp() {
+ osgiHelper = new OSGiHelper(bc);
+ ipojoHelper = new IPOJOHelper(bc);
+ String type = "CONFIG-FooProviderType-ConfUpdated";
+
+ Hashtable<String, String> p1 = new Hashtable<String, String>();
+ p1.put("instance.name", "FooProvider-1");
+ fooProvider1 = ipojoHelper.createComponentInstance(type, p1);
+
+ Properties p2 = new Properties();
+ p2.put("instance.name", "FooProvider-2");
+ p2.put("int", new Integer(4));
+ p2.put("boolean", new Boolean(false));
+ p2.put("string", new String("bar"));
+ p2.put("strAProp", new String[]{"bar", "foo"});
+ p2.put("intAProp", new int[]{1, 2, 3});
+ fooProvider2 = ipojoHelper.createComponentInstance(bc.getBundle(), type, p2);
+
+ Hashtable<String, String> p3 = new Hashtable<String, String>();
+ p3.put("instance.name", "FooProvider-3");
+ fooProvider3 = ipojoHelper.createComponentInstance("CONFIG-FooProviderType-ConfNoValueUpdated", p3);
+ }
+
+ @After
+ public void tearDown() {
+
+ fooProvider1.dispose();
+ fooProvider2.dispose();
+ fooProvider3.dispose();
+ fooProvider1 = null;
+ fooProvider2 = null;
+ fooProvider3 = null;
+ }
+
+ @Test
+ public void testComponentTypeConfiguration() {
+ ServiceReference ref = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), fooProvider1.getInstanceName());
+ assertNotNull("Check FooService availability", ref);
+ FooService fs = (FooService) osgiHelper.getServiceObject(ref);
+ Properties toCheck = fs.fooProps();
+
+ Integer intProp = (Integer) toCheck.get("intProp");
+ Boolean boolProp = (Boolean) toCheck.get("boolProp");
+ String strProp = (String) toCheck.get("strProp");
+ String[] strAProp = (String[]) toCheck.get("strAProp");
+ int[] intAProp = (int[]) toCheck.get("intAProp");
+
+ // Check updated
+ Integer updated = (Integer) toCheck.get("updated");
+ Dictionary dict = (Dictionary) toCheck.get("lastupdated");
+
+ assertEquals("Check intProp equality (1)", intProp, new Integer(2));
+ assertEquals("Check longProp equality (1)", boolProp, new Boolean(false));
+ assertEquals("Check strProp equality (1)", strProp, new String("foo"));
+ assertNotNull("Check strAProp not nullity (1)", strAProp);
+ String[] v = new String[]{"foo", "bar"};
+ for (int i = 0; i < strAProp.length; i++) {
+ if (!strAProp[i].equals(v[i])) {
+ fail("Check the strAProp Equality (1) : " + strAProp[i] + " != " + v[i]);
+ }
+ }
+ assertNotNull("Check intAProp not nullity", intAProp);
+ int[] v2 = new int[]{1, 2, 3};
+ for (int i = 0; i < intAProp.length; i++) {
+ if (intAProp[i] != v2[i]) {
+ fail("Check the intAProp Equality (1) : " + intAProp[i] + " != " + v2[i]);
+ }
+ }
+
+ assertEquals("updated count ", 1, updated.intValue());
+ assertEquals("Last updated", 5, dict.size());
+
+ // change the field value
+ assertTrue("Invoke the fs service", fs.foo());
+ toCheck = fs.fooProps();
+
+
+ // Re-check the property (change)
+ intProp = (Integer) toCheck.get("intProp");
+ boolProp = (Boolean) toCheck.get("boolProp");
+ strProp = (String) toCheck.get("strProp");
+ strAProp = (String[]) toCheck.get("strAProp");
+ intAProp = (int[]) toCheck.get("intAProp");
+
+ // Check updated
+ updated = (Integer) toCheck.get("updated");
+ dict = (Dictionary) toCheck.get("lastupdated");
+
+ assertEquals("Check intProp equality (2) (" + intProp + ")", intProp, new Integer(3));
+ assertEquals("Check longProp equality (2)", boolProp, new Boolean(true));
+ assertEquals("Check strProp equality (2)", strProp, new String("bar"));
+ assertNotNull("Check strAProp not nullity (2)", strAProp);
+ v = new String[]{"foo", "bar", "baz"};
+ for (int i = 0; i < strAProp.length; i++) {
+ if (!strAProp[i].equals(v[i])) {
+ fail("Check the strAProp Equality (2)");
+ }
+ }
+ assertNotNull("Check intAProp not nullity (2)", intAProp);
+ v2 = new int[]{3, 2, 1};
+ for (int i = 0; i < intAProp.length; i++) {
+ if (intAProp[i] != v2[i]) {
+ fail("Check the intAProp Equality (2) : " + intAProp[i] + " != " + v2[i]);
+ }
+ }
+
+ // This does not reconfigure...
+ assertEquals("updated count -2 ", 1, updated.intValue());
+ assertEquals("Last update - 2", 5, dict.size());
+
+ fs = null;
+ }
+
+ @Test
+ public void testNoValue() {
+ ServiceReference sr = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), "FooProvider-3");
+ assertNotNull("Check the availability of the FS service", sr);
+
+ FooService fs = (FooService) osgiHelper.getServiceObject(sr);
+ Properties toCheck = fs.fooProps();
+
+ // Check service properties
+ Integer intProp = (Integer) toCheck.get("intProp");
+ Boolean boolProp = (Boolean) toCheck.get("boolProp");
+ String strProp = (String) toCheck.get("strProp");
+ String[] strAProp = (String[]) toCheck.get("strAProp");
+ int[] intAProp = (int[]) toCheck.get("intAProp");
+
+ // Check updated
+ Integer updated = (Integer) toCheck.get("updated");
+ Dictionary dict = (Dictionary) toCheck.get("lastupdated");
+
+ assertEquals("Check intProp equality", intProp, new Integer(0));
+ assertEquals("Check longProp equality", boolProp, new Boolean(false));
+ assertEquals("Check strProp equality", strProp, null);
+ assertNull("Check strAProp nullity", strAProp);
+ assertNull("Check intAProp nullity", intAProp);
+
+ assertEquals("updated count ", 1, updated.intValue());
+ assertEquals("Last update", 0, dict.size());
+
+ assertTrue("invoke fs", fs.foo());
+ toCheck = fs.fooProps();
+
+ // Re-check the property (change)
+ intProp = (Integer) toCheck.get("intProp");
+ boolProp = (Boolean) toCheck.get("boolProp");
+ strProp = (String) toCheck.get("strProp");
+ strAProp = (String[]) toCheck.get("strAProp");
+ intAProp = (int[]) toCheck.get("intAProp");
+
+ updated = (Integer) toCheck.get("updated");
+ dict = (Dictionary) toCheck.get("lastupdated");
+
+ assertEquals("Check intProp equality", intProp, new Integer(3));
+ assertEquals("Check longProp equality", boolProp, new Boolean(true));
+ assertEquals("Check strProp equality", strProp, new String("bar"));
+ assertNotNull("Check strAProp not nullity", strAProp);
+ String[] v = new String[]{"foo", "bar", "baz"};
+ for (int i = 0; i < strAProp.length; i++) {
+ if (!strAProp[i].equals(v[i])) {
+ fail("Check the strAProp Equality");
+ }
+ }
+ assertNotNull("Check intAProp not nullity", intAProp);
+ int[] v2 = new int[]{3, 2, 1};
+ for (int i = 0; i < intAProp.length; i++) {
+ if (intAProp[i] != v2[i]) {
+ fail("Check the intAProp Equality");
+ }
+ }
+
+ fs = null;
+ }
+
+
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestUpdatedMethodAndManagedService.java b/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestUpdatedMethodAndManagedService.java
new file mode 100644
index 0000000..7840fc8
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestUpdatedMethodAndManagedService.java
@@ -0,0 +1,349 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.ipojo.runtime.core;
+
+import org.apache.felix.ipojo.ComponentInstance;
+import org.apache.felix.ipojo.runtime.core.services.FooService;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.cm.ConfigurationException;
+import org.osgi.service.cm.ManagedService;
+import org.ow2.chameleon.testing.helpers.IPOJOHelper;
+import org.ow2.chameleon.testing.helpers.OSGiHelper;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+import java.util.Properties;
+
+import static junit.framework.Assert.*;
+
+
+public class TestUpdatedMethodAndManagedService extends Common {
+
+
+
+ /**
+ * Instance where the ManagedServicePID is provided by the component type.
+ */
+ ComponentInstance instance1;
+ /**
+ * Instance where the ManagedServicePID is provided by the instance.
+ */
+ ComponentInstance instance2;
+
+ /**
+ * Instance without configuration.
+ */
+ ComponentInstance instance3;
+
+
+
+ @Before
+ public void setUp() {
+ osgiHelper = new OSGiHelper(bc);
+ ipojoHelper = new IPOJOHelper(bc);
+ String type = "CONFIG-FooProviderType-4Updated";
+ Hashtable<String, String> p = new Hashtable<String, String>();
+ p.put("instance.name", "instance");
+ p.put("foo", "foo");
+ p.put("bar", "2");
+ p.put("baz", "baz");
+ instance1 = ipojoHelper.createComponentInstance(type, p);
+ assertEquals("instance1 created", ComponentInstance.VALID, instance1.getState());
+
+ type = "CONFIG-FooProviderType-3Updated";
+ Hashtable<String, String> p1 = new Hashtable<String, String>();
+ p1.put("instance.name", "instance-2");
+ p1.put("foo", "foo");
+ p1.put("bar", "2");
+ p1.put("baz", "baz");
+ p1.put("managed.service.pid", "instance");
+ instance2 = ipojoHelper.createComponentInstance(type, p1);
+
+ type = "CONFIG-FooProviderType-3Updated";
+ Hashtable<String, String> p2 = new Hashtable<String, String>();
+ p2.put("instance.name", "instance-3");
+ p2.put("managed.service.pid", "instance-3");
+ instance3 = ipojoHelper.createComponentInstance(type, p2);
+ }
+
+
+ @After
+ public void tearDown() {
+
+ instance1.dispose();
+ instance2.dispose();
+ instance3.dispose();
+ instance1 = null;
+ instance2 = null;
+ instance3 = null;
+ }
+
+ @Test
+ public void testStaticInstance1() {
+ ServiceReference fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance1.getInstanceName());
+ assertNotNull("Check FS availability", fooRef);
+ String fooP = (String) fooRef.getProperty("foo");
+ Integer barP = (Integer) fooRef.getProperty("bar");
+ String bazP = (String) fooRef.getProperty("baz");
+ assertEquals("Check foo equality -1", fooP, "foo");
+ assertEquals("Check bar equality -1", barP, new Integer(2));
+ assertEquals("Check baz equality -1", bazP, "baz");
+
+ ServiceReference msRef = osgiHelper.getServiceReferenceByPID(ManagedService.class.getName(),
+ "FooProvider-3");
+ assertNotNull("Check ManagedServiceFactory availability", msRef);
+
+ // Configuration of baz
+ Properties conf = new Properties();
+ conf.put("baz", "zab");
+ conf.put("bar", new Integer(2));
+ conf.put("foo", "foo");
+ ManagedService ms = (ManagedService) osgiHelper.getServiceObject(msRef);
+ try {
+ ms.updated(conf);
+ } catch (ConfigurationException e) {
+ fail("Configuration Exception : " + e);
+ }
+
+ // Re-check props
+ fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance1.getInstanceName());
+ fooP = (String) fooRef.getProperty("foo");
+ barP = (Integer) fooRef.getProperty("bar");
+ bazP = (String) fooRef.getProperty("baz");
+ assertEquals("Check foo equality -2", fooP, "foo");
+ assertEquals("Check bar equality -2", barP, new Integer(2));
+ assertEquals("Check baz equality -2", bazP, "zab");
+
+ // Get Service
+ FooService fs = (FooService) osgiHelper.getServiceObject(fooRef);
+ Integer updated = (Integer) fs.fooProps().get("updated");
+ Dictionary dict = (Dictionary) fs.fooProps().get("lastupdated");
+
+ assertEquals("Check updated", 1, updated.intValue());
+ assertEquals("Check last updated", 3, dict.size());
+
+ }
+
+ @Test
+ public void testStaticInstance2() {
+ ServiceReference fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance2.getInstanceName());
+ assertNotNull("Check FS availability", fooRef);
+ String fooP = (String) fooRef.getProperty("foo");
+ Integer barP = (Integer) fooRef.getProperty("bar");
+ String bazP = (String) fooRef.getProperty("baz");
+ assertEquals("Check foo equality -1", fooP, "foo");
+ assertEquals("Check bar equality -1", barP, new Integer(2));
+ assertEquals("Check baz equality -1", bazP, "baz");
+
+ ServiceReference msRef = osgiHelper.getServiceReferenceByPID(ManagedService.class.getName(),
+ "instance");
+ assertNotNull("Check ManagedService availability", msRef);
+
+
+ // Configuration of baz
+ Properties conf = new Properties();
+ conf.put("baz", "zab");
+ conf.put("bar", new Integer(2));
+ conf.put("foo", "foo");
+ ManagedService ms = (ManagedService) osgiHelper.getServiceObject(msRef);
+ try {
+ ms.updated(conf);
+ } catch (ConfigurationException e) {
+ fail("Configuration Exception : " + e);
+ }
+
+ // Recheck props
+ fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance2.getInstanceName());
+ fooP = (String) fooRef.getProperty("foo");
+ barP = (Integer) fooRef.getProperty("bar");
+ bazP = (String) fooRef.getProperty("baz");
+ assertEquals("Check foo equality -2", fooP, "foo");
+ assertEquals("Check bar equality -2", barP, new Integer(2));
+ assertEquals("Check baz equality -2", bazP, "zab");
+
+ // Get Service
+ FooService fs = (FooService) osgiHelper.getServiceObject(fooRef);
+ Integer updated = (Integer) fs.fooProps().get("updated");
+ Dictionary dict = (Dictionary) fs.fooProps().get("lastupdated");
+
+ assertEquals("Check updated", 1, updated.intValue());
+ assertEquals("Check last updated", 3, dict.size());
+
+ conf.put("baz", "zab2");
+ conf.put("foo", "oof2");
+ conf.put("bar", new Integer(0));
+ ms = (ManagedService) osgiHelper.getServiceObject(msRef);
+ try {
+ ms.updated(conf);
+ } catch (ConfigurationException e) {
+ fail("Configuration Exception : " + e);
+ }
+
+ updated = (Integer) fs.fooProps().get("updated");
+ dict = (Dictionary) fs.fooProps().get("lastupdated");
+
+ assertEquals("Check updated -2", 2, updated.intValue());
+ assertEquals("Check last updated", 3, dict.size());
+ }
+
+ @Test
+ public void testDynamicInstance1() {
+ ServiceReference fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance1.getInstanceName());
+ assertNotNull("Check FS availability", fooRef);
+
+ String fooP = (String) fooRef.getProperty("foo");
+ Integer barP = (Integer) fooRef.getProperty("bar");
+ String bazP = (String) fooRef.getProperty("baz");
+
+ assertEquals("Check foo equality", fooP, "foo");
+ assertEquals("Check bar equality", barP, new Integer(2));
+ assertEquals("Check baz equality", bazP, "baz");
+
+ ServiceReference msRef = osgiHelper.getServiceReferenceByPID(ManagedService.class.getName(),
+ "FooProvider-3");
+ assertNotNull("Check ManagedServiceFactory availability", msRef);
+
+ // Configuration of baz
+ Properties conf = new Properties();
+ conf.put("baz", "zab");
+ conf.put("foo", "oof");
+ conf.put("bar", new Integer(0));
+ ManagedService ms = (ManagedService) osgiHelper.getServiceObject(msRef);
+ try {
+ ms.updated(conf);
+ } catch (ConfigurationException e) {
+ fail("Configuration Exception : " + e);
+ }
+
+ // Re-check props
+ fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance1.getInstanceName());
+ fooP = (String) fooRef.getProperty("foo");
+ barP = (Integer) fooRef.getProperty("bar");
+ bazP = (String) fooRef.getProperty("baz");
+
+ assertEquals("Check foo equality", fooP, "oof");
+ assertEquals("Check bar equality", barP, new Integer(0));
+ assertEquals("Check baz equality", bazP, "zab");
+
+ // Check field value
+ FooService fs = (FooService) osgiHelper.getServiceObject(fooRef);
+ Properties p = fs.fooProps();
+ fooP = (String) p.get("foo");
+ barP = (Integer) p.get("bar");
+
+ assertEquals("Check foo field equality", fooP, "oof");
+ assertEquals("Check bar field equality", barP, new Integer(0));
+
+ Integer updated = (Integer) fs.fooProps().get("updated");
+ Dictionary dict = (Dictionary) fs.fooProps().get("lastupdated");
+
+ assertEquals("Check updated -1", 1, updated.intValue());
+ assertEquals("Check last updated", 3, dict.size());
+
+ conf.put("baz", "zab2");
+ conf.put("foo", "oof2");
+ conf.put("bar", new Integer(0));
+ ms = (ManagedService) osgiHelper.getServiceObject(msRef);
+ try {
+ ms.updated(conf);
+ } catch (ConfigurationException e) {
+ fail("Configuration Exception : " + e);
+ }
+
+ updated = (Integer) fs.fooProps().get("updated");
+ dict = (Dictionary) fs.fooProps().get("lastupdated");
+
+ assertEquals("Check updated -2", 2, updated.intValue());
+ assertEquals("Check last updated", 3, dict.size());
+ }
+
+ @Test
+ public void testDynamicInstance2() {
+ ServiceReference fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance2.getInstanceName());
+ assertNotNull("Check FS availability", fooRef);
+
+ String fooP = (String) fooRef.getProperty("foo");
+ Integer barP = (Integer) fooRef.getProperty("bar");
+ String bazP = (String) fooRef.getProperty("baz");
+
+ assertEquals("Check foo equality", fooP, "foo");
+ assertEquals("Check bar equality", barP, new Integer(2));
+ assertEquals("Check baz equality", bazP, "baz");
+
+ ServiceReference msRef = osgiHelper.getServiceReferenceByPID(ManagedService.class.getName(), "instance");
+ assertNotNull("Check ManagedServiceFactory availability", msRef);
+
+ // Configuration of baz
+ Properties conf = new Properties();
+ conf.put("baz", "zab");
+ conf.put("foo", "oof");
+ conf.put("bar", new Integer(0));
+ ManagedService ms = (ManagedService) osgiHelper.getServiceObject(msRef);
+ try {
+ ms.updated(conf);
+ } catch (ConfigurationException e) {
+ fail("Configuration Exception : " + e);
+ }
+
+ // Recheck props
+ fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance2.getInstanceName());
+ fooP = (String) fooRef.getProperty("foo");
+ barP = (Integer) fooRef.getProperty("bar");
+ bazP = (String) fooRef.getProperty("baz");
+
+ assertEquals("Check foo equality", fooP, "oof");
+ assertEquals("Check bar equality", barP, new Integer(0));
+ assertEquals("Check baz equality", bazP, "zab");
+
+ // Check field value
+ FooService fs = (FooService) osgiHelper.getServiceObject(fooRef);
+ Properties p = fs.fooProps();
+ fooP = (String) p.get("foo");
+ barP = (Integer) p.get("bar");
+
+ assertEquals("Check foo field equality", fooP, "oof");
+ assertEquals("Check bar field equality", barP, new Integer(0));
+
+ Integer updated = (Integer) fs.fooProps().get("updated");
+ Dictionary dict = (Dictionary) fs.fooProps().get("lastupdated");
+
+ assertEquals("Check updated", 1, updated.intValue());
+ assertEquals("Check last updated", 3, dict.size());
+
+ conf.put("baz", "zab2");
+ conf.put("foo", "oof2");
+ conf.put("bar", new Integer(0));
+ ms = (ManagedService) osgiHelper.getServiceObject(msRef);
+ try {
+ ms.updated(conf);
+ } catch (ConfigurationException e) {
+ fail("Configuration Exception : " + e);
+ }
+
+ updated = (Integer) fs.fooProps().get("updated");
+ dict = (Dictionary) fs.fooProps().get("lastupdated");
+
+ assertEquals("Check updated -2", 2, updated.intValue());
+ assertEquals("Check last updated", 3, dict.size());
+
+ }
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestUpdatedMethodAndManagedServiceFactory.java b/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestUpdatedMethodAndManagedServiceFactory.java
new file mode 100644
index 0000000..d746bcf
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestUpdatedMethodAndManagedServiceFactory.java
@@ -0,0 +1,330 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.ipojo.runtime.core;
+
+import org.apache.felix.ipojo.ComponentInstance;
+import org.apache.felix.ipojo.runtime.core.services.FooService;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.cm.ConfigurationException;
+import org.osgi.service.cm.ManagedServiceFactory;
+import org.ow2.chameleon.testing.helpers.IPOJOHelper;
+import org.ow2.chameleon.testing.helpers.OSGiHelper;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+import java.util.Properties;
+
+import static junit.framework.Assert.*;
+
+
+public class TestUpdatedMethodAndManagedServiceFactory extends Common {
+
+
+
+ ComponentInstance instance, instance2;
+
+
+
+ @Before
+ public void setUp() {
+ osgiHelper = new OSGiHelper(bc);
+ ipojoHelper = new IPOJOHelper(bc);
+ String type = "CONFIG-FooProviderType-3Updated";
+
+ Hashtable<String, String> p1 = new Hashtable<String, String>();
+ p1.put("instance.name", "instance");
+ p1.put("foo", "foo");
+ p1.put("bar", "2");
+ p1.put("baz", "baz");
+ instance = ipojoHelper.createComponentInstance(type, p1);
+
+ Hashtable<String, String> p2 = new Hashtable<String, String>();
+ p2.put("instance.name", "instance2");
+
+ instance2 = ipojoHelper.createComponentInstance(type, p2);
+ }
+
+ @After
+ public void tearDown() {
+
+ instance.dispose();
+ instance2.dispose();
+ instance2 = null;
+ instance = null;
+ }
+
+ @Test
+ public void testStatic() {
+
+ ServiceReference fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance.getInstanceName());
+ assertNotNull("Check FS availability", fooRef);
+ String fooP = (String) fooRef.getProperty("foo");
+ Integer barP = (Integer) fooRef.getProperty("bar");
+ String bazP = (String) fooRef.getProperty("baz");
+ assertEquals("Check foo equality -1", fooP, "foo");
+ assertEquals("Check bar equality -1", barP, new Integer(2));
+ assertEquals("Check baz equality -1", bazP, "baz");
+
+ ServiceReference msRef = ipojoHelper.getServiceReferenceByName(ManagedServiceFactory.class.getName(), instance.getFactory().getName());
+ assertNotNull("Check ManagedServiceFactory availability", msRef);
+
+
+ // Configuration of baz
+ Properties conf = new Properties();
+ conf.put("baz", "zab");
+ conf.put("bar", new Integer(2));
+ conf.put("foo", "foo");
+ ManagedServiceFactory ms = (ManagedServiceFactory) osgiHelper.getServiceObject(msRef);
+ try {
+ ms.updated(instance.getInstanceName(), conf);
+ } catch (ConfigurationException e) {
+ fail("Configuration Exception : " + e);
+ }
+
+ // Recheck props
+ fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance.getInstanceName());
+ fooP = (String) fooRef.getProperty("foo");
+ barP = (Integer) fooRef.getProperty("bar");
+ bazP = (String) fooRef.getProperty("baz");
+ assertEquals("Check foo equality -2", fooP, "foo");
+ assertEquals("Check bar equality -2", barP, new Integer(2));
+ assertEquals("Check baz equality -2", bazP, "zab");
+
+ // Get Service
+ FooService fs = (FooService) osgiHelper.getServiceObject(fooRef);
+ Integer updated = (Integer) fs.fooProps().get("updated");
+ Dictionary dict = (Dictionary) fs.fooProps().get("lastupdated");
+
+ assertEquals("Check updated", 1, updated.intValue());
+ System.out.println("Dictionary : " + dict);
+ assertEquals("Check last updated", 3, dict.size()); // foo bar and baz as a service prooperties.
+ }
+
+ @Test
+ public void testStaticNoValue() {
+ ServiceReference fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance2.getInstanceName());
+ assertNotNull("Check FS availability", fooRef);
+ Object fooP = fooRef.getProperty("foo");
+ Object barP = fooRef.getProperty("bar");
+ Object bazP = fooRef.getProperty("baz");
+ assertEquals("Check foo equality -1", fooP, null);
+ assertEquals("Check bar equality -1", barP, null);
+ assertEquals("Check baz equality -1", bazP, null);
+
+ ServiceReference msRef = ipojoHelper.getServiceReferenceByName(ManagedServiceFactory.class.getName(), instance2.getFactory().getName());
+ assertNotNull("Check ManagedServiceFactory availability", msRef);
+
+
+ // Configuration of baz
+ Properties conf = new Properties();
+ conf.put("baz", "zab");
+ conf.put("bar", new Integer(2));
+ conf.put("foo", "foo");
+ ManagedServiceFactory ms = (ManagedServiceFactory) osgiHelper.getServiceObject(msRef);
+ try {
+ ms.updated(instance2.getInstanceName(), conf);
+ } catch (ConfigurationException e) {
+ fail("Configuration Exception : " + e);
+ }
+
+ // Recheck props
+ fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance2.getInstanceName());
+ fooP = (String) fooRef.getProperty("foo");
+ barP = (Integer) fooRef.getProperty("bar");
+ bazP = (String) fooRef.getProperty("baz");
+ assertEquals("Check foo equality -2", fooP, "foo");
+ assertEquals("Check bar equality -2", barP, new Integer(2));
+ assertEquals("Check baz equality -2", bazP, "zab");
+
+ // Get Service
+ FooService fs = (FooService) osgiHelper.getServiceObject(fooRef);
+ Integer updated = (Integer) fs.fooProps().get("updated");
+ Dictionary dict = (Dictionary) fs.fooProps().get("lastupdated");
+
+ assertEquals("Check updated", 1, updated.intValue());
+ assertEquals("Check last updated", 3, dict.size());
+ }
+
+ @Test
+ public void testDynamic() {
+ ServiceReference fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance.getInstanceName());
+ assertNotNull("Check FS availability", fooRef);
+
+ String fooP = (String) fooRef.getProperty("foo");
+ Integer barP = (Integer) fooRef.getProperty("bar");
+ String bazP = (String) fooRef.getProperty("baz");
+
+ assertEquals("Check foo equality", fooP, "foo");
+ assertEquals("Check bar equality", barP, new Integer(2));
+ assertEquals("Check baz equality", bazP, "baz");
+
+ ServiceReference msRef = ipojoHelper.getServiceReferenceByName(ManagedServiceFactory.class.getName(), instance.getFactory().getName());
+ assertNotNull("Check ManagedServiceFactory availability", msRef);
+
+ // Configuration of baz
+ Properties conf = new Properties();
+ conf.put("baz", "zab");
+ conf.put("foo", "oof");
+ conf.put("bar", new Integer(0));
+ ManagedServiceFactory ms = (ManagedServiceFactory) osgiHelper.getServiceObject(msRef);
+ try {
+ ms.updated(instance.getInstanceName(), conf);
+ } catch (ConfigurationException e) {
+ fail("Configuration Exception : " + e);
+ }
+
+ // Recheck props
+ fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance.getInstanceName());
+ fooP = (String) fooRef.getProperty("foo");
+ barP = (Integer) fooRef.getProperty("bar");
+ bazP = (String) fooRef.getProperty("baz");
+
+ assertEquals("Check foo equality", fooP, "oof");
+ assertEquals("Check bar equality", barP, new Integer(0));
+ assertEquals("Check baz equality", bazP, "zab");
+
+ // Check field value
+ FooService fs = (FooService) osgiHelper.getServiceObject(fooRef);
+ Properties p = fs.fooProps();
+ fooP = (String) p.get("foo");
+ barP = (Integer) p.get("bar");
+
+ assertEquals("Check foo field equality", fooP, "oof");
+ assertEquals("Check bar field equality", barP, new Integer(0));
+
+ Integer updated = (Integer) fs.fooProps().get("updated");
+ Dictionary dict = (Dictionary) fs.fooProps().get("lastupdated");
+
+ assertEquals("Check updated", 1, updated.intValue());
+ assertEquals("Check last updated", 3, dict.size());
+ }
+
+ @Test
+ public void testDynamicNoValue() {
+ ServiceReference fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance2.getInstanceName());
+ assertNotNull("Check FS availability", fooRef);
+
+ Object fooP = fooRef.getProperty("foo");
+ Object barP = fooRef.getProperty("bar");
+ Object bazP = fooRef.getProperty("baz");
+ assertEquals("Check foo equality -1", fooP, null);
+ assertEquals("Check bar equality -1", barP, null);
+ assertEquals("Check baz equality -1", bazP, null);
+
+ ServiceReference msRef = ipojoHelper.getServiceReferenceByName(ManagedServiceFactory.class.getName(), instance2.getFactory().getName());
+ assertNotNull("Check ManagedServiceFactory availability", msRef);
+
+ // Configuration of baz
+ Properties conf = new Properties();
+ conf.put("baz", "zab");
+ conf.put("foo", "oof");
+ conf.put("bar", new Integer(0));
+ ManagedServiceFactory ms = (ManagedServiceFactory) osgiHelper.getServiceObject(msRef);
+ try {
+ ms.updated(instance2.getInstanceName(), conf);
+ } catch (ConfigurationException e) {
+ fail("Configuration Exception : " + e);
+ }
+
+ // Recheck props
+ fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance2.getInstanceName());
+ fooP = (String) fooRef.getProperty("foo");
+ barP = (Integer) fooRef.getProperty("bar");
+ bazP = (String) fooRef.getProperty("baz");
+
+ assertEquals("Check foo equality", fooP, "oof");
+ assertEquals("Check bar equality", barP, new Integer(0));
+ assertEquals("Check baz equality", bazP, "zab");
+
+ // Check field value
+ FooService fs = (FooService) osgiHelper.getServiceObject(fooRef);
+ Properties p = fs.fooProps();
+ fooP = (String) p.get("foo");
+ barP = (Integer) p.get("bar");
+
+ assertEquals("Check foo field equality", fooP, "oof");
+ assertEquals("Check bar field equality", barP, new Integer(0));
+
+ Integer updated = (Integer) fs.fooProps().get("updated");
+ Dictionary dict = (Dictionary) fs.fooProps().get("lastupdated");
+
+ assertEquals("Check updated", 1, updated.intValue());
+ assertEquals("Check last updated", 3, dict.size());
+
+ }
+
+
+ @Test
+ public void testDynamicString() {
+ ServiceReference fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance.getInstanceName());
+ assertNotNull("Check FS availability", fooRef);
+
+ String fooP = (String) fooRef.getProperty("foo");
+ Integer barP = (Integer) fooRef.getProperty("bar");
+ String bazP = (String) fooRef.getProperty("baz");
+
+ assertEquals("Check foo equality", fooP, "foo");
+ assertEquals("Check bar equality", barP, new Integer(2));
+ assertEquals("Check baz equality", bazP, "baz");
+
+ ServiceReference msRef = ipojoHelper.getServiceReferenceByName(ManagedServiceFactory.class.getName(), instance.getFactory().getName());
+ assertNotNull("Check ManagedServiceFactory availability", msRef);
+
+ // Configuration of baz
+ Properties conf = new Properties();
+ conf.put("baz", "zab");
+ conf.put("foo", "oof");
+ conf.put("bar", "0");
+ ManagedServiceFactory ms = (ManagedServiceFactory) osgiHelper.getServiceObject(msRef);
+ try {
+ ms.updated(instance.getInstanceName(), conf);
+ } catch (ConfigurationException e) {
+ fail("Configuration Exception : " + e);
+ }
+
+ // Recheck props
+ fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance.getInstanceName());
+ fooP = (String) fooRef.getProperty("foo");
+ barP = (Integer) fooRef.getProperty("bar");
+ bazP = (String) fooRef.getProperty("baz");
+
+ assertEquals("Check foo equality", fooP, "oof");
+ assertEquals("Check bar equality", barP, new Integer(0));
+ assertEquals("Check baz equality", bazP, "zab");
+
+ // Check field value
+ FooService fs = (FooService) osgiHelper.getServiceObject(fooRef);
+ Properties p = fs.fooProps();
+ fooP = (String) p.get("foo");
+ barP = (Integer) p.get("bar");
+
+ assertEquals("Check foo field equality", fooP, "oof");
+ assertEquals("Check bar field equality", barP, new Integer(0));
+
+ Integer updated = (Integer) fs.fooProps().get("updated");
+ Dictionary dict = (Dictionary) fs.fooProps().get("lastupdated");
+
+ assertEquals("Check updated", 1, updated.intValue());
+ assertEquals("Check last updated", 3, dict.size());
+ }
+
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestUpdatedNoArgMethodAndManagedService.java b/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestUpdatedNoArgMethodAndManagedService.java
new file mode 100644
index 0000000..978d641
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestUpdatedNoArgMethodAndManagedService.java
@@ -0,0 +1,327 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.ipojo.runtime.core;
+
+import org.apache.felix.ipojo.ComponentInstance;
+import org.apache.felix.ipojo.runtime.core.services.FooService;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.cm.ConfigurationException;
+import org.osgi.service.cm.ManagedService;
+import org.ow2.chameleon.testing.helpers.IPOJOHelper;
+import org.ow2.chameleon.testing.helpers.OSGiHelper;
+
+import java.util.Hashtable;
+import java.util.Properties;
+
+import static junit.framework.Assert.*;
+
+
+public class TestUpdatedNoArgMethodAndManagedService extends Common {
+
+
+
+ /**
+ * Instance where the ManagedServicePID is provided by the component type.
+ */
+ ComponentInstance instance1;
+ /**
+ * Instance where the ManagedServicePID is provided by the instance.
+ */
+ ComponentInstance instance2;
+
+ /**
+ * Instance without configuration.
+ */
+ ComponentInstance instance3;
+
+
+
+ @Before
+ public void setUp() {
+ osgiHelper = new OSGiHelper(bc);
+ ipojoHelper = new IPOJOHelper(bc);
+ String type = "CONFIG-FooProviderType-4Updated2";
+ Hashtable<String, String> p = new Hashtable<String, String>();
+ p.put("instance.name", "instance");
+ p.put("foo", "foo");
+ p.put("bar", "2");
+ p.put("baz", "baz");
+ instance1 = ipojoHelper.createComponentInstance(type, p);
+ assertEquals("instance1 created", ComponentInstance.VALID, instance1.getState());
+
+ type = "CONFIG-FooProviderType-3Updated2";
+ Hashtable<String, String> p1 = new Hashtable<String, String>();
+ p1.put("instance.name", "instance-2");
+ p1.put("foo", "foo");
+ p1.put("bar", "2");
+ p1.put("baz", "baz");
+ p1.put("managed.service.pid", "instance");
+ instance2 = ipojoHelper.createComponentInstance(type, p1);
+
+ type = "CONFIG-FooProviderType-3Updated2";
+ Hashtable<String, String> p2 = new Hashtable<String, String>();
+ p2.put("instance.name", "instance-3");
+ p2.put("managed.service.pid", "instance-3");
+ instance3 = ipojoHelper.createComponentInstance(type, p2);
+ }
+
+ @After
+ public void tearDown() {
+ instance1.dispose();
+ instance2.dispose();
+ instance3.dispose();
+ instance1 = null;
+ instance2 = null;
+ instance3 = null;
+ }
+
+ @Test
+ public void testStaticInstance1() {
+ ServiceReference fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance1.getInstanceName());
+ assertNotNull("Check FS availability", fooRef);
+ String fooP = (String) fooRef.getProperty("foo");
+ Integer barP = (Integer) fooRef.getProperty("bar");
+ String bazP = (String) fooRef.getProperty("baz");
+ assertEquals("Check foo equality -1", fooP, "foo");
+ assertEquals("Check bar equality -1", barP, new Integer(2));
+ assertEquals("Check baz equality -1", bazP, "baz");
+
+ ServiceReference msRef = osgiHelper.getServiceReferenceByPID(ManagedService.class.getName(), "FooProvider-3");
+ assertNotNull("Check ManagedServiceFactory availability", msRef);
+
+ // Configuration of baz
+ Properties conf = new Properties();
+ conf.put("baz", "zab");
+ conf.put("bar", new Integer(2));
+ conf.put("foo", "foo");
+ ManagedService ms = (ManagedService) osgiHelper.getServiceObject(msRef);
+ try {
+ ms.updated(conf);
+ } catch (ConfigurationException e) {
+ fail("Configuration Exception : " + e);
+ }
+
+ // Re-check props
+ fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance1.getInstanceName());
+ fooP = (String) fooRef.getProperty("foo");
+ barP = (Integer) fooRef.getProperty("bar");
+ bazP = (String) fooRef.getProperty("baz");
+ assertEquals("Check foo equality -2", fooP, "foo");
+ assertEquals("Check bar equality -2", barP, new Integer(2));
+ assertEquals("Check baz equality -2", bazP, "zab");
+
+ // Get Service
+ FooService fs = (FooService) osgiHelper.getServiceObject(fooRef);
+ Integer updated = (Integer) fs.fooProps().get("updated");
+ assertEquals("Check updated", 1, updated.intValue());
+ }
+
+ @Test
+ public void testStaticInstance2() {
+ ServiceReference fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance2.getInstanceName());
+ assertNotNull("Check FS availability", fooRef);
+ String fooP = (String) fooRef.getProperty("foo");
+ Integer barP = (Integer) fooRef.getProperty("bar");
+ String bazP = (String) fooRef.getProperty("baz");
+ assertEquals("Check foo equality -1", fooP, "foo");
+ assertEquals("Check bar equality -1", barP, new Integer(2));
+ assertEquals("Check baz equality -1", bazP, "baz");
+
+ ServiceReference msRef = osgiHelper.getServiceReferenceByPID(ManagedService.class.getName(), "instance");
+ assertNotNull("Check ManagedService availability", msRef);
+
+
+ // Configuration of baz
+ Properties conf = new Properties();
+ conf.put("baz", "zab");
+ conf.put("bar", new Integer(2));
+ conf.put("foo", "foo");
+ ManagedService ms = (ManagedService) osgiHelper.getServiceObject(msRef);
+ try {
+ ms.updated(conf);
+ } catch (ConfigurationException e) {
+ fail("Configuration Exception : " + e);
+ }
+
+ // Recheck props
+ fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance2.getInstanceName());
+ fooP = (String) fooRef.getProperty("foo");
+ barP = (Integer) fooRef.getProperty("bar");
+ bazP = (String) fooRef.getProperty("baz");
+ assertEquals("Check foo equality -2", fooP, "foo");
+ assertEquals("Check bar equality -2", barP, new Integer(2));
+ assertEquals("Check baz equality -2", bazP, "zab");
+
+ // Get Service
+ FooService fs = (FooService) osgiHelper.getServiceObject(fooRef);
+ Integer updated = (Integer) fs.fooProps().get("updated");
+
+ assertEquals("Check updated", 1, updated.intValue());
+
+ conf.put("baz", "zab2");
+ conf.put("foo", "oof2");
+ conf.put("bar", new Integer(0));
+ ms = (ManagedService) osgiHelper.getServiceObject(msRef);
+ try {
+ ms.updated(conf);
+ } catch (ConfigurationException e) {
+ fail("Configuration Exception : " + e);
+ }
+
+ updated = (Integer) fs.fooProps().get("updated");
+
+ assertEquals("Check updated -2", 2, updated.intValue());
+ }
+
+ @Test
+ public void testDynamicInstance1() {
+ ServiceReference fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance1.getInstanceName());
+ assertNotNull("Check FS availability", fooRef);
+
+ String fooP = (String) fooRef.getProperty("foo");
+ Integer barP = (Integer) fooRef.getProperty("bar");
+ String bazP = (String) fooRef.getProperty("baz");
+
+ assertEquals("Check foo equality", fooP, "foo");
+ assertEquals("Check bar equality", barP, new Integer(2));
+ assertEquals("Check baz equality", bazP, "baz");
+
+ ServiceReference msRef = osgiHelper.getServiceReferenceByPID(ManagedService.class.getName(), "FooProvider-3");
+ assertNotNull("Check ManagedServiceFactory availability", msRef);
+
+ // Configuration of baz
+ Properties conf = new Properties();
+ conf.put("baz", "zab");
+ conf.put("foo", "oof");
+ conf.put("bar", new Integer(0));
+ ManagedService ms = (ManagedService) osgiHelper.getServiceObject(msRef);
+ try {
+ ms.updated(conf);
+ } catch (ConfigurationException e) {
+ fail("Configuration Exception : " + e);
+ }
+
+ // Re-check props
+ fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance1.getInstanceName());
+ fooP = (String) fooRef.getProperty("foo");
+ barP = (Integer) fooRef.getProperty("bar");
+ bazP = (String) fooRef.getProperty("baz");
+
+ assertEquals("Check foo equality", fooP, "oof");
+ assertEquals("Check bar equality", barP, new Integer(0));
+ assertEquals("Check baz equality", bazP, "zab");
+
+ // Check field value
+ FooService fs = (FooService) osgiHelper.getServiceObject(fooRef);
+ Properties p = fs.fooProps();
+ fooP = (String) p.get("foo");
+ barP = (Integer) p.get("bar");
+
+ assertEquals("Check foo field equality", fooP, "oof");
+ assertEquals("Check bar field equality", barP, new Integer(0));
+
+ Integer updated = (Integer) fs.fooProps().get("updated");
+
+ assertEquals("Check updated -1", 1, updated.intValue());
+
+ conf.put("baz", "zab2");
+ conf.put("foo", "oof2");
+ conf.put("bar", new Integer(0));
+ ms = (ManagedService) osgiHelper.getServiceObject(msRef);
+ try {
+ ms.updated(conf);
+ } catch (ConfigurationException e) {
+ fail("Configuration Exception : " + e);
+ }
+
+ updated = (Integer) fs.fooProps().get("updated");
+
+ assertEquals("Check updated -2", 2, updated.intValue());
+
+ }
+
+ @Test
+ public void testDynamicInstance2() {
+ ServiceReference fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance2.getInstanceName());
+ assertNotNull("Check FS availability", fooRef);
+
+ String fooP = (String) fooRef.getProperty("foo");
+ Integer barP = (Integer) fooRef.getProperty("bar");
+ String bazP = (String) fooRef.getProperty("baz");
+
+ assertEquals("Check foo equality", fooP, "foo");
+ assertEquals("Check bar equality", barP, new Integer(2));
+ assertEquals("Check baz equality", bazP, "baz");
+
+ ServiceReference msRef = osgiHelper.getServiceReferenceByPID(ManagedService.class.getName(), "instance");
+ assertNotNull("Check ManagedServiceFactory availability", msRef);
+
+ // Configuration of baz
+ Properties conf = new Properties();
+ conf.put("baz", "zab");
+ conf.put("foo", "oof");
+ conf.put("bar", new Integer(0));
+ ManagedService ms = (ManagedService) osgiHelper.getServiceObject(msRef);
+ try {
+ ms.updated(conf);
+ } catch (ConfigurationException e) {
+ fail("Configuration Exception : " + e);
+ }
+
+ // Recheck props
+ fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance2.getInstanceName());
+ fooP = (String) fooRef.getProperty("foo");
+ barP = (Integer) fooRef.getProperty("bar");
+ bazP = (String) fooRef.getProperty("baz");
+
+ assertEquals("Check foo equality", fooP, "oof");
+ assertEquals("Check bar equality", barP, new Integer(0));
+ assertEquals("Check baz equality", bazP, "zab");
+
+ // Check field value
+ FooService fs = (FooService) osgiHelper.getServiceObject(fooRef);
+ Properties p = fs.fooProps();
+ fooP = (String) p.get("foo");
+ barP = (Integer) p.get("bar");
+
+ assertEquals("Check foo field equality", fooP, "oof");
+ assertEquals("Check bar field equality", barP, new Integer(0));
+
+ Integer updated = (Integer) fs.fooProps().get("updated");
+
+ assertEquals("Check updated", 1, updated.intValue());
+
+ conf.put("baz", "zab2");
+ conf.put("foo", "oof2");
+ conf.put("bar", new Integer(0));
+ ms = (ManagedService) osgiHelper.getServiceObject(msRef);
+ try {
+ ms.updated(conf);
+ } catch (ConfigurationException e) {
+ fail("Configuration Exception : " + e);
+ }
+
+ updated = (Integer) fs.fooProps().get("updated");
+
+ assertEquals("Check updated -2", 2, updated.intValue());
+ }
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestUpdatedNoArgMethodAndManagedServiceFactory.java b/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestUpdatedNoArgMethodAndManagedServiceFactory.java
new file mode 100644
index 0000000..b3e1747
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestUpdatedNoArgMethodAndManagedServiceFactory.java
@@ -0,0 +1,317 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.ipojo.runtime.core;
+
+import org.apache.felix.ipojo.ComponentInstance;
+import org.apache.felix.ipojo.runtime.core.services.FooService;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.cm.ConfigurationException;
+import org.osgi.service.cm.ManagedServiceFactory;
+import org.ow2.chameleon.testing.helpers.IPOJOHelper;
+import org.ow2.chameleon.testing.helpers.OSGiHelper;
+
+import java.util.Hashtable;
+import java.util.Properties;
+
+import static org.junit.Assert.*;
+
+
+public class TestUpdatedNoArgMethodAndManagedServiceFactory extends Common {
+
+
+
+ ComponentInstance instance, instance2;
+
+
+
+ @Before
+ public void setUp() {
+ osgiHelper = new OSGiHelper(bc);
+ ipojoHelper = new IPOJOHelper(bc);
+ String type = "CONFIG-FooProviderType-3Updated2";
+
+ Hashtable<String, String> p1 = new Hashtable<String, String>();
+ p1.put("instance.name", "instance");
+ p1.put("foo", "foo");
+ p1.put("bar", "2");
+ p1.put("baz", "baz");
+ instance = ipojoHelper.createComponentInstance(type, p1);
+
+ Hashtable<String, String> p2 = new Hashtable<String, String>();
+ p2.put("instance.name", "instance2");
+
+ instance2 = ipojoHelper.createComponentInstance(type, p2);
+ }
+
+ @After
+ public void tearDown() {
+ instance.dispose();
+ instance2.dispose();
+ instance2 = null;
+ instance = null;
+ }
+
+ @Test
+ public void testStatic() {
+
+ ServiceReference fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance.getInstanceName());
+ assertNotNull("Check FS availability", fooRef);
+ String fooP = (String) fooRef.getProperty("foo");
+ Integer barP = (Integer) fooRef.getProperty("bar");
+ String bazP = (String) fooRef.getProperty("baz");
+ assertEquals("Check foo equality -1", fooP, "foo");
+ assertEquals("Check bar equality -1", barP, new Integer(2));
+ assertEquals("Check baz equality -1", bazP, "baz");
+
+ ServiceReference msRef = ipojoHelper.getServiceReferenceByName(ManagedServiceFactory.class.getName(), instance.getFactory().getName());
+ assertNotNull("Check ManagedServiceFactory availability", msRef);
+
+
+ // Configuration of baz
+ Properties conf = new Properties();
+ conf.put("baz", "zab");
+ conf.put("bar", new Integer(2));
+ conf.put("foo", "foo");
+ ManagedServiceFactory ms = (ManagedServiceFactory) osgiHelper.getServiceObject(msRef);
+ try {
+ ms.updated(instance.getInstanceName(), conf);
+ } catch (ConfigurationException e) {
+ fail("Configuration Exception : " + e);
+ }
+
+ // Recheck props
+ fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance.getInstanceName());
+ fooP = (String) fooRef.getProperty("foo");
+ barP = (Integer) fooRef.getProperty("bar");
+ bazP = (String) fooRef.getProperty("baz");
+ assertEquals("Check foo equality -2", fooP, "foo");
+ assertEquals("Check bar equality -2", barP, new Integer(2));
+ assertEquals("Check baz equality -2", bazP, "zab");
+
+ // Get Service
+ FooService fs = (FooService) osgiHelper.getServiceObject(fooRef);
+ Integer updated = (Integer) fs.fooProps().get("updated");
+
+ assertEquals("Check updated", 1, updated.intValue());
+
+ }
+
+ @Test
+ public void testStaticNoValue() {
+ ServiceReference fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance2.getInstanceName());
+ assertNotNull("Check FS availability", fooRef);
+ Object fooP = fooRef.getProperty("foo");
+ Object barP = fooRef.getProperty("bar");
+ Object bazP = fooRef.getProperty("baz");
+ assertEquals("Check foo equality -1", fooP, null);
+ assertEquals("Check bar equality -1", barP, null);
+ assertEquals("Check baz equality -1", bazP, null);
+
+ ServiceReference msRef = ipojoHelper.getServiceReferenceByName(ManagedServiceFactory.class.getName(), instance2.getFactory().getName());
+ assertNotNull("Check ManagedServiceFactory availability", msRef);
+
+
+ // Configuration of baz
+ Properties conf = new Properties();
+ conf.put("baz", "zab");
+ conf.put("bar", new Integer(2));
+ conf.put("foo", "foo");
+ ManagedServiceFactory ms = (ManagedServiceFactory) osgiHelper.getServiceObject(msRef);
+ try {
+ ms.updated(instance2.getInstanceName(), conf);
+ } catch (ConfigurationException e) {
+ fail("Configuration Exception : " + e);
+ }
+
+ // Recheck props
+ fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance2.getInstanceName());
+ fooP = (String) fooRef.getProperty("foo");
+ barP = (Integer) fooRef.getProperty("bar");
+ bazP = (String) fooRef.getProperty("baz");
+ assertEquals("Check foo equality -2", fooP, "foo");
+ assertEquals("Check bar equality -2", barP, new Integer(2));
+ assertEquals("Check baz equality -2", bazP, "zab");
+
+ // Get Service
+ FooService fs = (FooService) osgiHelper.getServiceObject(fooRef);
+ Integer updated = (Integer) fs.fooProps().get("updated");
+
+ assertEquals("Check updated", 1, updated.intValue());
+ }
+
+ @Test
+ public void testDynamic() {
+ ServiceReference fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance.getInstanceName());
+ assertNotNull("Check FS availability", fooRef);
+
+ String fooP = (String) fooRef.getProperty("foo");
+ Integer barP = (Integer) fooRef.getProperty("bar");
+ String bazP = (String) fooRef.getProperty("baz");
+
+ assertEquals("Check foo equality", fooP, "foo");
+ assertEquals("Check bar equality", barP, new Integer(2));
+ assertEquals("Check baz equality", bazP, "baz");
+
+ ServiceReference msRef = ipojoHelper.getServiceReferenceByName(ManagedServiceFactory.class.getName(), instance.getFactory().getName());
+ assertNotNull("Check ManagedServiceFactory availability", msRef);
+
+ // Configuration of baz
+ Properties conf = new Properties();
+ conf.put("baz", "zab");
+ conf.put("foo", "oof");
+ conf.put("bar", new Integer(0));
+ ManagedServiceFactory ms = (ManagedServiceFactory) osgiHelper.getServiceObject(msRef);
+ try {
+ ms.updated(instance.getInstanceName(), conf);
+ } catch (ConfigurationException e) {
+ fail("Configuration Exception : " + e);
+ }
+
+ // Recheck props
+ fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance.getInstanceName());
+ fooP = (String) fooRef.getProperty("foo");
+ barP = (Integer) fooRef.getProperty("bar");
+ bazP = (String) fooRef.getProperty("baz");
+
+ assertEquals("Check foo equality", fooP, "oof");
+ assertEquals("Check bar equality", barP, new Integer(0));
+ assertEquals("Check baz equality", bazP, "zab");
+
+ // Check field value
+ FooService fs = (FooService) osgiHelper.getServiceObject(fooRef);
+ Properties p = fs.fooProps();
+ fooP = (String) p.get("foo");
+ barP = (Integer) p.get("bar");
+
+ assertEquals("Check foo field equality", fooP, "oof");
+ assertEquals("Check bar field equality", barP, new Integer(0));
+
+ Integer updated = (Integer) fs.fooProps().get("updated");
+
+ assertEquals("Check updated", 1, updated.intValue());
+ }
+
+ @Test
+ public void testDynamicNoValue() {
+ ServiceReference fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance2.getInstanceName());
+ assertNotNull("Check FS availability", fooRef);
+
+ Object fooP = fooRef.getProperty("foo");
+ Object barP = fooRef.getProperty("bar");
+ Object bazP = fooRef.getProperty("baz");
+ assertEquals("Check foo equality -1", fooP, null);
+ assertEquals("Check bar equality -1", barP, null);
+ assertEquals("Check baz equality -1", bazP, null);
+
+ ServiceReference msRef = ipojoHelper.getServiceReferenceByName(ManagedServiceFactory.class.getName(), instance2.getFactory().getName());
+ assertNotNull("Check ManagedServiceFactory availability", msRef);
+
+ // Configuration of baz
+ Properties conf = new Properties();
+ conf.put("baz", "zab");
+ conf.put("foo", "oof");
+ conf.put("bar", new Integer(0));
+ ManagedServiceFactory ms = (ManagedServiceFactory) osgiHelper.getServiceObject(msRef);
+ try {
+ ms.updated(instance2.getInstanceName(), conf);
+ } catch (ConfigurationException e) {
+ fail("Configuration Exception : " + e);
+ }
+
+ // Recheck props
+ fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance2.getInstanceName());
+ fooP = (String) fooRef.getProperty("foo");
+ barP = (Integer) fooRef.getProperty("bar");
+ bazP = (String) fooRef.getProperty("baz");
+
+ assertEquals("Check foo equality", fooP, "oof");
+ assertEquals("Check bar equality", barP, new Integer(0));
+ assertEquals("Check baz equality", bazP, "zab");
+
+ // Check field value
+ FooService fs = (FooService) osgiHelper.getServiceObject(fooRef);
+ Properties p = fs.fooProps();
+ fooP = (String) p.get("foo");
+ barP = (Integer) p.get("bar");
+
+ assertEquals("Check foo field equality", fooP, "oof");
+ assertEquals("Check bar field equality", barP, new Integer(0));
+
+ Integer updated = (Integer) fs.fooProps().get("updated");
+
+ assertEquals("Check updated", 1, updated.intValue());
+ }
+
+
+ @Test
+ public void testDynamicString() {
+ ServiceReference fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance.getInstanceName());
+ assertNotNull("Check FS availability", fooRef);
+
+ String fooP = (String) fooRef.getProperty("foo");
+ Integer barP = (Integer) fooRef.getProperty("bar");
+ String bazP = (String) fooRef.getProperty("baz");
+
+ assertEquals("Check foo equality", fooP, "foo");
+ assertEquals("Check bar equality", barP, new Integer(2));
+ assertEquals("Check baz equality", bazP, "baz");
+
+ ServiceReference msRef = ipojoHelper.getServiceReferenceByName(ManagedServiceFactory.class.getName(), instance.getFactory().getName());
+ assertNotNull("Check ManagedServiceFactory availability", msRef);
+
+ // Configuration of baz
+ Properties conf = new Properties();
+ conf.put("baz", "zab");
+ conf.put("foo", "oof");
+ conf.put("bar", "0");
+ ManagedServiceFactory ms = (ManagedServiceFactory) osgiHelper.getServiceObject(msRef);
+ try {
+ ms.updated(instance.getInstanceName(), conf);
+ } catch (ConfigurationException e) {
+ fail("Configuration Exception : " + e);
+ }
+
+ // Recheck props
+ fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance.getInstanceName());
+ fooP = (String) fooRef.getProperty("foo");
+ barP = (Integer) fooRef.getProperty("bar");
+ bazP = (String) fooRef.getProperty("baz");
+
+ assertEquals("Check foo equality", fooP, "oof");
+ assertEquals("Check bar equality", barP, new Integer(0));
+ assertEquals("Check baz equality", bazP, "zab");
+
+ // Check field value
+ FooService fs = (FooService) osgiHelper.getServiceObject(fooRef);
+ Properties p = fs.fooProps();
+ fooP = (String) p.get("foo");
+ barP = (Integer) p.get("bar");
+
+ assertEquals("Check foo field equality", fooP, "oof");
+ assertEquals("Check bar field equality", barP, new Integer(0));
+
+ Integer updated = (Integer) fs.fooProps().get("updated");
+
+ assertEquals("Check updated", 1, updated.intValue());
+ }
+
+}
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/test/resources/exam.properties b/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/test/resources/exam.properties
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/test/resources/exam.properties
diff --git a/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/untitled.iml b/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/untitled.iml
new file mode 100644
index 0000000..3256536
--- /dev/null
+++ b/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/untitled.iml
@@ -0,0 +1,89 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
+ <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_6" inherit-compiler-output="false">
+ <output url="file://$MODULE_DIR$/target/classes" />
+ <output-test url="file://$MODULE_DIR$/target/test-classes" />
+ <content url="file://$MODULE_DIR$">
+ <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/src/main/resources" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
+ <sourceFolder url="file://$MODULE_DIR$/src/test/resources" isTestSource="true" />
+ <excludeFolder url="file://$MODULE_DIR$/target" />
+ </content>
+ <orderEntry type="inheritedJdk" />
+ <orderEntry type="sourceFolder" forTests="false" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.ops4j.pax.exam:pax-exam-container-native:3.0.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.ops4j.pax.exam:pax-exam:3.0.0" level="project" />
+ <orderEntry type="library" name="Maven: org.ops4j.base:ops4j-base-lang:1.4.0" level="project" />
+ <orderEntry type="library" name="Maven: org.ops4j.base:ops4j-base-store:1.2.3" level="project" />
+ <orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.5.11" level="project" />
+ <orderEntry type="library" name="Maven: org.ops4j.base:ops4j-base-io:1.2.3" level="project" />
+ <orderEntry type="library" name="Maven: org.ops4j.base:ops4j-base-monitors:1.4.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.ops4j.base:ops4j-base-util-property:1.4.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.ops4j.pax.exam:pax-exam-spi:3.0.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.ops4j.base:ops4j-base-spi:1.4.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: com.google.guava:guava:12.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: com.google.code.findbugs:jsr305:1.3.9" level="project" />
+ <orderEntry type="library" name="Maven: org.ops4j.pax.tinybundles:tinybundles:1.0.0" level="project" />
+ <orderEntry type="library" name="Maven: biz.aQute:bndlib:1.43.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.glassfish.main.common:scattered-archive-api:3.1.2.2" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.ops4j.pax.swissbox:pax-swissbox-core:1.6.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.ops4j.pax.swissbox:pax-swissbox-lifecycle:1.6.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.ops4j.pax.swissbox:pax-swissbox-tracker:1.6.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.ops4j.base:ops4j-base-net:1.4.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.ops4j.pax.url:pax-url-link:1.5.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.ops4j.pax.url:pax-url-commons:1.5.1" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.ops4j.pax.swissbox:pax-swissbox-property:1.5.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.ops4j.pax.url:pax-url-classpath:1.5.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.ops4j.pax.swissbox:pax-swissbox-optional-jcl:1.5.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.ops4j.pax.exam:pax-exam-junit4:3.0.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.9" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.1" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.ops4j.pax.exam:pax-exam-link-mvn:3.0.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.ops4j.pax.url:pax-url-aether:1.5.1" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.ops4j.pax.url:pax-url-maven-commons:1.5.1" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.ops4j.base:ops4j-base-util-xml:1.3.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.ops4j.base:ops4j-base-util-collections:1.3.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.sonatype.aether:aether-api:1.13.1" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.sonatype.aether:aether-spi:1.13.1" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.sonatype.aether:aether-util:1.13.1" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.sonatype.aether:aether-impl:1.13.1" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.sonatype.aether:aether-connector-wagon:1.13.1" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.apache.maven.wagon:wagon-provider-api:1.0-beta-7" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.codehaus.plexus:plexus-utils:3.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.codehaus.plexus:plexus-classworlds:2.4" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.sonatype.sisu:sisu-inject-plexus:2.2.3" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.codehaus.plexus:plexus-component-annotations:1.5.5" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.sonatype.sisu:sisu-inject-bean:2.2.3" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.sonatype.sisu:sisu-guice:no_aop:3.0.3" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.apache.maven:maven-aether-provider:3.0.4" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.apache.maven:maven-model:3.0.4" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.apache.maven:maven-model-builder:3.0.4" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.codehaus.plexus:plexus-interpolation:1.14" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.apache.maven:maven-repository-metadata:3.0.4" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.apache.maven.wagon:wagon-file:1.0-beta-7" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.apache.maven.wagon:wagon-http-lightweight:1.0-beta-7" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.apache.maven.wagon:wagon-http-shared:1.0-beta-7" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.codehaus.plexus:plexus-container-default:1.5.5" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.apache.xbean:xbean-reflect:3.4" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: com.google.collections:google-collections:1.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: commons-httpclient:commons-httpclient:3.1" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: commons-codec:commons-codec:1.2" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: commons-logging:commons-logging:1.0.4" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.apache.felix:org.apache.felix.framework:3.2.2" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: ch.qos.logback:logback-core:0.9.20" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: ch.qos.logback:logback-classic:0.9.20" level="project" />
+ <orderEntry type="library" name="Maven: org.apache.felix:org.apache.felix.ipojo:1.9.0-SNAPSHOT" level="project" />
+ <orderEntry type="library" name="Maven: org.osgi:org.osgi.core:4.3.1" level="project" />
+ <orderEntry type="library" name="Maven: org.osgi:org.osgi.compendium:4.0.0" level="project" />
+ <orderEntry type="library" name="Maven: org.apache.felix:org.apache.felix.ipojo.metadata:1.6.0" level="project" />
+ <orderEntry type="library" name="Maven: org.apache.felix:org.apache.felix.ipojo.manipulator:1.9.0-SNAPSHOT" level="project" />
+ <orderEntry type="library" name="Maven: asm:asm-all:3.3.1" level="project" />
+ <orderEntry type="library" name="Maven: org.apache.felix:org.apache.felix.ipojo.annotations:1.8.0" level="project" />
+ <orderEntry type="library" name="Maven: commons-io:commons-io:2.4" level="project" />
+ <orderEntry type="module" module-name="osgi-helpers" scope="TEST" />
+ <orderEntry type="module" module-name="tinybundles-ipojo" />
+ <orderEntry type="library" name="Maven: xerces:xercesImpl:2.4.0" level="project" />
+ </component>
+</module>
+