public void testEncode() throws Exception { Ows10Factory f = Ows10Factory.eINSTANCE; GetCapabilitiesType caps = f.createGetCapabilitiesType(); AcceptVersionsType versions = f.createAcceptVersionsType(); caps.setAcceptVersions(versions); versions.getVersion().add("1.0.0"); versions.getVersion().add("1.1.0"); ByteArrayOutputStream output = new ByteArrayOutputStream(); response.write(caps, output, null); Document d = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument(); TransformerFactory.newInstance() .newTransformer() .transform( new StreamSource(new ByteArrayInputStream(output.toByteArray())), new DOMResult(d)); assertEquals("ows:GetCapabilities", d.getDocumentElement().getNodeName()); assertEquals(2, d.getElementsByTagName("ows:Version").getLength()); } }
/** * * <!-- begin-user-doc --> * * @param value an instance of {@link GetCapabilitiesType} (possibly a subclass) if a binding * for a specific service's GetCapabilities request used {@link Binding#BEFORE} {@link * #getExecutionMode() execution mode}, and thus relies on this binding to fill the common * properties. <code>null</code> otherwise. * <!-- end-user-doc --> * @generated modifiable */ public Object parse(ElementInstance instance, Node node, Object value) throws Exception { GetCapabilitiesType getCapabilities; if ((value != null) && value instanceof GetCapabilitiesType) { getCapabilities = (GetCapabilitiesType) value; } else { getCapabilities = owsfactory.createGetCapabilitiesType(); } getCapabilities.setAcceptVersions( (AcceptVersionsType) node.getChildValue(AcceptVersionsType.class)); getCapabilities.setSections((SectionsType) node.getChildValue(SectionsType.class)); getCapabilities.setAcceptFormats( (AcceptFormatsType) node.getChildValue(AcceptFormatsType.class)); getCapabilities.setUpdateSequence((String) node.getAttributeValue("updateSequence")); return getCapabilities; } }