@Test public void testTypeName() throws Exception { this.urlMock = PowerMockito.mock(URL.class); this.clientMock = PowerMockito.mock(HttpURLConnection.class); PowerMockito.whenNew(URL.class).withAnyArguments().thenReturn(this.urlMock); PowerMockito.when(this.urlMock.toURI()).thenReturn(new URI(Helper.URL)); PowerMockito.when(this.urlMock.openConnection(anyObject())).thenReturn(this.clientMock); when(clientMock.getResponseCode()) .thenReturn(HttpStatus.SC_OK) .thenReturn(HttpStatus.SC_OK) .thenReturn(HttpStatus.SC_OK); when(clientMock.getInputStream()) .thenReturn(Helper.readXMLAsStream("test-data/abs.xml")) .thenReturn(Helper.readXMLAsStream("test-data/abs-census2011-t04-abs.xml")) .thenReturn(Helper.readXMLAsStream("test-data/abs-seifa-lga.xml")); this.dataStore = (SDMXDataStore) Helper.createSDMXTestDataStore(); List<Name> names = this.dataStore.createTypeNames(); assertEquals(4, names.size()); assertTrue(names.contains(new NameImpl(Helper.NAMESPACE, Helper.T04))); assertTrue(names.contains(new NameImpl(Helper.NAMESPACE, Helper.T04_DIMENSIONS))); assertNotNull(this.dataStore.getEntry(new NameImpl(Helper.NAMESPACE, Helper.T04))); assertTrue(names.contains(new NameImpl(Helper.NAMESPACE, Helper.SEIFA_LGA))); assertTrue(names.contains(new NameImpl(Helper.NAMESPACE, Helper.SEIFA_LGA_DIMENSIONS))); assertNotNull(this.dataStore.getEntry(new NameImpl(Helper.NAMESPACE, Helper.SEIFA_LGA))); }
@Override protected List<Name> createTypeNames() { if (this.entries.isEmpty() == false) { return new ArrayList<Name>(this.entries.keySet()); } try { dataflows = this.sdmxClient.getDataflows(); } catch (SdmxException e) { LOGGER.log(Level.SEVERE, "Error while getting dataflows", e); return new ArrayList<Name>(); } List<GetDataFlowStructureTask> tasks = new ArrayList<GetDataFlowStructureTask>(); dataflows.forEach( (s, d) -> { tasks.add(new GetDataFlowStructureTask(this, s, d)); }); this.dataflowStructures.clear(); ExecutorService executorService = Executors.newFixedThreadPool(this.getConcurrency()); try { executorService.invokeAll(tasks, SDMXDataStore.TIMEOUT, TimeUnit.SECONDS); } catch (InterruptedException e) { LOGGER.log(Level.SEVERE, "Timeout error getting SDMX DSD", e); } executorService.shutdownNow(); return new ArrayList<Name>(this.entries.keySet()); }
SDMXDataStore extends ContentDataStore { @Override protected List<Name> createTypeNames() { if (this.entries.isEmpty() == false) { return new ArrayList<Name>(this.entries.keySet()); } try { dataflows = this.sdmxClient.getDataflows(); } catch (SdmxException e) { LOGGER.log(Level.SEVERE, "Error while getting dataflows", e); return new ArrayList<Name>(); } List<GetDataFlowStructureTask> tasks = new ArrayList<GetDataFlowStructureTask>(); dataflows.forEach( (s, d) -> { tasks.add(new GetDataFlowStructureTask(this, s, d)); }); this.dataflowStructures.clear(); ExecutorService executorService = Executors.newFixedThreadPool(this.getConcurrency()); try { executorService.invokeAll(tasks, SDMXDataStore.TIMEOUT, TimeUnit.SECONDS); } catch (InterruptedException e) { LOGGER.log(Level.SEVERE, "Timeout error getting SDMX DSD", e); } executorService.shutdownNow(); return new ArrayList<Name>(this.entries.keySet()); } }
SDMXDataStore extends ContentDataStore { @Override protected List<Name> createTypeNames() { if (this.entries.isEmpty() == false) { return new ArrayList<Name>(this.entries.keySet()); } try { dataflows = this.sdmxClient.getDataflows(); } catch (SdmxException e) { LOGGER.log(Level.SEVERE, "Error while getting dataflows", e); return new ArrayList<Name>(); } List<GetDataFlowStructureTask> tasks = new ArrayList<GetDataFlowStructureTask>(); dataflows.forEach( (s, d) -> { tasks.add(new GetDataFlowStructureTask(this, s, d)); }); this.dataflowStructures.clear(); ExecutorService executorService = Executors.newFixedThreadPool(this.getConcurrency()); try { executorService.invokeAll(tasks, SDMXDataStore.TIMEOUT, TimeUnit.SECONDS); } catch (InterruptedException e) { LOGGER.log(Level.SEVERE, "Timeout error getting SDMX DSD", e); } executorService.shutdownNow(); return new ArrayList<Name>(this.entries.keySet()); } SDMXDataStore(
            String namespaceIn, String provider, Integer concurrency, String user, String password); }
