Package com.qspin.qtaste.config

Examples of com.qspin.qtaste.config.TestBedConfiguration


    public WindowsImpl() throws QTasteException {
        initialize();
    }

    public void initialize() throws QTasteException {
        TestBedConfiguration tb = TestBedConfiguration.getInstance();
        this.host = tb.getString("singleton_components.Windows.host");
        this.port = tb.getInt("singleton_components.Windows.port");
        this.client = new XmlRpcClient();
        try {
            XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
           
            config.setServerURL(new URL("http://" + host + ":" + port));
View Full Code Here


    private String URL;
    static Logger logger = Logger.getLogger(TestAPIImpl.class);

    public SeleniumImpl(String instanceId) {
        super();
        TestBedConfiguration config = TestBedConfiguration.getInstance();
        this.instanceId = instanceId;
        this.host = config.getMIString(instanceId, "Selenium", "host");
        this.port = config.getMIInt(instanceId, "Selenium", "port");
        this.URL = config.getMIString(instanceId, "Selenium", "url");
        logger.debug("Target url : " + this.URL);
    }
View Full Code Here

    private String user;
    private String password;
    static Logger logger = Logger.getLogger(TestAPIImpl.class);

    public BugzillaImpl(String instanceId) {
        TestBedConfiguration config = TestBedConfiguration.getInstance();
        this.instanceId = instanceId;
        this.jdbcDriver = config.getMIString(instanceId, "Bugzilla", "jdbcDriver");
        this.jdbcURL = config.getMIString(instanceId, "Bugzilla", "jdbcURL");
        this.user = config.getMIString(instanceId, "Bugzilla", "dbuser");
        this.password = config.getMIString(instanceId, "Bugzilla", "dbpassword");
    }
View Full Code Here

  }

  private static boolean startOrStopSUT(boolean start, TestResult tr) {
    needToRestartSUT = !start;
    String startOrStop = start ? "start" : "stop";
    TestBedConfiguration config = TestBedConfiguration.getInstance();
    if (hasControlScript()) {
      if (isStartStopSUTCancelled) {
        if (tr != null) {
          tr.setStatus(Status.FAIL);
          tr.setExtraResultDetails("SUT " + startOrStop + " command cancelled");
        }
        return false;
      }

      String scriptFilename = config.getControlScriptFileName();
      String scriptEngine = null;
      if (scriptFilename.endsWith(".py")) {
        final String jythonHome = StaticConfiguration.JYTHON_HOME;
        final String jythonJar = jythonHome + "/jython.jar";
        final String jythonLib = StaticConfiguration.JYTHON_LIB.trim();
        final String additionnalJythonLib = StaticConfiguration.ADDITIONNAL_JYTHON_LIB.trim();
        final String classPath = System.getProperties().getProperty("java.class.path", "").trim();
        scriptEngine = "java -Dpython.path=" + jythonJar + File.pathSeparator + jythonLib  + File.pathSeparator + additionnalJythonLib
                    + " -cp \"" + jythonHome + "/../build/jython-engine.jar" + File.pathSeparator
                  + jythonJar + File.pathSeparator + classPath + "\" org.python.util.jython";
      }
      String scriptArguments = config.getControlScriptArguments();
      String startOrStopCommand = scriptFilename + " " + startOrStop + " " + (scriptArguments != null ? scriptArguments : "") + (isRestartingSUT ? "-restart true" : "");
      logger.info((start ? "Starting" : "Stopping") + " SUT using command '" + startOrStopCommand + "'");
      // report the control script
      try {
        ByteArrayOutputStream output = new ByteArrayOutputStream();
        Map<String, String> env = new HashMap<String, String>(
            System.getenv());
        env.put("TESTBED", config.getFileName());
        String startOrStopFullCommand = (scriptEngine != null ? scriptEngine + " " + startOrStopCommand : startOrStopCommand);
        logger.trace("FULL COMMAND : '" + startOrStopFullCommand + "'");
        int exitCode = sutStartStopExec.exec(startOrStopFullCommand, env, output);
        if (exitCode == 0) {
          logger.info("SUT " + (start ? "started" : "stopped"));
View Full Code Here

            // initialize testData
            m_testData = new TestDataInteractive("QTaste_interactive", 1, null, null);
            m_testData.setGUIMonitoring(true, this);
            String defaultInstance = null;
            try {
                TestBedConfiguration testbedConfig = TestBedConfiguration.getInstance();
                if (testbedConfig != null) {
                    defaultInstance = testbedConfig.getDefaultInstanceId();
                }
            } catch (Exception e) {
            }
            m_testData.setValue("INSTANCE_ID", defaultInstance);
            testDataView.setTestData(m_testData);

            TestBedConfiguration.registerConfigurationChangeHandler(new TestBedConfiguration.ConfigurationChangeHandler() {

                public void onConfigurationChange() {
                    String defaultInstance = null;
                    try {
                        TestBedConfiguration testbedConfig = TestBedConfiguration.getInstance();
                        if (testbedConfig != null) {
                            defaultInstance = testbedConfig.getDefaultInstanceId();
                        }
                    } catch (Exception e) {
                    }
                    try {
                        m_testData.setValue("INSTANCE_ID", defaultInstance);
View Full Code Here

        this.expectedValues = nameExpectedValues;
        this.timeout = timeout;
        this.extraDetails = "";

        //TODO: change this temporary hack by making a SmartSocketsCache ?
        TestBedConfiguration config = TestBedConfiguration.getInstance();
        if (config == null || !config.containsKey("probe_manager.probe")) {
            throw new RuntimeException("Error: Probe is not configured in testbed!");
        }
    }
View Full Code Here

        }
     
    @Override
    public void actionPerformed(ActionEvent e) {
      // get the current testbed
      TestBedConfiguration testbed = TestBedConfiguration.getInstance();
      // get the list of failed tests
            CampaignWriter campaign = new CampaignWriter();
            for (int i=0; i < tcTable.getRowCount(); i++) {
                TestResult tr = (TestResult) tcModel.getValueAt(i, TC);
              if (tr.getStatus()== TestResult.Status.FAIL) {
                campaign.addCampaign(testbed.getFile().getName().replace("." + StaticConfiguration.CAMPAIGN_FILE_EXTENSION, ""),
                    tr.getTestCaseDirectory(),
                    tr.getTestData().getRowId());
              }
            }
            // ask for name of test campaign
View Full Code Here

    public static Logger getLogger() {
        return logger;
    }

    private static void initializeEmbeddedJython() {
        TestBedConfiguration testbedConfig = TestBedConfiguration.getInstance();
        if (testbedConfig != null) {
            platform = testbedConfig.getList("testapi_implementation.import");
        } else {
            platform = null;
        }

        // to force loading of components if not loaded
View Full Code Here

    private ComponentsLoader() {
        componentMap = new HashMap<String, Class<?>>();
        api = TestAPIImpl.getInstance();


        TestBedConfiguration testbedConfig = TestBedConfiguration.getInstance();
        if (testbedConfig != null) {
            testapiImplementation = testbedConfig.getList("testapi_implementation.import");
        } else {
            testapiImplementation = null;
        }
        initialize(testapiImplementation);

        TestBedConfiguration.registerConfigurationChangeHandler(new TestBedConfiguration.ConfigurationChangeHandler() {

            public void onConfigurationChange() {
                List<String> newTestAPIimplementation;
                TestBedConfiguration testbedConfig = TestBedConfiguration.getInstance();
                if (testbedConfig != null) {
                    newTestAPIimplementation = testbedConfig.getList("testapi_implementation.import");
                } else {
                    newTestAPIimplementation = null;
                }
                if (!newTestAPIimplementation.equals(testapiImplementation)) {
                    initialize(newTestAPIimplementation);
View Full Code Here

                TestAPI testAPI = TestAPIImpl.getInstance();
                rootNode.removeAllChildren();
                ComponentsLoader.getInstance(); // don't remove, it is to be sure that components are registered
                Collection<String> hashComponents = testAPI.getRegisteredComponents();
                TreeSet<String> sortedComponents = new TreeSet<String>(hashComponents);
                TestBedConfiguration testbedConfig = TestBedConfiguration.getInstance();
                for (String componentName: sortedComponents) {
                    boolean componentPresentInTestbed = true;
                    ComponentFactory componentFactory = testAPI.getComponentFactory(componentName);
                    if (componentFactory instanceof SingletonComponentFactory) {
                        componentPresentInTestbed = !testbedConfig.configurationsAt("singleton_components." + componentName).isEmpty();
                    } else if (componentFactory instanceof MultipleInstancesComponentFactory) {
                        componentPresentInTestbed = !testbedConfig.configurationsAt("multiple_instances_components." + componentName).isEmpty();
                    }
                    if (componentPresentInTestbed) {
                        DefaultMutableTreeNode node = new DefaultMutableTreeNode(componentName, true);
                        rootNode.add(node);
                        // get all methods from this component
View Full Code Here

TOP

Related Classes of com.qspin.qtaste.config.TestBedConfiguration

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.