public LogConfigurator(String childLogbackConfigFile) { this(new SystemEnvironment().getConfigDir(), childLogbackConfigFile); }
@Autowired public DefaultPluginJarLocationMonitor(SystemEnvironment systemEnvironment) { this.systemEnvironment = systemEnvironment; this.bundledPluginDirectory = new File(this.systemEnvironment.get(PLUGIN_GO_PROVIDED_PATH)); this.externalPluginDirectory = new File(this.systemEnvironment.get(PLUGIN_EXTERNAL_PROVIDED_PATH)); }
SystemEnvironment systemEnvironment = new SystemEnvironment(); systemEnvironment.setProperty(GENERATE_STATISTICS, "true"); systemEnvironment.setProperty(SystemEnvironment.PARENT_LOADER_PRIORITY, "true"); systemEnvironment.setProperty(SystemEnvironment.CRUISE_SERVER_WAR_PROPERTY, webApp.getAbsolutePath()); systemEnvironment.set(SystemEnvironment.PLUGIN_LOCATION_MONITOR_INTERVAL_IN_SECONDS, 5); systemEnvironment.set(SystemEnvironment.DEFAULT_PLUGINS_ZIP, "/plugins.zip"); systemEnvironment.set(SystemEnvironment.PLUGIN_ACTIVATOR_JAR_PATH, "go-plugin-activator.jar"); systemEnvironment.set(SystemEnvironment.FAIL_STARTUP_ON_DATA_ERROR, true); systemEnvironment.setProperty(GoConstants.I18N_CACHE_LIFE, "0"); //0 means reload when stale systemEnvironment.set(SystemEnvironment.GO_SERVER_MODE, "development"); setupPeriodicGC(systemEnvironment); assertPluginsZipExists(); GoServer server = new GoServer(); systemEnvironment.setProperty(GoConstants.USE_COMPRESSED_JAVASCRIPT, Boolean.toString(false)); try { server.startServer(); String hostName = systemEnvironment.getListenHost(); if (hostName == null) { hostName = "localhost"; System.out.println("GoCD server dashboard started on http://" + hostName + ":" + systemEnvironment.getServerPort()); System.out.println("* credentials: \"admin\" / \"badger\""); } catch (Exception e) {
private static void setupPeriodicGC(SystemEnvironment systemEnvironment) { systemEnvironment.set(SystemEnvironment.GO_CONFIG_REPO_GC_LOOSE_OBJECT_WARNING_THRESHOLD, 100L); systemEnvironment.set(SystemEnvironment.GO_CONFIG_REPO_PERIODIC_GC, true); systemEnvironment.set(SystemEnvironment.GO_CONFIG_REPO_GC_AGGRESSIVE, true); systemEnvironment.setProperty("go.config.repo.gc.cron", "0 0/1 * 1/1 * ?"); systemEnvironment.setProperty("go.config.repo.gc.check.interval", "10000"); }
public String getCruiseConfigFile() { return getPropertyImpl(CONFIG_FILE_PROPERTY, getConfigDir() + "/cruise-config.xml"); }
@Before public void setUp() { new SystemEnvironment().setProperty(SystemEnvironment.INTERVAL, "1"); }
public X509Certificate generate(PrivateKey caPrivKey) throws Exception { ContentSigner contentSigner = new JcaContentSignerBuilder(new SystemEnvironment().get(GO_SSL_CERTS_PUBLIC_KEY_ALGORITHM)).setProvider("BC").build(caPrivKey); return new JcaX509CertificateConverter().setProvider("BC").getCertificate(v3CertGen.build(contentSigner)); } }
Mockito.doNothing().when(deploymentManager).addApp(appCaptor.capture()); when(systemEnvironment.getServerPort()).thenReturn(1234); when(systemEnvironment.keystore()).thenReturn(temporaryFolder.newFolder()); when(systemEnvironment.truststore()).thenReturn(temporaryFolder.newFolder()); when(systemEnvironment.getWebappContextPath()).thenReturn("context"); when(systemEnvironment.getCruiseWar()).thenReturn("cruise.war"); when(systemEnvironment.getParentLoaderPriority()).thenReturn(true); when(systemEnvironment.useCompressedJs()).thenReturn(true); when(systemEnvironment.get(SystemEnvironment.RESPONSE_BUFFER_SIZE)).thenReturn(1000); when(systemEnvironment.get(SystemEnvironment.IDLE_TIMEOUT)).thenReturn(2000); when(systemEnvironment.configDir()).thenReturn(configDir = temporaryFolder.newFile()); when(systemEnvironment.get(SystemEnvironment.GO_SSL_RENEGOTIATION_ALLOWED)).thenReturn(true); when(systemEnvironment.getJettyConfigFile()).thenReturn(new File("foo")); when(systemEnvironment.isSessionCookieSecure()).thenReturn(false); when(systemEnvironment.sessionTimeoutInSeconds()).thenReturn(1234); when(systemEnvironment.sessionCookieMaxAgeInSeconds()).thenReturn(5678); when(systemEnvironment.get(SystemEnvironment.GO_SSL_CONFIG_CLEAR_JETTY_DEFAULT_EXCLUSIONS)).thenReturn(true);
@After public void tearDown() { if (realConfigDir != null) { new SystemEnvironment().setProperty("cruise.config.dir", realConfigDir); } else { new SystemEnvironment().clearProperty("cruise.config.dir"); } }
@Before public void setUp() throws Exception { handler = new WebSocketSessionHandler(new SystemEnvironment()); session = mock(Session.class); handler.setSession(session); }
@Before public void setUp() { realConfigDir = new SystemEnvironment().getPropertyImpl("cruise.config.dir"); new SystemEnvironment().setProperty("cruise.config.dir", new SystemEnvironment().getPropertyImpl("java.io.tmpdir")); }
public static void main(String[] args) throws Exception { new ProcessRunner().command("curl", "http://localhost:8153/go/admin/agent-plugins.zip", "--fail", "--silent", "--output", "agent-plugins.zip").failOnError(false).run(); new ProcessRunner().command("curl", "http://localhost:8153/go/admin/tfs-impl.jar", "--fail", "--silent", "--output", "tfs-impl.jar").failOnError(false).run(); new SystemEnvironment().set(SystemEnvironment.PLUGIN_ACTIVATOR_JAR_PATH, "go-plugin-activator.jar"); assertActivationJarPresent(); AgentMain.main("-serverUrl", "https://localhost:8154/go"); }
@Override public void taggedConsumeLine(String tag, String line) { SystemEnvironment env = new SystemEnvironment(); if (env.isWebsocketsForAgentsEnabled() && env.isConsoleLogsThroughWebsocketEnabled()) { remoteBuildRepository.taggedConsumeLine(tag, line, jobIdentifier); } else { consoleOutputTransmitter.taggedConsumeLine(tag, line); } }
public VelocityContext getVelocityContext(Map<String, Object> modelMap, Class<? extends SparkController> controller, String viewName) { HashMap<String, Object> context = new HashMap<>(modelMap); context.put("railsAssetsService", railsAssetsService); context.put("webpackAssetsService", webpackAssetsService); context.put("securityService", securityService); context.put("maintenanceModeService", maintenanceModeService); context.put("currentUser", SessionUtils.currentUsername()); context.put("controllerName", humanizedControllerName(controller)); context.put("viewName", viewName); context.put("currentVersion", CurrentGoCDVersion.getInstance()); context.put("toggles", Toggles.class); context.put("goUpdate", versionInfoService.getGoUpdate()); context.put("goUpdateCheckEnabled", versionInfoService.isGOUpdateCheckEnabled()); context.put("serverTimezoneUTCOffset", TimeZone.getDefault().getOffset(new Date().getTime())); context.put("spaRefreshInterval", SystemEnvironment.goSpaRefreshInterval()); context.put("spaTimeout", SystemEnvironment.goSpaTimeout()); context.put("showAnalyticsDashboard", showAnalyticsDashboard()); context.put("devMode", !new SystemEnvironment().useCompressedJs()); return new VelocityContext(context); }
@Test public void shouldPopulateEnvironmentForServerUrl(){ new SystemEnvironment().setProperty("serviceUrl", "some_random_place"); EnvironmentVariableContext context = new EnvironmentVariableContext(); context.setProperty("GO_SERVER_URL", SystemEnvironment.getProperty("serviceUrl"), false); jobIdentifier().populateEnvironmentVariables(context); assertThat(context.getProperty("GO_SERVER_URL"), is("some_random_place")); }
@Test public void shouldUseSvnMaterialNameIfPresent() throws IOException { svnMaterial.setName(new CaseInsensitiveString("Cruise")); pipelineConfig.setMaterialConfigs(new MaterialConfigs(svnMaterial.config())); BuildAssignment buildAssigment = createAssignment(null); BuildWork work = new BuildWork(buildAssigment, systemEnvironment.consoleLogCharset()); EnvironmentVariableContext environmentVariableContext = new EnvironmentVariableContext(); new SystemEnvironment().setProperty("serviceUrl", "some_random_place"); AgentIdentifier agentIdentifier = new AgentIdentifier("somename", "127.0.0.1", AGENT_UUID); work.doWork(environmentVariableContext, new AgentWorkContext(agentIdentifier, new FakeBuildRepositoryRemote(), new GoArtifactsManipulatorStub(), new AgentRuntimeInfo(agentIdentifier, AgentRuntimeStatus.Idle, currentWorkingDirectory(), "cookie", false), packageRepositoryExtension, scmExtension, taskExtension, null, null)); assertThat(environmentVariableContext.getProperty("GO_REVISION_CRUISE"), is("3")); }
@Before public void setUp() throws Exception { systemEnvironment = spy(new SystemEnvironment()); aesCipherFile = systemEnvironment.getAESCipherFile(); desCipherFile = systemEnvironment.getDESCipherFile(); }
public void initialize() { UsageStatisticsReporting existingUsageStatisticsReporting = usageStatisticsReportingSqlMapDao.load(); if (existingUsageStatisticsReporting == null) { create(); } if (new SystemEnvironment().shouldFailStartupOnDataError()) { assert get() != null; } }
public URLService() { String url = new SystemEnvironment().getServiceUrl(); if (url.endsWith("/")) { url = url.substring(0, url.length() - 1); } baseRemotingURL = url; }