+/*******************************************************************************\r
+ * Copyright (c) 2018 Politecnico di Torino and others.\r
+ *\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Apache License, Version 2.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *******************************************************************************/\r
+package it.polito.verigraph.grpc.tosca.test;\r
+\r
+import static org.junit.Assert.assertEquals;\r
+import static org.junit.Assert.assertNotNull;\r
+import static org.junit.Assert.fail;\r
+\r
+import java.util.ArrayList;\r
+import java.util.List;\r
+\r
+import org.junit.After;\r
+import org.junit.Before;\r
+import org.junit.FixMethodOrder;\r
+import org.junit.Test;\r
+import org.junit.runner.RunWith;\r
+import org.junit.runners.JUnit4;\r
+import org.junit.runners.MethodSorters;\r
+\r
+import it.polito.verigraph.grpc.NewTopologyTemplate;\r
+import it.polito.verigraph.grpc.NodeTemplateGrpc;\r
+import it.polito.verigraph.grpc.NodeTemplateGrpc.Type;\r
+import it.polito.verigraph.grpc.RelationshipTemplateGrpc;\r
+import it.polito.verigraph.grpc.Status;\r
+import it.polito.verigraph.grpc.TopologyTemplateGrpc;\r
+import it.polito.verigraph.grpc.ToscaConfigurationGrpc;\r
+import it.polito.verigraph.grpc.ToscaPolicy;\r
+import it.polito.verigraph.grpc.ToscaPolicy.PolicyType;\r
+import it.polito.verigraph.grpc.ToscaVerificationGrpc;\r
+import it.polito.verigraph.grpc.client.ToscaClient;\r
+import it.polito.verigraph.grpc.server.Service;\r
+\r
+@RunWith(JUnit4.class)\r
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)\r
+public class GrpcToscaTest {\r
+ private Service server;\r
+ private ToscaClient client;\r
+ private TopologyTemplateGrpc testTemplate, simpleTestTemplate;\r
+\r
+ public GrpcToscaTest() {\r
+ this.generateTestTemplate();\r
+ }\r
+\r
+ @Before\r
+ public void setUpBeforeClass() throws Exception {\r
+ client = new ToscaClient("localhost" , 50051);\r
+ server = new Service(50051);\r
+ server.start();\r
+ }\r
+\r
+ @After\r
+ public void tearDown() throws Exception {\r
+ server.stop();\r
+ client.shutdown();\r
+ }\r
+\r
+\r
+ @Test\r
+ public void test0Creation() {\r
+ System.out.println("\nTest A: Graph Creation.");\r
+\r
+ NewTopologyTemplate response = client.createTopologyTemplate(testTemplate);\r
+ assertNotNull("Returned a NULL graph", response);\r
+ assertEquals(response.getSuccess(), true);\r
+ assertEquals("Error report: " + response.getErrorMessage(), "", response.getErrorMessage());\r
+\r
+ Status resp = client.deleteTopologyTemplate(response.getTopologyTemplate().getId());\r
+ assertEquals("Error while deleting testTemplate.", true, resp.getSuccess());\r
+\r
+ System.out.println("Test A completed\n");\r
+\r
+ return;\r
+ }\r
+\r
+\r
+ @Test\r
+ public void test1Reading() {\r
+ System.out.println("\nTest B: Graph Reading.");\r
+\r
+ //Creating a test graph on remote repository\r
+ System.out.println("Phase B.1 -- Creating a test graph.");\r
+ NewTopologyTemplate response = client.createTopologyTemplate(simpleTestTemplate);\r
+ assertNotNull("Returned a NULL graph", response);\r
+ assertEquals(true, response.getSuccess());\r
+ assertEquals("Error report: " + response.getErrorMessage(), "", response.getErrorMessage());\r
+\r
+ //Reading remote graph.\r
+ System.out.println("Phase B.2 -- Reading remote graph.");\r
+ TopologyTemplateGrpc retrieved = client.getTopologyTemplate(response.getTopologyTemplate().getId());\r
+ assertNotNull("Retrieved a NULL graph", retrieved);\r
+ assertEquals(retrieved.getId(), response.getTopologyTemplate().getId());\r
+\r
+ //Nodes checking\r
+ System.out.println("Phase B.3 -- Checking graph's nodes.");\r
+ assertEquals(retrieved.getNodeTemplateCount(), 3);\r
+ assertEquals("Node1 name error", response.getTopologyTemplate().getNodeTemplateList().get(0).getName(),\r
+ retrieved.getNodeTemplateList().get(0).getName());\r
+ assertEquals("Node2 name error", response.getTopologyTemplate().getNodeTemplateList().get(1).getName(),\r
+ retrieved.getNodeTemplateList().get(1).getName());\r
+ assertEquals("Node3 name error", response.getTopologyTemplate().getNodeTemplateList().get(2).getName(),\r
+ retrieved.getNodeTemplateList().get(2).getName());\r
+\r
+ //Relationships checking\r
+ System.out.println("Phase B.4 -- Checking graph's relationships.");\r
+ assertEquals(retrieved.getRelationshipTemplateCount(), 4);\r
+ String source1=null, target1=null;\r
+ String source2=null, target2=null;\r
+ String source3=null, target3=null;\r
+ String source4=null, target4=null;\r
+ for (NodeTemplateGrpc node : retrieved.getNodeTemplateList()){\r
+ if(node.getId().equals(retrieved.getRelationshipTemplateList().get(0).getIdSourceNodeTemplate()))\r
+ source1=node.getName();\r
+ if(node.getId().equals(retrieved.getRelationshipTemplateList().get(0).getIdTargetNodeTemplate()))\r
+ target1=node.getName();\r
+ if(node.getId().equals(retrieved.getRelationshipTemplateList().get(1).getIdSourceNodeTemplate()))\r
+ source2=node.getName();\r
+ if(node.getId().equals(retrieved.getRelationshipTemplateList().get(1).getIdTargetNodeTemplate()))\r
+ target2=node.getName();\r
+ if(node.getId().equals(retrieved.getRelationshipTemplateList().get(2).getIdSourceNodeTemplate()))\r
+ source3=node.getName();\r
+ if(node.getId().equals(retrieved.getRelationshipTemplateList().get(2).getIdTargetNodeTemplate()))\r
+ target3=node.getName();\r
+ if(node.getId().equals(retrieved.getRelationshipTemplateList().get(3).getIdSourceNodeTemplate()))\r
+ source4=node.getName();\r
+ if(node.getId().equals(retrieved.getRelationshipTemplateList().get(3).getIdTargetNodeTemplate()))\r
+ target4=node.getName();\r
+ }\r
+\r
+ assertEquals("Relat1 name error", retrieved.getRelationshipTemplateList().get(0).getName(), source1+"to"+target1);\r
+ assertEquals("Relat2 name error", retrieved.getRelationshipTemplateList().get(1).getName(), source2+"to"+target2);\r
+ assertEquals("Relat3 name error", retrieved.getRelationshipTemplateList().get(2).getName(), source3+"to"+target3);\r
+ assertEquals("Relat4 name error", retrieved.getRelationshipTemplateList().get(3).getName(), source4+"to"+target4);\r
+\r
+ System.out.println("Phase B.5 -- Deleting graph.");\r
+ Status resp = client.deleteTopologyTemplate(response.getTopologyTemplate().getId());\r
+ assertEquals("Error while deleting simpleTestTemplate", true, resp.getSuccess());\r
+\r
+\r
+ System.out.println("Test B completed.\n");\r
+ return;\r
+ }\r
+\r
+ @Test\r
+ public void test2Update() {\r
+ System.out.println("\nTest C: Update.");\r
+\r
+ //Creating a test graph on remote repository\r
+ System.out.println("Phase C.1 -- Creating a test graph.");\r
+ NewTopologyTemplate response = client.createTopologyTemplate(simpleTestTemplate);\r
+ assertNotNull("Returned a NULL graph", response);\r
+ assertEquals(true, response.getSuccess());\r
+ assertEquals("Error report: " + response.getErrorMessage(), "", response.getErrorMessage());\r
+\r
+ //Reading remote graph.\r
+ System.out.println("Phase C.2 -- Reading remote graph.");\r
+ TopologyTemplateGrpc retrieved = client.getTopologyTemplate(response.getTopologyTemplate().getId());\r
+ assertNotNull("Retrieved a NULL graph", retrieved);\r
+ assertEquals(retrieved.getId(), response.getTopologyTemplate().getId());\r
+\r
+ //Updating a TopologyTemplateGrpc\r
+ System.out.println("Phase C.3 -- Updating a test graph.");\r
+ TopologyTemplateGrpc.Builder templ = TopologyTemplateGrpc.newBuilder();\r
+ List<NodeTemplateGrpc> nodes = new ArrayList<NodeTemplateGrpc>();\r
+ List<RelationshipTemplateGrpc> relats = new ArrayList<RelationshipTemplateGrpc>();\r
+\r
+ ToscaConfigurationGrpc node1conf = ToscaConfigurationGrpc.newBuilder().setDescription("node1configuration")\r
+ .setId("15").setConfiguration("[]").build();\r
+ NodeTemplateGrpc node1 = NodeTemplateGrpc.newBuilder().setConfiguration(node1conf).setId("999")\r
+ .setName("webserver1").setType(Type.webserver).build();\r
+ nodes.add(node1);\r
+\r
+ ToscaConfigurationGrpc node2conf = ToscaConfigurationGrpc.newBuilder().setDescription("node2configuration")\r
+ .setId("16").setConfiguration("[{\r\n\"protocol\":\"HTTP_REQUEST\",\r\n \"url\":\"www.facebook.com\"\r\n }]").build();\r
+ NodeTemplateGrpc node2 = NodeTemplateGrpc.newBuilder().setConfiguration(node2conf).setId("888")\r
+ .setName("host2").setType(Type.endhost).build();\r
+ nodes.add(node2);\r
+\r
+ RelationshipTemplateGrpc rel0 = RelationshipTemplateGrpc.newBuilder().setId("1001")\r
+ .setIdSourceNodeTemplate("999").setIdTargetNodeTemplate("888").setName("webserver1tohost2").build();\r
+ relats.add(rel0);\r
+\r
+ RelationshipTemplateGrpc rel1 = RelationshipTemplateGrpc.newBuilder().setId("1002")\r
+ .setIdSourceNodeTemplate("888").setIdTargetNodeTemplate("999").setName("host2towebserver1").build();\r
+ relats.add(rel1);\r
+\r
+ TopologyTemplateGrpc newTestTemplate = templ.addAllNodeTemplate(nodes).addAllRelationshipTemplate(relats).setId("9").build();\r
+ NewTopologyTemplate updated = client.updateTopologyTemplate(newTestTemplate, response.getTopologyTemplate().getId());\r
+ assertNotNull("Returned a NULL graph", updated);\r
+ assertEquals(true, updated.getSuccess());\r
+ assertEquals("Error report: " + updated.getErrorMessage(), "", updated.getErrorMessage());\r
+\r
+ //Reading remote graph.\r
+ System.out.println("Phase C.4 -- Reading remote graph.");\r
+ TopologyTemplateGrpc retrieved2 = client.getTopologyTemplate(response.getTopologyTemplate().getId());\r
+ assertNotNull("Retrieved a NULL graph", retrieved2);\r
+ assertEquals(retrieved2.getId(), response.getTopologyTemplate().getId());\r
+\r
+ //Nodes checking\r
+ System.out.println("Phase C.5 -- Checking updated graph's nodes.");\r
+ assertEquals(retrieved2.getNodeTemplateCount(), 2);\r
+ assertEquals("Node1 name error", updated.getTopologyTemplate().getNodeTemplateList().get(0).getName(),\r
+ retrieved2.getNodeTemplateList().get(0).getName());\r
+ assertEquals("Node2 name error", updated.getTopologyTemplate().getNodeTemplateList().get(1).getName(),\r
+ retrieved2.getNodeTemplateList().get(1).getName());\r
+\r
+ //Relationships checking\r
+ System.out.println("Phase C.6 -- Checking updated graph's relationships.");\r
+ assertEquals(retrieved2.getRelationshipTemplateCount(), 2);\r
+ String source1=null, target1=null;\r
+ String source2=null, target2=null;\r
+ for (NodeTemplateGrpc node : retrieved2.getNodeTemplateList()){\r
+ if(node.getId().equals(retrieved2.getRelationshipTemplateList().get(0).getIdSourceNodeTemplate()))\r
+ source1=node.getName();\r
+ if(node.getId().equals(retrieved2.getRelationshipTemplateList().get(0).getIdTargetNodeTemplate()))\r
+ target1=node.getName();\r
+ if(node.getId().equals(retrieved2.getRelationshipTemplateList().get(1).getIdSourceNodeTemplate()))\r
+ source2=node.getName();\r
+ if(node.getId().equals(retrieved2.getRelationshipTemplateList().get(1).getIdTargetNodeTemplate()))\r
+ target2=node.getName();\r
+ }\r
+\r
+ assertEquals("Relat1 name error", retrieved2.getRelationshipTemplateList().get(0).getName(), source1+"to"+target1);\r
+ assertEquals("Relat2 name error", retrieved2.getRelationshipTemplateList().get(1).getName(), source2+"to"+target2);\r
+\r
+ System.out.println("Phase C.6 -- Deleting graph.");\r
+ Status resp = client.deleteTopologyTemplate(updated.getTopologyTemplate().getId());\r
+ assertEquals("Error while deleting simpleTestTemplate", true, resp.getSuccess());\r
+\r
+ System.out.println("Test C completed.\n");\r
+ return;\r
+ }\r
+\r
+\r
+ @Test\r
+ public void test3Verification() {\r
+ System.out.println("\nTest D: Verification.");\r
+ NewTopologyTemplate response = client.createTopologyTemplate(testTemplate);\r
+ if(response == null | response.getSuccess() != true) {\r
+ fail("Test failed, unable to load the graph.");\r
+ return;\r
+ }\r
+\r
+ //The Id of the graph on which we are going to perform tests\r
+ String testTemplateId = response.getTopologyTemplate().getId();\r
+\r
+ //REACHABILITY test\r
+ System.out.println("Phase 1.1 - Reachability SAT.");\r
+ ToscaPolicy policy = ToscaPolicy.newBuilder().setIdTopologyTemplate(testTemplateId)\r
+ .setType(PolicyType.reachability).setSource("host2").setDestination("host1").build();\r
+ ToscaVerificationGrpc result = client.verifyPolicy(policy);\r
+ assertNotNull("There was no response", result);\r
+ assertEquals("Unexpected result : " + result.getResult() + " - " + result.getComment(), "SAT", result.getResult());\r
+ assertEquals("Error report: " + result.getErrorMessage(), "", result.getErrorMessage());\r
+\r
+ result = null;\r
+ System.out.println("Phase 1.2 - Reachability UNSAT.");\r
+ policy = ToscaPolicy.newBuilder().setIdTopologyTemplate(testTemplateId)\r
+ .setType(PolicyType.reachability).setSource("host1").setDestination("antispamNode1").build();\r
+ result = client.verifyPolicy(policy);\r
+ assertNotNull("There was no response", result);\r
+ assertEquals("Unexpected result : " + result.getResult() + " - " + result.getComment(), "UNSAT", result.getResult());\r
+ assertEquals("Error report: " + result.getErrorMessage(), "", result.getErrorMessage());\r
+\r
+ //ISOLATION test\r
+ result = null;\r
+ System.out.println("Phase 2.1 - Isolation SAT.");\r
+ policy = ToscaPolicy.newBuilder().setIdTopologyTemplate(testTemplateId)\r
+ .setType(PolicyType.isolation).setSource("host2").setDestination("host1").setMiddlebox("webserver1").build();\r
+ result = client.verifyPolicy(policy);\r
+ assertNotNull("There was no response", result);\r
+ assertEquals("Unexpected result : " + result.getResult() + " - " + result.getComment(), "SAT", result.getResult());\r
+ assertEquals("Error report: " + result.getErrorMessage(), "", result.getErrorMessage());\r
+\r
+ System.out.println("Phase 2.2 - Isolation UNSAT.");\r
+ policy = ToscaPolicy.newBuilder().setIdTopologyTemplate(testTemplateId)\r
+ .setType(PolicyType.isolation).setSource("host2").setDestination("host1").setMiddlebox("fw").build();\r
+ result = client.verifyPolicy(policy);\r
+ assertNotNull("There was no response", result);\r
+ assertEquals("Unexpected result : " + result.getResult() + " - " + result.getComment(), "UNSAT", result.getResult());\r
+ assertEquals("Error report: " + result.getErrorMessage(), "", result.getErrorMessage());\r
+\r
+ //TRAVERSAL test\r
+ result = null;\r
+ System.out.println("Phase 3.1 - Traversal SAT.");\r
+ policy = ToscaPolicy.newBuilder().setIdTopologyTemplate(testTemplateId)\r
+ .setType(PolicyType.traversal).setSource("host2").setDestination("host1").setMiddlebox("fw").build();\r
+ result = client.verifyPolicy(policy);\r
+ assertNotNull("There was no response", result);\r
+ assertEquals("Unexpected result : " + result.getResult() + " - " + result.getComment(), "SAT", result.getResult());\r
+ assertEquals("Error report: " + result.getErrorMessage(), "", result.getErrorMessage());\r
+\r
+ System.out.println("Phase 3.2 - Traversal UNSAT.");\r
+ policy = ToscaPolicy.newBuilder().setIdTopologyTemplate(testTemplateId)\r
+ .setType(PolicyType.traversal).setSource("host2").setDestination("webserver1").setMiddlebox("fw").build();\r
+ result = client.verifyPolicy(policy);\r
+ assertNotNull("There was no response", result);\r
+ assertEquals("Unexpected result : " + result.getResult() + " - " + result.getComment(), "UNSAT", result.getResult());\r
+ assertEquals("Error report: " + result.getErrorMessage(), "", result.getErrorMessage());\r
+\r
+ Status resp = client.deleteTopologyTemplate(testTemplateId);\r
+ assertEquals("Error while deleting testTemplate", true, resp.getSuccess());\r
+\r
+ System.out.println("Test D completed.\n");\r
+ return;\r
+ }\r
+\r
+\r
+ @Test\r
+ public void test4Deletion() {\r
+ System.out.println("\nTest E: Deletion");\r
+ NewTopologyTemplate templ = client.createTopologyTemplate(testTemplate);\r
+\r
+ if(templ.getSuccess() != true) {\r
+ fail("Unable to create the graph.");\r
+ return;\r
+ }else {\r
+ Status resp = client.deleteTopologyTemplate(templ.getTopologyTemplate().getId());\r
+ assertEquals("Error while deleting testTemplate", true, resp.getSuccess());\r
+ }\r
+\r
+ System.out.println("Test E completed.\n");\r
+ return;\r
+ }\r
+\r
+\r
+ //Generates a correct instance of a TopologyTemplateGrpc to be used in tests\r
+ public void generateTestTemplate() {\r
+ TopologyTemplateGrpc.Builder templ = TopologyTemplateGrpc.newBuilder();\r
+ List<NodeTemplateGrpc> nodes = new ArrayList<NodeTemplateGrpc>();\r
+ List<RelationshipTemplateGrpc> relats = new ArrayList<RelationshipTemplateGrpc>();\r
+\r
+ //Definition of nodes\r
+ ToscaConfigurationGrpc node0conf = ToscaConfigurationGrpc.newBuilder().setDescription("node0configuration")\r
+ .setId("100").setConfiguration("[{\r\n\"webserver1\":\"host2\"\r\n}]").build();\r
+ NodeTemplateGrpc node0 = NodeTemplateGrpc.newBuilder().setConfiguration(node0conf).setId("100")\r
+ .setName("fw").setType(Type.firewall).build();\r
+ nodes.add(node0);\r
+\r
+ ToscaConfigurationGrpc node1conf = ToscaConfigurationGrpc.newBuilder().setDescription("node1configuration")\r
+ .setId("101").setConfiguration("[]").build();\r
+ NodeTemplateGrpc node1 = NodeTemplateGrpc.newBuilder().setConfiguration(node1conf).setId("101")\r
+ .setName("webserver1").setType(Type.webserver).build();\r
+ nodes.add(node1);\r
+\r
+ ToscaConfigurationGrpc node2conf = ToscaConfigurationGrpc.newBuilder().setDescription("node2configuration")\r
+ .setId("102").setConfiguration("[{\r\n\"protocol\":\"HTTP_REQUEST\",\r\n \"url\":\"www.facebook.com\"\r\n }]").build();\r
+ NodeTemplateGrpc node2 = NodeTemplateGrpc.newBuilder().setConfiguration(node2conf).setId("102")\r
+ .setName("host2").setType(Type.endhost).build();\r
+ nodes.add(node2);\r
+\r
+ ToscaConfigurationGrpc node3conf = ToscaConfigurationGrpc.newBuilder().setDescription("node3configuration")\r
+ .setId("103").setConfiguration("[ {\r\n\"protocol\":\"HTTP_REQUEST\",\r\n\"url\":\"www.google.com\",\r\n\"destination\":\"server1\"\r\n}]").build();\r
+ NodeTemplateGrpc node3 = NodeTemplateGrpc.newBuilder().setConfiguration(node3conf).setId("103")\r
+ .setName("host1").setType(Type.endhost).build();\r
+ nodes.add(node3);\r
+\r
+ ToscaConfigurationGrpc node4conf = ToscaConfigurationGrpc.newBuilder().setDescription("node4configuration")\r
+ .setId("104").setConfiguration("[\"host1\",\"host2\"]").build();\r
+ NodeTemplateGrpc node4 = NodeTemplateGrpc.newBuilder().setConfiguration(node4conf).setId("104")\r
+ .setName("antispamNode1").setType(Type.antispam).build();\r
+ nodes.add(node4);\r
+\r
+ //Building relationships\r
+ RelationshipTemplateGrpc rel0 = RelationshipTemplateGrpc.newBuilder().setId("1001")\r
+ .setIdSourceNodeTemplate("100").setIdTargetNodeTemplate("101").setName("fwToServ1").build();\r
+ relats.add(rel0);\r
+\r
+ RelationshipTemplateGrpc rel1 = RelationshipTemplateGrpc.newBuilder().setId("1002")\r
+ .setIdSourceNodeTemplate("101").setIdTargetNodeTemplate("100").setName("serv1ToFw").build();\r
+ relats.add(rel1);\r
+\r
+ RelationshipTemplateGrpc rel2 = RelationshipTemplateGrpc.newBuilder().setId("1003")\r
+ .setIdSourceNodeTemplate("100").setIdTargetNodeTemplate("103").setName("fwToHost1").build();\r
+ relats.add(rel2);\r
+\r
+ RelationshipTemplateGrpc rel3 = RelationshipTemplateGrpc.newBuilder().setId("1004")\r
+ .setIdSourceNodeTemplate("100").setIdTargetNodeTemplate("102").setName("fwToHost2").build();\r
+ relats.add(rel3);\r
+\r
+ RelationshipTemplateGrpc rel4 = RelationshipTemplateGrpc.newBuilder().setId("1005")\r
+ .setIdSourceNodeTemplate("102").setIdTargetNodeTemplate("100").setName("Host2Tofw").build();\r
+ relats.add(rel4);\r
+\r
+ RelationshipTemplateGrpc rel5 = RelationshipTemplateGrpc.newBuilder().setId("1006")\r
+ .setIdSourceNodeTemplate("103").setIdTargetNodeTemplate("100").setName("Host1Tofw").build();\r
+ relats.add(rel5);\r
+\r
+ this.testTemplate = templ.addAllNodeTemplate(nodes).addAllRelationshipTemplate(relats).setId("0").build();\r
+\r
+ TopologyTemplateGrpc.Builder templ2 = TopologyTemplateGrpc.newBuilder();\r
+ List<NodeTemplateGrpc> nodes2 = new ArrayList<NodeTemplateGrpc>();\r
+ List<RelationshipTemplateGrpc> relats2 = new ArrayList<RelationshipTemplateGrpc>();\r
+ nodes2.add(node0);\r
+ nodes2.add(node1);\r
+ nodes2.add(node2);\r
+ relats2.add(rel0);\r
+ relats2.add(rel1);\r
+ relats2.add(rel3);\r
+ relats2.add(rel4);\r
+\r
+ this.simpleTestTemplate = templ2.addAllNodeTemplate(nodes2).addAllRelationshipTemplate(relats2).setId("1").build();\r
+\r
+ }\r
+\r
+ /*class NodeTemplateGrpcComparator implements Comparator<NodeTemplateGrpc> {\r
+ public int compare(NodeTemplateGrpc n0, NodeTemplateGrpc n1) {\r
+ return n0.getName().compareTo(n1.getName());\r
+ }\r
+ }\r
+\r
+ class RelationshipTemplateGrpcComparator implements Comparator<RelationshipTemplateGrpc> {\r
+ public int compare(RelationshipTemplateGrpc n0, RelationshipTemplateGrpc n1) {\r
+ int source = n0.getIdSourceNodeTemplate().compareTo(n1.getIdSourceNodeTemplate());\r
+ int target = n0.getIdTargetNodeTemplate().compareTo(n1.getIdTargetNodeTemplate());\r
+ return source + target;\r
+ }\r
+ }*/\r
+\r
+}\r