use of javax.management.JMRuntimeException in project wildfly-core by wildfly.
the class JmxRBACProviderHostScopedRolesTestCase method doOperation.
private void doOperation(boolean successExpected, String objectName, String operationName, JmxManagementInterface jmx) throws Exception {
MBeanServerConnection connection = jmx.getConnection();
ObjectName domain = new ObjectName(objectName);
try {
connection.invoke(domain, operationName, ArrayUtils.EMPTY_OBJECT_ARRAY, ArrayUtils.EMPTY_STRING_ARRAY);
assertTrue("Failure was expected but success happened", successExpected);
} catch (JMRuntimeException e) {
if (e.getMessage().contains("WFLYJMX0037")) {
assertFalse("Success was expected but failure happened: " + e, successExpected);
} else {
throw e;
}
}
}
use of javax.management.JMRuntimeException in project wildfly-core by wildfly.
the class JmxRBACProviderServerGroupScopedRolesTestCase method setAttribute.
private void setAttribute(String userName, JmxManagementInterface jmx) throws Exception {
boolean successExpected = isWriteAllowed(userName);
MBeanServerConnection connection = jmx.getConnection();
ObjectName domain = new ObjectName("java.lang:type=Memory");
try {
connection.setAttribute(domain, new Attribute("Verbose", true));
// back to default to not pollute the logs
connection.setAttribute(domain, new Attribute("Verbose", false));
assertTrue("Failure was expected", successExpected);
} catch (JMRuntimeException e) {
if (e.getMessage().contains("WFLYJMX0037")) {
assertFalse("Success was expected but failure happened: " + e, successExpected);
} else {
throw e;
}
}
}
use of javax.management.JMRuntimeException in project wildfly-core by wildfly.
the class JmxRBACProviderServerGroupScopedRolesTestCase method doOperation.
private void doOperation(boolean successExpected, String objectName, String operationName, JmxManagementInterface jmx) throws Exception {
MBeanServerConnection connection = jmx.getConnection();
ObjectName domain = new ObjectName(objectName);
try {
connection.invoke(domain, operationName, ArrayUtils.EMPTY_OBJECT_ARRAY, ArrayUtils.EMPTY_STRING_ARRAY);
assertTrue("Failure was expected but success happened", successExpected);
} catch (JMRuntimeException e) {
if (e.getMessage().contains("WFLYJMX0037")) {
assertFalse("Success was expected but failure happened: " + e, successExpected);
} else {
throw e;
}
}
}
use of javax.management.JMRuntimeException in project wildfly-core by wildfly.
the class AbstractJmxNonCoreMBeansSensitivityTestCase method setAttribute.
private void setAttribute(String userName, JmxManagementInterface jmx) throws Exception {
boolean successExpected = isWriteAllowed(userName);
MBeanServerConnection connection = jmx.getConnection();
ObjectName domain = new ObjectName("java.lang:type=Memory");
try {
connection.setAttribute(domain, new Attribute("Verbose", true));
// back to default to not pollute the logs
connection.setAttribute(domain, new Attribute("Verbose", false));
assertTrue("Failure was expected", successExpected);
} catch (JMRuntimeException e) {
if (e.getMessage().contains("WFLYJMX0037")) {
assertFalse("Success was expected but failure happened: " + e, successExpected);
} else {
throw e;
}
}
}
use of javax.management.JMRuntimeException in project wildfly-core by wildfly.
the class JmxManagementInterface method getAttribute.
private ModelNode getAttribute(ObjectName objectName, String name) {
MBeanServerConnection connection = getConnection();
Object result = null;
JMRuntimeException exception = null;
try {
result = connection.getAttribute(objectName, name);
} catch (JMRuntimeException e) {
exception = e;
} catch (Exception e) {
throw new RuntimeException(e);
}
return modelNodeResult(result, exception);
}
Aggregations