();
+ wdto.apps.add(appDTO);
+ wdto.bind = "http://localhost:0";
+ wdto.path = "console";
+ WebServerComponent webServerComponent = new WebServerComponent();
+ webServerComponent.configure(wdto, ".", ".");
+ webServerComponent.start();
+
+ backupServer.getServer().getNetworkHealthCheck().parseURIList("http://localhost:8787");
+ Assert.assertTrue(backupServer.getServer().getNetworkHealthCheck().isStarted());
+ backupServer.getServer().addExternalComponent(webServerComponent, false);
+ // this is called when backup servers go from live back to backup
+ backupServer.getServer().fail(true);
+ Assert.assertTrue(backupServer.getServer().getNetworkHealthCheck().isStarted());
+ Assert.assertTrue(backupServer.getServer().getExternalComponents().get(0).isStarted());
+ ((ServiceComponent) (backupServer.getServer().getExternalComponents().get(0))).stop(true);
+ } finally {
+ httpServer.stop(0);
+ }
+
+ }
+
+ @Override
+ protected void createConfigs() throws Exception {
+ createPluggableReplicatedConfigs();
+ }
+
+ @Override
+ protected void setupHAPolicyConfiguration() {
+ ((ReplicationPrimaryPolicyConfiguration) liveConfig.getHAPolicyConfiguration())
+ .setCheckForLiveServer(true)
+ .setGroupName(useGroupName ? GROUP_NAME : null);
+ ((ReplicationBackupPolicyConfiguration) backupConfig.getHAPolicyConfiguration())
+ .setMaxSavedReplicatedJournalsSize(2)
+ .setAllowFailBack(true)
+ .setGroupName(useGroupName ? GROUP_NAME : null);
+ }
+
+ @Override
+ protected TransportConfiguration getAcceptorTransportConfiguration(final boolean live) {
+ return useNetty ? getNettyAcceptorTransportConfiguration(live) :
+ super.getAcceptorTransportConfiguration(live);
+ }
+
+ @Override
+ protected TransportConfiguration getConnectorTransportConfiguration(final boolean live) {
+ return useNetty ? getNettyConnectorTransportConfiguration(live) :
+ super.getConnectorTransportConfiguration(live);
+ }
+
+ @Override
+ protected void crash(boolean waitFailure, ClientSession... sessions) throws Exception {
+ if (sessions.length > 0) {
+ for (ClientSession session : sessions) {
+ waitForRemoteBackup(session.getSessionFactory(), 5, true, backupServer.getServer());
+ }
+ } else {
+ waitForRemoteBackup(null, 5, true, backupServer.getServer());
+ }
+ super.crash(waitFailure, sessions);
+ }
+
+ @Override
+ protected void crash(ClientSession... sessions) throws Exception {
+ if (sessions.length > 0) {
+ for (ClientSession session : sessions) {
+ waitForRemoteBackup(session.getSessionFactory(), 5, true, backupServer.getServer());
+ }
+ } else {
+ waitForRemoteBackup(null, 5, true, backupServer.getServer());
+ }
+ super.crash(sessions);
+ }
+}
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/quorum/PluggableQuorumReplicatedLargeMessageFailoverTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/quorum/PluggableQuorumReplicatedLargeMessageFailoverTest.java
new file mode 100644
index 000000000000..23e728154b24
--- /dev/null
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/quorum/PluggableQuorumReplicatedLargeMessageFailoverTest.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.artemis.tests.integration.cluster.failover.quorum;
+
+import org.apache.activemq.artemis.core.config.ha.ReplicationBackupPolicyConfiguration;
+import org.apache.activemq.artemis.core.config.ha.ReplicationPrimaryPolicyConfiguration;
+import org.apache.activemq.artemis.tests.integration.cluster.failover.ReplicatedLargeMessageFailoverTest;
+
+public class PluggableQuorumReplicatedLargeMessageFailoverTest extends ReplicatedLargeMessageFailoverTest {
+
+ @Override
+ protected void createConfigs() throws Exception {
+ createPluggableReplicatedConfigs();
+ }
+
+ @Override
+ protected void setupHAPolicyConfiguration() {
+ ((ReplicationPrimaryPolicyConfiguration) liveConfig.getHAPolicyConfiguration()).setCheckForLiveServer(true);
+ ((ReplicationBackupPolicyConfiguration) backupConfig.getHAPolicyConfiguration()).setMaxSavedReplicatedJournalsSize(2).setAllowFailBack(true);
+ }
+
+}
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/quorum/PluggableQuorumReplicatedLargeMessageWithDelayFailoverTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/quorum/PluggableQuorumReplicatedLargeMessageWithDelayFailoverTest.java
new file mode 100644
index 000000000000..bf23c9b1246f
--- /dev/null
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/quorum/PluggableQuorumReplicatedLargeMessageWithDelayFailoverTest.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.artemis.tests.integration.cluster.failover.quorum;
+
+import org.apache.activemq.artemis.core.config.ha.ReplicationBackupPolicyConfiguration;
+import org.apache.activemq.artemis.core.config.ha.ReplicationPrimaryPolicyConfiguration;
+import org.apache.activemq.artemis.tests.integration.cluster.failover.ReplicatedLargeMessageWithDelayFailoverTest;
+
+public class PluggableQuorumReplicatedLargeMessageWithDelayFailoverTest extends ReplicatedLargeMessageWithDelayFailoverTest {
+
+ @Override
+ protected void createConfigs() throws Exception {
+ createPluggableReplicatedConfigs();
+ }
+
+ @Override
+ protected void setupHAPolicyConfiguration() {
+ ((ReplicationPrimaryPolicyConfiguration) liveConfig.getHAPolicyConfiguration()).setCheckForLiveServer(true);
+ ((ReplicationBackupPolicyConfiguration) backupConfig.getHAPolicyConfiguration()).setMaxSavedReplicatedJournalsSize(2).setAllowFailBack(true);
+ }
+
+}
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/quorum/PluggableQuorumReplicatedPagingFailoverTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/quorum/PluggableQuorumReplicatedPagingFailoverTest.java
new file mode 100644
index 000000000000..d80460855ba3
--- /dev/null
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/quorum/PluggableQuorumReplicatedPagingFailoverTest.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.artemis.tests.integration.cluster.failover.quorum;
+
+import org.apache.activemq.artemis.core.config.ha.ReplicationBackupPolicyConfiguration;
+import org.apache.activemq.artemis.core.config.ha.ReplicationPrimaryPolicyConfiguration;
+import org.apache.activemq.artemis.tests.integration.cluster.failover.PagingFailoverTest;
+
+public class PluggableQuorumReplicatedPagingFailoverTest extends PagingFailoverTest {
+
+ @Override
+ protected void createConfigs() throws Exception {
+ createPluggableReplicatedConfigs();
+ }
+
+ @Override
+ protected void setupHAPolicyConfiguration() {
+ ((ReplicationPrimaryPolicyConfiguration) liveConfig.getHAPolicyConfiguration()).setCheckForLiveServer(true);
+ ((ReplicationBackupPolicyConfiguration) backupConfig.getHAPolicyConfiguration()).setMaxSavedReplicatedJournalsSize(2).setAllowFailBack(true);
+ }
+}
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/util/BackupSyncDelay.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/util/BackupSyncDelay.java
index 9ddffd389a2e..b0af71b3675a 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/util/BackupSyncDelay.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/util/BackupSyncDelay.java
@@ -32,6 +32,8 @@
import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ReplicationStartSyncMessage;
import org.apache.activemq.artemis.core.replication.ReplicationEndpoint;
import org.apache.activemq.artemis.core.server.ActiveMQServer;
+import org.apache.activemq.artemis.core.server.impl.Activation;
+import org.apache.activemq.artemis.core.server.impl.ReplicationBackupActivation;
import org.apache.activemq.artemis.core.server.impl.SharedNothingBackupActivation;
import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection;
@@ -94,8 +96,18 @@ public BackupSyncDelay(TestableServer backupServer, TestableServer liveServer) {
public boolean intercept(Packet packet, RemotingConnection connection) throws ActiveMQException {
if (packet.getType() == PacketImpl.BACKUP_REGISTRATION) {
try {
- SharedNothingBackupActivation activation = (SharedNothingBackupActivation) backup.getActivation();
- ReplicationEndpoint repEnd = activation.getReplicationEndpoint();
+ Activation backupActivation = backup.getActivation();
+ ReplicationEndpoint repEnd = null;
+ if (backupActivation instanceof SharedNothingBackupActivation) {
+ SharedNothingBackupActivation activation = (SharedNothingBackupActivation) backupActivation;
+ repEnd = activation.getReplicationEndpoint();
+ } else if (backupActivation instanceof ReplicationBackupActivation) {
+ ReplicationBackupActivation activation = (ReplicationBackupActivation) backupActivation;
+ repEnd = activation.getReplicationEndpoint();
+ }
+ if (repEnd == null) {
+ throw new NullPointerException("replication endpoint isn't supposed to be null");
+ }
handler.addSubHandler(repEnd);
Channel repChannel = repEnd.getChannel();
repChannel.setHandler(handler);
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/replication/PluggableQuorumReplicationFlowControlTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/replication/PluggableQuorumReplicationFlowControlTest.java
new file mode 100644
index 000000000000..a359af9d87e1
--- /dev/null
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/replication/PluggableQuorumReplicationFlowControlTest.java
@@ -0,0 +1,61 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.activemq.artemis.tests.integration.replication;
+
+import java.io.IOException;
+import java.util.Collections;
+
+import org.apache.activemq.artemis.core.config.HAPolicyConfiguration;
+import org.apache.activemq.artemis.core.config.ha.DistributedPrimitiveManagerConfiguration;
+import org.apache.activemq.artemis.core.config.ha.ReplicationBackupPolicyConfiguration;
+import org.apache.activemq.artemis.core.config.ha.ReplicationPrimaryPolicyConfiguration;
+import org.apache.activemq.artemis.quorum.file.FileBasedPrimitiveManager;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.rules.TemporaryFolder;
+
+public class PluggableQuorumReplicationFlowControlTest extends SharedNothingReplicationFlowControlTest {
+
+ private DistributedPrimitiveManagerConfiguration managerConfiguration;
+ @Rule
+ public TemporaryFolder tmpFolder = new TemporaryFolder();
+
+ @Before
+ public void init() throws IOException {
+ managerConfiguration = new DistributedPrimitiveManagerConfiguration(FileBasedPrimitiveManager.class.getName(), Collections.singletonMap("locks-folder", tmpFolder.newFolder("manager").toString()));
+ }
+
+ @Override
+ protected HAPolicyConfiguration createReplicationBackupConfiguration() {
+ ReplicationBackupPolicyConfiguration haPolicy = ReplicationBackupPolicyConfiguration.withDefault();
+ haPolicy.setDistributedManagerConfiguration(managerConfiguration);
+ haPolicy.setClusterName("cluster");
+ // fail-fast in order to let the backup to quickly retry syncing with primary
+ haPolicy.setQuorumVoteWait(1);
+ haPolicy.setVoteRetries(0);
+ return haPolicy;
+ }
+
+ @Override
+ protected HAPolicyConfiguration createReplicationLiveConfiguration() {
+ ReplicationPrimaryPolicyConfiguration haPolicy = ReplicationPrimaryPolicyConfiguration.withDefault();
+ haPolicy.setDistributedManagerConfiguration(managerConfiguration);
+ haPolicy.setCheckForLiveServer(false);
+ return haPolicy;
+ }
+}
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/replication/PluggableQuorumReplicationOrderTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/replication/PluggableQuorumReplicationOrderTest.java
new file mode 100644
index 000000000000..f5ed720792b0
--- /dev/null
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/replication/PluggableQuorumReplicationOrderTest.java
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.artemis.tests.integration.replication;
+
+import org.apache.activemq.artemis.api.core.TransportConfiguration;
+import org.apache.activemq.artemis.core.config.ha.ReplicationBackupPolicyConfiguration;
+import org.apache.activemq.artemis.core.config.ha.ReplicationPrimaryPolicyConfiguration;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import static java.util.Arrays.asList;
+
+@RunWith(Parameterized.class)
+public class PluggableQuorumReplicationOrderTest extends ReplicationOrderTest {
+
+ @Parameterized.Parameter
+ public boolean useNetty;
+
+ @Parameterized.Parameters(name = "useNetty={1}")
+ public static Iterable