You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by bt...@apache.org on 2020/04/29 01:14:55 UTC
[james-project] 21/27: JAMES-3138 VarArg for Cassandra
instrumentation scenari registration
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
commit 9266b93a73e9aa2c862f681f3530c51fa37a8024
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Tue Apr 28 07:40:44 2020 +0700
JAMES-3138 VarArg for Cassandra instrumentation scenari registration
---
.../java/org/apache/james/backends/cassandra/TestingSession.java | 4 ++--
.../org/apache/james/backends/cassandra/TestingSessionTest.java | 5 ++---
.../integration/rabbitmq/ConsistencyTasksIntegrationTest.java | 6 ++----
3 files changed, 6 insertions(+), 9 deletions(-)
diff --git a/backends-common/cassandra/src/test/java/org/apache/james/backends/cassandra/TestingSession.java b/backends-common/cassandra/src/test/java/org/apache/james/backends/cassandra/TestingSession.java
index cbb7ae7..c8a7a54 100644
--- a/backends-common/cassandra/src/test/java/org/apache/james/backends/cassandra/TestingSession.java
+++ b/backends-common/cassandra/src/test/java/org/apache/james/backends/cassandra/TestingSession.java
@@ -44,8 +44,8 @@ public class TestingSession implements Session {
this.scenario = scenario;
}
- public void registerScenario(Scenario.ExecutionHook hook) {
- this.scenario = Scenario.combine(hook);
+ public void registerScenario(Scenario.ExecutionHook... hooks) {
+ this.scenario = Scenario.combine(hooks);
}
@Override
diff --git a/backends-common/cassandra/src/test/java/org/apache/james/backends/cassandra/TestingSessionTest.java b/backends-common/cassandra/src/test/java/org/apache/james/backends/cassandra/TestingSessionTest.java
index 5140e14..6c8dfc5 100644
--- a/backends-common/cassandra/src/test/java/org/apache/james/backends/cassandra/TestingSessionTest.java
+++ b/backends-common/cassandra/src/test/java/org/apache/james/backends/cassandra/TestingSessionTest.java
@@ -23,7 +23,6 @@ import static com.datastax.driver.core.querybuilder.QueryBuilder.select;
import static org.apache.james.backends.cassandra.Scenario.Builder.awaitOn;
import static org.apache.james.backends.cassandra.Scenario.Builder.executeNormally;
import static org.apache.james.backends.cassandra.Scenario.Builder.fail;
-import static org.apache.james.backends.cassandra.Scenario.combine;
import static org.apache.james.backends.cassandra.versions.table.CassandraSchemaVersionTable.TABLE_NAME;
import static org.apache.james.backends.cassandra.versions.table.CassandraSchemaVersionTable.VALUE;
import static org.assertj.core.api.Assertions.assertThat;
@@ -154,13 +153,13 @@ class TestingSessionTest {
@Test
void scenarioShouldDefiningSeveralHooks(CassandraCluster cassandra) {
cassandra.getConf()
- .registerScenario(combine(
+ .registerScenario(
executeNormally()
.times(1)
.whenQueryStartsWith("SELECT value FROM schemaVersion;"),
fail()
.times(1)
- .whenQueryStartsWith("SELECT value FROM schemaVersion;")));
+ .whenQueryStartsWith("SELECT value FROM schemaVersion;"));
SoftAssertions.assertSoftly(softly -> {
assertThatCode(() -> dao.getCurrentSchemaVersion().block())
diff --git a/server/protocols/webadmin-integration-test/distributed-webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/rabbitmq/ConsistencyTasksIntegrationTest.java b/server/protocols/webadmin-integration-test/distributed-webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/rabbitmq/ConsistencyTasksIntegrationTest.java
index f821ced..bb69945 100644
--- a/server/protocols/webadmin-integration-test/distributed-webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/rabbitmq/ConsistencyTasksIntegrationTest.java
+++ b/server/protocols/webadmin-integration-test/distributed-webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/rabbitmq/ConsistencyTasksIntegrationTest.java
@@ -44,7 +44,6 @@ import org.apache.james.DockerElasticSearchExtension;
import org.apache.james.GuiceJamesServer;
import org.apache.james.JamesServerBuilder;
import org.apache.james.JamesServerExtension;
-import org.apache.james.backends.cassandra.Scenario;
import org.apache.james.backends.cassandra.Scenario.Barrier;
import org.apache.james.backends.cassandra.TestingSession;
import org.apache.james.backends.cassandra.init.SessionWithInitializedTablesFactory;
@@ -68,7 +67,6 @@ import org.apache.james.webadmin.routes.CassandraMappingsRoutes;
import org.apache.james.webadmin.routes.TasksRoutes;
import org.eclipse.jetty.http.HttpStatus;
import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.RepeatedTest;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
@@ -272,7 +270,7 @@ class ConsistencyTasksIntegrationTest {
Barrier barrier2 = new Barrier();
String updatedQuotaQueryString = "UPDATE currentQuota SET messageCount=messageCount+?,storage=storage+? WHERE quotaRoot=?;";
server.getProbe(TestingSessionProbe.class)
- .getTestingSession().registerScenario(Scenario.combine(
+ .getTestingSession().registerScenario(
awaitOn(barrier1) // Event bus first execution
.thenFail()
.times(1)
@@ -280,7 +278,7 @@ class ConsistencyTasksIntegrationTest {
awaitOn(barrier2) // scenari for event bus retry
.thenFail()
.times(1)
- .whenQueryStartsWith(updatedQuotaQueryString)));
+ .whenQueryStartsWith(updatedQuotaQueryString));
probe.appendMessage(BOB.asString(), inbox,
new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes(StandardCharsets.UTF_8)), new Date(),
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org