Project

General

Profile

Download (19.2 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2008 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*/
6

    
7
package eu.etaxonomy.cdm.test.integration;
8

    
9
import java.sql.ResultSet;
10
import java.sql.SQLException;
11
import java.util.ArrayList;
12
import java.util.HashMap;
13
import java.util.List;
14
import java.util.Map;
15

    
16
import org.apache.log4j.Logger;
17
import org.springframework.transaction.TransactionStatus;
18

    
19
import eu.etaxonomy.cdm.api.application.CdmApplicationController;
20
import eu.etaxonomy.cdm.config.AccountStore;
21
import eu.etaxonomy.cdm.database.CdmDataSource;
22
import eu.etaxonomy.cdm.database.DbSchemaValidation;
23
import eu.etaxonomy.cdm.database.ICdmDataSource;
24
import eu.etaxonomy.cdm.io.common.Source;
25
import eu.etaxonomy.cdm.model.agent.AgentBase;
26
import eu.etaxonomy.cdm.model.common.CdmBase;
27
import eu.etaxonomy.cdm.model.common.LanguageString;
28
import eu.etaxonomy.cdm.model.name.NomenclaturalStatus;
29
import eu.etaxonomy.cdm.model.name.TypeDesignationBase;
30
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
31
import eu.etaxonomy.cdm.model.reference.Reference;
32
import eu.etaxonomy.cdm.model.term.DefinedTermBase;
33
import eu.etaxonomy.cdm.model.term.Representation;
34
import eu.etaxonomy.cdm.model.term.TermVocabulary;
35

    
36
/**
37
 * @author a.babadshanjan
38
 * @since 15.09.2008
39
 */
40
public class TestCdmDbComparator {
41

    
42
	private static final String sourceDbOne = "cdm_test_jaxb";
43
	private static final String sourceDbTwo = "cdm_test_jaxb2";
44

    
45
	private static final ICdmDataSource sourceOne = TestCdmDbComparator.CDM_DB(sourceDbOne);
46
	private static final ICdmDataSource sourceTwo = TestCdmDbComparator.CDM_DB(sourceDbTwo);
47

    
48
	private static final String server = "192.168.2.10";
49
	private static final String username = "edit";
50

    
51
	public static ICdmDataSource CDM_DB(String dbname) {
52

    
53
	String password = AccountStore.readOrStorePassword(dbname, server, username, null);
54
	ICdmDataSource datasource = CdmDataSource.NewMySqlInstance(server, dbname, username, password);
55
	return datasource;
56
	}
57

    
58
    private final int MAX_ROWS = 60000;
59
    private final int MAX_TABLES = 150;
60

    
61
    private static final Logger logger = Logger.getLogger(TestCdmDbComparator.class);
62

    
63
	private static final String[] table_list = {
64
//			"Address",
65
			"AgentBase",
66
//			"Agent_Agent",
67
//			"Agent_Annotation",
68
//			"Agent_DefinedTermBase",
69
//			"Agent_Extension",
70
//			"Agent_InstitutionalMembership",
71
//			"Agent_Marker",
72
//			"Agent_Media",
73
//			"Agent_OriginalSource",
74
//			"Agent_Rights",
75
			"Annotation",
76
//			"CDM_VIEW",
77
//			"CDM_VIEW_CDM_VIEW",
78
//			"Collection",
79
//			"Collection_Annotation",
80
//			"Collection_Extension",
81
//			"Collection_Marker",
82
//			"Collection_Media",
83
//			"Collection_OriginalSource",
84
//			"Collection_Rights",
85
//			"Contact",
86
			"DefinedTermBase",
87
//			"DefinedTermBase_DefinedTermBase",
88
//			"DefinedTermBase_Media",
89
//			"DefinedTermBase_Representation",
90
//			"DefinedTermBase_TermVocabulary",
91
//			"DerivationEvent",
92
//			"DerivationEvent_Annotation",
93
//			"DerivationEvent_Marker",
94
			"DescriptionBase",
95
//			"DescriptionBase_Annotation",
96
//			"DescriptionBase_DefinedTermBase",
97
//			"DescriptionBase_DescriptionElementBase",
98
//			"DescriptionBase_Extension",
99
//			"DescriptionBase_Marker",
100
//			"DescriptionBase_OriginalSource",
101
//			"DescriptionBase_Rights",
102
			"DescriptionElementBase",
103
//			"DescriptionElementBase_Annotation",
104
//			"DescriptionElementBase_DefinedTermBase",
105
//			"DescriptionElementBase_LanguageString",
106
//			"DescriptionElementBase_Marker",
107
//			"DescriptionElementBase_Media",
108
//			"DescriptionElementBase_StatisticalMeasurementValue",
109
//			"DeterminationEvent",
110
//			"DeterminationEvent_Annotation",
111
//			"DeterminationEvent_Marker",
112
//			"Extension",
113
			"FeatureNode",
114
			"FeatureTree",
115
//			"FeatureTree_Representation",
116
//			"GatheringEvent",
117
//			"GatheringEvent_Annotation",
118
//			"GatheringEvent_Marker",
119
			"HomotypicalGroup",
120
//			"HomotypicalGroup_Annotation",
121
//			"HomotypicalGroup_Marker",
122
//			"HybridRelationship",
123
//			"HybridRelationship_Annotation",
124
//			"HybridRelationship_Marker",
125
//			"InstitutionalMembership",
126
			"LanguageString",
127
//			"Locus",
128
			"Marker",
129
			"Media",
130
			"MediaRepresentation",
131
			"MediaRepresentationPart",
132
//			"Media_Annotation",
133
//			"Media_Marker",
134
//			"Media_Rights",
135
//			"Media_Sequence",
136
//			"MediaKey_CoveredTaxon",
137
			"NameRelationship",
138
//			"NameRelationship_Annotation",
139
//			"NameRelationship_Marker",
140
			"NomenclaturalStatus",
141
//			"NomenclaturalStatus_Annotation",
142
//			"NomenclaturalStatus_Marker",
143
			"OriginalSource",
144
//			"OriginalSource_Annotation",
145
//			"OriginalSource_Marker",
146
//			"Person_Keyword",
147
			"Reference",
148
//			"ReferenceBase_Annotation",
149
//			"ReferenceBase_Extension",
150
//			"ReferenceBase_Marker",
151
//			"ReferenceBase_Media",
152
//			"ReferenceBase_OriginalSource",
153
//			"ReferenceBase_Rights",
154
//			"RelationshipTermBase_inverseRepresentation",
155
			"Representation",
156
//			"Rights",
157
//			"Sequence",
158
//			"Sequence_Annotation",
159
//			"Sequence_Extension",
160
//			"Sequence_Marker",
161
//			"Sequence_Media",
162
//			"Sequence_OriginalSource",
163
//			"Sequence_ReferenceBase",
164
//			"Sequence_Rights",
165
			"SpecimenOrObservationBase",
166
//			"SpecimenOrObservationBase_Annotation",
167
//			"SpecimenOrObservationBase_DerivationEvent",
168
//			"SpecimenOrObservationBase_Extension",
169
//			"SpecimenOrObservationBase_Marker",
170
//			"SpecimenOrObservationBase_Media",
171
//			"SpecimenOrObservationBase_OriginalSource",
172
//			"SpecimenOrObservationBase_Rights",
173
//			"StateData",
174
//			"StateData_DefinedTermBase",
175
//			"StatisticalMeasurementValue",
176
//			"StatisticalMeasurementValue_DefinedTermBase",
177
			"TaxonBase",
178
//			"TaxonBase_Annotation",
179
//			"TaxonBase_Extension",
180
//			"TaxonBase_Marker",
181
//			"TaxonBase_OriginalSource",
182
//			"TaxonBase_Rights",
183
			"TaxonName",
184
//			"TaxonName_Annotation",
185
//			"TaxonName_Extension",
186
//			"TaxonName_HybridRelationship",
187
//			"TaxonName_Marker",
188
//			"TaxonName_NomenclaturalStatus",
189
//			"TaxonName_OriginalSource",
190
//			"TaxonName_Rights",
191
//			"TaxonName_TypeDesignationBase",
192
			"TaxonRelationship",
193
//			"TaxonRelationship_Annotation",
194
//			"TaxonRelationship_Marker",
195
			"TermVocabulary",
196
//			"TermVocabulary_Representation",
197
			"TypeDesignationBase",
198
//			"TypeDesignationBase_Annotation",
199
//			"TypeDesignationBase_Marker",
200
	};
201

    
202
//	@Autowired
203
//	@Qualifier("cdmDao")
204
//	private ICdmEntityDao cdmDao;
205

    
206
//	@Autowired
207
//	protected void setDao(ICdmEntityDao dao) {
208
//		logger.debug("setting DAO");
209
//		this.cdmDao = dao;
210
//	}
211

    
212
//	@Autowired
213
//	private SessionFactory factory;
214
//
215
//	protected Session getSession(){
216
//	Session session = factory.getCurrentSession();
217
//	return session;
218
//}
219

    
220
//    public ResultSet getResultSet (String query){
221
//    	ResultSet rs;
222
//    	try {
223
//            this.getConnection(); //establish connection
224
//        	if (query == null){
225
//        		return null;
226
//        	}
227
//            mStmt = mConn.createStatement();
228
//            rs = mStmt.executeQuery(query);
229
//            return rs;
230
//        }catch(SQLException e){
231
//            logger.error("Problems when creating Resultset for query \n  " + query + " \n" + "Exception: " + e);
232
//            return null;
233
//        }
234
//    }
235

    
236
	private Map<String, List<String>> doLoadDataFromDb(String dbname, Source source) {
237

    
238
		Map<String, List<String>> dbTables = new HashMap<String, List<String>>();
239

    
240
		logger.info("Loading data from DB " + dbname);
241

    
242
		CdmApplicationController appCtr = null;
243

    
244

    
245
		String password = AccountStore.readOrStorePassword(dbname, server, username, null);
246

    
247
		DbSchemaValidation dbSchemaValidation = DbSchemaValidation.VALIDATE;
248
		ICdmDataSource datasource = CdmDataSource.NewMySqlInstance(server, dbname, username, password);
249
		appCtr = CdmApplicationController.NewInstance(datasource, dbSchemaValidation, true);
250

    
251

    
252
    	TransactionStatus txStatus = appCtr.startTransaction(true);
253

    
254
    	// get data from DB
255

    
256
    	try {
257

    
258
    		dbTables = retrieveAllTables(appCtr);
259

    
260
    	} catch (Exception e) {
261
    		logger.error("error setting data");
262
    		e.printStackTrace();
263
    	}
264
    	appCtr.commitTransaction(txStatus);
265
    	appCtr.close();
266

    
267
    	return dbTables;
268

    
269
    }
270

    
271
	private Map<String, List<CdmBase>> doLoadDataFromDb_(String dbname) {
272

    
273
		Map<String, List<CdmBase>> dbTables = new HashMap<String, List<CdmBase>>();
274

    
275
		logger.info("Loading data from DB " + dbname);
276

    
277
		CdmApplicationController appCtr = null;
278

    
279

    
280
		String password = AccountStore.readOrStorePassword(dbname, server, username, null);
281

    
282
		DbSchemaValidation dbSchemaValidation = DbSchemaValidation.VALIDATE;
283
		ICdmDataSource datasource = CdmDataSource.NewMySqlInstance(server, dbname, username, password);
284
		appCtr = CdmApplicationController.NewInstance(datasource, dbSchemaValidation, true);
285

    
286

    
287
    	TransactionStatus txStatus = appCtr.startTransaction(true);
288

    
289
    	// get data from DB
290

    
291
    	try {
292

    
293
    		dbTables = retrieveAllTables_(appCtr);
294

    
295
    	} catch (Exception e) {
296
    		logger.error("error setting data");
297
    		e.printStackTrace();
298
    	}
299
    	appCtr.commitTransaction(txStatus);
300
    	appCtr.close();
301

    
302
    	return dbTables;
303

    
304
    }
305

    
306
	private Map<String, List<String>> doLoadDataFromDb__(String dbname, Source source) {
307

    
308
		Map<String, List<String>> dbTables = new HashMap<String, List<String>>();
309

    
310
		logger.info("Loading data from DB " + dbname);
311

    
312
    	try {
313

    
314
    		dbTables = retrieveAllTables__(source);
315

    
316
    	} catch (Exception e) {
317
    		logger.error("error setting data");
318
    		e.printStackTrace();
319
    	}
320
    	return dbTables;
321

    
322
    }
323

    
324
    private Map<String, List<CdmBase>> retrieveAllTables_(CdmApplicationController appCtr) {
325

    
326
		Map<String, List<CdmBase>> tables_ = new HashMap<String, List<CdmBase>>(table_list.length);
327

    
328
		//List<Agent> agents = appCtr.getAgentService().getAllAgents(MAX_ROWS, 0);
329

    
330
		try {
331
			//get data from database
332
			for (int i = 0; i < table_list.length; i++) {
333

    
334
	    		logger.debug("Retrieving table '" + table_list[i] + "'");
335
	    		System.out.println("Retrieving table '" + table_list[i] + "'");
336

    
337
				List<CdmBase> rows = new ArrayList<>(MAX_ROWS);
338

    
339
//				rows = appCtr.getCommonService().count (table_list[i], MAX_ROWS, 0);
340

    
341
    			tables_.put(table_list[i], rows);
342

    
343
			}
344

    
345
		} catch (Exception e) {
346
    		logger.error("error retrieving data");
347
    		e.printStackTrace();
348
		}
349
//		return tables;
350
		return tables_;
351
    }
352

    
353
    private Map<String, List<String>> retrieveAllTables___(Source source) {
354

    
355
		Map<String, List<String>> tables = new HashMap<>(table_list.length);
356

    
357
		try {
358
			//get data from database
359
			for (int i = 0; i < table_list.length; i++) {
360

    
361
				List<String> rows = new ArrayList<>(MAX_ROWS);
362

    
363
//					Session session = factory.getCurrentSession();
364

    
365
//					if ( sessionObject != null ) {
366
//						session.update(sessionObject);
367
//					}
368
//					Query query = session.createQuery("select term from DefinedTermBase term join fetch term.representations representation where representation.label = :label");
369
//					query.setParameter("label", queryString);
370

    
371
//					Query query = session.createQuery("select from " + table_list[i]);
372
//				    rows = query.list();
373

    
374
				//FIXME: NullPointerException (cdmDao is null)
375
				    //rows = cdmDao.list(MAX_ROWS, 0);
376
					tables.put(table_list[i], rows);
377

    
378
				}
379

    
380
		} catch (Exception e) {
381
    		logger.error("error retrieving data");
382
    		e.printStackTrace();
383
		}
384
		return tables;
385
    }
386

    
387
    private Map<String, List<String>> retrieveAllTables__(Source source) {
388

    
389
//		IImportConfigurator config = new BerlinModelImportConfigurator;
390
//		BerlinModelImportConfigurator bmiConfig = (BerlinModelImportConfigurator)config;
391
//		Source source = bmiConfig.getSource();
392
//		ResultSet rs = berlinModelSource.getResultSet();
393

    
394
		Map<String, List<String>> tables = new HashMap<>(table_list.length);
395

    
396
		try {
397
			//get data from database
398
			for (int i = 0; i < table_list.length; i++) {
399
				String strQuery =
400
					" SELECT * FROM " + table_list[i];
401
				logger.debug("SQL Statement: " +  strQuery);
402
				//ResultSet rs = berlinModelSource.getResultSet();
403
				//ResultSet rs = source.getResultSet(strQuery) ;
404
				ResultSet rs = source.getResultSet(strQuery) ;
405
				List<String> rows = new ArrayList<>(MAX_ROWS);
406

    
407
				while (rs.next()) {
408
					rows.add(rs.toString());
409
				}
410
				tables.put(table_list[i], rows);
411
			}
412
		} catch (SQLException e) {
413
			logger.error("SQLException:" +  e);
414
		}
415
		return tables;
416
    }
417

    
418
    private Map<String, List<String>> retrieveAllTables(CdmApplicationController appCtr) {
419

    
420
		Map<String, List<String>> tables = new HashMap<>(table_list.length);
421

    
422
		List<String> agentTableContent = new ArrayList<>(MAX_ROWS);
423
		List<? extends AgentBase> agents = appCtr.getAgentService().list(null,MAX_ROWS, 0,null,null);
424
		for (AgentBase agent: agents ) {
425
			//TODO: Want the entire row as string not just toString() of the object.
426
			agentTableContent.add(agent.toString());
427
		}
428
		tables.put("agents", agentTableContent);
429

    
430
		//List<Annotation> annotations = appCtr.getTermService().getAllAnnotations(MAX_ROWS, 0);
431

    
432
		List<String> definedTermBaseTableContent = new ArrayList<>(MAX_ROWS);
433
		List<DefinedTermBase> definedTermBases = appCtr.getTermService().list(null,MAX_ROWS, 0,null,null);
434
		for (DefinedTermBase definedTermBase: definedTermBases ) {
435
			definedTermBaseTableContent.add(definedTermBase.toString());
436
		}
437
		tables.put("definedTermBases", definedTermBaseTableContent);
438

    
439
		//List<DescriptionBase> descriptionBases = appCtr.getDescriptionService().getAllDescriptionBases(MAX_ROWS, 0);
440
		//List<DescriptionElementBase> descriptionElementBases = appCtr.getDescriptionService().getAllDescriptionElementBases(MAX_ROWS, 0);
441
		//List<HomotypicalGroup> homotypicalGroups = appCtr.getNameService().getAllHomotypicalGroups(MAX_ROWS, 0);
442
		List<LanguageString> languageStrings = appCtr.getTermService().getAllLanguageStrings(MAX_ROWS, 0);
443
		//List<Marker> markers = appCtr.getTermService().getAllMarkers(MAX_ROWS, 0);
444
		//List<NameRelationship> nameRelationships = appCtr.getNameService().getAllNameRelationships(MAX_ROWS, 0);
445
		List<NomenclaturalStatus> nomenclaturalStatus = appCtr.getNameService().getAllNomenclaturalStatus(MAX_ROWS, 0);
446
		//List<OriginalSource> originalSources = appCtr.getNameService().getAllOriginalSources(MAX_ROWS, 0);
447
		List<Reference> references = appCtr.getReferenceService().list(null,MAX_ROWS, 0,null,null);
448
		List<Representation> representations = appCtr.getTermService().getAllRepresentations(MAX_ROWS, 0);
449
		List<SpecimenOrObservationBase> specimenOrObservationBases = appCtr.getOccurrenceService().list(null,MAX_ROWS, 0,null,null);
450
//		List<TaxonBase> taxonBases = appCtr.getTaxonService().getAllTaxa(MAX_ROWS, 0);
451
//		List<TaxonName> taxonNames = appCtr.getNameService().getAllNames(MAX_ROWS, 0);
452
		//List<TaxonRelationship> taxonRelationships = appCtr.getTaxonService().getAllTaxonRelationships(MAX_ROWS, 0);
453
		List<TermVocabulary> termVocabularies = appCtr.getVocabularyService().list(null,MAX_ROWS, 0,null,null);
454
		List<TypeDesignationBase<?>> typeDesignationBases = appCtr.getNameService().getAllTypeDesignations(MAX_ROWS, 0);
455

    
456
		return tables;
457
	}
458

    
459
     private void compareTables(String tableName, List<CdmBase> tablesDbOne, List<CdmBase> tablesDbTwo) {
460

    
461
		int tableOneSize = tablesDbOne.size();
462
		int tableTwoSize = tablesDbTwo.size();
463
		int tableMinSize = 0;
464
		int tableMaxSize = 0;
465

    
466
		if (tableOneSize != tableTwoSize) {
467
			logger.warn("Table '" + tableName + "', Rows differ: " + tablesDbOne.size() + ", " + tablesDbTwo.size());
468
            tableMinSize = Math.min(tableOneSize, tableTwoSize);
469
            tableMaxSize = Math.max(tableOneSize, tableTwoSize);
470
		} else {
471
			logger.info("Table '" + tableName + "': " + tablesDbOne.size());
472
		}
473

    
474
		int different = 0;
475

    
476
		try {
477
		for (int i = 0; i < tableMinSize; i++) {
478

    
479
			CdmBase obj1 = tablesDbOne.get(i);
480
			CdmBase obj2 = tablesDbTwo.get(i);
481

    
482
			// This compares only whether both tables contain the same objects.
483
			// It doesn't check whether all field values are the same.
484
			logger.debug("Row # " + i + ":");
485
			if (obj1.equals(obj2) != true) {
486
				different++;
487
				logger.debug("Table 1 = " + obj1);
488
				logger.debug("Table 2 = " + obj2);
489
			} else {
490
				logger.debug("Entry = " + obj1);
491
			}
492
		}
493
		if (different > 0) {
494
			logger.info("# Rows identical: " + (tableMaxSize - different));
495
			logger.warn("# Rows different: " + different);
496
		}
497
		} catch (org.hibernate.LazyInitializationException e){
498
			logger.error("LazyInitializationException");
499
		}
500
	}
501

    
502
    	private void doCompareDatabases(Map<String, List<CdmBase>> tablesDbOne, Map<String, List<CdmBase>> tablesDbTwo) {
503

    
504
		logger.debug("# Tables in DB 1: " + tablesDbOne.size());
505
		logger.debug("# Tables in DB 2: " + tablesDbTwo.size());
506

    
507
		for (String tableName: tablesDbOne.keySet()) {
508

    
509
			logger.info("Comparing table '" + tableName + "'");
510

    
511
			List<CdmBase> dbOneTableRows = new ArrayList<>();
512
			List<CdmBase> dbTwoTableRows = new ArrayList<>();
513

    
514
			dbOneTableRows = tablesDbOne.get(tableName);
515
			dbTwoTableRows = tablesDbTwo.get(tableName);
516

    
517
//			Collections.sort(dbOneTableRows);
518
//			Collections.sort(dbTwoTableRows);
519

    
520
			int different = 0;
521
			int tableSize = dbOneTableRows.size();
522

    
523
			for (int i = 0; i < tableSize; i++) {
524

    
525
//				String str1 = dbOneTableRows.get(i);
526
//				String str2 = dbTwoTableRows.get(i);
527
				CdmBase str1 = dbOneTableRows.get(i);
528
				CdmBase str2 = dbTwoTableRows.get(i);
529

    
530
				if (str1.equals(str2) != true) {
531

    
532
					different++;
533
					logger.debug("Rows differ:");
534
					logger.debug("Table 1 Row = " + str1);
535
					logger.debug("Table 2 Row = " + str2);
536

    
537
				}
538
				i++;
539
			}
540
			if (different > 0) {
541
				logger.info("Compared table '" + tableName + "':");
542
				logger.info("# Rows total: " + tableSize);
543
				logger.info("# Rows identical: " + (tableSize - different));
544
				logger.warn("# Rows different: " + different);
545
			}
546
		}
547
		logger.info("End database comparison");
548
	}
549

    
550
//	private void test_(){
551
//
552
//		Map<String, List<CdmBase>> tablesDbOne = doLoadDataFromDb_(sourceDbOne);
553
//		Map<String, List<CdmBase>> tablesDbTwo = doLoadDataFromDb_(sourceDbTwo);
554
//	    doCompareDatabases(tablesDbOne, tablesDbTwo);
555
//
556
//	}
557

    
558
	private void test(){
559

    
560
		CdmApplicationController appCtrOne = null;
561
		CdmApplicationController appCtrTwo = null;
562
		logger.info("Comparing '" + sourceDbOne + "' and '" + sourceDbTwo + "'");
563

    
564
		try {
565
			appCtrOne = CdmApplicationController.NewInstance(sourceOne, DbSchemaValidation.VALIDATE, true);
566
			appCtrTwo = CdmApplicationController.NewInstance(sourceTwo, DbSchemaValidation.VALIDATE, true);
567

    
568
		} catch (Exception e) {
569
			logger.error("Error creating application controller");
570
			e.printStackTrace();
571
			System.exit(1);
572
			return;
573
		}
574

    
575
		try {
576
			//get data from database
577
	    	TransactionStatus txStatOne = appCtrOne.startTransaction(true);
578
	    	TransactionStatus txStatTwo = appCtrTwo.startTransaction(true);
579
			for (int i = 0; i < table_list.length; i++) {
580

    
581
				List<CdmBase> rowsDbOne = new ArrayList<>(MAX_ROWS);
582
				List<CdmBase> rowsDbTwo = new ArrayList<>(MAX_ROWS);
583
//				rowsDbOne = appCtrOne.getCommonService().count(table_list[i], MAX_ROWS, 0);
584
//				rowsDbTwo = appCtrTwo.getCommonService().count(table_list[i], MAX_ROWS, 0);
585
				compareTables(table_list[i], rowsDbOne, rowsDbTwo);
586
			}
587
	    	appCtrTwo.commitTransaction(txStatTwo);
588
	    	appCtrOne.commitTransaction(txStatOne);
589
	    	//java.lang.IllegalStateException: Cannot deactivate transaction synchronization - not active
590
	    	appCtrOne.close();
591
	    	appCtrTwo.close();
592
			logger.info("End database comparison");
593

    
594
		} catch (Exception e) {
595
    		logger.error("Error retrieving or comparing data");
596
    		e.printStackTrace();
597
		}
598
	}
599

    
600
	/**
601
	 * @param args
602
	 */
603
	public static void  main(String[] args) {
604
		TestCdmDbComparator diff = new TestCdmDbComparator();
605
    	diff.test();
606
	}
607
}
    (1-1/1)