diff options
author | liamfallon <liam.fallon@est.tech> | 2021-01-06 15:34:58 +0000 |
---|---|---|
committer | S�bastien Determe <sebastien.determe@intl.att.com> | 2021-01-06 18:36:04 +0000 |
commit | 79b5636be43054a0c2ec7ab2450edc347e1d5043 (patch) | |
tree | 5c1947c4f0639e0d1c4816fe841d286677a31637 /src/test/java/org/onap | |
parent | b6d7a6d192eddc0c52497603023e47f10599c2ae (diff) |
Merge clamp master into tosca-poc branch
This change mreges changes in clamp master into the tosca-poc branch
because the two banches have diverged.
Issue-ID: POLICY-2971
Change-Id: Iea4efe90204c98eeaae0b112ad5c964f722afdb0
Signed-off-by: liamfallon <liam.fallon@est.tech>
Diffstat (limited to 'src/test/java/org/onap')
-rw-r--r-- | src/test/java/org/onap/clamp/controlloop/models/tosca/authorative/concepts/ControlLoopToscaServiceTemplateTest.java | 34 | ||||
-rw-r--r-- | src/test/java/org/onap/policy/clamp/clds/client/CdsServicesTest.java (renamed from src/test/java/org/onap/clamp/clds/client/CdsServicesTest.java) | 6 | ||||
-rw-r--r-- | src/test/java/org/onap/policy/clamp/clds/config/CldsUserJsonDecoderTest.java (renamed from src/test/java/org/onap/clamp/clds/config/CldsUserJsonDecoderTest.java) | 6 | ||||
-rw-r--r-- | src/test/java/org/onap/policy/clamp/clds/config/sdc/SdcSingleControllerConfigurationTest.java (renamed from src/test/java/org/onap/clamp/clds/config/sdc/SdcSingleControllerConfigurationTest.java) | 26 | ||||
-rw-r--r-- | src/test/java/org/onap/policy/clamp/clds/it/AuthorizationControllerItCase.java (renamed from src/test/java/org/onap/clamp/clds/it/AuthorizationControllerItCase.java) | 10 | ||||
-rw-r--r-- | src/test/java/org/onap/policy/clamp/clds/it/CldsHealthcheckServiceItCase.java (renamed from src/test/java/org/onap/clamp/clds/it/CldsHealthcheckServiceItCase.java) | 6 | ||||
-rw-r--r-- | src/test/java/org/onap/policy/clamp/clds/it/HttpsItCase.java (renamed from src/test/java/org/onap/clamp/clds/it/HttpsItCase.java) | 2 | ||||
-rw-r--r-- | src/test/java/org/onap/policy/clamp/clds/it/RobotItCase.java (renamed from src/test/java/org/onap/clamp/clds/it/RobotItCase.java) | 2 | ||||
-rw-r--r-- | src/test/java/org/onap/policy/clamp/clds/it/config/CldsReferencePropertiesItCase.java (renamed from src/test/java/org/onap/clamp/clds/it/config/CldsReferencePropertiesItCase.java) | 9 | ||||
-rw-r--r-- | src/test/java/org/onap/policy/clamp/clds/it/config/SdcControllersConfigurationItCase.java (renamed from src/test/java/org/onap/clamp/clds/it/config/SdcControllersConfigurationItCase.java) | 12 | ||||
-rw-r--r-- | src/test/java/org/onap/policy/clamp/clds/it/sdc/controller/SdcSingleControllerItCase.java (renamed from src/test/java/org/onap/clamp/clds/it/sdc/controller/SdcSingleControllerItCase.java) | 21 | ||||
-rw-r--r-- | src/test/java/org/onap/policy/clamp/clds/model/dcae/DcaeInventoryResponseCacheTestItCase.java (renamed from src/test/java/org/onap/clamp/clds/model/dcae/DcaeInventoryResponseCacheTestItCase.java) | 5 | ||||
-rw-r--r-- | src/test/java/org/onap/policy/clamp/clds/model/dcae/DcaeInventoryResponseTest.java (renamed from src/test/java/org/onap/clamp/clds/model/dcae/DcaeInventoryResponseTest.java) | 3 | ||||
-rw-r--r-- | src/test/java/org/onap/policy/clamp/clds/model/jsontype/JsonTypeDescriptorTest.java (renamed from src/test/java/org/onap/clamp/clds/model/jsontype/JsonTypeDescriptorTest.java) | 25 | ||||
-rw-r--r-- | src/test/java/org/onap/policy/clamp/clds/sdc/controller/installer/BlueprintParserTest.java (renamed from src/test/java/org/onap/clamp/clds/sdc/controller/installer/BlueprintParserTest.java) | 6 | ||||
-rw-r--r-- | src/test/java/org/onap/policy/clamp/clds/sdc/controller/installer/ChainGeneratorTest.java (renamed from src/test/java/org/onap/clamp/clds/sdc/controller/installer/ChainGeneratorTest.java) | 3 | ||||
-rw-r--r-- | src/test/java/org/onap/policy/clamp/clds/sdc/controller/installer/CsarHandlerTest.java (renamed from src/test/java/org/onap/clamp/clds/sdc/controller/installer/CsarHandlerTest.java) | 9 | ||||
-rw-r--r-- | src/test/java/org/onap/policy/clamp/clds/tosca/DictionaryRepositoriesTestItCase.java (renamed from src/test/java/org/onap/clamp/clds/tosca/DictionaryRepositoriesTestItCase.java) | 10 | ||||
-rw-r--r-- | src/test/java/org/onap/policy/clamp/clds/tosca/ToscaYamlToJsonConvertorTestItCase.java (renamed from src/test/java/org/onap/clamp/clds/tosca/ToscaYamlToJsonConvertorTestItCase.java) | 12 | ||||
-rw-r--r-- | src/test/java/org/onap/policy/clamp/clds/tosca/update/ArrayFieldTest.java (renamed from src/test/java/org/onap/clamp/clds/tosca/update/ArrayFieldTest.java) | 12 | ||||
-rw-r--r-- | src/test/java/org/onap/policy/clamp/clds/tosca/update/ConstraintTest.java (renamed from src/test/java/org/onap/clamp/clds/tosca/update/ConstraintTest.java) | 12 | ||||
-rw-r--r-- | src/test/java/org/onap/policy/clamp/clds/tosca/update/JsonTemplateFieldTest.java (renamed from src/test/java/org/onap/clamp/clds/tosca/update/JsonTemplateFieldTest.java) | 12 | ||||
-rw-r--r-- | src/test/java/org/onap/policy/clamp/clds/tosca/update/JsonTemplateManagerTest.java (renamed from src/test/java/org/onap/clamp/clds/tosca/update/JsonTemplateManagerTest.java) | 34 | ||||
-rw-r--r-- | src/test/java/org/onap/policy/clamp/clds/tosca/update/JsonTemplateTest.java (renamed from src/test/java/org/onap/clamp/clds/tosca/update/JsonTemplateTest.java) | 6 | ||||
-rw-r--r-- | src/test/java/org/onap/policy/clamp/clds/tosca/update/ToscaConverterWithDictionarySupportItCase.java (renamed from src/test/java/org/onap/clamp/clds/tosca/update/ToscaConverterWithDictionarySupportItCase.java) | 27 | ||||
-rw-r--r-- | src/test/java/org/onap/policy/clamp/clds/tosca/update/ToscaElementPropertyTest.java (renamed from src/test/java/org/onap/clamp/clds/tosca/update/ToscaElementPropertyTest.java) | 12 | ||||
-rw-r--r-- | src/test/java/org/onap/policy/clamp/clds/tosca/update/ToscaElementTest.java (renamed from src/test/java/org/onap/clamp/clds/tosca/update/ToscaElementTest.java) | 8 | ||||
-rw-r--r-- | src/test/java/org/onap/policy/clamp/clds/util/CryptoUtilsTest.java (renamed from src/test/java/org/onap/clamp/clds/util/CryptoUtilsTest.java) | 4 | ||||
-rw-r--r-- | src/test/java/org/onap/policy/clamp/clds/util/JsonUtilsTest.java (renamed from src/test/java/org/onap/clamp/clds/util/JsonUtilsTest.java) | 8 | ||||
-rw-r--r-- | src/test/java/org/onap/policy/clamp/clds/util/LoggingUtilsTest.java (renamed from src/test/java/org/onap/clamp/clds/util/LoggingUtilsTest.java) | 2 | ||||
-rw-r--r-- | src/test/java/org/onap/policy/clamp/clds/util/TestObject.java (renamed from src/test/java/org/onap/clamp/clds/util/TestObject.java) | 2 | ||||
-rw-r--r-- | src/test/java/org/onap/policy/clamp/clds/util/TestObject2.java (renamed from src/test/java/org/onap/clamp/clds/util/TestObject2.java) | 2 | ||||
-rw-r--r-- | src/test/java/org/onap/policy/clamp/flow/FlowLogOperationTest.java (renamed from src/test/java/org/onap/clamp/flow/FlowLogOperationTest.java) | 8 | ||||
-rw-r--r-- | src/test/java/org/onap/policy/clamp/loop/CsarInstallerItCase.java (renamed from src/test/java/org/onap/clamp/loop/CsarInstallerItCase.java) | 100 | ||||
-rw-r--r-- | src/test/java/org/onap/policy/clamp/loop/DcaeComponentTest.java (renamed from src/test/java/org/onap/clamp/loop/DcaeComponentTest.java) | 16 | ||||
-rw-r--r-- | src/test/java/org/onap/policy/clamp/loop/DeployFlowTestItCase.java (renamed from src/test/java/org/onap/clamp/loop/DeployFlowTestItCase.java) | 12 | ||||
-rw-r--r-- | src/test/java/org/onap/policy/clamp/loop/ExternalComponentStateTest.java (renamed from src/test/java/org/onap/clamp/loop/ExternalComponentStateTest.java) | 4 | ||||
-rw-r--r-- | src/test/java/org/onap/policy/clamp/loop/LoopControllerTestItCase.java (renamed from src/test/java/org/onap/clamp/loop/LoopControllerTestItCase.java) | 27 | ||||
-rw-r--r-- | src/test/java/org/onap/policy/clamp/loop/LoopLogServiceTestItCase.java (renamed from src/test/java/org/onap/clamp/loop/LoopLogServiceTestItCase.java) | 15 | ||||
-rw-r--r-- | src/test/java/org/onap/policy/clamp/loop/LoopRepositoriesItCase.java (renamed from src/test/java/org/onap/clamp/loop/LoopRepositoriesItCase.java) | 49 | ||||
-rw-r--r-- | src/test/java/org/onap/policy/clamp/loop/LoopServiceTestItCase.java (renamed from src/test/java/org/onap/clamp/loop/LoopServiceTestItCase.java) | 31 | ||||
-rw-r--r-- | src/test/java/org/onap/policy/clamp/loop/LoopTemplateLoopElementModelTest.java (renamed from src/test/java/org/onap/clamp/loop/LoopTemplateLoopElementModelTest.java) | 10 | ||||
-rw-r--r-- | src/test/java/org/onap/policy/clamp/loop/LoopTemplatesServiceItCase.java (renamed from src/test/java/org/onap/clamp/loop/LoopTemplatesServiceItCase.java) | 16 | ||||
-rw-r--r-- | src/test/java/org/onap/policy/clamp/loop/LoopToJsonTest.java (renamed from src/test/java/org/onap/clamp/loop/LoopToJsonTest.java) | 23 | ||||
-rw-r--r-- | src/test/java/org/onap/policy/clamp/loop/PolicyComponentTest.java (renamed from src/test/java/org/onap/clamp/loop/PolicyComponentTest.java) | 20 | ||||
-rw-r--r-- | src/test/java/org/onap/policy/clamp/loop/PolicyModelServiceItCase.java (renamed from src/test/java/org/onap/clamp/loop/PolicyModelServiceItCase.java) | 33 | ||||
-rw-r--r-- | src/test/java/org/onap/policy/clamp/loop/ServiceTest.java (renamed from src/test/java/org/onap/clamp/loop/ServiceTest.java) | 9 | ||||
-rw-r--r-- | src/test/java/org/onap/policy/clamp/loop/deploy/BlueprintInputParametersTest.java (renamed from src/test/java/org/onap/clamp/loop/deploy/BlueprintInputParametersTest.java) | 14 | ||||
-rw-r--r-- | src/test/java/org/onap/policy/clamp/policy/downloader/PolicyEngineControllerTestItCase.java (renamed from src/test/java/org/onap/clamp/policy/downloader/PolicyEngineControllerTestItCase.java) | 14 | ||||
-rw-r--r-- | src/test/java/org/onap/policy/clamp/policy/microservice/MicroServicePayloadTest.java (renamed from src/test/java/org/onap/clamp/policy/microservice/MicroServicePayloadTest.java) | 15 | ||||
-rw-r--r-- | src/test/java/org/onap/policy/clamp/policy/operational/OperationalPolicyRepresentationBuilderTest.java (renamed from src/test/java/org/onap/clamp/policy/operational/OperationalPolicyRepresentationBuilderTest.java) | 6 | ||||
-rw-r--r-- | src/test/java/org/onap/policy/clamp/policy/pdpgroup/PdpGroupTest.java (renamed from src/test/java/org/onap/clamp/policy/pdpgroup/PdpGroupTest.java) | 4 | ||||
-rw-r--r-- | src/test/java/org/onap/policy/clamp/policy/pdpgroup/PolicyModelKeyTest.java (renamed from src/test/java/org/onap/clamp/policy/pdpgroup/PolicyModelKeyTest.java) | 16 | ||||
-rw-r--r-- | src/test/java/org/onap/policy/clamp/tosca/DictionaryServiceItCase.java (renamed from src/test/java/org/onap/clamp/tosca/DictionaryServiceItCase.java) | 4 | ||||
-rw-r--r-- | src/test/java/org/onap/policy/clamp/util/PassDecoderTest.java (renamed from src/test/java/org/onap/clamp/util/PassDecoderTest.java) | 2 | ||||
-rw-r--r-- | src/test/java/org/onap/policy/clamp/util/SemanticVersioningTest.java (renamed from src/test/java/org/onap/clamp/util/SemanticVersioningTest.java) | 2 |
56 files changed, 407 insertions, 391 deletions
diff --git a/src/test/java/org/onap/clamp/controlloop/models/tosca/authorative/concepts/ControlLoopToscaServiceTemplateTest.java b/src/test/java/org/onap/clamp/controlloop/models/tosca/authorative/concepts/ControlLoopToscaServiceTemplateTest.java deleted file mode 100644 index b1bbd512e..000000000 --- a/src/test/java/org/onap/clamp/controlloop/models/tosca/authorative/concepts/ControlLoopToscaServiceTemplateTest.java +++ /dev/null @@ -1,34 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2020 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.clamp.controlloop.models.tosca.authorative.concepts; - -import static org.junit.Assert.assertNotNull; - -import org.junit.Test; - -public class ControlLoopToscaServiceTemplateTest { - - @Test - public void testClassDef() { - ControlLoopToscaServiceTemplate serviceTemplate = new ControlLoopToscaServiceTemplate(); - assertNotNull("ControlLoopToscaServiceTemplate is Not null", serviceTemplate); - } -}
\ No newline at end of file diff --git a/src/test/java/org/onap/clamp/clds/client/CdsServicesTest.java b/src/test/java/org/onap/policy/clamp/clds/client/CdsServicesTest.java index 3d189cf71..6e5300e23 100644 --- a/src/test/java/org/onap/clamp/clds/client/CdsServicesTest.java +++ b/src/test/java/org/onap/policy/clamp/clds/client/CdsServicesTest.java @@ -20,13 +20,13 @@ * */ -package org.onap.clamp.clds.client; +package org.onap.policy.clamp.clds.client; import com.google.gson.JsonObject; import java.io.IOException; import org.junit.Test; -import org.onap.clamp.clds.util.JsonUtils; -import org.onap.clamp.clds.util.ResourceFileUtils; +import org.onap.policy.clamp.clds.util.JsonUtils; +import org.onap.policy.clamp.clds.util.ResourceFileUtils; import org.skyscreamer.jsonassert.JSONAssert; public class CdsServicesTest { diff --git a/src/test/java/org/onap/clamp/clds/config/CldsUserJsonDecoderTest.java b/src/test/java/org/onap/policy/clamp/clds/config/CldsUserJsonDecoderTest.java index 7152ee11d..605ab99ae 100644 --- a/src/test/java/org/onap/clamp/clds/config/CldsUserJsonDecoderTest.java +++ b/src/test/java/org/onap/policy/clamp/clds/config/CldsUserJsonDecoderTest.java @@ -24,13 +24,13 @@ * */ -package org.onap.clamp.clds.config; +package org.onap.policy.clamp.clds.config; import static org.assertj.core.api.Assertions.assertThat; import org.junit.Test; -import org.onap.clamp.authorization.CldsUser; -import org.onap.clamp.clds.exception.CldsUsersException; +import org.onap.policy.clamp.authorization.CldsUser; +import org.onap.policy.clamp.clds.exception.CldsUsersException; public class CldsUserJsonDecoderTest { diff --git a/src/test/java/org/onap/clamp/clds/config/sdc/SdcSingleControllerConfigurationTest.java b/src/test/java/org/onap/policy/clamp/clds/config/sdc/SdcSingleControllerConfigurationTest.java index 06df124ce..89178b778 100644 --- a/src/test/java/org/onap/clamp/clds/config/sdc/SdcSingleControllerConfigurationTest.java +++ b/src/test/java/org/onap/policy/clamp/clds/config/sdc/SdcSingleControllerConfigurationTest.java @@ -21,7 +21,7 @@ * */ -package org.onap.clamp.clds.config.sdc; +package org.onap.policy.clamp.clds.config.sdc; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.Assert.assertEquals; @@ -34,9 +34,9 @@ import java.io.IOException; import java.io.InputStreamReader; import java.nio.charset.StandardCharsets; import org.junit.Test; -import org.onap.clamp.clds.exception.sdc.controller.SdcParametersException; -import org.onap.clamp.clds.util.JsonUtils; -import org.onap.clamp.clds.util.ResourceFileUtils; +import org.onap.policy.clamp.clds.exception.sdc.controller.SdcParametersException; +import org.onap.policy.clamp.clds.util.JsonUtils; +import org.onap.policy.clamp.clds.util.ResourceFileUtils; /** * This class tests the SDC Controller config. @@ -44,15 +44,17 @@ import org.onap.clamp.clds.util.ResourceFileUtils; public class SdcSingleControllerConfigurationTest { /** - * @param fileName file for sdc controller configuration. + * This method loads the SDC controller configuration from a file located in the resource folder. + * + * @param fileName file for sdc controller configuration. * @param sdcControllerName sdc controller name. * @return instance of SdcSingleControllerConfiguration. */ public static SdcSingleControllerConfiguration loadControllerConfiguration(String fileName, - String sdcControllerName) { + String sdcControllerName) { InputStreamReader streamReader = new InputStreamReader(ResourceFileUtils.getResourceAsStream(fileName), - StandardCharsets.UTF_8); + StandardCharsets.UTF_8); JsonObject jsonNode = JsonUtils.GSON.fromJson(streamReader, JsonObject.class); return new SdcSingleControllerConfiguration(jsonNode, sdcControllerName); @@ -61,7 +63,7 @@ public class SdcSingleControllerConfigurationTest { @Test public final void testTheInit() throws SdcParametersException, IOException { SdcSingleControllerConfiguration sdcConfig = loadControllerConfiguration("clds/sdc-controller-config-TLS.json", - "sdc-controller1"); + "sdc-controller1"); assertEquals("User", sdcConfig.getUser()); assertEquals("ThePassword", sdcConfig.getPassword()); assertEquals("consumerGroup", sdcConfig.getConsumerGroup()); @@ -72,7 +74,7 @@ public class SdcSingleControllerConfigurationTest { assertEquals(30, sdcConfig.getPollingTimeout()); assertThat(SdcSingleControllerConfiguration.SUPPORTED_ARTIFACT_TYPES_LIST) - .hasSameSizeAs(sdcConfig.getRelevantArtifactTypes()); + .hasSameSizeAs(sdcConfig.getRelevantArtifactTypes()); assertEquals("ThePassword", sdcConfig.getKeyStorePassword()); assertTrue(sdcConfig.activateServerTLSAuth()); assertThat(sdcConfig.getMsgBusAddress()).contains("localhost"); @@ -81,7 +83,7 @@ public class SdcSingleControllerConfigurationTest { @Test(expected = SdcParametersException.class) public final void testAllRequiredParameters() throws IOException { SdcSingleControllerConfiguration sdcConfig = loadControllerConfiguration("clds/sdc-controller-config-TLS.json", - "sdc-controller1"); + "sdc-controller1"); // No exception should be raised sdcConfig.testAllRequiredParameters(); sdcConfig = loadControllerConfiguration("clds/sdc-controller-config-bad.json", "sdc-controller1"); @@ -91,7 +93,7 @@ public class SdcSingleControllerConfigurationTest { @Test public final void testAllRequiredParametersEmptyEncrypted() throws IOException { SdcSingleControllerConfiguration sdcConfig = loadControllerConfiguration( - "clds/sdc-controller-config-empty-encrypted.json", "sdc-controller1"); + "clds/sdc-controller-config-empty-encrypted.json", "sdc-controller1"); sdcConfig.testAllRequiredParameters(); assertNull(sdcConfig.getKeyStorePassword()); } @@ -99,7 +101,7 @@ public class SdcSingleControllerConfigurationTest { @Test public final void testConsumerGroupWithNull() throws IOException { SdcSingleControllerConfiguration sdcConfig = loadControllerConfiguration("clds/sdc-controller-config-NULL.json", - "sdc-controller1"); + "sdc-controller1"); assertTrue(sdcConfig.getConsumerGroup() == null); } } diff --git a/src/test/java/org/onap/clamp/clds/it/AuthorizationControllerItCase.java b/src/test/java/org/onap/policy/clamp/clds/it/AuthorizationControllerItCase.java index 207e93684..557a2e96c 100644 --- a/src/test/java/org/onap/clamp/clds/it/AuthorizationControllerItCase.java +++ b/src/test/java/org/onap/policy/clamp/clds/it/AuthorizationControllerItCase.java @@ -24,7 +24,7 @@ * */ -package org.onap.clamp.clds.it; +package org.onap.policy.clamp.clds.it; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; @@ -38,9 +38,9 @@ import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mockito; -import org.onap.clamp.authorization.AuthorizationController; -import org.onap.clamp.authorization.SecureServicePermission; -import org.onap.clamp.clds.exception.NotAuthorizedException; +import org.onap.policy.clamp.authorization.AuthorizationController; +import org.onap.policy.clamp.authorization.SecureServicePermission; +import org.onap.policy.clamp.clds.exception.NotAuthorizedException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.security.core.Authentication; @@ -121,7 +121,7 @@ public class AuthorizationControllerItCase { @Test public void testIsUserPermitted() { - assertEquals(AuthorizationController.getPrincipalName(sc),"admin"); + assertEquals(AuthorizationController.getPrincipalName(sc), "admin"); assertTrue(auth.isUserPermitted(new SecureServicePermission("permission-type-cl", "dev", "read"))); assertTrue(auth.isUserPermitted(new SecureServicePermission("permission-type-cl-manage", "dev", "DEPLOY"))); assertTrue(auth.isUserPermitted( diff --git a/src/test/java/org/onap/clamp/clds/it/CldsHealthcheckServiceItCase.java b/src/test/java/org/onap/policy/clamp/clds/it/CldsHealthcheckServiceItCase.java index 587b7c915..52da63952 100644 --- a/src/test/java/org/onap/clamp/clds/it/CldsHealthcheckServiceItCase.java +++ b/src/test/java/org/onap/policy/clamp/clds/it/CldsHealthcheckServiceItCase.java @@ -20,15 +20,15 @@ * =================================================================== */ -package org.onap.clamp.clds.it; +package org.onap.policy.clamp.clds.it; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import org.junit.Test; import org.junit.runner.RunWith; -import org.onap.clamp.clds.model.CldsHealthCheck; -import org.onap.clamp.clds.service.CldsHealthcheckService; +import org.onap.policy.clamp.clds.model.CldsHealthCheck; +import org.onap.policy.clamp.clds.service.CldsHealthcheckService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; diff --git a/src/test/java/org/onap/clamp/clds/it/HttpsItCase.java b/src/test/java/org/onap/policy/clamp/clds/it/HttpsItCase.java index 90a240181..9dd2130c6 100644 --- a/src/test/java/org/onap/clamp/clds/it/HttpsItCase.java +++ b/src/test/java/org/onap/policy/clamp/clds/it/HttpsItCase.java @@ -21,7 +21,7 @@ * */ -package org.onap.clamp.clds.it; +package org.onap.policy.clamp.clds.it; import static org.assertj.core.api.Assertions.assertThat; diff --git a/src/test/java/org/onap/clamp/clds/it/RobotItCase.java b/src/test/java/org/onap/policy/clamp/clds/it/RobotItCase.java index 5eff96e44..8c06929e1 100644 --- a/src/test/java/org/onap/clamp/clds/it/RobotItCase.java +++ b/src/test/java/org/onap/policy/clamp/clds/it/RobotItCase.java @@ -21,7 +21,7 @@ * */ -package org.onap.clamp.clds.it; +package org.onap.policy.clamp.clds.it; import com.att.eelf.configuration.EELFLogger; import com.att.eelf.configuration.EELFManager; diff --git a/src/test/java/org/onap/clamp/clds/it/config/CldsReferencePropertiesItCase.java b/src/test/java/org/onap/policy/clamp/clds/it/config/CldsReferencePropertiesItCase.java index c4c0c345a..c8b9932cc 100644 --- a/src/test/java/org/onap/clamp/clds/it/config/CldsReferencePropertiesItCase.java +++ b/src/test/java/org/onap/policy/clamp/clds/it/config/CldsReferencePropertiesItCase.java @@ -21,22 +21,19 @@ * */ -package org.onap.clamp.clds.it.config; +package org.onap.policy.clamp.clds.it.config; import static org.junit.Assert.assertEquals; import java.io.IOException; import org.junit.Test; import org.junit.runner.RunWith; -import org.onap.clamp.clds.config.ClampProperties; -import org.onap.clamp.clds.util.ResourceFileUtils; +import org.onap.policy.clamp.clds.config.ClampProperties; +import org.onap.policy.clamp.clds.util.ResourceFileUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; -/** - * Test corg.onap.clamp.ClampDesigner.model.refprop package using RefProp. - */ @RunWith(SpringRunner.class) @SpringBootTest public class CldsReferencePropertiesItCase { diff --git a/src/test/java/org/onap/clamp/clds/it/config/SdcControllersConfigurationItCase.java b/src/test/java/org/onap/policy/clamp/clds/it/config/SdcControllersConfigurationItCase.java index 0c08a2e36..516fc7a09 100644 --- a/src/test/java/org/onap/clamp/clds/it/config/SdcControllersConfigurationItCase.java +++ b/src/test/java/org/onap/policy/clamp/clds/it/config/SdcControllersConfigurationItCase.java @@ -18,22 +18,20 @@ * ============LICENSE_END========================================================= */ -package org.onap.clamp.clds.it.config; +package org.onap.policy.clamp.clds.it.config; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import com.google.gson.JsonSyntaxException; - import java.io.IOException; import java.util.Map; - import org.junit.Test; import org.junit.runner.RunWith; -import org.onap.clamp.clds.config.sdc.SdcControllersConfiguration; -import org.onap.clamp.clds.config.sdc.SdcSingleControllerConfiguration; -import org.onap.clamp.clds.exception.sdc.controller.SdcParametersException; +import org.onap.policy.clamp.clds.config.sdc.SdcControllersConfiguration; +import org.onap.policy.clamp.clds.config.sdc.SdcSingleControllerConfiguration; +import org.onap.policy.clamp.clds.exception.sdc.controller.SdcParametersException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.ActiveProfiles; @@ -45,7 +43,7 @@ import org.springframework.test.util.ReflectionTestUtils; */ @RunWith(SpringRunner.class) @SpringBootTest -@ActiveProfiles({"clamp-default","clamp-default-user","clamp-sdc-controller"}) +@ActiveProfiles({"clamp-default", "clamp-default-user", "clamp-sdc-controller"}) public class SdcControllersConfigurationItCase { @Autowired diff --git a/src/test/java/org/onap/clamp/clds/it/sdc/controller/SdcSingleControllerItCase.java b/src/test/java/org/onap/policy/clamp/clds/it/sdc/controller/SdcSingleControllerItCase.java index a8c3e58d4..787118902 100644 --- a/src/test/java/org/onap/clamp/clds/it/sdc/controller/SdcSingleControllerItCase.java +++ b/src/test/java/org/onap/policy/clamp/clds/it/sdc/controller/SdcSingleControllerItCase.java @@ -23,7 +23,7 @@ * */ -package org.onap.clamp.clds.it.sdc.controller; +package org.onap.policy.clamp.clds.it.sdc.controller; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; @@ -33,19 +33,18 @@ import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.List; - import org.assertj.core.api.Assertions; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mockito; -import org.onap.clamp.clds.config.ClampProperties; -import org.onap.clamp.clds.config.sdc.SdcSingleControllerConfigurationTest; -import org.onap.clamp.clds.exception.sdc.controller.SdcControllerException; -import org.onap.clamp.clds.sdc.controller.SdcSingleController; -import org.onap.clamp.clds.sdc.controller.SdcSingleControllerStatus; -import org.onap.clamp.clds.sdc.controller.installer.CsarHandler; -import org.onap.clamp.loop.CsarInstaller; +import org.onap.policy.clamp.clds.config.ClampProperties; +import org.onap.policy.clamp.clds.config.sdc.SdcSingleControllerConfigurationTest; +import org.onap.policy.clamp.clds.exception.sdc.controller.SdcControllerException; +import org.onap.policy.clamp.clds.sdc.controller.SdcSingleController; +import org.onap.policy.clamp.clds.sdc.controller.SdcSingleControllerStatus; +import org.onap.policy.clamp.clds.sdc.controller.installer.CsarHandler; +import org.onap.policy.clamp.loop.CsarInstaller; import org.onap.sdc.api.notification.IArtifactInfo; import org.onap.sdc.api.notification.INotificationData; import org.onap.sdc.api.notification.IResourceInstance; @@ -58,7 +57,7 @@ import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest -@ActiveProfiles({"clamp-default","clamp-default-user","clamp-sdc-controller"}) +@ActiveProfiles({"clamp-default", "clamp-default-user", "clamp-sdc-controller"}) public class SdcSingleControllerItCase { private static final String CSAR_ARTIFACT_NAME = "testArtifact.csar"; @@ -133,7 +132,7 @@ public class SdcSingleControllerItCase { // given Class<?> innerClass = Class - .forName("org.onap.clamp.clds.sdc.controller.SdcSingleController$SdcNotificationCallBack"); + .forName("org.onap.policy.clamp.clds.sdc.controller.SdcSingleController$SdcNotificationCallBack"); Constructor<?> constructor = innerClass.getDeclaredConstructor(SdcSingleController.class, SdcSingleController.class); constructor.setAccessible(true); diff --git a/src/test/java/org/onap/clamp/clds/model/dcae/DcaeInventoryResponseCacheTestItCase.java b/src/test/java/org/onap/policy/clamp/clds/model/dcae/DcaeInventoryResponseCacheTestItCase.java index 50da40049..0e7fe6c7e 100644 --- a/src/test/java/org/onap/clamp/clds/model/dcae/DcaeInventoryResponseCacheTestItCase.java +++ b/src/test/java/org/onap/policy/clamp/clds/model/dcae/DcaeInventoryResponseCacheTestItCase.java @@ -21,21 +21,20 @@ * */ -package org.onap.clamp.clds.model.dcae; +package org.onap.policy.clamp.clds.model.dcae; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.Assert.assertEquals; import java.util.HashSet; import java.util.Set; - import org.apache.camel.CamelContext; import org.apache.camel.Exchange; import org.apache.camel.builder.ExchangeBuilder; import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; -import org.onap.clamp.clds.Application; +import org.onap.policy.clamp.clds.Application; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; diff --git a/src/test/java/org/onap/clamp/clds/model/dcae/DcaeInventoryResponseTest.java b/src/test/java/org/onap/policy/clamp/clds/model/dcae/DcaeInventoryResponseTest.java index fc4872c3b..a246e0efa 100644 --- a/src/test/java/org/onap/clamp/clds/model/dcae/DcaeInventoryResponseTest.java +++ b/src/test/java/org/onap/policy/clamp/clds/model/dcae/DcaeInventoryResponseTest.java @@ -21,12 +21,11 @@ * */ -package org.onap.clamp.clds.model.dcae; +package org.onap.policy.clamp.clds.model.dcae; import static org.assertj.core.api.Assertions.assertThat; import java.util.TreeSet; - import org.junit.Test; public class DcaeInventoryResponseTest { diff --git a/src/test/java/org/onap/clamp/clds/model/jsontype/JsonTypeDescriptorTest.java b/src/test/java/org/onap/policy/clamp/clds/model/jsontype/JsonTypeDescriptorTest.java index 560f54cf4..7999709c2 100644 --- a/src/test/java/org/onap/clamp/clds/model/jsontype/JsonTypeDescriptorTest.java +++ b/src/test/java/org/onap/policy/clamp/clds/model/jsontype/JsonTypeDescriptorTest.java @@ -20,15 +20,14 @@ * */ -package org.onap.clamp.clds.model.jsontype; +package org.onap.policy.clamp.clds.model.jsontype; import static org.assertj.core.api.Assertions.assertThat; import com.google.gson.JsonObject; - import org.hibernate.HibernateException; import org.junit.Test; -import org.onap.clamp.dao.model.jsontype.JsonTypeDescriptor; +import org.onap.policy.clamp.dao.model.jsontype.JsonTypeDescriptor; public class JsonTypeDescriptorTest { @@ -37,10 +36,10 @@ public class JsonTypeDescriptorTest { @Test public void testFromString() { JsonObject object = new JsonObject(); - object.addProperty("one","oneValue"); + object.addProperty("one", "oneValue"); JsonObject child = new JsonObject(); - child.addProperty("two","twoValue"); - object.add("child",child); + child.addProperty("two", "twoValue"); + object.add("child", child); JsonObject jsonResult = descriptor.fromString("{\"one\":\"oneValue\",\"child\":{\"two\":\"twoValue\"}}"); @@ -53,10 +52,10 @@ public class JsonTypeDescriptorTest { assertThat(res1).isNull(); JsonObject object = new JsonObject(); - object.addProperty("one","oneValue"); + object.addProperty("one", "oneValue"); JsonObject child = new JsonObject(); - child.addProperty("two","twoValue"); - object.add("child",child); + child.addProperty("two", "twoValue"); + object.add("child", child); String res2 = descriptor.unwrap(object, String.class, null); assertThat(res2.replace("\n", "").replace(" ", "")) .isEqualTo("{\"one\":\"oneValue\",\"child\":{\"two\":\"twoValue\"}}"); @@ -70,7 +69,7 @@ public class JsonTypeDescriptorTest { @Test(expected = HibernateException.class) public void testUnwrapExpectationThrown() { JsonObject object = new JsonObject(); - object.addProperty("one","oneValue"); + object.addProperty("one", "oneValue"); descriptor.unwrap(object, Integer.class, null); } @@ -81,10 +80,10 @@ public class JsonTypeDescriptorTest { assertThat(res1).isNull(); JsonObject object = new JsonObject(); - object.addProperty("one","oneValue"); + object.addProperty("one", "oneValue"); JsonObject child = new JsonObject(); - child.addProperty("two","twoValue"); - object.add("child",child); + child.addProperty("two", "twoValue"); + object.add("child", child); JsonObject res2 = descriptor.wrap("{\"one\":\"oneValue\",\"child\":{\"two\":\"twoValue\"}}", null); assertThat(res2).isEqualTo(object); } diff --git a/src/test/java/org/onap/clamp/clds/sdc/controller/installer/BlueprintParserTest.java b/src/test/java/org/onap/policy/clamp/clds/sdc/controller/installer/BlueprintParserTest.java index a768526a0..085b3d187 100644 --- a/src/test/java/org/onap/clamp/clds/sdc/controller/installer/BlueprintParserTest.java +++ b/src/test/java/org/onap/policy/clamp/clds/sdc/controller/installer/BlueprintParserTest.java @@ -23,7 +23,7 @@ * */ -package org.onap.clamp.clds.sdc.controller.installer; +package org.onap.policy.clamp.clds.sdc.controller.installer; import static org.assertj.core.api.Assertions.assertThat; @@ -42,8 +42,8 @@ import org.json.JSONObject; import org.junit.Assert; import org.junit.BeforeClass; import org.junit.Test; -import org.onap.clamp.clds.exception.sdc.controller.BlueprintParserException; -import org.onap.clamp.clds.util.ResourceFileUtils; +import org.onap.policy.clamp.clds.exception.sdc.controller.BlueprintParserException; +import org.onap.policy.clamp.clds.util.ResourceFileUtils; import org.yaml.snakeyaml.Yaml; public class BlueprintParserTest { diff --git a/src/test/java/org/onap/clamp/clds/sdc/controller/installer/ChainGeneratorTest.java b/src/test/java/org/onap/policy/clamp/clds/sdc/controller/installer/ChainGeneratorTest.java index 83b3dda01..d7a3b3823 100644 --- a/src/test/java/org/onap/clamp/clds/sdc/controller/installer/ChainGeneratorTest.java +++ b/src/test/java/org/onap/policy/clamp/clds/sdc/controller/installer/ChainGeneratorTest.java @@ -21,13 +21,12 @@ * */ -package org.onap.clamp.clds.sdc.controller.installer; +package org.onap.policy.clamp.clds.sdc.controller.installer; import java.util.Arrays; import java.util.HashSet; import java.util.List; import java.util.Set; - import org.junit.Assert; import org.junit.Test; diff --git a/src/test/java/org/onap/clamp/clds/sdc/controller/installer/CsarHandlerTest.java b/src/test/java/org/onap/policy/clamp/clds/sdc/controller/installer/CsarHandlerTest.java index f04e3fa3c..08e425abf 100644 --- a/src/test/java/org/onap/clamp/clds/sdc/controller/installer/CsarHandlerTest.java +++ b/src/test/java/org/onap/policy/clamp/clds/sdc/controller/installer/CsarHandlerTest.java @@ -21,7 +21,7 @@ * */ -package org.onap.clamp.clds.sdc.controller.installer; +package org.onap.policy.clamp.clds.sdc.controller.installer; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; @@ -36,13 +36,12 @@ import java.nio.file.Path; import java.nio.file.Paths; import java.util.ArrayList; import java.util.List; - import org.apache.commons.io.IOUtils; import org.junit.Test; import org.mockito.Mockito; -import org.onap.clamp.clds.exception.sdc.controller.CsarHandlerException; -import org.onap.clamp.clds.exception.sdc.controller.SdcArtifactInstallerException; -import org.onap.clamp.clds.util.ResourceFileUtils; +import org.onap.policy.clamp.clds.exception.sdc.controller.CsarHandlerException; +import org.onap.policy.clamp.clds.exception.sdc.controller.SdcArtifactInstallerException; +import org.onap.policy.clamp.clds.util.ResourceFileUtils; import org.onap.sdc.api.notification.IArtifactInfo; import org.onap.sdc.api.notification.INotificationData; import org.onap.sdc.api.notification.IResourceInstance; diff --git a/src/test/java/org/onap/clamp/clds/tosca/DictionaryRepositoriesTestItCase.java b/src/test/java/org/onap/policy/clamp/clds/tosca/DictionaryRepositoriesTestItCase.java index 01dc8404c..f70e74cd6 100644 --- a/src/test/java/org/onap/clamp/clds/tosca/DictionaryRepositoriesTestItCase.java +++ b/src/test/java/org/onap/policy/clamp/clds/tosca/DictionaryRepositoriesTestItCase.java @@ -21,17 +21,17 @@ * */ -package org.onap.clamp.clds.tosca; +package org.onap.policy.clamp.clds.tosca; import static org.assertj.core.api.Assertions.assertThat; import java.util.List; import org.junit.Test; import org.junit.runner.RunWith; -import org.onap.clamp.clds.Application; -import org.onap.clamp.tosca.Dictionary; -import org.onap.clamp.tosca.DictionaryElement; -import org.onap.clamp.tosca.DictionaryRepository; +import org.onap.policy.clamp.clds.Application; +import org.onap.policy.clamp.tosca.Dictionary; +import org.onap.policy.clamp.tosca.DictionaryElement; +import org.onap.policy.clamp.tosca.DictionaryRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; diff --git a/src/test/java/org/onap/clamp/clds/tosca/ToscaYamlToJsonConvertorTestItCase.java b/src/test/java/org/onap/policy/clamp/clds/tosca/ToscaYamlToJsonConvertorTestItCase.java index e73547652..6ff82b6d7 100644 --- a/src/test/java/org/onap/clamp/clds/tosca/ToscaYamlToJsonConvertorTestItCase.java +++ b/src/test/java/org/onap/policy/clamp/clds/tosca/ToscaYamlToJsonConvertorTestItCase.java @@ -22,7 +22,7 @@ * */ -package org.onap.clamp.clds.tosca; +package org.onap.policy.clamp.clds.tosca; import static org.junit.Assert.assertNotNull; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -32,11 +32,11 @@ import java.io.IOException; import javax.transaction.Transactional; import org.junit.Test; import org.junit.runner.RunWith; -import org.onap.clamp.clds.Application; -import org.onap.clamp.clds.util.ResourceFileUtils; -import org.onap.clamp.tosca.Dictionary; -import org.onap.clamp.tosca.DictionaryElement; -import org.onap.clamp.tosca.DictionaryService; +import org.onap.policy.clamp.clds.Application; +import org.onap.policy.clamp.clds.util.ResourceFileUtils; +import org.onap.policy.clamp.tosca.Dictionary; +import org.onap.policy.clamp.tosca.DictionaryElement; +import org.onap.policy.clamp.tosca.DictionaryService; import org.skyscreamer.jsonassert.JSONAssert; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; diff --git a/src/test/java/org/onap/clamp/clds/tosca/update/ArrayFieldTest.java b/src/test/java/org/onap/policy/clamp/clds/tosca/update/ArrayFieldTest.java index 8a81445b2..6f6f5c104 100644 --- a/src/test/java/org/onap/clamp/clds/tosca/update/ArrayFieldTest.java +++ b/src/test/java/org/onap/policy/clamp/clds/tosca/update/ArrayFieldTest.java @@ -21,17 +21,17 @@ * */ -package org.onap.clamp.clds.tosca.update; +package org.onap.policy.clamp.clds.tosca.update; import com.google.gson.JsonArray; import java.io.IOException; import java.util.ArrayList; import junit.framework.TestCase; -import org.onap.clamp.clds.tosca.update.elements.ArrayField; -import org.onap.clamp.clds.tosca.update.elements.ToscaElement; -import org.onap.clamp.clds.tosca.update.elements.ToscaElementProperty; -import org.onap.clamp.clds.tosca.update.templates.JsonTemplateManager; -import org.onap.clamp.clds.util.ResourceFileUtils; +import org.onap.policy.clamp.clds.tosca.update.elements.ArrayField; +import org.onap.policy.clamp.clds.tosca.update.elements.ToscaElement; +import org.onap.policy.clamp.clds.tosca.update.elements.ToscaElementProperty; +import org.onap.policy.clamp.clds.tosca.update.templates.JsonTemplateManager; +import org.onap.policy.clamp.clds.util.ResourceFileUtils; public class ArrayFieldTest extends TestCase { diff --git a/src/test/java/org/onap/clamp/clds/tosca/update/ConstraintTest.java b/src/test/java/org/onap/policy/clamp/clds/tosca/update/ConstraintTest.java index f147f404d..493ee992c 100644 --- a/src/test/java/org/onap/clamp/clds/tosca/update/ConstraintTest.java +++ b/src/test/java/org/onap/policy/clamp/clds/tosca/update/ConstraintTest.java @@ -21,17 +21,17 @@ * */ -package org.onap.clamp.clds.tosca.update; +package org.onap.policy.clamp.clds.tosca.update; import com.google.gson.JsonObject; import java.io.IOException; import java.util.ArrayList; import junit.framework.TestCase; -import org.onap.clamp.clds.tosca.update.elements.ToscaElement; -import org.onap.clamp.clds.tosca.update.elements.ToscaElementProperty; -import org.onap.clamp.clds.tosca.update.templates.JsonTemplate; -import org.onap.clamp.clds.tosca.update.templates.JsonTemplateManager; -import org.onap.clamp.clds.util.ResourceFileUtils; +import org.onap.policy.clamp.clds.tosca.update.elements.ToscaElement; +import org.onap.policy.clamp.clds.tosca.update.elements.ToscaElementProperty; +import org.onap.policy.clamp.clds.tosca.update.templates.JsonTemplate; +import org.onap.policy.clamp.clds.tosca.update.templates.JsonTemplateManager; +import org.onap.policy.clamp.clds.util.ResourceFileUtils; public class ConstraintTest extends TestCase { diff --git a/src/test/java/org/onap/clamp/clds/tosca/update/JsonTemplateFieldTest.java b/src/test/java/org/onap/policy/clamp/clds/tosca/update/JsonTemplateFieldTest.java index 29f5a1da8..3eaa0ce51 100644 --- a/src/test/java/org/onap/clamp/clds/tosca/update/JsonTemplateFieldTest.java +++ b/src/test/java/org/onap/policy/clamp/clds/tosca/update/JsonTemplateFieldTest.java @@ -21,10 +21,10 @@ * */ -package org.onap.clamp.clds.tosca.update; +package org.onap.policy.clamp.clds.tosca.update; import junit.framework.TestCase; -import org.onap.clamp.clds.tosca.update.templates.JsonTemplateField; +import org.onap.policy.clamp.clds.tosca.update.templates.JsonTemplateField; public class JsonTemplateFieldTest extends TestCase { @@ -39,10 +39,10 @@ public class JsonTemplateFieldTest extends TestCase { * Test fieldsEqual method. */ public void testFieldsEqualsMethod() { - assertFalse(JsonTemplateField.fieldsEquals(field1,field3)); - assertFalse(JsonTemplateField.fieldsEquals(field1,field4)); - assertFalse(JsonTemplateField.fieldsEquals(field1,field5)); - assertTrue(JsonTemplateField.fieldsEquals(field1,field6)); + assertFalse(JsonTemplateField.fieldsEquals(field1, field3)); + assertFalse(JsonTemplateField.fieldsEquals(field1, field4)); + assertFalse(JsonTemplateField.fieldsEquals(field1, field5)); + assertTrue(JsonTemplateField.fieldsEquals(field1, field6)); } /** diff --git a/src/test/java/org/onap/clamp/clds/tosca/update/JsonTemplateManagerTest.java b/src/test/java/org/onap/policy/clamp/clds/tosca/update/JsonTemplateManagerTest.java index b9fcf51aa..2c8744f33 100644 --- a/src/test/java/org/onap/clamp/clds/tosca/update/JsonTemplateManagerTest.java +++ b/src/test/java/org/onap/policy/clamp/clds/tosca/update/JsonTemplateManagerTest.java @@ -21,17 +21,17 @@ * */ -package org.onap.clamp.clds.tosca.update; +package org.onap.policy.clamp.clds.tosca.update; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import junit.framework.TestCase; -import org.onap.clamp.clds.tosca.update.templates.JsonTemplate; -import org.onap.clamp.clds.tosca.update.templates.JsonTemplateField; -import org.onap.clamp.clds.tosca.update.templates.JsonTemplateManager; -import org.onap.clamp.clds.util.ResourceFileUtils; +import org.onap.policy.clamp.clds.tosca.update.templates.JsonTemplate; +import org.onap.policy.clamp.clds.tosca.update.templates.JsonTemplateField; +import org.onap.policy.clamp.clds.tosca.update.templates.JsonTemplateManager; +import org.onap.policy.clamp.clds.util.ResourceFileUtils; public class JsonTemplateManagerTest extends TestCase { @@ -45,9 +45,9 @@ public class JsonTemplateManagerTest extends TestCase { JsonTemplateManager jsonTemplateManager = new JsonTemplateManager( ResourceFileUtils.getResourceAsString("http-cache/example/policy/api/v1/policytypes/onap" - + ".policies.monitoring.cdap.tca.hi.lo.app/versions/1.0.0?" - + "connectionTimeToLive=5000/.file"), ResourceFileUtils.getResourceAsString( - "clds/tosca-converter/default-tosca-types.yaml"), + + ".policies.monitoring.cdap.tca.hi.lo.app/versions/1.0.0/.file"), + ResourceFileUtils.getResourceAsString( + "clds/tosca-converter/default-tosca-types.yaml"), ResourceFileUtils.getResourceAsString("clds/tosca-converter/templates.json")); String componentName = "onap.policies.monitoring.cdap.tca.hi.lo.app"; jsonTemplateManager.getJsonSchemaForPolicyType(componentName, null, null); @@ -63,9 +63,9 @@ public class JsonTemplateManagerTest extends TestCase { JsonTemplateManager jsonTemplateManager = new JsonTemplateManager( ResourceFileUtils.getResourceAsString("http-cache/example/policy/api/v1/policytypes/onap" - + ".policies.controlloop.guard.common.FrequencyLimiter/versions/1.0.0?" - + "connectionTimeToLive=5000/.file"), ResourceFileUtils.getResourceAsString( - "clds/tosca-converter/default-tosca-types.yaml"), + + ".policies.controlloop.guard.common.FrequencyLimiter/versions/1.0.0/.file"), + ResourceFileUtils.getResourceAsString( + "clds/tosca-converter/default-tosca-types.yaml"), ResourceFileUtils.getResourceAsString("clds/tosca-converter/templates.json")); String componentName = "onap.policies.controlloop.guard.common.FrequencyLimiter"; jsonTemplateManager.getJsonSchemaForPolicyType(componentName, null, null); @@ -81,9 +81,9 @@ public class JsonTemplateManagerTest extends TestCase { JsonTemplateManager jsonTemplateManager = new JsonTemplateManager( ResourceFileUtils.getResourceAsString("http-cache/example/policy/api/v1/policytypes/onap" - + ".policies.controlloop.operational.common.Apex/versions/1.0.0?" - + "connectionTimeToLive=5000/.file"), ResourceFileUtils.getResourceAsString( - "clds/tosca-converter/default-tosca-types.yaml"), + + ".policies.controlloop.operational.common.Apex/versions/1.0.0/.file"), + ResourceFileUtils.getResourceAsString( + "clds/tosca-converter/default-tosca-types.yaml"), ResourceFileUtils.getResourceAsString("clds/tosca-converter/templates.json")); String componentName = "onap.policies.controlloop.operational.common.Apex"; jsonTemplateManager.getJsonSchemaForPolicyType(componentName, null, null); @@ -99,9 +99,9 @@ public class JsonTemplateManagerTest extends TestCase { JsonTemplateManager jsonTemplateManager = new JsonTemplateManager( ResourceFileUtils.getResourceAsString("http-cache/example/policy/api/v1/policytypes/onap" - + ".policies.controlloop.operational.common.Drools/versions/1.0.0?" - + "connectionTimeToLive=5000/.file"), ResourceFileUtils.getResourceAsString( - "clds/tosca-converter/default-tosca-types.yaml"), + + ".policies.controlloop.operational.common.Drools/versions/1.0.0/.file"), + ResourceFileUtils.getResourceAsString( + "clds/tosca-converter/default-tosca-types.yaml"), ResourceFileUtils.getResourceAsString("clds/tosca-converter/templates.json")); String componentName = "onap.policies.controlloop.operational.common.Drools"; jsonTemplateManager.getJsonSchemaForPolicyType(componentName, null, null); diff --git a/src/test/java/org/onap/clamp/clds/tosca/update/JsonTemplateTest.java b/src/test/java/org/onap/policy/clamp/clds/tosca/update/JsonTemplateTest.java index dc736a48b..dc27d8aaa 100644 --- a/src/test/java/org/onap/clamp/clds/tosca/update/JsonTemplateTest.java +++ b/src/test/java/org/onap/policy/clamp/clds/tosca/update/JsonTemplateTest.java @@ -21,14 +21,14 @@ * */ -package org.onap.clamp.clds.tosca.update; +package org.onap.policy.clamp.clds.tosca.update; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import junit.framework.TestCase; -import org.onap.clamp.clds.tosca.update.templates.JsonTemplate; -import org.onap.clamp.clds.tosca.update.templates.JsonTemplateField; +import org.onap.policy.clamp.clds.tosca.update.templates.JsonTemplate; +import org.onap.policy.clamp.clds.tosca.update.templates.JsonTemplateField; public class JsonTemplateTest extends TestCase { diff --git a/src/test/java/org/onap/clamp/clds/tosca/update/ToscaConverterWithDictionarySupportItCase.java b/src/test/java/org/onap/policy/clamp/clds/tosca/update/ToscaConverterWithDictionarySupportItCase.java index b5b0247c8..658419d4c 100644 --- a/src/test/java/org/onap/clamp/clds/tosca/update/ToscaConverterWithDictionarySupportItCase.java +++ b/src/test/java/org/onap/policy/clamp/clds/tosca/update/ToscaConverterWithDictionarySupportItCase.java @@ -21,23 +21,23 @@ * */ -package org.onap.clamp.clds.tosca.update; +package org.onap.policy.clamp.clds.tosca.update; import com.google.gson.JsonObject; import java.io.IOException; import javax.transaction.Transactional; import org.junit.Test; import org.junit.runner.RunWith; -import org.onap.clamp.clds.Application; -import org.onap.clamp.clds.tosca.update.execution.ToscaMetadataExecutor; -import org.onap.clamp.clds.tosca.update.parser.metadata.ToscaMetadataParserWithDictionarySupport; -import org.onap.clamp.clds.tosca.update.templates.JsonTemplateManager; -import org.onap.clamp.clds.util.JsonUtils; -import org.onap.clamp.clds.util.ResourceFileUtils; -import org.onap.clamp.loop.service.Service; -import org.onap.clamp.tosca.Dictionary; -import org.onap.clamp.tosca.DictionaryElement; -import org.onap.clamp.tosca.DictionaryService; +import org.onap.policy.clamp.clds.Application; +import org.onap.policy.clamp.clds.tosca.update.execution.ToscaMetadataExecutor; +import org.onap.policy.clamp.clds.tosca.update.parser.metadata.ToscaMetadataParserWithDictionarySupport; +import org.onap.policy.clamp.clds.tosca.update.templates.JsonTemplateManager; +import org.onap.policy.clamp.clds.util.JsonUtils; +import org.onap.policy.clamp.clds.util.ResourceFileUtils; +import org.onap.policy.clamp.loop.service.Service; +import org.onap.policy.clamp.tosca.Dictionary; +import org.onap.policy.clamp.tosca.DictionaryElement; +import org.onap.policy.clamp.tosca.DictionaryService; import org.skyscreamer.jsonassert.JSONAssert; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; @@ -46,7 +46,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @RunWith(SpringJUnit4ClassRunner.class) @SpringBootTest(classes = Application.class) -@ActiveProfiles({"clamp-default","clamp-default-user","default-dictionary-elements"}) +@ActiveProfiles({"clamp-default", "clamp-default-user", "default-dictionary-elements"}) public class ToscaConverterWithDictionarySupportItCase { @Autowired @@ -132,8 +132,7 @@ public class ToscaConverterWithDictionarySupportItCase { JsonTemplateManager jsonTemplateManager = new JsonTemplateManager( ResourceFileUtils.getResourceAsString("http-cache/example/policy/api/v1/policytypes/onap" - + ".policies.controlloop.operational.common.Apex/versions/1.0" - + ".0?connectionTimeToLive=5000/.file"), + + ".policies.controlloop.operational.common.Apex/versions/1.0.0/.file"), ResourceFileUtils.getResourceAsString("clds/tosca-converter/default-tosca-types.yaml"), ResourceFileUtils.getResourceAsString("clds/tosca-converter/templates.json")); diff --git a/src/test/java/org/onap/clamp/clds/tosca/update/ToscaElementPropertyTest.java b/src/test/java/org/onap/policy/clamp/clds/tosca/update/ToscaElementPropertyTest.java index 52f8444ff..5652fa9cd 100644 --- a/src/test/java/org/onap/clamp/clds/tosca/update/ToscaElementPropertyTest.java +++ b/src/test/java/org/onap/policy/clamp/clds/tosca/update/ToscaElementPropertyTest.java @@ -21,18 +21,18 @@ * */ -package org.onap.clamp.clds.tosca.update; +package org.onap.policy.clamp.clds.tosca.update; import com.google.gson.JsonArray; import com.google.gson.JsonObject; import java.io.IOException; import java.util.ArrayList; import junit.framework.TestCase; -import org.onap.clamp.clds.tosca.update.elements.ToscaElement; -import org.onap.clamp.clds.tosca.update.elements.ToscaElementProperty; -import org.onap.clamp.clds.tosca.update.templates.JsonTemplate; -import org.onap.clamp.clds.tosca.update.templates.JsonTemplateManager; -import org.onap.clamp.clds.util.ResourceFileUtils; +import org.onap.policy.clamp.clds.tosca.update.elements.ToscaElement; +import org.onap.policy.clamp.clds.tosca.update.elements.ToscaElementProperty; +import org.onap.policy.clamp.clds.tosca.update.templates.JsonTemplate; +import org.onap.policy.clamp.clds.tosca.update.templates.JsonTemplateManager; +import org.onap.policy.clamp.clds.util.ResourceFileUtils; public class ToscaElementPropertyTest extends TestCase { public ToscaElementPropertyTest() throws IOException { diff --git a/src/test/java/org/onap/clamp/clds/tosca/update/ToscaElementTest.java b/src/test/java/org/onap/policy/clamp/clds/tosca/update/ToscaElementTest.java index ba8454bb2..7b17adeec 100644 --- a/src/test/java/org/onap/clamp/clds/tosca/update/ToscaElementTest.java +++ b/src/test/java/org/onap/policy/clamp/clds/tosca/update/ToscaElementTest.java @@ -21,15 +21,15 @@ *
*/
-package org.onap.clamp.clds.tosca.update;
+package org.onap.policy.clamp.clds.tosca.update;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import junit.framework.TestCase;
-import org.onap.clamp.clds.tosca.update.elements.ToscaElement;
-import org.onap.clamp.clds.tosca.update.templates.JsonTemplateManager;
-import org.onap.clamp.clds.util.ResourceFileUtils;
+import org.onap.policy.clamp.clds.tosca.update.elements.ToscaElement;
+import org.onap.policy.clamp.clds.tosca.update.templates.JsonTemplateManager;
+import org.onap.policy.clamp.clds.util.ResourceFileUtils;
public class ToscaElementTest extends TestCase {
diff --git a/src/test/java/org/onap/clamp/clds/util/CryptoUtilsTest.java b/src/test/java/org/onap/policy/clamp/clds/util/CryptoUtilsTest.java index f6054d538..6239fef80 100644 --- a/src/test/java/org/onap/clamp/clds/util/CryptoUtilsTest.java +++ b/src/test/java/org/onap/policy/clamp/clds/util/CryptoUtilsTest.java @@ -23,7 +23,7 @@ * */ -package org.onap.clamp.clds.util; +package org.onap.policy.clamp.clds.util; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotEquals; @@ -31,10 +31,8 @@ import static org.junit.Assert.assertNotNull; import static org.mockito.ArgumentMatchers.eq; import java.security.InvalidKeyException; - import javax.crypto.KeyGenerator; import javax.crypto.SecretKey; - import org.apache.commons.codec.binary.Hex; import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; diff --git a/src/test/java/org/onap/clamp/clds/util/JsonUtilsTest.java b/src/test/java/org/onap/policy/clamp/clds/util/JsonUtilsTest.java index bc2ec2122..b2c6d282a 100644 --- a/src/test/java/org/onap/clamp/clds/util/JsonUtilsTest.java +++ b/src/test/java/org/onap/policy/clamp/clds/util/JsonUtilsTest.java @@ -24,13 +24,12 @@ * */ -package org.onap.clamp.clds.util; +package org.onap.policy.clamp.clds.util; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import java.io.IOException; - import org.junit.Test; public class JsonUtilsTest { @@ -63,8 +62,9 @@ public class JsonUtilsTest { public void testCreateBeanDeserializer() { TestClass test = new TestClass("value1", "value2"); test.setObject2(new TestObject2("test3")); - Object testObject = JsonUtils.GSON.fromJson("[\"org.onap.clamp.clds.util.JsonUtilsTest$TestClass\"" - + ",{\"test\":\"value1\",\"test2\":\"value2\",\"object2\":[\"org.onap.clamp.clds.util.TestObject2\"," + Object testObject = JsonUtils.GSON.fromJson("[\"org.onap.policy.clamp.clds.util.JsonUtilsTest$TestClass\"" + + ",{\"test\":\"value1\",\"test2\":\"value2\"," + + "\"object2\":[\"org.onap.policy.clamp.clds.util.TestObject2\"," + "{\"test3\":\"test3\"}]}]", Object.class); assertNotNull(testObject); assertFalse(testObject instanceof TestObject); diff --git a/src/test/java/org/onap/clamp/clds/util/LoggingUtilsTest.java b/src/test/java/org/onap/policy/clamp/clds/util/LoggingUtilsTest.java index 7e823e163..ab6a41bca 100644 --- a/src/test/java/org/onap/clamp/clds/util/LoggingUtilsTest.java +++ b/src/test/java/org/onap/policy/clamp/clds/util/LoggingUtilsTest.java @@ -19,7 +19,7 @@ * */ -package org.onap.clamp.clds.util; +package org.onap.policy.clamp.clds.util; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; diff --git a/src/test/java/org/onap/clamp/clds/util/TestObject.java b/src/test/java/org/onap/policy/clamp/clds/util/TestObject.java index 418c80815..02cabd270 100644 --- a/src/test/java/org/onap/clamp/clds/util/TestObject.java +++ b/src/test/java/org/onap/policy/clamp/clds/util/TestObject.java @@ -21,7 +21,7 @@ * */ -package org.onap.clamp.clds.util; +package org.onap.policy.clamp.clds.util; public class TestObject { diff --git a/src/test/java/org/onap/clamp/clds/util/TestObject2.java b/src/test/java/org/onap/policy/clamp/clds/util/TestObject2.java index 4fd77c230..d5abf41d0 100644 --- a/src/test/java/org/onap/clamp/clds/util/TestObject2.java +++ b/src/test/java/org/onap/policy/clamp/clds/util/TestObject2.java @@ -21,7 +21,7 @@ * */ -package org.onap.clamp.clds.util; +package org.onap.policy.clamp.clds.util; public class TestObject2 { diff --git a/src/test/java/org/onap/clamp/flow/FlowLogOperationTest.java b/src/test/java/org/onap/policy/clamp/flow/FlowLogOperationTest.java index 648c03307..51c4c078a 100644 --- a/src/test/java/org/onap/clamp/flow/FlowLogOperationTest.java +++ b/src/test/java/org/onap/policy/clamp/flow/FlowLogOperationTest.java @@ -20,7 +20,7 @@ * */ -package org.onap.clamp.flow; +package org.onap.policy.clamp.flow; import static junit.framework.Assert.assertEquals; import static org.assertj.core.api.Assertions.assertThat; @@ -31,9 +31,9 @@ import org.apache.camel.Exchange; import org.apache.camel.impl.DefaultExchange; import org.junit.Test; import org.mockito.Mockito; -import org.onap.clamp.clds.util.LoggingUtils; -import org.onap.clamp.clds.util.OnapLogConstants; -import org.onap.clamp.flow.log.FlowLogOperation; +import org.onap.policy.clamp.clds.util.LoggingUtils; +import org.onap.policy.clamp.clds.util.OnapLogConstants; +import org.onap.policy.clamp.flow.log.FlowLogOperation; import org.slf4j.MDC; import org.slf4j.spi.MDCAdapter; import org.springframework.test.util.ReflectionTestUtils; diff --git a/src/test/java/org/onap/clamp/loop/CsarInstallerItCase.java b/src/test/java/org/onap/policy/clamp/loop/CsarInstallerItCase.java index aa8054c47..8ef0df5e4 100644 --- a/src/test/java/org/onap/clamp/loop/CsarInstallerItCase.java +++ b/src/test/java/org/onap/policy/clamp/loop/CsarInstallerItCase.java @@ -24,7 +24,7 @@ * */ -package org.onap.clamp.loop; +package org.onap.policy.clamp.loop; import static org.assertj.core.api.Assertions.assertThat; @@ -36,26 +36,27 @@ import java.util.Map; import java.util.Optional; import javax.transaction.Transactional; import org.apache.commons.lang3.RandomStringUtils; +import org.assertj.core.api.Assertions; import org.json.JSONException; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mockito; -import org.onap.clamp.clds.Application; -import org.onap.clamp.clds.exception.sdc.controller.BlueprintParserException; -import org.onap.clamp.clds.exception.sdc.controller.CsarHandlerException; -import org.onap.clamp.clds.exception.sdc.controller.SdcArtifactInstallerException; -import org.onap.clamp.clds.sdc.controller.installer.BlueprintArtifact; -import org.onap.clamp.clds.sdc.controller.installer.CsarHandler; -import org.onap.clamp.clds.util.JsonUtils; -import org.onap.clamp.clds.util.ResourceFileUtils; -import org.onap.clamp.loop.cds.CdsDataInstaller; -import org.onap.clamp.loop.service.ServicesRepository; -import org.onap.clamp.loop.template.LoopTemplate; -import org.onap.clamp.loop.template.LoopTemplateLoopElementModel; -import org.onap.clamp.loop.template.LoopTemplatesRepository; -import org.onap.clamp.loop.template.PolicyModelId; -import org.onap.clamp.loop.template.PolicyModelsRepository; +import org.onap.policy.clamp.clds.Application; +import org.onap.policy.clamp.clds.exception.sdc.controller.BlueprintParserException; +import org.onap.policy.clamp.clds.exception.sdc.controller.CsarHandlerException; +import org.onap.policy.clamp.clds.exception.sdc.controller.SdcArtifactInstallerException; +import org.onap.policy.clamp.clds.sdc.controller.installer.BlueprintArtifact; +import org.onap.policy.clamp.clds.sdc.controller.installer.CsarHandler; +import org.onap.policy.clamp.clds.util.JsonUtils; +import org.onap.policy.clamp.clds.util.ResourceFileUtils; +import org.onap.policy.clamp.loop.cds.CdsDataInstaller; +import org.onap.policy.clamp.loop.service.ServicesRepository; +import org.onap.policy.clamp.loop.template.LoopTemplate; +import org.onap.policy.clamp.loop.template.LoopTemplateLoopElementModel; +import org.onap.policy.clamp.loop.template.LoopTemplatesRepository; +import org.onap.policy.clamp.loop.template.PolicyModelId; +import org.onap.policy.clamp.loop.template.PolicyModelsRepository; import org.onap.sdc.api.notification.IArtifactInfo; import org.onap.sdc.api.notification.INotificationData; import org.onap.sdc.api.notification.IResourceInstance; @@ -112,6 +113,48 @@ public class CsarInstallerItCase { return blueprintArtifact; } + private CsarHandler buildBadFakeCsarHandler(String generatedName, String csarFileName) throws IOException, + SdcToscaParserException { + + // Build a Bad csar because the blueprint contains a link to a microservice that does not exist in the emulator + // Create fake notification + INotificationData notificationData = Mockito.mock(INotificationData.class); + Mockito.when(notificationData.getServiceVersion()).thenReturn("1.0"); + // Create fake resource in notification + CsarHandler csarHandler = Mockito.mock(CsarHandler.class); + List<IResourceInstance> listResources = new ArrayList<>(); + Mockito.when(notificationData.getResources()).thenReturn(listResources); + Map<String, BlueprintArtifact> blueprintMap = new HashMap<>(); + Mockito.when(csarHandler.getMapOfBlueprints()).thenReturn(blueprintMap); + // Create fake blueprint artifact 1 on resource1 + BlueprintArtifact blueprintArtifact = buildFakeBuildprintArtifact(RESOURCE_INSTANCE_NAME_RESOURCE1, + INVARIANT_RESOURCE1_UUID, "example/sdc/blueprint-dcae/tca-guilin.yaml", "tca-guilin.yaml", + INVARIANT_SERVICE_UUID); + listResources.add(blueprintArtifact.getResourceAttached()); + blueprintMap.put(blueprintArtifact.getBlueprintArtifactName(), blueprintArtifact); + + // Build fake csarhandler + Mockito.when(csarHandler.getSdcNotification()).thenReturn(notificationData); + // Build fake csar Helper + ISdcCsarHelper csarHelper = Mockito.mock(ISdcCsarHelper.class); + Metadata data = Mockito.mock(Metadata.class); + Mockito.when(data.getValue("name")).thenReturn(generatedName); + Mockito.when(notificationData.getServiceName()).thenReturn(generatedName); + Mockito.when(csarHelper.getServiceMetadata()).thenReturn(data); + + // Create helper based on real csar to test policy yaml and global properties + // set + SdcToscaParserFactory factory = SdcToscaParserFactory.getInstance(); + String path = Thread.currentThread().getContextClassLoader().getResource(csarFileName).getFile(); + ISdcCsarHelper sdcHelper = factory.getSdcCsarHelper(path); + Mockito.when(csarHandler.getSdcCsarHelper()).thenReturn(sdcHelper); + + // Mockito.when(csarHandler.getSdcCsarHelper()).thenReturn(csarHelper); + Mockito.when(csarHandler.getPolicyModelYaml()) + .thenReturn(Optional.ofNullable(ResourceFileUtils.getResourceAsString("tosca/tosca_example.yaml"))); + return csarHandler; + } + private CsarHandler buildFakeCsarHandler(String generatedName, String csarFileName) throws IOException, SdcToscaParserException { // Create fake notification @@ -173,9 +216,8 @@ public class CsarInstallerItCase { Mockito.when(notificationData.getServiceArtifacts()).thenReturn(serviceArtifactsList); CsarHandler csarHandler = new CsarHandler(notificationData, "", ""); - csarHandler - .setFilePath(Thread.currentThread().getContextClassLoader().getResource(CSAR_ARTIFACT_NAME_CDS). - getFile()); + csarHandler.setFilePath(Thread.currentThread().getContextClassLoader().getResource(CSAR_ARTIFACT_NAME_CDS) + .getFile()); Assert.assertEquals(csarHandler.getPolicyModelYaml(), Optional .ofNullable(ResourceFileUtils.getResourceAsString("example/sdc/expected-result/policy-data.yaml"))); } @@ -203,14 +245,25 @@ public class CsarInstallerItCase { assertThat(csarInstaller.isCsarAlreadyDeployed(csarHandler)).isTrue(); } + @Test(expected = SdcArtifactInstallerException.class) + @Transactional + public void testInstallTheBadCsarTca() + throws IOException, SdcToscaParserException, InterruptedException, BlueprintParserException, + SdcArtifactInstallerException { + // This test validates that the blueprint is well rejected because the blueprint contains a link + // to a policy that does not exist on the policy engine emulator. + String generatedName = RandomStringUtils.randomAlphanumeric(5); + csarInstaller.installTheCsar(buildBadFakeCsarHandler(generatedName, CSAR_ARTIFACT_NAME_NO_CDS)); + } + @Test @Transactional @Commit public void testInstallTheCsarTca() throws SdcArtifactInstallerException, SdcToscaParserException, CsarHandlerException, IOException, JSONException, InterruptedException, BlueprintParserException { String generatedName = RandomStringUtils.randomAlphanumeric(5); - CsarHandler csar = buildFakeCsarHandler(generatedName, CSAR_ARTIFACT_NAME_CDS); - csarInstaller.installTheCsar(csar); + csarInstaller.installTheCsar(buildFakeCsarHandler(generatedName, CSAR_ARTIFACT_NAME_CDS)); + assertThat(serviceRepository.existsById("63cac700-ab9a-4115-a74f-7eac85e3fce0")).isTrue(); // We should have CDS info assertThat(serviceRepository.findById("63cac700-ab9a-4115-a74f-7eac85e3fce0").get().getResourceByType("VF") @@ -227,14 +280,15 @@ public class CsarInstallerItCase { LoopTemplate loopTemplate = loopTemplatesRepo.findById(LoopTemplate.generateLoopTemplateName(generatedName, "1.0", RESOURCE_INSTANCE_NAME_RESOURCE1, "tca.yaml")).get(); assertThat(loopTemplate.getLoopElementModelsUsed()).hasSize(1); - assertThat(loopTemplate.getModelService().getServiceUuid()).isEqualTo("63cac700-ab9a-4115-a74f-7eac85e3fce0"); + Assertions.assertThat(loopTemplate.getModelService().getServiceUuid()) + .isEqualTo("63cac700-ab9a-4115-a74f-7eac85e3fce0"); JSONAssert.assertEquals(ResourceFileUtils.getResourceAsString("tosca/model-properties.json"), JsonUtils.GSON_JPA_MODEL.toJson(loopTemplate.getModelService()), true); JSONAssert.assertEquals(ResourceFileUtils.getResourceAsString("tosca/service-details.json"), JsonUtils.GSON_JPA_MODEL.toJson(loopTemplate.getModelService().getServiceDetails()), true); JSONAssert.assertEquals(ResourceFileUtils.getResourceAsString("tosca/resource-details.json"), JsonUtils.GSON_JPA_MODEL.toJson(loopTemplate.getModelService().getResourceDetails()), true); - assertThat(((LoopTemplateLoopElementModel) (loopTemplate.getLoopElementModelsUsed().toArray()[0])) + Assertions.assertThat(((LoopTemplateLoopElementModel) (loopTemplate.getLoopElementModelsUsed().toArray()[0])) .getLoopElementModel().getName()).isNotEmpty(); loopTemplate = loopTemplatesRepo.findById(LoopTemplate.generateLoopTemplateName(generatedName, "1.0", diff --git a/src/test/java/org/onap/clamp/loop/DcaeComponentTest.java b/src/test/java/org/onap/policy/clamp/loop/DcaeComponentTest.java index 022d10eb2..c94937031 100644 --- a/src/test/java/org/onap/clamp/loop/DcaeComponentTest.java +++ b/src/test/java/org/onap/policy/clamp/loop/DcaeComponentTest.java @@ -21,7 +21,7 @@ * */ -package org.onap.clamp.loop; +package org.onap.policy.clamp.loop; import static org.assertj.core.api.Assertions.assertThat; @@ -34,13 +34,13 @@ import org.apache.camel.Message; import org.json.simple.parser.ParseException; import org.junit.Test; import org.mockito.Mockito; -import org.onap.clamp.clds.model.dcae.DcaeInventoryResponse; -import org.onap.clamp.clds.model.dcae.DcaeOperationStatusResponse; -import org.onap.clamp.loop.components.external.DcaeComponent; -import org.onap.clamp.loop.components.external.ExternalComponentState; -import org.onap.clamp.loop.template.LoopTemplate; -import org.onap.clamp.loop.template.PolicyModel; -import org.onap.clamp.policy.microservice.MicroServicePolicy; +import org.onap.policy.clamp.clds.model.dcae.DcaeInventoryResponse; +import org.onap.policy.clamp.clds.model.dcae.DcaeOperationStatusResponse; +import org.onap.policy.clamp.loop.components.external.DcaeComponent; +import org.onap.policy.clamp.loop.components.external.ExternalComponentState; +import org.onap.policy.clamp.loop.template.LoopTemplate; +import org.onap.policy.clamp.loop.template.PolicyModel; +import org.onap.policy.clamp.policy.microservice.MicroServicePolicy; public class DcaeComponentTest { diff --git a/src/test/java/org/onap/clamp/loop/DeployFlowTestItCase.java b/src/test/java/org/onap/policy/clamp/loop/DeployFlowTestItCase.java index 169db9db1..4d02b10dc 100644 --- a/src/test/java/org/onap/clamp/loop/DeployFlowTestItCase.java +++ b/src/test/java/org/onap/policy/clamp/loop/DeployFlowTestItCase.java @@ -21,7 +21,7 @@ * */ -package org.onap.clamp.loop; +package org.onap.policy.clamp.loop; import static org.assertj.core.api.Assertions.assertThat; @@ -36,11 +36,11 @@ import org.apache.camel.Exchange; import org.apache.camel.builder.ExchangeBuilder; import org.junit.Test; import org.junit.runner.RunWith; -import org.onap.clamp.clds.Application; -import org.onap.clamp.loop.template.LoopTemplate; -import org.onap.clamp.loop.template.PolicyModel; -import org.onap.clamp.loop.template.PolicyModelsService; -import org.onap.clamp.policy.microservice.MicroServicePolicy; +import org.onap.policy.clamp.clds.Application; +import org.onap.policy.clamp.loop.template.LoopTemplate; +import org.onap.policy.clamp.loop.template.PolicyModel; +import org.onap.policy.clamp.loop.template.PolicyModelsService; +import org.onap.policy.clamp.policy.microservice.MicroServicePolicy; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; diff --git a/src/test/java/org/onap/clamp/loop/ExternalComponentStateTest.java b/src/test/java/org/onap/policy/clamp/loop/ExternalComponentStateTest.java index 34fcc077f..a73b2784b 100644 --- a/src/test/java/org/onap/clamp/loop/ExternalComponentStateTest.java +++ b/src/test/java/org/onap/policy/clamp/loop/ExternalComponentStateTest.java @@ -21,12 +21,12 @@ * */ -package org.onap.clamp.loop; +package org.onap.policy.clamp.loop; import static org.assertj.core.api.Assertions.assertThat; import org.junit.Test; -import org.onap.clamp.loop.components.external.ExternalComponentState; +import org.onap.policy.clamp.loop.components.external.ExternalComponentState; public class ExternalComponentStateTest { private ExternalComponentState state = new ExternalComponentState("NOT_SENT", diff --git a/src/test/java/org/onap/clamp/loop/LoopControllerTestItCase.java b/src/test/java/org/onap/policy/clamp/loop/LoopControllerTestItCase.java index f170bc6df..6728d292c 100644 --- a/src/test/java/org/onap/clamp/loop/LoopControllerTestItCase.java +++ b/src/test/java/org/onap/policy/clamp/loop/LoopControllerTestItCase.java @@ -22,7 +22,7 @@ * */ -package org.onap.clamp.loop; +package org.onap.policy.clamp.loop; import static org.assertj.core.api.Assertions.assertThat; @@ -33,18 +33,19 @@ import com.google.gson.JsonParser; import java.io.IOException; import java.util.Set; import javax.transaction.Transactional; +import org.assertj.core.api.Assertions; import org.junit.Test; import org.junit.runner.RunWith; -import org.onap.clamp.clds.Application; -import org.onap.clamp.clds.util.JsonUtils; -import org.onap.clamp.loop.service.Service; -import org.onap.clamp.loop.template.LoopTemplate; -import org.onap.clamp.loop.template.PolicyModel; -import org.onap.clamp.loop.template.PolicyModelsService; -import org.onap.clamp.policy.microservice.MicroServicePolicy; -import org.onap.clamp.policy.microservice.MicroServicePolicyService; -import org.onap.clamp.policy.operational.OperationalPolicy; -import org.onap.clamp.policy.operational.OperationalPolicyService; +import org.onap.policy.clamp.clds.Application; +import org.onap.policy.clamp.clds.util.JsonUtils; +import org.onap.policy.clamp.loop.service.Service; +import org.onap.policy.clamp.loop.template.LoopTemplate; +import org.onap.policy.clamp.loop.template.PolicyModel; +import org.onap.policy.clamp.loop.template.PolicyModelsService; +import org.onap.policy.clamp.policy.microservice.MicroServicePolicy; +import org.onap.policy.clamp.policy.microservice.MicroServicePolicyService; +import org.onap.policy.clamp.policy.operational.OperationalPolicy; +import org.onap.policy.clamp.policy.operational.OperationalPolicyService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @@ -163,8 +164,8 @@ public class LoopControllerTestItCase { assertThat(opPolicyList.size()).isEqualTo(1); for (OperationalPolicy policy : opPolicyList) { assertThat(policy.getName().contains("OPERATIONAL_serviceName")).isTrue(); - assertThat(policy.getPolicyModel().getPolicyModelType()).isEqualTo("testPolicyModel"); - assertThat(policy.getPolicyModel().getVersion()).isEqualTo("1.0.0"); + Assertions.assertThat(policy.getPolicyModel().getPolicyModelType()).isEqualTo("testPolicyModel"); + Assertions.assertThat(policy.getPolicyModel().getVersion()).isEqualTo("1.0.0"); } loopController.removeOperationalPolicy(EXAMPLE_LOOP_NAME, "testPolicyModel", "1.0.0"); diff --git a/src/test/java/org/onap/clamp/loop/LoopLogServiceTestItCase.java b/src/test/java/org/onap/policy/clamp/loop/LoopLogServiceTestItCase.java index ddab7b659..7b0ab8614 100644 --- a/src/test/java/org/onap/clamp/loop/LoopLogServiceTestItCase.java +++ b/src/test/java/org/onap/policy/clamp/loop/LoopLogServiceTestItCase.java @@ -20,20 +20,21 @@ * */ -package org.onap.clamp.loop; +package org.onap.policy.clamp.loop; import static org.assertj.core.api.Assertions.assertThat; import com.google.gson.JsonObject; import java.util.Set; import javax.transaction.Transactional; +import org.assertj.core.api.Assertions; import org.junit.Test; import org.junit.runner.RunWith; -import org.onap.clamp.clds.Application; -import org.onap.clamp.clds.util.JsonUtils; -import org.onap.clamp.loop.log.LogType; -import org.onap.clamp.loop.log.LoopLog; -import org.onap.clamp.loop.log.LoopLogService; +import org.onap.policy.clamp.clds.Application; +import org.onap.policy.clamp.clds.util.JsonUtils; +import org.onap.policy.clamp.loop.log.LogType; +import org.onap.policy.clamp.loop.log.LoopLog; +import org.onap.policy.clamp.loop.log.LoopLogService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @@ -90,6 +91,6 @@ public class LoopLogServiceTestItCase { assertThat(log.getLogType()).isEqualTo(LogType.INFO); assertThat(log.getLogComponent()).isEqualTo(CLAMP_COMPONENT); assertThat(log.getId()).isEqualTo(id); - assertThat(log.getLoop()).isEqualTo(testLoop); + Assertions.assertThat(log.getLoop()).isEqualTo(testLoop); } }
\ No newline at end of file diff --git a/src/test/java/org/onap/clamp/loop/LoopRepositoriesItCase.java b/src/test/java/org/onap/policy/clamp/loop/LoopRepositoriesItCase.java index 9815575cc..e18dd2475 100644 --- a/src/test/java/org/onap/clamp/loop/LoopRepositoriesItCase.java +++ b/src/test/java/org/onap/policy/clamp/loop/LoopRepositoriesItCase.java @@ -23,7 +23,7 @@ * */ -package org.onap.clamp.loop; +package org.onap.policy.clamp.loop; import static org.assertj.core.api.Assertions.assertThat; @@ -31,25 +31,26 @@ import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.JsonObject; import java.time.Instant; +import org.assertj.core.api.Assertions; import org.junit.Test; import org.junit.runner.RunWith; -import org.onap.clamp.clds.Application; -import org.onap.clamp.loop.log.LogType; -import org.onap.clamp.loop.log.LoopLog; -import org.onap.clamp.loop.log.LoopLogRepository; -import org.onap.clamp.loop.service.Service; -import org.onap.clamp.loop.service.ServicesRepository; -import org.onap.clamp.loop.template.LoopElementModel; -import org.onap.clamp.loop.template.LoopElementModelsRepository; -import org.onap.clamp.loop.template.LoopTemplate; -import org.onap.clamp.loop.template.LoopTemplatesRepository; -import org.onap.clamp.loop.template.PolicyModel; -import org.onap.clamp.loop.template.PolicyModelId; -import org.onap.clamp.loop.template.PolicyModelsRepository; -import org.onap.clamp.policy.microservice.MicroServicePolicy; -import org.onap.clamp.policy.microservice.MicroServicePolicyService; -import org.onap.clamp.policy.operational.OperationalPolicy; -import org.onap.clamp.policy.operational.OperationalPolicyService; +import org.onap.policy.clamp.clds.Application; +import org.onap.policy.clamp.loop.log.LogType; +import org.onap.policy.clamp.loop.log.LoopLog; +import org.onap.policy.clamp.loop.log.LoopLogRepository; +import org.onap.policy.clamp.loop.service.Service; +import org.onap.policy.clamp.loop.service.ServicesRepository; +import org.onap.policy.clamp.loop.template.LoopElementModel; +import org.onap.policy.clamp.loop.template.LoopElementModelsRepository; +import org.onap.policy.clamp.loop.template.LoopTemplate; +import org.onap.policy.clamp.loop.template.LoopTemplatesRepository; +import org.onap.policy.clamp.loop.template.PolicyModel; +import org.onap.policy.clamp.loop.template.PolicyModelId; +import org.onap.policy.clamp.loop.template.PolicyModelsRepository; +import org.onap.policy.clamp.policy.microservice.MicroServicePolicy; +import org.onap.policy.clamp.policy.microservice.MicroServicePolicyService; +import org.onap.policy.clamp.policy.operational.OperationalPolicy; +import org.onap.policy.clamp.policy.operational.OperationalPolicyService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @@ -201,13 +202,17 @@ public class LoopRepositoriesItCase { assertThat((LoopLog) loopInDbRetrieved.getLoopLogs().toArray()[0]).isEqualToComparingFieldByField(loopLog); assertThat((OperationalPolicy) loopInDbRetrieved.getOperationalPolicies().toArray()[0]) .isEqualToIgnoringGivenFields(opPolicy, "createdDate", "updatedDate", "createdBy", "updatedBy"); - assertThat(((OperationalPolicy) loopInDbRetrieved.getOperationalPolicies().toArray()[0]).getCreatedDate()) + Assertions.assertThat( + ((OperationalPolicy) loopInDbRetrieved.getOperationalPolicies().toArray()[0]).getCreatedDate()) .isNotNull(); - assertThat(((OperationalPolicy) loopInDbRetrieved.getOperationalPolicies().toArray()[0]).getUpdatedDate()) + Assertions.assertThat( + ((OperationalPolicy) loopInDbRetrieved.getOperationalPolicies().toArray()[0]).getUpdatedDate()) .isNotNull(); - assertThat(((OperationalPolicy) loopInDbRetrieved.getOperationalPolicies().toArray()[0]).getCreatedBy()) + Assertions.assertThat( + ((OperationalPolicy) loopInDbRetrieved.getOperationalPolicies().toArray()[0]).getCreatedBy()) .isNotNull(); - assertThat(((OperationalPolicy) loopInDbRetrieved.getOperationalPolicies().toArray()[0]).getUpdatedBy()) + Assertions.assertThat( + ((OperationalPolicy) loopInDbRetrieved.getOperationalPolicies().toArray()[0]).getUpdatedBy()) .isNotNull(); assertThat((MicroServicePolicy) loopInDbRetrieved.getMicroServicePolicies().toArray()[0]) diff --git a/src/test/java/org/onap/clamp/loop/LoopServiceTestItCase.java b/src/test/java/org/onap/policy/clamp/loop/LoopServiceTestItCase.java index 15cf59f38..010c4978a 100644 --- a/src/test/java/org/onap/clamp/loop/LoopServiceTestItCase.java +++ b/src/test/java/org/onap/policy/clamp/loop/LoopServiceTestItCase.java @@ -21,7 +21,7 @@ * */ -package org.onap.clamp.loop; +package org.onap.policy.clamp.loop; import static org.assertj.core.api.Assertions.assertThat; @@ -29,21 +29,22 @@ import com.google.gson.JsonObject; import java.util.Set; import java.util.stream.Collectors; import javax.transaction.Transactional; +import org.assertj.core.api.Assertions; import org.assertj.core.util.Lists; import org.junit.Test; import org.junit.runner.RunWith; -import org.onap.clamp.clds.Application; -import org.onap.clamp.clds.util.JsonUtils; -import org.onap.clamp.loop.log.LogType; -import org.onap.clamp.loop.log.LoopLog; -import org.onap.clamp.loop.log.LoopLogService; -import org.onap.clamp.loop.template.LoopTemplate; -import org.onap.clamp.loop.template.PolicyModel; -import org.onap.clamp.loop.template.PolicyModelsService; -import org.onap.clamp.policy.microservice.MicroServicePolicy; -import org.onap.clamp.policy.microservice.MicroServicePolicyService; -import org.onap.clamp.policy.operational.OperationalPolicy; -import org.onap.clamp.policy.operational.OperationalPolicyService; +import org.onap.policy.clamp.clds.Application; +import org.onap.policy.clamp.clds.util.JsonUtils; +import org.onap.policy.clamp.loop.log.LogType; +import org.onap.policy.clamp.loop.log.LoopLog; +import org.onap.policy.clamp.loop.log.LoopLogService; +import org.onap.policy.clamp.loop.template.LoopTemplate; +import org.onap.policy.clamp.loop.template.PolicyModel; +import org.onap.policy.clamp.loop.template.PolicyModelsService; +import org.onap.policy.clamp.policy.microservice.MicroServicePolicy; +import org.onap.policy.clamp.policy.microservice.MicroServicePolicyService; +import org.onap.policy.clamp.policy.operational.OperationalPolicy; +import org.onap.policy.clamp.policy.operational.OperationalPolicyService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @@ -114,7 +115,7 @@ public class LoopServiceTestItCase { .usingElementComparatorIgnoringFields("loop", "createdBy", "createdDate", "updatedBy", "updatedDate") .contains(operationalPolicy); OperationalPolicy savedPolicy = savedPolicies.iterator().next(); - assertThat(savedPolicy.getLoop().getName()).isEqualTo(EXAMPLE_LOOP_NAME); + Assertions.assertThat(savedPolicy.getLoop().getName()).isEqualTo(EXAMPLE_LOOP_NAME); } @@ -280,7 +281,7 @@ public class LoopServiceTestItCase { .usingElementComparatorIgnoringFields("loop", "createdDate", "updatedDate", "createdBy", "updatedBy") .containsExactly(secondOperationalPolicy); OperationalPolicy savedPolicy = savedPolicies.iterator().next(); - assertThat(savedPolicy.getLoop().getName()).isEqualTo(EXAMPLE_LOOP_NAME); + Assertions.assertThat(savedPolicy.getLoop().getName()).isEqualTo(EXAMPLE_LOOP_NAME); } diff --git a/src/test/java/org/onap/clamp/loop/LoopTemplateLoopElementModelTest.java b/src/test/java/org/onap/policy/clamp/loop/LoopTemplateLoopElementModelTest.java index 70ff9b118..9dcd71ef1 100644 --- a/src/test/java/org/onap/clamp/loop/LoopTemplateLoopElementModelTest.java +++ b/src/test/java/org/onap/policy/clamp/loop/LoopTemplateLoopElementModelTest.java @@ -23,15 +23,15 @@ * */ -package org.onap.clamp.loop; +package org.onap.policy.clamp.loop; import static org.assertj.core.api.Assertions.assertThat; import org.junit.Test; -import org.onap.clamp.loop.template.LoopElementModel; -import org.onap.clamp.loop.template.LoopTemplate; -import org.onap.clamp.loop.template.LoopTemplateLoopElementModel; -import org.onap.clamp.loop.template.PolicyModel; +import org.onap.policy.clamp.loop.template.LoopElementModel; +import org.onap.policy.clamp.loop.template.LoopTemplate; +import org.onap.policy.clamp.loop.template.LoopTemplateLoopElementModel; +import org.onap.policy.clamp.loop.template.PolicyModel; public class LoopTemplateLoopElementModelTest { diff --git a/src/test/java/org/onap/clamp/loop/LoopTemplatesServiceItCase.java b/src/test/java/org/onap/policy/clamp/loop/LoopTemplatesServiceItCase.java index b8b1144f6..d608075fc 100644 --- a/src/test/java/org/onap/clamp/loop/LoopTemplatesServiceItCase.java +++ b/src/test/java/org/onap/policy/clamp/loop/LoopTemplatesServiceItCase.java @@ -21,7 +21,7 @@ *
*/
-package org.onap.clamp.loop;
+package org.onap.policy.clamp.loop;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertNotNull;
@@ -33,13 +33,13 @@ import java.util.SortedSet; import javax.transaction.Transactional;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.onap.clamp.clds.Application;
-import org.onap.clamp.loop.template.LoopElementModel;
-import org.onap.clamp.loop.template.LoopTemplate;
-import org.onap.clamp.loop.template.LoopTemplateLoopElementModel;
-import org.onap.clamp.loop.template.LoopTemplatesService;
-import org.onap.clamp.loop.template.LoopType;
-import org.onap.clamp.loop.template.PolicyModel;
+import org.onap.policy.clamp.clds.Application;
+import org.onap.policy.clamp.loop.template.LoopElementModel;
+import org.onap.policy.clamp.loop.template.LoopTemplate;
+import org.onap.policy.clamp.loop.template.LoopTemplateLoopElementModel;
+import org.onap.policy.clamp.loop.template.LoopTemplatesService;
+import org.onap.policy.clamp.loop.template.LoopType;
+import org.onap.policy.clamp.loop.template.PolicyModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
diff --git a/src/test/java/org/onap/clamp/loop/LoopToJsonTest.java b/src/test/java/org/onap/policy/clamp/loop/LoopToJsonTest.java index 1d6940f83..0fc4b0b5c 100644 --- a/src/test/java/org/onap/clamp/loop/LoopToJsonTest.java +++ b/src/test/java/org/onap/policy/clamp/loop/LoopToJsonTest.java @@ -23,10 +23,11 @@ * */ -package org.onap.clamp.loop; +package org.onap.policy.clamp.loop; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.Assert.assertNotNull; + import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.JsonObject; @@ -34,16 +35,16 @@ import com.google.gson.JsonSyntaxException; import java.io.IOException; import java.util.Random; import org.junit.Test; -import org.onap.clamp.clds.util.JsonUtils; -import org.onap.clamp.clds.util.ResourceFileUtils; -import org.onap.clamp.loop.log.LogType; -import org.onap.clamp.loop.log.LoopLog; -import org.onap.clamp.loop.service.Service; -import org.onap.clamp.loop.template.LoopElementModel; -import org.onap.clamp.loop.template.LoopTemplate; -import org.onap.clamp.loop.template.PolicyModel; -import org.onap.clamp.policy.microservice.MicroServicePolicy; -import org.onap.clamp.policy.operational.OperationalPolicy; +import org.onap.policy.clamp.clds.util.JsonUtils; +import org.onap.policy.clamp.clds.util.ResourceFileUtils; +import org.onap.policy.clamp.loop.log.LogType; +import org.onap.policy.clamp.loop.log.LoopLog; +import org.onap.policy.clamp.loop.service.Service; +import org.onap.policy.clamp.loop.template.LoopElementModel; +import org.onap.policy.clamp.loop.template.LoopTemplate; +import org.onap.policy.clamp.loop.template.PolicyModel; +import org.onap.policy.clamp.policy.microservice.MicroServicePolicy; +import org.onap.policy.clamp.policy.operational.OperationalPolicy; public class LoopToJsonTest { diff --git a/src/test/java/org/onap/clamp/loop/PolicyComponentTest.java b/src/test/java/org/onap/policy/clamp/loop/PolicyComponentTest.java index 4d2bfe280..ea8785855 100644 --- a/src/test/java/org/onap/clamp/loop/PolicyComponentTest.java +++ b/src/test/java/org/onap/policy/clamp/loop/PolicyComponentTest.java @@ -21,7 +21,9 @@ * */ -package org.onap.clamp.loop; +package org.onap.policy.clamp.loop; + +import static org.assertj.core.api.Assertions.assertThat; import com.google.gson.Gson; import com.google.gson.JsonObject; @@ -30,15 +32,13 @@ import org.apache.camel.Exchange; import org.apache.camel.Message; import org.junit.Test; import org.mockito.Mockito; -import org.onap.clamp.clds.util.ResourceFileUtils; -import org.onap.clamp.loop.components.external.ExternalComponentState; -import org.onap.clamp.loop.components.external.PolicyComponent; -import org.onap.clamp.loop.template.LoopTemplate; -import org.onap.clamp.loop.template.PolicyModel; -import org.onap.clamp.policy.microservice.MicroServicePolicy; -import org.onap.clamp.policy.operational.OperationalPolicy; - -import static org.assertj.core.api.Assertions.assertThat; +import org.onap.policy.clamp.clds.util.ResourceFileUtils; +import org.onap.policy.clamp.loop.components.external.ExternalComponentState; +import org.onap.policy.clamp.loop.components.external.PolicyComponent; +import org.onap.policy.clamp.loop.template.LoopTemplate; +import org.onap.policy.clamp.loop.template.PolicyModel; +import org.onap.policy.clamp.policy.microservice.MicroServicePolicy; +import org.onap.policy.clamp.policy.operational.OperationalPolicy; public class PolicyComponentTest { diff --git a/src/test/java/org/onap/clamp/loop/PolicyModelServiceItCase.java b/src/test/java/org/onap/policy/clamp/loop/PolicyModelServiceItCase.java index 6f6cad815..e7df80cd8 100644 --- a/src/test/java/org/onap/clamp/loop/PolicyModelServiceItCase.java +++ b/src/test/java/org/onap/policy/clamp/loop/PolicyModelServiceItCase.java @@ -21,7 +21,7 @@ * */ -package org.onap.clamp.loop; +package org.onap.policy.clamp.loop; import static org.assertj.core.api.Assertions.assertThat; @@ -33,18 +33,19 @@ import java.util.SortedSet; import java.util.TreeSet; import java.util.stream.Collectors; import javax.transaction.Transactional; +import org.assertj.core.api.Assertions; import org.junit.Test; import org.junit.runner.RunWith; -import org.onap.clamp.clds.Application; -import org.onap.clamp.clds.util.JsonUtils; -import org.onap.clamp.clds.util.ResourceFileUtils; -import org.onap.clamp.loop.template.PolicyModel; -import org.onap.clamp.loop.template.PolicyModelId; -import org.onap.clamp.loop.template.PolicyModelsRepository; -import org.onap.clamp.loop.template.PolicyModelsService; -import org.onap.clamp.policy.pdpgroup.PdpGroup; -import org.onap.clamp.policy.pdpgroup.PdpSubgroup; -import org.onap.clamp.policy.pdpgroup.PolicyModelKey; +import org.onap.policy.clamp.clds.Application; +import org.onap.policy.clamp.clds.util.JsonUtils; +import org.onap.policy.clamp.clds.util.ResourceFileUtils; +import org.onap.policy.clamp.loop.template.PolicyModel; +import org.onap.policy.clamp.loop.template.PolicyModelId; +import org.onap.policy.clamp.loop.template.PolicyModelsRepository; +import org.onap.policy.clamp.loop.template.PolicyModelsService; +import org.onap.policy.clamp.policy.pdpgroup.PdpGroup; +import org.onap.policy.clamp.policy.pdpgroup.PdpSubgroup; +import org.onap.policy.clamp.policy.pdpgroup.PolicyModelKey; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @@ -69,7 +70,7 @@ public class PolicyModelServiceItCase { private static final String POLICY_MODEL_TYPE_2_VERSION_2 = "2.0.0"; private PolicyModel getPolicyModel(String policyType, String policyModelTosca, String version, - String policyAcronym, String policyVariant, String createdBy) { + String policyAcronym, String policyVariant, String createdBy) { PolicyModel policyModel = new PolicyModel(); policyModel.setCreatedBy(createdBy); policyModel.setPolicyAcronym(policyAcronym); @@ -101,13 +102,13 @@ public class PolicyModelServiceItCase { .get()); assertThat(actualPolicyModel.getPolicyModelType()) .isEqualTo(policyModel.getPolicyModelType()); - assertThat(actualPolicyModel.getCreatedBy()).isEqualTo("Not found"); - assertThat(actualPolicyModel.getCreatedDate()).isNotNull(); + Assertions.assertThat(actualPolicyModel.getCreatedBy()).isEqualTo("Not found"); + Assertions.assertThat(actualPolicyModel.getCreatedDate()).isNotNull(); assertThat(actualPolicyModel.getPolicyAcronym()).isEqualTo(policyModel.getPolicyAcronym()); assertThat(actualPolicyModel.getPolicyModelTosca()) .isEqualTo(policyModel.getPolicyModelTosca()); - assertThat(actualPolicyModel.getUpdatedBy()).isEqualTo("Not found"); - assertThat(actualPolicyModel.getUpdatedDate()).isNotNull(); + Assertions.assertThat(actualPolicyModel.getUpdatedBy()).isEqualTo("Not found"); + Assertions.assertThat(actualPolicyModel.getUpdatedDate()).isNotNull(); assertThat(actualPolicyModel.getVersion()).isEqualTo(policyModel.getVersion()); assertThat( diff --git a/src/test/java/org/onap/clamp/loop/ServiceTest.java b/src/test/java/org/onap/policy/clamp/loop/ServiceTest.java index 2b6fab8b6..8f28299fd 100644 --- a/src/test/java/org/onap/clamp/loop/ServiceTest.java +++ b/src/test/java/org/onap/policy/clamp/loop/ServiceTest.java @@ -21,15 +21,14 @@ * */ -package org.onap.clamp.loop; +package org.onap.policy.clamp.loop; import static org.assertj.core.api.Assertions.assertThat; import com.google.gson.JsonObject; - import org.junit.Test; -import org.onap.clamp.clds.util.JsonUtils; -import org.onap.clamp.loop.service.Service; +import org.onap.policy.clamp.clds.util.JsonUtils; +import org.onap.policy.clamp.loop.service.Service; public class ServiceTest { @@ -40,7 +39,7 @@ public class ServiceTest { String serviceStr3 = "{\"name\": \"vLoadBalancerMS\",\"UUID\": \"63cac700-ab9a-4115-a74f-7eac85e3fc11\"}"; String resourceStr = "{\"CP\": {}}"; - Service service1 = new Service(JsonUtils.GSON.fromJson(serviceStr1, JsonObject.class), + Service service1 = new Service(JsonUtils.GSON.fromJson(serviceStr1, JsonObject.class), JsonUtils.GSON.fromJson(resourceStr, JsonObject.class), "1.0"); Service service2 = new Service(JsonUtils.GSON.fromJson(serviceStr2, JsonObject.class), null, "1.0"); diff --git a/src/test/java/org/onap/clamp/loop/deploy/BlueprintInputParametersTest.java b/src/test/java/org/onap/policy/clamp/loop/deploy/BlueprintInputParametersTest.java index 8a5b5876f..f7f6baa0c 100644 --- a/src/test/java/org/onap/clamp/loop/deploy/BlueprintInputParametersTest.java +++ b/src/test/java/org/onap/policy/clamp/loop/deploy/BlueprintInputParametersTest.java @@ -24,7 +24,7 @@ * */ -package org.onap.clamp.loop.deploy; +package org.onap.policy.clamp.loop.deploy; import com.google.gson.JsonObject; import java.io.IOException; @@ -32,12 +32,12 @@ import java.util.LinkedHashSet; import org.junit.Assert; import org.junit.Test; import org.mockito.Mockito; -import org.onap.clamp.clds.util.JsonUtils; -import org.onap.clamp.clds.util.ResourceFileUtils; -import org.onap.clamp.loop.Loop; -import org.onap.clamp.loop.template.LoopElementModel; -import org.onap.clamp.loop.template.LoopTemplate; -import org.onap.clamp.policy.microservice.MicroServicePolicy; +import org.onap.policy.clamp.clds.util.JsonUtils; +import org.onap.policy.clamp.clds.util.ResourceFileUtils; +import org.onap.policy.clamp.loop.Loop; +import org.onap.policy.clamp.loop.template.LoopElementModel; +import org.onap.policy.clamp.loop.template.LoopTemplate; +import org.onap.policy.clamp.policy.microservice.MicroServicePolicy; import org.onap.sdc.tosca.parser.exceptions.SdcToscaParserException; public class BlueprintInputParametersTest { diff --git a/src/test/java/org/onap/clamp/policy/downloader/PolicyEngineControllerTestItCase.java b/src/test/java/org/onap/policy/clamp/policy/downloader/PolicyEngineControllerTestItCase.java index 51b93767f..657adf1d1 100644 --- a/src/test/java/org/onap/clamp/policy/downloader/PolicyEngineControllerTestItCase.java +++ b/src/test/java/org/onap/policy/clamp/policy/downloader/PolicyEngineControllerTestItCase.java @@ -1,4 +1,4 @@ -package org.onap.clamp.policy.downloader; +package org.onap.policy.clamp.policy.downloader; /*- * ============LICENSE_START======================================================= * ONAP CLAMP @@ -33,11 +33,11 @@ import javax.transaction.Transactional; import org.json.simple.parser.ParseException; import org.junit.Test; import org.junit.runner.RunWith; -import org.onap.clamp.clds.Application; -import org.onap.clamp.clds.util.JsonUtils; -import org.onap.clamp.loop.template.PolicyModel; -import org.onap.clamp.loop.template.PolicyModelId; -import org.onap.clamp.loop.template.PolicyModelsRepository; +import org.onap.policy.clamp.clds.Application; +import org.onap.policy.clamp.clds.util.JsonUtils; +import org.onap.policy.clamp.loop.template.PolicyModel; +import org.onap.policy.clamp.loop.template.PolicyModelId; +import org.onap.policy.clamp.loop.template.PolicyModelsRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.ActiveProfiles; @@ -45,7 +45,7 @@ import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest(classes = Application.class) -@ActiveProfiles({"clamp-default","clamp-policy-controller"}) +@ActiveProfiles({"clamp-default", "clamp-policy-controller"}) public class PolicyEngineControllerTestItCase { @Autowired diff --git a/src/test/java/org/onap/clamp/policy/microservice/MicroServicePayloadTest.java b/src/test/java/org/onap/policy/clamp/policy/microservice/MicroServicePayloadTest.java index 0bfb6ece0..4bb850c35 100644 --- a/src/test/java/org/onap/clamp/policy/microservice/MicroServicePayloadTest.java +++ b/src/test/java/org/onap/policy/clamp/policy/microservice/MicroServicePayloadTest.java @@ -21,14 +21,14 @@ * */ -package org.onap.clamp.policy.microservice; +package org.onap.policy.clamp.policy.microservice; import com.google.gson.JsonObject; import java.io.IOException; import org.junit.Test; -import org.onap.clamp.clds.util.JsonUtils; -import org.onap.clamp.clds.util.ResourceFileUtils; -import org.onap.clamp.loop.template.PolicyModel; +import org.onap.policy.clamp.clds.util.JsonUtils; +import org.onap.policy.clamp.clds.util.ResourceFileUtils; +import org.onap.policy.clamp.loop.template.PolicyModel; import org.skyscreamer.jsonassert.JSONAssert; public class MicroServicePayloadTest { @@ -37,10 +37,11 @@ public class MicroServicePayloadTest { public void testPayloadConstruction() throws IOException { MicroServicePolicy policy = new MicroServicePolicy("testPolicy", new PolicyModel( "onap.policies.monitoring.cdap.tca.hi.lo.app", - ResourceFileUtils.getResourceAsString("tosca/tosca_example.yaml"),"1.0.0"), false,null,null, null,null); + ResourceFileUtils.getResourceAsString("tosca/tosca_example.yaml"), "1.0.0"), false, null, null, null, + null); policy.setConfigurationsJson(JsonUtils.GSON.fromJson( - ResourceFileUtils.getResourceAsString("tosca/micro-service-policy-properties.json"), JsonObject.class)); + ResourceFileUtils.getResourceAsString("tosca/micro-service-policy-properties.json"), JsonObject.class)); JSONAssert.assertEquals(ResourceFileUtils.getResourceAsString("tosca/micro-service-policy-payload.json"), - policy.createPolicyPayload(), false); + policy.createPolicyPayload(), false); } } diff --git a/src/test/java/org/onap/clamp/policy/operational/OperationalPolicyRepresentationBuilderTest.java b/src/test/java/org/onap/policy/clamp/policy/operational/OperationalPolicyRepresentationBuilderTest.java index 322548bb4..136430c8f 100644 --- a/src/test/java/org/onap/clamp/policy/operational/OperationalPolicyRepresentationBuilderTest.java +++ b/src/test/java/org/onap/policy/clamp/policy/operational/OperationalPolicyRepresentationBuilderTest.java @@ -21,7 +21,7 @@ * */ -package org.onap.clamp.policy.operational; +package org.onap.policy.clamp.policy.operational; import static org.assertj.core.api.Assertions.assertThat; @@ -29,8 +29,8 @@ import com.google.gson.GsonBuilder; import com.google.gson.JsonObject; import java.io.IOException; import org.junit.Test; -import org.onap.clamp.clds.util.ResourceFileUtils; -import org.onap.clamp.loop.service.Service; +import org.onap.policy.clamp.clds.util.ResourceFileUtils; +import org.onap.policy.clamp.loop.service.Service; import org.skyscreamer.jsonassert.JSONAssert; public class OperationalPolicyRepresentationBuilderTest { diff --git a/src/test/java/org/onap/clamp/policy/pdpgroup/PdpGroupTest.java b/src/test/java/org/onap/policy/clamp/policy/pdpgroup/PdpGroupTest.java index b6f7c5491..699693de0 100644 --- a/src/test/java/org/onap/clamp/policy/pdpgroup/PdpGroupTest.java +++ b/src/test/java/org/onap/policy/clamp/policy/pdpgroup/PdpGroupTest.java @@ -21,17 +21,15 @@ * */ -package org.onap.clamp.policy.pdpgroup; +package org.onap.policy.clamp.policy.pdpgroup; import static org.assertj.core.api.Assertions.assertThat; import com.google.gson.JsonArray; import com.google.gson.JsonObject; - import java.io.IOException; import java.util.LinkedList; import java.util.List; - import org.junit.Test; public class PdpGroupTest { diff --git a/src/test/java/org/onap/clamp/policy/pdpgroup/PolicyModelKeyTest.java b/src/test/java/org/onap/policy/clamp/policy/pdpgroup/PolicyModelKeyTest.java index 413ce60ab..d4cf27392 100644 --- a/src/test/java/org/onap/clamp/policy/pdpgroup/PolicyModelKeyTest.java +++ b/src/test/java/org/onap/policy/clamp/policy/pdpgroup/PolicyModelKeyTest.java @@ -21,7 +21,7 @@ * */ -package org.onap.clamp.policy.pdpgroup; +package org.onap.policy.clamp.policy.pdpgroup; import static org.assertj.core.api.Assertions.assertThat; @@ -32,9 +32,9 @@ public class PolicyModelKeyTest { @Test public void testEqualsMethod() throws IOException { - PolicyModelKey key1 = new PolicyModelKey("name1","1.0.0"); - PolicyModelKey key2 = new PolicyModelKey(null,"1.0.0"); - PolicyModelKey key3 = new PolicyModelKey("name1",null); + PolicyModelKey key1 = new PolicyModelKey("name1", "1.0.0"); + PolicyModelKey key2 = new PolicyModelKey(null, "1.0.0"); + PolicyModelKey key3 = new PolicyModelKey("name1", null); assertThat(key1.equals(null)).isFalse(); assertThat(key1.equals("key2")).isFalse(); @@ -42,13 +42,13 @@ public class PolicyModelKeyTest { assertThat(key2.equals(key1)).isFalse(); assertThat(key3.equals(key1)).isFalse(); - PolicyModelKey key4 = new PolicyModelKey("name2","1.0.0"); - PolicyModelKey key5 = new PolicyModelKey("name1","2.0.0"); + PolicyModelKey key4 = new PolicyModelKey("name2", "1.0.0"); + PolicyModelKey key5 = new PolicyModelKey("name1", "2.0.0"); assertThat(key1.equals(key4)).isFalse(); assertThat(key1.equals(key5)).isFalse(); - PolicyModelKey key6 = new PolicyModelKey("name(.*)","1.0.0"); - PolicyModelKey key7 = new PolicyModelKey("name1","1.0.0"); + PolicyModelKey key6 = new PolicyModelKey("name(.*)", "1.0.0"); + PolicyModelKey key7 = new PolicyModelKey("name1", "1.0.0"); assertThat(key1.equals(key6)).isTrue(); assertThat(key1.equals(key7)).isTrue(); } diff --git a/src/test/java/org/onap/clamp/tosca/DictionaryServiceItCase.java b/src/test/java/org/onap/policy/clamp/tosca/DictionaryServiceItCase.java index 55d347ceb..fdde53a21 100644 --- a/src/test/java/org/onap/clamp/tosca/DictionaryServiceItCase.java +++ b/src/test/java/org/onap/policy/clamp/tosca/DictionaryServiceItCase.java @@ -21,7 +21,7 @@ * */ -package org.onap.clamp.tosca; +package org.onap.policy.clamp.tosca; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.Assert.assertNotNull; @@ -32,7 +32,7 @@ import javax.persistence.EntityNotFoundException; import javax.transaction.Transactional; import org.junit.Test; import org.junit.runner.RunWith; -import org.onap.clamp.clds.Application; +import org.onap.policy.clamp.clds.Application; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; diff --git a/src/test/java/org/onap/clamp/util/PassDecoderTest.java b/src/test/java/org/onap/policy/clamp/util/PassDecoderTest.java index e5de8b0a8..83e894130 100644 --- a/src/test/java/org/onap/clamp/util/PassDecoderTest.java +++ b/src/test/java/org/onap/policy/clamp/util/PassDecoderTest.java @@ -21,7 +21,7 @@ * */ -package org.onap.clamp.util; +package org.onap.policy.clamp.util; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; diff --git a/src/test/java/org/onap/clamp/util/SemanticVersioningTest.java b/src/test/java/org/onap/policy/clamp/util/SemanticVersioningTest.java index 88f2bbe1b..604ce55db 100644 --- a/src/test/java/org/onap/clamp/util/SemanticVersioningTest.java +++ b/src/test/java/org/onap/policy/clamp/util/SemanticVersioningTest.java @@ -21,7 +21,7 @@ * */ -package org.onap.clamp.util; +package org.onap.policy.clamp.util; import static org.assertj.core.api.Assertions.assertThat; |