You can typically start jetty - even for another war
void startServer() {
server = new Server(0);
WebAppContext context = new WebAppContext();
context.server = server;
context.contextPath = "/context";
context.war = "/path/to/the-other-one.war";
server.addHandler(context)
server.start();
int actualPort = server.connectors[0].localPort;
baseUrl = "http://localhost:${actualPort}/context"
}
In a @Before method of some sort.
If it really needs to be another Thread - you could start/stop
that thread in a @Before/@After. And if it really needs to be
another process you could create/stop that process in a @Before/
@After. Just a thought...
Brian
----- Original message -----
From: "Caoilte O'Connor" <[email protected]>
To: [email protected]
Date: Thu, 22 Sep 2011 18:42:42 +0100
Subject: Re: [jbehave-user] testing JMX
Hi All,
Apols for late reply. I was firefighting somewhere else for a month. :(.
W/regard starting jetty programmatically I already use annotations to
do this and it works fine.
The problem is that I appear to need to be able to run my Jetty in a
different JVM and it looks like only surefire is able to make this
possible.
(Even the jetty:run plugin appears to have this problem
http://jira.codehaus.org/browse/JETTY-991).
If I run my stories via surefire instead of via the jbehave plugin,
will this stop me from being able to generate reports?
thanks
Caoilte
On Sat, Aug 20, 2011 at 7:39 PM, Mauro Talevi
<[email protected]> wrote:
> Hi Brian,
>
> yes, there is: @BeforeStories / @AfterStories annotations.
>
> Controlling the server via the code is surely another viable option.
>
> Cheers
>
> On 20/08/2011 17:49, Brian Repko wrote:
>> Caoilte,
>>
>> You may also look to write a @BeforeStory / @AfterStory that
>> starts and stops an embedded jetty server. I've done this with
>> testing of JAX-RS (REST) web services where the steps methods
>> are clients of the server. Since you'd be in code, you should
>> have access to all the Jetty configuration (including JMX) that
>> you need.
>>
>> JBehave team - is there a @BeforeRun / @AfterRun?
>>
>> Brian
>>
>> ----- Original message -----
>> From: "Mauro Talevi" <[email protected]>
>> To: [email protected]
>> Date: Sat, 20 Aug 2011 10:05:13 +0200
>> Subject: Re: [jbehave-user] testing JMX
>>
>> Hi,
>>
>> you can use the Jetty Maven Plugin
>>
>> http://wiki.eclipse.org/Jetty/Feature/Jetty_Maven_Plugin
>>
>> You can configure JVM via it.
>>
>> Cheers
>>
>> On 19/08/2011 23:10, Caoilte O'Connor wrote:
>>> Hi,
>>> One of my JBehave steps start a jetty server and I would like to be
>>> able to enable JMX in this jetty server but I don't think it will be
>>> possible using the jbehave maven plugin.
>>>
>>> I used to use sure-fire and that allows you to fork and pass JVM
>>> properties in there.
>>>
>>> Can anyone think of a way I might be able to start Jetty with JMX
>>> enabled for my tests?
>>>
>>> Thanks
>>>
>>> Caoilte
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe from this list, please visit:
>>>
>>> http://xircles.codehaus.org/manage_email
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>> http://xircles.codehaus.org/manage_email
>>
>>
>>
>> ---
>> Brian Repko
>> LearnThinkCode, Inc.
>> http://www.learnthinkcode.com
>> email: [email protected]
>> phone: +1 612 229 6779
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>> http://xircles.codehaus.org/manage_email
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
> http://xircles.codehaus.org/manage_email
>
>
>
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
---
Brian Repko
LearnThinkCode, Inc.
http://www.learnthinkcode.com
email: [email protected]
phone: +1 612 229 6779
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email