Commit 1f2c970c authored by Spiros Koulouzis's avatar Spiros Koulouzis

close and reopen channel

parent 8344e8e3
......@@ -16,8 +16,10 @@
package nl.uva.sne.drip.model;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable;
import java.util.List;
import javax.validation.constraints.NotNull;
/**
*
......@@ -28,8 +30,9 @@ import java.util.List;
@JsonInclude(JsonInclude.Include.NON_NULL)
public class Message implements Serializable {
@NotNull
private String owner;
@NotNull
private Long creationDate;
private List<MessageParameter> parameters;
......
<?xml version="1.0" encoding="UTF-8"?>
<actions>
<action>
<actionName>debug</actionName>
<packagings>
<packaging>jar</packaging>
</packagings>
<goals>
<goal>process-classes</goal>
<goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
</goals>
<properties>
<exec.args>-Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address} -classpath %classpath nl.uva.sne.drip.Swagger2SpringBoot</exec.args>
<exec.executable>java</exec.executable>
<jpda.listen>true</jpda.listen>
</properties>
</action>
<action>
<actionName>run</actionName>
<packagings>
<packaging>jar</packaging>
</packagings>
<goals>
<goal>process-classes</goal>
<goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
</goals>
<properties>
<exec.args>-classpath %classpath nl.uva.sne.drip.Swagger2SpringBoot</exec.args>
<exec.executable>java</exec.executable>
</properties>
</action>
</actions>
......@@ -42,24 +42,31 @@ import org.springframework.stereotype.Service;
@Service
public class DRIPCaller implements AutoCloseable {
private final Connection connection;
private final Channel channel;
private final String replyQueueName;
private Connection connection;
private Channel channel;
private String replyQueueName;
private String requestQeueName;
private final ObjectMapper mapper;
private final ConnectionFactory factory;
public DRIPCaller(ConnectionFactory factory) throws IOException, TimeoutException {
// factory.setHost(messageBrokerHost);
this.factory = factory;
// factory.setHost(messageBrokerHost);
// factory.setPort(AMQP.PROTOCOL.PORT);
// factory.setUsername(username);
// factory.setPassword(password);
init();
this.mapper = new ObjectMapper();
mapper.configure(JsonParser.Feature.ALLOW_SINGLE_QUOTES, true);
}
public void init() throws IOException, TimeoutException {
if (connection == null || !connection.isOpen()) {
connection = factory.newConnection();
channel = connection.createChannel();
// create a single callback queue per client not per requests.
replyQueueName = channel.queueDeclare().getQueue();
this.mapper = new ObjectMapper();
mapper.configure(JsonParser.Feature.ALLOW_SINGLE_QUOTES, true);
}
}
/**
......
......@@ -33,10 +33,11 @@ public class DRIPService {
public String execute(String id) {
try {
caller.init();
String ymlToscaTemplate = toscaTemplateService.findByID(id);
ToscaTemplate toscaTemplate = toscaTemplateService.getYaml2ToscaTemplate(ymlToscaTemplate);
Message message = new Message();
message.setOwner("user");
message.setCreationDate(System.currentTimeMillis());
message.setToscaTemplate(toscaTemplate);
......
......@@ -2,12 +2,9 @@
<project version="4">
<component name="ChangeListManager">
<list default="true" id="e478ccae-5352-4e8e-9efb-3f5cda44e877" name="Default Changelist" comment="">
<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$/.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$/planner/planner.py" beforeDir="false" afterPath="$PROJECT_DIR$/planner/planner.py" afterDir="false" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
......@@ -25,7 +22,13 @@
</component>
<component name="ProjectId" id="1TI7vNZs1Z3y1uB6wXCH5F47r0F" />
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
<component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showExcludedFiles" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent">
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
<property name="settings.editor.selected.configurable" value="com.jetbrains.python.configuration.PyActiveSdkModuleConfigurable" />
</component>
......@@ -38,18 +41,6 @@
<recent name="$PROJECT_DIR$/test" />
</key>
</component>
<component name="RunDashboard">
<option name="ruleStates">
<list>
<RuleState>
<option name="name" value="ConfigurationTypeDashboardGroupingRule" />
</RuleState>
<RuleState>
<option name="name" value="StatusDashboardGroupingRule" />
</RuleState>
</list>
</option>
</component>
<component name="RunManager" selected="Python.__main__">
<configuration name="__main__" type="PythonConfigurationType" factoryName="Python" temporary="true">
<module name="drip-planner" />
......@@ -102,8 +93,8 @@
</configuration>
<list>
<item itemvalue="Python.__main__" />
<item itemvalue="Python tests.Unittests in test_planner.py" />
<item itemvalue="Python tests.Unittests for test_planner.MyTestCase.test_something" />
<item itemvalue="Python tests.Unittests in test_planner.py" />
</list>
<recent_temporary>
<list>
......@@ -113,6 +104,18 @@
</list>
</recent_temporary>
</component>
<component name="ServiceViewManager">
<option name="viewStates">
<list>
<serviceView>
<treeState>
<expand />
<select />
</treeState>
</serviceView>
</list>
</option>
</component>
<component name="SvnConfiguration">
<configuration />
</component>
......@@ -230,17 +233,71 @@
<MESSAGE value="fixed test" />
<option name="LAST_COMMIT_MESSAGE" value="fixed test" />
</component>
<component name="WindowStateProjectService">
<state x="808" y="316" width="1000" height="839" key="#Inspections" timestamp="1575885366203">
<screen x="67" y="34" width="2493" height="1406" />
</state>
<state x="808" y="316" width="1000" height="839" key="#Inspections/67.34.2493.1406@67.34.2493.1406" timestamp="1575885366203" />
<state x="925" y="283" width="767" height="906" key="#__main__" timestamp="1575885420596">
<screen x="67" y="34" width="2493" height="1406" />
</state>
<state x="925" y="283" width="767" height="906" key="#__main__/67.34.2493.1406@67.34.2493.1406" timestamp="1575885420596" />
<state x="1043" y="437" width="530" height="598" key="FileChooserDialogImpl" timestamp="1575885341909">
<screen x="67" y="34" width="2493" height="1406" />
</state>
<state x="1043" y="437" width="530" height="598" key="FileChooserDialogImpl/67.34.2493.1406@67.34.2493.1406" timestamp="1575885341909" />
<state width="2465" height="471" key="GridCell.Tab.0.bottom" timestamp="1575891470097">
<screen x="67" y="34" width="2493" height="1406" />
</state>
<state width="2465" height="471" key="GridCell.Tab.0.bottom/67.34.2493.1406@67.34.2493.1406" timestamp="1575891470097" />
<state width="2465" height="471" key="GridCell.Tab.0.center" timestamp="1575891470096">
<screen x="67" y="34" width="2493" height="1406" />
</state>
<state width="2465" height="471" key="GridCell.Tab.0.center/67.34.2493.1406@67.34.2493.1406" timestamp="1575891470096" />
<state width="2465" height="471" key="GridCell.Tab.0.left" timestamp="1575891470096">
<screen x="67" y="34" width="2493" height="1406" />
</state>
<state width="2465" height="471" key="GridCell.Tab.0.left/67.34.2493.1406@67.34.2493.1406" timestamp="1575891470096" />
<state width="2465" height="471" key="GridCell.Tab.0.right" timestamp="1575891470096">
<screen x="67" y="34" width="2493" height="1406" />
</state>
<state width="2465" height="471" key="GridCell.Tab.0.right/67.34.2493.1406@67.34.2493.1406" timestamp="1575891470096" />
<state width="2465" height="471" key="GridCell.Tab.1.bottom" timestamp="1575891470098">
<screen x="67" y="34" width="2493" height="1406" />
</state>
<state width="2465" height="471" key="GridCell.Tab.1.bottom/67.34.2493.1406@67.34.2493.1406" timestamp="1575891470098" />
<state width="2465" height="471" key="GridCell.Tab.1.center" timestamp="1575891470097">
<screen x="67" y="34" width="2493" height="1406" />
</state>
<state width="2465" height="471" key="GridCell.Tab.1.center/67.34.2493.1406@67.34.2493.1406" timestamp="1575891470097" />
<state width="2465" height="471" key="GridCell.Tab.1.left" timestamp="1575891470097">
<screen x="67" y="34" width="2493" height="1406" />
</state>
<state width="2465" height="471" key="GridCell.Tab.1.left/67.34.2493.1406@67.34.2493.1406" timestamp="1575891470097" />
<state width="2465" height="471" key="GridCell.Tab.1.right" timestamp="1575891470097">
<screen x="67" y="34" width="2493" height="1406" />
</state>
<state width="2465" height="471" key="GridCell.Tab.1.right/67.34.2493.1406@67.34.2493.1406" timestamp="1575891470097" />
<state x="679" y="283" key="SettingsEditor" timestamp="1575885393075">
<screen x="67" y="34" width="2493" height="1406" />
</state>
<state x="679" y="283" key="SettingsEditor/67.34.2493.1406@67.34.2493.1406" timestamp="1575885393075" />
<state x="893" y="526" key="com.intellij.ide.util.TipDialog" timestamp="1575885327988">
<screen x="67" y="34" width="2493" height="1406" />
</state>
<state x="893" y="526" key="com.intellij.ide.util.TipDialog/67.34.2493.1406@67.34.2493.1406" timestamp="1575885327988" />
</component>
<component name="XDebuggerManager">
<breakpoint-manager>
<breakpoints>
<line-breakpoint enabled="true" suspend="THREAD" type="python-line">
<url>file://$PROJECT_DIR$/planner/planner.py</url>
<line>71</line>
<line>72</line>
<option name="timeStamp" value="8" />
</line-breakpoint>
<line-breakpoint enabled="true" suspend="THREAD" type="python-line">
<url>file://$PROJECT_DIR$/planner/planner.py</url>
<line>66</line>
<line>67</line>
<option name="timeStamp" value="9" />
</line-breakpoint>
<line-breakpoint enabled="true" suspend="THREAD" type="python-line">
......@@ -248,11 +305,6 @@
<line>22</line>
<option name="timeStamp" value="21" />
</line-breakpoint>
<line-breakpoint enabled="true" suspend="THREAD" type="python-line">
<url>file://$PROJECT_DIR$/__main__.py</url>
<line>102</line>
<option name="timeStamp" value="22" />
</line-breakpoint>
</breakpoints>
</breakpoint-manager>
</component>
......
......@@ -3,6 +3,7 @@ from toscaparser.nodetemplate import NodeTemplate
from toscaparser.tosca_template import ToscaTemplate
from toscaparser.topology_template import TopologyTemplate
import operator
# import matplotlib.pyplot as plt
......@@ -12,7 +13,7 @@ from util import tosca_helper
class Planner:
def __init__(self, tosca_path=None, yaml_dict_tpl=None, spec_service=spec_service):
def __init__(self, tosca_path=None, yaml_dict_tpl=None, spec_service=None):
if tosca_path:
self.path = tosca_path
self.tosca_template = ToscaTemplate(tosca_path)
......
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