Compare commits

...

3 Commits

Author SHA1 Message Date
Michael Hoennig
875ff5c046 merging master aftermath 2024-06-17 19:19:15 +02:00
Michael Hoennig
981fbbcf04 Merge remote-tracking branch 'refs/remotes/origin/master' into booking-item-to-related-hosting-asset-just-1-to-1
# Conflicts:
#	src/test/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetRepositoryIntegrationTest.java
2024-06-17 19:07:13 +02:00
cbadc6e2c7 mitigate-hosting-asset-fetching-performance-problems (#60)
Co-authored-by: Michael Hoennig <michael@hoennig.de>
Reviewed-on: #60
Reviewed-by: Marc Sandlus <marc.sandlus@hostsharing.net>
2024-06-17 16:46:26 +02:00

View File

@ -154,8 +154,11 @@ class HsHostingAssetRepositoryIntegrationTest extends ContextBasedTestWithCleanu
} }
private void assertThatAssetIsPersisted(final HsHostingAssetEntity saved) { private void assertThatAssetIsPersisted(final HsHostingAssetEntity saved) {
attempt(em, () -> {
context("superuser-alex@hostsharing.net");
final var found = assetRepo.findByUuid(saved.getUuid()); final var found = assetRepo.findByUuid(saved.getUuid());
assertThat(found).isNotEmpty().map(HsHostingAssetEntity::getVersion).get().isEqualTo(saved.getVersion()); assertThat(found).isNotEmpty().map(HsHostingAssetEntity::toString).get().isEqualTo(saved.toString());
});
} }
} }
@ -178,14 +181,6 @@ class HsHostingAssetRepositoryIntegrationTest extends ContextBasedTestWithCleanu
"HsHostingAssetEntity(MANAGED_WEBSPACE, thi01, some Webspace, MANAGED_SERVER:vm1013, D-1000313:D-1000313 default project:separate ManagedWebspace)"); "HsHostingAssetEntity(MANAGED_WEBSPACE, thi01, some Webspace, MANAGED_SERVER:vm1013, D-1000313:D-1000313 default project:separate ManagedWebspace)");
} }
public <R> R stopWatch(final String caption, final Supplier<R> operation) {
long start = System.nanoTime();
final R result = operation.get();
System.out.printf("StopWatch %s: %dms\n",
caption, TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - start));
return result;
}
@Test @Test
public void normalUser_canViewOnlyRelatedAsset() { public void normalUser_canViewOnlyRelatedAsset() {
// given: // given:
@ -194,9 +189,7 @@ class HsHostingAssetRepositoryIntegrationTest extends ContextBasedTestWithCleanu
.findAny().orElseThrow().getUuid(); .findAny().orElseThrow().getUuid();
// when: // when:
final var result = stopWatch("findAllByCriteria", () -> final var result = assetRepo.findAllByCriteria(projectUuid, null, null);
assetRepo.findAllByCriteria(projectUuid, null, null)
);
// then: // then:
exactlyTheseAssetsAreReturned( exactlyTheseAssetsAreReturned(