@Before public void prepareDatabase() throws Exception { String dbUrl = "memory:test"; ODatabaseDocumentTx db = new ODatabaseDocumentTx(dbUrl); String username = "******"; String password = "******"; if (db.exists()) { db.activateOnCurrentThread(); db.open(username, password); db.drop(); } db.create(); createSchemaDB(db); if (!new File("./src/test/resources/file.pdf").exists()) OLogManager.instance() .warn( this, "TEST IS NOT RUNNING UNDER distributed folder, attachment will be not loaded!"); loadDB(db, 20); Properties info = new Properties(); info.put("user", username); info.put("password", password); conn = (OrientJdbcConnection) DriverManager.getConnection("jdbc:orient:" + dbUrl, info); }
@Test public static void main(String[] args) { database = new ODatabaseDocumentTx("local:/tmp/secmask/secmask"); if (database.exists()) database.open("admin", "admin"); else { database.create(); create(); } // insert(); query(); }
@Before public void setuUp() throws Exception { spwanServer(); baseDocumentTx = new ODatabaseDocumentTx( "plocal:" + buildDir.getAbsolutePath() + "/baseUniqueIndexCrashRestore"); if (baseDocumentTx.exists()) { baseDocumentTx.open("admin", "admin"); baseDocumentTx.drop(); } baseDocumentTx.create(); testDocumentTx = new ODatabaseDocumentTx("remote:localhost:3500/testUniqueIndexCrashRestore"); testDocumentTx.open("admin", "admin"); }
@BeforeClass public void beforeClass() { buildDirectory = System.getProperty("buildDirectory"); if (buildDirectory == null) buildDirectory = "."; databaseDocumentTx = new ODatabaseDocumentTx("plocal:" + buildDirectory + "/localSBTreeBigValuesTest"); if (databaseDocumentTx.exists()) { databaseDocumentTx.open("admin", "admin"); databaseDocumentTx.drop(); } databaseDocumentTx.create(); sbTree = new OSBTree<Integer, byte[]>( "sbTree", ".sbt", false, ".nbt", (OAbstractPaginatedStorage) databaseDocumentTx.getStorage()); sbTree.create(OIntegerSerializer.INSTANCE, OBinaryTypeSerializer.INSTANCE, null, 1, false); }
@Override @Test(enabled = false) public void init() throws Exception { String buildDirectory = System.getProperty("buildDirectory", "."); if (buildDirectory == null) buildDirectory = "."; databaseDocumentTx = new ODatabaseDocumentTx("local:" + buildDirectory + "/uniqueHashIndexTest"); if (databaseDocumentTx.exists()) { databaseDocumentTx.open("admin", "admin"); databaseDocumentTx.drop(); } databaseDocumentTx.create(); long maxMemory = 2L * 1024 * 1024 * 1024; System.out.println("Max memory :" + maxMemory); buffer = new O2QCache( maxMemory, 15000, ODirectMemoryFactory.INSTANCE.directMemory(), null, OHashIndexBucket.MAX_BUCKET_SIZE_BYTES, (OStorageLocal) databaseDocumentTx.getStorage(), false); hashIndex = new OUniqueHashIndex(); hashIndex.create( "uhashIndexTest", new OSimpleKeyIndexDefinition(OType.STRING), databaseDocumentTx, OMetadata.CLUSTER_INDEX_NAME, new int[0], null); }