예제 #1
0
    def process_arguments(cls, cmd_args):
        if len(cmd_args) < 6:
            raise ArgumentError("JoinGroupV1 requires at least 6 arguments")

        try:
            values = {'group_id': cmd_args[0],
                      'session_timeout': int(cmd_args[1]),
                      'rebalance_timeout': int(cmd_args[2]),
                      'member_id': cmd_args[3],
                      'protocol_type': cmd_args[4],
                      'group_protocols': []}
        except ValueError:
            raise ArgumentError("The session_timeout and rebalance_timeout must be integers")

        for protocol in cmd_args[5:]:
            values['group_protocols'].append(_parse_group_protocol(protocol))

        return values
예제 #2
0
    def process_arguments(cls, cmd_args):
        if len(cmd_args) < 6:
            raise ArgumentError("JoinGroupV1 requires at least 6 arguments")

        try:
            values = {
                'group_id': cmd_args[0],
                'session_timeout': int(cmd_args[1]),
                'rebalance_timeout': int(cmd_args[2]),
                'member_id': cmd_args[3],
                'protocol_type': cmd_args[4],
                'group_protocols': []
            }
        except ValueError:
            raise ArgumentError(
                "The session_timeout and rebalance_timeout must be integers")

        for protocol in cmd_args[5:]:
            values['group_protocols'].append(_parse_group_protocol(protocol))

        return values
예제 #3
0
 def test_parse_group_protocol(self):
     val = _parse_group_protocol('protocoltype,891234abdb')
     assert val == {
         'protocol_name': 'protocoltype',
         'protocol_metadata': b'\x89\x12\x34\xab\xdb'
     }
예제 #4
0
 def test_parse_group_protocol_blank_metadata(self):
     val = _parse_group_protocol('protocoltype,')
     assert val == {
         'protocol_name': 'protocoltype',
         'protocol_metadata': None
     }
예제 #5
0
 def test_parse_group_protocol(self):
     val = _parse_group_protocol('protocoltype,891234abdb')
     assert val == {'protocol_name': 'protocoltype', 'protocol_metadata': b'\x89\x12\x34\xab\xdb'}
예제 #6
0
 def test_parse_group_protocol_blank_metadata(self):
     val = _parse_group_protocol('protocoltype,')
     assert val == {'protocol_name': 'protocoltype', 'protocol_metadata': None}