7ab44bb60a2bd74c213c6bef471665d13ea93074
3 * Copyright (C) 2007 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
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.
11 package eu
.etaxonomy
.cdm
.ext
;
13 import static org
.junit
.Assert
.assertTrue
;
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
;
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
;
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
;
43 public class EditGeoServiceTest
{
44 private static final Logger logger
= Logger
.getLogger(EditGeoServiceTest
.class);
47 * @throws java.lang.Exception
50 public static void setUpBeforeClass() throws Exception
{
51 logger
.debug("Start class setup");
55 * @throws java.lang.Exception
58 public static void tearDownAfterClass() throws Exception
{
62 * @throws java.lang.Exception
65 public void setUp() throws Exception
{
69 * @throws java.lang.Exception
72 public void tearDown() throws Exception
{
75 //******************************************** TESTS**************
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()));
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
);
93 presenceAbsenceColorMap
= null;
94 String bbox
="-20,0,120,70";
95 List
<Language
> languages
= new ArrayList
<Language
>();
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"));