[jboss-cvs] JBossAS SVN: r112139 - branches/JBPAPP_5_1_JBPAPP-6716/testsuite/src/main/org/jboss/test/deployment.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Aug 26 11:28:00 EDT 2011


Author: klape
Date: 2011-08-26 11:28:00 -0400 (Fri, 26 Aug 2011)
New Revision: 112139

Modified:
   branches/JBPAPP_5_1_JBPAPP-6716/testsuite/src/main/org/jboss/test/deployment/JBPAPP6716UnitTestCase.java
Log:
fixing first test method

Modified: branches/JBPAPP_5_1_JBPAPP-6716/testsuite/src/main/org/jboss/test/deployment/JBPAPP6716UnitTestCase.java
===================================================================
--- branches/JBPAPP_5_1_JBPAPP-6716/testsuite/src/main/org/jboss/test/deployment/JBPAPP6716UnitTestCase.java	2011-08-26 14:46:01 UTC (rev 112138)
+++ branches/JBPAPP_5_1_JBPAPP-6716/testsuite/src/main/org/jboss/test/deployment/JBPAPP6716UnitTestCase.java	2011-08-26 15:28:00 UTC (rev 112139)
@@ -35,6 +35,8 @@
 import javax.naming.InitialContext;
 import javax.sql.DataSource;
 
+import org.jboss.security.SimplePrincipal;
+import org.jboss.security.SecurityAssociation;
 import org.jboss.jmx.adaptor.rmi.RMIAdaptor;
 import org.jboss.mx.util.ObjectNameFactory;
 import org.jboss.services.deployment.MBeanData;
@@ -54,6 +56,8 @@
    public JBPAPP6716UnitTestCase(String name) throws Exception
    {
       super(name);
+      SecurityAssociation.setPrincipal(new SimplePrincipal("admin"));
+      SecurityAssociation.setCredential("admin");
    }
 
    protected void setUp() throws Exception
@@ -77,44 +81,56 @@
       
       for (int tries = 0; tries < maxNum; tries++)
       {
-        log.info("Test iteration "+tries);
-         
-        try
-        {
-           //Deploy & undeploy with URL
-           deployer.deploy(dummyUrl);
-           assertTrue("Failed to deploy URL", isDeployed(dummyUrl, false));
+         log.info("Test iteration "+tries);
+          
+         try
+         {
+            //Deploy & undeploy with URL
+            deployer.deploy(dummyUrl);
+            assertTrue("Failed to deploy URL", isDeployed(dummyUrl, false));
 
-           deployer.undeploy(dummyUrl);
-           assertTrue(dummyUrlString + " is not deployed when it should be", !isDeployed(dummyUrl, false));
+            deployer.undeploy(dummyUrl);
+            assertTrue(dummyUrlString + " is not deployed when it should be", !isDeployed(dummyUrl, false));
 
-           //Deploy & undeploy with String
-           deployer.deploy(dummyUrlString);
-           assertTrue(isDeployed(dummyUrl, true));
+            //Deploy & undeploy with String
+            deployer.deploy(dummyUrlString);
+            assertTrue(isDeployed(dummyUrl, true));
 
-           deployer.undeploy(dummyUrlString);
-           assertTrue(!isDeployed(dummyUrl, true));
+            deployer.undeploy(dummyUrlString);
+            assertTrue(!isDeployed(dummyUrl, true));
 
-           //Redploy 
-           deployer.deploy(dummyUrl);
-           assertTrue(isDeployed(dummyUrl, false));
+            //Redploy 
+            deployer.deploy(dummyUrl);
+            assertTrue(isDeployed(dummyUrl, false));
 
-           //With URL
-           deployer.redeploy(dummyUrl);
-           assertTrue(!isDeployed(dummyUrl, false));
+            //With URL
+            deployer.redeploy(dummyUrl);
+            assertTrue(isDeployed(dummyUrl, false));
 
-           //With String
-           deployer.redeploy(dummyUrlString);
-           assertTrue(!isDeployed(dummyUrl, true));
-        }
-        catch (Exception e)
-        {
-           e.printStackTrace();
-           super.fail("Caught exception, message: " + e.getMessage());
-        }
+            //With String
+            deployer.redeploy(dummyUrlString);
+            assertTrue(isDeployed(dummyUrl, true));
+         }
+         catch (Exception e)
+         {
+            e.printStackTrace();
+            super.fail("Caught exception, message: " + e.getMessage());
+         }
+         finally
+         {
+            try
+            {
+               //make sure it's undeployed before moving on
+               deployer.undeploy(dummyUrl);
+            }
+            catch(Exception ignore)
+            {
+               //ignore
+            }
+         }
       }
    }
-   
+ 
    //***** Listing Methods *****//
 
    public void testListDeployedAsString() throws Exception



More information about the jboss-cvs-commits mailing list