Search in sources :

Example 16 with OServer

use of com.orientechnologies.orient.server.OServer 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 17 with OServer

use of com.orientechnologies.orient.server.OServer in project orientdb by orientechnologies.

the class OLuceneIndexCrashRestoreIT method testEntriesAddition.

@Test
@Ignore
public void testEntriesAddition() throws Exception {
    createSchema(testDocumentTx);
    System.out.println("Start data propagation");
    List<Future> futures = new ArrayList<Future>();
    for (int i = 0; i < 4; i++) {
        futures.add(executorService.submit(new DataPropagationTask(testDocumentTx)));
    }
    System.out.println("Wait for 5 minutes");
    TimeUnit.SECONDS.sleep(5);
    //test query
    // verify that the keyword analyzer is doing is job
    testDocumentTx.activateOnCurrentThread();
    //wildcard will not work
    List<ODocument> res = testDocumentTx.query(new OSQLSynchQuery<ODocument>("select from Person where name lucene 'Rob*' "));
    assertThat(res).hasSize(0);
    //plain name fetch docs
    testDocumentTx.activateOnCurrentThread();
    res = testDocumentTx.query(new OSQLSynchQuery<ODocument>("select from Person where name lucene 'Robert' LIMIT 20"));
    assertThat(res).hasSize(20);
    //crash the server
    // this works only on java8
    serverProcess.destroyForcibly();
    serverProcess.waitFor();
    System.out.println("Process was CRASHED");
    //stop data pumpers
    for (Future future : futures) {
        try {
            future.get();
        } catch (Exception e) {
            future.cancel(true);
        }
    }
    System.out.println("All loaders done");
    //now we start embedded
    System.out.println("START AGAIN");
    //start embedded
    OServer server = OServerMain.create();
    InputStream conf = RemoteDBRunner.class.getResourceAsStream("index-crash-config.xml");
    server.startup(conf);
    server.activate();
    while (!server.isActive()) {
        System.out.println("server active = " + server.isActive());
        TimeUnit.SECONDS.sleep(1);
    }
    //test query
    testDocumentTx.activateOnCurrentThread();
    testDocumentTx.getMetadata().reload();
    OIndex<?> index = testDocumentTx.getMetadata().getIndexManager().getIndex("Person.name");
    assertThat(index).isNotNull();
    //sometimes the metadata is null!!!!!
    assertThat((Iterable<? extends Map.Entry<String, Object>>) index.getMetadata()).isNotNull();
    assertThat(index.getMetadata().<String>field("default")).isNotNull();
    assertThat(index.getMetadata().<String>field("default")).isEqualTo("org.apache.lucene.analysis.core.KeywordAnalyzer");
    assertThat(index.getMetadata().<String>field("unknownKey")).isEqualTo("unknownValue");
    //sometimes it is not null, and all works fine
    res = testDocumentTx.query(new OSQLSynchQuery<ODocument>("select from Person where name lucene 'Rob*' "));
    assertThat(res).hasSize(0);
    testDocumentTx.activateOnCurrentThread();
    res = testDocumentTx.query(new OSQLSynchQuery<ODocument>("select from Person where name lucene 'Robert' LIMIT 20"));
    assertThat(res).hasSize(20);
    //shutdown embedded
    server.shutdown();
}
Also used : OServer(com.orientechnologies.orient.server.OServer) InputStream(java.io.InputStream) OSQLSynchQuery(com.orientechnologies.orient.core.sql.query.OSQLSynchQuery) ArrayList(java.util.ArrayList) ODocument(com.orientechnologies.orient.core.record.impl.ODocument)

Example 18 with OServer

use of com.orientechnologies.orient.server.OServer in project orientdb by orientechnologies.

the class LuceneAutomaticBackupRestoreTest method setUp.

@Before
public void setUp() throws Exception {
    System.setProperty("ORIENTDB_HOME", tempFolder.getRoot().getAbsolutePath());
    URL = "plocal:" + tempFolder.getRoot().getAbsolutePath() + File.separator + "databases" + File.separator + DBNAME;
    BACKUPDIR = tempFolder.getRoot().getAbsolutePath() + File.separator + "backups";
    BACKUFILE = BACKUPDIR + File.separator + DBNAME;
    tempFolder.newFolder("config");
    server = new OServer() {

        @Override
        public Map<String, String> getAvailableStorageNames() {
            HashMap<String, String> result = new HashMap<String, String>();
            result.put(DBNAME, URL);
            return result;
        }
    };
    databaseDocumentTx = new ODatabaseDocumentTx(URL);
    dropIfExists();
    databaseDocumentTx.create();
    databaseDocumentTx.command(new OCommandSQL("create class City ")).execute();
    databaseDocumentTx.command(new OCommandSQL("create property City.name string")).execute();
    databaseDocumentTx.command(new OCommandSQL("create index City.name on City (name) FULLTEXT ENGINE LUCENE")).execute();
    ODocument doc = new ODocument("City");
    doc.field("name", "Rome");
    databaseDocumentTx.save(doc);
}
Also used : OCommandSQL(com.orientechnologies.orient.core.sql.OCommandSQL) OServer(com.orientechnologies.orient.server.OServer) HashMap(java.util.HashMap) ODatabaseDocumentTx(com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx) HashMap(java.util.HashMap) Map(java.util.Map) ODocument(com.orientechnologies.orient.core.record.impl.ODocument)

Example 19 with OServer

use of com.orientechnologies.orient.server.OServer 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)

Example 20 with OServer

use of com.orientechnologies.orient.server.OServer in project orientdb by orientechnologies.

the class RemoteIndexSupportTest 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("test", "graph", "memory");
}
Also used : OServer(com.orientechnologies.orient.server.OServer) OServerAdmin(com.orientechnologies.orient.client.remote.OServerAdmin) Before(org.junit.Before)

Aggregations

OServer (com.orientechnologies.orient.server.OServer)25 Before (org.junit.Before)9 OServerAdmin (com.orientechnologies.orient.client.remote.OServerAdmin)8 OHazelcastPlugin (com.orientechnologies.orient.server.hazelcast.OHazelcastPlugin)4 File (java.io.File)4 ODatabaseDocumentInternal (com.orientechnologies.orient.core.db.ODatabaseDocumentInternal)3 OCommandExecutionException (com.orientechnologies.orient.core.exception.OCommandExecutionException)3 ODocument (com.orientechnologies.orient.core.record.impl.ODocument)3 ODatabaseDocumentTx (com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx)2 BeforeClass (org.junit.BeforeClass)2 OException (com.orientechnologies.common.exception.OException)1 OCommandSQL (com.orientechnologies.orient.core.sql.OCommandSQL)1 OCommandSQLParsingException (com.orientechnologies.orient.core.sql.OCommandSQLParsingException)1 OSQLSynchQuery (com.orientechnologies.orient.core.sql.query.OSQLSynchQuery)1 OObjectDatabaseTx (com.orientechnologies.orient.object.db.OObjectDatabaseTx)1 ODistributedConfiguration (com.orientechnologies.orient.server.distributed.ODistributedConfiguration)1 OrientGraphRemoteTest (com.tinkerpop.blueprints.impls.orient.OrientGraphRemoteTest)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 ArrayList (java.util.ArrayList)1