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);
}
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);
}
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);
}
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);
}
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);
}
Aggregations