Java Code Examples for java.util.logging.Logger#removeHandler()

The following examples show how to use java.util.logging.Logger#removeHandler() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LOGBackConfigurer.java    From styx with Apache License 2.0 6 votes vote down vote up
/**
 * Initialize LOGBack from the given URL.
 *
 * @param url              the url pointing to the location of the config file.
 * @param installJULBridge set to true to install SLF4J JUL bridge
 * @throws IllegalArgumentException if the url points to a non existing location or an error occurs during the parsing operation.
 */
public static void initLogging(URL url, boolean installJULBridge) {
    StaticLoggerBinder.getSingleton();
    ContextSelector selector = ContextSelectorStaticBinder.getSingleton().getContextSelector();
    LoggerContext loggerContext = selector.getLoggerContext();
    loggerContext.stop();
    ContextInitializer ctxi = new ContextInitializer(loggerContext);
    try {
        ctxi.configureByResource(url);
        loggerContext.start();
        if (installJULBridge) {
            //uninstall already present handlers we want to
            //continue logging through SLF4J after this point
            Logger l = LogManager.getLogManager().getLogger("");
            for (Handler h : l.getHandlers()) {
                l.removeHandler(h);
            }
            SLF4JBridgeHandler.install();

        }
    } catch (JoranException e) {
        throw new IllegalArgumentException("exception while initializing LOGBack", e);
    }
}
 
Example 2
Source File: SourcePrefetcherTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public void testConPref() throws Exception {
    JavaIndexerWorker.TEST_DO_PREFETCH = true;
    final LogHandler handler = new LogHandler();
    handler.expect("Using concurrent iterator, {0} workers");    //NOI18N
    final Logger log = Logger.getLogger(JavaIndexerWorker.class.getName());
    log.setLevel(Level.FINE);
    log.addHandler(handler);
    try {
        SourcePrefetcher pf = SourcePrefetcher.create(files, SuspendSupport.NOP);
        assertTrue(handler.isFound());
        final Deque<CompileTuple> got = new ArrayDeque<CompileTuple>(FILE_COUNT);
        while (pf.hasNext()) {
            final CompileTuple ct = pf.next();
            assertNotNull(getCache(ct.jfo));
            got.offer(ct);
            pf.remove();
            assertNull(getCache(ct.jfo));
        }
        assertCollectionsEqual(files,got);
    } finally {
        log.removeHandler(handler);
    }
}
 
Example 3
Source File: CslTestBase.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Override
protected void tearDown() throws Exception {
    if (classPathsForTest != null && !classPathsForTest.isEmpty()) {
        Logger logger = Logger.getLogger(RepositoryUpdater.class.getName() + ".tests");
        logger.setLevel(Level.FINEST);
        Waiter w = new Waiter(classPathContainsBinaries());
        logger.addHandler(w);

        for(String cpId : classPathsForTest.keySet()) {
            ClassPath cp = classPathsForTest.get(cpId);
            GlobalPathRegistry.getDefault().unregister(cpId, new ClassPath [] { cp });
        }

        w.waitForScanToFinish();
        logger.removeHandler(w);
    }

    super.tearDown();
}
 
Example 4
Source File: IndexerOrderingTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public void testEmbeddingIndexerOrdering() throws InterruptedException {
    assertTrue(GlobalPathRegistry.getDefault().getPaths(SRC_EMB).isEmpty());
    final RepositoryUpdaterTest.TestHandler handler = new RepositoryUpdaterTest.TestHandler();
    final Logger logger = Logger.getLogger(RepositoryUpdater.class.getName()+".tests"); //NOI18N
    logger.setLevel (Level.FINEST);
    logger.addHandler(handler);
    try {
        final ClassPath cp = ClassPathSupport.createClassPath(eroot);
        calls.clear();
        globalPathRegistry_register(SRC_EMB, new ClassPath[]{cp});
        assertTrue (handler.await());
        assertEquals(5, calls.size());
        final Iterator<SourceIndexerFactory> callsIt = calls.iterator();
        for (int i=1; i<=5; i++) {
            assertEquals(
                String.format("EI%d",i),    //NOI18N
                callsIt.next().getIndexerName());
        }
        
    } finally {
        logger.removeHandler(handler);
    }
}
 
