List of usage examples for java.util EnumSet of
public static <E extends Enum<E>> EnumSet<E> of(E e)
From source file:org.unidle.config.DispatcherServletInitializer.java
@Override public void onStartup(final ServletContext servletContext) throws ServletException { super.onStartup(servletContext); servletContext.setSessionTrackingModes(EnumSet.of(COOKIE)); final DelegatingFilterProxy wroFilter = servletContext.createFilter(DelegatingFilterProxy.class); wroFilter.setTargetFilterLifecycle(true); wroFilter.setBeanName("wroFilter"); servletContext.addFilter("wroFilter", wroFilter).addMappingForUrlPatterns(null, false, "/resources/*"); }
From source file:hudson.plugins.clearcase.ucm.service.BaselineService.java
public ActivitiesDelta compare(Baseline from, Baseline to) throws IOException { return compare(from, to, EnumSet.of(DiffBlOptions.ACTIVITIES), null); }
From source file:it.geosolutions.geonetwork.GeonetworkUpdateTest.java
@Test public void testUpdateMetadata() throws Exception { if (!runIntegrationTest()) return;//from ww w .j a v a2s . c om GNInsertConfiguration cfg = createDefaultInsertConfiguration(); GNPrivConfiguration pcfg = new GNPrivConfiguration(); pcfg.addPrivileges(GNPrivConfiguration.GROUP_GUEST, EnumSet.of(GNPriv.FEATURED)); pcfg.addPrivileges(GNPrivConfiguration.GROUP_INTRANET, EnumSet.of(GNPriv.DYNAMIC, GNPriv.FEATURED)); pcfg.addPrivileges(GNPrivConfiguration.GROUP_ALL, EnumSet.of(GNPriv.VIEW, GNPriv.DYNAMIC, GNPriv.FEATURED)); pcfg.addPrivileges(2, EnumSet.allOf(GNPriv.class)); File file = loadFile("metadata.xml"); assertNotNull(file); GNClient client = createClientAndLogin(); long id = client.insertMetadata(cfg, file); client.setPrivileges(id, pcfg); String version = GNMetadataGetVersion.get(client.getConnection(), gnServiceURL, id); LOGGER.info("Version is " + version); assertNotNull(version); assertEquals("2", version); // the md has just been created Element md = client.get(id); // XMLOutputter outputter = new XMLOutputter(Format.getPrettyFormat()); // outputter.output(md, System.out); final String UPDATED_TEXT = "Updated title"; { Element chstr = getTitleElement(md); assertEquals("TEST GeoBatch Action: GeoNetwork", chstr.getText()); chstr.setText(UPDATED_TEXT); } File tempFile = File.createTempFile("gnm_update", ".xml"); FileUtils.forceDeleteOnExit(tempFile); XMLOutputter fileOutputter = new XMLOutputter(Format.getCompactFormat()); FileUtils.writeStringToFile(tempFile, fileOutputter.outputString(md)); GNMetadataUpdate.update(client.getConnection(), gnServiceURL, id, version, tempFile); { Element md2 = client.get(id); Element chstr = getTitleElement(md2); assertEquals(UPDATED_TEXT, chstr.getText()); } String version3 = GNMetadataGetVersion.get(client.getConnection(), gnServiceURL, id); LOGGER.info("Version is " + version3); assertNotNull(version3); assertEquals("4", version3); // the md has been updated once // try bad version number try { GNMetadataUpdate.update(client.getConnection(), gnServiceURL, id, "9999", tempFile); fail("Bad version exception not trapped"); } catch (GNServerException e) { LOGGER.info("Bad version number error trapped properly (" + e.getMessage() + ")"); } // client.deleteMetadata(id); }
From source file:ch.cyberduck.ui.cocoa.CreateSymlinkController.java
protected void run(final Path selected, final String symlink, final boolean edit) { final Path link = new Path(this.getWorkdir(), symlink, EnumSet.of(Path.Type.file)); parent.background(new BrowserControllerBackgroundAction<Path>(parent) { @Override/*ww w. j a v a2 s . c o m*/ public Path run() throws BackgroundException { // Symlink pointing to existing file final Symlink feature = session.getFeature(Symlink.class); if (PreferencesFactory.get().getBoolean( String.format("%s.symlink.absolute", session.getHost().getProtocol().getScheme().name()))) { feature.symlink(link, selected.getAbsolute()); } else { feature.symlink(link, selected.getName()); } return link; } @Override public String getActivity() { return MessageFormat.format(LocaleFactory.localizedString("Uploading {0}", "Status"), symlink); } @Override public void cleanup() { super.cleanup(); if (symlink.charAt(0) == '.') { parent.setShowHiddenFiles(true); } parent.reload(parent.workdir(), Collections.singletonList(link), Collections.singletonList(link)); } }); }
From source file:ch.cyberduck.core.dav.DAVReadFeatureTest.java
@Test(expected = NotfoundException.class) public void testReadNotFound() throws Exception { final Host host = new Host(new DAVProtocol(), "test.cyberduck.ch", new Credentials(System.getProperties().getProperty("webdav.user"), System.getProperties().getProperty("webdav.password"))); host.setDefaultPath("/dav/basic"); final DAVSession session = new DAVSession(host); session.open(new DisabledHostKeyCallback()); session.login(new DisabledPasswordStore(), new DisabledLoginCallback(), new DisabledCancelCallback()); final TransferStatus status = new TransferStatus(); try {/* w w w .ja va2s . c om*/ new DAVReadFeature(session).read(new Path(new DefaultHomeFinderService(session).find(), "nosuchname", EnumSet.of(Path.Type.file)), status, new DisabledConnectionCallback()); } catch (NotfoundException e) { assertEquals( "Unexpected response (404 Not Found). Please contact your web hosting service provider for assistance.", e.getDetail()); throw e; } }
From source file:com.facebook.presto.geospatial.GeoFunctions.java
@Description("Returns a Geometry type LineString object from Well-Known Text representation (WKT)") @ScalarFunction("ST_LineFromText") @SqlType(GEOMETRY_TYPE_NAME)/* w w w. j a va2s.com*/ public static Slice parseLine(@SqlType(StandardTypes.VARCHAR) Slice input) { OGCGeometry geometry = OGCGeometry.fromText(input.toStringUtf8()); validateType("ST_LineFromText", geometry, EnumSet.of(LINE_STRING)); return serialize(geometry); }
From source file:ch.cyberduck.core.editor.AbstractEditorTest.java
@Test public void testEquals() throws Exception { final NullSession session = new NullSession(new Host(new TestProtocol())); assertEquals(new DisabledEditor(new Application("i"), new StatelessSessionPool(new TestLoginConnectionService(), session, PathCache.empty(), new DisabledTranscriptListener(), new DefaultVaultRegistry(new DisabledPasswordCallback())), new Path("/p/f", EnumSet.of(Path.Type.file))), new DisabledEditor(new Application("i"), new StatelessSessionPool(new TestLoginConnectionService(), session, PathCache.empty(), new DisabledTranscriptListener(), new DefaultVaultRegistry(new DisabledPasswordCallback())), new Path("/p/f", EnumSet.of(Path.Type.file)))); assertNotEquals(new DisabledEditor(new Application("i"), new StatelessSessionPool(new TestLoginConnectionService(), session, PathCache.empty(), new DisabledTranscriptListener(), new DefaultVaultRegistry(new DisabledPasswordCallback())), new Path("/p/f", EnumSet.of(Path.Type.file))), new DisabledEditor(new Application("i"), new StatelessSessionPool(new TestLoginConnectionService(), session, PathCache.empty(), new DisabledTranscriptListener(), new DefaultVaultRegistry(new DisabledPasswordCallback())), new Path("/p/g", EnumSet.of(Path.Type.file)))); assertNotEquals(new DisabledEditor(new Application("a"), new StatelessSessionPool(new TestLoginConnectionService(), session, PathCache.empty(), new DisabledTranscriptListener(), new DefaultVaultRegistry(new DisabledPasswordCallback())), new Path("/p/f", EnumSet.of(Path.Type.file))), new DisabledEditor(new Application("i"), new StatelessSessionPool(new TestLoginConnectionService(), session, PathCache.empty(), new DisabledTranscriptListener(), new DefaultVaultRegistry(new DisabledPasswordCallback())), new Path("/p/f", EnumSet.of(Path.Type.file)))); }
From source file:ch.cyberduck.core.nio.LocalWriteFeatureTest.java
@Test public void testWriteSymlink() throws Exception { final LocalSession session = new LocalSession( new Host(new LocalProtocol(), new LocalProtocol().getDefaultHostname())); if (session.isPosixFilesystem()) { session.open(new DisabledHostKeyCallback()); session.login(new DisabledPasswordStore(), new DisabledLoginCallback(), new DisabledCancelCallback()); final Path workdir = new LocalHomeFinderFeature(session).find(); final Path target = new Path(workdir, UUID.randomUUID().toString(), EnumSet.of(Path.Type.file)); new LocalTouchFeature(session).touch(target, new TransferStatus()); assertTrue(new LocalFindFeature(session).find(target)); final String name = UUID.randomUUID().toString(); final Path symlink = new Path(workdir, name, EnumSet.of(Path.Type.file, AbstractPath.Type.symboliclink)); new LocalSymlinkFeature(session).symlink(symlink, target.getName()); assertTrue(new LocalFindFeature(session).find(symlink)); final TransferStatus status = new TransferStatus(); final int length = 1048576; final byte[] content = RandomUtils.nextBytes(length); status.setLength(content.length); status.setExists(true);/* w w w . ja v a2s . co m*/ final OutputStream out = new LocalWriteFeature(session).write(symlink, status, new DisabledConnectionCallback()); new StreamCopier(status, status).transfer(new ByteArrayInputStream(content), out); out.close(); { final ByteArrayOutputStream buffer = new ByteArrayOutputStream(content.length); final InputStream in = new LocalReadFeature(session).read(symlink, new TransferStatus().length(content.length), new DisabledConnectionCallback()); new StreamCopier(status, status).transfer(in, buffer); assertArrayEquals(content, buffer.toByteArray()); } { final byte[] buffer = new byte[0]; final InputStream in = new LocalReadFeature(session).read(target, new TransferStatus(), new DisabledConnectionCallback()); IOUtils.readFully(in, buffer); in.close(); assertArrayEquals(new byte[0], buffer); } final AttributedList<Path> list = new LocalListService(session).list(workdir, new DisabledListProgressListener()); assertTrue(list.contains(new Path(workdir, name, EnumSet.of(Path.Type.file)))); assertFalse(list.contains(symlink)); new LocalDeleteFeature(session).delete(Arrays.asList(target, symlink), new DisabledLoginCallback(), new Delete.DisabledCallback()); } }
From source file:com.netflix.simianarmy.aws.janitor.crawler.edda.EddaLaunchConfigJanitorCrawler.java
@Override public EnumSet<? extends ResourceType> resourceTypes() { return EnumSet.of(AWSResourceType.LAUNCH_CONFIG); }
From source file:alfio.util.PreReservedTicketDistributor.java
@Override public Set<Characteristics> characteristics() { return EnumSet.of(Characteristics.IDENTITY_FINISH); }