Loading .gitignore +6 −0 Original line number Diff line number Diff line Loading @@ -9,3 +9,9 @@ dependency-reduced-pom.xml lib *.env .~lock.saref.pipeline.changes.ods# patterns saref-pipeline.env saref-pipeline.iml saref-pipeline.ipr saref-pipeline.iws saref-pipeline.iml saref-pipeline.ipr saref-pipeline.iws pom.xml +9 −1 Original line number Diff line number Diff line Loading @@ -281,6 +281,14 @@ <cleanupDaemonThreads>false</cleanupDaemonThreads> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>11</source> <target>11</target> </configuration> </plugin> </plugins> <pluginManagement> <plugins> Loading src/main/java/fr/mines_stetienne/ci/saref/checkers/AbstractClauseChecker.java +17 −3 Original line number Diff line number Diff line Loading @@ -85,11 +85,9 @@ public abstract class AbstractClauseChecker extends AbstractChecker { * If the directory does not exist, create it. directoryPath can be relative or absolute. * If the file does not exist, create it with the default contents. Creates a file of length=0 if fileContents is empty. * @param directoryPath * @param fileName * @param fileContents * @throws IOException */ public final void CreateFileInDirectoryWithContents(String directoryPath, String fileName, String[] fileContents) throws IOException { public final void CreateDirectory(String directoryPath) throws IOException { File theDir = new File(directoryPath); if (!theDir.exists()) { try { Loading @@ -98,6 +96,22 @@ public abstract class AbstractClauseChecker extends AbstractChecker { throw new IOException("Unable to create directory " + directoryPath); } } } /** * If the directory does not exist, create it. directoryPath can be relative or absolute. * If the file does not exist, create it with the default contents. Creates a file of length=0 if fileContents is empty. * @param directoryPath * @param fileName * @param fileContents * @throws IOException */ public final void CreateFileInDirectoryWithContents(String directoryPath, String fileName, String[] fileContents) throws IOException { try { CreateDirectory(directoryPath); } catch (Exception se) { return; } String fName = directoryPath + "/" + fileName; File fout = new File(fName); // implicit bw.close(). try (FileOutputStream fos = new FileOutputStream(fout); BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(fos));) { Loading src/main/java/fr/mines_stetienne/ci/saref/checkers/Clause_10_1_Checker.java +6 −9 Original line number Diff line number Diff line Loading @@ -27,8 +27,10 @@ package fr.mines_stetienne.ci.saref.checkers; import java.io.File; import java.io.IOException; import java.nio.file.Files; import fr.mines_stetienne.ci.saref.SAREFPipelineException; import fr.mines_stetienne.ci.saref.managers.RepositoryManager; import fr.mines_stetienne.ci.saref.utils.Languages; /** * Checks TS 103 673 Clause 10.1: Reference ontology pattern documentation and specification. Loading @@ -38,7 +40,7 @@ public class Clause_10_1_Checker extends AbstractClauseChecker { private static final String FIRST_LINE = "This file describes the pattern files found in this directory."; private enum MESSAGE { missing, ioexception, line ioexception, missing, name, one; } public Clause_10_1_Checker(RepositoryManager repositoryManager) { Loading @@ -57,15 +59,10 @@ public class Clause_10_1_Checker extends AbstractClauseChecker { } } try { File file = new File(dir, "pattern.ttl"); if (!file.exists()) { logError(getMessage(Clause_10_1_Checker.MESSAGE.missing)); return; if (Files.walk(dir.toPath(), 1).filter(p -> !p.toFile().isFile() && !p.toFile().getName().startsWith(".")) .count() != 1) { logError(getMessage(Clause_10_1_Checker.MESSAGE.one, repository.getProject().getOntologyFileName(Languages.TEXT_TURTLE))); } /*List<String> lines = FileUtils.readLines(file, StandardCharsets.UTF_8); if (lines.isEmpty() || !lines.get(0).equals(FIRST_LINE)) { logError(getMessage(Clause_10_1_Checker.MESSAGE.line));//<<< }*/ } catch (Exception ex) { logError(getMessage(Clause_10_1_Checker.MESSAGE.ioexception), ex); } Loading src/main/java/fr/mines_stetienne/ci/saref/checkers/Clause_10_2_Checker.java +1 −1 Original line number Diff line number Diff line Loading @@ -55,7 +55,7 @@ public class Clause_10_2_Checker extends AbstractClauseChecker { logWarning(getMessage(Clause_10_2_Checker.MESSAGE.missing)); } try { String[] lines = {}; // create empty file. String[] lines = {"# empty"}; // create empty file. CreateFileInDirectoryWithContents(patternDir, "pattern.ttl", lines); } catch (IOException ex) { logError(getMessage(Clause_10_2_Checker.MESSAGE.ioexception)); Loading Loading
.gitignore +6 −0 Original line number Diff line number Diff line Loading @@ -9,3 +9,9 @@ dependency-reduced-pom.xml lib *.env .~lock.saref.pipeline.changes.ods# patterns saref-pipeline.env saref-pipeline.iml saref-pipeline.ipr saref-pipeline.iws saref-pipeline.iml saref-pipeline.ipr saref-pipeline.iws
pom.xml +9 −1 Original line number Diff line number Diff line Loading @@ -281,6 +281,14 @@ <cleanupDaemonThreads>false</cleanupDaemonThreads> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>11</source> <target>11</target> </configuration> </plugin> </plugins> <pluginManagement> <plugins> Loading
src/main/java/fr/mines_stetienne/ci/saref/checkers/AbstractClauseChecker.java +17 −3 Original line number Diff line number Diff line Loading @@ -85,11 +85,9 @@ public abstract class AbstractClauseChecker extends AbstractChecker { * If the directory does not exist, create it. directoryPath can be relative or absolute. * If the file does not exist, create it with the default contents. Creates a file of length=0 if fileContents is empty. * @param directoryPath * @param fileName * @param fileContents * @throws IOException */ public final void CreateFileInDirectoryWithContents(String directoryPath, String fileName, String[] fileContents) throws IOException { public final void CreateDirectory(String directoryPath) throws IOException { File theDir = new File(directoryPath); if (!theDir.exists()) { try { Loading @@ -98,6 +96,22 @@ public abstract class AbstractClauseChecker extends AbstractChecker { throw new IOException("Unable to create directory " + directoryPath); } } } /** * If the directory does not exist, create it. directoryPath can be relative or absolute. * If the file does not exist, create it with the default contents. Creates a file of length=0 if fileContents is empty. * @param directoryPath * @param fileName * @param fileContents * @throws IOException */ public final void CreateFileInDirectoryWithContents(String directoryPath, String fileName, String[] fileContents) throws IOException { try { CreateDirectory(directoryPath); } catch (Exception se) { return; } String fName = directoryPath + "/" + fileName; File fout = new File(fName); // implicit bw.close(). try (FileOutputStream fos = new FileOutputStream(fout); BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(fos));) { Loading
src/main/java/fr/mines_stetienne/ci/saref/checkers/Clause_10_1_Checker.java +6 −9 Original line number Diff line number Diff line Loading @@ -27,8 +27,10 @@ package fr.mines_stetienne.ci.saref.checkers; import java.io.File; import java.io.IOException; import java.nio.file.Files; import fr.mines_stetienne.ci.saref.SAREFPipelineException; import fr.mines_stetienne.ci.saref.managers.RepositoryManager; import fr.mines_stetienne.ci.saref.utils.Languages; /** * Checks TS 103 673 Clause 10.1: Reference ontology pattern documentation and specification. Loading @@ -38,7 +40,7 @@ public class Clause_10_1_Checker extends AbstractClauseChecker { private static final String FIRST_LINE = "This file describes the pattern files found in this directory."; private enum MESSAGE { missing, ioexception, line ioexception, missing, name, one; } public Clause_10_1_Checker(RepositoryManager repositoryManager) { Loading @@ -57,15 +59,10 @@ public class Clause_10_1_Checker extends AbstractClauseChecker { } } try { File file = new File(dir, "pattern.ttl"); if (!file.exists()) { logError(getMessage(Clause_10_1_Checker.MESSAGE.missing)); return; if (Files.walk(dir.toPath(), 1).filter(p -> !p.toFile().isFile() && !p.toFile().getName().startsWith(".")) .count() != 1) { logError(getMessage(Clause_10_1_Checker.MESSAGE.one, repository.getProject().getOntologyFileName(Languages.TEXT_TURTLE))); } /*List<String> lines = FileUtils.readLines(file, StandardCharsets.UTF_8); if (lines.isEmpty() || !lines.get(0).equals(FIRST_LINE)) { logError(getMessage(Clause_10_1_Checker.MESSAGE.line));//<<< }*/ } catch (Exception ex) { logError(getMessage(Clause_10_1_Checker.MESSAGE.ioexception), ex); } Loading
src/main/java/fr/mines_stetienne/ci/saref/checkers/Clause_10_2_Checker.java +1 −1 Original line number Diff line number Diff line Loading @@ -55,7 +55,7 @@ public class Clause_10_2_Checker extends AbstractClauseChecker { logWarning(getMessage(Clause_10_2_Checker.MESSAGE.missing)); } try { String[] lines = {}; // create empty file. String[] lines = {"# empty"}; // create empty file. CreateFileInDirectoryWithContents(patternDir, "pattern.ttl", lines); } catch (IOException ex) { logError(getMessage(Clause_10_2_Checker.MESSAGE.ioexception)); Loading