Skip to content

Commit

Permalink
Merge pull request #157 from fact-project/silence_tests
Browse files Browse the repository at this point in the history
Remove output from unit tests
  • Loading branch information
jebuss authored Nov 25, 2016
2 parents 812b354 + 5d34d5c commit 3c15ef8
Show file tree
Hide file tree
Showing 12 changed files with 41 additions and 149 deletions.
2 changes: 1 addition & 1 deletion examples/studies/fits_writer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@
<include url="classpath:/default/data/calibration.xml" />
<include url="classpath:/default/data/extraction.xml" />

<fact.io.FITSWriter keys="photoncharge,arrivalTime" url="${outfile}" />
<!--<fact.io.FITSWriter keys="photoncharge,arrivalTime" url="${outfile}" />-->
</process>
</container>
12 changes: 6 additions & 6 deletions examples/studies/muon_fitting.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@
startRKey="circFitR"
/>

<fact.io.JSONWriter
keys="*R,*X,*Y,*Sigma"
url="file:test.json"
specialDoubleValuesAsString="true"
doubleSignDigits="6"
/>
<!--<fact.io.JSONWriter-->
<!--keys="*R,*X,*Y,*Sigma"-->
<!--url="file:test.json"-->
<!--specialDoubleValuesAsString="true"-->
<!--doubleSignDigits="6"-->
<!--/>-->
</process>
</container>
2 changes: 1 addition & 1 deletion examples/studies/muon_identification.xml
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@

<fact.features.muon.RingStandardDeviationWithThreshold threshold="8" />

<fact.io.JSONWriter url="file:${outfile}" keys="${outputKeys}" />
<!--<fact.io.JSONWriter url="file:${outfile}" keys="${outputKeys}" />-->
<!-- <fact.ShowViewer key="DataCalibrated"/> -->
</process>
</container>
1 change: 0 additions & 1 deletion src/test/java/fact/FactAnalysisTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

public class FactAnalysisTest {

static Logger log = LoggerFactory.getLogger(FactAnalysisTest.class);


public void factExampleXML() {
Expand Down
5 changes: 3 additions & 2 deletions src/test/java/fact/FunctionalTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}
20 changes: 9 additions & 11 deletions src/test/java/fact/io/ExpectedDataTypes.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,18 @@
* @author chris
*
*/
public class ExpectedDataTypes {
class ExpectedDataTypes {

static Logger log = LoggerFactory.getLogger(ExpectedDataTypes.class);
Map<String, Serializable> types = new LinkedHashMap<String, Serializable>();
private static Logger log = LoggerFactory.getLogger(ExpectedDataTypes.class);
private Map<String, Serializable> types = new LinkedHashMap<String, Serializable>();

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);
Expand All @@ -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);
Expand Down Expand Up @@ -96,7 +94,7 @@ private boolean arraysMatch(Object array1, Object array2) {
return false;
}

log.info("Arrays equal.");
log.debug("Arrays equal.");
return true;
}
}
70 changes: 0 additions & 70 deletions src/test/java/fact/io/FitsSpeedTest.java

This file was deleted.

8 changes: 0 additions & 8 deletions src/test/java/fact/io/FitsStreamTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
*/
public class FitsStreamTest {

static Logger log = LoggerFactory.getLogger(FitsStreamTest.class);

@Test
public void testFitsStream() {
Expand All @@ -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();
}
Expand All @@ -59,7 +55,6 @@ public void testFitsKeys() {
}
item = stream.read();
}
log.info("Read all the required keys");

} catch (Exception e) {
e.printStackTrace();
Expand Down Expand Up @@ -90,7 +85,6 @@ public void testDRSKeys(){
}
item = stream.read();
}
log.info("Read all the required keys");

} catch (Exception e) {
e.printStackTrace();
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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");
Expand Down
15 changes: 5 additions & 10 deletions src/test/java/fact/io/RecursiveDirectoryStreamTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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));
}

Expand All @@ -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));
}

Expand All @@ -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));
}

Expand All @@ -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)
Expand All @@ -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));
}


Expand Down
5 changes: 0 additions & 5 deletions src/test/java/fact/io/zfits/HuffmanTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down Expand Up @@ -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));
}
}
Expand Down
Loading

0 comments on commit 3c15ef8

Please sign in to comment.