Commit 61e56960 authored by Spiros Koulouzis's avatar Spiros Koulouzis

added test

parent b8df0432
...@@ -2,15 +2,13 @@ ...@@ -2,15 +2,13 @@
<project version="4"> <project version="4">
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="462ede19-adfe-472b-975e-fefefa973fe0" name="Default Changelist" comment=""> <list default="true" id="462ede19-adfe-472b-975e-fefefa973fe0" name="Default Changelist" comment="">
<change afterPath="$PROJECT_DIR$/src/test_planner.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../TOSCA/application_example_output.yaml" beforeDir="false" afterPath="$PROJECT_DIR$/../TOSCA/application_example_output.yaml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/../TOSCA/application_example_output.yaml" beforeDir="false" afterPath="$PROJECT_DIR$/../TOSCA/application_example_output.yaml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../TOSCA/application_example_updated.yaml" beforeDir="false" afterPath="$PROJECT_DIR$/../TOSCA/application_example_updated.yaml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/../TOSCA/application_example_updated.yaml" beforeDir="false" afterPath="$PROJECT_DIR$/../TOSCA/application_example_updated.yaml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../TOSCA/types/nodes.yaml" beforeDir="false" afterPath="$PROJECT_DIR$/../TOSCA/types/nodes.yaml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/../TOSCA/types/nodes.yaml" beforeDir="false" afterPath="$PROJECT_DIR$/../TOSCA/types/nodes.yaml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/planner/planner.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/planner/planner.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/planner/planner.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/planner/planner.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/planner/simple_spec_alayzer.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/planner/simple_spec_alayzer.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/planner/specification_analyzer.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/planner/specification_analyzer.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/rpc_server.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/rpc_server.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/rpc_server.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/rpc_server.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/utils/tosca.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/utils/tosca.py" afterDir="false" />
</list> </list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" /> <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
...@@ -22,6 +20,7 @@ ...@@ -22,6 +20,7 @@
<option name="RECENT_TEMPLATES"> <option name="RECENT_TEMPLATES">
<list> <list>
<option value="Python Script" /> <option value="Python Script" />
<option value="Python Unit Test" />
</list> </list>
</option> </option>
</component> </component>
...@@ -104,9 +103,31 @@ ...@@ -104,9 +103,31 @@
<option name="INPUT_FILE" value="" /> <option name="INPUT_FILE" value="" />
<method v="2" /> <method v="2" />
</configuration> </configuration>
<configuration name="test_planner" type="PythonConfigurationType" factoryName="Python" temporary="true">
<module name="drip_planner2" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/src" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/src/test_planner.py" />
<option name="PARAMETERS" value="" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="false" />
<option name="MODULE_MODE" value="false" />
<option name="REDIRECT_INPUT" value="false" />
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
<recent_temporary> <recent_temporary>
<list> <list>
<item itemvalue="Python.rpc_server" /> <item itemvalue="Python.rpc_server" />
<item itemvalue="Python.test_planner" />
<item itemvalue="Python.basic_planner" /> <item itemvalue="Python.basic_planner" />
</list> </list>
</recent_temporary> </recent_temporary>
...@@ -227,7 +248,14 @@ ...@@ -227,7 +248,14 @@
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1571748060598</updated> <updated>1571748060598</updated>
</task> </task>
<option name="localTasksCounter" value="16" /> <task id="LOCAL-00016" summary="fixed policies error">
<created>1571756795577</created>
<option name="number" value="00016" />
<option name="presentableId" value="LOCAL-00016" />
<option name="project" value="LOCAL" />
<updated>1571756795577</updated>
</task>
<option name="localTasksCounter" value="17" />
<servers /> <servers />
</component> </component>
<component name="Vcs.Log.Tabs.Properties"> <component name="Vcs.Log.Tabs.Properties">
...@@ -258,7 +286,8 @@ ...@@ -258,7 +286,8 @@
<MESSAGE value="added comments" /> <MESSAGE value="added comments" />
<MESSAGE value="set default properties" /> <MESSAGE value="set default properties" />
<MESSAGE value="set min number of VMs based on the swarm default workers and masters" /> <MESSAGE value="set min number of VMs based on the swarm default workers and masters" />
<option name="LAST_COMMIT_MESSAGE" value="set min number of VMs based on the swarm default workers and masters" /> <MESSAGE value="fixed policies error" />
<option name="LAST_COMMIT_MESSAGE" value="fixed policies error" />
</component> </component>
<component name="XDebuggerManager"> <component name="XDebuggerManager">
<breakpoint-manager> <breakpoint-manager>
......
...@@ -5,11 +5,11 @@ from toscaparser.topology_template import TopologyTemplate ...@@ -5,11 +5,11 @@ from toscaparser.topology_template import TopologyTemplate
import operator import operator
from src.planner.simple_spec_alayzer import SimpleAnalyzer from planner.simple_spec_alayzer import SimpleAnalyzer
from src.planner.spec_service import * from planner.spec_service import *
from src.utils.tosca import * from utils.tosca import *
from src.planner.specification_analyzer import * from planner.specification_analyzer import *
from src.utils import tosca as tosca_util from utils import tosca as tosca_util
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
......
...@@ -9,10 +9,10 @@ import time ...@@ -9,10 +9,10 @@ import time
import pika import pika
from src.planner.basic_planner import * from planner.basic_planner import *
from src.planner.planner import * from planner.planner import *
from src.planner.spec_service import SpecService from planner.spec_service import SpecService
from src.utils import tosca as tosca_util from utils import tosca as tosca_util
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
......
import os
import os.path
import tempfile
import unittest
from planner.planner import *
from planner.spec_service import SpecService
from utils import tosca as tosca_util
class MyTestCase(unittest.TestCase):
def test_something(self):
tosca_path = "../../TOSCA/"
tosca_file_path = tosca_path+'/application_example_updated.yaml'
conf = {'url': "http://host"}
spec_service = SpecService(conf)
test_planner = Planner(tosca_file_path, spec_service)
tosca_template = test_planner.resolve_requirements()
tosca_template = test_planner.set_infrastructure_specifications()
template = tosca_util.get_tosca_template_2_topology_template_dictionary(tosca_template)
# logger.info("template ----: \n" + yaml.dump(template))
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))
ToscaTemplate(input_tosca_file_path)
self.assertEqual(True, True)
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