Search in sources :

Example 91 with BeforeMethod

use of org.testng.annotations.BeforeMethod in project OpenAM by OpenRock.

the class RestRouterIT method setupMocks.

@BeforeMethod
public void setupMocks() {
    MockitoAnnotations.initMocks(this);
    configResource = mock(SingletonResourceProvider.class);
    usersResource = mock(CollectionResourceProvider.class);
    internalResource = mock(CollectionResourceProvider.class);
    dashboardResource = spy(new DashboardResource());
    authenticateResource = spy(new AuthenticateResource());
    httpAccessAuditFilter = spy(new AbstractHttpAccessAuditFilter(AUTHENTICATION, mock(AuditEventPublisher.class), mock(AuditEventFactory.class)) {

        @Override
        protected String getRealm(Context context) {
            return null;
        }
    });
    auditEventPublisher = mock(AuditEventPublisher.class);
    auditServiceProvider = mock(AuditServiceProvider.class);
    versionBehaviourManager = mock(ResourceApiVersionBehaviourManager.class);
    ssoTokenManager = mock(SSOTokenManager.class);
    authUtilsWrapper = mock(AuthUtilsWrapper.class);
    coreWrapper = mock(CoreWrapper.class);
    SSOToken adminToken = mock(SSOToken.class);
    given(coreWrapper.getAdminToken()).willReturn(adminToken);
    given(coreWrapper.isValidFQDN(anyString())).willReturn(true);
    realmValidator = mock(RestRealmValidator.class);
}
Also used : RootContext(org.forgerock.services.context.RootContext) RequestAuditContext(org.forgerock.services.context.RequestAuditContext) HttpContext(org.forgerock.json.resource.http.HttpContext) SessionContext(org.forgerock.http.session.SessionContext) SSOTokenContext(org.forgerock.openam.rest.resource.SSOTokenContext) AttributesContext(org.forgerock.services.context.AttributesContext) SecurityContext(org.forgerock.services.context.SecurityContext) Context(org.forgerock.services.context.Context) SSOTokenManager(com.iplanet.sso.SSOTokenManager) CoreWrapper(org.forgerock.openam.core.CoreWrapper) AuditServiceProvider(org.forgerock.openam.audit.AuditServiceProvider) SSOToken(com.iplanet.sso.SSOToken) SingletonResourceProvider(org.forgerock.json.resource.SingletonResourceProvider) AuditEventPublisher(org.forgerock.openam.audit.AuditEventPublisher) CollectionResourceProvider(org.forgerock.json.resource.CollectionResourceProvider) AuthUtilsWrapper(org.forgerock.openam.authentication.service.AuthUtilsWrapper) AuditEventFactory(org.forgerock.openam.audit.AuditEventFactory) ResourceApiVersionBehaviourManager(org.forgerock.http.routing.ResourceApiVersionBehaviourManager) RestRealmValidator(org.forgerock.openam.rest.router.RestRealmValidator) AbstractHttpAccessAuditFilter(org.forgerock.openam.audit.AbstractHttpAccessAuditFilter) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 92 with BeforeMethod

use of org.testng.annotations.BeforeMethod in project OpenAM by OpenRock.

the class ScriptConfigurationServiceTest method setUp.

@BeforeMethod
public void setUp() throws ResourceException {
    Logger logger = mock(Logger.class);
    Subject subject = new Subject();
    subject.getPrincipals().add(testUserPrinciple);
    dataStore = mock(ScriptingDataStore.class);
    ScriptingDataStoreFactory dataStoreFactory = mock(ScriptingDataStoreFactory.class);
    when(dataStoreFactory.create(any(Subject.class), anyString())).thenReturn(dataStore);
    service = new ScriptConfigurationService(logger, subject, "/", dataStoreFactory);
}
Also used : ScriptingDataStoreFactory(org.forgerock.openam.scripting.datastore.ScriptingDataStoreFactory) ScriptingDataStore(org.forgerock.openam.scripting.datastore.ScriptingDataStore) Logger(org.slf4j.Logger) Subject(javax.security.auth.Subject) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 93 with BeforeMethod

use of org.testng.annotations.BeforeMethod in project OpenAM by OpenRock.

the class AttributeCompressionStrategyTest method setup.

@BeforeMethod
public void setup() {
    blobUtils = new TokenBlobUtils();
    compression = new AttributeCompressionStrategy(blobUtils);
}
Also used : TokenBlobUtils(org.forgerock.openam.cts.utils.blob.TokenBlobUtils) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 94 with BeforeMethod

use of org.testng.annotations.BeforeMethod in project OpenAM by OpenRock.

the class XACMLSchemaFactoryTest method setup.

@BeforeMethod
public void setup() throws EntitlementException {
    xacmlSchemaFactory = new XACMLSchemaFactory();
    resourceAttributeUtil = new ResourceAttributeUtil();
    PolicyResponseProvider rp1 = createPolicyResponseProvider(1);
    PolicyResponseProvider rp2 = createPolicyResponseProvider(2);
    PolicyResponseProvider rp3 = createPolicyResponseProvider(3);
    PolicyResponseProvider rp4 = createPolicyResponseProvider(4);
    rpSet = CollectionUtils.asSet(rp1, rp2, rp3, rp4);
    AdviceExpression ae1 = createAdviceExpression(rp1);
    AdviceExpression ae2 = createAdviceExpression(rp2);
    AdviceExpression ae3 = createAdviceExpression(rp3);
    AdviceExpression ae4 = createAdviceExpression(rp4);
    aes = new AdviceExpressions();
    aes.getAdviceExpression().addAll(Arrays.asList(ae1, ae2, ae3, ae4));
}
Also used : AdviceExpression(com.sun.identity.entitlement.xacml3.core.AdviceExpression) PolicyResponseProvider(com.sun.identity.entitlement.opensso.PolicyResponseProvider) AdviceExpressions(com.sun.identity.entitlement.xacml3.core.AdviceExpressions) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 95 with BeforeMethod

use of org.testng.annotations.BeforeMethod in project OpenAM by OpenRock.

the class AMIdentityMembershipConditionTest method setUp.

@BeforeMethod
public void setUp() {
    Debug debug = mock(Debug.class);
    coreWrapper = mock(CoreWrapper.class);
    condition = new AMIdentityMembershipCondition(debug, coreWrapper);
    adminToken = mock(SSOToken.class);
    given(coreWrapper.getAdminToken()).willReturn(adminToken);
}
Also used : CoreWrapper(org.forgerock.openam.core.CoreWrapper) SSOToken(com.iplanet.sso.SSOToken) Debug(com.sun.identity.shared.debug.Debug) 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