felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clem...@apache.org
Subject svn commit: r1528105 - in /felix/trunk/ipojo/runtime: core-it/ipojo-core-configuration-processor-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ core-it/ipojo-core-configuration-processor-test/src/test/java/org/apache/felix/ipojo/run...
Date Tue, 01 Oct 2013 14:33:34 GMT
Author: clement
Date: Tue Oct  1 14:33:34 2013
New Revision: 1528105

URL: http://svn.apache.org/r1528105
Log:
Fix FELIX-4261 NPE when an instance is declared without a configuration using the @ConfigurationTracker

Added:
    felix/trunk/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/SimpleConfiguration.java
      - copied, changed from r1527507, felix/trunk/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ConfigureOneInstance.java
    felix/trunk/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestSimpleConfiguration.java
      - copied, changed from r1527507, felix/trunk/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestEmptyConfiguration.java
Modified:
    felix/trunk/ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/configuration/Instance.java

Copied: felix/trunk/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/SimpleConfiguration.java
(from r1527507, felix/trunk/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ConfigureOneInstance.java)
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/SimpleConfiguration.java?p2=felix/trunk/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/SimpleConfiguration.java&p1=felix/trunk/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ConfigureOneInstance.java&r1=1527507&r2=1528105&rev=1528105&view=diff
==============================================================================
--- felix/trunk/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ConfigureOneInstance.java
(original)
+++ felix/trunk/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/SimpleConfiguration.java
Tue Oct  1 14:33:34 2013
@@ -7,7 +7,7 @@
  * "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
+ *   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
@@ -30,14 +30,9 @@ import static org.apache.felix.ipojo.con
  * Simple configuration
  */
 @Configuration
-public class ConfigureOneInstance {
+public class SimpleConfiguration {
 
     // Declare an instance of MyComponent named myInstance
     Instance myInstance = instance().of(MyComponent.class)
-            .with("floating").setto("1.0")
-            .with("message").setto("foo")
-            .with("bool").setto(true)
-            .with("number").setto(1l)
-            .with("integer").setto(1)
-            .with("props").setto(new Properties());
+            .named("foo");
 }

Copied: felix/trunk/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestSimpleConfiguration.java
(from r1527507, felix/trunk/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestEmptyConfiguration.java)
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestSimpleConfiguration.java?p2=felix/trunk/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestSimpleConfiguration.java&p1=felix/trunk/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestEmptyConfiguration.java&r1=1527507&r2=1528105&rev=1528105&view=diff
==============================================================================
--- felix/trunk/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestEmptyConfiguration.java
(original)
+++ felix/trunk/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestSimpleConfiguration.java
Tue Oct  1 14:33:34 2013
@@ -7,7 +7,7 @@
  * "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
+ *   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
@@ -20,8 +20,8 @@
 package org.apache.felix.ipojo.runtime.core;
 
 import junit.framework.Assert;
-import org.apache.felix.ipojo.runtime.core.components.ConfigureNothing;
 import org.apache.felix.ipojo.runtime.core.components.MyComponent;
+import org.apache.felix.ipojo.runtime.core.components.SimpleConfiguration;
 import org.apache.felix.ipojo.runtime.core.services.FooService;
 import org.junit.Test;
 import org.ops4j.pax.exam.Configuration;
@@ -38,9 +38,9 @@ import static org.ops4j.pax.exam.CoreOpt
 import static org.ops4j.pax.tinybundles.core.TinyBundles.withBnd;
 
 /**
- * Check an empty @Configuration
+ * Check a simple @Configuration
  */
-public class TestEmptyConfiguration extends Common {
+public class TestSimpleConfiguration extends Common {
 
     @Configuration
     public Option[] config() throws IOException {
@@ -59,7 +59,7 @@ public class TestEmptyConfiguration exte
                 streamBundle(
                         TinyBundles.bundle()
                                 .add(MyComponent.class)
-                                .add(ConfigureNothing.class)
+                                .add(SimpleConfiguration.class)
                                 .set(Constants.BUNDLE_SYMBOLICNAME, "MyComponent")
                                 .build(IPOJOStrategy.withiPOJO())
                 )
@@ -70,7 +70,7 @@ public class TestEmptyConfiguration exte
     public void testConfiguration() throws InterruptedException {
         TimeUtils.grace(1000);
         // Check configuration
-        Assert.assertNull(osgiHelper.getServiceReference(FooService.class));
+        Assert.assertNotNull(osgiHelper.getServiceReference(FooService.class));
     }
 
 

Modified: felix/trunk/ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/configuration/Instance.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/configuration/Instance.java?rev=1528105&r1=1528104&r2=1528105&view=diff
==============================================================================
--- felix/trunk/ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/configuration/Instance.java
(original)
+++ felix/trunk/ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/configuration/Instance.java
Tue Oct  1 14:33:34 2013
@@ -62,8 +62,10 @@ public class Instance {
 
     public Dictionary<String, Object> configuration() {
         Hashtable<String, Object> configuration = new Hashtable<String, Object>();
-        for (Property property : this.configuration) {
-            configuration.put(property.name, property.value);
+        if (this.configuration != null) {
+            for (Property property : this.configuration) {
+                configuration.put(property.name, property.value);
+            }
         }
 
         if (name != null) {



Mime
View raw message