private String extractCheckerLog(List<WaitChecker> checkers) { List<String> logOut = new ArrayList<>(); for (WaitChecker checker : checkers) { logOut.add(checker.getLogLabel()); } return StringUtils.join(logOut.toArray(), " and "); }
protected String getCommandAsString() { return StringUtils.join(getArgs(), " "); }
/** * Resolve image with an external image resolver * * @param images the original image config list (can be null) * @param imageResolver the resolver used to extend on an image configuration * @param imageNameFilter filter to select only certain image configurations with the given name * @param imageCustomizer final customization hook for mangling the configuration * @return a list of resolved and customized image configuration. */ public static List<ImageConfiguration> resolveImages(Logger logger, List<ImageConfiguration> images, Resolver imageResolver, String imageNameFilter, Customizer imageCustomizer) { List<ImageConfiguration> ret = resolveConfiguration(imageResolver, images); ret = imageCustomizer.customizeConfig(ret); List<ImageConfiguration> filtered = filterImages(imageNameFilter,ret); if (ret.size() > 0 && filtered.size() == 0 && imageNameFilter != null) { List<String> imageNames = new ArrayList<>(); for (ImageConfiguration image : ret) { imageNames.add(image.getName()); } logger.warn("None of the resolved images [%s] match the configured filter '%s'", StringUtils.join(imageNames.iterator(), ","), imageNameFilter); } return filtered; }
/** * @return the default excludes pattern as comma separated string. * @see DirectoryScanner#DEFAULTEXCLUDES * @see StringUtils#join(Object[], String) */ @Nonnull public static String getDefaultExcludesAsString() { return StringUtils.join( DirectoryScanner.DEFAULTEXCLUDES, "," ); }
/** * <p>Concatenates elements of an array into a single String.</p> * <p/> * <p>The difference from join is that concatenate has no delimiter.</p> * * @param array the array of values to concatenate. * @return the concatenated string. */ @Nonnull public static String concatenate( @Nonnull Object... array ) { return join( array, "" ); }
/** {@inheritDoc} */ public String toString() { return StringUtils.join( getShellCommandline( true ), " " ); }
private String formatPortsAsList(List<ServicePort> ports) { List<String> p = new ArrayList<>(); for (ServicePort port : ports) { String targetPort = getPortValue(port.getTargetPort()); String servicePort= port.getPort() != null ? Integer.toString(port.getPort()) : targetPort; p.add(targetPort.equals(servicePort) ? targetPort : servicePort + ":" + targetPort); } return StringUtils.join(p.iterator(), ","); }
private String formatPortsAsList(List<ServicePort> ports) { List<String> p = new ArrayList<>(); for (ServicePort port : ports) { String targetPort = getPortValue(port.getTargetPort()); String servicePort= port.getPort() != null ? Integer.toString(port.getPort()) : targetPort; p.add(targetPort.equals(servicePort) ? targetPort : servicePort + ":" + targetPort); } return StringUtils.join(p.iterator(), ","); }
/** * Simple way to make a directory * * @param dir the directory to create * @throws IllegalArgumentException if the dir contains illegal Windows characters under Windows OS. * @see #INVALID_CHARACTERS_FOR_WINDOWS_FILE_NAME */ public static void mkdir( @Nonnull String dir ) { File file = new File( dir ); if ( Os.isFamily( Os.FAMILY_WINDOWS ) && !isValidWindowsFileName( file ) ) { throw new IllegalArgumentException( "The file (" + dir + ") cannot contain any of the following characters: \n" + StringUtils.join( INVALID_CHARACTERS_FOR_WINDOWS_FILE_NAME, " " ) ); } if ( !file.exists() ) { //noinspection ResultOfMethodCallIgnored file.mkdirs(); } }
/** * <p>Reverses a String that is delimited by a specific character.</p> * <p/> * <p>The Strings between the delimiters are not reversed. * Thus java.lang.String becomes String.lang.java (if the delimiter * is <code>'.'</code>).</p> * * @param str the String to reverse * @param delimiter the delimiter to use * @return the reversed String */ @Nonnull public static String reverseDelimitedString( @Nonnull String str, String delimiter ) { // could implement manually, but simple way is to reuse other, // probably slower, methods. String[] strs = split( str, delimiter ); reverseArray( strs ); return join( strs, delimiter ); }
+ StringUtils.join( INVALID_CHARACTERS_FOR_WINDOWS_FILE_NAME, " " ) );
public String getMavenVersion() throws IOException, LauncherException { File logFile; try { logFile = File.createTempFile( "maven", "log" ); } catch ( IOException e ) { throw new LauncherException( "Error creating temp file", e ); } // disable EMMA runtime controller port allocation, should be harmless if EMMA is not used Map<String, String> envVars = Collections.singletonMap( "MAVEN_OPTS", "-Demma.rt.control=false" ); run( new String[] { "--version" }, new Properties(), envVars, null, logFile ); List<String> logLines = FileUtils.loadFile( logFile ); // noinspection ResultOfMethodCallIgnored logFile.delete(); String version = extractMavenVersion( logLines ); if ( version == null ) { throw new LauncherException( "Illegal Maven output: String 'Maven' not found in the following output:\n" + StringUtils.join( logLines.iterator(), "\n" ) ); } else { return version; } }
"Exit code was non-zero: " + ret + "; command line and log = \n" + new File( defaultMavenHome, "bin/mvn" ) + " " + StringUtils.join( args.iterator(), " " ) + "\n" + getLogContents( logFile ) );
+ StringUtils.join(nonGwtProjects.iterator(), ", "));
+ StringUtils.join( project.getTestCompileSourceRoots() .iterator(), "\n " ) ); + StringUtils.join( project.getTestCompileSourceRoots() .iterator(), "\n " ) ); + StringUtils.join( project.getCompileSourceRoots() .iterator(), "\n " ) ); getLog().debug( "New compile source roots:\n " + StringUtils.join( project.getCompileSourceRoots() .iterator(), "\n " ) );
+ StringUtils.join( project.getTestCompileSourceRoots() .iterator(), "\n " ) ); + StringUtils.join( project.getTestCompileSourceRoots() .iterator(), "\n " ) ); + StringUtils.join( project.getCompileSourceRoots() .iterator(), "\n " ) ); getLog().debug( "New compile source roots:\n " + StringUtils.join( project.getCompileSourceRoots() .iterator(), "\n " ) );