holado 0.2.7__py3-none-any.whl → 0.3.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of holado might be problematic. Click here for more details.

Files changed (118) hide show
  1. holado/common/handlers/undefined.py +7 -1
  2. {holado-0.2.7.dist-info → holado-0.3.0.dist-info}/METADATA +7 -1
  3. {holado-0.2.7.dist-info → holado-0.3.0.dist-info}/RECORD +116 -107
  4. holado_ais/ais/ais_messages.py +97 -6
  5. holado_ais/tests/behave/steps/ais/ais_manager_steps.py +1 -1
  6. holado_ais/tests/behave/steps/ais/ais_messages_steps.py +45 -6
  7. holado_binary/ipc/bit_series.py +3 -3
  8. holado_binary/tests/behave/steps/ipc/binary_steps.py +1 -1
  9. holado_binary/tests/behave/steps/ipc/bit_series_steps.py +4 -3
  10. holado_context/tests/behave/steps/private/common/context_steps.py +1 -1
  11. holado_core/common/resource/persisted_data_manager.py +13 -16
  12. holado_core/common/resource/resource_manager.py +10 -10
  13. holado_core/common/tables/converters/table_converter.py +47 -9
  14. holado_core/common/tables/table.py +2 -2
  15. holado_core/common/tables/table_manager.py +6 -7
  16. holado_core/common/tables/table_with_header.py +6 -0
  17. holado_core/common/tools/string_tools.py +9 -0
  18. holado_core/tests/behave/steps/common/common_steps.py +2 -1
  19. holado_core/tests/behave/steps/common/config_steps.py +1 -1
  20. holado_core/tests/behave/steps/common/resource_steps.py +1 -1
  21. holado_core/tests/behave/steps/common/tables_steps.py +27 -4
  22. holado_data/data/generator/generator_manager.py +39 -0
  23. holado_data/tests/behave/steps/data/generator_steps.py +1 -1
  24. holado_data/tests/behave/steps/tools/utils_steps.py +1 -2
  25. holado_db/tests/behave/steps/tools/db/db_client_steps.py +1 -1
  26. holado_db/tests/behave/steps/tools/db/postgresql_client_steps.py +1 -1
  27. holado_db/tests/behave/steps/tools/db/sqlite_client_steps.py +1 -1
  28. holado_db/tools/db/clients/base/db_client.py +81 -28
  29. holado_db/tools/db/clients/postgresql/postgresql_client.py +17 -7
  30. holado_db/tools/db/query/base/query_builder.py +58 -7
  31. holado_db/tools/db/query/pypika/pypika_query_builder.py +73 -21
  32. holado_docker/tests/behave/steps/tools/docker_steps.py +1 -1
  33. holado_grpc/tests/behave/steps/api/grpc_client_steps.py +1 -1
  34. holado_grpc/tests/behave/steps/private/api/grpc_steps.py +1 -1
  35. holado_helper/script/action.py +16 -7
  36. holado_json/tests/behave/steps/ipc/json_steps.py +1 -1
  37. holado_keycloak/tests/behave/steps/tools/keycloak_client_steps.py +1 -1
  38. holado_multitask/tests/behave/steps/multiprocessing_steps.py +1 -1
  39. holado_multitask/tests/behave/steps/multithreading_steps.py +1 -1
  40. holado_protobuf/ipc/protobuf/types/google/protobuf.py +1 -1
  41. holado_protobuf/tests/behave/steps/ipc/protobuf_steps.py +1 -1
  42. holado_python/common/tools/datetime.py +31 -12
  43. holado_python/standard_library/socket/blocking_socket.py +112 -42
  44. holado_python/standard_library/socket/echo_server.py +4 -3
  45. holado_python/standard_library/socket/message_socket.py +69 -22
  46. holado_python/standard_library/socket/non_blocking_socket.py +65 -67
  47. holado_python/standard_library/socket/socket.py +272 -32
  48. holado_python/standard_library/ssl/resources/certificates/NOTES.txt +1 -1
  49. holado_python/standard_library/ssl/resources/certificates/rootCACert.pem +24 -0
  50. holado_python/standard_library/ssl/resources/certificates/tcpbin.crt +21 -0
  51. holado_python/standard_library/ssl/resources/certificates/tcpbin.key +28 -0
  52. holado_python/standard_library/ssl/ssl.py +138 -21
  53. holado_python/tests/behave/steps/convert_steps.py +1 -1
  54. holado_python/tests/behave/steps/iterable_steps.py +1 -1
  55. holado_python/tests/behave/steps/standard_library/csv_steps.py +1 -1
  56. holado_python/tests/behave/steps/standard_library/datetime_steps.py +1 -1
  57. holado_python/tests/behave/steps/standard_library/hashlib_steps.py +1 -1
  58. holado_python/tests/behave/steps/standard_library/multiprocessing_steps.py +1 -1
  59. holado_python/tests/behave/steps/standard_library/queue_steps.py +1 -1
  60. holado_python/tests/behave/steps/standard_library/socket_steps.py +147 -21
  61. holado_python/tests/behave/steps/standard_library/ssl_steps.py +87 -16
  62. holado_rabbitmq/tests/behave/steps/tools/rabbitmq_client_steps.py +48 -20
  63. holado_rabbitmq/tests/behave/steps/tools/rabbitmq_server_steps.py +1 -1
  64. holado_rabbitmq/tools/rabbitmq/rabbitmq_client.py +19 -13
  65. holado_rabbitmq/tools/rabbitmq/rabbitmq_manager.py +2 -29
  66. holado_redis/tests/behave/steps/tools/redis_client_steps.py +1 -1
  67. holado_rest/tests/behave/steps/api/rest_client_steps.py +1 -1
  68. holado_rest/tests/behave/steps/private/api/rest_steps.py +1 -1
  69. holado_s3/tests/behave/steps/private/tools/s3_steps.py +1 -1
  70. holado_s3/tests/behave/steps/tools/s3_client_steps.py +1 -1
  71. holado_s3/tests/behave/steps/tools/s3_server_steps.py +1 -1
  72. holado_scripting/tests/behave/steps/common/tools/variable_convert_steps.py +3 -2
  73. holado_scripting/tests/behave/steps/common/tools/variable_new_steps.py +1 -1
  74. holado_scripting/tests/behave/steps/common/tools/variable_steps.py +1 -1
  75. holado_scripting/tests/behave/steps/common/tools/variable_verify_steps.py +1 -1
  76. holado_scripting/tests/behave/steps/scenario/function_steps.py +1 -1
  77. holado_scripting/tests/behave/steps/scenario/if_steps.py +1 -1
  78. holado_scripting/tests/behave/steps/scenario/loop_steps.py +1 -1
  79. holado_scripting/text/interpreter/functions/function_apply_function.py +60 -0
  80. holado_scripting/text/interpreter/functions/function_to_string.py +50 -0
  81. holado_scripting/text/interpreter/text_interpreter.py +4 -0
  82. holado_sftp/tests/behave/steps/private/tools/sftp_steps.py +1 -1
  83. holado_sftp/tests/behave/steps/tools/sftp_client_steps.py +1 -1
  84. holado_sftp/tests/behave/steps/tools/sftp_server_steps.py +1 -1
  85. holado_swagger/tests/behave/steps/swagger_hub/mockserver_steps.py +1 -1
  86. holado_system/system/command/command.py +14 -9
  87. holado_system/tests/behave/steps/system/commands_steps.py +1 -1
  88. holado_system/tests/behave/steps/system/file_steps.py +1 -1
  89. holado_system/tests/behave/steps/system/system_steps.py +1 -1
  90. holado_test/scenario/step_tools.py +5 -4
  91. holado_test/scenario/tester_tools.py +6 -3
  92. holado_test/tests/behave/steps/scenario/exception_steps.py +1 -1
  93. holado_test/tests/behave/steps/scenario/scenario_steps.py +1 -1
  94. holado_test/tests/behave/steps/scenario/tester_steps.py +4 -4
  95. holado_value/common/tables/converters/value_table_converter.py +52 -8
  96. holado_value/common/tables/value_table_cell.py +5 -0
  97. holado_value/common/tables/value_table_manager.py +0 -10
  98. holado_value/common/tables/value_table_row.py +0 -1
  99. holado_value/common/tools/value.py +5 -1
  100. holado_ws/tests/behave/steps/api/web_service_steps.py +1 -1
  101. holado_yaml/tests/behave/steps/yaml_steps.py +1 -1
  102. holado_yaml/yaml/yaml_manager.py +2 -2
  103. test_holado/features/NonReg/common/tables/table.feature +30 -24
  104. test_holado/features/NonReg/holado_ais/ais_message-bitarray_to_nmea.feature +1 -1
  105. test_holado/features/NonReg/holado_python/standard_library/socket/local_echo_server/socket_reset.feature +191 -0
  106. test_holado/features/NonReg/holado_python/standard_library/{socket_with_ssl.feature → socket/local_echo_server/socket_with_tls_and_verify.feature} +126 -27
  107. test_holado/features/NonReg/holado_python/standard_library/socket/local_echo_server/socket_with_tls_without_verify.feature +299 -0
  108. test_holado/features/NonReg/holado_python/standard_library/{socket.feature → socket/local_echo_server/socket_without_tls.feature} +63 -1
  109. test_holado/features/NonReg/holado_python/standard_library/socket/tcpbin.com/socket_with_mtls.feature +214 -0
  110. test_holado/features/NonReg/holado_python/standard_library/socket/tcpbin.com/socket_with_tls.feature +184 -0
  111. test_holado/features/NonReg/holado_python/standard_library/socket/tcpbin.com/socket_without_tls.feature +169 -0
  112. test_holado/features/NonReg/tools/RabbitMQ.feature +9 -9
  113. test_holado/features/NonReg/tools/RabbitMQ_steps.feature +8 -8
  114. test_holado/logging.conf +5 -3
  115. holado_core/common/transport/__init__.py +0 -0
  116. holado_core/common/transport/crc.py +0 -40
  117. {holado-0.2.7.dist-info → holado-0.3.0.dist-info}/WHEEL +0 -0
  118. {holado-0.2.7.dist-info → holado-0.3.0.dist-info}/licenses/LICENSE +0 -0
