Search in sources :

Example 66 with BeforeTest

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

the class IdRepoTest method suiteSetup.

/**
     * Create the CLIManager.
     */
@BeforeTest(groups = { "cli-idrepo" })
public void suiteSetup() throws CLIException {
    Map<String, Object> env = new HashMap<String, Object>();
    env.put(CLIConstants.SYS_PROPERTY_COMMAND_NAME, "amadm");
    env.put(CLIConstants.SYS_PROPERTY_DEFINITION_FILES, "com.sun.identity.cli.AccessManager");
    env.put(CLIConstants.SYS_PROPERTY_OUTPUT_WRITER, outputWriter);
    cmdManager = new CommandManager(env);
}
Also used : CommandManager(com.sun.identity.cli.CommandManager) HashMap(java.util.HashMap) BeforeTest(org.testng.annotations.BeforeTest)

Example 67 with BeforeTest

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

the class SAML2Test method suiteSetup.

/**
     * Create the CLIManager.
     */
@BeforeTest(groups = { "cli" })
public void suiteSetup() throws CLIException {
    Map<String, Object> env = new HashMap<String, Object>();
    env.put(CLIConstants.SYS_PROPERTY_COMMAND_NAME, "famadm");
    env.put(CLIConstants.SYS_PROPERTY_DEFINITION_FILES, "com.sun.identity.federation.cli.FederationManager");
    env.put(CLIConstants.SYS_PROPERTY_OUTPUT_WRITER, outputWriter);
    cmdManager = new CommandManager(env);
}
Also used : CommandManager(com.sun.identity.cli.CommandManager) HashMap(java.util.HashMap) BeforeTest(org.testng.annotations.BeforeTest)

Example 68 with BeforeTest

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

the class DelegationPrivilegeIdRepoAccessTest method setup.

@BeforeTest
public void setup() throws Exception {
    OrganizationConfigManager orgMgr = new OrganizationConfigManager(adminToken, "/");
    orgMgr.createSubOrganization(SUB_REALM.substring(1), Collections.EMPTY_MAP);
    delegatedUser = IdRepoUtils.createUser(SUB_REALM, DELEGATED_USER);
    delegatedUser1 = IdRepoUtils.createUser(SUB_REALM, DELEGATED_USER1);
    orgMgr = new OrganizationConfigManager(adminToken, SUB_REALM);
    orgMgr.createSubOrganization(SUB_SUB_REALM, Collections.EMPTY_MAP);
    Application appl = ApplicationManager.newApplication(APPLICATION_NAME, ApplicationTypeManager.getAppplicationType(PrivilegeManager.superAdminSubject, ApplicationTypeManager.URL_APPLICATION_TYPE_NAME));
    // Test disabled, unable to make model change.
    // Set<String> resources = new HashSet<String>();
    // resources.add(DELEGATED_RESOURCE);
    // appl.setResources(resources);
    appl.setEntitlementCombiner(DenyOverride.class);
    ApplicationManager.saveApplication(SubjectUtils.createSuperAdminSubject(), SUB_REALM, appl);
}
Also used : OrganizationConfigManager(com.sun.identity.sm.OrganizationConfigManager) BeforeTest(org.testng.annotations.BeforeTest)

Example 69 with BeforeTest

use of org.testng.annotations.BeforeTest in project incubator-atlas by apache.

the class DefaultMetadataServiceTest method setUp.

