diff --git a/examples/studies/fits_writer.xml b/examples/studies/fits_writer.xml index d8a49683a7..ceadb9ad04 100644 --- a/examples/studies/fits_writer.xml +++ b/examples/studies/fits_writer.xml @@ -20,6 +20,6 @@ - + diff --git a/examples/studies/muon_fitting.xml b/examples/studies/muon_fitting.xml index a5e68c9136..2f16830190 100644 --- a/examples/studies/muon_fitting.xml +++ b/examples/studies/muon_fitting.xml @@ -37,11 +37,11 @@ startRKey="circFitR" /> - + + + + + + diff --git a/examples/studies/muon_identification.xml b/examples/studies/muon_identification.xml index da4d5b55df..cbb7bc23b7 100644 --- a/examples/studies/muon_identification.xml +++ b/examples/studies/muon_identification.xml @@ -147,7 +147,7 @@ - + diff --git a/src/test/java/fact/FactAnalysisTest.java b/src/test/java/fact/FactAnalysisTest.java index f2d8f47ebe..5b953b6044 100644 --- a/src/test/java/fact/FactAnalysisTest.java +++ b/src/test/java/fact/FactAnalysisTest.java @@ -11,7 +11,6 @@ public class FactAnalysisTest { - static Logger log = LoggerFactory.getLogger(FactAnalysisTest.class); public void factExampleXML() { diff --git a/src/test/java/fact/FunctionalTest.java b/src/test/java/fact/FunctionalTest.java index 33aa783a9b..bf64c72ce5 100644 --- a/src/test/java/fact/FunctionalTest.java +++ b/src/test/java/fact/FunctionalTest.java @@ -97,8 +97,9 @@ public void studiesXMLs() throws IOException { } } - log.info("\n\n" + counter + " of " + size + " files in examples/studies failed to execute"); - log.info(Arrays.toString(failedFilesList.toArray())); + log.debug("\n\n" + counter + " of " + size + " files in 'examples/studies' failed to execute"); + log.debug(Arrays.toString(failedFilesList.toArray())); + assertThat(failedFilesList.size(), is(0)); } } diff --git a/src/test/java/fact/io/ExpectedDataTypes.java b/src/test/java/fact/io/ExpectedDataTypes.java index a5befe0e9f..cbe90779d2 100644 --- a/src/test/java/fact/io/ExpectedDataTypes.java +++ b/src/test/java/fact/io/ExpectedDataTypes.java @@ -16,20 +16,18 @@ * @author chris * */ -public class ExpectedDataTypes { +class ExpectedDataTypes { - static Logger log = LoggerFactory.getLogger(ExpectedDataTypes.class); - Map types = new LinkedHashMap(); + private static Logger log = LoggerFactory.getLogger(ExpectedDataTypes.class); + private Map types = new LinkedHashMap(); - public ExpectedDataTypes() { - } - public void addType(String key, Serializable typeValue) { + void addType(String key, Serializable typeValue) { types.put(key, typeValue); } - public boolean check(Data item) { - log.info("Checking {} types for item {}", types.keySet().size(), item); + boolean check(Data item) { + log.debug("Checking {} types for item {}", types.keySet().size(), item); for (String key : types.keySet()) { if (!item.containsKey(key)) { log.error("Missing key '{}' in item {}!", key, item); @@ -47,8 +45,8 @@ public boolean check(Data item) { return true; } - protected boolean checkValues(String key, Serializable exp, - Serializable found) { + private boolean checkValues(String key, Serializable exp, + Serializable found) { if (!valuesMatch(exp, found)) { log.error("Value mismatch for key '{}'", key); @@ -96,7 +94,7 @@ private boolean arraysMatch(Object array1, Object array2) { return false; } - log.info("Arrays equal."); + log.debug("Arrays equal."); return true; } } \ No newline at end of file diff --git a/src/test/java/fact/io/FitsSpeedTest.java b/src/test/java/fact/io/FitsSpeedTest.java deleted file mode 100644 index 343245c44b..0000000000 --- a/src/test/java/fact/io/FitsSpeedTest.java +++ /dev/null @@ -1,70 +0,0 @@ -/** - * - */ -package fact.io; - -import fact.datacorrection.DrsCalibration; -import org.junit.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import stream.Data; -import stream.ProcessorList; -import stream.io.SourceURL; -import stream.runtime.ProcessContextImpl; - -import java.util.ArrayList; -import java.util.List; - -import static org.junit.Assert.fail; - -/** - * @author chris - * - */ -public class FitsSpeedTest { - - static Logger log = LoggerFactory.getLogger(FitsSpeedTest.class); - List cols = new ArrayList(); - - @Test - public void test() { - - int limit = 100; - - try { - SourceURL url = new SourceURL("classpath:/testDataFile.fits.gz"); - FitsStream stream = new FitsStream(url); - stream.init(); - - ProcessorList preprocess = new ProcessorList(); - DrsCalibration drs = new DrsCalibration(); - // URL u = - // FitsStreamTest.class.getResource("/testDrsFile.drs.fits.gz"); - drs.setUrl(new SourceURL("classpath:/testDrsFile.drs.fits.gz")); - preprocess.add(drs); - // preprocess.add(new PhotonCharge()); - // preprocess.add(new MaxAmplitude()); - - preprocess.init(new ProcessContextImpl()); - Long start = System.currentTimeMillis(); - Data item = stream.read(); - log.info("size of data array: {}", - ((short[]) item.get("Data")).length); - int i = 0; - while (item != null) { - item = stream.read(); - item = preprocess.process(item); - i++; - } - Long end = System.currentTimeMillis(); - Double seconds = (end - start) / 1000.0d; - log.info("Reading {} rows took {} ms", i, end - start); - log.info(" {} rows/sec", limit / seconds.doubleValue()); - - } catch (Exception e) { - e.printStackTrace(); - fail("Error: " + e.getMessage()); - } - } - -} \ No newline at end of file diff --git a/src/test/java/fact/io/FitsStreamTest.java b/src/test/java/fact/io/FitsStreamTest.java index ce7373a656..15b558d6cf 100644 --- a/src/test/java/fact/io/FitsStreamTest.java +++ b/src/test/java/fact/io/FitsStreamTest.java @@ -19,7 +19,6 @@ */ public class FitsStreamTest { - static Logger log = LoggerFactory.getLogger(FitsStreamTest.class); @Test public void testFitsStream() { @@ -31,9 +30,6 @@ public void testFitsStream() { stream.init(); Data item = stream.read(); - log.info( "size of data array: {}", - ((short[]) item.get("Data")).length - ); while (item != null) { item = stream.read(); } @@ -59,7 +55,6 @@ public void testFitsKeys() { } item = stream.read(); } - log.info("Read all the required keys"); } catch (Exception e) { e.printStackTrace(); @@ -90,7 +85,6 @@ public void testDRSKeys(){ } item = stream.read(); } - log.info("Read all the required keys"); } catch (Exception e) { e.printStackTrace(); @@ -119,7 +113,6 @@ public void testDrsTypes(){ } item = stream.read(); } - log.info("Read all the required keys"); } catch(ClassCastException e){ fail("Wrong data types in the drs file"); @@ -150,7 +143,6 @@ public void testDriveFile(){ } item = stream.read(); } - log.info("Read all the required keys"); } catch(ClassCastException e){ fail("Wrong data types in the drs file"); diff --git a/src/test/java/fact/io/RecursiveDirectoryStreamTest.java b/src/test/java/fact/io/RecursiveDirectoryStreamTest.java index 853797eac1..9ddbff05ff 100644 --- a/src/test/java/fact/io/RecursiveDirectoryStreamTest.java +++ b/src/test/java/fact/io/RecursiveDirectoryStreamTest.java @@ -11,6 +11,7 @@ import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; /** * This tests creates a dummy file tree in a temporary folder. It will then run against a number of glob patterns @@ -44,7 +45,7 @@ public void testSearchPath() throws Exception { r.setPattern(pattern); r.init(); - log.info("Found files: {}", r.files); + assertTrue(r.files.size() > 0); } @Test @@ -58,8 +59,6 @@ public void testGlob() throws Exception { String pattern = "/**/*DRIVE_CONTROL_{TRACKING,POINTING}_POSITION.fits"; r.setPattern(pattern); r.init(); - - log.info("Found files: {}", r.files); assertThat(r.files.size(), is(4)); } @@ -75,7 +74,6 @@ public void testGlobTrackingSourcePos() throws Exception { r.setPattern(pattern); r.init(); - log.info("Found files: {}", r.files); assertThat(r.files.size(), is(4)); } @@ -91,7 +89,6 @@ public void testGlobSourcePos() throws Exception { r.setPattern(pattern); r.init(); - log.info("Found files: {}", r.files); assertThat(r.files.size(), is(2)); } @@ -105,10 +102,9 @@ public void testGlobPos() throws Exception { //no files in this directory String pattern = "/*DRIVE_CONTROL_SOURCE_POSITION.fits"; r.setPattern(pattern); + //this should throw a runtime exception r.init(); - log.info("Found files: {}", r.files); - assertThat(r.files.size(), is(0)); } @Test(expected = RuntimeException.class) @@ -118,12 +114,11 @@ public void testInvalidGlobPattern() throws Exception { SourceURL sourceUrl = new SourceURL("file://"+ folder.getRoot()); RecursiveDirectoryStream r = new RecursiveDirectoryStream(sourceUrl); + //this is not a valid pattern String pattern = "/**/*DRIVE<>?!ยง$%&/%_SOURCE_POSITION.fits"; r.setPattern(pattern); + //should throw an exception r.init(); - - log.info("Found files: {}", r.files); - assertThat(r.files.size(), is(0)); } diff --git a/src/test/java/fact/io/zfits/HuffmanTest.java b/src/test/java/fact/io/zfits/HuffmanTest.java index 2546a67e4f..b69d5349ef 100644 --- a/src/test/java/fact/io/zfits/HuffmanTest.java +++ b/src/test/java/fact/io/zfits/HuffmanTest.java @@ -9,7 +9,6 @@ import static org.junit.Assert.assertEquals; public class HuffmanTest { - static Logger log = LoggerFactory.getLogger(HuffmanTest.class); private final static short[] data1 = {-29809,28065,20278,-32513,8150,28686,22158,-28528,6076,-25500,-7728,-18355,-17653,-14284,30473,32654,-28105,8046,-16589,-27978,-2935,31363,-24578,20165,-27514,31187,-7249,-18351,26754,24050,-31108,8162,4611,17103,-27926,17894,-26937,749,-28431,27657,-17864,29504,-21937,-22586,5195,20214,-22913,24664,25683,-370,-7672,25891,-11469,-22892,-24394,1059,27534,-21069,-10521,13356,16336,30183,5282,-3007,14777,-9397,31319,-6996,-17653,13944,10325,-26819,26095,16578,-2744,11660,31094,-26030,-19808,-26972,708,26731,25455,18491,12302,-5552,-11649,30010,13552,-27732,-2165,24020,-17785,16522,2028,-30102,16830,9600,4269}; @@ -49,14 +48,10 @@ public void testEnDeCoding(short[] input) throws EncodingException, DecodingExce @Test public void testCoder() throws EncodingException, DecodingException { //test known data - log.info("Data 1"); testEnDeCoding(data1); - log.info("Data 2"); testEnDeCoding(data2); //test random data - log.info("Rand data"); for (int i=0; i<10;i++) { - log.info("Data rand {}", i); testEnDeCoding(randomShortArray((i+1)*100000, -2000, 2000)); } } diff --git a/src/test/java/fact/io/zfits/TestZFitsStream.java b/src/test/java/fact/io/zfits/TestZFitsStream.java index 800e16e269..71ebd95cfc 100644 --- a/src/test/java/fact/io/zfits/TestZFitsStream.java +++ b/src/test/java/fact/io/zfits/TestZFitsStream.java @@ -1,34 +1,33 @@ package fact.io.zfits; import org.junit.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import stream.Data; import stream.io.SourceURL; import java.net.URL; public class TestZFitsStream { - static Logger log = LoggerFactory.getLogger(TestZFitsStream.class); /** * Test whether gzipped fits files containing raw data can be read correctly * @throws Exception */ - @Test - public void testReadFits() throws Exception { - URL u = TestZFitsStream.class.getResource("/testDataFile.fits.gz"); - ZFitsStream stream = new ZFitsStream(new SourceURL(u)); - stream.tableName = "Events"; - stream.init(); - - Data item = stream.read(); - log.info( "size of data array: {}", - ((short[]) item.get("Data")).length - ); - printItemsInStream(stream, item); - } + @Test + public void testReadFits() throws Exception { + URL u = TestZFitsStream.class.getResource("/testDataFile.fits.gz"); + ZFitsStream stream = new ZFitsStream(new SourceURL(u)); + stream.tableName = "Events"; + stream.init(); + + Data item = stream.read(); + int i = 1; + //the test file contains just 15 valid events. + while (i < 15) { + item = stream.read(); + i++; + } + } /** @@ -43,9 +42,6 @@ public void testReadZFits() throws Exception { stream.init(); Data item = stream.read(); - log.info( "size of data array: {}", - ((short[]) item.get("Data")).length - ); printItemsInStream(stream, item); } @@ -62,9 +58,6 @@ public void testReadMCFits() throws Exception { stream.init(); Data item = stream.read(); - log.info( "size of data array: {}", - ((short[]) item.get("Data")).length - ); printItemsInStream(stream, item); } @@ -80,9 +73,6 @@ public void testReadDRSFits() throws Exception { stream.init(); Data item = stream.read(); - log.info( "size of data array: {}", - ((float[]) item.get("TriggerOffsetMean")).length - ); printItemsInStream(stream, item); } @@ -98,9 +88,6 @@ public void testReadMCDRSFits() throws Exception { stream.init(); Data item = stream.read(); - log.info( "size of data array: {}", - ((float[]) item.get("TriggerOffsetRms")).length - ); printItemsInStream(stream, item); } @@ -116,11 +103,7 @@ public void testDriveFits() throws Exception { stream.tableName = "DRIVE_CONTROL_TRACKING_POSITION"; stream.init(); - log.info("Item number {}", 0); Data item = stream.read(); - log.info( "declination: {}", - item.get("Dec") - ); printItemsInStream(stream, item); } @@ -130,7 +113,6 @@ public void testDriveFits() throws Exception { private void printItemsInStream(ZFitsStream stream, Data item) throws Exception { int i = 1; while (item != null) { - log.debug("Item {} has {} elements",i, item.size()); item = stream.read(); i++; } diff --git a/src/test/resources/properties-test.xml b/src/test/resources/properties-test.xml index 7062baeb60..738969e289 100644 --- a/src/test/resources/properties-test.xml +++ b/src/test/resources/properties-test.xml @@ -6,7 +6,7 @@ - + \ No newline at end of file