All Downloads are FREE. Search and download functionalities are using the official Maven repository.

seleniumConsulting.ch.selenium.framework.driver.neoload.NeoLoadTransactionManager Maven / Gradle / Ivy

Go to download

Selenium-Toolkit is a Java based test-toolkit for selenium-testing with testNg. The goal of the toolkit is, to suport you in different things like 'how to manage testdata in the source', parallelisation, Webdriver-managemet, reporting and a lot more.

There is a newer version: 3.0.11
Show newest version
package seleniumConsulting.ch.selenium.framework.driver.neoload;


import com.google.common.base.Strings;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.openqa.selenium.remote.SessionId;
import org.openqa.selenium.support.events.EventFiringWebDriver;
import org.openqa.selenium.support.events.WebDriverEventListener;
import seleniumConsulting.ch.selenium.framework.driver.WebDriverFactory;
import seleniumConsulting.ch.selenium.framework.listeners.webdriver.NLWebDriverEventListener;
import seleniumConsulting.ch.selenium.framework.metadata.MetadataManager;
import vendors.grid.TestInfo;

import java.util.HashMap;
import java.util.Map;

import static seleniumConsulting.ch.selenium.framework.driver.WebDriverFactory.CAPABILITIES;
import static seleniumConsulting.ch.selenium.framework.driver.WebDriverFactory.NEOLOAD;
import static seleniumConsulting.ch.selenium.framework.metadata.MetadataKey.BROWSERNAME;
import static seleniumConsulting.ch.selenium.framework.metadata.MetadataKey.BROWSERVERSION;
import static seleniumConsulting.ch.selenium.framework.metadata.MetadataManager.getMetadata;

/**
 * The NeoLoadTransactionManager manages all {@link Transaction} for the Test
 */
public class NeoLoadTransactionManager {

    /**
    * Map to store the Transaction to the threadIds.
    */
    private static Map transactionMap = new HashMap();


    /**
     * Get the {@link Transaction} to your current {@link Thread}
     * @return Transaction of current Thread
     */
    public static Transaction getTransaction() {
        try {
            return transactionMap.get(Thread.currentThread().getId());
        } catch (Exception e) {
            return null;
        }
    }
    /**
     * Set the {@link Transaction} to your current {@link Thread}
     * @param transaction of current Thread
     */
    public static void setTransaction(Transaction transaction) {
        transactionMap.put(Thread.currentThread().getId(), transaction);
    }
    /**
     * Del the Transaction to your current {@link Thread}
     */
    public static void delTransaction() {
        transactionMap.remove(Thread.currentThread().getId());
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy