Search in sources :

Example 96 with BeforeMethod

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);
}
Also used : PEMDecoder(org.forgerock.oauth2.core.PEMDecoder) ClientAuthenticationFailureFactory(org.forgerock.oauth2.core.exceptions.ClientAuthenticationFailureFactory) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 97 with BeforeMethod

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);
}
Also used : OAuth2Request(org.forgerock.oauth2.core.OAuth2Request) ScriptEvaluator(org.forgerock.openam.scripting.ScriptEvaluator) ClientRegistration(org.forgerock.oauth2.core.ClientRegistration) OAuth2ProviderSettingsFactory(org.forgerock.oauth2.core.OAuth2ProviderSettingsFactory) AMIdentity(com.sun.identity.idm.AMIdentity) OAuth2ProviderSettings(org.forgerock.oauth2.core.OAuth2ProviderSettings) OpenIdConnectClientRegistrationStore(org.forgerock.openidconnect.OpenIdConnectClientRegistrationStore) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 98 with BeforeMethod

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);
}
Also used : OAuth2UrisFactory(org.forgerock.oauth2.core.OAuth2UrisFactory) SSOTokenManager(com.iplanet.sso.SSOTokenManager) JacksonRepresentationFactory(org.forgerock.openam.rest.representations.JacksonRepresentationFactory) RestletOAuth2Request(org.forgerock.oauth2.restlet.RestletOAuth2Request) Request(org.restlet.Request) OAuth2Request(org.forgerock.oauth2.core.OAuth2Request) SecureRandom(java.security.SecureRandom) BDDMockito.anyString(org.mockito.BDDMockito.anyString) OpenIdConnectClientRegistrationStore(org.forgerock.openidconnect.OpenIdConnectClientRegistrationStore) ClientAuthenticationFailureFactory(org.forgerock.oauth2.core.exceptions.ClientAuthenticationFailureFactory) RealmNormaliser(org.forgerock.openam.utils.RealmNormaliser) RestletOAuth2Request(org.forgerock.oauth2.restlet.RestletOAuth2Request) OAuth2Request(org.forgerock.oauth2.core.OAuth2Request) OAuth2ProviderSettingsFactory(org.forgerock.oauth2.core.OAuth2ProviderSettingsFactory) InvalidClientException(org.forgerock.oauth2.core.exceptions.InvalidClientException) RestletOAuth2RequestFactory(org.forgerock.oauth2.restlet.RestletOAuth2RequestFactory) Debug(com.sun.identity.shared.debug.Debug) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 99 with BeforeMethod

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);
}
Also used : HttpContext(org.forgerock.json.resource.http.HttpContext) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 100 with BeforeMethod

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);
}
Also used : CoreWrapper(org.forgerock.openam.core.CoreWrapper) BaseURLProviderFactory(org.forgerock.openam.services.baseurl.BaseURLProviderFactory) BeforeMethod(org.testng.annotations.BeforeMethod)

Aggregations

BeforeMethod (org.testng.annotations.BeforeMethod)1078 File (java.io.File)60 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)52 IOException (java.io.IOException)49 DateTime (org.joda.time.DateTime)46 NavigationHelper (org.mifos.test.acceptance.framework.testhelpers.NavigationHelper)42 DateTimeUpdaterRemoteTestingService (org.mifos.test.acceptance.remote.DateTimeUpdaterRemoteTestingService)41 LoanTestHelper (org.mifos.test.acceptance.framework.testhelpers.LoanTestHelper)38 Enumeration (java.util.Enumeration)37 Project (com.google.refine.model.Project)33 StringWriter (java.io.StringWriter)26 Properties (java.util.Properties)26 EntityType (org.molgenis.data.meta.model.EntityType)25 ODatabaseDocumentTx (com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx)23 ServletConfig (jakarta.servlet.ServletConfig)22 ServletContext (jakarta.servlet.ServletContext)22 HttpServletRequest (javax.servlet.http.HttpServletRequest)22 AppLauncher (org.mifos.test.acceptance.framework.AppLauncher)22 Subject (javax.security.auth.Subject)21 Attribute (org.molgenis.data.meta.model.Attribute)21