当前位置: 首页>>代码示例>>Java>>正文


Java EnumSet.of方法代码示例

本文整理汇总了Java中java.util.EnumSet.of方法的典型用法代码示例。如果您正苦于以下问题:Java EnumSet.of方法的具体用法?Java EnumSet.of怎么用?Java EnumSet.of使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.util.EnumSet的用法示例。


在下文中一共展示了EnumSet.of方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testCopyToDifferentFolderLongFilenameCryptomator

import java.util.EnumSet; //导入方法依赖的package包/类
@Test
public void testCopyToDifferentFolderLongFilenameCryptomator() throws Exception {
    final Path home = DriveHomeFinderService.MYDRIVE_FOLDER;
    final Path vault = new Path(home, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory));
    final Path source = new Path(vault, new RandomStringGenerator.Builder().build().generate(130), EnumSet.of(Path.Type.file));
    final Path targetFolder = new Path(vault, new RandomStringGenerator.Builder().build().generate(130), EnumSet.of(Path.Type.directory));
    final Path target = new Path(targetFolder, 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"));
    final DefaultVaultRegistry registry = new DefaultVaultRegistry(new DisabledPasswordStore(), new DisabledPasswordCallback(), cryptomator);
    session.withRegistry(registry);
    new CryptoTouchFeature<Void>(session, new DefaultTouchFeature<Void>(new DefaultUploadFeature<Void>(new DriveWriteFeature(session))), new DriveWriteFeature(session), cryptomator).touch(source, new TransferStatus());
    Assert.assertTrue(new CryptoFindFeature(session, new DefaultFindFeature(session), cryptomator).find(source));
    new CryptoDirectoryFeature<Void>(session, new DriveDirectoryFeature(session), new DriveWriteFeature(session), cryptomator).mkdir(targetFolder, null, new TransferStatus());
    Assert.assertTrue(new CryptoFindFeature(session, new DefaultFindFeature(session), cryptomator).find(targetFolder));
    final CopyWorker worker = new CopyWorker(Collections.singletonMap(source, target), new TestSessionPool(session, registry), PathCache.empty(), new DisabledProgressListener(), new DisabledConnectionCallback());
    worker.run(session);
    Assert.assertTrue(new CryptoFindFeature(session, new DefaultFindFeature(session), cryptomator).find(source));
    Assert.assertTrue(new CryptoFindFeature(session, new DefaultFindFeature(session), cryptomator).find(target));
    registry.clear();
    new DeleteWorker(new DisabledLoginCallback(), Collections.singletonList(vault), PathCache.empty(), new DisabledProgressListener()).run(session);
}
 
开发者ID:iterate-ch,项目名称:cyberduck,代码行数:23,代码来源:CopyWorkerTest.java

示例2: testFindAllPendingInBucket

import java.util.EnumSet; //导入方法依赖的package包/类
@Test
public void testFindAllPendingInBucket() 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")
                    )));
    final Path bucket = new Path("test-cyberduck", EnumSet.of(Path.Type.directory, Path.Type.volume));
    session.open(new DisabledHostKeyCallback(), new DisabledLoginCallback());
    session.login(new DisabledPasswordStore(), new DisabledLoginCallback(), new DisabledCancelCallback());
    final Path file = new Path(bucket, UUID.randomUUID().toString(), EnumSet.of(Path.Type.file));
    final B2StartLargeFileResponse start1Response = session.getClient().startLargeFileUpload(
            new B2FileidProvider(session).getFileid(bucket, new DisabledListProgressListener()),
            file.getName(), null, Collections.emptyMap());
    final B2StartLargeFileResponse start2Response = session.getClient().startLargeFileUpload(
            new B2FileidProvider(session).getFileid(bucket, new DisabledListProgressListener()),
            file.getName(), null, Collections.emptyMap());
    final List<B2FileInfoResponse> list = new B2LargeUploadPartService(session).find(file);
    assertFalse(list.isEmpty());
    assertEquals(start2Response.getFileId(), list.get(0).getFileId());
    assertEquals(start1Response.getFileId(), list.get(1).getFileId());
    session.getClient().cancelLargeFileUpload(start1Response.getFileId());
    session.getClient().cancelLargeFileUpload(start2Response.getFileId());
    session.close();
}
 
