-
Notifications
You must be signed in to change notification settings - Fork 464
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6126 from pferraro/WFCORE-6945
WFCORE-6945 Required child resource logic in wildfly-subsystem is not stability-level aware
- Loading branch information
Showing
6 changed files
with
193 additions
and
50 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
50 changes: 50 additions & 0 deletions
50
controller/src/test/java/org/jboss/as/controller/ResourceRegistrationTestCase.java
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 |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* Copyright The WildFly Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.jboss.as.controller; | ||
|
||
import java.util.EnumSet; | ||
import java.util.Objects; | ||
|
||
import org.jboss.as.controller.descriptions.ModelDescriptionConstants; | ||
import org.jboss.as.version.Stability; | ||
import org.junit.Assert; | ||
import org.junit.Test; | ||
|
||
/** | ||
* Unit test for {@link ResourceRegistration} factory methods. | ||
*/ | ||
public class ResourceRegistrationTestCase { | ||
|
||
@Test | ||
public void test() { | ||
ResourceRegistration root = ResourceRegistration.root(); | ||
Assert.assertNull(root.getPathElement()); | ||
Assert.assertSame(Stability.DEFAULT, root.getStability()); | ||
Assert.assertSame(root, ResourceRegistration.root()); | ||
Assert.assertSame(root, ResourceRegistration.of(root.getPathElement())); | ||
Assert.assertSame(root, ResourceRegistration.of(root.getPathElement(), Stability.DEFAULT)); | ||
verify(root); | ||
|
||
ResourceRegistration subsystem = ResourceRegistration.of(PathElement.pathElement(ModelDescriptionConstants.SUBSYSTEM, "foo")); | ||
Assert.assertNotEquals(subsystem, root); | ||
Assert.assertNotEquals(subsystem, ResourceRegistration.of(PathElement.pathElement(ModelDescriptionConstants.SUBSYSTEM, "bar"))); | ||
verify(subsystem); | ||
|
||
ResourceRegistration unstableSubsystem = ResourceRegistration.of(PathElement.pathElement(ModelDescriptionConstants.SUBSYSTEM, "bar"), Stability.EXPERIMENTAL); | ||
Assert.assertNotEquals(unstableSubsystem, root); | ||
Assert.assertNotEquals(unstableSubsystem, subsystem); | ||
Assert.assertNotEquals(unstableSubsystem, ResourceRegistration.of(unstableSubsystem.getPathElement())); | ||
verify(unstableSubsystem); | ||
} | ||
|
||
private static void verify(ResourceRegistration subject) { | ||
Assert.assertEquals(Objects.hashCode(subject.getPathElement()), subject.hashCode()); | ||
Assert.assertEquals(subject, ResourceRegistration.of(subject.getPathElement(), subject.getStability())); | ||
for (Stability stability : EnumSet.complementOf(EnumSet.of(subject.getStability()))) { | ||
Assert.assertNotEquals(subject, ResourceRegistration.of(subject.getPathElement(), stability)); | ||
} | ||
} | ||
} |
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
Oops, something went wrong.