use of com.hazelcast.simulator.protocol.core.SimulatorAddress in project hazelcast-simulator by hazelcast.
the class CoordinatorRemoteCli method loadAddresses.
private static List<String> loadAddresses(OptionSet options, OptionSpec<String> spec, AddressLevel addressLevel) {
String addresses = options.valueOf(spec);
if (addresses == null) {
return null;
}
List<String> result = new LinkedList<String>();
for (String addressString : addresses.split(",")) {
if (addressString != null) {
SimulatorAddress address;
try {
address = SimulatorAddress.fromString(addressString);
} catch (Exception e) {
throw new CommandLineExitException("Worker address [" + addressString + "] is not a valid simulator address", e);
}
if (!address.getAddressLevel().equals(addressLevel)) {
throw new CommandLineExitException("address [" + addressString + "] is not a valid " + addressLevel + " address, it's a " + address.getAddressLevel() + " address");
}
}
result.add(addressString);
}
return result;
}
use of com.hazelcast.simulator.protocol.core.SimulatorAddress in project hazelcast-simulator by hazelcast.
the class WorkerProcessFailureHandler method handle.
public void handle(String message, FailureType type, WorkerProcess workerProcess, String testId, String cause) {
SimulatorAddress workerAddress = workerProcess.getAddress();
String workerId = workerProcess.getId();
FailureOperation failure = new FailureOperation(message, type, workerAddress, agentAddress, workerId, testId, cause);
if (type.isPoisonPill()) {
LOGGER.info(format("Worker %s (%s) finished.", workerId, workerAddress));
} else {
LOGGER.error(format("Detected failure on Worker %s (%s): %s", workerId, workerAddress, failure.getLogMessage(++failureCount)));
}
server.sendCoordinator(failure);
}
use of com.hazelcast.simulator.protocol.core.SimulatorAddress in project hazelcast-simulator by hazelcast.
the class PerformanceStatsCollectorTest method testCalculatePerformanceStats_differentTests.
@Test
public void testCalculatePerformanceStats_differentTests() {
PerformanceStats a1w1Stats = new PerformanceStats(100, 10, 100.0, 50, 100, 200);
PerformanceStats a1w2Stats = new PerformanceStats(200, 20, 200.0, 60, 110, 210);
update(a1w1, TEST_CASE_ID_1, a1w1Stats);
update(a1w2, TEST_CASE_ID_2, a1w2Stats);
PerformanceStats a2w1Stats = new PerformanceStats(300, 30, 300.0, 70, 120, 220);
PerformanceStats a2w2Stats = new PerformanceStats(400, 40, 400.0, 80, 120, 230);
update(a2w1, TEST_CASE_ID_1, a2w1Stats);
update(a2w2, TEST_CASE_ID_2, a2w2Stats);
PerformanceStats totalStats = new PerformanceStats();
Map<SimulatorAddress, PerformanceStats> agentStats = new HashMap<SimulatorAddress, PerformanceStats>();
performanceStatsCollector.calculatePerformanceStats(TEST_CASE_ID_1, totalStats, agentStats);
assertEquals(2, agentStats.size());
assertPerfStatEquals(a1w1Stats, agentStats.get(a1));
assertPerfStatEquals(a2w1Stats, agentStats.get(a2));
assertPerfStatEquals(aggregateAll(a1w1Stats, a2w1Stats), totalStats);
}
use of com.hazelcast.simulator.protocol.core.SimulatorAddress in project hazelcast-simulator by hazelcast.
the class PerformanceStatsCollectorTest method testCalculatePerformanceStats.
@Test
public void testCalculatePerformanceStats() {
PerformanceStats a1w1Stats = new PerformanceStats(100, 10, 100.0, 50, 100, 200);
PerformanceStats a1w2Stats = new PerformanceStats(200, 20, 200.0, 60, 110, 210);
update(a1w1, TEST_CASE_ID_1, a1w1Stats);
update(a1w2, TEST_CASE_ID_1, a1w2Stats);
PerformanceStats a2w1Stats = new PerformanceStats(300, 30, 300.0, 70, 120, 220);
PerformanceStats a2w2Stats = new PerformanceStats(400, 40, 400.0, 80, 120, 230);
update(a2w1, TEST_CASE_ID_1, a2w1Stats);
update(a2w2, TEST_CASE_ID_1, a2w2Stats);
PerformanceStats totalStats = new PerformanceStats();
Map<SimulatorAddress, PerformanceStats> agentStats = new HashMap<SimulatorAddress, PerformanceStats>();
performanceStatsCollector.calculatePerformanceStats(TEST_CASE_ID_1, totalStats, agentStats);
assertEquals(2, agentStats.size());
assertPerfStatEquals(aggregateAll(a1w1Stats, a1w2Stats), agentStats.get(a1));
assertPerfStatEquals(aggregateAll(a2w1Stats, a2w2Stats), agentStats.get(a2));
assertPerfStatEquals(aggregateAll(a1w1Stats, a1w2Stats, a2w1Stats, a2w2Stats), totalStats);
}
use of com.hazelcast.simulator.protocol.core.SimulatorAddress in project hazelcast-simulator by hazelcast.
the class PerformanceStatsCollectorTest method testCalculatePerformanceStats_onEmptyContainer.
@Test
public void testCalculatePerformanceStats_onEmptyContainer() {
PerformanceStats totalPerformanceStats = new PerformanceStats();
Map<SimulatorAddress, PerformanceStats> agentPerformanceStatsMap = new HashMap<SimulatorAddress, PerformanceStats>();
emptyPerformanceStatsCollector.calculatePerformanceStats("foo", totalPerformanceStats, agentPerformanceStatsMap);
assertEquals(0, agentPerformanceStatsMap.size());
assertTrue(totalPerformanceStats.isEmpty());
}
Aggregations