Skip to content

Commit

Permalink
Merge pull request #53 from sportradar/v2.0.61
Browse files Browse the repository at this point in the history
v2.0.61
  • Loading branch information
dhrovat authored Jul 21, 2023
2 parents d496b0d + 4037e9d commit f050272
Show file tree
Hide file tree
Showing 24 changed files with 1,261 additions and 76 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ buildNumber.properties

#custom exclusions
/uf-sdk-logs/
**/uf-sdk-logs/
UFSdkConfiguration.properties
application.yml

**/custom

# logs
*.log.gz
*.log
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
### Unified Feed SDK 2.x changelog

**2.0.61 (2023-07-20)**
* Stages can be of SprintRace type

**2.0.60.0 (2023-05-17)**
* CustomBetManager respects ExceptionHandlingStrategy for all non-argument-validating exceptions
* CustomBetManager now throws CommunicationException on API failures
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.sportradar.unifiedodds.sdk</groupId>
<artifactId>unified-feed-sdk-parent</artifactId>
<version>2.0.60</version>
<version>2.0.61</version>
<packaging>pom</packaging>
<name>Unified Odds Feed SDK - parent</name>
<description>UnifiedFeed SDK is a client library that enables easier integration with the Betradar XML feeds. SDK exposes XML feed service interface in a more user-friendly way and isolates the client from having to do XML feed parsing, proper connection handling, error recovery, event queuing, data caching and dispatching. It also makes a client solution more stable and robust when it comes to feed handling, especially with the release of new and updated XML feed versions.</description>
Expand Down
2 changes: 1 addition & 1 deletion sdk-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<groupId>com.sportradar.unifiedodds.sdk</groupId>
<artifactId>unified-feed-sdk</artifactId>
<version>2.0.60</version>
<version>2.0.61</version>

<name>Unified Odds Feed SDK</name>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import java.util.Locale;
import java.util.Map;

