id stringlengths 7 14 | test_class dict | test_case dict | focal_class dict | focal_method dict | repository dict |
|---|---|---|---|---|---|
17517521_94 | {
"fields": [
{
"declarator": "PRIVATE_KEY_FILE = \"src/test/resources/rsa-private.pem\"",
"modifier": "private static final",
"original_string": "private static final String PRIVATE_KEY_FILE = \"src/test/resources/rsa-private.pem\";",
"type": "String",
"var_name": "PRIVATE_KEY_FILE"
},
{
"declarator": "PUBLIC_KEY_FILE = \"src/test/resources/rsa-public.pem\"",
"modifier": "private static final",
"original_string": "private static final String PUBLIC_KEY_FILE = \"src/test/resources/rsa-public.pem\";",
"type": "String",
"var_name": "PUBLIC_KEY_FILE"
},
{
"declarator": "INVALID_PUBLIC_KEY_FILE = \"src/test/resources/rsa-public_invalid.pem\"",
"modifier": "private static final",
"original_string": "private static final String INVALID_PUBLIC_KEY_FILE = \"src/test/resources/rsa-public_invalid.pem\";",
"type": "String",
"var_name": "INVALID_PUBLIC_KEY_FILE"
},
{
"declarator": "exception = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException exception = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "exception"
},
{
"declarator": "RS256Header = \"eyJhbGciOiJSUzI1NiJ9\"",
"modifier": "private static final",
"original_string": "private static final String RS256Header = \"eyJhbGciOiJSUzI1NiJ9\";",
"type": "String",
"var_name": "RS256Header"
},
{
"declarator": "RS384Header = \"eyJhbGciOiJSUzM4NCJ9\"",
"modifier": "private static final",
"original_string": "private static final String RS384Header = \"eyJhbGciOiJSUzM4NCJ9\";",
"type": "String",
"var_name": "RS384Header"
},
{
"declarator": "RS512Header = \"eyJhbGciOiJSUzUxMiJ9\"",
"modifier": "private static final",
"original_string": "private static final String RS512Header = \"eyJhbGciOiJSUzUxMiJ9\";",
"type": "String",
"var_name": "RS512Header"
},
{
"declarator": "auth0IssPayload = \"eyJpc3MiOiJhdXRoMCJ9\"",
"modifier": "private static final",
"original_string": "private static final String auth0IssPayload = \"eyJpc3MiOiJhdXRoMCJ9\";",
"type": "String",
"var_name": "auth0IssPayload"
}
],
"file": "lib/src/test/java/com/auth0/jwt/algorithms/RSAAlgorithmTest.java",
"identifier": "RSAAlgorithmTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void shouldFailRSA512VerificationWhenUsingPrivateKey() throws Exception {\n exception.expect(SignatureVerificationException.class);\n exception.expectMessage(\"The Token's Signature resulted invalid when verified using the Algorithm: SHA512withRSA\");\n exception.expectCause(isA(IllegalStateException.class));\n exception.expectCause(hasMessage(is(\"The given Public Key is null.\")));\n String jwt = \"eyJhbGciOiJSUzUxMiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJhdXRoMCJ9.mvL5LoMyIrWYjk5umEXZTmbyIrkbbcVPUkvdGZbu0qFBxGOf0nXP5PZBvPcOu084lvpwVox5n3VaD4iqzW-PsJyvKFgi5TnwmsbKchAp7JexQEsQOnTSGcfRqeUUiBZqRQdYsho71oAB3T4FnalDdFEpM-fztcZY9XqKyayqZLreTeBjqJm4jfOWH7KfGBHgZExQhe96NLq1UA9eUyQwdOA1Z0SgXe4Ja5PxZ6Fm37KnVDtDlNnY4JAAGFo6y74aGNnp_BKgpaVJCGFu1f1S5xCQ1HSvs8ZSdVWs5NgawW3wRd0kRt_GJ_Y3mIwiF4qUyHWGtsSHu_qjVdCTtbFyow\";\n Algorithm algorithm = Algorithm.RSA512((RSAKey) readPrivateKeyFromFile(PRIVATE_KEY_FILE, \"RSA\"));\n algorithm.verify(JWT.decode(jwt));\n }",
"class_method_signature": "RSAAlgorithmTest.shouldFailRSA512VerificationWhenUsingPrivateKey()",
"constructor": false,
"full_signature": "@Test public void shouldFailRSA512VerificationWhenUsingPrivateKey()",
"identifier": "shouldFailRSA512VerificationWhenUsingPrivateKey",
"invocations": [
"expect",
"expectMessage",
"expectCause",
"isA",
"expectCause",
"hasMessage",
"is",
"RSA512",
"readPrivateKeyFromFile",
"verify",
"decode"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void shouldFailRSA512VerificationWhenUsingPrivateKey()",
"testcase": true
} | {
"fields": [
{
"declarator": "keyProvider",
"modifier": "private final",
"original_string": "private final RSAKeyProvider keyProvider;",
"type": "RSAKeyProvider",
"var_name": "keyProvider"
},
{
"declarator": "crypto",
"modifier": "private final",
"original_string": "private final CryptoHelper crypto;",
"type": "CryptoHelper",
"var_name": "crypto"
}
],
"file": "lib/src/main/java/com/auth0/jwt/algorithms/RSAAlgorithm.java",
"identifier": "RSAAlgorithm",
"interfaces": "",
"methods": [
{
"class_method_signature": "RSAAlgorithm.RSAAlgorithm(CryptoHelper crypto, String id, String algorithm, RSAKeyProvider keyProvider)",
"constructor": true,
"full_signature": " RSAAlgorithm(CryptoHelper crypto, String id, String algorithm, RSAKeyProvider keyProvider)",
"identifier": "RSAAlgorithm",
"modifiers": "",
"parameters": "(CryptoHelper crypto, String id, String algorithm, RSAKeyProvider keyProvider)",
"return": "",
"signature": " RSAAlgorithm(CryptoHelper crypto, String id, String algorithm, RSAKeyProvider keyProvider)",
"testcase": false
},
{
"class_method_signature": "RSAAlgorithm.RSAAlgorithm(String id, String algorithm, RSAKeyProvider keyProvider)",
"constructor": true,
"full_signature": " RSAAlgorithm(String id, String algorithm, RSAKeyProvider keyProvider)",
"identifier": "RSAAlgorithm",
"modifiers": "",
"parameters": "(String id, String algorithm, RSAKeyProvider keyProvider)",
"return": "",
"signature": " RSAAlgorithm(String id, String algorithm, RSAKeyProvider keyProvider)",
"testcase": false
},
{
"class_method_signature": "RSAAlgorithm.verify(DecodedJWT jwt)",
"constructor": false,
"full_signature": "@Override public void verify(DecodedJWT jwt)",
"identifier": "verify",
"modifiers": "@Override public",
"parameters": "(DecodedJWT jwt)",
"return": "void",
"signature": "void verify(DecodedJWT jwt)",
"testcase": false
},
{
"class_method_signature": "RSAAlgorithm.sign(byte[] headerBytes, byte[] payloadBytes)",
"constructor": false,
"full_signature": "@Override @Deprecated public byte[] sign(byte[] headerBytes, byte[] payloadBytes)",
"identifier": "sign",
"modifiers": "@Override @Deprecated public",
"parameters": "(byte[] headerBytes, byte[] payloadBytes)",
"return": "byte[]",
"signature": "byte[] sign(byte[] headerBytes, byte[] payloadBytes)",
"testcase": false
},
{
"class_method_signature": "RSAAlgorithm.sign(byte[] contentBytes)",
"constructor": false,
"full_signature": "@Override public byte[] sign(byte[] contentBytes)",
"identifier": "sign",
"modifiers": "@Override public",
"parameters": "(byte[] contentBytes)",
"return": "byte[]",
"signature": "byte[] sign(byte[] contentBytes)",
"testcase": false
},
{
"class_method_signature": "RSAAlgorithm.getSigningKeyId()",
"constructor": false,
"full_signature": "@Override public String getSigningKeyId()",
"identifier": "getSigningKeyId",
"modifiers": "@Override public",
"parameters": "()",
"return": "String",
"signature": "String getSigningKeyId()",
"testcase": false
},
{
"class_method_signature": "RSAAlgorithm.providerForKeys(final RSAPublicKey publicKey, final RSAPrivateKey privateKey)",
"constructor": false,
"full_signature": "static RSAKeyProvider providerForKeys(final RSAPublicKey publicKey, final RSAPrivateKey privateKey)",
"identifier": "providerForKeys",
"modifiers": "static",
"parameters": "(final RSAPublicKey publicKey, final RSAPrivateKey privateKey)",
"return": "RSAKeyProvider",
"signature": "RSAKeyProvider providerForKeys(final RSAPublicKey publicKey, final RSAPrivateKey privateKey)",
"testcase": false
}
],
"superclass": "extends Algorithm"
} | {
"body": "@Override\n public void verify(DecodedJWT jwt) throws SignatureVerificationException {\n byte[] signatureBytes = Base64.decodeBase64(jwt.getSignature());\n\n try {\n RSAPublicKey publicKey = keyProvider.getPublicKeyById(jwt.getKeyId());\n if (publicKey == null) {\n throw new IllegalStateException(\"The given Public Key is null.\");\n }\n boolean valid = crypto.verifySignatureFor(getDescription(), publicKey, jwt.getHeader(), jwt.getPayload(), signatureBytes);\n if (!valid) {\n throw new SignatureVerificationException(this);\n }\n } catch (NoSuchAlgorithmException | SignatureException | InvalidKeyException | IllegalStateException e) {\n throw new SignatureVerificationException(this, e);\n }\n }",
"class_method_signature": "RSAAlgorithm.verify(DecodedJWT jwt)",
"constructor": false,
"full_signature": "@Override public void verify(DecodedJWT jwt)",
"identifier": "verify",
"invocations": [
"decodeBase64",
"getSignature",
"getPublicKeyById",
"getKeyId",
"verifySignatureFor",
"getDescription",
"getHeader",
"getPayload"
],
"modifiers": "@Override public",
"parameters": "(DecodedJWT jwt)",
"return": "void",
"signature": "void verify(DecodedJWT jwt)",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 691,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 17517521,
"size": 936,
"stargazer_count": 3678,
"stars": null,
"updates": null,
"url": "https://github.com/auth0/java-jwt"
} |
17517521_144 | {
"fields": [
{
"declarator": "PRIVATE_KEY_FILE_256 = \"src/test/resources/ec256-key-private.pem\"",
"modifier": "private static final",
"original_string": "private static final String PRIVATE_KEY_FILE_256 = \"src/test/resources/ec256-key-private.pem\";",
"type": "String",
"var_name": "PRIVATE_KEY_FILE_256"
},
{
"declarator": "PUBLIC_KEY_FILE_256 = \"src/test/resources/ec256-key-public.pem\"",
"modifier": "private static final",
"original_string": "private static final String PUBLIC_KEY_FILE_256 = \"src/test/resources/ec256-key-public.pem\";",
"type": "String",
"var_name": "PUBLIC_KEY_FILE_256"
},
{
"declarator": "INVALID_PUBLIC_KEY_FILE_256 = \"src/test/resources/ec256-key-public-invalid.pem\"",
"modifier": "private static final",
"original_string": "private static final String INVALID_PUBLIC_KEY_FILE_256 = \"src/test/resources/ec256-key-public-invalid.pem\";",
"type": "String",
"var_name": "INVALID_PUBLIC_KEY_FILE_256"
},
{
"declarator": "PRIVATE_KEY_FILE_256K = \"src/test/resources/ec256k-key-private.pem\"",
"modifier": "private static final",
"original_string": "private static final String PRIVATE_KEY_FILE_256K = \"src/test/resources/ec256k-key-private.pem\";",
"type": "String",
"var_name": "PRIVATE_KEY_FILE_256K"
},
{
"declarator": "PUBLIC_KEY_FILE_256K = \"src/test/resources/ec256k-key-public.pem\"",
"modifier": "private static final",
"original_string": "private static final String PUBLIC_KEY_FILE_256K = \"src/test/resources/ec256k-key-public.pem\";",
"type": "String",
"var_name": "PUBLIC_KEY_FILE_256K"
},
{
"declarator": "INVALID_PUBLIC_KEY_FILE_256K = \"src/test/resources/ec256k-key-public-invalid.pem\"",
"modifier": "private static final",
"original_string": "private static final String INVALID_PUBLIC_KEY_FILE_256K = \"src/test/resources/ec256k-key-public-invalid.pem\";",
"type": "String",
"var_name": "INVALID_PUBLIC_KEY_FILE_256K"
},
{
"declarator": "ES256K_JWT = \"eyJraWQiOiJteS1rZXktaWQiLCJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NksifQ.e30.2ggPsc4xwQhYcgJueo3uQ14MpaVJ3AbEE8UE-wA9fc8SMibeW54gjZbikL-JBHqhEwc22Cp8DNOtadXsM81RGQ\"",
"modifier": "private static final",
"original_string": "private static final String ES256K_JWT = \"eyJraWQiOiJteS1rZXktaWQiLCJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NksifQ.e30.2ggPsc4xwQhYcgJueo3uQ14MpaVJ3AbEE8UE-wA9fc8SMibeW54gjZbikL-JBHqhEwc22Cp8DNOtadXsM81RGQ\";",
"type": "String",
"var_name": "ES256K_JWT"
},
{
"declarator": "PRIVATE_KEY_FILE_384 = \"src/test/resources/ec384-key-private.pem\"",
"modifier": "private static final",
"original_string": "private static final String PRIVATE_KEY_FILE_384 = \"src/test/resources/ec384-key-private.pem\";",
"type": "String",
"var_name": "PRIVATE_KEY_FILE_384"
},
{
"declarator": "PUBLIC_KEY_FILE_384 = \"src/test/resources/ec384-key-public.pem\"",
"modifier": "private static final",
"original_string": "private static final String PUBLIC_KEY_FILE_384 = \"src/test/resources/ec384-key-public.pem\";",
"type": "String",
"var_name": "PUBLIC_KEY_FILE_384"
},
{
"declarator": "INVALID_PUBLIC_KEY_FILE_384 = \"src/test/resources/ec384-key-public-invalid.pem\"",
"modifier": "private static final",
"original_string": "private static final String INVALID_PUBLIC_KEY_FILE_384 = \"src/test/resources/ec384-key-public-invalid.pem\";",
"type": "String",
"var_name": "INVALID_PUBLIC_KEY_FILE_384"
},
{
"declarator": "PRIVATE_KEY_FILE_512 = \"src/test/resources/ec512-key-private.pem\"",
"modifier": "private static final",
"original_string": "private static final String PRIVATE_KEY_FILE_512 = \"src/test/resources/ec512-key-private.pem\";",
"type": "String",
"var_name": "PRIVATE_KEY_FILE_512"
},
{
"declarator": "PUBLIC_KEY_FILE_512 = \"src/test/resources/ec512-key-public.pem\"",
"modifier": "private static final",
"original_string": "private static final String PUBLIC_KEY_FILE_512 = \"src/test/resources/ec512-key-public.pem\";",
"type": "String",
"var_name": "PUBLIC_KEY_FILE_512"
},
{
"declarator": "INVALID_PUBLIC_KEY_FILE_512 = \"src/test/resources/ec512-key-public-invalid.pem\"",
"modifier": "private static final",
"original_string": "private static final String INVALID_PUBLIC_KEY_FILE_512 = \"src/test/resources/ec512-key-public-invalid.pem\";",
"type": "String",
"var_name": "INVALID_PUBLIC_KEY_FILE_512"
},
{
"declarator": "exception = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException exception = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "exception"
},
{
"declarator": "ES256Header = \"eyJhbGciOiJFUzI1NiJ9\"",
"modifier": "private static final",
"original_string": "private static final String ES256Header = \"eyJhbGciOiJFUzI1NiJ9\";",
"type": "String",
"var_name": "ES256Header"
},
{
"declarator": "ES384Header = \"eyJhbGciOiJFUzM4NCJ9\"",
"modifier": "private static final",
"original_string": "private static final String ES384Header = \"eyJhbGciOiJFUzM4NCJ9\";",
"type": "String",
"var_name": "ES384Header"
},
{
"declarator": "ES512Header = \"eyJhbGciOiJFUzUxMiJ9\"",
"modifier": "private static final",
"original_string": "private static final String ES512Header = \"eyJhbGciOiJFUzUxMiJ9\";",
"type": "String",
"var_name": "ES512Header"
},
{
"declarator": "auth0IssPayload = \"eyJpc3MiOiJhdXRoMCJ9\"",
"modifier": "private static final",
"original_string": "private static final String auth0IssPayload = \"eyJpc3MiOiJhdXRoMCJ9\";",
"type": "String",
"var_name": "auth0IssPayload"
},
{
"declarator": "ES256HeaderBytes = ES256Header.getBytes(StandardCharsets.UTF_8)",
"modifier": "private static final",
"original_string": "private static final byte[] ES256HeaderBytes = ES256Header.getBytes(StandardCharsets.UTF_8);",
"type": "byte[]",
"var_name": "ES256HeaderBytes"
},
{
"declarator": "ES384HeaderBytes = ES384Header.getBytes(StandardCharsets.UTF_8)",
"modifier": "private static final",
"original_string": "private static final byte[] ES384HeaderBytes = ES384Header.getBytes(StandardCharsets.UTF_8);",
"type": "byte[]",
"var_name": "ES384HeaderBytes"
},
{
"declarator": "ES512HeaderBytes = ES512Header.getBytes(StandardCharsets.UTF_8)",
"modifier": "private static final",
"original_string": "private static final byte[] ES512HeaderBytes = ES512Header.getBytes(StandardCharsets.UTF_8);",
"type": "byte[]",
"var_name": "ES512HeaderBytes"
},
{
"declarator": "auth0IssPayloadBytes = auth0IssPayload.getBytes(StandardCharsets.UTF_8)",
"modifier": "private static final",
"original_string": "private static final byte[] auth0IssPayloadBytes = auth0IssPayload.getBytes(StandardCharsets.UTF_8);",
"type": "byte[]",
"var_name": "auth0IssPayloadBytes"
}
],
"file": "lib/src/test/java/com/auth0/jwt/algorithms/ECDSAAlgorithmTest.java",
"identifier": "ECDSAAlgorithmTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void shouldFailECDSA256VerificationOnInvalidJOSESignature() throws Exception {\n exception.expect(SignatureVerificationException.class);\n exception.expectMessage(\"The Token's Signature resulted invalid when verified using the Algorithm: SHA256withECDSA\");\n\n byte[] bytes = new byte[64];\n new SecureRandom().nextBytes(bytes);\n String signature = Base64.encodeBase64URLSafeString(bytes);\n String jwt = \"eyJhbGciOiJFUzI1NiJ9.eyJpc3MiOiJhdXRoMCJ9.\" + signature;\n Algorithm algorithm = Algorithm.ECDSA256((ECKey) readPublicKeyFromFile(INVALID_PUBLIC_KEY_FILE_256, \"EC\"));\n algorithm.verify(JWT.decode(jwt));\n }",
"class_method_signature": "ECDSAAlgorithmTest.shouldFailECDSA256VerificationOnInvalidJOSESignature()",
"constructor": false,
"full_signature": "@Test public void shouldFailECDSA256VerificationOnInvalidJOSESignature()",
"identifier": "shouldFailECDSA256VerificationOnInvalidJOSESignature",
"invocations": [
"expect",
"expectMessage",
"nextBytes",
"encodeBase64URLSafeString",
"ECDSA256",
"readPublicKeyFromFile",
"verify",
"decode"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void shouldFailECDSA256VerificationOnInvalidJOSESignature()",
"testcase": true
} | {
"fields": [
{
"declarator": "keyProvider",
"modifier": "private final",
"original_string": "private final ECDSAKeyProvider keyProvider;",
"type": "ECDSAKeyProvider",
"var_name": "keyProvider"
},
{
"declarator": "crypto",
"modifier": "private final",
"original_string": "private final CryptoHelper crypto;",
"type": "CryptoHelper",
"var_name": "crypto"
},
{
"declarator": "ecNumberSize",
"modifier": "private final",
"original_string": "private final int ecNumberSize;",
"type": "int",
"var_name": "ecNumberSize"
}
],
"file": "lib/src/main/java/com/auth0/jwt/algorithms/ECDSAAlgorithm.java",
"identifier": "ECDSAAlgorithm",
"interfaces": "",
"methods": [
{
"class_method_signature": "ECDSAAlgorithm.ECDSAAlgorithm(CryptoHelper crypto, String id, String algorithm, int ecNumberSize, ECDSAKeyProvider keyProvider)",
"constructor": true,
"full_signature": " ECDSAAlgorithm(CryptoHelper crypto, String id, String algorithm, int ecNumberSize, ECDSAKeyProvider keyProvider)",
"identifier": "ECDSAAlgorithm",
"modifiers": "",
"parameters": "(CryptoHelper crypto, String id, String algorithm, int ecNumberSize, ECDSAKeyProvider keyProvider)",
"return": "",
"signature": " ECDSAAlgorithm(CryptoHelper crypto, String id, String algorithm, int ecNumberSize, ECDSAKeyProvider keyProvider)",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.ECDSAAlgorithm(String id, String algorithm, int ecNumberSize, ECDSAKeyProvider keyProvider)",
"constructor": true,
"full_signature": " ECDSAAlgorithm(String id, String algorithm, int ecNumberSize, ECDSAKeyProvider keyProvider)",
"identifier": "ECDSAAlgorithm",
"modifiers": "",
"parameters": "(String id, String algorithm, int ecNumberSize, ECDSAKeyProvider keyProvider)",
"return": "",
"signature": " ECDSAAlgorithm(String id, String algorithm, int ecNumberSize, ECDSAKeyProvider keyProvider)",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.verify(DecodedJWT jwt)",
"constructor": false,
"full_signature": "@Override public void verify(DecodedJWT jwt)",
"identifier": "verify",
"modifiers": "@Override public",
"parameters": "(DecodedJWT jwt)",
"return": "void",
"signature": "void verify(DecodedJWT jwt)",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.sign(byte[] headerBytes, byte[] payloadBytes)",
"constructor": false,
"full_signature": "@Override public byte[] sign(byte[] headerBytes, byte[] payloadBytes)",
"identifier": "sign",
"modifiers": "@Override public",
"parameters": "(byte[] headerBytes, byte[] payloadBytes)",
"return": "byte[]",
"signature": "byte[] sign(byte[] headerBytes, byte[] payloadBytes)",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.sign(byte[] contentBytes)",
"constructor": false,
"full_signature": "@Override @Deprecated public byte[] sign(byte[] contentBytes)",
"identifier": "sign",
"modifiers": "@Override @Deprecated public",
"parameters": "(byte[] contentBytes)",
"return": "byte[]",
"signature": "byte[] sign(byte[] contentBytes)",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.getSigningKeyId()",
"constructor": false,
"full_signature": "@Override public String getSigningKeyId()",
"identifier": "getSigningKeyId",
"modifiers": "@Override public",
"parameters": "()",
"return": "String",
"signature": "String getSigningKeyId()",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.DERToJOSE(byte[] derSignature)",
"constructor": false,
"full_signature": " byte[] DERToJOSE(byte[] derSignature)",
"identifier": "DERToJOSE",
"modifiers": "",
"parameters": "(byte[] derSignature)",
"return": "byte[]",
"signature": "byte[] DERToJOSE(byte[] derSignature)",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.JOSEToDER(byte[] joseSignature)",
"constructor": false,
"full_signature": " byte[] JOSEToDER(byte[] joseSignature)",
"identifier": "JOSEToDER",
"modifiers": "",
"parameters": "(byte[] joseSignature)",
"return": "byte[]",
"signature": "byte[] JOSEToDER(byte[] joseSignature)",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.countPadding(byte[] bytes, int fromIndex, int toIndex)",
"constructor": false,
"full_signature": "private int countPadding(byte[] bytes, int fromIndex, int toIndex)",
"identifier": "countPadding",
"modifiers": "private",
"parameters": "(byte[] bytes, int fromIndex, int toIndex)",
"return": "int",
"signature": "int countPadding(byte[] bytes, int fromIndex, int toIndex)",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.providerForKeys(final ECPublicKey publicKey, final ECPrivateKey privateKey)",
"constructor": false,
"full_signature": "static ECDSAKeyProvider providerForKeys(final ECPublicKey publicKey, final ECPrivateKey privateKey)",
"identifier": "providerForKeys",
"modifiers": "static",
"parameters": "(final ECPublicKey publicKey, final ECPrivateKey privateKey)",
"return": "ECDSAKeyProvider",
"signature": "ECDSAKeyProvider providerForKeys(final ECPublicKey publicKey, final ECPrivateKey privateKey)",
"testcase": false
}
],
"superclass": "extends Algorithm"
} | {
"body": "@Override\n public void verify(DecodedJWT jwt) throws SignatureVerificationException {\n byte[] signatureBytes = Base64.decodeBase64(jwt.getSignature());\n\n try {\n ECPublicKey publicKey = keyProvider.getPublicKeyById(jwt.getKeyId());\n if (publicKey == null) {\n throw new IllegalStateException(\"The given Public Key is null.\");\n }\n boolean valid = crypto.verifySignatureFor(getDescription(), publicKey, jwt.getHeader(), jwt.getPayload(), JOSEToDER(signatureBytes));\n\n if (!valid) {\n throw new SignatureVerificationException(this);\n }\n } catch (NoSuchAlgorithmException | SignatureException | InvalidKeyException | IllegalStateException e) {\n throw new SignatureVerificationException(this, e);\n }\n }",
"class_method_signature": "ECDSAAlgorithm.verify(DecodedJWT jwt)",
"constructor": false,
"full_signature": "@Override public void verify(DecodedJWT jwt)",
"identifier": "verify",
"invocations": [
"decodeBase64",
"getSignature",
"getPublicKeyById",
"getKeyId",
"verifySignatureFor",
"getDescription",
"getHeader",
"getPayload",
"JOSEToDER"
],
"modifiers": "@Override public",
"parameters": "(DecodedJWT jwt)",
"return": "void",
"signature": "void verify(DecodedJWT jwt)",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 691,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 17517521,
"size": 936,
"stargazer_count": 3678,
"stars": null,
"updates": null,
"url": "https://github.com/auth0/java-jwt"
} |
17517521_328 | {
"fields": [
{
"declarator": "exception = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException exception = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "exception"
},
{
"declarator": "deserializer",
"modifier": "private",
"original_string": "private PayloadDeserializer deserializer;",
"type": "PayloadDeserializer",
"var_name": "deserializer"
}
],
"file": "lib/src/test/java/com/auth0/jwt/impl/PayloadDeserializerTest.java",
"identifier": "PayloadDeserializerTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void shouldGetNullStringWhenParsingNullNode() throws Exception {\n Map<String, JsonNode> tree = new HashMap<>();\n NullNode node = NullNode.getInstance();\n tree.put(\"key\", node);\n\n String text = deserializer.getString(tree, \"key\");\n assertThat(text, is(nullValue()));\n }",
"class_method_signature": "PayloadDeserializerTest.shouldGetNullStringWhenParsingNullNode()",
"constructor": false,
"full_signature": "@Test public void shouldGetNullStringWhenParsingNullNode()",
"identifier": "shouldGetNullStringWhenParsingNullNode",
"invocations": [
"getInstance",
"put",
"getString",
"assertThat",
"is",
"nullValue"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void shouldGetNullStringWhenParsingNullNode()",
"testcase": true
} | {
"fields": [
{
"declarator": "objectReader",
"modifier": "private final",
"original_string": "private final ObjectReader objectReader;",
"type": "ObjectReader",
"var_name": "objectReader"
}
],
"file": "lib/src/main/java/com/auth0/jwt/impl/PayloadDeserializer.java",
"identifier": "PayloadDeserializer",
"interfaces": "",
"methods": [
{
"class_method_signature": "PayloadDeserializer.PayloadDeserializer(ObjectReader reader)",
"constructor": true,
"full_signature": " PayloadDeserializer(ObjectReader reader)",
"identifier": "PayloadDeserializer",
"modifiers": "",
"parameters": "(ObjectReader reader)",
"return": "",
"signature": " PayloadDeserializer(ObjectReader reader)",
"testcase": false
},
{
"class_method_signature": "PayloadDeserializer.PayloadDeserializer(Class<?> vc, ObjectReader reader)",
"constructor": true,
"full_signature": "private PayloadDeserializer(Class<?> vc, ObjectReader reader)",
"identifier": "PayloadDeserializer",
"modifiers": "private",
"parameters": "(Class<?> vc, ObjectReader reader)",
"return": "",
"signature": " PayloadDeserializer(Class<?> vc, ObjectReader reader)",
"testcase": false
},
{
"class_method_signature": "PayloadDeserializer.deserialize(JsonParser p, DeserializationContext ctxt)",
"constructor": false,
"full_signature": "@Override public Payload deserialize(JsonParser p, DeserializationContext ctxt)",
"identifier": "deserialize",
"modifiers": "@Override public",
"parameters": "(JsonParser p, DeserializationContext ctxt)",
"return": "Payload",
"signature": "Payload deserialize(JsonParser p, DeserializationContext ctxt)",
"testcase": false
},
{
"class_method_signature": "PayloadDeserializer.getStringOrArray(Map<String, JsonNode> tree, String claimName)",
"constructor": false,
"full_signature": " List<String> getStringOrArray(Map<String, JsonNode> tree, String claimName)",
"identifier": "getStringOrArray",
"modifiers": "",
"parameters": "(Map<String, JsonNode> tree, String claimName)",
"return": "List<String>",
"signature": "List<String> getStringOrArray(Map<String, JsonNode> tree, String claimName)",
"testcase": false
},
{
"class_method_signature": "PayloadDeserializer.getDateFromSeconds(Map<String, JsonNode> tree, String claimName)",
"constructor": false,
"full_signature": " Date getDateFromSeconds(Map<String, JsonNode> tree, String claimName)",
"identifier": "getDateFromSeconds",
"modifiers": "",
"parameters": "(Map<String, JsonNode> tree, String claimName)",
"return": "Date",
"signature": "Date getDateFromSeconds(Map<String, JsonNode> tree, String claimName)",
"testcase": false
},
{
"class_method_signature": "PayloadDeserializer.getString(Map<String, JsonNode> tree, String claimName)",
"constructor": false,
"full_signature": " String getString(Map<String, JsonNode> tree, String claimName)",
"identifier": "getString",
"modifiers": "",
"parameters": "(Map<String, JsonNode> tree, String claimName)",
"return": "String",
"signature": "String getString(Map<String, JsonNode> tree, String claimName)",
"testcase": false
}
],
"superclass": "extends StdDeserializer<Payload>"
} | {
"body": "String getString(Map<String, JsonNode> tree, String claimName) {\n JsonNode node = tree.get(claimName);\n if (node == null || node.isNull()) {\n return null;\n }\n return node.asText(null);\n }",
"class_method_signature": "PayloadDeserializer.getString(Map<String, JsonNode> tree, String claimName)",
"constructor": false,
"full_signature": " String getString(Map<String, JsonNode> tree, String claimName)",
"identifier": "getString",
"invocations": [
"get",
"isNull",
"asText"
],
"modifiers": "",
"parameters": "(Map<String, JsonNode> tree, String claimName)",
"return": "String",
"signature": "String getString(Map<String, JsonNode> tree, String claimName)",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 691,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 17517521,
"size": 936,
"stargazer_count": 3678,
"stars": null,
"updates": null,
"url": "https://github.com/auth0/java-jwt"
} |
17517521_282 | {
"fields": [
{
"declarator": "exception = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException exception = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "exception"
},
{
"declarator": "parser",
"modifier": "private",
"original_string": "private JWTParser parser;",
"type": "JWTParser",
"var_name": "parser"
}
],
"file": "lib/src/test/java/com/auth0/jwt/impl/JWTParserTest.java",
"identifier": "JWTParserTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void shouldParseHeader() throws Exception {\n ObjectMapper mapper = mock(ObjectMapper.class);\n ObjectReader reader = mock(ObjectReader.class);\n when(mapper.readerFor(Header.class)).thenReturn(reader);\n JWTParser parser = new JWTParser(mapper);\n parser.parseHeader(\"{}\");\n\n verify(reader).readValue(\"{}\");\n }",
"class_method_signature": "JWTParserTest.shouldParseHeader()",
"constructor": false,
"full_signature": "@Test public void shouldParseHeader()",
"identifier": "shouldParseHeader",
"invocations": [
"mock",
"mock",
"thenReturn",
"when",
"readerFor",
"parseHeader",
"readValue",
"verify"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void shouldParseHeader()",
"testcase": true
} | {
"fields": [
{
"declarator": "payloadReader",
"modifier": "private final",
"original_string": "private final ObjectReader payloadReader;",
"type": "ObjectReader",
"var_name": "payloadReader"
},
{
"declarator": "headerReader",
"modifier": "private final",
"original_string": "private final ObjectReader headerReader;",
"type": "ObjectReader",
"var_name": "headerReader"
}
],
"file": "lib/src/main/java/com/auth0/jwt/impl/JWTParser.java",
"identifier": "JWTParser",
"interfaces": "implements JWTPartsParser",
"methods": [
{
"class_method_signature": "JWTParser.JWTParser()",
"constructor": true,
"full_signature": "public JWTParser()",
"identifier": "JWTParser",
"modifiers": "public",
"parameters": "()",
"return": "",
"signature": " JWTParser()",
"testcase": false
},
{
"class_method_signature": "JWTParser.JWTParser(ObjectMapper mapper)",
"constructor": true,
"full_signature": " JWTParser(ObjectMapper mapper)",
"identifier": "JWTParser",
"modifiers": "",
"parameters": "(ObjectMapper mapper)",
"return": "",
"signature": " JWTParser(ObjectMapper mapper)",
"testcase": false
},
{
"class_method_signature": "JWTParser.parsePayload(String json)",
"constructor": false,
"full_signature": "@Override public Payload parsePayload(String json)",
"identifier": "parsePayload",
"modifiers": "@Override public",
"parameters": "(String json)",
"return": "Payload",
"signature": "Payload parsePayload(String json)",
"testcase": false
},
{
"class_method_signature": "JWTParser.parseHeader(String json)",
"constructor": false,
"full_signature": "@Override public Header parseHeader(String json)",
"identifier": "parseHeader",
"modifiers": "@Override public",
"parameters": "(String json)",
"return": "Header",
"signature": "Header parseHeader(String json)",
"testcase": false
},
{
"class_method_signature": "JWTParser.addDeserializers(ObjectMapper mapper)",
"constructor": false,
"full_signature": "private void addDeserializers(ObjectMapper mapper)",
"identifier": "addDeserializers",
"modifiers": "private",
"parameters": "(ObjectMapper mapper)",
"return": "void",
"signature": "void addDeserializers(ObjectMapper mapper)",
"testcase": false
},
{
"class_method_signature": "JWTParser.getDefaultObjectMapper()",
"constructor": false,
"full_signature": "static ObjectMapper getDefaultObjectMapper()",
"identifier": "getDefaultObjectMapper",
"modifiers": "static",
"parameters": "()",
"return": "ObjectMapper",
"signature": "ObjectMapper getDefaultObjectMapper()",
"testcase": false
},
{
"class_method_signature": "JWTParser.decodeException()",
"constructor": false,
"full_signature": "private static JWTDecodeException decodeException()",
"identifier": "decodeException",
"modifiers": "private static",
"parameters": "()",
"return": "JWTDecodeException",
"signature": "JWTDecodeException decodeException()",
"testcase": false
},
{
"class_method_signature": "JWTParser.decodeException(String json)",
"constructor": false,
"full_signature": "private static JWTDecodeException decodeException(String json)",
"identifier": "decodeException",
"modifiers": "private static",
"parameters": "(String json)",
"return": "JWTDecodeException",
"signature": "JWTDecodeException decodeException(String json)",
"testcase": false
}
],
"superclass": ""
} | {
"body": "@Override\n public Header parseHeader(String json) throws JWTDecodeException {\n if (json == null) {\n throw decodeException();\n }\n\n try {\n return headerReader.readValue(json);\n } catch (IOException e) {\n throw decodeException(json);\n }\n }",
"class_method_signature": "JWTParser.parseHeader(String json)",
"constructor": false,
"full_signature": "@Override public Header parseHeader(String json)",
"identifier": "parseHeader",
"invocations": [
"decodeException",
"readValue",
"decodeException"
],
"modifiers": "@Override public",
"parameters": "(String json)",
"return": "Header",
"signature": "Header parseHeader(String json)",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 691,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 17517521,
"size": 936,
"stargazer_count": 3678,
"stars": null,
"updates": null,
"url": "https://github.com/auth0/java-jwt"
} |
17517521_329 | {
"fields": [
{
"declarator": "exception = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException exception = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "exception"
},
{
"declarator": "deserializer",
"modifier": "private",
"original_string": "private PayloadDeserializer deserializer;",
"type": "PayloadDeserializer",
"var_name": "deserializer"
}
],
"file": "lib/src/test/java/com/auth0/jwt/impl/PayloadDeserializerTest.java",
"identifier": "PayloadDeserializerTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void shouldGetNullStringWhenParsingNull() throws Exception {\n Map<String, JsonNode> tree = new HashMap<>();\n tree.put(\"key\", null);\n\n String text = deserializer.getString(tree, \"key\");\n assertThat(text, is(nullValue()));\n }",
"class_method_signature": "PayloadDeserializerTest.shouldGetNullStringWhenParsingNull()",
"constructor": false,
"full_signature": "@Test public void shouldGetNullStringWhenParsingNull()",
"identifier": "shouldGetNullStringWhenParsingNull",
"invocations": [
"put",
"getString",
"assertThat",
"is",
"nullValue"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void shouldGetNullStringWhenParsingNull()",
"testcase": true
} | {
"fields": [
{
"declarator": "objectReader",
"modifier": "private final",
"original_string": "private final ObjectReader objectReader;",
"type": "ObjectReader",
"var_name": "objectReader"
}
],
"file": "lib/src/main/java/com/auth0/jwt/impl/PayloadDeserializer.java",
"identifier": "PayloadDeserializer",
"interfaces": "",
"methods": [
{
"class_method_signature": "PayloadDeserializer.PayloadDeserializer(ObjectReader reader)",
"constructor": true,
"full_signature": " PayloadDeserializer(ObjectReader reader)",
"identifier": "PayloadDeserializer",
"modifiers": "",
"parameters": "(ObjectReader reader)",
"return": "",
"signature": " PayloadDeserializer(ObjectReader reader)",
"testcase": false
},
{
"class_method_signature": "PayloadDeserializer.PayloadDeserializer(Class<?> vc, ObjectReader reader)",
"constructor": true,
"full_signature": "private PayloadDeserializer(Class<?> vc, ObjectReader reader)",
"identifier": "PayloadDeserializer",
"modifiers": "private",
"parameters": "(Class<?> vc, ObjectReader reader)",
"return": "",
"signature": " PayloadDeserializer(Class<?> vc, ObjectReader reader)",
"testcase": false
},
{
"class_method_signature": "PayloadDeserializer.deserialize(JsonParser p, DeserializationContext ctxt)",
"constructor": false,
"full_signature": "@Override public Payload deserialize(JsonParser p, DeserializationContext ctxt)",
"identifier": "deserialize",
"modifiers": "@Override public",
"parameters": "(JsonParser p, DeserializationContext ctxt)",
"return": "Payload",
"signature": "Payload deserialize(JsonParser p, DeserializationContext ctxt)",
"testcase": false
},
{
"class_method_signature": "PayloadDeserializer.getStringOrArray(Map<String, JsonNode> tree, String claimName)",
"constructor": false,
"full_signature": " List<String> getStringOrArray(Map<String, JsonNode> tree, String claimName)",
"identifier": "getStringOrArray",
"modifiers": "",
"parameters": "(Map<String, JsonNode> tree, String claimName)",
"return": "List<String>",
"signature": "List<String> getStringOrArray(Map<String, JsonNode> tree, String claimName)",
"testcase": false
},
{
"class_method_signature": "PayloadDeserializer.getDateFromSeconds(Map<String, JsonNode> tree, String claimName)",
"constructor": false,
"full_signature": " Date getDateFromSeconds(Map<String, JsonNode> tree, String claimName)",
"identifier": "getDateFromSeconds",
"modifiers": "",
"parameters": "(Map<String, JsonNode> tree, String claimName)",
"return": "Date",
"signature": "Date getDateFromSeconds(Map<String, JsonNode> tree, String claimName)",
"testcase": false
},
{
"class_method_signature": "PayloadDeserializer.getString(Map<String, JsonNode> tree, String claimName)",
"constructor": false,
"full_signature": " String getString(Map<String, JsonNode> tree, String claimName)",
"identifier": "getString",
"modifiers": "",
"parameters": "(Map<String, JsonNode> tree, String claimName)",
"return": "String",
"signature": "String getString(Map<String, JsonNode> tree, String claimName)",
"testcase": false
}
],
"superclass": "extends StdDeserializer<Payload>"
} | {
"body": "String getString(Map<String, JsonNode> tree, String claimName) {\n JsonNode node = tree.get(claimName);\n if (node == null || node.isNull()) {\n return null;\n }\n return node.asText(null);\n }",
"class_method_signature": "PayloadDeserializer.getString(Map<String, JsonNode> tree, String claimName)",
"constructor": false,
"full_signature": " String getString(Map<String, JsonNode> tree, String claimName)",
"identifier": "getString",
"invocations": [
"get",
"isNull",
"asText"
],
"modifiers": "",
"parameters": "(Map<String, JsonNode> tree, String claimName)",
"return": "String",
"signature": "String getString(Map<String, JsonNode> tree, String claimName)",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 691,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 17517521,
"size": 936,
"stargazer_count": 3678,
"stars": null,
"updates": null,
"url": "https://github.com/auth0/java-jwt"
} |
17517521_283 | {
"fields": [
{
"declarator": "exception = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException exception = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "exception"
},
{
"declarator": "parser",
"modifier": "private",
"original_string": "private JWTParser parser;",
"type": "JWTParser",
"var_name": "parser"
}
],
"file": "lib/src/test/java/com/auth0/jwt/impl/JWTParserTest.java",
"identifier": "JWTParserTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void shouldThrowOnInvalidHeader() throws Exception {\n String jsonHeader = \"}}\";\n exception.expect(JWTDecodeException.class);\n exception.expectMessage(String.format(\"The string '%s' doesn't have a valid JSON format.\", jsonHeader));\n Header header = parser.parseHeader(jsonHeader);\n assertThat(header, is(nullValue()));\n }",
"class_method_signature": "JWTParserTest.shouldThrowOnInvalidHeader()",
"constructor": false,
"full_signature": "@Test public void shouldThrowOnInvalidHeader()",
"identifier": "shouldThrowOnInvalidHeader",
"invocations": [
"expect",
"expectMessage",
"format",
"parseHeader",
"assertThat",
"is",
"nullValue"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void shouldThrowOnInvalidHeader()",
"testcase": true
} | {
"fields": [
{
"declarator": "payloadReader",
"modifier": "private final",
"original_string": "private final ObjectReader payloadReader;",
"type": "ObjectReader",
"var_name": "payloadReader"
},
{
"declarator": "headerReader",
"modifier": "private final",
"original_string": "private final ObjectReader headerReader;",
"type": "ObjectReader",
"var_name": "headerReader"
}
],
"file": "lib/src/main/java/com/auth0/jwt/impl/JWTParser.java",
"identifier": "JWTParser",
"interfaces": "implements JWTPartsParser",
"methods": [
{
"class_method_signature": "JWTParser.JWTParser()",
"constructor": true,
"full_signature": "public JWTParser()",
"identifier": "JWTParser",
"modifiers": "public",
"parameters": "()",
"return": "",
"signature": " JWTParser()",
"testcase": false
},
{
"class_method_signature": "JWTParser.JWTParser(ObjectMapper mapper)",
"constructor": true,
"full_signature": " JWTParser(ObjectMapper mapper)",
"identifier": "JWTParser",
"modifiers": "",
"parameters": "(ObjectMapper mapper)",
"return": "",
"signature": " JWTParser(ObjectMapper mapper)",
"testcase": false
},
{
"class_method_signature": "JWTParser.parsePayload(String json)",
"constructor": false,
"full_signature": "@Override public Payload parsePayload(String json)",
"identifier": "parsePayload",
"modifiers": "@Override public",
"parameters": "(String json)",
"return": "Payload",
"signature": "Payload parsePayload(String json)",
"testcase": false
},
{
"class_method_signature": "JWTParser.parseHeader(String json)",
"constructor": false,
"full_signature": "@Override public Header parseHeader(String json)",
"identifier": "parseHeader",
"modifiers": "@Override public",
"parameters": "(String json)",
"return": "Header",
"signature": "Header parseHeader(String json)",
"testcase": false
},
{
"class_method_signature": "JWTParser.addDeserializers(ObjectMapper mapper)",
"constructor": false,
"full_signature": "private void addDeserializers(ObjectMapper mapper)",
"identifier": "addDeserializers",
"modifiers": "private",
"parameters": "(ObjectMapper mapper)",
"return": "void",
"signature": "void addDeserializers(ObjectMapper mapper)",
"testcase": false
},
{
"class_method_signature": "JWTParser.getDefaultObjectMapper()",
"constructor": false,
"full_signature": "static ObjectMapper getDefaultObjectMapper()",
"identifier": "getDefaultObjectMapper",
"modifiers": "static",
"parameters": "()",
"return": "ObjectMapper",
"signature": "ObjectMapper getDefaultObjectMapper()",
"testcase": false
},
{
"class_method_signature": "JWTParser.decodeException()",
"constructor": false,
"full_signature": "private static JWTDecodeException decodeException()",
"identifier": "decodeException",
"modifiers": "private static",
"parameters": "()",
"return": "JWTDecodeException",
"signature": "JWTDecodeException decodeException()",
"testcase": false
},
{
"class_method_signature": "JWTParser.decodeException(String json)",
"constructor": false,
"full_signature": "private static JWTDecodeException decodeException(String json)",
"identifier": "decodeException",
"modifiers": "private static",
"parameters": "(String json)",
"return": "JWTDecodeException",
"signature": "JWTDecodeException decodeException(String json)",
"testcase": false
}
],
"superclass": ""
} | {
"body": "@Override\n public Header parseHeader(String json) throws JWTDecodeException {\n if (json == null) {\n throw decodeException();\n }\n\n try {\n return headerReader.readValue(json);\n } catch (IOException e) {\n throw decodeException(json);\n }\n }",
"class_method_signature": "JWTParser.parseHeader(String json)",
"constructor": false,
"full_signature": "@Override public Header parseHeader(String json)",
"identifier": "parseHeader",
"invocations": [
"decodeException",
"readValue",
"decodeException"
],
"modifiers": "@Override public",
"parameters": "(String json)",
"return": "Header",
"signature": "Header parseHeader(String json)",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 691,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 17517521,
"size": 936,
"stargazer_count": 3678,
"stars": null,
"updates": null,
"url": "https://github.com/auth0/java-jwt"
} |
17517521_145 | {
"fields": [
{
"declarator": "PRIVATE_KEY_FILE_256 = \"src/test/resources/ec256-key-private.pem\"",
"modifier": "private static final",
"original_string": "private static final String PRIVATE_KEY_FILE_256 = \"src/test/resources/ec256-key-private.pem\";",
"type": "String",
"var_name": "PRIVATE_KEY_FILE_256"
},
{
"declarator": "PUBLIC_KEY_FILE_256 = \"src/test/resources/ec256-key-public.pem\"",
"modifier": "private static final",
"original_string": "private static final String PUBLIC_KEY_FILE_256 = \"src/test/resources/ec256-key-public.pem\";",
"type": "String",
"var_name": "PUBLIC_KEY_FILE_256"
},
{
"declarator": "INVALID_PUBLIC_KEY_FILE_256 = \"src/test/resources/ec256-key-public-invalid.pem\"",
"modifier": "private static final",
"original_string": "private static final String INVALID_PUBLIC_KEY_FILE_256 = \"src/test/resources/ec256-key-public-invalid.pem\";",
"type": "String",
"var_name": "INVALID_PUBLIC_KEY_FILE_256"
},
{
"declarator": "PRIVATE_KEY_FILE_256K = \"src/test/resources/ec256k-key-private.pem\"",
"modifier": "private static final",
"original_string": "private static final String PRIVATE_KEY_FILE_256K = \"src/test/resources/ec256k-key-private.pem\";",
"type": "String",
"var_name": "PRIVATE_KEY_FILE_256K"
},
{
"declarator": "PUBLIC_KEY_FILE_256K = \"src/test/resources/ec256k-key-public.pem\"",
"modifier": "private static final",
"original_string": "private static final String PUBLIC_KEY_FILE_256K = \"src/test/resources/ec256k-key-public.pem\";",
"type": "String",
"var_name": "PUBLIC_KEY_FILE_256K"
},
{
"declarator": "INVALID_PUBLIC_KEY_FILE_256K = \"src/test/resources/ec256k-key-public-invalid.pem\"",
"modifier": "private static final",
"original_string": "private static final String INVALID_PUBLIC_KEY_FILE_256K = \"src/test/resources/ec256k-key-public-invalid.pem\";",
"type": "String",
"var_name": "INVALID_PUBLIC_KEY_FILE_256K"
},
{
"declarator": "ES256K_JWT = \"eyJraWQiOiJteS1rZXktaWQiLCJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NksifQ.e30.2ggPsc4xwQhYcgJueo3uQ14MpaVJ3AbEE8UE-wA9fc8SMibeW54gjZbikL-JBHqhEwc22Cp8DNOtadXsM81RGQ\"",
"modifier": "private static final",
"original_string": "private static final String ES256K_JWT = \"eyJraWQiOiJteS1rZXktaWQiLCJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NksifQ.e30.2ggPsc4xwQhYcgJueo3uQ14MpaVJ3AbEE8UE-wA9fc8SMibeW54gjZbikL-JBHqhEwc22Cp8DNOtadXsM81RGQ\";",
"type": "String",
"var_name": "ES256K_JWT"
},
{
"declarator": "PRIVATE_KEY_FILE_384 = \"src/test/resources/ec384-key-private.pem\"",
"modifier": "private static final",
"original_string": "private static final String PRIVATE_KEY_FILE_384 = \"src/test/resources/ec384-key-private.pem\";",
"type": "String",
"var_name": "PRIVATE_KEY_FILE_384"
},
{
"declarator": "PUBLIC_KEY_FILE_384 = \"src/test/resources/ec384-key-public.pem\"",
"modifier": "private static final",
"original_string": "private static final String PUBLIC_KEY_FILE_384 = \"src/test/resources/ec384-key-public.pem\";",
"type": "String",
"var_name": "PUBLIC_KEY_FILE_384"
},
{
"declarator": "INVALID_PUBLIC_KEY_FILE_384 = \"src/test/resources/ec384-key-public-invalid.pem\"",
"modifier": "private static final",
"original_string": "private static final String INVALID_PUBLIC_KEY_FILE_384 = \"src/test/resources/ec384-key-public-invalid.pem\";",
"type": "String",
"var_name": "INVALID_PUBLIC_KEY_FILE_384"
},
{
"declarator": "PRIVATE_KEY_FILE_512 = \"src/test/resources/ec512-key-private.pem\"",
"modifier": "private static final",
"original_string": "private static final String PRIVATE_KEY_FILE_512 = \"src/test/resources/ec512-key-private.pem\";",
"type": "String",
"var_name": "PRIVATE_KEY_FILE_512"
},
{
"declarator": "PUBLIC_KEY_FILE_512 = \"src/test/resources/ec512-key-public.pem\"",
"modifier": "private static final",
"original_string": "private static final String PUBLIC_KEY_FILE_512 = \"src/test/resources/ec512-key-public.pem\";",
"type": "String",
"var_name": "PUBLIC_KEY_FILE_512"
},
{
"declarator": "INVALID_PUBLIC_KEY_FILE_512 = \"src/test/resources/ec512-key-public-invalid.pem\"",
"modifier": "private static final",
"original_string": "private static final String INVALID_PUBLIC_KEY_FILE_512 = \"src/test/resources/ec512-key-public-invalid.pem\";",
"type": "String",
"var_name": "INVALID_PUBLIC_KEY_FILE_512"
},
{
"declarator": "exception = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException exception = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "exception"
},
{
"declarator": "ES256Header = \"eyJhbGciOiJFUzI1NiJ9\"",
"modifier": "private static final",
"original_string": "private static final String ES256Header = \"eyJhbGciOiJFUzI1NiJ9\";",
"type": "String",
"var_name": "ES256Header"
},
{
"declarator": "ES384Header = \"eyJhbGciOiJFUzM4NCJ9\"",
"modifier": "private static final",
"original_string": "private static final String ES384Header = \"eyJhbGciOiJFUzM4NCJ9\";",
"type": "String",
"var_name": "ES384Header"
},
{
"declarator": "ES512Header = \"eyJhbGciOiJFUzUxMiJ9\"",
"modifier": "private static final",
"original_string": "private static final String ES512Header = \"eyJhbGciOiJFUzUxMiJ9\";",
"type": "String",
"var_name": "ES512Header"
},
{
"declarator": "auth0IssPayload = \"eyJpc3MiOiJhdXRoMCJ9\"",
"modifier": "private static final",
"original_string": "private static final String auth0IssPayload = \"eyJpc3MiOiJhdXRoMCJ9\";",
"type": "String",
"var_name": "auth0IssPayload"
},
{
"declarator": "ES256HeaderBytes = ES256Header.getBytes(StandardCharsets.UTF_8)",
"modifier": "private static final",
"original_string": "private static final byte[] ES256HeaderBytes = ES256Header.getBytes(StandardCharsets.UTF_8);",
"type": "byte[]",
"var_name": "ES256HeaderBytes"
},
{
"declarator": "ES384HeaderBytes = ES384Header.getBytes(StandardCharsets.UTF_8)",
"modifier": "private static final",
"original_string": "private static final byte[] ES384HeaderBytes = ES384Header.getBytes(StandardCharsets.UTF_8);",
"type": "byte[]",
"var_name": "ES384HeaderBytes"
},
{
"declarator": "ES512HeaderBytes = ES512Header.getBytes(StandardCharsets.UTF_8)",
"modifier": "private static final",
"original_string": "private static final byte[] ES512HeaderBytes = ES512Header.getBytes(StandardCharsets.UTF_8);",
"type": "byte[]",
"var_name": "ES512HeaderBytes"
},
{
"declarator": "auth0IssPayloadBytes = auth0IssPayload.getBytes(StandardCharsets.UTF_8)",
"modifier": "private static final",
"original_string": "private static final byte[] auth0IssPayloadBytes = auth0IssPayload.getBytes(StandardCharsets.UTF_8);",
"type": "byte[]",
"var_name": "auth0IssPayloadBytes"
}
],
"file": "lib/src/test/java/com/auth0/jwt/algorithms/ECDSAAlgorithmTest.java",
"identifier": "ECDSAAlgorithmTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void shouldFailECDSA256VerificationOnInvalidDERSignature() throws Exception {\n exception.expect(SignatureVerificationException.class);\n exception.expectMessage(\"The Token's Signature resulted invalid when verified using the Algorithm: SHA256withECDSA\");\n\n byte[] bytes = new byte[64];\n bytes[0] = 0x30;\n new SecureRandom().nextBytes(bytes);\n String signature = Base64.encodeBase64URLSafeString(bytes);\n String jwt = \"eyJhbGciOiJFUzI1NiJ9.eyJpc3MiOiJhdXRoMCJ9.\" + signature;\n Algorithm algorithm = Algorithm.ECDSA256((ECKey) readPublicKeyFromFile(INVALID_PUBLIC_KEY_FILE_256, \"EC\"));\n algorithm.verify(JWT.decode(jwt));\n }",
"class_method_signature": "ECDSAAlgorithmTest.shouldFailECDSA256VerificationOnInvalidDERSignature()",
"constructor": false,
"full_signature": "@Test public void shouldFailECDSA256VerificationOnInvalidDERSignature()",
"identifier": "shouldFailECDSA256VerificationOnInvalidDERSignature",
"invocations": [
"expect",
"expectMessage",
"nextBytes",
"encodeBase64URLSafeString",
"ECDSA256",
"readPublicKeyFromFile",
"verify",
"decode"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void shouldFailECDSA256VerificationOnInvalidDERSignature()",
"testcase": true
} | {
"fields": [
{
"declarator": "keyProvider",
"modifier": "private final",
"original_string": "private final ECDSAKeyProvider keyProvider;",
"type": "ECDSAKeyProvider",
"var_name": "keyProvider"
},
{
"declarator": "crypto",
"modifier": "private final",
"original_string": "private final CryptoHelper crypto;",
"type": "CryptoHelper",
"var_name": "crypto"
},
{
"declarator": "ecNumberSize",
"modifier": "private final",
"original_string": "private final int ecNumberSize;",
"type": "int",
"var_name": "ecNumberSize"
}
],
"file": "lib/src/main/java/com/auth0/jwt/algorithms/ECDSAAlgorithm.java",
"identifier": "ECDSAAlgorithm",
"interfaces": "",
"methods": [
{
"class_method_signature": "ECDSAAlgorithm.ECDSAAlgorithm(CryptoHelper crypto, String id, String algorithm, int ecNumberSize, ECDSAKeyProvider keyProvider)",
"constructor": true,
"full_signature": " ECDSAAlgorithm(CryptoHelper crypto, String id, String algorithm, int ecNumberSize, ECDSAKeyProvider keyProvider)",
"identifier": "ECDSAAlgorithm",
"modifiers": "",
"parameters": "(CryptoHelper crypto, String id, String algorithm, int ecNumberSize, ECDSAKeyProvider keyProvider)",
"return": "",
"signature": " ECDSAAlgorithm(CryptoHelper crypto, String id, String algorithm, int ecNumberSize, ECDSAKeyProvider keyProvider)",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.ECDSAAlgorithm(String id, String algorithm, int ecNumberSize, ECDSAKeyProvider keyProvider)",
"constructor": true,
"full_signature": " ECDSAAlgorithm(String id, String algorithm, int ecNumberSize, ECDSAKeyProvider keyProvider)",
"identifier": "ECDSAAlgorithm",
"modifiers": "",
"parameters": "(String id, String algorithm, int ecNumberSize, ECDSAKeyProvider keyProvider)",
"return": "",
"signature": " ECDSAAlgorithm(String id, String algorithm, int ecNumberSize, ECDSAKeyProvider keyProvider)",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.verify(DecodedJWT jwt)",
"constructor": false,
"full_signature": "@Override public void verify(DecodedJWT jwt)",
"identifier": "verify",
"modifiers": "@Override public",
"parameters": "(DecodedJWT jwt)",
"return": "void",
"signature": "void verify(DecodedJWT jwt)",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.sign(byte[] headerBytes, byte[] payloadBytes)",
"constructor": false,
"full_signature": "@Override public byte[] sign(byte[] headerBytes, byte[] payloadBytes)",
"identifier": "sign",
"modifiers": "@Override public",
"parameters": "(byte[] headerBytes, byte[] payloadBytes)",
"return": "byte[]",
"signature": "byte[] sign(byte[] headerBytes, byte[] payloadBytes)",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.sign(byte[] contentBytes)",
"constructor": false,
"full_signature": "@Override @Deprecated public byte[] sign(byte[] contentBytes)",
"identifier": "sign",
"modifiers": "@Override @Deprecated public",
"parameters": "(byte[] contentBytes)",
"return": "byte[]",
"signature": "byte[] sign(byte[] contentBytes)",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.getSigningKeyId()",
"constructor": false,
"full_signature": "@Override public String getSigningKeyId()",
"identifier": "getSigningKeyId",
"modifiers": "@Override public",
"parameters": "()",
"return": "String",
"signature": "String getSigningKeyId()",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.DERToJOSE(byte[] derSignature)",
"constructor": false,
"full_signature": " byte[] DERToJOSE(byte[] derSignature)",
"identifier": "DERToJOSE",
"modifiers": "",
"parameters": "(byte[] derSignature)",
"return": "byte[]",
"signature": "byte[] DERToJOSE(byte[] derSignature)",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.JOSEToDER(byte[] joseSignature)",
"constructor": false,
"full_signature": " byte[] JOSEToDER(byte[] joseSignature)",
"identifier": "JOSEToDER",
"modifiers": "",
"parameters": "(byte[] joseSignature)",
"return": "byte[]",
"signature": "byte[] JOSEToDER(byte[] joseSignature)",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.countPadding(byte[] bytes, int fromIndex, int toIndex)",
"constructor": false,
"full_signature": "private int countPadding(byte[] bytes, int fromIndex, int toIndex)",
"identifier": "countPadding",
"modifiers": "private",
"parameters": "(byte[] bytes, int fromIndex, int toIndex)",
"return": "int",
"signature": "int countPadding(byte[] bytes, int fromIndex, int toIndex)",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.providerForKeys(final ECPublicKey publicKey, final ECPrivateKey privateKey)",
"constructor": false,
"full_signature": "static ECDSAKeyProvider providerForKeys(final ECPublicKey publicKey, final ECPrivateKey privateKey)",
"identifier": "providerForKeys",
"modifiers": "static",
"parameters": "(final ECPublicKey publicKey, final ECPrivateKey privateKey)",
"return": "ECDSAKeyProvider",
"signature": "ECDSAKeyProvider providerForKeys(final ECPublicKey publicKey, final ECPrivateKey privateKey)",
"testcase": false
}
],
"superclass": "extends Algorithm"
} | {
"body": "@Override\n public void verify(DecodedJWT jwt) throws SignatureVerificationException {\n byte[] signatureBytes = Base64.decodeBase64(jwt.getSignature());\n\n try {\n ECPublicKey publicKey = keyProvider.getPublicKeyById(jwt.getKeyId());\n if (publicKey == null) {\n throw new IllegalStateException(\"The given Public Key is null.\");\n }\n boolean valid = crypto.verifySignatureFor(getDescription(), publicKey, jwt.getHeader(), jwt.getPayload(), JOSEToDER(signatureBytes));\n\n if (!valid) {\n throw new SignatureVerificationException(this);\n }\n } catch (NoSuchAlgorithmException | SignatureException | InvalidKeyException | IllegalStateException e) {\n throw new SignatureVerificationException(this, e);\n }\n }",
"class_method_signature": "ECDSAAlgorithm.verify(DecodedJWT jwt)",
"constructor": false,
"full_signature": "@Override public void verify(DecodedJWT jwt)",
"identifier": "verify",
"invocations": [
"decodeBase64",
"getSignature",
"getPublicKeyById",
"getKeyId",
"verifySignatureFor",
"getDescription",
"getHeader",
"getPayload",
"JOSEToDER"
],
"modifiers": "@Override public",
"parameters": "(DecodedJWT jwt)",
"return": "void",
"signature": "void verify(DecodedJWT jwt)",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 691,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 17517521,
"size": 936,
"stargazer_count": 3678,
"stars": null,
"updates": null,
"url": "https://github.com/auth0/java-jwt"
} |
17517521_95 | {
"fields": [
{
"declarator": "PRIVATE_KEY_FILE = \"src/test/resources/rsa-private.pem\"",
"modifier": "private static final",
"original_string": "private static final String PRIVATE_KEY_FILE = \"src/test/resources/rsa-private.pem\";",
"type": "String",
"var_name": "PRIVATE_KEY_FILE"
},
{
"declarator": "PUBLIC_KEY_FILE = \"src/test/resources/rsa-public.pem\"",
"modifier": "private static final",
"original_string": "private static final String PUBLIC_KEY_FILE = \"src/test/resources/rsa-public.pem\";",
"type": "String",
"var_name": "PUBLIC_KEY_FILE"
},
{
"declarator": "INVALID_PUBLIC_KEY_FILE = \"src/test/resources/rsa-public_invalid.pem\"",
"modifier": "private static final",
"original_string": "private static final String INVALID_PUBLIC_KEY_FILE = \"src/test/resources/rsa-public_invalid.pem\";",
"type": "String",
"var_name": "INVALID_PUBLIC_KEY_FILE"
},
{
"declarator": "exception = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException exception = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "exception"
},
{
"declarator": "RS256Header = \"eyJhbGciOiJSUzI1NiJ9\"",
"modifier": "private static final",
"original_string": "private static final String RS256Header = \"eyJhbGciOiJSUzI1NiJ9\";",
"type": "String",
"var_name": "RS256Header"
},
{
"declarator": "RS384Header = \"eyJhbGciOiJSUzM4NCJ9\"",
"modifier": "private static final",
"original_string": "private static final String RS384Header = \"eyJhbGciOiJSUzM4NCJ9\";",
"type": "String",
"var_name": "RS384Header"
},
{
"declarator": "RS512Header = \"eyJhbGciOiJSUzUxMiJ9\"",
"modifier": "private static final",
"original_string": "private static final String RS512Header = \"eyJhbGciOiJSUzUxMiJ9\";",
"type": "String",
"var_name": "RS512Header"
},
{
"declarator": "auth0IssPayload = \"eyJpc3MiOiJhdXRoMCJ9\"",
"modifier": "private static final",
"original_string": "private static final String auth0IssPayload = \"eyJpc3MiOiJhdXRoMCJ9\";",
"type": "String",
"var_name": "auth0IssPayload"
}
],
"file": "lib/src/test/java/com/auth0/jwt/algorithms/RSAAlgorithmTest.java",
"identifier": "RSAAlgorithmTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void shouldDoRSA256Signing() throws Exception {\n Algorithm algorithmSign = Algorithm.RSA256((RSAKey) readPrivateKeyFromFile(PRIVATE_KEY_FILE, \"RSA\"));\n Algorithm algorithmVerify = Algorithm.RSA256((RSAKey) readPublicKeyFromFile(PUBLIC_KEY_FILE, \"RSA\"));\n\n String jwt = asJWT(algorithmSign, RS256Header, auth0IssPayload);\n String expectedSignature = \"ZB-Tr0vLtnf8I9fhSdSjU6HZei5xLYZQ6nZqM5O6Va0W9PgAqgRT7ShI9CjeYulRXPHvVmSl5EQuYuXdBzM0-H_3p_Nsl6tSMy4EyX2kkhEm6T0HhvarTh8CG0PCjn5p6FP5ZxWwhLcmRN70ItP6Z5MMO4CcJh1JrNxR4Fi4xQgt-CK2aVDMFXd-Br5yQiLVx1CX83w28OD9wssW3Rdltl5e66vCef0Ql6Q5I5e5F0nqGYT989a9fkNgLIx2F8k_az5x07BY59FV2SZg59nSiY7TZNjP8ot11Ew7HKRfPXOdh9eKRUVdhcxzqDePhyzKabU8TG5FP0SiWH5qVPfAgw\";\n\n assertSignaturePresent(jwt);\n assertSignatureValue(jwt, expectedSignature);\n algorithmVerify.verify(JWT.decode(jwt));\n }",
"class_method_signature": "RSAAlgorithmTest.shouldDoRSA256Signing()",
"constructor": false,
"full_signature": "@Test public void shouldDoRSA256Signing()",
"identifier": "shouldDoRSA256Signing",
"invocations": [
"RSA256",
"readPrivateKeyFromFile",
"RSA256",
"readPublicKeyFromFile",
"asJWT",
"assertSignaturePresent",
"assertSignatureValue",
"verify",
"decode"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void shouldDoRSA256Signing()",
"testcase": true
} | {
"fields": [
{
"declarator": "keyProvider",
"modifier": "private final",
"original_string": "private final RSAKeyProvider keyProvider;",
"type": "RSAKeyProvider",
"var_name": "keyProvider"
},
{
"declarator": "crypto",
"modifier": "private final",
"original_string": "private final CryptoHelper crypto;",
"type": "CryptoHelper",
"var_name": "crypto"
}
],
"file": "lib/src/main/java/com/auth0/jwt/algorithms/RSAAlgorithm.java",
"identifier": "RSAAlgorithm",
"interfaces": "",
"methods": [
{
"class_method_signature": "RSAAlgorithm.RSAAlgorithm(CryptoHelper crypto, String id, String algorithm, RSAKeyProvider keyProvider)",
"constructor": true,
"full_signature": " RSAAlgorithm(CryptoHelper crypto, String id, String algorithm, RSAKeyProvider keyProvider)",
"identifier": "RSAAlgorithm",
"modifiers": "",
"parameters": "(CryptoHelper crypto, String id, String algorithm, RSAKeyProvider keyProvider)",
"return": "",
"signature": " RSAAlgorithm(CryptoHelper crypto, String id, String algorithm, RSAKeyProvider keyProvider)",
"testcase": false
},
{
"class_method_signature": "RSAAlgorithm.RSAAlgorithm(String id, String algorithm, RSAKeyProvider keyProvider)",
"constructor": true,
"full_signature": " RSAAlgorithm(String id, String algorithm, RSAKeyProvider keyProvider)",
"identifier": "RSAAlgorithm",
"modifiers": "",
"parameters": "(String id, String algorithm, RSAKeyProvider keyProvider)",
"return": "",
"signature": " RSAAlgorithm(String id, String algorithm, RSAKeyProvider keyProvider)",
"testcase": false
},
{
"class_method_signature": "RSAAlgorithm.verify(DecodedJWT jwt)",
"constructor": false,
"full_signature": "@Override public void verify(DecodedJWT jwt)",
"identifier": "verify",
"modifiers": "@Override public",
"parameters": "(DecodedJWT jwt)",
"return": "void",
"signature": "void verify(DecodedJWT jwt)",
"testcase": false
},
{
"class_method_signature": "RSAAlgorithm.sign(byte[] headerBytes, byte[] payloadBytes)",
"constructor": false,
"full_signature": "@Override @Deprecated public byte[] sign(byte[] headerBytes, byte[] payloadBytes)",
"identifier": "sign",
"modifiers": "@Override @Deprecated public",
"parameters": "(byte[] headerBytes, byte[] payloadBytes)",
"return": "byte[]",
"signature": "byte[] sign(byte[] headerBytes, byte[] payloadBytes)",
"testcase": false
},
{
"class_method_signature": "RSAAlgorithm.sign(byte[] contentBytes)",
"constructor": false,
"full_signature": "@Override public byte[] sign(byte[] contentBytes)",
"identifier": "sign",
"modifiers": "@Override public",
"parameters": "(byte[] contentBytes)",
"return": "byte[]",
"signature": "byte[] sign(byte[] contentBytes)",
"testcase": false
},
{
"class_method_signature": "RSAAlgorithm.getSigningKeyId()",
"constructor": false,
"full_signature": "@Override public String getSigningKeyId()",
"identifier": "getSigningKeyId",
"modifiers": "@Override public",
"parameters": "()",
"return": "String",
"signature": "String getSigningKeyId()",
"testcase": false
},
{
"class_method_signature": "RSAAlgorithm.providerForKeys(final RSAPublicKey publicKey, final RSAPrivateKey privateKey)",
"constructor": false,
"full_signature": "static RSAKeyProvider providerForKeys(final RSAPublicKey publicKey, final RSAPrivateKey privateKey)",
"identifier": "providerForKeys",
"modifiers": "static",
"parameters": "(final RSAPublicKey publicKey, final RSAPrivateKey privateKey)",
"return": "RSAKeyProvider",
"signature": "RSAKeyProvider providerForKeys(final RSAPublicKey publicKey, final RSAPrivateKey privateKey)",
"testcase": false
}
],
"superclass": "extends Algorithm"
} | {
"body": "@Override\n public void verify(DecodedJWT jwt) throws SignatureVerificationException {\n byte[] signatureBytes = Base64.decodeBase64(jwt.getSignature());\n\n try {\n RSAPublicKey publicKey = keyProvider.getPublicKeyById(jwt.getKeyId());\n if (publicKey == null) {\n throw new IllegalStateException(\"The given Public Key is null.\");\n }\n boolean valid = crypto.verifySignatureFor(getDescription(), publicKey, jwt.getHeader(), jwt.getPayload(), signatureBytes);\n if (!valid) {\n throw new SignatureVerificationException(this);\n }\n } catch (NoSuchAlgorithmException | SignatureException | InvalidKeyException | IllegalStateException e) {\n throw new SignatureVerificationException(this, e);\n }\n }",
"class_method_signature": "RSAAlgorithm.verify(DecodedJWT jwt)",
"constructor": false,
"full_signature": "@Override public void verify(DecodedJWT jwt)",
"identifier": "verify",
"invocations": [
"decodeBase64",
"getSignature",
"getPublicKeyById",
"getKeyId",
"verifySignatureFor",
"getDescription",
"getHeader",
"getPayload"
],
"modifiers": "@Override public",
"parameters": "(DecodedJWT jwt)",
"return": "void",
"signature": "void verify(DecodedJWT jwt)",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 691,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 17517521,
"size": 936,
"stargazer_count": 3678,
"stars": null,
"updates": null,
"url": "https://github.com/auth0/java-jwt"
} |
17517521_112 | {
"fields": [
{
"declarator": "PRIVATE_KEY_FILE = \"src/test/resources/rsa-private.pem\"",
"modifier": "private static final",
"original_string": "private static final String PRIVATE_KEY_FILE = \"src/test/resources/rsa-private.pem\";",
"type": "String",
"var_name": "PRIVATE_KEY_FILE"
},
{
"declarator": "PUBLIC_KEY_FILE = \"src/test/resources/rsa-public.pem\"",
"modifier": "private static final",
"original_string": "private static final String PUBLIC_KEY_FILE = \"src/test/resources/rsa-public.pem\";",
"type": "String",
"var_name": "PUBLIC_KEY_FILE"
},
{
"declarator": "INVALID_PUBLIC_KEY_FILE = \"src/test/resources/rsa-public_invalid.pem\"",
"modifier": "private static final",
"original_string": "private static final String INVALID_PUBLIC_KEY_FILE = \"src/test/resources/rsa-public_invalid.pem\";",
"type": "String",
"var_name": "INVALID_PUBLIC_KEY_FILE"
},
{
"declarator": "exception = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException exception = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "exception"
},
{
"declarator": "RS256Header = \"eyJhbGciOiJSUzI1NiJ9\"",
"modifier": "private static final",
"original_string": "private static final String RS256Header = \"eyJhbGciOiJSUzI1NiJ9\";",
"type": "String",
"var_name": "RS256Header"
},
{
"declarator": "RS384Header = \"eyJhbGciOiJSUzM4NCJ9\"",
"modifier": "private static final",
"original_string": "private static final String RS384Header = \"eyJhbGciOiJSUzM4NCJ9\";",
"type": "String",
"var_name": "RS384Header"
},
{
"declarator": "RS512Header = \"eyJhbGciOiJSUzUxMiJ9\"",
"modifier": "private static final",
"original_string": "private static final String RS512Header = \"eyJhbGciOiJSUzUxMiJ9\";",
"type": "String",
"var_name": "RS512Header"
},
{
"declarator": "auth0IssPayload = \"eyJpc3MiOiJhdXRoMCJ9\"",
"modifier": "private static final",
"original_string": "private static final String auth0IssPayload = \"eyJpc3MiOiJhdXRoMCJ9\";",
"type": "String",
"var_name": "auth0IssPayload"
}
],
"file": "lib/src/test/java/com/auth0/jwt/algorithms/RSAAlgorithmTest.java",
"identifier": "RSAAlgorithmTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void shouldFailOnRSA256SigningWithDeprecatedMethodWhenProvidedPrivateKeyIsNull() throws Exception {\n exception.expect(SignatureGenerationException.class);\n exception.expectMessage(\"The Token's Signature couldn't be generated when signing using the Algorithm: SHA256withRSA\");\n exception.expectCause(isA(IllegalStateException.class));\n exception.expectCause(hasMessage(is(\"The given Private Key is null.\")));\n\n RSAKeyProvider provider = mock(RSAKeyProvider.class);\n when(provider.getPrivateKey()).thenReturn(null);\n Algorithm algorithm = Algorithm.RSA256(provider);\n algorithm.sign(new byte[0]);\n }",
"class_method_signature": "RSAAlgorithmTest.shouldFailOnRSA256SigningWithDeprecatedMethodWhenProvidedPrivateKeyIsNull()",
"constructor": false,
"full_signature": "@Test public void shouldFailOnRSA256SigningWithDeprecatedMethodWhenProvidedPrivateKeyIsNull()",
"identifier": "shouldFailOnRSA256SigningWithDeprecatedMethodWhenProvidedPrivateKeyIsNull",
"invocations": [
"expect",
"expectMessage",
"expectCause",
"isA",
"expectCause",
"hasMessage",
"is",
"mock",
"thenReturn",
"when",
"getPrivateKey",
"RSA256",
"sign"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void shouldFailOnRSA256SigningWithDeprecatedMethodWhenProvidedPrivateKeyIsNull()",
"testcase": true
} | {
"fields": [
{
"declarator": "keyProvider",
"modifier": "private final",
"original_string": "private final RSAKeyProvider keyProvider;",
"type": "RSAKeyProvider",
"var_name": "keyProvider"
},
{
"declarator": "crypto",
"modifier": "private final",
"original_string": "private final CryptoHelper crypto;",
"type": "CryptoHelper",
"var_name": "crypto"
}
],
"file": "lib/src/main/java/com/auth0/jwt/algorithms/RSAAlgorithm.java",
"identifier": "RSAAlgorithm",
"interfaces": "",
"methods": [
{
"class_method_signature": "RSAAlgorithm.RSAAlgorithm(CryptoHelper crypto, String id, String algorithm, RSAKeyProvider keyProvider)",
"constructor": true,
"full_signature": " RSAAlgorithm(CryptoHelper crypto, String id, String algorithm, RSAKeyProvider keyProvider)",
"identifier": "RSAAlgorithm",
"modifiers": "",
"parameters": "(CryptoHelper crypto, String id, String algorithm, RSAKeyProvider keyProvider)",
"return": "",
"signature": " RSAAlgorithm(CryptoHelper crypto, String id, String algorithm, RSAKeyProvider keyProvider)",
"testcase": false
},
{
"class_method_signature": "RSAAlgorithm.RSAAlgorithm(String id, String algorithm, RSAKeyProvider keyProvider)",
"constructor": true,
"full_signature": " RSAAlgorithm(String id, String algorithm, RSAKeyProvider keyProvider)",
"identifier": "RSAAlgorithm",
"modifiers": "",
"parameters": "(String id, String algorithm, RSAKeyProvider keyProvider)",
"return": "",
"signature": " RSAAlgorithm(String id, String algorithm, RSAKeyProvider keyProvider)",
"testcase": false
},
{
"class_method_signature": "RSAAlgorithm.verify(DecodedJWT jwt)",
"constructor": false,
"full_signature": "@Override public void verify(DecodedJWT jwt)",
"identifier": "verify",
"modifiers": "@Override public",
"parameters": "(DecodedJWT jwt)",
"return": "void",
"signature": "void verify(DecodedJWT jwt)",
"testcase": false
},
{
"class_method_signature": "RSAAlgorithm.sign(byte[] headerBytes, byte[] payloadBytes)",
"constructor": false,
"full_signature": "@Override @Deprecated public byte[] sign(byte[] headerBytes, byte[] payloadBytes)",
"identifier": "sign",
"modifiers": "@Override @Deprecated public",
"parameters": "(byte[] headerBytes, byte[] payloadBytes)",
"return": "byte[]",
"signature": "byte[] sign(byte[] headerBytes, byte[] payloadBytes)",
"testcase": false
},
{
"class_method_signature": "RSAAlgorithm.sign(byte[] contentBytes)",
"constructor": false,
"full_signature": "@Override public byte[] sign(byte[] contentBytes)",
"identifier": "sign",
"modifiers": "@Override public",
"parameters": "(byte[] contentBytes)",
"return": "byte[]",
"signature": "byte[] sign(byte[] contentBytes)",
"testcase": false
},
{
"class_method_signature": "RSAAlgorithm.getSigningKeyId()",
"constructor": false,
"full_signature": "@Override public String getSigningKeyId()",
"identifier": "getSigningKeyId",
"modifiers": "@Override public",
"parameters": "()",
"return": "String",
"signature": "String getSigningKeyId()",
"testcase": false
},
{
"class_method_signature": "RSAAlgorithm.providerForKeys(final RSAPublicKey publicKey, final RSAPrivateKey privateKey)",
"constructor": false,
"full_signature": "static RSAKeyProvider providerForKeys(final RSAPublicKey publicKey, final RSAPrivateKey privateKey)",
"identifier": "providerForKeys",
"modifiers": "static",
"parameters": "(final RSAPublicKey publicKey, final RSAPrivateKey privateKey)",
"return": "RSAKeyProvider",
"signature": "RSAKeyProvider providerForKeys(final RSAPublicKey publicKey, final RSAPrivateKey privateKey)",
"testcase": false
}
],
"superclass": "extends Algorithm"
} | {
"body": "@Override\n @Deprecated\n public byte[] sign(byte[] headerBytes, byte[] payloadBytes) throws SignatureGenerationException {\n try {\n RSAPrivateKey privateKey = keyProvider.getPrivateKey();\n if (privateKey == null) {\n throw new IllegalStateException(\"The given Private Key is null.\");\n }\n return crypto.createSignatureFor(getDescription(), privateKey, headerBytes, payloadBytes);\n } catch (NoSuchAlgorithmException | SignatureException | InvalidKeyException | IllegalStateException e) {\n throw new SignatureGenerationException(this, e);\n }\n }",
"class_method_signature": "RSAAlgorithm.sign(byte[] headerBytes, byte[] payloadBytes)",
"constructor": false,
"full_signature": "@Override @Deprecated public byte[] sign(byte[] headerBytes, byte[] payloadBytes)",
"identifier": "sign",
"invocations": [
"getPrivateKey",
"createSignatureFor",
"getDescription"
],
"modifiers": "@Override @Deprecated public",
"parameters": "(byte[] headerBytes, byte[] payloadBytes)",
"return": "byte[]",
"signature": "byte[] sign(byte[] headerBytes, byte[] payloadBytes)",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 691,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 17517521,
"size": 936,
"stargazer_count": 3678,
"stars": null,
"updates": null,
"url": "https://github.com/auth0/java-jwt"
} |
17517521_83 | {
"fields": [
{
"declarator": "PRIVATE_KEY_FILE = \"src/test/resources/rsa-private.pem\"",
"modifier": "private static final",
"original_string": "private static final String PRIVATE_KEY_FILE = \"src/test/resources/rsa-private.pem\";",
"type": "String",
"var_name": "PRIVATE_KEY_FILE"
},
{
"declarator": "PUBLIC_KEY_FILE = \"src/test/resources/rsa-public.pem\"",
"modifier": "private static final",
"original_string": "private static final String PUBLIC_KEY_FILE = \"src/test/resources/rsa-public.pem\";",
"type": "String",
"var_name": "PUBLIC_KEY_FILE"
},
{
"declarator": "INVALID_PUBLIC_KEY_FILE = \"src/test/resources/rsa-public_invalid.pem\"",
"modifier": "private static final",
"original_string": "private static final String INVALID_PUBLIC_KEY_FILE = \"src/test/resources/rsa-public_invalid.pem\";",
"type": "String",
"var_name": "INVALID_PUBLIC_KEY_FILE"
},
{
"declarator": "exception = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException exception = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "exception"
},
{
"declarator": "RS256Header = \"eyJhbGciOiJSUzI1NiJ9\"",
"modifier": "private static final",
"original_string": "private static final String RS256Header = \"eyJhbGciOiJSUzI1NiJ9\";",
"type": "String",
"var_name": "RS256Header"
},
{
"declarator": "RS384Header = \"eyJhbGciOiJSUzM4NCJ9\"",
"modifier": "private static final",
"original_string": "private static final String RS384Header = \"eyJhbGciOiJSUzM4NCJ9\";",
"type": "String",
"var_name": "RS384Header"
},
{
"declarator": "RS512Header = \"eyJhbGciOiJSUzUxMiJ9\"",
"modifier": "private static final",
"original_string": "private static final String RS512Header = \"eyJhbGciOiJSUzUxMiJ9\";",
"type": "String",
"var_name": "RS512Header"
},
{
"declarator": "auth0IssPayload = \"eyJpc3MiOiJhdXRoMCJ9\"",
"modifier": "private static final",
"original_string": "private static final String auth0IssPayload = \"eyJpc3MiOiJhdXRoMCJ9\";",
"type": "String",
"var_name": "auth0IssPayload"
}
],
"file": "lib/src/test/java/com/auth0/jwt/algorithms/RSAAlgorithmTest.java",
"identifier": "RSAAlgorithmTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void shouldPassRSA384Verification() throws Exception {\n String jwt = \"eyJhbGciOiJSUzM4NCIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJhdXRoMCJ9.TZlWjXObwGSQOiu2oMq8kiKz0_BR7bbBddNL6G8eZ_GoR82BXOZDqNrQr7lb_M-78XGBguWLWNIdYhzgxOUL9EoCJlrqVm9s9vo6G8T1sj1op-4TbjXZ61TwIvrJee9BvPLdKUJ9_fp1Js5kl6yXkst40Th8Auc5as4n49MLkipjpEhKDKaENKHpSubs1ripSz8SCQZSofeTM_EWVwSw7cpiM8Fy8jOPvWG8Xz4-e3ODFowvHVsDcONX_4FTMNbeRqDuHq2ZhCJnEfzcSJdrve_5VD5fM1LperBVslTrOxIgClOJ3RmM7-WnaizJrWP3D6Z9OLxPxLhM6-jx6tcxEw\";\n Algorithm algorithm = Algorithm.RSA384((RSAKey) readPublicKeyFromFile(PUBLIC_KEY_FILE, \"RSA\"));\n algorithm.verify(JWT.decode(jwt));\n }",
"class_method_signature": "RSAAlgorithmTest.shouldPassRSA384Verification()",
"constructor": false,
"full_signature": "@Test public void shouldPassRSA384Verification()",
"identifier": "shouldPassRSA384Verification",
"invocations": [
"RSA384",
"readPublicKeyFromFile",
"verify",
"decode"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void shouldPassRSA384Verification()",
"testcase": true
} | {
"fields": [
{
"declarator": "keyProvider",
"modifier": "private final",
"original_string": "private final RSAKeyProvider keyProvider;",
"type": "RSAKeyProvider",
"var_name": "keyProvider"
},
{
"declarator": "crypto",
"modifier": "private final",
"original_string": "private final CryptoHelper crypto;",
"type": "CryptoHelper",
"var_name": "crypto"
}
],
"file": "lib/src/main/java/com/auth0/jwt/algorithms/RSAAlgorithm.java",
"identifier": "RSAAlgorithm",
"interfaces": "",
"methods": [
{
"class_method_signature": "RSAAlgorithm.RSAAlgorithm(CryptoHelper crypto, String id, String algorithm, RSAKeyProvider keyProvider)",
"constructor": true,
"full_signature": " RSAAlgorithm(CryptoHelper crypto, String id, String algorithm, RSAKeyProvider keyProvider)",
"identifier": "RSAAlgorithm",
"modifiers": "",
"parameters": "(CryptoHelper crypto, String id, String algorithm, RSAKeyProvider keyProvider)",
"return": "",
"signature": " RSAAlgorithm(CryptoHelper crypto, String id, String algorithm, RSAKeyProvider keyProvider)",
"testcase": false
},
{
"class_method_signature": "RSAAlgorithm.RSAAlgorithm(String id, String algorithm, RSAKeyProvider keyProvider)",
"constructor": true,
"full_signature": " RSAAlgorithm(String id, String algorithm, RSAKeyProvider keyProvider)",
"identifier": "RSAAlgorithm",
"modifiers": "",
"parameters": "(String id, String algorithm, RSAKeyProvider keyProvider)",
"return": "",
"signature": " RSAAlgorithm(String id, String algorithm, RSAKeyProvider keyProvider)",
"testcase": false
},
{
"class_method_signature": "RSAAlgorithm.verify(DecodedJWT jwt)",
"constructor": false,
"full_signature": "@Override public void verify(DecodedJWT jwt)",
"identifier": "verify",
"modifiers": "@Override public",
"parameters": "(DecodedJWT jwt)",
"return": "void",
"signature": "void verify(DecodedJWT jwt)",
"testcase": false
},
{
"class_method_signature": "RSAAlgorithm.sign(byte[] headerBytes, byte[] payloadBytes)",
"constructor": false,
"full_signature": "@Override @Deprecated public byte[] sign(byte[] headerBytes, byte[] payloadBytes)",
"identifier": "sign",
"modifiers": "@Override @Deprecated public",
"parameters": "(byte[] headerBytes, byte[] payloadBytes)",
"return": "byte[]",
"signature": "byte[] sign(byte[] headerBytes, byte[] payloadBytes)",
"testcase": false
},
{
"class_method_signature": "RSAAlgorithm.sign(byte[] contentBytes)",
"constructor": false,
"full_signature": "@Override public byte[] sign(byte[] contentBytes)",
"identifier": "sign",
"modifiers": "@Override public",
"parameters": "(byte[] contentBytes)",
"return": "byte[]",
"signature": "byte[] sign(byte[] contentBytes)",
"testcase": false
},
{
"class_method_signature": "RSAAlgorithm.getSigningKeyId()",
"constructor": false,
"full_signature": "@Override public String getSigningKeyId()",
"identifier": "getSigningKeyId",
"modifiers": "@Override public",
"parameters": "()",
"return": "String",
"signature": "String getSigningKeyId()",
"testcase": false
},
{
"class_method_signature": "RSAAlgorithm.providerForKeys(final RSAPublicKey publicKey, final RSAPrivateKey privateKey)",
"constructor": false,
"full_signature": "static RSAKeyProvider providerForKeys(final RSAPublicKey publicKey, final RSAPrivateKey privateKey)",
"identifier": "providerForKeys",
"modifiers": "static",
"parameters": "(final RSAPublicKey publicKey, final RSAPrivateKey privateKey)",
"return": "RSAKeyProvider",
"signature": "RSAKeyProvider providerForKeys(final RSAPublicKey publicKey, final RSAPrivateKey privateKey)",
"testcase": false
}
],
"superclass": "extends Algorithm"
} | {
"body": "@Override\n public void verify(DecodedJWT jwt) throws SignatureVerificationException {\n byte[] signatureBytes = Base64.decodeBase64(jwt.getSignature());\n\n try {\n RSAPublicKey publicKey = keyProvider.getPublicKeyById(jwt.getKeyId());\n if (publicKey == null) {\n throw new IllegalStateException(\"The given Public Key is null.\");\n }\n boolean valid = crypto.verifySignatureFor(getDescription(), publicKey, jwt.getHeader(), jwt.getPayload(), signatureBytes);\n if (!valid) {\n throw new SignatureVerificationException(this);\n }\n } catch (NoSuchAlgorithmException | SignatureException | InvalidKeyException | IllegalStateException e) {\n throw new SignatureVerificationException(this, e);\n }\n }",
"class_method_signature": "RSAAlgorithm.verify(DecodedJWT jwt)",
"constructor": false,
"full_signature": "@Override public void verify(DecodedJWT jwt)",
"identifier": "verify",
"invocations": [
"decodeBase64",
"getSignature",
"getPublicKeyById",
"getKeyId",
"verifySignatureFor",
"getDescription",
"getHeader",
"getPayload"
],
"modifiers": "@Override public",
"parameters": "(DecodedJWT jwt)",
"return": "void",
"signature": "void verify(DecodedJWT jwt)",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 691,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 17517521,
"size": 936,
"stargazer_count": 3678,
"stars": null,
"updates": null,
"url": "https://github.com/auth0/java-jwt"
} |
17517521_104 | {
"fields": [
{
"declarator": "PRIVATE_KEY_FILE = \"src/test/resources/rsa-private.pem\"",
"modifier": "private static final",
"original_string": "private static final String PRIVATE_KEY_FILE = \"src/test/resources/rsa-private.pem\";",
"type": "String",
"var_name": "PRIVATE_KEY_FILE"
},
{
"declarator": "PUBLIC_KEY_FILE = \"src/test/resources/rsa-public.pem\"",
"modifier": "private static final",
"original_string": "private static final String PUBLIC_KEY_FILE = \"src/test/resources/rsa-public.pem\";",
"type": "String",
"var_name": "PUBLIC_KEY_FILE"
},
{
"declarator": "INVALID_PUBLIC_KEY_FILE = \"src/test/resources/rsa-public_invalid.pem\"",
"modifier": "private static final",
"original_string": "private static final String INVALID_PUBLIC_KEY_FILE = \"src/test/resources/rsa-public_invalid.pem\";",
"type": "String",
"var_name": "INVALID_PUBLIC_KEY_FILE"
},
{
"declarator": "exception = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException exception = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "exception"
},
{
"declarator": "RS256Header = \"eyJhbGciOiJSUzI1NiJ9\"",
"modifier": "private static final",
"original_string": "private static final String RS256Header = \"eyJhbGciOiJSUzI1NiJ9\";",
"type": "String",
"var_name": "RS256Header"
},
{
"declarator": "RS384Header = \"eyJhbGciOiJSUzM4NCJ9\"",
"modifier": "private static final",
"original_string": "private static final String RS384Header = \"eyJhbGciOiJSUzM4NCJ9\";",
"type": "String",
"var_name": "RS384Header"
},
{
"declarator": "RS512Header = \"eyJhbGciOiJSUzUxMiJ9\"",
"modifier": "private static final",
"original_string": "private static final String RS512Header = \"eyJhbGciOiJSUzUxMiJ9\";",
"type": "String",
"var_name": "RS512Header"
},
{
"declarator": "auth0IssPayload = \"eyJpc3MiOiJhdXRoMCJ9\"",
"modifier": "private static final",
"original_string": "private static final String auth0IssPayload = \"eyJpc3MiOiJhdXRoMCJ9\";",
"type": "String",
"var_name": "auth0IssPayload"
}
],
"file": "lib/src/test/java/com/auth0/jwt/algorithms/RSAAlgorithmTest.java",
"identifier": "RSAAlgorithmTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void shouldFailOnRSA384SigningWhenUsingPublicKey() throws Exception {\n exception.expect(SignatureGenerationException.class);\n exception.expectMessage(\"The Token's Signature couldn't be generated when signing using the Algorithm: SHA384withRSA\");\n exception.expectCause(isA(IllegalStateException.class));\n exception.expectCause(hasMessage(is(\"The given Private Key is null.\")));\n\n Algorithm algorithm = Algorithm.RSA384((RSAKey) readPublicKeyFromFile(PUBLIC_KEY_FILE, \"RSA\"));\n algorithm.sign(new byte[0], new byte[0]);\n }",
"class_method_signature": "RSAAlgorithmTest.shouldFailOnRSA384SigningWhenUsingPublicKey()",
"constructor": false,
"full_signature": "@Test public void shouldFailOnRSA384SigningWhenUsingPublicKey()",
"identifier": "shouldFailOnRSA384SigningWhenUsingPublicKey",
"invocations": [
"expect",
"expectMessage",
"expectCause",
"isA",
"expectCause",
"hasMessage",
"is",
"RSA384",
"readPublicKeyFromFile",
"sign"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void shouldFailOnRSA384SigningWhenUsingPublicKey()",
"testcase": true
} | {
"fields": [
{
"declarator": "keyProvider",
"modifier": "private final",
"original_string": "private final RSAKeyProvider keyProvider;",
"type": "RSAKeyProvider",
"var_name": "keyProvider"
},
{
"declarator": "crypto",
"modifier": "private final",
"original_string": "private final CryptoHelper crypto;",
"type": "CryptoHelper",
"var_name": "crypto"
}
],
"file": "lib/src/main/java/com/auth0/jwt/algorithms/RSAAlgorithm.java",
"identifier": "RSAAlgorithm",
"interfaces": "",
"methods": [
{
"class_method_signature": "RSAAlgorithm.RSAAlgorithm(CryptoHelper crypto, String id, String algorithm, RSAKeyProvider keyProvider)",
"constructor": true,
"full_signature": " RSAAlgorithm(CryptoHelper crypto, String id, String algorithm, RSAKeyProvider keyProvider)",
"identifier": "RSAAlgorithm",
"modifiers": "",
"parameters": "(CryptoHelper crypto, String id, String algorithm, RSAKeyProvider keyProvider)",
"return": "",
"signature": " RSAAlgorithm(CryptoHelper crypto, String id, String algorithm, RSAKeyProvider keyProvider)",
"testcase": false
},
{
"class_method_signature": "RSAAlgorithm.RSAAlgorithm(String id, String algorithm, RSAKeyProvider keyProvider)",
"constructor": true,
"full_signature": " RSAAlgorithm(String id, String algorithm, RSAKeyProvider keyProvider)",
"identifier": "RSAAlgorithm",
"modifiers": "",
"parameters": "(String id, String algorithm, RSAKeyProvider keyProvider)",
"return": "",
"signature": " RSAAlgorithm(String id, String algorithm, RSAKeyProvider keyProvider)",
"testcase": false
},
{
"class_method_signature": "RSAAlgorithm.verify(DecodedJWT jwt)",
"constructor": false,
"full_signature": "@Override public void verify(DecodedJWT jwt)",
"identifier": "verify",
"modifiers": "@Override public",
"parameters": "(DecodedJWT jwt)",
"return": "void",
"signature": "void verify(DecodedJWT jwt)",
"testcase": false
},
{
"class_method_signature": "RSAAlgorithm.sign(byte[] headerBytes, byte[] payloadBytes)",
"constructor": false,
"full_signature": "@Override @Deprecated public byte[] sign(byte[] headerBytes, byte[] payloadBytes)",
"identifier": "sign",
"modifiers": "@Override @Deprecated public",
"parameters": "(byte[] headerBytes, byte[] payloadBytes)",
"return": "byte[]",
"signature": "byte[] sign(byte[] headerBytes, byte[] payloadBytes)",
"testcase": false
},
{
"class_method_signature": "RSAAlgorithm.sign(byte[] contentBytes)",
"constructor": false,
"full_signature": "@Override public byte[] sign(byte[] contentBytes)",
"identifier": "sign",
"modifiers": "@Override public",
"parameters": "(byte[] contentBytes)",
"return": "byte[]",
"signature": "byte[] sign(byte[] contentBytes)",
"testcase": false
},
{
"class_method_signature": "RSAAlgorithm.getSigningKeyId()",
"constructor": false,
"full_signature": "@Override public String getSigningKeyId()",
"identifier": "getSigningKeyId",
"modifiers": "@Override public",
"parameters": "()",
"return": "String",
"signature": "String getSigningKeyId()",
"testcase": false
},
{
"class_method_signature": "RSAAlgorithm.providerForKeys(final RSAPublicKey publicKey, final RSAPrivateKey privateKey)",
"constructor": false,
"full_signature": "static RSAKeyProvider providerForKeys(final RSAPublicKey publicKey, final RSAPrivateKey privateKey)",
"identifier": "providerForKeys",
"modifiers": "static",
"parameters": "(final RSAPublicKey publicKey, final RSAPrivateKey privateKey)",
"return": "RSAKeyProvider",
"signature": "RSAKeyProvider providerForKeys(final RSAPublicKey publicKey, final RSAPrivateKey privateKey)",
"testcase": false
}
],
"superclass": "extends Algorithm"
} | {
"body": "@Override\n @Deprecated\n public byte[] sign(byte[] headerBytes, byte[] payloadBytes) throws SignatureGenerationException {\n try {\n RSAPrivateKey privateKey = keyProvider.getPrivateKey();\n if (privateKey == null) {\n throw new IllegalStateException(\"The given Private Key is null.\");\n }\n return crypto.createSignatureFor(getDescription(), privateKey, headerBytes, payloadBytes);\n } catch (NoSuchAlgorithmException | SignatureException | InvalidKeyException | IllegalStateException e) {\n throw new SignatureGenerationException(this, e);\n }\n }",
"class_method_signature": "RSAAlgorithm.sign(byte[] headerBytes, byte[] payloadBytes)",
"constructor": false,
"full_signature": "@Override @Deprecated public byte[] sign(byte[] headerBytes, byte[] payloadBytes)",
"identifier": "sign",
"invocations": [
"getPrivateKey",
"createSignatureFor",
"getDescription"
],
"modifiers": "@Override @Deprecated public",
"parameters": "(byte[] headerBytes, byte[] payloadBytes)",
"return": "byte[]",
"signature": "byte[] sign(byte[] headerBytes, byte[] payloadBytes)",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 691,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 17517521,
"size": 936,
"stargazer_count": 3678,
"stars": null,
"updates": null,
"url": "https://github.com/auth0/java-jwt"
} |
17517521_295 | {
"fields": [
{
"declarator": "exception = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException exception = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "exception"
},
{
"declarator": "objectReader = new ObjectMapper().reader()",
"modifier": "private",
"original_string": "private ObjectReader objectReader = new ObjectMapper().reader();",
"type": "ObjectReader",
"var_name": "objectReader"
}
],
"file": "lib/src/test/java/com/auth0/jwt/impl/BasicHeaderTest.java",
"identifier": "BasicHeaderTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void shouldGetContentType() throws Exception {\n BasicHeader header = new BasicHeader(null, null, \"content\", null, null, objectReader);\n\n assertThat(header, is(notNullValue()));\n assertThat(header.getContentType(), is(notNullValue()));\n assertThat(header.getContentType(), is(\"content\"));\n }",
"class_method_signature": "BasicHeaderTest.shouldGetContentType()",
"constructor": false,
"full_signature": "@Test public void shouldGetContentType()",
"identifier": "shouldGetContentType",
"invocations": [
"assertThat",
"is",
"notNullValue",
"assertThat",
"getContentType",
"is",
"notNullValue",
"assertThat",
"getContentType",
"is"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void shouldGetContentType()",
"testcase": true
} | {
"fields": [
{
"declarator": "serialVersionUID = -4659137688548605095L",
"modifier": "private static final",
"original_string": "private static final long serialVersionUID = -4659137688548605095L;",
"type": "long",
"var_name": "serialVersionUID"
},
{
"declarator": "algorithm",
"modifier": "private final",
"original_string": "private final String algorithm;",
"type": "String",
"var_name": "algorithm"
},
{
"declarator": "type",
"modifier": "private final",
"original_string": "private final String type;",
"type": "String",
"var_name": "type"
},
{
"declarator": "contentType",
"modifier": "private final",
"original_string": "private final String contentType;",
"type": "String",
"var_name": "contentType"
},
{
"declarator": "keyId",
"modifier": "private final",
"original_string": "private final String keyId;",
"type": "String",
"var_name": "keyId"
},
{
"declarator": "tree",
"modifier": "private final",
"original_string": "private final Map<String, JsonNode> tree;",
"type": "Map<String, JsonNode>",
"var_name": "tree"
},
{
"declarator": "objectReader",
"modifier": "private final",
"original_string": "private final ObjectReader objectReader;",
"type": "ObjectReader",
"var_name": "objectReader"
}
],
"file": "lib/src/main/java/com/auth0/jwt/impl/BasicHeader.java",
"identifier": "BasicHeader",
"interfaces": "implements Header, Serializable",
"methods": [
{
"class_method_signature": "BasicHeader.BasicHeader(String algorithm, String type, String contentType, String keyId, Map<String, JsonNode> tree, ObjectReader objectReader)",
"constructor": true,
"full_signature": " BasicHeader(String algorithm, String type, String contentType, String keyId, Map<String, JsonNode> tree, ObjectReader objectReader)",
"identifier": "BasicHeader",
"modifiers": "",
"parameters": "(String algorithm, String type, String contentType, String keyId, Map<String, JsonNode> tree, ObjectReader objectReader)",
"return": "",
"signature": " BasicHeader(String algorithm, String type, String contentType, String keyId, Map<String, JsonNode> tree, ObjectReader objectReader)",
"testcase": false
},
{
"class_method_signature": "BasicHeader.getTree()",
"constructor": false,
"full_signature": " Map<String, JsonNode> getTree()",
"identifier": "getTree",
"modifiers": "",
"parameters": "()",
"return": "Map<String, JsonNode>",
"signature": "Map<String, JsonNode> getTree()",
"testcase": false
},
{
"class_method_signature": "BasicHeader.getAlgorithm()",
"constructor": false,
"full_signature": "@Override public String getAlgorithm()",
"identifier": "getAlgorithm",
"modifiers": "@Override public",
"parameters": "()",
"return": "String",
"signature": "String getAlgorithm()",
"testcase": false
},
{
"class_method_signature": "BasicHeader.getType()",
"constructor": false,
"full_signature": "@Override public String getType()",
"identifier": "getType",
"modifiers": "@Override public",
"parameters": "()",
"return": "String",
"signature": "String getType()",
"testcase": false
},
{
"class_method_signature": "BasicHeader.getContentType()",
"constructor": false,
"full_signature": "@Override public String getContentType()",
"identifier": "getContentType",
"modifiers": "@Override public",
"parameters": "()",
"return": "String",
"signature": "String getContentType()",
"testcase": false
},
{
"class_method_signature": "BasicHeader.getKeyId()",
"constructor": false,
"full_signature": "@Override public String getKeyId()",
"identifier": "getKeyId",
"modifiers": "@Override public",
"parameters": "()",
"return": "String",
"signature": "String getKeyId()",
"testcase": false
},
{
"class_method_signature": "BasicHeader.getHeaderClaim(String name)",
"constructor": false,
"full_signature": "@Override public Claim getHeaderClaim(String name)",
"identifier": "getHeaderClaim",
"modifiers": "@Override public",
"parameters": "(String name)",
"return": "Claim",
"signature": "Claim getHeaderClaim(String name)",
"testcase": false
}
],
"superclass": ""
} | {
"body": "@Override\n public String getContentType() {\n return contentType;\n }",
"class_method_signature": "BasicHeader.getContentType()",
"constructor": false,
"full_signature": "@Override public String getContentType()",
"identifier": "getContentType",
"invocations": [],
"modifiers": "@Override public",
"parameters": "()",
"return": "String",
"signature": "String getContentType()",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 691,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 17517521,
"size": 936,
"stargazer_count": 3678,
"stars": null,
"updates": null,
"url": "https://github.com/auth0/java-jwt"
} |
17517521_153 | {
"fields": [
{
"declarator": "PRIVATE_KEY_FILE_256 = \"src/test/resources/ec256-key-private.pem\"",
"modifier": "private static final",
"original_string": "private static final String PRIVATE_KEY_FILE_256 = \"src/test/resources/ec256-key-private.pem\";",
"type": "String",
"var_name": "PRIVATE_KEY_FILE_256"
},
{
"declarator": "PUBLIC_KEY_FILE_256 = \"src/test/resources/ec256-key-public.pem\"",
"modifier": "private static final",
"original_string": "private static final String PUBLIC_KEY_FILE_256 = \"src/test/resources/ec256-key-public.pem\";",
"type": "String",
"var_name": "PUBLIC_KEY_FILE_256"
},
{
"declarator": "INVALID_PUBLIC_KEY_FILE_256 = \"src/test/resources/ec256-key-public-invalid.pem\"",
"modifier": "private static final",
"original_string": "private static final String INVALID_PUBLIC_KEY_FILE_256 = \"src/test/resources/ec256-key-public-invalid.pem\";",
"type": "String",
"var_name": "INVALID_PUBLIC_KEY_FILE_256"
},
{
"declarator": "PRIVATE_KEY_FILE_256K = \"src/test/resources/ec256k-key-private.pem\"",
"modifier": "private static final",
"original_string": "private static final String PRIVATE_KEY_FILE_256K = \"src/test/resources/ec256k-key-private.pem\";",
"type": "String",
"var_name": "PRIVATE_KEY_FILE_256K"
},
{
"declarator": "PUBLIC_KEY_FILE_256K = \"src/test/resources/ec256k-key-public.pem\"",
"modifier": "private static final",
"original_string": "private static final String PUBLIC_KEY_FILE_256K = \"src/test/resources/ec256k-key-public.pem\";",
"type": "String",
"var_name": "PUBLIC_KEY_FILE_256K"
},
{
"declarator": "INVALID_PUBLIC_KEY_FILE_256K = \"src/test/resources/ec256k-key-public-invalid.pem\"",
"modifier": "private static final",
"original_string": "private static final String INVALID_PUBLIC_KEY_FILE_256K = \"src/test/resources/ec256k-key-public-invalid.pem\";",
"type": "String",
"var_name": "INVALID_PUBLIC_KEY_FILE_256K"
},
{
"declarator": "ES256K_JWT = \"eyJraWQiOiJteS1rZXktaWQiLCJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NksifQ.e30.2ggPsc4xwQhYcgJueo3uQ14MpaVJ3AbEE8UE-wA9fc8SMibeW54gjZbikL-JBHqhEwc22Cp8DNOtadXsM81RGQ\"",
"modifier": "private static final",
"original_string": "private static final String ES256K_JWT = \"eyJraWQiOiJteS1rZXktaWQiLCJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NksifQ.e30.2ggPsc4xwQhYcgJueo3uQ14MpaVJ3AbEE8UE-wA9fc8SMibeW54gjZbikL-JBHqhEwc22Cp8DNOtadXsM81RGQ\";",
"type": "String",
"var_name": "ES256K_JWT"
},
{
"declarator": "PRIVATE_KEY_FILE_384 = \"src/test/resources/ec384-key-private.pem\"",
"modifier": "private static final",
"original_string": "private static final String PRIVATE_KEY_FILE_384 = \"src/test/resources/ec384-key-private.pem\";",
"type": "String",
"var_name": "PRIVATE_KEY_FILE_384"
},
{
"declarator": "PUBLIC_KEY_FILE_384 = \"src/test/resources/ec384-key-public.pem\"",
"modifier": "private static final",
"original_string": "private static final String PUBLIC_KEY_FILE_384 = \"src/test/resources/ec384-key-public.pem\";",
"type": "String",
"var_name": "PUBLIC_KEY_FILE_384"
},
{
"declarator": "INVALID_PUBLIC_KEY_FILE_384 = \"src/test/resources/ec384-key-public-invalid.pem\"",
"modifier": "private static final",
"original_string": "private static final String INVALID_PUBLIC_KEY_FILE_384 = \"src/test/resources/ec384-key-public-invalid.pem\";",
"type": "String",
"var_name": "INVALID_PUBLIC_KEY_FILE_384"
},
{
"declarator": "PRIVATE_KEY_FILE_512 = \"src/test/resources/ec512-key-private.pem\"",
"modifier": "private static final",
"original_string": "private static final String PRIVATE_KEY_FILE_512 = \"src/test/resources/ec512-key-private.pem\";",
"type": "String",
"var_name": "PRIVATE_KEY_FILE_512"
},
{
"declarator": "PUBLIC_KEY_FILE_512 = \"src/test/resources/ec512-key-public.pem\"",
"modifier": "private static final",
"original_string": "private static final String PUBLIC_KEY_FILE_512 = \"src/test/resources/ec512-key-public.pem\";",
"type": "String",
"var_name": "PUBLIC_KEY_FILE_512"
},
{
"declarator": "INVALID_PUBLIC_KEY_FILE_512 = \"src/test/resources/ec512-key-public-invalid.pem\"",
"modifier": "private static final",
"original_string": "private static final String INVALID_PUBLIC_KEY_FILE_512 = \"src/test/resources/ec512-key-public-invalid.pem\";",
"type": "String",
"var_name": "INVALID_PUBLIC_KEY_FILE_512"
},
{
"declarator": "exception = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException exception = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "exception"
},
{
"declarator": "ES256Header = \"eyJhbGciOiJFUzI1NiJ9\"",
"modifier": "private static final",
"original_string": "private static final String ES256Header = \"eyJhbGciOiJFUzI1NiJ9\";",
"type": "String",
"var_name": "ES256Header"
},
{
"declarator": "ES384Header = \"eyJhbGciOiJFUzM4NCJ9\"",
"modifier": "private static final",
"original_string": "private static final String ES384Header = \"eyJhbGciOiJFUzM4NCJ9\";",
"type": "String",
"var_name": "ES384Header"
},
{
"declarator": "ES512Header = \"eyJhbGciOiJFUzUxMiJ9\"",
"modifier": "private static final",
"original_string": "private static final String ES512Header = \"eyJhbGciOiJFUzUxMiJ9\";",
"type": "String",
"var_name": "ES512Header"
},
{
"declarator": "auth0IssPayload = \"eyJpc3MiOiJhdXRoMCJ9\"",
"modifier": "private static final",
"original_string": "private static final String auth0IssPayload = \"eyJpc3MiOiJhdXRoMCJ9\";",
"type": "String",
"var_name": "auth0IssPayload"
},
{
"declarator": "ES256HeaderBytes = ES256Header.getBytes(StandardCharsets.UTF_8)",
"modifier": "private static final",
"original_string": "private static final byte[] ES256HeaderBytes = ES256Header.getBytes(StandardCharsets.UTF_8);",
"type": "byte[]",
"var_name": "ES256HeaderBytes"
},
{
"declarator": "ES384HeaderBytes = ES384Header.getBytes(StandardCharsets.UTF_8)",
"modifier": "private static final",
"original_string": "private static final byte[] ES384HeaderBytes = ES384Header.getBytes(StandardCharsets.UTF_8);",
"type": "byte[]",
"var_name": "ES384HeaderBytes"
},
{
"declarator": "ES512HeaderBytes = ES512Header.getBytes(StandardCharsets.UTF_8)",
"modifier": "private static final",
"original_string": "private static final byte[] ES512HeaderBytes = ES512Header.getBytes(StandardCharsets.UTF_8);",
"type": "byte[]",
"var_name": "ES512HeaderBytes"
},
{
"declarator": "auth0IssPayloadBytes = auth0IssPayload.getBytes(StandardCharsets.UTF_8)",
"modifier": "private static final",
"original_string": "private static final byte[] auth0IssPayloadBytes = auth0IssPayload.getBytes(StandardCharsets.UTF_8);",
"type": "byte[]",
"var_name": "auth0IssPayloadBytes"
}
],
"file": "lib/src/test/java/com/auth0/jwt/algorithms/ECDSAAlgorithmTest.java",
"identifier": "ECDSAAlgorithmTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void shouldFailECDSA256KVerificationOnInvalidJOSESignatureLength() throws Exception {\n exception.expect(SignatureVerificationException.class);\n exception.expectMessage(\"The Token's Signature resulted invalid when verified using the Algorithm: SHA256withECDSA\");\n exception.expectCause(isA(SignatureException.class));\n exception.expectCause(hasMessage(is(\"Invalid JOSE signature format.\")));\n \n String jwt = ES256K_JWT.substring(0,ES256K_JWT.length()-1);\n Algorithm algorithm = Algorithm.ECDSA256K((ECPublicKey) readPublicKeyFromFile(INVALID_PUBLIC_KEY_FILE_256K, \"EC\"), null);\n algorithm.verify(JWT.decode(jwt));\n }",
"class_method_signature": "ECDSAAlgorithmTest.shouldFailECDSA256KVerificationOnInvalidJOSESignatureLength()",
"constructor": false,
"full_signature": "@Test public void shouldFailECDSA256KVerificationOnInvalidJOSESignatureLength()",
"identifier": "shouldFailECDSA256KVerificationOnInvalidJOSESignatureLength",
"invocations": [
"expect",
"expectMessage",
"expectCause",
"isA",
"expectCause",
"hasMessage",
"is",
"substring",
"length",
"ECDSA256K",
"readPublicKeyFromFile",
"verify",
"decode"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void shouldFailECDSA256KVerificationOnInvalidJOSESignatureLength()",
"testcase": true
} | {
"fields": [
{
"declarator": "keyProvider",
"modifier": "private final",
"original_string": "private final ECDSAKeyProvider keyProvider;",
"type": "ECDSAKeyProvider",
"var_name": "keyProvider"
},
{
"declarator": "crypto",
"modifier": "private final",
"original_string": "private final CryptoHelper crypto;",
"type": "CryptoHelper",
"var_name": "crypto"
},
{
"declarator": "ecNumberSize",
"modifier": "private final",
"original_string": "private final int ecNumberSize;",
"type": "int",
"var_name": "ecNumberSize"
}
],
"file": "lib/src/main/java/com/auth0/jwt/algorithms/ECDSAAlgorithm.java",
"identifier": "ECDSAAlgorithm",
"interfaces": "",
"methods": [
{
"class_method_signature": "ECDSAAlgorithm.ECDSAAlgorithm(CryptoHelper crypto, String id, String algorithm, int ecNumberSize, ECDSAKeyProvider keyProvider)",
"constructor": true,
"full_signature": " ECDSAAlgorithm(CryptoHelper crypto, String id, String algorithm, int ecNumberSize, ECDSAKeyProvider keyProvider)",
"identifier": "ECDSAAlgorithm",
"modifiers": "",
"parameters": "(CryptoHelper crypto, String id, String algorithm, int ecNumberSize, ECDSAKeyProvider keyProvider)",
"return": "",
"signature": " ECDSAAlgorithm(CryptoHelper crypto, String id, String algorithm, int ecNumberSize, ECDSAKeyProvider keyProvider)",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.ECDSAAlgorithm(String id, String algorithm, int ecNumberSize, ECDSAKeyProvider keyProvider)",
"constructor": true,
"full_signature": " ECDSAAlgorithm(String id, String algorithm, int ecNumberSize, ECDSAKeyProvider keyProvider)",
"identifier": "ECDSAAlgorithm",
"modifiers": "",
"parameters": "(String id, String algorithm, int ecNumberSize, ECDSAKeyProvider keyProvider)",
"return": "",
"signature": " ECDSAAlgorithm(String id, String algorithm, int ecNumberSize, ECDSAKeyProvider keyProvider)",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.verify(DecodedJWT jwt)",
"constructor": false,
"full_signature": "@Override public void verify(DecodedJWT jwt)",
"identifier": "verify",
"modifiers": "@Override public",
"parameters": "(DecodedJWT jwt)",
"return": "void",
"signature": "void verify(DecodedJWT jwt)",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.sign(byte[] headerBytes, byte[] payloadBytes)",
"constructor": false,
"full_signature": "@Override public byte[] sign(byte[] headerBytes, byte[] payloadBytes)",
"identifier": "sign",
"modifiers": "@Override public",
"parameters": "(byte[] headerBytes, byte[] payloadBytes)",
"return": "byte[]",
"signature": "byte[] sign(byte[] headerBytes, byte[] payloadBytes)",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.sign(byte[] contentBytes)",
"constructor": false,
"full_signature": "@Override @Deprecated public byte[] sign(byte[] contentBytes)",
"identifier": "sign",
"modifiers": "@Override @Deprecated public",
"parameters": "(byte[] contentBytes)",
"return": "byte[]",
"signature": "byte[] sign(byte[] contentBytes)",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.getSigningKeyId()",
"constructor": false,
"full_signature": "@Override public String getSigningKeyId()",
"identifier": "getSigningKeyId",
"modifiers": "@Override public",
"parameters": "()",
"return": "String",
"signature": "String getSigningKeyId()",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.DERToJOSE(byte[] derSignature)",
"constructor": false,
"full_signature": " byte[] DERToJOSE(byte[] derSignature)",
"identifier": "DERToJOSE",
"modifiers": "",
"parameters": "(byte[] derSignature)",
"return": "byte[]",
"signature": "byte[] DERToJOSE(byte[] derSignature)",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.JOSEToDER(byte[] joseSignature)",
"constructor": false,
"full_signature": " byte[] JOSEToDER(byte[] joseSignature)",
"identifier": "JOSEToDER",
"modifiers": "",
"parameters": "(byte[] joseSignature)",
"return": "byte[]",
"signature": "byte[] JOSEToDER(byte[] joseSignature)",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.countPadding(byte[] bytes, int fromIndex, int toIndex)",
"constructor": false,
"full_signature": "private int countPadding(byte[] bytes, int fromIndex, int toIndex)",
"identifier": "countPadding",
"modifiers": "private",
"parameters": "(byte[] bytes, int fromIndex, int toIndex)",
"return": "int",
"signature": "int countPadding(byte[] bytes, int fromIndex, int toIndex)",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.providerForKeys(final ECPublicKey publicKey, final ECPrivateKey privateKey)",
"constructor": false,
"full_signature": "static ECDSAKeyProvider providerForKeys(final ECPublicKey publicKey, final ECPrivateKey privateKey)",
"identifier": "providerForKeys",
"modifiers": "static",
"parameters": "(final ECPublicKey publicKey, final ECPrivateKey privateKey)",
"return": "ECDSAKeyProvider",
"signature": "ECDSAKeyProvider providerForKeys(final ECPublicKey publicKey, final ECPrivateKey privateKey)",
"testcase": false
}
],
"superclass": "extends Algorithm"
} | {
"body": "@Override\n public void verify(DecodedJWT jwt) throws SignatureVerificationException {\n byte[] signatureBytes = Base64.decodeBase64(jwt.getSignature());\n\n try {\n ECPublicKey publicKey = keyProvider.getPublicKeyById(jwt.getKeyId());\n if (publicKey == null) {\n throw new IllegalStateException(\"The given Public Key is null.\");\n }\n boolean valid = crypto.verifySignatureFor(getDescription(), publicKey, jwt.getHeader(), jwt.getPayload(), JOSEToDER(signatureBytes));\n\n if (!valid) {\n throw new SignatureVerificationException(this);\n }\n } catch (NoSuchAlgorithmException | SignatureException | InvalidKeyException | IllegalStateException e) {\n throw new SignatureVerificationException(this, e);\n }\n }",
"class_method_signature": "ECDSAAlgorithm.verify(DecodedJWT jwt)",
"constructor": false,
"full_signature": "@Override public void verify(DecodedJWT jwt)",
"identifier": "verify",
"invocations": [
"decodeBase64",
"getSignature",
"getPublicKeyById",
"getKeyId",
"verifySignatureFor",
"getDescription",
"getHeader",
"getPayload",
"JOSEToDER"
],
"modifiers": "@Override public",
"parameters": "(DecodedJWT jwt)",
"return": "void",
"signature": "void verify(DecodedJWT jwt)",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 691,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 17517521,
"size": 936,
"stargazer_count": 3678,
"stars": null,
"updates": null,
"url": "https://github.com/auth0/java-jwt"
} |
17517521_201 | {
"fields": [
{
"declarator": "PRIVATE_KEY_FILE_256 = \"src/test/resources/ec256-key-private.pem\"",
"modifier": "private static final",
"original_string": "private static final String PRIVATE_KEY_FILE_256 = \"src/test/resources/ec256-key-private.pem\";",
"type": "String",
"var_name": "PRIVATE_KEY_FILE_256"
},
{
"declarator": "PUBLIC_KEY_FILE_256 = \"src/test/resources/ec256-key-public.pem\"",
"modifier": "private static final",
"original_string": "private static final String PUBLIC_KEY_FILE_256 = \"src/test/resources/ec256-key-public.pem\";",
"type": "String",
"var_name": "PUBLIC_KEY_FILE_256"
},
{
"declarator": "INVALID_PUBLIC_KEY_FILE_256 = \"src/test/resources/ec256-key-public-invalid.pem\"",
"modifier": "private static final",
"original_string": "private static final String INVALID_PUBLIC_KEY_FILE_256 = \"src/test/resources/ec256-key-public-invalid.pem\";",
"type": "String",
"var_name": "INVALID_PUBLIC_KEY_FILE_256"
},
{
"declarator": "PRIVATE_KEY_FILE_256K = \"src/test/resources/ec256k-key-private.pem\"",
"modifier": "private static final",
"original_string": "private static final String PRIVATE_KEY_FILE_256K = \"src/test/resources/ec256k-key-private.pem\";",
"type": "String",
"var_name": "PRIVATE_KEY_FILE_256K"
},
{
"declarator": "PUBLIC_KEY_FILE_256K = \"src/test/resources/ec256k-key-public.pem\"",
"modifier": "private static final",
"original_string": "private static final String PUBLIC_KEY_FILE_256K = \"src/test/resources/ec256k-key-public.pem\";",
"type": "String",
"var_name": "PUBLIC_KEY_FILE_256K"
},
{
"declarator": "INVALID_PUBLIC_KEY_FILE_256K = \"src/test/resources/ec256k-key-public-invalid.pem\"",
"modifier": "private static final",
"original_string": "private static final String INVALID_PUBLIC_KEY_FILE_256K = \"src/test/resources/ec256k-key-public-invalid.pem\";",
"type": "String",
"var_name": "INVALID_PUBLIC_KEY_FILE_256K"
},
{
"declarator": "ES256K_JWT = \"eyJraWQiOiJteS1rZXktaWQiLCJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NksifQ.e30.2ggPsc4xwQhYcgJueo3uQ14MpaVJ3AbEE8UE-wA9fc8SMibeW54gjZbikL-JBHqhEwc22Cp8DNOtadXsM81RGQ\"",
"modifier": "private static final",
"original_string": "private static final String ES256K_JWT = \"eyJraWQiOiJteS1rZXktaWQiLCJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NksifQ.e30.2ggPsc4xwQhYcgJueo3uQ14MpaVJ3AbEE8UE-wA9fc8SMibeW54gjZbikL-JBHqhEwc22Cp8DNOtadXsM81RGQ\";",
"type": "String",
"var_name": "ES256K_JWT"
},
{
"declarator": "PRIVATE_KEY_FILE_384 = \"src/test/resources/ec384-key-private.pem\"",
"modifier": "private static final",
"original_string": "private static final String PRIVATE_KEY_FILE_384 = \"src/test/resources/ec384-key-private.pem\";",
"type": "String",
"var_name": "PRIVATE_KEY_FILE_384"
},
{
"declarator": "PUBLIC_KEY_FILE_384 = \"src/test/resources/ec384-key-public.pem\"",
"modifier": "private static final",
"original_string": "private static final String PUBLIC_KEY_FILE_384 = \"src/test/resources/ec384-key-public.pem\";",
"type": "String",
"var_name": "PUBLIC_KEY_FILE_384"
},
{
"declarator": "INVALID_PUBLIC_KEY_FILE_384 = \"src/test/resources/ec384-key-public-invalid.pem\"",
"modifier": "private static final",
"original_string": "private static final String INVALID_PUBLIC_KEY_FILE_384 = \"src/test/resources/ec384-key-public-invalid.pem\";",
"type": "String",
"var_name": "INVALID_PUBLIC_KEY_FILE_384"
},
{
"declarator": "PRIVATE_KEY_FILE_512 = \"src/test/resources/ec512-key-private.pem\"",
"modifier": "private static final",
"original_string": "private static final String PRIVATE_KEY_FILE_512 = \"src/test/resources/ec512-key-private.pem\";",
"type": "String",
"var_name": "PRIVATE_KEY_FILE_512"
},
{
"declarator": "PUBLIC_KEY_FILE_512 = \"src/test/resources/ec512-key-public.pem\"",
"modifier": "private static final",
"original_string": "private static final String PUBLIC_KEY_FILE_512 = \"src/test/resources/ec512-key-public.pem\";",
"type": "String",
"var_name": "PUBLIC_KEY_FILE_512"
},
{
"declarator": "INVALID_PUBLIC_KEY_FILE_512 = \"src/test/resources/ec512-key-public-invalid.pem\"",
"modifier": "private static final",
"original_string": "private static final String INVALID_PUBLIC_KEY_FILE_512 = \"src/test/resources/ec512-key-public-invalid.pem\";",
"type": "String",
"var_name": "INVALID_PUBLIC_KEY_FILE_512"
},
{
"declarator": "exception = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException exception = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "exception"
},
{
"declarator": "ES256Header = \"eyJhbGciOiJFUzI1NiJ9\"",
"modifier": "private static final",
"original_string": "private static final String ES256Header = \"eyJhbGciOiJFUzI1NiJ9\";",
"type": "String",
"var_name": "ES256Header"
},
{
"declarator": "ES384Header = \"eyJhbGciOiJFUzM4NCJ9\"",
"modifier": "private static final",
"original_string": "private static final String ES384Header = \"eyJhbGciOiJFUzM4NCJ9\";",
"type": "String",
"var_name": "ES384Header"
},
{
"declarator": "ES512Header = \"eyJhbGciOiJFUzUxMiJ9\"",
"modifier": "private static final",
"original_string": "private static final String ES512Header = \"eyJhbGciOiJFUzUxMiJ9\";",
"type": "String",
"var_name": "ES512Header"
},
{
"declarator": "auth0IssPayload = \"eyJpc3MiOiJhdXRoMCJ9\"",
"modifier": "private static final",
"original_string": "private static final String auth0IssPayload = \"eyJpc3MiOiJhdXRoMCJ9\";",
"type": "String",
"var_name": "auth0IssPayload"
},
{
"declarator": "ES256HeaderBytes = ES256Header.getBytes(StandardCharsets.UTF_8)",
"modifier": "private static final",
"original_string": "private static final byte[] ES256HeaderBytes = ES256Header.getBytes(StandardCharsets.UTF_8);",
"type": "byte[]",
"var_name": "ES256HeaderBytes"
},
{
"declarator": "ES384HeaderBytes = ES384Header.getBytes(StandardCharsets.UTF_8)",
"modifier": "private static final",
"original_string": "private static final byte[] ES384HeaderBytes = ES384Header.getBytes(StandardCharsets.UTF_8);",
"type": "byte[]",
"var_name": "ES384HeaderBytes"
},
{
"declarator": "ES512HeaderBytes = ES512Header.getBytes(StandardCharsets.UTF_8)",
"modifier": "private static final",
"original_string": "private static final byte[] ES512HeaderBytes = ES512Header.getBytes(StandardCharsets.UTF_8);",
"type": "byte[]",
"var_name": "ES512HeaderBytes"
},
{
"declarator": "auth0IssPayloadBytes = auth0IssPayload.getBytes(StandardCharsets.UTF_8)",
"modifier": "private static final",
"original_string": "private static final byte[] auth0IssPayloadBytes = auth0IssPayload.getBytes(StandardCharsets.UTF_8);",
"type": "byte[]",
"var_name": "auth0IssPayloadBytes"
}
],
"file": "lib/src/test/java/com/auth0/jwt/algorithms/ECDSAAlgorithmTest.java",
"identifier": "ECDSAAlgorithmTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void shouldDecodeECDSA256DER() throws Exception {\n ECDSAAlgorithm algorithm256 = (ECDSAAlgorithm) Algorithm.ECDSA256((ECPublicKey) readPublicKeyFromFile(PUBLIC_KEY_FILE_256, \"EC\"), (ECPrivateKey) readPrivateKeyFromFile(PRIVATE_KEY_FILE_256, \"EC\"));\n\n //Without padding\n byte[] derSignature = createDERSignature(32, false, false);\n byte[] joseSignature = algorithm256.DERToJOSE(derSignature);\n assertValidJOSESignature(joseSignature, 32, false, false);\n\n //With R padding\n derSignature = createDERSignature(32, true, false);\n joseSignature = algorithm256.DERToJOSE(derSignature);\n assertValidJOSESignature(joseSignature, 32, true, false);\n\n //With S padding\n derSignature = createDERSignature(32, false, true);\n joseSignature = algorithm256.DERToJOSE(derSignature);\n assertValidJOSESignature(joseSignature, 32, false, true);\n\n //With both paddings\n derSignature = createDERSignature(32, true, true);\n joseSignature = algorithm256.DERToJOSE(derSignature);\n assertValidJOSESignature(joseSignature, 32, true, true);\n }",
"class_method_signature": "ECDSAAlgorithmTest.shouldDecodeECDSA256DER()",
"constructor": false,
"full_signature": "@Test public void shouldDecodeECDSA256DER()",
"identifier": "shouldDecodeECDSA256DER",
"invocations": [
"ECDSA256",
"readPublicKeyFromFile",
"readPrivateKeyFromFile",
"createDERSignature",
"DERToJOSE",
"assertValidJOSESignature",
"createDERSignature",
"DERToJOSE",
"assertValidJOSESignature",
"createDERSignature",
"DERToJOSE",
"assertValidJOSESignature",
"createDERSignature",
"DERToJOSE",
"assertValidJOSESignature"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void shouldDecodeECDSA256DER()",
"testcase": true
} | {
"fields": [
{
"declarator": "keyProvider",
"modifier": "private final",
"original_string": "private final ECDSAKeyProvider keyProvider;",
"type": "ECDSAKeyProvider",
"var_name": "keyProvider"
},
{
"declarator": "crypto",
"modifier": "private final",
"original_string": "private final CryptoHelper crypto;",
"type": "CryptoHelper",
"var_name": "crypto"
},
{
"declarator": "ecNumberSize",
"modifier": "private final",
"original_string": "private final int ecNumberSize;",
"type": "int",
"var_name": "ecNumberSize"
}
],
"file": "lib/src/main/java/com/auth0/jwt/algorithms/ECDSAAlgorithm.java",
"identifier": "ECDSAAlgorithm",
"interfaces": "",
"methods": [
{
"class_method_signature": "ECDSAAlgorithm.ECDSAAlgorithm(CryptoHelper crypto, String id, String algorithm, int ecNumberSize, ECDSAKeyProvider keyProvider)",
"constructor": true,
"full_signature": " ECDSAAlgorithm(CryptoHelper crypto, String id, String algorithm, int ecNumberSize, ECDSAKeyProvider keyProvider)",
"identifier": "ECDSAAlgorithm",
"modifiers": "",
"parameters": "(CryptoHelper crypto, String id, String algorithm, int ecNumberSize, ECDSAKeyProvider keyProvider)",
"return": "",
"signature": " ECDSAAlgorithm(CryptoHelper crypto, String id, String algorithm, int ecNumberSize, ECDSAKeyProvider keyProvider)",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.ECDSAAlgorithm(String id, String algorithm, int ecNumberSize, ECDSAKeyProvider keyProvider)",
"constructor": true,
"full_signature": " ECDSAAlgorithm(String id, String algorithm, int ecNumberSize, ECDSAKeyProvider keyProvider)",
"identifier": "ECDSAAlgorithm",
"modifiers": "",
"parameters": "(String id, String algorithm, int ecNumberSize, ECDSAKeyProvider keyProvider)",
"return": "",
"signature": " ECDSAAlgorithm(String id, String algorithm, int ecNumberSize, ECDSAKeyProvider keyProvider)",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.verify(DecodedJWT jwt)",
"constructor": false,
"full_signature": "@Override public void verify(DecodedJWT jwt)",
"identifier": "verify",
"modifiers": "@Override public",
"parameters": "(DecodedJWT jwt)",
"return": "void",
"signature": "void verify(DecodedJWT jwt)",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.sign(byte[] headerBytes, byte[] payloadBytes)",
"constructor": false,
"full_signature": "@Override public byte[] sign(byte[] headerBytes, byte[] payloadBytes)",
"identifier": "sign",
"modifiers": "@Override public",
"parameters": "(byte[] headerBytes, byte[] payloadBytes)",
"return": "byte[]",
"signature": "byte[] sign(byte[] headerBytes, byte[] payloadBytes)",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.sign(byte[] contentBytes)",
"constructor": false,
"full_signature": "@Override @Deprecated public byte[] sign(byte[] contentBytes)",
"identifier": "sign",
"modifiers": "@Override @Deprecated public",
"parameters": "(byte[] contentBytes)",
"return": "byte[]",
"signature": "byte[] sign(byte[] contentBytes)",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.getSigningKeyId()",
"constructor": false,
"full_signature": "@Override public String getSigningKeyId()",
"identifier": "getSigningKeyId",
"modifiers": "@Override public",
"parameters": "()",
"return": "String",
"signature": "String getSigningKeyId()",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.DERToJOSE(byte[] derSignature)",
"constructor": false,
"full_signature": " byte[] DERToJOSE(byte[] derSignature)",
"identifier": "DERToJOSE",
"modifiers": "",
"parameters": "(byte[] derSignature)",
"return": "byte[]",
"signature": "byte[] DERToJOSE(byte[] derSignature)",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.JOSEToDER(byte[] joseSignature)",
"constructor": false,
"full_signature": " byte[] JOSEToDER(byte[] joseSignature)",
"identifier": "JOSEToDER",
"modifiers": "",
"parameters": "(byte[] joseSignature)",
"return": "byte[]",
"signature": "byte[] JOSEToDER(byte[] joseSignature)",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.countPadding(byte[] bytes, int fromIndex, int toIndex)",
"constructor": false,
"full_signature": "private int countPadding(byte[] bytes, int fromIndex, int toIndex)",
"identifier": "countPadding",
"modifiers": "private",
"parameters": "(byte[] bytes, int fromIndex, int toIndex)",
"return": "int",
"signature": "int countPadding(byte[] bytes, int fromIndex, int toIndex)",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.providerForKeys(final ECPublicKey publicKey, final ECPrivateKey privateKey)",
"constructor": false,
"full_signature": "static ECDSAKeyProvider providerForKeys(final ECPublicKey publicKey, final ECPrivateKey privateKey)",
"identifier": "providerForKeys",
"modifiers": "static",
"parameters": "(final ECPublicKey publicKey, final ECPrivateKey privateKey)",
"return": "ECDSAKeyProvider",
"signature": "ECDSAKeyProvider providerForKeys(final ECPublicKey publicKey, final ECPrivateKey privateKey)",
"testcase": false
}
],
"superclass": "extends Algorithm"
} | {
"body": "byte[] DERToJOSE(byte[] derSignature) throws SignatureException {\n // DER Structure: http://crypto.stackexchange.com/a/1797\n boolean derEncoded = derSignature[0] == 0x30 && derSignature.length != ecNumberSize * 2;\n if (!derEncoded) {\n throw new SignatureException(\"Invalid DER signature format.\");\n }\n\n final byte[] joseSignature = new byte[ecNumberSize * 2];\n\n //Skip 0x30\n int offset = 1;\n if (derSignature[1] == (byte) 0x81) {\n //Skip sign\n offset++;\n }\n\n //Convert to unsigned. Should match DER length - offset\n int encodedLength = derSignature[offset++] & 0xff;\n if (encodedLength != derSignature.length - offset) {\n throw new SignatureException(\"Invalid DER signature format.\");\n }\n\n //Skip 0x02\n offset++;\n\n //Obtain R number length (Includes padding) and skip it\n int rLength = derSignature[offset++];\n if (rLength > ecNumberSize + 1) {\n throw new SignatureException(\"Invalid DER signature format.\");\n }\n int rPadding = ecNumberSize - rLength;\n //Retrieve R number\n System.arraycopy(derSignature, offset + Math.max(-rPadding, 0), joseSignature, Math.max(rPadding, 0), rLength + Math.min(rPadding, 0));\n\n //Skip R number and 0x02\n offset += rLength + 1;\n\n //Obtain S number length. (Includes padding)\n int sLength = derSignature[offset++];\n if (sLength > ecNumberSize + 1) {\n throw new SignatureException(\"Invalid DER signature format.\");\n }\n int sPadding = ecNumberSize - sLength;\n //Retrieve R number\n System.arraycopy(derSignature, offset + Math.max(-sPadding, 0), joseSignature, ecNumberSize + Math.max(sPadding, 0), sLength + Math.min(sPadding, 0));\n\n return joseSignature;\n }",
"class_method_signature": "ECDSAAlgorithm.DERToJOSE(byte[] derSignature)",
"constructor": false,
"full_signature": " byte[] DERToJOSE(byte[] derSignature)",
"identifier": "DERToJOSE",
"invocations": [
"arraycopy",
"max",
"max",
"min",
"arraycopy",
"max",
"max",
"min"
],
"modifiers": "",
"parameters": "(byte[] derSignature)",
"return": "byte[]",
"signature": "byte[] DERToJOSE(byte[] derSignature)",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 691,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 17517521,
"size": 936,
"stargazer_count": 3678,
"stars": null,
"updates": null,
"url": "https://github.com/auth0/java-jwt"
} |
17517521_40 | {
"fields": [
{
"declarator": "DATE_TOKEN_MS_VALUE = 1477592 * 1000",
"modifier": "private static final",
"original_string": "private static final long DATE_TOKEN_MS_VALUE = 1477592 * 1000;",
"type": "long",
"var_name": "DATE_TOKEN_MS_VALUE"
},
{
"declarator": "exception = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException exception = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "exception"
}
],
"file": "lib/src/test/java/com/auth0/jwt/JWTVerifierTest.java",
"identifier": "JWTVerifierTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@SuppressWarnings(\"RedundantCast\")\n @Test\n public void shouldOverrideDefaultExpiresAtLeeway() throws Exception {\n Algorithm algorithm = mock(Algorithm.class);\n JWTVerifier verifier = JWTVerifier.init(algorithm)\n .acceptLeeway(1234L)\n .acceptExpiresAt(9999L)\n .build();\n\n assertThat(verifier.claims, is(notNullValue()));\n assertThat(verifier.claims, hasEntry(\"iat\", (Object) 1234L));\n assertThat(verifier.claims, hasEntry(\"exp\", (Object) 9999L));\n assertThat(verifier.claims, hasEntry(\"nbf\", (Object) 1234L));\n }",
"class_method_signature": "JWTVerifierTest.shouldOverrideDefaultExpiresAtLeeway()",
"constructor": false,
"full_signature": "@SuppressWarnings(\"RedundantCast\") @Test public void shouldOverrideDefaultExpiresAtLeeway()",
"identifier": "shouldOverrideDefaultExpiresAtLeeway",
"invocations": [
"mock",
"build",
"acceptExpiresAt",
"acceptLeeway",
"init",
"assertThat",
"is",
"notNullValue",
"assertThat",
"hasEntry",
"assertThat",
"hasEntry",
"assertThat",
"hasEntry"
],
"modifiers": "@SuppressWarnings(\"RedundantCast\") @Test public",
"parameters": "()",
"return": "void",
"signature": "void shouldOverrideDefaultExpiresAtLeeway()",
"testcase": true
} | {
"fields": [
{
"declarator": "algorithm",
"modifier": "private final",
"original_string": "private final Algorithm algorithm;",
"type": "Algorithm",
"var_name": "algorithm"
},
{
"declarator": "claims",
"modifier": "final",
"original_string": "final Map<String, Object> claims;",
"type": "Map<String, Object>",
"var_name": "claims"
},
{
"declarator": "clock",
"modifier": "private final",
"original_string": "private final Clock clock;",
"type": "Clock",
"var_name": "clock"
},
{
"declarator": "parser",
"modifier": "private final",
"original_string": "private final JWTParser parser;",
"type": "JWTParser",
"var_name": "parser"
}
],
"file": "lib/src/main/java/com/auth0/jwt/JWTVerifier.java",
"identifier": "JWTVerifier",
"interfaces": "implements com.auth0.jwt.interfaces.JWTVerifier",
"methods": [
{
"class_method_signature": "JWTVerifier.JWTVerifier(Algorithm algorithm, Map<String, Object> claims, Clock clock)",
"constructor": true,
"full_signature": " JWTVerifier(Algorithm algorithm, Map<String, Object> claims, Clock clock)",
"identifier": "JWTVerifier",
"modifiers": "",
"parameters": "(Algorithm algorithm, Map<String, Object> claims, Clock clock)",
"return": "",
"signature": " JWTVerifier(Algorithm algorithm, Map<String, Object> claims, Clock clock)",
"testcase": false
},
{
"class_method_signature": "JWTVerifier.init(Algorithm algorithm)",
"constructor": false,
"full_signature": "static Verification init(Algorithm algorithm)",
"identifier": "init",
"modifiers": "static",
"parameters": "(Algorithm algorithm)",
"return": "Verification",
"signature": "Verification init(Algorithm algorithm)",
"testcase": false
},
{
"class_method_signature": "JWTVerifier.isNullOrEmpty(String[] args)",
"constructor": false,
"full_signature": "private static boolean isNullOrEmpty(String[] args)",
"identifier": "isNullOrEmpty",
"modifiers": "private static",
"parameters": "(String[] args)",
"return": "boolean",
"signature": "boolean isNullOrEmpty(String[] args)",
"testcase": false
},
{
"class_method_signature": "JWTVerifier.verify(String token)",
"constructor": false,
"full_signature": "@Override public DecodedJWT verify(String token)",
"identifier": "verify",
"modifiers": "@Override public",
"parameters": "(String token)",
"return": "DecodedJWT",
"signature": "DecodedJWT verify(String token)",
"testcase": false
},
{
"class_method_signature": "JWTVerifier.verify(DecodedJWT jwt)",
"constructor": false,
"full_signature": "@Override public DecodedJWT verify(DecodedJWT jwt)",
"identifier": "verify",
"modifiers": "@Override public",
"parameters": "(DecodedJWT jwt)",
"return": "DecodedJWT",
"signature": "DecodedJWT verify(DecodedJWT jwt)",
"testcase": false
},
{
"class_method_signature": "JWTVerifier.verifyAlgorithm(DecodedJWT jwt, Algorithm expectedAlgorithm)",
"constructor": false,
"full_signature": "private void verifyAlgorithm(DecodedJWT jwt, Algorithm expectedAlgorithm)",
"identifier": "verifyAlgorithm",
"modifiers": "private",
"parameters": "(DecodedJWT jwt, Algorithm expectedAlgorithm)",
"return": "void",
"signature": "void verifyAlgorithm(DecodedJWT jwt, Algorithm expectedAlgorithm)",
"testcase": false
},
{
"class_method_signature": "JWTVerifier.verifyClaims(DecodedJWT jwt, Map<String, Object> claims)",
"constructor": false,
"full_signature": "private void verifyClaims(DecodedJWT jwt, Map<String, Object> claims)",
"identifier": "verifyClaims",
"modifiers": "private",
"parameters": "(DecodedJWT jwt, Map<String, Object> claims)",
"return": "void",
"signature": "void verifyClaims(DecodedJWT jwt, Map<String, Object> claims)",
"testcase": false
},
{
"class_method_signature": "JWTVerifier.verifyClaimValues(DecodedJWT jwt, Map.Entry<String, Object> entry)",
"constructor": false,
"full_signature": "private void verifyClaimValues(DecodedJWT jwt, Map.Entry<String, Object> entry)",
"identifier": "verifyClaimValues",
"modifiers": "private",
"parameters": "(DecodedJWT jwt, Map.Entry<String, Object> entry)",
"return": "void",
"signature": "void verifyClaimValues(DecodedJWT jwt, Map.Entry<String, Object> entry)",
"testcase": false
},
{
"class_method_signature": "JWTVerifier.assertClaimPresent(Claim claim, String claimName)",
"constructor": false,
"full_signature": "private void assertClaimPresent(Claim claim, String claimName)",
"identifier": "assertClaimPresent",
"modifiers": "private",
"parameters": "(Claim claim, String claimName)",
"return": "void",
"signature": "void assertClaimPresent(Claim claim, String claimName)",
"testcase": false
},
{
"class_method_signature": "JWTVerifier.assertValidClaim(Claim claim, String claimName, Object value)",
"constructor": false,
"full_signature": "private void assertValidClaim(Claim claim, String claimName, Object value)",
"identifier": "assertValidClaim",
"modifiers": "private",
"parameters": "(Claim claim, String claimName, Object value)",
"return": "void",
"signature": "void assertValidClaim(Claim claim, String claimName, Object value)",
"testcase": false
},
{
"class_method_signature": "JWTVerifier.assertValidStringClaim(String claimName, String value, String expectedValue)",
"constructor": false,
"full_signature": "private void assertValidStringClaim(String claimName, String value, String expectedValue)",
"identifier": "assertValidStringClaim",
"modifiers": "private",
"parameters": "(String claimName, String value, String expectedValue)",
"return": "void",
"signature": "void assertValidStringClaim(String claimName, String value, String expectedValue)",
"testcase": false
},
{
"class_method_signature": "JWTVerifier.assertValidDateClaim(Date date, long leeway, boolean shouldBeFuture)",
"constructor": false,
"full_signature": "private void assertValidDateClaim(Date date, long leeway, boolean shouldBeFuture)",
"identifier": "assertValidDateClaim",
"modifiers": "private",
"parameters": "(Date date, long leeway, boolean shouldBeFuture)",
"return": "void",
"signature": "void assertValidDateClaim(Date date, long leeway, boolean shouldBeFuture)",
"testcase": false
},
{
"class_method_signature": "JWTVerifier.assertDateIsFuture(Date date, long leeway, Date today)",
"constructor": false,
"full_signature": "private void assertDateIsFuture(Date date, long leeway, Date today)",
"identifier": "assertDateIsFuture",
"modifiers": "private",
"parameters": "(Date date, long leeway, Date today)",
"return": "void",
"signature": "void assertDateIsFuture(Date date, long leeway, Date today)",
"testcase": false
},
{
"class_method_signature": "JWTVerifier.assertDateIsPast(Date date, long leeway, Date today)",
"constructor": false,
"full_signature": "private void assertDateIsPast(Date date, long leeway, Date today)",
"identifier": "assertDateIsPast",
"modifiers": "private",
"parameters": "(Date date, long leeway, Date today)",
"return": "void",
"signature": "void assertDateIsPast(Date date, long leeway, Date today)",
"testcase": false
},
{
"class_method_signature": "JWTVerifier.assertValidAudienceClaim(List<String> audience, List<String> value)",
"constructor": false,
"full_signature": "private void assertValidAudienceClaim(List<String> audience, List<String> value)",
"identifier": "assertValidAudienceClaim",
"modifiers": "private",
"parameters": "(List<String> audience, List<String> value)",
"return": "void",
"signature": "void assertValidAudienceClaim(List<String> audience, List<String> value)",
"testcase": false
},
{
"class_method_signature": "JWTVerifier.assertValidIssuerClaim(String issuer, List<String> value)",
"constructor": false,
"full_signature": "private void assertValidIssuerClaim(String issuer, List<String> value)",
"identifier": "assertValidIssuerClaim",
"modifiers": "private",
"parameters": "(String issuer, List<String> value)",
"return": "void",
"signature": "void assertValidIssuerClaim(String issuer, List<String> value)",
"testcase": false
}
],
"superclass": ""
} | {
"body": "static Verification init(Algorithm algorithm) throws IllegalArgumentException {\n return new BaseVerification(algorithm);\n }",
"class_method_signature": "JWTVerifier.init(Algorithm algorithm)",
"constructor": false,
"full_signature": "static Verification init(Algorithm algorithm)",
"identifier": "init",
"invocations": [],
"modifiers": "static",
"parameters": "(Algorithm algorithm)",
"return": "Verification",
"signature": "Verification init(Algorithm algorithm)",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 691,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 17517521,
"size": 936,
"stargazer_count": 3678,
"stars": null,
"updates": null,
"url": "https://github.com/auth0/java-jwt"
} |
17517521_128 | {
"fields": [
{
"declarator": "exception = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException exception = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "exception"
},
{
"declarator": "HS256Header = \"eyJhbGciOiJIUzI1NiJ9\"",
"modifier": "private static final",
"original_string": "private static final String HS256Header = \"eyJhbGciOiJIUzI1NiJ9\";",
"type": "String",
"var_name": "HS256Header"
},
{
"declarator": "HS384Header = \"eyJhbGciOiJIUzM4NCJ9\"",
"modifier": "private static final",
"original_string": "private static final String HS384Header = \"eyJhbGciOiJIUzM4NCJ9\";",
"type": "String",
"var_name": "HS384Header"
},
{
"declarator": "HS512Header = \"eyJhbGciOiJIUzUxMiJ9\"",
"modifier": "private static final",
"original_string": "private static final String HS512Header = \"eyJhbGciOiJIUzUxMiJ9\";",
"type": "String",
"var_name": "HS512Header"
},
{
"declarator": "auth0IssPayload = \"eyJpc3MiOiJhdXRoMCJ9\"",
"modifier": "private static final",
"original_string": "private static final String auth0IssPayload = \"eyJpc3MiOiJhdXRoMCJ9\";",
"type": "String",
"var_name": "auth0IssPayload"
}
],
"file": "lib/src/test/java/com/auth0/jwt/algorithms/HMACAlgorithmTest.java",
"identifier": "HMACAlgorithmTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void shouldDoHMAC512SigningWithBytes() throws Exception {\n Algorithm algorithm = Algorithm.HMAC512(\"secret\".getBytes(StandardCharsets.UTF_8));\n\n String jwt = asJWT(algorithm, HS512Header, auth0IssPayload);\n String expectedSignature = \"OXWyxmf-VcVo8viOiTFfLaEy6mrQqLEos5R82Xsx8mtFxQadJAQ1aVniIWN8qT2GNE_pMQPcdzk4x7Cqxsp1dw\";\n\n assertSignaturePresent(jwt);\n assertSignatureValue(jwt, expectedSignature);\n algorithm.verify(JWT.decode(jwt));\n }",
"class_method_signature": "HMACAlgorithmTest.shouldDoHMAC512SigningWithBytes()",
"constructor": false,
"full_signature": "@Test public void shouldDoHMAC512SigningWithBytes()",
"identifier": "shouldDoHMAC512SigningWithBytes",
"invocations": [
"HMAC512",
"getBytes",
"asJWT",
"assertSignaturePresent",
"assertSignatureValue",
"verify",
"decode"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void shouldDoHMAC512SigningWithBytes()",
"testcase": true
} | {
"fields": [
{
"declarator": "crypto",
"modifier": "private final",
"original_string": "private final CryptoHelper crypto;",
"type": "CryptoHelper",
"var_name": "crypto"
},
{
"declarator": "secret",
"modifier": "private final",
"original_string": "private final byte[] secret;",
"type": "byte[]",
"var_name": "secret"
}
],
"file": "lib/src/main/java/com/auth0/jwt/algorithms/HMACAlgorithm.java",
"identifier": "HMACAlgorithm",
"interfaces": "",
"methods": [
{
"class_method_signature": "HMACAlgorithm.HMACAlgorithm(CryptoHelper crypto, String id, String algorithm, byte[] secretBytes)",
"constructor": true,
"full_signature": " HMACAlgorithm(CryptoHelper crypto, String id, String algorithm, byte[] secretBytes)",
"identifier": "HMACAlgorithm",
"modifiers": "",
"parameters": "(CryptoHelper crypto, String id, String algorithm, byte[] secretBytes)",
"return": "",
"signature": " HMACAlgorithm(CryptoHelper crypto, String id, String algorithm, byte[] secretBytes)",
"testcase": false
},
{
"class_method_signature": "HMACAlgorithm.HMACAlgorithm(String id, String algorithm, byte[] secretBytes)",
"constructor": true,
"full_signature": " HMACAlgorithm(String id, String algorithm, byte[] secretBytes)",
"identifier": "HMACAlgorithm",
"modifiers": "",
"parameters": "(String id, String algorithm, byte[] secretBytes)",
"return": "",
"signature": " HMACAlgorithm(String id, String algorithm, byte[] secretBytes)",
"testcase": false
},
{
"class_method_signature": "HMACAlgorithm.HMACAlgorithm(String id, String algorithm, String secret)",
"constructor": true,
"full_signature": " HMACAlgorithm(String id, String algorithm, String secret)",
"identifier": "HMACAlgorithm",
"modifiers": "",
"parameters": "(String id, String algorithm, String secret)",
"return": "",
"signature": " HMACAlgorithm(String id, String algorithm, String secret)",
"testcase": false
},
{
"class_method_signature": "HMACAlgorithm.getSecretBytes(String secret)",
"constructor": false,
"full_signature": "static byte[] getSecretBytes(String secret)",
"identifier": "getSecretBytes",
"modifiers": "static",
"parameters": "(String secret)",
"return": "byte[]",
"signature": "byte[] getSecretBytes(String secret)",
"testcase": false
},
{
"class_method_signature": "HMACAlgorithm.verify(DecodedJWT jwt)",
"constructor": false,
"full_signature": "@Override public void verify(DecodedJWT jwt)",
"identifier": "verify",
"modifiers": "@Override public",
"parameters": "(DecodedJWT jwt)",
"return": "void",
"signature": "void verify(DecodedJWT jwt)",
"testcase": false
},
{
"class_method_signature": "HMACAlgorithm.sign(byte[] headerBytes, byte[] payloadBytes)",
"constructor": false,
"full_signature": "@Override public byte[] sign(byte[] headerBytes, byte[] payloadBytes)",
"identifier": "sign",
"modifiers": "@Override public",
"parameters": "(byte[] headerBytes, byte[] payloadBytes)",
"return": "byte[]",
"signature": "byte[] sign(byte[] headerBytes, byte[] payloadBytes)",
"testcase": false
},
{
"class_method_signature": "HMACAlgorithm.sign(byte[] contentBytes)",
"constructor": false,
"full_signature": "@Override @Deprecated public byte[] sign(byte[] contentBytes)",
"identifier": "sign",
"modifiers": "@Override @Deprecated public",
"parameters": "(byte[] contentBytes)",
"return": "byte[]",
"signature": "byte[] sign(byte[] contentBytes)",
"testcase": false
}
],
"superclass": "extends Algorithm"
} | {
"body": "@Override\n public void verify(DecodedJWT jwt) throws SignatureVerificationException {\n byte[] signatureBytes = Base64.decodeBase64(jwt.getSignature());\n\n try {\n boolean valid = crypto.verifySignatureFor(getDescription(), secret, jwt.getHeader(), jwt.getPayload(), signatureBytes);\n if (!valid) {\n throw new SignatureVerificationException(this);\n }\n } catch (IllegalStateException | InvalidKeyException | NoSuchAlgorithmException e) {\n throw new SignatureVerificationException(this, e);\n }\n }",
"class_method_signature": "HMACAlgorithm.verify(DecodedJWT jwt)",
"constructor": false,
"full_signature": "@Override public void verify(DecodedJWT jwt)",
"identifier": "verify",
"invocations": [
"decodeBase64",
"getSignature",
"verifySignatureFor",
"getDescription",
"getHeader",
"getPayload"
],
"modifiers": "@Override public",
"parameters": "(DecodedJWT jwt)",
"return": "void",
"signature": "void verify(DecodedJWT jwt)",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 691,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 17517521,
"size": 936,
"stargazer_count": 3678,
"stars": null,
"updates": null,
"url": "https://github.com/auth0/java-jwt"
} |
17517521_256 | {
"fields": [
{
"declarator": "exception = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException exception = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "exception"
},
{
"declarator": "payload",
"modifier": "private",
"original_string": "private PayloadImpl payload;",
"type": "PayloadImpl",
"var_name": "payload"
},
{
"declarator": "expiresAt",
"modifier": "private",
"original_string": "private Date expiresAt;",
"type": "Date",
"var_name": "expiresAt"
},
{
"declarator": "notBefore",
"modifier": "private",
"original_string": "private Date notBefore;",
"type": "Date",
"var_name": "notBefore"
},
{
"declarator": "issuedAt",
"modifier": "private",
"original_string": "private Date issuedAt;",
"type": "Date",
"var_name": "issuedAt"
},
{
"declarator": "mapper",
"modifier": "private",
"original_string": "private ObjectMapper mapper;",
"type": "ObjectMapper",
"var_name": "mapper"
},
{
"declarator": "objectReader",
"modifier": "private",
"original_string": "private ObjectReader objectReader;",
"type": "ObjectReader",
"var_name": "objectReader"
}
],
"file": "lib/src/test/java/com/auth0/jwt/impl/PayloadImplTest.java",
"identifier": "PayloadImplTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void shouldGetNullJWTIdIfMissing() throws Exception {\n PayloadImpl payload = new PayloadImpl(null, null, null, null, null, null, null, null, objectReader);\n assertThat(payload, is(notNullValue()));\n assertThat(payload.getId(), is(nullValue()));\n }",
"class_method_signature": "PayloadImplTest.shouldGetNullJWTIdIfMissing()",
"constructor": false,
"full_signature": "@Test public void shouldGetNullJWTIdIfMissing()",
"identifier": "shouldGetNullJWTIdIfMissing",
"invocations": [
"assertThat",
"is",
"notNullValue",
"assertThat",
"getId",
"is",
"nullValue"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void shouldGetNullJWTIdIfMissing()",
"testcase": true
} | {
"fields": [
{
"declarator": "serialVersionUID = 1659021498824562311L",
"modifier": "private static final",
"original_string": "private static final long serialVersionUID = 1659021498824562311L;",
"type": "long",
"var_name": "serialVersionUID"
},
{
"declarator": "issuer",
"modifier": "private final",
"original_string": "private final String issuer;",
"type": "String",
"var_name": "issuer"
},
{
"declarator": "subject",
"modifier": "private final",
"original_string": "private final String subject;",
"type": "String",
"var_name": "subject"
},
{
"declarator": "audience",
"modifier": "private final",
"original_string": "private final List<String> audience;",
"type": "List<String>",
"var_name": "audience"
},
{
"declarator": "expiresAt",
"modifier": "private final",
"original_string": "private final Date expiresAt;",
"type": "Date",
"var_name": "expiresAt"
},
{
"declarator": "notBefore",
"modifier": "private final",
"original_string": "private final Date notBefore;",
"type": "Date",
"var_name": "notBefore"
},
{
"declarator": "issuedAt",
"modifier": "private final",
"original_string": "private final Date issuedAt;",
"type": "Date",
"var_name": "issuedAt"
},
{
"declarator": "jwtId",
"modifier": "private final",
"original_string": "private final String jwtId;",
"type": "String",
"var_name": "jwtId"
},
{
"declarator": "tree",
"modifier": "private final",
"original_string": "private final Map<String, JsonNode> tree;",
"type": "Map<String, JsonNode>",
"var_name": "tree"
},
{
"declarator": "objectReader",
"modifier": "private final",
"original_string": "private final ObjectReader objectReader;",
"type": "ObjectReader",
"var_name": "objectReader"
}
],
"file": "lib/src/main/java/com/auth0/jwt/impl/PayloadImpl.java",
"identifier": "PayloadImpl",
"interfaces": "implements Payload, Serializable",
"methods": [
{
"class_method_signature": "PayloadImpl.PayloadImpl(String issuer, String subject, List<String> audience, Date expiresAt, Date notBefore, Date issuedAt, String jwtId, Map<String, JsonNode> tree, ObjectReader objectReader)",
"constructor": true,
"full_signature": " PayloadImpl(String issuer, String subject, List<String> audience, Date expiresAt, Date notBefore, Date issuedAt, String jwtId, Map<String, JsonNode> tree, ObjectReader objectReader)",
"identifier": "PayloadImpl",
"modifiers": "",
"parameters": "(String issuer, String subject, List<String> audience, Date expiresAt, Date notBefore, Date issuedAt, String jwtId, Map<String, JsonNode> tree, ObjectReader objectReader)",
"return": "",
"signature": " PayloadImpl(String issuer, String subject, List<String> audience, Date expiresAt, Date notBefore, Date issuedAt, String jwtId, Map<String, JsonNode> tree, ObjectReader objectReader)",
"testcase": false
},
{
"class_method_signature": "PayloadImpl.getTree()",
"constructor": false,
"full_signature": " Map<String, JsonNode> getTree()",
"identifier": "getTree",
"modifiers": "",
"parameters": "()",
"return": "Map<String, JsonNode>",
"signature": "Map<String, JsonNode> getTree()",
"testcase": false
},
{
"class_method_signature": "PayloadImpl.getIssuer()",
"constructor": false,
"full_signature": "@Override public String getIssuer()",
"identifier": "getIssuer",
"modifiers": "@Override public",
"parameters": "()",
"return": "String",
"signature": "String getIssuer()",
"testcase": false
},
{
"class_method_signature": "PayloadImpl.getSubject()",
"constructor": false,
"full_signature": "@Override public String getSubject()",
"identifier": "getSubject",
"modifiers": "@Override public",
"parameters": "()",
"return": "String",
"signature": "String getSubject()",
"testcase": false
},
{
"class_method_signature": "PayloadImpl.getAudience()",
"constructor": false,
"full_signature": "@Override public List<String> getAudience()",
"identifier": "getAudience",
"modifiers": "@Override public",
"parameters": "()",
"return": "List<String>",
"signature": "List<String> getAudience()",
"testcase": false
},
{
"class_method_signature": "PayloadImpl.getExpiresAt()",
"constructor": false,
"full_signature": "@Override public Date getExpiresAt()",
"identifier": "getExpiresAt",
"modifiers": "@Override public",
"parameters": "()",
"return": "Date",
"signature": "Date getExpiresAt()",
"testcase": false
},
{
"class_method_signature": "PayloadImpl.getNotBefore()",
"constructor": false,
"full_signature": "@Override public Date getNotBefore()",
"identifier": "getNotBefore",
"modifiers": "@Override public",
"parameters": "()",
"return": "Date",
"signature": "Date getNotBefore()",
"testcase": false
},
{
"class_method_signature": "PayloadImpl.getIssuedAt()",
"constructor": false,
"full_signature": "@Override public Date getIssuedAt()",
"identifier": "getIssuedAt",
"modifiers": "@Override public",
"parameters": "()",
"return": "Date",
"signature": "Date getIssuedAt()",
"testcase": false
},
{
"class_method_signature": "PayloadImpl.getId()",
"constructor": false,
"full_signature": "@Override public String getId()",
"identifier": "getId",
"modifiers": "@Override public",
"parameters": "()",
"return": "String",
"signature": "String getId()",
"testcase": false
},
{
"class_method_signature": "PayloadImpl.getClaim(String name)",
"constructor": false,
"full_signature": "@Override public Claim getClaim(String name)",
"identifier": "getClaim",
"modifiers": "@Override public",
"parameters": "(String name)",
"return": "Claim",
"signature": "Claim getClaim(String name)",
"testcase": false
},
{
"class_method_signature": "PayloadImpl.getClaims()",
"constructor": false,
"full_signature": "@Override public Map<String, Claim> getClaims()",
"identifier": "getClaims",
"modifiers": "@Override public",
"parameters": "()",
"return": "Map<String, Claim>",
"signature": "Map<String, Claim> getClaims()",
"testcase": false
}
],
"superclass": ""
} | {
"body": "@Override\n public String getId() {\n return jwtId;\n }",
"class_method_signature": "PayloadImpl.getId()",
"constructor": false,
"full_signature": "@Override public String getId()",
"identifier": "getId",
"invocations": [],
"modifiers": "@Override public",
"parameters": "()",
"return": "String",
"signature": "String getId()",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 691,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 17517521,
"size": 936,
"stargazer_count": 3678,
"stars": null,
"updates": null,
"url": "https://github.com/auth0/java-jwt"
} |
17517521_313 | {
"fields": [
{
"declarator": "claim",
"modifier": "private",
"original_string": "private NullClaim claim;",
"type": "NullClaim",
"var_name": "claim"
}
],
"file": "lib/src/test/java/com/auth0/jwt/impl/NullClaimTest.java",
"identifier": "NullClaimTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void shouldGetAsCustomClass() throws Exception {\n assertThat(claim.as(Object.class), is(nullValue()));\n }",
"class_method_signature": "NullClaimTest.shouldGetAsCustomClass()",
"constructor": false,
"full_signature": "@Test public void shouldGetAsCustomClass()",
"identifier": "shouldGetAsCustomClass",
"invocations": [
"assertThat",
"as",
"is",
"nullValue"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void shouldGetAsCustomClass()",
"testcase": true
} | {
"fields": [],
"file": "lib/src/main/java/com/auth0/jwt/impl/NullClaim.java",
"identifier": "NullClaim",
"interfaces": "implements Claim",
"methods": [
{
"class_method_signature": "NullClaim.isNull()",
"constructor": false,
"full_signature": "@Override public boolean isNull()",
"identifier": "isNull",
"modifiers": "@Override public",
"parameters": "()",
"return": "boolean",
"signature": "boolean isNull()",
"testcase": false
},
{
"class_method_signature": "NullClaim.asBoolean()",
"constructor": false,
"full_signature": "@Override public Boolean asBoolean()",
"identifier": "asBoolean",
"modifiers": "@Override public",
"parameters": "()",
"return": "Boolean",
"signature": "Boolean asBoolean()",
"testcase": false
},
{
"class_method_signature": "NullClaim.asInt()",
"constructor": false,
"full_signature": "@Override public Integer asInt()",
"identifier": "asInt",
"modifiers": "@Override public",
"parameters": "()",
"return": "Integer",
"signature": "Integer asInt()",
"testcase": false
},
{
"class_method_signature": "NullClaim.asLong()",
"constructor": false,
"full_signature": "@Override public Long asLong()",
"identifier": "asLong",
"modifiers": "@Override public",
"parameters": "()",
"return": "Long",
"signature": "Long asLong()",
"testcase": false
},
{
"class_method_signature": "NullClaim.asDouble()",
"constructor": false,
"full_signature": "@Override public Double asDouble()",
"identifier": "asDouble",
"modifiers": "@Override public",
"parameters": "()",
"return": "Double",
"signature": "Double asDouble()",
"testcase": false
},
{
"class_method_signature": "NullClaim.asString()",
"constructor": false,
"full_signature": "@Override public String asString()",
"identifier": "asString",
"modifiers": "@Override public",
"parameters": "()",
"return": "String",
"signature": "String asString()",
"testcase": false
},
{
"class_method_signature": "NullClaim.asDate()",
"constructor": false,
"full_signature": "@Override public Date asDate()",
"identifier": "asDate",
"modifiers": "@Override public",
"parameters": "()",
"return": "Date",
"signature": "Date asDate()",
"testcase": false
},
{
"class_method_signature": "NullClaim.asArray(Class<T> tClazz)",
"constructor": false,
"full_signature": "@Override public T[] asArray(Class<T> tClazz)",
"identifier": "asArray",
"modifiers": "@Override public",
"parameters": "(Class<T> tClazz)",
"return": "T[]",
"signature": "T[] asArray(Class<T> tClazz)",
"testcase": false
},
{
"class_method_signature": "NullClaim.asList(Class<T> tClazz)",
"constructor": false,
"full_signature": "@Override public List<T> asList(Class<T> tClazz)",
"identifier": "asList",
"modifiers": "@Override public",
"parameters": "(Class<T> tClazz)",
"return": "List<T>",
"signature": "List<T> asList(Class<T> tClazz)",
"testcase": false
},
{
"class_method_signature": "NullClaim.asMap()",
"constructor": false,
"full_signature": "@Override public Map<String, Object> asMap()",
"identifier": "asMap",
"modifiers": "@Override public",
"parameters": "()",
"return": "Map<String, Object>",
"signature": "Map<String, Object> asMap()",
"testcase": false
},
{
"class_method_signature": "NullClaim.as(Class<T> tClazz)",
"constructor": false,
"full_signature": "@Override public T as(Class<T> tClazz)",
"identifier": "as",
"modifiers": "@Override public",
"parameters": "(Class<T> tClazz)",
"return": "T",
"signature": "T as(Class<T> tClazz)",
"testcase": false
}
],
"superclass": ""
} | {
"body": "@Override\n public <T> T as(Class<T> tClazz) throws JWTDecodeException {\n return null;\n }",
"class_method_signature": "NullClaim.as(Class<T> tClazz)",
"constructor": false,
"full_signature": "@Override public T as(Class<T> tClazz)",
"identifier": "as",
"invocations": [],
"modifiers": "@Override public",
"parameters": "(Class<T> tClazz)",
"return": "T",
"signature": "T as(Class<T> tClazz)",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 691,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 17517521,
"size": 936,
"stargazer_count": 3678,
"stars": null,
"updates": null,
"url": "https://github.com/auth0/java-jwt"
} |
17517521_17 | {
"fields": [
{
"declarator": "exception = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException exception = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "exception"
}
],
"file": "lib/src/test/java/com/auth0/jwt/JWTDecoderTest.java",
"identifier": "JWTDecoderTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void shouldGetValidClaim() throws Exception {\n DecodedJWT jwt = JWT.decode(\"eyJhbGciOiJIUzI1NiJ9.eyJvYmplY3QiOnsibmFtZSI6ImpvaG4ifX0.lrU1gZlOdlmTTeZwq0VI-pZx2iV46UWYd5-lCjy6-c4\");\n assertThat(jwt, is(notNullValue()));\n assertThat(jwt.getClaim(\"object\"), is(notNullValue()));\n assertThat(jwt.getClaim(\"object\"), is(instanceOf(Claim.class)));\n }",
"class_method_signature": "JWTDecoderTest.shouldGetValidClaim()",
"constructor": false,
"full_signature": "@Test public void shouldGetValidClaim()",
"identifier": "shouldGetValidClaim",
"invocations": [
"decode",
"assertThat",
"is",
"notNullValue",
"assertThat",
"getClaim",
"is",
"notNullValue",
"assertThat",
"getClaim",
"is",
"instanceOf"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void shouldGetValidClaim()",
"testcase": true
} | {
"fields": [
{
"declarator": "serialVersionUID = 1873362438023312895L",
"modifier": "private static final",
"original_string": "private static final long serialVersionUID = 1873362438023312895L;",
"type": "long",
"var_name": "serialVersionUID"
},
{
"declarator": "parts",
"modifier": "private final",
"original_string": "private final String[] parts;",
"type": "String[]",
"var_name": "parts"
},
{
"declarator": "header",
"modifier": "private final",
"original_string": "private final Header header;",
"type": "Header",
"var_name": "header"
},
{
"declarator": "payload",
"modifier": "private final",
"original_string": "private final Payload payload;",
"type": "Payload",
"var_name": "payload"
}
],
"file": "lib/src/main/java/com/auth0/jwt/JWTDecoder.java",
"identifier": "JWTDecoder",
"interfaces": "implements DecodedJWT, Serializable",
"methods": [
{
"class_method_signature": "JWTDecoder.JWTDecoder(String jwt)",
"constructor": true,
"full_signature": " JWTDecoder(String jwt)",
"identifier": "JWTDecoder",
"modifiers": "",
"parameters": "(String jwt)",
"return": "",
"signature": " JWTDecoder(String jwt)",
"testcase": false
},
{
"class_method_signature": "JWTDecoder.JWTDecoder(JWTParser converter, String jwt)",
"constructor": true,
"full_signature": " JWTDecoder(JWTParser converter, String jwt)",
"identifier": "JWTDecoder",
"modifiers": "",
"parameters": "(JWTParser converter, String jwt)",
"return": "",
"signature": " JWTDecoder(JWTParser converter, String jwt)",
"testcase": false
},
{
"class_method_signature": "JWTDecoder.getAlgorithm()",
"constructor": false,
"full_signature": "@Override public String getAlgorithm()",
"identifier": "getAlgorithm",
"modifiers": "@Override public",
"parameters": "()",
"return": "String",
"signature": "String getAlgorithm()",
"testcase": false
},
{
"class_method_signature": "JWTDecoder.getType()",
"constructor": false,
"full_signature": "@Override public String getType()",
"identifier": "getType",
"modifiers": "@Override public",
"parameters": "()",
"return": "String",
"signature": "String getType()",
"testcase": false
},
{
"class_method_signature": "JWTDecoder.getContentType()",
"constructor": false,
"full_signature": "@Override public String getContentType()",
"identifier": "getContentType",
"modifiers": "@Override public",
"parameters": "()",
"return": "String",
"signature": "String getContentType()",
"testcase": false
},
{
"class_method_signature": "JWTDecoder.getKeyId()",
"constructor": false,
"full_signature": "@Override public String getKeyId()",
"identifier": "getKeyId",
"modifiers": "@Override public",
"parameters": "()",
"return": "String",
"signature": "String getKeyId()",
"testcase": false
},
{
"class_method_signature": "JWTDecoder.getHeaderClaim(String name)",
"constructor": false,
"full_signature": "@Override public Claim getHeaderClaim(String name)",
"identifier": "getHeaderClaim",
"modifiers": "@Override public",
"parameters": "(String name)",
"return": "Claim",
"signature": "Claim getHeaderClaim(String name)",
"testcase": false
},
{
"class_method_signature": "JWTDecoder.getIssuer()",
"constructor": false,
"full_signature": "@Override public String getIssuer()",
"identifier": "getIssuer",
"modifiers": "@Override public",
"parameters": "()",
"return": "String",
"signature": "String getIssuer()",
"testcase": false
},
{
"class_method_signature": "JWTDecoder.getSubject()",
"constructor": false,
"full_signature": "@Override public String getSubject()",
"identifier": "getSubject",
"modifiers": "@Override public",
"parameters": "()",
"return": "String",
"signature": "String getSubject()",
"testcase": false
},
{
"class_method_signature": "JWTDecoder.getAudience()",
"constructor": false,
"full_signature": "@Override public List<String> getAudience()",
"identifier": "getAudience",
"modifiers": "@Override public",
"parameters": "()",
"return": "List<String>",
"signature": "List<String> getAudience()",
"testcase": false
},
{
"class_method_signature": "JWTDecoder.getExpiresAt()",
"constructor": false,
"full_signature": "@Override public Date getExpiresAt()",
"identifier": "getExpiresAt",
"modifiers": "@Override public",
"parameters": "()",
"return": "Date",
"signature": "Date getExpiresAt()",
"testcase": false
},
{
"class_method_signature": "JWTDecoder.getNotBefore()",
"constructor": false,
"full_signature": "@Override public Date getNotBefore()",
"identifier": "getNotBefore",
"modifiers": "@Override public",
"parameters": "()",
"return": "Date",
"signature": "Date getNotBefore()",
"testcase": false
},
{
"class_method_signature": "JWTDecoder.getIssuedAt()",
"constructor": false,
"full_signature": "@Override public Date getIssuedAt()",
"identifier": "getIssuedAt",
"modifiers": "@Override public",
"parameters": "()",
"return": "Date",
"signature": "Date getIssuedAt()",
"testcase": false
},
{
"class_method_signature": "JWTDecoder.getId()",
"constructor": false,
"full_signature": "@Override public String getId()",
"identifier": "getId",
"modifiers": "@Override public",
"parameters": "()",
"return": "String",
"signature": "String getId()",
"testcase": false
},
{
"class_method_signature": "JWTDecoder.getClaim(String name)",
"constructor": false,
"full_signature": "@Override public Claim getClaim(String name)",
"identifier": "getClaim",
"modifiers": "@Override public",
"parameters": "(String name)",
"return": "Claim",
"signature": "Claim getClaim(String name)",
"testcase": false
},
{
"class_method_signature": "JWTDecoder.getClaims()",
"constructor": false,
"full_signature": "@Override public Map<String, Claim> getClaims()",
"identifier": "getClaims",
"modifiers": "@Override public",
"parameters": "()",
"return": "Map<String, Claim>",
"signature": "Map<String, Claim> getClaims()",
"testcase": false
},
{
"class_method_signature": "JWTDecoder.getHeader()",
"constructor": false,
"full_signature": "@Override public String getHeader()",
"identifier": "getHeader",
"modifiers": "@Override public",
"parameters": "()",
"return": "String",
"signature": "String getHeader()",
"testcase": false
},
{
"class_method_signature": "JWTDecoder.getPayload()",
"constructor": false,
"full_signature": "@Override public String getPayload()",
"identifier": "getPayload",
"modifiers": "@Override public",
"parameters": "()",
"return": "String",
"signature": "String getPayload()",
"testcase": false
},
{
"class_method_signature": "JWTDecoder.getSignature()",
"constructor": false,
"full_signature": "@Override public String getSignature()",
"identifier": "getSignature",
"modifiers": "@Override public",
"parameters": "()",
"return": "String",
"signature": "String getSignature()",
"testcase": false
},
{
"class_method_signature": "JWTDecoder.getToken()",
"constructor": false,
"full_signature": "@Override public String getToken()",
"identifier": "getToken",
"modifiers": "@Override public",
"parameters": "()",
"return": "String",
"signature": "String getToken()",
"testcase": false
}
],
"superclass": ""
} | {
"body": "@Override\n public Claim getClaim(String name) {\n return payload.getClaim(name);\n }",
"class_method_signature": "JWTDecoder.getClaim(String name)",
"constructor": false,
"full_signature": "@Override public Claim getClaim(String name)",
"identifier": "getClaim",
"invocations": [
"getClaim"
],
"modifiers": "@Override public",
"parameters": "(String name)",
"return": "Claim",
"signature": "Claim getClaim(String name)",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 691,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 17517521,
"size": 936,
"stargazer_count": 3678,
"stars": null,
"updates": null,
"url": "https://github.com/auth0/java-jwt"
} |
17517521_190 | {
"fields": [
{
"declarator": "PRIVATE_KEY_FILE_256 = \"src/test/resources/ec256-key-private.pem\"",
"modifier": "private static final",
"original_string": "private static final String PRIVATE_KEY_FILE_256 = \"src/test/resources/ec256-key-private.pem\";",
"type": "String",
"var_name": "PRIVATE_KEY_FILE_256"
},
{
"declarator": "PUBLIC_KEY_FILE_256 = \"src/test/resources/ec256-key-public.pem\"",
"modifier": "private static final",
"original_string": "private static final String PUBLIC_KEY_FILE_256 = \"src/test/resources/ec256-key-public.pem\";",
"type": "String",
"var_name": "PUBLIC_KEY_FILE_256"
},
{
"declarator": "INVALID_PUBLIC_KEY_FILE_256 = \"src/test/resources/ec256-key-public-invalid.pem\"",
"modifier": "private static final",
"original_string": "private static final String INVALID_PUBLIC_KEY_FILE_256 = \"src/test/resources/ec256-key-public-invalid.pem\";",
"type": "String",
"var_name": "INVALID_PUBLIC_KEY_FILE_256"
},
{
"declarator": "PRIVATE_KEY_FILE_256K = \"src/test/resources/ec256k-key-private.pem\"",
"modifier": "private static final",
"original_string": "private static final String PRIVATE_KEY_FILE_256K = \"src/test/resources/ec256k-key-private.pem\";",
"type": "String",
"var_name": "PRIVATE_KEY_FILE_256K"
},
{
"declarator": "PUBLIC_KEY_FILE_256K = \"src/test/resources/ec256k-key-public.pem\"",
"modifier": "private static final",
"original_string": "private static final String PUBLIC_KEY_FILE_256K = \"src/test/resources/ec256k-key-public.pem\";",
"type": "String",
"var_name": "PUBLIC_KEY_FILE_256K"
},
{
"declarator": "INVALID_PUBLIC_KEY_FILE_256K = \"src/test/resources/ec256k-key-public-invalid.pem\"",
"modifier": "private static final",
"original_string": "private static final String INVALID_PUBLIC_KEY_FILE_256K = \"src/test/resources/ec256k-key-public-invalid.pem\";",
"type": "String",
"var_name": "INVALID_PUBLIC_KEY_FILE_256K"
},
{
"declarator": "ES256K_JWT = \"eyJraWQiOiJteS1rZXktaWQiLCJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NksifQ.e30.2ggPsc4xwQhYcgJueo3uQ14MpaVJ3AbEE8UE-wA9fc8SMibeW54gjZbikL-JBHqhEwc22Cp8DNOtadXsM81RGQ\"",
"modifier": "private static final",
"original_string": "private static final String ES256K_JWT = \"eyJraWQiOiJteS1rZXktaWQiLCJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NksifQ.e30.2ggPsc4xwQhYcgJueo3uQ14MpaVJ3AbEE8UE-wA9fc8SMibeW54gjZbikL-JBHqhEwc22Cp8DNOtadXsM81RGQ\";",
"type": "String",
"var_name": "ES256K_JWT"
},
{
"declarator": "PRIVATE_KEY_FILE_384 = \"src/test/resources/ec384-key-private.pem\"",
"modifier": "private static final",
"original_string": "private static final String PRIVATE_KEY_FILE_384 = \"src/test/resources/ec384-key-private.pem\";",
"type": "String",
"var_name": "PRIVATE_KEY_FILE_384"
},
{
"declarator": "PUBLIC_KEY_FILE_384 = \"src/test/resources/ec384-key-public.pem\"",
"modifier": "private static final",
"original_string": "private static final String PUBLIC_KEY_FILE_384 = \"src/test/resources/ec384-key-public.pem\";",
"type": "String",
"var_name": "PUBLIC_KEY_FILE_384"
},
{
"declarator": "INVALID_PUBLIC_KEY_FILE_384 = \"src/test/resources/ec384-key-public-invalid.pem\"",
"modifier": "private static final",
"original_string": "private static final String INVALID_PUBLIC_KEY_FILE_384 = \"src/test/resources/ec384-key-public-invalid.pem\";",
"type": "String",
"var_name": "INVALID_PUBLIC_KEY_FILE_384"
},
{
"declarator": "PRIVATE_KEY_FILE_512 = \"src/test/resources/ec512-key-private.pem\"",
"modifier": "private static final",
"original_string": "private static final String PRIVATE_KEY_FILE_512 = \"src/test/resources/ec512-key-private.pem\";",
"type": "String",
"var_name": "PRIVATE_KEY_FILE_512"
},
{
"declarator": "PUBLIC_KEY_FILE_512 = \"src/test/resources/ec512-key-public.pem\"",
"modifier": "private static final",
"original_string": "private static final String PUBLIC_KEY_FILE_512 = \"src/test/resources/ec512-key-public.pem\";",
"type": "String",
"var_name": "PUBLIC_KEY_FILE_512"
},
{
"declarator": "INVALID_PUBLIC_KEY_FILE_512 = \"src/test/resources/ec512-key-public-invalid.pem\"",
"modifier": "private static final",
"original_string": "private static final String INVALID_PUBLIC_KEY_FILE_512 = \"src/test/resources/ec512-key-public-invalid.pem\";",
"type": "String",
"var_name": "INVALID_PUBLIC_KEY_FILE_512"
},
{
"declarator": "exception = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException exception = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "exception"
},
{
"declarator": "ES256Header = \"eyJhbGciOiJFUzI1NiJ9\"",
"modifier": "private static final",
"original_string": "private static final String ES256Header = \"eyJhbGciOiJFUzI1NiJ9\";",
"type": "String",
"var_name": "ES256Header"
},
{
"declarator": "ES384Header = \"eyJhbGciOiJFUzM4NCJ9\"",
"modifier": "private static final",
"original_string": "private static final String ES384Header = \"eyJhbGciOiJFUzM4NCJ9\";",
"type": "String",
"var_name": "ES384Header"
},
{
"declarator": "ES512Header = \"eyJhbGciOiJFUzUxMiJ9\"",
"modifier": "private static final",
"original_string": "private static final String ES512Header = \"eyJhbGciOiJFUzUxMiJ9\";",
"type": "String",
"var_name": "ES512Header"
},
{
"declarator": "auth0IssPayload = \"eyJpc3MiOiJhdXRoMCJ9\"",
"modifier": "private static final",
"original_string": "private static final String auth0IssPayload = \"eyJpc3MiOiJhdXRoMCJ9\";",
"type": "String",
"var_name": "auth0IssPayload"
},
{
"declarator": "ES256HeaderBytes = ES256Header.getBytes(StandardCharsets.UTF_8)",
"modifier": "private static final",
"original_string": "private static final byte[] ES256HeaderBytes = ES256Header.getBytes(StandardCharsets.UTF_8);",
"type": "byte[]",
"var_name": "ES256HeaderBytes"
},
{
"declarator": "ES384HeaderBytes = ES384Header.getBytes(StandardCharsets.UTF_8)",
"modifier": "private static final",
"original_string": "private static final byte[] ES384HeaderBytes = ES384Header.getBytes(StandardCharsets.UTF_8);",
"type": "byte[]",
"var_name": "ES384HeaderBytes"
},
{
"declarator": "ES512HeaderBytes = ES512Header.getBytes(StandardCharsets.UTF_8)",
"modifier": "private static final",
"original_string": "private static final byte[] ES512HeaderBytes = ES512Header.getBytes(StandardCharsets.UTF_8);",
"type": "byte[]",
"var_name": "ES512HeaderBytes"
},
{
"declarator": "auth0IssPayloadBytes = auth0IssPayload.getBytes(StandardCharsets.UTF_8)",
"modifier": "private static final",
"original_string": "private static final byte[] auth0IssPayloadBytes = auth0IssPayload.getBytes(StandardCharsets.UTF_8);",
"type": "byte[]",
"var_name": "auth0IssPayloadBytes"
}
],
"file": "lib/src/test/java/com/auth0/jwt/algorithms/ECDSAAlgorithmTest.java",
"identifier": "ECDSAAlgorithmTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void shouldFailOnECDSA512SigningWhenProvidedPrivateKeyIsNull() throws Exception {\n exception.expect(SignatureGenerationException.class);\n exception.expectMessage(\"The Token's Signature couldn't be generated when signing using the Algorithm: SHA512withECDSA\");\n exception.expectCause(isA(IllegalStateException.class));\n exception.expectCause(hasMessage(is(\"The given Private Key is null.\")));\n\n ECDSAKeyProvider provider = mock(ECDSAKeyProvider.class);\n when(provider.getPrivateKey()).thenReturn(null);\n Algorithm algorithm = Algorithm.ECDSA512(provider);\n algorithm.sign(new byte[0], new byte[0]);\n }",
"class_method_signature": "ECDSAAlgorithmTest.shouldFailOnECDSA512SigningWhenProvidedPrivateKeyIsNull()",
"constructor": false,
"full_signature": "@Test public void shouldFailOnECDSA512SigningWhenProvidedPrivateKeyIsNull()",
"identifier": "shouldFailOnECDSA512SigningWhenProvidedPrivateKeyIsNull",
"invocations": [
"expect",
"expectMessage",
"expectCause",
"isA",
"expectCause",
"hasMessage",
"is",
"mock",
"thenReturn",
"when",
"getPrivateKey",
"ECDSA512",
"sign"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void shouldFailOnECDSA512SigningWhenProvidedPrivateKeyIsNull()",
"testcase": true
} | {
"fields": [
{
"declarator": "keyProvider",
"modifier": "private final",
"original_string": "private final ECDSAKeyProvider keyProvider;",
"type": "ECDSAKeyProvider",
"var_name": "keyProvider"
},
{
"declarator": "crypto",
"modifier": "private final",
"original_string": "private final CryptoHelper crypto;",
"type": "CryptoHelper",
"var_name": "crypto"
},
{
"declarator": "ecNumberSize",
"modifier": "private final",
"original_string": "private final int ecNumberSize;",
"type": "int",
"var_name": "ecNumberSize"
}
],
"file": "lib/src/main/java/com/auth0/jwt/algorithms/ECDSAAlgorithm.java",
"identifier": "ECDSAAlgorithm",
"interfaces": "",
"methods": [
{
"class_method_signature": "ECDSAAlgorithm.ECDSAAlgorithm(CryptoHelper crypto, String id, String algorithm, int ecNumberSize, ECDSAKeyProvider keyProvider)",
"constructor": true,
"full_signature": " ECDSAAlgorithm(CryptoHelper crypto, String id, String algorithm, int ecNumberSize, ECDSAKeyProvider keyProvider)",
"identifier": "ECDSAAlgorithm",
"modifiers": "",
"parameters": "(CryptoHelper crypto, String id, String algorithm, int ecNumberSize, ECDSAKeyProvider keyProvider)",
"return": "",
"signature": " ECDSAAlgorithm(CryptoHelper crypto, String id, String algorithm, int ecNumberSize, ECDSAKeyProvider keyProvider)",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.ECDSAAlgorithm(String id, String algorithm, int ecNumberSize, ECDSAKeyProvider keyProvider)",
"constructor": true,
"full_signature": " ECDSAAlgorithm(String id, String algorithm, int ecNumberSize, ECDSAKeyProvider keyProvider)",
"identifier": "ECDSAAlgorithm",
"modifiers": "",
"parameters": "(String id, String algorithm, int ecNumberSize, ECDSAKeyProvider keyProvider)",
"return": "",
"signature": " ECDSAAlgorithm(String id, String algorithm, int ecNumberSize, ECDSAKeyProvider keyProvider)",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.verify(DecodedJWT jwt)",
"constructor": false,
"full_signature": "@Override public void verify(DecodedJWT jwt)",
"identifier": "verify",
"modifiers": "@Override public",
"parameters": "(DecodedJWT jwt)",
"return": "void",
"signature": "void verify(DecodedJWT jwt)",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.sign(byte[] headerBytes, byte[] payloadBytes)",
"constructor": false,
"full_signature": "@Override public byte[] sign(byte[] headerBytes, byte[] payloadBytes)",
"identifier": "sign",
"modifiers": "@Override public",
"parameters": "(byte[] headerBytes, byte[] payloadBytes)",
"return": "byte[]",
"signature": "byte[] sign(byte[] headerBytes, byte[] payloadBytes)",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.sign(byte[] contentBytes)",
"constructor": false,
"full_signature": "@Override @Deprecated public byte[] sign(byte[] contentBytes)",
"identifier": "sign",
"modifiers": "@Override @Deprecated public",
"parameters": "(byte[] contentBytes)",
"return": "byte[]",
"signature": "byte[] sign(byte[] contentBytes)",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.getSigningKeyId()",
"constructor": false,
"full_signature": "@Override public String getSigningKeyId()",
"identifier": "getSigningKeyId",
"modifiers": "@Override public",
"parameters": "()",
"return": "String",
"signature": "String getSigningKeyId()",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.DERToJOSE(byte[] derSignature)",
"constructor": false,
"full_signature": " byte[] DERToJOSE(byte[] derSignature)",
"identifier": "DERToJOSE",
"modifiers": "",
"parameters": "(byte[] derSignature)",
"return": "byte[]",
"signature": "byte[] DERToJOSE(byte[] derSignature)",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.JOSEToDER(byte[] joseSignature)",
"constructor": false,
"full_signature": " byte[] JOSEToDER(byte[] joseSignature)",
"identifier": "JOSEToDER",
"modifiers": "",
"parameters": "(byte[] joseSignature)",
"return": "byte[]",
"signature": "byte[] JOSEToDER(byte[] joseSignature)",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.countPadding(byte[] bytes, int fromIndex, int toIndex)",
"constructor": false,
"full_signature": "private int countPadding(byte[] bytes, int fromIndex, int toIndex)",
"identifier": "countPadding",
"modifiers": "private",
"parameters": "(byte[] bytes, int fromIndex, int toIndex)",
"return": "int",
"signature": "int countPadding(byte[] bytes, int fromIndex, int toIndex)",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.providerForKeys(final ECPublicKey publicKey, final ECPrivateKey privateKey)",
"constructor": false,
"full_signature": "static ECDSAKeyProvider providerForKeys(final ECPublicKey publicKey, final ECPrivateKey privateKey)",
"identifier": "providerForKeys",
"modifiers": "static",
"parameters": "(final ECPublicKey publicKey, final ECPrivateKey privateKey)",
"return": "ECDSAKeyProvider",
"signature": "ECDSAKeyProvider providerForKeys(final ECPublicKey publicKey, final ECPrivateKey privateKey)",
"testcase": false
}
],
"superclass": "extends Algorithm"
} | {
"body": "@Override\n public byte[] sign(byte[] headerBytes, byte[] payloadBytes) throws SignatureGenerationException {\n try {\n ECPrivateKey privateKey = keyProvider.getPrivateKey();\n if (privateKey == null) {\n throw new IllegalStateException(\"The given Private Key is null.\");\n }\n byte[] signature = crypto.createSignatureFor(getDescription(), privateKey, headerBytes, payloadBytes);\n return DERToJOSE(signature);\n } catch (NoSuchAlgorithmException | SignatureException | InvalidKeyException | IllegalStateException e) {\n throw new SignatureGenerationException(this, e);\n }\n }",
"class_method_signature": "ECDSAAlgorithm.sign(byte[] headerBytes, byte[] payloadBytes)",
"constructor": false,
"full_signature": "@Override public byte[] sign(byte[] headerBytes, byte[] payloadBytes)",
"identifier": "sign",
"invocations": [
"getPrivateKey",
"createSignatureFor",
"getDescription",
"DERToJOSE"
],
"modifiers": "@Override public",
"parameters": "(byte[] headerBytes, byte[] payloadBytes)",
"return": "byte[]",
"signature": "byte[] sign(byte[] headerBytes, byte[] payloadBytes)",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 691,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 17517521,
"size": 936,
"stargazer_count": 3678,
"stars": null,
"updates": null,
"url": "https://github.com/auth0/java-jwt"
} |
17517521_240 | {
"fields": [
{
"declarator": "exception = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException exception = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "exception"
},
{
"declarator": "deserializer",
"modifier": "private",
"original_string": "private HeaderDeserializer deserializer;",
"type": "HeaderDeserializer",
"var_name": "deserializer"
},
{
"declarator": "objectReader = new ObjectMapper().reader()",
"modifier": "private",
"original_string": "private ObjectReader objectReader = new ObjectMapper().reader();",
"type": "ObjectReader",
"var_name": "objectReader"
}
],
"file": "lib/src/test/java/com/auth0/jwt/impl/HeaderDeserializerTest.java",
"identifier": "HeaderDeserializerTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void shouldGetStringWhenParsingTextNode() throws Exception {\n Map<String, JsonNode> tree = new HashMap<>();\n TextNode node = new TextNode(\"something here\");\n tree.put(\"key\", node);\n\n String text = deserializer.getString(tree, \"key\");\n assertThat(text, is(notNullValue()));\n assertThat(text, is(\"something here\"));\n }",
"class_method_signature": "HeaderDeserializerTest.shouldGetStringWhenParsingTextNode()",
"constructor": false,
"full_signature": "@Test public void shouldGetStringWhenParsingTextNode()",
"identifier": "shouldGetStringWhenParsingTextNode",
"invocations": [
"put",
"getString",
"assertThat",
"is",
"notNullValue",
"assertThat",
"is"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void shouldGetStringWhenParsingTextNode()",
"testcase": true
} | {
"fields": [
{
"declarator": "objectReader",
"modifier": "private final",
"original_string": "private final ObjectReader objectReader;",
"type": "ObjectReader",
"var_name": "objectReader"
}
],
"file": "lib/src/main/java/com/auth0/jwt/impl/HeaderDeserializer.java",
"identifier": "HeaderDeserializer",
"interfaces": "",
"methods": [
{
"class_method_signature": "HeaderDeserializer.HeaderDeserializer(ObjectReader objectReader)",
"constructor": true,
"full_signature": " HeaderDeserializer(ObjectReader objectReader)",
"identifier": "HeaderDeserializer",
"modifiers": "",
"parameters": "(ObjectReader objectReader)",
"return": "",
"signature": " HeaderDeserializer(ObjectReader objectReader)",
"testcase": false
},
{
"class_method_signature": "HeaderDeserializer.HeaderDeserializer(Class<?> vc, ObjectReader objectReader)",
"constructor": true,
"full_signature": "private HeaderDeserializer(Class<?> vc, ObjectReader objectReader)",
"identifier": "HeaderDeserializer",
"modifiers": "private",
"parameters": "(Class<?> vc, ObjectReader objectReader)",
"return": "",
"signature": " HeaderDeserializer(Class<?> vc, ObjectReader objectReader)",
"testcase": false
},
{
"class_method_signature": "HeaderDeserializer.deserialize(JsonParser p, DeserializationContext ctxt)",
"constructor": false,
"full_signature": "@Override public BasicHeader deserialize(JsonParser p, DeserializationContext ctxt)",
"identifier": "deserialize",
"modifiers": "@Override public",
"parameters": "(JsonParser p, DeserializationContext ctxt)",
"return": "BasicHeader",
"signature": "BasicHeader deserialize(JsonParser p, DeserializationContext ctxt)",
"testcase": false
},
{
"class_method_signature": "HeaderDeserializer.getString(Map<String, JsonNode> tree, String claimName)",
"constructor": false,
"full_signature": " String getString(Map<String, JsonNode> tree, String claimName)",
"identifier": "getString",
"modifiers": "",
"parameters": "(Map<String, JsonNode> tree, String claimName)",
"return": "String",
"signature": "String getString(Map<String, JsonNode> tree, String claimName)",
"testcase": false
}
],
"superclass": "extends StdDeserializer<BasicHeader>"
} | {
"body": "String getString(Map<String, JsonNode> tree, String claimName) {\n JsonNode node = tree.get(claimName);\n if (node == null || node.isNull()) {\n return null;\n }\n return node.asText(null);\n }",
"class_method_signature": "HeaderDeserializer.getString(Map<String, JsonNode> tree, String claimName)",
"constructor": false,
"full_signature": " String getString(Map<String, JsonNode> tree, String claimName)",
"identifier": "getString",
"invocations": [
"get",
"isNull",
"asText"
],
"modifiers": "",
"parameters": "(Map<String, JsonNode> tree, String claimName)",
"return": "String",
"signature": "String getString(Map<String, JsonNode> tree, String claimName)",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 691,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 17517521,
"size": 936,
"stargazer_count": 3678,
"stars": null,
"updates": null,
"url": "https://github.com/auth0/java-jwt"
} |
17517521_305 | {
"fields": [
{
"declarator": "claim",
"modifier": "private",
"original_string": "private NullClaim claim;",
"type": "NullClaim",
"var_name": "claim"
}
],
"file": "lib/src/test/java/com/auth0/jwt/impl/NullClaimTest.java",
"identifier": "NullClaimTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void shouldGetAsInt() throws Exception {\n assertThat(claim.asInt(), is(nullValue()));\n }",
"class_method_signature": "NullClaimTest.shouldGetAsInt()",
"constructor": false,
"full_signature": "@Test public void shouldGetAsInt()",
"identifier": "shouldGetAsInt",
"invocations": [
"assertThat",
"asInt",
"is",
"nullValue"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void shouldGetAsInt()",
"testcase": true
} | {
"fields": [],
"file": "lib/src/main/java/com/auth0/jwt/impl/NullClaim.java",
"identifier": "NullClaim",
"interfaces": "implements Claim",
"methods": [
{
"class_method_signature": "NullClaim.isNull()",
"constructor": false,
"full_signature": "@Override public boolean isNull()",
"identifier": "isNull",
"modifiers": "@Override public",
"parameters": "()",
"return": "boolean",
"signature": "boolean isNull()",
"testcase": false
},
{
"class_method_signature": "NullClaim.asBoolean()",
"constructor": false,
"full_signature": "@Override public Boolean asBoolean()",
"identifier": "asBoolean",
"modifiers": "@Override public",
"parameters": "()",
"return": "Boolean",
"signature": "Boolean asBoolean()",
"testcase": false
},
{
"class_method_signature": "NullClaim.asInt()",
"constructor": false,
"full_signature": "@Override public Integer asInt()",
"identifier": "asInt",
"modifiers": "@Override public",
"parameters": "()",
"return": "Integer",
"signature": "Integer asInt()",
"testcase": false
},
{
"class_method_signature": "NullClaim.asLong()",
"constructor": false,
"full_signature": "@Override public Long asLong()",
"identifier": "asLong",
"modifiers": "@Override public",
"parameters": "()",
"return": "Long",
"signature": "Long asLong()",
"testcase": false
},
{
"class_method_signature": "NullClaim.asDouble()",
"constructor": false,
"full_signature": "@Override public Double asDouble()",
"identifier": "asDouble",
"modifiers": "@Override public",
"parameters": "()",
"return": "Double",
"signature": "Double asDouble()",
"testcase": false
},
{
"class_method_signature": "NullClaim.asString()",
"constructor": false,
"full_signature": "@Override public String asString()",
"identifier": "asString",
"modifiers": "@Override public",
"parameters": "()",
"return": "String",
"signature": "String asString()",
"testcase": false
},
{
"class_method_signature": "NullClaim.asDate()",
"constructor": false,
"full_signature": "@Override public Date asDate()",
"identifier": "asDate",
"modifiers": "@Override public",
"parameters": "()",
"return": "Date",
"signature": "Date asDate()",
"testcase": false
},
{
"class_method_signature": "NullClaim.asArray(Class<T> tClazz)",
"constructor": false,
"full_signature": "@Override public T[] asArray(Class<T> tClazz)",
"identifier": "asArray",
"modifiers": "@Override public",
"parameters": "(Class<T> tClazz)",
"return": "T[]",
"signature": "T[] asArray(Class<T> tClazz)",
"testcase": false
},
{
"class_method_signature": "NullClaim.asList(Class<T> tClazz)",
"constructor": false,
"full_signature": "@Override public List<T> asList(Class<T> tClazz)",
"identifier": "asList",
"modifiers": "@Override public",
"parameters": "(Class<T> tClazz)",
"return": "List<T>",
"signature": "List<T> asList(Class<T> tClazz)",
"testcase": false
},
{
"class_method_signature": "NullClaim.asMap()",
"constructor": false,
"full_signature": "@Override public Map<String, Object> asMap()",
"identifier": "asMap",
"modifiers": "@Override public",
"parameters": "()",
"return": "Map<String, Object>",
"signature": "Map<String, Object> asMap()",
"testcase": false
},
{
"class_method_signature": "NullClaim.as(Class<T> tClazz)",
"constructor": false,
"full_signature": "@Override public T as(Class<T> tClazz)",
"identifier": "as",
"modifiers": "@Override public",
"parameters": "(Class<T> tClazz)",
"return": "T",
"signature": "T as(Class<T> tClazz)",
"testcase": false
}
],
"superclass": ""
} | {
"body": "@Override\n public Integer asInt() {\n return null;\n }",
"class_method_signature": "NullClaim.asInt()",
"constructor": false,
"full_signature": "@Override public Integer asInt()",
"identifier": "asInt",
"invocations": [],
"modifiers": "@Override public",
"parameters": "()",
"return": "Integer",
"signature": "Integer asInt()",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 691,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 17517521,
"size": 936,
"stargazer_count": 3678,
"stars": null,
"updates": null,
"url": "https://github.com/auth0/java-jwt"
} |
17517521_186 | {
"fields": [
{
"declarator": "PRIVATE_KEY_FILE_256 = \"src/test/resources/ec256-key-private.pem\"",
"modifier": "private static final",
"original_string": "private static final String PRIVATE_KEY_FILE_256 = \"src/test/resources/ec256-key-private.pem\";",
"type": "String",
"var_name": "PRIVATE_KEY_FILE_256"
},
{
"declarator": "PUBLIC_KEY_FILE_256 = \"src/test/resources/ec256-key-public.pem\"",
"modifier": "private static final",
"original_string": "private static final String PUBLIC_KEY_FILE_256 = \"src/test/resources/ec256-key-public.pem\";",
"type": "String",
"var_name": "PUBLIC_KEY_FILE_256"
},
{
"declarator": "INVALID_PUBLIC_KEY_FILE_256 = \"src/test/resources/ec256-key-public-invalid.pem\"",
"modifier": "private static final",
"original_string": "private static final String INVALID_PUBLIC_KEY_FILE_256 = \"src/test/resources/ec256-key-public-invalid.pem\";",
"type": "String",
"var_name": "INVALID_PUBLIC_KEY_FILE_256"
},
{
"declarator": "PRIVATE_KEY_FILE_256K = \"src/test/resources/ec256k-key-private.pem\"",
"modifier": "private static final",
"original_string": "private static final String PRIVATE_KEY_FILE_256K = \"src/test/resources/ec256k-key-private.pem\";",
"type": "String",
"var_name": "PRIVATE_KEY_FILE_256K"
},
{
"declarator": "PUBLIC_KEY_FILE_256K = \"src/test/resources/ec256k-key-public.pem\"",
"modifier": "private static final",
"original_string": "private static final String PUBLIC_KEY_FILE_256K = \"src/test/resources/ec256k-key-public.pem\";",
"type": "String",
"var_name": "PUBLIC_KEY_FILE_256K"
},
{
"declarator": "INVALID_PUBLIC_KEY_FILE_256K = \"src/test/resources/ec256k-key-public-invalid.pem\"",
"modifier": "private static final",
"original_string": "private static final String INVALID_PUBLIC_KEY_FILE_256K = \"src/test/resources/ec256k-key-public-invalid.pem\";",
"type": "String",
"var_name": "INVALID_PUBLIC_KEY_FILE_256K"
},
{
"declarator": "ES256K_JWT = \"eyJraWQiOiJteS1rZXktaWQiLCJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NksifQ.e30.2ggPsc4xwQhYcgJueo3uQ14MpaVJ3AbEE8UE-wA9fc8SMibeW54gjZbikL-JBHqhEwc22Cp8DNOtadXsM81RGQ\"",
"modifier": "private static final",
"original_string": "private static final String ES256K_JWT = \"eyJraWQiOiJteS1rZXktaWQiLCJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NksifQ.e30.2ggPsc4xwQhYcgJueo3uQ14MpaVJ3AbEE8UE-wA9fc8SMibeW54gjZbikL-JBHqhEwc22Cp8DNOtadXsM81RGQ\";",
"type": "String",
"var_name": "ES256K_JWT"
},
{
"declarator": "PRIVATE_KEY_FILE_384 = \"src/test/resources/ec384-key-private.pem\"",
"modifier": "private static final",
"original_string": "private static final String PRIVATE_KEY_FILE_384 = \"src/test/resources/ec384-key-private.pem\";",
"type": "String",
"var_name": "PRIVATE_KEY_FILE_384"
},
{
"declarator": "PUBLIC_KEY_FILE_384 = \"src/test/resources/ec384-key-public.pem\"",
"modifier": "private static final",
"original_string": "private static final String PUBLIC_KEY_FILE_384 = \"src/test/resources/ec384-key-public.pem\";",
"type": "String",
"var_name": "PUBLIC_KEY_FILE_384"
},
{
"declarator": "INVALID_PUBLIC_KEY_FILE_384 = \"src/test/resources/ec384-key-public-invalid.pem\"",
"modifier": "private static final",
"original_string": "private static final String INVALID_PUBLIC_KEY_FILE_384 = \"src/test/resources/ec384-key-public-invalid.pem\";",
"type": "String",
"var_name": "INVALID_PUBLIC_KEY_FILE_384"
},
{
"declarator": "PRIVATE_KEY_FILE_512 = \"src/test/resources/ec512-key-private.pem\"",
"modifier": "private static final",
"original_string": "private static final String PRIVATE_KEY_FILE_512 = \"src/test/resources/ec512-key-private.pem\";",
"type": "String",
"var_name": "PRIVATE_KEY_FILE_512"
},
{
"declarator": "PUBLIC_KEY_FILE_512 = \"src/test/resources/ec512-key-public.pem\"",
"modifier": "private static final",
"original_string": "private static final String PUBLIC_KEY_FILE_512 = \"src/test/resources/ec512-key-public.pem\";",
"type": "String",
"var_name": "PUBLIC_KEY_FILE_512"
},
{
"declarator": "INVALID_PUBLIC_KEY_FILE_512 = \"src/test/resources/ec512-key-public-invalid.pem\"",
"modifier": "private static final",
"original_string": "private static final String INVALID_PUBLIC_KEY_FILE_512 = \"src/test/resources/ec512-key-public-invalid.pem\";",
"type": "String",
"var_name": "INVALID_PUBLIC_KEY_FILE_512"
},
{
"declarator": "exception = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException exception = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "exception"
},
{
"declarator": "ES256Header = \"eyJhbGciOiJFUzI1NiJ9\"",
"modifier": "private static final",
"original_string": "private static final String ES256Header = \"eyJhbGciOiJFUzI1NiJ9\";",
"type": "String",
"var_name": "ES256Header"
},
{
"declarator": "ES384Header = \"eyJhbGciOiJFUzM4NCJ9\"",
"modifier": "private static final",
"original_string": "private static final String ES384Header = \"eyJhbGciOiJFUzM4NCJ9\";",
"type": "String",
"var_name": "ES384Header"
},
{
"declarator": "ES512Header = \"eyJhbGciOiJFUzUxMiJ9\"",
"modifier": "private static final",
"original_string": "private static final String ES512Header = \"eyJhbGciOiJFUzUxMiJ9\";",
"type": "String",
"var_name": "ES512Header"
},
{
"declarator": "auth0IssPayload = \"eyJpc3MiOiJhdXRoMCJ9\"",
"modifier": "private static final",
"original_string": "private static final String auth0IssPayload = \"eyJpc3MiOiJhdXRoMCJ9\";",
"type": "String",
"var_name": "auth0IssPayload"
},
{
"declarator": "ES256HeaderBytes = ES256Header.getBytes(StandardCharsets.UTF_8)",
"modifier": "private static final",
"original_string": "private static final byte[] ES256HeaderBytes = ES256Header.getBytes(StandardCharsets.UTF_8);",
"type": "byte[]",
"var_name": "ES256HeaderBytes"
},
{
"declarator": "ES384HeaderBytes = ES384Header.getBytes(StandardCharsets.UTF_8)",
"modifier": "private static final",
"original_string": "private static final byte[] ES384HeaderBytes = ES384Header.getBytes(StandardCharsets.UTF_8);",
"type": "byte[]",
"var_name": "ES384HeaderBytes"
},
{
"declarator": "ES512HeaderBytes = ES512Header.getBytes(StandardCharsets.UTF_8)",
"modifier": "private static final",
"original_string": "private static final byte[] ES512HeaderBytes = ES512Header.getBytes(StandardCharsets.UTF_8);",
"type": "byte[]",
"var_name": "ES512HeaderBytes"
},
{
"declarator": "auth0IssPayloadBytes = auth0IssPayload.getBytes(StandardCharsets.UTF_8)",
"modifier": "private static final",
"original_string": "private static final byte[] auth0IssPayloadBytes = auth0IssPayload.getBytes(StandardCharsets.UTF_8);",
"type": "byte[]",
"var_name": "auth0IssPayloadBytes"
}
],
"file": "lib/src/test/java/com/auth0/jwt/algorithms/ECDSAAlgorithmTest.java",
"identifier": "ECDSAAlgorithmTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void shouldFailOnECDSA384SigningWhenUsingPublicKey() throws Exception {\n exception.expect(SignatureGenerationException.class);\n exception.expectMessage(\"The Token's Signature couldn't be generated when signing using the Algorithm: SHA384withECDSA\");\n exception.expectCause(isA(IllegalStateException.class));\n exception.expectCause(hasMessage(is(\"The given Private Key is null.\")));\n\n Algorithm algorithm = Algorithm.ECDSA384((ECKey) readPublicKeyFromFile(PUBLIC_KEY_FILE_384, \"EC\"));\n algorithm.sign(new byte[0], new byte[0]);\n }",
"class_method_signature": "ECDSAAlgorithmTest.shouldFailOnECDSA384SigningWhenUsingPublicKey()",
"constructor": false,
"full_signature": "@Test public void shouldFailOnECDSA384SigningWhenUsingPublicKey()",
"identifier": "shouldFailOnECDSA384SigningWhenUsingPublicKey",
"invocations": [
"expect",
"expectMessage",
"expectCause",
"isA",
"expectCause",
"hasMessage",
"is",
"ECDSA384",
"readPublicKeyFromFile",
"sign"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void shouldFailOnECDSA384SigningWhenUsingPublicKey()",
"testcase": true
} | {
"fields": [
{
"declarator": "keyProvider",
"modifier": "private final",
"original_string": "private final ECDSAKeyProvider keyProvider;",
"type": "ECDSAKeyProvider",
"var_name": "keyProvider"
},
{
"declarator": "crypto",
"modifier": "private final",
"original_string": "private final CryptoHelper crypto;",
"type": "CryptoHelper",
"var_name": "crypto"
},
{
"declarator": "ecNumberSize",
"modifier": "private final",
"original_string": "private final int ecNumberSize;",
"type": "int",
"var_name": "ecNumberSize"
}
],
"file": "lib/src/main/java/com/auth0/jwt/algorithms/ECDSAAlgorithm.java",
"identifier": "ECDSAAlgorithm",
"interfaces": "",
"methods": [
{
"class_method_signature": "ECDSAAlgorithm.ECDSAAlgorithm(CryptoHelper crypto, String id, String algorithm, int ecNumberSize, ECDSAKeyProvider keyProvider)",
"constructor": true,
"full_signature": " ECDSAAlgorithm(CryptoHelper crypto, String id, String algorithm, int ecNumberSize, ECDSAKeyProvider keyProvider)",
"identifier": "ECDSAAlgorithm",
"modifiers": "",
"parameters": "(CryptoHelper crypto, String id, String algorithm, int ecNumberSize, ECDSAKeyProvider keyProvider)",
"return": "",
"signature": " ECDSAAlgorithm(CryptoHelper crypto, String id, String algorithm, int ecNumberSize, ECDSAKeyProvider keyProvider)",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.ECDSAAlgorithm(String id, String algorithm, int ecNumberSize, ECDSAKeyProvider keyProvider)",
"constructor": true,
"full_signature": " ECDSAAlgorithm(String id, String algorithm, int ecNumberSize, ECDSAKeyProvider keyProvider)",
"identifier": "ECDSAAlgorithm",
"modifiers": "",
"parameters": "(String id, String algorithm, int ecNumberSize, ECDSAKeyProvider keyProvider)",
"return": "",
"signature": " ECDSAAlgorithm(String id, String algorithm, int ecNumberSize, ECDSAKeyProvider keyProvider)",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.verify(DecodedJWT jwt)",
"constructor": false,
"full_signature": "@Override public void verify(DecodedJWT jwt)",
"identifier": "verify",
"modifiers": "@Override public",
"parameters": "(DecodedJWT jwt)",
"return": "void",
"signature": "void verify(DecodedJWT jwt)",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.sign(byte[] headerBytes, byte[] payloadBytes)",
"constructor": false,
"full_signature": "@Override public byte[] sign(byte[] headerBytes, byte[] payloadBytes)",
"identifier": "sign",
"modifiers": "@Override public",
"parameters": "(byte[] headerBytes, byte[] payloadBytes)",
"return": "byte[]",
"signature": "byte[] sign(byte[] headerBytes, byte[] payloadBytes)",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.sign(byte[] contentBytes)",
"constructor": false,
"full_signature": "@Override @Deprecated public byte[] sign(byte[] contentBytes)",
"identifier": "sign",
"modifiers": "@Override @Deprecated public",
"parameters": "(byte[] contentBytes)",
"return": "byte[]",
"signature": "byte[] sign(byte[] contentBytes)",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.getSigningKeyId()",
"constructor": false,
"full_signature": "@Override public String getSigningKeyId()",
"identifier": "getSigningKeyId",
"modifiers": "@Override public",
"parameters": "()",
"return": "String",
"signature": "String getSigningKeyId()",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.DERToJOSE(byte[] derSignature)",
"constructor": false,
"full_signature": " byte[] DERToJOSE(byte[] derSignature)",
"identifier": "DERToJOSE",
"modifiers": "",
"parameters": "(byte[] derSignature)",
"return": "byte[]",
"signature": "byte[] DERToJOSE(byte[] derSignature)",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.JOSEToDER(byte[] joseSignature)",
"constructor": false,
"full_signature": " byte[] JOSEToDER(byte[] joseSignature)",
"identifier": "JOSEToDER",
"modifiers": "",
"parameters": "(byte[] joseSignature)",
"return": "byte[]",
"signature": "byte[] JOSEToDER(byte[] joseSignature)",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.countPadding(byte[] bytes, int fromIndex, int toIndex)",
"constructor": false,
"full_signature": "private int countPadding(byte[] bytes, int fromIndex, int toIndex)",
"identifier": "countPadding",
"modifiers": "private",
"parameters": "(byte[] bytes, int fromIndex, int toIndex)",
"return": "int",
"signature": "int countPadding(byte[] bytes, int fromIndex, int toIndex)",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.providerForKeys(final ECPublicKey publicKey, final ECPrivateKey privateKey)",
"constructor": false,
"full_signature": "static ECDSAKeyProvider providerForKeys(final ECPublicKey publicKey, final ECPrivateKey privateKey)",
"identifier": "providerForKeys",
"modifiers": "static",
"parameters": "(final ECPublicKey publicKey, final ECPrivateKey privateKey)",
"return": "ECDSAKeyProvider",
"signature": "ECDSAKeyProvider providerForKeys(final ECPublicKey publicKey, final ECPrivateKey privateKey)",
"testcase": false
}
],
"superclass": "extends Algorithm"
} | {
"body": "@Override\n public byte[] sign(byte[] headerBytes, byte[] payloadBytes) throws SignatureGenerationException {\n try {\n ECPrivateKey privateKey = keyProvider.getPrivateKey();\n if (privateKey == null) {\n throw new IllegalStateException(\"The given Private Key is null.\");\n }\n byte[] signature = crypto.createSignatureFor(getDescription(), privateKey, headerBytes, payloadBytes);\n return DERToJOSE(signature);\n } catch (NoSuchAlgorithmException | SignatureException | InvalidKeyException | IllegalStateException e) {\n throw new SignatureGenerationException(this, e);\n }\n }",
"class_method_signature": "ECDSAAlgorithm.sign(byte[] headerBytes, byte[] payloadBytes)",
"constructor": false,
"full_signature": "@Override public byte[] sign(byte[] headerBytes, byte[] payloadBytes)",
"identifier": "sign",
"invocations": [
"getPrivateKey",
"createSignatureFor",
"getDescription",
"DERToJOSE"
],
"modifiers": "@Override public",
"parameters": "(byte[] headerBytes, byte[] payloadBytes)",
"return": "byte[]",
"signature": "byte[] sign(byte[] headerBytes, byte[] payloadBytes)",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 691,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 17517521,
"size": 936,
"stargazer_count": 3678,
"stars": null,
"updates": null,
"url": "https://github.com/auth0/java-jwt"
} |
17517521_169 | {
"fields": [
{
"declarator": "PRIVATE_KEY_FILE_256 = \"src/test/resources/ec256-key-private.pem\"",
"modifier": "private static final",
"original_string": "private static final String PRIVATE_KEY_FILE_256 = \"src/test/resources/ec256-key-private.pem\";",
"type": "String",
"var_name": "PRIVATE_KEY_FILE_256"
},
{
"declarator": "PUBLIC_KEY_FILE_256 = \"src/test/resources/ec256-key-public.pem\"",
"modifier": "private static final",
"original_string": "private static final String PUBLIC_KEY_FILE_256 = \"src/test/resources/ec256-key-public.pem\";",
"type": "String",
"var_name": "PUBLIC_KEY_FILE_256"
},
{
"declarator": "INVALID_PUBLIC_KEY_FILE_256 = \"src/test/resources/ec256-key-public-invalid.pem\"",
"modifier": "private static final",
"original_string": "private static final String INVALID_PUBLIC_KEY_FILE_256 = \"src/test/resources/ec256-key-public-invalid.pem\";",
"type": "String",
"var_name": "INVALID_PUBLIC_KEY_FILE_256"
},
{
"declarator": "PRIVATE_KEY_FILE_256K = \"src/test/resources/ec256k-key-private.pem\"",
"modifier": "private static final",
"original_string": "private static final String PRIVATE_KEY_FILE_256K = \"src/test/resources/ec256k-key-private.pem\";",
"type": "String",
"var_name": "PRIVATE_KEY_FILE_256K"
},
{
"declarator": "PUBLIC_KEY_FILE_256K = \"src/test/resources/ec256k-key-public.pem\"",
"modifier": "private static final",
"original_string": "private static final String PUBLIC_KEY_FILE_256K = \"src/test/resources/ec256k-key-public.pem\";",
"type": "String",
"var_name": "PUBLIC_KEY_FILE_256K"
},
{
"declarator": "INVALID_PUBLIC_KEY_FILE_256K = \"src/test/resources/ec256k-key-public-invalid.pem\"",
"modifier": "private static final",
"original_string": "private static final String INVALID_PUBLIC_KEY_FILE_256K = \"src/test/resources/ec256k-key-public-invalid.pem\";",
"type": "String",
"var_name": "INVALID_PUBLIC_KEY_FILE_256K"
},
{
"declarator": "ES256K_JWT = \"eyJraWQiOiJteS1rZXktaWQiLCJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NksifQ.e30.2ggPsc4xwQhYcgJueo3uQ14MpaVJ3AbEE8UE-wA9fc8SMibeW54gjZbikL-JBHqhEwc22Cp8DNOtadXsM81RGQ\"",
"modifier": "private static final",
"original_string": "private static final String ES256K_JWT = \"eyJraWQiOiJteS1rZXktaWQiLCJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NksifQ.e30.2ggPsc4xwQhYcgJueo3uQ14MpaVJ3AbEE8UE-wA9fc8SMibeW54gjZbikL-JBHqhEwc22Cp8DNOtadXsM81RGQ\";",
"type": "String",
"var_name": "ES256K_JWT"
},
{
"declarator": "PRIVATE_KEY_FILE_384 = \"src/test/resources/ec384-key-private.pem\"",
"modifier": "private static final",
"original_string": "private static final String PRIVATE_KEY_FILE_384 = \"src/test/resources/ec384-key-private.pem\";",
"type": "String",
"var_name": "PRIVATE_KEY_FILE_384"
},
{
"declarator": "PUBLIC_KEY_FILE_384 = \"src/test/resources/ec384-key-public.pem\"",
"modifier": "private static final",
"original_string": "private static final String PUBLIC_KEY_FILE_384 = \"src/test/resources/ec384-key-public.pem\";",
"type": "String",
"var_name": "PUBLIC_KEY_FILE_384"
},
{
"declarator": "INVALID_PUBLIC_KEY_FILE_384 = \"src/test/resources/ec384-key-public-invalid.pem\"",
"modifier": "private static final",
"original_string": "private static final String INVALID_PUBLIC_KEY_FILE_384 = \"src/test/resources/ec384-key-public-invalid.pem\";",
"type": "String",
"var_name": "INVALID_PUBLIC_KEY_FILE_384"
},
{
"declarator": "PRIVATE_KEY_FILE_512 = \"src/test/resources/ec512-key-private.pem\"",
"modifier": "private static final",
"original_string": "private static final String PRIVATE_KEY_FILE_512 = \"src/test/resources/ec512-key-private.pem\";",
"type": "String",
"var_name": "PRIVATE_KEY_FILE_512"
},
{
"declarator": "PUBLIC_KEY_FILE_512 = \"src/test/resources/ec512-key-public.pem\"",
"modifier": "private static final",
"original_string": "private static final String PUBLIC_KEY_FILE_512 = \"src/test/resources/ec512-key-public.pem\";",
"type": "String",
"var_name": "PUBLIC_KEY_FILE_512"
},
{
"declarator": "INVALID_PUBLIC_KEY_FILE_512 = \"src/test/resources/ec512-key-public-invalid.pem\"",
"modifier": "private static final",
"original_string": "private static final String INVALID_PUBLIC_KEY_FILE_512 = \"src/test/resources/ec512-key-public-invalid.pem\";",
"type": "String",
"var_name": "INVALID_PUBLIC_KEY_FILE_512"
},
{
"declarator": "exception = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException exception = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "exception"
},
{
"declarator": "ES256Header = \"eyJhbGciOiJFUzI1NiJ9\"",
"modifier": "private static final",
"original_string": "private static final String ES256Header = \"eyJhbGciOiJFUzI1NiJ9\";",
"type": "String",
"var_name": "ES256Header"
},
{
"declarator": "ES384Header = \"eyJhbGciOiJFUzM4NCJ9\"",
"modifier": "private static final",
"original_string": "private static final String ES384Header = \"eyJhbGciOiJFUzM4NCJ9\";",
"type": "String",
"var_name": "ES384Header"
},
{
"declarator": "ES512Header = \"eyJhbGciOiJFUzUxMiJ9\"",
"modifier": "private static final",
"original_string": "private static final String ES512Header = \"eyJhbGciOiJFUzUxMiJ9\";",
"type": "String",
"var_name": "ES512Header"
},
{
"declarator": "auth0IssPayload = \"eyJpc3MiOiJhdXRoMCJ9\"",
"modifier": "private static final",
"original_string": "private static final String auth0IssPayload = \"eyJpc3MiOiJhdXRoMCJ9\";",
"type": "String",
"var_name": "auth0IssPayload"
},
{
"declarator": "ES256HeaderBytes = ES256Header.getBytes(StandardCharsets.UTF_8)",
"modifier": "private static final",
"original_string": "private static final byte[] ES256HeaderBytes = ES256Header.getBytes(StandardCharsets.UTF_8);",
"type": "byte[]",
"var_name": "ES256HeaderBytes"
},
{
"declarator": "ES384HeaderBytes = ES384Header.getBytes(StandardCharsets.UTF_8)",
"modifier": "private static final",
"original_string": "private static final byte[] ES384HeaderBytes = ES384Header.getBytes(StandardCharsets.UTF_8);",
"type": "byte[]",
"var_name": "ES384HeaderBytes"
},
{
"declarator": "ES512HeaderBytes = ES512Header.getBytes(StandardCharsets.UTF_8)",
"modifier": "private static final",
"original_string": "private static final byte[] ES512HeaderBytes = ES512Header.getBytes(StandardCharsets.UTF_8);",
"type": "byte[]",
"var_name": "ES512HeaderBytes"
},
{
"declarator": "auth0IssPayloadBytes = auth0IssPayload.getBytes(StandardCharsets.UTF_8)",
"modifier": "private static final",
"original_string": "private static final byte[] auth0IssPayloadBytes = auth0IssPayload.getBytes(StandardCharsets.UTF_8);",
"type": "byte[]",
"var_name": "auth0IssPayloadBytes"
}
],
"file": "lib/src/test/java/com/auth0/jwt/algorithms/ECDSAAlgorithmTest.java",
"identifier": "ECDSAAlgorithmTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void shouldPassECDSA512VerificationWithJOSESignatureWithBothKeys() throws Exception {\n String jwt = \"eyJhbGciOiJFUzUxMiJ9.eyJpc3MiOiJhdXRoMCJ9.AeCJPDIsSHhwRSGZCY6rspi8zekOw0K9qYMNridP1Fu9uhrA1QrG-EUxXlE06yvmh2R7Rz0aE7kxBwrnq8L8aOBCAYAsqhzPeUvyp8fXjjgs0Eto5I0mndE2QHlgcMSFASyjHbU8wD2Rq7ZNzGQ5b2MZfpv030WGUajT-aZYWFUJHVg2\";\n Algorithm algorithm = Algorithm.ECDSA512((ECPublicKey) readPublicKeyFromFile(PUBLIC_KEY_FILE_512, \"EC\"), (ECPrivateKey) readPrivateKeyFromFile(PRIVATE_KEY_FILE_512, \"EC\"));\n algorithm.verify(JWT.decode(jwt));\n }",
"class_method_signature": "ECDSAAlgorithmTest.shouldPassECDSA512VerificationWithJOSESignatureWithBothKeys()",
"constructor": false,
"full_signature": "@Test public void shouldPassECDSA512VerificationWithJOSESignatureWithBothKeys()",
"identifier": "shouldPassECDSA512VerificationWithJOSESignatureWithBothKeys",
"invocations": [
"ECDSA512",
"readPublicKeyFromFile",
"readPrivateKeyFromFile",
"verify",
"decode"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void shouldPassECDSA512VerificationWithJOSESignatureWithBothKeys()",
"testcase": true
} | {
"fields": [
{
"declarator": "keyProvider",
"modifier": "private final",
"original_string": "private final ECDSAKeyProvider keyProvider;",
"type": "ECDSAKeyProvider",
"var_name": "keyProvider"
},
{
"declarator": "crypto",
"modifier": "private final",
"original_string": "private final CryptoHelper crypto;",
"type": "CryptoHelper",
"var_name": "crypto"
},
{
"declarator": "ecNumberSize",
"modifier": "private final",
"original_string": "private final int ecNumberSize;",
"type": "int",
"var_name": "ecNumberSize"
}
],
"file": "lib/src/main/java/com/auth0/jwt/algorithms/ECDSAAlgorithm.java",
"identifier": "ECDSAAlgorithm",
"interfaces": "",
"methods": [
{
"class_method_signature": "ECDSAAlgorithm.ECDSAAlgorithm(CryptoHelper crypto, String id, String algorithm, int ecNumberSize, ECDSAKeyProvider keyProvider)",
"constructor": true,
"full_signature": " ECDSAAlgorithm(CryptoHelper crypto, String id, String algorithm, int ecNumberSize, ECDSAKeyProvider keyProvider)",
"identifier": "ECDSAAlgorithm",
"modifiers": "",
"parameters": "(CryptoHelper crypto, String id, String algorithm, int ecNumberSize, ECDSAKeyProvider keyProvider)",
"return": "",
"signature": " ECDSAAlgorithm(CryptoHelper crypto, String id, String algorithm, int ecNumberSize, ECDSAKeyProvider keyProvider)",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.ECDSAAlgorithm(String id, String algorithm, int ecNumberSize, ECDSAKeyProvider keyProvider)",
"constructor": true,
"full_signature": " ECDSAAlgorithm(String id, String algorithm, int ecNumberSize, ECDSAKeyProvider keyProvider)",
"identifier": "ECDSAAlgorithm",
"modifiers": "",
"parameters": "(String id, String algorithm, int ecNumberSize, ECDSAKeyProvider keyProvider)",
"return": "",
"signature": " ECDSAAlgorithm(String id, String algorithm, int ecNumberSize, ECDSAKeyProvider keyProvider)",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.verify(DecodedJWT jwt)",
"constructor": false,
"full_signature": "@Override public void verify(DecodedJWT jwt)",
"identifier": "verify",
"modifiers": "@Override public",
"parameters": "(DecodedJWT jwt)",
"return": "void",
"signature": "void verify(DecodedJWT jwt)",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.sign(byte[] headerBytes, byte[] payloadBytes)",
"constructor": false,
"full_signature": "@Override public byte[] sign(byte[] headerBytes, byte[] payloadBytes)",
"identifier": "sign",
"modifiers": "@Override public",
"parameters": "(byte[] headerBytes, byte[] payloadBytes)",
"return": "byte[]",
"signature": "byte[] sign(byte[] headerBytes, byte[] payloadBytes)",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.sign(byte[] contentBytes)",
"constructor": false,
"full_signature": "@Override @Deprecated public byte[] sign(byte[] contentBytes)",
"identifier": "sign",
"modifiers": "@Override @Deprecated public",
"parameters": "(byte[] contentBytes)",
"return": "byte[]",
"signature": "byte[] sign(byte[] contentBytes)",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.getSigningKeyId()",
"constructor": false,
"full_signature": "@Override public String getSigningKeyId()",
"identifier": "getSigningKeyId",
"modifiers": "@Override public",
"parameters": "()",
"return": "String",
"signature": "String getSigningKeyId()",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.DERToJOSE(byte[] derSignature)",
"constructor": false,
"full_signature": " byte[] DERToJOSE(byte[] derSignature)",
"identifier": "DERToJOSE",
"modifiers": "",
"parameters": "(byte[] derSignature)",
"return": "byte[]",
"signature": "byte[] DERToJOSE(byte[] derSignature)",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.JOSEToDER(byte[] joseSignature)",
"constructor": false,
"full_signature": " byte[] JOSEToDER(byte[] joseSignature)",
"identifier": "JOSEToDER",
"modifiers": "",
"parameters": "(byte[] joseSignature)",
"return": "byte[]",
"signature": "byte[] JOSEToDER(byte[] joseSignature)",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.countPadding(byte[] bytes, int fromIndex, int toIndex)",
"constructor": false,
"full_signature": "private int countPadding(byte[] bytes, int fromIndex, int toIndex)",
"identifier": "countPadding",
"modifiers": "private",
"parameters": "(byte[] bytes, int fromIndex, int toIndex)",
"return": "int",
"signature": "int countPadding(byte[] bytes, int fromIndex, int toIndex)",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.providerForKeys(final ECPublicKey publicKey, final ECPrivateKey privateKey)",
"constructor": false,
"full_signature": "static ECDSAKeyProvider providerForKeys(final ECPublicKey publicKey, final ECPrivateKey privateKey)",
"identifier": "providerForKeys",
"modifiers": "static",
"parameters": "(final ECPublicKey publicKey, final ECPrivateKey privateKey)",
"return": "ECDSAKeyProvider",
"signature": "ECDSAKeyProvider providerForKeys(final ECPublicKey publicKey, final ECPrivateKey privateKey)",
"testcase": false
}
],
"superclass": "extends Algorithm"
} | {
"body": "@Override\n public void verify(DecodedJWT jwt) throws SignatureVerificationException {\n byte[] signatureBytes = Base64.decodeBase64(jwt.getSignature());\n\n try {\n ECPublicKey publicKey = keyProvider.getPublicKeyById(jwt.getKeyId());\n if (publicKey == null) {\n throw new IllegalStateException(\"The given Public Key is null.\");\n }\n boolean valid = crypto.verifySignatureFor(getDescription(), publicKey, jwt.getHeader(), jwt.getPayload(), JOSEToDER(signatureBytes));\n\n if (!valid) {\n throw new SignatureVerificationException(this);\n }\n } catch (NoSuchAlgorithmException | SignatureException | InvalidKeyException | IllegalStateException e) {\n throw new SignatureVerificationException(this, e);\n }\n }",
"class_method_signature": "ECDSAAlgorithm.verify(DecodedJWT jwt)",
"constructor": false,
"full_signature": "@Override public void verify(DecodedJWT jwt)",
"identifier": "verify",
"invocations": [
"decodeBase64",
"getSignature",
"getPublicKeyById",
"getKeyId",
"verifySignatureFor",
"getDescription",
"getHeader",
"getPayload",
"JOSEToDER"
],
"modifiers": "@Override public",
"parameters": "(DecodedJWT jwt)",
"return": "void",
"signature": "void verify(DecodedJWT jwt)",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 691,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 17517521,
"size": 936,
"stargazer_count": 3678,
"stars": null,
"updates": null,
"url": "https://github.com/auth0/java-jwt"
} |
17517521_9 | {
"fields": [
{
"declarator": "exception = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException exception = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "exception"
}
],
"file": "lib/src/test/java/com/auth0/jwt/JWTDecoderTest.java",
"identifier": "JWTDecoderTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void shouldGetExpirationTime() throws Exception {\n DecodedJWT jwt = JWT.decode(\"eyJhbGciOiJIUzI1NiJ9.eyJleHAiOjE0NzY3MjcwODZ9.L9dcPHEDQew2u9MkDCORFkfDGcSOsgoPqNY-LUMLEHg\");\n assertThat(jwt, is(notNullValue()));\n assertThat(jwt.getExpiresAt(), is(instanceOf(Date.class)));\n long ms = 1476727086L * 1000;\n Date expectedDate = new Date(ms);\n assertThat(jwt.getExpiresAt(), is(notNullValue()));\n assertThat(jwt.getExpiresAt(), is(equalTo(expectedDate)));\n }",
"class_method_signature": "JWTDecoderTest.shouldGetExpirationTime()",
"constructor": false,
"full_signature": "@Test public void shouldGetExpirationTime()",
"identifier": "shouldGetExpirationTime",
"invocations": [
"decode",
"assertThat",
"is",
"notNullValue",
"assertThat",
"getExpiresAt",
"is",
"instanceOf",
"assertThat",
"getExpiresAt",
"is",
"notNullValue",
"assertThat",
"getExpiresAt",
"is",
"equalTo"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void shouldGetExpirationTime()",
"testcase": true
} | {
"fields": [
{
"declarator": "serialVersionUID = 1873362438023312895L",
"modifier": "private static final",
"original_string": "private static final long serialVersionUID = 1873362438023312895L;",
"type": "long",
"var_name": "serialVersionUID"
},
{
"declarator": "parts",
"modifier": "private final",
"original_string": "private final String[] parts;",
"type": "String[]",
"var_name": "parts"
},
{
"declarator": "header",
"modifier": "private final",
"original_string": "private final Header header;",
"type": "Header",
"var_name": "header"
},
{
"declarator": "payload",
"modifier": "private final",
"original_string": "private final Payload payload;",
"type": "Payload",
"var_name": "payload"
}
],
"file": "lib/src/main/java/com/auth0/jwt/JWTDecoder.java",
"identifier": "JWTDecoder",
"interfaces": "implements DecodedJWT, Serializable",
"methods": [
{
"class_method_signature": "JWTDecoder.JWTDecoder(String jwt)",
"constructor": true,
"full_signature": " JWTDecoder(String jwt)",
"identifier": "JWTDecoder",
"modifiers": "",
"parameters": "(String jwt)",
"return": "",
"signature": " JWTDecoder(String jwt)",
"testcase": false
},
{
"class_method_signature": "JWTDecoder.JWTDecoder(JWTParser converter, String jwt)",
"constructor": true,
"full_signature": " JWTDecoder(JWTParser converter, String jwt)",
"identifier": "JWTDecoder",
"modifiers": "",
"parameters": "(JWTParser converter, String jwt)",
"return": "",
"signature": " JWTDecoder(JWTParser converter, String jwt)",
"testcase": false
},
{
"class_method_signature": "JWTDecoder.getAlgorithm()",
"constructor": false,
"full_signature": "@Override public String getAlgorithm()",
"identifier": "getAlgorithm",
"modifiers": "@Override public",
"parameters": "()",
"return": "String",
"signature": "String getAlgorithm()",
"testcase": false
},
{
"class_method_signature": "JWTDecoder.getType()",
"constructor": false,
"full_signature": "@Override public String getType()",
"identifier": "getType",
"modifiers": "@Override public",
"parameters": "()",
"return": "String",
"signature": "String getType()",
"testcase": false
},
{
"class_method_signature": "JWTDecoder.getContentType()",
"constructor": false,
"full_signature": "@Override public String getContentType()",
"identifier": "getContentType",
"modifiers": "@Override public",
"parameters": "()",
"return": "String",
"signature": "String getContentType()",
"testcase": false
},
{
"class_method_signature": "JWTDecoder.getKeyId()",
"constructor": false,
"full_signature": "@Override public String getKeyId()",
"identifier": "getKeyId",
"modifiers": "@Override public",
"parameters": "()",
"return": "String",
"signature": "String getKeyId()",
"testcase": false
},
{
"class_method_signature": "JWTDecoder.getHeaderClaim(String name)",
"constructor": false,
"full_signature": "@Override public Claim getHeaderClaim(String name)",
"identifier": "getHeaderClaim",
"modifiers": "@Override public",
"parameters": "(String name)",
"return": "Claim",
"signature": "Claim getHeaderClaim(String name)",
"testcase": false
},
{
"class_method_signature": "JWTDecoder.getIssuer()",
"constructor": false,
"full_signature": "@Override public String getIssuer()",
"identifier": "getIssuer",
"modifiers": "@Override public",
"parameters": "()",
"return": "String",
"signature": "String getIssuer()",
"testcase": false
},
{
"class_method_signature": "JWTDecoder.getSubject()",
"constructor": false,
"full_signature": "@Override public String getSubject()",
"identifier": "getSubject",
"modifiers": "@Override public",
"parameters": "()",
"return": "String",
"signature": "String getSubject()",
"testcase": false
},
{
"class_method_signature": "JWTDecoder.getAudience()",
"constructor": false,
"full_signature": "@Override public List<String> getAudience()",
"identifier": "getAudience",
"modifiers": "@Override public",
"parameters": "()",
"return": "List<String>",
"signature": "List<String> getAudience()",
"testcase": false
},
{
"class_method_signature": "JWTDecoder.getExpiresAt()",
"constructor": false,
"full_signature": "@Override public Date getExpiresAt()",
"identifier": "getExpiresAt",
"modifiers": "@Override public",
"parameters": "()",
"return": "Date",
"signature": "Date getExpiresAt()",
"testcase": false
},
{
"class_method_signature": "JWTDecoder.getNotBefore()",
"constructor": false,
"full_signature": "@Override public Date getNotBefore()",
"identifier": "getNotBefore",
"modifiers": "@Override public",
"parameters": "()",
"return": "Date",
"signature": "Date getNotBefore()",
"testcase": false
},
{
"class_method_signature": "JWTDecoder.getIssuedAt()",
"constructor": false,
"full_signature": "@Override public Date getIssuedAt()",
"identifier": "getIssuedAt",
"modifiers": "@Override public",
"parameters": "()",
"return": "Date",
"signature": "Date getIssuedAt()",
"testcase": false
},
{
"class_method_signature": "JWTDecoder.getId()",
"constructor": false,
"full_signature": "@Override public String getId()",
"identifier": "getId",
"modifiers": "@Override public",
"parameters": "()",
"return": "String",
"signature": "String getId()",
"testcase": false
},
{
"class_method_signature": "JWTDecoder.getClaim(String name)",
"constructor": false,
"full_signature": "@Override public Claim getClaim(String name)",
"identifier": "getClaim",
"modifiers": "@Override public",
"parameters": "(String name)",
"return": "Claim",
"signature": "Claim getClaim(String name)",
"testcase": false
},
{
"class_method_signature": "JWTDecoder.getClaims()",
"constructor": false,
"full_signature": "@Override public Map<String, Claim> getClaims()",
"identifier": "getClaims",
"modifiers": "@Override public",
"parameters": "()",
"return": "Map<String, Claim>",
"signature": "Map<String, Claim> getClaims()",
"testcase": false
},
{
"class_method_signature": "JWTDecoder.getHeader()",
"constructor": false,
"full_signature": "@Override public String getHeader()",
"identifier": "getHeader",
"modifiers": "@Override public",
"parameters": "()",
"return": "String",
"signature": "String getHeader()",
"testcase": false
},
{
"class_method_signature": "JWTDecoder.getPayload()",
"constructor": false,
"full_signature": "@Override public String getPayload()",
"identifier": "getPayload",
"modifiers": "@Override public",
"parameters": "()",
"return": "String",
"signature": "String getPayload()",
"testcase": false
},
{
"class_method_signature": "JWTDecoder.getSignature()",
"constructor": false,
"full_signature": "@Override public String getSignature()",
"identifier": "getSignature",
"modifiers": "@Override public",
"parameters": "()",
"return": "String",
"signature": "String getSignature()",
"testcase": false
},
{
"class_method_signature": "JWTDecoder.getToken()",
"constructor": false,
"full_signature": "@Override public String getToken()",
"identifier": "getToken",
"modifiers": "@Override public",
"parameters": "()",
"return": "String",
"signature": "String getToken()",
"testcase": false
}
],
"superclass": ""
} | {
"body": "@Override\n public Date getExpiresAt() {\n return payload.getExpiresAt();\n }",
"class_method_signature": "JWTDecoder.getExpiresAt()",
"constructor": false,
"full_signature": "@Override public Date getExpiresAt()",
"identifier": "getExpiresAt",
"invocations": [
"getExpiresAt"
],
"modifiers": "@Override public",
"parameters": "()",
"return": "Date",
"signature": "Date getExpiresAt()",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 691,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 17517521,
"size": 936,
"stargazer_count": 3678,
"stars": null,
"updates": null,
"url": "https://github.com/auth0/java-jwt"
} |
17517521_217 | {
"fields": [
{
"declarator": "PUBLIC_KEY_FILE_RSA = \"src/test/resources/rsa-public.pem\"",
"modifier": "private static final",
"original_string": "private static final String PUBLIC_KEY_FILE_RSA = \"src/test/resources/rsa-public.pem\";",
"type": "String",
"var_name": "PUBLIC_KEY_FILE_RSA"
},
{
"declarator": "PRIVATE_KEY_FILE_RSA = \"src/test/resources/rsa-private.pem\"",
"modifier": "private static final",
"original_string": "private static final String PRIVATE_KEY_FILE_RSA = \"src/test/resources/rsa-private.pem\";",
"type": "String",
"var_name": "PRIVATE_KEY_FILE_RSA"
},
{
"declarator": "PUBLIC_KEY_FILE_EC_256 = \"src/test/resources/ec256-key-public.pem\"",
"modifier": "private static final",
"original_string": "private static final String PUBLIC_KEY_FILE_EC_256 = \"src/test/resources/ec256-key-public.pem\";",
"type": "String",
"var_name": "PUBLIC_KEY_FILE_EC_256"
},
{
"declarator": "PUBLIC_KEY_FILE_EC_256K = \"src/test/resources/ec256k-key-public.pem\"",
"modifier": "private static final",
"original_string": "private static final String PUBLIC_KEY_FILE_EC_256K = \"src/test/resources/ec256k-key-public.pem\";",
"type": "String",
"var_name": "PUBLIC_KEY_FILE_EC_256K"
},
{
"declarator": "PUBLIC_KEY_FILE_EC_384 = \"src/test/resources/ec384-key-public.pem\"",
"modifier": "private static final",
"original_string": "private static final String PUBLIC_KEY_FILE_EC_384 = \"src/test/resources/ec384-key-public.pem\";",
"type": "String",
"var_name": "PUBLIC_KEY_FILE_EC_384"
},
{
"declarator": "PUBLIC_KEY_FILE_EC_512 = \"src/test/resources/ec512-key-public.pem\"",
"modifier": "private static final",
"original_string": "private static final String PUBLIC_KEY_FILE_EC_512 = \"src/test/resources/ec512-key-public.pem\";",
"type": "String",
"var_name": "PUBLIC_KEY_FILE_EC_512"
},
{
"declarator": "PRIVATE_KEY_FILE_EC_256 = \"src/test/resources/ec256-key-private.pem\"",
"modifier": "private static final",
"original_string": "private static final String PRIVATE_KEY_FILE_EC_256 = \"src/test/resources/ec256-key-private.pem\";",
"type": "String",
"var_name": "PRIVATE_KEY_FILE_EC_256"
},
{
"declarator": "PRIVATE_KEY_FILE_EC_256K = \"src/test/resources/ec256k-key-private.pem\"",
"modifier": "private static final",
"original_string": "private static final String PRIVATE_KEY_FILE_EC_256K = \"src/test/resources/ec256k-key-private.pem\";",
"type": "String",
"var_name": "PRIVATE_KEY_FILE_EC_256K"
},
{
"declarator": "PRIVATE_KEY_FILE_EC_384 = \"src/test/resources/ec384-key-private.pem\"",
"modifier": "private static final",
"original_string": "private static final String PRIVATE_KEY_FILE_EC_384 = \"src/test/resources/ec384-key-private.pem\";",
"type": "String",
"var_name": "PRIVATE_KEY_FILE_EC_384"
},
{
"declarator": "PRIVATE_KEY_FILE_EC_512 = \"src/test/resources/ec512-key-private.pem\"",
"modifier": "private static final",
"original_string": "private static final String PRIVATE_KEY_FILE_EC_512 = \"src/test/resources/ec512-key-private.pem\";",
"type": "String",
"var_name": "PRIVATE_KEY_FILE_EC_512"
},
{
"declarator": "exception = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException exception = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "exception"
}
],
"file": "lib/src/test/java/com/auth0/jwt/JWTTest.java",
"identifier": "JWTTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void shouldAcceptRSA512Algorithm() throws Exception {\n String token = \"eyJhbGciOiJSUzUxMiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJhdXRoMCJ9.mvL5LoMyIrWYjk5umEXZTmbyIrkbbcVPUkvdGZbu0qFBxGOf0nXP5PZBvPcOu084lvpwVox5n3VaD4iqzW-PsJyvKFgi5TnwmsbKchAp7JexQEsQOnTSGcfRqeUUiBZqRQdYsho71oAB3T4FnalDdFEpM-fztcZY9XqKyayqZLreTeBjqJm4jfOWH7KfGBHgZExQhe96NLq1UA9eUyQwdOA1Z0SgXe4Ja5PxZ6Fm37KnVDtDlNnY4JAAGFo6y74aGNnp_BKgpaVJCGFu1f1S5xCQ1HSvs8ZSdVWs5NgawW3wRd0kRt_GJ_Y3mIwiF4qUyHWGtsSHu_qjVdCTtbFyow\";\n RSAKey key = (RSAKey) PemUtils.readPublicKeyFromFile(PUBLIC_KEY_FILE_RSA, \"RSA\");\n DecodedJWT jwt = JWT.require(Algorithm.RSA512(key))\n .build()\n .verify(token);\n\n assertThat(jwt, is(notNullValue()));\n }",
"class_method_signature": "JWTTest.shouldAcceptRSA512Algorithm()",
"constructor": false,
"full_signature": "@Test public void shouldAcceptRSA512Algorithm()",
"identifier": "shouldAcceptRSA512Algorithm",
"invocations": [
"readPublicKeyFromFile",
"verify",
"build",
"require",
"RSA512",
"assertThat",
"is",
"notNullValue"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void shouldAcceptRSA512Algorithm()",
"testcase": true
} | {
"fields": [
{
"declarator": "parser",
"modifier": "private final",
"original_string": "private final JWTParser parser;",
"type": "JWTParser",
"var_name": "parser"
}
],
"file": "lib/src/main/java/com/auth0/jwt/JWT.java",
"identifier": "JWT",
"interfaces": "",
"methods": [
{
"class_method_signature": "JWT.JWT()",
"constructor": true,
"full_signature": "public JWT()",
"identifier": "JWT",
"modifiers": "public",
"parameters": "()",
"return": "",
"signature": " JWT()",
"testcase": false
},
{
"class_method_signature": "JWT.decodeJwt(String token)",
"constructor": false,
"full_signature": "public DecodedJWT decodeJwt(String token)",
"identifier": "decodeJwt",
"modifiers": "public",
"parameters": "(String token)",
"return": "DecodedJWT",
"signature": "DecodedJWT decodeJwt(String token)",
"testcase": false
},
{
"class_method_signature": "JWT.decode(String token)",
"constructor": false,
"full_signature": "public static DecodedJWT decode(String token)",
"identifier": "decode",
"modifiers": "public static",
"parameters": "(String token)",
"return": "DecodedJWT",
"signature": "DecodedJWT decode(String token)",
"testcase": false
},
{
"class_method_signature": "JWT.require(Algorithm algorithm)",
"constructor": false,
"full_signature": "public static Verification require(Algorithm algorithm)",
"identifier": "require",
"modifiers": "public static",
"parameters": "(Algorithm algorithm)",
"return": "Verification",
"signature": "Verification require(Algorithm algorithm)",
"testcase": false
},
{
"class_method_signature": "JWT.create()",
"constructor": false,
"full_signature": "public static JWTCreator.Builder create()",
"identifier": "create",
"modifiers": "public static",
"parameters": "()",
"return": "JWTCreator.Builder",
"signature": "JWTCreator.Builder create()",
"testcase": false
}
],
"superclass": ""
} | {
"body": "public static Verification require(Algorithm algorithm) {\n return JWTVerifier.init(algorithm);\n }",
"class_method_signature": "JWT.require(Algorithm algorithm)",
"constructor": false,
"full_signature": "public static Verification require(Algorithm algorithm)",
"identifier": "require",
"invocations": [
"init"
],
"modifiers": "public static",
"parameters": "(Algorithm algorithm)",
"return": "Verification",
"signature": "Verification require(Algorithm algorithm)",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 691,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 17517521,
"size": 936,
"stargazer_count": 3678,
"stars": null,
"updates": null,
"url": "https://github.com/auth0/java-jwt"
} |
17517521_56 | {
"fields": [
{
"declarator": "exception = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException exception = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "exception"
}
],
"file": "lib/src/test/java/com/auth0/jwt/algorithms/AlgorithmTest.java",
"identifier": "AlgorithmTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void shouldThrowRSA256InstanceWithNullKeys() throws Exception {\n exception.expect(IllegalArgumentException.class);\n exception.expectMessage(\"Both provided Keys cannot be null.\");\n Algorithm.RSA256(null, null);\n }",
"class_method_signature": "AlgorithmTest.shouldThrowRSA256InstanceWithNullKeys()",
"constructor": false,
"full_signature": "@Test public void shouldThrowRSA256InstanceWithNullKeys()",
"identifier": "shouldThrowRSA256InstanceWithNullKeys",
"invocations": [
"expect",
"expectMessage",
"RSA256"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void shouldThrowRSA256InstanceWithNullKeys()",
"testcase": true
} | {
"fields": [
{
"declarator": "name",
"modifier": "private final",
"original_string": "private final String name;",
"type": "String",
"var_name": "name"
},
{
"declarator": "description",
"modifier": "private final",
"original_string": "private final String description;",
"type": "String",
"var_name": "description"
}
],
"file": "lib/src/main/java/com/auth0/jwt/algorithms/Algorithm.java",
"identifier": "Algorithm",
"interfaces": "",
"methods": [
{
"class_method_signature": "Algorithm.RSA256(RSAKeyProvider keyProvider)",
"constructor": false,
"full_signature": "public static Algorithm RSA256(RSAKeyProvider keyProvider)",
"identifier": "RSA256",
"modifiers": "public static",
"parameters": "(RSAKeyProvider keyProvider)",
"return": "Algorithm",
"signature": "Algorithm RSA256(RSAKeyProvider keyProvider)",
"testcase": false
},
{
"class_method_signature": "Algorithm.RSA256(RSAPublicKey publicKey, RSAPrivateKey privateKey)",
"constructor": false,
"full_signature": "public static Algorithm RSA256(RSAPublicKey publicKey, RSAPrivateKey privateKey)",
"identifier": "RSA256",
"modifiers": "public static",
"parameters": "(RSAPublicKey publicKey, RSAPrivateKey privateKey)",
"return": "Algorithm",
"signature": "Algorithm RSA256(RSAPublicKey publicKey, RSAPrivateKey privateKey)",
"testcase": false
},
{
"class_method_signature": "Algorithm.RSA256(RSAKey key)",
"constructor": false,
"full_signature": "@Deprecated public static Algorithm RSA256(RSAKey key)",
"identifier": "RSA256",
"modifiers": "@Deprecated public static",
"parameters": "(RSAKey key)",
"return": "Algorithm",
"signature": "Algorithm RSA256(RSAKey key)",
"testcase": false
},
{
"class_method_signature": "Algorithm.RSA384(RSAKeyProvider keyProvider)",
"constructor": false,
"full_signature": "public static Algorithm RSA384(RSAKeyProvider keyProvider)",
"identifier": "RSA384",
"modifiers": "public static",
"parameters": "(RSAKeyProvider keyProvider)",
"return": "Algorithm",
"signature": "Algorithm RSA384(RSAKeyProvider keyProvider)",
"testcase": false
},
{
"class_method_signature": "Algorithm.RSA384(RSAPublicKey publicKey, RSAPrivateKey privateKey)",
"constructor": false,
"full_signature": "public static Algorithm RSA384(RSAPublicKey publicKey, RSAPrivateKey privateKey)",
"identifier": "RSA384",
"modifiers": "public static",
"parameters": "(RSAPublicKey publicKey, RSAPrivateKey privateKey)",
"return": "Algorithm",
"signature": "Algorithm RSA384(RSAPublicKey publicKey, RSAPrivateKey privateKey)",
"testcase": false
},
{
"class_method_signature": "Algorithm.RSA384(RSAKey key)",
"constructor": false,
"full_signature": "@Deprecated public static Algorithm RSA384(RSAKey key)",
"identifier": "RSA384",
"modifiers": "@Deprecated public static",
"parameters": "(RSAKey key)",
"return": "Algorithm",
"signature": "Algorithm RSA384(RSAKey key)",
"testcase": false
},
{
"class_method_signature": "Algorithm.RSA512(RSAKeyProvider keyProvider)",
"constructor": false,
"full_signature": "public static Algorithm RSA512(RSAKeyProvider keyProvider)",
"identifier": "RSA512",
"modifiers": "public static",
"parameters": "(RSAKeyProvider keyProvider)",
"return": "Algorithm",
"signature": "Algorithm RSA512(RSAKeyProvider keyProvider)",
"testcase": false
},
{
"class_method_signature": "Algorithm.RSA512(RSAPublicKey publicKey, RSAPrivateKey privateKey)",
"constructor": false,
"full_signature": "public static Algorithm RSA512(RSAPublicKey publicKey, RSAPrivateKey privateKey)",
"identifier": "RSA512",
"modifiers": "public static",
"parameters": "(RSAPublicKey publicKey, RSAPrivateKey privateKey)",
"return": "Algorithm",
"signature": "Algorithm RSA512(RSAPublicKey publicKey, RSAPrivateKey privateKey)",
"testcase": false
},
{
"class_method_signature": "Algorithm.RSA512(RSAKey key)",
"constructor": false,
"full_signature": "@Deprecated public static Algorithm RSA512(RSAKey key)",
"identifier": "RSA512",
"modifiers": "@Deprecated public static",
"parameters": "(RSAKey key)",
"return": "Algorithm",
"signature": "Algorithm RSA512(RSAKey key)",
"testcase": false
},
{
"class_method_signature": "Algorithm.HMAC256(String secret)",
"constructor": false,
"full_signature": "public static Algorithm HMAC256(String secret)",
"identifier": "HMAC256",
"modifiers": "public static",
"parameters": "(String secret)",
"return": "Algorithm",
"signature": "Algorithm HMAC256(String secret)",
"testcase": false
},
{
"class_method_signature": "Algorithm.HMAC384(String secret)",
"constructor": false,
"full_signature": "public static Algorithm HMAC384(String secret)",
"identifier": "HMAC384",
"modifiers": "public static",
"parameters": "(String secret)",
"return": "Algorithm",
"signature": "Algorithm HMAC384(String secret)",
"testcase": false
},
{
"class_method_signature": "Algorithm.HMAC512(String secret)",
"constructor": false,
"full_signature": "public static Algorithm HMAC512(String secret)",
"identifier": "HMAC512",
"modifiers": "public static",
"parameters": "(String secret)",
"return": "Algorithm",
"signature": "Algorithm HMAC512(String secret)",
"testcase": false
},
{
"class_method_signature": "Algorithm.HMAC256(byte[] secret)",
"constructor": false,
"full_signature": "public static Algorithm HMAC256(byte[] secret)",
"identifier": "HMAC256",
"modifiers": "public static",
"parameters": "(byte[] secret)",
"return": "Algorithm",
"signature": "Algorithm HMAC256(byte[] secret)",
"testcase": false
},
{
"class_method_signature": "Algorithm.ECDSA256K(ECDSAKeyProvider keyProvider)",
"constructor": false,
"full_signature": "public static Algorithm ECDSA256K(ECDSAKeyProvider keyProvider)",
"identifier": "ECDSA256K",
"modifiers": "public static",
"parameters": "(ECDSAKeyProvider keyProvider)",
"return": "Algorithm",
"signature": "Algorithm ECDSA256K(ECDSAKeyProvider keyProvider)",
"testcase": false
},
{
"class_method_signature": "Algorithm.ECDSA256K(ECPublicKey publicKey, ECPrivateKey privateKey)",
"constructor": false,
"full_signature": "public static Algorithm ECDSA256K(ECPublicKey publicKey, ECPrivateKey privateKey)",
"identifier": "ECDSA256K",
"modifiers": "public static",
"parameters": "(ECPublicKey publicKey, ECPrivateKey privateKey)",
"return": "Algorithm",
"signature": "Algorithm ECDSA256K(ECPublicKey publicKey, ECPrivateKey privateKey)",
"testcase": false
},
{
"class_method_signature": "Algorithm.HMAC384(byte[] secret)",
"constructor": false,
"full_signature": "public static Algorithm HMAC384(byte[] secret)",
"identifier": "HMAC384",
"modifiers": "public static",
"parameters": "(byte[] secret)",
"return": "Algorithm",
"signature": "Algorithm HMAC384(byte[] secret)",
"testcase": false
},
{
"class_method_signature": "Algorithm.HMAC512(byte[] secret)",
"constructor": false,
"full_signature": "public static Algorithm HMAC512(byte[] secret)",
"identifier": "HMAC512",
"modifiers": "public static",
"parameters": "(byte[] secret)",
"return": "Algorithm",
"signature": "Algorithm HMAC512(byte[] secret)",
"testcase": false
},
{
"class_method_signature": "Algorithm.ECDSA256(ECDSAKeyProvider keyProvider)",
"constructor": false,
"full_signature": "public static Algorithm ECDSA256(ECDSAKeyProvider keyProvider)",
"identifier": "ECDSA256",
"modifiers": "public static",
"parameters": "(ECDSAKeyProvider keyProvider)",
"return": "Algorithm",
"signature": "Algorithm ECDSA256(ECDSAKeyProvider keyProvider)",
"testcase": false
},
{
"class_method_signature": "Algorithm.ECDSA256(ECPublicKey publicKey, ECPrivateKey privateKey)",
"constructor": false,
"full_signature": "public static Algorithm ECDSA256(ECPublicKey publicKey, ECPrivateKey privateKey)",
"identifier": "ECDSA256",
"modifiers": "public static",
"parameters": "(ECPublicKey publicKey, ECPrivateKey privateKey)",
"return": "Algorithm",
"signature": "Algorithm ECDSA256(ECPublicKey publicKey, ECPrivateKey privateKey)",
"testcase": false
},
{
"class_method_signature": "Algorithm.ECDSA256(ECKey key)",
"constructor": false,
"full_signature": "@Deprecated public static Algorithm ECDSA256(ECKey key)",
"identifier": "ECDSA256",
"modifiers": "@Deprecated public static",
"parameters": "(ECKey key)",
"return": "Algorithm",
"signature": "Algorithm ECDSA256(ECKey key)",
"testcase": false
},
{
"class_method_signature": "Algorithm.ECDSA384(ECDSAKeyProvider keyProvider)",
"constructor": false,
"full_signature": "public static Algorithm ECDSA384(ECDSAKeyProvider keyProvider)",
"identifier": "ECDSA384",
"modifiers": "public static",
"parameters": "(ECDSAKeyProvider keyProvider)",
"return": "Algorithm",
"signature": "Algorithm ECDSA384(ECDSAKeyProvider keyProvider)",
"testcase": false
},
{
"class_method_signature": "Algorithm.ECDSA384(ECPublicKey publicKey, ECPrivateKey privateKey)",
"constructor": false,
"full_signature": "public static Algorithm ECDSA384(ECPublicKey publicKey, ECPrivateKey privateKey)",
"identifier": "ECDSA384",
"modifiers": "public static",
"parameters": "(ECPublicKey publicKey, ECPrivateKey privateKey)",
"return": "Algorithm",
"signature": "Algorithm ECDSA384(ECPublicKey publicKey, ECPrivateKey privateKey)",
"testcase": false
},
{
"class_method_signature": "Algorithm.ECDSA384(ECKey key)",
"constructor": false,
"full_signature": "@Deprecated public static Algorithm ECDSA384(ECKey key)",
"identifier": "ECDSA384",
"modifiers": "@Deprecated public static",
"parameters": "(ECKey key)",
"return": "Algorithm",
"signature": "Algorithm ECDSA384(ECKey key)",
"testcase": false
},
{
"class_method_signature": "Algorithm.ECDSA512(ECDSAKeyProvider keyProvider)",
"constructor": false,
"full_signature": "public static Algorithm ECDSA512(ECDSAKeyProvider keyProvider)",
"identifier": "ECDSA512",
"modifiers": "public static",
"parameters": "(ECDSAKeyProvider keyProvider)",
"return": "Algorithm",
"signature": "Algorithm ECDSA512(ECDSAKeyProvider keyProvider)",
"testcase": false
},
{
"class_method_signature": "Algorithm.ECDSA512(ECPublicKey publicKey, ECPrivateKey privateKey)",
"constructor": false,
"full_signature": "public static Algorithm ECDSA512(ECPublicKey publicKey, ECPrivateKey privateKey)",
"identifier": "ECDSA512",
"modifiers": "public static",
"parameters": "(ECPublicKey publicKey, ECPrivateKey privateKey)",
"return": "Algorithm",
"signature": "Algorithm ECDSA512(ECPublicKey publicKey, ECPrivateKey privateKey)",
"testcase": false
},
{
"class_method_signature": "Algorithm.ECDSA512(ECKey key)",
"constructor": false,
"full_signature": "@Deprecated public static Algorithm ECDSA512(ECKey key)",
"identifier": "ECDSA512",
"modifiers": "@Deprecated public static",
"parameters": "(ECKey key)",
"return": "Algorithm",
"signature": "Algorithm ECDSA512(ECKey key)",
"testcase": false
},
{
"class_method_signature": "Algorithm.none()",
"constructor": false,
"full_signature": "public static Algorithm none()",
"identifier": "none",
"modifiers": "public static",
"parameters": "()",
"return": "Algorithm",
"signature": "Algorithm none()",
"testcase": false
},
{
"class_method_signature": "Algorithm.Algorithm(String name, String description)",
"constructor": true,
"full_signature": "protected Algorithm(String name, String description)",
"identifier": "Algorithm",
"modifiers": "protected",
"parameters": "(String name, String description)",
"return": "",
"signature": " Algorithm(String name, String description)",
"testcase": false
},
{
"class_method_signature": "Algorithm.getSigningKeyId()",
"constructor": false,
"full_signature": "public String getSigningKeyId()",
"identifier": "getSigningKeyId",
"modifiers": "public",
"parameters": "()",
"return": "String",
"signature": "String getSigningKeyId()",
"testcase": false
},
{
"class_method_signature": "Algorithm.getName()",
"constructor": false,
"full_signature": "public String getName()",
"identifier": "getName",
"modifiers": "public",
"parameters": "()",
"return": "String",
"signature": "String getName()",
"testcase": false
},
{
"class_method_signature": "Algorithm.getDescription()",
"constructor": false,
"full_signature": " String getDescription()",
"identifier": "getDescription",
"modifiers": "",
"parameters": "()",
"return": "String",
"signature": "String getDescription()",
"testcase": false
},
{
"class_method_signature": "Algorithm.toString()",
"constructor": false,
"full_signature": "@Override public String toString()",
"identifier": "toString",
"modifiers": "@Override public",
"parameters": "()",
"return": "String",
"signature": "String toString()",
"testcase": false
},
{
"class_method_signature": "Algorithm.verify(DecodedJWT jwt)",
"constructor": false,
"full_signature": "public abstract void verify(DecodedJWT jwt)",
"identifier": "verify",
"modifiers": "public abstract",
"parameters": "(DecodedJWT jwt)",
"return": "void",
"signature": "void verify(DecodedJWT jwt)",
"testcase": false
},
{
"class_method_signature": "Algorithm.sign(byte[] headerBytes, byte[] payloadBytes)",
"constructor": false,
"full_signature": "public byte[] sign(byte[] headerBytes, byte[] payloadBytes)",
"identifier": "sign",
"modifiers": "public",
"parameters": "(byte[] headerBytes, byte[] payloadBytes)",
"return": "byte[]",
"signature": "byte[] sign(byte[] headerBytes, byte[] payloadBytes)",
"testcase": false
},
{
"class_method_signature": "Algorithm.sign(byte[] contentBytes)",
"constructor": false,
"full_signature": "@Deprecated public abstract byte[] sign(byte[] contentBytes)",
"identifier": "sign",
"modifiers": "@Deprecated public abstract",
"parameters": "(byte[] contentBytes)",
"return": "byte[]",
"signature": "byte[] sign(byte[] contentBytes)",
"testcase": false
}
],
"superclass": ""
} | {
"body": "public static Algorithm RSA256(RSAKeyProvider keyProvider) throws IllegalArgumentException {\n return new RSAAlgorithm(\"RS256\", \"SHA256withRSA\", keyProvider);\n }",
"class_method_signature": "Algorithm.RSA256(RSAKeyProvider keyProvider)",
"constructor": false,
"full_signature": "public static Algorithm RSA256(RSAKeyProvider keyProvider)",
"identifier": "RSA256",
"invocations": [],
"modifiers": "public static",
"parameters": "(RSAKeyProvider keyProvider)",
"return": "Algorithm",
"signature": "Algorithm RSA256(RSAKeyProvider keyProvider)",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 691,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 17517521,
"size": 936,
"stargazer_count": 3678,
"stars": null,
"updates": null,
"url": "https://github.com/auth0/java-jwt"
} |
17517521_149 | {
"fields": [
{
"declarator": "PRIVATE_KEY_FILE_256 = \"src/test/resources/ec256-key-private.pem\"",
"modifier": "private static final",
"original_string": "private static final String PRIVATE_KEY_FILE_256 = \"src/test/resources/ec256-key-private.pem\";",
"type": "String",
"var_name": "PRIVATE_KEY_FILE_256"
},
{
"declarator": "PUBLIC_KEY_FILE_256 = \"src/test/resources/ec256-key-public.pem\"",
"modifier": "private static final",
"original_string": "private static final String PUBLIC_KEY_FILE_256 = \"src/test/resources/ec256-key-public.pem\";",
"type": "String",
"var_name": "PUBLIC_KEY_FILE_256"
},
{
"declarator": "INVALID_PUBLIC_KEY_FILE_256 = \"src/test/resources/ec256-key-public-invalid.pem\"",
"modifier": "private static final",
"original_string": "private static final String INVALID_PUBLIC_KEY_FILE_256 = \"src/test/resources/ec256-key-public-invalid.pem\";",
"type": "String",
"var_name": "INVALID_PUBLIC_KEY_FILE_256"
},
{
"declarator": "PRIVATE_KEY_FILE_256K = \"src/test/resources/ec256k-key-private.pem\"",
"modifier": "private static final",
"original_string": "private static final String PRIVATE_KEY_FILE_256K = \"src/test/resources/ec256k-key-private.pem\";",
"type": "String",
"var_name": "PRIVATE_KEY_FILE_256K"
},
{
"declarator": "PUBLIC_KEY_FILE_256K = \"src/test/resources/ec256k-key-public.pem\"",
"modifier": "private static final",
"original_string": "private static final String PUBLIC_KEY_FILE_256K = \"src/test/resources/ec256k-key-public.pem\";",
"type": "String",
"var_name": "PUBLIC_KEY_FILE_256K"
},
{
"declarator": "INVALID_PUBLIC_KEY_FILE_256K = \"src/test/resources/ec256k-key-public-invalid.pem\"",
"modifier": "private static final",
"original_string": "private static final String INVALID_PUBLIC_KEY_FILE_256K = \"src/test/resources/ec256k-key-public-invalid.pem\";",
"type": "String",
"var_name": "INVALID_PUBLIC_KEY_FILE_256K"
},
{
"declarator": "ES256K_JWT = \"eyJraWQiOiJteS1rZXktaWQiLCJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NksifQ.e30.2ggPsc4xwQhYcgJueo3uQ14MpaVJ3AbEE8UE-wA9fc8SMibeW54gjZbikL-JBHqhEwc22Cp8DNOtadXsM81RGQ\"",
"modifier": "private static final",
"original_string": "private static final String ES256K_JWT = \"eyJraWQiOiJteS1rZXktaWQiLCJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NksifQ.e30.2ggPsc4xwQhYcgJueo3uQ14MpaVJ3AbEE8UE-wA9fc8SMibeW54gjZbikL-JBHqhEwc22Cp8DNOtadXsM81RGQ\";",
"type": "String",
"var_name": "ES256K_JWT"
},
{
"declarator": "PRIVATE_KEY_FILE_384 = \"src/test/resources/ec384-key-private.pem\"",
"modifier": "private static final",
"original_string": "private static final String PRIVATE_KEY_FILE_384 = \"src/test/resources/ec384-key-private.pem\";",
"type": "String",
"var_name": "PRIVATE_KEY_FILE_384"
},
{
"declarator": "PUBLIC_KEY_FILE_384 = \"src/test/resources/ec384-key-public.pem\"",
"modifier": "private static final",
"original_string": "private static final String PUBLIC_KEY_FILE_384 = \"src/test/resources/ec384-key-public.pem\";",
"type": "String",
"var_name": "PUBLIC_KEY_FILE_384"
},
{
"declarator": "INVALID_PUBLIC_KEY_FILE_384 = \"src/test/resources/ec384-key-public-invalid.pem\"",
"modifier": "private static final",
"original_string": "private static final String INVALID_PUBLIC_KEY_FILE_384 = \"src/test/resources/ec384-key-public-invalid.pem\";",
"type": "String",
"var_name": "INVALID_PUBLIC_KEY_FILE_384"
},
{
"declarator": "PRIVATE_KEY_FILE_512 = \"src/test/resources/ec512-key-private.pem\"",
"modifier": "private static final",
"original_string": "private static final String PRIVATE_KEY_FILE_512 = \"src/test/resources/ec512-key-private.pem\";",
"type": "String",
"var_name": "PRIVATE_KEY_FILE_512"
},
{
"declarator": "PUBLIC_KEY_FILE_512 = \"src/test/resources/ec512-key-public.pem\"",
"modifier": "private static final",
"original_string": "private static final String PUBLIC_KEY_FILE_512 = \"src/test/resources/ec512-key-public.pem\";",
"type": "String",
"var_name": "PUBLIC_KEY_FILE_512"
},
{
"declarator": "INVALID_PUBLIC_KEY_FILE_512 = \"src/test/resources/ec512-key-public-invalid.pem\"",
"modifier": "private static final",
"original_string": "private static final String INVALID_PUBLIC_KEY_FILE_512 = \"src/test/resources/ec512-key-public-invalid.pem\";",
"type": "String",
"var_name": "INVALID_PUBLIC_KEY_FILE_512"
},
{
"declarator": "exception = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException exception = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "exception"
},
{
"declarator": "ES256Header = \"eyJhbGciOiJFUzI1NiJ9\"",
"modifier": "private static final",
"original_string": "private static final String ES256Header = \"eyJhbGciOiJFUzI1NiJ9\";",
"type": "String",
"var_name": "ES256Header"
},
{
"declarator": "ES384Header = \"eyJhbGciOiJFUzM4NCJ9\"",
"modifier": "private static final",
"original_string": "private static final String ES384Header = \"eyJhbGciOiJFUzM4NCJ9\";",
"type": "String",
"var_name": "ES384Header"
},
{
"declarator": "ES512Header = \"eyJhbGciOiJFUzUxMiJ9\"",
"modifier": "private static final",
"original_string": "private static final String ES512Header = \"eyJhbGciOiJFUzUxMiJ9\";",
"type": "String",
"var_name": "ES512Header"
},
{
"declarator": "auth0IssPayload = \"eyJpc3MiOiJhdXRoMCJ9\"",
"modifier": "private static final",
"original_string": "private static final String auth0IssPayload = \"eyJpc3MiOiJhdXRoMCJ9\";",
"type": "String",
"var_name": "auth0IssPayload"
},
{
"declarator": "ES256HeaderBytes = ES256Header.getBytes(StandardCharsets.UTF_8)",
"modifier": "private static final",
"original_string": "private static final byte[] ES256HeaderBytes = ES256Header.getBytes(StandardCharsets.UTF_8);",
"type": "byte[]",
"var_name": "ES256HeaderBytes"
},
{
"declarator": "ES384HeaderBytes = ES384Header.getBytes(StandardCharsets.UTF_8)",
"modifier": "private static final",
"original_string": "private static final byte[] ES384HeaderBytes = ES384Header.getBytes(StandardCharsets.UTF_8);",
"type": "byte[]",
"var_name": "ES384HeaderBytes"
},
{
"declarator": "ES512HeaderBytes = ES512Header.getBytes(StandardCharsets.UTF_8)",
"modifier": "private static final",
"original_string": "private static final byte[] ES512HeaderBytes = ES512Header.getBytes(StandardCharsets.UTF_8);",
"type": "byte[]",
"var_name": "ES512HeaderBytes"
},
{
"declarator": "auth0IssPayloadBytes = auth0IssPayload.getBytes(StandardCharsets.UTF_8)",
"modifier": "private static final",
"original_string": "private static final byte[] auth0IssPayloadBytes = auth0IssPayload.getBytes(StandardCharsets.UTF_8);",
"type": "byte[]",
"var_name": "auth0IssPayloadBytes"
}
],
"file": "lib/src/test/java/com/auth0/jwt/algorithms/ECDSAAlgorithmTest.java",
"identifier": "ECDSAAlgorithmTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void shouldPassECDSA256KVerificationWithProvidedPublicKey() throws Exception {\n ECDSAKeyProvider provider = mock(ECDSAKeyProvider.class);\n PublicKey publicKey = readPublicKeyFromFile(PUBLIC_KEY_FILE_256K, \"EC\");\n when(provider.getPublicKeyById(\"my-key-id\")).thenReturn((ECPublicKey) publicKey);\n Algorithm algorithm = Algorithm.ECDSA256K(provider);\n algorithm.verify(JWT.decode(ES256K_JWT));\n }",
"class_method_signature": "ECDSAAlgorithmTest.shouldPassECDSA256KVerificationWithProvidedPublicKey()",
"constructor": false,
"full_signature": "@Test public void shouldPassECDSA256KVerificationWithProvidedPublicKey()",
"identifier": "shouldPassECDSA256KVerificationWithProvidedPublicKey",
"invocations": [
"mock",
"readPublicKeyFromFile",
"thenReturn",
"when",
"getPublicKeyById",
"ECDSA256K",
"verify",
"decode"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void shouldPassECDSA256KVerificationWithProvidedPublicKey()",
"testcase": true
} | {
"fields": [
{
"declarator": "keyProvider",
"modifier": "private final",
"original_string": "private final ECDSAKeyProvider keyProvider;",
"type": "ECDSAKeyProvider",
"var_name": "keyProvider"
},
{
"declarator": "crypto",
"modifier": "private final",
"original_string": "private final CryptoHelper crypto;",
"type": "CryptoHelper",
"var_name": "crypto"
},
{
"declarator": "ecNumberSize",
"modifier": "private final",
"original_string": "private final int ecNumberSize;",
"type": "int",
"var_name": "ecNumberSize"
}
],
"file": "lib/src/main/java/com/auth0/jwt/algorithms/ECDSAAlgorithm.java",
"identifier": "ECDSAAlgorithm",
"interfaces": "",
"methods": [
{
"class_method_signature": "ECDSAAlgorithm.ECDSAAlgorithm(CryptoHelper crypto, String id, String algorithm, int ecNumberSize, ECDSAKeyProvider keyProvider)",
"constructor": true,
"full_signature": " ECDSAAlgorithm(CryptoHelper crypto, String id, String algorithm, int ecNumberSize, ECDSAKeyProvider keyProvider)",
"identifier": "ECDSAAlgorithm",
"modifiers": "",
"parameters": "(CryptoHelper crypto, String id, String algorithm, int ecNumberSize, ECDSAKeyProvider keyProvider)",
"return": "",
"signature": " ECDSAAlgorithm(CryptoHelper crypto, String id, String algorithm, int ecNumberSize, ECDSAKeyProvider keyProvider)",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.ECDSAAlgorithm(String id, String algorithm, int ecNumberSize, ECDSAKeyProvider keyProvider)",
"constructor": true,
"full_signature": " ECDSAAlgorithm(String id, String algorithm, int ecNumberSize, ECDSAKeyProvider keyProvider)",
"identifier": "ECDSAAlgorithm",
"modifiers": "",
"parameters": "(String id, String algorithm, int ecNumberSize, ECDSAKeyProvider keyProvider)",
"return": "",
"signature": " ECDSAAlgorithm(String id, String algorithm, int ecNumberSize, ECDSAKeyProvider keyProvider)",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.verify(DecodedJWT jwt)",
"constructor": false,
"full_signature": "@Override public void verify(DecodedJWT jwt)",
"identifier": "verify",
"modifiers": "@Override public",
"parameters": "(DecodedJWT jwt)",
"return": "void",
"signature": "void verify(DecodedJWT jwt)",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.sign(byte[] headerBytes, byte[] payloadBytes)",
"constructor": false,
"full_signature": "@Override public byte[] sign(byte[] headerBytes, byte[] payloadBytes)",
"identifier": "sign",
"modifiers": "@Override public",
"parameters": "(byte[] headerBytes, byte[] payloadBytes)",
"return": "byte[]",
"signature": "byte[] sign(byte[] headerBytes, byte[] payloadBytes)",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.sign(byte[] contentBytes)",
"constructor": false,
"full_signature": "@Override @Deprecated public byte[] sign(byte[] contentBytes)",
"identifier": "sign",
"modifiers": "@Override @Deprecated public",
"parameters": "(byte[] contentBytes)",
"return": "byte[]",
"signature": "byte[] sign(byte[] contentBytes)",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.getSigningKeyId()",
"constructor": false,
"full_signature": "@Override public String getSigningKeyId()",
"identifier": "getSigningKeyId",
"modifiers": "@Override public",
"parameters": "()",
"return": "String",
"signature": "String getSigningKeyId()",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.DERToJOSE(byte[] derSignature)",
"constructor": false,
"full_signature": " byte[] DERToJOSE(byte[] derSignature)",
"identifier": "DERToJOSE",
"modifiers": "",
"parameters": "(byte[] derSignature)",
"return": "byte[]",
"signature": "byte[] DERToJOSE(byte[] derSignature)",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.JOSEToDER(byte[] joseSignature)",
"constructor": false,
"full_signature": " byte[] JOSEToDER(byte[] joseSignature)",
"identifier": "JOSEToDER",
"modifiers": "",
"parameters": "(byte[] joseSignature)",
"return": "byte[]",
"signature": "byte[] JOSEToDER(byte[] joseSignature)",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.countPadding(byte[] bytes, int fromIndex, int toIndex)",
"constructor": false,
"full_signature": "private int countPadding(byte[] bytes, int fromIndex, int toIndex)",
"identifier": "countPadding",
"modifiers": "private",
"parameters": "(byte[] bytes, int fromIndex, int toIndex)",
"return": "int",
"signature": "int countPadding(byte[] bytes, int fromIndex, int toIndex)",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.providerForKeys(final ECPublicKey publicKey, final ECPrivateKey privateKey)",
"constructor": false,
"full_signature": "static ECDSAKeyProvider providerForKeys(final ECPublicKey publicKey, final ECPrivateKey privateKey)",
"identifier": "providerForKeys",
"modifiers": "static",
"parameters": "(final ECPublicKey publicKey, final ECPrivateKey privateKey)",
"return": "ECDSAKeyProvider",
"signature": "ECDSAKeyProvider providerForKeys(final ECPublicKey publicKey, final ECPrivateKey privateKey)",
"testcase": false
}
],
"superclass": "extends Algorithm"
} | {
"body": "@Override\n public void verify(DecodedJWT jwt) throws SignatureVerificationException {\n byte[] signatureBytes = Base64.decodeBase64(jwt.getSignature());\n\n try {\n ECPublicKey publicKey = keyProvider.getPublicKeyById(jwt.getKeyId());\n if (publicKey == null) {\n throw new IllegalStateException(\"The given Public Key is null.\");\n }\n boolean valid = crypto.verifySignatureFor(getDescription(), publicKey, jwt.getHeader(), jwt.getPayload(), JOSEToDER(signatureBytes));\n\n if (!valid) {\n throw new SignatureVerificationException(this);\n }\n } catch (NoSuchAlgorithmException | SignatureException | InvalidKeyException | IllegalStateException e) {\n throw new SignatureVerificationException(this, e);\n }\n }",
"class_method_signature": "ECDSAAlgorithm.verify(DecodedJWT jwt)",
"constructor": false,
"full_signature": "@Override public void verify(DecodedJWT jwt)",
"identifier": "verify",
"invocations": [
"decodeBase64",
"getSignature",
"getPublicKeyById",
"getKeyId",
"verifySignatureFor",
"getDescription",
"getHeader",
"getPayload",
"JOSEToDER"
],
"modifiers": "@Override public",
"parameters": "(DecodedJWT jwt)",
"return": "void",
"signature": "void verify(DecodedJWT jwt)",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 691,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 17517521,
"size": 936,
"stargazer_count": 3678,
"stars": null,
"updates": null,
"url": "https://github.com/auth0/java-jwt"
} |
17517521_21 | {
"fields": [
{
"declarator": "exception = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException exception = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "exception"
}
],
"file": "lib/src/test/java/com/auth0/jwt/JWTDecoderTest.java",
"identifier": "JWTDecoderTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void shouldGetCustomClaimOfTypeBoolean() throws Exception {\n String token = \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjp0cnVlfQ.FwQ8VfsZNRqBa9PXMinSIQplfLU4-rkCLfIlTLg_MV0\";\n DecodedJWT jwt = JWT.decode(token);\n Assert.assertThat(jwt, is(notNullValue()));\n Assert.assertThat(jwt.getClaim(\"name\").asBoolean(), is(true));\n }",
"class_method_signature": "JWTDecoderTest.shouldGetCustomClaimOfTypeBoolean()",
"constructor": false,
"full_signature": "@Test public void shouldGetCustomClaimOfTypeBoolean()",
"identifier": "shouldGetCustomClaimOfTypeBoolean",
"invocations": [
"decode",
"assertThat",
"is",
"notNullValue",
"assertThat",
"asBoolean",
"getClaim",
"is"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void shouldGetCustomClaimOfTypeBoolean()",
"testcase": true
} | {
"fields": [
{
"declarator": "serialVersionUID = 1873362438023312895L",
"modifier": "private static final",
"original_string": "private static final long serialVersionUID = 1873362438023312895L;",
"type": "long",
"var_name": "serialVersionUID"
},
{
"declarator": "parts",
"modifier": "private final",
"original_string": "private final String[] parts;",
"type": "String[]",
"var_name": "parts"
},
{
"declarator": "header",
"modifier": "private final",
"original_string": "private final Header header;",
"type": "Header",
"var_name": "header"
},
{
"declarator": "payload",
"modifier": "private final",
"original_string": "private final Payload payload;",
"type": "Payload",
"var_name": "payload"
}
],
"file": "lib/src/main/java/com/auth0/jwt/JWTDecoder.java",
"identifier": "JWTDecoder",
"interfaces": "implements DecodedJWT, Serializable",
"methods": [
{
"class_method_signature": "JWTDecoder.JWTDecoder(String jwt)",
"constructor": true,
"full_signature": " JWTDecoder(String jwt)",
"identifier": "JWTDecoder",
"modifiers": "",
"parameters": "(String jwt)",
"return": "",
"signature": " JWTDecoder(String jwt)",
"testcase": false
},
{
"class_method_signature": "JWTDecoder.JWTDecoder(JWTParser converter, String jwt)",
"constructor": true,
"full_signature": " JWTDecoder(JWTParser converter, String jwt)",
"identifier": "JWTDecoder",
"modifiers": "",
"parameters": "(JWTParser converter, String jwt)",
"return": "",
"signature": " JWTDecoder(JWTParser converter, String jwt)",
"testcase": false
},
{
"class_method_signature": "JWTDecoder.getAlgorithm()",
"constructor": false,
"full_signature": "@Override public String getAlgorithm()",
"identifier": "getAlgorithm",
"modifiers": "@Override public",
"parameters": "()",
"return": "String",
"signature": "String getAlgorithm()",
"testcase": false
},
{
"class_method_signature": "JWTDecoder.getType()",
"constructor": false,
"full_signature": "@Override public String getType()",
"identifier": "getType",
"modifiers": "@Override public",
"parameters": "()",
"return": "String",
"signature": "String getType()",
"testcase": false
},
{
"class_method_signature": "JWTDecoder.getContentType()",
"constructor": false,
"full_signature": "@Override public String getContentType()",
"identifier": "getContentType",
"modifiers": "@Override public",
"parameters": "()",
"return": "String",
"signature": "String getContentType()",
"testcase": false
},
{
"class_method_signature": "JWTDecoder.getKeyId()",
"constructor": false,
"full_signature": "@Override public String getKeyId()",
"identifier": "getKeyId",
"modifiers": "@Override public",
"parameters": "()",
"return": "String",
"signature": "String getKeyId()",
"testcase": false
},
{
"class_method_signature": "JWTDecoder.getHeaderClaim(String name)",
"constructor": false,
"full_signature": "@Override public Claim getHeaderClaim(String name)",
"identifier": "getHeaderClaim",
"modifiers": "@Override public",
"parameters": "(String name)",
"return": "Claim",
"signature": "Claim getHeaderClaim(String name)",
"testcase": false
},
{
"class_method_signature": "JWTDecoder.getIssuer()",
"constructor": false,
"full_signature": "@Override public String getIssuer()",
"identifier": "getIssuer",
"modifiers": "@Override public",
"parameters": "()",
"return": "String",
"signature": "String getIssuer()",
"testcase": false
},
{
"class_method_signature": "JWTDecoder.getSubject()",
"constructor": false,
"full_signature": "@Override public String getSubject()",
"identifier": "getSubject",
"modifiers": "@Override public",
"parameters": "()",
"return": "String",
"signature": "String getSubject()",
"testcase": false
},
{
"class_method_signature": "JWTDecoder.getAudience()",
"constructor": false,
"full_signature": "@Override public List<String> getAudience()",
"identifier": "getAudience",
"modifiers": "@Override public",
"parameters": "()",
"return": "List<String>",
"signature": "List<String> getAudience()",
"testcase": false
},
{
"class_method_signature": "JWTDecoder.getExpiresAt()",
"constructor": false,
"full_signature": "@Override public Date getExpiresAt()",
"identifier": "getExpiresAt",
"modifiers": "@Override public",
"parameters": "()",
"return": "Date",
"signature": "Date getExpiresAt()",
"testcase": false
},
{
"class_method_signature": "JWTDecoder.getNotBefore()",
"constructor": false,
"full_signature": "@Override public Date getNotBefore()",
"identifier": "getNotBefore",
"modifiers": "@Override public",
"parameters": "()",
"return": "Date",
"signature": "Date getNotBefore()",
"testcase": false
},
{
"class_method_signature": "JWTDecoder.getIssuedAt()",
"constructor": false,
"full_signature": "@Override public Date getIssuedAt()",
"identifier": "getIssuedAt",
"modifiers": "@Override public",
"parameters": "()",
"return": "Date",
"signature": "Date getIssuedAt()",
"testcase": false
},
{
"class_method_signature": "JWTDecoder.getId()",
"constructor": false,
"full_signature": "@Override public String getId()",
"identifier": "getId",
"modifiers": "@Override public",
"parameters": "()",
"return": "String",
"signature": "String getId()",
"testcase": false
},
{
"class_method_signature": "JWTDecoder.getClaim(String name)",
"constructor": false,
"full_signature": "@Override public Claim getClaim(String name)",
"identifier": "getClaim",
"modifiers": "@Override public",
"parameters": "(String name)",
"return": "Claim",
"signature": "Claim getClaim(String name)",
"testcase": false
},
{
"class_method_signature": "JWTDecoder.getClaims()",
"constructor": false,
"full_signature": "@Override public Map<String, Claim> getClaims()",
"identifier": "getClaims",
"modifiers": "@Override public",
"parameters": "()",
"return": "Map<String, Claim>",
"signature": "Map<String, Claim> getClaims()",
"testcase": false
},
{
"class_method_signature": "JWTDecoder.getHeader()",
"constructor": false,
"full_signature": "@Override public String getHeader()",
"identifier": "getHeader",
"modifiers": "@Override public",
"parameters": "()",
"return": "String",
"signature": "String getHeader()",
"testcase": false
},
{
"class_method_signature": "JWTDecoder.getPayload()",
"constructor": false,
"full_signature": "@Override public String getPayload()",
"identifier": "getPayload",
"modifiers": "@Override public",
"parameters": "()",
"return": "String",
"signature": "String getPayload()",
"testcase": false
},
{
"class_method_signature": "JWTDecoder.getSignature()",
"constructor": false,
"full_signature": "@Override public String getSignature()",
"identifier": "getSignature",
"modifiers": "@Override public",
"parameters": "()",
"return": "String",
"signature": "String getSignature()",
"testcase": false
},
{
"class_method_signature": "JWTDecoder.getToken()",
"constructor": false,
"full_signature": "@Override public String getToken()",
"identifier": "getToken",
"modifiers": "@Override public",
"parameters": "()",
"return": "String",
"signature": "String getToken()",
"testcase": false
}
],
"superclass": ""
} | {
"body": "@Override\n public Claim getClaim(String name) {\n return payload.getClaim(name);\n }",
"class_method_signature": "JWTDecoder.getClaim(String name)",
"constructor": false,
"full_signature": "@Override public Claim getClaim(String name)",
"identifier": "getClaim",
"invocations": [
"getClaim"
],
"modifiers": "@Override public",
"parameters": "(String name)",
"return": "Claim",
"signature": "Claim getClaim(String name)",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 691,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 17517521,
"size": 936,
"stargazer_count": 3678,
"stars": null,
"updates": null,
"url": "https://github.com/auth0/java-jwt"
} |
17517521_325 | {
"fields": [
{
"declarator": "exception = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException exception = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "exception"
},
{
"declarator": "deserializer",
"modifier": "private",
"original_string": "private PayloadDeserializer deserializer;",
"type": "PayloadDeserializer",
"var_name": "deserializer"
}
],
"file": "lib/src/test/java/com/auth0/jwt/impl/PayloadDeserializerTest.java",
"identifier": "PayloadDeserializerTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void shouldThrowWhenParsingNonNumericNode() throws Exception {\n exception.expect(JWTDecodeException.class);\n exception.expectMessage(\"The claim 'key' contained a non-numeric date value.\");\n\n Map<String, JsonNode> tree = new HashMap<>();\n TextNode node = new TextNode(\"123456789\");\n tree.put(\"key\", node);\n\n deserializer.getDateFromSeconds(tree, \"key\");\n }",
"class_method_signature": "PayloadDeserializerTest.shouldThrowWhenParsingNonNumericNode()",
"constructor": false,
"full_signature": "@Test public void shouldThrowWhenParsingNonNumericNode()",
"identifier": "shouldThrowWhenParsingNonNumericNode",
"invocations": [
"expect",
"expectMessage",
"put",
"getDateFromSeconds"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void shouldThrowWhenParsingNonNumericNode()",
"testcase": true
} | {
"fields": [
{
"declarator": "objectReader",
"modifier": "private final",
"original_string": "private final ObjectReader objectReader;",
"type": "ObjectReader",
"var_name": "objectReader"
}
],
"file": "lib/src/main/java/com/auth0/jwt/impl/PayloadDeserializer.java",
"identifier": "PayloadDeserializer",
"interfaces": "",
"methods": [
{
"class_method_signature": "PayloadDeserializer.PayloadDeserializer(ObjectReader reader)",
"constructor": true,
"full_signature": " PayloadDeserializer(ObjectReader reader)",
"identifier": "PayloadDeserializer",
"modifiers": "",
"parameters": "(ObjectReader reader)",
"return": "",
"signature": " PayloadDeserializer(ObjectReader reader)",
"testcase": false
},
{
"class_method_signature": "PayloadDeserializer.PayloadDeserializer(Class<?> vc, ObjectReader reader)",
"constructor": true,
"full_signature": "private PayloadDeserializer(Class<?> vc, ObjectReader reader)",
"identifier": "PayloadDeserializer",
"modifiers": "private",
"parameters": "(Class<?> vc, ObjectReader reader)",
"return": "",
"signature": " PayloadDeserializer(Class<?> vc, ObjectReader reader)",
"testcase": false
},
{
"class_method_signature": "PayloadDeserializer.deserialize(JsonParser p, DeserializationContext ctxt)",
"constructor": false,
"full_signature": "@Override public Payload deserialize(JsonParser p, DeserializationContext ctxt)",
"identifier": "deserialize",
"modifiers": "@Override public",
"parameters": "(JsonParser p, DeserializationContext ctxt)",
"return": "Payload",
"signature": "Payload deserialize(JsonParser p, DeserializationContext ctxt)",
"testcase": false
},
{
"class_method_signature": "PayloadDeserializer.getStringOrArray(Map<String, JsonNode> tree, String claimName)",
"constructor": false,
"full_signature": " List<String> getStringOrArray(Map<String, JsonNode> tree, String claimName)",
"identifier": "getStringOrArray",
"modifiers": "",
"parameters": "(Map<String, JsonNode> tree, String claimName)",
"return": "List<String>",
"signature": "List<String> getStringOrArray(Map<String, JsonNode> tree, String claimName)",
"testcase": false
},
{
"class_method_signature": "PayloadDeserializer.getDateFromSeconds(Map<String, JsonNode> tree, String claimName)",
"constructor": false,
"full_signature": " Date getDateFromSeconds(Map<String, JsonNode> tree, String claimName)",
"identifier": "getDateFromSeconds",
"modifiers": "",
"parameters": "(Map<String, JsonNode> tree, String claimName)",
"return": "Date",
"signature": "Date getDateFromSeconds(Map<String, JsonNode> tree, String claimName)",
"testcase": false
},
{
"class_method_signature": "PayloadDeserializer.getString(Map<String, JsonNode> tree, String claimName)",
"constructor": false,
"full_signature": " String getString(Map<String, JsonNode> tree, String claimName)",
"identifier": "getString",
"modifiers": "",
"parameters": "(Map<String, JsonNode> tree, String claimName)",
"return": "String",
"signature": "String getString(Map<String, JsonNode> tree, String claimName)",
"testcase": false
}
],
"superclass": "extends StdDeserializer<Payload>"
} | {
"body": "Date getDateFromSeconds(Map<String, JsonNode> tree, String claimName) {\n JsonNode node = tree.get(claimName);\n if (node == null || node.isNull()) {\n return null;\n }\n if (!node.canConvertToLong()) {\n throw new JWTDecodeException(String.format(\"The claim '%s' contained a non-numeric date value.\", claimName));\n }\n final long ms = node.asLong() * 1000;\n return new Date(ms);\n }",
"class_method_signature": "PayloadDeserializer.getDateFromSeconds(Map<String, JsonNode> tree, String claimName)",
"constructor": false,
"full_signature": " Date getDateFromSeconds(Map<String, JsonNode> tree, String claimName)",
"identifier": "getDateFromSeconds",
"invocations": [
"get",
"isNull",
"canConvertToLong",
"format",
"asLong"
],
"modifiers": "",
"parameters": "(Map<String, JsonNode> tree, String claimName)",
"return": "Date",
"signature": "Date getDateFromSeconds(Map<String, JsonNode> tree, String claimName)",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 691,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 17517521,
"size": 936,
"stargazer_count": 3678,
"stars": null,
"updates": null,
"url": "https://github.com/auth0/java-jwt"
} |
17517521_260 | {
"fields": [
{
"declarator": "exception = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException exception = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "exception"
},
{
"declarator": "payload",
"modifier": "private",
"original_string": "private PayloadImpl payload;",
"type": "PayloadImpl",
"var_name": "payload"
},
{
"declarator": "expiresAt",
"modifier": "private",
"original_string": "private Date expiresAt;",
"type": "Date",
"var_name": "expiresAt"
},
{
"declarator": "notBefore",
"modifier": "private",
"original_string": "private Date notBefore;",
"type": "Date",
"var_name": "notBefore"
},
{
"declarator": "issuedAt",
"modifier": "private",
"original_string": "private Date issuedAt;",
"type": "Date",
"var_name": "issuedAt"
},
{
"declarator": "mapper",
"modifier": "private",
"original_string": "private ObjectMapper mapper;",
"type": "ObjectMapper",
"var_name": "mapper"
},
{
"declarator": "objectReader",
"modifier": "private",
"original_string": "private ObjectReader objectReader;",
"type": "ObjectReader",
"var_name": "objectReader"
}
],
"file": "lib/src/test/java/com/auth0/jwt/impl/PayloadImplTest.java",
"identifier": "PayloadImplTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void shouldNotAllowToModifyClaimsMap() throws Exception {\n assertThat(payload, is(notNullValue()));\n Map<String, Claim> claims = payload.getClaims();\n assertThat(claims, is(notNullValue()));\n exception.expect(UnsupportedOperationException.class);\n claims.put(\"name\", null);\n }",
"class_method_signature": "PayloadImplTest.shouldNotAllowToModifyClaimsMap()",
"constructor": false,
"full_signature": "@Test public void shouldNotAllowToModifyClaimsMap()",
"identifier": "shouldNotAllowToModifyClaimsMap",
"invocations": [
"assertThat",
"is",
"notNullValue",
"getClaims",
"assertThat",
"is",
"notNullValue",
"expect",
"put"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void shouldNotAllowToModifyClaimsMap()",
"testcase": true
} | {
"fields": [
{
"declarator": "serialVersionUID = 1659021498824562311L",
"modifier": "private static final",
"original_string": "private static final long serialVersionUID = 1659021498824562311L;",
"type": "long",
"var_name": "serialVersionUID"
},
{
"declarator": "issuer",
"modifier": "private final",
"original_string": "private final String issuer;",
"type": "String",
"var_name": "issuer"
},
{
"declarator": "subject",
"modifier": "private final",
"original_string": "private final String subject;",
"type": "String",
"var_name": "subject"
},
{
"declarator": "audience",
"modifier": "private final",
"original_string": "private final List<String> audience;",
"type": "List<String>",
"var_name": "audience"
},
{
"declarator": "expiresAt",
"modifier": "private final",
"original_string": "private final Date expiresAt;",
"type": "Date",
"var_name": "expiresAt"
},
{
"declarator": "notBefore",
"modifier": "private final",
"original_string": "private final Date notBefore;",
"type": "Date",
"var_name": "notBefore"
},
{
"declarator": "issuedAt",
"modifier": "private final",
"original_string": "private final Date issuedAt;",
"type": "Date",
"var_name": "issuedAt"
},
{
"declarator": "jwtId",
"modifier": "private final",
"original_string": "private final String jwtId;",
"type": "String",
"var_name": "jwtId"
},
{
"declarator": "tree",
"modifier": "private final",
"original_string": "private final Map<String, JsonNode> tree;",
"type": "Map<String, JsonNode>",
"var_name": "tree"
},
{
"declarator": "objectReader",
"modifier": "private final",
"original_string": "private final ObjectReader objectReader;",
"type": "ObjectReader",
"var_name": "objectReader"
}
],
"file": "lib/src/main/java/com/auth0/jwt/impl/PayloadImpl.java",
"identifier": "PayloadImpl",
"interfaces": "implements Payload, Serializable",
"methods": [
{
"class_method_signature": "PayloadImpl.PayloadImpl(String issuer, String subject, List<String> audience, Date expiresAt, Date notBefore, Date issuedAt, String jwtId, Map<String, JsonNode> tree, ObjectReader objectReader)",
"constructor": true,
"full_signature": " PayloadImpl(String issuer, String subject, List<String> audience, Date expiresAt, Date notBefore, Date issuedAt, String jwtId, Map<String, JsonNode> tree, ObjectReader objectReader)",
"identifier": "PayloadImpl",
"modifiers": "",
"parameters": "(String issuer, String subject, List<String> audience, Date expiresAt, Date notBefore, Date issuedAt, String jwtId, Map<String, JsonNode> tree, ObjectReader objectReader)",
"return": "",
"signature": " PayloadImpl(String issuer, String subject, List<String> audience, Date expiresAt, Date notBefore, Date issuedAt, String jwtId, Map<String, JsonNode> tree, ObjectReader objectReader)",
"testcase": false
},
{
"class_method_signature": "PayloadImpl.getTree()",
"constructor": false,
"full_signature": " Map<String, JsonNode> getTree()",
"identifier": "getTree",
"modifiers": "",
"parameters": "()",
"return": "Map<String, JsonNode>",
"signature": "Map<String, JsonNode> getTree()",
"testcase": false
},
{
"class_method_signature": "PayloadImpl.getIssuer()",
"constructor": false,
"full_signature": "@Override public String getIssuer()",
"identifier": "getIssuer",
"modifiers": "@Override public",
"parameters": "()",
"return": "String",
"signature": "String getIssuer()",
"testcase": false
},
{
"class_method_signature": "PayloadImpl.getSubject()",
"constructor": false,
"full_signature": "@Override public String getSubject()",
"identifier": "getSubject",
"modifiers": "@Override public",
"parameters": "()",
"return": "String",
"signature": "String getSubject()",
"testcase": false
},
{
"class_method_signature": "PayloadImpl.getAudience()",
"constructor": false,
"full_signature": "@Override public List<String> getAudience()",
"identifier": "getAudience",
"modifiers": "@Override public",
"parameters": "()",
"return": "List<String>",
"signature": "List<String> getAudience()",
"testcase": false
},
{
"class_method_signature": "PayloadImpl.getExpiresAt()",
"constructor": false,
"full_signature": "@Override public Date getExpiresAt()",
"identifier": "getExpiresAt",
"modifiers": "@Override public",
"parameters": "()",
"return": "Date",
"signature": "Date getExpiresAt()",
"testcase": false
},
{
"class_method_signature": "PayloadImpl.getNotBefore()",
"constructor": false,
"full_signature": "@Override public Date getNotBefore()",
"identifier": "getNotBefore",
"modifiers": "@Override public",
"parameters": "()",
"return": "Date",
"signature": "Date getNotBefore()",
"testcase": false
},
{
"class_method_signature": "PayloadImpl.getIssuedAt()",
"constructor": false,
"full_signature": "@Override public Date getIssuedAt()",
"identifier": "getIssuedAt",
"modifiers": "@Override public",
"parameters": "()",
"return": "Date",
"signature": "Date getIssuedAt()",
"testcase": false
},
{
"class_method_signature": "PayloadImpl.getId()",
"constructor": false,
"full_signature": "@Override public String getId()",
"identifier": "getId",
"modifiers": "@Override public",
"parameters": "()",
"return": "String",
"signature": "String getId()",
"testcase": false
},
{
"class_method_signature": "PayloadImpl.getClaim(String name)",
"constructor": false,
"full_signature": "@Override public Claim getClaim(String name)",
"identifier": "getClaim",
"modifiers": "@Override public",
"parameters": "(String name)",
"return": "Claim",
"signature": "Claim getClaim(String name)",
"testcase": false
},
{
"class_method_signature": "PayloadImpl.getClaims()",
"constructor": false,
"full_signature": "@Override public Map<String, Claim> getClaims()",
"identifier": "getClaims",
"modifiers": "@Override public",
"parameters": "()",
"return": "Map<String, Claim>",
"signature": "Map<String, Claim> getClaims()",
"testcase": false
}
],
"superclass": ""
} | {
"body": "@Override\n public Map<String, Claim> getClaims() {\n Map<String, Claim> claims = new HashMap<>(tree.size() * 2);\n for (String name : tree.keySet()) {\n claims.put(name, extractClaim(name, tree, objectReader));\n }\n return Collections.unmodifiableMap(claims);\n }",
"class_method_signature": "PayloadImpl.getClaims()",
"constructor": false,
"full_signature": "@Override public Map<String, Claim> getClaims()",
"identifier": "getClaims",
"invocations": [
"size",
"keySet",
"put",
"extractClaim",
"unmodifiableMap"
],
"modifiers": "@Override public",
"parameters": "()",
"return": "Map<String, Claim>",
"signature": "Map<String, Claim> getClaims()",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 691,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 17517521,
"size": 936,
"stargazer_count": 3678,
"stars": null,
"updates": null,
"url": "https://github.com/auth0/java-jwt"
} |
17517521_76 | {
"fields": [
{
"declarator": "exception = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException exception = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "exception"
}
],
"file": "lib/src/test/java/com/auth0/jwt/algorithms/NoneAlgorithmTest.java",
"identifier": "NoneAlgorithmTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void shouldFailNoneVerificationWhenSignatureIsPresent() throws Exception {\n exception.expect(SignatureVerificationException.class);\n exception.expectMessage(\"The Token's Signature resulted invalid when verified using the Algorithm: none\");\n String jwt = \"eyJhbGciOiJub25lIiwiY3R5IjoiSldUIn0.eyJpc3MiOiJhdXRoMCJ9.Ox-WRXRaGAuWt2KfPvWiGcCrPqZtbp_4OnQzZXaTfss\";\n Algorithm algorithm = Algorithm.none();\n algorithm.verify(JWT.decode(jwt));\n }",
"class_method_signature": "NoneAlgorithmTest.shouldFailNoneVerificationWhenSignatureIsPresent()",
"constructor": false,
"full_signature": "@Test public void shouldFailNoneVerificationWhenSignatureIsPresent()",
"identifier": "shouldFailNoneVerificationWhenSignatureIsPresent",
"invocations": [
"expect",
"expectMessage",
"none",
"verify",
"decode"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void shouldFailNoneVerificationWhenSignatureIsPresent()",
"testcase": true
} | {
"fields": [],
"file": "lib/src/main/java/com/auth0/jwt/algorithms/NoneAlgorithm.java",
"identifier": "NoneAlgorithm",
"interfaces": "",
"methods": [
{
"class_method_signature": "NoneAlgorithm.NoneAlgorithm()",
"constructor": true,
"full_signature": " NoneAlgorithm()",
"identifier": "NoneAlgorithm",
"modifiers": "",
"parameters": "()",
"return": "",
"signature": " NoneAlgorithm()",
"testcase": false
},
{
"class_method_signature": "NoneAlgorithm.verify(DecodedJWT jwt)",
"constructor": false,
"full_signature": "@Override public void verify(DecodedJWT jwt)",
"identifier": "verify",
"modifiers": "@Override public",
"parameters": "(DecodedJWT jwt)",
"return": "void",
"signature": "void verify(DecodedJWT jwt)",
"testcase": false
},
{
"class_method_signature": "NoneAlgorithm.sign(byte[] headerBytes, byte[] payloadBytes)",
"constructor": false,
"full_signature": "@Override public byte[] sign(byte[] headerBytes, byte[] payloadBytes)",
"identifier": "sign",
"modifiers": "@Override public",
"parameters": "(byte[] headerBytes, byte[] payloadBytes)",
"return": "byte[]",
"signature": "byte[] sign(byte[] headerBytes, byte[] payloadBytes)",
"testcase": false
},
{
"class_method_signature": "NoneAlgorithm.sign(byte[] contentBytes)",
"constructor": false,
"full_signature": "@Override @Deprecated public byte[] sign(byte[] contentBytes)",
"identifier": "sign",
"modifiers": "@Override @Deprecated public",
"parameters": "(byte[] contentBytes)",
"return": "byte[]",
"signature": "byte[] sign(byte[] contentBytes)",
"testcase": false
}
],
"superclass": "extends Algorithm"
} | {
"body": "@Override\n public void verify(DecodedJWT jwt) throws SignatureVerificationException {\n byte[] signatureBytes = Base64.decodeBase64(jwt.getSignature());\n if (signatureBytes.length > 0) {\n throw new SignatureVerificationException(this);\n }\n }",
"class_method_signature": "NoneAlgorithm.verify(DecodedJWT jwt)",
"constructor": false,
"full_signature": "@Override public void verify(DecodedJWT jwt)",
"identifier": "verify",
"invocations": [
"decodeBase64",
"getSignature"
],
"modifiers": "@Override public",
"parameters": "(DecodedJWT jwt)",
"return": "void",
"signature": "void verify(DecodedJWT jwt)",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 691,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 17517521,
"size": 936,
"stargazer_count": 3678,
"stars": null,
"updates": null,
"url": "https://github.com/auth0/java-jwt"
} |
17517521_237 | {
"fields": [
{
"declarator": "exception = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException exception = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "exception"
},
{
"declarator": "deserializer",
"modifier": "private",
"original_string": "private HeaderDeserializer deserializer;",
"type": "HeaderDeserializer",
"var_name": "deserializer"
},
{
"declarator": "objectReader = new ObjectMapper().reader()",
"modifier": "private",
"original_string": "private ObjectReader objectReader = new ObjectMapper().reader();",
"type": "ObjectReader",
"var_name": "objectReader"
}
],
"file": "lib/src/test/java/com/auth0/jwt/impl/HeaderDeserializerTest.java",
"identifier": "HeaderDeserializerTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void shouldNotRemoveKnownPublicClaimsFromTree() throws Exception {\n String headerJSON = \"{\\n\" +\n \" \\\"alg\\\": \\\"HS256\\\",\\n\" +\n \" \\\"typ\\\": \\\"jws\\\",\\n\" +\n \" \\\"cty\\\": \\\"content\\\",\\n\" +\n \" \\\"kid\\\": \\\"key\\\",\\n\" +\n \" \\\"roles\\\": \\\"admin\\\"\\n\" +\n \"}\";\n StringReader reader = new StringReader(headerJSON);\n JsonParser jsonParser = new JsonFactory().createParser(reader);\n ObjectMapper mapper = new ObjectMapper();\n jsonParser.setCodec(mapper);\n\n Header header = deserializer.deserialize(jsonParser, mapper.getDeserializationContext());\n\n assertThat(header, is(notNullValue()));\n assertThat(header.getAlgorithm(), is(\"HS256\"));\n assertThat(header.getType(), is(\"jws\"));\n assertThat(header.getContentType(), is(\"content\"));\n assertThat(header.getKeyId(), is(\"key\"));\n\n assertThat(header.getHeaderClaim(\"roles\").asString(), is(\"admin\"));\n assertThat(header.getHeaderClaim(\"alg\").asString(), is(\"HS256\"));\n assertThat(header.getHeaderClaim(\"typ\").asString(), is(\"jws\"));\n assertThat(header.getHeaderClaim(\"cty\").asString(), is(\"content\"));\n assertThat(header.getHeaderClaim(\"kid\").asString(), is(\"key\"));\n }",
"class_method_signature": "HeaderDeserializerTest.shouldNotRemoveKnownPublicClaimsFromTree()",
"constructor": false,
"full_signature": "@Test public void shouldNotRemoveKnownPublicClaimsFromTree()",
"identifier": "shouldNotRemoveKnownPublicClaimsFromTree",
"invocations": [
"createParser",
"setCodec",
"deserialize",
"getDeserializationContext",
"assertThat",
"is",
"notNullValue",
"assertThat",
"getAlgorithm",
"is",
"assertThat",
"getType",
"is",
"assertThat",
"getContentType",
"is",
"assertThat",
"getKeyId",
"is",
"assertThat",
"asString",
"getHeaderClaim",
"is",
"assertThat",
"asString",
"getHeaderClaim",
"is",
"assertThat",
"asString",
"getHeaderClaim",
"is",
"assertThat",
"asString",
"getHeaderClaim",
"is",
"assertThat",
"asString",
"getHeaderClaim",
"is"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void shouldNotRemoveKnownPublicClaimsFromTree()",
"testcase": true
} | {
"fields": [
{
"declarator": "objectReader",
"modifier": "private final",
"original_string": "private final ObjectReader objectReader;",
"type": "ObjectReader",
"var_name": "objectReader"
}
],
"file": "lib/src/main/java/com/auth0/jwt/impl/HeaderDeserializer.java",
"identifier": "HeaderDeserializer",
"interfaces": "",
"methods": [
{
"class_method_signature": "HeaderDeserializer.HeaderDeserializer(ObjectReader objectReader)",
"constructor": true,
"full_signature": " HeaderDeserializer(ObjectReader objectReader)",
"identifier": "HeaderDeserializer",
"modifiers": "",
"parameters": "(ObjectReader objectReader)",
"return": "",
"signature": " HeaderDeserializer(ObjectReader objectReader)",
"testcase": false
},
{
"class_method_signature": "HeaderDeserializer.HeaderDeserializer(Class<?> vc, ObjectReader objectReader)",
"constructor": true,
"full_signature": "private HeaderDeserializer(Class<?> vc, ObjectReader objectReader)",
"identifier": "HeaderDeserializer",
"modifiers": "private",
"parameters": "(Class<?> vc, ObjectReader objectReader)",
"return": "",
"signature": " HeaderDeserializer(Class<?> vc, ObjectReader objectReader)",
"testcase": false
},
{
"class_method_signature": "HeaderDeserializer.deserialize(JsonParser p, DeserializationContext ctxt)",
"constructor": false,
"full_signature": "@Override public BasicHeader deserialize(JsonParser p, DeserializationContext ctxt)",
"identifier": "deserialize",
"modifiers": "@Override public",
"parameters": "(JsonParser p, DeserializationContext ctxt)",
"return": "BasicHeader",
"signature": "BasicHeader deserialize(JsonParser p, DeserializationContext ctxt)",
"testcase": false
},
{
"class_method_signature": "HeaderDeserializer.getString(Map<String, JsonNode> tree, String claimName)",
"constructor": false,
"full_signature": " String getString(Map<String, JsonNode> tree, String claimName)",
"identifier": "getString",
"modifiers": "",
"parameters": "(Map<String, JsonNode> tree, String claimName)",
"return": "String",
"signature": "String getString(Map<String, JsonNode> tree, String claimName)",
"testcase": false
}
],
"superclass": "extends StdDeserializer<BasicHeader>"
} | {
"body": "@Override\n public BasicHeader deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {\n Map<String, JsonNode> tree = p.getCodec().readValue(p, new TypeReference<Map<String, JsonNode>>() {\n });\n if (tree == null) {\n throw new JWTDecodeException(\"Parsing the Header's JSON resulted on a Null map\");\n }\n\n String algorithm = getString(tree, PublicClaims.ALGORITHM);\n String type = getString(tree, PublicClaims.TYPE);\n String contentType = getString(tree, PublicClaims.CONTENT_TYPE);\n String keyId = getString(tree, PublicClaims.KEY_ID);\n return new BasicHeader(algorithm, type, contentType, keyId, tree, objectReader);\n }",
"class_method_signature": "HeaderDeserializer.deserialize(JsonParser p, DeserializationContext ctxt)",
"constructor": false,
"full_signature": "@Override public BasicHeader deserialize(JsonParser p, DeserializationContext ctxt)",
"identifier": "deserialize",
"invocations": [
"readValue",
"getCodec",
"getString",
"getString",
"getString",
"getString"
],
"modifiers": "@Override public",
"parameters": "(JsonParser p, DeserializationContext ctxt)",
"return": "BasicHeader",
"signature": "BasicHeader deserialize(JsonParser p, DeserializationContext ctxt)",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 691,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 17517521,
"size": 936,
"stargazer_count": 3678,
"stars": null,
"updates": null,
"url": "https://github.com/auth0/java-jwt"
} |
17517521_99 | {
"fields": [
{
"declarator": "PRIVATE_KEY_FILE = \"src/test/resources/rsa-private.pem\"",
"modifier": "private static final",
"original_string": "private static final String PRIVATE_KEY_FILE = \"src/test/resources/rsa-private.pem\";",
"type": "String",
"var_name": "PRIVATE_KEY_FILE"
},
{
"declarator": "PUBLIC_KEY_FILE = \"src/test/resources/rsa-public.pem\"",
"modifier": "private static final",
"original_string": "private static final String PUBLIC_KEY_FILE = \"src/test/resources/rsa-public.pem\";",
"type": "String",
"var_name": "PUBLIC_KEY_FILE"
},
{
"declarator": "INVALID_PUBLIC_KEY_FILE = \"src/test/resources/rsa-public_invalid.pem\"",
"modifier": "private static final",
"original_string": "private static final String INVALID_PUBLIC_KEY_FILE = \"src/test/resources/rsa-public_invalid.pem\";",
"type": "String",
"var_name": "INVALID_PUBLIC_KEY_FILE"
},
{
"declarator": "exception = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException exception = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "exception"
},
{
"declarator": "RS256Header = \"eyJhbGciOiJSUzI1NiJ9\"",
"modifier": "private static final",
"original_string": "private static final String RS256Header = \"eyJhbGciOiJSUzI1NiJ9\";",
"type": "String",
"var_name": "RS256Header"
},
{
"declarator": "RS384Header = \"eyJhbGciOiJSUzM4NCJ9\"",
"modifier": "private static final",
"original_string": "private static final String RS384Header = \"eyJhbGciOiJSUzM4NCJ9\";",
"type": "String",
"var_name": "RS384Header"
},
{
"declarator": "RS512Header = \"eyJhbGciOiJSUzUxMiJ9\"",
"modifier": "private static final",
"original_string": "private static final String RS512Header = \"eyJhbGciOiJSUzUxMiJ9\";",
"type": "String",
"var_name": "RS512Header"
},
{
"declarator": "auth0IssPayload = \"eyJpc3MiOiJhdXRoMCJ9\"",
"modifier": "private static final",
"original_string": "private static final String auth0IssPayload = \"eyJpc3MiOiJhdXRoMCJ9\";",
"type": "String",
"var_name": "auth0IssPayload"
}
],
"file": "lib/src/test/java/com/auth0/jwt/algorithms/RSAAlgorithmTest.java",
"identifier": "RSAAlgorithmTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void shouldFailOnRSA256SigningWhenUsingPublicKey() throws Exception {\n exception.expect(SignatureGenerationException.class);\n exception.expectMessage(\"The Token's Signature couldn't be generated when signing using the Algorithm: SHA256withRSA\");\n exception.expectCause(isA(IllegalStateException.class));\n exception.expectCause(hasMessage(is(\"The given Private Key is null.\")));\n\n Algorithm algorithm = Algorithm.RSA256((RSAKey) readPublicKeyFromFile(PUBLIC_KEY_FILE, \"RSA\"));\n algorithm.sign(new byte[0], new byte[0]);\n }",
"class_method_signature": "RSAAlgorithmTest.shouldFailOnRSA256SigningWhenUsingPublicKey()",
"constructor": false,
"full_signature": "@Test public void shouldFailOnRSA256SigningWhenUsingPublicKey()",
"identifier": "shouldFailOnRSA256SigningWhenUsingPublicKey",
"invocations": [
"expect",
"expectMessage",
"expectCause",
"isA",
"expectCause",
"hasMessage",
"is",
"RSA256",
"readPublicKeyFromFile",
"sign"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void shouldFailOnRSA256SigningWhenUsingPublicKey()",
"testcase": true
} | {
"fields": [
{
"declarator": "keyProvider",
"modifier": "private final",
"original_string": "private final RSAKeyProvider keyProvider;",
"type": "RSAKeyProvider",
"var_name": "keyProvider"
},
{
"declarator": "crypto",
"modifier": "private final",
"original_string": "private final CryptoHelper crypto;",
"type": "CryptoHelper",
"var_name": "crypto"
}
],
"file": "lib/src/main/java/com/auth0/jwt/algorithms/RSAAlgorithm.java",
"identifier": "RSAAlgorithm",
"interfaces": "",
"methods": [
{
"class_method_signature": "RSAAlgorithm.RSAAlgorithm(CryptoHelper crypto, String id, String algorithm, RSAKeyProvider keyProvider)",
"constructor": true,
"full_signature": " RSAAlgorithm(CryptoHelper crypto, String id, String algorithm, RSAKeyProvider keyProvider)",
"identifier": "RSAAlgorithm",
"modifiers": "",
"parameters": "(CryptoHelper crypto, String id, String algorithm, RSAKeyProvider keyProvider)",
"return": "",
"signature": " RSAAlgorithm(CryptoHelper crypto, String id, String algorithm, RSAKeyProvider keyProvider)",
"testcase": false
},
{
"class_method_signature": "RSAAlgorithm.RSAAlgorithm(String id, String algorithm, RSAKeyProvider keyProvider)",
"constructor": true,
"full_signature": " RSAAlgorithm(String id, String algorithm, RSAKeyProvider keyProvider)",
"identifier": "RSAAlgorithm",
"modifiers": "",
"parameters": "(String id, String algorithm, RSAKeyProvider keyProvider)",
"return": "",
"signature": " RSAAlgorithm(String id, String algorithm, RSAKeyProvider keyProvider)",
"testcase": false
},
{
"class_method_signature": "RSAAlgorithm.verify(DecodedJWT jwt)",
"constructor": false,
"full_signature": "@Override public void verify(DecodedJWT jwt)",
"identifier": "verify",
"modifiers": "@Override public",
"parameters": "(DecodedJWT jwt)",
"return": "void",
"signature": "void verify(DecodedJWT jwt)",
"testcase": false
},
{
"class_method_signature": "RSAAlgorithm.sign(byte[] headerBytes, byte[] payloadBytes)",
"constructor": false,
"full_signature": "@Override @Deprecated public byte[] sign(byte[] headerBytes, byte[] payloadBytes)",
"identifier": "sign",
"modifiers": "@Override @Deprecated public",
"parameters": "(byte[] headerBytes, byte[] payloadBytes)",
"return": "byte[]",
"signature": "byte[] sign(byte[] headerBytes, byte[] payloadBytes)",
"testcase": false
},
{
"class_method_signature": "RSAAlgorithm.sign(byte[] contentBytes)",
"constructor": false,
"full_signature": "@Override public byte[] sign(byte[] contentBytes)",
"identifier": "sign",
"modifiers": "@Override public",
"parameters": "(byte[] contentBytes)",
"return": "byte[]",
"signature": "byte[] sign(byte[] contentBytes)",
"testcase": false
},
{
"class_method_signature": "RSAAlgorithm.getSigningKeyId()",
"constructor": false,
"full_signature": "@Override public String getSigningKeyId()",
"identifier": "getSigningKeyId",
"modifiers": "@Override public",
"parameters": "()",
"return": "String",
"signature": "String getSigningKeyId()",
"testcase": false
},
{
"class_method_signature": "RSAAlgorithm.providerForKeys(final RSAPublicKey publicKey, final RSAPrivateKey privateKey)",
"constructor": false,
"full_signature": "static RSAKeyProvider providerForKeys(final RSAPublicKey publicKey, final RSAPrivateKey privateKey)",
"identifier": "providerForKeys",
"modifiers": "static",
"parameters": "(final RSAPublicKey publicKey, final RSAPrivateKey privateKey)",
"return": "RSAKeyProvider",
"signature": "RSAKeyProvider providerForKeys(final RSAPublicKey publicKey, final RSAPrivateKey privateKey)",
"testcase": false
}
],
"superclass": "extends Algorithm"
} | {
"body": "@Override\n @Deprecated\n public byte[] sign(byte[] headerBytes, byte[] payloadBytes) throws SignatureGenerationException {\n try {\n RSAPrivateKey privateKey = keyProvider.getPrivateKey();\n if (privateKey == null) {\n throw new IllegalStateException(\"The given Private Key is null.\");\n }\n return crypto.createSignatureFor(getDescription(), privateKey, headerBytes, payloadBytes);\n } catch (NoSuchAlgorithmException | SignatureException | InvalidKeyException | IllegalStateException e) {\n throw new SignatureGenerationException(this, e);\n }\n }",
"class_method_signature": "RSAAlgorithm.sign(byte[] headerBytes, byte[] payloadBytes)",
"constructor": false,
"full_signature": "@Override @Deprecated public byte[] sign(byte[] headerBytes, byte[] payloadBytes)",
"identifier": "sign",
"invocations": [
"getPrivateKey",
"createSignatureFor",
"getDescription"
],
"modifiers": "@Override @Deprecated public",
"parameters": "(byte[] headerBytes, byte[] payloadBytes)",
"return": "byte[]",
"signature": "byte[] sign(byte[] headerBytes, byte[] payloadBytes)",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 691,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 17517521,
"size": 936,
"stargazer_count": 3678,
"stars": null,
"updates": null,
"url": "https://github.com/auth0/java-jwt"
} |
17517521_108 | {
"fields": [
{
"declarator": "PRIVATE_KEY_FILE = \"src/test/resources/rsa-private.pem\"",
"modifier": "private static final",
"original_string": "private static final String PRIVATE_KEY_FILE = \"src/test/resources/rsa-private.pem\";",
"type": "String",
"var_name": "PRIVATE_KEY_FILE"
},
{
"declarator": "PUBLIC_KEY_FILE = \"src/test/resources/rsa-public.pem\"",
"modifier": "private static final",
"original_string": "private static final String PUBLIC_KEY_FILE = \"src/test/resources/rsa-public.pem\";",
"type": "String",
"var_name": "PUBLIC_KEY_FILE"
},
{
"declarator": "INVALID_PUBLIC_KEY_FILE = \"src/test/resources/rsa-public_invalid.pem\"",
"modifier": "private static final",
"original_string": "private static final String INVALID_PUBLIC_KEY_FILE = \"src/test/resources/rsa-public_invalid.pem\";",
"type": "String",
"var_name": "INVALID_PUBLIC_KEY_FILE"
},
{
"declarator": "exception = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException exception = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "exception"
},
{
"declarator": "RS256Header = \"eyJhbGciOiJSUzI1NiJ9\"",
"modifier": "private static final",
"original_string": "private static final String RS256Header = \"eyJhbGciOiJSUzI1NiJ9\";",
"type": "String",
"var_name": "RS256Header"
},
{
"declarator": "RS384Header = \"eyJhbGciOiJSUzM4NCJ9\"",
"modifier": "private static final",
"original_string": "private static final String RS384Header = \"eyJhbGciOiJSUzM4NCJ9\";",
"type": "String",
"var_name": "RS384Header"
},
{
"declarator": "RS512Header = \"eyJhbGciOiJSUzUxMiJ9\"",
"modifier": "private static final",
"original_string": "private static final String RS512Header = \"eyJhbGciOiJSUzUxMiJ9\";",
"type": "String",
"var_name": "RS512Header"
},
{
"declarator": "auth0IssPayload = \"eyJpc3MiOiJhdXRoMCJ9\"",
"modifier": "private static final",
"original_string": "private static final String auth0IssPayload = \"eyJpc3MiOiJhdXRoMCJ9\";",
"type": "String",
"var_name": "auth0IssPayload"
}
],
"file": "lib/src/test/java/com/auth0/jwt/algorithms/RSAAlgorithmTest.java",
"identifier": "RSAAlgorithmTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void shouldFailOnRSA512SigningWhenProvidedPrivateKeyIsNull() throws Exception {\n exception.expect(SignatureGenerationException.class);\n exception.expectMessage(\"The Token's Signature couldn't be generated when signing using the Algorithm: SHA512withRSA\");\n exception.expectCause(isA(IllegalStateException.class));\n exception.expectCause(hasMessage(is(\"The given Private Key is null.\")));\n\n RSAKeyProvider provider = mock(RSAKeyProvider.class);\n when(provider.getPrivateKey()).thenReturn(null);\n Algorithm algorithm = Algorithm.RSA512(provider);\n algorithm.sign(new byte[0], new byte[0]);\n }",
"class_method_signature": "RSAAlgorithmTest.shouldFailOnRSA512SigningWhenProvidedPrivateKeyIsNull()",
"constructor": false,
"full_signature": "@Test public void shouldFailOnRSA512SigningWhenProvidedPrivateKeyIsNull()",
"identifier": "shouldFailOnRSA512SigningWhenProvidedPrivateKeyIsNull",
"invocations": [
"expect",
"expectMessage",
"expectCause",
"isA",
"expectCause",
"hasMessage",
"is",
"mock",
"thenReturn",
"when",
"getPrivateKey",
"RSA512",
"sign"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void shouldFailOnRSA512SigningWhenProvidedPrivateKeyIsNull()",
"testcase": true
} | {
"fields": [
{
"declarator": "keyProvider",
"modifier": "private final",
"original_string": "private final RSAKeyProvider keyProvider;",
"type": "RSAKeyProvider",
"var_name": "keyProvider"
},
{
"declarator": "crypto",
"modifier": "private final",
"original_string": "private final CryptoHelper crypto;",
"type": "CryptoHelper",
"var_name": "crypto"
}
],
"file": "lib/src/main/java/com/auth0/jwt/algorithms/RSAAlgorithm.java",
"identifier": "RSAAlgorithm",
"interfaces": "",
"methods": [
{
"class_method_signature": "RSAAlgorithm.RSAAlgorithm(CryptoHelper crypto, String id, String algorithm, RSAKeyProvider keyProvider)",
"constructor": true,
"full_signature": " RSAAlgorithm(CryptoHelper crypto, String id, String algorithm, RSAKeyProvider keyProvider)",
"identifier": "RSAAlgorithm",
"modifiers": "",
"parameters": "(CryptoHelper crypto, String id, String algorithm, RSAKeyProvider keyProvider)",
"return": "",
"signature": " RSAAlgorithm(CryptoHelper crypto, String id, String algorithm, RSAKeyProvider keyProvider)",
"testcase": false
},
{
"class_method_signature": "RSAAlgorithm.RSAAlgorithm(String id, String algorithm, RSAKeyProvider keyProvider)",
"constructor": true,
"full_signature": " RSAAlgorithm(String id, String algorithm, RSAKeyProvider keyProvider)",
"identifier": "RSAAlgorithm",
"modifiers": "",
"parameters": "(String id, String algorithm, RSAKeyProvider keyProvider)",
"return": "",
"signature": " RSAAlgorithm(String id, String algorithm, RSAKeyProvider keyProvider)",
"testcase": false
},
{
"class_method_signature": "RSAAlgorithm.verify(DecodedJWT jwt)",
"constructor": false,
"full_signature": "@Override public void verify(DecodedJWT jwt)",
"identifier": "verify",
"modifiers": "@Override public",
"parameters": "(DecodedJWT jwt)",
"return": "void",
"signature": "void verify(DecodedJWT jwt)",
"testcase": false
},
{
"class_method_signature": "RSAAlgorithm.sign(byte[] headerBytes, byte[] payloadBytes)",
"constructor": false,
"full_signature": "@Override @Deprecated public byte[] sign(byte[] headerBytes, byte[] payloadBytes)",
"identifier": "sign",
"modifiers": "@Override @Deprecated public",
"parameters": "(byte[] headerBytes, byte[] payloadBytes)",
"return": "byte[]",
"signature": "byte[] sign(byte[] headerBytes, byte[] payloadBytes)",
"testcase": false
},
{
"class_method_signature": "RSAAlgorithm.sign(byte[] contentBytes)",
"constructor": false,
"full_signature": "@Override public byte[] sign(byte[] contentBytes)",
"identifier": "sign",
"modifiers": "@Override public",
"parameters": "(byte[] contentBytes)",
"return": "byte[]",
"signature": "byte[] sign(byte[] contentBytes)",
"testcase": false
},
{
"class_method_signature": "RSAAlgorithm.getSigningKeyId()",
"constructor": false,
"full_signature": "@Override public String getSigningKeyId()",
"identifier": "getSigningKeyId",
"modifiers": "@Override public",
"parameters": "()",
"return": "String",
"signature": "String getSigningKeyId()",
"testcase": false
},
{
"class_method_signature": "RSAAlgorithm.providerForKeys(final RSAPublicKey publicKey, final RSAPrivateKey privateKey)",
"constructor": false,
"full_signature": "static RSAKeyProvider providerForKeys(final RSAPublicKey publicKey, final RSAPrivateKey privateKey)",
"identifier": "providerForKeys",
"modifiers": "static",
"parameters": "(final RSAPublicKey publicKey, final RSAPrivateKey privateKey)",
"return": "RSAKeyProvider",
"signature": "RSAKeyProvider providerForKeys(final RSAPublicKey publicKey, final RSAPrivateKey privateKey)",
"testcase": false
}
],
"superclass": "extends Algorithm"
} | {
"body": "@Override\n @Deprecated\n public byte[] sign(byte[] headerBytes, byte[] payloadBytes) throws SignatureGenerationException {\n try {\n RSAPrivateKey privateKey = keyProvider.getPrivateKey();\n if (privateKey == null) {\n throw new IllegalStateException(\"The given Private Key is null.\");\n }\n return crypto.createSignatureFor(getDescription(), privateKey, headerBytes, payloadBytes);\n } catch (NoSuchAlgorithmException | SignatureException | InvalidKeyException | IllegalStateException e) {\n throw new SignatureGenerationException(this, e);\n }\n }",
"class_method_signature": "RSAAlgorithm.sign(byte[] headerBytes, byte[] payloadBytes)",
"constructor": false,
"full_signature": "@Override @Deprecated public byte[] sign(byte[] headerBytes, byte[] payloadBytes)",
"identifier": "sign",
"invocations": [
"getPrivateKey",
"createSignatureFor",
"getDescription"
],
"modifiers": "@Override @Deprecated public",
"parameters": "(byte[] headerBytes, byte[] payloadBytes)",
"return": "byte[]",
"signature": "byte[] sign(byte[] headerBytes, byte[] payloadBytes)",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 691,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 17517521,
"size": 936,
"stargazer_count": 3678,
"stars": null,
"updates": null,
"url": "https://github.com/auth0/java-jwt"
} |
17517521_60 | {
"fields": [
{
"declarator": "exception = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException exception = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "exception"
}
],
"file": "lib/src/test/java/com/auth0/jwt/algorithms/AlgorithmTest.java",
"identifier": "AlgorithmTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void shouldThrowRSA384InstanceWithNullKeyProvider() throws Exception {\n exception.expect(IllegalArgumentException.class);\n exception.expectMessage(\"The Key Provider cannot be null.\");\n RSAKeyProvider provider = null;\n Algorithm.RSA384(provider);\n }",
"class_method_signature": "AlgorithmTest.shouldThrowRSA384InstanceWithNullKeyProvider()",
"constructor": false,
"full_signature": "@Test public void shouldThrowRSA384InstanceWithNullKeyProvider()",
"identifier": "shouldThrowRSA384InstanceWithNullKeyProvider",
"invocations": [
"expect",
"expectMessage",
"RSA384"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void shouldThrowRSA384InstanceWithNullKeyProvider()",
"testcase": true
} | {
"fields": [
{
"declarator": "name",
"modifier": "private final",
"original_string": "private final String name;",
"type": "String",
"var_name": "name"
},
{
"declarator": "description",
"modifier": "private final",
"original_string": "private final String description;",
"type": "String",
"var_name": "description"
}
],
"file": "lib/src/main/java/com/auth0/jwt/algorithms/Algorithm.java",
"identifier": "Algorithm",
"interfaces": "",
"methods": [
{
"class_method_signature": "Algorithm.RSA256(RSAKeyProvider keyProvider)",
"constructor": false,
"full_signature": "public static Algorithm RSA256(RSAKeyProvider keyProvider)",
"identifier": "RSA256",
"modifiers": "public static",
"parameters": "(RSAKeyProvider keyProvider)",
"return": "Algorithm",
"signature": "Algorithm RSA256(RSAKeyProvider keyProvider)",
"testcase": false
},
{
"class_method_signature": "Algorithm.RSA256(RSAPublicKey publicKey, RSAPrivateKey privateKey)",
"constructor": false,
"full_signature": "public static Algorithm RSA256(RSAPublicKey publicKey, RSAPrivateKey privateKey)",
"identifier": "RSA256",
"modifiers": "public static",
"parameters": "(RSAPublicKey publicKey, RSAPrivateKey privateKey)",
"return": "Algorithm",
"signature": "Algorithm RSA256(RSAPublicKey publicKey, RSAPrivateKey privateKey)",
"testcase": false
},
{
"class_method_signature": "Algorithm.RSA256(RSAKey key)",
"constructor": false,
"full_signature": "@Deprecated public static Algorithm RSA256(RSAKey key)",
"identifier": "RSA256",
"modifiers": "@Deprecated public static",
"parameters": "(RSAKey key)",
"return": "Algorithm",
"signature": "Algorithm RSA256(RSAKey key)",
"testcase": false
},
{
"class_method_signature": "Algorithm.RSA384(RSAKeyProvider keyProvider)",
"constructor": false,
"full_signature": "public static Algorithm RSA384(RSAKeyProvider keyProvider)",
"identifier": "RSA384",
"modifiers": "public static",
"parameters": "(RSAKeyProvider keyProvider)",
"return": "Algorithm",
"signature": "Algorithm RSA384(RSAKeyProvider keyProvider)",
"testcase": false
},
{
"class_method_signature": "Algorithm.RSA384(RSAPublicKey publicKey, RSAPrivateKey privateKey)",
"constructor": false,
"full_signature": "public static Algorithm RSA384(RSAPublicKey publicKey, RSAPrivateKey privateKey)",
"identifier": "RSA384",
"modifiers": "public static",
"parameters": "(RSAPublicKey publicKey, RSAPrivateKey privateKey)",
"return": "Algorithm",
"signature": "Algorithm RSA384(RSAPublicKey publicKey, RSAPrivateKey privateKey)",
"testcase": false
},
{
"class_method_signature": "Algorithm.RSA384(RSAKey key)",
"constructor": false,
"full_signature": "@Deprecated public static Algorithm RSA384(RSAKey key)",
"identifier": "RSA384",
"modifiers": "@Deprecated public static",
"parameters": "(RSAKey key)",
"return": "Algorithm",
"signature": "Algorithm RSA384(RSAKey key)",
"testcase": false
},
{
"class_method_signature": "Algorithm.RSA512(RSAKeyProvider keyProvider)",
"constructor": false,
"full_signature": "public static Algorithm RSA512(RSAKeyProvider keyProvider)",
"identifier": "RSA512",
"modifiers": "public static",
"parameters": "(RSAKeyProvider keyProvider)",
"return": "Algorithm",
"signature": "Algorithm RSA512(RSAKeyProvider keyProvider)",
"testcase": false
},
{
"class_method_signature": "Algorithm.RSA512(RSAPublicKey publicKey, RSAPrivateKey privateKey)",
"constructor": false,
"full_signature": "public static Algorithm RSA512(RSAPublicKey publicKey, RSAPrivateKey privateKey)",
"identifier": "RSA512",
"modifiers": "public static",
"parameters": "(RSAPublicKey publicKey, RSAPrivateKey privateKey)",
"return": "Algorithm",
"signature": "Algorithm RSA512(RSAPublicKey publicKey, RSAPrivateKey privateKey)",
"testcase": false
},
{
"class_method_signature": "Algorithm.RSA512(RSAKey key)",
"constructor": false,
"full_signature": "@Deprecated public static Algorithm RSA512(RSAKey key)",
"identifier": "RSA512",
"modifiers": "@Deprecated public static",
"parameters": "(RSAKey key)",
"return": "Algorithm",
"signature": "Algorithm RSA512(RSAKey key)",
"testcase": false
},
{
"class_method_signature": "Algorithm.HMAC256(String secret)",
"constructor": false,
"full_signature": "public static Algorithm HMAC256(String secret)",
"identifier": "HMAC256",
"modifiers": "public static",
"parameters": "(String secret)",
"return": "Algorithm",
"signature": "Algorithm HMAC256(String secret)",
"testcase": false
},
{
"class_method_signature": "Algorithm.HMAC384(String secret)",
"constructor": false,
"full_signature": "public static Algorithm HMAC384(String secret)",
"identifier": "HMAC384",
"modifiers": "public static",
"parameters": "(String secret)",
"return": "Algorithm",
"signature": "Algorithm HMAC384(String secret)",
"testcase": false
},
{
"class_method_signature": "Algorithm.HMAC512(String secret)",
"constructor": false,
"full_signature": "public static Algorithm HMAC512(String secret)",
"identifier": "HMAC512",
"modifiers": "public static",
"parameters": "(String secret)",
"return": "Algorithm",
"signature": "Algorithm HMAC512(String secret)",
"testcase": false
},
{
"class_method_signature": "Algorithm.HMAC256(byte[] secret)",
"constructor": false,
"full_signature": "public static Algorithm HMAC256(byte[] secret)",
"identifier": "HMAC256",
"modifiers": "public static",
"parameters": "(byte[] secret)",
"return": "Algorithm",
"signature": "Algorithm HMAC256(byte[] secret)",
"testcase": false
},
{
"class_method_signature": "Algorithm.ECDSA256K(ECDSAKeyProvider keyProvider)",
"constructor": false,
"full_signature": "public static Algorithm ECDSA256K(ECDSAKeyProvider keyProvider)",
"identifier": "ECDSA256K",
"modifiers": "public static",
"parameters": "(ECDSAKeyProvider keyProvider)",
"return": "Algorithm",
"signature": "Algorithm ECDSA256K(ECDSAKeyProvider keyProvider)",
"testcase": false
},
{
"class_method_signature": "Algorithm.ECDSA256K(ECPublicKey publicKey, ECPrivateKey privateKey)",
"constructor": false,
"full_signature": "public static Algorithm ECDSA256K(ECPublicKey publicKey, ECPrivateKey privateKey)",
"identifier": "ECDSA256K",
"modifiers": "public static",
"parameters": "(ECPublicKey publicKey, ECPrivateKey privateKey)",
"return": "Algorithm",
"signature": "Algorithm ECDSA256K(ECPublicKey publicKey, ECPrivateKey privateKey)",
"testcase": false
},
{
"class_method_signature": "Algorithm.HMAC384(byte[] secret)",
"constructor": false,
"full_signature": "public static Algorithm HMAC384(byte[] secret)",
"identifier": "HMAC384",
"modifiers": "public static",
"parameters": "(byte[] secret)",
"return": "Algorithm",
"signature": "Algorithm HMAC384(byte[] secret)",
"testcase": false
},
{
"class_method_signature": "Algorithm.HMAC512(byte[] secret)",
"constructor": false,
"full_signature": "public static Algorithm HMAC512(byte[] secret)",
"identifier": "HMAC512",
"modifiers": "public static",
"parameters": "(byte[] secret)",
"return": "Algorithm",
"signature": "Algorithm HMAC512(byte[] secret)",
"testcase": false
},
{
"class_method_signature": "Algorithm.ECDSA256(ECDSAKeyProvider keyProvider)",
"constructor": false,
"full_signature": "public static Algorithm ECDSA256(ECDSAKeyProvider keyProvider)",
"identifier": "ECDSA256",
"modifiers": "public static",
"parameters": "(ECDSAKeyProvider keyProvider)",
"return": "Algorithm",
"signature": "Algorithm ECDSA256(ECDSAKeyProvider keyProvider)",
"testcase": false
},
{
"class_method_signature": "Algorithm.ECDSA256(ECPublicKey publicKey, ECPrivateKey privateKey)",
"constructor": false,
"full_signature": "public static Algorithm ECDSA256(ECPublicKey publicKey, ECPrivateKey privateKey)",
"identifier": "ECDSA256",
"modifiers": "public static",
"parameters": "(ECPublicKey publicKey, ECPrivateKey privateKey)",
"return": "Algorithm",
"signature": "Algorithm ECDSA256(ECPublicKey publicKey, ECPrivateKey privateKey)",
"testcase": false
},
{
"class_method_signature": "Algorithm.ECDSA256(ECKey key)",
"constructor": false,
"full_signature": "@Deprecated public static Algorithm ECDSA256(ECKey key)",
"identifier": "ECDSA256",
"modifiers": "@Deprecated public static",
"parameters": "(ECKey key)",
"return": "Algorithm",
"signature": "Algorithm ECDSA256(ECKey key)",
"testcase": false
},
{
"class_method_signature": "Algorithm.ECDSA384(ECDSAKeyProvider keyProvider)",
"constructor": false,
"full_signature": "public static Algorithm ECDSA384(ECDSAKeyProvider keyProvider)",
"identifier": "ECDSA384",
"modifiers": "public static",
"parameters": "(ECDSAKeyProvider keyProvider)",
"return": "Algorithm",
"signature": "Algorithm ECDSA384(ECDSAKeyProvider keyProvider)",
"testcase": false
},
{
"class_method_signature": "Algorithm.ECDSA384(ECPublicKey publicKey, ECPrivateKey privateKey)",
"constructor": false,
"full_signature": "public static Algorithm ECDSA384(ECPublicKey publicKey, ECPrivateKey privateKey)",
"identifier": "ECDSA384",
"modifiers": "public static",
"parameters": "(ECPublicKey publicKey, ECPrivateKey privateKey)",
"return": "Algorithm",
"signature": "Algorithm ECDSA384(ECPublicKey publicKey, ECPrivateKey privateKey)",
"testcase": false
},
{
"class_method_signature": "Algorithm.ECDSA384(ECKey key)",
"constructor": false,
"full_signature": "@Deprecated public static Algorithm ECDSA384(ECKey key)",
"identifier": "ECDSA384",
"modifiers": "@Deprecated public static",
"parameters": "(ECKey key)",
"return": "Algorithm",
"signature": "Algorithm ECDSA384(ECKey key)",
"testcase": false
},
{
"class_method_signature": "Algorithm.ECDSA512(ECDSAKeyProvider keyProvider)",
"constructor": false,
"full_signature": "public static Algorithm ECDSA512(ECDSAKeyProvider keyProvider)",
"identifier": "ECDSA512",
"modifiers": "public static",
"parameters": "(ECDSAKeyProvider keyProvider)",
"return": "Algorithm",
"signature": "Algorithm ECDSA512(ECDSAKeyProvider keyProvider)",
"testcase": false
},
{
"class_method_signature": "Algorithm.ECDSA512(ECPublicKey publicKey, ECPrivateKey privateKey)",
"constructor": false,
"full_signature": "public static Algorithm ECDSA512(ECPublicKey publicKey, ECPrivateKey privateKey)",
"identifier": "ECDSA512",
"modifiers": "public static",
"parameters": "(ECPublicKey publicKey, ECPrivateKey privateKey)",
"return": "Algorithm",
"signature": "Algorithm ECDSA512(ECPublicKey publicKey, ECPrivateKey privateKey)",
"testcase": false
},
{
"class_method_signature": "Algorithm.ECDSA512(ECKey key)",
"constructor": false,
"full_signature": "@Deprecated public static Algorithm ECDSA512(ECKey key)",
"identifier": "ECDSA512",
"modifiers": "@Deprecated public static",
"parameters": "(ECKey key)",
"return": "Algorithm",
"signature": "Algorithm ECDSA512(ECKey key)",
"testcase": false
},
{
"class_method_signature": "Algorithm.none()",
"constructor": false,
"full_signature": "public static Algorithm none()",
"identifier": "none",
"modifiers": "public static",
"parameters": "()",
"return": "Algorithm",
"signature": "Algorithm none()",
"testcase": false
},
{
"class_method_signature": "Algorithm.Algorithm(String name, String description)",
"constructor": true,
"full_signature": "protected Algorithm(String name, String description)",
"identifier": "Algorithm",
"modifiers": "protected",
"parameters": "(String name, String description)",
"return": "",
"signature": " Algorithm(String name, String description)",
"testcase": false
},
{
"class_method_signature": "Algorithm.getSigningKeyId()",
"constructor": false,
"full_signature": "public String getSigningKeyId()",
"identifier": "getSigningKeyId",
"modifiers": "public",
"parameters": "()",
"return": "String",
"signature": "String getSigningKeyId()",
"testcase": false
},
{
"class_method_signature": "Algorithm.getName()",
"constructor": false,
"full_signature": "public String getName()",
"identifier": "getName",
"modifiers": "public",
"parameters": "()",
"return": "String",
"signature": "String getName()",
"testcase": false
},
{
"class_method_signature": "Algorithm.getDescription()",
"constructor": false,
"full_signature": " String getDescription()",
"identifier": "getDescription",
"modifiers": "",
"parameters": "()",
"return": "String",
"signature": "String getDescription()",
"testcase": false
},
{
"class_method_signature": "Algorithm.toString()",
"constructor": false,
"full_signature": "@Override public String toString()",
"identifier": "toString",
"modifiers": "@Override public",
"parameters": "()",
"return": "String",
"signature": "String toString()",
"testcase": false
},
{
"class_method_signature": "Algorithm.verify(DecodedJWT jwt)",
"constructor": false,
"full_signature": "public abstract void verify(DecodedJWT jwt)",
"identifier": "verify",
"modifiers": "public abstract",
"parameters": "(DecodedJWT jwt)",
"return": "void",
"signature": "void verify(DecodedJWT jwt)",
"testcase": false
},
{
"class_method_signature": "Algorithm.sign(byte[] headerBytes, byte[] payloadBytes)",
"constructor": false,
"full_signature": "public byte[] sign(byte[] headerBytes, byte[] payloadBytes)",
"identifier": "sign",
"modifiers": "public",
"parameters": "(byte[] headerBytes, byte[] payloadBytes)",
"return": "byte[]",
"signature": "byte[] sign(byte[] headerBytes, byte[] payloadBytes)",
"testcase": false
},
{
"class_method_signature": "Algorithm.sign(byte[] contentBytes)",
"constructor": false,
"full_signature": "@Deprecated public abstract byte[] sign(byte[] contentBytes)",
"identifier": "sign",
"modifiers": "@Deprecated public abstract",
"parameters": "(byte[] contentBytes)",
"return": "byte[]",
"signature": "byte[] sign(byte[] contentBytes)",
"testcase": false
}
],
"superclass": ""
} | {
"body": "public static Algorithm RSA384(RSAKeyProvider keyProvider) throws IllegalArgumentException {\n return new RSAAlgorithm(\"RS384\", \"SHA384withRSA\", keyProvider);\n }",
"class_method_signature": "Algorithm.RSA384(RSAKeyProvider keyProvider)",
"constructor": false,
"full_signature": "public static Algorithm RSA384(RSAKeyProvider keyProvider)",
"identifier": "RSA384",
"invocations": [],
"modifiers": "public static",
"parameters": "(RSAKeyProvider keyProvider)",
"return": "Algorithm",
"signature": "Algorithm RSA384(RSAKeyProvider keyProvider)",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 691,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 17517521,
"size": 936,
"stargazer_count": 3678,
"stars": null,
"updates": null,
"url": "https://github.com/auth0/java-jwt"
} |
17517521_221 | {
"fields": [
{
"declarator": "PUBLIC_KEY_FILE_RSA = \"src/test/resources/rsa-public.pem\"",
"modifier": "private static final",
"original_string": "private static final String PUBLIC_KEY_FILE_RSA = \"src/test/resources/rsa-public.pem\";",
"type": "String",
"var_name": "PUBLIC_KEY_FILE_RSA"
},
{
"declarator": "PRIVATE_KEY_FILE_RSA = \"src/test/resources/rsa-private.pem\"",
"modifier": "private static final",
"original_string": "private static final String PRIVATE_KEY_FILE_RSA = \"src/test/resources/rsa-private.pem\";",
"type": "String",
"var_name": "PRIVATE_KEY_FILE_RSA"
},
{
"declarator": "PUBLIC_KEY_FILE_EC_256 = \"src/test/resources/ec256-key-public.pem\"",
"modifier": "private static final",
"original_string": "private static final String PUBLIC_KEY_FILE_EC_256 = \"src/test/resources/ec256-key-public.pem\";",
"type": "String",
"var_name": "PUBLIC_KEY_FILE_EC_256"
},
{
"declarator": "PUBLIC_KEY_FILE_EC_256K = \"src/test/resources/ec256k-key-public.pem\"",
"modifier": "private static final",
"original_string": "private static final String PUBLIC_KEY_FILE_EC_256K = \"src/test/resources/ec256k-key-public.pem\";",
"type": "String",
"var_name": "PUBLIC_KEY_FILE_EC_256K"
},
{
"declarator": "PUBLIC_KEY_FILE_EC_384 = \"src/test/resources/ec384-key-public.pem\"",
"modifier": "private static final",
"original_string": "private static final String PUBLIC_KEY_FILE_EC_384 = \"src/test/resources/ec384-key-public.pem\";",
"type": "String",
"var_name": "PUBLIC_KEY_FILE_EC_384"
},
{
"declarator": "PUBLIC_KEY_FILE_EC_512 = \"src/test/resources/ec512-key-public.pem\"",
"modifier": "private static final",
"original_string": "private static final String PUBLIC_KEY_FILE_EC_512 = \"src/test/resources/ec512-key-public.pem\";",
"type": "String",
"var_name": "PUBLIC_KEY_FILE_EC_512"
},
{
"declarator": "PRIVATE_KEY_FILE_EC_256 = \"src/test/resources/ec256-key-private.pem\"",
"modifier": "private static final",
"original_string": "private static final String PRIVATE_KEY_FILE_EC_256 = \"src/test/resources/ec256-key-private.pem\";",
"type": "String",
"var_name": "PRIVATE_KEY_FILE_EC_256"
},
{
"declarator": "PRIVATE_KEY_FILE_EC_256K = \"src/test/resources/ec256k-key-private.pem\"",
"modifier": "private static final",
"original_string": "private static final String PRIVATE_KEY_FILE_EC_256K = \"src/test/resources/ec256k-key-private.pem\";",
"type": "String",
"var_name": "PRIVATE_KEY_FILE_EC_256K"
},
{
"declarator": "PRIVATE_KEY_FILE_EC_384 = \"src/test/resources/ec384-key-private.pem\"",
"modifier": "private static final",
"original_string": "private static final String PRIVATE_KEY_FILE_EC_384 = \"src/test/resources/ec384-key-private.pem\";",
"type": "String",
"var_name": "PRIVATE_KEY_FILE_EC_384"
},
{
"declarator": "PRIVATE_KEY_FILE_EC_512 = \"src/test/resources/ec512-key-private.pem\"",
"modifier": "private static final",
"original_string": "private static final String PRIVATE_KEY_FILE_EC_512 = \"src/test/resources/ec512-key-private.pem\";",
"type": "String",
"var_name": "PRIVATE_KEY_FILE_EC_512"
},
{
"declarator": "exception = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException exception = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "exception"
}
],
"file": "lib/src/test/java/com/auth0/jwt/JWTTest.java",
"identifier": "JWTTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void shouldGetAlgorithm() throws Exception {\n String token = \"eyJhbGciOiJIUzI1NiJ9.e30.XmNK3GpH3Ys_7wsYBfq4C3M6goz71I7dTgUkuIa5lyQ\";\n DecodedJWT jwt = JWT.require(Algorithm.HMAC256(\"secret\"))\n .build()\n .verify(token);\n\n assertThat(jwt, is(notNullValue()));\n assertThat(jwt.getAlgorithm(), is(\"HS256\"));\n }",
"class_method_signature": "JWTTest.shouldGetAlgorithm()",
"constructor": false,
"full_signature": "@Test public void shouldGetAlgorithm()",
"identifier": "shouldGetAlgorithm",
"invocations": [
"verify",
"build",
"require",
"HMAC256",
"assertThat",
"is",
"notNullValue",
"assertThat",
"getAlgorithm",
"is"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void shouldGetAlgorithm()",
"testcase": true
} | {
"fields": [
{
"declarator": "parser",
"modifier": "private final",
"original_string": "private final JWTParser parser;",
"type": "JWTParser",
"var_name": "parser"
}
],
"file": "lib/src/main/java/com/auth0/jwt/JWT.java",
"identifier": "JWT",
"interfaces": "",
"methods": [
{
"class_method_signature": "JWT.JWT()",
"constructor": true,
"full_signature": "public JWT()",
"identifier": "JWT",
"modifiers": "public",
"parameters": "()",
"return": "",
"signature": " JWT()",
"testcase": false
},
{
"class_method_signature": "JWT.decodeJwt(String token)",
"constructor": false,
"full_signature": "public DecodedJWT decodeJwt(String token)",
"identifier": "decodeJwt",
"modifiers": "public",
"parameters": "(String token)",
"return": "DecodedJWT",
"signature": "DecodedJWT decodeJwt(String token)",
"testcase": false
},
{
"class_method_signature": "JWT.decode(String token)",
"constructor": false,
"full_signature": "public static DecodedJWT decode(String token)",
"identifier": "decode",
"modifiers": "public static",
"parameters": "(String token)",
"return": "DecodedJWT",
"signature": "DecodedJWT decode(String token)",
"testcase": false
},
{
"class_method_signature": "JWT.require(Algorithm algorithm)",
"constructor": false,
"full_signature": "public static Verification require(Algorithm algorithm)",
"identifier": "require",
"modifiers": "public static",
"parameters": "(Algorithm algorithm)",
"return": "Verification",
"signature": "Verification require(Algorithm algorithm)",
"testcase": false
},
{
"class_method_signature": "JWT.create()",
"constructor": false,
"full_signature": "public static JWTCreator.Builder create()",
"identifier": "create",
"modifiers": "public static",
"parameters": "()",
"return": "JWTCreator.Builder",
"signature": "JWTCreator.Builder create()",
"testcase": false
}
],
"superclass": ""
} | {
"body": "public static Verification require(Algorithm algorithm) {\n return JWTVerifier.init(algorithm);\n }",
"class_method_signature": "JWT.require(Algorithm algorithm)",
"constructor": false,
"full_signature": "public static Verification require(Algorithm algorithm)",
"identifier": "require",
"invocations": [
"init"
],
"modifiers": "public static",
"parameters": "(Algorithm algorithm)",
"return": "Verification",
"signature": "Verification require(Algorithm algorithm)",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 691,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 17517521,
"size": 936,
"stargazer_count": 3678,
"stars": null,
"updates": null,
"url": "https://github.com/auth0/java-jwt"
} |
17517521_37 | {
"fields": [
{
"declarator": "DATE_TOKEN_MS_VALUE = 1477592 * 1000",
"modifier": "private static final",
"original_string": "private static final long DATE_TOKEN_MS_VALUE = 1477592 * 1000;",
"type": "long",
"var_name": "DATE_TOKEN_MS_VALUE"
},
{
"declarator": "exception = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException exception = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "exception"
}
],
"file": "lib/src/test/java/com/auth0/jwt/JWTVerifierTest.java",
"identifier": "JWTVerifierTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@SuppressWarnings(\"RedundantCast\")\n @Test\n public void shouldAddDefaultLeewayToDateClaims() throws Exception {\n Algorithm algorithm = mock(Algorithm.class);\n JWTVerifier verifier = JWTVerifier.init(algorithm)\n .build();\n\n assertThat(verifier.claims, is(notNullValue()));\n assertThat(verifier.claims, hasEntry(\"iat\", (Object) 0L));\n assertThat(verifier.claims, hasEntry(\"exp\", (Object) 0L));\n assertThat(verifier.claims, hasEntry(\"nbf\", (Object) 0L));\n }",
"class_method_signature": "JWTVerifierTest.shouldAddDefaultLeewayToDateClaims()",
"constructor": false,
"full_signature": "@SuppressWarnings(\"RedundantCast\") @Test public void shouldAddDefaultLeewayToDateClaims()",
"identifier": "shouldAddDefaultLeewayToDateClaims",
"invocations": [
"mock",
"build",
"init",
"assertThat",
"is",
"notNullValue",
"assertThat",
"hasEntry",
"assertThat",
"hasEntry",
"assertThat",
"hasEntry"
],
"modifiers": "@SuppressWarnings(\"RedundantCast\") @Test public",
"parameters": "()",
"return": "void",
"signature": "void shouldAddDefaultLeewayToDateClaims()",
"testcase": true
} | {
"fields": [
{
"declarator": "algorithm",
"modifier": "private final",
"original_string": "private final Algorithm algorithm;",
"type": "Algorithm",
"var_name": "algorithm"
},
{
"declarator": "claims",
"modifier": "final",
"original_string": "final Map<String, Object> claims;",
"type": "Map<String, Object>",
"var_name": "claims"
},
{
"declarator": "clock",
"modifier": "private final",
"original_string": "private final Clock clock;",
"type": "Clock",
"var_name": "clock"
},
{
"declarator": "parser",
"modifier": "private final",
"original_string": "private final JWTParser parser;",
"type": "JWTParser",
"var_name": "parser"
}
],
"file": "lib/src/main/java/com/auth0/jwt/JWTVerifier.java",
"identifier": "JWTVerifier",
"interfaces": "implements com.auth0.jwt.interfaces.JWTVerifier",
"methods": [
{
"class_method_signature": "JWTVerifier.JWTVerifier(Algorithm algorithm, Map<String, Object> claims, Clock clock)",
"constructor": true,
"full_signature": " JWTVerifier(Algorithm algorithm, Map<String, Object> claims, Clock clock)",
"identifier": "JWTVerifier",
"modifiers": "",
"parameters": "(Algorithm algorithm, Map<String, Object> claims, Clock clock)",
"return": "",
"signature": " JWTVerifier(Algorithm algorithm, Map<String, Object> claims, Clock clock)",
"testcase": false
},
{
"class_method_signature": "JWTVerifier.init(Algorithm algorithm)",
"constructor": false,
"full_signature": "static Verification init(Algorithm algorithm)",
"identifier": "init",
"modifiers": "static",
"parameters": "(Algorithm algorithm)",
"return": "Verification",
"signature": "Verification init(Algorithm algorithm)",
"testcase": false
},
{
"class_method_signature": "JWTVerifier.isNullOrEmpty(String[] args)",
"constructor": false,
"full_signature": "private static boolean isNullOrEmpty(String[] args)",
"identifier": "isNullOrEmpty",
"modifiers": "private static",
"parameters": "(String[] args)",
"return": "boolean",
"signature": "boolean isNullOrEmpty(String[] args)",
"testcase": false
},
{
"class_method_signature": "JWTVerifier.verify(String token)",
"constructor": false,
"full_signature": "@Override public DecodedJWT verify(String token)",
"identifier": "verify",
"modifiers": "@Override public",
"parameters": "(String token)",
"return": "DecodedJWT",
"signature": "DecodedJWT verify(String token)",
"testcase": false
},
{
"class_method_signature": "JWTVerifier.verify(DecodedJWT jwt)",
"constructor": false,
"full_signature": "@Override public DecodedJWT verify(DecodedJWT jwt)",
"identifier": "verify",
"modifiers": "@Override public",
"parameters": "(DecodedJWT jwt)",
"return": "DecodedJWT",
"signature": "DecodedJWT verify(DecodedJWT jwt)",
"testcase": false
},
{
"class_method_signature": "JWTVerifier.verifyAlgorithm(DecodedJWT jwt, Algorithm expectedAlgorithm)",
"constructor": false,
"full_signature": "private void verifyAlgorithm(DecodedJWT jwt, Algorithm expectedAlgorithm)",
"identifier": "verifyAlgorithm",
"modifiers": "private",
"parameters": "(DecodedJWT jwt, Algorithm expectedAlgorithm)",
"return": "void",
"signature": "void verifyAlgorithm(DecodedJWT jwt, Algorithm expectedAlgorithm)",
"testcase": false
},
{
"class_method_signature": "JWTVerifier.verifyClaims(DecodedJWT jwt, Map<String, Object> claims)",
"constructor": false,
"full_signature": "private void verifyClaims(DecodedJWT jwt, Map<String, Object> claims)",
"identifier": "verifyClaims",
"modifiers": "private",
"parameters": "(DecodedJWT jwt, Map<String, Object> claims)",
"return": "void",
"signature": "void verifyClaims(DecodedJWT jwt, Map<String, Object> claims)",
"testcase": false
},
{
"class_method_signature": "JWTVerifier.verifyClaimValues(DecodedJWT jwt, Map.Entry<String, Object> entry)",
"constructor": false,
"full_signature": "private void verifyClaimValues(DecodedJWT jwt, Map.Entry<String, Object> entry)",
"identifier": "verifyClaimValues",
"modifiers": "private",
"parameters": "(DecodedJWT jwt, Map.Entry<String, Object> entry)",
"return": "void",
"signature": "void verifyClaimValues(DecodedJWT jwt, Map.Entry<String, Object> entry)",
"testcase": false
},
{
"class_method_signature": "JWTVerifier.assertClaimPresent(Claim claim, String claimName)",
"constructor": false,
"full_signature": "private void assertClaimPresent(Claim claim, String claimName)",
"identifier": "assertClaimPresent",
"modifiers": "private",
"parameters": "(Claim claim, String claimName)",
"return": "void",
"signature": "void assertClaimPresent(Claim claim, String claimName)",
"testcase": false
},
{
"class_method_signature": "JWTVerifier.assertValidClaim(Claim claim, String claimName, Object value)",
"constructor": false,
"full_signature": "private void assertValidClaim(Claim claim, String claimName, Object value)",
"identifier": "assertValidClaim",
"modifiers": "private",
"parameters": "(Claim claim, String claimName, Object value)",
"return": "void",
"signature": "void assertValidClaim(Claim claim, String claimName, Object value)",
"testcase": false
},
{
"class_method_signature": "JWTVerifier.assertValidStringClaim(String claimName, String value, String expectedValue)",
"constructor": false,
"full_signature": "private void assertValidStringClaim(String claimName, String value, String expectedValue)",
"identifier": "assertValidStringClaim",
"modifiers": "private",
"parameters": "(String claimName, String value, String expectedValue)",
"return": "void",
"signature": "void assertValidStringClaim(String claimName, String value, String expectedValue)",
"testcase": false
},
{
"class_method_signature": "JWTVerifier.assertValidDateClaim(Date date, long leeway, boolean shouldBeFuture)",
"constructor": false,
"full_signature": "private void assertValidDateClaim(Date date, long leeway, boolean shouldBeFuture)",
"identifier": "assertValidDateClaim",
"modifiers": "private",
"parameters": "(Date date, long leeway, boolean shouldBeFuture)",
"return": "void",
"signature": "void assertValidDateClaim(Date date, long leeway, boolean shouldBeFuture)",
"testcase": false
},
{
"class_method_signature": "JWTVerifier.assertDateIsFuture(Date date, long leeway, Date today)",
"constructor": false,
"full_signature": "private void assertDateIsFuture(Date date, long leeway, Date today)",
"identifier": "assertDateIsFuture",
"modifiers": "private",
"parameters": "(Date date, long leeway, Date today)",
"return": "void",
"signature": "void assertDateIsFuture(Date date, long leeway, Date today)",
"testcase": false
},
{
"class_method_signature": "JWTVerifier.assertDateIsPast(Date date, long leeway, Date today)",
"constructor": false,
"full_signature": "private void assertDateIsPast(Date date, long leeway, Date today)",
"identifier": "assertDateIsPast",
"modifiers": "private",
"parameters": "(Date date, long leeway, Date today)",
"return": "void",
"signature": "void assertDateIsPast(Date date, long leeway, Date today)",
"testcase": false
},
{
"class_method_signature": "JWTVerifier.assertValidAudienceClaim(List<String> audience, List<String> value)",
"constructor": false,
"full_signature": "private void assertValidAudienceClaim(List<String> audience, List<String> value)",
"identifier": "assertValidAudienceClaim",
"modifiers": "private",
"parameters": "(List<String> audience, List<String> value)",
"return": "void",
"signature": "void assertValidAudienceClaim(List<String> audience, List<String> value)",
"testcase": false
},
{
"class_method_signature": "JWTVerifier.assertValidIssuerClaim(String issuer, List<String> value)",
"constructor": false,
"full_signature": "private void assertValidIssuerClaim(String issuer, List<String> value)",
"identifier": "assertValidIssuerClaim",
"modifiers": "private",
"parameters": "(String issuer, List<String> value)",
"return": "void",
"signature": "void assertValidIssuerClaim(String issuer, List<String> value)",
"testcase": false
}
],
"superclass": ""
} | {
"body": "static Verification init(Algorithm algorithm) throws IllegalArgumentException {\n return new BaseVerification(algorithm);\n }",
"class_method_signature": "JWTVerifier.init(Algorithm algorithm)",
"constructor": false,
"full_signature": "static Verification init(Algorithm algorithm)",
"identifier": "init",
"invocations": [],
"modifiers": "static",
"parameters": "(Algorithm algorithm)",
"return": "Verification",
"signature": "Verification init(Algorithm algorithm)",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 691,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 17517521,
"size": 936,
"stargazer_count": 3678,
"stars": null,
"updates": null,
"url": "https://github.com/auth0/java-jwt"
} |
17517521_299 | {
"fields": [
{
"declarator": "exception = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException exception = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "exception"
},
{
"declarator": "objectReader = new ObjectMapper().reader()",
"modifier": "private",
"original_string": "private ObjectReader objectReader = new ObjectMapper().reader();",
"type": "ObjectReader",
"var_name": "objectReader"
}
],
"file": "lib/src/test/java/com/auth0/jwt/impl/BasicHeaderTest.java",
"identifier": "BasicHeaderTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void shouldGetExtraClaim() throws Exception {\n Map<String, JsonNode> tree = new HashMap<>();\n tree.put(\"extraClaim\", new TextNode(\"extraValue\"));\n BasicHeader header = new BasicHeader(null, null, null, null, tree, objectReader);\n\n assertThat(header, is(notNullValue()));\n assertThat(header.getHeaderClaim(\"extraClaim\"), is(instanceOf(JsonNodeClaim.class)));\n assertThat(header.getHeaderClaim(\"extraClaim\").asString(), is(\"extraValue\"));\n }",
"class_method_signature": "BasicHeaderTest.shouldGetExtraClaim()",
"constructor": false,
"full_signature": "@Test public void shouldGetExtraClaim()",
"identifier": "shouldGetExtraClaim",
"invocations": [
"put",
"assertThat",
"is",
"notNullValue",
"assertThat",
"getHeaderClaim",
"is",
"instanceOf",
"assertThat",
"asString",
"getHeaderClaim",
"is"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void shouldGetExtraClaim()",
"testcase": true
} | {
"fields": [
{
"declarator": "serialVersionUID = -4659137688548605095L",
"modifier": "private static final",
"original_string": "private static final long serialVersionUID = -4659137688548605095L;",
"type": "long",
"var_name": "serialVersionUID"
},
{
"declarator": "algorithm",
"modifier": "private final",
"original_string": "private final String algorithm;",
"type": "String",
"var_name": "algorithm"
},
{
"declarator": "type",
"modifier": "private final",
"original_string": "private final String type;",
"type": "String",
"var_name": "type"
},
{
"declarator": "contentType",
"modifier": "private final",
"original_string": "private final String contentType;",
"type": "String",
"var_name": "contentType"
},
{
"declarator": "keyId",
"modifier": "private final",
"original_string": "private final String keyId;",
"type": "String",
"var_name": "keyId"
},
{
"declarator": "tree",
"modifier": "private final",
"original_string": "private final Map<String, JsonNode> tree;",
"type": "Map<String, JsonNode>",
"var_name": "tree"
},
{
"declarator": "objectReader",
"modifier": "private final",
"original_string": "private final ObjectReader objectReader;",
"type": "ObjectReader",
"var_name": "objectReader"
}
],
"file": "lib/src/main/java/com/auth0/jwt/impl/BasicHeader.java",
"identifier": "BasicHeader",
"interfaces": "implements Header, Serializable",
"methods": [
{
"class_method_signature": "BasicHeader.BasicHeader(String algorithm, String type, String contentType, String keyId, Map<String, JsonNode> tree, ObjectReader objectReader)",
"constructor": true,
"full_signature": " BasicHeader(String algorithm, String type, String contentType, String keyId, Map<String, JsonNode> tree, ObjectReader objectReader)",
"identifier": "BasicHeader",
"modifiers": "",
"parameters": "(String algorithm, String type, String contentType, String keyId, Map<String, JsonNode> tree, ObjectReader objectReader)",
"return": "",
"signature": " BasicHeader(String algorithm, String type, String contentType, String keyId, Map<String, JsonNode> tree, ObjectReader objectReader)",
"testcase": false
},
{
"class_method_signature": "BasicHeader.getTree()",
"constructor": false,
"full_signature": " Map<String, JsonNode> getTree()",
"identifier": "getTree",
"modifiers": "",
"parameters": "()",
"return": "Map<String, JsonNode>",
"signature": "Map<String, JsonNode> getTree()",
"testcase": false
},
{
"class_method_signature": "BasicHeader.getAlgorithm()",
"constructor": false,
"full_signature": "@Override public String getAlgorithm()",
"identifier": "getAlgorithm",
"modifiers": "@Override public",
"parameters": "()",
"return": "String",
"signature": "String getAlgorithm()",
"testcase": false
},
{
"class_method_signature": "BasicHeader.getType()",
"constructor": false,
"full_signature": "@Override public String getType()",
"identifier": "getType",
"modifiers": "@Override public",
"parameters": "()",
"return": "String",
"signature": "String getType()",
"testcase": false
},
{
"class_method_signature": "BasicHeader.getContentType()",
"constructor": false,
"full_signature": "@Override public String getContentType()",
"identifier": "getContentType",
"modifiers": "@Override public",
"parameters": "()",
"return": "String",
"signature": "String getContentType()",
"testcase": false
},
{
"class_method_signature": "BasicHeader.getKeyId()",
"constructor": false,
"full_signature": "@Override public String getKeyId()",
"identifier": "getKeyId",
"modifiers": "@Override public",
"parameters": "()",
"return": "String",
"signature": "String getKeyId()",
"testcase": false
},
{
"class_method_signature": "BasicHeader.getHeaderClaim(String name)",
"constructor": false,
"full_signature": "@Override public Claim getHeaderClaim(String name)",
"identifier": "getHeaderClaim",
"modifiers": "@Override public",
"parameters": "(String name)",
"return": "Claim",
"signature": "Claim getHeaderClaim(String name)",
"testcase": false
}
],
"superclass": ""
} | {
"body": "@Override\n public Claim getHeaderClaim(String name) {\n return extractClaim(name, tree, objectReader);\n }",
"class_method_signature": "BasicHeader.getHeaderClaim(String name)",
"constructor": false,
"full_signature": "@Override public Claim getHeaderClaim(String name)",
"identifier": "getHeaderClaim",
"invocations": [
"extractClaim"
],
"modifiers": "@Override public",
"parameters": "(String name)",
"return": "Claim",
"signature": "Claim getHeaderClaim(String name)",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 691,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 17517521,
"size": 936,
"stargazer_count": 3678,
"stars": null,
"updates": null,
"url": "https://github.com/auth0/java-jwt"
} |
17517521_276 | {
"fields": [
{
"declarator": "writer",
"modifier": "private",
"original_string": "private StringWriter writer;",
"type": "StringWriter",
"var_name": "writer"
},
{
"declarator": "serializer",
"modifier": "private",
"original_string": "private PayloadSerializer serializer;",
"type": "PayloadSerializer",
"var_name": "serializer"
},
{
"declarator": "jsonGenerator",
"modifier": "private",
"original_string": "private JsonGenerator jsonGenerator;",
"type": "JsonGenerator",
"var_name": "jsonGenerator"
},
{
"declarator": "serializerProvider",
"modifier": "private",
"original_string": "private SerializerProvider serializerProvider;",
"type": "SerializerProvider",
"var_name": "serializerProvider"
}
],
"file": "lib/src/test/java/com/auth0/jwt/impl/PayloadSerializerTest.java",
"identifier": "PayloadSerializerTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void shouldSerializeCustomArrayOfObject() throws Exception {\n UserPojo user1 = new UserPojo(\"Michael\", 1);\n UserPojo user2 = new UserPojo(\"Lucas\", 2);\n ClaimsHolder holder = holderFor(\"users\", new UserPojo[]{user1, user2});\n serializer.serialize(holder, jsonGenerator, serializerProvider);\n jsonGenerator.flush();\n\n assertThat(writer.toString(), is(equalTo(\"{\\\"users\\\":[{\\\"name\\\":\\\"Michael\\\",\\\"id\\\":1},{\\\"name\\\":\\\"Lucas\\\",\\\"id\\\":2}]}\")));\n }",
"class_method_signature": "PayloadSerializerTest.shouldSerializeCustomArrayOfObject()",
"constructor": false,
"full_signature": "@Test public void shouldSerializeCustomArrayOfObject()",
"identifier": "shouldSerializeCustomArrayOfObject",
"invocations": [
"holderFor",
"serialize",
"flush",
"assertThat",
"toString",
"is",
"equalTo"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void shouldSerializeCustomArrayOfObject()",
"testcase": true
} | {
"fields": [],
"file": "lib/src/main/java/com/auth0/jwt/impl/PayloadSerializer.java",
"identifier": "PayloadSerializer",
"interfaces": "",
"methods": [
{
"class_method_signature": "PayloadSerializer.PayloadSerializer()",
"constructor": true,
"full_signature": "public PayloadSerializer()",
"identifier": "PayloadSerializer",
"modifiers": "public",
"parameters": "()",
"return": "",
"signature": " PayloadSerializer()",
"testcase": false
},
{
"class_method_signature": "PayloadSerializer.PayloadSerializer(Class<ClaimsHolder> t)",
"constructor": true,
"full_signature": "private PayloadSerializer(Class<ClaimsHolder> t)",
"identifier": "PayloadSerializer",
"modifiers": "private",
"parameters": "(Class<ClaimsHolder> t)",
"return": "",
"signature": " PayloadSerializer(Class<ClaimsHolder> t)",
"testcase": false
},
{
"class_method_signature": "PayloadSerializer.serialize(ClaimsHolder holder, JsonGenerator gen, SerializerProvider provider)",
"constructor": false,
"full_signature": "@Override public void serialize(ClaimsHolder holder, JsonGenerator gen, SerializerProvider provider)",
"identifier": "serialize",
"modifiers": "@Override public",
"parameters": "(ClaimsHolder holder, JsonGenerator gen, SerializerProvider provider)",
"return": "void",
"signature": "void serialize(ClaimsHolder holder, JsonGenerator gen, SerializerProvider provider)",
"testcase": false
},
{
"class_method_signature": "PayloadSerializer.dateToSeconds(Date date)",
"constructor": false,
"full_signature": "private long dateToSeconds(Date date)",
"identifier": "dateToSeconds",
"modifiers": "private",
"parameters": "(Date date)",
"return": "long",
"signature": "long dateToSeconds(Date date)",
"testcase": false
}
],
"superclass": "extends StdSerializer<ClaimsHolder>"
} | {
"body": "@Override\n public void serialize(ClaimsHolder holder, JsonGenerator gen, SerializerProvider provider) throws IOException {\n\n gen.writeStartObject();\n for (Map.Entry<String, Object> e : holder.getClaims().entrySet()) {\n switch (e.getKey()) {\n case PublicClaims.AUDIENCE:\n if (e.getValue() instanceof String) {\n gen.writeFieldName(e.getKey());\n gen.writeString((String) e.getValue());\n break;\n }\n String[] audArray = (String[]) e.getValue();\n if (audArray.length == 1) {\n gen.writeFieldName(e.getKey());\n gen.writeString(audArray[0]);\n } else if (audArray.length > 1) {\n gen.writeFieldName(e.getKey());\n gen.writeStartArray();\n for (String aud : audArray) {\n gen.writeString(aud);\n }\n gen.writeEndArray();\n }\n break;\n default:\n gen.writeFieldName(e.getKey());\n if (e.getValue() instanceof Date) { // true for EXPIRES_AT, ISSUED_AT, NOT_BEFORE\n gen.writeNumber(dateToSeconds((Date) e.getValue()));\n } else {\n gen.writeObject(e.getValue());\n }\n break;\n }\n }\n\n gen.writeEndObject();\n }",
"class_method_signature": "PayloadSerializer.serialize(ClaimsHolder holder, JsonGenerator gen, SerializerProvider provider)",
"constructor": false,
"full_signature": "@Override public void serialize(ClaimsHolder holder, JsonGenerator gen, SerializerProvider provider)",
"identifier": "serialize",
"invocations": [
"writeStartObject",
"entrySet",
"getClaims",
"getKey",
"getValue",
"writeFieldName",
"getKey",
"writeString",
"getValue",
"getValue",
"writeFieldName",
"getKey",
"writeString",
"writeFieldName",
"getKey",
"writeStartArray",
"writeString",
"writeEndArray",
"writeFieldName",
"getKey",
"getValue",
"writeNumber",
"dateToSeconds",
"getValue",
"writeObject",
"getValue",
"writeEndObject"
],
"modifiers": "@Override public",
"parameters": "(ClaimsHolder holder, JsonGenerator gen, SerializerProvider provider)",
"return": "void",
"signature": "void serialize(ClaimsHolder holder, JsonGenerator gen, SerializerProvider provider)",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 691,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 17517521,
"size": 936,
"stargazer_count": 3678,
"stars": null,
"updates": null,
"url": "https://github.com/auth0/java-jwt"
} |
17517521_124 | {
"fields": [
{
"declarator": "exception = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException exception = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "exception"
},
{
"declarator": "HS256Header = \"eyJhbGciOiJIUzI1NiJ9\"",
"modifier": "private static final",
"original_string": "private static final String HS256Header = \"eyJhbGciOiJIUzI1NiJ9\";",
"type": "String",
"var_name": "HS256Header"
},
{
"declarator": "HS384Header = \"eyJhbGciOiJIUzM4NCJ9\"",
"modifier": "private static final",
"original_string": "private static final String HS384Header = \"eyJhbGciOiJIUzM4NCJ9\";",
"type": "String",
"var_name": "HS384Header"
},
{
"declarator": "HS512Header = \"eyJhbGciOiJIUzUxMiJ9\"",
"modifier": "private static final",
"original_string": "private static final String HS512Header = \"eyJhbGciOiJIUzUxMiJ9\";",
"type": "String",
"var_name": "HS512Header"
},
{
"declarator": "auth0IssPayload = \"eyJpc3MiOiJhdXRoMCJ9\"",
"modifier": "private static final",
"original_string": "private static final String auth0IssPayload = \"eyJpc3MiOiJhdXRoMCJ9\";",
"type": "String",
"var_name": "auth0IssPayload"
}
],
"file": "lib/src/test/java/com/auth0/jwt/algorithms/HMACAlgorithmTest.java",
"identifier": "HMACAlgorithmTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void shouldThrowOnVerifyWhenSignatureAlgorithmDoesNotExists() throws Exception {\n exception.expect(SignatureVerificationException.class);\n exception.expectMessage(\"The Token's Signature resulted invalid when verified using the Algorithm: some-alg\");\n exception.expectCause(isA(NoSuchAlgorithmException.class));\n\n CryptoHelper crypto = mock(CryptoHelper.class);\n when(crypto.verifySignatureFor(anyString(), any(byte[].class), any(String.class), any(String.class), any(byte[].class)))\n .thenThrow(NoSuchAlgorithmException.class);\n\n Algorithm algorithm = new HMACAlgorithm(crypto, \"some-alg\", \"some-algorithm\", \"secret\".getBytes(StandardCharsets.UTF_8));\n String jwt = \"eyJhbGciOiJIUzI1NiIsImN0eSI6IkpXVCJ9.eyJpc3MiOiJhdXRoMCJ9.mZ0m_N1J4PgeqWmi903JuUoDRZDBPB7HwkS4nVyWH1M\";\n algorithm.verify(JWT.decode(jwt));\n }",
"class_method_signature": "HMACAlgorithmTest.shouldThrowOnVerifyWhenSignatureAlgorithmDoesNotExists()",
"constructor": false,
"full_signature": "@Test public void shouldThrowOnVerifyWhenSignatureAlgorithmDoesNotExists()",
"identifier": "shouldThrowOnVerifyWhenSignatureAlgorithmDoesNotExists",
"invocations": [
"expect",
"expectMessage",
"expectCause",
"isA",
"mock",
"thenThrow",
"when",
"verifySignatureFor",
"anyString",
"any",
"any",
"any",
"any",
"getBytes",
"verify",
"decode"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void shouldThrowOnVerifyWhenSignatureAlgorithmDoesNotExists()",
"testcase": true
} | {
"fields": [
{
"declarator": "crypto",
"modifier": "private final",
"original_string": "private final CryptoHelper crypto;",
"type": "CryptoHelper",
"var_name": "crypto"
},
{
"declarator": "secret",
"modifier": "private final",
"original_string": "private final byte[] secret;",
"type": "byte[]",
"var_name": "secret"
}
],
"file": "lib/src/main/java/com/auth0/jwt/algorithms/HMACAlgorithm.java",
"identifier": "HMACAlgorithm",
"interfaces": "",
"methods": [
{
"class_method_signature": "HMACAlgorithm.HMACAlgorithm(CryptoHelper crypto, String id, String algorithm, byte[] secretBytes)",
"constructor": true,
"full_signature": " HMACAlgorithm(CryptoHelper crypto, String id, String algorithm, byte[] secretBytes)",
"identifier": "HMACAlgorithm",
"modifiers": "",
"parameters": "(CryptoHelper crypto, String id, String algorithm, byte[] secretBytes)",
"return": "",
"signature": " HMACAlgorithm(CryptoHelper crypto, String id, String algorithm, byte[] secretBytes)",
"testcase": false
},
{
"class_method_signature": "HMACAlgorithm.HMACAlgorithm(String id, String algorithm, byte[] secretBytes)",
"constructor": true,
"full_signature": " HMACAlgorithm(String id, String algorithm, byte[] secretBytes)",
"identifier": "HMACAlgorithm",
"modifiers": "",
"parameters": "(String id, String algorithm, byte[] secretBytes)",
"return": "",
"signature": " HMACAlgorithm(String id, String algorithm, byte[] secretBytes)",
"testcase": false
},
{
"class_method_signature": "HMACAlgorithm.HMACAlgorithm(String id, String algorithm, String secret)",
"constructor": true,
"full_signature": " HMACAlgorithm(String id, String algorithm, String secret)",
"identifier": "HMACAlgorithm",
"modifiers": "",
"parameters": "(String id, String algorithm, String secret)",
"return": "",
"signature": " HMACAlgorithm(String id, String algorithm, String secret)",
"testcase": false
},
{
"class_method_signature": "HMACAlgorithm.getSecretBytes(String secret)",
"constructor": false,
"full_signature": "static byte[] getSecretBytes(String secret)",
"identifier": "getSecretBytes",
"modifiers": "static",
"parameters": "(String secret)",
"return": "byte[]",
"signature": "byte[] getSecretBytes(String secret)",
"testcase": false
},
{
"class_method_signature": "HMACAlgorithm.verify(DecodedJWT jwt)",
"constructor": false,
"full_signature": "@Override public void verify(DecodedJWT jwt)",
"identifier": "verify",
"modifiers": "@Override public",
"parameters": "(DecodedJWT jwt)",
"return": "void",
"signature": "void verify(DecodedJWT jwt)",
"testcase": false
},
{
"class_method_signature": "HMACAlgorithm.sign(byte[] headerBytes, byte[] payloadBytes)",
"constructor": false,
"full_signature": "@Override public byte[] sign(byte[] headerBytes, byte[] payloadBytes)",
"identifier": "sign",
"modifiers": "@Override public",
"parameters": "(byte[] headerBytes, byte[] payloadBytes)",
"return": "byte[]",
"signature": "byte[] sign(byte[] headerBytes, byte[] payloadBytes)",
"testcase": false
},
{
"class_method_signature": "HMACAlgorithm.sign(byte[] contentBytes)",
"constructor": false,
"full_signature": "@Override @Deprecated public byte[] sign(byte[] contentBytes)",
"identifier": "sign",
"modifiers": "@Override @Deprecated public",
"parameters": "(byte[] contentBytes)",
"return": "byte[]",
"signature": "byte[] sign(byte[] contentBytes)",
"testcase": false
}
],
"superclass": "extends Algorithm"
} | {
"body": "@Override\n public void verify(DecodedJWT jwt) throws SignatureVerificationException {\n byte[] signatureBytes = Base64.decodeBase64(jwt.getSignature());\n\n try {\n boolean valid = crypto.verifySignatureFor(getDescription(), secret, jwt.getHeader(), jwt.getPayload(), signatureBytes);\n if (!valid) {\n throw new SignatureVerificationException(this);\n }\n } catch (IllegalStateException | InvalidKeyException | NoSuchAlgorithmException e) {\n throw new SignatureVerificationException(this, e);\n }\n }",
"class_method_signature": "HMACAlgorithm.verify(DecodedJWT jwt)",
"constructor": false,
"full_signature": "@Override public void verify(DecodedJWT jwt)",
"identifier": "verify",
"invocations": [
"decodeBase64",
"getSignature",
"verifySignatureFor",
"getDescription",
"getHeader",
"getPayload"
],
"modifiers": "@Override public",
"parameters": "(DecodedJWT jwt)",
"return": "void",
"signature": "void verify(DecodedJWT jwt)",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 691,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 17517521,
"size": 936,
"stargazer_count": 3678,
"stars": null,
"updates": null,
"url": "https://github.com/auth0/java-jwt"
} |
17517521_173 | {
"fields": [
{
"declarator": "PRIVATE_KEY_FILE_256 = \"src/test/resources/ec256-key-private.pem\"",
"modifier": "private static final",
"original_string": "private static final String PRIVATE_KEY_FILE_256 = \"src/test/resources/ec256-key-private.pem\";",
"type": "String",
"var_name": "PRIVATE_KEY_FILE_256"
},
{
"declarator": "PUBLIC_KEY_FILE_256 = \"src/test/resources/ec256-key-public.pem\"",
"modifier": "private static final",
"original_string": "private static final String PUBLIC_KEY_FILE_256 = \"src/test/resources/ec256-key-public.pem\";",
"type": "String",
"var_name": "PUBLIC_KEY_FILE_256"
},
{
"declarator": "INVALID_PUBLIC_KEY_FILE_256 = \"src/test/resources/ec256-key-public-invalid.pem\"",
"modifier": "private static final",
"original_string": "private static final String INVALID_PUBLIC_KEY_FILE_256 = \"src/test/resources/ec256-key-public-invalid.pem\";",
"type": "String",
"var_name": "INVALID_PUBLIC_KEY_FILE_256"
},
{
"declarator": "PRIVATE_KEY_FILE_256K = \"src/test/resources/ec256k-key-private.pem\"",
"modifier": "private static final",
"original_string": "private static final String PRIVATE_KEY_FILE_256K = \"src/test/resources/ec256k-key-private.pem\";",
"type": "String",
"var_name": "PRIVATE_KEY_FILE_256K"
},
{
"declarator": "PUBLIC_KEY_FILE_256K = \"src/test/resources/ec256k-key-public.pem\"",
"modifier": "private static final",
"original_string": "private static final String PUBLIC_KEY_FILE_256K = \"src/test/resources/ec256k-key-public.pem\";",
"type": "String",
"var_name": "PUBLIC_KEY_FILE_256K"
},
{
"declarator": "INVALID_PUBLIC_KEY_FILE_256K = \"src/test/resources/ec256k-key-public-invalid.pem\"",
"modifier": "private static final",
"original_string": "private static final String INVALID_PUBLIC_KEY_FILE_256K = \"src/test/resources/ec256k-key-public-invalid.pem\";",
"type": "String",
"var_name": "INVALID_PUBLIC_KEY_FILE_256K"
},
{
"declarator": "ES256K_JWT = \"eyJraWQiOiJteS1rZXktaWQiLCJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NksifQ.e30.2ggPsc4xwQhYcgJueo3uQ14MpaVJ3AbEE8UE-wA9fc8SMibeW54gjZbikL-JBHqhEwc22Cp8DNOtadXsM81RGQ\"",
"modifier": "private static final",
"original_string": "private static final String ES256K_JWT = \"eyJraWQiOiJteS1rZXktaWQiLCJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NksifQ.e30.2ggPsc4xwQhYcgJueo3uQ14MpaVJ3AbEE8UE-wA9fc8SMibeW54gjZbikL-JBHqhEwc22Cp8DNOtadXsM81RGQ\";",
"type": "String",
"var_name": "ES256K_JWT"
},
{
"declarator": "PRIVATE_KEY_FILE_384 = \"src/test/resources/ec384-key-private.pem\"",
"modifier": "private static final",
"original_string": "private static final String PRIVATE_KEY_FILE_384 = \"src/test/resources/ec384-key-private.pem\";",
"type": "String",
"var_name": "PRIVATE_KEY_FILE_384"
},
{
"declarator": "PUBLIC_KEY_FILE_384 = \"src/test/resources/ec384-key-public.pem\"",
"modifier": "private static final",
"original_string": "private static final String PUBLIC_KEY_FILE_384 = \"src/test/resources/ec384-key-public.pem\";",
"type": "String",
"var_name": "PUBLIC_KEY_FILE_384"
},
{
"declarator": "INVALID_PUBLIC_KEY_FILE_384 = \"src/test/resources/ec384-key-public-invalid.pem\"",
"modifier": "private static final",
"original_string": "private static final String INVALID_PUBLIC_KEY_FILE_384 = \"src/test/resources/ec384-key-public-invalid.pem\";",
"type": "String",
"var_name": "INVALID_PUBLIC_KEY_FILE_384"
},
{
"declarator": "PRIVATE_KEY_FILE_512 = \"src/test/resources/ec512-key-private.pem\"",
"modifier": "private static final",
"original_string": "private static final String PRIVATE_KEY_FILE_512 = \"src/test/resources/ec512-key-private.pem\";",
"type": "String",
"var_name": "PRIVATE_KEY_FILE_512"
},
{
"declarator": "PUBLIC_KEY_FILE_512 = \"src/test/resources/ec512-key-public.pem\"",
"modifier": "private static final",
"original_string": "private static final String PUBLIC_KEY_FILE_512 = \"src/test/resources/ec512-key-public.pem\";",
"type": "String",
"var_name": "PUBLIC_KEY_FILE_512"
},
{
"declarator": "INVALID_PUBLIC_KEY_FILE_512 = \"src/test/resources/ec512-key-public-invalid.pem\"",
"modifier": "private static final",
"original_string": "private static final String INVALID_PUBLIC_KEY_FILE_512 = \"src/test/resources/ec512-key-public-invalid.pem\";",
"type": "String",
"var_name": "INVALID_PUBLIC_KEY_FILE_512"
},
{
"declarator": "exception = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException exception = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "exception"
},
{
"declarator": "ES256Header = \"eyJhbGciOiJFUzI1NiJ9\"",
"modifier": "private static final",
"original_string": "private static final String ES256Header = \"eyJhbGciOiJFUzI1NiJ9\";",
"type": "String",
"var_name": "ES256Header"
},
{
"declarator": "ES384Header = \"eyJhbGciOiJFUzM4NCJ9\"",
"modifier": "private static final",
"original_string": "private static final String ES384Header = \"eyJhbGciOiJFUzM4NCJ9\";",
"type": "String",
"var_name": "ES384Header"
},
{
"declarator": "ES512Header = \"eyJhbGciOiJFUzUxMiJ9\"",
"modifier": "private static final",
"original_string": "private static final String ES512Header = \"eyJhbGciOiJFUzUxMiJ9\";",
"type": "String",
"var_name": "ES512Header"
},
{
"declarator": "auth0IssPayload = \"eyJpc3MiOiJhdXRoMCJ9\"",
"modifier": "private static final",
"original_string": "private static final String auth0IssPayload = \"eyJpc3MiOiJhdXRoMCJ9\";",
"type": "String",
"var_name": "auth0IssPayload"
},
{
"declarator": "ES256HeaderBytes = ES256Header.getBytes(StandardCharsets.UTF_8)",
"modifier": "private static final",
"original_string": "private static final byte[] ES256HeaderBytes = ES256Header.getBytes(StandardCharsets.UTF_8);",
"type": "byte[]",
"var_name": "ES256HeaderBytes"
},
{
"declarator": "ES384HeaderBytes = ES384Header.getBytes(StandardCharsets.UTF_8)",
"modifier": "private static final",
"original_string": "private static final byte[] ES384HeaderBytes = ES384Header.getBytes(StandardCharsets.UTF_8);",
"type": "byte[]",
"var_name": "ES384HeaderBytes"
},
{
"declarator": "ES512HeaderBytes = ES512Header.getBytes(StandardCharsets.UTF_8)",
"modifier": "private static final",
"original_string": "private static final byte[] ES512HeaderBytes = ES512Header.getBytes(StandardCharsets.UTF_8);",
"type": "byte[]",
"var_name": "ES512HeaderBytes"
},
{
"declarator": "auth0IssPayloadBytes = auth0IssPayload.getBytes(StandardCharsets.UTF_8)",
"modifier": "private static final",
"original_string": "private static final byte[] auth0IssPayloadBytes = auth0IssPayload.getBytes(StandardCharsets.UTF_8);",
"type": "byte[]",
"var_name": "auth0IssPayloadBytes"
}
],
"file": "lib/src/test/java/com/auth0/jwt/algorithms/ECDSAAlgorithmTest.java",
"identifier": "ECDSAAlgorithmTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void shouldFailECDSA512VerificationWithInvalidPublicKey() throws Exception {\n exception.expect(SignatureVerificationException.class);\n exception.expectMessage(\"The Token's Signature resulted invalid when verified using the Algorithm: SHA512withECDSA\");\n String jwt = \"eyJhbGciOiJFUzUxMiJ9.eyJpc3MiOiJhdXRoMCJ9.AZgdopFFsN0amCSs2kOucXdpylD31DEm5ChK1PG0_gq5Mf47MrvVph8zHSVuvcrXzcE1U3VxeCg89mYW1H33Y-8iAF0QFkdfTUQIWKNObH543WNMYYssv3OtOj0znPv8atDbaF8DMYAtcT1qdmaSJRhx-egRE9HGZkinPh9CfLLLt58X\";\n Algorithm algorithm = Algorithm.ECDSA512((ECKey) readPublicKeyFromFile(INVALID_PUBLIC_KEY_FILE_512, \"EC\"));\n algorithm.verify(JWT.decode(jwt));\n }",
"class_method_signature": "ECDSAAlgorithmTest.shouldFailECDSA512VerificationWithInvalidPublicKey()",
"constructor": false,
"full_signature": "@Test public void shouldFailECDSA512VerificationWithInvalidPublicKey()",
"identifier": "shouldFailECDSA512VerificationWithInvalidPublicKey",
"invocations": [
"expect",
"expectMessage",
"ECDSA512",
"readPublicKeyFromFile",
"verify",
"decode"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void shouldFailECDSA512VerificationWithInvalidPublicKey()",
"testcase": true
} | {
"fields": [
{
"declarator": "keyProvider",
"modifier": "private final",
"original_string": "private final ECDSAKeyProvider keyProvider;",
"type": "ECDSAKeyProvider",
"var_name": "keyProvider"
},
{
"declarator": "crypto",
"modifier": "private final",
"original_string": "private final CryptoHelper crypto;",
"type": "CryptoHelper",
"var_name": "crypto"
},
{
"declarator": "ecNumberSize",
"modifier": "private final",
"original_string": "private final int ecNumberSize;",
"type": "int",
"var_name": "ecNumberSize"
}
],
"file": "lib/src/main/java/com/auth0/jwt/algorithms/ECDSAAlgorithm.java",
"identifier": "ECDSAAlgorithm",
"interfaces": "",
"methods": [
{
"class_method_signature": "ECDSAAlgorithm.ECDSAAlgorithm(CryptoHelper crypto, String id, String algorithm, int ecNumberSize, ECDSAKeyProvider keyProvider)",
"constructor": true,
"full_signature": " ECDSAAlgorithm(CryptoHelper crypto, String id, String algorithm, int ecNumberSize, ECDSAKeyProvider keyProvider)",
"identifier": "ECDSAAlgorithm",
"modifiers": "",
"parameters": "(CryptoHelper crypto, String id, String algorithm, int ecNumberSize, ECDSAKeyProvider keyProvider)",
"return": "",
"signature": " ECDSAAlgorithm(CryptoHelper crypto, String id, String algorithm, int ecNumberSize, ECDSAKeyProvider keyProvider)",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.ECDSAAlgorithm(String id, String algorithm, int ecNumberSize, ECDSAKeyProvider keyProvider)",
"constructor": true,
"full_signature": " ECDSAAlgorithm(String id, String algorithm, int ecNumberSize, ECDSAKeyProvider keyProvider)",
"identifier": "ECDSAAlgorithm",
"modifiers": "",
"parameters": "(String id, String algorithm, int ecNumberSize, ECDSAKeyProvider keyProvider)",
"return": "",
"signature": " ECDSAAlgorithm(String id, String algorithm, int ecNumberSize, ECDSAKeyProvider keyProvider)",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.verify(DecodedJWT jwt)",
"constructor": false,
"full_signature": "@Override public void verify(DecodedJWT jwt)",
"identifier": "verify",
"modifiers": "@Override public",
"parameters": "(DecodedJWT jwt)",
"return": "void",
"signature": "void verify(DecodedJWT jwt)",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.sign(byte[] headerBytes, byte[] payloadBytes)",
"constructor": false,
"full_signature": "@Override public byte[] sign(byte[] headerBytes, byte[] payloadBytes)",
"identifier": "sign",
"modifiers": "@Override public",
"parameters": "(byte[] headerBytes, byte[] payloadBytes)",
"return": "byte[]",
"signature": "byte[] sign(byte[] headerBytes, byte[] payloadBytes)",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.sign(byte[] contentBytes)",
"constructor": false,
"full_signature": "@Override @Deprecated public byte[] sign(byte[] contentBytes)",
"identifier": "sign",
"modifiers": "@Override @Deprecated public",
"parameters": "(byte[] contentBytes)",
"return": "byte[]",
"signature": "byte[] sign(byte[] contentBytes)",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.getSigningKeyId()",
"constructor": false,
"full_signature": "@Override public String getSigningKeyId()",
"identifier": "getSigningKeyId",
"modifiers": "@Override public",
"parameters": "()",
"return": "String",
"signature": "String getSigningKeyId()",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.DERToJOSE(byte[] derSignature)",
"constructor": false,
"full_signature": " byte[] DERToJOSE(byte[] derSignature)",
"identifier": "DERToJOSE",
"modifiers": "",
"parameters": "(byte[] derSignature)",
"return": "byte[]",
"signature": "byte[] DERToJOSE(byte[] derSignature)",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.JOSEToDER(byte[] joseSignature)",
"constructor": false,
"full_signature": " byte[] JOSEToDER(byte[] joseSignature)",
"identifier": "JOSEToDER",
"modifiers": "",
"parameters": "(byte[] joseSignature)",
"return": "byte[]",
"signature": "byte[] JOSEToDER(byte[] joseSignature)",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.countPadding(byte[] bytes, int fromIndex, int toIndex)",
"constructor": false,
"full_signature": "private int countPadding(byte[] bytes, int fromIndex, int toIndex)",
"identifier": "countPadding",
"modifiers": "private",
"parameters": "(byte[] bytes, int fromIndex, int toIndex)",
"return": "int",
"signature": "int countPadding(byte[] bytes, int fromIndex, int toIndex)",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.providerForKeys(final ECPublicKey publicKey, final ECPrivateKey privateKey)",
"constructor": false,
"full_signature": "static ECDSAKeyProvider providerForKeys(final ECPublicKey publicKey, final ECPrivateKey privateKey)",
"identifier": "providerForKeys",
"modifiers": "static",
"parameters": "(final ECPublicKey publicKey, final ECPrivateKey privateKey)",
"return": "ECDSAKeyProvider",
"signature": "ECDSAKeyProvider providerForKeys(final ECPublicKey publicKey, final ECPrivateKey privateKey)",
"testcase": false
}
],
"superclass": "extends Algorithm"
} | {
"body": "@Override\n public void verify(DecodedJWT jwt) throws SignatureVerificationException {\n byte[] signatureBytes = Base64.decodeBase64(jwt.getSignature());\n\n try {\n ECPublicKey publicKey = keyProvider.getPublicKeyById(jwt.getKeyId());\n if (publicKey == null) {\n throw new IllegalStateException(\"The given Public Key is null.\");\n }\n boolean valid = crypto.verifySignatureFor(getDescription(), publicKey, jwt.getHeader(), jwt.getPayload(), JOSEToDER(signatureBytes));\n\n if (!valid) {\n throw new SignatureVerificationException(this);\n }\n } catch (NoSuchAlgorithmException | SignatureException | InvalidKeyException | IllegalStateException e) {\n throw new SignatureVerificationException(this, e);\n }\n }",
"class_method_signature": "ECDSAAlgorithm.verify(DecodedJWT jwt)",
"constructor": false,
"full_signature": "@Override public void verify(DecodedJWT jwt)",
"identifier": "verify",
"invocations": [
"decodeBase64",
"getSignature",
"getPublicKeyById",
"getKeyId",
"verifySignatureFor",
"getDescription",
"getHeader",
"getPayload",
"JOSEToDER"
],
"modifiers": "@Override public",
"parameters": "(DecodedJWT jwt)",
"return": "void",
"signature": "void verify(DecodedJWT jwt)",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 691,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 17517521,
"size": 936,
"stargazer_count": 3678,
"stars": null,
"updates": null,
"url": "https://github.com/auth0/java-jwt"
} |
17517521_5 | {
"fields": [
{
"declarator": "exception = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException exception = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "exception"
}
],
"file": "lib/src/test/java/com/auth0/jwt/JWTDecoderTest.java",
"identifier": "JWTDecoderTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void shouldGetIssuer() throws Exception {\n DecodedJWT jwt = JWT.decode(\"eyJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJKb2huIERvZSJ9.SgXosfRR_IwCgHq5lF3tlM-JHtpucWCRSaVuoHTbWbQ\");\n assertThat(jwt, is(notNullValue()));\n assertThat(jwt.getIssuer(), is(\"John Doe\"));\n }",
"class_method_signature": "JWTDecoderTest.shouldGetIssuer()",
"constructor": false,
"full_signature": "@Test public void shouldGetIssuer()",
"identifier": "shouldGetIssuer",
"invocations": [
"decode",
"assertThat",
"is",
"notNullValue",
"assertThat",
"getIssuer",
"is"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void shouldGetIssuer()",
"testcase": true
} | {
"fields": [
{
"declarator": "serialVersionUID = 1873362438023312895L",
"modifier": "private static final",
"original_string": "private static final long serialVersionUID = 1873362438023312895L;",
"type": "long",
"var_name": "serialVersionUID"
},
{
"declarator": "parts",
"modifier": "private final",
"original_string": "private final String[] parts;",
"type": "String[]",
"var_name": "parts"
},
{
"declarator": "header",
"modifier": "private final",
"original_string": "private final Header header;",
"type": "Header",
"var_name": "header"
},
{
"declarator": "payload",
"modifier": "private final",
"original_string": "private final Payload payload;",
"type": "Payload",
"var_name": "payload"
}
],
"file": "lib/src/main/java/com/auth0/jwt/JWTDecoder.java",
"identifier": "JWTDecoder",
"interfaces": "implements DecodedJWT, Serializable",
"methods": [
{
"class_method_signature": "JWTDecoder.JWTDecoder(String jwt)",
"constructor": true,
"full_signature": " JWTDecoder(String jwt)",
"identifier": "JWTDecoder",
"modifiers": "",
"parameters": "(String jwt)",
"return": "",
"signature": " JWTDecoder(String jwt)",
"testcase": false
},
{
"class_method_signature": "JWTDecoder.JWTDecoder(JWTParser converter, String jwt)",
"constructor": true,
"full_signature": " JWTDecoder(JWTParser converter, String jwt)",
"identifier": "JWTDecoder",
"modifiers": "",
"parameters": "(JWTParser converter, String jwt)",
"return": "",
"signature": " JWTDecoder(JWTParser converter, String jwt)",
"testcase": false
},
{
"class_method_signature": "JWTDecoder.getAlgorithm()",
"constructor": false,
"full_signature": "@Override public String getAlgorithm()",
"identifier": "getAlgorithm",
"modifiers": "@Override public",
"parameters": "()",
"return": "String",
"signature": "String getAlgorithm()",
"testcase": false
},
{
"class_method_signature": "JWTDecoder.getType()",
"constructor": false,
"full_signature": "@Override public String getType()",
"identifier": "getType",
"modifiers": "@Override public",
"parameters": "()",
"return": "String",
"signature": "String getType()",
"testcase": false
},
{
"class_method_signature": "JWTDecoder.getContentType()",
"constructor": false,
"full_signature": "@Override public String getContentType()",
"identifier": "getContentType",
"modifiers": "@Override public",
"parameters": "()",
"return": "String",
"signature": "String getContentType()",
"testcase": false
},
{
"class_method_signature": "JWTDecoder.getKeyId()",
"constructor": false,
"full_signature": "@Override public String getKeyId()",
"identifier": "getKeyId",
"modifiers": "@Override public",
"parameters": "()",
"return": "String",
"signature": "String getKeyId()",
"testcase": false
},
{
"class_method_signature": "JWTDecoder.getHeaderClaim(String name)",
"constructor": false,
"full_signature": "@Override public Claim getHeaderClaim(String name)",
"identifier": "getHeaderClaim",
"modifiers": "@Override public",
"parameters": "(String name)",
"return": "Claim",
"signature": "Claim getHeaderClaim(String name)",
"testcase": false
},
{
"class_method_signature": "JWTDecoder.getIssuer()",
"constructor": false,
"full_signature": "@Override public String getIssuer()",
"identifier": "getIssuer",
"modifiers": "@Override public",
"parameters": "()",
"return": "String",
"signature": "String getIssuer()",
"testcase": false
},
{
"class_method_signature": "JWTDecoder.getSubject()",
"constructor": false,
"full_signature": "@Override public String getSubject()",
"identifier": "getSubject",
"modifiers": "@Override public",
"parameters": "()",
"return": "String",
"signature": "String getSubject()",
"testcase": false
},
{
"class_method_signature": "JWTDecoder.getAudience()",
"constructor": false,
"full_signature": "@Override public List<String> getAudience()",
"identifier": "getAudience",
"modifiers": "@Override public",
"parameters": "()",
"return": "List<String>",
"signature": "List<String> getAudience()",
"testcase": false
},
{
"class_method_signature": "JWTDecoder.getExpiresAt()",
"constructor": false,
"full_signature": "@Override public Date getExpiresAt()",
"identifier": "getExpiresAt",
"modifiers": "@Override public",
"parameters": "()",
"return": "Date",
"signature": "Date getExpiresAt()",
"testcase": false
},
{
"class_method_signature": "JWTDecoder.getNotBefore()",
"constructor": false,
"full_signature": "@Override public Date getNotBefore()",
"identifier": "getNotBefore",
"modifiers": "@Override public",
"parameters": "()",
"return": "Date",
"signature": "Date getNotBefore()",
"testcase": false
},
{
"class_method_signature": "JWTDecoder.getIssuedAt()",
"constructor": false,
"full_signature": "@Override public Date getIssuedAt()",
"identifier": "getIssuedAt",
"modifiers": "@Override public",
"parameters": "()",
"return": "Date",
"signature": "Date getIssuedAt()",
"testcase": false
},
{
"class_method_signature": "JWTDecoder.getId()",
"constructor": false,
"full_signature": "@Override public String getId()",
"identifier": "getId",
"modifiers": "@Override public",
"parameters": "()",
"return": "String",
"signature": "String getId()",
"testcase": false
},
{
"class_method_signature": "JWTDecoder.getClaim(String name)",
"constructor": false,
"full_signature": "@Override public Claim getClaim(String name)",
"identifier": "getClaim",
"modifiers": "@Override public",
"parameters": "(String name)",
"return": "Claim",
"signature": "Claim getClaim(String name)",
"testcase": false
},
{
"class_method_signature": "JWTDecoder.getClaims()",
"constructor": false,
"full_signature": "@Override public Map<String, Claim> getClaims()",
"identifier": "getClaims",
"modifiers": "@Override public",
"parameters": "()",
"return": "Map<String, Claim>",
"signature": "Map<String, Claim> getClaims()",
"testcase": false
},
{
"class_method_signature": "JWTDecoder.getHeader()",
"constructor": false,
"full_signature": "@Override public String getHeader()",
"identifier": "getHeader",
"modifiers": "@Override public",
"parameters": "()",
"return": "String",
"signature": "String getHeader()",
"testcase": false
},
{
"class_method_signature": "JWTDecoder.getPayload()",
"constructor": false,
"full_signature": "@Override public String getPayload()",
"identifier": "getPayload",
"modifiers": "@Override public",
"parameters": "()",
"return": "String",
"signature": "String getPayload()",
"testcase": false
},
{
"class_method_signature": "JWTDecoder.getSignature()",
"constructor": false,
"full_signature": "@Override public String getSignature()",
"identifier": "getSignature",
"modifiers": "@Override public",
"parameters": "()",
"return": "String",
"signature": "String getSignature()",
"testcase": false
},
{
"class_method_signature": "JWTDecoder.getToken()",
"constructor": false,
"full_signature": "@Override public String getToken()",
"identifier": "getToken",
"modifiers": "@Override public",
"parameters": "()",
"return": "String",
"signature": "String getToken()",
"testcase": false
}
],
"superclass": ""
} | {
"body": "@Override\n public String getIssuer() {\n return payload.getIssuer();\n }",
"class_method_signature": "JWTDecoder.getIssuer()",
"constructor": false,
"full_signature": "@Override public String getIssuer()",
"identifier": "getIssuer",
"invocations": [
"getIssuer"
],
"modifiers": "@Override public",
"parameters": "()",
"return": "String",
"signature": "String getIssuer()",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 691,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 17517521,
"size": 936,
"stargazer_count": 3678,
"stars": null,
"updates": null,
"url": "https://github.com/auth0/java-jwt"
} |
17517521_165 | {
"fields": [
{
"declarator": "PRIVATE_KEY_FILE_256 = \"src/test/resources/ec256-key-private.pem\"",
"modifier": "private static final",
"original_string": "private static final String PRIVATE_KEY_FILE_256 = \"src/test/resources/ec256-key-private.pem\";",
"type": "String",
"var_name": "PRIVATE_KEY_FILE_256"
},
{
"declarator": "PUBLIC_KEY_FILE_256 = \"src/test/resources/ec256-key-public.pem\"",
"modifier": "private static final",
"original_string": "private static final String PUBLIC_KEY_FILE_256 = \"src/test/resources/ec256-key-public.pem\";",
"type": "String",
"var_name": "PUBLIC_KEY_FILE_256"
},
{
"declarator": "INVALID_PUBLIC_KEY_FILE_256 = \"src/test/resources/ec256-key-public-invalid.pem\"",
"modifier": "private static final",
"original_string": "private static final String INVALID_PUBLIC_KEY_FILE_256 = \"src/test/resources/ec256-key-public-invalid.pem\";",
"type": "String",
"var_name": "INVALID_PUBLIC_KEY_FILE_256"
},
{
"declarator": "PRIVATE_KEY_FILE_256K = \"src/test/resources/ec256k-key-private.pem\"",
"modifier": "private static final",
"original_string": "private static final String PRIVATE_KEY_FILE_256K = \"src/test/resources/ec256k-key-private.pem\";",
"type": "String",
"var_name": "PRIVATE_KEY_FILE_256K"
},
{
"declarator": "PUBLIC_KEY_FILE_256K = \"src/test/resources/ec256k-key-public.pem\"",
"modifier": "private static final",
"original_string": "private static final String PUBLIC_KEY_FILE_256K = \"src/test/resources/ec256k-key-public.pem\";",
"type": "String",
"var_name": "PUBLIC_KEY_FILE_256K"
},
{
"declarator": "INVALID_PUBLIC_KEY_FILE_256K = \"src/test/resources/ec256k-key-public-invalid.pem\"",
"modifier": "private static final",
"original_string": "private static final String INVALID_PUBLIC_KEY_FILE_256K = \"src/test/resources/ec256k-key-public-invalid.pem\";",
"type": "String",
"var_name": "INVALID_PUBLIC_KEY_FILE_256K"
},
{
"declarator": "ES256K_JWT = \"eyJraWQiOiJteS1rZXktaWQiLCJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NksifQ.e30.2ggPsc4xwQhYcgJueo3uQ14MpaVJ3AbEE8UE-wA9fc8SMibeW54gjZbikL-JBHqhEwc22Cp8DNOtadXsM81RGQ\"",
"modifier": "private static final",
"original_string": "private static final String ES256K_JWT = \"eyJraWQiOiJteS1rZXktaWQiLCJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NksifQ.e30.2ggPsc4xwQhYcgJueo3uQ14MpaVJ3AbEE8UE-wA9fc8SMibeW54gjZbikL-JBHqhEwc22Cp8DNOtadXsM81RGQ\";",
"type": "String",
"var_name": "ES256K_JWT"
},
{
"declarator": "PRIVATE_KEY_FILE_384 = \"src/test/resources/ec384-key-private.pem\"",
"modifier": "private static final",
"original_string": "private static final String PRIVATE_KEY_FILE_384 = \"src/test/resources/ec384-key-private.pem\";",
"type": "String",
"var_name": "PRIVATE_KEY_FILE_384"
},
{
"declarator": "PUBLIC_KEY_FILE_384 = \"src/test/resources/ec384-key-public.pem\"",
"modifier": "private static final",
"original_string": "private static final String PUBLIC_KEY_FILE_384 = \"src/test/resources/ec384-key-public.pem\";",
"type": "String",
"var_name": "PUBLIC_KEY_FILE_384"
},
{
"declarator": "INVALID_PUBLIC_KEY_FILE_384 = \"src/test/resources/ec384-key-public-invalid.pem\"",
"modifier": "private static final",
"original_string": "private static final String INVALID_PUBLIC_KEY_FILE_384 = \"src/test/resources/ec384-key-public-invalid.pem\";",
"type": "String",
"var_name": "INVALID_PUBLIC_KEY_FILE_384"
},
{
"declarator": "PRIVATE_KEY_FILE_512 = \"src/test/resources/ec512-key-private.pem\"",
"modifier": "private static final",
"original_string": "private static final String PRIVATE_KEY_FILE_512 = \"src/test/resources/ec512-key-private.pem\";",
"type": "String",
"var_name": "PRIVATE_KEY_FILE_512"
},
{
"declarator": "PUBLIC_KEY_FILE_512 = \"src/test/resources/ec512-key-public.pem\"",
"modifier": "private static final",
"original_string": "private static final String PUBLIC_KEY_FILE_512 = \"src/test/resources/ec512-key-public.pem\";",
"type": "String",
"var_name": "PUBLIC_KEY_FILE_512"
},
{
"declarator": "INVALID_PUBLIC_KEY_FILE_512 = \"src/test/resources/ec512-key-public-invalid.pem\"",
"modifier": "private static final",
"original_string": "private static final String INVALID_PUBLIC_KEY_FILE_512 = \"src/test/resources/ec512-key-public-invalid.pem\";",
"type": "String",
"var_name": "INVALID_PUBLIC_KEY_FILE_512"
},
{
"declarator": "exception = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException exception = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "exception"
},
{
"declarator": "ES256Header = \"eyJhbGciOiJFUzI1NiJ9\"",
"modifier": "private static final",
"original_string": "private static final String ES256Header = \"eyJhbGciOiJFUzI1NiJ9\";",
"type": "String",
"var_name": "ES256Header"
},
{
"declarator": "ES384Header = \"eyJhbGciOiJFUzM4NCJ9\"",
"modifier": "private static final",
"original_string": "private static final String ES384Header = \"eyJhbGciOiJFUzM4NCJ9\";",
"type": "String",
"var_name": "ES384Header"
},
{
"declarator": "ES512Header = \"eyJhbGciOiJFUzUxMiJ9\"",
"modifier": "private static final",
"original_string": "private static final String ES512Header = \"eyJhbGciOiJFUzUxMiJ9\";",
"type": "String",
"var_name": "ES512Header"
},
{
"declarator": "auth0IssPayload = \"eyJpc3MiOiJhdXRoMCJ9\"",
"modifier": "private static final",
"original_string": "private static final String auth0IssPayload = \"eyJpc3MiOiJhdXRoMCJ9\";",
"type": "String",
"var_name": "auth0IssPayload"
},
{
"declarator": "ES256HeaderBytes = ES256Header.getBytes(StandardCharsets.UTF_8)",
"modifier": "private static final",
"original_string": "private static final byte[] ES256HeaderBytes = ES256Header.getBytes(StandardCharsets.UTF_8);",
"type": "byte[]",
"var_name": "ES256HeaderBytes"
},
{
"declarator": "ES384HeaderBytes = ES384Header.getBytes(StandardCharsets.UTF_8)",
"modifier": "private static final",
"original_string": "private static final byte[] ES384HeaderBytes = ES384Header.getBytes(StandardCharsets.UTF_8);",
"type": "byte[]",
"var_name": "ES384HeaderBytes"
},
{
"declarator": "ES512HeaderBytes = ES512Header.getBytes(StandardCharsets.UTF_8)",
"modifier": "private static final",
"original_string": "private static final byte[] ES512HeaderBytes = ES512Header.getBytes(StandardCharsets.UTF_8);",
"type": "byte[]",
"var_name": "ES512HeaderBytes"
},
{
"declarator": "auth0IssPayloadBytes = auth0IssPayload.getBytes(StandardCharsets.UTF_8)",
"modifier": "private static final",
"original_string": "private static final byte[] auth0IssPayloadBytes = auth0IssPayload.getBytes(StandardCharsets.UTF_8);",
"type": "byte[]",
"var_name": "auth0IssPayloadBytes"
}
],
"file": "lib/src/test/java/com/auth0/jwt/algorithms/ECDSAAlgorithmTest.java",
"identifier": "ECDSAAlgorithmTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void shouldFailECDSA384VerificationOnInvalidJOSESignature() throws Exception {\n exception.expect(SignatureVerificationException.class);\n exception.expectMessage(\"The Token's Signature resulted invalid when verified using the Algorithm: SHA384withECDSA\");\n\n byte[] bytes = new byte[96];\n new SecureRandom().nextBytes(bytes);\n String signature = Base64.encodeBase64URLSafeString(bytes);\n String jwt = \"eyJhbGciOiJFUzI1NiJ9.eyJpc3MiOiJhdXRoMCJ9.\" + signature;\n Algorithm algorithm = Algorithm.ECDSA384((ECKey) readPublicKeyFromFile(INVALID_PUBLIC_KEY_FILE_384, \"EC\"));\n algorithm.verify(JWT.decode(jwt));\n }",
"class_method_signature": "ECDSAAlgorithmTest.shouldFailECDSA384VerificationOnInvalidJOSESignature()",
"constructor": false,
"full_signature": "@Test public void shouldFailECDSA384VerificationOnInvalidJOSESignature()",
"identifier": "shouldFailECDSA384VerificationOnInvalidJOSESignature",
"invocations": [
"expect",
"expectMessage",
"nextBytes",
"encodeBase64URLSafeString",
"ECDSA384",
"readPublicKeyFromFile",
"verify",
"decode"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void shouldFailECDSA384VerificationOnInvalidJOSESignature()",
"testcase": true
} | {
"fields": [
{
"declarator": "keyProvider",
"modifier": "private final",
"original_string": "private final ECDSAKeyProvider keyProvider;",
"type": "ECDSAKeyProvider",
"var_name": "keyProvider"
},
{
"declarator": "crypto",
"modifier": "private final",
"original_string": "private final CryptoHelper crypto;",
"type": "CryptoHelper",
"var_name": "crypto"
},
{
"declarator": "ecNumberSize",
"modifier": "private final",
"original_string": "private final int ecNumberSize;",
"type": "int",
"var_name": "ecNumberSize"
}
],
"file": "lib/src/main/java/com/auth0/jwt/algorithms/ECDSAAlgorithm.java",
"identifier": "ECDSAAlgorithm",
"interfaces": "",
"methods": [
{
"class_method_signature": "ECDSAAlgorithm.ECDSAAlgorithm(CryptoHelper crypto, String id, String algorithm, int ecNumberSize, ECDSAKeyProvider keyProvider)",
"constructor": true,
"full_signature": " ECDSAAlgorithm(CryptoHelper crypto, String id, String algorithm, int ecNumberSize, ECDSAKeyProvider keyProvider)",
"identifier": "ECDSAAlgorithm",
"modifiers": "",
"parameters": "(CryptoHelper crypto, String id, String algorithm, int ecNumberSize, ECDSAKeyProvider keyProvider)",
"return": "",
"signature": " ECDSAAlgorithm(CryptoHelper crypto, String id, String algorithm, int ecNumberSize, ECDSAKeyProvider keyProvider)",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.ECDSAAlgorithm(String id, String algorithm, int ecNumberSize, ECDSAKeyProvider keyProvider)",
"constructor": true,
"full_signature": " ECDSAAlgorithm(String id, String algorithm, int ecNumberSize, ECDSAKeyProvider keyProvider)",
"identifier": "ECDSAAlgorithm",
"modifiers": "",
"parameters": "(String id, String algorithm, int ecNumberSize, ECDSAKeyProvider keyProvider)",
"return": "",
"signature": " ECDSAAlgorithm(String id, String algorithm, int ecNumberSize, ECDSAKeyProvider keyProvider)",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.verify(DecodedJWT jwt)",
"constructor": false,
"full_signature": "@Override public void verify(DecodedJWT jwt)",
"identifier": "verify",
"modifiers": "@Override public",
"parameters": "(DecodedJWT jwt)",
"return": "void",
"signature": "void verify(DecodedJWT jwt)",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.sign(byte[] headerBytes, byte[] payloadBytes)",
"constructor": false,
"full_signature": "@Override public byte[] sign(byte[] headerBytes, byte[] payloadBytes)",
"identifier": "sign",
"modifiers": "@Override public",
"parameters": "(byte[] headerBytes, byte[] payloadBytes)",
"return": "byte[]",
"signature": "byte[] sign(byte[] headerBytes, byte[] payloadBytes)",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.sign(byte[] contentBytes)",
"constructor": false,
"full_signature": "@Override @Deprecated public byte[] sign(byte[] contentBytes)",
"identifier": "sign",
"modifiers": "@Override @Deprecated public",
"parameters": "(byte[] contentBytes)",
"return": "byte[]",
"signature": "byte[] sign(byte[] contentBytes)",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.getSigningKeyId()",
"constructor": false,
"full_signature": "@Override public String getSigningKeyId()",
"identifier": "getSigningKeyId",
"modifiers": "@Override public",
"parameters": "()",
"return": "String",
"signature": "String getSigningKeyId()",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.DERToJOSE(byte[] derSignature)",
"constructor": false,
"full_signature": " byte[] DERToJOSE(byte[] derSignature)",
"identifier": "DERToJOSE",
"modifiers": "",
"parameters": "(byte[] derSignature)",
"return": "byte[]",
"signature": "byte[] DERToJOSE(byte[] derSignature)",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.JOSEToDER(byte[] joseSignature)",
"constructor": false,
"full_signature": " byte[] JOSEToDER(byte[] joseSignature)",
"identifier": "JOSEToDER",
"modifiers": "",
"parameters": "(byte[] joseSignature)",
"return": "byte[]",
"signature": "byte[] JOSEToDER(byte[] joseSignature)",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.countPadding(byte[] bytes, int fromIndex, int toIndex)",
"constructor": false,
"full_signature": "private int countPadding(byte[] bytes, int fromIndex, int toIndex)",
"identifier": "countPadding",
"modifiers": "private",
"parameters": "(byte[] bytes, int fromIndex, int toIndex)",
"return": "int",
"signature": "int countPadding(byte[] bytes, int fromIndex, int toIndex)",
"testcase": false
},
{
"class_method_signature": "ECDSAAlgorithm.providerForKeys(final ECPublicKey publicKey, final ECPrivateKey privateKey)",
"constructor": false,
"full_signature": "static ECDSAKeyProvider providerForKeys(final ECPublicKey publicKey, final ECPrivateKey privateKey)",
"identifier": "providerForKeys",
"modifiers": "static",
"parameters": "(final ECPublicKey publicKey, final ECPrivateKey privateKey)",
"return": "ECDSAKeyProvider",
"signature": "ECDSAKeyProvider providerForKeys(final ECPublicKey publicKey, final ECPrivateKey privateKey)",
"testcase": false
}
],
"superclass": "extends Algorithm"
} | {
"body": "@Override\n public void verify(DecodedJWT jwt) throws SignatureVerificationException {\n byte[] signatureBytes = Base64.decodeBase64(jwt.getSignature());\n\n try {\n ECPublicKey publicKey = keyProvider.getPublicKeyById(jwt.getKeyId());\n if (publicKey == null) {\n throw new IllegalStateException(\"The given Public Key is null.\");\n }\n boolean valid = crypto.verifySignatureFor(getDescription(), publicKey, jwt.getHeader(), jwt.getPayload(), JOSEToDER(signatureBytes));\n\n if (!valid) {\n throw new SignatureVerificationException(this);\n }\n } catch (NoSuchAlgorithmException | SignatureException | InvalidKeyException | IllegalStateException e) {\n throw new SignatureVerificationException(this, e);\n }\n }",
"class_method_signature": "ECDSAAlgorithm.verify(DecodedJWT jwt)",
"constructor": false,
"full_signature": "@Override public void verify(DecodedJWT jwt)",
"identifier": "verify",
"invocations": [
"decodeBase64",
"getSignature",
"getPublicKeyById",
"getKeyId",
"verifySignatureFor",
"getDescription",
"getHeader",
"getPayload",
"JOSEToDER"
],
"modifiers": "@Override public",
"parameters": "(DecodedJWT jwt)",
"return": "void",
"signature": "void verify(DecodedJWT jwt)",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 691,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 17517521,
"size": 936,
"stargazer_count": 3678,
"stars": null,
"updates": null,
"url": "https://github.com/auth0/java-jwt"
} |
17517521_309 | {
"fields": [
{
"declarator": "claim",
"modifier": "private",
"original_string": "private NullClaim claim;",
"type": "NullClaim",
"var_name": "claim"
}
],
"file": "lib/src/test/java/com/auth0/jwt/impl/NullClaimTest.java",
"identifier": "NullClaimTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void shouldGetAsDate() throws Exception {\n assertThat(claim.asDate(), is(nullValue()));\n }",
"class_method_signature": "NullClaimTest.shouldGetAsDate()",
"constructor": false,
"full_signature": "@Test public void shouldGetAsDate()",
"identifier": "shouldGetAsDate",
"invocations": [
"assertThat",
"asDate",
"is",
"nullValue"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void shouldGetAsDate()",
"testcase": true
} | {
"fields": [],
"file": "lib/src/main/java/com/auth0/jwt/impl/NullClaim.java",
"identifier": "NullClaim",
"interfaces": "implements Claim",
"methods": [
{
"class_method_signature": "NullClaim.isNull()",
"constructor": false,
"full_signature": "@Override public boolean isNull()",
"identifier": "isNull",
"modifiers": "@Override public",
"parameters": "()",
"return": "boolean",
"signature": "boolean isNull()",
"testcase": false
},
{
"class_method_signature": "NullClaim.asBoolean()",
"constructor": false,
"full_signature": "@Override public Boolean asBoolean()",
"identifier": "asBoolean",
"modifiers": "@Override public",
"parameters": "()",
"return": "Boolean",
"signature": "Boolean asBoolean()",
"testcase": false
},
{
"class_method_signature": "NullClaim.asInt()",
"constructor": false,
"full_signature": "@Override public Integer asInt()",
"identifier": "asInt",
"modifiers": "@Override public",
"parameters": "()",
"return": "Integer",
"signature": "Integer asInt()",
"testcase": false
},
{
"class_method_signature": "NullClaim.asLong()",
"constructor": false,
"full_signature": "@Override public Long asLong()",
"identifier": "asLong",
"modifiers": "@Override public",
"parameters": "()",
"return": "Long",
"signature": "Long asLong()",
"testcase": false
},
{
"class_method_signature": "NullClaim.asDouble()",
"constructor": false,
"full_signature": "@Override public Double asDouble()",
"identifier": "asDouble",
"modifiers": "@Override public",
"parameters": "()",
"return": "Double",
"signature": "Double asDouble()",
"testcase": false
},
{
"class_method_signature": "NullClaim.asString()",
"constructor": false,
"full_signature": "@Override public String asString()",
"identifier": "asString",
"modifiers": "@Override public",
"parameters": "()",
"return": "String",
"signature": "String asString()",
"testcase": false
},
{
"class_method_signature": "NullClaim.asDate()",
"constructor": false,
"full_signature": "@Override public Date asDate()",
"identifier": "asDate",
"modifiers": "@Override public",
"parameters": "()",
"return": "Date",
"signature": "Date asDate()",
"testcase": false
},
{
"class_method_signature": "NullClaim.asArray(Class<T> tClazz)",
"constructor": false,
"full_signature": "@Override public T[] asArray(Class<T> tClazz)",
"identifier": "asArray",
"modifiers": "@Override public",
"parameters": "(Class<T> tClazz)",
"return": "T[]",
"signature": "T[] asArray(Class<T> tClazz)",
"testcase": false
},
{
"class_method_signature": "NullClaim.asList(Class<T> tClazz)",
"constructor": false,
"full_signature": "@Override public List<T> asList(Class<T> tClazz)",
"identifier": "asList",
"modifiers": "@Override public",
"parameters": "(Class<T> tClazz)",
"return": "List<T>",
"signature": "List<T> asList(Class<T> tClazz)",
"testcase": false
},
{
"class_method_signature": "NullClaim.asMap()",
"constructor": false,
"full_signature": "@Override public Map<String, Object> asMap()",
"identifier": "asMap",
"modifiers": "@Override public",
"parameters": "()",
"return": "Map<String, Object>",
"signature": "Map<String, Object> asMap()",
"testcase": false
},
{
"class_method_signature": "NullClaim.as(Class<T> tClazz)",
"constructor": false,
"full_signature": "@Override public T as(Class<T> tClazz)",
"identifier": "as",
"modifiers": "@Override public",
"parameters": "(Class<T> tClazz)",
"return": "T",
"signature": "T as(Class<T> tClazz)",
"testcase": false
}
],
"superclass": ""
} | {
"body": "@Override\n public Date asDate() {\n return null;\n }",
"class_method_signature": "NullClaim.asDate()",
"constructor": false,
"full_signature": "@Override public Date asDate()",
"identifier": "asDate",
"invocations": [],
"modifiers": "@Override public",
"parameters": "()",
"return": "Date",
"signature": "Date asDate()",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 691,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 17517521,
"size": 936,
"stargazer_count": 3678,
"stars": null,
"updates": null,
"url": "https://github.com/auth0/java-jwt"
} |
17517521_132 | {
"fields": [
{
"declarator": "exception = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException exception = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "exception"
},
{
"declarator": "HS256Header = \"eyJhbGciOiJIUzI1NiJ9\"",
"modifier": "private static final",
"original_string": "private static final String HS256Header = \"eyJhbGciOiJIUzI1NiJ9\";",
"type": "String",
"var_name": "HS256Header"
},
{
"declarator": "HS384Header = \"eyJhbGciOiJIUzM4NCJ9\"",
"modifier": "private static final",
"original_string": "private static final String HS384Header = \"eyJhbGciOiJIUzM4NCJ9\";",
"type": "String",
"var_name": "HS384Header"
},
{
"declarator": "HS512Header = \"eyJhbGciOiJIUzUxMiJ9\"",
"modifier": "private static final",
"original_string": "private static final String HS512Header = \"eyJhbGciOiJIUzUxMiJ9\";",
"type": "String",
"var_name": "HS512Header"
},
{
"declarator": "auth0IssPayload = \"eyJpc3MiOiJhdXRoMCJ9\"",
"modifier": "private static final",
"original_string": "private static final String auth0IssPayload = \"eyJpc3MiOiJhdXRoMCJ9\";",
"type": "String",
"var_name": "auth0IssPayload"
}
],
"file": "lib/src/test/java/com/auth0/jwt/algorithms/HMACAlgorithmTest.java",
"identifier": "HMACAlgorithmTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void shouldThrowOnSignWhenSignatureAlgorithmDoesNotExists() throws Exception {\n exception.expect(SignatureGenerationException.class);\n exception.expectMessage(\"The Token's Signature couldn't be generated when signing using the Algorithm: some-algorithm\");\n exception.expectCause(isA(NoSuchAlgorithmException.class));\n\n CryptoHelper crypto = mock(CryptoHelper.class);\n when(crypto.createSignatureFor(anyString(), any(byte[].class), any(byte[].class), any(byte[].class)))\n .thenThrow(NoSuchAlgorithmException.class);\n\n Algorithm algorithm = new HMACAlgorithm(crypto, \"some-alg\", \"some-algorithm\", \"secret\".getBytes(StandardCharsets.UTF_8));\n algorithm.sign(new byte[0], new byte[0]);\n }",
"class_method_signature": "HMACAlgorithmTest.shouldThrowOnSignWhenSignatureAlgorithmDoesNotExists()",
"constructor": false,
"full_signature": "@Test public void shouldThrowOnSignWhenSignatureAlgorithmDoesNotExists()",
"identifier": "shouldThrowOnSignWhenSignatureAlgorithmDoesNotExists",
"invocations": [
"expect",
"expectMessage",
"expectCause",
"isA",
"mock",
"thenThrow",
"when",
"createSignatureFor",
"anyString",
"any",
"any",
"any",
"getBytes",
"sign"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void shouldThrowOnSignWhenSignatureAlgorithmDoesNotExists()",
"testcase": true
} | {
"fields": [
{
"declarator": "crypto",
"modifier": "private final",
"original_string": "private final CryptoHelper crypto;",
"type": "CryptoHelper",
"var_name": "crypto"
},
{
"declarator": "secret",
"modifier": "private final",
"original_string": "private final byte[] secret;",
"type": "byte[]",
"var_name": "secret"
}
],
"file": "lib/src/main/java/com/auth0/jwt/algorithms/HMACAlgorithm.java",
"identifier": "HMACAlgorithm",
"interfaces": "",
"methods": [
{
"class_method_signature": "HMACAlgorithm.HMACAlgorithm(CryptoHelper crypto, String id, String algorithm, byte[] secretBytes)",
"constructor": true,
"full_signature": " HMACAlgorithm(CryptoHelper crypto, String id, String algorithm, byte[] secretBytes)",
"identifier": "HMACAlgorithm",
"modifiers": "",
"parameters": "(CryptoHelper crypto, String id, String algorithm, byte[] secretBytes)",
"return": "",
"signature": " HMACAlgorithm(CryptoHelper crypto, String id, String algorithm, byte[] secretBytes)",
"testcase": false
},
{
"class_method_signature": "HMACAlgorithm.HMACAlgorithm(String id, String algorithm, byte[] secretBytes)",
"constructor": true,
"full_signature": " HMACAlgorithm(String id, String algorithm, byte[] secretBytes)",
"identifier": "HMACAlgorithm",
"modifiers": "",
"parameters": "(String id, String algorithm, byte[] secretBytes)",
"return": "",
"signature": " HMACAlgorithm(String id, String algorithm, byte[] secretBytes)",
"testcase": false
},
{
"class_method_signature": "HMACAlgorithm.HMACAlgorithm(String id, String algorithm, String secret)",
"constructor": true,
"full_signature": " HMACAlgorithm(String id, String algorithm, String secret)",
"identifier": "HMACAlgorithm",
"modifiers": "",
"parameters": "(String id, String algorithm, String secret)",
"return": "",
"signature": " HMACAlgorithm(String id, String algorithm, String secret)",
"testcase": false
},
{
"class_method_signature": "HMACAlgorithm.getSecretBytes(String secret)",
"constructor": false,
"full_signature": "static byte[] getSecretBytes(String secret)",
"identifier": "getSecretBytes",
"modifiers": "static",
"parameters": "(String secret)",
"return": "byte[]",
"signature": "byte[] getSecretBytes(String secret)",
"testcase": false
},
{
"class_method_signature": "HMACAlgorithm.verify(DecodedJWT jwt)",
"constructor": false,
"full_signature": "@Override public void verify(DecodedJWT jwt)",
"identifier": "verify",
"modifiers": "@Override public",
"parameters": "(DecodedJWT jwt)",
"return": "void",
"signature": "void verify(DecodedJWT jwt)",
"testcase": false
},
{
"class_method_signature": "HMACAlgorithm.sign(byte[] headerBytes, byte[] payloadBytes)",
"constructor": false,
"full_signature": "@Override public byte[] sign(byte[] headerBytes, byte[] payloadBytes)",
"identifier": "sign",
"modifiers": "@Override public",
"parameters": "(byte[] headerBytes, byte[] payloadBytes)",
"return": "byte[]",
"signature": "byte[] sign(byte[] headerBytes, byte[] payloadBytes)",
"testcase": false
},
{
"class_method_signature": "HMACAlgorithm.sign(byte[] contentBytes)",
"constructor": false,
"full_signature": "@Override @Deprecated public byte[] sign(byte[] contentBytes)",
"identifier": "sign",
"modifiers": "@Override @Deprecated public",
"parameters": "(byte[] contentBytes)",
"return": "byte[]",
"signature": "byte[] sign(byte[] contentBytes)",
"testcase": false
}
],
"superclass": "extends Algorithm"
} | {
"body": "@Override\n public byte[] sign(byte[] headerBytes, byte[] payloadBytes) throws SignatureGenerationException {\n try {\n return crypto.createSignatureFor(getDescription(), secret, headerBytes, payloadBytes);\n } catch (NoSuchAlgorithmException | InvalidKeyException e) {\n throw new SignatureGenerationException(this, e);\n }\n }",
"class_method_signature": "HMACAlgorithm.sign(byte[] headerBytes, byte[] payloadBytes)",
"constructor": false,
"full_signature": "@Override public byte[] sign(byte[] headerBytes, byte[] payloadBytes)",
"identifier": "sign",
"invocations": [
"createSignatureFor",
"getDescription"
],
"modifiers": "@Override public",
"parameters": "(byte[] headerBytes, byte[] payloadBytes)",
"return": "byte[]",
"signature": "byte[] sign(byte[] headerBytes, byte[] payloadBytes)",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 691,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 17517521,
"size": 936,
"stargazer_count": 3678,
"stars": null,
"updates": null,
"url": "https://github.com/auth0/java-jwt"
} |
19317653_9 | {
"fields": [
{
"declarator": "td1",
"modifier": "private",
"original_string": "private ToDo td1;",
"type": "ToDo",
"var_name": "td1"
},
{
"declarator": "td2",
"modifier": "private",
"original_string": "private ToDo td2;",
"type": "ToDo",
"var_name": "td2"
},
{
"declarator": "store",
"modifier": "private",
"original_string": "private ToDoStore store;",
"type": "ToDoStore",
"var_name": "store"
},
{
"declarator": "api",
"modifier": "private",
"original_string": "private ToDoAPI api;",
"type": "ToDoAPI",
"var_name": "api"
},
{
"declarator": "exceptionStore = new ToDoStore(){\n\n\t\t@Override\n\t\tpublic Collection<ToDo> getAll() throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo get(String id) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo persist(ToDo td) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo update(String id, ToDo td) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic void delete(String id) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n @Override\n public int count() throws ToDoStoreException {\n throw new ToDoStoreException(\"Error\");\n }\n\t}",
"modifier": "private",
"original_string": "private ToDoStore exceptionStore = new ToDoStore(){\n\n\t\t@Override\n\t\tpublic Collection<ToDo> getAll() throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo get(String id) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo persist(ToDo td) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo update(String id, ToDo td) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic void delete(String id) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n @Override\n public int count() throws ToDoStoreException {\n throw new ToDoStoreException(\"Error\");\n }\n\t};",
"type": "ToDoStore",
"var_name": "exceptionStore"
},
{
"declarator": "errorApi",
"modifier": "private",
"original_string": "private ToDoAPI errorApi;",
"type": "ToDoAPI",
"var_name": "errorApi"
}
],
"file": "java/bluemix-todo-app/src/test/java/net/bluemix/todo/rest/ToDoAPITest.java",
"identifier": "ToDoAPITest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n\tpublic void testUpdateToDo() {\n\t\tToDo td = new ToDo();\n\t\ttd.setTitle(\"do a test\");\n\t\ttd.setCompleted(true);\n\t\tapi.updateToDo(td1.getId(), td);\n\t\ttd = api.getToDo(td1.getId());\n\t\tassertEquals(\"do a test\", td.getTitle());\n\t\tassertTrue(td.isCompleted());\n\t}",
"class_method_signature": "ToDoAPITest.testUpdateToDo()",
"constructor": false,
"full_signature": "@Test public void testUpdateToDo()",
"identifier": "testUpdateToDo",
"invocations": [
"setTitle",
"setCompleted",
"updateToDo",
"getId",
"getToDo",
"getId",
"assertEquals",
"getTitle",
"assertTrue",
"isCompleted"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void testUpdateToDo()",
"testcase": true
} | {
"fields": [
{
"declarator": "store",
"modifier": "private",
"original_string": "private ToDoStore store;",
"type": "ToDoStore",
"var_name": "store"
}
],
"file": "java/bluemix-todo-app/src/main/java/net/bluemix/todo/rest/ToDoAPI.java",
"identifier": "ToDoAPI",
"interfaces": "",
"methods": [
{
"class_method_signature": "ToDoAPI.ToDoAPI()",
"constructor": true,
"full_signature": "public ToDoAPI()",
"identifier": "ToDoAPI",
"modifiers": "public",
"parameters": "()",
"return": "",
"signature": " ToDoAPI()",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.ToDoAPI(ToDoStore store)",
"constructor": true,
"full_signature": "public ToDoAPI(ToDoStore store)",
"identifier": "ToDoAPI",
"modifiers": "public",
"parameters": "(ToDoStore store)",
"return": "",
"signature": " ToDoAPI(ToDoStore store)",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.getToDo(@PathParam(\"id\") String id)",
"constructor": false,
"full_signature": "@GET @Path(\"/{id}\") @Produces(\"application/json\") public ToDo getToDo(@PathParam(\"id\") String id)",
"identifier": "getToDo",
"modifiers": "@GET @Path(\"/{id}\") @Produces(\"application/json\") public",
"parameters": "(@PathParam(\"id\") String id)",
"return": "ToDo",
"signature": "ToDo getToDo(@PathParam(\"id\") String id)",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.getToDos()",
"constructor": false,
"full_signature": "@GET @Produces(\"application/json\") public Collection<ToDo> getToDos()",
"identifier": "getToDos",
"modifiers": "@GET @Produces(\"application/json\") public",
"parameters": "()",
"return": "Collection<ToDo>",
"signature": "Collection<ToDo> getToDos()",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.newToDo(ToDo td)",
"constructor": false,
"full_signature": "@POST @Consumes(\"application/json\") @Produces(\"application/json\") public ToDo newToDo(ToDo td)",
"identifier": "newToDo",
"modifiers": "@POST @Consumes(\"application/json\") @Produces(\"application/json\") public",
"parameters": "(ToDo td)",
"return": "ToDo",
"signature": "ToDo newToDo(ToDo td)",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.updateToDo(@PathParam(\"id\") String id, ToDo td)",
"constructor": false,
"full_signature": "@PUT @Path(\"/{id}\") @Produces(\"application/json\") @Consumes(\"application/json\") public ToDo updateToDo(@PathParam(\"id\") String id, ToDo td)",
"identifier": "updateToDo",
"modifiers": "@PUT @Path(\"/{id}\") @Produces(\"application/json\") @Consumes(\"application/json\") public",
"parameters": "(@PathParam(\"id\") String id, ToDo td)",
"return": "ToDo",
"signature": "ToDo updateToDo(@PathParam(\"id\") String id, ToDo td)",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.deleteToDo(@PathParam(\"id\") String id)",
"constructor": false,
"full_signature": "@DELETE @Path(\"/{id}\") public void deleteToDo(@PathParam(\"id\") String id)",
"identifier": "deleteToDo",
"modifiers": "@DELETE @Path(\"/{id}\") public",
"parameters": "(@PathParam(\"id\") String id)",
"return": "void",
"signature": "void deleteToDo(@PathParam(\"id\") String id)",
"testcase": false
}
],
"superclass": ""
} | {
"body": "@PUT @Path(\"/{id}\")\n @Produces(\"application/json\")\n @Consumes(\"application/json\")\n public ToDo updateToDo(@PathParam(\"id\") String id, ToDo td) {\n if(id == null) {\n throw new WebApplicationException(\"Must supply an ID, for example /api/todos/123.\", \n Response.Status.BAD_REQUEST);\n }\n if(td == null) {\n throw new WebApplicationException(\"Must supply a ToDo in the PUT body.\", \n Response.Status.BAD_REQUEST);\n }\n try {\n ToDo updatedTd = store.update(id, td);\n if(updatedTd == null) {\n throw new WebApplicationException(\"The ToDo with the ID \" + id + \" does not exist.\",\n Response.Status.BAD_REQUEST);\n }\n return updatedTd;\n } catch (ToDoStoreException e) {\n throw new WebApplicationException(\"Error updating ToDo.\", Response.Status.INTERNAL_SERVER_ERROR);\n }\n }",
"class_method_signature": "ToDoAPI.updateToDo(@PathParam(\"id\") String id, ToDo td)",
"constructor": false,
"full_signature": "@PUT @Path(\"/{id}\") @Produces(\"application/json\") @Consumes(\"application/json\") public ToDo updateToDo(@PathParam(\"id\") String id, ToDo td)",
"identifier": "updateToDo",
"invocations": [
"update"
],
"modifiers": "@PUT @Path(\"/{id}\") @Produces(\"application/json\") @Consumes(\"application/json\") public",
"parameters": "(@PathParam(\"id\") String id, ToDo td)",
"return": "ToDo",
"signature": "ToDo updateToDo(@PathParam(\"id\") String id, ToDo td)",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 305,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 19317653,
"size": 777,
"stargazer_count": 196,
"stars": null,
"updates": null,
"url": "https://github.com/IBM-Cloud/todo-apps"
} |
19317653_30 | {
"fields": [],
"file": "java/bluemix-todo-app/src/test/java/net/bluemix/todo/model/ToDoTest.java",
"identifier": "ToDoTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n\tpublic void testGetOrder() {\n\t ToDo td = new ToDo();\n\t td.setOrder(1);\n\t assertEquals(1, td.getOrder());\n\t}",
"class_method_signature": "ToDoTest.testGetOrder()",
"constructor": false,
"full_signature": "@Test public void testGetOrder()",
"identifier": "testGetOrder",
"invocations": [
"setOrder",
"assertEquals",
"getOrder"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void testGetOrder()",
"testcase": true
} | {
"fields": [
{
"declarator": "completed",
"modifier": "private",
"original_string": "private boolean completed;",
"type": "boolean",
"var_name": "completed"
},
{
"declarator": "title",
"modifier": "private",
"original_string": "private String title;",
"type": "String",
"var_name": "title"
},
{
"declarator": "id",
"modifier": "private",
"original_string": "private String id;",
"type": "String",
"var_name": "id"
},
{
"declarator": "order",
"modifier": "private",
"original_string": "private int order;",
"type": "int",
"var_name": "order"
}
],
"file": "java/bluemix-todo-app/src/main/java/net/bluemix/todo/model/ToDo.java",
"identifier": "ToDo",
"interfaces": "",
"methods": [
{
"class_method_signature": "ToDo.ToDo()",
"constructor": true,
"full_signature": "public ToDo()",
"identifier": "ToDo",
"modifiers": "public",
"parameters": "()",
"return": "",
"signature": " ToDo()",
"testcase": false
},
{
"class_method_signature": "ToDo.getId()",
"constructor": false,
"full_signature": "public String getId()",
"identifier": "getId",
"modifiers": "public",
"parameters": "()",
"return": "String",
"signature": "String getId()",
"testcase": false
},
{
"class_method_signature": "ToDo.setId(String id)",
"constructor": false,
"full_signature": "public void setId(String id)",
"identifier": "setId",
"modifiers": "public",
"parameters": "(String id)",
"return": "void",
"signature": "void setId(String id)",
"testcase": false
},
{
"class_method_signature": "ToDo.isCompleted()",
"constructor": false,
"full_signature": "public boolean isCompleted()",
"identifier": "isCompleted",
"modifiers": "public",
"parameters": "()",
"return": "boolean",
"signature": "boolean isCompleted()",
"testcase": false
},
{
"class_method_signature": "ToDo.setCompleted(boolean completed)",
"constructor": false,
"full_signature": "public void setCompleted(boolean completed)",
"identifier": "setCompleted",
"modifiers": "public",
"parameters": "(boolean completed)",
"return": "void",
"signature": "void setCompleted(boolean completed)",
"testcase": false
},
{
"class_method_signature": "ToDo.getTitle()",
"constructor": false,
"full_signature": "public String getTitle()",
"identifier": "getTitle",
"modifiers": "public",
"parameters": "()",
"return": "String",
"signature": "String getTitle()",
"testcase": false
},
{
"class_method_signature": "ToDo.setTitle(String title)",
"constructor": false,
"full_signature": "public void setTitle(String title)",
"identifier": "setTitle",
"modifiers": "public",
"parameters": "(String title)",
"return": "void",
"signature": "void setTitle(String title)",
"testcase": false
},
{
"class_method_signature": "ToDo.getOrder()",
"constructor": false,
"full_signature": "public int getOrder()",
"identifier": "getOrder",
"modifiers": "public",
"parameters": "()",
"return": "int",
"signature": "int getOrder()",
"testcase": false
},
{
"class_method_signature": "ToDo.setOrder(int order)",
"constructor": false,
"full_signature": "public void setOrder(int order)",
"identifier": "setOrder",
"modifiers": "public",
"parameters": "(int order)",
"return": "void",
"signature": "void setOrder(int order)",
"testcase": false
},
{
"class_method_signature": "ToDo.equals(Object obj)",
"constructor": false,
"full_signature": "@Override public boolean equals(Object obj)",
"identifier": "equals",
"modifiers": "@Override public",
"parameters": "(Object obj)",
"return": "boolean",
"signature": "boolean equals(Object obj)",
"testcase": false
},
{
"class_method_signature": "ToDo.hashCode()",
"constructor": false,
"full_signature": "@Override public int hashCode()",
"identifier": "hashCode",
"modifiers": "@Override public",
"parameters": "()",
"return": "int",
"signature": "int hashCode()",
"testcase": false
}
],
"superclass": ""
} | {
"body": "public int getOrder() {\n return order;\n }",
"class_method_signature": "ToDo.getOrder()",
"constructor": false,
"full_signature": "public int getOrder()",
"identifier": "getOrder",
"invocations": [],
"modifiers": "public",
"parameters": "()",
"return": "int",
"signature": "int getOrder()",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 305,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 19317653,
"size": 777,
"stargazer_count": 196,
"stars": null,
"updates": null,
"url": "https://github.com/IBM-Cloud/todo-apps"
} |
19317653_26 | {
"fields": [],
"file": "java/bluemix-todo-app/src/test/java/net/bluemix/todo/model/CloudantPostResponseTest.java",
"identifier": "CloudantPostResponseTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testGetRev() {\n CloudantPostResponse resp = new CloudantPostResponse();\n resp.setRev(\"abc\");\n assertEquals(\"abc\", resp.getRev());\n }",
"class_method_signature": "CloudantPostResponseTest.testGetRev()",
"constructor": false,
"full_signature": "@Test public void testGetRev()",
"identifier": "testGetRev",
"invocations": [
"setRev",
"assertEquals",
"getRev"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void testGetRev()",
"testcase": true
} | {
"fields": [
{
"declarator": "id",
"modifier": "private",
"original_string": "private String id;",
"type": "String",
"var_name": "id"
},
{
"declarator": "ok",
"modifier": "private",
"original_string": "private boolean ok;",
"type": "boolean",
"var_name": "ok"
},
{
"declarator": "rev",
"modifier": "private",
"original_string": "private String rev;",
"type": "String",
"var_name": "rev"
}
],
"file": "java/bluemix-todo-app/src/main/java/net/bluemix/todo/model/CloudantPostResponse.java",
"identifier": "CloudantPostResponse",
"interfaces": "",
"methods": [
{
"class_method_signature": "CloudantPostResponse.getId()",
"constructor": false,
"full_signature": "public String getId()",
"identifier": "getId",
"modifiers": "public",
"parameters": "()",
"return": "String",
"signature": "String getId()",
"testcase": false
},
{
"class_method_signature": "CloudantPostResponse.setId(String id)",
"constructor": false,
"full_signature": "public void setId(String id)",
"identifier": "setId",
"modifiers": "public",
"parameters": "(String id)",
"return": "void",
"signature": "void setId(String id)",
"testcase": false
},
{
"class_method_signature": "CloudantPostResponse.isOk()",
"constructor": false,
"full_signature": "public boolean isOk()",
"identifier": "isOk",
"modifiers": "public",
"parameters": "()",
"return": "boolean",
"signature": "boolean isOk()",
"testcase": false
},
{
"class_method_signature": "CloudantPostResponse.setOk(boolean ok)",
"constructor": false,
"full_signature": "public void setOk(boolean ok)",
"identifier": "setOk",
"modifiers": "public",
"parameters": "(boolean ok)",
"return": "void",
"signature": "void setOk(boolean ok)",
"testcase": false
},
{
"class_method_signature": "CloudantPostResponse.getRev()",
"constructor": false,
"full_signature": "public String getRev()",
"identifier": "getRev",
"modifiers": "public",
"parameters": "()",
"return": "String",
"signature": "String getRev()",
"testcase": false
},
{
"class_method_signature": "CloudantPostResponse.setRev(String rev)",
"constructor": false,
"full_signature": "public void setRev(String rev)",
"identifier": "setRev",
"modifiers": "public",
"parameters": "(String rev)",
"return": "void",
"signature": "void setRev(String rev)",
"testcase": false
}
],
"superclass": ""
} | {
"body": "public String getRev() {\n return rev;\n }",
"class_method_signature": "CloudantPostResponse.getRev()",
"constructor": false,
"full_signature": "public String getRev()",
"identifier": "getRev",
"invocations": [],
"modifiers": "public",
"parameters": "()",
"return": "String",
"signature": "String getRev()",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 305,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 19317653,
"size": 777,
"stargazer_count": 196,
"stars": null,
"updates": null,
"url": "https://github.com/IBM-Cloud/todo-apps"
} |
19317653_51 | {
"fields": [
{
"declarator": "docs",
"modifier": "private",
"original_string": "private CloudantAllDocs docs;",
"type": "CloudantAllDocs",
"var_name": "docs"
},
{
"declarator": "rows",
"modifier": "private",
"original_string": "private List<CloudantRow> rows;",
"type": "List<CloudantRow>",
"var_name": "rows"
},
{
"declarator": "row1",
"modifier": "private",
"original_string": "private CloudantRow row1;",
"type": "CloudantRow",
"var_name": "row1"
},
{
"declarator": "row2",
"modifier": "private",
"original_string": "private CloudantRow row2;",
"type": "CloudantRow",
"var_name": "row2"
},
{
"declarator": "row3",
"modifier": "private",
"original_string": "private CloudantRow row3;",
"type": "CloudantRow",
"var_name": "row3"
},
{
"declarator": "ctd1",
"modifier": "private",
"original_string": "private CloudantToDo ctd1;",
"type": "CloudantToDo",
"var_name": "ctd1"
},
{
"declarator": "ctd2",
"modifier": "private",
"original_string": "private CloudantToDo ctd2;",
"type": "CloudantToDo",
"var_name": "ctd2"
},
{
"declarator": "ctd3",
"modifier": "private",
"original_string": "private CloudantToDo ctd3;",
"type": "CloudantToDo",
"var_name": "ctd3"
},
{
"declarator": "count",
"modifier": "private",
"original_string": "private CloudantCount count;",
"type": "CloudantCount",
"var_name": "count"
},
{
"declarator": "reducedRows",
"modifier": "private",
"original_string": "private List<CloudantReducedRow> reducedRows;",
"type": "List<CloudantReducedRow>",
"var_name": "reducedRows"
},
{
"declarator": "reducedRow",
"modifier": "private",
"original_string": "private CloudantReducedRow reducedRow;",
"type": "CloudantReducedRow",
"var_name": "reducedRow"
}
],
"file": "java/bluemix-todo-app/src/test/java/net/bluemix/todo/store/CloudantStoreTest.java",
"identifier": "CloudantStoreTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testGetAll() throws Exception {\n IMocksControl control = createControl();\n Response resp = control.createMock(Response.class);\n expect(resp.getStatus()).andReturn(200).times(3);\n Capture<Class<CloudantAllDocs>> classCapture = new Capture<Class<CloudantAllDocs>>();\n expect(resp.readEntity(capture(classCapture))).andReturn(docs);\n replay(resp);\n WebTarget wt = createMockWebTarget();\n Invocation.Builder builder = createBuilder();\n expect(builder.get()).andReturn(resp).times(3);\n replay(builder);\n expect(wt.path(eq(\"bluemix-todo\"))).andReturn(wt).times(2);\n expect(wt.path(eq(\"todos\"))).andReturn(wt).times(2);\n expect(wt.path(eq(\"_design\"))).andReturn(wt).times(2);\n expect(wt.path(eq(\"_view\"))).andReturn(wt);\n expect(wt.path(eq(\"allTodos\"))).andReturn(wt);\n expect(wt.queryParam(eq(\"reduce\"), eq(false))).andReturn(wt);\n //expect(wt.queryParam(eq(\"include_docs\"), eq(true))).andReturn(wt);\n expect(wt.request(eq(\"application/json\"))).andReturn(builder).anyTimes();\n replay(wt);\n CloudantStore store = new CloudantStore(wt);\n Collection<ToDo> todos = store.getAll();\n List<ToDo> testToDos = new ArrayList<ToDo>();\n testToDos.add(ctd1.getToDo());\n testToDos.add(ctd2.getToDo());\n testToDos.add(ctd3.getToDo());\n assertEquals(testToDos, todos);\n assertEquals(CloudantAllDocs.class, classCapture.getValue());\n verify(resp);\n verify(wt);\n verify(builder);\n }",
"class_method_signature": "CloudantStoreTest.testGetAll()",
"constructor": false,
"full_signature": "@Test public void testGetAll()",
"identifier": "testGetAll",
"invocations": [
"createControl",
"createMock",
"times",
"andReturn",
"expect",
"getStatus",
"andReturn",
"expect",
"readEntity",
"capture",
"replay",
"createMockWebTarget",
"createBuilder",
"times",
"andReturn",
"expect",
"get",
"replay",
"times",
"andReturn",
"expect",
"path",
"eq",
"times",
"andReturn",
"expect",
"path",
"eq",
"times",
"andReturn",
"expect",
"path",
"eq",
"andReturn",
"expect",
"path",
"eq",
"andReturn",
"expect",
"path",
"eq",
"andReturn",
"expect",
"queryParam",
"eq",
"eq",
"anyTimes",
"andReturn",
"expect",
"request",
"eq",
"replay",
"getAll",
"add",
"getToDo",
"add",
"getToDo",
"add",
"getToDo",
"assertEquals",
"assertEquals",
"getValue",
"verify",
"verify",
"verify"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void testGetAll()",
"testcase": true
} | {
"fields": [
{
"declarator": "REVISION_PARAM = \"rev\"",
"modifier": "private static final",
"original_string": "private static final String REVISION_PARAM = \"rev\";",
"type": "String",
"var_name": "REVISION_PARAM"
},
{
"declarator": "DESIGN_DOC_NAME = \"todos\"",
"modifier": "private static final",
"original_string": "private static final String DESIGN_DOC_NAME = \"todos\";",
"type": "String",
"var_name": "DESIGN_DOC_NAME"
},
{
"declarator": "VIEW_NAME = \"allTodos\"",
"modifier": "private static final",
"original_string": "private static final String VIEW_NAME = \"allTodos\";",
"type": "String",
"var_name": "VIEW_NAME"
},
{
"declarator": "DESIGN_DOC = \n \"{\" +\n \"\\\"views\\\": {\" +\n \"\\\"allTodos\\\": {\" +\n \"\\\"reduce\\\": \\\"_count\\\",\" +\n \"\\\"map\\\": \\\"function(doc){if(doc.title && doc.completed != null){emit(doc.order,{title: doc.title,completed: doc.completed})}}\\\"\" +\n \"}\" +\n \"}\" +\n \"}\"",
"modifier": "private static final",
"original_string": "private static final String DESIGN_DOC = \n \"{\" +\n \"\\\"views\\\": {\" +\n \"\\\"allTodos\\\": {\" +\n \"\\\"reduce\\\": \\\"_count\\\",\" +\n \"\\\"map\\\": \\\"function(doc){if(doc.title && doc.completed != null){emit(doc.order,{title: doc.title,completed: doc.completed})}}\\\"\" +\n \"}\" +\n \"}\" +\n \"}\";",
"type": "String",
"var_name": "DESIGN_DOC"
},
{
"declarator": "LOG = Logger.getLogger(CloudantStore.class.getName())",
"modifier": "private static final",
"original_string": "private static final Logger LOG = Logger.getLogger(CloudantStore.class.getName());",
"type": "Logger",
"var_name": "LOG"
},
{
"declarator": "target",
"modifier": "private",
"original_string": "private WebTarget target;",
"type": "WebTarget",
"var_name": "target"
}
],
"file": "java/bluemix-todo-app/src/main/java/net/bluemix/todo/store/CloudantStore.java",
"identifier": "CloudantStore",
"interfaces": "implements ToDoStore",
"methods": [
{
"class_method_signature": "CloudantStore.CloudantStore(WebTarget target)",
"constructor": true,
"full_signature": "public CloudantStore(WebTarget target)",
"identifier": "CloudantStore",
"modifiers": "public",
"parameters": "(WebTarget target)",
"return": "",
"signature": " CloudantStore(WebTarget target)",
"testcase": false
},
{
"class_method_signature": "CloudantStore.createDB(WebTarget target)",
"constructor": false,
"full_signature": "private void createDB(WebTarget target)",
"identifier": "createDB",
"modifiers": "private",
"parameters": "(WebTarget target)",
"return": "void",
"signature": "void createDB(WebTarget target)",
"testcase": false
},
{
"class_method_signature": "CloudantStore.createDesignDoc(WebTarget target)",
"constructor": false,
"full_signature": "private static void createDesignDoc(WebTarget target)",
"identifier": "createDesignDoc",
"modifiers": "private static",
"parameters": "(WebTarget target)",
"return": "void",
"signature": "void createDesignDoc(WebTarget target)",
"testcase": false
},
{
"class_method_signature": "CloudantStore.getAll()",
"constructor": false,
"full_signature": "@Override public Collection<ToDo> getAll()",
"identifier": "getAll",
"modifiers": "@Override public",
"parameters": "()",
"return": "Collection<ToDo>",
"signature": "Collection<ToDo> getAll()",
"testcase": false
},
{
"class_method_signature": "CloudantStore.get(String id)",
"constructor": false,
"full_signature": "@Override public ToDo get(String id)",
"identifier": "get",
"modifiers": "@Override public",
"parameters": "(String id)",
"return": "ToDo",
"signature": "ToDo get(String id)",
"testcase": false
},
{
"class_method_signature": "CloudantStore.getRequest(String id)",
"constructor": false,
"full_signature": "private Response getRequest(String id)",
"identifier": "getRequest",
"modifiers": "private",
"parameters": "(String id)",
"return": "Response",
"signature": "Response getRequest(String id)",
"testcase": false
},
{
"class_method_signature": "CloudantStore.persist(ToDo td)",
"constructor": false,
"full_signature": "@Override public ToDo persist(ToDo td)",
"identifier": "persist",
"modifiers": "@Override public",
"parameters": "(ToDo td)",
"return": "ToDo",
"signature": "ToDo persist(ToDo td)",
"testcase": false
},
{
"class_method_signature": "CloudantStore.update(String id, ToDo td)",
"constructor": false,
"full_signature": "@Override public ToDo update(String id, ToDo td)",
"identifier": "update",
"modifiers": "@Override public",
"parameters": "(String id, ToDo td)",
"return": "ToDo",
"signature": "ToDo update(String id, ToDo td)",
"testcase": false
},
{
"class_method_signature": "CloudantStore.delete(String id)",
"constructor": false,
"full_signature": "@Override public void delete(String id)",
"identifier": "delete",
"modifiers": "@Override public",
"parameters": "(String id)",
"return": "void",
"signature": "void delete(String id)",
"testcase": false
},
{
"class_method_signature": "CloudantStore.count()",
"constructor": false,
"full_signature": "@Override public int count()",
"identifier": "count",
"modifiers": "@Override public",
"parameters": "()",
"return": "int",
"signature": "int count()",
"testcase": false
}
],
"superclass": ""
} | {
"body": "@Override\n public Collection<ToDo> getAll() throws ToDoStoreException {\n Response allDocsResp = target.queryParam(\"reduce\", false).\n path(\"_design\").path(DESIGN_DOC_NAME).path(\"_view\").path(VIEW_NAME).\n request(MediaType.APPLICATION_JSON).get();\n int status = allDocsResp.getStatus();\n if(status == HttpURLConnection.HTTP_OK) {\n List<ToDo> todos = new ArrayList<ToDo>();\n CloudantAllDocs all = allDocsResp.readEntity(CloudantAllDocs.class);\n for(CloudantRow row : all.getRows()) {\n ToDo td = row.getValue();\n td.setId(row.getId());\n td.setOrder(row.getKey());\n todos.add(td);\n }\n return todos;\n } else {\n throw new ToDoStoreException(\"There was an error retrieving the tasks from Cloudant. Error \"\n + status);\n } \n }",
"class_method_signature": "CloudantStore.getAll()",
"constructor": false,
"full_signature": "@Override public Collection<ToDo> getAll()",
"identifier": "getAll",
"invocations": [
"get",
"request",
"path",
"path",
"path",
"path",
"queryParam",
"getStatus",
"readEntity",
"getRows",
"getValue",
"setId",
"getId",
"setOrder",
"getKey",
"add"
],
"modifiers": "@Override public",
"parameters": "()",
"return": "Collection<ToDo>",
"signature": "Collection<ToDo> getAll()",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 305,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 19317653,
"size": 777,
"stargazer_count": 196,
"stars": null,
"updates": null,
"url": "https://github.com/IBM-Cloud/todo-apps"
} |
19317653_47 | {
"fields": [],
"file": "java/bluemix-todo-app/src/test/java/net/bluemix/todo/store/MongoStoreTest.java",
"identifier": "MongoStoreTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n\tpublic void testPersist() {\n\t\tDBCollection coll = createMockCollection();\n\t\tToDo td = new ToDo();\n\t\ttd.setTitle(\"This is a test\");\n\t\ttd.setId(\"aaaaaaaaaaaaaaaaaaaaaaa1\");\n\t\texpect(coll.insert(isA(DBObject.class))).andAnswer(new IAnswer<WriteResult>() {\n\t\t\t@Override\n\t\t\tpublic WriteResult answer() throws Throwable {\n\t\t\t\tDBObject obj = (DBObject)getCurrentArguments()[0];\n\t\t\t\tobj.put(\"_id\", new ObjectId(\"aaaaaaaaaaaaaaaaaaaaaaa1\"));\n\t\t\t\treturn null;\n\t\t\t}\n\t\t});\n\t\treplay(coll);\n\t\tMongoStore store = new MongoStore(coll);\n\t\tassertEquals(td, store.persist(td));\n\t\tverify(coll);\n\t}",
"class_method_signature": "MongoStoreTest.testPersist()",
"constructor": false,
"full_signature": "@Test public void testPersist()",
"identifier": "testPersist",
"invocations": [
"createMockCollection",
"setTitle",
"setId",
"andAnswer",
"expect",
"insert",
"isA",
"getCurrentArguments",
"put",
"replay",
"assertEquals",
"persist",
"verify"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void testPersist()",
"testcase": true
} | {
"fields": [
{
"declarator": "coll",
"modifier": "private",
"original_string": "private DBCollection coll;",
"type": "DBCollection",
"var_name": "coll"
}
],
"file": "java/bluemix-todo-app/src/main/java/net/bluemix/todo/store/MongoStore.java",
"identifier": "MongoStore",
"interfaces": "implements ToDoStore",
"methods": [
{
"class_method_signature": "MongoStore.MongoStore(DBCollection coll)",
"constructor": true,
"full_signature": "public MongoStore(DBCollection coll)",
"identifier": "MongoStore",
"modifiers": "public",
"parameters": "(DBCollection coll)",
"return": "",
"signature": " MongoStore(DBCollection coll)",
"testcase": false
},
{
"class_method_signature": "MongoStore.getAll()",
"constructor": false,
"full_signature": "@Override public Collection<ToDo> getAll()",
"identifier": "getAll",
"modifiers": "@Override public",
"parameters": "()",
"return": "Collection<ToDo>",
"signature": "Collection<ToDo> getAll()",
"testcase": false
},
{
"class_method_signature": "MongoStore.get(String id)",
"constructor": false,
"full_signature": "@Override public ToDo get(String id)",
"identifier": "get",
"modifiers": "@Override public",
"parameters": "(String id)",
"return": "ToDo",
"signature": "ToDo get(String id)",
"testcase": false
},
{
"class_method_signature": "MongoStore.persist(ToDo td)",
"constructor": false,
"full_signature": "@Override public ToDo persist(ToDo td)",
"identifier": "persist",
"modifiers": "@Override public",
"parameters": "(ToDo td)",
"return": "ToDo",
"signature": "ToDo persist(ToDo td)",
"testcase": false
},
{
"class_method_signature": "MongoStore.update(String id, ToDo td)",
"constructor": false,
"full_signature": "@Override public ToDo update(String id, ToDo td)",
"identifier": "update",
"modifiers": "@Override public",
"parameters": "(String id, ToDo td)",
"return": "ToDo",
"signature": "ToDo update(String id, ToDo td)",
"testcase": false
},
{
"class_method_signature": "MongoStore.delete(String id)",
"constructor": false,
"full_signature": "@Override public void delete(String id)",
"identifier": "delete",
"modifiers": "@Override public",
"parameters": "(String id)",
"return": "void",
"signature": "void delete(String id)",
"testcase": false
},
{
"class_method_signature": "MongoStore.createToDo(DBObject dbObj)",
"constructor": false,
"full_signature": "private ToDo createToDo(DBObject dbObj)",
"identifier": "createToDo",
"modifiers": "private",
"parameters": "(DBObject dbObj)",
"return": "ToDo",
"signature": "ToDo createToDo(DBObject dbObj)",
"testcase": false
},
{
"class_method_signature": "MongoStore.convertToDbObject(ToDo td)",
"constructor": false,
"full_signature": "private DBObject convertToDbObject(ToDo td)",
"identifier": "convertToDbObject",
"modifiers": "private",
"parameters": "(ToDo td)",
"return": "DBObject",
"signature": "DBObject convertToDbObject(ToDo td)",
"testcase": false
},
{
"class_method_signature": "MongoStore.count()",
"constructor": false,
"full_signature": "@Override public int count()",
"identifier": "count",
"modifiers": "@Override public",
"parameters": "()",
"return": "int",
"signature": "int count()",
"testcase": false
}
],
"superclass": ""
} | {
"body": "@Override\n public ToDo persist(ToDo td) {\n DBObject dbObj = convertToDbObject(td);\n coll.insert(dbObj);\n return createToDo(dbObj);\n }",
"class_method_signature": "MongoStore.persist(ToDo td)",
"constructor": false,
"full_signature": "@Override public ToDo persist(ToDo td)",
"identifier": "persist",
"invocations": [
"convertToDbObject",
"insert",
"createToDo"
],
"modifiers": "@Override public",
"parameters": "(ToDo td)",
"return": "ToDo",
"signature": "ToDo persist(ToDo td)",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 305,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 19317653,
"size": 777,
"stargazer_count": 196,
"stars": null,
"updates": null,
"url": "https://github.com/IBM-Cloud/todo-apps"
} |
19317653_10 | {
"fields": [
{
"declarator": "td1",
"modifier": "private",
"original_string": "private ToDo td1;",
"type": "ToDo",
"var_name": "td1"
},
{
"declarator": "td2",
"modifier": "private",
"original_string": "private ToDo td2;",
"type": "ToDo",
"var_name": "td2"
},
{
"declarator": "store",
"modifier": "private",
"original_string": "private ToDoStore store;",
"type": "ToDoStore",
"var_name": "store"
},
{
"declarator": "api",
"modifier": "private",
"original_string": "private ToDoAPI api;",
"type": "ToDoAPI",
"var_name": "api"
},
{
"declarator": "exceptionStore = new ToDoStore(){\n\n\t\t@Override\n\t\tpublic Collection<ToDo> getAll() throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo get(String id) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo persist(ToDo td) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo update(String id, ToDo td) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic void delete(String id) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n @Override\n public int count() throws ToDoStoreException {\n throw new ToDoStoreException(\"Error\");\n }\n\t}",
"modifier": "private",
"original_string": "private ToDoStore exceptionStore = new ToDoStore(){\n\n\t\t@Override\n\t\tpublic Collection<ToDo> getAll() throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo get(String id) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo persist(ToDo td) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo update(String id, ToDo td) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic void delete(String id) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n @Override\n public int count() throws ToDoStoreException {\n throw new ToDoStoreException(\"Error\");\n }\n\t};",
"type": "ToDoStore",
"var_name": "exceptionStore"
},
{
"declarator": "errorApi",
"modifier": "private",
"original_string": "private ToDoAPI errorApi;",
"type": "ToDoAPI",
"var_name": "errorApi"
}
],
"file": "java/bluemix-todo-app/src/test/java/net/bluemix/todo/rest/ToDoAPITest.java",
"identifier": "ToDoAPITest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n\tpublic void testUpdateToDoIdException() {\n\t\ttry {\n\t\t\tapi.updateToDo(null, new ToDo());\n\t\t\tfail(\"Expected exception to be thrown.\");\n\t\t} catch(WebApplicationException e) {\n\t\t\tassertEquals(Response.Status.BAD_REQUEST.getStatusCode(), e.getResponse().getStatus());\n\t\t}\n\t}",
"class_method_signature": "ToDoAPITest.testUpdateToDoIdException()",
"constructor": false,
"full_signature": "@Test public void testUpdateToDoIdException()",
"identifier": "testUpdateToDoIdException",
"invocations": [
"updateToDo",
"fail",
"assertEquals",
"getStatusCode",
"getStatus",
"getResponse"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void testUpdateToDoIdException()",
"testcase": true
} | {
"fields": [
{
"declarator": "store",
"modifier": "private",
"original_string": "private ToDoStore store;",
"type": "ToDoStore",
"var_name": "store"
}
],
"file": "java/bluemix-todo-app/src/main/java/net/bluemix/todo/rest/ToDoAPI.java",
"identifier": "ToDoAPI",
"interfaces": "",
"methods": [
{
"class_method_signature": "ToDoAPI.ToDoAPI()",
"constructor": true,
"full_signature": "public ToDoAPI()",
"identifier": "ToDoAPI",
"modifiers": "public",
"parameters": "()",
"return": "",
"signature": " ToDoAPI()",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.ToDoAPI(ToDoStore store)",
"constructor": true,
"full_signature": "public ToDoAPI(ToDoStore store)",
"identifier": "ToDoAPI",
"modifiers": "public",
"parameters": "(ToDoStore store)",
"return": "",
"signature": " ToDoAPI(ToDoStore store)",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.getToDo(@PathParam(\"id\") String id)",
"constructor": false,
"full_signature": "@GET @Path(\"/{id}\") @Produces(\"application/json\") public ToDo getToDo(@PathParam(\"id\") String id)",
"identifier": "getToDo",
"modifiers": "@GET @Path(\"/{id}\") @Produces(\"application/json\") public",
"parameters": "(@PathParam(\"id\") String id)",
"return": "ToDo",
"signature": "ToDo getToDo(@PathParam(\"id\") String id)",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.getToDos()",
"constructor": false,
"full_signature": "@GET @Produces(\"application/json\") public Collection<ToDo> getToDos()",
"identifier": "getToDos",
"modifiers": "@GET @Produces(\"application/json\") public",
"parameters": "()",
"return": "Collection<ToDo>",
"signature": "Collection<ToDo> getToDos()",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.newToDo(ToDo td)",
"constructor": false,
"full_signature": "@POST @Consumes(\"application/json\") @Produces(\"application/json\") public ToDo newToDo(ToDo td)",
"identifier": "newToDo",
"modifiers": "@POST @Consumes(\"application/json\") @Produces(\"application/json\") public",
"parameters": "(ToDo td)",
"return": "ToDo",
"signature": "ToDo newToDo(ToDo td)",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.updateToDo(@PathParam(\"id\") String id, ToDo td)",
"constructor": false,
"full_signature": "@PUT @Path(\"/{id}\") @Produces(\"application/json\") @Consumes(\"application/json\") public ToDo updateToDo(@PathParam(\"id\") String id, ToDo td)",
"identifier": "updateToDo",
"modifiers": "@PUT @Path(\"/{id}\") @Produces(\"application/json\") @Consumes(\"application/json\") public",
"parameters": "(@PathParam(\"id\") String id, ToDo td)",
"return": "ToDo",
"signature": "ToDo updateToDo(@PathParam(\"id\") String id, ToDo td)",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.deleteToDo(@PathParam(\"id\") String id)",
"constructor": false,
"full_signature": "@DELETE @Path(\"/{id}\") public void deleteToDo(@PathParam(\"id\") String id)",
"identifier": "deleteToDo",
"modifiers": "@DELETE @Path(\"/{id}\") public",
"parameters": "(@PathParam(\"id\") String id)",
"return": "void",
"signature": "void deleteToDo(@PathParam(\"id\") String id)",
"testcase": false
}
],
"superclass": ""
} | {
"body": "@PUT @Path(\"/{id}\")\n @Produces(\"application/json\")\n @Consumes(\"application/json\")\n public ToDo updateToDo(@PathParam(\"id\") String id, ToDo td) {\n if(id == null) {\n throw new WebApplicationException(\"Must supply an ID, for example /api/todos/123.\", \n Response.Status.BAD_REQUEST);\n }\n if(td == null) {\n throw new WebApplicationException(\"Must supply a ToDo in the PUT body.\", \n Response.Status.BAD_REQUEST);\n }\n try {\n ToDo updatedTd = store.update(id, td);\n if(updatedTd == null) {\n throw new WebApplicationException(\"The ToDo with the ID \" + id + \" does not exist.\",\n Response.Status.BAD_REQUEST);\n }\n return updatedTd;\n } catch (ToDoStoreException e) {\n throw new WebApplicationException(\"Error updating ToDo.\", Response.Status.INTERNAL_SERVER_ERROR);\n }\n }",
"class_method_signature": "ToDoAPI.updateToDo(@PathParam(\"id\") String id, ToDo td)",
"constructor": false,
"full_signature": "@PUT @Path(\"/{id}\") @Produces(\"application/json\") @Consumes(\"application/json\") public ToDo updateToDo(@PathParam(\"id\") String id, ToDo td)",
"identifier": "updateToDo",
"invocations": [
"update"
],
"modifiers": "@PUT @Path(\"/{id}\") @Produces(\"application/json\") @Consumes(\"application/json\") public",
"parameters": "(@PathParam(\"id\") String id, ToDo td)",
"return": "ToDo",
"signature": "ToDo updateToDo(@PathParam(\"id\") String id, ToDo td)",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 305,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 19317653,
"size": 777,
"stargazer_count": 196,
"stars": null,
"updates": null,
"url": "https://github.com/IBM-Cloud/todo-apps"
} |
19317653_5 | {
"fields": [
{
"declarator": "td1",
"modifier": "private",
"original_string": "private ToDo td1;",
"type": "ToDo",
"var_name": "td1"
},
{
"declarator": "td2",
"modifier": "private",
"original_string": "private ToDo td2;",
"type": "ToDo",
"var_name": "td2"
},
{
"declarator": "store",
"modifier": "private",
"original_string": "private ToDoStore store;",
"type": "ToDoStore",
"var_name": "store"
},
{
"declarator": "api",
"modifier": "private",
"original_string": "private ToDoAPI api;",
"type": "ToDoAPI",
"var_name": "api"
},
{
"declarator": "exceptionStore = new ToDoStore(){\n\n\t\t@Override\n\t\tpublic Collection<ToDo> getAll() throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo get(String id) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo persist(ToDo td) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo update(String id, ToDo td) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic void delete(String id) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n @Override\n public int count() throws ToDoStoreException {\n throw new ToDoStoreException(\"Error\");\n }\n\t}",
"modifier": "private",
"original_string": "private ToDoStore exceptionStore = new ToDoStore(){\n\n\t\t@Override\n\t\tpublic Collection<ToDo> getAll() throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo get(String id) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo persist(ToDo td) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo update(String id, ToDo td) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic void delete(String id) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n @Override\n public int count() throws ToDoStoreException {\n throw new ToDoStoreException(\"Error\");\n }\n\t};",
"type": "ToDoStore",
"var_name": "exceptionStore"
},
{
"declarator": "errorApi",
"modifier": "private",
"original_string": "private ToDoAPI errorApi;",
"type": "ToDoAPI",
"var_name": "errorApi"
}
],
"file": "java/bluemix-todo-app/src/test/java/net/bluemix/todo/rest/ToDoAPITest.java",
"identifier": "ToDoAPITest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n\tpublic void testGetToDosException() {\n\t\ttry {\n\t\t\terrorApi.getToDos();\n\t\t\tfail(\"Expected exception to be thrown.\");\n\t\t} catch(WebApplicationException e) {\n\t\t\tassertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), e.getResponse().getStatus());\n\t\t}\n\t}",
"class_method_signature": "ToDoAPITest.testGetToDosException()",
"constructor": false,
"full_signature": "@Test public void testGetToDosException()",
"identifier": "testGetToDosException",
"invocations": [
"getToDos",
"fail",
"assertEquals",
"getStatusCode",
"getStatus",
"getResponse"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void testGetToDosException()",
"testcase": true
} | {
"fields": [
{
"declarator": "store",
"modifier": "private",
"original_string": "private ToDoStore store;",
"type": "ToDoStore",
"var_name": "store"
}
],
"file": "java/bluemix-todo-app/src/main/java/net/bluemix/todo/rest/ToDoAPI.java",
"identifier": "ToDoAPI",
"interfaces": "",
"methods": [
{
"class_method_signature": "ToDoAPI.ToDoAPI()",
"constructor": true,
"full_signature": "public ToDoAPI()",
"identifier": "ToDoAPI",
"modifiers": "public",
"parameters": "()",
"return": "",
"signature": " ToDoAPI()",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.ToDoAPI(ToDoStore store)",
"constructor": true,
"full_signature": "public ToDoAPI(ToDoStore store)",
"identifier": "ToDoAPI",
"modifiers": "public",
"parameters": "(ToDoStore store)",
"return": "",
"signature": " ToDoAPI(ToDoStore store)",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.getToDo(@PathParam(\"id\") String id)",
"constructor": false,
"full_signature": "@GET @Path(\"/{id}\") @Produces(\"application/json\") public ToDo getToDo(@PathParam(\"id\") String id)",
"identifier": "getToDo",
"modifiers": "@GET @Path(\"/{id}\") @Produces(\"application/json\") public",
"parameters": "(@PathParam(\"id\") String id)",
"return": "ToDo",
"signature": "ToDo getToDo(@PathParam(\"id\") String id)",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.getToDos()",
"constructor": false,
"full_signature": "@GET @Produces(\"application/json\") public Collection<ToDo> getToDos()",
"identifier": "getToDos",
"modifiers": "@GET @Produces(\"application/json\") public",
"parameters": "()",
"return": "Collection<ToDo>",
"signature": "Collection<ToDo> getToDos()",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.newToDo(ToDo td)",
"constructor": false,
"full_signature": "@POST @Consumes(\"application/json\") @Produces(\"application/json\") public ToDo newToDo(ToDo td)",
"identifier": "newToDo",
"modifiers": "@POST @Consumes(\"application/json\") @Produces(\"application/json\") public",
"parameters": "(ToDo td)",
"return": "ToDo",
"signature": "ToDo newToDo(ToDo td)",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.updateToDo(@PathParam(\"id\") String id, ToDo td)",
"constructor": false,
"full_signature": "@PUT @Path(\"/{id}\") @Produces(\"application/json\") @Consumes(\"application/json\") public ToDo updateToDo(@PathParam(\"id\") String id, ToDo td)",
"identifier": "updateToDo",
"modifiers": "@PUT @Path(\"/{id}\") @Produces(\"application/json\") @Consumes(\"application/json\") public",
"parameters": "(@PathParam(\"id\") String id, ToDo td)",
"return": "ToDo",
"signature": "ToDo updateToDo(@PathParam(\"id\") String id, ToDo td)",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.deleteToDo(@PathParam(\"id\") String id)",
"constructor": false,
"full_signature": "@DELETE @Path(\"/{id}\") public void deleteToDo(@PathParam(\"id\") String id)",
"identifier": "deleteToDo",
"modifiers": "@DELETE @Path(\"/{id}\") public",
"parameters": "(@PathParam(\"id\") String id)",
"return": "void",
"signature": "void deleteToDo(@PathParam(\"id\") String id)",
"testcase": false
}
],
"superclass": ""
} | {
"body": "@GET\n @Produces(\"application/json\")\n public Collection<ToDo> getToDos() {\n try {\n return store.getAll();\n } catch (ToDoStoreException e) {\n throw new WebApplicationException(\"Error getting all ToDos.\", Response.Status.INTERNAL_SERVER_ERROR);\n }\n }",
"class_method_signature": "ToDoAPI.getToDos()",
"constructor": false,
"full_signature": "@GET @Produces(\"application/json\") public Collection<ToDo> getToDos()",
"identifier": "getToDos",
"invocations": [
"getAll"
],
"modifiers": "@GET @Produces(\"application/json\") public",
"parameters": "()",
"return": "Collection<ToDo>",
"signature": "Collection<ToDo> getToDos()",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 305,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 19317653,
"size": 777,
"stargazer_count": 196,
"stars": null,
"updates": null,
"url": "https://github.com/IBM-Cloud/todo-apps"
} |
19317653_4 | {
"fields": [
{
"declarator": "td1",
"modifier": "private",
"original_string": "private ToDo td1;",
"type": "ToDo",
"var_name": "td1"
},
{
"declarator": "td2",
"modifier": "private",
"original_string": "private ToDo td2;",
"type": "ToDo",
"var_name": "td2"
},
{
"declarator": "store",
"modifier": "private",
"original_string": "private ToDoStore store;",
"type": "ToDoStore",
"var_name": "store"
},
{
"declarator": "api",
"modifier": "private",
"original_string": "private ToDoAPI api;",
"type": "ToDoAPI",
"var_name": "api"
},
{
"declarator": "exceptionStore = new ToDoStore(){\n\n\t\t@Override\n\t\tpublic Collection<ToDo> getAll() throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo get(String id) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo persist(ToDo td) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo update(String id, ToDo td) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic void delete(String id) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n @Override\n public int count() throws ToDoStoreException {\n throw new ToDoStoreException(\"Error\");\n }\n\t}",
"modifier": "private",
"original_string": "private ToDoStore exceptionStore = new ToDoStore(){\n\n\t\t@Override\n\t\tpublic Collection<ToDo> getAll() throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo get(String id) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo persist(ToDo td) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo update(String id, ToDo td) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic void delete(String id) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n @Override\n public int count() throws ToDoStoreException {\n throw new ToDoStoreException(\"Error\");\n }\n\t};",
"type": "ToDoStore",
"var_name": "exceptionStore"
},
{
"declarator": "errorApi",
"modifier": "private",
"original_string": "private ToDoAPI errorApi;",
"type": "ToDoAPI",
"var_name": "errorApi"
}
],
"file": "java/bluemix-todo-app/src/test/java/net/bluemix/todo/rest/ToDoAPITest.java",
"identifier": "ToDoAPITest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n\tpublic void testGetToDos() {\n\t\tCollection<ToDo> todos = api.getToDos();\n\t\tassertTrue(todos.contains(td1));\n\t\tassertTrue(todos.contains(td2));\n\t\tassertEquals(2, todos.size());\n\t}",
"class_method_signature": "ToDoAPITest.testGetToDos()",
"constructor": false,
"full_signature": "@Test public void testGetToDos()",
"identifier": "testGetToDos",
"invocations": [
"getToDos",
"assertTrue",
"contains",
"assertTrue",
"contains",
"assertEquals",
"size"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void testGetToDos()",
"testcase": true
} | {
"fields": [
{
"declarator": "store",
"modifier": "private",
"original_string": "private ToDoStore store;",
"type": "ToDoStore",
"var_name": "store"
}
],
"file": "java/bluemix-todo-app/src/main/java/net/bluemix/todo/rest/ToDoAPI.java",
"identifier": "ToDoAPI",
"interfaces": "",
"methods": [
{
"class_method_signature": "ToDoAPI.ToDoAPI()",
"constructor": true,
"full_signature": "public ToDoAPI()",
"identifier": "ToDoAPI",
"modifiers": "public",
"parameters": "()",
"return": "",
"signature": " ToDoAPI()",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.ToDoAPI(ToDoStore store)",
"constructor": true,
"full_signature": "public ToDoAPI(ToDoStore store)",
"identifier": "ToDoAPI",
"modifiers": "public",
"parameters": "(ToDoStore store)",
"return": "",
"signature": " ToDoAPI(ToDoStore store)",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.getToDo(@PathParam(\"id\") String id)",
"constructor": false,
"full_signature": "@GET @Path(\"/{id}\") @Produces(\"application/json\") public ToDo getToDo(@PathParam(\"id\") String id)",
"identifier": "getToDo",
"modifiers": "@GET @Path(\"/{id}\") @Produces(\"application/json\") public",
"parameters": "(@PathParam(\"id\") String id)",
"return": "ToDo",
"signature": "ToDo getToDo(@PathParam(\"id\") String id)",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.getToDos()",
"constructor": false,
"full_signature": "@GET @Produces(\"application/json\") public Collection<ToDo> getToDos()",
"identifier": "getToDos",
"modifiers": "@GET @Produces(\"application/json\") public",
"parameters": "()",
"return": "Collection<ToDo>",
"signature": "Collection<ToDo> getToDos()",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.newToDo(ToDo td)",
"constructor": false,
"full_signature": "@POST @Consumes(\"application/json\") @Produces(\"application/json\") public ToDo newToDo(ToDo td)",
"identifier": "newToDo",
"modifiers": "@POST @Consumes(\"application/json\") @Produces(\"application/json\") public",
"parameters": "(ToDo td)",
"return": "ToDo",
"signature": "ToDo newToDo(ToDo td)",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.updateToDo(@PathParam(\"id\") String id, ToDo td)",
"constructor": false,
"full_signature": "@PUT @Path(\"/{id}\") @Produces(\"application/json\") @Consumes(\"application/json\") public ToDo updateToDo(@PathParam(\"id\") String id, ToDo td)",
"identifier": "updateToDo",
"modifiers": "@PUT @Path(\"/{id}\") @Produces(\"application/json\") @Consumes(\"application/json\") public",
"parameters": "(@PathParam(\"id\") String id, ToDo td)",
"return": "ToDo",
"signature": "ToDo updateToDo(@PathParam(\"id\") String id, ToDo td)",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.deleteToDo(@PathParam(\"id\") String id)",
"constructor": false,
"full_signature": "@DELETE @Path(\"/{id}\") public void deleteToDo(@PathParam(\"id\") String id)",
"identifier": "deleteToDo",
"modifiers": "@DELETE @Path(\"/{id}\") public",
"parameters": "(@PathParam(\"id\") String id)",
"return": "void",
"signature": "void deleteToDo(@PathParam(\"id\") String id)",
"testcase": false
}
],
"superclass": ""
} | {
"body": "@GET\n @Produces(\"application/json\")\n public Collection<ToDo> getToDos() {\n try {\n return store.getAll();\n } catch (ToDoStoreException e) {\n throw new WebApplicationException(\"Error getting all ToDos.\", Response.Status.INTERNAL_SERVER_ERROR);\n }\n }",
"class_method_signature": "ToDoAPI.getToDos()",
"constructor": false,
"full_signature": "@GET @Produces(\"application/json\") public Collection<ToDo> getToDos()",
"identifier": "getToDos",
"invocations": [
"getAll"
],
"modifiers": "@GET @Produces(\"application/json\") public",
"parameters": "()",
"return": "Collection<ToDo>",
"signature": "Collection<ToDo> getToDos()",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 305,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 19317653,
"size": 777,
"stargazer_count": 196,
"stars": null,
"updates": null,
"url": "https://github.com/IBM-Cloud/todo-apps"
} |
19317653_11 | {
"fields": [
{
"declarator": "td1",
"modifier": "private",
"original_string": "private ToDo td1;",
"type": "ToDo",
"var_name": "td1"
},
{
"declarator": "td2",
"modifier": "private",
"original_string": "private ToDo td2;",
"type": "ToDo",
"var_name": "td2"
},
{
"declarator": "store",
"modifier": "private",
"original_string": "private ToDoStore store;",
"type": "ToDoStore",
"var_name": "store"
},
{
"declarator": "api",
"modifier": "private",
"original_string": "private ToDoAPI api;",
"type": "ToDoAPI",
"var_name": "api"
},
{
"declarator": "exceptionStore = new ToDoStore(){\n\n\t\t@Override\n\t\tpublic Collection<ToDo> getAll() throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo get(String id) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo persist(ToDo td) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo update(String id, ToDo td) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic void delete(String id) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n @Override\n public int count() throws ToDoStoreException {\n throw new ToDoStoreException(\"Error\");\n }\n\t}",
"modifier": "private",
"original_string": "private ToDoStore exceptionStore = new ToDoStore(){\n\n\t\t@Override\n\t\tpublic Collection<ToDo> getAll() throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo get(String id) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo persist(ToDo td) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo update(String id, ToDo td) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic void delete(String id) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n @Override\n public int count() throws ToDoStoreException {\n throw new ToDoStoreException(\"Error\");\n }\n\t};",
"type": "ToDoStore",
"var_name": "exceptionStore"
},
{
"declarator": "errorApi",
"modifier": "private",
"original_string": "private ToDoAPI errorApi;",
"type": "ToDoAPI",
"var_name": "errorApi"
}
],
"file": "java/bluemix-todo-app/src/test/java/net/bluemix/todo/rest/ToDoAPITest.java",
"identifier": "ToDoAPITest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n\tpublic void testUpdateToDoException() {\n\t\ttry {\n\t\t\tapi.updateToDo(\"123\", null);\n\t\t\tfail(\"Expected exception to be thrown.\");\n\t\t} catch(WebApplicationException e) {\n\t\t\tassertEquals(Response.Status.BAD_REQUEST.getStatusCode(), e.getResponse().getStatus());\n\t\t}\n\t}",
"class_method_signature": "ToDoAPITest.testUpdateToDoException()",
"constructor": false,
"full_signature": "@Test public void testUpdateToDoException()",
"identifier": "testUpdateToDoException",
"invocations": [
"updateToDo",
"fail",
"assertEquals",
"getStatusCode",
"getStatus",
"getResponse"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void testUpdateToDoException()",
"testcase": true
} | {
"fields": [
{
"declarator": "store",
"modifier": "private",
"original_string": "private ToDoStore store;",
"type": "ToDoStore",
"var_name": "store"
}
],
"file": "java/bluemix-todo-app/src/main/java/net/bluemix/todo/rest/ToDoAPI.java",
"identifier": "ToDoAPI",
"interfaces": "",
"methods": [
{
"class_method_signature": "ToDoAPI.ToDoAPI()",
"constructor": true,
"full_signature": "public ToDoAPI()",
"identifier": "ToDoAPI",
"modifiers": "public",
"parameters": "()",
"return": "",
"signature": " ToDoAPI()",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.ToDoAPI(ToDoStore store)",
"constructor": true,
"full_signature": "public ToDoAPI(ToDoStore store)",
"identifier": "ToDoAPI",
"modifiers": "public",
"parameters": "(ToDoStore store)",
"return": "",
"signature": " ToDoAPI(ToDoStore store)",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.getToDo(@PathParam(\"id\") String id)",
"constructor": false,
"full_signature": "@GET @Path(\"/{id}\") @Produces(\"application/json\") public ToDo getToDo(@PathParam(\"id\") String id)",
"identifier": "getToDo",
"modifiers": "@GET @Path(\"/{id}\") @Produces(\"application/json\") public",
"parameters": "(@PathParam(\"id\") String id)",
"return": "ToDo",
"signature": "ToDo getToDo(@PathParam(\"id\") String id)",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.getToDos()",
"constructor": false,
"full_signature": "@GET @Produces(\"application/json\") public Collection<ToDo> getToDos()",
"identifier": "getToDos",
"modifiers": "@GET @Produces(\"application/json\") public",
"parameters": "()",
"return": "Collection<ToDo>",
"signature": "Collection<ToDo> getToDos()",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.newToDo(ToDo td)",
"constructor": false,
"full_signature": "@POST @Consumes(\"application/json\") @Produces(\"application/json\") public ToDo newToDo(ToDo td)",
"identifier": "newToDo",
"modifiers": "@POST @Consumes(\"application/json\") @Produces(\"application/json\") public",
"parameters": "(ToDo td)",
"return": "ToDo",
"signature": "ToDo newToDo(ToDo td)",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.updateToDo(@PathParam(\"id\") String id, ToDo td)",
"constructor": false,
"full_signature": "@PUT @Path(\"/{id}\") @Produces(\"application/json\") @Consumes(\"application/json\") public ToDo updateToDo(@PathParam(\"id\") String id, ToDo td)",
"identifier": "updateToDo",
"modifiers": "@PUT @Path(\"/{id}\") @Produces(\"application/json\") @Consumes(\"application/json\") public",
"parameters": "(@PathParam(\"id\") String id, ToDo td)",
"return": "ToDo",
"signature": "ToDo updateToDo(@PathParam(\"id\") String id, ToDo td)",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.deleteToDo(@PathParam(\"id\") String id)",
"constructor": false,
"full_signature": "@DELETE @Path(\"/{id}\") public void deleteToDo(@PathParam(\"id\") String id)",
"identifier": "deleteToDo",
"modifiers": "@DELETE @Path(\"/{id}\") public",
"parameters": "(@PathParam(\"id\") String id)",
"return": "void",
"signature": "void deleteToDo(@PathParam(\"id\") String id)",
"testcase": false
}
],
"superclass": ""
} | {
"body": "@PUT @Path(\"/{id}\")\n @Produces(\"application/json\")\n @Consumes(\"application/json\")\n public ToDo updateToDo(@PathParam(\"id\") String id, ToDo td) {\n if(id == null) {\n throw new WebApplicationException(\"Must supply an ID, for example /api/todos/123.\", \n Response.Status.BAD_REQUEST);\n }\n if(td == null) {\n throw new WebApplicationException(\"Must supply a ToDo in the PUT body.\", \n Response.Status.BAD_REQUEST);\n }\n try {\n ToDo updatedTd = store.update(id, td);\n if(updatedTd == null) {\n throw new WebApplicationException(\"The ToDo with the ID \" + id + \" does not exist.\",\n Response.Status.BAD_REQUEST);\n }\n return updatedTd;\n } catch (ToDoStoreException e) {\n throw new WebApplicationException(\"Error updating ToDo.\", Response.Status.INTERNAL_SERVER_ERROR);\n }\n }",
"class_method_signature": "ToDoAPI.updateToDo(@PathParam(\"id\") String id, ToDo td)",
"constructor": false,
"full_signature": "@PUT @Path(\"/{id}\") @Produces(\"application/json\") @Consumes(\"application/json\") public ToDo updateToDo(@PathParam(\"id\") String id, ToDo td)",
"identifier": "updateToDo",
"invocations": [
"update"
],
"modifiers": "@PUT @Path(\"/{id}\") @Produces(\"application/json\") @Consumes(\"application/json\") public",
"parameters": "(@PathParam(\"id\") String id, ToDo td)",
"return": "ToDo",
"signature": "ToDo updateToDo(@PathParam(\"id\") String id, ToDo td)",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 305,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 19317653,
"size": 777,
"stargazer_count": 196,
"stars": null,
"updates": null,
"url": "https://github.com/IBM-Cloud/todo-apps"
} |
19317653_46 | {
"fields": [],
"file": "java/bluemix-todo-app/src/test/java/net/bluemix/todo/store/MongoStoreTest.java",
"identifier": "MongoStoreTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n\tpublic void testGet() {\n\t\tDBCollection coll = createMockCollection();\n\t\tDBCursor cursor = createMockCursor();\n\t\texpect(cursor.hasNext()).andAnswer(new IAnswer<Boolean>() {\n\t\t\tprivate int count = 0;\n\t\t\t@Override\n\t\t\tpublic Boolean answer() throws Throwable {\n\t\t\t\tcount++;\n\t\t\t\treturn count == 2 ? false : true;\n\t\t\t}\n\t\t}).anyTimes();\n\t\texpect(cursor.next()).andAnswer(new IAnswer<DBObject>() {\n\t\t\tprivate int count = 0;\n\t\t\t@Override\n\t\t\tpublic DBObject answer() throws Throwable {\n\t\t\t\tcount++;\n\t\t\t\tBasicDBObject dbObj = new BasicDBObject();\n\t\t\t\tdbObj.put(\"title\", \"This is todo \" + count);\n\t\t\t\tdbObj.put(\"completed\", false);\n\t\t\t\tdbObj.put(\"order\", count);\n\t\t\t\t//Object IDs must be 24 characters long\n\t\t\t\tdbObj.put(\"_id\", new ObjectId(\"aaaaaaaaaaaaaaaaaaaaaaa\" + count));\n\t\t\t\treturn dbObj;\n\t\t\t}\n\t\t}).anyTimes();\n\t\tcursor.close();\n\t\texpectLastCall();\n\t\treplay(cursor);\n\t\tDBCursor emptyCursor = createMockCursor();\n\t\texpect(emptyCursor.hasNext()).andReturn(false);\n\t\treplay(emptyCursor);\n\t\texpect(coll.find(eq(new BasicDBObject(\"_id\", \"aaaaaaaaaaaaaaaaaaaaaaa1\")))).andReturn(cursor);\n\t\texpect(coll.find(eq(new BasicDBObject(\"_id\", \"1\")))).andReturn(emptyCursor);\n\t\treplay(coll);\n\t\tMongoStore store = new MongoStore(coll);\n\t\tToDo td = store.get(\"1\");\n\t\tassertNull(td);\n\t\ttd = store.get(\"aaaaaaaaaaaaaaaaaaaaaaa1\");\n\t\tToDo td1 = new ToDo();\n\t\ttd1.setId(\"aaaaaaaaaaaaaaaaaaaaaaa1\");\n\t\ttd1.setTitle(\"This is todo 1\");\n\t\ttd1.setOrder(1);\n\t\tassertEquals(td, td1);\n\t\tverify(cursor);\n\t\tverify(emptyCursor);\n\t\tverify(coll);\n\t}",
"class_method_signature": "MongoStoreTest.testGet()",
"constructor": false,
"full_signature": "@Test public void testGet()",
"identifier": "testGet",
"invocations": [
"createMockCollection",
"createMockCursor",
"anyTimes",
"andAnswer",
"expect",
"hasNext",
"anyTimes",
"andAnswer",
"expect",
"next",
"put",
"put",
"put",
"put",
"close",
"expectLastCall",
"replay",
"createMockCursor",
"andReturn",
"expect",
"hasNext",
"replay",
"andReturn",
"expect",
"find",
"eq",
"andReturn",
"expect",
"find",
"eq",
"replay",
"get",
"assertNull",
"get",
"setId",
"setTitle",
"setOrder",
"assertEquals",
"verify",
"verify",
"verify"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void testGet()",
"testcase": true
} | {
"fields": [
{
"declarator": "coll",
"modifier": "private",
"original_string": "private DBCollection coll;",
"type": "DBCollection",
"var_name": "coll"
}
],
"file": "java/bluemix-todo-app/src/main/java/net/bluemix/todo/store/MongoStore.java",
"identifier": "MongoStore",
"interfaces": "implements ToDoStore",
"methods": [
{
"class_method_signature": "MongoStore.MongoStore(DBCollection coll)",
"constructor": true,
"full_signature": "public MongoStore(DBCollection coll)",
"identifier": "MongoStore",
"modifiers": "public",
"parameters": "(DBCollection coll)",
"return": "",
"signature": " MongoStore(DBCollection coll)",
"testcase": false
},
{
"class_method_signature": "MongoStore.getAll()",
"constructor": false,
"full_signature": "@Override public Collection<ToDo> getAll()",
"identifier": "getAll",
"modifiers": "@Override public",
"parameters": "()",
"return": "Collection<ToDo>",
"signature": "Collection<ToDo> getAll()",
"testcase": false
},
{
"class_method_signature": "MongoStore.get(String id)",
"constructor": false,
"full_signature": "@Override public ToDo get(String id)",
"identifier": "get",
"modifiers": "@Override public",
"parameters": "(String id)",
"return": "ToDo",
"signature": "ToDo get(String id)",
"testcase": false
},
{
"class_method_signature": "MongoStore.persist(ToDo td)",
"constructor": false,
"full_signature": "@Override public ToDo persist(ToDo td)",
"identifier": "persist",
"modifiers": "@Override public",
"parameters": "(ToDo td)",
"return": "ToDo",
"signature": "ToDo persist(ToDo td)",
"testcase": false
},
{
"class_method_signature": "MongoStore.update(String id, ToDo td)",
"constructor": false,
"full_signature": "@Override public ToDo update(String id, ToDo td)",
"identifier": "update",
"modifiers": "@Override public",
"parameters": "(String id, ToDo td)",
"return": "ToDo",
"signature": "ToDo update(String id, ToDo td)",
"testcase": false
},
{
"class_method_signature": "MongoStore.delete(String id)",
"constructor": false,
"full_signature": "@Override public void delete(String id)",
"identifier": "delete",
"modifiers": "@Override public",
"parameters": "(String id)",
"return": "void",
"signature": "void delete(String id)",
"testcase": false
},
{
"class_method_signature": "MongoStore.createToDo(DBObject dbObj)",
"constructor": false,
"full_signature": "private ToDo createToDo(DBObject dbObj)",
"identifier": "createToDo",
"modifiers": "private",
"parameters": "(DBObject dbObj)",
"return": "ToDo",
"signature": "ToDo createToDo(DBObject dbObj)",
"testcase": false
},
{
"class_method_signature": "MongoStore.convertToDbObject(ToDo td)",
"constructor": false,
"full_signature": "private DBObject convertToDbObject(ToDo td)",
"identifier": "convertToDbObject",
"modifiers": "private",
"parameters": "(ToDo td)",
"return": "DBObject",
"signature": "DBObject convertToDbObject(ToDo td)",
"testcase": false
},
{
"class_method_signature": "MongoStore.count()",
"constructor": false,
"full_signature": "@Override public int count()",
"identifier": "count",
"modifiers": "@Override public",
"parameters": "()",
"return": "int",
"signature": "int count()",
"testcase": false
}
],
"superclass": ""
} | {
"body": "@Override\n public ToDo get(String id) {\n BasicDBObject query = new BasicDBObject(\"_id\", id);\n DBCursor cursor = coll.find(query);\n if(cursor.hasNext()) {\n ToDo td = createToDo(cursor.next());\n cursor.close();\n return td;\n } else {\n return null;\n }\n }",
"class_method_signature": "MongoStore.get(String id)",
"constructor": false,
"full_signature": "@Override public ToDo get(String id)",
"identifier": "get",
"invocations": [
"find",
"hasNext",
"createToDo",
"next",
"close"
],
"modifiers": "@Override public",
"parameters": "(String id)",
"return": "ToDo",
"signature": "ToDo get(String id)",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 305,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 19317653,
"size": 777,
"stargazer_count": 196,
"stars": null,
"updates": null,
"url": "https://github.com/IBM-Cloud/todo-apps"
} |
19317653_50 | {
"fields": [],
"file": "java/bluemix-todo-app/src/test/java/net/bluemix/todo/store/MongoStoreTest.java",
"identifier": "MongoStoreTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n\tpublic void testCount() throws Exception {\n\t DBCollection coll = createMockCollection();\n DBCursor cursor = createMockCursor();\n expect(cursor.hasNext()).andAnswer(new IAnswer<Boolean>() {\n private int count = 0;\n @Override\n public Boolean answer() throws Throwable {\n count++;\n return count == 3 ? false : true;\n }\n }).anyTimes();\n expect(cursor.next()).andAnswer(new IAnswer<DBObject>() {\n private int count = 0;\n @Override\n public DBObject answer() throws Throwable {\n count++;\n BasicDBObject dbObj = new BasicDBObject();\n dbObj.put(\"title\", \"This is todo \" + count);\n dbObj.put(\"completed\", false);\n dbObj.put(\"order\", count);\n //Object IDs must be 24 characters long\n dbObj.put(\"_id\", new ObjectId(\"aaaaaaaaaaaaaaaaaaaaaaa\" + count));\n return dbObj;\n }\n }).anyTimes();\n cursor.close();\n expectLastCall();\n replay(cursor);\n expect(coll.find()).andReturn(cursor);\n replay(coll);\n MongoStore store = new MongoStore(coll);\n assertEquals(2, store.count());\n verify(cursor);\n verify(coll);\n\t}",
"class_method_signature": "MongoStoreTest.testCount()",
"constructor": false,
"full_signature": "@Test public void testCount()",
"identifier": "testCount",
"invocations": [
"createMockCollection",
"createMockCursor",
"anyTimes",
"andAnswer",
"expect",
"hasNext",
"anyTimes",
"andAnswer",
"expect",
"next",
"put",
"put",
"put",
"put",
"close",
"expectLastCall",
"replay",
"andReturn",
"expect",
"find",
"replay",
"assertEquals",
"count",
"verify",
"verify"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void testCount()",
"testcase": true
} | {
"fields": [
{
"declarator": "coll",
"modifier": "private",
"original_string": "private DBCollection coll;",
"type": "DBCollection",
"var_name": "coll"
}
],
"file": "java/bluemix-todo-app/src/main/java/net/bluemix/todo/store/MongoStore.java",
"identifier": "MongoStore",
"interfaces": "implements ToDoStore",
"methods": [
{
"class_method_signature": "MongoStore.MongoStore(DBCollection coll)",
"constructor": true,
"full_signature": "public MongoStore(DBCollection coll)",
"identifier": "MongoStore",
"modifiers": "public",
"parameters": "(DBCollection coll)",
"return": "",
"signature": " MongoStore(DBCollection coll)",
"testcase": false
},
{
"class_method_signature": "MongoStore.getAll()",
"constructor": false,
"full_signature": "@Override public Collection<ToDo> getAll()",
"identifier": "getAll",
"modifiers": "@Override public",
"parameters": "()",
"return": "Collection<ToDo>",
"signature": "Collection<ToDo> getAll()",
"testcase": false
},
{
"class_method_signature": "MongoStore.get(String id)",
"constructor": false,
"full_signature": "@Override public ToDo get(String id)",
"identifier": "get",
"modifiers": "@Override public",
"parameters": "(String id)",
"return": "ToDo",
"signature": "ToDo get(String id)",
"testcase": false
},
{
"class_method_signature": "MongoStore.persist(ToDo td)",
"constructor": false,
"full_signature": "@Override public ToDo persist(ToDo td)",
"identifier": "persist",
"modifiers": "@Override public",
"parameters": "(ToDo td)",
"return": "ToDo",
"signature": "ToDo persist(ToDo td)",
"testcase": false
},
{
"class_method_signature": "MongoStore.update(String id, ToDo td)",
"constructor": false,
"full_signature": "@Override public ToDo update(String id, ToDo td)",
"identifier": "update",
"modifiers": "@Override public",
"parameters": "(String id, ToDo td)",
"return": "ToDo",
"signature": "ToDo update(String id, ToDo td)",
"testcase": false
},
{
"class_method_signature": "MongoStore.delete(String id)",
"constructor": false,
"full_signature": "@Override public void delete(String id)",
"identifier": "delete",
"modifiers": "@Override public",
"parameters": "(String id)",
"return": "void",
"signature": "void delete(String id)",
"testcase": false
},
{
"class_method_signature": "MongoStore.createToDo(DBObject dbObj)",
"constructor": false,
"full_signature": "private ToDo createToDo(DBObject dbObj)",
"identifier": "createToDo",
"modifiers": "private",
"parameters": "(DBObject dbObj)",
"return": "ToDo",
"signature": "ToDo createToDo(DBObject dbObj)",
"testcase": false
},
{
"class_method_signature": "MongoStore.convertToDbObject(ToDo td)",
"constructor": false,
"full_signature": "private DBObject convertToDbObject(ToDo td)",
"identifier": "convertToDbObject",
"modifiers": "private",
"parameters": "(ToDo td)",
"return": "DBObject",
"signature": "DBObject convertToDbObject(ToDo td)",
"testcase": false
},
{
"class_method_signature": "MongoStore.count()",
"constructor": false,
"full_signature": "@Override public int count()",
"identifier": "count",
"modifiers": "@Override public",
"parameters": "()",
"return": "int",
"signature": "int count()",
"testcase": false
}
],
"superclass": ""
} | {
"body": "@Override\n public int count() throws ToDoStoreException {\n return getAll().size();\n }",
"class_method_signature": "MongoStore.count()",
"constructor": false,
"full_signature": "@Override public int count()",
"identifier": "count",
"invocations": [
"size",
"getAll"
],
"modifiers": "@Override public",
"parameters": "()",
"return": "int",
"signature": "int count()",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 305,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 19317653,
"size": 777,
"stargazer_count": 196,
"stars": null,
"updates": null,
"url": "https://github.com/IBM-Cloud/todo-apps"
} |
19317653_27 | {
"fields": [],
"file": "java/bluemix-todo-app/src/test/java/net/bluemix/todo/model/ToDoTest.java",
"identifier": "ToDoTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n\tpublic void testGetId() {\n\t\tToDo td = new ToDo();\n\t\tassertNull(td.getId());\n\t\ttd.setId(\"123abc\");\n\t\tassertEquals(\"123abc\", td.getId());\n\t}",
"class_method_signature": "ToDoTest.testGetId()",
"constructor": false,
"full_signature": "@Test public void testGetId()",
"identifier": "testGetId",
"invocations": [
"assertNull",
"getId",
"setId",
"assertEquals",
"getId"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void testGetId()",
"testcase": true
} | {
"fields": [
{
"declarator": "completed",
"modifier": "private",
"original_string": "private boolean completed;",
"type": "boolean",
"var_name": "completed"
},
{
"declarator": "title",
"modifier": "private",
"original_string": "private String title;",
"type": "String",
"var_name": "title"
},
{
"declarator": "id",
"modifier": "private",
"original_string": "private String id;",
"type": "String",
"var_name": "id"
},
{
"declarator": "order",
"modifier": "private",
"original_string": "private int order;",
"type": "int",
"var_name": "order"
}
],
"file": "java/bluemix-todo-app/src/main/java/net/bluemix/todo/model/ToDo.java",
"identifier": "ToDo",
"interfaces": "",
"methods": [
{
"class_method_signature": "ToDo.ToDo()",
"constructor": true,
"full_signature": "public ToDo()",
"identifier": "ToDo",
"modifiers": "public",
"parameters": "()",
"return": "",
"signature": " ToDo()",
"testcase": false
},
{
"class_method_signature": "ToDo.getId()",
"constructor": false,
"full_signature": "public String getId()",
"identifier": "getId",
"modifiers": "public",
"parameters": "()",
"return": "String",
"signature": "String getId()",
"testcase": false
},
{
"class_method_signature": "ToDo.setId(String id)",
"constructor": false,
"full_signature": "public void setId(String id)",
"identifier": "setId",
"modifiers": "public",
"parameters": "(String id)",
"return": "void",
"signature": "void setId(String id)",
"testcase": false
},
{
"class_method_signature": "ToDo.isCompleted()",
"constructor": false,
"full_signature": "public boolean isCompleted()",
"identifier": "isCompleted",
"modifiers": "public",
"parameters": "()",
"return": "boolean",
"signature": "boolean isCompleted()",
"testcase": false
},
{
"class_method_signature": "ToDo.setCompleted(boolean completed)",
"constructor": false,
"full_signature": "public void setCompleted(boolean completed)",
"identifier": "setCompleted",
"modifiers": "public",
"parameters": "(boolean completed)",
"return": "void",
"signature": "void setCompleted(boolean completed)",
"testcase": false
},
{
"class_method_signature": "ToDo.getTitle()",
"constructor": false,
"full_signature": "public String getTitle()",
"identifier": "getTitle",
"modifiers": "public",
"parameters": "()",
"return": "String",
"signature": "String getTitle()",
"testcase": false
},
{
"class_method_signature": "ToDo.setTitle(String title)",
"constructor": false,
"full_signature": "public void setTitle(String title)",
"identifier": "setTitle",
"modifiers": "public",
"parameters": "(String title)",
"return": "void",
"signature": "void setTitle(String title)",
"testcase": false
},
{
"class_method_signature": "ToDo.getOrder()",
"constructor": false,
"full_signature": "public int getOrder()",
"identifier": "getOrder",
"modifiers": "public",
"parameters": "()",
"return": "int",
"signature": "int getOrder()",
"testcase": false
},
{
"class_method_signature": "ToDo.setOrder(int order)",
"constructor": false,
"full_signature": "public void setOrder(int order)",
"identifier": "setOrder",
"modifiers": "public",
"parameters": "(int order)",
"return": "void",
"signature": "void setOrder(int order)",
"testcase": false
},
{
"class_method_signature": "ToDo.equals(Object obj)",
"constructor": false,
"full_signature": "@Override public boolean equals(Object obj)",
"identifier": "equals",
"modifiers": "@Override public",
"parameters": "(Object obj)",
"return": "boolean",
"signature": "boolean equals(Object obj)",
"testcase": false
},
{
"class_method_signature": "ToDo.hashCode()",
"constructor": false,
"full_signature": "@Override public int hashCode()",
"identifier": "hashCode",
"modifiers": "@Override public",
"parameters": "()",
"return": "int",
"signature": "int hashCode()",
"testcase": false
}
],
"superclass": ""
} | {
"body": "public String getId() {\n return id;\n }",
"class_method_signature": "ToDo.getId()",
"constructor": false,
"full_signature": "public String getId()",
"identifier": "getId",
"invocations": [],
"modifiers": "public",
"parameters": "()",
"return": "String",
"signature": "String getId()",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 305,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 19317653,
"size": 777,
"stargazer_count": 196,
"stars": null,
"updates": null,
"url": "https://github.com/IBM-Cloud/todo-apps"
} |
19317653_31 | {
"fields": [],
"file": "java/bluemix-todo-app/src/test/java/net/bluemix/todo/model/ToDoTest.java",
"identifier": "ToDoTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n\tpublic void testEquals() {\n\t\tToDo td = new ToDo();\n\t\tassertFalse(td.equals(null));\n\t\tassertTrue(td.equals(td));\n\t\ttd.setTitle(\"this is a test task\");\n\t\ttd.setCompleted(true);\n\t\tassertFalse(td.equals(new ToDo()));\n\t\tToDo td2 = new ToDo();\n\t\ttd2.setTitle(\"this is a test task\");\n\t\ttd2.setCompleted(true);\n\t\tassertTrue(td.equals(td2));\n\t}",
"class_method_signature": "ToDoTest.testEquals()",
"constructor": false,
"full_signature": "@Test public void testEquals()",
"identifier": "testEquals",
"invocations": [
"assertFalse",
"equals",
"assertTrue",
"equals",
"setTitle",
"setCompleted",
"assertFalse",
"equals",
"setTitle",
"setCompleted",
"assertTrue",
"equals"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void testEquals()",
"testcase": true
} | {
"fields": [
{
"declarator": "completed",
"modifier": "private",
"original_string": "private boolean completed;",
"type": "boolean",
"var_name": "completed"
},
{
"declarator": "title",
"modifier": "private",
"original_string": "private String title;",
"type": "String",
"var_name": "title"
},
{
"declarator": "id",
"modifier": "private",
"original_string": "private String id;",
"type": "String",
"var_name": "id"
},
{
"declarator": "order",
"modifier": "private",
"original_string": "private int order;",
"type": "int",
"var_name": "order"
}
],
"file": "java/bluemix-todo-app/src/main/java/net/bluemix/todo/model/ToDo.java",
"identifier": "ToDo",
"interfaces": "",
"methods": [
{
"class_method_signature": "ToDo.ToDo()",
"constructor": true,
"full_signature": "public ToDo()",
"identifier": "ToDo",
"modifiers": "public",
"parameters": "()",
"return": "",
"signature": " ToDo()",
"testcase": false
},
{
"class_method_signature": "ToDo.getId()",
"constructor": false,
"full_signature": "public String getId()",
"identifier": "getId",
"modifiers": "public",
"parameters": "()",
"return": "String",
"signature": "String getId()",
"testcase": false
},
{
"class_method_signature": "ToDo.setId(String id)",
"constructor": false,
"full_signature": "public void setId(String id)",
"identifier": "setId",
"modifiers": "public",
"parameters": "(String id)",
"return": "void",
"signature": "void setId(String id)",
"testcase": false
},
{
"class_method_signature": "ToDo.isCompleted()",
"constructor": false,
"full_signature": "public boolean isCompleted()",
"identifier": "isCompleted",
"modifiers": "public",
"parameters": "()",
"return": "boolean",
"signature": "boolean isCompleted()",
"testcase": false
},
{
"class_method_signature": "ToDo.setCompleted(boolean completed)",
"constructor": false,
"full_signature": "public void setCompleted(boolean completed)",
"identifier": "setCompleted",
"modifiers": "public",
"parameters": "(boolean completed)",
"return": "void",
"signature": "void setCompleted(boolean completed)",
"testcase": false
},
{
"class_method_signature": "ToDo.getTitle()",
"constructor": false,
"full_signature": "public String getTitle()",
"identifier": "getTitle",
"modifiers": "public",
"parameters": "()",
"return": "String",
"signature": "String getTitle()",
"testcase": false
},
{
"class_method_signature": "ToDo.setTitle(String title)",
"constructor": false,
"full_signature": "public void setTitle(String title)",
"identifier": "setTitle",
"modifiers": "public",
"parameters": "(String title)",
"return": "void",
"signature": "void setTitle(String title)",
"testcase": false
},
{
"class_method_signature": "ToDo.getOrder()",
"constructor": false,
"full_signature": "public int getOrder()",
"identifier": "getOrder",
"modifiers": "public",
"parameters": "()",
"return": "int",
"signature": "int getOrder()",
"testcase": false
},
{
"class_method_signature": "ToDo.setOrder(int order)",
"constructor": false,
"full_signature": "public void setOrder(int order)",
"identifier": "setOrder",
"modifiers": "public",
"parameters": "(int order)",
"return": "void",
"signature": "void setOrder(int order)",
"testcase": false
},
{
"class_method_signature": "ToDo.equals(Object obj)",
"constructor": false,
"full_signature": "@Override public boolean equals(Object obj)",
"identifier": "equals",
"modifiers": "@Override public",
"parameters": "(Object obj)",
"return": "boolean",
"signature": "boolean equals(Object obj)",
"testcase": false
},
{
"class_method_signature": "ToDo.hashCode()",
"constructor": false,
"full_signature": "@Override public int hashCode()",
"identifier": "hashCode",
"modifiers": "@Override public",
"parameters": "()",
"return": "int",
"signature": "int hashCode()",
"testcase": false
}
],
"superclass": ""
} | {
"body": "@Override\n public boolean equals(Object obj) {\n if(obj instanceof ToDo) {\n ToDo test = (ToDo)obj;\n boolean result = false;\n result = id == null ? id == test.getId() : id.equals(test.getId());\n result &= title == null ? title == test.getTitle() : title.equals(test.getTitle());\n result &= completed == test.isCompleted();\n result &= order == test.getOrder();\n return result;\n } else {\n return false;\n }\n }",
"class_method_signature": "ToDo.equals(Object obj)",
"constructor": false,
"full_signature": "@Override public boolean equals(Object obj)",
"identifier": "equals",
"invocations": [
"getId",
"equals",
"getId",
"getTitle",
"equals",
"getTitle",
"isCompleted",
"getOrder"
],
"modifiers": "@Override public",
"parameters": "(Object obj)",
"return": "boolean",
"signature": "boolean equals(Object obj)",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 305,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 19317653,
"size": 777,
"stargazer_count": 196,
"stars": null,
"updates": null,
"url": "https://github.com/IBM-Cloud/todo-apps"
} |
19317653_8 | {
"fields": [
{
"declarator": "td1",
"modifier": "private",
"original_string": "private ToDo td1;",
"type": "ToDo",
"var_name": "td1"
},
{
"declarator": "td2",
"modifier": "private",
"original_string": "private ToDo td2;",
"type": "ToDo",
"var_name": "td2"
},
{
"declarator": "store",
"modifier": "private",
"original_string": "private ToDoStore store;",
"type": "ToDoStore",
"var_name": "store"
},
{
"declarator": "api",
"modifier": "private",
"original_string": "private ToDoAPI api;",
"type": "ToDoAPI",
"var_name": "api"
},
{
"declarator": "exceptionStore = new ToDoStore(){\n\n\t\t@Override\n\t\tpublic Collection<ToDo> getAll() throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo get(String id) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo persist(ToDo td) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo update(String id, ToDo td) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic void delete(String id) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n @Override\n public int count() throws ToDoStoreException {\n throw new ToDoStoreException(\"Error\");\n }\n\t}",
"modifier": "private",
"original_string": "private ToDoStore exceptionStore = new ToDoStore(){\n\n\t\t@Override\n\t\tpublic Collection<ToDo> getAll() throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo get(String id) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo persist(ToDo td) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo update(String id, ToDo td) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic void delete(String id) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n @Override\n public int count() throws ToDoStoreException {\n throw new ToDoStoreException(\"Error\");\n }\n\t};",
"type": "ToDoStore",
"var_name": "exceptionStore"
},
{
"declarator": "errorApi",
"modifier": "private",
"original_string": "private ToDoAPI errorApi;",
"type": "ToDoAPI",
"var_name": "errorApi"
}
],
"file": "java/bluemix-todo-app/src/test/java/net/bluemix/todo/rest/ToDoAPITest.java",
"identifier": "ToDoAPITest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n\tpublic void testNewToDoInternalError() {\n\t\ttry {\n\t\t\terrorApi.newToDo(new ToDo());\n\t\t\tfail(\"Expected exception to be thrown.\");\n\t\t} catch(WebApplicationException e) {\n\t\t\tassertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), e.getResponse().getStatus());\n\t\t}\n\t}",
"class_method_signature": "ToDoAPITest.testNewToDoInternalError()",
"constructor": false,
"full_signature": "@Test public void testNewToDoInternalError()",
"identifier": "testNewToDoInternalError",
"invocations": [
"newToDo",
"fail",
"assertEquals",
"getStatusCode",
"getStatus",
"getResponse"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void testNewToDoInternalError()",
"testcase": true
} | {
"fields": [
{
"declarator": "store",
"modifier": "private",
"original_string": "private ToDoStore store;",
"type": "ToDoStore",
"var_name": "store"
}
],
"file": "java/bluemix-todo-app/src/main/java/net/bluemix/todo/rest/ToDoAPI.java",
"identifier": "ToDoAPI",
"interfaces": "",
"methods": [
{
"class_method_signature": "ToDoAPI.ToDoAPI()",
"constructor": true,
"full_signature": "public ToDoAPI()",
"identifier": "ToDoAPI",
"modifiers": "public",
"parameters": "()",
"return": "",
"signature": " ToDoAPI()",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.ToDoAPI(ToDoStore store)",
"constructor": true,
"full_signature": "public ToDoAPI(ToDoStore store)",
"identifier": "ToDoAPI",
"modifiers": "public",
"parameters": "(ToDoStore store)",
"return": "",
"signature": " ToDoAPI(ToDoStore store)",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.getToDo(@PathParam(\"id\") String id)",
"constructor": false,
"full_signature": "@GET @Path(\"/{id}\") @Produces(\"application/json\") public ToDo getToDo(@PathParam(\"id\") String id)",
"identifier": "getToDo",
"modifiers": "@GET @Path(\"/{id}\") @Produces(\"application/json\") public",
"parameters": "(@PathParam(\"id\") String id)",
"return": "ToDo",
"signature": "ToDo getToDo(@PathParam(\"id\") String id)",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.getToDos()",
"constructor": false,
"full_signature": "@GET @Produces(\"application/json\") public Collection<ToDo> getToDos()",
"identifier": "getToDos",
"modifiers": "@GET @Produces(\"application/json\") public",
"parameters": "()",
"return": "Collection<ToDo>",
"signature": "Collection<ToDo> getToDos()",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.newToDo(ToDo td)",
"constructor": false,
"full_signature": "@POST @Consumes(\"application/json\") @Produces(\"application/json\") public ToDo newToDo(ToDo td)",
"identifier": "newToDo",
"modifiers": "@POST @Consumes(\"application/json\") @Produces(\"application/json\") public",
"parameters": "(ToDo td)",
"return": "ToDo",
"signature": "ToDo newToDo(ToDo td)",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.updateToDo(@PathParam(\"id\") String id, ToDo td)",
"constructor": false,
"full_signature": "@PUT @Path(\"/{id}\") @Produces(\"application/json\") @Consumes(\"application/json\") public ToDo updateToDo(@PathParam(\"id\") String id, ToDo td)",
"identifier": "updateToDo",
"modifiers": "@PUT @Path(\"/{id}\") @Produces(\"application/json\") @Consumes(\"application/json\") public",
"parameters": "(@PathParam(\"id\") String id, ToDo td)",
"return": "ToDo",
"signature": "ToDo updateToDo(@PathParam(\"id\") String id, ToDo td)",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.deleteToDo(@PathParam(\"id\") String id)",
"constructor": false,
"full_signature": "@DELETE @Path(\"/{id}\") public void deleteToDo(@PathParam(\"id\") String id)",
"identifier": "deleteToDo",
"modifiers": "@DELETE @Path(\"/{id}\") public",
"parameters": "(@PathParam(\"id\") String id)",
"return": "void",
"signature": "void deleteToDo(@PathParam(\"id\") String id)",
"testcase": false
}
],
"superclass": ""
} | {
"body": "@POST\n @Consumes(\"application/json\")\n @Produces(\"application/json\")\n public ToDo newToDo(ToDo td) {\n if(td == null) {\n throw new WebApplicationException(\"Must supply a ToDo in the POST body.\", \n Response.Status.BAD_REQUEST);\n }\n try {\n return store.persist(td);\n } catch (ToDoStoreException e) {\n throw new WebApplicationException(\"Error saving ToDo.\", Response.Status.INTERNAL_SERVER_ERROR);\n }\n }",
"class_method_signature": "ToDoAPI.newToDo(ToDo td)",
"constructor": false,
"full_signature": "@POST @Consumes(\"application/json\") @Produces(\"application/json\") public ToDo newToDo(ToDo td)",
"identifier": "newToDo",
"invocations": [
"persist"
],
"modifiers": "@POST @Consumes(\"application/json\") @Produces(\"application/json\") public",
"parameters": "(ToDo td)",
"return": "ToDo",
"signature": "ToDo newToDo(ToDo td)",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 305,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 19317653,
"size": 777,
"stargazer_count": 196,
"stars": null,
"updates": null,
"url": "https://github.com/IBM-Cloud/todo-apps"
} |
19317653_41 | {
"fields": [
{
"declarator": "td1",
"modifier": "",
"original_string": "ToDo td1;",
"type": "ToDo",
"var_name": "td1"
},
{
"declarator": "td2",
"modifier": "",
"original_string": "ToDo td2;",
"type": "ToDo",
"var_name": "td2"
},
{
"declarator": "emptyStore",
"modifier": "private",
"original_string": "private ToDoStore emptyStore;",
"type": "ToDoStore",
"var_name": "emptyStore"
},
{
"declarator": "populatedStore",
"modifier": "private",
"original_string": "private ToDoStore populatedStore;",
"type": "ToDoStore",
"var_name": "populatedStore"
}
],
"file": "java/bluemix-todo-app/src/test/java/net/bluemix/todo/store/InMemoryStoreTest.java",
"identifier": "InMemoryStoreTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n\tpublic void testPersist() throws Exception {\n\t\tToDo td = new ToDo();\n\t\ttd.setTitle(\"do a test\");\n\t\ttd = emptyStore.persist(td);\n\t\tassertEquals(td, emptyStore.get(td.getId()));\n\t}",
"class_method_signature": "InMemoryStoreTest.testPersist()",
"constructor": false,
"full_signature": "@Test public void testPersist()",
"identifier": "testPersist",
"invocations": [
"setTitle",
"persist",
"assertEquals",
"get",
"getId"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void testPersist()",
"testcase": true
} | {
"fields": [
{
"declarator": "store",
"modifier": "private",
"original_string": "private Map<String, ToDo> store;",
"type": "Map<String, ToDo>",
"var_name": "store"
}
],
"file": "java/bluemix-todo-app/src/main/java/net/bluemix/todo/store/InMemoryStore.java",
"identifier": "InMemoryStore",
"interfaces": "implements ToDoStore",
"methods": [
{
"class_method_signature": "InMemoryStore.InMemoryStore()",
"constructor": true,
"full_signature": "public InMemoryStore()",
"identifier": "InMemoryStore",
"modifiers": "public",
"parameters": "()",
"return": "",
"signature": " InMemoryStore()",
"testcase": false
},
{
"class_method_signature": "InMemoryStore.getAll()",
"constructor": false,
"full_signature": "@Override public Collection<ToDo> getAll()",
"identifier": "getAll",
"modifiers": "@Override public",
"parameters": "()",
"return": "Collection<ToDo>",
"signature": "Collection<ToDo> getAll()",
"testcase": false
},
{
"class_method_signature": "InMemoryStore.get(String id)",
"constructor": false,
"full_signature": "@Override public ToDo get(String id)",
"identifier": "get",
"modifiers": "@Override public",
"parameters": "(String id)",
"return": "ToDo",
"signature": "ToDo get(String id)",
"testcase": false
},
{
"class_method_signature": "InMemoryStore.persist(ToDo td)",
"constructor": false,
"full_signature": "@Override public ToDo persist(ToDo td)",
"identifier": "persist",
"modifiers": "@Override public",
"parameters": "(ToDo td)",
"return": "ToDo",
"signature": "ToDo persist(ToDo td)",
"testcase": false
},
{
"class_method_signature": "InMemoryStore.update(String id, ToDo td)",
"constructor": false,
"full_signature": "@Override public ToDo update(String id, ToDo td)",
"identifier": "update",
"modifiers": "@Override public",
"parameters": "(String id, ToDo td)",
"return": "ToDo",
"signature": "ToDo update(String id, ToDo td)",
"testcase": false
},
{
"class_method_signature": "InMemoryStore.delete(String id)",
"constructor": false,
"full_signature": "@Override public void delete(String id)",
"identifier": "delete",
"modifiers": "@Override public",
"parameters": "(String id)",
"return": "void",
"signature": "void delete(String id)",
"testcase": false
},
{
"class_method_signature": "InMemoryStore.count()",
"constructor": false,
"full_signature": "@Override public int count()",
"identifier": "count",
"modifiers": "@Override public",
"parameters": "()",
"return": "int",
"signature": "int count()",
"testcase": false
}
],
"superclass": ""
} | {
"body": "@Override\n public ToDo persist(ToDo td) {\n td.setId(UUID.randomUUID().toString());\n synchronized(td) {\n store.put(td.getId(), td);\n }\n return td;\n }",
"class_method_signature": "InMemoryStore.persist(ToDo td)",
"constructor": false,
"full_signature": "@Override public ToDo persist(ToDo td)",
"identifier": "persist",
"invocations": [
"setId",
"toString",
"randomUUID",
"put",
"getId"
],
"modifiers": "@Override public",
"parameters": "(ToDo td)",
"return": "ToDo",
"signature": "ToDo persist(ToDo td)",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 305,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 19317653,
"size": 777,
"stargazer_count": 196,
"stars": null,
"updates": null,
"url": "https://github.com/IBM-Cloud/todo-apps"
} |
19317653_16 | {
"fields": [
{
"declarator": "rows",
"modifier": "private",
"original_string": "private List<CloudantRow> rows;",
"type": "List<CloudantRow>",
"var_name": "rows"
},
{
"declarator": "row1",
"modifier": "private",
"original_string": "private CloudantRow row1;",
"type": "CloudantRow",
"var_name": "row1"
},
{
"declarator": "row2",
"modifier": "private",
"original_string": "private CloudantRow row2;",
"type": "CloudantRow",
"var_name": "row2"
},
{
"declarator": "row3",
"modifier": "private",
"original_string": "private CloudantRow row3;",
"type": "CloudantRow",
"var_name": "row3"
},
{
"declarator": "ctd1",
"modifier": "private",
"original_string": "private CloudantToDo ctd1;",
"type": "CloudantToDo",
"var_name": "ctd1"
},
{
"declarator": "ctd2",
"modifier": "private",
"original_string": "private CloudantToDo ctd2;",
"type": "CloudantToDo",
"var_name": "ctd2"
},
{
"declarator": "ctd3",
"modifier": "private",
"original_string": "private CloudantToDo ctd3;",
"type": "CloudantToDo",
"var_name": "ctd3"
}
],
"file": "java/bluemix-todo-app/src/test/java/net/bluemix/todo/model/CloudantAllDocsTest.java",
"identifier": "CloudantAllDocsTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testGetRows() {\n CloudantAllDocs resp = new CloudantAllDocs();\n resp.setRows(rows);\n assertEquals(rows, resp.getRows());\n }",
"class_method_signature": "CloudantAllDocsTest.testGetRows()",
"constructor": false,
"full_signature": "@Test public void testGetRows()",
"identifier": "testGetRows",
"invocations": [
"setRows",
"assertEquals",
"getRows"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void testGetRows()",
"testcase": true
} | {
"fields": [
{
"declarator": "rows",
"modifier": "private",
"original_string": "private List<CloudantRow> rows;",
"type": "List<CloudantRow>",
"var_name": "rows"
}
],
"file": "java/bluemix-todo-app/src/main/java/net/bluemix/todo/model/CloudantAllDocs.java",
"identifier": "CloudantAllDocs",
"interfaces": "",
"methods": [
{
"class_method_signature": "CloudantAllDocs.getRows()",
"constructor": false,
"full_signature": "public List<CloudantRow> getRows()",
"identifier": "getRows",
"modifiers": "public",
"parameters": "()",
"return": "List<CloudantRow>",
"signature": "List<CloudantRow> getRows()",
"testcase": false
},
{
"class_method_signature": "CloudantAllDocs.setRows(List<CloudantRow> rows)",
"constructor": false,
"full_signature": "public void setRows(List<CloudantRow> rows)",
"identifier": "setRows",
"modifiers": "public",
"parameters": "(List<CloudantRow> rows)",
"return": "void",
"signature": "void setRows(List<CloudantRow> rows)",
"testcase": false
}
],
"superclass": ""
} | {
"body": "public List<CloudantRow> getRows() {\n return rows;\n }",
"class_method_signature": "CloudantAllDocs.getRows()",
"constructor": false,
"full_signature": "public List<CloudantRow> getRows()",
"identifier": "getRows",
"invocations": [],
"modifiers": "public",
"parameters": "()",
"return": "List<CloudantRow>",
"signature": "List<CloudantRow> getRows()",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 305,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 19317653,
"size": 777,
"stargazer_count": 196,
"stars": null,
"updates": null,
"url": "https://github.com/IBM-Cloud/todo-apps"
} |
19317653_3 | {
"fields": [
{
"declarator": "td1",
"modifier": "private",
"original_string": "private ToDo td1;",
"type": "ToDo",
"var_name": "td1"
},
{
"declarator": "td2",
"modifier": "private",
"original_string": "private ToDo td2;",
"type": "ToDo",
"var_name": "td2"
},
{
"declarator": "store",
"modifier": "private",
"original_string": "private ToDoStore store;",
"type": "ToDoStore",
"var_name": "store"
},
{
"declarator": "api",
"modifier": "private",
"original_string": "private ToDoAPI api;",
"type": "ToDoAPI",
"var_name": "api"
},
{
"declarator": "exceptionStore = new ToDoStore(){\n\n\t\t@Override\n\t\tpublic Collection<ToDo> getAll() throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo get(String id) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo persist(ToDo td) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo update(String id, ToDo td) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic void delete(String id) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n @Override\n public int count() throws ToDoStoreException {\n throw new ToDoStoreException(\"Error\");\n }\n\t}",
"modifier": "private",
"original_string": "private ToDoStore exceptionStore = new ToDoStore(){\n\n\t\t@Override\n\t\tpublic Collection<ToDo> getAll() throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo get(String id) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo persist(ToDo td) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo update(String id, ToDo td) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic void delete(String id) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n @Override\n public int count() throws ToDoStoreException {\n throw new ToDoStoreException(\"Error\");\n }\n\t};",
"type": "ToDoStore",
"var_name": "exceptionStore"
},
{
"declarator": "errorApi",
"modifier": "private",
"original_string": "private ToDoAPI errorApi;",
"type": "ToDoAPI",
"var_name": "errorApi"
}
],
"file": "java/bluemix-todo-app/src/test/java/net/bluemix/todo/rest/ToDoAPITest.java",
"identifier": "ToDoAPITest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n\tpublic void testToDoDoesNotExist() {\n\t\ttry {\n\t\t\tapi.getToDo(\"123\");\n\t\t\tfail(\"Expected exception to be thrown.\");\n\t\t} catch(WebApplicationException e) {\n\t\t\tassertEquals(Response.Status.BAD_REQUEST.getStatusCode(), e.getResponse().getStatus());\n\t\t}\n\t}",
"class_method_signature": "ToDoAPITest.testToDoDoesNotExist()",
"constructor": false,
"full_signature": "@Test public void testToDoDoesNotExist()",
"identifier": "testToDoDoesNotExist",
"invocations": [
"getToDo",
"fail",
"assertEquals",
"getStatusCode",
"getStatus",
"getResponse"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void testToDoDoesNotExist()",
"testcase": true
} | {
"fields": [
{
"declarator": "store",
"modifier": "private",
"original_string": "private ToDoStore store;",
"type": "ToDoStore",
"var_name": "store"
}
],
"file": "java/bluemix-todo-app/src/main/java/net/bluemix/todo/rest/ToDoAPI.java",
"identifier": "ToDoAPI",
"interfaces": "",
"methods": [
{
"class_method_signature": "ToDoAPI.ToDoAPI()",
"constructor": true,
"full_signature": "public ToDoAPI()",
"identifier": "ToDoAPI",
"modifiers": "public",
"parameters": "()",
"return": "",
"signature": " ToDoAPI()",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.ToDoAPI(ToDoStore store)",
"constructor": true,
"full_signature": "public ToDoAPI(ToDoStore store)",
"identifier": "ToDoAPI",
"modifiers": "public",
"parameters": "(ToDoStore store)",
"return": "",
"signature": " ToDoAPI(ToDoStore store)",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.getToDo(@PathParam(\"id\") String id)",
"constructor": false,
"full_signature": "@GET @Path(\"/{id}\") @Produces(\"application/json\") public ToDo getToDo(@PathParam(\"id\") String id)",
"identifier": "getToDo",
"modifiers": "@GET @Path(\"/{id}\") @Produces(\"application/json\") public",
"parameters": "(@PathParam(\"id\") String id)",
"return": "ToDo",
"signature": "ToDo getToDo(@PathParam(\"id\") String id)",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.getToDos()",
"constructor": false,
"full_signature": "@GET @Produces(\"application/json\") public Collection<ToDo> getToDos()",
"identifier": "getToDos",
"modifiers": "@GET @Produces(\"application/json\") public",
"parameters": "()",
"return": "Collection<ToDo>",
"signature": "Collection<ToDo> getToDos()",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.newToDo(ToDo td)",
"constructor": false,
"full_signature": "@POST @Consumes(\"application/json\") @Produces(\"application/json\") public ToDo newToDo(ToDo td)",
"identifier": "newToDo",
"modifiers": "@POST @Consumes(\"application/json\") @Produces(\"application/json\") public",
"parameters": "(ToDo td)",
"return": "ToDo",
"signature": "ToDo newToDo(ToDo td)",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.updateToDo(@PathParam(\"id\") String id, ToDo td)",
"constructor": false,
"full_signature": "@PUT @Path(\"/{id}\") @Produces(\"application/json\") @Consumes(\"application/json\") public ToDo updateToDo(@PathParam(\"id\") String id, ToDo td)",
"identifier": "updateToDo",
"modifiers": "@PUT @Path(\"/{id}\") @Produces(\"application/json\") @Consumes(\"application/json\") public",
"parameters": "(@PathParam(\"id\") String id, ToDo td)",
"return": "ToDo",
"signature": "ToDo updateToDo(@PathParam(\"id\") String id, ToDo td)",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.deleteToDo(@PathParam(\"id\") String id)",
"constructor": false,
"full_signature": "@DELETE @Path(\"/{id}\") public void deleteToDo(@PathParam(\"id\") String id)",
"identifier": "deleteToDo",
"modifiers": "@DELETE @Path(\"/{id}\") public",
"parameters": "(@PathParam(\"id\") String id)",
"return": "void",
"signature": "void deleteToDo(@PathParam(\"id\") String id)",
"testcase": false
}
],
"superclass": ""
} | {
"body": "@GET @Path(\"/{id}\")\n @Produces(\"application/json\")\n public ToDo getToDo(@PathParam(\"id\") String id) {\n if(id == null) {\n throw new WebApplicationException(\"Must supply an ID, for example /api/todos/123.\", \n Response.Status.BAD_REQUEST);\n }\n try {\n ToDo td = store.get(id);\n if(td == null) {\n throw new WebApplicationException(\"ToDo with the ID \" + id + \" does not exist.\",\n Response.Status.BAD_REQUEST);\n }\n return td;\n } catch (ToDoStoreException e) {\n throw new WebApplicationException(\"Error getting ToDo.\", Response.Status.INTERNAL_SERVER_ERROR);\n }\n }",
"class_method_signature": "ToDoAPI.getToDo(@PathParam(\"id\") String id)",
"constructor": false,
"full_signature": "@GET @Path(\"/{id}\") @Produces(\"application/json\") public ToDo getToDo(@PathParam(\"id\") String id)",
"identifier": "getToDo",
"invocations": [
"get"
],
"modifiers": "@GET @Path(\"/{id}\") @Produces(\"application/json\") public",
"parameters": "(@PathParam(\"id\") String id)",
"return": "ToDo",
"signature": "ToDo getToDo(@PathParam(\"id\") String id)",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 305,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 19317653,
"size": 777,
"stargazer_count": 196,
"stars": null,
"updates": null,
"url": "https://github.com/IBM-Cloud/todo-apps"
} |
19317653_36 | {
"fields": [
{
"declarator": "ctd",
"modifier": "private",
"original_string": "private CloudantToDo ctd;",
"type": "CloudantToDo",
"var_name": "ctd"
}
],
"file": "java/bluemix-todo-app/src/test/java/net/bluemix/todo/model/CloudantRowTest.java",
"identifier": "CloudantRowTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testGetId() {\n CloudantRow row = new CloudantRow();\n row.setId(\"123\");\n assertEquals(\"123\", row.getId());\n }",
"class_method_signature": "CloudantRowTest.testGetId()",
"constructor": false,
"full_signature": "@Test public void testGetId()",
"identifier": "testGetId",
"invocations": [
"setId",
"assertEquals",
"getId"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void testGetId()",
"testcase": true
} | {
"fields": [
{
"declarator": "id",
"modifier": "private",
"original_string": "private String id;",
"type": "String",
"var_name": "id"
},
{
"declarator": "key",
"modifier": "private",
"original_string": "private int key;",
"type": "int",
"var_name": "key"
},
{
"declarator": "doc",
"modifier": "private",
"original_string": "private CloudantToDo doc;",
"type": "CloudantToDo",
"var_name": "doc"
},
{
"declarator": "value",
"modifier": "private",
"original_string": "private ToDo value;",
"type": "ToDo",
"var_name": "value"
}
],
"file": "java/bluemix-todo-app/src/main/java/net/bluemix/todo/model/CloudantRow.java",
"identifier": "CloudantRow",
"interfaces": "",
"methods": [
{
"class_method_signature": "CloudantRow.getValue()",
"constructor": false,
"full_signature": "public ToDo getValue()",
"identifier": "getValue",
"modifiers": "public",
"parameters": "()",
"return": "ToDo",
"signature": "ToDo getValue()",
"testcase": false
},
{
"class_method_signature": "CloudantRow.setValue(ToDo value)",
"constructor": false,
"full_signature": "public void setValue(ToDo value)",
"identifier": "setValue",
"modifiers": "public",
"parameters": "(ToDo value)",
"return": "void",
"signature": "void setValue(ToDo value)",
"testcase": false
},
{
"class_method_signature": "CloudantRow.getKey()",
"constructor": false,
"full_signature": "public int getKey()",
"identifier": "getKey",
"modifiers": "public",
"parameters": "()",
"return": "int",
"signature": "int getKey()",
"testcase": false
},
{
"class_method_signature": "CloudantRow.setKey(int key)",
"constructor": false,
"full_signature": "public void setKey(int key)",
"identifier": "setKey",
"modifiers": "public",
"parameters": "(int key)",
"return": "void",
"signature": "void setKey(int key)",
"testcase": false
},
{
"class_method_signature": "CloudantRow.getId()",
"constructor": false,
"full_signature": "public String getId()",
"identifier": "getId",
"modifiers": "public",
"parameters": "()",
"return": "String",
"signature": "String getId()",
"testcase": false
},
{
"class_method_signature": "CloudantRow.setId(String id)",
"constructor": false,
"full_signature": "public void setId(String id)",
"identifier": "setId",
"modifiers": "public",
"parameters": "(String id)",
"return": "void",
"signature": "void setId(String id)",
"testcase": false
},
{
"class_method_signature": "CloudantRow.getDoc()",
"constructor": false,
"full_signature": "public CloudantToDo getDoc()",
"identifier": "getDoc",
"modifiers": "public",
"parameters": "()",
"return": "CloudantToDo",
"signature": "CloudantToDo getDoc()",
"testcase": false
},
{
"class_method_signature": "CloudantRow.setDoc(CloudantToDo doc)",
"constructor": false,
"full_signature": "public void setDoc(CloudantToDo doc)",
"identifier": "setDoc",
"modifiers": "public",
"parameters": "(CloudantToDo doc)",
"return": "void",
"signature": "void setDoc(CloudantToDo doc)",
"testcase": false
}
],
"superclass": ""
} | {
"body": "public String getId() {\n return id;\n }",
"class_method_signature": "CloudantRow.getId()",
"constructor": false,
"full_signature": "public String getId()",
"identifier": "getId",
"invocations": [],
"modifiers": "public",
"parameters": "()",
"return": "String",
"signature": "String getId()",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 305,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 19317653,
"size": 777,
"stargazer_count": 196,
"stars": null,
"updates": null,
"url": "https://github.com/IBM-Cloud/todo-apps"
} |
19317653_20 | {
"fields": [
{
"declarator": "td",
"modifier": "private",
"original_string": "private ToDo td;",
"type": "ToDo",
"var_name": "td"
}
],
"file": "java/bluemix-todo-app/src/test/java/net/bluemix/todo/model/CloudantToDoTest.java",
"identifier": "CloudantToDoTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testIsCompleted() {\n CloudantToDo ctd = new CloudantToDo(td);\n assertFalse(ctd.isCompleted());\n ctd = new CloudantToDo();\n ctd.setCompleted(true);\n assertTrue(ctd.isCompleted());\n }",
"class_method_signature": "CloudantToDoTest.testIsCompleted()",
"constructor": false,
"full_signature": "@Test public void testIsCompleted()",
"identifier": "testIsCompleted",
"invocations": [
"assertFalse",
"isCompleted",
"setCompleted",
"assertTrue",
"isCompleted"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void testIsCompleted()",
"testcase": true
} | {
"fields": [
{
"declarator": "_id",
"modifier": "private",
"original_string": "private String _id;",
"type": "String",
"var_name": "_id"
},
{
"declarator": "_rev",
"modifier": "private",
"original_string": "private String _rev;",
"type": "String",
"var_name": "_rev"
},
{
"declarator": "title",
"modifier": "private",
"original_string": "private String title;",
"type": "String",
"var_name": "title"
},
{
"declarator": "completed",
"modifier": "private",
"original_string": "private boolean completed;",
"type": "boolean",
"var_name": "completed"
},
{
"declarator": "order",
"modifier": "private",
"original_string": "private int order;",
"type": "int",
"var_name": "order"
}
],
"file": "java/bluemix-todo-app/src/main/java/net/bluemix/todo/model/CloudantToDo.java",
"identifier": "CloudantToDo",
"interfaces": "",
"methods": [
{
"class_method_signature": "CloudantToDo.CloudantToDo()",
"constructor": true,
"full_signature": "public CloudantToDo()",
"identifier": "CloudantToDo",
"modifiers": "public",
"parameters": "()",
"return": "",
"signature": " CloudantToDo()",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.CloudantToDo(ToDo td)",
"constructor": true,
"full_signature": "public CloudantToDo(ToDo td)",
"identifier": "CloudantToDo",
"modifiers": "public",
"parameters": "(ToDo td)",
"return": "",
"signature": " CloudantToDo(ToDo td)",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.get_id()",
"constructor": false,
"full_signature": "public String get_id()",
"identifier": "get_id",
"modifiers": "public",
"parameters": "()",
"return": "String",
"signature": "String get_id()",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.set_id(String _id)",
"constructor": false,
"full_signature": "public void set_id(String _id)",
"identifier": "set_id",
"modifiers": "public",
"parameters": "(String _id)",
"return": "void",
"signature": "void set_id(String _id)",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.get_rev()",
"constructor": false,
"full_signature": "public String get_rev()",
"identifier": "get_rev",
"modifiers": "public",
"parameters": "()",
"return": "String",
"signature": "String get_rev()",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.set_rev(String _rev)",
"constructor": false,
"full_signature": "public void set_rev(String _rev)",
"identifier": "set_rev",
"modifiers": "public",
"parameters": "(String _rev)",
"return": "void",
"signature": "void set_rev(String _rev)",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.getTitle()",
"constructor": false,
"full_signature": "public String getTitle()",
"identifier": "getTitle",
"modifiers": "public",
"parameters": "()",
"return": "String",
"signature": "String getTitle()",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.setTitle(String title)",
"constructor": false,
"full_signature": "public void setTitle(String title)",
"identifier": "setTitle",
"modifiers": "public",
"parameters": "(String title)",
"return": "void",
"signature": "void setTitle(String title)",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.isCompleted()",
"constructor": false,
"full_signature": "public boolean isCompleted()",
"identifier": "isCompleted",
"modifiers": "public",
"parameters": "()",
"return": "boolean",
"signature": "boolean isCompleted()",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.setCompleted(boolean completed)",
"constructor": false,
"full_signature": "public void setCompleted(boolean completed)",
"identifier": "setCompleted",
"modifiers": "public",
"parameters": "(boolean completed)",
"return": "void",
"signature": "void setCompleted(boolean completed)",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.getToDo()",
"constructor": false,
"full_signature": "public ToDo getToDo()",
"identifier": "getToDo",
"modifiers": "public",
"parameters": "()",
"return": "ToDo",
"signature": "ToDo getToDo()",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.getOrder()",
"constructor": false,
"full_signature": "public int getOrder()",
"identifier": "getOrder",
"modifiers": "public",
"parameters": "()",
"return": "int",
"signature": "int getOrder()",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.setOrder(int order)",
"constructor": false,
"full_signature": "public void setOrder(int order)",
"identifier": "setOrder",
"modifiers": "public",
"parameters": "(int order)",
"return": "void",
"signature": "void setOrder(int order)",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.equals(Object obj)",
"constructor": false,
"full_signature": "@Override public boolean equals(Object obj)",
"identifier": "equals",
"modifiers": "@Override public",
"parameters": "(Object obj)",
"return": "boolean",
"signature": "boolean equals(Object obj)",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.hashCode()",
"constructor": false,
"full_signature": "@Override public int hashCode()",
"identifier": "hashCode",
"modifiers": "@Override public",
"parameters": "()",
"return": "int",
"signature": "int hashCode()",
"testcase": false
}
],
"superclass": ""
} | {
"body": "public boolean isCompleted() {\n return completed;\n }",
"class_method_signature": "CloudantToDo.isCompleted()",
"constructor": false,
"full_signature": "public boolean isCompleted()",
"identifier": "isCompleted",
"invocations": [],
"modifiers": "public",
"parameters": "()",
"return": "boolean",
"signature": "boolean isCompleted()",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 305,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 19317653,
"size": 777,
"stargazer_count": 196,
"stars": null,
"updates": null,
"url": "https://github.com/IBM-Cloud/todo-apps"
} |
19317653_21 | {
"fields": [
{
"declarator": "td",
"modifier": "private",
"original_string": "private ToDo td;",
"type": "ToDo",
"var_name": "td"
}
],
"file": "java/bluemix-todo-app/src/test/java/net/bluemix/todo/model/CloudantToDoTest.java",
"identifier": "CloudantToDoTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testGetToDo() {\n CloudantToDo ctd = new CloudantToDo(td);\n assertEquals(td, ctd.getToDo());\n ctd = new CloudantToDo();\n ctd.set_id(\"456\");\n ctd.set_rev(\"def\");\n ctd.setTitle(\"Another test\");\n ToDo testTd = new ToDo();\n testTd.setId(\"456\");\n testTd.setTitle(\"Another test\");\n assertEquals(testTd, ctd.getToDo());\n }",
"class_method_signature": "CloudantToDoTest.testGetToDo()",
"constructor": false,
"full_signature": "@Test public void testGetToDo()",
"identifier": "testGetToDo",
"invocations": [
"assertEquals",
"getToDo",
"set_id",
"set_rev",
"setTitle",
"setId",
"setTitle",
"assertEquals",
"getToDo"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void testGetToDo()",
"testcase": true
} | {
"fields": [
{
"declarator": "_id",
"modifier": "private",
"original_string": "private String _id;",
"type": "String",
"var_name": "_id"
},
{
"declarator": "_rev",
"modifier": "private",
"original_string": "private String _rev;",
"type": "String",
"var_name": "_rev"
},
{
"declarator": "title",
"modifier": "private",
"original_string": "private String title;",
"type": "String",
"var_name": "title"
},
{
"declarator": "completed",
"modifier": "private",
"original_string": "private boolean completed;",
"type": "boolean",
"var_name": "completed"
},
{
"declarator": "order",
"modifier": "private",
"original_string": "private int order;",
"type": "int",
"var_name": "order"
}
],
"file": "java/bluemix-todo-app/src/main/java/net/bluemix/todo/model/CloudantToDo.java",
"identifier": "CloudantToDo",
"interfaces": "",
"methods": [
{
"class_method_signature": "CloudantToDo.CloudantToDo()",
"constructor": true,
"full_signature": "public CloudantToDo()",
"identifier": "CloudantToDo",
"modifiers": "public",
"parameters": "()",
"return": "",
"signature": " CloudantToDo()",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.CloudantToDo(ToDo td)",
"constructor": true,
"full_signature": "public CloudantToDo(ToDo td)",
"identifier": "CloudantToDo",
"modifiers": "public",
"parameters": "(ToDo td)",
"return": "",
"signature": " CloudantToDo(ToDo td)",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.get_id()",
"constructor": false,
"full_signature": "public String get_id()",
"identifier": "get_id",
"modifiers": "public",
"parameters": "()",
"return": "String",
"signature": "String get_id()",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.set_id(String _id)",
"constructor": false,
"full_signature": "public void set_id(String _id)",
"identifier": "set_id",
"modifiers": "public",
"parameters": "(String _id)",
"return": "void",
"signature": "void set_id(String _id)",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.get_rev()",
"constructor": false,
"full_signature": "public String get_rev()",
"identifier": "get_rev",
"modifiers": "public",
"parameters": "()",
"return": "String",
"signature": "String get_rev()",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.set_rev(String _rev)",
"constructor": false,
"full_signature": "public void set_rev(String _rev)",
"identifier": "set_rev",
"modifiers": "public",
"parameters": "(String _rev)",
"return": "void",
"signature": "void set_rev(String _rev)",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.getTitle()",
"constructor": false,
"full_signature": "public String getTitle()",
"identifier": "getTitle",
"modifiers": "public",
"parameters": "()",
"return": "String",
"signature": "String getTitle()",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.setTitle(String title)",
"constructor": false,
"full_signature": "public void setTitle(String title)",
"identifier": "setTitle",
"modifiers": "public",
"parameters": "(String title)",
"return": "void",
"signature": "void setTitle(String title)",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.isCompleted()",
"constructor": false,
"full_signature": "public boolean isCompleted()",
"identifier": "isCompleted",
"modifiers": "public",
"parameters": "()",
"return": "boolean",
"signature": "boolean isCompleted()",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.setCompleted(boolean completed)",
"constructor": false,
"full_signature": "public void setCompleted(boolean completed)",
"identifier": "setCompleted",
"modifiers": "public",
"parameters": "(boolean completed)",
"return": "void",
"signature": "void setCompleted(boolean completed)",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.getToDo()",
"constructor": false,
"full_signature": "public ToDo getToDo()",
"identifier": "getToDo",
"modifiers": "public",
"parameters": "()",
"return": "ToDo",
"signature": "ToDo getToDo()",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.getOrder()",
"constructor": false,
"full_signature": "public int getOrder()",
"identifier": "getOrder",
"modifiers": "public",
"parameters": "()",
"return": "int",
"signature": "int getOrder()",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.setOrder(int order)",
"constructor": false,
"full_signature": "public void setOrder(int order)",
"identifier": "setOrder",
"modifiers": "public",
"parameters": "(int order)",
"return": "void",
"signature": "void setOrder(int order)",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.equals(Object obj)",
"constructor": false,
"full_signature": "@Override public boolean equals(Object obj)",
"identifier": "equals",
"modifiers": "@Override public",
"parameters": "(Object obj)",
"return": "boolean",
"signature": "boolean equals(Object obj)",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.hashCode()",
"constructor": false,
"full_signature": "@Override public int hashCode()",
"identifier": "hashCode",
"modifiers": "@Override public",
"parameters": "()",
"return": "int",
"signature": "int hashCode()",
"testcase": false
}
],
"superclass": ""
} | {
"body": "public ToDo getToDo() {\n ToDo td = new ToDo();\n td.setId(this.get_id());\n td.setCompleted(this.isCompleted());\n td.setTitle(this.getTitle());\n return td;\n }",
"class_method_signature": "CloudantToDo.getToDo()",
"constructor": false,
"full_signature": "public ToDo getToDo()",
"identifier": "getToDo",
"invocations": [
"setId",
"get_id",
"setCompleted",
"isCompleted",
"setTitle",
"getTitle"
],
"modifiers": "public",
"parameters": "()",
"return": "ToDo",
"signature": "ToDo getToDo()",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 305,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 19317653,
"size": 777,
"stargazer_count": 196,
"stars": null,
"updates": null,
"url": "https://github.com/IBM-Cloud/todo-apps"
} |
19317653_37 | {
"fields": [
{
"declarator": "ctd",
"modifier": "private",
"original_string": "private CloudantToDo ctd;",
"type": "CloudantToDo",
"var_name": "ctd"
}
],
"file": "java/bluemix-todo-app/src/test/java/net/bluemix/todo/model/CloudantRowTest.java",
"identifier": "CloudantRowTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testGetKey() {\n CloudantRow row = new CloudantRow();\n row.setKey(0);\n assertEquals(0, row.getKey());\n }",
"class_method_signature": "CloudantRowTest.testGetKey()",
"constructor": false,
"full_signature": "@Test public void testGetKey()",
"identifier": "testGetKey",
"invocations": [
"setKey",
"assertEquals",
"getKey"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void testGetKey()",
"testcase": true
} | {
"fields": [
{
"declarator": "id",
"modifier": "private",
"original_string": "private String id;",
"type": "String",
"var_name": "id"
},
{
"declarator": "key",
"modifier": "private",
"original_string": "private int key;",
"type": "int",
"var_name": "key"
},
{
"declarator": "doc",
"modifier": "private",
"original_string": "private CloudantToDo doc;",
"type": "CloudantToDo",
"var_name": "doc"
},
{
"declarator": "value",
"modifier": "private",
"original_string": "private ToDo value;",
"type": "ToDo",
"var_name": "value"
}
],
"file": "java/bluemix-todo-app/src/main/java/net/bluemix/todo/model/CloudantRow.java",
"identifier": "CloudantRow",
"interfaces": "",
"methods": [
{
"class_method_signature": "CloudantRow.getValue()",
"constructor": false,
"full_signature": "public ToDo getValue()",
"identifier": "getValue",
"modifiers": "public",
"parameters": "()",
"return": "ToDo",
"signature": "ToDo getValue()",
"testcase": false
},
{
"class_method_signature": "CloudantRow.setValue(ToDo value)",
"constructor": false,
"full_signature": "public void setValue(ToDo value)",
"identifier": "setValue",
"modifiers": "public",
"parameters": "(ToDo value)",
"return": "void",
"signature": "void setValue(ToDo value)",
"testcase": false
},
{
"class_method_signature": "CloudantRow.getKey()",
"constructor": false,
"full_signature": "public int getKey()",
"identifier": "getKey",
"modifiers": "public",
"parameters": "()",
"return": "int",
"signature": "int getKey()",
"testcase": false
},
{
"class_method_signature": "CloudantRow.setKey(int key)",
"constructor": false,
"full_signature": "public void setKey(int key)",
"identifier": "setKey",
"modifiers": "public",
"parameters": "(int key)",
"return": "void",
"signature": "void setKey(int key)",
"testcase": false
},
{
"class_method_signature": "CloudantRow.getId()",
"constructor": false,
"full_signature": "public String getId()",
"identifier": "getId",
"modifiers": "public",
"parameters": "()",
"return": "String",
"signature": "String getId()",
"testcase": false
},
{
"class_method_signature": "CloudantRow.setId(String id)",
"constructor": false,
"full_signature": "public void setId(String id)",
"identifier": "setId",
"modifiers": "public",
"parameters": "(String id)",
"return": "void",
"signature": "void setId(String id)",
"testcase": false
},
{
"class_method_signature": "CloudantRow.getDoc()",
"constructor": false,
"full_signature": "public CloudantToDo getDoc()",
"identifier": "getDoc",
"modifiers": "public",
"parameters": "()",
"return": "CloudantToDo",
"signature": "CloudantToDo getDoc()",
"testcase": false
},
{
"class_method_signature": "CloudantRow.setDoc(CloudantToDo doc)",
"constructor": false,
"full_signature": "public void setDoc(CloudantToDo doc)",
"identifier": "setDoc",
"modifiers": "public",
"parameters": "(CloudantToDo doc)",
"return": "void",
"signature": "void setDoc(CloudantToDo doc)",
"testcase": false
}
],
"superclass": ""
} | {
"body": "public int getKey() {\n return key;\n }",
"class_method_signature": "CloudantRow.getKey()",
"constructor": false,
"full_signature": "public int getKey()",
"identifier": "getKey",
"invocations": [],
"modifiers": "public",
"parameters": "()",
"return": "int",
"signature": "int getKey()",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 305,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 19317653,
"size": 777,
"stargazer_count": 196,
"stars": null,
"updates": null,
"url": "https://github.com/IBM-Cloud/todo-apps"
} |
19317653_2 | {
"fields": [
{
"declarator": "td1",
"modifier": "private",
"original_string": "private ToDo td1;",
"type": "ToDo",
"var_name": "td1"
},
{
"declarator": "td2",
"modifier": "private",
"original_string": "private ToDo td2;",
"type": "ToDo",
"var_name": "td2"
},
{
"declarator": "store",
"modifier": "private",
"original_string": "private ToDoStore store;",
"type": "ToDoStore",
"var_name": "store"
},
{
"declarator": "api",
"modifier": "private",
"original_string": "private ToDoAPI api;",
"type": "ToDoAPI",
"var_name": "api"
},
{
"declarator": "exceptionStore = new ToDoStore(){\n\n\t\t@Override\n\t\tpublic Collection<ToDo> getAll() throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo get(String id) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo persist(ToDo td) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo update(String id, ToDo td) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic void delete(String id) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n @Override\n public int count() throws ToDoStoreException {\n throw new ToDoStoreException(\"Error\");\n }\n\t}",
"modifier": "private",
"original_string": "private ToDoStore exceptionStore = new ToDoStore(){\n\n\t\t@Override\n\t\tpublic Collection<ToDo> getAll() throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo get(String id) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo persist(ToDo td) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo update(String id, ToDo td) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic void delete(String id) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n @Override\n public int count() throws ToDoStoreException {\n throw new ToDoStoreException(\"Error\");\n }\n\t};",
"type": "ToDoStore",
"var_name": "exceptionStore"
},
{
"declarator": "errorApi",
"modifier": "private",
"original_string": "private ToDoAPI errorApi;",
"type": "ToDoAPI",
"var_name": "errorApi"
}
],
"file": "java/bluemix-todo-app/src/test/java/net/bluemix/todo/rest/ToDoAPITest.java",
"identifier": "ToDoAPITest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n\tpublic void testGetToDoException() {\n\t\ttry {\n\t\t\terrorApi.getToDo(\"123\");\n\t\t\tfail(\"Expected exception to be thrown.\");\n\t\t} catch(WebApplicationException e) {\n\t\t\tassertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), e.getResponse().getStatus());\n\t\t}\n\t}",
"class_method_signature": "ToDoAPITest.testGetToDoException()",
"constructor": false,
"full_signature": "@Test public void testGetToDoException()",
"identifier": "testGetToDoException",
"invocations": [
"getToDo",
"fail",
"assertEquals",
"getStatusCode",
"getStatus",
"getResponse"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void testGetToDoException()",
"testcase": true
} | {
"fields": [
{
"declarator": "store",
"modifier": "private",
"original_string": "private ToDoStore store;",
"type": "ToDoStore",
"var_name": "store"
}
],
"file": "java/bluemix-todo-app/src/main/java/net/bluemix/todo/rest/ToDoAPI.java",
"identifier": "ToDoAPI",
"interfaces": "",
"methods": [
{
"class_method_signature": "ToDoAPI.ToDoAPI()",
"constructor": true,
"full_signature": "public ToDoAPI()",
"identifier": "ToDoAPI",
"modifiers": "public",
"parameters": "()",
"return": "",
"signature": " ToDoAPI()",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.ToDoAPI(ToDoStore store)",
"constructor": true,
"full_signature": "public ToDoAPI(ToDoStore store)",
"identifier": "ToDoAPI",
"modifiers": "public",
"parameters": "(ToDoStore store)",
"return": "",
"signature": " ToDoAPI(ToDoStore store)",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.getToDo(@PathParam(\"id\") String id)",
"constructor": false,
"full_signature": "@GET @Path(\"/{id}\") @Produces(\"application/json\") public ToDo getToDo(@PathParam(\"id\") String id)",
"identifier": "getToDo",
"modifiers": "@GET @Path(\"/{id}\") @Produces(\"application/json\") public",
"parameters": "(@PathParam(\"id\") String id)",
"return": "ToDo",
"signature": "ToDo getToDo(@PathParam(\"id\") String id)",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.getToDos()",
"constructor": false,
"full_signature": "@GET @Produces(\"application/json\") public Collection<ToDo> getToDos()",
"identifier": "getToDos",
"modifiers": "@GET @Produces(\"application/json\") public",
"parameters": "()",
"return": "Collection<ToDo>",
"signature": "Collection<ToDo> getToDos()",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.newToDo(ToDo td)",
"constructor": false,
"full_signature": "@POST @Consumes(\"application/json\") @Produces(\"application/json\") public ToDo newToDo(ToDo td)",
"identifier": "newToDo",
"modifiers": "@POST @Consumes(\"application/json\") @Produces(\"application/json\") public",
"parameters": "(ToDo td)",
"return": "ToDo",
"signature": "ToDo newToDo(ToDo td)",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.updateToDo(@PathParam(\"id\") String id, ToDo td)",
"constructor": false,
"full_signature": "@PUT @Path(\"/{id}\") @Produces(\"application/json\") @Consumes(\"application/json\") public ToDo updateToDo(@PathParam(\"id\") String id, ToDo td)",
"identifier": "updateToDo",
"modifiers": "@PUT @Path(\"/{id}\") @Produces(\"application/json\") @Consumes(\"application/json\") public",
"parameters": "(@PathParam(\"id\") String id, ToDo td)",
"return": "ToDo",
"signature": "ToDo updateToDo(@PathParam(\"id\") String id, ToDo td)",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.deleteToDo(@PathParam(\"id\") String id)",
"constructor": false,
"full_signature": "@DELETE @Path(\"/{id}\") public void deleteToDo(@PathParam(\"id\") String id)",
"identifier": "deleteToDo",
"modifiers": "@DELETE @Path(\"/{id}\") public",
"parameters": "(@PathParam(\"id\") String id)",
"return": "void",
"signature": "void deleteToDo(@PathParam(\"id\") String id)",
"testcase": false
}
],
"superclass": ""
} | {
"body": "@GET @Path(\"/{id}\")\n @Produces(\"application/json\")\n public ToDo getToDo(@PathParam(\"id\") String id) {\n if(id == null) {\n throw new WebApplicationException(\"Must supply an ID, for example /api/todos/123.\", \n Response.Status.BAD_REQUEST);\n }\n try {\n ToDo td = store.get(id);\n if(td == null) {\n throw new WebApplicationException(\"ToDo with the ID \" + id + \" does not exist.\",\n Response.Status.BAD_REQUEST);\n }\n return td;\n } catch (ToDoStoreException e) {\n throw new WebApplicationException(\"Error getting ToDo.\", Response.Status.INTERNAL_SERVER_ERROR);\n }\n }",
"class_method_signature": "ToDoAPI.getToDo(@PathParam(\"id\") String id)",
"constructor": false,
"full_signature": "@GET @Path(\"/{id}\") @Produces(\"application/json\") public ToDo getToDo(@PathParam(\"id\") String id)",
"identifier": "getToDo",
"invocations": [
"get"
],
"modifiers": "@GET @Path(\"/{id}\") @Produces(\"application/json\") public",
"parameters": "(@PathParam(\"id\") String id)",
"return": "ToDo",
"signature": "ToDo getToDo(@PathParam(\"id\") String id)",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 305,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 19317653,
"size": 777,
"stargazer_count": 196,
"stars": null,
"updates": null,
"url": "https://github.com/IBM-Cloud/todo-apps"
} |
19317653_17 | {
"fields": [
{
"declarator": "td",
"modifier": "private",
"original_string": "private ToDo td;",
"type": "ToDo",
"var_name": "td"
}
],
"file": "java/bluemix-todo-app/src/test/java/net/bluemix/todo/model/CloudantToDoTest.java",
"identifier": "CloudantToDoTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testGet_id() {\n CloudantToDo ctd = new CloudantToDo(td);\n assertEquals(\"123\", ctd.get_id());\n ctd = new CloudantToDo();\n ctd.set_id(\"456\");\n assertEquals(\"456\", ctd.get_id());\n }",
"class_method_signature": "CloudantToDoTest.testGet_id()",
"constructor": false,
"full_signature": "@Test public void testGet_id()",
"identifier": "testGet_id",
"invocations": [
"assertEquals",
"get_id",
"set_id",
"assertEquals",
"get_id"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void testGet_id()",
"testcase": true
} | {
"fields": [
{
"declarator": "_id",
"modifier": "private",
"original_string": "private String _id;",
"type": "String",
"var_name": "_id"
},
{
"declarator": "_rev",
"modifier": "private",
"original_string": "private String _rev;",
"type": "String",
"var_name": "_rev"
},
{
"declarator": "title",
"modifier": "private",
"original_string": "private String title;",
"type": "String",
"var_name": "title"
},
{
"declarator": "completed",
"modifier": "private",
"original_string": "private boolean completed;",
"type": "boolean",
"var_name": "completed"
},
{
"declarator": "order",
"modifier": "private",
"original_string": "private int order;",
"type": "int",
"var_name": "order"
}
],
"file": "java/bluemix-todo-app/src/main/java/net/bluemix/todo/model/CloudantToDo.java",
"identifier": "CloudantToDo",
"interfaces": "",
"methods": [
{
"class_method_signature": "CloudantToDo.CloudantToDo()",
"constructor": true,
"full_signature": "public CloudantToDo()",
"identifier": "CloudantToDo",
"modifiers": "public",
"parameters": "()",
"return": "",
"signature": " CloudantToDo()",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.CloudantToDo(ToDo td)",
"constructor": true,
"full_signature": "public CloudantToDo(ToDo td)",
"identifier": "CloudantToDo",
"modifiers": "public",
"parameters": "(ToDo td)",
"return": "",
"signature": " CloudantToDo(ToDo td)",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.get_id()",
"constructor": false,
"full_signature": "public String get_id()",
"identifier": "get_id",
"modifiers": "public",
"parameters": "()",
"return": "String",
"signature": "String get_id()",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.set_id(String _id)",
"constructor": false,
"full_signature": "public void set_id(String _id)",
"identifier": "set_id",
"modifiers": "public",
"parameters": "(String _id)",
"return": "void",
"signature": "void set_id(String _id)",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.get_rev()",
"constructor": false,
"full_signature": "public String get_rev()",
"identifier": "get_rev",
"modifiers": "public",
"parameters": "()",
"return": "String",
"signature": "String get_rev()",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.set_rev(String _rev)",
"constructor": false,
"full_signature": "public void set_rev(String _rev)",
"identifier": "set_rev",
"modifiers": "public",
"parameters": "(String _rev)",
"return": "void",
"signature": "void set_rev(String _rev)",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.getTitle()",
"constructor": false,
"full_signature": "public String getTitle()",
"identifier": "getTitle",
"modifiers": "public",
"parameters": "()",
"return": "String",
"signature": "String getTitle()",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.setTitle(String title)",
"constructor": false,
"full_signature": "public void setTitle(String title)",
"identifier": "setTitle",
"modifiers": "public",
"parameters": "(String title)",
"return": "void",
"signature": "void setTitle(String title)",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.isCompleted()",
"constructor": false,
"full_signature": "public boolean isCompleted()",
"identifier": "isCompleted",
"modifiers": "public",
"parameters": "()",
"return": "boolean",
"signature": "boolean isCompleted()",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.setCompleted(boolean completed)",
"constructor": false,
"full_signature": "public void setCompleted(boolean completed)",
"identifier": "setCompleted",
"modifiers": "public",
"parameters": "(boolean completed)",
"return": "void",
"signature": "void setCompleted(boolean completed)",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.getToDo()",
"constructor": false,
"full_signature": "public ToDo getToDo()",
"identifier": "getToDo",
"modifiers": "public",
"parameters": "()",
"return": "ToDo",
"signature": "ToDo getToDo()",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.getOrder()",
"constructor": false,
"full_signature": "public int getOrder()",
"identifier": "getOrder",
"modifiers": "public",
"parameters": "()",
"return": "int",
"signature": "int getOrder()",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.setOrder(int order)",
"constructor": false,
"full_signature": "public void setOrder(int order)",
"identifier": "setOrder",
"modifiers": "public",
"parameters": "(int order)",
"return": "void",
"signature": "void setOrder(int order)",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.equals(Object obj)",
"constructor": false,
"full_signature": "@Override public boolean equals(Object obj)",
"identifier": "equals",
"modifiers": "@Override public",
"parameters": "(Object obj)",
"return": "boolean",
"signature": "boolean equals(Object obj)",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.hashCode()",
"constructor": false,
"full_signature": "@Override public int hashCode()",
"identifier": "hashCode",
"modifiers": "@Override public",
"parameters": "()",
"return": "int",
"signature": "int hashCode()",
"testcase": false
}
],
"superclass": ""
} | {
"body": "public String get_id() {\n return _id;\n }",
"class_method_signature": "CloudantToDo.get_id()",
"constructor": false,
"full_signature": "public String get_id()",
"identifier": "get_id",
"invocations": [],
"modifiers": "public",
"parameters": "()",
"return": "String",
"signature": "String get_id()",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 305,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 19317653,
"size": 777,
"stargazer_count": 196,
"stars": null,
"updates": null,
"url": "https://github.com/IBM-Cloud/todo-apps"
} |
19317653_40 | {
"fields": [
{
"declarator": "td1",
"modifier": "",
"original_string": "ToDo td1;",
"type": "ToDo",
"var_name": "td1"
},
{
"declarator": "td2",
"modifier": "",
"original_string": "ToDo td2;",
"type": "ToDo",
"var_name": "td2"
},
{
"declarator": "emptyStore",
"modifier": "private",
"original_string": "private ToDoStore emptyStore;",
"type": "ToDoStore",
"var_name": "emptyStore"
},
{
"declarator": "populatedStore",
"modifier": "private",
"original_string": "private ToDoStore populatedStore;",
"type": "ToDoStore",
"var_name": "populatedStore"
}
],
"file": "java/bluemix-todo-app/src/test/java/net/bluemix/todo/store/InMemoryStoreTest.java",
"identifier": "InMemoryStoreTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n\tpublic void testGet() throws Exception {\n\t\tassertNull(emptyStore.get(\"123\"));\n\t\tassertNull(populatedStore.get(\"123\"));\n\t\tassertEquals(td1, populatedStore.get(td1.getId()));\n\t\tassertEquals(td2, populatedStore.get(td2.getId()));\n\t}",
"class_method_signature": "InMemoryStoreTest.testGet()",
"constructor": false,
"full_signature": "@Test public void testGet()",
"identifier": "testGet",
"invocations": [
"assertNull",
"get",
"assertNull",
"get",
"assertEquals",
"get",
"getId",
"assertEquals",
"get",
"getId"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void testGet()",
"testcase": true
} | {
"fields": [
{
"declarator": "store",
"modifier": "private",
"original_string": "private Map<String, ToDo> store;",
"type": "Map<String, ToDo>",
"var_name": "store"
}
],
"file": "java/bluemix-todo-app/src/main/java/net/bluemix/todo/store/InMemoryStore.java",
"identifier": "InMemoryStore",
"interfaces": "implements ToDoStore",
"methods": [
{
"class_method_signature": "InMemoryStore.InMemoryStore()",
"constructor": true,
"full_signature": "public InMemoryStore()",
"identifier": "InMemoryStore",
"modifiers": "public",
"parameters": "()",
"return": "",
"signature": " InMemoryStore()",
"testcase": false
},
{
"class_method_signature": "InMemoryStore.getAll()",
"constructor": false,
"full_signature": "@Override public Collection<ToDo> getAll()",
"identifier": "getAll",
"modifiers": "@Override public",
"parameters": "()",
"return": "Collection<ToDo>",
"signature": "Collection<ToDo> getAll()",
"testcase": false
},
{
"class_method_signature": "InMemoryStore.get(String id)",
"constructor": false,
"full_signature": "@Override public ToDo get(String id)",
"identifier": "get",
"modifiers": "@Override public",
"parameters": "(String id)",
"return": "ToDo",
"signature": "ToDo get(String id)",
"testcase": false
},
{
"class_method_signature": "InMemoryStore.persist(ToDo td)",
"constructor": false,
"full_signature": "@Override public ToDo persist(ToDo td)",
"identifier": "persist",
"modifiers": "@Override public",
"parameters": "(ToDo td)",
"return": "ToDo",
"signature": "ToDo persist(ToDo td)",
"testcase": false
},
{
"class_method_signature": "InMemoryStore.update(String id, ToDo td)",
"constructor": false,
"full_signature": "@Override public ToDo update(String id, ToDo td)",
"identifier": "update",
"modifiers": "@Override public",
"parameters": "(String id, ToDo td)",
"return": "ToDo",
"signature": "ToDo update(String id, ToDo td)",
"testcase": false
},
{
"class_method_signature": "InMemoryStore.delete(String id)",
"constructor": false,
"full_signature": "@Override public void delete(String id)",
"identifier": "delete",
"modifiers": "@Override public",
"parameters": "(String id)",
"return": "void",
"signature": "void delete(String id)",
"testcase": false
},
{
"class_method_signature": "InMemoryStore.count()",
"constructor": false,
"full_signature": "@Override public int count()",
"identifier": "count",
"modifiers": "@Override public",
"parameters": "()",
"return": "int",
"signature": "int count()",
"testcase": false
}
],
"superclass": ""
} | {
"body": "@Override\n public ToDo get(String id) {\n return store.get(id);\n }",
"class_method_signature": "InMemoryStore.get(String id)",
"constructor": false,
"full_signature": "@Override public ToDo get(String id)",
"identifier": "get",
"invocations": [
"get"
],
"modifiers": "@Override public",
"parameters": "(String id)",
"return": "ToDo",
"signature": "ToDo get(String id)",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 305,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 19317653,
"size": 777,
"stargazer_count": 196,
"stars": null,
"updates": null,
"url": "https://github.com/IBM-Cloud/todo-apps"
} |
19317653_56 | {
"fields": [
{
"declarator": "docs",
"modifier": "private",
"original_string": "private CloudantAllDocs docs;",
"type": "CloudantAllDocs",
"var_name": "docs"
},
{
"declarator": "rows",
"modifier": "private",
"original_string": "private List<CloudantRow> rows;",
"type": "List<CloudantRow>",
"var_name": "rows"
},
{
"declarator": "row1",
"modifier": "private",
"original_string": "private CloudantRow row1;",
"type": "CloudantRow",
"var_name": "row1"
},
{
"declarator": "row2",
"modifier": "private",
"original_string": "private CloudantRow row2;",
"type": "CloudantRow",
"var_name": "row2"
},
{
"declarator": "row3",
"modifier": "private",
"original_string": "private CloudantRow row3;",
"type": "CloudantRow",
"var_name": "row3"
},
{
"declarator": "ctd1",
"modifier": "private",
"original_string": "private CloudantToDo ctd1;",
"type": "CloudantToDo",
"var_name": "ctd1"
},
{
"declarator": "ctd2",
"modifier": "private",
"original_string": "private CloudantToDo ctd2;",
"type": "CloudantToDo",
"var_name": "ctd2"
},
{
"declarator": "ctd3",
"modifier": "private",
"original_string": "private CloudantToDo ctd3;",
"type": "CloudantToDo",
"var_name": "ctd3"
},
{
"declarator": "count",
"modifier": "private",
"original_string": "private CloudantCount count;",
"type": "CloudantCount",
"var_name": "count"
},
{
"declarator": "reducedRows",
"modifier": "private",
"original_string": "private List<CloudantReducedRow> reducedRows;",
"type": "List<CloudantReducedRow>",
"var_name": "reducedRows"
},
{
"declarator": "reducedRow",
"modifier": "private",
"original_string": "private CloudantReducedRow reducedRow;",
"type": "CloudantReducedRow",
"var_name": "reducedRow"
}
],
"file": "java/bluemix-todo-app/src/test/java/net/bluemix/todo/store/CloudantStoreTest.java",
"identifier": "CloudantStoreTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testCount() throws Exception {\n IMocksControl control = createControl();\n Response resp = control.createMock(Response.class);\n expect(resp.getStatus()).andReturn(200).times(3);\n Capture<Class<CloudantCount>> classCapture = new Capture<Class<CloudantCount>>();\n expect(resp.readEntity(capture(classCapture))).andReturn(count);\n replay(resp);\n WebTarget wt = createMockWebTarget();\n Invocation.Builder builder = createBuilder();\n expect(builder.get()).andReturn(resp).times(3);\n replay(builder);\n expect(wt.path(eq(\"bluemix-todo\"))).andReturn(wt).times(2);\n expect(wt.path(eq(\"todos\"))).andReturn(wt).times(2);\n expect(wt.path(eq(\"_design\"))).andReturn(wt).times(2);\n expect(wt.path(eq(\"_view\"))).andReturn(wt);\n expect(wt.path(eq(\"allTodos\"))).andReturn(wt);\n expect(wt.request(eq(\"application/json\"))).andReturn(builder).anyTimes();\n replay(wt);\n CloudantStore store = new CloudantStore(wt);\n assertEquals(123, store.count());\n assertEquals(CloudantCount.class, classCapture.getValue());\n verify(resp);\n verify(wt);\n verify(builder);\n }",
"class_method_signature": "CloudantStoreTest.testCount()",
"constructor": false,
"full_signature": "@Test public void testCount()",
"identifier": "testCount",
"invocations": [
"createControl",
"createMock",
"times",
"andReturn",
"expect",
"getStatus",
"andReturn",
"expect",
"readEntity",
"capture",
"replay",
"createMockWebTarget",
"createBuilder",
"times",
"andReturn",
"expect",
"get",
"replay",
"times",
"andReturn",
"expect",
"path",
"eq",
"times",
"andReturn",
"expect",
"path",
"eq",
"times",
"andReturn",
"expect",
"path",
"eq",
"andReturn",
"expect",
"path",
"eq",
"andReturn",
"expect",
"path",
"eq",
"anyTimes",
"andReturn",
"expect",
"request",
"eq",
"replay",
"assertEquals",
"count",
"assertEquals",
"getValue",
"verify",
"verify",
"verify"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void testCount()",
"testcase": true
} | {
"fields": [
{
"declarator": "REVISION_PARAM = \"rev\"",
"modifier": "private static final",
"original_string": "private static final String REVISION_PARAM = \"rev\";",
"type": "String",
"var_name": "REVISION_PARAM"
},
{
"declarator": "DESIGN_DOC_NAME = \"todos\"",
"modifier": "private static final",
"original_string": "private static final String DESIGN_DOC_NAME = \"todos\";",
"type": "String",
"var_name": "DESIGN_DOC_NAME"
},
{
"declarator": "VIEW_NAME = \"allTodos\"",
"modifier": "private static final",
"original_string": "private static final String VIEW_NAME = \"allTodos\";",
"type": "String",
"var_name": "VIEW_NAME"
},
{
"declarator": "DESIGN_DOC = \n \"{\" +\n \"\\\"views\\\": {\" +\n \"\\\"allTodos\\\": {\" +\n \"\\\"reduce\\\": \\\"_count\\\",\" +\n \"\\\"map\\\": \\\"function(doc){if(doc.title && doc.completed != null){emit(doc.order,{title: doc.title,completed: doc.completed})}}\\\"\" +\n \"}\" +\n \"}\" +\n \"}\"",
"modifier": "private static final",
"original_string": "private static final String DESIGN_DOC = \n \"{\" +\n \"\\\"views\\\": {\" +\n \"\\\"allTodos\\\": {\" +\n \"\\\"reduce\\\": \\\"_count\\\",\" +\n \"\\\"map\\\": \\\"function(doc){if(doc.title && doc.completed != null){emit(doc.order,{title: doc.title,completed: doc.completed})}}\\\"\" +\n \"}\" +\n \"}\" +\n \"}\";",
"type": "String",
"var_name": "DESIGN_DOC"
},
{
"declarator": "LOG = Logger.getLogger(CloudantStore.class.getName())",
"modifier": "private static final",
"original_string": "private static final Logger LOG = Logger.getLogger(CloudantStore.class.getName());",
"type": "Logger",
"var_name": "LOG"
},
{
"declarator": "target",
"modifier": "private",
"original_string": "private WebTarget target;",
"type": "WebTarget",
"var_name": "target"
}
],
"file": "java/bluemix-todo-app/src/main/java/net/bluemix/todo/store/CloudantStore.java",
"identifier": "CloudantStore",
"interfaces": "implements ToDoStore",
"methods": [
{
"class_method_signature": "CloudantStore.CloudantStore(WebTarget target)",
"constructor": true,
"full_signature": "public CloudantStore(WebTarget target)",
"identifier": "CloudantStore",
"modifiers": "public",
"parameters": "(WebTarget target)",
"return": "",
"signature": " CloudantStore(WebTarget target)",
"testcase": false
},
{
"class_method_signature": "CloudantStore.createDB(WebTarget target)",
"constructor": false,
"full_signature": "private void createDB(WebTarget target)",
"identifier": "createDB",
"modifiers": "private",
"parameters": "(WebTarget target)",
"return": "void",
"signature": "void createDB(WebTarget target)",
"testcase": false
},
{
"class_method_signature": "CloudantStore.createDesignDoc(WebTarget target)",
"constructor": false,
"full_signature": "private static void createDesignDoc(WebTarget target)",
"identifier": "createDesignDoc",
"modifiers": "private static",
"parameters": "(WebTarget target)",
"return": "void",
"signature": "void createDesignDoc(WebTarget target)",
"testcase": false
},
{
"class_method_signature": "CloudantStore.getAll()",
"constructor": false,
"full_signature": "@Override public Collection<ToDo> getAll()",
"identifier": "getAll",
"modifiers": "@Override public",
"parameters": "()",
"return": "Collection<ToDo>",
"signature": "Collection<ToDo> getAll()",
"testcase": false
},
{
"class_method_signature": "CloudantStore.get(String id)",
"constructor": false,
"full_signature": "@Override public ToDo get(String id)",
"identifier": "get",
"modifiers": "@Override public",
"parameters": "(String id)",
"return": "ToDo",
"signature": "ToDo get(String id)",
"testcase": false
},
{
"class_method_signature": "CloudantStore.getRequest(String id)",
"constructor": false,
"full_signature": "private Response getRequest(String id)",
"identifier": "getRequest",
"modifiers": "private",
"parameters": "(String id)",
"return": "Response",
"signature": "Response getRequest(String id)",
"testcase": false
},
{
"class_method_signature": "CloudantStore.persist(ToDo td)",
"constructor": false,
"full_signature": "@Override public ToDo persist(ToDo td)",
"identifier": "persist",
"modifiers": "@Override public",
"parameters": "(ToDo td)",
"return": "ToDo",
"signature": "ToDo persist(ToDo td)",
"testcase": false
},
{
"class_method_signature": "CloudantStore.update(String id, ToDo td)",
"constructor": false,
"full_signature": "@Override public ToDo update(String id, ToDo td)",
"identifier": "update",
"modifiers": "@Override public",
"parameters": "(String id, ToDo td)",
"return": "ToDo",
"signature": "ToDo update(String id, ToDo td)",
"testcase": false
},
{
"class_method_signature": "CloudantStore.delete(String id)",
"constructor": false,
"full_signature": "@Override public void delete(String id)",
"identifier": "delete",
"modifiers": "@Override public",
"parameters": "(String id)",
"return": "void",
"signature": "void delete(String id)",
"testcase": false
},
{
"class_method_signature": "CloudantStore.count()",
"constructor": false,
"full_signature": "@Override public int count()",
"identifier": "count",
"modifiers": "@Override public",
"parameters": "()",
"return": "int",
"signature": "int count()",
"testcase": false
}
],
"superclass": ""
} | {
"body": "@Override\n public int count() throws ToDoStoreException {\n Response allDocsResp = target.path(\"_design\").path(DESIGN_DOC_NAME).path(\"_view\").path(VIEW_NAME).\n request(MediaType.APPLICATION_JSON).get();\n int status = allDocsResp.getStatus();\n if(status == HttpURLConnection.HTTP_OK) {\n CloudantCount count = allDocsResp.readEntity(CloudantCount.class);\n if(count.getRows().size() > 0) {\n return count.getRows().get(0).getValue();\n } else {\n //No rows means there are no documents in the view.\n return 0;\n }\n } else {\n throw new ToDoStoreException(\"There was an error retrieving the tasks from Cloudant. Error \"\n + status);\n } \n }",
"class_method_signature": "CloudantStore.count()",
"constructor": false,
"full_signature": "@Override public int count()",
"identifier": "count",
"invocations": [
"get",
"request",
"path",
"path",
"path",
"path",
"getStatus",
"readEntity",
"size",
"getRows",
"getValue",
"get",
"getRows"
],
"modifiers": "@Override public",
"parameters": "()",
"return": "int",
"signature": "int count()",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 305,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 19317653,
"size": 777,
"stargazer_count": 196,
"stars": null,
"updates": null,
"url": "https://github.com/IBM-Cloud/todo-apps"
} |
19317653_38 | {
"fields": [],
"file": "java/bluemix-todo-app/src/test/java/net/bluemix/todo/model/CloudantCountTest.java",
"identifier": "CloudantCountTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testGetRows() {\n CloudantCount count = new CloudantCount();\n List<CloudantReducedRow> rows = new ArrayList<CloudantReducedRow>();\n CloudantReducedRow row = new CloudantReducedRow();\n row.setValue(123);\n rows.add(row);\n count.setRows(rows);\n assertEquals(rows, count.getRows());\n }",
"class_method_signature": "CloudantCountTest.testGetRows()",
"constructor": false,
"full_signature": "@Test public void testGetRows()",
"identifier": "testGetRows",
"invocations": [
"setValue",
"add",
"setRows",
"assertEquals",
"getRows"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void testGetRows()",
"testcase": true
} | {
"fields": [
{
"declarator": "rows",
"modifier": "private",
"original_string": "private List<CloudantReducedRow> rows;",
"type": "List<CloudantReducedRow>",
"var_name": "rows"
}
],
"file": "java/bluemix-todo-app/src/main/java/net/bluemix/todo/model/CloudantCount.java",
"identifier": "CloudantCount",
"interfaces": "",
"methods": [
{
"class_method_signature": "CloudantCount.getRows()",
"constructor": false,
"full_signature": "public List<CloudantReducedRow> getRows()",
"identifier": "getRows",
"modifiers": "public",
"parameters": "()",
"return": "List<CloudantReducedRow>",
"signature": "List<CloudantReducedRow> getRows()",
"testcase": false
},
{
"class_method_signature": "CloudantCount.setRows(List<CloudantReducedRow> rows)",
"constructor": false,
"full_signature": "public void setRows(List<CloudantReducedRow> rows)",
"identifier": "setRows",
"modifiers": "public",
"parameters": "(List<CloudantReducedRow> rows)",
"return": "void",
"signature": "void setRows(List<CloudantReducedRow> rows)",
"testcase": false
}
],
"superclass": ""
} | {
"body": "public List<CloudantReducedRow> getRows() {\n return rows;\n }",
"class_method_signature": "CloudantCount.getRows()",
"constructor": false,
"full_signature": "public List<CloudantReducedRow> getRows()",
"identifier": "getRows",
"invocations": [],
"modifiers": "public",
"parameters": "()",
"return": "List<CloudantReducedRow>",
"signature": "List<CloudantReducedRow> getRows()",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 305,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 19317653,
"size": 777,
"stargazer_count": 196,
"stars": null,
"updates": null,
"url": "https://github.com/IBM-Cloud/todo-apps"
} |
19317653_1 | {
"fields": [
{
"declarator": "td1",
"modifier": "private",
"original_string": "private ToDo td1;",
"type": "ToDo",
"var_name": "td1"
},
{
"declarator": "td2",
"modifier": "private",
"original_string": "private ToDo td2;",
"type": "ToDo",
"var_name": "td2"
},
{
"declarator": "store",
"modifier": "private",
"original_string": "private ToDoStore store;",
"type": "ToDoStore",
"var_name": "store"
},
{
"declarator": "api",
"modifier": "private",
"original_string": "private ToDoAPI api;",
"type": "ToDoAPI",
"var_name": "api"
},
{
"declarator": "exceptionStore = new ToDoStore(){\n\n\t\t@Override\n\t\tpublic Collection<ToDo> getAll() throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo get(String id) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo persist(ToDo td) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo update(String id, ToDo td) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic void delete(String id) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n @Override\n public int count() throws ToDoStoreException {\n throw new ToDoStoreException(\"Error\");\n }\n\t}",
"modifier": "private",
"original_string": "private ToDoStore exceptionStore = new ToDoStore(){\n\n\t\t@Override\n\t\tpublic Collection<ToDo> getAll() throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo get(String id) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo persist(ToDo td) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo update(String id, ToDo td) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic void delete(String id) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n @Override\n public int count() throws ToDoStoreException {\n throw new ToDoStoreException(\"Error\");\n }\n\t};",
"type": "ToDoStore",
"var_name": "exceptionStore"
},
{
"declarator": "errorApi",
"modifier": "private",
"original_string": "private ToDoAPI errorApi;",
"type": "ToDoAPI",
"var_name": "errorApi"
}
],
"file": "java/bluemix-todo-app/src/test/java/net/bluemix/todo/rest/ToDoAPITest.java",
"identifier": "ToDoAPITest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n\tpublic void testGetToDoBadRequest() {\n\t\ttry {\n\t\t\tapi.getToDo(null);\n\t\t\tfail(\"Expected exception to be thrown.\");\n\t\t} catch(WebApplicationException e) {\n\t\t\tassertEquals(Response.Status.BAD_REQUEST.getStatusCode(), e.getResponse().getStatus());\n\t\t}\n\t}",
"class_method_signature": "ToDoAPITest.testGetToDoBadRequest()",
"constructor": false,
"full_signature": "@Test public void testGetToDoBadRequest()",
"identifier": "testGetToDoBadRequest",
"invocations": [
"getToDo",
"fail",
"assertEquals",
"getStatusCode",
"getStatus",
"getResponse"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void testGetToDoBadRequest()",
"testcase": true
} | {
"fields": [
{
"declarator": "store",
"modifier": "private",
"original_string": "private ToDoStore store;",
"type": "ToDoStore",
"var_name": "store"
}
],
"file": "java/bluemix-todo-app/src/main/java/net/bluemix/todo/rest/ToDoAPI.java",
"identifier": "ToDoAPI",
"interfaces": "",
"methods": [
{
"class_method_signature": "ToDoAPI.ToDoAPI()",
"constructor": true,
"full_signature": "public ToDoAPI()",
"identifier": "ToDoAPI",
"modifiers": "public",
"parameters": "()",
"return": "",
"signature": " ToDoAPI()",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.ToDoAPI(ToDoStore store)",
"constructor": true,
"full_signature": "public ToDoAPI(ToDoStore store)",
"identifier": "ToDoAPI",
"modifiers": "public",
"parameters": "(ToDoStore store)",
"return": "",
"signature": " ToDoAPI(ToDoStore store)",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.getToDo(@PathParam(\"id\") String id)",
"constructor": false,
"full_signature": "@GET @Path(\"/{id}\") @Produces(\"application/json\") public ToDo getToDo(@PathParam(\"id\") String id)",
"identifier": "getToDo",
"modifiers": "@GET @Path(\"/{id}\") @Produces(\"application/json\") public",
"parameters": "(@PathParam(\"id\") String id)",
"return": "ToDo",
"signature": "ToDo getToDo(@PathParam(\"id\") String id)",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.getToDos()",
"constructor": false,
"full_signature": "@GET @Produces(\"application/json\") public Collection<ToDo> getToDos()",
"identifier": "getToDos",
"modifiers": "@GET @Produces(\"application/json\") public",
"parameters": "()",
"return": "Collection<ToDo>",
"signature": "Collection<ToDo> getToDos()",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.newToDo(ToDo td)",
"constructor": false,
"full_signature": "@POST @Consumes(\"application/json\") @Produces(\"application/json\") public ToDo newToDo(ToDo td)",
"identifier": "newToDo",
"modifiers": "@POST @Consumes(\"application/json\") @Produces(\"application/json\") public",
"parameters": "(ToDo td)",
"return": "ToDo",
"signature": "ToDo newToDo(ToDo td)",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.updateToDo(@PathParam(\"id\") String id, ToDo td)",
"constructor": false,
"full_signature": "@PUT @Path(\"/{id}\") @Produces(\"application/json\") @Consumes(\"application/json\") public ToDo updateToDo(@PathParam(\"id\") String id, ToDo td)",
"identifier": "updateToDo",
"modifiers": "@PUT @Path(\"/{id}\") @Produces(\"application/json\") @Consumes(\"application/json\") public",
"parameters": "(@PathParam(\"id\") String id, ToDo td)",
"return": "ToDo",
"signature": "ToDo updateToDo(@PathParam(\"id\") String id, ToDo td)",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.deleteToDo(@PathParam(\"id\") String id)",
"constructor": false,
"full_signature": "@DELETE @Path(\"/{id}\") public void deleteToDo(@PathParam(\"id\") String id)",
"identifier": "deleteToDo",
"modifiers": "@DELETE @Path(\"/{id}\") public",
"parameters": "(@PathParam(\"id\") String id)",
"return": "void",
"signature": "void deleteToDo(@PathParam(\"id\") String id)",
"testcase": false
}
],
"superclass": ""
} | {
"body": "@GET @Path(\"/{id}\")\n @Produces(\"application/json\")\n public ToDo getToDo(@PathParam(\"id\") String id) {\n if(id == null) {\n throw new WebApplicationException(\"Must supply an ID, for example /api/todos/123.\", \n Response.Status.BAD_REQUEST);\n }\n try {\n ToDo td = store.get(id);\n if(td == null) {\n throw new WebApplicationException(\"ToDo with the ID \" + id + \" does not exist.\",\n Response.Status.BAD_REQUEST);\n }\n return td;\n } catch (ToDoStoreException e) {\n throw new WebApplicationException(\"Error getting ToDo.\", Response.Status.INTERNAL_SERVER_ERROR);\n }\n }",
"class_method_signature": "ToDoAPI.getToDo(@PathParam(\"id\") String id)",
"constructor": false,
"full_signature": "@GET @Path(\"/{id}\") @Produces(\"application/json\") public ToDo getToDo(@PathParam(\"id\") String id)",
"identifier": "getToDo",
"invocations": [
"get"
],
"modifiers": "@GET @Path(\"/{id}\") @Produces(\"application/json\") public",
"parameters": "(@PathParam(\"id\") String id)",
"return": "ToDo",
"signature": "ToDo getToDo(@PathParam(\"id\") String id)",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 305,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 19317653,
"size": 777,
"stargazer_count": 196,
"stars": null,
"updates": null,
"url": "https://github.com/IBM-Cloud/todo-apps"
} |
19317653_14 | {
"fields": [
{
"declarator": "td1",
"modifier": "private",
"original_string": "private ToDo td1;",
"type": "ToDo",
"var_name": "td1"
},
{
"declarator": "td2",
"modifier": "private",
"original_string": "private ToDo td2;",
"type": "ToDo",
"var_name": "td2"
},
{
"declarator": "store",
"modifier": "private",
"original_string": "private ToDoStore store;",
"type": "ToDoStore",
"var_name": "store"
},
{
"declarator": "api",
"modifier": "private",
"original_string": "private ToDoAPI api;",
"type": "ToDoAPI",
"var_name": "api"
},
{
"declarator": "exceptionStore = new ToDoStore(){\n\n\t\t@Override\n\t\tpublic Collection<ToDo> getAll() throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo get(String id) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo persist(ToDo td) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo update(String id, ToDo td) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic void delete(String id) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n @Override\n public int count() throws ToDoStoreException {\n throw new ToDoStoreException(\"Error\");\n }\n\t}",
"modifier": "private",
"original_string": "private ToDoStore exceptionStore = new ToDoStore(){\n\n\t\t@Override\n\t\tpublic Collection<ToDo> getAll() throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo get(String id) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo persist(ToDo td) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo update(String id, ToDo td) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic void delete(String id) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n @Override\n public int count() throws ToDoStoreException {\n throw new ToDoStoreException(\"Error\");\n }\n\t};",
"type": "ToDoStore",
"var_name": "exceptionStore"
},
{
"declarator": "errorApi",
"modifier": "private",
"original_string": "private ToDoAPI errorApi;",
"type": "ToDoAPI",
"var_name": "errorApi"
}
],
"file": "java/bluemix-todo-app/src/test/java/net/bluemix/todo/rest/ToDoAPITest.java",
"identifier": "ToDoAPITest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n\tpublic void testDeleteToDo() {\n\t\tapi.deleteToDo(td1.getId());\n\t\tCollection<ToDo> todos = api.getToDos();\n\t\tassertTrue(todos.contains(td2));\n\t\tassertEquals(1, todos.size());\t\n\t}",
"class_method_signature": "ToDoAPITest.testDeleteToDo()",
"constructor": false,
"full_signature": "@Test public void testDeleteToDo()",
"identifier": "testDeleteToDo",
"invocations": [
"deleteToDo",
"getId",
"getToDos",
"assertTrue",
"contains",
"assertEquals",
"size"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void testDeleteToDo()",
"testcase": true
} | {
"fields": [
{
"declarator": "store",
"modifier": "private",
"original_string": "private ToDoStore store;",
"type": "ToDoStore",
"var_name": "store"
}
],
"file": "java/bluemix-todo-app/src/main/java/net/bluemix/todo/rest/ToDoAPI.java",
"identifier": "ToDoAPI",
"interfaces": "",
"methods": [
{
"class_method_signature": "ToDoAPI.ToDoAPI()",
"constructor": true,
"full_signature": "public ToDoAPI()",
"identifier": "ToDoAPI",
"modifiers": "public",
"parameters": "()",
"return": "",
"signature": " ToDoAPI()",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.ToDoAPI(ToDoStore store)",
"constructor": true,
"full_signature": "public ToDoAPI(ToDoStore store)",
"identifier": "ToDoAPI",
"modifiers": "public",
"parameters": "(ToDoStore store)",
"return": "",
"signature": " ToDoAPI(ToDoStore store)",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.getToDo(@PathParam(\"id\") String id)",
"constructor": false,
"full_signature": "@GET @Path(\"/{id}\") @Produces(\"application/json\") public ToDo getToDo(@PathParam(\"id\") String id)",
"identifier": "getToDo",
"modifiers": "@GET @Path(\"/{id}\") @Produces(\"application/json\") public",
"parameters": "(@PathParam(\"id\") String id)",
"return": "ToDo",
"signature": "ToDo getToDo(@PathParam(\"id\") String id)",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.getToDos()",
"constructor": false,
"full_signature": "@GET @Produces(\"application/json\") public Collection<ToDo> getToDos()",
"identifier": "getToDos",
"modifiers": "@GET @Produces(\"application/json\") public",
"parameters": "()",
"return": "Collection<ToDo>",
"signature": "Collection<ToDo> getToDos()",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.newToDo(ToDo td)",
"constructor": false,
"full_signature": "@POST @Consumes(\"application/json\") @Produces(\"application/json\") public ToDo newToDo(ToDo td)",
"identifier": "newToDo",
"modifiers": "@POST @Consumes(\"application/json\") @Produces(\"application/json\") public",
"parameters": "(ToDo td)",
"return": "ToDo",
"signature": "ToDo newToDo(ToDo td)",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.updateToDo(@PathParam(\"id\") String id, ToDo td)",
"constructor": false,
"full_signature": "@PUT @Path(\"/{id}\") @Produces(\"application/json\") @Consumes(\"application/json\") public ToDo updateToDo(@PathParam(\"id\") String id, ToDo td)",
"identifier": "updateToDo",
"modifiers": "@PUT @Path(\"/{id}\") @Produces(\"application/json\") @Consumes(\"application/json\") public",
"parameters": "(@PathParam(\"id\") String id, ToDo td)",
"return": "ToDo",
"signature": "ToDo updateToDo(@PathParam(\"id\") String id, ToDo td)",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.deleteToDo(@PathParam(\"id\") String id)",
"constructor": false,
"full_signature": "@DELETE @Path(\"/{id}\") public void deleteToDo(@PathParam(\"id\") String id)",
"identifier": "deleteToDo",
"modifiers": "@DELETE @Path(\"/{id}\") public",
"parameters": "(@PathParam(\"id\") String id)",
"return": "void",
"signature": "void deleteToDo(@PathParam(\"id\") String id)",
"testcase": false
}
],
"superclass": ""
} | {
"body": "@DELETE @Path(\"/{id}\")\n public void deleteToDo(@PathParam(\"id\") String id) {\n if(id == null) {\n throw new WebApplicationException(\"Must supply an ID, for example /api/todos/123,\",\n Response.Status.BAD_REQUEST);\n }\n try {\n store.delete(id);\n } catch (ToDoStoreException e) {\n throw new WebApplicationException(\"Error deleting ToDo.\", Response.Status.INTERNAL_SERVER_ERROR);\n }\n }",
"class_method_signature": "ToDoAPI.deleteToDo(@PathParam(\"id\") String id)",
"constructor": false,
"full_signature": "@DELETE @Path(\"/{id}\") public void deleteToDo(@PathParam(\"id\") String id)",
"identifier": "deleteToDo",
"invocations": [
"delete"
],
"modifiers": "@DELETE @Path(\"/{id}\") public",
"parameters": "(@PathParam(\"id\") String id)",
"return": "void",
"signature": "void deleteToDo(@PathParam(\"id\") String id)",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 305,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 19317653,
"size": 777,
"stargazer_count": 196,
"stars": null,
"updates": null,
"url": "https://github.com/IBM-Cloud/todo-apps"
} |
19317653_43 | {
"fields": [
{
"declarator": "td1",
"modifier": "",
"original_string": "ToDo td1;",
"type": "ToDo",
"var_name": "td1"
},
{
"declarator": "td2",
"modifier": "",
"original_string": "ToDo td2;",
"type": "ToDo",
"var_name": "td2"
},
{
"declarator": "emptyStore",
"modifier": "private",
"original_string": "private ToDoStore emptyStore;",
"type": "ToDoStore",
"var_name": "emptyStore"
},
{
"declarator": "populatedStore",
"modifier": "private",
"original_string": "private ToDoStore populatedStore;",
"type": "ToDoStore",
"var_name": "populatedStore"
}
],
"file": "java/bluemix-todo-app/src/test/java/net/bluemix/todo/store/InMemoryStoreTest.java",
"identifier": "InMemoryStoreTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n\tpublic void testDelete() throws Exception {\n\t\temptyStore.delete(\"123\");\n\t\tpopulatedStore.delete(td1.getId());\n\t\tassertNull(populatedStore.get(td1.getId()));\n\t}",
"class_method_signature": "InMemoryStoreTest.testDelete()",
"constructor": false,
"full_signature": "@Test public void testDelete()",
"identifier": "testDelete",
"invocations": [
"delete",
"delete",
"getId",
"assertNull",
"get",
"getId"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void testDelete()",
"testcase": true
} | {
"fields": [
{
"declarator": "store",
"modifier": "private",
"original_string": "private Map<String, ToDo> store;",
"type": "Map<String, ToDo>",
"var_name": "store"
}
],
"file": "java/bluemix-todo-app/src/main/java/net/bluemix/todo/store/InMemoryStore.java",
"identifier": "InMemoryStore",
"interfaces": "implements ToDoStore",
"methods": [
{
"class_method_signature": "InMemoryStore.InMemoryStore()",
"constructor": true,
"full_signature": "public InMemoryStore()",
"identifier": "InMemoryStore",
"modifiers": "public",
"parameters": "()",
"return": "",
"signature": " InMemoryStore()",
"testcase": false
},
{
"class_method_signature": "InMemoryStore.getAll()",
"constructor": false,
"full_signature": "@Override public Collection<ToDo> getAll()",
"identifier": "getAll",
"modifiers": "@Override public",
"parameters": "()",
"return": "Collection<ToDo>",
"signature": "Collection<ToDo> getAll()",
"testcase": false
},
{
"class_method_signature": "InMemoryStore.get(String id)",
"constructor": false,
"full_signature": "@Override public ToDo get(String id)",
"identifier": "get",
"modifiers": "@Override public",
"parameters": "(String id)",
"return": "ToDo",
"signature": "ToDo get(String id)",
"testcase": false
},
{
"class_method_signature": "InMemoryStore.persist(ToDo td)",
"constructor": false,
"full_signature": "@Override public ToDo persist(ToDo td)",
"identifier": "persist",
"modifiers": "@Override public",
"parameters": "(ToDo td)",
"return": "ToDo",
"signature": "ToDo persist(ToDo td)",
"testcase": false
},
{
"class_method_signature": "InMemoryStore.update(String id, ToDo td)",
"constructor": false,
"full_signature": "@Override public ToDo update(String id, ToDo td)",
"identifier": "update",
"modifiers": "@Override public",
"parameters": "(String id, ToDo td)",
"return": "ToDo",
"signature": "ToDo update(String id, ToDo td)",
"testcase": false
},
{
"class_method_signature": "InMemoryStore.delete(String id)",
"constructor": false,
"full_signature": "@Override public void delete(String id)",
"identifier": "delete",
"modifiers": "@Override public",
"parameters": "(String id)",
"return": "void",
"signature": "void delete(String id)",
"testcase": false
},
{
"class_method_signature": "InMemoryStore.count()",
"constructor": false,
"full_signature": "@Override public int count()",
"identifier": "count",
"modifiers": "@Override public",
"parameters": "()",
"return": "int",
"signature": "int count()",
"testcase": false
}
],
"superclass": ""
} | {
"body": "@Override\n public void delete(String id) {\n synchronized(store) {\n store.remove(id);\n }\n }",
"class_method_signature": "InMemoryStore.delete(String id)",
"constructor": false,
"full_signature": "@Override public void delete(String id)",
"identifier": "delete",
"invocations": [
"remove"
],
"modifiers": "@Override public",
"parameters": "(String id)",
"return": "void",
"signature": "void delete(String id)",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 305,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 19317653,
"size": 777,
"stargazer_count": 196,
"stars": null,
"updates": null,
"url": "https://github.com/IBM-Cloud/todo-apps"
} |
19317653_55 | {
"fields": [
{
"declarator": "docs",
"modifier": "private",
"original_string": "private CloudantAllDocs docs;",
"type": "CloudantAllDocs",
"var_name": "docs"
},
{
"declarator": "rows",
"modifier": "private",
"original_string": "private List<CloudantRow> rows;",
"type": "List<CloudantRow>",
"var_name": "rows"
},
{
"declarator": "row1",
"modifier": "private",
"original_string": "private CloudantRow row1;",
"type": "CloudantRow",
"var_name": "row1"
},
{
"declarator": "row2",
"modifier": "private",
"original_string": "private CloudantRow row2;",
"type": "CloudantRow",
"var_name": "row2"
},
{
"declarator": "row3",
"modifier": "private",
"original_string": "private CloudantRow row3;",
"type": "CloudantRow",
"var_name": "row3"
},
{
"declarator": "ctd1",
"modifier": "private",
"original_string": "private CloudantToDo ctd1;",
"type": "CloudantToDo",
"var_name": "ctd1"
},
{
"declarator": "ctd2",
"modifier": "private",
"original_string": "private CloudantToDo ctd2;",
"type": "CloudantToDo",
"var_name": "ctd2"
},
{
"declarator": "ctd3",
"modifier": "private",
"original_string": "private CloudantToDo ctd3;",
"type": "CloudantToDo",
"var_name": "ctd3"
},
{
"declarator": "count",
"modifier": "private",
"original_string": "private CloudantCount count;",
"type": "CloudantCount",
"var_name": "count"
},
{
"declarator": "reducedRows",
"modifier": "private",
"original_string": "private List<CloudantReducedRow> reducedRows;",
"type": "List<CloudantReducedRow>",
"var_name": "reducedRows"
},
{
"declarator": "reducedRow",
"modifier": "private",
"original_string": "private CloudantReducedRow reducedRow;",
"type": "CloudantReducedRow",
"var_name": "reducedRow"
}
],
"file": "java/bluemix-todo-app/src/test/java/net/bluemix/todo/store/CloudantStoreTest.java",
"identifier": "CloudantStoreTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testDelete() throws Exception {\n IMocksControl control = createControl();\n Response resp = control.createMock(Response.class);\n expect(resp.getStatus()).andReturn(200).times(4);\n Capture<Class<CloudantToDo>> classCapture = new Capture<Class<CloudantToDo>>();\n expect(resp.readEntity(capture(classCapture))).andReturn(ctd1);\n replay(resp);\n WebTarget wt = createMockWebTarget();\n Invocation.Builder builder = createBuilder();\n expect(builder.get()).andReturn(resp).times(3);\n expect(builder.delete()).andReturn(resp);\n replay(builder);\n expect(wt.path(eq(\"bluemix-todo\"))).andReturn(wt).times(2);\n expect(wt.path(eq(\"todos\"))).andReturn(wt);\n expect(wt.path(eq(\"_design\"))).andReturn(wt).times(1);\n expect(wt.queryParam(eq(\"rev\"), eq(\"abc\"))).andReturn(wt);\n expect(wt.path(eq(\"123\"))).andReturn(wt).times(2);\n expect(wt.request(eq(\"application/json\"))).andReturn(builder).times(4);\n replay(wt);\n CloudantStore store = new CloudantStore(wt);\n store.delete(\"123\");\n assertEquals(CloudantToDo.class, classCapture.getValue());\n verify(resp);\n verify(wt);\n verify(builder);\n }",
"class_method_signature": "CloudantStoreTest.testDelete()",
"constructor": false,
"full_signature": "@Test public void testDelete()",
"identifier": "testDelete",
"invocations": [
"createControl",
"createMock",
"times",
"andReturn",
"expect",
"getStatus",
"andReturn",
"expect",
"readEntity",
"capture",
"replay",
"createMockWebTarget",
"createBuilder",
"times",
"andReturn",
"expect",
"get",
"andReturn",
"expect",
"delete",
"replay",
"times",
"andReturn",
"expect",
"path",
"eq",
"andReturn",
"expect",
"path",
"eq",
"times",
"andReturn",
"expect",
"path",
"eq",
"andReturn",
"expect",
"queryParam",
"eq",
"eq",
"times",
"andReturn",
"expect",
"path",
"eq",
"times",
"andReturn",
"expect",
"request",
"eq",
"replay",
"delete",
"assertEquals",
"getValue",
"verify",
"verify",
"verify"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void testDelete()",
"testcase": true
} | {
"fields": [
{
"declarator": "REVISION_PARAM = \"rev\"",
"modifier": "private static final",
"original_string": "private static final String REVISION_PARAM = \"rev\";",
"type": "String",
"var_name": "REVISION_PARAM"
},
{
"declarator": "DESIGN_DOC_NAME = \"todos\"",
"modifier": "private static final",
"original_string": "private static final String DESIGN_DOC_NAME = \"todos\";",
"type": "String",
"var_name": "DESIGN_DOC_NAME"
},
{
"declarator": "VIEW_NAME = \"allTodos\"",
"modifier": "private static final",
"original_string": "private static final String VIEW_NAME = \"allTodos\";",
"type": "String",
"var_name": "VIEW_NAME"
},
{
"declarator": "DESIGN_DOC = \n \"{\" +\n \"\\\"views\\\": {\" +\n \"\\\"allTodos\\\": {\" +\n \"\\\"reduce\\\": \\\"_count\\\",\" +\n \"\\\"map\\\": \\\"function(doc){if(doc.title && doc.completed != null){emit(doc.order,{title: doc.title,completed: doc.completed})}}\\\"\" +\n \"}\" +\n \"}\" +\n \"}\"",
"modifier": "private static final",
"original_string": "private static final String DESIGN_DOC = \n \"{\" +\n \"\\\"views\\\": {\" +\n \"\\\"allTodos\\\": {\" +\n \"\\\"reduce\\\": \\\"_count\\\",\" +\n \"\\\"map\\\": \\\"function(doc){if(doc.title && doc.completed != null){emit(doc.order,{title: doc.title,completed: doc.completed})}}\\\"\" +\n \"}\" +\n \"}\" +\n \"}\";",
"type": "String",
"var_name": "DESIGN_DOC"
},
{
"declarator": "LOG = Logger.getLogger(CloudantStore.class.getName())",
"modifier": "private static final",
"original_string": "private static final Logger LOG = Logger.getLogger(CloudantStore.class.getName());",
"type": "Logger",
"var_name": "LOG"
},
{
"declarator": "target",
"modifier": "private",
"original_string": "private WebTarget target;",
"type": "WebTarget",
"var_name": "target"
}
],
"file": "java/bluemix-todo-app/src/main/java/net/bluemix/todo/store/CloudantStore.java",
"identifier": "CloudantStore",
"interfaces": "implements ToDoStore",
"methods": [
{
"class_method_signature": "CloudantStore.CloudantStore(WebTarget target)",
"constructor": true,
"full_signature": "public CloudantStore(WebTarget target)",
"identifier": "CloudantStore",
"modifiers": "public",
"parameters": "(WebTarget target)",
"return": "",
"signature": " CloudantStore(WebTarget target)",
"testcase": false
},
{
"class_method_signature": "CloudantStore.createDB(WebTarget target)",
"constructor": false,
"full_signature": "private void createDB(WebTarget target)",
"identifier": "createDB",
"modifiers": "private",
"parameters": "(WebTarget target)",
"return": "void",
"signature": "void createDB(WebTarget target)",
"testcase": false
},
{
"class_method_signature": "CloudantStore.createDesignDoc(WebTarget target)",
"constructor": false,
"full_signature": "private static void createDesignDoc(WebTarget target)",
"identifier": "createDesignDoc",
"modifiers": "private static",
"parameters": "(WebTarget target)",
"return": "void",
"signature": "void createDesignDoc(WebTarget target)",
"testcase": false
},
{
"class_method_signature": "CloudantStore.getAll()",
"constructor": false,
"full_signature": "@Override public Collection<ToDo> getAll()",
"identifier": "getAll",
"modifiers": "@Override public",
"parameters": "()",
"return": "Collection<ToDo>",
"signature": "Collection<ToDo> getAll()",
"testcase": false
},
{
"class_method_signature": "CloudantStore.get(String id)",
"constructor": false,
"full_signature": "@Override public ToDo get(String id)",
"identifier": "get",
"modifiers": "@Override public",
"parameters": "(String id)",
"return": "ToDo",
"signature": "ToDo get(String id)",
"testcase": false
},
{
"class_method_signature": "CloudantStore.getRequest(String id)",
"constructor": false,
"full_signature": "private Response getRequest(String id)",
"identifier": "getRequest",
"modifiers": "private",
"parameters": "(String id)",
"return": "Response",
"signature": "Response getRequest(String id)",
"testcase": false
},
{
"class_method_signature": "CloudantStore.persist(ToDo td)",
"constructor": false,
"full_signature": "@Override public ToDo persist(ToDo td)",
"identifier": "persist",
"modifiers": "@Override public",
"parameters": "(ToDo td)",
"return": "ToDo",
"signature": "ToDo persist(ToDo td)",
"testcase": false
},
{
"class_method_signature": "CloudantStore.update(String id, ToDo td)",
"constructor": false,
"full_signature": "@Override public ToDo update(String id, ToDo td)",
"identifier": "update",
"modifiers": "@Override public",
"parameters": "(String id, ToDo td)",
"return": "ToDo",
"signature": "ToDo update(String id, ToDo td)",
"testcase": false
},
{
"class_method_signature": "CloudantStore.delete(String id)",
"constructor": false,
"full_signature": "@Override public void delete(String id)",
"identifier": "delete",
"modifiers": "@Override public",
"parameters": "(String id)",
"return": "void",
"signature": "void delete(String id)",
"testcase": false
},
{
"class_method_signature": "CloudantStore.count()",
"constructor": false,
"full_signature": "@Override public int count()",
"identifier": "count",
"modifiers": "@Override public",
"parameters": "()",
"return": "int",
"signature": "int count()",
"testcase": false
}
],
"superclass": ""
} | {
"body": "@Override\n public void delete(String id) throws ToDoStoreException {\n Response docResp = getRequest(id);\n int status = docResp.getStatus();\n if(status == HttpURLConnection.HTTP_OK) {\n CloudantToDo ctd = docResp.readEntity(CloudantToDo.class);\n Response updateReq = target.queryParam(REVISION_PARAM, ctd.get_rev()).path(id).\n request(MediaType.APPLICATION_JSON).delete();\n status = updateReq.getStatus();\n if(status != HttpURLConnection.HTTP_OK) {\n throw new ToDoStoreException(\"There was an error deleting the ToDo from Cloudant. Error \"\n + status);\n }\n } else {\n throw new ToDoStoreException(\"There was an error getting the ToDo from Cloudant. Error \" + status);\n }\n }",
"class_method_signature": "CloudantStore.delete(String id)",
"constructor": false,
"full_signature": "@Override public void delete(String id)",
"identifier": "delete",
"invocations": [
"getRequest",
"getStatus",
"readEntity",
"delete",
"request",
"path",
"queryParam",
"get_rev",
"getStatus"
],
"modifiers": "@Override public",
"parameters": "(String id)",
"return": "void",
"signature": "void delete(String id)",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 305,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 19317653,
"size": 777,
"stargazer_count": 196,
"stars": null,
"updates": null,
"url": "https://github.com/IBM-Cloud/todo-apps"
} |
19317653_22 | {
"fields": [
{
"declarator": "td",
"modifier": "private",
"original_string": "private ToDo td;",
"type": "ToDo",
"var_name": "td"
}
],
"file": "java/bluemix-todo-app/src/test/java/net/bluemix/todo/model/CloudantToDoTest.java",
"identifier": "CloudantToDoTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testGetOrder() {\n CloudantToDo ctd = new CloudantToDo();\n ctd.setOrder(1);\n assertEquals(1, ctd.getOrder());\n }",
"class_method_signature": "CloudantToDoTest.testGetOrder()",
"constructor": false,
"full_signature": "@Test public void testGetOrder()",
"identifier": "testGetOrder",
"invocations": [
"setOrder",
"assertEquals",
"getOrder"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void testGetOrder()",
"testcase": true
} | {
"fields": [
{
"declarator": "_id",
"modifier": "private",
"original_string": "private String _id;",
"type": "String",
"var_name": "_id"
},
{
"declarator": "_rev",
"modifier": "private",
"original_string": "private String _rev;",
"type": "String",
"var_name": "_rev"
},
{
"declarator": "title",
"modifier": "private",
"original_string": "private String title;",
"type": "String",
"var_name": "title"
},
{
"declarator": "completed",
"modifier": "private",
"original_string": "private boolean completed;",
"type": "boolean",
"var_name": "completed"
},
{
"declarator": "order",
"modifier": "private",
"original_string": "private int order;",
"type": "int",
"var_name": "order"
}
],
"file": "java/bluemix-todo-app/src/main/java/net/bluemix/todo/model/CloudantToDo.java",
"identifier": "CloudantToDo",
"interfaces": "",
"methods": [
{
"class_method_signature": "CloudantToDo.CloudantToDo()",
"constructor": true,
"full_signature": "public CloudantToDo()",
"identifier": "CloudantToDo",
"modifiers": "public",
"parameters": "()",
"return": "",
"signature": " CloudantToDo()",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.CloudantToDo(ToDo td)",
"constructor": true,
"full_signature": "public CloudantToDo(ToDo td)",
"identifier": "CloudantToDo",
"modifiers": "public",
"parameters": "(ToDo td)",
"return": "",
"signature": " CloudantToDo(ToDo td)",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.get_id()",
"constructor": false,
"full_signature": "public String get_id()",
"identifier": "get_id",
"modifiers": "public",
"parameters": "()",
"return": "String",
"signature": "String get_id()",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.set_id(String _id)",
"constructor": false,
"full_signature": "public void set_id(String _id)",
"identifier": "set_id",
"modifiers": "public",
"parameters": "(String _id)",
"return": "void",
"signature": "void set_id(String _id)",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.get_rev()",
"constructor": false,
"full_signature": "public String get_rev()",
"identifier": "get_rev",
"modifiers": "public",
"parameters": "()",
"return": "String",
"signature": "String get_rev()",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.set_rev(String _rev)",
"constructor": false,
"full_signature": "public void set_rev(String _rev)",
"identifier": "set_rev",
"modifiers": "public",
"parameters": "(String _rev)",
"return": "void",
"signature": "void set_rev(String _rev)",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.getTitle()",
"constructor": false,
"full_signature": "public String getTitle()",
"identifier": "getTitle",
"modifiers": "public",
"parameters": "()",
"return": "String",
"signature": "String getTitle()",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.setTitle(String title)",
"constructor": false,
"full_signature": "public void setTitle(String title)",
"identifier": "setTitle",
"modifiers": "public",
"parameters": "(String title)",
"return": "void",
"signature": "void setTitle(String title)",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.isCompleted()",
"constructor": false,
"full_signature": "public boolean isCompleted()",
"identifier": "isCompleted",
"modifiers": "public",
"parameters": "()",
"return": "boolean",
"signature": "boolean isCompleted()",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.setCompleted(boolean completed)",
"constructor": false,
"full_signature": "public void setCompleted(boolean completed)",
"identifier": "setCompleted",
"modifiers": "public",
"parameters": "(boolean completed)",
"return": "void",
"signature": "void setCompleted(boolean completed)",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.getToDo()",
"constructor": false,
"full_signature": "public ToDo getToDo()",
"identifier": "getToDo",
"modifiers": "public",
"parameters": "()",
"return": "ToDo",
"signature": "ToDo getToDo()",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.getOrder()",
"constructor": false,
"full_signature": "public int getOrder()",
"identifier": "getOrder",
"modifiers": "public",
"parameters": "()",
"return": "int",
"signature": "int getOrder()",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.setOrder(int order)",
"constructor": false,
"full_signature": "public void setOrder(int order)",
"identifier": "setOrder",
"modifiers": "public",
"parameters": "(int order)",
"return": "void",
"signature": "void setOrder(int order)",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.equals(Object obj)",
"constructor": false,
"full_signature": "@Override public boolean equals(Object obj)",
"identifier": "equals",
"modifiers": "@Override public",
"parameters": "(Object obj)",
"return": "boolean",
"signature": "boolean equals(Object obj)",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.hashCode()",
"constructor": false,
"full_signature": "@Override public int hashCode()",
"identifier": "hashCode",
"modifiers": "@Override public",
"parameters": "()",
"return": "int",
"signature": "int hashCode()",
"testcase": false
}
],
"superclass": ""
} | {
"body": "public int getOrder() {\n return order;\n }",
"class_method_signature": "CloudantToDo.getOrder()",
"constructor": false,
"full_signature": "public int getOrder()",
"identifier": "getOrder",
"invocations": [],
"modifiers": "public",
"parameters": "()",
"return": "int",
"signature": "int getOrder()",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 305,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 19317653,
"size": 777,
"stargazer_count": 196,
"stars": null,
"updates": null,
"url": "https://github.com/IBM-Cloud/todo-apps"
} |
19317653_34 | {
"fields": [
{
"declarator": "ctd",
"modifier": "private",
"original_string": "private CloudantToDo ctd;",
"type": "CloudantToDo",
"var_name": "ctd"
}
],
"file": "java/bluemix-todo-app/src/test/java/net/bluemix/todo/model/CloudantRowTest.java",
"identifier": "CloudantRowTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testGetDoc() {\n CloudantRow row = new CloudantRow();\n row.setDoc(ctd);\n assertEquals(ctd, row.getDoc());\n }",
"class_method_signature": "CloudantRowTest.testGetDoc()",
"constructor": false,
"full_signature": "@Test public void testGetDoc()",
"identifier": "testGetDoc",
"invocations": [
"setDoc",
"assertEquals",
"getDoc"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void testGetDoc()",
"testcase": true
} | {
"fields": [
{
"declarator": "id",
"modifier": "private",
"original_string": "private String id;",
"type": "String",
"var_name": "id"
},
{
"declarator": "key",
"modifier": "private",
"original_string": "private int key;",
"type": "int",
"var_name": "key"
},
{
"declarator": "doc",
"modifier": "private",
"original_string": "private CloudantToDo doc;",
"type": "CloudantToDo",
"var_name": "doc"
},
{
"declarator": "value",
"modifier": "private",
"original_string": "private ToDo value;",
"type": "ToDo",
"var_name": "value"
}
],
"file": "java/bluemix-todo-app/src/main/java/net/bluemix/todo/model/CloudantRow.java",
"identifier": "CloudantRow",
"interfaces": "",
"methods": [
{
"class_method_signature": "CloudantRow.getValue()",
"constructor": false,
"full_signature": "public ToDo getValue()",
"identifier": "getValue",
"modifiers": "public",
"parameters": "()",
"return": "ToDo",
"signature": "ToDo getValue()",
"testcase": false
},
{
"class_method_signature": "CloudantRow.setValue(ToDo value)",
"constructor": false,
"full_signature": "public void setValue(ToDo value)",
"identifier": "setValue",
"modifiers": "public",
"parameters": "(ToDo value)",
"return": "void",
"signature": "void setValue(ToDo value)",
"testcase": false
},
{
"class_method_signature": "CloudantRow.getKey()",
"constructor": false,
"full_signature": "public int getKey()",
"identifier": "getKey",
"modifiers": "public",
"parameters": "()",
"return": "int",
"signature": "int getKey()",
"testcase": false
},
{
"class_method_signature": "CloudantRow.setKey(int key)",
"constructor": false,
"full_signature": "public void setKey(int key)",
"identifier": "setKey",
"modifiers": "public",
"parameters": "(int key)",
"return": "void",
"signature": "void setKey(int key)",
"testcase": false
},
{
"class_method_signature": "CloudantRow.getId()",
"constructor": false,
"full_signature": "public String getId()",
"identifier": "getId",
"modifiers": "public",
"parameters": "()",
"return": "String",
"signature": "String getId()",
"testcase": false
},
{
"class_method_signature": "CloudantRow.setId(String id)",
"constructor": false,
"full_signature": "public void setId(String id)",
"identifier": "setId",
"modifiers": "public",
"parameters": "(String id)",
"return": "void",
"signature": "void setId(String id)",
"testcase": false
},
{
"class_method_signature": "CloudantRow.getDoc()",
"constructor": false,
"full_signature": "public CloudantToDo getDoc()",
"identifier": "getDoc",
"modifiers": "public",
"parameters": "()",
"return": "CloudantToDo",
"signature": "CloudantToDo getDoc()",
"testcase": false
},
{
"class_method_signature": "CloudantRow.setDoc(CloudantToDo doc)",
"constructor": false,
"full_signature": "public void setDoc(CloudantToDo doc)",
"identifier": "setDoc",
"modifiers": "public",
"parameters": "(CloudantToDo doc)",
"return": "void",
"signature": "void setDoc(CloudantToDo doc)",
"testcase": false
}
],
"superclass": ""
} | {
"body": "public CloudantToDo getDoc() {\n return doc;\n }",
"class_method_signature": "CloudantRow.getDoc()",
"constructor": false,
"full_signature": "public CloudantToDo getDoc()",
"identifier": "getDoc",
"invocations": [],
"modifiers": "public",
"parameters": "()",
"return": "CloudantToDo",
"signature": "CloudantToDo getDoc()",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 305,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 19317653,
"size": 777,
"stargazer_count": 196,
"stars": null,
"updates": null,
"url": "https://github.com/IBM-Cloud/todo-apps"
} |
19317653_18 | {
"fields": [
{
"declarator": "td",
"modifier": "private",
"original_string": "private ToDo td;",
"type": "ToDo",
"var_name": "td"
}
],
"file": "java/bluemix-todo-app/src/test/java/net/bluemix/todo/model/CloudantToDoTest.java",
"identifier": "CloudantToDoTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testGet_rev() {\n CloudantToDo ctd = new CloudantToDo(td);\n assertNull(ctd.get_rev());\n ctd = new CloudantToDo();\n ctd.set_rev(\"def\");\n assertEquals(\"def\", ctd.get_rev());\n }",
"class_method_signature": "CloudantToDoTest.testGet_rev()",
"constructor": false,
"full_signature": "@Test public void testGet_rev()",
"identifier": "testGet_rev",
"invocations": [
"assertNull",
"get_rev",
"set_rev",
"assertEquals",
"get_rev"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void testGet_rev()",
"testcase": true
} | {
"fields": [
{
"declarator": "_id",
"modifier": "private",
"original_string": "private String _id;",
"type": "String",
"var_name": "_id"
},
{
"declarator": "_rev",
"modifier": "private",
"original_string": "private String _rev;",
"type": "String",
"var_name": "_rev"
},
{
"declarator": "title",
"modifier": "private",
"original_string": "private String title;",
"type": "String",
"var_name": "title"
},
{
"declarator": "completed",
"modifier": "private",
"original_string": "private boolean completed;",
"type": "boolean",
"var_name": "completed"
},
{
"declarator": "order",
"modifier": "private",
"original_string": "private int order;",
"type": "int",
"var_name": "order"
}
],
"file": "java/bluemix-todo-app/src/main/java/net/bluemix/todo/model/CloudantToDo.java",
"identifier": "CloudantToDo",
"interfaces": "",
"methods": [
{
"class_method_signature": "CloudantToDo.CloudantToDo()",
"constructor": true,
"full_signature": "public CloudantToDo()",
"identifier": "CloudantToDo",
"modifiers": "public",
"parameters": "()",
"return": "",
"signature": " CloudantToDo()",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.CloudantToDo(ToDo td)",
"constructor": true,
"full_signature": "public CloudantToDo(ToDo td)",
"identifier": "CloudantToDo",
"modifiers": "public",
"parameters": "(ToDo td)",
"return": "",
"signature": " CloudantToDo(ToDo td)",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.get_id()",
"constructor": false,
"full_signature": "public String get_id()",
"identifier": "get_id",
"modifiers": "public",
"parameters": "()",
"return": "String",
"signature": "String get_id()",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.set_id(String _id)",
"constructor": false,
"full_signature": "public void set_id(String _id)",
"identifier": "set_id",
"modifiers": "public",
"parameters": "(String _id)",
"return": "void",
"signature": "void set_id(String _id)",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.get_rev()",
"constructor": false,
"full_signature": "public String get_rev()",
"identifier": "get_rev",
"modifiers": "public",
"parameters": "()",
"return": "String",
"signature": "String get_rev()",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.set_rev(String _rev)",
"constructor": false,
"full_signature": "public void set_rev(String _rev)",
"identifier": "set_rev",
"modifiers": "public",
"parameters": "(String _rev)",
"return": "void",
"signature": "void set_rev(String _rev)",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.getTitle()",
"constructor": false,
"full_signature": "public String getTitle()",
"identifier": "getTitle",
"modifiers": "public",
"parameters": "()",
"return": "String",
"signature": "String getTitle()",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.setTitle(String title)",
"constructor": false,
"full_signature": "public void setTitle(String title)",
"identifier": "setTitle",
"modifiers": "public",
"parameters": "(String title)",
"return": "void",
"signature": "void setTitle(String title)",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.isCompleted()",
"constructor": false,
"full_signature": "public boolean isCompleted()",
"identifier": "isCompleted",
"modifiers": "public",
"parameters": "()",
"return": "boolean",
"signature": "boolean isCompleted()",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.setCompleted(boolean completed)",
"constructor": false,
"full_signature": "public void setCompleted(boolean completed)",
"identifier": "setCompleted",
"modifiers": "public",
"parameters": "(boolean completed)",
"return": "void",
"signature": "void setCompleted(boolean completed)",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.getToDo()",
"constructor": false,
"full_signature": "public ToDo getToDo()",
"identifier": "getToDo",
"modifiers": "public",
"parameters": "()",
"return": "ToDo",
"signature": "ToDo getToDo()",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.getOrder()",
"constructor": false,
"full_signature": "public int getOrder()",
"identifier": "getOrder",
"modifiers": "public",
"parameters": "()",
"return": "int",
"signature": "int getOrder()",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.setOrder(int order)",
"constructor": false,
"full_signature": "public void setOrder(int order)",
"identifier": "setOrder",
"modifiers": "public",
"parameters": "(int order)",
"return": "void",
"signature": "void setOrder(int order)",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.equals(Object obj)",
"constructor": false,
"full_signature": "@Override public boolean equals(Object obj)",
"identifier": "equals",
"modifiers": "@Override public",
"parameters": "(Object obj)",
"return": "boolean",
"signature": "boolean equals(Object obj)",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.hashCode()",
"constructor": false,
"full_signature": "@Override public int hashCode()",
"identifier": "hashCode",
"modifiers": "@Override public",
"parameters": "()",
"return": "int",
"signature": "int hashCode()",
"testcase": false
}
],
"superclass": ""
} | {
"body": "public String get_rev() {\n return _rev;\n }",
"class_method_signature": "CloudantToDo.get_rev()",
"constructor": false,
"full_signature": "public String get_rev()",
"identifier": "get_rev",
"invocations": [],
"modifiers": "public",
"parameters": "()",
"return": "String",
"signature": "String get_rev()",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 305,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 19317653,
"size": 777,
"stargazer_count": 196,
"stars": null,
"updates": null,
"url": "https://github.com/IBM-Cloud/todo-apps"
} |
19317653_19 | {
"fields": [
{
"declarator": "td",
"modifier": "private",
"original_string": "private ToDo td;",
"type": "ToDo",
"var_name": "td"
}
],
"file": "java/bluemix-todo-app/src/test/java/net/bluemix/todo/model/CloudantToDoTest.java",
"identifier": "CloudantToDoTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testGetTitle() {\n CloudantToDo ctd = new CloudantToDo(td);\n assertEquals(\"This is a test\", ctd.getTitle());\n ctd = new CloudantToDo();\n ctd.setTitle(\"Another test\");\n assertEquals(\"Another test\", ctd.getTitle());\n }",
"class_method_signature": "CloudantToDoTest.testGetTitle()",
"constructor": false,
"full_signature": "@Test public void testGetTitle()",
"identifier": "testGetTitle",
"invocations": [
"assertEquals",
"getTitle",
"setTitle",
"assertEquals",
"getTitle"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void testGetTitle()",
"testcase": true
} | {
"fields": [
{
"declarator": "_id",
"modifier": "private",
"original_string": "private String _id;",
"type": "String",
"var_name": "_id"
},
{
"declarator": "_rev",
"modifier": "private",
"original_string": "private String _rev;",
"type": "String",
"var_name": "_rev"
},
{
"declarator": "title",
"modifier": "private",
"original_string": "private String title;",
"type": "String",
"var_name": "title"
},
{
"declarator": "completed",
"modifier": "private",
"original_string": "private boolean completed;",
"type": "boolean",
"var_name": "completed"
},
{
"declarator": "order",
"modifier": "private",
"original_string": "private int order;",
"type": "int",
"var_name": "order"
}
],
"file": "java/bluemix-todo-app/src/main/java/net/bluemix/todo/model/CloudantToDo.java",
"identifier": "CloudantToDo",
"interfaces": "",
"methods": [
{
"class_method_signature": "CloudantToDo.CloudantToDo()",
"constructor": true,
"full_signature": "public CloudantToDo()",
"identifier": "CloudantToDo",
"modifiers": "public",
"parameters": "()",
"return": "",
"signature": " CloudantToDo()",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.CloudantToDo(ToDo td)",
"constructor": true,
"full_signature": "public CloudantToDo(ToDo td)",
"identifier": "CloudantToDo",
"modifiers": "public",
"parameters": "(ToDo td)",
"return": "",
"signature": " CloudantToDo(ToDo td)",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.get_id()",
"constructor": false,
"full_signature": "public String get_id()",
"identifier": "get_id",
"modifiers": "public",
"parameters": "()",
"return": "String",
"signature": "String get_id()",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.set_id(String _id)",
"constructor": false,
"full_signature": "public void set_id(String _id)",
"identifier": "set_id",
"modifiers": "public",
"parameters": "(String _id)",
"return": "void",
"signature": "void set_id(String _id)",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.get_rev()",
"constructor": false,
"full_signature": "public String get_rev()",
"identifier": "get_rev",
"modifiers": "public",
"parameters": "()",
"return": "String",
"signature": "String get_rev()",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.set_rev(String _rev)",
"constructor": false,
"full_signature": "public void set_rev(String _rev)",
"identifier": "set_rev",
"modifiers": "public",
"parameters": "(String _rev)",
"return": "void",
"signature": "void set_rev(String _rev)",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.getTitle()",
"constructor": false,
"full_signature": "public String getTitle()",
"identifier": "getTitle",
"modifiers": "public",
"parameters": "()",
"return": "String",
"signature": "String getTitle()",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.setTitle(String title)",
"constructor": false,
"full_signature": "public void setTitle(String title)",
"identifier": "setTitle",
"modifiers": "public",
"parameters": "(String title)",
"return": "void",
"signature": "void setTitle(String title)",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.isCompleted()",
"constructor": false,
"full_signature": "public boolean isCompleted()",
"identifier": "isCompleted",
"modifiers": "public",
"parameters": "()",
"return": "boolean",
"signature": "boolean isCompleted()",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.setCompleted(boolean completed)",
"constructor": false,
"full_signature": "public void setCompleted(boolean completed)",
"identifier": "setCompleted",
"modifiers": "public",
"parameters": "(boolean completed)",
"return": "void",
"signature": "void setCompleted(boolean completed)",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.getToDo()",
"constructor": false,
"full_signature": "public ToDo getToDo()",
"identifier": "getToDo",
"modifiers": "public",
"parameters": "()",
"return": "ToDo",
"signature": "ToDo getToDo()",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.getOrder()",
"constructor": false,
"full_signature": "public int getOrder()",
"identifier": "getOrder",
"modifiers": "public",
"parameters": "()",
"return": "int",
"signature": "int getOrder()",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.setOrder(int order)",
"constructor": false,
"full_signature": "public void setOrder(int order)",
"identifier": "setOrder",
"modifiers": "public",
"parameters": "(int order)",
"return": "void",
"signature": "void setOrder(int order)",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.equals(Object obj)",
"constructor": false,
"full_signature": "@Override public boolean equals(Object obj)",
"identifier": "equals",
"modifiers": "@Override public",
"parameters": "(Object obj)",
"return": "boolean",
"signature": "boolean equals(Object obj)",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.hashCode()",
"constructor": false,
"full_signature": "@Override public int hashCode()",
"identifier": "hashCode",
"modifiers": "@Override public",
"parameters": "()",
"return": "int",
"signature": "int hashCode()",
"testcase": false
}
],
"superclass": ""
} | {
"body": "public String getTitle() {\n return title;\n }",
"class_method_signature": "CloudantToDo.getTitle()",
"constructor": false,
"full_signature": "public String getTitle()",
"identifier": "getTitle",
"invocations": [],
"modifiers": "public",
"parameters": "()",
"return": "String",
"signature": "String getTitle()",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 305,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 19317653,
"size": 777,
"stargazer_count": 196,
"stars": null,
"updates": null,
"url": "https://github.com/IBM-Cloud/todo-apps"
} |
19317653_35 | {
"fields": [
{
"declarator": "ctd",
"modifier": "private",
"original_string": "private CloudantToDo ctd;",
"type": "CloudantToDo",
"var_name": "ctd"
}
],
"file": "java/bluemix-todo-app/src/test/java/net/bluemix/todo/model/CloudantRowTest.java",
"identifier": "CloudantRowTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testGetValue() {\n CloudantRow row = new CloudantRow();\n row.setValue(ctd.getToDo());\n assertEquals(ctd.getToDo(), row.getValue());\n }",
"class_method_signature": "CloudantRowTest.testGetValue()",
"constructor": false,
"full_signature": "@Test public void testGetValue()",
"identifier": "testGetValue",
"invocations": [
"setValue",
"getToDo",
"assertEquals",
"getToDo",
"getValue"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void testGetValue()",
"testcase": true
} | {
"fields": [
{
"declarator": "id",
"modifier": "private",
"original_string": "private String id;",
"type": "String",
"var_name": "id"
},
{
"declarator": "key",
"modifier": "private",
"original_string": "private int key;",
"type": "int",
"var_name": "key"
},
{
"declarator": "doc",
"modifier": "private",
"original_string": "private CloudantToDo doc;",
"type": "CloudantToDo",
"var_name": "doc"
},
{
"declarator": "value",
"modifier": "private",
"original_string": "private ToDo value;",
"type": "ToDo",
"var_name": "value"
}
],
"file": "java/bluemix-todo-app/src/main/java/net/bluemix/todo/model/CloudantRow.java",
"identifier": "CloudantRow",
"interfaces": "",
"methods": [
{
"class_method_signature": "CloudantRow.getValue()",
"constructor": false,
"full_signature": "public ToDo getValue()",
"identifier": "getValue",
"modifiers": "public",
"parameters": "()",
"return": "ToDo",
"signature": "ToDo getValue()",
"testcase": false
},
{
"class_method_signature": "CloudantRow.setValue(ToDo value)",
"constructor": false,
"full_signature": "public void setValue(ToDo value)",
"identifier": "setValue",
"modifiers": "public",
"parameters": "(ToDo value)",
"return": "void",
"signature": "void setValue(ToDo value)",
"testcase": false
},
{
"class_method_signature": "CloudantRow.getKey()",
"constructor": false,
"full_signature": "public int getKey()",
"identifier": "getKey",
"modifiers": "public",
"parameters": "()",
"return": "int",
"signature": "int getKey()",
"testcase": false
},
{
"class_method_signature": "CloudantRow.setKey(int key)",
"constructor": false,
"full_signature": "public void setKey(int key)",
"identifier": "setKey",
"modifiers": "public",
"parameters": "(int key)",
"return": "void",
"signature": "void setKey(int key)",
"testcase": false
},
{
"class_method_signature": "CloudantRow.getId()",
"constructor": false,
"full_signature": "public String getId()",
"identifier": "getId",
"modifiers": "public",
"parameters": "()",
"return": "String",
"signature": "String getId()",
"testcase": false
},
{
"class_method_signature": "CloudantRow.setId(String id)",
"constructor": false,
"full_signature": "public void setId(String id)",
"identifier": "setId",
"modifiers": "public",
"parameters": "(String id)",
"return": "void",
"signature": "void setId(String id)",
"testcase": false
},
{
"class_method_signature": "CloudantRow.getDoc()",
"constructor": false,
"full_signature": "public CloudantToDo getDoc()",
"identifier": "getDoc",
"modifiers": "public",
"parameters": "()",
"return": "CloudantToDo",
"signature": "CloudantToDo getDoc()",
"testcase": false
},
{
"class_method_signature": "CloudantRow.setDoc(CloudantToDo doc)",
"constructor": false,
"full_signature": "public void setDoc(CloudantToDo doc)",
"identifier": "setDoc",
"modifiers": "public",
"parameters": "(CloudantToDo doc)",
"return": "void",
"signature": "void setDoc(CloudantToDo doc)",
"testcase": false
}
],
"superclass": ""
} | {
"body": "public ToDo getValue() {\n return value;\n }",
"class_method_signature": "CloudantRow.getValue()",
"constructor": false,
"full_signature": "public ToDo getValue()",
"identifier": "getValue",
"invocations": [],
"modifiers": "public",
"parameters": "()",
"return": "ToDo",
"signature": "ToDo getValue()",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 305,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 19317653,
"size": 777,
"stargazer_count": 196,
"stars": null,
"updates": null,
"url": "https://github.com/IBM-Cloud/todo-apps"
} |
19317653_23 | {
"fields": [
{
"declarator": "td",
"modifier": "private",
"original_string": "private ToDo td;",
"type": "ToDo",
"var_name": "td"
}
],
"file": "java/bluemix-todo-app/src/test/java/net/bluemix/todo/model/CloudantToDoTest.java",
"identifier": "CloudantToDoTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testEquals() {\n CloudantToDo ctd = new CloudantToDo(td);\n assertFalse(ctd.equals(null));\n assertFalse(ctd.equals(\"test\"));\n CloudantToDo testCtd = new CloudantToDo();\n testCtd.set_id(\"123\");\n testCtd.setTitle(\"This is a test\");\n assertTrue(ctd.equals(testCtd));\n }",
"class_method_signature": "CloudantToDoTest.testEquals()",
"constructor": false,
"full_signature": "@Test public void testEquals()",
"identifier": "testEquals",
"invocations": [
"assertFalse",
"equals",
"assertFalse",
"equals",
"set_id",
"setTitle",
"assertTrue",
"equals"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void testEquals()",
"testcase": true
} | {
"fields": [
{
"declarator": "_id",
"modifier": "private",
"original_string": "private String _id;",
"type": "String",
"var_name": "_id"
},
{
"declarator": "_rev",
"modifier": "private",
"original_string": "private String _rev;",
"type": "String",
"var_name": "_rev"
},
{
"declarator": "title",
"modifier": "private",
"original_string": "private String title;",
"type": "String",
"var_name": "title"
},
{
"declarator": "completed",
"modifier": "private",
"original_string": "private boolean completed;",
"type": "boolean",
"var_name": "completed"
},
{
"declarator": "order",
"modifier": "private",
"original_string": "private int order;",
"type": "int",
"var_name": "order"
}
],
"file": "java/bluemix-todo-app/src/main/java/net/bluemix/todo/model/CloudantToDo.java",
"identifier": "CloudantToDo",
"interfaces": "",
"methods": [
{
"class_method_signature": "CloudantToDo.CloudantToDo()",
"constructor": true,
"full_signature": "public CloudantToDo()",
"identifier": "CloudantToDo",
"modifiers": "public",
"parameters": "()",
"return": "",
"signature": " CloudantToDo()",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.CloudantToDo(ToDo td)",
"constructor": true,
"full_signature": "public CloudantToDo(ToDo td)",
"identifier": "CloudantToDo",
"modifiers": "public",
"parameters": "(ToDo td)",
"return": "",
"signature": " CloudantToDo(ToDo td)",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.get_id()",
"constructor": false,
"full_signature": "public String get_id()",
"identifier": "get_id",
"modifiers": "public",
"parameters": "()",
"return": "String",
"signature": "String get_id()",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.set_id(String _id)",
"constructor": false,
"full_signature": "public void set_id(String _id)",
"identifier": "set_id",
"modifiers": "public",
"parameters": "(String _id)",
"return": "void",
"signature": "void set_id(String _id)",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.get_rev()",
"constructor": false,
"full_signature": "public String get_rev()",
"identifier": "get_rev",
"modifiers": "public",
"parameters": "()",
"return": "String",
"signature": "String get_rev()",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.set_rev(String _rev)",
"constructor": false,
"full_signature": "public void set_rev(String _rev)",
"identifier": "set_rev",
"modifiers": "public",
"parameters": "(String _rev)",
"return": "void",
"signature": "void set_rev(String _rev)",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.getTitle()",
"constructor": false,
"full_signature": "public String getTitle()",
"identifier": "getTitle",
"modifiers": "public",
"parameters": "()",
"return": "String",
"signature": "String getTitle()",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.setTitle(String title)",
"constructor": false,
"full_signature": "public void setTitle(String title)",
"identifier": "setTitle",
"modifiers": "public",
"parameters": "(String title)",
"return": "void",
"signature": "void setTitle(String title)",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.isCompleted()",
"constructor": false,
"full_signature": "public boolean isCompleted()",
"identifier": "isCompleted",
"modifiers": "public",
"parameters": "()",
"return": "boolean",
"signature": "boolean isCompleted()",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.setCompleted(boolean completed)",
"constructor": false,
"full_signature": "public void setCompleted(boolean completed)",
"identifier": "setCompleted",
"modifiers": "public",
"parameters": "(boolean completed)",
"return": "void",
"signature": "void setCompleted(boolean completed)",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.getToDo()",
"constructor": false,
"full_signature": "public ToDo getToDo()",
"identifier": "getToDo",
"modifiers": "public",
"parameters": "()",
"return": "ToDo",
"signature": "ToDo getToDo()",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.getOrder()",
"constructor": false,
"full_signature": "public int getOrder()",
"identifier": "getOrder",
"modifiers": "public",
"parameters": "()",
"return": "int",
"signature": "int getOrder()",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.setOrder(int order)",
"constructor": false,
"full_signature": "public void setOrder(int order)",
"identifier": "setOrder",
"modifiers": "public",
"parameters": "(int order)",
"return": "void",
"signature": "void setOrder(int order)",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.equals(Object obj)",
"constructor": false,
"full_signature": "@Override public boolean equals(Object obj)",
"identifier": "equals",
"modifiers": "@Override public",
"parameters": "(Object obj)",
"return": "boolean",
"signature": "boolean equals(Object obj)",
"testcase": false
},
{
"class_method_signature": "CloudantToDo.hashCode()",
"constructor": false,
"full_signature": "@Override public int hashCode()",
"identifier": "hashCode",
"modifiers": "@Override public",
"parameters": "()",
"return": "int",
"signature": "int hashCode()",
"testcase": false
}
],
"superclass": ""
} | {
"body": "@Override\n public boolean equals(Object obj) {\n if(obj instanceof CloudantToDo) {\n CloudantToDo test = (CloudantToDo)obj;\n boolean result = _id == null ? _id == test.get_id() : _id.equals(test.get_id());\n result &= _rev == null ? _rev == test.get_rev() : _rev.equals(test.get_rev());\n result &= title == null ? title == test.getTitle() : title.equals(test.getTitle());\n result &= completed == test.isCompleted();\n result &= order == test.getOrder();\n return result;\n } else {\n return false;\n }\n }",
"class_method_signature": "CloudantToDo.equals(Object obj)",
"constructor": false,
"full_signature": "@Override public boolean equals(Object obj)",
"identifier": "equals",
"invocations": [
"get_id",
"equals",
"get_id",
"get_rev",
"equals",
"get_rev",
"getTitle",
"equals",
"getTitle",
"isCompleted",
"getOrder"
],
"modifiers": "@Override public",
"parameters": "(Object obj)",
"return": "boolean",
"signature": "boolean equals(Object obj)",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 305,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 19317653,
"size": 777,
"stargazer_count": 196,
"stars": null,
"updates": null,
"url": "https://github.com/IBM-Cloud/todo-apps"
} |
19317653_54 | {
"fields": [
{
"declarator": "docs",
"modifier": "private",
"original_string": "private CloudantAllDocs docs;",
"type": "CloudantAllDocs",
"var_name": "docs"
},
{
"declarator": "rows",
"modifier": "private",
"original_string": "private List<CloudantRow> rows;",
"type": "List<CloudantRow>",
"var_name": "rows"
},
{
"declarator": "row1",
"modifier": "private",
"original_string": "private CloudantRow row1;",
"type": "CloudantRow",
"var_name": "row1"
},
{
"declarator": "row2",
"modifier": "private",
"original_string": "private CloudantRow row2;",
"type": "CloudantRow",
"var_name": "row2"
},
{
"declarator": "row3",
"modifier": "private",
"original_string": "private CloudantRow row3;",
"type": "CloudantRow",
"var_name": "row3"
},
{
"declarator": "ctd1",
"modifier": "private",
"original_string": "private CloudantToDo ctd1;",
"type": "CloudantToDo",
"var_name": "ctd1"
},
{
"declarator": "ctd2",
"modifier": "private",
"original_string": "private CloudantToDo ctd2;",
"type": "CloudantToDo",
"var_name": "ctd2"
},
{
"declarator": "ctd3",
"modifier": "private",
"original_string": "private CloudantToDo ctd3;",
"type": "CloudantToDo",
"var_name": "ctd3"
},
{
"declarator": "count",
"modifier": "private",
"original_string": "private CloudantCount count;",
"type": "CloudantCount",
"var_name": "count"
},
{
"declarator": "reducedRows",
"modifier": "private",
"original_string": "private List<CloudantReducedRow> reducedRows;",
"type": "List<CloudantReducedRow>",
"var_name": "reducedRows"
},
{
"declarator": "reducedRow",
"modifier": "private",
"original_string": "private CloudantReducedRow reducedRow;",
"type": "CloudantReducedRow",
"var_name": "reducedRow"
}
],
"file": "java/bluemix-todo-app/src/test/java/net/bluemix/todo/store/CloudantStoreTest.java",
"identifier": "CloudantStoreTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testUpdate() throws Exception {\n IMocksControl control = createControl();\n Response resp = control.createMock(Response.class);\n expect(resp.getStatus()).andReturn(200).times(3);\n expect(resp.getStatus()).andReturn(201);\n Capture<Class<CloudantToDo>> classToDoCapture = new Capture<Class<CloudantToDo>>();\n expect(resp.readEntity(capture(classToDoCapture))).andReturn(ctd1);\n CloudantPostResponse postResp = new CloudantPostResponse();\n postResp.setId(\"123\");\n postResp.setOk(true);\n postResp.setRev(\"def\");\n Capture<Class<CloudantPostResponse>> classCapture = new Capture<Class<CloudantPostResponse>>();\n expect(resp.readEntity(capture(classCapture))).andReturn(postResp);\n replay(resp);\n WebTarget wt = createMockWebTarget();\n Invocation.Builder builder = createBuilder();\n ToDo td = new ToDo();\n td.setTitle(\"new text\");\n td.setId(\"123\");\n expect(builder.put(isA(Entity.class))).andReturn(resp);\n expect(builder.get()).andReturn(resp).times(3);\n replay(builder);\n expect(wt.path(eq(\"bluemix-todo\"))).andReturn(wt).times(2);\n expect(wt.path(eq(\"todos\"))).andReturn(wt);\n expect(wt.path(eq(\"_design\"))).andReturn(wt).times(1);\n expect(wt.queryParam(eq(\"rev\"), eq(\"abc\"))).andReturn(wt);\n expect(wt.path(eq(\"123\"))).andReturn(wt).times(2);\n expect(wt.request(eq(\"application/json\"))).andReturn(builder).anyTimes();\n replay(wt);\n CloudantStore store = new CloudantStore(wt);\n ToDo testTd = new ToDo();\n testTd.setTitle(\"new text\");\n testTd.setId(\"123\");\n assertEquals(testTd, store.update(\"123\", td));\n assertEquals(CloudantPostResponse.class, classCapture.getValue());\n assertEquals(CloudantToDo.class, classToDoCapture.getValue());\n verify(resp);\n verify(wt);\n verify(builder);\n }",
"class_method_signature": "CloudantStoreTest.testUpdate()",
"constructor": false,
"full_signature": "@Test public void testUpdate()",
"identifier": "testUpdate",
"invocations": [
"createControl",
"createMock",
"times",
"andReturn",
"expect",
"getStatus",
"andReturn",
"expect",
"getStatus",
"andReturn",
"expect",
"readEntity",
"capture",
"setId",
"setOk",
"setRev",
"andReturn",
"expect",
"readEntity",
"capture",
"replay",
"createMockWebTarget",
"createBuilder",
"setTitle",
"setId",
"andReturn",
"expect",
"put",
"isA",
"times",
"andReturn",
"expect",
"get",
"replay",
"times",
"andReturn",
"expect",
"path",
"eq",
"andReturn",
"expect",
"path",
"eq",
"times",
"andReturn",
"expect",
"path",
"eq",
"andReturn",
"expect",
"queryParam",
"eq",
"eq",
"times",
"andReturn",
"expect",
"path",
"eq",
"anyTimes",
"andReturn",
"expect",
"request",
"eq",
"replay",
"setTitle",
"setId",
"assertEquals",
"update",
"assertEquals",
"getValue",
"assertEquals",
"getValue",
"verify",
"verify",
"verify"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void testUpdate()",
"testcase": true
} | {
"fields": [
{
"declarator": "REVISION_PARAM = \"rev\"",
"modifier": "private static final",
"original_string": "private static final String REVISION_PARAM = \"rev\";",
"type": "String",
"var_name": "REVISION_PARAM"
},
{
"declarator": "DESIGN_DOC_NAME = \"todos\"",
"modifier": "private static final",
"original_string": "private static final String DESIGN_DOC_NAME = \"todos\";",
"type": "String",
"var_name": "DESIGN_DOC_NAME"
},
{
"declarator": "VIEW_NAME = \"allTodos\"",
"modifier": "private static final",
"original_string": "private static final String VIEW_NAME = \"allTodos\";",
"type": "String",
"var_name": "VIEW_NAME"
},
{
"declarator": "DESIGN_DOC = \n \"{\" +\n \"\\\"views\\\": {\" +\n \"\\\"allTodos\\\": {\" +\n \"\\\"reduce\\\": \\\"_count\\\",\" +\n \"\\\"map\\\": \\\"function(doc){if(doc.title && doc.completed != null){emit(doc.order,{title: doc.title,completed: doc.completed})}}\\\"\" +\n \"}\" +\n \"}\" +\n \"}\"",
"modifier": "private static final",
"original_string": "private static final String DESIGN_DOC = \n \"{\" +\n \"\\\"views\\\": {\" +\n \"\\\"allTodos\\\": {\" +\n \"\\\"reduce\\\": \\\"_count\\\",\" +\n \"\\\"map\\\": \\\"function(doc){if(doc.title && doc.completed != null){emit(doc.order,{title: doc.title,completed: doc.completed})}}\\\"\" +\n \"}\" +\n \"}\" +\n \"}\";",
"type": "String",
"var_name": "DESIGN_DOC"
},
{
"declarator": "LOG = Logger.getLogger(CloudantStore.class.getName())",
"modifier": "private static final",
"original_string": "private static final Logger LOG = Logger.getLogger(CloudantStore.class.getName());",
"type": "Logger",
"var_name": "LOG"
},
{
"declarator": "target",
"modifier": "private",
"original_string": "private WebTarget target;",
"type": "WebTarget",
"var_name": "target"
}
],
"file": "java/bluemix-todo-app/src/main/java/net/bluemix/todo/store/CloudantStore.java",
"identifier": "CloudantStore",
"interfaces": "implements ToDoStore",
"methods": [
{
"class_method_signature": "CloudantStore.CloudantStore(WebTarget target)",
"constructor": true,
"full_signature": "public CloudantStore(WebTarget target)",
"identifier": "CloudantStore",
"modifiers": "public",
"parameters": "(WebTarget target)",
"return": "",
"signature": " CloudantStore(WebTarget target)",
"testcase": false
},
{
"class_method_signature": "CloudantStore.createDB(WebTarget target)",
"constructor": false,
"full_signature": "private void createDB(WebTarget target)",
"identifier": "createDB",
"modifiers": "private",
"parameters": "(WebTarget target)",
"return": "void",
"signature": "void createDB(WebTarget target)",
"testcase": false
},
{
"class_method_signature": "CloudantStore.createDesignDoc(WebTarget target)",
"constructor": false,
"full_signature": "private static void createDesignDoc(WebTarget target)",
"identifier": "createDesignDoc",
"modifiers": "private static",
"parameters": "(WebTarget target)",
"return": "void",
"signature": "void createDesignDoc(WebTarget target)",
"testcase": false
},
{
"class_method_signature": "CloudantStore.getAll()",
"constructor": false,
"full_signature": "@Override public Collection<ToDo> getAll()",
"identifier": "getAll",
"modifiers": "@Override public",
"parameters": "()",
"return": "Collection<ToDo>",
"signature": "Collection<ToDo> getAll()",
"testcase": false
},
{
"class_method_signature": "CloudantStore.get(String id)",
"constructor": false,
"full_signature": "@Override public ToDo get(String id)",
"identifier": "get",
"modifiers": "@Override public",
"parameters": "(String id)",
"return": "ToDo",
"signature": "ToDo get(String id)",
"testcase": false
},
{
"class_method_signature": "CloudantStore.getRequest(String id)",
"constructor": false,
"full_signature": "private Response getRequest(String id)",
"identifier": "getRequest",
"modifiers": "private",
"parameters": "(String id)",
"return": "Response",
"signature": "Response getRequest(String id)",
"testcase": false
},
{
"class_method_signature": "CloudantStore.persist(ToDo td)",
"constructor": false,
"full_signature": "@Override public ToDo persist(ToDo td)",
"identifier": "persist",
"modifiers": "@Override public",
"parameters": "(ToDo td)",
"return": "ToDo",
"signature": "ToDo persist(ToDo td)",
"testcase": false
},
{
"class_method_signature": "CloudantStore.update(String id, ToDo td)",
"constructor": false,
"full_signature": "@Override public ToDo update(String id, ToDo td)",
"identifier": "update",
"modifiers": "@Override public",
"parameters": "(String id, ToDo td)",
"return": "ToDo",
"signature": "ToDo update(String id, ToDo td)",
"testcase": false
},
{
"class_method_signature": "CloudantStore.delete(String id)",
"constructor": false,
"full_signature": "@Override public void delete(String id)",
"identifier": "delete",
"modifiers": "@Override public",
"parameters": "(String id)",
"return": "void",
"signature": "void delete(String id)",
"testcase": false
},
{
"class_method_signature": "CloudantStore.count()",
"constructor": false,
"full_signature": "@Override public int count()",
"identifier": "count",
"modifiers": "@Override public",
"parameters": "()",
"return": "int",
"signature": "int count()",
"testcase": false
}
],
"superclass": ""
} | {
"body": "@Override\n public ToDo update(String id, ToDo td) throws ToDoStoreException {\n Response docResp = getRequest(id);\n int status = docResp.getStatus();\n if(status == HttpURLConnection.HTTP_OK) {\n CloudantToDo ctd = docResp.readEntity(CloudantToDo.class);\n CloudantToDo updatedCtd = new CloudantToDo(td);\n updatedCtd.set_rev(ctd.get_rev());\n Response updateReq = target.queryParam(REVISION_PARAM, ctd.get_rev()).path(id).\n request(MediaType.APPLICATION_JSON).put(Entity.entity(updatedCtd, MediaType.APPLICATION_JSON));\n status = updateReq.getStatus();\n if(status == HttpURLConnection.HTTP_CREATED) {\n CloudantPostResponse post = updateReq.readEntity(CloudantPostResponse.class);\n td.setId(post.getId());\n return td;\n } else {\n throw new ToDoStoreException(\"There was an error POSTing the ToDo to Cloudant. Error \"\n + status);\n }\n } else {\n throw new ToDoStoreException(\"there was an error fetching the ToDo from Cloudant. Error \" + status);\n }\n }",
"class_method_signature": "CloudantStore.update(String id, ToDo td)",
"constructor": false,
"full_signature": "@Override public ToDo update(String id, ToDo td)",
"identifier": "update",
"invocations": [
"getRequest",
"getStatus",
"readEntity",
"set_rev",
"get_rev",
"put",
"request",
"path",
"queryParam",
"get_rev",
"entity",
"getStatus",
"readEntity",
"setId",
"getId"
],
"modifiers": "@Override public",
"parameters": "(String id, ToDo td)",
"return": "ToDo",
"signature": "ToDo update(String id, ToDo td)",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 305,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 19317653,
"size": 777,
"stargazer_count": 196,
"stars": null,
"updates": null,
"url": "https://github.com/IBM-Cloud/todo-apps"
} |
19317653_42 | {
"fields": [
{
"declarator": "td1",
"modifier": "",
"original_string": "ToDo td1;",
"type": "ToDo",
"var_name": "td1"
},
{
"declarator": "td2",
"modifier": "",
"original_string": "ToDo td2;",
"type": "ToDo",
"var_name": "td2"
},
{
"declarator": "emptyStore",
"modifier": "private",
"original_string": "private ToDoStore emptyStore;",
"type": "ToDoStore",
"var_name": "emptyStore"
},
{
"declarator": "populatedStore",
"modifier": "private",
"original_string": "private ToDoStore populatedStore;",
"type": "ToDoStore",
"var_name": "populatedStore"
}
],
"file": "java/bluemix-todo-app/src/test/java/net/bluemix/todo/store/InMemoryStoreTest.java",
"identifier": "InMemoryStoreTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n\tpublic void testUpdate() throws Exception {\n\t\tToDo td = new ToDo();\n\t\ttd.setCompleted(true);\n\t\tassertNull(emptyStore.update(\"123\", td));\n\t\tpopulatedStore.update(td1.getId(), td);\n\t\ttd = populatedStore.get(td1.getId());\n\t\tassertEquals(\"\", td.getTitle());\n\t\tassertTrue(td.isCompleted());\n\t}",
"class_method_signature": "InMemoryStoreTest.testUpdate()",
"constructor": false,
"full_signature": "@Test public void testUpdate()",
"identifier": "testUpdate",
"invocations": [
"setCompleted",
"assertNull",
"update",
"update",
"getId",
"get",
"getId",
"assertEquals",
"getTitle",
"assertTrue",
"isCompleted"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void testUpdate()",
"testcase": true
} | {
"fields": [
{
"declarator": "store",
"modifier": "private",
"original_string": "private Map<String, ToDo> store;",
"type": "Map<String, ToDo>",
"var_name": "store"
}
],
"file": "java/bluemix-todo-app/src/main/java/net/bluemix/todo/store/InMemoryStore.java",
"identifier": "InMemoryStore",
"interfaces": "implements ToDoStore",
"methods": [
{
"class_method_signature": "InMemoryStore.InMemoryStore()",
"constructor": true,
"full_signature": "public InMemoryStore()",
"identifier": "InMemoryStore",
"modifiers": "public",
"parameters": "()",
"return": "",
"signature": " InMemoryStore()",
"testcase": false
},
{
"class_method_signature": "InMemoryStore.getAll()",
"constructor": false,
"full_signature": "@Override public Collection<ToDo> getAll()",
"identifier": "getAll",
"modifiers": "@Override public",
"parameters": "()",
"return": "Collection<ToDo>",
"signature": "Collection<ToDo> getAll()",
"testcase": false
},
{
"class_method_signature": "InMemoryStore.get(String id)",
"constructor": false,
"full_signature": "@Override public ToDo get(String id)",
"identifier": "get",
"modifiers": "@Override public",
"parameters": "(String id)",
"return": "ToDo",
"signature": "ToDo get(String id)",
"testcase": false
},
{
"class_method_signature": "InMemoryStore.persist(ToDo td)",
"constructor": false,
"full_signature": "@Override public ToDo persist(ToDo td)",
"identifier": "persist",
"modifiers": "@Override public",
"parameters": "(ToDo td)",
"return": "ToDo",
"signature": "ToDo persist(ToDo td)",
"testcase": false
},
{
"class_method_signature": "InMemoryStore.update(String id, ToDo td)",
"constructor": false,
"full_signature": "@Override public ToDo update(String id, ToDo td)",
"identifier": "update",
"modifiers": "@Override public",
"parameters": "(String id, ToDo td)",
"return": "ToDo",
"signature": "ToDo update(String id, ToDo td)",
"testcase": false
},
{
"class_method_signature": "InMemoryStore.delete(String id)",
"constructor": false,
"full_signature": "@Override public void delete(String id)",
"identifier": "delete",
"modifiers": "@Override public",
"parameters": "(String id)",
"return": "void",
"signature": "void delete(String id)",
"testcase": false
},
{
"class_method_signature": "InMemoryStore.count()",
"constructor": false,
"full_signature": "@Override public int count()",
"identifier": "count",
"modifiers": "@Override public",
"parameters": "()",
"return": "int",
"signature": "int count()",
"testcase": false
}
],
"superclass": ""
} | {
"body": "@Override\n public ToDo update(String id, ToDo td) {\n synchronized(store) {\n ToDo old = store.get(id);\n if(old == null) {\n return null;\n } else {\n old.setCompleted(td.isCompleted());\n old.setTitle(td.getTitle());\n }\n store.put(id, old);\n return old;\n }\n }",
"class_method_signature": "InMemoryStore.update(String id, ToDo td)",
"constructor": false,
"full_signature": "@Override public ToDo update(String id, ToDo td)",
"identifier": "update",
"invocations": [
"get",
"setCompleted",
"isCompleted",
"setTitle",
"getTitle",
"put"
],
"modifiers": "@Override public",
"parameters": "(String id, ToDo td)",
"return": "ToDo",
"signature": "ToDo update(String id, ToDo td)",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 305,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 19317653,
"size": 777,
"stargazer_count": 196,
"stars": null,
"updates": null,
"url": "https://github.com/IBM-Cloud/todo-apps"
} |
19317653_15 | {
"fields": [
{
"declarator": "td1",
"modifier": "private",
"original_string": "private ToDo td1;",
"type": "ToDo",
"var_name": "td1"
},
{
"declarator": "td2",
"modifier": "private",
"original_string": "private ToDo td2;",
"type": "ToDo",
"var_name": "td2"
},
{
"declarator": "store",
"modifier": "private",
"original_string": "private ToDoStore store;",
"type": "ToDoStore",
"var_name": "store"
},
{
"declarator": "api",
"modifier": "private",
"original_string": "private ToDoAPI api;",
"type": "ToDoAPI",
"var_name": "api"
},
{
"declarator": "exceptionStore = new ToDoStore(){\n\n\t\t@Override\n\t\tpublic Collection<ToDo> getAll() throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo get(String id) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo persist(ToDo td) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo update(String id, ToDo td) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic void delete(String id) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n @Override\n public int count() throws ToDoStoreException {\n throw new ToDoStoreException(\"Error\");\n }\n\t}",
"modifier": "private",
"original_string": "private ToDoStore exceptionStore = new ToDoStore(){\n\n\t\t@Override\n\t\tpublic Collection<ToDo> getAll() throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo get(String id) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo persist(ToDo td) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo update(String id, ToDo td) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic void delete(String id) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n @Override\n public int count() throws ToDoStoreException {\n throw new ToDoStoreException(\"Error\");\n }\n\t};",
"type": "ToDoStore",
"var_name": "exceptionStore"
},
{
"declarator": "errorApi",
"modifier": "private",
"original_string": "private ToDoAPI errorApi;",
"type": "ToDoAPI",
"var_name": "errorApi"
}
],
"file": "java/bluemix-todo-app/src/test/java/net/bluemix/todo/rest/ToDoAPITest.java",
"identifier": "ToDoAPITest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n\tpublic void testDeleteToDoException() {\n\t\ttry {\n\t\t\terrorApi.deleteToDo(\"123\");\n\t\t\tfail(\"Expected exception to be thrown.\");\n\t\t} catch (WebApplicationException e) {\n\t\t\tassertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), e.getResponse().getStatus());\n\t\t}\n\t\t\n\t}",
"class_method_signature": "ToDoAPITest.testDeleteToDoException()",
"constructor": false,
"full_signature": "@Test public void testDeleteToDoException()",
"identifier": "testDeleteToDoException",
"invocations": [
"deleteToDo",
"fail",
"assertEquals",
"getStatusCode",
"getStatus",
"getResponse"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void testDeleteToDoException()",
"testcase": true
} | {
"fields": [
{
"declarator": "store",
"modifier": "private",
"original_string": "private ToDoStore store;",
"type": "ToDoStore",
"var_name": "store"
}
],
"file": "java/bluemix-todo-app/src/main/java/net/bluemix/todo/rest/ToDoAPI.java",
"identifier": "ToDoAPI",
"interfaces": "",
"methods": [
{
"class_method_signature": "ToDoAPI.ToDoAPI()",
"constructor": true,
"full_signature": "public ToDoAPI()",
"identifier": "ToDoAPI",
"modifiers": "public",
"parameters": "()",
"return": "",
"signature": " ToDoAPI()",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.ToDoAPI(ToDoStore store)",
"constructor": true,
"full_signature": "public ToDoAPI(ToDoStore store)",
"identifier": "ToDoAPI",
"modifiers": "public",
"parameters": "(ToDoStore store)",
"return": "",
"signature": " ToDoAPI(ToDoStore store)",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.getToDo(@PathParam(\"id\") String id)",
"constructor": false,
"full_signature": "@GET @Path(\"/{id}\") @Produces(\"application/json\") public ToDo getToDo(@PathParam(\"id\") String id)",
"identifier": "getToDo",
"modifiers": "@GET @Path(\"/{id}\") @Produces(\"application/json\") public",
"parameters": "(@PathParam(\"id\") String id)",
"return": "ToDo",
"signature": "ToDo getToDo(@PathParam(\"id\") String id)",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.getToDos()",
"constructor": false,
"full_signature": "@GET @Produces(\"application/json\") public Collection<ToDo> getToDos()",
"identifier": "getToDos",
"modifiers": "@GET @Produces(\"application/json\") public",
"parameters": "()",
"return": "Collection<ToDo>",
"signature": "Collection<ToDo> getToDos()",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.newToDo(ToDo td)",
"constructor": false,
"full_signature": "@POST @Consumes(\"application/json\") @Produces(\"application/json\") public ToDo newToDo(ToDo td)",
"identifier": "newToDo",
"modifiers": "@POST @Consumes(\"application/json\") @Produces(\"application/json\") public",
"parameters": "(ToDo td)",
"return": "ToDo",
"signature": "ToDo newToDo(ToDo td)",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.updateToDo(@PathParam(\"id\") String id, ToDo td)",
"constructor": false,
"full_signature": "@PUT @Path(\"/{id}\") @Produces(\"application/json\") @Consumes(\"application/json\") public ToDo updateToDo(@PathParam(\"id\") String id, ToDo td)",
"identifier": "updateToDo",
"modifiers": "@PUT @Path(\"/{id}\") @Produces(\"application/json\") @Consumes(\"application/json\") public",
"parameters": "(@PathParam(\"id\") String id, ToDo td)",
"return": "ToDo",
"signature": "ToDo updateToDo(@PathParam(\"id\") String id, ToDo td)",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.deleteToDo(@PathParam(\"id\") String id)",
"constructor": false,
"full_signature": "@DELETE @Path(\"/{id}\") public void deleteToDo(@PathParam(\"id\") String id)",
"identifier": "deleteToDo",
"modifiers": "@DELETE @Path(\"/{id}\") public",
"parameters": "(@PathParam(\"id\") String id)",
"return": "void",
"signature": "void deleteToDo(@PathParam(\"id\") String id)",
"testcase": false
}
],
"superclass": ""
} | {
"body": "@DELETE @Path(\"/{id}\")\n public void deleteToDo(@PathParam(\"id\") String id) {\n if(id == null) {\n throw new WebApplicationException(\"Must supply an ID, for example /api/todos/123,\",\n Response.Status.BAD_REQUEST);\n }\n try {\n store.delete(id);\n } catch (ToDoStoreException e) {\n throw new WebApplicationException(\"Error deleting ToDo.\", Response.Status.INTERNAL_SERVER_ERROR);\n }\n }",
"class_method_signature": "ToDoAPI.deleteToDo(@PathParam(\"id\") String id)",
"constructor": false,
"full_signature": "@DELETE @Path(\"/{id}\") public void deleteToDo(@PathParam(\"id\") String id)",
"identifier": "deleteToDo",
"invocations": [
"delete"
],
"modifiers": "@DELETE @Path(\"/{id}\") public",
"parameters": "(@PathParam(\"id\") String id)",
"return": "void",
"signature": "void deleteToDo(@PathParam(\"id\") String id)",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 305,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 19317653,
"size": 777,
"stargazer_count": 196,
"stars": null,
"updates": null,
"url": "https://github.com/IBM-Cloud/todo-apps"
} |
19317653_0 | {
"fields": [
{
"declarator": "td1",
"modifier": "private",
"original_string": "private ToDo td1;",
"type": "ToDo",
"var_name": "td1"
},
{
"declarator": "td2",
"modifier": "private",
"original_string": "private ToDo td2;",
"type": "ToDo",
"var_name": "td2"
},
{
"declarator": "store",
"modifier": "private",
"original_string": "private ToDoStore store;",
"type": "ToDoStore",
"var_name": "store"
},
{
"declarator": "api",
"modifier": "private",
"original_string": "private ToDoAPI api;",
"type": "ToDoAPI",
"var_name": "api"
},
{
"declarator": "exceptionStore = new ToDoStore(){\n\n\t\t@Override\n\t\tpublic Collection<ToDo> getAll() throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo get(String id) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo persist(ToDo td) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo update(String id, ToDo td) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic void delete(String id) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n @Override\n public int count() throws ToDoStoreException {\n throw new ToDoStoreException(\"Error\");\n }\n\t}",
"modifier": "private",
"original_string": "private ToDoStore exceptionStore = new ToDoStore(){\n\n\t\t@Override\n\t\tpublic Collection<ToDo> getAll() throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo get(String id) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo persist(ToDo td) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo update(String id, ToDo td) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic void delete(String id) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n @Override\n public int count() throws ToDoStoreException {\n throw new ToDoStoreException(\"Error\");\n }\n\t};",
"type": "ToDoStore",
"var_name": "exceptionStore"
},
{
"declarator": "errorApi",
"modifier": "private",
"original_string": "private ToDoAPI errorApi;",
"type": "ToDoAPI",
"var_name": "errorApi"
}
],
"file": "java/bluemix-todo-app/src/test/java/net/bluemix/todo/rest/ToDoAPITest.java",
"identifier": "ToDoAPITest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n\tpublic void testGetToDo() {\n\t\tassertEquals(td1, api.getToDo(td1.getId()));\n\t}",
"class_method_signature": "ToDoAPITest.testGetToDo()",
"constructor": false,
"full_signature": "@Test public void testGetToDo()",
"identifier": "testGetToDo",
"invocations": [
"assertEquals",
"getToDo",
"getId"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void testGetToDo()",
"testcase": true
} | {
"fields": [
{
"declarator": "store",
"modifier": "private",
"original_string": "private ToDoStore store;",
"type": "ToDoStore",
"var_name": "store"
}
],
"file": "java/bluemix-todo-app/src/main/java/net/bluemix/todo/rest/ToDoAPI.java",
"identifier": "ToDoAPI",
"interfaces": "",
"methods": [
{
"class_method_signature": "ToDoAPI.ToDoAPI()",
"constructor": true,
"full_signature": "public ToDoAPI()",
"identifier": "ToDoAPI",
"modifiers": "public",
"parameters": "()",
"return": "",
"signature": " ToDoAPI()",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.ToDoAPI(ToDoStore store)",
"constructor": true,
"full_signature": "public ToDoAPI(ToDoStore store)",
"identifier": "ToDoAPI",
"modifiers": "public",
"parameters": "(ToDoStore store)",
"return": "",
"signature": " ToDoAPI(ToDoStore store)",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.getToDo(@PathParam(\"id\") String id)",
"constructor": false,
"full_signature": "@GET @Path(\"/{id}\") @Produces(\"application/json\") public ToDo getToDo(@PathParam(\"id\") String id)",
"identifier": "getToDo",
"modifiers": "@GET @Path(\"/{id}\") @Produces(\"application/json\") public",
"parameters": "(@PathParam(\"id\") String id)",
"return": "ToDo",
"signature": "ToDo getToDo(@PathParam(\"id\") String id)",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.getToDos()",
"constructor": false,
"full_signature": "@GET @Produces(\"application/json\") public Collection<ToDo> getToDos()",
"identifier": "getToDos",
"modifiers": "@GET @Produces(\"application/json\") public",
"parameters": "()",
"return": "Collection<ToDo>",
"signature": "Collection<ToDo> getToDos()",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.newToDo(ToDo td)",
"constructor": false,
"full_signature": "@POST @Consumes(\"application/json\") @Produces(\"application/json\") public ToDo newToDo(ToDo td)",
"identifier": "newToDo",
"modifiers": "@POST @Consumes(\"application/json\") @Produces(\"application/json\") public",
"parameters": "(ToDo td)",
"return": "ToDo",
"signature": "ToDo newToDo(ToDo td)",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.updateToDo(@PathParam(\"id\") String id, ToDo td)",
"constructor": false,
"full_signature": "@PUT @Path(\"/{id}\") @Produces(\"application/json\") @Consumes(\"application/json\") public ToDo updateToDo(@PathParam(\"id\") String id, ToDo td)",
"identifier": "updateToDo",
"modifiers": "@PUT @Path(\"/{id}\") @Produces(\"application/json\") @Consumes(\"application/json\") public",
"parameters": "(@PathParam(\"id\") String id, ToDo td)",
"return": "ToDo",
"signature": "ToDo updateToDo(@PathParam(\"id\") String id, ToDo td)",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.deleteToDo(@PathParam(\"id\") String id)",
"constructor": false,
"full_signature": "@DELETE @Path(\"/{id}\") public void deleteToDo(@PathParam(\"id\") String id)",
"identifier": "deleteToDo",
"modifiers": "@DELETE @Path(\"/{id}\") public",
"parameters": "(@PathParam(\"id\") String id)",
"return": "void",
"signature": "void deleteToDo(@PathParam(\"id\") String id)",
"testcase": false
}
],
"superclass": ""
} | {
"body": "@GET @Path(\"/{id}\")\n @Produces(\"application/json\")\n public ToDo getToDo(@PathParam(\"id\") String id) {\n if(id == null) {\n throw new WebApplicationException(\"Must supply an ID, for example /api/todos/123.\", \n Response.Status.BAD_REQUEST);\n }\n try {\n ToDo td = store.get(id);\n if(td == null) {\n throw new WebApplicationException(\"ToDo with the ID \" + id + \" does not exist.\",\n Response.Status.BAD_REQUEST);\n }\n return td;\n } catch (ToDoStoreException e) {\n throw new WebApplicationException(\"Error getting ToDo.\", Response.Status.INTERNAL_SERVER_ERROR);\n }\n }",
"class_method_signature": "ToDoAPI.getToDo(@PathParam(\"id\") String id)",
"constructor": false,
"full_signature": "@GET @Path(\"/{id}\") @Produces(\"application/json\") public ToDo getToDo(@PathParam(\"id\") String id)",
"identifier": "getToDo",
"invocations": [
"get"
],
"modifiers": "@GET @Path(\"/{id}\") @Produces(\"application/json\") public",
"parameters": "(@PathParam(\"id\") String id)",
"return": "ToDo",
"signature": "ToDo getToDo(@PathParam(\"id\") String id)",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 305,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 19317653,
"size": 777,
"stargazer_count": 196,
"stars": null,
"updates": null,
"url": "https://github.com/IBM-Cloud/todo-apps"
} |
19317653_39 | {
"fields": [
{
"declarator": "td1",
"modifier": "",
"original_string": "ToDo td1;",
"type": "ToDo",
"var_name": "td1"
},
{
"declarator": "td2",
"modifier": "",
"original_string": "ToDo td2;",
"type": "ToDo",
"var_name": "td2"
},
{
"declarator": "emptyStore",
"modifier": "private",
"original_string": "private ToDoStore emptyStore;",
"type": "ToDoStore",
"var_name": "emptyStore"
},
{
"declarator": "populatedStore",
"modifier": "private",
"original_string": "private ToDoStore populatedStore;",
"type": "ToDoStore",
"var_name": "populatedStore"
}
],
"file": "java/bluemix-todo-app/src/test/java/net/bluemix/todo/store/InMemoryStoreTest.java",
"identifier": "InMemoryStoreTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n\tpublic void testGetAll() throws Exception {\n\t\tassertTrue(emptyStore.getAll().isEmpty());\n\t\tCollection<ToDo> todos = populatedStore.getAll();\n\t\tassertTrue(todos.contains(td2));\n\t\tassertTrue(todos.contains(td1));\n\t}",
"class_method_signature": "InMemoryStoreTest.testGetAll()",
"constructor": false,
"full_signature": "@Test public void testGetAll()",
"identifier": "testGetAll",
"invocations": [
"assertTrue",
"isEmpty",
"getAll",
"getAll",
"assertTrue",
"contains",
"assertTrue",
"contains"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void testGetAll()",
"testcase": true
} | {
"fields": [
{
"declarator": "store",
"modifier": "private",
"original_string": "private Map<String, ToDo> store;",
"type": "Map<String, ToDo>",
"var_name": "store"
}
],
"file": "java/bluemix-todo-app/src/main/java/net/bluemix/todo/store/InMemoryStore.java",
"identifier": "InMemoryStore",
"interfaces": "implements ToDoStore",
"methods": [
{
"class_method_signature": "InMemoryStore.InMemoryStore()",
"constructor": true,
"full_signature": "public InMemoryStore()",
"identifier": "InMemoryStore",
"modifiers": "public",
"parameters": "()",
"return": "",
"signature": " InMemoryStore()",
"testcase": false
},
{
"class_method_signature": "InMemoryStore.getAll()",
"constructor": false,
"full_signature": "@Override public Collection<ToDo> getAll()",
"identifier": "getAll",
"modifiers": "@Override public",
"parameters": "()",
"return": "Collection<ToDo>",
"signature": "Collection<ToDo> getAll()",
"testcase": false
},
{
"class_method_signature": "InMemoryStore.get(String id)",
"constructor": false,
"full_signature": "@Override public ToDo get(String id)",
"identifier": "get",
"modifiers": "@Override public",
"parameters": "(String id)",
"return": "ToDo",
"signature": "ToDo get(String id)",
"testcase": false
},
{
"class_method_signature": "InMemoryStore.persist(ToDo td)",
"constructor": false,
"full_signature": "@Override public ToDo persist(ToDo td)",
"identifier": "persist",
"modifiers": "@Override public",
"parameters": "(ToDo td)",
"return": "ToDo",
"signature": "ToDo persist(ToDo td)",
"testcase": false
},
{
"class_method_signature": "InMemoryStore.update(String id, ToDo td)",
"constructor": false,
"full_signature": "@Override public ToDo update(String id, ToDo td)",
"identifier": "update",
"modifiers": "@Override public",
"parameters": "(String id, ToDo td)",
"return": "ToDo",
"signature": "ToDo update(String id, ToDo td)",
"testcase": false
},
{
"class_method_signature": "InMemoryStore.delete(String id)",
"constructor": false,
"full_signature": "@Override public void delete(String id)",
"identifier": "delete",
"modifiers": "@Override public",
"parameters": "(String id)",
"return": "void",
"signature": "void delete(String id)",
"testcase": false
},
{
"class_method_signature": "InMemoryStore.count()",
"constructor": false,
"full_signature": "@Override public int count()",
"identifier": "count",
"modifiers": "@Override public",
"parameters": "()",
"return": "int",
"signature": "int count()",
"testcase": false
}
],
"superclass": ""
} | {
"body": "@Override\n public Collection<ToDo> getAll() {\n return store.values();\n }",
"class_method_signature": "InMemoryStore.getAll()",
"constructor": false,
"full_signature": "@Override public Collection<ToDo> getAll()",
"identifier": "getAll",
"invocations": [
"values"
],
"modifiers": "@Override public",
"parameters": "()",
"return": "Collection<ToDo>",
"signature": "Collection<ToDo> getAll()",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 305,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 19317653,
"size": 777,
"stargazer_count": 196,
"stars": null,
"updates": null,
"url": "https://github.com/IBM-Cloud/todo-apps"
} |
19317653_24 | {
"fields": [],
"file": "java/bluemix-todo-app/src/test/java/net/bluemix/todo/model/CloudantPostResponseTest.java",
"identifier": "CloudantPostResponseTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testGetId() {\n CloudantPostResponse resp = new CloudantPostResponse();\n resp.setId(\"123\");\n assertEquals(\"123\", resp.getId());\n }",
"class_method_signature": "CloudantPostResponseTest.testGetId()",
"constructor": false,
"full_signature": "@Test public void testGetId()",
"identifier": "testGetId",
"invocations": [
"setId",
"assertEquals",
"getId"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void testGetId()",
"testcase": true
} | {
"fields": [
{
"declarator": "id",
"modifier": "private",
"original_string": "private String id;",
"type": "String",
"var_name": "id"
},
{
"declarator": "ok",
"modifier": "private",
"original_string": "private boolean ok;",
"type": "boolean",
"var_name": "ok"
},
{
"declarator": "rev",
"modifier": "private",
"original_string": "private String rev;",
"type": "String",
"var_name": "rev"
}
],
"file": "java/bluemix-todo-app/src/main/java/net/bluemix/todo/model/CloudantPostResponse.java",
"identifier": "CloudantPostResponse",
"interfaces": "",
"methods": [
{
"class_method_signature": "CloudantPostResponse.getId()",
"constructor": false,
"full_signature": "public String getId()",
"identifier": "getId",
"modifiers": "public",
"parameters": "()",
"return": "String",
"signature": "String getId()",
"testcase": false
},
{
"class_method_signature": "CloudantPostResponse.setId(String id)",
"constructor": false,
"full_signature": "public void setId(String id)",
"identifier": "setId",
"modifiers": "public",
"parameters": "(String id)",
"return": "void",
"signature": "void setId(String id)",
"testcase": false
},
{
"class_method_signature": "CloudantPostResponse.isOk()",
"constructor": false,
"full_signature": "public boolean isOk()",
"identifier": "isOk",
"modifiers": "public",
"parameters": "()",
"return": "boolean",
"signature": "boolean isOk()",
"testcase": false
},
{
"class_method_signature": "CloudantPostResponse.setOk(boolean ok)",
"constructor": false,
"full_signature": "public void setOk(boolean ok)",
"identifier": "setOk",
"modifiers": "public",
"parameters": "(boolean ok)",
"return": "void",
"signature": "void setOk(boolean ok)",
"testcase": false
},
{
"class_method_signature": "CloudantPostResponse.getRev()",
"constructor": false,
"full_signature": "public String getRev()",
"identifier": "getRev",
"modifiers": "public",
"parameters": "()",
"return": "String",
"signature": "String getRev()",
"testcase": false
},
{
"class_method_signature": "CloudantPostResponse.setRev(String rev)",
"constructor": false,
"full_signature": "public void setRev(String rev)",
"identifier": "setRev",
"modifiers": "public",
"parameters": "(String rev)",
"return": "void",
"signature": "void setRev(String rev)",
"testcase": false
}
],
"superclass": ""
} | {
"body": "public String getId() {\n return id;\n }",
"class_method_signature": "CloudantPostResponse.getId()",
"constructor": false,
"full_signature": "public String getId()",
"identifier": "getId",
"invocations": [],
"modifiers": "public",
"parameters": "()",
"return": "String",
"signature": "String getId()",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 305,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 19317653,
"size": 777,
"stargazer_count": 196,
"stars": null,
"updates": null,
"url": "https://github.com/IBM-Cloud/todo-apps"
} |
19317653_32 | {
"fields": [],
"file": "java/bluemix-todo-app/src/test/java/net/bluemix/todo/model/CloudantReducedRowTest.java",
"identifier": "CloudantReducedRowTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testGetKey() {\n CloudantReducedRow row = new CloudantReducedRow();\n row.setKey(\"123\");\n assertEquals(\"123\", row.getKey());\n }",
"class_method_signature": "CloudantReducedRowTest.testGetKey()",
"constructor": false,
"full_signature": "@Test public void testGetKey()",
"identifier": "testGetKey",
"invocations": [
"setKey",
"assertEquals",
"getKey"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void testGetKey()",
"testcase": true
} | {
"fields": [
{
"declarator": "key",
"modifier": "private",
"original_string": "private String key;",
"type": "String",
"var_name": "key"
},
{
"declarator": "value",
"modifier": "private",
"original_string": "private int value;",
"type": "int",
"var_name": "value"
}
],
"file": "java/bluemix-todo-app/src/main/java/net/bluemix/todo/model/CloudantReducedRow.java",
"identifier": "CloudantReducedRow",
"interfaces": "",
"methods": [
{
"class_method_signature": "CloudantReducedRow.getKey()",
"constructor": false,
"full_signature": "public String getKey()",
"identifier": "getKey",
"modifiers": "public",
"parameters": "()",
"return": "String",
"signature": "String getKey()",
"testcase": false
},
{
"class_method_signature": "CloudantReducedRow.setKey(String key)",
"constructor": false,
"full_signature": "public void setKey(String key)",
"identifier": "setKey",
"modifiers": "public",
"parameters": "(String key)",
"return": "void",
"signature": "void setKey(String key)",
"testcase": false
},
{
"class_method_signature": "CloudantReducedRow.getValue()",
"constructor": false,
"full_signature": "public int getValue()",
"identifier": "getValue",
"modifiers": "public",
"parameters": "()",
"return": "int",
"signature": "int getValue()",
"testcase": false
},
{
"class_method_signature": "CloudantReducedRow.setValue(int value)",
"constructor": false,
"full_signature": "public void setValue(int value)",
"identifier": "setValue",
"modifiers": "public",
"parameters": "(int value)",
"return": "void",
"signature": "void setValue(int value)",
"testcase": false
}
],
"superclass": ""
} | {
"body": "public String getKey() {\n return key;\n }",
"class_method_signature": "CloudantReducedRow.getKey()",
"constructor": false,
"full_signature": "public String getKey()",
"identifier": "getKey",
"invocations": [],
"modifiers": "public",
"parameters": "()",
"return": "String",
"signature": "String getKey()",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 305,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 19317653,
"size": 777,
"stargazer_count": 196,
"stars": null,
"updates": null,
"url": "https://github.com/IBM-Cloud/todo-apps"
} |
19317653_49 | {
"fields": [],
"file": "java/bluemix-todo-app/src/test/java/net/bluemix/todo/store/MongoStoreTest.java",
"identifier": "MongoStoreTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n\tpublic void testDelete() {\n\t\tToDo td = new ToDo();\n\t\ttd.setId(\"aaaaaaaaaaaaaaaaaaaaaaa2\");\n\t\ttd.setTitle(\"this is a test\");\n\t\tBasicDBObject dbObj = new BasicDBObject();\n\t\tdbObj.put(\"_id\", new ObjectId(\"aaaaaaaaaaaaaaaaaaaaaaa2\"));\n\t\tDBCollection coll = createMockCollection();\n\t\texpect(coll.remove(eq(dbObj))).andReturn(null);\n\t\treplay(coll);\n\t\tMongoStore store = new MongoStore(coll);\n\t\tstore.delete(\"aaaaaaaaaaaaaaaaaaaaaaa2\");\n\t\tverify(coll);\n\t}",
"class_method_signature": "MongoStoreTest.testDelete()",
"constructor": false,
"full_signature": "@Test public void testDelete()",
"identifier": "testDelete",
"invocations": [
"setId",
"setTitle",
"put",
"createMockCollection",
"andReturn",
"expect",
"remove",
"eq",
"replay",
"delete",
"verify"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void testDelete()",
"testcase": true
} | {
"fields": [
{
"declarator": "coll",
"modifier": "private",
"original_string": "private DBCollection coll;",
"type": "DBCollection",
"var_name": "coll"
}
],
"file": "java/bluemix-todo-app/src/main/java/net/bluemix/todo/store/MongoStore.java",
"identifier": "MongoStore",
"interfaces": "implements ToDoStore",
"methods": [
{
"class_method_signature": "MongoStore.MongoStore(DBCollection coll)",
"constructor": true,
"full_signature": "public MongoStore(DBCollection coll)",
"identifier": "MongoStore",
"modifiers": "public",
"parameters": "(DBCollection coll)",
"return": "",
"signature": " MongoStore(DBCollection coll)",
"testcase": false
},
{
"class_method_signature": "MongoStore.getAll()",
"constructor": false,
"full_signature": "@Override public Collection<ToDo> getAll()",
"identifier": "getAll",
"modifiers": "@Override public",
"parameters": "()",
"return": "Collection<ToDo>",
"signature": "Collection<ToDo> getAll()",
"testcase": false
},
{
"class_method_signature": "MongoStore.get(String id)",
"constructor": false,
"full_signature": "@Override public ToDo get(String id)",
"identifier": "get",
"modifiers": "@Override public",
"parameters": "(String id)",
"return": "ToDo",
"signature": "ToDo get(String id)",
"testcase": false
},
{
"class_method_signature": "MongoStore.persist(ToDo td)",
"constructor": false,
"full_signature": "@Override public ToDo persist(ToDo td)",
"identifier": "persist",
"modifiers": "@Override public",
"parameters": "(ToDo td)",
"return": "ToDo",
"signature": "ToDo persist(ToDo td)",
"testcase": false
},
{
"class_method_signature": "MongoStore.update(String id, ToDo td)",
"constructor": false,
"full_signature": "@Override public ToDo update(String id, ToDo td)",
"identifier": "update",
"modifiers": "@Override public",
"parameters": "(String id, ToDo td)",
"return": "ToDo",
"signature": "ToDo update(String id, ToDo td)",
"testcase": false
},
{
"class_method_signature": "MongoStore.delete(String id)",
"constructor": false,
"full_signature": "@Override public void delete(String id)",
"identifier": "delete",
"modifiers": "@Override public",
"parameters": "(String id)",
"return": "void",
"signature": "void delete(String id)",
"testcase": false
},
{
"class_method_signature": "MongoStore.createToDo(DBObject dbObj)",
"constructor": false,
"full_signature": "private ToDo createToDo(DBObject dbObj)",
"identifier": "createToDo",
"modifiers": "private",
"parameters": "(DBObject dbObj)",
"return": "ToDo",
"signature": "ToDo createToDo(DBObject dbObj)",
"testcase": false
},
{
"class_method_signature": "MongoStore.convertToDbObject(ToDo td)",
"constructor": false,
"full_signature": "private DBObject convertToDbObject(ToDo td)",
"identifier": "convertToDbObject",
"modifiers": "private",
"parameters": "(ToDo td)",
"return": "DBObject",
"signature": "DBObject convertToDbObject(ToDo td)",
"testcase": false
},
{
"class_method_signature": "MongoStore.count()",
"constructor": false,
"full_signature": "@Override public int count()",
"identifier": "count",
"modifiers": "@Override public",
"parameters": "()",
"return": "int",
"signature": "int count()",
"testcase": false
}
],
"superclass": ""
} | {
"body": "@Override\n public void delete(String id) {\n DBObject query = new BasicDBObject(\"_id\", new ObjectId(id));\n coll.remove(query);\n }",
"class_method_signature": "MongoStore.delete(String id)",
"constructor": false,
"full_signature": "@Override public void delete(String id)",
"identifier": "delete",
"invocations": [
"remove"
],
"modifiers": "@Override public",
"parameters": "(String id)",
"return": "void",
"signature": "void delete(String id)",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 305,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 19317653,
"size": 777,
"stargazer_count": 196,
"stars": null,
"updates": null,
"url": "https://github.com/IBM-Cloud/todo-apps"
} |
19317653_28 | {
"fields": [],
"file": "java/bluemix-todo-app/src/test/java/net/bluemix/todo/model/ToDoTest.java",
"identifier": "ToDoTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n\tpublic void testIsCompleted() {\n\t\tToDo td = new ToDo();\n\t\tassertFalse(td.isCompleted());\n\t\ttd.setCompleted(true);\n\t\tassertTrue(td.isCompleted());\n\t}",
"class_method_signature": "ToDoTest.testIsCompleted()",
"constructor": false,
"full_signature": "@Test public void testIsCompleted()",
"identifier": "testIsCompleted",
"invocations": [
"assertFalse",
"isCompleted",
"setCompleted",
"assertTrue",
"isCompleted"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void testIsCompleted()",
"testcase": true
} | {
"fields": [
{
"declarator": "completed",
"modifier": "private",
"original_string": "private boolean completed;",
"type": "boolean",
"var_name": "completed"
},
{
"declarator": "title",
"modifier": "private",
"original_string": "private String title;",
"type": "String",
"var_name": "title"
},
{
"declarator": "id",
"modifier": "private",
"original_string": "private String id;",
"type": "String",
"var_name": "id"
},
{
"declarator": "order",
"modifier": "private",
"original_string": "private int order;",
"type": "int",
"var_name": "order"
}
],
"file": "java/bluemix-todo-app/src/main/java/net/bluemix/todo/model/ToDo.java",
"identifier": "ToDo",
"interfaces": "",
"methods": [
{
"class_method_signature": "ToDo.ToDo()",
"constructor": true,
"full_signature": "public ToDo()",
"identifier": "ToDo",
"modifiers": "public",
"parameters": "()",
"return": "",
"signature": " ToDo()",
"testcase": false
},
{
"class_method_signature": "ToDo.getId()",
"constructor": false,
"full_signature": "public String getId()",
"identifier": "getId",
"modifiers": "public",
"parameters": "()",
"return": "String",
"signature": "String getId()",
"testcase": false
},
{
"class_method_signature": "ToDo.setId(String id)",
"constructor": false,
"full_signature": "public void setId(String id)",
"identifier": "setId",
"modifiers": "public",
"parameters": "(String id)",
"return": "void",
"signature": "void setId(String id)",
"testcase": false
},
{
"class_method_signature": "ToDo.isCompleted()",
"constructor": false,
"full_signature": "public boolean isCompleted()",
"identifier": "isCompleted",
"modifiers": "public",
"parameters": "()",
"return": "boolean",
"signature": "boolean isCompleted()",
"testcase": false
},
{
"class_method_signature": "ToDo.setCompleted(boolean completed)",
"constructor": false,
"full_signature": "public void setCompleted(boolean completed)",
"identifier": "setCompleted",
"modifiers": "public",
"parameters": "(boolean completed)",
"return": "void",
"signature": "void setCompleted(boolean completed)",
"testcase": false
},
{
"class_method_signature": "ToDo.getTitle()",
"constructor": false,
"full_signature": "public String getTitle()",
"identifier": "getTitle",
"modifiers": "public",
"parameters": "()",
"return": "String",
"signature": "String getTitle()",
"testcase": false
},
{
"class_method_signature": "ToDo.setTitle(String title)",
"constructor": false,
"full_signature": "public void setTitle(String title)",
"identifier": "setTitle",
"modifiers": "public",
"parameters": "(String title)",
"return": "void",
"signature": "void setTitle(String title)",
"testcase": false
},
{
"class_method_signature": "ToDo.getOrder()",
"constructor": false,
"full_signature": "public int getOrder()",
"identifier": "getOrder",
"modifiers": "public",
"parameters": "()",
"return": "int",
"signature": "int getOrder()",
"testcase": false
},
{
"class_method_signature": "ToDo.setOrder(int order)",
"constructor": false,
"full_signature": "public void setOrder(int order)",
"identifier": "setOrder",
"modifiers": "public",
"parameters": "(int order)",
"return": "void",
"signature": "void setOrder(int order)",
"testcase": false
},
{
"class_method_signature": "ToDo.equals(Object obj)",
"constructor": false,
"full_signature": "@Override public boolean equals(Object obj)",
"identifier": "equals",
"modifiers": "@Override public",
"parameters": "(Object obj)",
"return": "boolean",
"signature": "boolean equals(Object obj)",
"testcase": false
},
{
"class_method_signature": "ToDo.hashCode()",
"constructor": false,
"full_signature": "@Override public int hashCode()",
"identifier": "hashCode",
"modifiers": "@Override public",
"parameters": "()",
"return": "int",
"signature": "int hashCode()",
"testcase": false
}
],
"superclass": ""
} | {
"body": "public boolean isCompleted() {\n return completed;\n }",
"class_method_signature": "ToDo.isCompleted()",
"constructor": false,
"full_signature": "public boolean isCompleted()",
"identifier": "isCompleted",
"invocations": [],
"modifiers": "public",
"parameters": "()",
"return": "boolean",
"signature": "boolean isCompleted()",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 305,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 19317653,
"size": 777,
"stargazer_count": 196,
"stars": null,
"updates": null,
"url": "https://github.com/IBM-Cloud/todo-apps"
} |
19317653_7 | {
"fields": [
{
"declarator": "td1",
"modifier": "private",
"original_string": "private ToDo td1;",
"type": "ToDo",
"var_name": "td1"
},
{
"declarator": "td2",
"modifier": "private",
"original_string": "private ToDo td2;",
"type": "ToDo",
"var_name": "td2"
},
{
"declarator": "store",
"modifier": "private",
"original_string": "private ToDoStore store;",
"type": "ToDoStore",
"var_name": "store"
},
{
"declarator": "api",
"modifier": "private",
"original_string": "private ToDoAPI api;",
"type": "ToDoAPI",
"var_name": "api"
},
{
"declarator": "exceptionStore = new ToDoStore(){\n\n\t\t@Override\n\t\tpublic Collection<ToDo> getAll() throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo get(String id) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo persist(ToDo td) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo update(String id, ToDo td) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic void delete(String id) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n @Override\n public int count() throws ToDoStoreException {\n throw new ToDoStoreException(\"Error\");\n }\n\t}",
"modifier": "private",
"original_string": "private ToDoStore exceptionStore = new ToDoStore(){\n\n\t\t@Override\n\t\tpublic Collection<ToDo> getAll() throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo get(String id) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo persist(ToDo td) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo update(String id, ToDo td) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic void delete(String id) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n @Override\n public int count() throws ToDoStoreException {\n throw new ToDoStoreException(\"Error\");\n }\n\t};",
"type": "ToDoStore",
"var_name": "exceptionStore"
},
{
"declarator": "errorApi",
"modifier": "private",
"original_string": "private ToDoAPI errorApi;",
"type": "ToDoAPI",
"var_name": "errorApi"
}
],
"file": "java/bluemix-todo-app/src/test/java/net/bluemix/todo/rest/ToDoAPITest.java",
"identifier": "ToDoAPITest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n\tpublic void testNewToDoException() {\n\t\ttry {\n\t\t\tapi.newToDo(null);\n\t\t\tfail(\"Expected exception to be thrown.\");\n\t\t} catch(WebApplicationException e) {\n\t\t\tassertEquals(Response.Status.BAD_REQUEST.getStatusCode(), e.getResponse().getStatus());\n\t\t}\n\t}",
"class_method_signature": "ToDoAPITest.testNewToDoException()",
"constructor": false,
"full_signature": "@Test public void testNewToDoException()",
"identifier": "testNewToDoException",
"invocations": [
"newToDo",
"fail",
"assertEquals",
"getStatusCode",
"getStatus",
"getResponse"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void testNewToDoException()",
"testcase": true
} | {
"fields": [
{
"declarator": "store",
"modifier": "private",
"original_string": "private ToDoStore store;",
"type": "ToDoStore",
"var_name": "store"
}
],
"file": "java/bluemix-todo-app/src/main/java/net/bluemix/todo/rest/ToDoAPI.java",
"identifier": "ToDoAPI",
"interfaces": "",
"methods": [
{
"class_method_signature": "ToDoAPI.ToDoAPI()",
"constructor": true,
"full_signature": "public ToDoAPI()",
"identifier": "ToDoAPI",
"modifiers": "public",
"parameters": "()",
"return": "",
"signature": " ToDoAPI()",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.ToDoAPI(ToDoStore store)",
"constructor": true,
"full_signature": "public ToDoAPI(ToDoStore store)",
"identifier": "ToDoAPI",
"modifiers": "public",
"parameters": "(ToDoStore store)",
"return": "",
"signature": " ToDoAPI(ToDoStore store)",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.getToDo(@PathParam(\"id\") String id)",
"constructor": false,
"full_signature": "@GET @Path(\"/{id}\") @Produces(\"application/json\") public ToDo getToDo(@PathParam(\"id\") String id)",
"identifier": "getToDo",
"modifiers": "@GET @Path(\"/{id}\") @Produces(\"application/json\") public",
"parameters": "(@PathParam(\"id\") String id)",
"return": "ToDo",
"signature": "ToDo getToDo(@PathParam(\"id\") String id)",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.getToDos()",
"constructor": false,
"full_signature": "@GET @Produces(\"application/json\") public Collection<ToDo> getToDos()",
"identifier": "getToDos",
"modifiers": "@GET @Produces(\"application/json\") public",
"parameters": "()",
"return": "Collection<ToDo>",
"signature": "Collection<ToDo> getToDos()",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.newToDo(ToDo td)",
"constructor": false,
"full_signature": "@POST @Consumes(\"application/json\") @Produces(\"application/json\") public ToDo newToDo(ToDo td)",
"identifier": "newToDo",
"modifiers": "@POST @Consumes(\"application/json\") @Produces(\"application/json\") public",
"parameters": "(ToDo td)",
"return": "ToDo",
"signature": "ToDo newToDo(ToDo td)",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.updateToDo(@PathParam(\"id\") String id, ToDo td)",
"constructor": false,
"full_signature": "@PUT @Path(\"/{id}\") @Produces(\"application/json\") @Consumes(\"application/json\") public ToDo updateToDo(@PathParam(\"id\") String id, ToDo td)",
"identifier": "updateToDo",
"modifiers": "@PUT @Path(\"/{id}\") @Produces(\"application/json\") @Consumes(\"application/json\") public",
"parameters": "(@PathParam(\"id\") String id, ToDo td)",
"return": "ToDo",
"signature": "ToDo updateToDo(@PathParam(\"id\") String id, ToDo td)",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.deleteToDo(@PathParam(\"id\") String id)",
"constructor": false,
"full_signature": "@DELETE @Path(\"/{id}\") public void deleteToDo(@PathParam(\"id\") String id)",
"identifier": "deleteToDo",
"modifiers": "@DELETE @Path(\"/{id}\") public",
"parameters": "(@PathParam(\"id\") String id)",
"return": "void",
"signature": "void deleteToDo(@PathParam(\"id\") String id)",
"testcase": false
}
],
"superclass": ""
} | {
"body": "@POST\n @Consumes(\"application/json\")\n @Produces(\"application/json\")\n public ToDo newToDo(ToDo td) {\n if(td == null) {\n throw new WebApplicationException(\"Must supply a ToDo in the POST body.\", \n Response.Status.BAD_REQUEST);\n }\n try {\n return store.persist(td);\n } catch (ToDoStoreException e) {\n throw new WebApplicationException(\"Error saving ToDo.\", Response.Status.INTERNAL_SERVER_ERROR);\n }\n }",
"class_method_signature": "ToDoAPI.newToDo(ToDo td)",
"constructor": false,
"full_signature": "@POST @Consumes(\"application/json\") @Produces(\"application/json\") public ToDo newToDo(ToDo td)",
"identifier": "newToDo",
"invocations": [
"persist"
],
"modifiers": "@POST @Consumes(\"application/json\") @Produces(\"application/json\") public",
"parameters": "(ToDo td)",
"return": "ToDo",
"signature": "ToDo newToDo(ToDo td)",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 305,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 19317653,
"size": 777,
"stargazer_count": 196,
"stars": null,
"updates": null,
"url": "https://github.com/IBM-Cloud/todo-apps"
} |
19317653_12 | {
"fields": [
{
"declarator": "td1",
"modifier": "private",
"original_string": "private ToDo td1;",
"type": "ToDo",
"var_name": "td1"
},
{
"declarator": "td2",
"modifier": "private",
"original_string": "private ToDo td2;",
"type": "ToDo",
"var_name": "td2"
},
{
"declarator": "store",
"modifier": "private",
"original_string": "private ToDoStore store;",
"type": "ToDoStore",
"var_name": "store"
},
{
"declarator": "api",
"modifier": "private",
"original_string": "private ToDoAPI api;",
"type": "ToDoAPI",
"var_name": "api"
},
{
"declarator": "exceptionStore = new ToDoStore(){\n\n\t\t@Override\n\t\tpublic Collection<ToDo> getAll() throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo get(String id) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo persist(ToDo td) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo update(String id, ToDo td) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic void delete(String id) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n @Override\n public int count() throws ToDoStoreException {\n throw new ToDoStoreException(\"Error\");\n }\n\t}",
"modifier": "private",
"original_string": "private ToDoStore exceptionStore = new ToDoStore(){\n\n\t\t@Override\n\t\tpublic Collection<ToDo> getAll() throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo get(String id) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo persist(ToDo td) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo update(String id, ToDo td) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic void delete(String id) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n @Override\n public int count() throws ToDoStoreException {\n throw new ToDoStoreException(\"Error\");\n }\n\t};",
"type": "ToDoStore",
"var_name": "exceptionStore"
},
{
"declarator": "errorApi",
"modifier": "private",
"original_string": "private ToDoAPI errorApi;",
"type": "ToDoAPI",
"var_name": "errorApi"
}
],
"file": "java/bluemix-todo-app/src/test/java/net/bluemix/todo/rest/ToDoAPITest.java",
"identifier": "ToDoAPITest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n\tpublic void testUpdateToDoInternalError() {\n\t\ttry {\n\t\t\terrorApi.updateToDo(\"123\", new ToDo());\n\t\t\tfail(\"Expected exception to be thrown.\");\n\t\t} catch(WebApplicationException e) {\n\t\t\tassertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), e.getResponse().getStatus());\n\t\t}\n\t}",
"class_method_signature": "ToDoAPITest.testUpdateToDoInternalError()",
"constructor": false,
"full_signature": "@Test public void testUpdateToDoInternalError()",
"identifier": "testUpdateToDoInternalError",
"invocations": [
"updateToDo",
"fail",
"assertEquals",
"getStatusCode",
"getStatus",
"getResponse"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void testUpdateToDoInternalError()",
"testcase": true
} | {
"fields": [
{
"declarator": "store",
"modifier": "private",
"original_string": "private ToDoStore store;",
"type": "ToDoStore",
"var_name": "store"
}
],
"file": "java/bluemix-todo-app/src/main/java/net/bluemix/todo/rest/ToDoAPI.java",
"identifier": "ToDoAPI",
"interfaces": "",
"methods": [
{
"class_method_signature": "ToDoAPI.ToDoAPI()",
"constructor": true,
"full_signature": "public ToDoAPI()",
"identifier": "ToDoAPI",
"modifiers": "public",
"parameters": "()",
"return": "",
"signature": " ToDoAPI()",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.ToDoAPI(ToDoStore store)",
"constructor": true,
"full_signature": "public ToDoAPI(ToDoStore store)",
"identifier": "ToDoAPI",
"modifiers": "public",
"parameters": "(ToDoStore store)",
"return": "",
"signature": " ToDoAPI(ToDoStore store)",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.getToDo(@PathParam(\"id\") String id)",
"constructor": false,
"full_signature": "@GET @Path(\"/{id}\") @Produces(\"application/json\") public ToDo getToDo(@PathParam(\"id\") String id)",
"identifier": "getToDo",
"modifiers": "@GET @Path(\"/{id}\") @Produces(\"application/json\") public",
"parameters": "(@PathParam(\"id\") String id)",
"return": "ToDo",
"signature": "ToDo getToDo(@PathParam(\"id\") String id)",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.getToDos()",
"constructor": false,
"full_signature": "@GET @Produces(\"application/json\") public Collection<ToDo> getToDos()",
"identifier": "getToDos",
"modifiers": "@GET @Produces(\"application/json\") public",
"parameters": "()",
"return": "Collection<ToDo>",
"signature": "Collection<ToDo> getToDos()",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.newToDo(ToDo td)",
"constructor": false,
"full_signature": "@POST @Consumes(\"application/json\") @Produces(\"application/json\") public ToDo newToDo(ToDo td)",
"identifier": "newToDo",
"modifiers": "@POST @Consumes(\"application/json\") @Produces(\"application/json\") public",
"parameters": "(ToDo td)",
"return": "ToDo",
"signature": "ToDo newToDo(ToDo td)",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.updateToDo(@PathParam(\"id\") String id, ToDo td)",
"constructor": false,
"full_signature": "@PUT @Path(\"/{id}\") @Produces(\"application/json\") @Consumes(\"application/json\") public ToDo updateToDo(@PathParam(\"id\") String id, ToDo td)",
"identifier": "updateToDo",
"modifiers": "@PUT @Path(\"/{id}\") @Produces(\"application/json\") @Consumes(\"application/json\") public",
"parameters": "(@PathParam(\"id\") String id, ToDo td)",
"return": "ToDo",
"signature": "ToDo updateToDo(@PathParam(\"id\") String id, ToDo td)",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.deleteToDo(@PathParam(\"id\") String id)",
"constructor": false,
"full_signature": "@DELETE @Path(\"/{id}\") public void deleteToDo(@PathParam(\"id\") String id)",
"identifier": "deleteToDo",
"modifiers": "@DELETE @Path(\"/{id}\") public",
"parameters": "(@PathParam(\"id\") String id)",
"return": "void",
"signature": "void deleteToDo(@PathParam(\"id\") String id)",
"testcase": false
}
],
"superclass": ""
} | {
"body": "@PUT @Path(\"/{id}\")\n @Produces(\"application/json\")\n @Consumes(\"application/json\")\n public ToDo updateToDo(@PathParam(\"id\") String id, ToDo td) {\n if(id == null) {\n throw new WebApplicationException(\"Must supply an ID, for example /api/todos/123.\", \n Response.Status.BAD_REQUEST);\n }\n if(td == null) {\n throw new WebApplicationException(\"Must supply a ToDo in the PUT body.\", \n Response.Status.BAD_REQUEST);\n }\n try {\n ToDo updatedTd = store.update(id, td);\n if(updatedTd == null) {\n throw new WebApplicationException(\"The ToDo with the ID \" + id + \" does not exist.\",\n Response.Status.BAD_REQUEST);\n }\n return updatedTd;\n } catch (ToDoStoreException e) {\n throw new WebApplicationException(\"Error updating ToDo.\", Response.Status.INTERNAL_SERVER_ERROR);\n }\n }",
"class_method_signature": "ToDoAPI.updateToDo(@PathParam(\"id\") String id, ToDo td)",
"constructor": false,
"full_signature": "@PUT @Path(\"/{id}\") @Produces(\"application/json\") @Consumes(\"application/json\") public ToDo updateToDo(@PathParam(\"id\") String id, ToDo td)",
"identifier": "updateToDo",
"invocations": [
"update"
],
"modifiers": "@PUT @Path(\"/{id}\") @Produces(\"application/json\") @Consumes(\"application/json\") public",
"parameters": "(@PathParam(\"id\") String id, ToDo td)",
"return": "ToDo",
"signature": "ToDo updateToDo(@PathParam(\"id\") String id, ToDo td)",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 305,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 19317653,
"size": 777,
"stargazer_count": 196,
"stars": null,
"updates": null,
"url": "https://github.com/IBM-Cloud/todo-apps"
} |
19317653_45 | {
"fields": [],
"file": "java/bluemix-todo-app/src/test/java/net/bluemix/todo/store/MongoStoreTest.java",
"identifier": "MongoStoreTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n\tpublic void testGetAll() {\n\t\tDBCollection coll = createMockCollection();\n\t\tDBCursor cursor = createMockCursor();\n\t\texpect(cursor.hasNext()).andAnswer(new IAnswer<Boolean>() {\n\t\t\tprivate int count = 0;\n\t\t\t@Override\n\t\t\tpublic Boolean answer() throws Throwable {\n\t\t\t\tcount++;\n\t\t\t\treturn count == 3 ? false : true;\n\t\t\t}\n\t\t}).anyTimes();\n\t\texpect(cursor.next()).andAnswer(new IAnswer<DBObject>() {\n\t\t\tprivate int count = 0;\n\t\t\t@Override\n\t\t\tpublic DBObject answer() throws Throwable {\n\t\t\t\tcount++;\n\t\t\t\tBasicDBObject dbObj = new BasicDBObject();\n\t\t\t\tdbObj.put(\"title\", \"This is todo \" + count);\n\t\t\t\tdbObj.put(\"completed\", false);\n\t\t\t\tdbObj.put(\"order\", count);\n\t\t\t\t//Object IDs must be 24 characters long\n\t\t\t\tdbObj.put(\"_id\", new ObjectId(\"aaaaaaaaaaaaaaaaaaaaaaa\" + count));\n\t\t\t\treturn dbObj;\n\t\t\t}\n\t\t}).anyTimes();\n\t\tcursor.close();\n\t\texpectLastCall();\n\t\treplay(cursor);\n\t\texpect(coll.find()).andReturn(cursor);\n\t\treplay(coll);\n\t\tMongoStore store = new MongoStore(coll);\n\t\tCollection<ToDo> todos = store.getAll();\n\t\tList<ToDo> testToDos = new ArrayList<ToDo>();\n\t\tToDo td1 = new ToDo();\n\t\ttd1.setId(\"aaaaaaaaaaaaaaaaaaaaaaa1\");\n\t\ttd1.setTitle(\"This is todo 1\");\n\t\ttd1.setOrder(1);\n\t\tToDo td2 = new ToDo();\n\t\ttd2.setId(\"aaaaaaaaaaaaaaaaaaaaaaa2\");\n\t\ttd2.setTitle(\"This is todo 2\");\n\t\ttd2.setOrder(2);\n\t\ttestToDos.add(td1);\n\t\ttestToDos.add(td2);\n\t\tassertEquals(testToDos, todos);\n\t\tverify(cursor);\n\t\tverify(coll);\n\t}",
"class_method_signature": "MongoStoreTest.testGetAll()",
"constructor": false,
"full_signature": "@Test public void testGetAll()",
"identifier": "testGetAll",
"invocations": [
"createMockCollection",
"createMockCursor",
"anyTimes",
"andAnswer",
"expect",
"hasNext",
"anyTimes",
"andAnswer",
"expect",
"next",
"put",
"put",
"put",
"put",
"close",
"expectLastCall",
"replay",
"andReturn",
"expect",
"find",
"replay",
"getAll",
"setId",
"setTitle",
"setOrder",
"setId",
"setTitle",
"setOrder",
"add",
"add",
"assertEquals",
"verify",
"verify"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void testGetAll()",
"testcase": true
} | {
"fields": [
{
"declarator": "coll",
"modifier": "private",
"original_string": "private DBCollection coll;",
"type": "DBCollection",
"var_name": "coll"
}
],
"file": "java/bluemix-todo-app/src/main/java/net/bluemix/todo/store/MongoStore.java",
"identifier": "MongoStore",
"interfaces": "implements ToDoStore",
"methods": [
{
"class_method_signature": "MongoStore.MongoStore(DBCollection coll)",
"constructor": true,
"full_signature": "public MongoStore(DBCollection coll)",
"identifier": "MongoStore",
"modifiers": "public",
"parameters": "(DBCollection coll)",
"return": "",
"signature": " MongoStore(DBCollection coll)",
"testcase": false
},
{
"class_method_signature": "MongoStore.getAll()",
"constructor": false,
"full_signature": "@Override public Collection<ToDo> getAll()",
"identifier": "getAll",
"modifiers": "@Override public",
"parameters": "()",
"return": "Collection<ToDo>",
"signature": "Collection<ToDo> getAll()",
"testcase": false
},
{
"class_method_signature": "MongoStore.get(String id)",
"constructor": false,
"full_signature": "@Override public ToDo get(String id)",
"identifier": "get",
"modifiers": "@Override public",
"parameters": "(String id)",
"return": "ToDo",
"signature": "ToDo get(String id)",
"testcase": false
},
{
"class_method_signature": "MongoStore.persist(ToDo td)",
"constructor": false,
"full_signature": "@Override public ToDo persist(ToDo td)",
"identifier": "persist",
"modifiers": "@Override public",
"parameters": "(ToDo td)",
"return": "ToDo",
"signature": "ToDo persist(ToDo td)",
"testcase": false
},
{
"class_method_signature": "MongoStore.update(String id, ToDo td)",
"constructor": false,
"full_signature": "@Override public ToDo update(String id, ToDo td)",
"identifier": "update",
"modifiers": "@Override public",
"parameters": "(String id, ToDo td)",
"return": "ToDo",
"signature": "ToDo update(String id, ToDo td)",
"testcase": false
},
{
"class_method_signature": "MongoStore.delete(String id)",
"constructor": false,
"full_signature": "@Override public void delete(String id)",
"identifier": "delete",
"modifiers": "@Override public",
"parameters": "(String id)",
"return": "void",
"signature": "void delete(String id)",
"testcase": false
},
{
"class_method_signature": "MongoStore.createToDo(DBObject dbObj)",
"constructor": false,
"full_signature": "private ToDo createToDo(DBObject dbObj)",
"identifier": "createToDo",
"modifiers": "private",
"parameters": "(DBObject dbObj)",
"return": "ToDo",
"signature": "ToDo createToDo(DBObject dbObj)",
"testcase": false
},
{
"class_method_signature": "MongoStore.convertToDbObject(ToDo td)",
"constructor": false,
"full_signature": "private DBObject convertToDbObject(ToDo td)",
"identifier": "convertToDbObject",
"modifiers": "private",
"parameters": "(ToDo td)",
"return": "DBObject",
"signature": "DBObject convertToDbObject(ToDo td)",
"testcase": false
},
{
"class_method_signature": "MongoStore.count()",
"constructor": false,
"full_signature": "@Override public int count()",
"identifier": "count",
"modifiers": "@Override public",
"parameters": "()",
"return": "int",
"signature": "int count()",
"testcase": false
}
],
"superclass": ""
} | {
"body": "@Override\n public Collection<ToDo> getAll() {\n List<ToDo> todos = new ArrayList<ToDo>();\n DBCursor cursor = coll.find();\n while(cursor.hasNext()) {\n todos.add(createToDo(cursor.next()));\n }\n cursor.close();\n return todos;\n }",
"class_method_signature": "MongoStore.getAll()",
"constructor": false,
"full_signature": "@Override public Collection<ToDo> getAll()",
"identifier": "getAll",
"invocations": [
"find",
"hasNext",
"add",
"createToDo",
"next",
"close"
],
"modifiers": "@Override public",
"parameters": "()",
"return": "Collection<ToDo>",
"signature": "Collection<ToDo> getAll()",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 305,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 19317653,
"size": 777,
"stargazer_count": 196,
"stars": null,
"updates": null,
"url": "https://github.com/IBM-Cloud/todo-apps"
} |
19317653_53 | {
"fields": [
{
"declarator": "docs",
"modifier": "private",
"original_string": "private CloudantAllDocs docs;",
"type": "CloudantAllDocs",
"var_name": "docs"
},
{
"declarator": "rows",
"modifier": "private",
"original_string": "private List<CloudantRow> rows;",
"type": "List<CloudantRow>",
"var_name": "rows"
},
{
"declarator": "row1",
"modifier": "private",
"original_string": "private CloudantRow row1;",
"type": "CloudantRow",
"var_name": "row1"
},
{
"declarator": "row2",
"modifier": "private",
"original_string": "private CloudantRow row2;",
"type": "CloudantRow",
"var_name": "row2"
},
{
"declarator": "row3",
"modifier": "private",
"original_string": "private CloudantRow row3;",
"type": "CloudantRow",
"var_name": "row3"
},
{
"declarator": "ctd1",
"modifier": "private",
"original_string": "private CloudantToDo ctd1;",
"type": "CloudantToDo",
"var_name": "ctd1"
},
{
"declarator": "ctd2",
"modifier": "private",
"original_string": "private CloudantToDo ctd2;",
"type": "CloudantToDo",
"var_name": "ctd2"
},
{
"declarator": "ctd3",
"modifier": "private",
"original_string": "private CloudantToDo ctd3;",
"type": "CloudantToDo",
"var_name": "ctd3"
},
{
"declarator": "count",
"modifier": "private",
"original_string": "private CloudantCount count;",
"type": "CloudantCount",
"var_name": "count"
},
{
"declarator": "reducedRows",
"modifier": "private",
"original_string": "private List<CloudantReducedRow> reducedRows;",
"type": "List<CloudantReducedRow>",
"var_name": "reducedRows"
},
{
"declarator": "reducedRow",
"modifier": "private",
"original_string": "private CloudantReducedRow reducedRow;",
"type": "CloudantReducedRow",
"var_name": "reducedRow"
}
],
"file": "java/bluemix-todo-app/src/test/java/net/bluemix/todo/store/CloudantStoreTest.java",
"identifier": "CloudantStoreTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testPersist() throws Exception {\n IMocksControl control = createControl();\n Response resp = control.createMock(Response.class);\n expect(resp.getStatus()).andReturn(200).times(2);\n expect(resp.getStatus()).andReturn(201);\n CloudantPostResponse postResp = new CloudantPostResponse();\n postResp.setId(\"123\");\n postResp.setOk(true);\n postResp.setRev(\"abc\");\n Capture<Class<CloudantPostResponse>> classCapture = new Capture<Class<CloudantPostResponse>>();\n expect(resp.readEntity(capture(classCapture))).andReturn(postResp);\n replay(resp);\n WebTarget wt = createMockWebTarget();\n Invocation.Builder builder = createBuilder();\n ToDo td = new ToDo();\n td.setTitle(\"this is a test\");\n expect(builder.post(isA(Entity.class))).andReturn(resp);\n expect(builder.get()).andReturn(resp).times(2);\n replay(builder);\n expect(wt.path(eq(\"bluemix-todo\"))).andReturn(wt).times(2);\n expect(wt.path(eq(\"todos\"))).andReturn(wt);\n expect(wt.path(eq(\"_design\"))).andReturn(wt).times(1);\n expect(wt.request(eq(\"application/json\"))).andReturn(builder).anyTimes();\n replay(wt);\n CloudantStore store = new CloudantStore(wt);\n ToDo testTd = new ToDo();\n testTd.setTitle(\"this is a test\");\n testTd.setId(\"123\");\n assertEquals(testTd, store.persist(td));\n assertEquals(CloudantPostResponse.class, classCapture.getValue());\n verify(resp);\n verify(wt);\n verify(builder);\n }",
"class_method_signature": "CloudantStoreTest.testPersist()",
"constructor": false,
"full_signature": "@Test public void testPersist()",
"identifier": "testPersist",
"invocations": [
"createControl",
"createMock",
"times",
"andReturn",
"expect",
"getStatus",
"andReturn",
"expect",
"getStatus",
"setId",
"setOk",
"setRev",
"andReturn",
"expect",
"readEntity",
"capture",
"replay",
"createMockWebTarget",
"createBuilder",
"setTitle",
"andReturn",
"expect",
"post",
"isA",
"times",
"andReturn",
"expect",
"get",
"replay",
"times",
"andReturn",
"expect",
"path",
"eq",
"andReturn",
"expect",
"path",
"eq",
"times",
"andReturn",
"expect",
"path",
"eq",
"anyTimes",
"andReturn",
"expect",
"request",
"eq",
"replay",
"setTitle",
"setId",
"assertEquals",
"persist",
"assertEquals",
"getValue",
"verify",
"verify",
"verify"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void testPersist()",
"testcase": true
} | {
"fields": [
{
"declarator": "REVISION_PARAM = \"rev\"",
"modifier": "private static final",
"original_string": "private static final String REVISION_PARAM = \"rev\";",
"type": "String",
"var_name": "REVISION_PARAM"
},
{
"declarator": "DESIGN_DOC_NAME = \"todos\"",
"modifier": "private static final",
"original_string": "private static final String DESIGN_DOC_NAME = \"todos\";",
"type": "String",
"var_name": "DESIGN_DOC_NAME"
},
{
"declarator": "VIEW_NAME = \"allTodos\"",
"modifier": "private static final",
"original_string": "private static final String VIEW_NAME = \"allTodos\";",
"type": "String",
"var_name": "VIEW_NAME"
},
{
"declarator": "DESIGN_DOC = \n \"{\" +\n \"\\\"views\\\": {\" +\n \"\\\"allTodos\\\": {\" +\n \"\\\"reduce\\\": \\\"_count\\\",\" +\n \"\\\"map\\\": \\\"function(doc){if(doc.title && doc.completed != null){emit(doc.order,{title: doc.title,completed: doc.completed})}}\\\"\" +\n \"}\" +\n \"}\" +\n \"}\"",
"modifier": "private static final",
"original_string": "private static final String DESIGN_DOC = \n \"{\" +\n \"\\\"views\\\": {\" +\n \"\\\"allTodos\\\": {\" +\n \"\\\"reduce\\\": \\\"_count\\\",\" +\n \"\\\"map\\\": \\\"function(doc){if(doc.title && doc.completed != null){emit(doc.order,{title: doc.title,completed: doc.completed})}}\\\"\" +\n \"}\" +\n \"}\" +\n \"}\";",
"type": "String",
"var_name": "DESIGN_DOC"
},
{
"declarator": "LOG = Logger.getLogger(CloudantStore.class.getName())",
"modifier": "private static final",
"original_string": "private static final Logger LOG = Logger.getLogger(CloudantStore.class.getName());",
"type": "Logger",
"var_name": "LOG"
},
{
"declarator": "target",
"modifier": "private",
"original_string": "private WebTarget target;",
"type": "WebTarget",
"var_name": "target"
}
],
"file": "java/bluemix-todo-app/src/main/java/net/bluemix/todo/store/CloudantStore.java",
"identifier": "CloudantStore",
"interfaces": "implements ToDoStore",
"methods": [
{
"class_method_signature": "CloudantStore.CloudantStore(WebTarget target)",
"constructor": true,
"full_signature": "public CloudantStore(WebTarget target)",
"identifier": "CloudantStore",
"modifiers": "public",
"parameters": "(WebTarget target)",
"return": "",
"signature": " CloudantStore(WebTarget target)",
"testcase": false
},
{
"class_method_signature": "CloudantStore.createDB(WebTarget target)",
"constructor": false,
"full_signature": "private void createDB(WebTarget target)",
"identifier": "createDB",
"modifiers": "private",
"parameters": "(WebTarget target)",
"return": "void",
"signature": "void createDB(WebTarget target)",
"testcase": false
},
{
"class_method_signature": "CloudantStore.createDesignDoc(WebTarget target)",
"constructor": false,
"full_signature": "private static void createDesignDoc(WebTarget target)",
"identifier": "createDesignDoc",
"modifiers": "private static",
"parameters": "(WebTarget target)",
"return": "void",
"signature": "void createDesignDoc(WebTarget target)",
"testcase": false
},
{
"class_method_signature": "CloudantStore.getAll()",
"constructor": false,
"full_signature": "@Override public Collection<ToDo> getAll()",
"identifier": "getAll",
"modifiers": "@Override public",
"parameters": "()",
"return": "Collection<ToDo>",
"signature": "Collection<ToDo> getAll()",
"testcase": false
},
{
"class_method_signature": "CloudantStore.get(String id)",
"constructor": false,
"full_signature": "@Override public ToDo get(String id)",
"identifier": "get",
"modifiers": "@Override public",
"parameters": "(String id)",
"return": "ToDo",
"signature": "ToDo get(String id)",
"testcase": false
},
{
"class_method_signature": "CloudantStore.getRequest(String id)",
"constructor": false,
"full_signature": "private Response getRequest(String id)",
"identifier": "getRequest",
"modifiers": "private",
"parameters": "(String id)",
"return": "Response",
"signature": "Response getRequest(String id)",
"testcase": false
},
{
"class_method_signature": "CloudantStore.persist(ToDo td)",
"constructor": false,
"full_signature": "@Override public ToDo persist(ToDo td)",
"identifier": "persist",
"modifiers": "@Override public",
"parameters": "(ToDo td)",
"return": "ToDo",
"signature": "ToDo persist(ToDo td)",
"testcase": false
},
{
"class_method_signature": "CloudantStore.update(String id, ToDo td)",
"constructor": false,
"full_signature": "@Override public ToDo update(String id, ToDo td)",
"identifier": "update",
"modifiers": "@Override public",
"parameters": "(String id, ToDo td)",
"return": "ToDo",
"signature": "ToDo update(String id, ToDo td)",
"testcase": false
},
{
"class_method_signature": "CloudantStore.delete(String id)",
"constructor": false,
"full_signature": "@Override public void delete(String id)",
"identifier": "delete",
"modifiers": "@Override public",
"parameters": "(String id)",
"return": "void",
"signature": "void delete(String id)",
"testcase": false
},
{
"class_method_signature": "CloudantStore.count()",
"constructor": false,
"full_signature": "@Override public int count()",
"identifier": "count",
"modifiers": "@Override public",
"parameters": "()",
"return": "int",
"signature": "int count()",
"testcase": false
}
],
"superclass": ""
} | {
"body": "@Override\n public ToDo persist(ToDo td) throws ToDoStoreException {\n Response newdoc = target.request(MediaType.APPLICATION_JSON).post(Entity.entity(td, MediaType.APPLICATION_JSON));\n int status = newdoc.getStatus();\n if(status == HttpURLConnection.HTTP_CREATED) {\n CloudantPostResponse post = newdoc.readEntity(CloudantPostResponse.class);\n td.setId(post.getId());\n return td;\n } else {\n throw new ToDoStoreException(\"There was an error POSTing the ToDo to Cloudant. Error \" \n + status);\n }\n }",
"class_method_signature": "CloudantStore.persist(ToDo td)",
"constructor": false,
"full_signature": "@Override public ToDo persist(ToDo td)",
"identifier": "persist",
"invocations": [
"post",
"request",
"entity",
"getStatus",
"readEntity",
"setId",
"getId"
],
"modifiers": "@Override public",
"parameters": "(ToDo td)",
"return": "ToDo",
"signature": "ToDo persist(ToDo td)",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 305,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 19317653,
"size": 777,
"stargazer_count": 196,
"stars": null,
"updates": null,
"url": "https://github.com/IBM-Cloud/todo-apps"
} |
19317653_52 | {
"fields": [
{
"declarator": "docs",
"modifier": "private",
"original_string": "private CloudantAllDocs docs;",
"type": "CloudantAllDocs",
"var_name": "docs"
},
{
"declarator": "rows",
"modifier": "private",
"original_string": "private List<CloudantRow> rows;",
"type": "List<CloudantRow>",
"var_name": "rows"
},
{
"declarator": "row1",
"modifier": "private",
"original_string": "private CloudantRow row1;",
"type": "CloudantRow",
"var_name": "row1"
},
{
"declarator": "row2",
"modifier": "private",
"original_string": "private CloudantRow row2;",
"type": "CloudantRow",
"var_name": "row2"
},
{
"declarator": "row3",
"modifier": "private",
"original_string": "private CloudantRow row3;",
"type": "CloudantRow",
"var_name": "row3"
},
{
"declarator": "ctd1",
"modifier": "private",
"original_string": "private CloudantToDo ctd1;",
"type": "CloudantToDo",
"var_name": "ctd1"
},
{
"declarator": "ctd2",
"modifier": "private",
"original_string": "private CloudantToDo ctd2;",
"type": "CloudantToDo",
"var_name": "ctd2"
},
{
"declarator": "ctd3",
"modifier": "private",
"original_string": "private CloudantToDo ctd3;",
"type": "CloudantToDo",
"var_name": "ctd3"
},
{
"declarator": "count",
"modifier": "private",
"original_string": "private CloudantCount count;",
"type": "CloudantCount",
"var_name": "count"
},
{
"declarator": "reducedRows",
"modifier": "private",
"original_string": "private List<CloudantReducedRow> reducedRows;",
"type": "List<CloudantReducedRow>",
"var_name": "reducedRows"
},
{
"declarator": "reducedRow",
"modifier": "private",
"original_string": "private CloudantReducedRow reducedRow;",
"type": "CloudantReducedRow",
"var_name": "reducedRow"
}
],
"file": "java/bluemix-todo-app/src/test/java/net/bluemix/todo/store/CloudantStoreTest.java",
"identifier": "CloudantStoreTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testGet() throws Exception {\n IMocksControl control = createControl();\n Response resp = control.createMock(Response.class);\n expect(resp.getStatus()).andReturn(200).times(3);\n Capture<Class<CloudantToDo>> classCapture = new Capture<Class<CloudantToDo>>();\n expect(resp.readEntity(capture(classCapture))).andReturn(ctd1);\n replay(resp);\n WebTarget wt = createMockWebTarget();\n Invocation.Builder builder = createBuilder();\n expect(builder.get()).andReturn(resp).times(3);\n replay(builder);\n expect(wt.path(eq(\"bluemix-todo\"))).andReturn(wt).times(2);\n expect(wt.path(eq(\"todos\"))).andReturn(wt);\n expect(wt.path(eq(\"_design\"))).andReturn(wt).times(1);\n expect(wt.path(eq(\"123\"))).andReturn(wt);\n expect(wt.request(eq(\"application/json\"))).andReturn(builder).anyTimes();\n replay(wt);\n CloudantStore store = new CloudantStore(wt);\n assertEquals(ctd1.getToDo(), store.get(\"123\"));\n assertEquals(CloudantToDo.class, classCapture.getValue());\n verify(resp);\n verify(wt);\n verify(builder);\n }",
"class_method_signature": "CloudantStoreTest.testGet()",
"constructor": false,
"full_signature": "@Test public void testGet()",
"identifier": "testGet",
"invocations": [
"createControl",
"createMock",
"times",
"andReturn",
"expect",
"getStatus",
"andReturn",
"expect",
"readEntity",
"capture",
"replay",
"createMockWebTarget",
"createBuilder",
"times",
"andReturn",
"expect",
"get",
"replay",
"times",
"andReturn",
"expect",
"path",
"eq",
"andReturn",
"expect",
"path",
"eq",
"times",
"andReturn",
"expect",
"path",
"eq",
"andReturn",
"expect",
"path",
"eq",
"anyTimes",
"andReturn",
"expect",
"request",
"eq",
"replay",
"assertEquals",
"getToDo",
"get",
"assertEquals",
"getValue",
"verify",
"verify",
"verify"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void testGet()",
"testcase": true
} | {
"fields": [
{
"declarator": "REVISION_PARAM = \"rev\"",
"modifier": "private static final",
"original_string": "private static final String REVISION_PARAM = \"rev\";",
"type": "String",
"var_name": "REVISION_PARAM"
},
{
"declarator": "DESIGN_DOC_NAME = \"todos\"",
"modifier": "private static final",
"original_string": "private static final String DESIGN_DOC_NAME = \"todos\";",
"type": "String",
"var_name": "DESIGN_DOC_NAME"
},
{
"declarator": "VIEW_NAME = \"allTodos\"",
"modifier": "private static final",
"original_string": "private static final String VIEW_NAME = \"allTodos\";",
"type": "String",
"var_name": "VIEW_NAME"
},
{
"declarator": "DESIGN_DOC = \n \"{\" +\n \"\\\"views\\\": {\" +\n \"\\\"allTodos\\\": {\" +\n \"\\\"reduce\\\": \\\"_count\\\",\" +\n \"\\\"map\\\": \\\"function(doc){if(doc.title && doc.completed != null){emit(doc.order,{title: doc.title,completed: doc.completed})}}\\\"\" +\n \"}\" +\n \"}\" +\n \"}\"",
"modifier": "private static final",
"original_string": "private static final String DESIGN_DOC = \n \"{\" +\n \"\\\"views\\\": {\" +\n \"\\\"allTodos\\\": {\" +\n \"\\\"reduce\\\": \\\"_count\\\",\" +\n \"\\\"map\\\": \\\"function(doc){if(doc.title && doc.completed != null){emit(doc.order,{title: doc.title,completed: doc.completed})}}\\\"\" +\n \"}\" +\n \"}\" +\n \"}\";",
"type": "String",
"var_name": "DESIGN_DOC"
},
{
"declarator": "LOG = Logger.getLogger(CloudantStore.class.getName())",
"modifier": "private static final",
"original_string": "private static final Logger LOG = Logger.getLogger(CloudantStore.class.getName());",
"type": "Logger",
"var_name": "LOG"
},
{
"declarator": "target",
"modifier": "private",
"original_string": "private WebTarget target;",
"type": "WebTarget",
"var_name": "target"
}
],
"file": "java/bluemix-todo-app/src/main/java/net/bluemix/todo/store/CloudantStore.java",
"identifier": "CloudantStore",
"interfaces": "implements ToDoStore",
"methods": [
{
"class_method_signature": "CloudantStore.CloudantStore(WebTarget target)",
"constructor": true,
"full_signature": "public CloudantStore(WebTarget target)",
"identifier": "CloudantStore",
"modifiers": "public",
"parameters": "(WebTarget target)",
"return": "",
"signature": " CloudantStore(WebTarget target)",
"testcase": false
},
{
"class_method_signature": "CloudantStore.createDB(WebTarget target)",
"constructor": false,
"full_signature": "private void createDB(WebTarget target)",
"identifier": "createDB",
"modifiers": "private",
"parameters": "(WebTarget target)",
"return": "void",
"signature": "void createDB(WebTarget target)",
"testcase": false
},
{
"class_method_signature": "CloudantStore.createDesignDoc(WebTarget target)",
"constructor": false,
"full_signature": "private static void createDesignDoc(WebTarget target)",
"identifier": "createDesignDoc",
"modifiers": "private static",
"parameters": "(WebTarget target)",
"return": "void",
"signature": "void createDesignDoc(WebTarget target)",
"testcase": false
},
{
"class_method_signature": "CloudantStore.getAll()",
"constructor": false,
"full_signature": "@Override public Collection<ToDo> getAll()",
"identifier": "getAll",
"modifiers": "@Override public",
"parameters": "()",
"return": "Collection<ToDo>",
"signature": "Collection<ToDo> getAll()",
"testcase": false
},
{
"class_method_signature": "CloudantStore.get(String id)",
"constructor": false,
"full_signature": "@Override public ToDo get(String id)",
"identifier": "get",
"modifiers": "@Override public",
"parameters": "(String id)",
"return": "ToDo",
"signature": "ToDo get(String id)",
"testcase": false
},
{
"class_method_signature": "CloudantStore.getRequest(String id)",
"constructor": false,
"full_signature": "private Response getRequest(String id)",
"identifier": "getRequest",
"modifiers": "private",
"parameters": "(String id)",
"return": "Response",
"signature": "Response getRequest(String id)",
"testcase": false
},
{
"class_method_signature": "CloudantStore.persist(ToDo td)",
"constructor": false,
"full_signature": "@Override public ToDo persist(ToDo td)",
"identifier": "persist",
"modifiers": "@Override public",
"parameters": "(ToDo td)",
"return": "ToDo",
"signature": "ToDo persist(ToDo td)",
"testcase": false
},
{
"class_method_signature": "CloudantStore.update(String id, ToDo td)",
"constructor": false,
"full_signature": "@Override public ToDo update(String id, ToDo td)",
"identifier": "update",
"modifiers": "@Override public",
"parameters": "(String id, ToDo td)",
"return": "ToDo",
"signature": "ToDo update(String id, ToDo td)",
"testcase": false
},
{
"class_method_signature": "CloudantStore.delete(String id)",
"constructor": false,
"full_signature": "@Override public void delete(String id)",
"identifier": "delete",
"modifiers": "@Override public",
"parameters": "(String id)",
"return": "void",
"signature": "void delete(String id)",
"testcase": false
},
{
"class_method_signature": "CloudantStore.count()",
"constructor": false,
"full_signature": "@Override public int count()",
"identifier": "count",
"modifiers": "@Override public",
"parameters": "()",
"return": "int",
"signature": "int count()",
"testcase": false
}
],
"superclass": ""
} | {
"body": "@Override\n public ToDo get(String id) throws ToDoStoreException {\n Response docResp = getRequest(id);\n int status = docResp.getStatus();\n if(status == HttpURLConnection.HTTP_OK) {\n CloudantToDo td = docResp.readEntity(CloudantToDo.class); \n return td.getToDo();\n } else {\n throw new ToDoStoreException(\"There was an error retrieving the doc with id \" + id \n + \"from Cloudant. Error \" + status);\n }\n }",
"class_method_signature": "CloudantStore.get(String id)",
"constructor": false,
"full_signature": "@Override public ToDo get(String id)",
"identifier": "get",
"invocations": [
"getRequest",
"getStatus",
"readEntity",
"getToDo"
],
"modifiers": "@Override public",
"parameters": "(String id)",
"return": "ToDo",
"signature": "ToDo get(String id)",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 305,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 19317653,
"size": 777,
"stargazer_count": 196,
"stars": null,
"updates": null,
"url": "https://github.com/IBM-Cloud/todo-apps"
} |
19317653_44 | {
"fields": [
{
"declarator": "td1",
"modifier": "",
"original_string": "ToDo td1;",
"type": "ToDo",
"var_name": "td1"
},
{
"declarator": "td2",
"modifier": "",
"original_string": "ToDo td2;",
"type": "ToDo",
"var_name": "td2"
},
{
"declarator": "emptyStore",
"modifier": "private",
"original_string": "private ToDoStore emptyStore;",
"type": "ToDoStore",
"var_name": "emptyStore"
},
{
"declarator": "populatedStore",
"modifier": "private",
"original_string": "private ToDoStore populatedStore;",
"type": "ToDoStore",
"var_name": "populatedStore"
}
],
"file": "java/bluemix-todo-app/src/test/java/net/bluemix/todo/store/InMemoryStoreTest.java",
"identifier": "InMemoryStoreTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n\tpublic void testCount() throws Exception {\n\t assertEquals(0, emptyStore.count());\n\t assertEquals(2, populatedStore.count());\n\t}",
"class_method_signature": "InMemoryStoreTest.testCount()",
"constructor": false,
"full_signature": "@Test public void testCount()",
"identifier": "testCount",
"invocations": [
"assertEquals",
"count",
"assertEquals",
"count"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void testCount()",
"testcase": true
} | {
"fields": [
{
"declarator": "store",
"modifier": "private",
"original_string": "private Map<String, ToDo> store;",
"type": "Map<String, ToDo>",
"var_name": "store"
}
],
"file": "java/bluemix-todo-app/src/main/java/net/bluemix/todo/store/InMemoryStore.java",
"identifier": "InMemoryStore",
"interfaces": "implements ToDoStore",
"methods": [
{
"class_method_signature": "InMemoryStore.InMemoryStore()",
"constructor": true,
"full_signature": "public InMemoryStore()",
"identifier": "InMemoryStore",
"modifiers": "public",
"parameters": "()",
"return": "",
"signature": " InMemoryStore()",
"testcase": false
},
{
"class_method_signature": "InMemoryStore.getAll()",
"constructor": false,
"full_signature": "@Override public Collection<ToDo> getAll()",
"identifier": "getAll",
"modifiers": "@Override public",
"parameters": "()",
"return": "Collection<ToDo>",
"signature": "Collection<ToDo> getAll()",
"testcase": false
},
{
"class_method_signature": "InMemoryStore.get(String id)",
"constructor": false,
"full_signature": "@Override public ToDo get(String id)",
"identifier": "get",
"modifiers": "@Override public",
"parameters": "(String id)",
"return": "ToDo",
"signature": "ToDo get(String id)",
"testcase": false
},
{
"class_method_signature": "InMemoryStore.persist(ToDo td)",
"constructor": false,
"full_signature": "@Override public ToDo persist(ToDo td)",
"identifier": "persist",
"modifiers": "@Override public",
"parameters": "(ToDo td)",
"return": "ToDo",
"signature": "ToDo persist(ToDo td)",
"testcase": false
},
{
"class_method_signature": "InMemoryStore.update(String id, ToDo td)",
"constructor": false,
"full_signature": "@Override public ToDo update(String id, ToDo td)",
"identifier": "update",
"modifiers": "@Override public",
"parameters": "(String id, ToDo td)",
"return": "ToDo",
"signature": "ToDo update(String id, ToDo td)",
"testcase": false
},
{
"class_method_signature": "InMemoryStore.delete(String id)",
"constructor": false,
"full_signature": "@Override public void delete(String id)",
"identifier": "delete",
"modifiers": "@Override public",
"parameters": "(String id)",
"return": "void",
"signature": "void delete(String id)",
"testcase": false
},
{
"class_method_signature": "InMemoryStore.count()",
"constructor": false,
"full_signature": "@Override public int count()",
"identifier": "count",
"modifiers": "@Override public",
"parameters": "()",
"return": "int",
"signature": "int count()",
"testcase": false
}
],
"superclass": ""
} | {
"body": "@Override\n public int count() throws ToDoStoreException {\n return store.size();\n }",
"class_method_signature": "InMemoryStore.count()",
"constructor": false,
"full_signature": "@Override public int count()",
"identifier": "count",
"invocations": [
"size"
],
"modifiers": "@Override public",
"parameters": "()",
"return": "int",
"signature": "int count()",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 305,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 19317653,
"size": 777,
"stargazer_count": 196,
"stars": null,
"updates": null,
"url": "https://github.com/IBM-Cloud/todo-apps"
} |
19317653_13 | {
"fields": [
{
"declarator": "td1",
"modifier": "private",
"original_string": "private ToDo td1;",
"type": "ToDo",
"var_name": "td1"
},
{
"declarator": "td2",
"modifier": "private",
"original_string": "private ToDo td2;",
"type": "ToDo",
"var_name": "td2"
},
{
"declarator": "store",
"modifier": "private",
"original_string": "private ToDoStore store;",
"type": "ToDoStore",
"var_name": "store"
},
{
"declarator": "api",
"modifier": "private",
"original_string": "private ToDoAPI api;",
"type": "ToDoAPI",
"var_name": "api"
},
{
"declarator": "exceptionStore = new ToDoStore(){\n\n\t\t@Override\n\t\tpublic Collection<ToDo> getAll() throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo get(String id) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo persist(ToDo td) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo update(String id, ToDo td) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic void delete(String id) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n @Override\n public int count() throws ToDoStoreException {\n throw new ToDoStoreException(\"Error\");\n }\n\t}",
"modifier": "private",
"original_string": "private ToDoStore exceptionStore = new ToDoStore(){\n\n\t\t@Override\n\t\tpublic Collection<ToDo> getAll() throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo get(String id) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo persist(ToDo td) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo update(String id, ToDo td) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic void delete(String id) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n @Override\n public int count() throws ToDoStoreException {\n throw new ToDoStoreException(\"Error\");\n }\n\t};",
"type": "ToDoStore",
"var_name": "exceptionStore"
},
{
"declarator": "errorApi",
"modifier": "private",
"original_string": "private ToDoAPI errorApi;",
"type": "ToDoAPI",
"var_name": "errorApi"
}
],
"file": "java/bluemix-todo-app/src/test/java/net/bluemix/todo/rest/ToDoAPITest.java",
"identifier": "ToDoAPITest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n\tpublic void testUpdateToDoDoesNotExist() {\n\t\ttry{\n\t\t\tapi.updateToDo(\"123\", new ToDo());\n\t\t\tfail(\"Expected exception to be thrown.\");\n\t\t} catch(WebApplicationException e) {\n\t\t\tassertEquals(Response.Status.BAD_REQUEST.getStatusCode(), e.getResponse().getStatus());\n\t\t}\n\t}",
"class_method_signature": "ToDoAPITest.testUpdateToDoDoesNotExist()",
"constructor": false,
"full_signature": "@Test public void testUpdateToDoDoesNotExist()",
"identifier": "testUpdateToDoDoesNotExist",
"invocations": [
"updateToDo",
"fail",
"assertEquals",
"getStatusCode",
"getStatus",
"getResponse"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void testUpdateToDoDoesNotExist()",
"testcase": true
} | {
"fields": [
{
"declarator": "store",
"modifier": "private",
"original_string": "private ToDoStore store;",
"type": "ToDoStore",
"var_name": "store"
}
],
"file": "java/bluemix-todo-app/src/main/java/net/bluemix/todo/rest/ToDoAPI.java",
"identifier": "ToDoAPI",
"interfaces": "",
"methods": [
{
"class_method_signature": "ToDoAPI.ToDoAPI()",
"constructor": true,
"full_signature": "public ToDoAPI()",
"identifier": "ToDoAPI",
"modifiers": "public",
"parameters": "()",
"return": "",
"signature": " ToDoAPI()",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.ToDoAPI(ToDoStore store)",
"constructor": true,
"full_signature": "public ToDoAPI(ToDoStore store)",
"identifier": "ToDoAPI",
"modifiers": "public",
"parameters": "(ToDoStore store)",
"return": "",
"signature": " ToDoAPI(ToDoStore store)",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.getToDo(@PathParam(\"id\") String id)",
"constructor": false,
"full_signature": "@GET @Path(\"/{id}\") @Produces(\"application/json\") public ToDo getToDo(@PathParam(\"id\") String id)",
"identifier": "getToDo",
"modifiers": "@GET @Path(\"/{id}\") @Produces(\"application/json\") public",
"parameters": "(@PathParam(\"id\") String id)",
"return": "ToDo",
"signature": "ToDo getToDo(@PathParam(\"id\") String id)",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.getToDos()",
"constructor": false,
"full_signature": "@GET @Produces(\"application/json\") public Collection<ToDo> getToDos()",
"identifier": "getToDos",
"modifiers": "@GET @Produces(\"application/json\") public",
"parameters": "()",
"return": "Collection<ToDo>",
"signature": "Collection<ToDo> getToDos()",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.newToDo(ToDo td)",
"constructor": false,
"full_signature": "@POST @Consumes(\"application/json\") @Produces(\"application/json\") public ToDo newToDo(ToDo td)",
"identifier": "newToDo",
"modifiers": "@POST @Consumes(\"application/json\") @Produces(\"application/json\") public",
"parameters": "(ToDo td)",
"return": "ToDo",
"signature": "ToDo newToDo(ToDo td)",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.updateToDo(@PathParam(\"id\") String id, ToDo td)",
"constructor": false,
"full_signature": "@PUT @Path(\"/{id}\") @Produces(\"application/json\") @Consumes(\"application/json\") public ToDo updateToDo(@PathParam(\"id\") String id, ToDo td)",
"identifier": "updateToDo",
"modifiers": "@PUT @Path(\"/{id}\") @Produces(\"application/json\") @Consumes(\"application/json\") public",
"parameters": "(@PathParam(\"id\") String id, ToDo td)",
"return": "ToDo",
"signature": "ToDo updateToDo(@PathParam(\"id\") String id, ToDo td)",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.deleteToDo(@PathParam(\"id\") String id)",
"constructor": false,
"full_signature": "@DELETE @Path(\"/{id}\") public void deleteToDo(@PathParam(\"id\") String id)",
"identifier": "deleteToDo",
"modifiers": "@DELETE @Path(\"/{id}\") public",
"parameters": "(@PathParam(\"id\") String id)",
"return": "void",
"signature": "void deleteToDo(@PathParam(\"id\") String id)",
"testcase": false
}
],
"superclass": ""
} | {
"body": "@PUT @Path(\"/{id}\")\n @Produces(\"application/json\")\n @Consumes(\"application/json\")\n public ToDo updateToDo(@PathParam(\"id\") String id, ToDo td) {\n if(id == null) {\n throw new WebApplicationException(\"Must supply an ID, for example /api/todos/123.\", \n Response.Status.BAD_REQUEST);\n }\n if(td == null) {\n throw new WebApplicationException(\"Must supply a ToDo in the PUT body.\", \n Response.Status.BAD_REQUEST);\n }\n try {\n ToDo updatedTd = store.update(id, td);\n if(updatedTd == null) {\n throw new WebApplicationException(\"The ToDo with the ID \" + id + \" does not exist.\",\n Response.Status.BAD_REQUEST);\n }\n return updatedTd;\n } catch (ToDoStoreException e) {\n throw new WebApplicationException(\"Error updating ToDo.\", Response.Status.INTERNAL_SERVER_ERROR);\n }\n }",
"class_method_signature": "ToDoAPI.updateToDo(@PathParam(\"id\") String id, ToDo td)",
"constructor": false,
"full_signature": "@PUT @Path(\"/{id}\") @Produces(\"application/json\") @Consumes(\"application/json\") public ToDo updateToDo(@PathParam(\"id\") String id, ToDo td)",
"identifier": "updateToDo",
"invocations": [
"update"
],
"modifiers": "@PUT @Path(\"/{id}\") @Produces(\"application/json\") @Consumes(\"application/json\") public",
"parameters": "(@PathParam(\"id\") String id, ToDo td)",
"return": "ToDo",
"signature": "ToDo updateToDo(@PathParam(\"id\") String id, ToDo td)",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 305,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 19317653,
"size": 777,
"stargazer_count": 196,
"stars": null,
"updates": null,
"url": "https://github.com/IBM-Cloud/todo-apps"
} |
19317653_6 | {
"fields": [
{
"declarator": "td1",
"modifier": "private",
"original_string": "private ToDo td1;",
"type": "ToDo",
"var_name": "td1"
},
{
"declarator": "td2",
"modifier": "private",
"original_string": "private ToDo td2;",
"type": "ToDo",
"var_name": "td2"
},
{
"declarator": "store",
"modifier": "private",
"original_string": "private ToDoStore store;",
"type": "ToDoStore",
"var_name": "store"
},
{
"declarator": "api",
"modifier": "private",
"original_string": "private ToDoAPI api;",
"type": "ToDoAPI",
"var_name": "api"
},
{
"declarator": "exceptionStore = new ToDoStore(){\n\n\t\t@Override\n\t\tpublic Collection<ToDo> getAll() throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo get(String id) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo persist(ToDo td) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo update(String id, ToDo td) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic void delete(String id) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n @Override\n public int count() throws ToDoStoreException {\n throw new ToDoStoreException(\"Error\");\n }\n\t}",
"modifier": "private",
"original_string": "private ToDoStore exceptionStore = new ToDoStore(){\n\n\t\t@Override\n\t\tpublic Collection<ToDo> getAll() throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo get(String id) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo persist(ToDo td) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic ToDo update(String id, ToDo td) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n\t\t@Override\n\t\tpublic void delete(String id) throws ToDoStoreException {\n\t\t\tthrow new ToDoStoreException(\"Error\");\n\t\t}\n\n @Override\n public int count() throws ToDoStoreException {\n throw new ToDoStoreException(\"Error\");\n }\n\t};",
"type": "ToDoStore",
"var_name": "exceptionStore"
},
{
"declarator": "errorApi",
"modifier": "private",
"original_string": "private ToDoAPI errorApi;",
"type": "ToDoAPI",
"var_name": "errorApi"
}
],
"file": "java/bluemix-todo-app/src/test/java/net/bluemix/todo/rest/ToDoAPITest.java",
"identifier": "ToDoAPITest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n\tpublic void testNewToDo() {\n\t\tToDo td = new ToDo();\n\t\ttd.setTitle(\"do a test\");\n\t\ttd = api.newToDo(td);\n\t\tassertNotNull(td.getId());\n\t\tCollection<ToDo> todos = api.getToDos();\n\t\tassertTrue(todos.contains(td1));\n\t\tassertTrue(todos.contains(td2));\n\t\tassertTrue(todos.contains(td));\n\t\tassertEquals(3, todos.size());\t\n\t}",
"class_method_signature": "ToDoAPITest.testNewToDo()",
"constructor": false,
"full_signature": "@Test public void testNewToDo()",
"identifier": "testNewToDo",
"invocations": [
"setTitle",
"newToDo",
"assertNotNull",
"getId",
"getToDos",
"assertTrue",
"contains",
"assertTrue",
"contains",
"assertTrue",
"contains",
"assertEquals",
"size"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void testNewToDo()",
"testcase": true
} | {
"fields": [
{
"declarator": "store",
"modifier": "private",
"original_string": "private ToDoStore store;",
"type": "ToDoStore",
"var_name": "store"
}
],
"file": "java/bluemix-todo-app/src/main/java/net/bluemix/todo/rest/ToDoAPI.java",
"identifier": "ToDoAPI",
"interfaces": "",
"methods": [
{
"class_method_signature": "ToDoAPI.ToDoAPI()",
"constructor": true,
"full_signature": "public ToDoAPI()",
"identifier": "ToDoAPI",
"modifiers": "public",
"parameters": "()",
"return": "",
"signature": " ToDoAPI()",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.ToDoAPI(ToDoStore store)",
"constructor": true,
"full_signature": "public ToDoAPI(ToDoStore store)",
"identifier": "ToDoAPI",
"modifiers": "public",
"parameters": "(ToDoStore store)",
"return": "",
"signature": " ToDoAPI(ToDoStore store)",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.getToDo(@PathParam(\"id\") String id)",
"constructor": false,
"full_signature": "@GET @Path(\"/{id}\") @Produces(\"application/json\") public ToDo getToDo(@PathParam(\"id\") String id)",
"identifier": "getToDo",
"modifiers": "@GET @Path(\"/{id}\") @Produces(\"application/json\") public",
"parameters": "(@PathParam(\"id\") String id)",
"return": "ToDo",
"signature": "ToDo getToDo(@PathParam(\"id\") String id)",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.getToDos()",
"constructor": false,
"full_signature": "@GET @Produces(\"application/json\") public Collection<ToDo> getToDos()",
"identifier": "getToDos",
"modifiers": "@GET @Produces(\"application/json\") public",
"parameters": "()",
"return": "Collection<ToDo>",
"signature": "Collection<ToDo> getToDos()",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.newToDo(ToDo td)",
"constructor": false,
"full_signature": "@POST @Consumes(\"application/json\") @Produces(\"application/json\") public ToDo newToDo(ToDo td)",
"identifier": "newToDo",
"modifiers": "@POST @Consumes(\"application/json\") @Produces(\"application/json\") public",
"parameters": "(ToDo td)",
"return": "ToDo",
"signature": "ToDo newToDo(ToDo td)",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.updateToDo(@PathParam(\"id\") String id, ToDo td)",
"constructor": false,
"full_signature": "@PUT @Path(\"/{id}\") @Produces(\"application/json\") @Consumes(\"application/json\") public ToDo updateToDo(@PathParam(\"id\") String id, ToDo td)",
"identifier": "updateToDo",
"modifiers": "@PUT @Path(\"/{id}\") @Produces(\"application/json\") @Consumes(\"application/json\") public",
"parameters": "(@PathParam(\"id\") String id, ToDo td)",
"return": "ToDo",
"signature": "ToDo updateToDo(@PathParam(\"id\") String id, ToDo td)",
"testcase": false
},
{
"class_method_signature": "ToDoAPI.deleteToDo(@PathParam(\"id\") String id)",
"constructor": false,
"full_signature": "@DELETE @Path(\"/{id}\") public void deleteToDo(@PathParam(\"id\") String id)",
"identifier": "deleteToDo",
"modifiers": "@DELETE @Path(\"/{id}\") public",
"parameters": "(@PathParam(\"id\") String id)",
"return": "void",
"signature": "void deleteToDo(@PathParam(\"id\") String id)",
"testcase": false
}
],
"superclass": ""
} | {
"body": "@POST\n @Consumes(\"application/json\")\n @Produces(\"application/json\")\n public ToDo newToDo(ToDo td) {\n if(td == null) {\n throw new WebApplicationException(\"Must supply a ToDo in the POST body.\", \n Response.Status.BAD_REQUEST);\n }\n try {\n return store.persist(td);\n } catch (ToDoStoreException e) {\n throw new WebApplicationException(\"Error saving ToDo.\", Response.Status.INTERNAL_SERVER_ERROR);\n }\n }",
"class_method_signature": "ToDoAPI.newToDo(ToDo td)",
"constructor": false,
"full_signature": "@POST @Consumes(\"application/json\") @Produces(\"application/json\") public ToDo newToDo(ToDo td)",
"identifier": "newToDo",
"invocations": [
"persist"
],
"modifiers": "@POST @Consumes(\"application/json\") @Produces(\"application/json\") public",
"parameters": "(ToDo td)",
"return": "ToDo",
"signature": "ToDo newToDo(ToDo td)",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 305,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 19317653,
"size": 777,
"stargazer_count": 196,
"stars": null,
"updates": null,
"url": "https://github.com/IBM-Cloud/todo-apps"
} |
19317653_29 | {
"fields": [],
"file": "java/bluemix-todo-app/src/test/java/net/bluemix/todo/model/ToDoTest.java",
"identifier": "ToDoTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n\tpublic void testGetTitle() {\n\t\tToDo td = new ToDo();\n\t\tassertEquals(\"\", td.getTitle());\n\t\ttd.setTitle(\"Pick up kids at 3\");\n\t\tassertEquals(\"Pick up kids at 3\", td.getTitle());\n\t}",
"class_method_signature": "ToDoTest.testGetTitle()",
"constructor": false,
"full_signature": "@Test public void testGetTitle()",
"identifier": "testGetTitle",
"invocations": [
"assertEquals",
"getTitle",
"setTitle",
"assertEquals",
"getTitle"
],
"modifiers": "@Test public",
"parameters": "()",
"return": "void",
"signature": "void testGetTitle()",
"testcase": true
} | {
"fields": [
{
"declarator": "completed",
"modifier": "private",
"original_string": "private boolean completed;",
"type": "boolean",
"var_name": "completed"
},
{
"declarator": "title",
"modifier": "private",
"original_string": "private String title;",
"type": "String",
"var_name": "title"
},
{
"declarator": "id",
"modifier": "private",
"original_string": "private String id;",
"type": "String",
"var_name": "id"
},
{
"declarator": "order",
"modifier": "private",
"original_string": "private int order;",
"type": "int",
"var_name": "order"
}
],
"file": "java/bluemix-todo-app/src/main/java/net/bluemix/todo/model/ToDo.java",
"identifier": "ToDo",
"interfaces": "",
"methods": [
{
"class_method_signature": "ToDo.ToDo()",
"constructor": true,
"full_signature": "public ToDo()",
"identifier": "ToDo",
"modifiers": "public",
"parameters": "()",
"return": "",
"signature": " ToDo()",
"testcase": false
},
{
"class_method_signature": "ToDo.getId()",
"constructor": false,
"full_signature": "public String getId()",
"identifier": "getId",
"modifiers": "public",
"parameters": "()",
"return": "String",
"signature": "String getId()",
"testcase": false
},
{
"class_method_signature": "ToDo.setId(String id)",
"constructor": false,
"full_signature": "public void setId(String id)",
"identifier": "setId",
"modifiers": "public",
"parameters": "(String id)",
"return": "void",
"signature": "void setId(String id)",
"testcase": false
},
{
"class_method_signature": "ToDo.isCompleted()",
"constructor": false,
"full_signature": "public boolean isCompleted()",
"identifier": "isCompleted",
"modifiers": "public",
"parameters": "()",
"return": "boolean",
"signature": "boolean isCompleted()",
"testcase": false
},
{
"class_method_signature": "ToDo.setCompleted(boolean completed)",
"constructor": false,
"full_signature": "public void setCompleted(boolean completed)",
"identifier": "setCompleted",
"modifiers": "public",
"parameters": "(boolean completed)",
"return": "void",
"signature": "void setCompleted(boolean completed)",
"testcase": false
},
{
"class_method_signature": "ToDo.getTitle()",
"constructor": false,
"full_signature": "public String getTitle()",
"identifier": "getTitle",
"modifiers": "public",
"parameters": "()",
"return": "String",
"signature": "String getTitle()",
"testcase": false
},
{
"class_method_signature": "ToDo.setTitle(String title)",
"constructor": false,
"full_signature": "public void setTitle(String title)",
"identifier": "setTitle",
"modifiers": "public",
"parameters": "(String title)",
"return": "void",
"signature": "void setTitle(String title)",
"testcase": false
},
{
"class_method_signature": "ToDo.getOrder()",
"constructor": false,
"full_signature": "public int getOrder()",
"identifier": "getOrder",
"modifiers": "public",
"parameters": "()",
"return": "int",
"signature": "int getOrder()",
"testcase": false
},
{
"class_method_signature": "ToDo.setOrder(int order)",
"constructor": false,
"full_signature": "public void setOrder(int order)",
"identifier": "setOrder",
"modifiers": "public",
"parameters": "(int order)",
"return": "void",
"signature": "void setOrder(int order)",
"testcase": false
},
{
"class_method_signature": "ToDo.equals(Object obj)",
"constructor": false,
"full_signature": "@Override public boolean equals(Object obj)",
"identifier": "equals",
"modifiers": "@Override public",
"parameters": "(Object obj)",
"return": "boolean",
"signature": "boolean equals(Object obj)",
"testcase": false
},
{
"class_method_signature": "ToDo.hashCode()",
"constructor": false,
"full_signature": "@Override public int hashCode()",
"identifier": "hashCode",
"modifiers": "@Override public",
"parameters": "()",
"return": "int",
"signature": "int hashCode()",
"testcase": false
}
],
"superclass": ""
} | {
"body": "public String getTitle() {\n return title;\n }",
"class_method_signature": "ToDo.getTitle()",
"constructor": false,
"full_signature": "public String getTitle()",
"identifier": "getTitle",
"invocations": [],
"modifiers": "public",
"parameters": "()",
"return": "String",
"signature": "String getTitle()",
"testcase": false
} | {
"created": null,
"fork": null,
"fork_count": 305,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 19317653,
"size": 777,
"stargazer_count": 196,
"stars": null,
"updates": null,
"url": "https://github.com/IBM-Cloud/todo-apps"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.