armodel 1.7.7__py3-none-any.whl → 1.7.9__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/cli/arxml_dump_cli.py +33 -22
- armodel/cli/arxml_format_cli.py +25 -13
- armodel/models/M2/AUTOSARTemplates/AutosarTopLevelStructure.py +84 -28
- armodel/models/M2/AUTOSARTemplates/BswModuleTemplate/BswBehavior.py +410 -61
- armodel/models/M2/AUTOSARTemplates/BswModuleTemplate/BswInterfaces.py +80 -9
- armodel/models/M2/AUTOSARTemplates/BswModuleTemplate/BswOverview.py +141 -35
- armodel/models/M2/AUTOSARTemplates/CommonStructure/Implementation.py +10 -8
- armodel/models/M2/AUTOSARTemplates/CommonStructure/InternalBehavior.py +17 -6
- armodel/models/M2/AUTOSARTemplates/CommonStructure/ModeDeclaration.py +38 -3
- armodel/models/M2/AUTOSARTemplates/CommonStructure/ServiceNeeds.py +91 -18
- armodel/models/M2/AUTOSARTemplates/CommonStructure/StandardizationTemplate/BlueprintDedicated/PortPrototypeBlueprint.py +73 -0
- armodel/models/M2/AUTOSARTemplates/CommonStructure/StandardizationTemplate/BlueprintDedicated/__init__.py +0 -0
- armodel/models/M2/AUTOSARTemplates/CommonStructure/StandardizationTemplate/Keyword.py +45 -0
- armodel/models/M2/AUTOSARTemplates/CommonStructure/StandardizationTemplate/__init__.py +0 -0
- armodel/models/M2/AUTOSARTemplates/CommonStructure/TriggerDeclaration.py +45 -2
- armodel/models/M2/AUTOSARTemplates/ECUCDescriptionTemplate.py +20 -19
- armodel/models/M2/AUTOSARTemplates/EcuResourceTemplate/HwElementCategory.py +59 -0
- armodel/models/M2/AUTOSARTemplates/EcuResourceTemplate/__init__.py +145 -0
- armodel/models/M2/AUTOSARTemplates/GenericStructure/GeneralTemplateClasses/ARPackage.py +243 -156
- armodel/models/M2/AUTOSARTemplates/GenericStructure/GeneralTemplateClasses/ElementCollection.py +73 -0
- armodel/models/M2/AUTOSARTemplates/GenericStructure/GeneralTemplateClasses/Identifiable.py +60 -32
- armodel/models/M2/AUTOSARTemplates/GenericStructure/GeneralTemplateClasses/PrimitiveTypes.py +35 -14
- armodel/models/M2/AUTOSARTemplates/GenericStructure/LifeCycles.py +151 -1
- armodel/models/M2/AUTOSARTemplates/SWComponentTemplate/Components/__init__.py +66 -42
- armodel/models/M2/AUTOSARTemplates/SWComponentTemplate/Composition/__init__.py +1 -0
- armodel/models/M2/AUTOSARTemplates/SWComponentTemplate/EndToEndProtection.py +13 -6
- armodel/models/M2/AUTOSARTemplates/SWComponentTemplate/PortInterface/__init__.py +166 -50
- armodel/models/M2/AUTOSARTemplates/SWComponentTemplate/SoftwareComponentDocumentation.py +80 -0
- armodel/models/M2/AUTOSARTemplates/SWComponentTemplate/SwcInternalBehavior/AccessCount.py +9 -1
- armodel/models/M2/AUTOSARTemplates/SWComponentTemplate/SwcInternalBehavior/ModeDeclarationGroup.py +5 -4
- armodel/models/M2/AUTOSARTemplates/SWComponentTemplate/SwcInternalBehavior/RTEEvents.py +11 -1
- armodel/models/M2/AUTOSARTemplates/SWComponentTemplate/SwcInternalBehavior/ServiceMapping.py +16 -2
- armodel/models/M2/AUTOSARTemplates/SWComponentTemplate/SwcInternalBehavior/__init__.py +9 -1
- armodel/models/M2/AUTOSARTemplates/SystemTemplate/DataMapping.py +167 -5
- armodel/models/M2/AUTOSARTemplates/SystemTemplate/{ECUResourceMapping.py → EcuResourceMapping.py} +4 -3
- armodel/models/M2/AUTOSARTemplates/SystemTemplate/Fibex/Fibex4Can/CanTopology.py +31 -21
- armodel/models/M2/AUTOSARTemplates/SystemTemplate/Fibex/Fibex4Ethernet/EthernetFrame.py +5 -3
- armodel/models/M2/AUTOSARTemplates/SystemTemplate/Fibex/Fibex4Ethernet/EthernetTopology.py +18 -6
- armodel/models/M2/AUTOSARTemplates/SystemTemplate/Fibex/Fibex4Flexray/FlexrayCommunication.py +76 -0
- armodel/models/M2/AUTOSARTemplates/SystemTemplate/Fibex/Fibex4Flexray/FlexrayTopology.py +654 -0
- armodel/models/M2/AUTOSARTemplates/SystemTemplate/Fibex/Fibex4Flexray/__init__.py +0 -0
- armodel/models/M2/AUTOSARTemplates/SystemTemplate/Fibex/FibexCore/CoreCommunication.py +64 -31
- armodel/models/M2/AUTOSARTemplates/SystemTemplate/Fibex/FibexCore/CoreTopology.py +158 -40
- armodel/models/M2/AUTOSARTemplates/SystemTemplate/Fibex/FibexCore/EcuInstance.py +19 -6
- armodel/models/M2/AUTOSARTemplates/SystemTemplate/InstanceRefs.py +2 -0
- armodel/models/M2/AUTOSARTemplates/SystemTemplate/Transformer/__init__.py +524 -0
- armodel/models/M2/AUTOSARTemplates/SystemTemplate/__init__.py +15 -13
- armodel/models/M2/MSR/DataDictionary/DataDefProperties.py +10 -1
- armodel/models/M2/MSR/Documentation/BlockElements/Figure.py +163 -0
- armodel/models/M2/MSR/Documentation/BlockElements/__init__.py +0 -0
- armodel/models/M2/MSR/Documentation/TextModel/BlockElements/ListElements.py +5 -3
- armodel/models/M2/MSR/Documentation/TextModel/BlockElements/PaginationAndView.py +22 -1
- armodel/models/M2/MSR/Documentation/TextModel/BlockElements/__init__.py +94 -9
- armodel/models/__init__.py +7 -1
- armodel/parser/abstract_arxml_parser.py +39 -32
- armodel/parser/arxml_parser.py +1439 -551
- armodel/parser/file_parser.py +5 -3
- armodel/tests/test_armodel/models/test_ar_package.py +6 -11
- armodel/tests/test_armodel/models/test_port_interface.py +116 -117
- armodel/tests/test_armodel/parser/test_bsw_module_descriiption.py +109 -109
- armodel/tests/test_armodel/parser/test_sw_components.py +301 -28
- armodel/tests/test_armodel/parser/test_system.py +2 -8
- armodel/transformer/__init__.py +0 -0
- armodel/transformer/abstract.py +6 -0
- armodel/transformer/admin_data.py +31 -0
- armodel/writer/abstract_arxml_writer.py +22 -29
- armodel/writer/arxml_writer.py +1500 -526
- {armodel-1.7.7.dist-info → armodel-1.7.9.dist-info}/METADATA +61 -1
- {armodel-1.7.7.dist-info → armodel-1.7.9.dist-info}/RECORD +73 -57
- {armodel-1.7.7.dist-info → armodel-1.7.9.dist-info}/LICENSE +0 -0
- {armodel-1.7.7.dist-info → armodel-1.7.9.dist-info}/WHEEL +0 -0
- {armodel-1.7.7.dist-info → armodel-1.7.9.dist-info}/entry_points.txt +0 -0
- {armodel-1.7.7.dist-info → armodel-1.7.9.dist-info}/top_level.txt +0 -0
armodel/parser/file_parser.py
CHANGED
|
@@ -3,6 +3,8 @@ import os
|
|
|
3
3
|
import re
|
|
4
4
|
from typing import List
|
|
5
5
|
|
|
6
|
+
from colorama import Fore
|
|
7
|
+
|
|
6
8
|
|
|
7
9
|
class FileListParser:
|
|
8
10
|
'''
|
|
@@ -22,8 +24,8 @@ class FileListParser:
|
|
|
22
24
|
for line in f_in:
|
|
23
25
|
if not line.startswith('#'):
|
|
24
26
|
self.file_list.append(line.strip())
|
|
25
|
-
except:
|
|
26
|
-
self.logger.error("No such file or directory: %s" % os.path.realpath(file))
|
|
27
|
+
except IOError:
|
|
28
|
+
self.logger.error(Fore.RED + "No such file or directory: %s" % os.path.realpath(file) + Fore.WHITE)
|
|
27
29
|
|
|
28
30
|
def parse_dir_files(self, dir_name):
|
|
29
31
|
for (root, _, files) in os.walk(dir_name, topdown=False):
|
|
@@ -41,4 +43,4 @@ class FileListParser:
|
|
|
41
43
|
logging.debug("Parse ARXML list file %s " % input_file)
|
|
42
44
|
self.parse_text_file(input_file[1:])
|
|
43
45
|
else:
|
|
44
|
-
self.file_list.append(input_file)
|
|
46
|
+
self.file_list.append(input_file)
|
|
@@ -2,17 +2,11 @@
|
|
|
2
2
|
import pytest
|
|
3
3
|
|
|
4
4
|
from ....models.M2.AUTOSARTemplates.SWComponentTemplate.Datatype.Datatypes import ApplicationPrimitiveDataType, ApplicationRecordDataType
|
|
5
|
-
|
|
6
5
|
from ....models.M2.MSR.AsamHdo.BaseTypes import SwBaseType
|
|
7
|
-
|
|
8
6
|
from ....models.M2.AUTOSARTemplates.GenericStructure.GeneralTemplateClasses.Identifiable import PackageableElement
|
|
9
|
-
|
|
10
7
|
from ....models.M2.AUTOSARTemplates.GenericStructure.GeneralTemplateClasses.Identifiable import CollectableElement
|
|
11
|
-
|
|
12
8
|
from ....models.M2.AUTOSARTemplates.GenericStructure.GeneralTemplateClasses.Identifiable import Identifiable, MultilanguageReferrable, Referrable
|
|
13
|
-
|
|
14
9
|
from ....models.M2.AUTOSARTemplates.GenericStructure.GeneralTemplateClasses.ArObject import ARObject
|
|
15
|
-
|
|
16
10
|
from ....models.M2.AUTOSARTemplates.CommonStructure.ImplementationDataTypes import ImplementationDataType
|
|
17
11
|
from ....models.M2.AUTOSARTemplates.SWComponentTemplate.Components import ApplicationSwComponentType, AtomicSwComponentType, EcuAbstractionSwComponentType, SwComponentType
|
|
18
12
|
from ....models.M2.AUTOSARTemplates.AutosarTopLevelStructure import AUTOSAR
|
|
@@ -23,28 +17,29 @@ from ....models.M2.AUTOSARTemplates.SWComponentTemplate.PortInterface import Cli
|
|
|
23
17
|
from ....models.M2.AUTOSARTemplates.SWComponentTemplate.Components import ServiceSwComponentType
|
|
24
18
|
from ....models.M2.AUTOSARTemplates.SWComponentTemplate.Components import CompositionSwComponentType
|
|
25
19
|
|
|
20
|
+
|
|
26
21
|
class TestAUTOSAR:
|
|
27
22
|
|
|
28
23
|
def test_autosar_singleton_exception(self):
|
|
29
24
|
AUTOSAR.getInstance()
|
|
30
25
|
with pytest.raises(Exception) as err:
|
|
31
26
|
AUTOSAR()
|
|
32
|
-
assert(str(err.value) == "The AUTOSAR is singleton!")
|
|
27
|
+
assert (str(err.value) == "The AUTOSAR is singleton!")
|
|
33
28
|
|
|
34
29
|
def test_cannot_find_element(self):
|
|
35
30
|
document = AUTOSAR.getInstance()
|
|
36
|
-
#with pytest.raises(Exception) as err:
|
|
31
|
+
# with pytest.raises(Exception) as err:
|
|
37
32
|
# document.find("/sw_package/not_found")
|
|
38
|
-
#assert(str(err.value) ==
|
|
33
|
+
# assert(str(err.value) ==
|
|
39
34
|
# "The sw_package of reference </sw_package/not_found> does not exist.")
|
|
40
|
-
assert(document.find("/sw_package/not_found")
|
|
35
|
+
assert (document.find("/sw_package/not_found") is None)
|
|
41
36
|
|
|
42
37
|
def test_autosar(self):
|
|
43
38
|
document = AUTOSAR.getInstance()
|
|
44
39
|
assert (isinstance(document, CollectableElement))
|
|
45
40
|
assert (isinstance(document, AUTOSAR))
|
|
46
41
|
assert (len(document.getARPackages()) == 0)
|
|
47
|
-
assert (document.schema_location
|
|
42
|
+
assert (document.schema_location is None)
|
|
48
43
|
assert (document.full_name == "")
|
|
49
44
|
|
|
50
45
|
def test_create_autosar_package(self):
|
|
@@ -23,186 +23,185 @@ class Test_M2_AUTOSARTemplates_SWComponentTemplate_PortInterface:
|
|
|
23
23
|
def test_PortInterface(self):
|
|
24
24
|
with pytest.raises(NotImplementedError) as err:
|
|
25
25
|
PortInterface(AUTOSAR.getInstance(), "PortInterface")
|
|
26
|
-
assert(str(err.value) == "PortInterface is an abstract class.")
|
|
26
|
+
assert (str(err.value) == "PortInterface is an abstract class.")
|
|
27
27
|
|
|
28
28
|
def test_DataInterface(self):
|
|
29
29
|
with pytest.raises(NotImplementedError) as err:
|
|
30
30
|
DataInterface(AUTOSAR.getInstance(), "DataInterface")
|
|
31
|
-
assert(str(err.value) == "DataInterface is an abstract class.")
|
|
31
|
+
assert (str(err.value) == "DataInterface is an abstract class.")
|
|
32
32
|
|
|
33
33
|
def test_NvDataInterface(self):
|
|
34
34
|
document = AUTOSAR.getInstance()
|
|
35
35
|
ar_root = document.createARPackage("AUTOSAR")
|
|
36
36
|
data_if = NvDataInterface(ar_root, "NvDataInterface")
|
|
37
37
|
|
|
38
|
-
assert(isinstance(data_if, ARElement))
|
|
39
|
-
assert(isinstance(data_if, ARObject))
|
|
40
|
-
# assert(isinstance(sr, AtpBlueprint))
|
|
41
|
-
# assert(isinstance(sr, AtpBlueprintable))
|
|
42
|
-
# assert(isinstance(sr, AtpClassifier))
|
|
43
|
-
assert(isinstance(data_if, AtpType))
|
|
44
|
-
assert(isinstance(data_if, CollectableElement))
|
|
45
|
-
assert(isinstance(data_if, DataInterface))
|
|
46
|
-
assert(isinstance(data_if, Identifiable))
|
|
47
|
-
assert(isinstance(data_if, MultilanguageReferrable))
|
|
48
|
-
assert(isinstance(data_if, PackageableElement))
|
|
49
|
-
assert(isinstance(data_if, PortInterface))
|
|
50
|
-
assert(isinstance(data_if, Referrable))
|
|
51
|
-
assert(isinstance(data_if, NvDataInterface))
|
|
52
|
-
|
|
53
|
-
assert(data_if.parent == ar_root)
|
|
54
|
-
assert(data_if.short_name == "NvDataInterface")
|
|
38
|
+
assert (isinstance(data_if, ARElement))
|
|
39
|
+
assert (isinstance(data_if, ARObject))
|
|
40
|
+
# assert (isinstance(sr, AtpBlueprint))
|
|
41
|
+
# assert (isinstance(sr, AtpBlueprintable))
|
|
42
|
+
# assert (isinstance(sr, AtpClassifier))
|
|
43
|
+
assert (isinstance(data_if, AtpType))
|
|
44
|
+
assert (isinstance(data_if, CollectableElement))
|
|
45
|
+
assert (isinstance(data_if, DataInterface))
|
|
46
|
+
assert (isinstance(data_if, Identifiable))
|
|
47
|
+
assert (isinstance(data_if, MultilanguageReferrable))
|
|
48
|
+
assert (isinstance(data_if, PackageableElement))
|
|
49
|
+
assert (isinstance(data_if, PortInterface))
|
|
50
|
+
assert (isinstance(data_if, Referrable))
|
|
51
|
+
assert (isinstance(data_if, NvDataInterface))
|
|
52
|
+
|
|
53
|
+
assert (data_if.parent == ar_root)
|
|
54
|
+
assert (data_if.short_name == "NvDataInterface")
|
|
55
55
|
|
|
56
56
|
def test_ParameterInterface(self):
|
|
57
57
|
document = AUTOSAR.getInstance()
|
|
58
58
|
ar_root = document.createARPackage("AUTOSAR")
|
|
59
59
|
data_if = ParameterInterface(ar_root, "ParameterInterface")
|
|
60
60
|
|
|
61
|
-
assert(isinstance(data_if, ARElement))
|
|
62
|
-
assert(isinstance(data_if, ARObject))
|
|
63
|
-
# assert(isinstance(sr, AtpBlueprint))
|
|
64
|
-
# assert(isinstance(sr, AtpBlueprintable))
|
|
65
|
-
# assert(isinstance(sr, AtpClassifier))
|
|
66
|
-
assert(isinstance(data_if, AtpType))
|
|
67
|
-
assert(isinstance(data_if, CollectableElement))
|
|
68
|
-
assert(isinstance(data_if, DataInterface))
|
|
69
|
-
assert(isinstance(data_if, Identifiable))
|
|
70
|
-
assert(isinstance(data_if, MultilanguageReferrable))
|
|
71
|
-
assert(isinstance(data_if, PackageableElement))
|
|
72
|
-
assert(isinstance(data_if, PortInterface))
|
|
73
|
-
assert(isinstance(data_if, Referrable))
|
|
74
|
-
assert(isinstance(data_if, ParameterInterface))
|
|
75
|
-
|
|
76
|
-
assert(data_if.parent == ar_root)
|
|
77
|
-
assert(data_if.short_name == "ParameterInterface")
|
|
61
|
+
assert (isinstance(data_if, ARElement))
|
|
62
|
+
assert (isinstance(data_if, ARObject))
|
|
63
|
+
# assert (isinstance(sr, AtpBlueprint))
|
|
64
|
+
# assert (isinstance(sr, AtpBlueprintable))
|
|
65
|
+
# assert (isinstance(sr, AtpClassifier))
|
|
66
|
+
assert (isinstance(data_if, AtpType))
|
|
67
|
+
assert (isinstance(data_if, CollectableElement))
|
|
68
|
+
assert (isinstance(data_if, DataInterface))
|
|
69
|
+
assert (isinstance(data_if, Identifiable))
|
|
70
|
+
assert (isinstance(data_if, MultilanguageReferrable))
|
|
71
|
+
assert (isinstance(data_if, PackageableElement))
|
|
72
|
+
assert (isinstance(data_if, PortInterface))
|
|
73
|
+
assert (isinstance(data_if, Referrable))
|
|
74
|
+
assert (isinstance(data_if, ParameterInterface))
|
|
75
|
+
|
|
76
|
+
assert (data_if.parent == ar_root)
|
|
77
|
+
assert (data_if.short_name == "ParameterInterface")
|
|
78
78
|
|
|
79
79
|
def test_SenderReceiverInterface(self):
|
|
80
80
|
document = AUTOSAR.getInstance()
|
|
81
81
|
ar_root = document.createARPackage("AUTOSAR")
|
|
82
82
|
sr_if = SenderReceiverInterface(ar_root, "sr_if")
|
|
83
83
|
|
|
84
|
-
assert(isinstance(sr_if, ARElement))
|
|
85
|
-
assert(isinstance(sr_if, ARObject))
|
|
86
|
-
# assert(isinstance(sr, AtpBlueprint))
|
|
87
|
-
# assert(isinstance(sr, AtpBlueprintable))
|
|
88
|
-
# assert(isinstance(sr, AtpClassifier))
|
|
89
|
-
assert(isinstance(sr_if, AtpType))
|
|
90
|
-
assert(isinstance(sr_if, CollectableElement))
|
|
91
|
-
assert(isinstance(sr_if, DataInterface))
|
|
92
|
-
assert(isinstance(sr_if, Identifiable))
|
|
93
|
-
assert(isinstance(sr_if, MultilanguageReferrable))
|
|
94
|
-
assert(isinstance(sr_if, PackageableElement))
|
|
95
|
-
assert(isinstance(sr_if, PortInterface))
|
|
96
|
-
assert(isinstance(sr_if, Referrable))
|
|
97
|
-
assert(isinstance(sr_if, SenderReceiverInterface))
|
|
98
|
-
|
|
99
|
-
assert(sr_if.short_name == "sr_if")
|
|
100
|
-
assert(sr_if.parent == ar_root)
|
|
101
|
-
assert(len(sr_if.getDataElements()) == 0)
|
|
84
|
+
assert (isinstance(sr_if, ARElement))
|
|
85
|
+
assert (isinstance(sr_if, ARObject))
|
|
86
|
+
# assert (isinstance(sr, AtpBlueprint))
|
|
87
|
+
# assert (isinstance(sr, AtpBlueprintable))
|
|
88
|
+
# assert (isinstance(sr, AtpClassifier))
|
|
89
|
+
assert (isinstance(sr_if, AtpType))
|
|
90
|
+
assert (isinstance(sr_if, CollectableElement))
|
|
91
|
+
assert (isinstance(sr_if, DataInterface))
|
|
92
|
+
assert (isinstance(sr_if, Identifiable))
|
|
93
|
+
assert (isinstance(sr_if, MultilanguageReferrable))
|
|
94
|
+
assert (isinstance(sr_if, PackageableElement))
|
|
95
|
+
assert (isinstance(sr_if, PortInterface))
|
|
96
|
+
assert (isinstance(sr_if, Referrable))
|
|
97
|
+
assert (isinstance(sr_if, SenderReceiverInterface))
|
|
98
|
+
|
|
99
|
+
assert (sr_if.short_name == "sr_if")
|
|
100
|
+
assert (sr_if.parent == ar_root)
|
|
101
|
+
assert (len(sr_if.getDataElements()) == 0)
|
|
102
102
|
|
|
103
103
|
element = sr_if.createDataElement("element")
|
|
104
|
-
assert(isinstance(element, VariableDataPrototype))
|
|
105
|
-
assert(element.short_name == "element")
|
|
106
|
-
assert(len(sr_if.getDataElements()) == 1)
|
|
104
|
+
assert (isinstance(element, VariableDataPrototype))
|
|
105
|
+
assert (element.short_name == "element")
|
|
106
|
+
assert (len(sr_if.getDataElements()) == 1)
|
|
107
107
|
|
|
108
108
|
element2 = sr_if.getDataElement("element")
|
|
109
|
-
assert(element == element2)
|
|
109
|
+
assert (element == element2)
|
|
110
110
|
|
|
111
111
|
with pytest.raises(IndexError) as err:
|
|
112
112
|
sr_if.getDataElement("non_exist_element")
|
|
113
|
-
assert(str(err.value) == "data element <non_exist_element> can not be found.")
|
|
113
|
+
assert (str(err.value) == "data element <non_exist_element> can not be found.")
|
|
114
114
|
|
|
115
115
|
def test_ArgumentDataPrototype(self):
|
|
116
116
|
document = AUTOSAR.getInstance()
|
|
117
117
|
ar_root = document.createARPackage("AUTOSAR")
|
|
118
118
|
prototype = ArgumentDataPrototype(ar_root, "ArgumentDataPrototype")
|
|
119
119
|
|
|
120
|
-
assert(isinstance(prototype, ARObject))
|
|
121
|
-
assert(isinstance(prototype, AtpFeature))
|
|
122
|
-
assert(isinstance(prototype, AtpPrototype))
|
|
123
|
-
assert(isinstance(prototype, AutosarDataPrototype))
|
|
124
|
-
assert(isinstance(prototype, DataPrototype))
|
|
125
|
-
assert(isinstance(prototype, Identifiable))
|
|
126
|
-
assert(isinstance(prototype, MultilanguageReferrable))
|
|
127
|
-
assert(isinstance(prototype, Referrable))
|
|
128
|
-
assert(isinstance(prototype, ArgumentDataPrototype))
|
|
129
|
-
|
|
130
|
-
assert(prototype.getParent() == ar_root)
|
|
131
|
-
assert(prototype.getShortName() == "ArgumentDataPrototype")
|
|
132
|
-
assert(prototype.getDirection() == None)
|
|
133
|
-
assert(prototype.getServerArgumentImplPolicy() == None)
|
|
120
|
+
assert (isinstance(prototype, ARObject))
|
|
121
|
+
assert (isinstance(prototype, AtpFeature))
|
|
122
|
+
assert (isinstance(prototype, AtpPrototype))
|
|
123
|
+
assert (isinstance(prototype, AutosarDataPrototype))
|
|
124
|
+
assert (isinstance(prototype, DataPrototype))
|
|
125
|
+
assert (isinstance(prototype, Identifiable))
|
|
126
|
+
assert (isinstance(prototype, MultilanguageReferrable))
|
|
127
|
+
assert (isinstance(prototype, Referrable))
|
|
128
|
+
assert (isinstance(prototype, ArgumentDataPrototype))
|
|
129
|
+
|
|
130
|
+
assert (prototype.getParent() == ar_root)
|
|
131
|
+
assert (prototype.getShortName() == "ArgumentDataPrototype")
|
|
132
|
+
assert (prototype.getDirection() == None)
|
|
133
|
+
assert (prototype.getServerArgumentImplPolicy() == None)
|
|
134
134
|
|
|
135
135
|
def test_ApplicationError(self):
|
|
136
136
|
document = AUTOSAR.getInstance()
|
|
137
137
|
ar_root = document.createARPackage("AUTOSAR")
|
|
138
138
|
app_error = ApplicationError(ar_root, "ApplicationError")
|
|
139
139
|
|
|
140
|
-
assert(isinstance(app_error, ARObject))
|
|
141
|
-
assert(isinstance(app_error, Identifiable))
|
|
142
|
-
assert(isinstance(app_error, MultilanguageReferrable))
|
|
143
|
-
assert(isinstance(app_error, Referrable))
|
|
144
|
-
assert(isinstance(app_error, ApplicationError))
|
|
140
|
+
assert (isinstance(app_error, ARObject))
|
|
141
|
+
assert (isinstance(app_error, Identifiable))
|
|
142
|
+
assert (isinstance(app_error, MultilanguageReferrable))
|
|
143
|
+
assert (isinstance(app_error, Referrable))
|
|
144
|
+
assert (isinstance(app_error, ApplicationError))
|
|
145
145
|
|
|
146
|
-
assert(app_error.parent == ar_root)
|
|
147
|
-
assert(app_error.short_name == "ApplicationError")
|
|
146
|
+
assert (app_error.parent == ar_root)
|
|
147
|
+
assert (app_error.short_name == "ApplicationError")
|
|
148
148
|
|
|
149
149
|
def test_ClientServerOperation(self):
|
|
150
150
|
document = AUTOSAR.getInstance()
|
|
151
151
|
ar_root = document.createARPackage("AUTOSAR")
|
|
152
152
|
operation = ClientServerOperation(ar_root, "client_server_operation")
|
|
153
|
-
assert(isinstance(operation, ARObject))
|
|
154
|
-
# assert(isinstance(operation, AtpClassifier))
|
|
155
|
-
assert(isinstance(operation, AtpFeature))
|
|
156
|
-
assert(isinstance(operation, Identifiable))
|
|
157
|
-
assert(isinstance(operation, MultilanguageReferrable))
|
|
158
|
-
assert(isinstance(operation, Referrable))
|
|
159
|
-
assert(isinstance(operation, ClientServerOperation))
|
|
160
|
-
assert(operation.short_name == "client_server_operation")
|
|
161
|
-
|
|
162
|
-
prototype =
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
assert(
|
|
167
|
-
assert(operation.getArgumentDataPrototypes()[0] == prototype)
|
|
153
|
+
assert (isinstance(operation, ARObject))
|
|
154
|
+
# assert (isinstance(operation, AtpClassifier))
|
|
155
|
+
assert (isinstance(operation, AtpFeature))
|
|
156
|
+
assert (isinstance(operation, Identifiable))
|
|
157
|
+
assert (isinstance(operation, MultilanguageReferrable))
|
|
158
|
+
assert (isinstance(operation, Referrable))
|
|
159
|
+
assert (isinstance(operation, ClientServerOperation))
|
|
160
|
+
assert (operation.short_name == "client_server_operation")
|
|
161
|
+
|
|
162
|
+
prototype = operation.createArgumentDataPrototype("argument_data_prototype1")
|
|
163
|
+
assert (prototype.short_name == "argument_data_prototype1")
|
|
164
|
+
|
|
165
|
+
assert (len(operation.getArguments()) == 1)
|
|
166
|
+
assert (operation.getArguments()[0] == prototype)
|
|
168
167
|
|
|
169
168
|
refType = RefType()
|
|
170
169
|
refType.dest = "APPLICATION-ERROR"
|
|
171
170
|
refType.value = "/AUTOSAR_NvM/PortInterfaces/NvMService/E_NOT_OK"
|
|
172
171
|
operation.addPossibleErrorRef(refType)
|
|
173
172
|
|
|
174
|
-
assert(len(operation.
|
|
175
|
-
assert(operation.
|
|
173
|
+
assert (len(operation.getPossibleErrorRefs()) == 1)
|
|
174
|
+
assert (operation.getPossibleErrorRefs()[0] == refType)
|
|
176
175
|
|
|
177
176
|
def test_ClientServerInterface(self):
|
|
178
177
|
document = AUTOSAR.getInstance()
|
|
179
178
|
ar_root = document.createARPackage("AUTOSAR")
|
|
180
179
|
cs_if = ClientServerInterface(ar_root, "client_server_interface")
|
|
181
|
-
assert(isinstance(cs_if, ARObject))
|
|
182
|
-
assert(isinstance(cs_if, ARElement))
|
|
183
|
-
# assert(isinstance(operation, AtpBlueprint))
|
|
184
|
-
# assert(isinstance(operation, AtpBlueprintable))
|
|
185
|
-
# assert(isinstance(operation, AtpClassifier))
|
|
186
|
-
assert(isinstance(cs_if, AtpType))
|
|
187
|
-
assert(isinstance(cs_if, CollectableElement))
|
|
188
|
-
assert(isinstance(cs_if, Identifiable))
|
|
189
|
-
assert(isinstance(cs_if, MultilanguageReferrable))
|
|
190
|
-
assert(isinstance(cs_if, PackageableElement))
|
|
191
|
-
assert(isinstance(cs_if, PortInterface))
|
|
192
|
-
assert(isinstance(cs_if, Referrable))
|
|
180
|
+
assert (isinstance(cs_if, ARObject))
|
|
181
|
+
assert (isinstance(cs_if, ARElement))
|
|
182
|
+
# assert (isinstance(operation, AtpBlueprint))
|
|
183
|
+
# assert (isinstance(operation, AtpBlueprintable))
|
|
184
|
+
# assert (isinstance(operation, AtpClassifier))
|
|
185
|
+
assert (isinstance(cs_if, AtpType))
|
|
186
|
+
assert (isinstance(cs_if, CollectableElement))
|
|
187
|
+
assert (isinstance(cs_if, Identifiable))
|
|
188
|
+
assert (isinstance(cs_if, MultilanguageReferrable))
|
|
189
|
+
assert (isinstance(cs_if, PackageableElement))
|
|
190
|
+
assert (isinstance(cs_if, PortInterface))
|
|
191
|
+
assert (isinstance(cs_if, Referrable))
|
|
193
192
|
|
|
194
193
|
element = cs_if.createOperation("operation")
|
|
195
|
-
assert(isinstance(element, ClientServerOperation))
|
|
196
|
-
assert(element.short_name == "operation")
|
|
197
|
-
assert(len(cs_if.getOperations()) == 1)
|
|
194
|
+
assert (isinstance(element, ClientServerOperation))
|
|
195
|
+
assert (element.short_name == "operation")
|
|
196
|
+
assert (len(cs_if.getOperations()) == 1)
|
|
198
197
|
|
|
199
198
|
element2 = cs_if.getOperations()[0]
|
|
200
|
-
assert(element == element2)
|
|
199
|
+
assert (element == element2)
|
|
201
200
|
|
|
202
201
|
element = cs_if.createApplicationError("error")
|
|
203
|
-
assert(isinstance(element, ApplicationError))
|
|
204
|
-
assert(element.short_name == "error")
|
|
205
|
-
assert(len(cs_if.getPossibleErrors()) == 1)
|
|
202
|
+
assert (isinstance(element, ApplicationError))
|
|
203
|
+
assert (element.short_name == "error")
|
|
204
|
+
assert (len(cs_if.getPossibleErrors()) == 1)
|
|
206
205
|
|
|
207
206
|
element2 = cs_if.getPossibleErrors()[0]
|
|
208
|
-
assert(element == element2)
|
|
207
|
+
assert (element == element2)
|