Enabled ExtensionsDatabaseTest again

Might hang in Github Actions, but remains to be seen if changes to
testing environment have fixed the test hanging
This commit is contained in:
Risto Lahtela 2021-03-18 11:27:45 +02:00
parent 7906126b5e
commit 3ca98bb634
6 changed files with 35 additions and 11 deletions

View File

@ -17,6 +17,7 @@
package com.djrapitops.plan.storage.database;
import com.djrapitops.plan.delivery.DeliveryUtilities;
import com.djrapitops.plan.extension.ExtensionSvc;
import com.djrapitops.plan.identification.ServerInfo;
import com.djrapitops.plan.modules.FiltersModule;
import com.djrapitops.plan.settings.ConfigSystem;
@ -76,6 +77,8 @@ public interface DatabaseTestComponent extends DBPreparer.Dependencies {
PlanFiles files();
ExtensionSvc extensionService();
@Component.Builder
interface Builder {
@BindsInstance

View File

@ -18,6 +18,7 @@ package com.djrapitops.plan.storage.database;
import com.djrapitops.plan.PlanSystem;
import com.djrapitops.plan.delivery.DeliveryUtilities;
import com.djrapitops.plan.extension.ExtensionService;
import com.djrapitops.plan.identification.ServerInfo;
import com.djrapitops.plan.identification.ServerUUID;
import com.djrapitops.plan.settings.config.PlanConfig;
@ -58,6 +59,8 @@ public interface DatabaseTestPreparer {
return system().getDeliveryUtilities();
}
default ExtensionService extensionService() {return system().getExtensionService();}
default void execute(Executable executable) {
try {
db().executeTransaction(new Transaction() {

View File

@ -18,6 +18,7 @@ package com.djrapitops.plan.storage.database;
import com.djrapitops.plan.PlanSystem;
import com.djrapitops.plan.delivery.DeliveryUtilities;
import com.djrapitops.plan.extension.ExtensionService;
import com.djrapitops.plan.identification.Server;
import com.djrapitops.plan.identification.ServerInfo;
import com.djrapitops.plan.identification.ServerUUID;
@ -52,7 +53,7 @@ import static org.mockito.Mockito.when;
@ExtendWith(MockitoExtension.class)
public class H2Test implements DatabaseTest,
DatabaseBackupTest,
//ExtensionsDatabaseTest, TODO Test hangs forever for some reason, investigate later.
ExtensionsDatabaseTest,
ActivityIndexQueriesTest,
GeolocationQueriesTest,
NicknameQueriesTest,
@ -142,6 +143,11 @@ public class H2Test implements DatabaseTest,
return component.deliveryUtilities();
}
@Override
public ExtensionService extensionService() {
return component.extensionService();
}
@Override
public PlanSystem system() {
PlanSystem mockSystem = Mockito.mock(PlanSystem.class);

View File

@ -18,6 +18,7 @@ package com.djrapitops.plan.storage.database;
import com.djrapitops.plan.PlanSystem;
import com.djrapitops.plan.delivery.DeliveryUtilities;
import com.djrapitops.plan.extension.ExtensionService;
import com.djrapitops.plan.identification.Server;
import com.djrapitops.plan.identification.ServerInfo;
import com.djrapitops.plan.identification.ServerUUID;
@ -59,7 +60,7 @@ import static org.mockito.Mockito.when;
@ExtendWith(MockitoExtension.class)
class MySQLTest implements DatabaseTest,
DatabaseBackupTest,
//ExtensionsDatabaseTest, TODO Test hangs forever for some reason, investigate later.
ExtensionsDatabaseTest,
ActivityIndexQueriesTest,
GeolocationQueriesTest,
NicknameQueriesTest,
@ -146,6 +147,11 @@ class MySQLTest implements DatabaseTest,
return component.deliveryUtilities();
}
@Override
public ExtensionService extensionService() {
return component.extensionService();
}
@Override
public PlanSystem system() {
PlanSystem mockSystem = Mockito.mock(PlanSystem.class);

View File

@ -18,6 +18,7 @@ package com.djrapitops.plan.storage.database;
import com.djrapitops.plan.PlanSystem;
import com.djrapitops.plan.delivery.DeliveryUtilities;
import com.djrapitops.plan.extension.ExtensionService;
import com.djrapitops.plan.identification.Server;
import com.djrapitops.plan.identification.ServerInfo;
import com.djrapitops.plan.identification.ServerUUID;
@ -52,7 +53,7 @@ import static org.mockito.Mockito.when;
@ExtendWith(MockitoExtension.class)
public class SQLiteTest implements DatabaseTest,
DatabaseBackupTest,
//ExtensionsDatabaseTest, TODO Test hangs forever for some reason, investigate later.
ExtensionsDatabaseTest,
ActivityIndexQueriesTest,
GeolocationQueriesTest,
NicknameQueriesTest,
@ -139,6 +140,11 @@ public class SQLiteTest implements DatabaseTest,
return component.deliveryUtilities();
}
@Override
public ExtensionService extensionService() {
return component.extensionService();
}
@Override
public PlanSystem system() {
PlanSystem mockSystem = Mockito.mock(PlanSystem.class);

View File

@ -59,7 +59,7 @@ public interface ExtensionsDatabaseTest extends DatabaseTestPreparer {
@BeforeEach
default void unregisterExtensions() {
ExtensionService extensionService = system().getExtensionService();
ExtensionService extensionService = extensionService();
extensionService.unregister(new PlayerExtension());
extensionService.unregister(new ServerExtension());
extensionService.unregister(new ConditionalExtension());
@ -82,7 +82,7 @@ public interface ExtensionsDatabaseTest extends DatabaseTestPreparer {
@Test
default void extensionPlayerValuesAreStored() {
ExtensionSvc extensionService = (ExtensionSvc) system().getExtensionService();
ExtensionSvc extensionService = (ExtensionSvc) extensionService();
extensionService.register(new PlayerExtension());
extensionService.updatePlayerValues(playerUUID, TestConstants.PLAYER_ONE_NAME, CallEvents.MANUAL);
@ -130,7 +130,7 @@ public interface ExtensionsDatabaseTest extends DatabaseTestPreparer {
@Test
default void extensionServerValuesAreStored() {
ExtensionSvc extensionService = (ExtensionSvc) system().getExtensionService();
ExtensionSvc extensionService = (ExtensionSvc) extensionService();
extensionService.register(new ServerExtension());
extensionService.updateServerValues(CallEvents.SERVER_EXTENSION_REGISTER);
@ -152,7 +152,7 @@ public interface ExtensionsDatabaseTest extends DatabaseTestPreparer {
@Test
default void extensionServerAggregateQueriesWork() {
ExtensionSvc extensionService = (ExtensionSvc) system().getExtensionService();
ExtensionSvc extensionService = (ExtensionSvc) extensionService();
extensionService.register(new PlayerExtension());
extensionService.updatePlayerValues(playerUUID, TestConstants.PLAYER_ONE_NAME, CallEvents.MANUAL);
@ -183,7 +183,7 @@ public interface ExtensionsDatabaseTest extends DatabaseTestPreparer {
@Test
default void unsatisfiedPlayerConditionalResultsAreCleaned() {
ExtensionSvc extensionService = (ExtensionSvc) system().getExtensionService();
ExtensionSvc extensionService = (ExtensionSvc) extensionService();
extensionService.register(new ConditionalExtension());
@ -237,7 +237,7 @@ public interface ExtensionsDatabaseTest extends DatabaseTestPreparer {
@Test
default void unsatisfiedServerConditionalResultsAreCleaned() {
ExtensionSvc extensionService = (ExtensionSvc) system().getExtensionService();
ExtensionSvc extensionService = (ExtensionSvc) extensionService();
ConditionalExtension.condition = true;
extensionService.register(new ConditionalExtension());
@ -288,7 +288,7 @@ public interface ExtensionsDatabaseTest extends DatabaseTestPreparer {
@Test
default void extensionServerTableValuesAreInserted() {
ExtensionSvc extensionService = (ExtensionSvc) system().getExtensionService();
ExtensionSvc extensionService = (ExtensionSvc) extensionService();
extensionService.register(new TableExtension());
extensionService.updateServerValues(CallEvents.MANUAL);
@ -320,7 +320,7 @@ public interface ExtensionsDatabaseTest extends DatabaseTestPreparer {
@Test
default void extensionPlayerTableValuesAreInserted() {
ExtensionSvc extensionService = (ExtensionSvc) system().getExtensionService();
ExtensionSvc extensionService = (ExtensionSvc) extensionService();
extensionService.register(new TableExtension());
extensionService.updatePlayerValues(playerUUID, TestConstants.PLAYER_ONE_NAME, CallEvents.MANUAL);