@Test public void testGetChildren20() throws Exception { DbAccessor<?> accessor = new DotStatAccessor(nbbBean(), supplier); assertArrayEquals(new String[] {"LOCSTL04"}, accessor.getChildren().toArray()); assertArrayEquals(new String[] {"AUS"}, accessor.getChildren("LOCSTL04").toArray()); assertArrayEquals(new String[] {"M"}, accessor.getChildren("LOCSTL04", "AUS").toArray()); }
@Test public void testGetSeriesWithData21() throws Exception { DbAccessor<?> accessor = new DotStatAccessor(ecbBean(), supplier); DbSetId single = ecbRoot().child("A", "DEU", "1", "0", "319", "0", "UBLGE"); DbSeries series = accessor.getSeriesWithData("A", "DEU", "1", "0", "319", "0", "UBLGE"); assertEquals(single, series.getId()); TsData data = series.getData().get(); assertEquals(new TsPeriod(TsFrequency.Yearly, 1991, 0), data.getStart()); assertEquals(new TsPeriod(TsFrequency.Yearly, 2015, 0), data.getLastPeriod()); assertEquals(25, data.getLength()); assertEquals(25, data.getObsCount()); assertEquals(-2.8574221, data.getValues().get(0), 0d); assertEquals(-0.1420473, data.getValues().get(24), 0d); }
@Test public void testGetAllSeriesWithData21() throws Exception { DbAccessor<?> accessor = new DotStatAccessor(ecbBean(), supplier); List<DbSeries> allSeries; DbSetId item = ecbRoot().child("A", "DEU", "1", "0", "319", "0", "UBLGE"); allSeries = accessor.getAllSeriesWithData(); assertEquals(120, allSeries.size()); assertNotNull(DbSeries.findById(allSeries, item)); assertEquals(25, DbSeries.findById(allSeries, item).getData().get().getLength()); allSeries = accessor.getAllSeriesWithData("A", "DEU"); assertEquals(4, allSeries.size()); assertNotNull(DbSeries.findById(allSeries, item)); assertEquals(25, DbSeries.findById(allSeries, item).getData().get().getLength()); }
@Test public void testGetSeriesWithData20() throws Exception { DbAccessor<?> accessor = new DotStatAccessor(nbbBean(), supplier); DbSetId single = nbbRoot().child("LOCSTL04", "AUS", "M"); DbSeries series = accessor.getSeriesWithData("LOCSTL04", "AUS", "M"); assertEquals(single, series.getId()); TsData data = series.getData().get(); assertEquals(new TsPeriod(TsFrequency.Monthly, 1966, 1), data.getStart()); assertEquals(new TsPeriod(TsFrequency.Monthly, 1970, 7), data.getLastPeriod()); assertEquals(55, data.getLength()); assertEquals(54, data.getObsCount()); assertTrue(data.isMissing(50)); // 1970-04 assertEquals(98.68823, data.getValues().get(0), 0d); assertEquals(101.1945, data.getValues().get(54), 0d); }
@Test public void testGetAllSeries20() throws Exception { DbAccessor<?> accessor = new DotStatAccessor(nbbBean(), supplier); List<DbSetId> allSeries; DbSetId single = nbbRoot().child("LOCSTL04", "AUS", "M"); allSeries = accessor.getAllSeries(); assertEquals(1, allSeries.size()); assertEquals(single, allSeries.get(0)); allSeries = accessor.getAllSeries("LOCSTL04"); assertEquals(1, allSeries.size()); assertEquals(single, allSeries.get(0)); allSeries = accessor.getAllSeries("LOCSTL04", "AUS"); assertEquals(1, allSeries.size()); assertEquals(single, allSeries.get(0)); }
@Test public void testGetChildren21() throws Exception { DbAccessor<?> accessor = new DotStatAccessor(ecbBean(), supplier); List<String> children; children = accessor.getChildren(); assertEquals(1, children.size()); assertTrue(children.contains("A")); children = accessor.getChildren("A"); assertEquals(30, children.size()); assertTrue(children.contains("BEL")); assertTrue(children.contains("POL")); children = accessor.getChildren("A", "BEL"); assertEquals(1, children.size()); assertTrue(children.contains("1")); children = accessor.getChildren("hello"); assertTrue(children.isEmpty()); }
@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"))); }