aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-dao/src/test
diff options
context:
space:
mode:
authorTomasz Golabek <tomasz.golabek@nokia.com>2019-08-22 13:05:23 +0200
committerPiotr Darosz <piotr.darosz@nokia.com>2019-08-22 12:02:57 +0000
commit41ce69ec659d4fe1568bb7cfa0fd353e0469dfd4 (patch)
tree4edcaf77f9fce1c6bb5a124da8cabfda9d6b793e /catalog-dao/src/test
parent3bdedab365bf7dbc2288c988e24a97ed4823d864 (diff)
unit tests - catalog-be
Additional junit tests Change-Id: Ief7f445521f7821e47715a44c423fd11a17568e1 Issue-ID: SDC-2326 Signed-off-by: Tomasz Golabek <tomasz.golabek@nokia.com>
Diffstat (limited to 'catalog-dao/src/test')
-rw-r--r--catalog-dao/src/test/java/org/openecomp/sdc/be/dao/neo4j/BatchBuilderTest.java37
-rw-r--r--catalog-dao/src/test/java/org/openecomp/sdc/be/dao/neo4j/GraphNeighbourTableTest.java51
-rw-r--r--catalog-dao/src/test/java/org/openecomp/sdc/be/dao/neo4j/Neo4jEdgeTest.java32
-rw-r--r--catalog-dao/src/test/java/org/openecomp/sdc/be/dao/neo4j/Neo4jOperationStatusTest.java34
-rw-r--r--catalog-dao/src/test/java/org/openecomp/sdc/be/dao/neo4j/NodeRelationTest.java32
5 files changed, 186 insertions, 0 deletions
diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/neo4j/BatchBuilderTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/neo4j/BatchBuilderTest.java
new file mode 100644
index 0000000000..65ce29b946
--- /dev/null
+++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/neo4j/BatchBuilderTest.java
@@ -0,0 +1,37 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2019 Nokia. 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.neo4j;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+import org.openecomp.sdc.be.dao.graph.datatype.GraphRelation;
+
+public class BatchBuilderTest {
+
+ private GraphRelation graphElement = new GraphRelation();
+
+ @Test
+ public void shouldAddAndGetElement() {
+ BatchBuilder builder = BatchBuilder.getBuilder();
+ builder.add(graphElement);
+ assertEquals(graphElement, builder.getElements().get(0));
+ }
+} \ No newline at end of file
diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/neo4j/GraphNeighbourTableTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/neo4j/GraphNeighbourTableTest.java
new file mode 100644
index 0000000000..14d3f3aeb0
--- /dev/null
+++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/neo4j/GraphNeighbourTableTest.java
@@ -0,0 +1,51 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2019 Nokia. 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.neo4j;
+
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertThat;
+
+import org.junit.Test;
+import org.openecomp.sdc.be.resources.data.ArtifactData;
+
+public class GraphNeighbourTableTest {
+ @Test
+ public void shouldHaveValidGettersAndSetters() {
+ assertThat(GraphNeighbourTable.class, hasValidGettersAndSetters());
+ }
+
+ @Test
+ public void shouldAddEdge() {
+ GraphNeighbourTable graphNeighbourTable = new GraphNeighbourTable();
+ NodeRelation directedEdge = new NodeRelation(1, 1, null);
+ graphNeighbourTable.addEdge(directedEdge);
+ assertEquals(directedEdge, graphNeighbourTable.getDirectedEdges().get(0));
+ }
+
+ @Test
+ public void shouldAddNode() {
+ GraphNeighbourTable graphNeighbourTable = new GraphNeighbourTable();
+ ArtifactData node = new ArtifactData();
+ int index = graphNeighbourTable.addNode(node);
+ assertEquals(node, graphNeighbourTable.getNodes().get(0));
+ assertEquals(index, 0);
+ }
+} \ No newline at end of file
diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/neo4j/Neo4jEdgeTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/neo4j/Neo4jEdgeTest.java
new file mode 100644
index 0000000000..664fed070f
--- /dev/null
+++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/neo4j/Neo4jEdgeTest.java
@@ -0,0 +1,32 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2019 Nokia. 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.neo4j;
+
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.junit.Assert.assertThat;
+
+import org.junit.Test;
+
+public class Neo4jEdgeTest {
+ @Test
+ public void shouldHaveValidGettersAndSetters() {
+ assertThat(Neo4jEdge.class, hasValidGettersAndSetters());
+ }
+} \ No newline at end of file
diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/neo4j/Neo4jOperationStatusTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/neo4j/Neo4jOperationStatusTest.java
new file mode 100644
index 0000000000..837cf0baee
--- /dev/null
+++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/neo4j/Neo4jOperationStatusTest.java
@@ -0,0 +1,34 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2019 Nokia. 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.neo4j;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+
+public class Neo4jOperationStatusTest {
+
+ @Test
+ public void shouldPrintStatusInCorrectFormat() {
+ String status = Neo4jOperationStatus.BAD_REQUEST
+ .setMessage("A").setHelpErrorMsg("B").setOriginError("C").printError();
+ assertEquals(status, "[BAD_REQUEST-C-B-A]");
+ }
+} \ No newline at end of file
diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/neo4j/NodeRelationTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/neo4j/NodeRelationTest.java
new file mode 100644
index 0000000000..523c519617
--- /dev/null
+++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/neo4j/NodeRelationTest.java
@@ -0,0 +1,32 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2019 Nokia. 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.neo4j;
+
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.junit.Assert.assertThat;
+
+import org.junit.Test;
+
+public class NodeRelationTest {
+ @Test
+ public void shouldHaveValidGettersAndSetters() {
+ assertThat(NodeRelation.class, hasValidGettersAndSetters());
+ }
+} \ No newline at end of file