Skip to content

Commit

Permalink
[WFCORE-5288] Add tests for expressions
Browse files Browse the repository at this point in the history
  • Loading branch information
kabir committed Feb 23, 2021
1 parent 0ec9f91 commit b721a2e
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -132,15 +132,15 @@ public void execute(OperationContext context, ModelNode operation) throws Operat
OperationStepHandler handler = context.getResourceRegistration().getOperationEntry(PathAddress.pathAddress(ExposeModelResourceResolved.PATH_ELEMENT), ADD).getOperationHandler();
ModelNode addOp = new ModelNode();
addOp.get(OP).set(ADD);
addOp.get(OP_ADDR).set(PathAddress.pathAddress(operation.get(OP_ADDR)).append(ExposeModelResourceResolved.PATH_ELEMENT).toModelNode());
addOp.get(OP_ADDR).set(context.getCurrentAddress().append(ExposeModelResourceResolved.PATH_ELEMENT).toModelNode());
context.addStep(addOp, handler, Stage.MODEL, true);
}
} else {
if (hasResource) {
OperationStepHandler handler = context.getResourceRegistration().getOperationEntry(PathAddress.pathAddress(ExposeModelResourceResolved.PATH_ELEMENT), REMOVE).getOperationHandler();
ModelNode addOp = new ModelNode();
addOp.get(OP).set(REMOVE);
addOp.get(OP_ADDR).set(PathAddress.pathAddress(operation.get(OP_ADDR)).append(ExposeModelResourceResolved.PATH_ELEMENT).toModelNode());
addOp.get(OP_ADDR).set(context.getCurrentAddress().append(ExposeModelResourceResolved.PATH_ELEMENT).toModelNode());
context.addStep(addOp, handler, Stage.MODEL, true);
}
}
Expand Down
15 changes: 13 additions & 2 deletions jmx/src/test/java/org/jboss/as/jmx/JMXSubsystemTestCase.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.VALUE;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.WRITE_ATTRIBUTE_OPERATION;

import java.io.IOException;
import java.util.List;

import javax.management.MBeanServerConnection;
Expand All @@ -57,7 +58,7 @@
import org.jboss.as.remoting.RemotingServices;
import org.jboss.as.remoting.management.ManagementRemotingServices;
import org.jboss.as.server.ServerEnvironmentResourceDescription;
import org.jboss.as.subsystem.test.AbstractSubsystemTest;
import org.jboss.as.subsystem.test.AbstractSubsystemBaseTest;
import org.jboss.as.subsystem.test.AdditionalInitialization;
import org.jboss.as.subsystem.test.ControllerInitializer;
import org.jboss.as.subsystem.test.KernelServices;
Expand All @@ -73,7 +74,7 @@
*
* @author <a href="[email protected]">Kabir Khan</a>
*/
public class JMXSubsystemTestCase extends AbstractSubsystemTest {
public class JMXSubsystemTestCase extends AbstractSubsystemBaseTest {

private static final int JMX_PORT = 27258;
private static final String TYPE_STANDALONE = "STANDALONE";
Expand All @@ -82,6 +83,16 @@ public JMXSubsystemTestCase() {
super(JMXExtension.SUBSYSTEM_NAME, new JMXExtension());
}

@Override
protected String getSubsystemXml() throws IOException {
return readResource("subsystem-with-expressions.xml");
}


@Override
public void testSubsystem() throws Exception {
standardSubsystemTest(null, null, true, new AuditLogInitialization());
}

@Test
public void testParseEmptySubsystem() throws Exception {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!--
~ JBoss, Home of Professional Open Source
~ Copyright 2021, JBoss Inc., and individual contributors as indicated
~ by the @authors tag.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<subsystem xmlns="urn:jboss:domain:jmx:1.3">
<expose-resolved-model domain-name="${resolved-domain.prop:jboss.RESOLVED}" proper-property-format="false"/>
<expose-expression-model domain-name="${expression-domain.prop:jboss.EXPRESSION}"/>
<remoting-connector use-management-endpoint="${mgmt-endpoint:true}"/>
<audit-log log-boot="${log-boot.prop:true}" log-read-only="${log-read-only.prop:false}" enabled="${enabled.prop:false}">
<handlers>
<handler name="test"/>
</handlers>
</audit-log>
<sensitivity non-core-mbeans="${non-core-mbeans.prop:true}"/>
</subsystem>

0 comments on commit b721a2e

Please sign in to comment.