@datadog/mobile-react-native 2.14.1 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/DatadogSDKReactNative.podspec +6 -6
- package/README.md +23 -13
- package/android/build.gradle +10 -11
- package/android/gradle.properties +1 -1
- package/android/src/main/kotlin/com/datadog/reactnative/DatadogSDKWrapper.kt +36 -93
- package/android/src/main/kotlin/com/datadog/reactnative/DatadogWrapper.kt +46 -59
- package/android/src/main/kotlin/com/datadog/reactnative/DdLogsImplementation.kt +2 -1
- package/android/src/main/kotlin/com/datadog/reactnative/DdRumImplementation.kt +98 -0
- package/android/src/main/kotlin/com/datadog/reactnative/DdSdkConfiguration.kt +125 -75
- package/android/src/main/kotlin/com/datadog/reactnative/DdSdkConfigurationExt.kt +199 -90
- package/android/src/main/kotlin/com/datadog/reactnative/DdSdkImplementation.kt +151 -24
- package/android/src/main/kotlin/com/datadog/reactnative/DdSdkNativeInitialization.kt +57 -33
- package/android/src/main/kotlin/com/datadog/reactnative/DdSdkReactNativePackage.kt +2 -1
- package/android/src/main/kotlin/com/datadog/reactnative/DdTelemetry.kt +96 -0
- package/android/src/main/kotlin/com/datadog/reactnative/DdTraceImplementation.kt +20 -19
- package/android/src/main/kotlin/com/datadog/reactnative/SdkVersion.kt +1 -1
- package/android/src/newarch/kotlin/com/datadog/reactnative/DdRum.kt +100 -1
- package/android/src/newarch/kotlin/com/datadog/reactnative/DdSdk.kt +68 -14
- package/android/src/oldarch/kotlin/com/datadog/reactnative/DdRum.kt +94 -0
- package/android/src/oldarch/kotlin/com/datadog/reactnative/DdSdk.kt +70 -11
- package/android/src/test/kotlin/com/datadog/reactnative/DdRumTest.kt +58 -0
- package/android/src/test/kotlin/com/datadog/reactnative/DdSdkNativeInitializationTest.kt +63 -43
- package/android/src/test/kotlin/com/datadog/reactnative/DdSdkTest.kt +2024 -1199
- package/android/src/test/kotlin/com/datadog/reactnative/DdTraceTest.kt +44 -40
- package/android/src/test/kotlin/com/datadog/tools/unit/DdSdkConfigurationExt.kt +60 -91
- package/android/src/test/kotlin/com/datadog/tools/unit/MockRumMonitor.kt +34 -14
- package/android/src/test/kotlin/com/datadog/tools/unit/forge/DdSdkConfigurationForgeryFactory.kt +47 -43
- package/android/src/test/kotlin/com/datadog/tools/unit/forge/TelemetryConfigurationEventForgeryFactory.kt +0 -1
- package/android/src/test/resources/input/complete-configuration.json +32 -28
- package/android/src/test/resources/input/malformed-configuration.json +1 -1
- package/android/src/test/resources/input/minimal-configuration.json +4 -2
- package/datadog-configuration.schema.json +187 -139
- package/ios/Sources/AnyEncodable.swift +14 -7
- package/ios/Sources/Attributes.swift +0 -7
- package/ios/Sources/DatadogSDKWrapper.swift +12 -128
- package/ios/Sources/DdLogsImplementation.swift +9 -39
- package/ios/Sources/DdRum.mm +89 -1
- package/ios/Sources/DdRumImplementation.swift +79 -0
- package/ios/Sources/DdSdk.mm +76 -11
- package/ios/Sources/DdSdkConfiguration.swift +159 -117
- package/ios/Sources/DdSdkImplementation.swift +235 -82
- package/ios/Sources/DdSdkNativeInitialization.swift +116 -80
- package/ios/Sources/DdTelemetry.swift +49 -0
- package/ios/Sources/GlobalState.swift +1 -1
- package/ios/Sources/RNDdSdkConfiguration.swift +334 -172
- package/ios/Sources/SdkVersion.swift +1 -1
- package/jest/mock.js +43 -4
- package/lib/commonjs/DdAttributes.js.map +1 -0
- package/lib/commonjs/DdSdkReactNative.js +159 -56
- package/lib/commonjs/DdSdkReactNative.js.map +1 -1
- package/lib/commonjs/InternalLog.js +1 -1
- package/lib/commonjs/config/DatadogProviderConfiguration.js +25 -0
- package/lib/commonjs/config/DatadogProviderConfiguration.js.map +1 -0
- package/lib/commonjs/config/FileBasedConfiguration.js +349 -0
- package/lib/commonjs/config/FileBasedConfiguration.js.map +1 -0
- package/lib/commonjs/config/FileBasedConfiguration.type.js +6 -0
- package/lib/commonjs/config/FileBasedConfiguration.type.js.map +1 -0
- package/lib/commonjs/config/async/AutoInstrumentationConfiguration.js +51 -0
- package/lib/commonjs/config/async/AutoInstrumentationConfiguration.js.map +1 -0
- package/lib/commonjs/config/async/PartialInitializationConfiguration.js +6 -0
- package/lib/commonjs/config/async/PartialInitializationConfiguration.js.map +1 -0
- package/lib/commonjs/config/async/asyncInitializationHelper.js +44 -0
- package/lib/commonjs/config/async/asyncInitializationHelper.js.map +1 -0
- package/lib/commonjs/config/features/CoreConfiguration.js +104 -0
- package/lib/commonjs/config/features/CoreConfiguration.js.map +1 -0
- package/lib/commonjs/config/features/CoreConfiguration.type.js +6 -0
- package/lib/commonjs/config/features/CoreConfiguration.type.js.map +1 -0
- package/lib/commonjs/config/features/CoreConfigurationNative.js +38 -0
- package/lib/commonjs/config/features/CoreConfigurationNative.js.map +1 -0
- package/lib/commonjs/config/features/LogsConfiguration.js +36 -0
- package/lib/commonjs/config/features/LogsConfiguration.js.map +1 -0
- package/lib/commonjs/config/features/LogsConfiguration.type.js +6 -0
- package/lib/commonjs/config/features/LogsConfiguration.type.js.map +1 -0
- package/lib/commonjs/config/features/LogsConfigurationNative.js +2 -0
- package/lib/commonjs/config/features/LogsConfigurationNative.js.map +1 -0
- package/lib/commonjs/config/features/RumConfiguration.js +120 -0
- package/lib/commonjs/config/features/RumConfiguration.js.map +1 -0
- package/lib/commonjs/config/features/RumConfiguration.type.js +6 -0
- package/lib/commonjs/config/features/RumConfiguration.type.js.map +1 -0
- package/lib/commonjs/config/features/RumConfigurationNative.js +2 -0
- package/lib/commonjs/config/features/RumConfigurationNative.js.map +1 -0
- package/lib/commonjs/config/features/TraceConfiguration.js +24 -0
- package/lib/commonjs/config/features/TraceConfiguration.js.map +1 -0
- package/lib/commonjs/config/features/TraceConfiguration.type.js +2 -0
- package/lib/commonjs/config/features/TraceConfiguration.type.js.map +1 -0
- package/lib/commonjs/config/features/TraceConfigurationNative.js +2 -0
- package/lib/commonjs/config/features/TraceConfigurationNative.js.map +1 -0
- package/lib/commonjs/config/types/BatchProcessingLevel.js +30 -0
- package/lib/commonjs/config/types/BatchProcessingLevel.js.map +1 -0
- package/lib/commonjs/config/types/BatchSize.js +31 -0
- package/lib/commonjs/config/types/BatchSize.js.map +1 -0
- package/lib/commonjs/config/types/InitializationMode.js +17 -0
- package/lib/commonjs/config/types/InitializationMode.js.map +1 -0
- package/lib/commonjs/config/types/InitializationModeForTelemetry.js +2 -0
- package/lib/commonjs/config/types/InitializationModeForTelemetry.js.map +1 -0
- package/lib/commonjs/{ProxyConfiguration.js → config/types/ProxyConfiguration.js} +6 -0
- package/lib/commonjs/config/types/ProxyConfiguration.js.map +1 -0
- package/lib/commonjs/config/types/SdkVerbosity.js.map +1 -0
- package/lib/commonjs/config/types/TrackingConsent.js.map +1 -0
- package/lib/commonjs/config/types/UploadFrequency.js +30 -0
- package/lib/commonjs/config/types/UploadFrequency.js.map +1 -0
- package/lib/commonjs/config/types/VitalsUpdateFrequency.js +19 -0
- package/lib/commonjs/config/types/VitalsUpdateFrequency.js.map +1 -0
- package/lib/commonjs/config/types/index.js +68 -0
- package/lib/commonjs/config/types/index.js.map +1 -0
- package/lib/commonjs/index.js +51 -21
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/logs/DdLogs.js +13 -9
- package/lib/commonjs/logs/DdLogs.js.map +1 -1
- package/lib/commonjs/logs/eventMapper.js +4 -1
- package/lib/commonjs/logs/eventMapper.js.map +1 -1
- package/lib/commonjs/nativeModulesTypes.js +0 -45
- package/lib/commonjs/nativeModulesTypes.js.map +1 -1
- package/lib/commonjs/rum/DdRum.js +56 -28
- package/lib/commonjs/rum/DdRum.js.map +1 -1
- package/lib/commonjs/rum/helper.js +63 -0
- package/lib/commonjs/rum/helper.js.map +1 -0
- package/lib/commonjs/rum/instrumentation/DdRumErrorTracking.js +14 -18
- package/lib/commonjs/rum/instrumentation/DdRumErrorTracking.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/interactionTracking/DdBabelInteractionTracking.js +15 -25
- package/lib/commonjs/rum/instrumentation/interactionTracking/DdBabelInteractionTracking.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/interactionTracking/DdEventsInterceptor.js +1 -1
- package/lib/commonjs/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.js +15 -5
- package/lib/commonjs/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/DdRumResourceTracking.js +34 -22
- package/lib/commonjs/rum/instrumentation/resourceTracking/DdRumResourceTracking.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/DatadogTracingContext.js +21 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/DatadogTracingContext.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/TracingIdentifier.js +16 -3
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/TracingIdentifier.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.js +10 -12
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingAttributes.js +6 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingAttributes.js.map +1 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.js +41 -47
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingSampling.js +62 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingSampling.js.map +1 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/firstPartyHosts.js +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/headers.js +36 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/headers.js.map +1 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/URLHostParser.js +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.js +19 -8
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/baggageHeaderUtils.js +90 -48
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/baggageHeaderUtils.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/responseSize.js +1 -1
- package/lib/commonjs/rum/types.js +1 -9
- package/lib/commonjs/rum/types.js.map +1 -1
- package/lib/commonjs/sdk/AccountInfoSingleton/AccountInfoSingleton.js +46 -0
- package/lib/commonjs/sdk/AccountInfoSingleton/AccountInfoSingleton.js.map +1 -0
- package/lib/commonjs/sdk/AccountInfoSingleton/types.js +2 -0
- package/lib/commonjs/sdk/AccountInfoSingleton/types.js.map +1 -0
- package/lib/commonjs/sdk/AttributesEncoding/attributesEncoding.js +51 -0
- package/lib/commonjs/sdk/AttributesEncoding/attributesEncoding.js.map +1 -0
- package/lib/commonjs/sdk/AttributesEncoding/defaultEncoders.js +140 -0
- package/lib/commonjs/sdk/AttributesEncoding/defaultEncoders.js.map +1 -0
- package/lib/commonjs/{utils → sdk/AttributesEncoding}/errorUtils.js +39 -22
- package/lib/commonjs/sdk/AttributesEncoding/errorUtils.js.map +1 -0
- package/lib/commonjs/sdk/AttributesEncoding/helpers.js +123 -0
- package/lib/commonjs/sdk/AttributesEncoding/helpers.js.map +1 -0
- package/lib/commonjs/sdk/AttributesEncoding/types.js +2 -0
- package/lib/commonjs/sdk/AttributesEncoding/types.js.map +1 -0
- package/lib/commonjs/sdk/AttributesEncoding/utils.js +36 -0
- package/lib/commonjs/sdk/AttributesEncoding/utils.js.map +1 -0
- package/lib/commonjs/sdk/AttributesSingleton/AttributesSingleton.js +27 -1
- package/lib/commonjs/sdk/AttributesSingleton/AttributesSingleton.js.map +1 -1
- package/lib/commonjs/sdk/DatadogInternalBridge/DdSdkInternalNativeBridge.js +3 -3
- package/lib/commonjs/sdk/DatadogInternalBridge/DdSdkInternalNativeBridge.js.map +1 -1
- package/lib/commonjs/sdk/DatadogInternalBridge/DdSdkInternalNativeBridgeEvent.js +1 -1
- package/lib/commonjs/sdk/DatadogProvider/Buffer/BoundedBuffer.js +4 -4
- package/lib/commonjs/sdk/DatadogProvider/Buffer/BoundedBuffer.js.map +1 -1
- package/lib/commonjs/sdk/DatadogProvider/DatadogProvider.js +10 -9
- package/lib/commonjs/sdk/DatadogProvider/DatadogProvider.js.map +1 -1
- package/lib/commonjs/sdk/DatadogProvider/DatadogProviderState.js +28 -0
- package/lib/commonjs/sdk/DatadogProvider/DatadogProviderState.js.map +1 -0
- package/lib/commonjs/sdk/DdSdk.js +4 -2
- package/lib/commonjs/sdk/DdSdk.js.map +1 -1
- package/lib/commonjs/sdk/DdSdkInternal.js +86 -0
- package/lib/commonjs/sdk/DdSdkInternal.js.map +1 -0
- package/lib/commonjs/sdk/EventMappers/EventMapper.js +6 -3
- package/lib/commonjs/sdk/EventMappers/EventMapper.js.map +1 -1
- package/lib/commonjs/sdk/GlobalState/GlobalState.js +5 -11
- package/lib/commonjs/sdk/GlobalState/GlobalState.js.map +1 -1
- package/lib/commonjs/sdk/UserInfoSingleton/UserInfoSingleton.js +6 -1
- package/lib/commonjs/sdk/UserInfoSingleton/UserInfoSingleton.js.map +1 -1
- package/lib/commonjs/specs/NativeDdRum.js.map +1 -1
- package/lib/commonjs/specs/NativeDdSdk.js.map +1 -1
- package/lib/commonjs/trace/DdTrace.js +7 -5
- package/lib/commonjs/trace/DdTrace.js.map +1 -1
- package/lib/commonjs/types.js +19 -46
- package/lib/commonjs/types.js.map +1 -1
- package/lib/commonjs/utils/longTasksUtils.js.map +1 -1
- package/lib/commonjs/utils/singletonUtils.js +21 -0
- package/lib/commonjs/utils/singletonUtils.js.map +1 -0
- package/lib/commonjs/version.js +1 -1
- package/lib/commonjs/version.js.map +1 -1
- package/lib/module/DdAttributes.js.map +1 -0
- package/lib/module/DdSdkReactNative.js +155 -52
- package/lib/module/DdSdkReactNative.js.map +1 -1
- package/lib/module/InternalLog.js +1 -1
- package/lib/module/InternalLog.js.map +1 -1
- package/lib/module/config/DatadogProviderConfiguration.js +18 -0
- package/lib/module/config/DatadogProviderConfiguration.js.map +1 -0
- package/lib/module/config/FileBasedConfiguration.js +341 -0
- package/lib/module/config/FileBasedConfiguration.js.map +1 -0
- package/lib/module/config/FileBasedConfiguration.type.js +2 -0
- package/lib/module/config/FileBasedConfiguration.type.js.map +1 -0
- package/lib/module/config/async/AutoInstrumentationConfiguration.js +45 -0
- package/lib/module/config/async/AutoInstrumentationConfiguration.js.map +1 -0
- package/lib/module/config/async/PartialInitializationConfiguration.js +2 -0
- package/lib/module/config/async/PartialInitializationConfiguration.js.map +1 -0
- package/lib/module/config/async/asyncInitializationHelper.js +36 -0
- package/lib/module/config/async/asyncInitializationHelper.js.map +1 -0
- package/lib/module/config/features/CoreConfiguration.js +98 -0
- package/lib/module/config/features/CoreConfiguration.js.map +1 -0
- package/lib/module/config/features/CoreConfiguration.type.js +2 -0
- package/lib/module/config/features/CoreConfiguration.type.js.map +1 -0
- package/lib/module/config/features/CoreConfigurationNative.js +31 -0
- package/lib/module/config/features/CoreConfigurationNative.js.map +1 -0
- package/lib/module/config/features/LogsConfiguration.js +30 -0
- package/lib/module/config/features/LogsConfiguration.js.map +1 -0
- package/lib/module/config/features/LogsConfiguration.type.js +2 -0
- package/lib/module/config/features/LogsConfiguration.type.js.map +1 -0
- package/lib/module/config/features/LogsConfigurationNative.js +2 -0
- package/lib/module/config/features/LogsConfigurationNative.js.map +1 -0
- package/lib/module/config/features/RumConfiguration.js +114 -0
- package/lib/module/config/features/RumConfiguration.js.map +1 -0
- package/lib/module/config/features/RumConfiguration.type.js +2 -0
- package/lib/module/config/features/RumConfiguration.type.js.map +1 -0
- package/lib/module/config/features/RumConfigurationNative.js +2 -0
- package/lib/module/config/features/RumConfigurationNative.js.map +1 -0
- package/lib/module/config/features/TraceConfiguration.js +18 -0
- package/lib/module/config/features/TraceConfiguration.js.map +1 -0
- package/lib/module/config/features/TraceConfiguration.type.js +2 -0
- package/lib/module/config/features/TraceConfiguration.type.js.map +1 -0
- package/lib/module/config/features/TraceConfigurationNative.js +2 -0
- package/lib/module/config/features/TraceConfigurationNative.js.map +1 -0
- package/lib/module/config/types/BatchProcessingLevel.js +25 -0
- package/lib/module/config/types/BatchProcessingLevel.js.map +1 -0
- package/lib/module/config/types/BatchSize.js +26 -0
- package/lib/module/config/types/BatchSize.js.map +1 -0
- package/lib/module/config/types/InitializationMode.js +11 -0
- package/lib/module/config/types/InitializationMode.js.map +1 -0
- package/lib/module/config/types/InitializationModeForTelemetry.js +2 -0
- package/lib/module/config/types/InitializationModeForTelemetry.js.map +1 -0
- package/lib/module/{ProxyConfiguration.js → config/types/ProxyConfiguration.js} +6 -0
- package/lib/module/config/types/ProxyConfiguration.js.map +1 -0
- package/lib/module/config/types/SdkVerbosity.js.map +1 -0
- package/lib/module/config/types/TrackingConsent.js.map +1 -0
- package/lib/module/config/types/UploadFrequency.js +25 -0
- package/lib/module/config/types/UploadFrequency.js.map +1 -0
- package/lib/module/config/types/VitalsUpdateFrequency.js +13 -0
- package/lib/module/config/types/VitalsUpdateFrequency.js.map +1 -0
- package/lib/module/config/types/index.js +15 -0
- package/lib/module/config/types/index.js.map +1 -0
- package/lib/module/index.js +13 -7
- package/lib/module/index.js.map +1 -1
- package/lib/module/logs/DdLogs.js +13 -9
- package/lib/module/logs/DdLogs.js.map +1 -1
- package/lib/module/logs/eventMapper.js +4 -1
- package/lib/module/logs/eventMapper.js.map +1 -1
- package/lib/module/nativeModulesTypes.js +1 -43
- package/lib/module/nativeModulesTypes.js.map +1 -1
- package/lib/module/rum/DdRum.js +54 -26
- package/lib/module/rum/DdRum.js.map +1 -1
- package/lib/module/rum/helper.js +49 -0
- package/lib/module/rum/helper.js.map +1 -0
- package/lib/module/rum/instrumentation/DdRumErrorTracking.js +14 -18
- package/lib/module/rum/instrumentation/DdRumErrorTracking.js.map +1 -1
- package/lib/module/rum/instrumentation/interactionTracking/DdBabelInteractionTracking.js +15 -24
- package/lib/module/rum/instrumentation/interactionTracking/DdBabelInteractionTracking.js.map +1 -1
- package/lib/module/rum/instrumentation/interactionTracking/DdEventsInterceptor.js +1 -1
- package/lib/module/rum/instrumentation/interactionTracking/DdEventsInterceptor.js.map +1 -1
- package/lib/module/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.js +15 -5
- package/lib/module/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/DdRumResourceTracking.js +33 -21
- package/lib/module/rum/instrumentation/resourceTracking/DdRumResourceTracking.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/DatadogTracingContext.js +22 -1
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/DatadogTracingContext.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/TracingIdentifier.js +13 -2
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/TracingIdentifier.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.js +10 -11
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingAttributes.js +2 -0
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingAttributes.js.map +1 -0
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.js +27 -33
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingSampling.js +54 -0
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingSampling.js.map +1 -0
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/firstPartyHosts.js +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/firstPartyHosts.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/headers.js +30 -0
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/headers.js.map +1 -0
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/URLHostParser.js +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/URLHostParser.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.js +14 -3
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/baggageHeaderUtils.js +90 -48
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/baggageHeaderUtils.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/responseSize.js +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/responseSize.js.map +1 -1
- package/lib/module/rum/types.js +0 -9
- package/lib/module/rum/types.js.map +1 -1
- package/lib/module/sdk/AccountInfoSingleton/AccountInfoSingleton.js +39 -0
- package/lib/module/sdk/AccountInfoSingleton/AccountInfoSingleton.js.map +1 -0
- package/lib/module/sdk/AccountInfoSingleton/types.js +2 -0
- package/lib/module/sdk/AccountInfoSingleton/types.js.map +1 -0
- package/lib/module/sdk/AttributesEncoding/attributesEncoding.js +46 -0
- package/lib/module/sdk/AttributesEncoding/attributesEncoding.js.map +1 -0
- package/lib/module/sdk/AttributesEncoding/defaultEncoders.js +134 -0
- package/lib/module/sdk/AttributesEncoding/defaultEncoders.js.map +1 -0
- package/lib/module/{utils → sdk/AttributesEncoding}/errorUtils.js +37 -20
- package/lib/module/sdk/AttributesEncoding/errorUtils.js.map +1 -0
- package/lib/module/sdk/AttributesEncoding/helpers.js +115 -0
- package/lib/module/sdk/AttributesEncoding/helpers.js.map +1 -0
- package/lib/module/sdk/AttributesEncoding/types.js +2 -0
- package/lib/module/sdk/AttributesEncoding/types.js.map +1 -0
- package/lib/module/sdk/AttributesEncoding/utils.js +28 -0
- package/lib/module/sdk/AttributesEncoding/utils.js.map +1 -0
- package/lib/module/sdk/AttributesSingleton/AttributesSingleton.js +27 -1
- package/lib/module/sdk/AttributesSingleton/AttributesSingleton.js.map +1 -1
- package/lib/module/sdk/DatadogInternalBridge/DdSdkInternalNativeBridge.js +2 -2
- package/lib/module/sdk/DatadogInternalBridge/DdSdkInternalNativeBridge.js.map +1 -1
- package/lib/module/sdk/DatadogInternalBridge/DdSdkInternalNativeBridgeEvent.js +1 -1
- package/lib/module/sdk/DatadogInternalBridge/DdSdkInternalNativeBridgeEvent.js.map +1 -1
- package/lib/module/sdk/DatadogProvider/Buffer/BoundedBuffer.js +4 -4
- package/lib/module/sdk/DatadogProvider/Buffer/BoundedBuffer.js.map +1 -1
- package/lib/module/sdk/DatadogProvider/DatadogProvider.js +9 -8
- package/lib/module/sdk/DatadogProvider/DatadogProvider.js.map +1 -1
- package/lib/module/sdk/DatadogProvider/DatadogProviderState.js +21 -0
- package/lib/module/sdk/DatadogProvider/DatadogProviderState.js.map +1 -0
- package/lib/module/sdk/DdSdk.js +4 -4
- package/lib/module/sdk/DdSdk.js.map +1 -1
- package/lib/module/sdk/DdSdkInternal.js +80 -0
- package/lib/module/sdk/DdSdkInternal.js.map +1 -0
- package/lib/module/sdk/EventMappers/EventMapper.js +6 -3
- package/lib/module/sdk/EventMappers/EventMapper.js.map +1 -1
- package/lib/module/sdk/GlobalState/GlobalState.js +5 -10
- package/lib/module/sdk/GlobalState/GlobalState.js.map +1 -1
- package/lib/module/sdk/UserInfoSingleton/UserInfoSingleton.js +6 -1
- package/lib/module/sdk/UserInfoSingleton/UserInfoSingleton.js.map +1 -1
- package/lib/module/specs/NativeDdRum.js.map +1 -1
- package/lib/module/specs/NativeDdSdk.js.map +1 -1
- package/lib/module/trace/DdTrace.js +7 -6
- package/lib/module/trace/DdTrace.js.map +1 -1
- package/lib/module/types.js +22 -42
- package/lib/module/types.js.map +1 -1
- package/lib/module/utils/longTasksUtils.js.map +1 -1
- package/lib/module/utils/singletonUtils.js +14 -0
- package/lib/module/utils/singletonUtils.js.map +1 -0
- package/lib/module/version.js +1 -1
- package/lib/module/version.js.map +1 -1
- package/lib/typescript/DdAttributes.d.ts.map +1 -0
- package/lib/typescript/DdSdkReactNative.d.ts +49 -12
- package/lib/typescript/DdSdkReactNative.d.ts.map +1 -1
- package/lib/typescript/InternalLog.d.ts +1 -1
- package/lib/typescript/InternalLog.d.ts.map +1 -1
- package/lib/typescript/config/DatadogProviderConfiguration.d.ts +12 -0
- package/lib/typescript/config/DatadogProviderConfiguration.d.ts.map +1 -0
- package/lib/typescript/config/FileBasedConfiguration.d.ts +17 -0
- package/lib/typescript/config/FileBasedConfiguration.d.ts.map +1 -0
- package/lib/typescript/config/FileBasedConfiguration.type.d.ts +52 -0
- package/lib/typescript/config/FileBasedConfiguration.type.d.ts.map +1 -0
- package/lib/typescript/config/async/AutoInstrumentationConfiguration.d.ts +60 -0
- package/lib/typescript/config/async/AutoInstrumentationConfiguration.d.ts.map +1 -0
- package/lib/typescript/config/async/PartialInitializationConfiguration.d.ts +47 -0
- package/lib/typescript/config/async/PartialInitializationConfiguration.d.ts.map +1 -0
- package/lib/typescript/config/async/asyncInitializationHelper.d.ts +5 -0
- package/lib/typescript/config/async/asyncInitializationHelper.d.ts.map +1 -0
- package/lib/typescript/config/features/CoreConfiguration.d.ts +52 -0
- package/lib/typescript/config/features/CoreConfiguration.d.ts.map +1 -0
- package/lib/typescript/config/features/CoreConfiguration.type.d.ts +90 -0
- package/lib/typescript/config/features/CoreConfiguration.type.d.ts.map +1 -0
- package/lib/typescript/config/features/CoreConfigurationNative.d.ts +54 -0
- package/lib/typescript/config/features/CoreConfigurationNative.d.ts.map +1 -0
- package/lib/typescript/config/features/LogsConfiguration.d.ts +17 -0
- package/lib/typescript/config/features/LogsConfiguration.d.ts.map +1 -0
- package/lib/typescript/config/features/LogsConfiguration.type.d.ts +24 -0
- package/lib/typescript/config/features/LogsConfiguration.type.d.ts.map +1 -0
- package/lib/typescript/config/features/LogsConfigurationNative.d.ts +6 -0
- package/lib/typescript/config/features/LogsConfigurationNative.d.ts.map +1 -0
- package/lib/typescript/config/features/RumConfiguration.d.ts +66 -0
- package/lib/typescript/config/features/RumConfiguration.d.ts.map +1 -0
- package/lib/typescript/config/features/RumConfiguration.type.d.ts +131 -0
- package/lib/typescript/config/features/RumConfiguration.type.d.ts.map +1 -0
- package/lib/typescript/config/features/RumConfigurationNative.d.ts +25 -0
- package/lib/typescript/config/features/RumConfigurationNative.d.ts.map +1 -0
- package/lib/typescript/config/features/TraceConfiguration.d.ts +10 -0
- package/lib/typescript/config/features/TraceConfiguration.d.ts.map +1 -0
- package/lib/typescript/config/features/TraceConfiguration.type.d.ts +11 -0
- package/lib/typescript/config/features/TraceConfiguration.type.d.ts.map +1 -0
- package/lib/typescript/config/features/TraceConfigurationNative.d.ts +4 -0
- package/lib/typescript/config/features/TraceConfigurationNative.d.ts.map +1 -0
- package/lib/typescript/config/types/BatchProcessingLevel.d.ts +18 -0
- package/lib/typescript/config/types/BatchProcessingLevel.d.ts.map +1 -0
- package/lib/typescript/config/types/BatchSize.d.ts +19 -0
- package/lib/typescript/config/types/BatchSize.d.ts.map +1 -0
- package/lib/typescript/config/types/InitializationMode.d.ts +5 -0
- package/lib/typescript/config/types/InitializationMode.d.ts.map +1 -0
- package/lib/typescript/config/types/InitializationModeForTelemetry.d.ts +2 -0
- package/lib/typescript/config/types/InitializationModeForTelemetry.d.ts.map +1 -0
- package/lib/typescript/config/types/ProxyConfiguration.d.ts.map +1 -0
- package/lib/typescript/config/types/SdkVerbosity.d.ts.map +1 -0
- package/lib/typescript/config/types/TrackingConsent.d.ts.map +1 -0
- package/lib/typescript/config/types/UploadFrequency.d.ts +18 -0
- package/lib/typescript/config/types/UploadFrequency.d.ts.map +1 -0
- package/lib/typescript/config/types/VitalsUpdateFrequency.d.ts +7 -0
- package/lib/typescript/config/types/VitalsUpdateFrequency.d.ts.map +1 -0
- package/lib/typescript/config/types/index.d.ts +10 -0
- package/lib/typescript/config/types/index.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +20 -9
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/logs/DdLogs.d.ts +2 -1
- package/lib/typescript/logs/DdLogs.d.ts.map +1 -1
- package/lib/typescript/logs/eventMapper.d.ts +3 -2
- package/lib/typescript/logs/eventMapper.d.ts.map +1 -1
- package/lib/typescript/logs/types.d.ts +1 -16
- package/lib/typescript/logs/types.d.ts.map +1 -1
- package/lib/typescript/nativeModulesTypes.d.ts +2 -15
- package/lib/typescript/nativeModulesTypes.d.ts.map +1 -1
- package/lib/typescript/rum/DdRum.d.ts +10 -1
- package/lib/typescript/rum/DdRum.d.ts.map +1 -1
- package/lib/typescript/rum/eventMappers/errorEventMapper.d.ts +1 -1
- package/lib/typescript/rum/eventMappers/errorEventMapper.d.ts.map +1 -1
- package/lib/typescript/rum/helper.d.ts +10 -0
- package/lib/typescript/rum/helper.d.ts.map +1 -0
- package/lib/typescript/rum/instrumentation/DdRumErrorTracking.d.ts.map +1 -1
- package/lib/typescript/rum/instrumentation/interactionTracking/DdBabelInteractionTracking.d.ts +6 -6
- package/lib/typescript/rum/instrumentation/interactionTracking/DdBabelInteractionTracking.d.ts.map +1 -1
- package/lib/typescript/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.d.ts +7 -0
- package/lib/typescript/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.d.ts.map +1 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/DdRumResourceTracking.d.ts +12 -6
- package/lib/typescript/rum/instrumentation/resourceTracking/DdRumResourceTracking.d.ts.map +1 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/DatadogTracingContext.d.ts +1 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/DatadogTracingContext.d.ts.map +1 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/TracingIdentifier.d.ts +8 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/TracingIdentifier.d.ts.map +1 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.d.ts +5 -17
- package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.d.ts.map +1 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingAttributes.d.ts +20 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingAttributes.d.ts.map +1 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.d.ts +3 -24
- package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.d.ts.map +1 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingSampling.d.ts +12 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingSampling.d.ts.map +1 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/headers.d.ts +24 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/headers.d.ts.map +1 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.d.ts +2 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.d.ts.map +1 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/baggageHeaderUtils.d.ts.map +1 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/interfaces/RumResource.d.ts +1 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/interfaces/RumResource.d.ts.map +1 -1
- package/lib/typescript/rum/types.d.ts +47 -7
- package/lib/typescript/rum/types.d.ts.map +1 -1
- package/lib/typescript/sdk/AccountInfoSingleton/AccountInfoSingleton.d.ts +15 -0
- package/lib/typescript/sdk/AccountInfoSingleton/AccountInfoSingleton.d.ts.map +1 -0
- package/lib/typescript/sdk/AccountInfoSingleton/types.d.ts +6 -0
- package/lib/typescript/sdk/AccountInfoSingleton/types.d.ts.map +1 -0
- package/lib/typescript/sdk/AttributesEncoding/attributesEncoding.d.ts +13 -0
- package/lib/typescript/sdk/AttributesEncoding/attributesEncoding.d.ts.map +1 -0
- package/lib/typescript/sdk/AttributesEncoding/defaultEncoders.d.ts +33 -0
- package/lib/typescript/sdk/AttributesEncoding/defaultEncoders.d.ts.map +1 -0
- package/lib/typescript/{utils → sdk/AttributesEncoding}/errorUtils.d.ts +4 -4
- package/lib/typescript/sdk/AttributesEncoding/errorUtils.d.ts.map +1 -0
- package/lib/typescript/sdk/AttributesEncoding/helpers.d.ts +17 -0
- package/lib/typescript/sdk/AttributesEncoding/helpers.d.ts.map +1 -0
- package/lib/typescript/sdk/AttributesEncoding/types.d.ts +21 -0
- package/lib/typescript/sdk/AttributesEncoding/types.d.ts.map +1 -0
- package/lib/typescript/sdk/AttributesEncoding/utils.d.ts +7 -0
- package/lib/typescript/sdk/AttributesEncoding/utils.d.ts.map +1 -0
- package/lib/typescript/sdk/AttributesSingleton/AttributesSingleton.d.ts +5 -1
- package/lib/typescript/sdk/AttributesSingleton/AttributesSingleton.d.ts.map +1 -1
- package/lib/typescript/sdk/DatadogProvider/DatadogProvider.d.ts +4 -3
- package/lib/typescript/sdk/DatadogProvider/DatadogProvider.d.ts.map +1 -1
- package/lib/typescript/sdk/DatadogProvider/DatadogProviderState.d.ts +9 -0
- package/lib/typescript/sdk/DatadogProvider/DatadogProviderState.d.ts.map +1 -0
- package/lib/typescript/sdk/DdSdk.d.ts +2 -3
- package/lib/typescript/sdk/DdSdk.d.ts.map +1 -1
- package/lib/typescript/sdk/DdSdkInternal.d.ts +39 -0
- package/lib/typescript/sdk/DdSdkInternal.d.ts.map +1 -0
- package/lib/typescript/sdk/EventMappers/EventMapper.d.ts +3 -1
- package/lib/typescript/sdk/EventMappers/EventMapper.d.ts.map +1 -1
- package/lib/typescript/sdk/GlobalState/GlobalState.d.ts +3 -3
- package/lib/typescript/sdk/GlobalState/GlobalState.d.ts.map +1 -1
- package/lib/typescript/sdk/UserInfoSingleton/UserInfoSingleton.d.ts +2 -1
- package/lib/typescript/sdk/UserInfoSingleton/UserInfoSingleton.d.ts.map +1 -1
- package/lib/typescript/sdk/UserInfoSingleton/types.d.ts +1 -2
- package/lib/typescript/sdk/UserInfoSingleton/types.d.ts.map +1 -1
- package/lib/typescript/specs/NativeDdRum.d.ts +45 -0
- package/lib/typescript/specs/NativeDdRum.d.ts.map +1 -1
- package/lib/typescript/specs/NativeDdSdk.d.ts +34 -6
- package/lib/typescript/specs/NativeDdSdk.d.ts.map +1 -1
- package/lib/typescript/trace/DdTrace.d.ts +1 -2
- package/lib/typescript/trace/DdTrace.d.ts.map +1 -1
- package/lib/typescript/types.d.ts +74 -92
- package/lib/typescript/types.d.ts.map +1 -1
- package/lib/typescript/utils/longTasksUtils.d.ts +1 -1
- package/lib/typescript/utils/longTasksUtils.d.ts.map +1 -1
- package/lib/typescript/utils/singletonUtils.d.ts +2 -0
- package/lib/typescript/utils/singletonUtils.d.ts.map +1 -0
- package/lib/typescript/version.d.ts +1 -1
- package/lib/typescript/version.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/DdSdkReactNative.tsx +246 -104
- package/src/InternalLog.tsx +1 -1
- package/src/__tests__/DdSdkReactNative.test.tsx +415 -207
- package/src/__tests__/DdSdkReactNativeConfiguration.test.ts +237 -153
- package/src/__tests__/InternalLog.test.tsx +1 -1
- package/src/__tests__/rum/instrumentation/DdEventsInterceptor.test.tsx +2 -2
- package/src/__tests__/rum/instrumentation/DdRumErrorTracking.test.tsx +139 -216
- package/src/__tests__/rum/instrumentation/DdRumUserInteractionTracking.test.tsx +10 -7
- package/src/config/DatadogProviderConfiguration.ts +17 -0
- package/src/config/FileBasedConfiguration.ts +464 -0
- package/src/config/FileBasedConfiguration.type.ts +66 -0
- package/src/config/__tests__/FileBasedConfiguration.test.ts +334 -0
- package/src/config/__tests__/__fixtures__/configuration-all-fields.json +57 -0
- package/src/config/__tests__/__fixtures__/malformed-configuration.json +4 -0
- package/src/config/async/AutoInstrumentationConfiguration.ts +126 -0
- package/src/config/async/PartialInitializationConfiguration.ts +58 -0
- package/src/config/async/asyncInitializationHelper.tsx +51 -0
- package/src/config/features/CoreConfiguration.ts +130 -0
- package/src/config/features/CoreConfiguration.type.ts +119 -0
- package/src/config/features/CoreConfigurationNative.ts +50 -0
- package/src/config/features/LogsConfiguration.ts +38 -0
- package/src/config/features/LogsConfiguration.type.ts +33 -0
- package/src/config/features/LogsConfigurationNative.ts +10 -0
- package/src/config/features/RumConfiguration.ts +137 -0
- package/src/config/features/RumConfiguration.type.ts +164 -0
- package/src/config/features/RumConfigurationNative.ts +26 -0
- package/src/config/features/TraceConfiguration.ts +24 -0
- package/src/config/features/TraceConfiguration.type.ts +17 -0
- package/src/config/features/TraceConfigurationNative.ts +8 -0
- package/src/config/types/BatchProcessingLevel.ts +23 -0
- package/src/config/types/BatchSize.ts +24 -0
- package/src/config/types/InitializationMode.ts +9 -0
- package/src/config/types/InitializationModeForTelemetry.ts +11 -0
- package/src/{ProxyConfiguration.tsx → config/types/ProxyConfiguration.ts} +6 -0
- package/src/config/types/UploadFrequency.tsx +23 -0
- package/src/config/types/VitalsUpdateFrequency.ts +11 -0
- package/src/config/types/index.ts +15 -0
- package/src/index.tsx +33 -16
- package/src/logs/DdLogs.ts +14 -13
- package/src/logs/__tests__/DdLogs.test.ts +60 -107
- package/src/logs/__tests__/eventMapper.test.ts +1 -1
- package/src/logs/eventMapper.ts +5 -4
- package/src/logs/types.ts +1 -20
- package/src/nativeModulesTypes.ts +2 -17
- package/src/rum/DdRum.ts +139 -42
- package/src/rum/__tests__/DdRum.test.ts +217 -47
- package/src/rum/eventMappers/errorEventMapper.ts +1 -1
- package/src/rum/helper.ts +62 -0
- package/src/rum/instrumentation/DdRumErrorTracking.tsx +20 -38
- package/src/rum/instrumentation/interactionTracking/DdBabelInteractionTracking.ts +20 -32
- package/src/rum/instrumentation/interactionTracking/DdEventsInterceptor.tsx +1 -1
- package/src/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.tsx +18 -5
- package/src/rum/instrumentation/resourceTracking/DdRumResourceTracking.tsx +44 -23
- package/src/rum/instrumentation/resourceTracking/__tests__/DdRumResourceTracking.test.ts +2 -2
- package/src/rum/instrumentation/resourceTracking/__tests__/__utils__/XMLHttpRequestMock.ts +44 -23
- package/src/rum/instrumentation/resourceTracking/distributedTracing/DatadogTracingContext.ts +24 -1
- package/src/rum/instrumentation/resourceTracking/distributedTracing/TracingIdentifier.tsx +17 -2
- package/src/rum/instrumentation/resourceTracking/distributedTracing/__tests__/distributedTracing.test.ts +327 -1
- package/src/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.tsx +22 -31
- package/src/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingAttributes.ts +29 -0
- package/src/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.ts +54 -35
- package/src/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingSampling.ts +80 -0
- package/src/rum/instrumentation/resourceTracking/distributedTracing/firstPartyHosts.ts +1 -1
- package/src/rum/instrumentation/resourceTracking/distributedTracing/headers.ts +29 -0
- package/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/URLHostParser.ts +1 -1
- package/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.ts +19 -7
- package/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/__tests__/XHRProxy.test.ts +177 -119
- package/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/__tests__/baggageHeaderUtils.test.ts +85 -13
- package/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/baggageHeaderUtils.ts +110 -52
- package/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/responseSize.ts +1 -1
- package/src/rum/instrumentation/resourceTracking/requestProxy/interfaces/RumResource.ts +1 -1
- package/src/rum/types.ts +68 -8
- package/src/sdk/AccountInfoSingleton/AccountInfoSingleton.ts +49 -0
- package/src/sdk/AccountInfoSingleton/__tests__/AccountInfoSingleton.test.ts +90 -0
- package/src/sdk/AccountInfoSingleton/types.ts +11 -0
- package/src/sdk/AttributesEncoding/__tests__/attributesEncoding.test.ts +518 -0
- package/src/sdk/AttributesEncoding/__tests__/defaultEncoders.test.ts +198 -0
- package/src/sdk/AttributesEncoding/attributesEncoding.ts +56 -0
- package/src/sdk/AttributesEncoding/defaultEncoders.ts +175 -0
- package/src/{utils → sdk/AttributesEncoding}/errorUtils.ts +50 -22
- package/src/sdk/AttributesEncoding/helpers.ts +176 -0
- package/src/sdk/AttributesEncoding/types.ts +33 -0
- package/src/sdk/AttributesEncoding/utils.ts +31 -0
- package/src/sdk/AttributesSingleton/AttributesSingleton.ts +25 -1
- package/src/sdk/AttributesSingleton/__tests__/AttributesSingleton.test.ts +52 -8
- package/src/sdk/DatadogInternalBridge/DdSdkInternalNativeBridge.tsx +2 -2
- package/src/sdk/DatadogInternalBridge/DdSdkInternalNativeBridgeEvent.tsx +1 -1
- package/src/sdk/DatadogInternalBridge/__tests__/DdSdkNativeBridge.test.tsx +1 -1
- package/src/sdk/DatadogProvider/Buffer/BoundedBuffer.ts +4 -4
- package/src/sdk/DatadogProvider/Buffer/__tests__/BoundedBuffer.test.ts +5 -5
- package/src/sdk/DatadogProvider/DatadogProvider.tsx +12 -16
- package/src/sdk/DatadogProvider/DatadogProviderState.ts +30 -0
- package/src/sdk/DatadogProvider/__tests__/__utils__/renderWithProvider.tsx +18 -7
- package/src/sdk/DatadogProvider/__tests__/initialization.test.tsx +59 -33
- package/src/sdk/DatadogProvider/__tests__/initializationModes.test.tsx +26 -10
- package/src/sdk/DdSdk.ts +8 -5
- package/src/sdk/DdSdkInternal.ts +121 -0
- package/src/sdk/EventMappers/EventMapper.ts +9 -4
- package/src/sdk/EventMappers/__tests__/EventMapper.test.ts +3 -3
- package/src/sdk/GlobalState/GlobalState.tsx +10 -11
- package/src/sdk/UserInfoSingleton/UserInfoSingleton.ts +9 -2
- package/src/sdk/UserInfoSingleton/__tests__/UserInfoSingleton.test.ts +46 -9
- package/src/sdk/UserInfoSingleton/types.ts +1 -4
- package/src/specs/NativeDdRum.ts +65 -0
- package/src/specs/NativeDdSdk.ts +40 -6
- package/src/trace/DdTrace.ts +11 -7
- package/src/trace/__tests__/DdTrace.test.ts +7 -8
- package/src/types.tsx +97 -76
- package/src/utils/__tests__/errorUtils.test.ts +1 -1
- package/src/utils/__tests__/singletonUtils.test.ts +75 -0
- package/src/utils/longTasksUtils.ts +1 -3
- package/src/utils/singletonUtils.ts +17 -0
- package/src/version.ts +1 -1
- package/lib/commonjs/DdSdkReactNativeConfiguration.js +0 -412
- package/lib/commonjs/DdSdkReactNativeConfiguration.js.map +0 -1
- package/lib/commonjs/ProxyConfiguration.js.map +0 -1
- package/lib/commonjs/SdkVerbosity.js.map +0 -1
- package/lib/commonjs/TrackingConsent.js.map +0 -1
- package/lib/commonjs/rum/DdAttributes.js.map +0 -1
- package/lib/commonjs/sdk/FileBasedConfiguration/FileBasedConfiguration.js +0 -185
- package/lib/commonjs/sdk/FileBasedConfiguration/FileBasedConfiguration.js.map +0 -1
- package/lib/commonjs/utils/argsUtils.js +0 -41
- package/lib/commonjs/utils/argsUtils.js.map +0 -1
- package/lib/commonjs/utils/errorUtils.js.map +0 -1
- package/lib/module/DdSdkReactNativeConfiguration.js +0 -403
- package/lib/module/DdSdkReactNativeConfiguration.js.map +0 -1
- package/lib/module/ProxyConfiguration.js.map +0 -1
- package/lib/module/SdkVerbosity.js.map +0 -1
- package/lib/module/TrackingConsent.js.map +0 -1
- package/lib/module/rum/DdAttributes.js.map +0 -1
- package/lib/module/sdk/FileBasedConfiguration/FileBasedConfiguration.js +0 -176
- package/lib/module/sdk/FileBasedConfiguration/FileBasedConfiguration.js.map +0 -1
- package/lib/module/utils/argsUtils.js +0 -35
- package/lib/module/utils/argsUtils.js.map +0 -1
- package/lib/module/utils/errorUtils.js.map +0 -1
- package/lib/typescript/DdSdkReactNativeConfiguration.d.ts +0 -376
- package/lib/typescript/DdSdkReactNativeConfiguration.d.ts.map +0 -1
- package/lib/typescript/ProxyConfiguration.d.ts.map +0 -1
- package/lib/typescript/SdkVerbosity.d.ts.map +0 -1
- package/lib/typescript/TrackingConsent.d.ts.map +0 -1
- package/lib/typescript/rum/DdAttributes.d.ts.map +0 -1
- package/lib/typescript/sdk/FileBasedConfiguration/FileBasedConfiguration.d.ts +0 -34
- package/lib/typescript/sdk/FileBasedConfiguration/FileBasedConfiguration.d.ts.map +0 -1
- package/lib/typescript/utils/argsUtils.d.ts +0 -8
- package/lib/typescript/utils/argsUtils.d.ts.map +0 -1
- package/lib/typescript/utils/errorUtils.d.ts.map +0 -1
- package/src/DdSdkReactNativeConfiguration.tsx +0 -582
- package/src/sdk/FileBasedConfiguration/FileBasedConfiguration.ts +0 -241
- package/src/sdk/FileBasedConfiguration/__tests__/FileBasedConfiguration.test.ts +0 -255
- package/src/sdk/FileBasedConfiguration/__tests__/__fixtures__/configuration-all-fields.json +0 -27
- package/src/sdk/FileBasedConfiguration/__tests__/__fixtures__/malformed-configuration.json +0 -5
- package/src/utils/__tests__/argsUtils.test.ts +0 -66
- package/src/utils/argsUtils.ts +0 -41
- /package/lib/commonjs/{rum/DdAttributes.js → DdAttributes.js} +0 -0
- /package/lib/commonjs/{SdkVerbosity.js → config/types/SdkVerbosity.js} +0 -0
- /package/lib/commonjs/{TrackingConsent.js → config/types/TrackingConsent.js} +0 -0
- /package/lib/module/{rum/DdAttributes.js → DdAttributes.js} +0 -0
- /package/lib/module/{SdkVerbosity.js → config/types/SdkVerbosity.js} +0 -0
- /package/lib/module/{TrackingConsent.js → config/types/TrackingConsent.js} +0 -0
- /package/lib/typescript/{rum/DdAttributes.d.ts → DdAttributes.d.ts} +0 -0
- /package/lib/typescript/{ProxyConfiguration.d.ts → config/types/ProxyConfiguration.d.ts} +0 -0
- /package/lib/typescript/{SdkVerbosity.d.ts → config/types/SdkVerbosity.d.ts} +0 -0
- /package/lib/typescript/{TrackingConsent.d.ts → config/types/TrackingConsent.d.ts} +0 -0
- /package/src/{rum/DdAttributes.ts → DdAttributes.ts} +0 -0
- /package/src/{SdkVerbosity.tsx → config/types/SdkVerbosity.ts} +0 -0
- /package/src/{TrackingConsent.tsx → config/types/TrackingConsent.ts} +0 -0
|
@@ -16,8 +16,10 @@ import com.datadog.android.core.configuration.BatchSize
|
|
|
16
16
|
import com.datadog.android.core.configuration.Configuration
|
|
17
17
|
import com.datadog.android.core.configuration.UploadFrequency
|
|
18
18
|
import com.datadog.android.event.EventMapper
|
|
19
|
+
import com.datadog.android.log.Logs
|
|
19
20
|
import com.datadog.android.log.LogsConfiguration
|
|
20
21
|
import com.datadog.android.privacy.TrackingConsent
|
|
22
|
+
import com.datadog.android.rum.Rum
|
|
21
23
|
import com.datadog.android.rum.RumConfiguration
|
|
22
24
|
import com.datadog.android.rum.RumPerformanceMetric
|
|
23
25
|
import com.datadog.android.rum._RumInternalProxy
|
|
@@ -27,6 +29,7 @@ import com.datadog.android.rum.model.ActionEvent
|
|
|
27
29
|
import com.datadog.android.rum.model.ResourceEvent
|
|
28
30
|
import com.datadog.android.rum.tracking.ActivityViewTrackingStrategy
|
|
29
31
|
import com.datadog.android.telemetry.model.TelemetryConfigurationEvent
|
|
32
|
+
import com.datadog.android.trace.Trace
|
|
30
33
|
import com.datadog.android.trace.TraceConfiguration
|
|
31
34
|
import com.datadog.android.trace.TracingHeaderType
|
|
32
35
|
import com.datadog.tools.unit.GenericAssert.Companion.assertThat
|
|
@@ -37,6 +40,7 @@ import com.datadog.tools.unit.setStaticValue
|
|
|
37
40
|
import com.datadog.tools.unit.toReadableArray
|
|
38
41
|
import com.datadog.tools.unit.toReadableJavaOnlyMap
|
|
39
42
|
import com.datadog.tools.unit.toReadableMap
|
|
43
|
+
import com.facebook.react.bridge.JavaOnlyMap
|
|
40
44
|
import com.facebook.react.bridge.Promise
|
|
41
45
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
42
46
|
import com.facebook.react.bridge.ReadableMap
|
|
@@ -56,6 +60,7 @@ import java.util.Locale
|
|
|
56
60
|
import java.util.stream.Stream
|
|
57
61
|
import kotlin.time.Duration.Companion.seconds
|
|
58
62
|
import org.assertj.core.api.Assertions.assertThat
|
|
63
|
+
import org.assertj.core.data.Offset
|
|
59
64
|
import org.junit.jupiter.api.AfterEach
|
|
60
65
|
import org.junit.jupiter.api.BeforeEach
|
|
61
66
|
import org.junit.jupiter.api.Test
|
|
@@ -75,7 +80,6 @@ import org.mockito.kotlin.doReturn
|
|
|
75
80
|
import org.mockito.kotlin.doThrow
|
|
76
81
|
import org.mockito.kotlin.eq
|
|
77
82
|
import org.mockito.kotlin.inOrder
|
|
78
|
-
import org.mockito.kotlin.isNotNull
|
|
79
83
|
import org.mockito.kotlin.isNull
|
|
80
84
|
import org.mockito.kotlin.mock
|
|
81
85
|
import org.mockito.kotlin.never
|
|
@@ -120,6 +124,9 @@ internal class DdSdkTest {
|
|
|
120
124
|
@Mock
|
|
121
125
|
lateinit var mockDatadog: DatadogWrapper
|
|
122
126
|
|
|
127
|
+
@Mock
|
|
128
|
+
lateinit var mockDdTelemetry: DdTelemetry
|
|
129
|
+
|
|
123
130
|
@Forgery
|
|
124
131
|
lateinit var fakeConfiguration: DdSdkConfiguration
|
|
125
132
|
|
|
@@ -157,9 +164,13 @@ internal class DdSdkTest {
|
|
|
157
164
|
answer.getArgument<Runnable>(0).run()
|
|
158
165
|
true
|
|
159
166
|
}
|
|
160
|
-
testedBridgeSdk = DdSdkImplementation(
|
|
167
|
+
testedBridgeSdk = DdSdkImplementation(
|
|
168
|
+
mockReactContext,
|
|
169
|
+
mockDatadog,
|
|
170
|
+
mockDdTelemetry,
|
|
171
|
+
TestUiThreadExecutor()
|
|
172
|
+
)
|
|
161
173
|
|
|
162
|
-
DatadogSDKWrapperStorage.setSdkCore(null)
|
|
163
174
|
DatadogSDKWrapperStorage.onInitializedListeners.clear()
|
|
164
175
|
}
|
|
165
176
|
|
|
@@ -173,121 +184,173 @@ internal class DdSdkTest {
|
|
|
173
184
|
@Test
|
|
174
185
|
fun `𝕄 initialize native SDK 𝕎 initialize() {nativeCrashReportEnabled=true}`() {
|
|
175
186
|
// Given
|
|
176
|
-
val
|
|
187
|
+
val rumConfiguration = fakeConfiguration.rumConfiguration?.copy(
|
|
188
|
+
nativeCrashReportEnabled = true
|
|
189
|
+
)
|
|
190
|
+
val bridgeConfiguration = fakeConfiguration.copy(rumConfiguration = rumConfiguration)
|
|
177
191
|
val sdkConfigCaptor = argumentCaptor<Configuration>()
|
|
178
192
|
val rumConfigCaptor = argumentCaptor<RumConfiguration>()
|
|
179
193
|
val logsConfigCaptor = argumentCaptor<LogsConfiguration>()
|
|
180
194
|
val traceConfigCaptor = argumentCaptor<TraceConfiguration>()
|
|
181
195
|
|
|
182
|
-
|
|
183
|
-
|
|
196
|
+
val rumMock = org.mockito.Mockito.mockStatic(Rum::class.java)
|
|
197
|
+
val traceMock = org.mockito.Mockito.mockStatic(Trace::class.java)
|
|
198
|
+
val logsMock = org.mockito.Mockito.mockStatic(Logs::class.java)
|
|
184
199
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
)
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
+
try {
|
|
201
|
+
rumMock.`when`<Unit> { Rum.enable(any(), any()) }.then { }
|
|
202
|
+
logsMock.`when`<Unit> { Logs.enable(any(), any()) }.then { }
|
|
203
|
+
traceMock.`when`<Unit> { Trace.enable(any(), any()) }.then { }
|
|
204
|
+
|
|
205
|
+
// When
|
|
206
|
+
testedBridgeSdk.initialize(bridgeConfiguration.toReadableJavaOnlyMap(), mockPromise)
|
|
207
|
+
|
|
208
|
+
// Then
|
|
209
|
+
inOrder(mockDatadog) {
|
|
210
|
+
verify(mockDatadog).initialize(
|
|
211
|
+
same(mockContext),
|
|
212
|
+
sdkConfigCaptor.capture(),
|
|
213
|
+
any()
|
|
214
|
+
)
|
|
215
|
+
rumMock.verify { Rum.enable(rumConfigCaptor.capture(), any()) }
|
|
216
|
+
traceMock.verify { Trace.enable(traceConfigCaptor.capture(), any()) }
|
|
217
|
+
logsMock.verify { Logs.enable(logsConfigCaptor.capture(), any()) }
|
|
200
218
|
}
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
"
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
219
|
+
assertThat(sdkConfigCaptor.firstValue)
|
|
220
|
+
.hasField("coreConfig") {
|
|
221
|
+
it.hasFieldEqualTo("needsClearTextHttp", false)
|
|
222
|
+
it.hasFieldEqualTo("firstPartyHostsWithHeaderTypes", emptyMap<String, String>())
|
|
223
|
+
}
|
|
224
|
+
.hasFieldEqualTo("clientToken", fakeConfiguration.clientToken)
|
|
225
|
+
.hasFieldEqualTo("env", fakeConfiguration.env)
|
|
226
|
+
.hasFieldEqualTo("variant", "")
|
|
227
|
+
.hasFieldEqualTo("crashReportsEnabled", true)
|
|
228
|
+
.hasFieldEqualTo(
|
|
229
|
+
"additionalConfig",
|
|
230
|
+
fakeConfiguration.additionalConfiguration?.filterValues { it != null }.orEmpty()
|
|
231
|
+
)
|
|
232
|
+
assertThat(rumConfigCaptor.firstValue)
|
|
233
|
+
.hasFieldEqualTo("applicationId", fakeConfiguration.rumConfiguration?.applicationId)
|
|
234
|
+
} finally {
|
|
235
|
+
rumMock.close()
|
|
236
|
+
logsMock.close()
|
|
237
|
+
traceMock.close()
|
|
238
|
+
}
|
|
211
239
|
}
|
|
212
240
|
|
|
213
241
|
@Test
|
|
214
242
|
fun `𝕄 initialize native SDK 𝕎 initialize() {nativeCrashReportEnabled=false}`() {
|
|
215
243
|
// Given
|
|
216
|
-
|
|
244
|
+
val rumConfiguration = fakeConfiguration.rumConfiguration?.copy(
|
|
245
|
+
nativeCrashReportEnabled = false
|
|
246
|
+
)
|
|
247
|
+
fakeConfiguration = fakeConfiguration.copy(site = null, rumConfiguration = rumConfiguration)
|
|
217
248
|
val sdkConfigCaptor = argumentCaptor<Configuration>()
|
|
218
249
|
val rumConfigCaptor = argumentCaptor<RumConfiguration>()
|
|
219
250
|
val logsConfigCaptor = argumentCaptor<LogsConfiguration>()
|
|
220
251
|
val traceConfigCaptor = argumentCaptor<TraceConfiguration>()
|
|
221
252
|
|
|
222
|
-
|
|
223
|
-
|
|
253
|
+
val rumMock = org.mockito.Mockito.mockStatic(Rum::class.java)
|
|
254
|
+
val traceMock = org.mockito.Mockito.mockStatic(Trace::class.java)
|
|
255
|
+
val logsMock = org.mockito.Mockito.mockStatic(Logs::class.java)
|
|
224
256
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
)
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
257
|
+
try {
|
|
258
|
+
rumMock.`when`<Unit> { Rum.enable(any(), any()) }.then { }
|
|
259
|
+
logsMock.`when`<Unit> { Logs.enable(any(), any()) }.then { }
|
|
260
|
+
traceMock.`when`<Unit> { Trace.enable(any(), any()) }.then { }
|
|
261
|
+
|
|
262
|
+
// When
|
|
263
|
+
testedBridgeSdk.initialize(fakeConfiguration.toReadableJavaOnlyMap(), mockPromise)
|
|
264
|
+
|
|
265
|
+
// Then
|
|
266
|
+
inOrder(mockDatadog) {
|
|
267
|
+
verify(mockDatadog).initialize(
|
|
268
|
+
same(mockContext),
|
|
269
|
+
sdkConfigCaptor.capture(),
|
|
270
|
+
any()
|
|
271
|
+
)
|
|
272
|
+
rumMock.verify { Rum.enable(rumConfigCaptor.capture(), any()) }
|
|
273
|
+
traceMock.verify { Trace.enable(traceConfigCaptor.capture(), any()) }
|
|
274
|
+
logsMock.verify { Logs.enable(logsConfigCaptor.capture(), any()) }
|
|
240
275
|
}
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
"
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
276
|
+
assertThat(sdkConfigCaptor.firstValue)
|
|
277
|
+
.hasField("coreConfig") {
|
|
278
|
+
it.hasFieldEqualTo("needsClearTextHttp", false)
|
|
279
|
+
it.hasFieldEqualTo("firstPartyHostsWithHeaderTypes", emptyMap<String, String>())
|
|
280
|
+
}
|
|
281
|
+
.hasFieldEqualTo("clientToken", fakeConfiguration.clientToken)
|
|
282
|
+
.hasFieldEqualTo("env", fakeConfiguration.env)
|
|
283
|
+
.hasFieldEqualTo("variant", "")
|
|
284
|
+
.hasFieldEqualTo("crashReportsEnabled", false)
|
|
285
|
+
.hasFieldEqualTo(
|
|
286
|
+
"additionalConfig",
|
|
287
|
+
fakeConfiguration.additionalConfiguration?.filterValues { it != null }.orEmpty()
|
|
288
|
+
)
|
|
289
|
+
assertThat(rumConfigCaptor.firstValue)
|
|
290
|
+
.hasFieldEqualTo("applicationId", fakeConfiguration.rumConfiguration?.applicationId)
|
|
291
|
+
} finally {
|
|
292
|
+
rumMock.close()
|
|
293
|
+
logsMock.close()
|
|
294
|
+
traceMock.close()
|
|
295
|
+
}
|
|
251
296
|
}
|
|
252
297
|
|
|
253
298
|
@Test
|
|
254
299
|
fun `𝕄 initialize native SDK 𝕎 initialize() {nativeCrashReportEnabled=null}`() {
|
|
255
300
|
// Given
|
|
256
|
-
|
|
301
|
+
val rumConfiguration = fakeConfiguration.rumConfiguration?.copy(
|
|
302
|
+
nativeCrashReportEnabled = false
|
|
303
|
+
)
|
|
304
|
+
fakeConfiguration = fakeConfiguration.copy(site = null, rumConfiguration = rumConfiguration)
|
|
305
|
+
|
|
257
306
|
val sdkConfigCaptor = argumentCaptor<Configuration>()
|
|
258
307
|
val rumConfigCaptor = argumentCaptor<RumConfiguration>()
|
|
259
308
|
val logsConfigCaptor = argumentCaptor<LogsConfiguration>()
|
|
260
309
|
val traceConfigCaptor = argumentCaptor<TraceConfiguration>()
|
|
261
310
|
|
|
262
|
-
|
|
263
|
-
|
|
311
|
+
val rumMock = org.mockito.Mockito.mockStatic(Rum::class.java)
|
|
312
|
+
val traceMock = org.mockito.Mockito.mockStatic(Trace::class.java)
|
|
313
|
+
val logsMock = org.mockito.Mockito.mockStatic(Logs::class.java)
|
|
264
314
|
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
)
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
315
|
+
try {
|
|
316
|
+
rumMock.`when`<Unit> { Rum.enable(any(), any()) }.then { }
|
|
317
|
+
logsMock.`when`<Unit> { Logs.enable(any(), any()) }.then { }
|
|
318
|
+
traceMock.`when`<Unit> { Trace.enable(any(), any()) }.then { }
|
|
319
|
+
|
|
320
|
+
// When
|
|
321
|
+
testedBridgeSdk.initialize(fakeConfiguration.toReadableJavaOnlyMap(), mockPromise)
|
|
322
|
+
|
|
323
|
+
// Then
|
|
324
|
+
inOrder(mockDatadog) {
|
|
325
|
+
verify(mockDatadog).initialize(
|
|
326
|
+
same(mockContext),
|
|
327
|
+
sdkConfigCaptor.capture(),
|
|
328
|
+
any()
|
|
329
|
+
)
|
|
330
|
+
rumMock.verify { Rum.enable(rumConfigCaptor.capture(), any()) }
|
|
331
|
+
traceMock.verify { Trace.enable(traceConfigCaptor.capture(), any()) }
|
|
332
|
+
logsMock.verify { Logs.enable(logsConfigCaptor.capture(), any()) }
|
|
280
333
|
}
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
"
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
334
|
+
assertThat(sdkConfigCaptor.firstValue)
|
|
335
|
+
.hasField("coreConfig") {
|
|
336
|
+
it.hasFieldEqualTo("needsClearTextHttp", false)
|
|
337
|
+
it.hasFieldEqualTo("firstPartyHostsWithHeaderTypes", emptyMap<String, String>())
|
|
338
|
+
}
|
|
339
|
+
.hasFieldEqualTo("clientToken", fakeConfiguration.clientToken)
|
|
340
|
+
.hasFieldEqualTo("env", fakeConfiguration.env)
|
|
341
|
+
.hasFieldEqualTo("variant", "")
|
|
342
|
+
.hasFieldEqualTo("crashReportsEnabled", false)
|
|
343
|
+
.hasFieldEqualTo(
|
|
344
|
+
"additionalConfig",
|
|
345
|
+
fakeConfiguration.additionalConfiguration?.filterValues { it != null }.orEmpty()
|
|
346
|
+
)
|
|
347
|
+
assertThat(rumConfigCaptor.firstValue)
|
|
348
|
+
.hasFieldEqualTo("applicationId", fakeConfiguration.rumConfiguration?.applicationId)
|
|
349
|
+
} finally {
|
|
350
|
+
rumMock.close()
|
|
351
|
+
logsMock.close()
|
|
352
|
+
traceMock.close()
|
|
353
|
+
}
|
|
291
354
|
}
|
|
292
355
|
|
|
293
356
|
// endregion
|
|
@@ -301,39 +364,52 @@ internal class DdSdkTest {
|
|
|
301
364
|
val rumConfigCaptor = argumentCaptor<RumConfiguration>()
|
|
302
365
|
val logsConfigCaptor = argumentCaptor<LogsConfiguration>()
|
|
303
366
|
val traceConfigCaptor = argumentCaptor<TraceConfiguration>()
|
|
304
|
-
val expectedRumSampleRate = fakeConfiguration.
|
|
367
|
+
val expectedRumSampleRate = fakeConfiguration.rumConfiguration?.sessionSampleRate?.toFloat() ?: 100f // ktlint-disable-line max-line-length
|
|
305
368
|
|
|
306
|
-
|
|
307
|
-
|
|
369
|
+
val rumMock = org.mockito.Mockito.mockStatic(Rum::class.java)
|
|
370
|
+
val traceMock = org.mockito.Mockito.mockStatic(Trace::class.java)
|
|
371
|
+
val logsMock = org.mockito.Mockito.mockStatic(Logs::class.java)
|
|
308
372
|
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
.hasFieldEqualTo("env", fakeConfiguration.env)
|
|
327
|
-
.hasFieldEqualTo("variant", "")
|
|
328
|
-
.hasFieldEqualTo(
|
|
329
|
-
"additionalConfig",
|
|
330
|
-
fakeConfiguration.additionalConfig?.filterValues { it != null }.orEmpty()
|
|
331
|
-
)
|
|
332
|
-
assertThat(rumConfigCaptor.firstValue)
|
|
333
|
-
.hasFieldEqualTo("applicationId", fakeConfiguration.applicationId)
|
|
334
|
-
.hasField("featureConfiguration") {
|
|
335
|
-
it.hasFieldEqualTo("sampleRate", expectedRumSampleRate)
|
|
373
|
+
try {
|
|
374
|
+
rumMock.`when`<Unit> { Rum.enable(any(), any()) }.then { }
|
|
375
|
+
logsMock.`when`<Unit> { Logs.enable(any(), any()) }.then { }
|
|
376
|
+
traceMock.`when`<Unit> { Trace.enable(any(), any()) }.then { }
|
|
377
|
+
// When
|
|
378
|
+
testedBridgeSdk.initialize(fakeConfiguration.toReadableJavaOnlyMap(), mockPromise)
|
|
379
|
+
|
|
380
|
+
// Then
|
|
381
|
+
inOrder(mockDatadog) {
|
|
382
|
+
verify(mockDatadog).initialize(
|
|
383
|
+
same(mockContext),
|
|
384
|
+
sdkConfigCaptor.capture(),
|
|
385
|
+
any()
|
|
386
|
+
)
|
|
387
|
+
rumMock.verify { Rum.enable(rumConfigCaptor.capture(), any()) }
|
|
388
|
+
traceMock.verify { Trace.enable(traceConfigCaptor.capture(), any()) }
|
|
389
|
+
logsMock.verify { Logs.enable(logsConfigCaptor.capture(), any()) }
|
|
336
390
|
}
|
|
391
|
+
assertThat(sdkConfigCaptor.firstValue)
|
|
392
|
+
.hasField("coreConfig") {
|
|
393
|
+
it.hasFieldEqualTo("needsClearTextHttp", false)
|
|
394
|
+
it.hasFieldEqualTo("firstPartyHostsWithHeaderTypes", emptyMap<String, String>())
|
|
395
|
+
}
|
|
396
|
+
.hasFieldEqualTo("clientToken", fakeConfiguration.clientToken)
|
|
397
|
+
.hasFieldEqualTo("env", fakeConfiguration.env)
|
|
398
|
+
.hasFieldEqualTo("variant", "")
|
|
399
|
+
.hasFieldEqualTo(
|
|
400
|
+
"additionalConfig",
|
|
401
|
+
fakeConfiguration.additionalConfiguration?.filterValues { it != null }.orEmpty()
|
|
402
|
+
)
|
|
403
|
+
assertThat(rumConfigCaptor.firstValue)
|
|
404
|
+
.hasFieldEqualTo("applicationId", fakeConfiguration.rumConfiguration?.applicationId)
|
|
405
|
+
.hasField("featureConfiguration") {
|
|
406
|
+
it.hasFieldEqualTo("sampleRate", expectedRumSampleRate)
|
|
407
|
+
}
|
|
408
|
+
} finally {
|
|
409
|
+
rumMock.close()
|
|
410
|
+
logsMock.close()
|
|
411
|
+
traceMock.close()
|
|
412
|
+
}
|
|
337
413
|
}
|
|
338
414
|
|
|
339
415
|
// endregion
|
|
@@ -347,39 +423,52 @@ internal class DdSdkTest {
|
|
|
347
423
|
val rumConfigCaptor = argumentCaptor<RumConfiguration>()
|
|
348
424
|
val logsConfigCaptor = argumentCaptor<LogsConfiguration>()
|
|
349
425
|
val traceConfigCaptor = argumentCaptor<TraceConfiguration>()
|
|
350
|
-
val expectedTelemetrySampleRate = fakeConfiguration.telemetrySampleRate?.toFloat() ?: 20f
|
|
426
|
+
val expectedTelemetrySampleRate = fakeConfiguration.rumConfiguration?.telemetrySampleRate?.toFloat() ?: 20f // ktlint-disable-line max-line-length
|
|
351
427
|
|
|
352
|
-
|
|
353
|
-
|
|
428
|
+
val rumMock = org.mockito.Mockito.mockStatic(Rum::class.java)
|
|
429
|
+
val traceMock = org.mockito.Mockito.mockStatic(Trace::class.java)
|
|
430
|
+
val logsMock = org.mockito.Mockito.mockStatic(Logs::class.java)
|
|
354
431
|
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
.hasFieldEqualTo("env", fakeConfiguration.env)
|
|
373
|
-
.hasFieldEqualTo("variant", "")
|
|
374
|
-
.hasFieldEqualTo(
|
|
375
|
-
"additionalConfig",
|
|
376
|
-
fakeConfiguration.additionalConfig?.filterValues { it != null }.orEmpty()
|
|
377
|
-
)
|
|
378
|
-
assertThat(rumConfigCaptor.firstValue)
|
|
379
|
-
.hasFieldEqualTo("applicationId", fakeConfiguration.applicationId)
|
|
380
|
-
.hasField("featureConfiguration") {
|
|
381
|
-
it.hasFieldEqualTo("telemetrySampleRate", expectedTelemetrySampleRate)
|
|
432
|
+
try {
|
|
433
|
+
rumMock.`when`<Unit> { Rum.enable(any(), any()) }.then { }
|
|
434
|
+
logsMock.`when`<Unit> { Logs.enable(any(), any()) }.then { }
|
|
435
|
+
traceMock.`when`<Unit> { Trace.enable(any(), any()) }.then { }
|
|
436
|
+
// When
|
|
437
|
+
testedBridgeSdk.initialize(fakeConfiguration.toReadableJavaOnlyMap(), mockPromise)
|
|
438
|
+
|
|
439
|
+
// Then
|
|
440
|
+
inOrder(mockDatadog) {
|
|
441
|
+
verify(mockDatadog).initialize(
|
|
442
|
+
same(mockContext),
|
|
443
|
+
sdkConfigCaptor.capture(),
|
|
444
|
+
any()
|
|
445
|
+
)
|
|
446
|
+
rumMock.verify { Rum.enable(rumConfigCaptor.capture(), any()) }
|
|
447
|
+
traceMock.verify { Trace.enable(traceConfigCaptor.capture(), any()) }
|
|
448
|
+
logsMock.verify { Logs.enable(logsConfigCaptor.capture(), any()) }
|
|
382
449
|
}
|
|
450
|
+
assertThat(sdkConfigCaptor.firstValue)
|
|
451
|
+
.hasField("coreConfig") {
|
|
452
|
+
it.hasFieldEqualTo("needsClearTextHttp", false)
|
|
453
|
+
it.hasFieldEqualTo("firstPartyHostsWithHeaderTypes", emptyMap<String, String>())
|
|
454
|
+
}
|
|
455
|
+
.hasFieldEqualTo("clientToken", fakeConfiguration.clientToken)
|
|
456
|
+
.hasFieldEqualTo("env", fakeConfiguration.env)
|
|
457
|
+
.hasFieldEqualTo("variant", "")
|
|
458
|
+
.hasFieldEqualTo(
|
|
459
|
+
"additionalConfig",
|
|
460
|
+
fakeConfiguration.additionalConfiguration?.filterValues { it != null }.orEmpty()
|
|
461
|
+
)
|
|
462
|
+
assertThat(rumConfigCaptor.firstValue)
|
|
463
|
+
.hasFieldEqualTo("applicationId", fakeConfiguration.rumConfiguration?.applicationId)
|
|
464
|
+
.hasField("featureConfiguration") {
|
|
465
|
+
it.hasFieldEqualTo("telemetrySampleRate", expectedTelemetrySampleRate)
|
|
466
|
+
}
|
|
467
|
+
} finally {
|
|
468
|
+
rumMock.close()
|
|
469
|
+
logsMock.close()
|
|
470
|
+
traceMock.close()
|
|
471
|
+
}
|
|
383
472
|
}
|
|
384
473
|
|
|
385
474
|
// endregion
|
|
@@ -389,37 +478,50 @@ internal class DdSdkTest {
|
|
|
389
478
|
@Test
|
|
390
479
|
fun `𝕄 initialize native SDK 𝕎 initialize() {additionalConfig=null}`() {
|
|
391
480
|
// Given
|
|
392
|
-
fakeConfiguration = fakeConfiguration.copy(
|
|
481
|
+
fakeConfiguration = fakeConfiguration.copy(additionalConfiguration = null)
|
|
393
482
|
val sdkConfigCaptor = argumentCaptor<Configuration>()
|
|
394
483
|
val rumConfigCaptor = argumentCaptor<RumConfiguration>()
|
|
395
484
|
val logsConfigCaptor = argumentCaptor<LogsConfiguration>()
|
|
396
485
|
val traceConfigCaptor = argumentCaptor<TraceConfiguration>()
|
|
397
486
|
|
|
398
|
-
|
|
399
|
-
|
|
487
|
+
val rumMock = org.mockito.Mockito.mockStatic(Rum::class.java)
|
|
488
|
+
val traceMock = org.mockito.Mockito.mockStatic(Trace::class.java)
|
|
489
|
+
val logsMock = org.mockito.Mockito.mockStatic(Logs::class.java)
|
|
400
490
|
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
)
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
491
|
+
try {
|
|
492
|
+
rumMock.`when`<Unit> { Rum.enable(any(), any()) }.then { }
|
|
493
|
+
logsMock.`when`<Unit> { Logs.enable(any(), any()) }.then { }
|
|
494
|
+
traceMock.`when`<Unit> { Trace.enable(any(), any()) }.then { }
|
|
495
|
+
|
|
496
|
+
// When
|
|
497
|
+
testedBridgeSdk.initialize(fakeConfiguration.toReadableJavaOnlyMap(), mockPromise)
|
|
498
|
+
|
|
499
|
+
// Then
|
|
500
|
+
inOrder(mockDatadog) {
|
|
501
|
+
verify(mockDatadog).initialize(
|
|
502
|
+
same(mockContext),
|
|
503
|
+
sdkConfigCaptor.capture(),
|
|
504
|
+
any()
|
|
505
|
+
)
|
|
506
|
+
rumMock.verify { Rum.enable(rumConfigCaptor.capture(), any()) }
|
|
507
|
+
traceMock.verify { Trace.enable(traceConfigCaptor.capture(), any()) }
|
|
508
|
+
logsMock.verify { Logs.enable(logsConfigCaptor.capture(), any()) }
|
|
416
509
|
}
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
510
|
+
assertThat(sdkConfigCaptor.firstValue)
|
|
511
|
+
.hasField("coreConfig") {
|
|
512
|
+
it.hasFieldEqualTo("needsClearTextHttp", false)
|
|
513
|
+
it.hasFieldEqualTo("firstPartyHostsWithHeaderTypes", emptyMap<String, String>())
|
|
514
|
+
}
|
|
515
|
+
.hasFieldEqualTo("clientToken", fakeConfiguration.clientToken)
|
|
516
|
+
.hasFieldEqualTo("env", fakeConfiguration.env)
|
|
517
|
+
.hasFieldEqualTo("variant", "")
|
|
518
|
+
.hasFieldEqualTo("additionalConfig", emptyMap<String, Any?>())
|
|
519
|
+
assertThat(rumConfigCaptor.firstValue)
|
|
520
|
+
} finally {
|
|
521
|
+
rumMock.close()
|
|
522
|
+
logsMock.close()
|
|
523
|
+
traceMock.close()
|
|
524
|
+
}
|
|
423
525
|
}
|
|
424
526
|
|
|
425
527
|
@Test
|
|
@@ -430,34 +532,47 @@ internal class DdSdkTest {
|
|
|
430
532
|
val logsConfigCaptor = argumentCaptor<LogsConfiguration>()
|
|
431
533
|
val traceConfigCaptor = argumentCaptor<TraceConfiguration>()
|
|
432
534
|
|
|
433
|
-
|
|
434
|
-
|
|
535
|
+
val rumMock = org.mockito.Mockito.mockStatic(Rum::class.java)
|
|
536
|
+
val traceMock = org.mockito.Mockito.mockStatic(Trace::class.java)
|
|
537
|
+
val logsMock = org.mockito.Mockito.mockStatic(Logs::class.java)
|
|
435
538
|
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
539
|
+
try {
|
|
540
|
+
rumMock.`when`<Unit> { Rum.enable(any(), any()) }.then { }
|
|
541
|
+
logsMock.`when`<Unit> { Logs.enable(any(), any()) }.then { }
|
|
542
|
+
traceMock.`when`<Unit> { Trace.enable(any(), any()) }.then { }
|
|
543
|
+
// When
|
|
544
|
+
testedBridgeSdk.initialize(fakeConfiguration.toReadableJavaOnlyMap(), mockPromise)
|
|
545
|
+
|
|
546
|
+
// Then
|
|
547
|
+
inOrder(mockDatadog) {
|
|
548
|
+
verify(mockDatadog).initialize(
|
|
549
|
+
same(mockContext),
|
|
550
|
+
sdkConfigCaptor.capture(),
|
|
551
|
+
any()
|
|
552
|
+
)
|
|
553
|
+
rumMock.verify { Rum.enable(rumConfigCaptor.capture(), any()) }
|
|
554
|
+
traceMock.verify { Trace.enable(traceConfigCaptor.capture(), any()) }
|
|
555
|
+
logsMock.verify { Logs.enable(logsConfigCaptor.capture(), any()) }
|
|
451
556
|
}
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
557
|
+
assertThat(sdkConfigCaptor.firstValue)
|
|
558
|
+
.hasField("coreConfig") {
|
|
559
|
+
it.hasFieldEqualTo("needsClearTextHttp", false)
|
|
560
|
+
it.hasFieldEqualTo("firstPartyHostsWithHeaderTypes", emptyMap<String, String>())
|
|
561
|
+
}
|
|
562
|
+
.hasFieldEqualTo("clientToken", fakeConfiguration.clientToken)
|
|
563
|
+
.hasFieldEqualTo("env", fakeConfiguration.env)
|
|
564
|
+
.hasFieldEqualTo("variant", "")
|
|
565
|
+
.hasFieldEqualTo(
|
|
566
|
+
"additionalConfig",
|
|
567
|
+
fakeConfiguration.additionalConfiguration?.filterValues { it != null }.orEmpty()
|
|
568
|
+
)
|
|
569
|
+
assertThat(rumConfigCaptor.firstValue)
|
|
570
|
+
.hasFieldEqualTo("applicationId", fakeConfiguration.rumConfiguration?.applicationId)
|
|
571
|
+
} finally {
|
|
572
|
+
rumMock.close()
|
|
573
|
+
logsMock.close()
|
|
574
|
+
traceMock.close()
|
|
575
|
+
}
|
|
461
576
|
}
|
|
462
577
|
|
|
463
578
|
// endregion
|
|
@@ -469,41 +584,58 @@ internal class DdSdkTest {
|
|
|
469
584
|
forge: Forge
|
|
470
585
|
) {
|
|
471
586
|
// Given
|
|
472
|
-
|
|
587
|
+
val rumConfiguration = fakeConfiguration.rumConfiguration?.copy(
|
|
588
|
+
nativeCrashReportEnabled = true
|
|
589
|
+
)
|
|
590
|
+
fakeConfiguration = fakeConfiguration.copy(site = null, rumConfiguration = rumConfiguration)
|
|
473
591
|
val sdkConfigCaptor = argumentCaptor<Configuration>()
|
|
474
592
|
val rumConfigCaptor = argumentCaptor<RumConfiguration>()
|
|
475
593
|
val logsConfigCaptor = argumentCaptor<LogsConfiguration>()
|
|
476
594
|
val traceConfigCaptor = argumentCaptor<TraceConfiguration>()
|
|
477
595
|
|
|
478
|
-
|
|
479
|
-
|
|
596
|
+
val rumMock = org.mockito.Mockito.mockStatic(Rum::class.java)
|
|
597
|
+
val traceMock = org.mockito.Mockito.mockStatic(Trace::class.java)
|
|
598
|
+
val logsMock = org.mockito.Mockito.mockStatic(Logs::class.java)
|
|
480
599
|
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
)
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
600
|
+
try {
|
|
601
|
+
rumMock.`when`<Unit> { Rum.enable(any(), any()) }.then { }
|
|
602
|
+
logsMock.`when`<Unit> { Logs.enable(any(), any()) }.then { }
|
|
603
|
+
traceMock.`when`<Unit> { Trace.enable(any(), any()) }.then { }
|
|
604
|
+
|
|
605
|
+
// When
|
|
606
|
+
testedBridgeSdk.initialize(fakeConfiguration.toReadableJavaOnlyMap(), mockPromise)
|
|
607
|
+
|
|
608
|
+
// Then
|
|
609
|
+
inOrder(mockDatadog) {
|
|
610
|
+
verify(mockDatadog).initialize(
|
|
611
|
+
same(mockContext),
|
|
612
|
+
sdkConfigCaptor.capture(),
|
|
613
|
+
any()
|
|
614
|
+
)
|
|
615
|
+
rumMock.verify { Rum.enable(rumConfigCaptor.capture(), any()) }
|
|
616
|
+
traceMock.verify { Trace.enable(traceConfigCaptor.capture(), any()) }
|
|
617
|
+
logsMock.verify { Logs.enable(logsConfigCaptor.capture(), any()) }
|
|
497
618
|
}
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
619
|
+
assertThat(sdkConfigCaptor.firstValue)
|
|
620
|
+
.hasField("coreConfig") {
|
|
621
|
+
it.hasFieldEqualTo("needsClearTextHttp", false)
|
|
622
|
+
it.hasFieldEqualTo("firstPartyHostsWithHeaderTypes", emptyMap<String, String>())
|
|
623
|
+
it.hasFieldEqualTo("site", DatadogSite.US1)
|
|
624
|
+
}
|
|
625
|
+
.hasFieldEqualTo("clientToken", fakeConfiguration.clientToken)
|
|
626
|
+
.hasFieldEqualTo("env", fakeConfiguration.env)
|
|
627
|
+
.hasFieldEqualTo("variant", "")
|
|
628
|
+
.hasFieldEqualTo(
|
|
629
|
+
"additionalConfig",
|
|
630
|
+
fakeConfiguration.additionalConfiguration?.filterValues { it != null }.orEmpty()
|
|
631
|
+
)
|
|
632
|
+
assertThat(rumConfigCaptor.firstValue)
|
|
633
|
+
.hasFieldEqualTo("applicationId", fakeConfiguration.rumConfiguration?.applicationId)
|
|
634
|
+
} finally {
|
|
635
|
+
rumMock.close()
|
|
636
|
+
logsMock.close()
|
|
637
|
+
traceMock.close()
|
|
638
|
+
}
|
|
507
639
|
}
|
|
508
640
|
|
|
509
641
|
@Test
|
|
@@ -512,41 +644,58 @@ internal class DdSdkTest {
|
|
|
512
644
|
) {
|
|
513
645
|
// Given
|
|
514
646
|
val site = forge.randomizeCase("us1")
|
|
515
|
-
|
|
647
|
+
val rumConfiguration = fakeConfiguration.rumConfiguration?.copy(
|
|
648
|
+
nativeCrashReportEnabled = true
|
|
649
|
+
)
|
|
650
|
+
fakeConfiguration = fakeConfiguration.copy(site = site, rumConfiguration = rumConfiguration)
|
|
516
651
|
val sdkConfigCaptor = argumentCaptor<Configuration>()
|
|
517
652
|
val rumConfigCaptor = argumentCaptor<RumConfiguration>()
|
|
518
653
|
val logsConfigCaptor = argumentCaptor<LogsConfiguration>()
|
|
519
654
|
val traceConfigCaptor = argumentCaptor<TraceConfiguration>()
|
|
520
655
|
|
|
521
|
-
|
|
522
|
-
|
|
656
|
+
val rumMock = org.mockito.Mockito.mockStatic(Rum::class.java)
|
|
657
|
+
val traceMock = org.mockito.Mockito.mockStatic(Trace::class.java)
|
|
658
|
+
val logsMock = org.mockito.Mockito.mockStatic(Logs::class.java)
|
|
523
659
|
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
)
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
660
|
+
try {
|
|
661
|
+
rumMock.`when`<Unit> { Rum.enable(any(), any()) }.then { }
|
|
662
|
+
logsMock.`when`<Unit> { Logs.enable(any(), any()) }.then { }
|
|
663
|
+
traceMock.`when`<Unit> { Trace.enable(any(), any()) }.then { }
|
|
664
|
+
|
|
665
|
+
// When
|
|
666
|
+
testedBridgeSdk.initialize(fakeConfiguration.toReadableJavaOnlyMap(), mockPromise)
|
|
667
|
+
|
|
668
|
+
// Then
|
|
669
|
+
inOrder(mockDatadog) {
|
|
670
|
+
verify(mockDatadog).initialize(
|
|
671
|
+
same(mockContext),
|
|
672
|
+
sdkConfigCaptor.capture(),
|
|
673
|
+
any()
|
|
674
|
+
)
|
|
675
|
+
rumMock.verify { Rum.enable(rumConfigCaptor.capture(), any()) }
|
|
676
|
+
traceMock.verify { Trace.enable(traceConfigCaptor.capture(), any()) }
|
|
677
|
+
logsMock.verify { Logs.enable(logsConfigCaptor.capture(), any()) }
|
|
540
678
|
}
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
679
|
+
assertThat(sdkConfigCaptor.firstValue)
|
|
680
|
+
.hasField("coreConfig") {
|
|
681
|
+
it.hasFieldEqualTo("needsClearTextHttp", false)
|
|
682
|
+
it.hasFieldEqualTo("firstPartyHostsWithHeaderTypes", emptyMap<String, String>())
|
|
683
|
+
it.hasFieldEqualTo("site", DatadogSite.US1)
|
|
684
|
+
}
|
|
685
|
+
.hasFieldEqualTo("clientToken", fakeConfiguration.clientToken)
|
|
686
|
+
.hasFieldEqualTo("env", fakeConfiguration.env)
|
|
687
|
+
.hasFieldEqualTo("variant", "")
|
|
688
|
+
.hasFieldEqualTo(
|
|
689
|
+
"additionalConfig",
|
|
690
|
+
fakeConfiguration.additionalConfiguration?.filterValues { it != null }.orEmpty()
|
|
691
|
+
)
|
|
692
|
+
assertThat(rumConfigCaptor.firstValue)
|
|
693
|
+
.hasFieldEqualTo("applicationId", fakeConfiguration.rumConfiguration?.applicationId)
|
|
694
|
+
} finally {
|
|
695
|
+
rumMock.close()
|
|
696
|
+
logsMock.close()
|
|
697
|
+
traceMock.close()
|
|
698
|
+
}
|
|
550
699
|
}
|
|
551
700
|
|
|
552
701
|
@Test
|
|
@@ -555,41 +704,58 @@ internal class DdSdkTest {
|
|
|
555
704
|
) {
|
|
556
705
|
// Given
|
|
557
706
|
val site = forge.randomizeCase("us3")
|
|
558
|
-
|
|
707
|
+
val rumConfiguration = fakeConfiguration.rumConfiguration?.copy(
|
|
708
|
+
nativeCrashReportEnabled = true
|
|
709
|
+
)
|
|
710
|
+
fakeConfiguration = fakeConfiguration.copy(site = site, rumConfiguration = rumConfiguration)
|
|
559
711
|
val sdkConfigCaptor = argumentCaptor<Configuration>()
|
|
560
712
|
val rumConfigCaptor = argumentCaptor<RumConfiguration>()
|
|
561
713
|
val logsConfigCaptor = argumentCaptor<LogsConfiguration>()
|
|
562
714
|
val traceConfigCaptor = argumentCaptor<TraceConfiguration>()
|
|
563
715
|
|
|
564
|
-
|
|
565
|
-
|
|
716
|
+
val rumMock = org.mockito.Mockito.mockStatic(Rum::class.java)
|
|
717
|
+
val traceMock = org.mockito.Mockito.mockStatic(Trace::class.java)
|
|
718
|
+
val logsMock = org.mockito.Mockito.mockStatic(Logs::class.java)
|
|
566
719
|
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
)
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
720
|
+
try {
|
|
721
|
+
rumMock.`when`<Unit> { Rum.enable(any(), any()) }.then { }
|
|
722
|
+
logsMock.`when`<Unit> { Logs.enable(any(), any()) }.then { }
|
|
723
|
+
traceMock.`when`<Unit> { Trace.enable(any(), any()) }.then { }
|
|
724
|
+
|
|
725
|
+
// When
|
|
726
|
+
testedBridgeSdk.initialize(fakeConfiguration.toReadableJavaOnlyMap(), mockPromise)
|
|
727
|
+
|
|
728
|
+
// Then
|
|
729
|
+
inOrder(mockDatadog) {
|
|
730
|
+
verify(mockDatadog).initialize(
|
|
731
|
+
same(mockContext),
|
|
732
|
+
sdkConfigCaptor.capture(),
|
|
733
|
+
any()
|
|
734
|
+
)
|
|
735
|
+
rumMock.verify { Rum.enable(rumConfigCaptor.capture(), any()) }
|
|
736
|
+
traceMock.verify { Trace.enable(traceConfigCaptor.capture(), any()) }
|
|
737
|
+
logsMock.verify { Logs.enable(logsConfigCaptor.capture(), any()) }
|
|
583
738
|
}
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
739
|
+
assertThat(sdkConfigCaptor.firstValue)
|
|
740
|
+
.hasField("coreConfig") {
|
|
741
|
+
it.hasFieldEqualTo("needsClearTextHttp", false)
|
|
742
|
+
it.hasFieldEqualTo("firstPartyHostsWithHeaderTypes", emptyMap<String, String>())
|
|
743
|
+
it.hasFieldEqualTo("site", DatadogSite.US3)
|
|
744
|
+
}
|
|
745
|
+
.hasFieldEqualTo("clientToken", fakeConfiguration.clientToken)
|
|
746
|
+
.hasFieldEqualTo("env", fakeConfiguration.env)
|
|
747
|
+
.hasFieldEqualTo("variant", "")
|
|
748
|
+
.hasFieldEqualTo(
|
|
749
|
+
"additionalConfig",
|
|
750
|
+
fakeConfiguration.additionalConfiguration?.filterValues { it != null }.orEmpty()
|
|
751
|
+
)
|
|
752
|
+
assertThat(rumConfigCaptor.firstValue)
|
|
753
|
+
.hasFieldEqualTo("applicationId", fakeConfiguration.rumConfiguration?.applicationId)
|
|
754
|
+
} finally {
|
|
755
|
+
rumMock.close()
|
|
756
|
+
logsMock.close()
|
|
757
|
+
traceMock.close()
|
|
758
|
+
}
|
|
593
759
|
}
|
|
594
760
|
|
|
595
761
|
@Test
|
|
@@ -598,41 +764,58 @@ internal class DdSdkTest {
|
|
|
598
764
|
) {
|
|
599
765
|
// Given
|
|
600
766
|
val site = forge.randomizeCase("us5")
|
|
601
|
-
|
|
767
|
+
val rumConfiguration = fakeConfiguration.rumConfiguration?.copy(
|
|
768
|
+
nativeCrashReportEnabled = true
|
|
769
|
+
)
|
|
770
|
+
fakeConfiguration = fakeConfiguration.copy(site = site, rumConfiguration = rumConfiguration)
|
|
602
771
|
val sdkConfigCaptor = argumentCaptor<Configuration>()
|
|
603
772
|
val rumConfigCaptor = argumentCaptor<RumConfiguration>()
|
|
604
773
|
val logsConfigCaptor = argumentCaptor<LogsConfiguration>()
|
|
605
774
|
val traceConfigCaptor = argumentCaptor<TraceConfiguration>()
|
|
606
775
|
|
|
607
|
-
|
|
608
|
-
|
|
776
|
+
val rumMock = org.mockito.Mockito.mockStatic(Rum::class.java)
|
|
777
|
+
val traceMock = org.mockito.Mockito.mockStatic(Trace::class.java)
|
|
778
|
+
val logsMock = org.mockito.Mockito.mockStatic(Logs::class.java)
|
|
609
779
|
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
)
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
780
|
+
try {
|
|
781
|
+
rumMock.`when`<Unit> { Rum.enable(any(), any()) }.then { }
|
|
782
|
+
logsMock.`when`<Unit> { Logs.enable(any(), any()) }.then { }
|
|
783
|
+
traceMock.`when`<Unit> { Trace.enable(any(), any()) }.then { }
|
|
784
|
+
|
|
785
|
+
// When
|
|
786
|
+
testedBridgeSdk.initialize(fakeConfiguration.toReadableJavaOnlyMap(), mockPromise)
|
|
787
|
+
|
|
788
|
+
// Then
|
|
789
|
+
inOrder(mockDatadog) {
|
|
790
|
+
verify(mockDatadog).initialize(
|
|
791
|
+
same(mockContext),
|
|
792
|
+
sdkConfigCaptor.capture(),
|
|
793
|
+
any()
|
|
794
|
+
)
|
|
795
|
+
rumMock.verify { Rum.enable(rumConfigCaptor.capture(), any()) }
|
|
796
|
+
traceMock.verify { Trace.enable(traceConfigCaptor.capture(), any()) }
|
|
797
|
+
logsMock.verify { Logs.enable(logsConfigCaptor.capture(), any()) }
|
|
626
798
|
}
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
799
|
+
assertThat(sdkConfigCaptor.firstValue)
|
|
800
|
+
.hasField("coreConfig") {
|
|
801
|
+
it.hasFieldEqualTo("needsClearTextHttp", false)
|
|
802
|
+
it.hasFieldEqualTo("firstPartyHostsWithHeaderTypes", emptyMap<String, String>())
|
|
803
|
+
it.hasFieldEqualTo("site", DatadogSite.US5)
|
|
804
|
+
}
|
|
805
|
+
.hasFieldEqualTo("clientToken", fakeConfiguration.clientToken)
|
|
806
|
+
.hasFieldEqualTo("env", fakeConfiguration.env)
|
|
807
|
+
.hasFieldEqualTo("variant", "")
|
|
808
|
+
.hasFieldEqualTo(
|
|
809
|
+
"additionalConfig",
|
|
810
|
+
fakeConfiguration.additionalConfiguration?.filterValues { it != null }.orEmpty()
|
|
811
|
+
)
|
|
812
|
+
assertThat(rumConfigCaptor.firstValue)
|
|
813
|
+
.hasFieldEqualTo("applicationId", fakeConfiguration.rumConfiguration?.applicationId)
|
|
814
|
+
} finally {
|
|
815
|
+
rumMock.close()
|
|
816
|
+
logsMock.close()
|
|
817
|
+
traceMock.close()
|
|
818
|
+
}
|
|
636
819
|
}
|
|
637
820
|
|
|
638
821
|
@Test
|
|
@@ -641,41 +824,58 @@ internal class DdSdkTest {
|
|
|
641
824
|
) {
|
|
642
825
|
// Given
|
|
643
826
|
val site = forge.randomizeCase("us1_fed")
|
|
644
|
-
|
|
827
|
+
val rumConfiguration = fakeConfiguration.rumConfiguration?.copy(
|
|
828
|
+
nativeCrashReportEnabled = true
|
|
829
|
+
)
|
|
830
|
+
fakeConfiguration = fakeConfiguration.copy(site = site, rumConfiguration = rumConfiguration)
|
|
645
831
|
val sdkConfigCaptor = argumentCaptor<Configuration>()
|
|
646
832
|
val rumConfigCaptor = argumentCaptor<RumConfiguration>()
|
|
647
833
|
val logsConfigCaptor = argumentCaptor<LogsConfiguration>()
|
|
648
834
|
val traceConfigCaptor = argumentCaptor<TraceConfiguration>()
|
|
649
835
|
|
|
650
|
-
|
|
651
|
-
|
|
836
|
+
val rumMock = org.mockito.Mockito.mockStatic(Rum::class.java)
|
|
837
|
+
val traceMock = org.mockito.Mockito.mockStatic(Trace::class.java)
|
|
838
|
+
val logsMock = org.mockito.Mockito.mockStatic(Logs::class.java)
|
|
652
839
|
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
)
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
840
|
+
try {
|
|
841
|
+
rumMock.`when`<Unit> { Rum.enable(any(), any()) }.then { }
|
|
842
|
+
logsMock.`when`<Unit> { Logs.enable(any(), any()) }.then { }
|
|
843
|
+
traceMock.`when`<Unit> { Trace.enable(any(), any()) }.then { }
|
|
844
|
+
|
|
845
|
+
// When
|
|
846
|
+
testedBridgeSdk.initialize(fakeConfiguration.toReadableJavaOnlyMap(), mockPromise)
|
|
847
|
+
|
|
848
|
+
// Then
|
|
849
|
+
inOrder(mockDatadog) {
|
|
850
|
+
verify(mockDatadog).initialize(
|
|
851
|
+
same(mockContext),
|
|
852
|
+
sdkConfigCaptor.capture(),
|
|
853
|
+
any()
|
|
854
|
+
)
|
|
855
|
+
rumMock.verify { Rum.enable(rumConfigCaptor.capture(), any()) }
|
|
856
|
+
traceMock.verify { Trace.enable(traceConfigCaptor.capture(), any()) }
|
|
857
|
+
logsMock.verify { Logs.enable(logsConfigCaptor.capture(), any()) }
|
|
669
858
|
}
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
859
|
+
assertThat(sdkConfigCaptor.firstValue)
|
|
860
|
+
.hasField("coreConfig") {
|
|
861
|
+
it.hasFieldEqualTo("needsClearTextHttp", false)
|
|
862
|
+
it.hasFieldEqualTo("firstPartyHostsWithHeaderTypes", emptyMap<String, String>())
|
|
863
|
+
it.hasFieldEqualTo("site", DatadogSite.US1_FED)
|
|
864
|
+
}
|
|
865
|
+
.hasFieldEqualTo("clientToken", fakeConfiguration.clientToken)
|
|
866
|
+
.hasFieldEqualTo("env", fakeConfiguration.env)
|
|
867
|
+
.hasFieldEqualTo("variant", "")
|
|
868
|
+
.hasFieldEqualTo(
|
|
869
|
+
"additionalConfig",
|
|
870
|
+
fakeConfiguration.additionalConfiguration?.filterValues { it != null }.orEmpty()
|
|
871
|
+
)
|
|
872
|
+
assertThat(rumConfigCaptor.firstValue)
|
|
873
|
+
.hasFieldEqualTo("applicationId", fakeConfiguration.rumConfiguration?.applicationId)
|
|
874
|
+
} finally {
|
|
875
|
+
rumMock.close()
|
|
876
|
+
logsMock.close()
|
|
877
|
+
traceMock.close()
|
|
878
|
+
}
|
|
679
879
|
}
|
|
680
880
|
|
|
681
881
|
@Test
|
|
@@ -684,41 +884,58 @@ internal class DdSdkTest {
|
|
|
684
884
|
) {
|
|
685
885
|
// Given
|
|
686
886
|
val site = forge.randomizeCase("eu1")
|
|
687
|
-
|
|
887
|
+
val rumConfiguration = fakeConfiguration.rumConfiguration?.copy(
|
|
888
|
+
nativeCrashReportEnabled = true
|
|
889
|
+
)
|
|
890
|
+
fakeConfiguration = fakeConfiguration.copy(site = site, rumConfiguration = rumConfiguration)
|
|
688
891
|
val sdkConfigCaptor = argumentCaptor<Configuration>()
|
|
689
892
|
val rumConfigCaptor = argumentCaptor<RumConfiguration>()
|
|
690
893
|
val logsConfigCaptor = argumentCaptor<LogsConfiguration>()
|
|
691
894
|
val traceConfigCaptor = argumentCaptor<TraceConfiguration>()
|
|
692
895
|
|
|
693
|
-
|
|
694
|
-
|
|
896
|
+
val rumMock = org.mockito.Mockito.mockStatic(Rum::class.java)
|
|
897
|
+
val traceMock = org.mockito.Mockito.mockStatic(Trace::class.java)
|
|
898
|
+
val logsMock = org.mockito.Mockito.mockStatic(Logs::class.java)
|
|
695
899
|
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
)
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
900
|
+
try {
|
|
901
|
+
rumMock.`when`<Unit> { Rum.enable(any(), any()) }.then { }
|
|
902
|
+
logsMock.`when`<Unit> { Logs.enable(any(), any()) }.then { }
|
|
903
|
+
traceMock.`when`<Unit> { Trace.enable(any(), any()) }.then { }
|
|
904
|
+
|
|
905
|
+
// When
|
|
906
|
+
testedBridgeSdk.initialize(fakeConfiguration.toReadableJavaOnlyMap(), mockPromise)
|
|
907
|
+
|
|
908
|
+
// Then
|
|
909
|
+
inOrder(mockDatadog) {
|
|
910
|
+
verify(mockDatadog).initialize(
|
|
911
|
+
same(mockContext),
|
|
912
|
+
sdkConfigCaptor.capture(),
|
|
913
|
+
any()
|
|
914
|
+
)
|
|
915
|
+
rumMock.verify { Rum.enable(rumConfigCaptor.capture(), any()) }
|
|
916
|
+
traceMock.verify { Trace.enable(traceConfigCaptor.capture(), any()) }
|
|
917
|
+
logsMock.verify { Logs.enable(logsConfigCaptor.capture(), any()) }
|
|
712
918
|
}
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
919
|
+
assertThat(sdkConfigCaptor.firstValue)
|
|
920
|
+
.hasField("coreConfig") {
|
|
921
|
+
it.hasFieldEqualTo("needsClearTextHttp", false)
|
|
922
|
+
it.hasFieldEqualTo("firstPartyHostsWithHeaderTypes", emptyMap<String, String>())
|
|
923
|
+
it.hasFieldEqualTo("site", DatadogSite.EU1)
|
|
924
|
+
}
|
|
925
|
+
.hasFieldEqualTo("clientToken", fakeConfiguration.clientToken)
|
|
926
|
+
.hasFieldEqualTo("env", fakeConfiguration.env)
|
|
927
|
+
.hasFieldEqualTo("variant", "")
|
|
928
|
+
.hasFieldEqualTo(
|
|
929
|
+
"additionalConfig",
|
|
930
|
+
fakeConfiguration.additionalConfiguration?.filterValues { it != null }.orEmpty()
|
|
931
|
+
)
|
|
932
|
+
assertThat(rumConfigCaptor.firstValue)
|
|
933
|
+
.hasFieldEqualTo("applicationId", fakeConfiguration.rumConfiguration?.applicationId)
|
|
934
|
+
} finally {
|
|
935
|
+
rumMock.close()
|
|
936
|
+
logsMock.close()
|
|
937
|
+
traceMock.close()
|
|
938
|
+
}
|
|
722
939
|
}
|
|
723
940
|
|
|
724
941
|
@Test
|
|
@@ -727,41 +944,58 @@ internal class DdSdkTest {
|
|
|
727
944
|
) {
|
|
728
945
|
// Given
|
|
729
946
|
val site = forge.randomizeCase("ap1")
|
|
730
|
-
|
|
947
|
+
val rumConfiguration = fakeConfiguration.rumConfiguration?.copy(
|
|
948
|
+
nativeCrashReportEnabled = true
|
|
949
|
+
)
|
|
950
|
+
fakeConfiguration = fakeConfiguration.copy(site = site, rumConfiguration = rumConfiguration)
|
|
731
951
|
val sdkConfigCaptor = argumentCaptor<Configuration>()
|
|
732
952
|
val rumConfigCaptor = argumentCaptor<RumConfiguration>()
|
|
733
953
|
val logsConfigCaptor = argumentCaptor<LogsConfiguration>()
|
|
734
954
|
val traceConfigCaptor = argumentCaptor<TraceConfiguration>()
|
|
735
955
|
|
|
736
|
-
|
|
737
|
-
|
|
956
|
+
val rumMock = org.mockito.Mockito.mockStatic(Rum::class.java)
|
|
957
|
+
val traceMock = org.mockito.Mockito.mockStatic(Trace::class.java)
|
|
958
|
+
val logsMock = org.mockito.Mockito.mockStatic(Logs::class.java)
|
|
738
959
|
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
)
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
960
|
+
try {
|
|
961
|
+
rumMock.`when`<Unit> { Rum.enable(any(), any()) }.then { }
|
|
962
|
+
logsMock.`when`<Unit> { Logs.enable(any(), any()) }.then { }
|
|
963
|
+
traceMock.`when`<Unit> { Trace.enable(any(), any()) }.then { }
|
|
964
|
+
|
|
965
|
+
// When
|
|
966
|
+
testedBridgeSdk.initialize(fakeConfiguration.toReadableJavaOnlyMap(), mockPromise)
|
|
967
|
+
|
|
968
|
+
// Then
|
|
969
|
+
inOrder(mockDatadog) {
|
|
970
|
+
verify(mockDatadog).initialize(
|
|
971
|
+
same(mockContext),
|
|
972
|
+
sdkConfigCaptor.capture(),
|
|
973
|
+
any()
|
|
974
|
+
)
|
|
975
|
+
rumMock.verify { Rum.enable(rumConfigCaptor.capture(), any()) }
|
|
976
|
+
traceMock.verify { Trace.enable(traceConfigCaptor.capture(), any()) }
|
|
977
|
+
logsMock.verify { Logs.enable(logsConfigCaptor.capture(), any()) }
|
|
755
978
|
}
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
979
|
+
assertThat(sdkConfigCaptor.firstValue)
|
|
980
|
+
.hasField("coreConfig") {
|
|
981
|
+
it.hasFieldEqualTo("needsClearTextHttp", false)
|
|
982
|
+
it.hasFieldEqualTo("firstPartyHostsWithHeaderTypes", emptyMap<String, String>())
|
|
983
|
+
it.hasFieldEqualTo("site", DatadogSite.AP1)
|
|
984
|
+
}
|
|
985
|
+
.hasFieldEqualTo("clientToken", fakeConfiguration.clientToken)
|
|
986
|
+
.hasFieldEqualTo("env", fakeConfiguration.env)
|
|
987
|
+
.hasFieldEqualTo("variant", "")
|
|
988
|
+
.hasFieldEqualTo(
|
|
989
|
+
"additionalConfig",
|
|
990
|
+
fakeConfiguration.additionalConfiguration?.filterValues { it != null }.orEmpty()
|
|
991
|
+
)
|
|
992
|
+
assertThat(rumConfigCaptor.firstValue)
|
|
993
|
+
.hasFieldEqualTo("applicationId", fakeConfiguration.rumConfiguration?.applicationId)
|
|
994
|
+
} finally {
|
|
995
|
+
rumMock.close()
|
|
996
|
+
logsMock.close()
|
|
997
|
+
traceMock.close()
|
|
998
|
+
}
|
|
765
999
|
}
|
|
766
1000
|
|
|
767
1001
|
@Test
|
|
@@ -770,41 +1004,58 @@ internal class DdSdkTest {
|
|
|
770
1004
|
) {
|
|
771
1005
|
// Given
|
|
772
1006
|
val site = forge.randomizeCase("ap2")
|
|
773
|
-
|
|
1007
|
+
val rumConfiguration = fakeConfiguration.rumConfiguration?.copy(
|
|
1008
|
+
nativeCrashReportEnabled = true
|
|
1009
|
+
)
|
|
1010
|
+
fakeConfiguration = fakeConfiguration.copy(site = site, rumConfiguration = rumConfiguration)
|
|
774
1011
|
val sdkConfigCaptor = argumentCaptor<Configuration>()
|
|
775
1012
|
val rumConfigCaptor = argumentCaptor<RumConfiguration>()
|
|
776
1013
|
val logsConfigCaptor = argumentCaptor<LogsConfiguration>()
|
|
777
1014
|
val traceConfigCaptor = argumentCaptor<TraceConfiguration>()
|
|
778
1015
|
|
|
779
|
-
|
|
780
|
-
|
|
1016
|
+
val rumMock = org.mockito.Mockito.mockStatic(Rum::class.java)
|
|
1017
|
+
val traceMock = org.mockito.Mockito.mockStatic(Trace::class.java)
|
|
1018
|
+
val logsMock = org.mockito.Mockito.mockStatic(Logs::class.java)
|
|
781
1019
|
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
)
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
1020
|
+
try {
|
|
1021
|
+
rumMock.`when`<Unit> { Rum.enable(any(), any()) }.then { }
|
|
1022
|
+
logsMock.`when`<Unit> { Logs.enable(any(), any()) }.then { }
|
|
1023
|
+
traceMock.`when`<Unit> { Trace.enable(any(), any()) }.then { }
|
|
1024
|
+
|
|
1025
|
+
// When
|
|
1026
|
+
testedBridgeSdk.initialize(fakeConfiguration.toReadableJavaOnlyMap(), mockPromise)
|
|
1027
|
+
|
|
1028
|
+
// Then
|
|
1029
|
+
inOrder(mockDatadog) {
|
|
1030
|
+
verify(mockDatadog).initialize(
|
|
1031
|
+
same(mockContext),
|
|
1032
|
+
sdkConfigCaptor.capture(),
|
|
1033
|
+
any()
|
|
1034
|
+
)
|
|
1035
|
+
rumMock.verify { Rum.enable(rumConfigCaptor.capture(), any()) }
|
|
1036
|
+
traceMock.verify { Trace.enable(traceConfigCaptor.capture(), any()) }
|
|
1037
|
+
logsMock.verify { Logs.enable(logsConfigCaptor.capture(), any()) }
|
|
798
1038
|
}
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
1039
|
+
assertThat(sdkConfigCaptor.firstValue)
|
|
1040
|
+
.hasField("coreConfig") {
|
|
1041
|
+
it.hasFieldEqualTo("needsClearTextHttp", false)
|
|
1042
|
+
it.hasFieldEqualTo("firstPartyHostsWithHeaderTypes", emptyMap<String, String>())
|
|
1043
|
+
it.hasFieldEqualTo("site", DatadogSite.AP2)
|
|
1044
|
+
}
|
|
1045
|
+
.hasFieldEqualTo("clientToken", fakeConfiguration.clientToken)
|
|
1046
|
+
.hasFieldEqualTo("env", fakeConfiguration.env)
|
|
1047
|
+
.hasFieldEqualTo("variant", "")
|
|
1048
|
+
.hasFieldEqualTo(
|
|
1049
|
+
"additionalConfig",
|
|
1050
|
+
fakeConfiguration.additionalConfiguration?.filterValues { it != null }.orEmpty()
|
|
1051
|
+
)
|
|
1052
|
+
assertThat(rumConfigCaptor.firstValue)
|
|
1053
|
+
.hasFieldEqualTo("applicationId", fakeConfiguration.rumConfiguration?.applicationId)
|
|
1054
|
+
} finally {
|
|
1055
|
+
rumMock.close()
|
|
1056
|
+
logsMock.close()
|
|
1057
|
+
traceMock.close()
|
|
1058
|
+
}
|
|
808
1059
|
}
|
|
809
1060
|
|
|
810
1061
|
// endregion
|
|
@@ -820,19 +1071,33 @@ internal class DdSdkTest {
|
|
|
820
1071
|
val logsConfigCaptor = argumentCaptor<LogsConfiguration>()
|
|
821
1072
|
val traceConfigCaptor = argumentCaptor<TraceConfiguration>()
|
|
822
1073
|
|
|
823
|
-
|
|
824
|
-
|
|
1074
|
+
val rumMock = org.mockito.Mockito.mockStatic(Rum::class.java)
|
|
1075
|
+
val traceMock = org.mockito.Mockito.mockStatic(Trace::class.java)
|
|
1076
|
+
val logsMock = org.mockito.Mockito.mockStatic(Logs::class.java)
|
|
825
1077
|
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
)
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
1078
|
+
try {
|
|
1079
|
+
rumMock.`when`<Unit> { Rum.enable(any(), any()) }.then { }
|
|
1080
|
+
logsMock.`when`<Unit> { Logs.enable(any(), any()) }.then { }
|
|
1081
|
+
traceMock.`when`<Unit> { Trace.enable(any(), any()) }.then { }
|
|
1082
|
+
|
|
1083
|
+
// When
|
|
1084
|
+
testedBridgeSdk.initialize(fakeConfiguration.toReadableJavaOnlyMap(), mockPromise)
|
|
1085
|
+
|
|
1086
|
+
// Then
|
|
1087
|
+
inOrder(mockDatadog) {
|
|
1088
|
+
verify(mockDatadog).initialize(
|
|
1089
|
+
same(mockContext),
|
|
1090
|
+
sdkConfigCaptor.capture(),
|
|
1091
|
+
eq(TrackingConsent.PENDING)
|
|
1092
|
+
)
|
|
1093
|
+
rumMock.verify { Rum.enable(rumConfigCaptor.capture(), any()) }
|
|
1094
|
+
traceMock.verify { Trace.enable(traceConfigCaptor.capture(), any()) }
|
|
1095
|
+
logsMock.verify { Logs.enable(logsConfigCaptor.capture(), any()) }
|
|
1096
|
+
}
|
|
1097
|
+
} finally {
|
|
1098
|
+
rumMock.close()
|
|
1099
|
+
logsMock.close()
|
|
1100
|
+
traceMock.close()
|
|
836
1101
|
}
|
|
837
1102
|
}
|
|
838
1103
|
|
|
@@ -848,19 +1113,33 @@ internal class DdSdkTest {
|
|
|
848
1113
|
val logsConfigCaptor = argumentCaptor<LogsConfiguration>()
|
|
849
1114
|
val traceConfigCaptor = argumentCaptor<TraceConfiguration>()
|
|
850
1115
|
|
|
851
|
-
|
|
852
|
-
|
|
1116
|
+
val rumMock = org.mockito.Mockito.mockStatic(Rum::class.java)
|
|
1117
|
+
val traceMock = org.mockito.Mockito.mockStatic(Trace::class.java)
|
|
1118
|
+
val logsMock = org.mockito.Mockito.mockStatic(Logs::class.java)
|
|
853
1119
|
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
)
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
1120
|
+
try {
|
|
1121
|
+
rumMock.`when`<Unit> { Rum.enable(any(), any()) }.then { }
|
|
1122
|
+
logsMock.`when`<Unit> { Logs.enable(any(), any()) }.then { }
|
|
1123
|
+
traceMock.`when`<Unit> { Trace.enable(any(), any()) }.then { }
|
|
1124
|
+
|
|
1125
|
+
// When
|
|
1126
|
+
testedBridgeSdk.initialize(fakeConfiguration.toReadableJavaOnlyMap(), mockPromise)
|
|
1127
|
+
|
|
1128
|
+
// Then
|
|
1129
|
+
inOrder(mockDatadog) {
|
|
1130
|
+
verify(mockDatadog).initialize(
|
|
1131
|
+
same(mockContext),
|
|
1132
|
+
sdkConfigCaptor.capture(),
|
|
1133
|
+
eq(TrackingConsent.PENDING)
|
|
1134
|
+
)
|
|
1135
|
+
rumMock.verify { Rum.enable(rumConfigCaptor.capture(), any()) }
|
|
1136
|
+
traceMock.verify { Trace.enable(traceConfigCaptor.capture(), any()) }
|
|
1137
|
+
logsMock.verify { Logs.enable(logsConfigCaptor.capture(), any()) }
|
|
1138
|
+
}
|
|
1139
|
+
} finally {
|
|
1140
|
+
rumMock.close()
|
|
1141
|
+
logsMock.close()
|
|
1142
|
+
traceMock.close()
|
|
864
1143
|
}
|
|
865
1144
|
}
|
|
866
1145
|
|
|
@@ -876,19 +1155,33 @@ internal class DdSdkTest {
|
|
|
876
1155
|
val logsConfigCaptor = argumentCaptor<LogsConfiguration>()
|
|
877
1156
|
val traceConfigCaptor = argumentCaptor<TraceConfiguration>()
|
|
878
1157
|
|
|
879
|
-
|
|
880
|
-
|
|
1158
|
+
val rumMock = org.mockito.Mockito.mockStatic(Rum::class.java)
|
|
1159
|
+
val traceMock = org.mockito.Mockito.mockStatic(Trace::class.java)
|
|
1160
|
+
val logsMock = org.mockito.Mockito.mockStatic(Logs::class.java)
|
|
881
1161
|
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
)
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
1162
|
+
try {
|
|
1163
|
+
rumMock.`when`<Unit> { Rum.enable(any(), any()) }.then { }
|
|
1164
|
+
logsMock.`when`<Unit> { Logs.enable(any(), any()) }.then { }
|
|
1165
|
+
traceMock.`when`<Unit> { Trace.enable(any(), any()) }.then { }
|
|
1166
|
+
|
|
1167
|
+
// When
|
|
1168
|
+
testedBridgeSdk.initialize(fakeConfiguration.toReadableJavaOnlyMap(), mockPromise)
|
|
1169
|
+
|
|
1170
|
+
// Then
|
|
1171
|
+
inOrder(mockDatadog) {
|
|
1172
|
+
verify(mockDatadog).initialize(
|
|
1173
|
+
same(mockContext),
|
|
1174
|
+
sdkConfigCaptor.capture(),
|
|
1175
|
+
eq(TrackingConsent.GRANTED)
|
|
1176
|
+
)
|
|
1177
|
+
rumMock.verify { Rum.enable(rumConfigCaptor.capture(), any()) }
|
|
1178
|
+
traceMock.verify { Trace.enable(traceConfigCaptor.capture(), any()) }
|
|
1179
|
+
logsMock.verify { Logs.enable(logsConfigCaptor.capture(), any()) }
|
|
1180
|
+
}
|
|
1181
|
+
} finally {
|
|
1182
|
+
rumMock.close()
|
|
1183
|
+
logsMock.close()
|
|
1184
|
+
traceMock.close()
|
|
892
1185
|
}
|
|
893
1186
|
}
|
|
894
1187
|
|
|
@@ -904,19 +1197,33 @@ internal class DdSdkTest {
|
|
|
904
1197
|
val logsConfigCaptor = argumentCaptor<LogsConfiguration>()
|
|
905
1198
|
val traceConfigCaptor = argumentCaptor<TraceConfiguration>()
|
|
906
1199
|
|
|
907
|
-
|
|
908
|
-
|
|
1200
|
+
val rumMock = org.mockito.Mockito.mockStatic(Rum::class.java)
|
|
1201
|
+
val traceMock = org.mockito.Mockito.mockStatic(Trace::class.java)
|
|
1202
|
+
val logsMock = org.mockito.Mockito.mockStatic(Logs::class.java)
|
|
909
1203
|
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
)
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
1204
|
+
try {
|
|
1205
|
+
rumMock.`when`<Unit> { Rum.enable(any(), any()) }.then { }
|
|
1206
|
+
logsMock.`when`<Unit> { Logs.enable(any(), any()) }.then { }
|
|
1207
|
+
traceMock.`when`<Unit> { Trace.enable(any(), any()) }.then { }
|
|
1208
|
+
|
|
1209
|
+
// When
|
|
1210
|
+
testedBridgeSdk.initialize(fakeConfiguration.toReadableJavaOnlyMap(), mockPromise)
|
|
1211
|
+
|
|
1212
|
+
// Then
|
|
1213
|
+
inOrder(mockDatadog) {
|
|
1214
|
+
verify(mockDatadog).initialize(
|
|
1215
|
+
same(mockContext),
|
|
1216
|
+
sdkConfigCaptor.capture(),
|
|
1217
|
+
eq(TrackingConsent.NOT_GRANTED)
|
|
1218
|
+
)
|
|
1219
|
+
rumMock.verify { Rum.enable(rumConfigCaptor.capture(), any()) }
|
|
1220
|
+
traceMock.verify { Trace.enable(traceConfigCaptor.capture(), any()) }
|
|
1221
|
+
logsMock.verify { Logs.enable(logsConfigCaptor.capture(), any()) }
|
|
1222
|
+
}
|
|
1223
|
+
} finally {
|
|
1224
|
+
rumMock.close()
|
|
1225
|
+
logsMock.close()
|
|
1226
|
+
traceMock.close()
|
|
920
1227
|
}
|
|
921
1228
|
}
|
|
922
1229
|
|
|
@@ -927,65 +1234,95 @@ internal class DdSdkTest {
|
|
|
927
1234
|
@Forgery configuration: DdSdkConfiguration
|
|
928
1235
|
) {
|
|
929
1236
|
// Given
|
|
1237
|
+
val rumConfiguration = configuration.rumConfiguration?.copy(nativeViewTracking = false)
|
|
930
1238
|
val bridgeConfiguration = configuration.copy(
|
|
931
|
-
|
|
1239
|
+
rumConfiguration = rumConfiguration
|
|
932
1240
|
)
|
|
933
1241
|
val sdkConfigCaptor = argumentCaptor<Configuration>()
|
|
934
1242
|
val rumConfigCaptor = argumentCaptor<RumConfiguration>()
|
|
935
1243
|
val logsConfigCaptor = argumentCaptor<LogsConfiguration>()
|
|
936
1244
|
val traceConfigCaptor = argumentCaptor<TraceConfiguration>()
|
|
937
1245
|
|
|
938
|
-
|
|
939
|
-
|
|
1246
|
+
val rumMock = org.mockito.Mockito.mockStatic(Rum::class.java)
|
|
1247
|
+
val traceMock = org.mockito.Mockito.mockStatic(Trace::class.java)
|
|
1248
|
+
val logsMock = org.mockito.Mockito.mockStatic(Logs::class.java)
|
|
940
1249
|
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
)
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
1250
|
+
try {
|
|
1251
|
+
rumMock.`when`<Unit> { Rum.enable(any(), any()) }.then { }
|
|
1252
|
+
logsMock.`when`<Unit> { Logs.enable(any(), any()) }.then { }
|
|
1253
|
+
traceMock.`when`<Unit> { Trace.enable(any(), any()) }.then { }
|
|
1254
|
+
|
|
1255
|
+
// When
|
|
1256
|
+
testedBridgeSdk.initialize(bridgeConfiguration.toReadableJavaOnlyMap(), mockPromise)
|
|
1257
|
+
|
|
1258
|
+
// Then
|
|
1259
|
+
inOrder(mockDatadog) {
|
|
1260
|
+
verify(mockDatadog).initialize(
|
|
1261
|
+
same(mockContext),
|
|
1262
|
+
sdkConfigCaptor.capture(),
|
|
1263
|
+
any()
|
|
1264
|
+
)
|
|
1265
|
+
rumMock.verify { Rum.enable(rumConfigCaptor.capture(), any()) }
|
|
1266
|
+
traceMock.verify { Trace.enable(traceConfigCaptor.capture(), any()) }
|
|
1267
|
+
logsMock.verify { Logs.enable(logsConfigCaptor.capture(), any()) }
|
|
1268
|
+
}
|
|
1269
|
+
assertThat(rumConfigCaptor.firstValue)
|
|
1270
|
+
.hasField("featureConfiguration") {
|
|
1271
|
+
it.hasFieldEqualTo("viewTrackingStrategy", NoOpViewTrackingStrategy)
|
|
1272
|
+
}
|
|
1273
|
+
} finally {
|
|
1274
|
+
rumMock.close()
|
|
1275
|
+
logsMock.close()
|
|
1276
|
+
traceMock.close()
|
|
1277
|
+
}
|
|
1278
|
+
}
|
|
957
1279
|
|
|
958
1280
|
@Test
|
|
959
1281
|
fun `𝕄 initialize native SDK 𝕎 initialize() {with view tracking}`(
|
|
960
1282
|
@Forgery configuration: DdSdkConfiguration
|
|
961
1283
|
) {
|
|
962
1284
|
// Given
|
|
1285
|
+
val rumConfiguration = configuration.rumConfiguration?.copy(nativeViewTracking = true)
|
|
963
1286
|
val bridgeConfiguration = configuration.copy(
|
|
964
|
-
|
|
1287
|
+
rumConfiguration = rumConfiguration
|
|
965
1288
|
)
|
|
966
1289
|
val sdkConfigCaptor = argumentCaptor<Configuration>()
|
|
967
1290
|
val rumConfigCaptor = argumentCaptor<RumConfiguration>()
|
|
968
1291
|
val logsConfigCaptor = argumentCaptor<LogsConfiguration>()
|
|
969
1292
|
val traceConfigCaptor = argumentCaptor<TraceConfiguration>()
|
|
970
1293
|
|
|
971
|
-
|
|
972
|
-
|
|
1294
|
+
val rumMock = org.mockito.Mockito.mockStatic(Rum::class.java)
|
|
1295
|
+
val traceMock = org.mockito.Mockito.mockStatic(Trace::class.java)
|
|
1296
|
+
val logsMock = org.mockito.Mockito.mockStatic(Logs::class.java)
|
|
973
1297
|
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
)
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
1298
|
+
try {
|
|
1299
|
+
rumMock.`when`<Unit> { Rum.enable(any(), any()) }.then { }
|
|
1300
|
+
logsMock.`when`<Unit> { Logs.enable(any(), any()) }.then { }
|
|
1301
|
+
traceMock.`when`<Unit> { Trace.enable(any(), any()) }.then { }
|
|
1302
|
+
|
|
1303
|
+
// When
|
|
1304
|
+
testedBridgeSdk.initialize(bridgeConfiguration.toReadableJavaOnlyMap(), mockPromise)
|
|
1305
|
+
|
|
1306
|
+
// Then
|
|
1307
|
+
inOrder(mockDatadog) {
|
|
1308
|
+
verify(mockDatadog).initialize(
|
|
1309
|
+
same(mockContext),
|
|
1310
|
+
sdkConfigCaptor.capture(),
|
|
1311
|
+
any()
|
|
1312
|
+
)
|
|
1313
|
+
rumMock.verify { Rum.enable(rumConfigCaptor.capture(), any()) }
|
|
1314
|
+
traceMock.verify { Trace.enable(traceConfigCaptor.capture(), any()) }
|
|
1315
|
+
logsMock.verify { Logs.enable(logsConfigCaptor.capture(), any()) }
|
|
988
1316
|
}
|
|
1317
|
+
assertThat(rumConfigCaptor.firstValue)
|
|
1318
|
+
.hasField("featureConfiguration") {
|
|
1319
|
+
it.hasFieldEqualTo("viewTrackingStrategy", ActivityViewTrackingStrategy(false))
|
|
1320
|
+
}
|
|
1321
|
+
} finally {
|
|
1322
|
+
rumMock.close()
|
|
1323
|
+
logsMock.close()
|
|
1324
|
+
traceMock.close()
|
|
1325
|
+
}
|
|
989
1326
|
}
|
|
990
1327
|
|
|
991
1328
|
@Test
|
|
@@ -993,32 +1330,49 @@ internal class DdSdkTest {
|
|
|
993
1330
|
@Forgery configuration: DdSdkConfiguration
|
|
994
1331
|
) {
|
|
995
1332
|
// Given
|
|
996
|
-
val
|
|
1333
|
+
val rumConfiguration = configuration.rumConfiguration?.copy(
|
|
997
1334
|
nativeInteractionTracking = false
|
|
998
1335
|
)
|
|
1336
|
+
val bridgeConfiguration = configuration.copy(
|
|
1337
|
+
rumConfiguration = rumConfiguration
|
|
1338
|
+
)
|
|
999
1339
|
val sdkConfigCaptor = argumentCaptor<Configuration>()
|
|
1000
1340
|
val rumConfigCaptor = argumentCaptor<RumConfiguration>()
|
|
1001
1341
|
val logsConfigCaptor = argumentCaptor<LogsConfiguration>()
|
|
1002
1342
|
val traceConfigCaptor = argumentCaptor<TraceConfiguration>()
|
|
1003
1343
|
|
|
1004
|
-
|
|
1005
|
-
|
|
1344
|
+
val rumMock = org.mockito.Mockito.mockStatic(Rum::class.java)
|
|
1345
|
+
val traceMock = org.mockito.Mockito.mockStatic(Trace::class.java)
|
|
1346
|
+
val logsMock = org.mockito.Mockito.mockStatic(Logs::class.java)
|
|
1006
1347
|
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
)
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1348
|
+
try {
|
|
1349
|
+
rumMock.`when`<Unit> { Rum.enable(any(), any()) }.then { }
|
|
1350
|
+
logsMock.`when`<Unit> { Logs.enable(any(), any()) }.then { }
|
|
1351
|
+
traceMock.`when`<Unit> { Trace.enable(any(), any()) }.then { }
|
|
1352
|
+
|
|
1353
|
+
// When
|
|
1354
|
+
testedBridgeSdk.initialize(bridgeConfiguration.toReadableJavaOnlyMap(), mockPromise)
|
|
1355
|
+
|
|
1356
|
+
// Then
|
|
1357
|
+
inOrder(mockDatadog) {
|
|
1358
|
+
verify(mockDatadog).initialize(
|
|
1359
|
+
same(mockContext),
|
|
1360
|
+
sdkConfigCaptor.capture(),
|
|
1361
|
+
any()
|
|
1362
|
+
)
|
|
1363
|
+
rumMock.verify { Rum.enable(rumConfigCaptor.capture(), any()) }
|
|
1364
|
+
traceMock.verify { Trace.enable(traceConfigCaptor.capture(), any()) }
|
|
1365
|
+
logsMock.verify { Logs.enable(logsConfigCaptor.capture(), any()) }
|
|
1021
1366
|
}
|
|
1367
|
+
assertThat(rumConfigCaptor.firstValue)
|
|
1368
|
+
.hasField("featureConfiguration") {
|
|
1369
|
+
it.hasFieldEqualTo("userActionTracking", false)
|
|
1370
|
+
}
|
|
1371
|
+
} finally {
|
|
1372
|
+
rumMock.close()
|
|
1373
|
+
logsMock.close()
|
|
1374
|
+
traceMock.close()
|
|
1375
|
+
}
|
|
1022
1376
|
}
|
|
1023
1377
|
|
|
1024
1378
|
@Test
|
|
@@ -1026,32 +1380,47 @@ internal class DdSdkTest {
|
|
|
1026
1380
|
@Forgery configuration: DdSdkConfiguration
|
|
1027
1381
|
) {
|
|
1028
1382
|
// Given
|
|
1383
|
+
val rumConfiguration = configuration.rumConfiguration?.copy(trackFrustrations = true)
|
|
1029
1384
|
val bridgeConfiguration = configuration.copy(
|
|
1030
|
-
|
|
1385
|
+
rumConfiguration = rumConfiguration
|
|
1031
1386
|
)
|
|
1032
1387
|
val sdkConfigCaptor = argumentCaptor<Configuration>()
|
|
1033
1388
|
val rumConfigCaptor = argumentCaptor<RumConfiguration>()
|
|
1034
1389
|
val logsConfigCaptor = argumentCaptor<LogsConfiguration>()
|
|
1035
1390
|
val traceConfigCaptor = argumentCaptor<TraceConfiguration>()
|
|
1036
1391
|
|
|
1037
|
-
|
|
1038
|
-
|
|
1392
|
+
val rumMock = org.mockito.Mockito.mockStatic(Rum::class.java)
|
|
1393
|
+
val traceMock = org.mockito.Mockito.mockStatic(Trace::class.java)
|
|
1394
|
+
val logsMock = org.mockito.Mockito.mockStatic(Logs::class.java)
|
|
1039
1395
|
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
)
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1396
|
+
try {
|
|
1397
|
+
rumMock.`when`<Unit> { Rum.enable(any(), any()) }.then { }
|
|
1398
|
+
logsMock.`when`<Unit> { Logs.enable(any(), any()) }.then { }
|
|
1399
|
+
traceMock.`when`<Unit> { Trace.enable(any(), any()) }.then { }
|
|
1400
|
+
|
|
1401
|
+
// When
|
|
1402
|
+
testedBridgeSdk.initialize(bridgeConfiguration.toReadableJavaOnlyMap(), mockPromise)
|
|
1403
|
+
|
|
1404
|
+
// Then
|
|
1405
|
+
inOrder(mockDatadog) {
|
|
1406
|
+
verify(mockDatadog).initialize(
|
|
1407
|
+
same(mockContext),
|
|
1408
|
+
sdkConfigCaptor.capture(),
|
|
1409
|
+
any()
|
|
1410
|
+
)
|
|
1411
|
+
rumMock.verify { Rum.enable(rumConfigCaptor.capture(), any()) }
|
|
1412
|
+
traceMock.verify { Trace.enable(traceConfigCaptor.capture(), any()) }
|
|
1413
|
+
logsMock.verify { Logs.enable(logsConfigCaptor.capture(), any()) }
|
|
1054
1414
|
}
|
|
1415
|
+
assertThat(rumConfigCaptor.firstValue)
|
|
1416
|
+
.hasField("featureConfiguration") {
|
|
1417
|
+
it.hasFieldEqualTo("trackFrustrations", true)
|
|
1418
|
+
}
|
|
1419
|
+
} finally {
|
|
1420
|
+
rumMock.close()
|
|
1421
|
+
logsMock.close()
|
|
1422
|
+
traceMock.close()
|
|
1423
|
+
}
|
|
1055
1424
|
}
|
|
1056
1425
|
|
|
1057
1426
|
@Test
|
|
@@ -1059,32 +1428,48 @@ internal class DdSdkTest {
|
|
|
1059
1428
|
@Forgery configuration: DdSdkConfiguration
|
|
1060
1429
|
) {
|
|
1061
1430
|
// Given
|
|
1431
|
+
val rumConfiguration = configuration.rumConfiguration?.copy(trackFrustrations = false)
|
|
1062
1432
|
val bridgeConfiguration = configuration.copy(
|
|
1063
|
-
|
|
1433
|
+
rumConfiguration = rumConfiguration
|
|
1064
1434
|
)
|
|
1435
|
+
|
|
1065
1436
|
val sdkConfigCaptor = argumentCaptor<Configuration>()
|
|
1066
1437
|
val rumConfigCaptor = argumentCaptor<RumConfiguration>()
|
|
1067
1438
|
val logsConfigCaptor = argumentCaptor<LogsConfiguration>()
|
|
1068
1439
|
val traceConfigCaptor = argumentCaptor<TraceConfiguration>()
|
|
1069
1440
|
|
|
1070
|
-
|
|
1071
|
-
|
|
1441
|
+
val rumMock = org.mockito.Mockito.mockStatic(Rum::class.java)
|
|
1442
|
+
val traceMock = org.mockito.Mockito.mockStatic(Trace::class.java)
|
|
1443
|
+
val logsMock = org.mockito.Mockito.mockStatic(Logs::class.java)
|
|
1072
1444
|
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
)
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1445
|
+
try {
|
|
1446
|
+
rumMock.`when`<Unit> { Rum.enable(any(), any()) }.then { }
|
|
1447
|
+
logsMock.`when`<Unit> { Logs.enable(any(), any()) }.then { }
|
|
1448
|
+
traceMock.`when`<Unit> { Trace.enable(any(), any()) }.then { }
|
|
1449
|
+
|
|
1450
|
+
// When
|
|
1451
|
+
testedBridgeSdk.initialize(bridgeConfiguration.toReadableJavaOnlyMap(), mockPromise)
|
|
1452
|
+
|
|
1453
|
+
// Then
|
|
1454
|
+
inOrder(mockDatadog) {
|
|
1455
|
+
verify(mockDatadog).initialize(
|
|
1456
|
+
same(mockContext),
|
|
1457
|
+
sdkConfigCaptor.capture(),
|
|
1458
|
+
any()
|
|
1459
|
+
)
|
|
1460
|
+
rumMock.verify { Rum.enable(rumConfigCaptor.capture(), any()) }
|
|
1461
|
+
traceMock.verify { Trace.enable(traceConfigCaptor.capture(), any()) }
|
|
1462
|
+
logsMock.verify { Logs.enable(logsConfigCaptor.capture(), any()) }
|
|
1087
1463
|
}
|
|
1464
|
+
assertThat(rumConfigCaptor.firstValue)
|
|
1465
|
+
.hasField("featureConfiguration") {
|
|
1466
|
+
it.hasFieldEqualTo("trackFrustrations", false)
|
|
1467
|
+
}
|
|
1468
|
+
} finally {
|
|
1469
|
+
rumMock.close()
|
|
1470
|
+
logsMock.close()
|
|
1471
|
+
traceMock.close()
|
|
1472
|
+
}
|
|
1088
1473
|
}
|
|
1089
1474
|
|
|
1090
1475
|
@Test
|
|
@@ -1092,32 +1477,50 @@ internal class DdSdkTest {
|
|
|
1092
1477
|
@Forgery configuration: DdSdkConfiguration
|
|
1093
1478
|
) {
|
|
1094
1479
|
// Given
|
|
1095
|
-
val
|
|
1480
|
+
val rumConfiguration = configuration.rumConfiguration?.copy(
|
|
1096
1481
|
nativeInteractionTracking = true
|
|
1097
1482
|
)
|
|
1483
|
+
val bridgeConfiguration = configuration.copy(
|
|
1484
|
+
rumConfiguration = rumConfiguration
|
|
1485
|
+
)
|
|
1098
1486
|
val sdkConfigCaptor = argumentCaptor<Configuration>()
|
|
1099
1487
|
val rumConfigCaptor = argumentCaptor<RumConfiguration>()
|
|
1100
1488
|
val logsConfigCaptor = argumentCaptor<LogsConfiguration>()
|
|
1101
1489
|
val traceConfigCaptor = argumentCaptor<TraceConfiguration>()
|
|
1102
1490
|
|
|
1103
|
-
|
|
1104
|
-
|
|
1491
|
+
val rumMock = org.mockito.Mockito.mockStatic(Rum::class.java)
|
|
1492
|
+
val traceMock = org.mockito.Mockito.mockStatic(Trace::class.java)
|
|
1493
|
+
val logsMock = org.mockito.Mockito.mockStatic(Logs::class.java)
|
|
1105
1494
|
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
)
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1495
|
+
try {
|
|
1496
|
+
rumMock.`when`<Unit> { Rum.enable(any(), any()) }.then { }
|
|
1497
|
+
logsMock.`when`<Unit> { Logs.enable(any(), any()) }.then { }
|
|
1498
|
+
traceMock.`when`<Unit> { Trace.enable(any(), any()) }.then { }
|
|
1499
|
+
|
|
1500
|
+
// When
|
|
1501
|
+
testedBridgeSdk.initialize(bridgeConfiguration.toReadableJavaOnlyMap(), mockPromise)
|
|
1502
|
+
|
|
1503
|
+
// Then
|
|
1504
|
+
inOrder(mockDatadog) {
|
|
1505
|
+
verify(mockDatadog).initialize(
|
|
1506
|
+
same(mockContext),
|
|
1507
|
+
sdkConfigCaptor.capture(),
|
|
1508
|
+
any()
|
|
1509
|
+
)
|
|
1510
|
+
rumMock.verify { Rum.enable(rumConfigCaptor.capture(), any()) }
|
|
1511
|
+
traceMock.verify { Trace.enable(traceConfigCaptor.capture(), any()) }
|
|
1512
|
+
logsMock.verify { Logs.enable(logsConfigCaptor.capture(), any()) }
|
|
1120
1513
|
}
|
|
1514
|
+
|
|
1515
|
+
assertThat(rumConfigCaptor.firstValue)
|
|
1516
|
+
.hasField("featureConfiguration") {
|
|
1517
|
+
it.hasFieldEqualTo("userActionTracking", true)
|
|
1518
|
+
}
|
|
1519
|
+
} finally {
|
|
1520
|
+
rumMock.close()
|
|
1521
|
+
logsMock.close()
|
|
1522
|
+
traceMock.close()
|
|
1523
|
+
}
|
|
1121
1524
|
}
|
|
1122
1525
|
|
|
1123
1526
|
@Test
|
|
@@ -1164,46 +1567,63 @@ internal class DdSdkTest {
|
|
|
1164
1567
|
@Test
|
|
1165
1568
|
fun `𝕄 initialize native SDK 𝕎 initialize() {custom service name}`(
|
|
1166
1569
|
@Forgery configuration: DdSdkConfiguration,
|
|
1167
|
-
@StringForgery
|
|
1570
|
+
@StringForgery service: String
|
|
1168
1571
|
) {
|
|
1169
1572
|
// Given
|
|
1170
1573
|
val bridgeConfiguration = configuration.copy(
|
|
1171
|
-
|
|
1574
|
+
service = service
|
|
1172
1575
|
)
|
|
1173
1576
|
val sdkConfigCaptor = argumentCaptor<Configuration>()
|
|
1174
1577
|
val rumConfigCaptor = argumentCaptor<RumConfiguration>()
|
|
1175
1578
|
val logsConfigCaptor = argumentCaptor<LogsConfiguration>()
|
|
1176
1579
|
val traceConfigCaptor = argumentCaptor<TraceConfiguration>()
|
|
1177
1580
|
|
|
1178
|
-
|
|
1179
|
-
|
|
1581
|
+
val rumMock = org.mockito.Mockito.mockStatic(Rum::class.java)
|
|
1582
|
+
val traceMock = org.mockito.Mockito.mockStatic(Trace::class.java)
|
|
1583
|
+
val logsMock = org.mockito.Mockito.mockStatic(Logs::class.java)
|
|
1180
1584
|
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
)
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1585
|
+
try {
|
|
1586
|
+
rumMock.`when`<Unit> { Rum.enable(any(), any()) }.then { }
|
|
1587
|
+
logsMock.`when`<Unit> { Logs.enable(any(), any()) }.then { }
|
|
1588
|
+
traceMock.`when`<Unit> { Trace.enable(any(), any()) }.then { }
|
|
1589
|
+
|
|
1590
|
+
// When
|
|
1591
|
+
testedBridgeSdk.initialize(bridgeConfiguration.toReadableJavaOnlyMap(), mockPromise)
|
|
1592
|
+
|
|
1593
|
+
// Then
|
|
1594
|
+
inOrder(mockDatadog) {
|
|
1595
|
+
verify(mockDatadog).initialize(
|
|
1596
|
+
same(mockContext),
|
|
1597
|
+
sdkConfigCaptor.capture(),
|
|
1598
|
+
any()
|
|
1599
|
+
)
|
|
1600
|
+
rumMock.verify { Rum.enable(rumConfigCaptor.capture(), any()) }
|
|
1601
|
+
traceMock.verify { Trace.enable(traceConfigCaptor.capture(), any()) }
|
|
1602
|
+
logsMock.verify { Logs.enable(logsConfigCaptor.capture(), any()) }
|
|
1196
1603
|
}
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
"
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1604
|
+
assertThat(sdkConfigCaptor.firstValue)
|
|
1605
|
+
.hasField("coreConfig") {
|
|
1606
|
+
it.hasFieldEqualTo("needsClearTextHttp", false)
|
|
1607
|
+
it.hasFieldEqualTo("firstPartyHostsWithHeaderTypes", emptyMap<String, String>())
|
|
1608
|
+
}
|
|
1609
|
+
.hasFieldEqualTo("clientToken", bridgeConfiguration.clientToken)
|
|
1610
|
+
.hasFieldEqualTo("env", bridgeConfiguration.env)
|
|
1611
|
+
.hasFieldEqualTo("variant", "")
|
|
1612
|
+
.hasFieldEqualTo("service", service)
|
|
1613
|
+
.hasFieldEqualTo(
|
|
1614
|
+
"additionalConfig",
|
|
1615
|
+
bridgeConfiguration.additionalConfiguration?.filterValues { it != null }.orEmpty() // ktlint-disable-line max-line-length
|
|
1616
|
+
)
|
|
1617
|
+
assertThat(rumConfigCaptor.firstValue)
|
|
1618
|
+
.hasFieldEqualTo(
|
|
1619
|
+
"applicationId",
|
|
1620
|
+
bridgeConfiguration.rumConfiguration?.applicationId
|
|
1621
|
+
)
|
|
1622
|
+
} finally {
|
|
1623
|
+
rumMock.close()
|
|
1624
|
+
logsMock.close()
|
|
1625
|
+
traceMock.close()
|
|
1626
|
+
}
|
|
1207
1627
|
}
|
|
1208
1628
|
|
|
1209
1629
|
@Test
|
|
@@ -1214,39 +1634,55 @@ internal class DdSdkTest {
|
|
|
1214
1634
|
val threshold = forge.aDouble(min = 100.0, max = 65536.0)
|
|
1215
1635
|
|
|
1216
1636
|
// Given
|
|
1217
|
-
val
|
|
1637
|
+
val rumConfiguration = configuration.rumConfiguration?.copy(
|
|
1218
1638
|
nativeLongTaskThresholdMs = threshold
|
|
1219
1639
|
)
|
|
1640
|
+
val bridgeConfiguration = configuration.copy(rumConfiguration = rumConfiguration)
|
|
1641
|
+
|
|
1220
1642
|
val sdkConfigCaptor = argumentCaptor<Configuration>()
|
|
1221
1643
|
val rumConfigCaptor = argumentCaptor<RumConfiguration>()
|
|
1222
1644
|
val logsConfigCaptor = argumentCaptor<LogsConfiguration>()
|
|
1223
1645
|
val traceConfigCaptor = argumentCaptor<TraceConfiguration>()
|
|
1224
1646
|
|
|
1225
|
-
|
|
1226
|
-
|
|
1647
|
+
val rumMock = org.mockito.Mockito.mockStatic(Rum::class.java)
|
|
1648
|
+
val traceMock = org.mockito.Mockito.mockStatic(Trace::class.java)
|
|
1649
|
+
val logsMock = org.mockito.Mockito.mockStatic(Logs::class.java)
|
|
1227
1650
|
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
)
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
)
|
|
1247
|
-
.hasFieldEqualTo("thresholdMs", threshold.toLong())
|
|
1248
|
-
}
|
|
1651
|
+
try {
|
|
1652
|
+
rumMock.`when`<Unit> { Rum.enable(any(), any()) }.then { }
|
|
1653
|
+
logsMock.`when`<Unit> { Logs.enable(any(), any()) }.then { }
|
|
1654
|
+
traceMock.`when`<Unit> { Trace.enable(any(), any()) }.then { }
|
|
1655
|
+
|
|
1656
|
+
// When
|
|
1657
|
+
testedBridgeSdk.initialize(bridgeConfiguration.toReadableJavaOnlyMap(), mockPromise)
|
|
1658
|
+
|
|
1659
|
+
// Then
|
|
1660
|
+
inOrder(mockDatadog) {
|
|
1661
|
+
verify(mockDatadog).initialize(
|
|
1662
|
+
same(mockContext),
|
|
1663
|
+
sdkConfigCaptor.capture(),
|
|
1664
|
+
any()
|
|
1665
|
+
)
|
|
1666
|
+
rumMock.verify { Rum.enable(rumConfigCaptor.capture(), any()) }
|
|
1667
|
+
traceMock.verify { Trace.enable(traceConfigCaptor.capture(), any()) }
|
|
1668
|
+
logsMock.verify { Logs.enable(logsConfigCaptor.capture(), any()) }
|
|
1249
1669
|
}
|
|
1670
|
+
assertThat(rumConfigCaptor.firstValue)
|
|
1671
|
+
.hasField("featureConfiguration") { rumConfig ->
|
|
1672
|
+
rumConfig.hasField("longTaskTrackingStrategy") { longTaskTrackingStrategy ->
|
|
1673
|
+
longTaskTrackingStrategy
|
|
1674
|
+
.isInstanceOf(
|
|
1675
|
+
"com.datadog.android.rum.internal.instrumentation." +
|
|
1676
|
+
"MainLooperLongTaskStrategy"
|
|
1677
|
+
)
|
|
1678
|
+
.hasFieldEqualTo("thresholdMs", threshold.toLong())
|
|
1679
|
+
}
|
|
1680
|
+
}
|
|
1681
|
+
} finally {
|
|
1682
|
+
rumMock.close()
|
|
1683
|
+
logsMock.close()
|
|
1684
|
+
traceMock.close()
|
|
1685
|
+
}
|
|
1250
1686
|
}
|
|
1251
1687
|
|
|
1252
1688
|
@Test
|
|
@@ -1255,32 +1691,47 @@ internal class DdSdkTest {
|
|
|
1255
1691
|
forge: Forge
|
|
1256
1692
|
) {
|
|
1257
1693
|
// Given
|
|
1258
|
-
val
|
|
1694
|
+
val rumConfiguration = configuration.rumConfiguration?.copy(
|
|
1259
1695
|
nativeLongTaskThresholdMs = 0.0
|
|
1260
1696
|
)
|
|
1697
|
+
val bridgeConfiguration = configuration.copy(rumConfiguration = rumConfiguration)
|
|
1261
1698
|
val sdkConfigCaptor = argumentCaptor<Configuration>()
|
|
1262
1699
|
val rumConfigCaptor = argumentCaptor<RumConfiguration>()
|
|
1263
1700
|
val logsConfigCaptor = argumentCaptor<LogsConfiguration>()
|
|
1264
1701
|
val traceConfigCaptor = argumentCaptor<TraceConfiguration>()
|
|
1265
1702
|
|
|
1266
|
-
|
|
1267
|
-
|
|
1703
|
+
val rumMock = org.mockito.Mockito.mockStatic(Rum::class.java)
|
|
1704
|
+
val traceMock = org.mockito.Mockito.mockStatic(Trace::class.java)
|
|
1705
|
+
val logsMock = org.mockito.Mockito.mockStatic(Logs::class.java)
|
|
1268
1706
|
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
)
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1707
|
+
try {
|
|
1708
|
+
rumMock.`when`<Unit> { Rum.enable(any(), any()) }.then { }
|
|
1709
|
+
logsMock.`when`<Unit> { Logs.enable(any(), any()) }.then { }
|
|
1710
|
+
traceMock.`when`<Unit> { Trace.enable(any(), any()) }.then { }
|
|
1711
|
+
|
|
1712
|
+
// When
|
|
1713
|
+
testedBridgeSdk.initialize(bridgeConfiguration.toReadableJavaOnlyMap(), mockPromise)
|
|
1714
|
+
|
|
1715
|
+
// Then
|
|
1716
|
+
inOrder(mockDatadog) {
|
|
1717
|
+
verify(mockDatadog).initialize(
|
|
1718
|
+
same(mockContext),
|
|
1719
|
+
sdkConfigCaptor.capture(),
|
|
1720
|
+
any()
|
|
1721
|
+
)
|
|
1722
|
+
rumMock.verify { Rum.enable(rumConfigCaptor.capture(), any()) }
|
|
1723
|
+
traceMock.verify { Trace.enable(traceConfigCaptor.capture(), any()) }
|
|
1724
|
+
logsMock.verify { Logs.enable(logsConfigCaptor.capture(), any()) }
|
|
1283
1725
|
}
|
|
1726
|
+
assertThat(rumConfigCaptor.firstValue)
|
|
1727
|
+
.hasField("featureConfiguration") { rumConfig ->
|
|
1728
|
+
rumConfig.doesNotHaveField("longTaskTrackingStrategy")
|
|
1729
|
+
}
|
|
1730
|
+
} finally {
|
|
1731
|
+
rumMock.close()
|
|
1732
|
+
logsMock.close()
|
|
1733
|
+
traceMock.close()
|
|
1734
|
+
}
|
|
1284
1735
|
}
|
|
1285
1736
|
|
|
1286
1737
|
@Test
|
|
@@ -1324,27 +1775,41 @@ internal class DdSdkTest {
|
|
|
1324
1775
|
val logsConfigCaptor = argumentCaptor<LogsConfiguration>()
|
|
1325
1776
|
val traceConfigCaptor = argumentCaptor<TraceConfiguration>()
|
|
1326
1777
|
|
|
1327
|
-
|
|
1328
|
-
|
|
1778
|
+
val rumMock = org.mockito.Mockito.mockStatic(Rum::class.java)
|
|
1779
|
+
val traceMock = org.mockito.Mockito.mockStatic(Trace::class.java)
|
|
1780
|
+
val logsMock = org.mockito.Mockito.mockStatic(Logs::class.java)
|
|
1329
1781
|
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
)
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
"firstPartyHostsWithHeaderTypes",
|
|
1345
|
-
tracingHosts
|
|
1782
|
+
try {
|
|
1783
|
+
rumMock.`when`<Unit> { Rum.enable(any(), any()) }.then { }
|
|
1784
|
+
logsMock.`when`<Unit> { Logs.enable(any(), any()) }.then { }
|
|
1785
|
+
traceMock.`when`<Unit> { Trace.enable(any(), any()) }.then { }
|
|
1786
|
+
|
|
1787
|
+
// When
|
|
1788
|
+
testedBridgeSdk.initialize(bridgeConfiguration.toReadableJavaOnlyMap(), mockPromise)
|
|
1789
|
+
|
|
1790
|
+
// Then
|
|
1791
|
+
inOrder(mockDatadog) {
|
|
1792
|
+
verify(mockDatadog).initialize(
|
|
1793
|
+
same(mockContext),
|
|
1794
|
+
sdkConfigCaptor.capture(),
|
|
1795
|
+
any()
|
|
1346
1796
|
)
|
|
1797
|
+
rumMock.verify { Rum.enable(rumConfigCaptor.capture(), any()) }
|
|
1798
|
+
traceMock.verify { Trace.enable(traceConfigCaptor.capture(), any()) }
|
|
1799
|
+
logsMock.verify { Logs.enable(logsConfigCaptor.capture(), any()) }
|
|
1347
1800
|
}
|
|
1801
|
+
assertThat(sdkConfigCaptor.firstValue)
|
|
1802
|
+
.hasField("coreConfig") { coreConfig ->
|
|
1803
|
+
coreConfig.hasFieldEqualTo(
|
|
1804
|
+
"firstPartyHostsWithHeaderTypes",
|
|
1805
|
+
tracingHosts
|
|
1806
|
+
)
|
|
1807
|
+
}
|
|
1808
|
+
} finally {
|
|
1809
|
+
rumMock.close()
|
|
1810
|
+
logsMock.close()
|
|
1811
|
+
traceMock.close()
|
|
1812
|
+
}
|
|
1348
1813
|
}
|
|
1349
1814
|
|
|
1350
1815
|
@Test
|
|
@@ -1383,27 +1848,41 @@ internal class DdSdkTest {
|
|
|
1383
1848
|
val logsConfigCaptor = argumentCaptor<LogsConfiguration>()
|
|
1384
1849
|
val traceConfigCaptor = argumentCaptor<TraceConfiguration>()
|
|
1385
1850
|
|
|
1386
|
-
|
|
1387
|
-
|
|
1851
|
+
val rumMock = org.mockito.Mockito.mockStatic(Rum::class.java)
|
|
1852
|
+
val traceMock = org.mockito.Mockito.mockStatic(Trace::class.java)
|
|
1853
|
+
val logsMock = org.mockito.Mockito.mockStatic(Logs::class.java)
|
|
1388
1854
|
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
)
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
"firstPartyHostsWithHeaderTypes",
|
|
1404
|
-
tracingHosts
|
|
1855
|
+
try {
|
|
1856
|
+
rumMock.`when`<Unit> { Rum.enable(any(), any()) }.then { }
|
|
1857
|
+
logsMock.`when`<Unit> { Logs.enable(any(), any()) }.then { }
|
|
1858
|
+
traceMock.`when`<Unit> { Trace.enable(any(), any()) }.then { }
|
|
1859
|
+
|
|
1860
|
+
// When
|
|
1861
|
+
testedBridgeSdk.initialize(bridgeConfiguration.toReadableJavaOnlyMap(), mockPromise)
|
|
1862
|
+
|
|
1863
|
+
// Then
|
|
1864
|
+
inOrder(mockDatadog) {
|
|
1865
|
+
verify(mockDatadog).initialize(
|
|
1866
|
+
same(mockContext),
|
|
1867
|
+
sdkConfigCaptor.capture(),
|
|
1868
|
+
any()
|
|
1405
1869
|
)
|
|
1870
|
+
rumMock.verify { Rum.enable(rumConfigCaptor.capture(), any()) }
|
|
1871
|
+
traceMock.verify { Trace.enable(traceConfigCaptor.capture(), any()) }
|
|
1872
|
+
logsMock.verify { Logs.enable(logsConfigCaptor.capture(), any()) }
|
|
1406
1873
|
}
|
|
1874
|
+
assertThat(sdkConfigCaptor.firstValue)
|
|
1875
|
+
.hasField("coreConfig") { coreConfig ->
|
|
1876
|
+
coreConfig.hasFieldEqualTo(
|
|
1877
|
+
"firstPartyHostsWithHeaderTypes",
|
|
1878
|
+
tracingHosts
|
|
1879
|
+
)
|
|
1880
|
+
}
|
|
1881
|
+
} finally {
|
|
1882
|
+
rumMock.close()
|
|
1883
|
+
logsMock.close()
|
|
1884
|
+
traceMock.close()
|
|
1885
|
+
}
|
|
1407
1886
|
}
|
|
1408
1887
|
|
|
1409
1888
|
@Test
|
|
@@ -1449,27 +1928,41 @@ internal class DdSdkTest {
|
|
|
1449
1928
|
val logsConfigCaptor = argumentCaptor<LogsConfiguration>()
|
|
1450
1929
|
val traceConfigCaptor = argumentCaptor<TraceConfiguration>()
|
|
1451
1930
|
|
|
1452
|
-
|
|
1453
|
-
|
|
1931
|
+
val rumMock = org.mockito.Mockito.mockStatic(Rum::class.java)
|
|
1932
|
+
val traceMock = org.mockito.Mockito.mockStatic(Trace::class.java)
|
|
1933
|
+
val logsMock = org.mockito.Mockito.mockStatic(Logs::class.java)
|
|
1454
1934
|
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
)
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
"firstPartyHostsWithHeaderTypes",
|
|
1470
|
-
tracingHosts
|
|
1935
|
+
try {
|
|
1936
|
+
rumMock.`when`<Unit> { Rum.enable(any(), any()) }.then { }
|
|
1937
|
+
logsMock.`when`<Unit> { Logs.enable(any(), any()) }.then { }
|
|
1938
|
+
traceMock.`when`<Unit> { Trace.enable(any(), any()) }.then { }
|
|
1939
|
+
|
|
1940
|
+
// When
|
|
1941
|
+
testedBridgeSdk.initialize(bridgeConfiguration.toReadableJavaOnlyMap(), mockPromise)
|
|
1942
|
+
|
|
1943
|
+
// Then
|
|
1944
|
+
inOrder(mockDatadog) {
|
|
1945
|
+
verify(mockDatadog).initialize(
|
|
1946
|
+
same(mockContext),
|
|
1947
|
+
sdkConfigCaptor.capture(),
|
|
1948
|
+
any()
|
|
1471
1949
|
)
|
|
1950
|
+
rumMock.verify { Rum.enable(rumConfigCaptor.capture(), any()) }
|
|
1951
|
+
traceMock.verify { Trace.enable(traceConfigCaptor.capture(), any()) }
|
|
1952
|
+
logsMock.verify { Logs.enable(logsConfigCaptor.capture(), any()) }
|
|
1472
1953
|
}
|
|
1954
|
+
assertThat(sdkConfigCaptor.firstValue)
|
|
1955
|
+
.hasField("coreConfig") { coreConfig ->
|
|
1956
|
+
coreConfig.hasFieldEqualTo(
|
|
1957
|
+
"firstPartyHostsWithHeaderTypes",
|
|
1958
|
+
tracingHosts
|
|
1959
|
+
)
|
|
1960
|
+
}
|
|
1961
|
+
} finally {
|
|
1962
|
+
rumMock.close()
|
|
1963
|
+
logsMock.close()
|
|
1964
|
+
traceMock.close()
|
|
1965
|
+
}
|
|
1473
1966
|
}
|
|
1474
1967
|
|
|
1475
1968
|
@ParameterizedTest
|
|
@@ -1488,27 +1981,41 @@ internal class DdSdkTest {
|
|
|
1488
1981
|
val logsConfigCaptor = argumentCaptor<LogsConfiguration>()
|
|
1489
1982
|
val traceConfigCaptor = argumentCaptor<TraceConfiguration>()
|
|
1490
1983
|
|
|
1491
|
-
|
|
1492
|
-
|
|
1984
|
+
val rumMock = org.mockito.Mockito.mockStatic(Rum::class.java)
|
|
1985
|
+
val traceMock = org.mockito.Mockito.mockStatic(Trace::class.java)
|
|
1986
|
+
val logsMock = org.mockito.Mockito.mockStatic(Logs::class.java)
|
|
1493
1987
|
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
)
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
"uploadFrequency",
|
|
1509
|
-
expectedUploadFrequency
|
|
1988
|
+
try {
|
|
1989
|
+
rumMock.`when`<Unit> { Rum.enable(any(), any()) }.then { }
|
|
1990
|
+
logsMock.`when`<Unit> { Logs.enable(any(), any()) }.then { }
|
|
1991
|
+
traceMock.`when`<Unit> { Trace.enable(any(), any()) }.then { }
|
|
1992
|
+
|
|
1993
|
+
// When
|
|
1994
|
+
testedBridgeSdk.initialize(bridgeConfiguration.toReadableJavaOnlyMap(), mockPromise)
|
|
1995
|
+
|
|
1996
|
+
// Then
|
|
1997
|
+
inOrder(mockDatadog) {
|
|
1998
|
+
verify(mockDatadog).initialize(
|
|
1999
|
+
same(mockContext),
|
|
2000
|
+
sdkConfigCaptor.capture(),
|
|
2001
|
+
any()
|
|
1510
2002
|
)
|
|
2003
|
+
rumMock.verify { Rum.enable(rumConfigCaptor.capture(), any()) }
|
|
2004
|
+
traceMock.verify { Trace.enable(traceConfigCaptor.capture(), any()) }
|
|
2005
|
+
logsMock.verify { Logs.enable(logsConfigCaptor.capture(), any()) }
|
|
1511
2006
|
}
|
|
2007
|
+
assertThat(sdkConfigCaptor.firstValue)
|
|
2008
|
+
.hasField("coreConfig") { coreConfig ->
|
|
2009
|
+
coreConfig.hasFieldEqualTo(
|
|
2010
|
+
"uploadFrequency",
|
|
2011
|
+
expectedUploadFrequency
|
|
2012
|
+
)
|
|
2013
|
+
}
|
|
2014
|
+
} finally {
|
|
2015
|
+
rumMock.close()
|
|
2016
|
+
logsMock.close()
|
|
2017
|
+
traceMock.close()
|
|
2018
|
+
}
|
|
1512
2019
|
}
|
|
1513
2020
|
|
|
1514
2021
|
@ParameterizedTest
|
|
@@ -1527,27 +2034,41 @@ internal class DdSdkTest {
|
|
|
1527
2034
|
val logsConfigCaptor = argumentCaptor<LogsConfiguration>()
|
|
1528
2035
|
val traceConfigCaptor = argumentCaptor<TraceConfiguration>()
|
|
1529
2036
|
|
|
1530
|
-
|
|
1531
|
-
|
|
2037
|
+
val rumMock = org.mockito.Mockito.mockStatic(Rum::class.java)
|
|
2038
|
+
val traceMock = org.mockito.Mockito.mockStatic(Trace::class.java)
|
|
2039
|
+
val logsMock = org.mockito.Mockito.mockStatic(Logs::class.java)
|
|
1532
2040
|
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
)
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
"batchSize",
|
|
1548
|
-
expectedBatchSize
|
|
2041
|
+
try {
|
|
2042
|
+
rumMock.`when`<Unit> { Rum.enable(any(), any()) }.then { }
|
|
2043
|
+
logsMock.`when`<Unit> { Logs.enable(any(), any()) }.then { }
|
|
2044
|
+
traceMock.`when`<Unit> { Trace.enable(any(), any()) }.then { }
|
|
2045
|
+
|
|
2046
|
+
// When
|
|
2047
|
+
testedBridgeSdk.initialize(bridgeConfiguration.toReadableJavaOnlyMap(), mockPromise)
|
|
2048
|
+
|
|
2049
|
+
// Then
|
|
2050
|
+
inOrder(mockDatadog) {
|
|
2051
|
+
verify(mockDatadog).initialize(
|
|
2052
|
+
same(mockContext),
|
|
2053
|
+
sdkConfigCaptor.capture(),
|
|
2054
|
+
any()
|
|
1549
2055
|
)
|
|
2056
|
+
rumMock.verify { Rum.enable(rumConfigCaptor.capture(), any()) }
|
|
2057
|
+
traceMock.verify { Trace.enable(traceConfigCaptor.capture(), any()) }
|
|
2058
|
+
logsMock.verify { Logs.enable(logsConfigCaptor.capture(), any()) }
|
|
1550
2059
|
}
|
|
2060
|
+
assertThat(sdkConfigCaptor.firstValue)
|
|
2061
|
+
.hasField("coreConfig") { coreConfig ->
|
|
2062
|
+
coreConfig.hasFieldEqualTo(
|
|
2063
|
+
"batchSize",
|
|
2064
|
+
expectedBatchSize
|
|
2065
|
+
)
|
|
2066
|
+
}
|
|
2067
|
+
} finally {
|
|
2068
|
+
rumMock.close()
|
|
2069
|
+
logsMock.close()
|
|
2070
|
+
traceMock.close()
|
|
2071
|
+
}
|
|
1551
2072
|
}
|
|
1552
2073
|
|
|
1553
2074
|
@ParameterizedTest
|
|
@@ -1566,27 +2087,41 @@ internal class DdSdkTest {
|
|
|
1566
2087
|
val logsConfigCaptor = argumentCaptor<LogsConfiguration>()
|
|
1567
2088
|
val traceConfigCaptor = argumentCaptor<TraceConfiguration>()
|
|
1568
2089
|
|
|
1569
|
-
|
|
1570
|
-
|
|
2090
|
+
val rumMock = org.mockito.Mockito.mockStatic(Rum::class.java)
|
|
2091
|
+
val traceMock = org.mockito.Mockito.mockStatic(Trace::class.java)
|
|
2092
|
+
val logsMock = org.mockito.Mockito.mockStatic(Logs::class.java)
|
|
1571
2093
|
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
)
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
"batchProcessingLevel",
|
|
1587
|
-
expectedBatchSize
|
|
2094
|
+
try {
|
|
2095
|
+
rumMock.`when`<Unit> { Rum.enable(any(), any()) }.then { }
|
|
2096
|
+
logsMock.`when`<Unit> { Logs.enable(any(), any()) }.then { }
|
|
2097
|
+
traceMock.`when`<Unit> { Trace.enable(any(), any()) }.then { }
|
|
2098
|
+
|
|
2099
|
+
// When
|
|
2100
|
+
testedBridgeSdk.initialize(bridgeConfiguration.toReadableJavaOnlyMap(), mockPromise)
|
|
2101
|
+
|
|
2102
|
+
// Then
|
|
2103
|
+
inOrder(mockDatadog) {
|
|
2104
|
+
verify(mockDatadog).initialize(
|
|
2105
|
+
same(mockContext),
|
|
2106
|
+
sdkConfigCaptor.capture(),
|
|
2107
|
+
any()
|
|
1588
2108
|
)
|
|
2109
|
+
rumMock.verify { Rum.enable(rumConfigCaptor.capture(), any()) }
|
|
2110
|
+
traceMock.verify { Trace.enable(traceConfigCaptor.capture(), any()) }
|
|
2111
|
+
logsMock.verify { Logs.enable(logsConfigCaptor.capture(), any()) }
|
|
1589
2112
|
}
|
|
2113
|
+
assertThat(sdkConfigCaptor.firstValue)
|
|
2114
|
+
.hasField("coreConfig") { coreConfig ->
|
|
2115
|
+
coreConfig.hasFieldEqualTo(
|
|
2116
|
+
"batchProcessingLevel",
|
|
2117
|
+
expectedBatchSize
|
|
2118
|
+
)
|
|
2119
|
+
}
|
|
2120
|
+
} finally {
|
|
2121
|
+
rumMock.close()
|
|
2122
|
+
logsMock.close()
|
|
2123
|
+
traceMock.close()
|
|
2124
|
+
}
|
|
1590
2125
|
}
|
|
1591
2126
|
|
|
1592
2127
|
@Test
|
|
@@ -1596,32 +2131,49 @@ internal class DdSdkTest {
|
|
|
1596
2131
|
) {
|
|
1597
2132
|
// Given
|
|
1598
2133
|
val trackBackgroundEvents = forge.aNullable { forge.aBool() }
|
|
1599
|
-
val
|
|
2134
|
+
val rumConfiguration = configuration.rumConfiguration?.copy(
|
|
1600
2135
|
trackBackgroundEvents = trackBackgroundEvents
|
|
1601
2136
|
)
|
|
2137
|
+
val bridgeConfiguration = configuration.copy(
|
|
2138
|
+
rumConfiguration = rumConfiguration
|
|
2139
|
+
)
|
|
1602
2140
|
val sdkConfigCaptor = argumentCaptor<Configuration>()
|
|
1603
2141
|
val rumConfigCaptor = argumentCaptor<RumConfiguration>()
|
|
1604
2142
|
val logsConfigCaptor = argumentCaptor<LogsConfiguration>()
|
|
1605
2143
|
val traceConfigCaptor = argumentCaptor<TraceConfiguration>()
|
|
1606
2144
|
|
|
1607
|
-
|
|
1608
|
-
|
|
2145
|
+
val rumMock = org.mockito.Mockito.mockStatic(Rum::class.java)
|
|
2146
|
+
val traceMock = org.mockito.Mockito.mockStatic(Trace::class.java)
|
|
2147
|
+
val logsMock = org.mockito.Mockito.mockStatic(Logs::class.java)
|
|
1609
2148
|
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
)
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
2149
|
+
try {
|
|
2150
|
+
rumMock.`when`<Unit> { Rum.enable(any(), any()) }.then { }
|
|
2151
|
+
logsMock.`when`<Unit> { Logs.enable(any(), any()) }.then { }
|
|
2152
|
+
traceMock.`when`<Unit> { Trace.enable(any(), any()) }.then { }
|
|
2153
|
+
|
|
2154
|
+
// When
|
|
2155
|
+
testedBridgeSdk.initialize(bridgeConfiguration.toReadableJavaOnlyMap(), mockPromise)
|
|
2156
|
+
|
|
2157
|
+
// Then
|
|
2158
|
+
inOrder(mockDatadog) {
|
|
2159
|
+
verify(mockDatadog).initialize(
|
|
2160
|
+
same(mockContext),
|
|
2161
|
+
sdkConfigCaptor.capture(),
|
|
2162
|
+
any()
|
|
2163
|
+
)
|
|
2164
|
+
rumMock.verify { Rum.enable(rumConfigCaptor.capture(), any()) }
|
|
2165
|
+
traceMock.verify { Trace.enable(traceConfigCaptor.capture(), any()) }
|
|
2166
|
+
logsMock.verify { Logs.enable(logsConfigCaptor.capture(), any()) }
|
|
1624
2167
|
}
|
|
2168
|
+
assertThat(rumConfigCaptor.firstValue)
|
|
2169
|
+
.hasField("featureConfiguration") {
|
|
2170
|
+
it.hasFieldEqualTo("backgroundEventTracking", trackBackgroundEvents ?: false)
|
|
2171
|
+
}
|
|
2172
|
+
} finally {
|
|
2173
|
+
rumMock.close()
|
|
2174
|
+
logsMock.close()
|
|
2175
|
+
traceMock.close()
|
|
2176
|
+
}
|
|
1625
2177
|
}
|
|
1626
2178
|
|
|
1627
2179
|
@Test
|
|
@@ -1629,36 +2181,51 @@ internal class DdSdkTest {
|
|
|
1629
2181
|
@Forgery configuration: DdSdkConfiguration
|
|
1630
2182
|
) {
|
|
1631
2183
|
// Given
|
|
2184
|
+
val rumConfiguration = configuration.rumConfiguration?.copy(vitalsUpdateFrequency = "RARE")
|
|
1632
2185
|
val bridgeConfiguration = configuration.copy(
|
|
1633
|
-
|
|
2186
|
+
rumConfiguration = rumConfiguration
|
|
1634
2187
|
)
|
|
1635
2188
|
val sdkConfigCaptor = argumentCaptor<Configuration>()
|
|
1636
2189
|
val rumConfigCaptor = argumentCaptor<RumConfiguration>()
|
|
1637
2190
|
val logsConfigCaptor = argumentCaptor<LogsConfiguration>()
|
|
1638
2191
|
val traceConfigCaptor = argumentCaptor<TraceConfiguration>()
|
|
1639
2192
|
|
|
1640
|
-
|
|
1641
|
-
|
|
2193
|
+
val rumMock = org.mockito.Mockito.mockStatic(Rum::class.java)
|
|
2194
|
+
val traceMock = org.mockito.Mockito.mockStatic(Trace::class.java)
|
|
2195
|
+
val logsMock = org.mockito.Mockito.mockStatic(Logs::class.java)
|
|
1642
2196
|
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
)
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
2197
|
+
try {
|
|
2198
|
+
rumMock.`when`<Unit> { Rum.enable(any(), any()) }.then { }
|
|
2199
|
+
logsMock.`when`<Unit> { Logs.enable(any(), any()) }.then { }
|
|
2200
|
+
traceMock.`when`<Unit> { Trace.enable(any(), any()) }.then { }
|
|
2201
|
+
|
|
2202
|
+
// When
|
|
2203
|
+
testedBridgeSdk.initialize(bridgeConfiguration.toReadableJavaOnlyMap(), mockPromise)
|
|
2204
|
+
|
|
2205
|
+
// Then
|
|
2206
|
+
inOrder(mockDatadog) {
|
|
2207
|
+
verify(mockDatadog).initialize(
|
|
2208
|
+
same(mockContext),
|
|
2209
|
+
sdkConfigCaptor.capture(),
|
|
2210
|
+
any()
|
|
2211
|
+
)
|
|
2212
|
+
rumMock.verify { Rum.enable(rumConfigCaptor.capture(), any()) }
|
|
2213
|
+
traceMock.verify { Trace.enable(traceConfigCaptor.capture(), any()) }
|
|
2214
|
+
logsMock.verify { Logs.enable(logsConfigCaptor.capture(), any()) }
|
|
1657
2215
|
}
|
|
2216
|
+
assertThat(rumConfigCaptor.firstValue)
|
|
2217
|
+
.hasField("featureConfiguration") {
|
|
2218
|
+
it.hasFieldEqualTo("vitalsMonitorUpdateFrequency", VitalsUpdateFrequency.RARE)
|
|
2219
|
+
}
|
|
1658
2220
|
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
2221
|
+
argumentCaptor<Choreographer.FrameCallback> {
|
|
2222
|
+
verify(mockChoreographer).postFrameCallback(capture())
|
|
2223
|
+
assertThat(firstValue).isInstanceOf(FpsFrameCallback::class.java)
|
|
2224
|
+
}
|
|
2225
|
+
} finally {
|
|
2226
|
+
rumMock.close()
|
|
2227
|
+
logsMock.close()
|
|
2228
|
+
traceMock.close()
|
|
1662
2229
|
}
|
|
1663
2230
|
}
|
|
1664
2231
|
|
|
@@ -1668,34 +2235,49 @@ internal class DdSdkTest {
|
|
|
1668
2235
|
) {
|
|
1669
2236
|
// Given
|
|
1670
2237
|
doThrow(IllegalStateException()).whenever(mockChoreographer).postFrameCallback(any())
|
|
1671
|
-
val
|
|
2238
|
+
val rumConfiguration = configuration.rumConfiguration?.copy(
|
|
1672
2239
|
vitalsUpdateFrequency = "NEVER",
|
|
1673
2240
|
longTaskThresholdMs = 0.0
|
|
1674
2241
|
)
|
|
2242
|
+
val bridgeConfiguration = configuration.copy(
|
|
2243
|
+
rumConfiguration = rumConfiguration
|
|
2244
|
+
)
|
|
1675
2245
|
val sdkConfigCaptor = argumentCaptor<Configuration>()
|
|
1676
2246
|
val rumConfigCaptor = argumentCaptor<RumConfiguration>()
|
|
1677
2247
|
val logsConfigCaptor = argumentCaptor<LogsConfiguration>()
|
|
1678
2248
|
val traceConfigCaptor = argumentCaptor<TraceConfiguration>()
|
|
1679
2249
|
|
|
1680
|
-
|
|
1681
|
-
|
|
2250
|
+
val rumMock = org.mockito.Mockito.mockStatic(Rum::class.java)
|
|
2251
|
+
val traceMock = org.mockito.Mockito.mockStatic(Trace::class.java)
|
|
2252
|
+
val logsMock = org.mockito.Mockito.mockStatic(Logs::class.java)
|
|
1682
2253
|
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
2254
|
+
try {
|
|
2255
|
+
rumMock.`when`<Unit> { Rum.enable(any(), any()) }.then { }
|
|
2256
|
+
logsMock.`when`<Unit> { Logs.enable(any(), any()) }.then { }
|
|
2257
|
+
traceMock.`when`<Unit> { Trace.enable(any(), any()) }.then { } // When
|
|
2258
|
+
testedBridgeSdk.initialize(bridgeConfiguration.toReadableJavaOnlyMap(), mockPromise)
|
|
2259
|
+
|
|
2260
|
+
// Then
|
|
2261
|
+
inOrder(mockDatadog) {
|
|
2262
|
+
verify(mockDatadog).initialize(
|
|
2263
|
+
same(mockContext),
|
|
2264
|
+
sdkConfigCaptor.capture(),
|
|
2265
|
+
any()
|
|
2266
|
+
)
|
|
2267
|
+
rumMock.verify { Rum.enable(rumConfigCaptor.capture(), any()) }
|
|
2268
|
+
traceMock.verify { Trace.enable(traceConfigCaptor.capture(), any()) }
|
|
2269
|
+
logsMock.verify { Logs.enable(logsConfigCaptor.capture(), any()) }
|
|
1697
2270
|
}
|
|
1698
|
-
|
|
2271
|
+
assertThat(rumConfigCaptor.firstValue)
|
|
2272
|
+
.hasField("featureConfiguration") {
|
|
2273
|
+
it.hasFieldEqualTo("vitalsMonitorUpdateFrequency", VitalsUpdateFrequency.NEVER)
|
|
2274
|
+
}
|
|
2275
|
+
verifyNoInteractions(mockChoreographer)
|
|
2276
|
+
} finally {
|
|
2277
|
+
rumMock.close()
|
|
2278
|
+
logsMock.close()
|
|
2279
|
+
traceMock.close()
|
|
2280
|
+
}
|
|
1699
2281
|
}
|
|
1700
2282
|
|
|
1701
2283
|
@Test
|
|
@@ -1707,53 +2289,71 @@ internal class DdSdkTest {
|
|
|
1707
2289
|
@Forgery configuration: DdSdkConfiguration
|
|
1708
2290
|
) {
|
|
1709
2291
|
// Given
|
|
1710
|
-
val
|
|
2292
|
+
val rumConfiguration = configuration.rumConfiguration?.copy(
|
|
1711
2293
|
vitalsUpdateFrequency = fakeFrequency,
|
|
1712
2294
|
longTaskThresholdMs = 0.0
|
|
1713
2295
|
)
|
|
2296
|
+
val bridgeConfiguration = configuration.copy(
|
|
2297
|
+
rumConfiguration = rumConfiguration
|
|
2298
|
+
)
|
|
1714
2299
|
val sdkConfigCaptor = argumentCaptor<Configuration>()
|
|
1715
2300
|
val rumConfigCaptor = argumentCaptor<RumConfiguration>()
|
|
1716
2301
|
val logsConfigCaptor = argumentCaptor<LogsConfiguration>()
|
|
1717
2302
|
val traceConfigCaptor = argumentCaptor<TraceConfiguration>()
|
|
1718
2303
|
val frameDurationNs = threshold + frameDurationOverThreshold
|
|
1719
2304
|
|
|
1720
|
-
|
|
1721
|
-
|
|
2305
|
+
val rumMock = org.mockito.Mockito.mockStatic(Rum::class.java)
|
|
2306
|
+
val traceMock = org.mockito.Mockito.mockStatic(Trace::class.java)
|
|
2307
|
+
val logsMock = org.mockito.Mockito.mockStatic(Logs::class.java)
|
|
1722
2308
|
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
2309
|
+
try {
|
|
2310
|
+
rumMock.`when`<Unit> { Rum.enable(any(), any()) }.then { }
|
|
2311
|
+
logsMock.`when`<Unit> { Logs.enable(any(), any()) }.then { }
|
|
2312
|
+
traceMock.`when`<Unit> { Trace.enable(any(), any()) }.then { } // When
|
|
2313
|
+
testedBridgeSdk.initialize(bridgeConfiguration.toReadableJavaOnlyMap(), mockPromise)
|
|
2314
|
+
|
|
2315
|
+
// Then
|
|
2316
|
+
inOrder(mockDatadog) {
|
|
2317
|
+
verify(mockDatadog).initialize(
|
|
2318
|
+
same(mockContext),
|
|
2319
|
+
sdkConfigCaptor.capture(),
|
|
2320
|
+
any()
|
|
2321
|
+
)
|
|
2322
|
+
rumMock.verify { Rum.enable(rumConfigCaptor.capture(), any()) }
|
|
2323
|
+
traceMock.verify { Trace.enable(traceConfigCaptor.capture(), any()) }
|
|
2324
|
+
logsMock.verify { Logs.enable(logsConfigCaptor.capture(), any()) }
|
|
1737
2325
|
}
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
2326
|
+
assertThat(rumConfigCaptor.firstValue)
|
|
2327
|
+
.hasField("featureConfiguration") {
|
|
2328
|
+
it.hasFieldEqualTo(
|
|
2329
|
+
"vitalsMonitorUpdateFrequency",
|
|
2330
|
+
VitalsUpdateFrequency.AVERAGE
|
|
2331
|
+
)
|
|
2332
|
+
}
|
|
2333
|
+
argumentCaptor<Choreographer.FrameCallback> {
|
|
2334
|
+
verify(mockChoreographer).postFrameCallback(capture())
|
|
2335
|
+
assertThat(firstValue).isInstanceOf(FpsFrameCallback::class.java)
|
|
2336
|
+
|
|
2337
|
+
// When
|
|
2338
|
+
firstValue.doFrame(timestampNs)
|
|
2339
|
+
firstValue.doFrame(timestampNs + frameDurationNs)
|
|
2340
|
+
|
|
2341
|
+
// then
|
|
2342
|
+
verify(mockRumMonitor._getInternal()!!).updatePerformanceMetric(
|
|
2343
|
+
RumPerformanceMetric.JS_FRAME_TIME,
|
|
2344
|
+
frameDurationNs.toDouble()
|
|
2345
|
+
)
|
|
2346
|
+
verify(mockRumMonitor._getInternal()!!, never()).addLongTask(
|
|
2347
|
+
frameDurationNs,
|
|
2348
|
+
"javascript"
|
|
2349
|
+
)
|
|
2350
|
+
}
|
|
2351
|
+
} finally {
|
|
2352
|
+
rumMock.close()
|
|
2353
|
+
logsMock.close()
|
|
2354
|
+
traceMock.close()
|
|
2355
|
+
}
|
|
2356
|
+
}
|
|
1757
2357
|
|
|
1758
2358
|
@Test
|
|
1759
2359
|
fun `𝕄 send long tasks 𝕎 frame time is over threshold() {}`(
|
|
@@ -1763,10 +2363,13 @@ internal class DdSdkTest {
|
|
|
1763
2363
|
@Forgery configuration: DdSdkConfiguration
|
|
1764
2364
|
) {
|
|
1765
2365
|
// Given
|
|
1766
|
-
val
|
|
2366
|
+
val rumConfiguration = configuration.rumConfiguration?.copy(
|
|
1767
2367
|
vitalsUpdateFrequency = "AVERAGE",
|
|
1768
2368
|
longTaskThresholdMs = (threshold / 1_000_000).toDouble()
|
|
1769
2369
|
)
|
|
2370
|
+
val bridgeConfiguration = configuration.copy(
|
|
2371
|
+
rumConfiguration = rumConfiguration
|
|
2372
|
+
)
|
|
1770
2373
|
val frameDurationNs = threshold + frameDurationOverThreshold
|
|
1771
2374
|
|
|
1772
2375
|
// When
|
|
@@ -1800,10 +2403,13 @@ internal class DdSdkTest {
|
|
|
1800
2403
|
@Forgery configuration: DdSdkConfiguration
|
|
1801
2404
|
) {
|
|
1802
2405
|
// Given
|
|
1803
|
-
val
|
|
2406
|
+
val rumConfiguration = configuration.rumConfiguration?.copy(
|
|
1804
2407
|
vitalsUpdateFrequency = "NEVER",
|
|
1805
2408
|
longTaskThresholdMs = (threshold / 1_000_000).toDouble()
|
|
1806
2409
|
)
|
|
2410
|
+
val bridgeConfiguration = configuration.copy(
|
|
2411
|
+
rumConfiguration = rumConfiguration
|
|
2412
|
+
)
|
|
1807
2413
|
val frameDurationNs = threshold + frameDurationOverThreshold
|
|
1808
2414
|
|
|
1809
2415
|
// When
|
|
@@ -1838,31 +2444,49 @@ internal class DdSdkTest {
|
|
|
1838
2444
|
@Forgery configuration: DdSdkConfiguration
|
|
1839
2445
|
) {
|
|
1840
2446
|
// Given
|
|
2447
|
+
val rumConfiguration = configuration.rumConfiguration?.copy(
|
|
2448
|
+
initialResourceThreshold = null
|
|
2449
|
+
)
|
|
2450
|
+
val bridgeConfiguration = configuration.copy(
|
|
2451
|
+
rumConfiguration = rumConfiguration
|
|
2452
|
+
)
|
|
1841
2453
|
val sdkConfigCaptor = argumentCaptor<Configuration>()
|
|
1842
2454
|
val rumConfigCaptor = argumentCaptor<RumConfiguration>()
|
|
1843
2455
|
val logsConfigCaptor = argumentCaptor<LogsConfiguration>()
|
|
1844
2456
|
val traceConfigCaptor = argumentCaptor<TraceConfiguration>()
|
|
1845
2457
|
val defaultTimeBasedIdentifier = TimeBasedInitialResourceIdentifier(100)
|
|
1846
2458
|
|
|
1847
|
-
|
|
1848
|
-
|
|
2459
|
+
val rumMock = org.mockito.Mockito.mockStatic(Rum::class.java)
|
|
2460
|
+
val traceMock = org.mockito.Mockito.mockStatic(Trace::class.java)
|
|
2461
|
+
val logsMock = org.mockito.Mockito.mockStatic(Logs::class.java)
|
|
1849
2462
|
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
any()
|
|
1856
|
-
)
|
|
1857
|
-
verify(mockDatadog).enableRum(rumConfigCaptor.capture())
|
|
1858
|
-
verify(mockDatadog).enableTrace(traceConfigCaptor.capture())
|
|
1859
|
-
verify(mockDatadog).enableLogs(logsConfigCaptor.capture())
|
|
1860
|
-
}
|
|
2463
|
+
try {
|
|
2464
|
+
rumMock.`when`<Unit> { Rum.enable(any(), any()) }.then { }
|
|
2465
|
+
logsMock.`when`<Unit> { Logs.enable(any(), any()) }.then { }
|
|
2466
|
+
traceMock.`when`<Unit> { Trace.enable(any(), any()) }.then { } // When
|
|
2467
|
+
testedBridgeSdk.initialize(bridgeConfiguration.toReadableJavaOnlyMap(), mockPromise)
|
|
1861
2468
|
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
2469
|
+
// Then
|
|
2470
|
+
inOrder(mockDatadog) {
|
|
2471
|
+
verify(mockDatadog).initialize(
|
|
2472
|
+
same(mockContext),
|
|
2473
|
+
sdkConfigCaptor.capture(),
|
|
2474
|
+
any()
|
|
2475
|
+
)
|
|
2476
|
+
rumMock.verify { Rum.enable(rumConfigCaptor.capture(), any()) }
|
|
2477
|
+
traceMock.verify { Trace.enable(traceConfigCaptor.capture(), any()) }
|
|
2478
|
+
logsMock.verify { Logs.enable(logsConfigCaptor.capture(), any()) }
|
|
1865
2479
|
}
|
|
2480
|
+
|
|
2481
|
+
assertThat(rumConfigCaptor.firstValue)
|
|
2482
|
+
.hasField("featureConfiguration") {
|
|
2483
|
+
it.hasFieldEqualTo("initialResourceIdentifier", defaultTimeBasedIdentifier)
|
|
2484
|
+
}
|
|
2485
|
+
} finally {
|
|
2486
|
+
rumMock.close()
|
|
2487
|
+
logsMock.close()
|
|
2488
|
+
traceMock.close()
|
|
2489
|
+
}
|
|
1866
2490
|
}
|
|
1867
2491
|
|
|
1868
2492
|
@Test
|
|
@@ -1871,9 +2495,12 @@ internal class DdSdkTest {
|
|
|
1871
2495
|
@Forgery configuration: DdSdkConfiguration
|
|
1872
2496
|
) {
|
|
1873
2497
|
// Given
|
|
1874
|
-
val
|
|
2498
|
+
val rumConfiguration = configuration.rumConfiguration?.copy(
|
|
1875
2499
|
initialResourceThreshold = thresholdInSeconds
|
|
1876
2500
|
)
|
|
2501
|
+
val bridgeConfiguration = configuration.copy(
|
|
2502
|
+
rumConfiguration = rumConfiguration
|
|
2503
|
+
)
|
|
1877
2504
|
val sdkConfigCaptor = argumentCaptor<Configuration>()
|
|
1878
2505
|
val rumConfigCaptor = argumentCaptor<RumConfiguration>()
|
|
1879
2506
|
val logsConfigCaptor = argumentCaptor<LogsConfiguration>()
|
|
@@ -1882,25 +2509,37 @@ internal class DdSdkTest {
|
|
|
1882
2509
|
thresholdInSeconds.seconds.inWholeMilliseconds
|
|
1883
2510
|
)
|
|
1884
2511
|
|
|
1885
|
-
|
|
1886
|
-
|
|
2512
|
+
val rumMock = org.mockito.Mockito.mockStatic(Rum::class.java)
|
|
2513
|
+
val traceMock = org.mockito.Mockito.mockStatic(Trace::class.java)
|
|
2514
|
+
val logsMock = org.mockito.Mockito.mockStatic(Logs::class.java)
|
|
1887
2515
|
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
any()
|
|
1894
|
-
)
|
|
1895
|
-
verify(mockDatadog).enableRum(rumConfigCaptor.capture())
|
|
1896
|
-
verify(mockDatadog).enableTrace(traceConfigCaptor.capture())
|
|
1897
|
-
verify(mockDatadog).enableLogs(logsConfigCaptor.capture())
|
|
1898
|
-
}
|
|
2516
|
+
try {
|
|
2517
|
+
rumMock.`when`<Unit> { Rum.enable(any(), any()) }.then { }
|
|
2518
|
+
logsMock.`when`<Unit> { Logs.enable(any(), any()) }.then { }
|
|
2519
|
+
traceMock.`when`<Unit> { Trace.enable(any(), any()) }.then { } // When
|
|
2520
|
+
testedBridgeSdk.initialize(bridgeConfiguration.toReadableJavaOnlyMap(), mockPromise)
|
|
1899
2521
|
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
2522
|
+
// Then
|
|
2523
|
+
inOrder(mockDatadog) {
|
|
2524
|
+
verify(mockDatadog).initialize(
|
|
2525
|
+
same(mockContext),
|
|
2526
|
+
sdkConfigCaptor.capture(),
|
|
2527
|
+
any()
|
|
2528
|
+
)
|
|
2529
|
+
rumMock.verify { Rum.enable(rumConfigCaptor.capture(), any()) }
|
|
2530
|
+
traceMock.verify { Trace.enable(traceConfigCaptor.capture(), any()) }
|
|
2531
|
+
logsMock.verify { Logs.enable(logsConfigCaptor.capture(), any()) }
|
|
1903
2532
|
}
|
|
2533
|
+
|
|
2534
|
+
assertThat(rumConfigCaptor.firstValue)
|
|
2535
|
+
.hasField("featureConfiguration") {
|
|
2536
|
+
it.hasFieldEqualTo("initialResourceIdentifier", timeBasedIdentifier)
|
|
2537
|
+
}
|
|
2538
|
+
} finally {
|
|
2539
|
+
rumMock.close()
|
|
2540
|
+
logsMock.close()
|
|
2541
|
+
traceMock.close()
|
|
2542
|
+
}
|
|
1904
2543
|
}
|
|
1905
2544
|
|
|
1906
2545
|
// endregion
|
|
@@ -1914,7 +2553,7 @@ internal class DdSdkTest {
|
|
|
1914
2553
|
) {
|
|
1915
2554
|
// Given
|
|
1916
2555
|
val bridgeConfiguration = configuration.copy(
|
|
1917
|
-
|
|
2556
|
+
additionalConfiguration = mapOf(
|
|
1918
2557
|
DdSdkImplementation.DD_VERSION_SUFFIX to versionSuffix
|
|
1919
2558
|
)
|
|
1920
2559
|
)
|
|
@@ -1923,28 +2562,42 @@ internal class DdSdkTest {
|
|
|
1923
2562
|
val logsConfigCaptor = argumentCaptor<LogsConfiguration>()
|
|
1924
2563
|
val traceConfigCaptor = argumentCaptor<TraceConfiguration>()
|
|
1925
2564
|
|
|
1926
|
-
|
|
1927
|
-
|
|
2565
|
+
val rumMock = org.mockito.Mockito.mockStatic(Rum::class.java)
|
|
2566
|
+
val traceMock = org.mockito.Mockito.mockStatic(Trace::class.java)
|
|
2567
|
+
val logsMock = org.mockito.Mockito.mockStatic(Logs::class.java)
|
|
1928
2568
|
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
.hasFieldEqualTo(
|
|
1942
|
-
"additionalConfig",
|
|
1943
|
-
mapOf(
|
|
1944
|
-
DdSdkImplementation.DD_VERSION_SUFFIX to versionSuffix,
|
|
1945
|
-
DdSdkImplementation.DD_VERSION to mockPackageInfo.versionName + versionSuffix
|
|
2569
|
+
try {
|
|
2570
|
+
rumMock.`when`<Unit> { Rum.enable(any(), any()) }.then { }
|
|
2571
|
+
logsMock.`when`<Unit> { Logs.enable(any(), any()) }.then { }
|
|
2572
|
+
traceMock.`when`<Unit> { Trace.enable(any(), any()) }.then { } // When
|
|
2573
|
+
testedBridgeSdk.initialize(bridgeConfiguration.toReadableJavaOnlyMap(), mockPromise)
|
|
2574
|
+
|
|
2575
|
+
// Then
|
|
2576
|
+
inOrder(mockDatadog) {
|
|
2577
|
+
verify(mockDatadog).initialize(
|
|
2578
|
+
same(mockContext),
|
|
2579
|
+
sdkConfigCaptor.capture(),
|
|
2580
|
+
any()
|
|
1946
2581
|
)
|
|
1947
|
-
|
|
2582
|
+
rumMock.verify { Rum.enable(rumConfigCaptor.capture(), any()) }
|
|
2583
|
+
traceMock.verify { Trace.enable(traceConfigCaptor.capture(), any()) }
|
|
2584
|
+
logsMock.verify { Logs.enable(logsConfigCaptor.capture(), any()) }
|
|
2585
|
+
}
|
|
2586
|
+
assertThat(sdkConfigCaptor.firstValue)
|
|
2587
|
+
.hasFieldEqualTo(
|
|
2588
|
+
"additionalConfig",
|
|
2589
|
+
mapOf(
|
|
2590
|
+
DdSdkImplementation.DD_VERSION_SUFFIX to versionSuffix,
|
|
2591
|
+
DdSdkImplementation.DD_VERSION to (
|
|
2592
|
+
mockPackageInfo.versionName + versionSuffix
|
|
2593
|
+
)
|
|
2594
|
+
)
|
|
2595
|
+
)
|
|
2596
|
+
} finally {
|
|
2597
|
+
rumMock.close()
|
|
2598
|
+
logsMock.close()
|
|
2599
|
+
traceMock.close()
|
|
2600
|
+
}
|
|
1948
2601
|
}
|
|
1949
2602
|
|
|
1950
2603
|
// endregion
|
|
@@ -1965,10 +2618,13 @@ internal class DdSdkTest {
|
|
|
1965
2618
|
@StringForgery reactNativeVersion: String
|
|
1966
2619
|
) {
|
|
1967
2620
|
// Given
|
|
1968
|
-
val
|
|
1969
|
-
nativeCrashReportEnabled = trackNativeErrors,
|
|
1970
|
-
nativeLongTaskThresholdMs = 0.0,
|
|
2621
|
+
val rumConfiguration = configuration.rumConfiguration?.copy(
|
|
1971
2622
|
longTaskThresholdMs = 0.0,
|
|
2623
|
+
nativeCrashReportEnabled = trackNativeErrors,
|
|
2624
|
+
nativeLongTaskThresholdMs = 0.0
|
|
2625
|
+
)
|
|
2626
|
+
val bridgeConfiguration = configuration.copy(
|
|
2627
|
+
rumConfiguration = rumConfiguration,
|
|
1972
2628
|
configurationForTelemetry = ConfigurationForTelemetry(
|
|
1973
2629
|
initializationType = initializationType,
|
|
1974
2630
|
trackErrors = trackErrors,
|
|
@@ -1983,47 +2639,59 @@ internal class DdSdkTest {
|
|
|
1983
2639
|
val logsConfigCaptor = argumentCaptor<LogsConfiguration>()
|
|
1984
2640
|
val traceConfigCaptor = argumentCaptor<TraceConfiguration>()
|
|
1985
2641
|
|
|
1986
|
-
|
|
1987
|
-
|
|
2642
|
+
val rumMock = org.mockito.Mockito.mockStatic(Rum::class.java)
|
|
2643
|
+
val traceMock = org.mockito.Mockito.mockStatic(Trace::class.java)
|
|
2644
|
+
val logsMock = org.mockito.Mockito.mockStatic(Logs::class.java)
|
|
1988
2645
|
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
)
|
|
2006
|
-
val result = configurationMapper.map(telemetryConfigurationEvent)!!
|
|
2007
|
-
assertThat(result.telemetry.configuration.trackNativeErrors!!).isEqualTo(
|
|
2008
|
-
trackNativeErrors
|
|
2009
|
-
)
|
|
2010
|
-
assertThat(result.telemetry.configuration.trackCrossPlatformLongTasks!!)
|
|
2011
|
-
.isEqualTo(false)
|
|
2012
|
-
assertThat(result.telemetry.configuration.trackLongTask!!)
|
|
2013
|
-
.isEqualTo(false)
|
|
2014
|
-
assertThat(result.telemetry.configuration.trackNativeLongTasks!!)
|
|
2015
|
-
.isEqualTo(false)
|
|
2016
|
-
|
|
2017
|
-
assertThat(result.telemetry.configuration.initializationType!!)
|
|
2018
|
-
.isEqualTo(initializationType)
|
|
2019
|
-
assertThat(result.telemetry.configuration.trackInteractions!!)
|
|
2020
|
-
.isEqualTo(trackInteractions)
|
|
2021
|
-
assertThat(result.telemetry.configuration.trackErrors!!).isEqualTo(trackErrors)
|
|
2022
|
-
assertThat(result.telemetry.configuration.trackResources!!)
|
|
2023
|
-
.isEqualTo(trackNetworkRequests)
|
|
2024
|
-
assertThat(result.telemetry.configuration.trackNetworkRequests!!)
|
|
2025
|
-
.isEqualTo(trackNetworkRequests)
|
|
2646
|
+
try {
|
|
2647
|
+
rumMock.`when`<Unit> { Rum.enable(any(), any()) }.then { }
|
|
2648
|
+
logsMock.`when`<Unit> { Logs.enable(any(), any()) }.then { }
|
|
2649
|
+
traceMock.`when`<Unit> { Trace.enable(any(), any()) }.then { } // When
|
|
2650
|
+
testedBridgeSdk.initialize(bridgeConfiguration.toReadableJavaOnlyMap(), mockPromise)
|
|
2651
|
+
|
|
2652
|
+
// Then
|
|
2653
|
+
inOrder(mockDatadog) {
|
|
2654
|
+
verify(mockDatadog).initialize(
|
|
2655
|
+
same(mockContext),
|
|
2656
|
+
sdkConfigCaptor.capture(),
|
|
2657
|
+
any()
|
|
2658
|
+
)
|
|
2659
|
+
rumMock.verify { Rum.enable(rumConfigCaptor.capture(), any()) }
|
|
2660
|
+
traceMock.verify { Trace.enable(traceConfigCaptor.capture(), any()) }
|
|
2661
|
+
logsMock.verify { Logs.enable(logsConfigCaptor.capture(), any()) }
|
|
2026
2662
|
}
|
|
2663
|
+
assertThat(rumConfigCaptor.firstValue)
|
|
2664
|
+
.hasField("featureConfiguration") {
|
|
2665
|
+
val configurationMapper = it
|
|
2666
|
+
.getActualValue<EventMapper<TelemetryConfigurationEvent>>(
|
|
2667
|
+
"telemetryConfigurationMapper"
|
|
2668
|
+
)
|
|
2669
|
+
val result = configurationMapper.map(telemetryConfigurationEvent)!!
|
|
2670
|
+
assertThat(result.telemetry.configuration.trackNativeErrors!!).isEqualTo(
|
|
2671
|
+
trackNativeErrors
|
|
2672
|
+
)
|
|
2673
|
+
assertThat(result.telemetry.configuration.trackCrossPlatformLongTasks!!)
|
|
2674
|
+
.isEqualTo(false)
|
|
2675
|
+
assertThat(result.telemetry.configuration.trackLongTask!!)
|
|
2676
|
+
.isEqualTo(false)
|
|
2677
|
+
assertThat(result.telemetry.configuration.trackNativeLongTasks!!)
|
|
2678
|
+
.isEqualTo(false)
|
|
2679
|
+
|
|
2680
|
+
assertThat(result.telemetry.configuration.initializationType!!)
|
|
2681
|
+
.isEqualTo(initializationType)
|
|
2682
|
+
assertThat(result.telemetry.configuration.trackInteractions!!)
|
|
2683
|
+
.isEqualTo(trackInteractions)
|
|
2684
|
+
assertThat(result.telemetry.configuration.trackErrors!!).isEqualTo(trackErrors)
|
|
2685
|
+
assertThat(result.telemetry.configuration.trackResources!!)
|
|
2686
|
+
.isEqualTo(trackNetworkRequests)
|
|
2687
|
+
assertThat(result.telemetry.configuration.trackNetworkRequests!!)
|
|
2688
|
+
.isEqualTo(trackNetworkRequests)
|
|
2689
|
+
}
|
|
2690
|
+
} finally {
|
|
2691
|
+
rumMock.close()
|
|
2692
|
+
logsMock.close()
|
|
2693
|
+
traceMock.close()
|
|
2694
|
+
}
|
|
2027
2695
|
}
|
|
2028
2696
|
|
|
2029
2697
|
// endregion
|
|
@@ -2040,27 +2708,39 @@ internal class DdSdkTest {
|
|
|
2040
2708
|
val logsConfigCaptor = argumentCaptor<LogsConfiguration>()
|
|
2041
2709
|
val traceConfigCaptor = argumentCaptor<TraceConfiguration>()
|
|
2042
2710
|
|
|
2043
|
-
|
|
2044
|
-
|
|
2711
|
+
val rumMock = org.mockito.Mockito.mockStatic(Rum::class.java)
|
|
2712
|
+
val traceMock = org.mockito.Mockito.mockStatic(Trace::class.java)
|
|
2713
|
+
val logsMock = org.mockito.Mockito.mockStatic(Logs::class.java)
|
|
2045
2714
|
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
assertThat(notDroppedEvent).isNotNull
|
|
2715
|
+
try {
|
|
2716
|
+
rumMock.`when`<Unit> { Rum.enable(any(), any()) }.then { }
|
|
2717
|
+
logsMock.`when`<Unit> { Logs.enable(any(), any()) }.then { }
|
|
2718
|
+
traceMock.`when`<Unit> { Trace.enable(any(), any()) }.then { } // When
|
|
2719
|
+
testedBridgeSdk.initialize(fakeConfiguration.toReadableJavaOnlyMap(), mockPromise)
|
|
2720
|
+
|
|
2721
|
+
// Then
|
|
2722
|
+
inOrder(mockDatadog) {
|
|
2723
|
+
verify(mockDatadog).initialize(
|
|
2724
|
+
same(mockContext),
|
|
2725
|
+
sdkConfigCaptor.capture(),
|
|
2726
|
+
any()
|
|
2727
|
+
)
|
|
2728
|
+
rumMock.verify { Rum.enable(rumConfigCaptor.capture(), any()) }
|
|
2729
|
+
traceMock.verify { Trace.enable(traceConfigCaptor.capture(), any()) }
|
|
2730
|
+
logsMock.verify { Logs.enable(logsConfigCaptor.capture(), any()) }
|
|
2063
2731
|
}
|
|
2732
|
+
assertThat(rumConfigCaptor.firstValue)
|
|
2733
|
+
.hasField("featureConfiguration") {
|
|
2734
|
+
val resourceMapper = it
|
|
2735
|
+
.getActualValue<EventMapper<ResourceEvent>>("resourceEventMapper")
|
|
2736
|
+
val notDroppedEvent = resourceMapper.map(resourceEvent)
|
|
2737
|
+
assertThat(notDroppedEvent).isNotNull
|
|
2738
|
+
}
|
|
2739
|
+
} finally {
|
|
2740
|
+
rumMock.close()
|
|
2741
|
+
logsMock.close()
|
|
2742
|
+
traceMock.close()
|
|
2743
|
+
}
|
|
2064
2744
|
}
|
|
2065
2745
|
|
|
2066
2746
|
@Test
|
|
@@ -2074,27 +2754,39 @@ internal class DdSdkTest {
|
|
|
2074
2754
|
val traceConfigCaptor = argumentCaptor<TraceConfiguration>()
|
|
2075
2755
|
resourceEvent.context?.additionalProperties?.put("_dd.resource.drop_resource", true)
|
|
2076
2756
|
|
|
2077
|
-
|
|
2078
|
-
|
|
2757
|
+
val rumMock = org.mockito.Mockito.mockStatic(Rum::class.java)
|
|
2758
|
+
val traceMock = org.mockito.Mockito.mockStatic(Trace::class.java)
|
|
2759
|
+
val logsMock = org.mockito.Mockito.mockStatic(Logs::class.java)
|
|
2079
2760
|
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
assertThat(droppedEvent).isNull()
|
|
2761
|
+
try {
|
|
2762
|
+
rumMock.`when`<Unit> { Rum.enable(any(), any()) }.then { }
|
|
2763
|
+
logsMock.`when`<Unit> { Logs.enable(any(), any()) }.then { }
|
|
2764
|
+
traceMock.`when`<Unit> { Trace.enable(any(), any()) }.then { } // When
|
|
2765
|
+
testedBridgeSdk.initialize(fakeConfiguration.toReadableJavaOnlyMap(), mockPromise)
|
|
2766
|
+
|
|
2767
|
+
// Then
|
|
2768
|
+
inOrder(mockDatadog) {
|
|
2769
|
+
verify(mockDatadog).initialize(
|
|
2770
|
+
same(mockContext),
|
|
2771
|
+
sdkConfigCaptor.capture(),
|
|
2772
|
+
any()
|
|
2773
|
+
)
|
|
2774
|
+
rumMock.verify { Rum.enable(rumConfigCaptor.capture(), any()) }
|
|
2775
|
+
traceMock.verify { Trace.enable(traceConfigCaptor.capture(), any()) }
|
|
2776
|
+
logsMock.verify { Logs.enable(logsConfigCaptor.capture(), any()) }
|
|
2097
2777
|
}
|
|
2778
|
+
assertThat(rumConfigCaptor.firstValue)
|
|
2779
|
+
.hasField("featureConfiguration") {
|
|
2780
|
+
val resourceMapper = it
|
|
2781
|
+
.getActualValue<EventMapper<ResourceEvent>>("resourceEventMapper")
|
|
2782
|
+
val droppedEvent = resourceMapper.map(resourceEvent)
|
|
2783
|
+
assertThat(droppedEvent).isNull()
|
|
2784
|
+
}
|
|
2785
|
+
} finally {
|
|
2786
|
+
rumMock.close()
|
|
2787
|
+
logsMock.close()
|
|
2788
|
+
traceMock.close()
|
|
2789
|
+
}
|
|
2098
2790
|
}
|
|
2099
2791
|
|
|
2100
2792
|
// endregion
|
|
@@ -2111,27 +2803,39 @@ internal class DdSdkTest {
|
|
|
2111
2803
|
val logsConfigCaptor = argumentCaptor<LogsConfiguration>()
|
|
2112
2804
|
val traceConfigCaptor = argumentCaptor<TraceConfiguration>()
|
|
2113
2805
|
|
|
2114
|
-
|
|
2115
|
-
|
|
2806
|
+
val rumMock = org.mockito.Mockito.mockStatic(Rum::class.java)
|
|
2807
|
+
val traceMock = org.mockito.Mockito.mockStatic(Trace::class.java)
|
|
2808
|
+
val logsMock = org.mockito.Mockito.mockStatic(Logs::class.java)
|
|
2116
2809
|
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
assertThat(notDroppedEvent).isNotNull
|
|
2810
|
+
try {
|
|
2811
|
+
rumMock.`when`<Unit> { Rum.enable(any(), any()) }.then { }
|
|
2812
|
+
logsMock.`when`<Unit> { Logs.enable(any(), any()) }.then { }
|
|
2813
|
+
traceMock.`when`<Unit> { Trace.enable(any(), any()) }.then { } // When
|
|
2814
|
+
testedBridgeSdk.initialize(fakeConfiguration.toReadableJavaOnlyMap(), mockPromise)
|
|
2815
|
+
|
|
2816
|
+
// Then
|
|
2817
|
+
inOrder(mockDatadog) {
|
|
2818
|
+
verify(mockDatadog).initialize(
|
|
2819
|
+
same(mockContext),
|
|
2820
|
+
sdkConfigCaptor.capture(),
|
|
2821
|
+
any()
|
|
2822
|
+
)
|
|
2823
|
+
rumMock.verify { Rum.enable(rumConfigCaptor.capture(), any()) }
|
|
2824
|
+
traceMock.verify { Trace.enable(traceConfigCaptor.capture(), any()) }
|
|
2825
|
+
logsMock.verify { Logs.enable(logsConfigCaptor.capture(), any()) }
|
|
2134
2826
|
}
|
|
2827
|
+
assertThat(rumConfigCaptor.firstValue)
|
|
2828
|
+
.hasField("featureConfiguration") {
|
|
2829
|
+
val actionMapper = it
|
|
2830
|
+
.getActualValue<EventMapper<ActionEvent>>("actionEventMapper")
|
|
2831
|
+
val notDroppedEvent = actionMapper.map(actionEvent)
|
|
2832
|
+
assertThat(notDroppedEvent).isNotNull
|
|
2833
|
+
}
|
|
2834
|
+
} finally {
|
|
2835
|
+
rumMock.close()
|
|
2836
|
+
logsMock.close()
|
|
2837
|
+
traceMock.close()
|
|
2838
|
+
}
|
|
2135
2839
|
}
|
|
2136
2840
|
|
|
2137
2841
|
@Test
|
|
@@ -2145,190 +2849,44 @@ internal class DdSdkTest {
|
|
|
2145
2849
|
val traceConfigCaptor = argumentCaptor<TraceConfiguration>()
|
|
2146
2850
|
actionEvent.context?.additionalProperties?.put("_dd.action.drop_action", true)
|
|
2147
2851
|
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
// Then
|
|
2152
|
-
inOrder(mockDatadog) {
|
|
2153
|
-
verify(mockDatadog).initialize(
|
|
2154
|
-
same(mockContext),
|
|
2155
|
-
sdkConfigCaptor.capture(),
|
|
2156
|
-
any()
|
|
2157
|
-
)
|
|
2158
|
-
verify(mockDatadog).enableRum(rumConfigCaptor.capture())
|
|
2159
|
-
verify(mockDatadog).enableTrace(traceConfigCaptor.capture())
|
|
2160
|
-
verify(mockDatadog).enableLogs(logsConfigCaptor.capture())
|
|
2161
|
-
}
|
|
2162
|
-
assertThat(rumConfigCaptor.firstValue)
|
|
2163
|
-
.hasField("featureConfiguration") {
|
|
2164
|
-
val actionMapper = it
|
|
2165
|
-
.getActualValue<EventMapper<ActionEvent>>("actionEventMapper")
|
|
2166
|
-
val droppedEvent = actionMapper.map(actionEvent)
|
|
2167
|
-
assertThat(droppedEvent).isNull()
|
|
2168
|
-
}
|
|
2169
|
-
}
|
|
2170
|
-
|
|
2171
|
-
// endregion
|
|
2172
|
-
|
|
2173
|
-
// region misc
|
|
2174
|
-
|
|
2175
|
-
@Test
|
|
2176
|
-
fun `𝕄 set native user info 𝕎 setUser()`(
|
|
2177
|
-
@MapForgery(
|
|
2178
|
-
key = AdvancedForgery(string = [StringForgery(StringForgeryType.NUMERICAL)]),
|
|
2179
|
-
value = AdvancedForgery(string = [StringForgery(StringForgeryType.ASCII)])
|
|
2180
|
-
) extraInfo: Map<String, String>
|
|
2181
|
-
) {
|
|
2182
|
-
// When
|
|
2183
|
-
testedBridgeSdk.setUser(extraInfo.toReadableMap(), mockPromise)
|
|
2184
|
-
|
|
2185
|
-
// Then
|
|
2186
|
-
argumentCaptor<Map<String, Any?>> {
|
|
2187
|
-
verify(mockDatadog)
|
|
2188
|
-
.setUser(
|
|
2189
|
-
isNull(),
|
|
2190
|
-
isNull(),
|
|
2191
|
-
isNull(),
|
|
2192
|
-
capture()
|
|
2193
|
-
)
|
|
2194
|
-
|
|
2195
|
-
assertThat(firstValue)
|
|
2196
|
-
.containsAllEntriesOf(extraInfo)
|
|
2197
|
-
.hasSize(extraInfo.size)
|
|
2198
|
-
}
|
|
2199
|
-
}
|
|
2200
|
-
|
|
2201
|
-
@Test
|
|
2202
|
-
fun `𝕄 set native user info 𝕎 setUser() {with id}`(
|
|
2203
|
-
@StringForgery id: String,
|
|
2204
|
-
@MapForgery(
|
|
2205
|
-
key = AdvancedForgery(string = [StringForgery(StringForgeryType.NUMERICAL)]),
|
|
2206
|
-
value = AdvancedForgery(string = [StringForgery(StringForgeryType.ASCII)])
|
|
2207
|
-
) extraInfo: Map<String, String>
|
|
2208
|
-
) {
|
|
2209
|
-
// Given
|
|
2210
|
-
val user = extraInfo.toMutableMap().also {
|
|
2211
|
-
it.put("id", id)
|
|
2212
|
-
}
|
|
2213
|
-
|
|
2214
|
-
// When
|
|
2215
|
-
testedBridgeSdk.setUser(user.toReadableMap(), mockPromise)
|
|
2216
|
-
|
|
2217
|
-
// Then
|
|
2218
|
-
argumentCaptor<Map<String, Any?>> {
|
|
2219
|
-
verify(mockDatadog)
|
|
2220
|
-
.setUser(
|
|
2221
|
-
eq(id),
|
|
2222
|
-
isNull(),
|
|
2223
|
-
isNull(),
|
|
2224
|
-
capture()
|
|
2225
|
-
)
|
|
2226
|
-
|
|
2227
|
-
assertThat(firstValue)
|
|
2228
|
-
.containsAllEntriesOf(extraInfo)
|
|
2229
|
-
.hasSize(extraInfo.size)
|
|
2230
|
-
}
|
|
2231
|
-
}
|
|
2232
|
-
|
|
2233
|
-
@Test
|
|
2234
|
-
fun `𝕄 set native user info 𝕎 setUser() {with name}`(
|
|
2235
|
-
@StringForgery name: String,
|
|
2236
|
-
@MapForgery(
|
|
2237
|
-
key = AdvancedForgery(string = [StringForgery(StringForgeryType.NUMERICAL)]),
|
|
2238
|
-
value = AdvancedForgery(string = [StringForgery(StringForgeryType.ASCII)])
|
|
2239
|
-
) extraInfo: Map<String, String>
|
|
2240
|
-
) {
|
|
2241
|
-
// Given
|
|
2242
|
-
val user = extraInfo.toMutableMap().also {
|
|
2243
|
-
it.put("name", name)
|
|
2244
|
-
}
|
|
2245
|
-
|
|
2246
|
-
// When
|
|
2247
|
-
testedBridgeSdk.setUser(user.toReadableMap(), mockPromise)
|
|
2248
|
-
|
|
2249
|
-
// Then
|
|
2250
|
-
argumentCaptor<Map<String, Any?>> {
|
|
2251
|
-
verify(mockDatadog)
|
|
2252
|
-
.setUser(
|
|
2253
|
-
isNull(),
|
|
2254
|
-
eq(name),
|
|
2255
|
-
isNull(),
|
|
2256
|
-
capture()
|
|
2257
|
-
)
|
|
2258
|
-
|
|
2259
|
-
assertThat(firstValue)
|
|
2260
|
-
.containsAllEntriesOf(extraInfo)
|
|
2261
|
-
.hasSize(extraInfo.size)
|
|
2262
|
-
}
|
|
2263
|
-
}
|
|
2264
|
-
|
|
2265
|
-
@Test
|
|
2266
|
-
fun `𝕄 set native user info 𝕎 setUser() {with email}`(
|
|
2267
|
-
@StringForgery(regex = "\\w+@\\w+\\.[a-z]{3}") email: String,
|
|
2268
|
-
@MapForgery(
|
|
2269
|
-
key = AdvancedForgery(string = [StringForgery(StringForgeryType.NUMERICAL)]),
|
|
2270
|
-
value = AdvancedForgery(string = [StringForgery(StringForgeryType.ASCII)])
|
|
2271
|
-
) extraInfo: Map<String, String>
|
|
2272
|
-
) {
|
|
2273
|
-
// Given
|
|
2274
|
-
val user = extraInfo.toMutableMap().also {
|
|
2275
|
-
it.put("email", email)
|
|
2276
|
-
}
|
|
2852
|
+
val rumMock = org.mockito.Mockito.mockStatic(Rum::class.java)
|
|
2853
|
+
val traceMock = org.mockito.Mockito.mockStatic(Trace::class.java)
|
|
2854
|
+
val logsMock = org.mockito.Mockito.mockStatic(Logs::class.java)
|
|
2277
2855
|
|
|
2278
|
-
|
|
2279
|
-
|
|
2856
|
+
try {
|
|
2857
|
+
rumMock.`when`<Unit> { Rum.enable(any(), any()) }.then { }
|
|
2858
|
+
logsMock.`when`<Unit> { Logs.enable(any(), any()) }.then { }
|
|
2859
|
+
traceMock.`when`<Unit> { Trace.enable(any(), any()) }.then { } // When
|
|
2860
|
+
testedBridgeSdk.initialize(fakeConfiguration.toReadableJavaOnlyMap(), mockPromise)
|
|
2280
2861
|
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
eq(email),
|
|
2288
|
-
capture()
|
|
2862
|
+
// Then
|
|
2863
|
+
inOrder(mockDatadog) {
|
|
2864
|
+
verify(mockDatadog).initialize(
|
|
2865
|
+
same(mockContext),
|
|
2866
|
+
sdkConfigCaptor.capture(),
|
|
2867
|
+
any()
|
|
2289
2868
|
)
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
.
|
|
2293
|
-
|
|
2869
|
+
rumMock.verify { Rum.enable(rumConfigCaptor.capture(), any()) }
|
|
2870
|
+
traceMock.verify { Trace.enable(traceConfigCaptor.capture(), any()) }
|
|
2871
|
+
logsMock.verify { Logs.enable(logsConfigCaptor.capture(), any()) }
|
|
2872
|
+
}
|
|
2873
|
+
assertThat(rumConfigCaptor.firstValue)
|
|
2874
|
+
.hasField("featureConfiguration") {
|
|
2875
|
+
val actionMapper = it
|
|
2876
|
+
.getActualValue<EventMapper<ActionEvent>>("actionEventMapper")
|
|
2877
|
+
val droppedEvent = actionMapper.map(actionEvent)
|
|
2878
|
+
assertThat(droppedEvent).isNull()
|
|
2879
|
+
}
|
|
2880
|
+
} finally {
|
|
2881
|
+
rumMock.close()
|
|
2882
|
+
logsMock.close()
|
|
2883
|
+
traceMock.close()
|
|
2294
2884
|
}
|
|
2295
2885
|
}
|
|
2296
2886
|
|
|
2297
|
-
|
|
2298
|
-
fun `𝕄 set native user info 𝕎 setUser() {with id, name and email}`(
|
|
2299
|
-
@StringForgery id: String,
|
|
2300
|
-
@StringForgery name: String,
|
|
2301
|
-
@StringForgery(regex = "\\w+@\\w+\\.[a-z]{3}") email: String,
|
|
2302
|
-
@MapForgery(
|
|
2303
|
-
key = AdvancedForgery(string = [StringForgery(StringForgeryType.NUMERICAL)]),
|
|
2304
|
-
value = AdvancedForgery(string = [StringForgery(StringForgeryType.ASCII)])
|
|
2305
|
-
) extraInfo: Map<String, String>
|
|
2306
|
-
) {
|
|
2307
|
-
// Given
|
|
2308
|
-
val user = extraInfo.toMutableMap().also {
|
|
2309
|
-
it.put("id", id)
|
|
2310
|
-
it.put("name", name)
|
|
2311
|
-
it.put("email", email)
|
|
2312
|
-
}
|
|
2313
|
-
|
|
2314
|
-
// When
|
|
2315
|
-
testedBridgeSdk.setUser(user.toReadableMap(), mockPromise)
|
|
2316
|
-
|
|
2317
|
-
// Then
|
|
2318
|
-
argumentCaptor<Map<String, Any?>> {
|
|
2319
|
-
verify(mockDatadog)
|
|
2320
|
-
.setUser(
|
|
2321
|
-
eq(id),
|
|
2322
|
-
eq(name),
|
|
2323
|
-
eq(email),
|
|
2324
|
-
capture()
|
|
2325
|
-
)
|
|
2887
|
+
// endregion
|
|
2326
2888
|
|
|
2327
|
-
|
|
2328
|
-
.containsAllEntriesOf(extraInfo)
|
|
2329
|
-
.hasSize(extraInfo.size)
|
|
2330
|
-
}
|
|
2331
|
-
}
|
|
2889
|
+
// region misc
|
|
2332
2890
|
|
|
2333
2891
|
@Test
|
|
2334
2892
|
fun `𝕄 set native user info 𝕎 setUserInfo() {with id}`(
|
|
@@ -2475,28 +3033,107 @@ internal class DdSdkTest {
|
|
|
2475
3033
|
}
|
|
2476
3034
|
|
|
2477
3035
|
@Test
|
|
2478
|
-
fun `𝕄
|
|
3036
|
+
fun `𝕄 clear user info 𝕎 clearUserInfo()`() {
|
|
3037
|
+
// When
|
|
3038
|
+
testedBridgeSdk.clearUserInfo(mockPromise)
|
|
3039
|
+
|
|
3040
|
+
// Then
|
|
3041
|
+
argumentCaptor<Map<String, Any?>> {
|
|
3042
|
+
verify(mockDatadog).clearUserInfo()
|
|
3043
|
+
}
|
|
3044
|
+
}
|
|
3045
|
+
|
|
3046
|
+
@Test
|
|
3047
|
+
fun `M set Rum attribute W addAttribute`(
|
|
3048
|
+
@StringForgery(type = StringForgeryType.NUMERICAL) key: String,
|
|
3049
|
+
@StringForgery(type = StringForgeryType.ASCII) value: String
|
|
3050
|
+
) {
|
|
3051
|
+
// When
|
|
3052
|
+
val attributeMap = JavaOnlyMap().apply {
|
|
3053
|
+
putString("value", value)
|
|
3054
|
+
}
|
|
3055
|
+
testedBridgeSdk.addAttribute(key, attributeMap, mockPromise)
|
|
3056
|
+
|
|
3057
|
+
// Then
|
|
3058
|
+
verify(mockDatadog).addRumGlobalAttribute(key, value)
|
|
3059
|
+
}
|
|
3060
|
+
|
|
3061
|
+
@Test
|
|
3062
|
+
fun `M set GlobalState attribute W addAttribute`(
|
|
3063
|
+
@StringForgery(type = StringForgeryType.NUMERICAL) key: String,
|
|
3064
|
+
@StringForgery(type = StringForgeryType.ASCII) value: String
|
|
3065
|
+
) {
|
|
3066
|
+
// When
|
|
3067
|
+
val attributeMap = JavaOnlyMap().apply {
|
|
3068
|
+
putString("value", value)
|
|
3069
|
+
}
|
|
3070
|
+
testedBridgeSdk.addAttribute(key, attributeMap, mockPromise)
|
|
3071
|
+
|
|
3072
|
+
// Then
|
|
3073
|
+
assertThat(GlobalState.globalAttributes).containsEntry(key, value)
|
|
3074
|
+
}
|
|
3075
|
+
|
|
3076
|
+
@Test
|
|
3077
|
+
fun `M remove Rum attribute W removeAttribute`(
|
|
3078
|
+
@StringForgery(type = StringForgeryType.NUMERICAL) key: String,
|
|
3079
|
+
@StringForgery(type = StringForgeryType.ASCII) value: String
|
|
3080
|
+
) {
|
|
3081
|
+
// Given
|
|
3082
|
+
val attributeMap = JavaOnlyMap().apply {
|
|
3083
|
+
putString("value", value)
|
|
3084
|
+
}
|
|
3085
|
+
testedBridgeSdk.addAttribute(key, attributeMap, mockPromise)
|
|
3086
|
+
assertThat(GlobalState.globalAttributes).containsEntry(key, value)
|
|
3087
|
+
|
|
3088
|
+
// When
|
|
3089
|
+
testedBridgeSdk.removeAttribute(key, mockPromise)
|
|
3090
|
+
|
|
3091
|
+
// Then
|
|
3092
|
+
verify(mockDatadog).removeRumGlobalAttribute(key)
|
|
3093
|
+
}
|
|
3094
|
+
|
|
3095
|
+
@Test
|
|
3096
|
+
fun `M remove GlobalState attribute W removeAttribute`(
|
|
3097
|
+
@StringForgery(type = StringForgeryType.NUMERICAL) key: String,
|
|
3098
|
+
@StringForgery(type = StringForgeryType.ASCII) value: String
|
|
3099
|
+
) {
|
|
3100
|
+
// Given
|
|
3101
|
+
val attributeMap = JavaOnlyMap().apply {
|
|
3102
|
+
putString("value", value)
|
|
3103
|
+
}
|
|
3104
|
+
testedBridgeSdk.addAttribute(key, attributeMap, mockPromise)
|
|
3105
|
+
assertThat(GlobalState.globalAttributes).containsEntry(key, value)
|
|
3106
|
+
|
|
3107
|
+
// When
|
|
3108
|
+
testedBridgeSdk.removeAttribute(key, mockPromise)
|
|
3109
|
+
|
|
3110
|
+
// Then
|
|
3111
|
+
assertThat(GlobalState.globalAttributes).doesNotContainEntry(key, value)
|
|
3112
|
+
}
|
|
3113
|
+
|
|
3114
|
+
@Test
|
|
3115
|
+
fun `𝕄 set RUM attributes 𝕎 addAttributes`(
|
|
2479
3116
|
@MapForgery(
|
|
2480
3117
|
key = AdvancedForgery(string = [StringForgery(StringForgeryType.NUMERICAL)]),
|
|
2481
3118
|
value = AdvancedForgery(string = [StringForgery(StringForgeryType.ASCII)])
|
|
2482
3119
|
) customAttributes: Map<String, String>
|
|
2483
3120
|
) {
|
|
2484
3121
|
// When
|
|
2485
|
-
testedBridgeSdk.
|
|
3122
|
+
testedBridgeSdk.addAttributes(customAttributes.toReadableMap(), mockPromise)
|
|
2486
3123
|
|
|
2487
3124
|
// Then
|
|
2488
3125
|
verify(mockDatadog).addRumGlobalAttributes(customAttributes)
|
|
2489
3126
|
}
|
|
2490
3127
|
|
|
2491
3128
|
@Test
|
|
2492
|
-
fun `𝕄 set GlobalState attributes 𝕎
|
|
3129
|
+
fun `𝕄 set GlobalState attributes 𝕎 addAttributes`(
|
|
2493
3130
|
@MapForgery(
|
|
2494
3131
|
key = AdvancedForgery(string = [StringForgery(StringForgeryType.NUMERICAL)]),
|
|
2495
3132
|
value = AdvancedForgery(string = [StringForgery(StringForgeryType.ASCII)])
|
|
2496
3133
|
) customAttributes: Map<String, String>
|
|
2497
3134
|
) {
|
|
2498
3135
|
// When
|
|
2499
|
-
testedBridgeSdk.
|
|
3136
|
+
testedBridgeSdk.addAttributes(customAttributes.toReadableMap(), mockPromise)
|
|
2500
3137
|
|
|
2501
3138
|
// Then
|
|
2502
3139
|
customAttributes.forEach { (k, v) ->
|
|
@@ -2504,6 +3141,46 @@ internal class DdSdkTest {
|
|
|
2504
3141
|
}
|
|
2505
3142
|
}
|
|
2506
3143
|
|
|
3144
|
+
@Test
|
|
3145
|
+
fun `𝕄 remove RUM attributes 𝕎 removeAttributes`(
|
|
3146
|
+
@MapForgery(
|
|
3147
|
+
key = AdvancedForgery(string = [StringForgery(StringForgeryType.NUMERICAL)]),
|
|
3148
|
+
value = AdvancedForgery(string = [StringForgery(StringForgeryType.ASCII)])
|
|
3149
|
+
) customAttributes: Map<String, String>
|
|
3150
|
+
) {
|
|
3151
|
+
// Given
|
|
3152
|
+
testedBridgeSdk.addAttributes(customAttributes.toReadableMap(), mockPromise)
|
|
3153
|
+
verify(mockDatadog).addRumGlobalAttributes(customAttributes)
|
|
3154
|
+
|
|
3155
|
+
// When
|
|
3156
|
+
val keys = customAttributes.keys.toReadableArray()
|
|
3157
|
+
testedBridgeSdk.removeAttributes(keys, mockPromise)
|
|
3158
|
+
|
|
3159
|
+
// Then
|
|
3160
|
+
verify(mockDatadog).removeRumGlobalAttributes(customAttributes.keys.toTypedArray())
|
|
3161
|
+
}
|
|
3162
|
+
|
|
3163
|
+
@Test
|
|
3164
|
+
fun `𝕄 remve GlobalState attributes 𝕎 removeAttributes`(
|
|
3165
|
+
@MapForgery(
|
|
3166
|
+
key = AdvancedForgery(string = [StringForgery(StringForgeryType.NUMERICAL)]),
|
|
3167
|
+
value = AdvancedForgery(string = [StringForgery(StringForgeryType.ASCII)])
|
|
3168
|
+
) customAttributes: Map<String, String>
|
|
3169
|
+
) {
|
|
3170
|
+
// Given
|
|
3171
|
+
testedBridgeSdk.addAttributes(customAttributes.toReadableMap(), mockPromise)
|
|
3172
|
+
verify(mockDatadog).addRumGlobalAttributes(customAttributes)
|
|
3173
|
+
|
|
3174
|
+
// When
|
|
3175
|
+
val keys = customAttributes.keys.toReadableArray()
|
|
3176
|
+
testedBridgeSdk.removeAttributes(keys, mockPromise)
|
|
3177
|
+
|
|
3178
|
+
// Then
|
|
3179
|
+
customAttributes.forEach { (k, v) ->
|
|
3180
|
+
assertThat(GlobalState.globalAttributes).doesNotContainEntry(k, v)
|
|
3181
|
+
}
|
|
3182
|
+
}
|
|
3183
|
+
|
|
2507
3184
|
@Test
|
|
2508
3185
|
fun `𝕄 build Granted consent 𝕎 buildTrackingConsent {granted}`(forge: Forge) {
|
|
2509
3186
|
// When
|
|
@@ -2567,41 +3244,63 @@ internal class DdSdkTest {
|
|
|
2567
3244
|
val customRumEndpoint = forge.aNullable { aString() }
|
|
2568
3245
|
val customLogsEndpoint = forge.aNullable { aString() }
|
|
2569
3246
|
val customTraceEndpoint = forge.aNullable { aString() }
|
|
3247
|
+
val rumConfiguration = fakeConfiguration.rumConfiguration?.copy(
|
|
3248
|
+
customEndpoint = customRumEndpoint
|
|
3249
|
+
)
|
|
3250
|
+
val logsConfiguration = fakeConfiguration.logsConfiguration?.copy(
|
|
3251
|
+
customEndpoint = customLogsEndpoint
|
|
3252
|
+
)
|
|
3253
|
+
val traceConfiguration = fakeConfiguration.traceConfiguration?.copy(
|
|
3254
|
+
customEndpoint = customTraceEndpoint
|
|
3255
|
+
)
|
|
2570
3256
|
val bridgeConfiguration = fakeConfiguration.copy(
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
trace = customTraceEndpoint
|
|
2575
|
-
)
|
|
3257
|
+
rumConfiguration = rumConfiguration,
|
|
3258
|
+
logsConfiguration = logsConfiguration,
|
|
3259
|
+
traceConfiguration = traceConfiguration
|
|
2576
3260
|
)
|
|
2577
3261
|
val rumConfigCaptor = argumentCaptor<RumConfiguration>()
|
|
2578
3262
|
val logsConfigCaptor = argumentCaptor<LogsConfiguration>()
|
|
2579
3263
|
val traceConfigCaptor = argumentCaptor<TraceConfiguration>()
|
|
2580
3264
|
|
|
2581
|
-
|
|
2582
|
-
|
|
3265
|
+
val rumMock = org.mockito.Mockito.mockStatic(Rum::class.java)
|
|
3266
|
+
val traceMock = org.mockito.Mockito.mockStatic(Trace::class.java)
|
|
3267
|
+
val logsMock = org.mockito.Mockito.mockStatic(Logs::class.java)
|
|
2583
3268
|
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
}
|
|
3269
|
+
try {
|
|
3270
|
+
rumMock.`when`<Unit> { Rum.enable(any(), any()) }.then { }
|
|
3271
|
+
logsMock.`when`<Unit> { Logs.enable(any(), any()) }.then { }
|
|
3272
|
+
traceMock.`when`<Unit> { Trace.enable(any(), any()) }.then { } // When
|
|
3273
|
+
testedBridgeSdk.initialize(bridgeConfiguration.toReadableJavaOnlyMap(), mockPromise)
|
|
2590
3274
|
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
3275
|
+
// Then
|
|
3276
|
+
inOrder(mockDatadog) {
|
|
3277
|
+
rumMock.verify { Rum.enable(rumConfigCaptor.capture(), any()) }
|
|
3278
|
+
traceMock.verify { Trace.enable(traceConfigCaptor.capture(), any()) }
|
|
3279
|
+
logsMock.verify { Logs.enable(logsConfigCaptor.capture(), any()) }
|
|
2594
3280
|
}
|
|
2595
|
-
|
|
2596
|
-
.
|
|
2597
|
-
|
|
2598
|
-
|
|
3281
|
+
|
|
3282
|
+
assertThat(rumConfigCaptor.firstValue)
|
|
3283
|
+
.hasField("featureConfiguration") {
|
|
3284
|
+
it.hasFieldEqualTo("customEndpointUrl", customRumEndpoint)
|
|
3285
|
+
}
|
|
3286
|
+
assertThat(logsConfigCaptor.firstValue)
|
|
3287
|
+
.hasFieldEqualTo("customEndpointUrl", customLogsEndpoint)
|
|
3288
|
+
assertThat(traceConfigCaptor.firstValue)
|
|
3289
|
+
.hasFieldEqualTo("customEndpointUrl", customTraceEndpoint)
|
|
3290
|
+
} finally {
|
|
3291
|
+
rumMock.close()
|
|
3292
|
+
logsMock.close()
|
|
3293
|
+
traceMock.close()
|
|
3294
|
+
}
|
|
2599
3295
|
}
|
|
2600
3296
|
|
|
2601
3297
|
@Test
|
|
2602
3298
|
fun `𝕄 initialize native SDK 𝕎 initialize() {synthethics attributes}`() {
|
|
2603
3299
|
// Given
|
|
2604
|
-
|
|
3300
|
+
val rumConfiguration = fakeConfiguration.rumConfiguration?.copy(
|
|
3301
|
+
nativeCrashReportEnabled = false
|
|
3302
|
+
)
|
|
3303
|
+
fakeConfiguration = fakeConfiguration.copy(site = null, rumConfiguration = rumConfiguration)
|
|
2605
3304
|
DdSdkSynthetics.testId = "unit-test-test-id"
|
|
2606
3305
|
DdSdkSynthetics.resultId = "unit-test-result-id"
|
|
2607
3306
|
|
|
@@ -2627,6 +3326,132 @@ internal class DdSdkTest {
|
|
|
2627
3326
|
}
|
|
2628
3327
|
}
|
|
2629
3328
|
|
|
3329
|
+
@Test
|
|
3330
|
+
fun `𝕄 normalize frameTime according to the device's refresh rate`() {
|
|
3331
|
+
// 10 fps, 60Hz device, 60 fps budget -> 10 fps
|
|
3332
|
+
var frameTimeSeconds = testedBridgeSdk.normalizeFrameTime(
|
|
3333
|
+
frameTimeSeconds = 0.1,
|
|
3334
|
+
context = mockContext,
|
|
3335
|
+
fpsBudget = 60.0,
|
|
3336
|
+
deviceDisplayFps = 60.0
|
|
3337
|
+
)
|
|
3338
|
+
assertThat(frameTimeSeconds).isEqualTo(0.1)
|
|
3339
|
+
|
|
3340
|
+
// 30 fps, 60Hz device, 60 fps budget -> 30 fps
|
|
3341
|
+
frameTimeSeconds = testedBridgeSdk.normalizeFrameTime(
|
|
3342
|
+
frameTimeSeconds = 0.03,
|
|
3343
|
+
context = mockContext,
|
|
3344
|
+
fpsBudget = 60.0,
|
|
3345
|
+
deviceDisplayFps = 60.0
|
|
3346
|
+
)
|
|
3347
|
+
assertThat(frameTimeSeconds).isEqualTo(0.03)
|
|
3348
|
+
|
|
3349
|
+
// 60 fps, 60Hz device, 60 fps budget -> 60 fps
|
|
3350
|
+
frameTimeSeconds = testedBridgeSdk.normalizeFrameTime(
|
|
3351
|
+
frameTimeSeconds = 0.016,
|
|
3352
|
+
context = mockContext,
|
|
3353
|
+
fpsBudget = 60.0,
|
|
3354
|
+
deviceDisplayFps = 60.0
|
|
3355
|
+
)
|
|
3356
|
+
assertThat(frameTimeSeconds).isEqualTo(0.016, Offset.offset(0.005))
|
|
3357
|
+
|
|
3358
|
+
// 60 fps, 120Hz device, 60 fps budget -> 30 fps
|
|
3359
|
+
frameTimeSeconds = testedBridgeSdk.normalizeFrameTime(
|
|
3360
|
+
frameTimeSeconds = 0.016,
|
|
3361
|
+
context = mockContext,
|
|
3362
|
+
fpsBudget = 60.0,
|
|
3363
|
+
deviceDisplayFps = 120.0
|
|
3364
|
+
)
|
|
3365
|
+
assertThat(frameTimeSeconds).isEqualTo(0.032)
|
|
3366
|
+
|
|
3367
|
+
// 120 fps, 120Hz device, 60 fps budget -> 60 fps
|
|
3368
|
+
frameTimeSeconds = testedBridgeSdk.normalizeFrameTime(
|
|
3369
|
+
frameTimeSeconds = 0.0083,
|
|
3370
|
+
context = mockContext,
|
|
3371
|
+
fpsBudget = 60.0,
|
|
3372
|
+
deviceDisplayFps = 120.0
|
|
3373
|
+
)
|
|
3374
|
+
assertThat(frameTimeSeconds).isEqualTo(0.016, Offset.offset(0.005))
|
|
3375
|
+
|
|
3376
|
+
// 90 fps, 120Hz device, 60 fps budget -> 45 fps
|
|
3377
|
+
frameTimeSeconds = testedBridgeSdk.normalizeFrameTime(
|
|
3378
|
+
frameTimeSeconds = 0.0111,
|
|
3379
|
+
context = mockContext,
|
|
3380
|
+
fpsBudget = 60.0,
|
|
3381
|
+
deviceDisplayFps = 120.0
|
|
3382
|
+
)
|
|
3383
|
+
assertThat(frameTimeSeconds).isEqualTo(0.0222, Offset.offset(0.001))
|
|
3384
|
+
|
|
3385
|
+
// 100 fps, 120Hz device, 60 fps budget -> 50 fps
|
|
3386
|
+
frameTimeSeconds = testedBridgeSdk.normalizeFrameTime(
|
|
3387
|
+
frameTimeSeconds = 0.01,
|
|
3388
|
+
context = mockContext,
|
|
3389
|
+
fpsBudget = 60.0,
|
|
3390
|
+
deviceDisplayFps = 120.0
|
|
3391
|
+
)
|
|
3392
|
+
assertThat(frameTimeSeconds).isEqualTo(0.02, Offset.offset(0.001))
|
|
3393
|
+
|
|
3394
|
+
// 120 fps, 120Hz device, 120 fps budget -> 120 fps
|
|
3395
|
+
frameTimeSeconds = testedBridgeSdk.normalizeFrameTime(
|
|
3396
|
+
frameTimeSeconds = 0.0083,
|
|
3397
|
+
context = mockContext,
|
|
3398
|
+
fpsBudget = 120.0,
|
|
3399
|
+
deviceDisplayFps = 120.0
|
|
3400
|
+
)
|
|
3401
|
+
assertThat(frameTimeSeconds).isEqualTo(0.0083, Offset.offset(0.001))
|
|
3402
|
+
|
|
3403
|
+
// 80 fps, 160Hz device, 60 fps budget -> 30 fps
|
|
3404
|
+
frameTimeSeconds = testedBridgeSdk.normalizeFrameTime(
|
|
3405
|
+
frameTimeSeconds = 0.0125,
|
|
3406
|
+
context = mockContext,
|
|
3407
|
+
fpsBudget = 60.0,
|
|
3408
|
+
deviceDisplayFps = 160.0
|
|
3409
|
+
)
|
|
3410
|
+
assertThat(frameTimeSeconds).isEqualTo(0.033, Offset.offset(0.001))
|
|
3411
|
+
|
|
3412
|
+
// 160 fps, 160Hz device, 60 fps budget -> 60 fps
|
|
3413
|
+
frameTimeSeconds = testedBridgeSdk.normalizeFrameTime(
|
|
3414
|
+
frameTimeSeconds = 0.00625,
|
|
3415
|
+
context = mockContext,
|
|
3416
|
+
fpsBudget = 60.0,
|
|
3417
|
+
deviceDisplayFps = 160.0
|
|
3418
|
+
)
|
|
3419
|
+
assertThat(frameTimeSeconds).isEqualTo(0.016, Offset.offset(0.001))
|
|
3420
|
+
|
|
3421
|
+
// Edge cases
|
|
3422
|
+
frameTimeSeconds = testedBridgeSdk.normalizeFrameTime(
|
|
3423
|
+
frameTimeSeconds = 0.0,
|
|
3424
|
+
context = mockContext,
|
|
3425
|
+
fpsBudget = 0.0,
|
|
3426
|
+
deviceDisplayFps = 0.0
|
|
3427
|
+
)
|
|
3428
|
+
assertThat(frameTimeSeconds).isEqualTo(0.016, Offset.offset(0.001))
|
|
3429
|
+
|
|
3430
|
+
frameTimeSeconds = testedBridgeSdk.normalizeFrameTime(
|
|
3431
|
+
frameTimeSeconds = 0.016,
|
|
3432
|
+
context = mockContext,
|
|
3433
|
+
fpsBudget = 0.0,
|
|
3434
|
+
deviceDisplayFps = 0.0
|
|
3435
|
+
)
|
|
3436
|
+
assertThat(frameTimeSeconds).isEqualTo(0.016, Offset.offset(0.001))
|
|
3437
|
+
|
|
3438
|
+
frameTimeSeconds = testedBridgeSdk.normalizeFrameTime(
|
|
3439
|
+
frameTimeSeconds = 0.016,
|
|
3440
|
+
context = mockContext,
|
|
3441
|
+
fpsBudget = 60.0,
|
|
3442
|
+
deviceDisplayFps = 0.0
|
|
3443
|
+
)
|
|
3444
|
+
assertThat(frameTimeSeconds).isEqualTo(0.016, Offset.offset(0.001))
|
|
3445
|
+
|
|
3446
|
+
frameTimeSeconds = testedBridgeSdk.normalizeFrameTime(
|
|
3447
|
+
frameTimeSeconds = 0.016,
|
|
3448
|
+
context = mockContext,
|
|
3449
|
+
fpsBudget = 0.0,
|
|
3450
|
+
deviceDisplayFps = 60.0
|
|
3451
|
+
)
|
|
3452
|
+
assertThat(frameTimeSeconds).isEqualTo(0.016, Offset.offset(0.001))
|
|
3453
|
+
}
|
|
3454
|
+
|
|
2630
3455
|
// endregion
|
|
2631
3456
|
|
|
2632
3457
|
// region Internal
|