@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); }
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)); } } }