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; }
/** * Uses HttpUnit functionality to retreive a singe sds jnlp from the sds. * * @param sdsJnlpId The id of the jnlp you want to retrieve * @return The SdsJnlp with name, url and id set * @throws IOException * @throws JDOMException * @throws SAXException */ protected SdsJnlp getJnlpInSds(Long sdsJnlpId) throws IOException, JDOMException, SAXException { WebResponse webResponse = this.makeHttpRestGetRequest("/jnlp/" + sdsJnlpId); assertEquals(HttpStatus.SC_OK, webResponse.getResponseCode()); Document doc = createDocumentFromResponse(webResponse); SdsJnlp sdsJnlp = (SdsJnlp) this.applicationContext.getBean("sdsJnlp"); Element jnlpElement = doc.getRootElement(); sdsJnlp.setName(jnlpElement.getChild("name").getValue()); sdsJnlp.setUrl(jnlpElement.getChild("url").getValue()); sdsJnlp.setSdsObjectId(new Long(jnlpElement.getChild("id").getValue())); return sdsJnlp; }
/** @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; }