@@ -44,8 +44,8 @@ public static void main(String[] args) throws Exception
4444 {
4545 String baseUrl = "http://localhost:8080/labkey" ;
4646 Connection cn = args .length < 2 ? new Connection (baseUrl ) : new Connection (baseUrl , args [0 ], args [1 ]);
47- // Connection cn = new Connection(baseUrl, new ApiKeyCredentialsProvider("session:d7c3a4aeb283e3e54c4126a707908420"));
48- // Connection cn = new Connection(baseUrl, new NetRcCredentialsProvider(baseUrl));
47+ // Connection cn = new Connection(baseUrl, new ApiKeyCredentialsProvider("session:d7c3a4aeb283e3e54c4126a707908420"));
48+ // Connection cn = new Connection(baseUrl, new NetRcCredentialsProvider(baseUrl));
4949
5050 try
5151 {
@@ -62,7 +62,9 @@ public static void main(String[] args) throws Exception
6262 // Run NabAssayTest with -Dclean=false and rename subfolder "Rename############" to "nabassay"
6363 nabTest (cn , "/Nab Test Verify Project/nabassay" );
6464 assayTest (cn , "/Nab Test Verify Project/nabassay" );
65+ truncateAssayFailsTest (cn , "/Nab Test Verify Project/nabassay" );
6566
67+ truncateTableSuccessTest (cn , "Api Test" );
6668 System .out .println ("*** All tests completed successfully ***" );
6769 }
6870 catch (CommandException e )
@@ -136,6 +138,16 @@ public static void crudTest(Connection cn, String folder) throws Exception
136138 assert srresp .getRowCount ().intValue () == rowCount ;
137139 }
138140
141+ // Assumes that /remoteapi/sas/People.xls has been imported as a list into folder
142+ public static void truncateTableSuccessTest (Connection cn , String folder ) throws Exception
143+ {
144+ TruncateTableCommand trunc = new TruncateTableCommand ("lists" , "People" );
145+ SaveRowsResponse resp = trunc .execute (cn , folder );
146+
147+ assert resp .getRowsAffected ().intValue () == 9 ;
148+ assert resp .getRows ().size () == 0 ;
149+ }
150+
139151 // Assumes that /remoteapi/sas/People.xls has been imported as a list into folder
140152 public static void execSqlTest (Connection cn , String folder ) throws Exception
141153 {
@@ -280,4 +292,18 @@ public static void assayTest(Connection cn, String folder) throws Exception
280292 AssayListResponse resp = cmd .execute (cn , folder );
281293 System .out .println (resp .getDefinitions ());
282294 }
295+
296+ // Assumes that folder has been populated with assays
297+ public static void truncateAssayFailsTest (Connection cn , String folder ) throws Exception
298+ {
299+ TruncateTableCommand trunc = new TruncateTableCommand ("assay.NAb.TestAssayNab" , "WellData" );
300+ try {
301+ SaveRowsResponse resp = trunc .execute (cn , folder );
302+ }
303+ catch (CommandException e )
304+ {
305+ assert e .getStatusCode () == 500 ;
306+ assert e .getLocalizedMessage ().equals ("The query 'WellData' in the schema 'assay.NAb.TestAssayNab' is not truncatable." );
307+ }
308+ }
283309}
0 commit comments