This is an automated email from the ASF dual-hosted git repository.
arnold pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract.git
The following commit(s) were added to refs/heads/develop by this push:
new c1570049e FINERACT-1724: Make tests more resilient
c1570049e is described below
commit c1570049ed79de3726a2fcae40cbb244fb7393dc
Author: Adam Saghy <[email protected]>
AuthorDate: Mon Feb 27 23:57:37 2023 +0100
FINERACT-1724: Make tests more resilient
---
.../fineract/integrationtests/BatchApiTest.java | 30 ++++++------
.../integrationtests/CenterIntegrationTest.java | 11 +++--
.../ClientAuditingIntegrationTest.java | 2 +-
.../integrationtests/ClientExternalIdTest.java | 5 +-
.../ClientLoanIntegrationTest.java | 25 +++++-----
.../fineract/integrationtests/ClientTest.java | 12 ++---
...ientUndoRejectAndWithdrawalIntegrationTest.java | 5 --
.../CreditBureauConfigurationTest.java | 2 +-
.../integrationtests/DatatableIntegrationTest.java | 8 ++--
.../DatatableUniqueAndIndexColumnTest.java | 4 +-
.../integrationtests/FundsIntegrationTest.java | 56 +++++++++++-----------
.../fineract/integrationtests/GroupTest.java | 2 +-
.../LoanAuditingIntegrationTest.java | 2 +-
.../LoanReschedulingWithinCenterTest.java | 9 ++--
.../LoanTransactionAuditingIntegrationTest.java | 2 +-
.../integrationtests/NotificationApiTest.java | 4 +-
.../integrationtests/OfficeIntegrationTest.java | 2 +-
.../RepaymentWithPostDatedChecksTest.java | 2 +-
.../ShareProductDatatableIntegrationTest.java | 4 +-
.../fineract/integrationtests/StaffTest.java | 47 +++++++++---------
.../fineract/integrationtests/SystemCodeTest.java | 2 +-
.../client/ClientEntityImportHandlerTest.java | 4 +-
.../importhandler/loan/LoanImportHandlerTest.java | 11 +++--
.../office/OfficeImportHandlerTest.java | 2 +-
.../savings/SavingsImportHandlerTest.java | 7 +--
.../populator/loan/LoanWorkbookPopulatorTest.java | 2 +-
.../integrationtests/common/BatchHelper.java | 4 +-
.../integrationtests/common/CalendarHelper.java | 2 +-
.../integrationtests/common/CenterDomain.java | 9 ++--
.../integrationtests/common/CenterHelper.java | 2 +-
.../integrationtests/common/ClientHelper.java | 29 +++++------
.../common/CollateralManagementHelper.java | 4 +-
.../integrationtests/common/GroupHelper.java | 13 ++---
.../integrationtests/common/HolidayHelper.java | 2 +-
.../integrationtests/common/HookHelper.java | 2 +-
.../integrationtests/common/OfficeHelper.java | 2 +-
.../common/StandingInstructionsHelper.java | 2 +-
.../fineract/integrationtests/common/Utils.java | 46 +++++++++++++-----
.../common/accounting/AccountingRuleBuilder.java | 2 +-
.../common/accounting/GLAccountBuilder.java | 18 +++----
.../common/charges/ChargesHelper.java | 14 +++---
.../fixeddeposit/FixedDepositProductHelper.java | 6 +--
.../common/loans/LoanProductTestBuilder.java | 4 +-
.../common/loans/LoanTransactionHelper.java | 2 +-
.../common/organisation/CampaignsHelper.java | 8 ++--
.../EntityDatatableChecksIntegrationTest.java | 8 ++--
.../common/organisation/StaffHelper.java | 8 ++--
.../common/products/DelinquencyBucketsHelper.java | 2 +-
.../common/products/DelinquencyRangesHelper.java | 2 +-
.../integrationtests/common/rates/RatesHelper.java | 2 +-
.../RecurringDepositProductHelper.java | 6 +--
.../common/savings/SavingsAccountHelper.java | 2 +-
.../common/savings/SavingsProductHelper.java | 6 +--
.../common/shares/ShareProductHelper.java | 6 +--
.../integrationtests/common/system/CodeHelper.java | 2 +-
.../common/system/DatatableHelper.java | 7 +--
.../guarantor/GuarantorTestBuilder.java | 4 +-
.../inlinecob/InlineLoanCOBTest.java | 4 +-
.../useradministration/roles/RolesHelper.java | 4 +-
.../useradministration/users/UserHelper.java | 4 +-
60 files changed, 256 insertions(+), 244 deletions(-)
diff --git
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/BatchApiTest.java
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/BatchApiTest.java
index ed9a788d8..151b302b3 100644
---
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/BatchApiTest.java
+++
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/BatchApiTest.java
@@ -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);
diff --git
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/CenterIntegrationTest.java
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/CenterIntegrationTest.java
index af85542df..64e18c774 100644
---
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/CenterIntegrationTest.java
+++
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/CenterIntegrationTest.java
@@ -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");
diff --git
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/ClientAuditingIntegrationTest.java
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/ClientAuditingIntegrationTest.java
index d65803840..15d41a937 100644
---
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/ClientAuditingIntegrationTest.java
+++
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/ClientAuditingIntegrationTest.java
@@ -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"));
diff --git
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/ClientExternalIdTest.java
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/ClientExternalIdTest.java
index ba283d7bc..438e141bb 100644
---
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/ClientExternalIdTest.java
+++
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/ClientExternalIdTest.java
@@ -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
diff --git
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/ClientLoanIntegrationTest.java
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/ClientLoanIntegrationTest.java
index ba102d3ee..64cf20c4a 100644
---
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/ClientLoanIntegrationTest.java
+++
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/ClientLoanIntegrationTest.java
@@ -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);
diff --git
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/ClientTest.java
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/ClientTest.java
index 5ffabbd27..e5ffeab2a 100644
---
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/ClientTest.java
+++
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/ClientTest.java
@@ -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;
diff --git
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/ClientUndoRejectAndWithdrawalIntegrationTest.java
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/ClientUndoRejectAndWithdrawalIntegrationTest.java
index b6916532c..55f702ebe 100644
---
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/ClientUndoRejectAndWithdrawalIntegrationTest.java
+++
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/ClientUndoRejectAndWithdrawalIntegrationTest.java
@@ -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");
- }
-
}
diff --git
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/CreditBureauConfigurationTest.java
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/CreditBureauConfigurationTest.java
index 70a01a3ec..9c312921a 100644
---
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/CreditBureauConfigurationTest.java
+++
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/CreditBureauConfigurationTest.java
@@ -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
diff --git
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/DatatableIntegrationTest.java
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/DatatableIntegrationTest.java
index 781064021..c33c12c72 100644
---
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/DatatableIntegrationTest.java
+++
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/DatatableIntegrationTest.java
@@ -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);
diff --git
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/DatatableUniqueAndIndexColumnTest.java
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/DatatableUniqueAndIndexColumnTest.java
index 5b98cf043..50d59dbdb 100644
---
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/DatatableUniqueAndIndexColumnTest.java
+++
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/DatatableUniqueAndIndexColumnTest.java
@@ -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";
diff --git
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/FundsIntegrationTest.java
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/FundsIntegrationTest.java
index 57a75a0d7..c2701221e 100644
---
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/FundsIntegrationTest.java
+++
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/FundsIntegrationTest.java
@@ -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);
diff --git
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/GroupTest.java
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/GroupTest.java
index 01bacd274..96b309e33 100644
---
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/GroupTest.java
+++
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/GroupTest.java
@@ -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());
diff --git
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanAuditingIntegrationTest.java
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanAuditingIntegrationTest.java
index 9da99fa1a..72c8a459c 100644
---
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanAuditingIntegrationTest.java
+++
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanAuditingIntegrationTest.java
@@ -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");
diff --git
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanReschedulingWithinCenterTest.java
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanReschedulingWithinCenterTest.java
index 8c1ebbd6f..17b261523 100644
---
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanReschedulingWithinCenterTest.java
+++
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanReschedulingWithinCenterTest.java
@@ -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");
diff --git
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanTransactionAuditingIntegrationTest.java
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanTransactionAuditingIntegrationTest.java
index 66e0a1d39..f97d2f196 100644
---
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanTransactionAuditingIntegrationTest.java
+++
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanTransactionAuditingIntegrationTest.java
@@ -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");
diff --git
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/NotificationApiTest.java
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/NotificationApiTest.java
index def1ca8b0..81152fdbc 100644
---
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/NotificationApiTest.java
+++
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/NotificationApiTest.java
@@ -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("[email protected]").password(password).repeatPassword(password).sendPasswordToEmail(false)
.roles(List.of(Long.toString(SUPER_USER_ROLE_ID))).officeId(headOffice.getId());
diff --git
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/OfficeIntegrationTest.java
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/OfficeIntegrationTest.java
index ec2216456..4ffd31fc4 100644
---
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/OfficeIntegrationTest.java
+++
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/OfficeIntegrationTest.java
@@ -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" };
diff --git
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/RepaymentWithPostDatedChecksTest.java
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/RepaymentWithPostDatedChecksTest.java
index 3b34dc5bd..42213327c 100644
---
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/RepaymentWithPostDatedChecksTest.java
+++
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/RepaymentWithPostDatedChecksTest.java
@@ -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;
}
diff --git
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/ShareProductDatatableIntegrationTest.java
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/ShareProductDatatableIntegrationTest.java
index ae26beae0..c9005e79e 100644
---
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/ShareProductDatatableIntegrationTest.java
+++
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/ShareProductDatatableIntegrationTest.java
@@ -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();
diff --git
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/StaffTest.java
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/StaffTest.java
index 75ce47bd0..eb83bd55f 100644
---
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/StaffTest.java
+++
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/StaffTest.java
@@ -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));
diff --git
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/SystemCodeTest.java
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/SystemCodeTest.java
index a5bb290c1..8b1408572 100644
---
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/SystemCodeTest.java
+++
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/SystemCodeTest.java
@@ -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";
diff --git
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/bulkimport/importhandler/client/ClientEntityImportHandlerTest.java
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/bulkimport/importhandler/client/ClientEntityImportHandlerTest.java
index 16753405a..473fd02d8 100644
---
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/bulkimport/importhandler/client/ClientEntityImportHandlerTest.java
+++
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/bulkimport/importhandler/client/ClientEntityImportHandlerTest.java
@@ -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)
diff --git
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/bulkimport/importhandler/loan/LoanImportHandlerTest.java
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/bulkimport/importhandler/loan/LoanImportHandlerTest.java
index 6307296f6..c38e5b9d1 100644
---
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/bulkimport/importhandler/loan/LoanImportHandlerTest.java
+++
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/bulkimport/importhandler/loan/LoanImportHandlerTest.java
@@ -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");
diff --git
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/bulkimport/importhandler/office/OfficeImportHandlerTest.java
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/bulkimport/importhandler/office/OfficeImportHandlerTest.java
index e8cfd013b..d8fb36acf 100644
---
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/bulkimport/importhandler/office/OfficeImportHandlerTest.java
+++
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/bulkimport/importhandler/office/OfficeImportHandlerTest.java
@@ -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)
diff --git
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/bulkimport/importhandler/savings/SavingsImportHandlerTest.java
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/bulkimport/importhandler/savings/SavingsImportHandlerTest.java
index 95a28dea0..9f6df3004 100644
---
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/bulkimport/importhandler/savings/SavingsImportHandlerTest.java
+++
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/bulkimport/importhandler/savings/SavingsImportHandlerTest.java
@@ -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());
diff --git
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/bulkimport/populator/loan/LoanWorkbookPopulatorTest.java
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/bulkimport/populator/loan/LoanWorkbookPopulatorTest.java
index 4cad8d9f9..9f4562211 100644
---
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/bulkimport/populator/loan/LoanWorkbookPopulatorTest.java
+++
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/bulkimport/populator/loan/LoanWorkbookPopulatorTest.java
@@ -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");
diff --git
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/BatchHelper.java
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/BatchHelper.java
index ea5e59b31..68a04c8ce 100644
---
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/BatchHelper.java
+++
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/BatchHelper.java
@@ -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);
diff --git
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/CalendarHelper.java
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/CalendarHelper.java
index fbcf833cf..76edbf9bf 100644
---
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/CalendarHelper.java
+++
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/CalendarHelper.java
@@ -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);
diff --git
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/CenterDomain.java
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/CenterDomain.java
index f030516c1..5ec1af121 100644
---
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/CenterDomain.java
+++
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/CenterDomain.java
@@ -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() {
diff --git
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/CenterHelper.java
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/CenterHelper.java
index b1365699b..413e64766 100644
---
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/CenterHelper.java
+++
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/CenterHelper.java
@@ -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,
diff --git
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/ClientHelper.java
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/ClientHelper.java
index e90414223..2659bc33d 100644
---
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/ClientHelper.java
+++
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/ClientHelper.java
@@ -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);
}
}
diff --git
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/CollateralManagementHelper.java
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/CollateralManagementHelper.java
index 7486e6655..b5ec61617 100644
---
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/CollateralManagementHelper.java
+++
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/CollateralManagementHelper.java
@@ -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");
}
diff --git
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/GroupHelper.java
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/GroupHelper.java
index 1148ed326..8b2a97ada 100644
---
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/GroupHelper.java
+++
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/GroupHelper.java
@@ -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);
diff --git
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/HolidayHelper.java
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/HolidayHelper.java
index 3d49f4c57..32f9a08e4 100644
---
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/HolidayHelper.java
+++
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/HolidayHelper.java
@@ -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");
diff --git
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/HookHelper.java
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/HookHelper.java
index d7b81302c..326b34938 100644
---
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/HookHelper.java
+++
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/HookHelper.java
@@ -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");
diff --git
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/OfficeHelper.java
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/OfficeHelper.java
index 3c4cb6d70..e6a47f054 100644
---
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/OfficeHelper.java
+++
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/OfficeHelper.java
@@ -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);
diff --git
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/StandingInstructionsHelper.java
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/StandingInstructionsHelper.java
index 91aa8a2a4..2cc61ccd1 100644
---
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/StandingInstructionsHelper.java
+++
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/StandingInstructionsHelper.java
@@ -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);
diff --git
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/Utils.java
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/Utils.java
index 035e2cadf..aa6fe7bd8 100644
---
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/Utils.java
+++
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/Utils.java
@@ -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 uniqueRandomStringGenerator(final String prefix,
final int lenOfRandomSuffix) {
+ return uniqueRandomGenerator(prefix, lenOfRandomSuffix,
SOURCE_SET_NUMBERS_AND_LETTERS);
}
- public static String randomNameGenerator(final String prefix, final int
lenOfRandomSuffix) {
- return randomStringGenerator(prefix, lenOfRandomSuffix);
+ 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);
diff --git
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/accounting/AccountingRuleBuilder.java
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/accounting/AccountingRuleBuilder.java
index 5eb467b50..3e2d953ff 100644
---
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/accounting/AccountingRuleBuilder.java
+++
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/accounting/AccountingRuleBuilder.java
@@ -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;
}
diff --git
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/accounting/GLAccountBuilder.java
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/accounting/GLAccountBuilder.java
index 0c9189fa7..9edec639f 100644
---
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/accounting/GLAccountBuilder.java
+++
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/accounting/GLAccountBuilder.java
@@ -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;
}
diff --git
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/charges/ChargesHelper.java
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/charges/ChargesHelper.java
index 91ab7dca9..ca1a10a26 100644
---
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/charges/ChargesHelper.java
+++
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/charges/ChargesHelper.java
@@ -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;
}
diff --git
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/fixeddeposit/FixedDepositProductHelper.java
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/fixeddeposit/FixedDepositProductHelper.java
index b46f778f6..f502d1b57 100644
---
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/fixeddeposit/FixedDepositProductHelper.java
+++
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/fixeddeposit/FixedDepositProductHelper.java
@@ -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;
diff --git
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/loans/LoanProductTestBuilder.java
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/loans/LoanProductTestBuilder.java
index 7f0eb32cc..7a2d50b1e 100644
---
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/loans/LoanProductTestBuilder.java
+++
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/loans/LoanProductTestBuilder.java
@@ -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;
diff --git
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/loans/LoanTransactionHelper.java
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/loans/LoanTransactionHelper.java
index 4d9dc927e..5d3860777 100644
---
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/loans/LoanTransactionHelper.java
+++
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/loans/LoanTransactionHelper.java
@@ -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);
diff --git
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/organisation/CampaignsHelper.java
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/organisation/CampaignsHelper.java
index 74f516341..27ceb9369 100644
---
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/organisation/CampaignsHelper.java
+++
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/organisation/CampaignsHelper.java
@@ -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");
diff --git
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/organisation/EntityDatatableChecksIntegrationTest.java
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/organisation/EntityDatatableChecksIntegrationTest.java
index d439c82f5..2ad4564ee 100644
---
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/organisation/EntityDatatableChecksIntegrationTest.java
+++
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/organisation/EntityDatatableChecksIntegrationTest.java
@@ -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);
diff --git
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/organisation/StaffHelper.java
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/organisation/StaffHelper.java
index 93e212e52..a992bba19 100644
---
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/organisation/StaffHelper.java
+++
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/organisation/StaffHelper.java
@@ -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);
diff --git
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/products/DelinquencyBucketsHelper.java
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/products/DelinquencyBucketsHelper.java
index 0d8dea91d..e034d6c6d 100644
---
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/products/DelinquencyBucketsHelper.java
+++
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/products/DelinquencyBucketsHelper.java
@@ -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);
}
diff --git
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/products/DelinquencyRangesHelper.java
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/products/DelinquencyRangesHelper.java
index 32a7cef4a..645b7282d 100644
---
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/products/DelinquencyRangesHelper.java
+++
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/products/DelinquencyRangesHelper.java
@@ -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");
diff --git
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/rates/RatesHelper.java
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/rates/RatesHelper.java
index 548b531c1..866ae3d99 100644
---
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/rates/RatesHelper.java
+++
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/rates/RatesHelper.java
@@ -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;
}
diff --git
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/recurringdeposit/RecurringDepositProductHelper.java
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/recurringdeposit/RecurringDepositProductHelper.java
index 6da8255a7..ca2650a94 100644
---
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/recurringdeposit/RecurringDepositProductHelper.java
+++
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/recurringdeposit/RecurringDepositProductHelper.java
@@ -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;
diff --git
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/savings/SavingsAccountHelper.java
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/savings/SavingsAccountHelper.java
index 8ce6a5b5b..423cdc8b4 100644
---
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/savings/SavingsAccountHelper.java
+++
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/savings/SavingsAccountHelper.java
@@ -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);
diff --git
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/savings/SavingsProductHelper.java
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/savings/SavingsProductHelper.java
index 6ede76cbd..4ce70847d 100644
---
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/savings/SavingsProductHelper.java
+++
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/savings/SavingsProductHelper.java
@@ -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;
diff --git
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/shares/ShareProductHelper.java
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/shares/ShareProductHelper.java
index 151ffebbb..d8068358d 100644
---
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/shares/ShareProductHelper.java
+++
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/shares/ShareProductHelper.java
@@ -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";
diff --git
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/system/CodeHelper.java
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/system/CodeHelper.java
index c1542ed76..6eed20b57 100644
---
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/system/CodeHelper.java
+++
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/system/CodeHelper.java
@@ -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");
diff --git
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/system/DatatableHelper.java
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/system/DatatableHelper.java
index ab3e3fc89..c1c37be2a 100644
---
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/system/DatatableHelper.java
+++
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/system/DatatableHelper.java
@@ -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");
diff --git
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/guarantor/GuarantorTestBuilder.java
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/guarantor/GuarantorTestBuilder.java
index c085d8923..0b793373d 100644
---
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/guarantor/GuarantorTestBuilder.java
+++
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/guarantor/GuarantorTestBuilder.java
@@ -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);
diff --git
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/inlinecob/InlineLoanCOBTest.java
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/inlinecob/InlineLoanCOBTest.java
index 984cc6959..f06b744d5 100644
---
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/inlinecob/InlineLoanCOBTest.java
+++
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/inlinecob/InlineLoanCOBTest.java
@@ -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("[email protected]").password(password).repeatPassword(password).sendPasswordToEmail(false)
.roles(List.of(simpleRoleId)).officeId(headOffice.getId());
diff --git
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/useradministration/roles/RolesHelper.java
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/useradministration/roles/RolesHelper.java
index 34e936359..c019275fa 100644
---
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/useradministration/roles/RolesHelper.java
+++
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/useradministration/roles/RolesHelper.java
@@ -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);
}
diff --git
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/useradministration/users/UserHelper.java
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/useradministration/users/UserHelper.java
index 23d7dbe24..316d0f317 100644
---
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/useradministration/users/UserHelper.java
+++
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/useradministration/users/UserHelper.java
@@ -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\": \"[email protected]\","
+ " \"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\": \"[email protected]\","
+ " \"officeId\": \"1\", \"staffId\": " + "\"" + staffId +
"\",\"roles\": [\"" + roleId
+ "\"], \"sendPasswordToEmail\": false," +
"\"isSelfServiceUser\" : true," + "\"clients\" : [\"" + clientId + "\"]}";