-
Notifications
You must be signed in to change notification settings - Fork 468
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WFCORE-6829] Add a new 'urn:jboss:domain:community:20.0' schema.
Also update the SupportedNamespaceParsingTestCases to include stability level tests.
- Loading branch information
Showing
5 changed files
with
3,962 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,11 +10,13 @@ | |
|
||
import java.io.StringReader; | ||
import java.util.ArrayList; | ||
import java.util.Arrays; | ||
import java.util.HashSet; | ||
import java.util.List; | ||
import java.util.Set; | ||
|
||
import javax.xml.stream.XMLInputFactory; | ||
import javax.xml.stream.XMLStreamException; | ||
import javax.xml.stream.XMLStreamReader; | ||
|
||
import org.jboss.as.controller.parsing.ManagementXmlSchema; | ||
|
@@ -23,13 +25,16 @@ | |
import org.jboss.dmr.ModelNode; | ||
import org.jboss.staxmapper.XMLMapper; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.junit.runners.Parameterized; | ||
import org.projectodd.vdx.core.XMLStreamValidationException; | ||
|
||
/** | ||
* Test case testing the handling on unsupported namespaces when parsing the configuration. | ||
* | ||
* @author <a href="mailto:[email protected]">Darran Lofthouse</a> | ||
*/ | ||
@RunWith(Parameterized.class) | ||
public class SupportedNamespaceParsingTestCase { | ||
|
||
private static final String TEMPLATE = "<?xml version='1.0' encoding='UTF-8'?>" + | ||
|
@@ -44,9 +49,20 @@ public class SupportedNamespaceParsingTestCase { | |
"urn:jboss:domain:1.5", | ||
"urn:jboss:domain:1.6"); | ||
|
||
private final Stability testStability; | ||
|
||
public SupportedNamespaceParsingTestCase(Stability testStability) { | ||
this.testStability = testStability; | ||
} | ||
|
||
@Parameterized.Parameters | ||
public static Iterable<Stability> stabilityLevels() { | ||
return Arrays.asList(Stability.DEFAULT, Stability.COMMUNITY, Stability.PREVIEW, Stability.EXPERIMENTAL); | ||
} | ||
|
||
@Test | ||
public void testNamespaceHandling() throws Exception { | ||
DomainXmlSchemas xmlSchemas = new DomainXmlSchemas(Stability.DEFAULT, null, null, null); | ||
DomainXmlSchemas xmlSchemas = new DomainXmlSchemas(testStability, null, null, null); | ||
Set<ManagementXmlSchema> schemas = new HashSet<>(); | ||
schemas.add(xmlSchemas.getCurrent()); | ||
schemas.addAll(xmlSchemas.getAdditional()); | ||
|
@@ -68,9 +84,16 @@ public void testNamespaceHandling() throws Exception { | |
} catch (XMLStreamValidationException e) { | ||
assertTrue("Expected error should be WFLYCTL0513" , e.getMessage().contains("WFLYCTL0513")); | ||
} | ||
} else { | ||
// We expect no error if supported. | ||
} else if (testStability.enables(current.getStability())) { | ||
// We expect no error if supported | ||
mapper.parseDocument(operationList, reader); | ||
} else { | ||
try { | ||
mapper.parseDocument(operationList, reader); | ||
fail(String.format("Parsing expected to fail due to unsupported stability level %s", currentNamespace)); | ||
} catch (XMLStreamException e) { | ||
assertTrue("Expected error should be WFLYCTL0514" , e.getMessage().contains("WFLYCTL0514")); | ||
} | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,25 +10,30 @@ | |
|
||
import java.io.StringReader; | ||
import java.util.ArrayList; | ||
import java.util.Arrays; | ||
import java.util.HashSet; | ||
import java.util.List; | ||
import java.util.Set; | ||
|
||
import javax.xml.stream.XMLInputFactory; | ||
import javax.xml.stream.XMLStreamException; | ||
import javax.xml.stream.XMLStreamReader; | ||
|
||
import org.jboss.as.controller.parsing.ManagementXmlSchema; | ||
import org.jboss.as.version.Stability; | ||
import org.jboss.dmr.ModelNode; | ||
import org.jboss.staxmapper.XMLMapper; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.junit.runners.Parameterized; | ||
import org.projectodd.vdx.core.XMLStreamValidationException; | ||
|
||
/** | ||
* Test case testing the handling on unsupported namespaces when parsing the configuration. | ||
* | ||
* @author <a href="mailto:[email protected]">Darran Lofthouse</a> | ||
*/ | ||
@RunWith(Parameterized.class) | ||
public class SupportedNamespaceParsingTestCase { | ||
|
||
private static final String TEMPLATE = "<?xml version='1.0' encoding='UTF-8'?>" + | ||
|
@@ -48,9 +53,20 @@ public class SupportedNamespaceParsingTestCase { | |
"urn:jboss:domain:1.5", | ||
"urn:jboss:domain:1.6"); | ||
|
||
private final Stability testStability; | ||
|
||
public SupportedNamespaceParsingTestCase(Stability testStability) { | ||
this.testStability = testStability; | ||
} | ||
|
||
@Parameterized.Parameters | ||
public static Iterable<Stability> stabilityLevels() { | ||
return Arrays.asList(Stability.DEFAULT, Stability.COMMUNITY, Stability.PREVIEW, Stability.EXPERIMENTAL); | ||
} | ||
|
||
@Test | ||
public void testNamespaceHandling() throws Exception { | ||
HostXmlSchemas xmlSchemas = new HostXmlSchemas(Stability.DEFAULT, "primary", null, false, null, null, null); | ||
HostXmlSchemas xmlSchemas = new HostXmlSchemas(testStability, "primary", null, false, null, null, null); | ||
Set<ManagementXmlSchema> schemas = new HashSet<>(); | ||
schemas.add(xmlSchemas.getCurrent()); | ||
schemas.addAll(xmlSchemas.getAdditional()); | ||
|
@@ -72,9 +88,16 @@ public void testNamespaceHandling() throws Exception { | |
} catch (XMLStreamValidationException e) { | ||
assertTrue("Expected error should be WFLYCTL0513" , e.getMessage().contains("WFLYCTL0513")); | ||
} | ||
} else { | ||
// We expect no error if supported. | ||
} else if (testStability.enables(current.getStability())) { | ||
// We expect no error if supported | ||
mapper.parseDocument(operationList, reader); | ||
} else { | ||
try { | ||
mapper.parseDocument(operationList, reader); | ||
fail(String.format("Parsing expected to fail due to unsupported stability level %s", currentNamespace)); | ||
} catch (XMLStreamException e) { | ||
assertTrue("Expected error should be WFLYCTL0514" , e.getMessage().contains("WFLYCTL0514")); | ||
} | ||
} | ||
} | ||
} | ||
|
Oops, something went wrong.