protected SdsOffering createBogusOffering() throws MalformedURLException, IOException, SAXException, JDOMException { // TODO: LAW update me to work with Stephen's recent changes to jnlp validation // in the sds. The validation checks that the url is well-formed. Then, it retrieves // the xml using the url and check that its xml is well formed. // in the case below, http://www.invalid.com is well formed url, but it // apparently doesn't return a xml that is well-formed SdsOffering sdsOffering = (SdsOffering) this.applicationContext.getBean("sdsOffering"); sdsOffering.setName(DEFAULT_NAME); // create curnit in SDS SdsCurnit sdsCurnit = (SdsCurnit) this.applicationContext.getBean("sdsCurnit"); sdsCurnit.setSdsObjectId(this.createCurnitInSds()); sdsOffering.setSdsCurnit(sdsCurnit); // create invalid jnlp in SDS SdsJnlp sdsJnlp = (SdsJnlp) this.applicationContext.getBean("sdsJnlp"); WebResponse webResponse = this.makeHttpRestPostRequest( "/jnlp", "<jnlp><name>" + "invalid jnlp" + "</name><url>" + "http://www.invalid.com" + "</url></jnlp>"); sdsJnlp.setSdsObjectId(this.extractNewlyCreatedId(webResponse)); sdsOffering.setSdsJnlp(sdsJnlp); // create offering in SDS assertNull(sdsOffering.getSdsObjectId()); sdsOffering.setSdsObjectId( this.createOfferingInSds(sdsCurnit.getSdsObjectId(), sdsJnlp.getSdsObjectId())); assertNotNull(sdsOffering.getSdsObjectId()); return sdsOffering; }
/** @see net.sf.sail.webapp.dao.impl.AbstractDao#save(java.lang.Object) */ public void save(SdsJnlp sdsJnlp) { if (sdsJnlp.getSdsObjectId() == null) { this.createCommand.setSdsJnlp(sdsJnlp); this.createCommand.execute(this.createCommand.generateRequest()); } else { this.updateCommand.setSdsJnlp(sdsJnlp); this.updateCommand.execute(this.updateCommand.generateRequest()); } }
protected SdsOffering createWholeOffering() throws MalformedURLException, IOException, SAXException, JDOMException { SdsOffering sdsOffering = (SdsOffering) this.applicationContext.getBean("sdsOffering"); sdsOffering.setName(DEFAULT_NAME); // create curnit in SDS SdsCurnit sdsCurnit = (SdsCurnit) this.applicationContext.getBean("sdsCurnit"); sdsCurnit.setSdsObjectId(this.createCurnitInSds()); sdsOffering.setSdsCurnit(sdsCurnit); // create jnlp in SDS SdsJnlp sdsJnlp = (SdsJnlp) this.applicationContext.getBean("sdsJnlp"); sdsJnlp.setSdsObjectId(this.createJnlpInSds()); sdsOffering.setSdsJnlp(sdsJnlp); // create offering in SDS assertNull(sdsOffering.getSdsObjectId()); sdsOffering.setSdsObjectId( this.createOfferingInSds(sdsCurnit.getSdsObjectId(), sdsJnlp.getSdsObjectId())); assertNotNull(sdsOffering.getSdsObjectId()); return sdsOffering; }