Commit 2ca3c322 authored by Spiros Koulouzis's avatar Spiros Koulouzis

fixed test

parent 4e631d0b
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="e478ccae-5352-4e8e-9efb-3f5cda44e877" name="Default Changelist" comment="added matplotlib">
<list default="true" id="e478ccae-5352-4e8e-9efb-3f5cda44e877" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/__main__.py" beforeDir="false" afterPath="$PROJECT_DIR$/__main__.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/service/simple_spec_alayzer.py" beforeDir="false" afterPath="$PROJECT_DIR$/service/simple_spec_alayzer.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/test/test_planner.py" beforeDir="false" afterPath="$PROJECT_DIR$/test/test_planner.py" afterDir="false" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="SHOW_DIALOG" value="false" />
......@@ -169,7 +171,14 @@
<option name="project" value="LOCAL" />
<updated>1573146945740</updated>
</task>
<option name="localTasksCounter" value="10" />
<task id="LOCAL-00010" summary="fixed default property setting">
<created>1573214191545</created>
<option name="number" value="00010" />
<option name="presentableId" value="LOCAL-00010" />
<option name="project" value="LOCAL" />
<updated>1573214191545</updated>
</task>
<option name="localTasksCounter" value="11" />
<servers />
</component>
<component name="Vcs.Log.Tabs.Properties">
......@@ -194,7 +203,8 @@
<MESSAGE value="added pyyaml" />
<MESSAGE value="added tosca-parser" />
<MESSAGE value="added matplotlib" />
<option name="LAST_COMMIT_MESSAGE" value="added matplotlib" />
<MESSAGE value="fixed default property setting" />
<option name="LAST_COMMIT_MESSAGE" value="fixed default property setting" />
</component>
<component name="XDebuggerManager">
<breakpoint-manager>
......@@ -209,11 +219,6 @@
<line>61</line>
<option name="timeStamp" value="9" />
</line-breakpoint>
<line-breakpoint enabled="true" suspend="THREAD" type="python-line">
<url>file://$PROJECT_DIR$/__main__.py</url>
<line>124</line>
<option name="timeStamp" value="10" />
</line-breakpoint>
<line-breakpoint enabled="true" suspend="THREAD" type="python-line">
<url>file://$PROJECT_DIR$/service/simple_spec_alayzer.py</url>
<line>25</line>
......
......@@ -10,6 +10,7 @@ import logging
import pika
import yaml
import sys
import copy
from toscaparser.tosca_template import ToscaTemplate
......@@ -124,23 +125,10 @@ if __name__ == "__main__":
template_dict = tosca_helper.get_tosca_template_2_topology_template_dictionary(test_tosca_template)
logger.info("template ----: \n" + yaml.dump(template_dict))
try:
tosca_folder_path = os.path.join(tempfile.gettempdir(), tosca_path)
except NameError:
import sys
# tosca_folder_path = os.path.dirname(os.path.abspath(sys.argv[0])) + os.path.join(tempfile.gettempdir(),
# tosca_path)
# tosca_file_name = 'tosca_template'
# input_tosca_file_path = tosca_path + '/application_example_2_topologies.yaml'
#
# with open(input_tosca_file_path, 'w') as outfile:
# outfile.write(yaml.dump(template_dict))
#
# ToscaTemplate(input_tosca_file_path)
#
# test_response = {'toscaTemplate': template_dict}
# logger.info("Output message:" + json.dumps(test_response))
ToscaTemplate(yaml_dict_tpl=copy.deepcopy(template_dict))
test_response = {'toscaTemplate': template_dict}
logger.info("Output message:" + json.dumps(test_response))
else:
logger.info("Input args: " + sys.argv[0] + ' ' + sys.argv[1] + ' ' + sys.argv[2])
channel = init_chanel(sys.argv)
......
......@@ -71,7 +71,6 @@ class SimpleAnalyzer(SpecificationAnalyzer):
new_vm.name = new_vm_name
templates = new_vm.templates.pop(old_vm_name)
new_vm.templates[new_vm_name] = templates
new_vm.templates[next(iter(new_vm.templates))]['properties']['role'] = "worker"
return_nodes.append(new_vm)
for requirement in topology_nodes[0].requirements:
......
import copy
import json
import logging
import os
......@@ -19,10 +20,9 @@ class MyTestCase(unittest.TestCase):
def test_something(self):
logger = logging.getLogger(__name__)
tosca_path = "../TOSCA/"
input_tosca_file_path = tosca_path + '/application_example_2_topologies.yaml'
input_tosca_file_path = tosca_path + '/application_example_updated.yaml'
dir_path = os.path.dirname(os.path.realpath(__file__))
print(dir_path)
self.assertEqual(True, os.path.exists(input_tosca_file_path),
"Input TOSCA file: " + input_tosca_file_path + " not found")
......@@ -35,20 +35,7 @@ class MyTestCase(unittest.TestCase):
template_dict = tosca_helper.get_tosca_template_2_topology_template_dictionary(test_tosca_template)
logger.info("template ----: \n" + yaml.dump(template_dict))
try:
tosca_folder_path = os.path.join(tempfile.gettempdir(), tosca_path)
except NameError:
import sys
tosca_folder_path = os.path.dirname(os.path.abspath(sys.argv[0])) + os.path.join(tempfile.gettempdir(),
tosca_path)
tosca_file_name = 'tosca_template'
input_tosca_file_path = tosca_path + '/application_example_output.yaml'
with open(input_tosca_file_path, 'w') as outfile:
outfile.write(yaml.dump(template_dict))
ToscaTemplate(input_tosca_file_path)
ToscaTemplate(yaml_dict_tpl=copy.deepcopy(template_dict))
test_response = {'toscaTemplate': template_dict}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment