armodel 1.3.0__py3-none-any.whl → 1.4.3__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.
- armodel/__init__.py +2 -1
- armodel/cli/arxml_dump_cli.py +8 -6
- armodel/cli/arxml_format_cli.py +72 -0
- armodel/cli/connector2xlsx_cli.py +75 -0
- armodel/cli/connector_update_cli.py +77 -0
- armodel/cli/swc_list_cli.py +2 -2
- armodel/data_models/__init__.py +0 -0
- armodel/data_models/sw_connector.py +22 -0
- armodel/lib/__init__.py +1 -1
- armodel/lib/sw_component.py +34 -0
- armodel/models/__init__.py +8 -2
- armodel/models/annotation.py +20 -0
- armodel/models/ar_object.py +184 -0
- armodel/models/ar_package.py +144 -14
- armodel/models/ar_ref.py +74 -8
- armodel/models/bsw_module_template.py +97 -25
- armodel/models/calibration.py +119 -0
- armodel/models/common_structure.py +203 -36
- armodel/models/communication.py +17 -0
- armodel/models/data_def_properties.py +16 -0
- armodel/models/data_dictionary.py +46 -9
- armodel/models/data_prototype.py +24 -5
- armodel/models/datatype.py +86 -19
- armodel/models/end_to_end_protection.py +67 -0
- armodel/models/general_structure.py +72 -17
- armodel/models/global_constraints.py +40 -0
- armodel/models/implementation.py +80 -32
- armodel/models/m2_msr.py +82 -6
- armodel/models/multilanguage_data.py +42 -0
- armodel/models/per_instance_memory.py +14 -0
- armodel/models/port_interface.py +27 -4
- armodel/models/port_prototype.py +48 -23
- armodel/models/record_layout.py +118 -0
- armodel/models/service_mapping.py +11 -0
- armodel/models/service_needs.py +48 -0
- armodel/models/sw_component.py +257 -43
- armodel/models/unit.py +14 -0
- armodel/parser/abstract_arxml_parser.py +248 -0
- armodel/parser/arxml_parser.py +1550 -648
- armodel/parser/connector_xlsx_parser.py +190 -0
- armodel/parser/excel_parser.py +18 -0
- armodel/report/__init__.py +1 -0
- armodel/report/connector_xls_report.py +76 -0
- armodel/report/excel_report.py +42 -0
- armodel/tests/__init__.py +0 -0
- armodel/tests/test_armodel/__init__.py +0 -0
- armodel/tests/test_armodel/models/__init__.py +0 -0
- armodel/tests/test_armodel/models/test_ar_object.py +152 -0
- armodel/tests/test_armodel/models/test_ar_package.py +294 -0
- armodel/tests/test_armodel/models/test_ar_ref.py +74 -0
- armodel/tests/test_armodel/models/test_bsw_module_template.py +46 -0
- armodel/tests/test_armodel/models/test_common_structure.py +73 -0
- armodel/tests/test_armodel/models/test_data_dictionary.py +29 -0
- armodel/tests/test_armodel/models/test_data_prototype.py +86 -0
- armodel/tests/test_armodel/models/test_datatype.py +239 -0
- armodel/tests/test_armodel/models/test_general_structure.py +50 -0
- armodel/tests/test_armodel/models/test_implementation.py +26 -0
- armodel/tests/test_armodel/models/test_m2_msr.py +77 -0
- armodel/tests/test_armodel/models/test_port_interface.py +198 -0
- armodel/tests/test_armodel/models/test_port_prototype.py +14 -0
- armodel/tests/test_armodel/parser/__init__.py +0 -0
- armodel/tests/test_armodel/parser/test_arxml_parser.py +15 -0
- armodel/tests/test_armodel/parser/test_parse_bswmd.py +192 -0
- armodel/tests/test_armodel/parser/test_sw_components.py +93 -0
- armodel/writer/__init__.py +1 -0
- armodel/writer/abstract_arxml_writer.py +123 -0
- armodel/writer/arxml_writer.py +1755 -0
- {armodel-1.3.0.dist-info → armodel-1.4.3.dist-info}/METADATA +124 -4
- armodel-1.4.3.dist-info/RECORD +78 -0
- armodel-1.4.3.dist-info/entry_points.txt +7 -0
- armodel-1.3.0.dist-info/RECORD +0 -31
- armodel-1.3.0.dist-info/entry_points.txt +0 -4
- {armodel-1.3.0.dist-info → armodel-1.4.3.dist-info}/LICENSE +0 -0
- {armodel-1.3.0.dist-info → armodel-1.4.3.dist-info}/WHEEL +0 -0
- {armodel-1.3.0.dist-info → armodel-1.4.3.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
""" Test AR Package """
|
|
2
|
+
import pytest
|
|
3
|
+
|
|
4
|
+
from ....models.ar_package import AUTOSAR
|
|
5
|
+
from ....models.datatype import ApplicationPrimitiveDataType, ApplicationRecordDataType, DataTypeMappingSet, ImplementationDataType, SwBaseType
|
|
6
|
+
from ....models.general_structure import ARElement, ARObject, CollectableElement, Identifiable, MultilanguageReferrable, PackageableElement, Referrable
|
|
7
|
+
from ....models.m2_msr import CompuMethod
|
|
8
|
+
from ....models.port_interface import ClientServerInterface, DataInterface, PortInterface, SenderReceiverInterface
|
|
9
|
+
from ....models.sw_component import ApplicationSwComponentType, AtomicSwComponentType, CompositionSwComponentType, EcuAbstractionSwComponentType, ServiceSwComponentType, SwComponentType
|
|
10
|
+
|
|
11
|
+
class TestAUTOSAR:
|
|
12
|
+
|
|
13
|
+
def test_autosar_singleton_exception(self):
|
|
14
|
+
AUTOSAR.getInstance()
|
|
15
|
+
with pytest.raises(Exception) as err:
|
|
16
|
+
AUTOSAR()
|
|
17
|
+
assert(str(err.value) == "The AUTOSAR is singleton!")
|
|
18
|
+
|
|
19
|
+
def test_cannot_find_element(self):
|
|
20
|
+
document = AUTOSAR.getInstance()
|
|
21
|
+
#with pytest.raises(Exception) as err:
|
|
22
|
+
# document.find("/sw_package/not_found")
|
|
23
|
+
#assert(str(err.value) ==
|
|
24
|
+
# "The sw_package of reference </sw_package/not_found> does not exist.")
|
|
25
|
+
assert(document.find("/sw_package/not_found") == None)
|
|
26
|
+
|
|
27
|
+
def test_autosar(self):
|
|
28
|
+
document = AUTOSAR.getInstance()
|
|
29
|
+
assert (isinstance(document, CollectableElement))
|
|
30
|
+
assert (isinstance(document, AUTOSAR))
|
|
31
|
+
assert (len(document.getARPackages()) == 0)
|
|
32
|
+
assert (document.schema_location == "")
|
|
33
|
+
assert (document.full_name == "")
|
|
34
|
+
|
|
35
|
+
def test_create_autosar_package(self):
|
|
36
|
+
document = AUTOSAR.getInstance()
|
|
37
|
+
ar_package = document.createARPackage("sw_package")
|
|
38
|
+
assert ("sw_package" == ar_package.short_name)
|
|
39
|
+
assert (len(document.getARPackages()) == 1)
|
|
40
|
+
assert (document.getARPackages()[0] == ar_package)
|
|
41
|
+
|
|
42
|
+
ar_package = document.find("/sw_package")
|
|
43
|
+
assert ("sw_package" == ar_package.short_name)
|
|
44
|
+
|
|
45
|
+
assert(isinstance(ar_package, ARObject))
|
|
46
|
+
assert(isinstance(ar_package, Identifiable))
|
|
47
|
+
assert(isinstance(ar_package, Referrable))
|
|
48
|
+
assert(isinstance(ar_package, MultilanguageReferrable))
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
class TestARPackage:
|
|
52
|
+
|
|
53
|
+
def test_create_autosar_package(self):
|
|
54
|
+
document = AUTOSAR.getInstance()
|
|
55
|
+
ar_package_level1 = document.createARPackage("package_level1")
|
|
56
|
+
assert (ar_package_level1.short_name == "package_level1")
|
|
57
|
+
assert (ar_package_level1.full_name == "/package_level1")
|
|
58
|
+
assert (len(ar_package_level1.getARPackages()) == 0)
|
|
59
|
+
|
|
60
|
+
ar_find_package = document.find("/package_level1")
|
|
61
|
+
assert (ar_find_package == ar_package_level1)
|
|
62
|
+
assert (ar_find_package.short_name == 'package_level1')
|
|
63
|
+
|
|
64
|
+
ar_package_level2 = ar_package_level1.createARPackage("package_level2")
|
|
65
|
+
assert (ar_package_level2.short_name == 'package_level2')
|
|
66
|
+
assert (ar_package_level2.full_name ==
|
|
67
|
+
"/package_level1/package_level2")
|
|
68
|
+
assert (len(ar_package_level1.getARPackages()) == 1)
|
|
69
|
+
assert (ar_package_level1.getARPackages()[0] == ar_package_level2)
|
|
70
|
+
|
|
71
|
+
ar_find_package = document.find("/package_level1/package_level2")
|
|
72
|
+
assert (ar_find_package == ar_package_level2)
|
|
73
|
+
assert (ar_find_package.short_name == "package_level2")
|
|
74
|
+
|
|
75
|
+
def test_createEcuAbstractionSwComponentType(self):
|
|
76
|
+
document = AUTOSAR.getInstance()
|
|
77
|
+
ar_root = document.createARPackage("AUTOSAR")
|
|
78
|
+
sw_component_type = ar_root.createEcuAbstractionSwComponentType(
|
|
79
|
+
"ecu_abstract_sw_component")
|
|
80
|
+
assert(sw_component_type.short_name == "ecu_abstract_sw_component")
|
|
81
|
+
assert(isinstance(sw_component_type, EcuAbstractionSwComponentType))
|
|
82
|
+
|
|
83
|
+
find_component_type = document.find(
|
|
84
|
+
"/AUTOSAR/ecu_abstract_sw_component")
|
|
85
|
+
assert (find_component_type == sw_component_type)
|
|
86
|
+
assert (find_component_type.short_name == "ecu_abstract_sw_component")
|
|
87
|
+
|
|
88
|
+
def test_createApplicationSwComponentType(self):
|
|
89
|
+
document = AUTOSAR.getInstance()
|
|
90
|
+
ar_root = document.createARPackage("AUTOSAR")
|
|
91
|
+
sw_component_type = ar_root.createApplicationSwComponentType(
|
|
92
|
+
"application_sw_component")
|
|
93
|
+
assert(sw_component_type.short_name == "application_sw_component")
|
|
94
|
+
|
|
95
|
+
assert(isinstance(sw_component_type, ARElement))
|
|
96
|
+
assert(isinstance(sw_component_type, AtomicSwComponentType))
|
|
97
|
+
assert(isinstance(sw_component_type, CollectableElement))
|
|
98
|
+
assert(isinstance(sw_component_type, Identifiable))
|
|
99
|
+
assert(isinstance(sw_component_type, MultilanguageReferrable))
|
|
100
|
+
assert(isinstance(sw_component_type, PackageableElement))
|
|
101
|
+
assert(isinstance(sw_component_type, Referrable))
|
|
102
|
+
assert(isinstance(sw_component_type, SwComponentType))
|
|
103
|
+
assert(isinstance(sw_component_type, ApplicationSwComponentType))
|
|
104
|
+
|
|
105
|
+
find_component_type = document.find(
|
|
106
|
+
"/AUTOSAR/application_sw_component")
|
|
107
|
+
assert (find_component_type == sw_component_type)
|
|
108
|
+
assert (find_component_type.short_name == "application_sw_component")
|
|
109
|
+
|
|
110
|
+
def test_createServiceSwComponentType(self):
|
|
111
|
+
document = AUTOSAR.getInstance()
|
|
112
|
+
ar_root = document.createARPackage("AUTOSAR")
|
|
113
|
+
sw_component_type = ar_root.createServiceSwComponentType(
|
|
114
|
+
"service_sw_component")
|
|
115
|
+
assert(sw_component_type.short_name == "service_sw_component")
|
|
116
|
+
|
|
117
|
+
assert(isinstance(sw_component_type, ARElement))
|
|
118
|
+
assert(isinstance(sw_component_type, AtomicSwComponentType))
|
|
119
|
+
assert(isinstance(sw_component_type, CollectableElement))
|
|
120
|
+
assert(isinstance(sw_component_type, Identifiable))
|
|
121
|
+
assert(isinstance(sw_component_type, MultilanguageReferrable))
|
|
122
|
+
assert(isinstance(sw_component_type, PackageableElement))
|
|
123
|
+
assert(isinstance(sw_component_type, Referrable))
|
|
124
|
+
assert(isinstance(sw_component_type, SwComponentType))
|
|
125
|
+
assert(isinstance(sw_component_type, ServiceSwComponentType))
|
|
126
|
+
|
|
127
|
+
find_component_type = document.find("/AUTOSAR/service_sw_component")
|
|
128
|
+
assert (find_component_type == sw_component_type)
|
|
129
|
+
assert (find_component_type.short_name == "service_sw_component")
|
|
130
|
+
|
|
131
|
+
def test_createCompositionSwComponentType(self):
|
|
132
|
+
document = AUTOSAR.getInstance()
|
|
133
|
+
ar_root = document.createARPackage("AUTOSAR")
|
|
134
|
+
sw_component_type = ar_root.createCompositionSwComponentType(
|
|
135
|
+
"composition_sw_component")
|
|
136
|
+
assert(sw_component_type.short_name == "composition_sw_component")
|
|
137
|
+
|
|
138
|
+
assert(isinstance(sw_component_type, ARElement))
|
|
139
|
+
assert(isinstance(sw_component_type, CollectableElement))
|
|
140
|
+
assert(isinstance(sw_component_type, Identifiable))
|
|
141
|
+
assert(isinstance(sw_component_type, MultilanguageReferrable))
|
|
142
|
+
assert(isinstance(sw_component_type, PackageableElement))
|
|
143
|
+
assert(isinstance(sw_component_type, Referrable))
|
|
144
|
+
assert(isinstance(sw_component_type, SwComponentType))
|
|
145
|
+
assert(isinstance(sw_component_type, CompositionSwComponentType))
|
|
146
|
+
|
|
147
|
+
find_component_type = document.find(
|
|
148
|
+
"/AUTOSAR/composition_sw_component")
|
|
149
|
+
assert (find_component_type == sw_component_type)
|
|
150
|
+
assert (find_component_type.short_name == "composition_sw_component")
|
|
151
|
+
|
|
152
|
+
def test_createSenderReceiverInterface(self):
|
|
153
|
+
document = AUTOSAR.getInstance()
|
|
154
|
+
ar_root = document.createARPackage("AUTOSAR")
|
|
155
|
+
instance_if = ar_root.createSenderReceiverInterface(
|
|
156
|
+
"sender_receiver_interface")
|
|
157
|
+
assert(instance_if.short_name == "sender_receiver_interface")
|
|
158
|
+
|
|
159
|
+
assert(isinstance(instance_if, ARElement))
|
|
160
|
+
assert(isinstance(instance_if, CollectableElement))
|
|
161
|
+
assert(isinstance(instance_if, DataInterface))
|
|
162
|
+
assert(isinstance(instance_if, Identifiable))
|
|
163
|
+
assert(isinstance(instance_if, MultilanguageReferrable))
|
|
164
|
+
assert(isinstance(instance_if, PackageableElement))
|
|
165
|
+
assert(isinstance(instance_if, PortInterface))
|
|
166
|
+
assert(isinstance(instance_if, Referrable))
|
|
167
|
+
assert(isinstance(instance_if, SenderReceiverInterface))
|
|
168
|
+
|
|
169
|
+
find_component = document.find("/AUTOSAR/sender_receiver_interface")
|
|
170
|
+
assert (find_component == instance_if)
|
|
171
|
+
assert (find_component.short_name == "sender_receiver_interface")
|
|
172
|
+
|
|
173
|
+
assert (len(ar_root.getSenderReceiverInterfaces()) == 1)
|
|
174
|
+
assert (ar_root.getSenderReceiverInterfaces()[0] == instance_if)
|
|
175
|
+
assert (ar_root.getSenderReceiverInterfaces()[
|
|
176
|
+
0].short_name == "sender_receiver_interface")
|
|
177
|
+
|
|
178
|
+
def test_createClientServerInterface(self):
|
|
179
|
+
document = AUTOSAR.getInstance()
|
|
180
|
+
ar_root = document.createARPackage("AUTOSAR")
|
|
181
|
+
instance_if = ar_root.createClientServerInterface(
|
|
182
|
+
"client_server_interface")
|
|
183
|
+
assert(instance_if.short_name == "client_server_interface")
|
|
184
|
+
assert(isinstance(instance_if, ClientServerInterface))
|
|
185
|
+
|
|
186
|
+
find_component = document.find("/AUTOSAR/client_server_interface")
|
|
187
|
+
assert (find_component == instance_if)
|
|
188
|
+
assert (find_component.short_name == "client_server_interface")
|
|
189
|
+
|
|
190
|
+
assert (len(ar_root.getClientServerInterfaces()) == 1)
|
|
191
|
+
assert (ar_root.getClientServerInterfaces()[0] == instance_if)
|
|
192
|
+
assert (ar_root.getClientServerInterfaces()[
|
|
193
|
+
0].short_name == "client_server_interface")
|
|
194
|
+
|
|
195
|
+
def test_createApplicationPrimitiveDataType(self):
|
|
196
|
+
document = AUTOSAR.getInstance()
|
|
197
|
+
ar_root = document.createARPackage("AUTOSAR")
|
|
198
|
+
data_type = ar_root.createApplicationPrimitiveDataType(
|
|
199
|
+
"application_primitive_data_type")
|
|
200
|
+
assert(data_type.short_name == "application_primitive_data_type")
|
|
201
|
+
assert(isinstance(data_type, ApplicationPrimitiveDataType))
|
|
202
|
+
|
|
203
|
+
find_component = document.find(
|
|
204
|
+
"/AUTOSAR/application_primitive_data_type")
|
|
205
|
+
assert (find_component == data_type)
|
|
206
|
+
assert (find_component.short_name == "application_primitive_data_type")
|
|
207
|
+
|
|
208
|
+
assert (len(ar_root.getApplicationPrimitiveDataTypes()) == 1)
|
|
209
|
+
assert (ar_root.getApplicationPrimitiveDataTypes()[0] == data_type)
|
|
210
|
+
assert (ar_root.getApplicationPrimitiveDataTypes()[
|
|
211
|
+
0].short_name == "application_primitive_data_type")
|
|
212
|
+
|
|
213
|
+
def test_createApplicationRecordDataType(self):
|
|
214
|
+
document = AUTOSAR.getInstance()
|
|
215
|
+
ar_root = document.createARPackage("AUTOSAR")
|
|
216
|
+
data_type = ar_root.createApplicationRecordDataType(
|
|
217
|
+
"application_record_data_type")
|
|
218
|
+
assert(data_type.short_name == "application_record_data_type")
|
|
219
|
+
assert(isinstance(data_type, ApplicationRecordDataType))
|
|
220
|
+
|
|
221
|
+
find_component = document.find("/AUTOSAR/application_record_data_type")
|
|
222
|
+
assert (find_component == data_type)
|
|
223
|
+
assert (find_component.short_name == "application_record_data_type")
|
|
224
|
+
|
|
225
|
+
def test_createImplementationDataType(self):
|
|
226
|
+
document = AUTOSAR.getInstance()
|
|
227
|
+
ar_root = document.createARPackage("AUTOSAR")
|
|
228
|
+
data_type = ar_root.createImplementationDataType(
|
|
229
|
+
"implementation_data_type")
|
|
230
|
+
assert(data_type.short_name == "implementation_data_type")
|
|
231
|
+
assert(isinstance(data_type, ImplementationDataType))
|
|
232
|
+
|
|
233
|
+
find_component = document.find("/AUTOSAR/implementation_data_type")
|
|
234
|
+
assert (find_component == data_type)
|
|
235
|
+
assert (find_component.short_name == "implementation_data_type")
|
|
236
|
+
|
|
237
|
+
assert (len(ar_root.getImplementationDataTypes()) == 1)
|
|
238
|
+
assert (ar_root.getImplementationDataTypes()[0] == data_type)
|
|
239
|
+
assert (ar_root.getImplementationDataTypes()[
|
|
240
|
+
0].short_name == "implementation_data_type")
|
|
241
|
+
|
|
242
|
+
def test_createSwBaseType(self):
|
|
243
|
+
document = AUTOSAR.getInstance()
|
|
244
|
+
ar_root = document.createARPackage("AUTOSAR")
|
|
245
|
+
data_type = ar_root.createSwBaseType("sw_base_type")
|
|
246
|
+
assert(data_type.short_name == "sw_base_type")
|
|
247
|
+
assert(isinstance(data_type, SwBaseType))
|
|
248
|
+
|
|
249
|
+
find_component = document.find("/AUTOSAR/sw_base_type")
|
|
250
|
+
assert (find_component == data_type)
|
|
251
|
+
assert (find_component.short_name == "sw_base_type")
|
|
252
|
+
|
|
253
|
+
assert (len(ar_root.getSwBaseTypes()) == 1)
|
|
254
|
+
assert (ar_root.getSwBaseTypes()[0] == data_type)
|
|
255
|
+
assert (ar_root.getSwBaseTypes()[0].short_name == "sw_base_type")
|
|
256
|
+
|
|
257
|
+
def test_createDataTypeMappingSet(self):
|
|
258
|
+
document = AUTOSAR.getInstance()
|
|
259
|
+
ar_root = document.createARPackage("AUTOSAR")
|
|
260
|
+
mapping_set = ar_root.createDataTypeMappingSet("data_type_mapping_set")
|
|
261
|
+
assert(mapping_set.short_name == "data_type_mapping_set")
|
|
262
|
+
assert(isinstance(mapping_set, DataTypeMappingSet))
|
|
263
|
+
|
|
264
|
+
find_component = document.find("/AUTOSAR/data_type_mapping_set")
|
|
265
|
+
assert (find_component == mapping_set)
|
|
266
|
+
assert (find_component.short_name == "data_type_mapping_set")
|
|
267
|
+
|
|
268
|
+
assert (len(ar_root.getDataTypeMappingSets()) == 1)
|
|
269
|
+
assert (ar_root.getDataTypeMappingSets()[0] == mapping_set)
|
|
270
|
+
assert (ar_root.getDataTypeMappingSets()[
|
|
271
|
+
0].short_name == "data_type_mapping_set")
|
|
272
|
+
|
|
273
|
+
def test_createCompuMethod(self):
|
|
274
|
+
document = AUTOSAR.getInstance()
|
|
275
|
+
ar_root = document.createARPackage("AUTOSAR")
|
|
276
|
+
compu_method = ar_root.createCompuMethod("compu_method")
|
|
277
|
+
assert(compu_method.short_name == "compu_method")
|
|
278
|
+
assert(isinstance(compu_method, CompuMethod))
|
|
279
|
+
|
|
280
|
+
find_component = document.find("/AUTOSAR/compu_method")
|
|
281
|
+
assert (find_component == compu_method)
|
|
282
|
+
assert (find_component.short_name == "compu_method")
|
|
283
|
+
|
|
284
|
+
assert (len(ar_root.getCompuMethods()) == 1)
|
|
285
|
+
assert (ar_root.getCompuMethods()[0] == compu_method)
|
|
286
|
+
assert (ar_root.getCompuMethods()[0].short_name == "compu_method")
|
|
287
|
+
|
|
288
|
+
def test_getSwComponentTypes(self):
|
|
289
|
+
document = AUTOSAR.getInstance()
|
|
290
|
+
ar_root = document.createARPackage("AUTOSAR")
|
|
291
|
+
|
|
292
|
+
assert (len(ar_root.getSwComponentTypes()) == 4)
|
|
293
|
+
assert (len(ar_root.getAtomicSwComponentTypes()) == 3)
|
|
294
|
+
assert (len(ar_root.getCompositionSwComponentTypes()) == 1)
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
""" Test ARRef """
|
|
2
|
+
|
|
3
|
+
import pytest
|
|
4
|
+
|
|
5
|
+
from ....models.ar_ref import ArVariableInImplementationDataInstanceRef, AutosarVariableRef, PPortInCompositionInstanceRef, RPortInCompositionInstanceRef
|
|
6
|
+
from ....models.ar_ref import OperationInAtomicSwcInstanceRef, POperationInAtomicSwcInstanceRef, ROperationInAtomicSwcInstanceRef, RefType, TRefType, AtpInstanceRef
|
|
7
|
+
from ....models.general_structure import ARObject
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class TestARRef:
|
|
11
|
+
def test_RefType(self):
|
|
12
|
+
ref_type = RefType()
|
|
13
|
+
assert(ref_type.value == "")
|
|
14
|
+
assert(ref_type.dest == "")
|
|
15
|
+
|
|
16
|
+
def test_TRefType(self):
|
|
17
|
+
ref_type = TRefType()
|
|
18
|
+
assert(ref_type.value == "")
|
|
19
|
+
assert(ref_type.dest == "")
|
|
20
|
+
|
|
21
|
+
def test_AutosarVariableRef(self):
|
|
22
|
+
ref_type = AutosarVariableRef()
|
|
23
|
+
assert(ref_type != None)
|
|
24
|
+
assert(ref_type.autosar_variable_iref == None)
|
|
25
|
+
assert(ref_type.autosar_variable_in_impl_datatype == None)
|
|
26
|
+
assert(ref_type.local_variable_ref == None)
|
|
27
|
+
|
|
28
|
+
def test_AtpInstanceRef(self):
|
|
29
|
+
with pytest.raises(NotImplementedError) as err:
|
|
30
|
+
ref_type = AtpInstanceRef()
|
|
31
|
+
assert(str(err.value) == "AtpInstanceRef is an abstract class.")
|
|
32
|
+
|
|
33
|
+
def test_ProvidedPortPrototypeInstanceRef(self):
|
|
34
|
+
ref_type = PPortInCompositionInstanceRef()
|
|
35
|
+
assert(ref_type != None)
|
|
36
|
+
assert(ref_type.context_component_ref == None)
|
|
37
|
+
assert(ref_type.target_p_port_ref == None)
|
|
38
|
+
|
|
39
|
+
def test_RequiredPortPrototypeInstanceRef(self):
|
|
40
|
+
ref_type = RPortInCompositionInstanceRef()
|
|
41
|
+
assert(ref_type != None)
|
|
42
|
+
assert(ref_type.context_component_ref == None)
|
|
43
|
+
assert(ref_type.target_r_port_ref == None)
|
|
44
|
+
|
|
45
|
+
def test_ArVariableInImplementationDataInstanceRef(self):
|
|
46
|
+
ref_type = ArVariableInImplementationDataInstanceRef()
|
|
47
|
+
assert(ref_type != None)
|
|
48
|
+
assert(ref_type.port_prototype_ref == None)
|
|
49
|
+
assert(ref_type.target_data_prototype_ref == None)
|
|
50
|
+
|
|
51
|
+
def test_OperationInAtomicSwcInstanceRef(self):
|
|
52
|
+
with pytest.raises(NotImplementedError) as err:
|
|
53
|
+
ref_type = OperationInAtomicSwcInstanceRef()
|
|
54
|
+
assert(str(err.value) == "OperationInAtomicSwcInstanceRef is an abstract class.")
|
|
55
|
+
|
|
56
|
+
def test_POperationInAtomicSwcInstanceRef(self):
|
|
57
|
+
ref_type = POperationInAtomicSwcInstanceRef()
|
|
58
|
+
assert(isinstance(ref_type, ARObject))
|
|
59
|
+
assert(isinstance(ref_type, AtpInstanceRef))
|
|
60
|
+
assert(isinstance(ref_type, OperationInAtomicSwcInstanceRef))
|
|
61
|
+
assert(isinstance(ref_type, POperationInAtomicSwcInstanceRef))
|
|
62
|
+
assert(ref_type != None)
|
|
63
|
+
assert(ref_type.context_p_port_ref == None)
|
|
64
|
+
assert(ref_type.target_provided_operation_ref == None)
|
|
65
|
+
|
|
66
|
+
def test_ROperationInAtomicSwcInstanceRef(self):
|
|
67
|
+
ref_type = ROperationInAtomicSwcInstanceRef()
|
|
68
|
+
assert(isinstance(ref_type, ARObject))
|
|
69
|
+
assert(isinstance(ref_type, AtpInstanceRef))
|
|
70
|
+
assert(isinstance(ref_type, OperationInAtomicSwcInstanceRef))
|
|
71
|
+
assert(isinstance(ref_type, ROperationInAtomicSwcInstanceRef))
|
|
72
|
+
assert(ref_type != None)
|
|
73
|
+
assert(ref_type.context_r_port_ref == None)
|
|
74
|
+
assert(ref_type.target_required_operation_ref == None)
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import pytest
|
|
2
|
+
|
|
3
|
+
from ....models.bsw_module_template import BswModuleDescription, BswModuleEntry, BswModuleEntity, BswCalledEntity
|
|
4
|
+
from .... import AUTOSAR
|
|
5
|
+
|
|
6
|
+
class TestBswModuleDescription:
|
|
7
|
+
def test_construct(self):
|
|
8
|
+
document = AUTOSAR.getInstance()
|
|
9
|
+
ar_root = document.createARPackage("AUTOSAR")
|
|
10
|
+
bsw_module_description = BswModuleDescription(ar_root, "bsw_module")
|
|
11
|
+
assert(bsw_module_description != None)
|
|
12
|
+
assert(bsw_module_description.short_name == "bsw_module")
|
|
13
|
+
|
|
14
|
+
def test_category(self):
|
|
15
|
+
document = AUTOSAR.getInstance()
|
|
16
|
+
ar_root = document.createARPackage("AUTOSAR")
|
|
17
|
+
bsw_module_description = BswModuleDescription(ar_root, "bsw_module")
|
|
18
|
+
with pytest.raises(ValueError) as err:
|
|
19
|
+
bsw_module_description.category = "invalid"
|
|
20
|
+
assert(str(err.value) == "Invalid category <invalid> of BswModuleDescription <bsw_module>")
|
|
21
|
+
|
|
22
|
+
bsw_module_description.category = "BSW_MODULE"
|
|
23
|
+
assert(bsw_module_description.category == "BSW_MODULE")
|
|
24
|
+
|
|
25
|
+
class Test_M2_AUTOSARTemplates_BswModuleTemplate_BswInterfaces:
|
|
26
|
+
def test_BswModuleEntry(self):
|
|
27
|
+
document = AUTOSAR.getInstance()
|
|
28
|
+
ar_root = document.createARPackage("AUTOSAR")
|
|
29
|
+
entry = BswModuleEntry(ar_root, "bsw_entry")
|
|
30
|
+
assert(entry != None)
|
|
31
|
+
assert(entry.short_name == "bsw_entry")
|
|
32
|
+
|
|
33
|
+
class Test_M2_AUTOSARTemplates_BswModuleTemplate_BswBehavior:
|
|
34
|
+
def test_BswModuleEntity(self):
|
|
35
|
+
document = AUTOSAR.getInstance()
|
|
36
|
+
ar_root = document.createARPackage("AUTOSAR")
|
|
37
|
+
with pytest.raises(NotImplementedError) as err:
|
|
38
|
+
BswModuleEntity(ar_root, "BswModuleEntity")
|
|
39
|
+
assert(str(err.value) == "BswModuleEntity is an abstract class.")
|
|
40
|
+
|
|
41
|
+
def test_BswCalledEntity(self):
|
|
42
|
+
document = AUTOSAR.getInstance()
|
|
43
|
+
ar_root = document.createARPackage("AUTOSAR")
|
|
44
|
+
entity = BswCalledEntity(ar_root, "bsw_called_entity")
|
|
45
|
+
assert(entity != None)
|
|
46
|
+
assert(entity.short_name == "bsw_called_entity")
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import pytest
|
|
2
|
+
|
|
3
|
+
from .... import AUTOSAR
|
|
4
|
+
from ....models.common_structure import AbstractImplementationDataTypeElement, ConstantReference, ImplementationDataTypeElement, ValueSpecification, ConstantSpecification, ExecutableEntity
|
|
5
|
+
from ....models.datatype import AbstractImplementationDataType
|
|
6
|
+
from ....models.general_structure import ARElement, ARObject, CollectableElement, Identifiable
|
|
7
|
+
from ....models.general_structure import MultilanguageReferrable, PackageableElement, Referrable
|
|
8
|
+
|
|
9
|
+
class Test_M2_AUTOSARTemplates_CommonStructure_Constants:
|
|
10
|
+
|
|
11
|
+
def test_ValueSpecification(self):
|
|
12
|
+
with pytest.raises(NotImplementedError) as err:
|
|
13
|
+
ValueSpecification()
|
|
14
|
+
assert(str(err.value) == "ValueSpecification is an abstract class.")
|
|
15
|
+
|
|
16
|
+
def test_ConstantSpecification(self):
|
|
17
|
+
document = AUTOSAR.getInstance()
|
|
18
|
+
ar_root = document.createARPackage("AUTOSAR")
|
|
19
|
+
spec = ConstantSpecification(ar_root, "constant")
|
|
20
|
+
|
|
21
|
+
assert(isinstance(spec, ARElement))
|
|
22
|
+
assert(isinstance(spec, ARObject))
|
|
23
|
+
assert(isinstance(spec, CollectableElement))
|
|
24
|
+
assert(isinstance(spec, Identifiable))
|
|
25
|
+
assert(isinstance(spec, MultilanguageReferrable))
|
|
26
|
+
assert(isinstance(spec, PackageableElement))
|
|
27
|
+
assert(isinstance(spec, Referrable))
|
|
28
|
+
assert(isinstance(spec, ConstantSpecification))
|
|
29
|
+
|
|
30
|
+
def test_ConstantReference(self):
|
|
31
|
+
ref = ConstantReference()
|
|
32
|
+
|
|
33
|
+
assert(ref.constant_ref == None)
|
|
34
|
+
|
|
35
|
+
assert(isinstance(ref, ARObject))
|
|
36
|
+
assert(isinstance(ref, ValueSpecification))
|
|
37
|
+
assert(isinstance(ref, ConstantReference))
|
|
38
|
+
|
|
39
|
+
class Test_M2_AUTOSARTemplates_CommonStructure_InternalBehavior:
|
|
40
|
+
def test_ExecutableEntity(self):
|
|
41
|
+
document = AUTOSAR.getInstance()
|
|
42
|
+
ar_root = document.createARPackage("AUTOSAR")
|
|
43
|
+
with pytest.raises(NotImplementedError) as err:
|
|
44
|
+
ExecutableEntity(ar_root, "ExecutableEntity")
|
|
45
|
+
assert(str(err.value) == "ExecutableEntity is an abstract class.")
|
|
46
|
+
|
|
47
|
+
class Test_M2_AUTOSARTemplates_CommonStructure_ImplementationDataTypes:
|
|
48
|
+
def test_ImplementationDataTypeElement(self):
|
|
49
|
+
document = AUTOSAR.getInstance()
|
|
50
|
+
ar_root = document.createARPackage("AUTOSAR")
|
|
51
|
+
data_type = ImplementationDataTypeElement(ar_root, "implementation_data_type")
|
|
52
|
+
|
|
53
|
+
assert(data_type.short_name == "implementation_data_type")
|
|
54
|
+
assert(data_type.arraySize == None)
|
|
55
|
+
assert(data_type.isOptional == None)
|
|
56
|
+
|
|
57
|
+
assert(isinstance(data_type, ARObject))
|
|
58
|
+
assert(isinstance(data_type, AbstractImplementationDataTypeElement))
|
|
59
|
+
# assert(isinstance(data_type, AtpClassifier))
|
|
60
|
+
# assert(isinstance(data_type, AtpFeature))
|
|
61
|
+
# assert(isinstance(data_type, AtpStructureElement))
|
|
62
|
+
assert(isinstance(data_type, Identifiable))
|
|
63
|
+
assert(isinstance(data_type, MultilanguageReferrable))
|
|
64
|
+
assert(isinstance(data_type, Referrable))
|
|
65
|
+
assert(isinstance(data_type, ImplementationDataTypeElement))
|
|
66
|
+
|
|
67
|
+
sub_type = data_type.createImplementationDataTypeElement("sub_type")
|
|
68
|
+
assert(sub_type.short_name == "sub_type")
|
|
69
|
+
assert(isinstance(sub_type, ImplementationDataTypeElement))
|
|
70
|
+
|
|
71
|
+
assert(len(data_type.getImplementationDataTypeElements()) == 1)
|
|
72
|
+
sub_type2 = data_type.getImplementationDataTypeElements()[0]
|
|
73
|
+
assert(sub_type == sub_type2)
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import pytest
|
|
2
|
+
|
|
3
|
+
from ....models.data_dictionary import SwDataDefProps, SwPointerTargetProps
|
|
4
|
+
from ....models.general_structure import ARObject
|
|
5
|
+
|
|
6
|
+
class Test_M2_MSR_DataDictionary_DataDefProperties:
|
|
7
|
+
def test_SwDataDefProps(self):
|
|
8
|
+
props = SwDataDefProps()
|
|
9
|
+
|
|
10
|
+
assert(isinstance(props, ARObject))
|
|
11
|
+
assert(isinstance(props, SwDataDefProps))
|
|
12
|
+
|
|
13
|
+
assert(props.baseTypeRef == None)
|
|
14
|
+
assert(props.compuMethodRef == None)
|
|
15
|
+
assert(props.dataConstrRef == None)
|
|
16
|
+
assert(props.implementationDataTypeRef == None)
|
|
17
|
+
assert(props.swImplPolicy == None)
|
|
18
|
+
assert(props.swCalibrationAccess == None)
|
|
19
|
+
assert(props.sw_pointer_target_props == None)
|
|
20
|
+
|
|
21
|
+
def test_SwPointerTargetProps(self):
|
|
22
|
+
props = SwPointerTargetProps()
|
|
23
|
+
|
|
24
|
+
assert(isinstance(props, ARObject))
|
|
25
|
+
assert(isinstance(props, SwPointerTargetProps))
|
|
26
|
+
|
|
27
|
+
assert(props.function_pointer_signature == None)
|
|
28
|
+
assert(props.sw_data_def_props == None)
|
|
29
|
+
assert(props.target_category == None)
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import pytest
|
|
2
|
+
|
|
3
|
+
from .... import AUTOSAR
|
|
4
|
+
from ....models.ar_ref import RefType
|
|
5
|
+
from ....models.data_prototype import ApplicationArrayElement, ApplicationCompositeElementDataPrototype, ApplicationRecordElement, AtpPrototype, AutosarDataPrototype, DataPrototype, VariableDataPrototype
|
|
6
|
+
from ....models.general_structure import ARObject, AtpFeature, Identifiable, MultilanguageReferrable, Referrable
|
|
7
|
+
|
|
8
|
+
class Test_M2_AUTOSARTemplates_SWComponentTemplate_Datatype_DataPrototypes:
|
|
9
|
+
|
|
10
|
+
def test_AtpPrototype(self):
|
|
11
|
+
with pytest.raises(NotImplementedError) as err:
|
|
12
|
+
document = AUTOSAR.getInstance()
|
|
13
|
+
ar_root = document.createARPackage("AUTOSAR")
|
|
14
|
+
AtpPrototype(ar_root, "prototype")
|
|
15
|
+
assert(str(err.value) == "AtpPrototype is an abstract class.")
|
|
16
|
+
|
|
17
|
+
def test_DataPrototype(self):
|
|
18
|
+
with pytest.raises(NotImplementedError) as err:
|
|
19
|
+
document = AUTOSAR.getInstance()
|
|
20
|
+
ar_root = document.createARPackage("AUTOSAR")
|
|
21
|
+
DataPrototype(ar_root, "prototype")
|
|
22
|
+
assert(str(err.value) == "DataPrototype is an abstract class.")
|
|
23
|
+
|
|
24
|
+
def test_AutosarDataPrototype(self):
|
|
25
|
+
with pytest.raises(NotImplementedError) as err:
|
|
26
|
+
document = AUTOSAR.getInstance()
|
|
27
|
+
ar_root = document.createARPackage("AUTOSAR")
|
|
28
|
+
AutosarDataPrototype(ar_root, "prototype")
|
|
29
|
+
assert(str(err.value) == "AutosarDataPrototype is an abstract class.")
|
|
30
|
+
|
|
31
|
+
def test_VariableDataPrototype(self):
|
|
32
|
+
document = AUTOSAR.getInstance()
|
|
33
|
+
ar_root = document.createARPackage("AUTOSAR")
|
|
34
|
+
prototype = VariableDataPrototype(ar_root, "prototype")
|
|
35
|
+
|
|
36
|
+
assert(isinstance(prototype, ARObject))
|
|
37
|
+
assert(isinstance(prototype, AtpFeature))
|
|
38
|
+
assert(isinstance(prototype, AtpPrototype))
|
|
39
|
+
assert(isinstance(prototype, AutosarDataPrototype))
|
|
40
|
+
assert(isinstance(prototype, DataPrototype))
|
|
41
|
+
assert(isinstance(prototype, Identifiable))
|
|
42
|
+
assert(isinstance(prototype, MultilanguageReferrable))
|
|
43
|
+
assert(isinstance(prototype, Referrable))
|
|
44
|
+
|
|
45
|
+
assert(prototype.parent == ar_root)
|
|
46
|
+
assert(prototype.short_name == "prototype")
|
|
47
|
+
assert(prototype.type_tref is None)
|
|
48
|
+
|
|
49
|
+
def test_ApplicationCompositeElementDataPrototype(self):
|
|
50
|
+
with pytest.raises(NotImplementedError) as err:
|
|
51
|
+
document = AUTOSAR.getInstance()
|
|
52
|
+
ar_root = document.createARPackage("AUTOSAR")
|
|
53
|
+
ApplicationCompositeElementDataPrototype(ar_root, "application_composition_element_data_prototype")
|
|
54
|
+
assert(str(err.value) == "ApplicationCompositeElementDataPrototype is an abstract class.")
|
|
55
|
+
|
|
56
|
+
def test_ApplicationArrayElement(self):
|
|
57
|
+
document = AUTOSAR.getInstance()
|
|
58
|
+
ar_root = document.createARPackage("AUTOSAR")
|
|
59
|
+
prototype = ApplicationArrayElement(ar_root, "prototype")
|
|
60
|
+
|
|
61
|
+
assert(isinstance(prototype, ARObject))
|
|
62
|
+
assert(isinstance(prototype, ApplicationCompositeElementDataPrototype))
|
|
63
|
+
assert(isinstance(prototype, AtpFeature))
|
|
64
|
+
assert(isinstance(prototype, AtpPrototype))
|
|
65
|
+
assert(isinstance(prototype, DataPrototype))
|
|
66
|
+
assert(isinstance(prototype, Identifiable))
|
|
67
|
+
assert(isinstance(prototype, MultilanguageReferrable))
|
|
68
|
+
assert(isinstance(prototype, Referrable))
|
|
69
|
+
assert(isinstance(prototype, ApplicationArrayElement))
|
|
70
|
+
|
|
71
|
+
def test_ApplicationRecordElement(self):
|
|
72
|
+
document = AUTOSAR.getInstance()
|
|
73
|
+
ar_root = document.createARPackage("AUTOSAR")
|
|
74
|
+
prototype = ApplicationRecordElement(ar_root, "prototype")
|
|
75
|
+
|
|
76
|
+
assert(isinstance(prototype, ARObject))
|
|
77
|
+
assert(isinstance(prototype, ApplicationCompositeElementDataPrototype))
|
|
78
|
+
assert(isinstance(prototype, AtpFeature))
|
|
79
|
+
assert(isinstance(prototype, AtpPrototype))
|
|
80
|
+
assert(isinstance(prototype, DataPrototype))
|
|
81
|
+
assert(isinstance(prototype, Identifiable))
|
|
82
|
+
assert(isinstance(prototype, MultilanguageReferrable))
|
|
83
|
+
assert(isinstance(prototype, Referrable))
|
|
84
|
+
assert(isinstance(prototype, ApplicationRecordElement))
|
|
85
|
+
|
|
86
|
+
assert(prototype.isOptional == None)
|