Skip to content
Merged
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
24 changes: 24 additions & 0 deletions src/org/labkey/test/tests/ExternalSchemaTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,8 @@ void doTestViaJavaApi() throws Exception
// assertEquals("The row is from the wrong container.", ex.getMessage());
// assertEquals("org.labkey.api.view.UnauthorizedException", ex.getProperties().get("exceptionClass"));
}

updateDuplicateRows(PROJECT_NAME, cn, updated);

try
{
Expand Down Expand Up @@ -459,6 +461,28 @@ Row[] updateViaJavaApi(String containerPath, Connection cn, Row... rows) throws
}
return updated;
}

// Issue 52728: Update the same data twice should fail
void updateDuplicateRows(String containerPath, Connection cn, Row... rows) throws ParseException, IOException, CommandException
{
log("** Updating twice in a single request via api...");
UpdateRowsCommand cmd = new UpdateRowsCommand(USER_SCHEMA_NAME, TABLE_NAME);

for (Row row : rows)
cmd.addRow(row.toMap());
cmd.addRow(rows[0].toMap()); // add the 1st row twice

try
{
cmd.execute(cn, containerPath);
fail("expected exception when trying to update the same keys twice");
}
catch (CommandException ex)
{
assertEquals(400, ex.getStatusCode());
}

}

void deleteViaJavaApi(String containerPath, Connection cn, int... pks) throws IOException, CommandException
{
Expand Down