use of org.wso2.carbon.identity.application.common.model.xsd.ApplicationPermission in project carbon-identity-framework by wso2.
the class ApplicationMgtUtilTest method setup.
@BeforeTest
public void setup() {
mockAppRootNode = mock(Collection.class);
mockRealmConfiguration = mock(RealmConfiguration.class);
applicationPermission = new ApplicationPermission();
applicationPermission.setValue(USERNAME);
applicationPermissions = new ApplicationPermission[] { applicationPermission };
}
use of org.wso2.carbon.identity.application.common.model.xsd.ApplicationPermission in project product-is by wso2.
the class ApplicationManagementTestCase method testUpdateApplicationPermissions.
@Test(alwaysRun = true, description = "2.1.2.9")
public void testUpdateApplicationPermissions() {
String applicationName = "TestServiceProvider";
try {
ServiceProvider serviceProvider = applicationManagementServiceClient.getApplication(applicationName);
PermissionsAndRoleConfig permAndRoleConfig = new PermissionsAndRoleConfig();
List<ApplicationPermission> appPermList = new ArrayList<ApplicationPermission>();
ApplicationPermission appPermission = new ApplicationPermission();
appPermission.setValue("app_permission");
appPermList.add(appPermission);
permAndRoleConfig.setPermissions(appPermList.toArray(new ApplicationPermission[appPermList.size()]));
serviceProvider.setPermissionAndRoleConfig(permAndRoleConfig);
applicationManagementServiceClient.updateApplicationData(serviceProvider);
ServiceProvider updatedServiceProvider = applicationManagementServiceClient.getApplication(applicationName);
PermissionsAndRoleConfig updatedPermissionsAndRoleConfig = updatedServiceProvider.getPermissionAndRoleConfig();
Assert.assertEquals(updatedPermissionsAndRoleConfig.getPermissions()[0].getValue(), "app_permission", "Failed update application permissions");
} catch (Exception e) {
Assert.fail("Error while trying to update Application Permissions", e);
}
}
use of org.wso2.carbon.identity.application.common.model.xsd.ApplicationPermission in project product-is by wso2.
the class ApplicationManagementTestCase method testUpdateApplicationPermissions.
@Test(alwaysRun = true, description = "Testing update Application Permissions")
public void testUpdateApplicationPermissions() {
String applicationName = "TestServiceProvider";
try {
ServiceProvider serviceProvider = applicationManagementServiceClient.getApplication(applicationName);
PermissionsAndRoleConfig permAndRoleConfig = new PermissionsAndRoleConfig();
List<ApplicationPermission> appPermList = new ArrayList<ApplicationPermission>();
ApplicationPermission appPermission = new ApplicationPermission();
appPermission.setValue("app_permission");
appPermList.add(appPermission);
permAndRoleConfig.setPermissions(appPermList.toArray(new ApplicationPermission[appPermList.size()]));
serviceProvider.setPermissionAndRoleConfig(permAndRoleConfig);
applicationManagementServiceClient.updateApplicationData(serviceProvider);
ServiceProvider updatedServiceProvider = applicationManagementServiceClient.getApplication(applicationName);
PermissionsAndRoleConfig updatedPermissionsAndRoleConfig = updatedServiceProvider.getPermissionAndRoleConfig();
Assert.assertEquals(updatedPermissionsAndRoleConfig.getPermissions()[0].getValue(), "app_permission", "Failed update application permissions");
} catch (Exception e) {
Assert.fail("Error while trying to update Application Permissions", e);
}
}
Aggregations