Beispiel #1
0
class VerifierTasks(TaskSet):
    hubTasks = None

    def on_start(self):
        self.hubTasks = HubTasks(BatchUser(), self.client)
        self.hubTasks.start()

    @task(10000)
    def write(self):
        bulk = ""
        for x in range(0, 50):
            bulk += "--abcdefg\r\n"
            bulk += "Content-Type: application/json\r\n\r\n"
            bulk += '{"name":"' + self.hubTasks.payload + '", "count": ' + str(
                self.hubTasks.count) + '}\r\n'
            self.hubTasks.count += 1
        bulk += "--abcdefg--\r\n"

        with self.client.post(
                "/channel/" + self.hubTasks.channel + "/bulk",
                data=bulk,
                headers={"Content-Type": "multipart/mixed; boundary=abcdefg"},
                catch_response=True,
                name="post_bulk") as postResponse:
            if postResponse.status_code != 201:
                postResponse.failure("Got wrong response on post: " +
                                     str(postResponse.status_code))

        links = postResponse.json()

        uris = links['_links']['uris']
        for uri in uris:
            self.hubTasks.append_href(uri)
        # todo add read functionality
        return uris

    @task(10)
    def next_10(self):
        self.hubTasks.next_10()

    @task(10)
    def minute_query(self):
        self.hubTasks.minute_query()

    @task(10)
    def second_query(self):
        self.hubTasks.second_query()

    @task(10)
    def verify_callback_length(self):
        self.hubTasks.verify_callback_length(50000)

    @web.app.route("/callback", methods=['GET'])
    def get_channels():
        return HubTasks.get_channels()

    @web.app.route("/callback/<channel>", methods=['GET', 'POST'])
    def callback(channel):
        return HubTasks.callback(channel)
Beispiel #2
0
class VerifierTasks(TaskSet):
    hubTasks = None

    def on_start(self):
        self.hubTasks = HubTasks(VerifierUser(), self.client)
        self.hubTasks.start()

    @task(1000)
    def write_read(self):
        self.hubTasks.write_read()

    @task(50)
    def change_parallel(self):
        self.hubTasks.change_parallel("verifier_test_2")

    @task(100)
    def sequential(self):
        self.hubTasks.sequential()

    @task(1)
    def hour_query(self):
        self.hubTasks.hour_query()

    @task(1)
    def hour_query_get_items(self):
        self.hubTasks.hour_query_get_items()

    @task(1)
    def minute_query(self):
        self.hubTasks.minute_query()

    @task(1)
    def minute_query_get_items(self):
        self.hubTasks.minute_query_get_items()

    @task(10)
    def next_previous(self):
        self.hubTasks.next_previous()

    @task(10)
    def second_query(self):
        self.hubTasks.second_query()

    @task(10)
    def verify_callback_length(self):
        self.hubTasks.verify_callback_length()

    @web.app.route("/callback", methods=['GET'])
    def get_channels():
        return HubTasks.get_channels()

    @web.app.route("/callback/<channel>", methods=['GET', 'POST'])
    def callback(channel):
        return HubTasks.callback(channel)
Beispiel #3
0
class HistoricalTasks(TaskSet):
    hubTasks = None

    def on_start(self):
        self.user = HistoricalUser()
        self.hubTasks = HubTasks(self.user, self.client)
        self.hubTasks.start()

    @task(1000)
    def write_read(self):
        self.hubTasks.write_read()

    @task(1)
    def hour_query(self):
        self.hubTasks.hour_query()

    @task(1)
    def hour_query_get_items(self):
        self.hubTasks.hour_query_get_items()

    @task(1)
    def minute_query(self):
        self.hubTasks.minute_query()

    @task(1)
    def minute_query_get_items(self):
        self.hubTasks.minute_query_get_items()

    @task(10)
    def second_query(self):
        self.hubTasks.second_query()

    @task(10)
    def next_previous(self):
        self.hubTasks.next_previous()

    @task(10)
    def verify_callback_length(self):
        self.hubTasks.verify_callback_length()

    @web.app.route("/callback", methods=['GET'])
    def get_channels():
        logger.debug(
            utils.get_client_address(request) + ' | ' + request.method +
            ' | /callback')
        return HubTasks.get_channels()

    @web.app.route("/callback/<channel>", methods=['GET', 'POST'])
    def callback(channel):
        logger.debug(
            utils.get_client_address(request) + ' | ' + request.method +
            ' | /callback/' + channel + ' | ' + request.get_data().strip())
        return HubTasks.callback(channel)
Beispiel #4
0
class HistoricalTasks(TaskSet):
    hubTasks = None

    def on_start(self):
        self.user = HistoricalUser()
        self.hubTasks = HubTasks(self.user, self.client)
        self.hubTasks.start()

    @task(1000)
    def write_read(self):
        self.hubTasks.write_read()

    @task(1)
    def hour_query(self):
        self.hubTasks.hour_query()

    @task(1)
    def hour_query_get_items(self):
        self.hubTasks.hour_query_get_items()

    @task(1)
    def minute_query(self):
        self.hubTasks.minute_query()

    @task(1)
    def minute_query_get_items(self):
        self.hubTasks.minute_query_get_items()

    @task(10)
    def second_query(self):
        self.hubTasks.second_query()

    @task(10)
    def next_previous(self):
        self.hubTasks.next_previous()

    @task(10)
    def verify_callback_length(self):
        self.hubTasks.verify_callback_length()

    @web.app.route("/callback", methods=['GET'])
    def get_channels():
        return HubTasks.get_channels()

    @web.app.route("/callback/<channel>", methods=['GET', 'POST'])
    def callback(channel):
        return HubTasks.callback(channel)
