mirror of
https://github.com/optim-enterprises-bv/siembol.git
synced 2025-12-09 21:45:19 +00:00
maven: cleaning dependencies (#241)
* cleaning dependencies * increasing app version * fixing version * reworking parsing pom * cleaning dependencies in pom files * reworkign POM files, enable xlint all, mitigate warnings * minor cleaning * minor cleaning
This commit is contained in:
committed by
GitHub Enterprise
parent
8c7731acca
commit
824ac43d58
@@ -11,13 +11,31 @@
|
||||
<parent>
|
||||
<groupId>uk.co.gresearch.siembol</groupId>
|
||||
<artifactId>alerting</artifactId>
|
||||
<version>1.79-SNAPSHOT</version>
|
||||
<version>1.80-SNAPSHOT</version>
|
||||
</parent>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-core</artifactId>
|
||||
<version>${jackson_version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-annotations</artifactId>
|
||||
<version>${jackson_version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>${jackson_version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>uk.co.gresearch.siembol</groupId>
|
||||
<artifactId>siembol-common</artifactId>
|
||||
<version>1.79-SNAPSHOT</version>
|
||||
<version>1.80-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.adrianwalker</groupId>
|
||||
@@ -39,60 +57,5 @@
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>${shade_version}</version>
|
||||
<configuration>
|
||||
<createDependencyReducedPom>true</createDependencyReducedPom>
|
||||
<artifactSet>
|
||||
<excludes>
|
||||
<exclude>*slf4j*</exclude>
|
||||
</excludes>
|
||||
</artifactSet>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<shadedArtifactAttached>false</shadedArtifactAttached>
|
||||
<shadedClassifierName>uber</shadedClassifierName>
|
||||
<filters>
|
||||
<filter>
|
||||
<artifact>*:*</artifact>
|
||||
<excludes>
|
||||
<exclude>META-INF/*.SF</exclude>
|
||||
<exclude>META-INF/*.DSA</exclude>
|
||||
<exclude>META-INF/*.RSA</exclude>
|
||||
</excludes>
|
||||
</filter>
|
||||
</filters>
|
||||
<artifactSet>
|
||||
<excludes>
|
||||
<exclude>org.slf4j.impl*</exclude>
|
||||
<exclude>org.slf4j:slf4j-log4j*</exclude>
|
||||
</excludes>
|
||||
</artifactSet>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.5.1</version>
|
||||
<configuration>
|
||||
<forceJavacCompilerUse>true</forceJavacCompilerUse>
|
||||
<source>${java_version}</source>
|
||||
<compilerArgument>-Xlint:unchecked</compilerArgument>
|
||||
<target>${java_version}</target>
|
||||
<showWarnings>true</showWarnings>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
||||
@@ -4,6 +4,7 @@ import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.mockito.ArgumentMatchers;
|
||||
import org.mockito.Mockito;
|
||||
import uk.co.gresearch.siembol.common.utils.TimeProvider;
|
||||
import uk.co.gresearch.siembol.alerts.common.*;
|
||||
@@ -13,7 +14,7 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.mockito.Matchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyMap;
|
||||
import static org.mockito.Mockito.doNothing;
|
||||
import static org.mockito.Mockito.when;
|
||||
import static org.mockito.internal.verification.VerificationModeFactory.times;
|
||||
@@ -54,11 +55,11 @@ public class CorrelationEngineTest {
|
||||
resultRule2 = AlertingResult.fromEvaluationResult(EvaluationResult.MATCH, outEvent);
|
||||
|
||||
when(rule1.getAlertNames()).thenReturn(Arrays.asList("alert1", "alert2"));
|
||||
when(rule1.match(any())).thenReturn(resultRule1);
|
||||
when(rule1.match(ArgumentMatchers.<Map<String, Object>>any())).thenReturn(resultRule1);
|
||||
|
||||
|
||||
when(rule2.getAlertNames()).thenReturn(Arrays.asList("alert2"));
|
||||
when(rule2.match(any())).thenReturn(resultRule2);
|
||||
when(rule2.match(ArgumentMatchers.<Map<String, Object>>any())).thenReturn(resultRule2);
|
||||
|
||||
when(timeProvider.getCurrentTimeInMs()).thenReturn(currentTime);
|
||||
doNothing().when(rule1).clean(currentTime);
|
||||
@@ -109,7 +110,7 @@ public class CorrelationEngineTest {
|
||||
|
||||
@Test
|
||||
public void testMatchFirstRule() {
|
||||
when(rule2.match(any())).thenReturn(AlertingResult.fromEvaluationResult(NO_MATCH, outEvent));
|
||||
when(rule2.match(ArgumentMatchers.<Map<String, Object>>any())).thenReturn(AlertingResult.fromEvaluationResult(NO_MATCH, outEvent));
|
||||
alert.put(AlertingFields.RULE_NAME.getAlertingName(), "alert2");
|
||||
AlertingResult result = engine.evaluate(alert);
|
||||
Assert.assertEquals(OK, result.getStatusCode());
|
||||
@@ -124,7 +125,7 @@ public class CorrelationEngineTest {
|
||||
@Test
|
||||
public void testMatchFirstAndExceptionSecond() {
|
||||
resultRule2 = new AlertingResult(ERROR, resultRule2.getAttributes());
|
||||
when(rule2.match(any())).thenReturn(resultRule2);
|
||||
when(rule2.match(ArgumentMatchers.<Map<String, Object>>any())).thenReturn(resultRule2);
|
||||
|
||||
alert.put(AlertingFields.RULE_NAME.getAlertingName(), "alert2");
|
||||
AlertingResult result = engine.evaluate(alert);
|
||||
|
||||
@@ -5,6 +5,7 @@ import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.mockito.ArgumentMatchers;
|
||||
import org.mockito.Mockito;
|
||||
import uk.co.gresearch.siembol.alerts.common.EvaluationResult;
|
||||
import uk.co.gresearch.siembol.alerts.common.AlertingEngine;
|
||||
@@ -13,7 +14,7 @@ import uk.co.gresearch.siembol.alerts.common.AlertingResult;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import static org.mockito.Matchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyMap;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
public class AlertingEngineImplTest {
|
||||
@@ -46,10 +47,10 @@ public class AlertingEngineImplTest {
|
||||
when(rule1.getRuleName()).thenReturn("rule1");
|
||||
when(rule1.getFullRuleName()).thenReturn("rule1_v1");
|
||||
|
||||
when(rule1.match(any())).thenReturn(resultRule1);
|
||||
when(rule1.match(ArgumentMatchers.<Map<String, Object>>any())).thenReturn(resultRule1);
|
||||
when(rule2.getRuleName()).thenReturn("rule2");
|
||||
when(rule2.getFullRuleName()).thenReturn("rule2_v1");
|
||||
when(rule2.match(any())).thenReturn(resultRule2);
|
||||
when(rule2.match(ArgumentMatchers.<Map<String, Object>>any())).thenReturn(resultRule2);
|
||||
|
||||
rules = Arrays.asList(Pair.of(sourceType, rule1),
|
||||
Pair.of("*", rule2));
|
||||
@@ -141,7 +142,7 @@ public class AlertingEngineImplTest {
|
||||
|
||||
@Test
|
||||
public void testMatchAndException() {
|
||||
when(rule1.match(any())).thenThrow(new RuntimeException());
|
||||
when(rule1.match(ArgumentMatchers.<Map<String, Object>>any())).thenThrow(new RuntimeException());
|
||||
AlertingResult ret = engine.evaluate(knownSourceType);
|
||||
Assert.assertEquals(AlertingResult.StatusCode.OK, ret.getStatusCode());
|
||||
Assert.assertEquals(EvaluationResult.MATCH, ret.getAttributes().getEvaluationResult());
|
||||
|
||||
@@ -4,6 +4,7 @@ import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.mockito.ArgumentMatchers;
|
||||
import org.mockito.Mockito;
|
||||
import uk.co.gresearch.siembol.alerts.common.EvaluationResult;
|
||||
import uk.co.gresearch.siembol.alerts.common.AlertingFields;
|
||||
@@ -11,7 +12,8 @@ import uk.co.gresearch.siembol.alerts.common.AlertingResult;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import static org.mockito.Matchers.any;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyMap;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
public class RuleTest {
|
||||
@@ -30,7 +32,7 @@ public class RuleTest {
|
||||
constants = Arrays.asList(Pair.of("detection_source", "alerts"));
|
||||
protections = Arrays.asList(Pair.of(AlertingFields.MAX_PER_HOUR_FIELD.toString(), Integer.valueOf(1)));
|
||||
matcher = Mockito.mock(RuleMatcher.class);
|
||||
when(matcher.match(any())).thenReturn(EvaluationResult.MATCH);
|
||||
when(matcher.match(ArgumentMatchers.<Map<String, Object>>any())).thenReturn(EvaluationResult.MATCH);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -120,7 +122,7 @@ public class RuleTest {
|
||||
|
||||
@Test
|
||||
public void testGoodNoMatch() {
|
||||
when(matcher.match(any())).thenReturn(EvaluationResult.NO_MATCH);
|
||||
when(matcher.match(ArgumentMatchers.<Map<String, Object>>any())).thenReturn(EvaluationResult.NO_MATCH);
|
||||
rule = Rule.builder()
|
||||
.matchers(Arrays.asList(matcher))
|
||||
.name(name)
|
||||
@@ -136,7 +138,7 @@ public class RuleTest {
|
||||
|
||||
@Test(expected = RuntimeException.class)
|
||||
public void testThrowsException() throws RuntimeException {
|
||||
when(matcher.match(any())).thenThrow(new RuntimeException());
|
||||
when(matcher.match(ArgumentMatchers.<Map<String, Object>>any())).thenThrow(new RuntimeException());
|
||||
rule = Rule.builder()
|
||||
.matchers(Arrays.asList(matcher))
|
||||
.name(name)
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<parent>
|
||||
<groupId>uk.co.gresearch.siembol</groupId>
|
||||
<artifactId>alerting</artifactId>
|
||||
<version>1.79-SNAPSHOT</version>
|
||||
<version>1.80-SNAPSHOT</version>
|
||||
</parent>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
@@ -23,7 +23,7 @@
|
||||
<dependency>
|
||||
<groupId>uk.co.gresearch.siembol</groupId>
|
||||
<artifactId>alerting-core</artifactId>
|
||||
<version>1.79-SNAPSHOT</version>
|
||||
<version>1.80-SNAPSHOT</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
@@ -82,12 +82,17 @@
|
||||
<shadedClassifierName>uber</shadedClassifierName>
|
||||
<filters>
|
||||
<filter>
|
||||
<!-- Sometimes these get added and confuse the uber jar out of shade -->
|
||||
<artifact>*:*</artifact>
|
||||
<excludes>
|
||||
<exclude>module-info.class</exclude>
|
||||
<exclude>META-INF/*.SF</exclude>
|
||||
<exclude>META-INF/*.DSA</exclude>
|
||||
<exclude>META-INF/*.RSA</exclude>
|
||||
<exclude>META-INF/*.MF</exclude>
|
||||
<exclude>META-INF/*.txt</exclude>
|
||||
<exclude>META-INF/*/schema</exclude>
|
||||
<exclude>META-INF/LICENSE</exclude>
|
||||
<exclude>*/schema</exclude>
|
||||
</excludes>
|
||||
</filter>
|
||||
</filters>
|
||||
@@ -112,18 +117,6 @@
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.5.1</version>
|
||||
<configuration>
|
||||
<forceJavacCompilerUse>true</forceJavacCompilerUse>
|
||||
<source>${java_version}</source>
|
||||
<compilerArgument>-Xlint:unchecked</compilerArgument>
|
||||
<target>${java_version}</target>
|
||||
<showWarnings>true</showWarnings>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
||||
@@ -9,6 +9,7 @@ import java.io.ObjectOutputStream;
|
||||
import java.io.Serializable;
|
||||
|
||||
public class AlertingSparkEngine implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private transient AlertingEngine alertingEngine;
|
||||
private String rules;
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class AlertingSparkJob implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private final JavaRDD<String> rdd;
|
||||
private final AlertingSparkEngine alertingSparkEngine;
|
||||
private final int maxResult;
|
||||
@@ -89,7 +90,7 @@ public class AlertingSparkJob implements Serializable {
|
||||
return this;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
public AlertingSparkJob build() throws Exception {
|
||||
if (rules == null
|
||||
|| logPath == null
|
||||
|
||||
@@ -13,6 +13,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class AlertingSparkResult implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final ObjectWriter JSON_WRITER = new ObjectMapper()
|
||||
.writerFor(new TypeReference<Map<String, Object>>() { });
|
||||
private static final String ERROR_STATUS_CODE_MSG = "Status code: %s";
|
||||
|
||||
@@ -9,23 +9,23 @@
|
||||
<parent>
|
||||
<groupId>uk.co.gresearch.siembol</groupId>
|
||||
<artifactId>alerting</artifactId>
|
||||
<version>1.79-SNAPSHOT</version>
|
||||
<version>1.80-SNAPSHOT</version>
|
||||
</parent>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>uk.co.gresearch.siembol</groupId>
|
||||
<artifactId>alerting-core</artifactId>
|
||||
<version>1.79-SNAPSHOT</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-core</artifactId>
|
||||
<version>${jackson_version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-annotations</artifactId>
|
||||
<version>${jackson_version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>${jackson_version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.kafka</groupId>
|
||||
@@ -43,6 +43,21 @@
|
||||
<version>${storm_version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>uk.co.gresearch.siembol</groupId>
|
||||
<artifactId>alerting-core</artifactId>
|
||||
<version>1.80-SNAPSHOT</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
@@ -137,13 +152,30 @@
|
||||
<filter>
|
||||
<artifact>*:*</artifact>
|
||||
<excludes>
|
||||
<exclude>module-info.class</exclude>
|
||||
<exclude>META-INF/*.SF</exclude>
|
||||
<exclude>META-INF/*.DSA</exclude>
|
||||
<exclude>META-INF/*.RSA</exclude>
|
||||
<exclude>META-INF/*.MF</exclude>
|
||||
<exclude>META-INF/*.txt</exclude>
|
||||
<exclude>META-INF/*/schema</exclude>
|
||||
<exclude>META-INF/LICENSE</exclude>
|
||||
<exclude>META-INF/NOTICE</exclude>
|
||||
<exclude>META-INF/DEPENDENCIES</exclude>
|
||||
<exclude>*/schema</exclude>
|
||||
<exclude>LICENSE.txt</exclude>
|
||||
</excludes>
|
||||
</filter>
|
||||
</filters>
|
||||
<relocations>
|
||||
<relocation>
|
||||
<pattern>com</pattern>
|
||||
<shadedPattern>repackaged.com</shadedPattern>
|
||||
<includes>
|
||||
<include>com.fasterxml.jackson.*</include>
|
||||
<include>com.google.guava.*</include>
|
||||
</includes>
|
||||
</relocation>
|
||||
</relocations>
|
||||
<artifactSet>
|
||||
<excludes>
|
||||
@@ -157,18 +189,6 @@
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.5.1</version>
|
||||
<configuration>
|
||||
<forceJavacCompilerUse>true</forceJavacCompilerUse>
|
||||
<source>${java_version}</source>
|
||||
<compilerArgument>-Xlint:unchecked</compilerArgument>
|
||||
<target>${java_version}</target>
|
||||
<showWarnings>true</showWarnings>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
||||
@@ -25,12 +25,14 @@ import uk.co.gresearch.siembol.alerts.storm.model.AlertMessage;
|
||||
import uk.co.gresearch.siembol.alerts.storm.model.AlertMessages;
|
||||
import uk.co.gresearch.siembol.alerts.storm.model.ExceptionMessages;
|
||||
import uk.co.gresearch.siembol.common.model.AlertingStormAttributesDto;
|
||||
import uk.co.gresearch.siembol.common.zookeper.ZookeeperConnectorFactoryImpl;
|
||||
|
||||
import java.lang.invoke.MethodHandles;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
public class AlertingEngineBolt extends BaseRichBolt {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final String EXCEPTION_MSG_FORMAT = "Alerting Engine exception: %s during evaluating event: %s";
|
||||
private static final String INIT_EXCEPTION_MSG_FORMAT = "Alerting Engine exception: %s during initialising alerts engine";
|
||||
private static final String UPDATE_EXCEPTION_LOG = "Exception during alerts rules update: {}";
|
||||
@@ -59,9 +61,10 @@ public class AlertingEngineBolt extends BaseRichBolt {
|
||||
}
|
||||
|
||||
AlertingEngineBolt(AlertingStormAttributesDto attributes) {
|
||||
this(attributes, new ZookeeperConnectorFactory() {});
|
||||
this(attributes, new ZookeeperConnectorFactoryImpl());
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Override
|
||||
public void prepare(Map map, TopologyContext topologyContext, OutputCollector outputCollector) {
|
||||
this.collector = outputCollector;
|
||||
|
||||
@@ -17,6 +17,7 @@ import uk.co.gresearch.siembol.common.storm.StormHelper;
|
||||
import uk.co.gresearch.siembol.common.zookeper.ZookeeperConnectorFactory;
|
||||
import uk.co.gresearch.siembol.alerts.storm.model.AlertingEngineType;
|
||||
import uk.co.gresearch.siembol.common.model.AlertingStormAttributesDto;
|
||||
import uk.co.gresearch.siembol.common.zookeper.ZookeeperConnectorFactoryImpl;
|
||||
|
||||
import java.lang.invoke.MethodHandles;
|
||||
import java.util.Base64;
|
||||
@@ -104,7 +105,7 @@ public class AlertingStorm {
|
||||
|
||||
Config config = new Config();
|
||||
config.putAll(attributes.getStormAttributes().getStormConfig().getRawMap());
|
||||
ZookeeperConnectorFactory zookeeperConnectorFactory = new ZookeeperConnectorFactory() {};
|
||||
ZookeeperConnectorFactory zookeeperConnectorFactory = new ZookeeperConnectorFactoryImpl();
|
||||
|
||||
|
||||
StormTopology topology = engineType == AlertingEngineType.SIEMBOL_ALERTS
|
||||
|
||||
@@ -16,6 +16,7 @@ import static org.apache.storm.utils.TupleUtils.isTick;
|
||||
import static org.apache.storm.utils.TupleUtils.putTickFrequencyIntoComponentConfig;
|
||||
|
||||
public class CorrelationAlertingEngineBolt extends AlertingEngineBolt {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
|
||||
private final int cleanIntervalSec;
|
||||
|
||||
|
||||
@@ -25,8 +25,8 @@ import uk.co.gresearch.siembol.alerts.storm.model.*;
|
||||
import uk.co.gresearch.siembol.common.model.AlertingStormAttributesDto;
|
||||
|
||||
public class KafkaWriterBolt extends BaseRichBolt {
|
||||
private static final Logger LOG =
|
||||
LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
|
||||
private static final String WRONG_ALERTS_FIELD_MESSAGE = "Wrong alerts type in tuple";
|
||||
private static final String WRONG_EXCEPTION_FIELD_MESSAGE = "Wrong exceptions type in tuple";
|
||||
|
||||
@@ -121,6 +121,7 @@ public class KafkaWriterBolt extends BaseRichBolt {
|
||||
collector.ack(tuple);
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Override
|
||||
public void prepare(Map map, TopologyContext topologyContext, OutputCollector outputCollector) {
|
||||
this.collector = outputCollector;
|
||||
|
||||
@@ -9,13 +9,15 @@ import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
public class AlertMessage implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final String MISSING_FIELDS_MSG = "Missing siembol alerting fields in alert: %s";
|
||||
private static final String MISSING_CORRELATION_KEY = "Missing correlation key field in alert: %s";
|
||||
|
||||
public enum Flags implements Serializable {
|
||||
CORRELATION_ENGINE,
|
||||
CORRELATION_ALERT,
|
||||
VISIBLE_ALERT
|
||||
VISIBLE_ALERT;
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
|
||||
private final String fullRuleName;
|
||||
|
||||
@@ -3,4 +3,5 @@ package uk.co.gresearch.siembol.alerts.storm.model;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class AlertMessages extends ArrayList<AlertMessage> {
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ public enum AlertingEngineType implements Serializable {
|
||||
SIEMBOL_ALERTS("siembol_alerts"),
|
||||
SIEMBOL_CORRELATION_ALERTS("siembol_correlation_alerts");
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final String ENGINE_STR = "%s_engine";
|
||||
private static final String UNKNOWN_MSG = "unknown type: %s";
|
||||
private final String name;
|
||||
|
||||
@@ -3,4 +3,5 @@ package uk.co.gresearch.siembol.alerts.storm.model;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class ExceptionMessages extends ArrayList<String> {
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
import org.mockito.ArgumentMatchers;
|
||||
import org.mockito.Mockito;
|
||||
import uk.co.gresearch.siembol.common.constants.SiembolMessageFields;
|
||||
import uk.co.gresearch.siembol.common.model.ZookeeperAttributesDto;
|
||||
@@ -23,10 +24,10 @@ import uk.co.gresearch.siembol.common.model.AlertingStormAttributesDto;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.Mockito.never;
|
||||
import static org.mockito.Mockito.verify;
|
||||
@@ -187,7 +188,7 @@ public class AlertingEngineBoltTest {
|
||||
.thenReturn(event.replaceAll("is_alert", "unknown"));
|
||||
|
||||
AlertingEngineBolt.execute(tuple);
|
||||
verify(collector, never()).emit(any());
|
||||
verify(collector, never()).emit(ArgumentMatchers.<List<Object>>any());
|
||||
verify(collector, times(1)).ack(eq(tuple));
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
import org.mockito.ArgumentMatchers;
|
||||
import org.mockito.Mockito;
|
||||
import uk.co.gresearch.siembol.common.constants.SiembolMessageFields;
|
||||
import uk.co.gresearch.siembol.common.model.ZookeeperAttributesDto;
|
||||
@@ -24,6 +25,7 @@ import uk.co.gresearch.siembol.common.model.AlertingStormAttributesDto;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
@@ -208,6 +210,6 @@ public class CorrelationEngineBoltTest {
|
||||
correlationAlertingEngineBolt.execute(tuple);
|
||||
}
|
||||
verify(collector, times(10)).ack(eq(tuple));
|
||||
verify(collector, never()).emit(any());
|
||||
verify(collector, never()).emit(ArgumentMatchers.<List<Object>>any());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<parent>
|
||||
<groupId>uk.co.gresearch.siembol</groupId>
|
||||
<artifactId>siembol</artifactId>
|
||||
<version>1.79-SNAPSHOT</version>
|
||||
<version>1.80-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modules>
|
||||
<module>alerting-core</module>
|
||||
@@ -21,19 +21,5 @@
|
||||
<dependencies>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.5.1</version>
|
||||
<configuration>
|
||||
<forceJavacCompilerUse>true</forceJavacCompilerUse>
|
||||
<source>${java_version}</source>
|
||||
<compilerArgument>-Xlint:unchecked</compilerArgument>
|
||||
<target>${java_version}</target>
|
||||
<showWarnings>true</showWarnings>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
||||
@@ -9,18 +9,18 @@
|
||||
<parent>
|
||||
<groupId>uk.co.gresearch.siembol</groupId>
|
||||
<artifactId>config-editor</artifactId>
|
||||
<version>1.79-SNAPSHOT</version>
|
||||
<version>1.80-SNAPSHOT</version>
|
||||
</parent>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>uk.co.gresearch.siembol</groupId>
|
||||
<artifactId>siembol-common</artifactId>
|
||||
<version>1.79-SNAPSHOT</version>
|
||||
<version>1.80-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<version>${commons_lang3_version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jgit</groupId>
|
||||
@@ -103,17 +103,5 @@
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.5.1</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
<compilerArgument>-Xlint:unchecked</compilerArgument>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package uk.co.gresearch.siembol.configeditor.common;
|
||||
|
||||
public class AuthorisationException extends RuntimeException {
|
||||
private static final long serialVersionUID = 1L;
|
||||
public AuthorisationException(String msg) {
|
||||
super(msg);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package uk.co.gresearch.siembol.configeditor.configstore;
|
||||
import org.eclipse.jgit.api.errors.GitAPIException;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.mockito.ArgumentMatchers;
|
||||
import org.mockito.Mockito;
|
||||
|
||||
import org.junit.Before;
|
||||
@@ -18,11 +19,10 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.ArgumentMatchers.*;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.verifyNoMoreInteractions;
|
||||
import static org.mockito.Mockito.when;
|
||||
import static org.mockito.internal.verification.VerificationModeFactory.times;
|
||||
import static uk.co.gresearch.siembol.configeditor.model.ConfigEditorResult.StatusCode.BAD_REQUEST;
|
||||
@@ -54,9 +54,9 @@ public class ConfigItemsTest {
|
||||
|
||||
configInfo.setName("test");
|
||||
configInfo.setVersion(1);
|
||||
when(configInfoProvider.getConfigInfo(any(), any())).thenReturn(configInfo);
|
||||
when(configInfoProvider.getConfigInfo(any(UserInfo.class), anyString())).thenReturn(configInfo);
|
||||
|
||||
when(configInfoProvider.isStoreFile(any())).thenReturn(true);
|
||||
when(configInfoProvider.isStoreFile(anyString())).thenReturn(true);
|
||||
when(configInfoProvider.getFileContentType()).thenReturn(ConfigEditorFile.ContentType.STRING);
|
||||
filesContent.put("File.json", "DUMMY_CONTENT");
|
||||
files = new ArrayList<>();
|
||||
@@ -67,7 +67,8 @@ public class ConfigItemsTest {
|
||||
attr.setFiles(files);
|
||||
getFilesResult = new ConfigEditorResult(OK, attr);
|
||||
|
||||
when(gitRepo.getFiles(eq(directory), any())).thenReturn(getFilesResult);
|
||||
when(gitRepo.getFiles(eq(directory), ArgumentMatchers.<Function<String, Boolean>>any()))
|
||||
.thenReturn(getFilesResult);
|
||||
when(gitRepo.getRepoUri()).thenReturn(dummyRepoUrl);
|
||||
when(gitRepo.getDirectoryUrl(eq(directory))).thenReturn(dummyDirectoryRepoUrl);
|
||||
|
||||
@@ -78,7 +79,10 @@ public class ConfigItemsTest {
|
||||
ConfigEditorAttributes attrTransact = new ConfigEditorAttributes();
|
||||
attrTransact.setFiles(transactFiles);
|
||||
transactGetFilesResult = new ConfigEditorResult(OK, attrTransact);
|
||||
when(gitRepo.transactCopyAndCommit(eq(configInfo), eq(directory), any())).thenReturn(transactGetFilesResult);
|
||||
when(gitRepo.transactCopyAndCommit(any(ConfigInfo.class),
|
||||
eq(directory),
|
||||
ArgumentMatchers.<Function<String, Boolean>>any()))
|
||||
.thenReturn(transactGetFilesResult);
|
||||
|
||||
configItems = new ConfigItems(gitRepo, configInfoProvider, directory);
|
||||
user = new UserInfo();
|
||||
@@ -103,7 +107,8 @@ public class ConfigItemsTest {
|
||||
@Test
|
||||
public void initOK() throws IOException, GitAPIException {
|
||||
configItems.init();
|
||||
verify(gitRepo, times(1)).getFiles(eq(directory), any());
|
||||
verify(gitRepo, times(1))
|
||||
.getFiles(eq(directory), ArgumentMatchers.<Function<String, Boolean>>any());
|
||||
ConfigEditorResult result = configItems.getFiles();
|
||||
Assert.assertEquals(OK, result.getStatusCode());
|
||||
Assert.assertNotNull(result.getAttributes().getFiles());
|
||||
|
||||
@@ -16,13 +16,11 @@ import java.util.concurrent.SynchronousQueue;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.Matchers.any;
|
||||
import static org.mockito.ArgumentMatchers.*;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
import static org.springframework.boot.actuate.health.Status.DOWN;
|
||||
import static org.springframework.boot.actuate.health.Status.UP;
|
||||
import static uk.co.gresearch.siembol.configeditor.model.ConfigEditorResult.StatusCode.BAD_REQUEST;
|
||||
import static uk.co.gresearch.siembol.configeditor.model.ConfigEditorResult.StatusCode.ERROR;
|
||||
import static uk.co.gresearch.siembol.configeditor.model.ConfigEditorResult.StatusCode.OK;
|
||||
|
||||
@@ -159,7 +157,7 @@ public class ConfigStoreImplTest {
|
||||
|
||||
@Test
|
||||
public void checkHealthDown() throws Exception {
|
||||
when(configs.addConfigItem(any(), any())).thenThrow(new IllegalStateException("exception"));
|
||||
when(configs.addConfigItem(any(UserInfo.class), anyString())).thenThrow(new IllegalStateException("exception"));
|
||||
ConfigEditorResult ret = configStore.addConfig(user, "dummy");
|
||||
Assert.assertEquals(ERROR, ret.getStatusCode());
|
||||
Assert.assertNotNull(ret.getAttributes().getException());
|
||||
|
||||
@@ -17,8 +17,7 @@ import uk.co.gresearch.siembol.configeditor.model.ConfigEditorService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.ArgumentMatchers.*;
|
||||
import static org.mockito.Mockito.when;
|
||||
import static org.mockito.internal.verification.VerificationModeFactory.times;
|
||||
|
||||
@@ -40,7 +39,7 @@ public class ServiceAggregatorImplTest {
|
||||
when(schemaService.getAdminConfigurationSchema()).thenReturn(
|
||||
new ConfigEditorResult(ConfigEditorResult.StatusCode.OK, new ConfigEditorAttributes()));
|
||||
builder = new ServiceAggregatorImpl.Builder(authProvider);
|
||||
when(authProvider.getUserAuthorisation(any(), any()))
|
||||
when(authProvider.getUserAuthorisation(any(UserInfo.class), anyString()))
|
||||
.thenReturn(AuthorisationProvider.AuthorisationResult.ALLOWED);
|
||||
builder.addService("a", serviceType, store, schemaService);
|
||||
builder.addService("b", serviceType, store, schemaService);
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<parent>
|
||||
<groupId>uk.co.gresearch.siembol</groupId>
|
||||
<artifactId>config-editor</artifactId>
|
||||
<version>1.79-SNAPSHOT</version>
|
||||
<version>1.80-SNAPSHOT</version>
|
||||
</parent>
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
@@ -51,7 +51,7 @@
|
||||
<dependency>
|
||||
<groupId>uk.co.gresearch.siembol</groupId>
|
||||
<artifactId>siembol-common</artifactId>
|
||||
<version>1.79-SNAPSHOT</version>
|
||||
<version>1.80-SNAPSHOT</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.slf4j</groupId>
|
||||
@@ -62,22 +62,22 @@
|
||||
<dependency>
|
||||
<groupId>uk.co.gresearch.siembol</groupId>
|
||||
<artifactId>config-editor-core</artifactId>
|
||||
<version>1.79-SNAPSHOT</version>
|
||||
<version>1.80-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>uk.co.gresearch.siembol</groupId>
|
||||
<artifactId>config-editor-services</artifactId>
|
||||
<version>1.79-SNAPSHOT</version>
|
||||
<version>1.80-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>uk.co.gresearch.siembol</groupId>
|
||||
<artifactId>config-editor-sync</artifactId>
|
||||
<version>1.79-SNAPSHOT</version>
|
||||
<version>1.80-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>uk.co.gresearch.siembol</groupId>
|
||||
<artifactId>alerting-core</artifactId>
|
||||
<version>1.79-SNAPSHOT</version>
|
||||
<version>1.80-SNAPSHOT</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.slf4j</groupId>
|
||||
@@ -88,7 +88,7 @@
|
||||
<dependency>
|
||||
<groupId>uk.co.gresearch.siembol</groupId>
|
||||
<artifactId>parsing-app</artifactId>
|
||||
<version>1.79-SNAPSHOT</version>
|
||||
<version>1.80-SNAPSHOT</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.slf4j</groupId>
|
||||
@@ -99,7 +99,7 @@
|
||||
<dependency>
|
||||
<groupId>uk.co.gresearch.siembol</groupId>
|
||||
<artifactId>enriching-core</artifactId>
|
||||
<version>1.79-SNAPSHOT</version>
|
||||
<version>1.80-SNAPSHOT</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.slf4j</groupId>
|
||||
@@ -110,7 +110,7 @@
|
||||
<dependency>
|
||||
<groupId>uk.co.gresearch.siembol</groupId>
|
||||
<artifactId>responding-core</artifactId>
|
||||
<version>1.79-SNAPSHOT</version>
|
||||
<version>1.80-SNAPSHOT</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.slf4j</groupId>
|
||||
@@ -209,20 +209,6 @@
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.5.1</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
<compilerArgument>-Xlint:unchecked</compilerArgument>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.12.4</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
||||
@@ -9,6 +9,7 @@ import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.util.ResourceUtils;
|
||||
import uk.co.gresearch.siembol.common.testing.TestingZookeeperConnectorFactory;
|
||||
import uk.co.gresearch.siembol.common.zookeper.ZookeeperConnectorFactory;
|
||||
import uk.co.gresearch.siembol.common.zookeper.ZookeeperConnectorFactoryImpl;
|
||||
import uk.co.gresearch.siembol.configeditor.common.AuthorisationProvider;
|
||||
import uk.co.gresearch.siembol.configeditor.common.ConfigEditorUtils;
|
||||
import uk.co.gresearch.siembol.configeditor.common.ConfigSchemaService;
|
||||
@@ -110,7 +111,7 @@ public class ConfigEditorConfiguration implements DisposableBean {
|
||||
@ConditionalOnProperty(prefix = "config-editor", value = "synchronisation")
|
||||
ZookeeperConnectorFactory zookeeperConnectorFactory() throws Exception {
|
||||
if (properties.getTestingZookeeperFiles() == null) {
|
||||
return new ZookeeperConnectorFactory() {};
|
||||
return new ZookeeperConnectorFactoryImpl();
|
||||
}
|
||||
|
||||
TestingZookeeperConnectorFactory ret = new TestingZookeeperConnectorFactory();
|
||||
|
||||
@@ -10,53 +10,53 @@
|
||||
<parent>
|
||||
<groupId>uk.co.gresearch.siembol</groupId>
|
||||
<artifactId>config-editor</artifactId>
|
||||
<version>1.79-SNAPSHOT</version>
|
||||
<version>1.80-SNAPSHOT</version>
|
||||
</parent>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>uk.co.gresearch.siembol</groupId>
|
||||
<artifactId>siembol-common</artifactId>
|
||||
<version>1.79-SNAPSHOT</version>
|
||||
<version>1.80-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>uk.co.gresearch.siembol</groupId>
|
||||
<artifactId>config-editor-core</artifactId>
|
||||
<version>1.79-SNAPSHOT</version>
|
||||
<version>1.80-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>uk.co.gresearch.siembol</groupId>
|
||||
<artifactId>alerting-core</artifactId>
|
||||
<version>1.79-SNAPSHOT</version>
|
||||
<version>1.80-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>uk.co.gresearch.siembol</groupId>
|
||||
<artifactId>alerting-storm</artifactId>
|
||||
<version>1.79-SNAPSHOT</version>
|
||||
<version>1.80-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>uk.co.gresearch.siembol</groupId>
|
||||
<artifactId>parsing-storm</artifactId>
|
||||
<version>1.79-SNAPSHOT</version>
|
||||
<version>1.80-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>uk.co.gresearch.siembol</groupId>
|
||||
<artifactId>enriching-storm</artifactId>
|
||||
<version>1.79-SNAPSHOT</version>
|
||||
<version>1.80-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>uk.co.gresearch.siembol</groupId>
|
||||
<artifactId>parsing-app</artifactId>
|
||||
<version>1.79-SNAPSHOT</version>
|
||||
<version>1.80-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>uk.co.gresearch.siembol</groupId>
|
||||
<artifactId>enriching-core</artifactId>
|
||||
<version>1.79-SNAPSHOT</version>
|
||||
<version>1.80-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>uk.co.gresearch.siembol</groupId>
|
||||
<artifactId>responding-core</artifactId>
|
||||
<version>1.79-SNAPSHOT</version>
|
||||
<version>1.80-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
@@ -78,17 +78,5 @@
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.5.1</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
<compilerArgument>-Xlint:unchecked</compilerArgument>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
||||
@@ -14,10 +14,8 @@ import uk.co.gresearch.siembol.alerts.common.AlertingResult;
|
||||
import uk.co.gresearch.siembol.alerts.compiler.AlertingCompiler;
|
||||
import uk.co.gresearch.siembol.configeditor.service.common.ConfigSchemaServiceContext;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.anyString;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.Matchers.any;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
import static org.mockito.internal.verification.VerificationModeFactory.times;
|
||||
@@ -71,8 +69,8 @@ public class AlertingRuleSchemaServiceTest {
|
||||
|
||||
alertingAttributes = new AlertingAttributes();
|
||||
alertingResult = new AlertingResult(AlertingResult.StatusCode.OK, alertingAttributes);
|
||||
Mockito.when(alertingCompiler.validateRules(any())).thenReturn(alertingResult);
|
||||
Mockito.when(alertingCompiler.validateRule(any())).thenReturn(alertingResult);
|
||||
Mockito.when(alertingCompiler.validateRules(anyString())).thenReturn(alertingResult);
|
||||
Mockito.when(alertingCompiler.validateRule(anyString())).thenReturn(alertingResult);
|
||||
Mockito.when(alertingCompiler.testRule(testRule, testEvent.trim())).thenReturn(alertingResult);
|
||||
Mockito.when(alertingCompiler.testRule(testRules, testEvent.trim())).thenReturn(alertingResult);
|
||||
}
|
||||
@@ -140,7 +138,7 @@ public class AlertingRuleSchemaServiceTest {
|
||||
alertingAttributes.setMessage("error");
|
||||
alertingAttributes.setException("exception");
|
||||
alertingResult = new AlertingResult(AlertingResult.StatusCode.ERROR, alertingAttributes);
|
||||
Mockito.when(alertingCompiler.validateRules(any())).thenReturn(alertingResult);
|
||||
Mockito.when(alertingCompiler.validateRules(anyString())).thenReturn(alertingResult);
|
||||
ConfigEditorResult ret = alertingRuleSchemaService.validateConfigurations(testRules);
|
||||
verify(alertingCompiler, times(1)).validateRules(testRules);
|
||||
Assert.assertEquals(ConfigEditorResult.StatusCode.ERROR, ret.getStatusCode());
|
||||
@@ -153,7 +151,7 @@ public class AlertingRuleSchemaServiceTest {
|
||||
alertingAttributes.setMessage("error");
|
||||
alertingAttributes.setException("exception");
|
||||
alertingResult = new AlertingResult(AlertingResult.StatusCode.ERROR, alertingAttributes);
|
||||
Mockito.when(alertingCompiler.validateRule(any())).thenReturn(alertingResult);
|
||||
Mockito.when(alertingCompiler.validateRule(anyString())).thenReturn(alertingResult);
|
||||
ConfigEditorResult ret = alertingRuleSchemaService.validateConfiguration(testRule);
|
||||
verify(alertingCompiler, times(1)).validateRule(testRule);
|
||||
Assert.assertEquals(ConfigEditorResult.StatusCode.ERROR, ret.getStatusCode());
|
||||
|
||||
@@ -16,8 +16,8 @@ import uk.co.gresearch.siembol.enrichments.common.EnrichmentAttributes;
|
||||
import uk.co.gresearch.siembol.enrichments.common.EnrichmentResult;
|
||||
import uk.co.gresearch.siembol.enrichments.compiler.EnrichmentCompiler;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.anyString;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.Matchers.any;
|
||||
import static org.mockito.Mockito.times;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
@@ -60,12 +60,12 @@ public class EnrichmentSchemaServiceTest {
|
||||
this.enrichmentsSchemaService = new EnrichmentSchemaService(compiler, context);
|
||||
enrichmentAttributes = new EnrichmentAttributes();
|
||||
enrichmentResult = new EnrichmentResult(OK, enrichmentAttributes);
|
||||
Mockito.when(compiler.compile(any())).thenReturn(enrichmentResult);
|
||||
Mockito.when(compiler.compile(anyString())).thenReturn(enrichmentResult);
|
||||
|
||||
Mockito.when(compiler.validateConfiguration(any())).thenReturn(enrichmentResult);
|
||||
Mockito.when(compiler.validateConfigurations(any())).thenReturn(enrichmentResult);
|
||||
Mockito.when(compiler.testConfiguration(any(), any())).thenReturn(enrichmentResult);
|
||||
Mockito.when(compiler.testConfigurations(any(), any())).thenReturn(enrichmentResult);
|
||||
Mockito.when(compiler.validateConfiguration(anyString())).thenReturn(enrichmentResult);
|
||||
Mockito.when(compiler.validateConfigurations(anyString())).thenReturn(enrichmentResult);
|
||||
Mockito.when(compiler.testConfiguration(anyString(), anyString())).thenReturn(enrichmentResult);
|
||||
Mockito.when(compiler.testConfigurations(anyString(), anyString())).thenReturn(enrichmentResult);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -100,7 +100,7 @@ public class EnrichmentSchemaServiceTest {
|
||||
public void validateConfigurationsError() {
|
||||
enrichmentAttributes.setMessage("error");
|
||||
enrichmentResult = new EnrichmentResult(ERROR, enrichmentAttributes);
|
||||
Mockito.when(compiler.validateConfigurations(any())).thenReturn(enrichmentResult);
|
||||
Mockito.when(compiler.validateConfigurations(anyString())).thenReturn(enrichmentResult);
|
||||
ConfigEditorResult ret = enrichmentsSchemaService.validateConfigurations(testConfigs);
|
||||
Mockito.verify(compiler, times(1)).validateConfigurations(testConfigs);
|
||||
Assert.assertEquals(ConfigEditorResult.StatusCode.ERROR, ret.getStatusCode());
|
||||
@@ -111,7 +111,7 @@ public class EnrichmentSchemaServiceTest {
|
||||
public void validateConfigurationError() {
|
||||
enrichmentAttributes.setMessage("error");
|
||||
enrichmentResult = new EnrichmentResult(ERROR, enrichmentAttributes);
|
||||
Mockito.when(compiler.validateConfiguration(any())).thenReturn(enrichmentResult);
|
||||
Mockito.when(compiler.validateConfiguration(anyString())).thenReturn(enrichmentResult);
|
||||
ConfigEditorResult ret = enrichmentsSchemaService.validateConfiguration(testConfigs);
|
||||
Mockito.verify(compiler, times(1)).validateConfiguration(testConfigs);
|
||||
Assert.assertEquals(ConfigEditorResult.StatusCode.ERROR, ret.getStatusCode());
|
||||
@@ -122,7 +122,7 @@ public class EnrichmentSchemaServiceTest {
|
||||
public void testConfigurationOK() {
|
||||
enrichmentAttributes.setTestResult(testResult);
|
||||
enrichmentAttributes.setTestRawResult(testRawResult);
|
||||
Mockito.when(compiler.testConfiguration(any(), any())).thenReturn(enrichmentResult);
|
||||
Mockito.when(compiler.testConfiguration(anyString(), anyString())).thenReturn(enrichmentResult);
|
||||
ConfigEditorResult ret = enrichmentsSchemaService.testConfiguration(testConfig, testSpecification);
|
||||
Mockito.verify(compiler, times(1)).testConfiguration(testConfig, testSpecification);
|
||||
Assert.assertEquals(ConfigEditorResult.StatusCode.OK, ret.getStatusCode());
|
||||
@@ -136,7 +136,7 @@ public class EnrichmentSchemaServiceTest {
|
||||
public void testConfigurationsOK() {
|
||||
enrichmentAttributes.setTestResult(testResult);
|
||||
enrichmentAttributes.setTestRawResult(testRawResult);
|
||||
Mockito.when(compiler.testConfiguration(any(), any())).thenReturn(enrichmentResult);
|
||||
Mockito.when(compiler.testConfiguration(anyString(), anyString())).thenReturn(enrichmentResult);
|
||||
ConfigEditorResult ret = enrichmentsSchemaService.testConfigurations(testConfigs, testSpecification);
|
||||
Mockito.verify(compiler, times(1)).testConfigurations(testConfigs, testSpecification);
|
||||
Assert.assertEquals(ConfigEditorResult.StatusCode.OK, ret.getStatusCode());
|
||||
@@ -150,7 +150,7 @@ public class EnrichmentSchemaServiceTest {
|
||||
public void testConfigurationError() {
|
||||
enrichmentAttributes.setMessage("error");
|
||||
enrichmentResult = new EnrichmentResult(ERROR, enrichmentAttributes);
|
||||
Mockito.when(compiler.testConfiguration(any(), any())).thenReturn(enrichmentResult);
|
||||
Mockito.when(compiler.testConfiguration(anyString(), anyString())).thenReturn(enrichmentResult);
|
||||
ConfigEditorResult ret = enrichmentsSchemaService.testConfiguration(testConfig, testSpecification);
|
||||
Mockito.verify(compiler, times(1)).testConfiguration(testConfig, testSpecification);
|
||||
Assert.assertEquals(ConfigEditorResult.StatusCode.ERROR, ret.getStatusCode());
|
||||
@@ -161,7 +161,7 @@ public class EnrichmentSchemaServiceTest {
|
||||
public void testConfigurationsError() {
|
||||
enrichmentAttributes.setMessage("error");
|
||||
enrichmentResult = new EnrichmentResult(ERROR, enrichmentAttributes);
|
||||
Mockito.when(compiler.testConfigurations(any(), any())).thenReturn(enrichmentResult);
|
||||
Mockito.when(compiler.testConfigurations(anyString(), anyString())).thenReturn(enrichmentResult);
|
||||
ConfigEditorResult ret = enrichmentsSchemaService.testConfigurations(testConfigs, testSpecification);
|
||||
Mockito.verify(compiler, times(1)).testConfigurations(testConfigs, testSpecification);
|
||||
Assert.assertEquals(ConfigEditorResult.StatusCode.ERROR, ret.getStatusCode());
|
||||
|
||||
@@ -4,6 +4,7 @@ import org.adrianwalker.multilinestring.Multiline;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.mockito.ArgumentMatchers;
|
||||
import org.mockito.Mockito;
|
||||
import uk.co.gresearch.siembol.configeditor.common.ConfigSchemaService;
|
||||
import uk.co.gresearch.siembol.configeditor.model.ConfigEditorResult;
|
||||
@@ -16,7 +17,8 @@ import uk.co.gresearch.siembol.parsers.factory.ParserFactoryResult;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import static org.mockito.Matchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyString;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.Mockito.times;
|
||||
|
||||
public class ParserConfigSchemaServiceTest {
|
||||
@@ -62,11 +64,11 @@ public class ParserConfigSchemaServiceTest {
|
||||
parserFactoryAttributes = new ParserFactoryAttributes();
|
||||
parserFactoryResult = new ParserFactoryResult(ParserFactoryResult.StatusCode.OK, parserFactoryAttributes);
|
||||
parserResult = new ParserResult();
|
||||
Mockito.when(parserFactory.create(any())).thenReturn(parserFactoryResult);
|
||||
Mockito.when(parserFactory.create(anyString())).thenReturn(parserFactoryResult);
|
||||
|
||||
Mockito.when(parserFactory.validateConfiguration(any())).thenReturn(parserFactoryResult);
|
||||
Mockito.when(parserFactory.validateConfigurations(any())).thenReturn(parserFactoryResult);
|
||||
Mockito.when(parserFactory.test(any(), any(), any())).thenReturn(parserFactoryResult);
|
||||
Mockito.when(parserFactory.validateConfiguration(anyString())).thenReturn(parserFactoryResult);
|
||||
Mockito.when(parserFactory.validateConfigurations(anyString())).thenReturn(parserFactoryResult);
|
||||
Mockito.when(parserFactory.test(anyString(), eq(null), ArgumentMatchers.<byte[]>any())).thenReturn(parserFactoryResult);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -108,7 +110,7 @@ public class ParserConfigSchemaServiceTest {
|
||||
public void validateRulesError() {
|
||||
parserFactoryAttributes.setMessage("error");
|
||||
parserFactoryResult = new ParserFactoryResult(ParserFactoryResult.StatusCode.ERROR, parserFactoryAttributes);
|
||||
Mockito.when(parserFactory.validateConfigurations(any())).thenReturn(parserFactoryResult);
|
||||
Mockito.when(parserFactory.validateConfigurations(anyString())).thenReturn(parserFactoryResult);
|
||||
ConfigEditorResult ret = parserConfigSchemaService.validateConfigurations(testConfigs);
|
||||
Mockito.verify(parserFactory, times(1)).validateConfigurations(testConfigs);
|
||||
Assert.assertEquals(ConfigEditorResult.StatusCode.ERROR, ret.getStatusCode());
|
||||
@@ -120,7 +122,7 @@ public class ParserConfigSchemaServiceTest {
|
||||
parserFactoryAttributes.setMessage("error");
|
||||
|
||||
parserFactoryResult = new ParserFactoryResult(ParserFactoryResult.StatusCode.ERROR, parserFactoryAttributes);
|
||||
Mockito.when(parserFactory.validateConfiguration(any())).thenReturn(parserFactoryResult);
|
||||
Mockito.when(parserFactory.validateConfiguration(anyString())).thenReturn(parserFactoryResult);
|
||||
ConfigEditorResult ret = parserConfigSchemaService.validateConfiguration(testConfig);
|
||||
Mockito.verify(parserFactory, times(1)).validateConfiguration(testConfig);
|
||||
Assert.assertEquals(ConfigEditorResult.StatusCode.ERROR, ret.getStatusCode());
|
||||
|
||||
@@ -15,8 +15,8 @@ import uk.co.gresearch.siembol.parsers.application.factory.ParsingApplicationFac
|
||||
import uk.co.gresearch.siembol.parsers.application.factory.ParsingApplicationFactoryResult;
|
||||
import uk.co.gresearch.siembol.parsers.common.ParserResult;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.anyString;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.Matchers.any;
|
||||
import static org.mockito.Mockito.times;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
@@ -53,8 +53,8 @@ public class ParsingAppConfigSchemaServiceTest {
|
||||
factoryAttributes = new ParsingApplicationFactoryAttributes();
|
||||
factoryResult = new ParsingApplicationFactoryResult(OK, factoryAttributes);
|
||||
parsingAppResult = new ParserResult();
|
||||
Mockito.when(parsingAppFactory.validateConfiguration(any())).thenReturn(factoryResult);
|
||||
Mockito.when(parsingAppFactory.validateConfigurations(any())).thenReturn(factoryResult);
|
||||
Mockito.when(parsingAppFactory.validateConfiguration(anyString())).thenReturn(factoryResult);
|
||||
Mockito.when(parsingAppFactory.validateConfigurations(anyString())).thenReturn(factoryResult);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -90,7 +90,7 @@ public class ParsingAppConfigSchemaServiceTest {
|
||||
public void validateConfigsError() {
|
||||
factoryAttributes.setMessage("error");
|
||||
factoryResult = new ParsingApplicationFactoryResult(ERROR, factoryAttributes);
|
||||
Mockito.when(parsingAppFactory.validateConfigurations(any())).thenReturn(factoryResult);
|
||||
Mockito.when(parsingAppFactory.validateConfigurations(anyString())).thenReturn(factoryResult);
|
||||
ConfigEditorResult ret = parserConfigSchemaService.validateConfigurations(testConfigs);
|
||||
Mockito.verify(parsingAppFactory, times(1)).validateConfigurations(testConfigs);
|
||||
Assert.assertEquals(ConfigEditorResult.StatusCode.ERROR, ret.getStatusCode());
|
||||
@@ -101,7 +101,7 @@ public class ParsingAppConfigSchemaServiceTest {
|
||||
public void validateCongfigError() {
|
||||
factoryAttributes.setMessage("error");
|
||||
factoryResult = new ParsingApplicationFactoryResult(ERROR, factoryAttributes);
|
||||
Mockito.when(parsingAppFactory.validateConfiguration(any())).thenReturn(factoryResult);
|
||||
Mockito.when(parsingAppFactory.validateConfiguration(anyString())).thenReturn(factoryResult);
|
||||
ConfigEditorResult ret = parserConfigSchemaService.validateConfiguration(testConfig);
|
||||
Mockito.verify(parsingAppFactory, times(1)).validateConfiguration(testConfig);
|
||||
Assert.assertEquals(ConfigEditorResult.StatusCode.ERROR, ret.getStatusCode());
|
||||
|
||||
@@ -12,8 +12,7 @@ import uk.co.gresearch.siembol.response.common.ResponseApplicationPaths;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.ArgumentMatchers.*;
|
||||
import static uk.co.gresearch.siembol.configeditor.model.ConfigEditorResult.StatusCode.BAD_REQUEST;
|
||||
import static uk.co.gresearch.siembol.configeditor.model.ConfigEditorResult.StatusCode.ERROR;
|
||||
import static uk.co.gresearch.siembol.configeditor.model.ConfigEditorResult.StatusCode.OK;
|
||||
@@ -210,9 +209,9 @@ public class ResponseSchemaServiceTest {
|
||||
.thenReturn(rulesSchema);
|
||||
Mockito.when(httpProvider.get(eq(ResponseApplicationPaths.GET_TEST_SCHEMA.toString())))
|
||||
.thenReturn(testSchema);
|
||||
Mockito.when(httpProvider.post(eq(ResponseApplicationPaths.VALIDATE_RULES.toString()), any()))
|
||||
Mockito.when(httpProvider.post(eq(ResponseApplicationPaths.VALIDATE_RULES.toString()), anyString()))
|
||||
.thenReturn(okMessage);
|
||||
Mockito.when(httpProvider.post(eq(ResponseApplicationPaths.TEST_RULES.toString()), any()))
|
||||
Mockito.when(httpProvider.post(eq(ResponseApplicationPaths.TEST_RULES.toString()), anyString()))
|
||||
.thenReturn(okMessage);
|
||||
|
||||
builder = new ResponseSchemaService.Builder(httpProvider);
|
||||
@@ -270,7 +269,7 @@ public class ResponseSchemaServiceTest {
|
||||
|
||||
@Test
|
||||
public void validateRulesError() throws Exception {
|
||||
Mockito.when(httpProvider.post(eq(ResponseApplicationPaths.VALIDATE_RULES.toString()), any()))
|
||||
Mockito.when(httpProvider.post(eq(ResponseApplicationPaths.VALIDATE_RULES.toString()), anyString()))
|
||||
.thenReturn(errorMessage);
|
||||
responseSchemaService = builder.build();
|
||||
ConfigEditorResult result = responseSchemaService.validateConfigurations(dummyJsonObject);
|
||||
@@ -279,7 +278,7 @@ public class ResponseSchemaServiceTest {
|
||||
|
||||
@Test
|
||||
public void validateRulesException() throws Exception {
|
||||
Mockito.when(httpProvider.post(eq(ResponseApplicationPaths.VALIDATE_RULES.toString()), any()))
|
||||
Mockito.when(httpProvider.post(eq(ResponseApplicationPaths.VALIDATE_RULES.toString()), anyString()))
|
||||
.thenThrow(new IOException());
|
||||
responseSchemaService = builder.build();
|
||||
ConfigEditorResult result = responseSchemaService.validateConfigurations(dummyJsonObject);
|
||||
@@ -295,7 +294,7 @@ public class ResponseSchemaServiceTest {
|
||||
|
||||
@Test
|
||||
public void validateRuleError() throws Exception {
|
||||
Mockito.when(httpProvider.post(eq(ResponseApplicationPaths.VALIDATE_RULES.toString()), any()))
|
||||
Mockito.when(httpProvider.post(eq(ResponseApplicationPaths.VALIDATE_RULES.toString()), anyString()))
|
||||
.thenReturn(errorMessage);
|
||||
responseSchemaService = builder.build();
|
||||
ConfigEditorResult result = responseSchemaService.validateConfiguration(dummyJsonObject);
|
||||
|
||||
@@ -9,28 +9,28 @@
|
||||
<parent>
|
||||
<groupId>uk.co.gresearch.siembol</groupId>
|
||||
<artifactId>config-editor</artifactId>
|
||||
<version>1.79-SNAPSHOT</version>
|
||||
<version>1.80-SNAPSHOT</version>
|
||||
</parent>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<version>${commons_lang3_version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>uk.co.gresearch.siembol</groupId>
|
||||
<artifactId>siembol-common</artifactId>
|
||||
<version>1.79-SNAPSHOT</version>
|
||||
<version>1.80-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>uk.co.gresearch.siembol</groupId>
|
||||
<artifactId>config-editor-core</artifactId>
|
||||
<version>1.79-SNAPSHOT</version>
|
||||
<version>1.80-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>uk.co.gresearch.siembol</groupId>
|
||||
<artifactId>parsing-app</artifactId>
|
||||
<version>1.79-SNAPSHOT</version>
|
||||
<version>1.80-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
@@ -85,12 +85,6 @@
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<version>1.7.21</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
<version>1.7.25</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
@@ -111,17 +105,5 @@
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.5.1</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
<compilerArgument>-Xlint:unchecked</compilerArgument>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<parent>
|
||||
<groupId>uk.co.gresearch.siembol</groupId>
|
||||
<artifactId>siembol</artifactId>
|
||||
<version>1.79-SNAPSHOT</version>
|
||||
<version>1.80-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modules>
|
||||
<module>config-editor-core</module>
|
||||
@@ -22,19 +22,5 @@
|
||||
<dependencies>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.5.1</version>
|
||||
<configuration>
|
||||
<forceJavacCompilerUse>true</forceJavacCompilerUse>
|
||||
<source>${java_version}</source>
|
||||
<compilerArgument>-Xlint:unchecked</compilerArgument>
|
||||
<target>${java_version}</target>
|
||||
<showWarnings>true</showWarnings>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<parent>
|
||||
<groupId>uk.co.gresearch.siembol</groupId>
|
||||
<artifactId>siembol</artifactId>
|
||||
<version>1.79-SNAPSHOT</version>
|
||||
<version>1.80-SNAPSHOT</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
<dependencyManagement>
|
||||
@@ -29,10 +29,16 @@
|
||||
<artifactId>spring-boot-starter-logging</artifactId>
|
||||
<version>${spring_boot_version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
<version>${http_client_version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>uk.co.gresearch.siembol</groupId>
|
||||
<artifactId>siembol-common</artifactId>
|
||||
<version>1.79-SNAPSHOT</version>
|
||||
<version>1.80-SNAPSHOT</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.slf4j</groupId>
|
||||
@@ -172,20 +178,6 @@
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.5.1</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
<compilerArgument>-Xlint:unchecked</compilerArgument>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.12.4</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -7,6 +7,7 @@ import org.springframework.context.annotation.Configuration;
|
||||
import uk.co.gresearch.siembol.common.utils.HttpProvider;
|
||||
import uk.co.gresearch.siembol.common.zookeper.ZookeeperConnector;
|
||||
import uk.co.gresearch.siembol.common.zookeper.ZookeeperConnectorFactory;
|
||||
import uk.co.gresearch.siembol.common.zookeper.ZookeeperConnectorFactoryImpl;
|
||||
import uk.co.gresearch.siembol.deployment.storm.providers.KubernetesProvider;
|
||||
import uk.co.gresearch.siembol.deployment.storm.providers.KubernetesProviderImpl;
|
||||
import uk.co.gresearch.siembol.deployment.storm.providers.StormProvider;
|
||||
@@ -40,13 +41,13 @@ class TopologyManagerConfiguration {
|
||||
|
||||
@Bean
|
||||
ZookeeperConnector desiredStateZkConnector() throws Exception {
|
||||
ZookeeperConnectorFactory factory = new ZookeeperConnectorFactory(){};
|
||||
ZookeeperConnectorFactory factory = new ZookeeperConnectorFactoryImpl();
|
||||
return factory.createZookeeperConnector(properties.getDesiredState());
|
||||
}
|
||||
|
||||
@Bean
|
||||
ZookeeperConnector savedStateZkConnector() throws Exception {
|
||||
ZookeeperConnectorFactory factory = new ZookeeperConnectorFactory() {};
|
||||
ZookeeperConnectorFactory factory = new ZookeeperConnectorFactoryImpl();
|
||||
return factory.createZookeeperConnector(properties.getSavedState());
|
||||
}
|
||||
|
||||
|
||||
@@ -11,18 +11,36 @@
|
||||
<parent>
|
||||
<groupId>uk.co.gresearch.siembol</groupId>
|
||||
<artifactId>enriching</artifactId>
|
||||
<version>1.79-SNAPSHOT</version>
|
||||
<version>1.80-SNAPSHOT</version>
|
||||
</parent>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-core</artifactId>
|
||||
<version>${jackson_version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-annotations</artifactId>
|
||||
<version>${jackson_version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>${jackson_version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>uk.co.gresearch.siembol</groupId>
|
||||
<artifactId>siembol-common</artifactId>
|
||||
<version>1.79-SNAPSHOT</version>
|
||||
<version>1.80-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>uk.co.gresearch.siembol</groupId>
|
||||
<artifactId>alerting-core</artifactId>
|
||||
<version>1.79-SNAPSHOT</version>
|
||||
<version>1.80-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.adrianwalker</groupId>
|
||||
@@ -39,7 +57,7 @@
|
||||
<dependency>
|
||||
<groupId>com.github.java-json-tools</groupId>
|
||||
<artifactId>json-schema-core</artifactId>
|
||||
<version>1.2.10</version>
|
||||
<version>${json_schema_core_version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
@@ -55,12 +73,13 @@
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
<version>1.7.25</version>
|
||||
<version>${slf4j_version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.17</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
@@ -70,20 +89,6 @@
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.5.1</version>
|
||||
<configuration>
|
||||
<forceJavacCompilerUse>true</forceJavacCompilerUse>
|
||||
<source>${java_version}</source>
|
||||
<compilerArgument>-Xlint:unchecked</compilerArgument>
|
||||
<target>${java_version}</target>
|
||||
<showWarnings>true</showWarnings>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class EnrichmentCommand implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private String tableName;
|
||||
private String key;
|
||||
private ArrayList<Pair<String, String>> tags;
|
||||
|
||||
@@ -7,10 +7,12 @@ import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.Serializable;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class EnrichmentMemoryTable implements EnrichmentTable {
|
||||
public class EnrichmentMemoryTable implements EnrichmentTable, Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final String INVALID_JSON_TABLE_OBJECT = "Json table should be a json object";
|
||||
private static final String INVALID_JSON_TABLE_FIELD_MSG = "Invalid json table field: %s key: %s, " +
|
||||
"only strings fields are supported ";
|
||||
|
||||
@@ -9,7 +9,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
public interface EnrichmentTable extends Serializable {
|
||||
public interface EnrichmentTable {
|
||||
|
||||
boolean containsKey(String key);
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.mockito.ArgumentMatchers;
|
||||
import org.mockito.Mockito;
|
||||
import uk.co.gresearch.siembol.enrichments.common.EnrichmentCommand;
|
||||
import uk.co.gresearch.siembol.alerts.common.EvaluationResult;
|
||||
@@ -17,6 +18,7 @@ import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyMap;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
public class EnrichingRuleTest {
|
||||
@@ -39,7 +41,7 @@ public class EnrichingRuleTest {
|
||||
enrichmentTags.add(Pair.of("is_test", "true"));
|
||||
matcher = Mockito.mock(RuleMatcher.class);
|
||||
event = new HashMap<>();
|
||||
when(matcher.match(any())).thenReturn(EvaluationResult.MATCH);
|
||||
when(matcher.match(ArgumentMatchers.<Map<String, Object>>any())).thenReturn(EvaluationResult.MATCH);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -9,9 +9,24 @@
|
||||
<parent>
|
||||
<groupId>uk.co.gresearch.siembol</groupId>
|
||||
<artifactId>enriching</artifactId>
|
||||
<version>1.79-SNAPSHOT</version>
|
||||
<version>1.80-SNAPSHOT</version>
|
||||
</parent>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-core</artifactId>
|
||||
<version>${jackson_version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-annotations</artifactId>
|
||||
<version>${jackson_version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>${jackson_version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.kafka</groupId>
|
||||
<artifactId>kafka_2.11</artifactId>
|
||||
@@ -28,21 +43,6 @@
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>uk.co.gresearch.siembol</groupId>
|
||||
<artifactId>enriching-core</artifactId>
|
||||
<version>1.79-SNAPSHOT</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.kafka</groupId>
|
||||
<artifactId>kafka-clients</artifactId>
|
||||
@@ -59,6 +59,21 @@
|
||||
<version>${storm_version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>uk.co.gresearch.siembol</groupId>
|
||||
<artifactId>enriching-core</artifactId>
|
||||
<version>1.80-SNAPSHOT</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
@@ -102,6 +117,24 @@
|
||||
<groupId>org.apache.hadoop</groupId>
|
||||
<artifactId>hadoop-common</artifactId>
|
||||
<version>${hadoop_version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>com.fasterxml.woodstox</groupId>
|
||||
<artifactId>woodstox-core</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.codehaus.woodstox</groupId>
|
||||
<artifactId>stax2-api</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.apache.htrace</groupId>
|
||||
<artifactId>htrace-core4</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
@@ -142,13 +175,34 @@
|
||||
<filter>
|
||||
<artifact>*:*</artifact>
|
||||
<excludes>
|
||||
<exclude>module-info.class</exclude>
|
||||
<exclude>META-INF/*.SF</exclude>
|
||||
<exclude>META-INF/*.DSA</exclude>
|
||||
<exclude>META-INF/*.RSA</exclude>
|
||||
<exclude>META-INF/*.MF</exclude>
|
||||
<exclude>META-INF/*.txt</exclude>
|
||||
<exclude>META-INF/*/schema</exclude>
|
||||
<exclude>META-INF/LICENSE</exclude>
|
||||
<exclude>META-INF/NOTICE</exclude>
|
||||
<exclude>META-INF/DEPENDENCIES</exclude>
|
||||
<exclude>META-INF/ASL2.0</exclude>
|
||||
<exclude>META-INF/services/javax.ws.rs.ext.*</exclude>
|
||||
<exclude>META-INF/jersey-module-version</exclude>
|
||||
<exclude>*/schema</exclude>
|
||||
<exclude>LICENSE.txt</exclude>
|
||||
<exclude>about.html</exclude>
|
||||
</excludes>
|
||||
</filter>
|
||||
</filters>
|
||||
<relocations>
|
||||
<relocation>
|
||||
<pattern>com</pattern>
|
||||
<shadedPattern>repackaged.com</shadedPattern>
|
||||
<includes>
|
||||
<include>com.fasterxml.jackson.*</include>
|
||||
<include>com.google.guava.*</include>
|
||||
</includes>
|
||||
</relocation>
|
||||
</relocations>
|
||||
<artifactSet>
|
||||
<excludes>
|
||||
|
||||
@@ -15,6 +15,7 @@ import uk.co.gresearch.siembol.common.error.ErrorType;
|
||||
import uk.co.gresearch.siembol.common.model.ZookeeperAttributesDto;
|
||||
import uk.co.gresearch.siembol.common.zookeper.ZookeeperConnectorFactory;
|
||||
import uk.co.gresearch.siembol.common.zookeper.ZookeeperConnector;
|
||||
import uk.co.gresearch.siembol.common.zookeper.ZookeeperConnectorFactoryImpl;
|
||||
import uk.co.gresearch.siembol.enrichments.common.EnrichmentResult;
|
||||
import uk.co.gresearch.siembol.enrichments.compiler.EnrichmentCompilerImpl;
|
||||
import uk.co.gresearch.siembol.enrichments.evaluation.EnrichmentEvaluator;
|
||||
@@ -30,6 +31,7 @@ import java.util.concurrent.atomic.AtomicReference;
|
||||
import static uk.co.gresearch.siembol.enrichments.common.EnrichmentResult.StatusCode.OK;
|
||||
|
||||
public class EnrichmentEvaluatorBolt extends BaseRichBolt {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
|
||||
|
||||
private static final String INIT_EXCEPTION_MSG_FORMAT = "Enriching rule engine exception: %s during initialising alerts engine";
|
||||
@@ -56,9 +58,10 @@ public class EnrichmentEvaluatorBolt extends BaseRichBolt {
|
||||
}
|
||||
|
||||
public EnrichmentEvaluatorBolt(StormEnrichmentAttributesDto attributes) {
|
||||
this(attributes, new ZookeeperConnectorFactory() {});
|
||||
this(attributes, new ZookeeperConnectorFactoryImpl());
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Override
|
||||
public void prepare(Map map, TopologyContext topologyContext, OutputCollector outputCollector) {
|
||||
this.collector = outputCollector;
|
||||
|
||||
@@ -25,6 +25,7 @@ import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
public class EnrichmentMergerBolt extends BaseRichBolt {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
|
||||
private static final String INVALID_TYPE_IN_TUPLES = "Invalid type in tuple provided";
|
||||
private static final String MERGING_ERROR = "Unable to merge the event: {} with the enrichments : {}";
|
||||
@@ -39,6 +40,7 @@ public class EnrichmentMergerBolt extends BaseRichBolt {
|
||||
this.errorTopic = attributes.getEnrichingErrorTopic();
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Override
|
||||
public void prepare(Map map, TopologyContext topologyContext, OutputCollector outputCollector) {
|
||||
collector = outputCollector;
|
||||
|
||||
@@ -22,6 +22,7 @@ import uk.co.gresearch.siembol.common.model.StormEnrichmentAttributesDto;
|
||||
import uk.co.gresearch.siembol.common.model.ZookeeperAttributesDto;
|
||||
import uk.co.gresearch.siembol.common.zookeper.ZookeeperConnectorFactory;
|
||||
import uk.co.gresearch.siembol.common.zookeper.ZookeeperConnector;
|
||||
import uk.co.gresearch.siembol.common.zookeper.ZookeeperConnectorFactoryImpl;
|
||||
import uk.co.gresearch.siembol.enrichments.common.EnrichmentCommand;
|
||||
import uk.co.gresearch.siembol.enrichments.storm.common.*;
|
||||
import uk.co.gresearch.siembol.enrichments.table.EnrichmentMemoryTable;
|
||||
@@ -36,6 +37,7 @@ import java.util.Optional;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
public class MemoryTableEnrichmentBolt extends BaseRichBolt {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
|
||||
private static final ObjectReader TABLES_UPDATE_READER = new ObjectMapper()
|
||||
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
|
||||
@@ -71,10 +73,11 @@ public class MemoryTableEnrichmentBolt extends BaseRichBolt {
|
||||
|
||||
public MemoryTableEnrichmentBolt(StormEnrichmentAttributesDto attributes) {
|
||||
this(attributes,
|
||||
new ZookeeperConnectorFactory() {},
|
||||
new ZookeeperConnectorFactoryImpl(),
|
||||
new HdfsFileSystemFactory(attributes.getEnrichingTablesHdfsUri()));
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Override
|
||||
public void prepare(Map map, TopologyContext topologyContext, OutputCollector outputCollector) {
|
||||
this.collector = outputCollector;
|
||||
|
||||
@@ -18,6 +18,7 @@ import uk.co.gresearch.siembol.common.storm.KafkaBatchWriterBolt;
|
||||
import uk.co.gresearch.siembol.common.model.StormAttributesDto;
|
||||
import uk.co.gresearch.siembol.common.storm.StormHelper;
|
||||
import uk.co.gresearch.siembol.common.zookeper.ZookeeperConnectorFactory;
|
||||
import uk.co.gresearch.siembol.common.zookeper.ZookeeperConnectorFactoryImpl;
|
||||
import uk.co.gresearch.siembol.enrichments.storm.common.EnrichmentTuples;
|
||||
import uk.co.gresearch.siembol.common.model.StormEnrichmentAttributesDto;
|
||||
|
||||
@@ -99,7 +100,7 @@ public class StormEnrichingApplication {
|
||||
Config config = new Config();
|
||||
config.putAll(attributes.getStormAttributes().getStormConfig().getRawMap());
|
||||
StormTopology topology = createTopology(attributes,
|
||||
new ZookeeperConnectorFactory() {},
|
||||
new ZookeeperConnectorFactoryImpl(),
|
||||
new HdfsFileSystemFactory(attributes.getEnrichingTablesHdfsUri()));
|
||||
|
||||
LOG.info(SUBMIT_INFO_MSG, attributesStr);
|
||||
|
||||
@@ -5,4 +5,5 @@ import uk.co.gresearch.siembol.enrichments.common.EnrichmentCommand;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class EnrichmentCommands extends ArrayList<EnrichmentCommand> {
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
|
||||
@@ -3,4 +3,5 @@ package uk.co.gresearch.siembol.enrichments.storm.common;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class EnrichmentExceptions extends ArrayList<String> {
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
|
||||
@@ -4,4 +4,5 @@ import org.apache.commons.lang3.tuple.Pair;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class EnrichmentPairs extends ArrayList<Pair<String, String>> {
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<parent>
|
||||
<groupId>uk.co.gresearch.siembol</groupId>
|
||||
<artifactId>siembol</artifactId>
|
||||
<version>1.79-SNAPSHOT</version>
|
||||
<version>1.80-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modules>
|
||||
<module>enriching-core</module>
|
||||
@@ -20,19 +20,5 @@
|
||||
<dependencies>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.5.1</version>
|
||||
<configuration>
|
||||
<forceJavacCompilerUse>true</forceJavacCompilerUse>
|
||||
<source>${java_version}</source>
|
||||
<compilerArgument>-Xlint:unchecked</compilerArgument>
|
||||
<target>${java_version}</target>
|
||||
<showWarnings>true</showWarnings>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
||||
@@ -11,18 +11,40 @@
|
||||
<parent>
|
||||
<groupId>uk.co.gresearch.siembol</groupId>
|
||||
<artifactId>parsing</artifactId>
|
||||
<version>1.79-SNAPSHOT</version>
|
||||
<version>1.80-SNAPSHOT</version>
|
||||
</parent>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<version>${slf4j_version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-core</artifactId>
|
||||
<version>${jackson_version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-annotations</artifactId>
|
||||
<version>${jackson_version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.reinert</groupId>
|
||||
<artifactId>jjschema</artifactId>
|
||||
<version>1.16</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>uk.co.gresearch.siembol</groupId>
|
||||
<artifactId>siembol-common</artifactId>
|
||||
<version>1.79-SNAPSHOT</version>
|
||||
<version>1.80-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>uk.co.gresearch.siembol</groupId>
|
||||
<artifactId>parsing-core</artifactId>
|
||||
<version>1.79-SNAPSHOT</version>
|
||||
<version>1.80-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.adrianwalker</groupId>
|
||||
@@ -39,12 +61,14 @@
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
<version>1.7.25</version>
|
||||
<version>${slf4j_version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.17</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
@@ -54,63 +78,6 @@
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>${shade_version}</version>
|
||||
<configuration>
|
||||
<createDependencyReducedPom>true</createDependencyReducedPom>
|
||||
<artifactSet>
|
||||
<excludes>
|
||||
<exclude>*slf4j*</exclude>
|
||||
</excludes>
|
||||
</artifactSet>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<shadedArtifactAttached>false</shadedArtifactAttached>
|
||||
<shadedClassifierName>uber</shadedClassifierName>
|
||||
<filters>
|
||||
<filter>
|
||||
<artifact>*:*</artifact>
|
||||
<excludes>
|
||||
<exclude>META-INF/*.SF</exclude>
|
||||
<exclude>META-INF/*.DSA</exclude>
|
||||
<exclude>META-INF/*.RSA</exclude>
|
||||
</excludes>
|
||||
</filter>
|
||||
</filters>
|
||||
<relocations>
|
||||
</relocations>
|
||||
<artifactSet>
|
||||
<excludes>
|
||||
<exclude>org.slf4j.impl*</exclude>
|
||||
<exclude>org.slf4j:slf4j-log4j*</exclude>
|
||||
</excludes>
|
||||
</artifactSet>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.5.1</version>
|
||||
<configuration>
|
||||
<forceJavacCompilerUse>true</forceJavacCompilerUse>
|
||||
<source>${java_version}</source>
|
||||
<compilerArgument>-Xlint:unchecked</compilerArgument>
|
||||
<target>${java_version}</target>
|
||||
<showWarnings>true</showWarnings>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
||||
|
||||
@@ -22,9 +22,11 @@ import java.util.stream.Collectors;
|
||||
public abstract class ParsingApplicationParser implements Serializable {
|
||||
public enum Flags implements Serializable {
|
||||
PARSE_METADATA,
|
||||
ADD_GUID_TO_MESSAGES
|
||||
ADD_GUID_TO_MESSAGES;
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final Logger LOG = LoggerFactory
|
||||
.getLogger(MethodHandles.lookup().lookupClass());
|
||||
private static final ObjectWriter JSON_WRITER = new ObjectMapper()
|
||||
@@ -35,7 +37,6 @@ public abstract class ParsingApplicationParser implements Serializable {
|
||||
"metadata: {}, exception: {}";
|
||||
private static final String MISSING_ARGUMENTS = "Missing arguments required for Parsing application parser";
|
||||
|
||||
|
||||
private final EnumSet<Flags> flags;
|
||||
private final String name;
|
||||
private final String metadataFormatMsg;
|
||||
@@ -132,6 +133,7 @@ public abstract class ParsingApplicationParser implements Serializable {
|
||||
}
|
||||
|
||||
public static abstract class Builder<T extends ParsingApplicationParser> implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final String METADATA_FORMAT_MSG = "%s";
|
||||
protected EnumSet<Flags> flags = EnumSet.noneOf(Flags.class);
|
||||
protected String name;
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class ParsingApplicationResult implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private final String topic;
|
||||
private final ArrayList<String> messages;
|
||||
|
||||
|
||||
@@ -11,10 +11,11 @@ import java.util.Map;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class RoutingParsingApplicationParser extends ParsingApplicationParser {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final Logger LOG = LoggerFactory
|
||||
.getLogger(MethodHandles.lookup().lookupClass());
|
||||
private static final String MISSING_ROUTER_FIELDS = "Missing routing fields: %s, %s, in the parsed message: %s";
|
||||
static final String MISSING_ARGUMENTS = "Missing arguments in routing parsing application";
|
||||
private static final String MISSING_ARGUMENTS = "Missing arguments in routing parsing application";
|
||||
|
||||
private final String routingConditionField;
|
||||
private final String routingMessageField;
|
||||
@@ -77,6 +78,7 @@ public class RoutingParsingApplicationParser extends ParsingApplicationParser {
|
||||
|
||||
public static Builder<RoutingParsingApplicationParser> builder() {
|
||||
return new Builder<RoutingParsingApplicationParser>() {
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Override
|
||||
public RoutingParsingApplicationParser build() {
|
||||
if (routerParser == null
|
||||
@@ -95,6 +97,8 @@ public class RoutingParsingApplicationParser extends ParsingApplicationParser {
|
||||
|
||||
public static abstract class Builder<T extends RoutingParsingApplicationParser> extends
|
||||
ParsingApplicationParser.Builder<T> {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
protected String routingConditionField;
|
||||
protected String routingMessageField;
|
||||
protected ArrayList<String> mergedFields = new ArrayList<>();
|
||||
|
||||
@@ -9,6 +9,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class SiembolParserWrapper implements SiembolParser, Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private final RouterCondition condition;
|
||||
private final SerializableSiembolParser parser;
|
||||
private final String topic;
|
||||
|
||||
@@ -9,6 +9,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class SingleApplicationParser extends ParsingApplicationParser {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final Logger LOG = LoggerFactory
|
||||
.getLogger(MethodHandles.lookup().lookupClass());
|
||||
static final String MISSING_ARGUMENTS = "Missing arguments in single application parser";
|
||||
@@ -29,6 +30,7 @@ public class SingleApplicationParser extends ParsingApplicationParser {
|
||||
|
||||
public static Builder<SingleApplicationParser> builder() {
|
||||
return new Builder<SingleApplicationParser>() {
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Override
|
||||
public SingleApplicationParser build() {
|
||||
if (parser == null) {
|
||||
@@ -43,6 +45,7 @@ public class SingleApplicationParser extends ParsingApplicationParser {
|
||||
|
||||
public static abstract class Builder<T extends SingleApplicationParser> extends
|
||||
ParsingApplicationParser.Builder<T> {
|
||||
private static final long serialVersionUID = 1L;
|
||||
protected SiembolParserWrapper parser;
|
||||
|
||||
public Builder<T> parser(String topic, SerializableSiembolParser siembolParser) throws Exception {
|
||||
|
||||
@@ -11,13 +11,41 @@
|
||||
<parent>
|
||||
<groupId>uk.co.gresearch.siembol</groupId>
|
||||
<artifactId>parsing</artifactId>
|
||||
<version>1.79-SNAPSHOT</version>
|
||||
<version>1.80-SNAPSHOT</version>
|
||||
</parent>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-core</artifactId>
|
||||
<version>${jackson_version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-annotations</artifactId>
|
||||
<version>${jackson_version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>${jackson_version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<version>${slf4j_version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<version>${commons_lang3_version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>uk.co.gresearch.siembol</groupId>
|
||||
<artifactId>siembol-common</artifactId>
|
||||
<version>1.79-SNAPSHOT</version>
|
||||
<version>1.80-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>joda-time</groupId>
|
||||
@@ -36,47 +64,12 @@
|
||||
<version>${junit_version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.java-json-tools</groupId>
|
||||
<artifactId>json-schema-core</artifactId>
|
||||
<version>1.2.10</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.java-json-tools</groupId>
|
||||
<artifactId>json-schema-validator</artifactId>
|
||||
<version>${json_schema_validator_version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.reinert</groupId>
|
||||
<artifactId>jjschema</artifactId>
|
||||
<version>1.16</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
<version>1.7.25</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.17</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.5.1</version>
|
||||
<configuration>
|
||||
<forceJavacCompilerUse>true</forceJavacCompilerUse>
|
||||
<source>${java_version}</source>
|
||||
<compilerArgument>-Xlint:unchecked</compilerArgument>
|
||||
<target>${java_version}</target>
|
||||
<showWarnings>true</showWarnings>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
||||
@@ -13,6 +13,7 @@ import java.util.Map;
|
||||
import static uk.co.gresearch.siembol.parsers.factory.ParserFactoryResult.StatusCode.OK;
|
||||
|
||||
public class SerializableSiembolParser implements SiembolParser, Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final String WRONG_CONFIG_EXCEPTION_MSG = "Unable to create parser from config %s, Message: %s";
|
||||
private transient SiembolParser parser;
|
||||
private String parserConfig;
|
||||
|
||||
@@ -15,22 +15,22 @@ public class NetflowParsingResult {
|
||||
|
||||
private final StatusCode code;
|
||||
private final NetflowHeader header;
|
||||
private final NetflowTransportMessage transportMessage;
|
||||
private final NetflowTransportMessage<?> transportMessage;
|
||||
private final List<List<Pair<String, Object>>> dataFlowSet;
|
||||
|
||||
NetflowParsingResult(StatusCode code,
|
||||
NetflowTransportMessage transportMessage) {
|
||||
NetflowTransportMessage<?> transportMessage) {
|
||||
this(code, transportMessage, null, null);
|
||||
}
|
||||
|
||||
NetflowParsingResult(StatusCode code,
|
||||
NetflowTransportMessage transportMessage,
|
||||
NetflowTransportMessage<?> transportMessage,
|
||||
NetflowHeader header) {
|
||||
this(code, transportMessage, header, null);
|
||||
}
|
||||
|
||||
NetflowParsingResult(StatusCode code,
|
||||
NetflowTransportMessage transportMessage,
|
||||
NetflowTransportMessage<?> transportMessage,
|
||||
NetflowHeader header,
|
||||
List<List<Pair<String, Object>>> dataFlowSet){
|
||||
this.code = code;
|
||||
|
||||
@@ -19,7 +19,7 @@ public class SiembolNetflowParser implements SiembolParser {
|
||||
public static final String NETFLOW_UNKNOWN_TEMPLATE = "netflow_unknown_template";
|
||||
public static final String UNSUPPORTED_MSG = "The method is unsupported because netflow parsing requires metadata";
|
||||
|
||||
private final NetflowParser netflowParser;
|
||||
private final NetflowParser<?> netflowParser;
|
||||
|
||||
private Map<String, Object> getUnknownTemplateObject(NetflowParsingResult parsingResult, byte[] bytes) {
|
||||
Map<String, Object> ret = new HashMap<>();
|
||||
|
||||
@@ -9,9 +9,24 @@
|
||||
<parent>
|
||||
<groupId>uk.co.gresearch.siembol</groupId>
|
||||
<artifactId>parsing</artifactId>
|
||||
<version>1.79-SNAPSHOT</version>
|
||||
<version>1.80-SNAPSHOT</version>
|
||||
</parent>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-core</artifactId>
|
||||
<version>${jackson_version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-annotations</artifactId>
|
||||
<version>${jackson_version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>${jackson_version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.kafka</groupId>
|
||||
<artifactId>kafka_2.11</artifactId>
|
||||
@@ -28,21 +43,6 @@
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>uk.co.gresearch.siembol</groupId>
|
||||
<artifactId>parsing-app</artifactId>
|
||||
<version>1.79-SNAPSHOT</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.kafka</groupId>
|
||||
<artifactId>kafka-clients</artifactId>
|
||||
@@ -59,6 +59,25 @@
|
||||
<version>${storm_version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>uk.co.gresearch.siembol</groupId>
|
||||
<artifactId>parsing-app</artifactId>
|
||||
<version>1.80-SNAPSHOT</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
@@ -137,13 +156,29 @@
|
||||
<filter>
|
||||
<artifact>*:*</artifact>
|
||||
<excludes>
|
||||
<exclude>module-info.class</exclude>
|
||||
<exclude>META-INF/*.SF</exclude>
|
||||
<exclude>META-INF/*.DSA</exclude>
|
||||
<exclude>META-INF/*.RSA</exclude>
|
||||
<exclude>META-INF/*.MF</exclude>
|
||||
<exclude>META-INF/*.txt</exclude>
|
||||
<exclude>*/schema</exclude>
|
||||
<exclude>META-INF/LICENSE</exclude>
|
||||
<exclude>META-INF/DEPENDENCIES</exclude>
|
||||
<exclude>META-INF/NOTICE</exclude>
|
||||
<exclude>LICENSE.txt</exclude>
|
||||
</excludes>
|
||||
</filter>
|
||||
</filters>
|
||||
<relocations>
|
||||
<relocation>
|
||||
<pattern>com</pattern>
|
||||
<shadedPattern>repackaged.com</shadedPattern>
|
||||
<includes>
|
||||
<include>com.fasterxml.jackson.*</include>
|
||||
<include>com.google.guava.*</include>
|
||||
</includes>
|
||||
</relocation>
|
||||
</relocations>
|
||||
<artifactSet>
|
||||
<excludes>
|
||||
|
||||
@@ -16,6 +16,7 @@ import uk.co.gresearch.siembol.common.storm.KafkaBatchWriterMessages;
|
||||
import uk.co.gresearch.siembol.common.model.ZookeeperAttributesDto;
|
||||
import uk.co.gresearch.siembol.common.zookeper.ZookeeperConnector;
|
||||
import uk.co.gresearch.siembol.common.zookeper.ZookeeperConnectorFactory;
|
||||
import uk.co.gresearch.siembol.common.zookeper.ZookeeperConnectorFactoryImpl;
|
||||
import uk.co.gresearch.siembol.parsers.application.factory.ParsingApplicationFactory;
|
||||
import uk.co.gresearch.siembol.parsers.application.factory.ParsingApplicationFactoryAttributes;
|
||||
import uk.co.gresearch.siembol.parsers.application.factory.ParsingApplicationFactoryImpl;
|
||||
@@ -28,6 +29,7 @@ import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
public class ParsingApplicationBolt extends BaseRichBolt {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
|
||||
private static final String PARSERCONFIG_UPDATE_TRY_MSG_FORMAT = "Trying to update parsing app: %s, " +
|
||||
"by parser configs: %s, ";
|
||||
@@ -59,9 +61,10 @@ public class ParsingApplicationBolt extends BaseRichBolt {
|
||||
|
||||
public ParsingApplicationBolt(StormParsingApplicationAttributesDto attributes,
|
||||
ParsingApplicationFactoryAttributes parsingAttributes) throws Exception {
|
||||
this(attributes, parsingAttributes, new ZookeeperConnectorFactory() {});
|
||||
this(attributes, parsingAttributes, new ZookeeperConnectorFactoryImpl());
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Override
|
||||
public void prepare(Map map, TopologyContext topologyContext, OutputCollector outputCollector) {
|
||||
this.collector = outputCollector;
|
||||
|
||||
@@ -18,6 +18,7 @@ import uk.co.gresearch.siembol.common.storm.KafkaBatchWriterBolt;
|
||||
import uk.co.gresearch.siembol.common.model.StormAttributesDto;
|
||||
import uk.co.gresearch.siembol.common.storm.StormHelper;
|
||||
import uk.co.gresearch.siembol.common.zookeper.ZookeeperConnectorFactory;
|
||||
import uk.co.gresearch.siembol.common.zookeper.ZookeeperConnectorFactoryImpl;
|
||||
import uk.co.gresearch.siembol.parsers.application.factory.ParsingApplicationFactoryAttributes;
|
||||
import uk.co.gresearch.siembol.parsers.application.factory.ParsingApplicationFactoryImpl;
|
||||
import uk.co.gresearch.siembol.parsers.application.factory.ParsingApplicationFactoryResult;
|
||||
@@ -105,7 +106,7 @@ public class StormParsingApplication {
|
||||
ParsingApplicationFactoryAttributes parsingAttributes = result.getAttributes();
|
||||
Config config = new Config();
|
||||
config.putAll(stormAttributes.getStormAttributes().getStormConfig().getRawMap());
|
||||
StormTopology topology = createTopology(stormAttributes, parsingAttributes, new ZookeeperConnectorFactory() {});
|
||||
StormTopology topology = createTopology(stormAttributes, parsingAttributes, new ZookeeperConnectorFactoryImpl());
|
||||
String topologyName = stormAttributes.getTopologyName(parsingAttributes.getName());
|
||||
LOG.info(SUBMIT_INFO_LOG, topologyName, stormAttributesStr, parsingAttributesStr);
|
||||
StormSubmitter.submitTopology(topologyName, config, topology);
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<parent>
|
||||
<groupId>uk.co.gresearch.siembol</groupId>
|
||||
<artifactId>siembol</artifactId>
|
||||
<version>1.79-SNAPSHOT</version>
|
||||
<version>1.80-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modules>
|
||||
<module>parsing-core</module>
|
||||
@@ -21,19 +21,5 @@
|
||||
<dependencies>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.5.1</version>
|
||||
<configuration>
|
||||
<forceJavacCompilerUse>true</forceJavacCompilerUse>
|
||||
<source>${java_version}</source>
|
||||
<compilerArgument>-Xlint:unchecked</compilerArgument>
|
||||
<target>${java_version}</target>
|
||||
<showWarnings>true</showWarnings>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
||||
30
pom.xml
30
pom.xml
@@ -6,7 +6,7 @@
|
||||
<groupId>uk.co.gresearch.siembol</groupId>
|
||||
<artifactId>siembol</artifactId>
|
||||
<name>siembol</name>
|
||||
<version>1.79-SNAPSHOT</version>
|
||||
<version>1.80-SNAPSHOT</version>
|
||||
<description>A scalable, advanced security analytics framework based on open-source big data technologies.</description>
|
||||
<inceptionYear>2019</inceptionYear>
|
||||
<url>https://github.com/G-Research</url>
|
||||
@@ -39,23 +39,26 @@
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
<java_version>1.8</java_version>
|
||||
<jackson_version>2.9.8</jackson_version>
|
||||
<jackson_version>2.12.2</jackson_version>
|
||||
<junit_version>4.12</junit_version>
|
||||
<mockito_version>3.2.4</mockito_version>
|
||||
<shade_version>2.4.3</shade_version>
|
||||
<mockito_version>3.9.0</mockito_version>
|
||||
<shade_version>3.2.4</shade_version>
|
||||
<curator_version>2.12.0</curator_version>
|
||||
<storm_version>1.2.1</storm_version>
|
||||
<kafka_version>0.10.2.2</kafka_version>
|
||||
<kafka_junit_version>3.0.4</kafka_junit_version>
|
||||
<spark_version>2.2.0</spark_version>
|
||||
<hadoop_version>3.1.1</hadoop_version>
|
||||
<json_schema_validator_version>2.2.10</json_schema_validator_version>
|
||||
<json_schema_validator_version>2.2.14</json_schema_validator_version>
|
||||
<json_schema_core_version>1.2.14</json_schema_core_version>
|
||||
<spring_boot_version>2.3.1.RELEASE</spring_boot_version>
|
||||
<guava_version>29.0-jre</guava_version>
|
||||
<springdoc_openapi_version>1.4.8</springdoc_openapi_version>
|
||||
<commons_beanutils_version>1.9.4</commons_beanutils_version>
|
||||
<multiline_string_version>0.1.2</multiline_string_version>
|
||||
<http_client_version>4.5.12</http_client_version>
|
||||
<slf4j_version>1.7.25</slf4j_version>
|
||||
<commons_lang3_version>3.8.1</commons_lang3_version>
|
||||
</properties>
|
||||
<modules>
|
||||
<module>siembol-common</module>
|
||||
@@ -107,11 +110,26 @@
|
||||
<configuration>
|
||||
<forceJavacCompilerUse>true</forceJavacCompilerUse>
|
||||
<source>${java_version}</source>
|
||||
<compilerArgument>-Xlint:unchecked</compilerArgument>
|
||||
<compilerArgs>
|
||||
<arg>-Xlint:all</arg>
|
||||
<arg>-Xlint:-processing</arg>
|
||||
</compilerArgs>
|
||||
<target>${java_version}</target>
|
||||
<showWarnings>true</showWarnings>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>3.0.0-M5</version>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.surefire</groupId>
|
||||
<artifactId>surefire-junit47</artifactId>
|
||||
<version>3.0.0-M5</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.sonatype.plugins</groupId>
|
||||
<artifactId>nexus-staging-maven-plugin</artifactId>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<parent>
|
||||
<groupId>uk.co.gresearch.siembol</groupId>
|
||||
<artifactId>siembol</artifactId>
|
||||
<version>1.79-SNAPSHOT</version>
|
||||
<version>1.80-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modules>
|
||||
<module>responding-core</module>
|
||||
@@ -25,19 +25,5 @@
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.5.1</version>
|
||||
<configuration>
|
||||
<forceJavacCompilerUse>true</forceJavacCompilerUse>
|
||||
<source>${java_version}</source>
|
||||
<compilerArgument>-Xlint:unchecked</compilerArgument>
|
||||
<target>${java_version}</target>
|
||||
<showWarnings>true</showWarnings>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
||||
@@ -11,18 +11,36 @@
|
||||
<parent>
|
||||
<groupId>uk.co.gresearch.siembol</groupId>
|
||||
<artifactId>responding</artifactId>
|
||||
<version>1.79-SNAPSHOT</version>
|
||||
<version>1.80-SNAPSHOT</version>
|
||||
</parent>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-core</artifactId>
|
||||
<version>${jackson_version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-annotations</artifactId>
|
||||
<version>${jackson_version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>${jackson_version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>uk.co.gresearch.siembol</groupId>
|
||||
<artifactId>siembol-common</artifactId>
|
||||
<version>1.79-SNAPSHOT</version>
|
||||
<version>1.80-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>uk.co.gresearch.siembol</groupId>
|
||||
<artifactId>alerting-core</artifactId>
|
||||
<version>1.79-SNAPSHOT</version>
|
||||
<version>1.80-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.jayway.jsonpath</groupId>
|
||||
@@ -44,7 +62,7 @@
|
||||
<dependency>
|
||||
<groupId>com.github.java-json-tools</groupId>
|
||||
<artifactId>json-schema-core</artifactId>
|
||||
<version>1.2.10</version>
|
||||
<version>${json_schema_core_version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
@@ -87,20 +105,6 @@
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.5.1</version>
|
||||
<configuration>
|
||||
<forceJavacCompilerUse>true</forceJavacCompilerUse>
|
||||
<source>${java_version}</source>
|
||||
<compilerArgument>-Xlint:unchecked</compilerArgument>
|
||||
<target>${java_version}</target>
|
||||
<showWarnings>true</showWarnings>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
public class ResponseAlert extends HashMap<String, Object> {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static ObjectReader ALERT_READER = new ObjectMapper()
|
||||
.readerFor(new TypeReference<Map<String, Object>>() {});
|
||||
private static ObjectWriter RESPONSE_ALERT_WRITER = new ObjectMapper()
|
||||
|
||||
@@ -30,6 +30,7 @@ public class ArrayReducerEvaluator implements Evaluable {
|
||||
@Override
|
||||
public RespondingResult evaluate(ResponseAlert alert) {
|
||||
try {
|
||||
@SuppressWarnings("unchecked")
|
||||
List<Map<String, Object>> array = (List<Map<String, Object>>)alert.get(arrayFieldName);
|
||||
if (array == null) {
|
||||
return RespondingResult.fromEvaluationResult(ResponseEvaluationResult.NO_MATCH, alert);
|
||||
|
||||
@@ -50,6 +50,7 @@ public class TableFormatter implements Evaluable {
|
||||
return tableBuilder.build().toString();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private static String formatArray(ResponseAlert responseAlert, String arrayField, FieldFilter fieldFilter) {
|
||||
Table.Builder tableBuilder = new Table.Builder();
|
||||
List<Map<String, Object>> arrayObj;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<parent>
|
||||
<groupId>uk.co.gresearch.siembol</groupId>
|
||||
<artifactId>responding</artifactId>
|
||||
<version>1.79-SNAPSHOT</version>
|
||||
<version>1.80-SNAPSHOT</version>
|
||||
</parent>
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
@@ -23,6 +23,21 @@
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-core</artifactId>
|
||||
<version>${jackson_version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-annotations</artifactId>
|
||||
<version>${jackson_version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>${jackson_version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-logging</artifactId>
|
||||
@@ -31,7 +46,7 @@
|
||||
<dependency>
|
||||
<groupId>uk.co.gresearch.siembol</groupId>
|
||||
<artifactId>siembol-common</artifactId>
|
||||
<version>1.79-SNAPSHOT</version>
|
||||
<version>1.80-SNAPSHOT</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.slf4j</groupId>
|
||||
@@ -42,7 +57,7 @@
|
||||
<dependency>
|
||||
<groupId>uk.co.gresearch.siembol</groupId>
|
||||
<artifactId>responding-core</artifactId>
|
||||
<version>1.79-SNAPSHOT</version>
|
||||
<version>1.80-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.kafka</groupId>
|
||||
|
||||
@@ -6,6 +6,7 @@ import org.slf4j.LoggerFactory;
|
||||
import uk.co.gresearch.siembol.common.model.ZookeeperAttributesDto;
|
||||
import uk.co.gresearch.siembol.common.zookeper.ZookeeperConnector;
|
||||
import uk.co.gresearch.siembol.common.zookeper.ZookeeperConnectorFactory;
|
||||
import uk.co.gresearch.siembol.common.zookeper.ZookeeperConnectorFactoryImpl;
|
||||
import uk.co.gresearch.siembol.response.common.RespondingResult;
|
||||
import uk.co.gresearch.siembol.response.compiler.RespondingCompiler;
|
||||
import uk.co.gresearch.siembol.response.engine.ResponseEngine;
|
||||
@@ -33,7 +34,7 @@ public class ZookeeperRulesProvider implements RulesProvider {
|
||||
|
||||
public ZookeeperRulesProvider(ZookeeperAttributesDto zookeperAttributes,
|
||||
RespondingCompiler respondingCompiler) throws Exception {
|
||||
this(new ZookeeperConnectorFactory() {}, zookeperAttributes, respondingCompiler);
|
||||
this(new ZookeeperConnectorFactoryImpl(), zookeperAttributes, respondingCompiler);
|
||||
}
|
||||
|
||||
ZookeeperRulesProvider(ZookeeperConnectorFactory factory,
|
||||
|
||||
@@ -19,6 +19,7 @@ import java.util.UUID;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyMap;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
public class KafkaStreamRuleServiceTest {
|
||||
@@ -75,7 +76,7 @@ public class KafkaStreamRuleServiceTest {
|
||||
@Ignore
|
||||
@Test
|
||||
public void testMatchEngineTest() throws Exception {
|
||||
when(rulesEngine.evaluate(any()))
|
||||
when(rulesEngine.evaluate(any(ResponseAlert.class)))
|
||||
.thenReturn(RespondingResult.fromEvaluationResult(ResponseEvaluationResult.MATCH, responseAlert));
|
||||
kafkaRule.helper().produceStrings(inputTopic, alertStr.trim());;
|
||||
Assert.assertEquals(Status.UP, streamService.checkHealth().toFuture().get().getStatus());
|
||||
@@ -85,7 +86,7 @@ public class KafkaStreamRuleServiceTest {
|
||||
@Test
|
||||
public void testNoMatchEngineTest() throws Exception {
|
||||
resultAttributes.setMessage("no rule matched");
|
||||
when(rulesEngine.evaluate(any()))
|
||||
when(rulesEngine.evaluate(any(ResponseAlert.class)))
|
||||
.thenReturn(RespondingResult.fromEvaluationResult(ResponseEvaluationResult.NO_MATCH, responseAlert));
|
||||
kafkaRule.helper().produceStrings(inputTopic, alertStr.trim());
|
||||
|
||||
@@ -99,7 +100,7 @@ public class KafkaStreamRuleServiceTest {
|
||||
@Ignore
|
||||
@Test
|
||||
public void testErrorMatchEngineTest() throws Exception {
|
||||
when(rulesEngine.evaluate(any()))
|
||||
when(rulesEngine.evaluate(any(ResponseAlert.class)))
|
||||
.thenReturn(RespondingResult.fromException(new IllegalStateException("tmp")));
|
||||
kafkaRule.helper().produceStrings(inputTopic, alertStr.trim());
|
||||
|
||||
@@ -113,7 +114,7 @@ public class KafkaStreamRuleServiceTest {
|
||||
@Ignore
|
||||
@Test
|
||||
public void testExceptionEngineTest() throws Exception {
|
||||
when(rulesEngine.evaluate(any())).thenThrow(new IllegalStateException());
|
||||
when(rulesEngine.evaluate(any(ResponseAlert.class))).thenThrow(new IllegalStateException());
|
||||
kafkaRule.helper().produceStrings(inputTopic, alertStr.trim());
|
||||
|
||||
List<String> outputEvent = kafkaRule.helper().consumeStrings(errorTopic, 1)
|
||||
|
||||
@@ -9,18 +9,19 @@
|
||||
<parent>
|
||||
<groupId>uk.co.gresearch.siembol</groupId>
|
||||
<artifactId>siembol</artifactId>
|
||||
<version>1.79-SNAPSHOT</version>
|
||||
<version>1.80-SNAPSHOT</version>
|
||||
</parent>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<version>${commons_lang3_version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
<version>${http_client_version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.storm</groupId>
|
||||
@@ -38,21 +39,24 @@
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-core</artifactId>
|
||||
<version>${jackson_version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-annotations</artifactId>
|
||||
<version>${jackson_version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>${jackson_version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.java-json-tools</groupId>
|
||||
<artifactId>json-schema-core</artifactId>
|
||||
<version>1.2.10</version>
|
||||
<version>${json_schema_core_version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
@@ -77,12 +81,6 @@
|
||||
<version>${curator_version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.curator</groupId>
|
||||
<artifactId>curator-test</artifactId>
|
||||
<version>${curator_version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.curator</groupId>
|
||||
<artifactId>curator-client</artifactId>
|
||||
@@ -101,39 +99,10 @@
|
||||
<version>${kafka_version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.adrianwalker</groupId>
|
||||
<artifactId>multiline-string</artifactId>
|
||||
<version>${multiline_string_version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<version>1.7.21</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
<version>1.7.25</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>${junit_version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-core</artifactId>
|
||||
<version>${mockito_version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.charithe</groupId>
|
||||
<artifactId>kafka-junit</artifactId>
|
||||
<version>${kafka_junit_version}</version>
|
||||
<scope>test</scope>
|
||||
<version>${slf4j_version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springdoc</groupId>
|
||||
@@ -161,19 +130,5 @@
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.5.1</version>
|
||||
<configuration>
|
||||
<forceJavacCompilerUse>true</forceJavacCompilerUse>
|
||||
<source>${java_version}</source>
|
||||
<compilerArgument>-Xlint:unchecked</compilerArgument>
|
||||
<target>${java_version}</target>
|
||||
<showWarnings>true</showWarnings>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
||||
@@ -36,7 +36,9 @@ public class Oauth2Helper {
|
||||
public static JwtDecoder createJwtDecoder(ResourceServerOauth2Properties properties) throws MalformedURLException {
|
||||
List<OAuth2TokenValidator<Jwt>> validators = new ArrayList<>();
|
||||
validators.add(new JwtTimestampValidator(Duration.ofSeconds(JWT_CLOCK_SKEW_IN_SECONDS)));
|
||||
|
||||
validators.add(new JwtIssuerValidator(properties.getIssuerUrl()));
|
||||
|
||||
validators.add(token -> token.getAudience().contains(properties.getAudience())
|
||||
? OAuth2TokenValidatorResult.success()
|
||||
: OAuth2TokenValidatorResult.failure(new OAuth2Error(MISSING_REQUIRED_AUDIENCE)));
|
||||
@@ -52,8 +54,7 @@ public class Oauth2Helper {
|
||||
jwtProcessor.setJWSKeySelector(new JWSVerificationKeySelector<>(
|
||||
new JWSAlgorithm(properties.getJwsAlgorithm()), jwkSource));
|
||||
|
||||
jwtProcessor.setJWTClaimsSetVerifier((claims, context) -> {
|
||||
});
|
||||
jwtProcessor.setJWTClaimsSetVerifier((claims, context) -> {});
|
||||
|
||||
NimbusJwtDecoder jwtDecoder = new NimbusJwtDecoder(jwtProcessor);
|
||||
jwtDecoder.setJwtValidator(jwtValidator);
|
||||
|
||||
@@ -10,6 +10,7 @@ import java.io.Serializable;
|
||||
import java.lang.invoke.MethodHandles;
|
||||
|
||||
public class ByteArrayFileSystem implements SiembolFileSystem, Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
|
||||
|
||||
private String data;
|
||||
|
||||
@@ -3,6 +3,7 @@ package uk.co.gresearch.siembol.common.filesystem;
|
||||
import java.io.IOException;
|
||||
|
||||
public class HdfsFileSystemFactory implements SiembolFileSystemFactory {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private final String uri;
|
||||
|
||||
public HdfsFileSystemFactory(String uri) {
|
||||
|
||||
@@ -89,7 +89,7 @@ public class ModelHelper {
|
||||
return ret;
|
||||
}
|
||||
|
||||
private static boolean isInterestingType(Class type) {
|
||||
private static boolean isInterestingType(Class<?> type) {
|
||||
return !ClassUtils.isPrimitiveOrWrapper(type)
|
||||
&& !type.equals(String.class)
|
||||
&& !type.isEnum();
|
||||
|
||||
@@ -9,6 +9,7 @@ import java.util.List;
|
||||
|
||||
@Attributes(title = "storm alerting attributes", description = "Attributes for siembol alerting")
|
||||
public class AlertingStormAttributesDto extends AdminConfigDto implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Attributes(required = true, description = "The type of siembol alerting engine")
|
||||
@JsonProperty("alerts.engine")
|
||||
private String alertingEngine;
|
||||
|
||||
@@ -7,6 +7,8 @@ import java.io.Serializable;
|
||||
|
||||
@Attributes(title = "overridden application attributes", description = "Storm parsing application attributes")
|
||||
public class OverriddenApplicationAttributesDto implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@JsonProperty("application.name")
|
||||
@Attributes(description = "The name of the application with the overridden attributes", required = true)
|
||||
private String applicationName;
|
||||
|
||||
@@ -8,6 +8,8 @@ import java.util.List;
|
||||
|
||||
@Attributes(title = "storm enrichment attributes", description = "Attributes for storm enrichment configuration")
|
||||
public class StormEnrichmentAttributesDto extends AdminConfigDto implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@JsonProperty("topology.name")
|
||||
@Attributes(required = true, description = "The name of storm topology")
|
||||
private String topologyName = "siembol-enrichment";
|
||||
|
||||
@@ -10,6 +10,7 @@ import java.util.List;
|
||||
|
||||
@Attributes(title = "storm parsing application attributes", description = "Storm parsing application attributes")
|
||||
public class StormParsingApplicationAttributesDto extends AdminConfigDto implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final String KAFKA_PRINCIPAL_FORMAT_MSG = "%s.%s";
|
||||
private static final String TOPOLOGY_NAME_FORMAT_MSG = "%s-%s";
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ import java.io.Serializable;
|
||||
|
||||
@Attributes(title = "zookeeper attributes", description = "Zookeeper attributes for node cache")
|
||||
public class ZookeeperAttributesDto implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
@JsonProperty("zk.url")
|
||||
@Attributes(required = true, description = "Zookeeper servers url. Multiple servers are separated by comma")
|
||||
private String zkUrl;
|
||||
|
||||
@@ -25,6 +25,7 @@ import static org.apache.storm.utils.TupleUtils.isTick;
|
||||
import static org.apache.storm.utils.TupleUtils.putTickFrequencyIntoComponentConfig;
|
||||
|
||||
public class KafkaBatchWriterBolt extends BaseRichBolt {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final Logger LOG =
|
||||
LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
|
||||
private static final int ACK_INTERVAL_ACK_IN_SEC = 1;
|
||||
@@ -75,6 +76,7 @@ public class KafkaBatchWriterBolt extends BaseRichBolt {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Override
|
||||
public void prepare(Map map, TopologyContext topologyContext, OutputCollector outputCollector) {
|
||||
this.collector = outputCollector;
|
||||
|
||||
@@ -3,6 +3,7 @@ package uk.co.gresearch.siembol.common.storm;
|
||||
import java.io.Serializable;
|
||||
|
||||
public class KafkaBatchWriterMessage implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private final String topic;
|
||||
private final String message;
|
||||
|
||||
|
||||
@@ -3,4 +3,5 @@ package uk.co.gresearch.siembol.common.storm;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class KafkaBatchWriterMessages extends ArrayList<KafkaBatchWriterMessage> {
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
|
||||
@@ -14,6 +14,8 @@ import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
public class TestingZookeeperConnectorFactory implements ZookeeperConnectorFactory {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private final ExecutorService executorService = Executors.newSingleThreadExecutor();
|
||||
private final Map<String, String> cache = new HashMap<>();
|
||||
|
||||
|
||||
@@ -65,6 +65,7 @@ public class EvaluationLibrary {
|
||||
return numVariableMatches == numVariableStartMatches && numVariableMatches > 0;
|
||||
}
|
||||
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
public static Object substituteBean(Object obj, Map<String, Object> event) throws Exception {
|
||||
//NOTE: currently we have beans with primitive types, Bean or List<Beans>
|
||||
if (obj instanceof String) {
|
||||
|
||||
@@ -2,9 +2,7 @@ package uk.co.gresearch.siembol.common.zookeper;
|
||||
|
||||
import uk.co.gresearch.siembol.common.model.ZookeeperAttributesDto;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public interface ZookeeperConnectorFactory extends Serializable {
|
||||
public interface ZookeeperConnectorFactory {
|
||||
default ZookeeperConnector createZookeeperConnector(ZookeeperAttributesDto attributes) throws Exception {
|
||||
return new ZookeeperConnectorImpl.Builder()
|
||||
.zkServer(attributes.getZkUrl())
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
package uk.co.gresearch.siembol.common.zookeper;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class ZookeeperConnectorFactoryImpl implements ZookeeperConnectorFactory, Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
@@ -91,7 +91,7 @@ public class KafkaBatchWriterBoltTest {
|
||||
for (int i = 0; i < 100; i++) {
|
||||
Assert.assertEquals("dummy", outputMessages.get(i));
|
||||
}
|
||||
verify(collector, times(1)).ack(any());
|
||||
verify(collector, times(1)).ack(ArgumentMatchers.<List<Object>>any());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -113,6 +113,6 @@ public class KafkaBatchWriterBoltTest {
|
||||
for (int i = 0; i < 100; i++) {
|
||||
Assert.assertEquals("dummy", outputMessages.get(i));
|
||||
}
|
||||
verify(collector, times(100)).ack(any());
|
||||
verify(collector, times(100)).ack(any(Tuple.class));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user