@Override public List<KeywordInfo> getKeywords() { return delegate.getKeywords(); }
ftinfo.setDescription(rinfo.getDescription()); if (rinfo != null && (ftinfo.getKeywords() == null || ftinfo.getKeywords().isEmpty())) { if (rinfo.getKeywords() != null) { if (ftinfo.getKeywords() == null) { ((FeatureTypeInfoImpl) ftinfo).setKeywords(new ArrayList()); continue; ftinfo.getKeywords().add(new Keyword(kw));
@Test public void testSetupMetadataResourceInfoException() throws Exception { FeatureTypeInfo ftInfo = createMock(FeatureTypeInfo.class); expect(ftInfo.getTitle()).andReturn("foo"); expect(ftInfo.getDescription()).andReturn("foo"); expect(ftInfo.getKeywords()).andReturn(null); replay(ftInfo); FeatureSource fs = createMock(FeatureSource.class); expect(fs.getInfo()).andThrow(new UnsupportedOperationException()); replay(fs); CatalogBuilder cb = new CatalogBuilder(getCatalog()); cb.setupMetadata(ftInfo, fs); }
@Test public void testFullTextSearchAddedKeyword() { ft.getKeywords().add(new Keyword("air_temp")); ft.getKeywords().add(new Keyword("temperatureAir")); l.setResource(ft); addLayer(); LayerInfo lproxy = catalog.getLayer(l.getId()); FeatureTypeInfo ftproxy = (FeatureTypeInfo) lproxy.getResource(); ftproxy.getKeywords().add(new Keyword("newKeyword")); catalog.save(ftproxy); Filter filter = Predicates.fullTextSearch("newKeyword"); assertEquals(newHashSet(ftproxy), asSet(catalog.list(FeatureTypeInfo.class, filter))); assertEquals(newHashSet(lproxy), asSet(catalog.list(LayerInfo.class, filter))); }
@Test public void testMetadataFromFeatueSource() throws Exception { CatalogBuilder cb = new CatalogBuilder(getCatalog()); cb.setStore(cb.buildDataStore("fooStore")); FeatureType ft = createMock(FeatureType.class); expect(ft.getName()).andReturn(new NameImpl("foo")).anyTimes(); expect(ft.getCoordinateReferenceSystem()).andReturn(null).anyTimes(); expect(ft.getGeometryDescriptor()).andReturn(null).anyTimes(); replay(ft); ResourceInfo rInfo = createMock(ResourceInfo.class); expect(rInfo.getTitle()).andReturn("foo title"); expect(rInfo.getDescription()).andReturn("foo description"); expect(rInfo.getKeywords()) .andReturn(new LinkedHashSet<String>(Arrays.asList("foo", "bar", "baz", ""))) .anyTimes(); replay(rInfo); FeatureSource fs = createMock(FeatureSource.class); expect(fs.getSchema()).andReturn(ft).anyTimes(); expect(fs.getInfo()).andReturn(rInfo).anyTimes(); expect(fs.getName()).andReturn(ft.getName()).anyTimes(); replay(fs); FeatureTypeInfo ftInfo = cb.buildFeatureType(fs); assertEquals("foo title", ftInfo.getTitle()); assertEquals("foo description", ftInfo.getDescription()); assertTrue(ftInfo.getKeywords().contains(new Keyword("foo"))); assertTrue(ftInfo.getKeywords().contains(new Keyword("bar"))); assertTrue(ftInfo.getKeywords().contains(new Keyword("baz"))); }
@Test public void testModifyFeatureType() { addFeatureType(); FeatureTypeInfo ft2 = catalog.getFeatureTypeByName(ft.getName()); ft2.setDescription("ft2Description"); ft2.getKeywords().add(new Keyword("ft2")); FeatureTypeInfo ft3 = catalog.getFeatureTypeByName(ft.getName()); assertEquals("ftName", ft3.getName()); assertEquals("ftDescription", ft3.getDescription()); assertTrue(ft3.getKeywords().isEmpty()); catalog.save(ft2); ft3 = catalog.getFeatureTypeByName(ft.getName()); assertEquals(ft2, ft3); assertEquals("ft2Description", ft3.getDescription()); assertEquals(1, ft3.getKeywords().size()); }
@Test public void testFullTextSearchKeywords() { ft.getKeywords().add(new Keyword("air_temp")); ft.getKeywords().add(new Keyword("temperatureAir")); cv.getKeywords().add(new Keyword("dwpt_dprs")); cv.getKeywords().add(new Keyword("temperatureDewpointDepression"));
ft2 = catalog.getFeatureType(ft2.getId()); ft3 = catalog.getFeatureType(ft3.getId()); ft1.getKeywords().add(new Keyword("keyword1")); ft1.getKeywords().add(new Keyword("keyword2")); ft1.getKeywords().add(new Keyword("ft1")); ft1.setDescription("ft1 description"); catalog.save(ft1); ft2.getKeywords().add(new Keyword("keyword1")); ft2.getKeywords().add(new Keyword("keyword1")); ft2.setDescription("ft2"); catalog.save(ft2); ft3.getKeywords().add(new Keyword("ft3")); ft3.getKeywords().add(new Keyword("ft3")); ft3.setDescription("FT3"); catalog.save(ft3);
featureType.setAbstract(ftInfoReader.abstrct()); for (String kw : ftInfoReader.keywords()) { featureType.getKeywords().add(new Keyword(kw));
@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) { } }
FeatureTypeInfo ft3 = newFeatureType("ft3", ds); ft2.getKeywords().add(new Keyword("keyword1")); ft2.getKeywords().add(new Keyword("keyword2"));
ft1.getKeywords().add(new Keyword("kw1_ft1")); ft1.getKeywords().add(new Keyword("kw2_ft1")); ft1.getKeywords().add(new Keyword("repeatedKw")); ft2.getKeywords().add(new Keyword("kw1_ft2")); ft2.getKeywords().add(new Keyword("kw2_ft2")); ft2.getKeywords().add(new Keyword("repeatedKw")); assertEquals(ft2.getName(), catalog.get(ResourceInfo.class, filter).getName()); filter = equal("keywords[1].value", ft1.getKeywords().get(0).getValue()); assertEquals(ft1.getName(), catalog.get(ResourceInfo.class, filter).getName()); filter = equal("keywords[2]", ft2.getKeywords().get(1)); assertEquals(ft2.getName(), catalog.get(FeatureTypeInfo.class, filter).getName());
featureType.getKeywords().add(new Keyword(name)); featureType.setEnabled(true); featureType.setProjectionPolicy(
element("Title", info.getTitle()); element("Abstract", info.getAbstract()); handleKeywords(info.getKeywords());
@org.junit.Test public void testKeywordVocab() throws Exception { FeatureTypeInfo lines = getFeatureTypeInfo(MockData.LINES); Keyword kw = new Keyword("foo"); kw.setVocabulary("bar"); lines.getKeywords().add(kw); getCatalog().save(lines); WMSInfo wms = getGeoServer().getService(WMSInfo.class); kw = new Keyword("baz"); kw.setVocabulary("bar"); wms.getKeywords().add(kw); getGeoServer().save(wms); String linesName = MockData.LINES.getPrefix() + ":" + MockData.LINES.getLocalPart(); Document doc = getAsDOM("wms?service=WMS&request=getCapabilities&version=1.3.0", true); String xpath = "//wms:Layer[wms:Name='" + linesName + "']/wms:KeywordList/wms:Keyword[@vocabulary='bar']"; assertXpathExists(xpath, doc); assertXpathEvaluatesTo("foo", xpath, doc); xpath = "//wms:Service/wms:KeywordList/wms:Keyword[@vocabulary='bar']"; assertXpathExists(xpath, doc); assertXpathEvaluatesTo("baz", xpath, doc); }
@Override public void visit(FeatureTypeInfo featureType) { FeatureTypeInfo otherFeatureType = otherCatalog.getFeatureType(featureType.getId()); if (otherFeatureType != null) { otherFeatureType.setProjectionPolicy(featureType.getProjectionPolicy()); } if (!(Objects.equals(featureType, otherFeatureType) && checkEquals(featureType.getAttributes(), otherFeatureType.getAttributes()) && checkEquals(featureType.getResponseSRS(), otherFeatureType.getResponseSRS()) && checkEquals(featureType.getAlias(), otherFeatureType.getAlias()) && checkEquals(featureType.getKeywords(), otherFeatureType.getKeywords()) && checkEquals(featureType.getDataLinks(), otherFeatureType.getDataLinks()) && checkEquals(featureType.getMetadataLinks(), otherFeatureType.getMetadataLinks()) && checkEquals(featureType.getMetadata(), otherFeatureType.getMetadata()))) { differences.add(new InfoDiff(featureType, otherFeatureType)); } }
typeInfo.setDescription(_typeInfo.getDescription()); typeInfo.setAbstract(_typeInfo.getAbstract()); typeInfo.getKeywords().addAll(_typeInfo.getKeywords()); typeInfo.getMetadataLinks().addAll(_typeInfo.getMetadataLinks()); typeInfo.getDataLinks().addAll(_typeInfo.getDataLinks());
element("Title", featureType.getTitle()); element("Abstract", featureType.getAbstract()); keywords(featureType.getKeywords());