@Test public void testGetAllSeries21() throws Exception { DbAccessor<?> accessor = new DotStatAccessor(ecbBean(), supplier); List<DbSetId> allSeries; DbSetId root = ecbRoot(); allSeries = accessor.getAllSeries(); assertEquals(120, allSeries.size()); assertTrue(allSeries.contains(root.child("A", "DEU", "1", "0", "319", "0", "UBLGE"))); assertTrue(allSeries.contains(root.child("A", "HRV", "1", "0", "0", "0", "ZUTN"))); for (DbSetId o : allSeries) { assertTrue(o.isSeries()); } allSeries = accessor.getAllSeries("A"); assertEquals(120, allSeries.size()); allSeries = accessor.getAllSeries("A", "DEU"); assertEquals(4, allSeries.size()); assertTrue(allSeries.contains(root.child("A", "DEU", "1", "0", "319", "0", "UBLGE"))); assertFalse(allSeries.contains(root.child("A", "HRV", "1", "0", "0", "0", "ZUTN"))); }
@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)); }