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.core.spectra.SpectraMultipleDeleteFeatureTest.java
@Test(expected = NotfoundException.class) public void testDeleteNotFoundBucket() throws Exception { final Host host = new Host(new SpectraProtocol() { @Override//from www . j a v a 2s.c om 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(UUID.randomUUID().toString(), EnumSet.of(Path.Type.volume)); new S3MultipleDeleteFeature(session).delete(Arrays.asList(container, container), new DisabledLoginCallback(), new Delete.DisabledCallback()); }
From source file:com.vmware.photon.controller.model.adapters.vsphere.TestVSphereProvisionWithCloudConfigTask.java
private void doRefresh() throws Throwable { ResourceEnumerationTaskState task = new ResourceEnumerationTaskState(); task.adapterManagementReference = this.computeHost.adapterManagementReference; if (isMock()) { task.options = EnumSet.of(TaskOption.IS_MOCK); }/* w w w . ja v a 2s . c o m*/ task.enumerationAction = EnumerationAction.REFRESH; task.parentComputeLink = this.computeHost.documentSelfLink; task.resourcePoolLink = this.resourcePool.documentSelfLink; ResourceEnumerationTaskState outTask = TestUtils.doPost(this.host, task, ResourceEnumerationTaskState.class, UriUtils.buildUri(this.host, ResourceEnumerationTaskService.FACTORY_LINK)); this.host.waitForFinishedTask(ResourceEnumerationTaskState.class, outTask.documentSelfLink); }
From source file:ch.cyberduck.core.irods.IRODSUploadFeatureTest.java
@Test public void testWrite() 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 Local local = new Local(System.getProperty("java.io.tmpdir"), UUID.randomUUID().toString()); final int length = 32770; final byte[] content = RandomUtils.nextBytes(length); final OutputStream out = local.getOutputStream(false); IOUtils.write(content, out);/* w ww . jav a 2 s. co m*/ out.close(); final Checksum checksum; final Path test = new Path(new IRODSHomeFinderService(session).find(), UUID.randomUUID().toString(), EnumSet.of(Path.Type.file)); final TransferStatus status = new TransferStatus().length(content.length); checksum = new IRODSUploadFeature(session).upload(test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledStreamListener(), status, new DisabledConnectionCallback()); assertTrue(status.isComplete()); assertEquals(content.length, status.getOffset()); assertEquals(checksum, new MD5ChecksumCompute().compute(new FileInputStream(local.getAbsolute()), status)); final byte[] buffer = new byte[content.length]; final InputStream in = new IRODSReadFeature(session).read(test, new TransferStatus().length(content.length), new DisabledConnectionCallback()); IOUtils.readFully(in, buffer); in.close(); assertArrayEquals(content, buffer); new IRODSDeleteFeature(session).delete(Collections.singletonList(test), new DisabledLoginCallback(), new Delete.DisabledCallback()); session.close(); }