LISTSERV mailing list manager LISTSERV 16.5

Help for HPS-SVN Archives


HPS-SVN Archives

HPS-SVN Archives


HPS-SVN@LISTSERV.SLAC.STANFORD.EDU


View:

Message:

[

First

|

Previous

|

Next

|

Last

]

By Topic:

[

First

|

Previous

|

Next

|

Last

]

By Author:

[

First

|

Previous

|

Next

|

Last

]

Font:

Proportional Font

LISTSERV Archives

LISTSERV Archives

HPS-SVN Home

HPS-SVN Home

HPS-SVN  April 2015

HPS-SVN April 2015

Subject:

r2689 - /java/trunk/integration-tests/src/test/java/org/hps/SteeringFilesTest.java

From:

[log in to unmask]

Reply-To:

Notification of commits to the hps svn repository <[log in to unmask]>

Date:

Tue, 14 Apr 2015 05:58:25 -0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (167 lines)

Author: [log in to unmask]
Date: Mon Apr 13 22:58:20 2015
New Revision: 2689

Log:
Exclude some steering files that do not initialize properly in test environment (missing 3D field map).

Modified:
    java/trunk/integration-tests/src/test/java/org/hps/SteeringFilesTest.java

Modified: java/trunk/integration-tests/src/test/java/org/hps/SteeringFilesTest.java
 =============================================================================
