当前位置: 首页>>代码示例>>Java>>正文


Java Stream类代码示例

本文整理汇总了Java中org.graylog2.plugin.streams.Stream的典型用法代码示例。如果您正苦于以下问题:Java Stream类的具体用法?Java Stream怎么用?Java Stream使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Stream类属于org.graylog2.plugin.streams包,在下文中一共展示了Stream类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: DeloreanAlertCondition

import org.graylog2.plugin.streams.Stream; //导入依赖的package包/类
@AssistedInject
public DeloreanAlertCondition(Searches searches,
                                       Configuration configuration,
                                       @Assisted Stream stream,
                                       @Nullable @Assisted("id") String id,
                                       @Assisted DateTime createdAt,
                                       @Assisted("userid") String creatorUserId,
                                       @Assisted Map<String, Object> parameters,
                                       @Assisted("title") @Nullable String title) {
    super(stream, id, DeloreanAlertCondition.class.getCanonicalName(), createdAt, creatorUserId, parameters, title);
    this.searches = searches;
    this.configuration = configuration;
    this.query = (String) parameters.get("query");
    this.backtime = (Integer) parameters.get("backtime");
    this.staytime = (Integer) parameters.get("staytime");
}
 
开发者ID:alcampos,项目名称:graylog-plugin-alert-condition-delorean,代码行数:17,代码来源:DeloreanAlertCondition.java

示例2: updateStreams

import org.graylog2.plugin.streams.Stream; //导入依赖的package包/类
@VisibleForTesting
public void updateStreams(Collection<String> ids) {
    for (String id : ids) {
        LOG.debug("Updating stream id/title cache for id {}", id);
        try {
            final Stream stream = streamService.load(id);
            if (stream.getDisabled()) {
                purgeCache(stream.getId());
            } else {
                updateCache(stream);
            }
        } catch (NotFoundException e) {
            // the stream was deleted, we only have to purge the existing entries
            purgeCache(id);
        }
    }
}
 
开发者ID:Graylog2,项目名称:graylog-plugin-pipeline-processor,代码行数:18,代码来源:StreamCacheService.java

示例3: purgeCache

import org.graylog2.plugin.streams.Stream; //导入依赖的package包/类
private void purgeCache(String id) {
    final Stream stream = idToStream.remove(id);
    LOG.debug("Purging stream id/title cache for id {}, stream {}", id, stream);
    if (stream != null) {
        nameToStream.remove(stream.getTitle(), stream);
    }
}
 
开发者ID:Graylog2,项目名称:graylog-plugin-pipeline-processor,代码行数:8,代码来源:StreamCacheService.java

示例4: newlyCreatedMessage

import org.graylog2.plugin.streams.Stream; //导入依赖的package包/类
@Test
public void newlyCreatedMessage() {
    final Message message = new Message("test", "test", Tools.nowUTC());
    message.addField("foo", "bar");
    message.addStream(mock(Stream.class));
    final Rule rule = parser.parseRule(ruleForTest(), false);
    final EvaluationContext context = contextForRuleEval(rule, message);

    final Message origMessage = context.currentMessage();
    final Message newMessage = Iterables.getOnlyElement(context.createdMessages());

    assertThat(origMessage).isNotSameAs(newMessage);
    assertThat(newMessage.getMessage()).isEqualTo("new");
    assertThat(newMessage.getSource()).isEqualTo("synthetic");
    assertThat(newMessage.getStreams()).isEmpty();
    assertThat(newMessage.hasField("removed_again")).isFalse();
    assertThat(newMessage.getFieldAs(Boolean.class, "has_source")).isTrue();
    assertThat(newMessage.getFieldAs(String.class, "only_in")).isEqualTo("new message");
    assertThat(newMessage.getFieldAs(String.class, "multi")).isEqualTo("new message");
    assertThat(newMessage.getFieldAs(String.class, "foo")).isNull();
}
 
开发者ID:Graylog2,项目名称:graylog-plugin-pipeline-processor,代码行数:22,代码来源:FunctionsSnippetsTest.java

示例5: load

