Return-Path: X-Original-To: apmail-cassandra-commits-archive@www.apache.org Delivered-To: apmail-cassandra-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 6C9FC9A02 for ; Mon, 27 Feb 2012 10:32:05 +0000 (UTC) Received: (qmail 24763 invoked by uid 500); 27 Feb 2012 10:32:05 -0000 Delivered-To: apmail-cassandra-commits-archive@cassandra.apache.org Received: (qmail 24717 invoked by uid 500); 27 Feb 2012 10:32:05 -0000 Mailing-List: contact commits-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cassandra.apache.org Delivered-To: mailing list commits@cassandra.apache.org Received: (qmail 24698 invoked by uid 99); 27 Feb 2012 10:32:05 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 27 Feb 2012 10:32:05 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.114] (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 27 Feb 2012 10:32:01 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id EB62A81331E; Mon, 27 Feb 2012 10:31:17 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: slebresne@apache.org To: commits@cassandra.apache.org X-Mailer: ASF-Git Admin Mailer Subject: [12/14] [3649] Strip end of line whitespaces Message-Id: <20120227103117.EB62A81331E@tyr.zones.apache.org> Date: Mon, 27 Feb 2012 10:31:17 +0000 (UTC) http://git-wip-us.apache.org/repos/asf/cassandra/blob/07cdfd07/test/unit/org/apache/cassandra/db/DefsTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/db/DefsTest.java b/test/unit/org/apache/cassandra/db/DefsTest.java index 9bfa82c..6fb8a01 100644 --- a/test/unit/org/apache/cassandra/db/DefsTest.java +++ b/test/unit/org/apache/cassandra/db/DefsTest.java @@ -71,17 +71,17 @@ public class DefsTest extends CleanupHelper @Test public void ensureStaticCFMIdsAreLessThan1000() { - assert CFMetaData.StatusCf.cfId == 0; - assert CFMetaData.HintsCf.cfId == 1; - assert CFMetaData.MigrationsCf.cfId == 2; - assert CFMetaData.SchemaCf.cfId == 3; + assert CFMetaData.StatusCf.cfId == 0; + assert CFMetaData.HintsCf.cfId == 1; + assert CFMetaData.MigrationsCf.cfId == 2; + assert CFMetaData.SchemaCf.cfId == 3; } - + @Test public void testCFMetaDataApply() throws ConfigurationException { Map indexes = new HashMap(); - for (int i = 0; i < 5; i++) + for (int i = 0; i < 5; i++) { ByteBuffer name = ByteBuffer.wrap(new byte[] { (byte)i }); indexes.put(name, new ColumnDefinition(name, BytesType.instance, IndexType.KEYS, null, Integer.toString(i))); @@ -104,7 +104,7 @@ public class DefsTest extends CleanupHelper // we'll be adding this one later. make sure it's not already there. assert cfm.getColumn_metadata().get(ByteBuffer.wrap(new byte[] { 5 })) == null; CfDef cfDef = cfm.toThrift(); - + // add one. ColumnDef addIndexDef = new ColumnDef(); addIndexDef.index_name = "5"; @@ -112,7 +112,7 @@ public class DefsTest extends CleanupHelper addIndexDef.name = ByteBuffer.wrap(new byte[] { 5 }); addIndexDef.validation_class = BytesType.class.getName(); cfDef.column_metadata.add(addIndexDef); - + // remove one. ColumnDef removeIndexDef = new ColumnDef(); removeIndexDef.index_name = "0"; @@ -120,22 +120,22 @@ public class DefsTest extends CleanupHelper removeIndexDef.name = ByteBuffer.wrap(new byte[] { 0 }); removeIndexDef.validation_class = BytesType.class.getName(); assert cfDef.column_metadata.remove(removeIndexDef); - + cfm.apply(cfDef); - + for (int i = 1; i < indexes.size(); i++) assert cfm.getColumn_metadata().get(ByteBuffer.wrap(new byte[] { 1 })) != null; assert cfm.getColumn_metadata().get(ByteBuffer.wrap(new byte[] { 0 })) == null; assert cfm.getColumn_metadata().get(ByteBuffer.wrap(new byte[] { 5 })) != null; } - + @Test public void testInvalidNames() throws IOException { String[] valid = {"1", "a", "_1", "b_", "__", "1_a"}; for (String s : valid) assert Migration.isLegalName(s); - + String[] invalid = {"b@t", "dash-y", "", " ", "dot.s", ".hidden"}; for (String s : invalid) assert !Migration.isLegalName(s); @@ -177,7 +177,7 @@ public class DefsTest extends CleanupHelper throw new AssertionError("Unexpected exception."); } } - + @Test public void addNewCfWithNullComment() throws ConfigurationException, IOException, ExecutionException, InterruptedException { @@ -217,7 +217,7 @@ public class DefsTest extends CleanupHelper ColumnFamilyStore store = Table.open(ks).getColumnFamilyStore(cf); assert store != null; store.forceBlockingFlush(); - + ColumnFamily cfam = store.getColumnFamily(QueryFilter.getNamesFilter(dk, new QueryPath(cf), ByteBufferUtil.bytes("col0"))); assert cfam.getColumn(ByteBufferUtil.bytes("col0")) != null; IColumn col = cfam.getColumn(ByteBufferUtil.bytes("col0")); @@ -233,7 +233,7 @@ public class DefsTest extends CleanupHelper assert ks != null; final CFMetaData cfm = ks.cfMetaData().get("Standard1"); assert cfm != null; - + // write some data, force a flush, then verify that files exist on disk. RowMutation rm = new RowMutation(ks.name, dk.key); for (int i = 0; i < 100; i++) @@ -244,11 +244,11 @@ public class DefsTest extends CleanupHelper store.forceBlockingFlush(); store.getFlushPath(1024, Descriptor.CURRENT_VERSION); assert store.directories.sstableLister().list().size() > 0; - + new DropColumnFamily(ks.name, cfm.cfName).apply(); assert !Schema.instance.getTableDefinition(ks.name).cfMetaData().containsKey(cfm.cfName); - + // any write should fail. rm = new RowMutation(ks.name, dk.key); boolean success = true; @@ -278,7 +278,7 @@ public class DefsTest extends CleanupHelper CFMetaData newCf = addTestCF("NewKeyspace1", "AddedStandard1", "A new cf for a new ks"); KSMetaData newKs = KSMetaData.testMetadata(newCf.ksName, SimpleStrategy.class, KSMetaData.optsWithRF(5), newCf); - + new AddKeyspace(newKs).apply(); assert Schema.instance.getTableDefinition(newCf.ksName) != null; @@ -291,13 +291,13 @@ public class DefsTest extends CleanupHelper ColumnFamilyStore store = Table.open(newCf.ksName).getColumnFamilyStore(newCf.cfName); assert store != null; store.forceBlockingFlush(); - + ColumnFamily cfam = store.getColumnFamily(QueryFilter.getNamesFilter(dk, new QueryPath(newCf.cfName), ByteBufferUtil.bytes("col0"))); assert cfam.getColumn(ByteBufferUtil.bytes("col0")) != null; IColumn col = cfam.getColumn(ByteBufferUtil.bytes("col0")); assert ByteBufferUtil.bytes("value0").equals(col.value()); } - + @Test public void dropKS() throws ConfigurationException, IOException, ExecutionException, InterruptedException { @@ -317,11 +317,11 @@ public class DefsTest extends CleanupHelper assert store != null; store.forceBlockingFlush(); assert store.directories.sstableLister().list().size() > 0; - + new DropKeyspace(ks.name).apply(); assert Schema.instance.getTableDefinition(ks.name) == null; - + // write should fail. rm = new RowMutation(ks.name, dk.key); boolean success = true; @@ -374,7 +374,7 @@ public class DefsTest extends CleanupHelper public void createEmptyKsAddNewCf() throws ConfigurationException, IOException, ExecutionException, InterruptedException { assert Schema.instance.getTableDefinition("EmptyKeyspace") == null; - + KSMetaData newKs = KSMetaData.testMetadata("EmptyKeyspace", SimpleStrategy.class, KSMetaData.optsWithRF(5)); new AddKeyspace(newKs).apply(); @@ -405,19 +405,19 @@ public class DefsTest extends CleanupHelper IColumn col = cfam.getColumn(ByteBufferUtil.bytes("col0")); assert ByteBufferUtil.bytes("value0").equals(col.value()); } - + @Test public void testUpdateKeyspace() throws ConfigurationException, IOException, ExecutionException, InterruptedException { // create a keyspace to serve as existing. CFMetaData cf = addTestCF("UpdatedKeyspace", "AddedStandard1", "A new cf for a new ks"); KSMetaData oldKs = KSMetaData.testMetadata(cf.ksName, SimpleStrategy.class, KSMetaData.optsWithRF(5), cf); - + new AddKeyspace(oldKs).apply(); assert Schema.instance.getTableDefinition(cf.ksName) != null; assert Schema.instance.getTableDefinition(cf.ksName) == oldKs; - + // anything with cf defs should fail. CFMetaData cf2 = addTestCF(cf.ksName, "AddedStandard2", "A new cf for a new ks"); KSMetaData newBadKs = KSMetaData.testMetadata(cf.ksName, SimpleStrategy.class, KSMetaData.optsWithRF(4), cf2); @@ -430,7 +430,7 @@ public class DefsTest extends CleanupHelper { // expected. } - + // names should match. KSMetaData newBadKs2 = KSMetaData.testMetadata(cf.ksName + "trash", SimpleStrategy.class, KSMetaData.optsWithRF(4)); try @@ -442,7 +442,7 @@ public class DefsTest extends CleanupHelper { // expected. } - + KSMetaData newKs = KSMetaData.testMetadata(cf.ksName, OldNetworkTopologyStrategy.class, KSMetaData.optsWithRF(1)); new UpdateKeyspace(newKs.toThrift()).apply(); @@ -462,24 +462,24 @@ public class DefsTest extends CleanupHelper assert Schema.instance.getTableDefinition(cf.ksName) != null; assert Schema.instance.getTableDefinition(cf.ksName) == ksm; assert Schema.instance.getCFMetaData(cf.ksName, cf.cfName) != null; - + // updating certain fields should fail. CfDef cf_def = cf.toThrift(); cf_def.column_metadata = new ArrayList(); cf_def.default_validation_class ="BytesType"; cf_def.min_compaction_threshold = 5; cf_def.max_compaction_threshold = 31; - + // test valid operations. cf_def.comment = "Modified comment"; new UpdateColumnFamily(cf_def).apply(); // doesn't get set back here. cf_def.read_repair_chance = 0.23; new UpdateColumnFamily(cf_def).apply(); - + cf_def.gc_grace_seconds = 12; new UpdateColumnFamily(cf_def).apply(); - + cf_def.default_validation_class = "UTF8Type"; new UpdateColumnFamily(cf_def).apply(); @@ -490,13 +490,13 @@ public class DefsTest extends CleanupHelper new UpdateColumnFamily(cf_def).apply(); // can't test changing the reconciler because there is only one impl. - + // check the cumulative affect. assert Schema.instance.getCFMetaData(cf.ksName, cf.cfName).getComment().equals(cf_def.comment); assert Schema.instance.getCFMetaData(cf.ksName, cf.cfName).getReadRepairChance() == cf_def.read_repair_chance; assert Schema.instance.getCFMetaData(cf.ksName, cf.cfName).getGcGraceSeconds() == cf_def.gc_grace_seconds; assert Schema.instance.getCFMetaData(cf.ksName, cf.cfName).getDefaultValidator() == UTF8Type.instance; - + // todo: we probably don't need to reset old values in the catches anymore. // make sure some invalid operations fail. int oldId = cf_def.id; @@ -506,11 +506,11 @@ public class DefsTest extends CleanupHelper cf.apply(cf_def); throw new AssertionError("Should have blown up when you used a different id."); } - catch (ConfigurationException expected) + catch (ConfigurationException expected) { - cf_def.id = oldId; + cf_def.id = oldId; } - + String oldStr = cf_def.name; try { @@ -522,7 +522,7 @@ public class DefsTest extends CleanupHelper { cf_def.name = oldStr; } - + oldStr = cf_def.keyspace; try { @@ -534,7 +534,7 @@ public class DefsTest extends CleanupHelper { cf_def.keyspace = oldStr; } - + try { cf_def.column_type = ColumnFamilyType.Super.name(); @@ -545,9 +545,9 @@ public class DefsTest extends CleanupHelper { cf_def.column_type = ColumnFamilyType.Standard.name(); } - + oldStr = cf_def.comparator_type; - try + try { cf_def.comparator_type = TimeUUIDType.class.getSimpleName(); cf.apply(cf_def); http://git-wip-us.apache.org/repos/asf/cassandra/blob/07cdfd07/test/unit/org/apache/cassandra/db/KeyCacheTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/db/KeyCacheTest.java b/test/unit/org/apache/cassandra/db/KeyCacheTest.java index c59ce76..7af7094 100644 --- a/test/unit/org/apache/cassandra/db/KeyCacheTest.java +++ b/test/unit/org/apache/cassandra/db/KeyCacheTest.java @@ -1,6 +1,6 @@ package org.apache.cassandra.db; /* - * + * * 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 @@ -8,16 +8,16 @@ package org.apache.cassandra.db; * 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. - * + * */ import java.io.IOException; http://git-wip-us.apache.org/repos/asf/cassandra/blob/07cdfd07/test/unit/org/apache/cassandra/db/MultitableTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/db/MultitableTest.java b/test/unit/org/apache/cassandra/db/MultitableTest.java index 40bba6e..f7967b8 100644 --- a/test/unit/org/apache/cassandra/db/MultitableTest.java +++ b/test/unit/org/apache/cassandra/db/MultitableTest.java @@ -1,6 +1,6 @@ package org.apache.cassandra.db; /* - * + * * 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 @@ -8,16 +8,16 @@ package org.apache.cassandra.db; * 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. - * + * */ http://git-wip-us.apache.org/repos/asf/cassandra/blob/07cdfd07/test/unit/org/apache/cassandra/db/ReadMessageTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/db/ReadMessageTest.java b/test/unit/org/apache/cassandra/db/ReadMessageTest.java index d5b1066..27df3d0 100644 --- a/test/unit/org/apache/cassandra/db/ReadMessageTest.java +++ b/test/unit/org/apache/cassandra/db/ReadMessageTest.java @@ -44,10 +44,10 @@ public class ReadMessageTest extends SchemaLoader ArrayList colList = new ArrayList(); colList.add(ByteBufferUtil.bytes("col1")); colList.add(ByteBufferUtil.bytes("col2")); - + ReadCommand rm, rm2; DecoratedKey dk = Util.dk("row1"); - + rm = new SliceByNamesReadCommand("Keyspace1", dk.key, new QueryPath("Standard1"), colList); rm2 = serializeAndDeserializeReadMessage(rm); assert rm2.toString().equals(rm.toString()); @@ -55,7 +55,7 @@ public class ReadMessageTest extends SchemaLoader rm = new SliceFromReadCommand("Keyspace1", dk.key, new QueryPath("Standard1"), ByteBufferUtil.EMPTY_BYTE_BUFFER, ByteBufferUtil.EMPTY_BYTE_BUFFER, true, 2); rm2 = serializeAndDeserializeReadMessage(rm); assert rm2.toString().equals(rm.toString()); - + rm = new SliceFromReadCommand("Keyspace1", dk.key, new QueryPath("Standard1"), ByteBufferUtil.bytes("a"), ByteBufferUtil.bytes("z"), true, 5); rm2 = serializeAndDeserializeReadMessage(rm); assertEquals(rm2.toString(), rm.toString()); @@ -79,7 +79,7 @@ public class ReadMessageTest extends SchemaLoader bis = new ByteArrayInputStream(dos.getData(), 0, dos.getLength()); return rms.deserialize(new DataInputStream(bis), MessagingService.version_); } - + @Test public void testGetColumn() throws IOException, ColumnFamilyNotDefinedException { @@ -97,43 +97,43 @@ public class ReadMessageTest extends SchemaLoader IColumn col = row.cf.getColumn(ByteBufferUtil.bytes("Column1")); assertEquals(col.value(), ByteBuffer.wrap("abcd".getBytes())); } - - @Test + + @Test public void testNoCommitLog() throws Exception { - + RowMutation rm = new RowMutation("Keyspace1", ByteBufferUtil.bytes("row")); rm.add(new QueryPath("Standard1", null, ByteBufferUtil.bytes("commit1")), ByteBufferUtil.bytes("abcd"), 0); rm.apply(); - + rm = new RowMutation("NoCommitlogSpace", ByteBufferUtil.bytes("row")); rm.add(new QueryPath("Standard1", null, ByteBufferUtil.bytes("commit2")), ByteBufferUtil.bytes("abcd"), 0); rm.apply(); - + boolean commitLogMessageFound = false; boolean noCommitLogMessageFound = false; - + File commitLogDir = new File(DatabaseDescriptor.getCommitLogLocation()); - + for(String filename : commitLogDir.list()) { BufferedReader f = new BufferedReader(new FileReader(commitLogDir.getAbsolutePath()+File.separator+filename)); - + String line = null; while( (line = f.readLine()) != null) { if(line.contains("commit1")) commitLogMessageFound = true; - + if(line.contains("commit2")) noCommitLogMessageFound = true; } - + f.close(); } - + assertTrue(commitLogMessageFound); - assertFalse(noCommitLogMessageFound); + assertFalse(noCommitLogMessageFound); } - + } http://git-wip-us.apache.org/repos/asf/cassandra/blob/07cdfd07/test/unit/org/apache/cassandra/db/RecoveryManager2Test.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/db/RecoveryManager2Test.java b/test/unit/org/apache/cassandra/db/RecoveryManager2Test.java index b1a7900..0a50544 100644 --- a/test/unit/org/apache/cassandra/db/RecoveryManager2Test.java +++ b/test/unit/org/apache/cassandra/db/RecoveryManager2Test.java @@ -1,6 +1,6 @@ package org.apache.cassandra.db; /* - * + * * 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 @@ -8,16 +8,16 @@ package org.apache.cassandra.db; * 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. - * + * */ http://git-wip-us.apache.org/repos/asf/cassandra/blob/07cdfd07/test/unit/org/apache/cassandra/db/RecoveryManager3Test.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/db/RecoveryManager3Test.java b/test/unit/org/apache/cassandra/db/RecoveryManager3Test.java index fea4e59..13e041d 100644 --- a/test/unit/org/apache/cassandra/db/RecoveryManager3Test.java +++ b/test/unit/org/apache/cassandra/db/RecoveryManager3Test.java @@ -1,6 +1,6 @@ package org.apache.cassandra.db; /* - * + * * 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 @@ -8,16 +8,16 @@ package org.apache.cassandra.db; * 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. - * + * */ http://git-wip-us.apache.org/repos/asf/cassandra/blob/07cdfd07/test/unit/org/apache/cassandra/db/ScrubTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/db/ScrubTest.java b/test/unit/org/apache/cassandra/db/ScrubTest.java index be668de..e7529d7 100644 --- a/test/unit/org/apache/cassandra/db/ScrubTest.java +++ b/test/unit/org/apache/cassandra/db/ScrubTest.java @@ -1,6 +1,6 @@ package org.apache.cassandra.db; /* - * + * * 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 @@ -8,16 +8,16 @@ package org.apache.cassandra.db; * 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. - * + * */ @@ -50,16 +50,16 @@ public class ScrubTest extends CleanupHelper public String CF3 = "Standard2"; public String corruptSSTableName; - - public void copySSTables() throws IOException + + public void copySSTables() throws IOException { String root = System.getProperty("corrupt-sstable-root"); assert root != null; File rootDir = new File(root); assert rootDir.isDirectory(); - + File destDir = Directories.create(TABLE, CF2).getDirectoryForNewSSTables(1); - + FileUtils.createDirectory(destDir); for (File srcFile : rootDir.listFiles()) { @@ -69,23 +69,23 @@ public class ScrubTest extends CleanupHelper CLibrary.createHardLink(srcFile, destFile); assert destFile.exists() : destFile.getAbsoluteFile(); - + if(destFile.getName().endsWith("Data.db")) corruptSSTableName = destFile.getCanonicalPath(); - } + } assert corruptSSTableName != null; } - + @Test public void testScrubFile() throws Exception - { + { copySSTables(); Table table = Table.open(TABLE); ColumnFamilyStore cfs = table.getColumnFamilyStore(CF2); assert cfs.getSSTables().size() > 0; - + List rows; boolean caught = false; try @@ -98,13 +98,13 @@ public class ScrubTest extends CleanupHelper caught = true; } assert caught : "'corrupt' test file actually was not"; - + CompactionManager.instance.performScrub(cfs); rows = cfs.getRangeSlice(ByteBufferUtil.bytes("1"), Util.range("", ""), 1000, new IdentityQueryFilter(), null); assertEquals(100, rows.size()); } - - + + @Test public void testScrubOneRow() throws IOException, ExecutionException, InterruptedException, ConfigurationException { @@ -165,7 +165,7 @@ public class ScrubTest extends CleanupHelper rows = cfs.getRangeSlice(null, Util.range("", ""), 1000, new IdentityQueryFilter(), null); assertEquals(10, rows.size()); } - + protected void fillCF(ColumnFamilyStore cfs, int rowsPerSSTable) throws ExecutionException, InterruptedException, IOException { for (int i = 0; i < rowsPerSSTable; i++) @@ -184,7 +184,7 @@ public class ScrubTest extends CleanupHelper cfs.forceBlockingFlush(); } - - - + + + } http://git-wip-us.apache.org/repos/asf/cassandra/blob/07cdfd07/test/unit/org/apache/cassandra/db/SerializationsTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/db/SerializationsTest.java b/test/unit/org/apache/cassandra/db/SerializationsTest.java index 1fa03d8..73a95dd 100644 --- a/test/unit/org/apache/cassandra/db/SerializationsTest.java +++ b/test/unit/org/apache/cassandra/db/SerializationsTest.java @@ -1,6 +1,6 @@ package org.apache.cassandra.db; /* - * + * * 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 @@ -8,16 +8,16 @@ package org.apache.cassandra.db; * 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. - * + * */ @@ -59,7 +59,7 @@ public class SerializationsTest extends AbstractSerializationsTester ByteBuffer emptyCol = ByteBufferUtil.bytes(""); SlicePredicate namesPred = new SlicePredicate(); namesPred.column_names = Statics.NamedCols; - SliceRange emptySliceRange = new SliceRange(emptyCol, emptyCol, false, 100); + SliceRange emptySliceRange = new SliceRange(emptyCol, emptyCol, false, 100); SliceRange nonEmptySliceRange = new SliceRange(startCol, stopCol, true, 100); SlicePredicate emptyRangePred = new SlicePredicate(); emptyRangePred.slice_range = emptySliceRange; @@ -67,16 +67,16 @@ public class SerializationsTest extends AbstractSerializationsTester nonEmptyRangePred.slice_range = nonEmptySliceRange; IPartitioner part = StorageService.getPartitioner(); AbstractBounds bounds = new Range(part.getRandomToken(), part.getRandomToken()).toRowBounds(); - + Message namesCmd = new RangeSliceCommand(Statics.KS, "Standard1", null, namesPred, bounds, 100).getMessage(MessagingService.version_); Message emptyRangeCmd = new RangeSliceCommand(Statics.KS, "Standard1", null, emptyRangePred, bounds, 100).getMessage(MessagingService.version_); Message regRangeCmd = new RangeSliceCommand(Statics.KS, "Standard1", null, nonEmptyRangePred, bounds, 100).getMessage(MessagingService.version_); Message namesCmdSup = new RangeSliceCommand(Statics.KS, "Super1", Statics.SC, namesPred, bounds, 100).getMessage(MessagingService.version_); Message emptyRangeCmdSup = new RangeSliceCommand(Statics.KS, "Super1", Statics.SC, emptyRangePred, bounds, 100).getMessage(MessagingService.version_); Message regRangeCmdSup = new RangeSliceCommand(Statics.KS, "Super1", Statics.SC, nonEmptyRangePred, bounds, 100).getMessage(MessagingService.version_); - + DataOutputStream dout = getOutput("db.RangeSliceCommand.bin"); - + messageSerializer.serialize(namesCmd, dout, getVersion()); messageSerializer.serialize(emptyRangeCmd, dout, getVersion()); messageSerializer.serialize(regRangeCmd, dout, getVersion()); @@ -85,13 +85,13 @@ public class SerializationsTest extends AbstractSerializationsTester messageSerializer.serialize(regRangeCmdSup, dout, getVersion()); dout.close(); } - + @Test public void testRangeSliceCommandRead() throws IOException { if (EXECUTE_WRITES) testRangeSliceCommandWrite(); - + DataInputStream in = getInput("db.RangeSliceCommand.bin"); for (int i = 0; i < 6; i++) { @@ -100,12 +100,12 @@ public class SerializationsTest extends AbstractSerializationsTester } in.close(); } - + private void testSliceByNamesReadCommandWrite() throws IOException { SliceByNamesReadCommand standardCmd = new SliceByNamesReadCommand(Statics.KS, Statics.Key, Statics.StandardPath, Statics.NamedCols); SliceByNamesReadCommand superCmd = new SliceByNamesReadCommand(Statics.KS, Statics.Key, Statics.SuperPath, Statics.NamedCols); - + DataOutputStream out = getOutput("db.SliceByNamesReadCommand.bin"); SliceByNamesReadCommand.serializer().serialize(standardCmd, out, getVersion()); SliceByNamesReadCommand.serializer().serialize(superCmd, out, getVersion()); @@ -115,13 +115,13 @@ public class SerializationsTest extends AbstractSerializationsTester messageSerializer.serialize(superCmd.getMessage(getVersion()), out, getVersion()); out.close(); } - - @Test + + @Test public void testSliceByNamesReadCommandRead() throws IOException { if (EXECUTE_WRITES) testSliceByNamesReadCommandWrite(); - + DataInputStream in = getInput("db.SliceByNamesReadCommand.bin"); assert SliceByNamesReadCommand.serializer().deserialize(in, getVersion()) != null; assert SliceByNamesReadCommand.serializer().deserialize(in, getVersion()) != null; @@ -131,7 +131,7 @@ public class SerializationsTest extends AbstractSerializationsTester assert messageSerializer.deserialize(in, getVersion()) != null; in.close(); } - + private void testSliceFromReadCommandWrite() throws IOException { SliceFromReadCommand standardCmd = new SliceFromReadCommand(Statics.KS, Statics.Key, Statics.StandardPath, Statics.Start, Statics.Stop, true, 100); @@ -145,13 +145,13 @@ public class SerializationsTest extends AbstractSerializationsTester messageSerializer.serialize(superCmd.getMessage(getVersion()), out, getVersion()); out.close(); } - + @Test public void testSliceFromReadCommandRead() throws IOException { if (EXECUTE_WRITES) testSliceFromReadCommandWrite(); - + DataInputStream in = getInput("db.SliceFromReadCommand.bin"); assert SliceFromReadCommand.serializer().deserialize(in, getVersion()) != null; assert SliceFromReadCommand.serializer().deserialize(in, getVersion()) != null; @@ -161,7 +161,7 @@ public class SerializationsTest extends AbstractSerializationsTester assert messageSerializer.deserialize(in, getVersion()) != null; in.close(); } - + private void testRowWrite() throws IOException { DataOutputStream out = getOutput("db.Row.bin"); @@ -170,20 +170,20 @@ public class SerializationsTest extends AbstractSerializationsTester Row.serializer().serialize(Statics.NullRow, out, getVersion()); out.close(); } - + @Test public void testRowRead() throws IOException { if (EXECUTE_WRITES) testRowWrite(); - + DataInputStream in = getInput("db.Row.bin"); assert Row.serializer().deserialize(in, getVersion()) != null; assert Row.serializer().deserialize(in, getVersion()) != null; assert Row.serializer().deserialize(in, getVersion()) != null; in.close(); } - + private void restRowMutationWrite() throws IOException { RowMutation emptyRm = new RowMutation(Statics.KS, Statics.Key); @@ -197,7 +197,7 @@ public class SerializationsTest extends AbstractSerializationsTester mods.put(Statics.StandardCf.metadata().cfId, Statics.StandardCf); mods.put(Statics.SuperCf.metadata().cfId, Statics.SuperCf); RowMutation mixedRm = new RowMutation(Statics.KS, Statics.Key, mods); - + DataOutputStream out = getOutput("db.RowMutation.bin"); RowMutation.serializer().serialize(emptyRm, out, getVersion()); RowMutation.serializer().serialize(standardRowRm, out, getVersion()); @@ -211,15 +211,15 @@ public class SerializationsTest extends AbstractSerializationsTester messageSerializer.serialize(standardRm.getMessage(getVersion()), out, getVersion()); messageSerializer.serialize(superRm.getMessage(getVersion()), out, getVersion()); messageSerializer.serialize(mixedRm.getMessage(getVersion()), out, getVersion()); - out.close(); + out.close(); } - + @Test public void testRowMutationRead() throws IOException { if (EXECUTE_WRITES) restRowMutationWrite(); - + DataInputStream in = getInput("db.RowMutation.bin"); assert RowMutation.serializer().deserialize(in, getVersion()) != null; assert RowMutation.serializer().deserialize(in, getVersion()) != null; @@ -235,7 +235,7 @@ public class SerializationsTest extends AbstractSerializationsTester assert messageSerializer.deserialize(in, getVersion()) != null; in.close(); } - + public void testTruncateWrite() throws IOException { Truncation tr = new Truncation(Statics.KS, "Doesn't Really Matter"); @@ -251,13 +251,13 @@ public class SerializationsTest extends AbstractSerializationsTester // todo: notice how CF names weren't validated. out.close(); } - + @Test public void testTruncateRead() throws IOException { if (EXECUTE_WRITES) testTruncateWrite(); - + DataInputStream in = getInput("db.Truncation.bin"); assert Truncation.serializer().deserialize(in, getVersion()) != null; assert TruncateResponse.serializer().deserialize(in, getVersion()) != null; @@ -267,7 +267,7 @@ public class SerializationsTest extends AbstractSerializationsTester assert messageSerializer.deserialize(in, getVersion()) != null; in.close(); } - + private void testWriteResponseWrite() throws IOException { WriteResponse aff = new WriteResponse(Statics.KS, Statics.Key, true); @@ -277,28 +277,28 @@ public class SerializationsTest extends AbstractSerializationsTester WriteResponse.serializer().serialize(neg, out, getVersion()); out.close(); } - + @Test public void testWriteResponseRead() throws IOException { if (EXECUTE_WRITES) testWriteResponseWrite(); - + DataInputStream in = getInput("db.WriteResponse.bin"); assert WriteResponse.serializer().deserialize(in, getVersion()) != null; assert WriteResponse.serializer().deserialize(in, getVersion()) != null; in.close(); } - + private static ByteBuffer bb(String s) { return ByteBufferUtil.bytes(s); } - - private static class Statics + + private static class Statics { private static final String KS = "Keyspace1"; private static final ByteBuffer Key = ByteBufferUtil.bytes("Key01"); - private static final List NamedCols = new ArrayList() + private static final List NamedCols = new ArrayList() {{ add(ByteBufferUtil.bytes("AAA")); add(ByteBufferUtil.bytes("BBB")); @@ -309,10 +309,10 @@ public class SerializationsTest extends AbstractSerializationsTester private static final QueryPath SuperPath = new QueryPath("Super1", SC); private static final ByteBuffer Start = ByteBufferUtil.bytes("Start"); private static final ByteBuffer Stop = ByteBufferUtil.bytes("Stop"); - + private static final ColumnFamily StandardCf = ColumnFamily.create(Statics.KS, "Standard1"); private static final ColumnFamily SuperCf = ColumnFamily.create(Statics.KS, "Super1"); - + private static final SuperColumn SuperCol = new SuperColumn(Statics.SC, Schema.instance.getComparator(Statics.KS, "Super1")) {{ addColumn(new Column(bb("aaaa"))); @@ -327,7 +327,7 @@ public class SerializationsTest extends AbstractSerializationsTester private static final Row StandardRow = new Row(Util.dk("key0"), Statics.StandardCf); private static final Row SuperRow = new Row(Util.dk("key1"), Statics.SuperCf); private static final Row NullRow = new Row(Util.dk("key2"), null); - + static { StandardCf.addColumn(new Column(bb("aaaa"))); StandardCf.addColumn(new Column(bb("bbbb"), bb("bbbbb-value"))); @@ -336,7 +336,7 @@ public class SerializationsTest extends AbstractSerializationsTester StandardCf.addColumn(new DeletedColumn(bb("eeee"), bb("eeee-value"), 1001)); StandardCf.addColumn(new ExpiringColumn(bb("ffff"), bb("ffff-value"), 2000, 1000)); StandardCf.addColumn(new ExpiringColumn(bb("gggg"), bb("gggg-value"), 2001, 1000, 2002)); - + SuperCf.addColumn(Statics.SuperCol); } } http://git-wip-us.apache.org/repos/asf/cassandra/blob/07cdfd07/test/unit/org/apache/cassandra/db/SuperColumnTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/db/SuperColumnTest.java b/test/unit/org/apache/cassandra/db/SuperColumnTest.java index 7c61e7b..f1d1ba6 100644 --- a/test/unit/org/apache/cassandra/db/SuperColumnTest.java +++ b/test/unit/org/apache/cassandra/db/SuperColumnTest.java @@ -33,7 +33,7 @@ import org.apache.cassandra.utils.FBUtilities; import org.apache.cassandra.utils.NodeId; public class SuperColumnTest -{ +{ private static final CounterContext cc = new CounterContext(); @Test @@ -70,7 +70,7 @@ public class SuperColumnTest state.writeElement(NodeId.fromInt(3), 6L, 0L); state.writeElement(NodeId.fromInt(7), 3L, 0L); sc.addColumn(new CounterColumn(getBytes(2), state.context, 9L, 0L)); - + assertNotNull(sc.getSubColumn(getBytes(1))); assertNull(sc.getSubColumn(getBytes(3))); http://git-wip-us.apache.org/repos/asf/cassandra/blob/07cdfd07/test/unit/org/apache/cassandra/db/SystemTableTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/db/SystemTableTest.java b/test/unit/org/apache/cassandra/db/SystemTableTest.java index df44b78..e4f3d74 100644 --- a/test/unit/org/apache/cassandra/db/SystemTableTest.java +++ b/test/unit/org/apache/cassandra/db/SystemTableTest.java @@ -1,6 +1,6 @@ package org.apache.cassandra.db; /* - * + * * 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 @@ -8,16 +8,16 @@ package org.apache.cassandra.db; * 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. - * + * */ http://git-wip-us.apache.org/repos/asf/cassandra/blob/07cdfd07/test/unit/org/apache/cassandra/db/TableTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/db/TableTest.java b/test/unit/org/apache/cassandra/db/TableTest.java index 62ae97a..b5a3869 100644 --- a/test/unit/org/apache/cassandra/db/TableTest.java +++ b/test/unit/org/apache/cassandra/db/TableTest.java @@ -134,16 +134,16 @@ public class TableTest extends CleanupHelper cf.addColumn(column("c", "val3", 1L)); rm.add(cf); rm.apply(); - + cf = cfStore.getColumnFamily(key, new QueryPath("Standard1"), ByteBufferUtil.bytes("b"), ByteBufferUtil.bytes("c"), false, 100); assertEquals(2, cf.getColumnCount()); - + cf = cfStore.getColumnFamily(key, new QueryPath("Standard1"), ByteBufferUtil.bytes("b"), ByteBufferUtil.bytes("b"), false, 100); assertEquals(1, cf.getColumnCount()); - + cf = cfStore.getColumnFamily(key, new QueryPath("Standard1"), ByteBufferUtil.bytes("b"), ByteBufferUtil.bytes("c"), false, 1); assertEquals(1, cf.getColumnCount()); - + cf = cfStore.getColumnFamily(key, new QueryPath("Standard1"), ByteBufferUtil.bytes("c"), ByteBufferUtil.bytes("b"), false, 1); assertNull(cf); } @@ -365,13 +365,13 @@ public class TableTest extends CleanupHelper cf = cfStore.getColumnFamily(ROW, new QueryPath("Standard1"), ByteBufferUtil.bytes("col2"), ByteBufferUtil.EMPTY_BYTE_BUFFER, false, 3); assertColumns(cf, "col2", "col3", "col4"); - + ByteBuffer col = cf.getColumn(ByteBufferUtil.bytes("col2")).value(); assertEquals(ByteBufferUtil.string(col), "valx"); - + col = cf.getColumn(ByteBufferUtil.bytes("col3")).value(); assertEquals(ByteBufferUtil.string(col), "valx"); - + col = cf.getColumn(ByteBufferUtil.bytes("col4")).value(); assertEquals(ByteBufferUtil.string(col), "val4"); } @@ -422,26 +422,26 @@ public class TableTest extends CleanupHelper ColumnFamily cf; cf = cfStore.getColumnFamily(key, new QueryPath("Standard1"), ByteBufferUtil.bytes("col1000"), ByteBufferUtil.EMPTY_BYTE_BUFFER, false, 3); assertColumns(cf, "col1000", "col1001", "col1002"); - - ByteBuffer col; + + ByteBuffer col; col = cf.getColumn(ByteBufferUtil.bytes("col1000")).value(); assertEquals(ByteBufferUtil.string(col), "v1000"); col = cf.getColumn(ByteBufferUtil.bytes("col1001")).value(); assertEquals(ByteBufferUtil.string(col), "v1001"); col = cf.getColumn(ByteBufferUtil.bytes("col1002")).value(); assertEquals(ByteBufferUtil.string(col), "v1002"); - + cf = cfStore.getColumnFamily(key, new QueryPath("Standard1"), ByteBufferUtil.bytes("col1195"), ByteBufferUtil.EMPTY_BYTE_BUFFER, false, 3); assertColumns(cf, "col1195", "col1196", "col1197"); - + col = cf.getColumn(ByteBufferUtil.bytes("col1195")).value(); assertEquals(ByteBufferUtil.string(col), "v1195"); col = cf.getColumn(ByteBufferUtil.bytes("col1196")).value(); assertEquals(ByteBufferUtil.string(col), "v1196"); col = cf.getColumn(ByteBufferUtil.bytes("col1197")).value(); assertEquals(ByteBufferUtil.string(col), "v1197"); - - + + cf = cfStore.getColumnFamily(key, new QueryPath("Standard1"), ByteBufferUtil.bytes("col1996"), ByteBufferUtil.EMPTY_BYTE_BUFFER, true, 1000); IColumn[] columns = cf.getSortedColumns().toArray(new IColumn[0]); for (int i = 1000; i < 1996; i++) @@ -460,7 +460,7 @@ public class TableTest extends CleanupHelper assertEquals(ByteBufferUtil.string(col), "v1991"); col = cf.getColumn(ByteBufferUtil.bytes("col1992")).value(); assertEquals(ByteBufferUtil.string(col), "v1992"); - + cf = cfStore.getColumnFamily(key, new QueryPath("Standard1"), ByteBufferUtil.EMPTY_BYTE_BUFFER, ByteBufferUtil.EMPTY_BYTE_BUFFER, true, 3); assertColumns(cf, "col1997", "col1998", "col1999"); col = cf.getColumn(ByteBufferUtil.bytes("col1997")).value(); @@ -469,7 +469,7 @@ public class TableTest extends CleanupHelper assertEquals(ByteBufferUtil.string(col), "v1998"); col = cf.getColumn(ByteBufferUtil.bytes("col1999")).value(); assertEquals(ByteBufferUtil.string(col), "v1999"); - + cf = cfStore.getColumnFamily(key, new QueryPath("Standard1"), ByteBufferUtil.bytes("col9000"), ByteBufferUtil.EMPTY_BYTE_BUFFER, true, 3); assertColumns(cf, "col1997", "col1998", "col1999"); @@ -499,9 +499,9 @@ public class TableTest extends CleanupHelper { ColumnFamily cf = cfStore.getColumnFamily(ROW, new QueryPath("Super1"), ByteBufferUtil.EMPTY_BYTE_BUFFER, ByteBufferUtil.EMPTY_BYTE_BUFFER, false, 10); assertColumns(cf, "sc1"); - + ByteBuffer val = cf.getColumn(ByteBufferUtil.bytes("sc1")).getSubColumn(getBytes(1)).value(); - + assertEquals(ByteBufferUtil.string(val), "val1"); } }; http://git-wip-us.apache.org/repos/asf/cassandra/blob/07cdfd07/test/unit/org/apache/cassandra/db/context/CounterContextTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/db/context/CounterContextTest.java b/test/unit/org/apache/cassandra/db/context/CounterContextTest.java index 6c59a4b..ae9ffbf 100644 --- a/test/unit/org/apache/cassandra/db/context/CounterContextTest.java +++ b/test/unit/org/apache/cassandra/db/context/CounterContextTest.java @@ -1,5 +1,5 @@ /* - * + * * 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 @@ -7,16 +7,16 @@ * 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.cassandra.db.context; @@ -109,7 +109,7 @@ public class CounterContextTest assert ContextRelationship.GREATER_THAN == cc.diff(left.context, right.context); - + // less than: left has subset of nodes (counts equal) left = ContextState.allocate(3, 0, allocator); left.writeElement(NodeId.fromInt(3), 3L, 0L); @@ -221,7 +221,7 @@ public class CounterContextTest assert ContextRelationship.DISJOINT == cc.diff(left.context, right.context); - + // disjoint: left has less nodes, but higher counts left = ContextState.allocate(3, 0, allocator); left.writeElement(NodeId.fromInt(3), 5L, 0L); http://git-wip-us.apache.org/repos/asf/cassandra/blob/07cdfd07/test/unit/org/apache/cassandra/db/marshal/DecimalTypeTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/db/marshal/DecimalTypeTest.java b/test/unit/org/apache/cassandra/db/marshal/DecimalTypeTest.java index db41083..108f48f 100644 --- a/test/unit/org/apache/cassandra/db/marshal/DecimalTypeTest.java +++ b/test/unit/org/apache/cassandra/db/marshal/DecimalTypeTest.java @@ -37,43 +37,43 @@ public class DecimalTypeTest private static BigDecimal minus = new BigDecimal("-1.000001"); private static BigDecimal low = new BigDecimal(LOW); private static BigDecimal high = new BigDecimal(HIGH); - + @Test public void test1Decompose_compose() { ByteBuffer bb = DecimalType.instance.decompose(low); - + String string = DecimalType.instance.compose(bb).toPlainString(); - + // check that the decomposed buffer when re-composed is equal to the initial string. assertEquals(LOW, string); - + // check that a null argument yields an empty byte buffer bb = DecimalType.instance.decompose(null); assertEquals(bb, ByteBufferUtil.EMPTY_BYTE_BUFFER); } - + @Test public void test2Compare() { ByteBuffer lowBB = DecimalType.instance.decompose(low); ByteBuffer low2BB = DecimalType.instance.decompose(low); - ByteBuffer highBB = DecimalType.instance.decompose(high); + ByteBuffer highBB = DecimalType.instance.decompose(high); assertEquals(-1, DecimalType.instance.compare(lowBB, highBB)); - + lowBB = DecimalType.instance.decompose(low); highBB = DecimalType.instance.decompose(high); assertEquals(1, DecimalType.instance.compare(highBB, lowBB)); - + lowBB = DecimalType.instance.decompose(low); assertEquals(0, DecimalType.instance.compare(low2BB, lowBB)); - + lowBB = DecimalType.instance.decompose(low); assertEquals(-1, DecimalType.instance.compare(ByteBufferUtil.EMPTY_BYTE_BUFFER, lowBB)); - + lowBB = DecimalType.instance.decompose(low); assertEquals(1, DecimalType.instance.compare(lowBB,ByteBufferUtil.EMPTY_BYTE_BUFFER)); - + assertEquals(0, DecimalType.instance.compare(ByteBufferUtil.EMPTY_BYTE_BUFFER,ByteBufferUtil.EMPTY_BYTE_BUFFER)); } @@ -83,13 +83,13 @@ public class DecimalTypeTest ByteBuffer zeroBB = DecimalType.instance.decompose(zero); ByteBuffer minusBB = DecimalType.instance.decompose(minus); ByteBuffer lowBB = DecimalType.instance.decompose(low); - ByteBuffer highBB = DecimalType.instance.decompose(high); + ByteBuffer highBB = DecimalType.instance.decompose(high); ByteBuffer[] array = {highBB,minusBB,lowBB,lowBB,zeroBB,minusBB}; - + // Sort the array of ByteBuffer using a DecimalType comparator Arrays.sort(array, DecimalType.instance); - + // Check that the array is in order for (int i = 1; i < array.length; i++) { http://git-wip-us.apache.org/repos/asf/cassandra/blob/07cdfd07/test/unit/org/apache/cassandra/db/marshal/RoundTripTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/db/marshal/RoundTripTest.java b/test/unit/org/apache/cassandra/db/marshal/RoundTripTest.java index 9e56111..9cb761c 100644 --- a/test/unit/org/apache/cassandra/db/marshal/RoundTripTest.java +++ b/test/unit/org/apache/cassandra/db/marshal/RoundTripTest.java @@ -1,6 +1,6 @@ package org.apache.cassandra.db.marshal; /* - * + * * 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 @@ -8,16 +8,16 @@ package org.apache.cassandra.db.marshal; * 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. - * + * */ @@ -48,7 +48,7 @@ public class RoundTripTest assert IntegerType.instance.compose(ByteBuffer.wrap(bi.toByteArray())).equals(bi); assert JdbcInteger.instance.toString(bi).equals("1"); } - + @Test public void testLong() { @@ -59,7 +59,7 @@ public class RoundTripTest assert LongType.instance.compose(ByteBuffer.wrap(v)) == 1L; assert JdbcLong.instance.toString(1L).equals("1"); } - + @Test public void intLong() { @@ -70,7 +70,7 @@ public class RoundTripTest assert Int32Type.instance.compose(ByteBuffer.wrap(v)) == 1; // assert Int32Type.instance.toString(1).equals("1"); } - + @Test public void testAscii() throws Exception { @@ -81,7 +81,7 @@ public class RoundTripTest assert AsciiType.instance.compose(ByteBuffer.wrap(abc)).equals("abc"); assert JdbcAscii.instance.toString("abc").equals("abc"); } - + @Test public void testBytes() { @@ -93,7 +93,7 @@ public class RoundTripTest assert BytesType.instance.compose(ByteBuffer.wrap(v)).equals(ByteBuffer.wrap(v)); assert JdbcBytes.instance.toString(ByteBuffer.wrap(v)).equals(Hex.bytesToHex(v)); } - + @Test public void testLexicalUUID() { @@ -105,7 +105,7 @@ public class RoundTripTest assert LexicalUUIDType.instance.compose(ByteBuffer.wrap(UUIDGen.decompose(uuid))).equals(uuid); assert JdbcLexicalUUID.instance.toString(uuid).equals(uuid.toString()); } - + @Test public void testTimeUUID() { @@ -115,10 +115,10 @@ public class RoundTripTest assert TimeUUIDType.instance.fromString(TimeUUIDType.instance.getString(ByteBuffer.wrap(UUIDGen.decompose(uuid)))) .equals(ByteBuffer.wrap(UUIDGen.decompose(uuid))); assert TimeUUIDType.instance.compose(ByteBuffer.wrap(UUIDGen.decompose(uuid))).equals(uuid); - + assert uuid.equals(TimeUUIDType.instance.compose(TimeUUIDType.instance.fromString(uuid.toString()))); assert JdbcTimeUUID.instance.toString(uuid).equals(uuid.toString()); - + TimeZone.setDefault(TimeZone.getTimeZone("America/New_York")); Calendar c = Calendar.getInstance(); c.set(Calendar.YEAR, 2011); @@ -130,7 +130,7 @@ public class RoundTripTest c.set(Calendar.MILLISECOND, 0); Long ts = new Long(1299560400000L); assert ts.equals(c.getTimeInMillis()) : c.getTimeInMillis(); - + // create a uuid with a known time. uuid = TimeUUIDType.instance.compose(TimeUUIDType.instance.fromString(ts.toString())); assert uuid.equals(TimeUUIDType.instance.compose(TimeUUIDType.instance.fromString(uuid.toString()))); @@ -143,9 +143,9 @@ public class RoundTripTest assert uuid.equals(TimeUUIDType.instance.compose(TimeUUIDType.instance.fromString("2011-03-08T00:00:00"))); assert uuid.equals(TimeUUIDType.instance.compose(TimeUUIDType.instance.fromString("2011-03-08T00:00:00-0500"))); assert uuid.equals(TimeUUIDType.instance.compose(TimeUUIDType.instance.fromString("2011-03-08"))); - assert uuid.equals(TimeUUIDType.instance.compose(TimeUUIDType.instance.fromString("2011-03-08-0500"))); + assert uuid.equals(TimeUUIDType.instance.compose(TimeUUIDType.instance.fromString("2011-03-08-0500"))); } - + @Test public void testUtf8() throws Exception { http://git-wip-us.apache.org/repos/asf/cassandra/blob/07cdfd07/test/unit/org/apache/cassandra/db/marshal/TimeUUIDTypeTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/db/marshal/TimeUUIDTypeTest.java b/test/unit/org/apache/cassandra/db/marshal/TimeUUIDTypeTest.java index f41a528..256fba4 100644 --- a/test/unit/org/apache/cassandra/db/marshal/TimeUUIDTypeTest.java +++ b/test/unit/org/apache/cassandra/db/marshal/TimeUUIDTypeTest.java @@ -39,7 +39,7 @@ public class TimeUUIDTypeTest { UUID a = UUIDGen.makeType1UUIDFromHost(InetAddress.getLocalHost()); UUID b = new UUID(a.getMostSignificantBits(), a.getLeastSignificantBits()); - + timeUUIDType.validate(ByteBuffer.wrap(UUIDGen.decompose(a))); timeUUIDType.validate(ByteBuffer.wrap(UUIDGen.decompose(b))); assertEquals(0, timeUUIDType.compare(ByteBuffer.wrap(UUIDGen.decompose(a)), ByteBuffer.wrap(UUIDGen.decompose(b)))); @@ -55,7 +55,7 @@ public class TimeUUIDTypeTest timeUUIDType.validate(ByteBuffer.wrap(UUIDGen.decompose(a))); timeUUIDType.validate(ByteBuffer.wrap(UUIDGen.decompose(b))); timeUUIDType.validate(ByteBuffer.wrap(UUIDGen.decompose(c))); - + assert timeUUIDType.compare(ByteBuffer.wrap(UUIDGen.decompose(a)), ByteBuffer.wrap(UUIDGen.decompose(b))) < 0; assert timeUUIDType.compare(ByteBuffer.wrap(UUIDGen.decompose(b)), ByteBuffer.wrap(UUIDGen.decompose(c))) < 0; assert timeUUIDType.compare(ByteBuffer.wrap(UUIDGen.decompose(a)), ByteBuffer.wrap(UUIDGen.decompose(c))) < 0; @@ -98,7 +98,7 @@ public class TimeUUIDTypeTest assert i0 <= i1; } } - + @Test public void testValidTimeVersion() { @@ -106,7 +106,7 @@ public class TimeUUIDTypeTest assert uuid1.version() == 1; timeUUIDType.validate(ByteBuffer.wrap(UUIDGen.decompose(uuid1))); } - + @Test(expected = MarshalException.class) public void testInvalidTimeVersion() { @@ -114,6 +114,6 @@ public class TimeUUIDTypeTest assert uuid2.version() == 2; timeUUIDType.validate(ByteBuffer.wrap(UUIDGen.decompose(uuid2))); } - - + + } http://git-wip-us.apache.org/repos/asf/cassandra/blob/07cdfd07/test/unit/org/apache/cassandra/db/marshal/TypeCompareTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/db/marshal/TypeCompareTest.java b/test/unit/org/apache/cassandra/db/marshal/TypeCompareTest.java index 49bdf9c..04b030e 100644 --- a/test/unit/org/apache/cassandra/db/marshal/TypeCompareTest.java +++ b/test/unit/org/apache/cassandra/db/marshal/TypeCompareTest.java @@ -1,6 +1,6 @@ package org.apache.cassandra.db.marshal; /* - * + * * 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 @@ -8,16 +8,16 @@ package org.apache.cassandra.db.marshal; * 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. - * + * */ @@ -85,7 +85,7 @@ public class TypeCompareTest for (int i = 1; i < data.length; i++) { - + long l0 = data[i - 1].getLong(data[i - 1].position()); long l1 = data[i].getLong(data[i].position()); assert l0 <= l1; @@ -107,7 +107,7 @@ public class TypeCompareTest for (int i = 1; i < data.length; i++) { - + int l0 = data[i - 1].getInt(data[i - 1].position()); int l1 = data[i].getInt(data[i].position()); assert l0 <= l1; http://git-wip-us.apache.org/repos/asf/cassandra/blob/07cdfd07/test/unit/org/apache/cassandra/db/marshal/TypeValidationTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/db/marshal/TypeValidationTest.java b/test/unit/org/apache/cassandra/db/marshal/TypeValidationTest.java index f12a136..552582e 100644 --- a/test/unit/org/apache/cassandra/db/marshal/TypeValidationTest.java +++ b/test/unit/org/apache/cassandra/db/marshal/TypeValidationTest.java @@ -17,9 +17,9 @@ import java.util.UUID; * 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. @@ -35,34 +35,34 @@ public class TypeValidationTest { AsciiType.instance.validate(ByteBuffer.wrap(new byte[]{ (byte)0x80 })); } - + @Test(expected = MarshalException.class) public void testInvalidTimeUUID() { UUID uuid = UUID.randomUUID(); TimeUUIDType.instance.validate(ByteBuffer.wrap(UUIDGen.decompose(uuid))); } - - @Test + + @Test public void testValidTimeUUID() { TimeUUIDType.instance.validate(ByteBuffer.wrap(UUIDGen.getTimeUUIDBytes())); } - + @Test public void testLong() { LongType.instance.validate(Util.getBytes(5L)); LongType.instance.validate(Util.getBytes(5555555555555555555L)); } - + @Test public void testInt() { Int32Type.instance.validate(Util.getBytes(5)); Int32Type.instance.validate(Util.getBytes(2057022603)); } - + @Test public void testValidUtf8() throws UnsupportedEncodingException { @@ -83,46 +83,46 @@ public class TypeValidationTest byte[] arr = s.getBytes("UTF8"); ByteBuffer buf = ByteBuffer.wrap(arr); UTF8Type.instance.validate(buf); - + // some you might not expect. UTF8Type.instance.validate(ByteBuffer.wrap(new byte[] {})); // valid Utf8, unspecified in modified utf8. UTF8Type.instance.validate(ByteBuffer.wrap(new byte[] {0})); - + // modified utf8 null. UTF8Type.instance.validate(ByteBuffer.wrap(new byte[] {99, (byte)0xc0, (byte)0x80, 112})); - + // edges, for my sanity. UTF8Type.instance.validate(ByteBuffer.wrap(new byte[] {(byte)0xc2, (byte)0x81})); UTF8Type.instance.validate(ByteBuffer.wrap(new byte[] {(byte)0xe0, (byte)0xa0, (byte)0x81})); UTF8Type.instance.validate(ByteBuffer.wrap(new byte[] {(byte)0xf0, (byte)0x90, (byte)0x81, (byte)0x81})); } - + // now test for bogies. - + @Test(expected = MarshalException.class) public void testFloatingc0() { UTF8Type.instance.validate(ByteBuffer.wrap(new byte[] {99, (byte)0xc0, 112})); } - + @Test(expected = MarshalException.class) public void testInvalid2nd() { UTF8Type.instance.validate(ByteBuffer.wrap(new byte[] {(byte)0xc2, (byte)0xff})); } - + @Test(expected = MarshalException.class) public void testInvalid3rd() { UTF8Type.instance.validate(ByteBuffer.wrap(new byte[] {(byte)0xe0, (byte)0xa0, (byte)0xff})); } - + @Test(expected = MarshalException.class) public void testInvalid4th() { UTF8Type.instance.validate(ByteBuffer.wrap(new byte[] {(byte)0xf0, (byte)0x90, (byte)0x81, (byte)0xff})); } - + // todo: for completeness, should test invalid two byte pairs. } http://git-wip-us.apache.org/repos/asf/cassandra/blob/07cdfd07/test/unit/org/apache/cassandra/db/marshal/UUIDTypeTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/db/marshal/UUIDTypeTest.java b/test/unit/org/apache/cassandra/db/marshal/UUIDTypeTest.java index 2abb408..0f75d2a 100644 --- a/test/unit/org/apache/cassandra/db/marshal/UUIDTypeTest.java +++ b/test/unit/org/apache/cassandra/db/marshal/UUIDTypeTest.java @@ -1,7 +1,7 @@ package org.apache.cassandra.db.marshal; /* - * + * * 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 @@ -9,16 +9,16 @@ package org.apache.cassandra.db.marshal; * 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. - * + * */ import static org.junit.Assert.assertEquals; http://git-wip-us.apache.org/repos/asf/cassandra/blob/07cdfd07/test/unit/org/apache/cassandra/dht/BootStrapperTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/dht/BootStrapperTest.java b/test/unit/org/apache/cassandra/dht/BootStrapperTest.java index 72e5bf9..4b3a00d 100644 --- a/test/unit/org/apache/cassandra/dht/BootStrapperTest.java +++ b/test/unit/org/apache/cassandra/dht/BootStrapperTest.java @@ -51,30 +51,30 @@ public class BootStrapperTest extends CleanupHelper // fetch a bootstrap token from the local node assert BootStrapper.getBootstrapTokenFrom(FBUtilities.getBroadcastAddress()) != null; } - + @Test public void testMulitipleAutomaticBootstraps() throws IOException { StorageService ss = StorageService.instance; generateFakeEndpoints(5); - InetAddress[] addrs = new InetAddress[] + InetAddress[] addrs = new InetAddress[] { - InetAddress.getByName("127.0.0.2"), - InetAddress.getByName("127.0.0.3"), - InetAddress.getByName("127.0.0.4"), - InetAddress.getByName("127.0.0.5"), + InetAddress.getByName("127.0.0.2"), + InetAddress.getByName("127.0.0.3"), + InetAddress.getByName("127.0.0.4"), + InetAddress.getByName("127.0.0.5"), }; InetAddress[] bootstrapAddrs = new InetAddress[] { - InetAddress.getByName("127.0.0.12"), - InetAddress.getByName("127.0.0.13"), - InetAddress.getByName("127.0.0.14"), - InetAddress.getByName("127.0.0.15"), + InetAddress.getByName("127.0.0.12"), + InetAddress.getByName("127.0.0.13"), + InetAddress.getByName("127.0.0.14"), + InetAddress.getByName("127.0.0.15"), }; Map load = new HashMap(); for (int i = 0; i < addrs.length; i++) load.put(addrs[i], (double)i+2); - + // give every node a bootstrap source. for (int i = 3; i >=0; i--) { @@ -82,24 +82,24 @@ public class BootStrapperTest extends CleanupHelper assert bootstrapSource != null; assert bootstrapSource.equals(addrs[i]) : String.format("expected %s but got %s for %d", addrs[i], bootstrapSource, i); assert !ss.getTokenMetadata().getBootstrapTokens().containsValue(bootstrapSource); - + Range range = ss.getPrimaryRangeForEndpoint(bootstrapSource); Token token = StorageService.getPartitioner().midpoint(range.left, range.right); assert range.contains(token); ss.onChange(bootstrapAddrs[i], ApplicationState.STATUS, StorageService.instance.valueFactory.bootstrapping(token)); } - + // any further attempt to bootsrtap should fail since every node in the cluster is splitting. try { BootStrapper.getBootstrapSource(ss.getTokenMetadata(), load); throw new AssertionError("This bootstrap should have failed."); } - catch (RuntimeException ex) + catch (RuntimeException ex) { // success! } - + // indicate that one of the nodes is done. see if the node it was bootstrapping from is still available. Range range = ss.getPrimaryRangeForEndpoint(addrs[2]); Token token = StorageService.getPartitioner().midpoint(range.left, range.right); http://git-wip-us.apache.org/repos/asf/cassandra/blob/07cdfd07/test/unit/org/apache/cassandra/dht/PartitionerTestCase.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/dht/PartitionerTestCase.java b/test/unit/org/apache/cassandra/dht/PartitionerTestCase.java index 26708bc..13b052d 100644 --- a/test/unit/org/apache/cassandra/dht/PartitionerTestCase.java +++ b/test/unit/org/apache/cassandra/dht/PartitionerTestCase.java @@ -86,7 +86,7 @@ public abstract class PartitionerTestCase @Test public void testMidpointMinimum() { - T mintoken = partitioner.getMinimumToken(); + T mintoken = partitioner.getMinimumToken(); assert mintoken.compareTo(partitioner.midpoint(mintoken, mintoken)) != 0; assertMidpoint(mintoken, tok("a"), 16); assertMidpoint(mintoken, tok("aaa"), 16); @@ -100,14 +100,14 @@ public abstract class PartitionerTestCase assertMidpoint(tok("b"), tok("a"), 16); assertMidpoint(tok("bbb"), tok("a"), 16); } - + @Test public void testTokenFactoryBytes() { Token.TokenFactory factory = partitioner.getTokenFactory(); assert tok("a").compareTo(factory.fromByteArray(factory.toByteArray(tok("a")))) == 0; } - + @Test public void testTokenFactoryStrings() { http://git-wip-us.apache.org/repos/asf/cassandra/blob/07cdfd07/test/unit/org/apache/cassandra/dht/RandomPartitionerTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/dht/RandomPartitionerTest.java b/test/unit/org/apache/cassandra/dht/RandomPartitionerTest.java index 0426a1a..be5e365 100644 --- a/test/unit/org/apache/cassandra/dht/RandomPartitionerTest.java +++ b/test/unit/org/apache/cassandra/dht/RandomPartitionerTest.java @@ -1,6 +1,6 @@ package org.apache.cassandra.dht; /* - * + * * 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 @@ -8,16 +8,16 @@ package org.apache.cassandra.dht; * 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. - * + * */ http://git-wip-us.apache.org/repos/asf/cassandra/blob/07cdfd07/test/unit/org/apache/cassandra/gms/ArrivalWindowTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/gms/ArrivalWindowTest.java b/test/unit/org/apache/cassandra/gms/ArrivalWindowTest.java index 0b38058..277cae1 100644 --- a/test/unit/org/apache/cassandra/gms/ArrivalWindowTest.java +++ b/test/unit/org/apache/cassandra/gms/ArrivalWindowTest.java @@ -1,6 +1,6 @@ package org.apache.cassandra.gms; /* - * + * * 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 @@ -8,16 +8,16 @@ package org.apache.cassandra.gms; * 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. - * + * */ @@ -27,7 +27,7 @@ import org.junit.Test; public class ArrivalWindowTest { - + @Test public void test() { @@ -41,7 +41,7 @@ public class ArrivalWindowTest //all good assertEquals(0.4342, window.phi(666), 0.01); - + //oh noes, a much higher timestamp, something went wrong! assertEquals(9.566, window.phi(3000), 0.01); } http://git-wip-us.apache.org/repos/asf/cassandra/blob/07cdfd07/test/unit/org/apache/cassandra/gms/GossipDigestTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/gms/GossipDigestTest.java b/test/unit/org/apache/cassandra/gms/GossipDigestTest.java index df2f591..7732a0e 100644 --- a/test/unit/org/apache/cassandra/gms/GossipDigestTest.java +++ b/test/unit/org/apache/cassandra/gms/GossipDigestTest.java @@ -1,6 +1,6 @@ package org.apache.cassandra.gms; /* - * + * * 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 @@ -8,16 +8,16 @@ package org.apache.cassandra.gms; * 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. - * + * */ @@ -46,11 +46,11 @@ public class GossipDigestTest assertEquals(endpoint, expected.getEndpoint()); assertEquals(generation, expected.getGeneration()); assertEquals(maxVersion, expected.getMaxVersion()); - + //test the serialization and equals DataOutputBuffer output = new DataOutputBuffer(); GossipDigest.serializer().serialize(expected, output, MessagingService.version_); - + ByteArrayInputStream input = new ByteArrayInputStream(output.getData(), 0, output.getLength()); GossipDigest actual = GossipDigest.serializer().deserialize(new DataInputStream(input), MessagingService.version_); assertEquals(0, expected.compareTo(actual)); http://git-wip-us.apache.org/repos/asf/cassandra/blob/07cdfd07/test/unit/org/apache/cassandra/gms/SerializationsTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/gms/SerializationsTest.java b/test/unit/org/apache/cassandra/gms/SerializationsTest.java index b61c38a..0010465 100644 --- a/test/unit/org/apache/cassandra/gms/SerializationsTest.java +++ b/test/unit/org/apache/cassandra/gms/SerializationsTest.java @@ -1,6 +1,6 @@ package org.apache.cassandra.gms; /* - * + * * 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 @@ -8,16 +8,16 @@ package org.apache.cassandra.gms; * 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. - * + * */ @@ -37,7 +37,7 @@ import java.util.Map; public class SerializationsTest extends AbstractSerializationsTester { - private void testEndpointStateWrite() throws IOException + private void testEndpointStateWrite() throws IOException { DataOutputStream out = getOutput("gms.EndpointState.bin"); HeartBeatState.serializer().serialize(Statics.HeartbeatSt, out, getVersion()); @@ -46,13 +46,13 @@ public class SerializationsTest extends AbstractSerializationsTester VersionedValue.serializer.serialize(Statics.vv1, out, getVersion()); out.close(); } - + @Test public void testEndpointStateRead() throws IOException { if (EXECUTE_WRITES) testEndpointStateWrite(); - + DataInputStream in = getInput("gms.EndpointState.bin"); assert HeartBeatState.serializer().deserialize(in, getVersion()) != null; assert EndpointState.serializer().deserialize(in, getVersion()) != null; @@ -60,7 +60,7 @@ public class SerializationsTest extends AbstractSerializationsTester assert VersionedValue.serializer.deserialize(in, getVersion()) != null; in.close(); } - + private void testGossipDigestWrite() throws IOException { Map states = new HashMap(); @@ -69,7 +69,7 @@ public class SerializationsTest extends AbstractSerializationsTester GossipDigestAckMessage ack = new GossipDigestAckMessage(Statics.Digests, states); GossipDigestAck2Message ack2 = new GossipDigestAck2Message(states); GossipDigestSynMessage syn = new GossipDigestSynMessage("Not a real cluster name", Statics.Digests); - + DataOutputStream out = getOutput("gms.Gossip.bin"); for (GossipDigest gd : Statics.Digests) GossipDigest.serializer().serialize(gd, out, getVersion()); @@ -78,13 +78,13 @@ public class SerializationsTest extends AbstractSerializationsTester GossipDigestSynMessage.serializer().serialize(syn, out, getVersion()); out.close(); } - + @Test public void testGossipDigestRead() throws IOException { if (EXECUTE_WRITES) testGossipDigestWrite(); - + int count = 0; DataInputStream in = getInput("gms.Gossip.bin"); while (count < Statics.Digests.size()) @@ -94,7 +94,7 @@ public class SerializationsTest extends AbstractSerializationsTester assert GossipDigestSynMessage.serializer().deserialize(in, getVersion()) != null; in.close(); } - + private static class Statics { private static HeartBeatState HeartbeatSt = new HeartBeatState(101, 201); @@ -103,7 +103,7 @@ public class SerializationsTest extends AbstractSerializationsTester private static VersionedValue vv0 = vvFact.load(23d); private static VersionedValue vv1 = vvFact.bootstrapping(StorageService.getPartitioner().getRandomToken()); private static List Digests = new ArrayList(); - + { HeartbeatSt.updateHeartBeat(); EndpointSt.addApplicationState(ApplicationState.LOAD, vv0); http://git-wip-us.apache.org/repos/asf/cassandra/blob/07cdfd07/test/unit/org/apache/cassandra/hadoop/ColumnFamilyInputFormatTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/hadoop/ColumnFamilyInputFormatTest.java b/test/unit/org/apache/cassandra/hadoop/ColumnFamilyInputFormatTest.java index ffe0aa6..d4261bf 100644 --- a/test/unit/org/apache/cassandra/hadoop/ColumnFamilyInputFormatTest.java +++ b/test/unit/org/apache/cassandra/hadoop/ColumnFamilyInputFormatTest.java @@ -1,6 +1,6 @@ package org.apache.cassandra.hadoop; /* - * + * * 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 @@ -8,16 +8,16 @@ package org.apache.cassandra.hadoop; * 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. - * + * */ http://git-wip-us.apache.org/repos/asf/cassandra/blob/07cdfd07/test/unit/org/apache/cassandra/io/BloomFilterTrackerTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/io/BloomFilterTrackerTest.java b/test/unit/org/apache/cassandra/io/BloomFilterTrackerTest.java index 29a1588..6bc3032 100644 --- a/test/unit/org/apache/cassandra/io/BloomFilterTrackerTest.java +++ b/test/unit/org/apache/cassandra/io/BloomFilterTrackerTest.java @@ -1,6 +1,6 @@ package org.apache.cassandra.io; /* - * + * * 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 @@ -8,16 +8,16 @@ package org.apache.cassandra.io; * 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. - * + * */ http://git-wip-us.apache.org/repos/asf/cassandra/blob/07cdfd07/test/unit/org/apache/cassandra/io/CompactSerializerTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/io/CompactSerializerTest.java b/test/unit/org/apache/cassandra/io/CompactSerializerTest.java index befb0d1..64d3980 100644 --- a/test/unit/org/apache/cassandra/io/CompactSerializerTest.java +++ b/test/unit/org/apache/cassandra/io/CompactSerializerTest.java @@ -1,6 +1,6 @@ package org.apache.cassandra.io; /* - * + * * 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 @@ -8,16 +8,16 @@ package org.apache.cassandra.io; * 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. - * + * */ @@ -37,7 +37,7 @@ public class CompactSerializerTest extends CleanupHelper { private static Set expectedClassNames; private static List discoveredClassNames; - + @BeforeClass public static void scanClasspath() { @@ -71,14 +71,14 @@ public class CompactSerializerTest extends CleanupHelper expectedClassNames.add("StreamingRepairTaskSerializer"); expectedClassNames.add("AbstractBoundsSerializer"); expectedClassNames.add("SnapshotCommandSerializer"); - + discoveredClassNames = new ArrayList(); String cp = System.getProperty("java.class.path"); assert cp != null; String[] parts = cp.split(File.pathSeparator, -1); - class DirScanner + class DirScanner { - void scan(File f, String ctx) + void scan(File f, String ctx) { String newCtx = ctx == null ? f.getName().equals("org") ? f.getName() : null : ctx + "." + f.getName(); if (f.isDirectory()) @@ -114,14 +114,14 @@ public class CompactSerializerTest extends CleanupHelper cls = cls.getSuperclass(); } } - catch (ClassNotFoundException ex) + catch (ClassNotFoundException ex) { throw new RuntimeException(ex); } } } } - + DirScanner dirScanner = new DirScanner(); for (String cpItem : parts) { @@ -130,7 +130,7 @@ public class CompactSerializerTest extends CleanupHelper dirScanner.scan(f, null); } } - + /** look for classes I expect to find. */ @Test public void verifyAllSimpleNamesTest() @@ -138,7 +138,7 @@ public class CompactSerializerTest extends CleanupHelper for (String clsName : expectedClassNames) assert discoveredClassNames.contains(clsName) : clsName + " was not discovered"; } - + /** look for classes I do not expect to find. */ @Test public void noOthersTest() http://git-wip-us.apache.org/repos/asf/cassandra/blob/07cdfd07/test/unit/org/apache/cassandra/io/LazilyCompactedRowTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/io/LazilyCompactedRowTest.java b/test/unit/org/apache/cassandra/io/LazilyCompactedRowTest.java index 65b2e7e..1eab8c5 100644 --- a/test/unit/org/apache/cassandra/io/LazilyCompactedRowTest.java +++ b/test/unit/org/apache/cassandra/io/LazilyCompactedRowTest.java @@ -1,6 +1,6 @@ package org.apache.cassandra.io; /* - * + * * 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 @@ -8,16 +8,16 @@ package org.apache.cassandra.io; * 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. - * + * */