@Test
    public void testAddClusterConfigAsClusterAdmin() throws Exception {
        ConnectionParams adminConnectionParams = createAdminConnectionParams();

        String clusterAdminName = "clusterAdmin";
        String clusterAdminPwd = "clusterAdmin";

        /**
         * Create a user with cluster admin role
         */
        ClusterUtils.createUserClusterAdministrator(adminConnectionParams, clusterName,
                clusterAdminName, clusterAdminPwd);

        /**
         * Create and add a configuration to our cluster using the new user's privilege
         */

        String configType = "test-hadoop-env";
        String configTag = "version1";
        ClusterConfigParams configParams = new ClusterConfigParams();
        configParams.setClusterName(clusterName);
        configParams.setConfigType(configType);
        configParams.setConfigTag(configTag);
        configParams.setProperties(new HashMap<String, String>() {{
            put("fs.default.name", "localhost:9995");
        }});

        /**
         * This user has enough privilege to create the cluster configuration. Should succeed with 201.
         */
        ConnectionParams userConnectionParams = createConnectionParams(clusterAdminName, clusterAdminPwd);
        WebRequest webRequest = new CreateConfigurationWebRequest(userConnectionParams, configParams);
        WebResponse webResponse = webRequest.getResponse();
        assertEquals(HttpStatus.SC_CREATED, webResponse.getStatusCode());

        /**
         * Delete the user
         */
        RestApiUtils.executeRequest(new DeleteUserWebRequest(adminConnectionParams, clusterAdminName));
    }
Creates a user with cluster administrator privilege and adds a cluster configuration.

@throws Exception
ambari-funtest/src/test/java/org/apache/ambari/funtest/server/tests/RoleBasedAccessControlBasicTest.java