Fixed TPS Storage test

This commit is contained in:
Risto Lahtela 2021-01-25 11:26:30 +02:00
parent 4085ae310a
commit e26a272e60
2 changed files with 7 additions and 5 deletions

View File

@ -21,7 +21,6 @@ import com.djrapitops.plan.gathering.domain.TPS;
import com.djrapitops.plan.gathering.domain.builders.TPSBuilder;
import com.djrapitops.plan.storage.database.queries.Query;
import com.djrapitops.plan.storage.database.queries.QueryStatement;
import com.djrapitops.plan.storage.database.sql.building.Select;
import com.djrapitops.plan.storage.database.sql.tables.ServerTable;
import com.djrapitops.plan.utilities.java.Lists;
@ -129,10 +128,11 @@ public class TPSQueries {
}
public static Query<List<TPS>> fetchTPSDataOfServer(long after, long before, UUID serverUUID) {
String sql = Select.all(TABLE_NAME)
.where(SERVER_ID + "=" + ServerTable.STATEMENT_SELECT_SERVER_ID)
.and(DATE + ">=?").and(DATE + "<=?")
.toString();
String sql = SELECT + "*" + FROM + TABLE_NAME +
WHERE + SERVER_ID + "=" + ServerTable.STATEMENT_SELECT_SERVER_ID +
AND + DATE + ">=?" +
AND + DATE + "<=?" +
ORDER_BY + DATE;
return new QueryStatement<List<TPS>>(sql, 50000) {
@Override

View File

@ -22,6 +22,7 @@ import com.djrapitops.plan.storage.database.DatabaseTestPreparer;
import com.djrapitops.plan.storage.database.queries.objects.TPSQueries;
import com.djrapitops.plan.storage.database.transactions.commands.RemoveEverythingTransaction;
import com.djrapitops.plan.storage.database.transactions.events.TPSStoreTransaction;
import com.djrapitops.plan.utilities.comparators.TPSComparator;
import com.djrapitops.plan.utilities.java.Lists;
import org.junit.jupiter.api.Test;
import utilities.RandomData;
@ -44,6 +45,7 @@ public interface TPSQueriesTest extends DatabaseTestPreparer {
forcePersistenceCheck();
expected.sort(new TPSComparator());
assertEquals(expected, db().query(TPSQueries.fetchTPSDataOfServer(Long.MIN_VALUE, Long.MAX_VALUE, serverUUID())));
}