@Test public void testParse() throws IOException, ExternalDbUnavailableException, InterruptedException, JAXBException { String fetchRes = readFile("pbd_id_2k8d.xml"); Mockito.when( httpDataManager.fetchData(Mockito.any(), Mockito.any(ParameterNameValue[].class)) ).thenReturn(fetchRes); final Dataset dataset = pdbDataManager.fetchRCSBEntry("STRUCTURE_ID"); Assert.assertNotNull(dataset); Assert.assertNotNull(dataset.getRecord()); final List<Record> recordList = dataset.getRecord(); Assert.assertFalse(recordList.isEmpty()); final Record record = recordList.get(0); Assert.assertNotNull(record); Assert.assertTrue(record.getChainId().equals(CHAIN_ID)); Assert.assertTrue(record.getClassification().equals(CLASSIFICATION)); Assert.assertTrue(record.getCompound().equals(COMPOUND)); Assert.assertTrue(record.getStructureId().equals(STRUCTURE_ID)); Assert.assertTrue(record.getStructureTitle().equals(STRUCTURE_TITLE)); }
public Dataset fetchRCSBEntry(final String pdbids) throws ExternalDbUnavailableException { ParameterNameValue[] params = new ParameterNameValue[]{new ParameterNameValue("pdbids", pdbids), new ParameterNameValue("format", "xml"), new ParameterNameValue("customReportColumns", "structureTitle,expressionHost,classification," + "compound,uniprotRecommendedName")}; String location = RCSB_SERVER + RCSB_TOOL + "?"; String rcsbpbdData = httpDataManager.fetchData(location, params); try { JAXBContext jaxbContext = JAXBContext.newInstance("com.epam.catgenome.manager.externaldb.bindings.rcsbpbd"); Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); StringReader reader = new StringReader(rcsbpbdData); Object uniprotObject = unmarshaller.unmarshal(reader); Dataset fetchedDatasetData = null; if (uniprotObject instanceof Dataset) { fetchedDatasetData = (Dataset) uniprotObject; } return fetchedDatasetData; } catch (JAXBException e) { throw new ExternalDbUnavailableException(MessageHelper.getMessage(MessagesConstants .ERROR_UNEXPECTED_FORMAT, location), e); } }
PdbDataManager { public Dataset fetchRCSBEntry(final String pdbids) throws ExternalDbUnavailableException { ParameterNameValue[] params = new ParameterNameValue[]{new ParameterNameValue("pdbids", pdbids), new ParameterNameValue("format", "xml"), new ParameterNameValue("customReportColumns", "structureTitle,expressionHost,classification," + "compound,uniprotRecommendedName")}; String location = RCSB_SERVER + RCSB_TOOL + "?"; String rcsbpbdData = httpDataManager.fetchData(location, params); try { JAXBContext jaxbContext = JAXBContext.newInstance("com.epam.catgenome.manager.externaldb.bindings.rcsbpbd"); Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); StringReader reader = new StringReader(rcsbpbdData); Object uniprotObject = unmarshaller.unmarshal(reader); Dataset fetchedDatasetData = null; if (uniprotObject instanceof Dataset) { fetchedDatasetData = (Dataset) uniprotObject; } return fetchedDatasetData; } catch (JAXBException e) { throw new ExternalDbUnavailableException(MessageHelper.getMessage(MessagesConstants .ERROR_UNEXPECTED_FORMAT, location), e); } } }
PdbDataManager { public Dataset fetchRCSBEntry(final String pdbids) throws ExternalDbUnavailableException { ParameterNameValue[] params = new ParameterNameValue[]{new ParameterNameValue("pdbids", pdbids), new ParameterNameValue("format", "xml"), new ParameterNameValue("customReportColumns", "structureTitle,expressionHost,classification," + "compound,uniprotRecommendedName")}; String location = RCSB_SERVER + RCSB_TOOL + "?"; String rcsbpbdData = httpDataManager.fetchData(location, params); try { JAXBContext jaxbContext = JAXBContext.newInstance("com.epam.catgenome.manager.externaldb.bindings.rcsbpbd"); Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); StringReader reader = new StringReader(rcsbpbdData); Object uniprotObject = unmarshaller.unmarshal(reader); Dataset fetchedDatasetData = null; if (uniprotObject instanceof Dataset) { fetchedDatasetData = (Dataset) uniprotObject; } return fetchedDatasetData; } catch (JAXBException e) { throw new ExternalDbUnavailableException(MessageHelper.getMessage(MessagesConstants .ERROR_UNEXPECTED_FORMAT, location), e); } }  }
PdbDataManager { public Dataset fetchRCSBEntry(final String pdbids) throws ExternalDbUnavailableException { ParameterNameValue[] params = new ParameterNameValue[]{new ParameterNameValue("pdbids", pdbids), new ParameterNameValue("format", "xml"), new ParameterNameValue("customReportColumns", "structureTitle,expressionHost,classification," + "compound,uniprotRecommendedName")}; String location = RCSB_SERVER + RCSB_TOOL + "?"; String rcsbpbdData = httpDataManager.fetchData(location, params); try { JAXBContext jaxbContext = JAXBContext.newInstance("com.epam.catgenome.manager.externaldb.bindings.rcsbpbd"); Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); StringReader reader = new StringReader(rcsbpbdData); Object uniprotObject = unmarshaller.unmarshal(reader); Dataset fetchedDatasetData = null; if (uniprotObject instanceof Dataset) { fetchedDatasetData = (Dataset) uniprotObject; } return fetchedDatasetData; } 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 Dataset fetchRCSBEntry(final String pdbids) throws ExternalDbUnavailableException { ParameterNameValue[] params = new ParameterNameValue[]{new ParameterNameValue("pdbids", pdbids), new ParameterNameValue("format", "xml"), new ParameterNameValue("customReportColumns", "structureTitle,expressionHost,classification," + "compound,uniprotRecommendedName")}; String location = RCSB_SERVER + RCSB_TOOL + "?"; String rcsbpbdData = httpDataManager.fetchData(location, params); try { JAXBContext jaxbContext = JAXBContext.newInstance("com.epam.catgenome.manager.externaldb.bindings.rcsbpbd"); Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); StringReader reader = new StringReader(rcsbpbdData); Object uniprotObject = unmarshaller.unmarshal(reader); Dataset fetchedDatasetData = null; if (uniprotObject instanceof Dataset) { fetchedDatasetData = (Dataset) uniprotObject; } return fetchedDatasetData; } catch (JAXBException e) { throw new ExternalDbUnavailableException(MessageHelper.getMessage(MessagesConstants .ERROR_UNEXPECTED_FORMAT, location), e); } }  Dataset fetchRCSBEntry(final String pdbids); Dasalignment fetchPdbMapEntry(final String pdbIds);  }