User: schaefera
  Date: 02/03/23 18:27:49

  Modified:    src/main/org/jboss/test/management/test
                        JSR77SpecUnitTestCase.java
  Log:
  getLog() in inner class listener fails at runtime therefore removed but
  brought the Notification Listener test back in after the fixes.
  
  Revision  Changes    Path
  1.7       +49 -30    
jbosstest/src/main/org/jboss/test/management/test/JSR77SpecUnitTestCase.java
  
  Index: JSR77SpecUnitTestCase.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jbosstest/src/main/org/jboss/test/management/test/JSR77SpecUnitTestCase.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- JSR77SpecUnitTestCase.java        15 Mar 2002 07:04:41 -0000      1.6
  +++ JSR77SpecUnitTestCase.java        24 Mar 2002 02:27:49 -0000      1.7
  @@ -30,12 +30,17 @@
   import org.jboss.test.JBossTestCase;
   import org.jboss.test.JBossTestSetup;
   
  +import org.jboss.management.j2ee.J2EEDomain;
  +import org.jboss.management.j2ee.J2EEManagedObject;
  +import org.jboss.management.j2ee.J2EEServer;
  +import org.jboss.management.j2ee.JDBCDataSource;
  +
   /**
    * Test of JSR-77 specification conformance using the ??ToDo
    * These test the basic JSR-77 handling and access.
    *
    * @author  <a href="mailto:[EMAIL PROTECTED]";>Andreas Schaefer</a>.
  - * @version $Revision: 1.6 $
  + * @version $Revision: 1.7 $
    *   
    * <p><b>Revisions:</b>
    *
  @@ -49,6 +54,8 @@
   {
      // Constants -----------------------------------------------------
      
  +   public static final String TEST_DATASOURCE = "DefaultDS";
  +   
      // Attributes ----------------------------------------------------
      
      // Static --------------------------------------------------------
  @@ -114,14 +121,17 @@
         Management lManagement = getManagementEJB();
         Set lNames = lManagement.queryNames(
            new ObjectName(
  -            lManagement.getDefaultDomain() + ":j2eeType=J2EEDomain,*"
  -         )
  +            lManagement.getDefaultDomain() + ":" +
  +            J2EEManagedObject.TYPE + "=" + J2EEDomain.J2EE_TYPE + "," +
  +            "*"
  +         ),
  +         null
         );
         if( lNames.isEmpty() ) {
  -         fail( "Could not found JSR-77 root object of j2eeType 'J2EEDomain'" );
  +         fail( "Could not found JSR-77 root object of type '" + 
J2EEDomain.J2EE_TYPE + "'" );
         }
         if( lNames.size() > 1 ) {
  -         fail( "Found more than one JSR-77 root objects of j2eeType 'J2EEDomain'" );
  +         fail( "Found more than one JSR-77 root objects of type '" + 
J2EEDomain.J2EE_TYPE + "'" );
         }
         ObjectName lManagementDomain = (ObjectName) lNames.iterator().next();
         getLog().debug( "+++ testGetManagementDomain, root: " + lManagementDomain );
  @@ -140,19 +150,23 @@
         Management lManagement = getManagementEJB();
         Set lNames = lManagement.queryNames(
            new ObjectName(
  -            lManagement.getDefaultDomain() + 
":j2eeType=JDBCDataSource,name=DefaultDS,*"
  -         )
  +            lManagement.getDefaultDomain() + ":" +
  +            J2EEManagedObject.TYPE + "=" + JDBCDataSource.J2EE_TYPE + "," +
  +            "name=" + TEST_DATASOURCE + "," +
  +            "*"
  +         ),
  +         null
         );
         if( lNames.isEmpty() ) {
  -         fail( "Could not found JSR-77 JDBC DataSource named 'DefaultDS'" );
  +         fail( "Could not found JSR-77 JDBC DataSource named '" + TEST_DATASOURCE + 
"'" );
         }
         if( lNames.size() > 1 ) {
  -         fail( "Found more than one JSR-77 JDBC DataSource named 'DefaultDS'" );
  +         fail( "Found more than one JSR-77 JDBC DataSource named '" + 
TEST_DATASOURCE + "'" );
         }
         ObjectName lDataSource = (ObjectName) lNames.iterator().next();
  -      getLog().debug( "+++ testGetDataSource, DefaultDS: " + lDataSource );
  +      getLog().debug( "+++ testGetDataSource, " + TEST_DATASOURCE + ": " + 
lDataSource );
         getLog().debug(
  -         "+++ testGetDataSource, DefaultDS status: " +
  +         "+++ testGetDataSource, " + TEST_DATASOURCE + " status: " +
            lManagement.getAttribute( lDataSource, "State" )
         );
         lManagement.remove();
  @@ -169,20 +183,24 @@
         Management lManagement = getManagementEJB();
         Set lNames = lManagement.queryNames(
            new ObjectName(
  -            lManagement.getDefaultDomain() + 
":j2eeType=JDBCDataSource,name=DefaultDS,*"
  -         )
  +            lManagement.getDefaultDomain() + ":" +
  +            J2EEManagedObject.TYPE + "=" + JDBCDataSource.J2EE_TYPE + "," +
  +            "name=" + TEST_DATASOURCE + "," +
  +            "*"
  +         ),
  +         null
         );
         if( lNames.isEmpty() ) {
  -         fail( "Could not found JSR-77 JDBC DataSource named 'DefaultDS'" );
  +         fail( "Could not found JSR-77 JDBC DataSource named '" + TEST_DATASOURCE + 
"'" );
         }
         if( lNames.size() > 1 ) {
  -         fail( "Found more than one JSR-77 JDBC DataSource named 'DefaultDS'" );
  +         fail( "Found more than one JSR-77 JDBC DataSource named '" + 
TEST_DATASOURCE + "'" );
         }
         ObjectName lDataSource = (ObjectName) lNames.iterator().next();
  -      getLog().debug( "+++ testRestartDatasource, DefaultDS: " + lDataSource );
  -      getLog().debug( "+++ testRestartDatasource, stop DefaultDS" );
  +      getLog().debug( "+++ testRestartDatasource, " + TEST_DATASOURCE + ": " + 
lDataSource );
  +      getLog().debug( "+++ testRestartDatasource, stop " + TEST_DATASOURCE + "" );
         lManagement.invoke( lDataSource, "stop", new Object[] {}, new String[] {} );
  -      getLog().debug( "+++ testRestartDatasource, start DefaultDS" );
  +      getLog().debug( "+++ testRestartDatasource, start " + TEST_DATASOURCE + "" );
         lManagement.invoke( lDataSource, "start", new Object[] {}, new String[] {} );
         lManagement.remove();
      }
  @@ -190,8 +208,6 @@
      /**
       * Test the notification delivery by restarting Default DataSource
       **/
  -/* AS: Take this test out because it causes and endless loop and I want to
  -   commit the changes. Will bring it back in soon.
       public void testNotificationDeliver()
         throws
            Exception
  @@ -201,35 +217,39 @@
         Management lManagement = getManagementEJB();
         Set lNames = lManagement.queryNames(
            new ObjectName(
  -            lManagement.getDefaultDomain() + 
":j2eeType=JDBCDataSource,name=DefaultDS,*"
  -         )
  +            lManagement.getDefaultDomain() + ":" +
  +            J2EEManagedObject.TYPE + "=" + JDBCDataSource.J2EE_TYPE + "," +
  +            "name=" + TEST_DATASOURCE + "," +
  +            "*"
  +         ),
  +         null
         );
         if( lNames.isEmpty() ) {
  -         fail( "Could not found JSR-77 JDBC DataSource named 'DefaultDS'" );
  +         fail( "Could not found JSR-77 JDBC DataSource named '" + TEST_DATASOURCE + 
"'" );
         }
         if( lNames.size() > 1 ) {
  -         fail( "Found more than one JSR-77 JDBC DataSource named 'DefaultDS'" );
  +         fail( "Found more than one JSR-77 JDBC DataSource named '" + 
TEST_DATASOURCE + "'" );
         }
         ObjectName lDataSource = (ObjectName) lNames.iterator().next();
         Listener lLocalListener = new Listener();
         ListenerRegistration lListenerFactory = lManagement.getListenerRegistry();
  -      getLog().debug( "+++ testNotificationDeliver, add Notification Listener" );
  +      getLog().debug( "+++ testNotificationDeliver, add Notification Listener to " 
+ TEST_DATASOURCE + "" );
         lListenerFactory.addNotificationListener(
            lDataSource,
            lLocalListener,
            null,
            null
         );
  -      getLog().debug( "+++ testNotificationDeliver, stop DefaultDS" );
  +      getLog().debug( "+++ testNotificationDeliver, stop " + TEST_DATASOURCE + "" );
         lManagement.invoke( lDataSource, "stop", new Object[] {}, new String[] {} );
  -      getLog().debug( "+++ testNotificationDeliver, start DefaultDS" );
  +      getLog().debug( "+++ testNotificationDeliver, start " + TEST_DATASOURCE + "" 
);
         lManagement.invoke( lDataSource, "start", new Object[] {}, new String[] {} );
         // Wait 5 seconds to ensure that the notifications are delivered
         Thread.sleep( 5000 );
         if( lLocalListener.getNumberOfNotifications() < 2 ) {
            fail( "Not enough notifications received: " + 
lLocalListener.getNumberOfNotifications() );
         }
  -      getLog().debug( "+++ testNotificationDeliver, remove Notification Listener" );
  +      getLog().debug( "+++ testNotificationDeliver, remove Notification Listener 
from " + TEST_DATASOURCE + "" );
         lListenerFactory.removeNotificationListener(
            lDataSource,
            lLocalListener
  @@ -241,7 +261,7 @@
            throw e;
         }
      }
  -*/
  +// */
      
      // Z implementation ----------------------------------------------
      
  @@ -278,7 +298,6 @@
         }
         
         public void handleNotification( Notification pNotification, Object pHandbank 
) {
  -//         getLog().debug( "Got notification: " + pNotification );
            mNrOfNotifications++;
         }
      }
  
  
  

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

Reply via email to