/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2024 Nordix Foundation. All rights reserved.
+ * Copyright (C) 2024-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.tosca.authorative.concepts.ToscaServiceTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
-import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.http.MediaType;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ActiveProfiles;
+import org.springframework.test.context.bean.override.mockito.MockitoBean;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.web.context.WebApplicationContext;
@Autowired
private MockMvc mvc;
- @MockBean
+ @MockitoBean
private HealthCheckProvider healthCheckProvider;
- @MockBean
+ @MockitoBean
private ToscaServiceTemplateService toscaServiceTemplateService;
AutoCloseable autoCloseable;
* ============LICENSE_START=======================================================
* ONAP Policy API
* ================================================================================
- * Copyright (C) 2022-2024 Nordix Foundation. All rights reserved.
+ * 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 org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
-import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.http.MediaType;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ActiveProfiles;
+import org.springframework.test.context.bean.override.mockito.MockitoBean;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.web.context.WebApplicationContext;
@Autowired
private MockMvc mvc;
- @MockBean
+ @MockitoBean
private ToscaServiceTemplateService toscaServiceTemplateService;
AutoCloseable autoCloseable;
/*
* ============LICENSE_START=======================================================
* Copyright (C) 2022 Bell Canada. All rights reserved.
- * Modifications Copyright (C) 2023-2024 Nordix Foundation.
+ * Modifications 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.
/**
* This class offers common mock utility methods for uni testing {@link ToscaServiceTemplateService}.
*/
-public class TestCommonToscaServiceTemplateService {
+class TestCommonToscaServiceTemplateService {
protected enum Operation {
CREATE_POLICY_TYPE,
* Setup to return empty DB service template.
*/
@BeforeEach
- public void setUp() {
+ void setUp() {
autoCloseable = MockitoAnnotations.openMocks(this);
Mockito.when(toscaServiceTemplateRepository.findById(new PfConceptKey(JpaToscaServiceTemplate.DEFAULT_NAME,
JpaToscaServiceTemplate.DEFAULT_VERSION))).thenReturn(Optional.of(new JpaToscaServiceTemplate()));
}
@AfterEach
- public void tearDown() throws Exception {
+ void tearDown() throws Exception {
autoCloseable.close();
}
}
\ No newline at end of file
* ============LICENSE_START=======================================================
* ONAP Policy API
* ================================================================================
- * Copyright (C) 2022-2024 Nordix Foundation. All rights reserved.
+ * 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.
* @throws CoderException if error in json parsing
*/
@BeforeEach
- public void setUp() throws CoderException {
+ void setUp() throws CoderException {
closeable = MockitoAnnotations.openMocks(this);
StandardCoder standardCoder = new StandardCoder();
policyServiceTemplate =
/*
* ============LICENSE_START=======================================================
* Copyright (C) 2022 Bell Canada. All rights reserved.
- * Modifications Copyright (C) 2023 Nordix Foundation.
+ * Modifications 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.
* @throws CoderException decode errors
*/
@BeforeEach
- public void setUp() throws CoderException {
+ void setUp() throws CoderException {
closeable = MockitoAnnotations.openMocks(this);
var pdpGroups = new StandardCoder().decode(ResourceUtils.getResourceAsString("pdpgroups/PdpGroups.json"),
PdpGroups.class).getGroups();
/*
* ============LICENSE_START=======================================================
* Copyright (C) 2022 Bell Canada. All rights reserved.
- * Modifications Copyright (C) 2023 Nordix Foundation.
+ * Modifications 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.
AutoCloseable closeable;
@BeforeEach
- public void setUp() {
+ void setUp() {
closeable = MockitoAnnotations.openMocks(this);
}
#
# ============LICENSE_START=======================================================
# Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved.
-# Modifications Copyright (C) 2019-2022 Nordix Foundation.
+# Modifications Copyright (C) 2019-2022, 2025 OpenInfra Foundation Europe. All rights reserved.
# Modifications Copyright (C) 2022 Bell Canada. All rights reserved.
# ================================================================================
# Licensed under the Apache License, Version 2.0 (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
else
+ # shellcheck disable=SC2269
CONFIG_FILE=${CONFIG_FILE}
fi
echo "Policy api 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"
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.key-store="${KEYSTORE}" \
- -Dserver.ssl.key-store-password="${KEYSTORE_PASSWD}" \
- -Djavax.net.ssl.trustStore="${TRUSTSTORE}" \
- -Djavax.net.ssl.trustStorePassword="${TRUSTSTORE_PASSWD}" \
-jar /app/api.jar \
--spring.config.location="${CONFIG_FILE}"