use of ca.corefacility.bioinformatics.irida.model.RemoteAPI in project irida by phac-nml.
the class RemoteServiceImplTest method testGetServiceStatus.
@Test
public void testGetServiceStatus() {
RemoteAPI remoteAPI = new RemoteAPI();
service.getServiceStatus(remoteAPI);
verify(repository).getServiceStatus(remoteAPI);
}
use of ca.corefacility.bioinformatics.irida.model.RemoteAPI in project irida by phac-nml.
the class SampleRemoteServiceImplTest method testGetSamplesForProject.
@Test
public void testGetSamplesForProject() {
String samplesHref = "http://somewhere/projects/5/samples";
Project project = new Project();
project.add(new Link(samplesHref, SampleRemoteServiceImpl.PROJECT_SAMPLES_REL));
RemoteAPI api = new RemoteAPI();
project.setRemoteStatus(new RemoteStatus("http://nowhere", api));
Sample remoteSample = new Sample();
remoteSample.setRemoteStatus(new RemoteStatus("http://nowhere", api));
List<Sample> samples = Lists.newArrayList(remoteSample);
when(sampleRemoteRepository.list(samplesHref, api)).thenReturn(samples);
List<Sample> samplesForProject = sampleRemoteService.getSamplesForProject(project);
verify(sampleRemoteRepository).list(samplesHref, api);
assertEquals(samples, samplesForProject);
}
use of ca.corefacility.bioinformatics.irida.model.RemoteAPI in project irida by phac-nml.
the class SingleEndSequenceFileRemoteServiceImplTest method testGetSequenceFilesForSample.
@Test
public void testGetSequenceFilesForSample() {
String seqFilesHref = "http://somewhere/projects/1/samples/2/sequencefiles";
RemoteAPI api = new RemoteAPI();
Sample sample = new Sample();
sample.add(new Link(seqFilesHref, SingleEndSequenceFileRemoteServiceImpl.SAMPLE_SEQENCE_FILE_UNPAIRED_REL));
sample.setRemoteStatus(new RemoteStatus("http://nowhere", api));
List<SingleEndSequenceFile> filesList = Lists.newArrayList(new SingleEndSequenceFile(new SequenceFile()));
when(apiRepo.getRemoteAPIForUrl(seqFilesHref)).thenReturn(api);
when(repository.list(seqFilesHref, api)).thenReturn(filesList);
List<SingleEndSequenceFile> sequenceFilesForSample = service.getUnpairedFilesForSample(sample);
assertEquals(filesList, sequenceFilesForSample);
verify(repository).list(seqFilesHref, api);
}
use of ca.corefacility.bioinformatics.irida.model.RemoteAPI in project irida by phac-nml.
the class OAuthTokenRestTemplateIT method testRequestWithExpiredToken.
@Test(expected = IridaOAuthException.class)
public void testRequestWithExpiredToken() throws URISyntaxException {
RemoteAPI remoteAPI = apiService.read(2L);
URI serviceURI = new URI(remoteAPI.getServiceURI());
OAuthTokenRestTemplate restTemplate = new OAuthTokenRestTemplate(tokenService, remoteAPI);
restTemplate.getForEntity(serviceURI, String.class);
}
use of ca.corefacility.bioinformatics.irida.model.RemoteAPI in project irida by phac-nml.
the class OAuthTokenRestTemplateTest method setUp.
@Before
public void setUp() throws URISyntaxException {
tokenService = mock(RemoteAPITokenService.class);
serviceURI = new URI("http://uri");
remoteAPI = new RemoteAPI("service name", serviceURI.toString(), "a service", "clientId", "clientSecret");
restTemplate = new OAuthTokenRestTemplate(tokenService, remoteAPI);
}
Aggregations