@Test public void testParseMapPdp() throws IOException, ExternalDbUnavailableException, InterruptedException, JAXBException { String fetchRes = readFile("pbd_map_id_2k8d.xml"); Mockito.when( httpDataManager.fetchData(Mockito.any(String.class), Mockito.any(ParameterNameValue[].class)) ).thenReturn(fetchRes); final Dasalignment dataset = pdbDataManager.fetchPdbMapEntry("2K8F"); Assert.assertNotNull(dataset); Assert.assertNotNull(dataset.getAlignment()); final List<Alignment> alignmentList = dataset.getAlignment(); Assert.assertFalse(alignmentList.isEmpty()); final Alignment alignment = alignmentList.get(0); Assert.assertNotNull(alignment); Assert.assertFalse(alignment.getBlock().isEmpty()); Assert.assertNotNull(alignment.getBlock()); final PdbBlock pdbBlock = alignment.getBlock().get(0); Assert.assertNotNull(pdbBlock); Assert.assertNotNull(pdbBlock.getSegment()); Assert.assertFalse(pdbBlock.getSegment().isEmpty()); final Segment segment = pdbBlock.getSegment().get(0); Assert.assertNotNull(segment); Assert.assertNotNull(segment.getIntObjectId()); Assert.assertNotNull(segment.getStart()); Assert.assertNotNull(segment.getEnd()); }
public Dasalignment fetchPdbMapEntry(final String pdbIds) throws ExternalDbUnavailableException { ParameterNameValue[] params = new ParameterNameValue[]{new ParameterNameValue("query", pdbIds)}; String location = RCSB_SERVER + RCSB_PDP_MAP_TOOL + "?"; String rcsbpbdData = httpDataManager.fetchData(location, params); try { JAXBContext jaxbContext = JAXBContext .newInstance("com.epam.catgenome.manager.externaldb.bindings.ecsbpdbmap"); Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); StringReader reader = new StringReader(rcsbpbdData); Object pdbObject = unmarshaller.unmarshal(reader); Dasalignment fetchedDasalignmentData = null; if (pdbObject instanceof Dasalignment) { fetchedDasalignmentData = (Dasalignment) pdbObject; } return fetchedDasalignmentData; } catch (JAXBException e) { throw new ExternalDbUnavailableException(MessageHelper.getMessage(MessagesConstants .ERROR_UNEXPECTED_FORMAT, location), e); } }
PdbDataManager { public Dasalignment fetchPdbMapEntry(final String pdbIds) throws ExternalDbUnavailableException { ParameterNameValue[] params = new ParameterNameValue[]{new ParameterNameValue("query", pdbIds)}; String location = RCSB_SERVER + RCSB_PDP_MAP_TOOL + "?"; String rcsbpbdData = httpDataManager.fetchData(location, params); try { JAXBContext jaxbContext = JAXBContext .newInstance("com.epam.catgenome.manager.externaldb.bindings.ecsbpdbmap"); Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); StringReader reader = new StringReader(rcsbpbdData); Object pdbObject = unmarshaller.unmarshal(reader); Dasalignment fetchedDasalignmentData = null; if (pdbObject instanceof Dasalignment) { fetchedDasalignmentData = (Dasalignment) pdbObject; } return fetchedDasalignmentData; } catch (JAXBException e) { throw new ExternalDbUnavailableException(MessageHelper.getMessage(MessagesConstants .ERROR_UNEXPECTED_FORMAT, location), e); } } }
PdbDataManager { public Dasalignment fetchPdbMapEntry(final String pdbIds) throws ExternalDbUnavailableException { ParameterNameValue[] params = new ParameterNameValue[]{new ParameterNameValue("query", pdbIds)}; String location = RCSB_SERVER + RCSB_PDP_MAP_TOOL + "?"; String rcsbpbdData = httpDataManager.fetchData(location, params); try { JAXBContext jaxbContext = JAXBContext .newInstance("com.epam.catgenome.manager.externaldb.bindings.ecsbpdbmap"); Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); StringReader reader = new StringReader(rcsbpbdData); Object pdbObject = unmarshaller.unmarshal(reader); Dasalignment fetchedDasalignmentData = null; if (pdbObject instanceof Dasalignment) { fetchedDasalignmentData = (Dasalignment) pdbObject; } return fetchedDasalignmentData; } catch (JAXBException e) { throw new ExternalDbUnavailableException(MessageHelper.getMessage(MessagesConstants .ERROR_UNEXPECTED_FORMAT, location), e); } }  }
PdbDataManager { public Dasalignment fetchPdbMapEntry(final String pdbIds) throws ExternalDbUnavailableException { ParameterNameValue[] params = new ParameterNameValue[]{new ParameterNameValue("query", pdbIds)}; String location = RCSB_SERVER + RCSB_PDP_MAP_TOOL + "?"; String rcsbpbdData = httpDataManager.fetchData(location, params); try { JAXBContext jaxbContext = JAXBContext .newInstance("com.epam.catgenome.manager.externaldb.bindings.ecsbpdbmap"); Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); StringReader reader = new StringReader(rcsbpbdData); Object pdbObject = unmarshaller.unmarshal(reader); Dasalignment fetchedDasalignmentData = null; if (pdbObject instanceof Dasalignment) { fetchedDasalignmentData = (Dasalignment) pdbObject; } return fetchedDasalignmentData; } catch (JAXBException e) { throw new ExternalDbUnavailableException(MessageHelper.getMessage(MessagesConstants .ERROR_UNEXPECTED_FORMAT, location), e); } }  Dataset fetchRCSBEntry(final String pdbids); Dasalignment fetchPdbMapEntry(final String pdbIds); }
PdbDataManager { public Dasalignment fetchPdbMapEntry(final String pdbIds) throws ExternalDbUnavailableException { ParameterNameValue[] params = new ParameterNameValue[]{new ParameterNameValue("query", pdbIds)}; String location = RCSB_SERVER + RCSB_PDP_MAP_TOOL + "?"; String rcsbpbdData = httpDataManager.fetchData(location, params); try { JAXBContext jaxbContext = JAXBContext .newInstance("com.epam.catgenome.manager.externaldb.bindings.ecsbpdbmap"); Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); StringReader reader = new StringReader(rcsbpbdData); Object pdbObject = unmarshaller.unmarshal(reader); Dasalignment fetchedDasalignmentData = null; if (pdbObject instanceof Dasalignment) { fetchedDasalignmentData = (Dasalignment) pdbObject; } return fetchedDasalignmentData; } catch (JAXBException e) { throw new ExternalDbUnavailableException(MessageHelper.getMessage(MessagesConstants .ERROR_UNEXPECTED_FORMAT, location), e); } }  Dataset fetchRCSBEntry(final String pdbids); Dasalignment fetchPdbMapEntry(final String pdbIds);  }