Beispiel #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;
        }
Beispiel #2
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);

            var defaultBeaconConfig = new BeaconConfiguration();

            return(new OpenKitConfiguration(OpenKitType.DYNATRACE, "", "", 0, "", new Providers.TestSessionIDProvider(),
                                            new SSLStrictTrustManager(), new Core.Device("", "", ""), "", defaultCacheConfig, defaultBeaconConfig));
        }
Beispiel #3
0
        public void NewInstanceReturnHttpClientConfigWithGivenServerId()
        {
            // given
            const string endpointUrl   = "https://localhost:9999/1";
            const string applicationId = "some cryptic appId";
            var          trustManager  = Substitute.For <ISSLTrustManager>();
            const int    serverId      = 73;

            mockOpenKitConfig.EndpointUrl.Returns(endpointUrl);
            mockOpenKitConfig.ApplicationId.Returns(applicationId);
            mockOpenKitConfig.TrustManager.Returns(trustManager);
            mockOpenKitConfig.DefaultServerId.Returns(serverId);

            var target = BeaconConfiguration.From(mockOpenKitConfig, mockPrivacyConfig, serverId);

            // when
            var obtained = target.HttpClientConfiguration;

            // then
            Assert.That(obtained.BaseUrl, Is.EqualTo(endpointUrl));
            Assert.That(obtained.ApplicationId, Is.EqualTo(applicationId));
            Assert.That(obtained.SslTrustManager, Is.SameAs(trustManager));
            Assert.That(obtained.ServerId, Is.EqualTo(serverId));
        }
Beispiel #4
0
 private IBeaconConfiguration CreateBeaconConfig()
 {
     return(BeaconConfiguration.From(mockOpenKitConfig, mockPrivacyConfig, ServerId));
 }
Beispiel #5
0
 public void FromWithNullPrivacyConfigurationGivesNull()
 {
     // when, then
     Assert.That(BeaconConfiguration.From(mockOpenKitConfig, null, ServerId), Is.Null);
 }