List of usage examples for java.lang System getenv
public static String getenv(String name)
From source file:com.seleniumtests.connectors.extools.SoapUi.java
private void checkInstallation() { soapUiPath = System.getenv("SOAPUI_HOME"); if (soapUiPath == null) { throw new ConfigurationException( "To use SoapUI, install it and create env var SOAPUI_HOME pointing to root installation path"); }//from w ww .ja v a2 s .c o m if (!Paths.get(soapUiPath, "bin").toFile().exists()) { throw new ConfigurationException( String.format("Path %s does not contain SOAP UI installation", soapUiPath)); } if (OSUtility.getCurrentPlatorm() == Platform.WINDOWS) { soapUiPath = Paths.get(soapUiPath, "bin", "testrunner.bat").toString(); } else { soapUiPath = Paths.get(soapUiPath, "bin", "testrunner.sh").toString(); } }
From source file:com.teradata.benchto.driver.macro.shell.ShellMacroExecutionDriverTest.java
@Test public void shouldExecuteMacro() throws IOException { String filename = "/tmp/" + UUID.randomUUID().toString(); String suffix = System.getenv("USER"); macroService.runBenchmarkMacro("create-file", ImmutableMap.of("FILENAME", filename)); Path path = Paths.get(filename + suffix); assertThat(exists(path)).isTrue();/*from www .j a v a 2 s .c o m*/ delete(path); }
From source file:com.intuit.tank.vm.settings.CloudCredentials.java
/** * @return the keyId/*w w w . java2s . co m*/ */ public String getKeyId() { // first try userData String ret = AmazonUtil.getAWSKeyIdFromUserData(); if (StringUtils.isBlank(ret)) { // try to get from property String key = config.getString("secret-key-id-property", "AWS_SECRET_KEY_ID"); ret = System.getProperty(key); if (StringUtils.isBlank(ret)) { ret = System.getenv(key); } if (StringUtils.isBlank(ret)) { // finally get straight from config ret = config.getString("secret-key-id"); } } return ret; }
From source file:uk.ac.jorum.integration.RestApiBaseTest.java
protected static String jettyPath() { return System.getenv("jetty.path"); }
From source file:io.kahu.hawaii.service.io.LocationHelper.java
public String getHawaiiDocumentationDocRoot() { if (hawaiiDocumentationDocRoot == null) { hawaiiDocumentationDocRoot = System.getenv("HAWAII_DOCUMENTATION_DOCROOT"); }/*w w w. j av a 2 s. co m*/ return hawaiiDocumentationDocRoot; }
From source file:net.maritimecloud.portal.infrastructure.mail.SmtpMailAdapterITTest.java
@Test public void shouldSendTestMailToDeveloperIfConfigured() throws IOException { if (System.getenv("mail.smtp.password") == null) { LOG.warn("SmtpMailAdapter test skipped - (because 'mail.smtp.password' is not set)"); //echoEnvironmentVariables(); return;/* w ww . j a va2 s. c o m*/ } LOG.warn("Sending a test-email (because 'mail.smtp.password' is set)"); Mail mail = new Mail("", "Maritime Cloud Portal test mail", "Unit test build at " + new Date()); mailAdapter.send(mail); }
From source file:com.example.managedvms.twilio.SendSmsServlet.java
@Override public void service(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException { final String twilioAccountSid = System.getenv("TWILIO_ACCOUNT_SID"); final String twilioAuthToken = System.getenv("TWILIO_AUTH_TOKEN"); final String twilioNumber = System.getenv("TWILIO_NUMBER"); final String toNumber = (String) req.getParameter("to"); if (toNumber == null) { resp.getWriter().print("Please provide the number to message in the \"to\" query string parameter."); return;/* w w w.j a v a 2 s .c o m*/ } TwilioRestClient client = new TwilioRestClient(twilioAccountSid, twilioAuthToken); Account account = client.getAccount(); MessageFactory messageFactory = account.getMessageFactory(); List<NameValuePair> params = new ArrayList<NameValuePair>(); params.add(new BasicNameValuePair("To", toNumber)); params.add(new BasicNameValuePair("From", twilioNumber)); params.add(new BasicNameValuePair("Body", "Hello from Twilio!")); try { Message sms = messageFactory.create(params); resp.getWriter().print(sms.getBody()); } catch (TwilioRestException e) { throw new ServletException("Twilio error", e); } }
From source file:com.francetelecom.clara.cloud.commons.JasyptPrerequisites.java
private void assertJasyptPrerequisites(String passPhraseEnvName, String passPhraseJndiName) { Validate.notEmpty(passPhraseEnvName, "passPhraseEnvName cannot be empty, neither null"); String passPhrase = System.getenv(passPhraseEnvName); if (!isPassPhraseCorrect(passPhrase)) { try {//from w w w. ja v a2 s.co m InitialContext ctx = new InitialContext(); String jndiValue = (String) ctx.lookup(passPhraseJndiName); passPhrase = jndiValue; } catch (NamingException e) { logger.info("No Jndi jasypt secret named " + passPhraseJndiName, e); } } if (!isPassPhraseCorrect(passPhrase)) { throw new TechnicalException( "Jasypt require pass phrase into environment or jndi variables : '" + passPhraseEnvName + "'"); } }
From source file:org.slf4j.impl.PiazzaLogger.java
/** * Initializes the logger component. This will scan the environment for the URL to Piazza Logger REST endpoint. *//*from w ww . j a v a 2 s . c om*/ static void init() { if (INITIALIZED) { return; } INITIALIZED = true; // Scan the environment for the URL to Pz-Logger PZ_LOGGER_URL = System.getenv("logger.url"); System.out.println( String.format("PiazzaLogger initialized for service %s, url: %s", "serviceName", PZ_LOGGER_URL)); HttpClient httpClient = HttpClientBuilder.create().setMaxConnTotal(7500).setMaxConnPerRoute(4000).build(); restTemplate.setRequestFactory(new HttpComponentsClientHttpRequestFactory(httpClient)); }
From source file:net.netheos.pcsapi.providers.StorageProviderFactory.java
/** * junit factory for injection of storage object into test constructors. * * @return collection of storage providers * @throws IOException//from w w w .ja v a 2 s. c om */ public static Collection<Object[]> storageProviderFactory() throws IOException { String path = System.getProperty("pcsapiRepositoryDir"); if (path == null) { path = System.getenv("PCS_API_REPOSITORY_DIR"); } if (path == null) { path = "../repositories"; } File repository = new File(path); String providers = System.getProperty("pcsapiProviders"); boolean allProviders = false; if (providers == null) { allProviders = true; } File appRepoFile = new File(repository, "app_info_data.txt"); if (!appRepoFile.exists()) { LOGGER.warn("No app info file found for functional tests: {}" + " Set PCS_API_REPOSITORY_DIR environment variable," + " or set pcsapiRepositoryDir system property", appRepoFile); LOGGER.warn("No functional test will be run"); return Collections.EMPTY_LIST; // list of providers to be tested } appRepo = new AppInfoFileRepository(appRepoFile); File credRepoFile = new File(repository, "user_credentials_data.txt"); credRepo = new UserCredentialsFileRepository(credRepoFile); Collection<Object[]> values = new ArrayList<Object[]>(); for (String providerName : StorageFacade.getRegisteredProviders()) { if (allProviders || providers.contains(providerName)) { HttpClient httpClient = buildDedicatedHttpClient(providerName); addProvider(values, providerName, httpClient); } } return values; }