开发者ID:iterate-ch,项目名称:cyberduck,代码行数:26,代码来源:B2LargeUploadPartServiceTest.java

示例3: main

import java.util.EnumSet; //导入方法依赖的package包/类
/**
 * ���ÿ���·ݵĺ�Լ�ĸ������֮���Ƿ��н������ظ�
 * ��֪AU, A�д�����
 * @param args
 */
public static void main(String[] args) {
	for (int j = 1; j <= 12; j++) {
		final int fj = j;
		IDataSource kt_data = new SinYeeDataSource("y", EnumSet.of(TIME_FRAME.DAY), str -> str.endsWith(mon[fj]));

		BarSeries t= kt_data.getBarSeries(j, TIME_FRAME.DAY);
		if (t == null || t.times == null) {
			continue;
		}
		int[] time = t.times;
		Arrays.sort(time);
		for (int i = 1; i < time.length; i++) {
			if (time[i] == time[i - 1]) {
				System.out.println(i);
			}
		}
	}
}
 
开发者ID:zc8424,项目名称:QuantTester,代码行数:24,代码来源:CheckDuplicatedDays.java

示例4: test

import java.util.EnumSet; //导入方法依赖的package包/类
/** Tests all rules in a named grammar (to be loaded from {@link #INPUT_DIR}). */
private void test(String grammarName) {
    try {
        GrammarModel grammarView = Groove.loadGrammar(INPUT_DIR + "/" + grammarName);
        for (ResourceKind kind : EnumSet.of(ResourceKind.RULE,
            ResourceKind.HOST,
            ResourceKind.TYPE)) {
            for (Map.Entry<QualName,? extends NamedResourceModel<?>> entry : grammarView
                .getResourceMap(kind)
                .entrySet()) {
                String name = entry.getKey()
                    .last();
                NamedResourceModel<?> model = entry.getValue();
                if (name.startsWith(OK_PREFIX)) {
                    testCorrect(model);
                } else if (name.startsWith(ERR_PREFIX)) {
                    testErroneous(model);
                }
            }
        }
    } catch (IOException e) {
        Assert.fail(e.getMessage());
    }
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:25,代码来源:TypeCheckTest.java

示例5: testSymLinksFromRoot

import java.util.EnumSet; //导入方法依赖的package包/类
public void testSymLinksFromRoot() throws Exception {
    final File workDir = getWorkDir();
    final FileObject wd = FileUtil.toFileObject(workDir);
    final FileObject cycleTarget= wd.createFolder("cycleTarget");
    final FileObject rootWithCycle = cycleTarget.createFolder("rootWithExtLink");
    final FileObject folder1 = rootWithCycle.createFolder("folder1");
    final FileObject folder2 = rootWithCycle.createFolder("folder2");
    final FileObject inFolder1 = folder1.createFolder("infolder1");
    final FileObject inFolder2 = folder2.createFolder("cycleTarget");
    folder1.createData("data1.txt");
    inFolder1.createData("data2.txt");
    folder2.createData("data3.txt");
    inFolder2.createData("data4.txt");
    final Map<Pair<FileObject,FileObject>,Boolean> linkMap = new HashMap<>();
    linkMap.put(
        Pair.<FileObject,FileObject>of(cycleTarget, inFolder2), Boolean.TRUE
    );
    FileObjectCrawler.mockLinkTypes = linkMap;
    final FileObjectCrawler c = new FileObjectCrawler(rootWithCycle, EnumSet.<Crawler.TimeStampAction>of(Crawler.TimeStampAction.UPDATE), null, CR, SuspendSupport.NOP);
    final Collection<Indexable> indexables = c.getAllResources();
    assertCollectedFiles("Wring collected files", indexables,
            "folder1/data1.txt",
            "folder1/infolder1/data2.txt",
            "folder2/data3.txt");
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:FileObjectCrawlerTest.java

示例6: testListAWS2AutoSwitchAWS4SignatureFrankfurt

import java.util.EnumSet; //导入方法依赖的package包/类
@Test
public void testListAWS2AutoSwitchAWS4SignatureFrankfurt() throws Exception {
    final S3Session session = new S3Session(
            new Host(new S3Protocol(), new S3Protocol().getDefaultHostname(),
                    new Credentials(
                            System.getProperties().getProperty("s3.key"), System.getProperties().getProperty("s3.secret")
                    ))) {
        @Override
        public S3Protocol.AuthenticationHeaderSignatureVersion getSignatureVersion() {
            return S3Protocol.AuthenticationHeaderSignatureVersion.AWS2;
        }
    };
    session.open(new DisabledHostKeyCallback(), new DisabledLoginCallback());
    session.login(new DisabledPasswordStore(), new DisabledLoginCallback(), new DisabledCancelCallback());
    final Path container = new Path("test-eu-central-1-cyberduck", EnumSet.of(Path.Type.volume));
    final AttributedList<Path> list = new S3ObjectListService(session).list(container, new DisabledListProgressListener());
    session.close();
}
 
开发者ID:iterate-ch,项目名称:cyberduck,代码行数:19,代码来源:S3ObjectListServiceTest.java

示例7: testMoveNotFound

import java.util.EnumSet; //导入方法依赖的package包/类
@Test(expected = NotfoundException.class)
public void testMoveNotFound() throws Exception {
    final LocalSession session = new LocalSession(new Host(new LocalProtocol(), new LocalProtocol().getDefaultHostname()));
    session.open(new DisabledHostKeyCallback(), new DisabledLoginCallback());
    session.login(new DisabledPasswordStore(), new DisabledLoginCallback(), new DisabledCancelCallback());
    final Path workdir = new LocalHomeFinderFeature(session).find();
    final Path test = new Path(workdir, UUID.randomUUID().toString(), EnumSet.of(Path.Type.file));
    new LocalMoveFeature(session).move(test, new Path(workdir, UUID.randomUUID().toString(), EnumSet.of(Path.Type.file)), new TransferStatus(), new Delete.DisabledCallback(), new DisabledConnectionCallback());
}
 
开发者ID:iterate-ch,项目名称:cyberduck,代码行数:10,代码来源:LocalMoveFeatureTest.java

示例8: testSearchRoot

import java.util.EnumSet; //导入方法依赖的package包/类
@Test
public void testSearchRoot() throws Exception {
    final String name = new AlphanumericRandomStringService().random();
    final Path workdir = DriveHomeFinderService.MYDRIVE_FOLDER;
    final Path file = new DriveTouchFeature(session).touch(new Path(workdir, name, EnumSet.of(Path.Type.file)), new TransferStatus());
    final DriveSearchFeature feature = new DriveSearchFeature(session);
    assertTrue(feature.search(workdir, new SearchFilter(name), new DisabledListProgressListener()).contains(file));
    // Supports prefix matching only
    assertFalse(feature.search(workdir, new SearchFilter(StringUtils.substring(name, 2)), new DisabledListProgressListener()).contains(file));
    assertTrue(feature.search(workdir, new SearchFilter(StringUtils.substring(name, 0, name.length() - 2)), new DisabledListProgressListener()).contains(file));
    final Path subdir = new Path(workdir, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory));
    assertFalse(feature.search(subdir, new SearchFilter(name), new DisabledListProgressListener()).contains(file));
    new DriveDeleteFeature(session).delete(Collections.singletonList(file), new DisabledLoginCallback(), new Delete.DisabledCallback());
}
 
开发者ID:iterate-ch,项目名称:cyberduck,代码行数:15,代码来源:DriveSearchFeatureTest.java

示例9: testMoveFileOutsideVault

import java.util.EnumSet; //导入方法依赖的package包/类
@Test
public void testMoveFileOutsideVault() throws Exception {
    final Host host = new Host(new SFTPProtocol(), "test.cyberduck.ch", new Credentials(
            System.getProperties().getProperty("sftp.user"), System.getProperties().getProperty("sftp.password")
    ));
    final SFTPSession session = new SFTPSession(host);
    session.open(new DisabledHostKeyCallback(), new DisabledLoginCallback());
    session.login(new DisabledPasswordStore(), new DisabledLoginCallback(), new DisabledCancelCallback());
    final Path home = new SFTPHomeDirectoryService(session).find();
    final Path vault = new Path(home, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory));
    final Path clearFolder = new Path(home, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory));
    new SFTPDirectoryFeature(session).mkdir(clearFolder, null, new TransferStatus());
    final Path encryptedFolder = new Path(vault, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory));
    final Path encryptedFile = new Path(encryptedFolder, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file));
    final CryptoVault cryptomator = new CryptoVault(vault, new DisabledPasswordStore());
    cryptomator.create(session, null, new VaultCredentials("test"));
    final DefaultVaultRegistry registry = new DefaultVaultRegistry(new DisabledPasswordStore(), new DisabledPasswordCallback(), cryptomator);
    session.withRegistry(registry);
    new CryptoDirectoryFeature<Void>(session, new SFTPDirectoryFeature(session), new SFTPWriteFeature(session), cryptomator).mkdir(encryptedFolder, null, new TransferStatus());
    assertTrue(new CryptoFindFeature(session, new DefaultFindFeature(session), cryptomator).find(encryptedFolder));
    new CryptoTouchFeature<Void>(session, new DefaultTouchFeature<Void>(new DefaultUploadFeature<Void>(new SFTPWriteFeature(session))), new SFTPWriteFeature(session), cryptomator).touch(encryptedFile, new TransferStatus());
    assertTrue(new CryptoFindFeature(session, new DefaultFindFeature(session), cryptomator).find(encryptedFile));
    // move file outside vault
    final Path fileRenamed = new Path(clearFolder, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file));
    final MoveWorker worker = new MoveWorker(Collections.singletonMap(encryptedFile, fileRenamed), PathCache.empty(), PasswordStoreFactory.get(), new DisabledLoginCallback(), new DisabledHostKeyCallback(), new DisabledProgressListener(), new DisabledTranscriptListener());
    worker.run(session);
    assertFalse(new CryptoFindFeature(session, new SFTPFindFeature(session), cryptomator).find(encryptedFile));
    assertTrue(new SFTPFindFeature(session).find(fileRenamed));
    new CryptoDeleteFeature(session, new SFTPDeleteFeature(session), cryptomator).delete(Arrays.asList(encryptedFolder, vault), new DisabledLoginCallback(), new Delete.DisabledCallback());
    new SFTPDeleteFeature(session).delete(Arrays.asList(fileRenamed, clearFolder), new DisabledLoginCallback(), new Delete.DisabledCallback());
    session.close();
    registry.clear();
}
 
