use of com.hazelcast.simulator.agent.workerprocess.WorkerParameters in project hazelcast-simulator by hazelcast.
the class RegistryTest method testRemoveWorker_viaWorkerData.
@Test
public void testRemoveWorker_viaWorkerData() {
SimulatorAddress agentAddress = addAgent();
List<WorkerParameters> parametersList = newWorkerParametersList(agentAddress, 5);
registry.addWorkers(parametersList);
assertEquals(5, registry.workerCount());
registry.removeWorker(registry.getWorkers().get(0));
assertEquals(4, registry.workerCount());
}
use of com.hazelcast.simulator.agent.workerprocess.WorkerParameters in project hazelcast-simulator by hazelcast.
the class RegistryTest method testGetWorkers.
@Test
public void testGetWorkers() {
SimulatorAddress agentAddress = addAgent();
List<WorkerParameters> parametersList = newWorkerParametersList(agentAddress, 10);
registry.addWorkers(parametersList);
assertEquals(10, registry.workerCount());
List<WorkerData> workers = registry.getWorkers();
for (int i = 0; i < 10; i++) {
WorkerData workerData = workers.get(i);
assertEquals(i + 1, workerData.getAddress().getWorkerIndex());
assertEquals(WORKER, workerData.getAddress().getAddressLevel());
// assertEquals(i + 1, workerData.getParameters().getWorkerIndex());
assertEquals("member", workerData.getParameters().getWorkerType());
}
}
use of com.hazelcast.simulator.agent.workerprocess.WorkerParameters in project hazelcast-simulator by hazelcast.
the class HazelcastDriver method loadWorkerParameters.
@Override
public WorkerParameters loadWorkerParameters(String workerType, int agentIndex) {
Map<String, String> s = new HashMap<String, String>(properties);
s.remove("CONFIG");
if ("hazelcast-enterprise".equals(get("VENDOR"))) {
String licenceKey = get("LICENCE_KEY");
if (licenceKey == null) {
throw new IllegalStateException("licenceKey needs to be set with 'hazelcast-enterprise' as vendor");
}
}
WorkerParameters params = new WorkerParameters().setAll(s).set("WORKER_TYPE", workerType).set("file:log4j.xml", loadLog4jConfig());
if ("member".equals(workerType)) {
loadMemberWorkerParameters(params);
} else if ("javaclient".equals(workerType)) {
loadJavaClientWorkerParameters(params);
} else if ("litemember".equals(workerType)) {
loadLiteMemberWorkerParameters(params);
} else {
throw new IllegalArgumentException(String.format("Unsupported workerType [%s]", workerType));
}
return params;
}
use of com.hazelcast.simulator.agent.workerprocess.WorkerParameters in project hazelcast-simulator by hazelcast.
the class JetDriver method loadWorkerParameters.
@Override
public WorkerParameters loadWorkerParameters(String workerType, int agentIndex) {
Map<String, String> s = new HashMap<String, String>(properties);
s.remove("CONFIG");
WorkerParameters params = new WorkerParameters().setAll(s).set("WORKER_TYPE", workerType).set("file:log4j.xml", loadLog4jConfig());
if ("member".equals(workerType)) {
loadMemberWorkerParameters(params);
} else if ("javaclient".equals(workerType)) {
loadJavaClientWorkerParameters(params);
} else if ("litemember".equals(workerType)) {
loadLiteMemberWorkerParameters(params);
} else {
throw new IllegalArgumentException(String.format("Unsupported workerType [%s]", workerType));
}
return params;
}
use of com.hazelcast.simulator.agent.workerprocess.WorkerParameters in project hazelcast-simulator by hazelcast.
the class IgniteDriverTest method test.
@Test
public void test() throws Exception {
VendorDriver<Ignite> driverAtCoordinator = new IgniteDriver().setAgents(singletonList(agent));
WorkerParameters workerParameters = driverAtCoordinator.loadWorkerParameters("member", agent.getAddressIndex());
for (Map.Entry<String, String> entry : workerParameters.entrySet()) {
String key = entry.getKey();
if (key.startsWith("file:")) {
writeText(entry.getValue(), new File(getUserDir(), key.substring(5, key.length())));
}
}
VendorDriver<Ignite> driverAtWorker = new IgniteDriver().setAll(workerParameters.asMap());
driverAtWorker.startVendorInstance();
Ignite ignite = driverAtWorker.getVendorInstance();
assertNotNull(ignite);
driverAtWorker.close();
}
Aggregations