Example 5
Source File: LogUtilsTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
@Test
public void testLogParamsSubstitutionWithThrowable() throws Exception {
    Logger log = LogUtils.getL7dLogger(LogUtilsTest.class, null,
                                       "testLogParamsSubstitutionWithThrowable");
    Handler handler = EasyMock.createNiceMock(Handler.class);
    Exception ex = new Exception();
    LogRecord record = new LogRecord(Level.SEVERE, "subbed in 4 & 3");
    record.setThrown(ex);
    EasyMock.reportMatcher(new LogRecordMatcher(record));
    handler.publish(record);
    EasyMock.replay(handler);
    synchronized (log) {
        log.addHandler(handler);
        LogUtils.log(log, Level.SEVERE, "SUB2_MSG", ex, new Object[] {3, 4});
        EasyMock.verify(handler);
        log.removeHandler(handler);
    }
}
 
Example 6
Source File: LogsManager.java    From RepoSense with MIT License 5 votes vote down vote up
/**
 * Removes all the handlers from {@code logger}.
 */
private static void removeHandlers(Logger logger) {
    Handler[] handlers = logger.getHandlers();
    for (Handler handler : handlers) {
        logger.removeHandler(handler);
    }
}
 
Example 7
Source File: LoggerConfiguration.java    From slf4android with MIT License 5 votes vote down vote up
/**
 * Removes all handlers that derive from {@code handlerToRemoveClass} from logger named {@code logger}.
 */
public LoggerConfiguration removeHandlerFromLogger(String loggerName, Class<? extends Handler> handlerToRemoveClass) {
    Logger rootLogger = LogManager.getLogManager().getLogger(loggerName);
    for (Handler handler : Arrays.asList(rootLogger.getHandlers())) {
        if (handlerToRemoveClass.isAssignableFrom(handler.getClass())) {
            rootLogger.removeHandler(handler);
        }
    }
    return this;
}
 
Example 8
Source File: BeamFnLoggingClient.java    From beam with Apache License 2.0 5 votes vote down vote up
public BeamFnLoggingClient(
    PipelineOptions options,
    Endpoints.ApiServiceDescriptor apiServiceDescriptor,
    Function<Endpoints.ApiServiceDescriptor, ManagedChannel> channelFactory) {
  this.apiServiceDescriptor = apiServiceDescriptor;
  this.inboundObserverCompletion = new CompletableFuture<>();
  this.configuredLoggers = new ArrayList<>();
  this.phaser = new Phaser(1);
  this.channel = channelFactory.apply(apiServiceDescriptor);

  // Reset the global log manager, get the root logger and remove the default log handlers.
  LogManager logManager = LogManager.getLogManager();
  logManager.reset();
  Logger rootLogger = logManager.getLogger(ROOT_LOGGER_NAME);
  for (Handler handler : rootLogger.getHandlers()) {
    rootLogger.removeHandler(handler);
  }

  // Use the passed in logging options to configure the various logger levels.
  SdkHarnessOptions loggingOptions = options.as(SdkHarnessOptions.class);
  if (loggingOptions.getDefaultSdkHarnessLogLevel() != null) {
    rootLogger.setLevel(LEVEL_CONFIGURATION.get(loggingOptions.getDefaultSdkHarnessLogLevel()));
  }

  if (loggingOptions.getSdkHarnessLogLevelOverrides() != null) {
    for (Map.Entry<String, SdkHarnessOptions.LogLevel> loggerOverride :
        loggingOptions.getSdkHarnessLogLevelOverrides().entrySet()) {
      Logger logger = Logger.getLogger(loggerOverride.getKey());
      logger.setLevel(LEVEL_CONFIGURATION.get(loggerOverride.getValue()));
      configuredLoggers.add(logger);
    }
  }

  BeamFnLoggingGrpc.BeamFnLoggingStub stub = BeamFnLoggingGrpc.newStub(channel);
  inboundObserver = new LogControlObserver();
  logRecordHandler = new LogRecordHandler(options.as(GcsOptions.class).getExecutorService());
  logRecordHandler.setLevel(Level.ALL);
  outboundObserver = (CallStreamObserver<BeamFnApi.LogEntry.List>) stub.logging(inboundObserver);
  rootLogger.addHandler(logRecordHandler);
}
 
