Skip to content

Commit

Permalink
refactor(test):removed access to storage in tests where is not needed
Browse files Browse the repository at this point in the history
  • Loading branch information
tglman committed Feb 4, 2025
1 parent d5e5c05 commit be21b37
Show file tree
Hide file tree
Showing 12 changed files with 68 additions and 65 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import com.orientechnologies.orient.core.db.ODatabase;
import com.orientechnologies.orient.core.db.ODatabaseDocumentInternal;
import com.orientechnologies.orient.core.db.ODatabaseInternal;
import com.orientechnologies.orient.core.db.ODatabaseWrapperAbstract;
import com.orientechnologies.orient.core.db.OrientDB;
import com.orientechnologies.orient.core.db.OrientDBConfig;
Expand Down Expand Up @@ -269,7 +268,13 @@ protected boolean skipTestIfRemote() {
}

protected void checkEmbeddedDB() {
if (((ODatabaseInternal) database).getStorage().isRemote()) {
final ODatabaseDocumentInternal db;
if (database instanceof ODatabaseWrapperAbstract) {
db = (ODatabaseDocumentInternal) ((ODatabaseWrapperAbstract) database).getUnderlying();
} else {
db = (ODatabaseDocumentInternal) database;
}
if (db.isRemote()) {
throw new SkipException("Test is running only in embedded database");
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ public void testCompositeIndexQueryCS() {
Assert.assertTrue(
explain.getExecutionPlan().get().getIndexes().contains("collateCompositeIndexCS"));

if (!database.getStorage().isRemote()) {
if (!database.isRemote()) {
final OIndexManagerAbstract indexManager = database.getMetadata().getIndexManagerInternal();
final OIndex index = indexManager.getIndex(database, "collateCompositeIndexCS");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public void testDatePrecision() throws ParseException {
final long begin = System.currentTimeMillis();

String dateAsString =
database.getStorage().getConfiguration().getDateFormatInstance().format(begin);
database.getStorageInfo().getConfiguration().getDateFormatInstance().format(begin);

ODocument doc = new ODocument("Order");
doc.field("context", "testPrecision");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public void afterMethod() throws Exception {

@Test
public void testPut() {
if (database.getStorage().isRemote()) {
if (database.isRemote()) {
throw new SkipException("Test is enabled only for embedded database");
}

Expand Down Expand Up @@ -92,7 +92,7 @@ public void testPut() {

@Test
public void testRemove() {
if (database.getStorage().isRemote()) {
if (database.isRemote()) {
throw new SkipException("Test is enabled only for embedded database");
}

Expand Down Expand Up @@ -135,7 +135,7 @@ public void testRemove() {

@Test
public void testRemoveOne() {
if (database.getStorage().isRemote()) {
if (database.isRemote()) {
throw new SkipException("Test is enabled only for embedded database");
}

Expand Down Expand Up @@ -177,7 +177,7 @@ public void testRemoveOne() {

@Test
public void testMultiPut() {
if (database.getStorage().isRemote()) {
if (database.isRemote()) {
throw new SkipException("Test is enabled only for embedded database");
}

Expand Down Expand Up @@ -212,7 +212,7 @@ public void testMultiPut() {

@Test
public void testPutAfterTransaction() {
if (database.getStorage().isRemote()) {
if (database.isRemote()) {
throw new SkipException("Test is enabled only for embedded database");
}

Expand Down Expand Up @@ -241,7 +241,7 @@ public void testPutAfterTransaction() {

@Test
public void testRemoveOneWithinTransaction() {
if (database.getStorage().isRemote()) {
if (database.isRemote()) {
throw new SkipException("Test is enabled only for embedded database");
}

Expand Down Expand Up @@ -275,7 +275,7 @@ public void testRemoveOneWithinTransaction() {

@Test
public void testRemoveAllWithinTransaction() {
if (database.getStorage().isRemote()) {
if (database.isRemote()) {
throw new SkipException("Test is enabled only for embedded database");
}

Expand Down Expand Up @@ -308,7 +308,7 @@ public void testRemoveAllWithinTransaction() {

@Test
public void testPutAfterRemove() {
if (database.getStorage().isRemote()) {
if (database.isRemote()) {
throw new SkipException("Test is enabled only for embedded database");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public void afterMethod() throws Exception {

@Test
public void testPut() {
if (database.getStorage().isRemote()) {
if (database.isRemote()) {
throw new SkipException("Test is enabled only for embedded database");
}

Expand Down Expand Up @@ -89,7 +89,7 @@ public void testPut() {

@Test
public void testRemove() {
if (database.getStorage().isRemote()) {
if (database.isRemote()) {
throw new SkipException("Test is enabled only for embedded database");
}

Expand Down Expand Up @@ -138,7 +138,7 @@ public void testRemove() {

@Test
public void testRemoveOne() {
if (database.getStorage().isRemote()) {
if (database.isRemote()) {
throw new SkipException("Test is enabled only for embedded database");
}

Expand Down Expand Up @@ -186,7 +186,7 @@ public void testRemoveOne() {

@Test
public void testMultiPut() {
if (database.getStorage().isRemote()) {
if (database.isRemote()) {
throw new SkipException("Test is enabled only for embedded database");
}

Expand Down Expand Up @@ -217,7 +217,7 @@ public void testMultiPut() {

@Test
public void testPutAfterTransaction() {
if (database.getStorage().isRemote()) {
if (database.isRemote()) {
throw new SkipException("Test is enabled only for embedded database");
}

Expand All @@ -243,7 +243,7 @@ public void testPutAfterTransaction() {

@Test
public void testRemoveOneWithinTransaction() {
if (database.getStorage().isRemote()) {
if (database.isRemote()) {
throw new SkipException("Test is enabled only for embedded database");
}

Expand All @@ -269,7 +269,7 @@ public void testRemoveOneWithinTransaction() {

@Test
public void testPutAfterRemove() {
if (database.getStorage().isRemote()) {
if (database.isRemote()) {
throw new SkipException("Test is enabled only for embedded database");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public void afterMethod() throws Exception {

@Test
public void testPut() {
if (database.getStorage().isRemote()) {
if (database.isRemote()) {
throw new SkipException("Test is enabled only for embedded database");
}

Expand Down Expand Up @@ -91,7 +91,7 @@ public void testPut() {

@Test
public void testRemove() {
if (database.getStorage().isRemote()) {
if (database.isRemote()) {
throw new SkipException("Test is enabled only for embedded database");
}

Expand Down Expand Up @@ -133,7 +133,7 @@ public void testRemove() {

@Test
public void testRemoveOne() {
if (database.getStorage().isRemote()) {
if (database.isRemote()) {
throw new SkipException("Test is enabled only for embedded database");
}

Expand Down Expand Up @@ -173,7 +173,7 @@ public void testRemoveOne() {

@Test
public void testMultiPut() {
if (database.getStorage().isRemote()) {
if (database.isRemote()) {
throw new SkipException("Test is enabled only for embedded database");
}

Expand Down Expand Up @@ -205,7 +205,7 @@ public void testMultiPut() {

@Test
public void testPutAfterTransaction() {
if (database.getStorage().isRemote()) {
if (database.isRemote()) {
throw new SkipException("Test is enabled only for embedded database");
}

Expand Down Expand Up @@ -233,7 +233,7 @@ public void testPutAfterTransaction() {

@Test
public void testRemoveOneWithinTransaction() {
if (database.getStorage().isRemote()) {
if (database.isRemote()) {
throw new SkipException("Test is enabled only for embedded database");
}

Expand Down Expand Up @@ -262,7 +262,7 @@ public void testRemoveOneWithinTransaction() {

@Test
public void testRemoveAllWithinTransaction() {
if (database.getStorage().isRemote()) {
if (database.isRemote()) {
throw new SkipException("Test is enabled only for embedded database");
}

Expand Down Expand Up @@ -291,7 +291,7 @@ public void testRemoveAllWithinTransaction() {

@Test
public void testPutAfterRemove() {
if (database.getStorage().isRemote()) {
if (database.isRemote()) {
throw new SkipException("Test is enabled only for embedded database");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public void afterMethod() throws Exception {

@Test
public void testPut() {
if (database.getStorage().isRemote()) {
if (database.isRemote()) {
throw new SkipException("Test is enabled only for embedded database");
}

Expand Down Expand Up @@ -91,7 +91,7 @@ public void testPut() {

@Test
public void testRemove() {
if (database.getStorage().isRemote()) {
if (database.isRemote()) {
throw new SkipException("Test is enabled only for embedded database");
}

Expand Down Expand Up @@ -131,7 +131,7 @@ public void testRemove() {

@Test
public void testRemoveAndPut() {
if (database.getStorage().isRemote()) {
if (database.isRemote()) {
throw new SkipException("Test is enabled only for embedded database");
}

Expand Down Expand Up @@ -168,7 +168,7 @@ public void testRemoveAndPut() {

@Test
public void testMultiPut() {
if (database.getStorage().isRemote()) {
if (database.isRemote()) {
throw new SkipException("Test is enabled only for embedded database");
}

Expand Down Expand Up @@ -200,7 +200,7 @@ public void testMultiPut() {

@Test
public void testPutAfterTransaction() {
if (database.getStorage().isRemote()) {
if (database.isRemote()) {
throw new SkipException("Test is enabled only for embedded database");
}

Expand Down Expand Up @@ -229,7 +229,7 @@ public void testPutAfterTransaction() {

@Test
public void testRemoveOneWithinTransaction() {
if (database.getStorage().isRemote()) {
if (database.isRemote()) {
throw new SkipException("Test is enabled only for embedded database");
}

Expand Down Expand Up @@ -258,7 +258,7 @@ public void testRemoveOneWithinTransaction() {

@Test
public void testPutAfterRemove() {
if (database.getStorage().isRemote()) {
if (database.isRemote()) {
throw new SkipException("Test is enabled only for embedded database");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public void afterMethod() throws Exception {

@Test
public void testPut() {
if (database.getStorage().isRemote()) {
if (database.isRemote()) {
throw new SkipException("Test is enabled only for embedded database");
}

Expand Down Expand Up @@ -91,7 +91,7 @@ public void testPut() {

@Test
public void testRemove() {
if (database.getStorage().isRemote()) {
if (database.isRemote()) {
throw new SkipException("Test is enabled only for embedded database");
}

Expand Down Expand Up @@ -136,7 +136,7 @@ public void testRemove() {

@Test
public void testRemoveAndPut() {
if (database.getStorage().isRemote()) {
if (database.isRemote()) {
throw new SkipException("Test is enabled only for embedded database");
}

Expand Down Expand Up @@ -177,7 +177,7 @@ public void testRemoveAndPut() {

@Test
public void testMultiPut() {
if (database.getStorage().isRemote()) {
if (database.isRemote()) {
throw new SkipException("Test is enabled only for embedded database");
}

Expand All @@ -203,7 +203,7 @@ public void testMultiPut() {

@Test
public void testPutAfterTransaction() {
if (database.getStorage().isRemote()) {
if (database.isRemote()) {
throw new SkipException("Test is enabled only for embedded database");
}

Expand All @@ -228,7 +228,7 @@ public void testPutAfterTransaction() {

@Test
public void testRemoveOneWithinTransaction() {
if (database.getStorage().isRemote()) {
if (database.isRemote()) {
throw new SkipException("Test is enabled only for embedded database");
}

Expand All @@ -253,7 +253,7 @@ public void testRemoveOneWithinTransaction() {

@Test
public void testPutAfterRemove() {
if (database.getStorage().isRemote()) {
if (database.isRemote()) {
throw new SkipException("Test is enabled only for embedded database");
}

Expand Down
Loading

0 comments on commit be21b37

Please sign in to comment.