Search in sources :

Example 1 with ResourceTypeAdd

use of org.wso2.carbon.identity.configuration.mgt.core.model.ResourceTypeAdd in project carbon-identity-framework by wso2.

the class ConfigurationManagerTest method testAddDuplicateResourceType.

@Test(priority = 2, expectedExceptions = ConfigurationManagementClientException.class)
public void testAddDuplicateResourceType() throws Exception {
    ResourceTypeAdd resourceTypeAdd = getSampleResourceTypeAdd();
    configurationManager.addResourceType(resourceTypeAdd);
    configurationManager.addResourceType(resourceTypeAdd);
    fail("Expected: " + ConfigurationManagementClientException.class.getName());
}
Also used : ResourceTypeAdd(org.wso2.carbon.identity.configuration.mgt.core.model.ResourceTypeAdd) TestUtils.getSampleResourceTypeAdd(org.wso2.carbon.identity.configuration.mgt.core.util.TestUtils.getSampleResourceTypeAdd) Test(org.testng.annotations.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 2 with ResourceTypeAdd

use of org.wso2.carbon.identity.configuration.mgt.core.model.ResourceTypeAdd in project carbon-identity-framework by wso2.

the class ConfigurationManagerTest method testAddResource.

@Test(priority = 9)
public void testAddResource() throws Exception {
    ResourceType resourceType = configurationManager.addResourceType(getSampleResourceTypeAdd());
    ResourceAdd resourceTypeAdd = getSampleResource1Add();
    Resource resource = configurationManager.addResource(resourceType.getName(), resourceTypeAdd);
    assertNotNull(resource.getResourceId(), "Created resource type id cannot be null");
}
Also used : Resource(org.wso2.carbon.identity.configuration.mgt.core.model.Resource) ResourceType(org.wso2.carbon.identity.configuration.mgt.core.model.ResourceType) ResourceAdd(org.wso2.carbon.identity.configuration.mgt.core.model.ResourceAdd) Test(org.testng.annotations.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 3 with ResourceTypeAdd

use of org.wso2.carbon.identity.configuration.mgt.core.model.ResourceTypeAdd in project carbon-identity-framework by wso2.

the class ConfigurationManagerTest method testReplaceExistingResourceType.

@Test(priority = 4)
public void testReplaceExistingResourceType() throws Exception {
    ResourceTypeAdd resourceTypeAdd = getSampleResourceTypeAdd();
    ResourceType resourceTypeCreated = configurationManager.addResourceType(resourceTypeAdd);
    ResourceType resourceTypeReplaced = configurationManager.replaceResourceType(resourceTypeAdd);
    assertEquals("Existing id should be equal to the replaced id", resourceTypeCreated.getId(), resourceTypeReplaced.getId());
}
Also used : ResourceTypeAdd(org.wso2.carbon.identity.configuration.mgt.core.model.ResourceTypeAdd) TestUtils.getSampleResourceTypeAdd(org.wso2.carbon.identity.configuration.mgt.core.util.TestUtils.getSampleResourceTypeAdd) ResourceType(org.wso2.carbon.identity.configuration.mgt.core.model.ResourceType) Test(org.testng.annotations.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 4 with ResourceTypeAdd

use of org.wso2.carbon.identity.configuration.mgt.core.model.ResourceTypeAdd in project carbon-identity-framework by wso2.

the class TestUtils method getSampleResourceType2Add.

public static ResourceTypeAdd getSampleResourceType2Add() {
    ResourceTypeAdd resourceTypeAdd = new ResourceTypeAdd();
    resourceTypeAdd.setName(SAMPLE_RESOURCE_TYPE_NAME2);
    resourceTypeAdd.setDescription(SAMPLE_RESOURCE_TYPE_DESCRIPTION);
    return resourceTypeAdd;
}
Also used : ResourceTypeAdd(org.wso2.carbon.identity.configuration.mgt.core.model.ResourceTypeAdd)

Example 5 with ResourceTypeAdd

use of org.wso2.carbon.identity.configuration.mgt.core.model.ResourceTypeAdd in project carbon-identity-framework by wso2.

the class ConfigStoreBasedTemplateHandler method createResourceType.

private void createResourceType(String templateType) throws ConfigurationManagementException {
    ConfigurationManager configManager = TemplateManagerDataHolder.getInstance().getConfigurationManager();
    ResourceTypeAdd resourceType = new ResourceTypeAdd();
    resourceType.setName(templateType);
    resourceType.setDescription("This is the resource type for " + templateType);
    configManager.addResourceType(resourceType);
}
Also used : ResourceTypeAdd(org.wso2.carbon.identity.configuration.mgt.core.model.ResourceTypeAdd) ConfigurationManager(org.wso2.carbon.identity.configuration.mgt.core.ConfigurationManager)

Aggregations

ResourceTypeAdd (org.wso2.carbon.identity.configuration.mgt.core.model.ResourceTypeAdd)8 ResourceType (org.wso2.carbon.identity.configuration.mgt.core.model.ResourceType)7 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)5 Test (org.testng.annotations.Test)5 TestUtils.getSampleResourceTypeAdd (org.wso2.carbon.identity.configuration.mgt.core.util.TestUtils.getSampleResourceTypeAdd)4 ConfigurationManager (org.wso2.carbon.identity.configuration.mgt.core.ConfigurationManager)1 Resource (org.wso2.carbon.identity.configuration.mgt.core.model.Resource)1 ResourceAdd (org.wso2.carbon.identity.configuration.mgt.core.model.ResourceAdd)1