@@ -15,7 +15,7 @@
15
15
 
16
16
  from holado_test.scenario.step_tools import StepTools
17
17
  from holado.common.context.session_context import SessionContext
18
- from holado_test.behave.behave import *
18
+ from holado_test.behave.behave import * # @UnusedWildImport
19
19
  import logging
20
20
  from holado_test.behave.scenario.behave_step_tools import BehaveStepTools
21
21
  from holado_core.common.exceptions.functional_exception import FunctionalException
@@ -31,8 +31,8 @@ def __get_variable_manager():
31
31
  return __get_scenario_context().get_variable_manager()
32
32
 
33
33
 
34
- @Step(r"tester logs (?P<msg>{AnyStr})")
35
- def step_impl(context, msg):
34
+ @Step(r"tester logs (?P<msg>{AnyStr})(?: \((?P<unlimited_str>unlimited)\))?")
35
+ def step_impl(context, msg, unlimited_str):
36
36
  msg = StepTools.evaluate_scenario_parameter(msg)
37
37
 
38
38
  # Add multiline text if present
@@ -45,7 +45,7 @@ def step_impl(context, msg):
45
45
  if table:
46
46
  msg += '\n' + table.represent(4)
47
47
 
48
- TesterTools.log(msg)
48
+ TesterTools.log(msg, unlimited_str is not None)
49
49
 
50
50
 
51
51
  @Step(r"(?P<var_name>{Variable}) = tester represents (?P<param>{Any})")
@@ -27,6 +27,7 @@ from holado_value.common.tools.value_types import ValueTypes
27
27
  from holado_core.common.tools.tools import Tools
28
28
  from holado_json.ipc.json_converter import JsonConverter
29
29
  from holado_python.standard_library.typing import Typing
30
+ from holado_data.data.generator.base import BaseGenerator
30
31
 
31
32
  logger = logging.getLogger(__name__)
32
33
 
@@ -67,15 +68,58 @@ class ValueTableConverter(TableConverter):
67
68
  return res
68
69
 
69
70
  @classmethod
70
- def convert_table_with_header_to_dict_list(cls, table):
71
- index_by_name = table.get_column_indexes_by_string_content()
72
-
73
- res = []
74
- for row in table.rows:
75
- new_dict = {name: row.get_cell(index).value for name, index in index_by_name.items()}
76
- res.append(new_dict)
71
+ def convert_table_with_header_to_dict_list(cls, table, as_generator=False):
72
+ if not ValueTableManager.is_value_table(table):
73
+ return TableConverter.convert_table_with_header_to_dict_list(table, as_generator=as_generator)
74
+
75
+ if as_generator:
76
+ class TableWithHeader2DictGenerator(BaseGenerator):
77
+ def __init__(self, table):
78
+ super().__init__(name="table with header to dict generator")
79
+ self.__table = table
80
+ self.__index_by_name = table.get_column_indexes_by_string_content()
81
+ self.__table_rows_iter = iter(self.__table.rows)
82
+
83
+ def __next__(self):
84
+ row = next(self.__table_rows_iter)
85
+ return {name: row.get_cell(index).value for name, index in self.__index_by_name.items()}
77
86
 
