Package org.apache.cassandra.testing
Interface IClusterExtension<I extends org.apache.cassandra.distributed.api.IInstance>
-
- Type Parameters:
I- the type of the cluster instances
- All Superinterfaces:
java.lang.AutoCloseable,org.apache.cassandra.distributed.api.ICluster<I>,java.lang.Iterable<I>
- All Known Implementing Classes:
CassandraCluster
public interface IClusterExtension<I extends org.apache.cassandra.distributed.api.IInstance> extends org.apache.cassandra.distributed.api.ICluster<I>Extends functionality for theIClusterinterface
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description IaddInstance(java.lang.String dc, java.lang.String rack, java.util.function.Consumer<org.apache.cassandra.distributed.api.IInstanceConfig> fn)Create a new instance and add it to the cluster, without starting it.voidawaitGossipStatus(org.apache.cassandra.distributed.api.IInstance instance, org.apache.cassandra.distributed.api.IInstance expectedInGossip, java.lang.String targetStatus)Waits for the target instance to have the desired status.voidawaitRingState(org.apache.cassandra.distributed.api.IInstance instance, org.apache.cassandra.distributed.api.IInstance expectedInRing, java.lang.String state)Waits for the ring to have the target instance with the provided state.voidawaitRingStatus(org.apache.cassandra.distributed.api.IInstance instance, org.apache.cassandra.distributed.api.IInstance expectedInRing, java.lang.String status)Wait for the ring to have the target instance with the provided status.org.apache.cassandra.distributed.api.ICluster<I>delegate()IgetFirstRunningInstance()org.apache.cassandra.distributed.api.IInstanceConfignewInstanceConfig()voidschemaChangeIgnoringStoppedInstances(java.lang.String query)Change the schema of the cluster, tolerating stopped nodes.voidstopUnchecked(org.apache.cassandra.distributed.api.IInstance instance)Stop an instance in a blocking manner.-
Methods inherited from interface org.apache.cassandra.distributed.api.ICluster
bootstrap, checkAndResetUncaughtExceptions, coordinator, deliverMessage, filters, get, get, iterator, schemaChange, schemaChange, setMessageSink, setUncaughtExceptionsFilter, setUncaughtExceptionsFilter, size, startup, stream, stream, stream
-
-
-
-
Method Detail
-
schemaChangeIgnoringStoppedInstances
void schemaChangeIgnoringStoppedInstances(java.lang.String query)
Change the schema of the cluster, tolerating stopped nodes. N.B. the schema will not automatically be updated when stopped nodes are restarted, individual tests need to re-synchronize somehow (by gossip or some other mechanism).- Parameters:
query- Schema altering statement
-
addInstance
I addInstance(java.lang.String dc, java.lang.String rack, java.util.function.Consumer<org.apache.cassandra.distributed.api.IInstanceConfig> fn)
Create a new instance and add it to the cluster, without starting it.- Parameters:
dc- the instance should be inrack- the instance should be infn- function to add to the config before starting- Returns:
- the instance added
-
getFirstRunningInstance
I getFirstRunningInstance()
- Returns:
- the first instance with running state
-
newInstanceConfig
org.apache.cassandra.distributed.api.IInstanceConfig newInstanceConfig()
- Returns:
- a newly created instance configuration
-
delegate
org.apache.cassandra.distributed.api.ICluster<I> delegate()
- Returns:
- a reference to the delegated
IClusterinstance
-
awaitRingState
void awaitRingState(org.apache.cassandra.distributed.api.IInstance instance, org.apache.cassandra.distributed.api.IInstance expectedInRing, java.lang.String state)Waits for the ring to have the target instance with the provided state.- Parameters:
instance- instance to check onexpectedInRing- to look forstate- expected
-
awaitRingStatus
void awaitRingStatus(org.apache.cassandra.distributed.api.IInstance instance, org.apache.cassandra.distributed.api.IInstance expectedInRing, java.lang.String status)Wait for the ring to have the target instance with the provided status.- Parameters:
instance- instance to check onexpectedInRing- to look forstatus- expected
-
awaitGossipStatus
void awaitGossipStatus(org.apache.cassandra.distributed.api.IInstance instance, org.apache.cassandra.distributed.api.IInstance expectedInGossip, java.lang.String targetStatus)Waits for the target instance to have the desired status. Target status is checked via string contains so works with 'NORMAL' but also can check tokens or full state.- Parameters:
instance- instance to check onexpectedInGossip- instance to wait fortargetStatus- for the instance
-
stopUnchecked
void stopUnchecked(org.apache.cassandra.distributed.api.IInstance instance)
Stop an instance in a blocking manner.The main difference between this and
IInstance.shutdown()is that the wait on the future will catch the exceptions and throw as runtime.- Parameters:
instance- instance to stop
-
-