def __init__(self, halt_event, user_identity, test_script):
        self._log = logging.getLogger(user_identity.user_name)
        self._halt_event = halt_event
        self._user_identity = user_identity
        self._test_script = test_script
        self._multipart_upload_cutoff = \
                2 * self._test_script["multipart-part-size"]
        if "archive-failure-percent" in self._test_script:
            self._archive_failure_percent = \
                self._test_script["archive-failure-percent"]
        else:
            self._archive_failure_percent = 0

        self._default_collection_name = compute_default_collection_name(
            self._user_identity.user_name
        )
        self._s3_connection = None

        self._buckets = dict()
        self._bucket_accounting = dict()
        self._versioned_bucket_names = list()
        self._unversioned_bucket_names = list()

        self._dispatch_table = {
            "create-bucket"           : self._create_bucket,
            "create-versioned-bucket" : self._create_versioned_bucket,
            "delete-bucket"           : self._delete_bucket,
            "archive-new-key"         : self._archive_new_key,
            "archive-new-version"     : self._archive_new_version,
            "archive-overwrite"       : self._archive_overwrite,
            "retrieve-latest"         : self._retrieve_latest,
            "retrieve-version"        : self._retrieve_version,
            "delete-key"              : self._delete_key,
            "delete-version"          : self._delete_version,
        }
        self._frequency_table = list()

        self._bucket_name_manager = BucketNameManager(
            self._user_identity.user_name,
            test_script["max-bucket-count"],
        ) 

        self._key_name_manager = KeyNameManager() 
        self._key_name_generator = None

        self.key_verification = dict()
        self._error_count = 0
Esempio n. 2
0
    def __init__(self, halt_event, user_identity, test_script):
        self._log = logging.getLogger(user_identity.user_name)
        self._halt_event = halt_event
        self._user_identity = user_identity
        self._test_script = test_script
        self._multipart_upload_cutoff = \
                2 * self._test_script["multipart-part-size"]
        if "archive-failure-percent" in self._test_script:
            self._archive_failure_percent = \
                self._test_script["archive-failure-percent"]
        else:
            self._archive_failure_percent = 0

        self._default_collection_name = compute_default_collection_name(
            self._user_identity.user_name)
        self._s3_connection = None

        self._buckets = dict()
        self._bucket_accounting = dict()
        self._versioned_bucket_names = list()
        self._unversioned_bucket_names = list()

        self._dispatch_table = {
            "create-bucket": self._create_bucket,
            "create-versioned-bucket": self._create_versioned_bucket,
            "delete-bucket": self._delete_bucket,
            "archive-new-key": self._archive_new_key,
            "archive-new-version": self._archive_new_version,
            "archive-overwrite": self._archive_overwrite,
            "retrieve-latest": self._retrieve_latest,
            "retrieve-version": self._retrieve_version,
            "delete-key": self._delete_key,
            "delete-version": self._delete_version,
        }
        self._frequency_table = list()

        self._bucket_name_manager = BucketNameManager(
            self._user_identity.user_name,
            test_script["max-bucket-count"],
        )

        self._key_name_manager = KeyNameManager()
        self._key_name_generator = None

        self.key_verification = dict()
        self._error_count = 0
Esempio n. 3
0
    def __init__(self, identity=None):
        self._log = logging.getLogger("S3Emulator")

        if identity is not None:
            self._identity = identity
        else:
            identity = load_identity_from_environment()
            if identity is not None:
                self._identity = identity
            else:
                identity = load_identity_from_file()
                if identity is not None:
                    self._identity = identity
                else:
                    raise ValueError(
                        "You must specify identity in environment or file")

        self._default_bucket = Bucket(
            self._identity,
            compute_default_collection_name(self._identity.user_name))
Esempio n. 4
0
    def __init__(self, config=None):
        self._log = logging.getLogger("S3Emulator")

        if config is not None:
            self._config = config
        else:
            config = load_config_from_environment()
            if config is not None:
                self._config = config
            else:
                config = load_config_from_file()
                if config is not None:
                    self._config = config
                else:
                    raise ValueError(
                        "You must specify config in environment of file"
                    )

        self._default_bucket = Bucket(
            self._config, 
            compute_default_collection_name(self._config.user_name)
        )
Esempio n. 5
0
    def __init__(self, identity=None):
        self._log = logging.getLogger("S3Emulator")

        if identity is not None:
            self._identity = identity
        else:
            identity = load_identity_from_environment()
            if identity is not None:
                self._identity = identity
            else:
                identity = load_identity_from_file()
                if identity is not None:
                    self._identity = identity
                else:
                    raise ValueError(
                        "You must specify identity in environment or file"
                    )

        self._default_bucket = Bucket(
            self._identity, 
            compute_default_collection_name(self._identity.user_name)
        )