Search in sources :

Example 1 with KnotProxy

use of io.knotx.reactivex.proxy.KnotProxy in project knotx by Cognifide.

the class FragmentAssemblerTest method callAssemblerWithAssertions.

private void callAssemblerWithAssertions(TestContext context, List<Pair<List<String>, String>> fragments, Action1<KnotContext> testFunction) {
    Async async = context.async();
    KnotProxy service = KnotProxy.createProxy(new Vertx(vertx.vertx()), ADDRESS);
    service.rxProcess(KnotContextFactory.create(fragments)).map(ctx -> Pair.of(async, ctx)).doOnSuccess(success -> testFunction.call(success.getRight())).subscribe(success -> async.complete(), context::fail);
}
Also used : TestContext(io.vertx.ext.unit.TestContext) Async(io.vertx.ext.unit.Async) Arrays(java.util.Arrays) KnotContext(io.knotx.dataobjects.KnotContext) RunWith(org.junit.runner.RunWith) Logback(io.knotx.junit.rule.Logback) Action1(rx.functions.Action1) StringUtils(org.apache.commons.lang3.StringUtils) Vertx(io.vertx.reactivex.core.Vertx) FileReader(io.knotx.junit.util.FileReader) Pair(org.apache.commons.lang3.tuple.Pair) KnotxConfiguration(io.knotx.junit.rule.KnotxConfiguration) TestVertxDeployer(io.knotx.junit.rule.TestVertxDeployer) KnotProxy(io.knotx.reactivex.proxy.KnotProxy) KnotContextFactory(io.knotx.junit.util.KnotContextFactory) HttpResponseStatus(io.netty.handler.codec.http.HttpResponseStatus) IOException(java.io.IOException) Test(org.junit.Test) VertxUnitRunner(io.vertx.ext.unit.junit.VertxUnitRunner) ImmutablePair(org.apache.commons.lang3.tuple.ImmutablePair) RuleChain(org.junit.rules.RuleChain) List(java.util.List) Rule(org.junit.Rule) RunTestOnContext(io.vertx.ext.unit.junit.RunTestOnContext) Collections(java.util.Collections) Async(io.vertx.ext.unit.Async) KnotProxy(io.knotx.reactivex.proxy.KnotProxy) Vertx(io.vertx.reactivex.core.Vertx)

Example 2 with KnotProxy

use of io.knotx.reactivex.proxy.KnotProxy in project knotx by Cognifide.

the class HtmlFragmentSplitterVerticleTest method callFragmentSplitterWithAssertions.

private void callFragmentSplitterWithAssertions(TestContext context, String template, Action1<KnotContext> testFunction) {
    Async async = context.async();
    KnotProxy service = KnotProxy.createProxy(new Vertx(vertx.vertx()), ADDRESS);
    service.rxProcess(KnotContextFactory.empty(template)).map(ctx -> Pair.of(async, ctx)).doOnSuccess(success -> testFunction.call(success.getRight())).subscribe(success -> async.complete(), context::fail);
}
Also used : TestContext(io.vertx.ext.unit.TestContext) Async(io.vertx.ext.unit.Async) KnotContext(io.knotx.dataobjects.KnotContext) KnotProxy(io.knotx.reactivex.proxy.KnotProxy) RunWith(org.junit.runner.RunWith) KnotContextFactory(io.knotx.junit.util.KnotContextFactory) HttpResponseStatus(io.netty.handler.codec.http.HttpResponseStatus) Test(org.junit.Test) Logback(io.knotx.junit.rule.Logback) VertxUnitRunner(io.vertx.ext.unit.junit.VertxUnitRunner) Action1(rx.functions.Action1) RuleChain(org.junit.rules.RuleChain) Vertx(io.vertx.reactivex.core.Vertx) Rule(org.junit.Rule) FileReader(io.knotx.junit.util.FileReader) Pair(org.apache.commons.lang3.tuple.Pair) KnotxConfiguration(io.knotx.junit.rule.KnotxConfiguration) RunTestOnContext(io.vertx.ext.unit.junit.RunTestOnContext) TestVertxDeployer(io.knotx.junit.rule.TestVertxDeployer) Async(io.vertx.ext.unit.Async) KnotProxy(io.knotx.reactivex.proxy.KnotProxy) Vertx(io.vertx.reactivex.core.Vertx)

Example 3 with KnotProxy

use of io.knotx.reactivex.proxy.KnotProxy in project knotx by Cognifide.

the class ActionKnotProxyVerticleTest method callActionKnotWithAssertions.

private void callActionKnotWithAssertions(TestContext context, KnotContext knotContext, Action1<KnotContext> onSuccess, Consumer<Throwable> onError) {
    Async async = context.async();
    KnotProxy actionKnot = KnotProxy.createProxy(new Vertx(vertx.vertx()), ADDRESS);
    actionKnot.rxProcess(knotContext).doOnSuccess(onSuccess::call).subscribe(success -> async.complete(), onError);
}
Also used : Async(io.vertx.ext.unit.Async) KnotProxy(io.knotx.reactivex.proxy.KnotProxy) Vertx(io.vertx.reactivex.core.Vertx)

Aggregations

KnotProxy (io.knotx.reactivex.proxy.KnotProxy)3 Async (io.vertx.ext.unit.Async)3 Vertx (io.vertx.reactivex.core.Vertx)3 KnotContext (io.knotx.dataobjects.KnotContext)2 KnotxConfiguration (io.knotx.junit.rule.KnotxConfiguration)2 Logback (io.knotx.junit.rule.Logback)2 TestVertxDeployer (io.knotx.junit.rule.TestVertxDeployer)2 FileReader (io.knotx.junit.util.FileReader)2 KnotContextFactory (io.knotx.junit.util.KnotContextFactory)2 HttpResponseStatus (io.netty.handler.codec.http.HttpResponseStatus)2 TestContext (io.vertx.ext.unit.TestContext)2 RunTestOnContext (io.vertx.ext.unit.junit.RunTestOnContext)2 VertxUnitRunner (io.vertx.ext.unit.junit.VertxUnitRunner)2 Pair (org.apache.commons.lang3.tuple.Pair)2 Rule (org.junit.Rule)2 Test (org.junit.Test)2 RuleChain (org.junit.rules.RuleChain)2 RunWith (org.junit.runner.RunWith)2 Action1 (rx.functions.Action1)2 IOException (java.io.IOException)1