You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by GitBox <gi...@apache.org> on 2018/01/22 22:04:17 UTC

[GitHub] asfgit closed pull request #374: [NETBEANS-138] Fix ScanStartedTest in parsing.indexing module.

asfgit closed pull request #374: [NETBEANS-138] Fix ScanStartedTest in parsing.indexing module.
URL: https://github.com/apache/incubator-netbeans/pull/374
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/parsing.indexing/test/unit/src/org/netbeans/modules/parsing/impl/indexing/ScanStartedTest.java b/parsing.indexing/test/unit/src/org/netbeans/modules/parsing/impl/indexing/ScanStartedTest.java
index 01c0c8bbc..eec23e727 100644
--- a/parsing.indexing/test/unit/src/org/netbeans/modules/parsing/impl/indexing/ScanStartedTest.java
+++ b/parsing.indexing/test/unit/src/org/netbeans/modules/parsing/impl/indexing/ScanStartedTest.java
@@ -60,6 +60,10 @@
     
     private final Map<String, Map<ClassPath,Void>> registeredClasspaths = new HashMap<String, Map<ClassPath,Void>>();
     
+    private static final Logger LOG = Logger.getLogger(RepositoryUpdater.class.getName()+".tests"); //NOI18N
+    
+    private TestHandler handler;
+    
     private IndexerFactory factory1;
     private IndexerFactory factory2;
     private IndexerFactory factory3;
@@ -84,12 +88,12 @@ protected void getAdditionalServices(List<Class> clazz) {
         super.getAdditionalServices(clazz);
         clazz.add(FooCPP.class);
     }
-
-    final TestHandler handler = new TestHandler();
     
     @Override
     protected void setUp() throws Exception {
         super.setUp();
+        
+        handler = new TestHandler(); 
 
         this.clearWorkDir();
         final File _wd = this.getWorkDir();
@@ -125,29 +129,24 @@ protected void setUp() throws Exception {
         MockMimeLookup.setInstances(MimePath.EMPTY, binFactory1, binFactory2, binFactory3);
         MockMimeLookup.setInstances(MimePath.get(FOO_MIME), factory1, factory2, factory3);
         RepositoryUpdaterTest.setMimeTypes(FOO_MIME);
-
-        RepositoryUpdaterTest.waitForRepositoryUpdaterInit();
         
-        final Logger logger = Logger.getLogger(RepositoryUpdater.class.getName()+".tests"); //NOI18N
-        logger.setLevel (Level.FINEST);
-        logger.addHandler(handler);
+        RepositoryUpdaterTest.waitForRepositoryUpdaterInit();  
+        
+        LOG.setLevel (Level.FINEST);
+        LOG.addHandler(handler);
 
     }
 
     @Override
     protected void tearDown() throws Exception {
-        final TestHandler handler = new TestHandler();
-        final Logger logger = Logger.getLogger(RepositoryUpdater.class.getName()+".tests"); //NOI18N
         try {
-            logger.setLevel (Level.FINEST);
-            logger.addHandler(handler);
             for(String id : registeredClasspaths.keySet()) {
                 final Map<ClassPath,Void> classpaths = registeredClasspaths.get(id);
                 GlobalPathRegistry.getDefault().unregister(id, classpaths.keySet().toArray(new ClassPath[classpaths.size()]));
             }
             handler.await();
         } finally {
-            logger.removeHandler(handler);
+            LOG.removeHandler(handler);
         }
         super.tearDown();
     }
@@ -252,7 +251,6 @@ public void testBinaryScanFinishedAfterScanStarted() throws Exception {
 
     public void testBinaryScanFinishedAfterScanStartedWithException() throws Exception {
         assertTrue(GlobalPathRegistry.getDefault().getPaths(FOO_BINARY).isEmpty());
-
         binFactory2.throwFromScanStarted = new RuntimeException();
 
         //Testing classpath registration


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists