List of usage examples for java.util Set containsAll
boolean containsAll(Collection<?> c);
From source file:com.wickettraining.modelproxy.domain.PhoneNumberTest.java
@SuppressWarnings("unchecked") public void testUseInLinkedHashSet() throws Exception { Set<PhoneNumber> set = new LinkedHashSet<PhoneNumber>(); PhoneNumber p1 = new PhoneNumber("123"); PhoneNumber p2 = new PhoneNumber("234"); set.add(p1);// w ww .j a v a 2 s . c o m assertTrue(set.contains(p1)); set.add(p2); assertTrue(set.contains(p2)); Set<PhoneNumber> set2 = (Set<PhoneNumber>) SerializationUtils.clone((Serializable) set); assertTrue(set2.containsAll(set)); assertEquals(set, set2); }
From source file:org.eel.kitchen.jsonschema.keyword.PropertiesKeywordValidator.java
@Override public void validate(final ValidationContext context, final ValidationReport report, final JsonNode instance) { final Set<String> fields = JacksonUtils.fieldNames(instance); if (fields.containsAll(required)) return;//from w w w . j a va 2 s. c om final Set<String> requiredSorted = Sets.newTreeSet(required); final Set<String> missing = Sets.newTreeSet(required); missing.removeAll(fields); final Message.Builder msg = newMsg().addInfo("required", requiredSorted).addInfo("missing", missing) .setMessage("required property(ies) not found"); report.addMessage(msg.build()); }
From source file:com.chadekin.jadys.syntax.where.impl.WhereClauseExtendedBuilderImpl.java
private boolean isValidAlias(Set<String> aliases) { JadysSqlQueryBuilder builder = getParent(); while (builder != null) { Set<String> parentAliases = builder.getAlias(); if (CollectionUtils.isNotEmpty(parentAliases) && parentAliases.containsAll(aliases)) { return true; }//from www . j a va 2s. c om builder = builder.getParent(); } return false; }
From source file:org.wso2.carbon.apimgt.core.util.APIUtils.java
/** * Check the validity of roles to be assigned to an API * * @param availableRoleList all available roles * @param candidateRoleList candidate roles to be assigned to the API * @return true if all candidate roles are eligible * @throws APIManagementException if the check fails *///w w w . jav a 2 s.c om public static boolean checkAllowedRoles(Set<String> availableRoleList, Set<String> candidateRoleList) throws APIManagementException { //check if availableRoleList and candidateRoleList is not null if (availableRoleList != null && candidateRoleList != null) { if (availableRoleList.isEmpty() || candidateRoleList.isEmpty()) { String errorMsg = "Role list is empty."; log.error(errorMsg); throw new APIManagementException(errorMsg, ExceptionCodes.ROLES_CANNOT_BE_EMPTY); } else { //check if all roles in candidateRoleList are in availableRoleList if (availableRoleList.containsAll(candidateRoleList)) { return true; } else { String errorMsg = "Invalid role(s) found."; log.error(errorMsg); throw new APIManagementException(errorMsg, ExceptionCodes.UNSUPPORTED_ROLE); } } } else { String errorMsg = "Role(s) list is null."; log.error(errorMsg); throw new APIManagementException(errorMsg, ExceptionCodes.ROLES_CANNOT_BE_NULL); } }
From source file:org.trustedanalytics.serviceexposer.RedisCredentialsStoreTest.java
@Test public void testGetSurplusKeys() { Set<Object> redisGuids = Sets.newHashSet("1", "2", "3", "4"); Set<String> retrievedGuids = Sets.newHashSet("1", "2"); when(mockHashOps.keys(SERVICE_TYPE)).thenReturn(redisGuids); Set<String> keysToDelete = sut.getSurplusServicesGuids(SERVICE_TYPE, retrievedGuids); boolean eligible = keysToDelete.containsAll(Arrays.asList("3", "4")); assertEquals(true, eligible);//ww w. j ava 2s .c o m }
From source file:org.camelcookbook.splitjoin.splitaggregate.SplitAggregateSpringTest.java
@Test public void testSplitAggregatesResponses() throws Exception { String[] array = new String[] { "one", "two", "three" }; MockEndpoint mockOut = getMockEndpoint("mock:out"); mockOut.expectedMessageCount(1);//from w w w .j a va 2s . c o m template.sendBody("direct:in", array); assertMockEndpointsSatisfied(); Exchange exchange = mockOut.getReceivedExchanges().get(0); @SuppressWarnings("unchecked") Set<String> backendResponses = Collections.checkedSet(exchange.getIn().getBody(Set.class), String.class); assertTrue(backendResponses .containsAll(Arrays.asList("Processed: one", "Processed: two", "Processed: three"))); }
From source file:com.baidu.bjf.remoting.protobuf.ProtobufIDLProxy.java
private static CodeDependent hasDependency(List<CodeDependent> cds, Set<String> compiledClass) { if (cds.isEmpty()) { return null; }//from w w w. j av a 2 s .c om Iterator<CodeDependent> iterator = cds.iterator(); while (iterator.hasNext()) { CodeDependent next = iterator.next(); if (!next.isDepndency()) { compiledClass.add(next.name); iterator.remove(); return next; } else { Set<String> dependencies = next.dependencies; if (compiledClass.containsAll(dependencies)) { compiledClass.add(next.name); iterator.remove(); return next; } } } // if cds is not empty guess there is some message dependency is not // available. so error idl protobuf defined? if (!cds.isEmpty()) { Set<String> guessLoadedClass = new HashSet<String>(compiledClass); iterator = cds.iterator(); while (iterator.hasNext()) { guessLoadedClass.add(iterator.next().name); } // to check while message's dependency is missed iterator = cds.iterator(); while (iterator.hasNext()) { CodeDependent next = iterator.next(); if (!next.isDepndency()) { continue; } if (guessLoadedClass.containsAll(next.dependencies)) { continue; } for (String dependClass : next.dependencies) { if (!guessLoadedClass.contains(dependClass)) { throw new RuntimeException("Message '" + StringUtils.removeEnd(next.name, DEFAULT_SUFFIX_CLASSNAME) + "' depend on message '" + StringUtils.removeEnd(dependClass, DEFAULT_SUFFIX_CLASSNAME) + "' is missed"); } } } } return null; }
From source file:org.camelcookbook.splitjoin.splitaggregate.SplitAggregateExceptionHandlingSpringTest.java
@Test public void testHandlesException() throws Exception { String[] array = new String[] { "one", "two", "three" }; MockEndpoint mockOut = getMockEndpoint("mock:out"); mockOut.expectedMessageCount(1);// w w w .j a v a 2 s . co m template.sendBody("direct:in", array); assertMockEndpointsSatisfied(); Exchange exchange = mockOut.getReceivedExchanges().get(0); @SuppressWarnings("unchecked") Set<String> backendResponses = Collections.checkedSet(exchange.getIn().getBody(Set.class), String.class); assertTrue( backendResponses.containsAll(Arrays.asList("Processed: one", "Failed: two", "Processed: three"))); }
From source file:com.vrem.wifianalyzer.wifi.band.WiFiChannelCountryGHZ5Test.java
@Test public void testChannelsIsrael() throws Exception { int expectedSize = CHANNELS_SET1.size(); Set<Integer> actual = fixture.findChannels("IL"); assertEquals(expectedSize, actual.size()); assertTrue(actual.containsAll(CHANNELS_SET1)); assertFalse(actual.containsAll(CHANNELS_SET2)); assertFalse(actual.containsAll(CHANNELS_SET3)); }
From source file:ddf.test.itests.platform.TestSolrCommands.java
private Set<File> waitForFirstBackupDirToBeDeleted(String coreName, final Set<File> firstBackupDirSet) throws InterruptedException { return waitFor(coreName, new Predicate<Set<File>>() { @Override//from ww w . j a va 2s . c om public boolean apply(Set<File> backupDirs) { return backupDirs.containsAll(firstBackupDirSet) && (backupDirs.size() != 2); } }); }