Permalink
Browse files

fixed refactoring errors #4

  • Loading branch information...
1 parent 1d31e6f commit 7dea7965d6e61f825e5b024ff1210284a9474e74 thomasstorm committed May 10, 2012
@@ -18,7 +18,6 @@
import org.esa.beam.framework.datamodel.GeoPos;
import org.esa.beam.framework.datamodel.ProductData;
-import org.esa.beam.timeseries.core.insitu.InsituSource;
import org.esa.beam.timeseries.core.insitu.csv.CsvRecordSource;
import org.esa.beam.timeseries.core.insitu.csv.InsituRecord;
import org.junit.Before;
@@ -50,72 +49,72 @@ public void setUp() throws Exception {
+ "20\t40\t03.04.2003\tName 2\t0.5\t30\n"
+ "20\t40\t05.04.2003\tName 2\t0.6\t40\n"
+ "20\t50\t11.04.2003\tName 3\t0.4\t50\n");
- final org.esa.beam.timeseries.core.insitu.csv.CsvRecordSource csvRecordSource = new org.esa.beam.timeseries.core.insitu.csv.CsvRecordSource(csvReader, dateFormat);
+ final CsvRecordSource csvRecordSource = new CsvRecordSource(csvReader, dateFormat);
insituSource = new InsituSource(csvRecordSource);
}
@Test
public void testGetValuesForCHL_TimeOrdered() throws Exception {
// execution
- org.esa.beam.timeseries.core.insitu.csv.InsituRecord[] chlRecords = insituSource.getValuesFor("CHL", null);
+ InsituRecord[] chlRecords = insituSource.getValuesFor("CHL", null);
// verification
assertEquals(4, chlRecords.length);
- org.esa.beam.timeseries.core.insitu.csv.InsituRecord expectedRecord;
- expectedRecord = new org.esa.beam.timeseries.core.insitu.csv.InsituRecord(new GeoPos(20, 40), getDate("03.04.2003"), "Name 2", 0.5);
+ InsituRecord expectedRecord;
+ expectedRecord = new InsituRecord(new GeoPos(20, 40), getDate("03.04.2003"), "Name 2", 0.5);
assertEquals(expectedRecord, chlRecords[0]);
- expectedRecord = new org.esa.beam.timeseries.core.insitu.csv.InsituRecord(new GeoPos(20, 40), getDate("05.04.2003"), "Name 2", 0.6);
+ expectedRecord = new InsituRecord(new GeoPos(20, 40), getDate("05.04.2003"), "Name 2", 0.6);
assertEquals(expectedRecord, chlRecords[1]);
- expectedRecord = new org.esa.beam.timeseries.core.insitu.csv.InsituRecord(new GeoPos(10, 30), getDate("08.04.2003"), "Name 1", 0.9);
+ expectedRecord = new InsituRecord(new GeoPos(10, 30), getDate("08.04.2003"), "Name 1", 0.9);
assertEquals(expectedRecord, chlRecords[2]);
- expectedRecord = new org.esa.beam.timeseries.core.insitu.csv.InsituRecord(new GeoPos(20, 50), getDate("11.04.2003"), "Name 3", 0.4);
+ expectedRecord = new InsituRecord(new GeoPos(20, 50), getDate("11.04.2003"), "Name 3", 0.4);
assertEquals(expectedRecord, chlRecords[3]);
}
@Test
public void testGetValuesForYS_TimeOrdered() throws Exception {
// execution
- org.esa.beam.timeseries.core.insitu.csv.InsituRecord[] ysRecords = insituSource.getValuesFor("ys", null);
+ InsituRecord[] ysRecords = insituSource.getValuesFor("ys", null);
// verification
assertEquals(4, ysRecords.length);
- org.esa.beam.timeseries.core.insitu.csv.InsituRecord expectedRecord;
- expectedRecord = new org.esa.beam.timeseries.core.insitu.csv.InsituRecord(new GeoPos(20, 40), getDate("03.04.2003"), "Name 2", 30);
+ InsituRecord expectedRecord;
+ expectedRecord = new InsituRecord(new GeoPos(20, 40), getDate("03.04.2003"), "Name 2", 30);
assertEquals(expectedRecord, ysRecords[0]);
- expectedRecord = new org.esa.beam.timeseries.core.insitu.csv.InsituRecord(new GeoPos(20, 40), getDate("05.04.2003"), "Name 2", 40);
+ expectedRecord = new InsituRecord(new GeoPos(20, 40), getDate("05.04.2003"), "Name 2", 40);
assertEquals(expectedRecord, ysRecords[1]);
- expectedRecord = new org.esa.beam.timeseries.core.insitu.csv.InsituRecord(new GeoPos(10, 30), getDate("08.04.2003"), "Name 1", 20);
+ expectedRecord = new InsituRecord(new GeoPos(10, 30), getDate("08.04.2003"), "Name 1", 20);
assertEquals(expectedRecord, ysRecords[2]);
- expectedRecord = new org.esa.beam.timeseries.core.insitu.csv.InsituRecord(new GeoPos(20, 50), getDate("11.04.2003"), "Name 3", 50);
+ expectedRecord = new InsituRecord(new GeoPos(20, 50), getDate("11.04.2003"), "Name 3", 50);
assertEquals(expectedRecord, ysRecords[3]);
}
@Test
public void testGetValuesForGeoPos() throws Exception {
// execution
- org.esa.beam.timeseries.core.insitu.csv.InsituRecord[] chlRecordsPos1 = insituSource.getValuesFor("ys", new GeoPos(20, 40));
- org.esa.beam.timeseries.core.insitu.csv.InsituRecord[] chlRecordsPos2 = insituSource.getValuesFor("ys", new GeoPos(10, 30));
+ InsituRecord[] chlRecordsPos1 = insituSource.getValuesFor("ys", new GeoPos(20, 40));
+ InsituRecord[] chlRecordsPos2 = insituSource.getValuesFor("ys", new GeoPos(10, 30));
// verification
assertEquals(2, chlRecordsPos1.length);
assertEquals(1, chlRecordsPos2.length);
- org.esa.beam.timeseries.core.insitu.csv.InsituRecord expectedRecord;
- expectedRecord = new org.esa.beam.timeseries.core.insitu.csv.InsituRecord(new GeoPos(20, 40), getDate("03.04.2003"), "Name 2", 30);
+ InsituRecord expectedRecord;
+ expectedRecord = new InsituRecord(new GeoPos(20, 40), getDate("03.04.2003"), "Name 2", 30);
assertEquals(expectedRecord, chlRecordsPos1[0]);
- expectedRecord = new org.esa.beam.timeseries.core.insitu.csv.InsituRecord(new GeoPos(20, 40), getDate("05.04.2003"), "Name 2", 40);
+ expectedRecord = new InsituRecord(new GeoPos(20, 40), getDate("05.04.2003"), "Name 2", 40);
assertEquals(expectedRecord, chlRecordsPos1[1]);
- expectedRecord = new org.esa.beam.timeseries.core.insitu.csv.InsituRecord(new GeoPos(10, 30), getDate("08.04.2003"), "Name 1", 20);
+ expectedRecord = new InsituRecord(new GeoPos(10, 30), getDate("08.04.2003"), "Name 1", 20);
assertEquals(expectedRecord, chlRecordsPos2[0]);
}
@@ -38,7 +38,7 @@ public void testSimpleCsv() throws Exception {
Iterable<Record> records = recordSource.getRecords();
assertNotNull(records);
- Iterator<org.esa.beam.timeseries.core.insitu.Record> iterator = records.iterator();
+ Iterator<Record> iterator = records.iterator();
assertNotNull(iterator);
assertTrue(iterator.hasNext());
@@ -60,7 +60,7 @@ public void testSimpleCsv() throws Exception {
assertEquals("Name 2", rec2.getStationName());
assertTrue(iterator.hasNext());
- org.esa.beam.timeseries.core.insitu.Record rec3 = iterator.next();
+ Record rec3 = iterator.next();
assertNotNull(rec3);
assertArrayEquals(new Object[]{(double) 18, 53.1, 13.5, dateFormat.parse("11.04.2003"), "Name 3", 0.4, (double) 1},
rec3.getAttributeValues());
@@ -84,22 +84,22 @@ public void testSimpleCsvWithMissingValues() throws Exception {
DateFormat dateFormat = ProductData.UTC.createDateFormat("dd.MM.yyyy");
CsvRecordSource recordSource = new CsvRecordSource(new StringReader(CSV), dateFormat);
- org.esa.beam.timeseries.core.insitu.Header header = recordSource.getHeader();
+ Header header = recordSource.getHeader();
assertNotNull(header);
assertNotNull(header.getColumnNames());
assertArrayEquals(new String[]{"ID", "LAT", "LONG", "TIME", "Name", "CHL", "FLAG"},
header.getColumnNames());
assertEquals(true, header.hasLocation());
assertEquals(true, header.hasTime());
- Iterable<org.esa.beam.timeseries.core.insitu.Record> records = recordSource.getRecords();
+ Iterable<Record> records = recordSource.getRecords();
assertNotNull(records);
Iterator<Record> iterator = records.iterator();
assertNotNull(iterator);
assertTrue(iterator.hasNext());
- org.esa.beam.timeseries.core.insitu.Record rec1 = iterator.next();
+ Record rec1 = iterator.next();
assertNotNull(rec1);
assertArrayEquals(new Object[]{(double) 16, 53.1, 13.6, dateFormat.parse("03.04.2003"), null, 0.5, (double) 1},
rec1.getAttributeValues());
@@ -108,7 +108,7 @@ public void testSimpleCsvWithMissingValues() throws Exception {
assertEquals(null, rec1.getStationName());
assertTrue(iterator.hasNext());
- org.esa.beam.timeseries.core.insitu.Record rec2 = iterator.next();
+ Record rec2 = iterator.next();
assertNotNull(rec2);
assertArrayEquals(new Object[]{(double) 17, 53.3, 13.4, dateFormat.parse("08.04.2003"), null, null, null},
rec2.getAttributeValues());
@@ -117,7 +117,7 @@ public void testSimpleCsvWithMissingValues() throws Exception {
assertEquals(null, rec2.getStationName());
assertTrue(iterator.hasNext());
- org.esa.beam.timeseries.core.insitu.Record rec3 = iterator.next();
+ Record rec3 = iterator.next();
assertNotNull(rec3);
assertArrayEquals(new Object[]{(double) 18, 53.1, 13.5, dateFormat.parse("11.04.2003"), "A", 0.4, null},
rec3.getAttributeValues());
@@ -131,7 +131,7 @@ public void testRealLifeCsv() throws Exception {
InputStreamReader reader = new InputStreamReader(getClass().getResourceAsStream("cc-matchup-test-insitu.csv"));
CsvRecordSource recordSource = new CsvRecordSource(reader, ProductData.UTC.createDateFormat("yyyy-MM-dd HH:mm:ss"));
- org.esa.beam.timeseries.core.insitu.Header header = recordSource.getHeader();
+ Header header = recordSource.getHeader();
assertNotNull(header);
String[] headerAttributeNames = header.getColumnNames();
assertNotNull(headerAttributeNames);
@@ -143,7 +143,7 @@ public void testRealLifeCsv() throws Exception {
long t0 = System.currentTimeMillis();
Iterable<Record> records = recordSource.getRecords();
int n = 0;
- for (org.esa.beam.timeseries.core.insitu.Record record : records) {
+ for (Record record : records) {
Object[] dataAttributeValues = record.getAttributeValues();
assertEquals(8, dataAttributeValues.length);
assertType(n, Double.class, dataAttributeValues[0]);

0 comments on commit 7dea796

Please sign in to comment.