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 @@ -275,6 +275,18 @@ private void onInitialBegin(
{
doInitialReset(traceId);
}
if (assertion.resolve)
{
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);
                                }

{
doInitialReset(traceId);
}
else if (assertion.schema != null && !assertion.schema.equals(schema))
{
doInitialReset(traceId);
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to add the explicit concept of resolve as a boolean, or is it sufficient to derive that intent from assertion.schema != null instead ?

This perhaps seems more intuitive since it would read as asserting the id and schema, agree?

}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,18 @@ 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)
long delay,
boolean resolve)
{
this.id = id;
this.schema = schema;
this.delay = delay;
this.resolve = resolve;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ 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,7 +176,8 @@ public OptionsConfig adaptFromJson(
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(DELAY_NAME) ? c.getJsonNumber(DELAY_NAME).longValue() : 0L,
c.containsKey(RESOLVE_NAME) ? c.getBoolean(RESOLVE_NAME) : false));
}
testOptions.catalogAssertions(catalogName, catalogAssertions);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@
"delay":
{
"type": "number"
},
"resolve":
{
"type": "boolean"
}
}
}
Expand Down