id stringlengths 7 14 | test_class dict | test_case dict | focal_class dict | focal_method dict | repository dict |
|---|---|---|---|---|---|
96123627_47 | {
"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 mergeLocationsOverlap() {\n ScriptsLocations locations =\n new ScriptsLocations(\"db/migration/oracle\", \"db/migration\", \"db/migration\");\n List<ScriptsLocation> locationList = locations.getLocations();\n assertEquals(1, locationList.size());\n assertEquals(\"db/... | {
"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_237 | {
"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 testValidateCreateUserFailureWithEmptyEducationCity() {\n Request request = initailizeRequest();\n request.getRequest().put(JsonKey.PHONE_VERIFIED, true);\n\n Map<String, Object> map = new HashMap<>();\n map.put(JsonKey.NAME, \"name\");\n map.put(JsonKey.DEGREE, \"degree... | {
"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_260 | {
"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 testGenerateRandomPasswordSuccess() {\n assertNotNull(ProjectUtil.generateRandomPassword());\n }",
"class_method_signature": "ProjectUtilTest.testGenerateRandomPasswordSuccess()",
"constructor": false,
"full_signature": "@Test public void testGenerateRandomPasswordSuccess()",... | {
"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 generateRandomPassword() {\n String SALTCHARS = \"abcdef12345ghijklACDEFGHmnopqrs67IJKLMNOP890tuvQRSTUwxyzVWXYZ\";\n StringBuilder salt = new StringBuilder();\n Random rnd = new Random();\n while (salt.length() < randomPasswordLength) { // length of the random string.\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_84 | {
"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 testDeleteFailureWithEmptyIndex() {\n try {\n esService.delete(\"\", \"001\");\n } catch (ProjectCommonException e) {\n assertEquals(e.getResponseCode(), ResponseCode.invalidData.getResponseCode());\n }\n }",
"class_method_signature": "ElasticSearchRestHighImplTes... | {
"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_325 | {
"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 testGetRecordsFailureById() 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 ProjectCommonExcep... | {
"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_92 | {
"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 testGetByIdentifierSuccess() {\n Future<Map<String, Object>> responseMapF =\n esService.getDataByIdentifier(INDEX_NAME, (String) chemistryMap.get(\"courseId\"));\n\n Map<String, Object> responseMap =\n (Map<String, Object>) 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<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_276 | {
"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 testProgressStatusSuccess() {\n assertEquals(0, ProjectUtil.ProgressStatus.NOT_STARTED.getValue());\n assertEquals(1, ProjectUtil.ProgressStatus.STARTED.getValue());\n assertEquals(2, ProjectUtil.ProgressStatus.COMPLETED.getValue());\n }",
"class_method_signature": "Project... | {
"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_299 | {
"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 testSendGetRequestSuccess() {\n Map<String, String> headers = new HashMap<>();\n headers.put(\"Authorization\", \"123456\");\n String urlString = \"http://localhost:8000/v1/issuer/issuers\";\n try {\n String response = HttpUtil.sendGetRequest(urlString, headers);\n ... | {
"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 String sendGetRequest(String requestURL, Map<String, String> headers)\n throws IOException {\n long startTime = System.currentTimeMillis();\n Map<String, Object> logInfo = genarateLogInfo(JsonKey.API_CALL, \"API CALL : \" + requestURL);\n HttpURLConnection httpURLConnection = ge... | {
"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_108 | {
"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 testRemoveDataSuccessByIdentifier() {\n Future<Boolean> response = esService.delete(INDEX_NAME, (String) chemistryMap.get(\"courseId\"));\n boolean result = (boolean) ElasticSearchHelper.getResponseFromFuture(response);\n assertEquals(true, result);\n }",
"class_method_sign... | {
"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> delete(String index, String identifier) {\n long startTime = System.currentTimeMillis();\n Promise<Boolean> promise = Futures.promise();\n ProjectLogger.log(\n \"ElasticSearchTcpImpl:delete: method started at ==\" + startTime,\n LoggerEnum.PERF_LOG... | {
"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_221 | {
"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 testValidateWebPagesFailureWithNullWebPages() {\n Request request = new Request();\n Map<String, Object> requestObj = new HashMap<>();\n requestObj.put(JsonKey.WEB_PAGES, null);\n request.setRequest(requestObj);\n try {\n userRequestValidator.validateWebPages(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 void validateWebPages(Request request) {\n if (request.getRequest().containsKey(JsonKey.WEB_PAGES)) {\n List<Map<String, String>> data =\n (List<Map<String, String>>) request.getRequest().get(JsonKey.WEB_PAGES);\n if (null == data || data.isE... | {
"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_313 | {
"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 testGetAllRecordsFailure() throws Exception {\n\n when(session.execute(selectQuery))\n .thenThrow(\n new ProjectCommonException(\n ResponseCode.SERVER_ERROR.getErrorCode(),\n ResponseCode.SERVER_ERROR.getErrorMessage(),\n ... | {
"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 getAllRecords(String keyspaceName, String tableName) {\n long startTime = System.currentTimeMillis();\n ProjectLogger.log(\n \"Cassandra Service getAllRecords method started at ==\" + startTime, LoggerEnum.INFO);\n Response response = new Response();\n try {\... | {
"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_256 | {
"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 testGetContextSuccessWithOrgImageUrl() {\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.SUNBIRD_ENV_... | {
"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_190 | {
"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 testIsGoodPassword() {\n HashMap<String, Boolean> passwordExpectations = new HashMap<String, Boolean>(){\n {\n // Bad ones.\n put(\"Test 1234\", false); // space is not a valid char\n put(\"hello1234\", false); // no uppercase\n put(\"helloABCD\", fa... | {
"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 boolean isGoodPassword(String password) {\n return password.matches(ProjectUtil.getConfigValue(JsonKey.SUNBIRD_PASS_REGEX));\n }",
"class_method_signature": "UserRequestValidator.isGoodPassword(String password)",
"constructor": false,
"full_signature": "public static boolean isGoodP... | {
"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_201 | {
"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 testValidateForgotPasswordFailureWithEmptyName() {\n try {\n Request request = new Request();\n Map<String, Object> requestObj = new HashMap<>();\n requestObj.put(JsonKey.USERNAME, \"\");\n request.setRequest(requestObj);\n userRequestValidator.validateForgo... | {
"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_128 | {
"fields": [
{
"declarator": "keyCloakService = SSOServiceFactory.getInstance()",
"modifier": "private",
"original_string": "private SSOManager keyCloakService = SSOServiceFactory.getInstance();",
"type": "SSOManager",
"var_name": "keyCloakService"
},
{
"declarator": "... | {
"body": "@Test(expected = ProjectCommonException.class)\n public void testVerifyTokenSuccess() {\n keyCloakService.verifyToken(\n \"eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICI5emhhVnZDbl81OEtheHpldHBzYXNZQ2lEallkemJIX3U2LV93SDk4SEc0In0.eyJqdGkiOiI5ZmQzNzgzYy01YjZmLTQ3OWQtYmMzYy0yZWEzOGUzZmRmYzgiL... | {
"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 verifyToken(String accessToken) {\n return verifyToken(accessToken, null);\n }",
"class_method_signature": "KeyCloakServiceImpl.verifyToken(String accessToken)",
"constructor": false,
"full_signature": "@Override public String verifyToken(String accessToken)",
"identi... | {
"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_217 | {
"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 testUpdateUserSuccess() {\n Request request = initailizeRequest();\n Map<String, Object> requestObj = request.getRequest();\n requestObj.remove(JsonKey.USERNAME);\n requestObj.put(JsonKey.USER_ID, \"userId\");\n\n List<String> roles = new ArrayList<String>();\n roles.... | {
"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 validateUpdateUserRequest(Request userRequest) {\n if (userRequest.getRequest().containsKey(JsonKey.MANAGED_BY)) {\n ProjectCommonException.throwClientErrorException(ResponseCode.managedByNotAllowed);\n }\n externalIdsValidation(userRequest, JsonKey.UPDATE);\n phoneValidation(u... | {
"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_305 | {
"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 maskEmail() {\n HashMap<String, String> emailMaskExpectations = new HashMap<String, String>(){\n {\n put(\"abc@gmail.com\", \"ab*@gmail.com\");\n put(\"abcd@yahoo.com\", \"ab**@yahoo.com\");\n put(\"abcdefgh@testmail.org\... | {
"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 maskEmail(String email) {\n if (email.indexOf(\"@\") > 4) {\n return email.replaceAll(\"(^[^@]{4}|(?!^)\\\\G)[^@]\", \"$1*\");\n } else {\n return email.replaceAll(\"(^[^@]{2}|(?!^)\\\\G)[^@]\", \"$1*\");\n }\n }",
"class_method_signature": "Log... | {
"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_240 | {
"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 testValidateCreateUserFailureWithInvalidJobProfileJoiningDate() {\n Request request = initailizeRequest();\n Map<String, Object> map = new HashMap<>();\n map.put(JsonKey.JOB_NAME, \"kijklo\");\n map.put(JsonKey.ORG_NAME, \"degree\");\n map.put(JsonKey.JOINING_DATE, \"20-... | {
"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_169 | {
"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 testValidateEnrolmentTypeFailureWithWrongType() {\n try {\n RequestValidator.validateEnrolmentType(\"test\");\n } catch (ProjectCommonException e) {\n assertEquals(ResponseCode.CLIENT_ERROR.getResponseCode(), e.getResponseCode());\n assertEquals(ResponseCode.enrolm... | {
"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 validateEnrolmentType(String enrolmentType) {\n if (StringUtils.isBlank(enrolmentType)) {\n throw new ProjectCommonException(\n ResponseCode.enrolmentTypeRequired.getErrorCode(),\n ResponseCode.enrolmentTypeRequired.getErrorMessage(),\n ERROR_CODE);\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_2 | {
"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 sendEmailToMultipleUser() throws MessagingException {\n List<String> to = new ArrayList<String>();\n to.add(\"testmail@test.com\"); to.add(\"test1@test.com\");\n\t\t emailService.sendMail(to, subject, \"Test email body\"); \n List<Message> inbox = Mailbox.get(\"testmail@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 sendMail(List<String> emailList, String subject, String body) {\n return sendMail(emailList, subject, body, null);\n }",
"class_method_signature": "Email.sendMail(List<String> emailList, String subject, String body)",
"constructor": false,
"full_signature": "public boolean sendMail... | {
"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_30 | {
"fields": [],
"file": "sunbird-cassandra-migration/cassandra-migration/src/test/java/com/contrastsecurity/cassandra/migration/info/MigrationVersionTest.java",
"identifier": "MigrationVersionTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testEquals() {\n final MigrationVersion a1 = MigrationVersion.fromVersion(\"1.2.3.3\");\n final MigrationVersion a2 = MigrationVersion.fromVersion(\"1.2.3.3\");\n assertTrue(a1.compareTo(a2) == 0);\n assertEquals(a1.hashCode(), a2.hashCode());\n }",
"class_method_signatu... | {
"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": "@Override\n public boolean equals(Object o) {\n if (this == o) return true;\n if (o == null || getClass() != o.getClass()) return false;\n\n MigrationVersion version1 = (MigrationVersion) o;\n\n return compareTo(version1) == 0;\n }",
"class_method_signature": "MigrationVersion.equals(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_112 | {
"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 testBulkInsertDataSuccess() {\n Map<String, Object> data = new HashMap<String, Object>();\n data.put(\"test1\", \"test\");\n data.put(\"test2\", \"manzarul\");\n List<Map<String, Object>> listOfMap = new ArrayList<Map<String, Object>>();\n listOfMap.add(data);\n Futur... | {
"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> bulkInsert(String index, List<Map<String, Object>> dataList) {\n Promise<Boolean> promise = Futures.promise();\n long startTime = System.currentTimeMillis();\n ProjectLogger.log(\n \"ElasticSearchTcpImpl:bulkInsert: 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_88 | {
"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 testUpsertFailureWithEmptyIdentifier() {\n try {\n esService.update(\"test\", \"\", new HashMap<>());\n } catch (ProjectCommonException e) {\n assertEquals(e.getResponseCode(), ResponseCode.invalidData.getResponseCode());\n }\n }",
"class_method_signature": "Elast... | {
"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_67 | {
"fields": [],
"file": "sunbird-es-utils/src/test/java/org/sunbird/common/factory/EsClientFactoryTest.java",
"identifier": "EsClientFactoryTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n\tpublic void testGetRestClient() {\n\t\tElasticSearchService service = EsClientFactory.getInstance(\"rest\");\n\t\tAssert.assertTrue(service instanceof ElasticSearchRestHighImpl);\n\t}",
"class_method_signature": "EsClientFactoryTest.testGetRestClient()",
"constructor": false,
"full_signature... | {
"fields": [
{
"declarator": "tcpClient = null",
"modifier": "private static",
"original_string": "private static ElasticSearchService tcpClient = null;",
"type": "ElasticSearchService",
"var_name": "tcpClient"
},
{
"declarator": "restClient = null",
"modifier": ... | {
"body": "private static ElasticSearchService getRestClient() {\n if (restClient == null) {\n restClient = new ElasticSearchRestHighImpl();\n }\n return restClient;\n }",
"class_method_signature": "EsClientFactory.getRestClient()",
"constructor": false,
"full_signature": "private static ElasticS... | {
"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_283 | {
"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 testGetDateRangeSuccess() {\n int noOfDays = 7;\n Map<String, String> map = ProjectUtil.getDateRange(noOfDays);\n Calendar cal = Calendar.getInstance(TimeZone.getTimeZone(\"GMT\"));\n cal.add(Calendar.DATE, -noOfDays);\n assertEquals(map.get(\"startDate\"), new SimpleDat... | {
"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_295 | {
"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 testValidateUUID() {\n boolean isValid = ProjectUtil.validateUUID(\"1df03f56-ceba-4f2d-892c-2b1609e7b05f\");\n assertTrue(isValid);\n }",
"class_method_signature": "ProjectUtilTest.testValidateUUID()",
"constructor": false,
"full_signature": "@Test public void testValidate... | {
"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 validateUUID(String uuidStr) {\n try {\n UUID.fromString(uuidStr);\n return true;\n } catch (Exception ex) {\n return false;\n }\n }",
"class_method_signature": "ProjectUtil.validateUUID(String uuidStr)",
"constructor": false,
"full_signature": "public 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_71 | {
"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 testSaveFailureWithEmptyIdentifier() {\n Future<String> result = esService.save(\"test\", \"\", new HashMap<>());\n String res = (String) ElasticSearchHelper.getResponseFromFuture(result);\n assertEquals(\"ERROR\", res);\n }",
"class_method_signature": "ElasticSearchRestHig... | {
"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<String> save(String index, String identifier, Map<String, Object> data) {\n long startTime = System.currentTimeMillis();\n Promise<String> promise = Futures.promise();\n ProjectLogger.log(\n \"ElasticSearchUtilRest:save: method started at ==\" + startTime + \" for... | {
"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_153 | {
"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 testValidateUpdateContentSuccess() {\n Request request = new Request();\n boolean response = false;\n List<Map<String, Object>> listOfMap = new ArrayList<>();\n Map<String, Object> requestObj = new HashMap<>();\n requestObj.put(JsonKey.CONTENT_ID, \"do_1233343\");\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": "@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_26 | {
"fields": [],
"file": "sunbird-cassandra-migration/cassandra-migration/src/test/java/com/contrastsecurity/cassandra/migration/resolver/cql/CqlMigrationResolverTest.java",
"identifier": "CqlMigrationResolverTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void extractScriptName() {\n CqlMigrationResolver cqlMigrationResolver =\n new CqlMigrationResolver(\n Thread.currentThread().getContextClassLoader(),\n new ScriptsLocation(\"db/migration\"),\n \"UTF-8\");\n\n assertEquals(\n \"db_0__init... | {
"fields": [
{
"declarator": "scanner",
"modifier": "private final",
"original_string": "private final Scanner scanner;",
"type": "Scanner",
"var_name": "scanner"
},
{
"declarator": "location",
"modifier": "private final",
"original_string": "private final ... | {
"body": "String extractScriptName(Resource resource) {\n if (location.getPath().isEmpty()) {\n return resource.getLocation();\n }\n\n return resource.getLocation().substring(location.getPath().length() + 1);\n }",
"class_method_signature": "CqlMigrationResolver.extractScriptName(Resource resource)"... | {
"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_104 | {
"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 testUpsertDataFailureWithoutIndex() {\n Map<String, Object> innermap = new HashMap<>();\n innermap.put(\"courseName\", \"Updated Course Name\");\n innermap.put(\"organisationId\", \"updatedOrgId\");\n Future<Boolean> response =\n esService.upsert(null, (String) chemi... | {
"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> upsert(String index, String identifier, Map<String, Object> data) {\n long startTime = System.currentTimeMillis();\n Promise<Boolean> promise = Futures.promise();\n ProjectLogger.log(\n \"ElasticSearchTcpImpl:upsert: 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_226 | {
"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 testValidaeCreateUserRequestFailureWithInvalidEducation() {\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.EM... | {
"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_271 | {
"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 testReportTrackingStatusSuccess() {\n assertEquals(0, ProjectUtil.ReportTrackingStatus.NEW.getValue());\n assertEquals(1, ProjectUtil.ReportTrackingStatus.GENERATING_DATA.getValue());\n assertEquals(2, ProjectUtil.ReportTrackingStatus.UPLOADING_FILE.getValue());\n assertEqu... | {
"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_95 | {
"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 testComplexSearchSuccessWithRangeGreaterThan() {\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<S... | {
"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_158 | {
"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 testValidateRegisterClientFailureWithEmptyClientName() {\n Request request = new Request();\n Map<String, Object> requestObj = new HashMap<>();\n requestObj.put(JsonKey.CLIENT_NAME, \"\");\n request.setRequest(requestObj);\n try {\n RequestValidator.validateRegister... | {
"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_83 | {
"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 testDeleteFailureWithEmptyIdentifier() {\n try {\n esService.delete(\"test\", \"\");\n } catch (ProjectCommonException e) {\n assertEquals(e.getResponseCode(), ResponseCode.invalidData.getResponseCode());\n }\n }",
"class_method_signature": "ElasticSearchRestHighI... | {
"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_267 | {
"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 testIsDateValidFormatFailureWithEmptyDate() {\n boolean bool = ProjectUtil.isDateValidFormat(\"yyyy-MM-dd\", \"\");\n assertFalse(bool);\n }",
"class_method_signature": "ProjectUtilTest.testIsDateValidFormatFailureWithEmptyDate()",
"constructor": false,
"full_signature": "... | {
"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_288 | {
"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 testIsEmailValidSuccess() {\n boolean bool = ProjectUtil.isEmailvalid(\"amit.kumar@tarento.com\");\n assertTrue(bool);\n }",
"class_method_signature": "ProjectUtilTest.testIsEmailValidSuccess()",
"constructor": false,
"full_signature": "@Test public void testIsEmailValidSu... | {
"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_322 | {
"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 testGetRecordsSuccessByProperty() 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 Iterator<Row> rowItr = Mockito.mock(Iterator.class);\n Mockito.when(resultSet... | {
"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_230 | {
"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 testValidateCreateUserFailureWithInvalidEmail() {\n Request request = initailizeRequest();\n request.getRequest().put(JsonKey.EMAIL, \"am@ds@cmo\");\n\n try {\n userRequestValidator.validateCreateUserRequest(request);\n } catch (ProjectCommonException e) {\n asser... | {
"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_119 | {
"fields": [],
"file": "sunbird-es-utils/src/test/java/org/sunbird/helper/ConnectionManagerTest.java",
"identifier": "ConnectionManagerTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n\tpublic void testCloseConnection () {\n\t ConnectionManager.closeClient();\n\t Assert.assertTrue(true);\n\t}",
"class_method_signature": "ConnectionManagerTest.testCloseConnection()",
"constructor": false,
"full_signature": "@Test public void testCloseConnection()",
"identifier": "testClo... | {
"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 void closeClient() {\n client.close();\n }",
"class_method_signature": "ConnectionManager.closeClient()",
"constructor": false,
"full_signature": "public static void closeClient()",
"identifier": "closeClient",
"invocations": [
"close"
],
"modifiers": "public static",
... | {
"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_40 | {
"fields": [],
"file": "sunbird-cassandra-migration/cassandra-migration/src/test/java/com/contrastsecurity/cassandra/migration/info/MigrationInfoTest.java",
"identifier": "MigrationInfoTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void validate() {\n MigrationVersion version = MigrationVersion.fromVersion(\"1\");\n String description = \"test\";\n String user = \"testUser\";\n MigrationType type = MigrationType.CQL;\n\n ResolvedMigration resolvedMigration = new ResolvedMigration();\n resolvedMigrati... | {
"fields": [
{
"declarator": "resolvedMigration",
"modifier": "private final",
"original_string": "private final ResolvedMigration resolvedMigration;",
"type": "ResolvedMigration",
"var_name": "resolvedMigration"
},
{
"declarator": "appliedMigration",
"modifier":... | {
"body": "public String validate() {\n if (!context.pendingOrFuture\n && (resolvedMigration == null)\n && (appliedMigration.getType() != MigrationType.SCHEMA)\n && (appliedMigration.getType() != MigrationType.BASELINE)) {\n return \"Detected applied migration not resolved locally: \" + g... | {
"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_9 | {
"fields": [],
"file": "sunbird-cassandra-migration/cassandra-migration/src/test/java/com/contrastsecurity/cassandra/migration/resolver/java/JavaMigrationResolverTest.java",
"identifier": "JavaMigrationResolverTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void conventionOverConfiguration() {\n JavaMigrationResolver jdbcMigrationResolver =\n new JavaMigrationResolver(Thread.currentThread().getContextClassLoader(), null);\n ResolvedMigration migrationInfo =\n jdbcMigrationResolver.extractMigrationInfo(new V2__InterfaceBased... | {
"fields": [
{
"declarator": "location",
"modifier": "private final",
"original_string": "private final ScriptsLocation location;",
"type": "ScriptsLocation",
"var_name": "location"
},
{
"declarator": "classLoader",
"modifier": "private",
"original_string":... | {
"body": "ResolvedMigration extractMigrationInfo(JavaMigration javaMigration) {\n Integer checksum = null;\n if (javaMigration instanceof MigrationChecksumProvider) {\n MigrationChecksumProvider checksumProvider = (MigrationChecksumProvider) javaMigration;\n checksum = checksumProvider.getChecksum();... | {
"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_162 | {
"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 testValidateClientIdFailureWithEmptyId() {\n try {\n RequestValidator.validateClientId(\"\");\n } catch (ProjectCommonException e) {\n assertEquals(ResponseCode.CLIENT_ERROR.getResponseCode(), e.getResponseCode());\n assertEquals(ResponseCode.invalidClientId.getErr... | {
"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 validateClientId(String clientId) {\n if (StringUtils.isBlank(clientId)) {\n throw createExceptionInstance(ResponseCode.invalidClientId.getErrorCode());\n }\n }",
"class_method_signature": "RequestValidator.validateClientId(String clientId)",
"constructor": false,
"full... | {
"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_17 | {
"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 extractSchemaVersionCustomSeparator() {\n Pair<MigrationVersion, String> info =\n MigrationInfoHelper.extractVersionAndDescription(\"V9_4-EmailAxel.cql\", \"V\", \"-\", \".cql\");\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_135 | {
"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 testSyncUserDataSuccessWithoutCountryCode() {\n Map<String, Object> request = new HashMap<String, Object>();\n request.put(JsonKey.USERNAME, userName);\n request.put(JsonKey.PROVIDER, \"ntp\");\n request.put(JsonKey.PASSWORD, \"password\");\n request.put(JsonKey.FIRST_NA... | {
"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_123 | {
"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 testUpdateUserSuccessWithoutProvider() {\n Map<String, Object> request = new HashMap<String, Object>();\n request.put(JsonKey.USER_ID, userId.get(JsonKey.USER_ID));\n request.put(JsonKey.FIRST_NAME, userName);\n request.put(JsonKey.PHONE, \"9870060000\");\n request.put(J... | {
"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 updateUser(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 r... | {
"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_56 | {
"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 isPresentNot() {\n assertFalse(\n ClassUtils.isPresent(\n \"com.example.FakeClass\", Thread.currentThread().getContextClassLoader()));\n }",
"class_method_signature": "ClassUtilsTest.isPresentNot()",
"constructor": false,
"full_signature": "@Test public void... | {
"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_318 | {
"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 testGetRecordSuccessByProperties() throws Exception {\n\n Map<String, Object> map = new HashMap<>();\n map.put(JsonKey.USER_ID, \"USR1\");\n map.put(JsonKey.ADD_TYPE, \"addrType\");\n\n when(session.execute(boundStatement.bind(\"123\"))).thenReturn(resultSet);\n 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 getRecordsByProperties(\n String keyspaceName, String tableName, Map<String, Object> propertyMap) {\n return getRecordsByProperties(keyspaceName, tableName, propertyMap, null);\n }",
"class_method_signature": "CassandraOperationImpl.getRecordsByProperties(\n Str... | {
"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_174 | {
"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 testValidateSyncRequestFailureWithInvalidObjectType() {\n Request request = new Request();\n Map<String, Object> requestObj = new HashMap<>();\n requestObj.put(JsonKey.OPERATION_FOR, \"not keycloack\");\n List<String> objectLsit = new ArrayList<>();\n objectLsit.add(\"te... | {
"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 validateSyncRequest(Request request) {\n String operation = (String) request.getRequest().get(JsonKey.OPERATION_FOR);\n if ((null != operation) && (!operation.equalsIgnoreCase(\"keycloak\"))) {\n if (request.getRequest().get(JsonKey.OBJECT_TYPE) == null) {\n throw new P... | {
"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_103 | {
"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 testUpsertDataFailureWithoutIdentifier() {\n Map<String, Object> innermap = new HashMap<>();\n innermap.put(\"courseName\", \"Updated Course Name\");\n innermap.put(\"organisationId\", \"updatedOrgId\");\n Future<Boolean> response = esService.upsert(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> upsert(String index, String identifier, Map<String, Object> data) {\n long startTime = System.currentTimeMillis();\n Promise<Boolean> promise = Futures.promise();\n ProjectLogger.log(\n \"ElasticSearchTcpImpl:upsert: 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_21 | {
"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 extractSchemaVersionWithLeadingUnderscore() {\n MigrationInfoHelper.extractVersionAndDescription(\"_8_0__Description\", \"\", \"__\", \"\");\n }",
"class_method_signature": "MigrationInfoHelperTest.extractSchemaVersionWithLeadingUnder... | {
"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_154 | {
"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 testValdateUpdateContentFailureWithNullContentId() {\n Request request = new Request();\n boolean response = false;\n List<Map<String, Object>> listOfMap = new ArrayList<>();\n Map<String, Object> requestObj = new HashMap<>();\n requestObj.put(JsonKey.CONTENT_ID, null);\... | {
"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_99 | {
"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 testGetDataByIdentifierFailureWithoutIdentifier() {\n Future<Map<String, Object>> responseMap = esService.getDataByIdentifier(INDEX_NAME, \"\");\n Map<String, Object> map =\n (Map<String, Object>) ElasticSearchHelper.getResponseFromFuture(responseMap);\n assertEquals(0,... | {
"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_76 | {
"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 testUpdateFailureWithEmptyIdentifier() {\n try {\n esService.update(\"test\", \"\", new HashMap<>());\n } catch (ProjectCommonException e) {\n assertEquals(e.getResponseCode(), ResponseCode.invalidData.getResponseCode());\n }\n }",
"class_method_signature": "Elast... | {
"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_292 | {
"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 testMigrateActionAcceptValueSuccess() {\n Assert.assertEquals(\"accept\", ProjectUtil.MigrateAction.ACCEPT.getValue());\n }",
"class_method_signature": "ProjectUtilTest.testMigrateActionAcceptValueSuccess()",
"constructor": false,
"full_signature": "@Test public void testMigr... | {
"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_284 | {
"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 testGetDateRangeFailure() {\n int noOfDays = 14;\n Map<String, String> map = ProjectUtil.getDateRange(noOfDays);\n Calendar cal = Calendar.getInstance(TimeZone.getTimeZone(\"GMT\"));\n cal.add(Calendar.DATE, -noOfDays);\n assertEquals(map.get(\"startDate\"), new SimpleDa... | {
"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_60 | {
"fields": [],
"file": "sunbird-cassandra-migration/cassandra-migration/src/test/java/com/contrastsecurity/cassandra/migration/utils/scanner/filesystem/FileSystemResourceTest.java",
"identifier": "FileSystemResourceTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void getFilename() throws Exception {\n assertEquals(\"Mig777__Test.cql\", new FileSystemResource(\"Mig777__Test.cql\").getFilename());\n assertEquals(\n \"Mig777__Test.cql\", new FileSystemResource(\"folder/Mig777__Test.cql\").getFilename());\n }",
"class_method_signature":... | {
"fields": [
{
"declarator": "location",
"modifier": "private",
"original_string": "private File location;",
"type": "File",
"var_name": "location"
}
],
"file": "sunbird-cassandra-migration/cassandra-migration/src/main/java/com/contrastsecurity/cassandra/migration/utils/scan... | {
"body": "public String getFilename() {\n return location.getName();\n }",
"class_method_signature": "FileSystemResource.getFilename()",
"constructor": false,
"full_signature": "public String getFilename()",
"identifier": "getFilename",
"invocations": [
"getName"
],
"modifiers": "public",
"pa... | {
"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_115 | {
"fields": [],
"file": "sunbird-es-utils/src/test/java/org/sunbird/helper/ConnectionManagerTest.java",
"identifier": "ConnectionManagerTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n\tpublic void testGetRestClientNull() {\n\t\tRestHighLevelClient client = ConnectionManager.getRestClient();\n\t\tAssert.assertNull(client);\n\t}",
"class_method_signature": "ConnectionManagerTest.testGetRestClientNull()",
"constructor": false,
"full_signature": "@Test public void testGetRestC... | {
"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 RestHighLevelClient getRestClient() {\n if (restClient == null) {\n ProjectLogger.log(\n \"ConnectionManager:getRestClient eLastic search rest clinet is null \" + client,\n LoggerEnum.INFO.name());\n initialiseRestClientConnection();\n ProjectLogger.log(\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_37 | {
"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 letters() {\n MigrationVersion.fromVersion(\"abc1.0\");\n }",
"class_method_signature": "MigrationVersionTest.letters()",
"constructor": false,
"full_signature": "@Test(expected = CassandraMigrationException.class) public void let... | {
"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_5 | {
"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 sendEmailWithAttachmentTest() throws MessagingException {\n\t List<String> to = new ArrayList<String>();\n\t to.add(\"testmail@test.com\"); to.add(\"test1@test.com\");\n emailService.sendAttachment(to, \"Test email as attached.\", subject, \"emailtemplate.vm\");\n List<Messag... | {
"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 void sendAttachment(\n List<String> emailList, String emailBody, String subject, String filePath) {\n try {\n Session session = getSession();\n MimeMessage message = new MimeMessage(session);\n addRecipient(message, Message.RecipientType.TO, emailList);\n message.setSubje... | {
"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_181 | {
"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 testValidateGetClientKeyFailureWithEmptyClientId() {\n boolean response = false;\n try {\n RequestValidator.validateGetClientKey(\"\", \"clientType\");\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_247 | {
"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 validateUserCreateV3Sussess() {\n boolean response = true;\n try {\n Request request = new Request();\n request.getRequest().put(JsonKey.FIRST_NAME, \"test name\");\n request.getRequest().put(JsonKey.EMAIL, \"test@test.com\");\n request.getRequest().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 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_139 | {
"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 testGetFederatedUserId()\n throws ClassNotFoundException, InstantiationException, IllegalAccessException,\n NoSuchMethodException, SecurityException, IllegalArgumentException,\n InvocationTargetException {\n KeyCloakServiceImpl.class.getDeclaredMethods();\n ... | {
"fields": [
{
"declarator": "keycloak = KeyCloakConnectionProvider.getConnection()",
"modifier": "private",
"original_string": "private Keycloak keycloak = KeyCloakConnectionProvider.getConnection();",
"type": "Keycloak",
"var_name": "keycloak"
},
{
"declarator": "URL... | {
"body": "private String getFederatedUserId(String userId) {\n return String.join(\n \":\",\n \"f\",\n ProjectUtil.getConfigValue(JsonKey.SUNBIRD_KEYCLOAK_USER_FEDERATION_PROVIDER_ID),\n userId);\n }",
"class_method_signature": "KeyCloakServiceImpl.getFederatedUserId(String userId)"... | {
"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_210 | {
"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 testValidateCreateUserFailureWithEmptyAddType() {\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_206 | {
"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 testValidateChangePasswordFailureWithSameOldPassword() {\n Request request = new Request();\n Map<String, Object> requestObj = new HashMap<>();\n requestObj.put(JsonKey.NEW_PASSWORD, \"password\");\n requestObj.put(JsonKey.PASSWORD, \"password\");\n request.setRequest(re... | {
"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_178 | {
"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 testValidateCreateOrgTypeSuccess() {\n Request request = new Request();\n Map<String, Object> requestObj = new HashMap<>();\n requestObj.put(JsonKey.NAME, \"OrgTypeName\");\n request.setRequest(requestObj);\n boolean response = false;\n try {\n RequestValidator.v... | {
"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 validateCreateOrgType(Request reqObj) {\n if (StringUtils.isBlank((String) reqObj.getRequest().get(JsonKey.NAME))) {\n throw createExceptionInstance(ResponseCode.orgTypeMandatory.getErrorCode());\n }\n }",
"class_method_signature": "RequestValidator.validateCreateOrgType(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_197 | {
"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 testValidateUserNameFailure() {\n Request request = initailizeRequest();\n Map<String, Object> requestObj = request.getRequest();\n requestObj.put(JsonKey.USERNAME, \"\");\n request.setRequest(requestObj);\n try {\n userRequestValidator.validateCreateUserV1Request(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 validateCreateUserV1Request(Request userRequest) {\n validateUserName(userRequest);\n validateCreateUserV3Request(userRequest);\n }",
"class_method_signature": "UserRequestValidator.validateCreateUserV1Request(Request userRequest)",
"constructor": false,
"full_signature": "public v... | {
"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_314 | {
"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 testGetPropertiesValueFailureById() throws Exception {\n\n Throwable exception = null;\n PowerMockito.whenNew(BoundStatement.class)\n .withArguments(Mockito.any(PreparedStatement.class))\n .thenThrow(\n new ProjectCommonException(\n Respons... | {
"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 getPropertiesValueById(\n String keyspaceName, String tableName, String id, String... properties) {\n long startTime = System.currentTimeMillis();\n ProjectLogger.log(\n \"Cassandra Service getPropertiesValueById method started at ==\" + startTime,\n Lo... | {
"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_251 | {
"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 testValidateFrameworkUnknownField() {\n Request request = initailizeRequest();\n Map<String, Object> frameworkMap = createFrameWork();\n frameworkMap.put(\"school\", Arrays.asList(\"school1\"));\n request.getRequest().put(JsonKey.FRAMEWORK, frameworkMap);\n boolean respo... | {
"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_315 | {
"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 testGetRecordSuccessById() {\n Iterator<Row> rowItr = Mockito.mock(Iterator.class);\n Mockito.when(resultSet.iterator()).thenReturn(rowItr);\n when(session.execute(boundStatement.bind(\"123\"))).thenReturn(resultSet);\n when(session.execute(where)).thenReturn(resultSet);\n ... | {
"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_250 | {
"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 testValidateMandatoryFrameworkFieldValueAsString() {\n Request request = initailizeRequest();\n Map<String, Object> frameworkMap = createFrameWork();\n frameworkMap.put(\"medium\", \"hindi\");\n request.getRequest().put(JsonKey.FRAMEWORK, frameworkMap);\n boolean respons... | {
"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_179 | {
"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 testValidateCreateOrgTypeFailureWithNullName() {\n Request request = new Request();\n Map<String, Object> requestObj = new HashMap<>();\n requestObj.put(JsonKey.NAME, null);\n request.setRequest(requestObj);\n boolean response = false;\n try {\n RequestValidator.... | {
"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 validateCreateOrgType(Request reqObj) {\n if (StringUtils.isBlank((String) reqObj.getRequest().get(JsonKey.NAME))) {\n throw createExceptionInstance(ResponseCode.orgTypeMandatory.getErrorCode());\n }\n }",
"class_method_signature": "RequestValidator.validateCreateOrgType(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_196 | {
"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 testValidateUserCreateV3Failure() {\n Request request = initailizeRequest();\n Map<String, Object> requestObj = request.getRequest();\n requestObj.put(JsonKey.FIRST_NAME, \"\");\n request.setRequest(requestObj);\n try {\n userRequestValidator.validateUserCreateV3(re... | {
"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_207 | {
"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 testValidateChangePasswordFailureWithPasswordMissing() {\n Request request = new Request();\n Map<String, Object> requestObj = new HashMap<>();\n requestObj.put(JsonKey.NEW_PASSWORD, \"password\");\n request.setRequest(requestObj);\n try {\n userRequestValidator.val... | {
"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_211 | {
"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 testPhoneValidationSuccess() {\n Request request = new Request();\n boolean response = false;\n Map<String, Object> requestObj = new HashMap<>();\n requestObj.put(JsonKey.PHONE, \"9321234123\");\n requestObj.put(JsonKey.COUNTRY_CODE, \"+91\");\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 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_138 | {
"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 testDoPasswordUpdateSuccess() {\n boolean response = keyCloakService.doPasswordUpdate(userId.get(JsonKey.USER_ID), \"password\");\n Assert.assertEquals(true, response);\n }",
"class_method_signature": "KeyCloakServiceImplTest.testDoPasswordUpdateSuccess()",
"constructor": fa... | {
"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 doPasswordUpdate(String userId, String password) {\n boolean response = false;\n try {\n String fedUserId = getFederatedUserId(userId);\n UserResource resource =\n keycloak.realm(KeyCloakConnectionProvider.SSO_REALM).users().get(fedUserId);\n Creden... | {
"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_246 | {
"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 testValidateGerUserCountFailureWithEstCntReqTrue() {\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 new 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 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_4 | {
"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 sendEmailTOBCC() throws MessagingException{\n\t List<String> bcc = new ArrayList<String>();\n\t bcc.add(\"testmail@test.com\");\n\t emailService.sendEmail(\"testgamil@gmail.com\", subject, \"Bcc email test body\", bcc);\n\t List<Message> inbox = Mailbox.get(\"testmail@test.com\");\... | {
"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_180 | {
"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 testValidateGetClientKeySuccess() {\n boolean response = false;\n try {\n RequestValidator.validateGetClientKey(\"clientId\", \"clientType\");\n response = true;\n } catch (ProjectCommonException e) {\n Assert.assertNull(e);\n }\n Assert.assertTrue(respons... | {
"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_36 | {
"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 endDot() {\n MigrationVersion.fromVersion(\"1.\");\n }",
"class_method_signature": "MigrationVersionTest.endDot()",
"constructor": false,
"full_signature": "@Test(expected = CassandraMigrationException.class) public void endDot()"... | {
"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_114 | {
"fields": [],
"file": "sunbird-es-utils/src/test/java/org/sunbird/helper/ConnectionManagerTest.java",
"identifier": "ConnectionManagerTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n\tpublic void testInitialiseConnection() {\n\t\tTransportClient client = ConnectionManager.getClient();\n\t\tAssert.assertNotNull(client);\n\t}",
"class_method_signature": "ConnectionManagerTest.testInitialiseConnection()",
"constructor": false,
"full_signature": "@Test public void testInitial... | {
"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": "private static boolean initialiseConnection() {\n try {\n if (initialiseConnectionFromEnv()) {\n ProjectLogger.log(\"value found under system variable.\", LoggerEnum.INFO.name());\n return true;\n }\n return initialiseConnectionFromPropertiesFile(cluster, hostName, port);\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_285 | {
"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 testGetDateRangeFailureWithZeroDays() {\n int noOfDays = 0;\n Map<String, String> map = ProjectUtil.getDateRange(noOfDays);\n assertNull(map.get(\"startDate\"));\n assertNull(map.get(\"endDate\"));\n }",
"class_method_signature": "ProjectUtilTest.testGetDateRangeFailureW... | {
"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_61 | {
"fields": [],
"file": "sunbird-cassandra-migration/cassandra-migration/src/test/java/com/contrastsecurity/cassandra/migration/utils/scanner/filesystem/FileSystemResourceTest.java",
"identifier": "FileSystemResourceTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void getPath() throws Exception {\n assertEquals(\"Mig777__Test.cql\", new FileSystemResource(\"Mig777__Test.cql\").getLocation());\n assertEquals(\n \"folder/Mig777__Test.cql\", new FileSystemResource(\"folder/Mig777__Test.cql\").getLocation());\n }",
"class_method_signatur... | {
"fields": [
{
"declarator": "location",
"modifier": "private",
"original_string": "private File location;",
"type": "File",
"var_name": "location"
}
],
"file": "sunbird-cassandra-migration/cassandra-migration/src/main/java/com/contrastsecurity/cassandra/migration/utils/scan... | {
"body": "public String getLocation() {\n return StringUtils.replaceAll(location.getPath(), \"\\\\\", \"/\");\n }",
"class_method_signature": "FileSystemResource.getLocation()",
"constructor": false,
"full_signature": "public String getLocation()",
"identifier": "getLocation",
"invocations": [
"rep... | {
"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_98 | {
"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 testGetByIdentifierFailureWithoutTypeAndIndexIdentifier() {\n try {\n esService.getDataByIdentifier(null, \"\");\n } catch (ProjectCommonException ex) {\n assertEquals(ResponseCode.SERVER_ERROR.getResponseCode(), ex.getResponseCode());\n }\n }",
"class_method_sign... | {
"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_77 | {
"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 testGetDataByIdentifierFailureWithEmptyIndex() {\n try {\n esService.getDataByIdentifier(\"\", \"001\");\n } catch (ProjectCommonException e) {\n assertEquals(e.getResponseCode(), ResponseCode.invalidData.getResponseCode());\n }\n }",
"class_method_signature": "El... | {
"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_293 | {
"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 testMigrateActionRejectValueSuccess() {\n Assert.assertEquals(\"reject\", ProjectUtil.MigrateAction.REJECT.getValue());\n }",
"class_method_signature": "ProjectUtilTest.testMigrateActionRejectValueSuccess()",
"constructor": false,
"full_signature": "@Test public void testMigr... | {
"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_155 | {
"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 testValidteUpdateContentFailureWithoutContentId() {\n Request request = new Request();\n List<Map<String, Object>> listOfMap = new ArrayList<>();\n Map<String, Object> requestObj = new HashMap<>();\n requestObj.put(JsonKey.STATUS, \"Completed\");\n listOfMap.add(requestO... | {
"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_20 | {
"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 extractSchemaVersionWithLeadingZeroes() {\n Pair<MigrationVersion, String> info =\n MigrationInfoHelper.extractVersionAndDescription(\"009_4__EmailAxel\", \"\", \"__\", \"\");\n MigrationVersion version = info.getLeft();\n String description = info.getRight();\n asse... | {
"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_102 | {
"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 testUpdateDataFailureWithNullMap() {\n Future<Boolean> response =\n esService.update(INDEX_NAME, (String) chemistryMap.get(\"courseId\"), null);\n boolean result = (boolean) ElasticSearchHelper.getResponseFromFuture(response);\n assertFalse(result);\n }",
"class_meth... | {
"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_175 | {
"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 testValidateUserOrgTypeSuccess() {\n Request request = new Request();\n Map<String, Object> requestObj = new HashMap<>();\n requestObj.put(JsonKey.NAME, \"orgtypeName\");\n requestObj.put(JsonKey.ID, \"orgtypeId\");\n request.setRequest(requestObj);\n boolean 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 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_57 | {
"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 shouldDetectSlf4j() {\n assertThat(\n new FeatureDetector(Thread.currentThread().getContextClassLoader()).isSlf4jAvailable(),\n is(true));\n }",
"class_method_signature": "FeatureDetectorTest.shouldDetectSlf4j()",
"constructor": false,
"full_signature": "@Test p... | {
"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 isSlf4jAvailable() {\n if (slf4jAvailable == null) {\n slf4jAvailable = isPresent(\"org.slf4j.Logger\", classLoader);\n }\n\n return slf4jAvailable;\n }",
"class_method_signature": "FeatureDetector.isSlf4jAvailable()",
"constructor": false,
"full_signature": "public 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_319 | {
"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 testGetRecordFailureByProperties() throws Exception {\n\n Map<String, Object> map = new HashMap<>();\n map.put(JsonKey.USER_ID, \"USR1\");\n map.put(JsonKey.ADD_TYPE, \"addrType\");\n\n List<Row> rows = new ArrayList<>();\n Row row = Mockito.mock(Row.class);\n rows.ad... | {
"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 getRecordsByProperties(\n String keyspaceName, String tableName, Map<String, Object> propertyMap) {\n return getRecordsByProperties(keyspaceName, tableName, propertyMap, null);\n }",
"class_method_signature": "CassandraOperationImpl.getRecordsByProperties(\n Str... | {
"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_122 | {
"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 testUserUpdateTestSuccessWithAllData() {\n Map<String, Object> request = new HashMap<String, Object>();\n request.put(JsonKey.USER_ID, userId.get(JsonKey.USER_ID));\n request.put(JsonKey.FIRST_NAME, userName);\n request.put(JsonKey.PHONE, \"9870060000\");\n request.put(J... | {
"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 updateUser(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 r... | {
"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_134 | {
"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 testSyncUserDataSuccess() {\n Map<String, Object> request = new HashMap<String, Object>();\n request.put(JsonKey.USERNAME, userName);\n request.put(JsonKey.PROVIDER, \"ntp\");\n request.put(JsonKey.PASSWORD, \"password\");\n request.put(JsonKey.FIRST_NAME, \"A\");\n r... | {
"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_16 | {
"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 extractSchemaVersionDefaults() {\n Pair<MigrationVersion, String> info =\n MigrationInfoHelper.extractVersionAndDescription(\"V9_4__EmailAxel.cql\", \"V\", \"__\", \".cql\");\n MigrationVersion version = info.getLeft();\n String description = info.getRight();\n asser... | {
"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_8 | {
"fields": [],
"file": "sunbird-cassandra-migration/cassandra-migration/src/test/java/com/contrastsecurity/cassandra/migration/resolver/java/JavaMigrationResolverTest.java",
"identifier": "JavaMigrationResolverTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void resolveMigrations() {\n JavaMigrationResolver jdbcMigrationResolver =\n new JavaMigrationResolver(\n Thread.currentThread().getContextClassLoader(),\n new ScriptsLocation(\"com/contrastsecurity/cassandra/migration/resolver/java/dummy\"));\n Collection... | {
"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_163 | {
"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 testValidateFileUploadFailureWithoutContainerName() {\n Request request = new Request();\n Map<String, Object> requestObj = new HashMap<>();\n requestObj.put(JsonKey.CONTAINER, \"\");\n request.setRequest(requestObj);\n try {\n RequestValidator.validateFileUpload(re... | {
"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 validateFileUpload(Request reqObj) {\n\n if (StringUtils.isBlank((String) reqObj.get(JsonKey.CONTAINER))) {\n throw new ProjectCommonException(\n ResponseCode.storageContainerNameMandatory.getErrorCode(),\n ResponseCode.storageContainerNameMandatory.getErrorMess... | {
"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_41 | {
"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 dumpEmpty() {\n String table = MigrationInfoDumper.dumpToAsciiTable(new MigrationInfo[0]);\n String[] lines = StringUtils.tokenizeToStringArray(table, \"\\n\");\n\n assertEquals(5, lines.length);\n for (String line : lines) {\n assertEquals(lines[0].length(), line.leng... | {
"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_118 | {
"fields": [],
"file": "sunbird-es-utils/src/test/java/org/sunbird/helper/ConnectionManagerTest.java",
"identifier": "ConnectionManagerTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n\tpublic void testInitialiseConnectionFromPropertiesFileFailWithNull() {\n\t\tboolean response = ConnectionManager.initialiseConnectionFromPropertiesFile(\"test\", \"localhost\", null);\n\t\tAssert.assertFalse(response);\n\t}",
"class_method_signature": "ConnectionManagerTest.testInitialiseConnect... | {
"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_231 | {
"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 testValidateCreateUserFailureWithoutPhoneVerified() {\n Request request = initailizeRequest();\n request.getRequest().put(JsonKey.PHONE, \"7894561230\");\n\n try {\n userRequestValidator.validateCreateUserRequest(request);\n } catch (ProjectCommonException e) {\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": "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.