Search in sources :

Example 51 with ResourceType

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

the class ConfigurationManagerTest method testDeleteExistingAttribute.

@Test(priority = 25, expectedExceptions = ConfigurationManagementClientException.class)
public void testDeleteExistingAttribute() throws Exception {
    ResourceType resourceType = configurationManager.addResourceType(getSampleResourceTypeAdd());
    Resource resource = configurationManager.addResource(resourceType.getName(), getSampleResource1Add());
    Attribute createdAttribute = configurationManager.addAttribute(resourceType.getName(), resource.getResourceName(), getSampleAttribute1());
    configurationManager.deleteAttribute(resourceType.getName(), resource.getResourceName(), createdAttribute.getKey());
    configurationManager.getAttribute(resourceType.getName(), resource.getResourceName(), createdAttribute.getKey());
    fail("Expected: " + ConfigurationManagementClientException.class.getName());
}
Also used : Attribute(org.wso2.carbon.identity.configuration.mgt.core.model.Attribute) Resource(org.wso2.carbon.identity.configuration.mgt.core.model.Resource) ResourceType(org.wso2.carbon.identity.configuration.mgt.core.model.ResourceType) Test(org.testng.annotations.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 52 with ResourceType

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

the class ConfigurationManagerTest method testSearchTenantSpecificResources.

@Test(priority = 32)
public void testSearchTenantSpecificResources() throws Exception {
    ResourceType resourceType = configurationManager.addResourceType(getSampleResourceTypeAdd());
    configurationManager.addResource(resourceType.getName(), getSampleResource1Add());
    mockCarbonContextForTenant(SAMPLE_TENANT_ID_ABC, SAMPLE_TENANT_DOMAIN_ABC);
    configurationManager.addResource(resourceType.getName(), getSampleResource2Add());
    mockIdentityTenantUtilForTheTest();
    // Mock carbon context back to the super tenant.
    mockCarbonContextForTenant(SUPER_TENANT_ID, SUPER_TENANT_DOMAIN_NAME);
    ComplexCondition condition = getSampleSearchCondition();
    Resources resources = configurationManager.getTenantResources(SAMPLE_TENANT_DOMAIN_ABC, condition);
    assertTrue(isTenantSearchConditionMatch(resources));
}
Also used : ResourceType(org.wso2.carbon.identity.configuration.mgt.core.model.ResourceType) Resources(org.wso2.carbon.identity.configuration.mgt.core.model.Resources) ComplexCondition(org.wso2.carbon.identity.configuration.mgt.core.search.ComplexCondition) Test(org.testng.annotations.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 53 with ResourceType

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

the class ConfigurationManagerTest method testDeleteNonExistingResource.

@Test(priority = 15, expectedExceptions = ConfigurationManagementClientException.class)
public void testDeleteNonExistingResource() throws Exception {
    ResourceType resourceType = configurationManager.addResourceType(getSampleResourceTypeAdd());
    configurationManager.deleteResource(resourceType.getName(), SAMPLE_RESOURCE_NAME1);
    fail("Expected: " + ConfigurationManagementClientException.class.getName());
}
Also used : ResourceType(org.wso2.carbon.identity.configuration.mgt.core.model.ResourceType) Test(org.testng.annotations.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 54 with ResourceType

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

the class ConfigurationManagerTest method testAddResourceType.

@Test(priority = 1)
public void testAddResourceType() throws Exception {
    ResourceTypeAdd resourceTypeAdd = getSampleResourceTypeAdd();
    ResourceType resourceType = configurationManager.addResourceType(resourceTypeAdd);
    assertNotNull(resourceType.getId(), "Created resource type id cannot be null");
}
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)

Aggregations

ResourceType (org.wso2.carbon.identity.configuration.mgt.core.model.ResourceType)36 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)27 Test (org.testng.annotations.Test)27 Resource (org.wso2.carbon.identity.configuration.mgt.core.model.Resource)22 Attribute (org.wso2.carbon.identity.configuration.mgt.core.model.Attribute)9 InputStream (java.io.InputStream)7 ResourceFile (org.wso2.carbon.identity.configuration.mgt.core.model.ResourceFile)7 IOException (java.io.IOException)6 ArrayList (java.util.ArrayList)6 QName (javax.xml.namespace.QName)6 XMLStreamException (javax.xml.stream.XMLStreamException)6 OMAttribute (org.apache.axiom.om.OMAttribute)6 OMElement (org.apache.axiom.om.OMElement)6 Resources (org.wso2.carbon.identity.configuration.mgt.core.model.Resources)6 Resource (org.wso2.carbon.registry.core.Resource)6 RegistryException (org.wso2.carbon.registry.core.exceptions.RegistryException)6 File (java.io.File)5 APIProductResource (org.wso2.carbon.apimgt.api.model.APIProductResource)4 Mediation (org.wso2.carbon.apimgt.api.model.Mediation)4 JdbcTemplate (org.wso2.carbon.database.utils.jdbc.JdbcTemplate)4