use of org.cerberus.engine.threadpool.entity.TestCaseExecutionQueueToTreat in project cerberus-source by cerberustesting.
the class ExecutionThreadPoolService method getCurrentlyPoolSizes.
@Override
public HashMap<String, Integer> getCurrentlyPoolSizes() throws CerberusException {
AnswerList answer = new AnswerList();
HashMap<String, Integer> constrains_current = new HashMap<String, Integer>();
String const01_key = TestCaseExecutionQueueToTreat.CONSTRAIN1_GLOBAL;
int poolSizeGeneral = parameterService.getParameterIntegerByKey("cerberus_queueexecution_global_threadpoolsize", "", 12);
int poolSizeRobot = parameterService.getParameterIntegerByKey("cerberus_queueexecution_defaultrobothost_threadpoolsize", "", 10);
constrains_current.put(const01_key, poolSizeGeneral);
// Getting RobotHost PoolSize
HashMap<String, Integer> robot_poolsize = new HashMap<String, Integer>();
robot_poolsize = invariantService.readToHashMapGp1IntegerByIdname("ROBOTHOST", poolSizeRobot);
// Getting all executions to be treated.
answer = tceiqService.readQueueToTreat();
List<TestCaseExecutionQueueToTreat> executionsToTreat = (List<TestCaseExecutionQueueToTreat>) answer.getDataList();
// Calculate constrain values.
for (TestCaseExecutionQueueToTreat exe : executionsToTreat) {
String const02_key = TestCaseExecutionQueueToTreat.CONSTRAIN2_APPLICATION + CONST_SEPARATOR + exe.getSystem() + CONST_SEPARATOR + exe.getEnvironment() + CONST_SEPARATOR + exe.getCountry() + CONST_SEPARATOR + exe.getApplication();
String const03_key = TestCaseExecutionQueueToTreat.CONSTRAIN3_ROBOT + CONST_SEPARATOR + exe.getRobotHost();
constrains_current.put(const02_key, exe.getPoolSizeApplication());
// Getting Robot Host PoolSize from invariant hashmap.
int robot_poolsize_final = 0;
if (robot_poolsize.containsKey(exe.getRobotHost())) {
robot_poolsize_final = ParameterParserUtil.parseIntegerParam(robot_poolsize.get(exe.getRobotHost()), poolSizeRobot);
} else {
robot_poolsize_final = 0;
}
constrains_current.put(const03_key, robot_poolsize_final);
}
return constrains_current;
}
Aggregations