* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.onap.aai.rest;
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.Matchers.not;
+import static org.junit.Assert.assertThat;
+
+import java.io.IOException;
+import java.util.UUID;
+
+import javax.ws.rs.core.Response;
+
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
import org.apache.tinkerpop.gremlin.structure.Edge;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.onap.aai.exceptions.AAIException;
import org.onap.aai.serialization.engines.QueryStyle;
-import javax.ws.rs.core.Response;
-import java.io.IOException;
-import java.util.UUID;
-
-import static org.hamcrest.CoreMatchers.containsString;
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.Matchers.not;
-import static org.junit.Assert.assertThat;
-
public class EdgeNotValidAnymoreTest extends AAISetup {
private HttpTestUtil testUtil;
@Before
public void setupData() throws IOException, AAIException {
- String cloudRegionEndpoint = "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/junit-cloud-owner-with-vlan/junit-cloud-region-with-vlan";
+ String cloudRegionEndpoint =
+ "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/junit-cloud-owner-with-vlan/junit-cloud-region-with-vlan";
String cloudRegionBody = PayloadUtil.getResourcePayload("cloud-region-with-vlan.json");
testUtil = new HttpTestUtil(QueryStyle.TRAVERSAL_URI);
JanusGraphTransaction transaction = AAIGraph.getInstance().getGraph().newTransaction();
GraphTraversalSource g = transaction.traversal();
- Vertex configurationVertex = g.addV()
- .property( AAIProperties.NODE_TYPE, "configuration")
- .property( "configuration-id", "ci1")
- .property( "configuration-type", "ci1")
- .property( AAIProperties.AAI_URI, "/network/configurations/configuration/ci1")
- .property(AAIProperties.SOURCE_OF_TRUTH, "JUNIT")
- .next();
+ Vertex configurationVertex = g.addV().property(AAIProperties.NODE_TYPE, "configuration")
+ .property("configuration-id", "ci1").property("configuration-type", "ci1")
+ .property(AAIProperties.AAI_URI, "/network/configurations/configuration/ci1")
+ .property(AAIProperties.SOURCE_OF_TRUTH, "JUNIT").next();
- Vertex vlanVertex = g.V()
- .has("vlan-interface", "test-vlan-interface-1")
- .has(AAIProperties.NODE_TYPE, "vlan")
- .next();
+ Vertex vlanVertex =
+ g.V().has("vlan-interface", "test-vlan-interface-1").has(AAIProperties.NODE_TYPE, "vlan").next();
Edge edge = configurationVertex.addEdge("org.onap.relationships.inventory.PartOf", vlanVertex);
addEdge(edge);
}
@After
- public void teardown(){
+ public void teardown() {
JanusGraph janusGraph = AAIGraph.getInstance().getGraph();
JanusGraphTransaction transaction = janusGraph.newTransaction();
GraphTraversalSource g = transaction.traversal();
- g.V()
- .has(AAIProperties.SOURCE_OF_TRUTH, "JUNIT")
- .toList()
- .forEach((edge) -> edge.remove());
+ g.V().has(AAIProperties.SOURCE_OF_TRUTH, "JUNIT").toList().forEach((edge) -> edge.remove());
transaction.commit();
}