View Javadoc

1   package org.lsst.ccs.project.management;
2   
3   import java.io.BufferedReader;
4   import java.io.IOException;
5   import java.io.InputStreamReader;
6   import java.net.URL;
7   import java.util.ArrayList;
8   import java.util.List;
9   import org.dom4j.Document;
10  import org.dom4j.DocumentException;
11  import org.dom4j.Element;
12  import org.dom4j.io.SAXReader;
13  
14  /**
15   *
16   * @author turri
17   */
18  public class CheckProjects {
19  
20      /**
21       * @param args the command line arguments
22       * @throws java.io.IOException
23       * @throws java.lang.InterruptedException
24       */
25      public static void main(String[] args) throws IOException, InterruptedException, DocumentException {
26  
27          Process p = Runtime.getRuntime().exec(new String[]{"bash", "-c", "svn ls svn+ssh://repo-nexus.lsst.org/camera/CameraControl"});
28          p.waitFor();
29  
30          InputStreamReader isr = new InputStreamReader(p.getInputStream());
31          BufferedReader buff = new BufferedReader(isr);
32  
33          ArrayList<String> projects = new ArrayList<>();
34          String line;
35          while ((line = buff.readLine()) != null) {
36              if ( line.startsWith("org-lsst") ) {
37                  projects.add(line.replace("/", ""));
38              }
39          }
40  
41  //        System.out.println("*** Found "+projects.size()+" CCS projects");
42          
43          
44          URL url = new URL("https://srs.slac.stanford.edu/hudson/api/xml");
45          Document dom = new SAXReader().read(url);
46  
47          // scan through the job list and print its status
48          for( Element job : (List<Element>)dom.getRootElement().elements("job")) {
49              String projectName = job.elementText("name");
50              projects.remove(projectName);
51          }
52          
53          System.out.println("Projects without a Jenkins job: "+projects.size());
54          for ( String missing : projects ) {
55              System.out.println("*** "+missing);
56          }
57                 
58          
59      }
60  
61  }