This is an automated email from the ASF dual-hosted git repository.
btellier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git
The following commit(s) were added to refs/heads/master by this push:
new f937399 JAMES-2777 fix too strong expectation about task cancellation
f937399 is described below
commit f9373996c22b12aecce6d19ae277b26a67fa0432
Author: Benoit Tellier <[email protected]>
AuthorDate: Mon Jun 17 10:25:15 2019 +0700
JAMES-2777 fix too strong expectation about task cancellation
---
.../migration/CassandraMigrationServiceTest.java | 17 +++++++++--------
.../backends/cassandra/migration/MigrationTest.java | 8 ++++----
.../apache/james/vault/DeletedMessageVaultContract.java | 14 +++++++-------
.../webadmin/routes/CassandraMigrationRoutesTest.java | 4 ++--
4 files changed, 22 insertions(+), 21 deletions(-)
diff --git
a/backends-common/cassandra/src/test/java/org/apache/james/backends/cassandra/migration/CassandraMigrationServiceTest.java
b/backends-common/cassandra/src/test/java/org/apache/james/backends/cassandra/migration/CassandraMigrationServiceTest.java
index e0a849e..efa90e3 100644
---
a/backends-common/cassandra/src/test/java/org/apache/james/backends/cassandra/migration/CassandraMigrationServiceTest.java
+++
b/backends-common/cassandra/src/test/java/org/apache/james/backends/cassandra/migration/CassandraMigrationServiceTest.java
@@ -47,6 +47,7 @@ import org.junit.rules.ExpectedException;
import com.datastax.driver.core.Session;
import com.google.common.collect.ImmutableMap;
+
import reactor.core.publisher.Mono;
public class CassandraMigrationServiceTest {
@@ -97,7 +98,7 @@ public class CassandraMigrationServiceTest {
}
@Test
- public void upgradeToVersionShouldNotThrowWhenCurrentVersionIsUpToDate() {
+ public void upgradeToVersionShouldNotThrowWhenCurrentVersionIsUpToDate()
throws Exception {
when(schemaVersionDAO.getCurrentSchemaVersion()).thenReturn(Mono.just(Optional.of(CURRENT_VERSION)));
assertThat(testee.upgradeToVersion(OLDER_VERSION).run())
@@ -105,7 +106,7 @@ public class CassandraMigrationServiceTest {
}
@Test
- public void upgradeToVersionShouldUpdateToVersion() {
+ public void upgradeToVersionShouldUpdateToVersion() throws Exception {
when(schemaVersionDAO.getCurrentSchemaVersion()).thenReturn(Mono.just(Optional.of(OLDER_VERSION)));
testee.upgradeToVersion(CURRENT_VERSION).run();
@@ -114,7 +115,7 @@ public class CassandraMigrationServiceTest {
}
@Test
- public void upgradeToLastVersionShouldNotThrowWhenVersionIsUpToDate() {
+ public void upgradeToLastVersionShouldNotThrowWhenVersionIsUpToDate()
throws Exception {
when(schemaVersionDAO.getCurrentSchemaVersion()).thenReturn(Mono.just(Optional.of(LATEST_VERSION)));
@@ -123,7 +124,7 @@ public class CassandraMigrationServiceTest {
}
@Test
- public void upgradeToLastVersionShouldUpdateToLatestVersion() {
+ public void upgradeToLastVersionShouldUpdateToLatestVersion() throws
Exception {
when(schemaVersionDAO.getCurrentSchemaVersion()).thenReturn(Mono.just(Optional.of(OLDER_VERSION)));
testee.upgradeToLastVersion().run();
@@ -132,7 +133,7 @@ public class CassandraMigrationServiceTest {
}
@Test
- public void upgradeToVersionShouldThrowOnMissingVersion() {
+ public void upgradeToVersionShouldThrowOnMissingVersion() throws Exception
{
Map<SchemaVersion, Migration> allMigrationClazz =
ImmutableMap.<SchemaVersion, Migration>builder()
.put(OLDER_VERSION, successfulMigration)
.put(LATEST_VERSION, successfulMigration)
@@ -146,7 +147,7 @@ public class CassandraMigrationServiceTest {
}
@Test
- public void
upgradeToVersionShouldUpdateIntermediarySuccessfulMigrationsInCaseOfError() {
+ public void
upgradeToVersionShouldUpdateIntermediarySuccessfulMigrationsInCaseOfError()
throws Exception {
try {
Map<SchemaVersion, Migration> allMigrationClazz =
ImmutableMap.<SchemaVersion, Migration>builder()
.put(OLDER_VERSION, successfulMigration)
@@ -165,7 +166,7 @@ public class CassandraMigrationServiceTest {
}
@Test
- public void partialMigrationShouldThrow() {
+ public void partialMigrationShouldThrow() throws Exception {
Migration migration1 = mock(Migration.class);
when(migration1.run()).thenReturn(Migration.Result.PARTIAL);
Migration migration2 = successfulMigration;
@@ -182,7 +183,7 @@ public class CassandraMigrationServiceTest {
}
@Test
- public void partialMigrationShouldAbortMigrations() {
+ public void partialMigrationShouldAbortMigrations() throws Exception {
Migration migration1 = mock(Migration.class);
when(migration1.run()).thenReturn(Migration.Result.PARTIAL);
Migration migration2 = mock(Migration.class);
diff --git
a/backends-common/cassandra/src/test/java/org/apache/james/backends/cassandra/migration/MigrationTest.java
b/backends-common/cassandra/src/test/java/org/apache/james/backends/cassandra/migration/MigrationTest.java
index f1a0092..7f110c3 100644
---
a/backends-common/cassandra/src/test/java/org/apache/james/backends/cassandra/migration/MigrationTest.java
+++
b/backends-common/cassandra/src/test/java/org/apache/james/backends/cassandra/migration/MigrationTest.java
@@ -27,7 +27,7 @@ import org.junit.Test;
public class MigrationTest {
@Test
- public void
combineShouldNotExecuteSecondMigrationExecutionWhenTheFirstOneIsFailing() {
+ public void
combineShouldNotExecuteSecondMigrationExecutionWhenTheFirstOneIsFailing()
throws Exception {
AtomicBoolean migration2Done = new AtomicBoolean(false);
Migration migration1 = () -> Migration.Result.PARTIAL;
@@ -42,7 +42,7 @@ public class MigrationTest {
}
@Test
- public void combineShouldTriggerSecondMigrationWhenTheFirstOneSucceed() {
+ public void combineShouldTriggerSecondMigrationWhenTheFirstOneSucceed()
throws Exception {
AtomicBoolean migration2Done = new AtomicBoolean(false);
Migration migration1 = () -> Migration.Result.COMPLETED;
@@ -57,7 +57,7 @@ public class MigrationTest {
}
@Test
- public void combineShouldExecuteTheFirstMigrationWhenSecondWillFail() {
+ public void combineShouldExecuteTheFirstMigrationWhenSecondWillFail()
throws Exception {
AtomicBoolean migration1Done = new AtomicBoolean(false);
Migration migration1 = () -> {
@@ -73,7 +73,7 @@ public class MigrationTest {
}
@Test
- public void combineShouldExecuteTheFirstMigration() {
+ public void combineShouldExecuteTheFirstMigration() throws Exception {
AtomicBoolean migration1Done = new AtomicBoolean(false);
Migration migration1 = () -> {
diff --git
a/mailbox/plugin/deleted-messages-vault/src/test/java/org/apache/james/vault/DeletedMessageVaultContract.java
b/mailbox/plugin/deleted-messages-vault/src/test/java/org/apache/james/vault/DeletedMessageVaultContract.java
index c28f79f..273d288 100644
---
a/mailbox/plugin/deleted-messages-vault/src/test/java/org/apache/james/vault/DeletedMessageVaultContract.java
+++
b/mailbox/plugin/deleted-messages-vault/src/test/java/org/apache/james/vault/DeletedMessageVaultContract.java
@@ -221,14 +221,14 @@ public interface DeletedMessageVaultContract {
}
@Test
- default void deleteExpiredMessagesTaskShouldCompleteWhenNoMail() {
+ default void deleteExpiredMessagesTaskShouldCompleteWhenNoMail() throws
Exception {
Task.Result result = getVault().deleteExpiredMessagesTask().run();
assertThat(result).isEqualTo(Task.Result.COMPLETED);
}
@Test
- default void deleteExpiredMessagesTaskShouldCompleteWhenAllMailsDeleted() {
+ default void deleteExpiredMessagesTaskShouldCompleteWhenAllMailsDeleted()
throws Exception {
Mono.from(getVault().append(USER, DELETED_MESSAGE, new
ByteArrayInputStream(CONTENT))).block();
Mono.from(getVault().delete(USER,
DELETED_MESSAGE.getMessageId())).block();
@@ -238,7 +238,7 @@ public interface DeletedMessageVaultContract {
}
@Test
- default void deleteExpiredMessagesTaskShouldCompleteWhenOnlyRecentMails() {
+ default void deleteExpiredMessagesTaskShouldCompleteWhenOnlyRecentMails()
throws Exception {
Mono.from(getVault().append(USER, DELETED_MESSAGE, new
ByteArrayInputStream(CONTENT))).block();
Task.Result result = getVault().deleteExpiredMessagesTask().run();
@@ -247,7 +247,7 @@ public interface DeletedMessageVaultContract {
}
@Test
- default void deleteExpiredMessagesTaskShouldCompleteWhenOnlyOldMails() {
+ default void deleteExpiredMessagesTaskShouldCompleteWhenOnlyOldMails()
throws Exception {
Mono.from(getVault().append(USER, OLD_DELETED_MESSAGE, new
ByteArrayInputStream(CONTENT))).block();
Task.Result result = getVault().deleteExpiredMessagesTask().run();
@@ -256,7 +256,7 @@ public interface DeletedMessageVaultContract {
}
@Test
- default void deleteExpiredMessagesTaskShouldDoNothingWhenEmpty() {
+ default void deleteExpiredMessagesTaskShouldDoNothingWhenEmpty() throws
Exception {
getVault().deleteExpiredMessagesTask().run();
assertThat(Flux.from(getVault().search(USER,
ALL)).collectList().block())
@@ -264,7 +264,7 @@ public interface DeletedMessageVaultContract {
}
@Test
- default void deleteExpiredMessagesTaskShouldNotDeleteRecentMails() {
+ default void deleteExpiredMessagesTaskShouldNotDeleteRecentMails() throws
Exception {
Mono.from(getVault().append(USER, DELETED_MESSAGE, new
ByteArrayInputStream(CONTENT))).block();
getVault().deleteExpiredMessagesTask().run();
@@ -274,7 +274,7 @@ public interface DeletedMessageVaultContract {
}
@Test
- default void deleteExpiredMessagesTaskShouldDeleteOldMails() {
+ default void deleteExpiredMessagesTaskShouldDeleteOldMails() throws
Exception {
Mono.from(getVault().append(USER, OLD_DELETED_MESSAGE, new
ByteArrayInputStream(CONTENT))).block();
getVault().deleteExpiredMessagesTask().run();
diff --git
a/server/protocols/webadmin/webadmin-cassandra/src/test/java/org/apache/james/webadmin/routes/CassandraMigrationRoutesTest.java
b/server/protocols/webadmin/webadmin-cassandra/src/test/java/org/apache/james/webadmin/routes/CassandraMigrationRoutesTest.java
index 5e09109..fc853d3 100644
---
a/server/protocols/webadmin/webadmin-cassandra/src/test/java/org/apache/james/webadmin/routes/CassandraMigrationRoutesTest.java
+++
b/server/protocols/webadmin/webadmin-cassandra/src/test/java/org/apache/james/webadmin/routes/CassandraMigrationRoutesTest.java
@@ -66,7 +66,7 @@ public class CassandraMigrationRoutesTest {
private CassandraSchemaVersionDAO schemaVersionDAO;
private MemoryTaskManager taskManager;
- private void createServer() {
+ private void createServer() throws InterruptedException {
Migration successfulMigration = mock(Migration.class);
when(successfulMigration.run()).thenReturn(Migration.Result.COMPLETED);
@@ -92,7 +92,7 @@ public class CassandraMigrationRoutesTest {
}
@Before
- public void setUp() {
+ public void setUp() throws Exception {
createServer();
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]