Search in sources :

Example 16 with BeforeTest

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

the class ApplicationV1FilterTransformerTest method theSetUp.

@BeforeTest
public void theSetUp() {
    //you need this
    mockContextHelper = mock(ContextHelper.class);
    mockResourceTypeService = mock(ResourceTypeService.class);
    mockResourceErrorHandler = mock(ExceptionMappingHandler.class);
    transformer = new ApplicationV1FilterTransformer(mockContextHelper, mockResourceTypeService, mockResourceErrorHandler);
}
Also used : ContextHelper(org.forgerock.openam.rest.resource.ContextHelper) ExceptionMappingHandler(org.forgerock.openam.errors.ExceptionMappingHandler) ApplicationV1FilterTransformer(org.forgerock.openam.entitlement.rest.ApplicationV1FilterTransformer) ResourceTypeService(org.forgerock.openam.entitlement.service.ResourceTypeService) BeforeTest(org.testng.annotations.BeforeTest)

Example 17 with BeforeTest

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

the class SubjectTypeValidatorTest method setUp.

@BeforeTest
public void setUp() {
    ClientAuthenticationFailureFactory failureFactory = mock(ClientAuthenticationFailureFactory.class);
    when(failureFactory.getException()).thenReturn(mock(InvalidClientException.class));
    when(failureFactory.getException(anyString())).thenReturn(mock(InvalidClientException.class));
    when(failureFactory.getException(any(OAuth2Request.class), anyString())).thenReturn(mock(InvalidClientException.class));
    this.mockProviderSettingsFactory = mock(OAuth2ProviderSettingsFactory.class);
    this.mockClientRegistrationStore = mock(OpenIdConnectClientRegistrationStore.class);
    this.subjectTypeValidator = new SubjectTypeValidator(mockProviderSettingsFactory, mockClientRegistrationStore, failureFactory);
}
Also used : OAuth2Request(org.forgerock.oauth2.core.OAuth2Request) OAuth2ProviderSettingsFactory(org.forgerock.oauth2.core.OAuth2ProviderSettingsFactory) InvalidClientException(org.forgerock.oauth2.core.exceptions.InvalidClientException) ClientAuthenticationFailureFactory(org.forgerock.oauth2.core.exceptions.ClientAuthenticationFailureFactory) BeforeTest(org.testng.annotations.BeforeTest)

Example 18 with BeforeTest

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

the class AMLogTest method setup.

/**
     * Before running the test(s), ensure:
     *   o the log svc config is set with buffer timer off, buff size = 1
     *
     * @throws Exception if an AMLogException occurs
     */
@Parameters({ "logtest-log-location", "logtest-logname" })
@BeforeTest(groups = { "api-adminwrite", "api-adminread" })
public void setup(String logLoc, String logFName) throws Exception {
    Object[] params = { theRealm, logLoc, logFName };
    entering("setup", params);
    setbufferSizer("OFF", "1");
    try {
        lmgr.readConfiguration();
        String tlogLoc = lmgr.getProperty(LogConstants.LOG_LOCATION);
        if ((tlogLoc == null) || (tlogLoc.length() == 0)) {
            tlogLoc = logLoc;
        }
        if ((logFName != null) && (logFName.length() > 0)) {
            logName = logFName;
        } else {
            logName = defaultLogName;
        }
        loggingLocation = tlogLoc;
        logPath = loggingLocation + "/" + logName;
        File f1 = new File(logPath);
        if (f1.exists() && (f1.length() > 0)) {
            f1.delete();
        }
        logger = (Logger) Logger.getLogger(logFName);
    } catch (Exception e) {
        log(Level.SEVERE, "setup", e.getMessage(), params);
        e.printStackTrace();
        throw e;
    }
    exiting("setup");
}
Also used : File(java.io.File) AMLogException(com.sun.identity.log.AMLogException) SMSException(com.sun.identity.sm.SMSException) IOException(java.io.IOException) AuthLoginException(com.sun.identity.authentication.spi.AuthLoginException) SSOException(com.iplanet.sso.SSOException) Parameters(org.testng.annotations.Parameters) BeforeTest(org.testng.annotations.BeforeTest)

