User: d_jencks
  Date: 01/09/18 15:00:43

  Modified:    src/main/org/jboss/test JBossTestCase.java
                        JBossTestServices.java JBossTestSetup.java
  Log:
  Changed tests to deploy/undeploy only once per testcase file.  Moved clearAuthCache 
to JBossTestServices
  
  Revision  Changes    Path
  1.4       +33 -7     jbosstest/src/main/org/jboss/test/JBossTestCase.java
  
  Index: JBossTestCase.java
  ===================================================================
  RCS file: /cvsroot/jboss/jbosstest/src/main/org/jboss/test/JBossTestCase.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- JBossTestCase.java        2001/09/17 17:33:52     1.3
  +++ JBossTestCase.java        2001/09/18 22:00:42     1.4
  @@ -42,7 +42,7 @@
    * ../lib).
    *
    * @author    <a href="[EMAIL PROTECTED]">David Jencks</a>
  - * @version   $Revision: 1.3 $
  + * @version   $Revision: 1.4 $
    */
   public class JBossTestCase
          extends TestCase
  @@ -83,21 +83,21 @@
       * The JUnit setup method
       *
       * @exception Exception  Description of Exception
  -    */
  +    * /
      protected void setUp() throws Exception
      {
         delegate.setUp();
  -   }
  +      }*/
   
      /**
       * The teardown method for JUnit
       *
       * @exception Exception  Description of Exception
  -    */
  +    * /
      protected void tearDown() throws Exception
      {
         delegate.tearDown();
  -   }
  +   }*/
   
   
   
  @@ -108,7 +108,7 @@
       *
       * @return   The InitialContext value
       */
  -   protected InitialContext getInitialContext()
  +   protected InitialContext getInitialContext() throws Exception
      {
         return delegate.getInitialContext();
      }
  @@ -118,7 +118,7 @@
       *
       * @return   The Server value
       */
  -   protected RMIConnector getServer()
  +   protected RMIConnector getServer() throws Exception
      {
         return delegate.getServer();
      }
  @@ -251,6 +251,32 @@
         delegate.undeployService(name);
      }
   
  +   protected static Test getJ2eeSetup(final Test test, final String jarName) throws 
Exception
  +   {
  +      JBossTestSetup wrapper = new JBossTestSetup(test)
  +         {
  +
  +             protected void setUp() throws Exception
  +             {
  +                this.deployJ2ee(jarName);
  +                this.getLog().debug("deployed package: " + jarName);
  +             }
  +
  +             protected void tearDown() throws Exception
  +             {
  +                this.undeployJ2ee(jarName);
  +                this.getLog().debug("undeployed package: " + jarName);
  +             }
  +          };
  +      return wrapper;
  +   }
  +
  +   protected static Test getJ2eeSetup(final Class clazz, final String jarName) 
