Package org.geoserver.wfs.notification

Examples of org.geoserver.wfs.notification.GMLNotificationSerializer


        testData.setUpVectorLayer(QN_BOARD, Collections.EMPTY_MAP, getClass());
    }

    @Test
    public void testDelete() throws Exception {
        GMLNotificationSerializer cb = (GMLNotificationSerializer) applicationContext.getBean("publishCallback", GMLNotificationSerializer.class);

        FeatureType sft =
            DataUtilities.createType("urn:c2rpc:test", "TestType", "");

        NamespaceInfo nsi = this.getCatalog().getFactory().createNamespace();
       
        nsi.setURI(sft.getName().getNamespaceURI());
        nsi.setPrefix("c2rpc");
        this.getCatalog().add(nsi);
       
        WorkspaceInfo wsi = this.getCatalog().getFactory().createWorkspace();
        wsi.setName("c2rpc");
        this.getCatalog().add(wsi);
       
        SimpleFeatureBuilder builder =
            new SimpleFeatureBuilder((SimpleFeatureType) sft);
        Feature feature = builder.buildFeature("feature-1");
        QName typeName =
            new QName(sft.getName().getNamespaceURI(), sft.getName()
                .getLocalPart(), "c2rpc");

        String xml = cb.getDeleteRawMessage(typeName, feature.getIdentifier());
        TransformerFactory tf = TransformerFactory.newInstance();
        DOMResult result = new DOMResult();
        tf.newTransformer().transform(new StreamSource(new StringReader(xml)),
            result);
        Document doc = result.getNode().getOwnerDocument();
        if(doc == null) doc = (Document) result.getNode();
        Element docElt = doc.getDocumentElement();
        assertEquals("http://www.opengis.net/wfs", docElt.getNamespaceURI());
        assertEquals("Delete", docElt.getLocalName());
        assertNotNull(docElt.getAttribute("typeName"));
        assertEquals("c2rpc:TestType", docElt.getAttribute("typeName"));
        Node text = docElt.getFirstChild();
        assertNotNull(text);
        assertEquals(Node.TEXT_NODE, text.getNodeType());
        assertEquals(feature.getIdentifier().getID(), text.getTextContent()
            .trim());
        cb.serializeDelete(feature.getType().getName(), feature.getIdentifier());
    }
View Full Code Here

TOP

Related Classes of org.geoserver.wfs.notification.GMLNotificationSerializer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.