target stringlengths 20 113k | src_fm stringlengths 11 86.3k | src_fm_fc stringlengths 21 86.4k | src_fm_fc_co stringlengths 30 86.4k | src_fm_fc_ms stringlengths 42 86.8k | src_fm_fc_ms_ff stringlengths 43 86.8k |
|---|---|---|---|---|---|
@Test public void extractScriptNameFileSystemPrefix() { CqlMigrationResolver cqlMigrationResolver = new CqlMigrationResolver( Thread.currentThread().getContextClassLoader(), new ScriptsLocation("filesystem:/some/dir"), "UTF-8"); assertEquals( "V3.171__patch.cql", cqlMigrationResolver.extractScriptName( new FileSystemRe... | String extractScriptName(Resource resource) { if (location.getPath().isEmpty()) { return resource.getLocation(); } return resource.getLocation().substring(location.getPath().length() + 1); } | CqlMigrationResolver implements MigrationResolver { String extractScriptName(Resource resource) { if (location.getPath().isEmpty()) { return resource.getLocation(); } return resource.getLocation().substring(location.getPath().length() + 1); } } | CqlMigrationResolver implements MigrationResolver { String extractScriptName(Resource resource) { if (location.getPath().isEmpty()) { return resource.getLocation(); } return resource.getLocation().substring(location.getPath().length() + 1); } CqlMigrationResolver(ClassLoader classLoader, ScriptsLocation location, Strin... | CqlMigrationResolver implements MigrationResolver { String extractScriptName(Resource resource) { if (location.getPath().isEmpty()) { return resource.getLocation(); } return resource.getLocation().substring(location.getPath().length() + 1); } CqlMigrationResolver(ClassLoader classLoader, ScriptsLocation location, Strin... | CqlMigrationResolver implements MigrationResolver { String extractScriptName(Resource resource) { if (location.getPath().isEmpty()) { return resource.getLocation(); } return resource.getLocation().substring(location.getPath().length() + 1); } CqlMigrationResolver(ClassLoader classLoader, ScriptsLocation location, Strin... |
@Test public void testMigrateActionAcceptValueFailure() { Assert.assertNotEquals("ok", ProjectUtil.MigrateAction.ACCEPT.getValue()); } | private static Object getValue(Map<String, Object> map, String key) { Object value = map.get(key); map.remove(key); return value; } | ProjectUtil { private static Object getValue(Map<String, Object> map, String key) { Object value = map.get(key); map.remove(key); return value; } } | ProjectUtil { private static Object getValue(Map<String, Object> map, String key) { Object value = map.get(key); map.remove(key); return value; } } | ProjectUtil { private static Object getValue(Map<String, Object> map, String key) { Object value = map.get(key); map.remove(key); return value; } static boolean isStringNullOREmpty(String value); static String getFormattedDate(); static String formatDate(Date date); static boolean isEmailvalid(final String email); sta... | ProjectUtil { private static Object getValue(Map<String, Object> map, String key) { Object value = map.get(key); map.remove(key); return value; } static boolean isStringNullOREmpty(String value); static String getFormattedDate(); static String formatDate(Date date); static boolean isEmailvalid(final String email); sta... |
@Test public void testMigrateActionRejectValueFailure() { Assert.assertNotEquals("no", ProjectUtil.MigrateAction.REJECT.getValue()); } | private static Object getValue(Map<String, Object> map, String key) { Object value = map.get(key); map.remove(key); return value; } | ProjectUtil { private static Object getValue(Map<String, Object> map, String key) { Object value = map.get(key); map.remove(key); return value; } } | ProjectUtil { private static Object getValue(Map<String, Object> map, String key) { Object value = map.get(key); map.remove(key); return value; } } | ProjectUtil { private static Object getValue(Map<String, Object> map, String key) { Object value = map.get(key); map.remove(key); return value; } static boolean isStringNullOREmpty(String value); static String getFormattedDate(); static String formatDate(Date date); static boolean isEmailvalid(final String email); sta... | ProjectUtil { private static Object getValue(Map<String, Object> map, String key) { Object value = map.get(key); map.remove(key); return value; } static boolean isStringNullOREmpty(String value); static String getFormattedDate(); static String formatDate(Date date); static boolean isEmailvalid(final String email); sta... |
@Test public void testMigrateActionAcceptValueSuccess() { Assert.assertEquals("accept", ProjectUtil.MigrateAction.ACCEPT.getValue()); } | private static Object getValue(Map<String, Object> map, String key) { Object value = map.get(key); map.remove(key); return value; } | ProjectUtil { private static Object getValue(Map<String, Object> map, String key) { Object value = map.get(key); map.remove(key); return value; } } | ProjectUtil { private static Object getValue(Map<String, Object> map, String key) { Object value = map.get(key); map.remove(key); return value; } } | ProjectUtil { private static Object getValue(Map<String, Object> map, String key) { Object value = map.get(key); map.remove(key); return value; } static boolean isStringNullOREmpty(String value); static String getFormattedDate(); static String formatDate(Date date); static boolean isEmailvalid(final String email); sta... | ProjectUtil { private static Object getValue(Map<String, Object> map, String key) { Object value = map.get(key); map.remove(key); return value; } static boolean isStringNullOREmpty(String value); static String getFormattedDate(); static String formatDate(Date date); static boolean isEmailvalid(final String email); sta... |
@Test public void testMigrateActionRejectValueSuccess() { Assert.assertEquals("reject", ProjectUtil.MigrateAction.REJECT.getValue()); } | private static Object getValue(Map<String, Object> map, String key) { Object value = map.get(key); map.remove(key); return value; } | ProjectUtil { private static Object getValue(Map<String, Object> map, String key) { Object value = map.get(key); map.remove(key); return value; } } | ProjectUtil { private static Object getValue(Map<String, Object> map, String key) { Object value = map.get(key); map.remove(key); return value; } } | ProjectUtil { private static Object getValue(Map<String, Object> map, String key) { Object value = map.get(key); map.remove(key); return value; } static boolean isStringNullOREmpty(String value); static String getFormattedDate(); static String formatDate(Date date); static boolean isEmailvalid(final String email); sta... | ProjectUtil { private static Object getValue(Map<String, Object> map, String key) { Object value = map.get(key); map.remove(key); return value; } static boolean isStringNullOREmpty(String value); static String getFormattedDate(); static String formatDate(Date date); static boolean isEmailvalid(final String email); sta... |
@Test public void testValidateCountryCode() { boolean isValid = ProjectUtil.validateCountryCode("+91"); assertTrue(isValid); } | public static boolean validateCountryCode(String countryCode) { String pattern = "^(?:[+] ?){0,1}(?:[0-9] ?){1,3}"; try { Pattern patt = Pattern.compile(pattern); Matcher matcher = patt.matcher(countryCode); return matcher.matches(); } catch (RuntimeException e) { return false; } } | ProjectUtil { public static boolean validateCountryCode(String countryCode) { String pattern = "^(?:[+] ?){0,1}(?:[0-9] ?){1,3}"; try { Pattern patt = Pattern.compile(pattern); Matcher matcher = patt.matcher(countryCode); return matcher.matches(); } catch (RuntimeException e) { return false; } } } | ProjectUtil { public static boolean validateCountryCode(String countryCode) { String pattern = "^(?:[+] ?){0,1}(?:[0-9] ?){1,3}"; try { Pattern patt = Pattern.compile(pattern); Matcher matcher = patt.matcher(countryCode); return matcher.matches(); } catch (RuntimeException e) { return false; } } } | ProjectUtil { public static boolean validateCountryCode(String countryCode) { String pattern = "^(?:[+] ?){0,1}(?:[0-9] ?){1,3}"; try { Pattern patt = Pattern.compile(pattern); Matcher matcher = patt.matcher(countryCode); return matcher.matches(); } catch (RuntimeException e) { return false; } } static boolean isStrin... | ProjectUtil { public static boolean validateCountryCode(String countryCode) { String pattern = "^(?:[+] ?){0,1}(?:[0-9] ?){1,3}"; try { Pattern patt = Pattern.compile(pattern); Matcher matcher = patt.matcher(countryCode); return matcher.matches(); } catch (RuntimeException e) { return false; } } static boolean isStrin... |
@Test public void testValidateUUID() { boolean isValid = ProjectUtil.validateUUID("1df03f56-ceba-4f2d-892c-2b1609e7b05f"); assertTrue(isValid); } | public static boolean validateUUID(String uuidStr) { try { UUID.fromString(uuidStr); return true; } catch (Exception ex) { return false; } } | ProjectUtil { public static boolean validateUUID(String uuidStr) { try { UUID.fromString(uuidStr); return true; } catch (Exception ex) { return false; } } } | ProjectUtil { public static boolean validateUUID(String uuidStr) { try { UUID.fromString(uuidStr); return true; } catch (Exception ex) { return false; } } } | ProjectUtil { public static boolean validateUUID(String uuidStr) { try { UUID.fromString(uuidStr); return true; } catch (Exception ex) { return false; } } static boolean isStringNullOREmpty(String value); static String getFormattedDate(); static String formatDate(Date date); static boolean isEmailvalid(final String em... | ProjectUtil { public static boolean validateUUID(String uuidStr) { try { UUID.fromString(uuidStr); return true; } catch (Exception ex) { return false; } } static boolean isStringNullOREmpty(String value); static String getFormattedDate(); static String formatDate(Date date); static boolean isEmailvalid(final String em... |
@Test public void testPostFormDataSuccess() { Map<String, String> reqData = new HashMap<>(); reqData.put("field1", "value1"); reqData.put("field2", "value2"); Map<String, byte[]> fileData = new HashMap<>(); fileData.put("file1", ("asd".getBytes())); Map<String, String> headers = new HashMap<>(); headers.put("Authorizat... | public static HttpUtilResponse postFormData( Map<String, String> reqData, Map<String, byte[]> fileData, Map<String, String> headers, String url) throws IOException { long startTime = System.currentTimeMillis(); Map<String, Object> logInfo = genarateLogInfo(JsonKey.API_CALL, "API CALL : " + url); ProjectLogger.log( "Htt... | HttpUtil { public static HttpUtilResponse postFormData( Map<String, String> reqData, Map<String, byte[]> fileData, Map<String, String> headers, String url) throws IOException { long startTime = System.currentTimeMillis(); Map<String, Object> logInfo = genarateLogInfo(JsonKey.API_CALL, "API CALL : " + url); ProjectLogge... | HttpUtil { public static HttpUtilResponse postFormData( Map<String, String> reqData, Map<String, byte[]> fileData, Map<String, String> headers, String url) throws IOException { long startTime = System.currentTimeMillis(); Map<String, Object> logInfo = genarateLogInfo(JsonKey.API_CALL, "API CALL : " + url); ProjectLogge... | HttpUtil { public static HttpUtilResponse postFormData( Map<String, String> reqData, Map<String, byte[]> fileData, Map<String, String> headers, String url) throws IOException { long startTime = System.currentTimeMillis(); Map<String, Object> logInfo = genarateLogInfo(JsonKey.API_CALL, "API CALL : " + url); ProjectLogge... | HttpUtil { public static HttpUtilResponse postFormData( Map<String, String> reqData, Map<String, byte[]> fileData, Map<String, String> headers, String url) throws IOException { long startTime = System.currentTimeMillis(); Map<String, Object> logInfo = genarateLogInfo(JsonKey.API_CALL, "API CALL : " + url); ProjectLogge... |
@Test public void testSendPatchRequestSuccess() { Map<String, String> headers = new HashMap<>(); headers.put("Authorization", "123456"); String url = "http: try { CloseableHttpResponse closeableHttpResponseMock = PowerMockito.mock(CloseableHttpResponse.class); HttpEntity httpEntity = PowerMockito.mock(HttpEntity.class)... | public static String sendPatchRequest( String requestURL, String params, Map<String, String> headers) throws IOException { long startTime = System.currentTimeMillis(); Map<String, Object> logInfo = genarateLogInfo(JsonKey.API_CALL, "API CALL : " + requestURL); ProjectLogger.log( "HttpUtil sendPatchRequest method starte... | HttpUtil { public static String sendPatchRequest( String requestURL, String params, Map<String, String> headers) throws IOException { long startTime = System.currentTimeMillis(); Map<String, Object> logInfo = genarateLogInfo(JsonKey.API_CALL, "API CALL : " + requestURL); ProjectLogger.log( "HttpUtil sendPatchRequest me... | HttpUtil { public static String sendPatchRequest( String requestURL, String params, Map<String, String> headers) throws IOException { long startTime = System.currentTimeMillis(); Map<String, Object> logInfo = genarateLogInfo(JsonKey.API_CALL, "API CALL : " + requestURL); ProjectLogger.log( "HttpUtil sendPatchRequest me... | HttpUtil { public static String sendPatchRequest( String requestURL, String params, Map<String, String> headers) throws IOException { long startTime = System.currentTimeMillis(); Map<String, Object> logInfo = genarateLogInfo(JsonKey.API_CALL, "API CALL : " + requestURL); ProjectLogger.log( "HttpUtil sendPatchRequest me... | HttpUtil { public static String sendPatchRequest( String requestURL, String params, Map<String, String> headers) throws IOException { long startTime = System.currentTimeMillis(); Map<String, Object> logInfo = genarateLogInfo(JsonKey.API_CALL, "API CALL : " + requestURL); ProjectLogger.log( "HttpUtil sendPatchRequest me... |
@Test public void testSendPostRequestSuccess() { Map<String, String> headers = new HashMap<>(); headers.put("Authorization", "123456"); String url = "http: try { String response = HttpUtil.sendPostRequest(url, "{\"message\":\"success\"}", headers); assertTrue("{\"message\":\"success\"}".equals(response)); } catch (IOEx... | public static String sendPostRequest( String requestURL, Map<String, String> params, Map<String, String> headers) throws IOException { long startTime = System.currentTimeMillis(); Map<String, Object> logInfo = genarateLogInfo(JsonKey.API_CALL, "API CALL : " + requestURL); HttpURLConnection httpURLConnection = postReque... | HttpUtil { public static String sendPostRequest( String requestURL, Map<String, String> params, Map<String, String> headers) throws IOException { long startTime = System.currentTimeMillis(); Map<String, Object> logInfo = genarateLogInfo(JsonKey.API_CALL, "API CALL : " + requestURL); HttpURLConnection httpURLConnection ... | HttpUtil { public static String sendPostRequest( String requestURL, Map<String, String> params, Map<String, String> headers) throws IOException { long startTime = System.currentTimeMillis(); Map<String, Object> logInfo = genarateLogInfo(JsonKey.API_CALL, "API CALL : " + requestURL); HttpURLConnection httpURLConnection ... | HttpUtil { public static String sendPostRequest( String requestURL, Map<String, String> params, Map<String, String> headers) throws IOException { long startTime = System.currentTimeMillis(); Map<String, Object> logInfo = genarateLogInfo(JsonKey.API_CALL, "API CALL : " + requestURL); HttpURLConnection httpURLConnection ... | HttpUtil { public static String sendPostRequest( String requestURL, Map<String, String> params, Map<String, String> headers) throws IOException { long startTime = System.currentTimeMillis(); Map<String, Object> logInfo = genarateLogInfo(JsonKey.API_CALL, "API CALL : " + requestURL); HttpURLConnection httpURLConnection ... |
@Test public void testSendGetRequestSuccess() { Map<String, String> headers = new HashMap<>(); headers.put("Authorization", "123456"); String urlString = "http: try { String response = HttpUtil.sendGetRequest(urlString, headers); assertTrue("{\"message\":\"success\"}".equals(response)); } catch (Exception e) { ProjectL... | public static String sendGetRequest(String requestURL, Map<String, String> headers) throws IOException { long startTime = System.currentTimeMillis(); Map<String, Object> logInfo = genarateLogInfo(JsonKey.API_CALL, "API CALL : " + requestURL); HttpURLConnection httpURLConnection = getRequest(requestURL, headers, startTi... | HttpUtil { public static String sendGetRequest(String requestURL, Map<String, String> headers) throws IOException { long startTime = System.currentTimeMillis(); Map<String, Object> logInfo = genarateLogInfo(JsonKey.API_CALL, "API CALL : " + requestURL); HttpURLConnection httpURLConnection = getRequest(requestURL, heade... | HttpUtil { public static String sendGetRequest(String requestURL, Map<String, String> headers) throws IOException { long startTime = System.currentTimeMillis(); Map<String, Object> logInfo = genarateLogInfo(JsonKey.API_CALL, "API CALL : " + requestURL); HttpURLConnection httpURLConnection = getRequest(requestURL, heade... | HttpUtil { public static String sendGetRequest(String requestURL, Map<String, String> headers) throws IOException { long startTime = System.currentTimeMillis(); Map<String, Object> logInfo = genarateLogInfo(JsonKey.API_CALL, "API CALL : " + requestURL); HttpURLConnection httpURLConnection = getRequest(requestURL, heade... | HttpUtil { public static String sendGetRequest(String requestURL, Map<String, String> headers) throws IOException { long startTime = System.currentTimeMillis(); Map<String, Object> logInfo = genarateLogInfo(JsonKey.API_CALL, "API CALL : " + requestURL); HttpURLConnection httpURLConnection = getRequest(requestURL, heade... |
@Test public void compareTo() { MigrationVersion v1 = MigrationVersion.fromVersion("1"); MigrationVersion v10 = MigrationVersion.fromVersion("1.0"); MigrationVersion v11 = MigrationVersion.fromVersion("1.1"); MigrationVersion v1100 = MigrationVersion.fromVersion("1.1.0.0"); MigrationVersion v1101 = MigrationVersion.fro... | @Override public int compareTo(MigrationVersion o) { if (o == null) { return 1; } if (this == EMPTY) { return o == EMPTY ? 0 : Integer.MIN_VALUE; } if (this == CURRENT) { return o == CURRENT ? 0 : Integer.MIN_VALUE; } if (this == LATEST) { return o == LATEST ? 0 : Integer.MAX_VALUE; } if (o == EMPTY) { return Integer.M... | MigrationVersion implements Comparable<MigrationVersion> { @Override public int compareTo(MigrationVersion o) { if (o == null) { return 1; } if (this == EMPTY) { return o == EMPTY ? 0 : Integer.MIN_VALUE; } if (this == CURRENT) { return o == CURRENT ? 0 : Integer.MIN_VALUE; } if (this == LATEST) { return o == LATEST ? ... | MigrationVersion implements Comparable<MigrationVersion> { @Override public int compareTo(MigrationVersion o) { if (o == null) { return 1; } if (this == EMPTY) { return o == EMPTY ? 0 : Integer.MIN_VALUE; } if (this == CURRENT) { return o == CURRENT ? 0 : Integer.MIN_VALUE; } if (this == LATEST) { return o == LATEST ? ... | MigrationVersion implements Comparable<MigrationVersion> { @Override public int compareTo(MigrationVersion o) { if (o == null) { return 1; } if (this == EMPTY) { return o == EMPTY ? 0 : Integer.MIN_VALUE; } if (this == CURRENT) { return o == CURRENT ? 0 : Integer.MIN_VALUE; } if (this == LATEST) { return o == LATEST ? ... | MigrationVersion implements Comparable<MigrationVersion> { @Override public int compareTo(MigrationVersion o) { if (o == null) { return 1; } if (this == EMPTY) { return o == EMPTY ? 0 : Integer.MIN_VALUE; } if (this == CURRENT) { return o == CURRENT ? 0 : Integer.MIN_VALUE; } if (this == LATEST) { return o == LATEST ? ... |
@Test public void sendEmailToMultipleUser() throws MessagingException { List<String> to = new ArrayList<String>(); to.add("testmail@test.com"); to.add("test1@test.com"); emailService.sendMail(to, subject, "Test email body"); List<Message> inbox = Mailbox.get("testmail@test.com"); Assert.assertTrue(inbox.size() > 0); As... | public boolean sendMail(List<String> emailList, String subject, String body) { return sendMail(emailList, subject, body, null); } | Email { public boolean sendMail(List<String> emailList, String subject, String body) { return sendMail(emailList, subject, body, null); } } | Email { public boolean sendMail(List<String> emailList, String subject, String body) { return sendMail(emailList, subject, body, null); } Email(); Email(EmailConfig config); } | Email { public boolean sendMail(List<String> emailList, String subject, String body) { return sendMail(emailList, subject, body, null); } Email(); Email(EmailConfig config); boolean sendMail(List<String> emailList, String subject, String body); boolean sendMail(
List<String> emailList, String subject, String bod... | Email { public boolean sendMail(List<String> emailList, String subject, String body) { return sendMail(emailList, subject, body, null); } Email(); Email(EmailConfig config); boolean sendMail(List<String> emailList, String subject, String body); boolean sendMail(
List<String> emailList, String subject, String bod... |
@Test public void testGetHeaderWithInput() throws Exception { PowerMockito.mockStatic(KeycloakRequiredActionLinkUtil.class); when(KeycloakRequiredActionLinkUtil.getAdminAccessToken()).thenReturn("testAuthToken"); Map<String, String> input = new HashMap<String, String>(){{ put("x-channel-id", "test-channel"); put("x-dev... | public static Map<String, String> getHeader(Map<String, String> input) throws Exception { return new HashMap<String, String>() {{ put("Content-Type", "application/json"); put(JsonKey.X_AUTHENTICATED_USER_TOKEN, KeycloakRequiredActionLinkUtil.getAdminAccessToken()); if(MapUtils.isNotEmpty(input)) putAll(input); }}; } | HttpUtil { public static Map<String, String> getHeader(Map<String, String> input) throws Exception { return new HashMap<String, String>() {{ put("Content-Type", "application/json"); put(JsonKey.X_AUTHENTICATED_USER_TOKEN, KeycloakRequiredActionLinkUtil.getAdminAccessToken()); if(MapUtils.isNotEmpty(input)) putAll(input... | HttpUtil { public static Map<String, String> getHeader(Map<String, String> input) throws Exception { return new HashMap<String, String>() {{ put("Content-Type", "application/json"); put(JsonKey.X_AUTHENTICATED_USER_TOKEN, KeycloakRequiredActionLinkUtil.getAdminAccessToken()); if(MapUtils.isNotEmpty(input)) putAll(input... | HttpUtil { public static Map<String, String> getHeader(Map<String, String> input) throws Exception { return new HashMap<String, String>() {{ put("Content-Type", "application/json"); put(JsonKey.X_AUTHENTICATED_USER_TOKEN, KeycloakRequiredActionLinkUtil.getAdminAccessToken()); if(MapUtils.isNotEmpty(input)) putAll(input... | HttpUtil { public static Map<String, String> getHeader(Map<String, String> input) throws Exception { return new HashMap<String, String>() {{ put("Content-Type", "application/json"); put(JsonKey.X_AUTHENTICATED_USER_TOKEN, KeycloakRequiredActionLinkUtil.getAdminAccessToken()); if(MapUtils.isNotEmpty(input)) putAll(input... |
@Test public void testGetHeaderWithoutInput() throws Exception { PowerMockito.mockStatic(KeycloakRequiredActionLinkUtil.class); when(KeycloakRequiredActionLinkUtil.getAdminAccessToken()).thenReturn("testAuthToken"); Map<String, String> headers = HttpUtil.getHeader(null); assertTrue(!headers.isEmpty()); assertTrue(heade... | public static Map<String, String> getHeader(Map<String, String> input) throws Exception { return new HashMap<String, String>() {{ put("Content-Type", "application/json"); put(JsonKey.X_AUTHENTICATED_USER_TOKEN, KeycloakRequiredActionLinkUtil.getAdminAccessToken()); if(MapUtils.isNotEmpty(input)) putAll(input); }}; } | HttpUtil { public static Map<String, String> getHeader(Map<String, String> input) throws Exception { return new HashMap<String, String>() {{ put("Content-Type", "application/json"); put(JsonKey.X_AUTHENTICATED_USER_TOKEN, KeycloakRequiredActionLinkUtil.getAdminAccessToken()); if(MapUtils.isNotEmpty(input)) putAll(input... | HttpUtil { public static Map<String, String> getHeader(Map<String, String> input) throws Exception { return new HashMap<String, String>() {{ put("Content-Type", "application/json"); put(JsonKey.X_AUTHENTICATED_USER_TOKEN, KeycloakRequiredActionLinkUtil.getAdminAccessToken()); if(MapUtils.isNotEmpty(input)) putAll(input... | HttpUtil { public static Map<String, String> getHeader(Map<String, String> input) throws Exception { return new HashMap<String, String>() {{ put("Content-Type", "application/json"); put(JsonKey.X_AUTHENTICATED_USER_TOKEN, KeycloakRequiredActionLinkUtil.getAdminAccessToken()); if(MapUtils.isNotEmpty(input)) putAll(input... | HttpUtil { public static Map<String, String> getHeader(Map<String, String> input) throws Exception { return new HashMap<String, String>() {{ put("Content-Type", "application/json"); put(JsonKey.X_AUTHENTICATED_USER_TOKEN, KeycloakRequiredActionLinkUtil.getAdminAccessToken()); if(MapUtils.isNotEmpty(input)) putAll(input... |
@Test public void maskEmail() { HashMap<String, String> emailMaskExpectations = new HashMap<String, String>(){ { put("abc@gmail.com", "ab*@gmail.com"); put("abcd@yahoo.com", "ab**@yahoo.com"); put("abcdefgh@testmail.org", "abcd****@testmail.org"); } }; emailMaskExpectations.forEach((email, expectedResult) -> { assertEq... | public String maskEmail(String email) { if (email.indexOf("@") > 4) { return email.replaceAll("(^[^@]{4}|(?!^)\\G)[^@]", "$1*"); } else { return email.replaceAll("(^[^@]{2}|(?!^)\\G)[^@]", "$1*"); } } | LogMaskServiceImpl implements DataMaskingService { public String maskEmail(String email) { if (email.indexOf("@") > 4) { return email.replaceAll("(^[^@]{4}|(?!^)\\G)[^@]", "$1*"); } else { return email.replaceAll("(^[^@]{2}|(?!^)\\G)[^@]", "$1*"); } } } | LogMaskServiceImpl implements DataMaskingService { public String maskEmail(String email) { if (email.indexOf("@") > 4) { return email.replaceAll("(^[^@]{4}|(?!^)\\G)[^@]", "$1*"); } else { return email.replaceAll("(^[^@]{2}|(?!^)\\G)[^@]", "$1*"); } } } | LogMaskServiceImpl implements DataMaskingService { public String maskEmail(String email) { if (email.indexOf("@") > 4) { return email.replaceAll("(^[^@]{4}|(?!^)\\G)[^@]", "$1*"); } else { return email.replaceAll("(^[^@]{2}|(?!^)\\G)[^@]", "$1*"); } } String maskEmail(String email); String maskPhone(String phone); } | LogMaskServiceImpl implements DataMaskingService { public String maskEmail(String email) { if (email.indexOf("@") > 4) { return email.replaceAll("(^[^@]{4}|(?!^)\\G)[^@]", "$1*"); } else { return email.replaceAll("(^[^@]{2}|(?!^)\\G)[^@]", "$1*"); } } String maskEmail(String email); String maskPhone(String phone); } |
@Test public void maskPhone() { HashMap<String, String> phoneMaskExpectations = new HashMap<String, String>(){ { put("0123456789", "012345678*"); put("123-456-789", "123-456-7**"); put("123", "123"); } }; phoneMaskExpectations.forEach((phone, expectedResult) -> { assertEquals(expectedResult, logMaskService.maskPhone(ph... | public String maskPhone(String phone) { return phone.replaceAll("(^[^*]{9}|(?!^)\\G)[^*]", "$1*"); } | LogMaskServiceImpl implements DataMaskingService { public String maskPhone(String phone) { return phone.replaceAll("(^[^*]{9}|(?!^)\\G)[^*]", "$1*"); } } | LogMaskServiceImpl implements DataMaskingService { public String maskPhone(String phone) { return phone.replaceAll("(^[^*]{9}|(?!^)\\G)[^*]", "$1*"); } } | LogMaskServiceImpl implements DataMaskingService { public String maskPhone(String phone) { return phone.replaceAll("(^[^*]{9}|(?!^)\\G)[^*]", "$1*"); } String maskEmail(String email); String maskPhone(String phone); } | LogMaskServiceImpl implements DataMaskingService { public String maskPhone(String phone) { return phone.replaceAll("(^[^*]{9}|(?!^)\\G)[^*]", "$1*"); } String maskEmail(String email); String maskPhone(String phone); } |
@Test public void testUpdateRecordSuccess() { address.put(JsonKey.CITY, "city"); address.put(JsonKey.ADD_TYPE, "addrType"); when(session.execute(boundStatement)).thenReturn(resultSet); Response response = operation.updateRecord(cassandraKeySpace, "address", address); assertEquals(ResponseCode.success.getErrorCode(), re... | @Override public Response updateRecord(String keyspaceName, String tableName, Map<String, Object> request) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "Cassandra Service updateRecord method started at ==" + startTime, LoggerEnum.INFO); Response response = new Response(); try { String query = Cassa... | CassandraOperationImpl implements CassandraOperation { @Override public Response updateRecord(String keyspaceName, String tableName, Map<String, Object> request) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "Cassandra Service updateRecord method started at ==" + startTime, LoggerEnum.INFO); Respons... | CassandraOperationImpl implements CassandraOperation { @Override public Response updateRecord(String keyspaceName, String tableName, Map<String, Object> request) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "Cassandra Service updateRecord method started at ==" + startTime, LoggerEnum.INFO); Respons... | CassandraOperationImpl implements CassandraOperation { @Override public Response updateRecord(String keyspaceName, String tableName, Map<String, Object> request) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "Cassandra Service updateRecord method started at ==" + startTime, LoggerEnum.INFO); Respons... | CassandraOperationImpl implements CassandraOperation { @Override public Response updateRecord(String keyspaceName, String tableName, Map<String, Object> request) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "Cassandra Service updateRecord method started at ==" + startTime, LoggerEnum.INFO); Respons... |
@Test public void testUpdateRecordWithTTLSuccess() { when(resultSet.iterator()).thenReturn(iterator); Map<String, Object> compositeKey = new HashMap<>(); compositeKey.put(JsonKey.TYPE, JsonKey.EMAIL); compositeKey.put(JsonKey.KEY, "amit@example.com"); when(session.execute(update)).thenReturn(resultSet); Response respon... | @Override public Response updateRecordWithTTL( String keyspaceName, String tableName, Map<String, Object> request, Map<String, Object> compositeKey, int ttl) { long startTime = System.currentTimeMillis(); Session session = connectionManager.getSession(keyspaceName); Update update = QueryBuilder.update(keyspaceName, tab... | CassandraOperationImpl implements CassandraOperation { @Override public Response updateRecordWithTTL( String keyspaceName, String tableName, Map<String, Object> request, Map<String, Object> compositeKey, int ttl) { long startTime = System.currentTimeMillis(); Session session = connectionManager.getSession(keyspaceName)... | CassandraOperationImpl implements CassandraOperation { @Override public Response updateRecordWithTTL( String keyspaceName, String tableName, Map<String, Object> request, Map<String, Object> compositeKey, int ttl) { long startTime = System.currentTimeMillis(); Session session = connectionManager.getSession(keyspaceName)... | CassandraOperationImpl implements CassandraOperation { @Override public Response updateRecordWithTTL( String keyspaceName, String tableName, Map<String, Object> request, Map<String, Object> compositeKey, int ttl) { long startTime = System.currentTimeMillis(); Session session = connectionManager.getSession(keyspaceName)... | CassandraOperationImpl implements CassandraOperation { @Override public Response updateRecordWithTTL( String keyspaceName, String tableName, Map<String, Object> request, Map<String, Object> compositeKey, int ttl) { long startTime = System.currentTimeMillis(); Session session = connectionManager.getSession(keyspaceName)... |
@Test public void testEquals() { final MigrationVersion a1 = MigrationVersion.fromVersion("1.2.3.3"); final MigrationVersion a2 = MigrationVersion.fromVersion("1.2.3.3"); assertTrue(a1.compareTo(a2) == 0); assertEquals(a1.hashCode(), a2.hashCode()); } | @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; MigrationVersion version1 = (MigrationVersion) o; return compareTo(version1) == 0; } | MigrationVersion implements Comparable<MigrationVersion> { @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; MigrationVersion version1 = (MigrationVersion) o; return compareTo(version1) == 0; } } | MigrationVersion implements Comparable<MigrationVersion> { @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; MigrationVersion version1 = (MigrationVersion) o; return compareTo(version1) == 0; } MigrationVersion(BigInteger version, String d... | MigrationVersion implements Comparable<MigrationVersion> { @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; MigrationVersion version1 = (MigrationVersion) o; return compareTo(version1) == 0; } MigrationVersion(BigInteger version, String d... | MigrationVersion implements Comparable<MigrationVersion> { @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; MigrationVersion version1 = (MigrationVersion) o; return compareTo(version1) == 0; } MigrationVersion(BigInteger version, String d... |
@Test public void testUpdateRecordFailure() throws Exception { dummyAddress.put(JsonKey.CITY, "city"); dummyAddress.put(JsonKey.ADD_TYPE, "addrType"); when(session.prepare(Mockito.anyString())) .thenThrow( new ProjectCommonException( ResponseCode.dbUpdateError.getErrorCode(), ResponseCode.dbUpdateError.getErrorMessage(... | @Override public Response updateRecord(String keyspaceName, String tableName, Map<String, Object> request) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "Cassandra Service updateRecord method started at ==" + startTime, LoggerEnum.INFO); Response response = new Response(); try { String query = Cassa... | CassandraOperationImpl implements CassandraOperation { @Override public Response updateRecord(String keyspaceName, String tableName, Map<String, Object> request) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "Cassandra Service updateRecord method started at ==" + startTime, LoggerEnum.INFO); Respons... | CassandraOperationImpl implements CassandraOperation { @Override public Response updateRecord(String keyspaceName, String tableName, Map<String, Object> request) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "Cassandra Service updateRecord method started at ==" + startTime, LoggerEnum.INFO); Respons... | CassandraOperationImpl implements CassandraOperation { @Override public Response updateRecord(String keyspaceName, String tableName, Map<String, Object> request) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "Cassandra Service updateRecord method started at ==" + startTime, LoggerEnum.INFO); Respons... | CassandraOperationImpl implements CassandraOperation { @Override public Response updateRecord(String keyspaceName, String tableName, Map<String, Object> request) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "Cassandra Service updateRecord method started at ==" + startTime, LoggerEnum.INFO); Respons... |
@Test public void testUpdateRecordFailureWithInvalidProperty() throws Exception { dummyAddress.put(JsonKey.CITY, "city"); dummyAddress.put(JsonKey.ADD_TYPE, "addrType"); when(session.prepare(Mockito.anyString())) .thenThrow( new ProjectCommonException( ResponseCode.invalidPropertyError.getErrorCode(), JsonKey.UNKNOWN_I... | @Override public Response updateRecord(String keyspaceName, String tableName, Map<String, Object> request) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "Cassandra Service updateRecord method started at ==" + startTime, LoggerEnum.INFO); Response response = new Response(); try { String query = Cassa... | CassandraOperationImpl implements CassandraOperation { @Override public Response updateRecord(String keyspaceName, String tableName, Map<String, Object> request) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "Cassandra Service updateRecord method started at ==" + startTime, LoggerEnum.INFO); Respons... | CassandraOperationImpl implements CassandraOperation { @Override public Response updateRecord(String keyspaceName, String tableName, Map<String, Object> request) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "Cassandra Service updateRecord method started at ==" + startTime, LoggerEnum.INFO); Respons... | CassandraOperationImpl implements CassandraOperation { @Override public Response updateRecord(String keyspaceName, String tableName, Map<String, Object> request) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "Cassandra Service updateRecord method started at ==" + startTime, LoggerEnum.INFO); Respons... | CassandraOperationImpl implements CassandraOperation { @Override public Response updateRecord(String keyspaceName, String tableName, Map<String, Object> request) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "Cassandra Service updateRecord method started at ==" + startTime, LoggerEnum.INFO); Respons... |
@Test public void testGetAllRecordsSuccess() throws Exception { Iterator<Row> rowItr = Mockito.mock(Iterator.class); Mockito.when(resultSet.iterator()).thenReturn(rowItr); PowerMockito.whenNew(BoundStatement.class) .withArguments(Mockito.any(PreparedStatement.class)) .thenReturn(boundStatement); Response response = ope... | @Override public Response getAllRecords(String keyspaceName, String tableName) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "Cassandra Service getAllRecords method started at ==" + startTime, LoggerEnum.INFO); Response response = new Response(); try { Select selectQuery = QueryBuilder.select().all(... | CassandraOperationImpl implements CassandraOperation { @Override public Response getAllRecords(String keyspaceName, String tableName) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "Cassandra Service getAllRecords method started at ==" + startTime, LoggerEnum.INFO); Response response = new Response()... | CassandraOperationImpl implements CassandraOperation { @Override public Response getAllRecords(String keyspaceName, String tableName) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "Cassandra Service getAllRecords method started at ==" + startTime, LoggerEnum.INFO); Response response = new Response()... | CassandraOperationImpl implements CassandraOperation { @Override public Response getAllRecords(String keyspaceName, String tableName) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "Cassandra Service getAllRecords method started at ==" + startTime, LoggerEnum.INFO); Response response = new Response()... | CassandraOperationImpl implements CassandraOperation { @Override public Response getAllRecords(String keyspaceName, String tableName) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "Cassandra Service getAllRecords method started at ==" + startTime, LoggerEnum.INFO); Response response = new Response()... |
@Test public void testGetAllRecordsFailure() throws Exception { when(session.execute(selectQuery)) .thenThrow( new ProjectCommonException( ResponseCode.SERVER_ERROR.getErrorCode(), ResponseCode.SERVER_ERROR.getErrorMessage(), ResponseCode.SERVER_ERROR.getResponseCode())); List<Row> rows = new ArrayList<>(); Row row = M... | @Override public Response getAllRecords(String keyspaceName, String tableName) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "Cassandra Service getAllRecords method started at ==" + startTime, LoggerEnum.INFO); Response response = new Response(); try { Select selectQuery = QueryBuilder.select().all(... | CassandraOperationImpl implements CassandraOperation { @Override public Response getAllRecords(String keyspaceName, String tableName) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "Cassandra Service getAllRecords method started at ==" + startTime, LoggerEnum.INFO); Response response = new Response()... | CassandraOperationImpl implements CassandraOperation { @Override public Response getAllRecords(String keyspaceName, String tableName) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "Cassandra Service getAllRecords method started at ==" + startTime, LoggerEnum.INFO); Response response = new Response()... | CassandraOperationImpl implements CassandraOperation { @Override public Response getAllRecords(String keyspaceName, String tableName) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "Cassandra Service getAllRecords method started at ==" + startTime, LoggerEnum.INFO); Response response = new Response()... | CassandraOperationImpl implements CassandraOperation { @Override public Response getAllRecords(String keyspaceName, String tableName) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "Cassandra Service getAllRecords method started at ==" + startTime, LoggerEnum.INFO); Response response = new Response()... |
@Test public void testGetPropertiesValueFailureById() throws Exception { Throwable exception = null; PowerMockito.whenNew(BoundStatement.class) .withArguments(Mockito.any(PreparedStatement.class)) .thenThrow( new ProjectCommonException( ResponseCode.SERVER_ERROR.getErrorCode(), ResponseCode.SERVER_ERROR.getErrorMessage... | @Override public Response getPropertiesValueById( String keyspaceName, String tableName, String id, String... properties) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "Cassandra Service getPropertiesValueById method started at ==" + startTime, LoggerEnum.INFO); Response response = new Response(); t... | CassandraOperationImpl implements CassandraOperation { @Override public Response getPropertiesValueById( String keyspaceName, String tableName, String id, String... properties) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "Cassandra Service getPropertiesValueById method started at ==" + startTime, ... | CassandraOperationImpl implements CassandraOperation { @Override public Response getPropertiesValueById( String keyspaceName, String tableName, String id, String... properties) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "Cassandra Service getPropertiesValueById method started at ==" + startTime, ... | CassandraOperationImpl implements CassandraOperation { @Override public Response getPropertiesValueById( String keyspaceName, String tableName, String id, String... properties) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "Cassandra Service getPropertiesValueById method started at ==" + startTime, ... | CassandraOperationImpl implements CassandraOperation { @Override public Response getPropertiesValueById( String keyspaceName, String tableName, String id, String... properties) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "Cassandra Service getPropertiesValueById method started at ==" + startTime, ... |
@Test public void testGetRecordSuccessById() { Iterator<Row> rowItr = Mockito.mock(Iterator.class); Mockito.when(resultSet.iterator()).thenReturn(rowItr); when(session.execute(boundStatement.bind("123"))).thenReturn(resultSet); when(session.execute(where)).thenReturn(resultSet); when(selectBuilder.from(Mockito.anyStrin... | @Override public Response getRecordById(String keyspaceName, String tableName, String key) { return getRecordByIdentifier(keyspaceName, tableName, key, null); } | CassandraOperationImpl implements CassandraOperation { @Override public Response getRecordById(String keyspaceName, String tableName, String key) { return getRecordByIdentifier(keyspaceName, tableName, key, null); } } | CassandraOperationImpl implements CassandraOperation { @Override public Response getRecordById(String keyspaceName, String tableName, String key) { return getRecordByIdentifier(keyspaceName, tableName, key, null); } CassandraOperationImpl(); } | CassandraOperationImpl implements CassandraOperation { @Override public Response getRecordById(String keyspaceName, String tableName, String key) { return getRecordByIdentifier(keyspaceName, tableName, key, null); } CassandraOperationImpl(); @Override Response insertRecord(String keyspaceName, String tableName, Map<Str... | CassandraOperationImpl implements CassandraOperation { @Override public Response getRecordById(String keyspaceName, String tableName, String key) { return getRecordByIdentifier(keyspaceName, tableName, key, null); } CassandraOperationImpl(); @Override Response insertRecord(String keyspaceName, String tableName, Map<Str... |
@Test public void testGetRecordWithTTLById() { Select.SelectionOrAlias alias = PowerMockito.mock(Select.SelectionOrAlias.class); Select select = PowerMockito.mock(Select.class); when(selectSelection.from("sunbird", "otp")).thenReturn(select); when(select.where()).thenReturn(where); when(selectSelection.ttl("otp")).then... | @Override public Response getRecordWithTTLById( String keyspaceName, String tableName, Map<String, Object> key, List<String> ttlFields, List<String> fields) { return getRecordWithTTLByIdentifier(keyspaceName, tableName, key, ttlFields, fields); } | CassandraOperationImpl implements CassandraOperation { @Override public Response getRecordWithTTLById( String keyspaceName, String tableName, Map<String, Object> key, List<String> ttlFields, List<String> fields) { return getRecordWithTTLByIdentifier(keyspaceName, tableName, key, ttlFields, fields); } } | CassandraOperationImpl implements CassandraOperation { @Override public Response getRecordWithTTLById( String keyspaceName, String tableName, Map<String, Object> key, List<String> ttlFields, List<String> fields) { return getRecordWithTTLByIdentifier(keyspaceName, tableName, key, ttlFields, fields); } CassandraOperation... | CassandraOperationImpl implements CassandraOperation { @Override public Response getRecordWithTTLById( String keyspaceName, String tableName, Map<String, Object> key, List<String> ttlFields, List<String> fields) { return getRecordWithTTLByIdentifier(keyspaceName, tableName, key, ttlFields, fields); } CassandraOperation... | CassandraOperationImpl implements CassandraOperation { @Override public Response getRecordWithTTLById( String keyspaceName, String tableName, Map<String, Object> key, List<String> ttlFields, List<String> fields) { return getRecordWithTTLByIdentifier(keyspaceName, tableName, key, ttlFields, fields); } CassandraOperation... |
@Test public void testGetRecordFailureById() throws Exception { Throwable exception = null; PowerMockito.whenNew(BoundStatement.class) .withArguments(Mockito.any(PreparedStatement.class)) .thenThrow( new ProjectCommonException( ResponseCode.SERVER_ERROR.getErrorCode(), ResponseCode.SERVER_ERROR.getErrorMessage(), Respo... | @Override public Response getRecordById(String keyspaceName, String tableName, String key) { return getRecordByIdentifier(keyspaceName, tableName, key, null); } | CassandraOperationImpl implements CassandraOperation { @Override public Response getRecordById(String keyspaceName, String tableName, String key) { return getRecordByIdentifier(keyspaceName, tableName, key, null); } } | CassandraOperationImpl implements CassandraOperation { @Override public Response getRecordById(String keyspaceName, String tableName, String key) { return getRecordByIdentifier(keyspaceName, tableName, key, null); } CassandraOperationImpl(); } | CassandraOperationImpl implements CassandraOperation { @Override public Response getRecordById(String keyspaceName, String tableName, String key) { return getRecordByIdentifier(keyspaceName, tableName, key, null); } CassandraOperationImpl(); @Override Response insertRecord(String keyspaceName, String tableName, Map<Str... | CassandraOperationImpl implements CassandraOperation { @Override public Response getRecordById(String keyspaceName, String tableName, String key) { return getRecordByIdentifier(keyspaceName, tableName, key, null); } CassandraOperationImpl(); @Override Response insertRecord(String keyspaceName, String tableName, Map<Str... |
@Test public void testGetRecordSuccessByProperties() throws Exception { Map<String, Object> map = new HashMap<>(); map.put(JsonKey.USER_ID, "USR1"); map.put(JsonKey.ADD_TYPE, "addrType"); when(session.execute(boundStatement.bind("123"))).thenReturn(resultSet); Iterator<Row> rowItr = Mockito.mock(Iterator.class); Mockit... | @Override public Response getRecordsByProperties( String keyspaceName, String tableName, Map<String, Object> propertyMap) { return getRecordsByProperties(keyspaceName, tableName, propertyMap, null); } | CassandraOperationImpl implements CassandraOperation { @Override public Response getRecordsByProperties( String keyspaceName, String tableName, Map<String, Object> propertyMap) { return getRecordsByProperties(keyspaceName, tableName, propertyMap, null); } } | CassandraOperationImpl implements CassandraOperation { @Override public Response getRecordsByProperties( String keyspaceName, String tableName, Map<String, Object> propertyMap) { return getRecordsByProperties(keyspaceName, tableName, propertyMap, null); } CassandraOperationImpl(); } | CassandraOperationImpl implements CassandraOperation { @Override public Response getRecordsByProperties( String keyspaceName, String tableName, Map<String, Object> propertyMap) { return getRecordsByProperties(keyspaceName, tableName, propertyMap, null); } CassandraOperationImpl(); @Override Response insertRecord(String... | CassandraOperationImpl implements CassandraOperation { @Override public Response getRecordsByProperties( String keyspaceName, String tableName, Map<String, Object> propertyMap) { return getRecordsByProperties(keyspaceName, tableName, propertyMap, null); } CassandraOperationImpl(); @Override Response insertRecord(String... |
@Test public void testGetRecordFailureByProperties() throws Exception { Map<String, Object> map = new HashMap<>(); map.put(JsonKey.USER_ID, "USR1"); map.put(JsonKey.ADD_TYPE, "addrType"); List<Row> rows = new ArrayList<>(); Row row = Mockito.mock(Row.class); rows.add(row); when(resultSet.all()).thenReturn(rows); when(s... | @Override public Response getRecordsByProperties( String keyspaceName, String tableName, Map<String, Object> propertyMap) { return getRecordsByProperties(keyspaceName, tableName, propertyMap, null); } | CassandraOperationImpl implements CassandraOperation { @Override public Response getRecordsByProperties( String keyspaceName, String tableName, Map<String, Object> propertyMap) { return getRecordsByProperties(keyspaceName, tableName, propertyMap, null); } } | CassandraOperationImpl implements CassandraOperation { @Override public Response getRecordsByProperties( String keyspaceName, String tableName, Map<String, Object> propertyMap) { return getRecordsByProperties(keyspaceName, tableName, propertyMap, null); } CassandraOperationImpl(); } | CassandraOperationImpl implements CassandraOperation { @Override public Response getRecordsByProperties( String keyspaceName, String tableName, Map<String, Object> propertyMap) { return getRecordsByProperties(keyspaceName, tableName, propertyMap, null); } CassandraOperationImpl(); @Override Response insertRecord(String... | CassandraOperationImpl implements CassandraOperation { @Override public Response getRecordsByProperties( String keyspaceName, String tableName, Map<String, Object> propertyMap) { return getRecordsByProperties(keyspaceName, tableName, propertyMap, null); } CassandraOperationImpl(); @Override Response insertRecord(String... |
@Test public void empty() { assertEquals(MigrationVersion.EMPTY, MigrationVersion.EMPTY); assertTrue(MigrationVersion.EMPTY.compareTo(MigrationVersion.EMPTY) == 0); } | @Override public int compareTo(MigrationVersion o) { if (o == null) { return 1; } if (this == EMPTY) { return o == EMPTY ? 0 : Integer.MIN_VALUE; } if (this == CURRENT) { return o == CURRENT ? 0 : Integer.MIN_VALUE; } if (this == LATEST) { return o == LATEST ? 0 : Integer.MAX_VALUE; } if (o == EMPTY) { return Integer.M... | MigrationVersion implements Comparable<MigrationVersion> { @Override public int compareTo(MigrationVersion o) { if (o == null) { return 1; } if (this == EMPTY) { return o == EMPTY ? 0 : Integer.MIN_VALUE; } if (this == CURRENT) { return o == CURRENT ? 0 : Integer.MIN_VALUE; } if (this == LATEST) { return o == LATEST ? ... | MigrationVersion implements Comparable<MigrationVersion> { @Override public int compareTo(MigrationVersion o) { if (o == null) { return 1; } if (this == EMPTY) { return o == EMPTY ? 0 : Integer.MIN_VALUE; } if (this == CURRENT) { return o == CURRENT ? 0 : Integer.MIN_VALUE; } if (this == LATEST) { return o == LATEST ? ... | MigrationVersion implements Comparable<MigrationVersion> { @Override public int compareTo(MigrationVersion o) { if (o == null) { return 1; } if (this == EMPTY) { return o == EMPTY ? 0 : Integer.MIN_VALUE; } if (this == CURRENT) { return o == CURRENT ? 0 : Integer.MIN_VALUE; } if (this == LATEST) { return o == LATEST ? ... | MigrationVersion implements Comparable<MigrationVersion> { @Override public int compareTo(MigrationVersion o) { if (o == null) { return 1; } if (this == EMPTY) { return o == EMPTY ? 0 : Integer.MIN_VALUE; } if (this == CURRENT) { return o == CURRENT ? 0 : Integer.MIN_VALUE; } if (this == LATEST) { return o == LATEST ? ... |
@Test public void testGetRecordForListSuccessByProperties() throws Exception { List<Object> list = new ArrayList<>(); list.add("123"); list.add("321"); when(session.execute(boundStatement.bind("123"))).thenReturn(resultSet); Iterator<Row> rowItr = Mockito.mock(Iterator.class); Mockito.when(resultSet.iterator()).thenRet... | @Override public Response getRecordsByProperty( String keyspaceName, String tableName, String propertyName, Object propertyValue) { return getRecordsByProperty(keyspaceName, tableName, propertyName, propertyValue, null); } | CassandraOperationImpl implements CassandraOperation { @Override public Response getRecordsByProperty( String keyspaceName, String tableName, String propertyName, Object propertyValue) { return getRecordsByProperty(keyspaceName, tableName, propertyName, propertyValue, null); } } | CassandraOperationImpl implements CassandraOperation { @Override public Response getRecordsByProperty( String keyspaceName, String tableName, String propertyName, Object propertyValue) { return getRecordsByProperty(keyspaceName, tableName, propertyName, propertyValue, null); } CassandraOperationImpl(); } | CassandraOperationImpl implements CassandraOperation { @Override public Response getRecordsByProperty( String keyspaceName, String tableName, String propertyName, Object propertyValue) { return getRecordsByProperty(keyspaceName, tableName, propertyName, propertyValue, null); } CassandraOperationImpl(); @Override Respon... | CassandraOperationImpl implements CassandraOperation { @Override public Response getRecordsByProperty( String keyspaceName, String tableName, String propertyName, Object propertyValue) { return getRecordsByProperty(keyspaceName, tableName, propertyName, propertyValue, null); } CassandraOperationImpl(); @Override Respon... |
@Test public void testGetRecordForListFailreByProperties() throws Exception { List<Object> list = new ArrayList<>(); list.add("123"); list.add("321"); List<Row> rows = new ArrayList<>(); Row row = Mockito.mock(Row.class); rows.add(row); when(resultSet.all()).thenReturn(rows); when(selectSelection.all()) .thenThrow( new... | @Override public Response getRecordsByProperty( String keyspaceName, String tableName, String propertyName, Object propertyValue) { return getRecordsByProperty(keyspaceName, tableName, propertyName, propertyValue, null); } | CassandraOperationImpl implements CassandraOperation { @Override public Response getRecordsByProperty( String keyspaceName, String tableName, String propertyName, Object propertyValue) { return getRecordsByProperty(keyspaceName, tableName, propertyName, propertyValue, null); } } | CassandraOperationImpl implements CassandraOperation { @Override public Response getRecordsByProperty( String keyspaceName, String tableName, String propertyName, Object propertyValue) { return getRecordsByProperty(keyspaceName, tableName, propertyName, propertyValue, null); } CassandraOperationImpl(); } | CassandraOperationImpl implements CassandraOperation { @Override public Response getRecordsByProperty( String keyspaceName, String tableName, String propertyName, Object propertyValue) { return getRecordsByProperty(keyspaceName, tableName, propertyName, propertyValue, null); } CassandraOperationImpl(); @Override Respon... | CassandraOperationImpl implements CassandraOperation { @Override public Response getRecordsByProperty( String keyspaceName, String tableName, String propertyName, Object propertyValue) { return getRecordsByProperty(keyspaceName, tableName, propertyName, propertyValue, null); } CassandraOperationImpl(); @Override Respon... |
@Test public void testGetRecordsSuccessByProperty() throws Exception { List<Row> rows = new ArrayList<>(); Row row = Mockito.mock(Row.class); rows.add(row); when(resultSet.all()).thenReturn(rows); Iterator<Row> rowItr = Mockito.mock(Iterator.class); Mockito.when(resultSet.iterator()).thenReturn(rowItr); when(session.ex... | @Override public Response getRecordsByProperty( String keyspaceName, String tableName, String propertyName, Object propertyValue) { return getRecordsByProperty(keyspaceName, tableName, propertyName, propertyValue, null); } | CassandraOperationImpl implements CassandraOperation { @Override public Response getRecordsByProperty( String keyspaceName, String tableName, String propertyName, Object propertyValue) { return getRecordsByProperty(keyspaceName, tableName, propertyName, propertyValue, null); } } | CassandraOperationImpl implements CassandraOperation { @Override public Response getRecordsByProperty( String keyspaceName, String tableName, String propertyName, Object propertyValue) { return getRecordsByProperty(keyspaceName, tableName, propertyName, propertyValue, null); } CassandraOperationImpl(); } | CassandraOperationImpl implements CassandraOperation { @Override public Response getRecordsByProperty( String keyspaceName, String tableName, String propertyName, Object propertyValue) { return getRecordsByProperty(keyspaceName, tableName, propertyName, propertyValue, null); } CassandraOperationImpl(); @Override Respon... | CassandraOperationImpl implements CassandraOperation { @Override public Response getRecordsByProperty( String keyspaceName, String tableName, String propertyName, Object propertyValue) { return getRecordsByProperty(keyspaceName, tableName, propertyName, propertyValue, null); } CassandraOperationImpl(); @Override Respon... |
@Test public void testGetRecordsFailureByProperty() throws Exception { List<Row> rows = new ArrayList<>(); Row row = Mockito.mock(Row.class); rows.add(row); when(resultSet.all()).thenReturn(rows); when(selectSelection.all()) .thenThrow( new ProjectCommonException( ResponseCode.SERVER_ERROR.getErrorCode(), ResponseCode.... | @Override public Response getRecordsByProperty( String keyspaceName, String tableName, String propertyName, Object propertyValue) { return getRecordsByProperty(keyspaceName, tableName, propertyName, propertyValue, null); } | CassandraOperationImpl implements CassandraOperation { @Override public Response getRecordsByProperty( String keyspaceName, String tableName, String propertyName, Object propertyValue) { return getRecordsByProperty(keyspaceName, tableName, propertyName, propertyValue, null); } } | CassandraOperationImpl implements CassandraOperation { @Override public Response getRecordsByProperty( String keyspaceName, String tableName, String propertyName, Object propertyValue) { return getRecordsByProperty(keyspaceName, tableName, propertyName, propertyValue, null); } CassandraOperationImpl(); } | CassandraOperationImpl implements CassandraOperation { @Override public Response getRecordsByProperty( String keyspaceName, String tableName, String propertyName, Object propertyValue) { return getRecordsByProperty(keyspaceName, tableName, propertyName, propertyValue, null); } CassandraOperationImpl(); @Override Respon... | CassandraOperationImpl implements CassandraOperation { @Override public Response getRecordsByProperty( String keyspaceName, String tableName, String propertyName, Object propertyValue) { return getRecordsByProperty(keyspaceName, tableName, propertyName, propertyValue, null); } CassandraOperationImpl(); @Override Respon... |
@Test public void testGetRecordsSuccessById() { Iterator<Row> rowItr = Mockito.mock(Iterator.class); Mockito.when(resultSet.iterator()).thenReturn(rowItr); when(session.execute(where)).thenReturn(resultSet); when(selectSelection.all()).thenReturn(selectBuilder); Response response = operation.getRecordById(cassandraKeyS... | @Override public Response getRecordById(String keyspaceName, String tableName, String key) { return getRecordByIdentifier(keyspaceName, tableName, key, null); } | CassandraOperationImpl implements CassandraOperation { @Override public Response getRecordById(String keyspaceName, String tableName, String key) { return getRecordByIdentifier(keyspaceName, tableName, key, null); } } | CassandraOperationImpl implements CassandraOperation { @Override public Response getRecordById(String keyspaceName, String tableName, String key) { return getRecordByIdentifier(keyspaceName, tableName, key, null); } CassandraOperationImpl(); } | CassandraOperationImpl implements CassandraOperation { @Override public Response getRecordById(String keyspaceName, String tableName, String key) { return getRecordByIdentifier(keyspaceName, tableName, key, null); } CassandraOperationImpl(); @Override Response insertRecord(String keyspaceName, String tableName, Map<Str... | CassandraOperationImpl implements CassandraOperation { @Override public Response getRecordById(String keyspaceName, String tableName, String key) { return getRecordByIdentifier(keyspaceName, tableName, key, null); } CassandraOperationImpl(); @Override Response insertRecord(String keyspaceName, String tableName, Map<Str... |
@Test public void testGetRecordsFailureById() throws Exception { List<Row> rows = new ArrayList<>(); Row row = Mockito.mock(Row.class); rows.add(row); when(resultSet.all()).thenReturn(rows); when(selectSelection.all()) .thenThrow( new ProjectCommonException( ResponseCode.SERVER_ERROR.getErrorCode(), ResponseCode.SERVER... | @Override public Response getRecordById(String keyspaceName, String tableName, String key) { return getRecordByIdentifier(keyspaceName, tableName, key, null); } | CassandraOperationImpl implements CassandraOperation { @Override public Response getRecordById(String keyspaceName, String tableName, String key) { return getRecordByIdentifier(keyspaceName, tableName, key, null); } } | CassandraOperationImpl implements CassandraOperation { @Override public Response getRecordById(String keyspaceName, String tableName, String key) { return getRecordByIdentifier(keyspaceName, tableName, key, null); } CassandraOperationImpl(); } | CassandraOperationImpl implements CassandraOperation { @Override public Response getRecordById(String keyspaceName, String tableName, String key) { return getRecordByIdentifier(keyspaceName, tableName, key, null); } CassandraOperationImpl(); @Override Response insertRecord(String keyspaceName, String tableName, Map<Str... | CassandraOperationImpl implements CassandraOperation { @Override public Response getRecordById(String keyspaceName, String tableName, String key) { return getRecordByIdentifier(keyspaceName, tableName, key, null); } CassandraOperationImpl(); @Override Response insertRecord(String keyspaceName, String tableName, Map<Str... |
@Test public void testDeleteRecordSuccess() throws Exception { when(QueryBuilder.delete()).thenReturn(deleteSelection); Response response = new Response(); response.put(JsonKey.RESPONSE, Constants.SUCCESS); operation.deleteRecord(cassandraKeySpace, "address", "123"); assertEquals("SUCCESS", response.get("response")); } | @Override public Response deleteRecord(String keyspaceName, String tableName, String identifier) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "Cassandra Service deleteRecord method started at ==" + startTime, LoggerEnum.INFO); Response response = new Response(); try { Delete.Where delete = QueryBui... | CassandraOperationImpl implements CassandraOperation { @Override public Response deleteRecord(String keyspaceName, String tableName, String identifier) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "Cassandra Service deleteRecord method started at ==" + startTime, LoggerEnum.INFO); Response response... | CassandraOperationImpl implements CassandraOperation { @Override public Response deleteRecord(String keyspaceName, String tableName, String identifier) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "Cassandra Service deleteRecord method started at ==" + startTime, LoggerEnum.INFO); Response response... | CassandraOperationImpl implements CassandraOperation { @Override public Response deleteRecord(String keyspaceName, String tableName, String identifier) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "Cassandra Service deleteRecord method started at ==" + startTime, LoggerEnum.INFO); Response response... | CassandraOperationImpl implements CassandraOperation { @Override public Response deleteRecord(String keyspaceName, String tableName, String identifier) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "Cassandra Service deleteRecord method started at ==" + startTime, LoggerEnum.INFO); Response response... |
@Test public void testDeleteRecordFailure() { when(QueryBuilder.delete()) .thenThrow( new ProjectCommonException( ResponseCode.SERVER_ERROR.getErrorCode(), ResponseCode.SERVER_ERROR.getErrorMessage(), ResponseCode.SERVER_ERROR.getResponseCode())); Throwable exception = null; try { operation.deleteRecord(cassandraKeySpa... | @Override public Response deleteRecord(String keyspaceName, String tableName, String identifier) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "Cassandra Service deleteRecord method started at ==" + startTime, LoggerEnum.INFO); Response response = new Response(); try { Delete.Where delete = QueryBui... | CassandraOperationImpl implements CassandraOperation { @Override public Response deleteRecord(String keyspaceName, String tableName, String identifier) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "Cassandra Service deleteRecord method started at ==" + startTime, LoggerEnum.INFO); Response response... | CassandraOperationImpl implements CassandraOperation { @Override public Response deleteRecord(String keyspaceName, String tableName, String identifier) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "Cassandra Service deleteRecord method started at ==" + startTime, LoggerEnum.INFO); Response response... | CassandraOperationImpl implements CassandraOperation { @Override public Response deleteRecord(String keyspaceName, String tableName, String identifier) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "Cassandra Service deleteRecord method started at ==" + startTime, LoggerEnum.INFO); Response response... | CassandraOperationImpl implements CassandraOperation { @Override public Response deleteRecord(String keyspaceName, String tableName, String identifier) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "Cassandra Service deleteRecord method started at ==" + startTime, LoggerEnum.INFO); Response response... |
@Test public void latest() { assertEquals(MigrationVersion.LATEST, MigrationVersion.LATEST); assertTrue(MigrationVersion.LATEST.compareTo(MigrationVersion.LATEST) == 0); } | @Override public int compareTo(MigrationVersion o) { if (o == null) { return 1; } if (this == EMPTY) { return o == EMPTY ? 0 : Integer.MIN_VALUE; } if (this == CURRENT) { return o == CURRENT ? 0 : Integer.MIN_VALUE; } if (this == LATEST) { return o == LATEST ? 0 : Integer.MAX_VALUE; } if (o == EMPTY) { return Integer.M... | MigrationVersion implements Comparable<MigrationVersion> { @Override public int compareTo(MigrationVersion o) { if (o == null) { return 1; } if (this == EMPTY) { return o == EMPTY ? 0 : Integer.MIN_VALUE; } if (this == CURRENT) { return o == CURRENT ? 0 : Integer.MIN_VALUE; } if (this == LATEST) { return o == LATEST ? ... | MigrationVersion implements Comparable<MigrationVersion> { @Override public int compareTo(MigrationVersion o) { if (o == null) { return 1; } if (this == EMPTY) { return o == EMPTY ? 0 : Integer.MIN_VALUE; } if (this == CURRENT) { return o == CURRENT ? 0 : Integer.MIN_VALUE; } if (this == LATEST) { return o == LATEST ? ... | MigrationVersion implements Comparable<MigrationVersion> { @Override public int compareTo(MigrationVersion o) { if (o == null) { return 1; } if (this == EMPTY) { return o == EMPTY ? 0 : Integer.MIN_VALUE; } if (this == CURRENT) { return o == CURRENT ? 0 : Integer.MIN_VALUE; } if (this == LATEST) { return o == LATEST ? ... | MigrationVersion implements Comparable<MigrationVersion> { @Override public int compareTo(MigrationVersion o) { if (o == null) { return 1; } if (this == EMPTY) { return o == EMPTY ? 0 : Integer.MIN_VALUE; } if (this == CURRENT) { return o == CURRENT ? 0 : Integer.MIN_VALUE; } if (this == LATEST) { return o == LATEST ? ... |
@Test(expected = CassandraMigrationException.class) public void missingNumber() { MigrationVersion.fromVersion("1..1"); } | public static MigrationVersion fromVersion(String version) { if ("current".equalsIgnoreCase(version)) return CURRENT; if (LATEST.getVersion().equals(version)) return LATEST; if (version == null) return EMPTY; return new MigrationVersion(version); } | MigrationVersion implements Comparable<MigrationVersion> { public static MigrationVersion fromVersion(String version) { if ("current".equalsIgnoreCase(version)) return CURRENT; if (LATEST.getVersion().equals(version)) return LATEST; if (version == null) return EMPTY; return new MigrationVersion(version); } } | MigrationVersion implements Comparable<MigrationVersion> { public static MigrationVersion fromVersion(String version) { if ("current".equalsIgnoreCase(version)) return CURRENT; if (LATEST.getVersion().equals(version)) return LATEST; if (version == null) return EMPTY; return new MigrationVersion(version); } MigrationVer... | MigrationVersion implements Comparable<MigrationVersion> { public static MigrationVersion fromVersion(String version) { if ("current".equalsIgnoreCase(version)) return CURRENT; if (LATEST.getVersion().equals(version)) return LATEST; if (version == null) return EMPTY; return new MigrationVersion(version); } MigrationVer... | MigrationVersion implements Comparable<MigrationVersion> { public static MigrationVersion fromVersion(String version) { if ("current".equalsIgnoreCase(version)) return CURRENT; if (LATEST.getVersion().equals(version)) return LATEST; if (version == null) return EMPTY; return new MigrationVersion(version); } MigrationVer... |
@Test(expected = CassandraMigrationException.class) public void dot() { MigrationVersion.fromVersion("."); } | public static MigrationVersion fromVersion(String version) { if ("current".equalsIgnoreCase(version)) return CURRENT; if (LATEST.getVersion().equals(version)) return LATEST; if (version == null) return EMPTY; return new MigrationVersion(version); } | MigrationVersion implements Comparable<MigrationVersion> { public static MigrationVersion fromVersion(String version) { if ("current".equalsIgnoreCase(version)) return CURRENT; if (LATEST.getVersion().equals(version)) return LATEST; if (version == null) return EMPTY; return new MigrationVersion(version); } } | MigrationVersion implements Comparable<MigrationVersion> { public static MigrationVersion fromVersion(String version) { if ("current".equalsIgnoreCase(version)) return CURRENT; if (LATEST.getVersion().equals(version)) return LATEST; if (version == null) return EMPTY; return new MigrationVersion(version); } MigrationVer... | MigrationVersion implements Comparable<MigrationVersion> { public static MigrationVersion fromVersion(String version) { if ("current".equalsIgnoreCase(version)) return CURRENT; if (LATEST.getVersion().equals(version)) return LATEST; if (version == null) return EMPTY; return new MigrationVersion(version); } MigrationVer... | MigrationVersion implements Comparable<MigrationVersion> { public static MigrationVersion fromVersion(String version) { if ("current".equalsIgnoreCase(version)) return CURRENT; if (LATEST.getVersion().equals(version)) return LATEST; if (version == null) return EMPTY; return new MigrationVersion(version); } MigrationVer... |
@Test(expected = CassandraMigrationException.class) public void startDot() { MigrationVersion.fromVersion(".1"); } | public static MigrationVersion fromVersion(String version) { if ("current".equalsIgnoreCase(version)) return CURRENT; if (LATEST.getVersion().equals(version)) return LATEST; if (version == null) return EMPTY; return new MigrationVersion(version); } | MigrationVersion implements Comparable<MigrationVersion> { public static MigrationVersion fromVersion(String version) { if ("current".equalsIgnoreCase(version)) return CURRENT; if (LATEST.getVersion().equals(version)) return LATEST; if (version == null) return EMPTY; return new MigrationVersion(version); } } | MigrationVersion implements Comparable<MigrationVersion> { public static MigrationVersion fromVersion(String version) { if ("current".equalsIgnoreCase(version)) return CURRENT; if (LATEST.getVersion().equals(version)) return LATEST; if (version == null) return EMPTY; return new MigrationVersion(version); } MigrationVer... | MigrationVersion implements Comparable<MigrationVersion> { public static MigrationVersion fromVersion(String version) { if ("current".equalsIgnoreCase(version)) return CURRENT; if (LATEST.getVersion().equals(version)) return LATEST; if (version == null) return EMPTY; return new MigrationVersion(version); } MigrationVer... | MigrationVersion implements Comparable<MigrationVersion> { public static MigrationVersion fromVersion(String version) { if ("current".equalsIgnoreCase(version)) return CURRENT; if (LATEST.getVersion().equals(version)) return LATEST; if (version == null) return EMPTY; return new MigrationVersion(version); } MigrationVer... |
@Test(expected = CassandraMigrationException.class) public void endDot() { MigrationVersion.fromVersion("1."); } | public static MigrationVersion fromVersion(String version) { if ("current".equalsIgnoreCase(version)) return CURRENT; if (LATEST.getVersion().equals(version)) return LATEST; if (version == null) return EMPTY; return new MigrationVersion(version); } | MigrationVersion implements Comparable<MigrationVersion> { public static MigrationVersion fromVersion(String version) { if ("current".equalsIgnoreCase(version)) return CURRENT; if (LATEST.getVersion().equals(version)) return LATEST; if (version == null) return EMPTY; return new MigrationVersion(version); } } | MigrationVersion implements Comparable<MigrationVersion> { public static MigrationVersion fromVersion(String version) { if ("current".equalsIgnoreCase(version)) return CURRENT; if (LATEST.getVersion().equals(version)) return LATEST; if (version == null) return EMPTY; return new MigrationVersion(version); } MigrationVer... | MigrationVersion implements Comparable<MigrationVersion> { public static MigrationVersion fromVersion(String version) { if ("current".equalsIgnoreCase(version)) return CURRENT; if (LATEST.getVersion().equals(version)) return LATEST; if (version == null) return EMPTY; return new MigrationVersion(version); } MigrationVer... | MigrationVersion implements Comparable<MigrationVersion> { public static MigrationVersion fromVersion(String version) { if ("current".equalsIgnoreCase(version)) return CURRENT; if (LATEST.getVersion().equals(version)) return LATEST; if (version == null) return EMPTY; return new MigrationVersion(version); } MigrationVer... |
@Test(expected = CassandraMigrationException.class) public void letters() { MigrationVersion.fromVersion("abc1.0"); } | public static MigrationVersion fromVersion(String version) { if ("current".equalsIgnoreCase(version)) return CURRENT; if (LATEST.getVersion().equals(version)) return LATEST; if (version == null) return EMPTY; return new MigrationVersion(version); } | MigrationVersion implements Comparable<MigrationVersion> { public static MigrationVersion fromVersion(String version) { if ("current".equalsIgnoreCase(version)) return CURRENT; if (LATEST.getVersion().equals(version)) return LATEST; if (version == null) return EMPTY; return new MigrationVersion(version); } } | MigrationVersion implements Comparable<MigrationVersion> { public static MigrationVersion fromVersion(String version) { if ("current".equalsIgnoreCase(version)) return CURRENT; if (LATEST.getVersion().equals(version)) return LATEST; if (version == null) return EMPTY; return new MigrationVersion(version); } MigrationVer... | MigrationVersion implements Comparable<MigrationVersion> { public static MigrationVersion fromVersion(String version) { if ("current".equalsIgnoreCase(version)) return CURRENT; if (LATEST.getVersion().equals(version)) return LATEST; if (version == null) return EMPTY; return new MigrationVersion(version); } MigrationVer... | MigrationVersion implements Comparable<MigrationVersion> { public static MigrationVersion fromVersion(String version) { if ("current".equalsIgnoreCase(version)) return CURRENT; if (LATEST.getVersion().equals(version)) return LATEST; if (version == null) return EMPTY; return new MigrationVersion(version); } MigrationVer... |
@Test(expected = CassandraMigrationException.class) public void dash() { MigrationVersion.fromVersion("1.2.1-3"); } | public static MigrationVersion fromVersion(String version) { if ("current".equalsIgnoreCase(version)) return CURRENT; if (LATEST.getVersion().equals(version)) return LATEST; if (version == null) return EMPTY; return new MigrationVersion(version); } | MigrationVersion implements Comparable<MigrationVersion> { public static MigrationVersion fromVersion(String version) { if ("current".equalsIgnoreCase(version)) return CURRENT; if (LATEST.getVersion().equals(version)) return LATEST; if (version == null) return EMPTY; return new MigrationVersion(version); } } | MigrationVersion implements Comparable<MigrationVersion> { public static MigrationVersion fromVersion(String version) { if ("current".equalsIgnoreCase(version)) return CURRENT; if (LATEST.getVersion().equals(version)) return LATEST; if (version == null) return EMPTY; return new MigrationVersion(version); } MigrationVer... | MigrationVersion implements Comparable<MigrationVersion> { public static MigrationVersion fromVersion(String version) { if ("current".equalsIgnoreCase(version)) return CURRENT; if (LATEST.getVersion().equals(version)) return LATEST; if (version == null) return EMPTY; return new MigrationVersion(version); } MigrationVer... | MigrationVersion implements Comparable<MigrationVersion> { public static MigrationVersion fromVersion(String version) { if ("current".equalsIgnoreCase(version)) return CURRENT; if (LATEST.getVersion().equals(version)) return LATEST; if (version == null) return EMPTY; return new MigrationVersion(version); } MigrationVer... |
@Test(expected = CassandraMigrationException.class) public void alphaNumeric() { MigrationVersion.fromVersion("1.2.1a-3"); } | public static MigrationVersion fromVersion(String version) { if ("current".equalsIgnoreCase(version)) return CURRENT; if (LATEST.getVersion().equals(version)) return LATEST; if (version == null) return EMPTY; return new MigrationVersion(version); } | MigrationVersion implements Comparable<MigrationVersion> { public static MigrationVersion fromVersion(String version) { if ("current".equalsIgnoreCase(version)) return CURRENT; if (LATEST.getVersion().equals(version)) return LATEST; if (version == null) return EMPTY; return new MigrationVersion(version); } } | MigrationVersion implements Comparable<MigrationVersion> { public static MigrationVersion fromVersion(String version) { if ("current".equalsIgnoreCase(version)) return CURRENT; if (LATEST.getVersion().equals(version)) return LATEST; if (version == null) return EMPTY; return new MigrationVersion(version); } MigrationVer... | MigrationVersion implements Comparable<MigrationVersion> { public static MigrationVersion fromVersion(String version) { if ("current".equalsIgnoreCase(version)) return CURRENT; if (LATEST.getVersion().equals(version)) return LATEST; if (version == null) return EMPTY; return new MigrationVersion(version); } MigrationVer... | MigrationVersion implements Comparable<MigrationVersion> { public static MigrationVersion fromVersion(String version) { if ("current".equalsIgnoreCase(version)) return CURRENT; if (LATEST.getVersion().equals(version)) return LATEST; if (version == null) return EMPTY; return new MigrationVersion(version); } MigrationVer... |
@Test public void sendEmailWithCCTest() throws MessagingException { List<String> emailList = new ArrayList<String>(); emailList.add("testmail@test.com"); emailList.add("test1@test.com"); List<String> ccEmailList = new ArrayList<String>(); ccEmailList.add("testmailcc@test.com"); ccEmailList.add("test1cc@test.com"); emai... | public boolean sendMail(List<String> emailList, String subject, String body) { return sendMail(emailList, subject, body, null); } | Email { public boolean sendMail(List<String> emailList, String subject, String body) { return sendMail(emailList, subject, body, null); } } | Email { public boolean sendMail(List<String> emailList, String subject, String body) { return sendMail(emailList, subject, body, null); } Email(); Email(EmailConfig config); } | Email { public boolean sendMail(List<String> emailList, String subject, String body) { return sendMail(emailList, subject, body, null); } Email(); Email(EmailConfig config); boolean sendMail(List<String> emailList, String subject, String body); boolean sendMail(
List<String> emailList, String subject, String bod... | Email { public boolean sendMail(List<String> emailList, String subject, String body) { return sendMail(emailList, subject, body, null); } Email(); Email(EmailConfig config); boolean sendMail(List<String> emailList, String subject, String body); boolean sendMail(
List<String> emailList, String subject, String bod... |
@Test public void validate() { MigrationVersion version = MigrationVersion.fromVersion("1"); String description = "test"; String user = "testUser"; MigrationType type = MigrationType.CQL; ResolvedMigration resolvedMigration = new ResolvedMigration(); resolvedMigration.setVersion(version); resolvedMigration.setDescripti... | public String validate() { if (!context.pendingOrFuture && (resolvedMigration == null) && (appliedMigration.getType() != MigrationType.SCHEMA) && (appliedMigration.getType() != MigrationType.BASELINE)) { return "Detected applied migration not resolved locally: " + getVersion(); } if ((!context.pendingOrFuture && (Migra... | MigrationInfo implements Comparable<MigrationInfo> { public String validate() { if (!context.pendingOrFuture && (resolvedMigration == null) && (appliedMigration.getType() != MigrationType.SCHEMA) && (appliedMigration.getType() != MigrationType.BASELINE)) { return "Detected applied migration not resolved locally: " + ge... | MigrationInfo implements Comparable<MigrationInfo> { public String validate() { if (!context.pendingOrFuture && (resolvedMigration == null) && (appliedMigration.getType() != MigrationType.SCHEMA) && (appliedMigration.getType() != MigrationType.BASELINE)) { return "Detected applied migration not resolved locally: " + ge... | MigrationInfo implements Comparable<MigrationInfo> { public String validate() { if (!context.pendingOrFuture && (resolvedMigration == null) && (appliedMigration.getType() != MigrationType.SCHEMA) && (appliedMigration.getType() != MigrationType.BASELINE)) { return "Detected applied migration not resolved locally: " + ge... | MigrationInfo implements Comparable<MigrationInfo> { public String validate() { if (!context.pendingOrFuture && (resolvedMigration == null) && (appliedMigration.getType() != MigrationType.SCHEMA) && (appliedMigration.getType() != MigrationType.BASELINE)) { return "Detected applied migration not resolved locally: " + ge... |
@Test public void dumpEmpty() { String table = MigrationInfoDumper.dumpToAsciiTable(new MigrationInfo[0]); String[] lines = StringUtils.tokenizeToStringArray(table, "\n"); assertEquals(5, lines.length); for (String line : lines) { assertEquals(lines[0].length(), line.length()); } } | public static String dumpToAsciiTable(final MigrationInfo[] migrationInfos) { int versionWidth = VERSION_TITLE.length(); int descriptionWidth = DESCRIPTION_TITLE.length(); for (MigrationInfo migrationInfo : migrationInfos) { versionWidth = Math.max(versionWidth, migrationInfo.getVersion().toString().length()); descript... | MigrationInfoDumper { public static String dumpToAsciiTable(final MigrationInfo[] migrationInfos) { int versionWidth = VERSION_TITLE.length(); int descriptionWidth = DESCRIPTION_TITLE.length(); for (MigrationInfo migrationInfo : migrationInfos) { versionWidth = Math.max(versionWidth, migrationInfo.getVersion().toString... | MigrationInfoDumper { public static String dumpToAsciiTable(final MigrationInfo[] migrationInfos) { int versionWidth = VERSION_TITLE.length(); int descriptionWidth = DESCRIPTION_TITLE.length(); for (MigrationInfo migrationInfo : migrationInfos) { versionWidth = Math.max(versionWidth, migrationInfo.getVersion().toString... | MigrationInfoDumper { public static String dumpToAsciiTable(final MigrationInfo[] migrationInfos) { int versionWidth = VERSION_TITLE.length(); int descriptionWidth = DESCRIPTION_TITLE.length(); for (MigrationInfo migrationInfo : migrationInfos) { versionWidth = Math.max(versionWidth, migrationInfo.getVersion().toString... | MigrationInfoDumper { public static String dumpToAsciiTable(final MigrationInfo[] migrationInfos) { int versionWidth = VERSION_TITLE.length(); int descriptionWidth = DESCRIPTION_TITLE.length(); for (MigrationInfo migrationInfo : migrationInfos) { versionWidth = Math.max(versionWidth, migrationInfo.getVersion().toString... |
@Test public void dump2pending() { MigrationInfoService migrationInfoService = new MigrationInfoService( createMigrationResolver( createAvailableMigration("1"), createAvailableMigration("2.2014.09.11.55.45613")), createSchemaVersionDAO(), MigrationVersion.LATEST, false, true); migrationInfoService.refresh(); String tab... | public static String dumpToAsciiTable(final MigrationInfo[] migrationInfos) { int versionWidth = VERSION_TITLE.length(); int descriptionWidth = DESCRIPTION_TITLE.length(); for (MigrationInfo migrationInfo : migrationInfos) { versionWidth = Math.max(versionWidth, migrationInfo.getVersion().toString().length()); descript... | MigrationInfoDumper { public static String dumpToAsciiTable(final MigrationInfo[] migrationInfos) { int versionWidth = VERSION_TITLE.length(); int descriptionWidth = DESCRIPTION_TITLE.length(); for (MigrationInfo migrationInfo : migrationInfos) { versionWidth = Math.max(versionWidth, migrationInfo.getVersion().toString... | MigrationInfoDumper { public static String dumpToAsciiTable(final MigrationInfo[] migrationInfos) { int versionWidth = VERSION_TITLE.length(); int descriptionWidth = DESCRIPTION_TITLE.length(); for (MigrationInfo migrationInfo : migrationInfos) { versionWidth = Math.max(versionWidth, migrationInfo.getVersion().toString... | MigrationInfoDumper { public static String dumpToAsciiTable(final MigrationInfo[] migrationInfos) { int versionWidth = VERSION_TITLE.length(); int descriptionWidth = DESCRIPTION_TITLE.length(); for (MigrationInfo migrationInfo : migrationInfos) { versionWidth = Math.max(versionWidth, migrationInfo.getVersion().toString... | MigrationInfoDumper { public static String dumpToAsciiTable(final MigrationInfo[] migrationInfos) { int versionWidth = VERSION_TITLE.length(); int descriptionWidth = DESCRIPTION_TITLE.length(); for (MigrationInfo migrationInfo : migrationInfos) { versionWidth = Math.max(versionWidth, migrationInfo.getVersion().toString... |
@Test public void shouldDefaultToNoKeyspaceButCanBeOverridden() { assertThat(new Keyspace().getName(), is(nullValue())); System.setProperty(Keyspace.KeyspaceProperty.NAME.getName(), "myspace"); assertThat(new Keyspace().getName(), is("myspace")); } | public String getName() { return name; } | Keyspace { public String getName() { return name; } } | Keyspace { public String getName() { return name; } Keyspace(); } | Keyspace { public String getName() { return name; } Keyspace(); Cluster getCluster(); void setCluster(Cluster cluster); String getName(); void setName(String name); } | Keyspace { public String getName() { return name; } Keyspace(); Cluster getCluster(); void setCluster(Cluster cluster); String getName(); void setName(String name); } |
@Test public void shouldHaveDefaultClusterObject() { assertThat(new Keyspace().getCluster(), is(notNullValue())); } | public Cluster getCluster() { return cluster; } | Keyspace { public Cluster getCluster() { return cluster; } } | Keyspace { public Cluster getCluster() { return cluster; } Keyspace(); } | Keyspace { public Cluster getCluster() { return cluster; } Keyspace(); Cluster getCluster(); void setCluster(Cluster cluster); String getName(); void setName(String name); } | Keyspace { public Cluster getCluster() { return cluster; } Keyspace(); Cluster getCluster(); void setCluster(Cluster cluster); String getName(); void setName(String name); } |
@Test public void mergeLocations() { ScriptsLocations locations = new ScriptsLocations("db/locations", "db/files", "db/classes"); List<ScriptsLocation> locationList = locations.getLocations(); assertEquals(3, locationList.size()); Iterator<ScriptsLocation> iterator = locationList.iterator(); assertEquals("db/classes", ... | public List<ScriptsLocation> getLocations() { return locations; } | ScriptsLocations { public List<ScriptsLocation> getLocations() { return locations; } } | ScriptsLocations { public List<ScriptsLocation> getLocations() { return locations; } ScriptsLocations(String... rawLocations); } | ScriptsLocations { public List<ScriptsLocation> getLocations() { return locations; } ScriptsLocations(String... rawLocations); List<ScriptsLocation> getLocations(); } | ScriptsLocations { public List<ScriptsLocation> getLocations() { return locations; } ScriptsLocations(String... rawLocations); List<ScriptsLocation> getLocations(); } |
@Test public void mergeLocationsDuplicate() { ScriptsLocations locations = new ScriptsLocations("db/locations", "db/migration", "db/migration"); List<ScriptsLocation> locationList = locations.getLocations(); assertEquals(2, locationList.size()); Iterator<ScriptsLocation> iterator = locationList.iterator(); assertEquals... | public List<ScriptsLocation> getLocations() { return locations; } | ScriptsLocations { public List<ScriptsLocation> getLocations() { return locations; } } | ScriptsLocations { public List<ScriptsLocation> getLocations() { return locations; } ScriptsLocations(String... rawLocations); } | ScriptsLocations { public List<ScriptsLocation> getLocations() { return locations; } ScriptsLocations(String... rawLocations); List<ScriptsLocation> getLocations(); } | ScriptsLocations { public List<ScriptsLocation> getLocations() { return locations; } ScriptsLocations(String... rawLocations); List<ScriptsLocation> getLocations(); } |
@Test public void mergeLocationsOverlap() { ScriptsLocations locations = new ScriptsLocations("db/migration/oracle", "db/migration", "db/migration"); List<ScriptsLocation> locationList = locations.getLocations(); assertEquals(1, locationList.size()); assertEquals("db/migration", locationList.get(0).getPath()); } | public List<ScriptsLocation> getLocations() { return locations; } | ScriptsLocations { public List<ScriptsLocation> getLocations() { return locations; } } | ScriptsLocations { public List<ScriptsLocation> getLocations() { return locations; } ScriptsLocations(String... rawLocations); } | ScriptsLocations { public List<ScriptsLocation> getLocations() { return locations; } ScriptsLocations(String... rawLocations); List<ScriptsLocation> getLocations(); } | ScriptsLocations { public List<ScriptsLocation> getLocations() { return locations; } ScriptsLocations(String... rawLocations); List<ScriptsLocation> getLocations(); } |
@Test public void mergeLocationsSimilarButNoOverlap() { ScriptsLocations locations = new ScriptsLocations("db/migration/oracle", "db/migration", "db/migrationtest"); List<ScriptsLocation> locationList = locations.getLocations(); assertEquals(2, locationList.size()); assertTrue(locationList.contains(new ScriptsLocation(... | public List<ScriptsLocation> getLocations() { return locations; } | ScriptsLocations { public List<ScriptsLocation> getLocations() { return locations; } } | ScriptsLocations { public List<ScriptsLocation> getLocations() { return locations; } ScriptsLocations(String... rawLocations); } | ScriptsLocations { public List<ScriptsLocation> getLocations() { return locations; } ScriptsLocations(String... rawLocations); List<ScriptsLocation> getLocations(); } | ScriptsLocations { public List<ScriptsLocation> getLocations() { return locations; } ScriptsLocations(String... rawLocations); List<ScriptsLocation> getLocations(); } |
@Test public void mergeLocationsSimilarButNoOverlapCamelCase() { ScriptsLocations locations = new ScriptsLocations("/com/xxx/Star/", "/com/xxx/StarTrack/"); List<ScriptsLocation> locationList = locations.getLocations(); assertEquals(2, locationList.size()); assertTrue(locationList.contains(new ScriptsLocation("com/xxx/... | public List<ScriptsLocation> getLocations() { return locations; } | ScriptsLocations { public List<ScriptsLocation> getLocations() { return locations; } } | ScriptsLocations { public List<ScriptsLocation> getLocations() { return locations; } ScriptsLocations(String... rawLocations); } | ScriptsLocations { public List<ScriptsLocation> getLocations() { return locations; } ScriptsLocations(String... rawLocations); List<ScriptsLocation> getLocations(); } | ScriptsLocations { public List<ScriptsLocation> getLocations() { return locations; } ScriptsLocations(String... rawLocations); List<ScriptsLocation> getLocations(); } |
@Test public void sendEmailTOBCC() throws MessagingException{ List<String> bcc = new ArrayList<String>(); bcc.add("testmail@test.com"); emailService.sendEmail("testgamil@gmail.com", subject, "Bcc email test body", bcc); List<Message> inbox = Mailbox.get("testmail@test.com"); Assert.assertTrue(inbox.size() > 0); Assert.... | public boolean sendEmail(String fromEmail, String subject, String body, List<String> bccList) { boolean sentStatus = true; try { Session session = getSession(); MimeMessage message = new MimeMessage(session); addRecipient(message, Message.RecipientType.BCC, bccList); setMessageAttribute(message, fromEmail, subject, bod... | Email { public boolean sendEmail(String fromEmail, String subject, String body, List<String> bccList) { boolean sentStatus = true; try { Session session = getSession(); MimeMessage message = new MimeMessage(session); addRecipient(message, Message.RecipientType.BCC, bccList); setMessageAttribute(message, fromEmail, subj... | Email { public boolean sendEmail(String fromEmail, String subject, String body, List<String> bccList) { boolean sentStatus = true; try { Session session = getSession(); MimeMessage message = new MimeMessage(session); addRecipient(message, Message.RecipientType.BCC, bccList); setMessageAttribute(message, fromEmail, subj... | Email { public boolean sendEmail(String fromEmail, String subject, String body, List<String> bccList) { boolean sentStatus = true; try { Session session = getSession(); MimeMessage message = new MimeMessage(session); addRecipient(message, Message.RecipientType.BCC, bccList); setMessageAttribute(message, fromEmail, subj... | Email { public boolean sendEmail(String fromEmail, String subject, String body, List<String> bccList) { boolean sentStatus = true; try { Session session = getSession(); MimeMessage message = new MimeMessage(session); addRecipient(message, Message.RecipientType.BCC, bccList); setMessageAttribute(message, fromEmail, subj... |
@Test public void mergeLocationsSimilarButNoOverlapHyphen() { ScriptsLocations locations = new ScriptsLocations("db/migration/oracle", "db/migration", "db/migration-test"); List<ScriptsLocation> locationList = locations.getLocations(); assertEquals(2, locationList.size()); assertTrue(locationList.contains(new ScriptsLo... | public List<ScriptsLocation> getLocations() { return locations; } | ScriptsLocations { public List<ScriptsLocation> getLocations() { return locations; } } | ScriptsLocations { public List<ScriptsLocation> getLocations() { return locations; } ScriptsLocations(String... rawLocations); } | ScriptsLocations { public List<ScriptsLocation> getLocations() { return locations; } ScriptsLocations(String... rawLocations); List<ScriptsLocation> getLocations(); } | ScriptsLocations { public List<ScriptsLocation> getLocations() { return locations; } ScriptsLocations(String... rawLocations); List<ScriptsLocation> getLocations(); } |
@Test public void trimOrPad() { assertEquals("Hello World ", StringUtils.trimOrPad("Hello World", 15)); assertEquals("Hello Worl", StringUtils.trimOrPad("Hello World", 10)); assertEquals(" ", StringUtils.trimOrPad(null, 10)); } | public static String trimOrPad(String str, int length) { return trimOrPad(str, length, ' '); } | StringUtils { public static String trimOrPad(String str, int length) { return trimOrPad(str, length, ' '); } } | StringUtils { public static String trimOrPad(String str, int length) { return trimOrPad(str, length, ' '); } private StringUtils(); } | StringUtils { public static String trimOrPad(String str, int length) { return trimOrPad(str, length, ' '); } private StringUtils(); static String trimOrPad(String str, int length); static String trimOrPad(String str, int length, char padChar); static boolean isNumeric(String str); static String collapseWhitespace(Stri... | StringUtils { public static String trimOrPad(String str, int length) { return trimOrPad(str, length, ' '); } private StringUtils(); static String trimOrPad(String str, int length); static String trimOrPad(String str, int length, char padChar); static boolean isNumeric(String str); static String collapseWhitespace(Stri... |
@Test public void isNumeric() { assertFalse(StringUtils.isNumeric(null)); assertTrue(StringUtils.isNumeric("")); assertFalse(StringUtils.isNumeric(" ")); assertTrue(StringUtils.isNumeric("123")); assertFalse(StringUtils.isNumeric("12 3")); assertFalse(StringUtils.isNumeric("ab2c")); assertFalse(StringUtils.isNumeric("1... | public static boolean isNumeric(String str) { return str != null && str.matches("\\d*"); } | StringUtils { public static boolean isNumeric(String str) { return str != null && str.matches("\\d*"); } } | StringUtils { public static boolean isNumeric(String str) { return str != null && str.matches("\\d*"); } private StringUtils(); } | StringUtils { public static boolean isNumeric(String str) { return str != null && str.matches("\\d*"); } private StringUtils(); static String trimOrPad(String str, int length); static String trimOrPad(String str, int length, char padChar); static boolean isNumeric(String str); static String collapseWhitespace(String s... | StringUtils { public static boolean isNumeric(String str) { return str != null && str.matches("\\d*"); } private StringUtils(); static String trimOrPad(String str, int length); static String trimOrPad(String str, int length, char padChar); static boolean isNumeric(String str); static String collapseWhitespace(String s... |
@Test public void collapseWhitespace() { assertEquals("", StringUtils.collapseWhitespace("")); assertEquals("abc", StringUtils.collapseWhitespace("abc")); assertEquals("a b", StringUtils.collapseWhitespace("a b")); assertEquals(" a ", StringUtils.collapseWhitespace(" a ")); assertEquals(" a ", StringUtils.collapseWhite... | public static String collapseWhitespace(String str) { return str.replaceAll("\\s+", " "); } | StringUtils { public static String collapseWhitespace(String str) { return str.replaceAll("\\s+", " "); } } | StringUtils { public static String collapseWhitespace(String str) { return str.replaceAll("\\s+", " "); } private StringUtils(); } | StringUtils { public static String collapseWhitespace(String str) { return str.replaceAll("\\s+", " "); } private StringUtils(); static String trimOrPad(String str, int length); static String trimOrPad(String str, int length, char padChar); static boolean isNumeric(String str); static String collapseWhitespace(String ... | StringUtils { public static String collapseWhitespace(String str) { return str.replaceAll("\\s+", " "); } private StringUtils(); static String trimOrPad(String str, int length); static String trimOrPad(String str, int length, char padChar); static boolean isNumeric(String str); static String collapseWhitespace(String ... |
@Test public void tokenizeToStringArray() { assertArrayEquals(new String[] {"abc"}, StringUtils.tokenizeToStringArray("abc", ",")); assertArrayEquals( new String[] {"abc", "def"}, StringUtils.tokenizeToStringArray("abc,def", ",")); assertArrayEquals( new String[] {"abc", "def"}, StringUtils.tokenizeToStringArray(" abc ... | public static String[] tokenizeToStringArray(String str, String delimiters) { if (str == null) { return null; } String[] tokens = str.split("[" + delimiters + "]"); for (int i = 0; i < tokens.length; i++) { tokens[i] = tokens[i].trim(); } return tokens; } | StringUtils { public static String[] tokenizeToStringArray(String str, String delimiters) { if (str == null) { return null; } String[] tokens = str.split("[" + delimiters + "]"); for (int i = 0; i < tokens.length; i++) { tokens[i] = tokens[i].trim(); } return tokens; } } | StringUtils { public static String[] tokenizeToStringArray(String str, String delimiters) { if (str == null) { return null; } String[] tokens = str.split("[" + delimiters + "]"); for (int i = 0; i < tokens.length; i++) { tokens[i] = tokens[i].trim(); } return tokens; } private StringUtils(); } | StringUtils { public static String[] tokenizeToStringArray(String str, String delimiters) { if (str == null) { return null; } String[] tokens = str.split("[" + delimiters + "]"); for (int i = 0; i < tokens.length; i++) { tokens[i] = tokens[i].trim(); } return tokens; } private StringUtils(); static String trimOrPad(St... | StringUtils { public static String[] tokenizeToStringArray(String str, String delimiters) { if (str == null) { return null; } String[] tokens = str.split("[" + delimiters + "]"); for (int i = 0; i < tokens.length; i++) { tokens[i] = tokens[i].trim(); } return tokens; } private StringUtils(); static String trimOrPad(St... |
@Test public void isPresent() { assertTrue( ClassUtils.isPresent( "com.contrastsecurity.cassandra.migration.CassandraMigration", Thread.currentThread().getContextClassLoader())); } | public static boolean isPresent(String className, ClassLoader classLoader) { try { classLoader.loadClass(className); return true; } catch (Throwable ex) { return false; } } | ClassUtils { public static boolean isPresent(String className, ClassLoader classLoader) { try { classLoader.loadClass(className); return true; } catch (Throwable ex) { return false; } } } | ClassUtils { public static boolean isPresent(String className, ClassLoader classLoader) { try { classLoader.loadClass(className); return true; } catch (Throwable ex) { return false; } } private ClassUtils(); } | ClassUtils { public static boolean isPresent(String className, ClassLoader classLoader) { try { classLoader.loadClass(className); return true; } catch (Throwable ex) { return false; } } private ClassUtils(); @SuppressWarnings({"unchecked"}) // Must be synchronized for the Maven Parallel Junit runner to work static syn... | ClassUtils { public static boolean isPresent(String className, ClassLoader classLoader) { try { classLoader.loadClass(className); return true; } catch (Throwable ex) { return false; } } private ClassUtils(); @SuppressWarnings({"unchecked"}) // Must be synchronized for the Maven Parallel Junit runner to work static syn... |
@Test public void isPresentNot() { assertFalse( ClassUtils.isPresent( "com.example.FakeClass", Thread.currentThread().getContextClassLoader())); } | public static boolean isPresent(String className, ClassLoader classLoader) { try { classLoader.loadClass(className); return true; } catch (Throwable ex) { return false; } } | ClassUtils { public static boolean isPresent(String className, ClassLoader classLoader) { try { classLoader.loadClass(className); return true; } catch (Throwable ex) { return false; } } } | ClassUtils { public static boolean isPresent(String className, ClassLoader classLoader) { try { classLoader.loadClass(className); return true; } catch (Throwable ex) { return false; } } private ClassUtils(); } | ClassUtils { public static boolean isPresent(String className, ClassLoader classLoader) { try { classLoader.loadClass(className); return true; } catch (Throwable ex) { return false; } } private ClassUtils(); @SuppressWarnings({"unchecked"}) // Must be synchronized for the Maven Parallel Junit runner to work static syn... | ClassUtils { public static boolean isPresent(String className, ClassLoader classLoader) { try { classLoader.loadClass(className); return true; } catch (Throwable ex) { return false; } } private ClassUtils(); @SuppressWarnings({"unchecked"}) // Must be synchronized for the Maven Parallel Junit runner to work static syn... |
@Test public void shouldDetectSlf4j() { assertThat( new FeatureDetector(Thread.currentThread().getContextClassLoader()).isSlf4jAvailable(), is(true)); } | public boolean isSlf4jAvailable() { if (slf4jAvailable == null) { slf4jAvailable = isPresent("org.slf4j.Logger", classLoader); } return slf4jAvailable; } | FeatureDetector { public boolean isSlf4jAvailable() { if (slf4jAvailable == null) { slf4jAvailable = isPresent("org.slf4j.Logger", classLoader); } return slf4jAvailable; } } | FeatureDetector { public boolean isSlf4jAvailable() { if (slf4jAvailable == null) { slf4jAvailable = isPresent("org.slf4j.Logger", classLoader); } return slf4jAvailable; } FeatureDetector(ClassLoader classLoader); } | FeatureDetector { public boolean isSlf4jAvailable() { if (slf4jAvailable == null) { slf4jAvailable = isPresent("org.slf4j.Logger", classLoader); } return slf4jAvailable; } FeatureDetector(ClassLoader classLoader); boolean isApacheCommonsLoggingAvailable(); boolean isSlf4jAvailable(); } | FeatureDetector { public boolean isSlf4jAvailable() { if (slf4jAvailable == null) { slf4jAvailable = isPresent("org.slf4j.Logger", classLoader); } return slf4jAvailable; } FeatureDetector(ClassLoader classLoader); boolean isApacheCommonsLoggingAvailable(); boolean isSlf4jAvailable(); } |
@Test public void shouldDetectCommonsLogging() { assertThat( new FeatureDetector(Thread.currentThread().getContextClassLoader()) .isApacheCommonsLoggingAvailable(), is(true)); } | public boolean isApacheCommonsLoggingAvailable() { if (apacheCommonsLoggingAvailable == null) { apacheCommonsLoggingAvailable = isPresent("org.apache.commons.logging.Log", classLoader); } return apacheCommonsLoggingAvailable; } | FeatureDetector { public boolean isApacheCommonsLoggingAvailable() { if (apacheCommonsLoggingAvailable == null) { apacheCommonsLoggingAvailable = isPresent("org.apache.commons.logging.Log", classLoader); } return apacheCommonsLoggingAvailable; } } | FeatureDetector { public boolean isApacheCommonsLoggingAvailable() { if (apacheCommonsLoggingAvailable == null) { apacheCommonsLoggingAvailable = isPresent("org.apache.commons.logging.Log", classLoader); } return apacheCommonsLoggingAvailable; } FeatureDetector(ClassLoader classLoader); } | FeatureDetector { public boolean isApacheCommonsLoggingAvailable() { if (apacheCommonsLoggingAvailable == null) { apacheCommonsLoggingAvailable = isPresent("org.apache.commons.logging.Log", classLoader); } return apacheCommonsLoggingAvailable; } FeatureDetector(ClassLoader classLoader); boolean isApacheCommonsLoggingAv... | FeatureDetector { public boolean isApacheCommonsLoggingAvailable() { if (apacheCommonsLoggingAvailable == null) { apacheCommonsLoggingAvailable = isPresent("org.apache.commons.logging.Log", classLoader); } return apacheCommonsLoggingAvailable; } FeatureDetector(ClassLoader classLoader); boolean isApacheCommonsLoggingAv... |
@Test public void format() { assertEquals("00:00.001s", TimeFormat.format(1)); assertEquals("00:00.012s", TimeFormat.format(12)); assertEquals("00:00.123s", TimeFormat.format(123)); assertEquals("00:01.234s", TimeFormat.format(1234)); assertEquals("00:12.345s", TimeFormat.format(12345)); assertEquals("01:23.456s", Time... | public static String format(long millis) { return String.format( "%02d:%02d.%03ds", millis / 60000, (millis % 60000) / 1000, (millis % 1000)); } | TimeFormat { public static String format(long millis) { return String.format( "%02d:%02d.%03ds", millis / 60000, (millis % 60000) / 1000, (millis % 1000)); } } | TimeFormat { public static String format(long millis) { return String.format( "%02d:%02d.%03ds", millis / 60000, (millis % 60000) / 1000, (millis % 1000)); } private TimeFormat(); } | TimeFormat { public static String format(long millis) { return String.format( "%02d:%02d.%03ds", millis / 60000, (millis % 60000) / 1000, (millis % 1000)); } private TimeFormat(); static String format(long millis); } | TimeFormat { public static String format(long millis) { return String.format( "%02d:%02d.%03ds", millis / 60000, (millis % 60000) / 1000, (millis % 1000)); } private TimeFormat(); static String format(long millis); } |
@Test public void sendEmailWithAttachmentTest() throws MessagingException { List<String> to = new ArrayList<String>(); to.add("testmail@test.com"); to.add("test1@test.com"); emailService.sendAttachment(to, "Test email as attached.", subject, "emailtemplate.vm"); List<Message> inbox = Mailbox.get("testmail@test.com"); A... | public void sendAttachment( List<String> emailList, String emailBody, String subject, String filePath) { try { Session session = getSession(); MimeMessage message = new MimeMessage(session); addRecipient(message, Message.RecipientType.TO, emailList); message.setSubject(subject); Multipart multipart = createMultipartDat... | Email { public void sendAttachment( List<String> emailList, String emailBody, String subject, String filePath) { try { Session session = getSession(); MimeMessage message = new MimeMessage(session); addRecipient(message, Message.RecipientType.TO, emailList); message.setSubject(subject); Multipart multipart = createMult... | Email { public void sendAttachment( List<String> emailList, String emailBody, String subject, String filePath) { try { Session session = getSession(); MimeMessage message = new MimeMessage(session); addRecipient(message, Message.RecipientType.TO, emailList); message.setSubject(subject); Multipart multipart = createMult... | Email { public void sendAttachment( List<String> emailList, String emailBody, String subject, String filePath) { try { Session session = getSession(); MimeMessage message = new MimeMessage(session); addRecipient(message, Message.RecipientType.TO, emailList); message.setSubject(subject); Multipart multipart = createMult... | Email { public void sendAttachment( List<String> emailList, String emailBody, String subject, String filePath) { try { Session session = getSession(); MimeMessage message = new MimeMessage(session); addRecipient(message, Message.RecipientType.TO, emailList); message.setSubject(subject); Multipart multipart = createMult... |
@Test public void getFilename() throws Exception { assertEquals("Mig777__Test.cql", new FileSystemResource("Mig777__Test.cql").getFilename()); assertEquals( "Mig777__Test.cql", new FileSystemResource("folder/Mig777__Test.cql").getFilename()); } | public String getFilename() { return location.getName(); } | FileSystemResource implements Resource, Comparable<FileSystemResource> { public String getFilename() { return location.getName(); } } | FileSystemResource implements Resource, Comparable<FileSystemResource> { public String getFilename() { return location.getName(); } FileSystemResource(String location); } | FileSystemResource implements Resource, Comparable<FileSystemResource> { public String getFilename() { return location.getName(); } FileSystemResource(String location); String getLocation(); String getLocationOnDisk(); String loadAsString(String encoding); byte[] loadAsBytes(); String getFilename(); @SuppressWarnings("... | FileSystemResource implements Resource, Comparable<FileSystemResource> { public String getFilename() { return location.getName(); } FileSystemResource(String location); String getLocation(); String getLocationOnDisk(); String loadAsString(String encoding); byte[] loadAsBytes(); String getFilename(); @SuppressWarnings("... |
@Test public void getPath() throws Exception { assertEquals("Mig777__Test.cql", new FileSystemResource("Mig777__Test.cql").getLocation()); assertEquals( "folder/Mig777__Test.cql", new FileSystemResource("folder/Mig777__Test.cql").getLocation()); } | public String getLocation() { return StringUtils.replaceAll(location.getPath(), "\\", "/"); } | FileSystemResource implements Resource, Comparable<FileSystemResource> { public String getLocation() { return StringUtils.replaceAll(location.getPath(), "\\", "/"); } } | FileSystemResource implements Resource, Comparable<FileSystemResource> { public String getLocation() { return StringUtils.replaceAll(location.getPath(), "\\", "/"); } FileSystemResource(String location); } | FileSystemResource implements Resource, Comparable<FileSystemResource> { public String getLocation() { return StringUtils.replaceAll(location.getPath(), "\\", "/"); } FileSystemResource(String location); String getLocation(); String getLocationOnDisk(); String loadAsString(String encoding); byte[] loadAsBytes(); String... | FileSystemResource implements Resource, Comparable<FileSystemResource> { public String getLocation() { return StringUtils.replaceAll(location.getPath(), "\\", "/"); } FileSystemResource(String location); String getLocation(); String getLocationOnDisk(); String loadAsString(String encoding); byte[] loadAsBytes(); String... |
@Test public void getFilename() throws Exception { assertEquals( "Mig777__Test.cql", new ClassPathResource("Mig777__Test.cql", Thread.currentThread().getContextClassLoader()) .getFilename()); assertEquals( "Mig777__Test.cql", new ClassPathResource( "folder/Mig777__Test.cql", Thread.currentThread().getContextClassLoader... | public String getFilename() { return location.substring(location.lastIndexOf("/") + 1); } | ClassPathResource implements Comparable<ClassPathResource>, Resource { public String getFilename() { return location.substring(location.lastIndexOf("/") + 1); } } | ClassPathResource implements Comparable<ClassPathResource>, Resource { public String getFilename() { return location.substring(location.lastIndexOf("/") + 1); } ClassPathResource(String location, ClassLoader classLoader); } | ClassPathResource implements Comparable<ClassPathResource>, Resource { public String getFilename() { return location.substring(location.lastIndexOf("/") + 1); } ClassPathResource(String location, ClassLoader classLoader); String getLocation(); String getLocationOnDisk(); String loadAsString(String encoding); byte[] loa... | ClassPathResource implements Comparable<ClassPathResource>, Resource { public String getFilename() { return location.substring(location.lastIndexOf("/") + 1); } ClassPathResource(String location, ClassLoader classLoader); String getLocation(); String getLocationOnDisk(); String loadAsString(String encoding); byte[] loa... |
@Test public void loadAsStringUtf8WithoutBOM() { assertEquals( "SELECT * FROM contents;", new ClassPathResource( "com/contrastsecurity/cassandra/migration/utils/scanner/classpath/utf8.nofilter", Thread.currentThread().getContextClassLoader()) .loadAsString("UTF-8")); } | public String loadAsString(String encoding) { try { InputStream inputStream = classLoader.getResourceAsStream(location); if (inputStream == null) { throw new CassandraMigrationException( "Unable to obtain inputstream for resource: " + location); } Reader reader = new InputStreamReader(inputStream, Charset.forName(encod... | ClassPathResource implements Comparable<ClassPathResource>, Resource { public String loadAsString(String encoding) { try { InputStream inputStream = classLoader.getResourceAsStream(location); if (inputStream == null) { throw new CassandraMigrationException( "Unable to obtain inputstream for resource: " + location); } R... | ClassPathResource implements Comparable<ClassPathResource>, Resource { public String loadAsString(String encoding) { try { InputStream inputStream = classLoader.getResourceAsStream(location); if (inputStream == null) { throw new CassandraMigrationException( "Unable to obtain inputstream for resource: " + location); } R... | ClassPathResource implements Comparable<ClassPathResource>, Resource { public String loadAsString(String encoding) { try { InputStream inputStream = classLoader.getResourceAsStream(location); if (inputStream == null) { throw new CassandraMigrationException( "Unable to obtain inputstream for resource: " + location); } R... | ClassPathResource implements Comparable<ClassPathResource>, Resource { public String loadAsString(String encoding) { try { InputStream inputStream = classLoader.getResourceAsStream(location); if (inputStream == null) { throw new CassandraMigrationException( "Unable to obtain inputstream for resource: " + location); } R... |
@Test public void loadAsStringUtf8WithBOM() { assertEquals( "SELECT * FROM contents;", new ClassPathResource( "com/contrastsecurity/cassandra/migration/utils/scanner/classpath/utf8bom.nofilter", Thread.currentThread().getContextClassLoader()) .loadAsString("UTF-8")); } | public String loadAsString(String encoding) { try { InputStream inputStream = classLoader.getResourceAsStream(location); if (inputStream == null) { throw new CassandraMigrationException( "Unable to obtain inputstream for resource: " + location); } Reader reader = new InputStreamReader(inputStream, Charset.forName(encod... | ClassPathResource implements Comparable<ClassPathResource>, Resource { public String loadAsString(String encoding) { try { InputStream inputStream = classLoader.getResourceAsStream(location); if (inputStream == null) { throw new CassandraMigrationException( "Unable to obtain inputstream for resource: " + location); } R... | ClassPathResource implements Comparable<ClassPathResource>, Resource { public String loadAsString(String encoding) { try { InputStream inputStream = classLoader.getResourceAsStream(location); if (inputStream == null) { throw new CassandraMigrationException( "Unable to obtain inputstream for resource: " + location); } R... | ClassPathResource implements Comparable<ClassPathResource>, Resource { public String loadAsString(String encoding) { try { InputStream inputStream = classLoader.getResourceAsStream(location); if (inputStream == null) { throw new CassandraMigrationException( "Unable to obtain inputstream for resource: " + location); } R... | ClassPathResource implements Comparable<ClassPathResource>, Resource { public String loadAsString(String encoding) { try { InputStream inputStream = classLoader.getResourceAsStream(location); if (inputStream == null) { throw new CassandraMigrationException( "Unable to obtain inputstream for resource: " + location); } R... |
@Test public void toFilePath() throws MalformedURLException { File file = new File("/test dir/a+b"); assertEquals(file.getAbsolutePath(), UrlUtils.toFilePath(file.toURI().toURL())); } | public static String toFilePath(URL url) { try { String filePath = new File(URLDecoder.decode(url.getPath().replace("+", "%2b"), "UTF-8")).getAbsolutePath(); if (filePath.endsWith("/")) { return filePath.substring(0, filePath.length() - 1); } return filePath; } catch (UnsupportedEncodingException e) { throw new Illegal... | UrlUtils { public static String toFilePath(URL url) { try { String filePath = new File(URLDecoder.decode(url.getPath().replace("+", "%2b"), "UTF-8")).getAbsolutePath(); if (filePath.endsWith("/")) { return filePath.substring(0, filePath.length() - 1); } return filePath; } catch (UnsupportedEncodingException e) { throw ... | UrlUtils { public static String toFilePath(URL url) { try { String filePath = new File(URLDecoder.decode(url.getPath().replace("+", "%2b"), "UTF-8")).getAbsolutePath(); if (filePath.endsWith("/")) { return filePath.substring(0, filePath.length() - 1); } return filePath; } catch (UnsupportedEncodingException e) { throw ... | UrlUtils { public static String toFilePath(URL url) { try { String filePath = new File(URLDecoder.decode(url.getPath().replace("+", "%2b"), "UTF-8")).getAbsolutePath(); if (filePath.endsWith("/")) { return filePath.substring(0, filePath.length() - 1); } return filePath; } catch (UnsupportedEncodingException e) { throw ... | UrlUtils { public static String toFilePath(URL url) { try { String filePath = new File(URLDecoder.decode(url.getPath().replace("+", "%2b"), "UTF-8")).getAbsolutePath(); if (filePath.endsWith("/")) { return filePath.substring(0, filePath.length() - 1); } return filePath; } catch (UnsupportedEncodingException e) { throw ... |
@Test public void testGetTcpClient() { ElasticSearchService service = EsClientFactory.getInstance("tcp"); Assert.assertTrue(service instanceof ElasticSearchTcpImpl); } | private static ElasticSearchService getTcpClient() { if (tcpClient == null) { tcpClient = new ElasticSearchTcpImpl(); } return tcpClient; } | EsClientFactory { private static ElasticSearchService getTcpClient() { if (tcpClient == null) { tcpClient = new ElasticSearchTcpImpl(); } return tcpClient; } } | EsClientFactory { private static ElasticSearchService getTcpClient() { if (tcpClient == null) { tcpClient = new ElasticSearchTcpImpl(); } return tcpClient; } } | EsClientFactory { private static ElasticSearchService getTcpClient() { if (tcpClient == null) { tcpClient = new ElasticSearchTcpImpl(); } return tcpClient; } static ElasticSearchService getInstance(String type); } | EsClientFactory { private static ElasticSearchService getTcpClient() { if (tcpClient == null) { tcpClient = new ElasticSearchTcpImpl(); } return tcpClient; } static ElasticSearchService getInstance(String type); } |
@Test public void testGetRestClient() { ElasticSearchService service = EsClientFactory.getInstance("rest"); Assert.assertTrue(service instanceof ElasticSearchRestHighImpl); } | private static ElasticSearchService getRestClient() { if (restClient == null) { restClient = new ElasticSearchRestHighImpl(); } return restClient; } | EsClientFactory { private static ElasticSearchService getRestClient() { if (restClient == null) { restClient = new ElasticSearchRestHighImpl(); } return restClient; } } | EsClientFactory { private static ElasticSearchService getRestClient() { if (restClient == null) { restClient = new ElasticSearchRestHighImpl(); } return restClient; } } | EsClientFactory { private static ElasticSearchService getRestClient() { if (restClient == null) { restClient = new ElasticSearchRestHighImpl(); } return restClient; } static ElasticSearchService getInstance(String type); } | EsClientFactory { private static ElasticSearchService getRestClient() { if (restClient == null) { restClient = new ElasticSearchRestHighImpl(); } return restClient; } static ElasticSearchService getInstance(String type); } |
@Test public void testInstanceNull() { ElasticSearchService service = EsClientFactory.getInstance("test"); Assert.assertNull(service); } | public static ElasticSearchService getInstance(String type) { if (JsonKey.TCP.equals(type)) { return getTcpClient(); } else if (JsonKey.REST.equals(type)) { return getRestClient(); } else { ProjectLogger.log( "EsClientFactory:getInstance: value for client type provided null ", LoggerEnum.ERROR); } return null; } | EsClientFactory { public static ElasticSearchService getInstance(String type) { if (JsonKey.TCP.equals(type)) { return getTcpClient(); } else if (JsonKey.REST.equals(type)) { return getRestClient(); } else { ProjectLogger.log( "EsClientFactory:getInstance: value for client type provided null ", LoggerEnum.ERROR); } ret... | EsClientFactory { public static ElasticSearchService getInstance(String type) { if (JsonKey.TCP.equals(type)) { return getTcpClient(); } else if (JsonKey.REST.equals(type)) { return getRestClient(); } else { ProjectLogger.log( "EsClientFactory:getInstance: value for client type provided null ", LoggerEnum.ERROR); } ret... | EsClientFactory { public static ElasticSearchService getInstance(String type) { if (JsonKey.TCP.equals(type)) { return getTcpClient(); } else if (JsonKey.REST.equals(type)) { return getRestClient(); } else { ProjectLogger.log( "EsClientFactory:getInstance: value for client type provided null ", LoggerEnum.ERROR); } ret... | EsClientFactory { public static ElasticSearchService getInstance(String type) { if (JsonKey.TCP.equals(type)) { return getTcpClient(); } else if (JsonKey.REST.equals(type)) { return getRestClient(); } else { ProjectLogger.log( "EsClientFactory:getInstance: value for client type provided null ", LoggerEnum.ERROR); } ret... |
@Test public void testSaveSuccess() { mockRulesForSave(false); Future<String> result = esService.save("test", "001", new HashMap<>()); String res = (String) ElasticSearchHelper.getResponseFromFuture(result); assertEquals("001", res); } | @Override public Future<String> save(String index, String identifier, Map<String, Object> data) { long startTime = System.currentTimeMillis(); Promise<String> promise = Futures.promise(); ProjectLogger.log( "ElasticSearchUtilRest:save: method started at ==" + startTime + " for Index " + index, LoggerEnum.PERF_LOG.name(... | ElasticSearchRestHighImpl implements ElasticSearchService { @Override public Future<String> save(String index, String identifier, Map<String, Object> data) { long startTime = System.currentTimeMillis(); Promise<String> promise = Futures.promise(); ProjectLogger.log( "ElasticSearchUtilRest:save: method started at ==" + ... | ElasticSearchRestHighImpl implements ElasticSearchService { @Override public Future<String> save(String index, String identifier, Map<String, Object> data) { long startTime = System.currentTimeMillis(); Promise<String> promise = Futures.promise(); ProjectLogger.log( "ElasticSearchUtilRest:save: method started at ==" + ... | ElasticSearchRestHighImpl implements ElasticSearchService { @Override public Future<String> save(String index, String identifier, Map<String, Object> data) { long startTime = System.currentTimeMillis(); Promise<String> promise = Futures.promise(); ProjectLogger.log( "ElasticSearchUtilRest:save: method started at ==" + ... | ElasticSearchRestHighImpl implements ElasticSearchService { @Override public Future<String> save(String index, String identifier, Map<String, Object> data) { long startTime = System.currentTimeMillis(); Promise<String> promise = Futures.promise(); ProjectLogger.log( "ElasticSearchUtilRest:save: method started at ==" + ... |
@Test public void sendEmailFailure () { List<String> to = new ArrayList<String>(); Map<String,String> param = new HashMap<String, String>(); param.put("name", "test"); EmailRequest emailReq = new EmailRequest("testEmail", to, null, null, "emailtemplate", null, param); boolean response = service.sendEmail(emailReq); ass... | @Override public boolean sendEmail(EmailRequest emailReq) { if (emailReq == null) { logger.info("Email request is null or empty:"); return false; } else if (CollectionUtils.isNotEmpty(emailReq.getBcc()) || emailReq.getTo().size() > 1) { return email.sendEmail( email.getFromEmail(), emailReq.getSubject(), emailReq.getBo... | SmtpEMailServiceImpl implements IEmailService { @Override public boolean sendEmail(EmailRequest emailReq) { if (emailReq == null) { logger.info("Email request is null or empty:"); return false; } else if (CollectionUtils.isNotEmpty(emailReq.getBcc()) || emailReq.getTo().size() > 1) { return email.sendEmail( email.getFr... | SmtpEMailServiceImpl implements IEmailService { @Override public boolean sendEmail(EmailRequest emailReq) { if (emailReq == null) { logger.info("Email request is null or empty:"); return false; } else if (CollectionUtils.isNotEmpty(emailReq.getBcc()) || emailReq.getTo().size() > 1) { return email.sendEmail( email.getFr... | SmtpEMailServiceImpl implements IEmailService { @Override public boolean sendEmail(EmailRequest emailReq) { if (emailReq == null) { logger.info("Email request is null or empty:"); return false; } else if (CollectionUtils.isNotEmpty(emailReq.getBcc()) || emailReq.getTo().size() > 1) { return email.sendEmail( email.getFr... | SmtpEMailServiceImpl implements IEmailService { @Override public boolean sendEmail(EmailRequest emailReq) { if (emailReq == null) { logger.info("Email request is null or empty:"); return false; } else if (CollectionUtils.isNotEmpty(emailReq.getBcc()) || emailReq.getTo().size() > 1) { return email.sendEmail( email.getFr... |
@Test public void testSaveFailureWithEmptyIndex() { Future<String> result = esService.save("", "001", new HashMap<>()); String res = (String) ElasticSearchHelper.getResponseFromFuture(result); assertEquals("ERROR", res); } | @Override public Future<String> save(String index, String identifier, Map<String, Object> data) { long startTime = System.currentTimeMillis(); Promise<String> promise = Futures.promise(); ProjectLogger.log( "ElasticSearchUtilRest:save: method started at ==" + startTime + " for Index " + index, LoggerEnum.PERF_LOG.name(... | ElasticSearchRestHighImpl implements ElasticSearchService { @Override public Future<String> save(String index, String identifier, Map<String, Object> data) { long startTime = System.currentTimeMillis(); Promise<String> promise = Futures.promise(); ProjectLogger.log( "ElasticSearchUtilRest:save: method started at ==" + ... | ElasticSearchRestHighImpl implements ElasticSearchService { @Override public Future<String> save(String index, String identifier, Map<String, Object> data) { long startTime = System.currentTimeMillis(); Promise<String> promise = Futures.promise(); ProjectLogger.log( "ElasticSearchUtilRest:save: method started at ==" + ... | ElasticSearchRestHighImpl implements ElasticSearchService { @Override public Future<String> save(String index, String identifier, Map<String, Object> data) { long startTime = System.currentTimeMillis(); Promise<String> promise = Futures.promise(); ProjectLogger.log( "ElasticSearchUtilRest:save: method started at ==" + ... | ElasticSearchRestHighImpl implements ElasticSearchService { @Override public Future<String> save(String index, String identifier, Map<String, Object> data) { long startTime = System.currentTimeMillis(); Promise<String> promise = Futures.promise(); ProjectLogger.log( "ElasticSearchUtilRest:save: method started at ==" + ... |
@Test public void testSaveFailureWithEmptyIdentifier() { Future<String> result = esService.save("test", "", new HashMap<>()); String res = (String) ElasticSearchHelper.getResponseFromFuture(result); assertEquals("ERROR", res); } | @Override public Future<String> save(String index, String identifier, Map<String, Object> data) { long startTime = System.currentTimeMillis(); Promise<String> promise = Futures.promise(); ProjectLogger.log( "ElasticSearchUtilRest:save: method started at ==" + startTime + " for Index " + index, LoggerEnum.PERF_LOG.name(... | ElasticSearchRestHighImpl implements ElasticSearchService { @Override public Future<String> save(String index, String identifier, Map<String, Object> data) { long startTime = System.currentTimeMillis(); Promise<String> promise = Futures.promise(); ProjectLogger.log( "ElasticSearchUtilRest:save: method started at ==" + ... | ElasticSearchRestHighImpl implements ElasticSearchService { @Override public Future<String> save(String index, String identifier, Map<String, Object> data) { long startTime = System.currentTimeMillis(); Promise<String> promise = Futures.promise(); ProjectLogger.log( "ElasticSearchUtilRest:save: method started at ==" + ... | ElasticSearchRestHighImpl implements ElasticSearchService { @Override public Future<String> save(String index, String identifier, Map<String, Object> data) { long startTime = System.currentTimeMillis(); Promise<String> promise = Futures.promise(); ProjectLogger.log( "ElasticSearchUtilRest:save: method started at ==" + ... | ElasticSearchRestHighImpl implements ElasticSearchService { @Override public Future<String> save(String index, String identifier, Map<String, Object> data) { long startTime = System.currentTimeMillis(); Promise<String> promise = Futures.promise(); ProjectLogger.log( "ElasticSearchUtilRest:save: method started at ==" + ... |
@Test public void testSaveFailure() { mockRulesForSave(true); Future<String> result = esService.save("test", "001", new HashMap<>()); String res = (String) ElasticSearchHelper.getResponseFromFuture(result); assertEquals(null, res); } | @Override public Future<String> save(String index, String identifier, Map<String, Object> data) { long startTime = System.currentTimeMillis(); Promise<String> promise = Futures.promise(); ProjectLogger.log( "ElasticSearchUtilRest:save: method started at ==" + startTime + " for Index " + index, LoggerEnum.PERF_LOG.name(... | ElasticSearchRestHighImpl implements ElasticSearchService { @Override public Future<String> save(String index, String identifier, Map<String, Object> data) { long startTime = System.currentTimeMillis(); Promise<String> promise = Futures.promise(); ProjectLogger.log( "ElasticSearchUtilRest:save: method started at ==" + ... | ElasticSearchRestHighImpl implements ElasticSearchService { @Override public Future<String> save(String index, String identifier, Map<String, Object> data) { long startTime = System.currentTimeMillis(); Promise<String> promise = Futures.promise(); ProjectLogger.log( "ElasticSearchUtilRest:save: method started at ==" + ... | ElasticSearchRestHighImpl implements ElasticSearchService { @Override public Future<String> save(String index, String identifier, Map<String, Object> data) { long startTime = System.currentTimeMillis(); Promise<String> promise = Futures.promise(); ProjectLogger.log( "ElasticSearchUtilRest:save: method started at ==" + ... | ElasticSearchRestHighImpl implements ElasticSearchService { @Override public Future<String> save(String index, String identifier, Map<String, Object> data) { long startTime = System.currentTimeMillis(); Promise<String> promise = Futures.promise(); ProjectLogger.log( "ElasticSearchUtilRest:save: method started at ==" + ... |
@Test public void testUpdateSuccess() { mockRulesForUpdate(false); Future<Boolean> result = esService.update("test", "001", new HashMap<>()); boolean res = (boolean) ElasticSearchHelper.getResponseFromFuture(result); assertEquals(true, res); } | @Override public Future<Boolean> update(String index, String identifier, Map<String, Object> data) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "ElasticSearchRestHighImpl:update: method started at ==" + startTime + " for Index " + index, LoggerEnum.PERF_LOG.name()); Promise<Boolean> promise = Futur... | ElasticSearchRestHighImpl implements ElasticSearchService { @Override public Future<Boolean> update(String index, String identifier, Map<String, Object> data) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "ElasticSearchRestHighImpl:update: method started at ==" + startTime + " for Index " + index, L... | ElasticSearchRestHighImpl implements ElasticSearchService { @Override public Future<Boolean> update(String index, String identifier, Map<String, Object> data) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "ElasticSearchRestHighImpl:update: method started at ==" + startTime + " for Index " + index, L... | ElasticSearchRestHighImpl implements ElasticSearchService { @Override public Future<Boolean> update(String index, String identifier, Map<String, Object> data) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "ElasticSearchRestHighImpl:update: method started at ==" + startTime + " for Index " + index, L... | ElasticSearchRestHighImpl implements ElasticSearchService { @Override public Future<Boolean> update(String index, String identifier, Map<String, Object> data) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "ElasticSearchRestHighImpl:update: method started at ==" + startTime + " for Index " + index, L... |
@Test public void testUpdateFailure() { mockRulesForUpdate(true); Future<Boolean> result = esService.update("test", "001", new HashMap<>()); Object res = ElasticSearchHelper.getResponseFromFuture(result); assertEquals(null, res); } | @Override public Future<Boolean> update(String index, String identifier, Map<String, Object> data) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "ElasticSearchRestHighImpl:update: method started at ==" + startTime + " for Index " + index, LoggerEnum.PERF_LOG.name()); Promise<Boolean> promise = Futur... | ElasticSearchRestHighImpl implements ElasticSearchService { @Override public Future<Boolean> update(String index, String identifier, Map<String, Object> data) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "ElasticSearchRestHighImpl:update: method started at ==" + startTime + " for Index " + index, L... | ElasticSearchRestHighImpl implements ElasticSearchService { @Override public Future<Boolean> update(String index, String identifier, Map<String, Object> data) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "ElasticSearchRestHighImpl:update: method started at ==" + startTime + " for Index " + index, L... | ElasticSearchRestHighImpl implements ElasticSearchService { @Override public Future<Boolean> update(String index, String identifier, Map<String, Object> data) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "ElasticSearchRestHighImpl:update: method started at ==" + startTime + " for Index " + index, L... | ElasticSearchRestHighImpl implements ElasticSearchService { @Override public Future<Boolean> update(String index, String identifier, Map<String, Object> data) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "ElasticSearchRestHighImpl:update: method started at ==" + startTime + " for Index " + index, L... |
@Test public void testUpdateFailureWithEmptyIndex() { try { esService.update("", "001", new HashMap<>()); } catch (ProjectCommonException e) { assertEquals(e.getResponseCode(), ResponseCode.invalidData.getResponseCode()); } } | @Override public Future<Boolean> update(String index, String identifier, Map<String, Object> data) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "ElasticSearchRestHighImpl:update: method started at ==" + startTime + " for Index " + index, LoggerEnum.PERF_LOG.name()); Promise<Boolean> promise = Futur... | ElasticSearchRestHighImpl implements ElasticSearchService { @Override public Future<Boolean> update(String index, String identifier, Map<String, Object> data) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "ElasticSearchRestHighImpl:update: method started at ==" + startTime + " for Index " + index, L... | ElasticSearchRestHighImpl implements ElasticSearchService { @Override public Future<Boolean> update(String index, String identifier, Map<String, Object> data) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "ElasticSearchRestHighImpl:update: method started at ==" + startTime + " for Index " + index, L... | ElasticSearchRestHighImpl implements ElasticSearchService { @Override public Future<Boolean> update(String index, String identifier, Map<String, Object> data) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "ElasticSearchRestHighImpl:update: method started at ==" + startTime + " for Index " + index, L... | ElasticSearchRestHighImpl implements ElasticSearchService { @Override public Future<Boolean> update(String index, String identifier, Map<String, Object> data) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "ElasticSearchRestHighImpl:update: method started at ==" + startTime + " for Index " + index, L... |
@Test public void testUpdateFailureWithEmptyIdentifier() { try { esService.update("test", "", new HashMap<>()); } catch (ProjectCommonException e) { assertEquals(e.getResponseCode(), ResponseCode.invalidData.getResponseCode()); } } | @Override public Future<Boolean> update(String index, String identifier, Map<String, Object> data) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "ElasticSearchRestHighImpl:update: method started at ==" + startTime + " for Index " + index, LoggerEnum.PERF_LOG.name()); Promise<Boolean> promise = Futur... | ElasticSearchRestHighImpl implements ElasticSearchService { @Override public Future<Boolean> update(String index, String identifier, Map<String, Object> data) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "ElasticSearchRestHighImpl:update: method started at ==" + startTime + " for Index " + index, L... | ElasticSearchRestHighImpl implements ElasticSearchService { @Override public Future<Boolean> update(String index, String identifier, Map<String, Object> data) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "ElasticSearchRestHighImpl:update: method started at ==" + startTime + " for Index " + index, L... | ElasticSearchRestHighImpl implements ElasticSearchService { @Override public Future<Boolean> update(String index, String identifier, Map<String, Object> data) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "ElasticSearchRestHighImpl:update: method started at ==" + startTime + " for Index " + index, L... | ElasticSearchRestHighImpl implements ElasticSearchService { @Override public Future<Boolean> update(String index, String identifier, Map<String, Object> data) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "ElasticSearchRestHighImpl:update: method started at ==" + startTime + " for Index " + index, L... |
@Test public void testGetDataByIdentifierFailureWithEmptyIndex() { try { esService.getDataByIdentifier("", "001"); } catch (ProjectCommonException e) { assertEquals(e.getResponseCode(), ResponseCode.invalidData.getResponseCode()); } } | @Override public Future<Map<String, Object>> getDataByIdentifier(String index, String identifier) { long startTime = System.currentTimeMillis(); Promise<Map<String, Object>> promise = Futures.promise(); if (StringUtils.isNotEmpty(identifier) && StringUtils.isNotEmpty(index)) { ProjectLogger.log( "ElasticSearchRestHighI... | ElasticSearchRestHighImpl implements ElasticSearchService { @Override public Future<Map<String, Object>> getDataByIdentifier(String index, String identifier) { long startTime = System.currentTimeMillis(); Promise<Map<String, Object>> promise = Futures.promise(); if (StringUtils.isNotEmpty(identifier) && StringUtils.isN... | ElasticSearchRestHighImpl implements ElasticSearchService { @Override public Future<Map<String, Object>> getDataByIdentifier(String index, String identifier) { long startTime = System.currentTimeMillis(); Promise<Map<String, Object>> promise = Futures.promise(); if (StringUtils.isNotEmpty(identifier) && StringUtils.isN... | ElasticSearchRestHighImpl implements ElasticSearchService { @Override public Future<Map<String, Object>> getDataByIdentifier(String index, String identifier) { long startTime = System.currentTimeMillis(); Promise<Map<String, Object>> promise = Futures.promise(); if (StringUtils.isNotEmpty(identifier) && StringUtils.isN... | ElasticSearchRestHighImpl implements ElasticSearchService { @Override public Future<Map<String, Object>> getDataByIdentifier(String index, String identifier) { long startTime = System.currentTimeMillis(); Promise<Map<String, Object>> promise = Futures.promise(); if (StringUtils.isNotEmpty(identifier) && StringUtils.isN... |
@Test public void testGetDataByIdentifierFailureWithEmptyIdentifier() { try { esService.getDataByIdentifier("test", ""); } catch (ProjectCommonException e) { assertEquals(e.getResponseCode(), ResponseCode.invalidData.getResponseCode()); } } | @Override public Future<Map<String, Object>> getDataByIdentifier(String index, String identifier) { long startTime = System.currentTimeMillis(); Promise<Map<String, Object>> promise = Futures.promise(); if (StringUtils.isNotEmpty(identifier) && StringUtils.isNotEmpty(index)) { ProjectLogger.log( "ElasticSearchRestHighI... | ElasticSearchRestHighImpl implements ElasticSearchService { @Override public Future<Map<String, Object>> getDataByIdentifier(String index, String identifier) { long startTime = System.currentTimeMillis(); Promise<Map<String, Object>> promise = Futures.promise(); if (StringUtils.isNotEmpty(identifier) && StringUtils.isN... | ElasticSearchRestHighImpl implements ElasticSearchService { @Override public Future<Map<String, Object>> getDataByIdentifier(String index, String identifier) { long startTime = System.currentTimeMillis(); Promise<Map<String, Object>> promise = Futures.promise(); if (StringUtils.isNotEmpty(identifier) && StringUtils.isN... | ElasticSearchRestHighImpl implements ElasticSearchService { @Override public Future<Map<String, Object>> getDataByIdentifier(String index, String identifier) { long startTime = System.currentTimeMillis(); Promise<Map<String, Object>> promise = Futures.promise(); if (StringUtils.isNotEmpty(identifier) && StringUtils.isN... | ElasticSearchRestHighImpl implements ElasticSearchService { @Override public Future<Map<String, Object>> getDataByIdentifier(String index, String identifier) { long startTime = System.currentTimeMillis(); Promise<Map<String, Object>> promise = Futures.promise(); if (StringUtils.isNotEmpty(identifier) && StringUtils.isN... |
@Test public void testGetDataByIdentifierFailure() { mockRulesForGet(true); Future<Map<String, Object>> result = esService.getDataByIdentifier("test", "001"); Object res = ElasticSearchHelper.getResponseFromFuture(result); assertEquals(null, res); } | @Override public Future<Map<String, Object>> getDataByIdentifier(String index, String identifier) { long startTime = System.currentTimeMillis(); Promise<Map<String, Object>> promise = Futures.promise(); if (StringUtils.isNotEmpty(identifier) && StringUtils.isNotEmpty(index)) { ProjectLogger.log( "ElasticSearchRestHighI... | ElasticSearchRestHighImpl implements ElasticSearchService { @Override public Future<Map<String, Object>> getDataByIdentifier(String index, String identifier) { long startTime = System.currentTimeMillis(); Promise<Map<String, Object>> promise = Futures.promise(); if (StringUtils.isNotEmpty(identifier) && StringUtils.isN... | ElasticSearchRestHighImpl implements ElasticSearchService { @Override public Future<Map<String, Object>> getDataByIdentifier(String index, String identifier) { long startTime = System.currentTimeMillis(); Promise<Map<String, Object>> promise = Futures.promise(); if (StringUtils.isNotEmpty(identifier) && StringUtils.isN... | ElasticSearchRestHighImpl implements ElasticSearchService { @Override public Future<Map<String, Object>> getDataByIdentifier(String index, String identifier) { long startTime = System.currentTimeMillis(); Promise<Map<String, Object>> promise = Futures.promise(); if (StringUtils.isNotEmpty(identifier) && StringUtils.isN... | ElasticSearchRestHighImpl implements ElasticSearchService { @Override public Future<Map<String, Object>> getDataByIdentifier(String index, String identifier) { long startTime = System.currentTimeMillis(); Promise<Map<String, Object>> promise = Futures.promise(); if (StringUtils.isNotEmpty(identifier) && StringUtils.isN... |
@Test(expected = CassandraMigrationException.class) public void broken() { new JavaMigrationResolver( Thread.currentThread().getContextClassLoader(), new ScriptsLocation("com/contrastsecurity/cassandra/migration/resolver/java/error")) .resolveMigrations(); } | public List<ResolvedMigration> resolveMigrations() { List<ResolvedMigration> migrations = new ArrayList<ResolvedMigration>(); if (!location.isClassPath()) { return migrations; } try { Class<?>[] classes = new Scanner(classLoader).scanForClasses(location, JavaMigration.class); for (Class<?> clazz : classes) { JavaMigrat... | JavaMigrationResolver implements MigrationResolver { public List<ResolvedMigration> resolveMigrations() { List<ResolvedMigration> migrations = new ArrayList<ResolvedMigration>(); if (!location.isClassPath()) { return migrations; } try { Class<?>[] classes = new Scanner(classLoader).scanForClasses(location, JavaMigratio... | JavaMigrationResolver implements MigrationResolver { public List<ResolvedMigration> resolveMigrations() { List<ResolvedMigration> migrations = new ArrayList<ResolvedMigration>(); if (!location.isClassPath()) { return migrations; } try { Class<?>[] classes = new Scanner(classLoader).scanForClasses(location, JavaMigratio... | JavaMigrationResolver implements MigrationResolver { public List<ResolvedMigration> resolveMigrations() { List<ResolvedMigration> migrations = new ArrayList<ResolvedMigration>(); if (!location.isClassPath()) { return migrations; } try { Class<?>[] classes = new Scanner(classLoader).scanForClasses(location, JavaMigratio... | JavaMigrationResolver implements MigrationResolver { public List<ResolvedMigration> resolveMigrations() { List<ResolvedMigration> migrations = new ArrayList<ResolvedMigration>(); if (!location.isClassPath()) { return migrations; } try { Class<?>[] classes = new Scanner(classLoader).scanForClasses(location, JavaMigratio... |
@Test public void testDeleteSuccess() { mockRulesForDelete(false, false); Future<Boolean> result = esService.delete("test", "001"); boolean res = (boolean) ElasticSearchHelper.getResponseFromFuture(result); assertEquals(true, res); } | @Override public Future<Boolean> delete(String index, String identifier) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "ElasticSearchRestHighImpl:delete: method started at ==" + startTime, LoggerEnum.PERF_LOG.name()); Promise<Boolean> promise = Futures.promise(); if (StringUtils.isNotEmpty(identifie... | ElasticSearchRestHighImpl implements ElasticSearchService { @Override public Future<Boolean> delete(String index, String identifier) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "ElasticSearchRestHighImpl:delete: method started at ==" + startTime, LoggerEnum.PERF_LOG.name()); Promise<Boolean> promi... | ElasticSearchRestHighImpl implements ElasticSearchService { @Override public Future<Boolean> delete(String index, String identifier) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "ElasticSearchRestHighImpl:delete: method started at ==" + startTime, LoggerEnum.PERF_LOG.name()); Promise<Boolean> promi... | ElasticSearchRestHighImpl implements ElasticSearchService { @Override public Future<Boolean> delete(String index, String identifier) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "ElasticSearchRestHighImpl:delete: method started at ==" + startTime, LoggerEnum.PERF_LOG.name()); Promise<Boolean> promi... | ElasticSearchRestHighImpl implements ElasticSearchService { @Override public Future<Boolean> delete(String index, String identifier) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "ElasticSearchRestHighImpl:delete: method started at ==" + startTime, LoggerEnum.PERF_LOG.name()); Promise<Boolean> promi... |
@Test public void testDeleteSuccessWithoutDelete() { mockRulesForDelete(false, true); Future<Boolean> result = esService.delete("test", "001"); boolean res = (boolean) ElasticSearchHelper.getResponseFromFuture(result); assertEquals(false, res); } | @Override public Future<Boolean> delete(String index, String identifier) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "ElasticSearchRestHighImpl:delete: method started at ==" + startTime, LoggerEnum.PERF_LOG.name()); Promise<Boolean> promise = Futures.promise(); if (StringUtils.isNotEmpty(identifie... | ElasticSearchRestHighImpl implements ElasticSearchService { @Override public Future<Boolean> delete(String index, String identifier) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "ElasticSearchRestHighImpl:delete: method started at ==" + startTime, LoggerEnum.PERF_LOG.name()); Promise<Boolean> promi... | ElasticSearchRestHighImpl implements ElasticSearchService { @Override public Future<Boolean> delete(String index, String identifier) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "ElasticSearchRestHighImpl:delete: method started at ==" + startTime, LoggerEnum.PERF_LOG.name()); Promise<Boolean> promi... | ElasticSearchRestHighImpl implements ElasticSearchService { @Override public Future<Boolean> delete(String index, String identifier) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "ElasticSearchRestHighImpl:delete: method started at ==" + startTime, LoggerEnum.PERF_LOG.name()); Promise<Boolean> promi... | ElasticSearchRestHighImpl implements ElasticSearchService { @Override public Future<Boolean> delete(String index, String identifier) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "ElasticSearchRestHighImpl:delete: method started at ==" + startTime, LoggerEnum.PERF_LOG.name()); Promise<Boolean> promi... |
@Test public void testDeleteFailure() { mockRulesForDelete(true, false); Future<Boolean> result = esService.delete("test", "001"); Object res = ElasticSearchHelper.getResponseFromFuture(result); assertEquals(null, res); } | @Override public Future<Boolean> delete(String index, String identifier) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "ElasticSearchRestHighImpl:delete: method started at ==" + startTime, LoggerEnum.PERF_LOG.name()); Promise<Boolean> promise = Futures.promise(); if (StringUtils.isNotEmpty(identifie... | ElasticSearchRestHighImpl implements ElasticSearchService { @Override public Future<Boolean> delete(String index, String identifier) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "ElasticSearchRestHighImpl:delete: method started at ==" + startTime, LoggerEnum.PERF_LOG.name()); Promise<Boolean> promi... | ElasticSearchRestHighImpl implements ElasticSearchService { @Override public Future<Boolean> delete(String index, String identifier) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "ElasticSearchRestHighImpl:delete: method started at ==" + startTime, LoggerEnum.PERF_LOG.name()); Promise<Boolean> promi... | ElasticSearchRestHighImpl implements ElasticSearchService { @Override public Future<Boolean> delete(String index, String identifier) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "ElasticSearchRestHighImpl:delete: method started at ==" + startTime, LoggerEnum.PERF_LOG.name()); Promise<Boolean> promi... | ElasticSearchRestHighImpl implements ElasticSearchService { @Override public Future<Boolean> delete(String index, String identifier) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "ElasticSearchRestHighImpl:delete: method started at ==" + startTime, LoggerEnum.PERF_LOG.name()); Promise<Boolean> promi... |
@Test public void testDeleteFailureWithEmptyIdentifier() { try { esService.delete("test", ""); } catch (ProjectCommonException e) { assertEquals(e.getResponseCode(), ResponseCode.invalidData.getResponseCode()); } } | @Override public Future<Boolean> delete(String index, String identifier) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "ElasticSearchRestHighImpl:delete: method started at ==" + startTime, LoggerEnum.PERF_LOG.name()); Promise<Boolean> promise = Futures.promise(); if (StringUtils.isNotEmpty(identifie... | ElasticSearchRestHighImpl implements ElasticSearchService { @Override public Future<Boolean> delete(String index, String identifier) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "ElasticSearchRestHighImpl:delete: method started at ==" + startTime, LoggerEnum.PERF_LOG.name()); Promise<Boolean> promi... | ElasticSearchRestHighImpl implements ElasticSearchService { @Override public Future<Boolean> delete(String index, String identifier) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "ElasticSearchRestHighImpl:delete: method started at ==" + startTime, LoggerEnum.PERF_LOG.name()); Promise<Boolean> promi... | ElasticSearchRestHighImpl implements ElasticSearchService { @Override public Future<Boolean> delete(String index, String identifier) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "ElasticSearchRestHighImpl:delete: method started at ==" + startTime, LoggerEnum.PERF_LOG.name()); Promise<Boolean> promi... | ElasticSearchRestHighImpl implements ElasticSearchService { @Override public Future<Boolean> delete(String index, String identifier) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "ElasticSearchRestHighImpl:delete: method started at ==" + startTime, LoggerEnum.PERF_LOG.name()); Promise<Boolean> promi... |
@Test public void testDeleteFailureWithEmptyIndex() { try { esService.delete("", "001"); } catch (ProjectCommonException e) { assertEquals(e.getResponseCode(), ResponseCode.invalidData.getResponseCode()); } } | @Override public Future<Boolean> delete(String index, String identifier) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "ElasticSearchRestHighImpl:delete: method started at ==" + startTime, LoggerEnum.PERF_LOG.name()); Promise<Boolean> promise = Futures.promise(); if (StringUtils.isNotEmpty(identifie... | ElasticSearchRestHighImpl implements ElasticSearchService { @Override public Future<Boolean> delete(String index, String identifier) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "ElasticSearchRestHighImpl:delete: method started at ==" + startTime, LoggerEnum.PERF_LOG.name()); Promise<Boolean> promi... | ElasticSearchRestHighImpl implements ElasticSearchService { @Override public Future<Boolean> delete(String index, String identifier) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "ElasticSearchRestHighImpl:delete: method started at ==" + startTime, LoggerEnum.PERF_LOG.name()); Promise<Boolean> promi... | ElasticSearchRestHighImpl implements ElasticSearchService { @Override public Future<Boolean> delete(String index, String identifier) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "ElasticSearchRestHighImpl:delete: method started at ==" + startTime, LoggerEnum.PERF_LOG.name()); Promise<Boolean> promi... | ElasticSearchRestHighImpl implements ElasticSearchService { @Override public Future<Boolean> delete(String index, String identifier) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "ElasticSearchRestHighImpl:delete: method started at ==" + startTime, LoggerEnum.PERF_LOG.name()); Promise<Boolean> promi... |
@Test public void testUpsertSuccess() { mockRulesForUpdate(false); Future<Boolean> result = esService.update("test", "001", new HashMap<>()); boolean res = (boolean) ElasticSearchHelper.getResponseFromFuture(result); assertEquals(true, res); } | @Override public Future<Boolean> update(String index, String identifier, Map<String, Object> data) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "ElasticSearchRestHighImpl:update: method started at ==" + startTime + " for Index " + index, LoggerEnum.PERF_LOG.name()); Promise<Boolean> promise = Futur... | ElasticSearchRestHighImpl implements ElasticSearchService { @Override public Future<Boolean> update(String index, String identifier, Map<String, Object> data) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "ElasticSearchRestHighImpl:update: method started at ==" + startTime + " for Index " + index, L... | ElasticSearchRestHighImpl implements ElasticSearchService { @Override public Future<Boolean> update(String index, String identifier, Map<String, Object> data) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "ElasticSearchRestHighImpl:update: method started at ==" + startTime + " for Index " + index, L... | ElasticSearchRestHighImpl implements ElasticSearchService { @Override public Future<Boolean> update(String index, String identifier, Map<String, Object> data) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "ElasticSearchRestHighImpl:update: method started at ==" + startTime + " for Index " + index, L... | ElasticSearchRestHighImpl implements ElasticSearchService { @Override public Future<Boolean> update(String index, String identifier, Map<String, Object> data) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "ElasticSearchRestHighImpl:update: method started at ==" + startTime + " for Index " + index, L... |
@Test public void testUpsertFailure() { mockRulesForUpdate(true); Future<Boolean> result = esService.update("test", "001", new HashMap<>()); Object res = ElasticSearchHelper.getResponseFromFuture(result); assertEquals(null, res); } | @Override public Future<Boolean> update(String index, String identifier, Map<String, Object> data) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "ElasticSearchRestHighImpl:update: method started at ==" + startTime + " for Index " + index, LoggerEnum.PERF_LOG.name()); Promise<Boolean> promise = Futur... | ElasticSearchRestHighImpl implements ElasticSearchService { @Override public Future<Boolean> update(String index, String identifier, Map<String, Object> data) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "ElasticSearchRestHighImpl:update: method started at ==" + startTime + " for Index " + index, L... | ElasticSearchRestHighImpl implements ElasticSearchService { @Override public Future<Boolean> update(String index, String identifier, Map<String, Object> data) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "ElasticSearchRestHighImpl:update: method started at ==" + startTime + " for Index " + index, L... | ElasticSearchRestHighImpl implements ElasticSearchService { @Override public Future<Boolean> update(String index, String identifier, Map<String, Object> data) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "ElasticSearchRestHighImpl:update: method started at ==" + startTime + " for Index " + index, L... | ElasticSearchRestHighImpl implements ElasticSearchService { @Override public Future<Boolean> update(String index, String identifier, Map<String, Object> data) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "ElasticSearchRestHighImpl:update: method started at ==" + startTime + " for Index " + index, L... |
@Test public void testUpsertFailureWithEmptyIndex() { try { esService.update("", "001", new HashMap<>()); } catch (ProjectCommonException e) { assertEquals(e.getResponseCode(), ResponseCode.invalidData.getResponseCode()); } } | @Override public Future<Boolean> update(String index, String identifier, Map<String, Object> data) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "ElasticSearchRestHighImpl:update: method started at ==" + startTime + " for Index " + index, LoggerEnum.PERF_LOG.name()); Promise<Boolean> promise = Futur... | ElasticSearchRestHighImpl implements ElasticSearchService { @Override public Future<Boolean> update(String index, String identifier, Map<String, Object> data) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "ElasticSearchRestHighImpl:update: method started at ==" + startTime + " for Index " + index, L... | ElasticSearchRestHighImpl implements ElasticSearchService { @Override public Future<Boolean> update(String index, String identifier, Map<String, Object> data) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "ElasticSearchRestHighImpl:update: method started at ==" + startTime + " for Index " + index, L... | ElasticSearchRestHighImpl implements ElasticSearchService { @Override public Future<Boolean> update(String index, String identifier, Map<String, Object> data) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "ElasticSearchRestHighImpl:update: method started at ==" + startTime + " for Index " + index, L... | ElasticSearchRestHighImpl implements ElasticSearchService { @Override public Future<Boolean> update(String index, String identifier, Map<String, Object> data) { long startTime = System.currentTimeMillis(); ProjectLogger.log( "ElasticSearchRestHighImpl:update: method started at ==" + startTime + " for Index " + index, L... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.