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