Search in sources :

Example 36 with OServerAdmin

use of com.orientechnologies.orient.client.remote.OServerAdmin in project orientdb by orientechnologies.

the class OrientGraphRemoteTest method dropGraph.

@Override
public void dropGraph(final String graphDirectoryName) {
    // while to unlock files
    try {
        final String url = "remote:localhost:" + serverPort + "/" + graphDirectoryName;
        final OrientGraph graph = currentGraphs.get(url);
        if (graph != null && !graph.isClosed())
            graph.shutdown();
        final OrientGraphFactory factory = graphFactories.remove(url);
        if (factory != null)
            factory.close();
        final OServerAdmin serverAdmin = new OServerAdmin(url);
        serverAdmin.connect("root", "root");
        if (serverAdmin.existsDatabase(OrientGraphTest.getStorageType()))
            serverAdmin.dropDatabase(OrientGraphTest.getStorageType());
        serverAdmin.close();
    } catch (Exception e) {
        throw new IllegalStateException(e);
    }
}
Also used : OServerAdmin(com.orientechnologies.orient.client.remote.OServerAdmin)

Example 37 with OServerAdmin

use of com.orientechnologies.orient.client.remote.OServerAdmin in project orientdb by orientechnologies.

the class OrientCommitMT method setUp.

@Before
public void setUp() throws IOException {
    if (DB_URL.startsWith("remote:")) {
        OServerAdmin serverAdmin = new OServerAdmin(DB_URL);
        serverAdmin.connect("root", ODatabaseHelper.getServerRootPassword());
        if (serverAdmin.existsDatabase(OrientGraphTest.getStorageType())) {
            serverAdmin.dropDatabase(OrientGraphTest.getStorageType());
        }
        serverAdmin.createDatabase(DB_URL, "graph", OrientGraphTest.getStorageType());
    } else {
        OrientGraph graph = new OrientGraph(DB_URL, DB_USER, DB_PASSWORD);
        graph.drop();
        graph = new OrientGraph(DB_URL, DB_USER, DB_PASSWORD);
        graph.shutdown();
    }
    factory = new OrientGraphFactory(DB_URL).setupPool(5, 10);
    buildSchemaAndSeed();
    this.isValidData = true;
}
Also used : OServerAdmin(com.orientechnologies.orient.client.remote.OServerAdmin) Before(org.junit.Before)

Example 38 with OServerAdmin

use of com.orientechnologies.orient.client.remote.OServerAdmin in project orientdb by orientechnologies.

the class TestSelectProjectionVertexRemote method before.

@Before
public void before() throws ClassNotFoundException, MalformedObjectNameException, InstanceAlreadyExistsException, NotCompliantMBeanException, MBeanRegistrationException, InvocationTargetException, NoSuchMethodException, InstantiationException, IOException, IllegalAccessException {
    server = new OServer(false);
    server.startup(OrientGraphRemoteTest.class.getResourceAsStream("/embedded-server-config-single-run.xml"));
    server.activate();
    OServerAdmin admin = new OServerAdmin("remote:localhost:3064");
    admin.connect("root", "root");
    admin.createDatabase(TestSelectProjectionVertexRemote.class.getSimpleName(), "graph", "memory");
    admin.close();
}
Also used : OServer(com.orientechnologies.orient.server.OServer) OServerAdmin(com.orientechnologies.orient.client.remote.OServerAdmin) Before(org.junit.Before)

Example 39 with OServerAdmin

use of com.orientechnologies.orient.client.remote.OServerAdmin in project orientdb by orientechnologies.

the class HookInstallServerTest method before.

@Before
public void before() throws MalformedObjectNameException, InstanceAlreadyExistsException, MBeanRegistrationException, NotCompliantMBeanException, ClassNotFoundException, NullPointerException, IOException, IllegalArgumentException, SecurityException, InvocationTargetException, NoSuchMethodException, InstantiationException, IllegalAccessException {
    server = new OServer();
    OServerConfigurationManager ret = new OServerConfigurationManager(this.getClass().getClassLoader().getResourceAsStream("com/orientechnologies/orient/server/network/orientdb-server-config.xml"));
    OServerHookConfiguration hc = new OServerHookConfiguration();
    hc.clazz = MyHook.class.getName();
    ret.getConfiguration().hooks = new ArrayList<OServerHookConfiguration>();
    ret.getConfiguration().hooks.add(hc);
    server.startup(ret.getConfiguration());
    server.activate();
    OServerAdmin admin = new OServerAdmin("remote:localhost");
    admin.connect("root", "D2AFD02F20640EC8B7A5140F34FCA49D2289DB1F0D0598BB9DE8AAA75A0792F3");
    admin.createDatabase("test", "nothign", "memory");
    admin.close();
}
Also used : OServerHookConfiguration(com.orientechnologies.orient.server.config.OServerHookConfiguration) OServerConfigurationManager(com.orientechnologies.orient.server.config.OServerConfigurationManager) OServerAdmin(com.orientechnologies.orient.client.remote.OServerAdmin) Before(org.junit.Before)

Example 40 with OServerAdmin

use of com.orientechnologies.orient.client.remote.OServerAdmin in project orientdb by orientechnologies.

the class ORemoteImportTest method before.

@Before
public void before() throws Exception {
    server = new OServer();
    server.setServerRootDirectory(SERVER_DIRECTORY);
    server.startup(getClass().getResourceAsStream("orientdb-server-config.xml"));
    server.activate();
    OServerAdmin server = new OServerAdmin("remote:localhost");
    server.connect("root", "D2AFD02F20640EC8B7A5140F34FCA49D2289DB1F0D0598BB9DE8AAA75A0792F3");
    server.createDatabase(ORemoteImportTest.class.getSimpleName(), "graph", "memory");
}
Also used : OServer(com.orientechnologies.orient.server.OServer) OServerAdmin(com.orientechnologies.orient.client.remote.OServerAdmin) Before(org.junit.Before)

Aggregations

OServerAdmin (com.orientechnologies.orient.client.remote.OServerAdmin)46 ODatabaseDocumentTx (com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx)9 Before (org.junit.Before)9 OServer (com.orientechnologies.orient.server.OServer)8 OStorageProxy (com.orientechnologies.orient.core.storage.OStorageProxy)6 IOException (java.io.IOException)5 Test (org.testng.annotations.Test)5 ODocument (com.orientechnologies.orient.core.record.impl.ODocument)4 ONeedRetryException (com.orientechnologies.common.concur.ONeedRetryException)3 ConsoleCommand (com.orientechnologies.common.console.annotation.ConsoleCommand)3 OCommandSQL (com.orientechnologies.orient.core.sql.OCommandSQL)3 ODatabaseDocument (com.orientechnologies.orient.core.db.document.ODatabaseDocument)2 OIdentifiable (com.orientechnologies.orient.core.db.record.OIdentifiable)2 ORidBag (com.orientechnologies.orient.core.db.record.ridbag.ORidBag)2 OConcurrentModificationException (com.orientechnologies.orient.core.exception.OConcurrentModificationException)2 AfterMethod (org.testng.annotations.AfterMethod)2 BeforeMethod (org.testng.annotations.BeforeMethod)2 ORemoteConnectionManager (com.orientechnologies.orient.client.remote.ORemoteConnectionManager)1 OCommandScript (com.orientechnologies.orient.core.command.script.OCommandScript)1 OPartitionedDatabasePool (com.orientechnologies.orient.core.db.OPartitionedDatabasePool)1