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.eclipse.m2e.importer.tests.MavenImporterTest.java
@Test public void testRootWithoutPom() throws Exception { Set<IProject> newProjects = null; // important part here is the "getParentFile()" SmartImportJob job = new SmartImportJob(projectDirectory.getParentFile(), Collections.EMPTY_SET, true, true);/* w ww . ja va 2 s . c o m*/ Map<File, List<ProjectConfigurator>> proposals = job.getImportProposals(monitor); Assert.assertEquals("Expected 2 projects to import", 2, proposals.size()); //$NON-NLS-1$ boolean thymConfiguratorFound = false; for (ProjectConfigurator configurator : proposals.values().iterator().next()) { if (configurator instanceof MavenProjectConfigurator) { thymConfiguratorFound = true; } } Assert.assertTrue("Maven configurator not found while checking directory", thymConfiguratorFound); //$NON-NLS-1$ // accept proposals job.setDirectoriesToImport(proposals.keySet()); IWorkspaceRoot wsRoot = ResourcesPlugin.getWorkspace().getRoot(); Set<IProject> beforeImport = new HashSet<>(Arrays.asList(wsRoot.getProjects())); job.run(monitor); job.join(); newProjects = new HashSet<>(Arrays.asList(wsRoot.getProjects())); newProjects.removeAll(beforeImport); Assert.assertEquals("Expected only 2 new projects", 2, newProjects.size()); //$NON-NLS-1$ JobHelpers.waitForJobs(new IJobMatcher() { public boolean matches(Job job) { return MavenProjectConfigurator.UPDATE_MAVEN_CONFIGURATION_JOB_NAME.equals(job.getName()); } }, 30_000); for (IProject project : newProjects) { Assert.assertTrue(project.getLocation().toFile().getCanonicalPath() .startsWith(projectDirectory.getCanonicalPath())); IMavenProjectFacade mavenProject = MavenPlugin.getMavenProjectRegistry().getProject(project); Assert.assertNotNull("Project not configured as Maven", mavenProject); //$NON-NLS-1$ } }
From source file:grails.plugin.searchable.internal.util.GrailsDomainClassUtils.java
/** * Get the actual (user-defined) Classes for the given GrailsDomainClass Collection. * Equivalent to collecting the results of <code>grailsDomainClass.getClazz()</code> on * each element// w w w. ja va 2s .com * * @param grailsDomainClasses * @return A collection of User-defined classes, which may be empty */ public static Collection getClazzes(Collection grailsDomainClasses) { if (grailsDomainClasses == null || grailsDomainClasses.isEmpty()) { return Collections.EMPTY_SET; } Set clazzes = new HashSet(); for (Iterator iter = grailsDomainClasses.iterator(); iter.hasNext();) { clazzes.add(((GrailsDomainClass) iter.next()).getClazz()); } return clazzes; }
From source file:org.apache.geode.internal.admin.remote.RemoteTransportConfig.java
/** * Creates a new <code>RemoteTransportConfig</code> from the configuration information in a * <code>DistributionConfig</code>. We assume that <code>config</code> already been checked for * errors.//from www . j ava 2 s .co m * * @since GemFire 3.0 */ public RemoteTransportConfig(DistributionConfig config, int vmKind) { if (config.getBindAddress() == null) { this.bindAddress = DistributionConfig.DEFAULT_BIND_ADDRESS; } else { this.bindAddress = config.getBindAddress(); } this.vmKind = vmKind; this.tcpPort = config.getTcpPort(); this.membershipPortRange = getMembershipPortRangeString(config.getMembershipPortRange()); this.sslConfig = new SSLConfig(); String initialHosts = config.getLocators(); if (initialHosts == null) { initialHosts = ""; } initialHosts = initialHosts.trim(); if (config.getMcastPort() > 0) { this.mcastId = new DistributionLocatorId(config.getMcastAddress(), config.getMcastPort(), config.getBindAddress(), this.sslConfig); this.mcastEnabled = true; } else { this.mcastEnabled = false; this.mcastId = null; } this.tcpDisabled = config.getDisableTcp(); this.disableAutoReconnect = config.getDisableAutoReconnect(); // See what type of discovery is being used if (initialHosts.length() == 0) { // loner system this.ids = Collections.EMPTY_SET; return; } else { HashSet locators = new HashSet(); StringTokenizer stringTokenizer = new StringTokenizer(initialHosts, ","); while (stringTokenizer.hasMoreTokens()) { String locator = stringTokenizer.nextToken(); if (StringUtils.isNotEmpty(locator)) { locators.add(new DistributionLocatorId(locator)); } } if (this.mcastEnabled) { locators.add(this.mcastId); } this.ids = Collections.unmodifiableSet(locators); if (this.mcastEnabled) { Assert.assertTrue(this.mcastId != null); } } }
From source file:org.objectstyle.cayenne.query.UpdateBatchQuery.java
/** * Creates new UpdateBatchQuery.//from w ww.j ava 2 s .com * * @param dbEntity Table or view to update. * @param qualifierAttributes DbAttributes used in the WHERE clause. * @param nullQualifierNames DbAttribute names in the WHERE clause that have null values. * @param updatedAttribute DbAttributes describing updated columns. * @param batchCapacity Estimated size of the batch. */ public UpdateBatchQuery(DbEntity dbEntity, List qualifierAttributes, List updatedAttribute, Collection nullQualifierNames, int batchCapacity) { super(dbEntity); this.updatedAttributes = updatedAttribute; this.qualifierAttributes = qualifierAttributes; this.nullQualifierNames = nullQualifierNames != null ? nullQualifierNames : Collections.EMPTY_SET; qualifierSnapshots = new ArrayList(batchCapacity); updateSnapshots = new ArrayList(batchCapacity); dbAttributes = new ArrayList(updatedAttributes.size() + qualifierAttributes.size()); dbAttributes.addAll(updatedAttributes); dbAttributes.addAll(qualifierAttributes); }
From source file:org.red5.server.ClientRegistry.java
/** * Return collection of clients/* w w w. j a v a 2 s . c om*/ * * @return Collection of clients */ @SuppressWarnings("unchecked") protected Collection<IClient> getClients() { if (!hasClients()) { // avoid creating new Collection object if no clients exist. return Collections.EMPTY_SET; } return Collections.unmodifiableCollection(clients.values()); }
From source file:com.adobe.ags.curly.test.ErrorBehaviorTest.java
@Test public void testActionIgnore() throws IOException, ParseException { ApplicationState.getInstance().errorBehaviorProperty().set(ErrorBehavior.HALT); Action fail1 = failureAction(); Action fail2 = failureAction(); fail1.setErrorBehavior(ErrorBehavior.IGNORE); fail2.setErrorBehavior(ErrorBehavior.IGNORE); List<Action> actions = Arrays.asList(fail1, fail2); ActionGroupRunner runner = new ActionGroupRunner("Action Ignore Test", ignore -> client, actions, Collections.EMPTY_MAP, Collections.EMPTY_SET); runner.run();//from www . ja v a 2s.com assertResults(runner.getResult(), false, true); }
From source file:org.jahia.services.content.interceptor.HtmlFilteringInterceptorTest.java
@Test @SuppressWarnings("unchecked") public void testFilteringDisabled() throws Exception { String source = "abc"; assertEquals("Filtering should nor be done as the tag set is empty", source, HtmlFilteringInterceptor.filterTags(source, Collections.EMPTY_SET)); }
From source file:de.hybris.platform.servicelayer.interceptor.RemoveInterceptorTest.java
@Before public void setUp() throws Exception { MockitoAnnotations.initMocks(this); CountryModel country = modelService.create(CountryModel.class); country.setIsocode("DE"); country.setActive(Boolean.TRUE); modelService.save(country);/*from w w w. j av a 2s. co m*/ final RegionModel region = modelService.create(RegionModel.class); region.setIsocode("DE-BW"); region.setCountry(country); modelService.save(region); country = modelService.create(CountryModel.class); country.setIsocode("US"); country.setActive(Boolean.TRUE); modelService.save(country); reg = (DefaultInterceptorRegistry) ((DefaultModelService) modelService).getInterceptorRegistry(); gotRegionInterceptors.clear(); reg.registerInterceptor("Region", new RegionRemoveInterceptor(), Collections.EMPTY_SET); given(persistenceTypeService.getPersistenceType(anyCollection())).willReturn(PersistenceType.JALO); }
From source file:org.openrdf.repository.sparql.query.SPARQLQuery.java
protected Set<String> getBindingNames() { if (bindings.size() == 0) return Collections.EMPTY_SET; Set<String> names = new HashSet<String>(); String qry = query;/* w ww. ja v a2 s . c o m*/ int b = qry.indexOf('{'); String select = qry.substring(0, b); for (String name : bindings.getBindingNames()) { String replacement = getReplacement(bindings.getValue(name)); if (replacement != null) { String pattern = ".*[\\?\\$]" + name + "\\W.*"; if (Pattern.compile(pattern, Pattern.MULTILINE | Pattern.DOTALL).matcher(select).matches()) { names.add(name); } } } return names; }
From source file:com.haulmont.cuba.core.sys.serialization.KryoSerialization.java
protected Kryo newKryoInstance() { Kryo kryo = new Kryo(); kryo.setInstantiatorStrategy(new CubaInstantiatorStrategy()); if (onlySerializable) { kryo.setDefaultSerializer(CubaFieldSerializer.class); }/*w ww . j a v a 2 s . c om*/ //To work properly must itself be loaded by the application classloader (i.e. by classloader capable of loading //all the other application classes). For web application it means placing this class inside webapp folder. kryo.setClassLoader(KryoSerialization.class.getClassLoader()); kryo.register(Arrays.asList("").getClass(), new ArraysAsListSerializer()); kryo.register(Collections.EMPTY_LIST.getClass(), new CollectionsEmptyListSerializer()); kryo.register(Collections.EMPTY_MAP.getClass(), new CollectionsEmptyMapSerializer()); kryo.register(Collections.EMPTY_SET.getClass(), new CollectionsEmptySetSerializer()); kryo.register(Collections.singletonList("").getClass(), new CollectionsSingletonListSerializer()); kryo.register(Collections.singleton("").getClass(), new CollectionsSingletonSetSerializer()); kryo.register(Collections.singletonMap("", "").getClass(), new CollectionsSingletonMapSerializer()); kryo.register(BitSet.class, new BitSetSerializer()); kryo.register(GregorianCalendar.class, new GregorianCalendarSerializer()); kryo.register(InvocationHandler.class, new JdkProxySerializer()); UnmodifiableCollectionsSerializer.registerSerializers(kryo); SynchronizedCollectionsSerializer.registerSerializers(kryo); kryo.register(CGLibProxySerializer.CGLibProxyMarker.class, new CGLibProxySerializer()); ImmutableListSerializer.registerSerializers(kryo); ImmutableSetSerializer.registerSerializers(kryo); ImmutableMapSerializer.registerSerializers(kryo); ImmutableMultimapSerializer.registerSerializers(kryo); kryo.register(IndirectList.class, new IndirectContainerSerializer()); kryo.register(IndirectMap.class, new IndirectContainerSerializer()); kryo.register(IndirectSet.class, new IndirectContainerSerializer()); kryo.register(org.eclipse.persistence.indirection.IndirectList.class, new IndirectContainerSerializer()); kryo.register(org.eclipse.persistence.indirection.IndirectMap.class, new IndirectContainerSerializer()); kryo.register(org.eclipse.persistence.indirection.IndirectSet.class, new IndirectContainerSerializer()); //classes with custom serialization methods kryo.register(HashMultimap.class, new CubaJavaSerializer()); kryo.register(ArrayListMultimap.class, new CubaJavaSerializer()); kryo.register(MetaClassImpl.class, new CubaJavaSerializer()); kryo.register(MetaPropertyImpl.class, new CubaJavaSerializer()); kryo.register(UnitOfWorkQueryValueHolder.class, new UnitOfWorkQueryValueHolderSerializer(kryo)); return kryo; }