use of org.geotoolkit.csw.xml.v202.TransactionSummaryType in project geo-platform by geosdi.
the class WFSTransactionInsertTest method tasmaniaRoads.
@Test
@Ignore(value = "To Enable this test there will be a Geoserver local to run.")
public void tasmaniaRoads() throws Exception {
WFSTransactionRequest<TransactionResponseType> request = serverConnector.createTransactionRequest();
request.setOperation(INSERT);
request.setTypeName(TASMANIA_ROADS);
AttributeDTO att = new AttributeDTO();
att.setName("TYPE");
att.setValue("ecco");
GeometryAttributeDTO geometry = new GeometryAttributeDTO();
geometry.setName("the_geom");
geometry.setSrid(valueOf(4326));
geometry.setValue("MULTILINESTRING ((10 10, 20 20, 10 40), (40 40, 30 30, 40 20, 30 10))");
request.setAttributes(Arrays.asList(att, geometry));
logger.info("***************** Request TRANSACTION INSERT ******\n{}\n\n", request.showRequestAsString());
TransactionResponseType response = request.getResponse();
logger.info("\n*** {}", response.getTransactionResults());
TransactionSummaryType transactionSummary = response.getTransactionSummary();
assertEquals(0, transactionSummary.getTotalDeleted().intValue());
assertEquals(0, transactionSummary.getTotalUpdated().intValue());
assertEquals(1, transactionSummary.getTotalInserted().intValue());
assertEquals("1.1.0", response.getVersion());
logger.info("@@@@@@@@@@@@@@@@@@@@@@InsertResults {}", response.getInsertResults());
List<LayerSchemaDTO> schemas = featureReaderXSD.read(new URL(wfsURL + "?service=wfs" + "&version=1.1.0" + "&request=DescribeFeatureType" + "&typeName=topp:tasmania_roads").openStream());
assertNotNull(schemas);
assertEquals(1, schemas.size());
LayerSchemaDTO layerSchema = schemas.get(0);
logger.info("###############################Layer Schema : {}", layerSchema);
QName name = new QName("topp:tasmania_roads");
WFSGetFeatureRequest getRequest = serverConnector.createGetFeatureRequest();
getRequest.setTypeName(name);
getRequest.setResultType(ResultTypeType.RESULTS.value());
InputStream is = getRequest.getResponseAsStream();
WFSGetFeatureStaxReader featureReaderStAX = new WFSGetFeatureStaxReader(layerSchema);
FeatureCollectionDTO featureCollection = featureReaderStAX.read(is);
logger.info("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ {}", featureCollection);
}
Aggregations