* @throws ConfigurationException
* @throws IOException
*/
public static Data createTestCiteData(GeoServer geoserver)
throws ConfigurationException, IOException {
DataDTO dataDto = new DataDTO();
File dir = null;
URL testDataUrl = MockUtils.class.getResource("/test-data");
if (!"file".equals(testDataUrl.getProtocol())) {
throw new IOException("unsupported protocol: "
+ testDataUrl.getProtocol());
}
String url = testDataUrl.toExternalForm();
String testPath = url.substring("file:".length());
dir = new File(testPath);
if (!dir.exists() || !dir.isDirectory()) {
throw new ConfigurationException(
"Expected cite test dataset directory at " + dir);
}
Map dataStores = createDataStoresMap();
dataDto.setDataStores(dataStores);
Map featureTypes = createFeatureTypes();
dataDto.setFeaturesTypes(featureTypes);
Map nameSpaces = createNameSpaces();
dataDto.setNameSpaces(nameSpaces);
dataDto.setDefaultNameSpacePrefix("cite");
Map styles = createStyles(new File(dir, "styles"));
dataDto.setStyles(styles);
Data catalog = new Data(dataDto, dir, geoserver);
return catalog;
}