List of usage examples for java.util Collections emptySet
@SuppressWarnings("unchecked") public static final <T> Set<T> emptySet()
From source file:nu.yona.server.goals.service.ActivityCategoryServiceTestConfiguration.java
@Test public void getAllActivityCategories_default_returnsItemsFromCache() { assertGetAllActivityCategoriesResult("gambling", "news"); ActivityCategory gaming = ActivityCategory.createInstance(UUID.randomUUID(), usString("gaming"), false, new HashSet<>(Arrays.asList("games")), Collections.emptySet(), usString("Descr")); // Add to collection, so it appears as if it is in the database // It hasn't been loaded, so should not be in the cache mockRepositoryFindAllResult.add(gaming); when(mockRepository.findOne(gaming.getId())).thenReturn(gaming); assertGetAllActivityCategoriesResult("gambling", "news"); }
From source file:org.elasticsearch.xpack.security.authc.kerberos.SpnegoHttpClientConfigCallbackHandler.java
/** * If logged in {@link LoginContext} is not available, it attempts login and * returns {@link LoginContext}/*from w ww.j av a 2s .co m*/ * * @return {@link LoginContext} * @throws PrivilegedActionException */ public synchronized LoginContext login() throws PrivilegedActionException { if (this.loginContext == null) { AccessController.doPrivileged((PrivilegedExceptionAction<Void>) () -> { final Subject subject = new Subject(false, Collections.singleton(new KerberosPrincipal(userPrincipalName)), Collections.emptySet(), Collections.emptySet()); Configuration conf = null; final CallbackHandler callback; if (password != null) { conf = new PasswordJaasConf(userPrincipalName, enableDebugLogs); callback = new KrbCallbackHandler(userPrincipalName, password); } else { conf = new KeytabJaasConf(userPrincipalName, keytabPath, enableDebugLogs); callback = null; } loginContext = new LoginContext(CRED_CONF_NAME, subject, callback, conf); loginContext.login(); return null; }); } return loginContext; }
From source file:com.ge.predix.acs.service.policy.matcher.PolicyMatcherImplTest.java
/** * Tests matching a policy that does not specify a subject (i.e. applies to all subjects) to a request. * * @throws IOException//from w w w .ja va 2 s . c o m * on failure to load policy required for test. */ public void testMatchPolicyWithNoSubject() throws IOException { File file = getPolicyFileForTest(getMethodName()); PolicySet policySet = PolicySets.loadFromFile(file); List<Policy> policies = policySet.getPolicies(); PolicyMatchCandidate candidate = new PolicyMatchCandidate(); candidate.setAction("GET"); candidate.setResourceURI("/public"); candidate.setSubjectIdentifier("Edward R. Murrow"); candidate.setSupplementalResourceAttributes(Collections.emptySet()); candidate.setSupplementalSubjectAttributes(Collections.emptySet()); List<MatchedPolicy> matchedPolicies = this.policyMatcher.match(candidate, policies); Assert.assertEquals(matchedPolicies.size(), 1); Assert.assertEquals(matchedPolicies.get(0).getPolicy(), policies.get(policies.size() - 1)); Assert.assertNull(matchedPolicies.get(0).getPolicy().getTarget().getSubject()); }
From source file:it.geosolutions.geoserver.sira.security.config.Rule.java
/** * * @return the roles to which this rule applies *///from www . j a va 2 s . c o m public Set<String> getRoles() { if (this.roles == null) { return Collections.emptySet(); } final Set<String> roleSet = new HashSet<>(); final String[] rolesArray = this.roles.split(","); for (final String role : rolesArray) { if (StringUtils.isNotBlank(role)) { roleSet.add(role.trim()); } } return roleSet; }
From source file:eu.trentorise.smartcampus.permissionprovider.model.ClientDetailsEntity.java
@Override public Set<String> getScope() { if (scope != null) { Set<String> set = Utils.delimitedStringToSet(scope, ","); set.remove(""); return set; }//from ww w.java 2s . c o m return Collections.emptySet(); }
From source file:io.microprofile.showcase.speaker.persistence.SpeakerDAO.java
/** * Try and fuzzy find the specified Speaker * * @param speaker Speaker to find - may contain partial details * @return Optional matching speakers//from ww w . jav a 2 s . c o m */ public Set<Speaker> find(final Speaker speaker) { final ArrayList<Speaker> speakers = new ArrayList<>(); speakers.addAll(this.speakers.values()); CollectionUtils.filter(speakers, object -> { final Speaker find = Speaker.class.cast(object); return (isMatch(find.getNameFirst(), speaker.getNameFirst()) || isMatch(find.getNameLast(), speaker.getNameLast()) || isMatch(find.getOrganization(), speaker.getOrganization()) || isMatch(find.getTwitterHandle(), speaker.getTwitterHandle())); }); if (!speakers.isEmpty()) { return new HashSet<>(speakers); } return Collections.emptySet(); }
From source file:org.spring.data.gemfire.cache.ClientCacheFunctionExecutionTest.java
@Test public void testRegionSizeOnRegionUsingSpringGemfireOnRegionFunctionTemplate() { GemfireOnRegionFunctionTemplate template = new GemfireOnRegionFunctionTemplate(appDataProxy); assertThat(template.executeAndextract("regionSize", Collections.emptySet(), "AppData"), is(equalTo(EXPECTED_REGION_SIZE))); }
From source file:gov.nih.nci.caintegrator.application.query.CompoundCriterionHandler.java
private Set<ResultRow> getAllRows(Study study, Set<EntityTypeEnum> entityTypes) { ResultRowFactory rowFactory = new ResultRowFactory(entityTypes); if (entityTypes.contains(EntityTypeEnum.SUBJECT)) { return rowFactory.getSubjectRows(study.getAssignmentCollection()); } else if (entityTypes.contains(EntityTypeEnum.IMAGESERIES)) { return rowFactory.getImageSeriesRows(getAllImageSeries(study)); } else if (entityTypes.contains(EntityTypeEnum.SAMPLE)) { return rowFactory.getSampleRows(getAllSampleAcuisitions(study)); } else {/*from w w w. j a v a 2 s . com*/ return Collections.emptySet(); } }
From source file:org.spring.data.gemfire.cache.PeerCacheFunctionCreationExecutionTest.java
@Test public void testRegionSizeOnRegionUsingSpringGemfireOnRegionFunctionTemplate() { GemfireOnRegionFunctionTemplate template = new GemfireOnRegionFunctionTemplate(appData); assertThat(template.executeAndextract("regionSize", Collections.emptySet(), appData.getName()), is(equalTo(EXPECTED_REGION_SIZE))); }
From source file:de.acosix.alfresco.mtsupport.repo.auth.TenantRoutingUserRegistryFacade.java
/** * {@inheritDoc}//from ww w. j av a 2 s. c o m */ @Override public Set<QName> getPersonMappedProperties() { final Set<QName> results; // we always expect the synchronization process to be in a single tenant's context final UserRegistry userRegistry = this.getUserRegistryForCurrentDomain(); if (userRegistry != null) { results = userRegistry.getPersonMappedProperties(); } else { results = Collections.emptySet(); } return results; }