You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by da...@apache.org on 2011/04/10 02:10:38 UTC
svn commit: r1090720 - in /aries/trunk/spi-fly:
spi-fly-core/src/main/java/org/apache/aries/spifly/
spi-fly-dynamic-bundle/src/main/java/org/apache/aries/spifly/dynamic/
spi-fly-dynamic-bundle/src/test/java/org/apache/aries/spifly/dynamic/
Author: davidb
Date: Sun Apr 10 00:10:38 2011
New Revision: 1090720
URL: http://svn.apache.org/viewvc?rev=1090720&view=rev
Log:
Another SPI Fly test passing.
Modified:
aries/trunk/spi-fly/spi-fly-core/src/main/java/org/apache/aries/spifly/BaseActivator.java
aries/trunk/spi-fly/spi-fly-core/src/main/java/org/apache/aries/spifly/BundleDescriptor.java
aries/trunk/spi-fly/spi-fly-core/src/main/java/org/apache/aries/spifly/ConsumerBundleTrackerCustomizer.java
aries/trunk/spi-fly/spi-fly-core/src/main/java/org/apache/aries/spifly/ConsumerHeaderProcessor.java
aries/trunk/spi-fly/spi-fly-dynamic-bundle/src/main/java/org/apache/aries/spifly/dynamic/ClientWeavingHook.java
aries/trunk/spi-fly/spi-fly-dynamic-bundle/src/test/java/org/apache/aries/spifly/dynamic/ClientWeavingHookTest.java
Modified: aries/trunk/spi-fly/spi-fly-core/src/main/java/org/apache/aries/spifly/BaseActivator.java
URL: http://svn.apache.org/viewvc/aries/trunk/spi-fly/spi-fly-core/src/main/java/org/apache/aries/spifly/BaseActivator.java?rev=1090720&r1=1090719&r2=1090720&view=diff
==============================================================================
--- aries/trunk/spi-fly/spi-fly-core/src/main/java/org/apache/aries/spifly/BaseActivator.java (original)
+++ aries/trunk/spi-fly/spi-fly-core/src/main/java/org/apache/aries/spifly/BaseActivator.java Sun Apr 10 00:10:38 2011
@@ -77,13 +77,13 @@ public abstract class BaseActivator impl
consumerBundleTracker.open();
for (Bundle bundle : context.getBundles()) {
- addWeavingData(bundle, consumerHeaderName);
+ addConsumerWeavingData(bundle, consumerHeaderName);
}
activator = this;
}
- public void addWeavingData(Bundle bundle, String consumerHeaderName) {
+ public void addConsumerWeavingData(Bundle bundle, String consumerHeaderName) {
if (bundleWeavingData.containsKey(bundle)) {
// This bundle was already processed
return;
@@ -190,10 +190,16 @@ public abstract class BaseActivator impl
List<Bundle> bundles = new ArrayList<Bundle>();
for (Bundle b : bundleContext.getBundles()) {
for (BundleDescriptor desc : descriptors) {
- if (b.getSymbolicName().equals(desc.getSymbolicName())) {
- if (desc.getVersion() == null || b.getVersion().equals(desc.getVersion())) {
+ if (desc.getBundleID() != BundleDescriptor.BUNDLE_ID_UNSPECIFIED) {
+ if (b.getBundleId() == desc.getBundleID()) {
bundles.add(b);
}
+ } else {
+ if (b.getSymbolicName().equals(desc.getSymbolicName())) {
+ if (desc.getVersion() == null || b.getVersion().equals(desc.getVersion())) {
+ bundles.add(b);
+ }
+ }
}
}
}
Modified: aries/trunk/spi-fly/spi-fly-core/src/main/java/org/apache/aries/spifly/BundleDescriptor.java
URL: http://svn.apache.org/viewvc/aries/trunk/spi-fly/spi-fly-core/src/main/java/org/apache/aries/spifly/BundleDescriptor.java?rev=1090720&r1=1090719&r2=1090720&view=diff
==============================================================================
--- aries/trunk/spi-fly/spi-fly-core/src/main/java/org/apache/aries/spifly/BundleDescriptor.java (original)
+++ aries/trunk/spi-fly/spi-fly-core/src/main/java/org/apache/aries/spifly/BundleDescriptor.java Sun Apr 10 00:10:38 2011
@@ -21,9 +21,12 @@ package org.apache.aries.spifly;
import org.osgi.framework.Version;
class BundleDescriptor {
+ public static final int BUNDLE_ID_UNSPECIFIED = -1;
+
final String symbolicName;
final Version version;
-
+ final long bundleID;
+
BundleDescriptor(String symbolicName) {
this(symbolicName, null);
}
@@ -31,6 +34,17 @@ class BundleDescriptor {
BundleDescriptor(String symbolicName, Version version) {
this.symbolicName = symbolicName;
this.version = version;
+ this.bundleID = BUNDLE_ID_UNSPECIFIED;
+ }
+
+ BundleDescriptor(long bundleID) {
+ this.bundleID = bundleID;
+ this.symbolicName = null;
+ this.version = null;
+ }
+
+ public long getBundleID() {
+ return bundleID;
}
public String getSymbolicName() {
Modified: aries/trunk/spi-fly/spi-fly-core/src/main/java/org/apache/aries/spifly/ConsumerBundleTrackerCustomizer.java
URL: http://svn.apache.org/viewvc/aries/trunk/spi-fly/spi-fly-core/src/main/java/org/apache/aries/spifly/ConsumerBundleTrackerCustomizer.java?rev=1090720&r1=1090719&r2=1090720&view=diff
==============================================================================
--- aries/trunk/spi-fly/spi-fly-core/src/main/java/org/apache/aries/spifly/ConsumerBundleTrackerCustomizer.java (original)
+++ aries/trunk/spi-fly/spi-fly-core/src/main/java/org/apache/aries/spifly/ConsumerBundleTrackerCustomizer.java Sun Apr 10 00:10:38 2011
@@ -33,7 +33,7 @@ public class ConsumerBundleTrackerCustom
@Override
public Object addingBundle(Bundle bundle, BundleEvent event) {
- activator.addWeavingData(bundle, headerName);
+ activator.addConsumerWeavingData(bundle, headerName);
return bundle;
}
Modified: aries/trunk/spi-fly/spi-fly-core/src/main/java/org/apache/aries/spifly/ConsumerHeaderProcessor.java
URL: http://svn.apache.org/viewvc/aries/trunk/spi-fly/spi-fly-core/src/main/java/org/apache/aries/spifly/ConsumerHeaderProcessor.java?rev=1090720&r1=1090719&r2=1090720&view=diff
==============================================================================
--- aries/trunk/spi-fly/spi-fly-core/src/main/java/org/apache/aries/spifly/ConsumerHeaderProcessor.java (original)
+++ aries/trunk/spi-fly/spi-fly-core/src/main/java/org/apache/aries/spifly/ConsumerHeaderProcessor.java Sun Apr 10 00:10:38 2011
@@ -31,34 +31,34 @@ public class ConsumerHeaderProcessor {
/**
* Parses headers of the following syntax:
* <ul>
- * <li><tt>org.acme.MyClass#myMethod</tt> - apply the weaving to all overloads of <tt>myMethod()</tt>
+ * <li><tt>org.acme.MyClass#myMethod</tt> - apply the weaving to all overloads of <tt>myMethod()</tt>
* in <tt>MyClass</tt>
- * <li><tt>org.acme.MyClass#myMethod(java.lang.String, java.util.List)</tt> - apply the weaving only
+ * <li><tt>org.acme.MyClass#myMethod(java.lang.String, java.util.List)</tt> - apply the weaving only
* to the <tt>myMethod(String, List)</tt> overload in <tt>MyClass</tt>
- * <li><tt>org.acme.MyClass#myMethod()</tt> - apply the weaving only to the noarg overload of
+ * <li><tt>org.acme.MyClass#myMethod()</tt> - apply the weaving only to the noarg overload of
* <tt>myMethod()</tt>
* <li><b>true</b> - equivalent to <tt>java.util.ServiceLoader#load(java.lang.Class)</tt>
* </ul>
- * Additionally, it registers the consumer's constraints with the consumer registry in the activator, if the
+ * Additionally, it registers the consumer's constraints with the consumer registry in the activator, if the
* consumer is only constrained to a certain set of bundles.<p/>
- *
+ *
* The following attributes are supported:
* <ul>
- * <li><tt>bundle</tt> - restrict wiring to the bundle with the specifies Symbolic Name. The attribute value
+ * <li><tt>bundle</tt> - restrict wiring to the bundle with the specifies Symbolic Name. The attribute value
* is a list of bundle identifiers separated by a '|' sign. The bundle identifier starts with the Symbolic name
- * and can optionally contain a version suffix. E.g. bundle=impl2:version=1.2.3 or bundle=impl2|impl4.
- * <li><tt>bundleId</tt> - restrict wiring to the bundle with the specified bundle ID. Typically used when
- * the service should be forceably picked up from the system bundle (<tt>bundleId=0</tt>). Multiple bundle IDs
- * can be specified separated by a '|' sign.
+ * and can optionally contain a version suffix. E.g. bundle=impl2:version=1.2.3 or bundle=impl2|impl4.
+ * <li><tt>bundleId</tt> - restrict wiring to the bundle with the specified bundle ID. Typically used when
+ * the service should be forceably picked up from the system bundle (<tt>bundleId=0</tt>). Multiple bundle IDs
+ * can be specified separated by a '|' sign.
* </ul>
- *
+ *
* @param consumerBundle the consuming bundle.
* @param consumerHeader the <tt>SPI-Consumer</tt> header.
* @return an instance of the {@link WeavingData} class.
*/
- public static Set<WeavingData> processHeader(/* Bundle consumerBundle, */String consumerHeader) {
+ public static Set<WeavingData> processHeader(String consumerHeader) {
Set<WeavingData> weavingData = new HashSet<WeavingData>();
-
+
for (PathElement element : HeaderParser.parseHeader(consumerHeader)) {
List<BundleDescriptor> allowedBundles = new ArrayList<BundleDescriptor>();
String name = element.getName().trim();
@@ -66,9 +66,9 @@ public class ConsumerHeaderProcessor {
String className;
String methodName;
MethodRestriction methodRestriction;
-
+
int hashIdx = name.indexOf('#');
- if (hashIdx > 0) {
+ if (hashIdx > 0) {
className = name.substring(0, hashIdx);
int braceIdx = name.substring(hashIdx).indexOf('(');
if (braceIdx > 0) {
@@ -115,12 +115,12 @@ public class ConsumerHeaderProcessor {
} else {
throw new IllegalArgumentException("Must at least specify class name and method name: " + name);
}
- }
+ }
ConsumerRestriction restriction = new ConsumerRestriction(className, methodRestriction);
Set<ConsumerRestriction> restrictions = new HashSet<ConsumerRestriction>();
restrictions.add(restriction);
-
+
String bsn = element.getAttribute("bundle");
if (bsn != null) {
bsn = bsn.trim();
@@ -131,7 +131,7 @@ public class ConsumerHeaderProcessor {
String sn = s.substring(0, colonIdx);
String versionSfx = s.substring(colonIdx + 1);
if (versionSfx.startsWith("version=")) {
- allowedBundles.add(new BundleDescriptor(sn,
+ allowedBundles.add(new BundleDescriptor(sn,
Version.parseVersion(versionSfx.substring("version=".length()))));
} else {
allowedBundles.add(new BundleDescriptor(sn));
@@ -142,31 +142,21 @@ public class ConsumerHeaderProcessor {
}
}
}
-
- // TODO this cannot be done this way with static weaving...
- /*
+
String bid = element.getAttribute("bundleId");
if (bid != null) {
bid = bid.trim();
if (bid.length() > 0) {
for (String s : bid.split("\\|")) {
- for (Bundle b : consumerBundle.getBundleContext().getBundles()) {
- if (("" + b.getBundleId()).equals(s)) {
- allowedBundles.add(new BundleDescriptor(b.getSymbolicName()));
- break;
- }
- }
+ allowedBundles.add(new BundleDescriptor(Long.parseLong(s)));
}
}
}
- */
-
-// Activator.activator.registerConsumerBundle(consumerBundle, restrictions,
-// allowedBundles.size() == 0 ? null : allowedBundles);
+
// TODO this can be done in the WeavingData itself?
String[] argClasses = restriction.getMethodRestriction(methodName).getArgClasses();
- weavingData.add(new WeavingData(className, methodName, argClasses, restrictions,
+ weavingData.add(new WeavingData(className, methodName, argClasses, restrictions,
allowedBundles.size() == 0 ? null : allowedBundles));
}
return weavingData;
Modified: aries/trunk/spi-fly/spi-fly-dynamic-bundle/src/main/java/org/apache/aries/spifly/dynamic/ClientWeavingHook.java
URL: http://svn.apache.org/viewvc/aries/trunk/spi-fly/spi-fly-dynamic-bundle/src/main/java/org/apache/aries/spifly/dynamic/ClientWeavingHook.java?rev=1090720&r1=1090719&r2=1090720&view=diff
==============================================================================
--- aries/trunk/spi-fly/spi-fly-dynamic-bundle/src/main/java/org/apache/aries/spifly/dynamic/ClientWeavingHook.java (original)
+++ aries/trunk/spi-fly/spi-fly-dynamic-bundle/src/main/java/org/apache/aries/spifly/dynamic/ClientWeavingHook.java Sun Apr 10 00:10:38 2011
@@ -34,35 +34,33 @@ import org.osgi.service.log.LogService;
public class ClientWeavingHook implements WeavingHook {
private final String addedImport;
private final DynamicWeavingActivator activator;
-
+
ClientWeavingHook(BundleContext context, DynamicWeavingActivator dwActivator) {
activator = dwActivator;
-
+
Bundle b = context.getBundle();
String bver = b.getVersion().toString();
String bsn = b.getSymbolicName();
-
- addedImport = Util.class.getPackage().getName() +
- ";bundle-symbolic-name=" + bsn +
+
+ addedImport = Util.class.getPackage().getName() +
+ ";bundle-symbolic-name=" + bsn +
";bundle-version=" + bver;
}
-
+
@Override
public void weave(WovenClass wovenClass) {
Bundle consumerBundle = wovenClass.getBundleWiring().getBundle();
Set<WeavingData> wd = activator.getWeavingData(consumerBundle);
if (wd != null) {
- activator.log(LogService.LOG_DEBUG, "Weaving class " + wovenClass.getClassName());
-
-// WeavingData[] wd = ConsumerHeaderProcessor.processHeader(consumerBundle, consumerHeader);
-
+ activator.log(LogService.LOG_DEBUG, "Weaving class " + wovenClass.getClassName());
+
ClassReader cr = new ClassReader(wovenClass.getBytes());
ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS | ClassWriter.COMPUTE_FRAMES);
TCCLSetterVisitor tsv = new TCCLSetterVisitor(cw, wovenClass.getClassName(), wd);
- cr.accept(tsv, 0);
+ cr.accept(tsv, 0);
wovenClass.setBytes(cw.toByteArray());
if (tsv.additionalImportRequired())
wovenClass.getDynamicImports().add(addedImport);
- }
+ }
}
}
Modified: aries/trunk/spi-fly/spi-fly-dynamic-bundle/src/test/java/org/apache/aries/spifly/dynamic/ClientWeavingHookTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/spi-fly/spi-fly-dynamic-bundle/src/test/java/org/apache/aries/spifly/dynamic/ClientWeavingHookTest.java?rev=1090720&r1=1090719&r2=1090720&view=diff
==============================================================================
--- aries/trunk/spi-fly/spi-fly-dynamic-bundle/src/test/java/org/apache/aries/spifly/dynamic/ClientWeavingHookTest.java (original)
+++ aries/trunk/spi-fly/spi-fly-dynamic-bundle/src/test/java/org/apache/aries/spifly/dynamic/ClientWeavingHookTest.java Sun Apr 10 00:10:38 2011
@@ -80,7 +80,7 @@ public class ClientWeavingHookTest {
activator.registerProviderBundle("org.apache.aries.mytest.MySPI", providerBundle);
Bundle consumerBundle = mockConsumerBundle(consumerHeaders, providerBundle);
- activator.addWeavingData(consumerBundle, SpiFlyConstants.SPI_CONSUMER_HEADER);
+ activator.addConsumerWeavingData(consumerBundle, SpiFlyConstants.SPI_CONSUMER_HEADER);
Bundle spiFlyBundle = mockSpiFlyBundle("spifly", Version.parseVersion("1.9.4"), consumerBundle, providerBundle);
WeavingHook wh = new ClientWeavingHook(spiFlyBundle.getBundleContext(), activator);
@@ -147,7 +147,7 @@ public class ClientWeavingHookTest {
headers.put(SpiFlyConstants.SPI_CONSUMER_HEADER, "*");
Bundle consumerBundle = mockConsumerBundle(headers, spiFlyBundle);
- activator.addWeavingData(consumerBundle, SpiFlyConstants.SPI_CONSUMER_HEADER);
+ activator.addConsumerWeavingData(consumerBundle, SpiFlyConstants.SPI_CONSUMER_HEADER);
WeavingHook wh = new ClientWeavingHook(spiFlyBundle.getBundleContext(), activator);
@@ -182,12 +182,14 @@ public class ClientWeavingHookTest {
activator.registerProviderBundle("org.apache.aries.mytest.MySPI", providerBundle2);
Bundle consumerBundle = mockConsumerBundle(headers, providerBundle1, providerBundle2);
+ activator.addConsumerWeavingData(consumerBundle, SpiFlyConstants.SPI_CONSUMER_HEADER);
+
Bundle spiFlyBundle = mockSpiFlyBundle(consumerBundle, providerBundle1, providerBundle2);
WeavingHook wh = new ClientWeavingHook(spiFlyBundle.getBundleContext(), activator);
// Weave the TestClient class.
URL clsUrl = getClass().getResource("TestClient.class");
- WovenClass wc = new MyWovenClass(clsUrl, "org.apache.aries.spifly.TestClient", consumerBundle);
+ WovenClass wc = new MyWovenClass(clsUrl, "org.apache.aries.spifly.dynamic.TestClient", consumerBundle);
wh.weave(wc);
// Invoke the woven class and check that it propertly sets the TCCL so that the
@@ -211,12 +213,13 @@ public class ClientWeavingHookTest {
activator.registerProviderBundle("org.apache.aries.mytest.MySPI", providerBundle3);
Bundle consumerBundle = mockConsumerBundle(headers, providerBundle1, providerBundle2, providerBundle3);
+ activator.addConsumerWeavingData(consumerBundle, SpiFlyConstants.SPI_CONSUMER_HEADER);
Bundle spiFlyBundle = mockSpiFlyBundle(consumerBundle, providerBundle1, providerBundle2, providerBundle3);
WeavingHook wh = new ClientWeavingHook(spiFlyBundle.getBundleContext(), activator);
// Weave the TestClient class.
URL clsUrl = getClass().getResource("TestClient.class");
- WovenClass wc = new MyWovenClass(clsUrl, "org.apache.aries.spifly.TestClient", consumerBundle);
+ WovenClass wc = new MyWovenClass(clsUrl, "org.apache.aries.spifly.dynamic.TestClient", consumerBundle);
wh.weave(wc);
// Invoke the woven class and check that it propertly sets the TCCL so that the
@@ -243,12 +246,13 @@ public class ClientWeavingHookTest {
activator.registerProviderBundle("org.apache.aries.mytest.AltSPI", providerBundle4);
Bundle consumerBundle = mockConsumerBundle(headers, providerBundle1, providerBundle2, providerBundle4);
+ activator.addConsumerWeavingData(consumerBundle, SpiFlyConstants.SPI_CONSUMER_HEADER);
Bundle spiFlyBundle = mockSpiFlyBundle(consumerBundle, providerBundle1, providerBundle2, providerBundle4);
WeavingHook wh = new ClientWeavingHook(spiFlyBundle.getBundleContext(), activator);
// Weave the TestClient class.
URL clsUrl = getClass().getResource("TestClient.class");
- WovenClass wc = new MyWovenClass(clsUrl, "org.apache.aries.spifly.TestClient", consumerBundle);
+ WovenClass wc = new MyWovenClass(clsUrl, "org.apache.aries.spifly.dynamic.TestClient", consumerBundle);
wh.weave(wc);
// Invoke the woven class and check that it propertly sets the TCCL so that the
@@ -275,12 +279,13 @@ public class ClientWeavingHookTest {
activator.registerProviderBundle("org.apache.aries.mytest.AltSPI", providerBundle4);
Bundle consumerBundle = mockConsumerBundle(headers, providerBundle1, providerBundle2, providerBundle4);
+ activator.addConsumerWeavingData(consumerBundle, SpiFlyConstants.SPI_CONSUMER_HEADER);
Bundle spiFlyBundle = mockSpiFlyBundle(consumerBundle, providerBundle1, providerBundle2, providerBundle4);
WeavingHook wh = new ClientWeavingHook(spiFlyBundle.getBundleContext(), activator);
// Weave the TestClient class.
URL clsUrl = getClass().getResource("TestClient.class");
- WovenClass wc = new MyWovenClass(clsUrl, "org.apache.aries.spifly.TestClient", consumerBundle);
+ WovenClass wc = new MyWovenClass(clsUrl, "org.apache.aries.spifly.dynamic.TestClient", consumerBundle);
wh.weave(wc);
// Invoke the woven class and check that it propertly sets the TCCL so that the
@@ -308,12 +313,13 @@ public class ClientWeavingHookTest {
activator.registerProviderBundle("org.apache.aries.mytest.AltSPI", providerBundle4);
Bundle consumerBundle = mockConsumerBundle(headers, providerBundle1, providerBundle2, providerBundle4);
+ activator.addConsumerWeavingData(consumerBundle, SpiFlyConstants.SPI_CONSUMER_HEADER);
Bundle spiFlyBundle = mockSpiFlyBundle(consumerBundle, providerBundle1, providerBundle2, providerBundle4);
WeavingHook wh = new ClientWeavingHook(spiFlyBundle.getBundleContext(), activator);
// Weave the TestClient class.
URL clsUrl = getClass().getResource("TestClient.class");
- WovenClass wc = new MyWovenClass(clsUrl, "org.apache.aries.spifly.TestClient", consumerBundle);
+ WovenClass wc = new MyWovenClass(clsUrl, "org.apache.aries.spifly.dynamic.TestClient", consumerBundle);
wh.weave(wc);
// Invoke the woven class and check that it propertly sets the TCCL so that the
@@ -363,8 +369,11 @@ public class ClientWeavingHookTest {
activator.registerProviderBundle("org.apache.aries.mytest.AltSPI", providerBundle4);
Bundle consumerBundle1 = mockConsumerBundle(headers1, providerBundle1, providerBundle2, providerBundle3, providerBundle4);
+ activator.addConsumerWeavingData(consumerBundle1, SpiFlyConstants.SPI_CONSUMER_HEADER);
Bundle consumerBundle2 = mockConsumerBundle(headers2, providerBundle1, providerBundle2, providerBundle3, providerBundle4);
+ activator.addConsumerWeavingData(consumerBundle2, SpiFlyConstants.SPI_CONSUMER_HEADER);
Bundle consumerBundle3 = mockConsumerBundle(headers3, providerBundle1, providerBundle2, providerBundle3, providerBundle4);
+ activator.addConsumerWeavingData(consumerBundle3, SpiFlyConstants.SPI_CONSUMER_HEADER);
Bundle spiFlyBundle = mockSpiFlyBundle(consumerBundle1, consumerBundle2, consumerBundle3,
providerBundle1, providerBundle2, providerBundle3, providerBundle4);
WeavingHook wh = new ClientWeavingHook(spiFlyBundle.getBundleContext(), activator);
@@ -404,6 +413,7 @@ public class ClientWeavingHookTest {
Dictionary<String, String> headers = new Hashtable<String, String>();
headers.put(SpiFlyConstants.SPI_CONSUMER_HEADER, "javax.xml.parsers.DocumentBuilderFactory#newInstance()");
Bundle consumerBundle = mockConsumerBundle(headers, systembundle);
+ activator.addConsumerWeavingData(consumerBundle, SpiFlyConstants.SPI_CONSUMER_HEADER);
WeavingHook wh = new ClientWeavingHook(mockSpiFlyBundle(consumerBundle, systembundle).getBundleContext(), activator);
@@ -428,6 +438,7 @@ public class ClientWeavingHookTest {
Dictionary<String, String> headers = new Hashtable<String, String>();
headers.put(SpiFlyConstants.SPI_CONSUMER_HEADER, "javax.xml.parsers.DocumentBuilderFactory#newInstance()");
Bundle consumerBundle = mockConsumerBundle(headers, providerBundle, systembundle);
+ activator.addConsumerWeavingData(consumerBundle, SpiFlyConstants.SPI_CONSUMER_HEADER);
WeavingHook wh = new ClientWeavingHook(mockSpiFlyBundle(consumerBundle, providerBundle, systembundle).getBundleContext(), activator);
@@ -451,6 +462,7 @@ public class ClientWeavingHookTest {
Dictionary<String, String> headers = new Hashtable<String, String>();
headers.put(SpiFlyConstants.SPI_CONSUMER_HEADER, "javax.xml.parsers.DocumentBuilderFactory#newInstance();bundleId=0");
Bundle consumerBundle = mockConsumerBundle(headers, providerBundle, systembundle);
+ activator.addConsumerWeavingData(consumerBundle, SpiFlyConstants.SPI_CONSUMER_HEADER);
WeavingHook wh = new ClientWeavingHook(mockSpiFlyBundle(consumerBundle, providerBundle, systembundle).getBundleContext(), activator);
@@ -474,6 +486,7 @@ public class ClientWeavingHookTest {
Dictionary<String, String> headers = new Hashtable<String, String>();
headers.put(SpiFlyConstants.SPI_CONSUMER_HEADER, "javax.xml.parsers.DocumentBuilderFactory#newInstance();bundle=impl3");
Bundle consumerBundle = mockConsumerBundle(headers, providerBundle, systembundle);
+ activator.addConsumerWeavingData(consumerBundle, SpiFlyConstants.SPI_CONSUMER_HEADER);
WeavingHook wh = new ClientWeavingHook(mockSpiFlyBundle(consumerBundle, providerBundle, systembundle).getBundleContext(), activator);
@@ -503,6 +516,7 @@ public class ClientWeavingHookTest {
EasyMock.expect(spiFlyBundle.getSymbolicName()).andReturn(bsn).anyTimes();
EasyMock.expect(spiFlyBundle.getVersion()).andReturn(version).anyTimes();
+ EasyMock.expect(spiFlyBundle.getBundleId()).andReturn(Long.MAX_VALUE).anyTimes();
EasyMock.expect(spiFlyBundle.getBundleContext()).andReturn(spiFlyBundleContext).anyTimes();
EasyMock.replay(spiFlyBundle);