Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[tycho-user] [newbie] failure loading test resources from tycho but OK in IDE?

Apologies if this is answered somewhere else.  If so link(s) appreciated.

Context: complete newbie to maven & tycho, trying to run junit tests for xtext-based project.

I have integration tests that need to load test resources. When run from the IDE it works fine but fails in tycho because it can't find the test resources. Code as follows:

//...
final String pathroot = "org.domainmodels.ooa.tests/testdata/TestOoaStructure/"
URI uri = URI.createPlatformResourceURI(pathroot+filename, true);
System.out.println("Loading model from URI: " + uri.toString());
rootElement = loadModel(resourceSet, uri, getRootObjectType(uri));
//...

When run from IDE this prints e.g.:

  Loading model from URI: platform:/resource/org.domainmodels.ooa.tests/testdata/TestOoaStructure/TestDomain.ooa

and tests run fine.

However from tycho it fails:

Loading model from URI: platform:/resource/org.domainmodels.ooa.tests/testdata/TestOoaStructure/TestDomain.ooa
...
org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Resource '/org.domainmodels.ooa.tests/testdata/TestOoaStructure/ClassTest.ooa' does not exist.

I have tried with absolute file-based URLs (using URI.createFileURI) and it works; however absolute paths is obviously not a sustainable solution.

So my questions are:
1. Why does the platform-based URI scheme work in the IDE - but not from tycho?
2. Any suggestions for how I solve the problem?  Really don't want to use absolute paths.

Thanks,
Scott.


Back to the top