import org.graylog2.plugin.streams.Stream; //导入依赖的package包/类
@Override
public Stream load(String id) throws NotFoundException {
    final Stream stream = store.get(id);
    if (stream == null) {
        throw new NotFoundException();
    }
    return stream;
}
 
开发者ID:Graylog2,项目名称:graylog-plugin-pipeline-processor,代码行数:9,代码来源:PipelinePerformanceBenchmarks.java

示例6: call

import org.graylog2.plugin.streams.Stream; //导入依赖的package包/类
@Override
public void call (final Stream stream, final AlertCondition.CheckResult result) throws AlarmCallbackException {
  
  call (new JiraIssueClient (
      configuration.getString(CK_JIRA_PROJECT_KEY),
      buildJIRATitle (stream, result),
      buildDescription (stream, result),
      configuration.getString(CK_JIRA_LABELS),
      configuration.getString(CK_JIRA_ISSUE_TYPE),
      configuration.getString(CK_JIRA_COMPONENTS),
      configuration.getString(CK_JIRA_PRIORITY),
      configuration.getString(CK_JIRA_INSTANCE_URL),
      configuration.getString(CK_JIRA_USERNAME),
      configuration.getString(CK_JIRA_PASSWORD),
      configuration.getString(CK_JIRA_MD5_FILTER_QUERY),
      configuration.getString(CK_JIRA_MD5_CUSTOM_FIELD),
      buildJIRAGraylogMapping(stream, result),
      getJIRAMessageDigest (stream, result)), stream, result);
}
 
开发者ID:magicdude4eva,项目名称:graylog-jira-alarmcallback,代码行数:20,代码来源:JiraAlarmCallback.java

示例7: trigger

import org.graylog2.plugin.streams.Stream; //导入依赖的package包/类
public void trigger (final Stream stream, final AlertCondition.CheckResult checkResult) throws AlarmCallbackException {

    try {
      BasicCredentials creds = new BasicCredentials (JIRAUserName, JIRAPassword);
  
      jiraClient = new JiraClient(JIRAServerURL, creds);
  
      if (isDuplicateJiraIssue() == false) {
        createJIRAIssue();
      }
    } catch (Throwable ex) {
      LOG.error("Error in trigger function" + ex.getMessage() + (ex.getCause() != null ? ", Cause=" + ex.getCause().getMessage() : ""), ex);
      throw ex;
    }
    
 }
 
开发者ID:magicdude4eva,项目名称:graylog-jira-alarmcallback,代码行数:17,代码来源:JiraIssueClient.java

示例8: call

import org.graylog2.plugin.streams.Stream; //导入依赖的package包/类
@Override
public void call(Stream stream, AlertCondition.CheckResult result) throws AlarmCallbackException {
    final JiraClient client = new JiraClient(
            configuration.getString(CK_INSTANCE_URL),
            configuration.getString(CK_USERNAME),
            configuration.getString(CK_PASSWORD)
    );

    JiraIssue jiraIssue = new JiraIssue(
            configuration.getString(CK_PROJECT_KEY),
            configuration.getString(CK_LABELS),
            configuration.getString(CK_ISSUE_TYPE),
            configuration.getString(CK_COMPONENTS),
            configuration.getString(CK_PRIORITY),
            buildTitle(stream),
            buildDescription(stream, result, configuration)
    );
    try {
        client.send(jiraIssue);
    } catch (JiraClient.JiraClientException e) {
        throw new RuntimeException(e.getMessage());
    }
}
 
开发者ID:tjackiw,项目名称:graylog-plugin-jira,代码行数:24,代码来源:JiraAlarmCallback.java

示例9: AggregatesAlertCondition

import org.graylog2.plugin.streams.Stream; //导入依赖的package包/类
@AssistedInject
public AggregatesAlertCondition(Searches searches,
                                ClusterConfigService clusterConfigService,
                                HistoryItemService historyItemService,
                                @Assisted Stream stream,
                                @Nullable @Assisted("id") String id,
                                @Assisted DateTime createdAt,
                                @Assisted("userid") String creatorUserId,
                                @Assisted Map<String, Object> parameters,
                                @Assisted("title") @Nullable String title) {
    super(stream, id, AggregatesUtil.ALERT_CONDITION_TYPE, createdAt, creatorUserId, parameters, title);

    this.description = (String) parameters.get("description");
    this.query = (String) parameters.get("query");
    this.field = (String) parameters.get("field");
    this.numberOfMatches = (Long)parameters.get("number_of_matches");
    this.matchMoreOrEqual = parameters.get("match_more_or_equal") == null ? true : (boolean) parameters.get("match_more_or_equal");
    this.searches = searches;
    this.limit = 100;
    this.interval = Tools.getNumber(parameters.get("interval"), Integer.valueOf(1)).intValue();
    this.ruleName = (String) parameters.get("rule_name");

    this.clusterConfigService = clusterConfigService;
    this.historyItemService= historyItemService;
}
 
开发者ID:cvtienhoven,项目名称:graylog-plugin-aggregates,代码行数:26,代码来源:AggregatesAlertCondition.java

示例10: GraylogPluginDatadog

import org.graylog2.plugin.streams.Stream; //导入依赖的package包/类
@Inject
public GraylogPluginDatadog(@Assisted Stream stream, @Assisted Configuration configuration) throws MessageOutputConfigurationException {
    this.configuration = configuration;

    tags = configuration.getString(CK_DATADOG_TAGS, "").split(",");
    priority = configuration.getString(CK_DATADOG_PRIORITY, "normal");
    alertType = configuration.getString(CK_DATADOG_ALERT_TYPE, "info");
    aggregationKey = configuration.getString(CK_DATADOG_AGGREGATION_KEY, "");

    try {
        eventUrl = new URI(String.format("%s?api_key=%s&app_key=%s",
                                         DATADOG_API_URL,
                                         configuration.getString(CK_DATADOG_API_KEY),
                                         configuration.getString(CK_DATADOG_APP_KEY)));
    } catch (URISyntaxException e){
        throw new MessageOutputConfigurationException("Syntax error in datadog event URL");
    }

    Client client = ClientBuilder.newClient();
    eventTarget = client.target(eventUrl);
    isRunning.set(true);
}
 
开发者ID:underdogio,项目名称:graylog-plugin-datadog,代码行数:23,代码来源:GraylogPluginDatadog.java

示例11: testCallSucceedsWithSimpleJob

import org.graylog2.plugin.streams.Stream; //导入依赖的package包/类
@Test
public void testCallSucceedsWithSimpleJob() throws Exception {
    final Stream mockStream = mock(Stream.class);
    final AlertCondition.CheckResult checkResult = new AbstractAlertCondition.NegativeCheckResult(
            new DummyAlertCondition(
                    mockStream,
                    "id",
                    new DateTime(2017, 3, 20, 0, 0, DateTimeZone.UTC),
                    "user",
                    Collections.emptyMap())
    );

    final Configuration configuration = new Configuration(VALID_CONFIG_SOURCE);
    configuration.setString("api_token", token);
    configuration.setString("job_id", "804f107a-cafe-babe-0000-deadbeef0000");

    alarmCallback.initialize(configuration);
    alarmCallback.checkConfiguration();
    alarmCallback.call(mockStream, checkResult);
}
 
开发者ID:graylog-labs,项目名称:graylog-plugin-rundeck,代码行数:21,代码来源:RundeckAlarmCallbackIT.java

示例12: testCallFailsWithDisabledJob

import org.graylog2.plugin.streams.Stream; //导入依赖的package包/类
@Test
public void testCallFailsWithDisabledJob() throws Exception {
    final Stream mockStream = mock(Stream.class);
    final AlertCondition.CheckResult checkResult = new AbstractAlertCondition.NegativeCheckResult(
            new DummyAlertCondition(
                    mockStream,
                    "id",
                    new DateTime(2017, 3, 20, 0, 0, DateTimeZone.UTC),
                    "user",
                    Collections.emptyMap())
    );

    final Configuration configuration = new Configuration(VALID_CONFIG_SOURCE);
    configuration.setString("api_token", token);
    configuration.setString("job_id", "804f107a-cafe-babe-0000-deadbeef0001");

    expectedException.expect(AlarmCallbackException.class);
    expectedException.expectMessage("Failed to send alarm to Rundeck");

    alarmCallback.initialize(configuration);
    alarmCallback.checkConfiguration();
    alarmCallback.call(mockStream, checkResult);
}
 
