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

net.thucydides.core.batches.BatchManagerProvider Maven / Gradle / Ivy

package net.thucydides.core.batches;

import com.google.inject.Inject;
import com.google.inject.Provider;
import net.thucydides.core.ThucydidesSystemProperty;
import net.thucydides.core.util.EnvironmentVariables;
import net.thucydides.core.webdriver.Configuration;

public class BatchManagerProvider implements Provider{
	
	private final BatchManager batchManager;
	
	@Inject
	public BatchManagerProvider(Configuration configuration){
		EnvironmentVariables environmentVariables = configuration.getEnvironmentVariables();
        String batchManagerProperty = ThucydidesSystemProperty.THUCYDIDES_BATCH_STRATEGY.from(environmentVariables,
                BatchStrategy.DIVIDE_EQUALLY.name());
        try {
        	batchManager = BatchStrategy.valueOf(batchManagerProperty).instance(environmentVariables);
        } catch (Exception e) {
            throw new UnsupportedBatchStrategyException(batchManagerProperty + " is not a supported batch strategy.", e);
        }
	}

	@Override
	public BatchManager get() {
		return batchManager;
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy