Skip to content

Commit

Permalink
Move Kafka Streams classes to dedicated streams package
Browse files Browse the repository at this point in the history
Signed-off-by: nscuro <[email protected]>
  • Loading branch information
nscuro committed Feb 2, 2024
1 parent bfcae07 commit f906f65
Show file tree
Hide file tree
Showing 23 changed files with 35 additions and 35 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.dependencytrack.event.kafka;
package org.dependencytrack.event.kafka.streams;

import alpine.Config;
import alpine.common.logging.Logger;
Expand All @@ -11,9 +11,9 @@
import org.apache.kafka.streams.KafkaStreams;
import org.apache.kafka.streams.StreamsConfig;
import org.dependencytrack.common.ConfigKey;
import org.dependencytrack.event.kafka.exception.KafkaStreamsDeserializationExceptionHandler;
import org.dependencytrack.event.kafka.exception.KafkaStreamsProductionExceptionHandler;
import org.dependencytrack.event.kafka.exception.KafkaStreamsUncaughtExceptionHandler;
import org.dependencytrack.event.kafka.streams.exception.KafkaStreamsDeserializationExceptionHandler;
import org.dependencytrack.event.kafka.streams.exception.KafkaStreamsProductionExceptionHandler;
import org.dependencytrack.event.kafka.streams.exception.KafkaStreamsUncaughtExceptionHandler;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.dependencytrack.event.kafka;
package org.dependencytrack.event.kafka.streams;

import alpine.Config;
import alpine.common.logging.Logger;
Expand All @@ -21,10 +21,11 @@
import org.dependencytrack.event.PortfolioVulnerabilityAnalysisEvent;
import org.dependencytrack.event.ProjectMetricsUpdateEvent;
import org.dependencytrack.event.ProjectPolicyEvaluationEvent;
import org.dependencytrack.event.kafka.processor.DelayedBomProcessedNotificationProcessor;
import org.dependencytrack.event.kafka.processor.MirrorVulnerabilityProcessor;
import org.dependencytrack.event.kafka.processor.RepositoryMetaResultProcessor;
import org.dependencytrack.event.kafka.processor.VulnerabilityScanResultProcessor;
import org.dependencytrack.event.kafka.KafkaTopics;
import org.dependencytrack.event.kafka.streams.processor.DelayedBomProcessedNotificationProcessor;
import org.dependencytrack.event.kafka.streams.processor.MirrorVulnerabilityProcessor;
import org.dependencytrack.event.kafka.streams.processor.RepositoryMetaResultProcessor;
import org.dependencytrack.event.kafka.streams.processor.VulnerabilityScanResultProcessor;
import org.dependencytrack.model.VulnerabilityScan;
import org.dependencytrack.model.WorkflowState;
import org.dependencytrack.model.WorkflowStatus;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.dependencytrack.event.kafka.exception;
package org.dependencytrack.event.kafka.streams.exception;

import java.time.Clock;
import java.time.Duration;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.dependencytrack.event.kafka.exception;
package org.dependencytrack.event.kafka.streams.exception;

import alpine.Config;
import alpine.common.logging.Logger;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.dependencytrack.event.kafka.exception;
package org.dependencytrack.event.kafka.streams.exception;

import alpine.Config;
import alpine.common.logging.Logger;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.dependencytrack.event.kafka.exception;
package org.dependencytrack.event.kafka.streams.exception;

import alpine.Config;
import alpine.common.logging.Logger;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.dependencytrack.event.kafka.processor;
package org.dependencytrack.event.kafka.streams.processor;

import alpine.common.logging.Logger;
import alpine.notification.NotificationLevel;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.dependencytrack.event.kafka.processor;
package org.dependencytrack.event.kafka.streams.processor;

import alpine.common.logging.Logger;
import alpine.common.metrics.Metrics;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.dependencytrack.event.kafka.processor;
package org.dependencytrack.event.kafka.streams.processor;

import alpine.common.logging.Logger;
import alpine.common.metrics.Metrics;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.dependencytrack.event.kafka.processor;
package org.dependencytrack.event.kafka.streams.processor;

import alpine.Config;
import alpine.common.logging.Logger;
Expand Down Expand Up @@ -625,7 +625,7 @@ private org.dependencytrack.proto.notification.v1.Notification createProjectAudi
.setLevel(LEVEL_INFORMATIONAL)
.setTimestamp(Timestamps.now())
.setTitle(generateTitle(policyAnalysis.getState(), policyAnalysis.getSuppressed(), analysisStateChange, suppressionChange))
.setContent(generateNotificationContent(policyAnalysis))
.setContent("An analysis decision was made to a finding affecting a project")
.setSubject(Any.pack(subject))
.build())
.orElse(null);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.dependencytrack.health;

