2 * Copyright (C) 2015 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
9 package eu
.etaxonomy
.taxeditor
.operation
;
11 import java
.util
.ArrayList
;
12 import java
.util
.List
;
13 import java
.util
.UUID
;
15 import org
.eclipse
.core
.commands
.ExecutionException
;
16 import org
.junit
.Assert
;
17 import org
.junit
.Ignore
;
18 import org
.junit
.Test
;
19 import org
.unitils
.dbunit
.annotation
.DataSet
;
21 import eu
.etaxonomy
.cdm
.api
.service
.IPolytomousKeyService
;
22 import eu
.etaxonomy
.cdm
.model
.description
.PolytomousKey
;
23 import eu
.etaxonomy
.taxeditor
.navigation
.key
.polytomous
.operation
.RemotingDeletePolytomousKeyOperation
;
24 import eu
.etaxonomy
.taxeditor
.navigation
.key
.polytomous
.operation
.RemotingUpdatePolytomousKeyAllNodesOperation
;
32 public class PolytomousKeyViewPartTest
extends BaseOperationTest
{
34 IPolytomousKeyService polytomousKeyService
= getRemoteApplicationController().getPolytomousKeyService();
35 private static UUID pkey1Uuid
= UUID
.fromString("f82cef88-5a9e-4917-9938-d08bda40836f");
36 private static UUID pkey2Uuid
= UUID
.fromString("a00ca7ec-b660-433c-bd14-596826ab2243");
37 private static UUID pkey3Uuid
= UUID
.fromString("197bc542-bf5b-4a52-aa66-c65df32c196b");
39 @Ignore // waiting for #3998 to be fixed
41 public void testDeletePolytomousKey() throws ExecutionException
{
42 List
<PolytomousKey
> pKeysBeforeDelete
= polytomousKeyService
.list(PolytomousKey
.class, null, null, null, null);
43 int initialCount
= pKeysBeforeDelete
.size();
45 List
<PolytomousKey
> keysToDelete
= new ArrayList
<PolytomousKey
>();
46 keysToDelete
.add(polytomousKeyService
.load(pkey1Uuid
));
47 keysToDelete
.add(polytomousKeyService
.load(pkey2Uuid
));
48 keysToDelete
.add(polytomousKeyService
.load(pkey3Uuid
));
50 List
<UUID
> uuids
= new ArrayList
<UUID
>();
55 int keysToDeleteCount
= keysToDelete
.size();
56 operation
= new RemotingDeletePolytomousKeyOperation(sessionOwner
,
59 operation
.execute(monitor
, info
);
61 List
<PolytomousKey
> pKeysAfterDelete
= polytomousKeyService
.list(PolytomousKey
.class, null, null, null, null);
62 Assert
.assertEquals(initialCount
- keysToDeleteCount
, pKeysAfterDelete
.size());
63 for(PolytomousKey key
: keysToDelete
) {
64 Assert
.assertFalse(pKeysAfterDelete
.contains(key
));
70 public void testUpdateAllNodes() throws ExecutionException
{
71 operation
= new RemotingUpdatePolytomousKeyAllNodesOperation(sessionOwner
,
74 operation
.execute(monitor
, info
);