@Test public void xmlDeploymentToObjectTest() { String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "<deployment xmlns=\"http: + "<id>101</id>" + "<status>RUNNING</status>" + "<price>222</price>" + "<vms>" + "<vm href=\"/applications/101/deployments/22/vms/33\">" + "<id>33</id>" + "<ovf-id>101</ovf-id>" + "<provider-vm-id>vm-id</provider-vm-id>" + "<provider-id>222</provider-id>" + "<sla-aggrement-id>sla</sla-aggrement-id>" + "<ip>127.0.0.1</ip>" + "<link rel=\"deployment\" href=\"/applications/101/deployments/22\" type=\"application/xml\" />" + "<link rel=\"self\" href=\"/applications/101/deployments/22/vms/33\" type=\"application/xml\" />" + "</vm>" + "<vm href=\"/applications/101/deployments/22/vms/34\">" + "<id>34</id>" + "<ovf-id>101</ovf-id>" + "<provider-vm-id>vm-id</provider-vm-id>" + "<provider-id>222</provider-id>" + "<sla-aggrement-id>sla</sla-aggrement-id>" + "<ip>127.0.0.1</ip>" + "<link rel=\"deployment\" href=\"/applications/101/deployments/22\" type=\"application/xml\" />" + "<link rel=\"self\" href=\"/applications/101/deployments/22/vms/33\" type=\"application/xml\" />" + "</vm>" + "</vms>" + "<link rel=\"application\" href=\"/applications/101\" type=\"application/xml\" />" + "<link rel=\"self\" href=\"/applications/101/deployments/22\" type=\"application/xml\" />" + "</deployment>"; Deployment deployment = ModelConverter.xmlDeploymentToObject(xml); assertEquals("/applications/101/deployments/22", deployment.getHref()); assertEquals(101, deployment.getId()); assertEquals("RUNNING", deployment.getStatus()); assertEquals(2, deployment.getLinks().size()); assertEquals("application", deployment.getLinks().get(0).getRel()); assertEquals("/applications/101", deployment.getLinks().get(0).getHref()); assertEquals("application/xml", deployment.getLinks().get(0).getType()); assertEquals("self", deployment.getLinks().get(1).getRel()); assertEquals("/applications/101/deployments/22", deployment.getLinks().get(1).getHref()); assertEquals("application/xml", deployment.getLinks().get(1).getType()); assertEquals(2, deployment.getVms().size()); assertEquals(33, deployment.getVms().get(0).getId()); assertEquals(34, deployment.getVms().get(1).getId()); }
public static Deployment xmlDeploymentToObject(String xml) { return toObject(Deployment.class, xml); }
ModelConverter { public static Deployment xmlDeploymentToObject(String xml) { return toObject(Deployment.class, xml); } }
ModelConverter { public static Deployment xmlDeploymentToObject(String xml) { return toObject(Deployment.class, xml); }  }
ModelConverter { public static Deployment xmlDeploymentToObject(String xml) { return toObject(Deployment.class, xml); }  static String objectCollectionToXML(Collection collection); static String objectCollectionToJSON(Collection collection); static Collection xmlCollectionToObject(String xml); static Collection jsonCollectionToObject(String xml); static String objectSLAApplicationTermToXML(SLAApplicationTerms slaAppTerms); static String objectSLAApplicationTermToJSON(SLAApplicationTerms slaAppTerms); static SLAApplicationTerms xmlSLAApplicationTermsToObject(String xml); static SLAApplicationTerms jsonSLAApplicationTermsToObject(String jsonString); static String objectApplicationToXML(Application application); static String objectApplicationToJSON(Application application); static Application xmlApplicationToObject(String xml); static Application jsonApplicationToObject(String jsonString); static String slaLitmitsToXML(SLALimits slaLimits); static SLALimits xmlSLALimitsToObject(String xml); static String objectRootToXML(Root root); static String applicationManagerMessageToJSON(ApplicationManagerMessage amMessage); static ApplicationManagerMessage jsonToApplicationManagerMessage(String json); static Deployment xmlDeploymentToObject(String xml); static Deployment jsonDeploymentToObject(String json); static String objectDeploymentToJSON(Deployment deployment); static String objectDeploymentToXML(Deployment deployment); static VM xmlVMToObject(String xml); static String objectVMToXML(VM vm); static Agreement xmlAgreementToObject(String xml); static String objectAgreementToXML(Agreement agreement); static String objectEnergyMeasurementToXML(EnergyMeasurement energyMeasurement); static String objectEnergyMeasurementToJSON(EnergyMeasurement energyMeasurement); static EnergyMeasurement xmlEnergyMeasurementToObject(String xml); static String objectPowerMeasurementToXML(PowerMeasurement powerMeasurement); static String objectPowerMeasurementToJSON(PowerMeasurement powerMeasurement); static PowerMeasurement xmlPowerMeasurementToObject(String xml); static String objectCostToXML(Cost cost); static String objectCostToJSON(Cost cost); static Cost xmlCostToObject(String xml); }
ModelConverter { public static Deployment xmlDeploymentToObject(String xml) { return toObject(Deployment.class, xml); }  static String objectCollectionToXML(Collection collection); static String objectCollectionToJSON(Collection collection); static Collection xmlCollectionToObject(String xml); static Collection jsonCollectionToObject(String xml); static String objectSLAApplicationTermToXML(SLAApplicationTerms slaAppTerms); static String objectSLAApplicationTermToJSON(SLAApplicationTerms slaAppTerms); static SLAApplicationTerms xmlSLAApplicationTermsToObject(String xml); static SLAApplicationTerms jsonSLAApplicationTermsToObject(String jsonString); static String objectApplicationToXML(Application application); static String objectApplicationToJSON(Application application); static Application xmlApplicationToObject(String xml); static Application jsonApplicationToObject(String jsonString); static String slaLitmitsToXML(SLALimits slaLimits); static SLALimits xmlSLALimitsToObject(String xml); static String objectRootToXML(Root root); static String applicationManagerMessageToJSON(ApplicationManagerMessage amMessage); static ApplicationManagerMessage jsonToApplicationManagerMessage(String json); static Deployment xmlDeploymentToObject(String xml); static Deployment jsonDeploymentToObject(String json); static String objectDeploymentToJSON(Deployment deployment); static String objectDeploymentToXML(Deployment deployment); static VM xmlVMToObject(String xml); static String objectVMToXML(VM vm); static Agreement xmlAgreementToObject(String xml); static String objectAgreementToXML(Agreement agreement); static String objectEnergyMeasurementToXML(EnergyMeasurement energyMeasurement); static String objectEnergyMeasurementToJSON(EnergyMeasurement energyMeasurement); static EnergyMeasurement xmlEnergyMeasurementToObject(String xml); static String objectPowerMeasurementToXML(PowerMeasurement powerMeasurement); static String objectPowerMeasurementToJSON(PowerMeasurement powerMeasurement); static PowerMeasurement xmlPowerMeasurementToObject(String xml); static String objectCostToXML(Cost cost); static String objectCostToJSON(Cost cost); static Cost xmlCostToObject(String xml);  }