id stringlengths 7 14 | test_class dict | test_case dict | focal_class dict | focal_method dict | repository dict |
|---|---|---|---|---|---|
96123627_82 | {
"fields": [
{
"declarator": "esService = EsClientFactory.getInstance(JsonKey.REST)",
"modifier": "private",
"original_string": "private ElasticSearchService esService = EsClientFactory.getInstance(JsonKey.REST);",
"type": "ElasticSearchService",
"var_name": "esService"
},
{... | {
"body": "@Test\n public void testDeleteFailure() {\n mockRulesForDelete(true, false);\n Future<Boolean> result = esService.delete(\"test\", \"001\");\n Object res = ElasticSearchHelper.getResponseFromFuture(result);\n assertEquals(null, res);\n }",
"class_method_signature": "ElasticSearchRestHighImp... | {
"fields": [
{
"declarator": "ERROR = \"ERROR\"",
"modifier": "private static final",
"original_string": "private static final String ERROR = \"ERROR\";",
"type": "String",
"var_name": "ERROR"
}
],
"file": "sunbird-es-utils/src/main/java/org/sunbird/common/ElasticSearchRestH... | {
"body": "@Override\n public Future<Boolean> delete(String index, String identifier) {\n long startTime = System.currentTimeMillis();\n ProjectLogger.log(\n \"ElasticSearchRestHighImpl:delete: method started at ==\" + startTime,\n LoggerEnum.PERF_LOG.name());\n Promise<Boolean> promise = Futu... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_266 | {
"fields": [
{
"declarator": "propertiesCache = ProjectUtil.propertiesCache",
"modifier": "private",
"original_string": "private PropertiesCache propertiesCache = ProjectUtil.propertiesCache;",
"type": "PropertiesCache",
"var_name": "propertiesCache"
},
{
"declarator":... | {
"body": "@Test\n public void testIsDateValidFormatSuccess() {\n boolean bool = ProjectUtil.isDateValidFormat(\"yyyy-MM-dd\", \"2017-12-18\");\n assertTrue(bool);\n }",
"class_method_signature": "ProjectUtilTest.testIsDateValidFormatSuccess()",
"constructor": false,
"full_signature": "@Test public void... | {
"fields": [
{
"declarator": "atomicInteger = new AtomicInteger()",
"modifier": "private static",
"original_string": "private static AtomicInteger atomicInteger = new AtomicInteger();",
"type": "AtomicInteger",
"var_name": "atomicInteger"
},
{
"declarator": "DEFAULT_BA... | {
"body": "public static boolean isDateValidFormat(String format, String value) {\n Date date = null;\n try {\n SimpleDateFormat sdf = new SimpleDateFormat(format);\n date = sdf.parse(value);\n if (!value.equals(sdf.format(date))) {\n date = null;\n }\n } catch (ParseException ex) ... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_289 | {
"fields": [
{
"declarator": "propertiesCache = ProjectUtil.propertiesCache",
"modifier": "private",
"original_string": "private PropertiesCache propertiesCache = ProjectUtil.propertiesCache;",
"type": "PropertiesCache",
"var_name": "propertiesCache"
},
{
"declarator":... | {
"body": "@Test\n public void testGetLmsUserIdSuccessWithoutFedUserId() {\n String userid = ProjectUtil.getLmsUserId(\"1234567890\");\n assertEquals(\"1234567890\", userid);\n }",
"class_method_signature": "ProjectUtilTest.testGetLmsUserIdSuccessWithoutFedUserId()",
"constructor": false,
"full_signatur... | {
"fields": [
{
"declarator": "atomicInteger = new AtomicInteger()",
"modifier": "private static",
"original_string": "private static AtomicInteger atomicInteger = new AtomicInteger();",
"type": "AtomicInteger",
"var_name": "atomicInteger"
},
{
"declarator": "DEFAULT_BA... | {
"body": "public static String getLmsUserId(String fedUserId) {\n String userId = fedUserId;\n String prefix =\n \"f:\" + getConfigValue(JsonKey.SUNBIRD_KEYCLOAK_USER_FEDERATION_PROVIDER_ID) + \":\";\n if (StringUtils.isNotBlank(fedUserId) && fedUserId.startsWith(prefix)) {\n userId = fedUserId.... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_323 | {
"fields": [
{
"declarator": "iterator",
"modifier": "private static",
"original_string": "private static Iterator iterator;",
"type": "Iterator",
"var_name": "iterator"
},
{
"declarator": "row",
"modifier": "private static",
"original_string": "private sta... | {
"body": "@Test\n public void testGetRecordsFailureByProperty() throws Exception {\n\n List<Row> rows = new ArrayList<>();\n Row row = Mockito.mock(Row.class);\n rows.add(row);\n when(resultSet.all()).thenReturn(rows);\n\n when(selectSelection.all())\n .thenThrow(\n new ProjectCommo... | {
"fields": [
{
"declarator": "connectionManager",
"modifier": "protected",
"original_string": "protected CassandraConnectionManager connectionManager;",
"type": "CassandraConnectionManager",
"var_name": "connectionManager"
}
],
"file": "sunbird-cassandra-utils/src/main/java/... | {
"body": "@Override\n public Response getRecordsByProperty(\n String keyspaceName, String tableName, String propertyName, Object propertyValue) {\n return getRecordsByProperty(keyspaceName, tableName, propertyName, propertyValue, null);\n }",
"class_method_signature": "CassandraOperationImpl.getRecordsBy... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_159 | {
"fields": [],
"file": "sunbird-platform-core/common-util/src/test/java/org/sunbird/common/request/RequestValidatorTest.java",
"identifier": "RequestValidatorTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testValidateRegisterClientSuccess() {\n Request request = new Request();\n Map<String, Object> requestObj = new HashMap<>();\n requestObj.put(JsonKey.CLIENT_NAME, \"1234\");\n request.setRequest(requestObj);\n try {\n RequestValidator.validateRegisterClient(request)... | {
"fields": [
{
"declarator": "ERROR_CODE = ResponseCode.CLIENT_ERROR.getResponseCode()",
"modifier": "private static final",
"original_string": "private static final int ERROR_CODE = ResponseCode.CLIENT_ERROR.getResponseCode();",
"type": "int",
"var_name": "ERROR_CODE"
}
],
... | {
"body": "public static void validateRegisterClient(Request request) {\n\n if (StringUtils.isBlank((String) request.getRequest().get(JsonKey.CLIENT_NAME))) {\n throw createExceptionInstance(ResponseCode.invalidClientName.getErrorCode());\n }\n }",
"class_method_signature": "RequestValidator.validateReg... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_270 | {
"fields": [
{
"declarator": "propertiesCache = ProjectUtil.propertiesCache",
"modifier": "private",
"original_string": "private PropertiesCache propertiesCache = ProjectUtil.propertiesCache;",
"type": "PropertiesCache",
"var_name": "propertiesCache"
},
{
"declarator":... | {
"body": "@Test\n public void testGetEkstepHeaderSuccess() {\n Map<String, String> map = ProjectUtil.getEkstepHeader();\n assertEquals(map.get(\"Content-Type\"), \"application/json\");\n assertNotNull(map.get(JsonKey.AUTHORIZATION));\n }",
"class_method_signature": "ProjectUtilTest.testGetEkstepHeaderSu... | {
"fields": [
{
"declarator": "atomicInteger = new AtomicInteger()",
"modifier": "private static",
"original_string": "private static AtomicInteger atomicInteger = new AtomicInteger();",
"type": "AtomicInteger",
"var_name": "atomicInteger"
},
{
"declarator": "DEFAULT_BA... | {
"body": "public static Map<String, String> getEkstepHeader() {\n Map<String, String> headerMap = new HashMap<>();\n String header = System.getenv(JsonKey.EKSTEP_AUTHORIZATION);\n if (StringUtils.isBlank(header)) {\n header = PropertiesCache.getInstance().getProperty(JsonKey.EKSTEP_AUTHORIZATION);\n ... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_94 | {
"fields": [
{
"declarator": "chemistryMap = null",
"modifier": "private static",
"original_string": "private static Map<String, Object> chemistryMap = null;",
"type": "Map<String, Object>",
"var_name": "chemistryMap"
},
{
"declarator": "physicsMap = null",
"modi... | {
"body": "@Test\n @Ignore\n public void testComplexSearchSuccess() throws Exception {\n SearchDTO searchDTO = new SearchDTO();\n\n List<String> fields = new ArrayList<String>();\n fields.add(\"courseId\");\n fields.add(\"courseType\");\n fields.add(\"createdOn\");\n fields.add(\"description\");\n... | {
"fields": [
{
"declarator": "WAIT_TIME = 30",
"modifier": "public static final",
"original_string": "public static final int WAIT_TIME = 30;",
"type": "int",
"var_name": "WAIT_TIME"
},
{
"declarator": "timeout = new Timeout(WAIT_TIME, TimeUnit.SECONDS)",
"modifi... | {
"body": "@Override\n public Future<Map<String, Object>> search(SearchDTO searchDTO, String index) {\n\n long startTime = System.currentTimeMillis();\n Promise<Map<String, Object>> promise = Futures.promise();\n String[] indices = {index};\n\n ProjectLogger.log(\n \"ElasticSearchTcpImpl:search: m... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_227 | {
"fields": [
{
"declarator": "userRequestValidator = new UserRequestValidator()",
"modifier": "private static final",
"original_string": "private static final UserRequestValidator userRequestValidator = new UserRequestValidator();",
"type": "UserRequestValidator",
"var_name": "userR... | {
"body": "@Test\n public void testValidateCreateUserRequestFailureWithInvalidAddressType() {\n Request request = new Request();\n Map<String, Object> requestObj = new HashMap<>();\n requestObj.put(JsonKey.PHONE, \"9321234123\");\n requestObj.put(JsonKey.PHONE_VERIFIED, true);\n requestObj.put(JsonKey... | {
"fields": [
{
"declarator": "ERROR_CODE = ResponseCode.CLIENT_ERROR.getResponseCode()",
"modifier": "private static final",
"original_string": "private static final int ERROR_CODE = ResponseCode.CLIENT_ERROR.getResponseCode();",
"type": "int",
"var_name": "ERROR_CODE"
}
],
... | {
"body": "public void validateCreateUserRequest(Request userRequest) {\n externalIdsValidation(userRequest, JsonKey.CREATE);\n fieldsNotAllowed(\n Arrays.asList(\n JsonKey.REGISTERED_ORG_ID,\n JsonKey.ROOT_ORG_ID,\n JsonKey.PROVIDER,\n JsonKey.EXTERNAL_ID,\n ... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_199 | {
"fields": [
{
"declarator": "userRequestValidator = new UserRequestValidator()",
"modifier": "private static final",
"original_string": "private static final UserRequestValidator userRequestValidator = new UserRequestValidator();",
"type": "UserRequestValidator",
"var_name": "userR... | {
"body": "@Test\n public void testValidateLocationCodesFailure() {\n Request request = initailizeRequest();\n Map<String, Object> requestObj = request.getRequest();\n\n requestObj.put(JsonKey.LOCATION_CODES, \"AP\");\n request.setRequest(requestObj);\n try {\n userRequestValidator.validateCreate... | {
"fields": [
{
"declarator": "ERROR_CODE = ResponseCode.CLIENT_ERROR.getResponseCode()",
"modifier": "private static final",
"original_string": "private static final int ERROR_CODE = ResponseCode.CLIENT_ERROR.getResponseCode();",
"type": "int",
"var_name": "ERROR_CODE"
}
],
... | {
"body": "public void validateCreateUserRequest(Request userRequest) {\n externalIdsValidation(userRequest, JsonKey.CREATE);\n fieldsNotAllowed(\n Arrays.asList(\n JsonKey.REGISTERED_ORG_ID,\n JsonKey.ROOT_ORG_ID,\n JsonKey.PROVIDER,\n JsonKey.EXTERNAL_ID,\n ... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_176 | {
"fields": [],
"file": "sunbird-platform-core/common-util/src/test/java/org/sunbird/common/request/RequestValidatorTest.java",
"identifier": "RequestValidatorTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testValidateUserOrgTypeFailureWithEmptyName() {\n Request request = new Request();\n Map<String, Object> requestObj = new HashMap<>();\n requestObj.put(JsonKey.NAME, \"\");\n requestObj.put(JsonKey.ID, \"orgtypeId\");\n request.setRequest(requestObj);\n boolean respon... | {
"fields": [
{
"declarator": "ERROR_CODE = ResponseCode.CLIENT_ERROR.getResponseCode()",
"modifier": "private static final",
"original_string": "private static final int ERROR_CODE = ResponseCode.CLIENT_ERROR.getResponseCode();",
"type": "int",
"var_name": "ERROR_CODE"
}
],
... | {
"body": "public static void validateUpdateOrgType(Request reqObj) {\n if (StringUtils.isBlank((String) reqObj.getRequest().get(JsonKey.NAME))) {\n throw createExceptionInstance(ResponseCode.orgTypeMandatory.getErrorCode());\n }\n if (StringUtils.isBlank((String) reqObj.getRequest().get(JsonKey.ID))) {... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_54 | {
"fields": [],
"file": "sunbird-cassandra-migration/cassandra-migration/src/test/java/com/contrastsecurity/cassandra/migration/utils/StringUtilsTest.java",
"identifier": "StringUtilsTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void tokenizeToStringArray() {\n assertArrayEquals(new String[] {\"abc\"}, StringUtils.tokenizeToStringArray(\"abc\", \",\"));\n assertArrayEquals(\n new String[] {\"abc\", \"def\"}, StringUtils.tokenizeToStringArray(\"abc,def\", \",\"));\n assertArrayEquals(\n new St... | {
"fields": [],
"file": "sunbird-cassandra-migration/cassandra-migration/src/main/java/com/contrastsecurity/cassandra/migration/utils/StringUtils.java",
"identifier": "StringUtils",
"interfaces": "",
"methods": [
{
"class_method_signature": "StringUtils.StringUtils()",
"constructor": true,
... | {
"body": "public static String[] tokenizeToStringArray(String str, String delimiters) {\n if (str == null) {\n return null;\n }\n String[] tokens = str.split(\"[\" + delimiters + \"]\");\n for (int i = 0; i < tokens.length; i++) {\n tokens[i] = tokens[i].trim();\n }\n return tokens;\n }"... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_121 | {
"fields": [
{
"declarator": "keyCloakService = SSOServiceFactory.getInstance()",
"modifier": "private",
"original_string": "private SSOManager keyCloakService = SSOServiceFactory.getInstance();",
"type": "SSOManager",
"var_name": "keyCloakService"
},
{
"declarator": "... | {
"body": "@Test\n public void testGetUsernameById() {\n String result = keyCloakService.getUsernameById(\"1234-567-890\");\n Assert.assertNotNull(result);\n }",
"class_method_signature": "KeyCloakServiceImplTest.testGetUsernameById()",
"constructor": false,
"full_signature": "@Test public void testGetU... | {
"fields": [
{
"declarator": "keycloak = KeyCloakConnectionProvider.getConnection()",
"modifier": "private",
"original_string": "private Keycloak keycloak = KeyCloakConnectionProvider.getConnection();",
"type": "Keycloak",
"var_name": "keycloak"
},
{
"declarator": "URL... | {
"body": "@Override\n public String getUsernameById(String userId) {\n String fedUserId = getFederatedUserId(userId);\n try {\n UserResource resource =\n keycloak.realm(KeyCloakConnectionProvider.SSO_REALM).users().get(fedUserId);\n UserRepresentation ur = resource.toRepresentation();\n ... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_208 | {
"fields": [
{
"declarator": "userRequestValidator = new UserRequestValidator()",
"modifier": "private static final",
"original_string": "private static final UserRequestValidator userRequestValidator = new UserRequestValidator();",
"type": "UserRequestValidator",
"var_name": "userR... | {
"body": "@Test\n public void testCreateUserSuccess() {\n boolean response = false;\n Request request = initailizeRequest();\n Map<String, Object> requestObj = request.getRequest();\n List<String> roles = new ArrayList<String>();\n roles.add(\"PUBLIC\");\n roles.add(\"CONTENT-CREATOR\");\n requ... | {
"fields": [
{
"declarator": "ERROR_CODE = ResponseCode.CLIENT_ERROR.getResponseCode()",
"modifier": "private static final",
"original_string": "private static final int ERROR_CODE = ResponseCode.CLIENT_ERROR.getResponseCode();",
"type": "int",
"var_name": "ERROR_CODE"
}
],
... | {
"body": "public void validateCreateUserRequest(Request userRequest) {\n externalIdsValidation(userRequest, JsonKey.CREATE);\n fieldsNotAllowed(\n Arrays.asList(\n JsonKey.REGISTERED_ORG_ID,\n JsonKey.ROOT_ORG_ID,\n JsonKey.PROVIDER,\n JsonKey.EXTERNAL_ID,\n ... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_137 | {
"fields": [
{
"declarator": "keyCloakService = SSOServiceFactory.getInstance()",
"modifier": "private",
"original_string": "private SSOManager keyCloakService = SSOServiceFactory.getInstance();",
"type": "SSOManager",
"var_name": "keyCloakService"
},
{
"declarator": "... | {
"body": "@Test\n public void testSyncUserDataSuccessWithInvalidUser() {\n Map<String, Object> request = new HashMap<String, Object>();\n request.put(JsonKey.USERNAME, userName);\n request.put(JsonKey.PASSWORD, \"password\");\n request.put(JsonKey.FIRST_NAME, \"A\");\n request.put(JsonKey.LAST_NAME, ... | {
"fields": [
{
"declarator": "keycloak = KeyCloakConnectionProvider.getConnection()",
"modifier": "private",
"original_string": "private Keycloak keycloak = KeyCloakConnectionProvider.getConnection();",
"type": "Keycloak",
"var_name": "keycloak"
},
{
"declarator": "URL... | {
"body": "@Override\n public String syncUserData(Map<String, Object> request) {\n String userId = (String) request.get(JsonKey.USER_ID);\n String fedUserId = getFederatedUserId(userId);\n UserRepresentation ur = null;\n UserResource resource = null;\n boolean needTobeUpdate = false;\n try {\n ... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_15 | {
"fields": [],
"file": "sunbird-cassandra-migration/cassandra-migration/src/test/java/com/contrastsecurity/cassandra/migration/resolver/MigrationInfoHelperTest.java",
"identifier": "MigrationInfoHelperTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test(expected = CassandraMigrationException.class)\n public void extractSchemaVersionNoDescription() {\n MigrationInfoHelper.extractVersionAndDescription(\"9_4\", \"\", \"__\", \"\");\n }",
"class_method_signature": "MigrationInfoHelperTest.extractSchemaVersionNoDescription()",
"constructor": fal... | {
"fields": [],
"file": "sunbird-cassandra-migration/cassandra-migration/src/main/java/com/contrastsecurity/cassandra/migration/resolver/MigrationInfoHelper.java",
"identifier": "MigrationInfoHelper",
"interfaces": "",
"methods": [
{
"class_method_signature": "MigrationInfoHelper.MigrationInfoHelper... | {
"body": "public static Pair<MigrationVersion, String> extractVersionAndDescription(\n String migrationName, String prefix, String separator, String suffix) {\n String cleanMigrationName =\n migrationName.substring(prefix.length(), migrationName.length() - suffix.length());\n\n // Handle the descri... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_160 | {
"fields": [],
"file": "sunbird-platform-core/common-util/src/test/java/org/sunbird/common/request/RequestValidatorTest.java",
"identifier": "RequestValidatorTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testValidateUpdateClientKeyFailureWithEmptyToken() {\n try {\n RequestValidator.validateUpdateClientKey(\"1234\", \"\");\n } catch (ProjectCommonException e) {\n assertEquals(ResponseCode.CLIENT_ERROR.getResponseCode(), e.getResponseCode());\n assertEquals(Response... | {
"fields": [
{
"declarator": "ERROR_CODE = ResponseCode.CLIENT_ERROR.getResponseCode()",
"modifier": "private static final",
"original_string": "private static final int ERROR_CODE = ResponseCode.CLIENT_ERROR.getResponseCode();",
"type": "int",
"var_name": "ERROR_CODE"
}
],
... | {
"body": "public static void validateUpdateClientKey(String clientId, String masterAccessToken) {\n validateClientId(clientId);\n if (StringUtils.isBlank(masterAccessToken)) {\n throw createExceptionInstance(ResponseCode.invalidRequestData.getErrorCode());\n }\n }",
"class_method_signature": "Reques... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_249 | {
"fields": [
{
"declarator": "userRequestValidator = new UserRequestValidator()",
"modifier": "private static final",
"original_string": "private static final UserRequestValidator userRequestValidator = new UserRequestValidator();",
"type": "UserRequestValidator",
"var_name": "userR... | {
"body": "@Test\n public void testValidateMandatoryFrameworkFieldsSuccess() {\n Request request = initailizeRequest();\n request.getRequest().put(JsonKey.FRAMEWORK, createFrameWork());\n boolean response = false;\n try {\n new UserRequestValidator()\n .validateMandatoryFrameworkFields(\n ... | {
"fields": [
{
"declarator": "ERROR_CODE = ResponseCode.CLIENT_ERROR.getResponseCode()",
"modifier": "private static final",
"original_string": "private static final int ERROR_CODE = ResponseCode.CLIENT_ERROR.getResponseCode();",
"type": "int",
"var_name": "ERROR_CODE"
}
],
... | {
"body": "@SuppressWarnings(\"unchecked\")\n public void validateMandatoryFrameworkFields(\n Map<String, Object> userMap,\n List<String> frameworkFields,\n List<String> frameworkMandatoryFields) {\n if (userMap.containsKey(JsonKey.FRAMEWORK)) {\n Map<String, Object> frameworkRequest = (Map<St... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_42 | {
"fields": [],
"file": "sunbird-cassandra-migration/cassandra-migration/src/test/java/com/contrastsecurity/cassandra/migration/info/MigrationInfoDumperTest.java",
"identifier": "MigrationInfoDumperTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void dump2pending() {\n MigrationInfoService migrationInfoService =\n new MigrationInfoService(\n createMigrationResolver(\n createAvailableMigration(\"1\"), createAvailableMigration(\"2.2014.09.11.55.45613\")),\n createSchemaVersionDAO(),\n ... | {
"fields": [
{
"declarator": "VERSION_TITLE = \"Version\"",
"modifier": "private static final",
"original_string": "private static final String VERSION_TITLE = \"Version\";",
"type": "String",
"var_name": "VERSION_TITLE"
},
{
"declarator": "DESCRIPTION_TITLE = \"Descri... | {
"body": "public static String dumpToAsciiTable(final MigrationInfo[] migrationInfos) {\n int versionWidth = VERSION_TITLE.length();\n int descriptionWidth = DESCRIPTION_TITLE.length();\n\n for (MigrationInfo migrationInfo : migrationInfos) {\n versionWidth = Math.max(versionWidth, migrationInfo.getVer... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_39 | {
"fields": [],
"file": "sunbird-cassandra-migration/cassandra-migration/src/test/java/com/contrastsecurity/cassandra/migration/info/MigrationVersionTest.java",
"identifier": "MigrationVersionTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test(expected = CassandraMigrationException.class)\n public void alphaNumeric() {\n MigrationVersion.fromVersion(\"1.2.1a-3\");\n }",
"class_method_signature": "MigrationVersionTest.alphaNumeric()",
"constructor": false,
"full_signature": "@Test(expected = CassandraMigrationException.class) pub... | {
"fields": [
{
"declarator": "EMPTY = new MigrationVersion(null, \"<< Empty Schema >>\")",
"modifier": "public static final",
"original_string": "public static final MigrationVersion EMPTY = new MigrationVersion(null, \"<< Empty Schema >>\");",
"type": "MigrationVersion",
"var_name"... | {
"body": "public static MigrationVersion fromVersion(String version) {\n if (\"current\".equalsIgnoreCase(version)) return CURRENT;\n if (LATEST.getVersion().equals(version)) return LATEST;\n if (version == null) return EMPTY;\n return new MigrationVersion(version);\n }",
"class_method_signature": "Mi... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_232 | {
"fields": [
{
"declarator": "userRequestValidator = new UserRequestValidator()",
"modifier": "private static final",
"original_string": "private static final UserRequestValidator userRequestValidator = new UserRequestValidator();",
"type": "UserRequestValidator",
"var_name": "userR... | {
"body": "@Test\n public void testValidateCreateUserSuccess() {\n Request request = initailizeRequest();\n request.getRequest().put(JsonKey.PHONE, \"7894561230\");\n request.getRequest().put(JsonKey.PHONE_VERIFIED, \"\");\n try {\n userRequestValidator.validateCreateUserRequest(request);\n } cat... | {
"fields": [
{
"declarator": "ERROR_CODE = ResponseCode.CLIENT_ERROR.getResponseCode()",
"modifier": "private static final",
"original_string": "private static final int ERROR_CODE = ResponseCode.CLIENT_ERROR.getResponseCode();",
"type": "int",
"var_name": "ERROR_CODE"
}
],
... | {
"body": "public void validateCreateUserRequest(Request userRequest) {\n externalIdsValidation(userRequest, JsonKey.CREATE);\n fieldsNotAllowed(\n Arrays.asList(\n JsonKey.REGISTERED_ORG_ID,\n JsonKey.ROOT_ORG_ID,\n JsonKey.PROVIDER,\n JsonKey.EXTERNAL_ID,\n ... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_320 | {
"fields": [
{
"declarator": "iterator",
"modifier": "private static",
"original_string": "private static Iterator iterator;",
"type": "Iterator",
"var_name": "iterator"
},
{
"declarator": "row",
"modifier": "private static",
"original_string": "private sta... | {
"body": "@Test\n public void testGetRecordForListSuccessByProperties() throws Exception {\n\n List<Object> list = new ArrayList<>();\n list.add(\"123\");\n list.add(\"321\");\n\n when(session.execute(boundStatement.bind(\"123\"))).thenReturn(resultSet);\n Iterator<Row> rowItr = Mockito.mock(Iterator... | {
"fields": [
{
"declarator": "connectionManager",
"modifier": "protected",
"original_string": "protected CassandraConnectionManager connectionManager;",
"type": "CassandraConnectionManager",
"var_name": "connectionManager"
}
],
"file": "sunbird-cassandra-utils/src/main/java/... | {
"body": "@Override\n public Response getRecordsByProperty(\n String keyspaceName, String tableName, String propertyName, Object propertyValue) {\n return getRecordsByProperty(keyspaceName, tableName, propertyName, propertyValue, null);\n }",
"class_method_signature": "CassandraOperationImpl.getRecordsBy... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_81 | {
"fields": [
{
"declarator": "esService = EsClientFactory.getInstance(JsonKey.REST)",
"modifier": "private",
"original_string": "private ElasticSearchService esService = EsClientFactory.getInstance(JsonKey.REST);",
"type": "ElasticSearchService",
"var_name": "esService"
},
{... | {
"body": "@Test\n public void testDeleteSuccessWithoutDelete() {\n mockRulesForDelete(false, true);\n Future<Boolean> result = esService.delete(\"test\", \"001\");\n boolean res = (boolean) ElasticSearchHelper.getResponseFromFuture(result);\n assertEquals(false, res);\n }",
"class_method_signature": ... | {
"fields": [
{
"declarator": "ERROR = \"ERROR\"",
"modifier": "private static final",
"original_string": "private static final String ERROR = \"ERROR\";",
"type": "String",
"var_name": "ERROR"
}
],
"file": "sunbird-es-utils/src/main/java/org/sunbird/common/ElasticSearchRestH... | {
"body": "@Override\n public Future<Boolean> delete(String index, String identifier) {\n long startTime = System.currentTimeMillis();\n ProjectLogger.log(\n \"ElasticSearchRestHighImpl:delete: method started at ==\" + startTime,\n LoggerEnum.PERF_LOG.name());\n Promise<Boolean> promise = Futu... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_265 | {
"fields": [
{
"declarator": "propertiesCache = ProjectUtil.propertiesCache",
"modifier": "private",
"original_string": "private PropertiesCache propertiesCache = ProjectUtil.propertiesCache;",
"type": "PropertiesCache",
"var_name": "propertiesCache"
},
{
"declarator":... | {
"body": "@Test\n public void testIsEmailValidFailureWithWrongEmail() {\n boolean msg = ProjectUtil.isEmailvalid(\"Hello \");\n assertFalse(msg);\n }",
"class_method_signature": "ProjectUtilTest.testIsEmailValidFailureWithWrongEmail()",
"constructor": false,
"full_signature": "@Test public void testIsE... | {
"fields": [
{
"declarator": "atomicInteger = new AtomicInteger()",
"modifier": "private static",
"original_string": "private static AtomicInteger atomicInteger = new AtomicInteger();",
"type": "AtomicInteger",
"var_name": "atomicInteger"
},
{
"declarator": "DEFAULT_BA... | {
"body": "public static boolean isEmailvalid(final String email) {\n if (StringUtils.isBlank(email)) {\n return false;\n }\n Matcher matcher = pattern.matcher(email);\n return matcher.matches();\n }",
"class_method_signature": "ProjectUtil.isEmailvalid(final String email)",
"constructor": false... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_78 | {
"fields": [
{
"declarator": "esService = EsClientFactory.getInstance(JsonKey.REST)",
"modifier": "private",
"original_string": "private ElasticSearchService esService = EsClientFactory.getInstance(JsonKey.REST);",
"type": "ElasticSearchService",
"var_name": "esService"
},
{... | {
"body": "@Test\n public void testGetDataByIdentifierFailureWithEmptyIdentifier() {\n try {\n esService.getDataByIdentifier(\"test\", \"\");\n } catch (ProjectCommonException e) {\n assertEquals(e.getResponseCode(), ResponseCode.invalidData.getResponseCode());\n }\n }",
"class_method_signature... | {
"fields": [
{
"declarator": "ERROR = \"ERROR\"",
"modifier": "private static final",
"original_string": "private static final String ERROR = \"ERROR\";",
"type": "String",
"var_name": "ERROR"
}
],
"file": "sunbird-es-utils/src/main/java/org/sunbird/common/ElasticSearchRestH... | {
"body": "@Override\n public Future<Map<String, Object>> getDataByIdentifier(String index, String identifier) {\n long startTime = System.currentTimeMillis();\n Promise<Map<String, Object>> promise = Futures.promise();\n if (StringUtils.isNotEmpty(identifier) && StringUtils.isNotEmpty(index)) {\n\n Pr... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_273 | {
"fields": [
{
"declarator": "propertiesCache = ProjectUtil.propertiesCache",
"modifier": "private",
"original_string": "private PropertiesCache propertiesCache = ProjectUtil.propertiesCache;",
"type": "PropertiesCache",
"var_name": "propertiesCache"
},
{
"declarator":... | {
"body": "@Test\n public void testBulkProcessStatusSuccess() {\n assertEquals(0, ProjectUtil.BulkProcessStatus.NEW.getValue());\n assertEquals(1, ProjectUtil.BulkProcessStatus.IN_PROGRESS.getValue());\n assertEquals(2, ProjectUtil.BulkProcessStatus.INTERRUPT.getValue());\n assertEquals(3, ProjectUtil.Bu... | {
"fields": [
{
"declarator": "atomicInteger = new AtomicInteger()",
"modifier": "private static",
"original_string": "private static AtomicInteger atomicInteger = new AtomicInteger();",
"type": "AtomicInteger",
"var_name": "atomicInteger"
},
{
"declarator": "DEFAULT_BA... | {
"body": "private static Object getValue(Map<String, Object> map, String key) {\n Object value = map.get(key);\n map.remove(key);\n return value;\n }",
"class_method_signature": "ProjectUtil.getValue(Map<String, Object> map, String key)",
"constructor": false,
"full_signature": "private static Object... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_97 | {
"fields": [
{
"declarator": "chemistryMap = null",
"modifier": "private static",
"original_string": "private static Map<String, Object> chemistryMap = null;",
"type": "Map<String, Object>",
"var_name": "chemistryMap"
},
{
"declarator": "physicsMap = null",
"modi... | {
"body": "@Test\n public void testGetByIdentifierFailureWithoutIndex() {\n try {\n esService.getDataByIdentifier(null, (String) chemistryMap.get(\"courseId\"));\n } catch (ProjectCommonException ex) {\n assertEquals(ResponseCode.SERVER_ERROR.getResponseCode(), ex.getResponseCode());\n }\n }",
... | {
"fields": [
{
"declarator": "WAIT_TIME = 30",
"modifier": "public static final",
"original_string": "public static final int WAIT_TIME = 30;",
"type": "int",
"var_name": "WAIT_TIME"
},
{
"declarator": "timeout = new Timeout(WAIT_TIME, TimeUnit.SECONDS)",
"modifi... | {
"body": "@Override\n public Future<Map<String, Object>> getDataByIdentifier(String index, String identifier) {\n long startTime = System.currentTimeMillis();\n Promise<Map<String, Object>> promise = Futures.promise();\n ProjectLogger.log(\n \"ElasticSearchTcpImpl:getDataByIdentifier: method started... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_224 | {
"fields": [
{
"declarator": "userRequestValidator = new UserRequestValidator()",
"modifier": "private static final",
"original_string": "private static final UserRequestValidator userRequestValidator = new UserRequestValidator();",
"type": "UserRequestValidator",
"var_name": "userR... | {
"body": "@Test\n public void testValidateCreateUserRequestFailureWithInvalidLanguage() {\n Request request = new Request();\n Map<String, Object> requestObj = new HashMap<>();\n requestObj.put(JsonKey.PHONE, \"9321234123\");\n requestObj.put(JsonKey.EMAIL, \"test123@test.com\");\n requestObj.put(Jso... | {
"fields": [
{
"declarator": "ERROR_CODE = ResponseCode.CLIENT_ERROR.getResponseCode()",
"modifier": "private static final",
"original_string": "private static final int ERROR_CODE = ResponseCode.CLIENT_ERROR.getResponseCode();",
"type": "int",
"var_name": "ERROR_CODE"
}
],
... | {
"body": "public void validateCreateUserRequest(Request userRequest) {\n externalIdsValidation(userRequest, JsonKey.CREATE);\n fieldsNotAllowed(\n Arrays.asList(\n JsonKey.REGISTERED_ORG_ID,\n JsonKey.ROOT_ORG_ID,\n JsonKey.PROVIDER,\n JsonKey.EXTERNAL_ID,\n ... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_253 | {
"fields": [
{
"declarator": "userRequestValidator = new UserRequestValidator()",
"modifier": "private static final",
"original_string": "private static final UserRequestValidator userRequestValidator = new UserRequestValidator();",
"type": "UserRequestValidator",
"var_name": "userR... | {
"body": "@Test\n public void testValidateFrameworkWithNullValue() {\n Request request = initailizeRequest();\n Map<String, Object> frameworkMap = createFrameWork();\n frameworkMap.put(\"medium\", null);\n request.getRequest().put(JsonKey.FRAMEWORK, frameworkMap);\n\n boolean response = false;\n t... | {
"fields": [
{
"declarator": "ERROR_CODE = ResponseCode.CLIENT_ERROR.getResponseCode()",
"modifier": "private static final",
"original_string": "private static final int ERROR_CODE = ResponseCode.CLIENT_ERROR.getResponseCode();",
"type": "int",
"var_name": "ERROR_CODE"
}
],
... | {
"body": "@SuppressWarnings(\"unchecked\")\n public void validateMandatoryFrameworkFields(\n Map<String, Object> userMap,\n List<String> frameworkFields,\n List<String> frameworkMandatoryFields) {\n if (userMap.containsKey(JsonKey.FRAMEWORK)) {\n Map<String, Object> frameworkRequest = (Map<St... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_316 | {
"fields": [
{
"declarator": "iterator",
"modifier": "private static",
"original_string": "private static Iterator iterator;",
"type": "Iterator",
"var_name": "iterator"
},
{
"declarator": "row",
"modifier": "private static",
"original_string": "private sta... | {
"body": "@Test\n public void testGetRecordWithTTLById() {\n Select.SelectionOrAlias alias = PowerMockito.mock(Select.SelectionOrAlias.class);\n Select select = PowerMockito.mock(Select.class);\n when(selectSelection.from(\"sunbird\", \"otp\")).thenReturn(select);\n when(select.where()).thenReturn(where... | {
"fields": [
{
"declarator": "connectionManager",
"modifier": "protected",
"original_string": "protected CassandraConnectionManager connectionManager;",
"type": "CassandraConnectionManager",
"var_name": "connectionManager"
}
],
"file": "sunbird-cassandra-utils/src/main/java/... | {
"body": "@Override\n public Response getRecordWithTTLById(\n String keyspaceName,\n String tableName,\n Map<String, Object> key,\n List<String> ttlFields,\n List<String> fields) {\n return getRecordWithTTLByIdentifier(keyspaceName, tableName, key, ttlFields, fields);\n }",
"class_met... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_58 | {
"fields": [],
"file": "sunbird-cassandra-migration/cassandra-migration/src/test/java/com/contrastsecurity/cassandra/migration/utils/FeatureDetectorTest.java",
"identifier": "FeatureDetectorTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void shouldDetectCommonsLogging() {\n assertThat(\n new FeatureDetector(Thread.currentThread().getContextClassLoader())\n .isApacheCommonsLoggingAvailable(),\n is(true));\n }",
"class_method_signature": "FeatureDetectorTest.shouldDetectCommonsLogging()",
"co... | {
"fields": [
{
"declarator": "classLoader",
"modifier": "private",
"original_string": "private ClassLoader classLoader;",
"type": "ClassLoader",
"var_name": "classLoader"
},
{
"declarator": "slf4jAvailable",
"modifier": "private",
"original_string": "privat... | {
"body": "public boolean isApacheCommonsLoggingAvailable() {\n if (apacheCommonsLoggingAvailable == null) {\n apacheCommonsLoggingAvailable = isPresent(\"org.apache.commons.logging.Log\", classLoader);\n }\n\n return apacheCommonsLoggingAvailable;\n }",
"class_method_signature": "FeatureDetector.isA... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_195 | {
"fields": [
{
"declarator": "userRequestValidator = new UserRequestValidator()",
"modifier": "private static final",
"original_string": "private static final UserRequestValidator userRequestValidator = new UserRequestValidator();",
"type": "UserRequestValidator",
"var_name": "userR... | {
"body": "@Test\n public void testValidateUserCreateV3Success() {\n boolean response = false;\n Request request = initailizeRequest();\n Map<String, Object> requestObj = request.getRequest();\n requestObj.put(JsonKey.PASSWORD, \"Password@1\");\n request.setRequest(requestObj);\n try {\n userR... | {
"fields": [
{
"declarator": "ERROR_CODE = ResponseCode.CLIENT_ERROR.getResponseCode()",
"modifier": "private static final",
"original_string": "private static final int ERROR_CODE = ResponseCode.CLIENT_ERROR.getResponseCode();",
"type": "int",
"var_name": "ERROR_CODE"
}
],
... | {
"body": "public void validateUserCreateV3(Request userRequest) {\n validateParam(\n (String) userRequest.getRequest().get(JsonKey.FIRST_NAME),\n ResponseCode.mandatoryParamsMissing,\n JsonKey.FIRST_NAME);\n if (StringUtils.isBlank((String) userRequest.getRequest().get(JsonKey.EMAIL))\n ... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_204 | {
"fields": [
{
"declarator": "userRequestValidator = new UserRequestValidator()",
"modifier": "private static final",
"original_string": "private static final UserRequestValidator userRequestValidator = new UserRequestValidator();",
"type": "UserRequestValidator",
"var_name": "userR... | {
"body": "@Test\n public void testValidateChangePasswordFailureWithEmptyNewPassword() {\n Request request = new Request();\n Map<String, Object> requestObj = new HashMap<>();\n requestObj.put(JsonKey.NEW_PASSWORD, \"\");\n requestObj.put(JsonKey.PASSWORD, \"password\");\n request.setRequest(requestOb... | {
"fields": [
{
"declarator": "ERROR_CODE = ResponseCode.CLIENT_ERROR.getResponseCode()",
"modifier": "private static final",
"original_string": "private static final int ERROR_CODE = ResponseCode.CLIENT_ERROR.getResponseCode();",
"type": "int",
"var_name": "ERROR_CODE"
}
],
... | {
"body": "public void validateChangePassword(Request userRequest) {\n if (userRequest.getRequest().get(JsonKey.PASSWORD) == null\n || (StringUtils.isBlank((String) userRequest.getRequest().get(JsonKey.PASSWORD)))) {\n ProjectCommonException.throwClientErrorException(ResponseCode.passwordRequired);\n ... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_212 | {
"fields": [
{
"declarator": "userRequestValidator = new UserRequestValidator()",
"modifier": "private static final",
"original_string": "private static final UserRequestValidator userRequestValidator = new UserRequestValidator();",
"type": "UserRequestValidator",
"var_name": "userR... | {
"body": "@Test\n public void testPhoneValidationFailureWithInvalidPhone() {\n Request request = new Request();\n Map<String, Object> requestObj = new HashMap<>();\n requestObj.put(JsonKey.PHONE, \"+9321234123\");\n requestObj.put(JsonKey.COUNTRY_CODE, \"+91\");\n requestObj.put(JsonKey.PROVIDER, \"s... | {
"fields": [
{
"declarator": "ERROR_CODE = ResponseCode.CLIENT_ERROR.getResponseCode()",
"modifier": "private static final",
"original_string": "private static final int ERROR_CODE = ResponseCode.CLIENT_ERROR.getResponseCode();",
"type": "int",
"var_name": "ERROR_CODE"
}
],
... | {
"body": "public void phoneValidation(Request userRequest) {\n if (!StringUtils.isBlank((String) userRequest.getRequest().get(JsonKey.COUNTRY_CODE))) {\n boolean bool =\n ProjectUtil.validateCountryCode(\n (String) userRequest.getRequest().get(JsonKey.COUNTRY_CODE));\n if (!bool) {... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_19 | {
"fields": [],
"file": "sunbird-cassandra-migration/cassandra-migration/src/test/java/com/contrastsecurity/cassandra/migration/resolver/MigrationInfoHelperTest.java",
"identifier": "MigrationInfoHelperTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void extractSchemaVersionWithDescriptionWithSpaces() {\n Pair<MigrationVersion, String> info =\n MigrationInfoHelper.extractVersionAndDescription(\"9_4__Big_jump\", \"\", \"__\", \"\");\n MigrationVersion version = info.getLeft();\n String description = info.getRight();\n ... | {
"fields": [],
"file": "sunbird-cassandra-migration/cassandra-migration/src/main/java/com/contrastsecurity/cassandra/migration/resolver/MigrationInfoHelper.java",
"identifier": "MigrationInfoHelper",
"interfaces": "",
"methods": [
{
"class_method_signature": "MigrationInfoHelper.MigrationInfoHelper... | {
"body": "public static Pair<MigrationVersion, String> extractVersionAndDescription(\n String migrationName, String prefix, String separator, String suffix) {\n String cleanMigrationName =\n migrationName.substring(prefix.length(), migrationName.length() - suffix.length());\n\n // Handle the descri... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_245 | {
"fields": [
{
"declarator": "userRequestValidator = new UserRequestValidator()",
"modifier": "private static final",
"original_string": "private static final UserRequestValidator userRequestValidator = new UserRequestValidator();",
"type": "UserRequestValidator",
"var_name": "userR... | {
"body": "@Test\n public void testValidateVerifyUserSuccess() {\n Request request = new Request();\n Map<String, Object> requestObj = new HashMap<>();\n requestObj.put(JsonKey.LOGIN_ID, \"username@provider\");\n request.setRequest(requestObj);\n boolean response = false;\n try {\n new UserReq... | {
"fields": [
{
"declarator": "ERROR_CODE = ResponseCode.CLIENT_ERROR.getResponseCode()",
"modifier": "private static final",
"original_string": "private static final int ERROR_CODE = ResponseCode.CLIENT_ERROR.getResponseCode();",
"type": "int",
"var_name": "ERROR_CODE"
}
],
... | {
"body": "public void validateVerifyUser(Request userRequest) {\n if (StringUtils.isBlank((String) userRequest.getRequest().get(JsonKey.LOGIN_ID))) {\n ProjectCommonException.throwClientErrorException(ResponseCode.loginIdRequired);\n }\n }",
"class_method_signature": "UserRequestValidator.validateVerif... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_300 | {
"fields": [
{
"declarator": "JSON_STRING_DATA = \"asdasasfasfsdfdsfdsfgsd\"",
"modifier": "public static final",
"original_string": "public static final String JSON_STRING_DATA = \"asdasasfasfsdfdsfdsfgsd\";",
"type": "String",
"var_name": "JSON_STRING_DATA"
}
],
"file": "s... | {
"body": "@Test\n public void testGetHeaderWithInput() throws Exception {\n PowerMockito.mockStatic(KeycloakRequiredActionLinkUtil.class);\n when(KeycloakRequiredActionLinkUtil.getAdminAccessToken()).thenReturn(\"testAuthToken\");\n Map<String, String> input = new HashMap<String, String>(){{\n put(\"x... | {
"fields": [],
"file": "sunbird-platform-core/common-util/src/main/java/org/sunbird/common/models/util/HttpUtil.java",
"identifier": "HttpUtil",
"interfaces": "",
"methods": [
{
"class_method_signature": "HttpUtil.HttpUtil()",
"constructor": true,
"full_signature": "private HttpUtil()"... | {
"body": "public static Map<String, String> getHeader(Map<String, String> input) throws Exception {\n return new HashMap<String, String>() {{\n put(\"Content-Type\", \"application/json\");\n put(JsonKey.X_AUTHENTICATED_USER_TOKEN, KeycloakRequiredActionLinkUtil.getAdminAccessToken());\n if(MapUtils... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_7 | {
"fields": [],
"file": "sunbird-cassandra-migration/cassandra-migration/src/test/java/com/contrastsecurity/cassandra/migration/resolver/java/JavaMigrationResolverTest.java",
"identifier": "JavaMigrationResolverTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test(expected = CassandraMigrationException.class)\n public void broken() {\n new JavaMigrationResolver(\n Thread.currentThread().getContextClassLoader(),\n new ScriptsLocation(\"com/contrastsecurity/cassandra/migration/resolver/java/error\"))\n .resolveMigrations();\n }"... | {
"fields": [
{
"declarator": "location",
"modifier": "private final",
"original_string": "private final ScriptsLocation location;",
"type": "ScriptsLocation",
"var_name": "location"
},
{
"declarator": "classLoader",
"modifier": "private",
"original_string":... | {
"body": "public List<ResolvedMigration> resolveMigrations() {\n List<ResolvedMigration> migrations = new ArrayList<ResolvedMigration>();\n\n if (!location.isClassPath()) {\n return migrations;\n }\n\n try {\n Class<?>[] classes = new Scanner(classLoader).scanForClasses(location, JavaMigration.... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_35 | {
"fields": [],
"file": "sunbird-cassandra-migration/cassandra-migration/src/test/java/com/contrastsecurity/cassandra/migration/info/MigrationVersionTest.java",
"identifier": "MigrationVersionTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test(expected = CassandraMigrationException.class)\n public void startDot() {\n MigrationVersion.fromVersion(\".1\");\n }",
"class_method_signature": "MigrationVersionTest.startDot()",
"constructor": false,
"full_signature": "@Test(expected = CassandraMigrationException.class) public void start... | {
"fields": [
{
"declarator": "EMPTY = new MigrationVersion(null, \"<< Empty Schema >>\")",
"modifier": "public static final",
"original_string": "public static final MigrationVersion EMPTY = new MigrationVersion(null, \"<< Empty Schema >>\");",
"type": "MigrationVersion",
"var_name"... | {
"body": "public static MigrationVersion fromVersion(String version) {\n if (\"current\".equalsIgnoreCase(version)) return CURRENT;\n if (LATEST.getVersion().equals(version)) return LATEST;\n if (version == null) return EMPTY;\n return new MigrationVersion(version);\n }",
"class_method_signature": "Mi... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_117 | {
"fields": [],
"file": "sunbird-es-utils/src/test/java/org/sunbird/helper/ConnectionManagerTest.java",
"identifier": "ConnectionManagerTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n\tpublic void testInitialiseConnectionFromPropertiesFileFailWithEmpty() {\n\t\tboolean response = ConnectionManager.initialiseConnectionFromPropertiesFile(\"test\", \"localhost\", \"\");\n\t\tAssert.assertFalse(response);\n\t}",
"class_method_signature": "ConnectionManagerTest.testInitialiseConnec... | {
"fields": [
{
"declarator": "client = null",
"modifier": "private static",
"original_string": "private static TransportClient client = null;",
"type": "TransportClient",
"var_name": "client"
},
{
"declarator": "restClient = null",
"modifier": "private static",
... | {
"body": "public static boolean initialiseConnectionFromPropertiesFile(\n String cluster, String hostName, String port) {\n try {\n String[] splitedHost = hostName.split(\",\");\n for (String val : splitedHost) {\n host.add(val);\n }\n String[] splitedPort = port.split(\",\");\n ... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_286 | {
"fields": [
{
"declarator": "propertiesCache = ProjectUtil.propertiesCache",
"modifier": "private",
"original_string": "private PropertiesCache propertiesCache = ProjectUtil.propertiesCache;",
"type": "PropertiesCache",
"var_name": "propertiesCache"
},
{
"declarator":... | {
"body": "@Test\n public void testGetDateRangeFailureWithNegativeValue() {\n int noOfDays = -100;\n Map<String, String> map = ProjectUtil.getDateRange(noOfDays);\n assertNull(map.get(\"startDate\"));\n assertNull(map.get(\"endDate\"));\n }",
"class_method_signature": "ProjectUtilTest.testGetDateRange... | {
"fields": [
{
"declarator": "atomicInteger = new AtomicInteger()",
"modifier": "private static",
"original_string": "private static AtomicInteger atomicInteger = new AtomicInteger();",
"type": "AtomicInteger",
"var_name": "atomicInteger"
},
{
"declarator": "DEFAULT_BA... | {
"body": "public static Map<String, String> getDateRange(int numDays) {\n Map<String, String> map = new HashMap<>();\n if (numDays <= 0) {\n return map;\n }\n Calendar cal = Calendar.getInstance(TimeZone.getTimeZone(\"GMT\"));\n cal.add(Calendar.DATE, -numDays);\n map.put(STARTDATE, new Simple... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_62 | {
"fields": [],
"file": "sunbird-cassandra-migration/cassandra-migration/src/test/java/com/contrastsecurity/cassandra/migration/utils/scanner/classpath/ClassPathResourceTest.java",
"identifier": "ClassPathResourceTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void getFilename() throws Exception {\n assertEquals(\n \"Mig777__Test.cql\",\n new ClassPathResource(\"Mig777__Test.cql\", Thread.currentThread().getContextClassLoader())\n .getFilename());\n assertEquals(\n \"Mig777__Test.cql\",\n new ClassPath... | {
"fields": [
{
"declarator": "location",
"modifier": "private",
"original_string": "private String location;",
"type": "String",
"var_name": "location"
},
{
"declarator": "classLoader",
"modifier": "private",
"original_string": "private ClassLoader classLoa... | {
"body": "public String getFilename() {\n return location.substring(location.lastIndexOf(\"/\") + 1);\n }",
"class_method_signature": "ClassPathResource.getFilename()",
"constructor": false,
"full_signature": "public String getFilename()",
"identifier": "getFilename",
"invocations": [
"substring",
... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_269 | {
"fields": [
{
"declarator": "propertiesCache = ProjectUtil.propertiesCache",
"modifier": "private",
"original_string": "private PropertiesCache propertiesCache = ProjectUtil.propertiesCache;",
"type": "PropertiesCache",
"var_name": "propertiesCache"
},
{
"declarator":... | {
"body": "@Test\n public void testIsDateValidFormatFailureWithEmptyDateTime() {\n boolean bool = ProjectUtil.isDateValidFormat(\"yyyy-MM-dd HH:mm:ss:SSSZ\", \"\");\n assertFalse(bool);\n }",
"class_method_signature": "ProjectUtilTest.testIsDateValidFormatFailureWithEmptyDateTime()",
"constructor": false,... | {
"fields": [
{
"declarator": "atomicInteger = new AtomicInteger()",
"modifier": "private static",
"original_string": "private static AtomicInteger atomicInteger = new AtomicInteger();",
"type": "AtomicInteger",
"var_name": "atomicInteger"
},
{
"declarator": "DEFAULT_BA... | {
"body": "public static boolean isDateValidFormat(String format, String value) {\n Date date = null;\n try {\n SimpleDateFormat sdf = new SimpleDateFormat(format);\n date = sdf.parse(value);\n if (!value.equals(sdf.format(date))) {\n date = null;\n }\n } catch (ParseException ex) ... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_140 | {
"fields": [
{
"declarator": "keyCloakService = SSOServiceFactory.getInstance()",
"modifier": "private",
"original_string": "private SSOManager keyCloakService = SSOServiceFactory.getInstance();",
"type": "SSOManager",
"var_name": "keyCloakService"
},
{
"declarator": "... | {
"body": "@Test\n public void testUpdatePassword() throws Exception {\n boolean updated = keyCloakService.updatePassword(userId.get(JsonKey.USER_ID), \"password\");\n Assert.assertTrue(updated);\n }",
"class_method_signature": "KeyCloakServiceImplTest.testUpdatePassword()",
"constructor": false,
"full_... | {
"fields": [
{
"declarator": "keycloak = KeyCloakConnectionProvider.getConnection()",
"modifier": "private",
"original_string": "private Keycloak keycloak = KeyCloakConnectionProvider.getConnection();",
"type": "Keycloak",
"var_name": "keycloak"
},
{
"declarator": "URL... | {
"body": "@Override\n public boolean updatePassword(String userId, String password) {\n try {\n String fedUserId = getFederatedUserId(userId);\n UserResource ur = keycloak.realm(KeyCloakConnectionProvider.SSO_REALM).users().get(fedUserId);\n CredentialRepresentation cr = new CredentialRepresentati... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_74 | {
"fields": [
{
"declarator": "esService = EsClientFactory.getInstance(JsonKey.REST)",
"modifier": "private",
"original_string": "private ElasticSearchService esService = EsClientFactory.getInstance(JsonKey.REST);",
"type": "ElasticSearchService",
"var_name": "esService"
},
{... | {
"body": "@Test\n public void testUpdateFailure() {\n mockRulesForUpdate(true);\n Future<Boolean> result = esService.update(\"test\", \"001\", new HashMap<>());\n Object res = ElasticSearchHelper.getResponseFromFuture(result);\n assertEquals(null, res);\n }",
"class_method_signature": "ElasticSearchR... | {
"fields": [
{
"declarator": "ERROR = \"ERROR\"",
"modifier": "private static final",
"original_string": "private static final String ERROR = \"ERROR\";",
"type": "String",
"var_name": "ERROR"
}
],
"file": "sunbird-es-utils/src/main/java/org/sunbird/common/ElasticSearchRestH... | {
"body": "@Override\n public Future<Boolean> update(String index, String identifier, Map<String, Object> data) {\n long startTime = System.currentTimeMillis();\n ProjectLogger.log(\n \"ElasticSearchRestHighImpl:update: method started at ==\"\n + startTime\n + \" for Index \"\n ... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_290 | {
"fields": [
{
"declarator": "propertiesCache = ProjectUtil.propertiesCache",
"modifier": "private",
"original_string": "private PropertiesCache propertiesCache = ProjectUtil.propertiesCache;",
"type": "PropertiesCache",
"var_name": "propertiesCache"
},
{
"declarator":... | {
"body": "@Test\n public void testMigrateActionAcceptValueFailure() {\n Assert.assertNotEquals(\"ok\", ProjectUtil.MigrateAction.ACCEPT.getValue());\n }",
"class_method_signature": "ProjectUtilTest.testMigrateActionAcceptValueFailure()",
"constructor": false,
"full_signature": "@Test public void testMigra... | {
"fields": [
{
"declarator": "atomicInteger = new AtomicInteger()",
"modifier": "private static",
"original_string": "private static AtomicInteger atomicInteger = new AtomicInteger();",
"type": "AtomicInteger",
"var_name": "atomicInteger"
},
{
"declarator": "DEFAULT_BA... | {
"body": "private static Object getValue(Map<String, Object> map, String key) {\n Object value = map.get(key);\n map.remove(key);\n return value;\n }",
"class_method_signature": "ProjectUtil.getValue(Map<String, Object> map, String key)",
"constructor": false,
"full_signature": "private static Object... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_156 | {
"fields": [],
"file": "sunbird-platform-core/common-util/src/test/java/org/sunbird/common/request/RequestValidatorTest.java",
"identifier": "RequestValidatorTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testValidteUpdateContentFailureWithoutStatus() {\n Request request = new Request();\n List<Map<String, Object>> listOfMap = new ArrayList<>();\n Map<String, Object> requestObj = new HashMap<>();\n requestObj.put(JsonKey.CONTENT_ID, \"do_1233343\");\n listOfMap.add(reques... | {
"fields": [
{
"declarator": "ERROR_CODE = ResponseCode.CLIENT_ERROR.getResponseCode()",
"modifier": "private static final",
"original_string": "private static final int ERROR_CODE = ResponseCode.CLIENT_ERROR.getResponseCode();",
"type": "int",
"var_name": "ERROR_CODE"
}
],
... | {
"body": "@SuppressWarnings(\"unchecked\")\n public static void validateUpdateContent(Request contentRequestDto) {\n List<Map<String, Object>> list =\n (List<Map<String, Object>>) (contentRequestDto.getRequest().get(JsonKey.CONTENTS));\n if(CollectionUtils.isNotEmpty(list)) {\n for (Map<String... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_23 | {
"fields": [],
"file": "sunbird-cassandra-migration/cassandra-migration/src/test/java/com/contrastsecurity/cassandra/migration/resolver/MigrationInfoHelperTest.java",
"identifier": "MigrationInfoHelperTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void extractSchemaVersionWithVUnderscorePrefix() {\n Pair<MigrationVersion, String> info =\n MigrationInfoHelper.extractVersionAndDescription(\n \"V_8_0__Description.cql\", \"V_\", \"__\", \".cql\");\n MigrationVersion version = info.getLeft();\n String descriptio... | {
"fields": [],
"file": "sunbird-cassandra-migration/cassandra-migration/src/main/java/com/contrastsecurity/cassandra/migration/resolver/MigrationInfoHelper.java",
"identifier": "MigrationInfoHelper",
"interfaces": "",
"methods": [
{
"class_method_signature": "MigrationInfoHelper.MigrationInfoHelper... | {
"body": "public static Pair<MigrationVersion, String> extractVersionAndDescription(\n String migrationName, String prefix, String separator, String suffix) {\n String cleanMigrationName =\n migrationName.substring(prefix.length(), migrationName.length() - suffix.length());\n\n // Handle the descri... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_228 | {
"fields": [
{
"declarator": "userRequestValidator = new UserRequestValidator()",
"modifier": "private static final",
"original_string": "private static final UserRequestValidator userRequestValidator = new UserRequestValidator();",
"type": "UserRequestValidator",
"var_name": "userR... | {
"body": "@Test\n public void testValidateCreateUserRequestFailureWithInvalidCountryCode() {\n Request request = new Request();\n Map<String, Object> requestObj = new HashMap<>();\n requestObj.put(JsonKey.PHONE, \"9321234123\");\n requestObj.put(JsonKey.PHONE_VERIFIED, true);\n requestObj.put(JsonKey... | {
"fields": [
{
"declarator": "ERROR_CODE = ResponseCode.CLIENT_ERROR.getResponseCode()",
"modifier": "private static final",
"original_string": "private static final int ERROR_CODE = ResponseCode.CLIENT_ERROR.getResponseCode();",
"type": "int",
"var_name": "ERROR_CODE"
}
],
... | {
"body": "public void validateCreateUserRequest(Request userRequest) {\n externalIdsValidation(userRequest, JsonKey.CREATE);\n fieldsNotAllowed(\n Arrays.asList(\n JsonKey.REGISTERED_ORG_ID,\n JsonKey.ROOT_ORG_ID,\n JsonKey.PROVIDER,\n JsonKey.EXTERNAL_ID,\n ... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_101 | {
"fields": [
{
"declarator": "chemistryMap = null",
"modifier": "private static",
"original_string": "private static Map<String, Object> chemistryMap = null;",
"type": "Map<String, Object>",
"var_name": "chemistryMap"
},
{
"declarator": "physicsMap = null",
"modi... | {
"body": "@Test\n public void testUpdateDataFailureWithEmptyMap() {\n Map<String, Object> innermap = new HashMap<>();\n Future<Boolean> response =\n esService.update(INDEX_NAME, (String) chemistryMap.get(\"courseId\"), innermap);\n boolean result = (boolean) ElasticSearchHelper.getResponseFromFuture... | {
"fields": [
{
"declarator": "WAIT_TIME = 30",
"modifier": "public static final",
"original_string": "public static final int WAIT_TIME = 30;",
"type": "int",
"var_name": "WAIT_TIME"
},
{
"declarator": "timeout = new Timeout(WAIT_TIME, TimeUnit.SECONDS)",
"modifi... | {
"body": "@Override\n public Future<Boolean> update(String index, String identifier, Map<String, Object> data) {\n long startTime = System.currentTimeMillis();\n Promise<Boolean> promise = Futures.promise();\n ProjectLogger.log(\n \"ElasticSearchTcpImpl:update: method started at ==\" + startTime + \... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_100 | {
"fields": [
{
"declarator": "chemistryMap = null",
"modifier": "private static",
"original_string": "private static Map<String, Object> chemistryMap = null;",
"type": "Map<String, Object>",
"var_name": "chemistryMap"
},
{
"declarator": "physicsMap = null",
"modi... | {
"body": "@Test\n public void testUpdateDataFailureWithoutIdentifier() {\n Map<String, Object> innermap = new HashMap<>();\n innermap.put(\"courseName\", \"Updated Course Name\");\n innermap.put(\"organisationId\", \"updatedOrgId\");\n Future<Boolean> response = esService.update(INDEX_NAME, null, innerm... | {
"fields": [
{
"declarator": "WAIT_TIME = 30",
"modifier": "public static final",
"original_string": "public static final int WAIT_TIME = 30;",
"type": "int",
"var_name": "WAIT_TIME"
},
{
"declarator": "timeout = new Timeout(WAIT_TIME, TimeUnit.SECONDS)",
"modifi... | {
"body": "@Override\n public Future<Boolean> update(String index, String identifier, Map<String, Object> data) {\n long startTime = System.currentTimeMillis();\n Promise<Boolean> promise = Futures.promise();\n ProjectLogger.log(\n \"ElasticSearchTcpImpl:update: method started at ==\" + startTime + \... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_22 | {
"fields": [],
"file": "sunbird-cassandra-migration/cassandra-migration/src/test/java/com/contrastsecurity/cassandra/migration/resolver/MigrationInfoHelperTest.java",
"identifier": "MigrationInfoHelperTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test(expected = CassandraMigrationException.class)\n public void extractSchemaVersionWithLeadingUnderscoreAndPrefix() {\n MigrationInfoHelper.extractVersionAndDescription(\"V_8_0__Description.cql\", \"V\", \"__\", \".cql\");\n }",
"class_method_signature": "MigrationInfoHelperTest.extractSchemaVers... | {
"fields": [],
"file": "sunbird-cassandra-migration/cassandra-migration/src/main/java/com/contrastsecurity/cassandra/migration/resolver/MigrationInfoHelper.java",
"identifier": "MigrationInfoHelper",
"interfaces": "",
"methods": [
{
"class_method_signature": "MigrationInfoHelper.MigrationInfoHelper... | {
"body": "public static Pair<MigrationVersion, String> extractVersionAndDescription(\n String migrationName, String prefix, String separator, String suffix) {\n String cleanMigrationName =\n migrationName.substring(prefix.length(), migrationName.length() - suffix.length());\n\n // Handle the descri... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_229 | {
"fields": [
{
"declarator": "userRequestValidator = new UserRequestValidator()",
"modifier": "private static final",
"original_string": "private static final UserRequestValidator userRequestValidator = new UserRequestValidator();",
"type": "UserRequestValidator",
"var_name": "userR... | {
"body": "@Test\n public void testValidateCreateUserRequestFailureWithEmptyEmailAndPhone() {\n Request request = new Request();\n Map<String, Object> requestObj = new HashMap<>();\n requestObj.put(JsonKey.USERNAME, \"test123\");\n requestObj.put(JsonKey.PHONE, \"9321234123\");\n requestObj.put(JsonKe... | {
"fields": [
{
"declarator": "ERROR_CODE = ResponseCode.CLIENT_ERROR.getResponseCode()",
"modifier": "private static final",
"original_string": "private static final int ERROR_CODE = ResponseCode.CLIENT_ERROR.getResponseCode();",
"type": "int",
"var_name": "ERROR_CODE"
}
],
... | {
"body": "public void validateCreateUserRequest(Request userRequest) {\n externalIdsValidation(userRequest, JsonKey.CREATE);\n fieldsNotAllowed(\n Arrays.asList(\n JsonKey.REGISTERED_ORG_ID,\n JsonKey.ROOT_ORG_ID,\n JsonKey.PROVIDER,\n JsonKey.EXTERNAL_ID,\n ... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_157 | {
"fields": [],
"file": "sunbird-platform-core/common-util/src/test/java/org/sunbird/common/request/RequestValidatorTest.java",
"identifier": "RequestValidatorTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testValidteUpdateContentFailureWithEmptyContents() {\n Request request = new Request();\n List<Map<String, Object>> listOfMap = new ArrayList<>();\n Map<String, Object> requestObj = new HashMap<>();\n requestObj.put(JsonKey.CONTENT_ID, \"do_1233343\");\n Map<String, Obje... | {
"fields": [
{
"declarator": "ERROR_CODE = ResponseCode.CLIENT_ERROR.getResponseCode()",
"modifier": "private static final",
"original_string": "private static final int ERROR_CODE = ResponseCode.CLIENT_ERROR.getResponseCode();",
"type": "int",
"var_name": "ERROR_CODE"
}
],
... | {
"body": "@SuppressWarnings(\"unchecked\")\n public static void validateUpdateContent(Request contentRequestDto) {\n List<Map<String, Object>> list =\n (List<Map<String, Object>>) (contentRequestDto.getRequest().get(JsonKey.CONTENTS));\n if(CollectionUtils.isNotEmpty(list)) {\n for (Map<String... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_75 | {
"fields": [
{
"declarator": "esService = EsClientFactory.getInstance(JsonKey.REST)",
"modifier": "private",
"original_string": "private ElasticSearchService esService = EsClientFactory.getInstance(JsonKey.REST);",
"type": "ElasticSearchService",
"var_name": "esService"
},
{... | {
"body": "@Test\n public void testUpdateFailureWithEmptyIndex() {\n try {\n esService.update(\"\", \"001\", new HashMap<>());\n } catch (ProjectCommonException e) {\n assertEquals(e.getResponseCode(), ResponseCode.invalidData.getResponseCode());\n }\n }",
"class_method_signature": "ElasticSear... | {
"fields": [
{
"declarator": "ERROR = \"ERROR\"",
"modifier": "private static final",
"original_string": "private static final String ERROR = \"ERROR\";",
"type": "String",
"var_name": "ERROR"
}
],
"file": "sunbird-es-utils/src/main/java/org/sunbird/common/ElasticSearchRestH... | {
"body": "@Override\n public Future<Boolean> update(String index, String identifier, Map<String, Object> data) {\n long startTime = System.currentTimeMillis();\n ProjectLogger.log(\n \"ElasticSearchRestHighImpl:update: method started at ==\"\n + startTime\n + \" for Index \"\n ... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_291 | {
"fields": [
{
"declarator": "propertiesCache = ProjectUtil.propertiesCache",
"modifier": "private",
"original_string": "private PropertiesCache propertiesCache = ProjectUtil.propertiesCache;",
"type": "PropertiesCache",
"var_name": "propertiesCache"
},
{
"declarator":... | {
"body": "@Test\n public void testMigrateActionRejectValueFailure() {\n Assert.assertNotEquals(\"no\", ProjectUtil.MigrateAction.REJECT.getValue());\n }",
"class_method_signature": "ProjectUtilTest.testMigrateActionRejectValueFailure()",
"constructor": false,
"full_signature": "@Test public void testMigra... | {
"fields": [
{
"declarator": "atomicInteger = new AtomicInteger()",
"modifier": "private static",
"original_string": "private static AtomicInteger atomicInteger = new AtomicInteger();",
"type": "AtomicInteger",
"var_name": "atomicInteger"
},
{
"declarator": "DEFAULT_BA... | {
"body": "private static Object getValue(Map<String, Object> map, String key) {\n Object value = map.get(key);\n map.remove(key);\n return value;\n }",
"class_method_signature": "ProjectUtil.getValue(Map<String, Object> map, String key)",
"constructor": false,
"full_signature": "private static Object... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_287 | {
"fields": [
{
"declarator": "propertiesCache = ProjectUtil.propertiesCache",
"modifier": "private",
"original_string": "private PropertiesCache propertiesCache = ProjectUtil.propertiesCache;",
"type": "PropertiesCache",
"var_name": "propertiesCache"
},
{
"declarator":... | {
"body": "@Test\n public void testIsEmailValidFailureWithInvalidFormat() {\n boolean bool = ProjectUtil.isEmailvalid(\"amit.kumartarento.com\");\n Assert.assertFalse(bool);\n }",
"class_method_signature": "ProjectUtilTest.testIsEmailValidFailureWithInvalidFormat()",
"constructor": false,
"full_signatur... | {
"fields": [
{
"declarator": "atomicInteger = new AtomicInteger()",
"modifier": "private static",
"original_string": "private static AtomicInteger atomicInteger = new AtomicInteger();",
"type": "AtomicInteger",
"var_name": "atomicInteger"
},
{
"declarator": "DEFAULT_BA... | {
"body": "public static boolean isEmailvalid(final String email) {\n if (StringUtils.isBlank(email)) {\n return false;\n }\n Matcher matcher = pattern.matcher(email);\n return matcher.matches();\n }",
"class_method_signature": "ProjectUtil.isEmailvalid(final String email)",
"constructor": false... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_63 | {
"fields": [],
"file": "sunbird-cassandra-migration/cassandra-migration/src/test/java/com/contrastsecurity/cassandra/migration/utils/scanner/classpath/ClassPathResourceTest.java",
"identifier": "ClassPathResourceTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void loadAsStringUtf8WithoutBOM() {\n assertEquals(\n \"SELECT * FROM contents;\",\n new ClassPathResource(\n \"com/contrastsecurity/cassandra/migration/utils/scanner/classpath/utf8.nofilter\",\n Thread.currentThread().getContextClassLoader())\... | {
"fields": [
{
"declarator": "location",
"modifier": "private",
"original_string": "private String location;",
"type": "String",
"var_name": "location"
},
{
"declarator": "classLoader",
"modifier": "private",
"original_string": "private ClassLoader classLoa... | {
"body": "public String loadAsString(String encoding) {\n try {\n InputStream inputStream = classLoader.getResourceAsStream(location);\n if (inputStream == null) {\n throw new CassandraMigrationException(\n \"Unable to obtain inputstream for resource: \" + location);\n }\n Re... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_268 | {
"fields": [
{
"declarator": "propertiesCache = ProjectUtil.propertiesCache",
"modifier": "private",
"original_string": "private PropertiesCache propertiesCache = ProjectUtil.propertiesCache;",
"type": "PropertiesCache",
"var_name": "propertiesCache"
},
{
"declarator":... | {
"body": "@Test\n public void testIsDateValidFormatFailureWithInvalidDate() {\n boolean bool = ProjectUtil.isDateValidFormat(\"yyyy-MM-dd\", \"2017-12-18\");\n assertTrue(bool);\n }",
"class_method_signature": "ProjectUtilTest.testIsDateValidFormatFailureWithInvalidDate()",
"constructor": false,
"full_... | {
"fields": [
{
"declarator": "atomicInteger = new AtomicInteger()",
"modifier": "private static",
"original_string": "private static AtomicInteger atomicInteger = new AtomicInteger();",
"type": "AtomicInteger",
"var_name": "atomicInteger"
},
{
"declarator": "DEFAULT_BA... | {
"body": "public static boolean isDateValidFormat(String format, String value) {\n Date date = null;\n try {\n SimpleDateFormat sdf = new SimpleDateFormat(format);\n date = sdf.parse(value);\n if (!value.equals(sdf.format(date))) {\n date = null;\n }\n } catch (ParseException ex) ... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_116 | {
"fields": [],
"file": "sunbird-es-utils/src/test/java/org/sunbird/helper/ConnectionManagerTest.java",
"identifier": "ConnectionManagerTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n\t@Ignore\n\tpublic void testInitialiseConnectionFromPropertiesFile() {\n\t\tboolean response = ConnectionManager.initialiseConnectionFromPropertiesFile(\"test\", \"localhost\", \"9200\");\n\t\tAssert.assertTrue(response);\n\t}",
"class_method_signature": "ConnectionManagerTest.testInitialiseConne... | {
"fields": [
{
"declarator": "client = null",
"modifier": "private static",
"original_string": "private static TransportClient client = null;",
"type": "TransportClient",
"var_name": "client"
},
{
"declarator": "restClient = null",
"modifier": "private static",
... | {
"body": "public static boolean initialiseConnectionFromPropertiesFile(\n String cluster, String hostName, String port) {\n try {\n String[] splitedHost = hostName.split(\",\");\n for (String val : splitedHost) {\n host.add(val);\n }\n String[] splitedPort = port.split(\",\");\n ... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_34 | {
"fields": [],
"file": "sunbird-cassandra-migration/cassandra-migration/src/test/java/com/contrastsecurity/cassandra/migration/info/MigrationVersionTest.java",
"identifier": "MigrationVersionTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test(expected = CassandraMigrationException.class)\n public void dot() {\n MigrationVersion.fromVersion(\".\");\n }",
"class_method_signature": "MigrationVersionTest.dot()",
"constructor": false,
"full_signature": "@Test(expected = CassandraMigrationException.class) public void dot()",
"ident... | {
"fields": [
{
"declarator": "EMPTY = new MigrationVersion(null, \"<< Empty Schema >>\")",
"modifier": "public static final",
"original_string": "public static final MigrationVersion EMPTY = new MigrationVersion(null, \"<< Empty Schema >>\");",
"type": "MigrationVersion",
"var_name"... | {
"body": "public static MigrationVersion fromVersion(String version) {\n if (\"current\".equalsIgnoreCase(version)) return CURRENT;\n if (LATEST.getVersion().equals(version)) return LATEST;\n if (version == null) return EMPTY;\n return new MigrationVersion(version);\n }",
"class_method_signature": "Mi... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_182 | {
"fields": [],
"file": "sunbird-platform-core/common-util/src/test/java/org/sunbird/common/request/RequestValidatorTest.java",
"identifier": "RequestValidatorTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testValidateGetClientKeyFailureWithEmptyClientType() {\n boolean response = false;\n try {\n RequestValidator.validateGetClientKey(\"clientId\", \"\");\n response = true;\n } catch (ProjectCommonException e) {\n assertEquals(ResponseCode.CLIENT_ERROR.getResponse... | {
"fields": [
{
"declarator": "ERROR_CODE = ResponseCode.CLIENT_ERROR.getResponseCode()",
"modifier": "private static final",
"original_string": "private static final int ERROR_CODE = ResponseCode.CLIENT_ERROR.getResponseCode();",
"type": "int",
"var_name": "ERROR_CODE"
}
],
... | {
"body": "public static void validateGetClientKey(String id, String type) {\n validateClientId(id);\n if (StringUtils.isBlank(type)) {\n throw createExceptionInstance(ResponseCode.invalidRequestData.getErrorCode());\n }\n }",
"class_method_signature": "RequestValidator.validateGetClientKey(String id... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_6 | {
"fields": [
{
"declarator": "service = null",
"modifier": "private static",
"original_string": "private static IEmailService service = null;",
"type": "IEmailService",
"var_name": "service"
}
],
"file": "notification-sdk/src/test/java/org/sunbird/notification/email/service/... | {
"body": "@Test\n\tpublic void sendEmailFailure () {\n\t\tList<String> to = new ArrayList<String>();\n\t\tMap<String,String> param = new HashMap<String, String>();\n\t\tparam.put(\"name\", \"test\");\n\t\tEmailRequest emailReq = new EmailRequest(\"testEmail\", to, null, null, \"emailtemplate\", null, param);\n\t\tbo... | {
"fields": [
{
"declarator": "logger = LogManager.getLogger(SmtpEMailServiceImpl.class)",
"modifier": "private static",
"original_string": "private static Logger logger = LogManager.getLogger(SmtpEMailServiceImpl.class);",
"type": "Logger",
"var_name": "logger"
},
{
"d... | {
"body": "@Override\n public boolean sendEmail(EmailRequest emailReq) {\n if (emailReq == null) {\n logger.info(\"Email request is null or empty:\");\n return false;\n // either email object has bcc or to list size more than 1 then pass it as bcc.\n } else if (CollectionUtils.isNotEmpty(emailRe... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_244 | {
"fields": [
{
"declarator": "userRequestValidator = new UserRequestValidator()",
"modifier": "private static final",
"original_string": "private static final UserRequestValidator userRequestValidator = new UserRequestValidator();",
"type": "UserRequestValidator",
"var_name": "userR... | {
"body": "@Test\n public void testValidateCreateUserFailureWithInvalidPhoneFormat() {\n Request request = new Request();\n request.getRequest().put(JsonKey.EMAIL, \"asd@asd.com\");\n request.getRequest().put(JsonKey.EMAIL_VERIFIED, true);\n request.getRequest().put(JsonKey.PHONE, \"9874561230\");\n r... | {
"fields": [
{
"declarator": "ERROR_CODE = ResponseCode.CLIENT_ERROR.getResponseCode()",
"modifier": "private static final",
"original_string": "private static final int ERROR_CODE = ResponseCode.CLIENT_ERROR.getResponseCode();",
"type": "int",
"var_name": "ERROR_CODE"
}
],
... | {
"body": "public void validateCreateUserRequest(Request userRequest) {\n externalIdsValidation(userRequest, JsonKey.CREATE);\n fieldsNotAllowed(\n Arrays.asList(\n JsonKey.REGISTERED_ORG_ID,\n JsonKey.ROOT_ORG_ID,\n JsonKey.PROVIDER,\n JsonKey.EXTERNAL_ID,\n ... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_301 | {
"fields": [
{
"declarator": "JSON_STRING_DATA = \"asdasasfasfsdfdsfdsfgsd\"",
"modifier": "public static final",
"original_string": "public static final String JSON_STRING_DATA = \"asdasasfasfsdfdsfdsfgsd\";",
"type": "String",
"var_name": "JSON_STRING_DATA"
}
],
"file": "s... | {
"body": "@Test\n public void testGetHeaderWithoutInput() throws Exception {\n PowerMockito.mockStatic(KeycloakRequiredActionLinkUtil.class);\n when(KeycloakRequiredActionLinkUtil.getAdminAccessToken()).thenReturn(\"testAuthToken\");\n Map<String, String> headers = HttpUtil.getHeader(null);\n assertTrue... | {
"fields": [],
"file": "sunbird-platform-core/common-util/src/main/java/org/sunbird/common/models/util/HttpUtil.java",
"identifier": "HttpUtil",
"interfaces": "",
"methods": [
{
"class_method_signature": "HttpUtil.HttpUtil()",
"constructor": true,
"full_signature": "private HttpUtil()"... | {
"body": "public static Map<String, String> getHeader(Map<String, String> input) throws Exception {\n return new HashMap<String, String>() {{\n put(\"Content-Type\", \"application/json\");\n put(JsonKey.X_AUTHENTICATED_USER_TOKEN, KeycloakRequiredActionLinkUtil.getAdminAccessToken());\n if(MapUtils... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_213 | {
"fields": [
{
"declarator": "userRequestValidator = new UserRequestValidator()",
"modifier": "private static final",
"original_string": "private static final UserRequestValidator userRequestValidator = new UserRequestValidator();",
"type": "UserRequestValidator",
"var_name": "userR... | {
"body": "@Test\n public void testPhoneValidationFailureWithInvalidCountryCode() {\n Request request = new Request();\n Map<String, Object> requestObj = new HashMap<>();\n requestObj.put(JsonKey.PHONE, \"+9321234123\");\n requestObj.put(JsonKey.COUNTRY_CODE, \"+91968\");\n requestObj.put(JsonKey.PROV... | {
"fields": [
{
"declarator": "ERROR_CODE = ResponseCode.CLIENT_ERROR.getResponseCode()",
"modifier": "private static final",
"original_string": "private static final int ERROR_CODE = ResponseCode.CLIENT_ERROR.getResponseCode();",
"type": "int",
"var_name": "ERROR_CODE"
}
],
... | {
"body": "public void phoneValidation(Request userRequest) {\n if (!StringUtils.isBlank((String) userRequest.getRequest().get(JsonKey.COUNTRY_CODE))) {\n boolean bool =\n ProjectUtil.validateCountryCode(\n (String) userRequest.getRequest().get(JsonKey.COUNTRY_CODE));\n if (!bool) {... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_18 | {
"fields": [],
"file": "sunbird-cassandra-migration/cassandra-migration/src/test/java/com/contrastsecurity/cassandra/migration/resolver/MigrationInfoHelperTest.java",
"identifier": "MigrationInfoHelperTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void extractSchemaVersionWithDescription() {\n Pair<MigrationVersion, String> info =\n MigrationInfoHelper.extractVersionAndDescription(\"9_4__EmailAxel\", \"\", \"__\", \"\");\n MigrationVersion version = info.getLeft();\n String description = info.getRight();\n assertEq... | {
"fields": [],
"file": "sunbird-cassandra-migration/cassandra-migration/src/main/java/com/contrastsecurity/cassandra/migration/resolver/MigrationInfoHelper.java",
"identifier": "MigrationInfoHelper",
"interfaces": "",
"methods": [
{
"class_method_signature": "MigrationInfoHelper.MigrationInfoHelper... | {
"body": "public static Pair<MigrationVersion, String> extractVersionAndDescription(\n String migrationName, String prefix, String separator, String suffix) {\n String cleanMigrationName =\n migrationName.substring(prefix.length(), migrationName.length() - suffix.length());\n\n // Handle the descri... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_205 | {
"fields": [
{
"declarator": "userRequestValidator = new UserRequestValidator()",
"modifier": "private static final",
"original_string": "private static final UserRequestValidator userRequestValidator = new UserRequestValidator();",
"type": "UserRequestValidator",
"var_name": "userR... | {
"body": "@Test\n public void testValidateChangePasswordFailureWithoutNewPassword() {\n Request request = new Request();\n Map<String, Object> requestObj = new HashMap<>();\n requestObj.put(JsonKey.PASSWORD, \"password\");\n request.setRequest(requestObj);\n try {\n userRequestValidator.validate... | {
"fields": [
{
"declarator": "ERROR_CODE = ResponseCode.CLIENT_ERROR.getResponseCode()",
"modifier": "private static final",
"original_string": "private static final int ERROR_CODE = ResponseCode.CLIENT_ERROR.getResponseCode();",
"type": "int",
"var_name": "ERROR_CODE"
}
],
... | {
"body": "public void validateChangePassword(Request userRequest) {\n if (userRequest.getRequest().get(JsonKey.PASSWORD) == null\n || (StringUtils.isBlank((String) userRequest.getRequest().get(JsonKey.PASSWORD)))) {\n ProjectCommonException.throwClientErrorException(ResponseCode.passwordRequired);\n ... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_194 | {
"fields": [
{
"declarator": "userRequestValidator = new UserRequestValidator()",
"modifier": "private static final",
"original_string": "private static final UserRequestValidator userRequestValidator = new UserRequestValidator();",
"type": "UserRequestValidator",
"var_name": "userR... | {
"body": "@Test\n public void testValidatePasswordSuccess() {\n boolean response = false;\n Request request = initailizeRequest();\n Map<String, Object> requestObj = request.getRequest();\n requestObj.put(JsonKey.PASSWORD, \"Password@1\");\n request.setRequest(requestObj);\n try {\n userReque... | {
"fields": [
{
"declarator": "ERROR_CODE = ResponseCode.CLIENT_ERROR.getResponseCode()",
"modifier": "private static final",
"original_string": "private static final int ERROR_CODE = ResponseCode.CLIENT_ERROR.getResponseCode();",
"type": "int",
"var_name": "ERROR_CODE"
}
],
... | {
"body": "public void validateCreateUserRequest(Request userRequest) {\n externalIdsValidation(userRequest, JsonKey.CREATE);\n fieldsNotAllowed(\n Arrays.asList(\n JsonKey.REGISTERED_ORG_ID,\n JsonKey.ROOT_ORG_ID,\n JsonKey.PROVIDER,\n JsonKey.EXTERNAL_ID,\n ... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_252 | {
"fields": [
{
"declarator": "userRequestValidator = new UserRequestValidator()",
"modifier": "private static final",
"original_string": "private static final UserRequestValidator userRequestValidator = new UserRequestValidator();",
"type": "UserRequestValidator",
"var_name": "userR... | {
"body": "@Test\n public void testValidateFrameworkWithEmptyValue() {\n Request request = initailizeRequest();\n Map<String, Object> frameworkMap = createFrameWork();\n frameworkMap.put(\"medium\", Arrays.asList());\n request.getRequest().put(JsonKey.FRAMEWORK, frameworkMap);\n boolean response = fal... | {
"fields": [
{
"declarator": "ERROR_CODE = ResponseCode.CLIENT_ERROR.getResponseCode()",
"modifier": "private static final",
"original_string": "private static final int ERROR_CODE = ResponseCode.CLIENT_ERROR.getResponseCode();",
"type": "int",
"var_name": "ERROR_CODE"
}
],
... | {
"body": "@SuppressWarnings(\"unchecked\")\n public void validateMandatoryFrameworkFields(\n Map<String, Object> userMap,\n List<String> frameworkFields,\n List<String> frameworkMandatoryFields) {\n if (userMap.containsKey(JsonKey.FRAMEWORK)) {\n Map<String, Object> frameworkRequest = (Map<St... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_317 | {
"fields": [
{
"declarator": "iterator",
"modifier": "private static",
"original_string": "private static Iterator iterator;",
"type": "Iterator",
"var_name": "iterator"
},
{
"declarator": "row",
"modifier": "private static",
"original_string": "private sta... | {
"body": "@Test\n public void testGetRecordFailureById() throws Exception {\n\n Throwable exception = null;\n PowerMockito.whenNew(BoundStatement.class)\n .withArguments(Mockito.any(PreparedStatement.class))\n .thenThrow(\n new ProjectCommonException(\n ResponseCode.SER... | {
"fields": [
{
"declarator": "connectionManager",
"modifier": "protected",
"original_string": "protected CassandraConnectionManager connectionManager;",
"type": "CassandraConnectionManager",
"var_name": "connectionManager"
}
],
"file": "sunbird-cassandra-utils/src/main/java/... | {
"body": "@Override\n public Response getRecordById(String keyspaceName, String tableName, String key) {\n return getRecordByIdentifier(keyspaceName, tableName, key, null);\n }",
"class_method_signature": "CassandraOperationImpl.getRecordById(String keyspaceName, String tableName, String key)",
"constructor... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_59 | {
"fields": [],
"file": "sunbird-cassandra-migration/cassandra-migration/src/test/java/com/contrastsecurity/cassandra/migration/utils/TimeFormatTest.java",
"identifier": "TimeFormatTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void format() {\n assertEquals(\"00:00.001s\", TimeFormat.format(1));\n assertEquals(\"00:00.012s\", TimeFormat.format(12));\n assertEquals(\"00:00.123s\", TimeFormat.format(123));\n assertEquals(\"00:01.234s\", TimeFormat.format(1234));\n assertEquals(\"00:12.345s\", TimeFor... | {
"fields": [],
"file": "sunbird-cassandra-migration/cassandra-migration/src/main/java/com/contrastsecurity/cassandra/migration/utils/TimeFormat.java",
"identifier": "TimeFormat",
"interfaces": "",
"methods": [
{
"class_method_signature": "TimeFormat.TimeFormat()",
"constructor": true,
"... | {
"body": "public static String format(long millis) {\n return String.format(\n \"%02d:%02d.%03ds\", millis / 60000, (millis % 60000) / 1000, (millis % 1000));\n }",
"class_method_signature": "TimeFormat.format(long millis)",
"constructor": false,
"full_signature": "public static String format(long m... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_225 | {
"fields": [
{
"declarator": "userRequestValidator = new UserRequestValidator()",
"modifier": "private static final",
"original_string": "private static final UserRequestValidator userRequestValidator = new UserRequestValidator();",
"type": "UserRequestValidator",
"var_name": "userR... | {
"body": "@Test\n public void testValidateCreateUserRequestFailureWithInvalidAddress() {\n Request request = new Request();\n Map<String, Object> requestObj = new HashMap<>();\n requestObj.put(JsonKey.PHONE, \"9321234123\");\n requestObj.put(JsonKey.PHONE_VERIFIED, true);\n requestObj.put(JsonKey.EMA... | {
"fields": [
{
"declarator": "ERROR_CODE = ResponseCode.CLIENT_ERROR.getResponseCode()",
"modifier": "private static final",
"original_string": "private static final int ERROR_CODE = ResponseCode.CLIENT_ERROR.getResponseCode();",
"type": "int",
"var_name": "ERROR_CODE"
}
],
... | {
"body": "public void validateCreateUserRequest(Request userRequest) {\n externalIdsValidation(userRequest, JsonKey.CREATE);\n fieldsNotAllowed(\n Arrays.asList(\n JsonKey.REGISTERED_ORG_ID,\n JsonKey.ROOT_ORG_ID,\n JsonKey.PROVIDER,\n JsonKey.EXTERNAL_ID,\n ... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_79 | {
"fields": [
{
"declarator": "esService = EsClientFactory.getInstance(JsonKey.REST)",
"modifier": "private",
"original_string": "private ElasticSearchService esService = EsClientFactory.getInstance(JsonKey.REST);",
"type": "ElasticSearchService",
"var_name": "esService"
},
{... | {
"body": "@Test\n public void testGetDataByIdentifierFailure() {\n mockRulesForGet(true);\n Future<Map<String, Object>> result = esService.getDataByIdentifier(\"test\", \"001\");\n Object res = ElasticSearchHelper.getResponseFromFuture(result);\n assertEquals(null, res);\n }",
"class_method_signature... | {
"fields": [
{
"declarator": "ERROR = \"ERROR\"",
"modifier": "private static final",
"original_string": "private static final String ERROR = \"ERROR\";",
"type": "String",
"var_name": "ERROR"
}
],
"file": "sunbird-es-utils/src/main/java/org/sunbird/common/ElasticSearchRestH... | {
"body": "@Override\n public Future<Map<String, Object>> getDataByIdentifier(String index, String identifier) {\n long startTime = System.currentTimeMillis();\n Promise<Map<String, Object>> promise = Futures.promise();\n if (StringUtils.isNotEmpty(identifier) && StringUtils.isNotEmpty(index)) {\n\n Pr... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_272 | {
"fields": [
{
"declarator": "propertiesCache = ProjectUtil.propertiesCache",
"modifier": "private",
"original_string": "private PropertiesCache propertiesCache = ProjectUtil.propertiesCache;",
"type": "PropertiesCache",
"var_name": "propertiesCache"
},
{
"declarator":... | {
"body": "@Test\n public void testUserRoleSuccess() {\n assertEquals(\"PUBLIC\", ProjectUtil.UserRole.PUBLIC.getValue());\n assertEquals(\"CONTENT_CREATOR\", ProjectUtil.UserRole.CONTENT_CREATOR.getValue());\n assertEquals(\"CONTENT_REVIEWER\", ProjectUtil.UserRole.CONTENT_REVIEWER.getValue());\n assert... | {
"fields": [
{
"declarator": "atomicInteger = new AtomicInteger()",
"modifier": "private static",
"original_string": "private static AtomicInteger atomicInteger = new AtomicInteger();",
"type": "AtomicInteger",
"var_name": "atomicInteger"
},
{
"declarator": "DEFAULT_BA... | {
"body": "private static Object getValue(Map<String, Object> map, String key) {\n Object value = map.get(key);\n map.remove(key);\n return value;\n }",
"class_method_signature": "ProjectUtil.getValue(Map<String, Object> map, String key)",
"constructor": false,
"full_signature": "private static Object... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_96 | {
"fields": [
{
"declarator": "chemistryMap = null",
"modifier": "private static",
"original_string": "private static Map<String, Object> chemistryMap = null;",
"type": "Map<String, Object>",
"var_name": "chemistryMap"
},
{
"declarator": "physicsMap = null",
"modi... | {
"body": "@Test\n @Ignore\n public void testComplexSearchSuccessWithRangeLessThan() {\n SearchDTO searchDTO = new SearchDTO();\n Map<String, Object> additionalProperties = new HashMap<String, Object>();\n List<Integer> sizes = new ArrayList<Integer>();\n sizes.add(10);\n sizes.add(20);\n Map<Stri... | {
"fields": [
{
"declarator": "WAIT_TIME = 30",
"modifier": "public static final",
"original_string": "public static final int WAIT_TIME = 30;",
"type": "int",
"var_name": "WAIT_TIME"
},
{
"declarator": "timeout = new Timeout(WAIT_TIME, TimeUnit.SECONDS)",
"modifi... | {
"body": "@Override\n public Future<Map<String, Object>> search(SearchDTO searchDTO, String index) {\n\n long startTime = System.currentTimeMillis();\n Promise<Map<String, Object>> promise = Futures.promise();\n String[] indices = {index};\n\n ProjectLogger.log(\n \"ElasticSearchTcpImpl:search: m... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_321 | {
"fields": [
{
"declarator": "iterator",
"modifier": "private static",
"original_string": "private static Iterator iterator;",
"type": "Iterator",
"var_name": "iterator"
},
{
"declarator": "row",
"modifier": "private static",
"original_string": "private sta... | {
"body": "@Test\n public void testGetRecordForListFailreByProperties() throws Exception {\n\n List<Object> list = new ArrayList<>();\n list.add(\"123\");\n list.add(\"321\");\n\n List<Row> rows = new ArrayList<>();\n Row row = Mockito.mock(Row.class);\n rows.add(row);\n when(resultSet.all()).th... | {
"fields": [
{
"declarator": "connectionManager",
"modifier": "protected",
"original_string": "protected CassandraConnectionManager connectionManager;",
"type": "CassandraConnectionManager",
"var_name": "connectionManager"
}
],
"file": "sunbird-cassandra-utils/src/main/java/... | {
"body": "@Override\n public Response getRecordsByProperty(\n String keyspaceName, String tableName, String propertyName, Object propertyValue) {\n return getRecordsByProperty(keyspaceName, tableName, propertyName, propertyValue, null);\n }",
"class_method_signature": "CassandraOperationImpl.getRecordsBy... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_80 | {
"fields": [
{
"declarator": "esService = EsClientFactory.getInstance(JsonKey.REST)",
"modifier": "private",
"original_string": "private ElasticSearchService esService = EsClientFactory.getInstance(JsonKey.REST);",
"type": "ElasticSearchService",
"var_name": "esService"
},
{... | {
"body": "@Test\n public void testDeleteSuccess() {\n mockRulesForDelete(false, false);\n Future<Boolean> result = esService.delete(\"test\", \"001\");\n boolean res = (boolean) ElasticSearchHelper.getResponseFromFuture(result);\n assertEquals(true, res);\n }",
"class_method_signature": "ElasticSearc... | {
"fields": [
{
"declarator": "ERROR = \"ERROR\"",
"modifier": "private static final",
"original_string": "private static final String ERROR = \"ERROR\";",
"type": "String",
"var_name": "ERROR"
}
],
"file": "sunbird-es-utils/src/main/java/org/sunbird/common/ElasticSearchRestH... | {
"body": "@Override\n public Future<Boolean> delete(String index, String identifier) {\n long startTime = System.currentTimeMillis();\n ProjectLogger.log(\n \"ElasticSearchRestHighImpl:delete: method started at ==\" + startTime,\n LoggerEnum.PERF_LOG.name());\n Promise<Boolean> promise = Futu... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_264 | {
"fields": [
{
"declarator": "propertiesCache = ProjectUtil.propertiesCache",
"modifier": "private",
"original_string": "private PropertiesCache propertiesCache = ProjectUtil.propertiesCache;",
"type": "PropertiesCache",
"var_name": "propertiesCache"
},
{
"declarator":... | {
"body": "@Test\n public void testFormatMessageFailureWithInvalidVariable() {\n String msg = ProjectUtil.formatMessage(\"Hello \", \"user\");\n assertNotEquals(\"Hello user\", msg);\n }",
"class_method_signature": "ProjectUtilTest.testFormatMessageFailureWithInvalidVariable()",
"constructor": false,
"f... | {
"fields": [
{
"declarator": "atomicInteger = new AtomicInteger()",
"modifier": "private static",
"original_string": "private static AtomicInteger atomicInteger = new AtomicInteger();",
"type": "AtomicInteger",
"var_name": "atomicInteger"
},
{
"declarator": "DEFAULT_BA... | {
"body": "public static String formatMessage(String exceptionMsg, Object... fieldValue) {\n return MessageFormat.format(exceptionMsg, fieldValue);\n }",
"class_method_signature": "ProjectUtil.formatMessage(String exceptionMsg, Object... fieldValue)",
"constructor": false,
"full_signature": "public static S... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_38 | {
"fields": [],
"file": "sunbird-cassandra-migration/cassandra-migration/src/test/java/com/contrastsecurity/cassandra/migration/info/MigrationVersionTest.java",
"identifier": "MigrationVersionTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test(expected = CassandraMigrationException.class)\n public void dash() {\n MigrationVersion.fromVersion(\"1.2.1-3\");\n }",
"class_method_signature": "MigrationVersionTest.dash()",
"constructor": false,
"full_signature": "@Test(expected = CassandraMigrationException.class) public void dash()",... | {
"fields": [
{
"declarator": "EMPTY = new MigrationVersion(null, \"<< Empty Schema >>\")",
"modifier": "public static final",
"original_string": "public static final MigrationVersion EMPTY = new MigrationVersion(null, \"<< Empty Schema >>\");",
"type": "MigrationVersion",
"var_name"... | {
"body": "public static MigrationVersion fromVersion(String version) {\n if (\"current\".equalsIgnoreCase(version)) return CURRENT;\n if (LATEST.getVersion().equals(version)) return LATEST;\n if (version == null) return EMPTY;\n return new MigrationVersion(version);\n }",
"class_method_signature": "Mi... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_233 | {
"fields": [
{
"declarator": "userRequestValidator = new UserRequestValidator()",
"modifier": "private static final",
"original_string": "private static final UserRequestValidator userRequestValidator = new UserRequestValidator();",
"type": "UserRequestValidator",
"var_name": "userR... | {
"body": "@Test\n public void testValidateCreateUserFailureWithPhoneVerifiedFalse() {\n Request request = initailizeRequest();\n request.getRequest().put(JsonKey.PHONE, \"7894561230\");\n request.getRequest().put(JsonKey.PHONE_VERIFIED, false);\n try {\n userRequestValidator.validateCreateUserReque... | {
"fields": [
{
"declarator": "ERROR_CODE = ResponseCode.CLIENT_ERROR.getResponseCode()",
"modifier": "private static final",
"original_string": "private static final int ERROR_CODE = ResponseCode.CLIENT_ERROR.getResponseCode();",
"type": "int",
"var_name": "ERROR_CODE"
}
],
... | {
"body": "public void validateCreateUserRequest(Request userRequest) {\n externalIdsValidation(userRequest, JsonKey.CREATE);\n fieldsNotAllowed(\n Arrays.asList(\n JsonKey.REGISTERED_ORG_ID,\n JsonKey.ROOT_ORG_ID,\n JsonKey.PROVIDER,\n JsonKey.EXTERNAL_ID,\n ... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_248 | {
"fields": [
{
"declarator": "userRequestValidator = new UserRequestValidator()",
"modifier": "private static final",
"original_string": "private static final UserRequestValidator userRequestValidator = new UserRequestValidator();",
"type": "UserRequestValidator",
"var_name": "userR... | {
"body": "@Test\n public void testValidateVerifyUserFailureWithEmptyId() {\n Request request = new Request();\n Map<String, Object> requestObj = new HashMap<>();\n requestObj.put(JsonKey.LOGIN_ID, \"\");\n request.setRequest(requestObj);\n boolean response = false;\n try {\n userRequestValida... | {
"fields": [
{
"declarator": "ERROR_CODE = ResponseCode.CLIENT_ERROR.getResponseCode()",
"modifier": "private static final",
"original_string": "private static final int ERROR_CODE = ResponseCode.CLIENT_ERROR.getResponseCode();",
"type": "int",
"var_name": "ERROR_CODE"
}
],
... | {
"body": "public void validateVerifyUser(Request userRequest) {\n if (StringUtils.isBlank((String) userRequest.getRequest().get(JsonKey.LOGIN_ID))) {\n ProjectCommonException.throwClientErrorException(ResponseCode.loginIdRequired);\n }\n }",
"class_method_signature": "UserRequestValidator.validateVerif... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_43 | {
"fields": [],
"file": "sunbird-cassandra-migration/cassandra-migration/src/test/java/com/contrastsecurity/cassandra/migration/config/KeyspaceTest.java",
"identifier": "KeyspaceTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void shouldDefaultToNoKeyspaceButCanBeOverridden() {\n assertThat(new Keyspace().getName(), is(nullValue()));\n System.setProperty(Keyspace.KeyspaceProperty.NAME.getName(), \"myspace\");\n assertThat(new Keyspace().getName(), is(\"myspace\"));\n }",
"class_method_signature": "Ke... | {
"fields": [
{
"declarator": "PROPERTY_PREFIX = \"cassandra.migration.keyspace.\"",
"modifier": "private static final",
"original_string": "private static final String PROPERTY_PREFIX = \"cassandra.migration.keyspace.\";",
"type": "String",
"var_name": "PROPERTY_PREFIX"
},
{... | {
"body": "public String getName() {\n return name;\n }",
"class_method_signature": "Keyspace.getName()",
"constructor": false,
"full_signature": "public String getName()",
"identifier": "getName",
"invocations": [],
"modifiers": "public",
"parameters": "()",
"return": "String",
"signature": "St... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_161 | {
"fields": [],
"file": "sunbird-platform-core/common-util/src/test/java/org/sunbird/common/request/RequestValidatorTest.java",
"identifier": "RequestValidatorTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testValidateUpdateClientKeySuccess() {\n try {\n RequestValidator.validateUpdateClientKey(\"1234\", \"test123\");\n } catch (ProjectCommonException e) {\n assertEquals(ResponseCode.CLIENT_ERROR.getResponseCode(), e.getResponseCode());\n assertEquals(ResponseCode.in... | {
"fields": [
{
"declarator": "ERROR_CODE = ResponseCode.CLIENT_ERROR.getResponseCode()",
"modifier": "private static final",
"original_string": "private static final int ERROR_CODE = ResponseCode.CLIENT_ERROR.getResponseCode();",
"type": "int",
"var_name": "ERROR_CODE"
}
],
... | {
"body": "public static void validateUpdateClientKey(String clientId, String masterAccessToken) {\n validateClientId(clientId);\n if (StringUtils.isBlank(masterAccessToken)) {\n throw createExceptionInstance(ResponseCode.invalidRequestData.getErrorCode());\n }\n }",
"class_method_signature": "Reques... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_14 | {
"fields": [],
"file": "sunbird-cassandra-migration/cassandra-migration/src/test/java/com/contrastsecurity/cassandra/migration/resolver/CompositeMigrationResolverTest.java",
"identifier": "CompositeMigrationResolverTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void checkForIncompatibilitiesNoConflict() {\n List<ResolvedMigration> migrations = new ArrayList<ResolvedMigration>();\n migrations.add(\n createTestMigration(MigrationType.JAVA_DRIVER, \"1\", \"Description\", \"Migration1\", 123));\n migrations.add(createTestMigration(Migr... | {
"fields": [
{
"declarator": "migrationResolvers = new ArrayList<MigrationResolver>()",
"modifier": "private",
"original_string": "private Collection<MigrationResolver> migrationResolvers = new ArrayList<MigrationResolver>();",
"type": "Collection<MigrationResolver>",
"var_name": "m... | {
"body": "static void checkForIncompatibilities(List<ResolvedMigration> migrations) {\n // check for more than one migration with same version\n for (int i = 0; i < migrations.size() - 1; i++) {\n ResolvedMigration current = migrations.get(i);\n ResolvedMigration next = migrations.get(i + 1);\n ... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_136 | {
"fields": [
{
"declarator": "keyCloakService = SSOServiceFactory.getInstance()",
"modifier": "private",
"original_string": "private SSOManager keyCloakService = SSOServiceFactory.getInstance();",
"type": "SSOManager",
"var_name": "keyCloakService"
},
{
"declarator": "... | {
"body": "@Test\n public void testSyncUserDataSuccessWithoutProvider() {\n Map<String, Object> request = new HashMap<String, Object>();\n request.put(JsonKey.USERNAME, userName);\n request.put(JsonKey.PASSWORD, \"password\");\n request.put(JsonKey.FIRST_NAME, \"A\");\n request.put(JsonKey.LAST_NAME, ... | {
"fields": [
{
"declarator": "keycloak = KeyCloakConnectionProvider.getConnection()",
"modifier": "private",
"original_string": "private Keycloak keycloak = KeyCloakConnectionProvider.getConnection();",
"type": "Keycloak",
"var_name": "keycloak"
},
{
"declarator": "URL... | {
"body": "@Override\n public String syncUserData(Map<String, Object> request) {\n String userId = (String) request.get(JsonKey.USER_ID);\n String fedUserId = getFederatedUserId(userId);\n UserRepresentation ur = null;\n UserResource resource = null;\n boolean needTobeUpdate = false;\n try {\n ... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_209 | {
"fields": [
{
"declarator": "userRequestValidator = new UserRequestValidator()",
"modifier": "private static final",
"original_string": "private static final UserRequestValidator userRequestValidator = new UserRequestValidator();",
"type": "UserRequestValidator",
"var_name": "userR... | {
"body": "@Test\n public void testValidateCreateUserFailureWithWrongAddType() {\n Request request = initailizeRequest();\n Map<String, Object> requestObj = request.getRequest();\n List<String> roles = new ArrayList<String>();\n roles.add(\"PUBLIC\");\n roles.add(\"CONTENT-CREATOR\");\n requestObj.... | {
"fields": [
{
"declarator": "ERROR_CODE = ResponseCode.CLIENT_ERROR.getResponseCode()",
"modifier": "private static final",
"original_string": "private static final int ERROR_CODE = ResponseCode.CLIENT_ERROR.getResponseCode();",
"type": "int",
"var_name": "ERROR_CODE"
}
],
... | {
"body": "public void validateCreateUserRequest(Request userRequest) {\n externalIdsValidation(userRequest, JsonKey.CREATE);\n fieldsNotAllowed(\n Arrays.asList(\n JsonKey.REGISTERED_ORG_ID,\n JsonKey.ROOT_ORG_ID,\n JsonKey.PROVIDER,\n JsonKey.EXTERNAL_ID,\n ... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_55 | {
"fields": [],
"file": "sunbird-cassandra-migration/cassandra-migration/src/test/java/com/contrastsecurity/cassandra/migration/utils/ClassUtilsTest.java",
"identifier": "ClassUtilsTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void isPresent() {\n assertTrue(\n ClassUtils.isPresent(\n \"com.contrastsecurity.cassandra.migration.CassandraMigration\",\n Thread.currentThread().getContextClassLoader()));\n }",
"class_method_signature": "ClassUtilsTest.isPresent()",
"constructor": f... | {
"fields": [],
"file": "sunbird-cassandra-migration/cassandra-migration/src/main/java/com/contrastsecurity/cassandra/migration/utils/ClassUtils.java",
"identifier": "ClassUtils",
"interfaces": "",
"methods": [
{
"class_method_signature": "ClassUtils.ClassUtils()",
"constructor": true,
"... | {
"body": "public static boolean isPresent(String className, ClassLoader classLoader) {\n try {\n classLoader.loadClass(className);\n return true;\n } catch (Throwable ex) {\n // Class or one of its dependencies is not present...\n return false;\n }\n }",
"class_method_signature": "Cla... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_198 | {
"fields": [
{
"declarator": "userRequestValidator = new UserRequestValidator()",
"modifier": "private static final",
"original_string": "private static final UserRequestValidator userRequestValidator = new UserRequestValidator();",
"type": "UserRequestValidator",
"var_name": "userR... | {
"body": "@Test\n public void testValidateLocationCodesSuccess() {\n boolean response = false;\n Request request = initailizeRequest();\n Map<String, Object> requestObj = request.getRequest();\n List<String> location = new ArrayList<>();\n location.add(\"KA\");\n location.add(\"AP\");\n request... | {
"fields": [
{
"declarator": "ERROR_CODE = ResponseCode.CLIENT_ERROR.getResponseCode()",
"modifier": "private static final",
"original_string": "private static final int ERROR_CODE = ResponseCode.CLIENT_ERROR.getResponseCode();",
"type": "int",
"var_name": "ERROR_CODE"
}
],
... | {
"body": "public void validateCreateUserRequest(Request userRequest) {\n externalIdsValidation(userRequest, JsonKey.CREATE);\n fieldsNotAllowed(\n Arrays.asList(\n JsonKey.REGISTERED_ORG_ID,\n JsonKey.ROOT_ORG_ID,\n JsonKey.PROVIDER,\n JsonKey.EXTERNAL_ID,\n ... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_177 | {
"fields": [],
"file": "sunbird-platform-core/common-util/src/test/java/org/sunbird/common/request/RequestValidatorTest.java",
"identifier": "RequestValidatorTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testValidateUserOrgTypeFailureWithEmptyId() {\n Request request = new Request();\n Map<String, Object> requestObj = new HashMap<>();\n requestObj.put(JsonKey.NAME, \"orgTypeName\");\n requestObj.put(JsonKey.ID, \"\");\n request.setRequest(requestObj);\n boolean respon... | {
"fields": [
{
"declarator": "ERROR_CODE = ResponseCode.CLIENT_ERROR.getResponseCode()",
"modifier": "private static final",
"original_string": "private static final int ERROR_CODE = ResponseCode.CLIENT_ERROR.getResponseCode();",
"type": "int",
"var_name": "ERROR_CODE"
}
],
... | {
"body": "public static void validateUpdateOrgType(Request reqObj) {\n if (StringUtils.isBlank((String) reqObj.getRequest().get(JsonKey.NAME))) {\n throw createExceptionInstance(ResponseCode.orgTypeMandatory.getErrorCode());\n }\n if (StringUtils.isBlank((String) reqObj.getRequest().get(JsonKey.ID))) {... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_255 | {
"fields": [
{
"declarator": "propertiesCache = ProjectUtil.propertiesCache",
"modifier": "private",
"original_string": "private PropertiesCache propertiesCache = ProjectUtil.propertiesCache;",
"type": "PropertiesCache",
"var_name": "propertiesCache"
},
{
"declarator":... | {
"body": "@Test\n public void testGetContextSuccessWithFromMail() {\n\n Map<String, Object> templateMap = new HashMap<>();\n templateMap.put(JsonKey.ACTION_URL, \"googli.com\");\n templateMap.put(JsonKey.NAME, \"userName\");\n\n boolean envVal = !StringUtils.isBlank(System.getenv(JsonKey.EMAIL_SERVER_FR... | {
"fields": [
{
"declarator": "atomicInteger = new AtomicInteger()",
"modifier": "private static",
"original_string": "private static AtomicInteger atomicInteger = new AtomicInteger();",
"type": "AtomicInteger",
"var_name": "atomicInteger"
},
{
"declarator": "DEFAULT_BA... | {
"body": "public static VelocityContext getContext(Map<String, Object> map) {\n propertiesCache = PropertiesCache.getInstance();\n VelocityContext context = new VelocityContext();\n if (StringUtils.isNotBlank((String) map.get(JsonKey.ACTION_URL))) {\n context.put(JsonKey.ACTION_URL, getValue(map, JsonK... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_310 | {
"fields": [
{
"declarator": "iterator",
"modifier": "private static",
"original_string": "private static Iterator iterator;",
"type": "Iterator",
"var_name": "iterator"
},
{
"declarator": "row",
"modifier": "private static",
"original_string": "private sta... | {
"body": "@Test\n public void testUpdateRecordFailure() throws Exception {\n\n dummyAddress.put(JsonKey.CITY, \"city\");\n dummyAddress.put(JsonKey.ADD_TYPE, \"addrType\");\n\n when(session.prepare(Mockito.anyString()))\n .thenThrow(\n new ProjectCommonException(\n Response... | {
"fields": [
{
"declarator": "connectionManager",
"modifier": "protected",
"original_string": "protected CassandraConnectionManager connectionManager;",
"type": "CassandraConnectionManager",
"var_name": "connectionManager"
}
],
"file": "sunbird-cassandra-utils/src/main/java/... | {
"body": "@Override\n public Response updateRecord(String keyspaceName, String tableName, Map<String, Object> request) {\n long startTime = System.currentTimeMillis();\n ProjectLogger.log(\n \"Cassandra Service updateRecord method started at ==\" + startTime, LoggerEnum.INFO);\n Response response = ... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_193 | {
"fields": [
{
"declarator": "userRequestValidator = new UserRequestValidator()",
"modifier": "private static final",
"original_string": "private static final UserRequestValidator userRequestValidator = new UserRequestValidator();",
"type": "UserRequestValidator",
"var_name": "userR... | {
"body": "@Test\n public void testValidateValidateCreateUserV3RequestSuccess() {\n boolean response = false;\n Request request = initailizeRequest();\n Map<String, Object> requestObj = request.getRequest();\n requestObj.put(JsonKey.PASSWORD, \"Password@1\");\n request.setRequest(requestObj);\n try... | {
"fields": [
{
"declarator": "ERROR_CODE = ResponseCode.CLIENT_ERROR.getResponseCode()",
"modifier": "private static final",
"original_string": "private static final int ERROR_CODE = ResponseCode.CLIENT_ERROR.getResponseCode();",
"type": "int",
"var_name": "ERROR_CODE"
}
],
... | {
"body": "public void validateCreateUserV3Request(Request userRequest) {\n validateCreateUserRequest(userRequest);\n }",
"class_method_signature": "UserRequestValidator.validateCreateUserV3Request(Request userRequest)",
"constructor": false,
"full_signature": "public void validateCreateUserV3Request(Reques... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_202 | {
"fields": [
{
"declarator": "userRequestValidator = new UserRequestValidator()",
"modifier": "private static final",
"original_string": "private static final UserRequestValidator userRequestValidator = new UserRequestValidator();",
"type": "UserRequestValidator",
"var_name": "userR... | {
"body": "@Test\n public void testValidateForgotPasswordFailureWithoutName() {\n try {\n Request request = new Request();\n Map<String, Object> requestObj = new HashMap<>();\n request.setRequest(requestObj);\n userRequestValidator.validateForgotPassword(request);\n } catch (ProjectCommonEx... | {
"fields": [
{
"declarator": "ERROR_CODE = ResponseCode.CLIENT_ERROR.getResponseCode()",
"modifier": "private static final",
"original_string": "private static final int ERROR_CODE = ResponseCode.CLIENT_ERROR.getResponseCode();",
"type": "int",
"var_name": "ERROR_CODE"
}
],
... | {
"body": "public void validateForgotPassword(Request request) {\n if (request.getRequest().get(JsonKey.USERNAME) == null\n || StringUtils.isBlank((String) request.getRequest().get(JsonKey.USERNAME))) {\n throw new ProjectCommonException(\n ResponseCode.userNameRequired.getErrorCode(),\n ... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_214 | {
"fields": [
{
"declarator": "userRequestValidator = new UserRequestValidator()",
"modifier": "private static final",
"original_string": "private static final UserRequestValidator userRequestValidator = new UserRequestValidator();",
"type": "UserRequestValidator",
"var_name": "userR... | {
"body": "@Test\n public void testPhoneValidationFailureWithEmptyPhoneVerified() {\n Request request = new Request();\n Map<String, Object> requestObj = new HashMap<>();\n requestObj.put(JsonKey.PHONE, \"9321234123\");\n requestObj.put(JsonKey.COUNTRY_CODE, \"+91\");\n requestObj.put(JsonKey.PROVIDER... | {
"fields": [
{
"declarator": "ERROR_CODE = ResponseCode.CLIENT_ERROR.getResponseCode()",
"modifier": "private static final",
"original_string": "private static final int ERROR_CODE = ResponseCode.CLIENT_ERROR.getResponseCode();",
"type": "int",
"var_name": "ERROR_CODE"
}
],
... | {
"body": "public void phoneValidation(Request userRequest) {\n if (!StringUtils.isBlank((String) userRequest.getRequest().get(JsonKey.COUNTRY_CODE))) {\n boolean bool =\n ProjectUtil.validateCountryCode(\n (String) userRequest.getRequest().get(JsonKey.COUNTRY_CODE));\n if (!bool) {... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_243 | {
"fields": [
{
"declarator": "userRequestValidator = new UserRequestValidator()",
"modifier": "private static final",
"original_string": "private static final UserRequestValidator userRequestValidator = new UserRequestValidator();",
"type": "UserRequestValidator",
"var_name": "userR... | {
"body": "@Test\n public void testValidateCreateUserFailureWithEmptyJobProfileCity() {\n Request request = initailizeRequest();\n Map<String, Object> map = new HashMap<>();\n map.put(JsonKey.JOB_NAME, \"jabName\");\n map.put(JsonKey.ORG_NAME, \"orgName\");\n Map<String, Object> address = new HashMap<... | {
"fields": [
{
"declarator": "ERROR_CODE = ResponseCode.CLIENT_ERROR.getResponseCode()",
"modifier": "private static final",
"original_string": "private static final int ERROR_CODE = ResponseCode.CLIENT_ERROR.getResponseCode();",
"type": "int",
"var_name": "ERROR_CODE"
}
],
... | {
"body": "public void validateCreateUserRequest(Request userRequest) {\n externalIdsValidation(userRequest, JsonKey.CREATE);\n fieldsNotAllowed(\n Arrays.asList(\n JsonKey.REGISTERED_ORG_ID,\n JsonKey.ROOT_ORG_ID,\n JsonKey.PROVIDER,\n JsonKey.EXTERNAL_ID,\n ... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_48 | {
"fields": [],
"file": "sunbird-cassandra-migration/cassandra-migration/src/test/java/com/contrastsecurity/cassandra/migration/config/ScriptsLocationsTest.java",
"identifier": "ScriptsLocationsTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void mergeLocationsSimilarButNoOverlap() {\n ScriptsLocations locations =\n new ScriptsLocations(\"db/migration/oracle\", \"db/migration\", \"db/migrationtest\");\n List<ScriptsLocation> locationList = locations.getLocations();\n assertEquals(2, locationList.size());\n as... | {
"fields": [
{
"declarator": "LOG = LogFactory.getLog(ScriptsLocations.class)",
"modifier": "private static final",
"original_string": "private static final Log LOG = LogFactory.getLog(ScriptsLocations.class);",
"type": "Log",
"var_name": "LOG"
},
{
"declarator": "loca... | {
"body": "public List<ScriptsLocation> getLocations() {\n return locations;\n }",
"class_method_signature": "ScriptsLocations.getLocations()",
"constructor": false,
"full_signature": "public List<ScriptsLocation> getLocations()",
"identifier": "getLocations",
"invocations": [],
"modifiers": "public",... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_306 | {
"fields": [
{
"declarator": "logMaskService = new LogMaskServiceImpl()",
"modifier": "private",
"original_string": "private LogMaskServiceImpl logMaskService = new LogMaskServiceImpl();",
"type": "LogMaskServiceImpl",
"var_name": "logMaskService"
}
],
"file": "sunbird-platf... | {
"body": "@Test\n public void maskPhone() {\n HashMap<String, String> phoneMaskExpectations = new HashMap<String, String>(){\n {\n put(\"0123456789\", \"012345678*\");\n put(\"123-456-789\", \"123-456-7**\");\n put(\"123\", \"123\");\n }\n ... | {
"fields": [],
"file": "sunbird-platform-core/common-util/src/main/java/org/sunbird/common/models/util/datasecurity/impl/LogMaskServiceImpl.java",
"identifier": "LogMaskServiceImpl",
"interfaces": "implements DataMaskingService",
"methods": [
{
"class_method_signature": "LogMaskServiceImpl.maskEmai... | {
"body": "public String maskPhone(String phone) {\n return phone.replaceAll(\"(^[^*]{9}|(?!^)\\\\G)[^*]\", \"$1*\");\n }",
"class_method_signature": "LogMaskServiceImpl.maskPhone(String phone)",
"constructor": false,
"full_signature": "public String maskPhone(String phone)",
"identifier": "maskPhon... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_1 | {
"fields": [
{
"declarator": "authenticator = null",
"modifier": "private static",
"original_string": "private static GMailAuthenticator authenticator = null;",
"type": "GMailAuthenticator",
"var_name": "authenticator"
},
{
"declarator": "emailService = null",
"m... | {
"body": "@Test\n public void sendEmailTest() throws MessagingException {\n List<String> to = new ArrayList<String>();\n to.add(\"testmail@test.com\"); to.add(\"test1@test.com\");\n emailService.sendEmail(\"testmail@test.com\", subject, \"Hi how are you\", to);\n List<Message> inbox = Mailbox.get(\"test... | {
"fields": [
{
"declarator": "logger = LogManager.getLogger(Email.class)",
"modifier": "private static",
"original_string": "private static Logger logger = LogManager.getLogger(Email.class);",
"type": "Logger",
"var_name": "logger"
},
{
"declarator": "props = null",
... | {
"body": "public boolean sendEmail(String fromEmail, String subject, String body, List<String> bccList) {\n boolean sentStatus = true;\n try {\n Session session = getSession();\n MimeMessage message = new MimeMessage(session);\n addRecipient(message, Message.RecipientType.BCC, bccList);\n s... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_33 | {
"fields": [],
"file": "sunbird-cassandra-migration/cassandra-migration/src/test/java/com/contrastsecurity/cassandra/migration/info/MigrationVersionTest.java",
"identifier": "MigrationVersionTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test(expected = CassandraMigrationException.class)\n public void missingNumber() {\n MigrationVersion.fromVersion(\"1..1\");\n }",
"class_method_signature": "MigrationVersionTest.missingNumber()",
"constructor": false,
"full_signature": "@Test(expected = CassandraMigrationException.class) publi... | {
"fields": [
{
"declarator": "EMPTY = new MigrationVersion(null, \"<< Empty Schema >>\")",
"modifier": "public static final",
"original_string": "public static final MigrationVersion EMPTY = new MigrationVersion(null, \"<< Empty Schema >>\");",
"type": "MigrationVersion",
"var_name"... | {
"body": "public static MigrationVersion fromVersion(String version) {\n if (\"current\".equalsIgnoreCase(version)) return CURRENT;\n if (LATEST.getVersion().equals(version)) return LATEST;\n if (version == null) return EMPTY;\n return new MigrationVersion(version);\n }",
"class_method_signature": "Mi... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
96123627_238 | {
"fields": [
{
"declarator": "userRequestValidator = new UserRequestValidator()",
"modifier": "private static final",
"original_string": "private static final UserRequestValidator userRequestValidator = new UserRequestValidator();",
"type": "UserRequestValidator",
"var_name": "userR... | {
"body": "@Test\n public void testValidateCreateUserFailureWithEmptyJobProfile() {\n Request request = initailizeRequest();\n request.getRequest().put(JsonKey.PHONE_VERIFIED, true);\n request.getRequest().put(JsonKey.JOB_PROFILE, \"\");\n try {\n userRequestValidator.validateCreateUserRequest(reque... | {
"fields": [
{
"declarator": "ERROR_CODE = ResponseCode.CLIENT_ERROR.getResponseCode()",
"modifier": "private static final",
"original_string": "private static final int ERROR_CODE = ResponseCode.CLIENT_ERROR.getResponseCode();",
"type": "int",
"var_name": "ERROR_CODE"
}
],
... | {
"body": "public void validateCreateUserRequest(Request userRequest) {\n externalIdsValidation(userRequest, JsonKey.CREATE);\n fieldsNotAllowed(\n Arrays.asList(\n JsonKey.REGISTERED_ORG_ID,\n JsonKey.ROOT_ORG_ID,\n JsonKey.PROVIDER,\n JsonKey.EXTERNAL_ID,\n ... | {
"created": null,
"fork": null,
"fork_count": 42,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 96123627,
"size": 62845,
"stargazer_count": 5,
"stars": null,
"updates": null,
"url": "https://github.com/project-sunbird/sunbird-utils"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.