Search in sources :

Example 1 with EzyPluginInfoController

use of com.tvd12.ezyfoxserver.controller.EzyPluginInfoController in project ezyfox-server by youngmonkeys.

the class EzyPluginInfoControllerTest method test.

@Test
public void test() {
    EzyPluginInfoController controller = new EzyPluginInfoController();
    EzyServerContext serverContext = mock(EzyServerContext.class);
    EzyZoneContext zoneContext = mock(EzyZoneContext.class);
    when(serverContext.getZoneContext(1)).thenReturn(zoneContext);
    EzySimplePluginInfoRequest request = new EzySimplePluginInfoRequest();
    EzyAbstractSession session = spy(EzyAbstractSession.class);
    EzySimpleUser user = new EzySimpleUser();
    user.setZoneId(1);
    request.setSession(session);
    request.setUser(user);
    EzyArray data = EzyEntityFactory.newArrayBuilder().append("test").build();
    request.deserializeParams(data);
    controller.handle(serverContext, request);
    EzyPluginContext pluginContext = mock(EzyPluginContext.class);
    EzySimplePlugin plugin = new EzySimplePlugin();
    EzySimplePluginSetting pluginSetting = new EzySimplePluginSetting();
    plugin.setSetting(pluginSetting);
    when(pluginContext.getPlugin()).thenReturn(plugin);
    when(zoneContext.getPluginContext("test")).thenReturn(pluginContext);
    controller.handle(serverContext, request);
}
Also used : EzySimplePluginInfoRequest(com.tvd12.ezyfoxserver.request.EzySimplePluginInfoRequest) EzySimpleUser(com.tvd12.ezyfoxserver.entity.EzySimpleUser) EzyZoneContext(com.tvd12.ezyfoxserver.context.EzyZoneContext) EzyAbstractSession(com.tvd12.ezyfoxserver.entity.EzyAbstractSession) EzyServerContext(com.tvd12.ezyfoxserver.context.EzyServerContext) EzyPluginContext(com.tvd12.ezyfoxserver.context.EzyPluginContext) EzyPluginInfoController(com.tvd12.ezyfoxserver.controller.EzyPluginInfoController) EzyArray(com.tvd12.ezyfox.entity.EzyArray) EzySimplePlugin(com.tvd12.ezyfoxserver.EzySimplePlugin) EzySimplePluginSetting(com.tvd12.ezyfoxserver.setting.EzySimplePluginSetting) Test(org.testng.annotations.Test) BaseTest(com.tvd12.test.base.BaseTest)

Aggregations

EzyArray (com.tvd12.ezyfox.entity.EzyArray)1 EzySimplePlugin (com.tvd12.ezyfoxserver.EzySimplePlugin)1 EzyPluginContext (com.tvd12.ezyfoxserver.context.EzyPluginContext)1 EzyServerContext (com.tvd12.ezyfoxserver.context.EzyServerContext)1 EzyZoneContext (com.tvd12.ezyfoxserver.context.EzyZoneContext)1 EzyPluginInfoController (com.tvd12.ezyfoxserver.controller.EzyPluginInfoController)1 EzyAbstractSession (com.tvd12.ezyfoxserver.entity.EzyAbstractSession)1 EzySimpleUser (com.tvd12.ezyfoxserver.entity.EzySimpleUser)1 EzySimplePluginInfoRequest (com.tvd12.ezyfoxserver.request.EzySimplePluginInfoRequest)1 EzySimplePluginSetting (com.tvd12.ezyfoxserver.setting.EzySimplePluginSetting)1 BaseTest (com.tvd12.test.base.BaseTest)1 Test (org.testng.annotations.Test)1