@Test public void testDifference_StringString() { assertNull(StringUtils.difference(null, null)); assertEquals("", StringUtils.difference("", "")); assertEquals("abc", StringUtils.difference("", "abc")); assertEquals("", StringUtils.difference("abc", "")); assertEquals("i am a robot", StringUtils.difference(null, "i am a robot")); assertEquals("i am a machine", StringUtils.difference("i am a machine", null)); assertEquals("robot", StringUtils.difference("i am a machine", "i am a robot")); assertEquals("", StringUtils.difference("abc", "abc")); assertEquals("you are a robot", StringUtils.difference("i am a robot", "you are a robot")); }
public ContainerRequest filter(ContainerRequest request) { final String absoluteUri = request.getAbsolutePath().toString(); final String extension = StringUtils.substringAfterLast(absoluteUri, DOT); if (shouldFilter("/" + StringUtils.difference(request.getBaseUri().toString(), absoluteUri), extension)) { request.getRequestHeaders().putSingle(HttpHeaders.ACCEPT, EXTENSION_TO_ACCEPT_HEADER.get(extension)); final String absoluteUriWithoutExtension = StringUtils.substringBeforeLast(absoluteUri, DOT); request.setUris(request.getBaseUri(), getRequestUri(absoluteUriWithoutExtension, request.getQueryParameters())); } return request; }
scSchemaContent, localSchemaContent); String diffStringLocal = StringUtils.difference(scSchemaContent, localSchemaContent); if (diffStringLocal.equals("")) { LOGGER.warn("Some APIs are deleted in local schema which are present in service center schema \n");
/** * Return package name from the root to the target Path * * @param packageRoot * root where it starts * @param packageFolder * until the target * @return package name as String */ public static String getJavaPackageName(Path packageRoot, Path packageFolder) { String diff = StringUtils.difference(packageRoot.toString(), packageFolder.toString()); // remove seperators at the start if (diff.startsWith(java.io.File.separator)) { diff = diff.substring(1, diff.length()); } return diff.replaceAll(java.io.File.separator, "."); }
protected void putArray(DslPart object) { for(String matcherName: object.matchers.getMatchingRules().keySet()) { matchers.setRules(matcherName, object.matchers.getMatchingRules().get(matcherName)); } generators.addGenerators(object.generators); if (StringUtils.isNotEmpty(object.rootName)) { body.put(object.rootName, object.getBody()); } else { body.put(StringUtils.difference(this.rootPath, object.rootPath), object.getBody()); } }
protected void putArray(DslPart object) { for(String matcherName: object.matchers.getMatchingRules().keySet()) { matchers.setRules(matcherName, object.matchers.getMatchingRules().get(matcherName)); } generators.addGenerators(object.generators); if (StringUtils.isNotEmpty(object.rootName)) { body.put(object.rootName, object.getBody()); } else { body.put(StringUtils.difference(this.rootPath, object.rootPath), object.getBody()); } }
protected void putObject(DslPart object) { for (String matcherName: object.matchers.getMatchingRules().keySet()) { matchers.setRules(matcherName, object.matchers.getMatchingRules().get(matcherName)); } generators.addGenerators(object.generators); String elementBase = StringUtils.difference(this.rootPath, object.rootPath); if (StringUtils.isNotEmpty(object.rootName)) { body.put(object.rootName, object.getBody()); } else { String name = StringUtils.strip(elementBase, "."); Pattern p = Pattern.compile("\\['(.+)'\\]"); Matcher matcher = p.matcher(name); if (matcher.matches()) { body.put(matcher.group(1), object.getBody()); } else { body.put(name, object.getBody()); } } }
protected File getImageFile(String imagePath) throws IOException { String sampledImagesDirectory = getActualImagesDirectory(); String path; if (StringUtils.isNotBlank(sampledImagesDirectory)) { String canonical1 = new File(getExpectedImagesDirectory()).getCanonicalPath(); String canonical2 = new File(imagePath).getCanonicalPath(); String difference = StringUtils.difference(canonical1, canonical2); trace("image path construction image dir: " + canonical1); trace("image path construction image path: " + canonical2); trace("image path construction difference: " + difference); path = sampledImagesDirectory + File.separator + difference; } else { path = imagePath; } File imageFile = new File(path); File parentFile = imageFile.getParentFile(); if (!parentFile.isDirectory()) { debug("creating directory: " + parentFile.getPath()); FileUtils.forceMkdir(parentFile); } return imageFile; }
protected void putObject(DslPart object) { for (String matcherName: object.matchers.getMatchingRules().keySet()) { matchers.setRules(matcherName, object.matchers.getMatchingRules().get(matcherName)); } generators.addGenerators(object.generators); String elementBase = StringUtils.difference(this.rootPath, object.rootPath); if (StringUtils.isNotEmpty(object.rootName)) { body.put(object.rootName, object.getBody()); } else { String name = StringUtils.strip(elementBase, "."); Pattern p = Pattern.compile("\\['(.+)'\\]"); Matcher matcher = p.matcher(name); if (matcher.matches()) { body.put(matcher.group(1), object.getBody()); } else { body.put(name, object.getBody()); } } }
public static String difference(ActionContext actionContext){ Thing self = actionContext.getObject("self"); String str1 = (String) self.doAction("getStr1", actionContext); String str2 = (String) self.doAction("getStr2", actionContext); return StringUtils.difference(str1, str2); }
try { getLogger().debug("Persisting " + SAMPLED_TEXTS.size() + " text samples."); String difference = StringUtils.difference(GaleniumConfiguration.getGalenSpecPath(), FILE_NAME_EXPECTED_TEXTS); File file = new File(FILE_NAME_ROOT_DIR_SAVE_SAMPLED_TEXTS, difference); file.getParentFile().mkdirs();
scSchemaContent, localSchemaContent); String diffStringLocal = StringUtils.difference(scSchemaContent, localSchemaContent); if (diffStringLocal.equals("")) { LOGGER.warn("Some APIs are deleted in local schema which are present in service center schema \n");
if (segment.startsWith("{") && segment.endsWith("}")) { String peek = splitUrl[index - 1].toLowerCase(); name = "By" + StringUtils.capitalize(difference(peek, segment.substring(1, segment.length() - 1))); } else { String[] split = segment.split("[{}]");
String translatedPath = StringUtils.difference(gitConfig.getRepoFolder(), sonarIssuePath);