@Test public void testCreate() throws Exception { SdmxSource source = new GuessingCompactFactory().create(load("/sdmx-compact-sample.xml")); assertEquals(4, source.items.size()); SdmxSeries s0 = (SdmxSeries) source.items.get(0); assertEquals("COLLECTION=B, FREQ=M, JD_CATEGORY=A, JD_TYPE=P, VIS_CTY=MX", s0.id); assertEquals(12, s0.data.get().getObsCount()); assertEquals(TsFrequency.Monthly, s0.data.get().getFrequency()); assertEquals(new TsPeriod(TsFrequency.Monthly, 2000, 0), s0.data.get().getStart()); assertEquals(new TsPeriod(TsFrequency.Monthly, 2000, 11), s0.data.get().getLastPeriod()); assertArrayEquals(new double[]{3.14, 2.29, 3.14, 5.24, 3.14, 3.78, 3.65, 2.37, 3.14, 3.17, 3.34, 1.21}, s0.data.get().internalStorage(), 0); SdmxSeries s1 = (SdmxSeries) source.items.get(1); assertEquals("COLLECTION=B, FREQ=A, JD_CATEGORY=A, JD_TYPE=P, VIS_CTY=MX", s1.id); assertEquals(1, s1.data.get().getObsCount()); assertEquals(TsFrequency.Yearly, s1.data.get().getFrequency()); assertEquals(new TsPeriod(TsFrequency.Yearly, 2000, 0), s1.data.get().getStart()); assertEquals(s1.data.get().getStart(), s1.data.get().getLastPeriod()); assertArrayEquals(new double[]{3.14}, s1.data.get().internalStorage(), 0); }
@Override public SdmxSource create(Document doc) { Optional<Node> dataSetNode = lookupDataSetNode(doc); return new SdmxSource(SdmxSource.Type.COMPACT, getSdmxItems(dataSetNode.get(), new GregorianCalendar())); }
GuessingCompactFactory extends AbstractDocumentFactory { @Override public SdmxSource create(Document doc) { Optional<Node> dataSetNode = lookupDataSetNode(doc); return new SdmxSource(SdmxSource.Type.COMPACT, getSdmxItems(dataSetNode.get(), new GregorianCalendar())); } }
GuessingCompactFactory extends AbstractDocumentFactory { @Override public SdmxSource create(Document doc) { Optional<Node> dataSetNode = lookupDataSetNode(doc); return new SdmxSource(SdmxSource.Type.COMPACT, getSdmxItems(dataSetNode.get(), new GregorianCalendar())); }  }
GuessingCompactFactory extends AbstractDocumentFactory { @Override public SdmxSource create(Document doc) { Optional<Node> dataSetNode = lookupDataSetNode(doc); return new SdmxSource(SdmxSource.Type.COMPACT, getSdmxItems(dataSetNode.get(), new GregorianCalendar())); }  @Override String getName(); @Override boolean isValid(Document doc); @Override SdmxSource create(Document doc); }
GuessingCompactFactory extends AbstractDocumentFactory { @Override public SdmxSource create(Document doc) { Optional<Node> dataSetNode = lookupDataSetNode(doc); return new SdmxSource(SdmxSource.Type.COMPACT, getSdmxItems(dataSetNode.get(), new GregorianCalendar())); }  @Override String getName(); @Override boolean isValid(Document doc); @Override SdmxSource create(Document doc);  }