Skip to content

Commit

Permalink
Output multiple 111 and 211 failures.
Browse files Browse the repository at this point in the history
  • Loading branch information
timronan committed May 20, 2020
1 parent 7bf952f commit ed226d9
Show file tree
Hide file tree
Showing 3 changed files with 86,783 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ private Message run(List<? extends BaseNodeType> list) {
int i2 = 1;
String description ="";
map.keySet();

for(String key : map.keySet()) {
List<Tuple> tuples = map.get(key);
List<Tuple[]> invalidRanges = checkRanges(tuples);
Expand All @@ -129,6 +130,7 @@ private Message run(List<? extends BaseNodeType> list) {
.append(XmlUtil.toText(tuple[1].end)).append("");
}
nestedMessage.add(Result.error(builder.toString()));
returnmessage =true;
builder.setLength(0);

}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
package edu.iris.dmc.station.conditions;



import static org.junit.jupiter.api.Assertions.assertTrue;

import java.io.InputStream;

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import edu.iris.dmc.DocumentMarshaller;
import edu.iris.dmc.fdsn.station.model.FDSNStationXML;
import edu.iris.dmc.fdsn.station.model.Network;
import edu.iris.dmc.fdsn.station.model.Station;
import edu.iris.dmc.station.RuleEngineServiceTest;
import edu.iris.dmc.station.rules.Message;
import edu.iris.dmc.station.rules.NestedMessage;

public class Condition111Test3 {

private FDSNStationXML theDocument;

@BeforeEach
public void init() throws Exception {

}

@Test
public void success() throws Exception {
try (InputStream is = RuleEngineServiceTest.class.getClassLoader().getResourceAsStream("F3_111.xml")) {
theDocument = DocumentMarshaller.unmarshal(is);

Network n = theDocument.getNetwork().get(0);
Station s = n.getStations().get(0);
EpochOverlapCondition condition = new EpochOverlapCondition(true, "");

Message result = condition.evaluate(n);
NestedMessage nestedMessage=(NestedMessage)result;
assertTrue(nestedMessage.getNestedMessages().get(0).getDescription().contains("Sta: 2405 2018-01-17T23:10:56 2018-03-29T21:37:57 epoch overlaps"));
assertTrue(nestedMessage.getNestedMessages().get(1).getDescription().contains("Sta: 2405 2018-03-27T13:39:35 2018-03-29T21:37:57 epoch overlaps"));

Message resultS = condition.evaluate(s);
NestedMessage nestedMessages=(NestedMessage)resultS;
System.out.println(nestedMessages.getNestedMessages().get(0).getDescription());

assertTrue(nestedMessages.getNestedMessages().get(0).getDescription().contains("Chan: DP1 Loc: 2018-01-17T23:02:28 2018-01-26T16:12:38 epoch overlaps with DP1"));


}

}

@Test
public void pass() throws Exception {
try (InputStream is = RuleEngineServiceTest.class.getClassLoader().getResourceAsStream("pass.xml")) {
theDocument = DocumentMarshaller.unmarshal(is);

Network n = theDocument.getNetwork().get(0);
Station s = n.getStations().get(0);

EpochOverlapCondition condition = new EpochOverlapCondition(true, "");

Message result = condition.evaluate(s);
assertTrue(result instanceof edu.iris.dmc.station.rules.Success);
}

}
}
Loading

0 comments on commit ed226d9

Please sign in to comment.