- make sure workspace.xml specifies a storagedir

- removing unnecessary calls to ServerTestUtils.daemonInitialization() in a handful of tests
- minor cleanup in Verb and BTreeSet
This commit is contained in:
Caleb Rackliffe 2023-05-26 11:25:52 -05:00 committed by David Capwell
parent 537c1f991a
commit f54144d1c1
7 changed files with 30 additions and 39 deletions

View File

@ -189,6 +189,7 @@
-Dcassandra.reads.thresholds.coordinator.defensive_checks_enabled=true
-Dcassandra.ring_delay_ms=10000
-Dcassandra.skip_sync=true
-Dcassandra.storagedir=$PROJECT_DIR$/data
-Dcassandra.strict.runtime.checks=true
-Dcassandra.test.flush_local_schema_changes=false
-Dcassandra.test.messagingService.nonGracefulShutdown=true

View File

@ -150,6 +150,7 @@ public class ClusteringIndexNamesFilter extends AbstractClusteringIndexFilter
return false;
}
@Override
public String toString(TableMetadata metadata)
{
StringBuilder sb = new StringBuilder();
@ -197,6 +198,22 @@ public class ClusteringIndexNamesFilter extends AbstractClusteringIndexFilter
return sb.toString();
}
@Override
public boolean equals(Object o)
{
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ClusteringIndexNamesFilter that = (ClusteringIndexNamesFilter) o;
return Objects.equals(clusterings, that.clusterings) &&
Objects.equals(reversed, that.reversed);
}
@Override
public int hashCode()
{
return Objects.hash(clusterings, reversed);
}
public Kind kind()
{
return Kind.NAMES;

View File

@ -21,7 +21,6 @@ import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.function.Predicate;
import java.util.function.Supplier;
import java.util.function.ToLongFunction;
@ -364,30 +363,20 @@ public enum Verb
*/
Verb(int id, Priority priority, ToLongFunction<TimeUnit> expiration, Stage stage, Supplier<? extends IVersionedAsymmetricSerializer<?, ?>> serializer, Supplier<? extends IVerbHandler<?>> handler)
{
this(NORMAL, id, priority, expiration, stage, serializer, handler, null, null);
}
Verb(int id, Priority priority, ToLongFunction<TimeUnit> expiration, Stage stage, Supplier<? extends IVersionedAsymmetricSerializer<?, ?>> serializer, Supplier<? extends IVerbHandler<?>> handler, Predicate<?> isFinalReply)
{
this(NORMAL, id, priority, expiration, stage, serializer, handler, null, isFinalReply);
this(NORMAL, id, priority, expiration, stage, serializer, handler, null);
}
Verb(int id, Priority priority, ToLongFunction<TimeUnit> expiration, Stage stage, Supplier<? extends IVersionedAsymmetricSerializer<?, ?>> serializer, Supplier<? extends IVerbHandler<?>> handler, Verb responseVerb)
{
this(NORMAL, id, priority, expiration, stage, serializer, handler, responseVerb, null);
this(NORMAL, id, priority, expiration, stage, serializer, handler, responseVerb);
}
Verb(Kind kind, int id, Priority priority, ToLongFunction<TimeUnit> expiration, Stage stage, Supplier<? extends IVersionedAsymmetricSerializer<?, ?>> serializer, Supplier<? extends IVerbHandler<?>> handler)
{
this(kind, id, priority, expiration, stage, serializer, handler, null, null);
this(kind, id, priority, expiration, stage, serializer, handler, null);
}
Verb(Kind kind, int id, Priority priority, ToLongFunction<TimeUnit> expiration, Stage stage, Supplier<? extends IVersionedAsymmetricSerializer<?, ?>> serializer, Supplier<? extends IVerbHandler<?>> handler, Predicate<?> isFinalReply)
{
this(kind, id, priority, expiration, stage, serializer, handler, null, isFinalReply);
}
Verb(Kind kind, int id, Priority priority, ToLongFunction<TimeUnit> expiration, Stage stage, Supplier<? extends IVersionedAsymmetricSerializer<?, ?>> serializer, Supplier<? extends IVerbHandler<?>> handler, Verb responseVerb, Predicate<?> isFinalReply)
Verb(Kind kind, int id, Priority priority, ToLongFunction<TimeUnit> expiration, Stage stage, Supplier<? extends IVersionedAsymmetricSerializer<?, ?>> serializer, Supplier<? extends IVerbHandler<?>> handler, Verb responseVerb)
{
this.stage = stage;
if (id < 0)

View File

@ -27,13 +27,11 @@ import java.util.ListIterator;
import java.util.NavigableSet;
import java.util.NoSuchElementException;
import java.util.Objects;
import java.util.Set;
import java.util.SortedSet;
import java.util.Spliterator;
import java.util.Spliterators;
import java.util.function.Function;
import com.google.common.collect.Iterables;
import com.google.common.collect.Ordering;
import org.apache.cassandra.utils.btree.BTree.Dir;
@ -242,13 +240,6 @@ public class BTreeSet<V> extends AbstractSet<V> implements NavigableSet<V>, List
}
@Override
public boolean equals(Object o)
{
if (this == o) return true;
if (o == null || !(o instanceof Set)) return false;
return Iterables.elementsEqual(this, (Set) o);
}
public int hashCode()
{
// we can't just delegate to Arrays.deepHashCode(),

View File

@ -47,11 +47,10 @@ import static org.apache.cassandra.db.ConsistencyLevel.NODE_LOCAL;
public class TxnAuthTest extends CQLTester
{
@BeforeClass
public static void setUpAuthAndAccord() throws Exception
public static void setUpAuthAndAccord()
{
CassandraRelevantProperties.ENABLE_NODELOCAL_QUERIES.setBoolean(true);
SchemaLoader.prepareServer();
IRoleManager roleManager = new AuthTestUtils.LocalCassandraRoleManager();
SchemaLoader.setupAuth(roleManager,
new AuthTestUtils.LocalPasswordAuthenticator(),

View File

@ -22,7 +22,6 @@ import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
import org.apache.cassandra.ServerTestUtils;
import org.apache.cassandra.config.DatabaseDescriptor;
public class CDCStatementTest extends CQLTester
@ -30,19 +29,18 @@ public class CDCStatementTest extends CQLTester
@BeforeClass
public static void enableCDC()
{
ServerTestUtils.daemonInitialization();
DatabaseDescriptor.setCDCEnabled(true);
}
@Test
public void testEnableOnCreate() throws Throwable
public void testEnableOnCreate()
{
createTable("CREATE TABLE %s (key text, val int, primary key(key)) WITH cdc = true;");
Assert.assertTrue(currentTableMetadata().params.cdc);
}
@Test
public void testEnableOnAlter() throws Throwable
public void testEnableOnAlter()
{
createTable("CREATE TABLE %s (key text, val int, primary key(key));");
Assert.assertFalse(currentTableMetadata().params.cdc);
@ -51,7 +49,7 @@ public class CDCStatementTest extends CQLTester
}
@Test
public void testDisableOnAlter() throws Throwable
public void testDisableOnAlter()
{
createTable("CREATE TABLE %s (key text, val int, primary key(key)) WITH cdc = true;");
Assert.assertTrue(currentTableMetadata().params.cdc);

View File

@ -39,7 +39,6 @@ import org.junit.BeforeClass;
import org.junit.Test;
import com.datastax.driver.core.exceptions.InvalidQueryException;
import org.apache.cassandra.ServerTestUtils;
import org.apache.cassandra.cql3.CQLTester;
import org.apache.cassandra.db.Mutation;
import org.apache.cassandra.db.marshal.Int32Type;
@ -57,7 +56,6 @@ import org.apache.cassandra.service.StorageService;
import org.apache.cassandra.service.StorageServiceMBean;
import org.apache.cassandra.triggers.ITrigger;
import static java.lang.String.format;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
@ -209,8 +207,6 @@ public class VirtualTableTest extends CQLTester
@BeforeClass
public static void setUpVirtualTables()
{
ServerTestUtils.daemonInitialization();
TableMetadata vt1Metadata = TableMetadata.builder(KS_NAME, VT1_NAME)
.kind(TableMetadata.Kind.VIRTUAL)
.addPartitionKeyColumn("pk", UTF8Type.instance)
@ -1051,7 +1047,7 @@ public class VirtualTableTest extends CQLTester
}
@Test
public void testDisallowedFilteringOnRegularColumn() throws Throwable
public void testDisallowedFilteringOnRegularColumn()
{
try
{
@ -1065,7 +1061,7 @@ public class VirtualTableTest extends CQLTester
}
@Test
public void testDisallowedFilteringOnClusteringColumn() throws Throwable
public void testDisallowedFilteringOnClusteringColumn()
{
try
{
@ -1079,13 +1075,13 @@ public class VirtualTableTest extends CQLTester
}
@Test
public void testAllowedFilteringOnRegularColumn() throws Throwable
public void testAllowedFilteringOnRegularColumn()
{
executeNet(format("SELECT * FROM %s.%s WHERE v2 = 5", KS_NAME, VT1_NAME));
}
@Test
public void testAllowedFilteringOnClusteringColumn() throws Throwable
public void testAllowedFilteringOnClusteringColumn()
{
executeNet(format("SELECT * FROM %s.%s WHERE c = 'abc'", KS_NAME, VT1_NAME));
}