FINERACT-1724: Make tests more resilient
This commit is contained in:
committed by
Arnold Gálovics
parent
71c11aba3c
commit
c1570049ed
+15
-15
@@ -1326,9 +1326,9 @@ public class BatchApiTest {
|
||||
// creating datatable with m_loan association
|
||||
final Map<String, Object> columnMap = new HashMap<>();
|
||||
final List<HashMap<String, Object>> datatableColumnsList = new ArrayList<>();
|
||||
final String datatableName = Utils.randomNameGenerator(LOAN_APP_TABLE_NAME + "_", 5);
|
||||
final String columnName1 = Utils.randomNameGenerator("COL1_", 5);
|
||||
final String columnName2 = Utils.randomNameGenerator("COL2_", 5);
|
||||
final String datatableName = Utils.uniqueRandomStringGenerator(LOAN_APP_TABLE_NAME + "_", 5);
|
||||
final String columnName1 = Utils.randomStringGenerator("COL1_", 5);
|
||||
final String columnName2 = Utils.randomStringGenerator("COL2_", 5);
|
||||
columnMap.put("datatableName", datatableName);
|
||||
columnMap.put("apptableName", LOAN_APP_TABLE_NAME);
|
||||
columnMap.put("entitySubType", "PERSON");
|
||||
@@ -1343,8 +1343,8 @@ public class BatchApiTest {
|
||||
|
||||
// Create a datatable entry so that it can be updated using BatchApi
|
||||
final Map<String, Object> datatableEntryMap = new HashMap<>();
|
||||
datatableEntryMap.put(columnName1, Utils.randomNameGenerator("VAL1_", 3));
|
||||
datatableEntryMap.put(columnName2, Utils.randomNameGenerator("VAL2_", 3));
|
||||
datatableEntryMap.put(columnName1, Utils.randomStringGenerator("VAL1_", 3));
|
||||
datatableEntryMap.put(columnName2, Utils.randomStringGenerator("VAL2_", 3));
|
||||
final String datatableEntryRequestJsonString = new Gson().toJson(datatableEntryMap);
|
||||
LOG.info("CreateDataTableEntry map : {}", datatableEntryRequestJsonString);
|
||||
|
||||
@@ -1923,7 +1923,7 @@ public class BatchApiTest {
|
||||
*/
|
||||
@Test
|
||||
public void shouldFindOneToOneDatatableEntryByQueryAPIAndUpdateOneOfItsColumn() {
|
||||
final String datatableName = Utils.randomNameGenerator(LOAN_APP_TABLE_NAME + "_", 5).toLowerCase();
|
||||
final String datatableName = Utils.uniqueRandomStringGenerator(LOAN_APP_TABLE_NAME + "_", 5).toLowerCase();
|
||||
|
||||
final FromJsonHelper jsonHelper = new FromJsonHelper();
|
||||
final Long loanId = jsonHelper.extractLongNamed("loanId", jsonHelper.parse(setupAccount()).getAsJsonObject());
|
||||
@@ -1931,8 +1931,8 @@ public class BatchApiTest {
|
||||
final Map<String, Object> columnMap = new HashMap<>();
|
||||
final List<HashMap<String, Object>> datatableColumnsList = new ArrayList<>();
|
||||
|
||||
final String columnName1 = Utils.randomNameGenerator("COL1_", 5).toLowerCase();
|
||||
final String columnName2 = Utils.randomNameGenerator("COL2_", 5).toLowerCase();
|
||||
final String columnName1 = Utils.randomStringGenerator("COL1_", 5).toLowerCase();
|
||||
final String columnName2 = Utils.randomStringGenerator("COL2_", 5).toLowerCase();
|
||||
columnMap.put("datatableName", datatableName);
|
||||
columnMap.put("apptableName", LOAN_APP_TABLE_NAME);
|
||||
columnMap.put("entitySubType", "PERSON");
|
||||
@@ -1947,8 +1947,8 @@ public class BatchApiTest {
|
||||
|
||||
// Create a datatable entry so that it can be updated using BatchApi
|
||||
final Map<String, Object> datatableEntryMap = new HashMap<>();
|
||||
String columnValue1 = Utils.randomNameGenerator("VAL1_", 3);
|
||||
String columnValue2 = Utils.randomNameGenerator("VAL2_", 3);
|
||||
String columnValue1 = Utils.randomStringGenerator("VAL1_", 3);
|
||||
String columnValue2 = Utils.randomStringGenerator("VAL2_", 3);
|
||||
datatableEntryMap.put(columnName1, columnValue1);
|
||||
datatableEntryMap.put(columnName2, columnValue2);
|
||||
final String datatableEntryRequestJsonString = new Gson().toJson(datatableEntryMap);
|
||||
@@ -1990,7 +1990,7 @@ public class BatchApiTest {
|
||||
*/
|
||||
@Test
|
||||
public void shouldFindOneToManyDatatableEntryByQueryAPIAndUpdateOneOfItsColumn() {
|
||||
final String datatableName = Utils.randomNameGenerator(LOAN_APP_TABLE_NAME + "_", 5).toLowerCase();
|
||||
final String datatableName = Utils.uniqueRandomStringGenerator(LOAN_APP_TABLE_NAME + "_", 5).toLowerCase();
|
||||
|
||||
final FromJsonHelper jsonHelper = new FromJsonHelper();
|
||||
final Long loanId = jsonHelper.extractLongNamed("loanId", jsonHelper.parse(setupAccount()).getAsJsonObject());
|
||||
@@ -1998,8 +1998,8 @@ public class BatchApiTest {
|
||||
final Map<String, Object> columnMap = new HashMap<>();
|
||||
final List<HashMap<String, Object>> datatableColumnsList = new ArrayList<>();
|
||||
|
||||
final String columnName1 = Utils.randomNameGenerator("COL1_", 5).toLowerCase();
|
||||
final String columnName2 = Utils.randomNameGenerator("COL2_", 5).toLowerCase();
|
||||
final String columnName1 = Utils.randomStringGenerator("COL1_", 5).toLowerCase();
|
||||
final String columnName2 = Utils.randomStringGenerator("COL2_", 5).toLowerCase();
|
||||
columnMap.put("datatableName", datatableName);
|
||||
columnMap.put("apptableName", LOAN_APP_TABLE_NAME);
|
||||
columnMap.put("entitySubType", "PERSON");
|
||||
@@ -2014,8 +2014,8 @@ public class BatchApiTest {
|
||||
|
||||
// Create a datatable entry so that it can be updated using BatchApi
|
||||
final Map<String, Object> datatableEntryMap = new HashMap<>();
|
||||
String columnValue1 = Utils.randomNameGenerator("VAL1_", 3);
|
||||
String columnValue2 = Utils.randomNameGenerator("VAL2_", 3);
|
||||
String columnValue1 = Utils.randomStringGenerator("VAL1_", 3);
|
||||
String columnValue2 = Utils.randomStringGenerator("VAL2_", 3);
|
||||
datatableEntryMap.put(columnName1, columnValue1);
|
||||
datatableEntryMap.put(columnName2, columnValue2);
|
||||
final String datatableEntryRequestJsonString = new Gson().toJson(datatableEntryMap);
|
||||
|
||||
+6
-5
@@ -30,6 +30,7 @@ import java.sql.Timestamp;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.UUID;
|
||||
import org.apache.fineract.integrationtests.common.CenterDomain;
|
||||
import org.apache.fineract.integrationtests.common.CenterHelper;
|
||||
import org.apache.fineract.integrationtests.common.GroupHelper;
|
||||
@@ -86,7 +87,7 @@ public class CenterIntegrationTest {
|
||||
|
||||
int officeId = new OfficeHelper(requestSpec, responseSpec).createOffice("01 July 2007");
|
||||
String name = "TestFullCreation" + new Timestamp(new java.util.Date().getTime());
|
||||
String externalId = Utils.randomStringGenerator("ID_", 7, "ABCDEFGHIJKLMNOPQRSTUVWXYZ");
|
||||
String externalId = UUID.randomUUID().toString();
|
||||
int staffId = StaffHelper.createStaff(requestSpec, responseSpec);
|
||||
int[] groupMembers = generateGroupMembers(3, officeId);
|
||||
int resourceId = CenterHelper.createCenter(name, officeId, externalId, staffId, groupMembers, requestSpec, responseSpec);
|
||||
@@ -126,13 +127,13 @@ public class CenterIntegrationTest {
|
||||
public void testCenterUpdate() {
|
||||
int officeId = new OfficeHelper(requestSpec, responseSpec).createOffice("01 July 2007");
|
||||
String name = "TestFullCreation" + new Timestamp(new java.util.Date().getTime());
|
||||
String externalId = Utils.randomStringGenerator("ID_", 7, "ABCDEFGHIJKLMNOPQRSTUVWXYZ");
|
||||
String externalId = UUID.randomUUID().toString();
|
||||
int staffId = StaffHelper.createStaff(requestSpec, responseSpec);
|
||||
int[] groupMembers = generateGroupMembers(3, officeId);
|
||||
int resourceId = CenterHelper.createCenter(name, officeId, externalId, staffId, groupMembers, requestSpec, responseSpec);
|
||||
|
||||
String newName = "TestCenterUpdateNew" + new Timestamp(new java.util.Date().getTime());
|
||||
String newExternalId = Utils.randomStringGenerator("newID_", 7, "ABCDEFGHIJKLMNOPQRSTUVWXYZ");
|
||||
String newExternalId = UUID.randomUUID().toString();
|
||||
int newStaffId = StaffHelper.createStaff(requestSpec, responseSpec);
|
||||
int[] associateGroupMembers = generateGroupMembers(2, officeId);
|
||||
|
||||
@@ -185,8 +186,8 @@ public class CenterIntegrationTest {
|
||||
for (int i = 0; i < groupMembers.length; i++) {
|
||||
final HashMap<String, String> map = new HashMap<>();
|
||||
map.put("officeId", "" + officeId);
|
||||
map.put("name", Utils.randomStringGenerator("Group_Name_", 5));
|
||||
map.put("externalId", Utils.randomStringGenerator("ID_", 7, "ABCDEFGHIJKLMNOPQRSTUVWXYZ"));
|
||||
map.put("name", Utils.uniqueRandomStringGenerator("Group_Name_", 5));
|
||||
map.put("externalId", UUID.randomUUID().toString());
|
||||
map.put("dateFormat", "dd MMMM yyyy");
|
||||
map.put("locale", "en");
|
||||
map.put("active", "true");
|
||||
|
||||
+1
-1
@@ -62,7 +62,7 @@ public class ClientAuditingIntegrationTest {
|
||||
@Test
|
||||
public void checkAuditDates() throws InterruptedException {
|
||||
final Integer staffId = StaffHelper.createStaff(this.requestSpec, this.responseSpec);
|
||||
String username = Utils.randomNameGenerator("user", 8);
|
||||
String username = Utils.uniqueRandomStringGenerator("user", 8);
|
||||
final Integer userId = (Integer) UserHelper.createUser(this.requestSpec, this.responseSpec, 1, staffId, username, "password",
|
||||
"resourceId");
|
||||
OffsetDateTime now = OffsetDateTime.now(ZoneId.of("Asia/Kolkata"));
|
||||
|
||||
+3
-2
@@ -28,6 +28,7 @@ import io.restassured.http.ContentType;
|
||||
import io.restassured.specification.RequestSpecification;
|
||||
import io.restassured.specification.ResponseSpecification;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.fineract.client.models.DeleteClientsClientIdResponse;
|
||||
import org.apache.fineract.client.models.GetClientTransferProposalDateResponse;
|
||||
@@ -75,7 +76,7 @@ public class ClientExternalIdTest {
|
||||
@Test
|
||||
public void whenAutoExternalIdConfigIsOffCreateClientWithValue() {
|
||||
// given
|
||||
final String externalId = Utils.randomStringGenerator("ID_", 7);
|
||||
final String externalId = UUID.randomUUID().toString();
|
||||
final String jsonPayload = ClientHelper.getBasicClientAsJSON(ClientHelper.DEFAULT_OFFICE_ID, ClientHelper.LEGALFORM_ID_PERSON,
|
||||
externalId);
|
||||
// when
|
||||
@@ -113,7 +114,7 @@ public class ClientExternalIdTest {
|
||||
// given
|
||||
GlobalConfigurationHelper.manageConfigurations(requestSpec, responseSpec,
|
||||
GlobalConfigurationHelper.ENABLE_AUTOGENERATED_EXTERNAL_ID, true);
|
||||
final String externalId = Utils.randomStringGenerator("ID_", 7);
|
||||
final String externalId = UUID.randomUUID().toString();
|
||||
final String jsonPayload = ClientHelper.getBasicClientAsJSON(ClientHelper.DEFAULT_OFFICE_ID, ClientHelper.LEGALFORM_ID_PERSON,
|
||||
externalId);
|
||||
// when
|
||||
|
||||
+12
-13
@@ -184,7 +184,7 @@ public class ClientLoanIntegrationTest {
|
||||
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
|
||||
final Integer loanProductID = createLoanProduct(false, NONE);
|
||||
|
||||
final String externalId = Utils.randomStringGenerator("qwerty", 10);
|
||||
final String externalId = UUID.randomUUID().toString();
|
||||
|
||||
// When
|
||||
final Integer loanID = applyForLoanApplicationWithExternalId(this.requestSpec, this.responseSpec, clientID, loanProductID,
|
||||
@@ -6290,16 +6290,16 @@ public class ClientLoanIntegrationTest {
|
||||
final Account incomeAccount = this.accountHelper.createIncomeAccount();
|
||||
final Account expenseAccount = this.accountHelper.createExpenseAccount();
|
||||
final Account overpaymentAccount = this.accountHelper.createLiabilityAccount();
|
||||
final PostGLAccountsResponse uniqueIncomeAccountForFee = this.accountHelper
|
||||
.createGLAccount(new PostGLAccountsRequest().type(GLAccountType.INCOME.getValue())
|
||||
.glCode(Utils.randomStringGenerator("UNIQUE_FEE_INCOME" + Calendar.getInstance().getTimeInMillis(), 5))
|
||||
.manualEntriesAllowed(true)
|
||||
.name(Utils.randomStringGenerator("UNIQUE_FEE_INCOME" + Calendar.getInstance().getTimeInMillis(), 5)).usage(1));
|
||||
final PostGLAccountsResponse uniqueIncomeAccountForPenalty = this.accountHelper
|
||||
.createGLAccount(new PostGLAccountsRequest().type(GLAccountType.INCOME.getValue())
|
||||
.glCode(Utils.randomStringGenerator("UNIQUE_PENALTY_INCOME" + Calendar.getInstance().getTimeInMillis(), 5))
|
||||
.manualEntriesAllowed(true)
|
||||
.name(Utils.randomStringGenerator("UNIQUE_PENALTY_INCOME" + Calendar.getInstance().getTimeInMillis(), 5)).usage(1));
|
||||
final PostGLAccountsResponse uniqueIncomeAccountForFee = this.accountHelper.createGLAccount(new PostGLAccountsRequest()
|
||||
.type(GLAccountType.INCOME.getValue())
|
||||
.glCode(Utils.uniqueRandomStringGenerator("UNIQUE_FEE_INCOME" + Calendar.getInstance().getTimeInMillis(), 5))
|
||||
.manualEntriesAllowed(true)
|
||||
.name(Utils.uniqueRandomStringGenerator("UNIQUE_FEE_INCOME" + Calendar.getInstance().getTimeInMillis(), 5)).usage(1));
|
||||
final PostGLAccountsResponse uniqueIncomeAccountForPenalty = this.accountHelper.createGLAccount(new PostGLAccountsRequest()
|
||||
.type(GLAccountType.INCOME.getValue())
|
||||
.glCode(Utils.uniqueRandomStringGenerator("UNIQUE_PENALTY_INCOME" + Calendar.getInstance().getTimeInMillis(), 5))
|
||||
.manualEntriesAllowed(true)
|
||||
.name(Utils.uniqueRandomStringGenerator("UNIQUE_PENALTY_INCOME" + Calendar.getInstance().getTimeInMillis(), 5)).usage(1));
|
||||
|
||||
PostChargesResponse penaltyCharge = chargesHelper.createCharges(new PostChargesRequest().penalty(true).amount(10.0)
|
||||
.chargeCalculationType(ChargeCalculationType.FLAT.getValue()).chargeTimeType(ChargeTimeType.SPECIFIED_DUE_DATE.getValue())
|
||||
@@ -6965,8 +6965,7 @@ public class ClientLoanIntegrationTest {
|
||||
final Account incomeAccount = this.accountHelper.createIncomeAccount();
|
||||
final Account expenseAccount = this.accountHelper.createExpenseAccount();
|
||||
final Account overpaymentAccount = this.accountHelper.createLiabilityAccount();
|
||||
String randomText = Utils.randomStringGenerator("en", 5) + Utils.randomNumberGenerator(6)
|
||||
+ Utils.randomStringGenerator("is", 5);
|
||||
String randomText = UUID.randomUUID().toString();
|
||||
Integer chargeOffReasonId = CodeHelper.createChargeOffCodeValue(requestSpec, responseSpec, randomText, 1);
|
||||
final Integer loanProductID = createLoanProductWithPeriodicAccrualAccountingNoInterestMultiDisbursement(assetAccount,
|
||||
incomeAccount, expenseAccount, overpaymentAccount);
|
||||
|
||||
+6
-6
@@ -208,9 +208,9 @@ public class ClientTest {
|
||||
assertThat(isAddressEnabled).isTrue();
|
||||
|
||||
Integer addressTypeId = CodeHelper.createAddressTypeCodeValue(requestSpec, responseSpec,
|
||||
Utils.randomNameGenerator("Residential address", 4), 0);
|
||||
Integer countryId = CodeHelper.createCountryCodeValue(requestSpec, responseSpec, Utils.randomNameGenerator("Hungary", 4), 0);
|
||||
Integer stateId = CodeHelper.createStateCodeValue(requestSpec, responseSpec, Utils.randomNameGenerator("Budapest", 4), 0);
|
||||
Utils.randomStringGenerator("Residential address", 4), 0);
|
||||
Integer countryId = CodeHelper.createCountryCodeValue(requestSpec, responseSpec, Utils.randomStringGenerator("Hungary", 4), 0);
|
||||
Integer stateId = CodeHelper.createStateCodeValue(requestSpec, responseSpec, Utils.randomStringGenerator("Budapest", 4), 0);
|
||||
String city = "Budapest";
|
||||
boolean addressIsActive = true;
|
||||
long postalCode = 1000L;
|
||||
@@ -237,9 +237,9 @@ public class ClientTest {
|
||||
public void testClientAddressCreationWorksAfterClientIsCreated() {
|
||||
// given
|
||||
Integer addressTypeId = CodeHelper.createAddressTypeCodeValue(requestSpec, responseSpec,
|
||||
Utils.randomNameGenerator("Residential address", 4), 0);
|
||||
Integer countryId = CodeHelper.createCountryCodeValue(requestSpec, responseSpec, Utils.randomNameGenerator("Hungary", 4), 0);
|
||||
Integer stateId = CodeHelper.createStateCodeValue(requestSpec, responseSpec, Utils.randomNameGenerator("Budapest", 4), 0);
|
||||
Utils.randomStringGenerator("Residential address", 4), 0);
|
||||
Integer countryId = CodeHelper.createCountryCodeValue(requestSpec, responseSpec, Utils.randomStringGenerator("Hungary", 4), 0);
|
||||
Integer stateId = CodeHelper.createStateCodeValue(requestSpec, responseSpec, Utils.randomStringGenerator("Budapest", 4), 0);
|
||||
String city = "Budapest";
|
||||
boolean addressIsActive = true;
|
||||
long postalCode = 1000L;
|
||||
|
||||
-5
@@ -314,9 +314,4 @@ public class ClientUndoRejectAndWithdrawalIntegrationTest {
|
||||
status = this.clientHelper.activateClientWithDiffDateOption(clientId, ClientHelper.CREATED_DATE_PLUS_TWO);
|
||||
|
||||
}
|
||||
|
||||
private static String randomIDGenerator(final String prefix, final int lenOfRandomSuffix) {
|
||||
return Utils.randomStringGenerator(prefix, lenOfRandomSuffix, "ABCDEFGHIJKLMNOPQRSTUVWXYZ");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+1
-1
@@ -57,7 +57,7 @@ public class CreditBureauConfigurationTest {
|
||||
|
||||
// create creditBureauConfiguration
|
||||
final Integer configurationId = CreditBureauConfigurationHelper.createCreditBureauConfiguration(this.requestSpec, this.responseSpec,
|
||||
Utils.randomNameGenerator("testConfigKey_", 5));
|
||||
Utils.randomStringGenerator("testConfigKey_", 5));
|
||||
Assertions.assertNotNull(configurationId);
|
||||
|
||||
// update creditBureauConfiguration
|
||||
|
||||
+4
-4
@@ -120,7 +120,7 @@ public class DatatableIntegrationTest extends IntegrationTest {
|
||||
// creating datatable for client entity
|
||||
final HashMap<String, Object> columnMap = new HashMap<>();
|
||||
final List<HashMap<String, Object>> datatableColumnsList = new ArrayList<>();
|
||||
columnMap.put("datatableName", Utils.randomNameGenerator(CLIENT_APP_TABLE_NAME + "_", 5).toLowerCase().toLowerCase());
|
||||
columnMap.put("datatableName", Utils.uniqueRandomStringGenerator(CLIENT_APP_TABLE_NAME + "_", 5).toLowerCase().toLowerCase());
|
||||
columnMap.put("apptableName", CLIENT_APP_TABLE_NAME);
|
||||
columnMap.put("entitySubType", "PERSON");
|
||||
columnMap.put("multiRow", false);
|
||||
@@ -314,7 +314,7 @@ public class DatatableIntegrationTest extends IntegrationTest {
|
||||
// creating datatable for client entity
|
||||
final HashMap<String, Object> columnMap = new HashMap<>();
|
||||
final List<HashMap<String, Object>> datatableColumnsList = new ArrayList<>();
|
||||
columnMap.put("datatableName", Utils.randomNameGenerator(LOAN_APP_TABLE_NAME + "_", 5));
|
||||
columnMap.put("datatableName", Utils.uniqueRandomStringGenerator(LOAN_APP_TABLE_NAME + "_", 5));
|
||||
columnMap.put("apptableName", LOAN_APP_TABLE_NAME);
|
||||
columnMap.put("entitySubType", "");
|
||||
columnMap.put("multiRow", true);
|
||||
@@ -437,7 +437,7 @@ public class DatatableIntegrationTest extends IntegrationTest {
|
||||
final Integer randomNumber = Utils.randomNumberGenerator(3);
|
||||
|
||||
// Creating datatable for Client Person
|
||||
final String datatableName = Utils.randomNameGenerator(CLIENT_APP_TABLE_NAME + "_", 5);
|
||||
final String datatableName = Utils.uniqueRandomStringGenerator(CLIENT_APP_TABLE_NAME + "_", 5);
|
||||
final boolean genericResultSet = true;
|
||||
|
||||
HashMap<String, Object> columnMap = new HashMap<>();
|
||||
@@ -545,7 +545,7 @@ public class DatatableIntegrationTest extends IntegrationTest {
|
||||
// creating datatable for client entity
|
||||
final HashMap<String, Object> columnMap = new HashMap<>();
|
||||
final List<HashMap<String, Object>> datatableColumnsList = new ArrayList<>();
|
||||
columnMap.put("datatableName", Utils.randomNameGenerator(LOAN_APP_TABLE_NAME + "_", 5));
|
||||
columnMap.put("datatableName", Utils.uniqueRandomStringGenerator(LOAN_APP_TABLE_NAME + "_", 5));
|
||||
columnMap.put("apptableName", LOAN_APP_TABLE_NAME);
|
||||
columnMap.put("entitySubType", "");
|
||||
columnMap.put("multiRow", true);
|
||||
|
||||
+2
-2
@@ -62,7 +62,7 @@ public class DatatableUniqueAndIndexColumnTest {
|
||||
@Test
|
||||
public void testDatableCreationWithUniqueAndIndexedColumns() {
|
||||
// create dataTable
|
||||
String datatableName = Utils.randomNameGenerator("dt_" + LOAN_APP_TABLE_NAME + "_", 5).toLowerCase().toLowerCase();
|
||||
String datatableName = Utils.uniqueRandomStringGenerator("dt_" + LOAN_APP_TABLE_NAME + "_", 5).toLowerCase().toLowerCase();
|
||||
String column1Name = "itsanumber";
|
||||
String column2Name = "itsastring";
|
||||
|
||||
@@ -120,7 +120,7 @@ public class DatatableUniqueAndIndexColumnTest {
|
||||
@Test
|
||||
public void testDatableModificationWithUniqueAndIndexedColumns() {
|
||||
// create dataTable
|
||||
String datatableName = Utils.randomNameGenerator("dt_" + LOAN_APP_TABLE_NAME + "_", 5).toLowerCase().toLowerCase();
|
||||
String datatableName = Utils.uniqueRandomStringGenerator("dt_" + LOAN_APP_TABLE_NAME + "_", 5).toLowerCase().toLowerCase();
|
||||
String column1Name = "itsanumber";
|
||||
String column2Name = "itsastring";
|
||||
|
||||
|
||||
+29
-27
@@ -32,6 +32,7 @@ import io.restassured.specification.RequestSpecification;
|
||||
import io.restassured.specification.ResponseSpecification;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import org.apache.fineract.integrationtests.common.Utils;
|
||||
import org.apache.fineract.integrationtests.common.funds.FundsHelper;
|
||||
import org.apache.fineract.integrationtests.common.funds.FundsResourceHandler;
|
||||
@@ -57,7 +58,7 @@ public class FundsIntegrationTest {
|
||||
|
||||
@Test
|
||||
public void testCreateFund() {
|
||||
FundsHelper fh = FundsHelper.create(Utils.randomNameGenerator("", 10)).externalId(Utils.randomNameGenerator("fund-", 5)).build();
|
||||
FundsHelper fh = FundsHelper.create(Utils.uniqueRandomStringGenerator("", 10)).externalId(UUID.randomUUID().toString()).build();
|
||||
String jsonData = fh.toJSON();
|
||||
|
||||
final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec);
|
||||
@@ -66,7 +67,7 @@ public class FundsIntegrationTest {
|
||||
|
||||
@Test
|
||||
public void testCreateFundWithEmptyName() {
|
||||
FundsHelper fh = FundsHelper.create(null).externalId(Utils.randomNameGenerator("fund-", 5)).build();
|
||||
FundsHelper fh = FundsHelper.create(null).externalId(UUID.randomUUID().toString()).build();
|
||||
String jsonData = fh.toJSON();
|
||||
|
||||
ResponseSpecification responseSpec = new ResponseSpecBuilder().expectStatusCode(400).build();
|
||||
@@ -76,7 +77,7 @@ public class FundsIntegrationTest {
|
||||
|
||||
@Test
|
||||
public void testCreateFundWithEmptyExternalId() {
|
||||
FundsHelper fh = FundsHelper.create(Utils.randomNameGenerator("", 10)).externalId(null).build();
|
||||
FundsHelper fh = FundsHelper.create(Utils.uniqueRandomStringGenerator("", 10)).externalId(null).build();
|
||||
String jsonData = fh.toJSON();
|
||||
|
||||
final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec);
|
||||
@@ -85,13 +86,13 @@ public class FundsIntegrationTest {
|
||||
|
||||
@Test
|
||||
public void testCreateFundWithDuplicateName() {
|
||||
FundsHelper fh = FundsHelper.create(Utils.randomNameGenerator("", 10)).externalId(Utils.randomNameGenerator("fund-", 5)).build();
|
||||
FundsHelper fh = FundsHelper.create(Utils.uniqueRandomStringGenerator("", 10)).externalId(UUID.randomUUID().toString()).build();
|
||||
String jsonData = fh.toJSON();
|
||||
|
||||
final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec);
|
||||
Assertions.assertNotNull(fundID);
|
||||
|
||||
FundsHelper fh2 = FundsHelper.create(fh.getName()).externalId(Utils.randomNameGenerator("fund-", 5)).build();
|
||||
FundsHelper fh2 = FundsHelper.create(fh.getName()).externalId(UUID.randomUUID().toString()).build();
|
||||
jsonData = fh2.toJSON();
|
||||
|
||||
ResponseSpecification responseSpec = new ResponseSpecBuilder().expectStatusCode(403).build();
|
||||
@@ -101,13 +102,13 @@ public class FundsIntegrationTest {
|
||||
|
||||
@Test
|
||||
public void testCreateFundWithDuplicateExternalId() {
|
||||
FundsHelper fh = FundsHelper.create(Utils.randomNameGenerator("", 10)).externalId(Utils.randomNameGenerator("fund-", 5)).build();
|
||||
FundsHelper fh = FundsHelper.create(Utils.uniqueRandomStringGenerator("", 10)).externalId(UUID.randomUUID().toString()).build();
|
||||
String jsonData = fh.toJSON();
|
||||
|
||||
final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec);
|
||||
Assertions.assertNotNull(fundID);
|
||||
|
||||
FundsHelper fh2 = FundsHelper.create(Utils.randomNameGenerator("", 10)).externalId(fh.getExternalId()).build();
|
||||
FundsHelper fh2 = FundsHelper.create(Utils.uniqueRandomStringGenerator("", 10)).externalId(fh.getExternalId()).build();
|
||||
jsonData = fh2.toJSON();
|
||||
|
||||
ResponseSpecification responseSpec = new ResponseSpecBuilder().expectStatusCode(403).build();
|
||||
@@ -117,7 +118,7 @@ public class FundsIntegrationTest {
|
||||
|
||||
@Test
|
||||
public void testCreateFundWithInvalidName() {
|
||||
FundsHelper fh = FundsHelper.create(Utils.randomNameGenerator("", 120)).externalId(Utils.randomNameGenerator("fund-", 5)).build();
|
||||
FundsHelper fh = FundsHelper.create(Utils.randomStringGenerator("", 120)).externalId(UUID.randomUUID().toString()).build();
|
||||
String jsonData = fh.toJSON();
|
||||
|
||||
ResponseSpecification responseSpec = new ResponseSpecBuilder().expectStatusCode(400).build();
|
||||
@@ -127,7 +128,8 @@ public class FundsIntegrationTest {
|
||||
|
||||
@Test
|
||||
public void testCreateFundWithInvalidExternalId() {
|
||||
FundsHelper fh = FundsHelper.create(Utils.randomNameGenerator("", 10)).externalId(Utils.randomNameGenerator("fund-", 120)).build();
|
||||
FundsHelper fh = FundsHelper.create(Utils.uniqueRandomStringGenerator("", 10)).externalId(Utils.randomStringGenerator("fund-", 120))
|
||||
.build();
|
||||
String jsonData = fh.toJSON();
|
||||
|
||||
ResponseSpecification responseSpec = new ResponseSpecBuilder().expectStatusCode(400).build();
|
||||
@@ -137,7 +139,7 @@ public class FundsIntegrationTest {
|
||||
|
||||
@Test
|
||||
public void testRetrieveFund() {
|
||||
FundsHelper fh = FundsHelper.create(Utils.randomNameGenerator("", 10)).externalId(Utils.randomNameGenerator("fund-", 5)).build();
|
||||
FundsHelper fh = FundsHelper.create(Utils.uniqueRandomStringGenerator("", 10)).externalId(UUID.randomUUID().toString()).build();
|
||||
String jsonData = fh.toJSON();
|
||||
|
||||
final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec);
|
||||
@@ -151,7 +153,7 @@ public class FundsIntegrationTest {
|
||||
|
||||
@Test
|
||||
public void testRetrieveAllFunds() {
|
||||
FundsHelper fh = FundsHelper.create(Utils.randomNameGenerator("", 10)).externalId(Utils.randomNameGenerator("fund-", 5)).build();
|
||||
FundsHelper fh = FundsHelper.create(Utils.uniqueRandomStringGenerator("", 10)).externalId(UUID.randomUUID().toString()).build();
|
||||
String jsonData = fh.toJSON();
|
||||
|
||||
final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec);
|
||||
@@ -174,14 +176,14 @@ public class FundsIntegrationTest {
|
||||
|
||||
@Test
|
||||
public void testUpdateFund() {
|
||||
FundsHelper fh = FundsHelper.create(Utils.randomNameGenerator("", 10)).externalId(Utils.randomNameGenerator("fund-", 5)).build();
|
||||
FundsHelper fh = FundsHelper.create(Utils.uniqueRandomStringGenerator("", 10)).externalId(UUID.randomUUID().toString()).build();
|
||||
String jsonData = fh.toJSON();
|
||||
|
||||
final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec);
|
||||
Assertions.assertNotNull(fundID);
|
||||
|
||||
String newName = Utils.randomNameGenerator("", 10);
|
||||
String newExternalId = Utils.randomNameGenerator("fund-", 5);
|
||||
String newName = Utils.uniqueRandomStringGenerator("", 10);
|
||||
String newExternalId = UUID.randomUUID().toString();
|
||||
FundsHelper fh2 = FundsResourceHandler.updateFund(fundID, newName, newExternalId, this.requestSpec, this.statusOkResponseSpec);
|
||||
|
||||
Assertions.assertEquals(newName, fh2.getName());
|
||||
@@ -190,8 +192,8 @@ public class FundsIntegrationTest {
|
||||
|
||||
@Test
|
||||
public void testUpdateUnknownFund() {
|
||||
String newName = Utils.randomNameGenerator("", 10);
|
||||
String newExternalId = Utils.randomNameGenerator("fund-", 5);
|
||||
String newName = Utils.uniqueRandomStringGenerator("", 10);
|
||||
String newExternalId = UUID.randomUUID().toString();
|
||||
ResponseSpecification responseSpec = new ResponseSpecBuilder().expectStatusCode(404).build();
|
||||
FundsHelper fh = FundsResourceHandler.updateFund(Long.MAX_VALUE, newName, newExternalId, this.requestSpec, responseSpec);
|
||||
Assertions.assertNull(fh);
|
||||
@@ -199,14 +201,14 @@ public class FundsIntegrationTest {
|
||||
|
||||
@Test
|
||||
public void testUpdateFundWithInvalidNewName() {
|
||||
FundsHelper fh = FundsHelper.create(Utils.randomNameGenerator("", 10)).externalId(Utils.randomNameGenerator("fund-", 5)).build();
|
||||
FundsHelper fh = FundsHelper.create(Utils.uniqueRandomStringGenerator("", 10)).externalId(UUID.randomUUID().toString()).build();
|
||||
String jsonData = fh.toJSON();
|
||||
|
||||
final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec);
|
||||
Assertions.assertNotNull(fundID);
|
||||
|
||||
String newName = Utils.randomNameGenerator("", 120);
|
||||
String newExternalId = Utils.randomNameGenerator("fund-", 5);
|
||||
String newName = Utils.randomStringGenerator("", 120);
|
||||
String newExternalId = UUID.randomUUID().toString();
|
||||
ResponseSpecification responseSpec = new ResponseSpecBuilder().expectStatusCode(400).build();
|
||||
FundsHelper fh2 = FundsResourceHandler.updateFund(fundID, newName, newExternalId, this.requestSpec, responseSpec);
|
||||
|
||||
@@ -215,13 +217,13 @@ public class FundsIntegrationTest {
|
||||
|
||||
@Test
|
||||
public void testUpdateFundWithNewExternalId() {
|
||||
FundsHelper fh = FundsHelper.create(Utils.randomNameGenerator("", 10)).externalId(Utils.randomNameGenerator("fund-", 5)).build();
|
||||
FundsHelper fh = FundsHelper.create(Utils.uniqueRandomStringGenerator("", 10)).externalId(UUID.randomUUID().toString()).build();
|
||||
String jsonData = fh.toJSON();
|
||||
|
||||
final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec);
|
||||
Assertions.assertNotNull(fundID);
|
||||
|
||||
String newExternalId = Utils.randomNameGenerator("fund-", 5);
|
||||
String newExternalId = UUID.randomUUID().toString();
|
||||
FundsHelper fh2 = FundsResourceHandler.updateFund(fundID, null, newExternalId, this.requestSpec, this.statusOkResponseSpec);
|
||||
|
||||
Assertions.assertEquals(newExternalId, fh2.getExternalId());
|
||||
@@ -229,14 +231,14 @@ public class FundsIntegrationTest {
|
||||
|
||||
@Test
|
||||
public void testUpdateFundWithInvalidNewExternalId() {
|
||||
FundsHelper fh = FundsHelper.create(Utils.randomNameGenerator("", 10)).externalId(Utils.randomNameGenerator("fund-", 5)).build();
|
||||
FundsHelper fh = FundsHelper.create(Utils.uniqueRandomStringGenerator("", 10)).externalId(UUID.randomUUID().toString()).build();
|
||||
String jsonData = fh.toJSON();
|
||||
|
||||
final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec);
|
||||
Assertions.assertNotNull(fundID);
|
||||
|
||||
String newName = Utils.randomNameGenerator("", 10);
|
||||
String newExternalId = Utils.randomNameGenerator("fund-", 120);
|
||||
String newName = Utils.uniqueRandomStringGenerator("", 10);
|
||||
String newExternalId = Utils.randomStringGenerator("fund-", 120);
|
||||
ResponseSpecification responseSpec = new ResponseSpecBuilder().expectStatusCode(400).build();
|
||||
FundsHelper fh2 = FundsResourceHandler.updateFund(fundID, newName, newExternalId, this.requestSpec, responseSpec);
|
||||
|
||||
@@ -245,13 +247,13 @@ public class FundsIntegrationTest {
|
||||
|
||||
@Test
|
||||
public void testUpdateFundWithNewName() {
|
||||
FundsHelper fh = FundsHelper.create(Utils.randomNameGenerator("", 10)).externalId(Utils.randomNameGenerator("fund-", 5)).build();
|
||||
FundsHelper fh = FundsHelper.create(Utils.uniqueRandomStringGenerator("", 10)).externalId(UUID.randomUUID().toString()).build();
|
||||
String jsonData = fh.toJSON();
|
||||
|
||||
final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec);
|
||||
Assertions.assertNotNull(fundID);
|
||||
|
||||
String newName = Utils.randomNameGenerator("", 10);
|
||||
String newName = Utils.uniqueRandomStringGenerator("", 10);
|
||||
FundsHelper fh2 = FundsResourceHandler.updateFund(fundID, newName, null, this.requestSpec, this.statusOkResponseSpec);
|
||||
|
||||
Assertions.assertEquals(newName, fh2.getName());
|
||||
@@ -259,7 +261,7 @@ public class FundsIntegrationTest {
|
||||
|
||||
@Test
|
||||
public void testUpdateFundWithEmptyParams() {
|
||||
FundsHelper fh = FundsHelper.create(Utils.randomNameGenerator("", 10)).externalId(Utils.randomNameGenerator("fund-", 5)).build();
|
||||
FundsHelper fh = FundsHelper.create(Utils.uniqueRandomStringGenerator("", 10)).externalId(UUID.randomUUID().toString()).build();
|
||||
String jsonData = fh.toJSON();
|
||||
|
||||
final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec);
|
||||
|
||||
@@ -102,7 +102,7 @@ public class GroupTest {
|
||||
Integer groupID = GroupHelper.createGroup(this.requestSpec, this.responseSpec);
|
||||
GroupHelper.verifyGroupCreatedOnServer(this.requestSpec, this.responseSpec, groupID);
|
||||
|
||||
final String updateGroupName = Utils.randomNameGenerator("Savings Group Help_", 5);
|
||||
final String updateGroupName = Utils.uniqueRandomStringGenerator("Savings Group Help_", 5);
|
||||
groupID = GroupHelper.activateGroup(this.requestSpec, this.responseSpec, groupID.toString());
|
||||
Integer updateGroupId = GroupHelper.updateGroup(this.requestSpec, this.responseSpec, updateGroupName, groupID.toString());
|
||||
|
||||
|
||||
+1
-1
@@ -74,7 +74,7 @@ public class LoanAuditingIntegrationTest {
|
||||
@Test
|
||||
public void checkAuditDates() throws InterruptedException {
|
||||
final Integer staffId = StaffHelper.createStaff(this.requestSpec, this.responseSpec);
|
||||
String username = Utils.randomNameGenerator("user", 8);
|
||||
String username = Utils.uniqueRandomStringGenerator("user", 8);
|
||||
final Integer userId = (Integer) UserHelper.createUser(this.requestSpec, this.responseSpec, 1, staffId, username, "P4ssw0rd",
|
||||
"resourceId");
|
||||
|
||||
|
||||
+5
-4
@@ -37,6 +37,7 @@ import java.util.Calendar;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.UUID;
|
||||
import org.apache.fineract.integrationtests.common.CalendarHelper;
|
||||
import org.apache.fineract.integrationtests.common.CenterDomain;
|
||||
import org.apache.fineract.integrationtests.common.CenterHelper;
|
||||
@@ -87,7 +88,7 @@ public class LoanReschedulingWithinCenterTest {
|
||||
|
||||
Integer officeId = new OfficeHelper(requestSpec, responseSpec).createOffice("01 July 2007");
|
||||
String name = "TestFullCreation" + new Timestamp(new java.util.Date().getTime());
|
||||
String externalId = Utils.randomStringGenerator("ID_", 7, "ABCDEFGHIJKLMNOPQRSTUVWXYZ");
|
||||
String externalId = UUID.randomUUID().toString();
|
||||
int staffId = StaffHelper.createStaff(requestSpec, responseSpec);
|
||||
int[] groupMembers = generateGroupMembers(1, officeId);
|
||||
final String centerActivationDate = "01 July 2007";
|
||||
@@ -220,7 +221,7 @@ public class LoanReschedulingWithinCenterTest {
|
||||
|
||||
Integer officeId = new OfficeHelper(requestSpec, responseSpec).createOffice("01 July 2007");
|
||||
String name = "TestFullCreation" + new Timestamp(new java.util.Date().getTime());
|
||||
String externalId = Utils.randomStringGenerator("ID_", 7, "ABCDEFGHIJKLMNOPQRSTUVWXYZ");
|
||||
String externalId = UUID.randomUUID().toString();
|
||||
int staffId = StaffHelper.createStaff(requestSpec, responseSpec);
|
||||
int[] groupMembers = generateGroupMembers(1, officeId);
|
||||
final String centerActivationDate = "01 July 2007";
|
||||
@@ -420,8 +421,8 @@ public class LoanReschedulingWithinCenterTest {
|
||||
for (int i = 0; i < groupMembers.length; i++) {
|
||||
final HashMap<String, String> map = new HashMap<>();
|
||||
map.put("officeId", "" + officeId);
|
||||
map.put("name", Utils.randomStringGenerator("Group_Name_", 5));
|
||||
map.put("externalId", Utils.randomStringGenerator("ID_", 7, "ABCDEFGHIJKLMNOPQRSTUVWXYZ"));
|
||||
map.put("name", Utils.uniqueRandomStringGenerator("Group_Name_", 5));
|
||||
map.put("externalId", UUID.randomUUID().toString());
|
||||
map.put("dateFormat", "dd MMMM yyyy");
|
||||
map.put("locale", "en");
|
||||
map.put("active", "true");
|
||||
|
||||
+1
-1
@@ -73,7 +73,7 @@ public class LoanTransactionAuditingIntegrationTest {
|
||||
@Test
|
||||
public void checkAuditDates() throws InterruptedException {
|
||||
final Integer staffId = StaffHelper.createStaff(this.requestSpec, this.responseSpec);
|
||||
String username = Utils.randomNameGenerator("user", 8);
|
||||
String username = Utils.uniqueRandomStringGenerator("user", 8);
|
||||
final Integer userId = (Integer) UserHelper.createUser(this.requestSpec, this.responseSpec, 1, staffId, username, "P4ssw0rd",
|
||||
"resourceId");
|
||||
|
||||
|
||||
+2
-2
@@ -60,10 +60,10 @@ public class NotificationApiTest {
|
||||
responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
|
||||
|
||||
GetOfficesResponse headOffice = OfficeHelper.getHeadOffice(requestSpec, responseSpec);
|
||||
String username = Utils.randomNameGenerator("NotificationUser", 4);
|
||||
String username = Utils.uniqueRandomStringGenerator("NotificationUser", 4);
|
||||
String password = Utils.randomStringGenerator("aA1", 10); // prefix is to conform with the password rules
|
||||
PostUsersRequest createUserRequest = new PostUsersRequest().username(username)
|
||||
.firstname(Utils.randomNameGenerator("NotificationFN", 4)).lastname(Utils.randomNameGenerator("NotificationLN", 4))
|
||||
.firstname(Utils.randomStringGenerator("NotificationFN", 4)).lastname(Utils.randomStringGenerator("NotificationLN", 4))
|
||||
.email("whatever@mifos.org").password(password).repeatPassword(password).sendPasswordToEmail(false)
|
||||
.roles(List.of(Long.toString(SUPER_USER_ROLE_ID))).officeId(headOffice.getId());
|
||||
|
||||
|
||||
+1
-1
@@ -47,7 +47,7 @@ public class OfficeIntegrationTest {
|
||||
public void testOfficeModification() {
|
||||
OfficeHelper oh = new OfficeHelper(requestSpec, responseSpec);
|
||||
int officeId = oh.createOffice("01 July 2007");
|
||||
String name = Utils.randomNameGenerator("New_Office_", 4);
|
||||
String name = Utils.uniqueRandomStringGenerator("New_Office_", 4);
|
||||
String date = "02 July 2007";
|
||||
String[] dateArr = { "2007", "7", "2" };
|
||||
|
||||
|
||||
+1
-1
@@ -180,7 +180,7 @@ public class RepaymentWithPostDatedChecksTest {
|
||||
map.put("name", "AMANA BANK");
|
||||
map.put("amount", amount.toString());
|
||||
map.put("accountNo", "900400500621");
|
||||
map.put("checkNo", Utils.randomNumberGenerator(9).toString());
|
||||
map.put("checkNo", Utils.uniqueRandomNumberGenerator(9).toString());
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
+2
-2
@@ -62,7 +62,7 @@ public class ShareProductDatatableIntegrationTest {
|
||||
@Test
|
||||
public void testDatatableCreationForShareProduct() {
|
||||
// create dataTable
|
||||
String datatableName = Utils.randomNameGenerator("dt_" + SHARES_APP_TABLE_NAME + "_", 5).toLowerCase().toLowerCase();
|
||||
String datatableName = Utils.uniqueRandomStringGenerator("dt_" + SHARES_APP_TABLE_NAME + "_", 5).toLowerCase().toLowerCase();
|
||||
String column1Name = "aNumber";
|
||||
String column2Name = "aString";
|
||||
|
||||
@@ -117,7 +117,7 @@ public class ShareProductDatatableIntegrationTest {
|
||||
assertNotNull(shareProductId);
|
||||
|
||||
// create dataTable
|
||||
String datatableName = Utils.randomNameGenerator("dt_" + SHARES_APP_TABLE_NAME + "_", 5).toLowerCase().toLowerCase();
|
||||
String datatableName = Utils.uniqueRandomStringGenerator("dt_" + SHARES_APP_TABLE_NAME + "_", 5).toLowerCase().toLowerCase();
|
||||
String column1Name = "aNumber";
|
||||
|
||||
PostDataTablesRequest request = new PostDataTablesRequest();
|
||||
|
||||
+24
-23
@@ -27,6 +27,7 @@ import io.restassured.specification.ResponseSpecification;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import org.apache.fineract.integrationtests.common.Utils;
|
||||
import org.apache.fineract.integrationtests.common.organisation.StaffHelper;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
@@ -73,21 +74,21 @@ public class StaffTest {
|
||||
final Map<String, Object> map = StaffHelper.getMapWithJoiningDate();
|
||||
|
||||
map.put("officeId", 1);
|
||||
map.put("firstname", Utils.randomNameGenerator("michael_", 5));
|
||||
map.put("lastname", Utils.randomNameGenerator("Doe_", 4));
|
||||
map.put("firstname", Utils.uniqueRandomStringGenerator("michael_", 5));
|
||||
map.put("lastname", Utils.uniqueRandomStringGenerator("Doe_", 4));
|
||||
|
||||
/** Long firstname test */
|
||||
map.put("firstname", Utils.randomNameGenerator("michael_", 43));
|
||||
map.put("firstname", Utils.uniqueRandomStringGenerator("michael_", 43));
|
||||
StaffHelper.createStaffWithJson(requestSpec, responseSpecForValidationError, new Gson().toJson(map));
|
||||
map.put("firstname", Utils.randomNameGenerator("michael_", 5));
|
||||
map.put("firstname", Utils.uniqueRandomStringGenerator("michael_", 5));
|
||||
|
||||
/** Long lastname test */
|
||||
map.put("lastname", Utils.randomNameGenerator("Doe_", 47));
|
||||
map.put("lastname", Utils.uniqueRandomStringGenerator("Doe_", 47));
|
||||
StaffHelper.createStaffWithJson(requestSpec, responseSpecForValidationError, new Gson().toJson(map));
|
||||
map.put("lastname", Utils.randomNameGenerator("Doe_", 4));
|
||||
map.put("lastname", Utils.uniqueRandomStringGenerator("Doe_", 4));
|
||||
|
||||
/** Long mobileNo test */
|
||||
map.put("mobileNo", Utils.randomNameGenerator("num_", 47));
|
||||
map.put("mobileNo", Utils.uniqueRandomStringGenerator("num_", 47));
|
||||
StaffHelper.createStaffWithJson(requestSpec, responseSpecForValidationError, new Gson().toJson(map));
|
||||
}
|
||||
|
||||
@@ -97,8 +98,8 @@ public class StaffTest {
|
||||
final Map<String, Object> map = StaffHelper.getMapWithJoiningDate();
|
||||
|
||||
map.put("officeId", 1);
|
||||
map.put("firstname", Utils.randomNameGenerator("michael_", 42));
|
||||
map.put("lastname", Utils.randomNameGenerator("Doe_", 46));
|
||||
map.put("firstname", Utils.uniqueRandomStringGenerator("michael_", 42));
|
||||
map.put("lastname", Utils.uniqueRandomStringGenerator("Doe_", 46));
|
||||
|
||||
StaffHelper.createStaffWithJson(requestSpec, responseSpec, new Gson().toJson(map));
|
||||
}
|
||||
@@ -108,8 +109,8 @@ public class StaffTest {
|
||||
final Map<String, Object> map = StaffHelper.getMapWithJoiningDate();
|
||||
|
||||
map.put("officeId", 1);
|
||||
map.put("firstname", Utils.randomNameGenerator("michael_", 5));
|
||||
map.put("lastname", Utils.randomNameGenerator("Doe_", 4));
|
||||
map.put("firstname", Utils.uniqueRandomStringGenerator("michael_", 5));
|
||||
map.put("lastname", Utils.uniqueRandomStringGenerator("Doe_", 4));
|
||||
|
||||
map.put("externalId", Utils.randomStringGenerator("EXT", 98));
|
||||
StaffHelper.createStaffWithJson(requestSpec, responseSpecForValidationError, new Gson().toJson(map));
|
||||
@@ -166,10 +167,10 @@ public class StaffTest {
|
||||
@Test
|
||||
public void testStaffUpdate() {
|
||||
final Map<String, Object> map = new HashMap<>();
|
||||
final String firstname = Utils.randomNameGenerator("michael_", 10);
|
||||
final String lastname = Utils.randomNameGenerator("Doe_", 10);
|
||||
final String externalId = Utils.randomStringGenerator("EXT", 97);
|
||||
final String mobileNo = Utils.randomStringGenerator("num_", 10);
|
||||
final String firstname = Utils.uniqueRandomStringGenerator("michael_", 10);
|
||||
final String lastname = Utils.uniqueRandomStringGenerator("Doe_", 10);
|
||||
final String externalId = UUID.randomUUID().toString();
|
||||
final String mobileNo = Utils.uniqueRandomStringGenerator("num_", 10);
|
||||
|
||||
map.put("firstname", firstname);
|
||||
map.put("lastname", lastname);
|
||||
@@ -206,7 +207,7 @@ public class StaffTest {
|
||||
@Test
|
||||
public void testStaffUpdateNotFoundError() {
|
||||
final HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("firstname", Utils.randomNameGenerator("michael_", 5));
|
||||
map.put("firstname", Utils.uniqueRandomStringGenerator("michael_", 5));
|
||||
|
||||
StaffHelper.updateStaff(requestSpec, responseSpecForNotFoundError, Integer.MAX_VALUE, map);
|
||||
}
|
||||
@@ -214,10 +215,10 @@ public class StaffTest {
|
||||
@Test
|
||||
public void testStaffUpdateValidationError() {
|
||||
final HashMap<String, Object> map = new HashMap<>();
|
||||
final String firstname = Utils.randomNameGenerator("michael_", 5);
|
||||
final String lastname = Utils.randomNameGenerator("Doe_", 4);
|
||||
final String firstnameLong = Utils.randomNameGenerator("michael_", 43);
|
||||
final String lastnameLong = Utils.randomNameGenerator("Doe_", 47);
|
||||
final String firstname = Utils.uniqueRandomStringGenerator("michael_", 5);
|
||||
final String lastname = Utils.uniqueRandomStringGenerator("Doe_", 4);
|
||||
final String firstnameLong = Utils.uniqueRandomStringGenerator("michael_", 43);
|
||||
final String lastnameLong = Utils.uniqueRandomStringGenerator("Doe_", 47);
|
||||
|
||||
map.put("firstname", firstname);
|
||||
map.put("lastname", lastname);
|
||||
@@ -233,7 +234,7 @@ public class StaffTest {
|
||||
map.put("lastname", lastname);
|
||||
|
||||
/** Long mobileNo test */
|
||||
map.put("mobileNo", Utils.randomNameGenerator("num_", 47));
|
||||
map.put("mobileNo", Utils.uniqueRandomStringGenerator("num_", 47));
|
||||
StaffHelper.updateStaff(requestSpec, responseSpecForValidationError, 1, map);
|
||||
map.remove("mobileNo");
|
||||
|
||||
@@ -247,8 +248,8 @@ public class StaffTest {
|
||||
final Map<String, Object> map = StaffHelper.getMapWithJoiningDate();
|
||||
|
||||
map.put("officeId", 1);
|
||||
map.put("firstname", Utils.randomNameGenerator("michael_", 5));
|
||||
map.put("lastname", Utils.randomNameGenerator("Doe_", 5));
|
||||
map.put("firstname", Utils.uniqueRandomStringGenerator("michael_", 5));
|
||||
map.put("lastname", Utils.uniqueRandomStringGenerator("Doe_", 5));
|
||||
map.put("isLoanOfficer", true);
|
||||
|
||||
StaffHelper.createStaffWithJson(requestSpec, responseSpec, new Gson().toJson(map));
|
||||
|
||||
+1
-1
@@ -171,7 +171,7 @@ public class SystemCodeTest {
|
||||
@Test
|
||||
public void testCodeValuesNotAssignedToTable() {
|
||||
|
||||
final String codeName = Utils.randomNameGenerator("Marital Status1", 10);
|
||||
final String codeName = Utils.uniqueRandomStringGenerator("Marital Status1", 10);
|
||||
|
||||
final String codeValue1 = "Married1";
|
||||
final String codeValue2 = "Unmarried1";
|
||||
|
||||
+2
-2
@@ -102,7 +102,7 @@ public class ClientEntityImportHandlerTest {
|
||||
// insert dummy data into client entity sheet
|
||||
Sheet clientEntitySheet = workbook.getSheet(TemplatePopulateImportConstants.CLIENT_ENTITY_SHEET_NAME);
|
||||
Row firstClientRow = clientEntitySheet.getRow(1);
|
||||
firstClientRow.createCell(ClientEntityConstants.NAME_COL).setCellValue(Utils.randomNameGenerator("C_E_", 6));
|
||||
firstClientRow.createCell(ClientEntityConstants.NAME_COL).setCellValue(Utils.randomStringGenerator("C_E_", 6));
|
||||
Sheet staffSheet = workbook.getSheet(TemplatePopulateImportConstants.STAFF_SHEET_NAME);
|
||||
firstClientRow.createCell(ClientEntityConstants.OFFICE_NAME_COL).setCellValue(staffSheet.getRow(1).getCell(0).getStringCellValue());
|
||||
firstClientRow.createCell(ClientEntityConstants.STAFF_NAME_COL).setCellValue(staffSheet.getRow(1).getCell(1).getStringCellValue());
|
||||
@@ -111,7 +111,7 @@ public class ClientEntityImportHandlerTest {
|
||||
firstClientRow.createCell(ClientEntityConstants.INCOPORATION_DATE_COL).setCellValue(incoporationDate);
|
||||
Date validTill = simpleDateFormat.parse("14 May 2019");
|
||||
firstClientRow.createCell(ClientEntityConstants.INCOPORATION_VALID_TILL_COL).setCellValue(validTill);
|
||||
firstClientRow.createCell(ClientEntityConstants.MOBILE_NO_COL).setCellValue(Utils.randomNumberGenerator(7));
|
||||
firstClientRow.createCell(ClientEntityConstants.MOBILE_NO_COL).setCellValue(Utils.uniqueRandomNumberGenerator(7));
|
||||
firstClientRow.createCell(ClientEntityConstants.CLIENT_TYPE_COL)
|
||||
.setCellValue(clientEntitySheet.getRow(1).getCell(ClientEntityConstants.LOOKUP_CLIENT_TYPES).getStringCellValue());
|
||||
firstClientRow.createCell(ClientEntityConstants.CLIENT_CLASSIFICATION_COL)
|
||||
|
||||
+6
-5
@@ -38,6 +38,7 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import javax.ws.rs.core.HttpHeaders;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import org.apache.fineract.infrastructure.bulkimport.constants.LoanConstants;
|
||||
@@ -95,9 +96,9 @@ public class LoanImportHandlerTest {
|
||||
OfficeDomain office = officeHelper.retrieveOfficeByID(outcome_office_creation);
|
||||
Assertions.assertNotNull(office, "Could not retrieve created office");
|
||||
|
||||
String firstName = Utils.randomNameGenerator("Client_FirstName_", 5);
|
||||
String lastName = Utils.randomNameGenerator("Client_LastName_", 4);
|
||||
String externalId = Utils.randomStringGenerator("ID_", 7, "ABCDEFGHIJKLMNOPQRSTUVWXYZ");
|
||||
String firstName = Utils.randomStringGenerator("Client_FirstName_", 5);
|
||||
String lastName = Utils.randomStringGenerator("Client_LastName_", 4);
|
||||
String externalId = UUID.randomUUID().toString();
|
||||
|
||||
final HashMap<String, Object> clientMap = new HashMap<>();
|
||||
clientMap.put("officeId", outcome_office_creation.toString());
|
||||
@@ -154,8 +155,8 @@ public class LoanImportHandlerTest {
|
||||
Assertions.assertNotNull("Could not get created Loan Product", loanProductStr);
|
||||
JsonPath loanProductJson = JsonPath.from(loanProductStr);
|
||||
|
||||
String fundName = Utils.randomNameGenerator("", 9);
|
||||
FundsHelper fh = FundsHelper.create(fundName).externalId("fund-" + fundName).build();
|
||||
String fundName = Utils.uniqueRandomStringGenerator("", 9);
|
||||
FundsHelper fh = FundsHelper.create(fundName).externalId(UUID.randomUUID().toString()).build();
|
||||
Integer outcome_fund_creation = FundsResourceHandler.createFund(new Gson().toJson(fh), requestSpec, responseSpec);
|
||||
Assertions.assertNotNull(outcome_fund_creation, "Could not create Fund");
|
||||
|
||||
|
||||
+1
-1
@@ -68,7 +68,7 @@ public class OfficeImportHandlerTest {
|
||||
// insert dummy data into excel
|
||||
Sheet sheet = workbook.getSheet(TemplatePopulateImportConstants.OFFICE_SHEET_NAME);
|
||||
Row firstOfficeRow = sheet.getRow(1);
|
||||
firstOfficeRow.createCell(OfficeConstants.OFFICE_NAME_COL).setCellValue(Utils.randomNameGenerator("Test_Off_", 6));
|
||||
firstOfficeRow.createCell(OfficeConstants.OFFICE_NAME_COL).setCellValue(Utils.uniqueRandomStringGenerator("Test_Off_", 6));
|
||||
firstOfficeRow.createCell(OfficeConstants.PARENT_OFFICE_NAME_COL)
|
||||
.setCellValue(firstOfficeRow.getCell(OfficeConstants.LOOKUP_OFFICE_COL).getStringCellValue());
|
||||
firstOfficeRow.createCell(OfficeConstants.PARENT_OFFICE_ID_COL)
|
||||
|
||||
+4
-3
@@ -35,6 +35,7 @@ import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import javax.ws.rs.core.HttpHeaders;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import org.apache.fineract.infrastructure.bulkimport.constants.SavingsConstants;
|
||||
@@ -86,9 +87,9 @@ public class SavingsImportHandlerTest {
|
||||
OfficeDomain office = officeHelper.retrieveOfficeByID(outcome_office_creation);
|
||||
Assertions.assertNotNull(office, "Could not retrieve created office");
|
||||
|
||||
String firstName = Utils.randomNameGenerator("Client_FirstName_", 5);
|
||||
String lastName = Utils.randomNameGenerator("Client_LastName_", 4);
|
||||
String externalId = Utils.randomStringGenerator("ID_", 7, "ABCDEFGHIJKLMNOPQRSTUVWXYZ");
|
||||
String firstName = Utils.randomStringGenerator("Client_FirstName_", 5);
|
||||
String lastName = Utils.randomStringGenerator("Client_LastName_", 4);
|
||||
String externalId = UUID.randomUUID().toString();
|
||||
|
||||
final HashMap<String, Object> clientMap = new HashMap<>();
|
||||
clientMap.put("officeId", outcome_office_creation.toString());
|
||||
|
||||
+1
-1
@@ -82,7 +82,7 @@ public class LoanWorkbookPopulatorTest {
|
||||
Integer outcome_lp_creaion = loanTransactionHelper.getLoanProductId(jsonLoanProduct);
|
||||
Assertions.assertNotNull(outcome_lp_creaion, "Could not create Loan Product");
|
||||
|
||||
String jsonFund = "{\n" + "\t\"name\": \"" + Utils.randomNameGenerator("Fund_Name", 9) + "\"\n" + "}";
|
||||
String jsonFund = "{\n" + "\t\"name\": \"" + Utils.uniqueRandomStringGenerator("Fund_Name", 9) + "\"\n" + "}";
|
||||
Integer outcome_fund_creation = FundsResourceHandler.createFund(jsonFund, requestSpec, responseSpec);
|
||||
Assertions.assertNotNull(outcome_fund_creation, "Could not create Fund");
|
||||
|
||||
|
||||
+2
-2
@@ -1181,7 +1181,7 @@ public final class BatchHelper {
|
||||
final BatchRequest br = new BatchRequest();
|
||||
final String relativeUrl = String.format("datatables/%s/%s", datatableName, loanId);
|
||||
final Map<String, Object> datatableEntryMap = new HashMap<>();
|
||||
datatableEntryMap.putAll(columnNames.stream().collect(Collectors.toMap(v -> v, v -> Utils.randomNameGenerator("VAL_", 3))));
|
||||
datatableEntryMap.putAll(columnNames.stream().collect(Collectors.toMap(v -> v, v -> Utils.randomStringGenerator("VAL_", 3))));
|
||||
final String datatableEntryRequestJsonString = new Gson().toJson(datatableEntryMap);
|
||||
LOG.info("CreateDataTableEntry map : {}", datatableEntryRequestJsonString);
|
||||
|
||||
@@ -1211,7 +1211,7 @@ public final class BatchHelper {
|
||||
final BatchRequest br = new BatchRequest();
|
||||
final String relativeUrl = String.format("datatables/%s/%s/%s", datatableName, loanId, datatableEntryId);
|
||||
final Map<String, Object> datatableEntryMap = new HashMap<>();
|
||||
datatableEntryMap.putAll(columnNames.stream().collect(Collectors.toMap(v -> v, v -> Utils.randomNameGenerator("VAL_", 3))));
|
||||
datatableEntryMap.putAll(columnNames.stream().collect(Collectors.toMap(v -> v, v -> Utils.randomStringGenerator("VAL_", 3))));
|
||||
final String datatableEntryRequestJsonString = new Gson().toJson(datatableEntryMap);
|
||||
LOG.info("UpdateDataTableEntry map : {}", datatableEntryRequestJsonString);
|
||||
|
||||
|
||||
+1
-1
@@ -78,7 +78,7 @@ public final class CalendarHelper {
|
||||
map.put("interval", interval);
|
||||
map.put("repeating", "true");
|
||||
map.put("repeatsOnDay", repeatsOnDay);
|
||||
map.put("title", Utils.randomNameGenerator("groups_CollectionMeeting", 4));
|
||||
map.put("title", Utils.randomStringGenerator("groups_CollectionMeeting", 4));
|
||||
map.put("typeId", "1");
|
||||
map.put("startDate", startDate);
|
||||
LOG.info("map : {}", map);
|
||||
|
||||
+3
-6
@@ -22,6 +22,7 @@ import com.google.gson.Gson;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.UUID;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@@ -140,7 +141,7 @@ public class CenterDomain implements Comparable<CenterDomain> {
|
||||
}
|
||||
map.put("officeId", "1");
|
||||
map.put("name", randomNameGenerator("Center_Name_", 5));
|
||||
map.put("externalId", randomIDGenerator("ID_", 7));
|
||||
map.put("externalId", UUID.randomUUID().toString());
|
||||
map.put("dateFormat", "dd MMMM yyyy");
|
||||
map.put("locale", "en");
|
||||
if (staffId != null) {
|
||||
@@ -170,11 +171,7 @@ public class CenterDomain implements Comparable<CenterDomain> {
|
||||
}
|
||||
|
||||
public static String randomNameGenerator(final String prefix, final int lenOfRandomSuffix) {
|
||||
return Utils.randomStringGenerator(prefix, lenOfRandomSuffix);
|
||||
}
|
||||
|
||||
private static String randomIDGenerator(final String prefix, final int lenOfRandomSuffix) {
|
||||
return Utils.randomStringGenerator(prefix, lenOfRandomSuffix, "ABCDEFGHIJKLMNOPQRSTUVWXYZ");
|
||||
return Utils.uniqueRandomStringGenerator(prefix, lenOfRandomSuffix);
|
||||
}
|
||||
|
||||
public String getExternalId() {
|
||||
|
||||
+1
-1
@@ -269,7 +269,7 @@ public final class CenterHelper {
|
||||
}
|
||||
|
||||
public static String randomNameGenerator(final String prefix, final int lenOfRandomSuffix) {
|
||||
return Utils.randomStringGenerator(prefix, lenOfRandomSuffix);
|
||||
return Utils.uniqueRandomStringGenerator(prefix, lenOfRandomSuffix);
|
||||
}
|
||||
|
||||
public static Object assignStaff(final RequestSpecification requestSpec, final ResponseSpecification responseSpec, final String groupId,
|
||||
|
||||
+13
-16
@@ -33,6 +33,7 @@ import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import javax.ws.rs.core.HttpHeaders;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -280,7 +281,7 @@ public class ClientHelper extends IntegrationTest {
|
||||
}
|
||||
|
||||
public static HashMap<String, Object> setInitialClientValues(final String officeId, final Integer legalFormId) {
|
||||
return setInitialClientValues(officeId, legalFormId, randomIDGenerator("ID_", 7));
|
||||
return setInitialClientValues(officeId, legalFormId, UUID.randomUUID().toString());
|
||||
}
|
||||
|
||||
public static HashMap<String, Object> setInitialClientValues(final String officeId, final Integer legalFormId,
|
||||
@@ -288,8 +289,8 @@ public class ClientHelper extends IntegrationTest {
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("officeId", officeId);
|
||||
map.put("legalFormId", legalFormId);
|
||||
map.put("firstname", Utils.randomNameGenerator("Client_FirstName_", 5));
|
||||
map.put("lastname", Utils.randomNameGenerator("Client_LastName_", 4));
|
||||
map.put("firstname", Utils.randomStringGenerator("Client_FirstName_", 5));
|
||||
map.put("lastname", Utils.randomStringGenerator("Client_LastName_", 4));
|
||||
if (externalId != null) {
|
||||
map.put("externalId", externalId);
|
||||
}
|
||||
@@ -338,7 +339,7 @@ public class ClientHelper extends IntegrationTest {
|
||||
HashMap<String, Object> datatableMap = new HashMap<>();
|
||||
HashMap<String, Object> dataMap = new HashMap<>();
|
||||
dataMap.put("locale", "en");
|
||||
dataMap.put("Spouse Name", Utils.randomNameGenerator("Spouse_name", 4));
|
||||
dataMap.put("Spouse Name", Utils.randomStringGenerator("Spouse_name", 4));
|
||||
dataMap.put("Number of Dependents", 5);
|
||||
dataMap.put("Time of Visit", "01 December 2016 04:03");
|
||||
dataMap.put("dateFormat", Utils.DATE_TIME_FORMAT);
|
||||
@@ -353,8 +354,8 @@ public class ClientHelper extends IntegrationTest {
|
||||
public static String getTestPersonClientAsJSON(final String dateOfJoining, final String officeId) {
|
||||
final HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("officeId", officeId);
|
||||
map.put("fullname", Utils.randomNameGenerator("Client_FullName_", 5));
|
||||
map.put("externalId", randomIDGenerator("ID_", 7));
|
||||
map.put("fullname", Utils.randomStringGenerator("Client_FullName_", 5));
|
||||
map.put("externalId", UUID.randomUUID().toString());
|
||||
map.put("dateFormat", Utils.DATE_FORMAT);
|
||||
map.put("locale", "en");
|
||||
map.put("active", "true");
|
||||
@@ -369,8 +370,8 @@ public class ClientHelper extends IntegrationTest {
|
||||
final HashMap<String, Object> datatables) {
|
||||
final HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("officeId", officeId);
|
||||
map.put("fullname", Utils.randomNameGenerator("Client_FullName_", 5));
|
||||
map.put("externalId", randomIDGenerator("ID_", 7));
|
||||
map.put("fullname", Utils.randomStringGenerator("Client_FullName_", 5));
|
||||
map.put("externalId", UUID.randomUUID().toString());
|
||||
map.put("dateFormat", Utils.DATE_FORMAT);
|
||||
map.put("locale", "en");
|
||||
map.put("active", "true");
|
||||
@@ -388,8 +389,8 @@ public class ClientHelper extends IntegrationTest {
|
||||
final Integer soleProprietorCodeValueId) {
|
||||
final HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("officeId", officeId);
|
||||
map.put("fullname", Utils.randomNameGenerator("Client_FullName_", 5));
|
||||
map.put("externalId", randomIDGenerator("ID_", 7));
|
||||
map.put("fullname", Utils.randomStringGenerator("Client_FullName_", 5));
|
||||
map.put("externalId", UUID.randomUUID().toString());
|
||||
map.put("dateFormat", Utils.DATE_FORMAT);
|
||||
map.put("locale", "en");
|
||||
map.put("active", "true");
|
||||
@@ -470,10 +471,6 @@ public class ClientHelper extends IntegrationTest {
|
||||
return (HashMap<String, Object>) getClient(requestSpec, responseSpec, clientId, "status");
|
||||
}
|
||||
|
||||
private static String randomIDGenerator(final String prefix, final int lenOfRandomSuffix) {
|
||||
return Utils.randomStringGenerator(prefix, lenOfRandomSuffix, "ABCDEFGHIJKLMNOPQRSTUVWXYZ");
|
||||
}
|
||||
|
||||
public String getCloseClientAsJSON() {
|
||||
final HashMap<String, String> map = new HashMap<>();
|
||||
|
||||
@@ -787,8 +784,8 @@ public class ClientHelper extends IntegrationTest {
|
||||
|
||||
public static PostClientsRequest defaultClientCreationRequest() {
|
||||
return new PostClientsRequest().officeId(1).legalFormId(LEGALFORM_ID_PERSON)
|
||||
.firstname(Utils.randomNameGenerator("Client_FirstName_", 5)).lastname(Utils.randomNameGenerator("Client_LastName_", 5))
|
||||
.externalId(randomIDGenerator("ID_", 7)).dateFormat(Utils.DATE_FORMAT).locale("en").active(true)
|
||||
.firstname(Utils.randomStringGenerator("Client_FirstName_", 5)).lastname(Utils.randomStringGenerator("Client_LastName_", 5))
|
||||
.externalId(UUID.randomUUID().toString()).dateFormat(Utils.DATE_FORMAT).locale("en").active(true)
|
||||
.activationDate(DEFAULT_DATE);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -68,7 +68,7 @@ public class CollateralManagementHelper {
|
||||
LOG.info("---------------------------------CREATING A COLLATERAL_PRODUCT---------------------------------------------");
|
||||
final String COLLATERAL_PRODUCT_URL = "/fineract-provider/api/v1/collateral-management" + "?" + Utils.TENANT_IDENTIFIER;
|
||||
return Utils.performServerPost(requestSpec, responseSpec, COLLATERAL_PRODUCT_URL,
|
||||
collateralProductAsJson(Utils.randomNameGenerator("COLLATERAL_PRODUCT", 5), "USD", "acre", "agriculture",
|
||||
collateralProductAsJson(Utils.randomStringGenerator("COLLATERAL_PRODUCT", 5), "USD", "acre", "agriculture",
|
||||
BigDecimal.valueOf(40), BigDecimal.valueOf(100000000), "en"),
|
||||
"resourceId");
|
||||
}
|
||||
@@ -93,7 +93,7 @@ public class CollateralManagementHelper {
|
||||
final String COLLATERAL_PRODUCT_URL = "/fineract-provider/api/v1/collateral-management/" + collateralId + "?"
|
||||
+ Utils.TENANT_IDENTIFIER;
|
||||
return Utils.performServerPut(requestSpec, responseSpec, COLLATERAL_PRODUCT_URL,
|
||||
updateCollateralProductAsJson(Utils.randomNameGenerator("COLLATERAL_PRODUCT", 5), "USD", "acre", "agriculture",
|
||||
updateCollateralProductAsJson(Utils.randomStringGenerator("COLLATERAL_PRODUCT", 5), "USD", "acre", "agriculture",
|
||||
BigDecimal.valueOf(30), BigDecimal.valueOf(100000), "en"),
|
||||
"resourceId");
|
||||
}
|
||||
|
||||
+5
-8
@@ -29,6 +29,7 @@ import io.restassured.specification.ResponseSpecification;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@@ -135,7 +136,7 @@ public class GroupHelper {
|
||||
final HashMap<String, String> map = new HashMap<>();
|
||||
map.put("officeId", "1");
|
||||
map.put("name", randomNameGenerator("Group_Name_", 5));
|
||||
map.put("externalId", randomIDGenerator("ID_", 7));
|
||||
map.put("externalId", UUID.randomUUID().toString());
|
||||
map.put("dateFormat", "dd MMMM yyyy");
|
||||
map.put("locale", "en");
|
||||
if (active) {
|
||||
@@ -291,18 +292,14 @@ public class GroupHelper {
|
||||
}
|
||||
|
||||
public static String randomNameGenerator(final String prefix, final int lenOfRandomSuffix) {
|
||||
return Utils.randomStringGenerator(prefix, lenOfRandomSuffix);
|
||||
}
|
||||
|
||||
private static String randomIDGenerator(final String prefix, final int lenOfRandomSuffix) {
|
||||
return Utils.randomStringGenerator(prefix, lenOfRandomSuffix, "ABCDEFGHIJKLMNOPQRSTUVWXYZ");
|
||||
return Utils.uniqueRandomStringGenerator(prefix, lenOfRandomSuffix);
|
||||
}
|
||||
|
||||
public static String getTestGroupWithDatatableAsJson(final String registeredTableName) {
|
||||
final HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("officeId", "1");
|
||||
map.put("name", randomNameGenerator("Group_Name_", 5));
|
||||
map.put("externalId", randomIDGenerator("ID_", 7));
|
||||
map.put("externalId", UUID.randomUUID().toString());
|
||||
map.put("dateFormat", "dd MMMM yyyy");
|
||||
map.put("locale", "en");
|
||||
map.put("active", "false");
|
||||
@@ -317,7 +314,7 @@ public class GroupHelper {
|
||||
HashMap<String, Object> datatableMap = new HashMap<>();
|
||||
HashMap<String, Object> dataMap = new HashMap<>();
|
||||
dataMap.put("locale", "en");
|
||||
dataMap.put("Spouse Name", Utils.randomNameGenerator("Spouse_name", 4));
|
||||
dataMap.put("Spouse Name", Utils.randomStringGenerator("Spouse_name", 4));
|
||||
dataMap.put("Number of Dependents", 5);
|
||||
dataMap.put("Time of Visit", "01 December 2016 04:03");
|
||||
dataMap.put("dateFormat", DATE_TIME_FORMAT);
|
||||
|
||||
+1
-1
@@ -54,7 +54,7 @@ public class HolidayHelper {
|
||||
map.put("offices", offices);
|
||||
map.put("locale", "en");
|
||||
map.put("dateFormat", "dd MMMM yyyy");
|
||||
map.put("name", Utils.randomNameGenerator("HOLIDAY_", 5));
|
||||
map.put("name", Utils.uniqueRandomStringGenerator("HOLIDAY_", 5));
|
||||
map.put("fromDate", "01 April 2013");
|
||||
map.put("toDate", "01 April 2013");
|
||||
map.put("repaymentsRescheduledTo", "08 April 2013");
|
||||
|
||||
+1
-1
@@ -50,7 +50,7 @@ public class HookHelper {
|
||||
public String getTestHookAsJson(final String payloadURL) {
|
||||
final HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("name", "Web");
|
||||
map.put("displayName", Utils.randomNameGenerator("Hook_DisplayName_", 5));
|
||||
map.put("displayName", Utils.randomStringGenerator("Hook_DisplayName_", 5));
|
||||
map.put("isActive", "true");
|
||||
final HashMap<String, String> config = new HashMap<>();
|
||||
config.put("Content Type", "json");
|
||||
|
||||
+1
-1
@@ -85,7 +85,7 @@ public class OfficeHelper {
|
||||
public static String getAsJSON(final String openingDate) {
|
||||
final HashMap<String, String> map = new HashMap<>();
|
||||
map.put("parentId", "1");
|
||||
map.put("name", Utils.randomNameGenerator("Office_", 4));
|
||||
map.put("name", Utils.uniqueRandomStringGenerator("Office_", 4));
|
||||
map.put("dateFormat", "dd MMMM yyyy");
|
||||
map.put("locale", "en");
|
||||
map.put("openingDate", openingDate);
|
||||
|
||||
+1
-1
@@ -66,7 +66,7 @@ public class StandingInstructionsHelper {
|
||||
final String toAccountType, final String validFrom, final String validTo, final String monthDay) {
|
||||
|
||||
final HashMap<String, String> map = new HashMap<>();
|
||||
map.put("name", Utils.randomNameGenerator("STANDING_INSTRUCTION_", 5));
|
||||
map.put("name", Utils.uniqueRandomStringGenerator("STANDING_INSTRUCTION_", 5));
|
||||
map.put("dateFormat", "dd MMMM yyyy");
|
||||
map.put("monthDayFormat", "dd MMMM");
|
||||
map.put("locale", LOCALE);
|
||||
|
||||
+34
-12
@@ -48,11 +48,14 @@ import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.TimeZone;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.function.Function;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.http.conn.HttpHostConnectException;
|
||||
@@ -82,6 +85,10 @@ public final class Utils {
|
||||
|
||||
private static final Random r = new Random();
|
||||
|
||||
private static final ConcurrentHashMap<String, Set<String>> uniqueRandomStringContainer = new ConcurrentHashMap<>();
|
||||
public static final String SOURCE_SET_NUMBERS_AND_LETTERS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||
public static final String SOURCE_SET_NUMBERS = "1234567890";
|
||||
|
||||
private Utils() {
|
||||
|
||||
}
|
||||
@@ -275,28 +282,43 @@ public final class Utils {
|
||||
}
|
||||
|
||||
public static String randomStringGenerator(final String prefix, final int len) {
|
||||
return randomStringGenerator(prefix, len, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ");
|
||||
return randomStringGenerator(prefix, len, SOURCE_SET_NUMBERS_AND_LETTERS);
|
||||
}
|
||||
|
||||
public static String randomNameGenerator(final String prefix, final int lenOfRandomSuffix) {
|
||||
return randomStringGenerator(prefix, lenOfRandomSuffix);
|
||||
public static String uniqueRandomStringGenerator(final String prefix, final int lenOfRandomSuffix) {
|
||||
return uniqueRandomGenerator(prefix, lenOfRandomSuffix, SOURCE_SET_NUMBERS_AND_LETTERS);
|
||||
}
|
||||
|
||||
public static Integer uniqueRandomNumberGenerator(final int lenOfRandomSuffix) {
|
||||
return Integer.parseInt(uniqueRandomGenerator("", lenOfRandomSuffix, SOURCE_SET_NUMBERS));
|
||||
}
|
||||
|
||||
public static String uniqueRandomGenerator(final String prefix, final int lenOfRandomSuffix, String sourceSet) {
|
||||
String response;
|
||||
String key = prefix + lenOfRandomSuffix;
|
||||
int i = 0;
|
||||
do {
|
||||
response = randomStringGenerator(prefix, lenOfRandomSuffix, sourceSet);
|
||||
uniqueRandomStringContainer.putIfAbsent(key, new HashSet<>());
|
||||
i++;
|
||||
|
||||
if (i == 10000) {
|
||||
throw new IllegalStateException("Possible endless loop for: " + key);
|
||||
}
|
||||
} while (!uniqueRandomStringContainer.get(key).add(response));
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
@SuppressFBWarnings(value = {
|
||||
"DMI_RANDOM_USED_ONLY_ONCE" }, justification = "False positive for random object created and used only once")
|
||||
public static Integer randomNumberGenerator(final int expectedLength) {
|
||||
final String source = "1234567890";
|
||||
final int lengthOfSource = source.length();
|
||||
|
||||
StringBuilder stringBuilder = new StringBuilder(expectedLength);
|
||||
for (int i = 0; i < expectedLength; i++) {
|
||||
stringBuilder.append(source.charAt(random.nextInt(lengthOfSource)));
|
||||
}
|
||||
return Integer.parseInt(stringBuilder.toString());
|
||||
String response = randomStringGenerator("", expectedLength, SOURCE_SET_NUMBERS);
|
||||
return Integer.parseInt(response);
|
||||
}
|
||||
|
||||
public static Float randomDecimalGenerator(final int expectedWholeLength, final int expectedFractionLength) {
|
||||
final String source = "1234567890";
|
||||
final String source = SOURCE_SET_NUMBERS;
|
||||
final int lengthOfSource = source.length();
|
||||
|
||||
StringBuilder stringBuilder = new StringBuilder(expectedWholeLength + expectedFractionLength + 1);
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ public class AccountingRuleBuilder {
|
||||
private String description;
|
||||
|
||||
public AccountingRuleBuilder() {
|
||||
name = Utils.randomStringGenerator("ACCOUNTRULE_NAME_", 5);
|
||||
name = Utils.uniqueRandomStringGenerator("ACCOUNTRULE_NAME_", 5);
|
||||
description = name;
|
||||
}
|
||||
|
||||
|
||||
+6
-12
@@ -38,7 +38,7 @@ public class GLAccountBuilder {
|
||||
|
||||
private static final String DESCRIPTION = "DEFAULT_DESCRIPTION";
|
||||
|
||||
private String name = Utils.randomStringGenerator("ACCOUNT_NAME_", 5);
|
||||
private String name = Utils.uniqueRandomStringGenerator("ACCOUNT_NAME_", 5);
|
||||
|
||||
private String glCode = "";
|
||||
private String accountType = "";
|
||||
@@ -58,37 +58,31 @@ public class GLAccountBuilder {
|
||||
|
||||
public GLAccountBuilder withAccountTypeAsAsset() {
|
||||
accountType = ASSET_ACCOUNT;
|
||||
glCode = Utils.randomStringGenerator("ASSET_", 2);
|
||||
// Add unique timestamp to avoid random collisions
|
||||
glCode += Calendar.getInstance().getTimeInMillis() + "";
|
||||
glCode = Utils.uniqueRandomStringGenerator("ASSET_" + Calendar.getInstance().getTimeInMillis(), 2);
|
||||
return this;
|
||||
}
|
||||
|
||||
public GLAccountBuilder withAccountTypeAsLiability() {
|
||||
accountType = LIABILITY_ACCOUNT;
|
||||
glCode = Utils.randomStringGenerator("LIABILITY_", 2);
|
||||
glCode += Calendar.getInstance().getTimeInMillis() + "";
|
||||
glCode = Utils.uniqueRandomStringGenerator("LIABILITY_" + Calendar.getInstance().getTimeInMillis(), 2);
|
||||
return this;
|
||||
}
|
||||
|
||||
public GLAccountBuilder withAccountTypeAsAsEquity() {
|
||||
accountType = EQUITY_ACCOUNT;
|
||||
glCode = Utils.randomStringGenerator("EQUITY_", 2);
|
||||
glCode += Calendar.getInstance().getTimeInMillis() + "";
|
||||
glCode = Utils.uniqueRandomStringGenerator("EQUITY_" + Calendar.getInstance().getTimeInMillis(), 2);
|
||||
return this;
|
||||
}
|
||||
|
||||
public GLAccountBuilder withAccountTypeAsIncome() {
|
||||
accountType = INCOME_ACCOUNT;
|
||||
glCode = Utils.randomStringGenerator("INCOME_", 2);
|
||||
glCode += Calendar.getInstance().getTimeInMillis() + "";
|
||||
glCode = Utils.uniqueRandomStringGenerator("INCOME_" + Calendar.getInstance().getTimeInMillis(), 2);
|
||||
return this;
|
||||
}
|
||||
|
||||
public GLAccountBuilder withAccountTypeAsExpense() {
|
||||
accountType = EXPENSE_ACCOUNT;
|
||||
glCode = Utils.randomStringGenerator("EXPENSE_", 2);
|
||||
glCode += Calendar.getInstance().getTimeInMillis() + "";
|
||||
glCode = Utils.uniqueRandomStringGenerator("EXPENSE_" + Calendar.getInstance().getTimeInMillis(), 2);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
+7
-7
@@ -167,7 +167,7 @@ public final class ChargesHelper extends IntegrationTest {
|
||||
map.put("currencyCode", currencyCode);
|
||||
map.put("locale", CommonConstants.LOCALE);
|
||||
map.put("monthDayFormat", ChargesHelper.MONTH_DAY_FORMAT);
|
||||
map.put("name", Utils.randomNameGenerator("Charge_Savings_", 6));
|
||||
map.put("name", Utils.uniqueRandomStringGenerator("Charge_Savings_", 6));
|
||||
return map;
|
||||
}
|
||||
|
||||
@@ -207,7 +207,7 @@ public final class ChargesHelper extends IntegrationTest {
|
||||
map.put("currencyCode", ChargesHelper.CURRENCY_CODE);
|
||||
map.put("locale", CommonConstants.LOCALE);
|
||||
map.put("monthDayFormat", ChargesHelper.MONTH_DAY_FORMAT);
|
||||
map.put("name", Utils.randomNameGenerator("Charge_Savings_", 6));
|
||||
map.put("name", Utils.uniqueRandomStringGenerator("Charge_Savings_", 6));
|
||||
map.put("chargeTimeType", CHARGE_WITHDRAWAL_FEE);
|
||||
map.put("enablePaymentType", enablePaymentType);
|
||||
map.put("paymentTypeId", paymentTypeId);
|
||||
@@ -329,7 +329,7 @@ public final class ChargesHelper extends IntegrationTest {
|
||||
map.put("currencyCode", ChargesHelper.CURRENCY_CODE);
|
||||
map.put("locale", CommonConstants.LOCALE);
|
||||
map.put("monthDayFormat", ChargesHelper.MONTH_DAY_FORMAT);
|
||||
map.put("name", Utils.randomNameGenerator("Charge_Loans_", 6));
|
||||
map.put("name", Utils.uniqueRandomStringGenerator("Charge_Loans_", 6));
|
||||
return map;
|
||||
}
|
||||
|
||||
@@ -343,7 +343,7 @@ public final class ChargesHelper extends IntegrationTest {
|
||||
map.put("currencyCode", ChargesHelper.CURRENCY_CODE);
|
||||
map.put("locale", CommonConstants.LOCALE);
|
||||
map.put("monthDayFormat", ChargesHelper.MONTH_DAY_FORMAT);
|
||||
map.put("name", Utils.randomNameGenerator("Charge_client_", 8));
|
||||
map.put("name", Utils.uniqueRandomStringGenerator("Charge_client_", 8));
|
||||
return map;
|
||||
}
|
||||
|
||||
@@ -356,7 +356,7 @@ public final class ChargesHelper extends IntegrationTest {
|
||||
map.put("chargeTimeType", ChargesHelper.SHAREACCOUNT_ACTIVATION);
|
||||
map.put("currencyCode", ChargesHelper.CURRENCY_CODE);
|
||||
map.put("locale", CommonConstants.LOCALE);
|
||||
map.put("name", Utils.randomNameGenerator("Charge_Share_Activation_", 8));
|
||||
map.put("name", Utils.uniqueRandomStringGenerator("Charge_Share_Activation_", 8));
|
||||
return map;
|
||||
}
|
||||
|
||||
@@ -369,7 +369,7 @@ public final class ChargesHelper extends IntegrationTest {
|
||||
map.put("chargeTimeType", ChargesHelper.SHARE_PURCHASE);
|
||||
map.put("currencyCode", ChargesHelper.CURRENCY_CODE);
|
||||
map.put("locale", CommonConstants.LOCALE);
|
||||
map.put("name", Utils.randomNameGenerator("Charge_Share_Purchase_", 8));
|
||||
map.put("name", Utils.uniqueRandomStringGenerator("Charge_Share_Purchase_", 8));
|
||||
return map;
|
||||
}
|
||||
|
||||
@@ -382,7 +382,7 @@ public final class ChargesHelper extends IntegrationTest {
|
||||
map.put("chargeTimeType", ChargesHelper.SHARE_REDEEM);
|
||||
map.put("currencyCode", ChargesHelper.CURRENCY_CODE);
|
||||
map.put("locale", CommonConstants.LOCALE);
|
||||
map.put("name", Utils.randomNameGenerator("Charge_Share_Redeem_", 8));
|
||||
map.put("name", Utils.uniqueRandomStringGenerator("Charge_Share_Redeem_", 8));
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -71,9 +71,9 @@ public class FixedDepositProductHelper {
|
||||
private static final String WHOLE_TERM = "1";
|
||||
private static final String TILL_PREMATURE_WITHDRAWAL = "2";
|
||||
|
||||
private String name = Utils.randomNameGenerator("FIXED_DEPOSIT_PRODUCT_", 6);
|
||||
private String shortName = Utils.randomNameGenerator("", 4);
|
||||
private String description = Utils.randomNameGenerator("", 20);
|
||||
private String name = Utils.uniqueRandomStringGenerator("FIXED_DEPOSIT_PRODUCT_", 6);
|
||||
private String shortName = Utils.uniqueRandomStringGenerator("", 4);
|
||||
private String description = Utils.randomStringGenerator("", 20);
|
||||
private String interestCompoundingPeriodType = MONTHLY;
|
||||
private String interestPostingPeriodType = MONTHLY;
|
||||
private String interestCalculationType = INTEREST_CALCULATION_USING_DAILY_BALANCE;
|
||||
|
||||
+2
-2
@@ -71,8 +71,8 @@ public class LoanProductTestBuilder {
|
||||
private String digitsAfterDecimal = "2";
|
||||
private String inMultiplesOf = "0";
|
||||
|
||||
private String nameOfLoanProduct = Utils.randomNameGenerator("LOAN_PRODUCT_", 6);
|
||||
private final String shortName = Utils.randomNameGenerator("", 4);
|
||||
private String nameOfLoanProduct = Utils.uniqueRandomStringGenerator("LOAN_PRODUCT_", 6);
|
||||
private final String shortName = Utils.uniqueRandomStringGenerator("", 4);
|
||||
private String principal = "10000.00";
|
||||
private String numberOfRepayments = "5";
|
||||
private String repaymentFrequency = MONTHS;
|
||||
|
||||
+1
-1
@@ -1522,7 +1522,7 @@ public class LoanTransactionHelper extends IntegrationTest {
|
||||
HashMap<String, Object> datatableMap = new HashMap<>();
|
||||
HashMap<String, Object> dataMap = new HashMap<>();
|
||||
dataMap.put("locale", "en");
|
||||
dataMap.put("Spouse Name", Utils.randomNameGenerator("Spouse_name", 4));
|
||||
dataMap.put("Spouse Name", Utils.randomStringGenerator("Spouse_name", 4));
|
||||
dataMap.put("Number of Dependents", 5);
|
||||
dataMap.put("Time of Visit", "01 December 2016 04:03");
|
||||
dataMap.put("dateFormat", DATE_TIME_FORMAT);
|
||||
|
||||
+4
-4
@@ -108,11 +108,11 @@ public class CampaignsHelper {
|
||||
map.put("triggerType", triggerType);
|
||||
if (2 == triggerType) {
|
||||
map.put("recurrenceStartDate",
|
||||
LocalDateTime.now(Utils.getZoneIdOfTenant()).format(DateTimeFormatter.ofPattern(DATE_TIME_FORMAT)));
|
||||
LocalDateTime.now(Utils.getZoneIdOfTenant()).plusMinutes(1).format(DateTimeFormatter.ofPattern(DATE_TIME_FORMAT)));
|
||||
map.put("frequency", 1);
|
||||
map.put("interval", "1");
|
||||
}
|
||||
map.put("campaignName", Utils.randomNameGenerator("Campaign_Name_", 5));
|
||||
map.put("campaignName", Utils.randomStringGenerator("Campaign_Name_", 5));
|
||||
map.put("campaignType", 1);
|
||||
map.put("message", "Hi, this is from integtration tests runner");
|
||||
map.put("locale", "en");
|
||||
@@ -136,9 +136,9 @@ public class CampaignsHelper {
|
||||
map.put("triggerType", triggerType);
|
||||
if (2 == triggerType) {
|
||||
map.put("recurrenceStartDate",
|
||||
LocalDateTime.now(Utils.getZoneIdOfTenant()).format(DateTimeFormatter.ofPattern(DATE_TIME_FORMAT)));
|
||||
LocalDateTime.now(Utils.getZoneIdOfTenant()).plusMinutes(1).format(DateTimeFormatter.ofPattern(DATE_TIME_FORMAT)));
|
||||
}
|
||||
map.put("campaignName", Utils.randomNameGenerator("Campaign_Name_", 5));
|
||||
map.put("campaignName", Utils.randomStringGenerator("Campaign_Name_", 5));
|
||||
map.put("campaignType", 1);
|
||||
map.put("message", "Hi, this is from integtration tests runner");
|
||||
map.put("locale", "en");
|
||||
|
||||
+5
-3
@@ -542,7 +542,7 @@ public class EntityDatatableChecksIntegrationTest {
|
||||
HashMap<String, Object> datatableMap = new HashMap<>();
|
||||
HashMap<String, Object> dataMap = new HashMap<>();
|
||||
dataMap.put("locale", "en");
|
||||
dataMap.put("Spouse Name", Utils.randomNameGenerator("Spouse_name", 4));
|
||||
dataMap.put("Spouse Name", Utils.randomStringGenerator("Spouse_name", 4));
|
||||
dataMap.put("Number of Dependents", 5);
|
||||
dataMap.put("Time of Visit", "01 December 2016 04:03");
|
||||
dataMap.put("dateFormat", DATE_TIME_FORMAT);
|
||||
@@ -558,8 +558,10 @@ public class EntityDatatableChecksIntegrationTest {
|
||||
// creating datatable for client entity person subentity
|
||||
HashMap<String, Object> columnMap = new HashMap<>();
|
||||
final List<HashMap<String, Object>> datatableColumnsList = new ArrayList<>();
|
||||
final String datatableNamePerson = Utils.randomNameGenerator(CLIENT_APP_TABLE_NAME + "_person_", 5).toLowerCase().toLowerCase();
|
||||
final String datatableNameEntity = Utils.randomNameGenerator(CLIENT_APP_TABLE_NAME + "_entity_", 5).toLowerCase().toLowerCase();
|
||||
final String datatableNamePerson = Utils.uniqueRandomStringGenerator(CLIENT_APP_TABLE_NAME + "_person_", 5).toLowerCase()
|
||||
.toLowerCase();
|
||||
final String datatableNameEntity = Utils.uniqueRandomStringGenerator(CLIENT_APP_TABLE_NAME + "_entity_", 5).toLowerCase()
|
||||
.toLowerCase();
|
||||
|
||||
String itsAString = "itsastring";
|
||||
DatatableHelper.addDatatableColumns(datatableColumnsList, itsAString, "String", true, 10, null);
|
||||
|
||||
+4
-4
@@ -105,8 +105,8 @@ public final class StaffHelper {
|
||||
final Map<String, Object> map = getMapWithJoiningDate();
|
||||
|
||||
map.put("officeId", 1);
|
||||
map.put("firstname", Utils.randomNameGenerator("michael_", 5));
|
||||
map.put("lastname", Utils.randomNameGenerator("Doe_", 4));
|
||||
map.put("firstname", Utils.uniqueRandomStringGenerator("michael_", 5));
|
||||
map.put("lastname", Utils.uniqueRandomStringGenerator("Doe_", 4));
|
||||
map.put("isLoanOfficer", true);
|
||||
|
||||
LOG.info("map : {}", map);
|
||||
@@ -131,10 +131,10 @@ public final class StaffHelper {
|
||||
map.put("officeId", 1);
|
||||
}
|
||||
if (fieldList.contains("firstname")) {
|
||||
map.put("firstname", Utils.randomNameGenerator("michael_", 5));
|
||||
map.put("firstname", Utils.uniqueRandomStringGenerator("michael_", 5));
|
||||
}
|
||||
if (fieldList.contains("lastname")) {
|
||||
map.put("lastname", Utils.randomNameGenerator("Doe_", 4));
|
||||
map.put("lastname", Utils.uniqueRandomStringGenerator("Doe_", 4));
|
||||
}
|
||||
if (fieldList.contains("isLoanOfficer")) {
|
||||
map.put("isLoanOfficer", true);
|
||||
|
||||
+1
-1
@@ -89,7 +89,7 @@ public class DelinquencyBucketsHelper {
|
||||
|
||||
public static String getAsJSON(final ArrayList<Integer> rangeIds) {
|
||||
final HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("name", Utils.randomNameGenerator("Delinquency_Bucket_", 4));
|
||||
map.put("name", Utils.uniqueRandomStringGenerator("Delinquency_Bucket_", 4));
|
||||
map.put("ranges", rangeIds.toArray());
|
||||
return new Gson().toJson(map);
|
||||
}
|
||||
|
||||
+1
-1
@@ -85,7 +85,7 @@ public class DelinquencyRangesHelper {
|
||||
|
||||
public static String getAsJSON(int minimumAgeDays, int maximumAgeDays) {
|
||||
final HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("classification", Utils.randomNameGenerator("Delinquency__" + minimumAgeDays + "_" + maximumAgeDays + "__", 4));
|
||||
map.put("classification", Utils.uniqueRandomStringGenerator("Delinquency__" + minimumAgeDays + "_" + maximumAgeDays + "__", 4));
|
||||
map.put("minimumAgeDays", minimumAgeDays);
|
||||
map.put("maximumAgeDays", maximumAgeDays);
|
||||
map.put("locale", "en");
|
||||
|
||||
+1
-1
@@ -77,7 +77,7 @@ public final class RatesHelper {
|
||||
map.put("percentage", RatesHelper.PERCENTAGE);
|
||||
map.put("locale", "en");
|
||||
map.put("productApply", RatesHelper.PRODUCT_APPLY_LOAN);
|
||||
map.put("name", Utils.randomNameGenerator("Rate_Loans_", 6));
|
||||
map.put("name", Utils.uniqueRandomStringGenerator("Rate_Loans_", 6));
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -69,9 +69,9 @@ public class RecurringDepositProductHelper {
|
||||
private static final String WHOLE_TERM = "1";
|
||||
private static final String TILL_PREMATURE_WITHDRAWAL = "2";
|
||||
|
||||
private final String name = Utils.randomNameGenerator("RECURRING_DEPOSIT_PRODUCT_", 6);
|
||||
private final String shortName = Utils.randomNameGenerator("", 4);
|
||||
private final String description = Utils.randomNameGenerator("", 20);
|
||||
private final String name = Utils.uniqueRandomStringGenerator("RECURRING_DEPOSIT_PRODUCT_", 6);
|
||||
private final String shortName = Utils.uniqueRandomStringGenerator("", 4);
|
||||
private final String description = Utils.randomStringGenerator("", 20);
|
||||
private final String interestCompoundingPeriodType = MONTHLY;
|
||||
private final String interestPostingPeriodType = MONTHLY;
|
||||
private final String interestCalculationType = INTEREST_CALCULATION_USING_DAILY_BALANCE;
|
||||
|
||||
+1
-1
@@ -801,7 +801,7 @@ public class SavingsAccountHelper {
|
||||
HashMap<String, Object> datatableMap = new HashMap<>();
|
||||
HashMap<String, Object> dataMap = new HashMap<>();
|
||||
dataMap.put("locale", "en");
|
||||
dataMap.put("Spouse Name", Utils.randomNameGenerator("Spouse_name", 4));
|
||||
dataMap.put("Spouse Name", Utils.randomStringGenerator("Spouse_name", 4));
|
||||
dataMap.put("Number of Dependents", 5);
|
||||
dataMap.put("Time of Visit", "01 December 2016 04:03");
|
||||
dataMap.put("dateFormat", DATE_TIME_FORMAT);
|
||||
|
||||
+3
-3
@@ -57,9 +57,9 @@ public class SavingsProductHelper {
|
||||
private static final String NONE = "1";
|
||||
private static final String CASH_BASED = "2";
|
||||
|
||||
private String nameOfSavingsProduct = Utils.randomNameGenerator("SAVINGS_PRODUCT_", 6);
|
||||
private String shortName = Utils.randomNameGenerator("", 4);
|
||||
private String description = Utils.randomNameGenerator("", 20);
|
||||
private String nameOfSavingsProduct = Utils.uniqueRandomStringGenerator("SAVINGS_PRODUCT_", 6);
|
||||
private String shortName = Utils.uniqueRandomStringGenerator("", 4);
|
||||
private String description = Utils.randomStringGenerator("", 20);
|
||||
private String interestCompoundingPeriodType = "4";
|
||||
private String interestPostingPeriodType = "4";
|
||||
private String interestCalculationType = INTEREST_CALCULATION_USING_DAILY_BALANCE;
|
||||
|
||||
+3
-3
@@ -42,9 +42,9 @@ public class ShareProductHelper {
|
||||
private static final String IN_MULTIPLES_OF = "0";
|
||||
private static final String USD = "USD";
|
||||
|
||||
private String productName = Utils.randomNameGenerator("SHARE_PRODUCT_", 6);
|
||||
private String shortName = Utils.randomNameGenerator("", 4);
|
||||
private String description = Utils.randomNameGenerator("", 20);
|
||||
private String productName = Utils.uniqueRandomStringGenerator("SHARE_PRODUCT_", 6);
|
||||
private String shortName = Utils.uniqueRandomStringGenerator("", 4);
|
||||
private String description = Utils.randomStringGenerator("", 20);
|
||||
private String totalShares = "10000";
|
||||
private final String currencyCode = USD;
|
||||
private String sharesIssued = "10000";
|
||||
|
||||
+1
-1
@@ -100,7 +100,7 @@ public final class CodeHelper {
|
||||
/* If Code Values doesn't exist,then create Code value */
|
||||
if (codeValuesList.size() == 0) {
|
||||
final Integer codeValuePosition = 0;
|
||||
final String codeValue = Utils.randomNameGenerator("", 3);
|
||||
final String codeValue = Utils.randomStringGenerator("", 3);
|
||||
codeValueId = (Integer) CodeHelper.createCodeValue(requestSpec, responseSpec, codeId, codeValue, codeValuePosition,
|
||||
"subResourceId");
|
||||
|
||||
|
||||
+4
-3
@@ -164,7 +164,8 @@ public class DatatableHelper extends IntegrationTest {
|
||||
final boolean multiRow) {
|
||||
final HashMap<String, Object> map = new HashMap<>();
|
||||
final List<HashMap<String, Object>> datatableColumnsList = new ArrayList<>();
|
||||
map.put("datatableName", Objects.requireNonNullElseGet(datatableName, () -> Utils.randomNameGenerator(apptableName + "_", 5)));
|
||||
map.put("datatableName",
|
||||
Objects.requireNonNullElseGet(datatableName, () -> Utils.uniqueRandomStringGenerator(apptableName + "_", 5)));
|
||||
map.put("apptableName", apptableName);
|
||||
if ("m_client".equalsIgnoreCase(apptableName)) {
|
||||
map.put("entitySubType", "PERSON");
|
||||
@@ -189,7 +190,7 @@ public class DatatableHelper extends IntegrationTest {
|
||||
public static String getTestDatatableAsJSON(final String apptableName, final boolean multiRow) {
|
||||
final HashMap<String, Object> map = new HashMap<>();
|
||||
final List<HashMap<String, Object>> datatableColumnsList = new ArrayList<>();
|
||||
map.put("datatableName", Utils.randomNameGenerator(apptableName + "_", 5));
|
||||
map.put("datatableName", Utils.uniqueRandomStringGenerator(apptableName + "_", 5));
|
||||
map.put("apptableName", apptableName);
|
||||
map.put("entitySubType", "PERSON");
|
||||
map.put("multiRow", multiRow);
|
||||
@@ -205,7 +206,7 @@ public class DatatableHelper extends IntegrationTest {
|
||||
|
||||
public static String getTestDatatableEntryAsJSON(final String dateFormat) {
|
||||
final HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("Spouse Name", Utils.randomNameGenerator("Spouse_Name_", 5));
|
||||
map.put("Spouse Name", Utils.randomStringGenerator("Spouse_Name_", 5));
|
||||
map.put("Number of Dependents", Utils.randomNumberGenerator(1));
|
||||
map.put("Date of Approval", Utils.convertDateToURLFormat(Calendar.getInstance(), dateFormat));
|
||||
map.put("locale", "en");
|
||||
|
||||
+2
-2
@@ -47,8 +47,8 @@ public class GuarantorTestBuilder {
|
||||
map.put("guarantorTypeId", guarantorTypeId);
|
||||
map.put("locale", "en");
|
||||
if (GUARANTOR_TYPE_EXTERNAL.equals(guarantorTypeId)) {
|
||||
map.put("firstname", Utils.randomNameGenerator("guarantor_FirstName_", 5));
|
||||
map.put("lastname", Utils.randomNameGenerator("guarantor_LastName_", 4));
|
||||
map.put("firstname", Utils.randomStringGenerator("guarantor_FirstName_", 5));
|
||||
map.put("lastname", Utils.randomStringGenerator("guarantor_LastName_", 4));
|
||||
map.put("addressLine1", addressLine1);
|
||||
map.put("addressLine2", addressLine2);
|
||||
map.put("city", city);
|
||||
|
||||
+2
-2
@@ -392,11 +392,11 @@ public class InlineLoanCOBTest {
|
||||
|
||||
private void createNewSimpleUserWithoutBypassPermission() {
|
||||
GetOfficesResponse headOffice = OfficeHelper.getHeadOffice(requestSpec, responseSpec);
|
||||
String username = Utils.randomNameGenerator("NotificationUser", 4);
|
||||
String username = Utils.uniqueRandomStringGenerator("NotificationUser", 4);
|
||||
String password = Utils.randomStringGenerator("aA1", 10); // prefix is to conform with the password rules
|
||||
String simpleRoleId = createSimpleRole();
|
||||
PostUsersRequest createUserRequest = new PostUsersRequest().username(username)
|
||||
.firstname(Utils.randomNameGenerator("NotificationFN", 4)).lastname(Utils.randomNameGenerator("NotificationLN", 4))
|
||||
.firstname(Utils.randomStringGenerator("NotificationFN", 4)).lastname(Utils.randomStringGenerator("NotificationLN", 4))
|
||||
.email("whatever@mifos.org").password(password).repeatPassword(password).sendPasswordToEmail(false)
|
||||
.roles(List.of(simpleRoleId)).officeId(headOffice.getId());
|
||||
|
||||
|
||||
+2
-2
@@ -43,8 +43,8 @@ public final class RolesHelper {
|
||||
|
||||
public static String getTestCreateRoleAsJSON() {
|
||||
final HashMap<String, String> map = new HashMap<>();
|
||||
map.put("name", Utils.randomNameGenerator("Role_Name_", 5));
|
||||
map.put("description", Utils.randomNameGenerator("Role_Description_", 10));
|
||||
map.put("name", Utils.uniqueRandomStringGenerator("Role_Name_", 5));
|
||||
map.put("description", Utils.randomStringGenerator("Role_Description_", 10));
|
||||
return new Gson().toJson(map);
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -83,7 +83,7 @@ public final class UserHelper {
|
||||
}
|
||||
|
||||
public static String getTestCreateUserAsJSON(int roleId, int staffId) {
|
||||
return "{ \"username\": \"" + Utils.randomNameGenerator("User_Name_", 3)
|
||||
return "{ \"username\": \"" + Utils.uniqueRandomStringGenerator("User_Name_", 3)
|
||||
+ "\", \"firstname\": \"Test\", \"lastname\": \"User\", \"email\": \"whatever@mifos.org\","
|
||||
+ " \"officeId\": \"1\", \"staffId\": " + "\"" + staffId + "\",\"roles\": [\"" + roleId
|
||||
+ "\"], \"sendPasswordToEmail\": false}";
|
||||
@@ -108,7 +108,7 @@ public final class UserHelper {
|
||||
}
|
||||
|
||||
public static String getTestCreateUserAsJSONForSelfService(int roleId, int staffId, int clientId) {
|
||||
return "{ \"username\": \"" + Utils.randomNameGenerator("User_Name_", 3)
|
||||
return "{ \"username\": \"" + Utils.uniqueRandomStringGenerator("User_Name_", 3)
|
||||
+ "\", \"firstname\": \"Test\", \"lastname\": \"User\", \"email\": \"whatever@mifos.org\","
|
||||
+ " \"officeId\": \"1\", \"staffId\": " + "\"" + staffId + "\",\"roles\": [\"" + roleId
|
||||
+ "\"], \"sendPasswordToEmail\": false," + "\"isSelfServiceUser\" : true," + "\"clients\" : [\"" + clientId + "\"]}";
|
||||
|
||||
Reference in New Issue
Block a user