| 9 | import java.util.*; |
| 10 | |
| 11 | public class TEST { |
| 12 | |
| 13 | public static String mapString = null; |
| 14 | |
| 15 | public static List<Integer> sourceid = new LinkedList<>(); |
| 16 | |
| 17 | public static List<Integer> sinkid = new LinkedList<>(); |
| 18 | |
| 19 | public void setMapString(String mapString) { |
| 20 | this.mapString = mapString; |
| 21 | } |
| 22 | |
| 23 | public String getMapString() { |
| 24 | return mapString; |
| 25 | } |
| 26 | |
| 27 | public static List<String[]> edgeAll = new ArrayList<>(); |
| 28 | |
| 29 | public void clearEdge(){ |
| 30 | edgeAll.clear(); |
| 31 | } |
| 32 | |
| 33 | public List<String[]> getEdgeAll() { return edgeAll; } |
| 34 | //private static HashMap<String,HashMap> map = new HashMap(); |
| 35 | private static HashMap<String,List> map = new HashMap(); |
| 36 | private static List<HashMap> resultList = new LinkedList<>(); |
| 37 | |
| 38 | public static void test() { |
| 39 | |
| 40 | int i = 1; |
| 41 | Driver driver = GraphDatabase.driver("bolt://localhost:7687", AuthTokens.basic("neo4j", "password")); |
| 42 | Session session = driver.session(); |
| 43 | |
| 44 | String jsonPath = "./src/main/resources"; |
| 45 | |
| 46 | try { |
| 47 | |
| 48 | |
| 49 | //Map<Long, Node> nodesMap = new HashMap<>(); |
| 50 | //Map<Long, Node> nodesMap = new LinkedHashMap<>(); //HashMap存入数据与取出数据顺序不一致 |
| 51 | |
| 52 | |
| 53 | String cmdSql1 = "match (source:Method {SIGNATURE:'<java.util.PriorityQueue: void readObject(java.io.ObjectInputStream)>'})\n" + |
| 54 | "match (sink:Method {SIGNATURE:'<java.lang.reflect.Method: java.lang.Object invoke(java.lang.Object,java.lang.Object[])>'})\n" + |
| 55 | "call apoc.algo.allSimplePaths(sink, source, '<CALL|ALIAS', 10) yield path \n" + |
| 56 | "return path limit 50"; |
| 57 | |
| 58 | //CC:4.0 CC2,4,8 |
| 59 | //CC:3.1 CC5,6,7,9 |
| 60 | //CC:3.2.1 CC10 |
| 61 | |
| 62 | String cmdSqlcc2 = "//cc2\n" + |
| 63 | "match path = (m1:Method {SIGNATURE:'<java.util.PriorityQueue: void readObject(java.io.ObjectInputStream)>'})-[:CALL ]->(m2:Method {NAME:'heapify'})-[:CALL ]->(m3)-[:CALL]->(m4:Method {NAME:'siftDownUsingComparator'})-[:CALL]->(m5)-[:ALIAS*]-(m6 )-[:CALL]->(m7)-[:ALIAS*]-(m8:Method)-[:CALL]->(m9:Method {IS_SINK:true}) return path"; |
| 64 | |
| 65 | String cmdSqlcc5 = "// cc5\n" + |
| 66 | "match path=(m1:Method {SIGNATURE:'<javax.management.BadAttributeValueExpException: void readObject(java.io.ObjectInputStream)>'})-[:CALL]->(m2:Method {NAME:'toString'})-[:ALIAS*]-(m3:Method {SIGNATURE:'<org.apache.commons.collections.keyvalue.TiedMapEntry: java.lang.String toString()>'})-[:CALL]->(m4:Method {NAME:'getValue'})-[:CALL]->(m5:Method {NAME:'get'})-[:ALIAS*1..2]-(m6:Method {NAME:'get'})-[:CALL]->(m7:Method {NAME:'transform'})-[:ALIAS*]-(m8:Method)-[:CALL]->(m9:Method {IS_SINK:true}) return path"; |
| 67 | |
| 68 | String cmdSqlcc6 = "//cc6cc10\n" + |
nothing calls this directly
no outgoing calls
no test coverage detected