Search in sources :

Example 1 with Configuration

use of com.xilixir.fortniteapi.v2.Configuration in project graylog2-server by Graylog2.

the class SearchesTest method setUp.

@Before
public void setUp() throws Exception {
    when(indexRangeService.find(any(DateTime.class), any(DateTime.class))).thenReturn(INDEX_RANGES);
    metricRegistry = new MetricRegistry();
    searches = new Searches(new Configuration(), indexRangeService, client, metricRegistry, streamService, mock(Indices.class));
}
Also used : Configuration(org.graylog2.Configuration) MetricRegistry(com.codahale.metrics.MetricRegistry) ZonedDateTime(java.time.ZonedDateTime) DateTime(org.joda.time.DateTime) Before(org.junit.Before)

Example 2 with Configuration

use of com.xilixir.fortniteapi.v2.Configuration in project graylog2-server by Graylog2.

the class ExposedConfigurationTest method testCreateWithConfiguration.

@Test
public void testCreateWithConfiguration() throws Exception {
    final Configuration configuration = new Configuration();
    final ExposedConfiguration c = ExposedConfiguration.create(configuration);
    assertThat(c.inputBufferProcessors()).isEqualTo(configuration.getInputbufferProcessors());
    assertThat(c.processBufferProcessors()).isEqualTo(configuration.getProcessBufferProcessors());
    assertThat(c.outputBufferProcessors()).isEqualTo(configuration.getOutputBufferProcessors());
    assertThat(c.processorWaitStrategy()).isEqualTo(configuration.getProcessorWaitStrategy().getClass().getName());
    assertThat(c.inputBufferWaitStrategy()).isEqualTo(configuration.getInputBufferWaitStrategy().getClass().getName());
    assertThat(c.inputBufferRingSize()).isEqualTo(configuration.getInputBufferRingSize());
    assertThat(c.ringSize()).isEqualTo(configuration.getRingSize());
    assertThat(c.pluginDir()).isEqualTo(configuration.getPluginDir());
    assertThat(c.nodeIdFile()).isEqualTo(configuration.getNodeIdFile());
    assertThat(c.allowHighlighting()).isEqualTo(configuration.isAllowHighlighting());
    assertThat(c.allowLeadingWildcardSearches()).isEqualTo(configuration.isAllowLeadingWildcardSearches());
    assertThat(c.streamProcessingTimeout()).isEqualTo(configuration.getStreamProcessingTimeout());
    assertThat(c.streamProcessingMaxFaults()).isEqualTo(configuration.getStreamProcessingMaxFaults());
    assertThat(c.outputModuleTimeout()).isEqualTo(configuration.getOutputModuleTimeout());
    assertThat(c.staleMasterTimeout()).isEqualTo(configuration.getStaleMasterTimeout());
    assertThat(c.gcWarningThreshold()).isEqualTo(configuration.getGcWarningThreshold().toString());
}
Also used : Configuration(org.graylog2.Configuration) Test(org.junit.Test)

Example 3 with Configuration

use of com.xilixir.fortniteapi.v2.Configuration in project graylog2-server by Graylog2.

the class ExposedConfigurationTest method testSerialization.

@Test
public void testSerialization() throws Exception {
    final Configuration configuration = new Configuration();
    final ExposedConfiguration c = ExposedConfiguration.create(configuration);
    final String json = objectMapper.writeValueAsString(c);
    assertThat((int) JsonPath.read(json, "$.inputbuffer_processors")).isEqualTo(c.inputBufferProcessors());
    assertThat((int) JsonPath.read(json, "$.processbuffer_processors")).isEqualTo(c.processBufferProcessors());
    assertThat((int) JsonPath.read(json, "$.outputbuffer_processors")).isEqualTo(c.outputBufferProcessors());
    assertThat((String) JsonPath.read(json, "$.processor_wait_strategy")).isEqualTo(c.processorWaitStrategy());
    assertThat((String) JsonPath.read(json, "$.inputbuffer_wait_strategy")).isEqualTo(c.inputBufferWaitStrategy());
    assertThat((int) JsonPath.read(json, "$.inputbuffer_ring_size")).isEqualTo(c.inputBufferRingSize());
    assertThat((int) JsonPath.read(json, "$.ring_size")).isEqualTo(c.ringSize());
    assertThat((String) JsonPath.read(json, "$.plugin_dir")).isEqualTo(c.pluginDir());
    assertThat((String) JsonPath.read(json, "$.node_id_file")).isEqualTo(c.nodeIdFile());
    assertThat((boolean) JsonPath.read(json, "$.allow_highlighting")).isEqualTo(c.allowHighlighting());
    assertThat((boolean) JsonPath.read(json, "$.allow_leading_wildcard_searches")).isEqualTo(c.allowLeadingWildcardSearches());
    assertThat((int) JsonPath.read(json, "$.stream_processing_timeout")).isEqualTo((int) c.streamProcessingTimeout());
    assertThat((int) JsonPath.read(json, "$.stream_processing_max_faults")).isEqualTo(c.streamProcessingMaxFaults());
    assertThat((int) JsonPath.read(json, "$.output_module_timeout")).isEqualTo((int) c.outputModuleTimeout());
    assertThat((int) JsonPath.read(json, "$.stale_master_timeout")).isEqualTo(c.staleMasterTimeout());
    assertThat((String) JsonPath.read(json, "$.gc_warning_threshold")).isEqualTo(c.gcWarningThreshold());
}
Also used : Configuration(org.graylog2.Configuration) Test(org.junit.Test)

