From fe46988749656f914f8f8f955bfc17edd93f9e24 Mon Sep 17 00:00:00 2001 From: Omar ALQAWASMEH Date: Thu, 2 Apr 2020 19:09:21 +0200 Subject: [PATCH] GUI with respect to latest changes --- pom.xml | 44 +- report_output.xml | 2 + .../emse/gitlab/saref/JTextAreaAppender.java | 115 +++++ src/main/java/fr/emse/gitlab/saref/Main.java | 452 ++++++++++++++---- src/main/resources/GUI/select_btn.png | Bin 0 -> 2441 bytes src/main/resources/GUI/start_btn.png | Bin 0 -> 3038 bytes 6 files changed, 522 insertions(+), 91 deletions(-) create mode 100644 report_output.xml create mode 100644 src/main/java/fr/emse/gitlab/saref/JTextAreaAppender.java create mode 100644 src/main/resources/GUI/select_btn.png create mode 100644 src/main/resources/GUI/start_btn.png diff --git a/pom.xml b/pom.xml index bff5530..7ea7f4e 100644 --- a/pom.xml +++ b/pom.xml @@ -170,6 +170,12 @@ 1.4.5.519 + + org.openjfx + javafx-controls + 11 + + @@ -181,7 +187,7 @@ static false - + src/main/static/assembly.xml ${project.build.outputDirectory} @@ -247,5 +253,41 @@ + + + + + org.eclipse.m2e + lifecycle-mapping + 1.0.0 + + + + + + + org.apache.maven.plugins + + + maven-assembly-plugin + + + [3.2.0,) + + + single + + + + + + + + + + + + diff --git a/report_output.xml b/report_output.xml new file mode 100644 index 0000000..6bb8f9a --- /dev/null +++ b/report_output.xml @@ -0,0 +1,2 @@ + + diff --git a/src/main/java/fr/emse/gitlab/saref/JTextAreaAppender.java b/src/main/java/fr/emse/gitlab/saref/JTextAreaAppender.java new file mode 100644 index 0000000..8784d10 --- /dev/null +++ b/src/main/java/fr/emse/gitlab/saref/JTextAreaAppender.java @@ -0,0 +1,115 @@ +/** + * + */ +package fr.emse.gitlab.saref; + +import javax.swing.JComponent; +import javax.swing.JTextArea; + +import org.apache.log4j.AppenderSkeleton; +import org.apache.log4j.Layout; +import org.apache.log4j.spi.LoggingEvent; + +import org.apache.commons.lang3.ArrayUtils; +import org.apache.log4j.spi.ErrorCode; + +/** + * @author Omar Qawasmeh + * + * @organization Ecole des Mines de Saint Etienne + */ +/* + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * The Original Code is 'JSignPdf, a free application for PDF signing'. + * + * The Initial Developer of the Original Code is Josef Cacek. Portions created + * by Josef Cacek are Copyright (C) Josef Cacek. All Rights Reserved. + * + * Contributor(s): Josef Cacek. + * + * Alternatively, the contents of this file may be used under the terms of the + * GNU Lesser General Public License, version 2.1 (the "LGPL License"), in which + * case the provisions of LGPL License are applicable instead of those above. If + * you wish to allow use of your version of this file only under the terms of + * the LGPL License and not to allow others to use your version of this file + * under the MPL, indicate your decision by deleting the provisions above and + * replace them with the notice and other provisions required by the LGPL + * License. If you do not delete the provisions above, a recipient may use your + * version of this file under either the MPL or the LGPL License. + */ + +public class JTextAreaAppender extends AppenderSkeleton { + String NEW_LINE = System.getProperty("line.separator"); + private JTextArea jTextArea; + + /** + * Constructor. + * + * @param jTextArea + */ + public JTextAreaAppender(final JTextArea jTextArea) { + if (jTextArea == null) { + throw new IllegalArgumentException("JTextArea has to be not-null."); + } + this.jTextArea = jTextArea; + } + + /* + * (non-Javadoc) + * + * @see org.apache.log4j.Appender#close() + */ + public void close() { + jTextArea = null; + } + + /* + * (non-Javadoc) + * + * @see org.apache.log4j.Appender#requiresLayout() + */ + public boolean requiresLayout() { + return true; + } + + /* + * (non-Javadoc) + * + * @see + * org.apache.log4j.AppenderSkeleton#append(org.apache.log4j.spi.LoggingEvent) + */ + +// protected void append(LoggingEvent event) +// { +// if(event.getLevel().equals(Level.INFO)){ +// jTextA.append(event.getMessage().toString()); +// } +// } + @Override + protected void append(LoggingEvent event) { + if (layout == null) { + errorHandler.error("No layout for appender " + name, null, ErrorCode.MISSING_LAYOUT); + return; + } + final String message = layout.format(event); + jTextArea.append(message); + + // TODO do we need this code + if (layout.ignoresThrowable()) { + for (String throwableRow : ArrayUtils.nullToEmpty(event.getThrowableStrRep())) { + jTextArea.append(throwableRow + NEW_LINE); + } + } + // scroll TextArea + jTextArea.setCaretPosition(jTextArea.getText().length()); + } + +} + diff --git a/src/main/java/fr/emse/gitlab/saref/Main.java b/src/main/java/fr/emse/gitlab/saref/Main.java index ac27c98..0a7c4dc 100644 --- a/src/main/java/fr/emse/gitlab/saref/Main.java +++ b/src/main/java/fr/emse/gitlab/saref/Main.java @@ -2,7 +2,12 @@ package fr.emse.gitlab.saref; import static fr.emse.gitlab.saref.CMDConfigurations.*; +import java.awt.BorderLayout; import java.awt.Desktop; +import java.awt.FlowLayout; +import java.awt.GridLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; @@ -24,6 +29,17 @@ import java.util.Iterator; import java.util.List; import java.util.Map; +import javax.swing.JButton; +import javax.swing.JCheckBox; +import javax.swing.JFileChooser; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTextArea; +import javax.swing.SwingUtilities; +import javax.swing.WindowConstants; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; import javax.xml.bind.Marshaller; @@ -97,7 +113,6 @@ public class Main { private static Dataset dataset; private static Var VAR_TEST_SUITES = VarUtils.allocVar("testsuites"); - static boolean remoteOnly; static boolean ignoreGit; static boolean includeMaster; @@ -105,76 +120,93 @@ public class Main { static boolean ignoreTerms; static boolean ignoreExamples; static boolean verbose; - - - - public static void main(String[] args) - throws IOException, InterruptedException, URISyntaxException, JAXBException, ParseException, RefAlreadyExistsException, RefNotFoundException, InvalidRefNameException, CheckoutConflictException, GitAPIException { - - CommandLine cl = CMDConfigurations.parseArguments(args); - if (cl.getOptions().length == 0 || cl.hasOption(ARG_HELP)) { - CMDConfigurations.displayHelp(); - return; - } - String dirName = cl.getOptionValue(ARG_DIRECTORY, ARG_DIRECTORY_DEFAULT); - directory = new File(dirName).getCanonicalFile(); - if(!directory.isDirectory()) { - LOG.error("The directory does not exist " + directory); - System.exit(-1); - } + /* added to handle the GUI */ + static boolean fileSelected = false; - remoteOnly = cl.hasOption(ARG_REMOTE_ONLY); - ignoreGit = cl.hasOption(ARG_IGNORE_GIT); - includeMaster = cl.hasOption(ARG_INCLUDE_MASTER); - generateSite = !cl.hasOption(ARG_NO_SITE); - ignoreExamples = cl.hasOption(ARG_IGNORE_EXAMPLES); - ignoreTerms = cl.hasOption(ARG_IGNORE_TERMS); - verbose = cl.hasOption(ARG_VERBOSE); - - setLogAppenders(); - prepareDirectory(); - streamManager = initializeStreamManager(); - dataset = createFreshDataset(); - LOG.info("Starting pipeline in " + directory); - - Repositories repositories; - try { - repositories = new ReadRepositories("Fetching required repositories").readRepositories(directory, remoteOnly, ignoreGit, includeMaster); - } catch (Exception ex) { - reportAndExit(-1); - return; - } + private static JTextArea txtConsole = new JTextArea("Select a directory to start\n"); + private static JFrame frame = new JFrame(); + private static JPanel functionalitiesPanel = new JPanel(new GridLayout(0, 4)); + private static JPanel infoPanel = new JPanel(); + private static JPanel textAreaPanel = new JPanel(); + public static boolean isTheConsoleActive = true; - if (repositories.getDefaultRepository() != null) { - Repository repository = repositories.getDefaultRepository(); - boolean checkExamples = !ignoreExamples; - testRepository(repository, checkExamples); - } - for(Repository repository : repositories.getNamedRepositories()) { - boolean checkExamples = !ignoreExamples && remoteOnly; - testRepository(repository, checkExamples); + public static void main(String[] args) throws IOException, InterruptedException, URISyntaxException, JAXBException, + ParseException, RefAlreadyExistsException, RefNotFoundException, InvalidRefNameException, + CheckoutConflictException, GitAPIException { + if (isTheConsoleActive == true) { + + openConsole(); // open console } - checkOWLProfile(); - new CheckConfig().doJob(dataset, ignoreExamples); + else { + CommandLine cl = CMDConfigurations.parseArguments(args); + if (cl.getOptions().length == 0 || cl.hasOption(ARG_HELP)) { + CMDConfigurations.displayHelp(); + return; + } - if (generateSite) { - new GeneratePortal("Generate static files for the portal", streamManager).doJob(dataset, directory, verbose, ignoreExamples, ignoreTerms); - } + String dirName = cl.getOptionValue(ARG_DIRECTORY, ARG_DIRECTORY_DEFAULT); + directory = new File(dirName).getCanonicalFile(); + if (!directory.isDirectory()) { + LOG.error("The directory does not exist " + directory); + System.exit(-1); + } + + remoteOnly = cl.hasOption(ARG_REMOTE_ONLY); + ignoreGit = cl.hasOption(ARG_IGNORE_GIT); + includeMaster = cl.hasOption(ARG_INCLUDE_MASTER); + generateSite = !cl.hasOption(ARG_NO_SITE); + ignoreExamples = cl.hasOption(ARG_IGNORE_EXAMPLES); + ignoreTerms = cl.hasOption(ARG_IGNORE_TERMS); + verbose = cl.hasOption(ARG_VERBOSE); + + setLogAppenders(); + prepareDirectory(); + streamManager = initializeStreamManager(); + dataset = createFreshDataset(); + LOG.info("Starting pipeline in " + directory); + + Repositories repositories; + try { + repositories = new ReadRepositories("Fetching required repositories").readRepositories(directory, + remoteOnly, ignoreGit, includeMaster); + } catch (Exception ex) { + reportAndExit(-1); + return; + } + if (repositories.getDefaultRepository() != null) { + Repository repository = repositories.getDefaultRepository(); + boolean checkExamples = !ignoreExamples; + testRepository(repository, checkExamples); + } + for (Repository repository : repositories.getNamedRepositories()) { + boolean checkExamples = !ignoreExamples && remoteOnly; + testRepository(repository, checkExamples); + } - if (repositories.getDefaultRepository() != null && !ignoreGit) { - Repository repository = repositories.getDefaultRepository(); - resetCheckout(repository); - } - for(Repository repository : repositories.getNamedRepositories()) { - resetCheckout(repository); - } + checkOWLProfile(); + new CheckConfig().doJob(dataset, ignoreExamples); - testSuites.clean(); - - reportAndExit((int) -Math.signum(testSuites.getErrors() + testSuites.getFailures())); + if (generateSite) { + new GeneratePortal("Generate static files for the portal", streamManager).doJob(dataset, directory, + verbose, ignoreExamples, ignoreTerms); + } + + if (repositories.getDefaultRepository() != null && !ignoreGit) { + Repository repository = repositories.getDefaultRepository(); + resetCheckout(repository); + } + for (Repository repository : repositories.getNamedRepositories()) { + resetCheckout(repository); + } + + testSuites.clean(); + + reportAndExit((int) -Math.signum(testSuites.getErrors() + testSuites.getFailures())); + + } } private static void setLogAppenders() throws IOException { @@ -186,22 +218,259 @@ public class Main { org.apache.log4j.Logger loggerBase = org.apache.log4j.Logger.getLogger(Constants.LOGGER_BASE); TestSuitesAppender appender = new TestSuitesAppender(testSuites); loggerBase.addAppender(appender); - } + } + + private static boolean openConsole() throws IOException, InterruptedException, URISyntaxException, JAXBException, + ParseException, RefAlreadyExistsException, RefNotFoundException, InvalidRefNameException, + CheckoutConflictException, GitAPIException { + setGUIAppenders(); + +//LOG.info("Select a directory to start"); +// JFrame.setDefaultLookAndFeelDecorated(true); + + frame = new JFrame("Saref-Pipeline tests"); + frame.setBounds(100, 100, 800, 400); + SwingUtilities.updateComponentTreeUI(frame); + + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + + JLabel lblWelcomeToSarefpipeline = new JLabel("SAREF ontologies pipeline tests"); + infoPanel.add(lblWelcomeToSarefpipeline); + + frame.getContentPane().add(functionalitiesPanel, BorderLayout.SOUTH); + +//JLabel argsLbl = new JLabel("Please choose among the arguments:"); +//functionalitiesPanel.add(argsLbl); + JLabel lbl=new JLabel("The list of arguments:"); + functionalitiesPanel.add(lbl); + + JLabel emptylbl1=new JLabel(); + functionalitiesPanel.add(emptylbl1); + + JLabel emptylbl2=new JLabel(); + functionalitiesPanel.add(emptylbl2); + + JLabel emptylbl3=new JLabel(); + functionalitiesPanel.add(emptylbl3); + + + JCheckBox remoteOnly_checkBox = new JCheckBox("Remote-only"); + remoteOnly_checkBox.setToolTipText("Do not check the directory itself.\n" + + " Only consider the repositories listed in the `.saref-repositories.yml` document.\n" + + " Used to generate the website for several extensions."); + functionalitiesPanel.add(remoteOnly_checkBox); + + JCheckBox ignoreGit_checkBox = new JCheckBox("No-git"); + ignoreGit_checkBox.setToolTipText("Only check the current state of the repository"); + functionalitiesPanel.add(ignoreGit_checkBox); + + + JCheckBox includeMaster_checkBox = new JCheckBox("Include master"); + includeMaster_checkBox.setToolTipText("Check the master branches of the remote repositories listed in the `.saref-repositories.yml` document"); + functionalitiesPanel.add(includeMaster_checkBox); + + JCheckBox generateSite_checkBox = new JCheckBox("Don't generate site"); + generateSite_checkBox.setToolTipText("Do not generate the static website"); + functionalitiesPanel.add(generateSite_checkBox); + + JCheckBox ignoreExamples_checkBox = new JCheckBox("Ignore examples"); + ignoreExamples_checkBox.setToolTipText("Only check the SAREF extension ontology. Ignore the examples"); + functionalitiesPanel.add(ignoreExamples_checkBox); + + JCheckBox verbose_checkBox = new JCheckBox("Verbose"); + verbose_checkBox.setToolTipText("Use verbose mode.\n" + + "(For example, use SPARQL-Generate in --debug-template mode when generating the documentation)"); + functionalitiesPanel.add(verbose_checkBox); + + JCheckBox ignoreTerms_checkBox = new JCheckBox("Ignore terms"); + ignoreTerms_checkBox.setToolTipText("Do not generate the website for terms"); + functionalitiesPanel.add(ignoreTerms_checkBox); + + + JLabel emptylbl4=new JLabel(); + functionalitiesPanel.add(emptylbl4); + + JLabel emptylbl5=new JLabel(); + functionalitiesPanel.add(emptylbl5); + +// JButton startBtn = new JButton("Start the pipeline"); + + + JButton startBtn = new JButton("Start the pipeline"); + + JButton fileChooserBtn = new JButton("Choose a directory"); + fileChooserBtn.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + JFileChooser fileChooser = new JFileChooser(); + fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); + int option = fileChooser.showOpenDialog(frame); + if (option == JFileChooser.APPROVE_OPTION) { + directory = fileChooser.getSelectedFile(); + +// directory = new File(dirName).getCanonicalFile(); + + fileSelected = true; + startBtn.setEnabled(true); + } else { + System.out.println("Open command canceled"); + } + + } + }); + functionalitiesPanel.add(fileChooserBtn); + + startBtn.setEnabled(false); + + + + startBtn.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + + if (fileSelected == true) { + startBtn.setEnabled(true); + if (!remoteOnly_checkBox.isSelected() && !ignoreGit_checkBox.isSelected() + && !includeMaster_checkBox.isSelected() && !generateSite_checkBox.isSelected() + && !ignoreExamples_checkBox.isSelected() && !verbose_checkBox.isSelected()) { + + LOG.error("Please choose among the different options"); + return; + } + + remoteOnly = remoteOnly_checkBox.isSelected(); + ignoreGit = ignoreGit_checkBox.isSelected(); + includeMaster = includeMaster_checkBox.isSelected(); + generateSite = !generateSite_checkBox.isSelected(); + ignoreExamples = ignoreExamples_checkBox.isSelected(); + ignoreTerms = ignoreTerms_checkBox.isSelected(); + verbose = verbose_checkBox.isSelected(); + try { + + setLogAppenders(); + prepareDirectory(); + streamManager = initializeStreamManager(); + dataset = createFreshDataset(); + } catch (Exception e) { + // TODO: handle exception + } + + LOG.info("Starting pipeline in " + directory); + + Repositories repositories; + try { + repositories = new ReadRepositories("Fetching required repositories") + .readRepositories(directory, remoteOnly, ignoreGit, includeMaster); + } catch (Exception ex) { + reportAndExit(-1); + return; + } + + if (repositories.getDefaultRepository() != null) { + Repository repository = repositories.getDefaultRepository(); + boolean checkExamples = !ignoreExamples; + testRepository(repository, checkExamples); + } + for (Repository repository : repositories.getNamedRepositories()) { + boolean checkExamples = !ignoreExamples && remoteOnly; + testRepository(repository, checkExamples); + } + + checkOWLProfile(); + new CheckConfig().doJob(dataset, ignoreExamples); + + if (generateSite) { + try { + new GeneratePortal("Generate static files for the portal", streamManager).doJob(dataset, + directory, verbose, ignoreExamples, ignoreTerms); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + if (repositories.getDefaultRepository() != null && !ignoreGit) { + Repository repository = repositories.getDefaultRepository(); + resetCheckout(repository); + } + for (Repository repository : repositories.getNamedRepositories()) { + resetCheckout(repository); + } + + testSuites.clean(); + + reportAndExit((int) -Math.signum(testSuites.getErrors() + testSuites.getFailures())); + + int n = JOptionPane.showConfirmDialog(frame, + "The pipeline is finished\n" + "The report file is available at:\n" + directory + + "/target/report_output.xml\n" + + "Would you like to open it, erase the console and start the pipeline again?", + "Report results", JOptionPane.YES_NO_OPTION); + if (n == 0) { + try { + txtConsole.setText(""); + Desktop.getDesktop().open(new File(directory + "/target/report_output.xml")); + + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + } + + } + }); + functionalitiesPanel.add(startBtn); + + FlowLayout flowLayout_1 = (FlowLayout) infoPanel.getLayout(); + flowLayout_1.setVgap(20); + flowLayout_1.setHgap(20); + frame.getContentPane().add(infoPanel, BorderLayout.NORTH); + + frame.getContentPane().add(textAreaPanel, BorderLayout.CENTER); + txtConsole.setColumns(70); + txtConsole.setRows(15); + textAreaPanel.add(txtConsole); + + JScrollPane scroll = new JScrollPane(txtConsole, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, + JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); + frame.add(scroll); + + frame.pack(); + frame.setResizable(true); + frame.setVisible(true); + frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); + + return true; + } + + private static void setGUIAppenders() throws IOException { + + JTextAreaAppender jTextAreaAppender = new JTextAreaAppender(txtConsole); + + org.apache.log4j.Logger appenderRootLogger = org.apache.log4j.Logger.getRootLogger(); + + Layout GUIlayout = new PatternLayout("%d{mm:ss,SSS} %t %-5p %c:%L - %m%n"); + + jTextAreaAppender.setLayout(GUIlayout); + + appenderRootLogger.addAppender(jTextAreaAppender); + } + +// ************************************************ private static void prepareDirectory() throws IOException { target = new File(directory, Constants.TARGET_DIR); FileUtils.forceMkdir(target); - if(generateSite) { + if (generateSite) { File staticTargetDir = new File(directory, Constants.STATIC_TARGET_DIR); File staticTargetZip = new File(directory, Constants.STATIC_TARGET_DIR + ".zip"); URL url = Main.class.getClassLoader().getResource("static.zip"); FileUtils.copyURLToFile(url, staticTargetZip); - UnzipFile.unzip(staticTargetZip, staticTargetDir); - FileUtils.deleteQuietly(staticTargetZip); + UnzipFile.unzip(staticTargetZip, staticTargetDir); + FileUtils.deleteQuietly(staticTargetZip); } } - private static Dataset createFreshDataset() throws IOException { File datasetDir = new File(directory, Constants.DATASET_DIR); FileUtils.forceMkdir(datasetDir); @@ -210,8 +479,10 @@ public class Main { dataset.getDefaultModel().removeAll(); List toRemove = new ArrayList<>(); Iterator it = dataset.listNames(); - while(it.hasNext()) { toRemove.add(it.next()); } - for(String name : toRemove) { + while (it.hasNext()) { + toRemove.add(it.next()); + } + for (String name : toRemove) { dataset.removeNamedModel(name); } dataset.addNamedModel(Constants.CONFIG, ModelFactory.createDefaultModel()); @@ -225,7 +496,7 @@ public class Main { String versionTestSuiteName = version.toString() + " - testing repository structure"; new CheckoutJob(versionTestSuiteName).checkoutVersion(version); new CheckRepositoryStructure(versionTestSuiteName).check(version); - } catch(SAREFPipelineException ex) { + } catch (SAREFPipelineException ex) { LOG.error("Error while testing repository structure " + version, ex); continue; } @@ -234,13 +505,13 @@ public class Main { String ontologyTestSuiteName = version.toString() + " - testing ontology file"; testSuiteNames.put(version.getUri(), ontologyTestSuiteName); new ReadOntology(ontologyTestSuiteName).doJob(dataset, version); - } catch(SAREFPipelineException ex) { + } catch (SAREFPipelineException ex) { LOG.error(version.toString() + " Found errors for " + version.toString() + ". This version and all the examples will be ignored.", ex); continue; } - if(!checkExamples) { + if (!checkExamples) { return; } File examplesDir = new File(version.getRepository().getDirectory(), "examples"); @@ -262,11 +533,11 @@ public class Main { + ". This example will be ignored."); } } - } catch(Exception ex) { + } catch (Exception ex) { LOG.error(version.toString() + " Error while walking through the examples. They will be ignored.", ex); - continue; + continue; } - } + } } private static void checkOWLProfile() { @@ -296,9 +567,9 @@ public class Main { private static SPARQLExtStreamManager initializeStreamManager() throws IOException, URISyntaxException { URI uri = Main.class.getClassLoader().getResource("documentation").toURI(); Path dirPath; - if(uri.getScheme().equals("jar")) { - FileSystem fileSystem = FileSystems.newFileSystem(uri, Collections.emptyMap()); - dirPath = fileSystem.getPath("/documentation"); + if (uri.getScheme().equals("jar")) { + FileSystem fileSystem = FileSystems.newFileSystem(uri, Collections.emptyMap()); + dirPath = fileSystem.getPath("/documentation"); } else { dirPath = Paths.get(uri); } @@ -309,7 +580,7 @@ public class Main { Files.walk(dirPath).forEach((p) -> { String relativePath = dirPath.relativize(p).toString().replace("\\", "/"); String fileurl = BASE_DOC + relativePath; - if(uri.getScheme().equals("jar")) { + if (uri.getScheme().equals("jar")) { mapper.addAltEntry(fileurl, p.toString().substring(1)); } else { mapper.addAltEntry(fileurl, p.toString()); @@ -318,18 +589,17 @@ public class Main { return sm; } - private static void resetCheckout(Repository repository) { - try(Git git = Git.open(repository.getDirectory())) { + try (Git git = Git.open(repository.getDirectory())) { String currentBranch = repository.getCurrentBranch(); - if(currentBranch != null) { + if (currentBranch != null) { git.checkout().setName(currentBranch).call(); } } catch (IOException | GitAPIException ex) { LOG.warn("Error while reseting repository " + repository, ex); } } - + private static void reportAndExit(int code) { try { File report = new File(target, "report_output.xml"); @@ -341,23 +611,24 @@ public class Main { final StringWriter sw = new StringWriter(); jaxbMarshaller.marshal(testSuites, sw); - if(generateSite) { + if (generateSite) { // generate the report.html File reportHTML = new File(directory, Constants.SITE_DIR + File.separator + "report.html"); try (IndentedWriter writer = new IndentedWriter(new FileOutputStream(reportHTML));) { - Context context = ContextUtils.build(writer).setBase(Constants.BASE) - .setDebugTemplate(verbose).setStreamManager(streamManager).build(); + Context context = ContextUtils.build(writer).setBase(Constants.BASE).setDebugTemplate(verbose) + .setStreamManager(streamManager).build(); BindingHashMap binding = new BindingHashMap(); binding.add(VAR_TEST_SUITES, NodeFactory.createLiteral(sw.toString())); List bindings = new ArrayList<>(); bindings.add(binding); String query = IOUtils.toString( - streamManager.open(new LookUpRequest("documentation/report/main.rqg", SPARQLExt.MEDIA_TYPE)), + streamManager + .open(new LookUpRequest("documentation/report/main.rqg", SPARQLExt.MEDIA_TYPE)), StandardCharsets.UTF_8); RootPlan reportPlan = PlanFactory.create(query, BASE_DOC); reportPlan.execTemplateStream(bindings, context); } - + if (openBrowser) { if (Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) { Desktop.getDesktop().browse(reportHTML.toURI()); @@ -371,7 +642,8 @@ public class Main { ex.printStackTrace(); } - System.exit(code); + if (!isTheConsoleActive) { + System.exit(code); + } } - } diff --git a/src/main/resources/GUI/select_btn.png b/src/main/resources/GUI/select_btn.png new file mode 100644 index 0000000000000000000000000000000000000000..f098968804228bfd983724c9e8a92d14c32f1ecd GIT binary patch literal 2441 zcmeAS@N?(olHy`uVBq!ia0y~yU|7b$z@Wpy#=yYve(~Xx3=9mM1s;*b3=DinK$vl= zHlH*D1E;m8i(^Q|oVRmxbAqo+9()8zMioB^PJzkcZW;@mF8A^|xt zwp!-+zI6FF7G@ih)ys-FU9bLKsGD!Vz3qK$;@MNymWxwdX9b*{{Ca7J zyRWTa(ESUGc&%RUDcza8;Oo8auUA9=Gp;w_*8YBW`;BKY-qAmDW?gVr*~ML4b-X6A z;Z1hXrP9ZX*EL@I?SC~qymlEA$L6O6Sr<2%D5}0F{CcF+@@-(lmPM(VZ)MlEH>SHf zKD{@!v(oi>@F($?Z)fMdxa1|lId^tZebu|T8cW=q{$@dP;cqSMurIEx{tmLqh>xRf?u1jm@n;+Ah{<5?2 zRJ`G8g%)4doS@4B99urJ@iE61K2FT4mS^s{o^&JR!0r7aJmD85WamCQ)RSxz!eHq% zBRToi>q`ZK$+sR0E;Ca(Bha#P`-|3<+cz!WZqWMfslCwtWj0(r)7M)hA8fe3G(K3a zb>Ffb2CahGX+jg();RbdxpJrH)^VQj{9~uX=VA%J)YNVVW)la(7Udh z7J(GCS;VAj@H0zw)J2akkXDJwc(p)By>+|awcnRqjXqzv zW_;k=Vspk7bvsS6=Ktk15C1p2)OAncBD1vT-KzF+GtcjS{_ewqYK4T~lP#;Ryye-o zXYJbZhU@*6r%V4jwKy(Y#{6r>#%IgpwI37}n^)`K`J3>B8|AIbGn9Q4-cuw-pb6(Y(f;XdVtf%Il{HJ``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