Example 9
Source File: LogFilterHandler.java    From org.openntf.domino with Apache License 2.0 5 votes vote down vote up
private Logger activateOneLogger(final String loggerName, final LogFilterHandler[] oldLFHs) {
	Logger l = Logger.getLogger(loggerName);
	l.setLevel(getLevel());
	for (LogFilterHandler oldLFH : oldLFHs) {
		oldLFH.close();
		l.removeHandler(oldLFH);
	}
	l.addHandler(this);
	l.setUseParentHandlers(false);
	LogManager.getLogManager().addLogger(l);
	return l;
}
 
Example 10
Source File: ExportTest.java    From jpexs-decompiler with GNU General Public License v3.0 5 votes vote down vote up
@AfterClass
public void removeLogger() {
    if (loggerHandler != null) {
        Logger logger = Logger.getLogger("");
        logger.removeHandler(loggerHandler);
    }
}
 
Example 11
Source File: WhenConverterIsRegistered.java    From asciidoctorj with Apache License 2.0 5 votes vote down vote up
@Test
public void shouldBeAbleToLog() {
    MemoryLogHandler handler = registerMemoryLogHandler();
    try {
        asciidoctor.javaConverterRegistry().register(TextConverter.class);

        String result = asciidoctor.convert("== Hello\n\nWorld!\n\n- a\n- b", OptionsBuilder.options().backend(TextConverter.DEFAULT_FORMAT));

        assertThat(handler.getLogRecords(), hasSize(1));
        assertThat(handler.getLogRecords().get(0).getMessage(), is("Now we're logging"));
    } finally {
        final Logger logger = Logger.getLogger("asciidoctor");
        logger.removeHandler(handler);
    }
}
 
Example 12
Source File: ContextTest.java    From grpc-nebula-java with Apache License 2.0 5 votes vote down vote up
@Test
public void errorWhenAncestryLengthLong() {
  final AtomicReference<LogRecord> logRef = new AtomicReference<LogRecord>();
  Handler handler = new Handler() {
    @Override
    public void publish(LogRecord record) {
      logRef.set(record);
    }

    @Override
    public void flush() {
    }

    @Override
    public void close() throws SecurityException {
    }
  };
  Logger logger = Logger.getLogger(Context.class.getName());
  try {
    logger.addHandler(handler);
    Context ctx = Context.current();
    for (int i = 0; i < Context.CONTEXT_DEPTH_WARN_THRESH ; i++) {
      assertNull(logRef.get());
      ctx = ctx.fork();
    }
    ctx = ctx.fork();
    assertNotNull(logRef.get());
    assertNotNull(logRef.get().getThrown());
    assertEquals(Level.SEVERE, logRef.get().getLevel());
  } finally {
    logger.removeHandler(handler);
  }
}
 
