public virtual void TestCache()
        {
            KeyProviderCache kpCache = new KeyProviderCache(10000);
            Configuration    conf    = new Configuration();

            conf.Set(DFSConfigKeys.DfsEncryptionKeyProviderUri, "dummy://*****:*****@test_provider1"
                     );
            KeyProvider keyProvider1 = kpCache.Get(conf);

            NUnit.Framework.Assert.IsNotNull("Returned Key Provider is null !!", keyProvider1
                                             );
            conf.Set(DFSConfigKeys.DfsEncryptionKeyProviderUri, "dummy://*****:*****@test_provider1"
                     );
            KeyProvider keyProvider2 = kpCache.Get(conf);

            NUnit.Framework.Assert.IsTrue("Different KeyProviders returned !!", keyProvider1
                                          == keyProvider2);
            conf.Set(DFSConfigKeys.DfsEncryptionKeyProviderUri, "dummy://test_provider3");
            KeyProvider keyProvider3 = kpCache.Get(conf);

            NUnit.Framework.Assert.IsFalse("Same KeyProviders returned !!", keyProvider1 == keyProvider3
                                           );
            conf.Set(DFSConfigKeys.DfsEncryptionKeyProviderUri, "dummy://*****:*****@test_provider1"
                     );
            KeyProvider keyProvider4 = kpCache.Get(conf);

            NUnit.Framework.Assert.IsFalse("Same KeyProviders returned !!", keyProvider1 == keyProvider4
                                           );
        }
Beispiel #2
0
 private ClientContext(string name, DFSClient.Conf conf)
 {
     this.name              = name;
     this.confString        = ConfAsString(conf);
     this.shortCircuitCache = new ShortCircuitCache(conf.shortCircuitStreamsCacheSize,
                                                    conf.shortCircuitStreamsCacheExpiryMs, conf.shortCircuitMmapCacheSize, conf.shortCircuitMmapCacheExpiryMs
                                                    , conf.shortCircuitMmapCacheRetryTimeout, conf.shortCircuitCacheStaleThresholdMs
                                                    , conf.shortCircuitSharedMemoryWatcherInterruptCheckMs);
     this.peerCache                 = new PeerCache(conf.socketCacheCapacity, conf.socketCacheExpiry);
     this.keyProviderCache          = new KeyProviderCache(conf.keyProviderCacheExpiryMs);
     this.useLegacyBlockReaderLocal = conf.useLegacyBlockReaderLocal;
     this.domainSocketFactory       = new DomainSocketFactory(conf);
     this.byteArrayManager          = ByteArrayManager.NewInstance(conf.writeByteArrayManagerConf
                                                                   );
 }