cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sn...@apache.org
Subject [1/2] cassandra git commit: Fix failing DeleteTest
Date Thu, 05 Nov 2015 17:44:03 GMT
Repository: cassandra
Updated Branches:
  refs/heads/trunk c42fcf570 -> a38f362a0


Fix failing DeleteTest

patch by Robert Stupp; reviewed by Aleksey Yeschenko for CASSANDRA-10656


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/5289a564
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/5289a564
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/5289a564

Branch: refs/heads/trunk
Commit: 5289a564cf929fe2ca9e8a37e1b8df53f2be0c6e
Parents: 9940892
Author: Robert Stupp <snazy@snazy.de>
Authored: Thu Nov 5 18:42:02 2015 +0100
Committer: Robert Stupp <snazy@snazy.de>
Committed: Thu Nov 5 18:42:02 2015 +0100

----------------------------------------------------------------------
 .../org/apache/cassandra/cql3/DeleteTest.java   | 38 ++++++--------------
 1 file changed, 11 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/5289a564/test/unit/org/apache/cassandra/cql3/DeleteTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/cql3/DeleteTest.java b/test/unit/org/apache/cassandra/cql3/DeleteTest.java
index 0b88586..3c95a6c 100644
--- a/test/unit/org/apache/cassandra/cql3/DeleteTest.java
+++ b/test/unit/org/apache/cassandra/cql3/DeleteTest.java
@@ -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)),


Mime
View raw message