Search in sources :

Example 26 with Parameters

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");
}
Also used : CLIRequest(com.sun.identity.cli.CLIRequest) Parameters(org.testng.annotations.Parameters) Test(org.testng.annotations.Test) AfterTest(org.testng.annotations.AfterTest) BeforeTest(org.testng.annotations.BeforeTest)

Example 27 with Parameters

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");
}
Also used : CLIRequest(com.sun.identity.cli.CLIRequest) Parameters(org.testng.annotations.Parameters) Test(org.testng.annotations.Test) BeforeTest(org.testng.annotations.BeforeTest)

Example 28 with Parameters

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");
}
Also used : CLIRequest(com.sun.identity.cli.CLIRequest) Parameters(org.testng.annotations.Parameters) Test(org.testng.annotations.Test) BeforeTest(org.testng.annotations.BeforeTest)

Example 29 with Parameters

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");
}
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 30 with Parameters

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;
        }
    }
}
Also used : SSOToken(com.iplanet.sso.SSOToken) LogRecord(com.sun.identity.log.LogRecord) AMLogException(com.sun.identity.log.AMLogException) Level(java.util.logging.Level) Parameters(org.testng.annotations.Parameters) Test(org.testng.annotations.Test) BeforeTest(org.testng.annotations.BeforeTest) AfterTest(org.testng.annotations.AfterTest)

Aggregations

Parameters (org.testng.annotations.Parameters)628 Test (org.testng.annotations.Test)610 BaseTest (org.xdi.oxauth.BaseTest)511 Response (javax.ws.rs.core.Response)271 Builder (javax.ws.rs.client.Invocation.Builder)270 ResteasyClientBuilder (org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder)270 ResponseType (org.xdi.oxauth.model.common.ResponseType)259 JSONException (org.codehaus.jettison.json.JSONException)238 OxAuthCryptoProvider (org.xdi.oxauth.model.crypto.OxAuthCryptoProvider)196 JSONObject (org.codehaus.jettison.json.JSONObject)191 URISyntaxException (java.net.URISyntaxException)119 RegisterResponse (org.xdi.oxauth.client.RegisterResponse)110 RegisterRequest (org.xdi.oxauth.client.RegisterRequest)96 JwtAuthorizationRequest (org.xdi.oxauth.client.model.authorize.JwtAuthorizationRequest)92 AuthorizationRequest (org.xdi.oxauth.client.AuthorizationRequest)86 URI (java.net.URI)85 Jwt (org.xdi.oxauth.model.jwt.Jwt)81 Claim (org.xdi.oxauth.client.model.authorize.Claim)80 MultivaluedHashMap (javax.ws.rs.core.MultivaluedHashMap)73 REGISTRATION_CLIENT_URI (org.xdi.oxauth.model.register.RegisterResponseParam.REGISTRATION_CLIENT_URI)73