use of com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx in project orientdb by orientechnologies.
the class OCommandExecutorSQLDeleteEdgeTest method init.
@BeforeClass
public static void init() throws Exception {
db = new ODatabaseDocumentTx("memory:" + OCommandExecutorSQLDeleteEdgeTest.class.getSimpleName());
if (db.exists()) {
db.open("admin", "admin");
db.drop();
}
db.create();
final OSchema schema = db.getMetadata().getSchema();
schema.createClass("User", schema.getClass("V"));
schema.createClass("Folder", schema.getClass("V"));
schema.createClass("CanAccess", schema.getClass("E"));
}
use of com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx in project orientdb by orientechnologies.
the class LuceneBackupRestoreTest method setUp.
@Before
public void setUp() throws Exception {
String url = "plocal:./target/" + getClass().getName();
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.core.db.document.ODatabaseDocumentTx in project orientdb by orientechnologies.
the class LuceneDropTest method setUp.
@Before
public void setUp() throws Exception {
dbName = "plocal:./target/databases/" + this.getClass().getSimpleName();
// @maggiolo00 set cont to 0 and the test will not fail anymore
insertcount = 100;
ODatabaseDocumentTx db = new ODatabaseDocumentTx(dbName);
db.create();
OClass test = db.getMetadata().getSchema().createClass("test");
test.createProperty("name", OType.STRING);
db.command(new OCommandSQL("create index test.name on test (name) FULLTEXT ENGINE LUCENE")).execute();
db.close();
}
use of com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx in project orientdb by orientechnologies.
the class LuceneFreezeReleaseTest method freezeReleaseMisUsageTest.
// With double calling freeze/release
@Test
public void freezeReleaseMisUsageTest() {
ODatabaseDocument db = new ODatabaseDocumentTx("plocal:target/freezeRelease");
db.create();
OSchema schema = db.getMetadata().getSchema();
OClass person = schema.createClass("Person");
person.createProperty("name", OType.STRING);
db.command(new OCommandSQL("create index Person.name on Person (name) FULLTEXT ENGINE LUCENE")).execute();
db.save(new ODocument("Person").field("name", "John"));
try {
Collection results = db.command(new OCommandSQL("select from Person where name lucene 'John'")).execute();
Assert.assertEquals(1, results.size());
db.freeze();
db.freeze();
results = db.command(new OCommandSQL("select from Person where name lucene 'John'")).execute();
Assert.assertEquals(1, results.size());
db.release();
db.release();
db.save(new ODocument("Person").field("name", "John"));
results = db.command(new OCommandSQL("select from Person where name lucene 'John'")).execute();
Assert.assertEquals(2, results.size());
} finally {
db.drop();
}
}
use of com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx in project orientdb by orientechnologies.
the class LuceneMiscTest method testSubLucene.
// TODO Re-enable when removed check syntax on ODB
@Test
public void testSubLucene() {
OrientGraphNoTx graph = new OrientGraphNoTx("memory:doubleLucene");
try {
ODatabaseDocumentTx db = graph.getRawGraph();
db.command(new OCommandSQL("create class Person extends V")).execute();
db.command(new OCommandSQL("create property Person.name string")).execute();
db.command(new OCommandSQL("create index Person.name on Person (name) fulltext engine lucene")).execute();
db.command(new OCommandSQL("insert into Person set name='Enrico', age=18")).execute();
OSQLSynchQuery query = new OSQLSynchQuery("select from (select from Person where age = 18) where name lucene 'Enrico'");
List results = db.command(query).execute();
Assert.assertEquals(results.size(), 1);
// WITH PROJECTION does not work as the class is missing
query = new OSQLSynchQuery("select from (select name from Person where age = 18) where name lucene 'Enrico'");
results = db.command(query).execute();
Assert.assertEquals(results.size(), 0);
} finally {
graph.drop();
}
}
Aggregations