mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-09-20 04:35:32 +00:00
Added unit test for WindEstimationDataClient (yet without
wind_estimation_data)
This commit is contained in:
+33
@@ -0,0 +1,33 @@
|
||||
package com.sap.sailing.windestimation.jaxrs.api;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
import org.json.simple.parser.ParseException;
|
||||
|
||||
import com.sap.sailing.windestimation.integration.ReplicableWindEstimationFactoryService;
|
||||
import com.sap.sailing.windestimation.jaxrs.client.WindEstimationDataClient;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Vladislav Chumak (D069712)
|
||||
*
|
||||
*/
|
||||
public class WindEstimationDataClientMock extends WindEstimationDataClient {
|
||||
|
||||
private final File file;
|
||||
|
||||
public WindEstimationDataClientMock(File file,
|
||||
ReplicableWindEstimationFactoryService windEstimationFactoryService) {
|
||||
super(null, windEstimationFactoryService);
|
||||
this.file = file;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected InputStream getContentFromResponse() throws IOException, ParseException {
|
||||
return new FileInputStream(file);
|
||||
}
|
||||
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
package com.sap.sailing.windestimation.jaxrs.api;
|
||||
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.json.simple.parser.ParseException;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.sap.sailing.domain.polars.NotEnoughDataHasBeenAddedException;
|
||||
import com.sap.sailing.windestimation.integration.WindEstimationFactoryServiceImpl;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Vladislav Chumak (D069712)
|
||||
*
|
||||
*/
|
||||
public class WindEstimationDataResourceTest {
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void testImportingFromMockFile() throws NotEnoughDataHasBeenAddedException, ClassNotFoundException,
|
||||
IOException, ParseException, InterruptedException {
|
||||
WindEstimationFactoryServiceImpl windEstimationFactoryService = new WindEstimationFactoryServiceImpl();
|
||||
assertFalse(windEstimationFactoryService.isReady());
|
||||
final WindEstimationDataClientMock client = new WindEstimationDataClientMock(
|
||||
new File("resources/wind_estimation_data"), windEstimationFactoryService);
|
||||
client.updateWindEstimationModels();
|
||||
assertTrue(windEstimationFactoryService.isReady());
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user