use of org.ow2.proactive.resourcemanager.core.history.LockHistory in project scheduling by ow2-proactive.
the class RMDBManagerTest method testCreateLockEntryOrUpdateEnabled.
@Test
public void testCreateLockEntryOrUpdateEnabled() {
int nbEntries = 42;
Map<String, Integer> entries = insertEntries(nbEntries);
List<LockHistory> lockHistories = dbManager.getLockHistories();
assertThat(lockHistories).hasSize(nbEntries);
for (int i = 0; i < nbEntries; i++) {
Integer found = entries.remove("nodeSource" + i);
assertThat(found).isNotNull();
assertThat(found).isEqualTo(i);
}
assertThat(entries).hasSize(0);
}
use of org.ow2.proactive.resourcemanager.core.history.LockHistory in project scheduling by ow2-proactive.
the class RMDBManager method entityToMap.
public Map<String, MutableInteger> entityToMap(List<LockHistory> lockHistoryResult) {
if (lockHistoryResult == null || lockHistoryResult.isEmpty()) {
return Maps.newHashMap();
}
Map<String, MutableInteger> result = new HashMap<>(lockHistoryResult.size(), 1f);
for (Object entry : lockHistoryResult) {
LockHistory lockHistory = (LockHistory) entry;
int lockCount = lockHistory.getLockCount();
if (lockCount > 0) {
result.put(lockHistory.getNodeSource(), new MutableInteger(lockCount));
}
}
return result;
}
Aggregations