Skip to content

Commit

Permalink
Fix working dir path
Browse files Browse the repository at this point in the history
Signed-off-by: André Silva <[email protected]>
  • Loading branch information
andre15silva committed May 15, 2021
1 parent 07893b7 commit 1195a0a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,11 @@ public ProjectInspector(String workspace, List<AbstractNotifier> notifiers) {

public ProjectInspector(BuildToBeInspected buildToBeInspected, String workspace, List<AbstractNotifier> notifiers) {
this.buildToBeInspected = buildToBeInspected;
this.workspace = workspace;
this.workspace = new String(workspace);
this.gitSlug = getRepoSlug();
this.repoLocalPath = workspace + File.separator + getRepoSlug();
long buildId = buildToBeInspected != null ? buildToBeInspected.getBuggyBuild().getId() : 0;
this.repoToPushLocalPath = repoLocalPath+"_topush_" + buildId;
this.repoToPushLocalPath = new String(repoLocalPath + "_topush_" + buildId);
this.m2LocalPath = new File(this.repoLocalPath + File.separator + ".m2").getAbsolutePath();
this.serializers = new ArrayList<AbstractDataSerializer>();
this.gitHelper = new GitHelper();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,14 @@ public void testBearsJsonFileWithPassingPassingBuilds() throws IOException, Proc

ObjectMapper jsonMapper = new ObjectMapper();
String workingDir = System.getProperty("user.dir");
workingDir = workingDir.substring(0, workingDir.lastIndexOf("repairnator/") + "repairnator/".length());
String jsonSchemaFilePath = workingDir + "resources/bears-schema.json";
// In CI the base dir has a diferent name, and it changes with the PR
if (workingDir.contains("repairnator/")) {
workingDir = workingDir.substring(0, workingDir.lastIndexOf("repairnator/") + "repairnator/".length());
} else {
// We use the stable part (i.e. the sub-module) to get the workingDir
workingDir = workingDir.substring(0, workingDir.lastIndexOf("src/repairnator-pipeline"));
}
String jsonSchemaFilePath = workingDir + "/resources/bears-schema.json";
File jsonSchemaFile = new File(jsonSchemaFilePath);
JsonNode schemaObject = jsonMapper.readTree(jsonSchemaFile);

Expand Down Expand Up @@ -190,8 +196,14 @@ public void testRepairnatorJsonFileWithFailingBuild() throws IOException, Proces

ObjectMapper jsonMapper = new ObjectMapper();
String workingDir = System.getProperty("user.dir");
workingDir = workingDir.substring(0, workingDir.lastIndexOf("repairnator/") + "repairnator/".length());
String jsonSchemaFilePath = workingDir + "resources/repairnator-schema.json";
// In CI the base dir has a diferent name, and it changes with the PR
if (workingDir.contains("repairnator/")) {
workingDir = workingDir.substring(0, workingDir.lastIndexOf("repairnator/") + "repairnator/".length());
} else {
// We use the stable part (i.e. the sub-module) to get the workingDir
workingDir = workingDir.substring(0, workingDir.lastIndexOf("src/repairnator-pipeline"));
}
String jsonSchemaFilePath = workingDir + "/resources/repairnator-schema.json";
File jsonSchemaFile = new File(jsonSchemaFilePath);
JsonNode schemaObject = jsonMapper.readTree(jsonSchemaFile);

Expand Down

0 comments on commit 1195a0a

Please sign in to comment.