Return-Path: X-Original-To: apmail-accumulo-commits-archive@www.apache.org Delivered-To: apmail-accumulo-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 5F0691003F for ; Wed, 31 Jul 2013 15:13:56 +0000 (UTC) Received: (qmail 46816 invoked by uid 500); 31 Jul 2013 15:13:49 -0000 Delivered-To: apmail-accumulo-commits-archive@accumulo.apache.org Received: (qmail 46406 invoked by uid 500); 31 Jul 2013 15:13:47 -0000 Mailing-List: contact commits-help@accumulo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@accumulo.apache.org Delivered-To: mailing list commits@accumulo.apache.org Received: (qmail 45346 invoked by uid 99); 31 Jul 2013 15:13:40 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 31 Jul 2013 15:13:40 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 1B39B8316F9; Wed, 31 Jul 2013 15:13:40 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: kturner@apache.org To: commits@accumulo.apache.org Date: Wed, 31 Jul 2013 15:14:27 -0000 Message-Id: <2d4f7159733f46388540b5d50f9090c6@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [50/50] [abbrv] git commit: ACCUMULO-1565 converted clonet test to integration test. ACCUMULO-1565 converted clonet test to integration test. Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/14f8a80a Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/14f8a80a Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/14f8a80a Branch: refs/heads/master Commit: 14f8a80a84465b3d41724a7bf24544c6b0f67abe Parents: ae46532 Author: Keith Turner Authored: Wed Jul 31 11:13:08 2013 -0400 Committer: Keith Turner Committed: Wed Jul 31 11:13:08 2013 -0400 ---------------------------------------------------------------------- .../org/apache/accumulo/test/CloneTest.java | 133 ------------------- .../accumulo/test/functional/CloneTestIT.java | 112 ++++++++++++++++ 2 files changed, 112 insertions(+), 133 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/accumulo/blob/14f8a80a/test/src/test/java/org/apache/accumulo/test/CloneTest.java ---------------------------------------------------------------------- diff --git a/test/src/test/java/org/apache/accumulo/test/CloneTest.java b/test/src/test/java/org/apache/accumulo/test/CloneTest.java deleted file mode 100644 index 01affd9..0000000 --- a/test/src/test/java/org/apache/accumulo/test/CloneTest.java +++ /dev/null @@ -1,133 +0,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. - */ -package org.apache.accumulo.test; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import org.apache.accumulo.core.Constants; -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.client.Scanner; -import org.apache.accumulo.core.client.ZooKeeperInstance; -import org.apache.accumulo.core.client.security.tokens.PasswordToken; -import org.apache.accumulo.core.conf.Property; -import org.apache.accumulo.core.data.Key; -import org.apache.accumulo.core.data.Mutation; -import org.apache.accumulo.core.data.Value; -import org.apache.accumulo.minicluster.MiniAccumuloCluster; -import org.junit.After; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; -import org.junit.rules.TemporaryFolder; - -/** - * - */ -public class CloneTest { - - public static TemporaryFolder folder = new TemporaryFolder(); - private MiniAccumuloCluster accumulo; - private String secret = "secret"; - - @Before - public void setUp() throws Exception { - folder.create(); - accumulo = new MiniAccumuloCluster(folder.getRoot(), secret); - accumulo.start(); - } - - @After - public void tearDown() throws Exception { - accumulo.stop(); - folder.delete(); - } - - @Test(timeout = 120 * 1000) - public void run() throws Exception { - String table1 = "clone1"; - String table2 = "clone2"; - - ZooKeeperInstance zki = new ZooKeeperInstance(accumulo.getInstanceName(), accumulo.getZooKeepers()); - Connector c = zki.getConnector("root", new PasswordToken(secret)); - - c.tableOperations().create(table1); - - c.tableOperations().setProperty(table1, Property.TABLE_FILE_COMPRESSED_BLOCK_SIZE.getKey(), "1M"); - c.tableOperations().setProperty(table1, Property.TABLE_FILE_COMPRESSED_BLOCK_SIZE_INDEX.getKey(), "2M"); - c.tableOperations().setProperty(table1, Property.TABLE_FILE_MAX.getKey(), "23"); - - BatchWriter bw = c.createBatchWriter(table1, new BatchWriterConfig()); - - Mutation m1 = new Mutation("001"); - m1.put("data", "x", "9"); - m1.put("data", "y", "7"); - - Mutation m2 = new Mutation("008"); - m2.put("data", "x", "3"); - m2.put("data", "y", "4"); - - bw.addMutation(m1); - bw.addMutation(m2); - - bw.flush(); - - Map props = new HashMap(); - props.put(Property.TABLE_FILE_COMPRESSED_BLOCK_SIZE.getKey(), "500K"); - - Set exclude = new HashSet(); - exclude.add(Property.TABLE_FILE_MAX.getKey()); - - c.tableOperations().clone(table1, table2, true, props, exclude); - - Mutation m3 = new Mutation("009"); - m3.put("data", "x", "1"); - m3.put("data", "y", "2"); - bw.addMutation(m3); - bw.close(); - - Scanner scanner = c.createScanner(table2, Constants.NO_AUTHS); - - HashMap expected = new HashMap(); - expected.put("001:x", "9"); - expected.put("001:y", "7"); - expected.put("008:x", "3"); - expected.put("008:y", "4"); - - HashMap actual = new HashMap(); - - for (Entry entry : scanner) - actual.put(entry.getKey().getRowData().toString() + ":" + entry.getKey().getColumnQualifierData().toString(), entry.getValue().toString()); - - Assert.assertEquals(expected, actual); - - HashMap tableProps = new HashMap(); - for (Entry prop : c.tableOperations().getProperties(table2)) { - tableProps.put(prop.getKey(), prop.getValue()); - } - - Assert.assertEquals("500K", tableProps.get(Property.TABLE_FILE_COMPRESSED_BLOCK_SIZE.getKey())); - Assert.assertEquals(Property.TABLE_FILE_MAX.getDefaultValue(), tableProps.get(Property.TABLE_FILE_MAX.getKey())); - Assert.assertEquals("2M", tableProps.get(Property.TABLE_FILE_COMPRESSED_BLOCK_SIZE_INDEX.getKey())); - - } -} http://git-wip-us.apache.org/repos/asf/accumulo/blob/14f8a80a/test/src/test/java/org/apache/accumulo/test/functional/CloneTestIT.java ---------------------------------------------------------------------- diff --git a/test/src/test/java/org/apache/accumulo/test/functional/CloneTestIT.java b/test/src/test/java/org/apache/accumulo/test/functional/CloneTestIT.java new file mode 100644 index 0000000..01a32b1 --- /dev/null +++ b/test/src/test/java/org/apache/accumulo/test/functional/CloneTestIT.java @@ -0,0 +1,112 @@ +/* + * 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 java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import org.apache.accumulo.core.Constants; +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.client.Scanner; +import org.apache.accumulo.core.conf.Property; +import org.apache.accumulo.core.data.Key; +import org.apache.accumulo.core.data.Mutation; +import org.apache.accumulo.core.data.Value; +import org.junit.Assert; +import org.junit.Test; + +/** + * + */ +public class CloneTestIT extends SimpleMacIT { + + @Test(timeout = 120 * 1000) + public void run() throws Exception { + String table1 = makeTableName(); + String table2 = makeTableName(); + + Connector c = getConnector(); + + c.tableOperations().create(table1); + + c.tableOperations().setProperty(table1, Property.TABLE_FILE_COMPRESSED_BLOCK_SIZE.getKey(), "1M"); + c.tableOperations().setProperty(table1, Property.TABLE_FILE_COMPRESSED_BLOCK_SIZE_INDEX.getKey(), "2M"); + c.tableOperations().setProperty(table1, Property.TABLE_FILE_MAX.getKey(), "23"); + + BatchWriter bw = c.createBatchWriter(table1, new BatchWriterConfig()); + + Mutation m1 = new Mutation("001"); + m1.put("data", "x", "9"); + m1.put("data", "y", "7"); + + Mutation m2 = new Mutation("008"); + m2.put("data", "x", "3"); + m2.put("data", "y", "4"); + + bw.addMutation(m1); + bw.addMutation(m2); + + bw.flush(); + + Map props = new HashMap(); + props.put(Property.TABLE_FILE_COMPRESSED_BLOCK_SIZE.getKey(), "500K"); + + Set exclude = new HashSet(); + exclude.add(Property.TABLE_FILE_MAX.getKey()); + + c.tableOperations().clone(table1, table2, true, props, exclude); + + Mutation m3 = new Mutation("009"); + m3.put("data", "x", "1"); + m3.put("data", "y", "2"); + bw.addMutation(m3); + bw.close(); + + Scanner scanner = c.createScanner(table2, Constants.NO_AUTHS); + + HashMap expected = new HashMap(); + expected.put("001:x", "9"); + expected.put("001:y", "7"); + expected.put("008:x", "3"); + expected.put("008:y", "4"); + + HashMap actual = new HashMap(); + + for (Entry entry : scanner) + actual.put(entry.getKey().getRowData().toString() + ":" + entry.getKey().getColumnQualifierData().toString(), entry.getValue().toString()); + + Assert.assertEquals(expected, actual); + + HashMap tableProps = new HashMap(); + for (Entry prop : c.tableOperations().getProperties(table2)) { + tableProps.put(prop.getKey(), prop.getValue()); + } + + Assert.assertEquals("500K", tableProps.get(Property.TABLE_FILE_COMPRESSED_BLOCK_SIZE.getKey())); + Assert.assertEquals(Property.TABLE_FILE_MAX.getDefaultValue(), tableProps.get(Property.TABLE_FILE_MAX.getKey())); + Assert.assertEquals("2M", tableProps.get(Property.TABLE_FILE_COMPRESSED_BLOCK_SIZE_INDEX.getKey())); + + c.tableOperations().delete(table1); + c.tableOperations().delete(table2); + + } +}