editor now updatable via updateSite
[taxeditor.git] / taxeditor-store / src / test / java / eu / etaxonomy / taxeditor / store / operations / DeleteConceptRelationOperationTest.java
1 // $Id$
2 /**
3 * Copyright (C) 2007 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
6 *
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.
9 */
10
11 package eu.etaxonomy.taxeditor.store.operations;
12
13 import org.apache.log4j.Logger;
14 import org.eclipse.core.commands.ExecutionException;
15 import org.junit.Assert;
16 import org.junit.BeforeClass;
17 import org.junit.Test;
18
19 import eu.etaxonomy.cdm.model.common.CdmBase;
20 import eu.etaxonomy.cdm.model.taxon.Taxon;
21 import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
22
23 /**
24 * @author n.hoffmann
25 * @created 08.04.2009
26 * @version 1.0
27 */
28 public class DeleteConceptRelationOperationTest extends AbstractTaxeditorOperationTest{
29 private static final Logger logger = Logger
30 .getLogger(DeleteConceptRelationOperationTest.class);
31
32 private static TaxonRelationshipType relationshipType;
33
34 private static Taxon relatedTaxon;
35
36 /**
37 * @throws java.lang.Exception
38 */
39 @BeforeClass
40 public static void setUpBeforeClass() throws Exception {
41
42 taxon = Taxon.NewInstance(null, null);
43 relatedTaxon = Taxon.NewInstance(null, null);
44 relationshipType = TaxonRelationshipType.CONTRADICTION();
45
46 taxon.addTaxonRelation(relatedTaxon, relationshipType, null, null);
47
48 Assert.assertTrue(taxon.getTaxonRelations().size() > 0);
49
50 operation = new DeleteConceptRelationOperation("", undoContext, taxon, relatedTaxon, postOperation);
51 }
52
53 /**
54 * Test method for {@link eu.etaxonomy.taxeditor.store.operations.DeleteConceptRelationOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)}.
55 * @throws ExecutionException
56 */
57 @Test
58 public void testExecuteIProgressMonitorIAdaptable() throws ExecutionException {
59 operation.execute(monitor, info);
60
61 Assert.assertTrue(taxon.getTaxonRelations().size() == 0);
62 }
63
64 /**
65 * Test method for {@link eu.etaxonomy.taxeditor.store.operations.DeleteConceptRelationOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)}.
66 * @throws ExecutionException
67 */
68 @Test
69 public void testUndoIProgressMonitorIAdaptable() throws ExecutionException {
70 operation.undo(monitor, info);
71
72 Assert.assertTrue(taxon.getTaxonRelations().size() > 0);
73 }
74
75 /**
76 * Test method for {@link eu.etaxonomy.taxeditor.store.operations.DeleteConceptRelationOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)}.
77 * @throws ExecutionException
78 */
79 @Test
80 public void testRedoIProgressMonitorIAdaptable() throws ExecutionException {
81 operation.redo(monitor, info);
82
83 Assert.assertTrue(taxon.getTaxonRelations().size() == 0);
84 }
85
86 /**
87 * Test method for {@link eu.etaxonomy.taxeditor.store.operations.AbstractPostOperation#postExecute(CdmBase)}.
88 */
89 @Test
90 public void testPostExecute() {
91 // TODO there is not post operation functionality for this class
92 // at the moment. Implement test when there is.
93 logger.warn("No post operation functionality for this class");
94 }
95 }