List of usage examples for java.lang System getProperties
public static Properties getProperties()
From source file:ch.cyberduck.core.b2.B2WriteFeatureTest.java
@Test public void testWriteChecksumFailure() throws Exception { final B2Session session = new B2Session(new Host(new B2Protocol(), new B2Protocol().getDefaultHostname(), new Credentials(System.getProperties().getProperty("b2.user"), System.getProperties().getProperty("b2.key")))); session.open(new DisabledHostKeyCallback()); session.login(new DisabledPasswordStore(), new DisabledLoginCallback(), new DisabledCancelCallback()); final Path bucket = new Path("test-cyberduck", EnumSet.of(Path.Type.directory, Path.Type.volume)); final Path file = new Path(bucket, UUID.randomUUID().toString(), EnumSet.of(Path.Type.file)); final TransferStatus status = new TransferStatus(); final byte[] content = RandomUtils.nextBytes(1); status.setLength(content.length);/*ww w. j a va 2 s .c o m*/ status.setChecksum(Checksum.parse("da39a3ee5e6b4b0d3255bfef95601890afd80709")); final HttpResponseOutputStream<BaseB2Response> out = new B2WriteFeature(session).write(file, status, new DisabledConnectionCallback()); IOUtils.write(content, out); try { out.close(); fail(); } catch (IOException e) { assertTrue(e.getCause() instanceof ChecksumException); } finally { session.close(); } }
From source file:ch.cyberduck.core.cryptomator.AzureDirectoryFeatureTest.java
@Test public void testMakeDirectoryEncrypted() throws Exception { final Host host = new Host(new AzureProtocol(), "kahy9boj3eib.blob.core.windows.net", new Credentials(System.getProperties().getProperty("azure.account"), System.getProperties().getProperty("azure.key"))); final AzureSession session = new AzureSession(host); session.open(new DisabledHostKeyCallback()); session.login(new DisabledPasswordStore(), new DisabledLoginCallback(), new DisabledCancelCallback()); final Path home = new Path("cyberduck", EnumSet.of(Path.Type.directory, Path.Type.volume)); final CryptoVault cryptomator = new CryptoVault( new Path(home, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory)), new DisabledPasswordStore()); final Path vault = cryptomator.create(session, null, new VaultCredentials("test")); session.withRegistry(/* w w w . j av a 2s .c o m*/ new DefaultVaultRegistry(new DisabledPasswordStore(), new DisabledPasswordCallback(), cryptomator)); final Path test = new CryptoDirectoryFeature<Void>(session, new AzureDirectoryFeature(session, null), new AzureWriteFeature(session, null), cryptomator) .mkdir(new Path(vault, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory)), null, new TransferStatus()); assertTrue(test.getType().contains(Path.Type.placeholder)); assertTrue(new CryptoFindFeature(session, new DefaultFindFeature(session), cryptomator).find(test)); new CryptoDeleteFeature(session, new AzureDeleteFeature(session, null), cryptomator) .delete(Arrays.asList(test, vault), new DisabledLoginCallback(), new Delete.DisabledCallback()); session.close(); }
From source file:com.agc.tmdb.Util.URLFetcher.java
/** * This is used to open a connection, Proxy details will be considered if provided. * @param url/*from ww w .jav a 2 s . c o m*/ * @return * @throws TMDbException */ public static URLConnection openConnection(URL url) throws TMDbException { try { if (proxyHost != null) { System.getProperties().put("proxySet", "true"); System.getProperties().put("proxyHost", proxyHost); System.getProperties().put("proxyPort", proxyPort); } URLConnection cnx = url.openConnection(); if (proxyUsername != null) { cnx.setRequestProperty("Proxy-Authorization", proxyEncodedPassword); } return cnx; } catch (IOException ex) { throw new TMDbException(TMDbExceptionTypes.EXCEPTION_INVALID_URL, null, ex); } }
From source file:net.seedboxer.jetty.DaemonServer.java
public DaemonServer() { try {//from w w w. j ava2 s . c om String configFile = System.getProperty(CONFIG_PATH + File.separator + PROEASY_PROPS); System.getProperties().load(new FileInputStream(configFile)); } catch (Exception ignored) { } port = Integer.parseInt(System.getProperty(WS_PORT_PROP, "8080")); }
From source file:ch.cyberduck.core.b2.B2ObjectListServiceTest.java
@Test public void testList() throws Exception { final B2Session session = new B2Session(new Host(new B2Protocol(), new B2Protocol().getDefaultHostname(), new Credentials(System.getProperties().getProperty("b2.user"), System.getProperties().getProperty("b2.key")))); session.open(new DisabledHostKeyCallback()); session.login(new DisabledPasswordStore(), new DisabledLoginCallback(), new DisabledCancelCallback()); final Path bucket = new B2DirectoryFeature(session) .mkdir(new Path(String.format("test-%s", UUID.randomUUID().toString()), EnumSet.of(Path.Type.directory, Path.Type.volume)), null, new TransferStatus()); final Path file = new Path(bucket, UUID.randomUUID().toString(), EnumSet.of(Path.Type.file)); final TransferStatus status = new TransferStatus(); status.setChecksum(Checksum.parse("da39a3ee5e6b4b0d3255bfef95601890afd80709")); final HttpResponseOutputStream<BaseB2Response> out = new B2WriteFeature(session).write(file, status, new DisabledConnectionCallback()); IOUtils.write(new byte[0], out); out.close();/* w w w .j a v a2s .c o m*/ final B2FileResponse resopnse = (B2FileResponse) out.getStatus(); final AttributedList<Path> list = new B2ObjectListService(session).list(bucket, new DisabledListProgressListener()); assertNotNull(list.find(new SimplePathPredicate(file))); assertEquals("1", list.find(new SimplePathPredicate(file)).attributes().getRevision()); assertEquals(0L, list.find(new SimplePathPredicate(file)).attributes().getSize()); new B2DeleteFeature(session).delete(Collections.singletonList(file), new DisabledLoginCallback(), new Delete.DisabledCallback()); assertFalse( new B2ObjectListService(session).list(bucket, new DisabledListProgressListener()).contains(file)); new B2DeleteFeature(session).delete(Collections.singletonList(bucket), new DisabledLoginCallback(), new Delete.DisabledCallback()); session.close(); }
From source file:ch.cyberduck.core.cryptomator.DAVDirectoryFeatureTest.java
@Test public void testMakeDirectoryEncrypted() throws Exception { final Host host = new Host(new DAVProtocol(), "test.cyberduck.ch", new Credentials(System.getProperties().getProperty("webdav.user"), System.getProperties().getProperty("webdav.password"))); host.setDefaultPath("/dav/basic"); final DAVSession session = new DAVSession(host); session.open(new DisabledHostKeyCallback()); session.login(new DisabledPasswordStore(), new DisabledLoginCallback(), new DisabledCancelCallback()); final Path home = new DefaultHomeFinderService(session).find(); final Path vault = new Path(home, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory)); final Path test = new Path(vault, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory)); final CryptoVault cryptomator = new CryptoVault(vault, new DisabledPasswordStore()); cryptomator.create(session, null, new VaultCredentials("test")); session.withRegistry(//w w w.j a v a2 s. c o m new DefaultVaultRegistry(new DisabledPasswordStore(), new DisabledPasswordCallback(), cryptomator)); new CryptoDirectoryFeature<String>(session, new DAVDirectoryFeature(session), new DAVWriteFeature(session), cryptomator).mkdir(test, null, new TransferStatus()); assertTrue(new CryptoFindFeature(session, new DefaultFindFeature(session), cryptomator).find(test)); new CryptoDeleteFeature(session, new DAVDeleteFeature(session), cryptomator) .delete(Arrays.asList(test, vault), new DisabledLoginCallback(), new Delete.DisabledCallback()); session.close(); }
From source file:ch.cyberduck.core.cryptomator.S3DirectoryFeatureTest.java
@Test public void testMakeDirectoryEncrypted() throws Exception { final Host host = new Host(new S3Protocol(), new S3Protocol().getDefaultHostname(), new Credentials( System.getProperties().getProperty("s3.key"), System.getProperties().getProperty("s3.secret"))); final S3Session session = new S3Session(host); session.open(new DisabledHostKeyCallback()); session.login(new DisabledPasswordStore(), new DisabledLoginCallback(), new DisabledCancelCallback()); final Path home = new Path("test-us-east-1-cyberduck", EnumSet.of(Path.Type.directory, Path.Type.volume)); final Path vault = new Path(home, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory)); final CryptoVault cryptomator = new CryptoVault(vault, new DisabledPasswordStore()); cryptomator.create(session, null, new VaultCredentials("test")); session.withRegistry(/*from w w w . ja va 2 s . c o m*/ new DefaultVaultRegistry(new DisabledPasswordStore(), new DisabledPasswordCallback(), cryptomator)); final Path test = new CryptoDirectoryFeature<StorageObject>(session, new S3DirectoryFeature(session, new S3WriteFeature(session)), new S3WriteFeature(session), cryptomator) .mkdir(new Path(vault, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory)), null, new TransferStatus()); assertTrue(test.getType().contains(Path.Type.placeholder)); assertTrue(new CryptoFindFeature(session, new DefaultFindFeature(session), cryptomator).find(test)); new CryptoDeleteFeature(session, new S3DefaultDeleteFeature(session), cryptomator) .delete(Arrays.asList(test, vault), new DisabledLoginCallback(), new Delete.DisabledCallback()); session.close(); }
From source file:io.gatling.mojo.Fork.java
public void run() throws Exception { if (propagateSystemProperties) { for (Entry<Object, Object> systemProp : System.getProperties().entrySet()) { String name = systemProp.getKey().toString(); String value = systemProp.getValue().toString(); if (isPropagatableProperty(name)) { String escapedValue = StringUtils.escape(value); String safeValue = escapedValue.contains(" ") ? '"' + escapedValue + '"' : escapedValue; this.jvmArgs.add("-D" + name + "=" + safeValue); }/*from w w w .j av a 2 s . c om*/ } } this.jvmArgs.add("-jar"); this.jvmArgs .add(MojoUtils.createBooterJar(classpath, MainWithArgsInFile.class.getName()).getCanonicalPath()); List<String> command = buildCommand(); Executor exec = new DefaultExecutor(); exec.setStreamHandler(new PumpStreamHandler(System.out, System.err, System.in)); exec.setProcessDestroyer(new ShutdownHookProcessDestroyer()); CommandLine cl = new CommandLine(javaExecutable); for (String arg : command) { cl.addArgument(arg, false); } int exitValue = exec.execute(cl); if (exitValue != 0) { throw new MojoFailureException("command line returned non-zero value:" + exitValue); } }
From source file:io.inkstand.it.StaticContentITCase.java
@Before public void setUp() throws Exception { originalProperties = System.getProperties(); port = NetworkUtils.findAvailablePort(); //we set the port to use a randomized port for testing, otherwise the default port 80 will be used System.setProperty("inkstand.http.port", String.valueOf(port)); }
From source file:ch.cyberduck.core.spectra.SpectraMultipleDeleteFeatureTest.java
@Test public void testDeleteFile() throws Exception { final Host host = new Host(new SpectraProtocol() { @Override//from w w w . j a v a 2s .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.volume)); final Path test = new Path(container, UUID.randomUUID().toString(), EnumSet.of(Path.Type.file)); final byte[] content = RandomUtils.nextBytes(1024); final HttpResponseOutputStream<StorageObject> out = new S3WriteFeature(session).write(test, new TransferStatus().length(content.length), new DisabledConnectionCallback()); IOUtils.write(content, out); out.close(); assertTrue(new S3FindFeature(session).find(test)); new S3MultipleDeleteFeature(session).delete(Arrays.asList(test, test), new DisabledLoginCallback(), new Delete.DisabledCallback()); assertFalse(new S3FindFeature(session).find(test)); session.close(); }