Skip to content
This repository has been archived by the owner on Sep 6, 2023. It is now read-only.

Commit

Permalink
Merge pull request #190 from viadee/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
TamaraGunkel authored Aug 6, 2020
2 parents b722bcc + da8aec9 commit 2692892
Show file tree
Hide file tree
Showing 103 changed files with 2,868 additions and 2,171 deletions.
3 changes: 0 additions & 3 deletions docs/Checker/ProcessVariablesModelChecker.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ The rule should be configured as follows:
<rule>
<name>ProcessVariablesModelChecker</name>
<state>true</state>
<settings>
<setting name="UseStaticAnalysisBoolean">true</setting>
</settings>
</rule>

```
Expand Down
27 changes: 24 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<groupId>de.viadee</groupId>
<artifactId>viadeeProcessApplicationValidator</artifactId>

<version>3.0.5</version>
<version>3.0.6-SNAPSHOT</version>

<name>viadee Process Application Validator</name>

Expand Down Expand Up @@ -241,9 +241,9 @@
<version>4.38</version>
</dependency>
<dependency>
<groupId>ca.mcgill.sable</groupId>
<groupId>org.soot-oss</groupId>
<artifactId>soot</artifactId>
<version>4.1.0</version>
<version>4.2.1</version>
<exclusions>
<exclusion>
<groupId>ca.mcgill.sable</groupId>
Expand Down Expand Up @@ -401,6 +401,9 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<detectJavaApiLink>false</detectJavaApiLink>
</configuration>
<executions>
<execution>
<id>attach-javadocs</id>
Expand Down Expand Up @@ -448,6 +451,23 @@
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>make-assembly</id> <!-- this is used for inheritance merges -->
<phase>package</phase> <!-- bind to the packaging phase -->
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down Expand Up @@ -475,6 +495,7 @@
</plugins>
</reporting>


<distributionManagement>
<site>
<id>website</id>
Expand Down
95 changes: 47 additions & 48 deletions src/main/java/de/viadee/bpm/vPAV/FileScanner.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,25 +31,12 @@
*/
package de.viadee.bpm.vPAV;

import java.io.File;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Map;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import de.viadee.bpm.vPAV.config.model.Rule;
import de.viadee.bpm.vPAV.config.model.RuleSet;
import de.viadee.bpm.vPAV.config.model.Setting;
import de.viadee.bpm.vPAV.constants.ConfigConstants;
import de.viadee.bpm.vPAV.processing.ConfigItemNotFoundException;
import de.viadee.bpm.vPAV.processing.checker.VersioningChecker;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.filefilter.DirectoryFileFilter;
import org.apache.commons.io.filefilter.TrueFileFilter;
Expand All @@ -63,12 +50,18 @@
import org.camunda.bpm.model.dmn.DmnModelInstance;
import org.camunda.bpm.model.dmn.instance.Decision;

import de.viadee.bpm.vPAV.config.model.Rule;
import de.viadee.bpm.vPAV.config.model.RuleSet;
import de.viadee.bpm.vPAV.config.model.Setting;
import de.viadee.bpm.vPAV.constants.ConfigConstants;
import de.viadee.bpm.vPAV.processing.ConfigItemNotFoundException;
import de.viadee.bpm.vPAV.processing.checker.VersioningChecker;
import java.io.File;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.file.Paths;
import java.util.*;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;

/**
* scans maven project for files, which are necessary for the later analysis
Expand All @@ -87,8 +80,6 @@ public class FileScanner {

private Map<String, String> processIdToPathMap;

private String scanPath;

private static String scheme = null;

private static StringBuilder sootPath = new StringBuilder();
Expand All @@ -103,12 +94,12 @@ public FileScanner(final RuleSet rules) {

final DirectoryScanner scanner = new DirectoryScanner();
File basedir = null;
String basepath = ConfigConstants.getInstance().getBasepath();
String basepath = RuntimeConfig.getInstance().getBasepath();

if (basepath.startsWith("file:/")) {
// Convert URI
try {
basedir = new File(new URI(ConfigConstants.getInstance().getBasepath()));
basedir = new File(new URI(RuntimeConfig.getInstance().getBasepath()));
} catch (URISyntaxException e) {
LOGGER.log(Level.SEVERE, "URI of basedirectory seems to be malformed.", e);
}
Expand All @@ -128,8 +119,8 @@ public FileScanner(final RuleSet rules) {
System.exit(0);
}

scanPath = ConfigConstants.getInstance().getScanPath();
String filePattern = ConfigConstants.getInstance().getFilePattern();
String scanPath = RuntimeConfig.getInstance().getScanPath();
String filePattern = RuntimeConfig.getInstance().getFilePattern();

scanner.setBasedir(scanPath);
// get file paths of process definitions
Expand Down Expand Up @@ -218,7 +209,20 @@ public static void setupSootClassPaths(LinkedList<File> dirs) {
LOGGER.warning("Could not find target/classes folder");
}

for (String entry: classPathEntries) {
final String whiteListProperty = RuntimeConfig.getInstance().getWhiteList();
List<String> whitelist = Arrays.stream(whiteListProperty.split("\\s*,\\s*"))
.map(entry -> entry.replace("/", "\\\\").trim())
.collect(Collectors.toList());

for (String entry : classPathEntries) {
if (!whiteListProperty.isEmpty()) {
for (String item : whitelist) {
Pattern pattern = Pattern.compile(item);
if (pattern.matcher(entry).find()) {
addStringToSootPath(entry);
}
}
}
// retrieve all jars during runtime and pass them to get class files
if (Pattern.compile(".*target/classes.*").matcher(entry).find()
|| Pattern.compile(".*target/test-classes.*").matcher(entry).find()) {
Expand Down Expand Up @@ -346,12 +350,12 @@ private static Map<String, String> createProcessIdToPathMap(final Set<String> pa
// read bpmn file
BpmnModelInstance modelInstance;
File bpmnfile = null;
String basepath = ConfigConstants.getInstance().getBasepath();
String basepath = RuntimeConfig.getInstance().getBasepath();

if (basepath.startsWith("file:/")) {
// Convert URI
try {
bpmnfile = new File(new URI(ConfigConstants.getInstance().getBasepath() + path));
bpmnfile = new File(new URI(RuntimeConfig.getInstance().getBasepath() + path));
} catch (URISyntaxException e) {
LOGGER.log(Level.SEVERE, "URI of basedirectory seems to be malformed.", e);
}
Expand Down Expand Up @@ -393,7 +397,7 @@ private static Map<String, String> createDmnKeyToPathMap(final Set<String> paths
// read dmn file
DmnModelInstance modelInstance;
try {
modelInstance = Dmn.readModelFromFile(new File(ConfigConstants.getInstance().getBasepath() + path));
modelInstance = Dmn.readModelFromFile(new File(RuntimeConfig.getInstance().getBasepath() + path));
} catch (final DmnModelException ex) {
throw new RuntimeException("dmn model couldn't be read", ex);
}
Expand Down Expand Up @@ -502,19 +506,19 @@ private static String loadVersioningScheme(final Map<String, Map<String, Rule>>
if (rule != null && rule.isActive()) {
Setting setting = null;
final Map<String, Setting> settings = rule.getSettings();
if (settings.containsKey(ConfigConstants.VERSIONINGSCHEMECLASS)
&& !settings.containsKey(ConfigConstants.VERSIONINGSCHEMEPACKAGE)) {
setting = settings.get(ConfigConstants.VERSIONINGSCHEMECLASS);
if (settings.containsKey(ConfigConstants.VERSIONING_SCHEME_CLASS)
&& !settings.containsKey(ConfigConstants.VERSIONING_SCHEME_PACKAGE)) {
setting = settings.get(ConfigConstants.VERSIONING_SCHEME_CLASS);
isDirectory = false;
} else if (!settings.containsKey(ConfigConstants.VERSIONINGSCHEMECLASS)
&& settings.containsKey(ConfigConstants.VERSIONINGSCHEMEPACKAGE)) {
setting = settings.get(ConfigConstants.VERSIONINGSCHEMEPACKAGE);
} else if (!settings.containsKey(ConfigConstants.VERSIONING_SCHEME_CLASS)
&& settings.containsKey(ConfigConstants.VERSIONING_SCHEME_PACKAGE)) {
setting = settings.get(ConfigConstants.VERSIONING_SCHEME_PACKAGE);
isDirectory = true;
}
if (setting == null) {
throw new ConfigItemNotFoundException("VersioningChecker: Versioning Scheme could not be read. "
+ "Possible options: " + ConfigConstants.VERSIONINGSCHEMECLASS + " or "
+ ConfigConstants.VERSIONINGSCHEMEPACKAGE);
+ "Possible options: " + ConfigConstants.VERSIONING_SCHEME_CLASS + " or "
+ ConfigConstants.VERSIONING_SCHEME_PACKAGE);
} else {
scheme = setting.getValue().trim();
}
Expand Down Expand Up @@ -555,9 +559,4 @@ public static String getSootPath() {
}
return sootPath.toString().substring(0, sootPath.toString().length() - 1);
}

public void setScanPath(String scanPath) {
this.scanPath = scanPath;
}

}
Loading

0 comments on commit 2692892

Please sign in to comment.