diff options
25 files changed, 207 insertions, 24 deletions
diff --git a/common/pom.xml b/common/pom.xml index c60ed6c8f..297c861c3 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -27,7 +27,7 @@ <parent> <groupId>org.onap.policy.clamp</groupId> <artifactId>policy-clamp</artifactId> - <version>6.2.0-SNAPSHOT</version> + <version>6.2.1-SNAPSHOT</version> </parent> <artifactId>policy-clamp-common</artifactId> diff --git a/models/pom.xml b/models/pom.xml index 4adf64d2a..c38e80302 100644 --- a/models/pom.xml +++ b/models/pom.xml @@ -27,7 +27,7 @@ <parent> <groupId>org.onap.policy.clamp</groupId> <artifactId>policy-clamp</artifactId> - <version>6.2.0-SNAPSHOT</version> + <version>6.2.1-SNAPSHOT</version> </parent> <artifactId>policy-clamp-models</artifactId> diff --git a/packages/policy-clamp-docker/pom.xml b/packages/policy-clamp-docker/pom.xml index 62181b9a2..08511e03f 100644 --- a/packages/policy-clamp-docker/pom.xml +++ b/packages/policy-clamp-docker/pom.xml @@ -26,7 +26,7 @@ <parent> <groupId>org.onap.policy.clamp</groupId> <artifactId>clamp-packages</artifactId> - <version>6.2.0-SNAPSHOT</version> + <version>6.2.1-SNAPSHOT</version> </parent> <packaging>pom</packaging> diff --git a/packages/policy-clamp-docker/src/main/docker/ClRuntimeDockerfile b/packages/policy-clamp-docker/src/main/docker/ClRuntimeDockerfile index 01b150bd2..b66fddcc4 100644 --- a/packages/policy-clamp-docker/src/main/docker/ClRuntimeDockerfile +++ b/packages/policy-clamp-docker/src/main/docker/ClRuntimeDockerfile @@ -21,7 +21,7 @@ # # Docker file to build an image that runs CLAMP on Java 11 or better in alpine # -FROM onap/policy-jre-alpine:2.3.1 +FROM onap/policy-jre-alpine:2.4.0 LABEL maintainer="Policy Team" diff --git a/packages/policy-clamp-docker/src/main/docker/HttpParticipantDockerfile b/packages/policy-clamp-docker/src/main/docker/HttpParticipantDockerfile index 294a59754..2497f5d3b 100644 --- a/packages/policy-clamp-docker/src/main/docker/HttpParticipantDockerfile +++ b/packages/policy-clamp-docker/src/main/docker/HttpParticipantDockerfile @@ -22,7 +22,7 @@ # Docker file to build an image that runs CLAMP on Java 11 or better in alpine # -FROM onap/policy-jre-alpine:2.3.1 +FROM onap/policy-jre-alpine:2.4.0 LABEL maintainer="Policy Team" diff --git a/packages/policy-clamp-docker/src/main/docker/KubernetesParticipantDockerfile b/packages/policy-clamp-docker/src/main/docker/KubernetesParticipantDockerfile index e107b45af..e7fc89021 100644 --- a/packages/policy-clamp-docker/src/main/docker/KubernetesParticipantDockerfile +++ b/packages/policy-clamp-docker/src/main/docker/KubernetesParticipantDockerfile @@ -21,7 +21,7 @@ # # Docker file to build an image that runs CLAMP on Java 11 or better in alpine # -FROM onap/policy-jre-alpine:2.3.1 +FROM onap/policy-jre-alpine:2.4.0 LABEL maintainer="Policy Team" diff --git a/packages/policy-clamp-docker/src/main/docker/PolicyParticipantDockerfile b/packages/policy-clamp-docker/src/main/docker/PolicyParticipantDockerfile index 14f10dd6f..a0d003292 100644 --- a/packages/policy-clamp-docker/src/main/docker/PolicyParticipantDockerfile +++ b/packages/policy-clamp-docker/src/main/docker/PolicyParticipantDockerfile @@ -21,7 +21,7 @@ # # Docker file to build an image that runs CLAMP on Java 11 or better in alpine # -FROM onap/policy-jre-alpine:2.3.1 +FROM onap/policy-jre-alpine:2.4.0 LABEL maintainer="Policy Team" diff --git a/packages/policy-clamp-tarball/pom.xml b/packages/policy-clamp-tarball/pom.xml index 8db94f87c..6b4a370fc 100644 --- a/packages/policy-clamp-tarball/pom.xml +++ b/packages/policy-clamp-tarball/pom.xml @@ -24,7 +24,7 @@ <parent> <groupId>org.onap.policy.clamp</groupId> <artifactId>clamp-packages</artifactId> - <version>6.2.0-SNAPSHOT</version> + <version>6.2.1-SNAPSHOT</version> </parent> <artifactId>policy-clamp-tarball</artifactId> diff --git a/packages/pom.xml b/packages/pom.xml index 0a913dc52..9f6df5fa1 100644 --- a/packages/pom.xml +++ b/packages/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.onap.policy.clamp</groupId> <artifactId>policy-clamp</artifactId> - <version>6.2.0-SNAPSHOT</version> + <version>6.2.1-SNAPSHOT</version> </parent> <artifactId>clamp-packages</artifactId> diff --git a/participant/participant-impl/participant-impl-cds/pom.xml b/participant/participant-impl/participant-impl-cds/pom.xml index c52c8f5cb..0f806a602 100644 --- a/participant/participant-impl/participant-impl-cds/pom.xml +++ b/participant/participant-impl/participant-impl-cds/pom.xml @@ -25,7 +25,7 @@ <parent> <groupId>org.onap.policy.clamp.participant</groupId> <artifactId>policy-clamp-participant-impl</artifactId> - <version>6.2.0-SNAPSHOT</version> + <version>6.2.1-SNAPSHOT</version> </parent> <artifactId>policy-clamp-participant-impl-cds</artifactId> diff --git a/participant/participant-impl/participant-impl-http/pom.xml b/participant/participant-impl/participant-impl-http/pom.xml index 668588f63..0d1032bd3 100644 --- a/participant/participant-impl/participant-impl-http/pom.xml +++ b/participant/participant-impl/participant-impl-http/pom.xml @@ -25,7 +25,7 @@ <parent> <groupId>org.onap.policy.clamp.participant</groupId> <artifactId>policy-clamp-participant-impl</artifactId> - <version>6.2.0-SNAPSHOT</version> + <version>6.2.1-SNAPSHOT</version> </parent> <artifactId>policy-clamp-participant-impl-http</artifactId> diff --git a/participant/participant-impl/participant-impl-kubernetes/pom.xml b/participant/participant-impl/participant-impl-kubernetes/pom.xml index fb4620621..6bbf01757 100644 --- a/participant/participant-impl/participant-impl-kubernetes/pom.xml +++ b/participant/participant-impl/participant-impl-kubernetes/pom.xml @@ -25,7 +25,7 @@ <parent> <groupId>org.onap.policy.clamp.participant</groupId> <artifactId>policy-clamp-participant-impl</artifactId> - <version>6.2.0-SNAPSHOT</version> + <version>6.2.1-SNAPSHOT</version> </parent> <artifactId>policy-clamp-participant-impl-kubernetes</artifactId> diff --git a/participant/participant-impl/participant-impl-policy/pom.xml b/participant/participant-impl/participant-impl-policy/pom.xml index ed0667ffd..fce29acae 100644 --- a/participant/participant-impl/participant-impl-policy/pom.xml +++ b/participant/participant-impl/participant-impl-policy/pom.xml @@ -25,7 +25,7 @@ <parent> <groupId>org.onap.policy.clamp.participant</groupId> <artifactId>policy-clamp-participant-impl</artifactId> - <version>6.2.0-SNAPSHOT</version> + <version>6.2.1-SNAPSHOT</version> </parent> <artifactId>policy-clamp-participant-impl-policy</artifactId> diff --git a/participant/participant-impl/participant-impl-simulator/pom.xml b/participant/participant-impl/participant-impl-simulator/pom.xml index 324abea0e..c19e45ee0 100644 --- a/participant/participant-impl/participant-impl-simulator/pom.xml +++ b/participant/participant-impl/participant-impl-simulator/pom.xml @@ -26,7 +26,7 @@ <parent> <groupId>org.onap.policy.clamp.participant</groupId> <artifactId>policy-clamp-participant-impl</artifactId> - <version>6.2.0-SNAPSHOT</version> + <version>6.2.1-SNAPSHOT</version> </parent> <artifactId>policy-clamp-participant-impl-simulator</artifactId> diff --git a/participant/participant-impl/pom.xml b/participant/participant-impl/pom.xml index 646692b43..bd083d19c 100644 --- a/participant/participant-impl/pom.xml +++ b/participant/participant-impl/pom.xml @@ -27,7 +27,7 @@ <parent> <groupId>org.onap.policy.clamp.participant</groupId> <artifactId>policy-clamp-participant</artifactId> - <version>6.2.0-SNAPSHOT</version> + <version>6.2.1-SNAPSHOT</version> </parent> <artifactId>policy-clamp-participant-impl</artifactId> diff --git a/participant/participant-intermediary/pom.xml b/participant/participant-intermediary/pom.xml index a22826d28..c6078360e 100644 --- a/participant/participant-intermediary/pom.xml +++ b/participant/participant-intermediary/pom.xml @@ -25,7 +25,7 @@ <parent> <groupId>org.onap.policy.clamp.participant</groupId> <artifactId>policy-clamp-participant</artifactId> - <version>6.2.0-SNAPSHOT</version> + <version>6.2.1-SNAPSHOT</version> </parent> <artifactId>policy-clamp-participant-intermediary</artifactId> diff --git a/participant/pom.xml b/participant/pom.xml index e679bb227..8f80c207b 100644 --- a/participant/pom.xml +++ b/participant/pom.xml @@ -26,7 +26,7 @@ <parent> <groupId>org.onap.policy.clamp</groupId> <artifactId>policy-clamp</artifactId> - <version>6.2.0-SNAPSHOT</version> + <version>6.2.1-SNAPSHOT</version> </parent> <groupId>org.onap.policy.clamp.participant</groupId> @@ -23,12 +23,13 @@ <parent> <groupId>org.onap.policy.parent</groupId> <artifactId>integration</artifactId> - <version>3.5.0-SNAPSHOT</version> + <version>3.5.0</version> + <relativePath /> </parent> <groupId>org.onap.policy.clamp</groupId> <artifactId>policy-clamp</artifactId> - <version>6.2.0-SNAPSHOT</version> + <version>6.2.1-SNAPSHOT</version> <name>${project.artifactId}</name> <packaging>pom</packaging> @@ -50,8 +51,8 @@ </description> <properties> - <policy.common.version>1.10.0-SNAPSHOT</policy.common.version> - <policy.models.version>2.6.0-SNAPSHOT</policy.models.version> + <policy.common.version>1.10.0</policy.common.version> + <policy.models.version>2.6.0</policy.models.version> </properties> <modules> diff --git a/releases/6.2.0-container.yaml b/releases/6.2.0-container.yaml new file mode 100644 index 000000000..58cedf459 --- /dev/null +++ b/releases/6.2.0-container.yaml @@ -0,0 +1,18 @@ +distribution_type: 'container' +container_release_tag: '6.2.0' +project: 'policy-clamp' +log_dir: 'policy-clamp-maven-docker-stage-master/356' +ref: d03e0497ba2a2ff76148d6c2c7e7e95d9a012cff +containers: + - name: 'policy-clamp-backend' + version: '6.2-STAGING-20211126T101113Z' + - name: 'policy-clamp-frontend' + version: '6.2-STAGING-20211126T101113Z' + - name: 'policy-clamp-cl-pf-ppnt' + version: '6.2.0-20211126T1011' + - name: 'policy-clamp-cl-k8s-ppnt' + version: '6.2.0-20211126T1011' + - name: 'policy-clamp-cl-http-ppnt' + version: '6.2.0-20211126T1011' + - name: 'policy-clamp-cl-runtime' + version: '6.2.0-20211126T1011' diff --git a/releases/6.2.0.yaml b/releases/6.2.0.yaml new file mode 100644 index 000000000..4ee1ebb45 --- /dev/null +++ b/releases/6.2.0.yaml @@ -0,0 +1,5 @@ +distribution_type: 'maven' +version: '6.2.0' +project: 'policy-clamp' +tag_release: false +log_dir: 'policy-clamp-maven-stage-master/359/' diff --git a/runtime-controlloop/pom.xml b/runtime-controlloop/pom.xml index 8ab9cc349..be5597fa1 100644 --- a/runtime-controlloop/pom.xml +++ b/runtime-controlloop/pom.xml @@ -27,7 +27,7 @@ <parent> <groupId>org.onap.policy.clamp</groupId> <artifactId>policy-clamp</artifactId> - <version>6.2.0-SNAPSHOT</version> + <version>6.2.1-SNAPSHOT</version> </parent> <artifactId>policy-clamp-runtime-controlloop</artifactId> diff --git a/runtime/pom.xml b/runtime/pom.xml index 30e0f19bf..b7ca884d4 100644 --- a/runtime/pom.xml +++ b/runtime/pom.xml @@ -27,7 +27,7 @@ <parent> <groupId>org.onap.policy.clamp</groupId> <artifactId>policy-clamp</artifactId> - <version>6.2.0-SNAPSHOT</version> + <version>6.2.1-SNAPSHOT</version> </parent> <artifactId>policy-clamp-runtime</artifactId> diff --git a/runtime/src/test/java/org/onap/policy/clamp/authorization/AuthorizationTest.java b/runtime/src/test/java/org/onap/policy/clamp/authorization/AuthorizationTest.java new file mode 100644 index 000000000..e14295de7 --- /dev/null +++ b/runtime/src/test/java/org/onap/policy/clamp/authorization/AuthorizationTest.java @@ -0,0 +1,64 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2021 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. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.clamp.authorization; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import org.junit.jupiter.api.Test; + +class AuthorizationTest { + + private static String USERNAME = "username"; + private static String PASSWORD = "p4ssw0rd"; + + @Test + void cldsUserTest() { + var cldsUser = new CldsUser(); + cldsUser.setUser(USERNAME); + cldsUser.setPassword(PASSWORD); + var permissions = new SecureServicePermission("type", "instance", "action"); + SecureServicePermission[] p = {permissions}; + cldsUser.setPermissions(p); + + assertEquals(USERNAME, cldsUser.getUser()); + assertEquals(PASSWORD, cldsUser.getPassword()); + assertEquals("type|instance|action", cldsUser.getPermissionsString()[0]); + } + + @Test + void secureServicePermission() { + var permission = new SecureServicePermission("*", "*", "*"); + permission.setType("type"); + permission.setInstance("instance"); + permission.setAction("action"); + assertEquals("type", permission.getType()); + assertEquals("instance", permission.getInstance()); + assertEquals("action", permission.getAction()); + } + + @Test + void authorizationControllertest() { + var auth = new AuthorizationController(); + assertThat(auth.getClampInformation().getAllPermissions()).isEmpty(); + } + +} diff --git a/runtime/src/test/java/org/onap/policy/clamp/configuration/ClampGsonDataFormatTest.java b/runtime/src/test/java/org/onap/policy/clamp/configuration/ClampGsonDataFormatTest.java new file mode 100644 index 000000000..38ff8f271 --- /dev/null +++ b/runtime/src/test/java/org/onap/policy/clamp/configuration/ClampGsonDataFormatTest.java @@ -0,0 +1,95 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2021 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. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.clamp.configuration; + +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import com.google.gson.Gson; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.OutputStream; +import org.apache.camel.Exchange; +import org.apache.camel.Message; +import org.junit.jupiter.api.Test; +import org.onap.policy.clamp.policy.operational.OperationalPolicy; + +class ClampGsonDataFormatTest { + + private static String FORMAT = "clamp-gson"; + private static String PATH_JSON = "src/test/resources/tosca/service-details.json"; + + + @Test + void testFormat() throws IOException { + var clampGsonDataFormat = new ClampGsonDataFormat(); + + assertEquals(FORMAT, clampGsonDataFormat.getDataFormatName()); + assertTrue(clampGsonDataFormat.isContentTypeHeader()); + assertNull(clampGsonDataFormat.getGson()); + + clampGsonDataFormat.close(); + } + + @Test + void testMarshal() throws IOException { + var clampGsonDataFormatFull = new ClampGsonDataFormat(new Gson(), OperationalPolicy.class); + + var exchange = mock(Exchange.class); + when(exchange.hasOut()).thenReturn(true); + when(exchange.getOut()).thenReturn(mock(Message.class)); + assertDoesNotThrow(() -> clampGsonDataFormatFull + .marshal(exchange, new OperationalPolicy(), mock(OutputStream.class))); + + when(exchange.hasOut()).thenReturn(false); + when(exchange.getIn()).thenReturn(mock(Message.class)); + assertDoesNotThrow(() -> clampGsonDataFormatFull + .marshal(exchange, new OperationalPolicy(), mock(OutputStream.class))); + + clampGsonDataFormatFull.setContentTypeHeader(false); + assertDoesNotThrow(() -> clampGsonDataFormatFull + .marshal(exchange, new OperationalPolicy(), mock(OutputStream.class))); + + clampGsonDataFormatFull.close(); + } + + @Test + void testUnmarshal() throws IOException { + var clampGsonDataFormatFull = new ClampGsonDataFormat(new Gson(), OperationalPolicy.class); + + var exchange = mock(Exchange.class); + var jsonExample = new File(PATH_JSON); + var stubInputStream = new FileInputStream(jsonExample); + assertDoesNotThrow(() -> clampGsonDataFormatFull.unmarshal(exchange, stubInputStream)); + + clampGsonDataFormatFull.setUnmarshalType(String.class); + var stubInputStream2 = new FileInputStream(jsonExample); + assertDoesNotThrow(() -> clampGsonDataFormatFull.unmarshal(exchange, stubInputStream2)); + + clampGsonDataFormatFull.close(); + } + +} diff --git a/version.properties b/version.properties index cc93736c2..e36bf6bc1 100644 --- a/version.properties +++ b/version.properties @@ -27,7 +27,7 @@ major=6 minor=2 -patch=0 +patch=1 base_version=${major}.${minor}.${patch} |