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