summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSébastien Lesaint <sebastien.lesaint@sonarsource.com>2015-04-28 17:52:51 +0200
committerSébastien Lesaint <sebastien.lesaint@sonarsource.com>2015-05-05 09:18:54 +0200
commit1fecf17c816bcf9f75b10e557ef5b4ec080156d2 (patch)
treecd6e88ade5bc5aba3a614f72c80f6508454b941e
parenta219c5a6860ce4cb317dc718288ab5af91e732fe (diff)
downloadsonarqube-1fecf17c816bcf9f75b10e557ef5b4ec080156d2.tar.gz
sonarqube-1fecf17c816bcf9f75b10e557ef5b4ec080156d2.zip
SONAR-6366 add missing impl of PlatformDatabaseMigrationAsynchronousTest
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/db/migrations/PlatformDatabaseMigrationAsynchronousTest.java31
1 files changed, 9 insertions, 22 deletions
diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/PlatformDatabaseMigrationAsynchronousTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/PlatformDatabaseMigrationAsynchronousTest.java
index 978174fd191..7b4fc91c990 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/PlatformDatabaseMigrationAsynchronousTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/PlatformDatabaseMigrationAsynchronousTest.java
@@ -19,20 +19,16 @@
*/
package org.sonar.server.db.migrations;
-import com.google.common.base.Throwables;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import org.junit.After;
+import org.junit.Test;
import org.sonar.server.platform.Platform;
import org.sonar.server.ruby.RubyBridge;
-import org.sonar.server.ruby.RubyDatabaseMigration;
+import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
public class PlatformDatabaseMigrationAsynchronousTest {
- private ExecutorService pool = Executors.newFixedThreadPool(2);
- private ExecutorService delegate = Executors.newSingleThreadExecutor();
+ private boolean taskSuppliedForAsyncProcess = false;
/**
* Implementation of execute wraps specified Runnable to add a delay of 200 ms before passing it
* to a SingleThread executor to execute asynchronously.
@@ -40,26 +36,17 @@ public class PlatformDatabaseMigrationAsynchronousTest {
private PlatformDatabaseMigrationExecutorService executorService = new PlatformDatabaseMigrationExecutorServiceAdaptor() {
@Override
public void execute(final Runnable command) {
- delegate.execute(new Runnable() {
- @Override
- public void run() {
- try {
- Thread.currentThread().wait(200);
- } catch (InterruptedException e) {
- Throwables.propagate(e);
- }
- command.run();
- }
- });
+ taskSuppliedForAsyncProcess = true;
}
};
- private RubyDatabaseMigration rubyDatabaseMigration = mock(RubyDatabaseMigration.class);
private RubyBridge rubyBridge = mock(RubyBridge.class);
private Platform platform = mock(Platform.class);
private PlatformDatabaseMigration underTest = new PlatformDatabaseMigration(rubyBridge, executorService, platform);
- @After
- public void tearDown() throws Exception {
- delegate.shutdownNow();
+ @Test
+ public void testName() throws Exception {
+ underTest.startIt();
+
+ assertThat(taskSuppliedForAsyncProcess).isTrue();
}
}