mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-09-28 00:16:46 +00:00
Add Mocks, and modified tests
This commit is contained in:
@@ -9,3 +9,4 @@ Require-Bundle: com.sap.sailing.server,
|
||||
com.sap.sailing.domain,
|
||||
com.sap.sailing.domain.tractracadapter,
|
||||
org.junit4
|
||||
Import-Package: com.tractrac.clientmodule
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.sap.sailing.server.test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.management.RuntimeErrorException;
|
||||
|
||||
import com.sap.sailing.domain.base.Event;
|
||||
import com.sap.sailing.domain.base.RaceDefinition;
|
||||
import com.sap.sailing.domain.tracking.DynamicTrackedEvent;
|
||||
import com.sap.sailing.domain.tracking.RaceTracker;
|
||||
import com.sap.sailing.domain.tracking.RacesHandle;
|
||||
import com.sap.sailing.domain.tracking.WindStore;
|
||||
|
||||
public class RaceTrackerMock implements RaceTracker{
|
||||
|
||||
private Long id;
|
||||
private Event event;
|
||||
private Set<RaceDefinition> raceDefinitions;
|
||||
private boolean isTracking;
|
||||
|
||||
public RaceTrackerMock(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop() throws MalformedURLException, IOException, InterruptedException {
|
||||
isTracking = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Event getEvent() {
|
||||
return event;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<RaceDefinition> getRaces() {
|
||||
return raceDefinitions;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RacesHandle getRaceHandle() {
|
||||
throw new RuntimeException("No race Handle in RaceTrackerMock");
|
||||
}
|
||||
|
||||
@Override
|
||||
public DynamicTrackedEvent getTrackedEvent() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WindStore getWindStore() {
|
||||
throw new RuntimeException("No wind store in racetracker mock");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getID() {
|
||||
return id;
|
||||
}
|
||||
|
||||
}
|
||||
+28
-1
@@ -1,5 +1,32 @@
|
||||
package com.sap.sailing.server.test;
|
||||
|
||||
public class RaceTrackerStartStopTest {
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.sap.sailing.domain.base.BoatClass;
|
||||
import com.sap.sailing.domain.base.Event;
|
||||
import com.sap.sailing.domain.base.impl.EventImpl;
|
||||
import com.sap.sailing.server.RacingEventService;
|
||||
import com.sap.sailing.server.impl.RacingEventServiceImpl;
|
||||
|
||||
public class RaceTrackerStartStopTest {
|
||||
|
||||
private final static String EVENTNAME = "TESTEVENT";
|
||||
|
||||
private RacingEventServiceImplMock racingEventService;
|
||||
|
||||
private Event event;
|
||||
private BoatClass boatClass;
|
||||
|
||||
@Before
|
||||
public void setUp(){
|
||||
event = new EventImpl(EVENTNAME, BOATCLASS);
|
||||
}
|
||||
|
||||
@Test
|
||||
public RaceTrackerStartStopTest() {
|
||||
racingEventService = new RacingEventServiceImplMock();
|
||||
racingEventService.getEventsByName().put("Testevent", )
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
package com.sap.sailing.server.test;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import com.sap.sailing.domain.base.Event;
|
||||
import com.sap.sailing.domain.tracking.RaceTracker;
|
||||
import com.sap.sailing.server.impl.RacingEventServiceImpl;
|
||||
|
||||
|
||||
public class RacingEventServiceImplMock extends RacingEventServiceImpl{
|
||||
|
||||
|
||||
public RacingEventServiceImplMock() {
|
||||
super();
|
||||
}
|
||||
|
||||
public Map<String, Event> getEventsByName(){
|
||||
return eventsByName;
|
||||
}
|
||||
|
||||
public Map<Event, Set<RaceTracker>> getRaceTrackersByEvent(){
|
||||
return raceTrackersByEvent;
|
||||
}
|
||||
|
||||
public Map<Object, RaceTracker> getRaceTrackersByID(){
|
||||
return raceTrackersByID;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+3
-3
@@ -75,9 +75,9 @@ public class RacingEventServiceImpl implements RacingEventService {
|
||||
|
||||
private final WindTrackerFactory windTrackerFactory;
|
||||
|
||||
private final Map<String, Event> eventsByName;
|
||||
protected final Map<String, Event> eventsByName;
|
||||
|
||||
private final Map<Event, Set<RaceTracker>> raceTrackersByEvent;
|
||||
protected final Map<Event, Set<RaceTracker>> raceTrackersByEvent;
|
||||
|
||||
/**
|
||||
* Remembers the wind tracker and the port on which the UDP receiver with which the wind tracker is
|
||||
@@ -88,7 +88,7 @@ public class RacingEventServiceImpl implements RacingEventService {
|
||||
/**
|
||||
* Remembers the trackers by paramURL/liveURI/storedURI to avoid duplication
|
||||
*/
|
||||
private final Map<Object, RaceTracker> raceTrackersByID;
|
||||
protected final Map<Object, RaceTracker> raceTrackersByID;
|
||||
|
||||
/**
|
||||
* Leaderboards managed by this racing event service
|
||||
|
||||
Reference in New Issue
Block a user