Example 19 with BeforeTest

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

the class AMIdentityTestBase method setup.

/**
     * Creates realm and <code>AMIdenity</code> object before the testcases are
     * executed.
     *
     * @throws Exception if <code>AMIdenity</code> object cannot be created.
     */
@Parameters({ "parent-realm", "entity-type", "entity-name", "entity-creation-attributes" })
@BeforeTest(groups = { "api" })
public void setup(String parentRealm, String idType, String entityName, String createAttributes) throws Exception {
    Object[] params = { parentRealm, idType, entityName, createAttributes };
    entering("setup", params);
    try {
        IdType type = IdUtils.getType(idType);
        Map values = CollectionUtils.parseStringToMap(createAttributes);
        AMIdentity amid = createIdentity(parentRealm, type, entityName, values);
        assert amid.getName().equals(entityName);
        assert amid.getType().equals(type);
        String amidRealm = DNMapper.orgNameToRealmName(amid.getRealm());
        if (amidRealm.charAt(0) != '/') {
            amidRealm = "/" + amidRealm;
        }
        assert amidRealm.equals(parentRealm);
        if (type.equals(IdType.AGENT) || type.equals(IdType.USER)) {
            assert amid.isActive();
        }
        assert amid.isExists();
    } catch (Exception e) {
        log(Level.SEVERE, "setup", e.getMessage(), params);
        e.printStackTrace();
        throw e;
    }
    exiting("setup");
}
Also used : HashMap(java.util.HashMap) Map(java.util.Map) SMSException(com.sun.identity.sm.SMSException) SSOException(com.iplanet.sso.SSOException) Parameters(org.testng.annotations.Parameters) BeforeTest(org.testng.annotations.BeforeTest)

Example 20 with BeforeTest

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

the class RequesterTest method theSetUp.

@BeforeTest
private void theSetUp() {
    // you need this
    SSOTokenContext mockSSOTokenContext = mock(SSOTokenContext.class);
    RealmContext realmContext = new RealmContext(mockSSOTokenContext);
    realmContext.setSubRealm("REALM", "REALM");
    mockServerContext = mock(Context.class);
}
Also used : RealmContext(org.forgerock.openam.rest.RealmContext) Context(org.forgerock.services.context.Context) SSOTokenContext(org.forgerock.openam.rest.resource.SSOTokenContext) SSOTokenContext(org.forgerock.openam.rest.resource.SSOTokenContext) RealmContext(org.forgerock.openam.rest.RealmContext) BeforeTest(org.testng.annotations.BeforeTest)

Aggregations

BeforeTest (org.testng.annotations.BeforeTest)63 HashMap (java.util.HashMap)8 CommandManager (com.sun.identity.cli.CommandManager)6 Injector (com.google.inject.Injector)4 PinotHelixResourceManager (com.linkedin.pinot.controller.helix.core.PinotHelixResourceManager)4 File (java.io.File)4 AbstractTableConfig (com.linkedin.pinot.common.config.AbstractTableConfig)3 SSOException (com.iplanet.sso.SSOException)2 Schema (com.linkedin.pinot.common.data.Schema)2 SegmentGeneratorConfig (com.linkedin.pinot.core.indexsegment.generator.SegmentGeneratorConfig)2 SegmentIndexCreationDriver (com.linkedin.pinot.core.segment.creator.SegmentIndexCreationDriver)2 SegmentIndexCreationDriverImpl (com.linkedin.pinot.core.segment.creator.impl.SegmentIndexCreationDriverImpl)2 ThirdEyeConfigProperties (com.linkedin.thirdeye.hadoop.config.ThirdEyeConfigProperties)2 ODatabaseDocumentTx (com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx)2 OrganizationConfigManager (com.sun.identity.sm.OrganizationConfigManager)2 SMSException (com.sun.identity.sm.SMSException)2 MetricsRegistry (com.yammer.metrics.core.MetricsRegistry)2 URL (java.net.URL)2 ArrayList (java.util.ArrayList)2 ZkClient (org.I0Itec.zkclient.ZkClient)2