Skip to content

Commit cb1fec6

Browse files
author
mekjaer
committed
Merge branch 'develop' of github.com:Tightdb/tightdb_java2 into Breaking-updates
Conflicts: tightdb-java-test/src/test/java/com/tightdb/JNICloseTest.java tightdb-java-test/src/test/java/com/tightdb/JNIQueryTest.java tightdb-java-test/src/test/java/com/tightdb/JNISubtableTest.java tightdb-java-test/src/test/java/com/tightdb/JNITableInsertTest.java tightdb-java-test/src/test/java/com/tightdb/JNITransactions.java tightdb-java-test/src/test/java/com/tightdb/JNIViewSearchTest.java tightdb-java-test/src/test/java/com/tightdb/JNIViewSortTest.java tightdb-java-test/src/test/java/com/tightdb/experiment/SetIndexTest.java tightdb-java-test/src/test/java/com/tightdb/typed/GroupTest.java tightdb-java-test/src/test/java/com/tightdb/typed/TableTest.java tightdb_jni/src/com_tightdb_Group.cpp tightdb_jni/src/com_tightdb_table.cpp
2 parents 9e83637 + cb42f70 commit cb1fec6

19 files changed

Lines changed: 124 additions & 63 deletions

File tree

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ _ReSharper*/
7070

7171
# sh build.sh test
7272
/test_output
73+
<<<<<<< HEAD
7374

7475
.DS_Store
7576

