Skip to content

Commit abea9d2

Browse files
committed
[WFCORE-7091] Add the ability to ignore tests using the ModelTestControllerVersion
1 parent 1650871 commit abea9d2

File tree

4 files changed

+23
-3
lines changed

4 files changed

+23
-3
lines changed

core-model-test/framework/src/main/java/org/jboss/as/core/model/test/CoreModelTestDelegate.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@
9494
import org.jboss.dmr.Property;
9595
import org.jboss.staxmapper.XMLMapper;
9696
import org.junit.Assert;
97+
import org.junit.Assume;
9798
import org.wildfly.common.xml.XMLInputFactoryUtil;
9899
import org.wildfly.legacy.test.spi.Version;
99100

@@ -691,6 +692,7 @@ private class LegacyKernelServicesInitializerImpl implements LegacyKernelService
691692
private ModelTestOperationValidatorFilter.Builder operationValidationExcludeFilterBuilder;
692693

693694
LegacyKernelServicesInitializerImpl(ModelVersion modelVersion, ModelTestControllerVersion version) {
695+
Assume.assumeFalse("This model controller version is ignored for this server.", version.isIgnored());
694696
this.classLoaderBuilder = new ChildFirstClassLoaderBuilder(version.isEap());
695697
this.modelVersion = modelVersion;
696698
this.testControllerVersion = version;

core-model-test/tests/src/test/java/org/jboss/as/core/model/test/deployment/DomainDeploymentTransformersTestCase.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import org.jboss.as.model.test.ModelTestUtils;
3131
import org.jboss.dmr.ModelNode;
3232
import org.junit.Assert;
33+
import org.junit.AssumptionViolatedException;
3334
import org.junit.Test;
3435
import org.junit.runner.RunWith;
3536

@@ -66,6 +67,9 @@ public void domainDeployment() throws Exception {
6667
KernelServices legacyServices = mainServices.getLegacyServices(modelVersion);
6768
Assert.assertTrue("Legacy services didn't boot for version " + modelVersion, legacyServices.isSuccessfulBoot());
6869
checkCoreModelTransformation(mainServices, modelVersion);
70+
} catch (AssumptionViolatedException ex) {
71+
// If the test is ignored, we want to propagate the exception
72+
throw ex;
6973
} catch (Exception ex) {
7074
throw new RuntimeException("Error for version " + modelVersion + " " + ex.getMessage(), ex);
7175
}
@@ -86,10 +90,13 @@ public void domainExplodedDeployment() throws Exception {
8690

8791
List<ModelNode> operations = builder.parseXmlResource("domain-exploded-deployments.xml");
8892
//removing the ading of "management-client-content" => "rollout-plans
89-
operations = operations.subList(0, operations.size() -2);
93+
operations = operations.subList(0, operations.size() - 2);
9094
ModelTestUtils.checkFailedTransformedBootOperations(mainServices, modelVersion, operations, getConfig());
95+
} catch (AssumptionViolatedException ex) {
96+
// If the test is ignored, we want to propagate the exception
97+
throw ex;
9198
} catch (Exception ex) {
92-
throw new RuntimeException("Error for version " + modelVersion + " " + ex.getMessage(), ex);
99+
throw new Exception("Error for version " + modelVersion + " " + ex.getMessage(), ex);
93100
}
94101
}
95102

model-test/src/main/java/org/jboss/as/model/test/ModelTestControllerVersion.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,19 +42,23 @@ public enum ModelTestControllerVersion {
4242
private final String artifactIdPrefix;
4343
private final Map<String, ModelVersion> subsystemModelVersions = new LinkedHashMap<>();
4444
private final Stability stability;
45+
private final boolean ignored;
4546

4647
ModelTestControllerVersion(String mavenGavVersion, boolean eap, String testControllerVersion, String realVersionName) {
4748
this(mavenGavVersion, eap, testControllerVersion, null, realVersionName);
4849
}
49-
5050
ModelTestControllerVersion(String mavenGavVersion, boolean eap, String testControllerVersion, String coreVersion, String realVersionName) {
51+
this(mavenGavVersion, eap, testControllerVersion, coreVersion, realVersionName, false);
52+
}
53+
ModelTestControllerVersion(String mavenGavVersion, boolean eap, String testControllerVersion, String coreVersion, String realVersionName, boolean ignored) {
5154
this.mavenGavVersion = mavenGavVersion;
5255
this.testControllerVersion = testControllerVersion;
5356
this.eap = eap;
5457
this.stability = eap ? Stability.DEFAULT : Stability.COMMUNITY;
5558
this.validLegacyController = testControllerVersion != null;
5659
this.coreVersion = coreVersion == null? mavenGavVersion : coreVersion; //full == core
5760
this.realVersionName = realVersionName;
61+
this.ignored = ignored;
5862
if (eap) {
5963
if (coreVersion != null) { //eap 7+ has core version defined
6064
this.coreMavenGroupId = "org.wildfly.core";
@@ -170,4 +174,8 @@ public String getMavenGav(String artifactIdPart, boolean coreArtifact) {
170174
public Stability getStability() {
171175
return stability;
172176
}
177+
178+
public boolean isIgnored() {
179+
return ignored;
180+
}
173181
}

subsystem-test/framework/src/main/java/org/jboss/as/subsystem/test/SubsystemTestDelegate.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import java.util.Map;
2929
import java.util.ServiceLoader;
3030
import java.util.Set;
31+
3132
import javax.xml.namespace.QName;
3233
import javax.xml.stream.XMLStreamException;
3334
import javax.xml.stream.XMLStreamReader;
@@ -550,6 +551,7 @@ public LegacyKernelServicesInitializer createLegacyKernelServicesBuilder(Additio
550551
}
551552

552553
public KernelServices build() throws Exception {
554+
553555
bootOperationBuilder.validateNotAlreadyBuilt();
554556
List<ModelNode> bootOperations = bootOperationBuilder.build();
555557
AbstractKernelServicesImpl kernelServices = AbstractKernelServicesImpl.create(testClass, mainSubsystemName, additionalInit, ModelTestOperationValidatorFilter.createValidateAll(), cloneExtensionRegistry(additionalInit), bootOperations,
@@ -636,6 +638,7 @@ private class LegacyKernelServiceInitializerImpl implements LegacyKernelServices
636638
private OperationFixer reverseCheckOperationFixer = operation -> operation;
637639

638640
public LegacyKernelServiceInitializerImpl(AdditionalInitialization additionalInit, ModelTestControllerVersion version, ModelVersion modelVersion) {
641+
Assume.assumeFalse("This model controller version is ignored for this server.", version.isIgnored());
639642
this.classLoaderBuilder = new ChildFirstClassLoaderBuilder(version.isEap());
640643
this.additionalInit = additionalInit == null ? AdditionalInitialization.MANAGEMENT : additionalInit;
641644
this.testControllerVersion = version;

0 commit comments

Comments
 (0)