mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-20 03:00:00 +00:00
KiWo result test with loading "Verteilung" object green
This commit is contained in:
1 parent
fc1d91f8a6
commit
4a2633f7de
8 files changed
+80
-16
No files matched your search
@@ -6,4 +6,5 @@ Bundle-Version: 1.0.0.qualifier
|
||||
Bundle-Vendor: SAP
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
|
||||
Require-Bundle: org.junit4;bundle-version="4.8.2",
|
||||
com.sap.sailing.kiworesultimport
|
||||
com.sap.sailing.kiworesultimport,
|
||||
com.sap.sailing.domain.common
|
||||
+9
@@ -1,6 +1,7 @@
|
||||
package com.sap.sailing.kiworesultimport.test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
import java.io.File;
|
||||
@@ -17,9 +18,12 @@ import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Node;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
import com.sap.sailing.domain.common.impl.Util;
|
||||
import com.sap.sailing.kiworesultimport.Boat;
|
||||
import com.sap.sailing.kiworesultimport.ResultList;
|
||||
import com.sap.sailing.kiworesultimport.ResultListParser;
|
||||
import com.sap.sailing.kiworesultimport.ResultListParserFactory;
|
||||
import com.sap.sailing.kiworesultimport.Verteilung;
|
||||
|
||||
public class ParserTest {
|
||||
private static final String RESOURCES = "resources/";
|
||||
@@ -52,5 +56,10 @@ public class ParserTest {
|
||||
assertNotNull(resultList);
|
||||
assertEquals("D:\\Programme\\KWSailing\\eventlogos\\KielerWoche_Ergebnislistenkopf_2011.jpg", resultList.getImagePfad());
|
||||
assertEquals(new String(new byte[] { (byte) 160 /* non-breaking space */}), resultList.getLegende());
|
||||
final Verteilung verteilung = resultList.getVerteilung();
|
||||
assertNotNull(verteilung);
|
||||
Iterable<Boat> boats = verteilung.getBoats();
|
||||
assertFalse(Util.isEmpty(boats));
|
||||
assertEquals(48, Util.size(boats));
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -3,5 +3,5 @@ package com.sap.sailing.kiworesultimport;
|
||||
public interface Race {
|
||||
Double getPoints();
|
||||
|
||||
Double getNumber();
|
||||
Integer getNumber();
|
||||
}
|
||||
+9
-10
@@ -1,6 +1,8 @@
|
||||
package com.sap.sailing.kiworesultimport.impl;
|
||||
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
|
||||
import com.sap.sailing.kiworesultimport.Boat;
|
||||
import com.sap.sailing.kiworesultimport.Crew;
|
||||
@@ -14,32 +16,29 @@ public class BoatImpl extends NamedImpl implements Boat {
|
||||
|
||||
@Override
|
||||
public String getSailingNumber() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
return getNode().getAttributes().getNamedItem("sailingnumber").getNodeValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getPosition() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
return Integer.valueOf(getNode().getAttributes().getNamedItem("position").getNodeValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPreis() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
return getNode().getAttributes().getNamedItem("preis").getNodeValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Crew getCrew() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
final NodeList crew = ((Element) getNode()).getElementsByTagName("Crew");
|
||||
return new CrewImpl(crew.item(0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Races getRaces() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
final NodeList races = ((Element) getNode()).getElementsByTagName("Races");
|
||||
return new RacesImpl(races.item(0));
|
||||
}
|
||||
|
||||
}
|
||||
+13
-1
@@ -2,10 +2,22 @@ package com.sap.sailing.kiworesultimport.impl;
|
||||
|
||||
import org.w3c.dom.Node;
|
||||
|
||||
public class RaceImpl extends AbstractNodeWrapper {
|
||||
import com.sap.sailing.kiworesultimport.Race;
|
||||
|
||||
public class RaceImpl extends AbstractNodeWrapper implements Race {
|
||||
|
||||
public RaceImpl(Node node) {
|
||||
super(node);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Double getPoints() {
|
||||
return Double.valueOf(getNode().getAttributes().getNamedItem("points").getNodeValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getNumber() {
|
||||
return Integer.valueOf(getNode().getAttributes().getNamedItem("number").getNodeValue());
|
||||
}
|
||||
|
||||
}
|
||||
Executable
+34
@@ -0,0 +1,34 @@
|
||||
package com.sap.sailing.kiworesultimport.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
|
||||
import com.sap.sailing.kiworesultimport.Race;
|
||||
import com.sap.sailing.kiworesultimport.Races;
|
||||
|
||||
public class RacesImpl extends AbstractNodeWrapper implements Races {
|
||||
|
||||
public RacesImpl(Node node) {
|
||||
super(node);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Double getTotalPoints() {
|
||||
return Double.valueOf(getNode().getAttributes().getNamedItem("totalpoints").getNodeValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<Race> getRaces() {
|
||||
List<Race> result = new ArrayList<Race>();
|
||||
final NodeList races = ((Element) getNode()).getElementsByTagName("Race");
|
||||
for (int i=0; i<races.getLength(); i++) {
|
||||
result.add(new RaceImpl(races.item(i)));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
+1
-1
@@ -48,6 +48,6 @@ public class ResultListImpl extends AbstractNodeWrapper implements ResultList {
|
||||
|
||||
@Override
|
||||
public Verteilung getVerteilung() {
|
||||
return new VerteilungImpl(((Element) getNode()).getElementsByTagName("verteilung").item(0));
|
||||
return new VerteilungImpl(((Element) getNode()).getElementsByTagName("Verteilung").item(0));
|
||||
}
|
||||
}
|
||||
+11
-2
@@ -1,6 +1,11 @@
|
||||
package com.sap.sailing.kiworesultimport.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
|
||||
import com.sap.sailing.kiworesultimport.Boat;
|
||||
import com.sap.sailing.kiworesultimport.Verteilung;
|
||||
@@ -13,8 +18,12 @@ public class VerteilungImpl extends AbstractNodeWrapper implements Verteilung {
|
||||
|
||||
@Override
|
||||
public Iterable<Boat> getBoats() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
List<Boat> result = new ArrayList<Boat>();
|
||||
final NodeList boats = ((Element) getNode()).getElementsByTagName("Boat");
|
||||
for (int i=0; i<boats.getLength(); i++) {
|
||||
result.add(new BoatImpl(boats.item(i)));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user