Search in sources :

Example 16 with APIPersistence

use of org.wso2.carbon.apimgt.persistence.APIPersistence in project carbon-apimgt by wso2.

the class PersistenceManager method getPersistenceInstance.

public static APIPersistence getPersistenceInstance(Map<String, String> configs, Properties properties) {
    if (log.isDebugEnabled()) {
        log.debug("Persistence configs " + Arrays.asList(configs));
    }
    if (persistence == null) {
        ServiceReferenceHolder serviceReferenceHolder = ServiceReferenceHolder.getInstance();
        serviceReferenceHolder.setPersistenceConfigs(configs);
        if (serviceReferenceHolder.getApiPersistence() != null) {
            persistence = serviceReferenceHolder.getApiPersistence();
        } else {
            if (persistence == null) {
                persistence = new RegistryPersistenceImpl(properties);
            }
        }
    }
    return persistence;
}
Also used : ServiceReferenceHolder(org.wso2.carbon.apimgt.persistence.internal.ServiceReferenceHolder)

Aggregations

Test (org.junit.Test)15 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)15 Organization (org.wso2.carbon.apimgt.persistence.dto.Organization)15 Registry (org.wso2.carbon.registry.core.Registry)15 UserRegistry (org.wso2.carbon.registry.core.session.UserRegistry)15 Matchers.anyString (org.mockito.Matchers.anyString)14 GenericArtifact (org.wso2.carbon.governance.api.generic.dataobjects.GenericArtifact)12 Resource (org.wso2.carbon.registry.core.Resource)12 ResourceImpl (org.wso2.carbon.registry.core.ResourceImpl)10 GenericArtifactManager (org.wso2.carbon.governance.api.generic.GenericArtifactManager)8 Tag (org.wso2.carbon.registry.core.Tag)7 ServiceReferenceHolder (org.wso2.carbon.apimgt.persistence.internal.ServiceReferenceHolder)4 ArrayList (java.util.ArrayList)3 DevPortalAPI (org.wso2.carbon.apimgt.persistence.dto.DevPortalAPI)3 PublisherAPI (org.wso2.carbon.apimgt.persistence.dto.PublisherAPI)3 PublisherAPIProduct (org.wso2.carbon.apimgt.persistence.dto.PublisherAPIProduct)3 UserContext (org.wso2.carbon.apimgt.persistence.dto.UserContext)3 CarbonContext (org.wso2.carbon.context.CarbonContext)3 PrivilegedCarbonContext (org.wso2.carbon.context.PrivilegedCarbonContext)3 GovernanceArtifact (org.wso2.carbon.governance.api.common.dataobjects.GovernanceArtifact)3