mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-08 13:20:57 +00:00
Merge remote-tracking branch 'origin/master' into dataMining
This commit is contained in:
commit
7ad354f104
14 files changed
+439
-303
No files matched your search
+2
-2
@@ -15,7 +15,7 @@ import com.sap.sailing.domain.common.Color;
|
||||
|
||||
public abstract class AbstractLeaderboardTest {
|
||||
public static CompetitorImpl createCompetitor(String competitorName) {
|
||||
return new CompetitorImpl(123, competitorName, Color.RED, new TeamImpl("STG", Collections.singleton(
|
||||
return new CompetitorImpl(competitorName, competitorName, Color.RED, new TeamImpl("STG", Collections.singleton(
|
||||
new PersonImpl(competitorName, new NationalityImpl("GER"),
|
||||
/* dateOfBirth */ null, "This is famous "+competitorName)),
|
||||
new PersonImpl("Rigo van Maas", new NationalityImpl("NED"),
|
||||
@@ -24,7 +24,7 @@ public abstract class AbstractLeaderboardTest {
|
||||
}
|
||||
|
||||
public static Competitor createCompetitor(String competitorName, CompetitorFactory competitorFactory) {
|
||||
return competitorFactory.getOrCreateCompetitor(123, competitorName, Color.RED, new TeamImpl("STG", Collections.singleton(
|
||||
return competitorFactory.getOrCreateCompetitor(competitorName, competitorName, Color.RED, new TeamImpl("STG", Collections.singleton(
|
||||
new PersonImpl(competitorName, new NationalityImpl("GER"),
|
||||
/* dateOfBirth */ null, "This is famous "+competitorName)),
|
||||
new PersonImpl("Rigo van Maas", new NationalityImpl("NED"),
|
||||
|
||||
+47
@@ -879,6 +879,53 @@ public class LeaderboardScoringAndRankingTest extends AbstractLeaderboardTest {
|
||||
assertEquals(28 /* one win, two second */, leaderboardGroup.getOverallLeaderboard().getTotalPoints(c[0], later), 0.000000001);
|
||||
assertEquals(29 /* two wins, one second */, leaderboardGroup.getOverallLeaderboard().getTotalPoints(c[3], later), 0.000000001);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOverallLeaderboardWithESSHighPointScoringAndTieBreakInLastRegattaOfLeaderboardGroup() throws NoWindException {
|
||||
Competitor[] c = createCompetitors(12).toArray(new Competitor[0]);
|
||||
// 10 9 8 7 6 5 4 3 2 1 1 1
|
||||
Competitor[] regattaRace1 = new Competitor[] { c[0], c[1], c[2], c[3], c[4], c[5], c[6], c[7], c[8], c[9], c[10], c[11] };
|
||||
Competitor[] regattaRace2 = new Competitor[] { c[1], c[10], c[2], c[3], c[4], c[5], c[6], c[7], c[8], c[9], c[11], c[0] };
|
||||
Competitor[] regattaRace3 = new Competitor[] { c[1], c[2], c[3], c[4], c[5], c[6], c[7], c[8], c[9], c[11], c[10], c[0] };
|
||||
TimePoint now = MillisecondsTimePoint.now();
|
||||
TimePoint later = new MillisecondsTimePoint(now.asMillis()+1000);
|
||||
FlexibleLeaderboard leaderboard1 = new FlexibleLeaderboardImpl("Leaderboard 1", new ThresholdBasedResultDiscardingRuleImpl(/* discarding thresholds */ new int[0]),
|
||||
new HighPointFirstGets10LastBreaksTie(), null);
|
||||
leaderboard1.addRace(new MockedTrackedRaceWithStartTimeAndRanks(now, Arrays.asList(regattaRace1)), "R1", /* medalRace */ false,
|
||||
leaderboard1.getFleet(null));
|
||||
leaderboard1.addRace(new MockedTrackedRaceWithStartTimeAndRanks(now, Arrays.asList(regattaRace2)), "R2", /* medalRace */ false,
|
||||
leaderboard1.getFleet(null));
|
||||
leaderboard1.addRace(new MockedTrackedRaceWithStartTimeAndRanks(now, Arrays.asList(regattaRace3)), "R3", /* medalRace */ false,
|
||||
leaderboard1.getFleet(null));
|
||||
// [C2, C3, C4, C5, C6, C7, C1, C11, C8, C9, C10, C12]
|
||||
// [29, 25, 22, 19, 16, 12, 13, 11, 10, 7, 4, 3]
|
||||
List<Competitor> rankedCompetitorsInLeaderboard = leaderboard1.getCompetitorsFromBestToWorst(later);
|
||||
List<Double> scoresForCompetitors = new ArrayList<Double>();
|
||||
for (Competitor competitor : rankedCompetitorsInLeaderboard) {
|
||||
scoresForCompetitors.add(leaderboard1.getTotalPoints(competitor, later));
|
||||
}
|
||||
assertEquals(12, rankedCompetitorsInLeaderboard.size());
|
||||
assertEquals(c[1], rankedCompetitorsInLeaderboard.get(0));
|
||||
assertEquals(29, leaderboard1.getTotalPoints(c[1], later), 0.000000001);
|
||||
assertEquals(7, leaderboard1.getTotalPoints(c[8], later), 0.000000001);
|
||||
assertEquals(4, leaderboard1.getTotalPoints(c[9], later), 0.000000001);
|
||||
assertEquals(3, leaderboard1.getTotalPoints(c[11], later), 0.000000001);
|
||||
|
||||
LeaderboardGroup leaderboardGroup = new LeaderboardGroupImpl("Leaderboard Group ESS Overall", "Leaderboard Group", false, Arrays.asList(leaderboard1));
|
||||
leaderboardGroup.setOverallLeaderboard(new LeaderboardGroupMetaLeaderboard(leaderboardGroup, new HighPointExtremeSailingSeriesOverall(),
|
||||
new ThresholdBasedResultDiscardingRuleImpl(new int[0])));
|
||||
leaderboardGroup.getOverallLeaderboard().setSuppressed(c[c.length-1], true);
|
||||
// ranking must match the regatta ranks - as for 11 competitors the ranking is random
|
||||
// in the faulty implementation we test with many iterations to make sure that
|
||||
// we get the faulty random value
|
||||
for (int i=0;i<=1000;i++) {
|
||||
List<Competitor> rankedCompetitors = leaderboardGroup.getOverallLeaderboard().getCompetitorsFromBestToWorst(later);
|
||||
assertFalse(rankedCompetitors.contains(c[c.length-1]));
|
||||
assertEquals(11, rankedCompetitors.size());
|
||||
assertEquals(c[8], rankedCompetitors.get(9));
|
||||
assertEquals(c[9], rankedCompetitors.get(10));
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testApplicationOfScoreCorrectionsInRacesWithNoTrackedRaceAfterLastTrackedRaceWithoutMarkPassings() throws NoWindException {
|
||||
|
||||
@@ -12,6 +12,7 @@ import com.sap.sailing.domain.common.MaxPointsReason;
|
||||
import com.sap.sailing.domain.common.ScoringSchemeType;
|
||||
import com.sap.sailing.domain.common.TimePoint;
|
||||
import com.sap.sailing.domain.common.impl.Util.Pair;
|
||||
import com.sap.sailing.domain.leaderboard.meta.LeaderboardGroupMetaLeaderboard;
|
||||
|
||||
/**
|
||||
* A leaderboard has a scoring scheme that decides how race ranks map to scores, how penalties are to be scored,
|
||||
@@ -95,4 +96,12 @@ public interface ScoringScheme extends Serializable {
|
||||
* for the total scores.
|
||||
*/
|
||||
boolean isValidInTotalScore(Leaderboard leaderboard, RaceColumn raceColumn, TimePoint at);
|
||||
|
||||
/**
|
||||
* Some scoring schemes are applied to {@link LeaderboardGroupMetaLeaderboard} instances. These
|
||||
* instances of a leaderboard are based on other leaderboards grouped in a {@link LeaderboardGroup}.
|
||||
* It can happen that the {@link ScoringScheme} needs to have look at the total points of the other leaderboards
|
||||
* in that group. The ordering of the list containing the total points matches the order in the group.
|
||||
*/
|
||||
int compareByLatestRegattaInMetaLeaderboard(List<Double> o1TotalPointsForAllOtherLeaderboardsOrdered, List<Double> o2TotalPointsForAllOtherLeaderboardsOrdered);
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.sap.sailing.domain.leaderboard.impl;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
@@ -77,5 +78,11 @@ public class HighPoint extends AbstractScoringSchemeImpl {
|
||||
public boolean isValidInTotalScore(Leaderboard leaderboard, RaceColumn raceColumn, TimePoint at) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareByLatestRegattaInMetaLeaderboard(List<Double> o1TotalPointsForAllOtherLeaderboardsOrdered,
|
||||
List<Double> o2TotalPointsForAllOtherLeaderboardsOrdered) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
+26
@@ -95,6 +95,32 @@ public class HighPointExtremeSailingSeriesOverall extends HighPoint {
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* If a tie still remains, it shall be broken in
|
||||
* favour of the boat that had the better place at the last Regatta sailed.
|
||||
*/
|
||||
@Override
|
||||
public int compareByLatestRegattaInMetaLeaderboard(List<Double> o1TotalPointsForAllOtherLeaderboardsOrdered,
|
||||
List<Double> o2TotalPointsForAllOtherLeaderboardsOrdered) {
|
||||
int result = 0;
|
||||
if (o1TotalPointsForAllOtherLeaderboardsOrdered.size() == o2TotalPointsForAllOtherLeaderboardsOrdered.size()) {
|
||||
for (int i=o1TotalPointsForAllOtherLeaderboardsOrdered.size()-1;i==0;i--) {
|
||||
Double o1PointsForLeaderboard = o1TotalPointsForAllOtherLeaderboardsOrdered.get(i);
|
||||
Double o2PointsForLeaderboard = o2TotalPointsForAllOtherLeaderboardsOrdered.get(i);
|
||||
if (o1PointsForLeaderboard != null && o2PointsForLeaderboard != null) {
|
||||
// we're in a scheme where points never get 0 so we can safely assume
|
||||
// that the last total points that are no 0 are the ones that we want to
|
||||
// look at. We also assume that the ordering matches the one in the group
|
||||
if (o1PointsForLeaderboard > 0 && o2PointsForLeaderboard > 0) {
|
||||
result = -o1PointsForLeaderboard.compareTo(o2PointsForLeaderboard);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ScoringSchemeType getType() {
|
||||
return ScoringSchemeType.HIGH_POINT_ESS_OVERALL;
|
||||
|
||||
+16
@@ -15,6 +15,7 @@ import com.sap.sailing.domain.common.TimePoint;
|
||||
import com.sap.sailing.domain.common.impl.Util.Pair;
|
||||
import com.sap.sailing.domain.leaderboard.Leaderboard;
|
||||
import com.sap.sailing.domain.leaderboard.ScoringScheme;
|
||||
import com.sap.sailing.domain.leaderboard.meta.LeaderboardGroupMetaLeaderboard;
|
||||
|
||||
/**
|
||||
* Compares two competitors that occur in a {@link Leaderboard#getCompetitors()} set in the context of the
|
||||
@@ -161,6 +162,21 @@ public class LeaderboardTotalRankComparator implements Comparator<Competitor> {
|
||||
if (result == 0) {
|
||||
// compare by last race:
|
||||
result = scoringScheme.compareByLastRace(o1Scores, o2Scores, nullScoresAreBetter);
|
||||
if (result == 0 && (getLeaderboard() instanceof LeaderboardGroupMetaLeaderboard)) {
|
||||
// compare by last regatta if this leaderboard is a meta leaderboard
|
||||
LeaderboardGroupMetaLeaderboard overallLeaderboard = (LeaderboardGroupMetaLeaderboard) getLeaderboard();
|
||||
List<Double> o1PointsInLeaderboardsOfTheGroup = new ArrayList<Double>();
|
||||
List<Double> o2PointsInLeaderboardsOfTheGroup = new ArrayList<Double>();
|
||||
try {
|
||||
for (Leaderboard leaderboardInOverall : overallLeaderboard.getLeaderboards()) {
|
||||
o1PointsInLeaderboardsOfTheGroup.add(leaderboardInOverall.getTotalPoints(o1, timePoint));
|
||||
o2PointsInLeaderboardsOfTheGroup.add(leaderboardInOverall.getTotalPoints(o2, timePoint));
|
||||
}
|
||||
result = scoringScheme.compareByLatestRegattaInMetaLeaderboard(o1PointsInLeaderboardsOfTheGroup, o2PointsInLeaderboardsOfTheGroup);
|
||||
} catch (NoWindException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.sap.sailing.domain.leaderboard.impl;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
@@ -64,4 +65,10 @@ public class LowPoint extends AbstractScoringSchemeImpl {
|
||||
public boolean isValidInTotalScore(Leaderboard leaderboard, RaceColumn raceColumn, TimePoint at) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareByLatestRegattaInMetaLeaderboard(List<Double> o1TotalPointsForAllOtherLeaderboardsOrdered,
|
||||
List<Double> o2TotalPointsForAllOtherLeaderboardsOrdered) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
+9
-22
@@ -4,7 +4,6 @@ import java.io.FilterInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
import java.io.Serializable;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
@@ -158,7 +157,6 @@ import com.sap.sailing.domain.leaderboard.MetaLeaderboard;
|
||||
import com.sap.sailing.domain.leaderboard.RegattaLeaderboard;
|
||||
import com.sap.sailing.domain.leaderboard.ThresholdBasedResultDiscardingRule;
|
||||
import com.sap.sailing.domain.leaderboard.caching.LiveLeaderboardUpdater;
|
||||
import com.sap.sailing.domain.masterdataimport.TopLevelMasterData;
|
||||
import com.sap.sailing.domain.persistence.DomainObjectFactory;
|
||||
import com.sap.sailing.domain.persistence.MongoObjectFactory;
|
||||
import com.sap.sailing.domain.persistence.MongoRaceLogStoreFactory;
|
||||
@@ -3477,7 +3475,6 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
|
||||
|
||||
URL serverAddress = null;
|
||||
InputStream inputStream = null;
|
||||
ObjectInputStream objectInputStream = null;
|
||||
try {
|
||||
String path = "/sailingserver/spi/v1/masterdata/leaderboardgroups";
|
||||
serverAddress = createUrl(hostname, port, path, query);
|
||||
@@ -3502,17 +3499,16 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
|
||||
inputStream = new TimeoutExtendingInputStream(connection.getInputStream(), connection);
|
||||
}
|
||||
|
||||
objectInputStream = getService().getBaseDomainFactory()
|
||||
.createObjectInputStreamResolvingAgainstThisFactory(inputStream);
|
||||
getService().createOrUpdateDataImportProgressWithReplication(importOperationId, 0.03,
|
||||
"Reading Data", 0.5);
|
||||
TopLevelMasterData topLevelMasterData = (TopLevelMasterData) objectInputStream.readObject();
|
||||
|
||||
getService().createOrUpdateDataImportProgressWithReplication(importOperationId, 0.3,
|
||||
"Data-Transfer Complete, Initializing Import Operation", 0.5);
|
||||
importFromHttpResponse(topLevelMasterData, importOperationId, override);
|
||||
final MasterDataImporter importer = new MasterDataImporter(baseDomainFactory, getService());
|
||||
importer.importFromStream(inputStream, importOperationId, override);
|
||||
} catch (Exception e) {
|
||||
getService().setDataImportFailedWithReplication(importOperationId, e.getMessage());
|
||||
getService()
|
||||
.setDataImportFailedWithReplication(
|
||||
importOperationId,
|
||||
e.getMessage()
|
||||
+ "\n\nHave you checked if the"
|
||||
+ " versions (commit-wise) of the importing and exporting servers are compatible with each other? "
|
||||
+ "If the error still occurs, when both servers are running the same version, please report the problem.");
|
||||
throw new RuntimeException(e);
|
||||
} finally {
|
||||
// close the connection, set all objects to null
|
||||
@@ -3525,9 +3521,6 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
|
||||
if (inputStream != null) {
|
||||
inputStream.close();
|
||||
}
|
||||
if (objectInputStream != null) {
|
||||
objectInputStream.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
}
|
||||
}
|
||||
@@ -3547,12 +3540,6 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
|
||||
}
|
||||
return url;
|
||||
}
|
||||
|
||||
protected void importFromHttpResponse(final TopLevelMasterData topLevelMasterData, final UUID importOperationId,
|
||||
final boolean override) {
|
||||
final MasterDataImporter importer = new MasterDataImporter(baseDomainFactory, getService());
|
||||
importer.importMasterData(topLevelMasterData, importOperationId, override);
|
||||
}
|
||||
|
||||
public DataImportProgress getImportOperationProgress(UUID id) {
|
||||
return getService().getDataImportLock().getProgress(id);
|
||||
|
||||
@@ -41,4 +41,6 @@ Require-Bundle: com.sap.sailing.domain,
|
||||
com.sap.sailing.domain.igtimiadapter;bundle-version="1.0.0"
|
||||
Bundle-ClassPath: .
|
||||
Web-ContextPath: /sailingserver
|
||||
Export-Package: com.sap.sailing.server.gateway
|
||||
Export-Package: com.sap.sailing.server.gateway,
|
||||
com.sap.sailing.server.gateway.jaxrs,
|
||||
com.sap.sailing.server.gateway.jaxrs.spi
|
||||
+18
@@ -4,7 +4,9 @@ import java.io.FilterOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectOutputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.Serializable;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -21,6 +23,8 @@ import javax.ws.rs.core.Response;
|
||||
import javax.ws.rs.core.Response.ResponseBuilder;
|
||||
import javax.ws.rs.core.StreamingOutput;
|
||||
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.leaderboard.Leaderboard;
|
||||
import com.sap.sailing.domain.leaderboard.LeaderboardGroup;
|
||||
import com.sap.sailing.domain.masterdataimport.TopLevelMasterData;
|
||||
import com.sap.sailing.server.gateway.jaxrs.AbstractSailingServerResource;
|
||||
@@ -56,6 +60,16 @@ public class MasterDataResource extends AbstractSailingServerResource {
|
||||
groupsToExport.addAll(allLeaderboardGroups.values());
|
||||
}
|
||||
|
||||
final List<Serializable> competitorIds = new ArrayList<Serializable>();
|
||||
|
||||
for (LeaderboardGroup lg : groupsToExport) {
|
||||
for (Leaderboard leaderboard : lg.getLeaderboards()) {
|
||||
for (Competitor competitor : leaderboard.getAllCompetitors()) {
|
||||
competitorIds.add(competitor.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
final TopLevelMasterData masterData = new TopLevelMasterData(groupsToExport,
|
||||
getService().getAllEvents(), getService().getPersistentRegattasForRaceIDs(), getService()
|
||||
.getAllMediaTracks());
|
||||
@@ -74,6 +88,7 @@ public class MasterDataResource extends AbstractSailingServerResource {
|
||||
|
||||
masterData.setMasterDataExportFlagOnRaceColumns(true);
|
||||
// Actual start of streaming
|
||||
objectOutputStream.writeObject(competitorIds);
|
||||
objectOutputStream.writeObject(masterData);
|
||||
} finally {
|
||||
objectOutputStream.close();
|
||||
@@ -93,11 +108,14 @@ public class MasterDataResource extends AbstractSailingServerResource {
|
||||
try {
|
||||
OutputStream outputStreamWithByteCounter = new ByteCountOutputStreamDecorator(output);
|
||||
objectOutputStream = new ObjectOutputStream(outputStreamWithByteCounter);
|
||||
masterData.setMasterDataExportFlagOnRaceColumns(true);
|
||||
|
||||
// Actual start of streaming
|
||||
objectOutputStream.writeObject(competitorIds);
|
||||
objectOutputStream.writeObject(masterData);
|
||||
} finally {
|
||||
objectOutputStream.close();
|
||||
masterData.setMasterDataExportFlagOnRaceColumns(false);
|
||||
long timeToExport = System.currentTimeMillis() - startTime;
|
||||
logger.info(String.format("Took %s ms to finish masterdataexport", timeToExport));
|
||||
}
|
||||
|
||||
@@ -19,5 +19,8 @@ Require-Bundle: com.sap.sailing.domain,
|
||||
com.sap.sailing.domain.test,
|
||||
org.hamcrest;bundle-version="1.1.0",
|
||||
org.mockito.mockito-core;bundle-version="1.9.5"
|
||||
Import-Package: org.json.simple
|
||||
Import-Package: com.sap.sailing.server.gateway.jaxrs,
|
||||
com.sap.sailing.server.gateway.jaxrs.spi,
|
||||
org.json.simple,
|
||||
javax.ws.rs.core;version="1.1.1"
|
||||
Export-Package: com.sap.sailing.server.impl
|
||||
+251
-275
@@ -2,13 +2,13 @@ package com.sap.sailing.server.test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.mockito.Mockito.doReturn;
|
||||
import static org.mockito.Mockito.spy;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
import java.io.Serializable;
|
||||
import java.net.MalformedURLException;
|
||||
import java.util.ArrayList;
|
||||
@@ -22,6 +22,9 @@ import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import javax.ws.rs.core.Response;
|
||||
import javax.ws.rs.core.StreamingOutput;
|
||||
|
||||
import junit.framework.Assert;
|
||||
|
||||
import org.junit.After;
|
||||
@@ -76,7 +79,6 @@ import com.sap.sailing.domain.leaderboard.ThresholdBasedResultDiscardingRule;
|
||||
import com.sap.sailing.domain.leaderboard.impl.FlexibleLeaderboardImpl;
|
||||
import com.sap.sailing.domain.leaderboard.impl.LowPoint;
|
||||
import com.sap.sailing.domain.leaderboard.meta.LeaderboardGroupMetaLeaderboard;
|
||||
import com.sap.sailing.domain.masterdataimport.TopLevelMasterData;
|
||||
import com.sap.sailing.domain.persistence.PersistenceFactory;
|
||||
import com.sap.sailing.domain.persistence.media.MediaDBFactory;
|
||||
import com.sap.sailing.domain.racelog.CompetitorResults;
|
||||
@@ -95,6 +97,8 @@ import com.sap.sailing.domain.tracking.impl.EmptyWindStore;
|
||||
import com.sap.sailing.domain.tracking.impl.WindImpl;
|
||||
import com.sap.sailing.mongodb.MongoDBService;
|
||||
import com.sap.sailing.server.RacingEventService;
|
||||
import com.sap.sailing.server.gateway.jaxrs.AbstractSailingServerResource;
|
||||
import com.sap.sailing.server.gateway.jaxrs.spi.MasterDataResource;
|
||||
import com.sap.sailing.server.impl.RacingEventServiceImpl;
|
||||
import com.sap.sailing.server.masterdata.DummyTrackedRace;
|
||||
import com.sap.sailing.server.masterdata.MasterDataImporter;
|
||||
@@ -125,6 +129,13 @@ public class MasterDataImportTest {
|
||||
|
||||
}
|
||||
|
||||
private <T extends AbstractSailingServerResource> T spyResource(T resource, RacingEventService service) {
|
||||
T spyResource = spy(resource);
|
||||
|
||||
doReturn(service).when(spyResource).getService();
|
||||
return spyResource;
|
||||
}
|
||||
|
||||
private void deleteCreatedDataFromDatabase() throws MalformedURLException, IOException, InterruptedException {
|
||||
storedLogUUIDs.clear();
|
||||
RacingEventService service = new RacingEventServiceImpl();
|
||||
@@ -276,45 +287,40 @@ public class MasterDataImportTest {
|
||||
leaderboard.setDisplayName(competitorToSuppress, nickName);
|
||||
|
||||
// Serialize
|
||||
HashSet<LeaderboardGroup> groupsToExport = new HashSet<LeaderboardGroup>();
|
||||
groupsToExport.add(group);
|
||||
TopLevelMasterData masterdata = new TopLevelMasterData(groupsToExport, sourceService.getAllEvents(),
|
||||
sourceService.getPersistentRegattasForRaceIDs(), sourceService.getAllMediaTracks());
|
||||
Assert.assertNotNull(masterdata);
|
||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||
ObjectOutputStream oos = new ObjectOutputStream(outputStream);
|
||||
List<String> groupNamesToExport = new ArrayList<String>();
|
||||
groupNamesToExport.add(group.getName());
|
||||
|
||||
RacingEventService destService;
|
||||
ObjectInputStream ois = null;
|
||||
TopLevelMasterData deserializedMasterData;
|
||||
DomainFactory domainFactory;
|
||||
MasterDataResource resource = new MasterDataResource();
|
||||
MasterDataResource spyResource = spyResource(resource, sourceService);
|
||||
Response response = spyResource.getMasterDataByLeaderboardGroups(groupNamesToExport, false);
|
||||
StreamingOutput streamingOutput = (StreamingOutput) response.getEntity();
|
||||
ByteArrayOutputStream os = new ByteArrayOutputStream();
|
||||
UUID randomUUID = UUID.randomUUID();
|
||||
InputStream inputStream = null;
|
||||
try {
|
||||
masterdata.setMasterDataExportFlagOnRaceColumns(true);
|
||||
oos.writeObject(masterdata);
|
||||
|
||||
|
||||
outputStream.flush();
|
||||
streamingOutput.write(os);
|
||||
os.flush();
|
||||
// Delete all data above from the database, to allow recreating all of it on target server
|
||||
deleteCreatedDataFromDatabase();
|
||||
// Import in new service
|
||||
destService = new RacingEventServiceImplMock(new DataImportProgressImpl(randomUUID));
|
||||
domainFactory = destService.getBaseDomainFactory();
|
||||
InputStream inputStream = new ByteArrayInputStream(outputStream.toByteArray());
|
||||
inputStream = new ByteArrayInputStream(os.toByteArray());
|
||||
|
||||
ois = domainFactory.createObjectInputStreamResolvingAgainstThisFactory(inputStream);
|
||||
deserializedMasterData = (TopLevelMasterData) ois.readObject();
|
||||
MasterDataImporter importer = new MasterDataImporter(domainFactory, destService);
|
||||
importer.importFromStream(inputStream, randomUUID, false);
|
||||
} finally {
|
||||
masterdata.setMasterDataExportFlagOnRaceColumns(false);
|
||||
oos.close();
|
||||
ois.close();
|
||||
os.close();
|
||||
inputStream.close();
|
||||
}
|
||||
|
||||
|
||||
MasterDataImporter importer = new MasterDataImporter(domainFactory, destService);
|
||||
|
||||
|
||||
MasterDataImportObjectCreationCount creationCount = importer.importMasterData(deserializedMasterData,
|
||||
randomUUID, false);
|
||||
MasterDataImportObjectCreationCount creationCount = destService.getDataImportLock().getProgress(randomUUID)
|
||||
.getResult();
|
||||
|
||||
Assert.assertNotNull(creationCount);
|
||||
Event eventOnTarget = destService.getEvent(eventUUID);
|
||||
@@ -469,42 +475,37 @@ public class MasterDataImportTest {
|
||||
leaderboard.getScoreCorrection().setMaxPointsReason(competitor, raceColumn, maxPointsReason);
|
||||
|
||||
// Serialize
|
||||
HashSet<LeaderboardGroup> groupsToExport = new HashSet<LeaderboardGroup>();
|
||||
groupsToExport.add(group);
|
||||
TopLevelMasterData masterdata = new TopLevelMasterData(groupsToExport, sourceService.getAllEvents(),
|
||||
sourceService.getPersistentRegattasForRaceIDs(), sourceService.getAllMediaTracks());
|
||||
Assert.assertNotNull(masterdata);
|
||||
List<String> groupNamesToExport = new ArrayList<String>();
|
||||
groupNamesToExport.add(group.getName());
|
||||
|
||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||
ObjectOutputStream oos = new ObjectOutputStream(outputStream);
|
||||
RacingEventService destService;
|
||||
ObjectInputStream ois = null;
|
||||
TopLevelMasterData deserializedMasterData;
|
||||
DomainFactory domainFactory;
|
||||
MasterDataResource resource = new MasterDataResource();
|
||||
MasterDataResource spyResource = spyResource(resource, sourceService);
|
||||
Response response = spyResource.getMasterDataByLeaderboardGroups(groupNamesToExport, false);
|
||||
StreamingOutput streamingOutput = (StreamingOutput) response.getEntity();
|
||||
ByteArrayOutputStream os = new ByteArrayOutputStream();
|
||||
UUID randomUUID = UUID.randomUUID();
|
||||
ByteArrayInputStream inputStream = null;
|
||||
try {
|
||||
masterdata.setMasterDataExportFlagOnRaceColumns(true);
|
||||
oos.writeObject(masterdata);
|
||||
|
||||
outputStream.flush();
|
||||
streamingOutput.write(os);
|
||||
os.flush();
|
||||
// Delete all data above from the database, to allow recreating all of it on target server
|
||||
deleteCreatedDataFromDatabase();
|
||||
// Import in new service
|
||||
destService = new RacingEventServiceImplMock(new DataImportProgressImpl(randomUUID));
|
||||
domainFactory = destService.getBaseDomainFactory();
|
||||
InputStream inputStream = new ByteArrayInputStream(outputStream.toByteArray());
|
||||
inputStream = new ByteArrayInputStream(os.toByteArray());
|
||||
|
||||
ois = domainFactory.createObjectInputStreamResolvingAgainstThisFactory(inputStream);
|
||||
deserializedMasterData = (TopLevelMasterData) ois.readObject();
|
||||
MasterDataImporter importer = new MasterDataImporter(domainFactory, destService);
|
||||
importer.importFromStream(inputStream, randomUUID, false);
|
||||
} finally {
|
||||
masterdata.setMasterDataExportFlagOnRaceColumns(false);
|
||||
oos.close();
|
||||
ois.close();
|
||||
os.close();
|
||||
inputStream.close();
|
||||
}
|
||||
MasterDataImporter importer = new MasterDataImporter(domainFactory, destService);
|
||||
|
||||
MasterDataImportObjectCreationCount creationCount = importer.importMasterData(deserializedMasterData,
|
||||
randomUUID, false);
|
||||
MasterDataImportObjectCreationCount creationCount = destService.getDataImportLock().getProgress(randomUUID)
|
||||
.getResult();
|
||||
|
||||
Assert.assertNotNull(creationCount);
|
||||
Event eventOnTarget = destService.getEvent(eventUUID);
|
||||
@@ -608,42 +609,37 @@ public class MasterDataImportTest {
|
||||
raceColumn.setTrackedRace(testFleet1, trackedRace);
|
||||
|
||||
// Serialize
|
||||
HashSet<LeaderboardGroup> groupsToExport = new HashSet<LeaderboardGroup>();
|
||||
groupsToExport.add(group);
|
||||
TopLevelMasterData masterdata = new TopLevelMasterData(groupsToExport, sourceService.getAllEvents(),
|
||||
sourceService.getPersistentRegattasForRaceIDs(), sourceService.getAllMediaTracks());
|
||||
Assert.assertNotNull(masterdata);
|
||||
List<String> groupNamesToExport = new ArrayList<String>();
|
||||
groupNamesToExport.add(group.getName());
|
||||
|
||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||
ObjectOutputStream oos = new ObjectOutputStream(outputStream);
|
||||
RacingEventService destService;
|
||||
ObjectInputStream ois = null;
|
||||
TopLevelMasterData deserializedMasterData;
|
||||
DomainFactory domainFactory;
|
||||
MasterDataResource resource = new MasterDataResource();
|
||||
MasterDataResource spyResource = spyResource(resource, sourceService);
|
||||
Response response = spyResource.getMasterDataByLeaderboardGroups(groupNamesToExport, false);
|
||||
StreamingOutput streamingOutput = (StreamingOutput) response.getEntity();
|
||||
ByteArrayOutputStream os = new ByteArrayOutputStream();
|
||||
UUID randomUUID = UUID.randomUUID();
|
||||
ByteArrayInputStream inputStream = null;
|
||||
try {
|
||||
masterdata.setMasterDataExportFlagOnRaceColumns(true);
|
||||
oos.writeObject(masterdata);
|
||||
|
||||
outputStream.flush();
|
||||
streamingOutput.write(os);
|
||||
os.flush();
|
||||
// Delete all data above from the database, to allow recreating all of it on target server
|
||||
deleteCreatedDataFromDatabase();
|
||||
// Import in new service
|
||||
destService = new RacingEventServiceImplMock(new DataImportProgressImpl(randomUUID));
|
||||
domainFactory = destService.getBaseDomainFactory();
|
||||
InputStream inputStream = new ByteArrayInputStream(outputStream.toByteArray());
|
||||
inputStream = new ByteArrayInputStream(os.toByteArray());
|
||||
|
||||
ois = domainFactory.createObjectInputStreamResolvingAgainstThisFactory(inputStream);
|
||||
deserializedMasterData = (TopLevelMasterData) ois.readObject();
|
||||
MasterDataImporter importer = new MasterDataImporter(domainFactory, destService);
|
||||
importer.importFromStream(inputStream, randomUUID, false);
|
||||
} finally {
|
||||
masterdata.setMasterDataExportFlagOnRaceColumns(false);
|
||||
oos.close();
|
||||
ois.close();
|
||||
os.close();
|
||||
inputStream.close();
|
||||
}
|
||||
MasterDataImporter importer = new MasterDataImporter(domainFactory, destService);
|
||||
|
||||
MasterDataImportObjectCreationCount creationCount = importer.importMasterData(deserializedMasterData,
|
||||
randomUUID, false);
|
||||
MasterDataImportObjectCreationCount creationCount = destService.getDataImportLock().getProgress(randomUUID)
|
||||
.getResult();
|
||||
|
||||
Assert.assertNotNull(creationCount);
|
||||
Event eventOnTarget = destService.getEvent(eventUUID);
|
||||
@@ -763,42 +759,37 @@ public class MasterDataImportTest {
|
||||
storedLogUUIDs.add(finishPositioningConfirmedEvent.getId());
|
||||
|
||||
// Serialize
|
||||
HashSet<LeaderboardGroup> groupsToExport = new HashSet<LeaderboardGroup>();
|
||||
groupsToExport.add(group);
|
||||
TopLevelMasterData masterdata = new TopLevelMasterData(groupsToExport, sourceService.getAllEvents(),
|
||||
sourceService.getPersistentRegattasForRaceIDs(), sourceService.getAllMediaTracks());
|
||||
Assert.assertNotNull(masterdata);
|
||||
List<String> groupNamesToExport = new ArrayList<String>();
|
||||
groupNamesToExport.add(group.getName());
|
||||
|
||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||
ObjectOutputStream oos = new ObjectOutputStream(outputStream);
|
||||
RacingEventService destService;
|
||||
ObjectInputStream ois = null;
|
||||
TopLevelMasterData deserializedMasterData;
|
||||
DomainFactory domainFactory;
|
||||
MasterDataResource resource = new MasterDataResource();
|
||||
MasterDataResource spyResource = spyResource(resource, sourceService);
|
||||
Response response = spyResource.getMasterDataByLeaderboardGroups(groupNamesToExport, false);
|
||||
StreamingOutput streamingOutput = (StreamingOutput) response.getEntity();
|
||||
ByteArrayOutputStream os = new ByteArrayOutputStream();
|
||||
UUID randomUUID = UUID.randomUUID();
|
||||
ByteArrayInputStream inputStream = null;
|
||||
try {
|
||||
masterdata.setMasterDataExportFlagOnRaceColumns(true);
|
||||
oos.writeObject(masterdata);
|
||||
|
||||
outputStream.flush();
|
||||
streamingOutput.write(os);
|
||||
os.flush();
|
||||
// Delete all data above from the database, to allow recreating all of it on target server
|
||||
deleteCreatedDataFromDatabase();
|
||||
// Import in new service
|
||||
destService = new RacingEventServiceImplMock(new DataImportProgressImpl(randomUUID));
|
||||
domainFactory = destService.getBaseDomainFactory();
|
||||
InputStream inputStream = new ByteArrayInputStream(outputStream.toByteArray());
|
||||
inputStream = new ByteArrayInputStream(os.toByteArray());
|
||||
|
||||
ois = domainFactory.createObjectInputStreamResolvingAgainstThisFactory(inputStream);
|
||||
deserializedMasterData = (TopLevelMasterData) ois.readObject();
|
||||
MasterDataImporter importer = new MasterDataImporter(domainFactory, destService);
|
||||
importer.importFromStream(inputStream, randomUUID, false);
|
||||
} finally {
|
||||
masterdata.setMasterDataExportFlagOnRaceColumns(false);
|
||||
oos.close();
|
||||
ois.close();
|
||||
os.close();
|
||||
inputStream.close();
|
||||
}
|
||||
MasterDataImporter importer = new MasterDataImporter(domainFactory, destService);
|
||||
|
||||
MasterDataImportObjectCreationCount creationCount = importer.importMasterData(deserializedMasterData,
|
||||
randomUUID, false);
|
||||
MasterDataImportObjectCreationCount creationCount = destService.getDataImportLock().getProgress(randomUUID)
|
||||
.getResult();
|
||||
|
||||
Assert.assertNotNull(creationCount);
|
||||
Event eventOnTarget = destService.getEvent(eventUUID);
|
||||
@@ -929,31 +920,26 @@ public class MasterDataImportTest {
|
||||
leaderboard.setDisplayName(competitorToSuppress, nickName);
|
||||
|
||||
// Serialize
|
||||
HashSet<LeaderboardGroup> groupsToExport = new HashSet<LeaderboardGroup>();
|
||||
groupsToExport.add(group);
|
||||
TopLevelMasterData masterdata = new TopLevelMasterData(groupsToExport, sourceService.getAllEvents(),
|
||||
sourceService.getPersistentRegattasForRaceIDs(), sourceService.getAllMediaTracks());
|
||||
Assert.assertNotNull(masterdata);
|
||||
List<String> groupNamesToExport = new ArrayList<String>();
|
||||
groupNamesToExport.add(group.getName());
|
||||
|
||||
|
||||
|
||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||
ObjectOutputStream oos = new ObjectOutputStream(outputStream);
|
||||
ObjectInputStream ois = null;
|
||||
TopLevelMasterData deserializedMasterData;
|
||||
RacingEventService destService;
|
||||
DomainFactory domainFactory;
|
||||
RacingEventServiceImplMock destService;
|
||||
MasterDataResource resource = new MasterDataResource();
|
||||
MasterDataResource spyResource = spyResource(resource, sourceService);
|
||||
Response response = spyResource.getMasterDataByLeaderboardGroups(groupNamesToExport, false);
|
||||
StreamingOutput streamingOutput = (StreamingOutput) response.getEntity();
|
||||
ByteArrayOutputStream os = new ByteArrayOutputStream();
|
||||
UUID randomUUID = UUID.randomUUID();
|
||||
String venueNameNotToOverride;
|
||||
CourseAreaImpl courseAreaNotToOverride;
|
||||
String raceColumnNameNotToOveride;
|
||||
RegattaLeaderboard leaderboardNotToOverride;
|
||||
LeaderboardGroup groupNotToOverride;
|
||||
String raceColumnNameNotToOveride;
|
||||
UUID randomUUID = UUID.randomUUID();
|
||||
ByteArrayInputStream inputStream = null;
|
||||
try {
|
||||
masterdata.setMasterDataExportFlagOnRaceColumns(true);
|
||||
oos.writeObject(masterdata);
|
||||
|
||||
outputStream.flush();
|
||||
streamingOutput.write(os);
|
||||
os.flush();
|
||||
// Delete all data above from the database, to allow recreating all of it on target server
|
||||
deleteCreatedDataFromDatabase();
|
||||
// Import in new service
|
||||
@@ -990,19 +976,17 @@ public class MasterDataImportTest {
|
||||
leaderboardNamesNotToOverride.add(leaderboardNotToOverride.getName());
|
||||
groupNotToOverride = destService.addLeaderboardGroup(TEST_GROUP_NAME,
|
||||
"testGroupDescNotToOverride", false, leaderboardNamesNotToOverride, null, null);
|
||||
InputStream inputStream = new ByteArrayInputStream(outputStream.toByteArray());
|
||||
inputStream = new ByteArrayInputStream(os.toByteArray());
|
||||
|
||||
ois = domainFactory.createObjectInputStreamResolvingAgainstThisFactory(inputStream);
|
||||
deserializedMasterData = (TopLevelMasterData) ois.readObject();
|
||||
MasterDataImporter importer = new MasterDataImporter(domainFactory, destService);
|
||||
importer.importFromStream(inputStream, randomUUID, false);
|
||||
} finally {
|
||||
masterdata.setMasterDataExportFlagOnRaceColumns(false);
|
||||
oos.close();
|
||||
ois.close();
|
||||
os.close();
|
||||
inputStream.close();
|
||||
}
|
||||
MasterDataImporter importer = new MasterDataImporter(domainFactory, destService);
|
||||
|
||||
MasterDataImportObjectCreationCount creationCount = importer.importMasterData(deserializedMasterData,
|
||||
randomUUID, false);
|
||||
MasterDataImportObjectCreationCount creationCount = destService.getDataImportLock().getProgress(randomUUID)
|
||||
.getResult();
|
||||
|
||||
// ---Asserts---
|
||||
// Test correct number of creations
|
||||
@@ -1132,25 +1116,22 @@ public class MasterDataImportTest {
|
||||
leaderboard.setDisplayName(competitorToSuppress, nickName);
|
||||
|
||||
// Serialize
|
||||
HashSet<LeaderboardGroup> groupsToExport = new HashSet<LeaderboardGroup>();
|
||||
groupsToExport.add(group);
|
||||
TopLevelMasterData masterdata = new TopLevelMasterData(groupsToExport, sourceService.getAllEvents(),
|
||||
sourceService.getPersistentRegattasForRaceIDs(), sourceService.getAllMediaTracks());
|
||||
Assert.assertNotNull(masterdata);
|
||||
List<String> groupNamesToExport = new ArrayList<String>();
|
||||
groupNamesToExport.add(group.getName());
|
||||
|
||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||
ObjectOutputStream oos = new ObjectOutputStream(outputStream);
|
||||
RacingEventService destService;
|
||||
ObjectInputStream ois = null;
|
||||
TopLevelMasterData deserializedMasterData;
|
||||
DomainFactory domainFactory;
|
||||
RegattaAndRaceIdentifier identifierOfRegattaTrackedRace;
|
||||
MasterDataResource resource = new MasterDataResource();
|
||||
MasterDataResource spyResource = spyResource(resource, sourceService);
|
||||
Response response = spyResource.getMasterDataByLeaderboardGroups(groupNamesToExport, false);
|
||||
StreamingOutput streamingOutput = (StreamingOutput) response.getEntity();
|
||||
ByteArrayOutputStream os = new ByteArrayOutputStream();
|
||||
UUID randomUUID = UUID.randomUUID();
|
||||
RegattaAndRaceIdentifier identifierOfRegattaTrackedRace;
|
||||
ByteArrayInputStream inputStream = null;
|
||||
try {
|
||||
masterdata.setMasterDataExportFlagOnRaceColumns(true);
|
||||
oos.writeObject(masterdata);
|
||||
|
||||
outputStream.flush();
|
||||
streamingOutput.write(os);
|
||||
os.flush();
|
||||
// Delete all data above from the database, to allow recreating all of it on target server
|
||||
deleteCreatedDataFromDatabase();
|
||||
// Import in new service
|
||||
@@ -1180,9 +1161,24 @@ public class MasterDataImportTest {
|
||||
seriesToOverride.get(0).addRaceColumn(name, destService);
|
||||
}
|
||||
|
||||
// Create competitor with same ID and other details
|
||||
Set<Competitor> competitorsToOverride = new HashSet<Competitor>();
|
||||
Set<DynamicPerson> sailorsToOverride = new HashSet<DynamicPerson>();
|
||||
sailorsToOverride.add(new PersonImpl("Froderik Poterson", new NationalityImpl("GER"), new Date(
|
||||
645487200000L), "Oberhoschy"));
|
||||
Person coachToOverride = new PersonImpl("Lennart Hensler", new NationalityImpl("GER"), new Date(
|
||||
645487200000L), "Der Lennart halt");
|
||||
DynamicTeam teamToOverride = new TeamImpl("Pros", sailorsToOverride, coachToOverride);
|
||||
BoatClass boatClassToOverride = new BoatClassImpl("H16", true);
|
||||
DynamicBoat boatToOverride = new BoatImpl("Wingy", boatClassToOverride, "GER70133");
|
||||
String competitorOldName = "oldName";
|
||||
Competitor competitorToOverride = domainFactory.getOrCreateCompetitor(competitorUUID, competitorOldName,
|
||||
Color.BLUE, teamToOverride, boatToOverride);
|
||||
competitorsToOverride.add(competitorToOverride);
|
||||
|
||||
Leaderboard leaderboardToOverride = destService.addRegattaLeaderboard(
|
||||
regattaToOverride.getRegattaIdentifier(), "testDisplayNameNotToOverride", discardRule);
|
||||
TrackedRace trackedRace2 = new DummyTrackedRace(new HashSet<Competitor>(), regattaToOverride, null);
|
||||
TrackedRace trackedRace2 = new DummyTrackedRace(competitorsToOverride, regattaToOverride, null);
|
||||
RaceColumn columnToOverride = leaderboardToOverride.getRaceColumns().iterator().next();
|
||||
columnToOverride.setTrackedRace(testFleet1ToOverride, trackedRace2);
|
||||
identifierOfRegattaTrackedRace = regattaToOverride
|
||||
@@ -1192,18 +1188,17 @@ public class MasterDataImportTest {
|
||||
null, null);
|
||||
destService.getLeaderboardGroupByName(TEST_GROUP_NAME).addLeaderboard(leaderboardToOverride);
|
||||
destService.addLeaderboard(leaderboardToOverride);
|
||||
InputStream inputStream = new ByteArrayInputStream(outputStream.toByteArray());
|
||||
inputStream = new ByteArrayInputStream(os.toByteArray());
|
||||
|
||||
ois = domainFactory.createObjectInputStreamResolvingAgainstThisFactory(inputStream);
|
||||
deserializedMasterData = (TopLevelMasterData) ois.readObject();
|
||||
MasterDataImporter importer = new MasterDataImporter(domainFactory, destService);
|
||||
importer.importFromStream(inputStream, randomUUID, true);
|
||||
} finally {
|
||||
masterdata.setMasterDataExportFlagOnRaceColumns(false);
|
||||
oos.close();
|
||||
ois.close();
|
||||
os.close();
|
||||
inputStream.close();
|
||||
}
|
||||
MasterDataImporter importer = new MasterDataImporter(domainFactory, destService);
|
||||
MasterDataImportObjectCreationCount creationCount = importer.importMasterData(deserializedMasterData,
|
||||
randomUUID, true);
|
||||
|
||||
MasterDataImportObjectCreationCount creationCount = destService.getDataImportLock().getProgress(randomUUID)
|
||||
.getResult();
|
||||
|
||||
// ---Asserts---
|
||||
// Test correct number of creations
|
||||
@@ -1241,6 +1236,11 @@ public class MasterDataImportTest {
|
||||
// Check that tracked race of regatta leaderboard has been removed
|
||||
Assert.assertNull(destService.getTrackedRace(identifierOfRegattaTrackedRace));
|
||||
|
||||
// Assert that competitor details were overridden
|
||||
Competitor competitorOnTarget = destService.getBaseDomainFactory().getExistingCompetitorById(competitorUUID);
|
||||
Assert.assertEquals(competitor.getName(), competitorOnTarget.getName());
|
||||
Assert.assertEquals(competitor.getColor(), competitorOnTarget.getColor());
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -1262,41 +1262,36 @@ public class MasterDataImportTest {
|
||||
leaderboardNames, null, null);
|
||||
|
||||
// Serialize
|
||||
HashSet<LeaderboardGroup> groupsToExport = new HashSet<LeaderboardGroup>();
|
||||
groupsToExport.add(group);
|
||||
TopLevelMasterData masterdata = new TopLevelMasterData(groupsToExport, sourceService.getAllEvents(),
|
||||
sourceService.getPersistentRegattasForRaceIDs(), sourceService.getAllMediaTracks());
|
||||
Assert.assertNotNull(masterdata);
|
||||
List<String> groupNamesToExport = new ArrayList<String>();
|
||||
groupNamesToExport.add(group.getName());
|
||||
|
||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||
ObjectOutputStream oos = new ObjectOutputStream(outputStream);
|
||||
RacingEventService destService;
|
||||
ObjectInputStream ois = null;
|
||||
TopLevelMasterData deserializedMasterData;
|
||||
DomainFactory domainFactory;
|
||||
MasterDataResource resource = new MasterDataResource();
|
||||
MasterDataResource spyResource = spyResource(resource, sourceService);
|
||||
Response response = spyResource.getMasterDataByLeaderboardGroups(groupNamesToExport, false);
|
||||
StreamingOutput streamingOutput = (StreamingOutput) response.getEntity();
|
||||
ByteArrayOutputStream os = new ByteArrayOutputStream();
|
||||
UUID randomUUID = UUID.randomUUID();
|
||||
ByteArrayInputStream inputStream = null;
|
||||
try {
|
||||
masterdata.setMasterDataExportFlagOnRaceColumns(true);
|
||||
oos.writeObject(masterdata);
|
||||
|
||||
outputStream.flush();
|
||||
streamingOutput.write(os);
|
||||
os.flush();
|
||||
// Delete all data above from the database, to allow recreating all of it on target server
|
||||
deleteCreatedDataFromDatabase();
|
||||
// Import in new service
|
||||
destService = new RacingEventServiceImplMock(new DataImportProgressImpl(randomUUID));
|
||||
domainFactory = destService.getBaseDomainFactory();
|
||||
InputStream inputStream = new ByteArrayInputStream(outputStream.toByteArray());
|
||||
inputStream = new ByteArrayInputStream(os.toByteArray());
|
||||
|
||||
ois = domainFactory.createObjectInputStreamResolvingAgainstThisFactory(inputStream);
|
||||
deserializedMasterData = (TopLevelMasterData) ois.readObject();
|
||||
MasterDataImporter importer = new MasterDataImporter(domainFactory, destService);
|
||||
importer.importFromStream(inputStream, randomUUID, false);
|
||||
} finally {
|
||||
masterdata.setMasterDataExportFlagOnRaceColumns(false);
|
||||
oos.close();
|
||||
ois.close();
|
||||
os.close();
|
||||
inputStream.close();
|
||||
}
|
||||
MasterDataImporter importer = new MasterDataImporter(domainFactory, destService);
|
||||
importer.importMasterData(deserializedMasterData, randomUUID, false);
|
||||
|
||||
destService.getDataImportLock().getProgress(randomUUID).getResult();
|
||||
Regatta importedRegatta = destService.getRegattaByName(regatta.getName());
|
||||
|
||||
assertNotNull(importedRegatta.getRegattaConfiguration());
|
||||
@@ -1390,41 +1385,37 @@ public class MasterDataImportTest {
|
||||
leaderboard.setDisplayName(competitorToSuppress, nickName);
|
||||
|
||||
// Serialize
|
||||
HashSet<LeaderboardGroup> groupsToExport = new HashSet<LeaderboardGroup>();
|
||||
groupsToExport.add(group);
|
||||
TopLevelMasterData masterdata = new TopLevelMasterData(groupsToExport, sourceService.getAllEvents(),
|
||||
sourceService.getPersistentRegattasForRaceIDs(), sourceService.getAllMediaTracks());
|
||||
Assert.assertNotNull(masterdata);
|
||||
List<String> groupNamesToExport = new ArrayList<String>();
|
||||
groupNamesToExport.add(group.getName());
|
||||
|
||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||
ObjectOutputStream oos = new ObjectOutputStream(outputStream);
|
||||
RacingEventService destService;
|
||||
ObjectInputStream ois = null;
|
||||
TopLevelMasterData deserializedMasterData;
|
||||
DomainFactory domainFactory;
|
||||
MasterDataResource resource = new MasterDataResource();
|
||||
MasterDataResource spyResource = spyResource(resource, sourceService);
|
||||
Response response = spyResource.getMasterDataByLeaderboardGroups(groupNamesToExport, false);
|
||||
StreamingOutput streamingOutput = (StreamingOutput) response.getEntity();
|
||||
ByteArrayOutputStream os = new ByteArrayOutputStream();
|
||||
UUID randomUUID = UUID.randomUUID();
|
||||
ByteArrayInputStream inputStream = null;
|
||||
try {
|
||||
masterdata.setMasterDataExportFlagOnRaceColumns(true);
|
||||
oos.writeObject(masterdata);
|
||||
|
||||
outputStream.flush();
|
||||
streamingOutput.write(os);
|
||||
os.flush();
|
||||
// Delete all data above from the database, to allow recreating all of it on target server
|
||||
deleteCreatedDataFromDatabase();
|
||||
// Import in new service
|
||||
destService = new RacingEventServiceImplMock(new DataImportProgressImpl(randomUUID));
|
||||
domainFactory = destService.getBaseDomainFactory();
|
||||
InputStream inputStream = new ByteArrayInputStream(outputStream.toByteArray());
|
||||
inputStream = new ByteArrayInputStream(os.toByteArray());
|
||||
|
||||
ois = domainFactory.createObjectInputStreamResolvingAgainstThisFactory(inputStream);
|
||||
deserializedMasterData = (TopLevelMasterData) ois.readObject();
|
||||
MasterDataImporter importer = new MasterDataImporter(domainFactory, destService);
|
||||
importer.importFromStream(inputStream, randomUUID, false);
|
||||
} finally {
|
||||
masterdata.setMasterDataExportFlagOnRaceColumns(false);
|
||||
oos.close();
|
||||
ois.close();
|
||||
os.close();
|
||||
inputStream.close();
|
||||
}
|
||||
MasterDataImporter importer = new MasterDataImporter(domainFactory, destService);
|
||||
MasterDataImportObjectCreationCount creationCount = importer.importMasterData(deserializedMasterData,
|
||||
randomUUID, false);
|
||||
|
||||
MasterDataImportObjectCreationCount creationCount = destService.getDataImportLock().getProgress(randomUUID)
|
||||
.getResult();
|
||||
|
||||
// ---Asserts---
|
||||
Assert.assertNotNull(creationCount);
|
||||
@@ -1447,7 +1438,8 @@ public class MasterDataImportTest {
|
||||
List<String> raceColumnNames = new ArrayList<String>();
|
||||
String raceColumnName = "T1";
|
||||
raceColumnNames.add(raceColumnName);
|
||||
raceColumnNames.add("T2");
|
||||
String raceColumnName2 = "T2";
|
||||
raceColumnNames.add(raceColumnName2);
|
||||
final List<String> emptyRaceColumnNamesList = Collections.emptyList();
|
||||
|
||||
List<Series> series = new ArrayList<Series>();
|
||||
@@ -1528,41 +1520,37 @@ public class MasterDataImportTest {
|
||||
leaderboard.setDisplayName(competitorToSuppress, nickName);
|
||||
|
||||
// Serialize
|
||||
HashSet<LeaderboardGroup> groupsToExport = new HashSet<LeaderboardGroup>();
|
||||
groupsToExport.add(group);
|
||||
TopLevelMasterData masterdata = new TopLevelMasterData(groupsToExport, sourceService.getAllEvents(),
|
||||
sourceService.getPersistentRegattasForRaceIDs(), sourceService.getAllMediaTracks());
|
||||
Assert.assertNotNull(masterdata);
|
||||
List<String> groupNamesToExport = new ArrayList<String>();
|
||||
groupNamesToExport.add(group.getName());
|
||||
|
||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||
ObjectOutputStream oos = new ObjectOutputStream(outputStream);
|
||||
RacingEventService destService;
|
||||
ObjectInputStream ois = null;
|
||||
TopLevelMasterData deserializedMasterData;
|
||||
DomainFactory domainFactory;
|
||||
MasterDataResource resource = new MasterDataResource();
|
||||
MasterDataResource spyResource = spyResource(resource, sourceService);
|
||||
Response response = spyResource.getMasterDataByLeaderboardGroups(groupNamesToExport, false);
|
||||
StreamingOutput streamingOutput = (StreamingOutput) response.getEntity();
|
||||
ByteArrayOutputStream os = new ByteArrayOutputStream();
|
||||
UUID randomUUID = UUID.randomUUID();
|
||||
ByteArrayInputStream inputStream = null;
|
||||
try {
|
||||
masterdata.setMasterDataExportFlagOnRaceColumns(true);
|
||||
oos.writeObject(masterdata);
|
||||
|
||||
outputStream.flush();
|
||||
streamingOutput.write(os);
|
||||
os.flush();
|
||||
// Delete all data above from the database, to allow recreating all of it on target server
|
||||
deleteCreatedDataFromDatabase();
|
||||
// Import in new service
|
||||
destService = new RacingEventServiceImplMock(new DataImportProgressImpl(randomUUID));
|
||||
domainFactory = destService.getBaseDomainFactory();
|
||||
InputStream inputStream = new ByteArrayInputStream(outputStream.toByteArray());
|
||||
inputStream = new ByteArrayInputStream(os.toByteArray());
|
||||
|
||||
ois = domainFactory.createObjectInputStreamResolvingAgainstThisFactory(inputStream);
|
||||
deserializedMasterData = (TopLevelMasterData) ois.readObject();
|
||||
MasterDataImporter importer = new MasterDataImporter(domainFactory, destService);
|
||||
importer.importFromStream(inputStream, randomUUID, false);
|
||||
} finally {
|
||||
masterdata.setMasterDataExportFlagOnRaceColumns(false);
|
||||
oos.close();
|
||||
ois.close();
|
||||
os.close();
|
||||
inputStream.close();
|
||||
}
|
||||
MasterDataImporter importer = new MasterDataImporter(domainFactory, destService);
|
||||
MasterDataImportObjectCreationCount creationCount = importer.importMasterData(deserializedMasterData,
|
||||
randomUUID, false);
|
||||
|
||||
MasterDataImportObjectCreationCount creationCount = destService.getDataImportLock().getProgress(randomUUID)
|
||||
.getResult();
|
||||
|
||||
// ---Asserts---
|
||||
|
||||
@@ -1596,40 +1584,36 @@ public class MasterDataImportTest {
|
||||
sourceService.mediaTrackAdded(trackOnSource);
|
||||
|
||||
// Serialize
|
||||
HashSet<LeaderboardGroup> groupsToExport = new HashSet<LeaderboardGroup>();
|
||||
TopLevelMasterData masterdata = new TopLevelMasterData(groupsToExport, sourceService.getAllEvents(),
|
||||
sourceService.getPersistentRegattasForRaceIDs(), sourceService.getAllMediaTracks());
|
||||
Assert.assertNotNull(masterdata);
|
||||
List<String> groupNamesToExport = new ArrayList<String>();
|
||||
|
||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||
ObjectOutputStream oos = new ObjectOutputStream(outputStream);
|
||||
RacingEventService destService;
|
||||
ObjectInputStream ois = null;
|
||||
TopLevelMasterData deserializedMasterData;
|
||||
DomainFactory domainFactory;
|
||||
MasterDataResource resource = new MasterDataResource();
|
||||
MasterDataResource spyResource = spyResource(resource, sourceService);
|
||||
Response response = spyResource.getMasterDataByLeaderboardGroups(groupNamesToExport, false);
|
||||
StreamingOutput streamingOutput = (StreamingOutput) response.getEntity();
|
||||
ByteArrayOutputStream os = new ByteArrayOutputStream();
|
||||
UUID randomUUID = UUID.randomUUID();
|
||||
ByteArrayInputStream inputStream = null;
|
||||
try {
|
||||
masterdata.setMasterDataExportFlagOnRaceColumns(true);
|
||||
oos.writeObject(masterdata);
|
||||
|
||||
outputStream.flush();
|
||||
streamingOutput.write(os);
|
||||
os.flush();
|
||||
// Delete all data above from the database, to allow recreating all of it on target server
|
||||
deleteCreatedDataFromDatabase();
|
||||
// Import in new service
|
||||
destService = new RacingEventServiceImplMock(new DataImportProgressImpl(randomUUID));
|
||||
domainFactory = destService.getBaseDomainFactory();
|
||||
InputStream inputStream = new ByteArrayInputStream(outputStream.toByteArray());
|
||||
inputStream = new ByteArrayInputStream(os.toByteArray());
|
||||
|
||||
ois = domainFactory.createObjectInputStreamResolvingAgainstThisFactory(inputStream);
|
||||
deserializedMasterData = (TopLevelMasterData) ois.readObject();
|
||||
MasterDataImporter importer = new MasterDataImporter(domainFactory, destService);
|
||||
importer.importFromStream(inputStream, randomUUID, false);
|
||||
} finally {
|
||||
masterdata.setMasterDataExportFlagOnRaceColumns(false);
|
||||
oos.close();
|
||||
ois.close();
|
||||
os.close();
|
||||
inputStream.close();
|
||||
}
|
||||
MasterDataImporter importer = new MasterDataImporter(domainFactory, destService);
|
||||
MasterDataImportObjectCreationCount creationCount = importer.importMasterData(deserializedMasterData,
|
||||
randomUUID, false);
|
||||
|
||||
MasterDataImportObjectCreationCount creationCount = destService.getDataImportLock().getProgress(randomUUID)
|
||||
.getResult();
|
||||
|
||||
// ---Asserts---
|
||||
|
||||
@@ -1718,42 +1702,38 @@ public class MasterDataImportTest {
|
||||
raceColumn.setTrackedRace(testFleet1, trackedRace);
|
||||
|
||||
// Serialize
|
||||
HashSet<LeaderboardGroup> groupsToExport = new HashSet<LeaderboardGroup>();
|
||||
groupsToExport.add(group1);
|
||||
groupsToExport.add(group2);
|
||||
TopLevelMasterData masterdata = new TopLevelMasterData(groupsToExport, sourceService.getAllEvents(),
|
||||
sourceService.getPersistentRegattasForRaceIDs(), sourceService.getAllMediaTracks());
|
||||
Assert.assertNotNull(masterdata);
|
||||
List<String> groupNamesToExport = new ArrayList<String>();
|
||||
groupNamesToExport.add(group1.getName());
|
||||
groupNamesToExport.add(group2.getName());
|
||||
|
||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||
ObjectOutputStream oos = new ObjectOutputStream(outputStream);
|
||||
RacingEventService destService;
|
||||
ObjectInputStream ois = null;
|
||||
TopLevelMasterData deserializedMasterData;
|
||||
DomainFactory domainFactory;
|
||||
MasterDataResource resource = new MasterDataResource();
|
||||
MasterDataResource spyResource = spyResource(resource, sourceService);
|
||||
Response response = spyResource.getMasterDataByLeaderboardGroups(groupNamesToExport, false);
|
||||
StreamingOutput streamingOutput = (StreamingOutput) response.getEntity();
|
||||
ByteArrayOutputStream os = new ByteArrayOutputStream();
|
||||
UUID randomUUID = UUID.randomUUID();
|
||||
ByteArrayInputStream inputStream = null;
|
||||
try {
|
||||
masterdata.setMasterDataExportFlagOnRaceColumns(true);
|
||||
oos.writeObject(masterdata);
|
||||
|
||||
outputStream.flush();
|
||||
streamingOutput.write(os);
|
||||
os.flush();
|
||||
// Delete all data above from the database, to allow recreating all of it on target server
|
||||
deleteCreatedDataFromDatabase();
|
||||
// Import in new service
|
||||
destService = new RacingEventServiceImplMock(new DataImportProgressImpl(randomUUID));
|
||||
domainFactory = destService.getBaseDomainFactory();
|
||||
InputStream inputStream = new ByteArrayInputStream(outputStream.toByteArray());
|
||||
inputStream = new ByteArrayInputStream(os.toByteArray());
|
||||
|
||||
ois = domainFactory.createObjectInputStreamResolvingAgainstThisFactory(inputStream);
|
||||
deserializedMasterData = (TopLevelMasterData) ois.readObject();
|
||||
MasterDataImporter importer = new MasterDataImporter(domainFactory, destService);
|
||||
importer.importFromStream(inputStream, randomUUID, false);
|
||||
} finally {
|
||||
masterdata.setMasterDataExportFlagOnRaceColumns(false);
|
||||
oos.close();
|
||||
ois.close();
|
||||
os.close();
|
||||
inputStream.close();
|
||||
}
|
||||
MasterDataImporter importer = new MasterDataImporter(domainFactory, destService);
|
||||
MasterDataImportObjectCreationCount creationCount = importer.importMasterData(deserializedMasterData,
|
||||
randomUUID, false);
|
||||
|
||||
MasterDataImportObjectCreationCount creationCount = destService.getDataImportLock().getProgress(randomUUID)
|
||||
.getResult();
|
||||
|
||||
// Test correct number of creations
|
||||
Assert.assertNotNull(creationCount);
|
||||
@@ -1794,41 +1774,37 @@ public class MasterDataImportTest {
|
||||
metaLeaderboard.getRaceColumns().iterator().next().setFactor(factor);
|
||||
|
||||
// Serialize
|
||||
HashSet<LeaderboardGroup> groupsToExport = new HashSet<LeaderboardGroup>();
|
||||
groupsToExport.add(sourceGroup);
|
||||
TopLevelMasterData masterdata = new TopLevelMasterData(groupsToExport, sourceService.getAllEvents(),
|
||||
sourceService.getPersistentRegattasForRaceIDs(), sourceService.getAllMediaTracks());
|
||||
Assert.assertNotNull(masterdata);
|
||||
List<String> groupNamesToExport = new ArrayList<String>();
|
||||
groupNamesToExport.add(sourceGroup.getName());
|
||||
|
||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||
ObjectOutputStream oos = new ObjectOutputStream(outputStream);
|
||||
RacingEventService destService;
|
||||
ObjectInputStream ois = null;
|
||||
TopLevelMasterData deserializedMasterData;
|
||||
DomainFactory domainFactory;
|
||||
MasterDataResource resource = new MasterDataResource();
|
||||
MasterDataResource spyResource = spyResource(resource, sourceService);
|
||||
Response response = spyResource.getMasterDataByLeaderboardGroups(groupNamesToExport, false);
|
||||
StreamingOutput streamingOutput = (StreamingOutput) response.getEntity();
|
||||
ByteArrayOutputStream os = new ByteArrayOutputStream();
|
||||
UUID randomUUID = UUID.randomUUID();
|
||||
ByteArrayInputStream inputStream = null;
|
||||
try {
|
||||
masterdata.setMasterDataExportFlagOnRaceColumns(true);
|
||||
oos.writeObject(masterdata);
|
||||
|
||||
outputStream.flush();
|
||||
streamingOutput.write(os);
|
||||
os.flush();
|
||||
// Delete all data above from the database, to allow recreating all of it on target server
|
||||
deleteCreatedDataFromDatabase();
|
||||
// Import in new service
|
||||
destService = new RacingEventServiceImplMock(new DataImportProgressImpl(randomUUID));
|
||||
domainFactory = destService.getBaseDomainFactory();
|
||||
InputStream inputStream = new ByteArrayInputStream(outputStream.toByteArray());
|
||||
inputStream = new ByteArrayInputStream(os.toByteArray());
|
||||
|
||||
ois = domainFactory.createObjectInputStreamResolvingAgainstThisFactory(inputStream);
|
||||
deserializedMasterData = (TopLevelMasterData) ois.readObject();
|
||||
MasterDataImporter importer = new MasterDataImporter(domainFactory, destService);
|
||||
importer.importFromStream(inputStream, randomUUID, false);
|
||||
} finally {
|
||||
masterdata.setMasterDataExportFlagOnRaceColumns(false);
|
||||
oos.close();
|
||||
ois.close();
|
||||
os.close();
|
||||
inputStream.close();
|
||||
}
|
||||
MasterDataImporter importer = new MasterDataImporter(domainFactory, destService);
|
||||
MasterDataImportObjectCreationCount creationCount = importer.importMasterData(deserializedMasterData,
|
||||
randomUUID, false);
|
||||
|
||||
MasterDataImportObjectCreationCount creationCount = destService.getDataImportLock().getProgress(randomUUID)
|
||||
.getResult();
|
||||
|
||||
// Test correct number of creations
|
||||
Assert.assertEquals(1, creationCount.getLeaderboardGroupCount());
|
||||
|
||||
+39
-1
@@ -1,8 +1,15 @@
|
||||
package com.sap.sailing.server.masterdata;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.base.CompetitorStore;
|
||||
import com.sap.sailing.domain.base.DomainFactory;
|
||||
import com.sap.sailing.domain.base.ObjectInputStreamResolvingAgainstDomainFactory;
|
||||
import com.sap.sailing.domain.common.MasterDataImportObjectCreationCount;
|
||||
import com.sap.sailing.domain.common.impl.MasterDataImportObjectCreationCountImpl;
|
||||
import com.sap.sailing.domain.masterdataimport.TopLevelMasterData;
|
||||
@@ -19,7 +26,38 @@ public class MasterDataImporter {
|
||||
this.racingEventService = racingEventService;
|
||||
}
|
||||
|
||||
public MasterDataImportObjectCreationCount importMasterData(TopLevelMasterData topLevelMasterData,
|
||||
public void importFromStream(InputStream inputStream, UUID importOperationId, boolean override) throws IOException,
|
||||
ClassNotFoundException {
|
||||
ObjectInputStreamResolvingAgainstDomainFactory objectInputStream = racingEventService.getBaseDomainFactory()
|
||||
.createObjectInputStreamResolvingAgainstThisFactory(inputStream);
|
||||
racingEventService
|
||||
.createOrUpdateDataImportProgressWithReplication(importOperationId, 0.03, "Reading Data", 0.5);
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
final List<Serializable> competitorIds = (List<Serializable>) objectInputStream.readObject();
|
||||
if (override) {
|
||||
setAllowCompetitorsDataToBeReset(competitorIds);
|
||||
}
|
||||
TopLevelMasterData topLevelMasterData = (TopLevelMasterData) objectInputStream.readObject();
|
||||
|
||||
|
||||
racingEventService.createOrUpdateDataImportProgressWithReplication(importOperationId, 0.3,
|
||||
"Data-Transfer Complete, Initializing Import Operation", 0.5);
|
||||
|
||||
applyMasterDataImportOperation(topLevelMasterData, importOperationId, override);
|
||||
}
|
||||
|
||||
private void setAllowCompetitorsDataToBeReset(List<Serializable> competitorIds) {
|
||||
CompetitorStore store = baseDomainFactory.getCompetitorStore();
|
||||
for (Serializable id : competitorIds) {
|
||||
Competitor competitor = baseDomainFactory.getExistingCompetitorById(id);
|
||||
if (competitor != null) {
|
||||
store.allowCompetitorResetToDefaults(competitor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private MasterDataImportObjectCreationCount applyMasterDataImportOperation(TopLevelMasterData topLevelMasterData,
|
||||
UUID importOperationId, boolean override) {
|
||||
MasterDataImportObjectCreationCountImpl creationCount = new MasterDataImportObjectCreationCountImpl();
|
||||
ImportMasterDataOperation op = new ImportMasterDataOperation(topLevelMasterData, importOperationId, override,
|
||||
|
||||
@@ -101,7 +101,7 @@ Selecting the "Expert information" option you'll have access to the expert infor
|
||||
|
||||
When trying to logon onto a course area the RaceCommittee App opens an error dialog showing an error similar to "Failure to load data: 'null'" or something more expressive. Most of the times this happens when the current version of the app is not compatible with the server. Redo the synchronization step or even force an update via the app's preference screen.
|
||||
|
||||
If this doesn't help have a log in the runtime-log (see below).
|
||||
If this doesn't help have a look in the runtime-log (see below).
|
||||
|
||||
### Runtime- and Crash-Logs
|
||||
|
||||
|
||||
Reference in new issue
Block a user