fix typo in SICST class name
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/1ad710b6 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/1ad710b6 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/1ad710b6 Branch: refs/heads/cassandra-1.0 Commit: 1ad710b6eada9b0b269c96154021a95a807f4bbb Parents: bcc7f7b Author: Jonathan Ellis <[email protected]> Authored: Thu Jul 26 17:12:24 2012 -0500 Committer: Jonathan Ellis <[email protected]> Committed: Thu Jul 26 17:12:24 2012 -0500 ---------------------------------------------------------------------- .../cassandra/db/SecondaryIndexColumSizeTest.java | 215 --------------- .../cassandra/db/SecondaryIndexColumnSizeTest.java | 215 +++++++++++++++ 2 files changed, 215 insertions(+), 215 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/1ad710b6/test/unit/org/apache/cassandra/db/SecondaryIndexColumSizeTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/db/SecondaryIndexColumSizeTest.java b/test/unit/org/apache/cassandra/db/SecondaryIndexColumSizeTest.java deleted file mode 100644 index 1f6a0a1..0000000 --- a/test/unit/org/apache/cassandra/db/SecondaryIndexColumSizeTest.java +++ /dev/null @@ -1,215 +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.cassandra.db; - -import java.io.IOException; -import java.nio.ByteBuffer; -import java.util.List; -import java.util.Set; -import java.util.SortedSet; - -import org.junit.Test; - -import org.apache.cassandra.config.ConfigurationException; -import org.apache.cassandra.db.index.PerColumnSecondaryIndex; -import org.apache.cassandra.db.index.PerRowSecondaryIndex; -import org.apache.cassandra.db.index.SecondaryIndexSearcher; -import org.apache.cassandra.thrift.Column; -import org.apache.cassandra.utils.ByteBufferUtil; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -public class SecondaryIndexColumSizeTest -{ - @Test - public void test64kColumn() - { - Column column = new Column(); - column.name = ByteBufferUtil.bytes("test"); - - // a byte buffer more than 64k - ByteBuffer buffer = ByteBuffer.allocate(1024 * 65); - buffer.clear(); - - //read more than 64k - for (int i=0; i<1024*64/4 + 1; i++) - buffer.putInt(0); - - // for read - buffer.flip(); - column.value = buffer; - - MockRowIndex mockRowIndex = new MockRowIndex(); - MockColumnIndex mockColumnIndex = new MockColumnIndex(); - - assertTrue(mockRowIndex.validate(column)); - assertFalse(mockColumnIndex.validate(column)); - - // test less than 64k value - buffer.flip(); - buffer.clear(); - buffer.putInt(20); - buffer.flip(); - - assertTrue(mockRowIndex.validate(column)); - assertTrue(mockColumnIndex.validate(column)); - } - - private class MockRowIndex extends PerRowSecondaryIndex - { - @Override - public void applyIndexUpdates(ByteBuffer rowKey, ColumnFamily cf, SortedSet<ByteBuffer> mutatedIndexedColumns, ColumnFamily oldIndexedColumns) throws IOException - { - } - - @Override - public void init() - { - } - - @Override - public void validateOptions() throws ConfigurationException - { - } - - @Override - public String getIndexName() - { - return null; - } - - @Override - protected SecondaryIndexSearcher createSecondaryIndexSearcher(Set<ByteBuffer> columns) - { - return null; - } - - @Override - public void forceBlockingFlush() throws IOException - { - } - - @Override - public long getLiveSize() - { - return 0; - } - - @Override - public ColumnFamilyStore getIndexCfs() - { - return null; - } - - @Override - public void removeIndex(ByteBuffer columnName) throws IOException - { - } - - @Override - public void invalidate() - { - } - - @Override - public void truncate(long truncatedAt) - { - } - - @Override - public void deleteFromIndex(DecoratedKey<?> key, List<IColumn> indexedColumnsInRow) - { - } - - } - - - private class MockColumnIndex extends PerColumnSecondaryIndex - { - @Override - public void init() - { - } - - @Override - public void validateOptions() throws ConfigurationException - { - } - - @Override - public String getIndexName() - { - return null; - } - - @Override - protected SecondaryIndexSearcher createSecondaryIndexSearcher(Set<ByteBuffer> columns) - { - return null; - } - - @Override - public void forceBlockingFlush() throws IOException - { - } - - @Override - public long getLiveSize() - { - return 0; - } - - @Override - public ColumnFamilyStore getIndexCfs() - { - return null; - } - - @Override - public void removeIndex(ByteBuffer columnName) throws IOException - { - } - - @Override - public void invalidate() - { - } - - @Override - public void truncate(long truncatedAt) - { - } - - @Override - public void deleteColumn(DecoratedKey valueKey, ByteBuffer rowKey, IColumn col) throws IOException - { - } - - @Override - public void insertColumn(DecoratedKey valueKey, ByteBuffer rowKey, IColumn col) throws IOException - { - } - - @Override - public void updateColumn(DecoratedKey valueKey, ByteBuffer rowKey, IColumn col) throws IOException - { - } - } -} http://git-wip-us.apache.org/repos/asf/cassandra/blob/1ad710b6/test/unit/org/apache/cassandra/db/SecondaryIndexColumnSizeTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/db/SecondaryIndexColumnSizeTest.java b/test/unit/org/apache/cassandra/db/SecondaryIndexColumnSizeTest.java new file mode 100644 index 0000000..89479e9 --- /dev/null +++ b/test/unit/org/apache/cassandra/db/SecondaryIndexColumnSizeTest.java @@ -0,0 +1,215 @@ +/* +* 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.cassandra.db; + +import java.io.IOException; +import java.nio.ByteBuffer; +import java.util.List; +import java.util.Set; +import java.util.SortedSet; + +import org.junit.Test; + +import org.apache.cassandra.config.ConfigurationException; +import org.apache.cassandra.db.index.PerColumnSecondaryIndex; +import org.apache.cassandra.db.index.PerRowSecondaryIndex; +import org.apache.cassandra.db.index.SecondaryIndexSearcher; +import org.apache.cassandra.thrift.Column; +import org.apache.cassandra.utils.ByteBufferUtil; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +public class SecondaryIndexColumnSizeTest +{ + @Test + public void test64kColumn() + { + Column column = new Column(); + column.name = ByteBufferUtil.bytes("test"); + + // a byte buffer more than 64k + ByteBuffer buffer = ByteBuffer.allocate(1024 * 65); + buffer.clear(); + + //read more than 64k + for (int i=0; i<1024*64/4 + 1; i++) + buffer.putInt(0); + + // for read + buffer.flip(); + column.value = buffer; + + MockRowIndex mockRowIndex = new MockRowIndex(); + MockColumnIndex mockColumnIndex = new MockColumnIndex(); + + assertTrue(mockRowIndex.validate(column)); + assertFalse(mockColumnIndex.validate(column)); + + // test less than 64k value + buffer.flip(); + buffer.clear(); + buffer.putInt(20); + buffer.flip(); + + assertTrue(mockRowIndex.validate(column)); + assertTrue(mockColumnIndex.validate(column)); + } + + private class MockRowIndex extends PerRowSecondaryIndex + { + @Override + public void applyIndexUpdates(ByteBuffer rowKey, ColumnFamily cf, SortedSet<ByteBuffer> mutatedIndexedColumns, ColumnFamily oldIndexedColumns) throws IOException + { + } + + @Override + public void init() + { + } + + @Override + public void validateOptions() throws ConfigurationException + { + } + + @Override + public String getIndexName() + { + return null; + } + + @Override + protected SecondaryIndexSearcher createSecondaryIndexSearcher(Set<ByteBuffer> columns) + { + return null; + } + + @Override + public void forceBlockingFlush() throws IOException + { + } + + @Override + public long getLiveSize() + { + return 0; + } + + @Override + public ColumnFamilyStore getIndexCfs() + { + return null; + } + + @Override + public void removeIndex(ByteBuffer columnName) throws IOException + { + } + + @Override + public void invalidate() + { + } + + @Override + public void truncate(long truncatedAt) + { + } + + @Override + public void deleteFromIndex(DecoratedKey<?> key, List<IColumn> indexedColumnsInRow) + { + } + + } + + + private class MockColumnIndex extends PerColumnSecondaryIndex + { + @Override + public void init() + { + } + + @Override + public void validateOptions() throws ConfigurationException + { + } + + @Override + public String getIndexName() + { + return null; + } + + @Override + protected SecondaryIndexSearcher createSecondaryIndexSearcher(Set<ByteBuffer> columns) + { + return null; + } + + @Override + public void forceBlockingFlush() throws IOException + { + } + + @Override + public long getLiveSize() + { + return 0; + } + + @Override + public ColumnFamilyStore getIndexCfs() + { + return null; + } + + @Override + public void removeIndex(ByteBuffer columnName) throws IOException + { + } + + @Override + public void invalidate() + { + } + + @Override + public void truncate(long truncatedAt) + { + } + + @Override + public void deleteColumn(DecoratedKey valueKey, ByteBuffer rowKey, IColumn col) throws IOException + { + } + + @Override + public void insertColumn(DecoratedKey valueKey, ByteBuffer rowKey, IColumn col) throws IOException + { + } + + @Override + public void updateColumn(DecoratedKey valueKey, ByteBuffer rowKey, IColumn col) throws IOException + { + } + } +}
