public AppManager(IDataLayer dl)
        {
            data = dl;
            cache = new CacheManager();

            this.firstDataDate = DateTime.Now;
        }
    public AssemblyExplorer(MSpecUnitTestProvider provider,
#if RESHARPER_61
                            IUnitTestElementManager manager,
                            PsiModuleManager psiModuleManager,
                            CacheManager cacheManager,
#endif
                            IMetadataAssembly assembly,
                            IProject project,
                            UnitTestElementConsumer consumer)
    {
      _assembly = assembly;
      _consumer = consumer;

      using (ReadLockCookie.Create())
      {
        var projectEnvoy = new ProjectModelElementEnvoy(project);

        var cache = new ContextCache();
#if RESHARPER_61
        _contextFactory = new ContextFactory(provider, manager, psiModuleManager, cacheManager, project, projectEnvoy, _assembly.Location.FullPath, cache);
        _contextSpecificationFactory = new ContextSpecificationFactory(provider, manager, psiModuleManager, cacheManager, project, projectEnvoy, cache);
        _behaviorFactory = new BehaviorFactory(provider, manager, psiModuleManager, cacheManager, project, projectEnvoy, cache);
        _behaviorSpecificationFactory = new BehaviorSpecificationFactory(provider, manager, psiModuleManager, cacheManager, project, projectEnvoy);
#else
#if RESHARPER_6
        _contextFactory = new ContextFactory(provider, project, projectEnvoy, _assembly.Location.FullPath, cache);
#else
        _contextFactory = new ContextFactory(provider, project, projectEnvoy, _assembly.Location, cache);
#endif
        _contextSpecificationFactory = new ContextSpecificationFactory(provider, project, projectEnvoy, cache);
        _behaviorFactory = new BehaviorFactory(provider, project, projectEnvoy, cache);
        _behaviorSpecificationFactory = new BehaviorSpecificationFactory(provider, project, projectEnvoy);
#endif
      }
    }
        public AmoebaManager(string blocksPath, BufferManager bufferManager)
        {
            _blocksPath = blocksPath;
            _bufferManager = bufferManager;

            _clientManager = new ClientManager(_bufferManager);
            _serverManager = new ServerManager(_bufferManager);
            _cacheManager = new CacheManager(_blocksPath, _bufferManager);
            _connectionsManager = new ConnectionsManager(_clientManager, _serverManager, _cacheManager, _bufferManager);
            _downloadManager = new DownloadManager(_connectionsManager, _cacheManager, _bufferManager);
            _uploadManager = new UploadManager(_connectionsManager, _cacheManager, _bufferManager);
            _backgroundDownloadManager = new BackgroundDownloadManager(_connectionsManager, _cacheManager, _bufferManager);
            _backgroundUploadManager = new BackgroundUploadManager(_connectionsManager, _cacheManager, _bufferManager);

            _clientManager.CreateCapEvent = (object sender, string uri) =>
            {
                return _createCapEvent?.Invoke(this, uri);
            };

            _serverManager.AcceptCapEvent = (object sender, out string uri) =>
            {
                uri = null;
                return _acceptCapEvent?.Invoke(this, out uri);
            };

            _clientManager.CheckUriEvent = (object sender, string uri) =>
            {
                return _checkUriEvent?.Invoke(this, uri) ?? true;
            };

            _serverManager.CheckUriEvent = (object sender, string uri) =>
            {
                return _checkUriEvent?.Invoke(this, uri) ?? true;
            };
        }
 public ItemBrowsingService(IItemService itemService, ISearchProvider searchService, CacheManager cacheManager, IBlobUrlResolver blobUrlResolver = null, ISearchConnection searchConnection = null)
 {
     _searchProvider = searchService;
     _searchConnection = searchConnection;
     _itemService = itemService;
     _blobUrlResolver = blobUrlResolver;
 }
 public MSpecUnitTestProvider(ISolution solution, PsiModuleManager psiModuleManager, CacheManager cacheManager)
 {
   Solution = solution;
   PsiModuleManager = psiModuleManager;
   CacheManager = cacheManager;
   Debug.Listeners.Add(new DefaultTraceListener());
 }
 public XunitTestProvider(ISolution solution,
                          CacheManager cacheManager,
                          PsiModuleManager psiModuleManager,
                          UnitTestingCategoriesProvider categoriesProvider)
 {
     this.solution = solution;
 }
