Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » how to run junit test case in a customized Eclipse workspace?(show ` Cannot change the location once it is set.` when I set a certain path in filesystem programatically)
how to run junit test case in a customized Eclipse workspace? [message #1805796] Wed, 24 April 2019 08:43 Go to next message
hen hen is currently offline hen henFriend
Messages: 2
Registered: July 2018
Junior Member
I created junit test by importing a project into a Eclipse workspace,
after running maven to build the product, I found the workspace located under the plugin which contains the junit testcase. /pluginname/work/data/,
under the data folder, I saw my imported project and .metadata, indicate that's the workspace.

However I want to set a workspace path at a filesystem, e.g. /home/productname/Testing.

I tried the following code to set the workspace manually, as suggested by other post.

Location instanceLoc = Platform.getInstanceLocation();
if (instanceLoc.isSet()) {
// release any previous location
instanceLoc.release();
String destination = "home/productname/Testing/";
URL value = new URL("file", null, destination); // $NON-NLS-1$
try {
instanceLoc.set(value, true);
} catch (IllegalStateException | IOException e) {
e.printStackTrace();
}
}

However it shows ` Cannot change the location once it is set.`

Anyone has any suggestion?
Thanks in advance.

[Updated on: Wed, 24 April 2019 08:45]

Report message to a moderator

Re: how to run junit test case in a customized Eclipse workspace? [message #1811023 is a reply to message #1805796] Fri, 23 August 2019 18:14 Go to previous message
Wim Jongman is currently offline Wim JongmanFriend
Messages: 493
Registered: July 2009
Senior Member

How do you run the unit tests? If you run it with "run as junit plugin tests", you can change the workspace location in the run configuration.

Previous Topic:Fragment with resource
Next Topic:Plugin/Bundle remains in STARTING status
Goto Forum:
  


Current Time: Sat Dec 14 23:07:05 GMT 2024

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

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

Back to the top