use of io.micronaut.rxjava2.http.client.RxHttpClient in project kestra by kestra-io.
the class PluginControllerTest method docs.
@SuppressWarnings("unchecked")
@Test
void docs() throws URISyntaxException {
Helpers.runApplicationContext((applicationContext, embeddedServer) -> {
RxHttpClient client = RxHttpClient.create(embeddedServer.getURL());
io.kestra.webserver.controllers.PluginController.Doc doc = client.toBlocking().retrieve(HttpRequest.GET("/api/v1/plugins/io.kestra.plugin.templates.ExampleTask"), io.kestra.webserver.controllers.PluginController.Doc.class);
assertThat(doc.getMarkdown(), containsString("io.kestra.plugin.templates.ExampleTask"));
assertThat(((Map<String, Object>) doc.getSchema().getProperties().get("properties")).size(), is(2));
assertThat(((Map<String, Object>) doc.getSchema().getOutputs().get("properties")).size(), is(1));
});
}
use of io.micronaut.rxjava2.http.client.RxHttpClient in project kestra by kestra-io.
the class PluginControllerTest method plugins.
@Test
void plugins() throws URISyntaxException {
Helpers.runApplicationContext((applicationContext, embeddedServer) -> {
RxHttpClient client = RxHttpClient.create(embeddedServer.getURL());
List<io.kestra.webserver.controllers.PluginController.Plugin> list = client.toBlocking().retrieve(HttpRequest.GET("/api/v1/plugins"), Argument.listOf(io.kestra.webserver.controllers.PluginController.Plugin.class));
assertThat(list.size(), is(2));
io.kestra.webserver.controllers.PluginController.Plugin template = list.stream().filter(plugin -> plugin.getManifest().get("X-Kestra-Title").equals("plugin-template-test")).findFirst().orElseThrow();
assertThat(template.getTasks().size(), is(1));
assertThat(template.getTasks().get(0), is("io.kestra.plugin.templates.ExampleTask"));
// classLoader can lead to duplicate plugins for the core, just verify that the response is still the same
list = client.toBlocking().retrieve(HttpRequest.GET("/api/v1/plugins"), Argument.listOf(io.kestra.webserver.controllers.PluginController.Plugin.class));
assertThat(list.size(), is(2));
});
}
use of io.micronaut.rxjava2.http.client.RxHttpClient in project kestra by kestra-io.
the class BasicAuthEndpointsFilterTest method test.
void test(boolean password, BiConsumer<RxHttpClient, MutableHttpRequest<String>> consumer) {
MapPropertySource mapPropertySource = new MapPropertySource("unittest", password ? Map.of("endpoints.all.enabled", true, "endpoints.all.sensitive", false, "endpoints.all.basic-auth.username", "foo", "endpoints.all.basic-auth.password", "bar") : Map.of("endpoints.all.enabled", true, "endpoints.all.sensitive", false));
try (ApplicationContext ctx = ApplicationContext.run(mapPropertySource, Environment.CLI, Environment.TEST)) {
EmbeddedServer embeddedServer = ctx.getBean(EmbeddedServer.class);
embeddedServer.start();
RxHttpClient client = ctx.getBean(RxHttpClient.class);
consumer.accept(client, HttpRequest.GET("http://localhost:" + embeddedServer.getPort() + "/health"));
}
}
use of io.micronaut.rxjava2.http.client.RxHttpClient in project kestra by kestra-io.
the class PluginControllerTest method bash.
@SuppressWarnings("unchecked")
@Test
void bash() throws URISyntaxException {
Helpers.runApplicationContext((applicationContext, embeddedServer) -> {
RxHttpClient client = RxHttpClient.create(embeddedServer.getURL());
io.kestra.webserver.controllers.PluginController.Doc doc = client.toBlocking().retrieve(HttpRequest.GET("/api/v1/plugins/io.kestra.core.tasks.scripts.Bash"), io.kestra.webserver.controllers.PluginController.Doc.class);
assertThat(doc.getMarkdown(), containsString("io.kestra.core.tasks.scripts.Bash"));
assertThat(doc.getMarkdown(), containsString("Exit if any non true return value"));
assertThat(doc.getMarkdown(), containsString("The standard output line count"));
assertThat(((Map<String, Object>) doc.getSchema().getProperties().get("properties")).size(), is(12));
assertThat(((Map<String, Object>) doc.getSchema().getOutputs().get("properties")).size(), is(6));
});
}
use of io.micronaut.rxjava2.http.client.RxHttpClient in project kestra by kestra-io.
the class PluginControllerTest method icons.
@Test
void icons() throws URISyntaxException {
Helpers.runApplicationContext((applicationContext, embeddedServer) -> {
RxHttpClient client = RxHttpClient.create(embeddedServer.getURL());
Map<String, io.kestra.webserver.controllers.PluginController.PluginIcon> list = client.toBlocking().retrieve(HttpRequest.GET("/api/v1/plugins/icons"), Argument.mapOf(String.class, io.kestra.webserver.controllers.PluginController.PluginIcon.class));
assertThat(list.entrySet().stream().filter(e -> e.getKey().equals(Bash.class.getName())).findFirst().orElseThrow().getValue().getIcon(), is(notNullValue()));
});
}
Aggregations