Skip to content

Commit 790bea1

Browse files
author
i.hilerio
committed
Fix comments and extend different class
SVN r64442 |2019-09-05 23:11:47 +0000
1 parent bb1f8fa commit 790bea1

File tree

3 files changed

+20
-27
lines changed

3 files changed

+20
-27
lines changed

java/src/org/labkey/remoteapi/query/TruncateTableCommand.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,13 @@
1515
*/
1616
package org.labkey.remoteapi.query;
1717

18-
import org.json.simple.JSONArray;
1918
import org.json.simple.JSONObject;
2019
import org.labkey.remoteapi.PostCommand;
2120

22-
import java.text.SimpleDateFormat;
23-
import java.util.Date;
24-
import java.util.Map;
25-
2621
/**
27-
* Command for deleting rows from a read-write schema. The user associated
22+
* Command for truncating a table from a read-write schema. The user associated
2823
* with the connection used when executing this command must have
2924
* permission to delete the data.
30-
* <p>
3125
*/
3226
public class TruncateTableCommand extends PostCommand<TruncateTableResponse>
3327
{
@@ -106,7 +100,6 @@ public JSONObject getJsonObject()
106100
JSONObject json = new JSONObject();
107101
json.put("schemaName", getSchemaName());
108102
json.put("queryName", getQueryName());
109-
//json.put("rows", jsonRows);
110103
return json;
111104
}
112105
}

java/src/org/labkey/remoteapi/query/TruncateTableResponse.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
package org.labkey.remoteapi.query;
1717

1818
import org.json.simple.JSONObject;
19+
import org.labkey.remoteapi.CommandResponse;
1920

2021
/*
2122
* User: Dave
@@ -24,14 +25,14 @@
2425
*/
2526

2627
/**
27-
* Response object used for commands that derive from SaveRowsCommand.
28+
* Response object used for commands that derive from TruncateTableCommand.
2829
* This response object provides helper methods for accessing the important
2930
* bits of the parsed response data.
3031
*/
31-
public class TruncateTableResponse extends RowsResponse
32+
public class TruncateTableResponse extends CommandResponse
3233
{
3334
/**
34-
* Constructs a new SaveRowsResponse given the response text and status code
35+
* Constructs a new TruncateTableResponse given the response text and status code
3536
* @param text The response text.
3637
* @param statusCode The HTTP status code.
3738
* @param contentType The Content-Type header value.
@@ -44,8 +45,8 @@ public TruncateTableResponse(String text, int statusCode, String contentType, JS
4445
}
4546

4647
/**
47-
* Returns the 'rowsAffected' response property.
48-
* @return The number of rows affected by the command, or null if this property
48+
* Returns the 'deletedRows' response property.
49+
* @return The number of rows deleted by the command, or null if this property
4950
* was not present in the response.
5051
*/
5152
public Number getDeletedRowCount()

java/src/org/labkey/remoteapi/test/Test.java

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -50,19 +50,19 @@ public static void main(String[] args) throws Exception
5050
try
5151
{
5252
// Import /remoteapi/sas/People.xls as list "People" into project "Api Test"
53-
// selectTest(cn, "Api Test");
54-
// crudTest(cn, "Api Test");
55-
// execSqlTest(cn, "Api Test");
56-
// schemasTest(cn, "Api Test");
57-
// extendedFormatTest(cn, "Api Test");
58-
//
59-
// // Run ShortStudyTest with -Dclean=false
60-
// datasetTest(cn, "StudyVerifyProject/My Study");
61-
//
62-
// // Run NabAssayTest with -Dclean=false and rename subfolder "Rename############" to "nabassay"
63-
// nabTest(cn, "/Nab Test Verify Project/nabassay");
64-
// assayTest(cn, "/Nab Test Verify Project/nabassay");
65-
// truncateAssayFailsTest(cn, "/Nab Test Verify Project/nabassay");
53+
selectTest(cn, "Api Test");
54+
crudTest(cn, "Api Test");
55+
execSqlTest(cn, "Api Test");
56+
schemasTest(cn, "Api Test");
57+
extendedFormatTest(cn, "Api Test");
58+
59+
// Run ShortStudyTest with -Dclean=false
60+
datasetTest(cn, "StudyVerifyProject/My Study");
61+
62+
// Run NabAssayTest with -Dclean=false and rename subfolder "Rename############" to "nabassay"
63+
nabTest(cn, "/Nab Test Verify Project/nabassay");
64+
assayTest(cn, "/Nab Test Verify Project/nabassay");
65+
truncateAssayFailsTest(cn, "/Nab Test Verify Project/nabassay");
6666

6767
truncateTableSuccessTest(cn, "Api Test");
6868
System.out.println("*** All tests completed successfully ***");
@@ -145,7 +145,6 @@ public static void truncateTableSuccessTest(Connection cn, String folder) throws
145145
TruncateTableResponse resp = trunc.execute(cn, folder);
146146

147147
assert resp.getDeletedRowCount().intValue() == 9;
148-
assert resp.getRows().size() == 0;
149148
}
150149

151150
// Assumes that /remoteapi/sas/People.xls has been imported as a list into folder

0 commit comments

Comments
 (0)