Skip to content
Snippets Groups Projects
Verified Commit 0e03cb91 authored by Timm Fitschen's avatar Timm Fitschen
Browse files

Merge branch 'dev' into f-refactor-serialization

parents fd793928 ff711005
No related branches found
No related tags found
No related merge requests found
...@@ -56,7 +56,10 @@ test: easy-units ...@@ -56,7 +56,10 @@ test: easy-units
mvn test -X mvn test -X
test_misc: test_misc:
cd misc/bend_symlinks/ && /bin/bash -c /usr/bin/shunit2 test/test_suite.sh cd misc/bend_symlinks/ && ./bend_symlinks.sh -h && test/test_suite.sh | tee test_output
cat misc/bend_symlinks/test_output | grep "Ran 10 tests."
cat misc/bend_symlinks/test_output | grep "OK"
rm misc/bend_symlinks/test_output
clean: clean-antlr clean: clean-antlr
mvn clean mvn clean
......
...@@ -103,4 +103,4 @@ ...@@ -103,4 +103,4 @@
Run test suite with Run test suite with
$ shunit2 test/test_suite.sh $ ./test/test_suite.sh
#!/bin/bash
source ./src/utils.sh
source "./src/utils.sh"
set +o errexit set +o errexit
BEND=./bend_symlinks.sh BEND=./bend_symlinks.sh
FILE_SYSTEM_ROOT=test_dir/links FILE_SYSTEM_ROOT=test_dir/links
DATA_DIR=test_dir/original DATA_DIR=test_dir/original
...@@ -226,4 +227,4 @@ testSymlinkToSymlink () { ...@@ -226,4 +227,4 @@ testSymlinkToSymlink () {
} }
source shunit2
...@@ -111,4 +111,17 @@ public class UTCTimeZoneShift extends TimeZone { ...@@ -111,4 +111,17 @@ public class UTCTimeZoneShift extends TimeZone {
public String getID() { public String getID() {
return str; return str;
} }
/**
* Generate an ISO 8601 time zone offset string (e.g. +0200) from the given raw offset in
* milliseconds.
*
* @param rawOffset - offset in ms.
* @return ISO 8601 time zone offset.
*/
public static String getISO8601Offset(int rawOffset) {
int h = Integer.divideUnsigned(rawOffset, 1000 * 60 * 60);
int m = Integer.remainderUnsigned(rawOffset, 1000 * 60 * 60);
return generateString(Integer.signum(h), h, m);
}
} }
...@@ -22,10 +22,12 @@ ...@@ -22,10 +22,12 @@
*/ */
package caosdb.server.resource; package caosdb.server.resource;
import caosdb.datetime.UTCTimeZoneShift;
import caosdb.server.database.backend.implementation.MySQL.ConnectionException; import caosdb.server.database.backend.implementation.MySQL.ConnectionException;
import caosdb.server.database.misc.TransactionBenchmark; import caosdb.server.database.misc.TransactionBenchmark;
import caosdb.server.utils.FlagInfo; import caosdb.server.utils.FlagInfo;
import caosdb.server.utils.Info; import caosdb.server.utils.Info;
import java.util.TimeZone;
import org.jdom2.Document; import org.jdom2.Document;
import org.jdom2.Element; import org.jdom2.Element;
import org.jdom2.JDOMException; import org.jdom2.JDOMException;
...@@ -43,6 +45,7 @@ public class InfoResource extends XMLServerResource { ...@@ -43,6 +45,7 @@ public class InfoResource extends XMLServerResource {
protected Representation httpGetInChildClass() throws Exception { protected Representation httpGetInChildClass() throws Exception {
final Document doc = new Document(); final Document doc = new Document();
final Element root = generateRootElement(); final Element root = generateRootElement();
root.addContent(getTimeZone());
root.addContent(Info.toElement()); root.addContent(Info.toElement());
root.addContent(FlagInfo.toElement()); root.addContent(FlagInfo.toElement());
root.addContent(TransactionBenchmark.getRootInstance().toElememt()); root.addContent(TransactionBenchmark.getRootInstance().toElememt());
...@@ -50,6 +53,14 @@ public class InfoResource extends XMLServerResource { ...@@ -50,6 +53,14 @@ public class InfoResource extends XMLServerResource {
return ok(doc); return ok(doc);
} }
public Element getTimeZone() {
TimeZone d = TimeZone.getDefault();
return new Element("TimeZone")
.setAttribute("offset", UTCTimeZoneShift.getISO8601Offset(d.getRawOffset()))
.setAttribute("id", d.getID())
.addContent(d.getDisplayName());
}
/** There is no POST request specified for the /Info resource. */ /** There is no POST request specified for the /Info resource. */
@Override @Override
protected Representation httpPostInChildClass(final Representation entity) protected Representation httpPostInChildClass(final Representation entity)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment