org.wso2.carbon.identity.user.registration.stub.UserRegistrationAdminServiceStub Java Examples

The following examples show how to use org.wso2.carbon.identity.user.registration.stub.UserRegistrationAdminServiceStub. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: UserSignUpWorkflowExecutorTest.java    From carbon-apimgt with Apache License 2.0 6 votes vote down vote up
@Before
public void init() throws Exception {
    ServiceReferenceHolder serviceReferenceHolder = TestUtils.getServiceReferenceHolder();
    RealmService realmService = Mockito.mock(RealmService.class);
    UserRealm userRealm = Mockito.mock(UserRealm.class);
    userStoreManager = Mockito.mock(UserStoreManager.class);
    PowerMockito.mockStatic(CarbonUtils.class);
    userAdminStub = Mockito.mock(UserAdminStub.class);
    userRegistrationAdminServiceStub = Mockito.mock(UserRegistrationAdminServiceStub.class);
    serviceClient =  Mockito.mock(ServiceClient.class);;
    PowerMockito.whenNew(UserAdminStub.class).withAnyArguments().thenReturn(userAdminStub);
    PowerMockito.whenNew(UserRegistrationAdminServiceStub.class).withAnyArguments().thenReturn
            (userRegistrationAdminServiceStub);
    PowerMockito.when(userRegistrationAdminServiceStub._getServiceClient()).thenReturn(serviceClient);
    Mockito.when(serviceClient.getOptions()).thenReturn(new Options());
    Mockito.when(serviceReferenceHolder.getRealmService()).thenReturn(realmService);
    Mockito.when(realmService.getBootstrapRealm()).thenReturn(userRealm);
    Mockito.when(userRealm.getUserStoreManager()).thenReturn(userStoreManager);
    PowerMockito.doNothing().when(CarbonUtils.class, "setBasicAccessSecurityHeaders", Mockito.anyString(),
            Mockito.anyString(), Mockito.anyBoolean(), (ServiceClient) Mockito.anyObject());
    FlaggedName flaggedName = new FlaggedName();
    flaggedName.setSelected(true);
    flaggedName.setItemName(role);
    flaggedNames = new FlaggedName[]{flaggedName};
}
 
Example #2
Source File: UserRegistrationAdminServiceClient.java    From carbon-identity-framework with Apache License 2.0 5 votes vote down vote up
public UserRegistrationAdminServiceClient() throws AxisFault {

        StringBuilder builder = new StringBuilder();
        String serviceURL = null;

        serviceURL = builder.append(TenantDataManager.getPropertyValue(Constants.SERVICES_URL)).append
                (Constants.UserRegistrationConstants.USER_REGISTRATION_SERVICE).toString().replaceAll("(?<!(http:|https:))//", "/");

        stub = new UserRegistrationAdminServiceStub(serviceURL);

        ServiceClient client = stub._getServiceClient();
        Options option = client.getOptions();
        option.setManageSession(true);
    }
 
Example #3
Source File: UserRegistrationAdminServiceClient.java    From carbon-identity-framework with Apache License 2.0 5 votes vote down vote up
public UserRegistrationAdminServiceClient() throws AxisFault {

        StringBuilder builder = new StringBuilder();
        String serviceURL = null;

        serviceURL = builder.append(IdentityManagementServiceUtil.getInstance().getServiceContextURL())
                            .append(IdentityManagementEndpointConstants.ServiceEndpoints.USER_REGISTRATION_SERVICE)
                            .toString().replaceAll("(?<!(http:|https:))//", "/");

        stub = new UserRegistrationAdminServiceStub(serviceURL);
        ServiceClient client = stub._getServiceClient();
        Options option = client.getOptions();
        option.setManageSession(true);
    }
 
Example #4
Source File: UserRegistrationAdminServiceClient.java    From carbon-identity with Apache License 2.0 5 votes vote down vote up
public UserRegistrationAdminServiceClient() throws AxisFault {

        StringBuilder builder = new StringBuilder();
        String serviceURL = null;

        serviceURL = builder.append(TenantDataManager.getPropertyValue(Constants.SERVICES_URL)).append
                (Constants.UserRegistrationConstants.USER_REGISTRATION_SERVICE).toString().replaceAll("(?<!(http:|https:))//", "/");

        stub = new UserRegistrationAdminServiceStub(serviceURL);

        ServiceClient client = stub._getServiceClient();
        Options option = client.getOptions();
        option.setManageSession(true);
    }
 
Example #5
Source File: UserSignUpWorkflowExecutor.java    From carbon-apimgt with Apache License 2.0 5 votes vote down vote up
/**
 * Method to add user to userStore
 * @param serverURL
 * @param userDTO
 * @throws Exception
 */
public void addUserToUserStore(String serverURL, UserDTO userDTO) throws RemoteException, UserRegistrationAdminServiceException {
	if (log.isDebugEnabled()) {
		log.debug("Adding to user store user :" + userDTO.getUserName());
	}
       UserRegistrationAdminServiceStub stub = new UserRegistrationAdminServiceStub(null, serverURL +
               "UserRegistrationAdminService");
       ServiceClient client = stub._getServiceClient();
       Options option = client.getOptions();
       option.setManageSession(true);

       stub.addUser(userDTO);

}