@Test public void xmlVMToObjectTest() { String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "<vm xmlns=\"http: + "<id>33</id>" + "<ovf-id>101</ovf-id>" + "<provider-vm-id>vm-id</provider-vm-id>" + "<provider-id>222</provider-id>" + "<sla-agreement>sla</sla-agreement>" + "<status>XXX</status>" + "<ip>127.0.0.1</ip>" + "<images>" + "<image href=\"hrefImage2\">" + "<id>111</id>" + "<ovf-id>333</ovf-id>" + "<provider-image-id>444</provider-image-id>" + "</image>" + "</images>" + "<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 vm = ModelConverter.xmlVMToObject(xml); assertEquals("/applications/101/deployments/22/vms/33", vm.getHref()); assertEquals(33, vm.getId()); assertEquals("101", vm.getOvfId()); assertEquals("vm-id", vm.getProviderVmId()); assertEquals("222", vm.getProviderId()); assertEquals("sla", vm.getSlaAgreement()); assertEquals("XXX", vm.getStatus()); assertEquals(1, vm.getImages().size()); assertEquals("hrefImage2", vm.getImages().get(0).getHref()); assertEquals(111, vm.getImages().get(0).getId()); assertEquals("333", vm.getImages().get(0).getOvfId()); assertEquals("444", vm.getImages().get(0).getProviderImageId()); assertEquals(2, vm.getLinks().size()); assertEquals("deployment", vm.getLinks().get(0).getRel()); assertEquals("/applications/101/deployments/22", vm.getLinks().get(0).getHref()); assertEquals("application/xml", vm.getLinks().get(0).getType()); assertEquals("self", vm.getLinks().get(1).getRel()); assertEquals("/applications/101/deployments/22/vms/33", vm.getLinks().get(1).getHref()); assertEquals("application/xml", vm.getLinks().get(1).getType()); }
public static VM xmlVMToObject(String xml) { return toObject(VM.class, xml); }
ModelConverter { public static VM xmlVMToObject(String xml) { return toObject(VM.class, xml); } }
ModelConverter { public static VM xmlVMToObject(String xml) { return toObject(VM.class, xml); }  }
ModelConverter { public static VM xmlVMToObject(String xml) { return toObject(VM.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 VM xmlVMToObject(String xml) { return toObject(VM.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);  }