Class FailingProteinFetcher
- java.lang.Object
-
- psidev.psi.mi.jami.bridges.fetcher.mock.AbstractMockFetcher<T>
-
- psidev.psi.mi.jami.bridges.fetcher.mock.AbstractFailingFetcher<Collection<Protein>>
-
- psidev.psi.mi.jami.bridges.fetcher.mock.FailingProteinFetcher
-
- All Implemented Interfaces:
InteractorFetcher<Protein>
,MockFetcher<Collection<Protein>>
,ProteinFetcher
public class FailingProteinFetcher extends AbstractFailingFetcher<Collection<Protein>> implements ProteinFetcher
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:
23/05/13
- Version:
- $Id$
- Author:
- Marine Dumousseau (marine@ebi.ac.uk)
-
-
Field Summary
-
Fields inherited from class psidev.psi.mi.jami.bridges.fetcher.mock.AbstractMockFetcher
localMap
-
-
Constructor Summary
Constructors Constructor Description FailingProteinFetcher(int maxQuery)
Constructor for FailingProteinFetcher.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addEntry(String identifier, Protein protein)
addEntry.Collection<Protein>
fetchByIdentifier(String identifier)
Takes a string identifier and returns the interactors which match.Collection<Protein>
fetchByIdentifiers(Collection<String> identifiers)
Takes a collection of string identifiers and returns the interactors which match.protected Collection<Protein>
getEntry(String identifier)
getEntry.-
Methods inherited from class psidev.psi.mi.jami.bridges.fetcher.mock.AbstractFailingFetcher
getEntries
-
Methods inherited from class psidev.psi.mi.jami.bridges.fetcher.mock.AbstractMockFetcher
addEntry, clearEntries, removeEntry
-
-
-
-
Method Detail
-
getEntry
protected Collection<Protein> getEntry(String identifier) throws BridgeFailedException
getEntry.
Used to retrieve an entry from the internal list. will throw exceptions if the required number of queries has not been made.- Overrides:
getEntry
in classAbstractFailingFetcher<Collection<Protein>>
- Parameters:
identifier
- aString
object.- Returns:
- a T object.
- Throws:
BridgeFailedException
- if any.
-
fetchByIdentifier
public Collection<Protein> fetchByIdentifier(String identifier) throws BridgeFailedException
Takes a string identifier and returns the interactors which match. Returns an empty collection of no entries are returned- Specified by:
fetchByIdentifier
in interfaceInteractorFetcher<Protein>
- Parameters:
identifier
- The identifier to search for.- Returns:
- The proteins which match the search term. Empty if no matches.
- Throws:
BridgeFailedException
- A problem has been encountered when contacting the service
-
fetchByIdentifiers
public Collection<Protein> fetchByIdentifiers(Collection<String> identifiers) throws BridgeFailedException
Takes a collection of string identifiers and returns the interactors which match. Returns an empty collection of no entries are returned.- Specified by:
fetchByIdentifiers
in interfaceInteractorFetcher<Protein>
- Parameters:
identifiers
- The identifiers to search for.- Returns:
- The proteins which match the search term. Empty if no matches.
- Throws:
BridgeFailedException
- if any.
-
-