diff options
Diffstat (limited to 'controlloop/common')
18 files changed, 115 insertions, 95 deletions
diff --git a/controlloop/common/controller-usecases/pom.xml b/controlloop/common/controller-usecases/pom.xml index c3b53acf1..e5443eb60 100644 --- a/controlloop/common/controller-usecases/pom.xml +++ b/controlloop/common/controller-usecases/pom.xml @@ -4,7 +4,7 @@ ONAP ================================================================================ Copyright (C) 2020-2022 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. @@ -177,7 +177,6 @@ <groupId>org.onap.policy.drools-pdp</groupId> <artifactId>policy-management</artifactId> <version>${version.policy.drools-pdp}</version> - <scope>provided</scope> <optional>true</optional> </dependency> <dependency> diff --git a/controlloop/common/eventmanager/pom.xml b/controlloop/common/eventmanager/pom.xml index 2e7b0a497..c67021c47 100644 --- a/controlloop/common/eventmanager/pom.xml +++ b/controlloop/common/eventmanager/pom.xml @@ -37,11 +37,6 @@ <groupId>org.hibernate.orm</groupId> <artifactId>hibernate-core</artifactId> </dependency> - - <dependency> - <groupId>org.hibernate</groupId> - <artifactId>hibernate-core-jakarta</artifactId> - </dependency> <dependency> <groupId>commons-io</groupId> <artifactId>commons-io</artifactId> diff --git a/controlloop/common/eventmanager/src/main/resources/META-INF/persistence.xml b/controlloop/common/eventmanager/src/main/resources/META-INF/persistence.xml index e55fda222..fd0ab088b 100644 --- a/controlloop/common/eventmanager/src/main/resources/META-INF/persistence.xml +++ b/controlloop/common/eventmanager/src/main/resources/META-INF/persistence.xml @@ -4,7 +4,7 @@ drools-applications ================================================================================ Copyright (C) 2018-2021 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. @@ -19,19 +19,16 @@ limitations under the License. ============LICENSE_END========================================================= --> -<persistence xmlns="https://jakarta.ee/xml/ns/persistence" +<persistence version="3.1" xmlns="https://jakarta.ee/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="https://jakarta.ee/xml/ns/persistence https://jakarta.ee/xml/ns/persistence/persistence_3_0.xsd" - version="3.0"> + xsi:schemaLocation="https://jakarta.ee/xml/ns/persistence https://jakarta.ee/xml/ns/persistence/persistence_3_1.xsd"> <persistence-unit name="OperationsHistoryPU" transaction-type="RESOURCE_LOCAL"> <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider> <class>org.onap.policy.guard.OperationsHistory</class> - <properties> - <property name="jakarta.persistence.schema-generation.database.action" value="create" /> - <property name="hibernate.dialect" value="org.hibernate.dialect.MariaDBDialect" /> - <property name="hibernate.show_sql" value="false" /> + <property name="jakarta.persistence.schema-generation.database.action" value="create"/> + <property name="hibernate.show_sql" value="false"/> </properties> </persistence-unit> </persistence> diff --git a/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ClEventManagerWithEventTest.java b/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ClEventManagerWithEventTest.java index 3b16f465b..6b60ec84c 100644 --- a/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ClEventManagerWithEventTest.java +++ b/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ClEventManagerWithEventTest.java @@ -3,7 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2021, 2023 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. @@ -55,12 +55,9 @@ import org.onap.policy.controlloop.ControlLoopTargetType; import org.onap.policy.controlloop.VirtualControlLoopEvent; import org.onap.policy.controlloop.VirtualControlLoopNotification; import org.onap.policy.controlloop.actorserviceprovider.ActorService; -import org.onap.policy.controlloop.actorserviceprovider.Operation; import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome; import org.onap.policy.controlloop.actorserviceprovider.OperationResult; -import org.onap.policy.controlloop.actorserviceprovider.Operator; import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams; -import org.onap.policy.controlloop.actorserviceprovider.spi.Actor; import org.onap.policy.controlloop.drl.legacy.ControlLoopParams; import org.onap.policy.controlloop.eventmanager.ClEventManagerWithEvent.NewEventStatus; import org.onap.policy.controlloop.ophistory.OperationHistoryDataManager; @@ -82,27 +79,21 @@ class ClEventManagerWithEventTest { private static final String TARGET_PROP = "my-target-property"; private static final String MY_TARGET = "my-target"; private static final String EVENT_MGR_MULTI_YAML = - "../eventmanager/src/test/resources/eventManager/event-mgr-multi.yaml"; + "../eventmanager/src/test/resources/eventManager/event-mgr-multi.yaml"; private static final String EVENT_MGR_SIMPLE_YAML = - "../eventmanager/src/test/resources/eventManager/event-mgr-simple.yaml"; + "../eventmanager/src/test/resources/eventManager/event-mgr-simple.yaml"; private static final Coder yamlCoder = new StandardYamlCoder(); private static final String OUTCOME_MSG = "my outcome message"; private final PolicyEngine engineMgr = mock(PolicyEngine.class); private final WorkingMemory workMem = mock(WorkingMemory.class); private final InternalFactHandle factHandle = mock(InternalFactHandle.class); - private final Operator policyOperator = mock(Operator.class); - private final Operation policyOperation = mock(Operation.class); - private final Actor policyActor = mock(Actor.class); private final EventManagerServices services = mock(EventManagerServices.class); private final ActorService actors = mock(ActorService.class); private final OperationHistoryDataManager dataMgr = mock(OperationHistoryDataManager.class); private final ExecutorService executor = mock(ExecutorService.class); - private final MyStep stepa = mock(MyStep.class); - private final MyStep stepb = mock(MyStep.class); private List<LockImpl> locks; - private ToscaPolicy tosca; private ControlLoopParams params; private VirtualControlLoopEvent event; private ClEventManagerWithEvent<MyStep> mgr; @@ -149,7 +140,7 @@ class ClEventManagerWithEventTest { // invalid event.setTarget(""); assertThatThrownBy(() -> new MyManager(services, params, event, workMem)) - .isInstanceOf(ControlLoopException.class); + .isInstanceOf(ControlLoopException.class); } @Test @@ -209,7 +200,7 @@ class ClEventManagerWithEventTest { // null case assertThatThrownBy(() -> mgr.loadNextPolicy(null)).isInstanceOf(NullPointerException.class) - .hasMessageContaining("lastResult"); + .hasMessageContaining("lastResult"); } @Test @@ -218,10 +209,12 @@ class ClEventManagerWithEventTest { OperationOutcome outcome = makeOutcome(); mgr.addToHistory(outcome); - mgr.storeInDataBase(mgr.getPartialHistory().peekLast(), MY_TARGET); + var peeked = mgr.getPartialHistory().peekLast(); + assertNotNull(peeked); + mgr.storeInDataBase(peeked, MY_TARGET); verify(dataMgr).store(REQ_ID.toString(), event.getClosedLoopControlName(), event, MY_TARGET, - mgr.getPartialHistory().peekLast().getClOperation()); + peeked.getClOperation()); } @Test @@ -265,7 +258,7 @@ class ClEventManagerWithEventTest { event.setTarget(null); assertThatCode(() -> mgr.checkEventSyntax(event)).isInstanceOf(ControlLoopException.class) - .hasMessage("No target field"); + .hasMessage("No target field"); // abated supersedes previous errors - so it shouldn't throw an exception event.setClosedLoopEventStatus(ControlLoopEventStatus.ABATED); @@ -273,11 +266,11 @@ class ClEventManagerWithEventTest { event.setRequestId(null); assertThatCode(() -> mgr.checkEventSyntax(event)).isInstanceOf(ControlLoopException.class) - .hasMessage("No request ID"); + .hasMessage("No request ID"); event.setClosedLoopControlName(null); assertThatCode(() -> mgr.checkEventSyntax(event)).isInstanceOf(ControlLoopException.class) - .hasMessage("No control loop name"); + .hasMessage("No control loop name"); } @Test @@ -290,13 +283,12 @@ class ClEventManagerWithEventTest { event.setClosedLoopEventStatus(null); assertThatCode(() -> mgr.checkEventSyntax(event)).isInstanceOf(ControlLoopException.class) - .hasMessage("Invalid value in closedLoopEventStatus"); + .hasMessage("Invalid value in closedLoopEventStatus"); } private void loadPolicy(String fileName) throws CoderException { - var template = - yamlCoder.decode(ResourceUtils.getResourceAsString(fileName), ToscaServiceTemplate.class); - tosca = template.getToscaTopologyTemplate().getPolicies().get(0).values().iterator().next(); + var template = yamlCoder.decode(ResourceUtils.getResourceAsString(fileName), ToscaServiceTemplate.class); + ToscaPolicy tosca = template.getToscaTopologyTemplate().getPolicies().get(0).values().iterator().next(); params.setToscaPolicy(tosca); } @@ -325,7 +317,7 @@ class ClEventManagerWithEventTest { private static final long serialVersionUID = 1L; public MyManager(EventManagerServices services, ControlLoopParams params, VirtualControlLoopEvent event, - WorkingMemory workMem) throws ControlLoopException { + WorkingMemory workMem) throws ControlLoopException { super(services, params, event, workMem); } diff --git a/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/ophistory/OperationHistoryDataManagerImplTest.java b/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/ophistory/OperationHistoryDataManagerImplTest.java index 22cfa643d..a9d05bdaf 100644 --- a/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/ophistory/OperationHistoryDataManagerImplTest.java +++ b/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/ophistory/OperationHistoryDataManagerImplTest.java @@ -3,7 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2020-2021 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. @@ -151,8 +151,8 @@ class OperationHistoryDataManagerImplTest { // invalid properties params.setUrl(null); - assertThatCode(() -> new PseudoThread()).isInstanceOf(IllegalArgumentException.class) - .hasMessageContaining("data-manager-properties"); + assertThatCode(PseudoThread::new).isInstanceOf(IllegalArgumentException.class) + .hasMessageContaining("data-manager-properties"); } @Test @@ -192,7 +192,7 @@ class OperationHistoryDataManagerImplTest { * Tests store() when it is already stopped. */ @Test - void testStoreAlreadyStopped() throws InterruptedException { + void testStoreAlreadyStopped() { mgr.stop(); // store @@ -202,7 +202,7 @@ class OperationHistoryDataManagerImplTest { } /** - * Tests store() when when the queue is full. + * Tests store() when the queue is full. */ @Test void testStoreTooManyItems() throws InterruptedException { @@ -217,7 +217,7 @@ class OperationHistoryDataManagerImplTest { } @Test - void testRun() throws InterruptedException { + void testRun() { // trigger thread shutdown when it completes this batch when(emfSpy.createEntityManager()).thenAnswer(ans -> { @@ -248,7 +248,7 @@ class OperationHistoryDataManagerImplTest { * Tests run() when the entity manager throws an exception. */ @Test - void testRunException() throws InterruptedException { + void testRunException() { var count = new AtomicInteger(0); when(emfSpy.createEntityManager()).thenAnswer(ans -> { @@ -385,16 +385,15 @@ class OperationHistoryDataManagerImplTest { } private static OperationHistoryDataManagerParamsBuilder makeBuilder() { - // @formatter:off return OperationHistoryDataManagerParams.builder() - .url("jdbc:h2:mem:" + OperationHistoryDataManagerImplTest.class.getSimpleName()) - .dbType("H2") - .driver("org.h2.Driver") - .userName("sa") - .password("") - .batchSize(BATCH_SIZE) - .maxQueueLength(MAX_QUEUE_LENGTH); - // @formatter:on + .url("jdbc:h2:mem:" + OperationHistoryDataManagerImplTest.class.getSimpleName()) + .dbType("H2") + .driver("org.h2.Driver") + .userName("sa") + .password("") + .persistenceUnit("OperationsHistoryTest") + .batchSize(BATCH_SIZE) + .maxQueueLength(MAX_QUEUE_LENGTH); } /** diff --git a/controlloop/common/eventmanager/src/test/resources/META-INF/persistence.xml b/controlloop/common/eventmanager/src/test/resources/META-INF/persistence.xml new file mode 100644 index 000000000..f053f4fcb --- /dev/null +++ b/controlloop/common/eventmanager/src/test/resources/META-INF/persistence.xml @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ============LICENSE_START======================================================= + drools-applications + ================================================================================ + 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. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ============LICENSE_END========================================================= + --> +<persistence version="3.1" xmlns="https://jakarta.ee/xml/ns/persistence" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="https://jakarta.ee/xml/ns/persistence https://jakarta.ee/xml/ns/persistence/persistence_3_1.xsd"> + + <persistence-unit name="OperationsHistoryTest" transaction-type="RESOURCE_LOCAL"> + <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider> + <class>org.onap.policy.guard.OperationsHistory</class> + <properties> + <property name="jakarta.persistence.schema-generation.database.action" value="drop-and-create"/> + <property name="hibernate.show_sql" value="false"/> + </properties> + </persistence-unit> +</persistence> diff --git a/controlloop/common/feature-controlloop-management/src/main/feature/config/A1-P-RSP-topic.properties b/controlloop/common/feature-controlloop-management/src/main/feature/config/A1-P-RSP-topic.properties index 2efeaba17..93f564f97 100644 --- a/controlloop/common/feature-controlloop-management/src/main/feature/config/A1-P-RSP-topic.properties +++ b/controlloop/common/feature-controlloop-management/src/main/feature/config/A1-P-RSP-topic.properties @@ -18,6 +18,6 @@ # ============LICENSE_END========================================================= kafka.source.topics=a1-p-rsp -kafka.source.topics.a1-p-rsp.servers=${envd:KAFKA_SERVERS} -kafka.source.topics.a1-p-rsp.https=${envd:KAFKA_HTTPS:false} +kafka.source.topics.a1-p-rsp.servers=${env:KAFKA_SERVERS} +kafka.source.topics.a1-p-rsp.https=${env:KAFKA_HTTPS:false} diff --git a/controlloop/common/feature-controlloop-management/src/main/feature/config/A1-P-topic.properties b/controlloop/common/feature-controlloop-management/src/main/feature/config/A1-P-topic.properties index a5c0ae9b1..fc1bcf688 100644 --- a/controlloop/common/feature-controlloop-management/src/main/feature/config/A1-P-topic.properties +++ b/controlloop/common/feature-controlloop-management/src/main/feature/config/A1-P-topic.properties @@ -18,6 +18,6 @@ # ============LICENSE_END========================================================= kafka.sink.topics=a1-p -kafka.sink.topics.a1-p.servers=${envd:KAFKA_SERVERS} -kafka.sink.topics.a1-p.https=${envd:KAFKA_HTTPS:false} +kafka.sink.topics.a1-p.servers=${env:KAFKA_SERVERS} +kafka.sink.topics.a1-p.https=${env:KAFKA_HTTPS:false} diff --git a/controlloop/common/feature-controlloop-management/src/main/feature/config/APPC-CL-topic.properties b/controlloop/common/feature-controlloop-management/src/main/feature/config/APPC-CL-topic.properties index 5970ebc75..8ca73734b 100644 --- a/controlloop/common/feature-controlloop-management/src/main/feature/config/APPC-CL-topic.properties +++ b/controlloop/common/feature-controlloop-management/src/main/feature/config/APPC-CL-topic.properties @@ -18,9 +18,9 @@ # ============LICENSE_END========================================================= kafka.source.topics=appc-cl -kafka.source.topics.appc-cl.servers=${envd:KAFKA_SERVERS} -kafka.source.topics.appc-cl.https=${envd:KAFKA_HTTPS:false} +kafka.source.topics.appc-cl.servers=${env:KAFKA_SERVERS} +kafka.source.topics.appc-cl.https=${env:KAFKA_HTTPS:false} kafka.sink.topics=appc-cl -kafka.sink.topics.appc-cl.servers=${envd:KAFKA_SERVERS} -kafka.sink.topics.appc-cl.https=${envd:KAFKA_HTTPS:false} +kafka.sink.topics.appc-cl.servers=${env:KAFKA_SERVERS} +kafka.sink.topics.appc-cl.https=${env:KAFKA_HTTPS:false} diff --git a/controlloop/common/feature-controlloop-management/src/main/feature/config/APPC-LCM-READ-topic.properties b/controlloop/common/feature-controlloop-management/src/main/feature/config/APPC-LCM-READ-topic.properties index 40efa7ee9..bc775195d 100644 --- a/controlloop/common/feature-controlloop-management/src/main/feature/config/APPC-LCM-READ-topic.properties +++ b/controlloop/common/feature-controlloop-management/src/main/feature/config/APPC-LCM-READ-topic.properties @@ -18,5 +18,5 @@ # ============LICENSE_END========================================================= kafka.sink.topics=appc-lcm-read -kafka.sink.topics.appc-lcm-read.servers=${envd:KAFKA_SERVERS} -kafka.sink.topics.appc-lcm-read.https=${envd:KAFKA_HTTPS:false} +kafka.sink.topics.appc-lcm-read.servers=${env:KAFKA_SERVERS} +kafka.sink.topics.appc-lcm-read.https=${env:KAFKA_HTTPS:false} diff --git a/controlloop/common/feature-controlloop-management/src/main/feature/config/APPC-LCM-WRITE-topic.properties b/controlloop/common/feature-controlloop-management/src/main/feature/config/APPC-LCM-WRITE-topic.properties index a0a3065ee..22457f54f 100644 --- a/controlloop/common/feature-controlloop-management/src/main/feature/config/APPC-LCM-WRITE-topic.properties +++ b/controlloop/common/feature-controlloop-management/src/main/feature/config/APPC-LCM-WRITE-topic.properties @@ -18,5 +18,5 @@ # ============LICENSE_END========================================================= kafka.source.topics=appc-lcm-write -kafka.source.topics.appc-lcm-write.servers=${envd:KAFKA_SERVERS} -kafka.source.topics.appc-lcm-write.https=${envd:KAFKA_HTTPS:false} +kafka.source.topics.appc-lcm-write.servers=${env:KAFKA_SERVERS} +kafka.source.topics.appc-lcm-write.https=${env:KAFKA_HTTPS:false} diff --git a/controlloop/common/feature-controlloop-management/src/main/feature/config/DCAE_TOPIC-topic.properties b/controlloop/common/feature-controlloop-management/src/main/feature/config/DCAE_TOPIC-topic.properties index 6b2da4896..14fd442be 100644 --- a/controlloop/common/feature-controlloop-management/src/main/feature/config/DCAE_TOPIC-topic.properties +++ b/controlloop/common/feature-controlloop-management/src/main/feature/config/DCAE_TOPIC-topic.properties @@ -19,6 +19,6 @@ kafka.source.topics=dcae_topic kafka.source.topics.dcae_topic.effectiveTopic=${envd:DCAE_TOPIC} -kafka.source.topics.dcae_topic.servers=${envd:KAFKA_SERVERS} +kafka.source.topics.dcae_topic.servers=${env:KAFKA_SERVERS} kafka.source.topics.dcae_topic.consumerGroup=${envd:DCAE_CONSUMER_GROUP} -kafka.source.topics.dcae_topic.https=${envd:KAFKA_HTTPS:false} +kafka.source.topics.dcae_topic.https=${env:KAFKA_HTTPS:false} diff --git a/controlloop/common/feature-controlloop-management/src/main/feature/config/POLICY-CL-MGT-topic.properties b/controlloop/common/feature-controlloop-management/src/main/feature/config/POLICY-CL-MGT-topic.properties index 7a6a4fb83..b6c15fc71 100644 --- a/controlloop/common/feature-controlloop-management/src/main/feature/config/POLICY-CL-MGT-topic.properties +++ b/controlloop/common/feature-controlloop-management/src/main/feature/config/POLICY-CL-MGT-topic.properties @@ -18,5 +18,5 @@ # ============LICENSE_END========================================================= kafka.sink.topics=policy-cl-mgt -kafka.sink.topics.policy-cl-mgt.servers=${envd:KAFKA_SERVERS} -kafka.sink.topics.policy-cl-mgt.https=${envd:KAFKA_HTTPS:false} +kafka.sink.topics.policy-cl-mgt.servers=${env:KAFKA_SERVERS} +kafka.sink.topics.policy-cl-mgt.https=${env:KAFKA_HTTPS:false} diff --git a/controlloop/common/feature-controlloop-management/src/main/feature/config/SDNR-CL-RSP-topic.properties b/controlloop/common/feature-controlloop-management/src/main/feature/config/SDNR-CL-RSP-topic.properties index 001b9c0e2..033a6f068 100644 --- a/controlloop/common/feature-controlloop-management/src/main/feature/config/SDNR-CL-RSP-topic.properties +++ b/controlloop/common/feature-controlloop-management/src/main/feature/config/SDNR-CL-RSP-topic.properties @@ -18,5 +18,5 @@ # ============LICENSE_END========================================================= kafka.source.topics=sdnr-cl-rsp -kafka.source.topics.sdnr-cl-rsp.servers=${envd:KAFKA_SERVERS} -kafka.source.topics.sdnr-cl-rsp.https=${envd:KAFKA_HTTPS:false} +kafka.source.topics.sdnr-cl-rsp.servers=${env:KAFKA_SERVERS} +kafka.source.topics.sdnr-cl-rsp.https=${env:KAFKA_HTTPS:false} diff --git a/controlloop/common/feature-controlloop-management/src/main/feature/config/SDNR-CL-topic.properties b/controlloop/common/feature-controlloop-management/src/main/feature/config/SDNR-CL-topic.properties index 3a58f8f42..566070751 100644 --- a/controlloop/common/feature-controlloop-management/src/main/feature/config/SDNR-CL-topic.properties +++ b/controlloop/common/feature-controlloop-management/src/main/feature/config/SDNR-CL-topic.properties @@ -18,5 +18,5 @@ # ============LICENSE_END========================================================= kafka.sink.topics=sdnr-cl -kafka.sink.topics.sdnr-cl.servers=${envd:KAFKA_SERVERS} -kafka.sink.topics.sdnr-cl.https=${envd:KAFKA_HTTPS:false} +kafka.sink.topics.sdnr-cl.servers=${env:KAFKA_SERVERS} +kafka.sink.topics.sdnr-cl.https=${env:KAFKA_HTTPS:false} diff --git a/controlloop/common/feature-controlloop-trans/src/main/feature/config/feature-controlloop-trans.properties b/controlloop/common/feature-controlloop-trans/src/main/feature/config/feature-controlloop-trans.properties index 7744defa4..f65baf248 100644 --- a/controlloop/common/feature-controlloop-trans/src/main/feature/config/feature-controlloop-trans.properties +++ b/controlloop/common/feature-controlloop-trans/src/main/feature/config/feature-controlloop-trans.properties @@ -18,4 +18,4 @@ # ============LICENSE_END========================================================= ### controlloop.cache.transactions.size=100 -controllop.cache.transactions.timeout.seconds=1800 +controlloop.cache.transactions.timeout.seconds=1800 diff --git a/controlloop/common/feature-controlloop-usecases/src/main/feature/config/logback-include-usecases.xml b/controlloop/common/feature-controlloop-usecases/src/main/feature/config/logback-include-usecases.xml index 655ccd7ca..753d2e01c 100644 --- a/controlloop/common/feature-controlloop-usecases/src/main/feature/config/logback-include-usecases.xml +++ b/controlloop/common/feature-controlloop-usecases/src/main/feature/config/logback-include-usecases.xml @@ -3,6 +3,7 @@ feature-controlloop-usecases ================================================================================ Copyright (C) 2019-2020 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. @@ -49,8 +50,15 @@ <appender-ref ref="UsecasesOut" /> </appender> + <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> + <encoder> + <pattern>${networkPattern}</pattern> + </encoder> + </appender> + <logger name="usecases" level="INFO" additivity="false"> <appender-ref ref="AsyncUsecasesOut" /> + <appender-ref ref="STDOUT" /> </logger> </included> diff --git a/controlloop/common/rules-test/src/test/resources/rulesTest.drl b/controlloop/common/rules-test/src/test/resources/rulesTest.drl index a1a89714a..31c4f66e7 100644 --- a/controlloop/common/rules-test/src/test/resources/rulesTest.drl +++ b/controlloop/common/rules-test/src/test/resources/rulesTest.drl @@ -40,7 +40,7 @@ import org.onap.policy.drools.system.PolicyEngineConstants; rule "STARTED" when then - System.out.println(drools.getRule().getName()); + System.out.println(drools.getRule().getName()); end /* @@ -52,10 +52,9 @@ rule "INSERT.PARAMS" when $params : ControlLoopParams() then - - Logger logger = LoggerFactory.getLogger(drools.getRule().getPackageName()); - logger.info("{}: {} : TOSCA-POLICY=[{}]", $params.getClosedLoopControlName(), $params.getPolicyName() + "." - + drools.getRule().getName(), $params.getToscaPolicy()); + Logger logger = LoggerFactory.getLogger(drools.getRule().getPackageName()); + logger.info("{}: {} : TOSCA-POLICY=[{}]", $params.getClosedLoopControlName(), $params.getPolicyName() + "." + + drools.getRule().getName(), $params.getToscaPolicy()); end /* @@ -67,16 +66,15 @@ rule "NEW.TOSCA.POLICY" when $policy : ToscaPolicy() then + Logger logger = LoggerFactory.getLogger(drools.getRule().getPackageName()); + logger.info("{}: [{}|{}|{}|{}]: CONTENT: {}", drools.getRule().getName(), + $policy.getType(), $policy.getTypeVersion(), $policy.getName(), + $policy.getVersion(), $policy); - Logger logger = LoggerFactory.getLogger(drools.getRule().getPackageName()); - logger.info("{}: [{}|{}|{}|{}]: CONTENT: {}", drools.getRule().getName(), - $policy.getType(), $policy.getTypeVersion(), $policy.getName(), - $policy.getVersion(), $policy); - - ControlLoopParams params = ControlLoopUtils.toControlLoopParams($policy); - if (params != null) { - insert(params); - } + ControlLoopParams params = ControlLoopUtils.toControlLoopParams($policy); + if (params != null) { + insert(params); + } end /* @@ -87,10 +85,9 @@ rule "REMOVE.PARAMS" $params : ControlLoopParams( $policyName : getPolicyName(), $policyVersion : getPolicyVersion() ) not ( ToscaPolicy( getName() == $policyName, getVersion() == $policyVersion ) ) then + Logger logger = LoggerFactory.getLogger(drools.getRule().getPackageName()); + logger.info("{}: [{}|{}|{}]", drools.getRule().getName(), + $params.getPolicyScope(), $params.getPolicyName(), $params.getPolicyVersion()); - Logger logger = LoggerFactory.getLogger(drools.getRule().getPackageName()); - logger.info("{}: [{}|{}|{}]", drools.getRule().getName(), - $params.getPolicyScope(), $params.getPolicyName(), $params.getPolicyVersion()); - - retract($params); + retract($params); end |