Project

General

Profile

« Previous | Next » 

Revision 22244d5f

Added by Katja Luther over 7 years ago

fix failing test

View differences:

eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/session/CdmEntitySessionAwareTest.java
207 207
        rootChildNode.addChild(grandChildNode);
208 208

  
209 209

  
210
        polytomousKeyNodeService.merge(grandChildNode);
210
        polytomousKeyNodeService.merge(grandChildNode, true);
211 211

  
212 212

  
213 213
        Assert.assertFalse(pKey.getRoot().getChildAt(0).getChildAt(0).getId() == 0);
......
244 244
        Taxon taxon = CdmBase.deproxy(taxonService.find(taxon1Uuid),Taxon.class);
245 245
        pkeynode.getChildAt(1).setTaxon(taxon);
246 246

  
247
        polytomousKeyService.merge(pkey);
247
        polytomousKeyService.merge(pkey, true);
248 248

  
249 249
        pkey = CdmBase.deproxy(polytomousKeyService.find(polytomousKeyUuid),PolytomousKey.class);
250 250

  
......
259 259

  
260 260
        Assert.assertEquals(pkeynode.getChildAt(1).getTaxon(), taxon);
261 261

  
262
        polytomousKeyService.merge(pkey);
262
        polytomousKeyService.merge(pkey, true);
263 263

  
264 264
        pkey = CdmBase.deproxy(polytomousKeyService.find(polytomousKeyUuid),PolytomousKey.class);
265 265

  
......
295 295

  
296 296
        Assert.assertSame(subkey1, subkey2);
297 297

  
298
        polytomousKeyService.merge(pkey);
298
        polytomousKeyService.merge(pkey, true);
299 299
    }
300 300

  
301 301
    @Test
......
321 321

  
322 322
        Assert.assertSame(subkey1, subkey2);
323 323

  
324
        polytomousKeyService.merge(pkey);
324
        polytomousKeyService.merge(pkey, true);
325 325
    }
326 326

  
327 327

  
......
340 340
        label2.size();
341 341

  
342 342

  
343
        polytomousKeyService.merge(pkey);
343
        polytomousKeyService.merge(pkey, true);
344 344
    }
345 345

  
346 346
    @Test
......
460 460
        newTerm.setLabel("CreateTest");
461 461

  
462 462
        try {
463
        	 if(termService.findByRepresentationText("UpdateTest", Feature.class, null, null) != null) {
464
        		Pager<Feature> terms =  termService.findByRepresentationText("UpdateTest", Feature.class, null, null);
465
        		if (!terms.getRecords().isEmpty()){
466
        			termService.delete(terms.getRecords().get(0).getUuid());
463
        	List<Feature> features = termService.list(Feature.class, 100, 0, null, null);
464
        	List<UUID> updateTerms = new ArrayList<UUID>();
465
        	for (Feature feature:features){
466
        		if (feature.getLabel().equals("UpdateTest")){
467
        			updateTerms.add(feature.getUuid());
467 468
        		}
468
             }
469
        	}
470
        	termService.delete(updateTerms);
471
        	
472
//        	 if(termService.findByRepresentationText("UpdateTest", Feature.class, null, null) != null) {
473
//        		Pager<Feature> terms =  termService.findByRepresentationText("UpdateTest", Feature.class, null, null);
474
//        		if (!terms.getRecords().isEmpty()){
475
//        			termService.delete(terms.getRecords().get(0).getUuid());
476
//        		}
477
//             }
469 478

  
470 479
            Assert.assertNotNull(newTerm);
471 480
            TermVocabulary vocNameFeature = vocabularyService.find(vocNameFeatureUuid);
......
478 487

  
479 488
            vocNameFeature.addTerm(newTerm);
480 489

  
481
            vocs = vocabularyService.merge(vocs);
482
            for(TermVocabulary voc : vocs) {
490
            List<MergeResult<TermVocabulary>> mergeResults = vocabularyService.merge(vocs, true);
491
            
492
            for(MergeResult<TermVocabulary> result : mergeResults){
493
            	TermVocabulary voc = result.getMergedEntity();
483 494
                if(voc.getUuid().equals(vocNameFeatureUuid)) {
484 495
                    vocNameFeature = voc;
485 496
                }
......
518 529
        // Test for #5138
519 530
        Person person = (Person) CdmApplicationState.getCurrentAppConfig().getAgentService().load(personUuid);
520 531
        person.setFirstname("Me");
521
        CdmApplicationState.getCurrentAppConfig().getAgentService().merge(person);
532
        CdmApplicationState.getCurrentAppConfig().getAgentService().merge(person, true);
522 533
    }
523 534

  
524 535

  
......
529 540
        person = (Person) CdmApplicationState.getCurrentAppConfig().getAgentService().merge(person);
530 541
        person = (Person) CdmApplicationState.getCurrentAppConfig().getAgentService().load(person.getUuid());
531 542
        person.setFirstname("Some");
532
        CdmApplicationState.getCurrentAppConfig().getAgentService().merge(person);
543
        CdmApplicationState.getCurrentAppConfig().getAgentService().merge(person, true);
533 544
    }
534 545

  
535 546
    @Test

Also available in: Unified diff