コード例 #1
0
  @Test
  public void testIncludesWithOverriddenSubsystems() throws Exception {
    try {
      // Here we test changing the includes attribute value
      // Testing what happens when adding subsystems at runtime becomes a bit too hard to mock up
      // so we test that in ServerManagementTestCase
      PathAddress addr = getProfileAddress("profile-four");
      ModelNode list = new ModelNode().add("profile-three");
      ModelNode op = Util.getWriteAttributeOperation(addr, INCLUDES, list);
      MockOperationContext operationContext =
          getOperationContextForSubsystemIncludes(
              addr,
              new RootResourceInitializer() {
                @Override
                public void addAdditionalResources(Resource root) {
                  Resource subsystemA = Resource.Factory.create();
                  root.getChild(PathElement.pathElement(PROFILE, "profile-three"))
                      .registerChild(PathElement.pathElement(SUBSYSTEM, "a"), subsystemA);

                  Resource subsystemB = Resource.Factory.create();
                  Resource profile4 =
                      root.getChild(PathElement.pathElement(PROFILE, "profile-four"));
                  profile4.registerChild(PathElement.pathElement(SUBSYSTEM, "a"), subsystemB);
                }
              });
      ProfileResourceDefinition.createIncludesValidationHandler().execute(operationContext, op);
      operationContext.executeNextStep();
      Assert.fail("Expected error");
    } catch (OperationFailedException expected) {
      Assert.assertTrue(expected.getMessage().contains("164"));
      Assert.assertTrue(expected.getMessage().contains("'profile-four'"));
      Assert.assertTrue(expected.getMessage().contains("'a'"));
      Assert.assertTrue(expected.getMessage().contains("'profile-three'"));
    }
  }
コード例 #2
0
 /** Resolve expressions in the given model (if there are any) */
 private ModelNode resolveExpressions(final ModelNode unresolved) {
   if (unresolved == null) {
     return null;
   }
   try {
     return expressionResolver.resolveExpressions(unresolved.clone());
   } catch (OperationFailedException e) {
     // Fail
     throw new IllegalStateException(e.getMessage(), e);
   }
 }
コード例 #3
0
 public OperationFailedRuntimeException(OperationFailedException e) {
   super(e.getMessage());
 }