Project

General

Profile

Revision 9f495932

ID9f4959320704c6440212bab63195a4c5cdec554f
Parent dfabd5b6
Child c363956a

Added by Andreas Müller over 3 years ago

#5909 fix failing test

View differences:

cdmlib-ext/src/test/java/eu/etaxonomy/cdm/ext/geo/FloraCubaCondensedDistributionComposerTest.java
42 42
    private static NamedArea eastCuba;
43 43
    private static NamedArea centralCuba;
44 44
    private static NamedArea pinarDelRio;
45
    private static NamedArea artemisa;
46
    private static NamedArea habana;
47
    private static NamedArea mayabeque;
48
    private static NamedArea matanzas;
49
    private static NamedArea isla_juventud;
50

  
45 51
    private static NamedArea holguin;
46 52
    private static NamedArea guantanamo;
47 53

  
......
151 157
        //TODO work in progress
152 158
    }
153 159

  
160
    @Test
161
    public void testCreateCondensedDistributionOrderSubAreas() {
162
        FloraCubaCondensedDistributionComposer composer = new FloraCubaCondensedDistributionComposer();
163
        composer.setAreaPreTag("");
164
        composer.setAreaPostTag("");
165

  
166
        Set<Distribution> filteredDistributions = new HashSet<Distribution>();
167
        filteredDistributions.add(Distribution.NewInstance(cuba, PresenceAbsenceTerm.NATURALISED()));
168
        filteredDistributions.add(Distribution.NewInstance(eastCuba, statusVoc.findTermByUuid(uuidStatusOccasionallyCultivated)));
169
        filteredDistributions.add(Distribution.NewInstance(westernCuba, statusVoc.findTermByUuid(uuidStatusDoubtfullyNativeError)));
170

  
171
        //pinarDelRio, artemisa, habana, mayabeque, matanzas, isla_juventud
172
        filteredDistributions.add(Distribution.NewInstance(matanzas, PresenceAbsenceTerm.NATIVE()));
173
        filteredDistributions.add(Distribution.NewInstance(artemisa, PresenceAbsenceTerm.NATIVE()));
174
        filteredDistributions.add(Distribution.NewInstance(pinarDelRio, PresenceAbsenceTerm.NATIVE()));
175
        filteredDistributions.add(Distribution.NewInstance(isla_juventud, PresenceAbsenceTerm.NATIVE()));
176
        filteredDistributions.add(Distribution.NewInstance(mayabeque, PresenceAbsenceTerm.NATIVE()));
177
        filteredDistributions.add(Distribution.NewInstance(habana, PresenceAbsenceTerm.NATIVE()));
178

  
179
        filteredDistributions.add(Distribution.NewInstance(guantanamo, PresenceAbsenceTerm.CULTIVATED_REPORTED_IN_ERROR()));
180
        filteredDistributions.add(Distribution.NewInstance(holguin, PresenceAbsenceTerm.NATURALISED()));
181
        filteredDistributions.add(Distribution.NewInstance(bahamas, PresenceAbsenceTerm.NATIVE()));
182
        filteredDistributions.add(Distribution.NewInstance(oldWorld, PresenceAbsenceTerm.NATIVE_PRESENCE_QUESTIONABLE()));
183

  
184
        CondensedDistribution condensedDistribution = composer.createCondensedDistribution(filteredDistributions, null);
185
        String condensedString = condensedDistribution.toString();
186

  
187
        Assert.assertEquals("Condensed string for Cuba differs", "nCu(-dCuW(-cPR*) (c)CuE(nHo)) " + composer.getInternalAreaSeparator() + "<b>Bah</b> ?<b>VM</b> ", condensedString);
188

  
189

  
190
        //TODO work in progress
191
    }
