aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFiete Ostkamp <Fiete.Ostkamp@telekom.de>2024-10-13 15:27:43 +0200
committerFiete Ostkamp <Fiete.Ostkamp@telekom.de>2024-10-17 09:53:19 +0200
commitd567ebe4b4f74ad9ac442cca27c361c971c67e1e (patch)
treec78c964e0a7e06dcdba9ef355aca35421b1e19a8 /src
parentad17eaad323295cd61effc6bb9931e872b9b2d92 (diff)
Upgrade aai-common dependency to 1.15.1-SNAPSHOT
- remove ActiveMq dependency Issue-ID: AAI-4017 Change-Id: Ie475172ad13bc5ddd482822db36f1ce48bc846c9 Signed-off-by: Fiete Ostkamp <Fiete.Ostkamp@telekom.de>
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/onap/aai/migration/Migrator.java35
-rw-r--r--src/main/java/org/onap/aai/migration/NotificationHelper.java9
-rw-r--r--src/main/java/org/onap/aai/util/SendDeleteMigrationNotifications.java10
-rw-r--r--src/main/java/org/onap/aai/util/SendMigrationNotifications.java7
-rw-r--r--src/main/resources/application.properties6
-rw-r--r--src/main/resources/etc/appprops/aaiconfig.properties4
-rw-r--r--src/test/java/org/onap/aai/AAISetup.java3
-rw-r--r--src/test/java/org/onap/aai/util/SendMigrationNotificationsTest.java8
-rw-r--r--src/test/resources/application-test.properties5
-rw-r--r--src/test/resources/etc/appprops/aaiconfig.properties4
10 files changed, 50 insertions, 41 deletions
diff --git a/src/main/java/org/onap/aai/migration/Migrator.java b/src/main/java/org/onap/aai/migration/Migrator.java
index 57291e0..ca9af63 100644
--- a/src/main/java/org/onap/aai/migration/Migrator.java
+++ b/src/main/java/org/onap/aai/migration/Migrator.java
@@ -38,6 +38,7 @@ import org.apache.tinkerpop.gremlin.structure.VertexProperty;
import org.json.JSONException;
import org.json.JSONObject;
import org.onap.aai.aailog.logs.AaiDebugLog;
+import org.onap.aai.config.SpringContextAware;
import org.onap.aai.edges.EdgeIngestor;
import org.onap.aai.edges.enums.EdgeType;
import org.onap.aai.edges.exceptions.AmbiguousRuleChoiceException;
@@ -47,6 +48,7 @@ import org.onap.aai.introspection.Introspector;
import org.onap.aai.introspection.Loader;
import org.onap.aai.introspection.LoaderFactory;
import org.onap.aai.introspection.ModelType;
+import org.onap.aai.kafka.NotificationProducer;
import org.onap.aai.serialization.db.DBSerializer;
import org.onap.aai.serialization.db.EdgeSerializer;
import org.onap.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
@@ -63,7 +65,7 @@ import org.slf4j.MDC;
@MigrationPriority(0)
@MigrationDangerRating(0)
public abstract class Migrator implements Runnable {
-
+
protected Logger logger = null;
protected DBSerializer serializer = null;
@@ -80,7 +82,7 @@ public abstract class Migrator implements Runnable {
protected static final String MIGRATION_ERROR = "Migration Error: ";
protected static final String MIGRATION_SUMMARY_COUNT = "Migration Summary Count: ";
-
+
private static AaiDebugLog debugLog = new AaiDebugLog();
static {
debugLog.setupMDC();
@@ -99,8 +101,9 @@ public abstract class Migrator implements Runnable {
this.edgeIngestor = edgeIngestor;
this.edgeSerializer = edgeSerializer;
this.schemaVersions = schemaVersions;
- initDBSerializer();
- this.notificationHelper = new NotificationHelper(loader, serializer, loaderFactory, schemaVersions, engine, "AAI-MIGRATION", this.getMigrationName());
+ initDBSerializer();
+ NotificationProducer notificationProducer = SpringContextAware.getBean(NotificationProducer.class);
+ this.notificationHelper = new NotificationHelper(notificationProducer, loader, serializer, loaderFactory, schemaVersions, engine, "AAI-MIGRATION", this.getMigrationName());
MDC.put("logFilenameAppender", this.getClass().getSimpleName());
logger = LoggerFactory.getLogger(this.getClass().getSimpleName());
logAndPrint(logger,"\tInitilization of " + this.getClass().getSimpleName() + " migration script complete.");
@@ -141,8 +144,8 @@ public abstract class Migrator implements Runnable {
if (dmaapMsgList.size() > 0) {
try {
Files.write(Paths.get(logDirectory+"/"+fileName), (Iterable<String>)dmaapMsgList.stream()::iterator);
- } catch (IOException e) {
- System.out.println("Unable to generate file with dmaap msgs for " + getMigrationName() +
+ } catch (IOException e) {
+ System.out.println("Unable to generate file with dmaap msgs for " + getMigrationName() +
" Exception is: " + e.getMessage());
logger.error("Unable to generate file with dmaap msgs for " + getMigrationName(), e);
}
@@ -299,7 +302,7 @@ public abstract class Migrator implements Runnable {
}
}
-
+
/**
* Creates the edge
*
@@ -321,7 +324,7 @@ public abstract class Migrator implements Runnable {
}
return newEdge;
}
-
+
/**
* Creates the edge
*
@@ -363,7 +366,7 @@ public abstract class Migrator implements Runnable {
}
/**
- * Creates the TREE edge
+ * Creates the TREE edge
*
* @param out the out
* @param in the in
@@ -373,9 +376,9 @@ public abstract class Migrator implements Runnable {
Edge newEdge = createEdge(EdgeType.TREE, out, in);
return newEdge;
}
-
+
/**
- * Creates the COUSIN edge
+ * Creates the COUSIN edge
*
* @param out the out
* @param in the in
@@ -396,19 +399,19 @@ public abstract class Migrator implements Runnable {
throw new RuntimeException("could not create seralizer", e);
}
}
-
+
/**
* These are the node types you would like your traversal to process
* @return
*/
public abstract Optional<String[]> getAffectedNodeTypes();
-
+
/**
* used as the "fromAppId" when modifying vertices
* @return
*/
public abstract String getMigrationName();
-
+
/**
* updates all internal vertex properties
* @param v
@@ -417,11 +420,11 @@ public abstract class Migrator implements Runnable {
protected void touchVertexProperties(Vertex v, boolean isNewVertex) {
this.serializer.touchStandardVertexProperties(v, isNewVertex);
}
-
+
public NotificationHelper getNotificationHelper() {
return this.notificationHelper;
}
-
+
/**
* Log and print.
*
diff --git a/src/main/java/org/onap/aai/migration/NotificationHelper.java b/src/main/java/org/onap/aai/migration/NotificationHelper.java
index 817e5df..de13dbb 100644
--- a/src/main/java/org/onap/aai/migration/NotificationHelper.java
+++ b/src/main/java/org/onap/aai/migration/NotificationHelper.java
@@ -32,6 +32,7 @@ import org.onap.aai.introspection.Introspector;
import org.onap.aai.introspection.Loader;
import org.onap.aai.introspection.LoaderFactory;
import org.onap.aai.introspection.exceptions.AAIUnknownObjectException;
+import org.onap.aai.kafka.NotificationProducer;
import org.onap.aai.rest.notification.UEBNotification;
import org.onap.aai.serialization.db.DBSerializer;
import org.onap.aai.serialization.engines.TransactionalGraphEngine;
@@ -54,14 +55,16 @@ public class NotificationHelper {
protected final String transactionId;
protected final String sourceOfTruth;
protected final UEBNotification notification;
+ protected final NotificationProducer notificationProducer;
- public NotificationHelper(Loader loader, DBSerializer serializer, LoaderFactory loaderFactory, SchemaVersions schemaVersions, TransactionalGraphEngine engine, String transactionId, String sourceOfTruth) {
+ public NotificationHelper(NotificationProducer notificationProducer, Loader loader, DBSerializer serializer, LoaderFactory loaderFactory, SchemaVersions schemaVersions, TransactionalGraphEngine engine, String transactionId, String sourceOfTruth) {
this.loader = loader;
this.serializer = serializer;
this.engine = engine;
this.transactionId = transactionId;
this.sourceOfTruth = sourceOfTruth;
- this.notification = new UEBNotification(loader, loaderFactory, schemaVersions);
+ this.notification = new UEBNotification(loaderFactory, schemaVersions);
+ this.notificationProducer = notificationProducer;
MDC.put("logFilenameAppender", this.getClass().getSimpleName());
LOGGER = LoggerFactory.getLogger(this.getClass().getSimpleName());
@@ -113,7 +116,7 @@ public class NotificationHelper {
}
public void triggerEvents() throws AAIException {
- notification.triggerEvents();
+ notificationProducer.sendUEBNotification(notification);
}
public UEBNotification getNotifications() {
diff --git a/src/main/java/org/onap/aai/util/SendDeleteMigrationNotifications.java b/src/main/java/org/onap/aai/util/SendDeleteMigrationNotifications.java
index 865dc27..6cb6ed6 100644
--- a/src/main/java/org/onap/aai/util/SendDeleteMigrationNotifications.java
+++ b/src/main/java/org/onap/aai/util/SendDeleteMigrationNotifications.java
@@ -20,12 +20,15 @@
package org.onap.aai.util;
import com.att.eelf.configuration.Configuration;
+
+import org.onap.aai.config.SpringContextAware;
import org.onap.aai.dbmap.AAIGraph;
import org.onap.aai.exceptions.AAIException;
import org.onap.aai.introspection.Introspector;
import org.onap.aai.introspection.Loader;
import org.onap.aai.introspection.LoaderFactory;
import org.onap.aai.introspection.ModelType;
+import org.onap.aai.kafka.NotificationProducer;
import org.onap.aai.migration.EventAction;
import org.onap.aai.migration.NotificationHelper;
import org.onap.aai.serialization.db.DBSerializer;
@@ -66,7 +69,7 @@ public class SendDeleteMigrationNotifications {
protected final LoaderFactory loaderFactory;
protected final SchemaVersions schemaVersions;
protected final SchemaVersion version;
-
+
public SendDeleteMigrationNotifications(LoaderFactory loaderFactory, SchemaVersions schemaVersions, String config, String path, int sleepInMilliSecs, int numToBatch, String requestId, EventAction eventAction, String eventSource) {
System.setProperty("aai.service.name", SendDeleteMigrationNotifications.class.getSimpleName());
Properties props = System.getProperties();
@@ -157,7 +160,8 @@ public class SendDeleteMigrationNotifications {
} catch (AAIException e) {
throw new RuntimeException("could not create serializer", e);
}
- this.notificationHelper = new NotificationHelper(loader, serializer, loaderFactory, schemaVersions, engine, requestId, this.eventSource);
+ NotificationProducer notificationProducer = SpringContextAware.getBean(NotificationProducer.class);
+ this.notificationHelper = new NotificationHelper(notificationProducer, loader, serializer, loaderFactory, schemaVersions, engine, requestId, this.eventSource);
}
protected void initGraph() {
@@ -173,4 +177,4 @@ public class SendDeleteMigrationNotifications {
}
-} \ No newline at end of file
+}
diff --git a/src/main/java/org/onap/aai/util/SendMigrationNotifications.java b/src/main/java/org/onap/aai/util/SendMigrationNotifications.java
index c51de1e..a66e491 100644
--- a/src/main/java/org/onap/aai/util/SendMigrationNotifications.java
+++ b/src/main/java/org/onap/aai/util/SendMigrationNotifications.java
@@ -22,6 +22,7 @@ package org.onap.aai.util;
import com.att.eelf.configuration.Configuration;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
import org.apache.tinkerpop.gremlin.structure.Vertex;
+import org.onap.aai.config.SpringContextAware;
import org.onap.aai.db.props.AAIProperties;
import org.onap.aai.dbmap.AAIGraph;
import org.onap.aai.exceptions.AAIException;
@@ -29,6 +30,7 @@ import org.onap.aai.introspection.Introspector;
import org.onap.aai.introspection.Loader;
import org.onap.aai.introspection.LoaderFactory;
import org.onap.aai.introspection.ModelType;
+import org.onap.aai.kafka.NotificationProducer;
import org.onap.aai.migration.EventAction;
import org.onap.aai.migration.NotificationHelper;
import org.onap.aai.serialization.db.DBSerializer;
@@ -172,7 +174,8 @@ public class SendMigrationNotifications {
} catch (AAIException e) {
throw new RuntimeException("could not create serializer", e);
}
- this.notificationHelper = new NotificationHelper(loader, serializer, loaderFactory, schemaVersions, engine, requestId, this.eventSource);
+ NotificationProducer notificationProducer = SpringContextAware.getBean(NotificationProducer.class);
+ this.notificationHelper = new NotificationHelper(notificationProducer, loader, serializer, loaderFactory, schemaVersions, engine, requestId, this.eventSource);
}
protected void initGraph() {
@@ -188,4 +191,4 @@ public class SendMigrationNotifications {
}
-} \ No newline at end of file
+}
diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties
index 47ab0bc..ba35da5 100644
--- a/src/main/resources/application.properties
+++ b/src/main/resources/application.properties
@@ -32,9 +32,6 @@ server.ssl.trust-store-password=password(OBF:1vn21ugu1saj1v9i1v941sar1ugw1vo0)
server.ssl.client-auth=want
server.ssl.key-store-type=JKS
-# JMS bind address host port
-jms.bind.address=tcp://localhost:61450
-
# dmaap is deprecated and now replaced with kafka
spring.kafka.producer.bootstrap-servers=${BOOTSTRAP_SERVERS}
spring.kafka.producer.properties.security.protocol=SASL_PLAINTEXT
@@ -109,4 +106,7 @@ management.metrics.web.server.auto-time-requests=false
# but doesn't show up in micrometer metrics
aai.actuator.echo.enabled=false
+aai.notifications.enabled=false
+BOOTSTRAP_SERVERS=localhost:9092
+JAAS_CONFIG=
diff --git a/src/main/resources/etc/appprops/aaiconfig.properties b/src/main/resources/etc/appprops/aaiconfig.properties
index b2dd2ed..235cbda 100644
--- a/src/main/resources/etc/appprops/aaiconfig.properties
+++ b/src/main/resources/etc/appprops/aaiconfig.properties
@@ -65,7 +65,7 @@ aai.default.api.version=v14
aai.model.delete.sleep.per.vtx.msec=500
aai.model.query.resultset.maxcount=50
aai.model.query.timeout.sec=90
-
+
# Used by Data Grooming
aai.grooming.default.max.fix=150
aai.grooming.default.sleep.minutes=7
@@ -90,8 +90,6 @@ aai.forceDel.protected.descendant.count=10
aai.ctagPool.rangeString.vplsPe1=2001-2500
aai.ctagPool.rangeString.vplsPe2=2501-3000
-aai.jms.enable=false
-
#used by the dataGrooming and dataSnapshot cleanup tasks
aai.cron.enable.datagroomingcleanup=true
aai.cron.enable.datasnapshotcleanup=true
diff --git a/src/test/java/org/onap/aai/AAISetup.java b/src/test/java/org/onap/aai/AAISetup.java
index 49cc6c4..f0b78f2 100644
--- a/src/test/java/org/onap/aai/AAISetup.java
+++ b/src/test/java/org/onap/aai/AAISetup.java
@@ -64,7 +64,8 @@ import java.util.Map;
XmlFormatTransformerConfiguration.class,
RestBeanConfig.class,
LoaderFactory.class,
- NotificationService.class
+ NotificationService.class,
+ KafkaConfig.class
})
@TestPropertySource(properties = {
"schema.uri.base.path = /aai",
diff --git a/src/test/java/org/onap/aai/util/SendMigrationNotificationsTest.java b/src/test/java/org/onap/aai/util/SendMigrationNotificationsTest.java
index 2f6a4e0..eb2e2a3 100644
--- a/src/test/java/org/onap/aai/util/SendMigrationNotificationsTest.java
+++ b/src/test/java/org/onap/aai/util/SendMigrationNotificationsTest.java
@@ -138,7 +138,7 @@ public class SendMigrationNotificationsTest extends AAISetup {
@Test
public void processEverything() throws Exception {
SendMigrationNotifications s = spy(new SendMigrationNotifications(
- loaderFactory, schemaVersions, REALTIME_CONFIG, FILE, Collections.EMPTY_SET, 0, 0, "test", EventAction.UPDATE, "DMAAP-LOAD"));
+ loaderFactory, schemaVersions, REALTIME_CONFIG, FILE, Collections.emptySet(), 0, 0, "test", EventAction.UPDATE, "DMAAP-LOAD"));
doNothing().when(s).trigger();
doNothing().when(s).cleanup();
s.process("/aai/");
@@ -171,7 +171,7 @@ public class SendMigrationNotificationsTest extends AAISetup {
@Test
public void processEverythingBatched2() throws Exception {
SendMigrationNotifications s = spy(new SendMigrationNotifications(
- loaderFactory, schemaVersions, REALTIME_CONFIG, FILE, Collections.EMPTY_SET, 0, 2, "test", EventAction.UPDATE, "DMAAP-LOAD"));
+ loaderFactory, schemaVersions, REALTIME_CONFIG, FILE, Collections.emptySet(), 0, 2, "test", EventAction.UPDATE, "DMAAP-LOAD"));
doNothing().when(s).trigger();
doNothing().when(s).cleanup();
s.process("/aai/");
@@ -182,7 +182,7 @@ public class SendMigrationNotificationsTest extends AAISetup {
@Test
public void processEverythingBatched3() throws Exception {
SendMigrationNotifications s = spy(new SendMigrationNotifications(
- loaderFactory, schemaVersions, REALTIME_CONFIG, FILE, Collections.EMPTY_SET, 0, 3, "test", EventAction.UPDATE, "DMAAP-LOAD"));
+ loaderFactory, schemaVersions, REALTIME_CONFIG, FILE, Collections.emptySet(), 0, 3, "test", EventAction.UPDATE, "DMAAP-LOAD"));
doNothing().when(s).trigger();
doNothing().when(s).cleanup();
s.process("/aai/");
@@ -190,4 +190,4 @@ public class SendMigrationNotificationsTest extends AAISetup {
}
-} \ No newline at end of file
+}
diff --git a/src/test/resources/application-test.properties b/src/test/resources/application-test.properties
index d5b47d2..74d5d49 100644
--- a/src/test/resources/application-test.properties
+++ b/src/test/resources/application-test.properties
@@ -34,9 +34,6 @@ server.port=8449
security.require-ssl=false
server.ssl.enabled=false
-# JMS bind address host port
-jms.bind.address=tcp://localhost:61450
-
# Schema related attributes for the oxm and edges
# Any additional schema related attributes should start with prefix schema
schema.configuration.location=N/A
@@ -79,3 +76,5 @@ management.server.port=0
management.endpoints.enabled-by-default=true
management.endpoints.web.exposure.include=info, health, loggers, prometheus
management.metrics.web.server.auto-time-requests=false
+
+aai.notifications.enabled=false
diff --git a/src/test/resources/etc/appprops/aaiconfig.properties b/src/test/resources/etc/appprops/aaiconfig.properties
index b2dd2ed..235cbda 100644
--- a/src/test/resources/etc/appprops/aaiconfig.properties
+++ b/src/test/resources/etc/appprops/aaiconfig.properties
@@ -65,7 +65,7 @@ aai.default.api.version=v14
aai.model.delete.sleep.per.vtx.msec=500
aai.model.query.resultset.maxcount=50
aai.model.query.timeout.sec=90
-
+
# Used by Data Grooming
aai.grooming.default.max.fix=150
aai.grooming.default.sleep.minutes=7
@@ -90,8 +90,6 @@ aai.forceDel.protected.descendant.count=10
aai.ctagPool.rangeString.vplsPe1=2001-2500
aai.ctagPool.rangeString.vplsPe2=2501-3000
-aai.jms.enable=false
-
#used by the dataGrooming and dataSnapshot cleanup tasks
aai.cron.enable.datagroomingcleanup=true
aai.cron.enable.datasnapshotcleanup=true