From 6d32583c5cceddbb22395aaf8e75b52ecc9bea0c Mon Sep 17 00:00:00 2001 From: Tglman Date: Wed, 24 Jan 2024 12:02:48 +0100 Subject: [PATCH] chore: moved tests to new database api --- .../paginated/StorageBackupTestWithLuceneIndex.java | 12 ++++++++---- .../AbstractEnterpriseServerClusterTest.java | 5 ----- .../distributed/AbstractServerClusterTest.java | 5 ----- .../security/kerberos/KerberosClientTest.java | 9 +++++---- .../security/password/PasswordValidatorTest.java | 13 +++++++------ .../symmetrickey/OSystemSymmetricKeyTest.java | 2 +- 6 files changed, 21 insertions(+), 25 deletions(-) diff --git a/agent/src/test/java/com/orientechnologies/orient/core/storage/impl/local/paginated/StorageBackupTestWithLuceneIndex.java b/agent/src/test/java/com/orientechnologies/orient/core/storage/impl/local/paginated/StorageBackupTestWithLuceneIndex.java index e69b8bfe..89ca70bf 100755 --- a/agent/src/test/java/com/orientechnologies/orient/core/storage/impl/local/paginated/StorageBackupTestWithLuceneIndex.java +++ b/agent/src/test/java/com/orientechnologies/orient/core/storage/impl/local/paginated/StorageBackupTestWithLuceneIndex.java @@ -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; @@ -43,7 +45,7 @@ public class StorageBackupTestWithLuceneIndex { private String buildDirectory; - private ODatabaseDocumentTx db; + private ODatabaseDocumentInternal db; private String dbDirectory; private String backedUpDbDirectory; @@ -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"); @@ -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(); @@ -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(); diff --git a/agent/src/test/java/com/orientechnologies/orient/server/distributed/AbstractEnterpriseServerClusterTest.java b/agent/src/test/java/com/orientechnologies/orient/server/distributed/AbstractEnterpriseServerClusterTest.java index 847daee2..18f5e819 100755 --- a/agent/src/test/java/com/orientechnologies/orient/server/distributed/AbstractEnterpriseServerClusterTest.java +++ b/agent/src/test/java/com/orientechnologies/orient/server/distributed/AbstractEnterpriseServerClusterTest.java @@ -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; @@ -56,10 +55,6 @@ public abstract class AbstractEnterpriseServerClusterTest { protected List serverInstance = new ArrayList(); - protected AbstractEnterpriseServerClusterTest() { - OGlobalConfiguration.STORAGE_TRACK_CHANGED_RECORDS_IN_WAL.setValue(true); - } - private static void syntaxError() { System.err.println( "Syntax error. Usage: []\nWhere can be: prepare|execute|prepare+execute"); diff --git a/agent/src/test/java/com/orientechnologies/orient/server/distributed/AbstractServerClusterTest.java b/agent/src/test/java/com/orientechnologies/orient/server/distributed/AbstractServerClusterTest.java index d245a233..278e6271 100755 --- a/agent/src/test/java/com/orientechnologies/orient/server/distributed/AbstractServerClusterTest.java +++ b/agent/src/test/java/com/orientechnologies/orient/server/distributed/AbstractServerClusterTest.java @@ -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; @@ -53,10 +52,6 @@ public abstract class AbstractServerClusterTest { protected List serverInstance = new ArrayList(); - protected AbstractServerClusterTest() { - OGlobalConfiguration.STORAGE_TRACK_CHANGED_RECORDS_IN_WAL.setValue(true); - } - @SuppressWarnings("unchecked") public static void main(final String[] args) throws Exception { Class testClass = null; diff --git a/agent/src/test/java/com/orientechnologies/security/kerberos/KerberosClientTest.java b/agent/src/test/java/com/orientechnologies/security/kerberos/KerberosClientTest.java index 036ae0e2..171794cc 100644 --- a/agent/src/test/java/com/orientechnologies/security/kerberos/KerberosClientTest.java +++ b/agent/src/test/java/com/orientechnologies/security/kerberos/KerberosClientTest.java @@ -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; @@ -33,7 +34,7 @@ public static void beforeClass() throws Exception { serverAd.createDatabase(testDB, "graph", "plocal"); // orientdb@ODBREALM.COM - ODatabaseDocumentTx db = new ODatabaseDocumentTx(url); + ODatabaseDocument db = new ODatabaseDocumentTx(url); db.open("root", "password"); try { @@ -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(); @@ -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(); @@ -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(); diff --git a/agent/src/test/java/com/orientechnologies/security/password/PasswordValidatorTest.java b/agent/src/test/java/com/orientechnologies/security/password/PasswordValidatorTest.java index 4547ccc1..cc047836 100755 --- a/agent/src/test/java/com/orientechnologies/security/password/PasswordValidatorTest.java +++ b/agent/src/test/java/com/orientechnologies/security/password/PasswordValidatorTest.java @@ -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; @@ -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 { @@ -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 { @@ -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 { @@ -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 { @@ -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 = @@ -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 = diff --git a/agent/src/test/java/com/orientechnologies/security/symmetrickey/OSystemSymmetricKeyTest.java b/agent/src/test/java/com/orientechnologies/security/symmetrickey/OSystemSymmetricKeyTest.java index 3a598ac6..d324b06f 100755 --- a/agent/src/test/java/com/orientechnologies/security/symmetrickey/OSystemSymmetricKeyTest.java +++ b/agent/src/test/java/com/orientechnologies/security/symmetrickey/OSystemSymmetricKeyTest.java @@ -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();