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 the ICluster interface
    • Field Summary

      • Fields inherited from interface org.apache.cassandra.distributed.api.ICluster

        PROPERTY_PREFIX
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      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.
      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.
      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.
      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.
      org.apache.cassandra.distributed.api.ICluster<I> delegate()  
      I getFirstRunningInstance()  
      org.apache.cassandra.distributed.api.IInstanceConfig newInstanceConfig()  
      void schemaChangeIgnoringStoppedInstances​(java.lang.String query)
      Change the schema of the cluster, tolerating stopped nodes.
      void stopUnchecked​(org.apache.cassandra.distributed.api.IInstance instance)
      Stop an instance in a blocking manner.
      • Methods inherited from interface java.lang.AutoCloseable

        close
      • 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
      • Methods inherited from interface java.lang.Iterable

        forEach, spliterator
    • 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 in
        rack - the instance should be in
        fn - 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 ICluster instance
      • 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 on
        expectedInRing - to look for
        state - 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 on
        expectedInRing - to look for
        status - 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 on
        expectedInGossip - instance to wait for
        targetStatus - 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