use of org.testng.annotations.BeforeMethod in project OpenAM by OpenRock.
the class OpenAMClientRegistrationTest method setup.
@BeforeMethod
public void setup() throws Exception {
MockitoAnnotations.initMocks(this);
ClientAuthenticationFailureFactory failureFactory = mock(ClientAuthenticationFailureFactory.class);
clientRegistration = new OpenAMClientRegistration(amIdentity, new PEMDecoder(), resolver, providerSettings, failureFactory);
}
use of org.testng.annotations.BeforeMethod in project OpenAM by OpenRock.
the class OpenAMScopeValidatorTest method setup.
@BeforeMethod
public void setup() throws Exception {
client = mock(ClientRegistration.class);
request = mock(OAuth2Request.class);
providerSettings = mock(OAuth2ProviderSettings.class);
clientRegistrationStore = mock(OpenIdConnectClientRegistrationStore.class);
OAuth2ProviderSettingsFactory factory = mock(OAuth2ProviderSettingsFactory.class);
when(factory.get(request)).thenReturn(providerSettings);
ScriptEvaluator scriptEvaluator = mock(ScriptEvaluator.class);
IdentityManager identityManager = mock(IdentityManager.class);
identity = mock(AMIdentity.class);
when(identityManager.getResourceOwnerIdentity(anyString(), anyString())).thenReturn(identity);
validator = new OpenAMScopeValidator(identityManager, null, factory, null, scriptEvaluator, clientRegistrationStore, null);
}
use of org.testng.annotations.BeforeMethod in project OpenAM by OpenRock.
the class OpenAMTokenStoreTest method setUp.
@BeforeMethod
public void setUp() {
tokenStore = mock(OAuthTokenStore.class);
providerSettingsFactory = mock(OAuth2ProviderSettingsFactory.class);
oAuth2UrisFactory = mock(OAuth2UrisFactory.class);
clientRegistrationStore = mock(OpenIdConnectClientRegistrationStore.class);
realmNormaliser = mock(RealmNormaliser.class);
ssoTokenManager = mock(SSOTokenManager.class);
request = mock(Request.class);
cookieExtractor = mock(CookieExtractor.class);
auditLogger = mock(OAuth2AuditLogger.class);
debug = mock(Debug.class);
failureFactory = mock(ClientAuthenticationFailureFactory.class);
oAuth2RequestFactory = new RestletOAuth2RequestFactory(new JacksonRepresentationFactory(new ObjectMapper()));
ClientAuthenticationFailureFactory failureFactory = mock(ClientAuthenticationFailureFactory.class);
InvalidClientException expectedResult = mock(InvalidClientException.class);
when(expectedResult.getError()).thenReturn(new String("invalid_client"));
when(failureFactory.getException()).thenReturn(expectedResult);
when(failureFactory.getException(anyString())).thenReturn(expectedResult);
when(failureFactory.getException(any(OAuth2Request.class), anyString())).thenReturn(expectedResult);
openAMtokenStore = new OpenAMTokenStore(tokenStore, providerSettingsFactory, oAuth2UrisFactory, clientRegistrationStore, realmNormaliser, ssoTokenManager, cookieExtractor, auditLogger, debug, new SecureRandom(), failureFactory);
}
use of org.testng.annotations.BeforeMethod in project OpenAM by OpenRock.
the class SelfServiceRequestHandlerTest method setUp.
@BeforeMethod
public void setUp() {
MockitoAnnotations.initMocks(this);
context = new HttpContext(json(object(field("headers", Collections.emptyMap()), field("parameters", Collections.emptyMap()))), null);
selfServiceHandler = new SelfServiceRequestHandler<>(MockBuilder.class, consoleConfigHandler, providerFactory, serviceFactory);
}
use of org.testng.annotations.BeforeMethod in project OpenAM by OpenRock.
the class PendingRequestsServiceTest method setup.
@SuppressWarnings("unchecked")
@BeforeMethod
public void setup() throws Exception {
initMocks(this);
UmaProviderSettingsFactory settingsFactory = mock(UmaProviderSettingsFactory.class);
given(settingsFactory.get(anyString())).willReturn(settings);
BaseURLProviderFactory baseUrlProviderFactory = mock(BaseURLProviderFactory.class);
given(baseUrlProviderFactory.get(anyString())).willReturn(baseUrlProvider);
CoreWrapper coreWrapper = mock(CoreWrapper.class);
given(coreWrapper.getIdentity(RESOURCE_OWNER_ID, REALM)).willReturn(resourceOwnerIdentity);
service = new PendingRequestsService(store, auditLogger, settingsFactory, emailService, pendingRequestEmailTemplate, policyService, baseUrlProviderFactory, coreWrapper);
}
Aggregations