You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by rf...@apache.org on 2009/08/06 18:29:21 UTC

svn commit: r801708 - in /tuscany/java/sca/modules/node-launcher-equinox/src: main/java/org/apache/tuscany/sca/node/equinox/launcher/FrameworkLauncher.java test/java/org/apache/tuscany/sca/node/equinox/launcher/EquinoxOSGiHostTestCase.java

Author: rfeng
Date: Thu Aug  6 16:29:21 2009
New Revision: 801708

URL: http://svn.apache.org/viewvc?rev=801708&view=rev
Log:
Reenable the EquinoxHost test case that was ignored due to NPE

Modified:
    tuscany/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/FrameworkLauncher.java
    tuscany/java/sca/modules/node-launcher-equinox/src/test/java/org/apache/tuscany/sca/node/equinox/launcher/EquinoxOSGiHostTestCase.java

Modified: tuscany/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/FrameworkLauncher.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/FrameworkLauncher.java?rev=801708&r1=801707&r2=801708&view=diff
==============================================================================
--- tuscany/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/FrameworkLauncher.java (original)
+++ tuscany/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/FrameworkLauncher.java Thu Aug  6 16:29:21 2009
@@ -38,6 +38,8 @@
  * Launcher for the OSGi framework using the framework launch APIs
  */
 public class FrameworkLauncher implements BundleActivator {
+    private static final String FACTORY_RESOURCE = "META-INF/services/" + FrameworkFactory.class.getName();
+
     private static final Logger logger = Logger.getLogger(FrameworkLauncher.class.getName());
 
     private FrameworkFactory factory;
@@ -46,14 +48,12 @@
     @SuppressWarnings("unchecked")
     private synchronized FrameworkFactory loadFrameworkFactory() {
         if (factory == null) {
-            // Use reflection APIs to call ServiceDiscovery to avoid hard dependency to tuscany-extensibility
             try {
-                ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
-                InputStream is =
-                    classLoader.getResourceAsStream("META-INF/services/" + FrameworkFactory.class.getName());
+                ClassLoader classLoader = FrameworkFactory.class.getClassLoader();
+                InputStream is = classLoader.getResourceAsStream(FACTORY_RESOURCE);
                 if (is == null) {
-                    classLoader = FrameworkFactory.class.getClassLoader();
-                    is = classLoader.getResourceAsStream("META-INF/services/" + FrameworkFactory.class.getName());
+                    classLoader = Thread.currentThread().getContextClassLoader();
+                    is = classLoader.getResourceAsStream(FACTORY_RESOURCE);
                 }
                 if (is == null) {
                     return null;
@@ -61,7 +61,7 @@
                 BufferedReader reader = null;
                 String line = null;
                 try {
-                    reader = new BufferedReader(new InputStreamReader(is));
+                    reader = new BufferedReader(new InputStreamReader(is, "UTF-8"));
                     while (true) {
                         line = reader.readLine();
                         if (line == null)

Modified: tuscany/java/sca/modules/node-launcher-equinox/src/test/java/org/apache/tuscany/sca/node/equinox/launcher/EquinoxOSGiHostTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/node-launcher-equinox/src/test/java/org/apache/tuscany/sca/node/equinox/launcher/EquinoxOSGiHostTestCase.java?rev=801708&r1=801707&r2=801708&view=diff
==============================================================================
--- tuscany/java/sca/modules/node-launcher-equinox/src/test/java/org/apache/tuscany/sca/node/equinox/launcher/EquinoxOSGiHostTestCase.java (original)
+++ tuscany/java/sca/modules/node-launcher-equinox/src/test/java/org/apache/tuscany/sca/node/equinox/launcher/EquinoxOSGiHostTestCase.java Thu Aug  6 16:29:21 2009
@@ -23,16 +23,14 @@
 import java.util.Enumeration;
 
 import org.junit.Assert;
-import org.junit.Ignore;
 import org.junit.Test;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 
 
 /**
- * 
+ * Test case for equinox host
  */
-@Ignore
 public class EquinoxOSGiHostTestCase {
 
     @Test