Try to reproduce FELIX-2296, the configuration seems to work correctly.

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@941589 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/ipojo/tests/core/service-providing/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FooProviderWithAnonymousClass.java b/ipojo/tests/core/service-providing/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FooProviderWithAnonymousClass.java
index a41b2f1..351871c 100644
--- a/ipojo/tests/core/service-providing/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FooProviderWithAnonymousClass.java
+++ b/ipojo/tests/core/service-providing/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FooProviderWithAnonymousClass.java
@@ -20,6 +20,8 @@
 

 import java.util.Properties;

 

+import javax.swing.SwingUtilities;

+

 import org.apache.felix.ipojo.test.scenarios.ps.service.FooService;

 

 public class FooProviderWithAnonymousClass implements FooService {

@@ -62,7 +64,26 @@
 		return p;

 	}

 

-	public boolean getBoolean() { return true; }

+	public boolean getBoolean() {

+		SwingUtilities.invokeLater(new Runnable() {

+			public void run() {

+				intProp = 3;

+				boolProp = true;

+				if(strProp.equals("foo")) { strProp = "bar"; }

+				else { strProp = "foo"; }

+				strAProp = new String[] {"foo", "bar", "baz"};

+				intAProp = new int[] {3, 2, 1};

+			}

+		});

+

+		try {

+			Thread.sleep(500);

+		} catch (InterruptedException e) {

+			e.printStackTrace();

+		}

+

+		return true;

+	}

 

 	public double getDouble() { return 1.0; }

 

diff --git a/ipojo/tests/core/service-providing/src/main/java/org/apache/felix/ipojo/test/scenarios/ps/PropertiesInAnonymousClassTest.java b/ipojo/tests/core/service-providing/src/main/java/org/apache/felix/ipojo/test/scenarios/ps/PropertiesInAnonymousClassTest.java
index 8c3111c..d40599e 100644
--- a/ipojo/tests/core/service-providing/src/main/java/org/apache/felix/ipojo/test/scenarios/ps/PropertiesInAnonymousClassTest.java
+++ b/ipojo/tests/core/service-providing/src/main/java/org/apache/felix/ipojo/test/scenarios/ps/PropertiesInAnonymousClassTest.java
@@ -20,7 +20,7 @@
 		helper.dispose();
 	}
 
-	public void testProperties1() {
+	public void testRunnable() {
 		ServiceReference sr = helper.getServiceReferenceByName(FooService.class.getName(), "FooProviderAno-1");
 		assertNotNull("Check the availability of the FS service", sr);
 
@@ -74,4 +74,58 @@
 		fs = null;
 	}
 
+	public void testSwingWorker() {
+		ServiceReference sr = helper.getServiceReferenceByName(FooService.class.getName(), "FooProviderAno-1");
+		assertNotNull("Check the availability of the FS service", sr);
+
+		// Check service properties
+		Integer intProp = (Integer) sr.getProperty("int");
+		Boolean boolProp = (Boolean) sr.getProperty("boolean");
+		String strProp = (String) sr.getProperty("string");
+		String[] strAProp = (String[]) sr.getProperty("strAProp");
+		int[] intAProp = (int[]) sr.getProperty("intAProp");
+
+		assertEquals("Check intProp equality (1)", intProp, new Integer(2));
+		assertEquals("Check longProp equality (1)", boolProp, new Boolean(false));
+		assertEquals("Check strProp equality (1)", strProp, new String("foo"));
+		assertNotNull("Check strAProp not nullity (1)", strAProp);
+		String[] v = new String[] {"foo", "bar"};
+		for (int i = 0; i < strAProp.length; i++) {
+			if(!strAProp[i].equals(v[i])) { fail("Check the strAProp Equality (1)"); }
+		}
+		assertNotNull("Check intAProp not nullity", intAProp);
+		int[] v2 = new int[] {1, 2, 3};
+		for (int i = 0; i < intAProp.length; i++) {
+			if(intAProp[i] != v2[i]) { fail("Check the intAProp Equality (1)"); }
+		}
+
+		// Invoke
+		FooService fs = (FooService) getServiceObject(sr);
+		assertTrue("invoke fs", fs.getBoolean());
+
+		sr = helper.getServiceReferenceByName(FooService.class.getName(), "FooProviderAno-1");
+		// Re-check the property (change)
+		intProp = (Integer) sr.getProperty("int");
+		boolProp = (Boolean) sr.getProperty("boolean");
+		strProp = (String) sr.getProperty("string");
+		strAProp = (String[]) sr.getProperty("strAProp");
+		intAProp = (int[]) sr.getProperty("intAProp");
+
+		assertEquals("Check intProp equality (2)", intProp, new Integer(3));
+		assertEquals("Check longProp equality (2)", boolProp, new Boolean(true));
+		assertEquals("Check strProp equality (2)", strProp, new String("bar"));
+		assertNotNull("Check strAProp not nullity (2)", strAProp);
+		v = new String[] {"foo", "bar", "baz"};
+		for (int i = 0; i < strAProp.length; i++) {
+			if(!strAProp[i].equals(v[i])) { fail("Check the strAProp Equality (2)"); }
+		}
+		assertNotNull("Check intAProp not nullity (2)", intAProp);
+		v2 = new int[] {3, 2, 1};
+		for (int i = 0; i < intAProp.length; i++) {
+			if(intAProp[i] != v2[i]) { fail("Check the intAProp Equality (2)"); }
+		}
+
+		fs = null;
+	}
+
 }