Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Base directory is not the same when running tests with surefire or when running the application with wisdom:run #511

Open
amischler opened this issue Jun 2, 2015 · 3 comments
Milestone

Comments

@amischler
Copy link

This leads to some strange ressource loading issues like Modeshape does not load cnd files from conf directory when running tests #12 in wisdom-jcr

The application should be executed in the same directory both with wisdom:run and with surefire.

@cescoffier
Copy link
Member

So, Wisdom relies on the maven failsafe plugin to run integration test. So it just needs some configuration in the failsafe plugin.

I'm going to update the default pom.xml file to set the working directory to target/wisdom. However, be aware that you IDE, will require manual tweaks.

I'm also documenting the failsafe configuration.

@cescoffier cescoffier added this to the 0.9.2 milestone Jun 14, 2015
@cescoffier
Copy link
Member

Actually, this is not a good idea.

  1. your application should not base its 'file' lookup on the working directory. This si really error prone
  2. changing the working directory of failsafe impact a lot of things such as the bundle packaging strategy as files are not found anymore (BND use relative paths)

So, I need to think more about this.

For now, there is a simple work around. The ApplicationConfiguration service has a getBaseDirectory method retrieving the Wisdom root directory.

@cescoffier cescoffier removed the ready label Jun 14, 2015
@amischler
Copy link
Author

Thanks for looking at this issue.

Unfortunately the code responsible for loading the CND file is not in my application but located in ModeShape. (see wisdom-framework/wisdom-jcr#12 (comment))

However, what is strange is that if you look at the code of the CndImportOperation and especially at getInputStreamForFile and IoUtil.getResourceAsStream you will note that ModeShape do rely on the classloader to load the ressource and not on a working directory.

That's why I suspected an issue in Wisdom failsafe configuration. By the way adding manullay in the pom ${basedir}/target/wisdom to the failsafe classpath does fix the issue.

Anyway, it seems that updating the failsafe base directory is a bit more complicated than expected :)
So I guess that we will go with the failsafe workaround for the moment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants