ARTEMIS-1866 Fixing QuorumResultWaitTest
This commit is contained in:
parent
8989da1a6a
commit
048f46bd4f
|
@ -79,24 +79,27 @@ public class ReplicatedPolicyConfiguration implements HAPolicyConfiguration {
|
|||
return initialReplicationSyncTimeout;
|
||||
}
|
||||
|
||||
public void setInitialReplicationSyncTimeout(long initialReplicationSyncTimeout) {
|
||||
public ReplicatedPolicyConfiguration setInitialReplicationSyncTimeout(long initialReplicationSyncTimeout) {
|
||||
this.initialReplicationSyncTimeout = initialReplicationSyncTimeout;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean getVoteOnReplicationFailure() {
|
||||
return voteOnReplicationFailure;
|
||||
}
|
||||
|
||||
public void setVoteOnReplicationFailure(boolean voteOnReplicationFailure) {
|
||||
public ReplicatedPolicyConfiguration setVoteOnReplicationFailure(boolean voteOnReplicationFailure) {
|
||||
this.voteOnReplicationFailure = voteOnReplicationFailure;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getQuorumSize() {
|
||||
return quorumSize;
|
||||
}
|
||||
|
||||
public void setQuorumSize(int quorumSize) {
|
||||
public ReplicatedPolicyConfiguration setQuorumSize(int quorumSize) {
|
||||
this.quorumSize = quorumSize;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
|
@ -104,12 +107,14 @@ public class ReplicatedPolicyConfiguration implements HAPolicyConfiguration {
|
|||
return voteRetries;
|
||||
}
|
||||
|
||||
public void setVoteRetries(int voteRetries) {
|
||||
public ReplicatedPolicyConfiguration setVoteRetries(int voteRetries) {
|
||||
this.voteRetries = voteRetries;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void setVoteRetryWait(long voteRetryWait) {
|
||||
public ReplicatedPolicyConfiguration setVoteRetryWait(long voteRetryWait) {
|
||||
this.voteRetryWait = voteRetryWait;
|
||||
return this;
|
||||
}
|
||||
|
||||
public long getVoteRetryWait() {
|
||||
|
@ -120,7 +125,9 @@ public class ReplicatedPolicyConfiguration implements HAPolicyConfiguration {
|
|||
return quorumVoteWait;
|
||||
}
|
||||
|
||||
public void setQuorumVoteWait(int quorumVoteWait) {
|
||||
public ReplicatedPolicyConfiguration setQuorumVoteWait(int quorumVoteWait) {
|
||||
new Exception("here").printStackTrace();
|
||||
this.quorumVoteWait = quorumVoteWait;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ import org.apache.activemq.artemis.core.config.ha.ReplicaPolicyConfiguration;
|
|||
import org.apache.activemq.artemis.core.config.ha.ReplicatedPolicyConfiguration;
|
||||
import org.apache.activemq.artemis.core.server.cluster.ha.ReplicatedPolicy;
|
||||
import org.junit.Test;
|
||||
|
||||
public class QuorumResultWaitTest extends StaticClusterWithBackupFailoverTest {
|
||||
|
||||
public static final int QUORUM_VOTE_WAIT_CONFIGURED_TIME_SEC = 12;
|
||||
|
@ -33,7 +34,7 @@ public class QuorumResultWaitTest extends StaticClusterWithBackupFailoverTest {
|
|||
((ReplicatedPolicyConfiguration) servers[2].getConfiguration().getHAPolicyConfiguration()).setGroupName("group2");
|
||||
((ReplicaPolicyConfiguration) servers[4].getConfiguration().getHAPolicyConfiguration()).setGroupName("group1");
|
||||
((ReplicaPolicyConfiguration) servers[5].getConfiguration().getHAPolicyConfiguration()).setGroupName("group2");
|
||||
ReplicatedPolicyConfiguration replicatedPolicyConf = new ReplicatedPolicyConfiguration();
|
||||
ReplicatedPolicyConfiguration replicatedPolicyConf = new ReplicatedPolicyConfiguration().setQuorumVoteWait(QUORUM_VOTE_WAIT_CONFIGURED_TIME_SEC);
|
||||
replicatedPolicyConf.setGroupName("group0");
|
||||
replicatedPolicyConf.setVoteRetries(5);
|
||||
replicatedPolicyConf.setVoteRetryWait(100);
|
||||
|
@ -43,12 +44,16 @@ public class QuorumResultWaitTest extends StaticClusterWithBackupFailoverTest {
|
|||
@Test
|
||||
public void testQuorumVotingResultWait() throws Exception {
|
||||
setupCluster();
|
||||
try {
|
||||
startServers(0, 1, 2);
|
||||
startServers(3, 4, 5);
|
||||
//Assert if the default time 30 sec is used
|
||||
assertEquals(ActiveMQDefaultConfiguration.getDefaultQuorumVoteWait(), ((ReplicatedPolicy)(servers[0].getHAPolicy())).getQuorumVoteWait());
|
||||
assertEquals(ActiveMQDefaultConfiguration.getDefaultQuorumVoteWait(), ((ReplicatedPolicy) (servers[0].getHAPolicy())).getQuorumVoteWait());
|
||||
//Assert if the configured time is used.
|
||||
assertEquals(QUORUM_VOTE_WAIT_CONFIGURED_TIME_SEC, ((ReplicatedPolicy)(servers[3].getHAPolicy())).getQuorumVoteWait());
|
||||
assertEquals(QUORUM_VOTE_WAIT_CONFIGURED_TIME_SEC, ((ReplicatedPolicy) (servers[3].getHAPolicy())).getQuorumVoteWait());
|
||||
} finally {
|
||||
stopServers(0, 1, 2, 3, 4, 5);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue