Search in sources :

Example 1 with Locale

use of com.djrapitops.plan.settings.locale.Locale in project Plan by plan-player-analytics.

the class ShutdownSaveTest method setupShutdownSaveObject.

@BeforeEach
void setupShutdownSaveObject(@TempDir Path temporaryFolder) throws Exception {
    PluginMockComponent pluginMockComponent = new PluginMockComponent(temporaryFolder);
    PlanSystem system = pluginMockComponent.getPlanSystem();
    database = system.getDatabaseSystem().getSqLiteFactory().usingFileCalled("test");
    database.init();
    sessionCache = system.getCacheSystem().getSessionCache();
    storeNecessaryInformation();
    placeSessionToCache();
    DBSystem dbSystemMock = mock(DBSystem.class);
    when(dbSystemMock.getDatabase()).thenReturn(database);
    TestPluginLogger logger = new TestPluginLogger();
    underTest = new ServerShutdownSave(new Locale(), dbSystemMock, logger, system.getErrorLogger()) {

        @Override
        protected boolean checkServerShuttingDownStatus() {
            return shutdownStatus;
        }
    };
    shutdownStatus = false;
}
Also used : Locale(com.djrapitops.plan.settings.locale.Locale) DBSystem(com.djrapitops.plan.storage.database.DBSystem) TestPluginLogger(utilities.TestPluginLogger) PlanSystem(com.djrapitops.plan.PlanSystem) PluginMockComponent(utilities.mocks.PluginMockComponent) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 2 with Locale

use of com.djrapitops.plan.settings.locale.Locale in project Plan by plan-player-analytics.

the class ActivityIndexTest method localeIsUsedWhenGivenForGetGroups.

@Test
void localeIsUsedWhenGivenForGetGroups() {
    Locale locale = createTestLocale();
    String[] expected = new String[] { "A", "B", "C", "D", "E" };
    String[] result = ActivityIndex.getGroups(locale);
    assertArrayEquals(expected, result);
}
Also used : Locale(com.djrapitops.plan.settings.locale.Locale) Test(org.junit.jupiter.api.Test)

Example 3 with Locale

use of com.djrapitops.plan.settings.locale.Locale in project Plan by plan-player-analytics.

the class ActivityIndexTest method createTestLocale.

private Locale createTestLocale() {
    Locale locale = new Locale();
    locale.put(HtmlLang.INDEX_VERY_ACTIVE, new Message("A"));
    locale.put(HtmlLang.INDEX_ACTIVE, new Message("B"));
    locale.put(HtmlLang.INDEX_REGULAR, new Message("C"));
    locale.put(HtmlLang.INDEX_IRREGULAR, new Message("D"));
    locale.put(HtmlLang.INDEX_INACTIVE, new Message("E"));
    return locale;
}
Also used : Locale(com.djrapitops.plan.settings.locale.Locale) Message(com.djrapitops.plan.settings.locale.Message)

Example 4 with Locale

use of com.djrapitops.plan.settings.locale.Locale in project Plan by plan-player-analytics.

the class DatabaseTest method cleanDoesNotCleanActivePlayers.

@Test
default void cleanDoesNotCleanActivePlayers() {
    saveUserOne();
    saveTwoWorlds();
    long sessionStart = System.currentTimeMillis();
    ActiveSession session = new ActiveSession(playerUUID, serverUUID(), sessionStart, worlds[0], "SURVIVAL");
    execute(DataStoreQueries.storeSession(session.toFinishedSession(sessionStart + 22345L)));
    TestPluginLogger logger = new TestPluginLogger();
    new DBCleanTask(config(), new Locale(), dbSystem(), new QuerySvc(config(), dbSystem(), serverInfo(), null), serverInfo(), logger, null).cleanOldPlayers(db());
    Collection<BaseUser> found = db().query(BaseUserQueries.fetchServerBaseUsers(serverUUID()));
    assertFalse(found.isEmpty(), "All users were deleted!! D:");
}
Also used : Locale(com.djrapitops.plan.settings.locale.Locale) ActiveSession(com.djrapitops.plan.gathering.domain.ActiveSession) BaseUser(com.djrapitops.plan.gathering.domain.BaseUser) DBCleanTask(com.djrapitops.plan.storage.upkeep.DBCleanTask) QuerySvc(com.djrapitops.plan.query.QuerySvc) Test(org.junit.jupiter.api.Test)

Aggregations

Locale (com.djrapitops.plan.settings.locale.Locale)4 Test (org.junit.jupiter.api.Test)2 PlanSystem (com.djrapitops.plan.PlanSystem)1 ActiveSession (com.djrapitops.plan.gathering.domain.ActiveSession)1 BaseUser (com.djrapitops.plan.gathering.domain.BaseUser)1 QuerySvc (com.djrapitops.plan.query.QuerySvc)1 Message (com.djrapitops.plan.settings.locale.Message)1 DBSystem (com.djrapitops.plan.storage.database.DBSystem)1 DBCleanTask (com.djrapitops.plan.storage.upkeep.DBCleanTask)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1 TestPluginLogger (utilities.TestPluginLogger)1 PluginMockComponent (utilities.mocks.PluginMockComponent)1