Skip to content

Commit

Permalink
Test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
GihanAyesh committed Dec 12, 2023
1 parent 96b8beb commit 020dc14
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ public void testLoadingDefaultTenantWorkflowConfig() throws IOException, XMLStre
Mockito.when(apimConfigService.getWorkFlowConfig(tenantDomain)).thenReturn(IOUtils.toString(defaultWFConfigContent));
try {
tenantWorkflowConfigHolder.load();
Assert.assertNotNull(tenantWorkflowConfigHolder.getWorkflowExecutor("AM_REVISION_DEPLOYMENT"));
Assert.assertNotNull(tenantWorkflowConfigHolder.getWorkflowExecutor("AM_APPLICATION_CREATION"));
Assert.assertNotNull(tenantWorkflowConfigHolder.getWorkflowExecutor
("AM_APPLICATION_REGISTRATION_PRODUCTION"));
Expand All @@ -100,6 +101,7 @@ public void testLoadingExtendedTenantWorkflowConfig() throws IOException, XMLStr
Mockito.when(apimConfigService.getWorkFlowConfig(tenantDomain)).thenReturn(IOUtils.toString(defaultWFConfigContent));
try {
tenantWorkflowConfigHolder.load();
Assert.assertNotNull(tenantWorkflowConfigHolder.getWorkflowExecutor("AM_REVISION_DEPLOYMENT"));
Assert.assertNotNull(tenantWorkflowConfigHolder.getWorkflowExecutor("AM_APPLICATION_CREATION"));
Assert.assertNotNull(tenantWorkflowConfigHolder.getWorkflowExecutor
("AM_APPLICATION_REGISTRATION_PRODUCTION"));
Expand Down Expand Up @@ -131,6 +133,7 @@ public void testFailureToLoadTenantWFConfigWhenErrorWhileLoadingRegistryResource
public void testFailureToLoadTenantWFConfigWhenWFExecutorClassNotFound() throws Exception {
//For signup workflow we set TestUserSignUpSimpleWorkflowExecutor. since it is not there, default signup executor should be used.
String invalidWFExecutor = "<WorkFlowExtensions>\n"
+ " <APIRevisionDeployment executor=\"org.wso2.carbon.apimgt.impl.workflow.APIRevisionDeploymentSimpleWorkflowExecutor\"/>\n"
+ " <ApplicationCreation executor=\"org.wso2.carbon.apimgt.impl.workflow.ApplicationCreationSimpleWorkflowExecutor\"/>\n"
+ " <ProductionApplicationRegistration executor=\"org.wso2.carbon.apimgt.impl.workflow.ApplicationRegistrationSimpleWorkflowExecutor\"/>\n"
+ " <SandboxApplicationRegistration executor=\"org.wso2.carbon.apimgt.impl.workflow.ApplicationRegistrationSimpleWorkflowExecutor\"/>\n"
Expand Down Expand Up @@ -278,6 +281,8 @@ public void testFailureToLoadTenantWFConfigWhenWFExecutorHasMultipleParamTypes()
//Workflow executor class setter methods are available for different parameter types
String invalidWFExecutor =
"<WorkFlowExtensions>\n" +
" <APIRevisionDeployment executor=\"org.wso2.carbon.apimgt.impl.workflow." +
"APIRevisionDeploymentSimpleWorkflowExecutor\"/>\n" +
" <ApplicationCreation executor=\"org.wso2.carbon.apimgt.impl.workflow" +
".WorkflowExecutorWithMultipleParamTypes\">\n" +
" <Property name=\"stringParam\">admin</Property>\n" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ INSERT INTO AM_CERTIFICATE_METADATA VALUES (1001, 'ALIAS_2','EP_2',RAWTOHEX('abc
INSERT INTO AM_CERTIFICATE_METADATA VALUES (1002, 'ALIAS_3','EP_3',RAWTOHEX('abcdefghtij'));
INSERT INTO AM_CERTIFICATE_METADATA VALUES (1002, 'ALIAS_4','EP_4',RAWTOHEX('abcdefghtij'));

INSERT INTO AM_WORKFLOWS VALUES (1, '821b9664-eeca-4173-9f56-3dc6d46bd6eb', 'AM_REVISION_DEPLOYMENT', 'CREATED', '2017-01-01 00:00:00', '2017-01-01 00:00:00', 'sampleDescription', 1, 'sampleDomain', '821b9664-eeca-4173-9f56-3dc6d46bd6e5', null, null);
INSERT INTO AM_WORKFLOWS (WF_ID, WF_REFERENCE, WF_TYPE, WF_STATUS, WF_CREATED_TIME, WF_UPDATED_TIME, WF_STATUS_DESC, TENANT_ID, TENANT_DOMAIN, WF_EXTERNAL_REFERENCE, WF_METADATA, WF_PROPERTIES) VALUES (5, '821b9664-eeca-4173-9f56-3dc6d46bd6eb', 'AM_REVISION_DEPLOYMENT', 'CREATED', '2017-01-01 00:00:00','2017-01-01 00:00:00', 'sampleDescription', -1234, 'sampleDomain', '821b9664-eeca-4173-9f56-3dc6d46bd6e5', null, null);

INSERT INTO AM_REVISION VALUES (5,'7af95c9d-6177-4191-ab3e-d3f6c1cdc4c2', '821b9664-eeca-4173-9f56-3dc6d46bd6eb', 'sampleDescription','2017-01-01 00:00:00', 'admin');
INSERT INTO AM_REVISION VALUES (5,'696430b1-c554-4d82-8ea9-ea1a61db0a60', '821b9664-eeca-4173-9f56-3dc6d46bd6e3', 'sampleDescription','2017-01-01 00:00:00', 'admin');
INSERT INTO AM_REVISION (ID, API_UUID, REVISION_UUID, DESCRIPTION, CREATED_TIME, CREATED_BY) VALUES (5, '7af95c9d-6177-4191-ab3e-d3f6c1cdc4c2', '821b9664-eeca-4173-9f56-3dc6d46bd6eb', 'sampleDescription', '2017-01-01 00:00:00', 'admin');
INSERT INTO AM_REVISION (ID, API_UUID, REVISION_UUID, DESCRIPTION, CREATED_TIME, CREATED_BY) VALUES (5, '696430b1-c554-4d82-8ea9-ea1a61db0a60', '821b9664-eeca-4173-9f56-3dc6d46bd6e3', 'sampleDescription', '2017-01-01 00:00:00', 'admin');

INSERT INTO AM_DEPLOYMENT_REVISION_MAPPING VALUES ('default','testVhost', '821b9664-eeca-4173-9f56-3dc6d46bd6eb', 'CREATED', TRUE, '2017-01-01 00:00:00');
INSERT INTO AM_DEPLOYMENT_REVISION_MAPPING VALUES ('default','testVhost', '821b9664-eeca-4173-9f56-3dc6d46bd6e3', 'APPROVED', TRUE, '2017-01-01 00:00:00');
INSERT INTO AM_DEPLOYMENT_REVISION_MAPPING (NAME, VHOST, REVISION_UUID, REVISION_STATUS, DISPLAY_ON_DEVPORTAL, DEPLOYED_TIME) VALUES ('default', 'testVhost', '821b9664-eeca-4173-9f56-3dc6d46bd6eb', 'CREATED', TRUE, '2017-01-01 00:00:00');
INSERT INTO AM_DEPLOYMENT_REVISION_MAPPING (NAME, VHOST, REVISION_UUID, REVISION_STATUS, DISPLAY_ON_DEVPORTAL, DEPLOYED_TIME) VALUES ('default', 'testVhost', '821b9664-eeca-4173-9f56-3dc6d46bd6e3', 'APPROVED', TRUE, '2017-01-01 00:00:00');

INSERT INTO AM_POLICY_SUBSCRIPTION (NAME, DISPLAY_NAME, TENANT_ID, QUOTA_TYPE, QUOTA, UNIT_TIME, TIME_UNIT,BILLING_PLAN) VALUES ('Gold', 'Gold', -1234, 'requestCount', 2, 1, 'min', 'Free');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
-->

<WorkFlowExtensions>
<APIRevisionDeployment executor="org.wso2.carbon.apimgt.impl.workflow.APIRevisionDeploymentSimpleWorkflowExecutor"/>
<!--APIRevisionDeployment executor="org.wso2.carbon.apimgt.impl.workflow.APIRevisionDeploymentApprovalWorkflowExecutor"/-->
<ApplicationCreation executor="org.wso2.carbon.apimgt.impl.workflow.ApplicationCreationSimpleWorkflowExecutor"/>
<!--ApplicationCreation executor="org.wso2.carbon.apimgt.impl.workflow.ApplicationCreationWSWorkflowExecutor">
<Property name="serviceEndpoint">http://localhost:9765/services/ApplicationApprovalWorkFlowProcess/</Property>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
-->

<WorkFlowExtensions>
<APIRevisionDeployment executor="org.wso2.carbon.apimgt.impl.workflow.APIRevisionDeploymentSimpleWorkflowExecutor"/>
<ApplicationCreation executor="org.wso2.carbon.apimgt.impl.workflow.ApplicationCreationWSWorkflowExecutor">
<Property name="serviceEndpoint">http://localhost:9765/services/ApplicationApprovalWorkFlowProcess/</Property>
<Property name="username">admin</Property>
Expand Down

0 comments on commit 020dc14

Please sign in to comment.