Revision ae5cf321
Added by Andreas Müller almost 4 years ago
cdmlib-ext/src/test/java/eu/etaxonomy/cdm/ext/geo/EditGeoServiceTest.java | ||
---|---|---|
19 | 19 |
import java.net.HttpURLConnection; |
20 | 20 |
import java.net.MalformedURLException; |
21 | 21 |
import java.net.URI; |
22 |
import java.net.URISyntaxException; |
|
23 | 22 |
import java.net.URL; |
24 | 23 |
import java.util.ArrayList; |
25 | 24 |
import java.util.Collection; |
... | ... | |
100 | 99 |
public void testGetWebServiceUrlCountry() { |
101 | 100 |
Set<Distribution> distributions = new HashSet<>(); |
102 | 101 |
Country germany = termService.findByIdInVocabulary("DEU", Country.uuidCountryVocabulary, Country.class); |
103 |
// germany = (Country)termService.find(665); |
|
104 |
// germany = (Country)termService.find(UUID.fromString("cbe7ce69-2952-4309-85dd-0d7d4a4830a1")); |
|
105 |
|
|
106 |
// germany = Country.GERMANY(); |
|
107 | 102 |
|
108 | 103 |
distributions.add(Distribution.NewInstance(germany, PresenceAbsenceTerm.PRESENT())); |
109 | 104 |
distributions.add(Distribution.NewInstance(termService.findByIdInVocabulary("DE", Country.uuidCountryVocabulary, Country.class), PresenceAbsenceTerm.INTRODUCED())); |
110 |
Map<PresenceAbsenceTerm, Color> presenceAbsenceColorMap = new HashMap<PresenceAbsenceTerm, Color>();
|
|
105 |
Map<PresenceAbsenceTerm, Color> presenceAbsenceColorMap = new HashMap<>(); |
|
111 | 106 |
presenceAbsenceColorMap.put(PresenceAbsenceTerm.PRESENT(), Color.BLUE); |
112 | 107 |
presenceAbsenceColorMap.put(PresenceAbsenceTerm.INTRODUCED(), Color.BLACK); |
113 |
List<Language> languages = new ArrayList<Language>();
|
|
108 |
List<Language> languages = new ArrayList<>(); |
|
114 | 109 |
|
115 | 110 |
boolean subAreaPreference = false; |
116 | 111 |
boolean statusOrderPreference = false; |
117 | 112 |
|
118 |
|
|
119 | 113 |
Collection<Distribution> filteredDistributions = DescriptionUtility.filterDistributions( |
120 | 114 |
distributions, null, true, statusOrderPreference, subAreaPreference); |
121 | 115 |
|
... | ... | |
141 | 135 |
presenceAbsenceColorMap.put(PresenceAbsenceTerm.INTRODUCED(), Color.BLACK); |
142 | 136 |
presenceAbsenceColorMap.put(PresenceAbsenceTerm.CULTIVATED(), Color.YELLOW); |
143 | 137 |
presenceAbsenceColorMap.put(PresenceAbsenceTerm.ABSENT(), Color.DARK_GRAY); |
144 |
String backLayer =""; |
|
138 |
// String backLayer ="";
|
|
145 | 139 |
presenceAbsenceColorMap = null; |
146 |
String bbox="-20,0,120,70"; |
|
140 |
// String bbox="-20,0,120,70";
|
|
147 | 141 |
List<Language> languages = new ArrayList<>(); |
148 | 142 |
|
149 |
boolean subAreaPreference = false; |
|
150 |
boolean statusOrderPreference = false; |
|
143 |
// boolean subAreaPreference = false;
|
|
144 |
// boolean statusOrderPreference = false;
|
|
151 | 145 |
String result = EditGeoServiceUtilities.getDistributionServiceRequestParameterString( |
152 | 146 |
distributions, |
153 | 147 |
mapping, |
... | ... | |
171 | 165 |
} |
172 | 166 |
|
173 | 167 |
@Test |
174 |
public void testGetWebServiceUrlCyprus() throws ClientProtocolException, IOException, URISyntaxException {
|
|
168 |
public void testGetWebServiceUrlCyprus() throws ClientProtocolException, IOException { |
|
175 | 169 |
makeCyprusAreas(); |
176 | 170 |
Set<Distribution> distributions = new HashSet<Distribution>(); |
177 | 171 |
distributions.add(Distribution.NewInstance(divisions.get("1"), PresenceAbsenceTerm.PRESENT())); |
... | ... | |
181 | 175 |
distributions.add(Distribution.NewInstance(divisions.get("5"), PresenceAbsenceTerm.ABSENT())); |
182 | 176 |
distributions.add(Distribution.NewInstance(divisions.get("6"), PresenceAbsenceTerm.PRESENT())); |
183 | 177 |
|
184 |
Map<PresenceAbsenceTerm, Color> presenceAbsenceColorMap = new HashMap<PresenceAbsenceTerm, Color>();
|
|
178 |
Map<PresenceAbsenceTerm, Color> presenceAbsenceColorMap = new HashMap<>(); |
|
185 | 179 |
presenceAbsenceColorMap.put(PresenceAbsenceTerm.PRESENT(), Color.BLUE); |
186 | 180 |
presenceAbsenceColorMap.put(PresenceAbsenceTerm.INTRODUCED(), Color.BLACK); |
187 | 181 |
presenceAbsenceColorMap.put(PresenceAbsenceTerm.CULTIVATED(), Color.YELLOW); |
188 | 182 |
presenceAbsenceColorMap.put(PresenceAbsenceTerm.ABSENT(), Color.DARK_GRAY); |
189 |
String backLayer =""; |
|
190 | 183 |
presenceAbsenceColorMap = null; |
191 |
String bbox="-20,0,120,70"; |
|
192 |
List<Language> languages = new ArrayList<Language>(); |
|
184 |
List<Language> languages = new ArrayList<>(); |
|
193 | 185 |
|
194 |
boolean subAreaPreference = false; |
|
195 |
boolean statusOrderPreference = false; |
|
196 | 186 |
String result = EditGeoServiceUtilities.getDistributionServiceRequestParameterString( |
197 | 187 |
distributions, |
198 | 188 |
mapping, |
... | ... | |
236 | 226 |
private boolean makeCyprusAreas() throws IOException { |
237 | 227 |
//divisions |
238 | 228 |
|
239 |
|
|
240 | 229 |
NamedAreaType areaType = NamedAreaType.NATURAL_AREA(); |
241 | 230 |
NamedAreaLevel areaLevel = NamedAreaLevel.NewInstance("Cyprus Division", "Cyprus Division", null); |
242 | 231 |
|
... | ... | |
246 | 235 |
NamedArea.class, "Cyprus devisions", "Cyprus divisions", null, null); |
247 | 236 |
areaVocabulary.setUuid(uuidCyprusDivisionsVocabulary); |
248 | 237 |
|
249 |
|
|
250 | 238 |
for(int i = 1; i <= 8; i++){ |
251 | 239 |
UUID divisionUuid = getNamedAreaUuid(String.valueOf(i)); |
252 | 240 |
NamedArea division = this.newNamedArea( |
... | ... | |
263 | 251 |
vocabService.saveOrUpdate(areaVocabulary); |
264 | 252 |
commitAndStartNewTransaction(null); |
265 | 253 |
|
266 |
|
|
267 | 254 |
// import and map shapefile attributes from csv |
268 | 255 |
InputStream is = getClass().getClassLoader().getResourceAsStream("eu/etaxonomy/cdm/ext/geo/cyprusdivs.csv"); |
269 | 256 |
List<String> idSearchFields = new ArrayList<String>(); |
... | ... | |
273 | 260 |
|
274 | 261 |
divisions.clear(); |
275 | 262 |
Set<DefinedTermBase> terms = vocabService.load(uuidCyprusDivisionsVocabulary).getTerms(); |
276 |
for(DefinedTermBase dtb : terms){ |
|
263 |
for(DefinedTermBase<?> dtb : terms){
|
|
277 | 264 |
divisions.put(dtb.getIdInVocabulary(), (NamedArea) dtb); |
278 | 265 |
} |
279 | 266 |
|
... | ... | |
339 | 326 |
geoServiceArea.add(geoServiceLayer, layerFieldName, "BALI"); |
340 | 327 |
|
341 | 328 |
mapping.set(areaBangka, geoServiceArea); |
342 |
Set<Distribution> distributions = new HashSet<Distribution>();
|
|
329 |
Set<Distribution> distributions = new HashSet<>(); |
|
343 | 330 |
distributions.add(Distribution.NewInstance(areaBangka, PresenceAbsenceTerm.PRESENT())); |
344 | 331 |
|
345 | 332 |
Map<PresenceAbsenceTerm, Color> presenceAbsenceColorMap = new HashMap<>(); |
346 | 333 |
presenceAbsenceColorMap.put(PresenceAbsenceTerm.PRESENT(), Color.BLUE); |
347 | 334 |
|
348 | 335 |
presenceAbsenceColorMap = null; |
349 |
List<Language> languages = new ArrayList<Language>();
|
|
336 |
List<Language> languages = new ArrayList<>(); |
|
350 | 337 |
|
351 |
boolean subAreaPreference = false; |
|
352 |
boolean statusOrderPreference = false; |
|
353 | 338 |
String result = EditGeoServiceUtilities.getDistributionServiceRequestParameterString(distributions, |
354 | 339 |
mapping, |
355 | 340 |
null, null, languages ); |
... | ... | |
411 | 396 |
// @Test |
412 | 397 |
public void createTestDataSet() throws FileNotFoundException { |
413 | 398 |
|
414 |
List<TaxonDescription> taxonDescriptions = new ArrayList<TaxonDescription>();
|
|
399 |
List<TaxonDescription> taxonDescriptions = new ArrayList<>(); |
|
415 | 400 |
TaxonDescription description1 = TaxonDescription.NewInstance(); |
416 | 401 |
taxonDescriptions.add(description1); |
417 | 402 |
Distribution distribution1 = Distribution.NewInstance(Country.POLANDPOLISHPEOPLESREPUBLIC(), null); |
Also available in: Unified diff
cleanup