use of org.ow2.proactive.resourcemanager.db.RMDBManager in project scheduling by ow2-proactive.
the class NodesLockRestorationManager method findNodesLockedOnPreviousRun.
Map<String, MutableInteger> findNodesLockedOnPreviousRun() {
RMDBManager dbManager = rmCore.getDbManager();
Map<String, MutableInteger> nodesLockedOnPreviousRun = dbManager.findNodesLockedOnPreviousRun();
dbManager.clearLockHistory();
return nodesLockedOnPreviousRun;
}
use of org.ow2.proactive.resourcemanager.db.RMDBManager in project scheduling by ow2-proactive.
the class NodeHistoryTest method initDB.
@BeforeClass
public static void initDB() throws Exception {
PAResourceManagerProperties.RM_ALIVE_EVENT_FREQUENCY.updateProperty("100");
Configuration config = new Configuration().configure("/functionaltests/config/hibernate-unit.cfg.xml");
dbManager = new RMDBManager(config, true, true);
}
use of org.ow2.proactive.resourcemanager.db.RMDBManager in project scheduling by ow2-proactive.
the class NodeHistoryTest method testSaveHistory.
public void testSaveHistory() throws Exception {
Configuration config = new Configuration().configure("/functionaltests/config/hibernate-unit.cfg.xml");
dbManager = new RMDBManager(config, true, true);
NodeHistory expected = createNodeHistory(1);
dbManager.saveNodeHistory(expected);
List<?> rows = dbManager.executeSqlQuery("from NodeHistory");
Assert.assertEquals(1, rows.size());
NodeHistory actual = (NodeHistory) rows.get(0);
assertEquals(expected, actual);
}
use of org.ow2.proactive.resourcemanager.db.RMDBManager in project scheduling by ow2-proactive.
the class NodeSourcesTest method setUp.
@Before
public void setUp() throws Exception {
PAResourceManagerProperties.RM_ALIVE_EVENT_FREQUENCY.updateProperty("100");
Configuration config = new Configuration().configure("/functionaltests/config/hibernate-unit.cfg.xml");
dbManager = new RMDBManager(config, true, true);
infrastructureVariables = new HashMap<>();
infrastructureVariables.put(INFRASTRUCTURE_VARIABLE_KEY, INFRASTRUCTURE_VARIABLE_VALUE);
}
use of org.ow2.proactive.resourcemanager.db.RMDBManager in project scheduling by ow2-proactive.
the class RMDBManager method createUsingProperties.
private static RMDBManager createUsingProperties() {
if (System.getProperty(RM_DATABASE_IN_MEMORY) != null) {
return createInMemoryRMDBManager();
} else {
File configFile = new File(PAResourceManagerProperties.getAbsolutePath(PAResourceManagerProperties.RM_DB_HIBERNATE_CONFIG.getValueAsString()));
boolean drop = PAResourceManagerProperties.RM_DB_HIBERNATE_DROPDB.getValueAsBoolean();
boolean dropNS = PAResourceManagerProperties.RM_DB_HIBERNATE_DROPDB_NODESOURCES.getValueAsBoolean();
if (logger.isInfoEnabled()) {
logger.info("Starting RM DB Manager " + "with drop DB = " + drop + " and drop nodesources = " + dropNS + " and configuration file = " + configFile.getAbsolutePath());
}
Configuration configuration = new Configuration();
if (configFile.getName().endsWith(".xml")) {
configuration.configure(configFile);
} else {
try {
Properties properties = new Properties();
properties.load(Files.newBufferedReader(configFile.toPath(), Charset.defaultCharset()));
configuration.addProperties(properties);
} catch (IOException e) {
throw new IllegalArgumentException(e);
}
}
return new RMDBManager(configuration, drop, dropNS);
}
}
Aggregations