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

HBX-2390: Create a JBoss Tools adaptation layer in Hibernate Tools #4243

Merged
merged 1 commit into from
Jun 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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 @@ -102,6 +102,11 @@ default QueryExporterWrapper getQueryExporter() {
return null;
}
}
default void setCustomProperties(Properties properties) {
if (getWrappedObject() instanceof CfgExporter) {
((CfgExporter)getWrappedObject()).setCustomProperties(properties);
}
}
}

static class ExporterWrapperImpl implements ExporterWrapper {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,28 @@ public void testGetQueryExporter() {
assertSame(exporterTarget, queryExporterTarget);
}

@Test
public void testSetCustomProperties() {
Properties properties = new Properties();
// 'setCustomProperties()' should not be called on other exporters than CfgExporter
TestExporter wrappedTestExporter = (TestExporter)exporterWrapper.getWrappedObject();
assertNull(wrappedTestExporter.props);
exporterWrapper.setCustomProperties(null);
assertNull(wrappedTestExporter.props);
// try now with CfgExporter
exporterWrapper = ExporterWrapperFactory.create(CfgExporter.class.getName());
CfgExporter wrappedCfgExporter = (CfgExporter)exporterWrapper.getWrappedObject();
assertNotSame(properties, wrappedCfgExporter.getCustomProperties());
exporterWrapper.setCustomProperties(properties);
assertSame(properties, wrappedCfgExporter.getCustomProperties());
}

public static class TestExporter extends AbstractExporter {
private boolean started = false;
private Properties props = null;
@Override protected void doStart() {}
@Override public void start() { started = true; }
void setCustomProperties(Properties p) { props = p; }
}

}