JRuby Support (strikes back) [message #31236] |
Thu, 02 April 2009 19:52  |
Eclipse User |
|
|
|
Originally posted by: frederick.ros.gmail.com
Hi Ketan,
Following experiments made by Andy Maleh, I'm currently trying to play
with SWTBot within JRuby.
My goal is to be able to write some user acceptance tests (using
Cucumber) to be able to tests some of my Eclipse plug-ins.
Currently I'm able to create a small SWT application and to start an
SWTBot to click some of its buttons. So far, so good.
Now regarding Eclipse: I'm able to start an Eclipse instance in a
dedicated thread. However, if I try to get the 'Eclipse Display' using
the method you described (i.e. for each of the VM thread look if an SWT
Display is available). I'm thus unable to start an SWTBot or
SWTEclipseBot in the main thread to exercise my Eclipse instance.
Am I doing something wrong ? Is it technically possible, or is this
'lack' of Display due to the way Eclipse internally work ?
Thanks in advance and Best Regards,
Fred
|
|
|
|
|
|
|
|
|
Re: JRuby Support (strikes back) [message #31694 is a reply to message #31661] |
Thu, 09 April 2009 11:42   |
Eclipse User |
|
|
|
Hi Fredrick:
What I'm trying out is something like the snippet below. The jruby
bundle is the jruby-complete jar packaged with cucumber. This one is
able to successfully print 'hello world'.
What I need to do next is be able to invoke cucumber :) I think that
should be fairly simple!
public class CucumberRunner implements IApplication {
public Object start(IApplicationContext context) throws Exception {
Bundle bundle = Platform.getBundle("org.jruby.jruby");
URL jrubyHome =
FileLocator.toFileURL(bundle.getEntry("/META-INF/jruby.home "));
RubyInstanceConfig config = new RubyInstanceConfig();
config.setJRubyHome(jrubyHome.toString());
Ruby runtime = JavaEmbedUtils.initialize(new
ArrayList<String>(), config);
RubyRuntimeAdapter evaler = JavaEmbedUtils.newRuntimeAdapter();
evaler.eval(runtime, "p 'hello world'");
JavaEmbedUtils.terminate(runtime);
return EXIT_OK;
}
}
-- Ketan
On 9/4/09 18:24, Frederick Ros wrote:
> Ketan Padegaonkar wrote:
>> This is an interesting problem that I'd definitely like to take a look
>> at, I'd be traveling for some part of the next week, so expect some
>> delays in responses from me.
>
> Hi Ketan,
>
> I advanced a little bit on this one (not so much time these days).
>
> What I'm trying to do is to start an Eclipse instance using the
> org.eclipse.core.runtime.adaptor.EclipseStarter class.
>
> If I succeeds in this, it means that I'll be able to get access to OSGI
> services, and will be (potentially) able to get the classloader used for
> the org.eclipse.swt plugin.
>
> Then I could use this classloader to load SWTBot ...
>
> Do you think this is doable ?
>
> Best Regards,
> Fred
>
|
|
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.07491 seconds