--- java/trunk/integration-tests/src/test/java/org/hps/SteeringFilesTest.java	(original)
+++ java/trunk/integration-tests/src/test/java/org/hps/SteeringFilesTest.java	Mon Apr 13 22:58:20 2015
@@ -4,6 +4,7 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
+import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
@@ -18,44 +19,78 @@
 import org.hps.steering.SteeringFileCatalog;
 
 /**
- * Perform a dry run on all steering files to make sure they are valid
- * and do not reference non-existent Drivers or define invalid parameters.
- * 
+ * Perform a dry run on all steering files to make sure they are valid and do not reference non-existent Drivers or
+ * define invalid parameters.
+ *
  * @author Jeremy McCormick <[log in to unmask]>
  */
 public class SteeringFilesTest extends TestCase {
-    
+
     /**
      * Dummy job manager.
      */
     static class DummyJobManager extends JobManager {
+        @Override
         protected void setupInputFiles() {
             // We don't actually want this to happen, as dummy variables are being used!
         }
     }
-    
+
+    static final List<String> SKIP_STEERING_FILES = new ArrayList<String>();
+
+    static final Pattern varPattern = Pattern.compile("[$][{][a-zA-Z_-]*[}]");
+
+    static {
+        // FIXME: These all reference the field map which is not found.
+        SKIP_STEERING_FILES.add("/org/hps/steering/readout/EngineeringRun2014PrescaledTriggers.lcsim");
+        SKIP_STEERING_FILES.add("/org/hps/steering/readout/EngineeringRun2014PresTrigPairs0.lcsim");
+        SKIP_STEERING_FILES.add("/org/hps/steering/readout/EngineeringRun2014PresTrigPairs1.lcsim");
+        SKIP_STEERING_FILES.add("/org/hps/steering/readout/EngineeringRun2014PresTrigSingles0.lcsim");
+        SKIP_STEERING_FILES.add("/org/hps/steering/readout/EngineeringRun2014PresTrigSingles1.lcsim");
+        SKIP_STEERING_FILES.add("/org/hps/steering/users/holly/EcalSimReadout.lcsim");
+    }
+
     /**
-     * Perform a dry run job on every steering file in the steering-files module.
-     * @throws Exception If there was an error initializing from one of the steering files.
+     * Find the variable names in an lcsim steering file.
+     *
+     * @param resourcePath The resource path to the file.
+     * @return The set of variable names.
+     * @throws IOException If there was an file IO error.
      */
-    public void testSteeringFiles() throws Exception {
-        DatabaseConditionsManager.getInstance().setLogLevel(Level.SEVERE);
-        List<String> steeringResources = SteeringFileCatalog.find();
-        for (String steeringResource : steeringResources) {
-            steeringFileCheck(steeringResource);
+    private static Set<String> findVariableNames(final String resourcePath) throws IOException {
+        final Set<String> variableNames = new HashSet<String>();
+        final InputStream inputStream = SteeringFileCatalog.class.getResourceAsStream(resourcePath);
+        final BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
+        String line;
+        while ((line = reader.readLine()) != null) {
+            final Matcher match = varPattern.matcher(line);
+            while (match.find()) {
+
+                // Variable string with ${...} enclosure included.
+                final String variable = match.group();
+
+                // The name of the variable for lookup.
+                final String variableName = variable.substring(2, variable.length() - 1);
+
+                variableNames.add(variableName);
+            }
         }
+        reader.close();
+        inputStream.close();
+        return variableNames;
     }
-        
+
     /**
      * Perform a dry run job on a steering file with the given resource path.
+     *
      * @param resourcePath The resource path in the jar.
      * @throws Exception If there was an error initializing from this steering file.
      */
-    private static void steeringFileCheck(String resourcePath) throws Exception {        
-        System.out.println("running steering file check on " + resourcePath);        
-        JobManager job = new DummyJobManager();        
-        Set<String> variableNames = findVariableNames(resourcePath);
-        for (String variableName : variableNames) {
+    private static void steeringFileCheck(final String resourcePath) throws Exception {
+        System.out.println("running steering file check on " + resourcePath);
+        final JobManager job = new DummyJobManager();
+        final Set<String> variableNames = findVariableNames(resourcePath);
+        for (final String variableName : variableNames) {
             String value = "dummy";
             if (variableName.equals("runNumber")) {
                 value = "1";
@@ -66,35 +101,19 @@
         job.setPerformDryRun(true);
         job.run();
     }
-    
 
-    static final Pattern varPattern = Pattern.compile("[$][{][a-zA-Z_-]*[}]");
     /**
-     * Find the variable names in an lcsim steering file.
-     * @param resourcePath The resource path to the file.
-     * @return The set of variable names.
-     * @throws IOException If there was an file IO error. 
+     * Perform a dry run job on every steering file in the steering-files module.
+     *
+     * @throws Exception If there was an error initializing from one of the steering files.
      */
-    private static Set<String> findVariableNames(String resourcePath) throws IOException {        
-        Set<String> variableNames = new HashSet<String>();
-        InputStream inputStream = SteeringFileCatalog.class.getResourceAsStream(resourcePath);
-        BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
-        String line;
-        while((line = reader.readLine()) != null) {
-            Matcher match = varPattern.matcher(line);
-            while (match.find()) {
-
-                // Variable string with ${...} enclosure included.
-                String variable = match.group();
-
-                // The name of the variable for lookup.
-                String variableName = variable.substring(2, variable.length() - 1);
-
-                variableNames.add(variableName);
+    public void testSteeringFiles() throws Exception {
+        DatabaseConditionsManager.getInstance().setLogLevel(Level.SEVERE);
+        final List<String> steeringResources = SteeringFileCatalog.find();
+        for (final String steeringResource : steeringResources) {
+            if (!SKIP_STEERING_FILES.contains(steeringResource)) {
+                steeringFileCheck(steeringResource);
             }
-        }            
-        reader.close();
-        inputStream.close();        
-        return variableNames;        
-    }    
+        }
+    }
 }

Top of Message | Previous Page | Permalink

Advanced Options


Options

Log In

Log In

Get Password

Get Password


Search Archives

Search Archives


Subscribe or Unsubscribe

Subscribe or Unsubscribe


Archives

November 2017
August 2017
July 2017
January 2017
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
December 2013
November 2013

ATOM RSS1 RSS2



LISTSERV.SLAC.STANFORD.EDU

Secured by F-Secure Anti-Virus CataList Email List Search Powered by the LISTSERV Email List Manager

Privacy Notice, Security Notice and Terms of Use