Skip to content

Commit 831306a

Browse files
committed
update
1 parent c3cb9ae commit 831306a

File tree

3 files changed

+30
-29
lines changed

3 files changed

+30
-29
lines changed

dynamodb-documents/src/main/java/com/formkiq/stacks/dynamodb/DocumentServiceImpl.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -516,9 +516,11 @@ public boolean deleteDocument(final String siteId, final String documentId,
516516
.findAny().orElse(null);
517517
}
518518

519-
AttributeValueToMap transform = new AttributeValueToMap();
520-
Map<String, Object> apply = transform.apply(documentRecord);
521-
this.interceptor.deleteDocument(siteId, documentId, softDelete, apply);
519+
if (documentRecord != null) {
520+
AttributeValueToMap transform = new AttributeValueToMap();
521+
Map<String, Object> apply = transform.apply(documentRecord);
522+
this.interceptor.deleteDocument(siteId, documentId, softDelete, apply);
523+
}
522524
}
523525

524526
return deleted;

dynamodb-documents/src/test/java/com/formkiq/stacks/dynamodb/FolderIndexProcessorTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -658,7 +658,7 @@ public void testMove04() throws Exception {
658658
}
659659

660660
private void verifyIndex(final String siteId, final FolderIndexRecord map, final String pk,
661-
final String sk, final String path, final boolean hasDates) {
661+
final String sk, final String path, final boolean hasDates) {
662662

663663
assertEquals(pk, map.pk(siteId));
664664
assertEquals(sk, map.sk());

lambda-api/src/integration/java/com/formkiq/stacks/api/awstest/FoldersRequestTest.java

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -144,38 +144,37 @@ void testGetFolders02() throws Exception {
144144
String siteId = UUID.randomUUID().toString();
145145

146146
List<ApiClient> clients = getApiClients(siteId);
147-
String random = UUID.randomUUID().toString();
147+
final String random = UUID.randomUUID().toString();
148148

149-
for (ApiClient apiClient : clients) {
149+
ApiClient apiClient = clients.get(0);
150150

151-
// when
152-
for (int i = 0; i < numberOfThreads; i++) {
153-
final int ii = i;
154-
executorService.submit(() -> {
151+
// when
152+
for (int i = 0; i < numberOfThreads; i++) {
153+
final int ii = i;
154+
executorService.submit(() -> {
155+
try {
155156
try {
156-
try {
157-
String path = "Chicago_" + random + "/sample" + ii + ".txt";
158-
addDocument(apiClient, siteId, path, content.getBytes(StandardCharsets.UTF_8),
159-
"text/plain", null);
160-
} catch (IOException | InterruptedException | URISyntaxException | ApiException e) {
161-
throw new RuntimeException(e);
162-
}
163-
} finally {
164-
latch.countDown();
157+
String path = "Chicago_" + random + "/sample" + ii + ".txt";
158+
addDocument(apiClient, siteId, path, content.getBytes(StandardCharsets.UTF_8),
159+
"text/plain", null);
160+
} catch (IOException | InterruptedException | URISyntaxException | ApiException e) {
161+
throw new RuntimeException(e);
165162
}
166-
});
167-
}
163+
} finally {
164+
latch.countDown();
165+
}
166+
});
167+
}
168168

169-
// then
170-
latch.await();
171-
executorService.shutdown();
169+
// then
170+
latch.await();
171+
executorService.shutdown();
172172

173-
DocumentFoldersApi foldersApi = new DocumentFoldersApi(apiClient);
174-
List<SearchResultDocument> docs = notNull(foldersApi
175-
.getFolderDocuments(siteId, null, "Chicago_" + random, "200", null, null).getDocuments());
173+
DocumentFoldersApi foldersApi = new DocumentFoldersApi(apiClient);
174+
List<SearchResultDocument> docs = notNull(foldersApi
175+
.getFolderDocuments(siteId, null, "Chicago_" + random, "200", null, null).getDocuments());
176176

177-
assertEquals(numberOfThreads, docs.size());
178-
}
177+
assertEquals(numberOfThreads, docs.size());
179178
}
180179

181180
/**

0 commit comments

Comments
 (0)