throws Exception
  +   {
  +      TestSuite suite = new TestSuite();  
  +      suite.addTest(new TestSuite(clazz));
  +      return getJ2eeSetup(suite, jarName);
  +   }
   
      //private methods--------------
   
  
  
  
  1.3       +33 -11    jbosstest/src/main/org/jboss/test/JBossTestServices.java
  
  Index: JBossTestServices.java
  ===================================================================
  RCS file: /cvsroot/jboss/jbosstest/src/main/org/jboss/test/JBossTestServices.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- JBossTestServices.java    2001/09/18 08:23:25     1.2
  +++ JBossTestServices.java    2001/09/18 22:00:42     1.3
  @@ -41,7 +41,7 @@
    * ../lib).
    *
    * @author    <a href="[EMAIL PROTECTED]">David Jencks</a>
  - * @version   $Revision: 1.2 $
  + * @version   $Revision: 1.3 $
    */
   public class JBossTestServices
   {
  @@ -81,13 +81,6 @@
       */
      public void setUp() throws Exception
      {
  -      String serverName = System.getProperty("jbosstest.server.name");
  -      if (serverName == null)
  -      {
  -         serverName = InetAddress.getLocalHost().getHostName();
  -      }
  -      initialContext = new InitialContext();
  -      server = (RMIConnector)getInitialContext().lookup("jmx:" + serverName + 
":rmi");
         log.debug("JBossTestServices.setUp()");
      }
   
  @@ -98,7 +91,7 @@
       */
      public void tearDown() throws Exception
      {
  -      server = null;
  +      // server = null;
         log.debug("JBossTestServices.tearDown()");
      }
   
  @@ -110,8 +103,9 @@
       *
       * @return   The InitialContext value
       */
  -   InitialContext getInitialContext()
  +   InitialContext getInitialContext() throws Exception
      {
  +      init();
         return initialContext;
      }
   
  @@ -120,8 +114,9 @@
       *
       * @return   The Server value
       */
  -   RMIConnector getServer()
  +   RMIConnector getServer() throws Exception
      {
  +      init();
         return server;
      }
   
  @@ -325,6 +320,16 @@
      }
   
   
  +   void flushAuthCache() throws Exception
  +   {     
  +      ObjectName jaasMgr = new ObjectName("Security:name=JaasSecurityManager");
  +      Object[] params = {"other"};
  +      String[] signature = {"java.lang.String"};
  +      invoke(jaasMgr, "flushAuthenticationCache", params, signature);
  +   }
  +
  +
  +
      //private methods--------------
   
      private void setDeployed(String name)
  @@ -336,4 +341,21 @@
      {
         deployed.remove(name);
      }
  +
  +   private void init() throws Exception
  +   {
  +      if (initialContext == null) 
  +      {
  +         initialContext = new InitialContext();           
  +      }
  +      if (server == null) {
  +         String serverName = System.getProperty("jbosstest.server.name");
  +         if (serverName == null)
  +         {
  +            serverName = InetAddress.getLocalHost().getHostName();
  +         }
  +         server = (RMIConnector)initialContext.lookup("jmx:" + serverName + ":rmi");
  +      }
  +   }
  +
   }
  
  
  
  1.2       +13 -7     jbosstest/src/main/org/jboss/test/JBossTestSetup.java
  
  Index: JBossTestSetup.java
  ===================================================================
  RCS file: /cvsroot/jboss/jbosstest/src/main/org/jboss/test/JBossTestSetup.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- JBossTestSetup.java       2001/09/17 17:33:52     1.1
  +++ JBossTestSetup.java       2001/09/18 22:00:42     1.2
  @@ -44,7 +44,7 @@
    * ../lib).
    *
    * @author    <a href="[EMAIL PROTECTED]">David Jencks</a>
  - * @version   $Revision: 1.1 $
  + * @version   $Revision: 1.2 $
    */
   public class JBossTestSetup
          extends TestSetup
  @@ -74,21 +74,21 @@
       * The JUnit setup method
       *
       * @exception Exception  Description of Exception
  -    */
  +    * /
      protected void setUp() throws Exception
      {
         delegate.setUp();
  -   }
  +      }*/
   
      /**
       * The teardown method for JUnit
       *
       * @exception Exception  Description of Exception
  -    */
  +    * /
      protected void tearDown() throws Exception
      {
         delegate.tearDown();
  -   }
  +      }*/
   
   
   
  @@ -99,7 +99,7 @@
       *
       * @return   The InitialContext value
       */
  -   protected InitialContext getInitialContext()
  +   protected InitialContext getInitialContext() throws Exception
      {
         return delegate.getInitialContext();
      }
  @@ -109,7 +109,7 @@
       *
       * @return   The Server value
       */
  -   protected RMIConnector getServer()
  +   protected RMIConnector getServer() throws Exception
      {
         return delegate.getServer();
      }
  @@ -240,6 +240,12 @@
      protected void undeployService(String name) throws Exception
      {
         delegate.undeployService(name);
  +   }
  +
  +
  +   protected void flushAuthCache() throws Exception
  +   {
  +      delegate.flushAuthCache();
      }
   
   
  
  
  

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to