use of com.tvd12.ezyfoxserver.context.EzyPluginContext in project ezyfox-server-example by tvd12.
the class PluginEntry method setupBeanContext.
@Override
protected void setupBeanContext(EzyPluginContext context, EzyBeanContextBuilder builder) {
EzyPluginSetting setting = context.getPlugin().getSetting();
String pluginConfigFile = getConfigFile(setting);
PluginConfig pluginConfig = readPluginConfig(pluginConfigFile);
logger.info("simple-chat plugin config: {}", pluginConfig);
}
use of com.tvd12.ezyfoxserver.context.EzyPluginContext in project ezyfox-server by youngmonkeys.
the class EzyPluginResponseImplTest method test.
@Test
public void test() {
EzyZoneContext zoneContext = mock(EzyZoneContext.class);
EzyZone zone = mock(EzyZone.class);
when(zoneContext.getZone()).thenReturn(zone);
EzyZoneUserManager userManager = EzyZoneUserManagerImpl.builder().build();
when(zone.getUserManager()).thenReturn(userManager);
EzyPluginContext pluginContext = mock(EzyPluginContext.class);
when(pluginContext.getParent()).thenReturn(zoneContext);
EzyPluginResponse cmd = (EzyPluginResponse) new EzyPluginResponseImpl(pluginContext).command("test").params(EzyEntityFactory.newArrayBuilder());
cmd.execute();
}
use of com.tvd12.ezyfoxserver.context.EzyPluginContext in project ezyfox-server by youngmonkeys.
the class EzyPluginSendResponseImplTest method test.
@Test
public void test() {
EzyPluginContext pluginContext = mock(EzyPluginContext.class);
EzyPlugin plugin = mock(EzyPlugin.class);
when(pluginContext.getPlugin()).thenReturn(plugin);
EzySimplePluginSetting pluginSetting = new EzySimplePluginSetting();
pluginSetting.setName("test");
when(plugin.getSetting()).thenReturn(pluginSetting);
EzyZoneContext zoneContext = mock(EzyZoneContext.class);
when(pluginContext.getParent()).thenReturn(zoneContext);
EzyServerContext serverContext = mock(EzyServerContext.class);
when(zoneContext.getParent()).thenReturn(serverContext);
EzyPluginSendResponseImpl cmd = new EzyPluginSendResponseImpl(pluginContext);
EzyObject data = EzyEntityFactory.newObjectBuilder().build();
EzyAbstractSession session = spy(EzyAbstractSession.class);
cmd.execute(data, session, false);
cmd.execute(data, Lists.newArrayList(session), false);
}
use of com.tvd12.ezyfoxserver.context.EzyPluginContext in project ezyfox-server by youngmonkeys.
the class EzyPluginInfoController method handle.
@Override
public void handle(EzyServerContext ctx, EzyPluginInfoRequest request) {
EzyUser user = request.getUser();
EzySession session = request.getSession();
EzyPluginInfoParams params = request.getParams();
EzyZoneContext zoneCtx = ctx.getZoneContext(user.getZoneId());
EzyPluginContext pluginCtx = zoneCtx.getPluginContext(params.getPluginName());
if (pluginCtx != null) {
EzyPluginSetting setting = pluginCtx.getPlugin().getSetting();
EzyResponse response = newPluginInfoResponse(setting);
ctx.send(response, session, false);
}
}
use of com.tvd12.ezyfoxserver.context.EzyPluginContext in project ezyfox-server by youngmonkeys.
the class EzyBroadcastPluginsEventImpl method getPluginContextMaps.
private EzyMapSet<EzyConstant, EzyPluginContext> getPluginContextMaps() {
Collection<EzyPluginContext> pluginContexts = context.getPluginContexts();
EzyMapSet<EzyConstant, EzyPluginContext> pluginContextMaps = new EzyHashMapSet<>();
for (EzyPluginContext pluginContext : pluginContexts) {
EzyPluginSetting pluginSetting = pluginContext.getPlugin().getSetting();
Set<EzyConstant> listenEvents = pluginSetting.getListenEvents().getEvents();
for (EzyConstant listenEvent : listenEvents) {
pluginContextMaps.addItem(listenEvent, pluginContext);
}
}
return pluginContextMaps;
}
Aggregations