Search in sources :

Example 11 with SimulatorAddress

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());
}
Also used : WorkerParameters(com.hazelcast.simulator.agent.workerprocess.WorkerParameters) SimulatorAddress(com.hazelcast.simulator.protocol.core.SimulatorAddress) Test(org.junit.Test)

Example 12 with SimulatorAddress

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());
}
Also used : WorkerParameters(com.hazelcast.simulator.agent.workerprocess.WorkerParameters) SimulatorAddress(com.hazelcast.simulator.protocol.core.SimulatorAddress) Test(org.junit.Test)

Example 13 with SimulatorAddress

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());
}
Also used : WorkerParameters(com.hazelcast.simulator.agent.workerprocess.WorkerParameters) SimulatorAddress(com.hazelcast.simulator.protocol.core.SimulatorAddress) Test(org.junit.Test)

Example 14 with SimulatorAddress

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());
    }
}
Also used : WorkerParameters(com.hazelcast.simulator.agent.workerprocess.WorkerParameters) SimulatorAddress(com.hazelcast.simulator.protocol.core.SimulatorAddress) Test(org.junit.Test)

Example 15 with SimulatorAddress

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);
}
Also used : CreateWorkerOperation(com.hazelcast.simulator.agent.operations.CreateWorkerOperation) Future(java.util.concurrent.Future) List(java.util.List) SimulatorAddress(com.hazelcast.simulator.protocol.core.SimulatorAddress) Test(org.junit.Test)

Aggregations

SimulatorAddress (com.hazelcast.simulator.protocol.core.SimulatorAddress)30 Test (org.junit.Test)20 WorkerParameters (com.hazelcast.simulator.agent.workerprocess.WorkerParameters)8 HashMap (java.util.HashMap)8 Future (java.util.concurrent.Future)7 PerformanceStats (com.hazelcast.simulator.worker.performance.PerformanceStats)6 List (java.util.List)5 LogOperation (com.hazelcast.simulator.protocol.operation.LogOperation)4 SimulatorOperation (com.hazelcast.simulator.protocol.operation.SimulatorOperation)4 ExecutionException (java.util.concurrent.ExecutionException)4 CreateWorkerOperation (com.hazelcast.simulator.agent.operations.CreateWorkerOperation)3 Map (java.util.Map)3 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)3 JMSException (javax.jms.JMSException)3 FailureOperation (com.hazelcast.simulator.coordinator.operations.FailureOperation)2 AssertTask (com.hazelcast.simulator.utils.AssertTask)2 ArrayList (java.util.ArrayList)2 LinkedList (java.util.LinkedList)2 ConcurrentMap (java.util.concurrent.ConcurrentMap)2 AgentData (com.hazelcast.simulator.coordinator.registry.AgentData)1