Java Code Examples for org.jboss.as.controller.descriptions.ModelDescriptionConstants#APPLICATION_CLASSIFICATION

The following examples show how to use org.jboss.as.controller.descriptions.ModelDescriptionConstants#APPLICATION_CLASSIFICATION . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ApplicationClassificationConfigResourceDefinition.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
private Map<PathAddress, AccessConstraintUtilization> getAccessConstraintUtilizations() {
    boolean core = ModelDescriptionConstants.CORE.equals(configType);
    AccessConstraintKey key =
            new AccessConstraintKey(ModelDescriptionConstants.APPLICATION_CLASSIFICATION,
                    core, core? null : configType, getPathElement().getValue());
    return registry.getAccessConstraintUtilizations(key);
}
 
Example 2
Source File: ApplicationTypeAccessConstraintDefinition.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public ApplicationTypeAccessConstraintDefinition(ApplicationTypeConfig applicationTypeConfig) {
    // Register this applicationTypeConfig, and if a compatible one is already registered, use that instead
    ApplicationTypeConfig toUse = ApplicationTypeConstraint.FACTORY.addApplicationTypeConfig(applicationTypeConfig);
    this.applicationTypeConfig = toUse;
    this.key = new AccessConstraintKey(ModelDescriptionConstants.APPLICATION_CLASSIFICATION, toUse.isCore(),
            toUse.getSubsystem(), toUse.getName());
}
 
Example 3
Source File: AccessConstraintUtilizationTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Test
public void testConstraintUtilization() throws Exception {
    ModelControllerClient client = testSupport.getDomainMasterLifecycleUtil().getDomainClient();
    for (ExpectedDef expectedDef : EXPECTED_DEFS) {
        AccessConstraintKey acdKey = expectedDef.key;
        String constraint = ModelDescriptionConstants.SENSITIVE.equals(acdKey.getType())
                ? ModelDescriptionConstants.SENSITIVITY_CLASSIFICATION
                : ModelDescriptionConstants.APPLICATION_CLASSIFICATION;
        String acdType = acdKey.isCore() ? "core" : acdKey.getSubsystemName();
        String path = String.format(ADDR_FORMAT, acdKey.getType(), acdType, acdKey.getName());
        ModelNode op = createOpNode(path, READ_CHILDREN_RESOURCES_OPERATION);
        op.get(ModelDescriptionConstants.CHILD_TYPE).set(ModelDescriptionConstants.APPLIES_TO);
        System.out.println("Testing " + acdKey);
        ModelNode result = RbacUtil.executeOperation(client, op, Outcome.SUCCESS).get(ModelDescriptionConstants.RESULT);
        Assert.assertTrue(acdKey + "result is defined", result.isDefined());
        Assert.assertTrue(acdKey + "result has content", result.asInt() > 0);
        boolean foundResource = false;
        boolean foundAttr = false;
        boolean foundOps = false;
        for (Property prop : result.asPropertyList()) {
            ModelNode pathResult = prop.getValue();
            if (pathResult.get(ModelDescriptionConstants.ENTIRE_RESOURCE).asBoolean()) {
                Assert.assertTrue(acdKey + " -- " + prop.getName() + " resource", expectedDef.expectResource);
                foundResource = true;
            }
            ModelNode attrs = pathResult.get(ATTRIBUTES);
            if (attrs.isDefined() && attrs.asInt() > 0) {
                Assert.assertTrue(acdKey + " -- " + prop.getName() + " attributes = " + attrs.asString(), expectedDef.expectAttributes);
                foundAttr = true;
            }
            ModelNode ops = pathResult.get(OPERATIONS);
            if (ops.isDefined() && ops.asInt() > 0) {
                Assert.assertTrue(acdKey + " -- " + prop.getName() + " operations = " + ops.asString(), expectedDef.expectOps);
                foundOps = true;
            }
        }

        Assert.assertEquals(acdKey + " -- resource", expectedDef.expectResource, foundResource);
        Assert.assertEquals(acdKey + " -- attributes", expectedDef.expectAttributes, foundAttr);
        Assert.assertEquals(acdKey + " -- operations", expectedDef.expectOps, foundOps);
    }
}
 
Example 4
Source File: AccessConstraintUtilizationTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
private static AccessConstraintKey getAppKey(String subsystemName, String name) {
    return new AccessConstraintKey(ModelDescriptionConstants.APPLICATION_CLASSIFICATION, false, subsystemName, name);
}