Search in sources :

Example 1 with FkPipe

use of io.wring.fake.FkPipe in project wring by yegor256.

the class CycleTest method processesSinglePipe.

/**
 * Cycle can process a single pipe.
 * @throws Exception If some problem inside
 */
@Test
public void processesSinglePipe() throws Exception {
    final Base base = new FkBase();
    final Pipe pipe = new FkPipe();
    new Cycle(base).exec(pipe);
}
Also used : FkBase(io.wring.fake.FkBase) Pipe(io.wring.model.Pipe) FkPipe(io.wring.fake.FkPipe) Base(io.wring.model.Base) FkBase(io.wring.fake.FkBase) FkPipe(io.wring.fake.FkPipe) Test(org.junit.Test)

Example 2 with FkPipe

use of io.wring.fake.FkPipe in project wring by yegor256.

the class CycleTest method processesSinglePipeWithBrokenJson.

/**
 * Cycle can process a single pipe with broken JSOn.
 * @throws Exception If some problem inside
 */
@Test
public void processesSinglePipeWithBrokenJson() throws Exception {
    final Base base = new FkBase();
    final Pipe pipe = new FkPipe(new Directives().add("pipe").add("urn").set("urn:test:1").up().add("json").set("{\"a\":\"/@[a-z0-9\\\\-]\\\\s+\"}").up().up());
    new Cycle(base).exec(pipe);
}
Also used : FkBase(io.wring.fake.FkBase) Directives(org.xembly.Directives) Pipe(io.wring.model.Pipe) FkPipe(io.wring.fake.FkPipe) Base(io.wring.model.Base) FkBase(io.wring.fake.FkBase) FkPipe(io.wring.fake.FkPipe) Test(org.junit.Test)

Example 3 with FkPipe

use of io.wring.fake.FkPipe in project wring by yegor256.

the class ExecTest method catchesExceptions.

/**
 * Exec can catch in case of an error.
 * @throws Exception If some problem inside
 */
@Test
public void catchesExceptions() throws Exception {
    final Agent agent = Mockito.mock(Agent.class);
    final Events events = Mockito.mock(Events.class);
    Mockito.doThrow(new IOException("<bug>")).when(agent).push(events);
    new Exec(agent, events, new FkPipe()).run();
    Mockito.verify(events).post(MockitoHamcrest.argThat(Matchers.startsWith("Internal error (java.io.IOException): \"&lt;bug&gt;\"")), MockitoHamcrest.argThat(Matchers.containsString("java.io.IOException: &lt;bug&gt;\n")));
}
Also used : Events(io.wring.model.Events) IOException(java.io.IOException) FkPipe(io.wring.fake.FkPipe) Test(org.junit.Test)

Aggregations

FkPipe (io.wring.fake.FkPipe)3 Test (org.junit.Test)3 FkBase (io.wring.fake.FkBase)2 Base (io.wring.model.Base)2 Pipe (io.wring.model.Pipe)2 Events (io.wring.model.Events)1 IOException (java.io.IOException)1 Directives (org.xembly.Directives)1