<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
</dependency>
+ <dependency>
+ <groupId>io.prometheus</groupId>
+ <artifactId>simpleclient_hotspot</artifactId>
+ </dependency>
</dependencies>
</project>
private static final Logger logger = LoggerFactory.getLogger(EndToEndFeatureTest.class);
/**
- * UEB servers for both internal & external topics.
+ * KAFKA servers for both internal & external topics.
*/
- private static final String UEB_SERVERS = "ueb-server";
+ private static final String SERVER = "localhost:9092";
/**
* Name of the topic used for inter-host communication.
private static final String CONTROLLER1 = "controller.one";
/**
- * Maximum number of items to fetch from DMaaP in a single poll.
+ * Maximum number of items to fetch from Kafka in a single poll.
*/
private static final String FETCH_LIMIT = "5";
private static final ThreadLocal<Host> currentHost = new ThreadLocal<Host>();
/**
- * Sink for external DMaaP topic.
+ * Sink for external Kafka topic.
*/
private static TopicSink externalSink;
/**
- * Sink for internal DMaaP topic.
+ * Sink for internal Kafka topic.
*/
private static TopicSink internalSink;
private static Properties makeSinkProperties(String topic) {
Properties props = new Properties();
- props.setProperty(PolicyEndPointProperties.PROPERTY_UEB_SINK_TOPICS, topic);
+ props.setProperty(PolicyEndPointProperties.PROPERTY_KAFKA_SINK_TOPICS, topic);
- props.setProperty(PolicyEndPointProperties.PROPERTY_UEB_SINK_TOPICS + "." + topic
- + PolicyEndPointProperties.PROPERTY_TOPIC_SERVERS_SUFFIX, UEB_SERVERS);
- props.setProperty(PolicyEndPointProperties.PROPERTY_UEB_SINK_TOPICS + "." + topic
+ props.setProperty(PolicyEndPointProperties.PROPERTY_KAFKA_SINK_TOPICS + "." + topic
+ + PolicyEndPointProperties.PROPERTY_TOPIC_SERVERS_SUFFIX, SERVER);
+ props.setProperty(PolicyEndPointProperties.PROPERTY_KAFKA_SINK_TOPICS + "." + topic
+ PolicyEndPointProperties.PROPERTY_TOPIC_SINK_PARTITION_KEY_SUFFIX, "0");
- props.setProperty(PolicyEndPointProperties.PROPERTY_UEB_SINK_TOPICS + "." + topic
+ props.setProperty(PolicyEndPointProperties.PROPERTY_KAFKA_SINK_TOPICS + "." + topic
+ PolicyEndPointProperties.PROPERTY_MANAGED_SUFFIX, "false");
return props;
props.setProperty(PolicyEndPointProperties.PROPERTY_UEB_SOURCE_TOPICS, topic);
props.setProperty(PolicyEndPointProperties.PROPERTY_UEB_SOURCE_TOPICS + "." + topic
- + PolicyEndPointProperties.PROPERTY_TOPIC_SERVERS_SUFFIX, UEB_SERVERS);
+ + PolicyEndPointProperties.PROPERTY_TOPIC_SERVERS_SUFFIX, SERVER);
props.setProperty(PolicyEndPointProperties.PROPERTY_UEB_SOURCE_TOPICS + "." + topic
+ PolicyEndPointProperties.PROPERTY_TOPIC_SOURCE_FETCH_LIMIT_SUFFIX, FETCH_LIMIT);
props.setProperty(PolicyEndPointProperties.PROPERTY_UEB_SOURCE_TOPICS + "." + topic
* Starts the hosts.
*/
public void startHosts() {
- hosts.forEach(host -> host.start());
+ hosts.forEach(Host::start);
}
/**
* Stops the hosts.
*/
public void stopHosts() {
- hosts.forEach(host -> host.stop());
+ hosts.forEach(Host::stop);
}
/**
when(controller.getName()).thenReturn(CONTROLLER1);
when(controller.getDrools()).thenReturn(drools);
- externalSource = TopicEndpointManager.getManager().addTopicSources(makeSourceProperties(EXTERNAL_TOPIC))
- .get(0);
- internalSource = TopicEndpointManager.getManager().addTopicSources(makeSourceProperties(INTERNAL_TOPIC))
- .get(0);
+ externalSource = TopicEndpointManager.getManager()
+ .addTopicSources(makeSourceProperties(EXTERNAL_TOPIC)).get(0);
+ internalSource = TopicEndpointManager.getManager()
+ .addTopicSources(makeSourceProperties(INTERNAL_TOPIC)).get(0);
// stop consuming events if the controller stops
when(controller.stop()).thenAnswer(args -> {
if (!host.beforeInsert(fact)) {
// feature did not handle it so we handle it here
- host.afterInsert(fact, result);
+ host.afterInsert(fact, true);
host.sawMessage();
context.addEvent();
if (msg == null) {
return;
}
- listener.onTopicEvent(CommInfrastructure.UEB, topic, msg);
+ listener.onTopicEvent(CommInfrastructure.KAFKA, topic, msg);
}
}
}
@Test
void testBeforeOffer() {
- assertFalse(pool.beforeOffer(controller1, CommInfrastructure.UEB, TOPIC1, EVENT1));
+ assertFalse(pool.beforeOffer(controller1, CommInfrastructure.KAFKA, TOPIC1, EVENT1));
verify(mgr1).beforeOffer(TOPIC1, EVENT1);
// ensure that the args were captured
// ensure it's still in the map by re-invoking
- assertFalse(pool.beforeOffer(controller1, CommInfrastructure.UEB, TOPIC2, EVENT2));
+ assertFalse(pool.beforeOffer(controller1, CommInfrastructure.KAFKA, TOPIC2, EVENT2));
verify(mgr1).beforeOffer(TOPIC2, EVENT2);
// ensure that the new args were captured
verify(mgr1).beforeInsert(TOPIC2, OBJECT2);
- assertFalse(pool.beforeOffer(controllerDisabled, CommInfrastructure.UEB, TOPIC1, EVENT1));
+ assertFalse(pool.beforeOffer(controllerDisabled, CommInfrastructure.KAFKA, TOPIC1, EVENT1));
}
@Test
void testBeforeOffer_NotFound() {
- assertFalse(pool.beforeOffer(controllerDisabled, CommInfrastructure.UEB, TOPIC1, EVENT1));
+ assertFalse(pool.beforeOffer(controllerDisabled, CommInfrastructure.KAFKA, TOPIC1, EVENT1));
}
@Test
// manager will return true
when(mgr1.beforeOffer(any(), any())).thenReturn(true);
- assertTrue(pool.beforeOffer(controller1, CommInfrastructure.UEB, TOPIC1, EVENT1));
+ assertTrue(pool.beforeOffer(controller1, CommInfrastructure.KAFKA, TOPIC1, EVENT1));
verify(mgr1).beforeOffer(TOPIC1, EVENT1);
// ensure it's still in the map by re-invoking
- assertTrue(pool.beforeOffer(controller1, CommInfrastructure.UEB, TOPIC2, EVENT2));
+ assertTrue(pool.beforeOffer(controller1, CommInfrastructure.KAFKA, TOPIC2, EVENT2));
verify(mgr1).beforeOffer(TOPIC2, EVENT2);
- assertFalse(pool.beforeOffer(controllerDisabled, CommInfrastructure.UEB, TOPIC1, EVENT1));
+ assertFalse(pool.beforeOffer(controllerDisabled, CommInfrastructure.KAFKA, TOPIC1, EVENT1));
}
@Test
void testBeforeInsert() {
- pool.beforeOffer(controller1, CommInfrastructure.UEB, TOPIC1, EVENT1);
+ pool.beforeOffer(controller1, CommInfrastructure.KAFKA, TOPIC1, EVENT1);
assertFalse(pool.beforeInsert(drools1, OBJECT1));
verify(mgr1).beforeInsert(TOPIC1, OBJECT1);
// ensure it's still in the map by re-invoking
- pool.beforeOffer(controller1, CommInfrastructure.UEB, TOPIC2, EVENT2);
+ pool.beforeOffer(controller1, CommInfrastructure.KAFKA, TOPIC2, EVENT2);
assertFalse(pool.beforeInsert(drools1, OBJECT2));
verify(mgr1).beforeInsert(TOPIC2, OBJECT2);
- pool.beforeOffer(controllerDisabled, CommInfrastructure.UEB, TOPIC2, EVENT2);
+ pool.beforeOffer(controllerDisabled, CommInfrastructure.KAFKA, TOPIC2, EVENT2);
assertFalse(pool.beforeInsert(droolsDisabled, OBJECT1));
}
}
};
- pool.beforeOffer(controller1, CommInfrastructure.UEB, TOPIC1, EVENT1);
+ pool.beforeOffer(controller1, CommInfrastructure.KAFKA, TOPIC1, EVENT1);
assertFalse(pool.beforeInsert(drools1, OBJECT1));
verify(mgr1, never()).beforeInsert(any(), any());
}
}
};
- pool.beforeOffer(controller1, CommInfrastructure.UEB, TOPIC1, EVENT1);
+ pool.beforeOffer(controller1, CommInfrastructure.KAFKA, TOPIC1, EVENT1);
assertFalse(pool.beforeInsert(drools1, OBJECT1));
verify(mgr1, never()).beforeInsert(any(), any());
}
}
};
- pool.beforeOffer(controller1, CommInfrastructure.UEB, TOPIC1, EVENT1);
+ pool.beforeOffer(controller1, CommInfrastructure.KAFKA, TOPIC1, EVENT1);
assertFalse(pool.beforeInsert(drools1, OBJECT1));
verify(mgr1, never()).beforeInsert(any(), any());
}
@Test
void testBeforeInsert_NotFound() {
- pool.beforeOffer(controllerDisabled, CommInfrastructure.UEB, TOPIC2, EVENT2);
+ pool.beforeOffer(controllerDisabled, CommInfrastructure.KAFKA, TOPIC2, EVENT2);
assertFalse(pool.beforeInsert(droolsDisabled, OBJECT1));
}
@Test
void testAfterOffer() {
// this will create OfferArgs
- pool.beforeOffer(controller1, CommInfrastructure.UEB, TOPIC1, EVENT1);
+ pool.beforeOffer(controller1, CommInfrastructure.KAFKA, TOPIC1, EVENT1);
// this should clear them
- assertFalse(pool.afterOffer(controller1, CommInfrastructure.UEB, TOPIC2, EVENT2, true));
+ assertFalse(pool.afterOffer(controller1, CommInfrastructure.KAFKA, TOPIC2, EVENT2, true));
assertFalse(pool.beforeInsert(drools1, OBJECT1));
verify(mgr1, never()).beforeInsert(any(), any());
import static org.mockito.Mockito.when;
import java.util.LinkedList;
+import java.util.Objects;
import java.util.Properties;
import java.util.Queue;
import java.util.concurrent.CountDownLatch;
}
@Test
- void testOnTopicEvent() throws Exception {
+ void testOnTopicEvent() {
startMgr();
StartState st = (StartState) mgr.getCurrent();
String msg = ser.encodeMsg(hb);
- mgr.onTopicEvent(CommInfrastructure.UEB, MY_TOPIC, msg);
+ mgr.onTopicEvent(CommInfrastructure.KAFKA, MY_TOPIC, msg);
assertInstanceOf(QueryState.class, mgr.getCurrent());
}
@Test
- void testOnTopicEvent_NullEvent() throws Exception {
+ void testOnTopicEvent_NullEvent() {
startMgr();
- assertThatCode(() -> mgr.onTopicEvent(CommInfrastructure.UEB, TOPIC2, null)).doesNotThrowAnyException();
+ assertThatCode(() -> mgr.onTopicEvent(CommInfrastructure.KAFKA, TOPIC2, null)).doesNotThrowAnyException();
}
@Test
@Test
void testHandleExternalCommInfrastructureStringStringString_NullReqId() throws Exception {
- validateHandleReqId(null);
+ validateHandleReqId();
}
@Test
void testHandleExternalCommInfrastructureStringStringString_EmptyReqId() throws Exception {
- validateHandleReqId("");
+ validateHandleReqId();
}
@Test
String msg = ser.encodeMsg(hb);
- mgr.onTopicEvent(CommInfrastructure.UEB, MY_TOPIC, msg);
+ mgr.onTopicEvent(CommInfrastructure.KAFKA, MY_TOPIC, msg);
assertInstanceOf(QueryState.class, mgr.getCurrent());
}
void testHandleInternal_IoEx() throws Exception {
startMgr();
- mgr.onTopicEvent(CommInfrastructure.UEB, MY_TOPIC, "invalid message");
+ mgr.onTopicEvent(CommInfrastructure.KAFKA, MY_TOPIC, "invalid message");
assertInstanceOf(StartState.class, mgr.getCurrent());
}
String msg = ser.encodeMsg(hb);
- mgr.onTopicEvent(CommInfrastructure.UEB, MY_TOPIC, msg);
+ mgr.onTopicEvent(CommInfrastructure.KAFKA, MY_TOPIC, msg);
assertInstanceOf(StartState.class, mgr.getCurrent());
}
String msg = ser.encodeMsg(hb);
- mgr.onTopicEvent(CommInfrastructure.UEB, MY_TOPIC, msg);
+ mgr.onTopicEvent(CommInfrastructure.KAFKA, MY_TOPIC, msg);
assertInstanceOf(QueryState.class, mgr.getCurrent());
assertEquals(1, latch.getCount());
}
- private void validateHandleReqId(String requestId) throws PoolingFeatureException {
+ private void validateHandleReqId() {
startMgr();
assertFalse(mgr.beforeInsert(TOPIC2, DECODED_EVENT));
verify(topicMessageManager, times(START_PUB)).publish(any());
}
- private void validateUnhandled() throws PoolingFeatureException {
+ private void validateUnhandled() {
startMgr();
assertFalse(mgr.beforeInsert(TOPIC2, DECODED_EVENT));
}
@Override
protected Object decodeEventWrapper(DroolsController drools2, String topic2, String event) {
- if (drools2 == drools && TOPIC2.equals(topic2) && event == THE_EVENT) {
+ if (drools2 == drools && TOPIC2.equals(topic2) && Objects.equals(event, THE_EVENT)) {
return DECODED_EVENT;
} else {
return null;
<version>1.10.14</version>
</dependency>
+ <dependency>
+ <groupId>org.mvel</groupId>
+ <artifactId>mvel2</artifactId>
+ <version>2.5.2.Final</version>
+ </dependency>
+
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-ci</artifactId>
- <!--
- Issue: 2 of 2
- Excluding these 2 dependencies in order to force upgrade security fixes
- identified. As declared above. Any changes here should be reflected above
- and vice versa.
- -->
- <exclusions>
- <exclusion>
- <groupId>org.apache.ant</groupId>
- <artifactId>ant</artifactId>
- </exclusion>
- </exclusions>
</dependency>
<dependency>
ONAP
================================================================================
Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
- Modifications Copyright (C) 2023 Nordix Foundation.
+ Modifications Copyright (C) 2023-2024 Nordix Foundation.
================================================================================
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
<description>domain policies</description>
<dependencies>
-
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</dependency>
-
<dependency>
<groupId>com.openpojo</groupId>
<artifactId>openpojo</artifactId>
<scope>test</scope>
</dependency>
-
<dependency>
<groupId>org.onap.policy.common</groupId>
<artifactId>utils</artifactId>
<version>${policy.common.version}</version>
<scope>test</scope>
</dependency>
-
<dependency>
<groupId>org.onap.policy.drools-pdp</groupId>
<artifactId>policy-utils</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
-
+ <dependency>
+ <groupId>org.onap.policy.models</groupId>
+ <artifactId>policy-models-examples</artifactId>
+ <version>${policy.models.version}</version>
+ </dependency>
</dependencies>
</project>
ONAP Policy Engine - Drools PDP
================================================================================
Copyright (C) 2017-2022 AT&T Intellectual Property. All rights reserved.
- Modifications Copyright (C) 2020,2023 Nordix Foundation.
+ Modifications Copyright (C) 2020, 2023-2024 Nordix Foundation.
================================================================================
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
<build>
<plugins>
<plugin>
+ <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
</executions>
</plugin>
<plugin>
+ <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<artifactId>utils</artifactId>
<version>${policy.common.version}</version>
</dependency>
-
<dependency>
<groupId>org.onap.policy.models</groupId>
<artifactId>policy-models-pdp</artifactId>
<version>${policy.models.version}</version>
</dependency>
-
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlet</artifactId>
</dependency>
-
- <dependency>
- <groupId>com.google.code.gson</groupId>
- <artifactId>gson</artifactId>
- </dependency>
<dependency>
<groupId>com.fatboyindustrial.gson-javatime-serialisers</groupId>
<artifactId>gson-javatime-serialisers</artifactId>
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
</dependency>
-
- <!-- if we don't explicitly specify the version here, we seem to end up
- with version 1.4 (as a dependency to drools-core). This version is
- not compatible with 'saClientLibrary' version 1.2.1-oss
- -->
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-jexl3</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.glassfish.jersey.inject</groupId>
+ <artifactId>jersey-hk2</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.prometheus</groupId>
+ <artifactId>simpleclient_servlet_jakarta</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.prometheus</groupId>
+ <artifactId>simpleclient_hotspot</artifactId>
+ <scope>runtime</scope>
+ </dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.apache.kafka</groupId>
+ <artifactId>kafka-clients</artifactId>
+ </dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-annotations</artifactId>
</dependency>
+ <dependency>
+ <groupId>io.swagger.core.v3</groupId>
+ <artifactId>swagger-jaxrs2-servlet-initializer-v2-jakarta</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.swagger.core.v3</groupId>
+ <artifactId>swagger-jaxrs2-jakarta</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>jakarta.servlet</groupId>
+ <artifactId>jakarta.servlet-api</artifactId>
+ </dependency>
</dependencies>
</project>
private String getPropertyTopicPrefix(Topic topic) {
boolean isSource = topic instanceof TopicSource;
var commInfra = topic.getTopicCommInfrastructure();
- if (commInfra == CommInfrastructure.UEB) {
- if (isSource) {
- return PolicyEndPointProperties.PROPERTY_UEB_SOURCE_TOPICS + ".";
- } else {
- return PolicyEndPointProperties.PROPERTY_UEB_SINK_TOPICS + ".";
- }
- } else if (commInfra == CommInfrastructure.NOOP) {
+ if (commInfra == CommInfrastructure.NOOP) {
if (isSource) {
return PolicyEndPointProperties.PROPERTY_NOOP_SOURCE_TOPICS + ".";
} else {
public static final String DEFAULT_CONFIGURATION_DIR = "config";
/**
- * Persistence Manager. For now it is a file-based properties management, In the future, it will
+ * Persistence Manager. For now, it is a file-based properties management, In the future, it will
* probably be DB based, so manager implementation will change.
*/
@Getter
*/
@Override
@GET
- @Path("engine/topics/sources/{comm: ueb|kafka|noop}")
+ @Path("engine/topics/sources/{comm: kafka|noop}")
public Response commSources(
@PathParam("comm") String comm) {
if (!checkValidNameInput(comm)) {
List<TopicSource> sources = new ArrayList<>();
var status = Status.OK;
switch (CommInfrastructure.valueOf(comm.toUpperCase())) {
- case UEB:
- sources.addAll(TopicEndpointManager.getManager().getUebTopicSources());
- break;
case NOOP:
sources.addAll(TopicEndpointManager.getManager().getNoopTopicSources());
break;
*/
@Override
@GET
- @Path("engine/topics/sinks/{comm: ueb|kafka|noop}")
+ @Path("engine/topics/sinks/{comm: kafka|noop}")
public Response commSinks(
@PathParam("comm") String comm) {
if (!checkValidNameInput(comm)) {
List<TopicSink> sinks = new ArrayList<>();
var status = Status.OK;
switch (CommInfrastructure.valueOf(comm.toUpperCase())) {
- case UEB:
- sinks.addAll(TopicEndpointManager.getManager().getUebTopicSinks());
- break;
case NOOP:
sinks.addAll(TopicEndpointManager.getManager().getNoopTopicSinks());
break;
*/
@Override
@GET
- @Path("engine/topics/sources/{comm: ueb|kafka|noop}/{topic}")
+ @Path("engine/topics/sources/{comm: kafka|noop}/{topic}")
public Response sourceTopic(
@PathParam("comm") String comm,
@PathParam("topic") String topic) {
*/
@Override
@GET
- @Path("engine/topics/sinks/{comm: ueb|kafka|noop}/{topic}")
+ @Path("engine/topics/sinks/{comm: kafka|noop}/{topic}")
public Response sinkTopic(
@PathParam("comm") String comm,
@PathParam("topic") String topic) {
*/
@Override
@GET
- @Path("engine/topics/sources/{comm: ueb|kafka|noop}/{topic}/events")
+ @Path("engine/topics/sources/{comm: kafka|noop}/{topic}/events")
public Response sourceEvents(
@PathParam("comm") String comm,
@PathParam("topic") String topic) {
*/
@Override
@GET
- @Path("engine/topics/sinks/{comm: ueb|kafka|noop}/{topic}/events")
+ @Path("engine/topics/sinks/{comm: kafka|noop}/{topic}/events")
public Response sinkEvents(
@PathParam("comm") String comm,
@PathParam("topic") String topic) {
*/
@Override
@GET
- @Path("engine/topics/sources/{comm: ueb|kafka|noop}/{topic}/switches")
+ @Path("engine/topics/sources/{comm: kafka|noop}/{topic}/switches")
public Response commSourceTopicSwitches(
@PathParam("comm") String comm,
@PathParam("topic") String topic) {
*/
@Override
@GET
- @Path("engine/topics/sinks/{comm: ueb|kafka|noop}/{topic}/switches")
+ @Path("engine/topics/sinks/{comm: kafka|noop}/{topic}/switches")
public Response commSinkTopicSwitches(
@PathParam("comm") String comm,
@PathParam("topic") String topic) {
*/
@Override
@PUT
- @Path("engine/topics/sources/{comm: ueb|kafka|noop}/{topic}/switches/lock")
+ @Path("engine/topics/sources/{comm: kafka|noop}/{topic}/switches/lock")
public Response commSourceTopicLock(
@PathParam("comm") String comm,
@PathParam("topic") String topic) {
*/
@Override
@DELETE
- @Path("engine/topics/sources/{comm: ueb|kafka|noop}/{topic}/switches/lock")
+ @Path("engine/topics/sources/{comm: kafka|noop}/{topic}/switches/lock")
public Response commSourceTopicUnlock(
@PathParam("comm") String comm,
@PathParam("topic") String topic) {
*/
@Override
@PUT
- @Path("engine/topics/sources/{comm: ueb|kafka|noop}/{topic}/switches/activation")
+ @Path("engine/topics/sources/{comm: kafka|noop}/{topic}/switches/activation")
public Response commSourceTopicActivation(
@PathParam("comm") String comm,
@PathParam("topic") String topic) {
*/
@Override
@DELETE
- @Path("engine/topics/sources/{comm: ueb|kafka|noop}/{topic}/switches/activation")
+ @Path("engine/topics/sources/{comm: kafka|noop}/{topic}/switches/activation")
public Response commSourceTopicDeactivation(
@PathParam("comm") String comm,
@PathParam("topic") String topic) {
*/
@Override
@PUT
- @Path("engine/topics/sinks/{comm: ueb|kafka|noop}/{topic}/switches/lock")
+ @Path("engine/topics/sinks/{comm: kafka|noop}/{topic}/switches/lock")
public Response commSinkTopicLock(
@PathParam("comm") String comm,
@PathParam("topic") String topic) {
*/
@Override
@DELETE
- @Path("engine/topics/sinks/{comm: ueb|kafka|noop}/{topic}/switches/lock")
+ @Path("engine/topics/sinks/{comm: kafka|noop}/{topic}/switches/lock")
public Response commSinkTopicUnlock(
@PathParam("comm") String comm,
@PathParam("topic") String topic) {
*/
@Override
@PUT
- @Path("engine/topics/sinks/{comm: ueb|kafka|noop}/{topic}/switches/activation")
+ @Path("engine/topics/sinks/{comm: kafka|noop}/{topic}/switches/activation")
public Response commSinkTopicActivation(
@PathParam("comm") String comm,
@PathParam("topic") String topic) {
*/
@Override
@DELETE
- @Path("engine/topics/sinks/{comm: ueb|kafka|noop}/{topic}/switches/activation")
+ @Path("engine/topics/sinks/{comm: kafka|noop}/{topic}/switches/activation")
public Response commSinkTopicDeactivation(
@PathParam("comm") String comm,
@PathParam("topic") String topic) {
*/
@Override
@PUT
- @Path("engine/topics/sources/{comm: ueb|kafka|noop}/{topic}/events")
+ @Path("engine/topics/sources/{comm: kafka|noop}/{topic}/events")
@Consumes(MediaType.TEXT_PLAIN)
public Response commEventOffer(
@PathParam("comm") String comm,
* ONAP
* ================================================================================
* Copyright (C) 2017-2021 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2024 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
try {
engineProperties = SystemPersistenceConstants.getManager().getEngineProperties();
} catch (IllegalArgumentException iae) {
- logger.warn("Main: engine properties not found. Using default configuration.", iae);
+ logger.warn("Main: engine properties not found. Using default configuration. {}", iae.getMessage());
engineProperties = PolicyEngineConstants.getManager().defaultTelemetryConfig();
}
tags:
- pdp-d-telemetry
summary: Retrieves the managed topic sources
- description: Network Topic Sources Agregation
+ description: Network Topic Sources Aggregation
operationId: sources
responses:
200:
tags:
- pdp-d-telemetry
summary: Retrieves the managed topic sinks
- description: Network Topic Sinks Agregation
+ description: Network Topic Sinks Aggregation
operationId: sinks
responses:
200:
description: Communication Mechanism
required: true
schema:
- pattern: ueb|dmaap|noop
+ pattern: kafka|noop
type: string
responses:
200:
description: Communication Mechanism
required: true
schema:
- pattern: ueb|dmaap|noop
+ pattern: kafka|noop
type: string
responses:
200:
description: Communication Mechanism
required: true
schema:
- pattern: ueb|dmaap|noop
+ pattern: kafka|noop
type: string
- name: topic
in: path
tags:
- pdp-d-telemetry
summary: Retrieves a managed topic sink
- description: This is a Network Communicaton Endpoint destination of messages
+ description: This is a Network Communication Endpoint destination of messages
from the Engine
operationId: sinkTopic
parameters:
description: Communication Mechanism
required: true
schema:
- pattern: ueb|dmaap|noop
+ pattern: kafka|noop
type: string
- name: topic
in: path
description: Communication Mechanism
required: true
schema:
- pattern: ueb|dmaap|noop
+ pattern: kafka|noop
type: string
- name: topic
in: path
description: Communication Mechanism
required: true
schema:
- pattern: ueb|dmaap|noop
+ pattern: kafka|noop
type: string
- name: topic
in: path
tags:
- pdp-d-telemetry
summary: Retrieves the latest events received by an UEB topic
- description: This is a Network Communicaton Endpoint source of messages for
+ description: This is a Network Communication Endpoint source of messages for
the Engine
operationId: sinkEvents
parameters:
description: Communication Mechanism
required: true
schema:
- pattern: ueb|dmaap|noop
+ pattern: kafka|noop
type: string
- name: topic
in: path
description: Communication Mechanism
required: true
schema:
- pattern: ueb|dmaap|noop
+ pattern: kafka|noop
type: string
- name: topic
in: path
description: Communication Mechanism
required: true
schema:
- pattern: ueb|dmaap|noop
+ pattern: kafka|noop
type: string
- name: topic
in: path
description: Communication Mechanism
required: true
schema:
- pattern: ueb|dmaap|noop
+ pattern: kafka|noop
type: string
- name: topic
in: path
description: Communication Mechanism
required: true
schema:
- pattern: ueb|dmaap|noop
+ pattern: kafka|noop
type: string
- name: topic
in: path
description: Communication Mechanism
required: true
schema:
- pattern: ueb|dmaap|noop
+ pattern: kafka|noop
type: string
- name: topic
in: path
description: Communication Mechanism
required: true
schema:
- pattern: ueb|dmaap|noop
+ pattern: kafka|noop
type: string
- name: topic
in: path
description: Communication Mechanism
required: true
schema:
- pattern: ueb|dmaap|noop
+ pattern: kafka|noop
type: string
- name: topic
in: path
description: Communication Mechanism
required: true
schema:
- pattern: ueb|dmaap|noop
+ pattern: kafka|noop
type: string
- name: topic
in: path
description: Communication Mechanism
required: true
schema:
- pattern: ueb|dmaap|noop
+ pattern: kafka|noop
type: string
- name: topic
in: path
description: Communication Mechanism
required: true
schema:
- pattern: ueb|dmaap|noop
+ pattern: kafka|noop
type: string
- name: topic
in: path
tags:
- pdp-d-legacy
summary: Legacy Engine Configuration Properties
- description: Used for booststrapping the engine
+ description: Used for bootstrapping the engine
operationId: properties
responses:
200:
$ref: '#/components/schemas/CoderFilters'
customCoder:
$ref: '#/components/schemas/CustomCoder'
- DmaapTopicSink:
- type: object
- properties:
- partitionKey:
- type: string
- apiKey:
- type: string
- apiSecret:
- type: string
- effectiveTopic:
- type: string
- recentEvents:
- type: array
- items:
- type: string
- topic:
- type: string
- servers:
- type: array
- items:
- type: string
- topicCommInfrastructure:
- type: string
- enum:
- - UEB
- - DMAAP
- - KAFKA
- - NOOP
- - REST
- alive:
- type: boolean
- locked:
- type: boolean
- DmaapTopicSource:
- type: object
- properties:
- consumerInstance:
- type: string
- consumerGroup:
- type: string
- fetchTimeout:
- type: integer
- format: int32
- fetchLimit:
- type: integer
- format: int32
- apiKey:
- type: string
- apiSecret:
- type: string
- effectiveTopic:
- type: string
- recentEvents:
- type: array
- items:
- type: string
- topic:
- type: string
- servers:
- type: array
- items:
- type: string
- topicCommInfrastructure:
- type: string
- enum:
- - UEB
- - DMAAP
- - KAFKA
- - NOOP
- - REST
- alive:
- type: boolean
- locked:
- type: boolean
KafkaTopicSink:
type: object
properties:
topicCommInfrastructure:
type: string
enum:
- - UEB
- - DMAAP
- KAFKA
- NOOP
- REST
topicCommInfrastructure:
type: string
enum:
- - UEB
- - DMAAP
- KAFKA
- NOOP
- REST
topicCommInfrastructure:
type: string
enum:
- - UEB
- - DMAAP
- KAFKA
- NOOP
- REST
TopicEndpoint:
type: object
properties:
- uebTopicSources:
- type: array
- items:
- $ref: '#/components/schemas/UebTopicSource'
- uebTopicSinks:
- type: array
- items:
- $ref: '#/components/schemas/UebTopicSink'
- dmaapTopicSinks:
- type: array
- items:
- $ref: '#/components/schemas/DmaapTopicSink'
kafkaTopicSinks:
type: array
items:
type: array
items:
$ref: '#/components/schemas/NoopTopicSink'
- dmaapTopicSources:
- type: array
- items:
- $ref: '#/components/schemas/DmaapTopicSource'
kafkaTopicSources:
type: array
items:
type: boolean
locked:
type: boolean
- UebTopicSink:
- type: object
- properties:
- partitionKey:
- type: string
- apiKey:
- type: string
- apiSecret:
- type: string
- effectiveTopic:
- type: string
- recentEvents:
- type: array
- items:
- type: string
- topic:
- type: string
- servers:
- type: array
- items:
- type: string
- topicCommInfrastructure:
- type: string
- enum:
- - UEB
- - DMAAP
- - KAFKA
- - NOOP
- - REST
- alive:
- type: boolean
- locked:
- type: boolean
- UebTopicSource:
- type: object
- properties:
- consumerInstance:
- type: string
- consumerGroup:
- type: string
- fetchTimeout:
- type: integer
- format: int32
- fetchLimit:
- type: integer
- format: int32
- apiKey:
- type: string
- apiSecret:
- type: string
- effectiveTopic:
- type: string
- recentEvents:
- type: array
- items:
- type: string
- topic:
- type: string
- servers:
- type: array
- items:
- type: string
- topicCommInfrastructure:
- type: string
- enum:
- - UEB
- - DMAAP
- - KAFKA
- - NOOP
- - REST
- alive:
- type: boolean
- locked:
- type: boolean
PdpdConfiguration:
type: object
properties:
"get" : {
"tags" : [ "pdp-d-telemetry" ],
"summary" : "Retrieves the managed topic sources",
- "description" : "Network Topic Sources Agregation",
+ "description" : "Network Topic Sources Aggregation",
"operationId" : "sources",
"responses" : {
"200" : {
"get" : {
"tags" : [ "pdp-d-telemetry" ],
"summary" : "Retrieves the managed topic sinks",
- "description" : "Network Topic Sinks Agregation",
+ "description" : "Network Topic Sinks Aggregation",
"operationId" : "sinks",
"responses" : {
"200" : {
"style" : "simple",
"explode" : false,
"schema" : {
- "pattern" : "ueb|dmaap|noop",
+ "pattern" : "kafka|noop",
"type" : "string"
}
} ],
"style" : "simple",
"explode" : false,
"schema" : {
- "pattern" : "ueb|dmaap|noop",
+ "pattern" : "kafka|noop",
"type" : "string"
}
} ],
"style" : "simple",
"explode" : false,
"schema" : {
- "pattern" : "ueb|dmaap|noop",
+ "pattern" : "kafka|noop",
"type" : "string"
}
}, {
"get" : {
"tags" : [ "pdp-d-telemetry" ],
"summary" : "Retrieves a managed topic sink",
- "description" : "This is a Network Communicaton Endpoint destination of messages from the Engine",
+ "description" : "This is a Network Communication Endpoint destination of messages from the Engine",
"operationId" : "sinkTopic",
"parameters" : [ {
"name" : "comm",
"style" : "simple",
"explode" : false,
"schema" : {
- "pattern" : "ueb|dmaap|noop",
+ "pattern" : "kafka|noop",
"type" : "string"
}
}, {
"style" : "simple",
"explode" : false,
"schema" : {
- "pattern" : "ueb|dmaap|noop",
+ "pattern" : "kafka|noop",
"type" : "string"
}
}, {
"style" : "simple",
"explode" : false,
"schema" : {
- "pattern" : "ueb|dmaap|noop",
+ "pattern" : "kafka|noop",
"type" : "string"
}
}, {
"get" : {
"tags" : [ "pdp-d-telemetry" ],
"summary" : "Retrieves the latest events received by an UEB topic",
- "description" : "This is a Network Communicaton Endpoint source of messages for the Engine",
+ "description" : "This is a Network Communication Endpoint source of messages for the Engine",
"operationId" : "sinkEvents",
"parameters" : [ {
"name" : "comm",
"style" : "simple",
"explode" : false,
"schema" : {
- "pattern" : "ueb|dmaap|noop",
+ "pattern" : "kafka|noop",
"type" : "string"
}
}, {
"style" : "simple",
"explode" : false,
"schema" : {
- "pattern" : "ueb|dmaap|noop",
+ "pattern" : "kafka|noop",
"type" : "string"
}
}, {
"style" : "simple",
"explode" : false,
"schema" : {
- "pattern" : "ueb|dmaap|noop",
+ "pattern" : "kafka|noop",
"type" : "string"
}
}, {
"style" : "simple",
"explode" : false,
"schema" : {
- "pattern" : "ueb|dmaap|noop",
+ "pattern" : "kafka|noop",
"type" : "string"
}
}, {
"style" : "simple",
"explode" : false,
"schema" : {
- "pattern" : "ueb|dmaap|noop",
+ "pattern" : "kafka|noop",
"type" : "string"
}
}, {
"style" : "simple",
"explode" : false,
"schema" : {
- "pattern" : "ueb|dmaap|noop",
+ "pattern" : "kafka|noop",
"type" : "string"
}
}, {
"style" : "simple",
"explode" : false,
"schema" : {
- "pattern" : "ueb|dmaap|noop",
+ "pattern" : "kafka|noop",
"type" : "string"
}
}, {
"style" : "simple",
"explode" : false,
"schema" : {
- "pattern" : "ueb|dmaap|noop",
+ "pattern" : "kafka|noop",
"type" : "string"
}
}, {
"style" : "simple",
"explode" : false,
"schema" : {
- "pattern" : "ueb|dmaap|noop",
+ "pattern" : "kafka|noop",
"type" : "string"
}
}, {
"style" : "simple",
"explode" : false,
"schema" : {
- "pattern" : "ueb|dmaap|noop",
+ "pattern" : "kafka|noop",
"type" : "string"
}
}, {
"style" : "simple",
"explode" : false,
"schema" : {
- "pattern" : "ueb|dmaap|noop",
+ "pattern" : "kafka|noop",
"type" : "string"
}
}, {
"get" : {
"tags" : [ "pdp-d-legacy" ],
"summary" : "Legacy Engine Configuration Properties",
- "description" : "Used for booststrapping the engine",
+ "description" : "Used for bootstrapping the engine",
"operationId" : "properties",
"responses" : {
"200" : {
}
}
},
- "DmaapTopicSink" : {
- "type" : "object",
- "properties" : {
- "partitionKey" : {
- "type" : "string"
- },
- "apiKey" : {
- "type" : "string"
- },
- "apiSecret" : {
- "type" : "string"
- },
- "effectiveTopic" : {
- "type" : "string"
- },
- "recentEvents" : {
- "type" : "array",
- "items" : {
- "type" : "string"
- }
- },
- "topic" : {
- "type" : "string"
- },
- "servers" : {
- "type" : "array",
- "items" : {
- "type" : "string"
- }
- },
- "topicCommInfrastructure" : {
- "type" : "string",
- "enum" : [ "UEB", "DMAAP", "KAFKA", "NOOP", "REST" ]
- },
- "alive" : {
- "type" : "boolean"
- },
- "locked" : {
- "type" : "boolean"
- }
- }
- },
- "DmaapTopicSource" : {
- "type" : "object",
- "properties" : {
- "consumerInstance" : {
- "type" : "string"
- },
- "consumerGroup" : {
- "type" : "string"
- },
- "fetchTimeout" : {
- "type" : "integer",
- "format" : "int32"
- },
- "fetchLimit" : {
- "type" : "integer",
- "format" : "int32"
- },
- "apiKey" : {
- "type" : "string"
- },
- "apiSecret" : {
- "type" : "string"
- },
- "effectiveTopic" : {
- "type" : "string"
- },
- "recentEvents" : {
- "type" : "array",
- "items" : {
- "type" : "string"
- }
- },
- "topic" : {
- "type" : "string"
- },
- "servers" : {
- "type" : "array",
- "items" : {
- "type" : "string"
- }
- },
- "topicCommInfrastructure" : {
- "type" : "string",
- "enum" : [ "UEB", "DMAAP", "KAFKA", "NOOP", "REST" ]
- },
- "alive" : {
- "type" : "boolean"
- },
- "locked" : {
- "type" : "boolean"
- }
- }
- },
"KafkaTopicSink" : {
"type" : "object",
"properties" : {
},
"topicCommInfrastructure" : {
"type" : "string",
- "enum" : [ "UEB", "DMAAP", "KAFKA", "NOOP", "REST" ]
+ "enum" : [ "KAFKA", "NOOP", "REST" ]
},
"alive" : {
"type" : "boolean"
},
"topicCommInfrastructure" : {
"type" : "string",
- "enum" : [ "UEB", "DMAAP", "KAFKA", "NOOP", "REST" ]
+ "enum" : [ "KAFKA", "NOOP", "REST" ]
}
}
},
},
"topicCommInfrastructure" : {
"type" : "string",
- "enum" : [ "UEB", "DMAAP", "KAFKA", "NOOP", "REST" ]
+ "enum" : [ "KAFKA", "NOOP", "REST" ]
}
}
},
"TopicEndpoint" : {
"type" : "object",
"properties" : {
- "uebTopicSources" : {
- "type" : "array",
- "items" : {
- "$ref" : "#/components/schemas/UebTopicSource"
- }
- },
- "uebTopicSinks" : {
- "type" : "array",
- "items" : {
- "$ref" : "#/components/schemas/UebTopicSink"
- }
- },
- "dmaapTopicSinks" : {
- "type" : "array",
- "items" : {
- "$ref" : "#/components/schemas/DmaapTopicSink"
- }
- },
"kafkaTopicSinks" : {
"type" : "array",
"items" : {
"$ref" : "#/components/schemas/NoopTopicSink"
}
},
- "dmaapTopicSources" : {
- "type" : "array",
- "items" : {
- "$ref" : "#/components/schemas/DmaapTopicSource"
- }
- },
"kafkaTopicSources" : {
"type" : "array",
"items" : {
}
}
},
- "UebTopicSink" : {
- "type" : "object",
- "properties" : {
- "partitionKey" : {
- "type" : "string"
- },
- "apiKey" : {
- "type" : "string"
- },
- "apiSecret" : {
- "type" : "string"
- },
- "effectiveTopic" : {
- "type" : "string"
- },
- "recentEvents" : {
- "type" : "array",
- "items" : {
- "type" : "string"
- }
- },
- "topic" : {
- "type" : "string"
- },
- "servers" : {
- "type" : "array",
- "items" : {
- "type" : "string"
- }
- },
- "topicCommInfrastructure" : {
- "type" : "string",
- "enum" : [ "UEB", "DMAAP", "KAFKA", "NOOP", "REST" ]
- },
- "alive" : {
- "type" : "boolean"
- },
- "locked" : {
- "type" : "boolean"
- }
- }
- },
- "UebTopicSource" : {
- "type" : "object",
- "properties" : {
- "consumerInstance" : {
- "type" : "string"
- },
- "consumerGroup" : {
- "type" : "string"
- },
- "fetchTimeout" : {
- "type" : "integer",
- "format" : "int32"
- },
- "fetchLimit" : {
- "type" : "integer",
- "format" : "int32"
- },
- "apiKey" : {
- "type" : "string"
- },
- "apiSecret" : {
- "type" : "string"
- },
- "effectiveTopic" : {
- "type" : "string"
- },
- "recentEvents" : {
- "type" : "array",
- "items" : {
- "type" : "string"
- }
- },
- "topic" : {
- "type" : "string"
- },
- "servers" : {
- "type" : "array",
- "items" : {
- "type" : "string"
- }
- },
- "topicCommInfrastructure" : {
- "type" : "string",
- "enum" : [ "UEB", "DMAAP", "KAFKA", "NOOP", "REST" ]
- },
- "alive" : {
- "type" : "boolean"
- },
- "locked" : {
- "type" : "boolean"
- }
- }
- },
"PdpdConfiguration" : {
"type" : "object",
"properties" : {
private static final String TELEMETRY_USER = "x";
private static final String TELEMETRY_PASSWORD = "y";
private static final String FOO_CONTROLLER = "foo";
-
- private static final String UEB_TOPIC = "ueb-topic-test";
private static final String KAFKA_TOPIC = "kafka-topic-test";
private static final String NOOP_TOPIC = "noop_topic";
-
- private static final String UEB_SOURCE_SERVER_PROPERTY = PolicyEndPointProperties.PROPERTY_UEB_SOURCE_TOPICS + "."
- + UEB_TOPIC + PolicyEndPointProperties.PROPERTY_TOPIC_SERVERS_SUFFIX;
- private static final String UEB_SINK_SERVER_PROPERTY = PolicyEndPointProperties.PROPERTY_UEB_SINK_TOPICS + "."
- + UEB_TOPIC + PolicyEndPointProperties.PROPERTY_TOPIC_SERVERS_SUFFIX;
private static final String KAFKA_SOURCE_SERVER_PROPERTY = PolicyEndPointProperties.PROPERTY_KAFKA_SOURCE_TOPICS
- + "." + KAFKA_TOPIC + PolicyEndPointProperties.PROPERTY_TOPIC_SERVERS_SUFFIX;
+ + "." + KAFKA_TOPIC + PolicyEndPointProperties.PROPERTY_TOPIC_SERVERS_SUFFIX;
private static final String KAFKA_SINK_SERVER_PROPERTY = PolicyEndPointProperties.PROPERTY_KAFKA_SINK_TOPICS + "."
- + KAFKA_TOPIC + PolicyEndPointProperties.PROPERTY_TOPIC_SERVERS_SUFFIX;
- private static final String UEB_SERVER = "localhost";
+ + KAFKA_TOPIC + PolicyEndPointProperties.PROPERTY_TOPIC_SERVERS_SUFFIX;
private static final String KAFKA_SERVER = "localhost:9092";
private static final String FOO_CONTROLLER_FILE = FOO_CONTROLLER + "-controller.properties";
private static final String FOO_CONTROLLER_FILE_BAK = FOO_CONTROLLER_FILE + ".bak";
private static final String PDP_CONFIGURATION_JSON =
- "src/test/resources/org/onap/policy/drools/server/restful/PdpConfiguration.json";
+ "src/test/resources/org/onap/policy/drools/server/restful/PdpConfiguration.json";
private static CloseableHttpClient client;
/* override default port */
final Properties engineProps = PolicyEngineConstants.getManager().defaultTelemetryConfig();
engineProps.put(PolicyEndPointProperties.PROPERTY_HTTP_SERVER_SERVICES + "."
- + PolicyEngineConstants.TELEMETRY_SERVER_DEFAULT_NAME
- + PolicyEndPointProperties.PROPERTY_HTTP_PORT_SUFFIX, "" + DEFAULT_TELEMETRY_PORT);
+ + PolicyEngineConstants.TELEMETRY_SERVER_DEFAULT_NAME
+ + PolicyEndPointProperties.PROPERTY_HTTP_PORT_SUFFIX, "" + DEFAULT_TELEMETRY_PORT);
engineProps.put(PolicyEndPointProperties.PROPERTY_HTTP_SERVER_SERVICES + "."
+ PolicyEngineConstants.TELEMETRY_SERVER_DEFAULT_NAME
+ PolicyEndPointProperties.PROPERTY_HTTP_AUTH_USERNAME_SUFFIX,
- TELEMETRY_USER);
+ TELEMETRY_USER);
engineProps.put(PolicyEndPointProperties.PROPERTY_HTTP_SERVER_SERVICES + "."
+ PolicyEngineConstants.TELEMETRY_SERVER_DEFAULT_NAME
+ PolicyEndPointProperties.PROPERTY_HTTP_AUTH_PASSWORD_SUFFIX,
- TELEMETRY_PASSWORD);
+ TELEMETRY_PASSWORD);
engineProps.put(PolicyEndPointProperties.PROPERTY_HTTP_SERVER_SERVICES + "."
+ PolicyEngineConstants.TELEMETRY_SERVER_DEFAULT_NAME
+ PolicyEndPointProperties.PROPERTY_HTTP_SERIALIZATION_PROVIDER,
- String.join(",", JacksonHandler.class.getName(), YamlJacksonHandler.class.getName()));
+ String.join(",", JacksonHandler.class.getName(), YamlJacksonHandler.class.getName()));
/* other properties */
- engineProps.put(PolicyEndPointProperties.PROPERTY_UEB_SOURCE_TOPICS, UEB_TOPIC);
- engineProps.put(PolicyEndPointProperties.PROPERTY_UEB_SINK_TOPICS, UEB_TOPIC);
engineProps.put(PolicyEndPointProperties.PROPERTY_KAFKA_SOURCE_TOPICS, KAFKA_TOPIC);
engineProps.put(PolicyEndPointProperties.PROPERTY_KAFKA_SINK_TOPICS, KAFKA_TOPIC);
- engineProps.put(UEB_SOURCE_SERVER_PROPERTY, UEB_SERVER);
- engineProps.put(UEB_SINK_SERVER_PROPERTY, UEB_SERVER);
engineProps.put(KAFKA_SOURCE_SERVER_PROPERTY, KAFKA_SERVER);
engineProps.put(KAFKA_SINK_SERVER_PROPERTY, KAFKA_SERVER);
}
private void putDeleteTopicSwitches() throws IOException {
- putDeleteSwitch("/engine/topics/sources/ueb/", UEB_TOPIC, "lock");
putDeleteSwitch("/engine/topics/sources/kafka/", KAFKA_TOPIC, "lock");
putDeleteSwitch("/engine/topics/sources/noop/", NOOP_TOPIC, "lock");
- putDeleteSwitch("/engine/topics/sinks/ueb/", UEB_TOPIC, "lock");
putDeleteSwitch("/engine/topics/sinks/kafka/", KAFKA_TOPIC, "lock");
putDeleteSwitch("/engine/topics/sinks/noop/", NOOP_TOPIC, "lock");
- putDeleteSwitch("/engine/topics/sources/ueb/", UEB_TOPIC, "activation");
putDeleteSwitch("/engine/topics/sources/kafka/", KAFKA_TOPIC, "activation");
putDeleteSwitch("/engine/topics/sources/noop/", NOOP_TOPIC, "activation");
- putDeleteSwitch("/engine/topics/sinks/ueb/", UEB_TOPIC, "activation");
putDeleteSwitch("/engine/topics/sinks/kafka/", KAFKA_TOPIC, "activation");
putDeleteSwitch("/engine/topics/sinks/noop/", NOOP_TOPIC, "activation");
- putSwitch("/engine/topics/sources/ueb/", UEB_TOPIC, "activation");
putSwitch("/engine/topics/sources/kafka/", KAFKA_TOPIC, "activation");
putSwitch("/engine/topics/sources/noop/", NOOP_TOPIC, "activation");
- putSwitch("/engine/topics/sinks/ueb/", UEB_TOPIC, "activation");
putSwitch("/engine/topics/sinks/kafka/", KAFKA_TOPIC, "activation");
putSwitch("/engine/topics/sinks/noop/", NOOP_TOPIC, "activation");
}
private void putDeleteTopicsSources() throws IOException {
- putTest(HOST_URL + "/engine/topics/sources/ueb/" + UEB_TOPIC + "/events", 200,
- "{x:y}", ContentType.TEXT_PLAIN);
putTest(HOST_URL + "/engine/topics/sources/noop/" + NOOP_TOPIC + "/events", 200,
"{x:y}", ContentType.TEXT_PLAIN);
putTest(HOST_URL + "/engine/topics/sources/kafka/" + KAFKA_TOPIC + "/events", 200,
"FOOOO", ContentType.TEXT_PLAIN);
- putTest(HOST_URL + "/engine/topics/sources/ueb/fiznits/events", 406, "FOOOO", ContentType.TEXT_PLAIN);
putTest(HOST_URL + "/engine/topics/sources/kafka/fiznits/events", 406,
"FOOOO", ContentType.TEXT_PLAIN);
putTest(HOST_URL + "/engine/topics/switches/lock", 200);
- putTest(HOST_URL + "/engine/topics/sources/ueb/" + UEB_TOPIC + "/events",
- 406, "FOOOO", ContentType.TEXT_PLAIN);
putTest(HOST_URL + "/engine/topics/sources/kafka/" + KAFKA_TOPIC + "/events",
406, "FOOOO", ContentType.TEXT_PLAIN);
deleteTest(HOST_URL + "/engine/topics/switches/lock", 200);
deleteTest(HOST_URL + "/engine/controllers/" + FOO_CONTROLLER, 200);
}
- private void postTest(String uri, int statusCode, String payload, ContentType contentType) throws IOException {
+ private void postTest(String uri, int statusCode, String payload) throws IOException {
HttpPost post = new HttpPost(uri);
- if (contentType != null) {
- post.setEntity(new StringEntity(payload, contentType));
+ if (ContentType.APPLICATION_JSON != null) {
+ post.setEntity(new StringEntity(payload, ContentType.APPLICATION_JSON));
}
requestTest(post, statusCode);
}
@Test
void testPost() throws IOException {
postTest(HOST_URL + "/engine/inputs/configuration", 406,
- Files.readString(Paths.get(PDP_CONFIGURATION_JSON)),
- ContentType.APPLICATION_JSON);
+ Files.readString(Paths.get(PDP_CONFIGURATION_JSON)));
- postTest(HOST_URL + "/engine/controllers", 400,
- "{}",
- ContentType.APPLICATION_JSON);
+ postTest(HOST_URL + "/engine/controllers", 400, "{}");
- postTest(HOST_URL + "/engine/controllers", 304,
- "{controller.name : foo}",
- ContentType.APPLICATION_JSON);
+ postTest(HOST_URL + "/engine/controllers", 304, "{controller.name : foo}");
- postTest(HOST_URL + "/engine/controllers", 206,
- "{controller.name : new}",
- ContentType.APPLICATION_JSON);
+ postTest(HOST_URL + "/engine/controllers", 206, "{controller.name : new}");
deleteTest(HOST_URL + "/engine/controllers/new", 200);
- postTest(HOST_URL + "/engine/controllers/foo/drools/facts/session1/query1/entity1", 200,
- "[{f:v}]", ContentType.APPLICATION_JSON);
+ postTest(HOST_URL + "/engine/controllers/foo/drools/facts/session1/query1/entity1", 200, "[{f:v}]");
- postTest(HOST_URL + "/engine/controllers/new/drools/facts/session1/query1/entity1", 404,
- "[{f:v}]", ContentType.APPLICATION_JSON);
+ postTest(HOST_URL + "/engine/controllers/new/drools/facts/session1/query1/entity1", 404, "[{f:v}]");
}
@Test
assertEquals(404, response.getStatusLine().getStatusCode());
httpGet.releaseConnection();
+ testGetDroolsControllers();
+
+ testGetControllersDecoders();
+
+ testGetTopics();
+
+ testGetEngineTools();
+ }
+
+ private static void testGetDroolsControllers() throws IOException {
+ CloseableHttpResponse response;
+ HttpGet httpGet;
/*
* GET: /engine/controllers/controllerName/drools/facts
* /engine/controllers/controllerName/drools/facts/session
httpGet.releaseConnection();
httpGet = new HttpGet(
- HOST_URL + "/engine/controllers/" + FOO_CONTROLLER + "/drools/facts/session/query/queriedEntity");
+ HOST_URL + "/engine/controllers/" + FOO_CONTROLLER + "/drools/facts/session/query/queriedEntity");
response = client.execute(httpGet);
logger.info(httpGet.getRequestLine() + " response code: {}", response.getStatusLine().getStatusCode());
assertEquals(200, response.getStatusLine().getStatusCode());
logger.info(httpGet.getRequestLine() + " response code: {}", response.getStatusLine().getStatusCode());
assertEquals(404, response.getStatusLine().getStatusCode());
httpGet.releaseConnection();
+ }
+ private static void testGetEngineTools() throws IOException {
+ CloseableHttpResponse response;
+ HttpGet httpGet;
+ /*
+ * GET: /engine/tools/uuid /engine/tools/loggers /engine/tools/loggers/loggerName
+ */
+ httpGet = new HttpGet(HOST_URL + "/engine/tools/uuid");
+ response = client.execute(httpGet);
+ logger.info(httpGet.getRequestLine() + " response code: {}", response.getStatusLine().getStatusCode());
+ assertEquals(200, response.getStatusLine().getStatusCode());
+ httpGet.releaseConnection();
+ httpGet = new HttpGet(HOST_URL + "/engine/tools/loggers");
+ response = client.execute(httpGet);
+ logger.info(httpGet.getRequestLine() + " response code: {}", response.getStatusLine().getStatusCode());
+ assertEquals(200, response.getStatusLine().getStatusCode());
+ httpGet.releaseConnection();
+
+ httpGet = new HttpGet(HOST_URL + "/engine/tools/loggers/ROOT");
+ response = client.execute(httpGet);
+ logger.info(httpGet.getRequestLine() + " response code: {}", response.getStatusLine().getStatusCode());
+ assertEquals(200, response.getStatusLine().getStatusCode());
+ httpGet.releaseConnection();
+ }
+
+ private static void testGetControllersDecoders() throws IOException {
+ HttpGet httpGet;
+ CloseableHttpResponse response;
/*
* GET: /engine/controllers/controllerName/decoders
* /engine/controllers/controllerName/decoders/filters
httpGet.releaseConnection();
httpGet = new HttpGet(
- HOST_URL + "/engine/controllers/" + FOO_CONTROLLER + "/decoders/topic/filters/factType/rules");
+ HOST_URL + "/engine/controllers/" + FOO_CONTROLLER + "/decoders/topic/filters/factType/rules");
response = client.execute(httpGet);
logger.info(httpGet.getRequestLine() + " response code: {}", response.getStatusLine().getStatusCode());
assertEquals(404, response.getStatusLine().getStatusCode());
httpGet.releaseConnection();
httpGet = new HttpGet(
- HOST_URL + "/engine/controllers/" + FOO_CONTROLLER + "/decoders/topic/filters/factType/rules/ruleName");
+ HOST_URL + "/engine/controllers/" + FOO_CONTROLLER + "/decoders/topic/filters/factType/rules/ruleName");
response = client.execute(httpGet);
logger.info(httpGet.getRequestLine() + " response code: {}", response.getStatusLine().getStatusCode());
assertEquals(404, response.getStatusLine().getStatusCode());
logger.info(httpGet.getRequestLine() + " response code: {}", response.getStatusLine().getStatusCode());
assertEquals(200, response.getStatusLine().getStatusCode());
httpGet.releaseConnection();
+ }
+ private static void testGetTopics() throws IOException {
+ CloseableHttpResponse response;
+ HttpGet httpGet;
/*
- * GET: /engine/topics /engine/topics/switches /engine/topics/sources /engine/topics/sinks
- * /engine/topics/sinks/ueb /engine/topics/sources/ueb /engine/topics/sinks/kafka
- * /engine/topics/sources/kafka /engine/topics/sinks/ueb/topic
- * /engine/topics/sources/ueb/topic /engine/topics/sinks/kafka/topic
- * /engine/topics/sources/kafka/topic /engine/topics/sinks/ueb/topic/events
- * /engine/topics/sources/ueb/topic/events /engine/topics/sinks/kafka/topic/events
- * /engine/topics/sources/kafka/topic/events /engine/topics/sources/ueb/topic/switches
+ * GET: /engine/topics
+ * /engine/topics/switches
+ * /engine/topics/sources
+ * /engine/topics/sinks
+ * /engine/topics/sinks/kafka
+ * /engine/topics/sources/kafka
+ * /engine/topics/sinks/kafka/topic
+ * /engine/topics/sources/kafka/topic
+ * /engine/topics/sinks/kafka/topic/events
+ * /engine/topics/sources/kafka/topic/events
* /engine/topics/sources/kafka/topic/switches
*/
httpGet = new HttpGet(HOST_URL + "/engine/topics");
assertEquals(200, response.getStatusLine().getStatusCode());
httpGet.releaseConnection();
- httpGet = new HttpGet(HOST_URL + "/engine/topics/sinks/ueb");
- response = client.execute(httpGet);
- logger.info(httpGet.getRequestLine() + " response code: {}", response.getStatusLine().getStatusCode());
- assertEquals(200, response.getStatusLine().getStatusCode());
- httpGet.releaseConnection();
-
- httpGet = new HttpGet(HOST_URL + "/engine/topics/sources/ueb");
- response = client.execute(httpGet);
- logger.info(httpGet.getRequestLine() + " response code: {}", response.getStatusLine().getStatusCode());
- assertEquals(200, response.getStatusLine().getStatusCode());
- httpGet.releaseConnection();
-
httpGet = new HttpGet(HOST_URL + "/engine/topics/sources/kafka");
response = client.execute(httpGet);
logger.info(httpGet.getRequestLine() + " response code: {}", response.getStatusLine().getStatusCode());
assertEquals(200, response.getStatusLine().getStatusCode());
httpGet.releaseConnection();
- httpGet = new HttpGet(HOST_URL + "/engine/topics/sources/ueb/" + UEB_TOPIC);
- response = client.execute(httpGet);
- logger.info(httpGet.getRequestLine() + " response code: {}", response.getStatusLine().getStatusCode());
- assertEquals(200, response.getStatusLine().getStatusCode());
- httpGet.releaseConnection();
-
- httpGet = new HttpGet(HOST_URL + "/engine/topics/sources/ueb/foobar");
- response = client.execute(httpGet);
- logger.info(httpGet.getRequestLine() + " response code: {}", response.getStatusLine().getStatusCode());
- assertEquals(500, response.getStatusLine().getStatusCode());
- httpGet.releaseConnection();
-
- httpGet = new HttpGet(HOST_URL + "/engine/topics/sinks/ueb/" + UEB_TOPIC);
- response = client.execute(httpGet);
- logger.info(httpGet.getRequestLine() + " response code: {}", response.getStatusLine().getStatusCode());
- assertEquals(200, response.getStatusLine().getStatusCode());
- httpGet.releaseConnection();
-
- httpGet = new HttpGet(HOST_URL + "/engine/topics/sinks/ueb/foobar");
- response = client.execute(httpGet);
- logger.info(httpGet.getRequestLine() + " response code: {}", response.getStatusLine().getStatusCode());
- assertEquals(500, response.getStatusLine().getStatusCode());
- httpGet.releaseConnection();
-
httpGet = new HttpGet(HOST_URL + "/engine/topics/sources/kafka/" + KAFKA_TOPIC);
response = client.execute(httpGet);
logger.info(httpGet.getRequestLine() + " response code: {}", response.getStatusLine().getStatusCode());
assertEquals(500, response.getStatusLine().getStatusCode());
httpGet.releaseConnection();
- httpGet = new HttpGet(HOST_URL + "/engine/topics/sources/ueb/" + UEB_TOPIC + "/events");
- response = client.execute(httpGet);
- logger.info(httpGet.getRequestLine() + " response code: {}", response.getStatusLine().getStatusCode());
- assertEquals(200, response.getStatusLine().getStatusCode());
- httpGet.releaseConnection();
-
- httpGet = new HttpGet(HOST_URL + "/engine/topics/sources/ueb/foobar/events");
- response = client.execute(httpGet);
- logger.info(httpGet.getRequestLine() + " response code: {}", response.getStatusLine().getStatusCode());
- assertEquals(500, response.getStatusLine().getStatusCode());
- httpGet.releaseConnection();
-
- httpGet = new HttpGet(HOST_URL + "/engine/topics/sinks/ueb/" + UEB_TOPIC + "/events");
- response = client.execute(httpGet);
- logger.info(httpGet.getRequestLine() + " response code: {}", response.getStatusLine().getStatusCode());
- assertEquals(200, response.getStatusLine().getStatusCode());
- httpGet.releaseConnection();
-
- httpGet = new HttpGet(HOST_URL + "/engine/topics/sinks/ueb/foobar/events");
- response = client.execute(httpGet);
- logger.info(httpGet.getRequestLine() + " response code: {}", response.getStatusLine().getStatusCode());
- assertEquals(500, response.getStatusLine().getStatusCode());
- httpGet.releaseConnection();
-
httpGet = new HttpGet(HOST_URL + "/engine/topics/sources/kafka/" + KAFKA_TOPIC + "/events");
response = client.execute(httpGet);
logger.info(httpGet.getRequestLine() + " response code: {}", response.getStatusLine().getStatusCode());
assertEquals(500, response.getStatusLine().getStatusCode());
httpGet.releaseConnection();
- httpGet = new HttpGet(HOST_URL + "/engine/topics/sources/ueb/" + UEB_TOPIC + "/switches");
- response = client.execute(httpGet);
- logger.info(httpGet.getRequestLine() + " response code: {}", response.getStatusLine().getStatusCode());
- assertEquals(200, response.getStatusLine().getStatusCode());
- httpGet.releaseConnection();
-
httpGet = new HttpGet(HOST_URL + "/engine/topics/sources/kafka/" + KAFKA_TOPIC + "/switches");
response = client.execute(httpGet);
logger.info(httpGet.getRequestLine() + " response code: {}", response.getStatusLine().getStatusCode());
assertEquals(200, response.getStatusLine().getStatusCode());
httpGet.releaseConnection();
- httpGet = new HttpGet(HOST_URL + "/engine/topics/sinks/ueb/" + UEB_TOPIC + "/switches");
- response = client.execute(httpGet);
- logger.info(httpGet.getRequestLine() + " response code: {}", response.getStatusLine().getStatusCode());
- assertEquals(200, response.getStatusLine().getStatusCode());
- httpGet.releaseConnection();
-
httpGet = new HttpGet(HOST_URL + "/engine/topics/sinks/kafka/" + KAFKA_TOPIC + "/switches");
response = client.execute(httpGet);
logger.info(httpGet.getRequestLine() + " response code: {}", response.getStatusLine().getStatusCode());
logger.info(httpGet.getRequestLine() + " response code: {}", response.getStatusLine().getStatusCode());
assertEquals(200, response.getStatusLine().getStatusCode());
httpGet.releaseConnection();
-
- /*
- * GET: /engine/tools/uuid /engine/tools/loggers /engine/tools/loggers/loggerName
- */
- httpGet = new HttpGet(HOST_URL + "/engine/tools/uuid");
- response = client.execute(httpGet);
- logger.info(httpGet.getRequestLine() + " response code: {}", response.getStatusLine().getStatusCode());
- assertEquals(200, response.getStatusLine().getStatusCode());
- httpGet.releaseConnection();
-
- httpGet = new HttpGet(HOST_URL + "/engine/tools/loggers");
- response = client.execute(httpGet);
- logger.info(httpGet.getRequestLine() + " response code: {}", response.getStatusLine().getStatusCode());
- assertEquals(200, response.getStatusLine().getStatusCode());
- httpGet.releaseConnection();
-
- httpGet = new HttpGet(HOST_URL + "/engine/tools/loggers/ROOT");
- response = client.execute(httpGet);
- logger.info(httpGet.getRequestLine() + " response code: {}", response.getStatusLine().getStatusCode());
- assertEquals(200, response.getStatusLine().getStatusCode());
- httpGet.releaseConnection();
}
/**
private static void cleanUpWorkingDirs() throws IOException {
final Path testControllerPath = Paths.get(
- SystemPersistenceConstants.getManager().getConfigurationPath().toString(), FOO_CONTROLLER_FILE);
+ SystemPersistenceConstants.getManager().getConfigurationPath().toString(), FOO_CONTROLLER_FILE);
final Path testControllerBakPath =
- Paths.get(SystemPersistenceConstants.getManager().getConfigurationPath().toString(),
- FOO_CONTROLLER_FILE_BAK);
+ Paths.get(SystemPersistenceConstants.getManager().getConfigurationPath().toString(),
+ FOO_CONTROLLER_FILE_BAK);
Files.deleteIfExists(testControllerPath);
Files.deleteIfExists(testControllerBakPath);
import java.nio.file.Paths;
import java.util.Properties;
import java.util.concurrent.TimeUnit;
-import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Test;
<version>${policy.common.version}</version>
<scope>provided</scope>
</dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
<dependency>
<groupId>org.onap.policy.common</groupId>
<artifactId>utils-test</artifactId>