mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-11-13 14:12:11 +00:00
fixed ZIP file NMEA reading test
Change-Id: I3791871a66160624e6554e4d5592a00eae407f92
This commit is contained in:
1 parent
ebfe03d8bc
commit
123777280d
1 file changed
+37
-34
+37
-34
@@ -1,34 +1,37 @@
|
||||
package com.sap.sailing.nmeaconnector.test;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipInputStream;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.sap.sailing.domain.common.Wind;
|
||||
import com.sap.sailing.nmeaconnector.NmeaFactory;
|
||||
import com.sap.sse.common.Util;
|
||||
|
||||
public class NmeaFromZipImportTest {
|
||||
private ZipInputStream zipInputStream;
|
||||
|
||||
@Before
|
||||
public void setUp() throws FileNotFoundException {
|
||||
NmeaFactory.INSTANCE.getUtil().registerAdditionalParsers();
|
||||
zipInputStream = new ZipInputStream(new FileInputStream("resources/LogSS.txt.zip"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadOneZipEntry() throws IOException, InterruptedException {
|
||||
ZipEntry entry;
|
||||
while ((entry=zipInputStream.getNextEntry()) != null && entry.getName().toLowerCase().endsWith(".txt"));
|
||||
Iterable<Wind> windFixes = NmeaFactory.INSTANCE.readWind(zipInputStream);
|
||||
assertTrue(!Util.isEmpty(windFixes));
|
||||
}
|
||||
}
|
||||
package com.sap.sailing.nmeaconnector.test;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipInputStream;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.sap.sailing.domain.common.Wind;
|
||||
import com.sap.sailing.nmeaconnector.NmeaFactory;
|
||||
import com.sap.sse.common.Util;
|
||||
|
||||
public class NmeaFromZipImportTest {
|
||||
private ZipInputStream zipInputStream;
|
||||
|
||||
@Before
|
||||
public void setUp() throws FileNotFoundException {
|
||||
NmeaFactory.INSTANCE.getUtil().registerAdditionalParsers();
|
||||
zipInputStream = new ZipInputStream(new FileInputStream("resources/LogSS.txt.zip"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadOneZipEntry() throws IOException, InterruptedException {
|
||||
ZipEntry entry;
|
||||
while ((entry=zipInputStream.getNextEntry()) != null) {
|
||||
if (entry.getName().toLowerCase().endsWith(".txt")) {
|
||||
Iterable<Wind> windFixes = NmeaFactory.INSTANCE.readWind(zipInputStream);
|
||||
assertTrue(!Util.isEmpty(windFixes));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user