diff --git a/android-sdk/src/androidTest/java/com/optimizely/ab/android/sdk/ODPIntegrationTest.java b/android-sdk/src/androidTest/java/com/optimizely/ab/android/sdk/ODPIntegrationTest.java index 00dd811e..bd96c088 100644 --- a/android-sdk/src/androidTest/java/com/optimizely/ab/android/sdk/ODPIntegrationTest.java +++ b/android-sdk/src/androidTest/java/com/optimizely/ab/android/sdk/ODPIntegrationTest.java @@ -100,7 +100,7 @@ public void setup() throws Exception { optimizelyManager = OptimizelyManager.builder() .withSDKKey(testSdkKey) - .withVuid(testVuid) + .withVuidEnabled() .withODPEventManager(odpEventManager) .withODPSegmentManager(odpSegmentManager) .build(context); diff --git a/android-sdk/src/androidTest/java/com/optimizely/ab/android/sdk/ODPIntegrationUpdateConfigTest.java b/android-sdk/src/androidTest/java/com/optimizely/ab/android/sdk/ODPIntegrationUpdateConfigTest.java index 04cd5236..fb4028bf 100644 --- a/android-sdk/src/androidTest/java/com/optimizely/ab/android/sdk/ODPIntegrationUpdateConfigTest.java +++ b/android-sdk/src/androidTest/java/com/optimizely/ab/android/sdk/ODPIntegrationUpdateConfigTest.java @@ -34,6 +34,7 @@ import com.optimizely.ab.odp.ODPApiManager; import com.optimizely.ab.odp.ODPEventManager; import com.optimizely.ab.odp.ODPManager; +import com.optimizely.ab.android.odp.VuidManager; import com.optimizely.ab.odp.ODPSegmentManager; import org.junit.Before; @@ -68,6 +69,7 @@ public class ODPIntegrationUpdateConfigTest { private OptimizelyManager optimizelyManager; private ODPManager odpManager; + private VuidManager vuidManager; private DefaultDatafileHandler datafileHandler; private NotificationCenter notificationCenter; private Context context = InstrumentationRegistry.getInstrumentation().getTargetContext(); @@ -101,6 +103,7 @@ public void setup() throws Exception { datafileHandler = new DefaultDatafileHandler(); notificationCenter = new NotificationCenter(); + vuidManager = new VuidManager(context, true); optimizelyManager = new OptimizelyManager( null, @@ -117,7 +120,7 @@ public void setup() throws Exception { notificationCenter, null, odpManager, - "test-vuid", + vuidManager, null, null); } diff --git a/android-sdk/src/test/java/com/optimizely/ab/android/sdk/OptimizelyManagerBuilderTest.java b/android-sdk/src/test/java/com/optimizely/ab/android/sdk/OptimizelyManagerBuilderTest.java index b9f5f276..0f0cfaab 100644 --- a/android-sdk/src/test/java/com/optimizely/ab/android/sdk/OptimizelyManagerBuilderTest.java +++ b/android-sdk/src/test/java/com/optimizely/ab/android/sdk/OptimizelyManagerBuilderTest.java @@ -115,7 +115,7 @@ public void testBuildWithValidPollingInterval() { OptimizelyManager manager = OptimizelyManager.builder() .withSDKKey(testSdkKey) .withDatafileDownloadInterval(interval, timeUnit) - .withVuid("any-to-avoid-generate") + .withVuidEnabled() .build(mockContext); assertEquals(interval * 60L, manager.getDatafileDownloadInterval().longValue()); @@ -128,7 +128,7 @@ public void testBuildWithEventHandler() { .withSDKKey(testSdkKey) .withDatafileDownloadInterval(901L, TimeUnit.SECONDS) .withEventHandler(eventHandler) - .withVuid("any-to-avoid-generate") + .withVuidEnabled() .build(mockContext); assertEquals(901L, manager.getDatafileDownloadInterval().longValue()); @@ -142,7 +142,7 @@ public void testBuildWithErrorHandler() { .withSDKKey(testSdkKey) .withDatafileDownloadInterval(61L, TimeUnit.SECONDS) .withErrorHandler(errorHandler) - .withVuid("any-to-avoid-generate") + .withVuidEnabled() .build(mockContext); manager.initialize(mockContext, minDatafile); @@ -157,7 +157,7 @@ public void testBuildWithDatafileHandler() { .withSDKKey(testSdkKey) .withDatafileDownloadInterval(61L, TimeUnit.SECONDS) .withDatafileHandler(dfHandler) - .withVuid("any-to-avoid-generate") + .withVuidEnabled() .build(mockContext); manager.initialize(mockContext, minDatafile); @@ -172,7 +172,7 @@ public void testBuildWithUserProfileService() { .withSDKKey(testSdkKey) .withDatafileDownloadInterval(61L, TimeUnit.SECONDS) .withUserProfileService(ups) - .withVuid("any-to-avoid-generate") + .withVuidEnabled() .build(mockContext); manager.initialize(mockContext, minDatafile); @@ -189,7 +189,7 @@ public void testBuildWithDatafileDownloadInterval_workerScheduled() throws Excep .withSDKKey(testSdkKey) .withDatafileHandler(mockDatafileHandler) .withDatafileDownloadInterval(goodNumber, TimeUnit.MINUTES) - .withVuid("any-to-avoid-generate") + .withVuidEnabled() .build(mockContext); OptimizelyManager spyManager = spy(manager); when(spyManager.isAndroidVersionSupported()).thenReturn(true); @@ -205,7 +205,7 @@ public void testBuildWithDatafileDownloadInterval_workerCancelledWhenIntervalIsN .withSDKKey(testSdkKey) .withDatafileHandler(mockDatafileHandler) .withDatafileDownloadInterval(-1, TimeUnit.MINUTES) - .withVuid("any-to-avoid-generate") + .withVuidEnabled() .build(mockContext); OptimizelyManager spyManager = spy(manager); when(spyManager.isAndroidVersionSupported()).thenReturn(true); @@ -220,7 +220,7 @@ public void testBuildWithCustomSdkNameAndVersion() throws Exception { OptimizelyManager manager = OptimizelyManager.builder() .withSDKKey(testSdkKey) .withClientInfo("test-sdk", "test-version") - .withVuid("any-to-avoid-generate") + .withVuidEnabled() .build(mockContext); assertEquals(manager.getSdkName(mockContext), "test-sdk"); assertEquals(manager.getSdkVersion(), "test-version"); @@ -232,7 +232,7 @@ public void testBuildWithDefaultODP_defaultEnabled() throws Exception { OptimizelyManager manager = OptimizelyManager.builder() .withSDKKey(testSdkKey) - .withVuid("test-vuid") + .withVuidEnabled() .build(mockContext); verifyNew(OptimizelyManager.class).withArguments( @@ -262,7 +262,7 @@ public void testBuildWithDefaultODP_disabled() throws Exception { OptimizelyManager manager = OptimizelyManager.builder() .withSDKKey(testSdkKey) .withODPDisabled() - .withVuid("test-vuid") + .withVuidEnabled() .build(mockContext); verifyNew(OptimizelyManager.class).withArguments( @@ -293,7 +293,7 @@ public void testBuildWithODP_defaultCacheSizeAndTimeout() throws Exception { OptimizelyManager manager = OptimizelyManager.builder() .withSDKKey(testSdkKey) - .withVuid("any-to-avoid-generate") + .withVuidEnabled() .build(mockContext); verifyNew(ODPManager.class).withArguments( @@ -320,7 +320,7 @@ public void testBuildWithODP_customSegmentCacheSize() throws Exception { OptimizelyManager manager = OptimizelyManager.builder() .withSDKKey(testSdkKey) .withODPSegmentCacheSize(1234) - .withVuid("any-to-avoid-generate") + .withVuidEnabled() .build(mockContext); verifyNew(ODPSegmentManager.class).withArguments( @@ -337,7 +337,7 @@ public void testBuildWithODP_customSegmentCacheTimeout() throws Exception { OptimizelyManager manager = OptimizelyManager.builder() .withSDKKey(testSdkKey) .withODPSegmentCacheTimeout(20, TimeUnit.MINUTES) - .withVuid("any-to-avoid-generate") + .withVuidEnabled() .build(mockContext); verifyNew(ODPSegmentManager.class).withArguments( @@ -351,7 +351,7 @@ public void testBuildWithODP_customSegmentCacheTimeout() throws Exception { public void testBuildWithODP_defaultSegmentFetchTimeout() throws Exception { OptimizelyManager manager = OptimizelyManager.builder() .withSDKKey(testSdkKey) - .withVuid("any-to-avoid-generate") + .withVuidEnabled() .build(mockContext); assertEquals(ODPSegmentClient.Companion.getCONNECTION_TIMEOUT(), 10*1000); @@ -364,7 +364,7 @@ public void testBuildWithODP_customSegmentFetchTimeout() throws Exception { .withSDKKey(testSdkKey) .withTimeoutForODPSegmentFetch(20) .withTimeoutForODPEventDispatch(30) - .withVuid("any-to-avoid-generate") + .withVuidEnabled() .build(mockContext); assertEquals(ODPSegmentClient.Companion.getCONNECTION_TIMEOUT(), 20*1000); @@ -380,7 +380,7 @@ public void testBuildWithODP_defaultCommonDataAndIdentifiers() throws Exception OptimizelyManager manager = OptimizelyManager.builder() .withSDKKey(testSdkKey) - .withVuid("test-vuid") + .withVuidEnabled() .build(mockContext); ArgumentCaptor> captorData = ArgumentCaptor.forClass(Map.class); diff --git a/android-sdk/src/test/java/com/optimizely/ab/android/sdk/OptimizelyManagerIntervalTest.java b/android-sdk/src/test/java/com/optimizely/ab/android/sdk/OptimizelyManagerIntervalTest.java index 45fceb29..ec939ec3 100644 --- a/android-sdk/src/test/java/com/optimizely/ab/android/sdk/OptimizelyManagerIntervalTest.java +++ b/android-sdk/src/test/java/com/optimizely/ab/android/sdk/OptimizelyManagerIntervalTest.java @@ -84,7 +84,7 @@ public void setup() throws Exception { public void testBuildWithDatafileDownloadInterval() throws Exception { long goodNumber = 27; OptimizelyManager manager = OptimizelyManager.builder("1") - .withVuid("any-to-avoid-generate") + .withVuidEnabled() .withLogger(logger) .withDatafileDownloadInterval(goodNumber, TimeUnit.MINUTES) .build(mockContext); @@ -113,7 +113,7 @@ public void testBuildWithDatafileDownloadInterval() throws Exception { public void testBuildWithDatafileDownloadIntervalDeprecated() throws Exception { long goodNumber = 1234L; OptimizelyManager manager = OptimizelyManager.builder("1") - .withVuid("any-to-avoid-generate") + .withVuidEnabled() .withLogger(logger) .withDatafileDownloadInterval(goodNumber) // deprecated .build(mockContext); @@ -142,7 +142,7 @@ public void testBuildWithDatafileDownloadIntervalDeprecated() throws Exception { public void testBuildWithEventDispatchInterval() throws Exception { long goodNumber = 100L; OptimizelyManager manager = OptimizelyManager.builder("1") - .withVuid("any-to-avoid-generate") + .withVuidEnabled() .withLogger(logger) .withEventDispatchInterval(goodNumber, TimeUnit.SECONDS) .build(mockContext); @@ -186,7 +186,7 @@ public void testBuildWithEventDispatchRetryInterval() throws Exception { long defaultEventFlushInterval = 30L; // seconds OptimizelyManager manager = OptimizelyManager.builder("1") - .withVuid("any-to-avoid-generate") + .withVuidEnabled() .withLogger(logger) .withEventDispatchRetryInterval(goodNumber, timeUnit) .build(mockContext); @@ -227,7 +227,7 @@ public void testBuildWithEventDispatchRetryInterval() throws Exception { public void testBuildWithEventDispatchIntervalDeprecated() throws Exception { long goodNumber = 1234L; OptimizelyManager manager = OptimizelyManager.builder("1") - .withVuid("any-to-avoid-generate") + .withVuidEnabled() .withLogger(logger) .withEventDispatchInterval(goodNumber) // deprecated .build(mockContext); diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 7ce850e5..07350e57 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,7 +1,7 @@ -#Thu Jan 28 11:38:35 PST 2021 +#Fri Oct 18 20:28:21 BDT 2024 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME +distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip org.gradle.jvmargs=-Xmx1g +zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip diff --git a/odp/src/main/java/com/optimizely/ab/android/odp/VuidManager.kt b/odp/src/main/java/com/optimizely/ab/android/odp/VuidManager.kt index 7aa0b103..dc467799 100644 --- a/odp/src/main/java/com/optimizely/ab/android/odp/VuidManager.kt +++ b/odp/src/main/java/com/optimizely/ab/android/odp/VuidManager.kt @@ -47,7 +47,7 @@ class VuidManager constructor(context: Context, isEnabled: Boolean = false) { return visitorId.startsWith("vuid_", ignoreCase = true) } } - + @VisibleForTesting fun makeVuid(): String { val maxLength = 32 // required by ODP server