mirror of https://github.com/apache/cassandra
Fix failing DeleteTest
patch by Robert Stupp; reviewed by Aleksey Yeschenko for CASSANDRA-10656
This commit is contained in:
parent
9940892c3c
commit
5289a564cf
|
|
@ -17,27 +17,17 @@
|
|||
*/
|
||||
package org.apache.cassandra.cql3;
|
||||
|
||||
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.Assert;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.datastax.driver.core.Cluster;
|
||||
import com.datastax.driver.core.ConsistencyLevel;
|
||||
import com.datastax.driver.core.PreparedStatement;
|
||||
import com.datastax.driver.core.ResultSetFuture;
|
||||
import com.datastax.driver.core.Session;
|
||||
import org.apache.cassandra.SchemaLoader;
|
||||
import org.apache.cassandra.config.DatabaseDescriptor;
|
||||
import org.apache.cassandra.config.Schema;
|
||||
import org.apache.cassandra.service.EmbeddedCassandraService;
|
||||
|
||||
public class DeleteTest extends SchemaLoader
|
||||
public class DeleteTest extends CQLTester
|
||||
{
|
||||
private static EmbeddedCassandraService cassandra;
|
||||
|
||||
private static Cluster cluster;
|
||||
private static Session session;
|
||||
private static PreparedStatement pstmtI;
|
||||
private static PreparedStatement pstmtU;
|
||||
private static PreparedStatement pstmtD;
|
||||
|
|
@ -47,16 +37,13 @@ public class DeleteTest extends SchemaLoader
|
|||
private static PreparedStatement pstmt4;
|
||||
private static PreparedStatement pstmt5;
|
||||
|
||||
@BeforeClass
|
||||
public static void setup() throws Exception
|
||||
@Before
|
||||
public void prepare() throws Exception
|
||||
{
|
||||
Schema.instance.clear();
|
||||
// Schema.instance.clear();
|
||||
|
||||
cassandra = new EmbeddedCassandraService();
|
||||
cassandra.start();
|
||||
|
||||
cluster = Cluster.builder().addContactPoint("127.0.0.1").withPort(DatabaseDescriptor.getNativeTransportPort()).build();
|
||||
session = cluster.connect();
|
||||
Session session = sessionNet();
|
||||
session.getCluster().getConfiguration().getQueryOptions().setConsistencyLevel(ConsistencyLevel.ONE);
|
||||
|
||||
session.execute("drop keyspace if exists junit;");
|
||||
session.execute("create keyspace junit WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 2 };");
|
||||
|
|
@ -106,15 +93,10 @@ public class DeleteTest extends SchemaLoader
|
|||
pstmt5 = session.prepare("select id, cid, inh_c, val from junit.tpc_inherit_c where id=? and cid=?");
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void tearDown() throws Exception
|
||||
{
|
||||
cluster.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void lostDeletesTest()
|
||||
{
|
||||
Session session = sessionNet();
|
||||
|
||||
for (int i = 0; i < 500; i++)
|
||||
{
|
||||
|
|
@ -151,6 +133,8 @@ public class DeleteTest extends SchemaLoader
|
|||
}
|
||||
|
||||
private ResultSetFuture[] load() {
|
||||
Session session = sessionNet();
|
||||
|
||||
return new ResultSetFuture[]{
|
||||
session.executeAsync(pstmt1.bind(1, 1)),
|
||||
session.executeAsync(pstmt2.bind(1, 1)),
|
||||
|
|
|
|||
Loading…
Reference in New Issue