DomGarguilo commented on code in PR #2910: URL: https://github.com/apache/accumulo/pull/2910#discussion_r960850160
########## test/src/main/java/org/apache/accumulo/test/TableOperationsIT.java: ########## @@ -292,4 +295,59 @@ public void testCompactEmptyTablesWithBadIterator_FailsAndCancel() throws TableE } } + @Test + public void getTimeTypeTest() throws TableNotFoundException, AccumuloException, + TableExistsException, AccumuloSecurityException { + String[] tableNames = getUniqueNames(4); + + // Create table with default MILLIS TimeType + accumuloClient.tableOperations().create(tableNames[0]); + TimeType timeType = accumuloClient.tableOperations().getTimeType(tableNames[0]); + assertEquals(TimeType.MILLIS, timeType); + + // Create table with LOGICAL TimeType. + NewTableConfiguration ntc = new NewTableConfiguration(); + ntc.setTimeType(TimeType.LOGICAL); + accumuloClient.tableOperations().create(tableNames[1], ntc); + timeType = accumuloClient.tableOperations().getTimeType(tableNames[1]); + assertEquals(TimeType.LOGICAL, timeType); + + // Create some split points + SortedSet<Text> splits = new TreeSet<>(); + splits.add(new Text("F")); + splits.add(new Text("M")); + splits.add(new Text("S")); + + // Create table with MILLIS TimeType. Use splits to create multiple tablets + ntc = new NewTableConfiguration(); + ntc.withSplits(splits); + accumuloClient.tableOperations().create(tableNames[2], ntc); Review Comment: Maybe a note could be added to the comment about `TimeType.MILLIS` being the default for ntc and/or another test case could be added which explicitly calls `ntc.setTimeType(TimeType.MILLIS);` ########## test/src/main/java/org/apache/accumulo/test/TableOperationsIT.java: ########## @@ -292,4 +295,59 @@ public void testCompactEmptyTablesWithBadIterator_FailsAndCancel() throws TableE } } + @Test + public void getTimeTypeTest() throws TableNotFoundException, AccumuloException, + TableExistsException, AccumuloSecurityException { + String[] tableNames = getUniqueNames(4); + + // Create table with default MILLIS TimeType + accumuloClient.tableOperations().create(tableNames[0]); + TimeType timeType = accumuloClient.tableOperations().getTimeType(tableNames[0]); + assertEquals(TimeType.MILLIS, timeType); + + // Create table with LOGICAL TimeType. + NewTableConfiguration ntc = new NewTableConfiguration(); + ntc.setTimeType(TimeType.LOGICAL); + accumuloClient.tableOperations().create(tableNames[1], ntc); + timeType = accumuloClient.tableOperations().getTimeType(tableNames[1]); + assertEquals(TimeType.LOGICAL, timeType); + + // Create some split points + SortedSet<Text> splits = new TreeSet<>(); + splits.add(new Text("F")); + splits.add(new Text("M")); + splits.add(new Text("S")); + + // Create table with MILLIS TimeType. Use splits to create multiple tablets + ntc = new NewTableConfiguration(); + ntc.withSplits(splits); + accumuloClient.tableOperations().create(tableNames[2], ntc); + timeType = accumuloClient.tableOperations().getTimeType(tableNames[2]); + assertEquals(TimeType.MILLIS, timeType); + + // Create table with LOGICAL TimeType. Use splits to create multiple tablets + ntc = new NewTableConfiguration(); + ntc.setTimeType(TimeType.LOGICAL).withSplits(splits); + accumuloClient.tableOperations().create(tableNames[3], ntc); + timeType = accumuloClient.tableOperations().getTimeType(tableNames[3]); + assertEquals(TimeType.LOGICAL, timeType); + + // check system tables + timeType = accumuloClient.tableOperations().getTimeType("accumulo.metadata"); + assertEquals(TimeType.LOGICAL, timeType); + + timeType = accumuloClient.tableOperations().getTimeType("accumulo.replication"); + assertEquals(TimeType.LOGICAL, timeType); + + // test non-existent table + assertThrows(TableNotFoundException.class, + () -> accumuloClient.tableOperations().getTimeType("notatable"), + "specified table that doesn't exist"); + + // cannot get TimeType for root table + assertThrows(RuntimeException.class, Review Comment: ```suggestion assertThrows(IllegalArgumentException.class, ``` This could be narrowed down I think -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@accumulo.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org