[jboss-cvs] JBossAS SVN: r105743 - in branches/JBPAPP_5_1: 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
Sat Jun 5 00:10:34 EDT 2010


Author: miclark
Date: 2010-06-05 00:10:33 -0400 (Sat, 05 Jun 2010)
New Revision: 105743

Modified:
   branches/JBPAPP_5_1/system/src/main/org/jboss/system/server/profileservice/hotdeploy/HDScanner.java
   branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/profileservice/test/HDScannerTestCase.java
Log:
Fix for JBPAPP-4431, HDScanner's setScanEnabled() method Fails to enable scanning on first invocation.

Modified: branches/JBPAPP_5_1/system/src/main/org/jboss/system/server/profileservice/hotdeploy/HDScanner.java
===================================================================
--- branches/JBPAPP_5_1/system/src/main/org/jboss/system/server/profileservice/hotdeploy/HDScanner.java	2010-06-05 04:05:48 UTC (rev 105742)
+++ branches/JBPAPP_5_1/system/src/main/org/jboss/system/server/profileservice/hotdeploy/HDScanner.java	2010-06-05 04:10:33 UTC (rev 105743)
@@ -215,18 +215,18 @@
     *
     * @param scanEnabled true to enable scans, false to disable.
     */
-   public synchronized void setScanEnabled(boolean scanEnabled)
+   public synchronized void setScanEnabled(boolean enabled)
    {
-      if (scanEnabled == true && activeScan == null && scanExecutor != null)
+      this.scanEnabled = enabled;
+
+      if (enabled == true && activeScan == null && scanExecutor != null)
       {
          start();
       }
-      else if (scanEnabled == false && activeScan != null)
+      else if (enabled == false && activeScan != null)
       {
          stop();
       }
-
-      this.scanEnabled = scanEnabled;
    }
 
    public boolean isCreatedScanExecutor()

Modified: branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/profileservice/test/HDScannerTestCase.java
===================================================================
--- branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/profileservice/test/HDScannerTestCase.java	2010-06-05 04:05:48 UTC (rev 105742)
+++ branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/profileservice/test/HDScannerTestCase.java	2010-06-05 04:10:33 UTC (rev 105743)
@@ -29,6 +29,7 @@
  * HDScanner test cases.
  *
  * @author <a href="mailto:jawilson at redhat.com">Jimmy Wilson</a>
+ * @author <a href="mailto:miclark at redhat.com">Mike M. Clark</a>
  */
 public class HDScannerTestCase extends JBossTestCase
 {
@@ -72,4 +73,25 @@
       assertFalse("HDScanner had a scheduled scan when ScanEnabled was false",
                   hdScanner.isScanScheduled());
     }
-}
\ No newline at end of file
+
+    /**
+     * Test for JBAS-8071.
+     * 
+     * Verify that setting <code>scanEnabled</code> attribute from
+     * <code>false</code> to <code>true</code> works.
+     */
+    public void testSettingScanEnabledFromFalseToTrueWorks()
+    throws Exception
+    {
+      HDScanner hdScanner = new HDScanner();
+      hdScanner.setScanEnabled(false);
+      hdScanner.create();
+      hdScanner.start();
+      assertFalse("HDScanner had a scheduled scan when ScanEnabled was false",
+                  hdScanner.isScanScheduled());
+      
+      hdScanner.setScanEnabled(true);
+      assertTrue("HDScanner did not have a scheduled scan when ScanEnabled was set to true",
+                  hdScanner.isScanScheduled());
+    }
+}



More information about the jboss-cvs-commits mailing list