78
- return res
87
+ return TableWithHeader2DictGenerator(table)
88
+ else:
89
+ # index_by_name = table.get_column_indexes_by_string_content()
90
+ #
91
+ # res = []
92
+ # for row in table.rows:
93
+ # new_dict = {name: row.get_cell(index).value for name, index in index_by_name.items()}
94
+ # res.append(new_dict)
95
+ #
96
+ # return res
97
+ gen = cls.convert_table_with_header_to_dict_list(table, as_generator=True)
98
+ return [e for e in gen]
99
+
100
+ @classmethod
101
+ def convert_table_2_list_of_tuples(cls, table, as_generator=False):
102
+ if not ValueTableManager.is_value_table(table):
103
+ return TableConverter.convert_table_2_list_of_tuples(table, as_generator=as_generator)
104
+
105
+ if Tools.do_log(logger, logging.DEBUG):
106
+ logger.debug("Converting table to a list of tuples...")
107
+ if as_generator:
108
+ class Table2TupleGenerator(BaseGenerator):
109
+ def __init__(self, table):
110
+ super().__init__(name="table with header to dict generator")
111
+ self.__table = table
112
+ self.__table_rows_iter = iter(self.__table.rows)
113
+
114
+ def __next__(self):
115
+ row = next(self.__table_rows_iter)
116
+ return tuple((cell.value for cell in row.cells))
117
+
118
+ return Table2TupleGenerator(table)
119
+ else:
120
+ # return [tuple((cell.content for cell in row.cells)) for row in table.rows]
121
+ gen = cls.convert_table_2_list_of_tuples(table, as_generator=True)
122
+ return [e for e in gen]
79
123
 
80
124
  @classmethod
81
125
  def convert_name_value_table_2_dict(cls, table, with_original_value_content = False):
@@ -63,6 +63,11 @@ class ValueTableCell(TableCell):
63
63
  def value(self):
64
64
  return self.__value.value
65
65
 
66
+ @value.setter
67
+ def value(self, value):
68
+ self.__value = Value(original_value=None, value=value, do_eval_once=self.__value.do_eval_once)
69
+ self.content = self.__value.original_value
70
+
66
71
  def get_value(self, raise_if_undefined=False):
67
72
  return self.__value.get_value(raise_if_undefined=raise_if_undefined)
68
73
 
