Moved mock.app.App#readFile(...) to shared.dataInput.XMLReader#readXMLFileToString(...).
Did the bare minimum to get the mock.model, mock.dataInput, shared.model tests working - many of them need to be tidied/refactored/moved as they don't take into account most of the refactorings.
This commit is contained in:
@@ -34,9 +34,9 @@ public class App extends Application {
|
||||
try {
|
||||
Polars boatPolars = PolarParser.parse("mock/polars/acc_polars.csv");
|
||||
|
||||
String regattaXML = readFile("mock/mockXML/regattaTest.xml", StandardCharsets.UTF_8);
|
||||
String raceXML = readFile("mock/mockXML/raceTest.xml", StandardCharsets.UTF_8);
|
||||
String boatXML = readFile("mock/mockXML/boatTest.xml", StandardCharsets.UTF_8);
|
||||
String regattaXML = XMLReader.readXMLFileToString("mock/mockXML/regattaTest.xml", StandardCharsets.UTF_8);
|
||||
String raceXML = XMLReader.readXMLFileToString("mock/mockXML/raceTest.xml", StandardCharsets.UTF_8);
|
||||
String boatXML = XMLReader.readXMLFileToString("mock/mockXML/boatTest.xml", StandardCharsets.UTF_8);
|
||||
|
||||
Event raceEvent = new Event(raceXML, regattaXML, boatXML, boatPolars);
|
||||
raceEvent.start();
|
||||
@@ -48,27 +48,6 @@ public class App extends Application {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads the Initial Race XML files that are necessary to run the mock.
|
||||
* @param path path of the XML
|
||||
* @param encoding encoding of the xml
|
||||
* @return A string containing the contents of the specified file.
|
||||
* @throws IOException No file etc
|
||||
* @throws ParserConfigurationException Issue with the XML formatting
|
||||
* @throws SAXException Issue with XML formatting
|
||||
* @throws TransformerException Issue with the XML format
|
||||
*/
|
||||
private String readFile(String path, Charset encoding) throws IOException, ParserConfigurationException, SAXException, TransformerException {
|
||||
|
||||
InputSource fXmlFile = new InputSource(getClass().getClassLoader().getResourceAsStream(path));
|
||||
|
||||
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
|
||||
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
|
||||
Document doc = dBuilder.parse(fXmlFile);
|
||||
doc.getDocumentElement().normalize();
|
||||
|
||||
return XMLReader.getContents(doc);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user