Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » Equinox Aspects Weaving Problem(Not all pluggins are woven when trying to weave MockWorkspace on ResourcesPlugin.getWorkspace)
Equinox Aspects Weaving Problem [message #651430] Sun, 30 January 2011 20:36 Go to next message
Alex Smirnoff is currently offline Alex SmirnoffFriend
Messages: 28
Registered: July 2009
Junior Member
Hi.

I am trying to create a MockWorkspace for our test suite. Having been partially successful I am stumbled into the problem when trying to use AspectJ to inject MockWorkspace. When using Equinox Aspects weaver does not weave all Eclipse plugins needed.

My plugins have next layout: test plugin that run the suite, depends on test.util plugin where the aspect is defined.

Here is the aspect I have:

package org.eclipse.jst.jsf.test.util.aspects;

import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.jst.jsf.test.util.mock.MockWorkspaceContext;

public aspect MockWorkspaceInjector {
	
	pointcut getWorkspace() : call(static IWorkspace ResourcesPlugin.getWorkspace());
	
	IWorkspace around() : getWorkspace() {
		MockWorkspaceContext currentContext = MockWorkspaceContext.getCurrent();
		
		if (currentContext != null && currentContext.isCurrentThread()){
			return currentContext.getWorkspace();
		}
		return proceed();
	}
}


When running the test in development environment I only see the test plugin being woven and the plugin that it depends on in the workspace being woven using LTW. The dependencies that in the target are ignored. Also I see successful waveinfo Joint point method call to ResourcesPlugin.getWorkspace().

It seems that Supplement-Bundle does not work at all if I point to the bundles that I want weaver to weave.

Where am I getting wrong?
BTW, Can I instead using the call use execution pointcut and simply point weaver to "org.eclipse.core.resources"? How can I do that?

Re: Equinox Aspects Weaving Problem [message #652661 is a reply to message #651430] Fri, 04 February 2011 22:55 Go to previous message
Alex Smirnoff is currently offline Alex SmirnoffFriend
Messages: 28
Registered: July 2009
Junior Member
The solution was to set the OSGi start level on test plugin smaller than org.eclipse.core.resources so the aspect could get initialized before the plugin it should be woven with.

Execution advice worked nice.

But the whole idea is quite crazy because it is really hard to mock the whole workspace implementation. If you need to have memory based workspace, much easier to create in-memory file system (but these guys are not supported very well).
Previous Topic:Problem while exporting my product
Next Topic:p2.inf file is ignored
Goto Forum:
  


Current Time: Fri Apr 26 12:27:39 GMT 2024

Powered by FUDForum. Page generated in 0.02550 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top