Project

General

Profile

Revision bae5b07c

IDbae5b07cb0eb7790fc98ece0944375c06c8ab2de
Parent 0c1286dd
Child 7d363a62

Added by Andreas Müller about 2 years ago

ref #3734 fix compilation issue

View differences:

cdmlib-persistence/src/test/java/eu/etaxonomy/cdm/database/update/CdmUpdaterTest.java
24 24
import eu.etaxonomy.cdm.database.DatabaseTypeEnum;
25 25
import eu.etaxonomy.cdm.database.ICdmDataSource;
26 26
import eu.etaxonomy.cdm.database.update.v24_25.SchemaUpdater_24_25;
27
import eu.etaxonomy.cdm.database.update.v24_25.TermUpdater_24_25;
28 27
import eu.etaxonomy.cdm.model.metadata.CdmMetaData;
29 28

  
30 29
/**
......
142 141
		Assert.assertEquals(CdmMetaData.getDbSchemaVersion(), currentUpdater.getTargetVersion());
143 142
	}
144 143

  
145
	@Test
146
	public void testRecursiveCallTermUpdater(){
147
		CdmUpdater updater = new CdmUpdater();
148
		ITermUpdater currentUpdater = null;
149
		try {
150
			Method method =  CdmUpdater.class.getDeclaredMethod("getCurrentTermUpdater");
151
			method.setAccessible(true);
152
			currentUpdater = (ITermUpdater)method.invoke(updater);
153
		} catch (Exception e) {
154
			Assert.fail("CdmUpdater.getCurrentTermUpdater not found:" + e.getMessage());;
155
		}
156
		Assert.assertNotNull("Current Updater must not be null", currentUpdater);
157
		ITermUpdater lastUpdater = null;
158
		ITermUpdater tmpUpdater = currentUpdater;
159
		int i = 0;
160
		//get very first term updater available (= TermUpdater_24_25) by recursive call to getPreviousUpdater
161
		while (tmpUpdater.getPreviousUpdater() != null && i++<1000){
162
			tmpUpdater = tmpUpdater.getPreviousUpdater();
163
			lastUpdater = tmpUpdater;
164
		}
165

  
166
		Assert.assertEquals(TermUpdater_24_25.class, lastUpdater.getClass());
167

  
168
		i = 0;
169
		while (tmpUpdater.getNextUpdater() != null && i++<1000){
170
			tmpUpdater = tmpUpdater.getNextUpdater();
171
			lastUpdater = tmpUpdater;
172
		}
173
		Assert.assertEquals("Current term updater not found by recursive call firstUpdater.getNextUpdater()", currentUpdater.getClass(), lastUpdater.getClass());
174

  
175
		//test correct schema version string
176
		Assert.assertEquals(CdmMetaData.getTermsVersion(), currentUpdater.getTargetVersion());
177
	}
178

  
179 144
}

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)