Exemple #7
0
        public Region( StatLog statLog,  CacheManager cacheManager)
            : base(0, 0, 0, 0)
        {
            // Store the statLog
            _statLog = statLog;

            // Store the cache manager
            // TODO: What happens if the cachemanger changes during the lifecycle of this region?
            _cacheManager = cacheManager;

            //default options
            options.Width = 1024;
            options.Height = 768;
            options.Left = 0;
            options.Top = 0;
            options.Uri = null;

            this.Size = new Size(options.Width, options.Height);

            this.Location = new Point(options.Left, options.Top);



              this.Background = new SolidColorBrush(Colors.Red);

            if (Settings.Default.DoubleBuffering)
            {
                //   SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
                //      SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            }

            // Create a new BlackList for us to use
            blackList = new BlackList();
        }
 public void Init(System.Web.HttpApplication context)
 {
   
     context.BeginRequest += Application_BeginRequest;
     context.EndRequest += Application_EndRequest;
     RootURL = System.Configuration.ConfigurationManager.AppSettings["ROOT_URL"];
     if (string.IsNullOrEmpty(RootURL))
         RootURL = "http://localhost";
     MenCacheHost = System.Configuration.ConfigurationManager.AppSettings["MEMCACHE_HOST"];
     if (string.IsNullOrEmpty(MenCacheHost))
         MenCacheHost = "127.0.0.1:11211";
     Boolean.TryParse(System.Configuration.ConfigurationManager.AppSettings["ENABLED_MEMCACHE"], out MenCacheEnabled);
     Boolean.TryParse(System.Configuration.ConfigurationManager.AppSettings["ENABLED_WEBCACHE"], out WebCacheEnabled);
     GetDespatch = new Despatch();
     try
     {
         if (MenCacheEnabled)
             MenCache = new CacheManager(MenCacheHost);
        
     }
     catch
     {
     }
     
 }
    public static IUnitTestElement ReadFromXml(XmlElement parent, IUnitTestElement parentElement, MSpecUnitTestProvider provider, ISolution solution
#if RESHARPER_61
      , IUnitTestElementManager manager, PsiModuleManager psiModuleManager, CacheManager cacheManager
#endif
      )
    {
      var projectId = parent.GetAttribute("projectId");
      var project = ProjectUtil.FindProjectElementByPersistentID(solution, projectId) as IProject;
      if (project == null)
      {
        return null;
      }

      var behavior = parentElement as BehaviorElement;
      if (behavior == null)
      {
        return null;
      }

      var typeName = parent.GetAttribute("typeName");
      var methodName = parent.GetAttribute("methodName");
      var isIgnored = bool.Parse(parent.GetAttribute("isIgnored"));

      return BehaviorSpecificationFactory.GetOrCreateBehaviorSpecification(provider,
#if RESHARPER_61
        manager, psiModuleManager, cacheManager,
#endif
        project, behavior, ProjectModelElementEnvoy.Create(project), typeName, methodName, isIgnored);
    }
    public static ContextSpecificationElement GetOrCreateContextSpecification(MSpecUnitTestProvider provider,
                                                                              IUnitTestElementManager manager,
                                                                              PsiModuleManager psiModuleManager,
                                                                              CacheManager cacheManager,
                                                                              IProject project,
                                                                              ContextElement context,
                                                                              ProjectModelElementEnvoy projectEnvoy,
                                                                              IClrTypeName declaringTypeName,
                                                                              string fieldName,
                                                                              bool isIgnored)
    {
      var id = ContextSpecificationElement.CreateId(context, fieldName);
      var contextSpecification = manager.GetElementById(project, id) as ContextSpecificationElement;
      if (contextSpecification != null)
      {
        contextSpecification.Parent = context;
        contextSpecification.State = UnitTestElementState.Valid;
        return contextSpecification;
      }

      return new ContextSpecificationElement(provider,
                                             psiModuleManager,
                                             cacheManager,
                                             context,
                                             projectEnvoy,
                                             declaringTypeName,
                                             fieldName,
                                             isIgnored);
    }
Exemple #11
0
        public FileCollector(CacheManager cacheManager, FilesModel xmlString)
        {
            _cacheManager = cacheManager;


            // Create a required files object
            _requiredFiles = new RequiredFiles();


            foreach (var item in xmlString.Items)
            {
                _requiredFiles.Files.Add(item);
            }


            // Get the key for later use
            hardwareKey = new HardwareKey();

            // Make a new filelist collection
            _files = new Collection<RequiredFileModel>();

            // Create a webservice call
            xmdsFile = new ServiceClient();

            // Start up the Xmds Service Object
            //xmdsFile.Credentials = null;
            //xmdsFile.Url = Properties.Settings.Default.Client_xmds_xmds;
            //xmdsFile.UseDefaultCredentials = false;

            // Hook onto the xmds file complete event
            xmdsFile.GetFileCompleted += (XmdsFileGetFileCompleted);
        }
 public void TestBasicCachingFunctionality()
 {
     string objectToStore = "Test Object";
     CacheManager manager = new CacheManager(new MemoryProvider());
     manager.Store(objectToStore);
     Assert.AreEqual(objectToStore, manager.GetMostRecentCacheItem());
 }
        public void Example()
        {
            var cacheManager = new CacheManager();

            Assert.IsNotNull(cacheManager);

        }
    public static IUnitTestElement ReadFromXml(XmlElement parent, IUnitTestElement parentElement, MSpecUnitTestProvider provider, ISolution solution
#if RESHARPER_61
      , IUnitTestElementManager manager, PsiModuleManager psiModuleManager, CacheManager cacheManager
#endif
      )
    {
      var projectId = parent.GetAttribute("projectId");
      var project = ProjectUtil.FindProjectElementByPersistentID(solution, projectId) as IProject;
      if (project == null)
      {
        return null;
      }

      var context = parentElement as ContextElement;
      if (context == null)
      {
        return null;
      }

      var typeName = parent.GetAttribute("typeName");
      var methodName = parent.GetAttribute("methodName");
      var isIgnored = bool.Parse(parent.GetAttribute("isIgnored"));

      return ContextSpecificationFactory.GetOrCreateContextSpecification(provider,
#if RESHARPER_61
                manager, psiModuleManager, cacheManager,
#endif
                project, context, ProjectModelElementEnvoy.Create(project), new ClrTypeName(typeName), methodName, EmptyArray<string>.Instance, isIgnored);
    }
    public void GetOrAddValueFactoryTest()
    {
      var cacheManager = new CacheManager(); 
      string key = "key" + DateTime.Now.Ticks;
      object value = "value" + DateTime.Now.Ticks;
      bool valueCalled = false;

      Func<string, object> valueFactory = k => { valueCalled = true; return value; }; 
      object result = cacheManager.GetOrAdd(key, valueFactory);

      Assert.IsNotNull(result);
      Assert.IsTrue(valueCalled);
      Assert.AreEqual(value, result);

      // value factory 2 should not be called
      object value2 = "value2" + DateTime.Now.Ticks;
      bool value2Called = false;      
      Func<string, object> valueFactory2 = k => { value2Called = true; return value2; };

      object result2 = cacheManager.GetOrAdd(key, valueFactory2);

      Assert.IsNotNull(result2);
      Assert.IsFalse(value2Called);
      // result should still = first call
      Assert.AreEqual(value, result2);
    }
 public SimpleTestingElementFactory(SimpleTestingTestProvider provider, IUnitTestElementManager unitTestManager, CacheManager cacheManager, PsiModuleManager psiModuleManager)
 {
     _provider = provider;
     _unitTestManager = unitTestManager;
     _cacheManager = cacheManager;
     _psiModuleManager = psiModuleManager;
 }
 public XunitServiceProvider(XunitTestProvider provider, PsiModuleManager psiModuleManager,
     CacheManager cacheManager)
 {
     this.provider = provider;
     this.psiModuleManager = psiModuleManager;
     this.cacheManager = cacheManager;
 }
 public void AddKeyNullTest()
 {
   var cacheManager = new CacheManager();
   string key = null;
   object value = "value" + DateTime.Now.Ticks;
   CachePolicy cachePolicy = null;
   bool isAdded = cacheManager.Add(key, value, cachePolicy);
 }
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            RegisterRoutes(RouteTable.Routes);
            var cachemanager = new CacheManager<ImageModel>("Images", 60 * 6); // 6 hours?
            cachemanager.Clear();
        }
		public void TestInitialize()
        {
			CacheManagerFactory factory = new CacheManagerFactory(TestConfigurationSource.GenerateConfiguration());
			cache = factory.Create("InDatabasePersistence");
			cache.Flush();
            wasCalledBack = false;
            initializationCount = 0;
        }
 public MSpecUnitTestElementSerializer(ISolution solution, MSpecUnitTestProvider provider, IUnitTestElementManager manager, PsiModuleManager psiModuleManager, CacheManager cacheManager)
 {
   _solution = solution;
   _provider = provider;
   _manager = manager;
   _psiModuleManager = psiModuleManager;
   _cacheManager = cacheManager;
 }
 public Flash_R_Tree(CacheManager cache, Int32 reservationBufferSize)
     : base(cache)
 {
     BufferSize = reservationBufferSize;
     Buffer = new ReservationBuffer(BufferSize);
     NodeTranslationTable = new NodeTranslationTable(cache);
     Cache = NodeTranslationTable;
 }
