--- /dev/null
+/*-
+ * ============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.types;
+
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.junit.Assert.assertThat;
+
+import org.junit.Test;
+
+public class ServiceConsumptionDataTest {
+ @Test
+ public void shouldHaveValidGettersAndSetters() {
+ assertThat(ServiceConsumptionData.class, hasValidGettersAndSetters());
+ }
+}
\ No newline at end of file
--- /dev/null
+/*-
+ * ============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.types;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+
+public class ServiceConsumptionSourceTest {
+
+ @Test
+ public void shouldReturnSourceValue() {
+ ServiceConsumptionSource serviceInput = ServiceConsumptionSource.getSourceValue("ServiceInput");
+ assertEquals(serviceInput, ServiceConsumptionSource.SERVICE_INPUT);
+ }
+
+ @Test
+ public void shouldReturnSource() {
+ String serviceInput = ServiceConsumptionSource.SERVICE_INPUT.getSource();
+ assertEquals(serviceInput, "ServiceInput");
+ }
+}
\ No newline at end of file
import java.util.List;
public class BatchBuilder {
- // private Map<String, List<Neo4jNode>> nodes;
- // private List<Neo4jRelation> relations;
- //
- private List<GraphElement> elements;
- // TODO add filter
+ private List<GraphElement> elements;
protected BatchBuilder() {
- // nodes = new HashMap<String, List<Neo4jNode>>();
- // relations = new ArrayList<Neo4jRelation>();
elements = new ArrayList<>();
}
return elements;
}
- // public BatchBuilder add( Neo4jNode element ){
- // String label = element.getLabel();
- // List<Neo4jNode> list = nodes.get(label);
- // if ( list == null ){
- // list = new ArrayList<Neo4jNode>();
- // }
- // list.add(element);
- // nodes.put(label, list);
-
- // return this;
- // }
- // public BatchBuilder add( Neo4jRelation relation ){
- // relations.add(relation);
- // return this;
- // }
- //
- // public Map<String, List<Neo4jNode>> getNodes() {
- // return nodes;
- // }
- //
- // public List<Neo4jRelation> getRelations() {
- // return relations;
- // }
}
package org.openecomp.sdc.be.dao.neo4j;
+import com.google.common.annotations.VisibleForTesting;
import org.openecomp.sdc.be.dao.graph.datatype.ActionEnum;
import java.util.Map;
private Map<String, Object> properties;
private ActionEnum action;
+ @VisibleForTesting
+ Neo4jEdge() {}
+
public Neo4jEdge(GraphEdgeLabels edgeType, Map<String, Object> properties, ActionEnum actionEnum) {
super();
this.edgeType = edgeType;
package org.openecomp.sdc.be.dao.neo4j;
+import com.google.common.annotations.VisibleForTesting;
+
public class NodeRelation {
private int fromIndex;
private int toIndex;
private Neo4jEdge edge;
+ @VisibleForTesting
+ NodeRelation() {}
+
public NodeRelation(int fromIndex, int toIndex, Neo4jEdge edge) {
super();
this.fromIndex = fromIndex;
--- /dev/null
+/*-
+ * ============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
--- /dev/null
+/*-
+ * ============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
--- /dev/null
+/*-
+ * ============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
--- /dev/null
+/*-
+ * ============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
--- /dev/null
+/*-
+ * ============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