List of usage examples for java.util EnumSet allOf
public static <E extends Enum<E>> EnumSet<E> allOf(Class<E> elementType)
From source file:io.mpos.ui.tester.CheckoutActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_checkout); TextView sdkVersionText = (TextView) findViewById(R.id.sdk_version); sdkVersionText.setText("SDK version : " + Mpos.getVersion()); MposUi.initialize(CheckoutActivity.this, ProviderMode.TEST, MERCHANT_ID, MERCHANT_SECRET); findViewById(R.id.transaction_signature).setOnClickListener(new OnClickListener() { @Override/*from w w w . j av a 2 s. c om*/ public void onClick(View v) { initMockPaymentController(); //Styling the Payment Controller. MposUi.getInitializedInstance().getConfiguration().getAppearance() .setColorPrimary(Color.parseColor("#ff9800")) .setColorPrimaryDark(Color.parseColor("#f57c00")) .setBackgroundColor(Color.parseColor("#FFF3E0")).setTextColorPrimary(Color.BLACK); startPayment(108.20); } }); findViewById(R.id.transaction_application_selection).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { initMockPaymentController(); //Styling the Payment Controller. MposUi.getInitializedInstance().getConfiguration().getAppearance() .setColorPrimary(Color.parseColor("#7cb342")) .setColorPrimaryDark(Color.parseColor("#689f38")) .setBackgroundColor(Color.parseColor("#E8F5E9")).setTextColorPrimary(Color.WHITE); startPayment(113.73); } }); findViewById(R.id.transaction_declined).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { initMockPaymentController(); //Styling the Payment Controller. MposUi.getInitializedInstance().getConfiguration().getAppearance() .setColorPrimary(Color.parseColor("#F4511E")) .setColorPrimaryDark(Color.parseColor("#D84315")) .setBackgroundColor(Color.parseColor("#FFEBEE")).setTextColorPrimary(Color.WHITE); startPayment(110.40); } }); findViewById(R.id.transaction_ask_for_tip).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { initMockPaymentController(); //Styling the Payment Controller. MposUi.getInitializedInstance().getConfiguration().getAppearance() .setColorPrimary(Color.parseColor("#ffbb00")) .setColorPrimaryDark(Color.parseColor("#D49B00")) .setBackgroundColor(Color.parseColor("#FFF3E0")).setTextColorPrimary(Color.BLACK); TransactionProcessParameters processParameters = new TransactionProcessParameters.Builder() .addAskForTipStep().build(); startPayment(105, true, processParameters); } }); findViewById(R.id.transaction_e105_charge).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (!mIsAcquirerMode) { MposUi mposUi = MposUi.getInitializedInstance(); AccessoryParameters accessoryParameters = new AccessoryParameters.Builder( AccessoryFamily.VERIFONE_E105).audioJack().build(); mposUi.getConfiguration().setTerminalParameters(accessoryParameters); mposUi.getConfiguration() .setSummaryFeatures(EnumSet.allOf(MposUiConfiguration.SummaryFeature.class)); } startPayment(13.37); } }); findViewById(R.id.transaction_miura_charge).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (!mIsAcquirerMode) { MposUi mposUi = MposUi.getInitializedInstance(); AccessoryParameters accessoryParameters = new AccessoryParameters.Builder( AccessoryFamily.MIURA_MPI).bluetooth().build(); mposUi.getConfiguration().setTerminalParameters(accessoryParameters); mposUi.getConfiguration() .setSummaryFeatures(EnumSet.allOf(MposUiConfiguration.SummaryFeature.class)); } startPayment(13.37); } }); findViewById(R.id.transaction_miura_preauthorize).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (!mIsAcquirerMode) { MposUi mposUi = MposUi.getInitializedInstance(); AccessoryParameters accessoryParameters = new AccessoryParameters.Builder( AccessoryFamily.MIURA_MPI).bluetooth().build(); mposUi.getConfiguration().setTerminalParameters(accessoryParameters); mposUi.getConfiguration() .setSummaryFeatures(EnumSet.allOf(MposUiConfiguration.SummaryFeature.class)); } startPayment(13.37, false); } }); findViewById(R.id.transaction_miura_charge_with_tip).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (!mIsAcquirerMode) { MposUi mposUi = MposUi.getInitializedInstance(); AccessoryParameters accessoryParameters = new AccessoryParameters.Builder( AccessoryFamily.MIURA_MPI).bluetooth().build(); mposUi.getConfiguration().setTerminalParameters(accessoryParameters); mposUi.getConfiguration() .setSummaryFeatures(EnumSet.allOf(MposUiConfiguration.SummaryFeature.class)); } TransactionProcessParameters processParameters = new TransactionProcessParameters.Builder() .addAskForTipStep().build(); startPayment(13.37, true, processParameters); } }); findViewById(R.id.summary_last).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent summaryIntent = MposUi.getInitializedInstance() .createTransactionSummaryIntent(mLastTransactionIdentifier); startActivityForResult(summaryIntent, MposUi.REQUEST_CODE_SHOW_SUMMARY); } }); findViewById(R.id.refund_last).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { TransactionParameters transactionParameters = new TransactionParameters.Builder() .refund(mLastTransactionIdentifier).subject("subject-refund").build(); Intent refundIntent = MposUi.getInitializedInstance() .createTransactionIntent(transactionParameters); startActivity(refundIntent); } }); findViewById(R.id.capture_last).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { TransactionParameters transactionParameters = new TransactionParameters.Builder() .capture(mLastTransactionIdentifier).build(); Intent captureIntent = MposUi.getInitializedInstance() .createTransactionIntent(transactionParameters); startActivity(captureIntent); } }); findViewById(R.id.print_last).setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { printReceipt(mLastTransactionIdentifier); } }); findViewById(R.id.show_login).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent intent = MposUi.getInitializedInstance().createLoginIntent(); startActivityForResult(intent, MposUi.REQUEST_CODE_LOGIN); } }); findViewById(R.id.show_settings).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent intent = MposUi.getInitializedInstance().createSettingsIntent(); startActivityForResult(intent, MposUi.REQUEST_CODE_SETTINGS); } }); findViewById(R.id.logout).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { MposUi.getInitializedInstance().logout(); } }); findViewById(R.id.init_with_concardis).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { mIsAcquirerMode = true; MposUi.initialize(CheckoutActivity.this, ProviderMode.TEST, ApplicationName.CONCARDIS, "test-integrator"); } }); findViewById(R.id.init_with_mcashier).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { mIsAcquirerMode = true; MposUi.initialize(CheckoutActivity.this, ProviderMode.TEST, ApplicationName.MCASHIER, "test-integrator"); } }); findViewById(R.id.init_with_secure_retail).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { mIsAcquirerMode = true; MposUi.initialize(CheckoutActivity.this, ProviderMode.TEST, ApplicationName.SECURE_RETAIL, "test-integrator"); } }); findViewById(R.id.init_with_yourbrand).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { mIsAcquirerMode = true; MposUi.initialize(CheckoutActivity.this, ProviderMode.TEST, ApplicationName.YOURBRAND, "test-integrator"); } }); findViewById(R.id.init_with_provider).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { mIsAcquirerMode = false; MposUi mposUi = MposUi.initialize(CheckoutActivity.this, ProviderMode.TEST, MERCHANT_ID, MERCHANT_SECRET); mposUi.getConfiguration() .setSummaryFeatures(EnumSet.allOf(MposUiConfiguration.SummaryFeature.class)); AccessoryParameters printerAccessoryParams = new AccessoryParameters.Builder(AccessoryFamily.SEWOO) .bluetooth().build(); MposUi.getInitializedInstance().getConfiguration().setPrinterParameters(printerAccessoryParams); } }); findViewById(R.id.read_card).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { MposUi mposUi = MposUi.getInitializedInstance(); AccessoryParameters accessoryParameters = new AccessoryParameters.Builder(AccessoryFamily.MIURA_MPI) .bluetooth().build(); mposUi.getConfiguration().setTerminalParameters(accessoryParameters); readCard(); } }); updateViews(); }
From source file:org.wso2.andes.server.Broker.java
/** * Starts the TCP listener for handling AMQP messages. * * @param config The configuration for application registry. * @param options Broker options/*from ww w . j av a 2s . c o m*/ * @param serverConfig Server configuration * @throws AndesException */ private void startAMQPListener(ApplicationRegistry config, BrokerOptions options, ServerConfiguration serverConfig) throws AndesException { try { if (AndesConfigurationManager.<Boolean>readValue(AndesConfiguration.TRANSPORTS_AMQP_ENABLED)) { ConfigurationManagementMBean configMBean = new ConfigurationManagementMBean(); configMBean.register(); ServerInformationMBean sysInfoMBean = new ServerInformationMBean(config); sysInfoMBean.register(); Set<Integer> ports = new HashSet<Integer>(options.getPorts()); if (ports.isEmpty()) { parsePortList(ports, serverConfig.getPorts()); } Set<Integer> sslPorts = new HashSet<Integer>(options.getSSLPorts()); if (sslPorts.isEmpty()) { parsePortList(sslPorts, serverConfig.getSSLPorts()); } Set<Integer> exclude_0_10 = new HashSet<Integer>(options.getExcludedPorts(ProtocolExclusion.v0_10)); if (exclude_0_10.isEmpty()) { parsePortList(exclude_0_10, serverConfig.getPortExclude010()); } Set<Integer> exclude_0_9_1 = new HashSet<Integer>( options.getExcludedPorts(ProtocolExclusion.v0_9_1)); if (exclude_0_9_1.isEmpty()) { parsePortList(exclude_0_9_1, serverConfig.getPortExclude091()); } Set<Integer> exclude_0_9 = new HashSet<Integer>(options.getExcludedPorts(ProtocolExclusion.v0_9)); if (exclude_0_9.isEmpty()) { parsePortList(exclude_0_9, serverConfig.getPortExclude09()); } Set<Integer> exclude_0_8 = new HashSet<Integer>(options.getExcludedPorts(ProtocolExclusion.v0_8)); if (exclude_0_8.isEmpty()) { parsePortList(exclude_0_8, serverConfig.getPortExclude08()); } String bindAddressFromBrokerOptions = options.getBind(); if (null == bindAddressFromBrokerOptions) { bindAddressFromBrokerOptions = serverConfig.getBind(); } InetAddress bindAddressForHostname; if (WILDCARD_ADDRESS.equals(bindAddressFromBrokerOptions)) { bindAddressForHostname = new InetSocketAddress(0).getAddress(); } else { bindAddressForHostname = InetAddress.getByName(bindAddressFromBrokerOptions); } String hostName = bindAddressForHostname.getCanonicalHostName(); if (!serverConfig.getSSLOnly()) { for (int port : ports) { Set<AmqpProtocolVersion> supported = EnumSet.allOf(AmqpProtocolVersion.class); if (exclude_0_10.contains(port)) { supported.remove(AmqpProtocolVersion.v0_10); } if (exclude_0_9_1.contains(port)) { supported.remove(AmqpProtocolVersion.v0_9_1); } if (exclude_0_9.contains(port)) { supported.remove(AmqpProtocolVersion.v0_9); } if (exclude_0_8.contains(port)) { supported.remove(AmqpProtocolVersion.v0_8); } NetworkTransportConfiguration settings = new ServerNetworkTransportConfiguration( serverConfig, port, bindAddressFromBrokerOptions, Transport.TCP); IncomingNetworkTransport transport = Transport.getIncomingTransportInstance(); MultiVersionProtocolEngineFactory protocolEngineFactory = new MultiVersionProtocolEngineFactory( hostName, supported); transport.accept(settings, protocolEngineFactory, null); ApplicationRegistry.getInstance().addAcceptor( new InetSocketAddress(bindAddressForHostname, port), new QpidAcceptor(transport, "TCP")); CurrentActor.get().message(BrokerMessages.LISTENING("TCP", port)); } } if (serverConfig.getEnableSSL()) { JKSStore keyStore = AndesConfigurationManager .readValue(AndesConfiguration.TRANSPORTS_AMQP_SSL_CONNECTION_KEYSTORE); JKSStore trustStore = AndesConfigurationManager .readValue(AndesConfiguration.TRANSPORTS_AMQP_SSL_CONNECTION_TRUSTSTORE); String sslProtocols = AndesConfigurationManager .readValue(AndesConfiguration.TRANSPORTS_AMQP_SSL_CONNECTION_PROTOCOLS); String ciphers = AndesConfigurationManager .readValue(AndesConfiguration.TRANSPORTS_AMQP_SSL_CONNECTION_CIPHERS); SSLContextFactory sslFactory = new SSLContextFactory(trustStore.getStoreLocation(), trustStore.getPassword(), trustStore.getStoreAlgorithm(), keyStore.getStoreLocation(), keyStore.getPassword(), keyStore.getStoreAlgorithm(), sslProtocols, ciphers); for (int sslPort : sslPorts) { NetworkTransportConfiguration settings = new ServerNetworkTransportConfiguration( serverConfig, sslPort, bindAddressFromBrokerOptions, Transport.TCP); IncomingNetworkTransport transport = new MinaNetworkTransport(); transport.accept(settings, new AMQProtocolEngineFactory(), sslFactory); ApplicationRegistry.getInstance().addAcceptor( new InetSocketAddress(bindAddressForHostname, sslPort), new QpidAcceptor(transport, "TCP")); CurrentActor.get().message(BrokerMessages.LISTENING("TCP/SSL", sslPort)); } } CurrentActor.get().message(BrokerMessages.READY()); } else { log.warn("AMQP Transport is disabled as per configuration."); } } catch (JMException e) { throw new AndesException("Unable to register an MBean", e); } catch (UnknownHostException e) { throw new AndesException("Unable to get bind address", e); } }
From source file:org.apache.hadoop.yarn.server.timeline.MapTimelineStore.java
@Override public synchronized TimelineEntity getEntity(String entityId, String entityType, EnumSet<Field> fieldsToRetrieve) { if (serviceStopped) { LOG.info("Service stopped, return null for the storage"); return null; }/*from w w w . j a v a 2 s . c o m*/ if (fieldsToRetrieve == null) { fieldsToRetrieve = EnumSet.allOf(Field.class); } TimelineEntity entity = entities.get(new EntityIdentifier(entityId, entityType)); if (entity == null) { return null; } else { return maskFields(entity, fieldsToRetrieve); } }
From source file:org.apache.sentry.policy.indexer.TestIndexerAuthorizationProviderGeneralCases.java
@Test public void testJuniorAnalyst() throws Exception { Set<IndexerModelAction> allActions = EnumSet.allOf(IndexerModelAction.class); doTestAuthProviderOnIndexer(SUB_JUNIOR_ANALYST, IND_JRANALYST1, allActions); Set<IndexerModelAction> readOnly = EnumSet.of(IndexerModelAction.READ); doTestAuthProviderOnIndexer(SUB_JUNIOR_ANALYST, IND_PURCHASES_PARTIAL, readOnly); Set<IndexerModelAction> noActions = EnumSet.noneOf(IndexerModelAction.class); doTestAuthProviderOnIndexer(SUB_JUNIOR_ANALYST, IND_PURCHASES, noActions); doTestAuthProviderOnIndexer(SUB_JUNIOR_ANALYST, IND_ANALYST1, noActions); doTestAuthProviderOnIndexer(SUB_JUNIOR_ANALYST, IND_TMP, noActions); }
From source file:com.smartsheet.api.internal.SheetResourcesImplTest.java
@Test public void testCreateSheetFromTemplate() throws SmartsheetException, IOException { server.setResponseBody(new File("src/test/resources/createSheetFromExisting.json")); Sheet sheet = new Sheet.CreateFromTemplateOrSheetBuilder().setFromId(7960873114331012L) .setName("New test sheet from template").build(); Sheet newSheet = sheetResource.createSheetFromTemplate(sheet, EnumSet.allOf(SheetTemplateInclusion.class)); assertEquals(7960873114331012L, newSheet.getId().longValue()); assertEquals(AccessLevel.OWNER, newSheet.getAccessLevel()); assertEquals("https://app.smartsheet.com/b/home?lx=lbKEF1UakfTNJTZ5XkpxWg", newSheet.getPermalink()); }
From source file:org.apache.sentry.policy.search.TestSearchAuthorizationProviderGeneralCases.java
@Test public void testJuniorAnalyst() throws Exception { Set<SearchModelAction> allActions = EnumSet.allOf(SearchModelAction.class); doTestAuthProviderOnCollection(SUB_JUNIOR_ANALYST, COLL_JRANALYST1, allActions); Set<SearchModelAction> queryOnly = EnumSet.of(SearchModelAction.QUERY); doTestAuthProviderOnCollection(SUB_JUNIOR_ANALYST, COLL_PURCHASES_PARTIAL, queryOnly); Set<SearchModelAction> noActions = EnumSet.noneOf(SearchModelAction.class); doTestAuthProviderOnCollection(SUB_JUNIOR_ANALYST, COLL_PURCHASES, noActions); doTestAuthProviderOnCollection(SUB_JUNIOR_ANALYST, COLL_ANALYST1, noActions); doTestAuthProviderOnCollection(SUB_JUNIOR_ANALYST, COLL_TMP, noActions); }
From source file:at.salzburgresearch.stanbol.enhancer.nlp.talismane.impl.TestTalismaneAnalyser.java
private void validateAnalysedText(String text, AnalysedText at) { Assert.assertNotNull(text);/*from w w w . jav a2 s.com*/ Assert.assertNotNull(at); //Assert the AnalysedText Assert.assertEquals(0, at.getStart()); Assert.assertEquals(text.length(), at.getEnd()); Iterator<Span> it = at.getEnclosed(EnumSet.allOf(SpanTypeEnum.class)); while (it.hasNext()) { //validate that the span|start|end corresponds with the Text Span span = it.next(); Assert.assertNotNull(span); Assert.assertEquals(text.substring(span.getStart(), span.getEnd()), span.getSpan()); switch (span.getType()) { case Token: double prevProb = -1; List<Value<PosTag>> posTags = span.getAnnotations(POS_ANNOTATION); Assert.assertTrue("All Tokens need to have a PosTag (missing for " + span + ")", posTags != null && !posTags.isEmpty()); for (Value<PosTag> posTag : posTags) { //assert Mapped PosTags Assert.assertTrue("PosTag " + posTag + " used by " + span + " is not present in the PosTagSet", TAG_SET.getTag(posTag.value().getTag()) != null); //assert declining probabilities Assert.assertTrue("Wrong order in " + posTags + " of " + span + "!", prevProb < 0 || posTag.probability() <= prevProb); prevProb = posTag.probability(); } Assert.assertNull("Tokens MUST NOT have Phrase annotations!", span.getAnnotation(PHRASE_ANNOTATION)); Assert.assertNull("Tokens MUST NOT have NER annotations!", span.getAnnotation(NER_ANNOTATION)); break; case Chunk: Assert.assertNull("Chunks MUST NOT have POS annotations!", span.getAnnotation(POS_ANNOTATION)); List<Token> tokens = AnalysedTextUtils.asList(((Chunk) span).getTokens()); prevProb = -1; List<Value<PhraseTag>> phraseTags = span.getAnnotations(PHRASE_ANNOTATION); boolean hasPhraseTag = (phraseTags != null && !phraseTags.isEmpty()); List<Value<NerTag>> nerTags = span.getAnnotations(NER_ANNOTATION); boolean hasNerTag = (nerTags != null && !nerTags.isEmpty()); Assert.assertTrue( "All Chunks with several words need to have a PhraseTag (missing for " + span + ")", hasPhraseTag || tokens.size() < 2); Assert.assertTrue("All Chunks with a single word need to have a NerTag (missing for" + span + ")", hasNerTag || tokens.size() > 1); for (Value<PhraseTag> phraseTag : phraseTags) { //assert Mapped PosTags Assert.assertNotNull("PhraseTag " + phraseTag + " is not mapped", phraseTag.value().getCategory()); //assert declining probabilities Assert.assertTrue(prevProb < 0 || phraseTag.probability() < prevProb); prevProb = phraseTag.probability(); } for (Value<NerTag> nerTag : nerTags) { Assert.assertTrue("NER Tags need to have a probability", nerTag.probability() > 0); } break; default: Assert.assertNull(span.getType() + " type Spans MUST NOT have POS annotations!", span.getAnnotation(POS_ANNOTATION)); Assert.assertNull(span.getType() + " type Spans MUST NOT have Phrase annotations!", span.getAnnotation(PHRASE_ANNOTATION)); Assert.assertNull(span.getType() + " type Spans MUST NOT have NER annotations!", span.getAnnotation(NER_ANNOTATION)); break; } } }
From source file:org.apache.sentry.policy.solr.TestSolrAuthorizationProviderGeneralCases.java
@Test public void testJuniorAnalyst() throws Exception { Set<SolrModelAction> allActions = EnumSet.allOf(SolrModelAction.class); doTestAuthProviderOnCollection(SUB_JUNIOR_ANALYST, COLL_JRANALYST1, allActions); Set<SolrModelAction> queryOnly = EnumSet.of(SolrModelAction.QUERY); doTestAuthProviderOnCollection(SUB_JUNIOR_ANALYST, COLL_PURCHASES_PARTIAL, queryOnly); Set<SolrModelAction> noActions = EnumSet.noneOf(SolrModelAction.class); doTestAuthProviderOnCollection(SUB_JUNIOR_ANALYST, COLL_PURCHASES, noActions); doTestAuthProviderOnCollection(SUB_JUNIOR_ANALYST, COLL_ANALYST1, noActions); doTestAuthProviderOnCollection(SUB_JUNIOR_ANALYST, COLL_TMP, noActions); }
From source file:com.htmlhifive.sync.resource.AbstractCrudSyncResource.java
/** * ??SyncAction????true???.//from w w w. j av a 2s . co m * * @param syncActionStr syncAction? * @return SyncAction???true */ private boolean isSyncAction(String syncActionStr) { if (syncActionStr == null) return false; for (SyncAction syncAction : EnumSet.allOf(SyncAction.class)) { if (syncAction.toString().equals(syncActionStr)) return true; } return false; }
From source file:org.bremersee.spring.autoconfigure.JerseyAutoConfiguration.java
@Bean @ConditionalOnMissingBean(name = "jerseyFilterRegistration") @ConditionalOnProperty(prefix = "spring.jersey", name = "type", havingValue = "filter") public FilterRegistrationBean jerseyFilterRegistration() { FilterRegistrationBean registration = new FilterRegistrationBean(); registration.setFilter(new ServletContainer(this.config)); registration.setUrlPatterns(Arrays.asList(this.path)); registration.setOrder(this.jersey.getFilter().getOrder()); registration.addInitParameter(ServletProperties.FILTER_CONTEXT_PATH, stripPattern(this.path)); addInitParameters(registration);//from w w w.java2s. c o m registration.setName("jerseyFilter"); registration.setDispatcherTypes(EnumSet.allOf(DispatcherType.class)); return registration; }