@@ -35,16 +35,6 @@ class ValueTableManager(TableManager):
35
35
  raise VerifyException(f"Table is not a ValueTable of ValueTableWithHeader (table type: {type(table)})")
36
36
  return res
37
37
 
38
- @classmethod
39
- def convert_table_2_list_of_tuples(cls, table):
40
- if isinstance(table, ValueTable) or isinstance(table, ValueTableWithHeader):
41
- if Tools.do_log(logger, logging.DEBUG):
42
- logger.debug("Converting value table to a list of tuples...")
43
- return [tuple((cell.value for cell in row.cells)) for row in table.rows]
44
- else:
45
- return TableManager.convert_table_2_list_of_tuples(table)
46
-
47
-
48
38
  @classmethod
49
39
  def set_object_attributes_according_name_value_table(cls, obj, table):
50
40
  if not cls.is_value_table(table):
@@ -16,7 +16,6 @@ from holado_value.common.tables.value_table_cell import ValueTableCell
16
16
  from holado_core.common.tables.table_row import TableRow
17
17
  import logging
18
18
  from holado_core.common.tools.tools import Tools
19
- from holado_python.standard_library.typing import Typing
20
19
  from holado.common.handlers.undefined import undefined_value
21
20
 
22
21
  logger = logging.getLogger(__name__)
@@ -69,7 +69,11 @@ class Value(object):
69
69
  return (self.get_value() < other.get_value())
70
70
  else:
71
71
  return TechnicalException(f"Unmanaged comparison between types '{self.__class__.__name__}' and '{other.__class__.__name__}'")
72
-
72
+
73
+ @property
74
+ def do_eval_once(self):
75
+ return self.__do_eval_once
76
+
73
77
  @property
74
78
  def string_value(self):
75
79
  value = self.get_value()
@@ -22,7 +22,7 @@ from holado_value.common.tables.value_table_manager import ValueTableManager
22
22
  from holado.common.context.session_context import SessionContext
23
23
  from holado_core.common.exceptions.functional_exception import FunctionalException
24
24
  from holado_core.common.exceptions.technical_exception import TechnicalException
25
- from holado_test.behave.behave import *
25
+ from holado_test.behave.behave import * # @UnusedWildImport
26
26
  from holado_test.behave.scenario.behave_step_tools import BehaveStepTools
27
27
  from holado_value.common.tables.converters.value_table_converter import ValueTableConverter
28
28
  from holado_test.scenario.step_tools import StepTools
@@ -15,7 +15,7 @@
15
15
 
16
16
  from holado_test.scenario.step_tools import StepTools
17
17
  from holado.common.context.session_context import SessionContext
18
- from holado_test.behave.behave import *
18
+ from holado_test.behave.behave import * # @UnusedWildImport
19
19
  import logging
20
20
  from holado_yaml.yaml.yaml_manager import YAMLManager
21
21
 
@@ -39,7 +39,7 @@ class YAMLManager(object):
39
39
  return with_yaml
40
40
 
41
41
  @classmethod
42
- def __path_manager(cls):
42
+ def __get_path_manager(cls):
43
43
  return SessionContext.instance().path_manager
44
44
 
45
45
  @classmethod
@@ -78,7 +78,7 @@ class YAMLManager(object):
78
78
 
79
79
  @classmethod
80
80
  def save_file(cls, data, file_path):
81
- cls.__path_manager().makedirs(file_path)
81
+ cls.__get_path_manager().makedirs(file_path)
82
82
  with open(file_path, 'w') as file:
83
83
  yaml.dump(data, file)
84
84
 
@@ -10,37 +10,37 @@ Feature: Features related to tables
10
10
 
11
11
  Given end preconditions
12
12
  ### PRECONDITIONS - END
13
-
14
- Then table INPUT_TABLE is
13
+
14
+ Then table INPUT_TABLE is
15
15
  | Name | Value |
16
16
  | 'test1' | 1 |
17
17
  | 'test2' | 2.0 |
