package org.bench4q.agent.plugin;

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

import org.bench4q.agent.Main;

/**
 * This class is the base of parameterization, such as CsvProvider, And
 * parameterization Class has one more constructor parameter called testId, And
 * it make getting parameter file convenient
 * 
 * @author coderfengyun
 * 
 */
public abstract class ParameterBarn {
	private UUID testId;

	protected UUID getTestId() {
		return testId;
	}

	private void setTestId(UUID testId) {
		this.testId = testId;
	}

	protected ParameterBarn(String testId) {
		this.setTestId(UUID.fromString(testId));
	}

	public String getFileFullPath(String simpleFileName) {
		String FILE_SEPARATOR = System.getProperty("file.separator");
		return Main.SCENARIO_PARAMETERS_FOLDER + FILE_SEPARATOR
				+ this.getTestId().toString() + FILE_SEPARATOR + simpleFileName
				+ ".txt";
	}

	public abstract String getValue(String var);

	public static Map<String, String> buildConstructorInitParams(String testId) {
		Map<String, String> initParamsForParameterization = new HashMap<String, String>();
		initParamsForParameterization.put("testId", testId);
		return initParamsForParameterization;
	}
}
