List of usage examples for java.util EnumSet of
public static <E extends Enum<E>> EnumSet<E> of(E e)
From source file:ch.cyberduck.cli.TerminalTransferFactoryTest.java
@Test public void testFilter() throws Exception { final CommandLineParser parser = new PosixParser(); final Transfer transfer = new TerminalTransferFactory().create( parser.parse(TerminalOptionsBuilder.options(), new String[] { "--download", "rackspace://cdn.cyberduck.ch/remote/*.css" }), new Host(new SwiftProtocol()), new Path("/remote/*.css", EnumSet.of(Path.Type.directory)), Collections.<TransferItem>emptyList()); assertEquals(Transfer.Type.download, transfer.getType()); final PathCache cache = new PathCache(1); transfer.withCache(cache);// w w w. j a va2s. c o m cache.clear(); cache.put(new Path("/remote", EnumSet.of(Path.Type.directory)), new AttributedList<Path>( Collections.singletonList(new Path("/remote/file.css", EnumSet.of(Path.Type.file))))); assertFalse(transfer.list(null, null, new Path("/remote", EnumSet.of(Path.Type.directory)), new Local("/tmp"), new DisabledListProgressListener()).isEmpty()); cache.clear(); cache.put(new Path("/remote", EnumSet.of(Path.Type.directory)), new AttributedList<Path>( Collections.singletonList(new Path("/remote/file.png", EnumSet.of(Path.Type.file))))); assertTrue(transfer.list(null, null, new Path("/remote", EnumSet.of(Path.Type.directory)), new Local("/tmp"), new DisabledListProgressListener()).isEmpty()); }
From source file:ch.cyberduck.core.cryptomator.OneDriveTouchFeatureTest.java
@Test public void testTouchLongFilenameEncrypted() throws Exception { final Path home = new OneDriveHomeFinderFeature(session).find(); final Path vault = new Path(home, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory)); final Path test = new Path(vault, new RandomStringGenerator.Builder().build().generate(130), EnumSet.of(Path.Type.file)); final CryptoVault cryptomator = new CryptoVault(vault, new DisabledPasswordStore()); cryptomator.create(session, null, new VaultCredentials("test")); session.withRegistry(//from ww w .j av a2 s . c o m new DefaultVaultRegistry(new DisabledPasswordStore(), new DisabledPasswordCallback(), cryptomator)); new CryptoTouchFeature<Void>(session, new DefaultTouchFeature<Void>(new DefaultUploadFeature<>(new OneDriveWriteFeature(session))), new OneDriveWriteFeature(session), cryptomator).touch(test, new TransferStatus()); assertTrue(new CryptoFindFeature(session, new OneDriveFindFeature(session), cryptomator).find(test)); new CryptoDeleteFeature(session, new OneDriveDeleteFeature(session), cryptomator) .delete(Arrays.asList(test, vault), new DisabledLoginCallback(), new Delete.DisabledCallback()); }
From source file:ch.cyberduck.core.cryptomator.impl.CryptoDirectoryProviderTest.java
@Test(expected = NotfoundException.class) public void testToEncryptedInvalidPath() throws Exception { final Path home = new Path("/vault", EnumSet.of(Path.Type.directory)); final CryptoVault vault = new CryptoVault(home, new DisabledPasswordStore()); final CryptoDirectoryProvider provider = new CryptoDirectoryProvider(home, vault); provider.toEncrypted(new NullSession(new Host(new TestProtocol())), null, new Path("/", EnumSet.of(Path.Type.directory))); }
From source file:com.smartsheet.api.internal.SheetResourcesImplTest.java
@Test public void testListSheets() throws SmartsheetException, IOException { server.setResponseBody(new File("src/test/resources/listSheets.json")); PaginationParameters parameters = new PaginationParameters.PaginationParametersBuilder() .setIncludeAll(false).setPageSize(1).setPage(1).build(); PagedResult<Sheet> sheets = sheetResource.listSheets(EnumSet.of(SourceInclusion.SOURCE), parameters, null); assertTrue(sheets.getPageNumber() == 1); assertTrue(sheets.getPageSize() == 100); assertTrue(sheets.getTotalPages() == 1); assertTrue(sheets.getTotalCount() == 2); assertTrue(sheets.getData().size() == 2); assertEquals("sheet 1", sheets.getData().get(0).getName()); assertEquals("sheet 2", sheets.getData().get(1).getName()); }
From source file:ch.cyberduck.cli.GlobTransferItemFinderTest.java
@Test public void testNoLocalInOptionsUploadFile() throws Exception { final CommandLineParser parser = new PosixParser(); final CommandLine input = parser.parse(TerminalOptionsBuilder.options(), new String[] { "--upload", "rackspace://cdn.cyberduck.ch/remote" }); final Set<TransferItem> found = new GlobTransferItemFinder().find(input, TerminalAction.upload, new Path("/cdn.cyberduck.ch/remote", EnumSet.of(Path.Type.file))); assertTrue(found.isEmpty());//ww w.ja v a 2 s. com }
From source file:ch.cyberduck.core.googledrive.DriveReadFeatureTest.java
@Test public void testReadRange() throws Exception { final String name = "-" + UUID.randomUUID().toString(); final Path test = new Path(new DriveHomeFinderService(session).find(), name, EnumSet.of(Path.Type.file)); final Local local = new Local(System.getProperty("java.io.tmpdir"), name); final byte[] content = new RandomStringGenerator.Builder().build().generate(1000).getBytes(); final OutputStream out = local.getOutputStream(false); assertNotNull(out);// ww w .j a v a 2 s . c o m IOUtils.write(content, out); out.close(); new DriveUploadFeature(new DriveWriteFeature(session)).upload(test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledStreamListener(), new TransferStatus().length(content.length), new DisabledConnectionCallback()); final TransferStatus status = new TransferStatus(); status.setLength(content.length); status.setAppend(true); status.setOffset(100L); final InputStream in = new DriveReadFeature(session).read(test, status.length(content.length - 100), new DisabledConnectionCallback()); assertNotNull(in); final ByteArrayOutputStream buffer = new ByteArrayOutputStream(content.length - 100); new StreamCopier(status, status).transfer(in, buffer); final byte[] reference = new byte[content.length - 100]; System.arraycopy(content, 100, reference, 0, content.length - 100); assertArrayEquals(reference, buffer.toByteArray()); in.close(); new DriveDeleteFeature(session).delete(Collections.<Path>singletonList(test), new DisabledLoginCallback(), new Delete.DisabledCallback()); }
From source file:com.quinsoft.zeidon.ActivateOptions.java
public ActivateOptions(View view) { super(view.getTask()); activateFlags = EnumSet.of(ActivateFlags.fMULTIPLE); lodDef = view.getLodDef(); }
From source file:ch.cyberduck.core.onedrive.OneDriveReadFeatureTest.java
@Test public void testReadInterrupt() throws Exception { final Path drive = new OneDriveHomeFinderFeature(session).find(); final Path test = new Path(drive, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)); new OneDriveTouchFeature(session).touch(test, new TransferStatus()); // Unknown length in status final TransferStatus status = new TransferStatus(); // Read a single byte {/* w ww . j a va2s . c o m*/ final InputStream in = new OneDriveReadFeature(session).read(test, status, new DisabledConnectionCallback()); assertNotNull(in.read()); in.close(); } { final InputStream in = new OneDriveReadFeature(session).read(test, status, new DisabledConnectionCallback()); assertNotNull(in); in.close(); } new OneDriveDeleteFeature(session).delete(Collections.singletonList(test), new DisabledLoginCallback(), new Delete.DisabledCallback()); }
From source file:com.slytechs.utils.number.Version.java
public Version(String expression) { if (expression == null) { throw new NullPointerException("Expected argument is null"); }/*from w ww . j a va 2 s . co m*/ if (expression.trim().equals("")) { throw new IllegalArgumentException("Expected a version expression, received empty string"); } String[] s = expression.trim().split("\\."); if (s.length == 0) { s = new String[] { expression }; } Integer[] n = new Integer[s.length]; for (int i = 0; i < s.length; i++) { n[i] = Integer.valueOf(s[i]); } detail = EnumSet.of(VersionDetail.Major); int i = 0; if (i < n.length) { major = n[i]; detail.add(VersionDetail.Major); map.put(VersionDetail.Major, n[i]); } if (++i < n.length) { minor = n[i]; detail.add(VersionDetail.Minor); map.put(VersionDetail.Minor, n[i]); } if (++i < n.length) { milli = n[i]; detail.add(VersionDetail.Milli); map.put(VersionDetail.Milli, n[i]); } if (++i < n.length) { micro = n[i]; detail.add(VersionDetail.Micro); map.put(VersionDetail.Micro, n[i]); } if (++i < n.length) { nano = n[i]; detail.add(VersionDetail.Nano); map.put(VersionDetail.Nano, n[i]); } if (++i < n.length) { throw new IllegalArgumentException("Too many version levels. Only supports 5 levels"); } }
From source file:com.netflix.simianarmy.aws.janitor.crawler.EBSSnapshotJanitorCrawler.java
@Override public EnumSet<? extends ResourceType> resourceTypes() { return EnumSet.of(AWSResourceType.EBS_SNAPSHOT); }