Skip to content

Commit

Permalink
Merge pull request #16934 from pferraro/WFLY-18109
Browse files Browse the repository at this point in the history
WFLY-18109 Migrate MicroProfile LRA subsystem tests to use AbstractSubsystemSchemaTest from wildfly-core
  • Loading branch information
bstansberry committed Jul 6, 2023
2 parents 50cd68a + 1e3f546 commit 9164b0d
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 35 deletions.
Expand Up @@ -46,7 +46,7 @@ public class MicroProfileLRACoordinatorExtension implements Extension {

private static final MicroProfileLRACoordinatorSubsystemModel CURRENT_MODEL = MicroProfileLRACoordinatorSubsystemModel.VERSION_1_0_0;

private static final MicroProfileLRACoordinatorSubsystemSchema CURRENT_SCHEMA = MicroProfileLRACoordinatorSubsystemSchema.VERSION_1_0;
static final MicroProfileLRACoordinatorSubsystemSchema CURRENT_SCHEMA = MicroProfileLRACoordinatorSubsystemSchema.VERSION_1_0;

private final PersistentResourceXMLDescription currentDescription = CURRENT_SCHEMA.getXMLDescription();

Expand All @@ -58,6 +58,7 @@ public void initialize(ExtensionContext extensionContext) {
registration.registerOperationHandler(GenericSubsystemDescribeHandler.DEFINITION, GenericSubsystemDescribeHandler.INSTANCE);
}

@Override
public void initializeParsers(ExtensionParsingContext context) {
for (MicroProfileLRACoordinatorSubsystemSchema schema : EnumSet.allOf(MicroProfileLRACoordinatorSubsystemSchema.class)) {
XMLElementReader<List<ModelNode>> reader = (schema == CURRENT_SCHEMA) ? new PersistentResourceXMLDescriptionReader(this.currentDescription) : schema;
Expand Down
Expand Up @@ -22,35 +22,22 @@

package org.wildfly.extension.microprofile.lra.coordinator;

import org.jboss.as.subsystem.test.AbstractSubsystemBaseTest;
import org.jboss.as.subsystem.test.AbstractSubsystemSchemaTest;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;

import java.io.IOException;
import java.util.EnumSet;

@RunWith(Parameterized.class)
public class MicroprofileLRACoordinatorSubsystemTestCase extends AbstractSubsystemBaseTest {
public class MicroprofileLRACoordinatorSubsystemTestCase extends AbstractSubsystemSchemaTest<MicroProfileLRACoordinatorSubsystemSchema> {

@Parameterized.Parameters
public static Iterable<MicroProfileLRACoordinatorSubsystemSchema> parameters() {
return EnumSet.allOf(MicroProfileLRACoordinatorSubsystemSchema.class);
}

private final MicroProfileLRACoordinatorSubsystemSchema schema;

public MicroprofileLRACoordinatorSubsystemTestCase(MicroProfileLRACoordinatorSubsystemSchema schema) {
super(MicroProfileLRACoordinatorExtension.SUBSYSTEM_NAME, new MicroProfileLRACoordinatorExtension());
this.schema = schema;
}

@Override
protected String getSubsystemXml() throws IOException {
return readResource(String.format("lra-coordinator-%d.%d.xml", this.schema.getVersion().major(), this.schema.getVersion().minor()));
super(MicroProfileLRACoordinatorExtension.SUBSYSTEM_NAME, new MicroProfileLRACoordinatorExtension(), schema, MicroProfileLRACoordinatorExtension.CURRENT_SCHEMA);
}

@Override
protected String getSubsystemXsdPath() throws Exception {
return String.format("schema/wildfly-microprofile-lra-coordinator_%d_%d.xsd", this.schema.getVersion().major(), this.schema.getVersion().minor());
}
}
Expand Up @@ -47,7 +47,7 @@ public class MicroProfileLRAParticipantExtension implements Extension {

private static final MicroProfileLRAParticipantSubsystemModel CURRENT_MODEL = MicroProfileLRAParticipantSubsystemModel.VERSION_1_0_0;

private static final MicroProfileLRAParticipantSubsystemSchema CURRENT_SCHEMA = MicroProfileLRAParticipantSubsystemSchema.VERSION_1_0;
static final MicroProfileLRAParticipantSubsystemSchema CURRENT_SCHEMA = MicroProfileLRAParticipantSubsystemSchema.VERSION_1_0;

private final PersistentResourceXMLDescription currentDescription = CURRENT_SCHEMA.getXMLDescription();

Expand Down
Expand Up @@ -22,35 +22,21 @@

package org.wildfly.extension.microprofile.lra.participant;

import org.jboss.as.subsystem.test.AbstractSubsystemBaseTest;
import org.jboss.as.subsystem.test.AbstractSubsystemSchemaTest;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;

import java.io.IOException;
import java.util.EnumSet;

@RunWith(Parameterized.class)
public class MicroprofileLRAParticipantSubsystemTestCase extends AbstractSubsystemBaseTest {
public class MicroprofileLRAParticipantSubsystemTestCase extends AbstractSubsystemSchemaTest<MicroProfileLRAParticipantSubsystemSchema> {

@Parameterized.Parameters
public static Iterable<MicroProfileLRAParticipantSubsystemSchema> parameters() {
return EnumSet.allOf(MicroProfileLRAParticipantSubsystemSchema.class);
}

private final MicroProfileLRAParticipantSubsystemSchema schema;

public MicroprofileLRAParticipantSubsystemTestCase(MicroProfileLRAParticipantSubsystemSchema schema) {
super(MicroProfileLRAParticipantExtension.SUBSYSTEM_NAME, new MicroProfileLRAParticipantExtension());
this.schema = schema;
}

@Override
protected String getSubsystemXml() throws IOException {
return readResource(String.format("lra-participant-%d.%d.xml", this.schema.getVersion().major(), this.schema.getVersion().minor()));
}

@Override
protected String getSubsystemXsdPath() throws Exception {
return String.format("schema/wildfly-microprofile-lra-participant_%d_%d.xsd", this.schema.getVersion().major(), this.schema.getVersion().minor());
super(MicroProfileLRAParticipantExtension.SUBSYSTEM_NAME, new MicroProfileLRAParticipantExtension(), schema, MicroProfileLRAParticipantExtension.CURRENT_SCHEMA);
}
}

0 comments on commit 9164b0d

Please sign in to comment.