private void processCreateTest(CreateTestOperation operation) {
LOGGER.info(operation.getTestCase().toString());
TestCase testCase = operation.getTestCase();
int testIndex = operation.getTestIndex();
WorkerConnector workerConnector = worker.getWorkerConnector();
if (workerConnector.getTest(testIndex) != null) {
throw new IllegalStateException(format("Can't init TestCase: %s, another test with testIndex %d already exists",
operation, testIndex));
}
String testId = testCase.getId();
if (tests.containsKey(testId)) {
throw new IllegalStateException(format("Can't init TestCase: %s, another test with testId [%s] already exists",
operation, testId));
}
LOGGER.info(format("%s Initializing test %s %s%n%s", DASHES, testId, DASHES, testCase));
TestContextImpl testContext = new TestContextImpl(
hazelcastInstance, testId, worker.getPublicIpAddress(), workerConnector);
TestContainer testContainer = new TestContainer(testContext, testCase);
SimulatorAddress testAddress = workerAddress.getChild(testIndex);
TestOperationProcessor processor = new TestOperationProcessor(worker, type, testContainer, testAddress);
workerConnector.addTest(testIndex, processor);
tests.put(testId, testContainer);
if (type == WorkerType.MEMBER) {
hazelcastInstance.getUserContext().put(getUserContextKeyFromTestId(testId), testContainer.getTestInstance());
}
}