@BeforeTest
public void setUp() throws Exception {
    typeDefChangeListener = (DefaultMetadataService) metadataService;
    metadataService = TestUtils.addSessionCleanupWrapper(metadataService);
    if (auditRepository instanceof HBaseBasedAuditRepository) {
        HBaseTestUtils.startCluster();
        ((HBaseBasedAuditRepository) auditRepository).start();
    }
    TestUtils.resetRequestContext();
    RequestContext.get().setUser("testuser");
    TypesDef typesDef = TestUtils.defineHiveTypes();
    try {
        metadataService.getTypeDefinition(TestUtils.TABLE_TYPE);
    } catch (TypeNotFoundException e) {
        metadataService.createType(TypesSerialization.toJson(typesDef));
    }
    String dbGUid = TestUtils.createInstance(metadataService, db);
    table = createTableEntity(dbGUid);
    String tableGuid = TestUtils.createInstance(metadataService, table);
    String tableDefinitionJson = metadataService.getEntityDefinition(TestUtils.TABLE_TYPE, NAME, (String) table.get(NAME));
    table = InstanceSerialization.fromJsonReferenceable(tableDefinitionJson, true);
    tableId = new Id(tableGuid, 0, TestUtils.TABLE_TYPE);
}
Also used : HBaseBasedAuditRepository(org.apache.atlas.repository.audit.HBaseBasedAuditRepository) TypesDef(org.apache.atlas.typesystem.TypesDef) TypeNotFoundException(org.apache.atlas.typesystem.exception.TypeNotFoundException) Id(org.apache.atlas.typesystem.persistence.Id) BeforeTest(org.testng.annotations.BeforeTest)

Example 70 with BeforeTest

use of org.testng.annotations.BeforeTest in project oxAuth by GluuFederation.

the class BaseTest method discovery.

