[jboss-cvs] JBossAS SVN: r74758 - in trunk/testsuite/src/main/org/jboss/test/profileservice: test and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Jun 17 22:20:40 EDT 2008


Author: scott.stark at jboss.org
Date: 2008-06-17 22:20:40 -0400 (Tue, 17 Jun 2008)
New Revision: 74758

Added:
   trunk/testsuite/src/main/org/jboss/test/profileservice/ejb3x/BeanImpl3x.java
   trunk/testsuite/src/main/org/jboss/test/profileservice/ejb3x/BeanRemote3x.java
Modified:
   trunk/testsuite/src/main/org/jboss/test/profileservice/test/DeployUnitTestCase.java
Log:
Complete the ejb3 deployment test and validation

Added: trunk/testsuite/src/main/org/jboss/test/profileservice/ejb3x/BeanImpl3x.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/profileservice/ejb3x/BeanImpl3x.java	                        (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/profileservice/ejb3x/BeanImpl3x.java	2008-06-18 02:20:40 UTC (rev 74758)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.profileservice.ejb3x;
+
+import javax.annotation.Resource;
+import javax.ejb.Remote;
+import javax.ejb.Stateless;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+/**
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+ at Stateless(mappedName="profileservice/ejb3x/BeanRemote3x")
+ at Remote(BeanRemote3x.class)
+public class BeanImpl3x
+   implements BeanRemote3x
+{
+   @Resource(name="entry1", mappedName="entry1Value")
+   private String x;
+
+   public Object getEnvEntry(String name) throws NamingException
+   {
+      return new InitialContext().lookup("java:/comp/env/" + name);
+   }
+
+}

Added: trunk/testsuite/src/main/org/jboss/test/profileservice/ejb3x/BeanRemote3x.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/profileservice/ejb3x/BeanRemote3x.java	                        (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/profileservice/ejb3x/BeanRemote3x.java	2008-06-18 02:20:40 UTC (rev 74758)
@@ -0,0 +1,33 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.profileservice.ejb3x;
+
+import javax.naming.NamingException;
+
+/**
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+public interface BeanRemote3x
+{
+   Object getEnvEntry(String name) throws NamingException;
+}

Modified: trunk/testsuite/src/main/org/jboss/test/profileservice/test/DeployUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/profileservice/test/DeployUnitTestCase.java	2008-06-18 02:20:03 UTC (rev 74757)
+++ trunk/testsuite/src/main/org/jboss/test/profileservice/test/DeployUnitTestCase.java	2008-06-18 02:20:40 UTC (rev 74758)
@@ -35,6 +35,7 @@
 import org.jboss.managed.api.ManagedDeployment.DeploymentPhase;
 import org.jboss.test.profileservice.ejb2x.BeanHome;
 import org.jboss.test.profileservice.ejb2x.BeanRemote;
+import org.jboss.test.profileservice.ejb3x.BeanRemote3x;
 
 /**
  * Profile service DeploymentManager tests
@@ -119,7 +120,50 @@
       DeploymentManager deployMgr = getDeploymentManager();
       URL contentURL = super.getDeployURL("testEjb3xDeployment.jar");
       assertNotNull(contentURL);
-      deployMgr.distribute("testEjb3xDeployment.jar", DeploymentPhase.APPLICATION, contentURL);      
+      DeploymentProgress progress = deployMgr.distribute("testEjb3xDeployment.jar", DeploymentPhase.APPLICATION, contentURL);
+      progress.addProgressListener(this);
+      progress.run();
+      DeploymentStatus status = progress.getDeploymentStatus();
+      assertTrue("DeploymentStatus.isCompleted", status.isCompleted());
+      // It should not be running yet
+      assertFalse("DeploymentStatus.isRunning", status.isRunning());
+      assertFalse("DeploymentStatus.isFailed", status.isFailed());
+
+      // Now start the deployment
+      String[] names = {"testEjb3xDeployment.jar"};
+      progress = deployMgr.start(DeploymentPhase.APPLICATION, names);
+      progress.addProgressListener(this);
+      progress.run();
+      status = progress.getDeploymentStatus();
+      assertTrue("DeploymentStatus.isCompleted", status.isCompleted());
+      assertTrue("DeploymentStatus.isRunning", status.isRunning());
+      assertFalse("DeploymentStatus.isFailed", status.isFailed());
+      // Check for a 
+      ManagementView mgtView = super.getManagementView();
+      ManagedDeployment ejb3x = mgtView.getDeployment("testEjb3xDeployment.jar", DeploymentPhase.APPLICATION);
+      assertNotNull(ejb3x);
+      log.info("Found ejb deployment: "+ejb3x);
+      assertTrue(ejb3x.getTypes().contains("ejb3x"));
+      // Validate the ejb
+      InitialContext ic = new InitialContext();
+      BeanRemote3x bean = (BeanRemote3x) ic.lookup("BeanImpl3x/remote");
+      String entry1 = (String) bean.getEnvEntry("entry1");
+      assertEquals("entry1Value", entry1);
+
+      // Stop/remove the deployment
+      progress = deployMgr.stop(DeploymentPhase.APPLICATION, names);
+      progress.addProgressListener(this);
+      progress.run();
+      status = progress.getDeploymentStatus();
+      assertTrue("DeploymentStatus.isCompleted", status.isCompleted());
+      assertFalse("DeploymentStatus.isFailed", status.isFailed());
+      
+      progress = deployMgr.undeploy(DeploymentPhase.APPLICATION, names);
+      progress.addProgressListener(this);
+      progress.run();
+      status = progress.getDeploymentStatus();
+      assertTrue("DeploymentStatus.isCompleted", status.isCompleted());
+      assertFalse("DeploymentStatus.isFailed", status.isFailed());
    }
    public void testEjb2xDeployment()
       throws Exception




More information about the jboss-cvs-commits mailing list