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

Merge branch 'dev' into f-unit-resource

parents bf3725e3 ff711005
No related branches found
No related tags found
No related merge requests found
......@@ -56,7 +56,10 @@ test: easy-units
mvn test -X
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
mvn clean
......
......@@ -103,4 +103,4 @@
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
BEND=./bend_symlinks.sh
FILE_SYSTEM_ROOT=test_dir/links
DATA_DIR=test_dir/original
......@@ -226,4 +227,4 @@ testSymlinkToSymlink () {
}
source shunit2
......@@ -111,4 +111,17 @@ public class UTCTimeZoneShift extends TimeZone {
public String getID() {
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 @@
*/
package caosdb.server.resource;
import caosdb.datetime.UTCTimeZoneShift;
import caosdb.server.database.backend.implementation.MySQL.ConnectionException;
import caosdb.server.database.misc.TransactionBenchmark;
import caosdb.server.utils.FlagInfo;
import caosdb.server.utils.Info;
import java.util.TimeZone;
import org.jdom2.Document;
import org.jdom2.Element;
import org.jdom2.JDOMException;
......@@ -43,6 +45,7 @@ public class InfoResource extends AbstractCaosDBServerResource {
protected Representation httpGetInChildClass() throws Exception {
final Document doc = new Document();
final Element root = generateRootElement();
root.addContent(getTimeZone());
root.addContent(Info.toElement());
root.addContent(FlagInfo.toElement());
root.addContent(TransactionBenchmark.getRootInstance().toElememt());
......@@ -50,6 +53,14 @@ public class InfoResource extends AbstractCaosDBServerResource {
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. */
@Override
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