mirror of https://github.com/apache/cassandra
Remove all usages of junit.framework and ban them via Checkstyle
patch by Caleb Rackliffe; reviewed by Marcus Eriksson for CASSANDRA-17316 Co-authored-by: Marcus Eriksson <marcuse@apache.org>
This commit is contained in:
parent
a41040ccdc
commit
7b91e4cc18
|
|
@ -1,4 +1,5 @@
|
|||
4.1
|
||||
* Remove all usages of junit.framework and ban them via Checkstyle (CASSANDRA-17316)
|
||||
* Add guardrails for read/write consistency levels (CASSANDRA-17188)
|
||||
* Add guardrail for SELECT IN terms and their cartesian product (CASSANDRA-17187)
|
||||
* remove unused imports in cqlsh.py and cqlshlib (CASSANDRA-17413)
|
||||
|
|
|
|||
17
build.xml
17
build.xml
|
|
@ -1369,7 +1369,7 @@
|
|||
</jar>
|
||||
</target>
|
||||
|
||||
<target name="build-test" depends="_main-jar,stress-build,fqltool-build,resolver-dist-lib,simulator-jars" unless="no-build-test"
|
||||
<target name="build-test" depends="_main-jar,stress-build,fqltool-build,resolver-dist-lib,simulator-jars,checkstyle-test" unless="no-build-test"
|
||||
description="Compile test classes">
|
||||
<antcall target="_build-test"/>
|
||||
</target>
|
||||
|
|
@ -2253,6 +2253,21 @@
|
|||
</checkstyle>
|
||||
</target>
|
||||
|
||||
<target name="checkstyle-test" depends="init-checkstyle,maven-ant-tasks-retrieve-build,build-project" description="Run custom checkstyle code analysis on tests" if="java.version.8">
|
||||
<property name="checkstyle.log.dir" value="${build.dir}/checkstyle" />
|
||||
<property name="checkstyle_test.report.file" value="${checkstyle.log.dir}/checkstyle_report_test.xml"/>
|
||||
<mkdir dir="${checkstyle.log.dir}" />
|
||||
|
||||
<property name="checkstyle_test.properties" value="${basedir}/checkstyle_test.xml" />
|
||||
<property name="checkstyle.suppressions" value="${basedir}/checkstyle_suppressions.xml" />
|
||||
<checkstyle config="${checkstyle_test.properties}"
|
||||
failureProperty="checkstyle.failure"
|
||||
failOnViolation="true">
|
||||
<formatter type="plain"/>
|
||||
<formatter type="xml" tofile="${checkstyle_test.report.file}"/>
|
||||
<fileset dir="${test.dir}" includes="**/*.java"/>
|
||||
</checkstyle>
|
||||
</target>
|
||||
|
||||
<!-- Installs artifacts to local Maven repository -->
|
||||
<target name="mvn-install"
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@
|
|||
<property name="message" value="Avoid MoreExecutors.directExecutor() in favor of ImmediateExecutor.INSTANCE" />
|
||||
</module>
|
||||
<module name="IllegalImport">
|
||||
<property name="illegalPkgs" value=""/>
|
||||
<property name="illegalPkgs" value="junit.framework"/>
|
||||
<property name="illegalClasses" value="java.io.File,java.io.FileInputStream,java.io.FileOutputStream,java.io.FileReader,java.io.FileWriter,java.io.RandomAccessFile,java.util.concurrent.Semaphore,java.util.concurrent.CountDownLatch,java.util.concurrent.Executors,java.util.concurrent.LinkedBlockingQueue,java.util.concurrent.SynchronousQueue,java.util.concurrent.ArrayBlockingQueue,com.google.common.util.concurrent.Futures,java.util.concurrent.CompletableFuture,io.netty.util.concurrent.Future,io.netty.util.concurrent.Promise,io.netty.util.concurrent.AbstractFuture,com.google.common.util.concurrent.ListenableFutureTask,com.google.common.util.concurrent.ListenableFuture,com.google.common.util.concurrent.AbstractFuture"/>
|
||||
</module>
|
||||
<module name="IllegalInstantiation">
|
||||
|
|
|
|||
|
|
@ -0,0 +1,61 @@
|
|||
<?xml version="1.0"?>
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<!DOCTYPE module PUBLIC
|
||||
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
|
||||
"https://checkstyle.org/dtds/configuration_1_3.dtd">
|
||||
|
||||
<module name="Checker">
|
||||
<property name="severity" value="error"/>
|
||||
|
||||
<property name="fileExtensions" value="java, properties, xml"/>
|
||||
|
||||
<module name="BeforeExecutionExclusionFileFilter">
|
||||
<property name="fileNamePattern" value="module\-info\.java$"/>
|
||||
</module>
|
||||
|
||||
<!-- https://checkstyle.org/config_filters.html#SuppressionFilter -->
|
||||
<!-- this exists only because for some reason the comment filter does not seem to work for Semaphore -->
|
||||
<module name="SuppressionFilter">
|
||||
<property name="file" value="${checkstyle.suppressions}"
|
||||
default="checkstyle-suppressions.xml" />
|
||||
<property name="optional" value="false"/>
|
||||
</module>
|
||||
|
||||
<module name="TreeWalker">
|
||||
<module name="SuppressWithNearbyCommentFilter">
|
||||
<property name="commentFormat" value="checkstyle: permit this import"/>
|
||||
<property name="checkFormat" value="IllegalImport"/>
|
||||
<property name="influenceFormat" value="0"/>
|
||||
</module>
|
||||
|
||||
<module name="SuppressWithNearbyCommentFilter">
|
||||
<property name="commentFormat" value="checkstyle: permit this instantiation"/>
|
||||
<property name="checkFormat" value="IllegalInstantiation"/>
|
||||
<property name="influenceFormat" value="0"/>
|
||||
</module>
|
||||
|
||||
<module name="IllegalImport">
|
||||
<property name="illegalPkgs" value="junit.framework"/>
|
||||
<property name="illegalClasses" value=""/>
|
||||
</module>
|
||||
<module name="IllegalInstantiation">
|
||||
<property name="classes" value=""/>
|
||||
</module>
|
||||
</module>
|
||||
|
||||
</module>
|
||||
|
|
@ -24,8 +24,8 @@ import java.io.OutputStream;
|
|||
import java.io.StringWriter;
|
||||
import java.text.NumberFormat;
|
||||
|
||||
import junit.framework.AssertionFailedError;
|
||||
import junit.framework.Test;
|
||||
import junit.framework.AssertionFailedError; // checkstyle: permit this import
|
||||
import junit.framework.Test; // checkstyle: permit this import
|
||||
|
||||
import org.apache.tools.ant.BuildException;
|
||||
import org.apache.tools.ant.taskdefs.optional.junit.IgnoredTestListener;
|
||||
|
|
|
|||
|
|
@ -33,8 +33,8 @@ import java.util.Properties;
|
|||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
|
||||
import junit.framework.AssertionFailedError;
|
||||
import junit.framework.Test;
|
||||
import junit.framework.AssertionFailedError; // checkstyle: permit this import
|
||||
import junit.framework.Test; // checkstyle: permit this import
|
||||
|
||||
import org.apache.tools.ant.BuildException;
|
||||
import org.apache.tools.ant.taskdefs.optional.junit.IgnoredTestListener;
|
||||
|
|
|
|||
|
|
@ -19,8 +19,8 @@ package org.apache.cassandra.cql3;
|
|||
|
||||
import org.junit.Test;
|
||||
|
||||
import static junit.framework.Assert.assertEquals;
|
||||
import static junit.framework.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class NonNativeTimestampTest extends CQLTester
|
||||
|
|
|
|||
|
|
@ -17,8 +17,6 @@
|
|||
*/
|
||||
package org.apache.cassandra.cql3;
|
||||
|
||||
import static junit.framework.Assert.fail;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
|
|
@ -37,6 +35,8 @@ import org.apache.cassandra.schema.TableId;
|
|||
import org.apache.cassandra.utils.JVMStabilityInspector;
|
||||
import org.apache.cassandra.utils.KillerForTests;
|
||||
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
/**
|
||||
* Test that TombstoneOverwhelmingException gets thrown when it should be and doesn't when it shouldn't be.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ import org.apache.cassandra.service.EmbeddedCassandraService;
|
|||
import org.apache.cassandra.service.StorageService;
|
||||
import org.apache.cassandra.utils.FBUtilities;
|
||||
|
||||
import static junit.framework.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ import org.junit.Test;
|
|||
import org.junit.Assert;
|
||||
import org.apache.cassandra.cql3.CQLTester;
|
||||
|
||||
import static junit.framework.Assert.assertNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class TimestampTest extends CQLTester
|
||||
|
|
|
|||
|
|
@ -21,15 +21,15 @@ import java.math.BigInteger;
|
|||
|
||||
import org.junit.Test;
|
||||
|
||||
import static junit.framework.Assert.assertNull;
|
||||
import static org.junit.Assert.assertArrayEquals;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import org.apache.cassandra.cql3.CQLTester;
|
||||
import org.apache.cassandra.exceptions.SyntaxException;
|
||||
import org.apache.cassandra.utils.ByteBufferUtil;
|
||||
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertArrayEquals;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
/**
|
||||
* Any tests that do not fit in any other category,
|
||||
* migrated from python dtests, CASSANDRA-9160
|
||||
|
|
|
|||
|
|
@ -31,9 +31,9 @@ import org.apache.cassandra.db.ColumnFamilyStore;
|
|||
import org.apache.cassandra.db.Keyspace;
|
||||
import org.apache.cassandra.db.filter.TombstoneOverwhelmingException;
|
||||
|
||||
import static junit.framework.Assert.assertEquals;
|
||||
import static junit.framework.Assert.assertTrue;
|
||||
import static junit.framework.Assert.fail;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
/**
|
||||
* Test that TombstoneOverwhelmingException gets thrown when it should be and doesn't when it shouldn't be.
|
||||
|
|
|
|||
|
|
@ -45,10 +45,10 @@ import org.apache.cassandra.schema.TableMetadata;
|
|||
import org.apache.cassandra.utils.ByteBufferUtil;
|
||||
import org.apache.cassandra.utils.FBUtilities;
|
||||
|
||||
import static junit.framework.TestCase.assertTrue;
|
||||
import static org.apache.cassandra.utils.ByteBufferUtil.EMPTY_BYTE_BUFFER;
|
||||
import static org.apache.cassandra.utils.ByteBufferUtil.bytes;
|
||||
import static org.junit.Assert.assertArrayEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
import static org.reflections.util.Utils.isEmpty;
|
||||
|
||||
|
|
|
|||
|
|
@ -25,14 +25,14 @@ import java.util.Arrays;
|
|||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import static junit.framework.Assert.assertNull;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import org.apache.cassandra.config.DatabaseDescriptor;
|
||||
import org.apache.cassandra.cql3.CQLTester;
|
||||
import org.apache.cassandra.cql3.restrictions.StatementRestrictions;
|
||||
import org.apache.cassandra.dht.ByteOrderedPartitioner;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNull;
|
||||
|
||||
/**
|
||||
* SELECT statement tests that require a ByteOrderedPartitioner
|
||||
*/
|
||||
|
|
@ -368,7 +368,7 @@ public class SelectOrderedPartitionerTest extends CQLTester
|
|||
|
||||
Object[][] rows = getRows(execute("SELECT v2 FROM %s"));
|
||||
assertEquals(0, rows[0][0]);
|
||||
assertEquals(null, rows[1][0]);
|
||||
assertNull(rows[1][0]);
|
||||
assertEquals(2, rows[2][0]);
|
||||
|
||||
rows = getRows(execute("SELECT v2 FROM %s WHERE k = 1"));
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@ import java.util.*;
|
|||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Assume;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
|
|
@ -35,11 +34,6 @@ import org.apache.cassandra.schema.SchemaConstants;
|
|||
import org.apache.cassandra.service.snapshot.SnapshotManifest;
|
||||
import org.apache.cassandra.service.snapshot.TableSnapshot;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import com.google.common.collect.Iterators;
|
||||
import org.apache.cassandra.*;
|
||||
import org.apache.cassandra.cql3.Operator;
|
||||
|
|
@ -58,7 +52,12 @@ import org.apache.cassandra.schema.KeyspaceParams;
|
|||
import org.apache.cassandra.utils.ByteBufferUtil;
|
||||
import org.apache.cassandra.utils.FBUtilities;
|
||||
import org.apache.cassandra.utils.WrappedRunnable;
|
||||
import static junit.framework.Assert.assertNotNull;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
public class ColumnFamilyStoreTest
|
||||
{
|
||||
|
|
|
|||
|
|
@ -30,8 +30,8 @@ import org.apache.cassandra.schema.KeyspaceParams;
|
|||
import org.apache.cassandra.utils.ByteBufferUtil;
|
||||
import org.apache.cassandra.utils.FBUtilities;
|
||||
|
||||
import static junit.framework.Assert.assertFalse;
|
||||
import static junit.framework.Assert.assertTrue;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class DeletePartitionTest
|
||||
{
|
||||
|
|
|
|||
|
|
@ -64,8 +64,8 @@ import org.apache.cassandra.utils.FBUtilities;
|
|||
import org.apache.cassandra.utils.ObjectSizes;
|
||||
import org.apache.cassandra.utils.btree.BTree;
|
||||
|
||||
import static junit.framework.Assert.assertEquals;
|
||||
import static junit.framework.Assert.assertTrue;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class RowIndexEntryTest extends CQLTester
|
||||
{
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ import org.apache.cassandra.io.sstable.format.SSTableReader;
|
|||
import org.apache.cassandra.schema.MockSchema;
|
||||
import org.apache.cassandra.utils.ByteBufferUtil;
|
||||
|
||||
import static junit.framework.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
|
|
|
|||
|
|
@ -38,8 +38,8 @@ import org.apache.cassandra.db.compaction.OperationType;
|
|||
import org.apache.cassandra.io.sstable.format.SSTableReader;
|
||||
import org.apache.cassandra.schema.MockSchema;
|
||||
|
||||
import static junit.framework.Assert.assertEquals;
|
||||
import static junit.framework.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class HelpersTest
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ package org.apache.cassandra.hints;
|
|||
import java.io.IOException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Arrays;
|
||||
import java.util.zip.CRC32;
|
||||
|
||||
import org.apache.cassandra.io.util.File;
|
||||
|
|
@ -35,9 +34,10 @@ import org.apache.cassandra.io.util.SequentialWriter;
|
|||
import org.apache.cassandra.utils.ByteBufferUtil;
|
||||
import org.apache.cassandra.utils.FBUtilities;
|
||||
|
||||
import static junit.framework.Assert.assertEquals;
|
||||
import static junit.framework.Assert.assertTrue;
|
||||
import static org.junit.Assert.assertArrayEquals;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class ChecksummedDataInputTest
|
||||
{
|
||||
|
|
@ -104,12 +104,12 @@ public class ChecksummedDataInputTest
|
|||
assertEquals(127, reader.read());
|
||||
byte[] bytes = new byte[b.length];
|
||||
reader.readFully(bytes);
|
||||
assertTrue(Arrays.equals(bytes, b));
|
||||
assertEquals(false, reader.readBoolean());
|
||||
assertArrayEquals(bytes, b);
|
||||
assertFalse(reader.readBoolean());
|
||||
assertEquals(10, reader.readByte());
|
||||
assertEquals('t', reader.readChar());
|
||||
assertEquals(3.3, reader.readDouble());
|
||||
assertEquals(2.2f, reader.readFloat());
|
||||
assertEquals(3.3, reader.readDouble(), 0.0);
|
||||
assertEquals(2.2f, reader.readFloat(), 0.0);
|
||||
assertEquals(42, reader.readInt());
|
||||
assertEquals(Long.MAX_VALUE, reader.readLong());
|
||||
assertEquals(Short.MIN_VALUE, reader.readShort());
|
||||
|
|
@ -176,14 +176,14 @@ public class ChecksummedDataInputTest
|
|||
|
||||
// assert that we read all the right values back
|
||||
assertEquals(127, reader.read());
|
||||
assertEquals(false, reader.readBoolean());
|
||||
assertFalse(reader.readBoolean());
|
||||
assertEquals(10, reader.readByte());
|
||||
assertEquals('t', reader.readChar());
|
||||
assertTrue(reader.checkCrc());
|
||||
|
||||
reader.resetCrc();
|
||||
assertEquals(3.3, reader.readDouble());
|
||||
assertEquals(2.2f, reader.readFloat());
|
||||
assertEquals(3.3, reader.readDouble(), 0.0);
|
||||
assertEquals(2.2f, reader.readFloat(), 0.0);
|
||||
assertEquals(42, reader.readInt());
|
||||
assertTrue(reader.checkCrc());
|
||||
assertTrue(reader.isEOF());
|
||||
|
|
@ -232,7 +232,7 @@ public class ChecksummedDataInputTest
|
|||
|
||||
// assert that we read all the right values back
|
||||
assertEquals(127, reader.read());
|
||||
assertEquals(false, reader.readBoolean());
|
||||
assertFalse(reader.readBoolean());
|
||||
assertEquals(10, reader.readByte());
|
||||
assertEquals('t', reader.readChar());
|
||||
assertFalse(reader.checkCrc());
|
||||
|
|
|
|||
|
|
@ -52,7 +52,8 @@ import org.apache.cassandra.service.StorageProxy;
|
|||
import org.apache.cassandra.service.StorageService;
|
||||
import org.apache.cassandra.utils.FBUtilities;
|
||||
|
||||
import static junit.framework.Assert.*;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
|
||||
import static org.apache.cassandra.Util.dk;
|
||||
import static org.apache.cassandra.hints.HintsTestUtil.assertHintsEqual;
|
||||
|
|
|
|||
|
|
@ -26,12 +26,12 @@ import org.junit.runner.RunWith;
|
|||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
import static junit.framework.Assert.*;
|
||||
|
||||
import java.util.Queue;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
@RunWith(BMUnitRunner.class)
|
||||
public class HintsBufferPoolTest
|
||||
{
|
||||
|
|
|
|||
|
|
@ -45,7 +45,11 @@ import org.apache.cassandra.utils.Clock;
|
|||
import org.jboss.byteman.contrib.bmunit.BMRule;
|
||||
import org.jboss.byteman.contrib.bmunit.BMUnitRunner;
|
||||
|
||||
import static junit.framework.Assert.*;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import static org.apache.cassandra.utils.ByteBufferUtil.bytes;
|
||||
import static org.apache.cassandra.utils.FBUtilities.updateChecksum;
|
||||
|
|
|
|||
|
|
@ -34,7 +34,12 @@ import org.junit.Rule;
|
|||
import org.junit.Test;
|
||||
import org.junit.rules.TemporaryFolder;
|
||||
|
||||
import static junit.framework.Assert.*;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import static org.apache.cassandra.Util.dk;
|
||||
|
||||
public class HintsCatalogTest
|
||||
|
|
|
|||
|
|
@ -33,9 +33,9 @@ import org.apache.cassandra.io.compress.LZ4Compressor;
|
|||
import org.apache.cassandra.io.util.DataOutputBuffer;
|
||||
import org.apache.cassandra.net.MessagingService;
|
||||
|
||||
import static junit.framework.Assert.assertEquals;
|
||||
import static junit.framework.Assert.assertNotSame;
|
||||
import static junit.framework.Assert.fail;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotSame;
|
||||
import static org.junit.Assert.fail;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
public class HintsDescriptorTest
|
||||
|
|
|
|||
|
|
@ -47,8 +47,8 @@ import org.apache.cassandra.schema.Schema;
|
|||
import org.apache.cassandra.schema.SchemaTestUtil;
|
||||
import org.apache.cassandra.schema.TableMetadata;
|
||||
|
||||
import static junit.framework.Assert.assertEquals;
|
||||
import static junit.framework.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.apache.cassandra.Util.dk;
|
||||
import static org.apache.cassandra.utils.ByteBufferUtil.bytes;
|
||||
|
||||
|
|
|
|||
|
|
@ -43,8 +43,12 @@ import org.apache.cassandra.db.RowUpdateBuilder;
|
|||
import org.apache.cassandra.io.util.FileUtils;
|
||||
import org.apache.cassandra.schema.KeyspaceParams;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import static org.apache.cassandra.utils.ByteBufferUtil.bytes;
|
||||
import static junit.framework.Assert.*;
|
||||
|
||||
public class HintsStoreTest
|
||||
{
|
||||
|
|
|
|||
|
|
@ -35,8 +35,8 @@ import org.apache.cassandra.schema.TableMetadata;
|
|||
import org.apache.cassandra.service.StorageService;
|
||||
import org.apache.cassandra.utils.Clock;
|
||||
|
||||
import static junit.framework.Assert.assertEquals;
|
||||
import static junit.framework.Assert.assertTrue;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.apache.cassandra.Util.dk;
|
||||
import static org.apache.cassandra.net.MockMessagingService.verb;
|
||||
import static org.apache.cassandra.net.Verb.HINT_REQ;
|
||||
|
|
|
|||
|
|
@ -34,12 +34,13 @@ import org.apache.cassandra.io.sstable.format.SSTableReadsListener;
|
|||
import org.apache.cassandra.io.sstable.format.SSTableWriter;
|
||||
import org.apache.cassandra.utils.TimeUUID;
|
||||
|
||||
import static junit.framework.Assert.fail;
|
||||
import static org.junit.Assert.fail;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import static org.apache.cassandra.service.ActiveRepairService.NO_PENDING_REPAIR;
|
||||
import static org.apache.cassandra.service.ActiveRepairService.UNREPAIRED_SSTABLE;
|
||||
import static org.apache.cassandra.utils.TimeUUID.Generator.nextTimeUUID;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class SSTableWriterTest extends SSTableWriterTestBase
|
||||
{
|
||||
|
|
@ -95,7 +96,7 @@ public class SSTableWriterTest extends SSTableWriterTestBase
|
|||
|
||||
|
||||
@Test
|
||||
public void testAbortTxnWithClosedWriterShouldRemoveSSTable() throws InterruptedException
|
||||
public void testAbortTxnWithClosedWriterShouldRemoveSSTable()
|
||||
{
|
||||
Keyspace keyspace = Keyspace.open(KEYSPACE);
|
||||
ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(CF);
|
||||
|
|
@ -139,7 +140,7 @@ public class SSTableWriterTest extends SSTableWriterTestBase
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testAbortTxnWithClosedAndOpenWriterShouldRemoveAllSSTables() throws InterruptedException
|
||||
public void testAbortTxnWithClosedAndOpenWriterShouldRemoveAllSSTables()
|
||||
{
|
||||
Keyspace keyspace = Keyspace.open(KEYSPACE);
|
||||
ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(CF);
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ package org.apache.cassandra.io.sstable.format;
|
|||
import org.junit.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThatThrownBy;
|
||||
import static junit.framework.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class VersionAndTypeTest
|
||||
{
|
||||
|
|
|
|||
|
|
@ -37,13 +37,14 @@ import org.apache.cassandra.io.compress.CompressionMetadata;
|
|||
import org.apache.cassandra.io.sstable.metadata.MetadataCollector;
|
||||
import org.apache.cassandra.schema.CompressionParams;
|
||||
|
||||
import static junit.framework.Assert.assertNull;
|
||||
import static org.apache.cassandra.utils.Clock.Global.nanoTime;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import static org.apache.cassandra.utils.Clock.Global.nanoTime;
|
||||
|
||||
public class MmappedRegionsTest
|
||||
{
|
||||
private static final Logger logger = LoggerFactory.getLogger(MmappedRegionsTest.class);
|
||||
|
|
|
|||
|
|
@ -22,8 +22,8 @@ import java.util.concurrent.TimeUnit;
|
|||
|
||||
import org.junit.Test;
|
||||
|
||||
import static junit.framework.Assert.assertEquals;
|
||||
import static junit.framework.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
|
||||
public class LatencyMetricsTest
|
||||
{
|
||||
|
|
|
|||
|
|
@ -32,8 +32,6 @@ import com.google.common.util.concurrent.MoreExecutors;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import junit.framework.AssertionFailedError;
|
||||
|
||||
import static org.apache.cassandra.utils.concurrent.BlockingQueues.newBlockingQueue;
|
||||
|
||||
/**
|
||||
|
|
@ -233,7 +231,7 @@ public class MockMessagingSpy
|
|||
{
|
||||
T result = queue.poll(time, unit);
|
||||
if (result != null)
|
||||
setException(new AssertionFailedError("Received unexpected message: " + result));
|
||||
setException(new AssertionError("Received unexpected message: " + result));
|
||||
else
|
||||
set(true);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ import org.apache.cassandra.utils.MerkleTree;
|
|||
import org.apache.cassandra.utils.MerkleTrees;
|
||||
import org.apache.cassandra.utils.MerkleTreesTest;
|
||||
|
||||
import static junit.framework.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class DifferenceHolderTest
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ import org.apache.cassandra.dht.Murmur3Partitioner;
|
|||
import org.apache.cassandra.dht.Range;
|
||||
import org.apache.cassandra.dht.Token;
|
||||
|
||||
import static junit.framework.TestCase.assertEquals;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
|
||||
public class RangeMapTest
|
||||
|
|
|
|||
|
|
@ -44,9 +44,9 @@ import org.apache.cassandra.dht.Range;
|
|||
import org.apache.cassandra.dht.Token;
|
||||
import org.apache.cassandra.locator.InetAddressAndPort;
|
||||
|
||||
import static junit.framework.TestCase.fail;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
public class ReduceHelperTest
|
||||
{
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ import org.apache.cassandra.dht.Range;
|
|||
import org.apache.cassandra.dht.Token;
|
||||
import org.apache.cassandra.locator.InetAddressAndPort;
|
||||
|
||||
import static junit.framework.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ import org.apache.cassandra.transport.ProtocolVersion;
|
|||
import org.apache.cassandra.transport.SimpleClient;
|
||||
import org.apache.cassandra.transport.messages.QueryMessage;
|
||||
|
||||
import static junit.framework.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNull;
|
||||
|
||||
@RunWith(Parameterized.class)
|
||||
|
|
|
|||
|
|
@ -25,9 +25,9 @@ import org.apache.cassandra.cql3.*;
|
|||
import org.apache.cassandra.transport.*;
|
||||
import org.apache.cassandra.transport.messages.*;
|
||||
|
||||
import static junit.framework.Assert.assertEquals;
|
||||
import static junit.framework.Assert.assertTrue;
|
||||
import static junit.framework.Assert.fail;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
public class ProtocolBetaVersionTest extends CQLTester
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue