http://git-wip-us.apache.org/repos/asf/cassandra/blob/438acfc8/test/unit/org/apache/cassandra/db/ScrubTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/db/ScrubTest.java b/test/unit/org/apache/cassandra/db/ScrubTest.java index f0b379d..7cc431d 100644 --- a/test/unit/org/apache/cassandra/db/ScrubTest.java +++ b/test/unit/org/apache/cassandra/db/ScrubTest.java @@ -28,7 +28,7 @@ import java.util.concurrent.ExecutionException; import org.junit.Test; -import org.apache.cassandra.CleanupHelper; +import org.apache.cassandra.SchemaLoader; import org.apache.cassandra.Util; import org.apache.cassandra.config.ConfigurationException; import org.apache.cassandra.db.columniterator.IdentityQueryFilter; @@ -41,7 +41,7 @@ import static org.apache.cassandra.Util.column; import static org.junit.Assert.assertEquals; import static org.junit.Assert.fail; -public class ScrubTest extends CleanupHelper +public class ScrubTest extends SchemaLoader { public String TABLE = "Keyspace1"; public String CF = "Standard1"; @@ -83,6 +83,7 @@ public class ScrubTest extends CleanupHelper Table table = Table.open(TABLE); ColumnFamilyStore cfs = table.getColumnFamilyStore(CF2); + cfs.loadNewSSTables(); assert cfs.getSSTables().size() > 0; List<Row> rows;
http://git-wip-us.apache.org/repos/asf/cassandra/blob/438acfc8/test/unit/org/apache/cassandra/db/TableTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/db/TableTest.java b/test/unit/org/apache/cassandra/db/TableTest.java index b5a3869..1071eeb 100644 --- a/test/unit/org/apache/cassandra/db/TableTest.java +++ b/test/unit/org/apache/cassandra/db/TableTest.java @@ -32,7 +32,7 @@ import org.apache.commons.lang.StringUtils; import org.junit.Test; import static junit.framework.Assert.*; -import org.apache.cassandra.CleanupHelper; +import org.apache.cassandra.SchemaLoader; import org.apache.cassandra.db.compaction.CompactionManager; import org.apache.cassandra.db.filter.QueryFilter; import org.apache.cassandra.io.util.RandomAccessReader; @@ -47,7 +47,7 @@ import org.apache.cassandra.io.sstable.SSTableReader; import org.apache.cassandra.utils.ByteBufferUtil; -public class TableTest extends CleanupHelper +public class TableTest extends SchemaLoader { private static final DecoratedKey TEST_KEY = Util.dk("key1"); private static final DecoratedKey TEST_SLICE_KEY = Util.dk("key1-slicerange"); http://git-wip-us.apache.org/repos/asf/cassandra/blob/438acfc8/test/unit/org/apache/cassandra/db/TimeSortTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/db/TimeSortTest.java b/test/unit/org/apache/cassandra/db/TimeSortTest.java index 59bdabf..7ea91a5 100644 --- a/test/unit/org/apache/cassandra/db/TimeSortTest.java +++ b/test/unit/org/apache/cassandra/db/TimeSortTest.java @@ -26,7 +26,7 @@ import java.util.*; import org.junit.Test; import static org.junit.Assert.assertEquals; -import org.apache.cassandra.CleanupHelper; +import org.apache.cassandra.SchemaLoader; import static org.apache.cassandra.Util.getBytes; import org.apache.cassandra.Util; @@ -36,7 +36,7 @@ import org.apache.cassandra.db.marshal.LongType; import org.apache.cassandra.utils.ByteBufferUtil; -public class TimeSortTest extends CleanupHelper +public class TimeSortTest extends SchemaLoader { @Test public void testMixedSources() throws IOException, ExecutionException, InterruptedException http://git-wip-us.apache.org/repos/asf/cassandra/blob/438acfc8/test/unit/org/apache/cassandra/db/compaction/CompactionsPurgeTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/db/compaction/CompactionsPurgeTest.java b/test/unit/org/apache/cassandra/db/compaction/CompactionsPurgeTest.java index b948f49..e8ed58c 100644 --- a/test/unit/org/apache/cassandra/db/compaction/CompactionsPurgeTest.java +++ b/test/unit/org/apache/cassandra/db/compaction/CompactionsPurgeTest.java @@ -25,7 +25,7 @@ import java.util.concurrent.ExecutionException; import org.junit.Test; -import org.apache.cassandra.CleanupHelper; +import org.apache.cassandra.SchemaLoader; import org.apache.cassandra.db.IColumn; import org.apache.cassandra.db.Table; import org.apache.cassandra.db.DecoratedKey; @@ -43,7 +43,7 @@ import static org.apache.cassandra.db.TableTest.assertColumns; import org.apache.cassandra.utils.ByteBufferUtil; -public class CompactionsPurgeTest extends CleanupHelper +public class CompactionsPurgeTest extends SchemaLoader { public static final String TABLE1 = "Keyspace1"; public static final String TABLE2 = "Keyspace2"; http://git-wip-us.apache.org/repos/asf/cassandra/blob/438acfc8/test/unit/org/apache/cassandra/db/compaction/CompactionsTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/db/compaction/CompactionsTest.java b/test/unit/org/apache/cassandra/db/compaction/CompactionsTest.java index 7d78524..076aad3 100644 --- a/test/unit/org/apache/cassandra/db/compaction/CompactionsTest.java +++ b/test/unit/org/apache/cassandra/db/compaction/CompactionsTest.java @@ -31,7 +31,7 @@ import java.util.concurrent.Future; import org.junit.Test; import static junit.framework.Assert.assertEquals; -import org.apache.cassandra.CleanupHelper; +import org.apache.cassandra.SchemaLoader; import org.apache.cassandra.Util; import org.apache.cassandra.config.DatabaseDescriptor; import org.apache.cassandra.db.*; @@ -42,7 +42,7 @@ import org.apache.cassandra.io.sstable.*; import org.apache.cassandra.utils.ByteBufferUtil; import org.apache.cassandra.utils.FBUtilities; -public class CompactionsTest extends CleanupHelper +public class CompactionsTest extends SchemaLoader { public static final String TABLE1 = "Keyspace1"; http://git-wip-us.apache.org/repos/asf/cassandra/blob/438acfc8/test/unit/org/apache/cassandra/db/compaction/OneCompactionTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/db/compaction/OneCompactionTest.java b/test/unit/org/apache/cassandra/db/compaction/OneCompactionTest.java index c86e42e..67906c5 100644 --- a/test/unit/org/apache/cassandra/db/compaction/OneCompactionTest.java +++ b/test/unit/org/apache/cassandra/db/compaction/OneCompactionTest.java @@ -34,11 +34,11 @@ import org.apache.cassandra.db.RowMutation; import org.apache.cassandra.db.ColumnFamilyStore; import org.apache.cassandra.db.filter.QueryPath; -import org.apache.cassandra.CleanupHelper; +import org.apache.cassandra.SchemaLoader; import org.apache.cassandra.utils.ByteBufferUtil; -public class OneCompactionTest extends CleanupHelper +public class OneCompactionTest extends SchemaLoader { private void testCompaction(String columnFamilyName, int insertsPerTable) throws IOException, ExecutionException, InterruptedException { http://git-wip-us.apache.org/repos/asf/cassandra/blob/438acfc8/test/unit/org/apache/cassandra/db/marshal/CompositeTypeTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/db/marshal/CompositeTypeTest.java b/test/unit/org/apache/cassandra/db/marshal/CompositeTypeTest.java index c52efb9..1bc3d70 100644 --- a/test/unit/org/apache/cassandra/db/marshal/CompositeTypeTest.java +++ b/test/unit/org/apache/cassandra/db/marshal/CompositeTypeTest.java @@ -27,7 +27,7 @@ import java.util.UUID; import org.junit.Test; import static org.junit.Assert.fail; -import org.apache.cassandra.CleanupHelper; +import org.apache.cassandra.SchemaLoader; import org.apache.cassandra.Util; import org.apache.cassandra.config.ConfigurationException; import org.apache.cassandra.db.*; @@ -35,7 +35,7 @@ import org.apache.cassandra.db.filter.QueryFilter; import org.apache.cassandra.db.filter.QueryPath; import org.apache.cassandra.utils.*; -public class CompositeTypeTest extends CleanupHelper +public class CompositeTypeTest extends SchemaLoader { private static final String cfName = "StandardComposite"; private static final CompositeType comparator; http://git-wip-us.apache.org/repos/asf/cassandra/blob/438acfc8/test/unit/org/apache/cassandra/db/marshal/DynamicCompositeTypeTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/db/marshal/DynamicCompositeTypeTest.java b/test/unit/org/apache/cassandra/db/marshal/DynamicCompositeTypeTest.java index 45b243d..08f772f 100644 --- a/test/unit/org/apache/cassandra/db/marshal/DynamicCompositeTypeTest.java +++ b/test/unit/org/apache/cassandra/db/marshal/DynamicCompositeTypeTest.java @@ -27,14 +27,14 @@ import java.util.UUID; import org.junit.Test; import static org.junit.Assert.fail; -import org.apache.cassandra.CleanupHelper; +import org.apache.cassandra.SchemaLoader; import org.apache.cassandra.Util; import org.apache.cassandra.db.*; import org.apache.cassandra.db.filter.QueryFilter; import org.apache.cassandra.db.filter.QueryPath; import org.apache.cassandra.utils.*; -public class DynamicCompositeTypeTest extends CleanupHelper +public class DynamicCompositeTypeTest extends SchemaLoader { private static final String cfName = "StandardDynamicComposite"; http://git-wip-us.apache.org/repos/asf/cassandra/blob/438acfc8/test/unit/org/apache/cassandra/dht/BootStrapperTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/dht/BootStrapperTest.java b/test/unit/org/apache/cassandra/dht/BootStrapperTest.java index 4b3a00d..4b19505 100644 --- a/test/unit/org/apache/cassandra/dht/BootStrapperTest.java +++ b/test/unit/org/apache/cassandra/dht/BootStrapperTest.java @@ -29,7 +29,7 @@ import java.util.Map; import org.junit.Test; -import org.apache.cassandra.CleanupHelper; +import org.apache.cassandra.SchemaLoader; import org.apache.cassandra.config.Schema; import org.apache.cassandra.db.Table; import org.apache.cassandra.gms.ApplicationState; @@ -42,7 +42,7 @@ import org.apache.cassandra.utils.FBUtilities; import static org.junit.Assert.assertEquals; -public class BootStrapperTest extends CleanupHelper +public class BootStrapperTest extends SchemaLoader { @Test public void testTokenRoundtrip() throws Exception http://git-wip-us.apache.org/repos/asf/cassandra/blob/438acfc8/test/unit/org/apache/cassandra/io/BloomFilterTrackerTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/io/BloomFilterTrackerTest.java b/test/unit/org/apache/cassandra/io/BloomFilterTrackerTest.java index 6bc3032..4943a3a 100644 --- a/test/unit/org/apache/cassandra/io/BloomFilterTrackerTest.java +++ b/test/unit/org/apache/cassandra/io/BloomFilterTrackerTest.java @@ -23,12 +23,12 @@ package org.apache.cassandra.io; import org.junit.Test; -import org.apache.cassandra.CleanupHelper; +import org.apache.cassandra.SchemaLoader; import org.apache.cassandra.io.sstable.BloomFilterTracker; import static org.junit.Assert.assertEquals; -public class BloomFilterTrackerTest extends CleanupHelper +public class BloomFilterTrackerTest extends SchemaLoader { @Test public void testAddingFalsePositives() http://git-wip-us.apache.org/repos/asf/cassandra/blob/438acfc8/test/unit/org/apache/cassandra/io/CompactSerializerTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/io/CompactSerializerTest.java b/test/unit/org/apache/cassandra/io/CompactSerializerTest.java index 64d3980..58b01a7 100644 --- a/test/unit/org/apache/cassandra/io/CompactSerializerTest.java +++ b/test/unit/org/apache/cassandra/io/CompactSerializerTest.java @@ -21,7 +21,7 @@ package org.apache.cassandra.io; */ -import org.apache.cassandra.CleanupHelper; +import org.apache.cassandra.SchemaLoader; import org.junit.BeforeClass; import org.junit.Test; @@ -33,7 +33,7 @@ import java.util.HashSet; import java.util.List; import java.util.Set; -public class CompactSerializerTest extends CleanupHelper +public class CompactSerializerTest extends SchemaLoader { private static Set<String> expectedClassNames; private static List<String> discoveredClassNames; http://git-wip-us.apache.org/repos/asf/cassandra/blob/438acfc8/test/unit/org/apache/cassandra/io/LazilyCompactedRowTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/io/LazilyCompactedRowTest.java b/test/unit/org/apache/cassandra/io/LazilyCompactedRowTest.java index 1eab8c5..22ffe97 100644 --- a/test/unit/org/apache/cassandra/io/LazilyCompactedRowTest.java +++ b/test/unit/org/apache/cassandra/io/LazilyCompactedRowTest.java @@ -34,7 +34,7 @@ import java.util.concurrent.ExecutionException; import org.junit.Test; -import org.apache.cassandra.CleanupHelper; +import org.apache.cassandra.SchemaLoader; import org.apache.cassandra.config.DatabaseDescriptor; import org.apache.cassandra.db.*; import org.apache.cassandra.db.compaction.*; @@ -53,7 +53,7 @@ import org.apache.cassandra.utils.UUIDGen; import static junit.framework.Assert.assertEquals; -public class LazilyCompactedRowTest extends CleanupHelper +public class LazilyCompactedRowTest extends SchemaLoader { private static void assertBytes(ColumnFamilyStore cfs, int gcBefore) throws IOException { http://git-wip-us.apache.org/repos/asf/cassandra/blob/438acfc8/test/unit/org/apache/cassandra/io/sstable/LegacySSTableTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/io/sstable/LegacySSTableTest.java b/test/unit/org/apache/cassandra/io/sstable/LegacySSTableTest.java index 01d547a..ac1e497 100644 --- a/test/unit/org/apache/cassandra/io/sstable/LegacySSTableTest.java +++ b/test/unit/org/apache/cassandra/io/sstable/LegacySSTableTest.java @@ -24,7 +24,7 @@ import java.io.IOException; import java.nio.ByteBuffer; import java.util.*; -import org.apache.cassandra.CleanupHelper; +import org.apache.cassandra.SchemaLoader; import org.apache.cassandra.db.DecoratedKey; import org.apache.cassandra.db.columniterator.SSTableNamesIterator; import org.apache.cassandra.utils.FBUtilities; @@ -36,7 +36,7 @@ import org.junit.Test; * Tests backwards compatibility for SSTables. Requires that older SSTables match up with the existing config file, * and currently only tests specific cases for specific upgrades. */ -public class LegacySSTableTest extends CleanupHelper +public class LegacySSTableTest extends SchemaLoader { public static final String LEGACY_SSTABLE_PROP = "legacy-sstable-root"; public static final String KSNAME = "Keyspace1"; http://git-wip-us.apache.org/repos/asf/cassandra/blob/438acfc8/test/unit/org/apache/cassandra/io/sstable/SSTableReaderTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/io/sstable/SSTableReaderTest.java b/test/unit/org/apache/cassandra/io/sstable/SSTableReaderTest.java index fede053..caefdce 100644 --- a/test/unit/org/apache/cassandra/io/sstable/SSTableReaderTest.java +++ b/test/unit/org/apache/cassandra/io/sstable/SSTableReaderTest.java @@ -31,7 +31,7 @@ import java.util.concurrent.ExecutionException; import org.junit.Test; -import org.apache.cassandra.CleanupHelper; +import org.apache.cassandra.SchemaLoader; import org.apache.cassandra.Util; import org.apache.cassandra.config.DatabaseDescriptor; import org.apache.cassandra.db.*; @@ -52,7 +52,7 @@ import org.apache.cassandra.utils.ByteBufferUtil; import org.apache.cassandra.utils.CLibrary; import org.apache.cassandra.utils.Pair; -public class SSTableReaderTest extends CleanupHelper +public class SSTableReaderTest extends SchemaLoader { static Token t(int i) { http://git-wip-us.apache.org/repos/asf/cassandra/blob/438acfc8/test/unit/org/apache/cassandra/io/sstable/SSTableSimpleWriterTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/io/sstable/SSTableSimpleWriterTest.java b/test/unit/org/apache/cassandra/io/sstable/SSTableSimpleWriterTest.java index 667e3f6..6efdc9b 100644 --- a/test/unit/org/apache/cassandra/io/sstable/SSTableSimpleWriterTest.java +++ b/test/unit/org/apache/cassandra/io/sstable/SSTableSimpleWriterTest.java @@ -23,7 +23,7 @@ import java.io.File; import org.apache.cassandra.dht.IPartitioner; import org.junit.Test; -import org.apache.cassandra.CleanupHelper; +import org.apache.cassandra.SchemaLoader; import org.apache.cassandra.Util; import org.apache.cassandra.db.*; import org.apache.cassandra.db.marshal.IntegerType; @@ -31,7 +31,7 @@ import org.apache.cassandra.service.StorageService; import static org.apache.cassandra.utils.ByteBufferUtil.bytes; import static org.apache.cassandra.utils.ByteBufferUtil.toInt; -public class SSTableSimpleWriterTest extends CleanupHelper +public class SSTableSimpleWriterTest extends SchemaLoader { @Test public void testSSTableSimpleUnsortedWriter() throws Exception http://git-wip-us.apache.org/repos/asf/cassandra/blob/438acfc8/test/unit/org/apache/cassandra/io/sstable/SSTableTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/io/sstable/SSTableTest.java b/test/unit/org/apache/cassandra/io/sstable/SSTableTest.java index 34f3226..88a49ea 100644 --- a/test/unit/org/apache/cassandra/io/sstable/SSTableTest.java +++ b/test/unit/org/apache/cassandra/io/sstable/SSTableTest.java @@ -25,11 +25,11 @@ import java.util.*; import org.junit.Test; -import org.apache.cassandra.CleanupHelper; +import org.apache.cassandra.SchemaLoader; import org.apache.cassandra.io.util.RandomAccessReader; import org.apache.cassandra.utils.ByteBufferUtil; -public class SSTableTest extends CleanupHelper +public class SSTableTest extends SchemaLoader { @Test public void testSingleWrite() throws IOException { http://git-wip-us.apache.org/repos/asf/cassandra/blob/438acfc8/test/unit/org/apache/cassandra/locator/SimpleStrategyTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/locator/SimpleStrategyTest.java b/test/unit/org/apache/cassandra/locator/SimpleStrategyTest.java index 027469f..8c17f6d 100644 --- a/test/unit/org/apache/cassandra/locator/SimpleStrategyTest.java +++ b/test/unit/org/apache/cassandra/locator/SimpleStrategyTest.java @@ -29,7 +29,7 @@ import java.util.List; import org.apache.cassandra.config.Schema; import org.junit.Test; -import org.apache.cassandra.CleanupHelper; +import org.apache.cassandra.SchemaLoader; import org.apache.cassandra.config.ConfigurationException; import org.apache.cassandra.config.KSMetaData; import org.apache.cassandra.db.Table; @@ -40,7 +40,7 @@ import org.apache.cassandra.utils.ByteBufferUtil; import static org.junit.Assert.*; -public class SimpleStrategyTest extends CleanupHelper +public class SimpleStrategyTest extends SchemaLoader { @Test public void tryValidTable() http://git-wip-us.apache.org/repos/asf/cassandra/blob/438acfc8/test/unit/org/apache/cassandra/service/AntiEntropyServiceTestAbstract.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/service/AntiEntropyServiceTestAbstract.java b/test/unit/org/apache/cassandra/service/AntiEntropyServiceTestAbstract.java index 9a9e459..17146f4 100644 --- a/test/unit/org/apache/cassandra/service/AntiEntropyServiceTestAbstract.java +++ b/test/unit/org/apache/cassandra/service/AntiEntropyServiceTestAbstract.java @@ -27,7 +27,7 @@ import org.junit.After; import org.junit.Before; import org.junit.Test; -import org.apache.cassandra.CleanupHelper; +import org.apache.cassandra.SchemaLoader; import org.apache.cassandra.Util; import org.apache.cassandra.concurrent.Stage; import org.apache.cassandra.concurrent.StageManager; @@ -47,7 +47,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import org.apache.cassandra.utils.ByteBufferUtil; -public abstract class AntiEntropyServiceTestAbstract extends CleanupHelper +public abstract class AntiEntropyServiceTestAbstract extends SchemaLoader { // table and column family to test against public AntiEntropyService aes; http://git-wip-us.apache.org/repos/asf/cassandra/blob/438acfc8/test/unit/org/apache/cassandra/service/CassandraServerTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/service/CassandraServerTest.java b/test/unit/org/apache/cassandra/service/CassandraServerTest.java index 3a6de25..495d697 100644 --- a/test/unit/org/apache/cassandra/service/CassandraServerTest.java +++ b/test/unit/org/apache/cassandra/service/CassandraServerTest.java @@ -20,9 +20,9 @@ package org.apache.cassandra.service; import org.junit.Test; -import org.apache.cassandra.CleanupHelper; +import org.apache.cassandra.SchemaLoader; -public class CassandraServerTest extends CleanupHelper +public class CassandraServerTest extends SchemaLoader { @Test public void test_get_column() throws Throwable { http://git-wip-us.apache.org/repos/asf/cassandra/blob/438acfc8/test/unit/org/apache/cassandra/service/EmbeddedCassandraServiceTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/service/EmbeddedCassandraServiceTest.java b/test/unit/org/apache/cassandra/service/EmbeddedCassandraServiceTest.java index 701dee5..332f95a 100644 --- a/test/unit/org/apache/cassandra/service/EmbeddedCassandraServiceTest.java +++ b/test/unit/org/apache/cassandra/service/EmbeddedCassandraServiceTest.java @@ -25,9 +25,10 @@ import java.nio.charset.CharacterCodingException; import org.junit.BeforeClass; import org.junit.Test; -import org.apache.cassandra.CleanupHelper; +import org.apache.cassandra.SchemaLoader; import org.apache.cassandra.config.ConfigurationException; import org.apache.cassandra.config.DatabaseDescriptor; +import org.apache.cassandra.config.Schema; import org.apache.cassandra.thrift.*; import org.apache.cassandra.utils.ByteBufferUtil; import org.apache.thrift.TException; @@ -47,7 +48,7 @@ import static org.junit.Assert.assertNotNull; * Tests connect to localhost:9160 when the embedded server is running. * */ -public class EmbeddedCassandraServiceTest extends CleanupHelper +public class EmbeddedCassandraServiceTest extends SchemaLoader { private static EmbeddedCassandraService cassandra; @@ -62,6 +63,7 @@ public class EmbeddedCassandraServiceTest extends CleanupHelper @BeforeClass public static void setup() throws TTransportException, IOException, InterruptedException, ConfigurationException { + Schema.instance.clear(); // Schema are now written on disk and will be reloaded cassandra = new EmbeddedCassandraService(); cassandra.start(); } http://git-wip-us.apache.org/repos/asf/cassandra/blob/438acfc8/test/unit/org/apache/cassandra/service/LeaveAndBootstrapTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/service/LeaveAndBootstrapTest.java b/test/unit/org/apache/cassandra/service/LeaveAndBootstrapTest.java index 8047841..faa9e18 100644 --- a/test/unit/org/apache/cassandra/service/LeaveAndBootstrapTest.java +++ b/test/unit/org/apache/cassandra/service/LeaveAndBootstrapTest.java @@ -19,6 +19,7 @@ package org.apache.cassandra.service; +import java.io.IOException; import java.net.InetAddress; import java.net.UnknownHostException; import java.util.*; @@ -28,9 +29,11 @@ import org.apache.cassandra.config.Schema; import org.junit.Test; import static org.junit.Assert.*; +import org.junit.AfterClass; +import org.junit.BeforeClass; import com.google.common.collect.HashMultimap; import com.google.common.collect.Multimap; -import org.apache.cassandra.CleanupHelper; +import org.apache.cassandra.SchemaLoader; import org.apache.cassandra.Util; import org.apache.cassandra.config.KSMetaData; import org.apache.cassandra.dht.*; @@ -41,8 +44,25 @@ import org.apache.cassandra.locator.AbstractReplicationStrategy; import org.apache.cassandra.locator.SimpleSnitch; import org.apache.cassandra.locator.TokenMetadata; -public class LeaveAndBootstrapTest extends CleanupHelper +public class LeaveAndBootstrapTest { + private static final IPartitioner partitioner = new RandomPartitioner(); + private static IPartitioner oldPartitioner; + + @BeforeClass + public static void setup() throws IOException + { + oldPartitioner = StorageService.instance.setPartitionerUnsafe(partitioner); + SchemaLoader.loadSchema(); + } + + @AfterClass + public static void tearDown() + { + StorageService.instance.setPartitionerUnsafe(oldPartitioner); + SchemaLoader.stopGossiper(); + } + /** * Test whether write endpoints is correct when the node is leaving. Uses * StorageService.onChange and does not manipulate token metadata directly. @@ -59,8 +79,6 @@ public class LeaveAndBootstrapTest extends CleanupHelper IPartitioner partitioner = new RandomPartitioner(); VersionedValue.VersionedValueFactory valueFactory = new VersionedValue.VersionedValueFactory(partitioner); - IPartitioner oldPartitioner = ss.setPartitionerUnsafe(partitioner); - ArrayList<Token> endpointTokens = new ArrayList<Token>(); ArrayList<Token> keyTokens = new ArrayList<Token>(); List<InetAddress> hosts = new ArrayList<InetAddress>(); @@ -112,8 +130,6 @@ public class LeaveAndBootstrapTest extends CleanupHelper assertEquals("mismatched endpoint sets", expected, actual); } } - - ss.setPartitionerUnsafe(oldPartitioner); } /** @@ -130,8 +146,6 @@ public class LeaveAndBootstrapTest extends CleanupHelper IPartitioner partitioner = new RandomPartitioner(); VersionedValue.VersionedValueFactory valueFactory = new VersionedValue.VersionedValueFactory(partitioner); - IPartitioner oldPartitioner = ss.setPartitionerUnsafe(partitioner); - ArrayList<Token> endpointTokens = new ArrayList<Token>(); ArrayList<Token> keyTokens = new ArrayList<Token>(); List<InetAddress> hosts = new ArrayList<InetAddress>(); @@ -406,8 +420,6 @@ public class LeaveAndBootstrapTest extends CleanupHelper assertTrue(endpoints.contains(hosts.get(1))); assertTrue(endpoints.contains(hosts.get(2))); } - - ss.setPartitionerUnsafe(oldPartitioner); } @Test @@ -419,8 +431,6 @@ public class LeaveAndBootstrapTest extends CleanupHelper IPartitioner partitioner = new RandomPartitioner(); VersionedValue.VersionedValueFactory valueFactory = new VersionedValue.VersionedValueFactory(partitioner); - IPartitioner oldPartitioner = ss.setPartitionerUnsafe(partitioner); - ArrayList<Token> endpointTokens = new ArrayList<Token>(); ArrayList<Token> keyTokens = new ArrayList<Token>(); List<InetAddress> hosts = new ArrayList<InetAddress>(); @@ -473,8 +483,6 @@ public class LeaveAndBootstrapTest extends CleanupHelper assertTrue(tmd.getToken(hosts.get(3)).equals(keyTokens.get(2))); assertTrue(tmd.getBootstrapTokens().isEmpty()); - - ss.setPartitionerUnsafe(oldPartitioner); } @Test @@ -486,8 +494,6 @@ public class LeaveAndBootstrapTest extends CleanupHelper IPartitioner partitioner = new RandomPartitioner(); VersionedValue.VersionedValueFactory valueFactory = new VersionedValue.VersionedValueFactory(partitioner); - IPartitioner oldPartitioner = ss.setPartitionerUnsafe(partitioner); - ArrayList<Token> endpointTokens = new ArrayList<Token>(); ArrayList<Token> keyTokens = new ArrayList<Token>(); List<InetAddress> hosts = new ArrayList<InetAddress>(); @@ -516,8 +522,6 @@ public class LeaveAndBootstrapTest extends CleanupHelper assertTrue(tmd.getBootstrapTokens().isEmpty()); assertTrue(tmd.getLeavingEndpoints().isEmpty()); assertTrue(tmd.getToken(hosts.get(2)).equals(keyTokens.get(4))); - - ss.setPartitionerUnsafe(oldPartitioner); } @Test @@ -529,8 +533,6 @@ public class LeaveAndBootstrapTest extends CleanupHelper IPartitioner partitioner = new RandomPartitioner(); VersionedValue.VersionedValueFactory valueFactory = new VersionedValue.VersionedValueFactory(partitioner); - IPartitioner oldPartitioner = ss.setPartitionerUnsafe(partitioner); - ArrayList<Token> endpointTokens = new ArrayList<Token>(); ArrayList<Token> keyTokens = new ArrayList<Token>(); List<InetAddress> hosts = new ArrayList<InetAddress>(); @@ -565,8 +567,6 @@ public class LeaveAndBootstrapTest extends CleanupHelper assertFalse(tmd.isMember(hosts.get(2))); assertFalse(tmd.isLeaving(hosts.get(2))); - - ss.setPartitionerUnsafe(oldPartitioner); } @Test @@ -578,8 +578,6 @@ public class LeaveAndBootstrapTest extends CleanupHelper IPartitioner partitioner = new RandomPartitioner(); VersionedValue.VersionedValueFactory valueFactory = new VersionedValue.VersionedValueFactory(partitioner); - IPartitioner oldPartitioner = ss.setPartitionerUnsafe(partitioner); - ArrayList<Token> endpointTokens = new ArrayList<Token>(); ArrayList<Token> keyTokens = new ArrayList<Token>(); List<InetAddress> hosts = new ArrayList<InetAddress>(); @@ -607,8 +605,6 @@ public class LeaveAndBootstrapTest extends CleanupHelper assertTrue(tmd.getBootstrapTokens().size() == 0); assertFalse(tmd.isMember(hosts.get(2))); assertFalse(tmd.isLeaving(hosts.get(2))); - - ss.setPartitionerUnsafe(oldPartitioner); } private static Collection<InetAddress> makeAddrs(String... hosts) throws UnknownHostException http://git-wip-us.apache.org/repos/asf/cassandra/blob/438acfc8/test/unit/org/apache/cassandra/service/MoveTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/service/MoveTest.java b/test/unit/org/apache/cassandra/service/MoveTest.java index 284c201..cbdad15 100644 --- a/test/unit/org/apache/cassandra/service/MoveTest.java +++ b/test/unit/org/apache/cassandra/service/MoveTest.java @@ -19,18 +19,21 @@ package org.apache.cassandra.service; +import java.io.IOException; import java.net.InetAddress; import java.net.UnknownHostException; import java.util.*; -import org.apache.cassandra.config.ConfigurationException; -import org.apache.cassandra.config.Schema; -import org.junit.Test; - -import static org.junit.Assert.*; import com.google.common.collect.HashMultimap; import com.google.common.collect.Multimap; -import org.apache.cassandra.CleanupHelper; +import static org.junit.Assert.*; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import org.apache.cassandra.config.ConfigurationException; +import org.apache.cassandra.config.Schema; +import org.apache.cassandra.SchemaLoader; import org.apache.cassandra.Util; import org.apache.cassandra.config.KSMetaData; import org.apache.cassandra.dht.*; @@ -40,8 +43,31 @@ import org.apache.cassandra.locator.AbstractReplicationStrategy; import org.apache.cassandra.locator.SimpleSnitch; import org.apache.cassandra.locator.TokenMetadata; -public class MoveTest extends CleanupHelper +public class MoveTest { + private static final IPartitioner partitioner = new RandomPartitioner(); + private static IPartitioner oldPartitioner; + + /* + * NOTE: the tests above uses RandomPartitioner, which is not the default + * test partitioner. Changing the partitioner should be done before + * loading the schema as loading the schema trigger the write of sstables. + * So instead of extending SchemaLoader, we call it's method below. + */ + @BeforeClass + public static void setup() throws IOException + { + oldPartitioner = StorageService.instance.setPartitionerUnsafe(partitioner); + SchemaLoader.loadSchema(); + } + + @AfterClass + public static void tearDown() + { + StorageService.instance.setPartitionerUnsafe(oldPartitioner); + SchemaLoader.stopGossiper(); + } + /* * Test whether write endpoints is correct when the node is moving. Uses * StorageService.onChange and does not manipulate token metadata directly. @@ -55,11 +81,8 @@ public class MoveTest extends CleanupHelper TokenMetadata tmd = ss.getTokenMetadata(); tmd.clearUnsafe(); - IPartitioner partitioner = new RandomPartitioner(); VersionedValue.VersionedValueFactory valueFactory = new VersionedValue.VersionedValueFactory(partitioner); - IPartitioner oldPartitioner = ss.setPartitionerUnsafe(partitioner); - ArrayList<Token> endpointTokens = new ArrayList<Token>(); ArrayList<Token> keyTokens = new ArrayList<Token>(); List<InetAddress> hosts = new ArrayList<InetAddress>(); @@ -111,7 +134,6 @@ public class MoveTest extends CleanupHelper // moving endpoint back to the normal state ss.onChange(hosts.get(MOVING_NODE), ApplicationState.STATUS, valueFactory.normal(newToken)); - ss.setPartitionerUnsafe(oldPartitioner); } /* @@ -127,8 +149,6 @@ public class MoveTest extends CleanupHelper IPartitioner partitioner = new RandomPartitioner(); VersionedValue.VersionedValueFactory valueFactory = new VersionedValue.VersionedValueFactory(partitioner); - IPartitioner oldPartitioner = ss.setPartitionerUnsafe(partitioner); - ArrayList<Token> endpointTokens = new ArrayList<Token>(); ArrayList<Token> keyTokens = new ArrayList<Token>(); List<InetAddress> hosts = new ArrayList<InetAddress>(); @@ -447,8 +467,6 @@ public class MoveTest extends CleanupHelper { ss.onChange(hosts.get(movingIndex), ApplicationState.STATUS, valueFactory.normal(newTokens.get(movingIndex))); } - - ss.setPartitionerUnsafe(oldPartitioner); } @Test @@ -460,8 +478,6 @@ public class MoveTest extends CleanupHelper IPartitioner partitioner = new RandomPartitioner(); VersionedValue.VersionedValueFactory valueFactory = new VersionedValue.VersionedValueFactory(partitioner); - IPartitioner oldPartitioner = ss.setPartitionerUnsafe(partitioner); - ArrayList<Token> endpointTokens = new ArrayList<Token>(); ArrayList<Token> keyTokens = new ArrayList<Token>(); List<InetAddress> hosts = new ArrayList<InetAddress>(); @@ -490,8 +506,6 @@ public class MoveTest extends CleanupHelper assertTrue(tmd.getBootstrapTokens().isEmpty()); assertTrue(tmd.getMovingEndpoints().isEmpty()); assertTrue(tmd.getToken(hosts.get(2)).equals(newToken)); - - ss.setPartitionerUnsafe(oldPartitioner); } private static Collection<InetAddress> makeAddrs(String... hosts) throws UnknownHostException http://git-wip-us.apache.org/repos/asf/cassandra/blob/438acfc8/test/unit/org/apache/cassandra/service/RemoveTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/service/RemoveTest.java b/test/unit/org/apache/cassandra/service/RemoveTest.java index 7ee7d69..baf1f17 100644 --- a/test/unit/org/apache/cassandra/service/RemoveTest.java +++ b/test/unit/org/apache/cassandra/service/RemoveTest.java @@ -26,10 +26,12 @@ import java.util.List; import java.util.concurrent.atomic.AtomicBoolean; import org.junit.After; +import org.junit.AfterClass; import org.junit.Before; +import org.junit.BeforeClass; import org.junit.Test; -import org.apache.cassandra.CleanupHelper; +import org.apache.cassandra.SchemaLoader; import org.apache.cassandra.Util; import org.apache.cassandra.config.ConfigurationException; import org.apache.cassandra.dht.IPartitioner; @@ -46,24 +48,36 @@ import org.apache.cassandra.utils.FBUtilities; import static org.junit.Assert.*; -public class RemoveTest extends CleanupHelper +public class RemoveTest { + static final IPartitioner partitioner = new RandomPartitioner(); StorageService ss = StorageService.instance; TokenMetadata tmd = ss.getTokenMetadata(); - IPartitioner oldPartitioner; + static IPartitioner oldPartitioner; ArrayList<Token> endpointTokens = new ArrayList<Token>(); ArrayList<Token> keyTokens = new ArrayList<Token>(); List<InetAddress> hosts = new ArrayList<InetAddress>(); InetAddress removalhost; Token removaltoken; + @BeforeClass + public static void setupClass() throws IOException + { + oldPartitioner = StorageService.instance.setPartitionerUnsafe(partitioner); + SchemaLoader.loadSchema(); + } + + @AfterClass + public static void tearDownClass() + { + StorageService.instance.setPartitionerUnsafe(oldPartitioner); + SchemaLoader.stopGossiper(); + } + @Before public void setup() throws IOException, ConfigurationException { tmd.clearUnsafe(); - IPartitioner partitioner = new RandomPartitioner(); - - oldPartitioner = ss.setPartitionerUnsafe(partitioner); // create a ring of 5 nodes Util.createInitialRing(ss, partitioner, endpointTokens, keyTokens, hosts, 6); @@ -86,7 +100,6 @@ public class RemoveTest extends CleanupHelper SinkManager.clear(); MessagingService.instance().clearCallbacksUnsafe(); MessagingService.instance().shutdown(); - ss.setPartitionerUnsafe(oldPartitioner); } @Test(expected = UnsupportedOperationException.class) http://git-wip-us.apache.org/repos/asf/cassandra/blob/438acfc8/test/unit/org/apache/cassandra/service/StorageProxyTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/service/StorageProxyTest.java b/test/unit/org/apache/cassandra/service/StorageProxyTest.java index 193c258..6fbc80a 100644 --- a/test/unit/org/apache/cassandra/service/StorageProxyTest.java +++ b/test/unit/org/apache/cassandra/service/StorageProxyTest.java @@ -25,7 +25,7 @@ import org.junit.BeforeClass; import org.junit.Test; import static org.junit.Assert.assertEquals; -import org.apache.cassandra.CleanupHelper; +import org.apache.cassandra.SchemaLoader; import static org.apache.cassandra.Util.token; import static org.apache.cassandra.Util.rp; @@ -39,7 +39,7 @@ import org.apache.cassandra.dht.IncludingExcludingBounds; import org.apache.cassandra.locator.TokenMetadata; import org.apache.cassandra.utils.ByteBufferUtil; -public class StorageProxyTest extends CleanupHelper +public class StorageProxyTest extends SchemaLoader { private static Range<RowPosition> range(RowPosition left, RowPosition right) { http://git-wip-us.apache.org/repos/asf/cassandra/blob/438acfc8/test/unit/org/apache/cassandra/service/StorageServiceClientTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/service/StorageServiceClientTest.java b/test/unit/org/apache/cassandra/service/StorageServiceClientTest.java index eb7dc37..e0dca35 100644 --- a/test/unit/org/apache/cassandra/service/StorageServiceClientTest.java +++ b/test/unit/org/apache/cassandra/service/StorageServiceClientTest.java @@ -19,7 +19,7 @@ package org.apache.cassandra.service; -import org.apache.cassandra.CleanupHelper; +import org.apache.cassandra.SchemaLoader; import org.apache.cassandra.config.ConfigurationException; import org.apache.cassandra.config.DatabaseDescriptor; import org.junit.Test; @@ -33,8 +33,8 @@ public class StorageServiceClientTest @Test public void testClientOnlyMode() throws IOException, ConfigurationException { - CleanupHelper.mkdirs(); - CleanupHelper.cleanup(); + SchemaLoader.mkdirs(); + SchemaLoader.cleanup(); StorageService.instance.initClient(0); // verify that no storage directories were created. http://git-wip-us.apache.org/repos/asf/cassandra/blob/438acfc8/test/unit/org/apache/cassandra/service/StorageServiceServerTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/service/StorageServiceServerTest.java b/test/unit/org/apache/cassandra/service/StorageServiceServerTest.java index 5d44ffe..ce88d59 100644 --- a/test/unit/org/apache/cassandra/service/StorageServiceServerTest.java +++ b/test/unit/org/apache/cassandra/service/StorageServiceServerTest.java @@ -28,7 +28,7 @@ import org.junit.Test; import org.apache.cassandra.config.ConfigurationException; import org.apache.cassandra.dht.Token; -import org.apache.cassandra.CleanupHelper; +import org.apache.cassandra.SchemaLoader; import org.apache.cassandra.config.DatabaseDescriptor; import static org.junit.Assert.assertEquals; @@ -39,8 +39,8 @@ public class StorageServiceServerTest @Test public void testRegularMode() throws IOException, InterruptedException, ConfigurationException { - CleanupHelper.mkdirs(); - CleanupHelper.cleanup(); + SchemaLoader.mkdirs(); + SchemaLoader.cleanup(); StorageService.instance.initServer(0); for (String path : DatabaseDescriptor.getAllDataFileLocations()) { http://git-wip-us.apache.org/repos/asf/cassandra/blob/438acfc8/test/unit/org/apache/cassandra/streaming/StreamingTransferTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/streaming/StreamingTransferTest.java b/test/unit/org/apache/cassandra/streaming/StreamingTransferTest.java index 6d720a1..1be057e 100644 --- a/test/unit/org/apache/cassandra/streaming/StreamingTransferTest.java +++ b/test/unit/org/apache/cassandra/streaming/StreamingTransferTest.java @@ -27,7 +27,7 @@ import static org.apache.cassandra.Util.addMutation; import java.net.InetAddress; import java.util.*; -import org.apache.cassandra.CleanupHelper; +import org.apache.cassandra.SchemaLoader; import org.apache.cassandra.db.*; import org.apache.cassandra.db.columniterator.IdentityQueryFilter; import org.apache.cassandra.db.context.CounterContext; @@ -52,7 +52,7 @@ import org.slf4j.LoggerFactory; import org.apache.cassandra.utils.ByteBufferUtil; -public class StreamingTransferTest extends CleanupHelper +public class StreamingTransferTest extends SchemaLoader { private static final Logger logger = LoggerFactory.getLogger(StreamingTransferTest.class); http://git-wip-us.apache.org/repos/asf/cassandra/blob/438acfc8/test/unit/org/apache/cassandra/thrift/ThriftValidationTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/thrift/ThriftValidationTest.java b/test/unit/org/apache/cassandra/thrift/ThriftValidationTest.java index 2ab7202..2a87d35 100644 --- a/test/unit/org/apache/cassandra/thrift/ThriftValidationTest.java +++ b/test/unit/org/apache/cassandra/thrift/ThriftValidationTest.java @@ -25,7 +25,7 @@ import java.nio.ByteBuffer; import org.junit.Test; -import org.apache.cassandra.CleanupHelper; +import org.apache.cassandra.SchemaLoader; import org.apache.cassandra.config.CFMetaData; import org.apache.cassandra.config.ConfigurationException; import org.apache.cassandra.config.Schema; @@ -35,7 +35,7 @@ import org.apache.cassandra.locator.LocalStrategy; import org.apache.cassandra.locator.NetworkTopologyStrategy; import org.apache.cassandra.utils.FBUtilities; -public class ThriftValidationTest extends CleanupHelper +public class ThriftValidationTest extends SchemaLoader { @Test(expected=InvalidRequestException.class) public void testValidateCommutativeWithStandard() throws InvalidRequestException