use of org.wso2.carbon.apimgt.core.models.WorkflowConfig in project carbon-apimgt by wso2.
the class WorkflowConfigHolder method load.
public void load() throws WorkflowException {
workflowExecutorMap = new ConcurrentHashMap<>();
try {
WorkflowConfig config = WorkflowExtensionsConfigBuilder.getWorkflowConfig();
// Load application creation workflow configurations
loadWorkflowConfigurations(config.getApplicationCreation(), WorkflowConstants.WF_TYPE_AM_APPLICATION_CREATION);
// Load application deletion workflow configurations
loadWorkflowConfigurations(config.getApplicationDeletion(), WorkflowConstants.WF_TYPE_AM_APPLICATION_DELETION);
// Load subscription creation workflow configurations
loadWorkflowConfigurations(config.getSubscriptionCreation(), WorkflowConstants.WF_TYPE_AM_SUBSCRIPTION_CREATION);
// Load subscription deletion workflow configurations
loadWorkflowConfigurations(config.getSubscriptionDeletion(), WorkflowConstants.WF_TYPE_AM_SUBSCRIPTION_DELETION);
// Load api state change workflow configurations
loadWorkflowConfigurations(config.getApiStateChange(), WorkflowConstants.WF_TYPE_AM_API_STATE);
// Load application update workflow configurations
loadWorkflowConfigurations(config.getApplicationUpdate(), WorkflowConstants.WF_TYPE_AM_APPLICATION_UPDATE);
} catch (ClassNotFoundException e) {
handleException("Unable to find class", e);
} catch (InstantiationException e) {
handleException("Unable to instantiate class", e);
} catch (IllegalAccessException e) {
handleException("Illegal attempt to invoke class methods", e);
} catch (WorkflowException e) {
handleException("Unable to load workflow executor class", e);
}
}
use of org.wso2.carbon.apimgt.core.models.WorkflowConfig in project carbon-apimgt by wso2.
the class WorkflowExtensionsConfigBuilderTestCase method testWorkflowConfigWithoutConfigFile.
@Test(description = "Test situation where workflow config file loading during a missing config file")
public void testWorkflowConfigWithoutConfigFile() {
WorkflowConfig config = WorkflowExtensionsConfigBuilder.getWorkflowConfig();
Assert.assertNotNull(config.getApplicationCreation(), "Default application creation workflow not set");
Assert.assertNotNull(config.getSubscriptionCreation(), "Default subscription creation workflow not set");
Assert.assertNotNull(config.getApplicationDeletion(), "Default application deletion workflow not set");
Assert.assertNotNull(config.getSubscriptionDeletion(), "Default subscription deletion workflow not set");
WorkflowExtensionsConfigBuilder obj = new WorkflowExtensionsConfigBuilder();
Assert.assertNotNull(obj);
}
use of org.wso2.carbon.apimgt.core.models.WorkflowConfig in project carbon-apimgt by wso2.
the class ConfigurationsAPITestCase method setup.
@BeforeTest
public void setup() throws Exception {
WorkflowExtensionsConfigBuilder.build(new ConfigProvider() {
@Override
public <T> T getConfigurationObject(Class<T> configClass) throws ConfigurationException {
T workflowConfig = (T) new WorkflowConfig();
return workflowConfig;
}
@Override
public Object getConfigurationObject(String s) throws ConfigurationException {
return null;
}
public <T> T getConfigurationObject(String s, Class<T> aClass) throws ConfigurationException {
return null;
}
});
ConfigProvider configProvider = Mockito.mock(ConfigProvider.class);
ServiceReferenceHolder.getInstance().setConfigProvider(configProvider);
}
use of org.wso2.carbon.apimgt.core.models.WorkflowConfig in project carbon-apimgt by wso2.
the class WorkflowConfigHolder method loadWorkflowConfigurations.
private void loadWorkflowConfigurations(WorkflowExecutorInfo workflowConfig, String workflowExecutorType) throws ClassNotFoundException, IllegalAccessException, InstantiationException, WorkflowException {
String executorClass = workflowConfig.getExecutor();
Class clazz = WorkflowConfigHolder.class.getClassLoader().loadClass(executorClass);
WorkflowExecutor workFlowExecutor = (WorkflowExecutor) clazz.newInstance();
List<WorkflowConfigProperties> properties = workflowConfig.getProperty();
if (properties != null) {
loadProperties(properties, workFlowExecutor);
}
workflowExecutorMap.put(workflowExecutorType, workFlowExecutor);
}
use of org.wso2.carbon.apimgt.core.models.WorkflowConfig in project carbon-apimgt by wso2.
the class APIPublisherImplTestCase method init.
@BeforeClass
void init() {
File temp = Files.createTempDir();
temp.deleteOnExit();
System.setProperty("gwHome", temp.getAbsolutePath());
// Set the resource path, where contain composer test JS
System.setProperty("carbon.home", new File("src/test/resources").getAbsolutePath());
WorkflowExtensionsConfigBuilder.build(new ConfigProvider() {
@Override
public <T> T getConfigurationObject(Class<T> configClass) throws ConfigurationException {
T workflowConfig = (T) new WorkflowConfig();
return workflowConfig;
}
@Override
public Object getConfigurationObject(String s) throws ConfigurationException {
return null;
}
public <T> T getConfigurationObject(String s, Class<T> aClass) throws ConfigurationException {
return null;
}
});
}
Aggregations