use of org.testng.annotations.Parameters in project OpenAM by OpenRock.
the class AuthConfigTest method listAuthInstances.
@Parameters({ "realm" })
@Test(groups = { "cli-authconfig", "ops", "list-auth-instances" })
public void listAuthInstances(String realm) throws CLIException {
String[] param = { realm };
entering("listAuthInstances", param);
String[] args = { "list-auth-instances", CLIConstants.PREFIX_ARGUMENT_LONG + IArgument.REALM_NAME, realm };
CLIRequest req = new CLIRequest(null, args, getAdminSSOToken());
cmdManager.addToRequestQueue(req);
cmdManager.serviceRequestQueue();
exiting("listAuthInstances");
}
use of org.testng.annotations.Parameters in project OpenAM by OpenRock.
the class DataStoreTest method createDataStore.
@Parameters({ "realm" })
@Test(groups = { "cli-datastore", "ops", "create-datastore" })
public void createDataStore(String realm) throws CLIException {
String[] param = { realm };
entering("createDataStore", param);
String[] args = { "create-datastore", CLIConstants.PREFIX_ARGUMENT_LONG + IArgument.REALM_NAME, realm, CLIConstants.PREFIX_ARGUMENT_LONG + DatastoreOptions.DATASTORE_NAME, TEST_DATASTORE_NAME, CLIConstants.PREFIX_ARGUMENT_LONG + DatastoreOptions.DATASTORE_TYPE, TEST_DATASTORE_TYPE, CLIConstants.PREFIX_ARGUMENT_LONG + IArgument.ATTRIBUTE_VALUES, "sunIdRepoClass=com.sun.identity.idm.plugins.files.FilesRepo", "sunFilesIdRepoDirectory=/tmp/clitestdatastore" };
CLIRequest req = new CLIRequest(null, args, getAdminSSOToken());
cmdManager.addToRequestQueue(req);
cmdManager.serviceRequestQueue();
exiting("createDataStore");
}
use of org.testng.annotations.Parameters in project OpenAM by OpenRock.
the class DataStoreTest method listDataStores.
@Parameters({ "realm" })
@Test(groups = { "cli-datastore", "ops", "list-datastores" })
public void listDataStores(String realm) throws CLIException {
String[] param = { realm };
entering("listDataStores", param);
String[] args = { "list-datastores", CLIConstants.PREFIX_ARGUMENT_LONG + IArgument.REALM_NAME, realm };
CLIRequest req = new CLIRequest(null, args, getAdminSSOToken());
cmdManager.addToRequestQueue(req);
cmdManager.serviceRequestQueue();
exiting("listDataStores");
}
use of org.testng.annotations.Parameters 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.Parameters in project OpenAM by OpenRock.
the class AMLogTest method writeAdminLogRecord.
/**
* need:
* only the amadmin SSOToken (used in LogRecord), since
* can't (currently) use user SSOTokens. also means
* the log delegation can't be tested.
* column values
* data
* module_name
* domain
* log_level
* login_id
* ip_addr
* host_name
* message_id
* number of records to write
*
*/
@Parameters({ "logwrite-data", "logwrite-modulename", "logwrite-domain", "logwrite-log-level", "logwrite-login-id", "logwrite-ip-addr", "logwrite-host-name", "logwrite-message-id", "logwrite-number-of-records" })
@Test(groups = { "api-adminwrite" })
public void writeAdminLogRecord(String rData, String rModuleName, String rDomain, String rLogLevel, String rLoginId, String rIPAddr, String rHostName, String rMsgId, String rNumRecs) throws AMLogException {
LogRecord lR = null;
Level llevel = null;
int numRecs = 0;
if ((rNumRecs != null) && (rNumRecs.length() > 0)) {
try {
numRecs = Integer.parseInt(rNumRecs);
} catch (NumberFormatException nfe) {
log(Level.WARNING, "writeAdminLogRecord", nfe.getMessage());
numRecs = 1;
}
}
llevel = getLogLevel(rLogLevel);
/**
* DOMAIN, LOGIN_ID, IP_ADDR, and HOST_NAME are extracted from the
* SSOToken and added by the LogRecord handling. if any values are
* provided to the test, then they'll be added.
*/
int totalRecs = 0;
SSOToken adminToken = getAdminSSOToken();
/*
* put variable data in ("msgDataPrefix + i") reverse
* order, so we can test sortBy in the read test.
*/
for (int i = (numRecs - 1); i >= 0; i--) {
lR = new LogRecord(llevel, msgDataPrefix + i + "|" + rData, adminToken);
if ((rDomain != null) && (rDomain.length() > 0)) {
lR.addLogInfo(LogConstants.DOMAIN, rDomain);
}
// ignore rLoginId parameter; use "amAdmin"
lR.addLogInfo(LogConstants.LOGIN_ID, "amAdmin");
if ((rIPAddr != null) && (rIPAddr.length() > 0)) {
lR.addLogInfo(LogConstants.IP_ADDR, rIPAddr);
}
if ((rHostName != null) && (rHostName.length() > 0)) {
lR.addLogInfo(LogConstants.HOST_NAME, rHostName);
}
if ((rModuleName != null) && (rModuleName.length() > 0)) {
lR.addLogInfo(LogConstants.MODULE_NAME, rModuleName);
}
if ((rMsgId != null) && (rMsgId.length() > 0)) {
String msgid = rMsgId + i;
lR.addLogInfo(LogConstants.MESSAGE_ID, msgid);
}
try {
logger.log(lR, adminToken);
totalRecs++;
} catch (AMLogException alex) {
// unexpected exception
log(Level.SEVERE, "writeAdminLogRecord", alex.getMessage());
throw alex;
}
}
}
Aggregations