Class FailingPublicationFetcher
- java.lang.Object
-
- psidev.psi.mi.jami.bridges.fetcher.mock.AbstractMockFetcher<T>
-
- psidev.psi.mi.jami.bridges.fetcher.mock.AbstractFailingFetcher<Publication>
-
- psidev.psi.mi.jami.bridges.fetcher.mock.FailingPublicationFetcher
-
- All Implemented Interfaces:
MockFetcher<Publication>
,PublicationFetcher
public class FailingPublicationFetcher extends AbstractFailingFetcher<Publication> implements PublicationFetcher
A mock fetcher for testing exceptions. It extends the functionality of the mock fetcher but can also throw exceptions. Upon initialisation, an integer is given which sets how many times a query is made before returning the result. If the current query matches the last query and the counter of the number of times is less than the maxQuery set at initialisation, then an exception will be thrown. Additionally, if the maxQuery is set to -1, the fetcher will always throw an exception.- Since:
- 05/08/13
- Author:
- Gabriel Aldam (galdam@ebi.ac.uk)
-
-
Field Summary
-
Fields inherited from class psidev.psi.mi.jami.bridges.fetcher.mock.AbstractMockFetcher
localMap
-
-
Constructor Summary
Constructors Constructor Description FailingPublicationFetcher(int maxQuery)
Constructor for FailingPublicationFetcher.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Publication
fetchByIdentifier(String pubmedID, String source)
Uses the identifier to search for a publication and return a completed record.Collection<Publication>
fetchByIdentifiers(Map<String,Collection<String>> identifiers)
Uses the identifiers to search for publications and return completed records.-
Methods inherited from class psidev.psi.mi.jami.bridges.fetcher.mock.AbstractFailingFetcher
getEntries, getEntry
-
Methods inherited from class psidev.psi.mi.jami.bridges.fetcher.mock.AbstractMockFetcher
addEntry, clearEntries, removeEntry
-
-
-
-
Method Detail
-
fetchByIdentifier
public Publication fetchByIdentifier(String pubmedID, String source) throws BridgeFailedException
Uses the identifier to search for a publication and return a completed record.- Specified by:
fetchByIdentifier
in interfacePublicationFetcher
- Parameters:
pubmedID
- The identifier of the publication to search for.source
- The database that the identifier is from (pubmed, doi, ...).- Returns:
- A completed record for the publication or null if no publication could be found.
- Throws:
BridgeFailedException
- if any.
-
fetchByIdentifiers
public Collection<Publication> fetchByIdentifiers(Map<String,Collection<String>> identifiers) throws BridgeFailedException
Uses the identifiers to search for publications and return completed records.- Specified by:
fetchByIdentifiers
in interfacePublicationFetcher
- Parameters:
identifiers
- The identifiers of the publications to search for per publication identifier source (pubmed, doi, ...).- Returns:
- Completed records for the publications.
- Throws:
BridgeFailedException
- if any.
-
-