Java Code Examples for java.util.EnumSet
The following examples show how to use
java.util.EnumSet. These examples are extracted from open source projects.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: onedev Source File: DefaultPersistManager.java License: MIT License | 6 votes |
protected void dropConstraints(Metadata metadata) { File tempFile = null; try { tempFile = File.createTempFile("schema", ".sql"); new SchemaExport().setOutputFile(tempFile.getAbsolutePath()) .setFormat(false).drop(EnumSet.of(TargetType.SCRIPT), metadata); List<String> sqls = new ArrayList<>(); for (String sql: FileUtils.readLines(tempFile, Charset.defaultCharset())) { if (isDroppingConstraints(sql)) sqls.add(sql); } execute(sqls, false); } catch (IOException e) { throw new RuntimeException(e); } finally { if (tempFile != null) tempFile.delete(); } }
Example 2
Source Project: netbeans Source File: FilesystemInterceptorTest.java License: Apache License 2.0 | 6 votes |
public void testCopyAddedFile2UnversionedFolder_DO() throws Exception { // init File fromFile = new File(repositoryLocation, "file"); fromFile.createNewFile(); File toFolder = new File(repositoryLocation.getParentFile(), "toFolder"); toFolder.mkdirs(); File toFile = new File(toFolder, fromFile.getName()); // add add(fromFile); // copy copyDO(fromFile, toFile); getCache().refreshAllRoots(Collections.singleton(fromFile)); getCache().refreshAllRoots(Collections.singleton(toFile)); // test assertTrue(fromFile.exists()); assertTrue(toFile.exists()); assertEquals(EnumSet.of(Status.NEW_HEAD_INDEX, Status.NEW_HEAD_WORKING_TREE), getCache().getStatus(fromFile).getStatus()); assertEquals(EnumSet.of(Status.NOTVERSIONED_NOTMANAGED), getCache().getStatus(toFile).getStatus()); }
Example 3
Source Project: picocli Source File: ArgGroupParameterizedTest.java License: Apache License 2.0 | 6 votes |
@Test @junitparams.Parameters(method = "commandMethodArgs") public void testCommandMethod(String args, InvokedSub invokedSub, ArgGroupTest.SomeMixin expectedMixin, ArgGroupTest.Composite expectedArgGroup, int[] expectedPositionalInt, String[] expectedStrings) { ArgGroupTest.CommandMethodsWithGroupsAndMixins bean = new ArgGroupTest.CommandMethodsWithGroupsAndMixins(); new CommandLine(bean).execute(args.split(" ")); assertTrue(bean.invoked.contains(invokedSub)); EnumSet<InvokedSub> notInvoked = EnumSet.allOf(InvokedSub.class); notInvoked.remove(invokedSub); for (InvokedSub sub : notInvoked) { assertFalse(bean.invoked.contains(sub)); } assertTrue(bean.invoked.contains(invokedSub)); assertEquals(expectedMixin, bean.myMixin); assertEquals(expectedArgGroup, bean.myComposite); assertArrayEquals(expectedPositionalInt, bean.myPositionalInt); assertArrayEquals(expectedStrings, bean.myStrings); }
Example 4
Source Project: logparser Source File: GeoIPISPDissector.java License: Apache License 2.0 | 6 votes |
@Override public EnumSet<Casts> prepareForDissect(final String inputname, final String outputname) { EnumSet<Casts> result = super.prepareForDissect(inputname, outputname); if (!result.isEmpty()) { return result; } String name = extractFieldName(inputname, outputname); switch (name) { case "isp.name": wantIspName = true; return STRING_ONLY; case "isp.organization": wantIspOrganization = true; return STRING_ONLY; default: return NO_CASTS; } }
Example 5
Source Project: qpid-broker-j Source File: SimpleConversionTest.java License: Apache License 2.0 | 6 votes |
@Test public void providerAssignedMessageId_UuidMode_10_010() throws Exception { assumeTrue(EnumSet.of(Protocol.AMQP_1_0).contains(getPublisherProtocolVersion()) && EnumSet.of(Protocol.AMQP_0_10).contains(getSubscriberProtocolVersion())); List<ClientMessage> clientResults = performProviderAssignedMessageIdTest(Collections.singletonMap( JMS_MESSAGE_IDPOLICY_MESSAGE_IDTYPE, "UUID")); ClientMessage publishedMessage = clientResults.get(0); ClientMessage subscriberMessage = clientResults.get(1); // On the wire the message-id is a message-id-uuid final String publishedJmsMessageID = publishedMessage.getJMSMessageID(); assertThat(publishedJmsMessageID, startsWith("ID:AMQP_UUID:")); String barePublishedJmsMessageID = publishedJmsMessageID.substring("ID:AMQP_UUID:".length()); String expectedSubscriberJmsMessageID = String.format("ID:%s", barePublishedJmsMessageID); assertThat(subscriberMessage.getJMSMessageID(), equalTo(expectedSubscriberJmsMessageID)); }
Example 6
Source Project: cyberduck Source File: S3MetadataFeatureTest.java License: GNU General Public License v3.0 | 6 votes |
@Test public void testSetMetadataFileLeaveOtherFeatures() throws Exception { final Path container = new Path("test-us-east-1-cyberduck", EnumSet.of(Path.Type.volume)); final Path test = new Path(container, UUID.randomUUID().toString(), EnumSet.of(Path.Type.file)); new S3TouchFeature(session).touch(test, new TransferStatus()); final String v = UUID.randomUUID().toString(); final S3StorageClassFeature storage = new S3StorageClassFeature(session); storage.setClass(test, S3Object.STORAGE_CLASS_REDUCED_REDUNDANCY); assertEquals(S3Object.STORAGE_CLASS_REDUCED_REDUNDANCY, storage.getClass(test)); final S3EncryptionFeature encryption = new S3EncryptionFeature(session); encryption.setEncryption(test, S3EncryptionFeature.SSE_AES256); assertEquals("AES256", encryption.getEncryption(test).algorithm); final S3MetadataFeature feature = new S3MetadataFeature(session, new S3AccessControlListFeature(session)); feature.setMetadata(test, Collections.singletonMap("Test", v)); final Map<String, String> metadata = feature.getMetadata(test); assertFalse(metadata.isEmpty()); assertTrue(metadata.containsKey("test")); assertEquals(v, metadata.get("test")); assertEquals(S3Object.STORAGE_CLASS_REDUCED_REDUNDANCY, storage.getClass(test)); assertEquals("AES256", encryption.getEncryption(test).algorithm); new S3DefaultDeleteFeature(session).delete(Collections.singletonList(test), new DisabledLoginCallback(), new Delete.DisabledCallback()); }
Example 7
Source Project: openjdk-8 Source File: OcspUnauthorized.java License: GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) throws Exception { cf = CertificateFactory.getInstance("X.509"); X509Certificate taCert = getX509Cert(TRUST_ANCHOR); X509Certificate eeCert = getX509Cert(EE_CERT); CertPath cp = cf.generateCertPath(Collections.singletonList(eeCert)); CertPathValidator cpv = CertPathValidator.getInstance("PKIX"); PKIXRevocationChecker prc = (PKIXRevocationChecker)cpv.getRevocationChecker(); prc.setOptions(EnumSet.of(Option.SOFT_FAIL, Option.NO_FALLBACK)); byte[] response = base64Decoder.decode(OCSP_RESPONSE); prc.setOcspResponses(Collections.singletonMap(eeCert, response)); TrustAnchor ta = new TrustAnchor(taCert, null); PKIXParameters params = new PKIXParameters(Collections.singleton(ta)); params.addCertPathChecker(prc); try { cpv.validate(cp, params); throw new Exception("FAILED: expected CertPathValidatorException"); } catch (CertPathValidatorException cpve) { cpve.printStackTrace(); } }
Example 8
Source Project: cyberduck Source File: SDSSharesUrlProviderTest.java License: GNU General Public License v3.0 | 6 votes |
@Test(expected = InteroperabilityException.class) public void testToUrlInvalidSMSRecipients() throws Exception { final SDSNodeIdProvider nodeid = new SDSNodeIdProvider(session).withCache(cache); final Path room = new SDSDirectoryFeature(session, nodeid).mkdir(new Path(new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory, Path.Type.volume, Path.Type.triplecrypt)), null, new TransferStatus()); final Path test = new SDSTouchFeature(session, nodeid).touch(new Path(room, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)), new TransferStatus()); try { final DescriptiveUrl url = new SDSSharesUrlProvider(session, nodeid).toDownloadUrl(test, new CreateDownloadShareRequest() .expiration(new ObjectExpiration().enableExpiration(false)) .notifyCreator(false) .sendMail(false) .mailRecipients(null) .sendSms(true) .smsRecipients("invalid") .password("p") .mailSubject(null) .mailBody(null) .maxDownloads(null), new DisabledPasswordCallback()); } finally { new SDSDeleteFeature(session, nodeid).delete(Collections.singletonList(room), new DisabledLoginCallback(), new Delete.DisabledCallback()); } }
Example 9
Source Project: gemfirexd-oss Source File: TXManagerImpl.java License: Apache License 2.0 | 6 votes |
public final TXStateProxy resumeTX(final TXManagerImpl.TXContext context, final IsolationLevel isolationLevel, final EnumSet<TransactionFlag> txFlags, TXId txid) { checkClosed(); TXId txId = context.getTXId(); context.remoteBatching(false); if (txId != null) { throw new IllegalTransactionStateException( LocalizedStrings.TXManagerImpl_TRANSACTION_0_ALREADY_IN_PROGRESS .toLocalizedString(txId)); } txId = txid; // Do we have a proxy here TXStateProxy txState = this.hostedTXStates.get(txId); if (txState != null) { return txState; } txState = this.hostedTXStates.create(txId, txStateProxyCreator, isolationLevel, txFlags, false); // context.setTXState(txState); return txState; }
Example 10
Source Project: incubator-tez Source File: DAGAppMaster.java License: Apache License 2.0 | 6 votes |
private synchronized void checkAndHandleSessionTimeout() { if (EnumSet.of(DAGAppMasterState.RUNNING, DAGAppMasterState.RECOVERING).contains(this.state) || sessionStopped.get()) { // DAG running or session already completed, cannot timeout session return; } long currentTime = clock.getTime(); if (currentTime < (lastDAGCompletionTime + sessionTimeoutInterval)) { return; } LOG.info("Session timed out" + ", lastDAGCompletionTime=" + lastDAGCompletionTime + " ms" + ", sessionTimeoutInterval=" + sessionTimeoutInterval + " ms"); shutdownTezAM(); }
Example 11
Source Project: hadoop-ozone Source File: OzoneBlockTokenSecretManager.java License: Apache License 2.0 | 6 votes |
/** * Generate an block token for specified user, blockId. Service field for * token is set to blockId. * * @param user * @param blockId * @param modes * @param maxLength * @return token */ public Token<OzoneBlockTokenIdentifier> generateToken(String user, String blockId, EnumSet<AccessModeProto> modes, long maxLength) { OzoneBlockTokenIdentifier tokenIdentifier = createIdentifier(user, blockId, modes, maxLength); if (LOG.isTraceEnabled()) { long expiryTime = tokenIdentifier.getExpiryDate(); String tokenId = tokenIdentifier.toString(); LOG.trace("Issued delegation token -> expiryTime:{}, tokenId:{}", expiryTime, tokenId); } // Pass blockId as service. return new Token<>(tokenIdentifier.getBytes(), createPassword(tokenIdentifier), tokenIdentifier.getKind(), new Text(blockId)); }
Example 12
Source Project: dragonwell8_jdk Source File: Bundle.java License: GNU General Public License v2.0 | 6 votes |
@SuppressWarnings("ConvertToStringSwitch") Bundle(String id, String cldrPath, String bundles, String currencies) { this.id = id; this.cldrPath = cldrPath; if ("localenames".equals(bundles)) { bundleTypes = EnumSet.of(Type.LOCALENAMES); } else if ("currencynames".equals(bundles)) { bundleTypes = EnumSet.of(Type.CURRENCYNAMES); } else { bundleTypes = Type.ALL_TYPES; } if (currencies == null) { currencies = "local"; } this.currencies = currencies; addBundle(); }
Example 13
Source Project: libreveris Source File: SampleVerifier.java License: GNU Lesser General Public License v3.0 | 6 votes |
@Override public void actionPerformed (ActionEvent e) { // Populate with shape names found in selected folders List<String> folders = folderSelector.list.getSelectedValuesList(); if (folders.isEmpty()) { logger.warn("No folders selected in Folder Selector"); } else { EnumSet<Shape> shapeSet = EnumSet.noneOf(Shape.class); for (String folder : folders) { File dir = getActualDir(folder); // Add all glyphs files from this directory for (File file : repository.getGlyphsIn(dir)) { shapeSet.add(Shape.valueOf(radixOf(file.getName()))); } } populateWith(shapeSet); } }
Example 14
Source Project: openjdk-8 Source File: T6431257.java License: GNU General Public License v2.0 | 6 votes |
void testPackage(String packageName) throws IOException { JavaFileObject object = fm.getJavaFileForInput(PLATFORM_CLASS_PATH, "java.lang.Object", CLASS); Iterable<? extends JavaFileObject> files = fm.list(CLASS_OUTPUT, packageName, EnumSet.of(CLASS), false); boolean found = false; String binaryPackageName = packageName.replace('/', '.'); for (JavaFileObject file : files) { System.out.println("Found " + file.getName() + " in " + packageName); String name = fm.inferBinaryName(CLASS_OUTPUT, file); found |= name.equals(binaryPackageName + ".package-info"); JavaFileObject other = fm.getJavaFileForInput(CLASS_OUTPUT, name, CLASS); if (!fm.isSameFile(file, other)) throw new AssertionError(file + " != " + other); if (fm.isSameFile(file, object)) throw new AssertionError(file + " == " + object); } if (!found) throw new AssertionError("Did not find " + binaryPackageName + ".package-info"); }
Example 15
Source Project: NNAnalytics Source File: TestNNAnalyticsBase.java License: Apache License 2.0 | 6 votes |
@Test public void testInvalidQueryChecker() throws Exception { HashMap<INodeSet, HashMap<String, HashMap<String, ArrayList<EnumSet<Filter>>>>> setSumTypeFilterConfig = getInvalidCombinations(); String[] parameters = new String[4]; for (INodeSet set : INodeSet.values()) { String setType = set.toString(); parameters[0] = setType; HashMap<String, HashMap<String, ArrayList<EnumSet<Filter>>>> sumTypeFilters = setSumTypeFilterConfig.get(set); for (Map.Entry<String, HashMap<String, ArrayList<EnumSet<Filter>>>> sumTypeFilter : sumTypeFilters.entrySet()) { HashMap<String, ArrayList<EnumSet<Filter>>> typeFilters = sumTypeFilter.getValue(); String sum = sumTypeFilter.getKey(); parameters[1] = sum; for (Map.Entry<String, ArrayList<EnumSet<Filter>>> typeFilter : typeFilters.entrySet()) { String type = typeFilter.getKey(); parameters[2] = type; String testingURL = buildQuery(parameters); testQuery(testingURL, false); } } } }
Example 16
Source Project: snowplow-android-tracker Source File: TLSArgumentsTest.java License: Apache License 2.0 | 5 votes |
public void testEnumStringConversion() { EnumSet<TLSVersion> versions = EnumSet.of(TLSVersion.TLSv1_2, TLSVersion.TLSv1_1); TLSArguments arguments = new TLSArguments(versions); String[] stringVersions = arguments.getVersions(); assertTrue(Arrays.asList(stringVersions).contains("TLSv1.2")); assertTrue(Arrays.asList(stringVersions).contains("TLSv1.1")); }
Example 17
Source Project: albedo Source File: WebConfigurer.java License: GNU Lesser General Public License v3.0 | 5 votes |
/** * Initializes the caching HTTP Headers Filter. */ private void initCachingHttpHeadersFilter(ServletContext servletContext, EnumSet<DispatcherType> disps) { log.debug("Registering Caching HTTP Headers Filter"); FilterRegistration.Dynamic cachingHttpHeadersFilter = servletContext.addFilter("cachingHttpHeadersFilter", new CachingHttpHeadersFilter(applicationProperties)); cachingHttpHeadersFilter.addMappingForUrlPatterns(disps, true, "/statics/*", "/WEB-INF/views/*"); cachingHttpHeadersFilter.setAsyncSupported(true); }
Example 18
Source Project: gitea-plugin Source File: ForkPullRequestDiscoveryTrait.java License: MIT License | 5 votes |
/** * Returns the strategies. * * @return the strategies. */ @NonNull public Set<ChangeRequestCheckoutStrategy> getStrategies() { switch (strategyId) { case 1: return EnumSet.of(ChangeRequestCheckoutStrategy.MERGE); case 2: return EnumSet.of(ChangeRequestCheckoutStrategy.HEAD); case 3: return EnumSet.of(ChangeRequestCheckoutStrategy.HEAD, ChangeRequestCheckoutStrategy.MERGE); default: return EnumSet.noneOf(ChangeRequestCheckoutStrategy.class); } }
Example 19
Source Project: jdk8u-dev-jdk Source File: ScanManagerTest.java License: GNU General Public License v2.0 | 5 votes |
/** * Test of stop method, of class com.sun.jmx.examples.scandir.ScanManager. */ public void testStop() throws Exception { System.out.println("stop"); final ScanManagerMXBean manager = ScanManager.register(); try { manager.schedule(1000000,0); assertContained(EnumSet.of(SCHEDULED),manager.getState()); final Call op = new Call() { public void call() throws Exception { manager.stop(); assertEquals(STOPPED,manager.getState()); } public void cancel() throws Exception { if (manager.getState() != STOPPED) manager.stop(); } }; doTestOperation(manager,op,EnumSet.of(STOPPED),"stop"); } finally { try { ManagementFactory.getPlatformMBeanServer(). unregisterMBean(ScanManager.SCAN_MANAGER_NAME); } catch (Exception x) { System.err.println("Failed to cleanup: "+x); } } }
Example 20
Source Project: jdk8u-jdk Source File: DirectoryScannerTest.java License: GNU General Public License v2.0 | 5 votes |
/** * Test of addNotificationListener method, of class com.sun.jmx.examples.scandir.DirectoryScanner. */ public void testAddNotificationListener() throws Exception { System.out.println("addNotificationListener"); final ScanManagerMXBean manager = ScanManager.register(); final Call op = new Call() { public void call() throws Exception { manager.start(); } public void cancel() throws Exception { manager.stop(); } }; try { final String tmpdir = System.getProperty("java.io.tmpdir"); final ScanDirConfigMXBean config = manager.getConfigurationMBean(); final DirectoryScannerConfig bean = config.addDirectoryScanner("test1",tmpdir,".*",0,0); manager.applyConfiguration(true); final DirectoryScannerMXBean proxy = manager.getDirectoryScanners().get("test1"); doTestOperation(proxy,op, EnumSet.of(RUNNING,SCHEDULED), "scan"); } finally { try { ManagementFactory.getPlatformMBeanServer(). unregisterMBean(ScanManager.SCAN_MANAGER_NAME); } catch (Exception x) { System.err.println("Failed to cleanup: "+x); } } }
Example 21
Source Project: audiveris Source File: ShapeSet.java License: GNU Affero General Public License v3.0 | 5 votes |
/** * Report the template notes suitable for the provided sheet. * * @param sheet provided sheet or null * @return the template notes, perhaps limited by sheet processing switches */ public static EnumSet<Shape> getTemplateNotes (Sheet sheet) { final EnumSet<Shape> set = EnumSet.of( NOTEHEAD_BLACK, NOTEHEAD_VOID, WHOLE_NOTE, NOTEHEAD_BLACK_SMALL, NOTEHEAD_VOID_SMALL, WHOLE_NOTE_SMALL); if (sheet == null) { return set; } final ProcessingSwitches switches = sheet.getStub().getProcessingSwitches(); if (!switches.getValue(Switch.smallBlackHeads)) { set.remove(NOTEHEAD_BLACK_SMALL); } if (!switches.getValue(Switch.smallVoidHeads)) { set.remove(NOTEHEAD_VOID_SMALL); } if (!switches.getValue(Switch.smallWholeHeads)) { set.remove(WHOLE_NOTE_SMALL); } return set; }
Example 22
Source Project: cyberduck Source File: GoogleStorageDirectoryFeatureTest.java License: GNU General Public License v3.0 | 5 votes |
@Test public void testDirectoryWhitespace() throws Exception { final Path bucket = new Path("test.cyberduck.ch", EnumSet.of(Path.Type.directory, Path.Type.volume)); final Path test = new GoogleStorageDirectoryFeature(session).mkdir(new Path(bucket, String.format("%s %s", new AlphanumericRandomStringService().random(), new AlphanumericRandomStringService().random()), EnumSet.of(Path.Type.directory)), null, new TransferStatus()); assertTrue(new GoogleStorageFindFeature(session).find(test)); assertTrue(new DefaultFindFeature(session).find(test)); new GoogleStorageDeleteFeature(session).delete(Collections.<Path>singletonList(test), new DisabledLoginCallback(), new Delete.DisabledCallback()); }
Example 23
Source Project: openjdk-8 Source File: Infer.java License: GNU General Public License v2.0 | 5 votes |
private boolean solveBasic(List<Type> varsToSolve, EnumSet<InferenceStep> steps) { boolean changed = false; for (Type t : varsToSolve.intersect(restvars())) { UndetVar uv = (UndetVar)asFree(t); for (InferenceStep step : steps) { if (step.accepts(uv, this)) { uv.inst = step.solve(uv, this); changed = true; break; } } } return changed; }
Example 24
Source Project: green_android Source File: TestNet3Params.java License: GNU General Public License v3.0 | 5 votes |
@Override public EnumSet<Script.VerifyFlag> getTransactionVerificationFlags( final Block block, final Transaction transaction, final VersionTally tally, final Integer height) { final EnumSet<Script.VerifyFlag> flags = super.getTransactionVerificationFlags(block, transaction, tally, height); if (height >= SEGWIT_ENFORCE_HEIGHT) flags.add(Script.VerifyFlag.SEGWIT); return flags; }
Example 25
Source Project: azure-storage-android Source File: LogBlobIterator.java License: Apache License 2.0 | 5 votes |
public LogBlobIterator(final CloudBlobDirectory logDirectory, final Date startDate, final Date endDate, final EnumSet<LoggingOperations> operations, final EnumSet<BlobListingDetails> details, final BlobRequestOptions options, final OperationContext opContext) { TimeZone gmtTime = TimeZone.getTimeZone("GMT"); HOUR_FORMAT.setTimeZone(gmtTime); DAY_FORMAT.setTimeZone(gmtTime); MONTH_FORMAT.setTimeZone(gmtTime); YEAR_FORMAT.setTimeZone(gmtTime); this.logDirectory = logDirectory; this.operations = operations; this.details = details; this.opContext = opContext; if (options == null) { this.options = new BlobRequestOptions(); } else { this.options = options; } if (startDate != null) { this.startDate = new GregorianCalendar(); this.startDate.setTime(startDate); this.startDate.add(GregorianCalendar.MINUTE, (-this.startDate.get(GregorianCalendar.MINUTE))); this.startDate.setTimeZone(gmtTime); } if (endDate != null) { this.endDate = new GregorianCalendar(); this.endDate.setTime(endDate); this.endDate.setTimeZone(gmtTime); this.endPrefix = this.logDirectory.getPrefix() + HOUR_FORMAT.format(this.endDate.getTime()); } }
Example 26
Source Project: ehcache3 Source File: EhcacheBasicRemoveTest.java License: Apache License 2.0 | 5 votes |
/** * Tests the effect of a {@link Ehcache#remove(Object)} for * <ul> * <li>key not present in {@code Store}</li> * </ul> */ @Test public void testRemoveNoStoreEntry() throws Exception { final FakeStore fakeStore = new FakeStore(Collections.<String, String>emptyMap()); this.store = spy(fakeStore); final Ehcache<String, String> ehcache = this.getEhcache(); ehcache.remove("key"); verify(this.store).remove(eq("key")); verifyZeroInteractions(this.resilienceStrategy); assertThat(fakeStore.getEntryMap().containsKey("key"), is(false)); validateStats(ehcache, EnumSet.of(CacheOperationOutcomes.RemoveOutcome.NOOP)); }
Example 27
Source Project: jaybird Source File: GeneratedKeysSupportFactoryTest.java License: GNU Lesser General Public License v2.1 | 5 votes |
@Test public void testCreateFor_INSERT_UPDATE_3_0_both() throws SQLException { expectDatabaseVersionCheck(3, 0); GeneratedKeysSupport generatedKeysSupport = GeneratedKeysSupportFactory .createFor("INSERT,UPDATE", dbMetadata); assertThat(generatedKeysSupport.supportedQueryTypes(), equalTo(EnumSet.of(GeneratedKeysSupport.QueryType.INSERT, GeneratedKeysSupport.QueryType.UPDATE))); }
Example 28
Source Project: hadoop Source File: FileContextTestHelper.java License: Apache License 2.0 | 5 votes |
public static void writeFile(FileContext fc, Path path, byte b[]) throws IOException { FSDataOutputStream out = fc.create(path,EnumSet.of(CreateFlag.CREATE), CreateOpts.createParent()); out.write(b); out.close(); }
Example 29
Source Project: dragonwell8_jdk Source File: FontPanel.java License: GNU General Public License v2.0 | 5 votes |
public static Object getValue(int ordinal) { if (valArray == null) { valArray = (FMValues[])EnumSet.allOf(FMValues.class).toArray(new FMValues[0]); } for (int i=0;i<valArray.length;i++) { if (valArray[i].ordinal() == ordinal) { return valArray[i]; } } return valArray[0]; }
Example 30
Source Project: cf-java-logging-support Source File: RequestLogTest.java License: Apache License 2.0 | 5 votes |
private Server initJetty() throws Exception { Server server = new Server(0); ServletContextHandler handler = new ServletContextHandler(server, null); handler.addFilter(RequestLoggingFilter.class, "/*", EnumSet.of(DispatcherType.INCLUDE, DispatcherType.REQUEST, DispatcherType.ERROR, DispatcherType.FORWARD, DispatcherType.ASYNC)); handler.addServlet(TestServlet.class, "/test"); server.start(); return server; }