@Test public void testGetKeyFromTs() throws Exception { try (DataCursor cursor = nbb.AsConnection().getData(new FlowRef("NBB", "TEST_DATASET", null), Key.ALL, true)) { cursor.nextSeries(); assertEquals(Key.parse("LOCSTL04.AUS.M"), cursor.getKey()); } }
@Test public void testGetKey() throws Exception { DataStructure dfs = nbb.AsConnection().getDataStructure(new FlowRef("NBB", "TEST_DATASET", null)); Map<String, Dimension> dimensionById = DotStatAccessor.dimensionById(dfs); // default ordering of dimensions DbSetId r1 = DbSetId.root("SUBJECT", "LOCATION", "FREQUENCY"); assertEquals( Key.parse("LOCSTL04.AUS.M"), getKey(dimensionById, r1.child("LOCSTL04", "AUS", "M"))); assertEquals(Key.parse("LOCSTL04.AUS."), getKey(dimensionById, r1.child("LOCSTL04", "AUS"))); assertEquals(Key.parse("LOCSTL04.."), getKey(dimensionById, r1.child("LOCSTL04"))); assertEquals(Key.ALL, getKey(dimensionById, r1)); // custom ordering of dimensions DbSetId r2 = DbSetId.root("FREQUENCY", "LOCATION", "SUBJECT"); assertEquals( Key.parse("LOCSTL04.AUS.M"), getKey(dimensionById, r2.child("M", "AUS", "LOCSTL04"))); assertEquals(Key.parse(".AUS.M"), getKey(dimensionById, r2.child("M", "AUS"))); assertEquals(Key.parse("..M"), getKey(dimensionById, r2.child("M"))); assertEquals(Key.ALL, getKey(dimensionById, r2)); }