[Design of POJO Server] - Re: Testing Bootstrap Dependencies
by istudens@redhat.com
Thanks for your advice. It was very helpful for me.
I want to share my first ideas about the implementation. I am not sure about package which the test should be in and other things.
I have made a simple SAR which is responsible for deployment of testing modules like JARs, EARs, WARs and so on. The code snippet of the SAR:
package org.jboss.test.deployers_jbas5349.sar;
|
| public class DeploymentDependencyTest
| extends ServiceMBeanSupport
| implements DeploymentDependencyTestMBean
| {
| // Constants -----------------------------------------------------
| public final static String DEPLOYER_NAME = "jboss.system:service=MainDeployer";
|
| // Attributes -----------------------------------------------------
| protected String deployModule;
|
| @Override
| protected void startService() throws Exception
| {
| log.debug("DeploymentDependencyTest's SAR is starting");
|
| deployModule = System.getProperty("deployment.dependency.test.module");
|
| if (deployModule != null)
| {
| log.debug("deploying of " + deployModule);
| deploy(deployModule);
| } else {
| // what should I do?
| }
|
| log.debug("DeploymentDependencyTest's SAR is started");
| }
|
| @Override
| protected void stopService() throws Exception
| {
| log.debug("DeploymentDependencyTest's SAR is stopping");
|
| if (deployModule != null)
| {
| log.debug("un-deploying of " + deployModule);
| undeploy(deployModule);
| }
|
| log.debug("DeploymentDependencyTest's SAR is stopped");
| }
|
| ...
|
| protected void deploy(String name) throws Exception
| {
| if (Boolean.getBoolean("jbosstest.nodeploy") == true)
| {
| log.debug("Skipping deployment of: " + name);
| return;
| }
|
| URL deployURL = getDeployURL(name);
| log.debug("Deploying " + name + ", url=" + deployURL);
| invoke(getDeployerName(),
| "deploy",
| new Object[]{deployURL},
| new String[]{"java.net.URL"});
| }
|
| ...
| }
The SAR is built inside testsuite/imports/sections/deployers.xml:
<!-- JBAS-5349 SAR -->
| <jar destfile="${build.lib}/Aaadeploymentdependency-jbas5349.sar">
| <fileset dir="${build.resources}/deployers/jbas5349">
| <include name="**/*"/>
| </fileset>
| <fileset dir="${build.classes}">
| <include name="org/jboss/test/deployers_jbas5349/**"/>
| </fileset>
| </jar>
JBoss's service XML of the SAR is located in testsuite/src/resources/deployers/jbas5349/META-INF/jboss-service.xml and is pretty simple:
<mbean code="org.jboss.test.deployers_jbas5349.sar.DeploymentDependencyTest"
| name="org.jboss.test.deployers_jbas5349.sar.deployment.dependency.test:service=DeploymentDependencyTest">
| </mbean>
I have not found any better way how to start JBoss server repeatedly with different jvmargs or system properties than copying the configuration of the profile "all" to the new one each time.
So the test starts from testsuite/build.xml this way:
<target name="deployment-dependency-tests" description="Tests deployment dependency in new JBossMC.">
| <copy file="${build.lib}/Aaadeploymentdependency-jbas5349.sar" overwrite="true" todir="${jboss.dist}/server/all/deploy/" />
| <create-profileservice-config baseconf="all" conf="deploymentdependencyserviceA"/>
| <server:config>
| <server name="deploymentdependencyserviceA">
| <jvmarg value="-Djbosstest.deploy.dir=${build.lib}" />
| <jvmarg value="-Ddeployment.dependency.test.module=deploymentdependency-ejb3-dummystateless.jar" />
| </server>
| </server:config>
| <server:start name="deploymentdependencyserviceA"/>
| <antcall target="test-deployment-dependency-mbean-state"/>
| <server:stop name="deploymentdependencyserviceA"/>
| <create-profileservice-config baseconf="all" conf="deploymentdependencyserviceB"/>
| <server:config>
| <server name="deploymentdependencyserviceB">
| <jvmarg value="-Djbosstest.deploy.dir=${build.lib}" />
| <jvmarg value="-Ddeployment.dependency.test.module=???" />
| </server>
| </server:config>
| <server:start name="deploymentdependencyserviceB"/>
| <antcall target="test-deployment-dependency-mbean-state"/>
| <server:stop name="deploymentdependencyserviceB"/>
| ...
| <delete file="${jboss.dist}/server/all/deploy/Aaadeploymentdependency-jbas5349.sar" />
| </target>
Where antcall "test-deployment-dependency-mbean-state" runs simple test case which just checks the state of the SAR:
package org.jboss.test.deployers_jbas5349;
|
| public class DeploymentDependencyTestCase
| extends JBossTestCase
| {
| // Constants -----------------------------------------------------
| public final static String DEPLOYMENT_DEPENDENCY_MBEAN_NAME =
| "org.jboss.test.deployers_jbas5349.sar.deployment.dependency.test:service=DeploymentDependencyTest";
| public final static int EXPECTED_MBEAN_STATE = 3;
|
| ...
|
| public void testSARStatus()
| throws Exception
| {
| getLog().debug("+++ testSARStatus");
|
| assertEquals(EXPECTED_MBEAN_STATE, checkMBeanState());
| }
|
| protected ObjectName getDeploymentDependencyMBeanName() throws MalformedObjectNameException
| {
| return new ObjectName(DEPLOYMENT_DEPENDENCY_MBEAN_NAME);
| }
|
| protected int checkMBeanState() throws Exception
| {
| if (Boolean.getBoolean("jbosstest.nodeploy") == true)
| return EXPECTED_MBEAN_STATE;
|
| Object state = invoke(getDeploymentDependencyMBeanName(), "getState", null, null);
|
| return ((Integer) state).intValue();
| }
| }
I have written the first test module - dummy (empty) EJB3 stateless bean and run the tests with next result:
2008-09-18 13:53:59,764 WARN [org.jboss.deployment.MainDeployer] (main) Failed to deploy: file:/home/studensky/workspace/trunk/testsuite/output/lib/deploymentdependency-ejb3-dummystateless.jar
| org.jboss.deployers.client.spi.IncompleteDeploymentException: Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS):
|
| *** CONTEXTS MISSING DEPENDENCIES: Name -> Dependency{Required State:Actual State}
|
| jboss.j2ee:ear=deploymentdependency-ejb3-dummystateless.jar,jar=deploymentdependency-ejb3-dummystateless.jar,name=DummyStateless,service=EJB3
| -> <UNKNOWN jboss.j2ee:ear=deploymentdependency-ejb3-dummystateless.jar,jar=deploymentdependency-ejb3-dummystateless.jar,name=DummyStateless,service=EJB3>{Described:** UNRESOLVED Demands 'jboss.ejb:service=EJBTimerService' **}
I hope this is one case of errors which this test should discover.
I will continue with writing other test modules like dummy EJB3 statefull, EJB3 entity, EJB3 MDB, EJB2 stateless, EJB2 statefull, EJB2 BMP entity, EJB2 CMP entity, EJB2 MDB, simple WAR, ...
If there are any considerations/issues about my work, don't hesitate to tell me, please.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4177399#4177399
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4177399
17 years, 6 months
[Design of Messaging on JBoss (Messaging/JBoss)] - Re: Notifications over JBM core connections
by timfox
"jmesnil" wrote : As part of the management task, I'm implementing receiving management notifications over JBM core connections.
|
| The idea is that a Core client can subscribe to notifications by asking the server to send a message to a given destination every time a notification is triggered on the server (e.g. a queue is full, a queue is added to the server)
|
| - the client creates a "management message", a Core message with well-known properties:
| * the ObjectName it wants to observe
|
What if there is no jmx server running? All this stuff should work with no JMX server too.
anonymous wrote :
| * the destination where the notification messages must be sent (specified by the client, can be any kind of destination, more likely either a topic or a temp queue)
| - it sends the message to the server
|
| - the server handles the message
| * the PostOffice detects it is a management message and pass it to the management service
|
I think it might be better to introduce a new packet on the wireformat ManagementMessage and send via that, then there's no need for special routing in the post office - it can be intercepted at the session level
anonymous wrote :
| * the management service creates a NotificationListener for the given ObjectName
|
This seems JMX dependent to me
anonymous wrote :
| - Later on, when a notification is received by the listener (e.g. a queue is full)
|
Are notifications supposed to be persisent (i.e. do they survive after the session that created them has died?)
If not, then the listener could just be the session, and you could use the standard session send functionality to send the notification
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4177354#4177354
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4177354
17 years, 6 months