[
https://jira.jboss.org/jira/browse/JBIDE-5259?page=com.atlassian.jira.plu...
]
Tom Fennelly commented on JBIDE-5259:
-------------------------------------
Copied from email......
I eventually got the Run Configurations working... my first bit of eclipse code ;) This
is for JIRA
https://jira.jboss.org/jira/browse/JBIDE-5259
Here's a screencast:
http://www.screencast.com/t/OGVlMWMwOGYt
I don't have the Run Shortcut working yet (the ability to run from a keyboard
shortcut), but might leave that for now I think, yeah? At least we have the ability to
run smooks configs now!!
There's one biggish issue with the implementation.... I'm trying to reuse the
same launch framework code as used by the existing JUnit launch framework.... it does a
lot of the classpath resolution stuff etc (although that's not all that difficult, now
that I've seen it). This code launches the test class as a main, setting up the
classpath etc. This meant I had to write a SmookaLauncher class, which is just a wrapper
class around Smooks, with a main method.
The problem I encountered.... the SmooksLaunch class is part of the smooks ui bundle and
I've no idea how I get hold of this and add it to the classpath. To get it working
(i.e. a hack), I added the plugin's "bin" dir to the bundle classpath, which
I can then hack out of the classpath :) How do I do this properly?
This bit of code currently looks like this....
List<String> classpath = new
ArrayList<String>(Arrays.asList(getClasspath(launchConfig)));
//
====================================================================================================================
// TODO Total Hack... Fixme: We're using classes here that we
shouldn't, as well as adding bundle paths that we
// probably shouldn't, but how do I get the SmooksLauncher class on the
launcher classpath?
// I added the "bin" folder to the bundle classpath as a workaround
(with the following code) for getting
// the SmooksLauncher class onto the classpath. Need to fix this
properly!!!!
//
ClassLoader classloader = getClass().getClassLoader();
if(classloader instanceof BaseClassLoader) {
ClasspathManager cpManager =
((BaseClassLoader)classloader).getClasspathManager();
ClasspathEntry[] entries = cpManager.getHostClasspathEntries();
for(ClasspathEntry entry : entries) {
File baseFile = entry.getBundleFile().getBaseFile();
try {
String[] bundleEntries = entry.getBaseData().getClassPath();
for(String bundleEntry : bundleEntries) {
String path = baseFile.getAbsolutePath() + "/" +
bundleEntry;
if(!classpath.contains(path)) {
classpath.add(path);
}
}
} catch (BundleException e) {
e.printStackTrace();
}
}
}
//
//
====================================================================================================================
VMRunnerConfiguration runConfig= new
VMRunnerConfiguration(SmooksLauncher.class.getName(), classpath.toArray(new
String[classpath.size()]));
Implement rudimentary Test facility for Smooks Config
-----------------------------------------------------
Key: JBIDE-5259
URL:
https://jira.jboss.org/jira/browse/JBIDE-5259
Project: Tools (JBoss Tools)
Issue Type: Feature Request
Components: smooks
Reporter: Brian Fitzpatrick
Assignee: Tom Fennelly
Priority: Critical
Fix For: 3.1.0.CR1
Original Estimate: 0 minutes
Remaining Estimate: 0 minutes
Test functionality via the "Run" button perhaps, outputting the templating/java
result to the Console? With this, we should all be able to do more meaningful testing, so
it kinda feeds back into the overall effort of improving the quality of this thing. I
know this doesn't make use of the Reporting, but are we too late for that now?
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira