本文整理汇总了Java中org.graylog2.plugin.configuration.Configuration.setString方法的典型用法代码示例。如果您正苦于以下问题:Java Configuration.setString方法的具体用法?Java Configuration.setString怎么用?Java Configuration.setString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.graylog2.plugin.configuration.Configuration
的用法示例。
在下文中一共展示了Configuration.setString方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testCallSucceedsWithSimpleJob
import org.graylog2.plugin.configuration.Configuration; //导入方法依赖的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);
}
示例2: testCallFailsWithDisabledJob
import org.graylog2.plugin.configuration.Configuration; //导入方法依赖的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);
}
示例3: testCallSucceedsWithFailingJob
import org.graylog2.plugin.configuration.Configuration; //导入方法依赖的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);
}
示例4: testCallSucceedsWithParameterizedJob
import org.graylog2.plugin.configuration.Configuration; //导入方法依赖的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);
}
示例5: testCallFailsWithParameterizedJobWithoutParameters
import org.graylog2.plugin.configuration.Configuration; //导入方法依赖的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);
}
示例6: testCallFailsWithUnknownJob
import org.graylog2.plugin.configuration.Configuration; //导入方法依赖的package包/类
@Test
public void testCallFailsWithUnknownJob() 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", "unknown");
expectedException.expect(AlarmCallbackException.class);
expectedException.expectMessage("Failed to send alarm to Rundeck");
alarmCallback.initialize(configuration);
alarmCallback.checkConfiguration();
alarmCallback.call(mockStream, checkResult);
}
示例7: testCallSucceedsWithValidConfiguration
import org.graylog2.plugin.configuration.Configuration; //导入方法依赖的package包/类
@Test
public void testCallSucceedsWithValidConfiguration() throws Exception {
final MockResponse mockResponse = new MockResponse()
.addHeader(HttpHeaders.CONTENT_TYPE, MediaType.TEXT_XML)
.setResponseCode(200);
final MockWebServer mockWebServer = new MockWebServer();
mockWebServer.enqueue(mockResponse);
mockWebServer.start();
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("rundeck_url", mockWebServer.url("/").toString());
alarmCallback.initialize(configuration);
alarmCallback.checkConfiguration();
alarmCallback.call(mockStream, checkResult);
final RecordedRequest recordedRequest = mockWebServer.takeRequest(10, TimeUnit.SECONDS);
assertEquals(1, mockWebServer.getRequestCount());
assertEquals("POST /api/12/job/test-job-id/executions HTTP/1.1", recordedRequest.getRequestLine());
assertEquals("text/xml", recordedRequest.getHeader("Accept"));
assertEquals("test_api_token", recordedRequest.getHeader("X-Rundeck-Auth-Token"));
assertEquals(0L, recordedRequest.getBodySize());
mockWebServer.shutdown();
}