Hello,

I am trying to implement execution of a SmartFrog application within a JUnit 
test. Successful termination of the application is a necessary condition for 
the test success.

The <sf-run> Ant task sounds like what I need. The description says: "Run an 
application by deploying it locally; only return from ant after it has 
finished." In practice, I found that the application is forcibly terminated 
immediately after it is started. For example, the following SmartFrog  example 
is supposed to execute 4 counter steps before terminating:

                                <sf-run classpathref="run.classpath">
                                                <application name=" Counter " 
descriptor="org/smartfrog/examples/counter/example.sf"/>
                                </sf-run>

Here is what actually happens:

   [sf-run]
   [sf-run] SmartFrog 3.17.014 (2009-07-27 16:11:39 BST)
   [sf-run] (C) Copyright 1998-2009 Hewlett-Packard Development Company, LP
   [sf-run]
   [sf-run] 2010/09/16 20:38:28:937 MSD [WARN ][main] SFCORE_LOG - SmartFrog 
security is NOT active
   [sf-run] 2010/09/16 20:38:30:343 MSD [INFO ][main] HOST 
test289.alliedtesting.com:sfRunProcess:Counter - Starting with msg-step
   [sf-run]  - Successfully deployed: 'HOST 
test289.alliedtesting.com:sfRunProcess:Counter',  
[/org/smartfrog/examples/counter/example.sf]
   [sf-run]
   [sf-run] COUNTER: step 1

As you can see, the task doesn't wait for the application to  terminate on its 
own. I tried playing with various attributes, but the result was always the 
same, as far as premature termination is concerned.


Another Ant task that I have tried to use is <sf-functionaltest>. Here is the 
same example as above using a simple implementation of this task:

                                <sf-functionaltest shutdowntime="10" 
testtimeout="600">
                                                <application>
                                                                <sf-startdaemon 
classpathref="run.classpath"/>
                                                </application>
                                                <probe>
                                                                <socket 
port="${smartfrog.daemon.port}" server="localhost"/>
                                                </probe>
                                                <teardown>
                                                                <sf-stopdaemon 
failonerror="false"/>
                                                </teardown>
                                                <test>
                                                                <sf-deploy 
classpathref="run.classpath">
                                                                                
<application
                                                                                
                name="Counter"
                                                                                
                descriptor="/org/smartfrog/examples/counter/example.sf"
                                                                                
/>
                                                                </sf-deploy>
                                                </test>
                                </sf-functionaltest>

And here is what happens:

[sf-startdaemon]
[sf-startdaemon] SmartFrog 3.17.014 (2009-07-27 16:11:39 BST)
[sf-startdaemon] (C) Copyright 1998-2009 Hewlett-Packard Development Company, LP

[sf-startdaemon]
[sf-startdaemon] 2010/09/16 20:44:39:554 MSD [WARN ][main] SFCORE_LOG - 
SmartFrog security is NOT active
[sf-startdaemon] SmartFrog ready... [rootProcess:3800] Thu Sep 16 20:44:41 MSD 
2010
[sf-deploy]
[sf-deploy] SmartFrog 3.17.014 (2009-07-27 16:11:39 BST)
[sf-deploy] (C) Copyright 1998-2009 Hewlett-Packard Development Company, LP
[sf-deploy]
[sf-deploy] 2010/09/16 20:44:42:460 MSD [WARN ][main] SFCORE_LOG - SmartFrog 
security is NOT active
[sf-startdaemon] 2010/09/16 20:44:44:288 MSD [INFO ][RMI TCP 
Connection(3)-192.168.134.33] HOST 
test289.alliedtesting.com:rootProcess:Counter - Starting with msg-step
[sf-deploy]  - Successfully deployed: 'HOST 
test289.alliedtesting.com:rootProcess:Counter',  
[/org/smartfrog/examples/counter/example.sf],  host:localhost
[sf-deploy]
[sf-startdaemon] COUNTER: step 1
[sf-startdaemon] COUNTER: step 2
[sf-stopdaemon]
[sf-stopdaemon] SmartFrog 3.17.014 (2009-07-27 16:11:39 BST)
[sf-stopdaemon] (C) Copyright 1998-2009 Hewlett-Packard Development Company, LP
[sf-stopdaemon]
[sf-stopdaemon] 2010/09/16 20:44:45:601 MSD [WARN ][main] SFCORE_LOG - 
SmartFrog security is NOT active
[sf-startdaemon] COUNTER: step 3
[sf-startdaemon] 2010/09/16 20:44:46:882 MSD [INFO ][RMI TCP 
Connection(5)-192.168.134.33] HOST 
test289.alliedtesting.com:rootProcess:Counter -  Terminating for reason: 
Termination Record: HOST test289.alliedtesting.com:rootProcess,  type:normal,  
description: External Management Action
[sf-startdaemon] 2010/09/16 20:44:46:882 MSD [ERROR][Counter] HOST 
test289.alliedtesting.com:rootProcess:Counter -  
<java.lang.InterruptedException: sleep interrupted>
[sf-startdaemon]
[sf-startdaemon] SmartFrog [rootProcess] dead  Thu Sep 16 20:44:46 MSD 2010
[sf-stopdaemon] SmartFrog daemon terminated
[sf-stopdaemon]  - Successfully terminated: 'null',  host:localhost
[sf-stopdaemon]

In this case, too, the application was terminated prematurely.


Am I doing something wrong?

Is there a better way to do what I want (i.e. programmatically executing a 
SmartFrog application, preferably using an Ant or Java interface, and getting 
back the termination status)?

Thank you,
Dmitry
------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Smartfrog-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/smartfrog-users

Reply via email to