Project

General

Profile

« Previous | Next » 

Revision 0cb91465

Added by Andreas Müller about 3 years ago

cleanup

View differences:

src/test/java/eu/etaxonomy/cdm/vaadin/presenter/EditConceptRelationshipPresenterTest.java
44 44
    @SuppressWarnings("unused")
45 45
    private static final Logger logger = Logger.getLogger(EditConceptRelationshipPresenterTest.class);
46 46

  
47
    public static EditConceptRelationshipPresenter ecrp;
47
    public static EditConceptRelationshipPresenter conceptRelationshipPresenter;
48 48

  
49 49
    private static List<String> FROM_TAXON_INIT_STRATEGY = Arrays.asList(new String []{
50 50
            "relationsFromThisTaxon"
......
52 52

  
53 53
    @BeforeClass
54 54
    public static void init() {
55
        ecrp = new EditConceptRelationshipPresenter();
55
        conceptRelationshipPresenter = new EditConceptRelationshipPresenter();
56 56
    }
57 57

  
58 58
    @Test
59 59
    public void testLoadTaxonRelationshipTypeContainer() throws SQLException {
60
        CdmSQLContainer container = ecrp.loadTaxonRelationshipTypeContainer();
60
        CdmSQLContainer container = conceptRelationshipPresenter.loadTaxonRelationshipTypeContainer();
61 61
        Assert.assertEquals(30, container.size());
62 62
    }
63 63

  
......
67 67
        UUID toTaxonUuid = UUID.fromString("5004a8e7-b907-4744-b67e-44ccb057ab3b");
68 68
        UUID relTypeUuid = UUID.fromString("60974c98-64ab-4574-bb5c-c110f6db634d");
69 69

  
70
        IdUuidName trId =ecrp.createRelationship(fromTaxonUuid, relTypeUuid, toTaxonUuid);
70
        IdUuidName trId =conceptRelationshipPresenter.createRelationship(fromTaxonUuid, relTypeUuid, toTaxonUuid);
71 71

  
72 72
        Taxon taxon = CdmBase.deproxy(CdmSpringContextHelper.getTaxonService().load(fromTaxonUuid,FROM_TAXON_INIT_STRATEGY),Taxon.class);
73 73
        Assert.assertEquals(1, taxon.getRelationsFromThisTaxon().size());
......
95 95
        Assert.assertNotEquals(newRelTypeUuid, oldRelTypeUuid);
96 96

  
97 97
        // change both to taxon and relationship type
98
        ecrp.updateRelationship(fromTaxonUuid, taxonRelUuid, newRelTypeUuid, newToTaxonUuid);
98
        conceptRelationshipPresenter.updateRelationship(fromTaxonUuid, taxonRelUuid, newRelTypeUuid, newToTaxonUuid);
99 99
        taxon = CdmBase.deproxy(CdmSpringContextHelper.getTaxonService().load(fromTaxonUuid,FROM_TAXON_INIT_STRATEGY),Taxon.class);
100 100
        tr = getFromRelwithUuid(taxon, taxonRelUuid);
101 101

  
......
104 104
        Assert.assertEquals(newRelTypeUuid, tr.getType().getUuid());
105 105

  
106 106
        // reset old values
107
        ecrp.updateRelationship(fromTaxonUuid, taxonRelUuid, oldRelTypeUuid, oldToTaxonUuid);
107
        conceptRelationshipPresenter.updateRelationship(fromTaxonUuid, taxonRelUuid, oldRelTypeUuid, oldToTaxonUuid);
108 108

  
109 109
        // change only relationship type
110
        ecrp.updateRelationship(fromTaxonUuid, taxonRelUuid, newRelTypeUuid, null);
110
        conceptRelationshipPresenter.updateRelationship(fromTaxonUuid, taxonRelUuid, newRelTypeUuid, null);
111 111
        taxon = CdmBase.deproxy(CdmSpringContextHelper.getTaxonService().load(fromTaxonUuid,FROM_TAXON_INIT_STRATEGY),Taxon.class);
112 112
        tr = getFromRelwithUuid(taxon, taxonRelUuid);
113 113

  
......
116 116
        Assert.assertEquals(newRelTypeUuid, tr.getType().getUuid());
117 117

  
118 118
        // reset old values
119
        ecrp.updateRelationship(fromTaxonUuid, taxonRelUuid, oldRelTypeUuid, oldToTaxonUuid);
119
        conceptRelationshipPresenter.updateRelationship(fromTaxonUuid, taxonRelUuid, oldRelTypeUuid, oldToTaxonUuid);
120 120

  
121 121
        // change only to taxon
122
        ecrp.updateRelationship(fromTaxonUuid, taxonRelUuid, null, newToTaxonUuid);
122
        conceptRelationshipPresenter.updateRelationship(fromTaxonUuid, taxonRelUuid, null, newToTaxonUuid);
123 123
        taxon = CdmBase.deproxy(CdmSpringContextHelper.getTaxonService().load(fromTaxonUuid,FROM_TAXON_INIT_STRATEGY),Taxon.class);
124 124
        tr = getFromRelwithUuid(taxon, taxonRelUuid);
125 125

  
......
135 135
        // RelType "Not Included in" id=865 before (924)
136 136
        UUID taxonRelUuid = UUID.fromString("cac9fa65-9b15-445f-80e4-56f77952f7ec");
137 137

  
138
        ecrp.deleteRelationship(fromTaxonUuid, taxonRelUuid);
138
        conceptRelationshipPresenter.deleteRelationship(fromTaxonUuid, taxonRelUuid);
139 139
        Taxon taxon = CdmBase.deproxy(CdmSpringContextHelper.getTaxonService().load(fromTaxonUuid,FROM_TAXON_INIT_STRATEGY),Taxon.class);
140 140
        Assert.assertEquals(4, taxon.getRelationsFromThisTaxon().size());
141 141

  
......
146 146
        // Reltype "Includes or Overlaps or Excludes" id = 866 (before: 934)
147 147
        taxonRelUuid = UUID.fromString("9634d870-bab1-4fdc-8845-c7e71aa8dc6b");
148 148

  
149
        ecrp.deleteRelationship(fromTaxonUuid, taxonRelUuid);
149
        conceptRelationshipPresenter.deleteRelationship(fromTaxonUuid, taxonRelUuid);
150 150
        taxon = CdmBase.deproxy(CdmSpringContextHelper.getTaxonService().load(fromTaxonUuid,FROM_TAXON_INIT_STRATEGY),Taxon.class);
151 151
        Assert.assertEquals(0, taxon.getRelationsFromThisTaxon().size());
152 152
    }
......
156 156
    public void testGetRelTypeToTaxonIunMap() {
157 157
        UUID fromTaxonUuid = UUID.fromString("5f713f69-e03e-4a11-8a55-700fbbf44805");
158 158
        UUID taxonRelUuid = UUID.fromString("cc761030-38d2-4b5d-954d-32329c0ea106");
159
        Map<String, IdUuidName> map = ecrp.getRelTypeToTaxonIunMap(fromTaxonUuid, taxonRelUuid);
159
        Map<String, IdUuidName> map = conceptRelationshipPresenter.getRelTypeToTaxonIunMap(fromTaxonUuid, taxonRelUuid);
160 160

  
161 161
        IdUuidName relTypeIun = map.get(EditConceptRelationshipPresenter.REL_TYPE_KEY);
162 162
        Assert.assertEquals(865, relTypeIun.getId());

Also available in: Unified diff