@Test public void testEnsemblFetchVariationEntry() throws IOException, ExternalDbUnavailableException, InterruptedException { String fetchRes = readFile("ensembl_summary_variation_rs7412.json"); Mockito.when( httpDataManager.fetchData(Mockito.any(), Mockito.any(ParameterNameValue[].class)) ).thenReturn(fetchRes); EnsemblVariationEntryVO ensemblVariationEntryVO = ensemblDataManager.fetchVariationEntry("rs7412", "human"); Assert.assertNotNull(ensemblVariationEntryVO); Assert.assertEquals("rs7412", ensemblVariationEntryVO.getName()); Assert.assertEquals(new Double("0.0750799"), ensemblVariationEntryVO.getMaf()); Assert.assertEquals("Y", ensemblVariationEntryVO.getAmbiguity()); Assert.assertEquals("SNP", ensemblVariationEntryVO.getVarClass()); Assert.assertEquals("C", ensemblVariationEntryVO.getAncestralAllele()); Assert.assertEquals("T", ensemblVariationEntryVO.getMinorAllele()); Assert.assertEquals("missense_variant", ensemblVariationEntryVO.getMostSevereConsequence()); }
public EnsemblVariationEntryVO fetchVariationEntry(String variationId, String species) throws ExternalDbUnavailableException { ParameterNameValue[] params = new ParameterNameValue[]{ new ParameterNameValue(CONTENT_TYPE, APPLICATION_JSON), new ParameterNameValue(ENSEMBL_EXPAND_TOOL, "1")}; String location = String.format("%s%s/%s/%s?", ENSEMBL_SERVER, ENSEMBL_VARIATION_TOOL, species, variationId); String variationData = httpDataManager.fetchData(location, params); try { return objectMapper.readValue(variationData, EnsemblVariationEntryVO.class); } catch (IOException e) { throw new ExternalDbUnavailableException(MessageHelper.getMessage(MessagesConstants.ERROR_NO_DATA_FOR_URL, location), e); } }
EnsemblDataManager { public EnsemblVariationEntryVO fetchVariationEntry(String variationId, String species) throws ExternalDbUnavailableException { ParameterNameValue[] params = new ParameterNameValue[]{ new ParameterNameValue(CONTENT_TYPE, APPLICATION_JSON), new ParameterNameValue(ENSEMBL_EXPAND_TOOL, "1")}; String location = String.format("%s%s/%s/%s?", ENSEMBL_SERVER, ENSEMBL_VARIATION_TOOL, species, variationId); String variationData = httpDataManager.fetchData(location, params); try { return objectMapper.readValue(variationData, EnsemblVariationEntryVO.class); } catch (IOException e) { throw new ExternalDbUnavailableException(MessageHelper.getMessage(MessagesConstants.ERROR_NO_DATA_FOR_URL, location), e); } } }
EnsemblDataManager { public EnsemblVariationEntryVO fetchVariationEntry(String variationId, String species) throws ExternalDbUnavailableException { ParameterNameValue[] params = new ParameterNameValue[]{ new ParameterNameValue(CONTENT_TYPE, APPLICATION_JSON), new ParameterNameValue(ENSEMBL_EXPAND_TOOL, "1")}; String location = String.format("%s%s/%s/%s?", ENSEMBL_SERVER, ENSEMBL_VARIATION_TOOL, species, variationId); String variationData = httpDataManager.fetchData(location, params); try { return objectMapper.readValue(variationData, EnsemblVariationEntryVO.class); } catch (IOException e) { throw new ExternalDbUnavailableException(MessageHelper.getMessage(MessagesConstants.ERROR_NO_DATA_FOR_URL, location), e); } }  }
EnsemblDataManager { public EnsemblVariationEntryVO fetchVariationEntry(String variationId, String species) throws ExternalDbUnavailableException { ParameterNameValue[] params = new ParameterNameValue[]{ new ParameterNameValue(CONTENT_TYPE, APPLICATION_JSON), new ParameterNameValue(ENSEMBL_EXPAND_TOOL, "1")}; String location = String.format("%s%s/%s/%s?", ENSEMBL_SERVER, ENSEMBL_VARIATION_TOOL, species, variationId); String variationData = httpDataManager.fetchData(location, params); try { return objectMapper.readValue(variationData, EnsemblVariationEntryVO.class); } catch (IOException e) { throw new ExternalDbUnavailableException(MessageHelper.getMessage(MessagesConstants.ERROR_NO_DATA_FOR_URL, location), e); } }  EnsemblEntryVO fetchEnsemblEntry(String geneId); EnsemblVariationEntryVO fetchVariationEntry(String variationId, String species); List<EnsemblEntryVO> fetchVariationsOnRegion(String species, String chromosome,
                                                        String start, String finish); }
EnsemblDataManager { public EnsemblVariationEntryVO fetchVariationEntry(String variationId, String species) throws ExternalDbUnavailableException { ParameterNameValue[] params = new ParameterNameValue[]{ new ParameterNameValue(CONTENT_TYPE, APPLICATION_JSON), new ParameterNameValue(ENSEMBL_EXPAND_TOOL, "1")}; String location = String.format("%s%s/%s/%s?", ENSEMBL_SERVER, ENSEMBL_VARIATION_TOOL, species, variationId); String variationData = httpDataManager.fetchData(location, params); try { return objectMapper.readValue(variationData, EnsemblVariationEntryVO.class); } catch (IOException e) { throw new ExternalDbUnavailableException(MessageHelper.getMessage(MessagesConstants.ERROR_NO_DATA_FOR_URL, location), e); } }  EnsemblEntryVO fetchEnsemblEntry(String geneId); EnsemblVariationEntryVO fetchVariationEntry(String variationId, String species); List<EnsemblEntryVO> fetchVariationsOnRegion(String species, String chromosome,
                                                        String start, String finish);  }