Skip to content

Commit

Permalink
unit tests and fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
johnspackman committed Jul 3, 2019
1 parent 25325fd commit 2d72479
Show file tree
Hide file tree
Showing 48 changed files with 1,886 additions and 540 deletions.
57 changes: 23 additions & 34 deletions WebContent/demoapp/Manifest.json
Original file line number Diff line number Diff line change
@@ -1,34 +1,23 @@
{
"info" :
{
"name" : "demoapp",

"summary" : "Demo application for testing Qooxdoo Server Objects",
"description" : "Demo application for testing Qooxdoo Server Objects",

"homepage" : "https://github.com/johnspackman/qooxdoo-serverobjects",

"license" : "Same as Qooxdoo",
"authors" :
[
{
"name" : "John Spackman (johnspackman)",
"email" : "[email protected]"
}
],

"version" : "trunk",
"qooxdoo-versions": [ "6.0" ]
},

"provides" :
{
"namespace" : "demoapp",
"encoding" : "utf-8",
"class" : "source/class",
"resource" : "source/resource",
"translation" : "source/translation",
"type" : "application"
}
}

{
"info": {
"name": "demoapp",
"summary": "Demo application for testing Qooxdoo Server Objects",
"description": "Demo application for testing Qooxdoo Server Objects",
"homepage": "https://github.com/johnspackman/qooxdoo-serverobjects",
"license": "Same as Qooxdoo",
"authors": [],
"version": "1.0.0"
},
"provides": {
"namespace": "demoapp",
"encoding": "utf-8",
"class": "source/class",
"resource": "source/resource",
"translation": "source/translation"
},
"$schema": "https://raw.githubusercontent.com/qooxdoo/qooxdoo-compiler/master/source/resource/qx/tool/schema/Manifest-1-0-0.json",
"requires": {
"@qooxdoo/compiler": "^1.0.0-beta",
"@qooxdoo/framework": "^6.0.0-beta"
}
}
63 changes: 32 additions & 31 deletions WebContent/demoapp/compile.json
Original file line number Diff line number Diff line change
@@ -1,33 +1,34 @@
{
"targets": [
{
"type": "source",
"outputPath": "source-output"
},
{
"type": "hybrid",
"outputPath": "hybrid-output"
},
{
"type": "build",
"outputPath": "build-output"
}
],
"defaultTarget": "source",
"locales": [
"en"
],
"applications": [
{
"class": "demoapp.Application",
"theme": "qx.theme.Modern",
"name": "demoapp"
}
],
"libraries": [
"../../../../../../../../Local/WebContent/public/grasshopper/qooxdoo-trunk/framework",
"../javalib",
"../qso-lib",
"."
]
"targets": [
{
"type": "source",
"outputPath": "source-output"
},
{
"type": "hybrid",
"outputPath": "hybrid-output"
},
{
"type": "build",
"outputPath": "build-output"
}
],
"defaultTarget": "source",
"locales": [
"en"
],
"applications": [
{
"class": "demoapp.Application",
"theme": "qx.theme.Modern",
"name": "demoapp"
}
],
"libraries": [
"../../../../../../../../Local/WebContent/public/grasshopper/qooxdoo-trunk/framework",
"../javalib",
"../qso-lib",
"."
],
"$schema": "https://raw.githubusercontent.com/qooxdoo/qooxdoo-compiler/master/source/resource/qx/tool/schema/compile-1-0-0.json"
}
11 changes: 1 addition & 10 deletions WebContent/demoapp/source/class/demoapp/Application.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,7 @@
* @require(qx.Promise)
* @use(com.zenesis.qx.remote.test.simple.TestBootstrap)
* @asset(demoapp/*)
* @ignore(com.zenesis.qx.remote.test.collections.TestJavaUtilArrayContainer)
* @ignore(com.zenesis.qx.remote.test.collections.TestJavaUtilArrayContainer$Child)
* @ignore(com.zenesis.qx.remote.test.simple.Pippo)
* @ignore(com.zenesis.qx.remote.test.properties.TestProperties)
* @ignore(alert)
* @ignore(com.zenesis.qx.remote.test.simple.Pippo)
* @ignore(com.zenesis.qx.remote.test.properties.TestProperties)
* @ignore(com.zenesis.qx.remote.test.properties.TestValue)
* @ignore(com.zenesis.qx.remote.test.collections.TestRecursiveArray)
* @ignore(com.zenesis.qx.remote.test.collections.TestQsoMap$MyKey)
* @ignore(com.zenesis.qx.remote.test.collections.TestQsoMap$MyValue)
*
*/
qx.Class.define("demoapp.Application", {
Expand Down Expand Up @@ -91,6 +81,7 @@ qx.Class.define("demoapp.Application", {
}, t);

unitTest.testObserver();
unitTest.testDate();

t.log("Testing main");
t.testMain();
Expand Down
20 changes: 20 additions & 0 deletions WebContent/demoapp/source/class/demoapp/test/DemoTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,26 @@ qx.Class.define("demoapp.test.DemoTest", {
t.assertEquals(true, obj.isDirty());
},

testDate() {
var boot = com.zenesis.qx.remote.ProxyManager.getInstance().getBootstrapObject();
var tp = boot.getMainTests().getTestProperties();
const addUp = dt => dt.getHours() + dt.getMinutes() + dt.getSeconds();

this.assertTrue(addUp(tp.getDateTime()) != 0);
this.assertTrue(addUp(tp.getDateStartOfDay()) == 0);
this.assertTrue(addUp(tp.getDateEndOfDay()) == 23 + 59 + 59);

let dt1 = new Date();
tp.setDateStartOfDay(dt1);
tp.doStuff();
let dt2 = tp.getDateStartOfDay();
this.assertTrue(addUp(dt2) == 0);
this.assertEquals(dt2.getFullYear(), dt1.getFullYear());
this.assertEquals(dt2.getMonth(), dt1.getMonth());
this.assertEquals(dt2.getDate(), dt1.getDate());
tp.checkDateStartOfDay();
},

assertEquivalent: function(expected, actual, msg) {
if (qx.lang.Type.isArray(expected)) {
this.assertTrue(qx.lang.Type.isArray(actual), msg);
Expand Down
2 changes: 1 addition & 1 deletion WebContent/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ <h1>Qooxdoo Server Objects</h1>
<h2>Development</h2>
<p>If this is your development server, you can access the demos at:
<ul>
<li>"demoapp" sample: Run the <a href="/demoapp/source/index.html">Source</a> or the <a href="/demoapp/build/index.html">Build</a> version</li>
<li>"demoapp" sample: Run the <a href="/demoapp/source-output/demoapp/index.html">Source</a> or the <a href="/demoapp/build-output/demoapp//index.html">Build</a> version</li>
<li>"explorer" sample: Run the <a href="/explorer/source/index.html">Source</a> or the <a href="/explorer/build/index.html">Build</a> version</li>
</ul>
</p>
Expand Down
27 changes: 20 additions & 7 deletions WebContent/javalib/class/com/zenesis/qx/remote/BasicBootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@ qx.Class.define("com.zenesis.qx.remote.BasicBootstrap", {
},
"properties" : {
"fileApi" : {
"@" : [ new com.zenesis.qx.remote.annotations.Property().set({"readOnly":true}) ],
"@" : [ new com.zenesis.qx.remote.annotations.Property().set({
"readOnly" : true
}) ],
"nullable" : true,
"apply" : "_applyFileApi",
"check" : "com.zenesis.qx.remote.FileApi",
"event" : "changeFileApi"
"apply":"_applyFileApi",
"check":"com.zenesis.qx.remote.FileApi",
"event":"changeFileApi"
}
},
"members" : {
Expand All @@ -46,8 +48,19 @@ qx.Class.define("com.zenesis.qx.remote.BasicBootstrap", {
clazz.$$eventMeta = {};
clazz.$$methodMeta = {};
com.zenesis.qx.remote.MProxy.deferredClassInitialisation(clazz);
clazz.$$methodMeta.loadProxyType = {"isServer":true};
qx.lang.Object.mergeWith(clazz.$$properties.fileApi, {"onDemand":false,"isServer":true,"readOnly":true,"sync":"queue","nativeKeyType":true});
clazz.$$eventMeta.changeFileApi = {"isServer":true,"isProperty":true};
clazz.$$methodMeta.loadProxyType = {
"isServer" : true
};
qx.lang.Object.mergeWith(clazz.$$properties.fileApi, {
"onDemand" : false,
"isServer" : true,
"readOnly" : true,
"sync":"queue",
"nativeKeyType" : true
});
clazz.$$eventMeta.changeFileApi = {
"isServer" : true,
"isProperty" : true
};
}
});
96 changes: 73 additions & 23 deletions WebContent/javalib/class/com/zenesis/qx/remote/FileApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,21 @@ qx.Class.define("com.zenesis.qx.remote.FileApi", {
},
"properties" : {
"mimeTypes" : {
"@" : [ new com.zenesis.qx.remote.annotations.Property().set({"keyTypeName":"String"}) ],
"@" : [ new com.zenesis.qx.remote.annotations.Property().set({
"keyTypeName":"String"
}) ],
"nullable" : true,
"apply" : "_applyMimeTypes",
"event" : "changeMimeTypes"
"apply":"_applyMimeTypes",
"event":"changeMimeTypes"
},
"rootUrl" : {
"@" : [ new com.zenesis.qx.remote.annotations.Property().set({"readOnly":true}) ],
"@" : [ new com.zenesis.qx.remote.annotations.Property().set({
"readOnly" : true
}) ],
"nullable" : true,
"apply" : "_applyRootUrl",
"check" : "String",
"event" : "changeRootUrl"
"apply":"_applyRootUrl",
"check":"String",
"event":"changeRootUrl"
}
},
"members" : {
Expand Down Expand Up @@ -188,21 +192,67 @@ qx.Class.define("com.zenesis.qx.remote.FileApi", {
clazz.$$eventMeta = {};
clazz.$$methodMeta = {};
com.zenesis.qx.remote.MProxy.deferredClassInitialisation(clazz);
clazz.$$methodMeta.copyTo = {"isServer":true};
clazz.$$methodMeta.copyToUnique = {"isServer":true};
clazz.$$methodMeta.createFolder = {"isServer":true};
clazz.$$methodMeta.deleteFile = {"isServer":true};
clazz.$$methodMeta.deleteRecursive = {"isServer":true};
clazz.$$methodMeta.exists = {"isServer":true};
clazz.$$methodMeta.getFileInfo = {"isServer":true};
clazz.$$methodMeta.getType = {"isServer":true};
clazz.$$methodMeta.listFileInfos = {"isServer":true,"returnArray":"native"};
clazz.$$methodMeta.listFilenames = {"isServer":true,"returnArray":"native"};
clazz.$$methodMeta.moveTo = {"isServer":true};
clazz.$$methodMeta.renameTo = {"isServer":true};
qx.lang.Object.mergeWith(clazz.$$properties.mimeTypes, {"onDemand":false,"isServer":true,"array":"native","readOnly":false,"sync":"queue","map":true,"nativeKeyType":true});
qx.lang.Object.mergeWith(clazz.$$properties.rootUrl, {"onDemand":false,"isServer":true,"readOnly":true,"sync":"queue","nativeKeyType":true});
clazz.$$eventMeta.changeMimeTypes = {"isServer":true,"isProperty":true};
clazz.$$eventMeta.changeRootUrl = {"isServer":true,"isProperty":true};
clazz.$$methodMeta.copyTo = {
"isServer" : true
};
clazz.$$methodMeta.copyToUnique = {
"isServer" : true
};
clazz.$$methodMeta.createFolder = {
"isServer" : true
};
clazz.$$methodMeta.deleteFile = {
"isServer" : true
};
clazz.$$methodMeta.deleteRecursive = {
"isServer" : true
};
clazz.$$methodMeta.exists = {
"isServer" : true
};
clazz.$$methodMeta.getFileInfo = {
"isServer" : true
};
clazz.$$methodMeta.getType = {
"isServer" : true
};
clazz.$$methodMeta.listFileInfos = {
"isServer" : true,
"returnArray":"native"
};
clazz.$$methodMeta.listFilenames = {
"isServer" : true,
"returnArray":"native"
};
clazz.$$methodMeta.moveTo = {
"isServer" : true
};
clazz.$$methodMeta.renameTo = {
"isServer" : true
};
qx.lang.Object.mergeWith(clazz.$$properties.mimeTypes, {
"onDemand" : false,
"isServer" : true,
"array":"native",
"readOnly" : false,
"sync":"queue",
"map" : true,
"nativeKeyType" : true
});
qx.lang.Object.mergeWith(clazz.$$properties.rootUrl, {
"onDemand" : false,
"isServer" : true,
"readOnly" : true,
"sync":"queue",
"nativeKeyType" : true
});
clazz.$$eventMeta.changeMimeTypes = {
"isServer" : true,
"isProperty" : true
};
clazz.$$eventMeta.changeRootUrl = {
"isServer" : true,
"isProperty" : true
};
}
});
Loading

0 comments on commit 2d72479

Please sign in to comment.