Example 13
Source File: ContextTest.java    From grpc-nebula-java with Apache License 2.0 5 votes vote down vote up
@Test
public void detachingNonCurrentLogsSevereMessage() {
  final AtomicReference<LogRecord> logRef = new AtomicReference<LogRecord>();
  Handler handler = new Handler() {
    @Override
    public void publish(LogRecord record) {
      logRef.set(record);
    }

    @Override
    public void flush() {
    }

    @Override
    public void close() throws SecurityException {
    }
  };
  Logger logger = Logger.getLogger(Context.storage().getClass().getName());
  try {
    logger.addHandler(handler);
    Context initial = Context.current();
    Context base = initial.withValue(PET, "dog");
    // Base is not attached
    base.detach(initial);
    assertSame(initial, Context.current());
    assertNotNull(logRef.get());
    assertEquals(Level.SEVERE, logRef.get().getLevel());
  } finally {
    logger.removeHandler(handler);
  }
}
 
Example 14
Source File: OLcServerShutdown.java    From Open-Lowcode with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * @param port
 */
public OLcServerShutdown(int port) {
	Logger mainlogger = Logger.getLogger("");
	try {
		for (int i = 0; i < mainlogger.getHandlers().length; i++) {
			mainlogger.removeHandler(mainlogger.getHandlers()[i]);
		}
		ConsoleHandler consolehandler = new ConsoleHandler();
		consolehandler.setFormatter(new ConsoleFormatter());
		consolehandler.setLevel(Level.FINER);
		mainlogger.addHandler(consolehandler);
		File file = new File("./log/");
		System.err.println("log folder = " + file.getAbsolutePath());
		FileHandler logfilehandler = new FileHandler("./log/OpenLowcodeClient%g.log", 10000000, 1000, true);
		logfilehandler.setLevel(Level.FINEST);
		logfilehandler.setFormatter(new FileFormatter(true));
		mainlogger.addHandler(logfilehandler);
		mainlogger.setUseParentHandlers(false);
		// ------------------------------------------------------------------------------
		logger.severe("Connection to Open-Lowcode Server on localhost port " + port + " to send shutdown message");
		Socket clientsocket = new Socket("localhost", port);
		MessageSimpleReader reader = new MessageSimpleReader(
				new BufferedReader(new InputStreamReader(clientsocket.getInputStream()), 9090));
		MessageBufferedWriter writer = new MessageBufferedWriter(
				new BufferedWriter(new OutputStreamWriter(clientsocket.getOutputStream())), false);
		@SuppressWarnings("unused")
		AESCommunicator aescommunicator = AESCommunicator.performServerHandshake(reader, writer);
		writer.startNewMessage();
		writer.startStructure("SHUTDOWN");
		writer.endStructure("SHUTDOWN");
		writer.endMessage();
		writer.flushMessage();
		logger.severe("Succesfully sent shutdown message to server on port " + port);
		reader.returnNextMessageStart();
		reader.returnNextStartStructure("SHUTDOWNOK");
		reader.returnNextEndStructure("SHUTDOWNOK");
		reader.returnNextEndMessage();

		logger.severe(
				"Got last message from server before shutdown, all connections are stopped. Server will stop in less than 50ms");
		reader.close();
		writer.close();
		clientsocket.close();
	} catch (Exception e) {
		logger.severe("could not execute correctly shutdown script: " + e.getMessage());
		for (int i = 0; i < e.getStackTrace().length; i++) {
			logger.severe(e.getStackTrace()[i].toString());
		}
	}
}
 
Example 15
Source File: PerfRunner.java    From tomee with Apache License 2.0 4 votes vote down vote up
private void cleanHandlers(final Logger logger) {
    for (final Handler h : logger.getHandlers()) {
        logger.removeHandler(h);
    }
    logger.setUseParentHandlers(false);
}
 
