use of com.tinkerpop.blueprints.impls.orient.OrientGraphNoTx in project orientdb by orientechnologies.
the class LuceneNullTest method testNotNullChangeToNullWithLists.
@Test
public void testNotNullChangeToNullWithLists() {
OrientGraphNoTx graph = new OrientGraphNoTx("memory:testNotNullChangeToNullWithLists");
try {
ODatabaseDocumentTx db = graph.getRawGraph();
db.command(new OCommandSQL("create class Test extends V")).execute();
db.command(new OCommandSQL("create property Test.names EMBEDDEDLIST STRING")).execute();
db.command(new OCommandSQL("create index Test.names on Test (names) fulltext engine lucene")).execute();
ODocument doc = new ODocument("Test");
db.begin();
doc.field("names", new String[] { "foo" });
db.save(doc);
db.commit();
db.begin();
doc.removeField("names");
db.save(doc);
db.commit();
OIndex<?> index = db.getMetadata().getIndexManager().getIndex("Test.names");
Assert.assertEquals(index.getSize(), 0);
} finally {
graph.drop();
}
}
use of com.tinkerpop.blueprints.impls.orient.OrientGraphNoTx in project orientdb by orientechnologies.
the class OrientDbCreationHelper method loadDB.
public static void loadDB(ODatabaseDocumentTx db, int documents) throws IOException {
db.declareIntent(new OIntentMassiveInsert());
for (int i = 1; i <= documents; i++) {
ODocument doc = new ODocument();
doc.setClassName("Item");
doc = createItem(i, doc);
db.save(doc, "Item");
}
db.declareIntent(null);
createAuthorAndArticles(db, 50, 50);
createArticleWithAttachmentSplitted(db);
createWriterAndPosts(new OrientGraphNoTx(db), 10, 10);
}
use of com.tinkerpop.blueprints.impls.orient.OrientGraphNoTx in project orientdb by orientechnologies.
the class TestNotTxVertexDropWithRidBagTree method before.
@Before
public void before() {
graph = new OrientGraphNoTx("memory:" + TestNotTxVertexDropWithRidBagTree.class.getSimpleName());
graph.createVertexType("Test");
graph.createEdgeType("Ref");
}
use of com.tinkerpop.blueprints.impls.orient.OrientGraphNoTx in project orientdb by orientechnologies.
the class OGremlinConsoleTest method testGraphMLImportIgnoreVAttribute.
@Test
public void testGraphMLImportIgnoreVAttribute() throws IOException {
final String INPUT_FILE = "src/test/resources/graph-example-fromexport.xml";
String dbUrl = "memory:testGraphMLImportIgnoreVAttribute";
final OGraphMLReader graphml = new OGraphMLReader(new OrientGraphNoTx(dbUrl)).defineVertexAttributeStrategy("__type__", new OIgnoreGraphMLImportStrategy()).inputGraph(INPUT_FILE);
ODatabaseDocumentTx db = new ODatabaseDocumentTx(dbUrl);
db.open("admin", "admin");
try {
List<ODocument> result = db.query(new OSQLSynchQuery<ODocument>("select from V"));
Assert.assertFalse(result.isEmpty());
for (ODocument d : result) {
Assert.assertFalse(d.containsField("__type__"));
}
} finally {
db.close();
}
}
use of com.tinkerpop.blueprints.impls.orient.OrientGraphNoTx in project orientdb by orientechnologies.
the class GraphValidationTest method ok.
@Test
public void ok() {
setupSchema();
final OrientGraphNoTx graphNoTx = new OrientGraphNoTx(URL, "admin", "admin");
try {
graphNoTx.addVertex("class:M", "name", "n0");
try {
graphNoTx.addVertex("class:M");
throw new RuntimeException("Schema problem was not detected!");
} catch (Throwable e) {
// This is what happens => OK
System.out.println("This is the Message I want to see: \n" + e);
}
graphNoTx.commit();
} finally {
graphNoTx.shutdown();
}
}
Aggregations