From 82caf7c825cb6eb6aa97131534e2214cad12c8ba Mon Sep 17 00:00:00 2001 From: James Ahlborn Date: Fri, 17 Jun 2011 03:06:16 +0000 Subject: add a few util methods related to indexes and joins git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@566 f203690c-595d-4dc9-a70b-905162fa7fd2 --- test/src/java/com/healthmarketscience/jackcess/IndexTest.java | 6 ++++++ test/src/java/com/healthmarketscience/jackcess/JoinerTest.java | 5 ++++- 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/src/java/com/healthmarketscience/jackcess/IndexTest.java b/test/src/java/com/healthmarketscience/jackcess/IndexTest.java index 21e4fd9..8f078f6 100644 --- a/test/src/java/com/healthmarketscience/jackcess/IndexTest.java +++ b/test/src/java/com/healthmarketscience/jackcess/IndexTest.java @@ -88,14 +88,20 @@ public class IndexTest extends TestCase { for (final TestDB testDB : SUPPORTED_DBS_TEST_FOR_READ) { Table table = open(testDB).getTable("Table1"); Map foundPKs = new HashMap(); + Index pkIndex = null; for(Index index : table.getIndexes()) { foundPKs.put(index.getColumns().iterator().next().getName(), index.isPrimaryKey()); + if(index.isPrimaryKey()) { + pkIndex= index; + + } } Map expectedPKs = new HashMap(); expectedPKs.put("A", Boolean.TRUE); expectedPKs.put("B", Boolean.FALSE); assertEquals(expectedPKs, foundPKs); + assertSame(pkIndex, table.getPrimaryKeyIndex()); } } diff --git a/test/src/java/com/healthmarketscience/jackcess/JoinerTest.java b/test/src/java/com/healthmarketscience/jackcess/JoinerTest.java index 1f2961c..87f70fd 100644 --- a/test/src/java/com/healthmarketscience/jackcess/JoinerTest.java +++ b/test/src/java/com/healthmarketscience/jackcess/JoinerTest.java @@ -83,7 +83,8 @@ public class JoinerTest extends TestCase { { final Set colNames = new HashSet( Arrays.asList("id", "data")); - + + Joiner revJoin = join.createReverse(); for(Map row : join.getFromTable()) { Integer id = (Integer)row.get("id"); @@ -98,6 +99,8 @@ public class JoinerTest extends TestCase { if(!expectedRows.isEmpty()) { assertEquals(expectedRows.get(0), join.findFirstRow(row)); + + assertEquals(row, revJoin.findFirstRow(expectedRows.get(0))); } else { assertNull(join.findFirstRow(row)); } -- cgit v1.2.3