public void testRemoteType() throws Exception { SimpleFeatureType ft = DataUtilities.createType( "remoteType", "the_geom:MultiPolygon,FID:String,ADDRESS:String"); GeoServerResourceLoader resources = GeoServerExtensions.bean(GeoServerResourceLoader.class); GeoServerTemplateLoader loader = new GeoServerTemplateLoader(getClass(), resources); loader.setFeatureType(ft); loader.findTemplateSource("header.ftl"); }
public void testAppend() throws Exception { SimpleFeatureType type = DataUtilities.createType("trees", "the_geom:Point,FID:String,NAME:String");
public void testAppend() throws Exception { SimpleFeatureType type = DataUtilities.createType("trees", "the_geom:Point,FID:String,NAME:String");
@Before public void setup() throws SchemaException { SimpleFeatureType originalSchema = DataUtilities.createType( "BasicPolygons", "the_geom:MultiPolygon:srid=4326,ID:String,value:int"); SimpleFeatureTypeBuilder tb = new SimpleFeatureTypeBuilder(); tb.init(originalSchema); tb.setName("BasicPolygons2"); renamedSchema = tb.buildFeatureType(); collection = new ListFeatureCollection(originalSchema) { public void accepts(FeatureVisitor visitor, ProgressListener progress) throws java.io.IOException { lastVisitor = visitor; }; }; }
@Test public void testCreateInWorkspace() throws Exception { ResourcePool rp = createNiceMock(ResourcePool.class); Catalog cat = createNiceMock(Catalog.class); expect(cat.getFactory()).andReturn(new CatalogFactoryImpl(null)).anyTimes(); expect(cat.getResourcePool()).andReturn(rp).anyTimes(); WorkspaceInfo ws = createNiceMock(WorkspaceInfo.class); FeatureTypeInfo ft = createNiceMock(FeatureTypeInfo.class); expect(ft.getName()).andReturn("foo").anyTimes(); replay(rp, ft, ws, cat); StyleGenerator gen = new StyleGenerator(cat); gen.setWorkspace(ws); SimpleFeatureType schema = DataUtilities.createType("foo", "geom:Point"); StyleInfo style = gen.createStyle(new SLDHandler(), ft, schema); assertNotNull(style); assertNotNull(style.getWorkspace()); }
@Test public void testRemoteType() throws Exception { SimpleFeatureType ft = DataUtilities.createType( "remoteType", "the_geom:MultiPolygon,FID:String,ADDRESS:String"); GeoServerDataDirectory dd = createDataDirectoryMock(); Catalog cat = createNiceMock(Catalog.class); expect(cat.getFeatureTypeByName(ft.getName())).andReturn(null).once(); replay(dd, cat); GeoServerTemplateLoader tl = new GeoServerTemplateLoader(getClass(), dd); tl.setCatalog(cat); tl.setFeatureType(ft); tl.findTemplateSource("header.ftl"); verify(cat); } }
DataUtilities.createType( "testType", "string:String,int:Integer,double:Double,geom:Point");
gen.setWorkspace(ws); SimpleFeatureType schema = DataUtilities.createType("foo", "geom:Geometry"); StyleInfo style = gen.createStyle(new SLDHandler(), ft, schema); assertNotNull(style);
protected CapabilitiesFilterSplitter newVisitor(Capabilities supportedCaps) throws SchemaException { return new CapabilitiesFilterSplitter( supportedCaps, DataUtilities.createType( typeName, geomAtt + ":Point," + nameAtt + ":String," + numAtt + ":int"), accessor); }
@Override protected void connect() throws Exception { super.connect(); personSchema = DataUtilities.createType( dataStore.getNamespaceURI() + "." + PERSON, ID + ":0," + NAME + ":String," + AGE + ":0"); zipCodeSchema = DataUtilities.createType( dataStore.getNamespaceURI() + "." + ZIPCODE, ID + ":0," + CODE + ":String"); }
@Override protected void setUp() throws Exception { super.setUp(); schema = DataUtilities.createType( "buildings", "the_geom:Geometry,name:String,ADDRESS:String"); feature = SimpleFeatureBuilder.build( schema, new Object[] {null, "ABC", "Random Road, 12"}, "building.1"); wkt = new WKTReader(); }
@Before public void setup() throws Exception { ft = DataUtilities.createType( "test", "theGeom:LineString,b:java.lang.Byte,s:java.lang.Short,i:java.lang.Integer,l:java.lang.Long,d:java.lang.Double,label:String"); visitor = new ExpressionTypeVisitor(ft); }
@Before public void setup() throws Exception { ft = DataUtilities.createType( "test", "theGeom:LineString,b:java.lang.Byte,s:java.lang.Short,i:java.lang.Integer,l:java.lang.Long,d:java.lang.Double,label:String"); visitor = new BindingFilterVisitor(ft); }
public void testSpecCRS() throws Exception { String spec = "id:String,polygonProperty:Polygon:srid=32615"; SimpleFeatureType ft = DataUtilities.createType("testType", spec); String spec2 = DataUtilities.encodeType(ft); // System.out.println("BEFORE:"+spec); // System.out.println(" AFTER:"+spec2); assertEquals(spec, spec2); }
@Override protected void connect() throws Exception { super.connect(); schema = DataUtilities.createType( dataStore.getNamespaceURI() + "." + SKIPCOLUMN, ID + ":0," + GEOM + ":Point," + NAME + ":String"); }
public void testEmpty() throws Exception { SimpleFeatureType type = DataUtilities.createType( "namespace.typename", "name:String,id:0,geom:MultiLineString"); MemoryDataStore memory = new MemoryDataStore(type); FeatureSource<SimpleFeatureType, SimpleFeature> source = memory.getFeatureSource("typename"); assertEquals(0, source.getCount(Query.ALL)); }
public void testCreateSubTypeWithPropertyNotMatchingAnAttributeDescriptor() throws Exception { // creating a sub type with a property that doesn't map to an attribute descriptor SimpleFeatureType before = DataUtilities.createType("cities", "the_geom:Point:srid=4326,name:String"); SimpleFeatureType after = DataUtilities.createSubType( before, new String[] {"the_geom", "name", "not_existing"}); // the not_existing property should have been ignored assertEquals(2, after.getAttributeCount()); assertNotNull(after.getDescriptor("the_geom")); assertNotNull(after.getDescriptor("name")); }
public void testSimplifyNegateImpossible() throws Exception { PropertyIsEqualTo propertyIsEqualTo = ff.equal(ff.literal("a"), ff.literal("b"), true); Not negated = ff.not(propertyIsEqualTo); SimplifyingFilterVisitor visitor = new SimplifyingFilterVisitor(); SimpleFeatureType schema = DataUtilities.createType("test", "pop:String"); visitor.setFeatureType(schema); Filter simplified = (Filter) negated.accept(visitor, null); assertEquals(Filter.INCLUDE, simplified); } }
private <T> void testOrTouchingRanges(Class<T> type, T value) throws Exception { SimpleFeatureType schema = DataUtilities.createType("test", "a:" + type.getName()); SimplifyingFilterVisitor visitor = new SimplifyingFilterVisitor(); visitor.setRangeSimplicationEnabled(true); visitor.setFeatureType(schema); Filter original = ff.or( ff.greaterOrEqual(ff.property("a"), ff.literal(value)), ff.lessOrEqual(ff.property("a"), ff.literal(value))); Filter simplified = (Filter) original.accept(visitor, null); assertEquals(Filter.INCLUDE, simplified); }
public void testGetBoundsSupportsEmptyBounds() throws Exception { SimpleFeatureType type = DataUtilities.createType(getName() + ".test", "id:0,geom:LineString,name:String"); SimpleFeature[] features = new SimpleFeature[3]; features[0] = SimpleFeatureBuilder.build(type, new Object[] {1, null, "r1"}, "test.f1"); features[1] = SimpleFeatureBuilder.build(type, new Object[] {2, null, "r2"}, "test.f2"); features[2] = SimpleFeatureBuilder.build(type, new Object[] {3, null, "r3"}, "test.f3"); data.addFeatures(features); SimpleFeatureSource featureSource = data.getFeatureSource("test"); assertTrue(featureSource.getBounds(Query.ALL).isEmpty()); } }