Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
mfriesen committed Mar 2, 2024
1 parent 3db542c commit 6b14968
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -495,13 +495,15 @@ private void validateActions(final AwsServiceCache awsservice, final String site
type = null;
}

String queueId = o.getString("queueId");
DynamicObject map = o.containsKey("parameters") ? o.getMap("parameters") : null;
Map<String, String> parameters = map != null
? map.entrySet().stream()
.collect(Collectors.toMap(e -> e.getKey(), e -> e.getValue().toString()))
: Collections.emptyMap();

return new Action().type(type).parameters(parameters).userId(o.getString("userId"));
return new Action().type(type).queueId(queueId).parameters(parameters)
.userId(o.getString("userId"));
}).collect(Collectors.toList());

for (Action action : actions) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,12 @@
import com.formkiq.aws.services.lambda.GsonUtil;
import com.formkiq.client.invoker.ApiException;
import com.formkiq.client.model.AddAccessAttribute;
import com.formkiq.client.model.AddAction;
import com.formkiq.client.model.AddDocumentRequest;
import com.formkiq.client.model.AddDocumentResponse;
import com.formkiq.client.model.AddDocumentUploadRequest;
import com.formkiq.client.model.Document;
import com.formkiq.client.model.DocumentActionType;
import com.formkiq.client.model.GetDocumentResponse;
import com.formkiq.client.model.GetDocumentUrlResponse;
import com.formkiq.client.model.SetDocumentRestoreResponse;
Expand Down Expand Up @@ -214,4 +216,31 @@ public void testHandleAddDocument02() throws Exception {
}
}
}

/**
* POST /documents/{documentId} request, with action queue.
*
* @throws Exception an error has occurred
*/
@Test
public void testHandleAddDocument03() throws Exception {
// given
for (String siteId : Arrays.asList(null, UUID.randomUUID().toString())) {
setBearerToken(siteId);

AddDocumentRequest req =
new AddDocumentRequest().content("SKADJASKDSA").contentType("text/plain")
.addActionsItem(new AddAction().type(DocumentActionType.QUEUE).queueId("test"));

// when
try {
this.documentsApi.addDocument(req, siteId, null);
fail();
} catch (ApiException e) {
// then
assertEquals("{\"errors\":[{\"key\":\"queueId\",\"error\":\"'queueId' does not exist\"}]}",
e.getResponseBody());
}
}
}
}

0 comments on commit 6b14968

Please sign in to comment.