diff options
author | adheli.tavares <adheli.tavares@est.tech> | 2024-01-26 15:28:56 +0000 |
---|---|---|
committer | Adheli Tavares <adheli.tavares@est.tech> | 2024-02-09 10:31:15 +0000 |
commit | cc1d3d352771d1fa35d297e90663539e34b022f6 (patch) | |
tree | b1b00d678b0157742b91be1262fbf614a62063b1 /policy-domains/src/test/java | |
parent | cce79248655f484e007769ba81b092148f940d27 (diff) |
Removing deprecated DMAAP library
Issue-ID: POLICY-4402
Change-Id: I4ce5b303cb3a775010683d3c7102b0bd065280ea
Signed-off-by: adheli.tavares <adheli.tavares@est.tech>
Diffstat (limited to 'policy-domains/src/test/java')
5 files changed, 45 insertions, 42 deletions
diff --git a/policy-domains/src/test/java/org/onap/policy/drools/domain/models/DomainPolicyTypesTest.java b/policy-domains/src/test/java/org/onap/policy/drools/domain/models/DomainPolicyTypesTest.java index d7692fc0..3d1e8490 100644 --- a/policy-domains/src/test/java/org/onap/policy/drools/domain/models/DomainPolicyTypesTest.java +++ b/policy-domains/src/test/java/org/onap/policy/drools/domain/models/DomainPolicyTypesTest.java @@ -22,16 +22,16 @@ package org.onap.policy.drools.domain.models; import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import com.worldturner.medeia.api.ValidationFailedException; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.onap.policy.common.utils.coder.CoderException; import org.onap.policy.common.utils.coder.StandardCoder; import org.onap.policy.common.utils.resources.ResourceUtils; @@ -45,7 +45,7 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy; import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate; -public class DomainPolicyTypesTest { +class DomainPolicyTypesTest { // Policy Types private static final String NATIVE_DROOLS_POLICY_TYPE = "onap.policies.native.drools.Artifact"; @@ -63,14 +63,14 @@ public class DomainPolicyTypesTest { private DomainMaker domainMaker; private StandardCoder nonValCoder; - @Before + @BeforeEach public void setUp() { domainMaker = new DomainMaker(); nonValCoder = new StandardCoder(); } @Test - public void testToscaNativeDroolsPolicy() throws CoderException, IOException { + void testToscaNativeDroolsPolicy() throws CoderException, IOException { String rawNativeDroolsPolicy = getPolicyFromFileString(); ToscaPolicy toscaPolicy = @@ -122,7 +122,7 @@ public class DomainPolicyTypesTest { } @Test - public void testToscaControllerPolicy() throws CoderException { + void testToscaControllerPolicy() throws CoderException { ToscaPolicy toscaPolicy = getExamplesPolicy(EXAMPLE_CONTROLLER_DROOLS_POLICY_JSON, EXAMPLE_CONTROLLER_DROOLS_POLICY_NAME); diff --git a/policy-domains/src/test/java/org/onap/policy/drools/domain/models/DroolsPolicyTest.java b/policy-domains/src/test/java/org/onap/policy/drools/domain/models/DroolsPolicyTest.java index 98ddd4c8..99494d71 100644 --- a/policy-domains/src/test/java/org/onap/policy/drools/domain/models/DroolsPolicyTest.java +++ b/policy-domains/src/test/java/org/onap/policy/drools/domain/models/DroolsPolicyTest.java @@ -1,6 +1,7 @@ /* * ============LICENSE_START======================================================= - * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 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. @@ -29,26 +30,28 @@ import com.openpojo.validation.Validator; import com.openpojo.validation.ValidatorBuilder; import com.openpojo.validation.test.impl.GetterTester; import com.openpojo.validation.test.impl.SetterTester; +import java.io.Serial; import java.io.Serializable; import java.util.List; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; import lombok.experimental.SuperBuilder; -import org.junit.Test; +import org.junit.jupiter.api.Test; -public class DroolsPolicyTest { +class DroolsPolicyTest { @Data @SuperBuilder @NoArgsConstructor @EqualsAndHashCode(callSuper = true) public static class DerivedDomainPolicy extends DroolsPolicy implements Serializable { + @Serial private static final long serialVersionUID = -1027974819756498893L; } @Test - public void testDerivedClass() { + void testDerivedClass() { /* validate model pojos */ Validator validator = ValidatorBuilder.create() .with(new SetterTester(), new GetterTester()).build(); @@ -57,7 +60,7 @@ public class DroolsPolicyTest { } @Test - public void testPackage() { + void testPackage() { /* validate model pojos */ List<PojoClass> pojoClasses = PojoClassFactory diff --git a/policy-domains/src/test/java/org/onap/policy/drools/domain/models/artifact/ArtifactPolicyTest.java b/policy-domains/src/test/java/org/onap/policy/drools/domain/models/artifact/ArtifactPolicyTest.java index b4c71f0d..16a91b67 100644 --- a/policy-domains/src/test/java/org/onap/policy/drools/domain/models/artifact/ArtifactPolicyTest.java +++ b/policy-domains/src/test/java/org/onap/policy/drools/domain/models/artifact/ArtifactPolicyTest.java @@ -1,6 +1,7 @@ /* * ============LICENSE_START======================================================= * Copyright (C) 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. @@ -20,15 +21,15 @@ package org.onap.policy.drools.domain.models.artifact; -import static org.junit.Assert.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNotNull; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.onap.policy.drools.domain.models.Metadata; -public class ArtifactPolicyTest { +class ArtifactPolicyTest { @Test - public void testBuildDomainPolicyNativeArtifact() { + void testBuildDomainPolicyNativeArtifact() { /* manually create a native drools policy */ // @formatter:off diff --git a/policy-domains/src/test/java/org/onap/policy/drools/domain/models/controller/ControllerPolicyTest.java b/policy-domains/src/test/java/org/onap/policy/drools/domain/models/controller/ControllerPolicyTest.java index d24a8f70..05e85b84 100644 --- a/policy-domains/src/test/java/org/onap/policy/drools/domain/models/controller/ControllerPolicyTest.java +++ b/policy-domains/src/test/java/org/onap/policy/drools/domain/models/controller/ControllerPolicyTest.java @@ -1,6 +1,7 @@ /* * ============LICENSE_START======================================================= - * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 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. @@ -20,16 +21,16 @@ package org.onap.policy.drools.domain.models.controller; -import static org.junit.Assert.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNotNull; import java.util.ArrayList; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.onap.policy.drools.domain.models.Metadata; -public class ControllerPolicyTest { +class ControllerPolicyTest { @Test - public void testBuildDomainPolicyController() { + void testBuildDomainPolicyController() { /* manually create a controller policy */ // @formatter:off diff --git a/policy-domains/src/test/java/org/onap/policy/drools/domain/models/operational/OperationalPolicyTest.java b/policy-domains/src/test/java/org/onap/policy/drools/domain/models/operational/OperationalPolicyTest.java index 91e8acc1..8168e75a 100644 --- a/policy-domains/src/test/java/org/onap/policy/drools/domain/models/operational/OperationalPolicyTest.java +++ b/policy-domains/src/test/java/org/onap/policy/drools/domain/models/operational/OperationalPolicyTest.java @@ -3,7 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2021 Nordix Foundation. + * Modifications Copyright (C) 2021, 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. @@ -21,12 +21,12 @@ package org.onap.policy.drools.domain.models.operational; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.List; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.onap.policy.common.utils.coder.CoderException; import org.onap.policy.common.utils.coder.StandardCoder; import org.onap.policy.common.utils.resources.ResourceUtils; @@ -36,7 +36,7 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy; import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate; -public class OperationalPolicyTest { +class OperationalPolicyTest { // Policy Types private static final String OPERATIONAL_DROOLS_POLICY_TYPE = "onap.policies.controlloop.operational.common.Drools"; @@ -48,15 +48,15 @@ public class OperationalPolicyTest { private DomainMaker domainMaker; private StandardCoder nonValCoder; - @Before + @BeforeEach public void setUp() { domainMaker = new DomainMaker(); nonValCoder = new StandardCoder(); } @Test - public void testToscaCompliantOperationalPolicyType() throws CoderException { - String rawVcpeToscaPolicy = getExamplesPolicyString(VCPE_OPERATIONAL_DROOLS_POLICY_JSON, OP_POLICY_NAME_VCPE); + void testToscaCompliantOperationalPolicyType() throws CoderException { + String rawVcpeToscaPolicy = getExamplesPolicyString(); // valid "known" policy type with implicit schema ToscaConceptIdentifier operationalCompliantType = @@ -66,7 +66,7 @@ public class OperationalPolicyTest { } @Test - public void testOperationalCompliantModel() { + void testOperationalCompliantModel() { // @formatter:off OperationalPolicy policy = OperationalPolicy.builder() @@ -100,17 +100,15 @@ public class OperationalPolicyTest { assertNotNull(policy); } - private String getJsonFromResource(String resourcePath) { - return ResourceUtils.getResourceAsString(resourcePath); - } - - private ToscaPolicy getExamplesPolicy(String resourcePath, String policyName) throws CoderException { - String policyJson = getJsonFromResource(resourcePath); + private ToscaPolicy getExamplesPolicy() throws CoderException { + String policyJson = ResourceUtils + .getResourceAsString(OperationalPolicyTest.VCPE_OPERATIONAL_DROOLS_POLICY_JSON); ToscaServiceTemplate serviceTemplate = new StandardCoder().decode(policyJson, ToscaServiceTemplate.class); - return serviceTemplate.getToscaTopologyTemplate().getPolicies().get(0).get(policyName); + return serviceTemplate.getToscaTopologyTemplate().getPolicies().get(0).get( + OperationalPolicyTest.OP_POLICY_NAME_VCPE); } - private String getExamplesPolicyString(String resourcePath, String policyName) throws CoderException { - return nonValCoder.encode(getExamplesPolicy(resourcePath, policyName)); + private String getExamplesPolicyString() throws CoderException { + return nonValCoder.encode(getExamplesPolicy()); } } |