public abstract class AbstractQuorumTestCase extends TestCase3
MockQuorumFixture.TestCase2.MyProperties, TestCase2.RandomType| Modifier and Type | Field and Description |
|---|---|
protected MockQuorumFixture.MockQuorum.MockQuorumActor[] |
actors
The per-client quorum actor objects.
|
protected com.bigdata.quorum.MockQuorumFixture.MockQuorumMember[] |
clients
The clients.
|
protected MockQuorumFixture |
fixture
The mock shared quorum state object.
|
protected int |
k
The service replication factor (this must be set in
#setupUp()). |
protected MockQuorumFixture.MockQuorum[] |
quorums
The per-client quorum objects.
|
_randomType, log| Constructor and Description |
|---|
AbstractQuorumTestCase() |
AbstractQuorumTestCase(String name) |
| Modifier and Type | Method and Description |
|---|---|
static void |
assertCondition(Runnable cond,
long timeout,
TimeUnit units)
Wait up to a timeout until some condition succeeds.
|
protected void |
setUp() |
protected void |
tearDown() |
static String |
toString(Map<Long,UUID[]> votes)
Helper method provides nice rendering of a votes snapshot.
|
assertCondition, assertEquals, assertEquals, getBytes, getPort, getRandomData, getRandomDataassertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEqualsWithinUlps, assertSameArray, assertSameArray, assertSameBigDecimal, assertSameBigDecimal, assertSameBigInteger, assertSameBigInteger, assertSameIterator, assertSameIterator, assertSameIteratorAnyOrder, assertSameIteratorAnyOrder, assertSameValue, assertSameValue, assertZeroUlps, assertZeroUlps, fail, getInnerCause, getNormalInt, getProjectBuildPath, getProperties, getRandomObject, getRandomObject, getRandomOrder, getRandomString, getTestInputStream, getTestResource, getTestResource, getUlps, getUlps, isDEBUG, isDEBUG, isINFO, isINFO, isInnerCause, logPropertiesassertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, run, runBare, runTest, setName, toStringprotected int k
#setupUp()).protected MockQuorumFixture.MockQuorum[] quorums
protected com.bigdata.quorum.MockQuorumFixture.MockQuorumMember[] clients
protected MockQuorumFixture.MockQuorum.MockQuorumActor[] actors
protected MockQuorumFixture fixture
public AbstractQuorumTestCase()
public AbstractQuorumTestCase(String name)
protected void tearDown()
throws Exception
public static void assertCondition(Runnable cond, long timeout, TimeUnit units)
Whenever more than one AbstractQuorum is under test there will be
concurrent indeterminism concerning the precise ordering and timing as
updates propagate from the AbstractQuorum which takes some action
(castVote(), pipelineAdd(), etc.) to the other quorums attached to the
same MockQuorumFixture. This uncertainty about the ordering and
timing state changes is not dissimilar from the uncertainty we face in a
real distributed system.
While there are times when this uncertainty does not affect the behavior of the tests, there are other times when we must have a guarantee that a specific vote order or pipeline order was established. For those cases, this method may be used to await an arbitrary condition. This method simply retries until the condition becomes true, sleeping a little after each failure.
Actions executed in the main thread of the unit test will directly update
the internal state of the MockQuorumFixture, which is shared
across the MockQuorumFixture.MockQuorums. However, uncertainty about ordering can
arise as a result of the interleaving of the actions taken by the
QuorumWatchers in response to both top-level actions and actions
taken by other QuorumWatchers. For example, the vote order or the
pipeline order are fully determined based on sequence such as the
following:
actor0.pipelineAdd(); actor2.pipelineAdd(); actor1.pipelineAdd();When in doubt, or when a unit test displays stochastic behavior, you can use this method to wait until the quorum state has been correctly replicated to the
Quorums under test.cond - The condition, which must throw an
AssertionFailedError if it does not succeed.timeout - The timeout.unit - junit.framework.AssertionFailedError - if the condition does not succeed within the timeout.public static String toString(Map<Long,UUID[]> votes)
Note: The snapshot uses a UUID[] rather than a collection for
each lastCommitTime key. However, by default toString() for
an array does not provide a nice rendering.
votes - The votes.Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.