|
Re: Possible bug in resolver [message #75140 is a reply to message #75122] |
Fri, 20 October 2006 15:06 |
Eclipse User |
|
|
|
Originally posted by: alex_blewitt.yahoo.com
IIRC a fragment's classes can't be exported to other dependent bundles. So I don't think that fragment B would be able to instantiate a.MockA. Also, I don't think the bundle A would be able to see A's fragment classes, either.
You probably need to do something like:
Bundle A
Bundle-Classpath: mock.jar, .
:
// Bundle A
class Factory {
X getThing() { return null; };
}
// Fragment A, stored in 'mock.jar'
class Factory {
X getThing() { return new MockX(); };
}
That way, at run time, your Factory is replaced with the Factory from the fragment, which knows how to instantiate MockX things. You could then return them to B (or B's fragment).
However, I'm not certain this would work, since I don't think that B would be able to access instances of type MockX anyway...
Alex.
|
|
|
|
Re: Possible bug in resolver [message #75171 is a reply to message #75122] |
Sat, 21 October 2006 12:52 |
Eclipse User |
|
|
|
Originally posted by: jeff_mcaffer.REMOVE.ca.ibm.com
Paul,
The may be a PDE issue as it seems like this should work. Try reloading
your target. That is, go to Window > Preferences > PDE > Target
Platform and click the Reload button. That should trigger PDE to
recompute the state and all the wirings etc. If that doesn't work,
perhaps you should open a bug in Eclipse/PDE/UI and attach the manifests
for the 4 bundles involved?
Jeff
Paul Kendall wrote:
> Hi,
> I'm using fragment bundles as my container for unit tests and I have a
> problem with them as follows.
>
> bundleA has an interface a.X
> package a is exported from the bundle
> fragmentA has a mock implementation of X called a.MockX
>
> bundleB has a class b.Y which has interface X from bundleA as an
> argument to a method.
> package a is imported in this bundle
> fragmentB has a test class Z for b.Y which passes a new a.MockX object
> from bundleA
>
> Ok, this should work if I'm reading the spec right. But I get compile errors
> for fragmentB saying "the import a cannot be resolved". Also, the Plug-in
> Depenencies object in the project shows package in it!
>
> I have tried added exports to fragmentA & imports to fragmentB to no avail.
>
> Can someone steer me in the right direction.
>
> Cheers,
> Paul
|
|
|
Re: Possible bug in resolver [message #75205 is a reply to message #75140] |
Sat, 21 October 2006 19:03 |
Eclipse User |
|
|
|
Originally posted by: alex_blewitt.yahoo.com
Sorry, I may have misunderstood, but I thought if you had package com.example.foo in the bundle, and com.example.foo in the fragment, then you wouldn't necessarily see that by dependent bundles. But I may have been misremembering from when I tried to replace classes in the main bundle -- in that case, I was using the same class as well as package name.
Alex.
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03848 seconds