Ejemplo n.º 1
0
 public void exportDependencies(File file) {
   IAnalyseService analyseService = ServiceProvider.getInstance().getAnalyseService();
   try {
     analyseService.exportDependencies(file.getAbsolutePath());
   } catch (Exception exception) {
     IControlService controlService = ServiceProvider.getInstance().getControlService();
     controlService.showErrorMessage(exception.getMessage());
   }
 }
  private Map<String, List<ActiveRuleType>> initializeAllActiveViolationTypes() {
    Map<String, List<ActiveRuleType>> activeViolationTypes =
        new HashMap<String, List<ActiveRuleType>>();

    for (String programmingLanguage : analsyseService.getAvailableLanguages()) {
      List<ActiveRuleType> activeRuleTypes = new ArrayList<ActiveRuleType>();
      activeViolationTypes.put(programmingLanguage, activeRuleTypes);

      for (List<RuleType> ruleTypes : ruletypesfactory.getRuleTypes(programmingLanguage).values()) {

        for (RuleType ruleType : ruleTypes) {
          ActiveRuleType activeRuleType = initializeActiveViolationTypes(ruleType);
          activeRuleTypes.add(activeRuleType);

          for (RuleType exceptionRuleType : ruleType.getExceptionrules()) {
            try {
              containsRuleType(activeRuleTypes, exceptionRuleType.getKey());
              activeRuleTypes.add(initializeActiveViolationTypes(exceptionRuleType));
            } catch (RuntimeException e) {

            }
          }
        }
      }
    }
    return activeViolationTypes;
  }
Ejemplo n.º 3
0
  @Override
  public void setUp() {

    ServiceProvider provider = ServiceProvider.getInstance();
    IDefineService defService = provider.getDefineService();

    String path = TestProjectFinder.lookupProject("java", "recognition");
    ArrayList<String> paths = new ArrayList<String>();
    paths.add(path);
    ArrayList<ProjectDTO> projects = new ArrayList<ProjectDTO>();
    projects.add(
        new ProjectDTO(
            "TestProject",
            new ArrayList<String>(),
            "java",
            "1.0",
            "test project for unit tests",
            new ArrayList<AnalysedModuleDTO>()));
    defService.createApplication("Java Recognition", projects, "1.0");

    service = provider.getAnalyseService();

    try {
      if (!isAnalysed) {
        service.analyseApplication(projects.get(0));
        isAnalysed = true;
      }

    } catch (Exception e) {
      System.out.println(
          "We're sorry. You need to have a java project 'benchmark_application' with inside the benchmark_application. Or you have the wrong version of the benchmark_application.");
      System.exit(0);
    }
  }
 public void initializeDefaultSeverities() {
   for (String programmingLanguage : analsyseService.getAvailableLanguages()) {
     severitiesPerTypePerProgrammingLanguage.putAll(
         initializeDefaultSeverityForLanguage(programmingLanguage));
     defaultSeveritiesPerTypePerProgrammingLanguage.putAll(
         initializeDefaultSeverityForLanguage(programmingLanguage));
   }
 }