Example 16
Source File: TestLoggerBundleSync.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void run() {
    try {
        handler.setLevel(Level.FINEST);
        while (goOn) {
            Logger l;
            Logger foo = Logger.getLogger("foo");
            Logger bar = Logger.getLogger("foo.bar");
            for (long i=0; i < nextLong.longValue() + 100 ; i++) {
                if (!goOn) break;
                l = Logger.getLogger("foo.bar.l"+i);
                final ResourceBundle b = l.getResourceBundle();
                final String name = l.getResourceBundleName();
                if (b != null) {
                    if (!name.equals(b.getBaseBundleName())) {
                        throw new RuntimeException("Unexpected bundle name: "
                                +b.getBaseBundleName());
                    }
                }
                Logger ll = Logger.getLogger(l.getName()+".bie.bye");
                ResourceBundle hrb;
                String hrbName;
                if (handler.getLevel() != Level.FINEST) {
                    throw new RuntimeException("Handler level is not finest: "
                            + handler.getLevel());
                }
                final int countBefore = handler.count;
                handler.reset();
                ll.setLevel(Level.FINEST);
                ll.addHandler(handler);
                ll.log(Level.FINE, "dummy {0}", this);
                ll.removeHandler(handler);
                final int countAfter = handler.count;
                if (countBefore == countAfter) {
                    throw new RuntimeException("Handler not called for "
                            + ll.getName() + "("+ countAfter +")");
                }
                hrb = handler.rb;
                hrbName = handler.rbName;
                if (name != null) {
                    // if name is not null, then it implies that it
                    // won't change, since setResourceBundle() cannot
                    // replace a non null name.
                    // Since we never set the resource bundle on 'll',
                    // then ll must inherit its resource bundle [name]
                    // from l - and therefor we should find it in
                    // handler.rb/handler.rbName
                    if (!name.equals(hrbName)) {
                        throw new RuntimeException("Unexpected bundle name: "
                                +hrbName);
                    }
                    // here we know that hrbName is not null so hrb
                    // should not be null either.
                    if (!name.equals(hrb.getBaseBundleName())) {
                        throw new RuntimeException("Unexpected bundle name: "
                                +hrb.getBaseBundleName());
                    }
                }

                // Make sure to refer to 'l' explicitly in order to
                // prevent eager garbage collecting before the end of
                // the test (JDK-8030192)
                if (!ll.getName().startsWith(l.getName())) {
                    throw new RuntimeException("Logger " + ll.getName()
                            + "does not start with expected prefix "
                            + l.getName());
                }

                getRBcount.incrementAndGet();
                if (!goOn) break;
                Thread.sleep(1);
            }
        }
   } catch (Exception x) {
       fail(x);
   }
}
 
Example 17
Source File: TestLoggerBundleSync.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void run() {
    try {
        handler.setLevel(Level.FINEST);
        while (goOn) {
            Logger l;
            Logger foo = Logger.getLogger("foo");
            Logger bar = Logger.getLogger("foo.bar");
            for (long i=0; i < nextLong.longValue() + 100 ; i++) {
                if (!goOn) break;
                l = Logger.getLogger("foo.bar.l"+i);
                final ResourceBundle b = l.getResourceBundle();
                final String name = l.getResourceBundleName();
                if (b != null) {
                    if (!name.equals(b.getBaseBundleName())) {
                        throw new RuntimeException("Unexpected bundle name: "
                                +b.getBaseBundleName());
                    }
                }
                Logger ll = Logger.getLogger(l.getName()+".bie.bye");
                ResourceBundle hrb;
                String hrbName;
                if (handler.getLevel() != Level.FINEST) {
                    throw new RuntimeException("Handler level is not finest: "
                            + handler.getLevel());
                }
                final int countBefore = handler.count;
                handler.reset();
                ll.setLevel(Level.FINEST);
                ll.addHandler(handler);
                ll.log(Level.FINE, "dummy {0}", this);
                ll.removeHandler(handler);
                final int countAfter = handler.count;
                if (countBefore == countAfter) {
                    throw new RuntimeException("Handler not called for "
                            + ll.getName() + "("+ countAfter +")");
                }
                hrb = handler.rb;
                hrbName = handler.rbName;
                if (name != null) {
                    // if name is not null, then it implies that it
                    // won't change, since setResourceBundle() cannot
                    // replace a non null name.
                    // Since we never set the resource bundle on 'll',
                    // then ll must inherit its resource bundle [name]
                    // from l - and therefor we should find it in
                    // handler.rb/handler.rbName
                    if (!name.equals(hrbName)) {
                        throw new RuntimeException("Unexpected bundle name: "
                                +hrbName);
                    }
                    // here we know that hrbName is not null so hrb
                    // should not be null either.
                    if (!name.equals(hrb.getBaseBundleName())) {
                        throw new RuntimeException("Unexpected bundle name: "
                                +hrb.getBaseBundleName());
                    }
                }

                // Make sure to refer to 'l' explicitly in order to
                // prevent eager garbage collecting before the end of
                // the test (JDK-8030192)
                if (!ll.getName().startsWith(l.getName())) {
                    throw new RuntimeException("Logger " + ll.getName()
                            + "does not start with expected prefix "
                            + l.getName());
                }

                getRBcount.incrementAndGet();
                if (!goOn) break;
                Thread.sleep(1);
            }
        }
   } catch (Exception x) {
       fail(x);
   }
}
 
