From 53fa6b518cb5b4e8c9111a414930f4369a23a1bd Mon Sep 17 00:00:00 2001 From: Michal Petrov Date: Thu, 11 Jul 2024 14:09:13 +0200 Subject: [PATCH 1/2] WFLY-19304: fix schema and model, bump --- .../subsystems/datasources/Constants.java | 12 +- .../datasources/DataSourcesExtension.java | 88 +- .../subsystems/datasources/Namespace.java | 6 +- .../schema/wildfly-datasources_7_2.xsd | 1119 +++++++++++++++++ .../DatasourcesSubsystemTestCase.java | 4 +- .../subsystems/datasources/datasource.xml | 489 ++++--- ...datasources-elytron-enabled-expression.xml | 540 ++++---- .../datasources-elytron-enabled.xml | 542 ++++---- .../datasources-full-expression.xml | 24 +- .../datasources/datasources-full.xml | 26 +- .../datasources/datasources-minimal.xml | 2 +- ...urces-validation-custom-modules-reject.xml | 12 +- .../DataSourceCfgMetricUnitTestCase.java | 2 +- .../metrics/data-sources/basic-attributes.xml | 2 +- .../metrics/data-sources/complex-driver.xml | 2 +- .../jca/metrics/data-sources/empty-driver.xml | 2 +- .../metrics/data-sources/pool-properties.xml | 2 +- .../data-sources/statement-properties.xml | 2 +- .../data-sources/timeout-properties.xml | 2 +- .../data-sources/validation-properties.xml | 2 +- .../data-sources/wrong-2-driver-classes.xml | 2 +- .../wrong-2-ds-classes-driver.xml | 2 +- .../wrong-2-xa-ds-classes-driver.xml | 2 +- .../wrong-alloc-retry-property.xml | 2 +- .../wrong-alloc-retry-wait-property.xml | 2 +- .../wrong-blckg-timeout-property.xml | 2 +- .../data-sources/wrong-empty-name-driver.xml | 2 +- .../wrong-flush-strategy-property.xml | 2 +- .../data-sources/wrong-idle-mins-property.xml | 2 +- ...wrong-max-less-min-pool-size-propertiy.xml | 2 +- .../wrong-max-pool-size-propertiy.xml | 2 +- .../wrong-min-pool-size-propertiy.xml | 2 +- .../metrics/data-sources/wrong-no-driver.xml | 2 +- .../wrong-no-xa-ds-properties.xml | 2 +- .../wrong-stmt-cache-size-property.xml | 2 +- .../wrong-transaction-isolation-type.xml | 2 +- .../data-sources/wrong-trck-stmt-property.xml | 2 +- .../wrong-validation-properties.xml | 2 +- .../data-sources/wrong-wo-name-driver.xml | 2 +- .../wrong-xa-2-security-domains.xml | 2 +- .../data-sources/wrong-xa-bogus-driver.xml | 2 +- .../wrong-xa-res-timeout-property.xml | 2 +- .../data-sources/xa-basic-attributes.xml | 2 +- .../data-sources/xa-bool-pres-properties.xml | 2 +- .../data-sources/xa-default-properties.xml | 2 +- .../xa-false-bool-pres-properties.xml | 10 +- .../xa-true-bool-pres-properties.xml | 10 +- 47 files changed, 2024 insertions(+), 926 deletions(-) create mode 100644 connector/src/main/resources/schema/wildfly-datasources_7_2.xsd diff --git a/connector/src/main/java/org/jboss/as/connector/subsystems/datasources/Constants.java b/connector/src/main/java/org/jboss/as/connector/subsystems/datasources/Constants.java index 84b17d40d737..d8e07bddd19d 100644 --- a/connector/src/main/java/org/jboss/as/connector/subsystems/datasources/Constants.java +++ b/connector/src/main/java/org/jboss/as/connector/subsystems/datasources/Constants.java @@ -24,8 +24,10 @@ import org.jboss.as.controller.SimpleOperationDefinitionBuilder; import org.jboss.as.controller.access.constraint.SensitivityClassification; import org.jboss.as.controller.access.management.SensitiveTargetAccessConstraintDefinition; +import org.jboss.as.controller.client.helpers.MeasurementUnit; import org.jboss.as.controller.descriptions.ModelDescriptionConstants; import org.jboss.as.controller.descriptions.NonResolvingResourceDescriptionResolver; +import org.jboss.as.controller.operations.validation.EnumValidator; import org.jboss.as.controller.operations.validation.StringLengthValidator; import org.jboss.as.controller.registry.AttributeAccess; import org.jboss.as.controller.security.CredentialReference; @@ -39,6 +41,7 @@ import org.jboss.jca.common.api.metadata.ds.DsPool; import org.jboss.jca.common.api.metadata.ds.Statement; import org.jboss.jca.common.api.metadata.ds.TimeOut; +import org.jboss.jca.common.api.metadata.ds.TransactionIsolation; import org.jboss.jca.common.api.metadata.ds.Validation; import org.jboss.jca.common.api.metadata.ds.XaDataSource; @@ -431,7 +434,8 @@ public class Constants { static SimpleAttributeDefinition TRACK_STATEMENTS = new SimpleAttributeDefinitionBuilder(TRACKSTATEMENTS_NAME, ModelType.STRING, true) .setAllowExpression(true) .setXmlName(Statement.Tag.TRACK_STATEMENTS.getLocalName()) - .setDefaultValue(new ModelNode(Defaults.TRACK_STATEMENTS.name())) + .setDefaultValue(new ModelNode(Defaults.TRACK_STATEMENTS.toString())) + .setValidator(EnumValidator.create(Statement.TrackStatementsEnum.class)) .setRestartAllServices() .build(); @@ -444,6 +448,7 @@ public class Constants { static SimpleAttributeDefinition ALLOCATION_RETRY_WAIT_MILLIS = new SimpleAttributeDefinitionBuilder(ALLOCATION_RETRY_WAIT_MILLIS_NAME, ModelType.LONG, true) .setXmlName(TimeOut.Tag.ALLOCATION_RETRY_WAIT_MILLIS.getLocalName()) + .setMeasurementUnit(MeasurementUnit.MILLISECONDS) .setAllowExpression(true) .setRestartAllServices() .build(); @@ -472,6 +477,7 @@ public class Constants { static SimpleAttributeDefinition QUERY_TIMEOUT = new SimpleAttributeDefinitionBuilder(QUERYTIMEOUT_NAME, ModelType.LONG, true) .setXmlName(TimeOut.Tag.QUERY_TIMEOUT.getLocalName()) + .setMeasurementUnit(MeasurementUnit.SECONDS) .setAllowExpression(true) .setRestartAllServices() .build(); @@ -492,6 +498,9 @@ public class Constants { static SimpleAttributeDefinition TRANSACTION_ISOLATION = new SimpleAttributeDefinitionBuilder(TRANSACTION_ISOLATION_NAME, ModelType.STRING, true) .setXmlName(DataSource.Tag.TRANSACTION_ISOLATION.getLocalName()) .setAllowExpression(true) + .setAllowedValues(TransactionIsolation.TRANSACTION_NONE.name(), TransactionIsolation.TRANSACTION_READ_COMMITTED.name(), + TransactionIsolation.TRANSACTION_READ_UNCOMMITTED.name(), TransactionIsolation.TRANSACTION_REPEATABLE_READ.name(), + TransactionIsolation.TRANSACTION_SERIALIZABLE.name()) .setRestartAllServices() .build(); @@ -623,6 +632,7 @@ public class Constants { static SimpleAttributeDefinition XA_RESOURCE_TIMEOUT = new SimpleAttributeDefinitionBuilder(XA_RESOURCE_TIMEOUT_NAME, ModelType.INT, true) .setXmlName(TimeOut.Tag.XA_RESOURCE_TIMEOUT.getLocalName()) + .setMeasurementUnit(MeasurementUnit.SECONDS) .setAllowExpression(true) .setRestartAllServices() .build(); diff --git a/connector/src/main/java/org/jboss/as/connector/subsystems/datasources/DataSourcesExtension.java b/connector/src/main/java/org/jboss/as/connector/subsystems/datasources/DataSourcesExtension.java index 24e01f4e1297..f121cc2628cf 100644 --- a/connector/src/main/java/org/jboss/as/connector/subsystems/datasources/DataSourcesExtension.java +++ b/connector/src/main/java/org/jboss/as/connector/subsystems/datasources/DataSourcesExtension.java @@ -146,7 +146,7 @@ public class DataSourcesExtension implements Extension { public static final String SUBSYSTEM_NAME = Constants.DATASOURCES; private static final String RESOURCE_NAME = DataSourcesExtension.class.getPackage().getName() + ".LocalDescriptions"; - static final ModelVersion CURRENT_MODEL_VERSION = ModelVersion.create(6, 0, 0); + static final ModelVersion CURRENT_MODEL_VERSION = ModelVersion.create(7, 2, 0); static StandardResourceDescriptionResolver getResourceDescriptionResolver(final String... keyPrefix) { StringBuilder prefix = new StringBuilder(SUBSYSTEM_NAME); @@ -187,6 +187,7 @@ public void initializeParsers(final ExtensionParsingContext context) { context.setSubsystemXmlMapping(SUBSYSTEM_NAME, Namespace.DATASOURCES_6_0.getUriString(), DataSourceSubsystemParser::new); context.setSubsystemXmlMapping(SUBSYSTEM_NAME, Namespace.DATASOURCES_7_0.getUriString(), DataSourceSubsystemParser::new); context.setSubsystemXmlMapping(SUBSYSTEM_NAME, Namespace.DATASOURCES_7_1.getUriString(), DataSourceSubsystemParser::new); + context.setSubsystemXmlMapping(SUBSYSTEM_NAME, Namespace.DATASOURCES_7_2.getUriString(), DataSourceSubsystemParser::new); } public static final class DataSourceSubsystemParser implements XMLStreamConstants, XMLElementReader>, @@ -282,22 +283,14 @@ private void writeDS(XMLExtendedStreamWriter writer, boolean isXADataSource, Mod } XA_DATASOURCE_CLASS.marshallAsElement(dataSourceNode, writer); - - } - DATASOURCE_DRIVER.marshallAsElement(dataSourceNode, writer); - - if (isXADataSource) { - URL_DELIMITER.marshallAsElement(dataSourceNode, writer); URL_PROPERTY.marshallAsElement(dataSourceNode, writer); - URL_SELECTOR_STRATEGY_CLASS_NAME.marshallAsElement(dataSourceNode, writer); } + DATASOURCE_DRIVER.marshallAsElement(dataSourceNode, writer); + URL_DELIMITER.marshallAsElement(dataSourceNode, writer); + URL_SELECTOR_STRATEGY_CLASS_NAME.marshallAsElement(dataSourceNode, writer); NEW_CONNECTION_SQL.marshallAsElement(dataSourceNode, writer); TRANSACTION_ISOLATION.marshallAsElement(dataSourceNode, writer); - if (!isXADataSource) { - URL_DELIMITER.marshallAsElement(dataSourceNode, writer); - URL_SELECTOR_STRATEGY_CLASS_NAME.marshallAsElement(dataSourceNode, writer); - } boolean poolRequired = INITIAL_POOL_SIZE.isMarshallable(dataSourceNode) || MIN_POOL_SIZE.isMarshallable(dataSourceNode) || MAX_POOL_SIZE.isMarshallable(dataSourceNode) || @@ -379,40 +372,6 @@ private void writeDS(XMLExtendedStreamWriter writer, boolean isXADataSource, Mod } writer.writeEndElement(); } - boolean securityRequired = USERNAME.isMarshallable(dataSourceNode) || - PASSWORD.isMarshallable(dataSourceNode) || - CREDENTIAL_REFERENCE.isMarshallable(dataSourceNode) || - SECURITY_DOMAIN.isMarshallable(dataSourceNode) || - ELYTRON_ENABLED.isMarshallable(dataSourceNode) || - REAUTH_PLUGIN_CLASSNAME.isMarshallable(dataSourceNode) || - REAUTHPLUGIN_PROPERTIES.isMarshallable(dataSourceNode); - if (securityRequired) { - writer.writeStartElement(DataSource.Tag.SECURITY.getLocalName()); - USERNAME.marshallAsAttribute(dataSourceNode, writer); - PASSWORD.marshallAsAttribute(dataSourceNode, writer); - SECURITY_DOMAIN.marshallAsElement(dataSourceNode, writer); - CREDENTIAL_REFERENCE.marshallAsElement(dataSourceNode, writer); - ELYTRON_ENABLED.marshallAsElement(dataSourceNode, writer); - AUTHENTICATION_CONTEXT.marshallAsElement(dataSourceNode, writer); - - if (dataSourceNode.hasDefined(REAUTH_PLUGIN_CLASSNAME.getName())) { - writer.writeStartElement(DsSecurity.Tag.REAUTH_PLUGIN.getLocalName()); - writer.writeAttribute( - org.jboss.jca.common.api.metadata.common.Extension.Attribute.CLASS_NAME.getLocalName(), - dataSourceNode.get(REAUTH_PLUGIN_CLASSNAME.getName()).asString()); - - if (dataSourceNode.hasDefined(REAUTHPLUGIN_PROPERTIES.getName())) { - for (Property connectionProperty : dataSourceNode.get(REAUTHPLUGIN_PROPERTIES.getName()).asPropertyList()) { - writeProperty(writer, dataSourceNode, connectionProperty.getName(), connectionProperty - .getValue().asString(), - org.jboss.jca.common.api.metadata.common.Extension.Tag.CONFIG_PROPERTY - .getLocalName()); - } - } - writer.writeEndElement(); - } - writer.writeEndElement(); - } boolean recoveryRequired = RECOVERY_USERNAME.isMarshallable(dataSourceNode) || RECOVERY_PASSWORD.isMarshallable(dataSourceNode) || @@ -429,10 +388,10 @@ private void writeDS(XMLExtendedStreamWriter writer, boolean isXADataSource, Mod writer.writeStartElement(Recovery.Tag.RECOVER_CREDENTIAL.getLocalName()); RECOVERY_USERNAME.marshallAsAttribute(dataSourceNode, writer); RECOVERY_PASSWORD.marshallAsAttribute(dataSourceNode, writer); - RECOVERY_ELYTRON_ENABLED.marshallAsElement(dataSourceNode, writer); RECOVERY_AUTHENTICATION_CONTEXT.marshallAsElement(dataSourceNode, writer); RECOVERY_SECURITY_DOMAIN.marshallAsElement(dataSourceNode, writer); RECOVERY_CREDENTIAL_REFERENCE.marshallAsElement(dataSourceNode, writer); + RECOVERY_ELYTRON_ENABLED.marshallAsElement(dataSourceNode, writer); writer.writeEndElement(); } if (hasAnyOf(dataSourceNode, RECOVER_PLUGIN_CLASSNAME)) { @@ -454,6 +413,41 @@ private void writeDS(XMLExtendedStreamWriter writer, boolean isXADataSource, Mod writer.writeEndElement(); } + boolean securityRequired = USERNAME.isMarshallable(dataSourceNode) || + PASSWORD.isMarshallable(dataSourceNode) || + CREDENTIAL_REFERENCE.isMarshallable(dataSourceNode) || + SECURITY_DOMAIN.isMarshallable(dataSourceNode) || + ELYTRON_ENABLED.isMarshallable(dataSourceNode) || + REAUTH_PLUGIN_CLASSNAME.isMarshallable(dataSourceNode) || + REAUTHPLUGIN_PROPERTIES.isMarshallable(dataSourceNode); + if (securityRequired) { + writer.writeStartElement(DataSource.Tag.SECURITY.getLocalName()); + USERNAME.marshallAsAttribute(dataSourceNode, writer); + PASSWORD.marshallAsAttribute(dataSourceNode, writer); + SECURITY_DOMAIN.marshallAsElement(dataSourceNode, writer); + AUTHENTICATION_CONTEXT.marshallAsElement(dataSourceNode, writer); + CREDENTIAL_REFERENCE.marshallAsElement(dataSourceNode, writer); + ELYTRON_ENABLED.marshallAsElement(dataSourceNode, writer); + + if (dataSourceNode.hasDefined(REAUTH_PLUGIN_CLASSNAME.getName())) { + writer.writeStartElement(DsSecurity.Tag.REAUTH_PLUGIN.getLocalName()); + writer.writeAttribute( + org.jboss.jca.common.api.metadata.common.Extension.Attribute.CLASS_NAME.getLocalName(), + dataSourceNode.get(REAUTH_PLUGIN_CLASSNAME.getName()).asString()); + + if (dataSourceNode.hasDefined(REAUTHPLUGIN_PROPERTIES.getName())) { + for (Property connectionProperty : dataSourceNode.get(REAUTHPLUGIN_PROPERTIES.getName()).asPropertyList()) { + writeProperty(writer, dataSourceNode, connectionProperty.getName(), connectionProperty + .getValue().asString(), + org.jboss.jca.common.api.metadata.common.Extension.Tag.CONFIG_PROPERTY + .getLocalName()); + } + } + writer.writeEndElement(); + } + writer.writeEndElement(); + } + boolean validationRequired = VALID_CONNECTION_CHECKER_CLASSNAME.isMarshallable(dataSourceNode) || VALID_CONNECTION_CHECKER_MODULE.isMarshallable(dataSourceNode) || VALID_CONNECTION_CHECKER_PROPERTIES.isMarshallable(dataSourceNode) || diff --git a/connector/src/main/java/org/jboss/as/connector/subsystems/datasources/Namespace.java b/connector/src/main/java/org/jboss/as/connector/subsystems/datasources/Namespace.java index 1c5ed63ede8d..35345e214610 100644 --- a/connector/src/main/java/org/jboss/as/connector/subsystems/datasources/Namespace.java +++ b/connector/src/main/java/org/jboss/as/connector/subsystems/datasources/Namespace.java @@ -32,12 +32,14 @@ public enum Namespace { DATASOURCES_7_0("urn:jboss:domain:datasources:7.0"), - DATASOURCES_7_1("urn:jboss:domain:datasources:7.1"); + DATASOURCES_7_1("urn:jboss:domain:datasources:7.1"), + + DATASOURCES_7_2("urn:jboss:domain:datasources:7.2"); /** * The current namespace version. */ - public static final Namespace CURRENT = DATASOURCES_7_1; + public static final Namespace CURRENT = DATASOURCES_7_2; private final String name; diff --git a/connector/src/main/resources/schema/wildfly-datasources_7_2.xsd b/connector/src/main/resources/schema/wildfly-datasources_7_2.xsd new file mode 100644 index 000000000000..9285f0f9819e --- /dev/null +++ b/connector/src/main/resources/schema/wildfly-datasources_7_2.xsd @@ -0,0 +1,1119 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + jdbc:hsqldb:hsql://localhost:1701 + ]]> + + + + + + + org.hsqldb.jdbcDriver + ]]> + + + + + + + org.h2.jdbcx.JdbcDataSource + ]]> + + + + + + + UTF-8 + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 10 + myhost.mydomain.com + 1557 + mydb + myserver + ]]> + + + + + + + oracle.jdbc.xa.client.OracleXADataSource + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + ]]> + + + + + + + + ]]> + + + + + + + + ]]> + + + + + + + + + + + + ]]> + + + + + + + + + + + + + + + + + + + + + 300 + ]]> + + + + + + + 300 + ]]> + + + + + + + + + + + + + + + + + + + + + 300 + ]]> + + + + + + + + + + + + + + + + + + nowarn + ]]> + + + + + + + + + + + + + + + ]]> + + + + + + + + + + + 1 + ]]> + + + + + + + 1 + ]]> + + + + + + + + + + + + + + true. + Default is false + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ]]> + + + + + + + + + + + + + + + + + + + + true + ]]> + + + + + + + + ]]> + + + + + + + + Ex: + ]]> + + + + + + + true + ]]> + + + + + + + true + ]]> + + + + + + + + + + + + + + HsqlDbRealm + ]]> + + + + + + + + HsqlDbContext + ]]> + + + + + + + + Credential to be used by the configuration. + + + + + + + + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + org.hsqldb.jdbcDriver + ]]> + + + + + + + oracle.jdbc.xa.client.OracleXADataSource + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/connector/src/test/java/org/jboss/as/connector/subsystems/datasources/DatasourcesSubsystemTestCase.java b/connector/src/test/java/org/jboss/as/connector/subsystems/datasources/DatasourcesSubsystemTestCase.java index 685140519589..0f680f46553d 100644 --- a/connector/src/test/java/org/jboss/as/connector/subsystems/datasources/DatasourcesSubsystemTestCase.java +++ b/connector/src/test/java/org/jboss/as/connector/subsystems/datasources/DatasourcesSubsystemTestCase.java @@ -45,12 +45,12 @@ public DatasourcesSubsystemTestCase() { @Override protected String getSubsystemXml() throws IOException { //test configuration put in standalone.xml - return readResource("datasources-minimal.xml"); + return readResource("datasources-full.xml"); } @Override protected String getSubsystemXsdPath() throws Exception { - return "schema/wildfly-datasources_7_1.xsd"; + return "schema/wildfly-datasources_7_2.xsd"; } @Test diff --git a/connector/src/test/resources/org/jboss/as/connector/subsystems/datasources/datasource.xml b/connector/src/test/resources/org/jboss/as/connector/subsystems/datasources/datasource.xml index 12eaa0dda286..a6953516d21c 100644 --- a/connector/src/test/resources/org/jboss/as/connector/subsystems/datasources/datasource.xml +++ b/connector/src/test/resources/org/jboss/as/connector/subsystems/datasources/datasource.xml @@ -3,257 +3,238 @@ ~ SPDX-License-Identifier: Apache-2.0 --> - - - - - jdbc:h2:mem:test;DB_CLOSE_DELAY=-1 - - - org.hsqldb.jdbcDriver - - - org.jboss.as.connector.subsystems.datasources.ModifiableDataSource - - - UTF-8 - - - h2 - - - select 1 - - - TRANSACTION_READ_COMMITTED - - - : - - - someClass - - - - 1 - - - 5 - - - true - - - true - - - true - - - EntirePool - - - - - - sa - - - sa - - - Property1 - - - - - Property2 - - - select 1 - - - true - - - true - - - 2000 - - - true - - - Property3 - - - Property4 - - - - 20000 - 4 - - - 120 - - - 100 - - - 2 - - - 3000 - - - - - 30 - - - nowarn - - - - - jdbc:h2:mem:test - - - org.jboss.as.connector.subsystems.datasources.ModifiableXaDataSource - - - h2 - - - : - - - someClass - - - select 1 - - - TRANSACTION_READ_COMMITTED - - - - 1 - - - 5 - - - true - - - true - - - true - - - EntirePool - - - true - - - - - true - - - true - - - - - sa - - - sa - - - Property1 - - - - - - sa - - - sa - - - - Property5 - Property6 - - - - - Property2 - - - select 1 - - - true - - - true - - - 2000 - - - true - - - Property3 - - - Property4 - - - - 20000 - 4 - - - 120 - - - 100 - - - 2 - - - 3000 - - - 120 - - - - - 30 - - - nowarn - - - - - - org.h2.jdbcx.JdbcDataSource - - - - - + + + + + jdbc:h2:mem:test;DB_CLOSE_DELAY=-1 + + + org.hsqldb.jdbcDriver + + + org.jboss.as.connector.subsystems.datasources.ModifiableDataSource + + + UTF-8 + + + h2 + + + : + + + someClass + + + select 1 + + + TRANSACTION_READ_COMMITTED + + + + 1 + + + 5 + + + true + + + true + + + true + + + EntirePool + + true + + + + Property1 + + + + + Property2 + + + select 1 + + + true + + + true + + + 2000 + + + true + + + Property3 + + + Property4 + + + + true + 20000 + 4 + + 120 + + + 100 + + + 2 + + + 3000 + + + + nowarn + + 30 + + true + + + + + jdbc:h2:mem:test + + + org.jboss.as.connector.subsystems.datasources.ModifiableXaDataSource + + + h2 + + + : + + + someClass + + + select 1 + + + TRANSACTION_READ_COMMITTED + + + + 1 + + + 5 + + + true + + + true + + + true + + + EntirePool + + + true + + true + true + + true + + + true + + + + + + Property5 + Property6 + + + + + Property1 + + + + + Property2 + + + select 1 + + + true + + + true + + + 2000 + + + true + + + Property3 + + + Property4 + + + + true + 20000 + 4 + + 120 + + + 100 + + + 2 + + + 3000 + + + 120 + + + + nowarn + + 30 + + true + + + + + + org.h2.jdbcx.JdbcDataSource + + + + + \ No newline at end of file diff --git a/connector/src/test/resources/org/jboss/as/connector/subsystems/datasources/datasources-elytron-enabled-expression.xml b/connector/src/test/resources/org/jboss/as/connector/subsystems/datasources/datasources-elytron-enabled-expression.xml index 56bebecad383..a7a7b1f4d6a0 100644 --- a/connector/src/test/resources/org/jboss/as/connector/subsystems/datasources/datasources-elytron-enabled-expression.xml +++ b/connector/src/test/resources/org/jboss/as/connector/subsystems/datasources/datasources-elytron-enabled-expression.xml @@ -3,276 +3,276 @@ ~ SPDX-License-Identifier: Apache-2.0 --> - - - - - ${test.expr:token} - ${test.expr:token} - - ${test.expr:token} - - ${test.expr:e gero} - - ${test.expr:token} - - ${test.expr:string} - - ${test.expr:TRANSACTION_REPEATABLE_READ} - - ${test.expr:token} - - ${test.expr:token} - - - - ${test.expr:200} - - ${test.expr:200} - - ${test.expr:200} - - ${test.expr:true} - - ${test.expr:true} - - ${test.expr:EntirePool} - - ${test.expr:true} - - - - ${test.expr:token} - - - - - - - ${test.expr:token} - - - - - ${test.expr:token} - - - - - + + - - ${test.expr:token} - - - ${test.expr:true} - - - - - - - ${test.expr:token} - - - ${test.expr:string} - - ${test.expr:true} - - ${test.expr:true} - - ${test.expr:200} - - ${test.expr:false} - - - - ${test.expr:token} - - - - - ${test.expr:token} - - - - - - ${test.expr:true} - - ${test.expr:200} - - ${test.expr:200} - - ${test.expr:200} - - ${test.expr:200} - - ${test.expr:200} - - ${test.expr:200} - - - - - ${test.expr:false} - - ${test.expr:200} - - ${test.expr:true} - - - - - ${test.expr:per turbine} - - ${test.expr:token} - - ${test.expr:token} - - ${test.expr:token} - - ${test.expr:token} - - ${test.expr:string} - - ${test.expr:TRANSACTION_SERIALIZABLE} - - - - ${test.expr:200} - - ${test.expr:200} - - ${test.expr:200} - - ${test.expr:false} - - ${test.expr:true} - - ${test.expr:EntirePool} - - ${test.expr:true} - - - - ${test.expr:token} - - - - - - - ${test.expr:token} - - - + + ${test.expr:token} + ${test.expr:token} + + ${test.expr:token} - ${test.expr:token} - - - - ${test.expr:false} - - ${test.expr:true} - - ${test.expr:true} - - ${test.expr:false} - - ${test.expr:false} - - - - ${test.expr:true} - - - - ${test.expr:token} - - - - - - - ${test.expr:true} - CredentialAuthCtxt - - - - - - ${test.expr:token} - - - - - - - - ${test.expr:token} - - - ${test.expr:string} - - ${test.expr:false} - - ${test.expr:false} - - ${test.expr:200} - - ${test.expr:true} - - - - ${test.expr:token} - - - - - ${test.expr:token} - - - - - - ${test.expr:true} - - ${test.expr:200} - - ${test.expr:200} - - ${test.expr:200} - - ${test.expr:200} - - ${test.expr:200} - - ${test.expr:200} - - ${test.expr:200} - - - - - ${test.expr:nowarn} - - ${test.expr:200} - - ${test.expr:true} - - - - - - - - ${test.expr:token} - - ${test.expr:token} - - ${test.expr:token} - - - + ${test.expr:e gero} + + ${test.expr:token} + + ${test.expr:token} + + ${test.expr:token} + + ${test.expr:string} + + ${test.expr:TRANSACTION_REPEATABLE_READ} + + + + ${test.expr:200} + + ${test.expr:200} + + ${test.expr:200} + + ${test.expr:true} + + ${test.expr:true} + + ${test.expr:EntirePool} + + ${test.expr:true} + + + + ${test.expr:token} + + + + + + + ${test.expr:token} + + + + + ${test.expr:token} + + + + + + + + ${test.expr:token} + + + ${test.expr:true} + + + + + + + ${test.expr:token} + + + ${test.expr:string} + + ${test.expr:true} + + ${test.expr:true} + + ${test.expr:200} + + ${test.expr:false} + + + + ${test.expr:token} + + + + + ${test.expr:token} + + + + + + ${test.expr:true} + + ${test.expr:200} + + ${test.expr:200} + + ${test.expr:200} + + ${test.expr:200} + + ${test.expr:200} + + ${test.expr:200} + + + + + ${test.expr:false} + + ${test.expr:200} + + ${test.expr:true} + + + + + ${test.expr:per turbine} + + ${test.expr:token} + + ${test.expr:token} + + ${test.expr:token} + + ${test.expr:token} + + ${test.expr:string} + + ${test.expr:TRANSACTION_SERIALIZABLE} + + + + ${test.expr:200} + + ${test.expr:200} + + ${test.expr:200} + + ${test.expr:false} + + ${test.expr:true} + + ${test.expr:EntirePool} + + ${test.expr:true} + + + + ${test.expr:token} + + + + + + + ${test.expr:token} + + + + + ${test.expr:token} + + + + ${test.expr:false} + + ${test.expr:true} + + ${test.expr:true} + + ${test.expr:false} + + ${test.expr:false} + + + + + + CredentialAuthCtxt + + ${test.expr:true} + + + + + ${test.expr:token} + + + + + ${test.expr:true} + + + + ${test.expr:token} + + + + + + + + ${test.expr:token} + + + ${test.expr:string} + + ${test.expr:false} + + ${test.expr:false} + + ${test.expr:200} + + ${test.expr:true} + + + + ${test.expr:token} + + + + + ${test.expr:token} + + + + + + ${test.expr:true} + + ${test.expr:200} + + ${test.expr:200} + + ${test.expr:200} + + ${test.expr:200} + + ${test.expr:200} + + ${test.expr:200} + + ${test.expr:200} + + + + + ${test.expr:nowarn} + + ${test.expr:200} + + ${test.expr:true} + + + + + + + + ${test.expr:token} + + ${test.expr:token} + + ${test.expr:token} + + + diff --git a/connector/src/test/resources/org/jboss/as/connector/subsystems/datasources/datasources-elytron-enabled.xml b/connector/src/test/resources/org/jboss/as/connector/subsystems/datasources/datasources-elytron-enabled.xml index d71da28e4089..6abbfac39f17 100644 --- a/connector/src/test/resources/org/jboss/as/connector/subsystems/datasources/datasources-elytron-enabled.xml +++ b/connector/src/test/resources/org/jboss/as/connector/subsystems/datasources/datasources-elytron-enabled.xml @@ -3,277 +3,277 @@ ~ SPDX-License-Identifier: Apache-2.0 --> - - - - - token - - token - - token - - e gero - - token - - string - - TRANSACTION_REPEATABLE_READ - - token - - token - - - - 200 - - 200 - - 200 - - true - - true - - EntirePool - - true - - - - token - - - - - - - token - - - - - token - - - - - + + - - token - - - true - - - - - - - token - - - string - - true - - true - - 200 - - false - - - - token - - - - - token - - - - - - true - - 200 - - 200 - - 200 - - 200 - - 200 - - 200 - - - - - false - - 200 - - true - - - - - per turbine - - token - - token - - token - - token - - string - - TRANSACTION_SERIALIZABLE - - - - 200 - - 200 - - 200 - - false - - true - - EntirePool - - true - - - - token - - - - - - - token - - - + + token + + token + + token - token - - - - false - - true - - true - - false - - false - - - - true - - - - token - - - - - - - true - CredentialAuthCtxt - - - - - - token - - - - - - - - token - - - string - - false - - false - - 200 - - true - - - - token - - - - - token - - - - - - true - - 200 - - 200 - - 200 - - 200 - - 200 - - 200 - - 200 - - - - - nowarn - - 200 - - true - - - - - - - - token - - token - - token - - - + e gero + + token + + token + + token + + string + + TRANSACTION_REPEATABLE_READ + + + + 200 + + 200 + + 200 + + true + + true + + EntirePool + + true + + + + token + + + + + + + token + + + + + token + + + + + + + + token + + + true + + + + + + + token + + + string + + true + + true + + 200 + + false + + + + token + + + + + token + + + + + + true + + 200 + + 200 + + 200 + + 200 + + 200 + + 200 + + + + + false + + 200 + + true + + + + + per turbine + + token + + token + + token + + token + + string + + TRANSACTION_SERIALIZABLE + + + + 200 + + 200 + + 200 + + false + + true + + EntirePool + + true + + + + token + + + + + + + token + + + + + token + + + + false + + true + + true + + false + + false + + + + + + CredentialAuthCtxt + + true + + + + + token + + + + + true + + + + token + + + + + + + + token + + + string + + false + + false + + 200 + + true + + + + token + + + + + token + + + + + + true + + 200 + + 200 + + 200 + + 200 + + 200 + + 200 + + 200 + + + + + nowarn + + 200 + + true + + + + + + + + token + + token + + token + + + diff --git a/connector/src/test/resources/org/jboss/as/connector/subsystems/datasources/datasources-full-expression.xml b/connector/src/test/resources/org/jboss/as/connector/subsystems/datasources/datasources-full-expression.xml index 5f05f415dd8b..a8c9f3dda8bd 100644 --- a/connector/src/test/resources/org/jboss/as/connector/subsystems/datasources/datasources-full-expression.xml +++ b/connector/src/test/resources/org/jboss/as/connector/subsystems/datasources/datasources-full-expression.xml @@ -3,7 +3,7 @@ ~ SPDX-License-Identifier: Apache-2.0 --> - + ${test.expr:h2} - - ${test.expr:select 1} - - - ${test.expr:TRANSACTION_READ_COMMITTED} - ${test.expr::} ${test.expr:someClass} + + ${test.expr:select 1} + + + ${test.expr:TRANSACTION_READ_COMMITTED} + ${test.expr:1} ${test.expr:5} @@ -161,11 +161,6 @@ - - - ${test.expr:Property1} - - @@ -173,6 +168,11 @@ ${test.expr:Property6} + + + ${test.expr:Property1} + + ${test.expr:Property2} diff --git a/connector/src/test/resources/org/jboss/as/connector/subsystems/datasources/datasources-full.xml b/connector/src/test/resources/org/jboss/as/connector/subsystems/datasources/datasources-full.xml index 4721da7ad997..b1445948801b 100644 --- a/connector/src/test/resources/org/jboss/as/connector/subsystems/datasources/datasources-full.xml +++ b/connector/src/test/resources/org/jboss/as/connector/subsystems/datasources/datasources-full.xml @@ -3,7 +3,7 @@ ~ SPDX-License-Identifier: Apache-2.0 --> - + @@ -22,18 +22,18 @@ h2 - - select 1 - - - TRANSACTION_READ_COMMITTED - : someClass + + select 1 + + + TRANSACTION_READ_COMMITTED + 1 5 @@ -103,7 +103,6 @@ nowarn 30 true - true - - - - Property1 - - @@ -171,6 +164,11 @@ Property6 + + + Property1 + + Property2 diff --git a/connector/src/test/resources/org/jboss/as/connector/subsystems/datasources/datasources-minimal.xml b/connector/src/test/resources/org/jboss/as/connector/subsystems/datasources/datasources-minimal.xml index f14e6211e574..bbfd27a2ab26 100644 --- a/connector/src/test/resources/org/jboss/as/connector/subsystems/datasources/datasources-minimal.xml +++ b/connector/src/test/resources/org/jboss/as/connector/subsystems/datasources/datasources-minimal.xml @@ -3,7 +3,7 @@ ~ SPDX-License-Identifier: Apache-2.0 --> - + diff --git a/connector/src/test/resources/org/jboss/as/connector/subsystems/datasources/datasources-validation-custom-modules-reject.xml b/connector/src/test/resources/org/jboss/as/connector/subsystems/datasources/datasources-validation-custom-modules-reject.xml index b9cde64b82f8..2566ac7f3df6 100644 --- a/connector/src/test/resources/org/jboss/as/connector/subsystems/datasources/datasources-validation-custom-modules-reject.xml +++ b/connector/src/test/resources/org/jboss/as/connector/subsystems/datasources/datasources-validation-custom-modules-reject.xml @@ -3,16 +3,13 @@ ~ SPDX-License-Identifier: Apache-2.0 --> - + jdbc:h2:mem:test;DB_CLOSE_DELAY=-1 h2 - - sa - sa - + @@ -28,10 +25,7 @@ org.jboss.as.connector.subsystems.datasources.ModifiableXaDataSource h2 - - sa - sa - + diff --git a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/DataSourceCfgMetricUnitTestCase.java b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/DataSourceCfgMetricUnitTestCase.java index be4500da66a6..8d9040c38128 100644 --- a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/DataSourceCfgMetricUnitTestCase.java +++ b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/DataSourceCfgMetricUnitTestCase.java @@ -91,7 +91,7 @@ public void testWrongAllocRetryWaitProperty() throws Exception { @Test public void testStatementDefaultProperties() throws Exception { setModel("statement-properties.xml"); - assertEquals("NOWARN", readAttribute(baseAddress, "track-statements").asString()); + assertEquals("nowarn", readAttribute(baseAddress, "track-statements").asString()); assertFalse(readAttribute(baseAddress, "share-prepared-statements").asBoolean()); removeDs(); } diff --git a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/basic-attributes.xml b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/basic-attributes.xml index 7bb2ffa0c6f4..05a261e91846 100644 --- a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/basic-attributes.xml +++ b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/basic-attributes.xml @@ -3,7 +3,7 @@ ~ SPDX-License-Identifier: Apache-2.0 --> - + diff --git a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/complex-driver.xml b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/complex-driver.xml index 6a4793a062f4..e0e28b7212e6 100644 --- a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/complex-driver.xml +++ b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/complex-driver.xml @@ -3,7 +3,7 @@ ~ SPDX-License-Identifier: Apache-2.0 --> - + diff --git a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/empty-driver.xml b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/empty-driver.xml index f85727583594..90fb960c6f48 100644 --- a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/empty-driver.xml +++ b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/empty-driver.xml @@ -3,7 +3,7 @@ ~ SPDX-License-Identifier: Apache-2.0 --> - + diff --git a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/pool-properties.xml b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/pool-properties.xml index abab5d31ae9e..973d86823028 100644 --- a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/pool-properties.xml +++ b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/pool-properties.xml @@ -3,7 +3,7 @@ ~ SPDX-License-Identifier: Apache-2.0 --> - + diff --git a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/statement-properties.xml b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/statement-properties.xml index 2415c4d617d0..e1003097f1b2 100644 --- a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/statement-properties.xml +++ b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/statement-properties.xml @@ -3,7 +3,7 @@ ~ SPDX-License-Identifier: Apache-2.0 --> - + diff --git a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/timeout-properties.xml b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/timeout-properties.xml index f4b66ad8bb6a..b9847bca1e60 100644 --- a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/timeout-properties.xml +++ b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/timeout-properties.xml @@ -3,7 +3,7 @@ ~ SPDX-License-Identifier: Apache-2.0 --> - + diff --git a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/validation-properties.xml b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/validation-properties.xml index faec843ed6d4..d9e915d0d34b 100644 --- a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/validation-properties.xml +++ b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/validation-properties.xml @@ -3,7 +3,7 @@ ~ SPDX-License-Identifier: Apache-2.0 --> - + diff --git a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-2-driver-classes.xml b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-2-driver-classes.xml index 300797fdfa2a..8c4194f94fb0 100644 --- a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-2-driver-classes.xml +++ b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-2-driver-classes.xml @@ -3,7 +3,7 @@ ~ SPDX-License-Identifier: Apache-2.0 --> - + diff --git a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-2-ds-classes-driver.xml b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-2-ds-classes-driver.xml index f0c5984ab733..c1b88ea0c5bd 100644 --- a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-2-ds-classes-driver.xml +++ b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-2-ds-classes-driver.xml @@ -3,7 +3,7 @@ ~ SPDX-License-Identifier: Apache-2.0 --> - + diff --git a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-2-xa-ds-classes-driver.xml b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-2-xa-ds-classes-driver.xml index 4e601d77489b..a5f7543a3cae 100644 --- a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-2-xa-ds-classes-driver.xml +++ b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-2-xa-ds-classes-driver.xml @@ -3,7 +3,7 @@ ~ SPDX-License-Identifier: Apache-2.0 --> - + diff --git a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-alloc-retry-property.xml b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-alloc-retry-property.xml index 86a65efd7dc9..65b2d5f7cfdc 100644 --- a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-alloc-retry-property.xml +++ b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-alloc-retry-property.xml @@ -3,7 +3,7 @@ ~ SPDX-License-Identifier: Apache-2.0 --> - + diff --git a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-alloc-retry-wait-property.xml b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-alloc-retry-wait-property.xml index 9e3f96b860f7..259e3262fcf7 100644 --- a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-alloc-retry-wait-property.xml +++ b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-alloc-retry-wait-property.xml @@ -3,7 +3,7 @@ ~ SPDX-License-Identifier: Apache-2.0 --> - + diff --git a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-blckg-timeout-property.xml b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-blckg-timeout-property.xml index 1823259caaa0..6b2b1d1725ed 100644 --- a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-blckg-timeout-property.xml +++ b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-blckg-timeout-property.xml @@ -3,7 +3,7 @@ ~ SPDX-License-Identifier: Apache-2.0 --> - + diff --git a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-empty-name-driver.xml b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-empty-name-driver.xml index 8389ac53c2ae..7e51f45f5a3e 100644 --- a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-empty-name-driver.xml +++ b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-empty-name-driver.xml @@ -3,7 +3,7 @@ ~ SPDX-License-Identifier: Apache-2.0 --> - + diff --git a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-flush-strategy-property.xml b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-flush-strategy-property.xml index 4f5f68122b8f..a1c75bb77881 100644 --- a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-flush-strategy-property.xml +++ b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-flush-strategy-property.xml @@ -3,7 +3,7 @@ ~ SPDX-License-Identifier: Apache-2.0 --> - + diff --git a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-idle-mins-property.xml b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-idle-mins-property.xml index f60e830b0346..d772ed05b93c 100644 --- a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-idle-mins-property.xml +++ b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-idle-mins-property.xml @@ -3,7 +3,7 @@ ~ SPDX-License-Identifier: Apache-2.0 --> - + diff --git a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-max-less-min-pool-size-propertiy.xml b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-max-less-min-pool-size-propertiy.xml index 0a4d68261e4c..3026c6e04c90 100644 --- a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-max-less-min-pool-size-propertiy.xml +++ b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-max-less-min-pool-size-propertiy.xml @@ -3,7 +3,7 @@ ~ SPDX-License-Identifier: Apache-2.0 --> - + diff --git a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-max-pool-size-propertiy.xml b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-max-pool-size-propertiy.xml index e463d57e7430..98eafaf4cc26 100644 --- a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-max-pool-size-propertiy.xml +++ b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-max-pool-size-propertiy.xml @@ -3,7 +3,7 @@ ~ SPDX-License-Identifier: Apache-2.0 --> - + diff --git a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-min-pool-size-propertiy.xml b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-min-pool-size-propertiy.xml index 5adbc1eccf3b..29bc23cfeed8 100644 --- a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-min-pool-size-propertiy.xml +++ b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-min-pool-size-propertiy.xml @@ -3,7 +3,7 @@ ~ SPDX-License-Identifier: Apache-2.0 --> - + diff --git a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-no-driver.xml b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-no-driver.xml index d5925a20b27a..f1cb96ef76bf 100644 --- a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-no-driver.xml +++ b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-no-driver.xml @@ -3,7 +3,7 @@ ~ SPDX-License-Identifier: Apache-2.0 --> - + diff --git a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-no-xa-ds-properties.xml b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-no-xa-ds-properties.xml index 039216e7b7ed..f74703a4a63a 100644 --- a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-no-xa-ds-properties.xml +++ b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-no-xa-ds-properties.xml @@ -3,7 +3,7 @@ ~ SPDX-License-Identifier: Apache-2.0 --> - + diff --git a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-stmt-cache-size-property.xml b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-stmt-cache-size-property.xml index e9178941b1e3..1c2b8b2839a0 100644 --- a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-stmt-cache-size-property.xml +++ b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-stmt-cache-size-property.xml @@ -3,7 +3,7 @@ ~ SPDX-License-Identifier: Apache-2.0 --> - + diff --git a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-transaction-isolation-type.xml b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-transaction-isolation-type.xml index f4b99b58cd7f..5db804e44b33 100644 --- a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-transaction-isolation-type.xml +++ b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-transaction-isolation-type.xml @@ -3,7 +3,7 @@ ~ SPDX-License-Identifier: Apache-2.0 --> - + diff --git a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-trck-stmt-property.xml b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-trck-stmt-property.xml index e7254955550b..ab1ec571d889 100644 --- a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-trck-stmt-property.xml +++ b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-trck-stmt-property.xml @@ -3,7 +3,7 @@ ~ SPDX-License-Identifier: Apache-2.0 --> - + diff --git a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-validation-properties.xml b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-validation-properties.xml index 6507e1e2bd85..c5e3d7ed8852 100644 --- a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-validation-properties.xml +++ b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-validation-properties.xml @@ -3,7 +3,7 @@ ~ SPDX-License-Identifier: Apache-2.0 --> - + diff --git a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-wo-name-driver.xml b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-wo-name-driver.xml index 8e0e63ed9d11..c5a9e467f055 100644 --- a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-wo-name-driver.xml +++ b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-wo-name-driver.xml @@ -3,7 +3,7 @@ ~ SPDX-License-Identifier: Apache-2.0 --> - + diff --git a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-xa-2-security-domains.xml b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-xa-2-security-domains.xml index d82eb16f302f..5ef41fa34007 100644 --- a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-xa-2-security-domains.xml +++ b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-xa-2-security-domains.xml @@ -3,7 +3,7 @@ ~ SPDX-License-Identifier: Apache-2.0 --> - + mydb diff --git a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-xa-bogus-driver.xml b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-xa-bogus-driver.xml index 545bb56e77c0..e35c37780a38 100644 --- a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-xa-bogus-driver.xml +++ b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-xa-bogus-driver.xml @@ -3,7 +3,7 @@ ~ SPDX-License-Identifier: Apache-2.0 --> - + mydb diff --git a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-xa-res-timeout-property.xml b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-xa-res-timeout-property.xml index 3a7dafa272fc..5c26fb26b0f9 100644 --- a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-xa-res-timeout-property.xml +++ b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/wrong-xa-res-timeout-property.xml @@ -3,7 +3,7 @@ ~ SPDX-License-Identifier: Apache-2.0 --> - + mydb diff --git a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/xa-basic-attributes.xml b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/xa-basic-attributes.xml index 57612bc121af..736087cf3d95 100644 --- a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/xa-basic-attributes.xml +++ b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/xa-basic-attributes.xml @@ -3,7 +3,7 @@ ~ SPDX-License-Identifier: Apache-2.0 --> - + mydb diff --git a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/xa-bool-pres-properties.xml b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/xa-bool-pres-properties.xml index 39b47bef5330..b9a06338def8 100644 --- a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/xa-bool-pres-properties.xml +++ b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/xa-bool-pres-properties.xml @@ -3,7 +3,7 @@ ~ SPDX-License-Identifier: Apache-2.0 --> - + mydb diff --git a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/xa-default-properties.xml b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/xa-default-properties.xml index bf532f1c152a..4e9376bf89e1 100644 --- a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/xa-default-properties.xml +++ b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/xa-default-properties.xml @@ -3,7 +3,7 @@ ~ SPDX-License-Identifier: Apache-2.0 --> - + mydb diff --git a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/xa-false-bool-pres-properties.xml b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/xa-false-bool-pres-properties.xml index af7987144cf4..e4de21e9b4b1 100644 --- a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/xa-false-bool-pres-properties.xml +++ b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/xa-false-bool-pres-properties.xml @@ -3,21 +3,21 @@ ~ SPDX-License-Identifier: Apache-2.0 --> - + mydb h2 - false false + false - - false - false + + false + diff --git a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/xa-true-bool-pres-properties.xml b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/xa-true-bool-pres-properties.xml index 788fd6b0ecf5..91bda24a5a78 100644 --- a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/xa-true-bool-pres-properties.xml +++ b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/data-sources/xa-true-bool-pres-properties.xml @@ -3,21 +3,21 @@ ~ SPDX-License-Identifier: Apache-2.0 --> - + mydb h2 - true true + true - - true - true + + true + From 95eb7221b5ba30239b252d8f7f1572498fc90e07 Mon Sep 17 00:00:00 2001 From: Michal Petrov Date: Thu, 11 Jul 2024 16:51:45 +0200 Subject: [PATCH 2/2] WFLY-19304: refactor schema and writer --- .../datasources/DataSourcesExtension.java | 179 ++++----- .../schema/wildfly-datasources_7_2.xsd | 355 +++++++----------- 2 files changed, 200 insertions(+), 334 deletions(-) diff --git a/connector/src/main/java/org/jboss/as/connector/subsystems/datasources/DataSourcesExtension.java b/connector/src/main/java/org/jboss/as/connector/subsystems/datasources/DataSourcesExtension.java index f121cc2628cf..8bdd63b303f5 100644 --- a/connector/src/main/java/org/jboss/as/connector/subsystems/datasources/DataSourcesExtension.java +++ b/connector/src/main/java/org/jboss/as/connector/subsystems/datasources/DataSourcesExtension.java @@ -105,11 +105,13 @@ import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.OP_ADDR; import static org.jboss.as.controller.parsing.ParseUtils.requireNoContent; +import java.util.Arrays; import java.util.List; import javax.xml.stream.XMLStreamConstants; import javax.xml.stream.XMLStreamException; +import org.jboss.as.controller.AttributeDefinition; import org.jboss.as.controller.Extension; import org.jboss.as.controller.ExtensionContext; import org.jboss.as.controller.ModelVersion; @@ -194,6 +196,35 @@ public static final class DataSourceSubsystemParser implements XMLStreamConstant XMLElementWriter { + private static final SimpleAttributeDefinition[] COMMON_SIMPLE_DS_ATTRIBUTES = { + DATASOURCE_DRIVER, URL_DELIMITER, URL_SELECTOR_STRATEGY_CLASS_NAME, NEW_CONNECTION_SQL, TRANSACTION_ISOLATION + }; + + private static final SimpleAttributeDefinition[] POOL_ATTRIBUTES = { + MIN_POOL_SIZE, INITIAL_POOL_SIZE, MAX_POOL_SIZE, POOL_PREFILL, POOL_FAIR, POOL_USE_STRICT_MIN, POOL_FLUSH_STRATEGY, ALLOW_MULTIPLE_USERS + }; + + private static final SimpleAttributeDefinition[] XA_POOL_ATTRIBUTES = { + SAME_RM_OVERRIDE, INTERLEAVING, NO_TX_SEPARATE_POOL, PAD_XID, WRAP_XA_RESOURCE + }; + + private static final SimpleAttributeDefinition[] TIMEOUT_ATTRIBUTES = { + SET_TX_QUERY_TIMEOUT, BLOCKING_TIMEOUT_WAIT_MILLIS, IDLETIMEOUTMINUTES, QUERY_TIMEOUT, USE_TRY_LOCK, + ALLOCATION_RETRY, ALLOCATION_RETRY_WAIT_MILLIS, XA_RESOURCE_TIMEOUT + }; + + private static final SimpleAttributeDefinition[] RECOVERY_ATTRIBUTES = { + RECOVERY_SECURITY_DOMAIN, RECOVERY_AUTHENTICATION_CONTEXT, RECOVERY_CREDENTIAL_REFERENCE, RECOVERY_ELYTRON_ENABLED + }; + + private static final SimpleAttributeDefinition[] SECURITY_ATTRIBUTES = { + SECURITY_DOMAIN, AUTHENTICATION_CONTEXT, CREDENTIAL_REFERENCE, ELYTRON_ENABLED + }; + + private static final SimpleAttributeDefinition[] STATEMENT_ATTRIBUTES = { + TRACK_STATEMENTS, PREPARED_STATEMENTS_CACHE_SIZE, SHARE_PREPARED_STATEMENTS + }; + /** * {@inheritDoc} */ @@ -264,9 +295,7 @@ private void writeDS(XMLExtendedStreamWriter writer, boolean isXADataSource, Mod STATISTICS_ENABLED.marshallAsAttribute(dataSourceNode, writer); if (!isXADataSource) { - CONNECTION_URL.marshallAsElement(dataSourceNode, writer); - DRIVER_CLASS.marshallAsElement(dataSourceNode, writer); - DATASOURCE_CLASS.marshallAsElement(dataSourceNode, writer); + marshallAsElements(dataSourceNode, writer, CONNECTION_URL, DRIVER_CLASS, DATASOURCE_CLASS); if (dataSourceNode.hasDefined(CONNECTION_PROPERTIES.getName())) { for (Property connectionProperty : dataSourceNode.get(CONNECTION_PROPERTIES.getName()).asPropertyList()) { writeProperty(writer, dataSourceNode, connectionProperty.getName(), connectionProperty @@ -282,49 +311,24 @@ private void writeDS(XMLExtendedStreamWriter writer, boolean isXADataSource, Mod } } - XA_DATASOURCE_CLASS.marshallAsElement(dataSourceNode, writer); - URL_PROPERTY.marshallAsElement(dataSourceNode, writer); + marshallAsElements(dataSourceNode, writer, XA_DATASOURCE_CLASS, URL_PROPERTY); } - DATASOURCE_DRIVER.marshallAsElement(dataSourceNode, writer); - URL_DELIMITER.marshallAsElement(dataSourceNode, writer); - URL_SELECTOR_STRATEGY_CLASS_NAME.marshallAsElement(dataSourceNode, writer); - NEW_CONNECTION_SQL.marshallAsElement(dataSourceNode, writer); - TRANSACTION_ISOLATION.marshallAsElement(dataSourceNode, writer); - - boolean poolRequired = INITIAL_POOL_SIZE.isMarshallable(dataSourceNode) || - MIN_POOL_SIZE.isMarshallable(dataSourceNode) || - MAX_POOL_SIZE.isMarshallable(dataSourceNode) || - POOL_PREFILL.isMarshallable(dataSourceNode) || - POOL_FAIR.isMarshallable(dataSourceNode) || - POOL_USE_STRICT_MIN.isMarshallable(dataSourceNode) || - POOL_FLUSH_STRATEGY.isMarshallable(dataSourceNode) || - ALLOW_MULTIPLE_USERS.isMarshallable(dataSourceNode) || + marshallAsElements(dataSourceNode, writer, COMMON_SIMPLE_DS_ATTRIBUTES); + + boolean poolRequired = isAnyRequired(dataSourceNode, POOL_ATTRIBUTES) || CONNECTION_LISTENER_CLASS.isMarshallable(dataSourceNode) || CONNECTION_LISTENER_PROPERTIES.isMarshallable(dataSourceNode); if (isXADataSource) { - poolRequired = poolRequired - || SAME_RM_OVERRIDE.isMarshallable(dataSourceNode) || - INTERLEAVING.isMarshallable(dataSourceNode) || - NO_TX_SEPARATE_POOL.isMarshallable(dataSourceNode) || - PAD_XID.isMarshallable(dataSourceNode) || - WRAP_XA_RESOURCE.isMarshallable(dataSourceNode); + poolRequired = poolRequired || isAnyRequired(dataSourceNode, XA_POOL_ATTRIBUTES); } - final boolean capacityRequired = CAPACITY_INCREMENTER_CLASS.isMarshallable(dataSourceNode) || - CAPACITY_INCREMENTER_PROPERTIES.isMarshallable(dataSourceNode) || - CAPACITY_DECREMENTER_CLASS.isMarshallable(dataSourceNode) || - CAPACITY_DECREMENTER_PROPERTIES.isMarshallable(dataSourceNode); + + final boolean capacityRequired = isAnyRequired(dataSourceNode, CAPACITY_INCREMENTER_CLASS, + CAPACITY_INCREMENTER_PROPERTIES, CAPACITY_DECREMENTER_CLASS, CAPACITY_DECREMENTER_PROPERTIES); poolRequired = poolRequired || capacityRequired; if (poolRequired) { writer.writeStartElement(isXADataSource ? XaDataSource.Tag.XA_POOL.getLocalName() : DataSource.Tag.POOL .getLocalName()); - MIN_POOL_SIZE.marshallAsElement(dataSourceNode, writer); - INITIAL_POOL_SIZE.marshallAsElement(dataSourceNode, writer); - MAX_POOL_SIZE.marshallAsElement(dataSourceNode, writer); - POOL_PREFILL.marshallAsElement(dataSourceNode, writer); - POOL_FAIR.marshallAsElement(dataSourceNode, writer); - POOL_USE_STRICT_MIN.marshallAsElement(dataSourceNode, writer); - POOL_FLUSH_STRATEGY.marshallAsElement(dataSourceNode, writer); - ALLOW_MULTIPLE_USERS.marshallAsElement(dataSourceNode, writer); + marshallAsElements(dataSourceNode, writer, POOL_ATTRIBUTES); if (dataSourceNode.hasDefined(CONNECTION_LISTENER_CLASS.getName())) { writer.writeStartElement(DsPool.Tag.CONNECTION_LISTENER.getLocalName()); @@ -344,43 +348,30 @@ private void writeDS(XMLExtendedStreamWriter writer, boolean isXADataSource, Mod writer.writeEndElement(); } - if (capacityRequired) { writer.writeStartElement(DsPool.Tag.CAPACITY.getLocalName()); if (dataSourceNode.hasDefined(CAPACITY_INCREMENTER_CLASS.getName())) { writer.writeStartElement(Capacity.Tag.INCREMENTER.getLocalName()); CAPACITY_INCREMENTER_CLASS.marshallAsAttribute(dataSourceNode, writer); CAPACITY_INCREMENTER_PROPERTIES.marshallAsElement(dataSourceNode, writer); - writer.writeEndElement(); } if (dataSourceNode.hasDefined(CAPACITY_DECREMENTER_CLASS.getName())) { writer.writeStartElement(Capacity.Tag.DECREMENTER.getLocalName()); CAPACITY_DECREMENTER_CLASS.marshallAsAttribute(dataSourceNode, writer); CAPACITY_DECREMENTER_PROPERTIES.marshallAsElement(dataSourceNode, writer); - writer.writeEndElement(); } writer.writeEndElement(); } if (isXADataSource) { - SAME_RM_OVERRIDE.marshallAsElement(dataSourceNode, writer); - INTERLEAVING.marshallAsElement(dataSourceNode, writer); - NO_TX_SEPARATE_POOL.marshallAsElement(dataSourceNode, writer); - PAD_XID.marshallAsElement(dataSourceNode, writer); - WRAP_XA_RESOURCE.marshallAsElement(dataSourceNode, writer); + marshallAsElements(dataSourceNode, writer, XA_POOL_ATTRIBUTES); } writer.writeEndElement(); } - - boolean recoveryRequired = RECOVERY_USERNAME.isMarshallable(dataSourceNode) || - RECOVERY_PASSWORD.isMarshallable(dataSourceNode) || - RECOVERY_SECURITY_DOMAIN.isMarshallable(dataSourceNode) || - RECOVERY_ELYTRON_ENABLED.isMarshallable(dataSourceNode) || - RECOVER_PLUGIN_CLASSNAME.isMarshallable(dataSourceNode) || - RECOVERY_CREDENTIAL_REFERENCE.isMarshallable(dataSourceNode) || - NO_RECOVERY.isMarshallable(dataSourceNode) || - RECOVER_PLUGIN_PROPERTIES.isMarshallable(dataSourceNode); + boolean recoveryRequired = isAnyRequired(dataSourceNode, RECOVERY_USERNAME, RECOVERY_PASSWORD, + RECOVERY_SECURITY_DOMAIN, RECOVERY_ELYTRON_ENABLED, RECOVER_PLUGIN_CLASSNAME, + RECOVERY_CREDENTIAL_REFERENCE, NO_RECOVERY, RECOVER_PLUGIN_PROPERTIES); if (recoveryRequired && isXADataSource) { writer.writeStartElement(XaDataSource.Tag.RECOVERY.getLocalName()); NO_RECOVERY.marshallAsAttribute(dataSourceNode, writer); @@ -388,10 +379,7 @@ private void writeDS(XMLExtendedStreamWriter writer, boolean isXADataSource, Mod writer.writeStartElement(Recovery.Tag.RECOVER_CREDENTIAL.getLocalName()); RECOVERY_USERNAME.marshallAsAttribute(dataSourceNode, writer); RECOVERY_PASSWORD.marshallAsAttribute(dataSourceNode, writer); - RECOVERY_AUTHENTICATION_CONTEXT.marshallAsElement(dataSourceNode, writer); - RECOVERY_SECURITY_DOMAIN.marshallAsElement(dataSourceNode, writer); - RECOVERY_CREDENTIAL_REFERENCE.marshallAsElement(dataSourceNode, writer); - RECOVERY_ELYTRON_ENABLED.marshallAsElement(dataSourceNode, writer); + marshallAsElements(dataSourceNode, writer, RECOVERY_ATTRIBUTES); writer.writeEndElement(); } if (hasAnyOf(dataSourceNode, RECOVER_PLUGIN_CLASSNAME)) { @@ -412,22 +400,13 @@ private void writeDS(XMLExtendedStreamWriter writer, boolean isXADataSource, Mod } writer.writeEndElement(); } - - boolean securityRequired = USERNAME.isMarshallable(dataSourceNode) || - PASSWORD.isMarshallable(dataSourceNode) || - CREDENTIAL_REFERENCE.isMarshallable(dataSourceNode) || - SECURITY_DOMAIN.isMarshallable(dataSourceNode) || - ELYTRON_ENABLED.isMarshallable(dataSourceNode) || - REAUTH_PLUGIN_CLASSNAME.isMarshallable(dataSourceNode) || - REAUTHPLUGIN_PROPERTIES.isMarshallable(dataSourceNode); + boolean securityRequired = isAnyRequired(dataSourceNode, USERNAME, PASSWORD, CREDENTIAL_REFERENCE, + SECURITY_DOMAIN, ELYTRON_ENABLED, REAUTH_PLUGIN_CLASSNAME, REAUTHPLUGIN_PROPERTIES); if (securityRequired) { writer.writeStartElement(DataSource.Tag.SECURITY.getLocalName()); USERNAME.marshallAsAttribute(dataSourceNode, writer); PASSWORD.marshallAsAttribute(dataSourceNode, writer); - SECURITY_DOMAIN.marshallAsElement(dataSourceNode, writer); - AUTHENTICATION_CONTEXT.marshallAsElement(dataSourceNode, writer); - CREDENTIAL_REFERENCE.marshallAsElement(dataSourceNode, writer); - ELYTRON_ENABLED.marshallAsElement(dataSourceNode, writer); + marshallAsElements(dataSourceNode, writer, SECURITY_ATTRIBUTES); if (dataSourceNode.hasDefined(REAUTH_PLUGIN_CLASSNAME.getName())) { writer.writeStartElement(DsSecurity.Tag.REAUTH_PLUGIN.getLocalName()); @@ -448,20 +427,11 @@ private void writeDS(XMLExtendedStreamWriter writer, boolean isXADataSource, Mod writer.writeEndElement(); } - boolean validationRequired = VALID_CONNECTION_CHECKER_CLASSNAME.isMarshallable(dataSourceNode) || - VALID_CONNECTION_CHECKER_MODULE.isMarshallable(dataSourceNode) || - VALID_CONNECTION_CHECKER_PROPERTIES.isMarshallable(dataSourceNode) || - CHECK_VALID_CONNECTION_SQL.isMarshallable(dataSourceNode) || - VALIDATE_ON_MATCH.isMarshallable(dataSourceNode) || - BACKGROUNDVALIDATION.isMarshallable(dataSourceNode) || - BACKGROUNDVALIDATIONMILLIS.isMarshallable(dataSourceNode) || - USE_FAST_FAIL.isMarshallable(dataSourceNode) || - STALE_CONNECTION_CHECKER_CLASSNAME.isMarshallable(dataSourceNode) || - STALE_CONNECTION_CHECKER_MODULE.isMarshallable(dataSourceNode) || - STALE_CONNECTION_CHECKER_PROPERTIES.isMarshallable(dataSourceNode) || - EXCEPTION_SORTER_CLASSNAME.isMarshallable(dataSourceNode) || - EXCEPTION_SORTER_MODULE.isMarshallable(dataSourceNode) || - EXCEPTION_SORTER_PROPERTIES.isMarshallable(dataSourceNode); + boolean validationRequired = isAnyRequired(dataSourceNode, VALID_CONNECTION_CHECKER_CLASSNAME, + VALID_CONNECTION_CHECKER_MODULE, CHECK_VALID_CONNECTION_SQL, + VALIDATE_ON_MATCH, BACKGROUNDVALIDATION, BACKGROUNDVALIDATIONMILLIS, USE_FAST_FAIL, + STALE_CONNECTION_CHECKER_CLASSNAME, STALE_CONNECTION_CHECKER_MODULE, STALE_CONNECTION_CHECKER_PROPERTIES, + EXCEPTION_SORTER_CLASSNAME, EXCEPTION_SORTER_MODULE, EXCEPTION_SORTER_PROPERTIES); if (validationRequired) { writer.writeStartElement(DataSource.Tag.VALIDATION.getLocalName()); if (dataSourceNode.hasDefined(VALID_CONNECTION_CHECKER_CLASSNAME.getName())) { @@ -485,11 +455,8 @@ private void writeDS(XMLExtendedStreamWriter writer, boolean isXADataSource, Mod } writer.writeEndElement(); } - CHECK_VALID_CONNECTION_SQL.marshallAsElement(dataSourceNode, writer); - VALIDATE_ON_MATCH.marshallAsElement(dataSourceNode, writer); - BACKGROUNDVALIDATION.marshallAsElement(dataSourceNode, writer); - BACKGROUNDVALIDATIONMILLIS.marshallAsElement(dataSourceNode, writer); - USE_FAST_FAIL.marshallAsElement(dataSourceNode, writer); + marshallAsElements(dataSourceNode, writer, CHECK_VALID_CONNECTION_SQL, VALIDATE_ON_MATCH, + BACKGROUNDVALIDATION, BACKGROUNDVALIDATIONMILLIS, USE_FAST_FAIL); if (dataSourceNode.hasDefined(STALE_CONNECTION_CHECKER_CLASSNAME.getName())) { writer.writeStartElement(Validation.Tag.STALE_CONNECTION_CHECKER.getLocalName()); writer.writeAttribute(org.jboss.jca.common.api.metadata.common.Extension.Attribute.CLASS_NAME.getLocalName(), @@ -534,33 +501,16 @@ private void writeDS(XMLExtendedStreamWriter writer, boolean isXADataSource, Mod } writer.writeEndElement(); } - boolean timeoutRequired = BLOCKING_TIMEOUT_WAIT_MILLIS.isMarshallable(dataSourceNode) || - IDLETIMEOUTMINUTES.isMarshallable(dataSourceNode) || - SET_TX_QUERY_TIMEOUT.isMarshallable(dataSourceNode) || - QUERY_TIMEOUT.isMarshallable(dataSourceNode) || - USE_TRY_LOCK.isMarshallable(dataSourceNode) || - ALLOCATION_RETRY.isMarshallable(dataSourceNode) || - ALLOCATION_RETRY_WAIT_MILLIS.isMarshallable(dataSourceNode) || - XA_RESOURCE_TIMEOUT.isMarshallable(dataSourceNode); + boolean timeoutRequired = isAnyRequired(dataSourceNode, TIMEOUT_ATTRIBUTES); if (timeoutRequired) { writer.writeStartElement(DataSource.Tag.TIMEOUT.getLocalName()); - SET_TX_QUERY_TIMEOUT.marshallAsElement(dataSourceNode, writer); - BLOCKING_TIMEOUT_WAIT_MILLIS.marshallAsElement(dataSourceNode, writer); - IDLETIMEOUTMINUTES.marshallAsElement(dataSourceNode, writer); - QUERY_TIMEOUT.marshallAsElement(dataSourceNode, writer); - USE_TRY_LOCK.marshallAsElement(dataSourceNode, writer); - ALLOCATION_RETRY.marshallAsElement(dataSourceNode, writer); - ALLOCATION_RETRY_WAIT_MILLIS.marshallAsElement(dataSourceNode, writer); - XA_RESOURCE_TIMEOUT.marshallAsElement(dataSourceNode, writer); + marshallAsElements(dataSourceNode, writer, TIMEOUT_ATTRIBUTES); writer.writeEndElement(); } - boolean statementRequired = hasAnyOf(dataSourceNode, TRACK_STATEMENTS, PREPARED_STATEMENTS_CACHE_SIZE, SHARE_PREPARED_STATEMENTS); + boolean statementRequired = hasAnyOf(dataSourceNode, STATEMENT_ATTRIBUTES); if (statementRequired) { writer.writeStartElement(DataSource.Tag.STATEMENT.getLocalName()); - TRACK_STATEMENTS.marshallAsElement(dataSourceNode, writer); - PREPARED_STATEMENTS_CACHE_SIZE.marshallAsElement(dataSourceNode, writer); - SHARE_PREPARED_STATEMENTS.marshallAsElement(dataSourceNode, writer); - + marshallAsElements(dataSourceNode, writer, STATEMENT_ATTRIBUTES); writer.writeEndElement(); } @@ -601,6 +551,11 @@ private void writeElementIfHas(XMLExtendedStreamWriter writer, ModelNode node, S } } + private void marshallAsElements(ModelNode node, XMLExtendedStreamWriter writer, SimpleAttributeDefinition... names) throws XMLStreamException { + for (SimpleAttributeDefinition attr : names) { + attr.marshallAsElement(node, writer); + } + } private boolean hasAnyOf(ModelNode node, SimpleAttributeDefinition... names) { for (SimpleAttributeDefinition current : names) { @@ -615,6 +570,10 @@ private boolean has(ModelNode node, String name) { return node.has(name) && node.get(name).isDefined(); } + private boolean isAnyRequired(ModelNode node, AttributeDefinition... names) { + return Arrays.stream(names).anyMatch(name -> name.isMarshallable(node)); + }; + @Override public void readElement(final XMLExtendedStreamReader reader, final List list) throws XMLStreamException { diff --git a/connector/src/main/resources/schema/wildfly-datasources_7_2.xsd b/connector/src/main/resources/schema/wildfly-datasources_7_2.xsd index 9285f0f9819e..036ab999f7a4 100644 --- a/connector/src/main/resources/schema/wildfly-datasources_7_2.xsd +++ b/connector/src/main/resources/schema/wildfly-datasources_7_2.xsd @@ -41,10 +41,10 @@ - + - + @@ -86,56 +86,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -145,42 +96,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -191,11 +107,11 @@ - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -293,47 +160,11 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - + - @@ -439,6 +270,103 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -450,19 +378,13 @@ - - - - - + + + + + - - - - - - @@ -652,9 +574,9 @@ - - - + + + @@ -885,9 +807,9 @@ - - - + + HsqlDbContext ]]> - - - + + + @@ -922,7 +844,7 @@ - + @@ -946,38 +868,23 @@ - + - + - - - - - + + + + + - - - - - - - - - - - - + @@ -1090,7 +997,7 @@ - +