@BeforeClass
  public static void setupDomain() throws Exception {
    testSupport = DomainTestSuite.createSupport(ManagementReadsTestCase.class.getSimpleName());

    domainMasterLifecycleUtil = testSupport.getDomainMasterLifecycleUtil();
    domainSlaveLifecycleUtil = testSupport.getDomainSlaveLifecycleUtil();
  }
 @BeforeClass
 public static void setupDomain() throws Exception {
   testSupport = DomainTestSuite.createSupport(FullReplaceUndeployTestCase.class.getSimpleName());
   domainMasterLifecycleUtil = testSupport.getDomainMasterLifecycleUtil();
   // Initialize the test extension
   ExtensionSetup.initializeTestExtension(testSupport);
 }
 private void resolveExpressionOnSlaveHostTest(ModelControllerClient domainClient)
     throws Exception {
   ModelNode op = testSupport.createOperationNode("host=slave", "resolve-expression-on-domain");
   op.get("expression").set("${file.separator}");
   System.out.println(op);
   ModelNode response = domainClient.execute(op);
   validateResponse(response);
   validateResolveExpressionOnSlave(response);
 }
 private void readHostState(String host) throws Exception {
   ModelNode op = testSupport.createOperationNode("host=" + host, READ_RESOURCE_OPERATION);
   op.get(INCLUDE_RUNTIME).set(true);
   DomainClient client = domainMasterLifecycleUtil.getDomainClient();
   ModelNode response = client.execute(op);
   ModelNode result = validateResponse(response);
   Assert.assertTrue(result.hasDefined(HOST_STATE));
   Assert.assertEquals("running", result.get(HOST_STATE).asString());
 }
  @Test
  public void testResolveExpressionOnMasterHost() throws Exception {
    ModelNode op = testSupport.createOperationNode("host=master", "resolve-expression-on-domain");
    op.get("expression").set("${file.separator}");

    DomainClient domainClient = domainMasterLifecycleUtil.getDomainClient();
    ModelNode response = domainClient.execute(op);
    validateResponse(response);
    validateResolveExpressionOnMaster(response);
  }
예제 #6
0
 protected void removeResource(String address) throws IOException {
   ModelNode op = createOpNode(address, READ_RESOURCE_OPERATION);
   DomainClient domainClient = testSupport.getDomainMasterLifecycleUtil().getDomainClient();
   ModelNode result = domainClient.execute(op);
   if (SUCCESS.equals(result.get(OUTCOME).asString())) {
     op = createOpNode(address, REMOVE);
     result = domainClient.execute(op);
     assertEquals(result.asString(), SUCCESS, result.get(OUTCOME).asString());
   }
 }
  /**
   * @param expectedOutcome for standard and host-scoped roles tests, this is the expected outcome
   *     of all operations; for server-group-scoped roles tests, this is the expected outcome for
   *     the profile of the server group the user is member of, as for the other profiles and for
   *     read-config-as-xml, the outcome is well known
   */
  protected void readWholeConfig(
      ModelControllerClient client, Outcome expectedOutcome, String... roles) throws IOException {
    Outcome expectedOutcomeForReadConfigAsXml = expectedOutcome;
    if (this instanceof AbstractServerGroupScopedRolesTestCase) {
      expectedOutcomeForReadConfigAsXml = Outcome.UNAUTHORIZED;
    }

    ModelNode op = createOpNode(null, READ_CONFIG_AS_XML_OPERATION);
    configureRoles(op, roles);
    RbacUtil.executeOperation(client, op, expectedOutcomeForReadConfigAsXml);

    // the code below calls the non-published operation 'describe'; see WFLY-2379 for more info

    ModelControllerClient domainClient =
        testSupport.getDomainMasterLifecycleUtil().getDomainClient();

    op = createOpNode(null, READ_CHILDREN_NAMES_OPERATION);
    op.get(CHILD_TYPE).set(PROFILE);
    ModelNode profiles = RbacUtil.executeOperation(domainClient, op, Outcome.SUCCESS);
    for (ModelNode profile : profiles.get(RESULT).asList()) {
      Outcome expectedOutcomeForProfile = expectedOutcome;
      if (this instanceof AbstractServerGroupScopedRolesTestCase) {
        expectedOutcomeForProfile =
            "profile-a".equals(profile.asString()) ? expectedOutcome : Outcome.HIDDEN;
      }

      op = createOpNode("profile=" + profile.asString(), DESCRIBE);
      configureRoles(op, roles);
      ModelNode result = RbacUtil.executeOperation(client, op, expectedOutcomeForProfile);
      assertEquals(expectedOutcomeForProfile == Outcome.SUCCESS, result.hasDefined(RESULT));

      op = createOpNode("profile=" + profile.asString(), READ_CHILDREN_NAMES_OPERATION);
      op.get(CHILD_TYPE).set(SUBSYSTEM);
      ModelNode subsystems = RbacUtil.executeOperation(domainClient, op, Outcome.SUCCESS);
      for (ModelNode subsystem : subsystems.get(RESULT).asList()) {
        op =
            createOpNode(
                "profile=" + profile.asString() + "/subsystem=" + subsystem.asString(), DESCRIBE);
        configureRoles(op, roles);
        result = RbacUtil.executeOperation(client, op, expectedOutcomeForProfile);
        assertEquals(expectedOutcomeForProfile == Outcome.SUCCESS, result.hasDefined(RESULT));
      }
    }
  }