import org.apache.kafka.streams.KafkaStreams;
import org.dependencytrack.event.kafka.KafkaStreamsInitializer;
import org.dependencytrack.event.kafka.streams.KafkaStreamsInitializer;
import org.eclipse.microprofile.health.HealthCheck;
import org.eclipse.microprofile.health.HealthCheckResponse;
import org.eclipse.microprofile.health.Liveness;
Expand Down
5 changes: 0 additions & 5 deletions src/main/java/org/dependencytrack/util/NotificationUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.dependencytrack.event.kafka.KafkaEventDispatcher;
import org.dependencytrack.event.kafka.processor.VulnerabilityScanResultProcessor;
import org.dependencytrack.model.Analysis;
import org.dependencytrack.model.AnalysisState;
import org.dependencytrack.model.Component;
Expand Down Expand Up @@ -429,10 +428,6 @@ public static String generateNotificationTitle(String messageType, Project proje
return messageType;
}

public static String generateNotificationContent(final VulnerabilityScanResultProcessor.Analysis analysis) {
return "An analysis decision was made to a finding affecting a project";
}

public static String generateNotificationTitle(final String messageType, final org.dependencytrack.proto.notification.v1.Project project) {
if (project == null) {
return messageType;
Expand Down
2 changes: 1 addition & 1 deletion src/main/webapp/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
<listener-class>org.dependencytrack.event.EventSubsystemInitializer</listener-class>
</listener>
<listener>
<listener-class>org.dependencytrack.event.kafka.KafkaStreamsInitializer</listener-class>
<listener-class>org.dependencytrack.event.kafka.streams.KafkaStreamsInitializer</listener-class>
</listener>
<listener>
<listener-class>org.dependencytrack.event.PurlMigrator</listener-class>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package org.dependencytrack.event.kafka;
package org.dependencytrack.event.kafka.streams;

import net.mguenther.kafka.junit.KeyValue;
import net.mguenther.kafka.junit.ReadKeyValues;
import net.mguenther.kafka.junit.SendKeyValues;
import org.apache.kafka.clients.consumer.ConsumerConfig;
import org.apache.kafka.clients.producer.ProducerConfig;
import org.apache.kafka.common.serialization.StringDeserializer;
import org.dependencytrack.event.kafka.KafkaTopics;
import org.dependencytrack.event.kafka.serialization.KafkaProtobufSerializer;
import org.dependencytrack.model.Project;
import org.dependencytrack.model.VulnerabilityScan;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package org.dependencytrack.event.kafka;
package org.dependencytrack.event.kafka.streams;

import net.mguenther.kafka.junit.ExternalKafkaCluster;
import net.mguenther.kafka.junit.TopicConfig;
import org.apache.kafka.streams.KafkaStreams;
import org.apache.kafka.streams.StreamsConfig;
import org.apache.kafka.streams.Topology;
import org.dependencytrack.AbstractPostgresEnabledTest;
import org.dependencytrack.event.kafka.KafkaTopics;
import org.dependencytrack.event.kafka.serialization.KafkaProtobufDeserializer;
import org.dependencytrack.proto.notification.v1.Notification;
import org.junit.After;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package org.dependencytrack.event.kafka;
package org.dependencytrack.event.kafka.streams;

import net.mguenther.kafka.junit.ExternalKafkaCluster;
import net.mguenther.kafka.junit.TopicConfig;
import org.apache.kafka.streams.KafkaStreams;
import org.apache.kafka.streams.StreamsConfig;
import org.dependencytrack.PersistenceCapableTest;
import org.dependencytrack.event.kafka.KafkaTopics;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.dependencytrack.event.kafka;
package org.dependencytrack.event.kafka.streams;

import alpine.event.framework.Event;
import alpine.event.framework.EventService;
Expand All @@ -19,6 +19,7 @@
import org.dependencytrack.event.PortfolioVulnerabilityAnalysisEvent;
import org.dependencytrack.event.ProjectMetricsUpdateEvent;
import org.dependencytrack.event.ProjectPolicyEvaluationEvent;
import org.dependencytrack.event.kafka.KafkaTopics;
import org.dependencytrack.event.kafka.serialization.KafkaProtobufSerializer;
import org.dependencytrack.model.Policy;
import org.dependencytrack.model.PolicyCondition;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.dependencytrack.event.kafka.exception;
package org.dependencytrack.event.kafka.streams.exception;

import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.apache.kafka.common.errors.SerializationException;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.dependencytrack.event.kafka.exception;
package org.dependencytrack.event.kafka.streams.exception;

import org.apache.kafka.clients.producer.ProducerRecord;
import org.apache.kafka.common.errors.RecordTooLargeException;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.dependencytrack.event.kafka.exception;
package org.dependencytrack.event.kafka.streams.exception;

import org.apache.kafka.streams.errors.StreamsUncaughtExceptionHandler.StreamThreadExceptionResponse;
import org.junit.Test;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.dependencytrack.event.kafka.processor;
package org.dependencytrack.event.kafka.streams.processor;

import org.apache.kafka.common.serialization.Serdes;
import org.apache.kafka.common.serialization.StringSerializer;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.dependencytrack.event.kafka.processor;
package org.dependencytrack.event.kafka.streams.processor;

import com.google.protobuf.Timestamp;
import org.apache.kafka.common.serialization.StringDeserializer;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.dependencytrack.event.kafka.processor;
package org.dependencytrack.event.kafka.streams.processor;

import com.google.protobuf.Timestamp;
import junitparams.JUnitParamsRunner;
Expand Down

0 comments on commit f906f65

Please sign in to comment.