Exemple #1
0
        public void GenerateBiGramWithExclusion()
        {
            string dataRoot   = @"../../Data/ExecutionTraces/JPDA/";
            string traceFile  = dataRoot + "trace.jdpa";
            string oracleFile = dataRoot + "trace.bigrams";
            string methodFile = dataRoot + "trace.include";

            IEnumerable <string> rawMethods    = Generics.ImportStrings(methodFile);
            HashSet <string>     prunedMethods = new HashSet <string>();

            foreach (string rawMethod in rawMethods)
            {
                prunedMethods.Add(rawMethod.Substring(0, rawMethod.IndexOf('(')));
            }
            //Console.WriteLine("Number of methods: {0}", prunedMethods.Count);

            BiGramCollection bigrams = JPDA.GenerateBiGrams(traceFile, prunedMethods);
            BiGramCollection oracle  = BiGrams.Import(oracleFile);

            Assert.AreEqual(oracle.Count, bigrams.Count);

            for (int i = 0; i < oracle.Count; i++)
            {
                //Console.WriteLine(String.Format("{0} -> {1} : {2} -> {3}", oracle[i].Caller, oracle[i].Callee, bigrams[i].Caller, bigrams[i].Callee));
                Assert.AreEqual(oracle[i].Caller, bigrams[i].Caller);
                Assert.AreEqual(oracle[i].Callee, bigrams[i].Callee);
            }
        }
Exemple #2
0
        internal static PDG GeneratePDG(string traceFile, IEnumerable <string> rawMethods)
        {
            Console.WriteLine("Generating input PDG...");
            HashSet <string> prunedMethods = new HashSet <string>();

            foreach (string rawMethod in rawMethods)
            {
                prunedMethods.Add(rawMethod.Substring(0, rawMethod.IndexOf('(')));
            }
            return(PDG.Convert(JPDA.GenerateBiGrams(traceFile, prunedMethods)));
        }
Exemple #3
0
        public override void Compute()
        {
            string traceID = (string)Workspace.Load("TraceID");
            TLArtifactsCollection artifacts = (TLArtifactsCollection)Workspace.Load("Artifacts");
            BiGramCollection      bigrams   = JPDA.GenerateBiGrams(Path.Combine(_config.TraceDirectory, traceID), new HashSet <string>(artifacts.Keys));
            PDG           pdg    = PDG.Convert(bigrams);
            ISet <string> unique = JPDA.GenerateUniqueMethods(Path.Combine(_config.TraceDirectory, traceID));

            Workspace.Store("PDG", pdg);
            Workspace.Store("UniqueMethods", unique);
        }