public boolean optionalAndMissingTag(Element e, ConfigTag tag, boolean optional) { boolean isMissingElement = !hasChild(e, tag); if (!optional && isMissingElement) { throw bomb("Non optional tag '" + tag + "' is not in config file. Found: " + elementOutput(e)); } return optional && isMissingElement; } }
public SslVerificationMode getAgentSslVerificationMode() { if (getPropertyImpl(AGENT_SSL_VERIFICATION_MODE) == null) { return SslVerificationMode.NONE; } return SslVerificationMode.valueOf(getPropertyImpl(AGENT_SSL_VERIFICATION_MODE)); }
public Element getChild(Element e, ConfigTag tag) { Element child = child(e, tag); if (child == null) { throw bomb("Error finding child '" + tag + "' in config: " + configFile + elementOutput(e)); } return child; }
public static void bombIf(boolean check, String msg) { if (check) { throw bomb(msg); } }
public GoArtifactsManipulatorStub(List<Property> properties, List<String> consoleOuts, HttpService service) { super(service, new URLService(), new ZipUtil()); this.properties = properties; this.consoleOuts = consoleOuts; }
void usePackagedCommandRepository(ZipInputStream zipInputStream, File defaultDirectory) throws IOException { FileUtil.deleteDirectoryNoisily(defaultDirectory); zipUtil.unzip(zipInputStream, defaultDirectory); }
public GoConfigRevision(String configXml, String md5, String username, String goVersion, TimeProvider provider) { this(configXml); this.md5 = md5; this.username = username; this.goVersion = goVersion; this.goEdition = "OpenSource"; this.time = provider.currentTime(); this.schemaVersion = GoConstants.CONFIG_SCHEMA_VERSION; }
private boolean isExpired(Clock clock, SystemEnvironment systemEnvironment) { return systemEnvironment.isReAuthenticationEnabled() && (clock.currentTimeMillis() - authenticatedAt) > systemEnvironment.getReAuthenticationTimeInterval(); }
public File done() throws IOException { ZipBuilder zipBuilder = zipUtil.zipContentsOfMultipleFolders(pluginsZipFile, true); zipBuilder.add("bundled", bundledPluginsDir).add("external", externalPluginsDir).add("dummy.txt", dummyFileSoZipFileIsNotEmpty).done(); return pluginsZipFile; } }
public File createUniqueFolder(String folder) { return mkdir(folder + clock.currentTimeMillis()); }
public void close() { close(process); ProcessManager.getInstance().processKilled(process); }
public static Document buildXmlDocument(InputStream inputStream, URL resource, String xsds) throws Exception { return buildXmlDocument(inputStream, new ValidatingSaxBuilder(resource, xsds)); }
private boolean nodeExists(File file, String xpath) { try { return XpathUtils.nodeExists(file, xpath); } catch (Exception ignored) { return false; } }
private int download(HttpService httpService, String url, FetchHandler handler) throws Exception { int returnCode = httpService.download(url, handler); while (returnCode == HttpServletResponse.SC_ACCEPTED) { clock.sleepForMillis(DOWNLOAD_SLEEP_MILLIS); returnCode = httpService.download(url, handler); } return returnCode; }
private String getUrl(String currentPath, String name) { return urlService.getRestfulArtifactUrl(jobIdentifier, getCurrentPath(currentPath) + name); }
/** * Do we have to traverse a symlink when trying to reach path from * basedir? * @param base base File (dir). * @param path file path. * @since Ant 1.6 */ private boolean isSymlink(File base, String path) { return isSymlink(base, SelectorUtils.tokenizePath(path)); }
public DatabaseDiskSpaceWarningChecker(EmailSender sender, SystemEnvironment systemEnvironment, GoConfigService goConfigService, final SystemDiskSpaceChecker diskSpaceChecker, ServerHealthService serverHealthService) { super(sender, systemEnvironment, systemEnvironment.getDbFolder(), goConfigService, DATABASE_DISK_FULL_ID, diskSpaceChecker); this.serverHealthService = serverHealthService; }
public void run() { readWriteLock.acquireWriteLock("foo"); numberOfLocks++; } }).start();
/** * Breaks a path up into a Vector of path elements, tokenizing on * <code>File.separator</code>. * * @param path Path to tokenize. Must not be <code>null</code>. * * @return a Vector of path elements from the tokenized path */ public static Vector tokenizePath (String path) { return tokenizePath(path, File.separator); }
public void setInsertedBefore(PipelineTimelineEntry insertedBefore) { if (this.insertedBefore != null) { throw bomb("cannot change insertedBefore for: " + this + " with " + insertedBefore); } this.insertedBefore = insertedBefore; }