2017 up to now  | 2016 | 2015 | 2014 | 2013 | 2012 | 2011 | 2010 | 2009 | 2008 | 2007

(older archive entries before 2007 are not shown here, but included in the onsite-search)

Mailing List - Entries of 2015


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [QF-Test] Check If an Process is already running


  • Subject: Re: [QF-Test] Check If an Process is already running
  • From: Gregor Schmid <Gregor.Schmid@?.de>
  • Date: Tue, 07 Jul 2015 10:32:58 +0200

Hi Lukas,

OK, I guess I was focusing too much on terminating the process rather
than checking for it. To check whether a process client was started
from QF-Test and whether it is still running, use the following
construct:

+ Try
  + Wait for process to terminate, timeout 0
  + ...You'll get here if the process was started and has terminated
  + Catch ProcessNotTerminatedException
    + ...You'll get here if the process was started and is still running
  + Catch NoSuchClientException
    + ...You'll get here if the process was never started

Hope that (finally) helps :-).

Best regards,
    Greg

Eichner Lukas VIB-AZ311 <Eichner.Lukas@?.de> writes:

> Hi Gregor,
>
> Thank you for your answer!
>
> I already have it like This:
>
> + Execute Batch: jboss-cli.bat (Client= JBossShutdown)
> + Wait for Process to terminate (Client= JBoss)
>
> But like this it throws an exception when the JBoss is not running. I
> could surround the "Wait for terminate" with try/catch but I also
> don't want to have the errors, displayed by the jboss-cli.bat, in the
> terminal.
>
> I would prefer an If-Case which checks if the JBoss is running before
> executing the shutdown command.
>
> Best regards,
> Lukas
>
>
> -----Ursprüngliche Nachricht-----
> Von: Gregor Schmid [mailto:Gregor.Schmid@?.de]
> Gesendet: Montag, 6. Juli 2015 20:40
> An: qftest-list@?.de
> Cc: Eichner Lukas VIB-AZ311
> Betreff: Re: [QF-Test] Check If an Process is already running
>
> Hi Lukas,
>
> in that case you can run that batch command via an 'Execute shell
> command' node with a different client name. Follow this with a 'Wait
> for process to terminate' node for this shell command and another one
> for the JBoss client.
>
> Best regards,
>     Greg
>
>
> Eichner Lukas VIB-AZ311 <Eichner.Lukas@?.de> writes:
>
>> Hi Gregor,
>>
>> thank you for your answer, but it didn't solve my problem.
>> Actually to stop the JBoss assured I'm starting another Batch-File (jboss-cli.bat --connect --controller=localhost:1090 --command=:shutdown).
>> I don't want to use the "Stop Client" node.
>>
>> I hope there is another solution.
>>
>> Best regards,
>> Lukas
>>
>> -----Ursprüngliche Nachricht-----
>> Von: Gregor Schmid [mailto:Gregor.Schmid@?.de]
>> Gesendet: Mittwoch, 24. Juni 2015 18:22
>> An: qftest-list@?.de
>> Cc: Eichner Lukas VIB-AZ311
>> Betreff: Re: [QF-Test] Check If an Process is already running
>>
>>
>> Hi Lukas,
>>
>> for an SUT client that connects to QF-Test, the preferred method for
>> checking for the client is a 'Wait for client to connect' node,
>> possibly inside a Try/Catch.
>>
>> In your case, the JBoss server is probably a plain sub-process that
>> does not connect, so the 'Wait for client' will never succeed. The
>> easiest way for your "check and probably stop" function is a construct
>> like the following:
>>
>> + Try
>>   + Stop client <client name of JBoss>
>>   + Wait for process to terminate <client name of JBoss>
>> + Catch NoSuchClientExcption
>>
>> If JBoss was never started it's go right into the (empty) Catch,
>> otherwise the 'Stop client' should succeed. 'Wait for process to
>> terminate' is always a good idea because killing the process happens
>> asynchronously.
>>
>> Best regards,
>>     Greg
>>
>> Eichner Lukas VIB-AZ311 <Eichner.Lukas@?.de> writes:
>>
>>> Hi all,
>>>
>>> is there any way to check if a specific process / client has already been started and is running
>>> atm.?
>>>
>>> In the test I'm building up a JBoss with Maven, which fails, if there is an JBoss running.
>>> Sometimes the test doesn't run until the end, so I forget to stop the JBoss. When I restart the
>>> test, the Maven build fails, because the JBoss is already running.
>>>
>>> I want to make an If-Condition before the Maven-Build to check and probably stop the JBoss
>>> process.
>>>
>>> Best regards,
>>> Lukas
>>>
>>> _______________________________________________
>>> qftest-list mailing list
>>> qftest-list@?.de
>>> http://www.qfs.de/mailman/listinfo/qftest-list

--
Gregor Schmid

E: gregor.schmid@?.de
T: +49 8171 38648-11
F: +49 8171 38648-16

Quality First Software GmbH | www.qfs.de
Tulpenstr. 41 | 82538 Geretsried | Germany
GF Gregor Schmid, Dr. Martina Schmid, Karlheinz Kellerer
HRB München 140833