use of com.hazelcast.simulator.vendors.VendorDriver in project hazelcast-simulator by hazelcast.
the class WorkerTest method before.
@Before
public void before() {
setupFakeEnvironment();
Registry registry = new Registry();
AgentData agent = registry.addAgent(PUBLIC_ADDRESS, PUBLIC_ADDRESS);
SimulatorProperties properties = new SimulatorProperties().set("MANAGEMENT_CENTER_URL", "none");
VendorDriver driver = new HazelcastDriver().setAgents(registry.getAgents()).setAll(properties.asPublicMap()).set("CONFIG", fileAsText(localResourceDirectory() + "/hazelcast.xml"));
workerAddress = workerAddress(AGENT_INDEX, WORKER_INDEX);
parameters = driver.loadWorkerParameters("member", agent.getAddressIndex()).set("WORKER_ADDRESS", workerAddress).set("PUBLIC_ADDRESS", PUBLIC_ADDRESS);
for (Map.Entry<String, String> entry : parameters.entrySet()) {
String key = entry.getKey();
if (key.startsWith("file:")) {
FileUtils.writeText(entry.getValue(), new File(getUserDir(), key.substring(5, key.length())));
}
}
}
use of com.hazelcast.simulator.vendors.VendorDriver in project hazelcast-simulator by hazelcast.
the class Coordinator method workerStart.
public String workerStart(RcWorkerStartOperation op) throws Exception {
// todo: tags
String workerType = op.getWorkerType();
LOGGER.info("Starting " + op.getCount() + " [" + workerType + "] workers...");
VendorDriver vendorDriver = loadVendorDriver(properties.get("VENDOR")).setAgents(registry.getAgents()).setAll(properties.asPublicMap()).set("CLIENT_ARGS", op.getVmOptions()).set("MEMBER_ARGS", op.getVmOptions()).set("SESSION_ID", parameters.getSessionId()).setIfNotNull("VERSION_SPEC", op.getVersionSpec()).setIfNotNull("CONFIG", op.getConfig());
List<AgentData> agents = findAgents(op);
if (agents.isEmpty()) {
throw new IllegalStateException("No suitable agents found");
}
LOGGER.info("Suitable agents: " + agents);
DeploymentPlan deploymentPlan = new DeploymentPlan(vendorDriver, agents).addToPlan(op.getCount(), workerType);
List<WorkerData> workers = createStartWorkersTask(deploymentPlan.getWorkerDeployment(), op.getTags()).run();
LOGGER.info("Workers started!");
return WorkerData.toAddressString(workers);
}
Aggregations