开发者ID:iterate-ch,项目名称:cyberduck,代码行数:34,代码来源:MoveWorkerTest.java

示例10: testDuplicateResults6

import java.util.EnumSet; //导入方法依赖的package包/类
public void testDuplicateResults6() throws IOException {
    FileObject root = FileUtil.createFolder(new File(getWorkDir(), "src"));
    String [] paths = new String [] {
            "org/me/prj/foo/file2.txt",
            "org/me/prj/bar/file3.txt",
    };

    populateFolderStructure(root, paths);

    FileObjectCrawler crawler = new FileObjectCrawler(root, new FileObject[] {root.getFileObject("org/me/prj/bar/file3.txt"), root.getFileObject("org/me/prj/foo"), root.getFileObject("org/me/prj/bar")}, EnumSet.<Crawler.TimeStampAction>of(Crawler.TimeStampAction.UPDATE), null, CR, SuspendSupport.NOP);
    assertCollectedFiles("Wrong files collected", crawler.getResources(), new String[] {"org/me/prj/foo/file2.txt","org/me/prj/bar/file3.txt"});
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:FileObjectCrawlerTest.java

示例11: testReadNotFound

import java.util.EnumSet; //导入方法依赖的package包/类
@Test(expected = NotfoundException.class)
public void testReadNotFound() throws Exception {
    final S3Session session = new S3Session(
            new Host(new S3Protocol(), new S3Protocol().getDefaultHostname(),
                    new Credentials(
                            System.getProperties().getProperty("s3.key"), System.getProperties().getProperty("s3.secret")
                    )));
    session.open(new DisabledHostKeyCallback(), new DisabledLoginCallback());
    session.login(new DisabledPasswordStore(), new DisabledLoginCallback(), new DisabledCancelCallback());
    final Path container = new Path("test-us-east-1-cyberduck", EnumSet.of(Path.Type.directory, Path.Type.volume));
    final Path test = new Path(container, UUID.randomUUID().toString(), EnumSet.of(Path.Type.file));
    final S3AccessControlListFeature f = new S3AccessControlListFeature(session);
    f.getPermission(test);
}
 
开发者ID:iterate-ch,项目名称:cyberduck,代码行数:15,代码来源:S3AccessControlListFeatureTest.java

示例12: testCopyFile

import java.util.EnumSet; //导入方法依赖的package包/类
@Test
public void testCopyFile() throws Exception {
    final Host host = new Host(new B2Protocol(), new B2Protocol().getDefaultHostname(),
            new Credentials(
                    System.getProperties().getProperty("b2.user"), System.getProperties().getProperty("b2.key")
            ));
    final B2Session session = new B2Session(host);
    session.open(new DisabledHostKeyCallback(), new DisabledLoginCallback());
    session.login(new DisabledPasswordStore(), new DisabledLoginCallback(), new DisabledCancelCallback());
    final Path home = new Path("/test-cyberduck", EnumSet.of(Path.Type.directory, Path.Type.volume));
    final Path vault = new Path(home, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory));
    final Path source = new Path(vault, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file));
    final Path target = new Path(vault, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file));
    final CryptoVault cryptomator = new CryptoVault(vault, new DisabledPasswordStore());
    cryptomator.create(session, null, new VaultCredentials("test"));
    final DefaultVaultRegistry registry = new DefaultVaultRegistry(new DisabledPasswordStore(), new DisabledPasswordCallback(), cryptomator);
    session.withRegistry(registry);
    final byte[] content = RandomUtils.nextBytes(40500);
    final TransferStatus status = new TransferStatus();
    new CryptoBulkFeature<>(session, new DisabledBulkFeature(), new B2DeleteFeature(session), cryptomator).pre(Transfer.Type.upload, Collections.singletonMap(source, status), new DisabledConnectionCallback());
    new StreamCopier(new TransferStatus(), new TransferStatus()).transfer(new ByteArrayInputStream(content), new CryptoWriteFeature<>(session, new B2WriteFeature(session), cryptomator).write(source, status.length(content.length), new DisabledConnectionCallback()));
    assertTrue(new CryptoFindFeature(session, new DefaultFindFeature(session), cryptomator).find(source));
    final CopyWorker worker = new CopyWorker(Collections.singletonMap(source, target), new TestSessionPool(session, registry), PathCache.empty(), new DisabledProgressListener(), new DisabledConnectionCallback());
    worker.run(session);
    assertTrue(new CryptoFindFeature(session, new B2FindFeature(session), cryptomator).find(source));
    assertTrue(new CryptoFindFeature(session, new B2FindFeature(session), cryptomator).find(target));
    final ByteArrayOutputStream out = new ByteArrayOutputStream(content.length);
    assertEquals(content.length, IOUtils.copy(new CryptoReadFeature(session, new B2ReadFeature(session), cryptomator).read(target, new TransferStatus().length(content.length), new DisabledConnectionCallback()), out));
    assertArrayEquals(content, out.toByteArray());
    new DeleteWorker(new DisabledLoginCallback(), Collections.singletonList(vault), PathCache.empty(), new DisabledProgressListener()).run(session);
    session.close();
}
 
开发者ID:iterate-ch,项目名称:cyberduck,代码行数:33,代码来源:CopyWorkerTest.java

示例13: init

import java.util.EnumSet; //导入方法依赖的package包/类
protected void init() {
	messageDamper = new OFMessageDamper(OFMESSAGE_DAMPER_CAPACITY,
			EnumSet.of(OFType.FLOW_MOD),
			OFMESSAGE_DAMPER_TIMEOUT);
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:6,代码来源:ForwardingBase.java

示例14: context

import java.util.EnumSet; //导入方法依赖的package包/类
@Override
public EnumSet<MetaData.XContentContext> context() {
    return EnumSet.of(MetaData.XContentContext.GATEWAY);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:5,代码来源:ClusterChangedEventTests.java

示例15: html

import java.util.EnumSet; //导入方法依赖的package包/类
public HTML<WebAppProxyServlet._> html() {
  return new HTML<>("html", null, EnumSet.of(EOpt.ENDTAG));
}
 
开发者ID:naver,项目名称:hadoop,代码行数:4,代码来源:WebAppProxyServlet.java


注:本文中的java.util.EnumSet.of方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。