List of usage examples for java.lang System getProperties
public static Properties getProperties()
From source file:es.uvigo.ei.sing.jarvest.core.HTTPUtils.java
private static HttpClient createClient() { @SuppressWarnings("deprecation") Protocol easyhttps = new Protocol("https", new EasySSLProtocolSocketFactory(), 443); Protocol.registerProtocol("https", easyhttps); if (System.getProperty("httpclient.useragent") == null) { System.getProperties().setProperty("httpclient.useragent", DEFAULT_USER_AGENT); }/*from w w w . jav a2s . c om*/ HttpClient client = new HttpClient(); if (System.getProperty("http.proxyHost") != null && System.getProperty("http.proxyPort") != null) { client.getHostConfiguration().setProxy(System.getProperty("http.proxyHost"), Integer.parseInt(System.getProperty("http.proxyPort"))); } client.getParams().setCookiePolicy(CookiePolicy.BROWSER_COMPATIBILITY); client.getParams().setBooleanParameter("http.protocol.single-cookie-header", true); return client; }
From source file:com.cognifide.qa.bb.config.ConfigStrategy.java
/** * Determines how the loaded configuration is overriden with system properties, e.g. parameteres provided via * command-line./*from ww w . j av a 2 s. c o m*/ * * @param properties the {@link Properties} containing the default and user configuration * @return {@link Properties} with overrides from system properties */ default Properties overrideFromSystemProperties(Properties properties) { System.getProperties().stringPropertyNames().stream().forEach(key -> { String systemProperty = System.getProperty(key); if (StringUtils.isNotBlank(systemProperty)) { properties.setProperty(key, systemProperty); } }); return properties; }
From source file:gemlite.core.internal.support.system.ServerConfigHelper.java
public static Integer getInteger(String name) { Object val = System.getProperties().get(name); if (val instanceof Integer) return (Integer) System.getProperties().get(name); else//from w w w .j a va 2 s . c om return NumberUtils.toInt(val.toString()); }
From source file:ch.cyberduck.core.sds.SDSMoveFeatureTest.java
@Test public void testMove() throws Exception { final Host host = new Host(new SDSProtocol(), "duck.ssp-europe.eu", new Credentials( System.getProperties().getProperty("sds.user"), System.getProperties().getProperty("sds.key"))); final SDSSession session = new SDSSession(host, new DisabledX509TrustManager(), new DefaultX509KeyManager()); session.open(new DisabledHostKeyCallback()); session.login(new DisabledPasswordStore(), new DisabledLoginCallback(), new DisabledCancelCallback(), PathCache.empty());//w ww.j av a2 s. c o m final Path room = new SDSDirectoryFeature(session) .mkdir(new Path(new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory, Path.Type.volume)), null, new TransferStatus()); final Path test = new Path(room, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)); new SDSTouchFeature(session).touch(test, new TransferStatus()); final Path target = new Path(room, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)); new SDSMoveFeature(session).move(test, target, new TransferStatus(), new Delete.DisabledCallback(), new DisabledConnectionCallback()); assertFalse(new SDSFindFeature(session).find(test)); assertTrue(new SDSFindFeature(session).find(target)); new SDSDeleteFeature(session).delete(Collections.singletonList(room), new DisabledLoginCallback(), new Delete.DisabledCallback()); session.close(); }
From source file:ch.cyberduck.core.spectra.SpectraWriteFeatureTest.java
@Test public void testWriteOverwrite() throws Exception { final Host host = new Host(new SpectraProtocol() { @Override// w w w . j a v a 2 s. c o m public Scheme getScheme() { return Scheme.http; } }, System.getProperties().getProperty("spectra.hostname"), Integer.valueOf(System.getProperties().getProperty("spectra.port")), new Credentials(System.getProperties().getProperty("spectra.user"), System.getProperties().getProperty("spectra.key"))); final SpectraSession session = new SpectraSession(host, new DisabledX509TrustManager(), new DefaultX509KeyManager()); session.open(new DisabledHostKeyCallback()); session.login(new DisabledPasswordStore(), new DisabledLoginCallback(), new DisabledCancelCallback()); final Path container = new Path("cyberduck", EnumSet.of(Path.Type.directory, Path.Type.volume)); final Path test = new Path(container, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)); final byte[] content = RandomUtils.nextBytes(1000); final TransferStatus status = new TransferStatus().length(content.length); status.setChecksum(new CRC32ChecksumCompute().compute(new ByteArrayInputStream(content), status)); // Allocate final SpectraBulkService bulk = new SpectraBulkService(session); bulk.pre(Transfer.Type.upload, Collections.singletonMap(test, status), new DisabledConnectionCallback()); { final OutputStream out = new SpectraWriteFeature(session).write(test, status, new DisabledConnectionCallback()); assertNotNull(out); new StreamCopier(new TransferStatus(), new TransferStatus()).transfer(new ByteArrayInputStream(content), out); out.close(); } assertEquals(content.length, new S3AttributesFinderFeature(session).find(test).getSize()); // Overwrite bulk.pre(Transfer.Type.upload, Collections.singletonMap(test, status.exists(true)), new DisabledConnectionCallback()); { final OutputStream out = new SpectraWriteFeature(session).write(test, status.exists(true), new DisabledConnectionCallback()); new StreamCopier(new TransferStatus(), new TransferStatus()).transfer(new ByteArrayInputStream(content), out); out.close(); } assertEquals(content.length, new S3AttributesFinderFeature(session).find(test).getSize()); new SpectraDeleteFeature(session).delete(Collections.singletonList(test), new DisabledLoginCallback(), new Delete.DisabledCallback()); session.close(); }
From source file:com.srotya.tau.api.dao.TestTemplateManager.java
@BeforeClass public static void beforeClass() throws Exception { Properties config = new Properties(System.getProperties()); File db = new File(TARGET_RULES_DB); if (db.exists()) { FileUtils.deleteDirectory(db);/*w ww .j a v a2s .co m*/ } config.setProperty("javax.persistence.jdbc.url", CONNECTION_STRING); try { emf = Persistence.createEntityManagerFactory("tau", config); } catch (Exception e) { e.printStackTrace(); throw e; } EntityManager em = emf.createEntityManager(); RuleGroup ruleGroup = new RuleGroup(); ruleGroup.setRuleGroupId(RULE_GROUP_ID_1); ruleGroup.setRuleGroupName(TEST_RULE_GROUP); RuleGroupManager.getInstance().createRuleGroup(em, ruleGroup); em.close(); }
From source file:cc.kune.core.server.mail.MailServiceDefault.java
/** * Instantiates a new mail service default. * //from ww w. j a v a2 s . c o m * @param kuneProperties * the kune properties */ @Inject public MailServiceDefault(final KuneProperties kuneProperties) { final String smtpServer = kuneProperties.get(KuneProperties.SITE_SMTP_HOST); smtpDefaultFrom = kuneProperties.get(KuneProperties.SITE_SMTP_DEFAULT_FROM); smtpSkip = kuneProperties.getBoolean(KuneProperties.SITE_SMTP_SKIP); props = System.getProperties(); props.put("mail.smtp.host", smtpServer); }
From source file:ch.cyberduck.core.sds.SDSReadFeatureTest.java
@Test(expected = NotfoundException.class) public void testReadNotFound() throws Exception { final Host host = new Host(new SDSProtocol(), "duck.ssp-europe.eu", new Credentials( System.getProperties().getProperty("sds.user"), System.getProperties().getProperty("sds.key"))); final SDSSession session = new SDSSession(host, new DisabledX509TrustManager(), new DefaultX509KeyManager()); session.open(new DisabledHostKeyCallback()); session.login(new DisabledPasswordStore(), new DisabledLoginCallback(), new DisabledCancelCallback()); final TransferStatus status = new TransferStatus(); final Path room = new SDSDirectoryFeature(session) .mkdir(new Path(new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory, Path.Type.volume)), null, new TransferStatus()); try {//w w w. ja v a 2 s .com new SDSReadFeature(session).read(new Path(room, "nosuchname", EnumSet.of(Path.Type.file)), status, new DisabledConnectionCallback()); } finally { new SDSDeleteFeature(session).delete(Collections.singletonList(room), new DisabledLoginCallback(), new Delete.DisabledCallback()); session.close(); } }
From source file:ch.cyberduck.core.irods.IRODSReadFeatureTest.java
@Test public void testRead() throws Exception { final ProtocolFactory factory = new ProtocolFactory( new HashSet<>(Collections.singleton(new IRODSProtocol()))); final Profile profile = new ProfilePlistReader(factory) .read(new Local("../profiles/iRODS (iPlant Collaborative).cyberduckprofile")); final Host host = new Host(profile, profile.getDefaultHostname(), new Credentials(System.getProperties().getProperty("irods.key"), System.getProperties().getProperty("irods.secret"))); final IRODSSession session = new IRODSSession(host); session.open(new DisabledHostKeyCallback()); session.login(new DisabledPasswordStore(), new DisabledLoginCallback(), new DisabledCancelCallback()); final Path test = new Path(new IRODSHomeFinderService(session).find(), UUID.randomUUID().toString(), EnumSet.of(Path.Type.file)); assertFalse(session.getFeature(Find.class).find(test)); final byte[] content = RandomUtils.nextBytes(2048); final TransferStatus status = new TransferStatus(); status.setLength(content.length);/*from ww w. j a v a 2s .com*/ status.setAppend(false); final OutputStream out = new IRODSWriteFeature(session).write(test, status, new DisabledConnectionCallback()); assertNotNull(out); new StreamCopier(status, status).transfer(new ByteArrayInputStream(content), out); out.close(); assertTrue(session.getFeature(Find.class).find(test)); final InputStream in = new IRODSReadFeature(session).read(test, status, new DisabledConnectionCallback()); assertNotNull(in); in.close(); session.getFeature(Delete.class).delete(Arrays.asList(test), new DisabledLoginCallback(), new Delete.DisabledCallback()); assertFalse(session.getFeature(Find.class).find(test)); session.close(); }
From source file:com.egt.core.aplicacion.Bitacora.java
private static String getKeyValue(String key) { String clave = key;//from w w w . j ava 2 s .c o m String value = System.getenv(clave); if (StringUtils.isBlank(value)) { System.out.println(clave + "="); clave = key.replace('_', '.').toLowerCase(); value = System.getProperties().getProperty(clave); } String trimmed = StringUtils.trimToEmpty(value); System.out.println(clave + "=" + trimmed); return trimmed; }