1 |
|
package org.apache.torque.mojo; |
2 |
|
|
3 |
|
import java.util.Collections; |
4 |
|
import java.util.Comparator; |
5 |
|
import java.util.Vector; |
6 |
|
|
7 |
|
import org.apache.torque.util.TransactionComparator; |
8 |
|
import org.junit.Test; |
9 |
|
import org.kuali.db.Transaction; |
10 |
|
|
|
|
| 0% |
Uncovered Elements: 21 (21) |
Complexity: 3 |
Complexity Density: 0.17 |
|
11 |
|
public class TransactionComparatorTest { |
12 |
|
|
|
|
| 0% |
Uncovered Elements: 13 (13) |
Complexity: 1 |
Complexity Density: 0.08 |
4
-
|
|
13 |
0
|
@Test... |
14 |
|
public void testComparator() { |
15 |
0
|
Comparator<Transaction> comparator = new TransactionComparator<Transaction>("ks-embedded-db"); |
16 |
0
|
Vector<Transaction> transactions = new Vector<Transaction>(); |
17 |
0
|
transactions.add(getTransaction("003.sql")); |
18 |
0
|
transactions.add(getTransaction("004.sql")); |
19 |
0
|
transactions.add(getTransaction("001.sql")); |
20 |
0
|
transactions.add(getTransaction("sql/oracle/ks-embedded-db.sql")); |
21 |
0
|
transactions.add(getTransaction("002.sql")); |
22 |
0
|
transactions.add(getTransaction("sql/oracle/ks-embedded-db-constraints.sql")); |
23 |
0
|
transactions.add(getTransaction("001.sql")); |
24 |
0
|
transactions.add(getTransaction("000.sql")); |
25 |
0
|
transactions.add(getTransaction("zzz000.sql")); |
26 |
0
|
Collections.sort(transactions, comparator); |
27 |
0
|
showTransactions(transactions); |
28 |
|
} |
29 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
30 |
0
|
protected void showTransactions(Vector<Transaction> transactions) {... |
31 |
0
|
for (Transaction t : transactions) { |
32 |
0
|
System.out.println(t.getResourceLocation()); |
33 |
|
} |
34 |
|
} |
35 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
36 |
0
|
protected Transaction getTransaction(String location) {... |
37 |
0
|
Transaction t = new Transaction(); |
38 |
0
|
t.setResourceLocation(location); |
39 |
0
|
return t; |
40 |
|
} |
41 |
|
} |