diff options
Diffstat (limited to 'catalog-dao/src/test')
6 files changed, 159 insertions, 185 deletions
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 index e0fd178478..0000000000 --- a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/AccountTest.java +++ /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 index 0000000000..450801eb00 --- /dev/null +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/DAOJanusGraphStrategyTest.java @@ -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(); + } +} diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/jsongraph/types/EdgeLabelEnumTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/jsongraph/types/EdgeLabelEnumTest.java index 39bf138592..3d7f392b50 100644 --- a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/jsongraph/types/EdgeLabelEnumTest.java +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/jsongraph/types/EdgeLabelEnumTest.java @@ -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. @@ -20,33 +20,42 @@ 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(); + } } diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/jsongraph/types/EdgePropertyEnumTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/jsongraph/types/EdgePropertyEnumTest.java index 2b517d1c57..066b8ec37e 100644 --- a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/jsongraph/types/EdgePropertyEnumTest.java +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/jsongraph/types/EdgePropertyEnumTest.java @@ -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. @@ -20,33 +20,26 @@ 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(); + } } diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/jsongraph/types/JsonParseFlagEnumTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/jsongraph/types/JsonParseFlagEnumTest.java new file mode 100644 index 0000000000..c95d1cb46e --- /dev/null +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/jsongraph/types/JsonParseFlagEnumTest.java @@ -0,0 +1,34 @@ +/*- + * ============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.jsongraph.types; + +import static org.assertj.core.api.Assertions.assertThat; + +import org.junit.Test; + +public class JsonParseFlagEnumTest { + + @Test + public void testEnumValues() { + for (final Object value : JsonParseFlagEnum.values()) { + assertThat(value).isNotNull().isInstanceOf(JsonParseFlagEnum.class); + } + } +} diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/jsongraph/types/VertexTypeEnumTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/jsongraph/types/VertexTypeEnumTest.java index 0efe7021a9..ab0e9540cd 100644 --- a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/jsongraph/types/VertexTypeEnumTest.java +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/jsongraph/types/VertexTypeEnumTest.java @@ -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. @@ -20,44 +20,30 @@ 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(); + } } |