@Override
 public Object execute(ExecutionEvent event) throws ExecutionException {
   Graph<Integer> graph = Activator.getDefault().getSourceGraphController().getSourceGraph();
   Set<Path<Integer>> paths = new GenerateTestPaths<Integer>(graph).getTestPaths();
   if (paths != null && !paths.isEmpty()) {
     for (Path<Integer> newTestPath : paths)
       Activator.getDefault().getTestPathController().addTestPath(newTestPath, TestType.AUTOMATIC);
   }
   return null;
 }
示例#2
0
 @SuppressWarnings("unchecked")
 @Override
 public Set<AbstractPath<V>> getTestRequirements() {
   Set<AbstractPath<V>> paths = new AllDuPathsCoverage<V>(graph).getTestRequirements();
   Map<String, List<List<Object>>> defusesByVariable =
       Activator.getDefault().getDefUsesController().getDefUsesByVariable();
   Set<AbstractPath<V>> result = new TreeSet<AbstractPath<V>>();
   for (String key : defusesByVariable.keySet()) {
     nodes.clear();
     List<List<Object>> variableDefUses = defusesByVariable.get(key);
     List<Object> defs = variableDefUses.get(0);
     List<Object> uses = variableDefUses.get(1);
     for (AbstractPath<V> path : paths)
       if (isTestRequirement(defs, uses, path))
         for (Object obj : defs) {
           Node<V> node;
           if (obj instanceof Edge<?>) node = ((Edge<V>) obj).getBeginNode();
           else node = ((Node<V>) obj);
           if (node == path.from() && !nodes.contains(node)) {
             nodes.add(node);
             result.add(path);
           }
         }
   }
   return result;
 }