@Test public void xmlCollectionToObjectTest() { String collectionXML = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "<collection xmlns=\"http: + "<items offset=\"0\" total=\"2\">" + "<application href=\"/101\">" + "<id>101</id>" + "<state>STATE1</state>" + "<link rel=\"parent\" href=\"/\" type=\"application/xml\" />" + "<link rel=\"self\" href=\"/101\" type=\"application/xml\" />" + "</application>" + "<application href=\"/102\">" + "<id>102</id>" + "<state>STATE2</state>" + "<link rel=\"parent\" href=\"/\" type=\"application/xml\" />" + "<link rel=\"self\" href=\"/102\" type=\"application/xml\" />" + "</application>" + "<deployment href=\"yyy\">" + "</deployment>" + "<vm href=\"xxx\">" + "</vm>" + "<agreement href=\"zzz\" />" + "</items>" + "<link href=\"/\" rel=\"self\" type=\"application/xml\"/>" + "</collection>"; Collection collection = ModelConverter.xmlCollectionToObject(collectionXML); assertEquals(2, collection.getItems().getApplications().size()); assertEquals(102, collection.getItems().getApplications().get(1).getId()); assertEquals(2, collection.getItems().getTotal()); assertEquals("application/xml", collection.getLinks().get(0).getType()); assertEquals(1, collection.getItems().getDeployments().size()); assertEquals("yyy", collection.getItems().getDeployments().get(0).getHref()); assertEquals(1, collection.getItems().getVms().size()); assertEquals("xxx", collection.getItems().getVms().get(0).getHref()); assertEquals(1, collection.getItems().getAgreements().size()); assertEquals("zzz", collection.getItems().getAgreements().get(0).getHref()); }
public static Collection xmlCollectionToObject(String xml) { return toObject(Collection.class, xml); }
ModelConverter { public static Collection xmlCollectionToObject(String xml) { return toObject(Collection.class, xml); } }
ModelConverter { public static Collection xmlCollectionToObject(String xml) { return toObject(Collection.class, xml); }  }
ModelConverter { public static Collection xmlCollectionToObject(String xml) { return toObject(Collection.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 Collection xmlCollectionToObject(String xml) { return toObject(Collection.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);  }