Exemple #1
0
    public void SetUp()
    {
      var csDefault = "google-drive{{ email='{0}' cert-path=$'{1}' }}"
        .Args(GOOGLE_DRIVE_EMAIL, GOOGLE_DRIVE_CERT_PATH);

      CONN_PARAMS = FileSystemSessionConnectParams.Make<GoogleDriveParameters>(csDefault);

      var csTimeout = "google-drive{{ email='{0}' cert-path=$'{1}' timeout-ms=1 }}"
        .Args(GOOGLE_DRIVE_EMAIL, GOOGLE_DRIVE_CERT_PATH);

      CONN_PARAMS_TIMEOUT = FileSystemSessionConnectParams.Make<GoogleDriveParameters>(csTimeout);

      cleanUp();
      initialize();
    }
        static GoogleDriveFileSystemTests()
        {
            try
            {
                var env = System.Environment.GetEnvironmentVariable(NFX_GOOGLE_DRIVE);

                var cfg = Configuration.ProviderLoadFromString(env, Configuration.CONFIG_LACONIC_FORMAT).Root;
                CONN_PARAMS = FileSystemSessionConnectParams.Make<GoogleDriveParameters>(env);
            }
            catch(Exception ex)
            {
                throw new Exception(string.Format(
                    "May be environment variable \"{0}\" of format like \"{1}\" isn't present.\nDon't forget to reload VS after variable is added",
                        NFX_GOOGLE_DRIVE,
                        "google-drive{ client-id='<value>' client-secret='<value>' access-token='<value>' refresh-token='<value>' }"
                    ),
                    ex
                );
            }
        }
Exemple #3
0
    private GoogleDriveSession StartSession(GoogleDriveFileSystem fs = null, GoogleDriveParameters connParams = null)
    {
      if (fs == null)
      {
        fs = GetFileSystem();
      }

      return fs.StartSession(connParams ?? CONN_PARAMS) as GoogleDriveSession;
    }