StartRequest extends LifeCycleRequest implements Serializable { public void setContentURL(final ContentURLType value) { contentURL = value; }  @XmlElement(name = "ContentURL", namespace = "http://www.w3.org/2008/04/mmi-arch") ContentURLType getContentURL(); void setContentURL(final ContentURLType value); void setContentURL(final String value); void setContentURL(final URL value); void setContentURL(final URI value); @XmlElement(name = "Content", namespace = "http://www.w3.org/2008/04/mmi-arch") AnyComplexType getContent(); void setContent(final AnyComplexType value);  }
@Test public void testStartRequest() throws Exception { final Mmi mmi = new Mmi(); final StartRequest request = new StartRequest(); mmi.setStartRequest(request); request.setRequestId("request1"); request.setSource("source1"); request.setTarget("target1"); request.setContext("context1"); final ContentURLType url = new ContentURLType(); url.setHref("http: request.setContentURL(url); final JAXBContext ctx = JAXBContext.newInstance(Mmi.class); final Marshaller marshaller = ctx.createMarshaller(); marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); final ByteArrayOutputStream out = new ByteArrayOutputStream(); marshaller.marshal(mmi, out); System.out.println("1*" + out); final Unmarshaller unmarshaller = ctx.createUnmarshaller(); final ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray()); final Object o = unmarshaller.unmarshal(in); System.out.println("2*" + o); }
@Test public void testReadFromFile() throws Exception { final Mmi mmi = new Mmi(); final StartRequest request = new StartRequest(); mmi.setStartRequest(request); request.setRequestId("request1"); request.setSource("source1"); request.setTarget("target1"); request.setContext("context1"); final ContentURLType url = new ContentURLType(); url.setHref("http: request.setContentURL(url); final JAXBContext ctx = JAXBContext.newInstance(Mmi.class); final Marshaller marshaller = ctx.createMarshaller(); final FileOutputStream out = new FileOutputStream("testrequest.xml"); marshaller.marshal(mmi, out); out.close(); final FileInputStream in = new FileInputStream("testrequest.xml"); final Unmarshaller unmarshaller = ctx.createUnmarshaller(); final Object o = unmarshaller.unmarshal(in); System.out.println(o); }