diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/AbstractPingIndicator.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/AbstractPingIndicator.java index 883fef76..4d6d9996 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/AbstractPingIndicator.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/AbstractPingIndicator.java @@ -15,6 +15,9 @@ import java.util.Collections; import java.util.EnumSet; import java.util.Set; +import org.joda.time.DateTime; +import org.joda.time.DateTimeZone; + import com.fasterxml.jackson.annotation.JsonIgnore; import ch.ethz.seb.sebserver.gbl.model.session.ClientEvent.EventType; @@ -27,6 +30,7 @@ public abstract class AbstractPingIndicator extends AbstractClientIndicator { private final ClientEventExtentionMapper clientEventExtentionMapper; + protected long pingLatency; protected int pingCount = 0; protected int pingNumber = 0; @@ -35,14 +39,16 @@ public abstract class AbstractPingIndicator extends AbstractClientIndicator { this.clientEventExtentionMapper = clientEventExtentionMapper; } - public void notifyPing(final long timestamp, final int pingNumber) { - super.currentValue = timestamp; + public final void notifyPing(final long timestamp, final int pingNumber) { + final long now = DateTime.now(DateTimeZone.UTC).getMillis(); + this.pingLatency = now - timestamp; + super.currentValue = now; this.pingCount++; this.pingNumber = pingNumber; } @Override - public double computeValueAt(final long timestamp) { + public final double computeValueAt(final long timestamp) { if (this.cachingEnabled) { return timestamp; } else { diff --git a/src/main/resources/config/application.properties b/src/main/resources/config/application.properties index 1233764e..09fc503e 100644 --- a/src/main/resources/config/application.properties +++ b/src/main/resources/config/application.properties @@ -5,6 +5,6 @@ spring.mandatory-file-encoding=UTF-8 spring.http.encoding.charset=UTF-8 spring.http.encoding.enabled=true -sebserver.version=0.3.4 pre-beta +sebserver.version=0.3.5 pre-beta sebserver.supported.languages=en,de diff --git a/src/main/resources/schema-demo.sql b/src/main/resources/schema-demo.sql index dcc10d47..85a0e419 100644 --- a/src/main/resources/schema-demo.sql +++ b/src/main/resources/schema-demo.sql @@ -391,7 +391,8 @@ CREATE TABLE IF NOT EXISTS `oauth_access_token` ( `user_name` VARCHAR(255) NULL, `client_id` VARCHAR(255) NULL, `authentication` BLOB NULL, - `refresh_token` VARCHAR(255) NULL) + `refresh_token` VARCHAR(255) NULL, + UNIQUE INDEX `authentication_id_UNIQUE` (`authentication_id` ASC)) ; diff --git a/src/test/java/ch/ethz/seb/sebserver/HTTPClientBot.java b/src/test/java/ch/ethz/seb/sebserver/HTTPClientBot.java index e328f6ff..cf8f59ba 100644 --- a/src/test/java/ch/ethz/seb/sebserver/HTTPClientBot.java +++ b/src/test/java/ch/ethz/seb/sebserver/HTTPClientBot.java @@ -78,7 +78,9 @@ public class HTTPClientBot { public HTTPClientBot(final Map args) { + //this.webserviceAddress = args.getOrDefault("webserviceAddress", "http://ralph.ethz.ch:8080"); this.webserviceAddress = args.getOrDefault("webserviceAddress", "http://localhost:8080"); + this.accessTokenEndpoint = args.getOrDefault("accessTokenEndpoint", "/oauth/token"); this.clientId = args.getOrDefault("clientId", "TO_SET"); this.clientSecret = args.getOrDefault("clientSecret", "TO_SET"); diff --git a/src/test/resources/schema-test.sql b/src/test/resources/schema-test.sql index 0d960732..c920c842 100644 --- a/src/test/resources/schema-test.sql +++ b/src/test/resources/schema-test.sql @@ -397,10 +397,10 @@ CREATE TABLE IF NOT EXISTS `oauth_access_token` ( `user_name` VARCHAR(255) NULL, `client_id` VARCHAR(255) NULL, `authentication` BLOB NULL, - `refresh_token` VARCHAR(255) NULL) + `refresh_token` VARCHAR(255) NULL, + UNIQUE INDEX `authentication_id_UNIQUE` (`authentication_id` ASC)) ; - -- ----------------------------------------------------- -- Table `oauth_refresh_token` -- -----------------------------------------------------