use of com.hazelcast.simulator.utils.BindException in project hazelcast-simulator by hazelcast.
the class TestSuite method load.
@SuppressFBWarnings("DM_DEFAULT_ENCODING")
private void load(String testContent) {
Properties properties = new Properties();
try {
properties.load(new StringReader(testContent));
} catch (UnsupportedEncodingException e) {
throw rethrow(e);
} catch (IOException e) {
throw rethrow(e);
}
Map<String, TestCase> testCases = createTestCases(properties);
if (testCases.isEmpty()) {
throw new BindException("No tests are defined.");
}
if (testCases.size() == 1) {
// use classname instead of empty desc in single test scenarios
TestCase testCase = testCases.values().iterator().next();
String className = testCase.getClassname();
if (testCase.getId().isEmpty() && className != null) {
String desc = className.substring(className.lastIndexOf('.') + 1);
testCases = singletonMap(desc, new TestCase(desc, testCase.getProperties()));
}
}
for (String testCaseId : getTestCaseIds(testCases)) {
TestCase testCase = testCases.get(testCaseId);
if (testCase.getClassname() == null) {
String msg;
if (testCaseId.isEmpty()) {
msg = "There is no class set. Add class=YourTestClass";
} else {
msg = format("There is no class set for test [%s]. Add %s.class=YourTestClass", testCaseId, testCaseId);
}
throw new BindException(msg);
}
addTest(testCase);
}
}
Aggregations