@Override public FeatureTypeInfo createFeatureType() { return delegate.createFeatureType(); }
protected FeatureTypeInfo newFeatureType(String name, DataStoreInfo ds) { FeatureTypeInfo ft2 = catalog.getFactory().createFeatureType(); ft2.setNamespace(ns); ft2.setName(name); ft2.setStore(ds); return ft2; }
@Test public void testEqualsWithAttributes() { CatalogFactory factory = catalog.getFactory(); FeatureTypeInfoImpl ft1 = (FeatureTypeInfoImpl) factory.createFeatureType(); FeatureTypeInfoImpl ft2 = (FeatureTypeInfoImpl) factory.createFeatureType(); ft1.setName("featureType"); ft2.setName("featureType"); AttributeTypeInfo at1 = factory.createAttribute(); AttributeTypeInfo at2 = factory.createAttribute(); at1.setName("attribute"); at2.setName("attribute"); at1.setFeatureType(ft1); at2.setFeatureType(ft2); ft1.setAttributes(Collections.singletonList(at1)); ft2.setAttributes(Collections.singletonList(at2)); assertEquals(ft1, ft2); } }
catalog.addListener(l); FeatureTypeInfo ft = catalog.getFactory().createFeatureType(); ft.setName("ftName"); ft.setDescription("ftDescription");
@Test public void testModifyMetadata() { // set default namespace addNamespace(); addDataStore(); TestListener l = new TestListener(); catalog.addListener(l); FeatureTypeInfo ft = catalog.getFactory().createFeatureType(); ft.setName("ftName"); ft.setDescription("ftDescription"); ft.setStore(ds); assertTrue(l.added.isEmpty()); catalog.add(ft); assertEquals(1, l.added.size()); assertEquals(ft, l.added.get(0).getSource()); ft = catalog.getFeatureTypeByName("ftName"); ft.getMetadata().put("newValue", "abcd"); MetadataMap newMetadata = new MetadataMap(ft.getMetadata()); catalog.save(ft); assertEquals(1, l.modified.size()); assertEquals(ft, l.modified.get(0).getSource()); assertTrue(l.modified.get(0).getPropertyNames().contains("metadata")); assertTrue(l.modified.get(0).getOldValues().contains(new MetadataMap())); assertTrue(l.modified.get(0).getNewValues().contains(newMetadata)); }
FeatureTypeInfo ftinfo = catalog.getFactory().createFeatureType(); ftinfo.setStore(store); ftinfo.setEnabled(true);
@Test public void testAddFeatureType() throws Exception { testAddDataStore(); File d = new File(testData.getDataDirectoryRoot(), "workspaces/acme/foostore/foo"); assertFalse(d.exists()); NamespaceInfo ns = catalog.getFactory().createNamespace(); ns.setPrefix("bar"); ns.setURI("http://bar"); catalog.add(ns); FeatureTypeInfo ft = catalog.getFactory().createFeatureType(); ft.setName("foo"); ft.setNamespace(ns); ft.setStore(catalog.getDataStoreByName("acme", "foostore")); catalog.add(ft); assertTrue(d.exists()); }
@Test public void testAddFeatureType() { assertTrue(catalog.getFeatureTypes().isEmpty()); addFeatureType(); assertEquals(1, catalog.getFeatureTypes().size()); FeatureTypeInfo ft2 = catalog.getFactory().createFeatureType(); try { catalog.add(ft2); fail("adding with no name should throw exception"); } catch (Exception e) { } ft2.setName("ft2Name"); try { catalog.add(ft2); fail("adding with no store should throw exception"); } catch (Exception e) { } ft2.setStore(ds); ft2.getKeywords().add(new Keyword("keyword")); catalog.add(ft2); FeatureTypeInfo ft3 = catalog.getFactory().createFeatureType(); ft3.setName("ft3Name"); try { catalog.getFeatureTypes().add(ft3); fail("adding directly should throw an exception"); } catch (Exception e) { } }
catalog.add(ds1); FeatureTypeInfo ft1 = catalog.getFactory().createFeatureType(); ft1.setName("ft1"); ft1.setStore(ds1); catalog.add(ft1); FeatureTypeInfo ft2 = catalog.getFactory().createFeatureType(); ft2.setName("ft2"); ft2.setStore(ds1); catalog.add(ds2); FeatureTypeInfo ft3 = catalog.getFactory().createFeatureType(); ft3.setName("ft3"); ft3.setStore(ds2);
protected void runInternal() throws Exception { CatalogFactory factory = catalog.getFactory(); for (int i = 0; i < GET_LAYER_BY_ID_WITH_CONCURRENT_ADD_TEST_COUNT; i++) { // GR: Adding a new feature type info too, we can't really add multiple layers per // feature type yet. Setting the name of the layer changes the name of the resource, // then all previous layers for that resource get screwed String name = "LAYER-" + i + "-" + idx; FeatureTypeInfo resource = factory.createFeatureType(); resource.setName(name); resource.setNamespace(ns); resource.setStore(ds); catalog.add(resource); LayerInfo layer = factory.createLayer(); layer.setResource(resource); layer.setName(name); catalog.add(layer); } } };
@Test public void testLookupSRSDetached() throws Exception { Catalog cat = getCatalog(); CatalogBuilder cb = new CatalogBuilder(cat); DataStoreInfo sf = cat.getDataStoreByName("sf"); FeatureSource fs = sf.getDataStore(null).getFeatureSource(toName(MockData.PRIMITIVEGEOFEATURE)); FeatureTypeInfo ft = cat.getFactory().createFeatureType(); ft.setNativeName("PrimitiveGeoFeature"); assertNull(ft.getSRS()); assertNull(ft.getCRS()); cb.lookupSRS(ft, fs, true); assertNotNull(ft.getSRS()); assertNotNull(ft.getCRS()); }
@Test public void testSetupBoundsDetached() throws Exception { Catalog cat = getCatalog(); CatalogBuilder cb = new CatalogBuilder(cat); DataStoreInfo sf = cat.getDataStoreByName("sf"); FeatureSource fs = sf.getDataStore(null).getFeatureSource(toName(MockData.PRIMITIVEGEOFEATURE)); FeatureTypeInfo ft = cat.getFactory().createFeatureType(); ft.setNativeName("PrimitiveGeoFeature"); assertNull(ft.getNativeBoundingBox()); assertNull(ft.getLatLonBoundingBox()); cb.lookupSRS(ft, fs, true); cb.setupBounds(ft, fs); assertNotNull(ft.getNativeBoundingBox()); assertNotNull(ft.getLatLonBoundingBox()); }
FeatureTypeInfo ft2 = catalog.getFactory().createFeatureType(); ft2.setName("ft2Name"); ft2.setStore(ds);
@Test public void testGetLayerByNameWithColon() { addNamespace(); addDataStore(); FeatureTypeInfo ft = catalog.getFactory().createFeatureType(); ft.setEnabled(true); ft.setName("foo:bar"); ft.setAbstract("ftAbstract"); ft.setDescription("ftDescription"); ft.setStore(ds); ft.setNamespace(ns); catalog.add(ft); addStyle(); LayerInfo l = catalog.getFactory().createLayer(); l.setResource(ft); l.setEnabled(true); l.setDefaultStyle(s); catalog.add(l); assertNotNull(catalog.getLayerByName("foo:bar")); }
vt.addParameter(new VirtualTableParameter("andparam", null)); FeatureTypeInfo ft = cFactory.createFeatureType(); ft.setStore(ds); ft.setNamespace(ns);
catalog.add(ds); FeatureTypeInfo ft = cFactory.createFeatureType(); ft.setStore(ds); ft.setNamespace(ns);
catalog.add(ds); FeatureTypeInfo ft = cFactory.createFeatureType(); ft.setStore(ds); ft.setNamespace(ns);
@Test public void testGetFeatureTypeByName() { addFeatureType(); FeatureTypeInfo ft2 = catalog.getFeatureTypeByName(ft.getName()); assertNotNull(ft2); assertFalse(ft == ft2); assertEquals(ft, ft2); NamespaceInfo ns2 = catalog.getFactory().createNamespace(); ns2.setPrefix("ns2Prefix"); ns2.setURI("ns2URI"); catalog.add(ns2); FeatureTypeInfo ft3 = catalog.getFactory().createFeatureType(); ft3.setName("ft3Name"); ft3.setStore(ds); ft3.setNamespace(ns2); catalog.add(ft3); FeatureTypeInfo ft4 = catalog.getFeatureTypeByName(ns2.getPrefix(), ft3.getName()); assertNotNull(ft4); assertFalse(ft4 == ft3); assertEquals(ft3, ft4); ft4 = catalog.getFeatureTypeByName(ns2.getURI(), ft3.getName()); assertNotNull(ft4); assertFalse(ft4 == ft3); assertEquals(ft3, ft4); }
catalog.add(ds2); FeatureTypeInfo ft2 = factory.createFeatureType(); ft2.setEnabled(true); ft2.setName("ftName");
catalog.add(citeStore); FeatureTypeInfo citeFeatureType = factory.createFeatureType(); citeFeatureType.setName("citeLayer"); citeFeatureType.setStore(citeStore); catalog.add(sfStore); FeatureTypeInfo sfFeatureType = factory.createFeatureType(); sfFeatureType.setName("sfLayer"); sfFeatureType.setStore(sfStore);