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

remove test and adapt for TOSCA

parent 4b613bd4
......@@ -25,12 +25,12 @@ import org.json.JSONException;
public class P2PConverter {
public static SimplePlanContainer transfer(String toscaPlan,
public static SimplePlanContainer transfer( Map<String, Object> toscaPlanMap,
String userName, String domainName, String cloudProvider) throws JsonParseException, JsonMappingException, IOException, JSONException {
if (cloudProvider != null) {
cloudProvider = cloudProvider.toUpperCase();
}
Map<String, Object> toscaPlanMap = Converter.ymlString2Map(toscaPlan);
Map<String, Object> topologyTemplate = (Map<String, Object>) ((Map<String, Object>) toscaPlanMap.get("topology_template")).get("node_templates");
//Get the domain provider and vm list
......
package nl.uva.sne.drip.drip.converter;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.JsonMappingException;
import java.io.File;
import java.io.IOException;
import java.util.Map;
import org.apache.commons.io.FileUtils;
import org.json.JSONException;
public class testConverter {
public static void main(String[] args) throws JsonParseException, JsonMappingException, JSONException {
File jsonFile = new File("input.json");
String json = "";
try {
json = FileUtils.readFileToString(jsonFile, "UTF-8");
} catch (IOException e1) {
e1.printStackTrace();
}
try {
SimplePlanContainer spc = P2PConverter.transfer(json, "zh9314", "Virginia", "EC2");
System.out.println("--topLevel:\n" + spc.topLevelContents);
System.out.println("--lowLevel:");
for (Map.Entry<String, String> entry : spc.lowerLevelContents.entrySet()) {
System.out.println(entry.getKey() + ":\n" + entry.getValue());
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
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