com.surveypanel.form.test.Runner.java Source code

Java tutorial

Introduction

Here is the source code for com.surveypanel.form.test.Runner.java

Source

/*
* SurveyPanel
* Copyright (C) 2009 Serge Tan Panza
* All rights reserved.
* License: GNU/GPL License v3 , see LICENSE.txt
* SurveyPanel is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.txt for copyright notices and details.
* 
*/
package com.surveypanel.form.test;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.surveypanel.form.FormFactory;
import com.surveypanel.form.TestHelper;
import com.surveypanel.js.JSManager;

public class Runner {

    private static FormFactory formFactory;
    private static JSManager jsManager;
    private static Log log = LogFactory.getLog(Runner.class);
    private static long surveyId = 2;

    /**
     * @param args
     */
    public static void main(String[] args) {
        try {
            init(surveyId);
            Thread[] runners = new Thread[100];
            for (int j = 0; j < runners.length; j++) {
                runners[j] = new Thread(new FormRun(formFactory, jsManager, surveyId));
            }
            for (Thread thread : runners) {
                thread.start();
            }
            Thread.sleep(1000);
        } catch (Exception e) {
            log.error(e);
        }
    }

    private static void init(long surveyId) throws Exception {
        formFactory = TestHelper.getDBFormFactory();
        formFactory.init(surveyId);
        jsManager = new JSManager(formFactory);

    }

}