Example 4 with Configuration

use of com.xilixir.fortniteapi.v2.Configuration in project graylog2-server by Graylog2.

the class FieldContentValueAlertConditionTest method testCorrectUsageOfRelativeRange.

@Test
public void testCorrectUsageOfRelativeRange() throws Exception {
    final Stream stream = mock(Stream.class);
    final Searches searches = mock(Searches.class);
    final Configuration configuration = mock(Configuration.class);
    final SearchResult searchResult = mock(SearchResult.class);
    final int alertCheckInterval = 42;
    final RelativeRange relativeRange = RelativeRange.create(alertCheckInterval);
    when(configuration.getAlertCheckInterval()).thenReturn(alertCheckInterval);
    when(searches.search(anyString(), anyString(), eq(relativeRange), anyInt(), anyInt(), any(Sorting.class))).thenReturn(searchResult);
    final FieldContentValueAlertCondition alertCondition = new FieldContentValueAlertCondition(searches, configuration, stream, null, DateTime.now(DateTimeZone.UTC), "mockuser", ImmutableMap.<String, Object>of("field", "test", "value", "test"), "Field Content Value Test COndition");
    final AbstractAlertCondition.CheckResult result = alertCondition.runCheck();
}
Also used : Searches(org.graylog2.indexer.searches.Searches) Configuration(org.graylog2.Configuration) RelativeRange(org.graylog2.plugin.indexer.searches.timeranges.RelativeRange) Stream(org.graylog2.plugin.streams.Stream) SearchResult(org.graylog2.indexer.results.SearchResult) AbstractAlertCondition(org.graylog2.alerts.AbstractAlertCondition) Sorting(org.graylog2.indexer.searches.Sorting) Test(org.junit.Test) AlertConditionTest(org.graylog2.alerts.AlertConditionTest)

Example 5 with Configuration

use of com.xilixir.fortniteapi.v2.Configuration in project graylog2-server by Graylog2.

the class UserServiceImplTest method setUp.

@Before
public void setUp() throws Exception {
    this.mongoConnection = mongoRule.getMongoConnection();
    this.configuration = new Configuration();
    this.userFactory = new UserImplFactory(configuration);
    this.permissions = new Permissions(ImmutableSet.of(new RestPermissions()));
    this.userService = new UserServiceImpl(mongoConnection, configuration, roleService, userFactory, permissionsResolver);
    when(roleService.getAdminRoleObjectId()).thenReturn("deadbeef");
}
Also used : RestPermissions(org.graylog2.shared.security.RestPermissions) Configuration(org.graylog2.Configuration) RestPermissions(org.graylog2.shared.security.RestPermissions) Permissions(org.graylog2.shared.security.Permissions) Before(org.junit.Before)

Aggregations

Configuration (org.apache.commons.configuration2.Configuration)18 Configuration (org.graylog2.Configuration)10 Test (org.junit.Test)7 Configurations (org.apache.commons.configuration2.builder.fluent.Configurations)5 Before (org.junit.Before)5 Test (org.testng.annotations.Test)5 Configuration (de.tudarmstadt.ukp.clarin.webanno.curation.casdiff.CasDiff2.Configuration)4 ConfigurationSet (de.tudarmstadt.ukp.clarin.webanno.curation.casdiff.CasDiff2.ConfigurationSet)4 ArrayList (java.util.ArrayList)3 MetricRegistry (com.codahale.metrics.MetricRegistry)2 DiffResult (de.tudarmstadt.ukp.clarin.webanno.curation.casdiff.CasDiff2.DiffResult)2 IOException (java.io.IOException)2 Map (java.util.Map)2 BaseConfiguration (org.apache.commons.configuration2.BaseConfiguration)2 HierarchicalConfiguration (org.apache.commons.configuration2.HierarchicalConfiguration)2 JCas (org.apache.uima.jcas.JCas)2 Role (org.graylog2.shared.users.Role)2 UserService (org.graylog2.shared.users.UserService)2 EventBus (com.google.common.eventbus.EventBus)1 Gson (com.google.gson.Gson)1