forked from mosip/digital-credential-plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' of https://github.com/mosip/digital-credential-plugins into develop the commit. Merged from upstream
- Loading branch information
Showing
16 changed files
with
886 additions
and
49 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
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
8 changes: 0 additions & 8 deletions
8
mock-certify-plugin/src/main/java/io/mosip/certify/util/IssuerKeyPairAndCertificate.java
This file was deleted.
Oops, something went wrong.
9 changes: 9 additions & 0 deletions
9
mock-certify-plugin/src/main/java/io/mosip/certify/util/UUIDGenerator.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,9 @@ | ||
package io.mosip.certify.util; | ||
|
||
import java.util.UUID; | ||
|
||
public class UUIDGenerator { | ||
public String generate() { | ||
return "urn:uuid:" + UUID.randomUUID(); | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
...rtify-plugin/src/test/java/io/mosip/certify/mock/integration/mocks/MdocGeneratorTest.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,30 @@ | ||
package io.mosip.certify.mock.integration.mocks; | ||
|
||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
|
||
public class MdocGeneratorTest { | ||
@Test | ||
void shouldGenerateMdocDataSuccessfully() { | ||
Map<String, Object> data = new HashMap<>(); | ||
data.put("family_name", "Mock"); | ||
data.put("given_name", "User"); | ||
data.put("birth_date", "2001-11-06"); | ||
data.put("issuing_country", "MK"); | ||
data.put("document_number", 1233); | ||
data.put("driving_privileges", new HashMap<>() {{ | ||
put("vehicle_category_code", "A"); | ||
}}); | ||
String generatedMdoc = new MdocGenerator().generate(data, | ||
"did:jwk:eyJrdHkiOiJFQyIsInVzZSI6InNpZyIsImNydiI6IlAtMjU2Iiwia2lkIjoiZEp2UzIzOXkyQk5Jc3VJdzZ4dG12M0QtLVotbC1yaDlZZ1NQYmhhOGRVVSIsIngiOiI0eDJtTUFHRHRMV3drRUtCMExnUHBYYmZzbVQtZ2FFeVg4c2lkZlFJV2NZIiwieSI6IlBkeU5LVlhyU1piNENZUW1vSzZsWDdadXgwRElCY25oSjktX2E3WmxZdGMiLCJhbGciOiJFUzI1NiJ9", | ||
"MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQg2U+wq/9uXZdMqJgjpaZ0SIkXLlVzZzVkhFKZIxD8adyhRANCAASO1Fw5eAjJH/GoYH4zp3SqSuNBY4EYZ2U+B8h9vbFbR6BkBUTP/nkhcKh9ZqmtEbFfupBOU0BnIHKeJrLaPOFH||LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUJ3RENDQVdXZ0F3SUJBZ0lVZnFVZ0pPd0NHUXlLOGkwNVAyL29sNW01dkNZd0NnWUlLb1pJemowRUF3SXcKVGpFTE1Ba0dBMVVFQmhNQ1RVc3hEakFNQmdOVkJBZ01CVTFMTFV0Qk1SRXdEd1lEVlFRSERBaE5iMk5yUTJsMAplVEVOTUFzR0ExVUVDZ3dFVFc5amF6RU5NQXNHQTFVRUN3d0VUVzlqYXpBZUZ3MHlOREV3TWpJd056QXlOVEJhCkZ3MHlOVEV3TWpJd056QXlOVEJhTUU0eEN6QUpCZ05WQkFZVEFrMUxNUTR3REFZRFZRUUlEQVZOU3kxTFFURVIKTUE4R0ExVUVCd3dJVFc5amEwTnBkSGt4RFRBTEJnTlZCQW9NQkUxdlkyc3hEVEFMQmdOVkJBc01CRTF2WTJzdwpXVEFUQmdjcWhrak9QUUlCQmdncWhrak9QUU1CQndOQ0FBU08xRnc1ZUFqSkgvR29ZSDR6cDNTcVN1TkJZNEVZCloyVStCOGg5dmJGYlI2QmtCVVRQL25raGNLaDlacW10RWJGZnVwQk9VMEJuSUhLZUpyTGFQT0ZIb3lFd0h6QWQKQmdOVkhRNEVGZ1FVMm9BZktsQmh6QmFoNVIrWXkvaEp2TzJpWVc4d0NnWUlLb1pJemowRUF3SURTUUF3UmdJaApBT3lDelAzQUpybnE2U2wvSytyM2Z2VnZrYUdSSmx2ZndidkVXaDlhQVcwbkFpRUFyRUFLV1VnNjF5VjRvUk1NClVacmRxdG9BT01wM2FLeHFGQzFkbkJDWSt2VT0KLS0tLS1FTkQgQ0VSVElGSUNBVEUtLS0tLQo="); | ||
|
||
Assertions.assertNotNull(generatedMdoc); | ||
} | ||
|
||
} | ||
|
14 changes: 14 additions & 0 deletions
14
mock-certify-plugin/src/test/java/io/mosip/certify/util/UUIDGeneratorTest.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,14 @@ | ||
package io.mosip.certify.util; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
class UUIDGeneratorTest { | ||
@Test | ||
void shouldReturnUUIDInRequiredFormatWhenGenerated() { | ||
String generatedUUID = new UUIDGenerator().generate(); | ||
|
||
assertTrue(generatedUUID.matches("^urn:uuid:[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}$")); | ||
} | ||
} |
Oops, something went wrong.