Search in sources :

Example 1 with EzySessionCreator

use of com.tvd12.ezyfoxserver.creator.EzySessionCreator in project ezyfox-server by youngmonkeys.

the class EzyHandlerGroupBuilderFactoryImplTest method buildWithSessionCreatorNotNull.

@Test
public void buildWithSessionCreatorNotNull() {
    // given
    EzySessionCreator sessionCreator = mock(EzySessionCreator.class);
    EzyHandlerGroupBuilderFactoryImpl.Builder builder = EzyHandlerGroupBuilderFactoryImpl.builder().sessionCreator(sessionCreator);
    // when
    EzyHandlerGroupBuilderFactory factor = builder.build();
    // then
    Asserts.assertNotNull(factor);
}
Also used : EzySessionCreator(com.tvd12.ezyfoxserver.creator.EzySessionCreator) EzyHandlerGroupBuilderFactory(com.tvd12.ezyfoxserver.nio.factory.EzyHandlerGroupBuilderFactory) EzyHandlerGroupBuilderFactoryImpl(com.tvd12.ezyfoxserver.nio.builder.impl.EzyHandlerGroupBuilderFactoryImpl) Test(org.testng.annotations.Test)

Example 2 with EzySessionCreator

use of com.tvd12.ezyfoxserver.creator.EzySessionCreator in project ezyfox-server by youngmonkeys.

the class EzySimpleSessionCreatorTest method test.

@SuppressWarnings("rawtypes")
@Test
public void test() {
    EzySessionManager sessionManager = mock(EzySessionManager.class);
    EzySimpleSessionManagementSetting sessionSetting = new EzySimpleSessionManagementSetting();
    EzySessionCreator creator = EzySimpleSessionCreator.builder().sessionManager(sessionManager).sessionSetting(sessionSetting).build();
    EzyAbstractSession session = spy(EzyAbstractSession.class);
    when(sessionManager.provideSession(any())).thenReturn(session);
    assert creator.create(mock(EzyChannel.class)) == session;
}
Also used : EzySessionCreator(com.tvd12.ezyfoxserver.creator.EzySessionCreator) EzyAbstractSession(com.tvd12.ezyfoxserver.entity.EzyAbstractSession) EzySimpleSessionManagementSetting(com.tvd12.ezyfoxserver.setting.EzySimpleSessionManagementSetting) EzySessionManager(com.tvd12.ezyfoxserver.wrapper.EzySessionManager) BaseTest(com.tvd12.test.base.BaseTest) Test(org.testng.annotations.Test)

Aggregations

EzySessionCreator (com.tvd12.ezyfoxserver.creator.EzySessionCreator)2 Test (org.testng.annotations.Test)2 EzyAbstractSession (com.tvd12.ezyfoxserver.entity.EzyAbstractSession)1 EzyHandlerGroupBuilderFactoryImpl (com.tvd12.ezyfoxserver.nio.builder.impl.EzyHandlerGroupBuilderFactoryImpl)1 EzyHandlerGroupBuilderFactory (com.tvd12.ezyfoxserver.nio.factory.EzyHandlerGroupBuilderFactory)1 EzySimpleSessionManagementSetting (com.tvd12.ezyfoxserver.setting.EzySimpleSessionManagementSetting)1 EzySessionManager (com.tvd12.ezyfoxserver.wrapper.EzySessionManager)1 BaseTest (com.tvd12.test.base.BaseTest)1