Exemple #1
0
def pre_built_queries(data_type):
    return client.QueryRequest(data_type,
                               pre_built_region(),
                               start_date.strftime(timehelpers.date_format),
                               end_date.strftime(timehelpers.date_format),
                               skip,
                               limit)
Exemple #2
0
def build_request(config):
    request = None

    area = config.get('SERVICE_REGION', None)
    region = None
    if area is not None:
        region = build_region(area)
    else:
        region = simulatedClientPresets.pre_built_region()

    if config.get('REQUEST_TYPE',
                  None) and config.get('REQUEST_TYPE') == 'sub':
        request = client.SubscriptionRequest(config.get('DATA'), region)
    # TEST REQUEST Manager
    if config.get('UPLOAD_TEST_DATA',
                  False) and config.get('REQUEST_TYPE') == 'sub':
        request = client.BaseRequest("tst", "veh", region)

    elif config.get('REQUEST_TYPE',
                    None) and config.get('REQUEST_TYPE') == 'qry':
        request = client.QueryRequest(config.get('DATA_TYPE'), region,
                                      config.get('START_DATE', start_date),
                                      config.get('END_DATE', end_date),
                                      config.get('SKIP', skip),
                                      config.get('LIMIT', limit))
    if config.get('ROAD_SEGMENTS', False):
        for segment in config['ROAD_SEGMENTS']:
            if segment.get('startPoint'):
                startPoint = client.OdePoint(
                    *tuple(segment['startPoint'].split(',')))
            else:
                startPoint = None

            endpoint = client.OdePoint(*tuple(segment['endPoint'].split(',')))
            rs = client.RoadSegment(segment['id'],
                                    startPoint=startPoint,
                                    endPoint=endpoint,
                                    previousSegmentId=segment.get(
                                        'previousSegmentId', None))
            request.add_road_segments(rs)
    return request
Exemple #3
0
def build_request(config):
    request = None

    area = config.get('SERVICE_REGION', None)

    if area is not None:
        region = build_region(area)

    if config.get('REQUEST_TYPE', None):
        if config.get('REQUEST_TYPE') == 'sub':
            request = client.SubscriptionRequest(config.get('DATA_TYPE'),
                                                 region)
        elif config.get('REQUEST_TYPE') == 'qry':
            request = client.QueryRequest(config.get('DATA_TYPE'), region,
                                          config.get('START_DATE', start_date),
                                          config.get('END_DATE', end_date),
                                          config.get('SKIP', skip),
                                          config.get('LIMIT', limit))
        elif "INPUT_FILE" in config and (config.get('REQUEST_TYPE') == 'tst' or
                                         config.get('REQUEST_TYPE') == 'dep'):
            request = client.BaseRequest(config.get('REQUEST_TYPE'),
                                         config.get('DATA_TYPE'), region)

    if config.get('ROAD_SEGMENTS', False):
        for segment in config['ROAD_SEGMENTS']:
            if segment.get('startPoint'):
                startPoint = client.OdePoint(
                    *tuple(segment['startPoint'].split(',')))
            else:
                startPoint = None

            endpoint = client.OdePoint(*tuple(segment['endPoint'].split(',')))
            rs = client.RoadSegment(segment['id'],
                                    startPoint=startPoint,
                                    endPoint=endpoint,
                                    previousSegmentId=segment.get(
                                        'previousSegmentId', None))
            request.add_road_segments(rs)
    return request
Exemple #4
0
def build_query_request(config, **kwargs):
    return client.QueryRequest(config['DATA'],
                               build_region(config['SERVICE_REGION']),
                               config['START_DATE'], config['END_DATE'],
                               config['SKIP'], config['LIMIT'], **kwargs)
 def build_qry_request(self, data_type):
     return client.QueryRequest(data_type, self.region, self.start_date,
                                self.end_date, self.skip, self.limit)
Exemple #6
0
start_date = datetime.datetime(2015, month=1, day=1, hour=1, minute=1, second=30, tzinfo=timehelpers.ZULU())
end_date = datetime.datetime(2015, month=6, day=1, hour=23, minute=59, second=59, microsecond=999,
                             tzinfo=timehelpers.ZULU())
date_format = '%Y-%m-%dT%H:%M:%S.%f%Z'

# File Name to capture ODE OUTPUT
# Same date time stamp used for log file
ode_output_file_name = 'ODE_test_run_{0}.txt'.format(current_date_time)
log_to_file = True

qry_data_type = "veh" # veh, int,  adv
skip = 0,
limit = 100
qry_request = client.QueryRequest(qry_data_type,
                                  region,
                                  start_date.strftime(timehelpers.date_format),
                                  end_date.strftime(timehelpers.date_format),
                                  skip,
                                  limit)

qry_subs = \
    {
        "veh": { client.QueryRequest("veh",
                                  region,
                                  start_date.strftime(timehelpers.date_format),
                                  end_date.strftime(timehelpers.date_format),
                                  skip,
                                  limit)

        },
        "adv": {
                client.QueryRequest("adv",