Project

General

Profile

Revision eda8c594

IDeda8c59417fa9b2f6d2e0cccf9dd994f5697383d
Parent 8f96afd0
Child ab9e1654

Added by Andreas Müller over 1 year ago

cleanup

View differences:

cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/database/update/v50_55/SchemaUpdater_50_55.java
33 33
/**
34 34
 * @author a.mueller
35 35
 * @date 09.06.2017
36
 *
37 36
 */
38 37
public class SchemaUpdater_50_55 extends SchemaUpdaterBase {
39 38

  
cdmlib-persistence/src/test/java/eu/etaxonomy/cdm/database/CdmPersistentDataSourceTest.java
5 5
*
6 6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7 7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/ 
8
*/
9 9

  
10 10
package eu.etaxonomy.cdm.database;
11 11

  
......
44 44
public class CdmPersistentDataSourceTest {
45 45
	@SuppressWarnings("unused")
46 46
	private static final Logger logger = Logger.getLogger(CdmPersistentDataSourceTest.class);
47
	
47

  
48 48
	private static CdmPersistentDataSource dataSource;
49
	
49

  
50 50
	/**
51 51
	 * @throws java.lang.Exception
52 52
	 */
......
96 96
		assertFalse(CdmPersistentDataSource.exists(dataSourceString));
97 97

  
98 98
	}
99
	
99

  
100 100
//********************** TESTS ***********************************************/
101 101

  
102 102
	@Test
103 103
	public void testDummy() {
104 104
		assertEquals(1,1);
105 105
	}
106
	
106

  
107 107
	/**
108 108
	 * Test method for {@link eu.etaxonomy.cdm.database.CdmPersistentDataSource#NewDefaultInstance()}.
109 109
	 */
......
187 187
		DbSchemaValidation hbm2dll = DbSchemaValidation.CREATE;
188 188
		BeanDefinition beanDef = dataSource.getHibernatePropertiesBean(hbm2dll);
189 189
		PropertyValues propValues = beanDef.getPropertyValues();
190
		String propName =  "properties"; 
190
		String propName =  "properties";
191 191
		PropertyValue propValue =  propValues.getPropertyValue(propName);
192 192
		assertNotNull(propValue);
193 193
		assertTrue( propValue.getValue() instanceof Properties);
194
		
194

  
195 195
		Properties properties = (Properties)propValue.getValue();
196 196
		assertEquals(hbm2dll.toString(), properties.getProperty("hibernate.hbm2ddl.auto"));
197 197
		assertEquals(dataSource.getDatabaseType().getHibernateDialectCanonicalName(), properties.getProperty("hibernate.dialect"));
......
202 202
		//null
203 203
		beanDef = dataSource.getHibernatePropertiesBean(null);
204 204
		propValues = beanDef.getPropertyValues();
205
		propName =  "properties"; 
205
		propName =  "properties";
206 206
		propValue =  propValues.getPropertyValue(propName);
207 207
		assertNotNull(propValue);
208 208
		assertTrue( propValue.getValue() instanceof Properties);
209
		
209

  
210 210
		properties = (Properties)propValue.getValue();
211 211
		assertEquals(DbSchemaValidation.VALIDATE.toString(), properties.getProperty("hibernate.hbm2ddl.auto"));
212 212
	}
......
221 221
		boolean formatSql = false;
222 222
		boolean registerSearchListener = false;
223 223
		Class<? extends RegionFactory> cacheProviderClass = NoCachingRegionFactory.class;
224
		
224

  
225 225
		BeanDefinition beanDef = dataSource.getHibernatePropertiesBean(hbm2dll, showSql, formatSql, registerSearchListener, cacheProviderClass);
226 226
		PropertyValues propValues = beanDef.getPropertyValues();
227
		String propName =  "properties"; 
227
		String propName =  "properties";
228 228
		PropertyValue propValue =  propValues.getPropertyValue(propName);
229 229
		assertNotNull(propValue);
230 230
		assertTrue( propValue.getValue() instanceof Properties);
231
		
231

  
232 232
		Properties properties = (Properties)propValue.getValue();
233 233
		assertEquals(hbm2dll.toString(), properties.getProperty("hibernate.hbm2ddl.auto"));
234 234
		assertEquals(dataSource.getDatabaseType().getHibernateDialectCanonicalName(), properties.getProperty("hibernate.dialect"));
......
254 254
	public void testSaveStringDatabaseTypeEnumStringStringIntStringString() {
255 255
		String dataSourceString = "tmp";
256 256
		assertFalse(CdmPersistentDataSource.exists(dataSourceString));
257
		
257

  
258 258
		DatabaseTypeEnum databaseType = DatabaseTypeEnum.SqlServer2005;
259 259
		String servername = "server";
260 260
		String db = "database";
261 261
		String username = "username";
262 262
		String password = "password";
263 263
		int port = 1234;
264
		
264

  
265 265
		ICdmDataSource dataSource = CdmDataSource.NewInstance(databaseType, servername, db, port, username, password);
266
		
266

  
267 267
		CdmPersistentDataSource.save(dataSourceString, dataSource);
268 268
		assertTrue(CdmPersistentDataSource.exists(dataSourceString));
269
		
269

  
270 270
		CdmPersistentDataSource loadedDataSource = null;
271 271
		try {
272 272
			loadedDataSource = CdmPersistentDataSource.NewInstance(dataSourceString);
......
308 308
	 */
309 309
	@Test
310 310
	public void testGetAllDataSources() {
311
		//assertEquals(6, CdmPersistentDataSource.getAllDataSources().size());  //does not run for all orders of tests of this class 
311
		//assertEquals(6, CdmPersistentDataSource.getAllDataSources().size());  //does not run for all orders of tests of this class
312 312
		assertEquals("default", CdmPersistentDataSource.getAllDataSources().get(0).getName());
313 313
	}
314 314

  
......
339 339
		} catch (IOException e) {
340 340
			fail("Exception occurred in datasource input stream read");
341 341
		}
342
		
342

  
343 343
	}
344 344

  
345 345
	/**

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)