开发者ID:graylog-labs,项目名称:graylog-plugin-rundeck,代码行数:24,代码来源:RundeckAlarmCallbackIT.java

示例13: testCallSucceedsWithFailingJob

import org.graylog2.plugin.streams.Stream; //导入依赖的package包/类
@Test
public void testCallSucceedsWithFailingJob() throws Exception {
    final Stream mockStream = mock(Stream.class);
    final AlertCondition.CheckResult checkResult = new AbstractAlertCondition.NegativeCheckResult(
            new DummyAlertCondition(
                    mockStream,
                    "id",
                    new DateTime(2017, 3, 20, 0, 0, DateTimeZone.UTC),
                    "user",
                    Collections.emptyMap())
    );

    final Configuration configuration = new Configuration(VALID_CONFIG_SOURCE);
    configuration.setString("api_token", token);
    configuration.setString("job_id", "804f107a-cafe-babe-0000-deadbeef0002");

    alarmCallback.initialize(configuration);
    alarmCallback.checkConfiguration();
    alarmCallback.call(mockStream, checkResult);
}
 
开发者ID:graylog-labs,项目名称:graylog-plugin-rundeck,代码行数:21,代码来源:RundeckAlarmCallbackIT.java

示例14: testCallSucceedsWithParameterizedJob

import org.graylog2.plugin.streams.Stream; //导入依赖的package包/类
@Test
public void testCallSucceedsWithParameterizedJob() throws Exception {
    final Stream mockStream = mock(Stream.class);
    final AlertCondition.CheckResult checkResult = new AbstractAlertCondition.NegativeCheckResult(
            new DummyAlertCondition(
                    mockStream,
                    "id",
                    new DateTime(2017, 3, 20, 0, 0, DateTimeZone.UTC),
                    "user",
                    Collections.emptyMap())
    );

    final Configuration configuration = new Configuration(VALID_CONFIG_SOURCE);
    configuration.setString("api_token", token);
    configuration.setString("job_id", "804f107a-cafe-babe-0000-deadbeef0003");
    configuration.setString("args", "custom-arg:Test");

    alarmCallback.initialize(configuration);
    alarmCallback.checkConfiguration();
    alarmCallback.call(mockStream, checkResult);
}
 
开发者ID:graylog-labs,项目名称:graylog-plugin-rundeck,代码行数:22,代码来源:RundeckAlarmCallbackIT.java

示例15: testCallFailsWithParameterizedJobWithoutParameters

import org.graylog2.plugin.streams.Stream; //导入依赖的package包/类
@Test
public void testCallFailsWithParameterizedJobWithoutParameters() throws Exception {
    final Stream mockStream = mock(Stream.class);
    final AlertCondition.CheckResult checkResult = new AbstractAlertCondition.NegativeCheckResult(
            new DummyAlertCondition(
                    mockStream,
                    "id",
                    new DateTime(2017, 3, 20, 0, 0, DateTimeZone.UTC),
                    "user",
                    Collections.emptyMap())
    );

    final Configuration configuration = new Configuration(VALID_CONFIG_SOURCE);
    configuration.setString("api_token", token);
    configuration.setString("job_id", "804f107a-cafe-babe-0000-deadbeef0003");

    expectedException.expect(AlarmCallbackException.class);
    expectedException.expectMessage("Failed to send alarm to Rundeck");

    alarmCallback.initialize(configuration);
    alarmCallback.checkConfiguration();
    alarmCallback.call(mockStream, checkResult);
}
 
开发者ID:graylog-labs,项目名称:graylog-plugin-rundeck,代码行数:24,代码来源:RundeckAlarmCallbackIT.java


注:本文中的org.graylog2.plugin.streams.Stream类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。