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();
}
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();
}
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);
}
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");
}
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");
}
Aggregations