use of ca.corefacility.bioinformatics.irida.model.RemoteAPI in project irida by phac-nml.
the class RemoteAPIServiceImplIT method testGetApiByURLNoMatch.
@Test
@WithMockUser(username = "tom", roles = "USER")
public void testGetApiByURLNoMatch() {
String resourceURL = "http://somewhereelse.ca/api/projects/2";
RemoteAPI apiForUrl = remoteAPIService.getRemoteAPIForUrl(resourceURL);
assertNull(apiForUrl);
}
use of ca.corefacility.bioinformatics.irida.model.RemoteAPI in project irida by phac-nml.
the class RemoteAPITokenServiceImplIT method testGetTokenNotExists.
@Test(expected = EntityNotFoundException.class)
public void testGetTokenNotExists() {
RemoteAPI api = apiService.read(2L);
tokenService.getToken(api);
}
use of ca.corefacility.bioinformatics.irida.model.RemoteAPI in project irida by phac-nml.
the class RemoteAPITokenServiceImplIT method addTokenExisting.
@Test
public void addTokenExisting() {
RemoteAPI api = apiService.read(1L);
RemoteAPIToken originalToken = tokenService.getToken(api);
RemoteAPIToken token = new RemoteAPIToken("111111111", api, new Date());
tokenService.create(token);
RemoteAPIToken readToken = tokenService.getToken(api);
assertNotEquals(token, originalToken);
assertEquals(token, readToken);
}
use of ca.corefacility.bioinformatics.irida.model.RemoteAPI in project irida by phac-nml.
the class RemoteAPITokenServiceImplIT method testAddToken.
@Test
public void testAddToken() {
RemoteAPI api = apiService.read(2L);
RemoteAPIToken token = new RemoteAPIToken("111111111", api, new Date());
tokenService.create(token);
RemoteAPIToken readToken = tokenService.getToken(api);
assertEquals(token, readToken);
}
use of ca.corefacility.bioinformatics.irida.model.RemoteAPI in project irida by phac-nml.
the class RemoteAPIControllerTest method testCheckApiStatusActive.
@Test
public void testCheckApiStatusActive() {
Long apiId = 1L;
RemoteAPI client = new RemoteAPI("name", "http://uri", "a description", "id", "secret");
when(remoteAPIService.read(apiId)).thenReturn(client);
when(projectRemoteService.getServiceStatus(client)).thenReturn(true);
String checkApiStatus = remoteAPIController.checkApiStatus(apiId);
assertEquals(RemoteAPIController.VALID_OAUTH_CONNECTION, checkApiStatus);
verify(remoteAPIService).read(apiId);
verify(projectRemoteService).getServiceStatus(client);
}
Aggregations