public void InitializeWithNonExternalDatabaseLoadsSettingsTextResource( ) { // Set up XmlPasswordData.From( new SettingsTextResource( _settings ) ) .SavePasswords( new List<PasswordDigestDocument> { TestPasswords.Abcd } ); _settings.PasswordsAreExternal = false; // Exercise _storageConfiguration = new StorageConfiguration( _settings, _storage ); // Verify Assert.That( _storage.PasswordRepository.PasswordData.LoadPasswords( ), Is.EquivalentTo( new[ ] { TestPasswords.Abcd } ) ); }
public static string GetMountedPathFromBlob(IStorageConfiguration config, string localCachePath, string cloudDir, string containerName, string blobName, int driveSize, out CloudDrive drive) { Diagnostics.TraceInformation(string.Format("In mounting cloud drive for dir {0} on {1} with {2}", cloudDir, containerName, blobName)); var blobClient = config.Account.CreateCloudBlobClient(); Diagnostics.TraceInformation("Get container"); // this should be the name of your replset var driveContainer = blobClient.GetContainerReference(containerName); // create blob container (it has to exist before creating the cloud drive) try { driveContainer.CreateIfNotExist(); } catch (Exception e) { Diagnostics.Trace("Exception when creating container", e); } var blobUri = blobClient.GetContainerReference(containerName).GetPageBlobReference(blobName).Uri.ToString(); Diagnostics.TraceInformation(string.Format("Blob uri obtained {0}", blobUri)); // create the cloud drive drive = config.Account.CreateCloudDrive(blobUri); try { drive.Create(driveSize); } catch {} Diagnostics.TraceInformation("Initialize cache"); var localStorage = RoleEnvironment.GetLocalResource(localCachePath); CloudDrive.InitializeCache(localStorage.RootPath.TrimEnd('\\'), localStorage.MaximumSizeInMegabytes); // mount the drive and get the root path of the drive it's mounted as Diagnostics.TraceInformation(string.Format("Trying to mount blob as azure drive on {0}", RoleEnvironment.CurrentRoleInstance.Id)); var driveLetter = drive.Mount(localStorage.MaximumSizeInMegabytes, DriveMountOptions.None); Diagnostics.TraceInformation(string.Format("Write lock acquired on azure drive, mounted as {0}, on role instance {1}", driveLetter, RoleEnvironment.CurrentRoleInstance.Id)); return driveLetter; }
public void InitializeWithExternalDatabaseLoadsFileTextResource( ) { // Set up var passwordsFile = new FileInfo( TempFile ); XmlPasswordData.From( new FileTextResource( passwordsFile ) ) .SavePasswords( new List<PasswordDigestDocument> { TestPasswords.Efgh } ); _settings.ExternalPasswordDatabaseFile = passwordsFile.FullName; _settings.PasswordsAreExternal = true; // Exercise _storageConfiguration = new StorageConfiguration( _settings, _storage ); // Verify Assert.That( _storage.PasswordRepository.PasswordData.LoadPasswords( ), Is.EquivalentTo( new[ ] { TestPasswords.Efgh } ) ); }
public void ChangeFromInternalToExternalMergesPasswords( ) { // Set up XmlPasswordData.From( new SettingsTextResource( _settings ) ) .SavePasswords( new List<PasswordDigestDocument> { TestPasswords.Abcd } ); var passwordsFile = new FileInfo( TempFile ); XmlPasswordData.From( new FileTextResource( passwordsFile ) ) .SavePasswords( new List<PasswordDigestDocument> { TestPasswords.Efgh } ); _settings.PasswordsAreExternal = false; _storageConfiguration = new StorageConfiguration( _settings, _storage ); // Exercise _storageConfiguration.SelectExternalStorage( passwordsFile ); // Verify Assert.That( _storage.PasswordRepository.PasswordData.LoadPasswords( ), Is.EquivalentTo( new[ ] { TestPasswords.Abcd, TestPasswords.Efgh } ) ); }
public PasswordManagerViewModel( IFileSelectionService fileSelectionService, IDialogService dialogService, IPasswordExchange passwordExchange, IStorageConfiguration storageConfiguration, Settings settings, PasswordListViewModel passwordList ) { _passwordList = passwordList; _passwordExchange = passwordExchange; _storageConfiguration = storageConfiguration; _settings = settings; _fileSelectionService = fileSelectionService; _dialogService = dialogService; _selectInternalStorageCommand = new RelayCommand( ExecuteSelectInternalStorage ); _selectExternalStorageCommand = new RelayCommand( ExecuteSelectExternalStorage ); _toggleAlwaysShowLegacyPasswordTypes = new RelayCommand( ExecuteToggleAlwaysShowLegacyPasswordTypes ); _quitCommand = new RelayCommand( ExecuteQuit ); _importPasswordsCommand = new RelayCommand( ExecuteImportPasswords ); _exportPasswordsCommand = new RelayCommand( ExecuteExportPasswords ); Update( ); }
public void AssertConfiguration(IStorageConfiguration storageConfiguration, string name, string value) { Assert.That(storageConfiguration.ConfigurationValues.ContainsKey(name)); Assert.That(storageConfiguration.ConfigurationValues[name], Is.EqualTo(value)); }
public AzureUniqueIdGenerator(IStorageConfiguration configuration, string containerName, int batchSize) { _configuration = configuration; _containerName = containerName; _batchSize = batchSize; }
public AzureTableStorageCounter(IStorageConfiguration configuration) { var account = CloudStorageAccount.Parse(configuration.GetConnectionString()); var client = account.CreateCloudTableClient(); _table = client.GetTableReference(configuration.GetContainer()); }
public void ChangeFromInternalToExternalSavesFurtherPasswordsToExternal( ) { // Set up var passwordsFile = new FileInfo( TempFile ); PasswordDigestDocument password = new PasswordDigestDocumentBuilder { Key = "abc " }; _settings.PasswordsAreExternal = false; _storageConfiguration = new StorageConfiguration( _settings, _storage ); _storageConfiguration.SelectExternalStorage( passwordsFile ); // Exercise _storage.PasswordRepository.SavePassword( password ); // Verify var passwords = XmlPasswordData .From( new FileTextResource( passwordsFile ) ) .LoadPasswords( ); Assert.That( passwords, Is.EquivalentTo( new[ ] { password } ) ); }
public UploadController() { _configuration = WebService.Configuration.Instance.Storage; }
public VsixStorageWatcher(string vsixDirectory, IStorageConfiguration storageConfig, IGalleryConfiguration galleryConfig) { _vsixDirectory = vsixDirectory; _feedBuilder = new VsixFeedBuilder(storageConfig, galleryConfig); _feedBuilder.BackgroundProgress += FeedBuilderOnBackgroundProgress; }