List of usage examples for java.util Collections EMPTY_SET
Set EMPTY_SET
To view the source code for java.util Collections EMPTY_SET.
Click Source Link
From source file:org.matonto.ontology.rest.impl.OntologyRestImplTest.java
@Test public void testGetIRIsInImportedOntologiesWhenNoImports() { when(ontology.getImportsClosure()).thenReturn(Collections.EMPTY_SET); Response response = target().path("ontologies/" + encode(ontologyIRI.stringValue()) + "/imported-iris") .queryParam("branchId", branchId.stringValue()).queryParam("commitId", commitId.stringValue()) .request().get();//from w w w.j a v a 2 s.c o m assertEquals(response.getStatus(), 204); }
From source file:org.matonto.ontology.rest.impl.OntologyRestImplTest.java
@Test public void testGetImportsClosureWhenNoImports() { when(ontology.getImportsClosure()).thenReturn(Collections.EMPTY_SET); Response response = target()/* w w w .jav a 2 s .c o m*/ .path("ontologies/" + encode(ontologyIRI.stringValue()) + "/imported-ontologies") .queryParam("branchId", branchId.stringValue()).queryParam("commitId", commitId.stringValue()) .request().get(); assertEquals(response.getStatus(), 204); }
From source file:net.sourceforge.fenixedu.domain.student.Registration.java
final public Collection<CycleType> getConcludedCycles() { if (!getDegreeType().hasAnyCycleTypes()) { return Collections.EMPTY_SET; }//from w w w .j a va2 s. com final Collection<CycleType> result = new TreeSet<CycleType>(CycleType.COMPARATOR_BY_LESS_WEIGHT); for (final CycleType cycleType : getDegreeType().getCycleTypes()) { if (hasConcludedCycle(cycleType)) { result.add(cycleType); } } return result; }
From source file:org.matonto.ontology.rest.impl.OntologyRestImplTest.java
@Test public void testGetAnnotationsInImportedOntologiesWhenNoImports() { when(ontology.getImportsClosure()).thenReturn(Collections.EMPTY_SET); Response response = target()/*from ww w. j av a2s.c o m*/ .path("ontologies/" + encode(ontologyIRI.stringValue()) + "/imported-annotations") .queryParam("branchId", branchId.stringValue()).queryParam("commitId", commitId.stringValue()) .request().get(); assertEquals(response.getStatus(), 204); }
From source file:org.apache.geode.internal.cache.GemFireCacheImpl.java
public Set<DistributedMember> getMembers(Region r) { if (r instanceof DistributedRegion) { DistributedRegion d = (DistributedRegion) r; return d.getDistributionAdvisor().adviseCacheOp(); } else if (r instanceof PartitionedRegion) { PartitionedRegion p = (PartitionedRegion) r; return p.getRegionAdvisor().adviseAllPRNodes(); } else {// w w w. j a v a 2s. c om return Collections.EMPTY_SET; } }
From source file:org.apache.geode.internal.cache.GemFireCacheImpl.java
public Set<InetSocketAddress> getCurrentServers() { Map<String, Pool> pools = PoolManager.getAll(); Set result = null;/*ww w. j a v a2 s. c om*/ for (Pool p : pools.values()) { PoolImpl pi = (PoolImpl) p; for (Object o : pi.getCurrentServers()) { ServerLocation sl = (ServerLocation) o; if (result == null) { result = new HashSet<DistributedMember>(); } result.add(new InetSocketAddress(sl.getHostName(), sl.getPort())); } } if (result == null) { return Collections.EMPTY_SET; } else { return result; } }
From source file:org.matonto.ontology.rest.impl.OntologyRestImplTest.java
@Test public void testGetClassesInImportedOntologiesWhenNoImports() { when(ontology.getImportsClosure()).thenReturn(Collections.EMPTY_SET); Response response = target().path("ontologies/" + encode(ontologyIRI.stringValue()) + "/imported-classes") .queryParam("branchId", branchId.stringValue()).queryParam("commitId", commitId.stringValue()) .request().get();//w w w . j a v a 2 s . co m assertEquals(response.getStatus(), 204); }
From source file:org.rhq.core.pc.inventory.InventoryManager.java
@NotNull Set<Resource> executeComponentDiscovery(ResourceType resourceType, ResourceDiscoveryComponent discoveryComponent, ResourceContainer parentContainer, List<ProcessScanResult> processScanResults) { ResourceContext parentResourceContext = parentContainer.getResourceContext(); ResourceComponent parentComponent = parentContainer.getResourceComponent(); Resource parentResource = parentContainer.getResource(); long startTime = System.currentTimeMillis(); log.debug("Executing discovery for [" + resourceType.getName() + "] Resources..."); Set<Resource> newResources; try {//from www .ja va 2s . c o m ResourceDiscoveryContext context = new ResourceDiscoveryContext(resourceType, parentComponent, parentResourceContext, SystemInfoFactory.createSystemInfo(), processScanResults, Collections.EMPTY_LIST, this.configuration.getContainerName(), this.configuration.getPluginContainerDeployment()); newResources = new HashSet<Resource>(); try { Set<DiscoveredResourceDetails> discoveredResources = invokeDiscoveryComponent(parentContainer, discoveryComponent, context); if ((discoveredResources != null) && (!discoveredResources.isEmpty())) { IdentityHashMap<Configuration, DiscoveredResourceDetails> pluginConfigObjects = new IdentityHashMap<Configuration, DiscoveredResourceDetails>(); for (DiscoveredResourceDetails discoveredResource : discoveredResources) { if (discoveredResource == null) { throw new IllegalStateException( "Plugin error: Discovery class " + discoveryComponent.getClass().getName() + " returned a Set containing one or more null items."); } if (!discoveredResource.getResourceType().equals(resourceType)) { throw new IllegalStateException("Plugin error: Discovery class " + discoveryComponent.getClass().getName() + " returned a DiscoveredResourceDetails with an incorrect ResourceType (was " + discoveredResource.getResourceType().getName() + " but should have been " + resourceType.getName()); } if (null != pluginConfigObjects.put(discoveredResource.getPluginConfiguration(), discoveredResource)) { throw new IllegalStateException("The plugin component " + discoveryComponent.getClass().getName() + " returned multiple resources that point to the same plugin configuration object on the " + "resource type [" + resourceType + "]. This is not allowed, please use " + "ResourceDiscoveryContext.getDefaultPluginConfiguration() " + "for each discovered resource."); } Resource newResource = InventoryManager.createNewResource(discoveredResource); newResources.add(newResource); } } } catch (DiscoverySuspendedException e) { //ok, the discovery is suspended for this resource type under this parent. //but we can continue the discovery in the child resource types of the existing resources. //we can therefore pretend that the discovery returned the existing resources so that //we can recurse into their children up in the call-chain. for (Resource existingResource : parentResource.getChildResources()) { if (resourceType.equals(existingResource.getResourceType())) { newResources.add(existingResource); } } } } catch (Throwable e) { // TODO GH: Add server/parent - up/down semantics so this won't happen just because a server is not up long elapsedTime = System.currentTimeMillis() - startTime; log.warn("Failure during discovery for [" + resourceType.getName() + "] Resources - failed after " + elapsedTime + " ms.", e); return Collections.EMPTY_SET; } long elapsedTime = System.currentTimeMillis() - startTime; if (elapsedTime > 20000) log.info("Discovery for [" + resourceType.getName() + "] resources took [" + elapsedTime + "] ms"); else log.debug("Discovery for [" + resourceType.getName() + "] resources completed in [" + elapsedTime + "] ms"); return newResources; }
From source file:de.innovationgate.webgate.api.jdbc.WGDatabaseImpl.java
public Set getDeletions(Set contentKeys) throws WGAPIException { // unsupported for this implementation return Collections.EMPTY_SET; }
From source file:org.matonto.ontology.rest.impl.OntologyRestImplTest.java
@Test public void testGetDatatypesInImportedOntologiesWhenNoImports() { when(ontology.getImportsClosure()).thenReturn(Collections.EMPTY_SET); Response response = target().path("ontologies/" + encode(ontologyIRI.stringValue()) + "/imported-datatypes") .queryParam("branchId", branchId.stringValue()).queryParam("commitId", commitId.stringValue()) .request().get();//from ww w .j a v a2s.com assertEquals(response.getStatus(), 204); }