List of usage examples for java.util Collections emptySet
@SuppressWarnings("unchecked") public static final <T> Set<T> emptySet()
From source file:io.cloudslang.lang.systemtests.BindingScopeTest.java
@Test public void testInputMissing() throws Exception { URL resource = getClass().getResource("/yaml/check_weather_missing_input.sl"); CompilationArtifact compilationArtifact = slang.compile(SlangSource.fromFile(resource.toURI()), new HashSet<SlangSource>()); Map<String, Value> userInputs = Collections.emptyMap(); Set<SystemProperty> systemProperties = Collections.emptySet(); exception.expect(RuntimeException.class); exception.expectMessage(new BaseMatcher<String>() { public void describeTo(Description description) { }//from www . j a v a 2 s. c o m public boolean matches(Object o) { String message = o.toString(); return message.contains("Error running: 'check_weather_missing_input'") && message.contains("Error binding input: 'input_get_missing_input'") && message.contains("Error is: Error in running script expression: 'missing_input'") && message.contains("Exception is: name 'missing_input' is not defined"); } }); triggerWithData(compilationArtifact, userInputs, systemProperties); }
From source file:com.navercorp.pinpoint.web.alarm.checker.DeadlockCheckerTest.java
@Test public void checkTest1() { Rule rule = new Rule(APPLICATION_NAME, SERVICE_TYPE, CheckerCategory.ERROR_COUNT.getName(), 50, "testGroup", false, false, ""); Application application = new Application(APPLICATION_NAME, ServiceType.STAND_ALONE); Range range = Range.createUncheckedRange(START_TIME_MILLIS, CURRENT_TIME_MILLIS); when(mockAgentEventDao.getAgentEvents(AGENT_ID_1, range, Collections.emptySet())).thenReturn(Arrays.asList( createAgentEvent(AGENT_ID_1, createEventTimestamp(), AgentEventType.AGENT_CLOSED_BY_SERVER))); when(mockAgentEventDao.getAgentEvents(AGENT_ID_2, range, Collections.emptySet())).thenReturn(Arrays.asList( createAgentEvent(AGENT_ID_2, createEventTimestamp(), AgentEventType.AGENT_DEADLOCK_DETECTED))); when(mockAgentEventDao.getAgentEvents(AGENT_ID_3, range, Collections.emptySet())).thenReturn( Arrays.asList(createAgentEvent(AGENT_ID_3, createEventTimestamp(), AgentEventType.AGENT_PING))); AgentEventDataCollector dataCollector = new AgentEventDataCollector( DataCollectorFactory.DataCollectorCategory.AGENT_EVENT, application, mockAgentEventDao, mockApplicationIndexDao, CURRENT_TIME_MILLIS, INTERVAL_MILLIS); DeadlockChecker checker = new DeadlockChecker(dataCollector, rule); checker.check();//from w ww. j a va2 s . c om Assert.assertTrue(checker.isDetected()); String emailMessage = checker.getEmailMessage(); Assert.assertTrue(StringUtils.hasLength(emailMessage)); List<String> smsMessage = checker.getSmsMessage(); Assert.assertTrue(smsMessage.size() == 1); }
From source file:com.linkedin.pinot.core.indexsegment.mutable.MutableSegmentImplTest.java
@BeforeClass public void setUp() throws Exception { FileUtils.deleteQuietly(TEMP_DIR);// www. j a va2 s . co m URL resourceUrl = MutableSegmentImplTest.class.getClassLoader().getResource(AVRO_FILE); Assert.assertNotNull(resourceUrl); File avroFile = new File(resourceUrl.getFile()); SegmentGeneratorConfig config = SegmentTestUtils.getSegmentGeneratorConfigWithoutTimeColumn(avroFile, TEMP_DIR, "testTable"); SegmentIndexCreationDriver driver = new SegmentIndexCreationDriverImpl(); driver.init(config); driver.build(); _immutableSegment = ImmutableSegmentLoader.load(new File(TEMP_DIR, driver.getSegmentName()), ReadMode.mmap); _schema = config.getSchema(); _mutableSegmentImpl = MutableSegmentImplTestUtils.createMutableSegmentImpl(_schema, Collections.emptySet(), Collections.emptySet(), false); try (RecordReader recordReader = new AvroRecordReader(avroFile, _schema)) { GenericRow reuse = new GenericRow(); while (recordReader.hasNext()) { _mutableSegmentImpl.index(recordReader.next(reuse)); } } }
From source file:org.shredzone.cilla.web.renderer.CalendarGenerator.java
/** * Sets the {@link SearchResult} to create a calendar for. * <p>//from www. j ava2 s .co m * Must be invoked after {@link #setLocale(Locale)}. * * @param result * {@link SearchResult}, may be {@code null} for the current calendar */ public void setSearchResult(SearchResult result) throws CillaServiceException { filter = new FilterModel(); date = new DateRange(); pageDays = Collections.emptySet(); if (result != null) { filter = result.getFilter(); if (filter.getDate() != null) { date = filter.getDate(); } else { date = new DateRange(); } } setup(); if (result != null) { Calendar cal = Calendar.getInstance(locale); cal.clear(); cal.set(calYear, calMonth - 1, 1); pageDays = result.fetchPageDays(cal); } }
From source file:com.griddynamics.jagger.monitoring.reporting.SystemUnderTestPlotsProvider.java
@Override public JRDataSource getDataSource(String taskId) { log.debug("Report for task with id {} requested", taskId); if (!this.enable) { return new JRBeanCollectionDataSource(Collections.emptySet()); }// w w w. jav a 2 s .c o m if (taskPlots == null) { log.debug("Initing task plots"); taskPlots = createTaskPlots(); } loadMonitoringMap(); log.debug("Loading data for task id {}", taskId); List<MonitoringReporterData> data = taskPlots.get(taskId); if (data == null) { log.debug("Data not found for task {}", taskId); String monitoringTaskId = relatedMonitoringTask(taskId); log.debug("Related task {}", monitoringTaskId); data = taskPlots.get(monitoringTaskId); } if (data == null) { log.warn("SuT plots not found for task with id {}", taskId); log.warn("Check that MonitoringAggregator is configured!!!"); } return new JRBeanCollectionDataSource(data); }
From source file:com.springsource.greenhouse.invite.FacebookInviteController.java
/** * Renders the Facebook friend-finder page as HTML in the web browser. * If the member's account is connected to Facebook, adds his or her Facebook friends who are already members to the model. * Supports distinguishing between those Facebook friends who have already joined and those who haven't. *//*from ww w .j a v a2 s. c om*/ @RequestMapping(value = "/invite/facebook", method = RequestMethod.GET) public void friendFinder(Model model, Account account) { if (facebook.isAuthorized()) { List<ProfileReference> profileReferences = accountRepository .findProfileReferencesByIds(friendAccountIds(account.getId(), facebook)); model.addAttribute("friends", profileReferences); } else { model.addAttribute("friends", Collections.emptySet()); } model.addAttribute("facebookAppId", facebookAppId); }
From source file:com.evolveum.midpoint.repo.sql.data.common.RObjectTextInfo.java
public static <T extends ObjectType> Set<RObjectTextInfo> createItemsSet(@NotNull ObjectType object, @NotNull RObject repo, @NotNull RepositoryContext repositoryContext) { FullTextSearchConfigurationType config = repositoryContext.repositoryService .getFullTextSearchConfiguration(); if (!FullTextSearchConfigurationUtil.isEnabled(config)) { return Collections.emptySet(); }// ww w .j a v a2 s .com Set<ItemPath> paths = FullTextSearchConfigurationUtil.getFullTextSearchItemPaths(config, object.getClass()); List<PrismValue> values = new ArrayList<>(); for (ItemPath path : paths) { Object o = object.asPrismObject().find(path); if (o == null) { // shouldn't occur } else if (o instanceof PrismValue) { values.add((PrismValue) o); } else if (o instanceof Item) { values.addAll(((Item<?, ?>) o).getValues()); } else { throw new IllegalStateException("Unexpected value " + o + " in " + object + " at " + path); } } List<String> allWords = new ArrayList<>(); // not a (hash) set in order to preserve order for (PrismValue value : values) { if (value == null) { continue; } if (value instanceof PrismPropertyValue) { Object realValue = value.getRealValue(); if (realValue == null) { // skip } else if (realValue instanceof String) { append(allWords, (String) realValue, repositoryContext.prismContext); } else if (realValue instanceof PolyString) { append(allWords, (PolyString) realValue, repositoryContext.prismContext); } else { append(allWords, realValue.toString(), repositoryContext.prismContext); } } } LOGGER.trace("Indexing {}:\n items: {}\n values: {}\n words: {}", object, paths, values, allWords); return createItemsSet(repo, allWords); }
From source file:ch.cyberduck.core.sds.SDSDeleteFeature.java
private Set<Acl.Role> getRoles(final Path file) throws BackgroundException { final Acl acl = new SDSPermissionsFeature(session).getPermission(containerService.getContainer(file)); final Set<Acl.Role> roles = acl.get(new Acl.CanonicalUser(String.valueOf(session.userAccount().getId()))); return roles != null ? roles : Collections.emptySet(); }
From source file:com.jxt.web.dao.hbase.HbaseHostApplicationMapDao.java
@Override public Set<AcceptApplication> findAcceptApplicationName(Application fromApplication, Range range) { if (fromApplication == null) { throw new NullPointerException("fromApplication must not be null"); }/*from ww w. j a v a2 s . c o m*/ final Scan scan = createScan(fromApplication, range); final List<List<AcceptApplication>> result = hbaseOperations2.findParallel( HBaseTables.HOST_APPLICATION_MAP_VER2, scan, acceptApplicationRowKeyDistributor, hostApplicationMapperVer2, HOST_APPLICATION_MAP_VER2_NUM_PARTITIONS); if (CollectionUtils.isNotEmpty(result)) { final Set<AcceptApplication> resultSet = new HashSet<>(); for (List<AcceptApplication> resultList : result) { resultSet.addAll(resultList); } logger.debug("findAcceptApplicationName result:{}", resultSet); return resultSet; } else { return Collections.emptySet(); } }
From source file:com.hp.autonomy.searchcomponents.idol.parametricvalues.IdolParametricValuesService.java
@Override public Set<QueryTagInfo> getAllParametricValues(final IdolParametricRequest parametricRequest) throws AciErrorException { final Collection<String> fieldNames = new HashSet<>(); fieldNames.addAll(parametricRequest.getFieldNames()); if (fieldNames.isEmpty()) { fieldNames.addAll(fieldsService.getParametricFields(new IdolFieldsRequest.Builder().build())); }//from w ww . ja v a2 s . c om final Set<QueryTagInfo> results; if (fieldNames.isEmpty()) { results = Collections.emptySet(); } else { final AciParameters aciParameters = new AciParameters(TagActions.GetQueryTagValues.name()); parameterHandler.addSearchRestrictions(aciParameters, parametricRequest.getQueryRestrictions()); if (parametricRequest.isModified()) { parameterHandler.addQmsParameters(aciParameters, parametricRequest.getQueryRestrictions()); } aciParameters.add(GetQueryTagValuesParams.DocumentCount.name(), true); aciParameters.add(GetQueryTagValuesParams.MaxValues.name(), parametricRequest.getMaxValues()); aciParameters.add(GetQueryTagValuesParams.FieldName.name(), StringUtils.join(fieldNames.toArray(), ',')); aciParameters.add(GetQueryTagValuesParams.Sort.name(), SortParam.DocumentCount.name()); final GetQueryTagValuesResponseData responseData = contentAciService.executeAction(aciParameters, queryTagValuesResponseProcessor); final List<FlatField> fields = responseData.getField(); results = new LinkedHashSet<>(fields.size()); for (final FlatField field : fields) { final List<JAXBElement<? extends Serializable>> valueElements = field.getValueOrSubvalueOrValues(); final LinkedHashSet<QueryTagCountInfo> values = new LinkedHashSet<>(valueElements.size()); for (final JAXBElement<?> element : valueElements) { if (VALUE_NODE_NAME.equals(element.getName().getLocalPart())) { final TagValue tagValue = (TagValue) element.getValue(); values.add(new QueryTagCountInfo(tagValue.getValue(), tagValue.getCount())); } } final String fieldName = getFieldNameFromPath(field.getName().get(0)); if (!values.isEmpty()) { results.add(new QueryTagInfo(fieldName, values)); } } } return results; }