Move MoveTaxonOperationTest to navigation package and try to enable
authorAndreas Müller <a.mueller@bgbm.org>
Mon, 14 Nov 2016 15:12:40 +0000 (16:12 +0100)
committerAndreas Müller <a.mueller@bgbm.org>
Mon, 14 Nov 2016 15:12:40 +0000 (16:12 +0100)
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/operation/MoveTaxonOperation.java
eu.etaxonomy.taxeditor.navigation/src/test/java/eu/etaxonomy/taxeditor/navigation/navigator/operation/MoveTaxonOperationTest.java [moved from eu.etaxonomy.taxeditor.editor/src/test/java/eu/etaxonomy/taxeditor/editor/name/operation/MoveTaxonOperationTest.java with 80% similarity]

index 1120e70..1513977 100644 (file)
@@ -60,7 +60,9 @@ public class MoveTaxonOperation extends AbstractPersistentPostOperation {
         * @param conversationEnabled a {@link eu.etaxonomy.cdm.api.conversation.IConversationEnabled} object.
         */
        public MoveTaxonOperation(String label, IUndoContext undoContext,
-                       Set<UUID> taxonNodesUUIDToMove, ITaxonTreeNode newParentTreeNode, IPostOperationEnabled postOperationEnabled, IConversationEnabled conversationEnabled, MovingType moveToParentNode) {
+                       Set<UUID> taxonNodesUUIDToMove, ITaxonTreeNode newParentTreeNode, 
+                       IPostOperationEnabled postOperationEnabled, 
+                       IConversationEnabled conversationEnabled, MovingType moveToParentNode) {
                super(label, undoContext, postOperationEnabled, conversationEnabled);
 
                this.taxonNodesUuid = taxonNodesUUIDToMove;
@@ -1,4 +1,3 @@
-// $Id$
 /**
 * Copyright (C) 2007 EDIT
 * European Distributed Institute of Taxonomy 
@@ -8,22 +7,27 @@
 * See LICENSE.TXT at the top of this package for the full license terms.
 */
 
-package eu.etaxonomy.taxeditor.editor.name.operation;
+package eu.etaxonomy.taxeditor.navigation.navigator.operation;
+
+import java.util.HashSet;
+import java.util.Set;
+import java.util.UUID;
 
 import org.eclipse.core.commands.ExecutionException;
 import org.junit.Assert;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
+import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
 import eu.etaxonomy.cdm.model.taxon.Classification;
 import eu.etaxonomy.cdm.model.taxon.Taxon;
 import eu.etaxonomy.cdm.model.taxon.TaxonNode;
+import eu.etaxonomy.taxeditor.navigation.navigator.TreeNodeDropAdapter.MovingType;
 import eu.etaxonomy.taxeditor.store.operations.AbstractTaxeditorOperationTestBase;
 
 /**
  * @author n.hoffmann
  * @created 08.04.2009
- * @version 1.0
  */
 public class MoveTaxonOperationTest extends AbstractTaxeditorOperationTestBase {
 
@@ -42,9 +46,7 @@ public class MoveTaxonOperationTest extends AbstractTaxeditorOperationTestBase {
 
                
                taxon = Taxon.NewInstance(null, null);
-               
-               
-               
+
                oldParentTaxon = Taxon.NewInstance(null, null);
                newParentTaxon = Taxon.NewInstance(null, null);
                
@@ -54,7 +56,13 @@ public class MoveTaxonOperationTest extends AbstractTaxeditorOperationTestBase {
                
                taxonNode = oldParentTaxonNode.addChildTaxon(taxon, null, null);
                
-               operation = null;//new MoveTaxonOperation("Move Taxon To Different Parent", undoContext, taxonNode, newParentTaxonNode, postOperation);
+               Set<UUID> taxonNodeUuidSet = new HashSet<UUID>();
+               //TODO ??
+               IConversationEnabled conversationEnabled = null;
+               taxonNodeUuidSet.add(taxonNode.getUuid());
+               operation = new MoveTaxonOperation("Move Taxon To Different Parent", 
+                               undoContext, taxonNodeUuidSet, newParentTaxonNode, postOperation, 
+                               conversationEnabled, MovingType.CHILD);
        }
 
        /**
@@ -79,15 +87,9 @@ public class MoveTaxonOperationTest extends AbstractTaxeditorOperationTestBase {
        public void testUndoIProgressMonitorIAdaptable() throws ExecutionException {
                operation.undo(monitor, info);
                
-//             Assert.assertEquals(oldParentTaxon ,taxon.getTaxonomicParent());
-//             Assert.assertTrue(newParentTaxon.getTaxonomicChildren().size() == 0);
-//             Assert.assertEquals(taxon, oldParentTaxon.getTaxonomicChildren().toArray(new Taxon[0])[0]);
-
-               Assert.assertEquals(newParentTaxon ,taxon.getTaxonNodes().iterator().next().getParent().getTaxon());
-               Assert.assertEquals(taxon, newParentTaxon.getTaxonNodes().iterator().next().getChildNodes().iterator().next());
-               Assert.assertEquals(0, oldParentTaxon.getTaxonNodes().iterator().next().getChildNodes().size());
-
-       
+               Assert.assertEquals(oldParentTaxon ,taxon.getTaxonNodes().iterator().next().getParent().getTaxon());
+               Assert.assertEquals(0, newParentTaxon.getTaxonNodes().iterator().next().getChildNodes().size());
+               Assert.assertEquals(taxon, oldParentTaxon.getTaxonNodes().iterator().next().getChildNodes().iterator().next());
        }
        
        /**