From a395595ac3a2a79f573dab085c90546811e5eae5 Mon Sep 17 00:00:00 2001 From: juanf <juanf> Date: Fri, 4 Dec 2015 13:33:52 +0000 Subject: [PATCH] SSDM-2788 : Report test template SVN: 35219 --- .../openbis-v3-api-test/html/test/common.js | 17 +++++---- .../openbis-v3-api-test/html/test/main.js | 2 +- .../html/test/test-jsVSjava.js | 35 +++++++++++++++++++ .../dss/reporting-plugins/js-test/js-test.py | 11 ++++-- 4 files changed, 56 insertions(+), 9 deletions(-) create mode 100644 js-test/servers/common/core-plugins/tests/1/as/webapps/openbis-v3-api-test/html/test/test-jsVSjava.js diff --git a/js-test/servers/common/core-plugins/tests/1/as/webapps/openbis-v3-api-test/html/test/common.js b/js-test/servers/common/core-plugins/tests/1/as/webapps/openbis-v3-api-test/html/test/common.js index 7571c5fb77d..5318e1a7967 100644 --- a/js-test/servers/common/core-plugins/tests/1/as/webapps/openbis-v3-api-test/html/test/common.js +++ b/js-test/servers/common/core-plugins/tests/1/as/webapps/openbis-v3-api-test/html/test/common.js @@ -127,8 +127,15 @@ define([ 'jquery', 'openbis', 'dto/entity/space/SpaceCreation', 'dto/entity/proj }); }); }.bind(this); - + this.createDataSet = function(facade) { + var c = this; + return this.getResponseFromJSTestAggregationService(facade, {}, function(response) { + return new DataSetPermId(response.result.rows[0][0].value); + }); + }.bind(this); + + this.getResponseFromJSTestAggregationService = function(facade, params, callback) { var c = this; return $.ajax({ "url" : "http://localhost:20001/datastore_server/rmi-dss-api-v1.json", @@ -137,15 +144,13 @@ define([ 'jquery', 'openbis', 'dto/entity/space/SpaceCreation', 'dto/entity/proj "dataType" : "json", "data" : JSON.stringify({ "method" : "createReportFromAggregationService", - "params" : [ facade._private.sessionToken, "js-test", {} ], + "params" : [ facade._private.sessionToken, "js-test", params ], "id" : "1", "jsonrpc" : "2.0" }) - }).then(function(response) { - return new DataSetPermId(response.result.rows[0][0].value); - }); + }).then(callback); }.bind(this); - + this.createMaterial = function(facade) { var c = this; var creation = new MaterialCreation(); diff --git a/js-test/servers/common/core-plugins/tests/1/as/webapps/openbis-v3-api-test/html/test/main.js b/js-test/servers/common/core-plugins/tests/1/as/webapps/openbis-v3-api-test/html/test/main.js index 7ef7bb57fa7..2d308c0f335 100644 --- a/js-test/servers/common/core-plugins/tests/1/as/webapps/openbis-v3-api-test/html/test/main.js +++ b/js-test/servers/common/core-plugins/tests/1/as/webapps/openbis-v3-api-test/html/test/main.js @@ -1,4 +1,4 @@ -define([ 'test/test-login', 'test/test-create', 'test/test-update', 'test/test-search', 'test/test-map', 'test/test-delete', 'test/test-dto' ], function() { +define([ 'test/test-login', 'test/test-jsVSjava', 'test/test-create', 'test/test-update', 'test/test-search', 'test/test-map', 'test/test-delete', 'test/test-dto' ], function() { var testSuites = arguments; return function() { for (var i = 0; i < testSuites.length; i++) { diff --git a/js-test/servers/common/core-plugins/tests/1/as/webapps/openbis-v3-api-test/html/test/test-jsVSjava.js b/js-test/servers/common/core-plugins/tests/1/as/webapps/openbis-v3-api-test/html/test/test-jsVSjava.js new file mode 100644 index 00000000000..2453ac7020d --- /dev/null +++ b/js-test/servers/common/core-plugins/tests/1/as/webapps/openbis-v3-api-test/html/test/test-jsVSjava.js @@ -0,0 +1,35 @@ +/** + * + */ +define([ 'jquery', 'underscore', 'openbis', 'test/common' ], function($, _, openbis, common) { + return function() { + QUnit.module("JS VS JAVA API"); + + QUnit.test("get Java report from aggregation service", function(assert) { + var c = new common(assert); + c.start(); + + var getV3APIReport = function(facade) { + c.getResponseFromJSTestAggregationService(facade, {"method" : "getV3APIReport"}, function(data) { + var report = null; + + if ( !data.error && + data.result.columns[0].title === "STATUS" && + data.result.rows[0][0].value === "SUCCESS") { //Success Case + report = JSON.parse(data.result.rows[0][1].value); + } + + if(report) { + c.ok("Report received"); + } else { + c.fail("Report Missing"); + } + + c.finish(); + }); + } + + c.createFacadeAndLogin().then(getV3APIReport); + }); + } +}); \ No newline at end of file diff --git a/js-test/servers/common/core-plugins/tests/1/dss/reporting-plugins/js-test/js-test.py b/js-test/servers/common/core-plugins/tests/1/dss/reporting-plugins/js-test/js-test.py index d6f01b3f25e..d8d7c122d05 100644 --- a/js-test/servers/common/core-plugins/tests/1/dss/reporting-plugins/js-test/js-test.py +++ b/js-test/servers/common/core-plugins/tests/1/dss/reporting-plugins/js-test/js-test.py @@ -35,10 +35,17 @@ def process(tr, parameters, tableBuilder): tableBuilder.addHeader("DATA_SET_CODE") row = tableBuilder.addRow() row.setCell("DATA_SET_CODE", dataSet.getDataSetCode()) - elif method is "getV3APIReport": + elif method == "getV3APIReport": + tableBuilder.addHeader("STATUS") tableBuilder.addHeader("RESULT") row = tableBuilder.addRow() - row.setCell("RESULT", APIReport.getReport()) + report = APIReport().getReport() + if report is None: + report = ""; + row.setCell("STATUS", "FAILED") + else: + row.setCell("STATUS", "SUCCESS") + row.setCell("RESULT", report) def findSample(tr): criteria = SearchCriteria() -- GitLab