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