From 21fe60f21b505a8b858e9be5cf74122f654a8049 Mon Sep 17 00:00:00 2001 From: Xavi Aracil Date: Tue, 22 Nov 2022 13:57:35 +0100 Subject: [PATCH] Added basic json test resource --- .../org/oneedtech/inspect/vc/Samples.java | 36 +++++++++++-------- .../test/resources/ob20/basic-assertion.json | 18 ++++++++++ .../test/resources/ob20/basic-badgeclass.json | 10 ++++++ .../src/test/resources/ob20/basic-issuer.json | 8 +++++ 4 files changed, 58 insertions(+), 14 deletions(-) create mode 100644 inspector-vc/src/test/resources/ob20/basic-assertion.json create mode 100644 inspector-vc/src/test/resources/ob20/basic-badgeclass.json create mode 100644 inspector-vc/src/test/resources/ob20/basic-issuer.json diff --git a/inspector-vc/src/test/java/org/oneedtech/inspect/vc/Samples.java b/inspector-vc/src/test/java/org/oneedtech/inspect/vc/Samples.java index f47703a..35b7bf6 100644 --- a/inspector-vc/src/test/java/org/oneedtech/inspect/vc/Samples.java +++ b/inspector-vc/src/test/java/org/oneedtech/inspect/vc/Samples.java @@ -3,41 +3,49 @@ package org.oneedtech.inspect.vc; import org.oneedtech.inspect.test.Sample; public class Samples { - public static final class OB30 { - public static final class SVG { + public static final class OB30 { + public static final class SVG { public final static Sample SIMPLE_JSON_SVG = new Sample("ob30/simple-json.svg", true); - public final static Sample SIMPLE_JWT_SVG = new Sample("ob30/simple-jwt.svg", true); + public final static Sample SIMPLE_JWT_SVG = new Sample("ob30/simple-jwt.svg", true); } - public static final class JSON { + public static final class JSON { public final static Sample COMPLETE_JSON = new Sample("ob30/complete.json", false); public final static Sample SIMPLE_JSON = new Sample("ob30/simple.json", true); public final static Sample SIMPLE_DID_METHOD_JSON = new Sample("ob30/simple-did-method.json", true); public final static Sample SIMPLE_JSON_NOPROOF = new Sample("ob30/simple-noproof.json", false); public final static Sample SIMPLE_JSON_UNKNOWN_TYPE = new Sample("ob30/simple-err-type.json", false); - public final static Sample SIMPLE_JSON_PROOF_METHOD_ERROR = new Sample("ob30/simple-err-proof-method.json", false); - public final static Sample SIMPLE_JSON_PROOF_METHOD_NO_SCHEME_ERROR = new Sample("ob30/simple-err-proof-method-no-scheme.json", false); - public final static Sample SIMPLE_JSON_PROOF_METHOD_UNKNOWN_SCHEME_ERROR = new Sample("ob30/simple-err-proof-method-unknown-scheme.json", false); - public final static Sample SIMPLE_JSON_PROOF_METHOD_UNKNOWN_DID_METHOD_ERROR = new Sample("ob30/simple-err-proof-method-unknown-did-method.json", false); - public final static Sample SIMPLE_JSON_PROOF_VALUE_ERROR = new Sample("ob30/simple-err-proof-value.json", false); + public final static Sample SIMPLE_JSON_PROOF_METHOD_ERROR = new Sample("ob30/simple-err-proof-method.json", false); + public final static Sample SIMPLE_JSON_PROOF_METHOD_NO_SCHEME_ERROR = new Sample("ob30/simple-err-proof-method-no-scheme.json", false); + public final static Sample SIMPLE_JSON_PROOF_METHOD_UNKNOWN_SCHEME_ERROR = new Sample("ob30/simple-err-proof-method-unknown-scheme.json", false); + public final static Sample SIMPLE_JSON_PROOF_METHOD_UNKNOWN_DID_METHOD_ERROR = new Sample("ob30/simple-err-proof-method-unknown-did-method.json", false); + public final static Sample SIMPLE_JSON_PROOF_VALUE_ERROR = new Sample("ob30/simple-err-proof-value.json", false); public final static Sample SIMPLE_JSON_EXPIRED = new Sample("ob30/simple-err-expired.json", false); public final static Sample SIMPLE_JSON_ISSUED = new Sample("ob30/simple-err-issued.json", false); public final static Sample SIMPLE_JSON_ISSUER = new Sample("ob30/simple-err-issuer.json", false); public final static Sample SIMPLE_JSON_ERR_CONTEXT = new Sample("ob30/simple-err-context.json", false); } - public static final class PNG { + public static final class PNG { public final static Sample SIMPLE_JWT_PNG = new Sample("ob30/simple-jwt.png", true); - public final static Sample SIMPLE_JSON_PNG = new Sample("ob30/simple-json.png", true); + public final static Sample SIMPLE_JSON_PNG = new Sample("ob30/simple-json.png", true); } - public static final class JWT { + public static final class JWT { public final static Sample SIMPLE_JWT = new Sample("ob30/simple.jwt", true); } } - public static final class CLR20 { - public static final class JSON { + public static final class CLR20 { + public static final class JSON { public final static Sample SIMPLE_JSON = new Sample("clr20/simple.json", true); public final static Sample SIMPLE_JSON_NOPROOF = new Sample("clr20/simple-noproof.json", true); public final static Sample SIMPLE_JWT = new Sample("clr20/simple.jwt", true); } } + + public static final class OB20 { + public static final class JSON { + public final static Sample SIMPLE_ASSERTION_JSON = new Sample("ob20/basic-assertion.json", true); + public final static Sample SIMPLE_BADGECLASS_JSON = new Sample("ob20/basic-badgeclass.json", true); + public final static Sample SIMPLE_ISSUER_JSON = new Sample("ob20/basic-issuer.json", true); + } + } } diff --git a/inspector-vc/src/test/resources/ob20/basic-assertion.json b/inspector-vc/src/test/resources/ob20/basic-assertion.json new file mode 100644 index 0000000..4bc982b --- /dev/null +++ b/inspector-vc/src/test/resources/ob20/basic-assertion.json @@ -0,0 +1,18 @@ +{ + "@context": "https://w3id.org/openbadges/v2", + "type": "Assertion", + "id": "https://example.org/beths-robotics-badge.json", + "recipient": { + "type": "email", + "hashed": true, + "salt": "deadsea", + "identity": "sha256$ecf5409f3f4b91ab60cc5ef4c02aef7032354375e70cf4d8e43f6a1d29891942" + }, + "image": "https://example.org/beths-robot-badge.png", + "evidence": "https://example.org/beths-robot-work.html", + "issuedOn": "2016-12-31T23:59:59Z", + "badge": "https://example.org/robotics-badge.json", + "verification": { + "type": "hosted" + } + } \ No newline at end of file diff --git a/inspector-vc/src/test/resources/ob20/basic-badgeclass.json b/inspector-vc/src/test/resources/ob20/basic-badgeclass.json new file mode 100644 index 0000000..b53f3cc --- /dev/null +++ b/inspector-vc/src/test/resources/ob20/basic-badgeclass.json @@ -0,0 +1,10 @@ +{ + "@context": "https://w3id.org/openbadges/v2", + "type": "BadgeClass", + "id": "https://example.org/robotics-badge.json", + "name": "Awesome Robotics Badge", + "description": "For doing awesome things with robots that people think is pretty great.", + "image": "https://example.org/robotics-badge.png", + "criteria": "https://example.org/robotics-badge.html", + "issuer": "https://example.org/organization.json" +} \ No newline at end of file diff --git a/inspector-vc/src/test/resources/ob20/basic-issuer.json b/inspector-vc/src/test/resources/ob20/basic-issuer.json new file mode 100644 index 0000000..151dcc5 --- /dev/null +++ b/inspector-vc/src/test/resources/ob20/basic-issuer.json @@ -0,0 +1,8 @@ +{ + "@context": "https://w3id.org/openbadges/v2", + "type": "Issuer", + "id": "https://example.org/organization.json", + "name": "An Example Badge Issuer", + "url": "https://example.org", + "email": "contact@example.org" +} \ No newline at end of file