Skip to content

Commit

Permalink
Merge pull request wildfly#18425 from aldaris/WFLY-17539
Browse files Browse the repository at this point in the history
WFLY-17539 Move rbac testing from XSLT to cli script
  • Loading branch information
bstansberry authored Nov 25, 2024
2 parents 32e6014 + 5ac38da commit 1771bf4
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 182 deletions.
38 changes: 38 additions & 0 deletions testsuite/integration/rbac/enable-rbac.cli
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#
# Copyright The WildFly Authors
# SPDX-License-Identifier: Apache-2.0
#

embed-server --server-config=standalone-full.xml
batch
/core-service=management/access=authorization:write-attribute(name=provider,value=rbac)

/core-service=management/access=authorization/role-mapping=Monitor:add
/core-service=management/access=authorization/role-mapping=Monitor/include=group-monitor:add(name=Monitor,type=GROUP)
/core-service=management/access=authorization/role-mapping=Monitor/exclude=user1:add(name=UserMappedToGroupOperatorAndMonitorAndExcludedFromGroupMonitor,type=USER)
/core-service=management/access=authorization/role-mapping=Monitor/exclude=user2:add(name=UserMappedToGroupMaintainerAndMonitorAndExcludedFromGroupMonitor,type=USER)
/core-service=management/access=authorization/role-mapping=Monitor/exclude=user3:add(name=UserMappedToGroupDeployerAndMonitorAndExcludedFromGroupMonitor,type=USER)
/core-service=management/access=authorization/role-mapping=Monitor/exclude=user4:add(name=UserMappedToGroupAdministratorAndMonitorAndExcludedFromGroupMonitor,type=USER)
/core-service=management/access=authorization/role-mapping=Monitor/exclude=user5:add(name=UserMappedToGroupAuditorAndMonitorAndExcludedFromGroupMonitor,type=USER)
/core-service=management/access=authorization/role-mapping=Monitor/exclude=user6:add(name=UserMappedToGroupSuperUserAndMonitorAndExcludedFromGroupMonitor,type=USER)
/core-service=management/access=authorization/role-mapping=Monitor/exclude=group1:add(name=ExcludingGroup,type=GROUP)

/core-service=management/access=authorization/role-mapping=Operator:add
/core-service=management/access=authorization/role-mapping=Operator/include=group-operator:add(name=Operator,type=GROUP)

/core-service=management/access=authorization/role-mapping=Maintainer:add
/core-service=management/access=authorization/role-mapping=Maintainer/include=group-maintainer:add(name=Maintainer,type=GROUP)

/core-service=management/access=authorization/role-mapping=Deployer:add
/core-service=management/access=authorization/role-mapping=Deployer/include=group-deployer:add(name=Deployer,type=GROUP)

/core-service=management/access=authorization/role-mapping=Administrator:add
/core-service=management/access=authorization/role-mapping=Administrator/include=group-administrator:add(name=Administrator,type=GROUP)

/core-service=management/access=authorization/role-mapping=Auditor:add
/core-service=management/access=authorization/role-mapping=Auditor/include=group-auditor:add(name=Auditor,type=GROUP)

/core-service=management/access=authorization/role-mapping=SuperUser/include=group-superuser:add(name=SuperUser,type=GROUP)

run-batch
stop-embedded-server
52 changes: 19 additions & 33 deletions testsuite/integration/rbac/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,45 +66,31 @@
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>xml-maven-plugin</artifactId>
<groupId>org.wildfly.plugins</groupId>
<artifactId>wildfly-maven-plugin</artifactId>
<version>${version.org.wildfly.plugin}</version>
<executions>
<execution>
<id>adjust-default-server-configuration-for-basic-tests</id>
<id>ts.config-as.configure-wildfly</id>
<phase>process-test-resources</phase>
<goals>
<goal>transform</goal>
<goal>execute-commands</goal>
</goals>
<configuration>
<offline>true</offline>
<scripts>
<script>enable-rbac.cli</script>
</scripts>
<jboss-home>${wildfly.dir}</jboss-home>
<stdout>${project.build.directory}/wildfly-plugin.log</stdout>
<java-opts>${modular.jdk.args}</java-opts>
<system-properties>
<maven.repo.local>${settings.localRepository}</maven.repo.local>
<module.path>${jboss.dist}/modules</module.path>
</system-properties>
</configuration>
</execution>
</executions>
<configuration>
<transformationSets>
<transformationSet>
<dir>${wildfly.standalone.config}</dir>
<skipDefaultExcludes>true</skipDefaultExcludes>
<includes>
<include>standalone*.xml</include>
</includes>
<stylesheet>${basedir}/../src/test/xslt/enableRbac.xsl</stylesheet>
<outputDir>${wildfly.standalone.config}</outputDir>
</transformationSet>
<transformationSet>
<dir>${wildfly.standalone.config}</dir>
<skipDefaultExcludes>true</skipDefaultExcludes>
<includes>
<include>standalone*.xml</include>
</includes>
<stylesheet>${basedir}/../src/test/xslt/setupRbacRolesMappingTests.xsl</stylesheet>
<outputDir>${wildfly.standalone.config}</outputDir>
<fileMappers>
<fileMapper implementation="org.codehaus.plexus.components.io.filemappers.RegExpFileMapper">
<pattern>^</pattern>
<replacement>properties-role-mapping-</replacement>
</fileMapper>
</fileMappers>
</transformationSet>
</transformationSets>
</configuration>
</plugin>

<!-- Resources plugin. -->
Expand Down Expand Up @@ -164,7 +150,7 @@
</includes>
<!-- Parameters to test cases. -->
<systemPropertyVariables>
<jboss.server.config.file.name>properties-role-mapping-standalone-full.xml</jboss.server.config.file.name>
<jboss.server.config.file.name>standalone-full.xml</jboss.server.config.file.name>
</systemPropertyVariables>

<additionalClasspathElements>
Expand Down
39 changes: 0 additions & 39 deletions testsuite/integration/src/test/xslt/enableRbac.xsl

This file was deleted.

110 changes: 0 additions & 110 deletions testsuite/integration/src/test/xslt/setupRbacRolesMappingTests.xsl

This file was deleted.

0 comments on commit 1771bf4

Please sign in to comment.