SDMXDataStore extends ContentDataStore { @Override protected List<Name> createTypeNames() { if (this.entries.isEmpty() == false) { return new ArrayList<Name>(this.entries.keySet()); } try { dataflows = this.sdmxClient.getDataflows(); } catch (SdmxException e) { LOGGER.log(Level.SEVERE, "Error while getting dataflows", e); return new ArrayList<Name>(); } List<GetDataFlowStructureTask> tasks = new ArrayList<GetDataFlowStructureTask>(); dataflows.forEach( (s, d) -> { tasks.add(new GetDataFlowStructureTask(this, s, d)); }); this.dataflowStructures.clear(); ExecutorService executorService = Executors.newFixedThreadPool(this.getConcurrency()); try { executorService.invokeAll(tasks, SDMXDataStore.TIMEOUT, TimeUnit.SECONDS); } catch (InterruptedException e) { LOGGER.log(Level.SEVERE, "Timeout error getting SDMX DSD", e); } executorService.shutdownNow(); return new ArrayList<Name>(this.entries.keySet()); } SDMXDataStore(
            String namespaceIn, String provider, Integer concurrency, String user, String password); int getConcurrency(); void setConcurrency(int concurrency); static String composeDataflowTypeName(String dfName); static String composeDimensionTypeName(String dfName); static boolean isDataflowName(String typeName); static boolean isDimensionName(String typeName); static String extractDataflowName(String typeName); URL getNamespace(); GenericSDMXClient getSDMXClient(); DataFlowStructure getDataFlowStructure(String name); @Override void dispose(); }
SDMXDataStore extends ContentDataStore { @Override protected List<Name> createTypeNames() { if (this.entries.isEmpty() == false) { return new ArrayList<Name>(this.entries.keySet()); } try { dataflows = this.sdmxClient.getDataflows(); } catch (SdmxException e) { LOGGER.log(Level.SEVERE, "Error while getting dataflows", e); return new ArrayList<Name>(); } List<GetDataFlowStructureTask> tasks = new ArrayList<GetDataFlowStructureTask>(); dataflows.forEach( (s, d) -> { tasks.add(new GetDataFlowStructureTask(this, s, d)); }); this.dataflowStructures.clear(); ExecutorService executorService = Executors.newFixedThreadPool(this.getConcurrency()); try { executorService.invokeAll(tasks, SDMXDataStore.TIMEOUT, TimeUnit.SECONDS); } catch (InterruptedException e) { LOGGER.log(Level.SEVERE, "Timeout error getting SDMX DSD", e); } executorService.shutdownNow(); return new ArrayList<Name>(this.entries.keySet()); } SDMXDataStore(
            String namespaceIn, String provider, Integer concurrency, String user, String password); int getConcurrency(); void setConcurrency(int concurrency); static String composeDataflowTypeName(String dfName); static String composeDimensionTypeName(String dfName); static boolean isDataflowName(String typeName); static boolean isDimensionName(String typeName); static String extractDataflowName(String typeName); URL getNamespace(); GenericSDMXClient getSDMXClient(); DataFlowStructure getDataFlowStructure(String name); @Override void dispose(); static String MEASURE_KEY; static String REGION_KEY; static String TIME_KEY; static String CODE_KEY; static String DESCRIPTION_KEY; static String ALLCODES_EXP; static String OR_EXP; static String SEPARATOR_EXP; static String SEPARATOR_DIM; static String GEOMETRY_ATTR; static String SEPARATOR_FEATURETYPE; static String COMMA_REPLACEMENT; static String DOT_REPLACEMENT; static String DIMENSIONS_SUFFIX; static String FEATURETYPE_SUFFIX; static String DIMENSIONS_EXPR; static String DIMENSIONS_EXPR_ALL; static int TIMEOUT; static int ERROR_NORESULTS; }