public EnvironmentTestClusterAugmenter(TestCluster cluster) { this.cluster = cluster; testClusterGenerator = TestGenerationContext.getInstance().getTestClusterGenerator(); // testClusterGenerator = new TestClusterGenerator(cluster.getInheritanceTree()); this.handledClasses = new LinkedHashSet<>(); }
private static void analyze(String className, List<String> classPath) throws RuntimeException, ClassNotFoundException { if (!inheritanceTree.hasClass(Properties.TARGET_CLASS)) { throw new ClassNotFoundException("Target class not found in inheritance tree"); } logger.debug("Calculate call tree"); CallGraph callGraph = CallGraphGenerator.analyze(className); callGraphs.put(className, callGraph); loadCallTreeClasses(callGraph); // include all the project classes in the inheritance tree and in the callgraph. if (ArrayUtil.contains(Properties.CRITERION, Criterion.IBRANCH) || Properties.INSTRUMENT_CONTEXT) { for (String classn : inheritanceTree.getAllClasses()) { if (isTargetProject(classn)) { CallGraphGenerator.analyzeOtherClasses(callGraph, classn); } } } // TODO: Need to make sure that all classes in calltree are instrumented logger.debug("Update call tree with calls to overridden methods"); CallGraphGenerator.update(callGraph, inheritanceTree); logger.debug("Create test cluster"); // if a class is not instrumented but part of the callgraph, the // generateCluster method will instrument it // update: we instrument only classes reachable from the class // under test, the callgraph is populated with all classes, but only the // set of relevant ones are instrumented - mattia TestGenerationContext.getInstance().getTestClusterGenerator().generateCluster(callGraph); gatherStatistics(); }
TestClusterGenerator clusterGenerator = TestGenerationContext.getInstance().getTestClusterGenerator(); Class<?> mock = MockList.getMockClass(clazz.getRawClass().getCanonicalName()); if (mock != null) {
testClusterGenerator = TestGenerationContext.getInstance().getTestClusterGenerator();