Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to handle catalog IT validation(resolve schema from subject) #1055

Merged
merged 3 commits into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,7 +278,7 @@ private void onInitialBegin(
{
doInitialReset(traceId);
}
if (assertion.resolve)
if (!Objects.equals(DEFAULT_ASSERTION_SCHEMA, assertion.schema))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (!Objects.equals(DEFAULT_ASSERTION_SCHEMA, assertion.schema))
if (assertion.schema != DEFAULT_ASSERTION_SCHEMA)

{
String schema = handler.resolve(id);
if (assertion.schema == null && schema != null)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

                                if (!Objects.equals(assertion.schema, schema))
                                {
                                     doInitialReset(traceId);
                                }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,18 +87,15 @@ public static final class CatalogAssertion
public final int id;
public final String schema;
public final long delay;
public final boolean resolve;

public CatalogAssertion(
int id,
String schema,
long delay,
boolean resolve)
long delay)
{
this.id = id;
this.schema = schema;
this.delay = delay;
this.resolve = resolve;
}
}
}
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 All @@ -44,7 +46,6 @@ public final class TestBindingOptionsConfigAdapter implements OptionsConfigAdapt
private static final String ID_NAME = "id";
private static final String SCHEMA_NAME = "schema";
private static final String DELAY_NAME = "delay";
private static final String RESOLVE_NAME = "resolve";

private final SchemaConfigAdapter schema = new SchemaConfigAdapter();

Expand Down Expand Up @@ -175,9 +176,9 @@ 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(DELAY_NAME) ? c.getJsonNumber(DELAY_NAME).longValue() : 0L,
c.containsKey(RESOLVE_NAME) ? c.getBoolean(RESOLVE_NAME) : false));
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
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,6 @@
"delay":
{
"type": "number"
},
"resolve":
{
"type": "boolean"
}
}
}
Expand Down