FINERACT-1508: Add Cucumber test suppport

This commit is contained in:
Aleksandar Vidakovic
2022-03-18 09:23:15 +01:00
committed by Arnold Gálovics
parent 56824802b3
commit 5232656a6e
82 changed files with 1238 additions and 2978 deletions
@@ -0,0 +1,20 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
cucumber.publish.quiet=true
@@ -0,0 +1,6 @@
Feature: Accounting Service
@accounting
Scenario: Verify financial activities constants
Given All financial activities
Then The they should not be empty
@@ -0,0 +1,7 @@
Feature: Batch Service
@batch
Scenario: Verify that batch builder methods are called
Given A batch request
When The user calls the batch service handle request method without enclosing transaction
Then The batch service handle request method without enclosing transaction should have been called
@@ -0,0 +1,20 @@
Feature: Commands Service
@template
Scenario Outline: Verify that command providers are injected
Given A command handler for entity <entity> and action <action>
When The user processes the command with ID <id>
Then The command ID matches <id>
Examples:
| id | entity | action |
| 815 | HUMAN | UPDATE |
@template
Scenario Outline: Verify that command no command handler is provided
Given A missing command handler for entity <entity> and action <action>
Then The system should throw an exception
Examples:
| entity | action |
| WHATEVER | DOSOMETHING |
@@ -0,0 +1,7 @@
Feature: Classpath duplicates
@infrastructure
Scenario: Verify if any duplicates exist in the classpath
Given A class graph
When The user scans the class graph
Then There should be no duplicates
@@ -0,0 +1,23 @@
Feature: Core Infrastructure
@infrastructure
Scenario: Verify that tenant migration service is properly executed
Given Liquibase is disabled with a default tenant
Given Liquibase runs the very first time for the tenant store
Given A previously Flyway migrated tenant store database
Given A previously Flyway migrated tenant store database on an earlier version than 1.6
Given Liquibase runs the very first time for the default tenant
Given A previously Flyway migrated default tenant database
Given A previously Flyway migrated default tenant database on the 1.6 version
When The database migration process is executed
Then The tenant store upgrade fails with a schema upgrade needed
@infrastructure
Scenario Outline: Verify empty multi exceptions
Given A multi exception with exceptions <exception1> and <exception2>
Then A <expected> should be thrown
Examples:
| exception1 | exception2 | expected |
| | | java.lang.IllegalArgumentException |
| java.lang.IllegalArgumentException | java.lang.IllegalStateException | org.apache.fineract.infrastructure.core.exception.MultiException |
@@ -0,0 +1,35 @@
Feature: SQL Builder
@sqlbuilder
Scenario Outline: Verify that SQL builder has expected template and arguments
Given A criteria <criteria1>, <criteria2>, <criteria3>, <criteria4> and arguments <argument1>, <argument2>, <argument3>, <argument4>
Then The template should match expected template <template>
Then The arguments should match expected arguments <arguments>
Then The builder should match <expected>
Examples:
| criteria1 | argument1 | criteria2 | argument2 | criteria3 | argument3 | criteria4 | argument4 | template | expected |
| | | | | | | | | | SQLBuilder{} |
| name = | Michael | hobby LIKE | Mifos/Apache Fineract | age < | 123 | | | WHERE name = ? AND hobby LIKE ? AND age < ? | SQLBuilder{WHERE name = ['Michael'] AND hobby LIKE ['Mifos/Apache Fineract'] AND age < [123]} |
| ref = | NULL | | | | | | | WHERE ref = ? | SQLBuilder{WHERE ref = [null]} |
| hobby LIKE | Mifos/Apache Fineract | hobby like | Mifos/Apache Fineract | | | | | WHERE hobby LIKE ? AND hobby like ? | |
@sqlbuilder
Scenario Outline: Verify that SQL builder detects illegal criteria
Given An illegal criteria <criteria> with argument <argument>
Then The builder should throw an exception <exception> with message <message>
Examples:
| criteria | argument | message | exception |
| NULL | argument | <NULL> criteria fragment | java.lang.IllegalArgumentException |
| EMPTY | argument | <EMPTY> criteria fragment | java.lang.IllegalArgumentException |
| age< | 123 | Space between column and operator | java.lang.IllegalArgumentException |
| age = ? | 123 | Criteria with placeholder ? | java.lang.IllegalArgumentException |
| age | 123 | Criteria missing operator | java.lang.IllegalArgumentException |
| and age = ? | 123 | Criteria starts with AND | java.lang.IllegalArgumentException |
| age = ? and | 123 | Criteria ends with AND | java.lang.IllegalArgumentException |
| or age = ? | 123 | Criteria start with OR | java.lang.IllegalArgumentException |
| age = ? or | 123 | Criteria ends with OR | java.lang.IllegalArgumentException |
| (age = | 123 | Criteria contains opening parenthesis | java.lang.IllegalArgumentException |
| age = ? | 123 | Criteria contains closing parenthesis | java.lang.IllegalArgumentException |
| age< = ? | 123 | Offset corner case | java.lang.IllegalArgumentException |
@@ -0,0 +1,21 @@
Feature: MIX XBRL
@mix
Scenario Outline: Verify that GL codes resolve
Given A XBRL template <template>
When The user resolves GL codes
Then The result should contain <values>
Examples:
| template | values |
| {12000}+{11000} | 12000,11000 |
@mix
Scenario Outline: Verify XBRL builder is working
Given The XBRL input parameters start date <start>, end date <end>, currency <currency>, taxonomy <taxonomy> and sample <sample>
When The user builds the XBRL report
Then The XBRL result should match <result>
Examples:
| start | end | currency | taxonomy | sample | result |
| 2005-11-11 | 2013-07-17 | USD | Assets | 10000 | xbrl.xml |
@@ -0,0 +1,19 @@
Feature: Loan Product Validation
@loanproduct
Scenario Outline: Verify that loan product settings are throwing expected exceptions
Given A loan product with values `allowMultipleDisbursal` is <allowMultipleDisbursal>, `disallowExpectedDisbursements` is <disallowExpectedDisbursements>, `allowApprovedDisbursedAmountsOverApplied` is <allowApprovedDisbursedAmountsOverApplied>, `overAppliedCalculationType` is <overAppliedCalculationType> and `overAppliedNumber` is <overAppliedNumber>
When The user validates the loan product before saving
Then An exception <exception> with message template <template> should be thrown
Examples:
| allowMultipleDisbursal | disallowExpectedDisbursements | allowApprovedDisbursedAmountsOverApplied | overAppliedCalculationType | overAppliedNumber | exception | template |
| false | true | false | - | -1 | org.apache.fineract.portfolio.loanproduct.exception.LoanProductGeneralRuleException | error.msg.allowMultipleDisbursals.not.set.disallowExpectedDisbursements.cant.be.set |
| true | false | true | - | -1 | org.apache.fineract.portfolio.loanproduct.exception.LoanProductGeneralRuleException | error.msg.disallowExpectedDisbursements.not.set.allowApprovedDisbursedAmountsOverApplied.cant.be.set |
| true | true | true | - | -1 | org.apache.fineract.portfolio.loanproduct.exception.LoanProductGeneralRuleException | error.msg.allowApprovedDisbursedAmountsOverApplied.is.set.overAppliedCalculationType.is.mandatory |
| true | true | true | - | -1 | org.apache.fineract.portfolio.loanproduct.exception.LoanProductGeneralRuleException | error.msg.allowApprovedDisbursedAmountsOverApplied.is.set.overAppliedCalculationType.is.mandatory |
| true | false | true | - | -1 | org.apache.fineract.portfolio.loanproduct.exception.LoanProductGeneralRuleException | error.msg.disallowExpectedDisbursements.not.set.allowApprovedDisbursedAmountsOverApplied.cant.be.set |
| true | true | true | notflat | -1 | org.apache.fineract.portfolio.loanproduct.exception.LoanProductGeneralRuleException | error.msg.overAppliedCalculationType.must.be.percentage.or.flat |
| true | true | false | flat | -1 | org.apache.fineract.portfolio.loanproduct.exception.LoanProductGeneralRuleException | error.msg.allowApprovedDisbursedAmountsOverApplied.is.not.set.overAppliedCalculationType.cant.be.entered |
| true | true | true | flat | -1 | org.apache.fineract.portfolio.loanproduct.exception.LoanProductGeneralRuleException | error.msg.allowApprovedDisbursedAmountsOverApplied.is.set.overAppliedNumber.is.mandatory |
| true | true | false | - | 80 | org.apache.fineract.portfolio.loanproduct.exception.LoanProductGeneralRuleException | error.msg.allowApprovedDisbursedAmountsOverApplied.is.not.set.overAppliedNumber.cant.be.entered |
@@ -0,0 +1,15 @@
Feature: Template Service
@template
Scenario Outline: Verify that mustache templates have expected results
Given A mustache template file <template>
Given A JSON data file <json>
When The user merges the template with data
Then The result should match the content of file <result>
Examples:
| template | json | result |
| hello.mustache | hello.json | hello.txt |
| loan.mustache | loan.json | loan.html |
| array.loop.mustache | array.json | array.loop.txt |
| array.index.mustache | array.json | array.index.txt |
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<configuration scan="false">
<contextListener class="ch.qos.logback.classic.jul.LevelChangePropagator">
<resetJUL>false</resetJUL>
</contextListener>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<withJansi>true</withJansi>
<encoder>
<pattern>%green(%d{yyyy-MM-dd HH:mm:ss.SSS}) [%thread] %highlight(%-5level) %cyan(%logger{36}) - %msg%n</pattern>
</encoder>
</appender>
<logger name="org.springframework.transaction" level="INFO" />
<logger name="org.springframework.data.convert" level="ERROR" />
<logger name="org.springframework.http.converter.json" level="ERROR" />
<root level="INFO">
<appender-ref ref="STDOUT" />
</root>
</configuration>
@@ -0,0 +1 @@
Hello Test for Template Terence & Michael!
@@ -0,0 +1 @@
Hello Test for Template Michael Terence!
@@ -0,0 +1 @@
Hello Test for Template hello!
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<xbrl><schemaRef xmlns:link="http://www.themix.org/sites/default/files/Taxonomy2010/dct/dc-all_2010-08-31.xsd"></schemaRef><Assets contextRef="As_Of_07_17_20131" unitRef="Unit2" decimals="0">10000</Assets><context id="As_Of_07_17_20131"><entity><identifier scheme="http://www.themix.org">000000</identifier></entity><period><instant>2013-07-17</instant></period></context><unit id="Unit2"><measure>iso4217:USD</measure></unit><unit id="Unit1"><measure>xbrli:pure</measure></unit></xbrl>
@@ -0,0 +1 @@
Hello Test for Template {{data.name#1}} & {{data.name#0}}!
@@ -0,0 +1,8 @@
{
"data": {
"name": [
"Michael",
"Terence"
]
}
}
@@ -0,0 +1 @@
Hello Test for Template{{#data.name}} {{.}}{{/data.name}}!
@@ -0,0 +1,5 @@
{
"file": {
"name": "hello"
}
}
@@ -0,0 +1 @@
Hello Test for Template {{file.name}}!
@@ -0,0 +1,22 @@
{
"installments": [
{
"dueDate": "2012-07-02",
"installmentNumber": "1",
"principal": "",
"feeChargesCharged": ""
},
{
"dueDate": "2012-08-02",
"installmentNumber": "2",
"principal": "",
"feeChargesCharged": ""
},
{
"dueDate": "2012-09-02",
"installmentNumber": "3",
"principal": "",
"feeChargesCharged": ""
}
]
}