List of usage examples for java.util EnumSet allOf
public static <E extends Enum<E>> EnumSet<E> allOf(Class<E> elementType)
From source file:org.wso2.carbon.bpel.core.ode.integration.config.BPELServerConfiguration.java
public static void processACleanup(Set<ProcessConf.CLEANUP_CATEGORY> categories, List<TCleanup.Category.Enum> categoryList) { if (categoryList.isEmpty()) { // add all categories categories.addAll(EnumSet.allOf(ProcessConf.CLEANUP_CATEGORY.class)); } else {/* w ww .j av a 2 s . c o m*/ for (TCleanup.Category.Enum aCategory : categoryList) { if (aCategory == TCleanup.Category.ALL) { // add all categories categories.addAll(EnumSet.allOf(ProcessConf.CLEANUP_CATEGORY.class)); } else { categories.add(ProcessConf.CLEANUP_CATEGORY.fromString(aCategory.toString())); } } } }
From source file:org.apache.hadoop.hdfs.security.token.block.TestBlockToken.java
@Test public void testWritable() throws Exception { TestWritable.testWritable(new BlockTokenIdentifier()); BlockTokenSecretManager sm = new BlockTokenSecretManager(true, blockKeyUpdateInterval, blockTokenLifetime); TestWritable// w ww . ja v a2 s . com .testWritable(generateTokenId(sm, block1, EnumSet.allOf(BlockTokenSecretManager.AccessMode.class))); TestWritable .testWritable(generateTokenId(sm, block2, EnumSet.of(BlockTokenSecretManager.AccessMode.WRITE))); TestWritable.testWritable( generateTokenId(sm, block3, EnumSet.noneOf(BlockTokenSecretManager.AccessMode.class))); }
From source file:eu.ggnet.dwoss.customer.assist.gen.CustomerGenerator.java
private MandatorMetadata makeMandatorMetadata() { MandatorMetadata m = new MandatorMetadata(); m.setMandatorMatchcode(RandomStringUtils.randomAlphanumeric(4)); m.setPaymentCondition(new RandomEnum<>(PaymentCondition.class).random()); m.setPaymentMethod(new RandomEnum<>(PaymentMethod.class).random()); m.setShippingCondition(new RandomEnum<>(ShippingCondition.class).random()); EnumSet.allOf(SalesChannel.class).stream().filter(t -> R.nextInt(10) < 3).forEach(t -> m.add(t)); return m;//from w w w .ja v a 2 s .c o m }
From source file:org.apache.hadoop.yarn.server.applicationhistoryservice.ApplicationHistoryManagerOnTimelineStore.java
@Override public Map<ApplicationId, ApplicationReport> getApplications(long appsNum, long appStartedTimeBegin, long appStartedTimeEnd) throws YarnException, IOException { TimelineEntities entities = timelineDataManager.getEntities(ApplicationMetricsConstants.ENTITY_TYPE, null, null, appStartedTimeBegin, appStartedTimeEnd, null, null, appsNum == Long.MAX_VALUE ? this.maxLoadedApplications : appsNum, EnumSet.allOf(Field.class), UserGroupInformation.getLoginUser()); Map<ApplicationId, ApplicationReport> apps = new LinkedHashMap<ApplicationId, ApplicationReport>(); if (entities != null && entities.getEntities() != null) { for (TimelineEntity entity : entities.getEntities()) { try { ApplicationReportExt app = generateApplicationReport(entity, ApplicationReportField.ALL); apps.put(app.appReport.getApplicationId(), app.appReport); } catch (Exception e) { LOG.error("Error on generating application report for " + entity.getEntityId(), e); }/* w w w .j a v a 2 s .com*/ } } return apps; }
From source file:edu.mit.lib.mama.MamaTest.java
@Test public void usageSuite() throws IOException { final SimpleReportAggregator aggregator = new SimpleReportAggregator(); final RamlHttpClient client = baseClient.aggregating(aggregator); // URLs must collectively trigger full set of API behaviors as described by spec // missing required query parameter 'qf' - should return 400 response code send(client, TEST_SVC_URL + "/item?qv=http://hdl.handle.net/123456789/3"); // required query parameter 'qf' lacking value - should return 400 response code send(client, TEST_SVC_URL + "/item?qf=&qv=http://hdl.handle.net/123456789/3"); // required query parameter 'qf' bogus value - should return 404 response code send(client, TEST_SVC_URL + "/item?qf=dc.identifier.foo&qv=http://hdl.handle.net/123456789/3"); // no items matching query - should return 404 response code send(client, TEST_SVC_URL + "/item?qf=dc.identifier.uri&qv=http://hdl.handle.net/123456789/5"); // correct query - no response parameters send(client, TEST_SVC_URL + "/item?qf=dc.identifier.uri&qv=http://hdl.handle.net/123456789/3"); // correct query - optional response parameters send(client, TEST_SVC_URL// w w w. j a v a2 s .co m + "/item?qf=dc.identifier.uri&qv=http://hdl.handle.net/123456789/3&rf=dc.title&rf=dc.type"); assertUsage(aggregator.getUsage(), EnumSet.allOf(UsageItem.class)); }
From source file:org.apache.kylin.rest.service.JobService.java
private Set<ExecutableState> convertStatusEnumToStates(List<JobStatusEnum> statusList) { Set<ExecutableState> states; if (statusList == null || statusList.isEmpty()) { states = EnumSet.allOf(ExecutableState.class); } else {// ww w .ja v a 2 s . c o m states = Sets.newHashSet(); for (JobStatusEnum status : statusList) { states.add(parseToExecutableState(status)); } } return states; }
From source file:org.kuali.rice.krad.uif.util.ClientValidationUtils.java
/** * Generates the js object used to override all default messages for validator jquery plugin * with custom messages retrieved from the message service * //from ww w . ja v a 2s.c o m * @return script for message override */ public static String generateValidatorMessagesOption() { MessageService messageService = KRADServiceLocatorWeb.getMessageService(); String mOption = ""; String keyValuePairs = ""; for (ValidationMessageKeys element : EnumSet.allOf(ValidationMessageKeys.class)) { String key = element.toString(); String message = messageService.getMessageText(UifConstants.Messages.VALIDATION_MSG_KEY_PREFIX + key); if (StringUtils.isNotEmpty(message)) { message = MessageStructureUtils.translateStringMessage(message); keyValuePairs = keyValuePairs + "\n" + key + ": '" + message + "',"; } } keyValuePairs = StringUtils.removeEnd(keyValuePairs, ","); if (StringUtils.isNotEmpty(keyValuePairs)) { mOption = "{" + keyValuePairs + "}"; } return mOption; }
From source file:com.spotify.reaper.ReaperApplication.java
@Override public void run(ReaperApplicationConfiguration config, Environment environment) throws Exception { // Using UTC times everywhere as default. Affects only Yoda time. DateTimeZone.setDefault(DateTimeZone.UTC); checkConfiguration(config);/* w ww. j a v a2 s .c o m*/ context.config = config; addSignalHandlers(); // SIGHUP, etc. LOG.info("initializing runner thread pool with {} threads", config.getRepairRunThreadCount()); context.repairManager = new RepairManager(); context.repairManager.initializeThreadPool(config.getRepairRunThreadCount(), config.getHangingRepairTimeoutMins(), TimeUnit.MINUTES, 30, TimeUnit.SECONDS); if (context.storage == null) { LOG.info("initializing storage of type: {}", config.getStorageType()); context.storage = initializeStorage(config, environment); } else { LOG.info("storage already given in context, not initializing a new one"); } if (context.jmxConnectionFactory == null) { LOG.info("no JMX connection factory given in context, creating default"); context.jmxConnectionFactory = new JmxConnectionFactory(); } // read jmx host/port mapping from config and provide to jmx con.factory Map<String, Integer> jmxPorts = config.getJmxPorts(); if (jmxPorts != null) { LOG.debug("using JMX ports mapping: {}", jmxPorts); context.jmxConnectionFactory.setJmxPorts(jmxPorts); } // Enable cross-origin requests for using external GUI applications. if (config.isEnableCrossOrigin() || System.getProperty("enableCrossOrigin") != null) { final FilterRegistration.Dynamic cors = environment.servlets().addFilter("crossOriginRequests", CrossOriginFilter.class); cors.setInitParameter("allowedOrigins", "*"); cors.setInitParameter("allowedHeaders", "X-Requested-With,Content-Type,Accept,Origin"); cors.setInitParameter("allowedMethods", "OPTIONS,GET,PUT,POST,DELETE,HEAD"); cors.addMappingForUrlPatterns(EnumSet.allOf(DispatcherType.class), true, "/*"); } JmxCredentials jmxAuth = config.getJmxAuth(); if (jmxAuth != null) { LOG.debug("using specified JMX credentials for authentication"); context.jmxConnectionFactory.setJmxAuth(jmxAuth); } LOG.info("creating and registering health checks"); // Notice that health checks are registered under the admin application on /healthcheck final ReaperHealthCheck healthCheck = new ReaperHealthCheck(context); environment.healthChecks().register("reaper", healthCheck); LOG.info("creating resources and registering endpoints"); final PingResource pingResource = new PingResource(); environment.jersey().register(pingResource); final ClusterResource addClusterResource = new ClusterResource(context); environment.jersey().register(addClusterResource); final RepairRunResource addRepairRunResource = new RepairRunResource(context); environment.jersey().register(addRepairRunResource); final RepairScheduleResource addRepairScheduleResource = new RepairScheduleResource(context); environment.jersey().register(addRepairScheduleResource); Thread.sleep(1000); SchedulingManager.start(context); if (config.hasAutoSchedulingEnabled()) { LOG.debug("using specified configuration for auto scheduling: {}", config.getAutoScheduling()); AutoSchedulingManager.start(context); } LOG.info("resuming pending repair runs"); context.repairManager.resumeRunningRepairRuns(context); }
From source file:org.apache.sentry.policy.indexer.TestIndexerAuthorizationProviderGeneralCases.java
@Test public void testManager() throws Exception { Set<IndexerModelAction> writeOnly = EnumSet.of(IndexerModelAction.WRITE); doTestAuthProviderOnIndexer(SUB_MANAGER, IND_PURCHASES, writeOnly); Set<IndexerModelAction> allActions = EnumSet.allOf(IndexerModelAction.class); doTestAuthProviderOnIndexer(SUB_MANAGER, IND_ANALYST1, allActions); doTestAuthProviderOnIndexer(SUB_MANAGER, IND_JRANALYST1, allActions); Set<IndexerModelAction> readWriteOnly = EnumSet.of(READ, WRITE); doTestAuthProviderOnIndexer(SUB_MANAGER, IND_TMP, readWriteOnly); Set<IndexerModelAction> readOnly = EnumSet.of(IndexerModelAction.READ); doTestAuthProviderOnIndexer(SUB_MANAGER, IND_PURCHASES_PARTIAL, readOnly); }
From source file:org.apache.sentry.policy.search.TestSearchAuthorizationProviderGeneralCases.java
@Test public void testManager() throws Exception { Set<SearchModelAction> updateOnly = EnumSet.of(SearchModelAction.UPDATE); doTestAuthProviderOnCollection(SUB_MANAGER, COLL_PURCHASES, updateOnly); Set<SearchModelAction> allActions = EnumSet.allOf(SearchModelAction.class); doTestAuthProviderOnCollection(SUB_MANAGER, COLL_ANALYST1, allActions); doTestAuthProviderOnCollection(SUB_MANAGER, COLL_JRANALYST1, allActions); Set<SearchModelAction> queryUpdateOnly = EnumSet.of(QUERY, UPDATE); doTestAuthProviderOnCollection(SUB_MANAGER, COLL_TMP, queryUpdateOnly); Set<SearchModelAction> queryOnly = EnumSet.of(SearchModelAction.QUERY); doTestAuthProviderOnCollection(SUB_MANAGER, COLL_PURCHASES_PARTIAL, queryOnly); }