AnnotationUtils { public static ParamInfo<String> tableAliasParamKey(String name) { Wrapper<BaseDB> db = DB_CLASSES.get(name); Preconditions.checkState(db != null, "No DB named %s", name); return tableAliasParamKey(db.clazz); }  static String annotatedName(Class<?> clazz); static String annotatedAlias(Class<? extends BaseDB> cls); static String annotatedAlias(String name); static IOType annotatedIoType(Class<? extends AlgoOperator> cls); static ParamInfo<String> tableAliasParamKey(String name); static ParamInfo<String> tableAliasParamKey(Class<? extends BaseDB> dbClazz); static ParamInfo<String> dynamicParamKey(String key); static List<String> allDBAndOpNames(); static List<String> allFileSystemNames(); static BaseDB createDB(String name, Params parameter); static BaseFileSystem<?> createFileSystem(String name, Params parameter); static boolean isDB(String name); static boolean isDBHasTimestamp(String name); static boolean isIoOpHasTimestamp(String name, IOType type); static boolean isFileSystem(String name); static AlgoOperator createOp(String name, IOType type, Params parameter);  }
@Test public void testGetTableAliasParamKeyByName() { ParamInfo<String> param = AnnotationUtils.tableAliasParamKey("test_fake_db_1"); Assert.assertEquals("DbKey: tableName", param.getDescription()); Assert.assertEquals("tableName", param.getName()); param = AnnotationUtils.tableAliasParamKey("test_fake_db_2"); Assert.assertEquals("DbKey: topic", param.getDescription()); Assert.assertEquals("topic", param.getName()); }
@Test(expected = IllegalStateException.class) public void testGetTableAliasParamKeyByNameError() { AnnotationUtils.tableAliasParamKey("A_DB_HAS_NO_NAME"); }
@Test public void testGetTableAliasParamKeyByClass() { ParamInfo<String> param = AnnotationUtils.tableAliasParamKey(FakeDB1.class); Assert.assertEquals("DbKey: tableName", param.getDescription()); Assert.assertEquals("tableName", param.getName()); param = AnnotationUtils.tableAliasParamKey(FakeDB2.class); Assert.assertEquals("DbKey: topic", param.getDescription()); Assert.assertEquals("topic", param.getName()); }
@Test(expected = IllegalStateException.class) public void testGetTableAliasParamKeyByClassError() { AnnotationUtils.tableAliasParamKey(FakeDB3.class); }