Example 18
Source File: HeadersTest.java    From cxf with Apache License 2.0 4 votes vote down vote up
@Test
public void logProtocolHeadersTest() {
    Map<String, List<Object>> headerMap = new HashMap<>();
    headerMap.put("Normal-Header", Arrays.asList("normal"));
    headerMap.put("Multivalue-Header", Arrays.asList("first", "second"));
    headerMap.put("Authorization", Arrays.asList("myPassword"));
    headerMap.put("Null-Header", Arrays.asList((String)null));

    //Set up test logger
    Logger logger = Logger.getAnonymousLogger();
    // remove all "normal" handlers and just use our custom handler for testing
    logger.setUseParentHandlers(false);
    logger.setLevel(Level.INFO);
    for (Handler h : logger.getHandlers()) {
        logger.removeHandler(h);
    }
    logger.addHandler(new Handler() {

        @Override
        public void publish(LogRecord record) {
            String msg = record.getMessage();
            if (msg.startsWith("Normal-Header")) {
                assertTrue("Unexpected output for normal header - expected Normal-Header: normal, received " + msg,
                           "Normal-Header: normal".equals(msg));
            } else if (msg.startsWith("Multivalue-Header")) {
                assertTrue("Unexpected output for multi-value header - expected Multivalue-Header: first or "
                    + "Multivalue-Header: second, received: " + msg,
                    "Multivalue-Header: first".equals(msg) || "Multivalue-Header: second".equals(msg));
            } else if (msg.startsWith("Authorization")) {
                assertTrue("Unexpected output for sensitive header - expected Authorization: ***, received " + msg,
                           "Authorization: ***".equals(msg));
            } else if (msg.startsWith("Null-Header")) {
                assertTrue("Unexpected output for null header - expected Null-Header: <null>, received " + msg,
                           "Null-Header: <null>".equals(msg));
            } else {
                fail("Unexpected header logged: " + msg);
            }

        }

        @Override
        public void flush() {
            // no-op
        }

        @Override
        public void close() throws SecurityException {
            // no-op
        } });

    Headers.logProtocolHeaders(logger, Level.INFO, headerMap, false);
}
 
