List of usage examples for java.util EnumSet noneOf
public static <E extends Enum<E>> EnumSet<E> noneOf(Class<E> elementType)
From source file:com.streamsets.pipeline.stage.origin.udp.BaseUDPSourceTest.java
public void testIterator(int numThreads, boolean epoll) throws Exception { int maxRuns = 3; List<AssertionError> failures = new ArrayList<>(); EnumSet<DatagramMode> remainingFormats = EnumSet.of(DatagramMode.NETFLOW, DatagramMode.SYSLOG, DatagramMode.RAW_DATA);//from w w w. j a va 2s.co m for (int i = 0; i < maxRuns; i++) { try { EnumSet<DatagramMode> succeededFormats = EnumSet.noneOf(DatagramMode.class); for (DatagramMode mode : remainingFormats) { doBasicTest(mode, epoll, numThreads); succeededFormats.add(mode); } remainingFormats.removeAll(succeededFormats); } catch (Exception ex) { // we don't expect exceptions to be thrown, // even when udp messages are lost throw ex; } catch (AssertionError failure) { String msg = "Test failed on iteration: " + i; LOG.error(msg, failure); failures.add(failure); Assert.assertTrue("Interrupted while sleeping", ThreadUtil.sleep(10 * 1000)); } } if (failures.size() >= maxRuns) { throw failures.get(0); } }
From source file:org.apache.hadoop.tools.util.TestDistCpUtils.java
@Test public void testPackAttributes() { EnumSet<FileAttribute> attributes = EnumSet.noneOf(FileAttribute.class); Assert.assertEquals(DistCpUtils.packAttributes(attributes), ""); attributes.add(FileAttribute.REPLICATION); Assert.assertEquals(DistCpUtils.packAttributes(attributes), "R"); attributes.add(FileAttribute.BLOCKSIZE); Assert.assertEquals(DistCpUtils.packAttributes(attributes), "RB"); attributes.add(FileAttribute.USER); attributes.add(FileAttribute.CHECKSUMTYPE); Assert.assertEquals(DistCpUtils.packAttributes(attributes), "RBUC"); attributes.add(FileAttribute.GROUP); Assert.assertEquals(DistCpUtils.packAttributes(attributes), "RBUGC"); attributes.add(FileAttribute.PERMISSION); Assert.assertEquals(DistCpUtils.packAttributes(attributes), "RBUGPC"); attributes.add(FileAttribute.TIMES); Assert.assertEquals(DistCpUtils.packAttributes(attributes), "RBUGPCT"); }
From source file:com.github.fge.jsonschema.core.keyword.syntax.SyntaxProcessorTest.java
@BeforeMethod public void initialize() { report = spy(new TestProcessingReport()); final DictionaryBuilder<SyntaxChecker> builder = Dictionary.newBuilder(); checker = mock(SyntaxChecker.class); builder.addEntry(K1, checker);/*from w w w . ja v a2 s.com*/ builder.addEntry(K2, new SyntaxChecker() { @Override public EnumSet<NodeType> getValidTypes() { return EnumSet.noneOf(NodeType.class); } @Override public void checkSyntax(final Collection<JsonPointer> pointers, final MessageBundle bundle, final ProcessingReport report, final SchemaTree tree) throws ProcessingException { report.error(new ProcessingMessage().setMessage(ERRMSG)); } }); processor = new SyntaxProcessor(BUNDLE, builder.freeze()); }
From source file:de.fiz.ddb.aas.utils.LDAPEngineUtility.java
public Set<PrivilegeEnum> privilegeDiff(Set<PrivilegeEnum> p0, Set<PrivilegeEnum> p1) { // Set<Privilege> privilege = new HashSet<Privilege> (); Set<PrivilegeEnum> privilege = EnumSet.noneOf(PrivilegeEnum.class); for (PrivilegeEnum p : p1) { if (!p0.contains(p)) { privilege.add(p);/*from w w w. java 2 s. c o m*/ } } return privilege; }
From source file:ru.savvy.jpafilterbuilder.FilterCriteriaBuilder.java
/** * Creates new instance. Class/*from w ww . ja va 2s . c o m*/ * * @param em * @param clazz must be JPA Entity annotated */ public FilterCriteriaBuilder(EntityManager em, Class<T> clazz) { this.clazz = clazz; this.cb = em.getCriteriaBuilder(); //this.query = cb.createQuery(clazz); //this.root = query.from(clazz); this.options = EnumSet.noneOf(Option.class); this.pb = new PredicateBuilder(cb, options); this.metamodel = em.getMetamodel(); }
From source file:com.mellanox.r4h.TestHFlush.java
/** * The test uses// ww w . ja v a 2s . c o m * {@link #doTheJob(Configuration, String, long, short, boolean, EnumSet)} * to write a file with a custom block size so the writes will be * happening across block' boundaries */ @Test public void hFlush_02() throws IOException { Configuration conf = new HdfsConfiguration(); int customPerChecksumSize = 512; int customBlockSize = customPerChecksumSize * 3; // Modify defaul filesystem settings conf.setInt(DFSConfigKeys.DFS_BYTES_PER_CHECKSUM_KEY, customPerChecksumSize); conf.setLong(DFSConfigKeys.DFS_BLOCK_SIZE_KEY, customBlockSize); doTheJob(conf, fName, customBlockSize, (short) 2, false, EnumSet.noneOf(SyncFlag.class)); }
From source file:com.github.pjungermann.config.specification.constraint.inetAddress.InetAddressConstraint.java
@Nullable protected EnumSet<InetAddressType> configureAllowedVersions(@Nullable final Object expectation) { if (expectation == null) { return null; }/* w w w .java 2 s.c o m*/ if (expectation instanceof Boolean) { boolean allowed = (boolean) expectation; return allowed ? EnumSet.allOf(InetAddressType.class) : EnumSet.noneOf(InetAddressType.class); } if (expectation instanceof CharSequence) { return asCheckedEnumSet(singleton(expectation.toString())); } if (expectation instanceof Collection) { return asCheckedEnumSet((Collection) expectation); } return null; }
From source file:net.ripe.rpki.commons.crypto.x509cert.X509ResourceCertificate.java
protected X509ResourceCertificate(X509Certificate certificate) { super(certificate); ResourceExtensionParser parser = new ResourceExtensionParser(); inheritedResourceTypes = EnumSet.noneOf(IpResourceType.class); resources = new IpResourceSet(); byte[] ipAddressBlocksExtension = getCertificate() .getExtensionValue(ResourceExtensionEncoder.OID_IP_ADDRESS_BLOCKS.getId()); if (ipAddressBlocksExtension != null) { SortedMap<AddressFamily, IpResourceSet> ipResources = parser .parseIpAddressBlocks(ipAddressBlocksExtension); for (Entry<AddressFamily, IpResourceSet> resourcesByType : ipResources.entrySet()) { if (resourcesByType.getValue() == null) { inheritedResourceTypes.add(resourcesByType.getKey().toIpResourceType()); } else { resources.addAll(resourcesByType.getValue()); }// w ww .ja va 2 s. c o m } } byte[] asnExtension = getCertificate() .getExtensionValue(ResourceExtensionEncoder.OID_AUTONOMOUS_SYS_IDS.getId()); if (asnExtension != null) { IpResourceSet asResources = parser.parseAsIdentifiers(asnExtension); if (asResources == null) { inheritedResourceTypes.add(IpResourceType.ASN); } else { resources.addAll(asResources); } } Validate.isTrue(!inheritedResourceTypes.isEmpty() || !resources.isEmpty(), "empty resource set"); }
From source file:edu.uci.ics.hyracks.api.client.HyracksConnection.java
@Override public JobId startJob(JobSpecification jobSpec) throws Exception { return startJob(jobSpec, EnumSet.noneOf(JobFlag.class)); }
From source file:org.apache.syncope.core.persistence.api.attrvalue.validation.InvalidEntityException.java
/** * Constructs a map of violations out of given <tt>ConstraintViolation</tt> set. * * @param entityClassSimpleName simple class name of invalid entity * @param violations as returned by bean validation *//*from w ww . j av a 2s. co m*/ public InvalidEntityException(final String entityClassSimpleName, final Set<ConstraintViolation<Object>> violations) { super(); this.entityClassSimpleName = entityClassSimpleName; for (ConstraintViolation<Object> violation : violations) { int firstComma = violation.getMessageTemplate().indexOf(';'); final String key = violation.getMessageTemplate().substring(0, firstComma > 0 ? firstComma : violation.getMessageTemplate().length()); final String message = violation.getMessageTemplate().substring(firstComma > 0 ? firstComma + 1 : 0); EntityViolationType entityViolationType; try { entityViolationType = EntityViolationType.valueOf(key.trim()); } catch (IllegalArgumentException e) { entityViolationType = EntityViolationType.Standard; } entityViolationType.setMessage(message.trim()); if (!this.violations.containsKey(violation.getLeafBean().getClass())) { this.violations.put(violation.getLeafBean().getClass(), EnumSet.noneOf(EntityViolationType.class)); } this.violations.get(violation.getLeafBean().getClass()).add(entityViolationType); } }