18
18
  | 'test3' | 'test3' |
19
19
  | 'test4' | None |
20
20
 
21
- Given EXTRACTED = extract column 'Name' from table INPUT_TABLE
22
- Then table EXTRACTED is
23
- | Name |
24
- | 'test1' |
25
- | 'test2' |
26
- | 'test3' |
27
- | 'test4' |
21
+ Given EXTRACTED = extract column 'Name' from table INPUT_TABLE
22
+ Then table EXTRACTED is
23
+ | Name |
24
+ | 'test1' |
25
+ | 'test2' |
26
+ | 'test3' |
27
+ | 'test4' |
28
28
 
29
- Given EXTRACTED = extract column 'Value' cells from table INPUT_TABLE
30
- Then table EXTRACTED is
31
- | 1 |
32
- | 2.0 |
33
- | 'test3' |
29
+ Given EXTRACTED = extract column 'Value' cells from table INPUT_TABLE
30
+ Then table EXTRACTED is
31
+ | 1 |
32
+ | 2.0 |
33
+ | 'test3' |
34
34
  | None |
35
35
 
36
- Given EXTRACTED = extract column 'Value' cells from table INPUT_TABLE as row
37
- Then table EXTRACTED is
38
- | 1 | 2.0 | 'test3' | None |
36
+ Given EXTRACTED = extract column 'Value' cells from table INPUT_TABLE as row
37
+ Then table EXTRACTED is
38
+ | 1 | 2.0 | 'test3' | None |
39
39
 
40
40
  Scenario: Empty table
41
41
  ### PRECONDITIONS - BEGIN
42
42
  Given begin preconditions
43
-
43
+
44
44
  Given INPUT_TABLE = convert json '{}' to name/value table with names uncollapsed
45
45
  Then table INPUT_TABLE is
46
46
  | Name | Value |
@@ -53,7 +53,7 @@ Feature: Features related to tables
53
53
  Scenario: Table count
54
54
  ### PRECONDITIONS - BEGIN
55
55
  Given begin preconditions
56
-
56
+
57
57
  Given INPUT_TABLE = convert json '{"test1" : 1, "test2":2.0, "test3": "test3", "test4" : null}' to name/value table with names uncollapsed
58
58
 
59
59
  Then table INPUT_TABLE is
@@ -67,7 +67,7 @@ Feature: Features related to tables
67
67
  ### PRECONDITIONS - END
68
68
 
69
69
  Given TABLE_COUNT = number of rows in table INPUT_TABLE
70
- Then TABLE_COUNT == 4
70
+ Then TABLE_COUNT == 4
71
71
 
72
72
 
73
73
  Scenario: Table count empty
@@ -82,12 +82,13 @@ Feature: Features related to tables
82
82
  Given TABLE_COUNT = number of rows in table INPUT_TABLE
83
83
  Then TABLE_COUNT == 0
84
84
 
85
-
85
+ @table_is
86
86
  Scenario: Table verification and variables
87
87
  ### PRECONDITIONS - BEGIN
88
88
  Given begin preconditions
89
-
90
- Given INPUT_TABLE = convert json '{"test1" : 1, "test2":2.0, "test3": "TEST3 value", "test4" : null}' to name/value table with names uncollapsed
89
+
90
+ Given TABLE_1 = convert json '{"test1" : 1, "test2":2.0, "test3": "TEST3 value", "test4" : null}' to name/value table with names uncollapsed
91
+ Given TABLE_2 = convert json '{"TEST1" : 1, "TEST2":2.0, "TEST3": "TEST3 value", "TEST4" : null}' to table with names as columns
91
92
 
92
93
  Given TEST3 = 'test3'
93
94
  Given TEST3_VALUE = 'TEST3 value'
@@ -95,13 +96,18 @@ Feature: Features related to tables
95
96
  Given end preconditions
96
97
  ### PRECONDITIONS - END
97
98
 
98
- Then table INPUT_TABLE is
99
+ Then table TABLE_1 is
99
100
  | Name | Value |
