Beispiel #1
0
 def test_query_subset_response_AdventureWorks2014(self):
     """
         Test the retrieval of the actual rows for "select * from HumanResources.Department"
     """
     with open(self.get_baseline(\
               u'test_simple_query.txt'),
               u'r+b',
               buffering=0) as response_file:
         request_stream = io.BytesIO()
         rpc_client = json_rpc_client.JsonRpcClient(request_stream,
                                                    response_file)
         rpc_client.start()
         # Submit a dummy request.
         owner_uri = u'connectionservicetest'
         parameters = {
             u'OwnerUri': u'connectionservicetest',
             u'BatchIndex': 0,
             u'ResultSetIndex': 0,
             u'RowsStartIndex': 0,
             u'RowCount': 16
         }
         request = queryservice.QuerySubsetRequest(
             request_id=u'3',
             owner_uri=owner_uri,
             json_rpc_client=rpc_client,
             parameters=parameters)
         self.verify_query_service_response(request=request,
                                            expected_result_subsets=1,
                                            expected_row_count=16)
         rpc_client.shutdown()
Beispiel #2
0
    def create_request(self, request_type, parameters):
        """
            Create request of request type passed in.
        """
        request = None
        self.current_id = uuid.uuid4().int

        if request_type == u'connection_request':
            logger.info(u'SqlToolsClient connection request Id {0}'.format(
                self.current_id))
            request = connection.ConnectionRequest(self.current_id,
                                                   self.json_rpc_client,
                                                   parameters)
            return request

        if request_type == u'query_execute_string_request':
            logger.info(u'SqlToolsClient execute string request Id {0}'.format(
                self.current_id))
            request = query.QueryExecuteStringRequest(self.current_id,
                                                      self.json_rpc_client,
                                                      parameters)
            return request

        if request_type == u'query_subset_request':
            logger.info(u'SqlToolsClient subset request Id {0}'.format(
                self.current_id))
            request = query.QuerySubsetRequest(self.current_id,
                                               self.json_rpc_client,
                                               parameters)
            return request
    def test_query_subset_response_AdventureWorks2014(self):
        """
            Test the retrieval of the actual rows for "select * from HumanResources.Department"
        """

        with open(self.get_test_baseline(u'select_from_humanresources_department_adventureworks2014.txt'), u'r+b', buffering=0) as response_file:
            request_stream = io.BytesIO()
            rpc_client = json_rpc_client.JsonRpcClient(
                request_stream, response_file)
            rpc_client.start()
            # Submit a dummy request.
            parameters = {u'OwnerUri': u'connectionservicetest',
                          u'BatchIndex': 0,
                          u'ResultSetIndex': 0,
                          u'RowsStartIndex': 0,
                          u'RowCount': 16}

            request = queryservice.QuerySubsetRequest(
                3, rpc_client, parameters)
            self.verify_subset_response(request=request)
            rpc_client.shutdown()