コード例 #1
0
        public virtual void createInitialUser(string id, string password, string firstName, string lastName)
        {
            UserDto            user        = new UserDto();
            UserCredentialsDto credentials = new UserCredentialsDto();

            credentials.Password = password;
            user.Credentials     = credentials;
            UserProfileDto profile = new UserProfileDto();

            profile.Id        = id;
            profile.FirstName = firstName;
            profile.LastName  = lastName;
            user.Profile      = profile;

            WebResource    webResource    = client.resource(testProperties.getApplicationPath("/camunda/api/admin/setup/default/user/create"));
            ClientResponse clientResponse = webResource.accept(MediaType.APPLICATION_JSON).type(MediaType.APPLICATION_JSON).post(typeof(ClientResponse), user);

            try
            {
                if (clientResponse.ResponseStatus != Response.Status.NO_CONTENT)
                {
                    throw new WebApplicationException(clientResponse.ResponseStatus);
                }
            }
            finally
            {
                clientResponse.close();
            }
        }