@Test void testGetPlugins() { IPlugin[] plugins = setupPlugins(); Mockito.when(this.manager.getPlugins()).thenReturn(Arrays.asList(plugins)); Response r = this.target.request().get(); assertEquals(200, r.getStatus()); SimplePluginEntity[] spes = r.readEntity(SimplePluginEntity[].class); assertEquals(plugins.length, spes.length); for (int i = 0; i < plugins.length; i++) { assertEquals(plugins[i].getDisplayName(), spes[i].getName()); assertEquals(plugins[i].getDescription(), spes[i].getDescription()); assertEquals(null, spes[i].getLink()); } }
@GET @Produces(MediaType.APPLICATION_JSON) @Operation(tags = "home") public SimplePluginEntity[] getPlugins() { List<IPlugin> pluginList = this.manager.getPlugins(); SimplePluginEntity[] plugins = new SimplePluginEntity[pluginList.size()]; for (int i = 0; i < pluginList.size(); i++) { plugins[i] = new SimplePluginEntity(pluginList.get(i)); plugins[i].setLink(createPath(pluginList.get(i))); } return plugins; }
HomeResource { @GET @Produces(MediaType.APPLICATION_JSON) @Operation(tags = "home") public SimplePluginEntity[] getPlugins() { List<IPlugin> pluginList = this.manager.getPlugins(); SimplePluginEntity[] plugins = new SimplePluginEntity[pluginList.size()]; for (int i = 0; i < pluginList.size(); i++) { plugins[i] = new SimplePluginEntity(pluginList.get(i)); plugins[i].setLink(createPath(pluginList.get(i))); } return plugins; } }
HomeResource { @GET @Produces(MediaType.APPLICATION_JSON) @Operation(tags = "home") public SimplePluginEntity[] getPlugins() { List<IPlugin> pluginList = this.manager.getPlugins(); SimplePluginEntity[] plugins = new SimplePluginEntity[pluginList.size()]; for (int i = 0; i < pluginList.size(); i++) { plugins[i] = new SimplePluginEntity(pluginList.get(i)); plugins[i].setLink(createPath(pluginList.get(i))); } return plugins; }  }
HomeResource { @GET @Produces(MediaType.APPLICATION_JSON) @Operation(tags = "home") public SimplePluginEntity[] getPlugins() { List<IPlugin> pluginList = this.manager.getPlugins(); SimplePluginEntity[] plugins = new SimplePluginEntity[pluginList.size()]; for (int i = 0; i < pluginList.size(); i++) { plugins[i] = new SimplePluginEntity(pluginList.get(i)); plugins[i].setLink(createPath(pluginList.get(i))); } return plugins; }  @GET @Produces(MediaType.APPLICATION_JSON) @Operation(tags = "home") SimplePluginEntity[] getPlugins(); @POST @Path("mute") void mute(); @POST @Path("unmute") void unmute(); }
HomeResource { @GET @Produces(MediaType.APPLICATION_JSON) @Operation(tags = "home") public SimplePluginEntity[] getPlugins() { List<IPlugin> pluginList = this.manager.getPlugins(); SimplePluginEntity[] plugins = new SimplePluginEntity[pluginList.size()]; for (int i = 0; i < pluginList.size(); i++) { plugins[i] = new SimplePluginEntity(pluginList.get(i)); plugins[i].setLink(createPath(pluginList.get(i))); } return plugins; }  @GET @Produces(MediaType.APPLICATION_JSON) @Operation(tags = "home") SimplePluginEntity[] getPlugins(); @POST @Path("mute") void mute(); @POST @Path("unmute") void unmute(); static final String PATH; }