1
|
// $Id$
|
2
|
/**
|
3
|
* Copyright (C) 2007 EDIT
|
4
|
* European Distributed Institute of Taxonomy
|
5
|
* http://www.e-taxonomy.eu
|
6
|
*
|
7
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
8
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
9
|
*/
|
10
|
|
11
|
package eu.etaxonomy.cdm.ext;
|
12
|
|
13
|
import static org.junit.Assert.assertTrue;
|
14
|
|
15
|
import java.awt.Color;
|
16
|
import java.util.ArrayList;
|
17
|
import java.util.HashMap;
|
18
|
import java.util.HashSet;
|
19
|
import java.util.List;
|
20
|
import java.util.Map;
|
21
|
import java.util.Set;
|
22
|
|
23
|
import org.apache.log4j.Logger;
|
24
|
import org.junit.After;
|
25
|
import org.junit.AfterClass;
|
26
|
import org.junit.Before;
|
27
|
import org.junit.BeforeClass;
|
28
|
import org.junit.Ignore;
|
29
|
import org.junit.Test;
|
30
|
|
31
|
import eu.etaxonomy.cdm.model.common.Language;
|
32
|
import eu.etaxonomy.cdm.model.description.AbsenceTerm;
|
33
|
import eu.etaxonomy.cdm.model.description.Distribution;
|
34
|
import eu.etaxonomy.cdm.model.description.PresenceAbsenceTermBase;
|
35
|
import eu.etaxonomy.cdm.model.description.PresenceTerm;
|
36
|
import eu.etaxonomy.cdm.model.location.TdwgArea;
|
37
|
|
38
|
/**
|
39
|
* @author a.mueller
|
40
|
* @created 08.10.2008
|
41
|
* @version 1.0
|
42
|
*/
|
43
|
public class EditGeoServiceTest {
|
44
|
private static final Logger logger = Logger.getLogger(EditGeoServiceTest.class);
|
45
|
|
46
|
/**
|
47
|
* @throws java.lang.Exception
|
48
|
*/
|
49
|
@BeforeClass
|
50
|
public static void setUpBeforeClass() throws Exception {
|
51
|
logger.debug("Start class setup");
|
52
|
}
|
53
|
|
54
|
/**
|
55
|
* @throws java.lang.Exception
|
56
|
*/
|
57
|
@AfterClass
|
58
|
public static void tearDownAfterClass() throws Exception {
|
59
|
}
|
60
|
|
61
|
/**
|
62
|
* @throws java.lang.Exception
|
63
|
*/
|
64
|
@Before
|
65
|
public void setUp() throws Exception {
|
66
|
}
|
67
|
|
68
|
/**
|
69
|
* @throws java.lang.Exception
|
70
|
*/
|
71
|
@After
|
72
|
public void tearDown() throws Exception {
|
73
|
}
|
74
|
|
75
|
//******************************************** TESTS**************
|
76
|
@Ignore
|
77
|
public void testGetWebServiceUrl() {
|
78
|
//String webServiceUrl = "http://www.test.de/webservice";
|
79
|
Set<Distribution> distributions = new HashSet<Distribution>();
|
80
|
distributions.add(Distribution.NewInstance(TdwgArea.getAreaByTdwgAbbreviation("SPA"), PresenceTerm.PRESENT()));
|
81
|
distributions.add(Distribution.NewInstance(TdwgArea.getAreaByTdwgAbbreviation("GER"), PresenceTerm.INTRODUCED()));
|
82
|
distributions.add(Distribution.NewInstance(TdwgArea.getAreaByTdwgAbbreviation("14"), PresenceTerm.CULTIVATED()));
|
83
|
distributions.add(Distribution.NewInstance(TdwgArea.getAreaByTdwgAbbreviation("BGM"), AbsenceTerm.ABSENT()));
|
84
|
distributions.add(Distribution.NewInstance(TdwgArea.getAreaByTdwgAbbreviation("FRA"), AbsenceTerm.ABSENT()));
|
85
|
distributions.add(Distribution.NewInstance(TdwgArea.getAreaByTdwgAbbreviation("IND-AP"), PresenceTerm.PRESENT()));
|
86
|
|
87
|
Map<PresenceAbsenceTermBase<?>, Color> presenceAbsenceColorMap = new HashMap<PresenceAbsenceTermBase<?>, Color>();
|
88
|
presenceAbsenceColorMap.put(PresenceTerm.PRESENT(), Color.BLUE);
|
89
|
presenceAbsenceColorMap.put(PresenceTerm.INTRODUCED(), Color.BLACK);
|
90
|
presenceAbsenceColorMap.put(PresenceTerm.CULTIVATED(), Color.YELLOW);
|
91
|
presenceAbsenceColorMap.put(AbsenceTerm.ABSENT(), Color.DARK_GRAY);
|
92
|
String backLayer ="";
|
93
|
presenceAbsenceColorMap = null;
|
94
|
String bbox="-20,0,120,70";
|
95
|
List<Language> languages = new ArrayList<Language>();
|
96
|
|
97
|
String result = EditGeoServiceUtilities.getEditGeoServiceUrlParameterString(distributions, presenceAbsenceColorMap, 600, 300, bbox,backLayer, languages );
|
98
|
//TODO Set semantics is not determined
|
99
|
//String expected = "http://www.test.de/webservice?l=tdwg3&ad=tdwg3:a:GER|b:OKL|c:BGM|b:SPA|d:FRA&as=a:005500|b:00FF00|c:FFFFFF|d:001100&bbox=-20,40,40,40&ms=400x300";
|
100
|
System.out.println(result);
|
101
|
assertTrue(result.startsWith("l="));
|
102
|
assertTrue(result.endsWith("&ms=600,300"));
|
103
|
//assertTrue(result.matches("0000ff"));
|
104
|
//TODO continue
|
105
|
}
|
106
|
}
|