| Chunk |
|---|
| Conflicting content |
|---|
// Tables get detached
public class JNICloseTest {
<<<<<<< HEAD
@Test (expectedExceptions = IllegalStateException.class)
public void shouldCloseTable() {
=======
@Test (enabled=true, expectedExceptions = IllegalStateException.class)
public void shouldCloseTable() throws Throwable {
>>>>>>> ee0dca1c41f3cceb6d82339dd4607b43adab15c1
// util.setDebugLevel(1);
Table table = new Table();
table.finalize(); |
| Solution content |
|---|
// Tables get detached
public class JNICloseTest {
@Test (enabled=true, expectedExceptions = IllegalStateException.class)
public void shouldCloseTable() throws Throwable {
// util.setDebugLevel(1);
Table table = new Table();
table.finalize(); |
| File |
|---|
| JNICloseTest.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Annotation |
| Method signature |
| Chunk |
|---|
| Conflicting content |
|---|
import com.tightdb.test.TestHelper;
import org.testng.annotations.Test;
<<<<<<< HEAD
import java.util.Date;
=======
>>>>>>> ee0dca1c41f3cceb6d82339dd4607b43adab15c1
public class JNIQueryTest {
Table table; |
| Solution content |
|---|
import com.tightdb.test.TestHelper;
import org.testng.annotations.Test;
public class JNIQueryTest {
Table table; |
| File |
|---|
| JNIQueryTest.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Import |
| Chunk |
|---|
| Conflicting content |
|---|
fail("expected exception.");
} catch (UnsupportedOperationException e) {}
<<<<<<< HEAD
// Should throw
persons.getSubTable(2,0).getSubTableDefinition(2);
}
@Test(expectedExceptions=UnsupportedOperationException.class)
public void shouldThrowOnAddColumnFromSubtable() {
// Table definition
Table persons = new Table();
persons.addColumn(ColumnType.STRING, "name");
persons.addColumn(ColumnType.STRING, "email");
persons.addColumn(ColumnType.TABLE, "addresses");
TableDefinition addresses = persons.getSubTableDefinition(2);
addresses.addColumn(ColumnType.STRING, "street");
addresses.addColumn(ColumnType.INTEGER, "zipcode");
addresses.addColumn(ColumnType.TABLE, "phone_numbers");
TableDefinition phone_numbers = addresses.getSubTableDefinition(2);
phone_numbers.addColumn(ColumnType.INTEGER, "number");
// Inserting data
persons.add(new Object[] {"Mr X", "xx@xxxx.com", new Object[][] {{ "X Street", 1234, new Object[][] {{ 12345678 }} }} });
// Should throw
persons.getSubTable(2,0).addColumn(ColumnType.INTEGER, "i");
=======
try {
// Should throw
persons.getSubTable(2,0).getSubTableDefinition(2);
fail("expected exception.");
} catch (UnsupportedOperationException e) {}
>>>>>>> ee0dca1c41f3cceb6d82339dd4607b43adab15c1
}
|
| Solution content |
|---|
fail("expected exception.");
} catch (UnsupportedOperationException e) {}
try {
// Should throw
persons.getSubTable(2,0).getSubTableDefinition(2);
fail("expected exception.");
} catch (UnsupportedOperationException e) {}
}
|
| File |
|---|
| JNISubtableTest.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Annotation |
| Comment |
| Method invocation |
| Method signature |
| Try statement |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
// Wrong number of parameters
byte[] buf = new byte[23];
try {
<<<<<<< HEAD
table.addAt(0, false);
assertTrue(false);
=======
table.insert(0, false);
fail("expected exception.");
>>>>>>> ee0dca1c41f3cceb6d82339dd4607b43adab15c1
} catch (IllegalArgumentException e) {}
// wrong row index |
| Solution content |
|---|
// Wrong number of parameters
byte[] buf = new byte[23];
try {
table.addAt(0, false);
fail("expected exception.");
} catch (IllegalArgumentException e) {}
// wrong row index |
| File |
|---|
| JNITableInsertTest.java |
| Developer's decision |
|---|
| Combination |
| Kind of conflict |
|---|
| Method invocation |
| Chunk |
|---|
| Conflicting content |
|---|
// wrong row index
long mix = 123;
try {
<<<<<<< HEAD
table.addAt(1, false, 1, "hi", buf, new Date(), mix, null);
assertTrue(false);
=======
table.insert(1, false, 1, "hi", buf, new Date(), mix, null);
fail("expected exception.");
>>>>>>> ee0dca1c41f3cceb6d82339dd4607b43adab15c1
} catch (IllegalArgumentException e) {}
// wrong row index |
| Solution content |
|---|
// wrong row index
long mix = 123;
try {
table.addAt(1, false, 1, "hi", buf, new Date(), mix, null);
fail("expected exception.");
} catch (IllegalArgumentException e) {}
// wrong row index |
| File |
|---|
| JNITableInsertTest.java |
| Developer's decision |
|---|
| Combination |
| Kind of conflict |
|---|
| Method invocation |
| Chunk |
|---|
| Conflicting content |
|---|
table.addAt(0, false, 1, "hi", buf, new Date(), 123, null);
table.addAt(1, false, 1, "hi", buf, new Date(), 123, null);
try {
<<<<<<< HEAD
table.addAt(3, false, 1, "hi", buf, new Date(), mix, null);
assertTrue(false);
=======
table.insert(3, false, 1, "hi", buf, new Date(), mix, null);
fail("expected exception.");
>>>>>>> ee0dca1c41f3cceb6d82339dd4607b43adab15c1
} catch (IllegalArgumentException e) {}
// Wrong type of parameter (999 instead of bool) |
| Solution content |
|---|
table.addAt(0, false, 1, "hi", buf, new Date(), 123, null);
table.addAt(1, false, 1, "hi", buf, new Date(), 123, null);
try {
table.addAt(3, false, 1, "hi", buf, new Date(), mix, null);
fail("expected exception.");
} catch (IllegalArgumentException e) {}
// Wrong type of parameter (999 instead of bool) |
| File |
|---|
| JNITableInsertTest.java |
| Developer's decision |
|---|
| Combination |
| Kind of conflict |
|---|
| Method invocation |
| Chunk |
|---|
| Conflicting content |
|---|
// Wrong type of parameter (999 instead of bool)
try {
<<<<<<< HEAD
table.addAt(0, 999, 1, "hi", buf, new Date(), mix, null);
assertTrue(false);
=======
table.insert(0, 999, 1, "hi", buf, new Date(), mix, null);
fail("expected exception.");
>>>>>>> ee0dca1c41f3cceb6d82339dd4607b43adab15c1
} catch (IllegalArgumentException e) {}
// Wrong type of parameter (bool instead of 1) |
| Solution content |
|---|
// Wrong type of parameter (999 instead of bool)
try {
table.addAt(0, 999, 1, "hi", buf, new Date(), mix, null);
fail("expected exception.");
} catch (IllegalArgumentException e) {}
// Wrong type of parameter (bool instead of 1) |
| File |
|---|
| JNITableInsertTest.java |
| Developer's decision |
|---|
| Combination |
| Kind of conflict |
|---|
| Method invocation |
| Chunk |
|---|
| Conflicting content |
|---|
// Wrong type of parameter (bool instead of 1)
try {
<<<<<<< HEAD
table.addAt(0, true, false, "hi", buf, new Date(), mix, null);
assertTrue(false);
=======
table.insert(0, true, false, "hi", buf, new Date(), mix, null);
fail("expected exception.");
>>>>>>> ee0dca1c41f3cceb6d82339dd4607b43adab15c1
} catch (IllegalArgumentException e) {}
// Wrong type of parameter (999 instead of string) |
| Solution content |
|---|
// Wrong type of parameter (bool instead of 1)
try {
table.addAt(0, true, false, "hi", buf, new Date(), mix, null);
fail("expected exception.");
} catch (IllegalArgumentException e) {}
// Wrong type of parameter (999 instead of string) |
| File |
|---|
| JNITableInsertTest.java |
| Developer's decision |
|---|
| Combination |
| Kind of conflict |
|---|
| Method invocation |
| Chunk |
|---|
| Conflicting content |
|---|
// Wrong type of parameter (999 instead of string)
try {
<<<<<<< HEAD
table.addAt(0, false, 1, 999, buf, new Date(), mix, null);
assertTrue(false);
=======
table.insert(0, false, 1, 999, buf, new Date(), mix, null);
fail("expected exception.");
>>>>>>> ee0dca1c41f3cceb6d82339dd4607b43adab15c1
} catch (IllegalArgumentException e) {}
// Wrong type of parameter (999 instead of Binary) |
| Solution content |
|---|
// Wrong type of parameter (999 instead of string)
try {
table.addAt(0, false, 1, 999, buf, new Date(), mix, null);
fail("expected exception.");
} catch (IllegalArgumentException e) {}
// Wrong type of parameter (999 instead of Binary) |
| File |
|---|
| JNITableInsertTest.java |
| Developer's decision |
|---|
| Combination |
| Kind of conflict |
|---|
| Method invocation |
| Chunk |
|---|
| Conflicting content |
|---|
// Wrong type of parameter (999 instead of Binary)
try {
<<<<<<< HEAD
table.addAt(0, false, 1, "hi", 999, new Date(), mix, null);
assertTrue(false);
=======
table.insert(0, false, 1, "hi", 999, new Date(), mix, null);
fail("expected exception.");
>>>>>>> ee0dca1c41f3cceb6d82339dd4607b43adab15c1
} catch (IllegalArgumentException e) {}
// Wrong type of parameter (999 instead of Date) |
| Solution content |
|---|
try {
// Wrong type of parameter (999 instead of Binary)
table.addAt(0, false, 1, "hi", 999, new Date(), mix, null);
fail("expected exception.");
} catch (IllegalArgumentException e) {}
// Wrong type of parameter (999 instead of Date) |
| File |
|---|
| JNITableInsertTest.java |
| Developer's decision |
|---|
| Combination |
| Kind of conflict |
|---|
| Method invocation |
| Chunk |
|---|
| Conflicting content |
|---|
// Wrong type of parameter (999 instead of Date)
try {
<<<<<<< HEAD
table.addAt(0, false, 1, "hi", buf, 999, mix, null);
assertTrue(false);
=======
table.insert(0, false, 1, "hi", buf, 999, mix, null);
fail("expected exception.");
>>>>>>> ee0dca1c41f3cceb6d82339dd4607b43adab15c1
} catch (IllegalArgumentException e) {}
// Wrong type of parameter (999 instead of subtable) |
| Solution content |
|---|
// Wrong type of parameter (999 instead of Date)
try {
table.addAt(0, false, 1, "hi", buf, 999, mix, null);
fail("expected exception.");
} catch (IllegalArgumentException e) {}
// Wrong type of parameter (999 instead of subtable) |
| File |
|---|
| JNITableInsertTest.java |
| Developer's decision |
|---|
| Combination |
| Kind of conflict |
|---|
| Method invocation |
| Chunk |
|---|
| Conflicting content |
|---|
// Wrong type of parameter (999 instead of subtable)
try {
<<<<<<< HEAD
table.addAt(0, false, 1, "hi", buf, new Date(), mix, 999);
assertTrue(false);
=======
table.insert(0, false, 1, "hi", buf, new Date(), mix, 999);
fail("expected exception.");
>>>>>>> ee0dca1c41f3cceb6d82339dd4607b43adab15c1
} catch (IllegalArgumentException e) {}
// Wrong type of parameter (String instead of subtable-Int) |
| Solution content |
|---|
// Wrong type of parameter (999 instead of subtable)
try {
table.addAt(0, false, 1, "hi", buf, new Date(), mix, 999);
fail("expected exception.");
} catch (IllegalArgumentException e) {}
// Wrong type of parameter (String instead of subtable-Int) |
| File |
|---|
| JNITableInsertTest.java |
| Developer's decision |
|---|
| Combination |
| Kind of conflict |
|---|
| Method invocation |
| Chunk |
|---|
| Conflicting content |
|---|
// Wrong type of parameter (String instead of subtable-Int)
try {
<<<<<<< HEAD
table.addAt(0, false, 1, "hi", buf, new Date(), mix, new Object[][] { {"err",2,3}} );
assertTrue(false);
=======
table.insert(0, false, 1, "hi", buf, new Date(), mix, new Object[][] { {"err",2,3}} );
fail("expected exception.");
>>>>>>> ee0dca1c41f3cceb6d82339dd4607b43adab15c1
} catch (IllegalArgumentException e) {}
// Wrong type of parameter (String instead of subtable-Int) |
| Solution content |
|---|
// Wrong type of parameter (String instead of subtable-Int)
try {
table.addAt(0, false, 1, "hi", buf, new Date(), mix, new Object[][] { {"err",2,3}} );
fail("expected exception.");
} catch (IllegalArgumentException e) {}
// Wrong type of parameter (String instead of subtable-Int) |
| File |
|---|
| JNITableInsertTest.java |
| Developer's decision |
|---|
| Combination |
| Kind of conflict |
|---|
| Method invocation |
| Chunk |
|---|
| Conflicting content |
|---|
// Wrong type of parameter (String instead of subtable-Int)
try {
<<<<<<< HEAD
table.addAt(0, false, 1, "hi", buf, new Date(), mix, new Object[] {1,2,3} );
assertTrue(false);
=======
table.insert(0, false, 1, "hi", buf, new Date(), mix, new Object[] {1,2,3} );
fail("expected exception.");
>>>>>>> ee0dca1c41f3cceb6d82339dd4607b43adab15c1
} catch (IllegalArgumentException e) {}
}
|
| Solution content |
|---|
// Wrong type of parameter (String instead of subtable-Int)
try {
table.addAt(0, false, 1, "hi", buf, new Date(), mix, new Object[] {1,2,3} );
fail("expected exception.");
} catch (IllegalArgumentException e) {}
}
|
| File |
|---|
| JNITableInsertTest.java |
| Developer's decision |
|---|
| Combination |
| Kind of conflict |
|---|
| Method invocation |
| Chunk |
|---|
| Conflicting content |
|---|
}
<<<<<<< HEAD
@Test(expectedExceptions=IllegalStateException.class)
public void shouldThrowExceptionAfterClosedReadTransaction() {
ReadTransaction rt = db.beginRead();
try {
Table tbl = rt.getTable("EmployeeTable");
rt.endRead();
tbl.getColumnCount(); //Should throw exception, the table is invalid when transaction has been closed
} finally {
rt.endRead();
clear();
}
}
@Test(expectedExceptions=IllegalStateException.class)
public void shouldThrowExceptionAfterClosedReadTransactionWhenWriting() {
ReadTransaction rt = db.beginRead();
try {
Table tbl = rt.getTable("EmployeeTable");
rt.endRead();
tbl.addColumn(ColumnType.STRING, "newString"); //Should throw exception, as adding a column is not allowed in read transaction
} finally {
rt.endRead();
clear();
}
}
@Test(expectedExceptions=IllegalStateException.class)
public void shouldThrowExceptionWhenWritingInReadTrans() {
ReadTransaction rt = db.beginRead();
try {
Table tbl = rt.getTable("newTable"); //Should throw exception, as this method creates a new table, if the table does not exists, thereby making it a mutable operation
rt.endRead();
} finally {
rt.endRead();
clear();
}
}
=======
@Test
public void onlyOneCommit() {
WriteTransaction trans = db.beginWrite();
try{
Table tbl = trans.getTable("EmployeeTable");
tbl.addColumn(ColumnType.ColumnTypeString, "name");
trans.commit();
try { trans.commit(); assert(false); } catch (IllegalStateException e){}
} catch (Throwable t){
trans.rollback();
}
}
>>>>>>> ee0dca1c41f3cceb6d82339dd4607b43adab15c1
@Test
public void mustRollback() {
|
| Solution content |
|---|
}
@Test(expectedExceptions=IllegalStateException.class)
public void shouldThrowExceptionAfterClosedReadTransaction() {
ReadTransaction rt = db.beginRead();
try {
Table tbl = rt.getTable("EmployeeTable");
rt.endRead();
tbl.getColumnCount(); //Should throw exception, the table is invalid when transaction has been closed
} finally {
rt.endRead();
clear();
}
}
@Test(expectedExceptions=IllegalStateException.class)
public void shouldThrowExceptionAfterClosedReadTransactionWhenWriting() {
ReadTransaction rt = db.beginRead();
try {
Table tbl = rt.getTable("EmployeeTable");
rt.endRead();
tbl.addColumn(ColumnType.STRING, "newString"); //Should throw exception, as adding a column is not allowed in read transaction
} finally {
rt.endRead();
clear();
}
}
@Test(expectedExceptions=IllegalStateException.class)
public void shouldThrowExceptionWhenWritingInReadTrans() {
ReadTransaction rt = db.beginRead();
try {
Table tbl = rt.getTable("newTable"); //Should throw exception, as this method creates a new table, if the table does not exists, thereby making it a mutable operation
rt.endRead();
} finally {
rt.endRead();
clear();
}
}
@Test
public void onlyOneCommit() {
WriteTransaction trans = db.beginWrite();
try{
Table tbl = trans.getTable("EmployeeTable");
tbl.addColumn(ColumnType.STRING, "name");
trans.commit();
try { trans.commit(); assert(false); } catch (IllegalStateException e){}
} catch (Throwable t){
trans.rollback();
}
}
@Test
public void mustRollback() {
|
| File |
|---|
| JNITransactions.java |
| Developer's decision |
|---|
| Manual |
| Kind of conflict |
|---|
| Annotation |
| Method declaration |
| Chunk |
|---|
| Conflicting content |
|---|
Table tbl = trans.getTable("EmployeeTable");
@Test()
public void mustAllowDoubleCommitAndRollback() {
<<<<<<< HEAD
{
WriteTransaction trans = db.beginWrite();
Table tbl = trans.getTable("EmployeeTable");
tbl.addColumn(ColumnType.STRING, "name");
tbl.addColumn(ColumnType.INTEGER, "number");
// allow commit before any changes
assertEquals(0, tbl.size());
tbl.add("Hello", 1);
trans.commit();
}
{
WriteTransaction trans = db.beginWrite();
// allow double rollback
tbl.add("Hello", 2);
assertEquals(2, tbl.size());
trans.rollback();
trans.rollback();
trans.rollback();
trans.rollback();
}
{
ReadTransaction trans = db.beginRead();
Table tbl = trans.getTable("EmployeeTable");
assertEquals(1, tbl.size());
trans.endRead();
}
clear();
=======
{
WriteTransaction trans = db.beginWrite();
Table tbl = trans.getTable("EmployeeTable");
tbl.addColumn(ColumnType.ColumnTypeString, "name");
tbl.addColumn(ColumnType.ColumnTypeInt, "number");
// allow commit before any changes
assertEquals(0, tbl.size());
tbl.add("Hello", 1);
trans.commit();
}
{
WriteTransaction trans = db.beginWrite();
Table tbl = trans.getTable("EmployeeTable");
// allow double rollback
tbl.add("Hello", 2);
assertEquals(2, tbl.size());
trans.rollback();
trans.rollback();
trans.rollback();
trans.rollback();
}
{
ReadTransaction trans = db.beginRead();
Table tbl = trans.getTable("EmployeeTable");
assertEquals(1, tbl.size());
trans.endRead();
}
clear();
>>>>>>> ee0dca1c41f3cceb6d82339dd4607b43adab15c1
}
// Test: exception at all mutable methods in TableBase, TableView, |
| Solution content |
|---|
@Test()
public void mustAllowDoubleCommitAndRollback() {
{
WriteTransaction trans = db.beginWrite();
Table tbl = trans.getTable("EmployeeTable");
tbl.addColumn(ColumnType.STRING, "name");
tbl.addColumn(ColumnType.INTEGER, "number");
// allow commit before any changes
assertEquals(0, tbl.size());
tbl.add("Hello", 1);
trans.commit();
}
{
WriteTransaction trans = db.beginWrite();
Table tbl = trans.getTable("EmployeeTable");
// allow double rollback
tbl.add("Hello", 2);
assertEquals(2, tbl.size());
trans.rollback();
trans.rollback();
trans.rollback();
trans.rollback();
}
{
ReadTransaction trans = db.beginRead();
Table tbl = trans.getTable("EmployeeTable");
assertEquals(1, tbl.size());
trans.endRead();
}
clear();
}
// Test: exception at all mutable methods in TableBase, TableView, |
| File |
|---|
| JNITransactions.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Comment |
| Method invocation |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
ReadTransaction t = db.beginRead();
Table table = t.getTable("EmployeeTable");
<<<<<<< HEAD
try { table.addAt(0, 0, false); assert(false);} catch (IllegalStateException e) {}
=======
try { table.insert(0, 0, false); assert(false);} catch (IllegalStateException e) {}
>>>>>>> ee0dca1c41f3cceb6d82339dd4607b43adab15c1
try { table.add(0, false); assert(false);} catch (IllegalStateException e) {}
try { table.addEmptyRow(); assert(false);} catch (IllegalStateException e) {}
try { table.addEmptyRows(1); assert(false);} catch (IllegalStateException e) {} |
| Solution content |
|---|
ReadTransaction t = db.beginRead();
Table table = t.getTable("EmployeeTable");
try { table.addAt(0, 0, false); assert(false);} catch (IllegalStateException e) {}
try { table.add(0, false); assert(false);} catch (IllegalStateException e) {}
try { table.addEmptyRow(); assert(false);} catch (IllegalStateException e) {}
try { table.addEmptyRows(1); assert(false);} catch (IllegalStateException e) {} |
| File |
|---|
| JNITransactions.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Try statement |
| Chunk |
|---|
| Conflicting content |
|---|
group.getTable("");
// Expect to throw exception
}
<<<<<<< HEAD
//
// Open Group with file
//
@Test
public void shouldOpenExistingGroupFile() throws IOException {
new File(FILENAME).delete();
Group group = new Group();
group.writeToFile(FILENAME);
group.close();
Group group2 = new Group(FILENAME);
group2.close();
Group group3 = new Group(FILENAME, OpenMode.READ_ONLY);
group3.close();
Group group4 = new Group(FILENAME, OpenMode.READ_WRITE);
group4.close();
Group group5 = new Group(FILENAME, OpenMode.READ_WRITE_NO_CREATE);
group5.close();
}
@Test(expectedExceptions = IllegalArgumentException.class)
public void shouldOpenReadOnly() throws IOException {
File file = new File(FILENAME);
file.delete();
file.createNewFile();
// Throw when opening non-TightDB file
Group group = new Group(FILENAME, OpenMode.READ_ONLY);
}
@Test(expectedExceptions = IllegalArgumentException.class)
public void shouldThrowExceptionOnGroupReadOnly() throws IOException {
new File(FILENAME).delete();
// Throw when opening non-existing file
Group group = new Group(FILENAME, OpenMode.READ_ONLY);
}
@Test(expectedExceptions = IllegalArgumentException.class)
public void shouldThrowExceptionOnOpenWrongFileReadOnly() throws IOException {
File file = new File(FILENAME);
file.delete();
file.createNewFile();
// Throw when opening non-TightDB file
Group group = new Group(FILENAME, OpenMode.READ_ONLY);
}
@Test(expectedExceptions = IllegalArgumentException.class)
public void ThrowExceptionOnGroupNoCreate() throws IOException {
new File(FILENAME).delete();
Group group2 = new Group(FILENAME, OpenMode.READ_WRITE_NO_CREATE);
}
=======
@Test
public void shouldOpenExistingGroupFile() throws IOException {
new File(FILENAME).delete();
Group group = new Group();
group.writeToFile(FILENAME);
group.close();
Group group2 = new Group(FILENAME);
group2.close();
}
>>>>>>> ee0dca1c41f3cceb6d82339dd4607b43adab15c1
@Test
public void groupCanWriteToFile() throws IOException { |
| Solution content |
|---|
}
@Test
group.getTable("");
// Expect to throw exception
}
//
// Open Group with file
//
@Test
public void shouldOpenExistingGroupFile() throws IOException {
new File(FILENAME).delete();
Group group = new Group();
group.writeToFile(FILENAME);
group.close();
Group group2 = new Group(FILENAME);
group2.close();
Group group3 = new Group(FILENAME, OpenMode.READ_ONLY);
group3.close();
Group group4 = new Group(FILENAME, OpenMode.READ_WRITE);
group4.close();
Group group5 = new Group(FILENAME, OpenMode.READ_WRITE_NO_CREATE);
group5.close();
}
@Test
public void shouldThrowExceptionOnGroupReadOnly() throws IOException {
new File(FILENAME).delete();
// Throw when opening non-existing file
try { Group group = new Group(FILENAME, OpenMode.READ_ONLY); fail("Group is read only"); } catch (com.tightdb.IOException e) { }
}
@Test(expectedExceptions = IllegalArgumentException.class)
public void shouldThrowExceptionOnOpenWrongFileReadOnly() throws IOException {
File file = new File(FILENAME);
file.delete();
file.createNewFile();
// Throw when opening non-TightDB file
Group group = new Group(FILENAME, OpenMode.READ_ONLY);
}
@Test
public void ThrowExceptionOnGroupNoCreate() throws IOException {
new File(FILENAME).delete();
try { Group group2 = new Group(FILENAME, OpenMode.READ_WRITE_NO_CREATE); fail("Exception excpected"); } catch (com.tightdb.IOException e) { }
public void groupCanWriteToFile() throws IOException { |
| File |
|---|
| GroupTest.java |
| Developer's decision |
|---|
| Manual |
| Kind of conflict |
|---|
| Annotation |
| Comment |
| Method declaration |
| Chunk |
|---|
| Conflicting content |
|---|
Group readGrp = new Group(FILENAME);
group.writeToFile(FILENAME);
}
<<<<<<< HEAD
@Test
public void shouldCommitToDisk() throws IOException {
new File(FILENAME).delete();
// Write a DB to file
Group group = new Group(FILENAME, OpenMode.READ_WRITE);
group.commit();
Table tbl = group.getTable("test");
tbl.addColumn(ColumnType.INTEGER, "number");
tbl.add(1);
group.commit();
assertEquals(tbl.getLong(0, 0), 1);
// Update, commit and close file.
tbl.set(0, 27);
group.commit();
group.close();
// Open file again and verify content
Table tbl2 = readGrp.getTable("test");
assertEquals(tbl2.getLong(0, 0), 27);
readGrp.close();
}
/* TODO: Enable when implemented "free" method for the data
=======
/* TODO: Enable when implemented "free" method for the data
>>>>>>> ee0dca1c41f3cceb6d82339dd4607b43adab15c1
@Test(enabled = true)
public void groupByteBufferCanClose() {
Group group = new Group(); |
| Solution content |
|---|
group.writeToFile(FILENAME);
}
@Test
public void shouldCommitToDisk() throws IOException {
new File(FILENAME).delete();
// Write a DB to file
Group group = new Group(FILENAME, OpenMode.READ_WRITE);
group.commit();
Table tbl = group.getTable("test");
tbl.addColumn(ColumnType.INTEGER, "number");
tbl.add(1);
group.commit();
assertEquals(tbl.getLong(0, 0), 1);
// Update, commit and close file.
tbl.set(0, 27);
group.commit();
group.close();
// Open file again and verify content
Group readGrp = new Group(FILENAME);
Table tbl2 = readGrp.getTable("test");
assertEquals(tbl2.getLong(0, 0), 27);
readGrp.close();
}
/* TODO: Enable when implemented "free" method for the data
@Test(enabled = true)
public void groupByteBufferCanClose() {
Group group = new Group(); |
| File |
|---|
| GroupTest.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Annotation |
| Comment |
| Method declaration |
| Chunk |
|---|
| Conflicting content |
|---|
//Try to add data to table in group
tbl.add(2);
}
<<<<<<< HEAD
=======
>>>>>>> ee0dca1c41f3cceb6d82339dd4607b43adab15c1
@Test(expectedExceptions = IllegalStateException.class)
public void shouldFailWhenAddingTablesToClosedGroup() {
Group group = new Group(); |
| Solution content |
|---|
//Try to add data to table in group
try{ tbl.add(2); fail("Group is closed"); } catch (IllegalStateException e) { }
}
@Test(expectedExceptions = IllegalStateException.class)
public void shouldFailWhenAddingTablesToClosedGroup() {
Group group = new Group(); |
| File |
|---|
| GroupTest.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Blank |
| Chunk |
|---|
| Conflicting content |
|---|
import com.tightdb.ColumnType;
import com.tightdb.Group;
import com.tightdb.Mixed;
<<<<<<< HEAD
import com.tightdb.Table;
=======
import com.tightdb.ReadTransaction;
import com.tightdb.SharedGroup;
import com.tightdb.WriteTransaction;
>>>>>>> ee0dca1c41f3cceb6d82339dd4607b43adab15c1
import com.tightdb.test.TestEmployeeTable;
public class TableTest { |
| Solution content |
|---|
import com.tightdb.ColumnType;
import com.tightdb.Group;
import com.tightdb.Mixed;
import com.tightdb.Table;
import com.tightdb.ReadTransaction;
import com.tightdb.SharedGroup;
import com.tightdb.WriteTransaction;
import com.tightdb.test.TestEmployeeTable;
public class TableTest { |
| File |
|---|
| TableTest.java |
| Developer's decision |
|---|
| Concatenation |
| Kind of conflict |
|---|
| Import |