Skip to content

Commit

Permalink
Update to handle catalog IT validation(resolve schema from subject) (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
ankitk-me authored May 28, 2024
1 parent 2429256 commit e500419
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@
*/
package io.aklivity.zilla.runtime.engine.test.internal.binding;

import static io.aklivity.zilla.runtime.engine.test.internal.binding.config.TestBindingOptionsConfigAdapter.DEFAULT_ASSERTION_SCHEMA;

import java.util.LinkedList;
import java.util.List;
import java.util.Objects;

import org.agrona.DirectBuffer;
import org.agrona.MutableDirectBuffer;
Expand Down Expand Up @@ -275,6 +278,14 @@ private void onInitialBegin(
{
doInitialReset(traceId);
}
if (DEFAULT_ASSERTION_SCHEMA != assertion.schema)
{
String schema = handler.resolve(id);
if (!Objects.equals(assertion.schema, schema))
{
doInitialReset(traceId);
}
}
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@

public final class TestBindingOptionsConfigAdapter implements OptionsConfigAdapterSpi
{
public static final String DEFAULT_ASSERTION_SCHEMA = new String();

private static final String MODE_NAME = "mode";
private static final String CATALOG_NAME = "catalog";
private static final String AUTHORIZATION_NAME = "authorization";
Expand Down Expand Up @@ -174,7 +176,8 @@ public OptionsConfig adaptFromJson(
JsonObject c = assertion.asJsonObject();
catalogAssertions.add(new TestBindingOptionsConfig.CatalogAssertion(
c.containsKey(ID_NAME) ? c.getInt(ID_NAME) : 0,
c.containsKey(SCHEMA_NAME) ? !c.isNull(SCHEMA_NAME) ? c.getString(SCHEMA_NAME) : null : null,
c.containsKey(SCHEMA_NAME) ? !c.isNull(SCHEMA_NAME) ? c.getString(SCHEMA_NAME)
: null : DEFAULT_ASSERTION_SCHEMA,
c.containsKey(DELAY_NAME) ? c.getJsonNumber(DELAY_NAME).longValue() : 0L));
}
testOptions.catalogAssertions(catalogName, catalogAssertions);
Expand Down

0 comments on commit e500419

Please sign in to comment.