@@ -89,3 +90,9 @@ doc/ref/examples/generated/com/tightdb/refdoc/*.java
8990
# generated json output in ref doc json example
9091

9192
doc/ref/examples/fromServlet
93+
94+
95+
# debian packaging
96+
/debian/tightdb-java
97+
/debian/tightdb-java-dev
98+
/debian/.mh

debian/changelog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
tightdb-java (0.0.1-2) UNRELEASED; urgency=low
2+
3+
* Support for Maven.
4+
5+
-- Kenneth Geisshirt <[email protected]> Fri, 31 May 2013 09:44:32 +0200
6+
17
tightdb-java (0.0.1-1) UNRELEASED; urgency=low
28

39
* Initial release. (Closes: #00001)

debian/control

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ Description: Fast, embedded database
1515

1616
Package: tightdb-java-dev
1717
Architecture: any
18-
Depends: ${shlibs:Depends}, ${misc:Depends}, libtightdb
18+
Depends: ${shlibs:Depends}, ${misc:Depends}, tightdb-java
1919
Description: Fast, embedded database [development]
2020
TightDB is a fast, embedded database. This is the Java interface.

debian/rules

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
#!/usr/bin/make -f
22
# -*- makefile -*-
33

4-
# Uncomment this to turn on verbose mode.
5-
#export DH_VERBOSE=1
4+
VERSION := $(shell dpkg-parsechangelog | egrep '^Version:' | cut -f 2 -d ' ')
65

76
override_dh_usrlocal:
87

@@ -22,7 +21,7 @@ tightdb-java: build
2221
dh_testroot -a
2322
dh_installdocs -a
2423
dh_installchangelogs -p$@ -a
25-
dh_strip -p$@ .a
24+
dh_strip -p$@ -a
2625
dh_compress -p$@ -s
2726
dh_fixperms -p$@ -a
2827
dh_installdeb -p$@ -a
@@ -31,14 +30,20 @@ tightdb-java: build
3130
dh_md5sums -p$@ -a
3231
dh_builddeb -p$@ -a
3332
dh_installdirs
33+
mh_installpoms -p$@
34+
mh_installjar -p$@ -l pom.xml lib/tightdb.jar
3435

3536
tightdb-java-dev: build
3637
DESTDIR=$$(pwd)/debian/tightdb-java-dev sh build.sh install
3738
dh_testdir -a
3839
dh_testroot -a
3940
dh_installdocs -a
4041
dh_installchangelogs -p$@ -a
41-
dh_strip -p$@ .a
42+
dh_strip -p$@ -a
43+
dh_installexamples -p$@ $$(pwd)/examples/ant-setup
44+
dh_installexamples -p$@ $$(pwd)/examples/intro-example
45+
dh_installexamples -p$@ $$(pwd)/examples/lib-sqlite
46+
dh_installexamples -p$@ $$(pwd)/examples/maven-setup
4247
dh_compress -p$@ -s
4348
dh_fixperms -p$@ -a
4449
dh_installdeb -p$@ -a

doc/changes.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
24-September-2013:
2+
==================
3+
+ Added com.tightdb.Table.equals() and fixed com.tightdb.Group.equals()
4+
15
23-September-2013:
26
==================
37
+ Added com.tightdb.IOException, as a RuntimeException can be thrown from all methods operating on files, like Group(file), SharedGroup(file) etc.

pom.xml

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
<modelVersion>4.0.0</modelVersion>
55

66
<groupId>com.tightdb</groupId>
7-
<artifactId>tightdb-parent</artifactId>
8-
<version>1.1.0</version>
7+
<artifactId>tightdb</artifactId>
8+
<version>0.0.1</version>
99
<packaging>pom</packaging>
1010

1111
<properties>
@@ -34,12 +34,4 @@
3434
</plugin>
3535
</plugins>
3636
</build>
37-
38-
<modules>
39-
<module>tightdb-java-core</module>
40-
<module>tightdb-java-generator</module>
41-
<module>tightdb-java-example</module>
42-
<module>tightdb-java-doc</module>
43-
<module>tightdb-java-test</module>
44-
</modules>
45-
</project>
37+
</project>

tightdb-java-core/src/main/java/com/tightdb/Group.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -248,15 +248,13 @@ public String toString() {
248248
protected native void nativeCommit(long nativeGroupPtr);
249249

250250
protected native String nativeToString(long nativeGroupPtr);
251-
252-
253-
251+
254252
public boolean equals(Object other) {
255-
if(other == null)
253+
if (other == null)
256254
return false;
257-
if(other == this)
255+
if (other == this)
258256
return true;
259-
if( ! (other instanceof Group))
257+
if (!(other instanceof Group))
260258
return false;
261259

262260
Group otherGroup = (Group) other;

tightdb-java-core/src/main/java/com/tightdb/Table.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,22 @@ public boolean isValid(){
135135

136136
protected native boolean nativeIsValid(long nativeTablePtr);
137137

138+
@Override
139+
public boolean equals(Object other) {
140+
if (this == other)
141+
return true;
142+
if (other == null)
143+
return false;
144+
// Has to work for all the typed tables as well
145+
if (!(other instanceof Table))
146+
return false;
147+
148+
Table otherTable = (Table) other;
149+
return nativeEquals(nativePtr, otherTable.nativePtr);
150+
}
151+
152+
protected native boolean nativeEquals(long nativeTablePtr, long nativeTableToComparePtr);
153+
138154
private void verifyColumnName(String name) {
139155
if (name.length() > 63) {
140156
throw new IllegalArgumentException("Column names are currently limited to max 63 characters.");

tightdb-java-core/src/main/java/com/tightdb/typed/AbstractTable.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,13 @@ public boolean isValid() {
5555
return table.isValid();
5656
}
5757

58+
@Override
59+
public boolean equals(Object other) {
60+
if (other instanceof AbstractTable)
61+
return table.equals(((AbstractTable)other).table);
62+
return false;
63+
}
64+
5865
@Override
5966
public String getName() {
6067
return getClass().getSimpleName();

tightdb-java-test/src/test/java/com/tightdb/JNITableTest.java

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,12 @@
99

1010
import static org.testng.AssertJUnit.*;
1111

12-
13-
1412
public class JNITableTest {
1513

16-
17-
Table t = new Table();
18-
19-
@BeforeMethod
20-
void init() {
14+
Table t = new Table();
15+
16+
Table createTestTable() {
17+
Table t = new Table();
2118
t.addColumn(ColumnType.BINARY, "binary"); // 0
2219
t.addColumn(ColumnType.BOOLEAN, "boolean"); // 1
2320
t.addColumn(ColumnType.DATE, "date"); // 2
@@ -27,6 +24,12 @@ void init() {
2724
t.addColumn(ColumnType.MIXED, "mixed"); // 6
2825
t.addColumn(ColumnType.STRING, "string"); // 7
2926
t.addColumn(ColumnType.TABLE, "table"); // 8
27+
return t;
28+
}
29+
30+
@BeforeMethod
31+
void init() {
32+
t = createTestTable();
3033
}
3134

3235
@Test
@@ -47,8 +50,15 @@ public void tableToString() {
4750

4851
assertEquals(expected, t.toString());
4952
}
50-
51-
53+
54+
@Test
55+
public void testGroupEquals() {
56+
Table t2 = createTestTable();
57+
assertEquals(true, t.equals(t2));
58+
t.addEmptyRow();
59+
assertEquals(false, t.equals(t2));
60+
}
61+
5262
@Test
5363
public void getNonExistingColumn() {
5464
Table t = new Table();

0 commit comments

Comments
 (0)