List of usage examples for org.apache.commons.lang3 StringUtils contains
public static boolean contains(final CharSequence seq, final CharSequence searchSeq)
Checks if CharSequence contains a search CharSequence, handling null .
From source file:com.cognifide.qa.bb.aem.touch.pageobjects.touchui.Parsys.java
private Predicate<Component> containsDataPath(String componentDataPath) { return component -> StringUtils.contains(component.getDataPath(), componentDataPath); }
From source file:com.glaf.report.web.springmvc.MxReportController.java
@RequestMapping("/chooseQuery") public ModelAndView chooseQuery(HttpServletRequest request, ModelMap modelMap) { RequestUtils.setRequestParameterToAttribute(request); request.removeAttribute("canSubmit"); Map<String, Object> params = RequestUtils.getParameterMap(request); String rowId = ParamUtils.getString(params, "reportId"); QueryDefinitionQuery query = new QueryDefinitionQuery(); List<QueryDefinition> list = queryDefinitionService.list(query); request.setAttribute("unselecteds", list); Report report = null;/*from w w w . j av a 2 s . c o m*/ if (StringUtils.isNotEmpty(rowId)) { report = reportService.getReport(rowId); request.setAttribute("report", report); if (StringUtils.isNotEmpty(report.getQueryIds())) { StringBuffer sb01 = new StringBuffer(); StringBuffer sb02 = new StringBuffer(); List<String> selecteds = new java.util.ArrayList<String>(); for (QueryDefinition q : list) { if (StringUtils.contains(report.getQueryIds(), q.getId())) { selecteds.add(q.getId()); sb01.append(q.getId()).append(","); sb02.append(q.getName()).append(","); } } if (sb01.toString().endsWith(",")) { sb01.delete(sb01.length() - 1, sb01.length()); } if (sb02.toString().endsWith(",")) { sb02.delete(sb02.length() - 1, sb02.length()); } request.setAttribute("selecteds", selecteds); request.setAttribute("queryIds", sb01.toString()); request.setAttribute("queryNames", sb02.toString()); } } String x_view = ViewProperties.getString("report.chooseQuery"); if (StringUtils.isNotEmpty(x_view)) { return new ModelAndView(x_view, modelMap); } return new ModelAndView("/bi/report/chooseQuery", modelMap); }
From source file:com.nike.cerberus.module.CerberusModule.java
private Optional<String> findBucket(final String environmentName) { AmazonS3Client s3Client = new AmazonS3Client(); List<Bucket> buckets = s3Client.listBuckets(); String envBucket = null;/* www . j av a 2 s . c o m*/ for (final Bucket bucket : buckets) { if (StringUtils.contains(bucket.getName(), ConfigConstants.CONFIG_BUCKET_KEY)) { String[] parts = bucket.getName().split("-"); if (StringUtils.equalsIgnoreCase(environmentName, parts[0])) { envBucket = bucket.getName(); break; } } } return Optional.ofNullable(envBucket); }
From source file:info.magnolia.ui.framework.command.ImportZipCommand.java
private String extractEntryPath(ZipArchiveEntry entry) { String entryName = entry.getName(); String path = (StringUtils.contains(entryName, "/")) ? StringUtils.substringBeforeLast(entryName, "/") : "/"; if (!path.startsWith("/")) { path = "/" + path; }//w w w . j a v a2s.co m // make proper name, the path was already created path = StringUtils.replace(path, "/", BACKSLASH_DUMMY); path = Path.getValidatedLabel(path); path = StringUtils.replace(path, BACKSLASH_DUMMY, "/"); return path; }
From source file:com.thoughtworks.go.matchers.ConsoleOutMatcher.java
public static TypeSafeMatcher<String> printedExcRunIfInfo(final String command, final String args, final String status) { return new TypeSafeMatcher<String>() { public String consoleOut; public String message; public boolean matchesSafely(String consoleOut) { this.consoleOut = consoleOut; if (StringUtils.isEmpty(args)) { this.message = format("[%s] Current job status: %s", GoConstants.PRODUCT_NAME, status); this.message = format("[%s] Task: %s", GoConstants.PRODUCT_NAME, command); } else { this.message = format("[%s] Current job status: %s", GoConstants.PRODUCT_NAME, status); this.message = format("[%s] Task: %s %s", GoConstants.PRODUCT_NAME, command, args); }/*from ww w.ja va 2 s .com*/ return StringUtils.contains(consoleOut, message); } public void describeTo(Description description) { description.appendText("Expected console to contain [" + message + "] but was " + consoleOut); } }; }
From source file:io.wcm.handler.media.MediaArgsTest.java
@Test public void testToString() throws Exception { MediaArgs mediaArgs = new MediaArgs().altText("abc"); assertTrue(StringUtils.contains(mediaArgs.toString(), "abc")); }
From source file:io.wcm.handler.mediasource.inline.InlineMediaSource.java
/** * Make sure filename contains no invalid characters or path parts * @param fileName File name// w w w . j ava2 s . co m * @return Cleaned up file name */ private String cleanupFileName(String fileName) { String processedFileName = fileName; // strip off path parts if (StringUtils.contains(processedFileName, "/")) { processedFileName = StringUtils.substringAfterLast(processedFileName, "/"); } if (StringUtils.contains(processedFileName, "\\")) { processedFileName = StringUtils.substringAfterLast(processedFileName, "\\"); } // make sure filename does not contain any invalid characters processedFileName = Escape.validFilename(processedFileName); return processedFileName; }
From source file:com.alibaba.rocketmq.filtersrv.filter.DynaCode.java
public static String getClassName(String code) { String className = StringUtils.substringBefore(code, "{"); if (StringUtils.isBlank(className)) { return className; }// w w w. j a va2s . c o m if (StringUtils.contains(code, " class ")) { className = StringUtils.substringAfter(className, " class "); if (StringUtils.contains(className, " extends ")) { className = StringUtils.substringBefore(className, " extends ").trim(); } else if (StringUtils.contains(className, " implements ")) { className = StringUtils.trim(StringUtils.substringBefore(className, " implements ")); } else { className = StringUtils.trim(className); } } else if (StringUtils.contains(code, " interface ")) { className = StringUtils.substringAfter(className, " interface "); if (StringUtils.contains(className, " extends ")) { className = StringUtils.substringBefore(className, " extends ").trim(); } else { className = StringUtils.trim(className); } } else if (StringUtils.contains(code, " enum ")) { className = StringUtils.trim(StringUtils.substringAfter(className, " enum ")); } else { return StringUtils.EMPTY; } return className; }
From source file:ee.ria.xroad.asyncdb.AsyncDBIntegrationTest.java
private static void sendFirstRequestSuccessfully() throws Exception { LOG.info("TEST 6: sendFirstRequestSuccessfully - STARTED"); String expectedSoap = AsyncDBTestUtil.getFirstSoapRequest().getXml(); SendingCtx sendingCtx = queue.startSending(); String firstRequestContent = IOUtils.toString(sendingCtx.getInputStream()); if (!StringUtils.contains(firstRequestContent, expectedSoap)) { throw new IntegrationTestFailedException("Message input stream does not contain expected content."); }//w w w . ja v a 2 s . com validateContentType(0); // Between starting and committing request must be in state 'sending'. RequestInfo expectedRequestInfo = RequestInfo.markSending(getFirstRequest()); validateRequestInfo(expectedRequestInfo); sendingCtx.success(LAST_SEND_RESULT_SUCCESS); QueueInfo expectedQueueInfo = new QueueInfo(AsyncDBTestUtil.getProvider(), new QueueState(1, 1, new Date(), 0, "1234567890", new Date(), LAST_SEND_RESULT_SUCCESS)); validateQueueInfo(expectedQueueInfo); int expectedRequestsSize = 1; int actualRequestsSize = queue.getRequests().size(); if (actualRequestsSize != expectedRequestsSize) { throw new IntegrationTestFailedException("There must be " + expectedRequestsSize + " request(s) under provider, but there is " + actualRequestsSize); } SUCCESSFUL_STEPS.add("sendFirstRequestSuccessfully"); LOG.info("TEST 6: sendFirstRequestSuccessfully - FINISHED"); }
From source file:com.thoughtworks.go.matchers.ConsoleOutMatcher.java
public static TypeSafeMatcher<String> printedAppsMissingInfoOnUnix(final String app) { return new TypeSafeMatcher<String>() { public String consoleOut; public String message; public boolean matchesSafely(String consoleOut) { this.consoleOut = consoleOut; message = format("Please make sure [%s] can be executed on this agent", app); return StringUtils.contains(consoleOut, message); }/*from w ww. j av a 2s.c o m*/ public void describeTo(Description description) { description.appendText("Expected console to contain [" + message + "] but was " + consoleOut); } }; }