100
101
  | 'test1' | 1 |
101
102
  | 'test2' | 2.0 |
102
103
  | ${TEST3} | ${TEST3_VALUE} |
103
104
  | 'test4' | None |
104
105
 
106
+ Then table TABLE_2 is
107
+ | TEST1 | TEST2 | TEST3 | TEST4 |
108
+ | 1 | 2.0 | ${TEST3_VALUE} | None |
109
+
110
+
105
111
  @table_without_rows
106
112
  Scenario: Table without rows
107
113
  ### PRECONDITIONS - BEGIN
@@ -52,7 +52,7 @@ Feature: Test decode of AIS message from bitarry and its encode in NMEAv4
52
52
  Scenario Outline: from NMEAv4 sentences to bitarray through decode
53
53
 
54
54
  Given NMEA_SENTENCES = split text <msg_nmea> on separator '\n'
55
- When MSG = decode AIS NMEA message NMEA_SENTENCES
55
+ When MSG = decode NMEA AIS message NMEA_SENTENCES
56
56
  Then MSG.mmsi == <mmsi>
57
57
 
58
58
  When MSG_RAW = convert AIS message MSG to hexadecimal string
@@ -0,0 +1,191 @@
1
+ @testing_solution
2
+ @python
3
+ @socket
4
+ Feature: Test python socket reset steps
5
+
6
+ @blocking_socket
7
+ @reset_data
8
+ Scenario: Reset received data (client with blocking connections)
9
+
10
+ ### PRECONDITIONS - BEGIN
11
+ Given begin preconditions
12
+
13
+ Given PORT = first available anonymous port
14
+ Given SERVER = new echo TCP socket server
15
+ | Name | Value |
16
+ | 'host' | '127.0.0.1' |
17
+ | 'port' | PORT |
18
+
19
+ Given CLIENT = new TCP socket client
20
+ | Name | Value |
21
+ | 'host' | '127.0.0.1' |
22
+ | 'port' | PORT |
23
+
24
+ Given end preconditions
25
+ ### PRECONDITIONS - END
26
+
27
+ # Start server & client
28
+ When start (socket server: SERVER)
29
+ When start (socket client: CLIENT)
30
+
31
+ # Write data and verify received data size
32
+ When write b'\x01\x02' (socket: CLIENT)
33
+
34
+ When await socket CLIENT receives data
35
+ When SIZE = size of received data (socket: CLIENT)
36
+ Then SIZE > 0
37
+
38
+ # Reset data and verify
39
+ Given reset stored received data in socket CLIENT
40
+ When SIZE = size of received data (socket: CLIENT)
41
+ Then SIZE == 0
42
+
43
+ # Stop server & client
44
+ #When stop (socket server: SERVER)
45
+ When stop (socket client: CLIENT)
46
+
47
+
48
+
49
+ @non_blocking_socket
50
+ @reset_data
51
+ Scenario: Reset received data (client with non blocking connections)
52
+
53
+ ### PRECONDITIONS - BEGIN
54
+ Given begin preconditions
55
+
56
+ Given PORT = first available anonymous port
57
+ Given SERVER = new echo TCP socket server
58
+ | Name | Value |
59
+ | 'host' | '127.0.0.1' |
60
+ | 'port' | PORT |
61
+
62
+ Given CLIENT = new TCP socket client
63
+ | Name | Value |
64
+ | 'host' | '127.0.0.1' |
65
+ | 'port' | PORT |
66
+ | 'blocking' | False |
67
+
68
+ Given end preconditions
69
+ ### PRECONDITIONS - END
70
+
71
+ # Start server & client
72
+ When start (socket server: SERVER)
73
+ When start (socket client: CLIENT)
74
+
75
+ # Write data and verify received data size
76
+ When write b'\x01\x02' (socket: CLIENT)
77
+
78
+ When await socket CLIENT receives data
79
+ When SIZE = size of received data (socket: CLIENT)
80
+ Then SIZE > 0
81
+
82
+ # Reset data and verify
83
+ Given reset stored received data in socket CLIENT
84
+ When SIZE = size of received data (socket: CLIENT)
85
+ Then SIZE == 0
86
+
87
+ # Stop server & client
88
+ #When stop (socket server: SERVER)
89
+ When stop (socket client: CLIENT)
90
+
91
+
92
+
93
+ @message_socket
94
+ @blocking_socket
95
+ @reset_messages
96
+ Scenario: Reset received messages (client with blocking connections)
97
+
98
+ ### PRECONDITIONS - BEGIN
99
+ Given begin preconditions
100
+
101
+ # Use echo server with a blocking connection
102
+ Given PORT = first available anonymous port
103
+ Given SERVER = new echo TCP socket server
104
+ | Name | Value |
105
+ | 'host' | '127.0.0.1' |
106
+ | 'port' | PORT |
107
+
108
+ # Create a message client
109
+ Given CLIENT = new message TCP socket client
110
+ | Name | Value |
111
+ | 'host' | '127.0.0.1' |
112
+ | 'port' | PORT |
113
+ | 'separator' | b'\n' |
114
+
115
+ Given end preconditions
116
+ ### PRECONDITIONS - END
117
+
118
+ # Start echo server & message client
119
+ When start (socket server: SERVER)
120
+ When start (socket client: CLIENT)
121
+
122
+ # Write data and verify result is identical
123
+ When write message b'\x01\x02' (socket: CLIENT)
124
+ When write message b'\x11\x21' (socket: CLIENT)
125
+
126
+ # Verify number of received messages
127
+ When await socket CLIENT receives messages (window: 0.1 s)
128
+ When NB_MSG = number of received messages (socket: CLIENT)
129
+ Then NB_MSG == 2
130
+
131
+ # Reset data and verify
132
+ Given reset stored received messages in socket CLIENT
133
+ When NB_MSG = number of received messages (socket: CLIENT)
134
+ Then NB_MSG == 0
135
+
136
+ # Stop server & client
137
+ #When stop (socket server: SERVER)
138
+ When stop (socket client: CLIENT)
139
+
140
+
141
+
142
+ @message_socket
143
+ @non_blocking_socket
144
+ @reset_messages
145
+ Scenario: Reset received messages (client with non blocking connections)
146
+
147
+ ### PRECONDITIONS - BEGIN
148
+ Given begin preconditions
149
+
150
+ # Use echo server with a blocking connection
151
+ Given PORT = first available anonymous port
152
+ Given SERVER = new echo TCP socket server
153
+ | Name | Value |
154
+ | 'host' | '127.0.0.1' |
155
+ | 'port' | PORT |
156
+
157
+ # Create a message client
158
+ Given CLIENT = new message TCP socket client
159
+ | Name | Value |
160
+ | 'host' | '127.0.0.1' |
161
+ | 'port' | PORT |
162
+ | 'separator' | b'\n' |
163
+ | 'blocking' | False |
164
+
165
+ Given end preconditions
166
+ ### PRECONDITIONS - END
167
+
168
+ # Start echo server & message client
169
+ When start (socket server: SERVER)
170
+ When start (socket client: CLIENT)
171
+
172
+ # Write data and verify result is identical
173
+ When write message b'\x01\x02' (socket: CLIENT)
174
+ When write message b'\x11\x21' (socket: CLIENT)
175
+
176
+ # Verify number of received messages
177
+ When await socket CLIENT receives messages (window: 0.1 s)
178
+ When NB_MSG = number of received messages (socket: CLIENT)
179
+ Then NB_MSG == 2
180
+
181
+ # Reset data and verify
182
+ Given reset stored received messages in socket CLIENT
183
+ When NB_MSG = number of received messages (socket: CLIENT)
184
+ Then NB_MSG == 0
185
+
186
+ # Stop server & client
187
+ #When stop (socket server: SERVER)
188
+ When stop (socket client: CLIENT)
189
+
190
+
191
+