Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Covering #436 - Report API AutoTests #6

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,11 @@ protected HttpResponse download(String url, File downloadTo, String token) throw
}
}

protected JsonNode getEntityOkIfNull(String uri, String token, Object... params) throws IOException {
HttpResponse response = execute(new HttpGet(appendQueryString(uri, queryString(params))), false, token);
return mapper.readTree(response.getEntity().getContent());
}

protected JsonNode getEntity(String uri, String token, Object... params) throws IOException
{
HttpResponse response = execute(new HttpGet(appendQueryString(uri, queryString(params))), false, token);
Expand Down Expand Up @@ -479,4 +484,8 @@ protected String superSerialResponse(HttpResponse response)
throw new RuntimeException(e);
}
}

protected void debug(String msg, Object... args) {
System.out.println(String.format(msg,args));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package com.tle.webtests.test.webservices.rest.report;

public class AuthenticatedUserDetails {
String token;
String username;
String id;

public AuthenticatedUserDetails(String name) {
username = name;
}

public String getToken() {
return token;
}

public void setToken(String token) {
this.token = token;
}

public String getUsername() {
return username;
}

public String getId() {
return id;
}

public void setId(String id) {
this.id = id;
}
}

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions OldTests/testng-codebuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ tests:
- com.tle.webtests.test.webservices.rest.SearchApiTest
- com.tle.webtests.test.webservices.rest.TasksApiTest
- com.tle.webtests.test.webservices.rest.TaxonomyApiTest
- com.tle.webtests.test.webservices.rest.ReportApiTest
- com.tle.webtests.test.webservices.rest.UserGroupManagementApiTest
- com.tle.webtests.test.webservices.soap.Soap51Test
- com.tle.webtests.test.webservices.soap.SoapServicesTest
Expand Down
3 changes: 2 additions & 1 deletion OldTests/testng-local-services.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
<packages>
<package name="com.tle.webtests.test.webservices" />
<package name="com.tle.webtests.test.webservices.rest" />
<package name="com.tle.webtests.test.webservices.soap" />
<package name="com.tle.webtests.test.webservices.rest.report" />
<package name="com.tle.webtests.test.webservices.soap" />
</packages>
</test>
</suite>
200 changes: 200 additions & 0 deletions Tests/src/main/resources/com/tle/webtests/test/files/Users.rptdesign
Original file line number Diff line number Diff line change
@@ -0,0 +1,200 @@
<?xml version="1.0" encoding="UTF-8"?>
<report xmlns="http://www.eclipse.org/birt/2005/design" version="3.2.22" id="1">
<property name="createdBy">Eclipse BIRT Designer Version 2.6.1.v20100902 Build &lt;2.6.1.v20100915-1750></property>
<property name="units">in</property>
<property name="iconFile">/templates/blank_report.gif</property>
<property name="bidiLayoutOrientation">ltr</property>
<property name="imageDPI">96</property>
<data-sources>
<oda-data-source extensionID="com.tle.reporting.oda.datasource" name="Data Source" id="7">
<property name="webserviceUrl">http://fly:8080/reporting</property>
<property name="webserviceUser">AutoTest</property>
<encrypted-property name="webservicePassword" encryptionID="base64">YXV0b21hdGVk</encrypted-property>
</oda-data-source>
</data-sources>
<data-sets>
<oda-data-set extensionID="com.tle.reporting.oda.dataset.jdbc" name="Data Set" id="8">
<structure name="cachedMetaData">
<list-property name="resultSet">
<structure>
<property name="position">1</property>
<property name="name">id</property>
<property name="dataType">decimal</property>
</structure>
<structure>
<property name="position">2</property>
<property name="name">username</property>
<property name="dataType">string</property>
</structure>
<structure>
<property name="position">3</property>
<property name="name">uuid</property>
<property name="dataType">string</property>
</structure>
</list-property>
</structure>
<property name="dataSource">Data Source</property>
<list-property name="resultSet">
<structure>
<property name="position">1</property>
<property name="name">id</property>
<property name="nativeName">id</property>
<property name="dataType">decimal</property>
</structure>
<structure>
<property name="position">2</property>
<property name="name">username</property>
<property name="nativeName">username</property>
<property name="dataType">string</property>
</structure>
<structure>
<property name="position">3</property>
<property name="name">uuid</property>
<property name="nativeName">uuid</property>
<property name="dataType">string</property>
</structure>
</list-property>
<xml-property name="queryText"><![CDATA[select id, username, uuid
from tleuser
where institution_id = CURRENT_INSTITUTION order by username asc]]></xml-property>
<xml-property name="designerValues"><![CDATA[]]></xml-property>
</oda-data-set>
</data-sets>
<styles>
<style name="report" id="4">
<property name="fontFamily">sans-serif</property>
<property name="fontSize">10pt</property>
</style>
<style name="crosstab-cell" id="5">
<property name="borderBottomColor">#CCCCCC</property>
<property name="borderBottomStyle">solid</property>
<property name="borderBottomWidth">1pt</property>
<property name="borderLeftColor">#CCCCCC</property>
<property name="borderLeftStyle">solid</property>
<property name="borderLeftWidth">1pt</property>
<property name="borderRightColor">#CCCCCC</property>
<property name="borderRightStyle">solid</property>
<property name="borderRightWidth">1pt</property>
<property name="borderTopColor">#CCCCCC</property>
<property name="borderTopStyle">solid</property>
<property name="borderTopWidth">1pt</property>
</style>
<style name="crosstab" id="6">
<property name="borderBottomColor">#CCCCCC</property>
<property name="borderBottomStyle">solid</property>
<property name="borderBottomWidth">1pt</property>
<property name="borderLeftColor">#CCCCCC</property>
<property name="borderLeftStyle">solid</property>
<property name="borderLeftWidth">1pt</property>
<property name="borderRightColor">#CCCCCC</property>
<property name="borderRightStyle">solid</property>
<property name="borderRightWidth">1pt</property>
<property name="borderTopColor">#CCCCCC</property>
<property name="borderTopStyle">solid</property>
<property name="borderTopWidth">1pt</property>
</style>
</styles>
<page-setup>
<simple-master-page name="Simple MasterPage" id="2">
<page-footer>
<text id="3">
<property name="contentType">html</property>
<text-property name="content"><![CDATA[<value-of>new Date()</value-of>]]></text-property>
</text>
</page-footer>
</simple-master-page>
</page-setup>
<body>
<table id="9">
<property name="dataSet">Data Set</property>
<list-property name="boundDataColumns">
<structure>
<property name="name">id</property>
<text-property name="displayName">id</text-property>
<expression name="expression" type="javascript">dataSetRow["id"]</expression>
<property name="dataType">decimal</property>
</structure>
<structure>
<property name="name">username</property>
<text-property name="displayName">username</text-property>
<expression name="expression" type="javascript">dataSetRow["username"]</expression>
<property name="dataType">string</property>
</structure>
<structure>
<property name="name">uuid</property>
<text-property name="displayName">uuid</text-property>
<expression name="expression" type="javascript">dataSetRow["uuid"]</expression>
<property name="dataType">string</property>
</structure>
</list-property>
<column id="28"/>
<column id="29"/>
<column id="30"/>
<header>
<row id="10">
<cell id="11">
<label id="12">
<text-property name="text">id</text-property>
</label>
</cell>
<cell id="13">
<label id="14">
<text-property name="text">username</text-property>
</label>
</cell>
<cell id="15">
<label id="16">
<text-property name="text">uuid</text-property>
</label>
</cell>
</row>
</header>
<detail>
<row id="17">
<cell id="18">
<data id="19">
<property name="whiteSpace">nowrap</property>
<property name="resultSetColumn">id</property>
</data>
</cell>
<cell id="20">
<data id="21">
<property name="whiteSpace">nowrap</property>
<structure name="toc"/>
<property name="resultSetColumn">username</property>
</data>
</cell>
<cell id="22">
<data id="23">
<property name="whiteSpace">nowrap</property>
<property name="resultSetColumn">uuid</property>
<list-property name="action">
<structure>
<property name="linkType">drill-through</property>
<property name="reportName">Items.rptdesign</property>
<property name="targetWindow">_parent</property>
<property name="targetFileType">report-design</property>
<list-property name="paramBindings">
<structure>
<property name="paramName">oWNER</property>
<simple-property-list name="expression">
<value type="javascript">row["uuid"]</value>
</simple-property-list>
</structure>
</list-property>
</structure>
</list-property>
</data>
</cell>
</row>
</detail>
<footer>
<row id="24">
<cell id="25"/>
<cell id="26"/>
<cell id="27"/>
</row>
</footer>
</table>
</body>
</report>
Loading