Search in sources :

Example 1 with LoggerManager

use of com.alessiodp.core.common.logging.LoggerManager in project ADP-Core by AlessioDP.

the class StorageTest method setUp.

@BeforeAll
public static void setUp() {
    ADPPlugin mockPlugin = mock(ADPPlugin.class);
    LoggerManager mockLoggerManager = mock(LoggerManager.class);
    when(mockPlugin.getLoggerManager()).thenReturn(mockLoggerManager);
    when(mockPlugin.getFolder()).thenReturn(Paths.get("./"));
}
Also used : LoggerManager(com.alessiodp.core.common.logging.LoggerManager) ADPPlugin(com.alessiodp.core.common.ADPPlugin) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 2 with LoggerManager

use of com.alessiodp.core.common.logging.LoggerManager in project ADP-Core by AlessioDP.

the class SchedulerTest method setUp.

@BeforeAll
public static void setUp() {
    LoggerManager mockLoggerManager = mock(LoggerManager.class);
    when(mockPlugin.getLoggerManager()).thenReturn(mockLoggerManager);
    when(mockPlugin.getFolder()).thenReturn(Paths.get("./"));
}
Also used : LoggerManager(com.alessiodp.core.common.logging.LoggerManager) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 3 with LoggerManager

use of com.alessiodp.core.common.logging.LoggerManager in project ADP-Core by AlessioDP.

the class ADPPlugin method preHandle.

/**
 * Preparation before the main handle method
 * Initialize necessary classes
 */
protected final void preHandle() {
    loggerManager = new LoggerManager(this);
    loginAlertsManager = new LoginAlertsManager();
    initializeCore();
}
Also used : LoggerManager(com.alessiodp.core.common.logging.LoggerManager) LoginAlertsManager(com.alessiodp.core.common.players.LoginAlertsManager)

Example 4 with LoggerManager

use of com.alessiodp.core.common.logging.LoggerManager in project Parties by AlessioDP.

the class MigrationsTest method setUp.

@BeforeAll
public static void setUp(@TempDir Path tempDir) {
    LoggerManager mockLoggerManager = mock(LoggerManager.class);
    when(mockPlugin.getLoggerManager()).thenReturn(mockLoggerManager);
    when(mockPlugin.getPluginFallbackName()).thenReturn("parties");
    when(mockPlugin.getFolder()).thenReturn(tempDir);
    when(mockPlugin.getResource(anyString())).thenAnswer((mock) -> ClassLoader.getSystemResourceAsStream(mock.getArgument(0)));
    when(mockLoggerManager.isDebugEnabled()).thenReturn(true);
    // Mock managers for player/party initialization
    ColorManager mockColorManager = mock(ColorManager.class);
    when(mockPlugin.getColorManager()).thenReturn(mockColorManager);
    when(mockColorManager.searchColorByName(anyString())).thenReturn(null);
    PlayerManager mockPlayerManager = mock(PlayerManager.class);
    when(mockPlugin.getPlayerManager()).thenReturn(mockPlayerManager);
    when(mockPlayerManager.initializePlayer(any())).thenAnswer((mock) -> SQLDispatcherTest.initializePlayer(mockPlugin, mock.getArgument(0)));
    PartyManager mockPartyManager = mock(PartyManager.class);
    when(mockPlugin.getPartyManager()).thenReturn(mockPartyManager);
    when(mockPartyManager.initializeParty(any())).thenAnswer((mock) -> SQLDispatcherTest.initializeParty(mockPlugin, mock.getArgument(0)));
    // Mock names
    OfflineUser mockOfflineUser = mock(OfflineUser.class);
    when(mockPlugin.getOfflinePlayer(any())).thenReturn(mockOfflineUser);
    when(mockOfflineUser.getName()).thenReturn("Dummy");
    ConfigMain.STORAGE_SETTINGS_GENERAL_SQL_PREFIX = "test_";
    staticPlugin = Mockito.mockStatic(ADPPlugin.class);
    when(ADPPlugin.getInstance()).thenReturn(mockPlugin);
}
Also used : PlayerManager(com.alessiodp.parties.common.players.PlayerManager) PartyManager(com.alessiodp.parties.common.parties.PartyManager) LoggerManager(com.alessiodp.core.common.logging.LoggerManager) OfflineUser(com.alessiodp.core.common.user.OfflineUser) ColorManager(com.alessiodp.parties.common.parties.ColorManager) ADPPlugin(com.alessiodp.core.common.ADPPlugin) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 5 with LoggerManager

use of com.alessiodp.core.common.logging.LoggerManager in project Parties by AlessioDP.

the class PartiesPlaceholderTest method setUp.

@BeforeAll
public static void setUp() {
    LoggerManager mockLoggerManager = mock(LoggerManager.class);
    when(mockPlugin.getLoggerManager()).thenReturn(mockLoggerManager);
    when(mockPlugin.getDatabaseManager()).thenReturn(mockDatabaseManager);
    when(mockPlugin.getMessageUtils()).thenReturn(mockMessageUtils);
    when(mockMessageUtils.convertRawPlaceholder(any(), any(), any(), any())).thenCallRealMethod();
    // Mock names
    OfflineUser mockOfflineUser = mock(OfflineUser.class);
    when(mockPlugin.getOfflinePlayer(any())).thenReturn(mockOfflineUser);
    when(mockOfflineUser.getName()).thenReturn("Dummy");
    staticPlugin = mockStatic(ADPPlugin.class);
    when(ADPPlugin.getInstance()).thenReturn(mockPlugin);
}
Also used : LoggerManager(com.alessiodp.core.common.logging.LoggerManager) OfflineUser(com.alessiodp.core.common.user.OfflineUser) ADPPlugin(com.alessiodp.core.common.ADPPlugin) BeforeAll(org.junit.jupiter.api.BeforeAll)

Aggregations

LoggerManager (com.alessiodp.core.common.logging.LoggerManager)9 BeforeAll (org.junit.jupiter.api.BeforeAll)8 ADPPlugin (com.alessiodp.core.common.ADPPlugin)6 OfflineUser (com.alessiodp.core.common.user.OfflineUser)4 ColorManager (com.alessiodp.parties.common.parties.ColorManager)3 ADPBootstrap (com.alessiodp.core.common.bootstrap.ADPBootstrap)2 LoginAlertsManager (com.alessiodp.core.common.players.LoginAlertsManager)1 PartiesPlugin (com.alessiodp.parties.common.PartiesPlugin)1 PartyManager (com.alessiodp.parties.common.parties.PartyManager)1 PlayerManager (com.alessiodp.parties.common.players.PlayerManager)1