Skip to content

Commit

Permalink
chore: moved tests to new database api
Browse files Browse the repository at this point in the history
  • Loading branch information
tglman committed Jan 24, 2024
1 parent fdd18ad commit 6d32583
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

import com.orientechnologies.common.io.OFileUtils;
import com.orientechnologies.orient.core.command.OCommandOutputListener;
import com.orientechnologies.orient.core.db.ODatabaseDocumentInternal;
import com.orientechnologies.orient.core.db.document.ODatabaseDocument;
import com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx;
import com.orientechnologies.orient.core.db.tool.ODatabaseCompare;
import com.orientechnologies.orient.core.metadata.schema.OClass;
Expand All @@ -43,7 +45,7 @@
public class StorageBackupTestWithLuceneIndex {
private String buildDirectory;

private ODatabaseDocumentTx db;
private ODatabaseDocumentInternal db;
private String dbDirectory;
private String backedUpDbDirectory;

Expand Down Expand Up @@ -72,7 +74,7 @@ public void after() {
db.drop();
}

final ODatabaseDocumentTx backedUpDb = new ODatabaseDocumentTx("plocal:" + backedUpDbDirectory);
final ODatabaseDocument backedUpDb = new ODatabaseDocumentTx("plocal:" + backedUpDbDirectory);
if (backedUpDb.exists()) {
if (backedUpDb.isClosed()) {
backedUpDb.open("admin", "admin");
Expand Down Expand Up @@ -118,7 +120,8 @@ public void testSingeThreadFullBackup() throws IOException {

OFileUtils.deleteRecursively(new File(backedUpDbDirectory));

final ODatabaseDocumentTx backedUpDb = new ODatabaseDocumentTx("plocal:" + backedUpDbDirectory);
final ODatabaseDocumentInternal backedUpDb =
new ODatabaseDocumentTx("plocal:" + backedUpDbDirectory);
backedUpDb.create(backupDir.getAbsolutePath());

final OStorage backupStorage = backedUpDb.getStorage();
Expand Down Expand Up @@ -189,7 +192,8 @@ public void testSingeThreadIncrementalBackup() throws IOException {
+ "BackUp";
OFileUtils.deleteRecursively(new File(backedUpDbDirectory));

final ODatabaseDocumentTx backedUpDb = new ODatabaseDocumentTx("plocal:" + backedUpDbDirectory);
final ODatabaseDocumentInternal backedUpDb =
new ODatabaseDocumentTx("plocal:" + backedUpDbDirectory);
backedUpDb.create(backupDir.getAbsolutePath());

final OStorage backupStorage = backedUpDb.getStorage();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import com.orientechnologies.common.log.OLogManager;
import com.orientechnologies.common.util.OCallable;
import com.orientechnologies.orient.core.Orient;
import com.orientechnologies.orient.core.config.OGlobalConfiguration;
import com.orientechnologies.orient.core.db.ODatabaseDocumentInternal;
import com.orientechnologies.orient.core.db.ODatabaseRecordThreadLocal;
import com.orientechnologies.orient.core.db.document.ODatabaseDocument;
Expand Down Expand Up @@ -56,10 +55,6 @@ public abstract class AbstractEnterpriseServerClusterTest {

protected List<ServerRun> serverInstance = new ArrayList<ServerRun>();

protected AbstractEnterpriseServerClusterTest() {
OGlobalConfiguration.STORAGE_TRACK_CHANGED_RECORDS_IN_WAL.setValue(true);
}

private static void syntaxError() {
System.err.println(
"Syntax error. Usage: <class> <operation> [<servers>]\nWhere <operation> can be: prepare|execute|prepare+execute");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import com.orientechnologies.common.log.OLogManager;
import com.orientechnologies.common.util.OCallable;
import com.orientechnologies.orient.core.Orient;
import com.orientechnologies.orient.core.config.OGlobalConfiguration;
import com.orientechnologies.orient.core.db.ODatabaseDocumentInternal;
import com.orientechnologies.orient.core.db.ODatabaseRecordThreadLocal;
import com.orientechnologies.orient.core.db.document.ODatabaseDocument;
Expand Down Expand Up @@ -53,10 +52,6 @@ public abstract class AbstractServerClusterTest {

protected List<ServerRun> serverInstance = new ArrayList<ServerRun>();

protected AbstractServerClusterTest() {
OGlobalConfiguration.STORAGE_TRACK_CHANGED_RECORDS_IN_WAL.setValue(true);
}

@SuppressWarnings("unchecked")
public static void main(final String[] args) throws Exception {
Class<? extends AbstractServerClusterTest> testClass = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.orientechnologies.orient.client.remote.OServerAdmin;
import com.orientechnologies.orient.core.config.OGlobalConfiguration;
import com.orientechnologies.orient.core.db.document.ODatabaseDocument;
import com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx;
import com.orientechnologies.orient.core.exception.OSecurityException;
import com.orientechnologies.security.AbstractSecurityTest;
Expand Down Expand Up @@ -33,7 +34,7 @@ public static void beforeClass() throws Exception {
serverAd.createDatabase(testDB, "graph", "plocal");

// [email protected]
ODatabaseDocumentTx db = new ODatabaseDocumentTx(url);
ODatabaseDocument db = new ODatabaseDocumentTx(url);
db.open("root", "password");

try {
Expand Down Expand Up @@ -65,7 +66,7 @@ public void defaultSPNTest() throws InterruptedException, IOException {

OGlobalConfiguration.CLIENT_KRB5_CCNAME.setValue(ccache);

ODatabaseDocumentTx db = new ODatabaseDocumentTx(url);
ODatabaseDocument db = new ODatabaseDocumentTx(url);
db.open(kerbUser, "");

db.close();
Expand All @@ -79,7 +80,7 @@ public void explicitSPNTest() throws InterruptedException, IOException {

OGlobalConfiguration.CLIENT_KRB5_CCNAME.setValue(ccache);

ODatabaseDocumentTx db = new ODatabaseDocumentTx(url);
ODatabaseDocument db = new ODatabaseDocumentTx(url);
db.open(kerbUser, spn);

db.close();
Expand All @@ -93,7 +94,7 @@ public void shouldFailAuthenticationTest() throws InterruptedException, IOExcept

OGlobalConfiguration.CLIENT_KRB5_CCNAME.setValue(wrongcache);

ODatabaseDocumentTx db = new ODatabaseDocumentTx(url);
ODatabaseDocument db = new ODatabaseDocumentTx(url);
db.open(kerbUser, spn);

db.close();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import com.orientechnologies.orient.core.Orient;
import com.orientechnologies.orient.core.db.ODatabaseType;
import com.orientechnologies.orient.core.db.document.ODatabaseDocument;
import com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx;
import com.orientechnologies.orient.core.security.OInvalidPasswordException;
import com.orientechnologies.orient.server.OServer;
Expand Down Expand Up @@ -76,7 +77,7 @@ public static void afterClass() {

@Test
public void minCharacterTest() {
ODatabaseDocumentTx db = new ODatabaseDocumentTx(DATABASE_URL);
ODatabaseDocument db = new ODatabaseDocumentTx(DATABASE_URL);
db.open("root", ROOT_PASSWORD);

try {
Expand All @@ -93,7 +94,7 @@ public void minCharacterTest() {

@Test
public void minNumberTest() {
ODatabaseDocumentTx db = new ODatabaseDocumentTx(DATABASE_URL);
ODatabaseDocument db = new ODatabaseDocumentTx(DATABASE_URL);
db.open("root", ROOT_PASSWORD);

try {
Expand All @@ -109,7 +110,7 @@ public void minNumberTest() {

@Test
public void minSpecialTest() {
ODatabaseDocumentTx db = new ODatabaseDocumentTx(DATABASE_URL);
ODatabaseDocument db = new ODatabaseDocumentTx(DATABASE_URL);
db.open("root", ROOT_PASSWORD);

try {
Expand All @@ -125,7 +126,7 @@ public void minSpecialTest() {

@Test
public void minUppercaseTest() {
ODatabaseDocumentTx db = new ODatabaseDocumentTx(DATABASE_URL);
ODatabaseDocument db = new ODatabaseDocumentTx(DATABASE_URL);
db.open("root", ROOT_PASSWORD);

try {
Expand All @@ -143,7 +144,7 @@ public void minUppercaseTest() {

@Test
public void uuidTest() {
ODatabaseDocumentTx db = new ODatabaseDocumentTx(DATABASE_URL);
ODatabaseDocument db = new ODatabaseDocumentTx(DATABASE_URL);
db.open("root", ROOT_PASSWORD);

final String sql =
Expand All @@ -157,7 +158,7 @@ public void uuidTest() {

@Test
public void validTest() {
ODatabaseDocumentTx db = new ODatabaseDocumentTx(DATABASE_URL);
ODatabaseDocument db = new ODatabaseDocumentTx(DATABASE_URL);
db.open("root", ROOT_PASSWORD);

final String sql =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public void shouldTestSystemUserWithKey() throws Exception {
OSymmetricKey sk = new OSymmetricKey("AES", "8BC7LeGkFbmHEYNTz5GwDw==");

// "sysuser" is the username. We just created it in OSystem.
ODatabaseDocumentTx db = new ODatabaseDocumentTx(DATABASE_URL);
ODatabaseDocument db = new ODatabaseDocumentTx(DATABASE_URL);
// We encrypt the username and specify the Base64-encoded JSON document as the password.
db.open(sysuser, sk.encrypt("AES/CBC/PKCS5Padding", sysuser));
db.close();
Expand Down

0 comments on commit 6d32583

Please sign in to comment.