Project

General

Profile

« Previous | Next » 

Revision bcbe5633

Added by Andreas Müller almost 3 years ago

ref #9683 add loadProxy method to services and adapt test to work with current auto initialize settings

View differences:

cdmlib-services/src/test/java/eu/etaxonomy/cdm/api/service/NameServiceImplTest.java
77 77
    private static final Logger logger = Logger.getLogger(NameServiceImplTest.class);
78 78

  
79 79
    private static final UUID NAME1_UUID = UUID.fromString("6dbd41d1-fe13-4d9c-bb58-31f051c2c384");
80
    private static final int NAME1_ID = 10;
80 81
    private static final UUID NAME2_UUID = UUID.fromString("f9e9c13f-5fa5-48d3-88cf-712c921a099e");
82
    private static final int NAME2_ID = 11;
81 83
    private static final UUID NAME3_UUID = UUID.fromString("e1e66264-f16a-4df9-80fd-6ab5028a3c28");
84
    private static final int NAME3_ID = 12;
82 85

  
83 86
    @SpringBeanByType
84 87
    private INameService nameService;
......
1021 1024
        Field fullTitleCacheField = TaxonName.class.getDeclaredField("fullTitleCache");
1022 1025
        fullTitleCacheField.setAccessible(true);
1023 1026

  
1024
        TaxonName name1 = nameService.load(NAME1_UUID);
1025
        TaxonName name2 = nameService.load(NAME2_UUID);
1026
        TaxonName name3 = nameService.load(NAME3_UUID);
1027
        TaxonName name1 = nameService.loadProxy(NAME1_ID);
1028
        TaxonName name2 = nameService.loadProxy(NAME2_ID);
1029
        TaxonName name3 = nameService.loadProxy(NAME3_ID);
1027 1030

  
1031
        name1 = CdmBase.deproxy(name1);
1028 1032
        assertEquals("TitleCache should be the persisted one", "Name1", titleCacheField.get(name1));
1029 1033
        assertEquals("NameCache should be the persisted one", "", nameCacheField.get(name1));
1030 1034
        assertEquals("AuthorCache should be the persisted one", "", authorCacheField.get(name1));
1031 1035
        assertEquals("FullTitleCache should be the persisted one", "", fullTitleCacheField.get(name1));
1032 1036

  
1037
        name2 = CdmBase.deproxy(name2);
1033 1038
        assertEquals("TitleCache should be the persisted one", "Name2", titleCacheField.get(name2));
1034 1039
        assertEquals("NameCache should be the persisted one", "Protected name", nameCacheField.get(name2));
1035 1040
        assertEquals("AuthorCache should be the persisted one", null, authorCacheField.get(name2));
1036 1041
        assertEquals("FullTitleCache should be the persisted one", "", fullTitleCacheField.get(name2));
1037 1042

  
1043
        name3 = CdmBase.deproxy(name3);
1038 1044
        assertEquals("TitleCache should be the persisted one", "Name3", titleCacheField.get(name3));
1039 1045
        assertEquals("NameCache should be the persisted one", "", nameCacheField.get(name3));
1040 1046
        assertEquals("AuthorCache should be the persisted one", "No-author", authorCacheField.get(name3));

Also available in: Unified diff