192

  
154 193

  
155 194

  
156 195
    private static boolean makeAreas(){
......
191 230

  
192 231
        cuba.addIncludes(westernCuba);
193 232

  
194

  
195 233
        //Pinar del Río PR
196 234
        label = "Pinar del Río";
197 235
        abbrev = "PR*";
......
203 241
        label = "Artemisa";
204 242
        abbrev = "Art";
205 243
        uuid = UUID.randomUUID();
206
        NamedArea area = getNamedArea(uuid, label, abbrev, cubaAreasVocabualary);
207
        westernCuba.addIncludes(area);
244
        artemisa = getNamedArea(uuid, label, abbrev, cubaAreasVocabualary);
245
        westernCuba.addIncludes(artemisa);
208 246

  
209 247
        //Ciudad de la Habana
210 248
        label = "Ciudad de la Habana";
211 249
        abbrev = "Hab*";
212 250
        uuid = UUID.randomUUID();
213
        area = getNamedArea(uuid, label, abbrev, cubaAreasVocabualary);
214
        westernCuba.addIncludes(area);
251
        habana = getNamedArea(uuid, label, abbrev, cubaAreasVocabualary);
252
        westernCuba.addIncludes(habana);
215 253

  
216 254
        //Ciudad de la Habana
217 255
        label = "Mayabeque";
218 256
        abbrev = "May";
219 257
        uuid = UUID.randomUUID();
220
        area = getNamedArea(uuid, label, abbrev, cubaAreasVocabualary);
221
        westernCuba.addIncludes(area);
258
        mayabeque = getNamedArea(uuid, label, abbrev, cubaAreasVocabualary);
259
        westernCuba.addIncludes(mayabeque);
222 260

  
223 261
        //Matanzas Mat
224 262
        label = "Matanzas";
225 263
        abbrev = "Mat";
226 264
        uuid = UUID.randomUUID();
227
        area = getNamedArea(uuid, label, abbrev, cubaAreasVocabualary);
228
        westernCuba.addIncludes(area);
265
        matanzas = getNamedArea(uuid, label, abbrev, cubaAreasVocabualary);
266
        westernCuba.addIncludes(matanzas);
229 267

  
230 268
        //Isla de la Juventud IJ
231 269
        label = "Isla de la Juventud";
232 270
        abbrev = "IJ";
233 271
        uuid = UUID.randomUUID();
234
        area = getNamedArea(uuid, label, abbrev, cubaAreasVocabualary);
235
        westernCuba.addIncludes(area);
272
        isla_juventud = getNamedArea(uuid, label, abbrev, cubaAreasVocabualary);
273
        westernCuba.addIncludes(isla_juventud);
236 274

  
237 275
        //Provinces - Central
238 276
        //Villa Clara VC
239 277
        label = "Villa Clara";
240 278
        abbrev = "VC";
241 279
        uuid = UUID.randomUUID();
242
        area = getNamedArea(uuid, label, abbrev, cubaAreasVocabualary);
280
        NamedArea area = getNamedArea(uuid, label, abbrev, cubaAreasVocabualary);
243 281
        centralCuba.addIncludes(area);
244 282

  
245 283
        //Cienfuegos Ci VC
cdmlib-model/src/main/java/eu/etaxonomy/cdm/strategy/parser/NonViralNameParserImpl.java
661 661
		IBook result = ReferenceFactory.newBook();
662 662
		reference = makeEdition(result, reference);
663 663
		reference = makeVolume(result, reference);
664
		result.setTitle(reference);
664
		result.setAbbrevTitle(reference);
665 665
		return result;
666 666
	}
667 667

  
......
672 672
		Reference result = ReferenceFactory.newArticle();
673 673
		reference = makeVolume(result, reference);
674 674
		Reference inJournal = ReferenceFactory.newJournal();
675
		inJournal.setTitle(reference);
675
		inJournal.setAbbrevTitle(reference);
676 676
		result.setInReference(inJournal);
677 677
		return result;
678 678
	}
cdmlib-model/src/test/java/eu/etaxonomy/cdm/strategy/parser/NonViralNameParserImplTest.java
1913 1913

  
1914 1914
        //f
1915 1915
        name = parser.parseReferencedName("Coussarea imitans L.O. Williams"
1916
                + " in Phytologia 26 (6): 488489, f. 1973");
1916
                + " in Phytologia 26 (6): 488-489, f. 1973");
1917 1917
        Assert.assertFalse("Name should be parsable", name.isProtectedTitleCache());
1918 1918
        combinationAuthor = name.getCombinationAuthorship();
1919 1919
        assertEquals( "L.O. Williams", combinationAuthor.getNomenclaturalTitle());
1920 1920
        nomRef = (Reference)name.getNomenclaturalReference();
1921 1921
        assertEquals(ReferenceType.Article, nomRef.getType());
1922 1922
        assertEquals("26 (6)", nomRef.getVolume());
1923
        assertEquals("488489, f", name.getNomenclaturalMicroReference());
1923
        assertEquals("488-489, f", name.getNomenclaturalMicroReference());
1924 1924

  
1925 1925
        //Phys.-Med.
1926 1926
        name = parser.parseReferencedName("Coccocypselum cordifolium Nees & Mart."
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/IIdentifiableEntityService.java
99 99

  
100 100
    /**
101 101
     * Return a list of all uuids mapped to titleCache in the convenient <code>UuidAndTitleCache</code> object.
102
     * Retrieving this list is considered to be significantly faster than initializing the fully fledged buiseness
102
     * @see #getUuidAndTitleCache(Integer, String)
103
     */
104
    public List<UuidAndTitleCache<T>> getUuidAndTitleCache();
105

  
106
    /**
107
     * Return a list of all uuids mapped to titleCache in the convenient <code>UuidAndTitleCache</code> object.
108
     * Retrieving this list is considered to be significantly faster than initializing the fully fledged business
103 109
     * objects. To be used in cases where you want to present large amount of data and provide details after
104 110
     * a selection has been made.
105 111
     *
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/IdentifiableServiceBase.java
135 135
		return result;
136 136
	}
137 137

  
138
	@Override
139
    public List<UuidAndTitleCache<T>> getUuidAndTitleCache() {
140
	    return getUuidAndTitleCache(null, null);
141
	}
142

  
143

  
138 144
	@Transactional(readOnly = true)
139 145
	@Override
140 146
	public List<UuidAndTitleCache<T>> getUuidAndTitleCache(Integer limit, String pattern) {

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)