Exemple #23
0
 public void RunRandomThreadsInDatabase()
 {
     //            Console.WriteLine("\n\n\n********");
     //            Console.WriteLine("*** RunRandomThreadsInDatabase");
     //            Console.WriteLine("********\n\n\n");
     currentCacheManager = CacheFactory.GetCacheManager("InDatabasePerformanceTest");
     RunTest(new ThreadStart(RandomWorkerMethod));
 }
        public AmoebaManager(string bitmapPath, string cachePath, BufferManager bufferManager)
        {
            _bitmapPath = bitmapPath;
            _cachePath = cachePath;
            _bufferManager = bufferManager;

            _clientManager = new ClientManager(_bufferManager);
            _serverManager = new ServerManager(_bufferManager);
            _bitmapManager = new BitmapManager(_bitmapPath, _bufferManager);
            _cacheManager = new CacheManager(_cachePath, _bitmapManager, _bufferManager);
            _connectionsManager = new ConnectionsManager(_clientManager, _serverManager, _cacheManager, _bufferManager);
            _downloadManager = new DownloadManager(_connectionsManager, _cacheManager, _bufferManager);
            _uploadManager = new UploadManager(_connectionsManager, _cacheManager, _bufferManager);
            _backgroundDownloadManager = new BackgroundDownloadManager(_connectionsManager, _cacheManager, _bufferManager);
            _backgroundUploadManager = new BackgroundUploadManager(_connectionsManager, _cacheManager, _bufferManager);

            _clientManager.CreateCapEvent = (object sender, string uri) =>
            {
                if (_createCapEvent != null)
                {
                    return _createCapEvent(this, uri);
                }

                return null;
            };

            _serverManager.AcceptCapEvent = (object sender, out string uri) =>
            {
                uri = null;

                if (_acceptCapEvent != null)
                {
                    return _acceptCapEvent(this, out uri);
                }

                return null;
            };

            _clientManager.CheckUriEvent = (object sender, string uri) =>
            {
                if (_checkUriEvent != null)
                {
                    return _checkUriEvent(this, uri);
                }

                return true;
            };

            _serverManager.CheckUriEvent = (object sender, string uri) =>
            {
                if (_checkUriEvent != null)
                {
                    return _checkUriEvent(this, uri);
                }

                return true;
            };
        }
 public CacheManagerStreamWriter(out KeyCollection keys, int blockLength, HashAlgorithm hashAlgorithm, CacheManager cacheManager, BufferManager bufferManager)
 {
     keys = _keyList;
     _hashAlgorithm = hashAlgorithm;
     _cacheManager = cacheManager;
     _bufferManager = bufferManager;
     _blockBuffer = bufferManager.TakeBuffer(blockLength);
     _blockBufferLength = blockLength;
 }
		public OrderModuleController(ICustomerOrderService customerOrderService, ICustomerOrderSearchService searchService, IStoreService storeService, IOperationNumberGenerator numberGenerator, CacheManager cacheManager, Func<IOrderRepository> repositoryFactory)
        {
            _customerOrderService = customerOrderService;
            _searchService = searchService;
            _operationNumberGenerator = numberGenerator;
            _storeService = storeService;
			_cacheManager = cacheManager;
			_repositoryFactory = repositoryFactory;
        }
		public void StartCacheProcesses()
        {
            sharedLock = new object();
            callbackCount = 0;
            callbackReason = CacheItemRemovedReason.Unknown;
            exceptionMessage = "";

			cacheManager = MockCacheManagerFactory.Create("ShortInMemoryPersistence", TestConfigurationSource.GenerateConfiguration());
        }
 public R_Tree(String indexSavedLocation, CacheManager cache)
 {
     Cache = cache;
     StreamReader reader = new StreamReader(indexSavedLocation);
     Root = new Address(reader.ReadLine());
     TreeHeight = Int32.Parse(reader.ReadLine());
     Address.NextAddress= Int32.Parse(reader.ReadLine());
     reader.Close();
 }
 public R_Tree(CacheManager cache)
 {
     Cache = cache;
     Leaf rootNode = new Leaf(Address.Empty);
     root = rootNode.Address;
     Cache.WritePageData(rootNode);
     TreeHeight = 1;
     Cache.FlushCache();
 }
 public SavedIndexBuilder(
     Type treeType,
     CacheManager cache,
     String savedIndexFileLocation)
 {
     SavedIndexFileLocation = savedIndexFileLocation;
     TreeType = treeType;
     Cache = cache;
 }