@Test public void testGetHiveSpecs() throws IOException { State state = new State(); this.path = new Path(getClass().getResource("/test-hive-table/snapshot1").toString()); Collection<HiveSpec> specs = new HiveSnapshotRegistrationPolicy(state).getHiveSpecs(this.path); Assert.assertEquals(specs.size(), 0); this.path = new Path(getClass().getResource("/test-hive-table/").toString()); Assert.assertEquals(specs.size(), 0); state.appendToListProp(HiveRegistrationPolicyBase.HIVE_DATABASE_NAME, "db1"); state.appendToListProp(HiveRegistrationPolicyBase.ADDITIONAL_HIVE_DATABASE_NAMES, "db2"); state.appendToListProp(HiveRegistrationPolicyBase.HIVE_TABLE_NAME, "tbl1"); state.appendToListProp(HiveRegistrationPolicyBase.ADDITIONAL_HIVE_TABLE_NAMES, "tbl2,tbl3"); specs = new HiveSnapshotRegistrationPolicy(state).getHiveSpecs(this.path); Assert.assertEquals(specs.size(), 6); Iterator<HiveSpec> iterator = specs.iterator(); HiveSpec spec = iterator.next(); examine(spec, "db1", "tbl1"); spec = iterator.next(); examine(spec, "db1", "tbl2"); spec = iterator.next(); examine(spec, "db1", "tbl3"); spec = iterator.next(); examine(spec, "db2", "tbl1"); spec = iterator.next(); examine(spec, "db2", "tbl2"); spec = iterator.next(); examine(spec, "db2", "tbl3"); }
@Override public Collection<HiveSpec> getHiveSpecs(Path path) throws IOException { List<HiveTable> tables = getTables(path); if (tables.isEmpty()) { return ImmutableList.<HiveSpec> of(); } Collection<HiveSpec> specs = Lists.newArrayList(); for (HiveTable table : tables) { specs.add(new SimpleHiveSpec.Builder<>(path).withTable(table).withPartition(getPartition(path, table)).build()); } return specs; }
HiveSnapshotRegistrationPolicy extends HiveRegistrationPolicyBase { @Override public Collection<HiveSpec> getHiveSpecs(Path path) throws IOException { List<HiveTable> tables = getTables(path); if (tables.isEmpty()) { return ImmutableList.<HiveSpec> of(); } Collection<HiveSpec> specs = Lists.newArrayList(); for (HiveTable table : tables) { specs.add(new SimpleHiveSpec.Builder<>(path).withTable(table).withPartition(getPartition(path, table)).build()); } return specs; } }
HiveSnapshotRegistrationPolicy extends HiveRegistrationPolicyBase { @Override public Collection<HiveSpec> getHiveSpecs(Path path) throws IOException { List<HiveTable> tables = getTables(path); if (tables.isEmpty()) { return ImmutableList.<HiveSpec> of(); } Collection<HiveSpec> specs = Lists.newArrayList(); for (HiveTable table : tables) { specs.add(new SimpleHiveSpec.Builder<>(path).withTable(table).withPartition(getPartition(path, table)).build()); } return specs; } protected  HiveSnapshotRegistrationPolicy(State props); }
HiveSnapshotRegistrationPolicy extends HiveRegistrationPolicyBase { @Override public Collection<HiveSpec> getHiveSpecs(Path path) throws IOException { List<HiveTable> tables = getTables(path); if (tables.isEmpty()) { return ImmutableList.<HiveSpec> of(); } Collection<HiveSpec> specs = Lists.newArrayList(); for (HiveTable table : tables) { specs.add(new SimpleHiveSpec.Builder<>(path).withTable(table).withPartition(getPartition(path, table)).build()); } return specs; } protected  HiveSnapshotRegistrationPolicy(State props); @Override Collection<HiveSpec> getHiveSpecs(Path path); }
HiveSnapshotRegistrationPolicy extends HiveRegistrationPolicyBase { @Override public Collection<HiveSpec> getHiveSpecs(Path path) throws IOException { List<HiveTable> tables = getTables(path); if (tables.isEmpty()) { return ImmutableList.<HiveSpec> of(); } Collection<HiveSpec> specs = Lists.newArrayList(); for (HiveTable table : tables) { specs.add(new SimpleHiveSpec.Builder<>(path).withTable(table).withPartition(getPartition(path, table)).build()); } return specs; } protected  HiveSnapshotRegistrationPolicy(State props); @Override Collection<HiveSpec> getHiveSpecs(Path path); static final String SNAPSHOT_PATH_PATTERN; }