accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject [10/10] git commit: ACCUMULO-1452 test removing _tmp files
Date Thu, 12 Sep 2013 16:38:28 GMT
ACCUMULO-1452 test removing _tmp files


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/9190eb45
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/9190eb45
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/9190eb45

Branch: refs/heads/master
Commit: 9190eb453459ccb736d96cdca7754e2957ddd123
Parents: 2737b84
Author: Eric Newton <eric.newton@gmail.com>
Authored: Thu Sep 12 12:37:17 2013 -0400
Committer: Eric Newton <eric.newton@gmail.com>
Committed: Thu Sep 12 12:37:17 2013 -0400

----------------------------------------------------------------------
 .../accumulo/test/functional/CleanTmpIT.java    | 55 ++++++++++++++++++++
 1 file changed, 55 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/9190eb45/test/src/test/java/org/apache/accumulo/test/functional/CleanTmpIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/CleanTmpIT.java b/test/src/test/java/org/apache/accumulo/test/functional/CleanTmpIT.java
new file mode 100644
index 0000000..93b21f1
--- /dev/null
+++ b/test/src/test/java/org/apache/accumulo/test/functional/CleanTmpIT.java
@@ -0,0 +1,55 @@
+/*
+ * 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.
+ */
+package org.apache.accumulo.test.functional;
+
+import static org.junit.Assert.*;
+
+import java.io.File;
+
+import org.apache.accumulo.core.client.BatchWriter;
+import org.apache.accumulo.core.client.BatchWriterConfig;
+import org.apache.accumulo.core.client.Connector;
+import org.apache.accumulo.core.data.Mutation;
+import org.apache.accumulo.core.util.UtilWaitThread;
+import org.junit.Test;
+
+public class CleanTmpIT extends SimpleMacIT {
+  
+  @Test(timeout = 2 * 60 * 1000)
+  public void test() throws Exception {
+    Connector c = getConnector();
+    // make a table
+    String tableName = makeTableName();
+    c.tableOperations().create(tableName);
+    // write to it
+    BatchWriter bw = c.createBatchWriter(tableName, new BatchWriterConfig());
+    Mutation m = new Mutation("row");
+    m.put("cf", "cq", "value");
+    bw.addMutation(m);
+    bw.close();
+    // take it offline
+    c.tableOperations().offline(tableName);
+    
+    // create a fake _tmp file in its directory
+    String id = c.tableOperations().tableIdMap().get(tableName);
+    File tmp = File.createTempFile("junk", "_tmp", new File(getCluster().getConfig().getDir(),
"accumulo/tables/" + id + "/default_tablet"));
+    assertTrue(tmp.exists());
+    c.tableOperations().online(tableName);
+    UtilWaitThread.sleep(1000);
+    assertFalse(tmp.exists());
+  }
+}


Mime
View raw message