Author: ningjiang
Date: Wed Jan 7 17:52:47 2009
New Revision: 732589
URL: http://svn.apache.org/viewvc?rev=732589&view=rev
Log:
CAMEL-1231 Added unit test for camel-osgi component
Modified:
activemq/camel/trunk/components/camel-osgi/pom.xml
activemq/camel/trunk/components/camel-osgi/src/main/java/org/apache/camel/osgi/Activator.java
activemq/camel/trunk/components/camel-osgi/src/main/java/org/apache/camel/osgi/OsgiFactoryFinder.java
activemq/camel/trunk/pom.xml
Modified: activemq/camel/trunk/components/camel-osgi/pom.xml
URL:
http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-osgi/pom.xml?rev=732589&r1=732588&r2=732589&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-osgi/pom.xml (original)
+++ activemq/camel/trunk/components/camel-osgi/pom.xml Wed Jan 7 17:52:47 2009
@@ -93,7 +93,7 @@
</dependency>
<dependency>
<groupId>org.springframework.osgi</groupId>
- <artifactId>spring-osgi-test</artifactId>
+ <artifactId>spring-osgi-mock</artifactId>
<scope>test</scope>
</dependency>
Modified:
activemq/camel/trunk/components/camel-osgi/src/main/java/org/apache/camel/osgi/Activator.java
URL:
http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-osgi/src/main/java/org/apache/camel/osgi/Activator.java?rev=732589&r1=732588&r2=732589&view=diff
==============================================================================
---
activemq/camel/trunk/components/camel-osgi/src/main/java/org/apache/camel/osgi/Activator.java
(original)
+++
activemq/camel/trunk/components/camel-osgi/src/main/java/org/apache/camel/osgi/Activator.java
Wed Jan 7 17:52:47 2009
@@ -40,12 +40,12 @@
import org.springframework.osgi.util.BundleDelegatingClassLoader;
public class Activator implements BundleActivator, SynchronousBundleListener {
- public static final String META_INF_TYPE_CONVERTER =
"/META-INF/services/org/apache/camel/TypeConverter";
- public static final String META_INF_COMPONENT =
"/META-INF/services/org/apache/camel/component/";
- public static final String META_INF_LANGUAGE =
"/META-INF/services/org/apache/camel/language/";
+ public static final String META_INF_TYPE_CONVERTER =
"META-INF/services/org/apache/camel/TypeConverter";
+ public static final String META_INF_COMPONENT =
"META-INF/services/org/apache/camel/component/";
+ public static final String META_INF_LANGUAGE =
"META-INF/services/org/apache/camel/language/";
private static final transient Log LOG =
LogFactory.getLog(Activator.class);
private static final Map<String, ComponentEntry> COMPONENTS = new
HashMap<String, ComponentEntry>();
- private static final Map<Bundle, TypeConverterEntry> TYPE_CONVERTERS = new
HashMap<Bundle, TypeConverterEntry>();
+ private static final Map<URL, TypeConverterEntry> TYPE_CONVERTERS = new
HashMap<URL, TypeConverterEntry>();
private static final Map<String, ComponentEntry> LANGUAGES = new
HashMap<String, ComponentEntry>();
private static Bundle bundle;
@@ -120,7 +120,7 @@
entry.bundle = bundle;
entry.resource = resource;
entry.converterPackages = getConverterPackages(resource);
- TYPE_CONVERTERS.put(bundle, entry);
+ TYPE_CONVERTERS.put(resource, entry);
}
}
} catch (IOException ignore) {
@@ -152,7 +152,7 @@
if (LOG.isDebugEnabled()) {
LOG.debug("Removing entry: " + entry.resource + " in
bundle " + bundle.getSymbolicName());
}
- COMPONENTS.remove(bundle);
+ COMPONENTS.remove(entry.resource);
}
}
}
Modified:
activemq/camel/trunk/components/camel-osgi/src/main/java/org/apache/camel/osgi/OsgiFactoryFinder.java
URL:
http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-osgi/src/main/java/org/apache/camel/osgi/OsgiFactoryFinder.java?rev=732589&r1=732588&r2=732589&view=diff
==============================================================================
---
activemq/camel/trunk/components/camel-osgi/src/main/java/org/apache/camel/osgi/OsgiFactoryFinder.java
(original)
+++
activemq/camel/trunk/components/camel-osgi/src/main/java/org/apache/camel/osgi/OsgiFactoryFinder.java
Wed Jan 7 17:52:47 2009
@@ -79,12 +79,12 @@
}
- public BundleEntry getResource(String path) {
+ public BundleEntry getResource(String name) {
URL url = null;
BundleEntry entry = null;
BundleContext bundleContext =
Activator.getBundle().getBundleContext();
- for (Bundle bundle : bundleContext.getBundles()) {
- url = bundle.getEntry(path);
+ for (Bundle bundle : bundleContext.getBundles()) {
+ url = bundle.getEntry(getPath() + name);
if (url != null) {
entry = new BundleEntry();
entry.url = url;
Modified: activemq/camel/trunk/pom.xml
URL:
http://svn.apache.org/viewvc/activemq/camel/trunk/pom.xml?rev=732589&r1=732588&r2=732589&view=diff
==============================================================================
--- activemq/camel/trunk/pom.xml (original)
+++ activemq/camel/trunk/pom.xml Wed Jan 7 17:52:47 2009
@@ -747,7 +747,7 @@
<dependency>
<groupId>org.springframework.osgi</groupId>
- <artifactId>spring-osgi-test</artifactId>
+ <artifactId>spring-osgi-mock</artifactId>
<version>${spring-osgi-version}</version>
</dependency>