Search in sources :

Example 1 with RemoteAPITokenServiceImpl

use of ca.corefacility.bioinformatics.irida.service.impl.RemoteAPITokenServiceImpl in project irida by phac-nml.

the class RemoteAPITokenServiceImplTest method setUp.

@Before
public void setUp() {
    tokenRepository = mock(RemoteApiTokenRepository.class);
    userRepo = mock(UserRepository.class);
    oauthClient = mock(OAuthClient.class);
    service = new RemoteAPITokenServiceImpl(tokenRepository, userRepo, oauthClient);
    user = new User("tom", "an@email.com", "password1", "tom", "matthews", "123456789");
    remoteAPI = new RemoteAPI("apiname", "http://nowhere", "a test api", "clientId", "clientSecret");
    SecurityContextHolder.getContext().setAuthentication(new TestingAuthenticationToken(user, null));
    remoteAPIToken = new RemoteAPIToken("token", remoteAPI, new Date());
}
Also used : RemoteAPITokenServiceImpl(ca.corefacility.bioinformatics.irida.service.impl.RemoteAPITokenServiceImpl) RemoteAPI(ca.corefacility.bioinformatics.irida.model.RemoteAPI) RemoteAPIToken(ca.corefacility.bioinformatics.irida.model.RemoteAPIToken) UserRepository(ca.corefacility.bioinformatics.irida.repositories.user.UserRepository) User(ca.corefacility.bioinformatics.irida.model.user.User) OAuthClient(org.apache.oltu.oauth2.client.OAuthClient) TestingAuthenticationToken(org.springframework.security.authentication.TestingAuthenticationToken) RemoteApiTokenRepository(ca.corefacility.bioinformatics.irida.repositories.RemoteApiTokenRepository) Date(java.util.Date) Before(org.junit.Before)

Aggregations

RemoteAPI (ca.corefacility.bioinformatics.irida.model.RemoteAPI)1 RemoteAPIToken (ca.corefacility.bioinformatics.irida.model.RemoteAPIToken)1 User (ca.corefacility.bioinformatics.irida.model.user.User)1 RemoteApiTokenRepository (ca.corefacility.bioinformatics.irida.repositories.RemoteApiTokenRepository)1 UserRepository (ca.corefacility.bioinformatics.irida.repositories.user.UserRepository)1 RemoteAPITokenServiceImpl (ca.corefacility.bioinformatics.irida.service.impl.RemoteAPITokenServiceImpl)1 Date (java.util.Date)1 OAuthClient (org.apache.oltu.oauth2.client.OAuthClient)1 Before (org.junit.Before)1 TestingAuthenticationToken (org.springframework.security.authentication.TestingAuthenticationToken)1