/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2021-2025 Nordix Foundation.
+ * Copyright (C) 2021-2025 OpenInfra Foundation Europe. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
import org.onap.policy.models.base.Validated;
/**
- * Class to represent a automation composition in the database.
+ * Class to represent an automation composition in the database.
*
* @author Liam Fallon (liam.fallon@est.tech)
*/
import lombok.EqualsAndHashCode;
import lombok.NonNull;
import org.apache.commons.lang3.ObjectUtils;
-import org.hibernate.annotations.LazyCollection;
-import org.hibernate.annotations.LazyCollectionOption;
import org.onap.policy.clamp.models.acm.concepts.Participant;
import org.onap.policy.common.parameters.annotations.NotNull;
import org.onap.policy.common.parameters.annotations.Valid;
@NotNull
@OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
- @LazyCollection(LazyCollectionOption.FALSE)
@JoinColumn(name = "participantId", referencedColumnName = "participantId",
foreignKey = @ForeignKey(name = "participant_replica_fk"))
@SuppressWarnings("squid:S1948")
* @param map1 Map where to merge
* @param map2 Map
*/
+ @SuppressWarnings({"unchecked", "rawtypes"})
public static void recursiveMerge(Map<String, Object> map1, Map<String, Object> map2) {
Deque<Pair<Map<String, Object>, Map<String, Object>>> stack = new ArrayDeque<>();
stack.push(Pair.of(map1, map2));
}
}
+ @SuppressWarnings({"unchecked", "rawtypes"})
private static void recursiveMerge(List<Object> list1, List<Object> list2) {
for (var i = 0; i < list1.size(); i++) {
var valueLeft = list1.get(i);
#!/usr/bin/env sh
#
# ============LICENSE_START=======================================================
-# Copyright (C) 2021-2022 Nordix Foundation.
+# Copyright (C) 2021-2022, 2025 OpenInfra Foundation Europe. All rights reserved.
# ================================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# ============LICENSE_END=========================================================
#
-KEYSTORE="${KEYSTORE:-$POLICY_HOME/etc/ssl/policy-keystore}"
-TRUSTSTORE="${TRUSTSTORE:-$POLICY_HOME/etc/ssl/policy-truststore}"
-KEYSTORE_PASSWD="${KEYSTORE_PASSWD:-Pol1cy_0nap}"
-TRUSTSTORE_PASSWD="${TRUSTSTORE_PASSWD:-Pol1cy_0nap}"
-
if [ "$#" -eq 1 ]; then
CONFIG_FILE=$1
fi
echo "Policy clamp A1 Pms participant config file: $CONFIG_FILE"
-if [ -f "${POLICY_HOME}/etc/mounted/policy-truststore" ]; then
- echo "overriding policy-truststore"
- cp -f "${POLICY_HOME}"/etc/mounted/policy-truststore "${TRUSTSTORE}"
-fi
-
-if [ -f "${POLICY_HOME}/etc/mounted/policy-keystore" ]; then
- echo "overriding policy-keystore"
- cp -f "${POLICY_HOME}"/etc/mounted/policy-keystore "${KEYSTORE}"
-fi
-
if [ -f "${POLICY_HOME}/etc/mounted/logback.xml" ]; then
echo "overriding logback xml file"
cp -f "${POLICY_HOME}"/etc/mounted/logback.xml "${POLICY_HOME}"/etc/
fi
-$JAVA_HOME/bin/java \
+"$JAVA_HOME"/bin/java \
-Dlogging.config="${POLICY_HOME}/etc/logback.xml" \
-Dserver.ssl.keyStore="${KEYSTORE}" \
-Dserver.ssl.keyStorePassword="${KEYSTORE_PASSWD}" \
#!/usr/bin/env sh
#
# ============LICENSE_START=======================================================
-# Copyright (C) 2021-2022 Nordix Foundation.
+# Copyright (C) 2021-2022, 2025 OpenInfra Foundation Europe. All rights reserved.
# ================================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# ============LICENSE_END=========================================================
#
-KEYSTORE="${KEYSTORE:-$POLICY_HOME/etc/ssl/policy-keystore}"
-TRUSTSTORE="${TRUSTSTORE:-$POLICY_HOME/etc/ssl/policy-truststore}"
-KEYSTORE_PASSWD="${KEYSTORE_PASSWD:-Pol1cy_0nap}"
-TRUSTSTORE_PASSWD="${TRUSTSTORE_PASSWD:-Pol1cy_0nap}"
-
if [ "$#" -eq 1 ]; then
CONFIG_FILE=$1
fi
echo "Policy clamp runtime acm config file: $CONFIG_FILE"
-if [ -f "${POLICY_HOME}/etc/mounted/policy-truststore" ]; then
- echo "overriding policy-truststore"
- cp -f "${POLICY_HOME}"/etc/mounted/policy-truststore "${TRUSTSTORE}"
-fi
-
-if [ -f "${POLICY_HOME}/etc/mounted/policy-keystore" ]; then
- echo "overriding policy-keystore"
- cp -f "${POLICY_HOME}"/etc/mounted/policy-keystore "${KEYSTORE}"
-fi
-
if [ -f "${POLICY_HOME}/etc/mounted/logback.xml" ]; then
echo "overriding logback xml file"
cp -f "${POLICY_HOME}"/etc/mounted/logback.xml "${POLICY_HOME}"/etc/
fi
-$JAVA_HOME/bin/java \
+"$JAVA_HOME"/bin/java \
-Dlogging.config="${POLICY_HOME}/etc/logback.xml" \
- -Dserver.ssl.keyStore="${KEYSTORE}" \
- -Dserver.ssl.keyStorePassword="${KEYSTORE_PASSWD}" \
- -Djavax.net.ssl.trustStore="${TRUSTSTORE}" \
- -Djavax.net.ssl.trustStorePassword="${TRUSTSTORE_PASSWD}" \
-Dcom.sun.management.jmxremote.rmi.port=9090 \
-Dcom.sun.management.jmxremote=true \
-Dcom.sun.management.jmxremote.port=9090 \
#!/usr/bin/env sh
#
# ============LICENSE_START=======================================================
-# Copyright (C) 2022 Nordix Foundation.
+# Copyright (C) 2022, 2025 OpenInfra Foundation Europe. All rights reserved.
# ================================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# ============LICENSE_END=========================================================
#
-KEYSTORE="${KEYSTORE:-$POLICY_HOME/etc/ssl/policy-keystore}"
-TRUSTSTORE="${TRUSTSTORE:-$POLICY_HOME/etc/ssl/policy-truststore}"
-KEYSTORE_PASSWD="${KEYSTORE_PASSWD:-Pol1cy_0nap}"
-TRUSTSTORE_PASSWD="${TRUSTSTORE_PASSWD:-Pol1cy_0nap}"
-
if [ "$#" -eq 1 ]; then
CONFIG_FILE=$1
fi
echo "Policy clamp Element participant config file: $CONFIG_FILE"
-if [ -f "${POLICY_HOME}/etc/mounted/policy-truststore" ]; then
- echo "overriding policy-truststore"
- cp -f "${POLICY_HOME}"/etc/mounted/policy-truststore "${TRUSTSTORE}"
-fi
-
-if [ -f "${POLICY_HOME}/etc/mounted/policy-keystore" ]; then
- echo "overriding policy-keystore"
- cp -f "${POLICY_HOME}"/etc/mounted/policy-keystore "${KEYSTORE}"
-fi
-
if [ -f "${POLICY_HOME}/etc/mounted/logback.xml" ]; then
echo "overriding logback xml file"
cp -f "${POLICY_HOME}"/etc/mounted/logback.xml "${POLICY_HOME}"/etc/
fi
-$JAVA_HOME/bin/java \
+"$JAVA_HOME"/bin/java \
-Dlogging.config="${POLICY_HOME}/etc/logback.xml" \
- -Dserver.ssl.keyStore="${KEYSTORE}" \
- -Dserver.ssl.keyStorePassword="${KEYSTORE_PASSWD}" \
- -Djavax.net.ssl.trustStore="${TRUSTSTORE}" \
- -Djavax.net.ssl.trustStorePassword="${TRUSTSTORE_PASSWD}" \
-jar /app/app.jar \
--spring.config.location="${CONFIG_FILE}"
#!/usr/bin/env sh
#
# ============LICENSE_START=======================================================
-# Copyright (C) 2021-2022 Nordix Foundation.
+# Copyright (C) 2021-2022, 2025 OpenInfra Foundation Europe. All rights reserved.
# ================================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# ============LICENSE_END=========================================================
#
-KEYSTORE="${KEYSTORE:-$POLICY_HOME/etc/ssl/policy-keystore}"
-TRUSTSTORE="${TRUSTSTORE:-$POLICY_HOME/etc/ssl/policy-truststore}"
-KEYSTORE_PASSWD="${KEYSTORE_PASSWD:-Pol1cy_0nap}"
-TRUSTSTORE_PASSWD="${TRUSTSTORE_PASSWD:-Pol1cy_0nap}"
-
if [ "$#" -eq 1 ]; then
CONFIG_FILE=$1
fi
echo "Policy clamp HTTP participant config file: $CONFIG_FILE"
-if [ -f "${POLICY_HOME}/etc/mounted/policy-truststore" ]; then
- echo "overriding policy-truststore"
- cp -f "${POLICY_HOME}"/etc/mounted/policy-truststore "${TRUSTSTORE}"
-fi
-
-if [ -f "${POLICY_HOME}/etc/mounted/policy-keystore" ]; then
- echo "overriding policy-keystore"
- cp -f "${POLICY_HOME}"/etc/mounted/policy-keystore "${KEYSTORE}"
-fi
-
if [ -f "${POLICY_HOME}/etc/mounted/logback.xml" ]; then
echo "overriding logback xml file"
cp -f "${POLICY_HOME}"/etc/mounted/logback.xml "${POLICY_HOME}"/etc/
fi
-$JAVA_HOME/bin/java \
+"$JAVA_HOME"/bin/java \
-Dlogging.config="${POLICY_HOME}/etc/logback.xml" \
- -Dserver.ssl.keyStore="${KEYSTORE}" \
- -Dserver.ssl.keyStorePassword="${KEYSTORE_PASSWD}" \
- -Djavax.net.ssl.trustStore="${TRUSTSTORE}" \
- -Djavax.net.ssl.trustStorePassword="${TRUSTSTORE_PASSWD}" \
-jar /app/app.jar \
--spring.config.location="${CONFIG_FILE}"
#!/usr/bin/env sh
#
# ============LICENSE_START=======================================================
-# Copyright (C) 2023 Nordix Foundation.
+# Copyright (C) 2023, 2025 OpenInfra Foundation Europe. All rights reserved.
# ================================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# ============LICENSE_END=========================================================
#
-KEYSTORE="${KEYSTORE:-$POLICY_HOME/etc/ssl/policy-keystore}"
-TRUSTSTORE="${TRUSTSTORE:-$POLICY_HOME/etc/ssl/policy-truststore}"
-KEYSTORE_PASSWD="${KEYSTORE_PASSWD:-Pol1cy_0nap}"
-TRUSTSTORE_PASSWD="${TRUSTSTORE_PASSWD:-Pol1cy_0nap}"
-
if [ "$#" -eq 1 ]; then
CONFIG_FILE=$1
fi
echo "Policy clamp Kserve participant config file: $CONFIG_FILE"
-if [ -f "${POLICY_HOME}/etc/mounted/policy-truststore" ]; then
- echo "overriding policy-truststore"
- cp -f "${POLICY_HOME}"/etc/mounted/policy-truststore "${TRUSTSTORE}"
-fi
-
-if [ -f "${POLICY_HOME}/etc/mounted/policy-keystore" ]; then
- echo "overriding policy-keystore"
- cp -f "${POLICY_HOME}"/etc/mounted/policy-keystore "${KEYSTORE}"
-fi
-
if [ -f "${POLICY_HOME}/etc/mounted/logback.xml" ]; then
echo "overriding logback xml file"
cp -f "${POLICY_HOME}"/etc/mounted/logback.xml "${POLICY_HOME}"/etc/
fi
-$JAVA_HOME/bin/java \
+"$JAVA_HOME"/bin/java \
-Dlogging.config="${POLICY_HOME}/etc/logback.xml" \
- -Dserver.ssl.keyStore="${KEYSTORE}" \
- -Dserver.ssl.keyStorePassword="${KEYSTORE_PASSWD}" \
- -Djavax.net.ssl.trustStore="${TRUSTSTORE}" \
- -Djavax.net.ssl.trustStorePassword="${TRUSTSTORE_PASSWD}" \
-jar /app/app.jar \
--spring.config.location="${CONFIG_FILE}"
#!/usr/bin/env sh
#
# ============LICENSE_START=======================================================
-# Copyright (C) 2021-2022 Nordix Foundation.
+# Copyright (C) 2021-2022, 2025 OpenInfra Foundation Europe. All rights reserved.
# ================================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# ============LICENSE_END=========================================================
#
-KEYSTORE="${KEYSTORE:-$POLICY_HOME/etc/ssl/policy-keystore}"
-TRUSTSTORE="${TRUSTSTORE:-$POLICY_HOME/etc/ssl/policy-truststore}"
-KEYSTORE_PASSWD="${KEYSTORE_PASSWD:-Pol1cy_0nap}"
-TRUSTSTORE_PASSWD="${TRUSTSTORE_PASSWD:-Pol1cy_0nap}"
-
if [ "$#" -eq 1 ]; then
CONFIG_FILE=$1
fi
echo "Policy clamp Kubernetes participant config file: $CONFIG_FILE"
-if [ -f "${POLICY_HOME}/etc/mounted/policy-truststore" ]; then
- echo "overriding policy-truststore"
- cp -f "${POLICY_HOME}"/etc/mounted/policy-truststore "${TRUSTSTORE}"
-fi
-
-if [ -f "${POLICY_HOME}/etc/mounted/policy-keystore" ]; then
- echo "overriding policy-keystore"
- cp -f "${POLICY_HOME}"/etc/mounted/policy-keystore "${KEYSTORE}"
-fi
-
if [ -f "${POLICY_HOME}/etc/mounted/logback.xml" ]; then
echo "overriding logback xml file"
cp -f "${POLICY_HOME}"/etc/mounted/logback.xml "${POLICY_HOME}"/etc/
fi
-$JAVA_HOME/bin/java \
+"$JAVA_HOME"/bin/java \
-Dlogging.config="${POLICY_HOME}/etc/logback.xml" \
- -Dserver.ssl.keyStore="${KEYSTORE}" \
- -Dserver.ssl.keyStorePassword="${KEYSTORE_PASSWD}" \
- -Djavax.net.ssl.trustStore="${TRUSTSTORE}" \
- -Djavax.net.ssl.trustStorePassword="${TRUSTSTORE_PASSWD}" \
-jar /app/app.jar \
--spring.config.location="${CONFIG_FILE}"
#!/usr/bin/env sh
#
# ============LICENSE_START=======================================================
-# Copyright (C) 2021-2022 Nordix Foundation.
+# Copyright (C) 2021-2022, 2025 OpenInfra Foundation Europe. All rights reserved.
# ================================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# ============LICENSE_END=========================================================
#
-KEYSTORE="${KEYSTORE:-$POLICY_HOME/etc/ssl/policy-keystore}"
-TRUSTSTORE="${TRUSTSTORE:-$POLICY_HOME/etc/ssl/policy-truststore}"
-KEYSTORE_PASSWD="${KEYSTORE_PASSWD:-Pol1cy_0nap}"
-TRUSTSTORE_PASSWD="${TRUSTSTORE_PASSWD:-Pol1cy_0nap}"
-
if [ "$#" -eq 1 ]; then
CONFIG_FILE=$1
fi
echo "Policy clamp policy participant config file: $CONFIG_FILE"
-if [ -f "${POLICY_HOME}/etc/mounted/policy-truststore" ]; then
- echo "overriding policy-truststore"
- cp -f "${POLICY_HOME}"/etc/mounted/policy-truststore "${TRUSTSTORE}"
-fi
-
-if [ -f "${POLICY_HOME}/etc/mounted/policy-keystore" ]; then
- echo "overriding policy-keystore"
- cp -f "${POLICY_HOME}"/etc/mounted/policy-keystore "${KEYSTORE}"
-fi
-
if [ -f "${POLICY_HOME}/etc/mounted/logback.xml" ]; then
echo "overriding logback xml file"
cp -f "${POLICY_HOME}"/etc/mounted/logback.xml "${POLICY_HOME}"/etc/
fi
-$JAVA_HOME/bin/java \
+"$JAVA_HOME"/bin/java \
-Dlogging.config="${POLICY_HOME}/etc/logback.xml" \
- -Dserver.ssl.keyStore="${KEYSTORE}" \
- -Dserver.ssl.keyStorePassword="${KEYSTORE_PASSWD}" \
- -Djavax.net.ssl.trustStore="${TRUSTSTORE}" \
- -Djavax.net.ssl.trustStorePassword="${TRUSTSTORE_PASSWD}" \
-jar /app/app.jar \
--spring.config.location="${CONFIG_FILE}"
#!/usr/bin/env sh
#
# ============LICENSE_START=======================================================
-# Copyright (C) 2023 Nordix Foundation.
+# Copyright (C) 2023, 2025 OpenInfra Foundation Europe. All rights reserved.
# ================================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# ============LICENSE_END=========================================================
#
-KEYSTORE="${KEYSTORE:-$POLICY_HOME/etc/ssl/policy-keystore}"
-TRUSTSTORE="${TRUSTSTORE:-$POLICY_HOME/etc/ssl/policy-truststore}"
-KEYSTORE_PASSWD="${KEYSTORE_PASSWD:-Pol1cy_0nap}"
-TRUSTSTORE_PASSWD="${TRUSTSTORE_PASSWD:-Pol1cy_0nap}"
-
if [ "$#" -eq 1 ]; then
CONFIG_FILE=$1
fi
echo "Policy clamp Simulator participant config file: $CONFIG_FILE"
-if [ -f "${POLICY_HOME}/etc/mounted/policy-truststore" ]; then
- echo "overriding policy-truststore"
- cp -f "${POLICY_HOME}"/etc/mounted/policy-truststore "${TRUSTSTORE}"
-fi
-
-if [ -f "${POLICY_HOME}/etc/mounted/policy-keystore" ]; then
- echo "overriding policy-keystore"
- cp -f "${POLICY_HOME}"/etc/mounted/policy-keystore "${KEYSTORE}"
-fi
-
if [ -f "${POLICY_HOME}/etc/mounted/logback.xml" ]; then
echo "overriding logback xml file"
cp -f "${POLICY_HOME}"/etc/mounted/logback.xml "${POLICY_HOME}"/etc/
fi
-$JAVA_HOME/bin/java \
+"$JAVA_HOME"/bin/java \
-Dlogging.config="${POLICY_HOME}/etc/logback.xml" \
- -Dserver.ssl.keyStore="${KEYSTORE}" \
- -Dserver.ssl.keyStorePassword="${KEYSTORE_PASSWD}" \
- -Djavax.net.ssl.trustStore="${TRUSTSTORE}" \
- -Djavax.net.ssl.trustStorePassword="${TRUSTSTORE_PASSWD}" \
-jar /app/app.jar \
--spring.config.location="${CONFIG_FILE}"
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2021,2023-2024 Nordix Foundation.
+ * Copyright (C) 2021,2023-2025 OpenInfra Foundation Europe. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
if (useBasicAuth) {
http
- .httpBasic(Customizer.withDefaults())
- .authorizeHttpRequests(authorize -> authorize.anyRequest().authenticated());
+ .httpBasic(Customizer.withDefaults())
+ .authorizeHttpRequests(authorize -> authorize.anyRequest().authenticated());
} else {
- http
- .authorizeHttpRequests(authorize -> authorize.anyRequest().permitAll());
+ http.authorizeHttpRequests(authorize -> authorize.anyRequest().permitAll());
}
http.csrf(AbstractHttpConfigurer::disable);
package org.onap.policy.clamp.acm.runtime.main.rest.stub;
-import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import lombok.RequiredArgsConstructor;
@Override
public ResponseEntity<List<ParticipantInformation>> queryParticipants(String name, String version,
Integer page, Integer size, UUID xonaprequestid) {
- List<ParticipantInformation> participantInformationList = new ArrayList<>();
- return (ResponseEntity<List<ParticipantInformation>>) stubUtils
- .getResponse(pathToParticipantList, participantInformationList.getClass());
+ return stubUtils.getResponseList(pathToParticipantList);
}
}
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2022 Nordix Foundation.
+ * Copyright (C) 2022, 2025 OpenInfra Foundation Europe. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
import jakarta.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
+import java.util.List;
import lombok.RequiredArgsConstructor;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.common.utils.coder.StandardYamlCoder;
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).build();
}
}
+
+ @SuppressWarnings({"unchecked", "rawtypes"})
+ <T> ResponseEntity<List<T>> getResponseList(String path) {
+ final var resource = new ClassPathResource(path);
+ try (var inputStream = resource.getInputStream()) {
+ final var string = new String(inputStream.readAllBytes(), StandardCharsets.UTF_8);
+ var targetObject = JSON_TRANSLATOR.fromJson(string, ArrayList.class);
+ return new ResponseEntity<>(targetObject, HttpStatus.OK);
+ } catch (IOException exception) {
+ log.error("Error reading the file.", exception);
+ return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).build();
+ }
+ }
}
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2021,2023-2025 Nordix Foundation.
+ * Copyright (C) 2021,2023-2025 OpenInfra Foundation Europe. All rights reserved.
* Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
import org.onap.policy.common.endpoints.listeners.ScoListener;
import org.onap.policy.common.message.bus.event.Topic.CommInfrastructure;
import org.onap.policy.common.utils.coder.StandardCoderObject;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
/**
@Component
public class AutomationCompositionStateChangeAckListener extends ScoListener<AutomationCompositionDeployAck>
implements Listener<AutomationCompositionDeployAck> {
- private static final Logger LOGGER = LoggerFactory.getLogger(AutomationCompositionStateChangeAckListener.class);
private final SupervisionAcHandler supervisionHandler;
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2021,2023-2025 Nordix Foundation.
+ * Copyright (C) 2021,2023-2025 OpenInfra Foundation Europe. All rights reserved.
* Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
import org.onap.policy.common.endpoints.listeners.ScoListener;
import org.onap.policy.common.message.bus.event.Topic.CommInfrastructure;
import org.onap.policy.common.utils.coder.StandardCoderObject;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
/**
@Component
public class AutomationCompositionUpdateAckListener extends ScoListener<AutomationCompositionDeployAck>
implements Listener<AutomationCompositionDeployAck> {
- private static final Logger LOGGER = LoggerFactory.getLogger(AutomationCompositionUpdateAckListener.class);
private final SupervisionAcHandler supervisionHandler;
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2021-2025 Nordix Foundation.
+ * Copyright (C) 2021-2025 OpenInfra Foundation Europe. All rights reserved.
* Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
import org.onap.policy.common.endpoints.listeners.ScoListener;
import org.onap.policy.common.message.bus.event.Topic.CommInfrastructure;
import org.onap.policy.common.utils.coder.StandardCoderObject;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
/**
@Component
public class ParticipantDeregisterListener extends ScoListener<ParticipantDeregister>
implements Listener<ParticipantDeregister> {
- private static final Logger LOGGER = LoggerFactory.getLogger(ParticipantDeregisterListener.class);
private final SupervisionParticipantHandler supervisionHandler;
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2021-2025 Nordix Foundation.
+ * Copyright (C) 2021-2025 OpenInfra Foundation Europe. All rights reserved.
* Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
import org.onap.policy.common.endpoints.listeners.ScoListener;
import org.onap.policy.common.message.bus.event.Topic.CommInfrastructure;
import org.onap.policy.common.utils.coder.StandardCoderObject;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
/**
@Component
public class ParticipantPrimeAckListener extends ScoListener<ParticipantPrimeAck>
implements Listener<ParticipantPrimeAck> {
- private static final Logger LOGGER = LoggerFactory.getLogger(ParticipantPrimeAckListener.class);
private final SupervisionHandler supervisionHandler;
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2021-2025 Nordix Foundation.
+ * Copyright (C) 2021-2025 OpenInfra Foundation Europe. All rights reserved.
* Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
import org.onap.policy.common.endpoints.listeners.ScoListener;
import org.onap.policy.common.message.bus.event.Topic.CommInfrastructure;
import org.onap.policy.common.utils.coder.StandardCoderObject;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
/**
@Component
public class ParticipantRegisterListener extends ScoListener<ParticipantRegister>
implements Listener<ParticipantRegister> {
- private static final Logger LOGGER = LoggerFactory.getLogger(ParticipantRegisterListener.class);
private final SupervisionParticipantHandler supervisionHandler;
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2021-2025 Nordix Foundation.
+ * Copyright (C) 2021-2025 OpenInfra Foundation Europe. All rights reserved.
* Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
import org.onap.policy.common.endpoints.listeners.ScoListener;
import org.onap.policy.common.message.bus.event.Topic.CommInfrastructure;
import org.onap.policy.common.utils.coder.StandardCoderObject;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
/**
*/
@Component
public class ParticipantStatusListener extends ScoListener<ParticipantStatus> implements Listener<ParticipantStatus> {
- private static final Logger LOGGER = LoggerFactory.getLogger(ParticipantStatusListener.class);
private final SupervisionParticipantHandler supervisionHandler;
import org.onap.policy.clamp.acm.runtime.util.CommonTestData;
import org.onap.policy.clamp.acm.runtime.util.rest.CommonRestController;
import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionDefinition;
-import org.onap.policy.clamp.models.acm.concepts.Participant;
import org.onap.policy.clamp.models.acm.concepts.ParticipantSupportedElementType;
import org.onap.policy.clamp.models.acm.messages.rest.commissioning.AcTypeStateUpdate;
import org.onap.policy.clamp.models.acm.messages.rest.commissioning.CommissioningResponse;
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2022-2023 Nordix Foundation.
+ * Copyright (C) 2022-2023, 2025 OpenInfra Foundation Europe. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
private int randomServerPort;
@BeforeEach
- public void setUpPort() {
+ void setUpPort() {
super.setHttpPrefix(randomServerPort);
}
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2023 Nordix Foundation.
+ * Copyright (C) 2023, 2025 OpenInfra Foundation Europe. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
private int randomServerPort;
@BeforeEach
- public void setUpPort() {
+ void setUpPort() {
super.setHttpPrefix(randomServerPort);
}
void testOrderReport() {
var invocationBuilder = super.sendRequest(PARTICIPANT_ENDPOINT + "/" + PARTICIPANT_ID);
- var respPost = invocationBuilder.header("Content-Length", 0).put(Entity.entity(""
- + "", MediaType.APPLICATION_JSON));
+ var respPost = invocationBuilder.header("Content-Length", 0)
+ .put(Entity.entity("", MediaType.APPLICATION_JSON));
assertThat(Response.Status.ACCEPTED.getStatusCode()).isEqualTo(respPost.getStatus());
+ respPost.close();
}
@Test
void testOrderAllReport() {
var invocationBuilder = super.sendRequest(PARTICIPANT_ENDPOINT);
- var respPost = invocationBuilder.header("Content-Length", 0).put(Entity.entity(""
- + "", MediaType.APPLICATION_JSON));
+ var respPost = invocationBuilder.header("Content-Length", 0)
+ .put(Entity.entity("", MediaType.APPLICATION_JSON));
assertThat(Response.Status.ACCEPTED.getStatusCode()).isEqualTo(respPost.getStatus());
+ respPost.close();
}
}
private static ToscaServiceTemplate serviceTemplateMigration = new ToscaServiceTemplate();
@BeforeAll
- public static void setUpBeforeClass() {
+ static void setUpBeforeClass() {
var st = InstantiationUtils.getToscaServiceTemplate(TOSCA_SERVICE_TEMPLATE_YAML);
var jpa = ProviderUtils.getJpaAndValidate(st, JpaToscaServiceTemplate::new, "toscaServiceTemplate");
serviceTemplate = jpa.toAuthorative();
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2025 OpenInfra Foundation Europe. All rights reserved.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.clamp.acm.runtime.main.rest.stub;
+
+import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+import jakarta.servlet.http.HttpServletRequest;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.mockito.Mockito;
+import org.springframework.http.HttpStatus;
+
+class StubUtilsTest {
+
+ HttpServletRequest mockRequest;
+
+ StubUtils stubUtil;
+
+ @BeforeEach
+ void setUp() {
+ mockRequest = Mockito.mock(HttpServletRequest.class);
+ Mockito.when(mockRequest.getHeader("Accept")).thenReturn("application/yaml");
+ stubUtil = new StubUtils(mockRequest);
+ }
+
+ @Test
+ void getResponse() {
+ assertDoesNotThrow(() -> stubUtil.getResponse("does/not/exist/path", Object.class));
+ var response = stubUtil.getResponse("does/not/exist/path", Object.class);
+ assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, response.getStatusCode());
+ }
+
+ @Test
+ void getResponseList() {
+ assertDoesNotThrow(() -> stubUtil.getResponseList("does/not/exist/path"));
+ var response = stubUtil.getResponseList("does/not/exist/path");
+ assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, response.getStatusCode());
+ }
+}
\ No newline at end of file
* Adds participants to the db from json file.
*/
@BeforeAll
- public static void setUpBeforeClass() throws CoderException {
+ static void setUpBeforeClass() throws CoderException {
inputParticipants.add(CODER.decode(ORIGINAL_JSON, Participant.class));
inputParticipants.add(CODER.decode(ORIGINAL_JSON2, Participant.class));
serviceTemplate = InstantiationUtils.getToscaServiceTemplate(TOSCA_SERVICE_TEMPLATE_YAML);
}
@BeforeEach
- public void setUpPort() {
+ void setUpPort() {
super.setHttpPrefix(randomServerPort);
}
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2021-2024 Nordix Foundation.
+ * Copyright (C) 2021-2025 OpenInfra Foundation Europe. All rights reserved.
* Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
class SupervisionAspectTest {
@Test
- void testSchedule() throws Exception {
+ void testSchedule() {
var supervisionScanner = mock(SupervisionScanner.class);
var participantScanner = mock(SupervisionParticipantScanner.class);
try (var supervisionAspect = new SupervisionAspect(supervisionScanner, participantScanner)) {
}
@Test
- void testDoCheck() throws Exception {
+ void testDoCheck() {
var supervisionScanner = mock(SupervisionScanner.class);
var participantScanner = mock(SupervisionParticipantScanner.class);
try (var supervisionAspect = new SupervisionAspect(supervisionScanner, participantScanner)) {
*
* @param port the port
*/
- protected void setHttpPrefix(int port) {
+ public void setHttpPrefix(int port) {
httpPrefix = "http://" + SELF + ":" + port + "/";
}