Project

General

Profile

Revision 502547d1

ID502547d1e739dc507d76dc8599293bc73a65a9fe
Parent 810bbc08
Child 18dfe77e

Added by Andreas Müller 12 months ago

ref #6794 fix FeatureNodeServiceImplTest

View differences:

cdmlib-services/src/test/java/eu/etaxonomy/cdm/api/service/FeatureNodeServiceImplTest.java
19 19
import org.junit.Before;
20 20
import org.junit.Test;
21 21
import org.unitils.dbunit.annotation.DataSet;
22
import org.unitils.dbunit.datasetloadstrategy.impl.RefreshLoadStrategy;
22 23
import org.unitils.spring.annotation.SpringBeanByType;
23 24

  
24 25
import eu.etaxonomy.cdm.api.service.config.FeatureNodeDeletionConfigurator;
......
59 60
	private static final UUID node5Uuid = UUID.fromString("c4d5170a-7967-4dac-ab76-ae2019eefde5");
60 61
	private static final UUID node6Uuid = UUID.fromString("b419ba5e-9c8b-449c-ad86-7abfca9a7340");
61 62

  
62
//	private Synonym s1;
63 63
	private TermTreeNode<Feature> node3;
64 64
	private TermTreeNode<Feature> node2;
65 65

  
66
	/**
67
	 * @throws java.lang.Exception
68
	 */
69 66
	@Before
70
	public void setUp() throws Exception {
71
	}
67
	public void setUp() throws Exception {}
72 68

  
73 69
	@Test
