use of me.staartvin.statz.database.datatype.Query in project Statz by Staartvin.
the class QueryTest method testMultipleConflictingQueries3.
@Test
public void testMultipleConflictingQueries3() {
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", 100);
Query queryC = StatzUtil.makeQuery("uuid", "3657b9cc-2518-4265-ad69-323e11286ce2", "mob", "COW", "value", -200);
Query queryD = StatzUtil.makeQuery("uuid", "3657b9cc-2518-4265-ad69-323e11286ce2", "mob", "COW", "value", 500);
Query queryE = StatzUtil.makeQuery("uuid", "3657b9cc-2518-4265-ad69-323e11286ce2", "mob", "COW", "value", 100);
List<Query> conflictingQueries = new ArrayList<>();
conflictingQueries.add(queryB);
conflictingQueries.add(queryC);
conflictingQueries.add(queryD);
conflictingQueries.add(queryE);
Query nonConflictingQuery = queryA.resolveConflicts(conflictingQueries);
Assert.assertEquals(400, nonConflictingQuery.getValue(), 0);
}
use of me.staartvin.statz.database.datatype.Query in project Statz by Staartvin.
the class QueryTest method testRobustnessResolveConflictingQueries3.
// A query does not have value column
@Test(expected = IllegalArgumentException.class)
public void testRobustnessResolveConflictingQueries3() {
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");
PlayerInfo info = new PlayerInfo(UUID.fromString("3657b9cc-2518-4265-ad69-323e11286ce2"));
List<Query> list = new ArrayList<>();
list.add(queryA);
list.add(queryB);
info.setData(PlayerStat.KILLS_MOBS, list);
info.setData(PlayerStat.ITEMS_DROPPED, list);
queryA.resolveConflict(queryB).getValue();
}
use of me.staartvin.statz.database.datatype.Query in project Statz by Staartvin.
the class QueryTest method testNonConflictingQuery2.
// UUIDs are different
@Test
public void testNonConflictingQuery2() {
Query queryA = StatzUtil.makeQuery("UUID", "3657b9cc-2518-4265-ad69-323e11286ce2", "World", "worldName1");
Query queryB = StatzUtil.makeQuery("UUID", "c019cc4e-e9b9-4140-9cf5-07338a21659f", "World", "worldName1");
checkConflict(queryA, queryB, false);
}
use of me.staartvin.statz.database.datatype.Query in project Statz by Staartvin.
the class QueryTest method testRobustnessAddValue2.
@Test(expected = NullPointerException.class)
public void testRobustnessAddValue2() {
Query query = new Query();
query.setValue("Existing-column", "Def value");
query.addValue("Existing-column", null);
}
use of me.staartvin.statz.database.datatype.Query in project Statz by Staartvin.
the class QueryTest method testRobustnessResolveConflictingQueries2.
// A query does not have value column
@Test(expected = IllegalArgumentException.class)
public void testRobustnessResolveConflictingQueries2() {
Query queryA = StatzUtil.makeQuery("UUID", "3657b9cc-2518-4265-ad69-323e11286ce2", "mob", "COW");
Query queryB = StatzUtil.makeQuery("uuid", "3657b9cc-2518-4265-ad69-323e11286ce2", "mob", "COW", "value", -6);
queryA.resolveConflict(queryB).getValue();
}
Aggregations