use of com.hazelcast.simulator.protocol.core.SimulatorAddress in project hazelcast-simulator by hazelcast.
the class RegistryTest method testAddWorkers.
@Test
public void testAddWorkers() {
SimulatorAddress agentAddress = addAgent();
List<WorkerParameters> parametersList = newWorkerParametersList(agentAddress, 10);
assertEquals(0, registry.workerCount());
registry.addWorkers(parametersList);
assertEquals(10, registry.workerCount());
}
use of com.hazelcast.simulator.protocol.core.SimulatorAddress in project hazelcast-simulator by hazelcast.
the class RegistryTest method testHasClientWorkers_withoutClientWorkers.
@Test
public void testHasClientWorkers_withoutClientWorkers() {
SimulatorAddress agentAddress = addAgent();
List<WorkerParameters> parametersList = newWorkerParametersList(agentAddress, 2);
registry.addWorkers(parametersList);
assertFalse(registry.hasClientWorkers());
}
use of com.hazelcast.simulator.protocol.core.SimulatorAddress 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.protocol.core.SimulatorAddress 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.protocol.core.SimulatorAddress in project hazelcast-simulator by hazelcast.
the class StartWorkersTaskTest method testCreateWorkers_withClients.
@Test
public void testCreateWorkers_withClients() throws Exception {
Map<SimulatorAddress, List<WorkerParameters>> deploymentPlan = getDeployment(0, 6, 3);
Future f = mock(Future.class);
when(f.get()).thenReturn("SUCCESS");
when(client.submit(eq(agent1.getAddress()), any(CreateWorkerOperation.class))).thenReturn(f);
when(client.submit(eq(agent2.getAddress()), any(CreateWorkerOperation.class))).thenReturn(f);
when(client.submit(eq(agent3.getAddress()), any(CreateWorkerOperation.class))).thenReturn(f);
new StartWorkersTask(deploymentPlan, Collections.<String, String>emptyMap(), client, registry, 0).run();
assertComponentRegistry(registry, 6, 3);
}
Aggregations