Search in sources :

Example 11 with Query

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);
}
Also used : Query(me.staartvin.statz.database.datatype.Query) Test(org.junit.Test)

Example 12 with Query

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);
}
Also used : Query(me.staartvin.statz.database.datatype.Query) Test(org.junit.Test)

Example 13 with Query

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);
}
Also used : Query(me.staartvin.statz.database.datatype.Query) Test(org.junit.Test)

Example 14 with Query

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);
}
Also used : Query(me.staartvin.statz.database.datatype.Query) Test(org.junit.Test)

Example 15 with Query

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);
}
Also used : Query(me.staartvin.statz.database.datatype.Query) Test(org.junit.Test)

Aggregations

Query (me.staartvin.statz.database.datatype.Query)44 Test (org.junit.Test)25 PlayerInfo (me.staartvin.statz.datamanager.player.PlayerInfo)13 PlayerStat (me.staartvin.statz.datamanager.player.PlayerStat)11 ArrayList (java.util.ArrayList)8 UUID (java.util.UUID)6 RowRequirement (me.staartvin.statz.database.datatype.RowRequirement)4 HashMap (java.util.HashMap)2 Material (org.bukkit.Material)2 Player (org.bukkit.entity.Player)2 Inventory (org.bukkit.inventory.Inventory)2 ItemStack (org.bukkit.inventory.ItemStack)2 ItemMeta (org.bukkit.inventory.meta.ItemMeta)2 BufferedWriter (java.io.BufferedWriter)1 File (java.io.File)1 FileWriter (java.io.FileWriter)1 IOException (java.io.IOException)1 Date (java.util.Date)1 Map (java.util.Map)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1