use of com.hazelcast.simulator.protocol.core.SimulatorAddress in project hazelcast-simulator by hazelcast.
the class RegistryTest method testHasClientWorkers_withClientWorkers.
@Test
public void testHasClientWorkers_withClientWorkers() {
SimulatorAddress agentAddress = addAgent();
List<WorkerParameters> parametersList = newWorkerParametersList(agentAddress, 2);
registry.addWorkers(parametersList);
parametersList = newWorkerParametersList(agentAddress, 2, "javaclient");
registry.addWorkers(parametersList);
assertTrue(registry.hasClientWorkers());
}
use of com.hazelcast.simulator.protocol.core.SimulatorAddress in project hazelcast-simulator by hazelcast.
the class RegistryTest method testGetWorkers_getMemberWorkers_notEnoughWorkersFound.
@Test(expected = IllegalStateException.class)
public void testGetWorkers_getMemberWorkers_notEnoughWorkersFound() {
SimulatorAddress agentAddress = addAgent();
registry.addWorkers(newWorkerParametersList(agentAddress, 2, "member"));
registry.addWorkers(newWorkerParametersList(agentAddress, 2, "javaclient"));
assertEquals(4, registry.workerCount());
registry.getWorkerAddresses(TargetType.MEMBER, 3);
}
use of com.hazelcast.simulator.protocol.core.SimulatorAddress in project hazelcast-simulator by hazelcast.
the class RegistryTest method testGetWorkers_withHigherWorkerCountThanRegisteredWorkers.
@Test(expected = IllegalArgumentException.class)
public void testGetWorkers_withHigherWorkerCountThanRegisteredWorkers() {
SimulatorAddress agentAddress = addAgent();
registry.addWorkers(newWorkerParametersList(agentAddress, 2, "member"));
registry.addWorkers(newWorkerParametersList(agentAddress, 2, "javaclient"));
assertEquals(4, registry.workerCount());
registry.getWorkerAddresses(TargetType.ALL, 5);
}
use of com.hazelcast.simulator.protocol.core.SimulatorAddress in project hazelcast-simulator by hazelcast.
the class StartWorkersTaskTest method testCreateWorkers_withErrorResponse.
@Test(expected = CommandLineExitException.class)
public void testCreateWorkers_withErrorResponse() throws Exception {
Map<SimulatorAddress, List<WorkerParameters>> deploymentPlan = getDeployment(0, 1, 0);
Future f = mock(Future.class);
when(f.get()).thenThrow(new ExecutionException(null));
when(client.submit(eq(agent1.getAddress()), any(CreateWorkerOperation.class))).thenReturn(f);
new StartWorkersTask(deploymentPlan, Collections.<String, String>emptyMap(), client, registry, 0).run();
}
use of com.hazelcast.simulator.protocol.core.SimulatorAddress in project hazelcast-simulator by hazelcast.
the class MessagingTest method sendCoordinator.
@Test
public void sendCoordinator() throws Exception {
agentServer = new Server("agents").setBrokerURL(broker.getBrokerURL()).setSelfAddress(agentAddress).setProcessor(new OperationProcessor() {
@Override
public void process(SimulatorOperation op, SimulatorAddress source, Promise promise) throws Exception {
}
}).start();
final OperationProcessor clientOperationProcessor = mock(OperationProcessor.class);
client = new CoordinatorClient().setProcessor(clientOperationProcessor);
client.getConnectionFactory().setMaxReconnectAttempts(1);
client.start().connectToAgentBroker(agentAddress, localIp());
agentServer.sendCoordinator(new LogOperation("Foo"));
assertTrueEventually(new AssertTask() {
@Override
public void run() throws Exception {
verify(clientOperationProcessor).process(any(LogOperation.class), eq(agentAddress), any(Promise.class));
}
});
}
Aggregations