use of io.aklivity.zilla.runtime.engine.config.ConditionConfig in project zilla by aklivity.
the class ConditionConfigAdapterTest method shouldWriteNullWhenNotAdapting.
@Test
public void shouldWriteNullWhenNotAdapting() {
ConditionConfig condition = new TestConditionConfig("test");
adapter.adaptType(null);
String text = jsonb.toJson(condition);
assertThat(text, not(nullValue()));
assertThat(text, equalTo("null"));
}
use of io.aklivity.zilla.runtime.engine.config.ConditionConfig in project zilla by aklivity.
the class ConditionConfigAdapterTest method shouldWriteCondition.
@Test
public void shouldWriteCondition() {
ConditionConfig condition = new TestConditionConfig("test");
String text = jsonb.toJson(condition);
assertThat(text, not(nullValue()));
assertThat(text, equalTo("{\"match\":\"test\"}"));
}
use of io.aklivity.zilla.runtime.engine.config.ConditionConfig in project zilla by aklivity.
the class WithConfigAdapterTest method shouldWriteWith.
@Test
public void shouldWriteWith() {
ConditionConfig condition = new TestCondition("test");
String text = jsonb.toJson(condition);
assertThat(text, not(nullValue()));
assertThat(text, equalTo("{\"match\":\"test\"}"));
}
use of io.aklivity.zilla.runtime.engine.config.ConditionConfig in project zilla by aklivity.
the class RouteAdapter method adaptFromJson.
@Override
public RouteConfig adaptFromJson(JsonObject object) {
String exit = object.getString(EXIT_NAME);
List<ConditionConfig> when = object.containsKey(WHEN_NAME) ? object.getJsonArray(WHEN_NAME).stream().map(JsonValue::asJsonObject).map(condition::adaptFromJson).collect(Collectors.toList()) : WHEN_DEFAULT;
WithConfig wth = object.containsKey(WITH_NAME) ? with.adaptFromJson(object.getJsonObject(WITH_NAME)) : null;
return new RouteConfig(index, exit, when, wth);
}
use of io.aklivity.zilla.runtime.engine.config.ConditionConfig in project zilla by aklivity.
the class ConditionConfigAdapterTest method shouldReadNullWhenNotAdapting.
@Test
public void shouldReadNullWhenNotAdapting() {
String text = "{" + "\"match\": \"test\"" + "}";
adapter.adaptType(null);
ConditionConfig condition = jsonb.fromJson(text, ConditionConfig.class);
assertThat(condition, nullValue());
}
Aggregations