Loading src/main/java/fr/emse/gitlab/saref/Constants.java +6 −0 Original line number Original line Diff line number Diff line Loading @@ -5,6 +5,8 @@ import java.nio.file.FileSystems; import java.nio.file.PathMatcher; import java.nio.file.PathMatcher; import java.util.regex.Pattern; import java.util.regex.Pattern; import javax.swing.JFrame; public class Constants { public class Constants { public final static String BASE = "https://saref.etsi.org/"; public final static String BASE = "https://saref.etsi.org/"; Loading @@ -26,4 +28,8 @@ public class Constants { public static final String CONFIG = BASE + "config"; public static final String CONFIG = BASE + "config"; public static boolean isTheConsoleActive = true; public static JFrame frame = new JFrame(); } } src/main/java/fr/emse/gitlab/saref/JTextAreaAppender.java +2 −0 Original line number Original line Diff line number Diff line Loading @@ -110,6 +110,8 @@ public class JTextAreaAppender extends AppenderSkeleton { } } jTextArea.update(jTextArea.getGraphics()); jTextArea.update(jTextArea.getGraphics()); // DefaultCaret caret = (DefaultCaret)jTextArea.getCaret(); // caret.setUpdatePolicy(DefaultCaret.OUT_BOTTOM); // scroll TextArea // scroll TextArea // jTextArea.setCaretPosition(jTextArea.getText().length()); // jTextArea.setCaretPosition(jTextArea.getText().length()); Loading src/main/java/fr/emse/gitlab/saref/Main.java +18 −18 Original line number Original line Diff line number Diff line Loading @@ -127,11 +127,10 @@ public class Main { private static JTextArea txtConsole = new JTextArea("Select a directory to start\n"); private static JTextArea txtConsole = new JTextArea("Select a directory to start\n"); private static JScrollPane scroll = new JScrollPane(); private static JScrollPane scroll = new JScrollPane(); private static JFrame frame = new JFrame(); private static JPanel functionalitiesPanel = new JPanel(new GridLayout(0, 4)); private static JPanel functionalitiesPanel = new JPanel(new GridLayout(0, 4)); private static JPanel infoPanel = new JPanel(); private static JPanel infoPanel = new JPanel(); private static JPanel textAreaPanel = new JPanel(); private static JPanel textAreaPanel = new JPanel(); public static boolean isTheConsoleActive = true; private static String lastPath; private static String lastPath; private static JFileChooser fileChooser; private static JFileChooser fileChooser; Loading @@ -140,7 +139,7 @@ public class Main { public static void main(String[] args) throws IOException, InterruptedException, URISyntaxException, JAXBException, public static void main(String[] args) throws IOException, InterruptedException, URISyntaxException, JAXBException, ParseException, RefAlreadyExistsException, RefNotFoundException, InvalidRefNameException, ParseException, RefAlreadyExistsException, RefNotFoundException, InvalidRefNameException, CheckoutConflictException, GitAPIException { CheckoutConflictException, GitAPIException { if (isTheConsoleActive == true) { if (Constants.isTheConsoleActive == true) { openConsole(); // open console openConsole(); // open console Loading Loading @@ -249,16 +248,16 @@ public class Main { // JFrame.setDefaultLookAndFeelDecorated(true); // JFrame.setDefaultLookAndFeelDecorated(true); frame = new JFrame("Saref-Pipeline tests"); Constants.frame = new JFrame("Saref-Pipeline tests"); frame.setBounds(100, 100, 800, 400); Constants.frame.setBounds(100, 100, 800, 400); SwingUtilities.updateComponentTreeUI(frame); SwingUtilities.updateComponentTreeUI(Constants.frame); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Constants.frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JLabel lblWelcomeToSarefpipeline = new JLabel("SAREF ontologies pipeline tests"); JLabel lblWelcomeToSarefpipeline = new JLabel("SAREF ontologies pipeline tests"); infoPanel.add(lblWelcomeToSarefpipeline); infoPanel.add(lblWelcomeToSarefpipeline); frame.getContentPane().add(functionalitiesPanel, BorderLayout.SOUTH); Constants.frame.getContentPane().add(functionalitiesPanel, BorderLayout.SOUTH); JLabel lbl = new JLabel("The list of arguments:"); JLabel lbl = new JLabel("The list of arguments:"); functionalitiesPanel.add(lbl); functionalitiesPanel.add(lbl); Loading Loading @@ -327,7 +326,7 @@ public class Main { } } fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); int option = fileChooser.showOpenDialog(frame); int option = fileChooser.showOpenDialog(Constants.frame); if (option == JFileChooser.APPROVE_OPTION) { if (option == JFileChooser.APPROVE_OPTION) { directory = fileChooser.getSelectedFile(); directory = fileChooser.getSelectedFile(); fileSelected = true; fileSelected = true; Loading Loading @@ -410,6 +409,7 @@ public class Main { Repositories repositories; Repositories repositories; try { try { LOG.info("eeeee"); repositories = new ReadRepositories("Fetching required repositories") repositories = new ReadRepositories("Fetching required repositories") .readRepositories(directory, remoteOnly, ignoreGit, includeMaster); .readRepositories(directory, remoteOnly, ignoreGit, includeMaster); } catch (Exception ex) { } catch (Exception ex) { Loading Loading @@ -452,7 +452,7 @@ public class Main { reportAndExit((int) -Math.signum(testSuites.getErrors() + testSuites.getFailures())); reportAndExit((int) -Math.signum(testSuites.getErrors() + testSuites.getFailures())); int n = JOptionPane.showConfirmDialog(frame, int n = JOptionPane.showConfirmDialog(Constants.frame, "The pipeline is finished\n" + "The report file is available at:\n" + directory "The pipeline is finished\n" + "The report file is available at:\n" + directory + "/target/report_output.xml\n" + "/target/report_output.xml\n" + "Would you like to open it, erase the console and start the pipeline again?", + "Would you like to open it, erase the console and start the pipeline again?", Loading @@ -477,9 +477,9 @@ public class Main { FlowLayout flowLayout_1 = (FlowLayout) infoPanel.getLayout(); FlowLayout flowLayout_1 = (FlowLayout) infoPanel.getLayout(); flowLayout_1.setVgap(20); flowLayout_1.setVgap(20); flowLayout_1.setHgap(20); flowLayout_1.setHgap(20); frame.getContentPane().add(infoPanel, BorderLayout.NORTH); Constants.frame.getContentPane().add(infoPanel, BorderLayout.NORTH); frame.getContentPane().add(textAreaPanel, BorderLayout.CENTER); Constants.frame.getContentPane().add(textAreaPanel, BorderLayout.CENTER); txtConsole.setColumns(70); txtConsole.setColumns(70); txtConsole.setRows(15); txtConsole.setRows(15); Loading @@ -487,12 +487,12 @@ public class Main { scroll = new JScrollPane(txtConsole, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, scroll = new JScrollPane(txtConsole, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); frame.add(scroll); Constants.frame.add(scroll); frame.pack(); Constants.frame.pack(); frame.setResizable(true); Constants.frame.setResizable(true); frame.setVisible(true); Constants.frame.setVisible(true); frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); Constants.frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); return true; return true; } } Loading Loading @@ -680,7 +680,7 @@ public class Main { LOG.error("Exception:", ex); LOG.error("Exception:", ex); ex.printStackTrace(); ex.printStackTrace(); } } if (!isTheConsoleActive) { if (!Constants.isTheConsoleActive) { System.exit(code); System.exit(code); } } Loading src/main/java/fr/emse/gitlab/saref/jobs/ReadRepositories.java +12 −0 Original line number Original line Diff line number Diff line Loading @@ -11,6 +11,8 @@ import java.util.List; import java.util.regex.Matcher; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.regex.Pattern; import javax.swing.JOptionPane; import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils; import org.apache.commons.text.StringSubstitutor; import org.apache.commons.text.StringSubstitutor; import org.eclipse.jgit.api.Git; import org.eclipse.jgit.api.Git; Loading Loading @@ -155,6 +157,11 @@ public class ReadRepositories extends JobRunner { } else if (System.getenv("GITLAB_CI") != null) { } else if (System.getenv("GITLAB_CI") != null) { LOG.info("using username 'gitlab-ci-token'"); LOG.info("using username 'gitlab-ci-token'"); username = "gitlab-ci-token"; username = "gitlab-ci-token"; }else if (Constants.isTheConsoleActive == true) { LOG.info("Please enter your account username for %s:\t" + hostName); username = JOptionPane.showInputDialog(Constants.frame, "Please enter your account username for \n" + hostName, null); } else { } else { LOG.warn("using empty username"); LOG.warn("using empty username"); username = ""; username = ""; Loading @@ -168,6 +175,11 @@ public class ReadRepositories extends JobRunner { .readPassword(String.format("Please enter your account password for %s:\n", hostName)); .readPassword(String.format("Please enter your account password for %s:\n", hostName)); } else if (System.getenv("GITLAB_CI") != null) { } else if (System.getenv("GITLAB_CI") != null) { password = System.getenv("CI_JOB_TOKEN").toCharArray(); password = System.getenv("CI_JOB_TOKEN").toCharArray(); } else if (Constants.isTheConsoleActive == true) { password = JOptionPane .showInputDialog(Constants.frame, "Please enter your account password for \n" + hostName, null) .toCharArray(); } else { } else { LOG.warn("using empty password"); LOG.warn("using empty password"); password = "".toCharArray(); password = "".toCharArray(); Loading Loading
src/main/java/fr/emse/gitlab/saref/Constants.java +6 −0 Original line number Original line Diff line number Diff line Loading @@ -5,6 +5,8 @@ import java.nio.file.FileSystems; import java.nio.file.PathMatcher; import java.nio.file.PathMatcher; import java.util.regex.Pattern; import java.util.regex.Pattern; import javax.swing.JFrame; public class Constants { public class Constants { public final static String BASE = "https://saref.etsi.org/"; public final static String BASE = "https://saref.etsi.org/"; Loading @@ -26,4 +28,8 @@ public class Constants { public static final String CONFIG = BASE + "config"; public static final String CONFIG = BASE + "config"; public static boolean isTheConsoleActive = true; public static JFrame frame = new JFrame(); } }
src/main/java/fr/emse/gitlab/saref/JTextAreaAppender.java +2 −0 Original line number Original line Diff line number Diff line Loading @@ -110,6 +110,8 @@ public class JTextAreaAppender extends AppenderSkeleton { } } jTextArea.update(jTextArea.getGraphics()); jTextArea.update(jTextArea.getGraphics()); // DefaultCaret caret = (DefaultCaret)jTextArea.getCaret(); // caret.setUpdatePolicy(DefaultCaret.OUT_BOTTOM); // scroll TextArea // scroll TextArea // jTextArea.setCaretPosition(jTextArea.getText().length()); // jTextArea.setCaretPosition(jTextArea.getText().length()); Loading
src/main/java/fr/emse/gitlab/saref/Main.java +18 −18 Original line number Original line Diff line number Diff line Loading @@ -127,11 +127,10 @@ public class Main { private static JTextArea txtConsole = new JTextArea("Select a directory to start\n"); private static JTextArea txtConsole = new JTextArea("Select a directory to start\n"); private static JScrollPane scroll = new JScrollPane(); private static JScrollPane scroll = new JScrollPane(); private static JFrame frame = new JFrame(); private static JPanel functionalitiesPanel = new JPanel(new GridLayout(0, 4)); private static JPanel functionalitiesPanel = new JPanel(new GridLayout(0, 4)); private static JPanel infoPanel = new JPanel(); private static JPanel infoPanel = new JPanel(); private static JPanel textAreaPanel = new JPanel(); private static JPanel textAreaPanel = new JPanel(); public static boolean isTheConsoleActive = true; private static String lastPath; private static String lastPath; private static JFileChooser fileChooser; private static JFileChooser fileChooser; Loading @@ -140,7 +139,7 @@ public class Main { public static void main(String[] args) throws IOException, InterruptedException, URISyntaxException, JAXBException, public static void main(String[] args) throws IOException, InterruptedException, URISyntaxException, JAXBException, ParseException, RefAlreadyExistsException, RefNotFoundException, InvalidRefNameException, ParseException, RefAlreadyExistsException, RefNotFoundException, InvalidRefNameException, CheckoutConflictException, GitAPIException { CheckoutConflictException, GitAPIException { if (isTheConsoleActive == true) { if (Constants.isTheConsoleActive == true) { openConsole(); // open console openConsole(); // open console Loading Loading @@ -249,16 +248,16 @@ public class Main { // JFrame.setDefaultLookAndFeelDecorated(true); // JFrame.setDefaultLookAndFeelDecorated(true); frame = new JFrame("Saref-Pipeline tests"); Constants.frame = new JFrame("Saref-Pipeline tests"); frame.setBounds(100, 100, 800, 400); Constants.frame.setBounds(100, 100, 800, 400); SwingUtilities.updateComponentTreeUI(frame); SwingUtilities.updateComponentTreeUI(Constants.frame); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Constants.frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JLabel lblWelcomeToSarefpipeline = new JLabel("SAREF ontologies pipeline tests"); JLabel lblWelcomeToSarefpipeline = new JLabel("SAREF ontologies pipeline tests"); infoPanel.add(lblWelcomeToSarefpipeline); infoPanel.add(lblWelcomeToSarefpipeline); frame.getContentPane().add(functionalitiesPanel, BorderLayout.SOUTH); Constants.frame.getContentPane().add(functionalitiesPanel, BorderLayout.SOUTH); JLabel lbl = new JLabel("The list of arguments:"); JLabel lbl = new JLabel("The list of arguments:"); functionalitiesPanel.add(lbl); functionalitiesPanel.add(lbl); Loading Loading @@ -327,7 +326,7 @@ public class Main { } } fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); int option = fileChooser.showOpenDialog(frame); int option = fileChooser.showOpenDialog(Constants.frame); if (option == JFileChooser.APPROVE_OPTION) { if (option == JFileChooser.APPROVE_OPTION) { directory = fileChooser.getSelectedFile(); directory = fileChooser.getSelectedFile(); fileSelected = true; fileSelected = true; Loading Loading @@ -410,6 +409,7 @@ public class Main { Repositories repositories; Repositories repositories; try { try { LOG.info("eeeee"); repositories = new ReadRepositories("Fetching required repositories") repositories = new ReadRepositories("Fetching required repositories") .readRepositories(directory, remoteOnly, ignoreGit, includeMaster); .readRepositories(directory, remoteOnly, ignoreGit, includeMaster); } catch (Exception ex) { } catch (Exception ex) { Loading Loading @@ -452,7 +452,7 @@ public class Main { reportAndExit((int) -Math.signum(testSuites.getErrors() + testSuites.getFailures())); reportAndExit((int) -Math.signum(testSuites.getErrors() + testSuites.getFailures())); int n = JOptionPane.showConfirmDialog(frame, int n = JOptionPane.showConfirmDialog(Constants.frame, "The pipeline is finished\n" + "The report file is available at:\n" + directory "The pipeline is finished\n" + "The report file is available at:\n" + directory + "/target/report_output.xml\n" + "/target/report_output.xml\n" + "Would you like to open it, erase the console and start the pipeline again?", + "Would you like to open it, erase the console and start the pipeline again?", Loading @@ -477,9 +477,9 @@ public class Main { FlowLayout flowLayout_1 = (FlowLayout) infoPanel.getLayout(); FlowLayout flowLayout_1 = (FlowLayout) infoPanel.getLayout(); flowLayout_1.setVgap(20); flowLayout_1.setVgap(20); flowLayout_1.setHgap(20); flowLayout_1.setHgap(20); frame.getContentPane().add(infoPanel, BorderLayout.NORTH); Constants.frame.getContentPane().add(infoPanel, BorderLayout.NORTH); frame.getContentPane().add(textAreaPanel, BorderLayout.CENTER); Constants.frame.getContentPane().add(textAreaPanel, BorderLayout.CENTER); txtConsole.setColumns(70); txtConsole.setColumns(70); txtConsole.setRows(15); txtConsole.setRows(15); Loading @@ -487,12 +487,12 @@ public class Main { scroll = new JScrollPane(txtConsole, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, scroll = new JScrollPane(txtConsole, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); frame.add(scroll); Constants.frame.add(scroll); frame.pack(); Constants.frame.pack(); frame.setResizable(true); Constants.frame.setResizable(true); frame.setVisible(true); Constants.frame.setVisible(true); frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); Constants.frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); return true; return true; } } Loading Loading @@ -680,7 +680,7 @@ public class Main { LOG.error("Exception:", ex); LOG.error("Exception:", ex); ex.printStackTrace(); ex.printStackTrace(); } } if (!isTheConsoleActive) { if (!Constants.isTheConsoleActive) { System.exit(code); System.exit(code); } } Loading
src/main/java/fr/emse/gitlab/saref/jobs/ReadRepositories.java +12 −0 Original line number Original line Diff line number Diff line Loading @@ -11,6 +11,8 @@ import java.util.List; import java.util.regex.Matcher; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.regex.Pattern; import javax.swing.JOptionPane; import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils; import org.apache.commons.text.StringSubstitutor; import org.apache.commons.text.StringSubstitutor; import org.eclipse.jgit.api.Git; import org.eclipse.jgit.api.Git; Loading Loading @@ -155,6 +157,11 @@ public class ReadRepositories extends JobRunner { } else if (System.getenv("GITLAB_CI") != null) { } else if (System.getenv("GITLAB_CI") != null) { LOG.info("using username 'gitlab-ci-token'"); LOG.info("using username 'gitlab-ci-token'"); username = "gitlab-ci-token"; username = "gitlab-ci-token"; }else if (Constants.isTheConsoleActive == true) { LOG.info("Please enter your account username for %s:\t" + hostName); username = JOptionPane.showInputDialog(Constants.frame, "Please enter your account username for \n" + hostName, null); } else { } else { LOG.warn("using empty username"); LOG.warn("using empty username"); username = ""; username = ""; Loading @@ -168,6 +175,11 @@ public class ReadRepositories extends JobRunner { .readPassword(String.format("Please enter your account password for %s:\n", hostName)); .readPassword(String.format("Please enter your account password for %s:\n", hostName)); } else if (System.getenv("GITLAB_CI") != null) { } else if (System.getenv("GITLAB_CI") != null) { password = System.getenv("CI_JOB_TOKEN").toCharArray(); password = System.getenv("CI_JOB_TOKEN").toCharArray(); } else if (Constants.isTheConsoleActive == true) { password = JOptionPane .showInputDialog(Constants.frame, "Please enter your account password for \n" + hostName, null) .toCharArray(); } else { } else { LOG.warn("using empty password"); LOG.warn("using empty password"); password = "".toCharArray(); password = "".toCharArray(); Loading