Merge branch 'master' into bug4228

This commit is contained in:
Steffen Schaefer committed 2017-08-17 15:19:35 +02:00
commit 4d3cbd3aa3
4 files changed
+29 -1

No files matched your search

Binary file not shown.
Binary file not shown.
@@ -1,5 +1,6 @@
package com.sap.sailing.nmeaconnector.test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.io.FileInputStream;
@@ -48,4 +49,28 @@ public class NmeaFromZipImportTest {
}
}
}
@Test
public void testYetAnotherZipFile() throws IOException, InterruptedException {
zipInputStream = new ZipInputStream(new FileInputStream("resources/NMEA.zip"));
ZipEntry entry;
while ((entry=zipInputStream.getNextEntry()) != null) {
if (entry.getName().toLowerCase().endsWith(".txt")) {
Iterable<Wind> windFixes = NmeaFactory.INSTANCE.readWind(zipInputStream);
assertEquals(740, Util.size(windFixes));
}
}
}
@Test
public void testZipFileExcerptWithOnlyEmptyWindRecords() throws IOException, InterruptedException {
zipInputStream = new ZipInputStream(new FileInputStream("resources/NMEA_Snippet.zip"));
ZipEntry entry;
while ((entry=zipInputStream.getNextEntry()) != null) {
if (entry.getName().toLowerCase().endsWith(".txt")) {
Iterable<Wind> windFixes = NmeaFactory.INSTANCE.readWind(zipInputStream);
assertTrue(Util.isEmpty(windFixes));
}
}
}
}
@@ -7,6 +7,8 @@ import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
@@ -34,7 +36,7 @@ import com.sap.sailing.server.gateway.windimport.AbstractWindImportServlet.WindI
import com.sap.sse.common.Util;
public abstract class AbstractWindImportServlet extends SailingServerHttpServlet {
private static final Logger logger = Logger.getLogger(AbstractWindImportServlet.class.getName());
private static final long serialVersionUID = 1L;
public static class UploadRequest {
@@ -192,6 +194,7 @@ public abstract class AbstractWindImportServlet extends SailingServerHttpServlet
// Use text/html to prevent browsers from wrapping the response body,
// see "Handling File Upload Responses in GWT" at http://www.artofsolving.com/node/50
} catch (Exception e) {
logger.log(Level.SEVERE, "Error ocurred trying to import wind fixes", e);
windImportResult.error = e.toString();
}
response.setContentType("text/html;charset=UTF-8");