public class TestHelper {
public static AbstractDataStoreFactory createTestFactory() throws Exception {
SimpleFeatureTypeBuilder builder = new SimpleFeatureTypeBuilder();
builder.setCRS(CRS.decode("EPSG:4326"));
builder.add("geom", Point.class);
builder.add("label", String.class);
builder.setName("table1");
SimpleFeatureType type = builder.buildFeatureType();
SimpleFeatureTypeBuilder builder2 = new SimpleFeatureTypeBuilder();
builder2.setCRS(CRS.decode("EPSG:4326"));
builder2.add("geom", Point.class);
builder2.add("name", String.class);
builder2.setName("table2");
SimpleFeatureType type2 = builder2.buildFeatureType();
SimpleFeatureTypeBuilder builder3 = new SimpleFeatureTypeBuilder();
builder3.setCRS(CRS.decode("EPSG:4326"));
builder3.add("geom", Point.class);
builder3.add("name", String.class);
builder3.add("number", Long.class);
builder3.setName("table3");
SimpleFeatureTypeBuilder builder4 = new SimpleFeatureTypeBuilder();
builder4.setCRS(CRS.decode("EPSG:4326"));
builder4.add("geom", Point.class);
builder4.add("number", Double.class);
builder4.setName("table4");
// A table with a shp-like structure
SimpleFeatureTypeBuilder builderShp = new SimpleFeatureTypeBuilder();
builderShp.setCRS(CRS.decode("EPSG:4326"));
builderShp.add("the_geom", Point.class);
builderShp.add("number", Double.class);
builderShp.add("number2", Double.class);
builderShp.setName("shpLikeTable");
SimpleFeatureTypeBuilder builderShp2 = new SimpleFeatureTypeBuilder();
builderShp2.setCRS(CRS.decode("EPSG:4326"));
builderShp2.add("the_geom", Point.class);
builderShp2.add("number", Double.class);
builderShp2.add("number2", Integer.class);
builderShp2.setName("shpLikeTable2");
// A table with a geojson-like structure
SimpleFeatureTypeBuilder builderGeoJson = new SimpleFeatureTypeBuilder();
builderGeoJson.setCRS(CRS.decode("EPSG:4326"));
builderGeoJson.add("number", Double.class);
builderGeoJson.add("number2", Double.class);
builderGeoJson.add("geom", Point.class);
builderGeoJson.setName("GeoJsonLikeTable");
SimpleFeatureTypeBuilder builderGeoJson2 = new SimpleFeatureTypeBuilder();
builderGeoJson2.setCRS(CRS.decode("EPSG:23030"));
builderGeoJson2.add("number", Double.class);
builderGeoJson2.add("number2", Double.class);
builderGeoJson2.add("geom", Point.class);
builderGeoJson2.setName("GeoJsonLikeTable2");
SimpleFeatureType type3 = builder3.buildFeatureType();
SimpleFeatureType typeShp = builderShp.buildFeatureType();
SimpleFeatureType typeShp2 = builderShp2.buildFeatureType();
SimpleFeatureType typeGeoJson = builderGeoJson.buildFeatureType();
SimpleFeatureType typeGeoJson2 = builderGeoJson2.buildFeatureType();
GeometryFactory gf = new GeometryFactory();
SimpleFeature f1 = SimpleFeatureBuilder.build(type,
new Object[] { gf.createPoint(new Coordinate(5, 8)), "feature1" },
"table1.feature1");