-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #686 from jayesh12234/develop
MOSIP-38064-Added Nrc id in Id Json and resident data
- Loading branch information
Showing
7 changed files
with
80 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
mosipTestDataProvider/src/io/mosip/testrig/dslrig/dataprovider/NrcIdProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package io.mosip.testrig.dslrig.dataprovider; | ||
|
||
import java.security.SecureRandom; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.Random; | ||
|
||
import io.mosip.testrig.dslrig.dataprovider.models.NrcId; | ||
|
||
public class NrcIdProvider { | ||
private static SecureRandom rand = new SecureRandom (); | ||
|
||
|
||
static int MAX_NUM = 9999; | ||
|
||
public static List<NrcId> generate(int count) { | ||
|
||
List<NrcId> nrcIds = new ArrayList<NrcId>(); | ||
for(int i=0; i < count; i++) { | ||
|
||
NrcId nrcId = new NrcId(); | ||
nrcId.setNrcId(generateNrcId(rand)); | ||
nrcIds.add(nrcId); | ||
} | ||
return nrcIds; | ||
} | ||
|
||
static String generateNrcId(Random rand) { | ||
return generateSixDigitNumber(rand) + "/" + generateTwoDigitNumber(rand) + "/" + generateOneDigitNumber(rand); | ||
} | ||
|
||
private static String generateSixDigitNumber(Random rand) { | ||
return String.format("%06d", rand.nextInt(1000000)); | ||
} | ||
|
||
private static String generateTwoDigitNumber(Random rand) { | ||
return String.format("%02d", rand.nextInt(100)); | ||
} | ||
|
||
private static String generateOneDigitNumber(Random rand) { | ||
return String.valueOf(rand.nextInt(10)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
mosipTestDataProvider/src/io/mosip/testrig/dslrig/dataprovider/models/NrcId.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package io.mosip.testrig.dslrig.dataprovider.models; | ||
|
||
import java.io.Serializable; | ||
|
||
public class NrcId implements Serializable { | ||
|
||
private static final long serialVersionUID = 1L; | ||
|
||
public String getNrcId() { | ||
return nrcId; | ||
} | ||
public void setNrcId(String nrcId) { | ||
this.nrcId = nrcId; | ||
} | ||
|
||
private String nrcId; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters