Increase test coverage 23/105023/2
authorvasraz <vasyl.razinkov@est.tech>
Thu, 2 Apr 2020 18:23:40 +0000 (19:23 +0100)
committerOfir Sonsino <ofir.sonsino@intl.att.com>
Mon, 6 Apr 2020 13:51:34 +0000 (13:51 +0000)
Change-Id: I5ed0e2520305519af573df10768c3ee69c39f213
Signed-off-by: Vasyl Razinkov <vasyl.razinkov@est.tech>
Issue-ID: SDC-2833

12 files changed:
catalog-dao/src/main/java/org/openecomp/sdc/be/dao/Account.java
catalog-dao/src/main/java/org/openecomp/sdc/be/dao/DAOJanusGraphStrategy.java
catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/types/EdgeLabelEnum.java
catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/types/EdgePropertyEnum.java
catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/types/JsonParseFlagEnum.java
catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/types/VertexTypeEnum.java
catalog-dao/src/test/java/org/openecomp/sdc/be/dao/AccountTest.java [deleted file]
catalog-dao/src/test/java/org/openecomp/sdc/be/dao/DAOJanusGraphStrategyTest.java [new file with mode: 0644]
catalog-dao/src/test/java/org/openecomp/sdc/be/dao/jsongraph/types/EdgeLabelEnumTest.java
catalog-dao/src/test/java/org/openecomp/sdc/be/dao/jsongraph/types/EdgePropertyEnumTest.java
catalog-dao/src/test/java/org/openecomp/sdc/be/dao/jsongraph/types/JsonParseFlagEnumTest.java [moved from catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/types/GraphJsonProperty.java with 67% similarity]
catalog-dao/src/test/java/org/openecomp/sdc/be/dao/jsongraph/types/VertexTypeEnumTest.java

index 6ff717d..6a1e495 100644 (file)
@@ -7,9 +7,9 @@
  * 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.
 
 package org.openecomp.sdc.be.dao;
 
-//import com.datastax.driver.mapping.annotations.Column;
-//import com.datastax.driver.mapping.annotations.Frozen;
 import com.datastax.driver.mapping.annotations.PartitionKey;
 import com.datastax.driver.mapping.annotations.Table;
-import com.google.common.base.Objects;
+import lombok.AllArgsConstructor;
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
 
 @Table(keyspace = "dstest", name = "accounts")
+@Getter
+@Setter
+@EqualsAndHashCode
+@AllArgsConstructor
+@NoArgsConstructor
 public class Account {
 
-       @PartitionKey
-       private String email;
-       private String name;
-       // @Column (name = "addr")
-       // @Frozen
-       // private Address address;
-
-       public Account() {
-       }
-
-       // public Account(String name, String email, Address address) {
-       public Account(String name, String email) {
-               this.name = name;
-               this.email = email;
-       }
-
-       public String getName() {
-               return name;
-       }
-
-       public void setName(String name) {
-               this.name = name;
-       }
-
-       public String getEmail() {
-               return email;
-       }
-
-       public void setEmail(String email) {
-               this.email = email;
-       }
-       //
-       // public Address getAddress() {
-       // return address;
-       // }
-       //
-       // public void setAddress(Address address) {
-       // this.address = address;
-       // }
-
-       @Override
-       public boolean equals(Object other) {
-               if (other instanceof Account) {
-                       Account that = (Account) other;
-                       return Objects.equal(this.name, that.name) && Objects.equal(this.email, that.email);
-               }
-               return false;
-       }
-
-       @Override
-       public int hashCode() {
-               return Objects.hashCode(name, email);
-       }
+    @PartitionKey
+    private String email;
+    private String name;
 
 }
index 1a96ebf..1f7d6b9 100644 (file)
@@ -7,9 +7,9 @@
  * 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.
index 9dc9c84..d35f00b 100644 (file)
 package org.openecomp.sdc.be.dao.jsongraph.types;
 
 public enum EdgeLabelEnum {
-       ARTIFACTS,
-       DEPLOYMENT_ARTIFACTS,
-       INST_DEPLOYMENT_ARTIFACTS,
-       INSTANCE_ARTIFACTS,
-       INTERFACE_ARTIFACTS,
-       TOSCA_ARTIFACTS,
-       PROPERTIES,
-       CAPABILITIES,
-       CAPABILITIES_PROPERTIES,
-       REQUIREMENTS,
-       ATTRIBUTES,
-       ADDITIONAL_INFORMATION,
-       CATEGORY,
-       DERIVED_FROM,
-       STATE,
-       LAST_STATE,
-       LAST_MODIFIER,
-       VERSION,
-       CREATOR,
-       SUB_CATEGORY,
-       INPUTS,
-       GROUPS,
-       INST_PROPERTIES,
-       INST_INPUTS,
-       INST_ATTRIBUTES,
-       INST_GROUPS,
-       SERVICE_API_ARTIFACTS,
-       FORWARDING_PATH,
-       CALCULATED_CAPABILITIES,
-       FULLFILLED_CAPABILITIES,
-       CALCULATED_REQUIREMENTS,
-       FULLFILLED_REQUIREMENTS,
-       LAST_DISTRIBUTION_STATE_MODIFIER,
-       CALCULATED_CAP_PROPERTIES,
-       POLICIES,
-       EXTERNAL_REFS,
-       CATALOG_ELEMENT,
+    ARTIFACTS,
+    DEPLOYMENT_ARTIFACTS,
+    INST_DEPLOYMENT_ARTIFACTS,
+    INSTANCE_ARTIFACTS,
+    INTERFACE_ARTIFACTS,
+    TOSCA_ARTIFACTS,
+    PROPERTIES,
+    CAPABILITIES,
+    CAPABILITIES_PROPERTIES,
+    REQUIREMENTS,
+    ATTRIBUTES,
+    ADDITIONAL_INFORMATION,
+    CATEGORY,
+    DERIVED_FROM,
+    STATE,
+    LAST_STATE,
+    LAST_MODIFIER,
+    VERSION,
+    CREATOR,
+    SUB_CATEGORY,
+    INPUTS,
+    GROUPS,
+    INST_PROPERTIES,
+    INST_INPUTS,
+    INST_ATTRIBUTES,
+    INST_GROUPS,
+    SERVICE_API_ARTIFACTS,
+    FORWARDING_PATH,
+    CALCULATED_CAPABILITIES,
+    FULLFILLED_CAPABILITIES,
+    CALCULATED_REQUIREMENTS,
+    FULLFILLED_REQUIREMENTS,
+    LAST_DISTRIBUTION_STATE_MODIFIER,
+    CALCULATED_CAP_PROPERTIES,
+    POLICIES,
+    EXTERNAL_REFS,
+    CATALOG_ELEMENT,
     ARCHIVE_ELEMENT,
-       INSTANCE_OF,
-       PROXY_OF,
-       ALLOTTED_OF,
-       INTERFACE,
-       INTERFACE_OPERATION,
-       INST_INTERFACES,
-       NODE_FILTER_TEMPLATE,
-       DATA_TYPES;
+    INSTANCE_OF,
+    PROXY_OF,
+    ALLOTTED_OF,
+    INTERFACE,
+    INTERFACE_OPERATION,
+    INST_INTERFACES,
+    NODE_FILTER_TEMPLATE,
+    DATA_TYPES;
 
     /**
-        * Returns EdgeLabelEnum according received name
-        * @param name
-        * @return
-        */
-       public static EdgeLabelEnum getEdgeLabelEnum(String name){
-               for(EdgeLabelEnum currLabel : EdgeLabelEnum.values()){
-                       if (currLabel.name().equals(name)){
-                               return currLabel;
-                       }
-               }
-               return null;
-       }
+     * Returns EdgeLabelEnum according received name
+     *
+     * @param name
+     * @return
+     */
+    public static EdgeLabelEnum getEdgeLabelEnum(String name) {
+        for (EdgeLabelEnum currLabel : EdgeLabelEnum.values()) {
+            if (currLabel.name().equals(name)) {
+                return currLabel;
+            }
+        }
+        return null;
+    }
 
-       public boolean isInstanceArtifactsLabel() {
-               return this.equals(INSTANCE_ARTIFACTS) || this.equals(INST_DEPLOYMENT_ARTIFACTS);
-       }
+    public boolean isInstanceArtifactsLabel() {
+        return this.equals(INSTANCE_ARTIFACTS) || this.equals(INST_DEPLOYMENT_ARTIFACTS);
+    }
 }
index e47a78d..d2f6d09 100644 (file)
@@ -7,9 +7,9 @@
  * 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.
 
 package org.openecomp.sdc.be.dao.jsongraph.types;
 
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+@Getter
+@AllArgsConstructor
 public enum EdgePropertyEnum {
-       
-       STATE ("state"),
-       INSTANCES("instances");
 
-       private String property;
-       
-       public String getProperty() {
-               return property;
-       }
+    STATE("state"),
+    INSTANCES("instances");
+
+    private final String property;
 
-       EdgePropertyEnum (String property){
-               this.property = property;
-       }
-       
-       public static EdgePropertyEnum getByProperty(String property){
-               for ( EdgePropertyEnum inst : EdgePropertyEnum.values() ){
-                       if ( inst.getProperty().equals(property) ){
-                               return inst;
-                       }
-               }
-               return null;
-       }
+    public static EdgePropertyEnum getByProperty(String property) {
+        for (EdgePropertyEnum inst : EdgePropertyEnum.values()) {
+            if (inst.getProperty().equals(property)) {
+                return inst;
+            }
+        }
+        return null;
+    }
 }
index 485531a..ac0ceeb 100644 (file)
@@ -7,9 +7,9 @@
  * 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.
@@ -22,8 +22,8 @@ package org.openecomp.sdc.be.dao.jsongraph.types;
 
 public enum JsonParseFlagEnum {
 
-       NoParse,
-       ParseAll,
-       ParseJson,
-       ParseMetadata
+    NoParse,
+    ParseAll,
+    ParseJson,
+    ParseMetadata
 }
index 053a690..01d3ac4 100644 (file)
@@ -7,9 +7,9 @@
  * 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.
 
 package org.openecomp.sdc.be.dao.jsongraph.types;
 
+import lombok.AllArgsConstructor;
+import lombok.Getter;
 import org.openecomp.sdc.be.datatypes.elements.*;
 import org.openecomp.sdc.be.resources.data.DataTypeData;
 
-
+@Getter
+@AllArgsConstructor
 public enum VertexTypeEnum {
        NODE_TYPE                                       ("node_type",                                   null),
-       TOPOLOGY_TEMPLATE                       ("topology_template",                   CompositionDataDefinition.class),
+       TOPOLOGY_TEMPLATE                       ("topology_template",           CompositionDataDefinition.class),
        ARTIFACTS                                       ("artifacts",                                   ArtifactDataDefinition.class),
-       TOSCA_ARTIFACTS                         ("tosca_artifacts",                             ArtifactDataDefinition.class),
-       DEPLOYMENT_ARTIFACTS            ("deployment_artifacts",                ArtifactDataDefinition.class),  
+       TOSCA_ARTIFACTS                         ("tosca_artifacts",                     ArtifactDataDefinition.class),
+       DEPLOYMENT_ARTIFACTS            ("deployment_artifacts",                ArtifactDataDefinition.class),
        INST_DEPLOYMENT_ARTIFACTS       ("inst_deployment_artifacts",   MapArtifactDataDefinition.class),
-       INTERFACE_ARTIFACTS                     ("interface_artifacts",                 InterfaceDataDefinition.class),
-       INSTANCE_ARTIFACTS                      ("instance_artifacts",                  MapArtifactDataDefinition.class),
-       PROPERTIES                                      ("properties",                                  PropertyDataDefinition.class),
+       INTERFACE_ARTIFACTS                     ("interface_artifacts",         InterfaceDataDefinition.class),
+       INSTANCE_ARTIFACTS                      ("instance_artifacts",          MapArtifactDataDefinition.class),
+       PROPERTIES                                      ("properties",                          PropertyDataDefinition.class),
        CAPABILITIES                            ("capabilities",                                ListCapabilityDataDefinition.class),
-       CAPABILITIES_PROPERTIES         ("capabilities_properties",             MapPropertiesDataDefinition.class),     
+       CAPABILITIES_PROPERTIES         ("capabilities_properties",     MapPropertiesDataDefinition.class),
        REQUIREMENTS                            ("requirements",                                ListRequirementDataDefinition.class),
-       ATTRIBUTES                                      ("attributes",                                  PropertyDataDefinition.class),
-       RESOURCE_CATEGORY                       ("resourceNewCategory",                 null),
-       RESOURCE_SUBCATEGORY            ("resourceSubcategory",                 null),
-       SERVICE_CATEGORY                        ("serviceNewCategory",                  null), 
-       ADDITIONAL_INFORMATION          ("additional_information",      AdditionalInfoParameterDataDefinition.class),
+       ATTRIBUTES                                      ("attributes",                          PropertyDataDefinition.class),
+       RESOURCE_CATEGORY                       ("resourceNewCategory",         null),
+       RESOURCE_SUBCATEGORY            ("resourceSubcategory",         null),
+       SERVICE_CATEGORY                        ("serviceNewCategory",          null),
+       ADDITIONAL_INFORMATION          ("additional_information",    AdditionalInfoParameterDataDefinition.class),
        USER                                            ("user",                                                null),
-       INPUTS                                          ("inputs",                                              PropertyDataDefinition.class),
-       GROUPS                                          ("groups",                                              GroupDataDefinition.class),
-       INST_ATTRIBUTES                         ("instAttributes",                              MapPropertiesDataDefinition.class),
-       INST_PROPERTIES                         ("instProperties",                              MapPropertiesDataDefinition.class),
-       INST_INPUTS                                     ("instInputs",                                  MapPropertiesDataDefinition.class),
-       INST_GROUPS                                     ("instGroups",                                  MapGroupsDataDefinition.class),
-       SERVICE_API_ARTIFACTS           ("serviceApiArtifacts",                 ArtifactDataDefinition.class),
-       CALCULATED_CAPABILITIES         ("calculatedCapabilities",              MapListCapabilityDataDefinition.class),
-       FULLFILLED_CAPABILITIES         ("fullfilledCapabilities",              MapListCapabilityDataDefinition.class),
-       CALCULATED_REQUIREMENTS         ("calculatedRequirements",              MapListRequirementDataDefinition.class),
-       FULLFILLED_REQUIREMENTS         ("fullfilledRequirements",              MapListRequirementDataDefinition.class),
-       CALCULATED_CAP_PROPERTIES       ("calculatedCapProperties",             MapCapabilityProperty.class),
-       FORWARDING_PATH             ("path",                            ForwardingPathDataDefinition.class),
+       INPUTS                                          ("inputs",                                      PropertyDataDefinition.class),
+       GROUPS                                          ("groups",                                      GroupDataDefinition.class),
+       INST_ATTRIBUTES                         ("instAttributes",                      MapPropertiesDataDefinition.class),
+       INST_PROPERTIES                         ("instProperties",                      MapPropertiesDataDefinition.class),
+       INST_INPUTS                                     ("instInputs",                          MapPropertiesDataDefinition.class),
+       INST_GROUPS                                     ("instGroups",                          MapGroupsDataDefinition.class),
+       SERVICE_API_ARTIFACTS           ("serviceApiArtifacts",         ArtifactDataDefinition.class),
+       CALCULATED_CAPABILITIES         ("calculatedCapabilities",      MapListCapabilityDataDefinition.class),
+       FULLFILLED_CAPABILITIES         ("fullfilledCapabilities",      MapListCapabilityDataDefinition.class),
+       CALCULATED_REQUIREMENTS         ("calculatedRequirements",      MapListRequirementDataDefinition.class),
+       FULLFILLED_REQUIREMENTS         ("fullfilledRequirements",      MapListRequirementDataDefinition.class),
+       CALCULATED_CAP_PROPERTIES       ("calculatedCapProperties",     MapCapabilityProperty.class),
+       FORWARDING_PATH             ("path",                    ForwardingPathDataDefinition.class),
        POLICIES                                        ("policies",                                    PolicyDataDefinition.class),
-       EXTERNAL_REF                            ("componentInstanceExtRefs",    MapComponentInstanceExternalRefs.class),
-       CATALOG_ROOT                ("catalogRoot",                 null),
-       ARCHIVE_ROOT                ("archiveRoot",                 null),
+       EXTERNAL_REF                            ("componentInstanceExtRefs",  MapComponentInstanceExternalRefs.class),
+       CATALOG_ROOT                ("catalogRoot",               null),
+       ARCHIVE_ROOT                ("archiveRoot",               null),
        INTERFACE                           ("interface",                               InterfaceDataDefinition.class),
-       INTERFACE_OPERATION                     ("interfaceOperation",                  OperationDataDefinition.class),
-       NODE_FILTER_TEMPLATE            ("NodeTemplateFilter",          CINodeFilterDataDefinition.class),
-       INST_INTERFACES             ("InstInterfaces",              MapInterfaceDataDefinition.class),
-       DATA_TYPES                                      ("data_types",                                  DataTypeDataDefinition.class);
+       INTERFACE_OPERATION                     ("interfaceOperation",          OperationDataDefinition.class),
+       NODE_FILTER_TEMPLATE            ("NodeTemplateFilter",        CINodeFilterDataDefinition.class),
+       INST_INTERFACES             ("InstInterfaces",            MapInterfaceDataDefinition.class),
+       DATA_TYPES                                      ("data_types",                          DataTypeDataDefinition.class);
 
-       private String name;
-       private Class classOfJson;
-       VertexTypeEnum(String name, Class clazz){
-               this.name = name;
-               classOfJson = clazz;
-       }
-       
-       public String getName() {
-               return name;
-       }
-
-       public Class getClassOfJson() {
-               return classOfJson;
-       }
+       private final String name;
+       private final Class classOfJson;
 
        public static VertexTypeEnum getByName(String name){
                for ( VertexTypeEnum inst : VertexTypeEnum.values() ){
diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/AccountTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/AccountTest.java
deleted file mode 100644 (file)
index e0fd178..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2019 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=========================================================
- */
-
-package org.openecomp.sdc.be.dao;
-
-import org.junit.Test;
-
-public class AccountTest {
-
-       private Account createTestSubject() {
-               return new Account();
-       }
-
-       @Test
-       public void testCtor() throws Exception {
-               new Account("mock", "mock");
-       }
-       
-       @Test
-       public void testGetName() throws Exception {
-               Account testSubject;
-               String result;
-
-               // default test
-               testSubject = createTestSubject();
-               result = testSubject.getName();
-       }
-
-       @Test
-       public void testSetName() throws Exception {
-               Account testSubject;
-               String name = "";
-
-               // default test
-               testSubject = createTestSubject();
-               testSubject.setName(name);
-       }
-
-       @Test
-       public void testGetEmail() throws Exception {
-               Account testSubject;
-               String result;
-
-               // default test
-               testSubject = createTestSubject();
-               result = testSubject.getEmail();
-       }
-
-       @Test
-       public void testSetEmail() throws Exception {
-               Account testSubject;
-               String email = "";
-
-               // default test
-               testSubject = createTestSubject();
-               testSubject.setEmail(email);
-       }
-
-       @Test
-       public void testEquals() throws Exception {
-               Account testSubject;
-               Object other = null;
-               boolean result;
-
-               // default test
-               testSubject = createTestSubject();
-               result = testSubject.equals(other);
-               result = testSubject.equals(testSubject);
-               result = testSubject.equals(createTestSubject());
-       }
-
-       @Test
-       public void testHashCode() throws Exception {
-               Account testSubject;
-               int result;
-
-               // default test
-               testSubject = createTestSubject();
-               result = testSubject.hashCode();
-       }
-}
diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/DAOJanusGraphStrategyTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/DAOJanusGraphStrategyTest.java
new file mode 100644 (file)
index 0000000..450801e
--- /dev/null
@@ -0,0 +1,50 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2020, Nordix Foundation. 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=========================================================
+ */
+package org.openecomp.sdc.be.dao;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.openecomp.sdc.be.config.ConfigurationManager;
+import org.openecomp.sdc.common.impl.ExternalConfiguration;
+import org.openecomp.sdc.common.impl.FSConfigurationSource;
+
+public class DAOJanusGraphStrategyTest {
+
+    @Before
+    public void setUp() throws Exception {
+        new ConfigurationManager(new FSConfigurationSource(ExternalConfiguration.getChangeListener(),
+            "src/test/resources/config/catalog-dao"));
+    }
+
+    private DAOJanusGraphStrategy createTestSubject() {
+        return new DAOJanusGraphStrategy();
+    }
+
+    @Test
+    public void getConfigFile() {
+        DAOJanusGraphStrategy testSubject;
+
+        // default test
+        testSubject = createTestSubject();
+        assertThat(testSubject.getConfigFile()).isNotNull();
+    }
+}
index 39bf138..3d7f392 100644 (file)
@@ -7,9 +7,9 @@
  * 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.
 
 package org.openecomp.sdc.be.dao.jsongraph.types;
 
+import static org.assertj.core.api.Assertions.assertThat;
+
 import org.junit.Test;
 
 
 public class EdgeLabelEnumTest {
 
-       private EdgeLabelEnum createTestSubject() {
-               return EdgeLabelEnum.ARTIFACTS;
-       }
+    private EdgeLabelEnum createTestSubject() {
+        return EdgeLabelEnum.ARTIFACTS;
+    }
 
-       
-       @Test
-       public void testGetEdgeLabelEnum() throws Exception {
-               String name = "";
-               EdgeLabelEnum result;
+    @Test
+    public void testGetEdgeLabelEnum() throws Exception {
+        String name = "";
+        EdgeLabelEnum result;
 
-               // default test
-               result = EdgeLabelEnum.getEdgeLabelEnum(name);
+        // default test
+        result = EdgeLabelEnum.getEdgeLabelEnum(name);
+               assertThat(result).isNull();
        }
 
-       
-       @Test
-       public void testIsInstanceArtifactsLabel() throws Exception {
-               EdgeLabelEnum testSubject;
-               boolean result;
-
-               // default test
-               testSubject = createTestSubject();
-               result = testSubject.isInstanceArtifactsLabel();
-       }
+    @Test
+    public void testEnumValues() {
+        for (final Object value : EdgeLabelEnum.values()) {
+            assertThat(value).isNotNull().isInstanceOf(EdgeLabelEnum.class);
+        }
+    }
+
+    @Test
+    public void testIsInstanceArtifactsLabel() throws Exception {
+        EdgeLabelEnum testSubject;
+        boolean result;
+
+        // default test
+        testSubject = createTestSubject();
+        result = testSubject.isInstanceArtifactsLabel();
+        assertThat(result).isFalse();
+    }
 }
index 2b517d1..066b8ec 100644 (file)
@@ -7,9 +7,9 @@
  * 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.
 
 package org.openecomp.sdc.be.dao.jsongraph.types;
 
-import org.junit.Test;
+import static org.assertj.core.api.Assertions.assertThat;
 
+import org.junit.Test;
 
 public class EdgePropertyEnumTest {
 
-       private EdgePropertyEnum createTestSubject() {
-               return EdgePropertyEnum.STATE;
-       }
-
-       
-       @Test
-       public void testGetProperty() throws Exception {
-               EdgePropertyEnum testSubject;
-               String result;
-
-               // default test
-               testSubject = createTestSubject();
-               result = testSubject.getProperty();
-       }
-
-       
-       @Test
-       public void testGetByProperty() throws Exception {
-               String property = "";
-               EdgePropertyEnum result;
-
-               // default test
-               result = EdgePropertyEnum.getByProperty(property);
-       }
+    @Test
+    public void testEnumValues() {
+        for (final Object value : EdgePropertyEnum.values()) {
+            assertThat(value).isNotNull().isInstanceOf(EdgePropertyEnum.class);
+        }
+    }
+
+    @Test
+    public void testGetByProperty() throws Exception {
+        String property = "";
+        EdgePropertyEnum result;
+
+        // default test
+        result = EdgePropertyEnum.getByProperty(property);
+               assertThat(result).isNull();
+    }
 }
@@ -2,14 +2,14 @@
  * ============LICENSE_START=======================================================
  * SDC
  * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2020, Nordix Foundation. 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.
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
-
 package org.openecomp.sdc.be.dao.jsongraph.types;
 
-import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum;
+import static org.assertj.core.api.Assertions.assertThat;
+
+import org.junit.Test;
 
-public enum GraphJsonProperty {
-       METADATA        (GraphPropertyEnum.METADATA),
-       JSON            (GraphPropertyEnum.JSON);
-       
-       private GraphPropertyEnum propInGraph;
-       
-       GraphJsonProperty (GraphPropertyEnum propInGraph){
-               this.propInGraph = propInGraph;
-       }
+public class JsonParseFlagEnumTest {
 
-       public GraphPropertyEnum getPropInGraph() {
-               return propInGraph;
-       }
-       
+    @Test
+    public void testEnumValues() {
+        for (final Object value : JsonParseFlagEnum.values()) {
+            assertThat(value).isNotNull().isInstanceOf(JsonParseFlagEnum.class);
+        }
+    }
 }
index 0efe702..ab0e954 100644 (file)
@@ -7,9 +7,9 @@
  * 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.
 
 package org.openecomp.sdc.be.dao.jsongraph.types;
 
-import org.junit.Test;
+import static org.assertj.core.api.Assertions.assertThat;
 
+import org.junit.Test;
 
 public class VertexTypeEnumTest {
 
-       private VertexTypeEnum createTestSubject() {
-               return VertexTypeEnum.ADDITIONAL_INFORMATION;
-       }
-
-       
-       @Test
-       public void testGetName() throws Exception {
-               VertexTypeEnum testSubject;
-               String result;
-
-               // default test
-               testSubject = createTestSubject();
-               result = testSubject.getName();
-       }
-
-       
-       @Test
-       public void testGetClassOfJson() throws Exception {
-               VertexTypeEnum testSubject;
-               Class result;
-
-               // default test
-               testSubject = createTestSubject();
-               result = testSubject.getClassOfJson();
-       }
-
-       
-       @Test
-       public void testGetByName() throws Exception {
-               String name = "";
-               VertexTypeEnum result;
-
-               // default test
-               result = VertexTypeEnum.getByName(name);
-       }
+    private VertexTypeEnum createTestSubject() {
+        return VertexTypeEnum.ADDITIONAL_INFORMATION;
+    }
+
+    @Test
+    public void testEnumValues() {
+        for (final Object value : VertexTypeEnum.values()) {
+            assertThat(value).isNotNull().isInstanceOf(VertexTypeEnum.class);
+        }
+    }
+
+    @Test
+    public void testGetByName() throws Exception {
+        String name = "";
+        VertexTypeEnum result;
+
+        // default test
+        result = VertexTypeEnum.getByName(name);
+        assertThat(result).isNull();
+    }
 }