Commit 534906e7 authored by Spiros Koulouzis's avatar Spiros Koulouzis

Make sure we don't have '/' on the end of url

parent 500b0688
...@@ -86,7 +86,7 @@ public class ApiClient { ...@@ -86,7 +86,7 @@ public class ApiClient {
setUserAgent("Swagger-Codegen/1.0.0/java"); setUserAgent("Swagger-Codegen/1.0.0/java");
// Setup authentications (key: authentication name, value: authentication). // Setup authentications (key: authentication name, value: authentication).
authentications = new HashMap<String, Authentication>(); authentications = new HashMap<>();
// Prevent the authentications from being modified. // Prevent the authentications from being modified.
authentications = Collections.unmodifiableMap(authentications); authentications = Collections.unmodifiableMap(authentications);
} }
......
/*
* tosca-sure
* TOSCA Simple qUeRy sErvice (SURE).
*
* OpenAPI spec version: 1.0.0
* Contact: S.Koulouzis@uva.nl
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
package nl.uva.sne.drip.sure_tosca.client;
import nl.uva.sne.drip.sure.tosca.client.ApiException;
import org.junit.Test;
import nl.uva.sne.drip.commons.utils.ToscaHelper;
import static org.junit.Assert.assertTrue;
import org.junit.Ignore;
/**
* API tests for DefaultApi
*/
@Ignore
public class DefaultApiTest {
private String serviceBasePath;
private final Boolean serviceUp;
public DefaultApiTest() {
serviceUp = ToscaHelper.isServiceUp(serviceBasePath);
}
// private final DefaultApi api = new DefaultApi();
/**
*
*
* Recursively get all requirements all the way to the ROOT including the
* input node&#39;s
*
* @throws ApiException if the Api call fails
*/
@Test
public void getAllAncestorPropertiesTest() throws ApiException {
String id = "1";
String nodeName = null;
assertTrue(true);
// List<Map<String, Object>> response = api.getAllAncestorProperties(id, nodeName);
// TODO: test validations
}
// /**
// *
// *
// * Recursively get all requirements all the way to the ROOT including the
// * input node&#39;s
// *
// * @throws ApiException if the Api call fails
// */
// @Test
// public void getAllAncestorTypesTest() throws ApiException {
// String id = null;
// String nodeName = null;
//// List<String> response = api.getAllAncestorTypes(id, nodeName);
//
// // TODO: test validations
// }
//
// /**
// *
// *
// * Recursively get all requirements all the way to the ROOT including the
// * input node&#39;s
// *
// * @throws ApiException if the Api call fails
// */
// @Test
// public void getAncestorsRequirementsTest() throws ApiException {
// String id = null;
// String nodeName = null;
//// Map<String, Object> response = api.getAncestorsRequirements(id, nodeName);
//
// // TODO: test validations
// }
//
// /**
// *
// *
// * returns the interface types
// *
// * @throws ApiException if the Api call fails
// */
// @Test
// public void getDslDefinitionsTest() throws ApiException {
// String id = null;
// List<String> anchors = null;
// String derivedFrom = null;
//// List<Map<String, Object>> response = api.getDslDefinitions(id, anchors, derivedFrom);
//
// // TODO: test validations
// }
//
// /**
// *
// *
// * returns the interface types
// *
// * @throws ApiException if the Api call fails
// */
// @Test
// public void getImportsTest() throws ApiException {
// String id = null;
//// List<Map<String, Object>> response = api.getImports(id);
//
// // TODO: test validations
// }
//
// /**
// *
// *
// * s
// *
// * @throws ApiException if the Api call fails
// */
// @Test
// public void getNodeOutputsTest() throws ApiException {
// String id = null;
// String nodeName = null;
//// List<Map<String, Object>> response = api.getNodeOutputs(id, nodeName);
//
// // TODO: test validations
// }
//
// /**
// *
// *
// * s
// *
// * @throws ApiException if the Api call fails
// */
// @Test
// public void getNodePropertiesTest() throws ApiException {
// String id = null;
// String nodeName = null;
//// Map<String, Object> response = api.getNodeProperties(id, nodeName);
//
// // TODO: test validations
// }
//
// /**
// *
// *
// * Returns the requirements for an input node as described in the template
// * not in the node&#39;s definition
// *
// * @throws ApiException if the Api call fails
// */
// @Test
// public void getNodeRequirementsTest() throws ApiException {
// String id = null;
// String nodeName = null;
//// Map<String, Object> response = api.getNodeRequirements(id, nodeName);
//
// // TODO: test validations
// }
//
// /**
// *
// *
// * returns nodes templates in topology
// *
// * @throws ApiException if the Api call fails
// */
// @Test
// public void getNodeTemplatesTest() throws ApiException {
// String id = null;
// String typeName = null;
// String nodeName = null;
// Boolean hasInterfaces = null;
// Boolean hasProperties = null;
// Boolean hasAttributes = null;
// Boolean hasRequirements = null;
// Boolean hasCapabilities = null;
// Boolean hasArtifacts = null;
//// List<NodeTemplate> response = api.getNodeTemplates(id, typeName, nodeName, hasInterfaces, hasProperties, hasAttributes, hasRequirements, hasCapabilities, hasArtifacts);
//
// // TODO: test validations
// }
//
// /**
// *
// *
// *
// *
// * @throws ApiException if the Api call fails
// */
// @Test
// public void getNodeTypeNameTest() throws ApiException {
// String id = null;
// String nodeName = null;
//// String response = api.getNodeTypeName(id, nodeName);
//
// // TODO: test validations
// }
//
// /**
// *
// *
// *
// *
// * @throws ApiException if the Api call fails
// */
// @Test
// public void getParentTypeNameTest() throws ApiException {
// String id = null;
// String nodeName = null;
//// String response = api.getParentTypeName(id, nodeName);
//
// // TODO: test validations
// }
//
// /**
// *
// *
// * s
// *
// * @throws ApiException if the Api call fails
// */
// @Test
// public void getRelatedNodesTest() throws ApiException {
// String id = null;
// String nodeName = null;
//// List<NodeTemplate> response = api.getRelatedNodes(id, nodeName);
//
// // TODO: test validations
// }
//
// /**
// *
// *
// * returns the interface types
// *
// * @throws ApiException if the Api call fails
// */
// @Test
// public void getRelationshipTemplatesTest() throws ApiException {
// String id = null;
// String typeName = null;
// String derivedFrom = null;
//// List<Map<String, Object>> response = api.getRelationshipTemplates(id, typeName, derivedFrom);
//
// // TODO: test validations
// }
//
// /**
// *
// *
// * r
// *
// * @throws ApiException if the Api call fails
// */
// @Test
// public void getTopologyTemplateTest() throws ApiException {
// String id = null;
//// TopologyTemplate response = api.getTopologyTemplate(id);
//
// // TODO: test validations
// }
//
// /**
// *
// *
// *
// *
// * @throws ApiException if the Api call fails
// */
// @Test
// public void getToscaTemplateTest() throws ApiException {
// String id = null;
//// ToscaTemplate response = api.getToscaTemplate(id);
//
// // TODO: test validations
// }
//
// /**
// *
// *
// * returns the interface types
// *
// * @throws ApiException if the Api call fails
// */
// @Test
// public void getTypesTest() throws ApiException {
// String id = null;
// String kindOfType = null;
// Boolean hasInterfaces = null;
// String typeName = null;
// Boolean hasProperties = null;
// Boolean hasAttributes = null;
// Boolean hasRequirements = null;
// Boolean hasCapabilities = null;
// Boolean hasArtifacts = null;
// String derivedFrom = null;
//// List<Map<String, Object>> response = api.getTypes(id, kindOfType, hasInterfaces, typeName, hasProperties, hasAttributes, hasRequirements, hasCapabilities, hasArtifacts, derivedFrom);
//
// // TODO: test validations
// }
//
// /**
// *
// *
// * s
// *
// * @throws ApiException if the Api call fails
// */
// @Test
// public void setNodePropertiesTest() throws ApiException {
// String id = null;
// Object properties = null;
// String nodeName = null;
//// String response = api.setNodeProperties(id, properties, nodeName);
//
// // TODO: test validations
// }
//
// /**
// * upload a tosca template description file
// *
// * upload and validate a tosca template description file
// *
// * @throws ApiException if the Api call fails
// */
// @Test
// public void uploadToscaTemplateTest() throws ApiException {
// File file = null;
//// String response = api.uploadToscaTemplate(file);
//
// // TODO: test validations
// }
}
...@@ -51,9 +51,10 @@ class TestDeployer(unittest.TestCase): ...@@ -51,9 +51,10 @@ class TestDeployer(unittest.TestCase):
tosca_client = self.init_sure_tosca_client('http://localhost:8081/tosca-sure/1.0.0/') tosca_client = self.init_sure_tosca_client('http://localhost:8081/tosca-sure/1.0.0/')
self.upload_tosca_template('application_example_provisioned.yaml',tosca_client) doc_id = self.upload_tosca_template(tosca_template_path,tosca_client)
self.assertIsNotNone(doc_id)
# tosca_interfaces = tosca.get_interfaces(tosca_template_dict) tosca_interfaces = tosca_client.get_tosca_template(doc_id).get
# tmp_path = tempfile.mkdtemp() # tmp_path = tempfile.mkdtemp()
# vms = tosca.get_vms(tosca_template_dict) # vms = tosca.get_vms(tosca_template_dict)
# inventory_path = ansible_service.write_inventory_file(tmp_path, vms) # inventory_path = ansible_service.write_inventory_file(tmp_path, vms)
...@@ -88,9 +89,8 @@ class TestDeployer(unittest.TestCase): ...@@ -88,9 +89,8 @@ class TestDeployer(unittest.TestCase):
# print(json.dumps(response)) # print(json.dumps(response))
def upload_tosca_template(self, file_name,api): def upload_tosca_template(self, file_path,api):
file = self.get_tosca_file(file_name) file_id = api.upload_tosca_template(file_path)
file_id = api.upload_tosca_template(file)
return file_id return file_id
...@@ -108,7 +108,7 @@ class TestDeployer(unittest.TestCase): ...@@ -108,7 +108,7 @@ class TestDeployer(unittest.TestCase):
def init_sure_tosca_client(self,sure_tosca_base_path): def init_sure_tosca_client(self,sure_tosca_base_path):
configuration = Configuration() configuration = Configuration()
configuration.host = "http://localhost:8081/tosca-sure/1.0.0/" configuration.host = sure_tosca_base_path
api_client = ApiClient(configuration=configuration) api_client = ApiClient(configuration=configuration)
api = default_api.DefaultApi(api_client=api_client) # noqa: E501 api = default_api.DefaultApi(api_client=api_client) # noqa: E501
return api return api
......
...@@ -2,9 +2,11 @@ ...@@ -2,9 +2,11 @@
<project version="4"> <project version="4">
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="3f84153d-6ed1-4691-94d6-53105266f15e" name="Default Changelist" comment=""> <list default="true" id="3f84153d-6ed1-4691-94d6-53105266f15e" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/../commons/src/main/java/nl/uva/sne/drip/sure/tosca/client/ApiClient.java" beforeDir="false" afterPath="$PROJECT_DIR$/../commons/src/main/java/nl/uva/sne/drip/sure/tosca/client/ApiClient.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../commons/src/test/java/nl/uva/sne/drip/sure_tosca/client/DefaultApiTest.java" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/../deployer/test/test_deployer.py" beforeDir="false" afterPath="$PROJECT_DIR$/../deployer/test/test_deployer.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/../deployer/test/test_deployer.py" beforeDir="false" afterPath="$PROJECT_DIR$/../deployer/test/test_deployer.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../docker-compose.yml" beforeDir="false" afterPath="$PROJECT_DIR$/../docker-compose.yml" 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$/test/test_default_api.py" beforeDir="false" afterPath="$PROJECT_DIR$/test/test_default_api.py" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
...@@ -65,38 +67,38 @@ ...@@ -65,38 +67,38 @@
<screen x="67" y="34" width="1853" height="1046" /> <screen x="67" y="34" width="1853" height="1046" />
</state> </state>
<state x="723" y="257" width="530" height="598" key="FileChooserDialogImpl/67.34.1853.1046@67.34.1853.1046" timestamp="1584814061190" /> <state x="723" y="257" width="530" height="598" key="FileChooserDialogImpl/67.34.1853.1046@67.34.1853.1046" timestamp="1584814061190" />
<state width="1825" height="336" key="GridCell.Tab.0.bottom" timestamp="1585226920216"> <state width="1825" height="307" key="GridCell.Tab.0.bottom" timestamp="1585229908006">
<screen x="67" y="34" width="1853" height="1046" /> <screen x="67" y="34" width="1853" height="1046" />
</state> </state>
<state width="1825" height="336" key="GridCell.Tab.0.bottom/67.34.1853.1046@67.34.1853.1046" timestamp="1585226920216" /> <state width="1825" height="307" key="GridCell.Tab.0.bottom/67.34.1853.1046@67.34.1853.1046" timestamp="1585229908006" />
<state width="1825" height="336" key="GridCell.Tab.0.center" timestamp="1585226920216"> <state width="1825" height="307" key="GridCell.Tab.0.center" timestamp="1585229908006">
<screen x="67" y="34" width="1853" height="1046" /> <screen x="67" y="34" width="1853" height="1046" />
</state> </state>
<state width="1825" height="336" key="GridCell.Tab.0.center/67.34.1853.1046@67.34.1853.1046" timestamp="1585226920216" /> <state width="1825" height="307" key="GridCell.Tab.0.center/67.34.1853.1046@67.34.1853.1046" timestamp="1585229908006" />
<state width="1825" height="336" key="GridCell.Tab.0.left" timestamp="1585226920215"> <state width="1825" height="307" key="GridCell.Tab.0.left" timestamp="1585229908006">
<screen x="67" y="34" width="1853" height="1046" /> <screen x="67" y="34" width="1853" height="1046" />
</state> </state>
<state width="1825" height="336" key="GridCell.Tab.0.left/67.34.1853.1046@67.34.1853.1046" timestamp="1585226920215" /> <state width="1825" height="307" key="GridCell.Tab.0.left/67.34.1853.1046@67.34.1853.1046" timestamp="1585229908006" />
<state width="1825" height="336" key="GridCell.Tab.0.right" timestamp="1585226920216"> <state width="1825" height="307" key="GridCell.Tab.0.right" timestamp="1585229908006">
<screen x="67" y="34" width="1853" height="1046" /> <screen x="67" y="34" width="1853" height="1046" />
</state> </state>
<state width="1825" height="336" key="GridCell.Tab.0.right/67.34.1853.1046@67.34.1853.1046" timestamp="1585226920216" /> <state width="1825" height="307" key="GridCell.Tab.0.right/67.34.1853.1046@67.34.1853.1046" timestamp="1585229908006" />
<state width="1825" height="336" key="GridCell.Tab.1.bottom" timestamp="1584952144349"> <state width="1825" height="166" key="GridCell.Tab.1.bottom" timestamp="1585229893964">
<screen x="67" y="34" width="1853" height="1046" /> <screen x="67" y="34" width="1853" height="1046" />
</state> </state>
<state width="1825" height="336" key="GridCell.Tab.1.bottom/67.34.1853.1046@67.34.1853.1046" timestamp="1584952144349" /> <state width="1825" height="166" key="GridCell.Tab.1.bottom/67.34.1853.1046@67.34.1853.1046" timestamp="1585229893964" />
<state width="1825" height="336" key="GridCell.Tab.1.center" timestamp="1584952144349"> <state width="1825" height="166" key="GridCell.Tab.1.center" timestamp="1585229893964">
<screen x="67" y="34" width="1853" height="1046" /> <screen x="67" y="34" width="1853" height="1046" />
</state> </state>
<state width="1825" height="336" key="GridCell.Tab.1.center/67.34.1853.1046@67.34.1853.1046" timestamp="1584952144349" /> <state width="1825" height="166" key="GridCell.Tab.1.center/67.34.1853.1046@67.34.1853.1046" timestamp="1585229893964" />
<state width="1825" height="336" key="GridCell.Tab.1.left" timestamp="1584952144348"> <state width="1825" height="166" key="GridCell.Tab.1.left" timestamp="1585229893964">
<screen x="67" y="34" width="1853" height="1046" /> <screen x="67" y="34" width="1853" height="1046" />
</state> </state>
<state width="1825" height="336" key="GridCell.Tab.1.left/67.34.1853.1046@67.34.1853.1046" timestamp="1584952144348" /> <state width="1825" height="166" key="GridCell.Tab.1.left/67.34.1853.1046@67.34.1853.1046" timestamp="1585229893964" />
<state width="1825" height="336" key="GridCell.Tab.1.right" timestamp="1584952144349"> <state width="1825" height="166" key="GridCell.Tab.1.right" timestamp="1585229893964">
<screen x="67" y="34" width="1853" height="1046" /> <screen x="67" y="34" width="1853" height="1046" />
</state> </state>
<state width="1825" height="336" key="GridCell.Tab.1.right/67.34.1853.1046@67.34.1853.1046" timestamp="1584952144349" /> <state width="1825" height="166" key="GridCell.Tab.1.right/67.34.1853.1046@67.34.1853.1046" timestamp="1585229893964" />
<state x="359" y="103" key="SettingsEditor" timestamp="1584813615342"> <state x="359" y="103" key="SettingsEditor" timestamp="1584813615342">
<screen x="67" y="34" width="1853" height="1046" /> <screen x="67" y="34" width="1853" height="1046" />
</state> </state>
...@@ -111,8 +113,13 @@ ...@@ -111,8 +113,13 @@
<breakpoints> <breakpoints>
<line-breakpoint enabled="true" suspend="THREAD" type="python-line"> <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
<url>file://$PROJECT_DIR$/test/test_default_api.py</url> <url>file://$PROJECT_DIR$/test/test_default_api.py</url>
<line>159</line> <line>158</line>
<option name="timeStamp" value="2" /> <option name="timeStamp" value="3" />
</line-breakpoint>
<line-breakpoint enabled="true" suspend="THREAD" type="python-line">
<url>file://$PROJECT_DIR$/sure_tosca_client/api_client.py</url>
<line>367</line>
<option name="timeStamp" value="5" />
</line-breakpoint> </line-breakpoint>
</breakpoints> </breakpoints>
</breakpoint-manager> </breakpoint-manager>
......
...@@ -27,7 +27,8 @@ class TestDefaultApi(unittest.TestCase): ...@@ -27,7 +27,8 @@ class TestDefaultApi(unittest.TestCase):
def setUp(self): def setUp(self):
configuration = Configuration() configuration = Configuration()
configuration.host = "http://localhost:8081/tosca-sure/1.0.0/" configuration.host = 'http://localhost:8081/tosca-sure/1.0.0' #Make sure we don't have '/' on the end of url
configuration.verify_ssl = False
api_client = ApiClient(configuration=configuration) api_client = ApiClient(configuration=configuration)
self.api = sure_tosca_client.api.default_api.DefaultApi(api_client=api_client) # noqa: E501 self.api = sure_tosca_client.api.default_api.DefaultApi(api_client=api_client) # noqa: E501
......
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