Changesets · Branches · Tags · Compare
| Changeset | 922c8fb436a5e5e91d2134e9c84761d330b99d619b771dcebbb3498dff75e6ba |
|---|---|
| Author | Enrico Risa <enrico.risa@gmail.com> · 2024-07-08 09:43 +02:00 |
| Committer | GitHub <noreply@github.com> · 2024-07-08 09:43 +02:00 |
| Parents | 4f43536fdafa |
2 files changed
modified extensions/common/store/sql/edr-index-sql/src/main/java/org/eclipse/edc/edr/store/index/sql/schema/postgres/EndpointDataReferenceEntryMapping.java +1 −0
| @@ -29,5 +29,6 @@ | ||
| 29 | 29 | add("transferProcessId", statements.getTransferProcessIdColumn()); |
| 30 | 30 | add("providerId", statements.getProviderIdColumn()); |
| 31 | 31 | add("contractNegotiationId", statements.getContractNegotiationIdColumn()); |
| 32 | + add("createdAt", statements.getCreatedAtColumn()); | |
| 32 | 33 | } |
| 33 | 34 | } |
modified spi/common/edr-store-spi/src/testFixtures/java/org/eclipse/edc/edr/spi/store/EndpointDataReferenceEntryIndexTestBase.java +16 −0
| @@ -18,6 +18,7 @@ | ||
| 18 | 18 | import org.eclipse.edc.edr.spi.types.EndpointDataReferenceEntry; |
| 19 | 19 | import org.eclipse.edc.spi.query.Criterion; |
| 20 | 20 | import org.eclipse.edc.spi.query.QuerySpec; |
| 21 | +import org.eclipse.edc.spi.query.SortOrder; | |
| 21 | 22 | import org.eclipse.edc.spi.result.StoreFailure; |
| 22 | 23 | import org.eclipse.edc.spi.result.StoreResult; |
| 23 | 24 | import org.junit.jupiter.api.Test; |
| @@ -27,6 +28,7 @@ | ||
| 27 | 28 | import org.junit.jupiter.params.provider.ArgumentsProvider; |
| 28 | 29 | import org.junit.jupiter.params.provider.ArgumentsSource; |
| 29 | 30 | |
| 31 | +import java.util.Comparator; | |
| 30 | 32 | import java.util.function.Function; |
| 31 | 33 | import java.util.stream.Collectors; |
| 32 | 34 | import java.util.stream.IntStream; |
| @@ -119,6 +121,20 @@ | ||
| 119 | 121 | |
| 120 | 122 | } |
| 121 | 123 | |
| 124 | + @Test | |
| 125 | + void query_withOrderBy() { | |
| 126 | + IntStream.range(0, 10) | |
| 127 | + .mapToObj(i -> TestFunctions.edrEntry("assetId" + i, "agreementId" + i, "tpId" + i, "cnId" + i)) | |
| 128 | + .forEach(entry -> getStore().save(entry)); | |
| 129 | + | |
| 130 | + var results = getStore().query(QuerySpec.Builder.newInstance().sortField("createdAt").sortOrder(SortOrder.DESC).build()); | |
| 131 | + | |
| 132 | + assertThat(results.succeeded()).isTrue(); | |
| 133 | + assertThat(results.getContent()) | |
| 134 | + .isSortedAccordingTo(Comparator.comparing(EndpointDataReferenceEntry::getCreatedAt).reversed()); | |
| 135 | + | |
| 136 | + } | |
| 137 | + | |
| 122 | 138 | @Test |
| 123 | 139 | void delete_shouldDelete_WhenFound() { |
| 124 | 140 |