You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by cl...@apache.org on 2013/02/13 17:26:24 UTC
svn commit: r1445708 [4/9] - in /felix/trunk/ipojo/runtime/core-it: ./ src/
src/it/ src/it/ipojo-core-annotations-test/
src/it/ipojo-core-annotations-test/src/
src/it/ipojo-core-annotations-test/src/main/
src/it/ipojo-core-annotations-test/src/main/jav...
Added: felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestWhiteBoard.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestWhiteBoard.java?rev=1445708&view=auto
==============================================================================
--- felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestWhiteBoard.java (added)
+++ felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestWhiteBoard.java Wed Feb 13 16:26:18 2013
@@ -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);
+ }
+
+
+}
Added: felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/ipojo-core-configuration-test.iml
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/ipojo-core-configuration-test.iml?rev=1445708&view=auto
==============================================================================
--- felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/ipojo-core-configuration-test.iml (added)
+++ felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/ipojo-core-configuration-test.iml Wed Feb 13 16:26:18 2013
@@ -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>
+
Added: felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/pom.xml
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/pom.xml?rev=1445708&view=auto
==============================================================================
--- felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/pom.xml (added)
+++ felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/pom.xml Wed Feb 13 16:26:18 2013
@@ -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
Added: felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CheckProviderParentClass.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CheckProviderParentClass.java?rev=1445708&view=auto
==============================================================================
--- felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CheckProviderParentClass.java (added)
+++ felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CheckProviderParentClass.java Wed Feb 13 16:26:18 2013
@@ -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++;
+ }
+
+}
Added: felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CheckServiceProvider.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CheckServiceProvider.java?rev=1445708&view=auto
==============================================================================
--- felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CheckServiceProvider.java (added)
+++ felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CheckServiceProvider.java Wed Feb 13 16:26:18 2013
@@ -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++; }
+ }
+
+}
Added: felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ComplexConfiguration.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ComplexConfiguration.java?rev=1445708&view=auto
==============================================================================
--- felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ComplexConfiguration.java (added)
+++ felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ComplexConfiguration.java Wed Feb 13 16:26:18 2013
@@ -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;
+ }
+
+}
Added: felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ConfigurableCheckServiceProvider.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ConfigurableCheckServiceProvider.java?rev=1445708&view=auto
==============================================================================
--- felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ConfigurableCheckServiceProvider.java (added)
+++ felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ConfigurableCheckServiceProvider.java Wed Feb 13 16:26:18 2013
@@ -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++;
+ }
+
+}
Added: felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderType1.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderType1.java?rev=1445708&view=auto
==============================================================================
--- felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderType1.java (added)
+++ felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderType1.java Wed Feb 13 16:26:18 2013
@@ -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;
+ }
+
+}
Added: felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderType2.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderType2.java?rev=1445708&view=auto
==============================================================================
--- felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderType2.java (added)
+++ felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderType2.java Wed Feb 13 16:26:18 2013
@@ -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++;
+ }
+
+}
Added: felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderTypeDyn.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderTypeDyn.java?rev=1445708&view=auto
==============================================================================
--- felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderTypeDyn.java (added)
+++ felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderTypeDyn.java Wed Feb 13 16:26:18 2013
@@ -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;
+ }
+
+}
Added: felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ParentClass.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ParentClass.java?rev=1445708&view=auto
==============================================================================
--- felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ParentClass.java (added)
+++ felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ParentClass.java Wed Feb 13 16:26:18 2013
@@ -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++;
+ }
+
+
+
+}
Added: felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ParentConfigurableCheckServiceProvider.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ParentConfigurableCheckServiceProvider.java?rev=1445708&view=auto
==============================================================================
--- felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ParentConfigurableCheckServiceProvider.java (added)
+++ felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ParentConfigurableCheckServiceProvider.java Wed Feb 13 16:26:18 2013
@@ -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++;
+ }
+
+
+
+}
Added: felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/PropertyModifier.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/PropertyModifier.java?rev=1445708&view=auto
==============================================================================
--- felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/PropertyModifier.java (added)
+++ felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/PropertyModifier.java Wed Feb 13 16:26:18 2013
@@ -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;
+ }
+
+}
Added: felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/CheckService.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/CheckService.java?rev=1445708&view=auto
==============================================================================
--- felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/CheckService.java (added)
+++ felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/CheckService.java Wed Feb 13 16:26:18 2013
@@ -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();
+
+}
Added: felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/FooService.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/FooService.java?rev=1445708&view=auto
==============================================================================
--- felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/FooService.java (added)
+++ felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/FooService.java Wed Feb 13 16:26:18 2013
@@ -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();
+
+}
Added: felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/resources/metadata.xml
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/resources/metadata.xml?rev=1445708&view=auto
==============================================================================
--- felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/resources/metadata.xml (added)
+++ felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/resources/metadata.xml Wed Feb 13 16:26:18 2013
@@ -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>
Added: felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/resources/updated.xml
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/resources/updated.xml?rev=1445708&view=auto
==============================================================================
--- felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/resources/updated.xml (added)
+++ felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/main/resources/updated.xml Wed Feb 13 16:26:18 2013
@@ -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>
Added: felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/Common.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/Common.java?rev=1445708&view=auto
==============================================================================
--- felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/Common.java (added)
+++ felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/Common.java Wed Feb 13 16:26:18 2013
@@ -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");
+ }
+ }
+
+
+}
Added: felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestArchitecture.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestArchitecture.java?rev=1445708&view=auto
==============================================================================
--- felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestArchitecture.java (added)
+++ felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestArchitecture.java Wed Feb 13 16:26:18 2013
@@ -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());
+
+ }
+
+
+}