74 70
	public final void testIndexCreatRoot() {
......
88 84

  
89 85

  
90 86
	@Test
91
	@DataSet(value="FeatureNodeServiceImplTest-indexing.xml")
87
	@DataSet(loadStrategy=RefreshLoadStrategy.class, value="FeatureNodeServiceImplTest-indexing.xml")
92 88
	public final void testIndexCreateNode() {
93
		Feature feature = (Feature)termService.find(914);
89

  
90
	    Feature feature = (Feature)termService.find(914);
94 91

  
95 92
		node2 = featureNodeService.load(node2Uuid);
96 93
		String oldTreeIndex = node2.treeIndex();
......
105 102

  
106 103

  
107 104
	@Test
108
	@DataSet(value="FeatureNodeServiceImplTest-indexing.xml")
105
    @DataSet(loadStrategy=RefreshLoadStrategy.class ,value="FeatureNodeServiceImplTest-indexing.xml")
106
	//this may fail in single test if it is the first test as long as #8174 is not fixed
109 107
	public final void testIndexMoveNode() {
110 108
		//in feature tree
109
        @SuppressWarnings("unused")
111 110
        TermTree<Feature> featureTree = featureTreeService.load(featureTreeUuid);
112 111
		node2 = featureNodeService.load(node2Uuid);
113 112
		node3 = featureNodeService.load(node3Uuid);
......
124 123
		featureNodeService.saveOrUpdate(node2);
125 124
		commitAndStartNewTransaction(new String[]{"TaxonNode"});
126 125
		node2 = featureNodeService.load(node2Uuid);
127
		Assert.assertEquals("Node2 treeindex is not correct", "#t2#7#2#", node2.treeIndex());
126
		Assert.assertEquals("Node2 treeindex is not correct", "#t5002#7#2#", node2.treeIndex());
128 127
		node6 = featureNodeService.load(node6Uuid);
129
		Assert.assertEquals("Node6 treeindex is not correct", "#t2#7#2#4#6#", node6.treeIndex());
128
		Assert.assertEquals("Node6 treeindex is not correct", "#t5002#7#2#4#6#", node6.treeIndex());
130 129

  
131 130
		//into new classification
132 131
		node3 = featureNodeService.load(node3Uuid);
......
135 134
		featureNodeService.saveOrUpdate(node5);
136 135
		commitAndStartNewTransaction(new String[]{"TaxonNode"});
137 136
		node3 = featureNodeService.load(node3Uuid);
138
		Assert.assertEquals("Node3 treeindex is not correct", "#t2#7#2#5#3#", node3.treeIndex());
137
		Assert.assertEquals("Node3 treeindex is not correct", "#t5002#7#2#5#3#", node3.treeIndex());
139 138

  
140 139
	}
141 140

  
142 141
	@Test  //here we may have a test for testing delete of a node and attaching the children
143 142
	//to its parents, however this depends on the way delete is implemented and therefore needs
144 143
	//to wait until this is finally done
145
	@DataSet(value="FeatureNodeServiceImplTest-indexing.xml")
144
	@DataSet(loadStrategy=RefreshLoadStrategy.class, value="FeatureNodeServiceImplTest-indexing.xml")
146 145
	public final void testIndexDeleteNode() {
147 146
		node2 = featureNodeService.load(node2Uuid);
148 147
		TermTreeNode<Feature> root = node2.getParent();
cdmlib-services/src/test/resources/eu/etaxonomy/cdm/api/service/FeatureNodeServiceImplTest-indexing.xml
1 1
<?xml version='1.0' encoding='UTF-8'?>
2 2
<dataset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../database/schema/dataset.xsd">
3
    <TERMCOLLECTION DTYPE='TermTree' TERMTYPE="FE" ID="5001" UUID="6c2bc8d9-ee62-4222-be89-4a8e31770878"  PROTECTEDTITLECACHE="true" ROOT_ID="1" ALLOWDUPLICATES="false" />
4
    <TERMCOLLECTION DTYPE='TermTree' TERMTYPE="FE" ID="5002" UUID="43d67247-936f-42a3-a739-bbcde372e334"  PROTECTEDTITLECACHE="true" ROOT_ID="7" ALLOWDUPLICATES="false" />
3
    <TERMCOLLECTION DTYPE="TermTree" TERMTYPE="FE" ID="5001" UUID="6c2bc8d9-ee62-4222-be89-4a8e31770878" PROTECTEDTITLECACHE="true"  ROOT_ID="1"    ALLOWDUPLICATES="false" ORDERRELEVANT="false" ISFLAT="false" />
4
    <TERMCOLLECTION DTYPE="TermTree" TERMTYPE="FE" ID="5002" UUID="43d67247-936f-42a3-a739-bbcde372e334" PROTECTEDTITLECACHE="true"  ROOT_ID="7"    ALLOWDUPLICATES="false" ORDERRELEVANT="false" ISFLAT="false" />
5 5

  
6
    <TERMRELATION DTYPE='TermTreeNode' TERMTYPE="FE" ID="1" TERM_ID="[null]" PARENT_ID="[null]" TREEINDEX="#t5001#1#" SORTINDEX="[null]" GRAPH_ID="5001" UUID="324a1a77-689c-44be-8e65-347d835f4111" />
7
    <TERMRELATION DTYPE='TermTreeNode' TERMTYPE="FE" ID="2" TERM_ID="912" PARENT_ID="1" TREEINDEX="#t5001#1#2#" SORTINDEX="0" GRAPH_ID="5001" UUID="484a1a77-689c-44be-8e65-347d835f47e8" />
8
    <TERMRELATION DTYPE='TermTreeNode' TERMTYPE="FE" ID="3" TERM_ID="913" PARENT_ID="1" TREEINDEX="#t5001#1#3#" SORTINDEX="1" GRAPH_ID="5001" UUID="2d41f0c2-b785-4f73-a436-cc2d5e93cc5b" />
9
    <TERMRELATION DTYPE='TermTreeNode' TERMTYPE="FE" ID="4" TERM_ID="913" PARENT_ID="2" TREEINDEX="#t5001#1#2#4#" SORTINDEX="0" GRAPH_ID="5001" UUID="fdaec4bd-c78e-44df-ae87-28f18110968c" />
10
    <TERMRELATION DTYPE='TermTreeNode' TERMTYPE="FE" ID="5" TERM_ID="913" PARENT_ID="2" TREEINDEX="#t5001#1#2#5#" SORTINDEX="1" GRAPH_ID="5001" UUID="c4d5170a-7967-4dac-ab76-ae2019eefde5" />
11
    <TERMRELATION DTYPE='TermTreeNode' TERMTYPE="FE" ID="6" TERM_ID="913" PARENT_ID="4" TREEINDEX="#t5001#1#2#4#6#" SORTINDEX="0" GRAPH_ID="5001" UUID="b419ba5e-9c8b-449c-ad86-7abfca9a7340" />
12
    <TERMRELATION DTYPE='TermTreeNode' TERMTYPE="FE" ID="7" TERM_ID="913" PARENT_ID="[null]" TREEINDEX="#t2#7#" SORTINDEX="0" GRAPH_ID="5002" UUID="bb2c2d69-2b36-4f21-9374-b375ada8448c" />
6
    <TERMCOLLECTION DTYPE="TermVocabulary" TERMTYPE="FE" ID="16" CREATED="2009-01-28 17:07:04.0" UUID="b187d555-f06f-4d65-9e53-da7c93f8eaa8" URI="" TERMSOURCEURI="eu.etaxonomy.cdm.model.description.Feature" PROTECTEDTITLECACHE="true" TITLECACHE=""/>
7
  
8
    <TERMRELATION DTYPE="TermTreeNode" TERMTYPE="FE" ID="1" TERM_ID="[null]" PARENT_ID="[null]" TREEINDEX="#t5001#1#" SORTINDEX="[null]" GRAPH_ID="5001" UUID="324a1a77-689c-44be-8e65-347d835f4111" />
9
    <TERMRELATION DTYPE="TermTreeNode" TERMTYPE="FE" ID="2" TERM_ID="912" PARENT_ID="1" TREEINDEX="#t5001#1#2#" SORTINDEX="0" GRAPH_ID="5001" UUID="484a1a77-689c-44be-8e65-347d835f47e8" />
10
    <TERMRELATION DTYPE="TermTreeNode" TERMTYPE="FE" ID="3" TERM_ID="913" PARENT_ID="1" TREEINDEX="#t5001#1#3#" SORTINDEX="1" GRAPH_ID="5001" UUID="2d41f0c2-b785-4f73-a436-cc2d5e93cc5b" />
11
    <TERMRELATION DTYPE="TermTreeNode" TERMTYPE="FE" ID="4" TERM_ID="913" PARENT_ID="2" TREEINDEX="#t5001#1#2#4#" SORTINDEX="0" GRAPH_ID="5001" UUID="fdaec4bd-c78e-44df-ae87-28f18110968c" />
12
    <TERMRELATION DTYPE="TermTreeNode" TERMTYPE="FE" ID="5" TERM_ID="913" PARENT_ID="2" TREEINDEX="#t5001#1#2#5#" SORTINDEX="1" GRAPH_ID="5001" UUID="c4d5170a-7967-4dac-ab76-ae2019eefde5" />
13
    <TERMRELATION DTYPE="TermTreeNode" TERMTYPE="FE" ID="6" TERM_ID="913" PARENT_ID="4" TREEINDEX="#t5001#1#2#4#6#" SORTINDEX="0" GRAPH_ID="5001" UUID="b419ba5e-9c8b-449c-ad86-7abfca9a7340" />
14
    <TERMRELATION DTYPE="TermTreeNode" TERMTYPE="FE" ID="7" TERM_ID="913" PARENT_ID="[null]" TREEINDEX="#t2#7#" SORTINDEX="0" GRAPH_ID="5002" UUID="bb2c2d69-2b36-4f21-9374-b375ada8448c" />
13 15

  
14 16
</dataset>

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)