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

WFLY-18109 Migrate MicroProfile LRA subsystem tests to use AbstractSubsystemSchemaTest from wildfly-core #16934

Merged
merged 1 commit into from Jul 6, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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);
}
}