Search in sources :

Example 1 with ParameterDataConfig

use of com.axway.ats.agent.core.threading.data.config.ParameterDataConfig in project ats-framework by Axway.

the class MultiThreadedActionHandler method scheduleActions.

/**
     * @param caller
     * @param queueName
     * @param actionRequests
     * @param threadingPattern
     * @throws NoSuchComponentException
     * @throws NoSuchActionException
     * @throws NoCompatibleMethodFoundException
     * @throws ThreadingPatternNotSupportedException
     * @throws ActionExecutionException
     * @throws ActionTaskLoaderException
     * @throws LoadQueueAlreadyExistsException
     * @throws ParameterDataProviderNotSupportedException
     * @throws ParameterDataProviderInitalizationException
     */
public void scheduleActions(String caller, String queueName, int queueId, List<ActionRequest> actionRequests, ThreadingPattern threadingPattern, LoaderDataConfig loaderDataConfig, boolean isUseSynchronizedIterations) throws NoSuchComponentException, NoSuchActionException, NoCompatibleMethodFoundException, ThreadingPatternNotSupportedException, ActionExecutionException, ActionTaskLoaderException, LoadQueueAlreadyExistsException, ParameterDataProviderNotSupportedException, ParameterDataProviderInitalizationException {
    //first cleanup the queues
    cleanupFinishedQueues();
    //check if we already have this queue and it has not finished yet
    //if the queue has finished, we can simply discard it
    QueueLoader queueLoader = queueLoadersMap.get(queueName);
    if (queueLoader != null) {
        throw new LoadQueueAlreadyExistsException(queueName, queueLoader.getState());
    }
    //create the data providers
    List<ParameterDataProvider> parameterDataProviders = new ArrayList<ParameterDataProvider>();
    for (ParameterDataConfig paramDataConfigs : loaderDataConfig.getParameterConfigurations()) {
        parameterDataProviders.add(ParameterDataProviderFactory.createDataProvider(paramDataConfigs));
    }
    //create the loader
    queueLoader = LoadQueueFactory.createLoadQueue(queueName, actionRequests, threadingPattern, parameterDataProviders, listeners);
    log.rememberLoadQueueState(queueName, queueId, threadingPattern.getPatternDescription(), threadingPattern.getThreadCount());
    //start the queue
    queueLoader.scheduleThreads(caller, isUseSynchronizedIterations);
    queueLoadersMap.put(queueName, queueLoader);
    log.info("Scheduled queue '" + queueName + "'");
}
Also used : QueueLoader(com.axway.ats.agent.core.threading.QueueLoader) AbstractQueueLoader(com.axway.ats.agent.core.threading.AbstractQueueLoader) LoadQueueAlreadyExistsException(com.axway.ats.agent.core.threading.exceptions.LoadQueueAlreadyExistsException) ParameterDataProvider(com.axway.ats.agent.core.threading.data.ParameterDataProvider) ParameterDataConfig(com.axway.ats.agent.core.threading.data.config.ParameterDataConfig) ArrayList(java.util.ArrayList)

Example 2 with ParameterDataConfig

use of com.axway.ats.agent.core.threading.data.config.ParameterDataConfig in project ats-framework by Axway.

the class LoadClient method executeQueuedActions.

/**
     * Execute all queued actions
     *
     * @throws AgentException
     */
@PublicAtsApi
public void executeQueuedActions() throws AgentException {
    configureAgentLoaders();
    boolean isThereUsernameConfigurator = false;
    boolean isThereUsernameParam = false;
    for (ParameterDataConfig dataConfig : loaderDataConfig.getParameterConfigurations()) {
        // check if UsernameDataConfigurator is used more than once
        if (isThereUsernameConfigurator) {
            throw new ActionExecutionException("You have used Username Data Configurator more than once. This is not allowed.");
        }
        if (dataConfig instanceof UsernameDataConfig) {
            isThereUsernameConfigurator = true;
            // user names are specified
            ((UsernameDataConfig) dataConfig).verifyUsernamesAreWEnough(threadingPattern.getThreadCount());
        } else if ("username".equals(dataConfig.getParameterName())) {
            isThereUsernameParam = true;
        }
    }
    if (isThereUsernameConfigurator && isThereUsernameParam) {
        throw new ActionExecutionException("The parameter \"username\" can not be used for another data configurator " + "when Username data configurator is used.");
    }
    actionQueue.executeQueuedActions(new ArrayList<String>(this.loaderAddresses), threadingPattern, loaderDataConfig);
}
Also used : ParameterDataConfig(com.axway.ats.agent.core.threading.data.config.ParameterDataConfig) UsernameDataConfig(com.axway.ats.agent.core.threading.data.config.UsernameDataConfig) ActionExecutionException(com.axway.ats.agent.core.exceptions.ActionExecutionException) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Aggregations

ParameterDataConfig (com.axway.ats.agent.core.threading.data.config.ParameterDataConfig)2 ActionExecutionException (com.axway.ats.agent.core.exceptions.ActionExecutionException)1 AbstractQueueLoader (com.axway.ats.agent.core.threading.AbstractQueueLoader)1 QueueLoader (com.axway.ats.agent.core.threading.QueueLoader)1 ParameterDataProvider (com.axway.ats.agent.core.threading.data.ParameterDataProvider)1 UsernameDataConfig (com.axway.ats.agent.core.threading.data.config.UsernameDataConfig)1 LoadQueueAlreadyExistsException (com.axway.ats.agent.core.threading.exceptions.LoadQueueAlreadyExistsException)1 PublicAtsApi (com.axway.ats.common.PublicAtsApi)1 ArrayList (java.util.ArrayList)1