Author: clement
Date: Wed Feb 27 17:34:45 2013
New Revision: 1450878

URL: http://svn.apache.org/r1450878
Log:
FELIX-3903 - avoid using classes requiring Swing or AWT, it makes headless CI 
unhappy

Modified:
    
felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderWithAnonymousClass.java
    
felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestPropertiesInAnonymousClass.java

Modified: 
felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderWithAnonymousClass.java
URL: 
http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderWithAnonymousClass.java?rev=1450878&r1=1450877&r2=1450878&view=diff
==============================================================================
--- 
felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderWithAnonymousClass.java
 (original)
+++ 
felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderWithAnonymousClass.java
 Wed Feb 27 17:34:45 2013
@@ -20,78 +20,94 @@ package org.apache.felix.ipojo.runtime.c
 
 import org.apache.felix.ipojo.runtime.core.services.FooService;
 
-import javax.swing.*;
 import java.util.Properties;
 
 public class FooProviderWithAnonymousClass implements FooService {
 
-       private int intProp;
-       private String strProp;
-       private String[] strAProp;
-       private int[] intAProp;
-       private boolean boolProp;
-
-       public boolean foo() {
-               Runnable runnable = 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};
-                       }
-               };
-               new Thread(runnable).start();
-
-               try {
-                       Thread.sleep(500);
-               } catch (InterruptedException e) {
-                       e.printStackTrace();
-               }
-
-               return true;
-       }
-
-       public Properties fooProps() {
-               Properties p = new Properties();
-               p.put("intProp", new Integer(intProp));
-               p.put("boolProp", new Boolean(boolProp));
-               p.put("strProp", strProp);
-               p.put("strAProp", strAProp);
-               p.put("intAProp", intAProp);
-               return p;
-       }
-
-       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; }
-
-       public int getInt() { return 1; }
-
-       public long getLong() { return 1; }
-
-       public Boolean getObject() { return new Boolean(true); }
-
+    private int intProp;
+    private String strProp;
+    private String[] strAProp;
+    private int[] intAProp;
+    private boolean boolProp;
+
+    public boolean foo() {
+        Runnable runnable = 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};
+            }
+        };
+        new Thread(runnable).start();
+
+        try {
+            Thread.sleep(500);
+        } catch (InterruptedException e) {
+            e.printStackTrace();
+        }
+
+        return true;
+    }
+
+    public Properties fooProps() {
+        Properties p = new Properties();
+        p.put("intProp", new Integer(intProp));
+        p.put("boolProp", new Boolean(boolProp));
+        p.put("strProp", strProp);
+        p.put("strAProp", strAProp);
+        p.put("intAProp", intAProp);
+        return p;
+    }
+
+    public boolean getBoolean() {
+        Runnable runnable = new Runnable() {
+            @Override
+            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};
+            }
+        };
+
+        Thread thread = new Thread(runnable);
+        thread.start();
+
+        try {
+            Thread.sleep(500);
+        } catch (InterruptedException e) {
+            e.printStackTrace();
+        }
+
+        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);
+    }
 
 
 }

Modified: 
felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestPropertiesInAnonymousClass.java
URL: 
http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestPropertiesInAnonymousClass.java?rev=1450878&r1=1450877&r2=1450878&view=diff
==============================================================================
--- 
felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestPropertiesInAnonymousClass.java
 (original)
+++ 
felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestPropertiesInAnonymousClass.java
 Wed Feb 27 17:34:45 2013
@@ -82,7 +82,7 @@ public class TestPropertiesInAnonymousCl
     }
 
     @Test
-    public void testSwingWorker() {
+    public void testWorkerThread() {
         ServiceReference sr = 
ipojoHelper.getServiceReferenceByName(FooService.class.getName(), 
"FooProviderAno-1");
         assertNotNull("Check the availability of the FS service", sr);
 


Reply via email to