@SuppressWarnings({ "AbbreviationAsWordInName", "HiddenField", "ParameterNumber" })
@SuppressWarnings({ "HiddenField", "ParameterNumber", "AbbreviationAsWordInName" })
public class ExportableRaceStageCI extends ExportableStageCI {

private Locale defaultLocale;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public enum StageType {
Qualifying,
QualifyingPart,
Lap,
SprintRace,
Run;

public static StageType mapFromApiValue(String str) {
Expand Down Expand Up @@ -64,6 +65,8 @@ public static StageType mapFromApiValue(String str) {
return Lap;
case "run":
return Run;
case "sprint_race":
return SprintRace;
default:
return null;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Copyright (C) Sportradar AG. See LICENSE for full license governing this code
*/
package com.sportradar.unifiedodds.sdk;

import static org.assertj.core.api.Assertions.assertThat;

import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.junit.Test;

public class ErrorHandlingStrategiesTest {

private final int sampleSize = 100;
private List<ExceptionHandlingStrategy> strategies = Stream
.generate(() -> ExceptionHandlingStrategies.anyErrorHandlingStrategy())
.limit(sampleSize)
.distinct()
.collect(Collectors.toList());

@Test
public void anyStrategyGeneratesNotAlwaysTheSameStrategy() {
assertThat(strategies).hasSizeGreaterThan(1);
}

@Test
public void anyStrategyDoesNotGenerateNulls() {
assertThat(strategies).doesNotContainNull();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Copyright (C) Sportradar AG. See LICENSE for full license governing this code
*/
package com.sportradar.unifiedodds.sdk;

import static com.sportradar.unifiedodds.sdk.ExceptionHandlingStrategy.Catch;
import static com.sportradar.unifiedodds.sdk.ExceptionHandlingStrategy.Throw;

import java.util.Arrays;
import java.util.Random;
import lombok.val;

public class ExceptionHandlingStrategies {

private static Random random = new Random();

private ExceptionHandlingStrategies() {}

public static ExceptionHandlingStrategy anyErrorHandlingStrategy() {
val strategiesPool = Arrays.asList(Throw, Catch);
return strategiesPool.get(random.nextInt(strategiesPool.size()));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* Copyright (C) Sportradar AG. See LICENSE for full license governing this code
*/
package com.sportradar.unifiedodds.sdk.caching.impl;

import com.sportradar.unifiedodds.sdk.caching.DataRouterManager;

public class DataRouterManagers {

private DataRouterManagers() {}

public static DataRouterManager any() {
return new NoOpDataRouterManager();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
/*
* Copyright (C) Sportradar AG. See LICENSE for full license governing this code
*/
package com.sportradar.unifiedodds.sdk.caching.impl;

import com.sportradar.uf.sportsapi.datamodel.SAPIMatchTimelineEndpoint;
import com.sportradar.unifiedodds.sdk.caching.CacheItem;
import com.sportradar.unifiedodds.sdk.caching.DataRouterManager;
import com.sportradar.unifiedodds.sdk.custombetentities.AvailableSelections;
import com.sportradar.unifiedodds.sdk.custombetentities.Calculation;
import com.sportradar.unifiedodds.sdk.custombetentities.CalculationFilter;
import com.sportradar.unifiedodds.sdk.custombetentities.Selection;
import com.sportradar.unifiedodds.sdk.entities.FixtureChange;
import com.sportradar.unifiedodds.sdk.entities.PeriodStatus;
import com.sportradar.unifiedodds.sdk.entities.ResultChange;
import com.sportradar.unifiedodds.sdk.exceptions.internal.CommunicationException;
import com.sportradar.utils.URN;
import java.util.Date;
import java.util.List;
import java.util.Locale;

public class NoOpDataRouterManager implements DataRouterManager {

@Override
public void requestSummaryEndpoint(Locale locale, URN id, CacheItem requester)
throws CommunicationException {}

@Override
public void requestFixtureEndpoint(Locale locale, URN id, boolean useCachedProvider, CacheItem requester)
throws CommunicationException {}

@Override
public void requestDrawSummary(Locale locale, URN id, CacheItem requester)
throws CommunicationException {}

@Override
public void requestDrawFixture(Locale locale, URN id, CacheItem requester)
throws CommunicationException {}

@Override
public void requestAllTournamentsForAllSportsEndpoint(Locale locale) throws CommunicationException {}

@Override
public void requestAllSportsEndpoint(Locale locale) throws CommunicationException {}

@Override
public List<URN> requestAllLotteriesEndpoint(Locale locale, Boolean requireResult)
throws CommunicationException {
return null;
}

@Override
public List<URN> requestEventsFor(Locale locale, URN tournamentId) throws CommunicationException {
return null;
}

@Override
public List<URN> requestEventsFor(Locale locale, Date date) throws CommunicationException {
return null;
}

@Override
public List<URN> requestLotterySchedule(Locale locale, URN lotteryId, CacheItem requester)
throws CommunicationException {
return null;
}

@Override
public void requestPlayerProfileEndpoint(Locale locale, URN id, CacheItem requester)
throws CommunicationException {}

@Override
public void requestCompetitorEndpoint(Locale locale, URN id, CacheItem requester)
throws CommunicationException {}

@Override
public void requestSimpleTeamEndpoint(Locale locale, URN id, CacheItem requester)
throws CommunicationException {}

@Override
public List<URN> requestSeasonsFor(Locale locale, URN tournamentId) throws CommunicationException {
return null;
}

@Override
public SAPIMatchTimelineEndpoint requestEventTimelineEndpoint(Locale locale, URN id, CacheItem requester)
throws CommunicationException {
return null;
}

@Override
public void requestSportCategoriesEndpoint(Locale locale, URN id, CacheItem requester)
throws CommunicationException {}

@Override
public AvailableSelections requestAvailableSelections(URN id) throws CommunicationException {
return null;
}

@Override
public Calculation requestCalculateProbability(List<Selection> selections) throws CommunicationException {
return null;
}

@Override
public CalculationFilter requestCalculateProbabilityFilter(List<Selection> selections)
throws CommunicationException {
return null;
}

@Override
public List<FixtureChange> requestFixtureChanges(Date after, URN sportId, Locale locale)
throws CommunicationException {
return null;
}

@Override
public List<ResultChange> requestResultChanges(Date after, URN sportId, Locale locale)
throws CommunicationException {
return null;
}

@Override
public List<URN> requestListSportEvents(Locale locale, int startIndex, int limit)
throws CommunicationException {
return null;
}

@Override
public List<URN> requestAvailableTournamentsFor(Locale locale, URN sportId)
throws CommunicationException {
return null;
}

@Override
public List<PeriodStatus> requestPeriodSummary(
URN id,
Locale locale,
List<URN> competitorIds,
List<Integer> periods
) throws CommunicationException {
return null;
}

@Override
public void close() {}
}
Loading

0 comments on commit f050272

Please sign in to comment.