diff --git a/src/repairnator-pipeline/src/main/java/fr/inria/spirals/repairnator/process/inspectors/ProjectInspector.java b/src/repairnator-pipeline/src/main/java/fr/inria/spirals/repairnator/process/inspectors/ProjectInspector.java index 09a8d75c4..592398ae2 100644 --- a/src/repairnator-pipeline/src/main/java/fr/inria/spirals/repairnator/process/inspectors/ProjectInspector.java +++ b/src/repairnator-pipeline/src/main/java/fr/inria/spirals/repairnator/process/inspectors/ProjectInspector.java @@ -110,11 +110,11 @@ public ProjectInspector(String workspace, List notifiers) { public ProjectInspector(BuildToBeInspected buildToBeInspected, String workspace, List 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(); this.gitHelper = new GitHelper(); diff --git a/src/repairnator-pipeline/src/test/java/fr/inria/spirals/repairnator/process/inspectors/metrics4bears/TestMetrics4BearsJsonFile.java b/src/repairnator-pipeline/src/test/java/fr/inria/spirals/repairnator/process/inspectors/metrics4bears/TestMetrics4BearsJsonFile.java index 1e3e91b6f..61a34fc8d 100644 --- a/src/repairnator-pipeline/src/test/java/fr/inria/spirals/repairnator/process/inspectors/metrics4bears/TestMetrics4BearsJsonFile.java +++ b/src/repairnator-pipeline/src/test/java/fr/inria/spirals/repairnator/process/inspectors/metrics4bears/TestMetrics4BearsJsonFile.java @@ -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); @@ -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);