diff options
Diffstat (limited to 'tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/rules/ExecutorRule.java')
-rw-r--r-- | tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/rules/ExecutorRule.java | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/rules/ExecutorRule.java b/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/rules/ExecutorRule.java deleted file mode 100644 index 77347df01ce..00000000000 --- a/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/rules/ExecutorRule.java +++ /dev/null @@ -1,56 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2015 Christian W. Damus and others. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Christian W. Damus - Initial API and implementation - * - *****************************************************************************/ - -package org.eclipse.papyrus.junit.utils.rules; - -import java.util.concurrent.BlockingQueue; -import java.util.concurrent.Executor; - -import org.eclipse.papyrus.junit.utils.Activator; -import org.junit.rules.TestRule; -import org.junit.rules.TestWatcher; -import org.junit.runner.Description; - -import com.google.common.collect.Queues; - -/** - * A JUnit {@linkplain TestRule rule} that is an {@link Executor} running tasks at clean-up of the - * test execution. - */ -public class ExecutorRule extends TestWatcher implements Executor { - private final BlockingQueue<Runnable> queue = Queues.newLinkedBlockingQueue(); - - public ExecutorRule() { - super(); - } - - @Override - public void execute(Runnable command) { - queue.add(command); - } - - protected void runPending() { - for (Runnable next = queue.poll(); next != null; next = queue.poll()) { - try { - next.run(); - } catch (Exception e) { - Activator.log.error("Uncaught exception in test shutdown runnable.", e); //$NON-NLS-1$ - } - } - } - - @Override - protected void finished(Description description) { - runPending(); - } -} |