20 |
20 |
import org.hibernate.collection.spi.PersistentCollection;
|
21 |
21 |
import org.junit.Assert;
|
22 |
22 |
import org.junit.BeforeClass;
|
|
23 |
import org.junit.Ignore;
|
23 |
24 |
import org.junit.Test;
|
24 |
25 |
import org.unitils.dbunit.annotation.DataSet;
|
25 |
26 |
|
... | ... | |
28 |
29 |
import eu.etaxonomy.cdm.api.service.IPolytomousKeyService;
|
29 |
30 |
import eu.etaxonomy.cdm.api.service.ITaxonService;
|
30 |
31 |
import eu.etaxonomy.cdm.api.service.ITermService;
|
|
32 |
import eu.etaxonomy.cdm.api.service.IUserService;
|
31 |
33 |
import eu.etaxonomy.cdm.api.service.IVocabularyService;
|
32 |
34 |
import eu.etaxonomy.cdm.model.agent.AgentBase;
|
33 |
35 |
import eu.etaxonomy.cdm.model.common.CdmBase;
|
... | ... | |
68 |
70 |
ITaxonService taxonService = getRemoteApplicationController().getTaxonService();
|
69 |
71 |
IVocabularyService vocabularyService = getRemoteApplicationController().getVocabularyService();
|
70 |
72 |
ITermService termService = getRemoteApplicationController().getTermService();
|
|
73 |
IUserService userService = getRemoteApplicationController().getUserService();
|
|
74 |
|
71 |
75 |
//Language english = Language.getLanguageFromUuid(Language.uuidEnglish);
|
72 |
76 |
|
73 |
77 |
|
... | ... | |
394 |
398 |
}
|
395 |
399 |
}
|
396 |
400 |
|
|
401 |
@Ignore // should be enabled once resolution of #5066 is merged into cdmlib main branch
|
397 |
402 |
@Test
|
398 |
403 |
public void saveNewTerm() {
|
399 |
404 |
UUID vocNameFeatureUuid = UUID.fromString("fa7ca3eef-4092-49e1-beec-ed5096193e5e");
|
400 |
405 |
UUID vocFeatureUuid = UUID.fromString("b187d555-f06f-4d65-9e53-da7c93f8eaa8");
|
401 |
406 |
DefinedTermBase newTerm = TermType.Feature.getEmptyDefinedTermBase();
|
402 |
407 |
newTerm.setLabel("CreateTest");
|
|
408 |
|
403 |
409 |
try {
|
|
410 |
|
404 |
411 |
Assert.assertNotNull(newTerm);
|
405 |
412 |
TermVocabulary vocNameFeature = vocabularyService.find(vocNameFeatureUuid);
|
406 |
413 |
TermVocabulary vocFeature = vocabularyService.find(vocFeatureUuid);
|
... | ... | |
427 |
434 |
newTerm = dtb;
|
428 |
435 |
Assert.assertNotNull(dtb.getCreatedBy());
|
429 |
436 |
Assert.assertNotNull(dtb.getCreated());
|
|
437 |
} else {
|
|
438 |
Assert.assertNull(dtb.getCreatedBy());
|
430 |
439 |
}
|
431 |
440 |
}
|
432 |
441 |
newTerm.setLabel("UpdateTest");
|
433 |
442 |
newTerm = termService.merge(newTerm);
|
434 |
443 |
Assert.assertNotNull(newTerm.getUpdatedBy());
|
435 |
444 |
Assert.assertNotNull(newTerm.getUpdated());
|
|
445 |
|
|
446 |
Assert.assertNull(vocNameFeature.getCreatedBy());
|
|
447 |
Assert.assertNull(vocFeature.getCreatedBy());
|
436 |
448 |
} finally {
|
437 |
|
termService.delete(newTerm.getUuid());
|
|
449 |
if(termService.find(newTerm.getUuid()) != null) {
|
|
450 |
termService.delete(newTerm.getUuid());
|
|
451 |
}
|
438 |
452 |
}
|
439 |
453 |
}
|
440 |
454 |
}
|
#5054 Update test for checking terms update