Exemple #1
0
        // *** constructors ***
        public OpenKitConfiguration(OpenKitType openKitType, string applicationName, string applicationID, long deviceID, string endpointURL,
                                    ISessionIDProvider sessionIDProvider, ISSLTrustManager trustManager, Device device, string applicationVersion,
                                    BeaconCacheConfiguration beaconCacheConfiguration, BeaconConfiguration beaconConfiguration)
        {
            OpenKitType = openKitType;

            // immutable settings
            ApplicationName = applicationName;
            ApplicationID   = applicationID;
            DeviceID        = deviceID;
            EndpointURL     = endpointURL;

            // mutable settings
            capture        = DEFAULT_CAPTURE;
            sendInterval   = DEFAULT_SEND_INTERVAL;
            maxBeaconSize  = DEFAULT_MAX_BEACON_SIZE;
            captureErrors  = DEFAULT_CAPTURE_ERRORS;
            captureCrashes = DEFAULT_CAPTURE_CRASHES;

            this.device = device;

            HTTPClientConfig = new HTTPClientConfiguration(
                endpointURL,
                openKitType.DefaultServerID,
                applicationID,
                trustManager);

            this.applicationVersion = applicationVersion;

            this.beaconCacheConfiguration = beaconCacheConfiguration;

            this.sessionIDProvider = sessionIDProvider;

            BeaconConfig = beaconConfiguration;
        }
        public void BeaconCacheConfigurationFromNullReturnsNull()
        {
            // given, when
            var obtained = BeaconCacheConfiguration.From(null);

            // then
            Assert.That(obtained, Is.Null);
        }
Exemple #3
0
        private static OpenKitConfiguration CreateDefaultConfig()
        {
            var defaultCacheConfig = new BeaconCacheConfiguration(
                BeaconCacheConfiguration.DEFAULT_MAX_RECORD_AGE_IN_MILLIS,
                BeaconCacheConfiguration.DEFAULT_LOWER_MEMORY_BOUNDARY_IN_BYTES,
                BeaconCacheConfiguration.DEFAULT_UPPER_MEMORY_BOUNDARY_IN_BYTES);

            return(new OpenKitConfiguration(OpenKitType.DYNATRACE, "", "", 0, "", new Providers.TestSessionIDProvider(),
                                            new SSLStrictTrustManager(), new Core.Device("", "", ""), "", defaultCacheConfig));
        }
        public void PositiveLowerCacheSizeBoundIsTakenOverFromOpenKitBuilder()
        {
            // given
            const long lowerBound = 73;
            var        builder    = Substitute.For <IOpenKitBuilder>();

            builder.BeaconCacheLowerMemoryBoundary.Returns(lowerBound);

            // when
            var obtained = BeaconCacheConfiguration.From(builder);

            // then
            _ = builder.Received(1).BeaconCacheLowerMemoryBoundary;
            Assert.That(obtained.CacheSizeLowerBound, Is.EqualTo(lowerBound));
        }
        public void ZeroMaxOrderAgeIsTakenOverFromOpenKitBuilder()
        {
            // given
            const long maxRecordAge = 0;
            var        builder      = Substitute.For <IOpenKitBuilder>();

            builder.BeaconCacheMaxBeaconAge.Returns(maxRecordAge);

            // when
            var obtained = BeaconCacheConfiguration.From(builder);

            // then
            _ = builder.Received(1).BeaconCacheMaxBeaconAge;
            Assert.That(obtained.MaxRecordAge, Is.EqualTo(maxRecordAge));
        }