Fixing some unit tests.
Project: http://git-wip-us.apache.org/repos/asf/incubator-blur/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-blur/commit/2d8055e1 Tree: http://git-wip-us.apache.org/repos/asf/incubator-blur/tree/2d8055e1 Diff: http://git-wip-us.apache.org/repos/asf/incubator-blur/diff/2d8055e1 Branch: refs/heads/master Commit: 2d8055e1f54580876508bdd17ed765e64f6d5848 Parents: 2296021 Author: Aaron McCurry <[email protected]> Authored: Tue Aug 27 16:36:02 2013 -0400 Committer: Aaron McCurry <[email protected]> Committed: Tue Aug 27 16:36:02 2013 -0400 ---------------------------------------------------------------------- .../indexserver/DistributedIndexServer.java | 6 ++++++ .../apache/blur/manager/IndexManagerTest.java | 20 -------------------- .../org/apache/blur/thrift/BlurClusterTest.java | 4 ++++ 3 files changed, 10 insertions(+), 20 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/2d8055e1/blur-core/src/main/java/org/apache/blur/manager/indexserver/DistributedIndexServer.java ---------------------------------------------------------------------- diff --git a/blur-core/src/main/java/org/apache/blur/manager/indexserver/DistributedIndexServer.java b/blur-core/src/main/java/org/apache/blur/manager/indexserver/DistributedIndexServer.java index 4c836c6..6b7e942 100644 --- a/blur-core/src/main/java/org/apache/blur/manager/indexserver/DistributedIndexServer.java +++ b/blur-core/src/main/java/org/apache/blur/manager/indexserver/DistributedIndexServer.java @@ -296,6 +296,7 @@ public class DistributedIndexServer extends AbstractIndexServer { clearMapOfOldTables(_layoutManagers); clearMapOfOldTables(_layoutCache); clearMapOfOldTables(_tableSimilarity); + boolean closed = false; Map<String, Map<String, BlurIndex>> oldIndexesThatNeedToBeClosed = clearMapOfOldTables(_indexes); for (String table : oldIndexesThatNeedToBeClosed.keySet()) { Map<String, BlurIndex> indexes = oldIndexesThatNeedToBeClosed.get(table); @@ -308,6 +309,7 @@ public class DistributedIndexServer extends AbstractIndexServer { continue; } close(index, table, shard); + closed = true; } } for (String table : _indexes.keySet()) { @@ -323,9 +325,13 @@ public class DistributedIndexServer extends AbstractIndexServer { LOG.info("Closing index for table [{0}] shard [{1}]", table, shard); BlurIndex index = shardMap.remove(shard); close(index, table, shard); + closed = true; } } } + if (closed) { + TableContext.clear(); + } } }, _delay, _delay); } http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/2d8055e1/blur-core/src/test/java/org/apache/blur/manager/IndexManagerTest.java ---------------------------------------------------------------------- diff --git a/blur-core/src/test/java/org/apache/blur/manager/IndexManagerTest.java b/blur-core/src/test/java/org/apache/blur/manager/IndexManagerTest.java index d50a4f2..be4487e 100644 --- a/blur-core/src/test/java/org/apache/blur/manager/IndexManagerTest.java +++ b/blur-core/src/test/java/org/apache/blur/manager/IndexManagerTest.java @@ -906,15 +906,6 @@ public class IndexManagerTest { assertEquals("row should have one record", 1, fetchResult.rowResult.row.getRecordsSize()); } - @Test(expected = BlurException.class) - public void testMutationUpdateMissingRowDeleteRecord() throws Exception { - RecordMutation rm = newRecordMutation(DELETE_ENTIRE_RECORD, FAMILY, "record-101"); - - RowMutation rowMutation = newRowMutation(UPDATE_ROW, TABLE, "row-101", rm); - rowMutation.waitToBeVisible = true; - indexManager.mutate(rowMutation); - } - @Test public void testMutationUpdateRowReplaceExistingRecord() throws Exception { Column c1 = newColumn("testcol4", "value104"); @@ -987,17 +978,6 @@ public class IndexManagerTest { assertEquals("unmodified record should exist", 1, nonMatches); } - @Test(expected = BlurException.class) - public void testMutationUpdateMissingRowReplaceRecord() throws Exception { - Column c1 = newColumn("testcol1", "value104"); - Column c2 = newColumn("testcol2", "value105"); - Column c3 = newColumn("testcol3", "value105"); - String rec = "record-100"; - RecordMutation rm = newRecordMutation(REPLACE_ENTIRE_RECORD, FAMILY, rec, c1, c2, c3); - - updateAndFetchRecord("row-100", rec, rm); - } - @Test public void testMutationUpdateRowReplaceExistingColumns() throws Exception { Column c1 = newColumn("testcol1", "value999"); http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/2d8055e1/blur-core/src/test/java/org/apache/blur/thrift/BlurClusterTest.java ---------------------------------------------------------------------- diff --git a/blur-core/src/test/java/org/apache/blur/thrift/BlurClusterTest.java b/blur-core/src/test/java/org/apache/blur/thrift/BlurClusterTest.java index a766fa3..dac5851 100644 --- a/blur-core/src/test/java/org/apache/blur/thrift/BlurClusterTest.java +++ b/blur-core/src/test/java/org/apache/blur/thrift/BlurClusterTest.java @@ -49,6 +49,7 @@ import org.apache.blur.thrift.generated.ErrorType; import org.apache.blur.thrift.generated.Query; import org.apache.blur.thrift.generated.RecordMutation; import org.apache.blur.thrift.generated.RowMutation; +import org.apache.blur.thrift.generated.Schema; import org.apache.blur.thrift.generated.TableDescriptor; import org.apache.blur.thrift.util.BlurThriftHelper; import org.apache.blur.utils.GCWatcher; @@ -149,6 +150,9 @@ public class BlurClusterTest { BlurResults resultsRecord = client.query("test", blurQueryRecord); assertRecordResults(resultsRecord); assertEquals(length, resultsRecord.getTotalResults()); + + Schema schema = client.schema("test"); + assertFalse(schema.getFamilies().isEmpty()); } @Test