Example 19
Source File: ExternalChangesTest.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public void testLogIntCmd () throws Exception {
    waitForInitialScan();
    FileChangeAdapter fca = new FileChangeAdapter();
    workdirFO.addRecursiveListener(fca);
    final File toAdd = new File(modifiedFile.getParentFile(), "toAdd");
    final File toDelete = new File(modifiedFile.getParentFile(), "toDelete");
    toDelete.createNewFile();
    FileUtil.refreshFor(repositoryLocation);
    Thread.sleep(11000); // some time for initial scans to finish and event logger to settle down
    File gitFolder = new File(repositoryLocation, ".git");
    final File lockFile = new File(gitFolder, "index.lock");
    Logger GESTURES_LOG = Logger.getLogger("org.netbeans.ui.vcs");
    ExternalCommandUsageHandler h = new ExternalCommandUsageHandler();
    GESTURES_LOG.addHandler(h);
    Git.getInstance().runWithoutExternalEvents(repositoryLocation, "MY_COMMAND", new Callable<Void>() {
        @Override
        public Void call () throws Exception {
            lockFile.createNewFile();
            FileUtil.refreshFor(repositoryLocation);
            // modification
            write(modifiedFile, "testExternalCommandLoggedChanges");
            // delete
            toDelete.delete();
            // create
            toAdd.createNewFile();
            FileUtil.refreshFor(repositoryLocation);
            pause();
            lockFile.delete();
            FileUtil.refreshFor(repositoryLocation);
            return null;
        }
    });
    h.waitForEvent();
    assertNotNull(h.event);
    assertEquals(1, h.numberOfEvents);
    assertTrue(h.event.time > 0);
    assertEquals("GIT", h.event.vcs);
    assertFalse(h.event.external);
    assertEquals("MY_COMMAND", h.event.command);
    assertEquals(Long.valueOf(3), h.event.modifications);
    GESTURES_LOG.removeHandler(h);
    workdirFO.removeRecursiveListener(fca);
}
 
Example 20
Source File: FileListWorkOrderingTest.java    From netbeans with Apache License 2.0 4 votes vote down vote up
/**
 * Tests that consequent file list works on single roots with intermediate delete work on same root
 * are not collapsed into single one.
 * Runs special work at start which in execution schedules FLW(src1), DEL(src1), FLW(src1) -> 2 FLWs should
 * be executed.
 */
public void testFLWOnSingleRootsWithintermediateDelWorkOnSameRootAreNotAbsorbed() throws InterruptedException, IOException {

    assertTrue(GlobalPathRegistry.getDefault().getPaths(FOO_SOURCES).isEmpty());
    final RepositoryUpdaterTest.TestHandler handler = new RepositoryUpdaterTest.TestHandler();
    final Logger logger = Logger.getLogger(RepositoryUpdater.class.getName()+".tests"); //NOI18N
    logger.setLevel (Level.FINEST);
    logger.addHandler(handler);
    try {
        globalPathRegistry_register(FOO_SOURCES,new ClassPath[]{cp1});
        assertTrue (handler.await());
        assertEquals(0, handler.getBinaries().size());
        assertEquals(2, handler.getSources().size());

        handler.reset(RepositoryUpdaterTest.TestHandler.Type.FILELIST);
        MimeLookup.getLookup(MimePath.get(FOO_MIME)).
                lookup(FooIndexerFactory.class).
                reset();
        RepositoryUpdater.getDefault().runAsWork(
            new Runnable() {
               @Override
               public void run() {
                   //First schedule of refresh for src1
                   IndexingManager.getDefault().refreshIndex(
                      src1.toURL(),
                      Collections.<URL>emptyList(),
                      false);
                   //Second schedulte some delete in src2
                   RepositoryUpdater.getDefault().addDeleteJob(
                      src1.toURL(),
                      Collections.<String>emptySet(),
                      LogContext.create(LogContext.EventType.PATH, "Test"));    //NOI18N
                   //Third schedule of refresh for src1
                   IndexingManager.getDefault().refreshIndex(
                      src1.toURL(),
                      Collections.<URL>emptyList(),
                      false);
               }
            });
        assertTrue (handler.await());
        assertTrue (awaitRUSilence());
        assertEquals(2, MimeLookup.getLookup(MimePath.get(FOO_MIME)).
                        lookup(FooIndexerFactory.class).
                        getIndexingCount());
    } finally {
        logger.removeHandler(handler);
    }
}