@BeforeTest
public void discovery(ITestContext context) throws Exception {
    // Load Form Interaction
    loginFormUsername = context.getCurrentXmlTest().getParameter("loginFormUsername");
    loginFormPassword = context.getCurrentXmlTest().getParameter("loginFormPassword");
    loginFormLoginButton = context.getCurrentXmlTest().getParameter("loginFormLoginButton");
    authorizeFormAllowButton = context.getCurrentXmlTest().getParameter("authorizeFormAllowButton");
    authorizeFormDoNotAllowButton = context.getCurrentXmlTest().getParameter("authorizeFormDoNotAllowButton");
    String resource = context.getCurrentXmlTest().getParameter("swdResource");
    if (StringUtils.isNotBlank(resource)) {
        showTitle("OpenID Connect Discovery");
        OpenIdConnectDiscoveryClient openIdConnectDiscoveryClient = new OpenIdConnectDiscoveryClient(resource);
        OpenIdConnectDiscoveryResponse openIdConnectDiscoveryResponse = openIdConnectDiscoveryClient.exec(new ApacheHttpClient4Executor(createHttpClient(HostnameVerifierType.ALLOW_ALL)));
        showClient(openIdConnectDiscoveryClient);
        assertEquals(openIdConnectDiscoveryResponse.getStatus(), 200, "Unexpected response code");
        assertNotNull(openIdConnectDiscoveryResponse.getSubject());
        assertTrue(openIdConnectDiscoveryResponse.getLinks().size() > 0);
        configurationEndpoint = openIdConnectDiscoveryResponse.getLinks().get(0).getHref() + "/.well-known/openid-configuration";
        System.out.println("OpenID Connect Configuration");
        OpenIdConfigurationClient client = new OpenIdConfigurationClient(configurationEndpoint);
        OpenIdConfigurationResponse response = client.execOpenIdConfiguration();
        showClient(client);
        assertEquals(response.getStatus(), 200, "Unexpected response code");
        assertNotNull(response.getIssuer(), "The issuer is null");
        assertNotNull(response.getAuthorizationEndpoint(), "The authorizationEndpoint is null");
        assertNotNull(response.getTokenEndpoint(), "The tokenEndpoint is null");
        assertNotNull(response.getUserInfoEndpoint(), "The userInfoEndPoint is null");
        assertNotNull(response.getJwksUri(), "The jwksUri is null");
        assertNotNull(response.getRegistrationEndpoint(), "The registrationEndpoint is null");
        assertTrue(response.getScopesSupported().size() > 0, "The scopesSupported is empty");
        assertTrue(response.getScopeToClaimsMapping().size() > 0, "The scope to claims mapping is empty");
        assertTrue(response.getResponseTypesSupported().size() > 0, "The responseTypesSupported is empty");
        assertTrue(response.getGrantTypesSupported().size() > 0, "The grantTypesSupported is empty");
        assertTrue(response.getAcrValuesSupported().size() >= 0, "The acrValuesSupported is empty");
        assertTrue(response.getSubjectTypesSupported().size() > 0, "The subjectTypesSupported is empty");
        assertTrue(response.getIdTokenSigningAlgValuesSupported().size() > 0, "The idTokenSigningAlgValuesSupported is empty");
        assertTrue(response.getRequestObjectSigningAlgValuesSupported().size() > 0, "The requestObjectSigningAlgValuesSupported is empty");
        assertTrue(response.getTokenEndpointAuthMethodsSupported().size() > 0, "The tokenEndpointAuthMethodsSupported is empty");
        assertTrue(response.getClaimsSupported().size() > 0, "The claimsSupported is empty");
        authorizationEndpoint = response.getAuthorizationEndpoint();
        tokenEndpoint = response.getTokenEndpoint();
        userInfoEndpoint = response.getUserInfoEndpoint();
        clientInfoEndpoint = response.getClientInfoEndpoint();
        checkSessionIFrame = response.getCheckSessionIFrame();
        endSessionEndpoint = response.getEndSessionEndpoint();
        jwksUri = response.getJwksUri();
        registrationEndpoint = response.getRegistrationEndpoint();
        idGenEndpoint = response.getIdGenerationEndpoint();
        introspectionEndpoint = response.getIntrospectionEndpoint();
        scopeToClaimsMapping = response.getScopeToClaimsMapping();
        gluuConfigurationEndpoint = determineGluuConfigurationEndpoint(openIdConnectDiscoveryResponse.getLinks().get(0).getHref());
    } else {
        showTitle("Loading configuration endpoints from properties file");
        authorizationEndpoint = context.getCurrentXmlTest().getParameter("authorizationEndpoint");
        tokenEndpoint = context.getCurrentXmlTest().getParameter("tokenEndpoint");
        userInfoEndpoint = context.getCurrentXmlTest().getParameter("userInfoEndpoint");
        clientInfoEndpoint = context.getCurrentXmlTest().getParameter("clientInfoEndpoint");
        checkSessionIFrame = context.getCurrentXmlTest().getParameter("checkSessionIFrame");
        endSessionEndpoint = context.getCurrentXmlTest().getParameter("endSessionEndpoint");
        jwksUri = context.getCurrentXmlTest().getParameter("jwksUri");
        registrationEndpoint = context.getCurrentXmlTest().getParameter("registrationEndpoint");
        configurationEndpoint = context.getCurrentXmlTest().getParameter("configurationEndpoint");
        idGenEndpoint = context.getCurrentXmlTest().getParameter("idGenEndpoint");
        introspectionEndpoint = context.getCurrentXmlTest().getParameter("introspectionEndpoint");
        scopeToClaimsMapping = new HashMap<String, List<String>>();
    }
    authorizationPageEndpoint = determineAuthorizationPageEndpoint(authorizationEndpoint);
}
Also used : ApacheHttpClient4Executor(org.jboss.resteasy.client.core.executors.ApacheHttpClient4Executor) List(java.util.List) BeforeTest(org.testng.annotations.BeforeTest)

Aggregations

BeforeTest (org.testng.annotations.BeforeTest)80 HashMap (java.util.HashMap)8 CommandManager (com.sun.identity.cli.CommandManager)6 Path (java.nio.file.Path)6 File (java.io.File)5 Injector (com.google.inject.Injector)4 PinotHelixResourceManager (com.linkedin.pinot.controller.helix.core.PinotHelixResourceManager)4 Series (com.axibase.tsd.api.model.series.Series)3 AbstractTableConfig (com.linkedin.pinot.common.config.AbstractTableConfig)3 ArrayList (java.util.ArrayList)3 Parameters (org.testng.annotations.Parameters)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