keys = this.items.keySet();
- IPrevExchangeItem[] result = new IPrevExchangeItem[n];
- int i = 0;
- for (String key : keys) {
- result[i] = this.items.get(key);
- i++;
- }
- return result;
- }
-
+ @Override
public void finish() {
// Updates parameter file.
- double[] currentTimeCache = this.items.get("parameter_d").getTimes();
- double[] parameter_dCache = this.items.get("parameter_d").getValuesAsDoubles();
- double[] parameter_SmaxCache = this.items.get("parameter_Smax").getValuesAsDoubles();
- double[] parameter_alpha1Cache = this.items.get("parameter_alpha1").getValuesAsDoubles();
- double[] parameter_alpha2Cache = this.items.get("parameter_alpha2").getValuesAsDoubles();
+ double[] currentTimeCache = this.exchangeItems.get("parameter_d").getTimes();
+ double[] parameter_dCache = this.exchangeItems.get("parameter_d").getValuesAsDoubles();
+ double[] parameter_SmaxCache = this.exchangeItems.get("parameter_Smax").getValuesAsDoubles();
+ double[] parameter_alpha1Cache = this.exchangeItems.get("parameter_alpha1").getValuesAsDoubles();
+ double[] parameter_alpha2Cache = this.exchangeItems.get("parameter_alpha2").getValuesAsDoubles();
//write to file
System.out.println("ParametersWrapper.finish(): Writing to file: "+this.workingDir+"/"+this.fileName);
@@ -179,15 +148,16 @@ public void finish() {
*
* -- Adapt reading of the key-value pairs and writing to the ExchangeItem
* here below.
- *
+ *
* @param workingDir
- * @param fileName
+ * Working directory
* @param arguments
+ * The name of the file containing the data (relative to the
+ * working directory), and additional arguments (may be null zero-length)
* @throws IOException
*/
- private void ReadNameListFile(File workingDir, String fileName,
- String[] arguments) throws IOException {
- File namelist = new File(workingDir, fileName);
+ private void ReadNameListFile(File workingDir, String[] arguments) throws IOException {
+ File namelist = new File(workingDir, arguments[0]);
if (!namelist.exists()) {
throw new RuntimeException("ParametersWrapper.ReadNameListFile(): settings file "
+ namelist.getAbsolutePath() + " does not exist");
@@ -195,8 +165,8 @@ private void ReadNameListFile(File workingDir, String fileName,
// Create nested reader.
FileInputStream in = new FileInputStream(namelist);
BufferedReader buff = new BufferedReader(new InputStreamReader(in));
- String line = ""; // Initialize line.
- Boolean eof = false; // End of file cache.
+ String line; // Initialize line.
+ boolean eof = false; // End of file cache.
// While End of file is not reached yet do the following:
while (!eof) {
@@ -213,7 +183,7 @@ private void ReadNameListFile(File workingDir, String fileName,
// Now parse the line.
// Remove comments at end of line.
if (line.indexOf("%") > 1) {
- String columns[] = line.split("%");
+ String[] columns = line.split("%");
line = columns[0];
}
if (line.startsWith("%")) {
@@ -230,14 +200,14 @@ private void ReadNameListFile(File workingDir, String fileName,
columns[3] = columns[3].trim();
// Remove comma from columns[3].
String[] tempTime = columns[3].split(",");
- timeCache[0] = Double.valueOf(tempTime[0]);
+ timeCache[0] = Double.parseDouble(tempTime[0]);
} else {
System.out.println("Error in parameters wrapper. Trouble reading current time.");
}
if (columns[4].equals("finalTime")) {
columns[6] = columns[6].trim();
String[] temp = columns[6].split(";");
- timeCache[1] = Double.valueOf(temp[0]);
+ timeCache[1] = Double.parseDouble(temp[0]);
} else {
System.out.println("Error in parameters wrapper. Trouble reading final time.");
}
@@ -253,27 +223,27 @@ private void ReadNameListFile(File workingDir, String fileName,
columns[1] = columns[1].trim();
// Remove the semicollon at the end of the string in
// columns[1].
- String temp[] = columns[1].split(";");
+ String[] temp = columns[1].split(";");
columns[1] = temp[0];
// Parse the values to the key caches in Java.
// -- Add if-loops for variables to be read here.
if (columns[0].equals("parameter_d")) {
- parameter_dCache[0] = Double.valueOf(columns[1]);
+ parameter_dCache[0] = Double.parseDouble(columns[1]);
parameter_dCache[1] = parameter_dCache[0];
}
if (columns[0].equals("parameter_Smax")) {
- parameter_SmaxCache[0] = Double.valueOf(columns[1]);
+ parameter_SmaxCache[0] = Double.parseDouble(columns[1]);
parameter_SmaxCache[1] = parameter_SmaxCache[0];
}
if (columns[0].equals("parameter_alpha1")) {
- parameter_alpha1Cache[0] = Double.valueOf(columns[1]);
+ parameter_alpha1Cache[0] = Double.parseDouble(columns[1]);
parameter_alpha1Cache[1] = parameter_alpha1Cache[0];
}
if (columns[0].equals("parameter_alpha2")) {
- parameter_alpha2Cache[0] = Double.valueOf(columns[1]);
+ parameter_alpha2Cache[0] = Double.parseDouble(columns[1]);
parameter_alpha2Cache[1] = parameter_alpha2Cache[0];
}
@@ -290,7 +260,7 @@ private void ReadNameListFile(File workingDir, String fileName,
parameter_dSeries.setLocation("default");
String id1 = "parameter_d";
parameter_dSeries.setId(id1);
- this.items.put(id1,parameter_dSeries);
+ this.exchangeItems.put(id1,parameter_dSeries);
@SuppressWarnings("unused")
IExchangeItem parameter_dExchangeItem = new TimeSeries(parameter_dSeries);
@@ -298,7 +268,7 @@ private void ReadNameListFile(File workingDir, String fileName,
parameter_SmaxSeries.setLocation("default");
String id2 = "parameter_Smax";
parameter_SmaxSeries.setId(id2);
- this.items.put(id2,parameter_SmaxSeries);
+ this.exchangeItems.put(id2,parameter_SmaxSeries);
@SuppressWarnings("unused")
IExchangeItem parameter_SmaxExchangeItem = new TimeSeries(parameter_SmaxSeries);
@@ -306,7 +276,7 @@ private void ReadNameListFile(File workingDir, String fileName,
parameter_alpha1Series.setLocation("default");
String id3 = "parameter_alpha1";
parameter_alpha1Series.setId(id3);
- this.items.put(id3,parameter_alpha1Series);
+ this.exchangeItems.put(id3,parameter_alpha1Series);
@SuppressWarnings("unused")
IExchangeItem parameter_alpha1ExchangeItem = new TimeSeries(parameter_alpha1Series);
@@ -314,7 +284,7 @@ private void ReadNameListFile(File workingDir, String fileName,
parameter_alpha2Series.setLocation("default");
String id4 = "parameter_alpha2";
parameter_alpha2Series.setId(id4);
- this.items.put(id4,parameter_alpha2Series);
+ this.exchangeItems.put(id4,parameter_alpha2Series);
@SuppressWarnings("unused")
IExchangeItem parameter_alpha2ExchangeItem = new TimeSeries(parameter_alpha2Series);
diff --git a/model_RainfallRunoffZhang/java/src/org/openda/model_RainfallRunoffZhang/ResultFileWrapper.java b/model_RainfallRunoffZhang/java/src/org/openda/model_RainfallRunoffZhang/ResultFileWrapper.java
index 6bd60603a..b8f8ea431 100644
--- a/model_RainfallRunoffZhang/java/src/org/openda/model_RainfallRunoffZhang/ResultFileWrapper.java
+++ b/model_RainfallRunoffZhang/java/src/org/openda/model_RainfallRunoffZhang/ResultFileWrapper.java
@@ -18,22 +18,14 @@
* along with OpenDA. If not, see .
*/
package org.openda.model_RainfallRunoffZhang;
-import java.io.BufferedReader;
-//import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileInputStream;
-//import java.io.FileWriter;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.Set;
-import java.util.Vector;
-import org.openda.blackbox.interfaces.IoObjectInterface;
+import org.openda.exchange.AbstractDataObject;
import org.openda.exchange.timeseries.TimeSeries;
import org.openda.interfaces.IExchangeItem;
+import java.io.*;
+import java.util.Vector;
+
/**
* Allows reading of time variables from matlab readable ASCII file and
* transferring these to OpenDA ExchangeItems.
@@ -54,107 +46,42 @@
* @author Beatrice Marti, hydrosolutions ltd.
*
*/
-public class ResultFileWrapper implements IoObjectInterface {
+public class ResultFileWrapper extends AbstractDataObject {
// Class specific values
File workingDir;
- String configString;
String fileName = null;
- HashMap items = new LinkedHashMap();
-
+
/**
- * Initialize the IoObject. Reads the content of a file (fileName) in
+ * Initialize the DataObject. Reads the content of a file in
* directory (workingDir) with given arguments.
*
* @param workingDir
* Working directory
- * @param fileName
- * The name of the file containing the data (relative to the
- * working directory.)
* @param arguments
- * Additional arguments (may be null zero-length)
+ * The name of the file containing the data (relative to the
+ * working directory), and additional arguments (may be null zero-length)
*/
- public void initialize(File workingDir, String fileName, String[] arguments) {
+ @Override
+ public void initialize(File workingDir, String[] arguments) {
this.workingDir = workingDir;
- this.fileName = fileName;
+ this.fileName = arguments[0];
try {
- ReadNameListFile(workingDir, fileName, arguments);
+ ReadNameListFile();
} catch (IOException e) {
e.printStackTrace();
}
}
- /**
- * Ask which elements can be accessed
- *
- *
- * @return The list of element identifiers that can be accessed
- */
- public TimeSeries[] getExchangeItems() {
- // Get the number of items.
- int n = this.items.size();
- Set keys = this.items.keySet();
- TimeSeries[] result = new TimeSeries[n];
- int i = 0;
- for (String key : keys) {
- result[i] = this.items.get(key);
- i++;
- }
- return result;
- }
-
- /**
- * A slightly more elegant variant of getExchangeItems().
- *
- * @return A vector of type TimeSeries containing the values of the
- * time series stored in the hash map items.
- */
- public Vector getData() {
- return new Vector(this.items.values());
- }
-
-
+ @Override
public void finish() {
/*
* In this example, writing the result file is not needed because the totalRunoff is not
* read by the rainfall runoff model to initialize a run.
*
- *
- // Write updated predictor
- double[] currentTimeCache = this.items.get("totalRunoff").getTimes();
- double[] totalRunoffCache = this.items.get("totalRunoff").getValuesAsDoubles();
-
- //write to file
- System.out.println("Result wrapper finish(): Writing to file: "+this.workingDir+"/"+this.fileName);
- File outputFile = new File(this.workingDir,this.fileName);
- try{
- if(outputFile.isFile()){
- outputFile.delete();
- }
- }catch (Exception e) {
- System.out.println("ResultWrapper: trouble removing file "+ fileName);
- }
- try {
- FileWriter writer = new FileWriter(outputFile);
- BufferedWriter out = new BufferedWriter(writer);
-
- int seriesLength = currentTimeCache.length;
- if (seriesLength != totalRunoffCache.length) {
- System.out.println("Error writing result file. Length of times and values are not the same.");
- }
- for (int i = 0 ; i < seriesLength; i++) {
- out.write(currentTimeCache[i] + " " + totalRunoffCache[i] + System.getProperty("line.separator"));
- }
- out.flush(); // Force java to write buffered stream to disk.
- out.close();
- writer.close();
-
- } catch (Exception e) {
- throw new RuntimeException("Result file wrapper: Problem writing to file "+fileName+" : " + System.getProperty("line.separator") + e.getMessage());
- }
- */
+ */
}
/**
@@ -162,26 +89,19 @@ public void finish() {
* them to an ExchangeItem.
*
* Actually reads one single value from file.
- *
- * @param workingDir
- * @param fileName
- * @param arguments
+ *
* @throws IOException
*/
- private void ReadNameListFile(File workingDir, String fileName,
- String[] arguments) throws IOException {
-
+ private void ReadNameListFile() throws IOException {
+
File namelist = new File(workingDir, fileName);
if (!namelist.exists()) {
System.out.println("ResultFileWrapper.ReadNameListFile(): Failed to open File " + fileName + " in " + workingDir);
}
- //TimeSeries series = new TimeSeries();
- Vector timesVector = new Vector();
- Vector valuesVector = new Vector();
- //ArrayList times = new ArrayList();
- //ArrayList values = new ArrayList();
- double[] times = null;
- double[] values = null;
+ Vector timesVector = new Vector<>();
+ Vector valuesVector = new Vector<>();
+ double[] times;
+ double[] values;
if (!namelist.exists()) {
throw new RuntimeException("ResultFileWrapper.ReadNameListFile(): settings file "
@@ -190,8 +110,8 @@ private void ReadNameListFile(File workingDir, String fileName,
// Create nested reader.
FileInputStream in = new FileInputStream(namelist);
BufferedReader buff = new BufferedReader(new InputStreamReader(in));
- String line = ""; // Initialize line.
- Boolean eof = false; // End of file cache.
+ String line; // Initialize line.
+ boolean eof = false; // End of file cache.
// While End of file is not reached yet do the following:
while (!eof) {
@@ -243,10 +163,7 @@ private void ReadNameListFile(File workingDir, String fileName,
TimeSeries series = new TimeSeries(times, values);
String id = "totalRunoff";
series.setId(id);
- this.items.put(id,series);
- @SuppressWarnings("unused")
- IExchangeItem totalRunoffExchangeItem = new TimeSeries(series);
-
+ this.exchangeItems.put(id,series);
}
diff --git a/model_RainfallRunoffZhang/java/src/org/openda/model_RainfallRunoffZhang/TimesWrapper.java b/model_RainfallRunoffZhang/java/src/org/openda/model_RainfallRunoffZhang/TimesWrapper.java
index 387bbc4a3..a976b2105 100644
--- a/model_RainfallRunoffZhang/java/src/org/openda/model_RainfallRunoffZhang/TimesWrapper.java
+++ b/model_RainfallRunoffZhang/java/src/org/openda/model_RainfallRunoffZhang/TimesWrapper.java
@@ -18,21 +18,12 @@
* along with OpenDA. If not, see .
*/
package org.openda.model_RainfallRunoffZhang;
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.Set;
-import org.openda.blackbox.interfaces.IoObjectInterface;
+import org.openda.exchange.AbstractDataObject;
import org.openda.exchange.DoubleExchangeItem;
import org.openda.interfaces.IExchangeItem;
-import org.openda.interfaces.IPrevExchangeItem;
+
+import java.io.*;
/**
* Allows reading of time variables from matlab readable ASCII file and
@@ -55,23 +46,11 @@
* @author Beatrice Marti, hydrosolutions ltd.
*
*/
-public class TimesWrapper implements
- IoObjectInterface {
-
- // Define a private class to cache the exchange items.
- private class TimesWrapperExchangeItem {
- public IExchangeItem exchangeItem;
-
- TimesWrapperExchangeItem(IExchangeItem exchangeItem) {
- this.exchangeItem = exchangeItem;
- }
- }
+public class TimesWrapper extends AbstractDataObject {
// Class specific values
File workingDir;
- String configString;
String fileName = null;
- HashMap items = new LinkedHashMap();
// Cache values to be read.
// -- Add variables for initial States to be read here.
@@ -80,53 +59,34 @@ private class TimesWrapperExchangeItem {
private double finalTimeCache = 0.0;
/**
- * Initialize the IoObject. Reads the content of a file (fileName) in
+ * Initialize the DataObject. Reads the content of a file (fileName) in
* directory (workingDir) with given arguments.
*
* @param workingDir
* Working directory
- * @param fileName
- * The name of the file containing the data (relative to the
- * working directory.)
* @param arguments
- * Additional arguments (may be null zero-length)
+ * The name of the file containing the data (relative to the
+ * working directory), and additional arguments (may be null zero-length)
*/
- public void initialize(File workingDir, String fileName, String[] arguments) {
+ @Override
+ public void initialize(File workingDir, String[] arguments) {
this.workingDir = workingDir;
- this.fileName = fileName;
+ this.fileName = arguments[0];
try {
- ReadNameListFile(workingDir, fileName, arguments);
+ ReadNameListFile();
} catch (IOException e) {
e.printStackTrace();
}
}
- /**
- * Ask which elements can be accessed
- *
- *
- * @return The list of element identifiers that can be accessed
- */
- public IPrevExchangeItem[] getExchangeItems() {
- // Get the number of items.
- int n = this.items.size();
- Set keys = this.items.keySet();
- IExchangeItem[] result = new IExchangeItem[n];
- int i = 0;
- for (String key : keys) {
- result[i] = this.items.get(key).exchangeItem;
- i++;
- }
- return result;
- }
-
+ @Override
public void finish() {
// Updates time configuration file.
- double currentTime = this.items.get("currentTime").exchangeItem.getValuesAsDoubles()[0];
- double simulationTimeStep = this.items.get("simulationTimeStep").exchangeItem.getValuesAsDoubles()[0];
- double finalTime = this.items.get("finalTime").exchangeItem.getValuesAsDoubles()[0];
+ double currentTime = exchangeItems.get("currentTime").getValuesAsDoubles()[0];
+ double simulationTimeStep = exchangeItems.get("simulationTimeStep").getValuesAsDoubles()[0];
+ double finalTime = exchangeItems.get("finalTime").getValuesAsDoubles()[0];
//write to file
System.out.println("TimesWrapper.finish(): writing to " +this.workingDir+"/"+this.fileName);
@@ -163,14 +123,10 @@ public void finish() {
* them to an ExchangeItem.
* -- Adapt reading of the key-value pairs and writing to the ExchangeItem
* here below.
- *
- * @param workingDir
- * @param fileName
- * @param arguments
+ *
* @throws IOException
*/
- private void ReadNameListFile(File workingDir, String fileName,
- String[] arguments) throws IOException {
+ private void ReadNameListFile() throws IOException {
File namelist = new File(workingDir, fileName);
if (!namelist.exists()) {
throw new RuntimeException("TimesWrapper.ReadNameListFile(): settings file "
@@ -180,7 +136,7 @@ private void ReadNameListFile(File workingDir, String fileName,
FileInputStream in = new FileInputStream(namelist);
BufferedReader buff = new BufferedReader(new InputStreamReader(in));
String line = ""; // Initialize line.
- Boolean eof = false; // End of file cache.
+ boolean eof = false; // End of file cache.
// While End of file is not reached yet do the following:
while (!eof) {
@@ -197,7 +153,7 @@ private void ReadNameListFile(File workingDir, String fileName,
// Now parse the line.
// Remove comments at end of line.
if (line.indexOf("%") > 1) {
- String columns[] = line.split("%");
+ String[] columns = line.split("%");
line = columns[0];
}
if (line.startsWith("%")) {
@@ -212,20 +168,20 @@ private void ReadNameListFile(File workingDir, String fileName,
// of the string.
columns[1] = columns[1].trim();
// Remove the semicollon at the end of the string in columns[1].
- String temp[] = columns[1].split(";");
+ String[] temp = columns[1].split(";");
columns[1] = temp[0];
// Parse the values to the key caches in Java.
// -- Add if-loops for variables to be read here.
if (columns[0].equals("currentTime")) {
- currentTimeCache = Double.valueOf(columns[1]);
+ currentTimeCache = Double.parseDouble(columns[1]);
}
if (columns[0].equals("simulationTimeStep")) {
- simulationTimeStepCache = Double.valueOf(columns[1]);
+ simulationTimeStepCache = Double.parseDouble(columns[1]);
}
if (columns[0].equals("finalTime")) {
- finalTimeCache = Double.valueOf(columns[1]);
+ finalTimeCache = Double.parseDouble(columns[1]);
}
}
@@ -239,18 +195,15 @@ private void ReadNameListFile(File workingDir, String fileName,
// -- Add commands for storing the read key-value pairs in the exchange items.
IExchangeItem currentTimeExchangeItem = new DoubleExchangeItem(
"currentTime", this.currentTimeCache);
- this.items.put("currentTime", new TimesWrapperExchangeItem(
- currentTimeExchangeItem));
+ exchangeItems.put("currentTime", currentTimeExchangeItem);
IExchangeItem finalTimeExchangeItem = new DoubleExchangeItem(
"finalTime", this.finalTimeCache);
- this.items.put("finalTime", new TimesWrapperExchangeItem(
- finalTimeExchangeItem));
+ exchangeItems.put("finalTime", finalTimeExchangeItem);
IExchangeItem simulationTimeStepExchangeItem = new DoubleExchangeItem(
"simulationTimeStep", this.simulationTimeStepCache);
- this.items.put("simulationTimeStep", new TimesWrapperExchangeItem(
- simulationTimeStepExchangeItem));
+ exchangeItems.put("simulationTimeStep", simulationTimeStepExchangeItem);
}
diff --git a/model_RainfallRunoffZhang/java/test/org/openda/model_RainfallRunoffZhang/ASCIITimeSeriesStochObserverTest.java b/model_RainfallRunoffZhang/java/test/org/openda/model_RainfallRunoffZhang/ASCIITimeSeriesStochObserverTest.java
index d93f89df1..e32dfff92 100644
--- a/model_RainfallRunoffZhang/java/test/org/openda/model_RainfallRunoffZhang/ASCIITimeSeriesStochObserverTest.java
+++ b/model_RainfallRunoffZhang/java/test/org/openda/model_RainfallRunoffZhang/ASCIITimeSeriesStochObserverTest.java
@@ -382,13 +382,13 @@ public void testStochObserver_noosObserver6() {
IStochObserver noosStochObserver_a = new ASCIITimeSeriesStochObserver();
noosStochObserver_a.initialize(workingDir, new String[]{"noosStochObsConfig_a.xml"});
- List exchangeItems_a = noosStochObserver_a.getObservationDescriptions().getExchangeItems();
+ List exchangeItems_a = noosStochObserver_a.getObservationDescriptions().getExchangeItems();
assertEquals("First Series", "location 1 Measurement", exchangeItems_a.get(0).getId());
assertEquals("First Series", "location 2 Measurement", exchangeItems_a.get(1).getId());
IStochObserver noosStochObserver_b = new ASCIITimeSeriesStochObserver();
noosStochObserver_b.initialize(workingDir, new String[]{"noosStochObsConfig_b.xml"});
- List exchangeItems_b = noosStochObserver_b.getObservationDescriptions().getExchangeItems();
+ List exchangeItems_b = noosStochObserver_b.getObservationDescriptions().getExchangeItems();
assertEquals("First Series", "ObsPoint1.waterlevel", exchangeItems_b.get(0).getId());
assertEquals("First Series", "ObsPoint2.waterlevel", exchangeItems_b.get(1).getId());
@@ -397,7 +397,7 @@ public void testStochObserver_noosObserver6() {
double endTime = times[times.length-1];
ITime timeSpan = new Time(startTime, endTime);
IStochObserver selection = noosStochObserver_b.createSelection(timeSpan);
- List exchangeItems_c = selection.getObservationDescriptions().getExchangeItems();
+ List exchangeItems_c = selection.getObservationDescriptions().getExchangeItems();
assertEquals("First Series", "ObsPoint1.waterlevel", exchangeItems_c.get(0).getId());
assertEquals("First Series", "ObsPoint2.waterlevel", exchangeItems_c.get(1).getId());
}
diff --git a/model_RainfallRunoffZhang/java/test/org/openda/model_RainfallRunoffZhang/ForcingWrapperTest.java b/model_RainfallRunoffZhang/java/test/org/openda/model_RainfallRunoffZhang/ForcingWrapperTest.java
index 5f279a732..76930b851 100644
--- a/model_RainfallRunoffZhang/java/test/org/openda/model_RainfallRunoffZhang/ForcingWrapperTest.java
+++ b/model_RainfallRunoffZhang/java/test/org/openda/model_RainfallRunoffZhang/ForcingWrapperTest.java
@@ -18,29 +18,20 @@
* along with OpenDA. If not, see .
*/
package org.openda.model_RainfallRunoffZhang;
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.nio.file.Files;
-import java.nio.file.NoSuchFileException;
-import java.nio.file.Path;
-import org.openda.blackbox.interfaces.IoObjectInterface;
-import org.openda.interfaces.IPrevExchangeItem;
+import junit.framework.TestCase;
+import org.openda.interfaces.IExchangeItem;
import org.openda.utils.OpenDaTestSupport;
-import junit.framework.TestCase;
+import java.io.*;
+import java.nio.file.Files;
+import java.nio.file.NoSuchFileException;
+import java.nio.file.Path;
public class ForcingWrapperTest extends TestCase {
// Use openDA test suite.
private File testRunDataDir;
- private OpenDaTestSupport testData;
// Class types definitions:
private String fileNamePrecip = "forcingWrapperTestPrecip.txt"; // Needs to be created.
@@ -64,7 +55,7 @@ public class ForcingWrapperTest extends TestCase {
protected void setUp() throws IOException {
// Use openDA test utilities. This allows the test files to be stored
// in a separate directory from the source code.
- testData = new OpenDaTestSupport(ResultFileWrapperTest.class, "model_RainfallRunoffZhang");
+ OpenDaTestSupport testData = new OpenDaTestSupport(ResultFileWrapperTest.class, "model_RainfallRunoffZhang");
testRunDataDir = testData.getTestRunDataDir();
// Write a test file.
@@ -111,7 +102,7 @@ protected void setUp() throws IOException {
/**
* Cleans up test file created in setUp().
*/
- protected void tearDown() throws Exception {
+ protected void tearDown() {
try {
File file = new File(testRunDataDir, fileNamePrecip);
@@ -144,21 +135,23 @@ protected void tearDown() throws Exception {
*/
public void testReadPrecipitationInput() {
// Creates the I/O-Object from the wrapper to be tested.
- IoObjectInterface forcingWrapper = new ForcingWrapper();
- String args[] = {};
- double[] expectedTimes = new double[3];
- double[] expectedValues = new double[3];
+ ForcingWrapper forcingWrapper = new ForcingWrapper();
+ String[] args = {fileNamePrecip};
+ double[] expectedTimes;
+ double[] expectedValues;
// Call to initialize -> reads the file and writes 2 Exchange items.
- forcingWrapper.initialize(testRunDataDir, fileNamePrecip, args);
+ forcingWrapper.initialize(testRunDataDir, args);
- IPrevExchangeItem[] exchangeItems = forcingWrapper.getExchangeItems();
+ String[] exchangeItemIDs = forcingWrapper.getExchangeItemIDs();
- for (int item = 0; item < exchangeItems.length; item++) {
- if (exchangeItems[item].getId().equalsIgnoreCase("Precipitation")) {
- IPrevExchangeItem expectedExchangeItem = exchangeItems[item];
- expectedTimes = (double[]) expectedExchangeItem.getTimes();
- expectedValues = (double[]) expectedExchangeItem.getValuesAsDoubles();
+ for (String id:exchangeItemIDs) {
+ IExchangeItem expectedExchangeItem = forcingWrapper.getDataObjectExchangeItem(id);
+ String exId = expectedExchangeItem.getId();
+ assertEquals(id, exId);
+ if (exId.equalsIgnoreCase("Precipitation")) {
+ expectedTimes = expectedExchangeItem.getTimes();
+ expectedValues = expectedExchangeItem.getValuesAsDoubles();
assertEquals(value0, expectedValues[0]);
assertEquals(time0, expectedTimes[0]);
assertEquals(value1, expectedValues[1]);
@@ -171,21 +164,23 @@ public void testReadPrecipitationInput() {
public void testReadPotETInput() {
// Creates the I/O-Object from the wrapper to be tested.
- IoObjectInterface forcingWrapper = new ForcingWrapper();
- String args[] = {};
- double[] expectedTimes = new double[3];
- double[] expectedValues = new double[3];
+ ForcingWrapper forcingWrapper = new ForcingWrapper();
+ String[] args = {fileNamePotET};
+ double[] expectedTimes;
+ double[] expectedValues;
// Call to initialize -> reads the file and writes 2 Exchange items.
- forcingWrapper.initialize(testRunDataDir, fileNamePotET, args);
+ forcingWrapper.initialize(testRunDataDir, args);
- IPrevExchangeItem[] exchangeItems = forcingWrapper.getExchangeItems();
+ String[] exchangeItemIDs = forcingWrapper.getExchangeItemIDs();
- for (int item = 0; item < exchangeItems.length; item++) {
- if (exchangeItems[item].getId().equalsIgnoreCase("potET")) {
- IPrevExchangeItem expectedExchangeItem = exchangeItems[item];
- expectedTimes = (double[]) expectedExchangeItem.getTimes();
- expectedValues = (double[]) expectedExchangeItem.getValuesAsDoubles();
+ for (String id:exchangeItemIDs) {
+ IExchangeItem expectedExchangeItem = forcingWrapper.getDataObjectExchangeItem(id);
+ String exId = expectedExchangeItem.getId();
+ assertEquals(id, exId);
+ if (exId.equalsIgnoreCase("potET")) {
+ expectedTimes = expectedExchangeItem.getTimes();
+ expectedValues = expectedExchangeItem.getValuesAsDoubles();
assertEquals(value0, expectedValues[0]);
assertEquals(time00, expectedTimes[0]);
assertEquals(value1, expectedValues[1]);
@@ -197,35 +192,36 @@ public void testReadPotETInput() {
}
/**
- * Test whether or not the new forcing is written to file.
- * @throws FileNotFoundException
+ * Test whether or not the new forcing is written to file.
*/
- public void testPrecipFinish() throws FileNotFoundException {
+ public void testPrecipFinish() {
// Creates the I/O-Object from the wrapper to be tested.
- IoObjectInterface precipWrapper = new ForcingWrapper();
- String args[] = {};
+ ForcingWrapper precipWrapper = new ForcingWrapper();
+ String[] args = {fileNamePrecip};
double[] times = new double[3];
double[] values = new double[3];
// Call to initialize -> reads the file and writes 2 Exchange items.
- precipWrapper.initialize(testRunDataDir, fileNamePrecip, args);
+ precipWrapper.initialize(testRunDataDir, args);
// Modify times and values in exchange items
- IPrevExchangeItem[] exchangeItems = precipWrapper.getExchangeItems();
+ String[] exchangeItemIDs = precipWrapper.getExchangeItemIDs();
times[0] = time0 + 30;
times[1] = time1 + 30;
times[2] = time2 + 30;
- for (int item = 0; item < exchangeItems.length; item++) {
+ for (int i = 0; i < exchangeItemIDs.length; i++) {
+ String id = exchangeItemIDs[i];
+ IExchangeItem exchangeItem = precipWrapper.getDataObjectExchangeItem(id);
values[0] = value1 + 1;
values[1] = value1 + 2;
values[2] = value1 + 3;
- exchangeItems[item].setValues(values);
- exchangeItems[item].setTimes(times);
- System.out.println("testPrecipFinish(): writes exchangeItems[" + item + "].setValues[0] = " + values[0]);
- System.out.println("testPrecipFinish(): writes exchangeItems[" + item + "].setValues[1] = " + values[1]);
- System.out.println("testPrecipFinish(): writes exchangeItems[" + item + "].setTimes[0] = " + times[0]);
- System.out.println("testPrecipFinish(): writes exchangeItems[" + item + "].setTimes[1] = " + times[1]);
+ exchangeItem.setValues(values);
+ exchangeItem.setTimes(times);
+ System.out.println("testPrecipFinish(): writes exchangeItems[" + i + "].setValues[0] = " + values[0]);
+ System.out.println("testPrecipFinish(): writes exchangeItems[" + i + "].setValues[1] = " + values[1]);
+ System.out.println("testPrecipFinish(): writes exchangeItems[" + i + "].setTimes[0] = " + times[0]);
+ System.out.println("testPrecipFinish(): writes exchangeItems[" + i + "].setTimes[1] = " + times[1]);
}
precipWrapper.finish();
@@ -239,7 +235,7 @@ public void testPrecipFinish() throws FileNotFoundException {
FileInputStream in = new FileInputStream(testFile);
BufferedReader buff = new BufferedReader(new InputStreamReader(in));
String line = ""; // Initialize line.
- Boolean eof = false; // End of file cache.
+ boolean eof = false; // End of file cache.
double[] expectedTimes = new double[3];
double[] expectedValues = new double[3];
@@ -272,8 +268,8 @@ public void testPrecipFinish() throws FileNotFoundException {
columns[1] = columns[1].trim();
// Parse the values.
- expectedTimes[index] = Double.valueOf(columns[0]);
- expectedValues[index] = Double.valueOf(columns[1]);
+ expectedTimes[index] = Double.parseDouble(columns[0]);
+ expectedValues[index] = Double.parseDouble(columns[1]);
System.out.println("testPrecipFinish(): reads times[" + index + "] = " + expectedTimes[index]);
System.out.println("testPrecipFinish(): reads values[" + index + "] = " + expectedValues[index]);
index = index + 1;
@@ -291,31 +287,33 @@ public void testPrecipFinish() throws FileNotFoundException {
}
}
- public void testPotETFinish() throws FileNotFoundException {
+ public void testPotETFinish() {
// Creates the I/O-Object from the wrapper to be tested.
- IoObjectInterface potETWrapper = new ForcingWrapper();
- String args[] = {};
+ ForcingWrapper potETWrapper = new ForcingWrapper();
+ String[] args = {fileNamePotET};
double[] times = new double[3];
double[] values = new double[3];
// Call to initialize -> reads the file and writes 2 Exchange items.
- potETWrapper.initialize(testRunDataDir, fileNamePotET, args);
+ potETWrapper.initialize(testRunDataDir, args);
// Modify times and values in exchange items
- IPrevExchangeItem[] exchangeItems = potETWrapper.getExchangeItems();
+ String[] exchangeItemIDs = potETWrapper.getExchangeItemIDs();
times[0] = time00 + 30;
times[1] = time01 + 30;
times[2] = time02 + 30;
- for (int item = 0; item < exchangeItems.length; item++) {
+ for (int i = 0; i < exchangeItemIDs.length; i++) {
+ String id = exchangeItemIDs[i];
+ IExchangeItem exchangeItem = potETWrapper.getDataObjectExchangeItem(id);
values[0] = value1 + 1;
values[1] = value1 + 2;
values[2] = value1 + 3;
- exchangeItems[item].setValues(values);
- exchangeItems[item].setTimes(times);
- System.out.println("testPrecipFinish(): writes exchangeItems[" + item + "].setValues[0] = " + values[0]);
- System.out.println("testPrecipFinish(): writes exchangeItems[" + item + "].setValues[1] = " + values[1]);
- System.out.println("testPrecipFinish(): writes exchangeItems[" + item + "].setTimes[0] = " + times[0]);
- System.out.println("testPrecipFinish(): writes exchangeItems[" + item + "].setTimes[1] = " + times[1]);
+ exchangeItem.setValues(values);
+ exchangeItem.setTimes(times);
+ System.out.println("testPrecipFinish(): writes exchangeItems[" + i + "].setValues[0] = " + values[0]);
+ System.out.println("testPrecipFinish(): writes exchangeItems[" + i + "].setValues[1] = " + values[1]);
+ System.out.println("testPrecipFinish(): writes exchangeItems[" + i + "].setTimes[0] = " + times[0]);
+ System.out.println("testPrecipFinish(): writes exchangeItems[" + i + "].setTimes[1] = " + times[1]);
}
potETWrapper.finish();
@@ -329,7 +327,7 @@ public void testPotETFinish() throws FileNotFoundException {
FileInputStream in = new FileInputStream(testFile);
BufferedReader buff = new BufferedReader(new InputStreamReader(in));
String line = ""; // Initialize line.
- Boolean eof = false; // End of file cache.
+ boolean eof = false; // End of file cache.
double[] expectedTimes = new double[3];
double[] expectedValues = new double[3];
@@ -362,8 +360,8 @@ public void testPotETFinish() throws FileNotFoundException {
columns[1] = columns[1].trim();
// Parse the values.
- expectedTimes[index] = Double.valueOf(columns[0]);
- expectedValues[index] = Double.valueOf(columns[1]);
+ expectedTimes[index] = Double.parseDouble(columns[0]);
+ expectedValues[index] = Double.parseDouble(columns[1]);
System.out.println("testPotETFinish(): reads times[" + index + "] = " + expectedTimes[index]);
System.out.println("testPotETFinish(): reads values[" + index + "] = " + expectedValues[index]);
index = index + 1;
diff --git a/model_RainfallRunoffZhang/java/test/org/openda/model_RainfallRunoffZhang/InitialStatesWrapperTest.java b/model_RainfallRunoffZhang/java/test/org/openda/model_RainfallRunoffZhang/InitialStatesWrapperTest.java
index 83429b354..2f0434684 100644
--- a/model_RainfallRunoffZhang/java/test/org/openda/model_RainfallRunoffZhang/InitialStatesWrapperTest.java
+++ b/model_RainfallRunoffZhang/java/test/org/openda/model_RainfallRunoffZhang/InitialStatesWrapperTest.java
@@ -18,23 +18,15 @@
* along with OpenDA. If not, see .
*/
package org.openda.model_RainfallRunoffZhang;
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.nio.file.Files;
-import java.nio.file.NoSuchFileException;
-import java.nio.file.Path;
-import org.openda.blackbox.interfaces.IoObjectInterface;
-import org.openda.interfaces.IPrevExchangeItem;
+import junit.framework.TestCase;
+import org.openda.interfaces.IExchangeItem;
import org.openda.utils.OpenDaTestSupport;
-import junit.framework.TestCase;
+import java.io.*;
+import java.nio.file.Files;
+import java.nio.file.NoSuchFileException;
+import java.nio.file.Path;
/**
* Tester for a wrapper. The reading of a correct input file and the storing of
@@ -48,13 +40,10 @@ public class InitialStatesWrapperTest extends TestCase {
// Use openDA test suite.
private File testRunDataDir;
- private OpenDaTestSupport testData;
// Class types definitions:
private String fileName = "initialStatesTestInput.m"; // Needs to be created.
-
- // Reference ids and values.
- private String id0 = "currentTime";
+
private String id1 = "soilMoisture";
private String id2 = "gwStorage";
private double value0 = 33000;
@@ -67,10 +56,12 @@ public class InitialStatesWrapperTest extends TestCase {
protected void setUp() throws IOException {
// Use openDA test utilities. This allows the test files to be stored
// in a separate directory from the source code.
- testData = new OpenDaTestSupport(ResultFileWrapperTest.class, "model_RainfallRunoffZhang");
+ OpenDaTestSupport testData = new OpenDaTestSupport(ResultFileWrapperTest.class, "model_RainfallRunoffZhang");
testRunDataDir = testData.getTestRunDataDir();
// Write a test file.
+ // Reference ids and values.
+ String id0 = "currentTime";
String line0 = "% " + id0 + " = " + value0 + ", " + " finalTime " + " = " + value0 + System.getProperty("line.separator");
String line1 = id1 + " = " + value1 + "; % Some comment."
+ System.getProperty("line.separator"); // Correct input line.
@@ -98,7 +89,7 @@ protected void setUp() throws IOException {
/**
* Cleans up test file created in setUp().
*/
- protected void tearDown() throws Exception {
+ protected void tearDown() {
try {
File file = new File(testRunDataDir, fileName);
Path path = file.toPath();
@@ -119,43 +110,36 @@ protected void tearDown() throws Exception {
public void testReadInput() {
// Creates the I/O-Object from the wrapper to be tested.
- IoObjectInterface ioObject = new InitialStatesWrapper();
- String args[] = {};
+ InitialStatesWrapper dataObject = new InitialStatesWrapper();
+ String[] args = {fileName};
double[] expectedTimes = new double[1];
double[] expectedTimes2 = new double[1];
- double[] expectedValue = new double[1];
+ double[] expectedValue;
// Call to initialize -> reads the file and writes 2 Exchange items.
- ioObject.initialize(testRunDataDir, fileName, args);
+ dataObject.initialize(testRunDataDir, args);
// 2 exchange items should be present: soilMoistureExchangeItem and
// gwStorageExchangeItem.
- IPrevExchangeItem[] exchangeItems = ioObject.getExchangeItems();
-
- for (int item = 0; item < exchangeItems.length; item++) {
- if (exchangeItems[item].getId().equalsIgnoreCase(id1)) {
- IPrevExchangeItem expectedExchangeItem = exchangeItems[item];
- // String getId();
- String expectedId = expectedExchangeItem.getId();
- assertEquals(id1, expectedId);
+ String[] exchangeItemIDs = dataObject.getExchangeItemIDs();
- // public Object getValues();
- expectedTimes = (double[]) expectedExchangeItem.getTimes();
- expectedValue = (double[]) expectedExchangeItem.getValuesAsDoubles();
+ for (String id : exchangeItemIDs) {
+ IExchangeItem exchangeItem = dataObject.getDataObjectExchangeItem(id);
+ String exId = exchangeItem.getId();
+ assertEquals(id, exId);
+ if (exId.equalsIgnoreCase(id1)) {
+ expectedTimes = exchangeItem.getTimes();
+ expectedValue = exchangeItem.getValuesAsDoubles();
assertEquals(value1, expectedValue[0]);
assertEquals(value0, expectedTimes[0]);
}
- if (exchangeItems[item].getId().equalsIgnoreCase(id2)) {
- IPrevExchangeItem expectedExchangeItem = exchangeItems[item];
- String expectedId = expectedExchangeItem.getId();
- assertEquals(id2, expectedId);
-
- expectedTimes2 = (double[]) expectedExchangeItem.getTimes();
- expectedValue = (double[]) expectedExchangeItem.getValuesAsDoubles();
+ if (exId.equalsIgnoreCase(id2)) {
+ expectedTimes2 = exchangeItem.getTimes();
+ expectedValue = exchangeItem.getValuesAsDoubles();
assertEquals(value2, expectedValue[0]);
assertEquals(value0, expectedTimes2[0]);
-
-
+
+
}
}
@@ -165,36 +149,38 @@ public void testReadInput() {
/**
* Test whether or not the new initial states are written to file.
- * @throws FileNotFoundException
*/
- public void testFinish() throws FileNotFoundException {
+ public void testFinish() {
// Creates the I/O-Object from the wrapper to be tested.
- IoObjectInterface initialStatesWrapper = new InitialStatesWrapper();
- String args[] = {};
+ InitialStatesWrapper initialStatesWrapper = new InitialStatesWrapper();
+ String[] args = {fileName};
double[] times = new double[2];
double[] values = new double[2];
double[] values2 = new double[2];
// Call to initialize -> reads the file and writes 2 Exchange items.
- initialStatesWrapper.initialize(testRunDataDir, fileName, args);
+ initialStatesWrapper.initialize(testRunDataDir, args);
// Modify times and values in exchange items
- IPrevExchangeItem[] exchangeItems = initialStatesWrapper.getExchangeItems();
+ String[] exchangeItemIDs = initialStatesWrapper.getExchangeItemIDs();
times[0] = value0 + 1;
times[1] = value0 + 2;
- for (int item = 0; item < exchangeItems.length; item++) {
- if (exchangeItems[item].getId().equalsIgnoreCase(id1)) {
+ for (String id : exchangeItemIDs) {
+ IExchangeItem exchangeItem = initialStatesWrapper.getDataObjectExchangeItem(id);
+ String exId = exchangeItem.getId();
+ assertEquals(id, exId);
+ if (exId.equalsIgnoreCase(id1)) {
values[0] = value1 + 1;
values[1] = value1 + 2;
- exchangeItems[item].setValues(values);
- exchangeItems[item].setTimes(times);
- } else if (exchangeItems[item].getId().equalsIgnoreCase(id2)) {
+ exchangeItem.setValues(values);
+ exchangeItem.setTimes(times);
+ } else if (exId.equalsIgnoreCase(id2)) {
values2[0] = value2 + 1;
values2[1] = value2 + 2;
- exchangeItems[item].setValues(values2);
- exchangeItems[item].setTimes(times);
-
+ exchangeItem.setValues(values2);
+ exchangeItem.setTimes(times);
+
}
}
@@ -210,7 +196,7 @@ public void testFinish() throws FileNotFoundException {
FileInputStream in = new FileInputStream(testFile);
BufferedReader buff = new BufferedReader(new InputStreamReader(in));
String line = ""; // Initialize line.
- Boolean eof = false; // End of file cache.
+ boolean eof = false; // End of file cache.
double[] expectedTime = new double[2];
double[] expectedSoilMoisture = new double[1];
double[] expectedGwStorage = new double[1];
@@ -236,7 +222,7 @@ public void testFinish() throws FileNotFoundException {
// Now parse the line.
// Remove comments at end of line.
if (line.indexOf("%") > 1) {
- String columns[] = line.split("%");
+ String[] columns = line.split("%");
line = columns[0];
}
if (line.startsWith("%")) {
@@ -252,14 +238,14 @@ public void testFinish() throws FileNotFoundException {
columns[3] = columns[3].trim();
// Remove comma from columns[3].
String[] tempTime = columns[3].split(",");
- expectedTime[0] = Double.valueOf(tempTime[0]);
+ expectedTime[0] = Double.parseDouble(tempTime[0]);
} else {
System.out.println("InitialStatesWrapperTest.TestFinish(): Trouble reading current time.");
}
if (columns[4].equals("finalTime")) {
columns[6] = columns[6].trim();
- expectedTime[1] = Double.valueOf(columns[6]);
+ expectedTime[1] = Double.parseDouble(columns[6]);
} else {
System.out.println("InitialStatesWrapperTest.TestFinish(): Trouble reading final time.");
}
@@ -279,18 +265,18 @@ public void testFinish() throws FileNotFoundException {
// the beginning or the end
// of the string.
columns[1] = columns[1].trim();
- // Remove the semicollon at the end of the string in
+ // Remove the semicolon at the end of the string in
// columns[1].
- String temp[] = columns[1].split(";");
+ String[] temp = columns[1].split(";");
columns[1] = temp[0];
// Parse the values to the key caches in Java.
// --> Add if-loops for variables to be read here.
if (columns[0].equals("soilMoisture")) {
- expectedSoilMoisture[0] = Double.valueOf(columns[1]);
+ expectedSoilMoisture[0] = Double.parseDouble(columns[1]);
System.out.println(">> soilMoistureCache = " + expectedSoilMoisture[0]);
}
if (columns[0].equals("gwStorage")) {
- expectedGwStorage[0] = Double.valueOf(columns[1]);
+ expectedGwStorage[0] = Double.parseDouble(columns[1]);
System.out.println(">> gwStorageCache = " + expectedGwStorage[0]);
}
}
diff --git a/model_RainfallRunoffZhang/java/test/org/openda/model_RainfallRunoffZhang/ParametersWrapperTest.java b/model_RainfallRunoffZhang/java/test/org/openda/model_RainfallRunoffZhang/ParametersWrapperTest.java
index c9dc53c93..7d5eec098 100644
--- a/model_RainfallRunoffZhang/java/test/org/openda/model_RainfallRunoffZhang/ParametersWrapperTest.java
+++ b/model_RainfallRunoffZhang/java/test/org/openda/model_RainfallRunoffZhang/ParametersWrapperTest.java
@@ -18,23 +18,15 @@
* along with OpenDA. If not, see .
*/
package org.openda.model_RainfallRunoffZhang;
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.nio.file.Files;
-import java.nio.file.NoSuchFileException;
-import java.nio.file.Path;
-import org.openda.blackbox.interfaces.IoObjectInterface;
-import org.openda.interfaces.IPrevExchangeItem;
+import junit.framework.TestCase;
+import org.openda.interfaces.IExchangeItem;
import org.openda.utils.OpenDaTestSupport;
-import junit.framework.TestCase;
+import java.io.*;
+import java.nio.file.Files;
+import java.nio.file.NoSuchFileException;
+import java.nio.file.Path;
/**
* Tester for a wrapper. The reading of a correct input file and the storing of
@@ -48,7 +40,6 @@ public class ParametersWrapperTest extends TestCase {
// Use openDA test suite.
private File testRunDataDir;
- private OpenDaTestSupport testData;
private String fileName = "parametersWrapperTestInput.m"; // Needs to be created.
@@ -69,7 +60,7 @@ protected void setUp() throws IOException {
// Use openDA test utilities. This allows the test files to be stored
// in a separate directory from the source code.
- testData = new OpenDaTestSupport(ResultFileWrapperTest.class, "model_RainfallRunoffZhang");
+ OpenDaTestSupport testData = new OpenDaTestSupport(ResultFileWrapperTest.class, "model_RainfallRunoffZhang");
testRunDataDir = testData.getTestRunDataDir();
// Write a test file.
@@ -105,7 +96,7 @@ protected void setUp() throws IOException {
/**
* Cleans up test file created in setUp().
*/
- protected void tearDown() throws Exception {
+ protected void tearDown() {
try {
File file = new File(testRunDataDir, fileName);
@@ -128,46 +119,45 @@ protected void tearDown() throws Exception {
public void testReadInput() {
// Creates the I/O-Object from the wrapper to be tested.
- IoObjectInterface ioObject = new ParametersWrapper();
- String args[] = {};
+ ParametersWrapper parametersWrapper = new ParametersWrapper();
+ String[] args = {fileName};
// Call to initialize -> reads the file and writes 2 Exchange items.
- ioObject.initialize(testRunDataDir, fileName, args);
+ parametersWrapper.initialize(testRunDataDir, args);
// 2 exchange items should be present: soilMoistureExchangeItem and
// gwStorageExchangeItem.
- IPrevExchangeItem[] exchangeItems = ioObject.getExchangeItems();
+ String[] exchangeItemIDs = parametersWrapper.getExchangeItemIDs();
- for (int item = 0; item < exchangeItems.length; item++) {
- if (exchangeItems[item].getId().equalsIgnoreCase(id1)) {
- IPrevExchangeItem expectedExchangeItem = exchangeItems[item];
- // String getId();
- String expectedId = expectedExchangeItem.getId();
- assertEquals(id1, expectedId);
+ for (String id : exchangeItemIDs) {
+ if (id.equalsIgnoreCase(id1)) {
+ IExchangeItem expectedExchangeItem = parametersWrapper.getDataObjectExchangeItem(id);
+ String exId = expectedExchangeItem.getId();
+ assertEquals(exId,id1);
// public Object getValues();
double[] expectedValue = expectedExchangeItem.getValuesAsDoubles();
assertEquals(value1, expectedValue[0]);
}
- if (exchangeItems[item].getId().equalsIgnoreCase(id2)) {
- IPrevExchangeItem expectedExchangeItem = exchangeItems[item];
- String expectedId = expectedExchangeItem.getId();
- assertEquals(id2, expectedId);
+ if (id.equalsIgnoreCase(id2)) {
+ IExchangeItem expectedExchangeItem = parametersWrapper.getDataObjectExchangeItem(id);
+ String exId = expectedExchangeItem.getId();
+ assertEquals(exId,id2);
double[] expectedValue = expectedExchangeItem.getValuesAsDoubles();
assertEquals(value2, expectedValue[0]);
}
- if (exchangeItems[item].getId().equalsIgnoreCase(id3)) {
- IPrevExchangeItem expectedExchangeItem = exchangeItems[item];
- String expectedId = expectedExchangeItem.getId();
- assertEquals(id3, expectedId);
+ if (id.equalsIgnoreCase(id3)) {
+ IExchangeItem expectedExchangeItem = parametersWrapper.getDataObjectExchangeItem(id);
+ String exId = expectedExchangeItem.getId();
+ assertEquals(exId,id3);
double[] expectedValue = expectedExchangeItem.getValuesAsDoubles();
assertEquals(value3, expectedValue[0]);
}
- if (exchangeItems[item].getId().equalsIgnoreCase(id4)) {
- IPrevExchangeItem expectedExchangeItem = exchangeItems[item];
- String expectedId = expectedExchangeItem.getId();
- assertEquals(id4, expectedId);
+ if (id.equalsIgnoreCase(id4)) {
+ IExchangeItem expectedExchangeItem = parametersWrapper.getDataObjectExchangeItem(id);
+ String exId = expectedExchangeItem.getId();
+ assertEquals(exId,id4);
double[] expectedValue = expectedExchangeItem.getValuesAsDoubles();
assertEquals(value4, expectedValue[0]);
@@ -183,8 +173,8 @@ public void testReadInput() {
public void testFinish() throws FileNotFoundException {
// Creates the I/O-Object from the wrapper to be tested.
- IoObjectInterface parameterWrapper = new ParametersWrapper();
- String args[] = {};
+ ParametersWrapper parameterWrapper = new ParametersWrapper();
+ String[] args = {fileName};
double[] times = new double[2];
double[] values1 = new double[2];
double[] values2 = new double[2];
@@ -192,38 +182,41 @@ public void testFinish() throws FileNotFoundException {
double[] values4 = new double[2];
// Call to initialize -> reads the file and writes 2 Exchange items.
- parameterWrapper.initialize(testRunDataDir, fileName, args);
+ parameterWrapper.initialize(testRunDataDir, args);
- IPrevExchangeItem[] exchangeItems = parameterWrapper.getExchangeItems();
- for (int item = 0; item < exchangeItems.length; item++) {
- if (exchangeItems[item].getId().equalsIgnoreCase(id1)) {
- values1 = exchangeItems[item].getValuesAsDoubles();
+ String[] exchangeItemIDs = parameterWrapper.getExchangeItemIDs();
+ for (String id : exchangeItemIDs) {
+ IExchangeItem exchangeItem = parameterWrapper.getDataObjectExchangeItem(id);
+ String exId = exchangeItem.getId();
+ assertEquals(id, exId);
+ if (exId.equalsIgnoreCase(id1)) {
+ values1 = exchangeItem.getValuesAsDoubles();
values1[0] = values1[0] + 1;
values1[1] = values1[1] + 1;
- exchangeItems[item].setValues(values1);
- times = exchangeItems[item].getTimes();
+ exchangeItem.setValues(values1);
+ times = exchangeItem.getTimes();
times[0] = times[0] + 1;
times[1] = times[1] + 1;
- exchangeItems[item].setTimes(times);
+ exchangeItem.setTimes(times);
System.out.println("% currentTime = " + times[0] + ", finalTime = " + times[1]);
- } else if (exchangeItems[item].getId().equalsIgnoreCase(id2)) {
- values2 = exchangeItems[item].getValuesAsDoubles();
+ } else if (exId.equalsIgnoreCase(id2)) {
+ values2 = exchangeItem.getValuesAsDoubles();
values2[0] = values2[0] + 1;
values2[1] = values2[1] + 1;
- exchangeItems[item].setValues(values2);
- exchangeItems[item].setTimes(times);
- } else if (exchangeItems[item].getId().equalsIgnoreCase(id3)) {
- values3 = exchangeItems[item].getValuesAsDoubles();
+ exchangeItem.setValues(values2);
+ exchangeItem.setTimes(times);
+ } else if (exId.equalsIgnoreCase(id3)) {
+ values3 = exchangeItem.getValuesAsDoubles();
values3[0] = values3[0] + 0.4;
values3[1] = values3[1] + 0.4;
- exchangeItems[item].setValues(values3);
- exchangeItems[item].setTimes(times);
- } else if (exchangeItems[item].getId().equalsIgnoreCase(id4)) {
- values4 = exchangeItems[item].getValuesAsDoubles();
+ exchangeItem.setValues(values3);
+ exchangeItem.setTimes(times);
+ } else if (exId.equalsIgnoreCase(id4)) {
+ values4 = exchangeItem.getValuesAsDoubles();
values4[0] = values4[0] - 0.4;
values4[1] = values4[1] - 0.4;
- exchangeItems[item].setValues(values4);
- exchangeItems[item].setTimes(times);
+ exchangeItem.setValues(values4);
+ exchangeItem.setTimes(times);
}
}
@@ -238,7 +231,7 @@ public void testFinish() throws FileNotFoundException {
FileInputStream in = new FileInputStream(testFile);
BufferedReader buff = new BufferedReader(new InputStreamReader(in));
String line = ""; // Initialize line.
- Boolean eof = false; // End of file cache.
+ boolean eof = false; // End of file cache.
double[] expectedTime = new double[1];
double[] expectedParam_d = new double[1];
double[] expectedParam_Smax = new double[1];
@@ -265,7 +258,7 @@ public void testFinish() throws FileNotFoundException {
// Now parse the line.
// Remove comments at end of line.
if (line.indexOf("%") > 1) {
- String columns[] = line.split("%");
+ String[] columns = line.split("%");
line = columns[0];
}
if (line.startsWith("%")) {
@@ -282,7 +275,7 @@ public void testFinish() throws FileNotFoundException {
// Remove comma from columns[3].
String[] tempTime = columns[3].split(",");
System.out.println(">> Parameters : currentTime = " + tempTime[0]);
- expectedTime[0] = Double.valueOf(tempTime[0]);
+ expectedTime[0] = Double.parseDouble(tempTime[0]);
} else {
System.out.println("ParametersWrapper.testFinish(): trouble reading current time.");
}
@@ -305,25 +298,25 @@ public void testFinish() throws FileNotFoundException {
//System.out.println("dbg1 - key:"+columns[0]+" = value:"+columns[1]);
// Remove the semicollon at the end of the string in
// columns[1].
- String temp[] = columns[1].split(";");
+ String[] temp = columns[1].split(";");
columns[1] = temp[0];
// Parse the values to the key caches in Java.
// --> Add if-loops for variables to be read here.
if (columns[0].equals("parameter_d")) {
- expectedParam_d[0] = Double.valueOf(columns[1]);
+ expectedParam_d[0] = Double.parseDouble(columns[1]);
System.out.println("expectedParam_d = " + expectedParam_d[0]);
}
if (columns[0].equals("parameter_Smax")) {
- expectedParam_Smax[0] = Double.valueOf(columns[1]);
+ expectedParam_Smax[0] = Double.parseDouble(columns[1]);
System.out.println("expectedParam_Smax = " + expectedParam_Smax[0]);
}
// System.out.println("2 - key:"+columns[0]+" = value:"+columns[1]);
if (columns[0].equals("parameter_alpha1")) {
- expectedParam_a1[0] = Double.valueOf(columns[1]);
+ expectedParam_a1[0] = Double.parseDouble(columns[1]);
System.out.println("expectedParam_a1 = " + expectedParam_a1[0]);
}
if (columns[0].equals("parameter_alpha2")) {
- expectedParam_a2[0] = Double.valueOf(columns[1]);
+ expectedParam_a2[0] = Double.parseDouble(columns[1]);
System.out.println("expectedParam_a2 = " + expectedParam_a2[0]);
}
}
diff --git a/model_RainfallRunoffZhang/java/test/org/openda/model_RainfallRunoffZhang/ResultFileWrapperTest.java b/model_RainfallRunoffZhang/java/test/org/openda/model_RainfallRunoffZhang/ResultFileWrapperTest.java
index 725e723ef..2b13535ff 100644
--- a/model_RainfallRunoffZhang/java/test/org/openda/model_RainfallRunoffZhang/ResultFileWrapperTest.java
+++ b/model_RainfallRunoffZhang/java/test/org/openda/model_RainfallRunoffZhang/ResultFileWrapperTest.java
@@ -29,7 +29,7 @@
import org.openda.exchange.DoublesExchangeItem;
import org.openda.exchange.timeseries.TimeSeries;
import org.openda.exchange.timeseries.TimeSeriesFormatter;
-import org.openda.interfaces.IPrevExchangeItem;
+import org.openda.interfaces.IExchangeItem;
import org.openda.utils.OpenDaTestSupport;
import junit.framework.TestCase;
@@ -45,7 +45,6 @@ public class ResultFileWrapperTest extends TestCase {
// Use openDA test suite.
private File testRunDataDir;
- private OpenDaTestSupport testData;
private String fileName = "resultFileWrapperTestInput.txt"; // Needs to be created.
@@ -66,7 +65,7 @@ protected void setUp() throws IOException {
// Use openDA test utilities. This allows the test files to be stored
// in a separate directory from the source code.
- testData = new OpenDaTestSupport(ResultFileWrapperTest.class, "model_RainfallRunoffZhang");
+ OpenDaTestSupport testData = new OpenDaTestSupport(ResultFileWrapperTest.class, "model_RainfallRunoffZhang");
testRunDataDir = testData.getTestRunDataDir();
// Write a test file.
@@ -101,7 +100,7 @@ protected void setUp() throws IOException {
/**
* Cleans up (deletes) test file created in setUp().
*/
- protected void tearDown() throws Exception {
+ protected void tearDown() {
try {
File file = new File(testRunDataDir, fileName);
@@ -125,148 +124,49 @@ public void testReadInput() {
// Creates the I/O-Object from the wrapper to be tested.
ResultFileWrapper resultFileWrapper = new ResultFileWrapper();
- String args[] = {};
+ String[] args = {fileName};
// Call to initialize -> reads the file and writes exchange items.
- resultFileWrapper.initialize(testRunDataDir, fileName, args);
+ resultFileWrapper.initialize(testRunDataDir, args);
- IPrevExchangeItem[] resultExchangeItems = resultFileWrapper.getExchangeItems();
+ String[] exchangeItemIDs = resultFileWrapper.getExchangeItemIDs();
// Iterate through all found exchange items.
- for(int item=0;item timesVector = new Vector();
- Vector valuesVector = new Vector();
- double[] times = new double[4];
- double[] values = new double[4];
-
- // Call to initialize -> reads the file and writes 2 Exchange items.
- resultWrapper.initialize(workingDir, fileName, args);
-
- // Modify times and values in exchange items
- IPrevExchangeItem[] exchangeItems = resultWrapper.getExchangeItems();
- times[0] = time1 + 10;
- times[1] = time2 + 10;
- times[2] = time3 + 10;
- times[3] = time4 + 10;
- for (int item = 0; item < exchangeItems.length; item++) {
- values[0] = value1 + 1;
- values[1] = value1 + 2;
- values[2] = value1 + 3;
- values[3] = value1 + 4;
- exchangeItems[item].setValues(values);
- exchangeItems[item].setTimes(times);
- }
-
- resultWrapper.finish();
-
- // Read in the file again.
- // Create nested reader.
- File testFile = new File(workingDir, fileName);
- try{
- FileInputStream in = new FileInputStream(testFile);
- BufferedReader buff = new BufferedReader(new InputStreamReader(in));
- String line = ""; // Initialize line.
- Boolean eof = false; // End of file cache.
-
- while (!eof) {
- // Read line.
- line = buff.readLine();
- // System.out.println("line : " + line);
- // Test for end of file.
- if (line == null) {
- eof = true;
- } else if (line.startsWith("%")) {
- // If the lines starts with comment or meta data, do nothing.
- continue;
- } else if (line.startsWith("#")) {
- continue;
- } else if (line.equals("")) {
- // If the line is empty, do nothing.
- continue;
- } else {
- // If the end of the file is not reached yet split line and store
- // data.
- String[] columns = line.split("\\s");
-
- if (columns.length != 2) {
- buff.close();
- in.close();
- throw new RuntimeException("Reading TimeSeries : Wrong number of arguments : '" + line + "'");
- }
-
- // Now parse the line.
- columns[0] = columns[0].trim();
- columns[1] = columns[1].trim();
-
- timesVector.add(Double.valueOf(columns[0])); // Values are added to dynamic Vector.
- valuesVector.add(Double.valueOf(columns[1]));
- }
- }
- // Close the writers.
- buff.close();
- in.close();
- } catch (IOException e) {
- System.out.println("IOException in WrapperTest -> testFinish()");
- e.printStackTrace();
- }
-
- assertEquals(times[0],timesVector.get(0));
- assertEquals(times[1],timesVector.get(1));
- assertEquals(times[2],timesVector.get(2));
- assertEquals(times[3],timesVector.get(3));
- assertEquals(values[0],valuesVector.get(0));
- assertEquals(values[1],valuesVector.get(1));
- assertEquals(values[2],valuesVector.get(2));
- assertEquals(values[3],valuesVector.get(3));
- */
- }
-
}
diff --git a/model_RainfallRunoffZhang/java/test/org/openda/model_RainfallRunoffZhang/TimesWrapperTest.java b/model_RainfallRunoffZhang/java/test/org/openda/model_RainfallRunoffZhang/TimesWrapperTest.java
index 7046916b5..0950223cc 100644
--- a/model_RainfallRunoffZhang/java/test/org/openda/model_RainfallRunoffZhang/TimesWrapperTest.java
+++ b/model_RainfallRunoffZhang/java/test/org/openda/model_RainfallRunoffZhang/TimesWrapperTest.java
@@ -18,22 +18,15 @@
* along with OpenDA. If not, see .
*/
package org.openda.model_RainfallRunoffZhang;
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.nio.file.Files;
-import java.nio.file.NoSuchFileException;
-import java.nio.file.Path;
-import org.openda.blackbox.interfaces.IoObjectInterface;
-import org.openda.interfaces.IPrevExchangeItem;
+import junit.framework.TestCase;
+import org.openda.interfaces.IExchangeItem;
import org.openda.utils.OpenDaTestSupport;
-import junit.framework.TestCase;
+import java.io.*;
+import java.nio.file.Files;
+import java.nio.file.NoSuchFileException;
+import java.nio.file.Path;
/**
* Tester for a wrapper. The reading of a correct input file and the storing of
@@ -48,7 +41,6 @@ public class TimesWrapperTest extends TestCase {
// Use openDA test suite.
private File testRunDataDir;
- private OpenDaTestSupport testData;
private String fileName = "timesWrapperTestInput.m"; // Needs to be created.
@@ -67,7 +59,7 @@ protected void setUp() throws IOException {
// Use openDA test utilities. This allows the test files to be stored
// in a separate directory from the source code.
- testData = new OpenDaTestSupport(ResultFileWrapperTest.class, "model_RainfallRunoffZhang");
+ OpenDaTestSupport testData = new OpenDaTestSupport(ResultFileWrapperTest.class, "model_RainfallRunoffZhang");
testRunDataDir = testData.getTestRunDataDir();
// Write a test input file.
@@ -94,7 +86,7 @@ protected void setUp() throws IOException {
/**
* Cleans up test file created in setUp().
*/
- protected void tearDown() throws Exception {
+ protected void tearDown() {
try {
File file = new File(testRunDataDir, fileName);
Path path = file.toPath();
@@ -116,39 +108,29 @@ protected void tearDown() throws Exception {
public void testReadInput() {
// Creates the I/O-Object from the wrapper to be tested.
- IoObjectInterface ioObject = new TimesWrapper();
- String args[] = {};
+ TimesWrapper timesWrapper = new TimesWrapper();
+ String[] args = {fileName};
// Call to initialize -> reads the file and writes 2 Exchange items.
- ioObject.initialize(testRunDataDir, fileName, args);
+ timesWrapper.initialize(testRunDataDir, args);
// 2 exchange items should be present: soilMoistureExchangeItem and
// gwStorageExchangeItem.
- IPrevExchangeItem[] exchangeItems = ioObject.getExchangeItems();
-
- for (int item = 0; item < exchangeItems.length; item++) {
- if (exchangeItems[item].getId().equalsIgnoreCase(id1)) {
- IPrevExchangeItem expectedExchangeItem = exchangeItems[item];
- String expectedId = expectedExchangeItem.getId();
- assertEquals(id1, expectedId);
-
- // public Object getValues();
- double[] expectedValue = expectedExchangeItem.getValuesAsDoubles();
+ String[] exchangeItemIDs = timesWrapper.getExchangeItemIDs();
+
+ for (String id : exchangeItemIDs) {
+ IExchangeItem exchangeItem = timesWrapper.getDataObjectExchangeItem(id);
+ String exId = exchangeItem.getId();
+ assertEquals(id, exId);
+ if (exId.equalsIgnoreCase(id1)) {
+ double[] expectedValue = exchangeItem.getValuesAsDoubles();
assertEquals(value1, expectedValue[0]);
}
- if (exchangeItems[item].getId().equalsIgnoreCase(id2)) {
- IPrevExchangeItem expectedExchangeItem = exchangeItems[item];
- String expectedId = expectedExchangeItem.getId();
- assertEquals(id2, expectedId);
-
- double[] expectedValue = expectedExchangeItem.getValuesAsDoubles();
+ if (exId.equalsIgnoreCase(id2)) {
+ double[] expectedValue = exchangeItem.getValuesAsDoubles();
assertEquals(value2, expectedValue[0]);
}
- if (exchangeItems[item].getId().equalsIgnoreCase(id3)) {
- IPrevExchangeItem expectedExchangeItem = exchangeItems[item];
- String expectedId = expectedExchangeItem.getId();
- assertEquals(id3, expectedId);
-
- double[] expectedValue = expectedExchangeItem.getValuesAsDoubles();
+ if (exId.equalsIgnoreCase(id3)) {
+ double[] expectedValue = exchangeItem.getValuesAsDoubles();
assertEquals(value3, expectedValue[0]);
}
}
@@ -163,31 +145,31 @@ public void testFinish() {
double[] expectedSimTimeStep = new double[1];
double[] expectedFinalTime = new double[1];
- IoObjectInterface timesWrapper = new TimesWrapper();
- String args[] = {};
- timesWrapper.initialize(testRunDataDir, fileName, args);
+ TimesWrapper timesWrapper = new TimesWrapper();
+ String[] args = {fileName};
+ timesWrapper.initialize(testRunDataDir, args);
- IPrevExchangeItem[] exchangeItems = timesWrapper.getExchangeItems();
+ String[] exchangeItemIDs = timesWrapper.getExchangeItemIDs();
// modify the entries of the exchange items.
- for (int item = 0 ; item < exchangeItems.length; item++) {
- if (exchangeItems[item].getId().equalsIgnoreCase(id1)) {
- IPrevExchangeItem ei = exchangeItems[item];
- expectedCurrentTime = ei.getValuesAsDoubles();
+ for (String id : exchangeItemIDs) {
+ IExchangeItem exchangeItem = timesWrapper.getDataObjectExchangeItem(id);
+ String exId = exchangeItem.getId();
+ assertEquals(id, exId);
+ if (exId.equalsIgnoreCase(id1)) {
+ expectedCurrentTime = exchangeItem.getValuesAsDoubles();
expectedCurrentTime[0] = 2;
- ei.setValuesAsDoubles(expectedCurrentTime);
+ exchangeItem.setValuesAsDoubles(expectedCurrentTime);
}
- if (exchangeItems[item].getId().equalsIgnoreCase(id2)) {
- IPrevExchangeItem ei = exchangeItems[item];
- expectedSimTimeStep = ei.getValuesAsDoubles();
+ if (exId.equalsIgnoreCase(id2)) {
+ expectedSimTimeStep = exchangeItem.getValuesAsDoubles();
expectedSimTimeStep[0] = 100;
- ei.setValuesAsDoubles(expectedSimTimeStep);
+ exchangeItem.setValuesAsDoubles(expectedSimTimeStep);
}
- if (exchangeItems[item].getId().equalsIgnoreCase(id3)) {
- IPrevExchangeItem ei = exchangeItems[item];
- expectedFinalTime = ei.getValuesAsDoubles();
+ if (exId.equalsIgnoreCase(id3)) {
+ expectedFinalTime = exchangeItem.getValuesAsDoubles();
expectedFinalTime[0] = 21;
- ei.setValuesAsDoubles(expectedFinalTime);
+ exchangeItem.setValuesAsDoubles(expectedFinalTime);
}
}
@@ -204,8 +186,8 @@ public void testFinish() {
try{
FileInputStream in = new FileInputStream(namelist);
BufferedReader buff = new BufferedReader(new InputStreamReader(in));
- String line = ""; // Initialize line.
- Boolean eof = false; // End of file cache.
+ String line; // Initialize line.
+ boolean eof = false; // End of file cache.
// While End of file is not reached yet do the following:
while (!eof) {
@@ -222,7 +204,7 @@ public void testFinish() {
// Now parse the line.
// Remove comments at end of line.
if (line.indexOf("%") > 1) {
- String columns[] = line.split("%");
+ String[] columns = line.split("%");
line = columns[0];
}
if (line.startsWith("%")) {
@@ -237,20 +219,20 @@ public void testFinish() {
// of the string.
columns[1] = columns[1].trim();
// Remove the semicollon at the end of the string in columns[1].
- String temp[] = columns[1].split(";");
+ String[] temp = columns[1].split(";");
columns[1] = temp[0];
// Parse the values to the key caches in Java.
// --> Add if-loops for variables to be read here.
if (columns[0].equals("currentTime")) {
- readCurrentTime = Double.valueOf(columns[1]);
+ readCurrentTime = Double.parseDouble(columns[1]);
}
if (columns[0].equals("simulationTimeStep")) {
- readSimulationTimeStep = Double.valueOf(columns[1]);
+ readSimulationTimeStep = Double.parseDouble(columns[1]);
}
if (columns[0].equals("finalTime")) {
- readFinalTime = Double.valueOf(columns[1]);
+ readFinalTime = Double.parseDouble(columns[1]);
}
}
diff --git a/model_RainfallRunoffZhang/tests/model/WrapperConfig.xml b/model_RainfallRunoffZhang/tests/model/WrapperConfig.xml
index acc1e0e55..f57638cf2 100644
--- a/model_RainfallRunoffZhang/tests/model/WrapperConfig.xml
+++ b/model_RainfallRunoffZhang/tests/model/WrapperConfig.xml
@@ -42,46 +42,46 @@
-
+