use of me.staartvin.statz.database.datatype.Query in project Statz by Staartvin.
the class QueryTest method testConflictingQuery3.
// Same number of columns, UUIDs are the same and mob is the same.
@Test
public void testConflictingQuery3() {
Query queryA = StatzUtil.makeQuery("UUID", "3657b9cc-2518-4265-ad69-323e11286ce2", "mob", "COW", "value", 46);
Query queryB = StatzUtil.makeQuery("uuid", "3657b9cc-2518-4265-ad69-323e11286ce2", "mob", "COW", "value", 5);
checkConflict(queryA, queryB, true);
}
use of me.staartvin.statz.database.datatype.Query in project Statz by Staartvin.
the class QueryTest method testResolveConflictingQueries3.
// Add up negative and positive values
@Test
public void testResolveConflictingQueries3() {
Query queryA = StatzUtil.makeQuery("UUID", "3657b9cc-2518-4265-ad69-323e11286ce2", "mob", "COW", "value", 100);
Query queryB = StatzUtil.makeQuery("uuid", "3657b9cc-2518-4265-ad69-323e11286ce2", "mob", "COW", "value", -6);
Assert.assertEquals(94, queryA.resolveConflict(queryB).getValue(), 0);
}
use of me.staartvin.statz.database.datatype.Query in project Statz by Staartvin.
the class QueryTest method testNonConflictingQuery4.
// The number of columns are different
@Test
public void testNonConflictingQuery4() {
Query queryA = StatzUtil.makeQuery("UUID", "3657b9cc-2518-4265-ad69-323e11286ce2");
Query queryB = StatzUtil.makeQuery("UUID", "3657b9cc-2518-4265-ad69-323e11286ce2", "World", "worldname");
checkConflict(queryA, queryB, false);
}
use of me.staartvin.statz.database.datatype.Query in project Statz by Staartvin.
the class QueryTest method testConflictingQuery1.
// Same number of columns and UUIDs are the same
@Test
public void testConflictingQuery1() {
Query queryA = StatzUtil.makeQuery("UUID", "3657b9cc-2518-4265-ad69-323e11286ce2");
Query queryB = StatzUtil.makeQuery("UUID", "3657b9cc-2518-4265-ad69-323e11286ce2");
checkConflict(queryA, queryB, true);
}
use of me.staartvin.statz.database.datatype.Query in project Statz by Staartvin.
the class QueryTest method testResolveConflictingQueries2.
// Resolve conflict should be symmetric - value should add up
@Test
public void testResolveConflictingQueries2() {
Query queryA = StatzUtil.makeQuery("UUID", "3657b9cc-2518-4265-ad69-323e11286ce2", "mob", "COW", "value", 46);
Query queryB = StatzUtil.makeQuery("uuid", "3657b9cc-2518-4265-ad69-323e11286ce2", "mob", "COW", "value", 5);
// Note that query order is reversed.
Assert.assertEquals(51, queryB.resolveConflict(queryA).getValue(), 0);
}
Aggregations