Search in sources :

Example 6 with OEngine

use of com.orientechnologies.orient.core.engine.OEngine in project orientdb by orientechnologies.

the class Orient method registerEngine.

protected void registerEngine(final OEngine iEngine) throws IllegalArgumentException {
    OEngine oEngine = engines.get(iEngine.getName());
    if (oEngine != null) {
        if (!oEngine.getClass().isAssignableFrom(iEngine.getClass())) {
            throw new IllegalArgumentException("Cannot replace storage " + iEngine.getName());
        }
    }
    engines.put(iEngine.getName(), iEngine);
}
Also used : OEngine(com.orientechnologies.orient.core.engine.OEngine)

Example 7 with OEngine

use of com.orientechnologies.orient.core.engine.OEngine in project orientdb by orientechnologies.

the class PostponedEngineStartTest method testEngineRestart.

// @Test(dependsOnMethods = "testGetRunningEngineShouldStartEngine")
public void testEngineRestart() {
    OEngine engine = ORIENT.getRunningEngine(ENGINE1.getName());
    engine.shutdown();
    Assert.assertFalse(engine.isRunning());
    engine = ORIENT.getEngineIfRunning(ENGINE1.getName());
    Assert.assertNull(engine);
    engine = ORIENT.getEngine(ENGINE1.getName());
    Assert.assertFalse(engine.isRunning());
    engine = ORIENT.getRunningEngine(ENGINE1.getName());
    Assert.assertTrue(engine.isRunning());
}
Also used : OEngine(com.orientechnologies.orient.core.engine.OEngine)

Example 8 with OEngine

use of com.orientechnologies.orient.core.engine.OEngine in project orientdb by orientechnologies.

the class PostponedEngineStartTest method testEngineShouldNotStartAtRuntimeStart.

// @Test
public void testEngineShouldNotStartAtRuntimeStart() {
    final OEngine engine = ORIENT.getEngine(ENGINE1.getName());
    Assert.assertFalse(engine.isRunning());
}
Also used : OEngine(com.orientechnologies.orient.core.engine.OEngine)

Example 9 with OEngine

use of com.orientechnologies.orient.core.engine.OEngine in project orientdb by orientechnologies.

the class PostponedEngineStartTest method testGetRunningEngineShouldThrowIfEngineIsUnableToStart.

//@Test
public void testGetRunningEngineShouldThrowIfEngineIsUnableToStart() {
    OEngine engine = ORIENT.getEngine(FAULTY_ENGINE.getName());
    Assert.assertNotNull(engine, "engine should be registered");
    Assert.assertThrows(IllegalStateException.class, new Assert.ThrowingRunnable() {

        @Override
        public void run() throws Throwable {
            ORIENT.getRunningEngine(FAULTY_ENGINE.getName());
        }
    });
    engine = ORIENT.getEngine(FAULTY_ENGINE.getName());
    Assert.assertNull(engine, "engine should be unregistered");
}
Also used : Assert(org.testng.Assert) OEngine(com.orientechnologies.orient.core.engine.OEngine)

Example 10 with OEngine

use of com.orientechnologies.orient.core.engine.OEngine in project orientdb by orientechnologies.

the class PostponedEngineStartTest method testGetEngineIfRunningShouldReturnNullEngineIfNotRunning.

// @Test(dependsOnMethods = "testEngineShouldNotStartAtRuntimeStart")
public void testGetEngineIfRunningShouldReturnNullEngineIfNotRunning() {
    final OEngine engine = ORIENT.getEngineIfRunning(ENGINE1.getName());
    Assert.assertNull(engine);
}
Also used : OEngine(com.orientechnologies.orient.core.engine.OEngine)

Aggregations

OEngine (com.orientechnologies.orient.core.engine.OEngine)10 OStorage (com.orientechnologies.orient.core.storage.OStorage)2 OConfigurationException (com.orientechnologies.orient.core.exception.OConfigurationException)1 OIdentifiableStorage (com.orientechnologies.orient.core.storage.OIdentifiableStorage)1 File (java.io.File)1 IOException (java.io.IOException)1 Assert (org.testng.Assert)1