summaryrefslogtreecommitdiffstats
path: root/common-be/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'common-be/src/test')
-rw-r--r--common-be/src/test/java/org/openecomp/sdc/be/config/NonManoConfigurationManagerTest.java4
-rw-r--r--common-be/src/test/java/org/openecomp/sdc/be/csar/pnf/SoftwareInformationArtifactYamlParserTest.java11
-rw-r--r--common-be/src/test/java/org/openecomp/sdc/be/datatypes/components/ServiceMetadataDataDefinitionTest.java22
-rw-r--r--common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/CompositionDataDefinitionTest.java4
-rw-r--r--common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/ConsumerDataDefinitionTest.java7
-rw-r--r--common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/MapCapabilityPropertyTest.java4
-rw-r--r--common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/MapListRequirementDataDefinitionTest.java4
-rw-r--r--common-be/src/test/java/org/openecomp/sdc/be/test/util/TestResourcesHandler.java9
-rw-r--r--common-be/src/test/java/org/openecomp/sdc/be/utils/CommonBeUtilsTest.java2
-rw-r--r--common-be/src/test/java/org/openecomp/sdc/be/utils/DummyConfigurationManager.java62
-rw-r--r--common-be/src/test/java/org/openecomp/sdc/be/utils/PropertyDefinitionUtilsTest.java13
-rw-r--r--common-be/src/test/java/org/openecomp/sdc/be/utils/TypeUtilsTest.java7
12 files changed, 118 insertions, 31 deletions
diff --git a/common-be/src/test/java/org/openecomp/sdc/be/config/NonManoConfigurationManagerTest.java b/common-be/src/test/java/org/openecomp/sdc/be/config/NonManoConfigurationManagerTest.java
index bbe8623ed8..3c51778fb1 100644
--- a/common-be/src/test/java/org/openecomp/sdc/be/config/NonManoConfigurationManagerTest.java
+++ b/common-be/src/test/java/org/openecomp/sdc/be/config/NonManoConfigurationManagerTest.java
@@ -19,14 +19,14 @@
package org.openecomp.sdc.be.config;
+import org.junit.Test;
+
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.not;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.Matchers.anEmptyMap;
import static org.junit.Assert.assertThat;
-import org.junit.Test;
-
public class NonManoConfigurationManagerTest {
@Test
diff --git a/common-be/src/test/java/org/openecomp/sdc/be/csar/pnf/SoftwareInformationArtifactYamlParserTest.java b/common-be/src/test/java/org/openecomp/sdc/be/csar/pnf/SoftwareInformationArtifactYamlParserTest.java
index b866fd55db..bc49f2d417 100644
--- a/common-be/src/test/java/org/openecomp/sdc/be/csar/pnf/SoftwareInformationArtifactYamlParserTest.java
+++ b/common-be/src/test/java/org/openecomp/sdc/be/csar/pnf/SoftwareInformationArtifactYamlParserTest.java
@@ -19,16 +19,17 @@
package org.openecomp.sdc.be.csar.pnf;
+import org.junit.Test;
+import org.openecomp.sdc.be.test.util.TestResourcesHandler;
+
+import java.io.IOException;
+import java.util.Optional;
+
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.hasItems;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
-import java.io.IOException;
-import java.util.Optional;
-import org.junit.Test;
-import org.openecomp.sdc.be.test.util.TestResourcesHandler;
-
public class SoftwareInformationArtifactYamlParserTest {
@Test
diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/components/ServiceMetadataDataDefinitionTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/components/ServiceMetadataDataDefinitionTest.java
index 3842f0a00e..77b6871c92 100644
--- a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/components/ServiceMetadataDataDefinitionTest.java
+++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/components/ServiceMetadataDataDefinitionTest.java
@@ -21,12 +21,34 @@
package org.openecomp.sdc.be.datatypes.components;
import org.junit.Assert;
+import org.junit.Before;
+import org.junit.BeforeClass;
import org.junit.Test;
+import org.openecomp.sdc.be.config.Configuration;
+import org.openecomp.sdc.be.config.ConfigurationManager;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
+import org.openecomp.sdc.be.utils.DummyConfigurationManager;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
public class ServiceMetadataDataDefinitionTest {
+ private Configuration.EnvironmentContext environmentContext = mock(Configuration.EnvironmentContext.class);
+ private static final String DEFAULT_ENVIRONMENT = "General_Revenue-Bearing";
+ @BeforeClass
+ public static void setup() {
+ new DummyConfigurationManager();
+ }
+
+ @Before
+ public void beforeTest() {
+ when(environmentContext.getDefaultValue()).thenReturn(DEFAULT_ENVIRONMENT);
+ when(ConfigurationManager.getConfigurationManager().getConfiguration().getEnvironmentContext())
+ .thenReturn(environmentContext);
+ }
+
private ServiceMetadataDataDefinition createTestSubject() {
return new ServiceMetadataDataDefinition();
}
diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/CompositionDataDefinitionTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/CompositionDataDefinitionTest.java
index 390d1004d3..df6a10c293 100644
--- a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/CompositionDataDefinitionTest.java
+++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/CompositionDataDefinitionTest.java
@@ -20,10 +20,10 @@
package org.openecomp.sdc.be.datatypes.elements;
-import java.util.Map;
-
import org.junit.Test;
+import java.util.Map;
+
public class CompositionDataDefinitionTest {
diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/ConsumerDataDefinitionTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/ConsumerDataDefinitionTest.java
index ddcb32f87a..b8b55369c5 100644
--- a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/ConsumerDataDefinitionTest.java
+++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/ConsumerDataDefinitionTest.java
@@ -19,13 +19,12 @@
*/
package org.openecomp.sdc.be.datatypes.elements;
-import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
-import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSettersExcluding;
-import static org.junit.Assert.assertThat;
-
import org.junit.Assert;
import org.junit.Test;
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSettersExcluding;
+import static org.junit.Assert.assertThat;
+
public class ConsumerDataDefinitionTest {
private ConsumerDataDefinition createTestSubject() {
diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/MapCapabilityPropertyTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/MapCapabilityPropertyTest.java
index 14d6504d7a..b5f04de358 100644
--- a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/MapCapabilityPropertyTest.java
+++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/MapCapabilityPropertyTest.java
@@ -20,11 +20,11 @@
package org.openecomp.sdc.be.datatypes.elements;
+import org.junit.Test;
+
import java.util.HashMap;
import java.util.Map;
-import org.junit.Test;
-
public class MapCapabilityPropertyTest {
private MapCapabilityProperty createTestSubject() {
diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/MapListRequirementDataDefinitionTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/MapListRequirementDataDefinitionTest.java
index 86b4c27805..4001599277 100644
--- a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/MapListRequirementDataDefinitionTest.java
+++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/MapListRequirementDataDefinitionTest.java
@@ -20,11 +20,11 @@
package org.openecomp.sdc.be.datatypes.elements;
+import org.junit.Test;
+
import java.util.HashMap;
import java.util.Map;
-import org.junit.Test;
-
public class MapListRequirementDataDefinitionTest {
diff --git a/common-be/src/test/java/org/openecomp/sdc/be/test/util/TestResourcesHandler.java b/common-be/src/test/java/org/openecomp/sdc/be/test/util/TestResourcesHandler.java
index 3aba23692f..2e3b906a5d 100644
--- a/common-be/src/test/java/org/openecomp/sdc/be/test/util/TestResourcesHandler.java
+++ b/common-be/src/test/java/org/openecomp/sdc/be/test/util/TestResourcesHandler.java
@@ -19,15 +19,16 @@
package org.openecomp.sdc.be.test.util;
-import static org.junit.Assert.fail;
+import org.apache.commons.io.IOUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.nio.file.Path;
-import org.apache.commons.io.IOUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+
+import static org.junit.Assert.fail;
/**
* Util class for handling test resources.
diff --git a/common-be/src/test/java/org/openecomp/sdc/be/utils/CommonBeUtilsTest.java b/common-be/src/test/java/org/openecomp/sdc/be/utils/CommonBeUtilsTest.java
index 7670913163..6f8ffe529f 100644
--- a/common-be/src/test/java/org/openecomp/sdc/be/utils/CommonBeUtilsTest.java
+++ b/common-be/src/test/java/org/openecomp/sdc/be/utils/CommonBeUtilsTest.java
@@ -22,9 +22,9 @@
package org.openecomp.sdc.be.utils;
-import static org.junit.Assert.assertEquals;
import org.junit.Test;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
diff --git a/common-be/src/test/java/org/openecomp/sdc/be/utils/DummyConfigurationManager.java b/common-be/src/test/java/org/openecomp/sdc/be/utils/DummyConfigurationManager.java
new file mode 100644
index 0000000000..2f8c81cf0c
--- /dev/null
+++ b/common-be/src/test/java/org/openecomp/sdc/be/utils/DummyConfigurationManager.java
@@ -0,0 +1,62 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ * Modifications copyright (c) 2019 Nokia
+ * ================================================================================
+ */
+
+package org.openecomp.sdc.be.utils;
+
+import org.openecomp.sdc.be.config.Configuration;
+import org.openecomp.sdc.be.config.ConfigurationManager;
+import org.openecomp.sdc.be.config.DistributionEngineConfiguration;
+import org.openecomp.sdc.common.api.ConfigurationListener;
+import org.openecomp.sdc.common.api.ConfigurationSource;
+
+import static org.mockito.Mockito.mock;
+
+public class DummyConfigurationManager {
+
+ private DistributionEngineConfiguration distributionConfigurationMock = mock(DistributionEngineConfiguration.class);
+ private Configuration configurationMock = mock(Configuration.class);
+
+ public DummyConfigurationManager() {
+ new ConfigurationManager(new DummyConfigurationSource());
+ }
+
+ public class DummyConfigurationSource implements ConfigurationSource {
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public <T> T getAndWatchConfiguration(Class<T> className, ConfigurationListener configurationListener) {
+ if (className.equals(DistributionEngineConfiguration.class)) {
+ return (T) distributionConfigurationMock;
+ }
+ if (className.equals(Configuration.class)) {
+ return (T) configurationMock;
+ }
+ return null;
+ }
+
+ @Override
+ public <T> void addWatchConfiguration(Class<T> className, ConfigurationListener configurationListener) {
+
+ }
+ }
+
+}
diff --git a/common-be/src/test/java/org/openecomp/sdc/be/utils/PropertyDefinitionUtilsTest.java b/common-be/src/test/java/org/openecomp/sdc/be/utils/PropertyDefinitionUtilsTest.java
index b9f11d32a7..a4d5eed056 100644
--- a/common-be/src/test/java/org/openecomp/sdc/be/utils/PropertyDefinitionUtilsTest.java
+++ b/common-be/src/test/java/org/openecomp/sdc/be/utils/PropertyDefinitionUtilsTest.java
@@ -19,17 +19,18 @@
*/
package org.openecomp.sdc.be.utils;
-import static java.util.Collections.emptyMap;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotSame;
+import org.junit.Test;
+import org.openecomp.sdc.be.datatypes.elements.GetInputValueDataDefinition;
+import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import org.junit.Test;
-import org.openecomp.sdc.be.datatypes.elements.GetInputValueDataDefinition;
-import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition;
+
+import static java.util.Collections.emptyMap;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotSame;
public class PropertyDefinitionUtilsTest {
diff --git a/common-be/src/test/java/org/openecomp/sdc/be/utils/TypeUtilsTest.java b/common-be/src/test/java/org/openecomp/sdc/be/utils/TypeUtilsTest.java
index fc5cea4b82..2f6ddf92e8 100644
--- a/common-be/src/test/java/org/openecomp/sdc/be/utils/TypeUtilsTest.java
+++ b/common-be/src/test/java/org/openecomp/sdc/be/utils/TypeUtilsTest.java
@@ -21,15 +21,16 @@
*/
package org.openecomp.sdc.be.utils;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.function.Consumer;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
import org.mockito.junit.MockitoJUnitRunner;
import org.openecomp.sdc.be.utils.TypeUtils.ToscaTagNamesEnum;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.function.Consumer;
+
@RunWith(MockitoJUnitRunner.class)
public class TypeUtilsTest {