Beispiel #5
0
class VerifierTasks(TaskSet):
    hubTasks = None

    def on_start(self):
        self.hubTasks = HubTasks(SingleUser(), self.client)
        self.hubTasks.start()

    @task(1000)
    def write_read(self):
        self.hubTasks.write_read()

    @task(10)
    def hour_query(self):
        self.hubTasks.hour_query()

    @task(10)
    def minute_query(self):
        self.hubTasks.minute_query()

    @task(10)
    def second_query(self):
        self.hubTasks.second_query()

    @task(10)
    def next_previous(self):
        self.hubTasks.next_previous()

    @task(10)
    def verify_callback_length(self):
        self.hubTasks.verify_callback_length(20000)

    @web.app.route("/callback", methods=['GET'])
    def get_channels():
        logger.debug(utils.get_client_address(request) + ' | ' + request.method + ' | /callback')
        return HubTasks.get_channels()

    @web.app.route("/callback/<channel>", methods=['GET', 'POST'])
    def callback(channel):
        logger.debug(utils.get_client_address(request) + ' | ' + request.method + ' | /callback/' + channel + ' | ' + request.get_data().strip())
        return HubTasks.callback(channel)

    @web.app.route('/store/<name>', methods=['GET'])
    def get_store(name):
        return Response(HubTasks.get_store(name), mimetype='application/json')
Beispiel #6
0
class VerifierTasks(TaskSet):
    hubTasks = None

    def on_start(self):
        self.hubTasks = HubTasks(BatchUser(), self.client)
        self.hubTasks.start()

    @task(10000)
    def write(self):
        bulk = ""
        for x in range(0, 50):
            bulk += "--abcdefg\r\n"
            bulk += "Content-Type: application/json\r\n\r\n"
            bulk += '{"name":"' + self.hubTasks.payload + '", "count": ' + str(self.hubTasks.count) + '}\r\n'
            self.hubTasks.count += 1
        bulk += "--abcdefg--\r\n"

        with self.client.post("/channel/" + self.hubTasks.channel + "/bulk", data=bulk,
                              headers={"Content-Type": "multipart/mixed; boundary=abcdefg"}, catch_response=True,
                              name="post_bulk") as postResponse:
            if postResponse.status_code != 201:
                postResponse.failure("Got wrong response on post: " + str(postResponse.status_code))

        links = get_response_as_json(postResponse)
        logger.debug('item POSTed: ' + links['_links']['self']['href'])

        uris = links['_links']['uris']
        for uri in uris:
            self.hubTasks.append_href(uri, 'websockets')
            self.hubTasks.append_href(uri, 'webhooks')
        # todo add read functionality
        return uris

    @task(10)
    def next_10(self):
        self.hubTasks.next_10()

    @task(10)
    def minute_query(self):
        self.hubTasks.minute_query()

    @task(10)
    def second_query(self):
        self.hubTasks.second_query()

    @task(10)
    def verify_callback_length(self):
        self.hubTasks.verify_callback_length(50000)

    @web.app.route("/callback", methods=['GET'])
    def get_channels():
        logger.debug(utils.get_client_address(request) + ' | ' + request.method + ' | /callback')
        return HubTasks.get_channels()

    @web.app.route("/callback/<channel>", methods=['GET', 'POST'])
    def callback(channel):
        logger.debug(utils.get_client_address(request) + ' | ' + request.method + ' | /callback/' + channel + ' | ' + request.get_data().strip())
        return HubTasks.callback(channel)

    @web.app.route('/store/<name>', methods=['GET'])
    def get_store(name):
        return Response(HubTasks.get_store(name), mimetype='application/json')
Beispiel #7
0
class VerifierTasks(TaskSet):
    hubTasks = None

    def on_start(self):
        self.hubTasks = HubTasks(VerifierUser(), self.client)
        self.hubTasks.start()

    @task(1000)
    def write_read(self):
        self.hubTasks.write_read()

    @task(5)
    def change_parallel(self):
        self.hubTasks.change_parallel("verifier_test_2")

    @task(100)
    def sequential(self):
        self.hubTasks.sequential()

    @task(1)
    def earliest(self):
        self.hubTasks.earliest()

    @task(100)
    def latest(self):
        self.hubTasks.latest()

    @task(10)
    def day_query(self):
        self.hubTasks.day_query()

    @task(1)
    def hour_query(self):
        self.hubTasks.hour_query()

    @task(1)
    def hour_query_get_items(self):
        self.hubTasks.hour_query_get_items()

    @task(1)
    def minute_query(self):
        self.hubTasks.minute_query()

    @task(1)
    def minute_query_get_items(self):
        self.hubTasks.minute_query_get_items()

    @task(10)
    def next_previous(self):
        self.hubTasks.next_previous()

    @task(10)
    def second_query(self):
        self.hubTasks.second_query()

    @task(10)
    def verify_callback_length(self):
        self.hubTasks.verify_callback_length()

    @web.app.route("/callback", methods=['GET'])
    def get_channels():
        logger.debug(utils.get_client_address(request) + ' | ' + request.method + ' | /callback')
        return HubTasks.get_channels()

    @web.app.route("/callback/<channel>", methods=['GET', 'POST'])
    def callback(channel):
        logger.debug(utils.get_client_address(request) + ' | ' + request.method + ' | /callback/' + channel + ' | ' + request.get_data().strip())
        return HubTasks.callback(channel)

    @web.app.route('/store/<name>', methods=['GET'])
    def get_store(name):
        return Response(HubTasks.get_store(name), mimetype='application/json')