fix ArchTest
This commit is contained in:
		| @@ -2,6 +2,8 @@ package net.hostsharing.hsadminng.credentials; | ||||
|  | ||||
| import java.util.List; | ||||
|  | ||||
| import io.micrometer.core.annotation.Timed; | ||||
| import net.hostsharing.hsadminng.config.NoSecurityRequirement; | ||||
| import net.hostsharing.hsadminng.context.Context; | ||||
| import net.hostsharing.hsadminng.credentials.generated.api.v1.api.LoginContextsApi; | ||||
| import net.hostsharing.hsadminng.credentials.generated.api.v1.model.LoginContextResource; | ||||
| @@ -11,6 +13,7 @@ import org.springframework.http.ResponseEntity; | ||||
| import org.springframework.web.bind.annotation.RestController; | ||||
|  | ||||
| @RestController | ||||
| @NoSecurityRequirement | ||||
| public class HsCredentialsContextsController implements LoginContextsApi { | ||||
|  | ||||
|     @Autowired | ||||
| @@ -23,6 +26,7 @@ public class HsCredentialsContextsController implements LoginContextsApi { | ||||
|     private HsCredentialsContextRbacRepository contextRepo; | ||||
|  | ||||
|     @Override | ||||
|     @Timed("app.credentials.contexts.getListOfLoginContexts") | ||||
|     public ResponseEntity<List<LoginContextResource>> getListOfLoginContexts(final String assumedRoles) { | ||||
|         context.assumeRoles(assumedRoles); | ||||
|  | ||||
|   | ||||
| @@ -2,6 +2,9 @@ package net.hostsharing.hsadminng.credentials; | ||||
|  | ||||
| import java.util.List; | ||||
| import java.util.UUID; | ||||
|  | ||||
| import io.micrometer.core.annotation.Timed; | ||||
| import io.swagger.v3.oas.annotations.security.SecurityRequirement; | ||||
| import net.hostsharing.hsadminng.context.Context; | ||||
| import net.hostsharing.hsadminng.credentials.generated.api.v1.api.LoginCredentialsApi; | ||||
| import net.hostsharing.hsadminng.credentials.generated.api.v1.model.LoginCredentialsInsertResource; | ||||
| @@ -15,6 +18,7 @@ import org.springframework.http.ResponseEntity; | ||||
| import org.springframework.web.bind.annotation.RestController; | ||||
|  | ||||
| @RestController | ||||
| @SecurityRequirement(name = "casTicket") | ||||
| public class HsCredentialsController implements LoginCredentialsApi { | ||||
|  | ||||
|     @Autowired | ||||
| @@ -33,6 +37,7 @@ public class HsCredentialsController implements LoginCredentialsApi { | ||||
|     private HsCredentialsRepository loginCredentialsRepo; | ||||
|  | ||||
|     @Override | ||||
|     @Timed("app.credentials.credentials.getSingleLoginCredentialsByUuid") | ||||
|     public ResponseEntity<LoginCredentialsResource> getSingleLoginCredentialsByUuid( | ||||
|             final String assumedRoles, | ||||
|             final UUID loginCredentialsUuid) { | ||||
| @@ -44,6 +49,7 @@ public class HsCredentialsController implements LoginCredentialsApi { | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     @Timed("app.credentials.credentials.getListOfLoginCredentialsByPersonUuid") | ||||
|     public ResponseEntity<List<LoginCredentialsResource>> getListOfLoginCredentialsByPersonUuid( | ||||
|             final String assumedRoles, | ||||
|             final UUID personUuid | ||||
| @@ -57,6 +63,7 @@ public class HsCredentialsController implements LoginCredentialsApi { | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     @Timed("app.credentials.credentials.postNewLoginCredentials") | ||||
|     public ResponseEntity<LoginCredentialsResource> postNewLoginCredentials( | ||||
|             final String assumedRoles, | ||||
|             final LoginCredentialsInsertResource body | ||||
| @@ -70,6 +77,7 @@ public class HsCredentialsController implements LoginCredentialsApi { | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     @Timed("app.credentials.credentials.deleteLoginCredentialsByUuid") | ||||
|     public ResponseEntity<Void> deleteLoginCredentialsByUuid(final String assumedRoles, final UUID loginCredentialsUuid) { | ||||
|         context.assumeRoles(assumedRoles); | ||||
|         final var loginCredentialsEntity = em.getReference(HsCredentialsEntity.class, loginCredentialsUuid); | ||||
| @@ -78,6 +86,7 @@ public class HsCredentialsController implements LoginCredentialsApi { | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     @Timed("app.credentials.credentials.patchLoginCredentials") | ||||
|     public ResponseEntity<LoginCredentialsResource> patchLoginCredentials( | ||||
|             final String assumedRoles, | ||||
|             final UUID loginCredentialsUuid, | ||||
|   | ||||
| @@ -52,6 +52,7 @@ public class ArchitectureTest { | ||||
|                     "..credentials", | ||||
|                     "..hash", | ||||
|                     "..lambda", | ||||
|                     "..journal", | ||||
|                     "..generated..", | ||||
|                     "..persistence..", | ||||
|                     "..reflection", | ||||
| @@ -155,14 +156,14 @@ public class ArchitectureTest { | ||||
|     public static final ArchRule testPackagesRule = classes() | ||||
|             .that().resideInAPackage("..test.(*)..") | ||||
|             .should().onlyBeAccessed().byClassesThat() | ||||
|             .resideInAnyPackage("..test.(*).."); | ||||
|             .resideInAnyPackage("..test.(*)..", "..journal.."); | ||||
|  | ||||
|     @ArchTest | ||||
|     @SuppressWarnings("unused") | ||||
|     public static final ArchRule testPackagePackageRule = classes() | ||||
|             .that().resideInAPackage("..test.pac..") | ||||
|             .should().onlyBeAccessed().byClassesThat() | ||||
|             .resideInAnyPackage("..test.pac.."); | ||||
|             .resideInAnyPackage("..test.pac..", "..journal.."); | ||||
|  | ||||
|     @ArchTest | ||||
|     @SuppressWarnings("unused") | ||||
| @@ -174,6 +175,7 @@ public class ArchitectureTest { | ||||
|                     "..hs.office.(*)..", | ||||
|                     "..hs.booking.(*)..", | ||||
|                     "..hs.hosting.(*)..", | ||||
|                     "..credentials..", | ||||
|                     "..hs.scenarios", | ||||
|                     "..hs.migration", | ||||
|                     "..rbacgrant" // TODO.test: just because of RbacGrantsDiagramServiceIntegrationTest | ||||
|   | ||||
| @@ -11,10 +11,10 @@ import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; | ||||
| import org.springframework.context.annotation.Import; | ||||
| import org.springframework.test.context.ActiveProfiles; | ||||
| import org.springframework.test.context.bean.override.mockito.MockitoBean; | ||||
| import org.springframework.transaction.annotation.Transactional; | ||||
|  | ||||
| import jakarta.persistence.PersistenceException; | ||||
| import jakarta.servlet.http.HttpServletRequest; | ||||
| import jakarta.transaction.Transactional; | ||||
| import java.util.UUID; | ||||
|  | ||||
| import static org.assertj.core.api.Assertions.assertThat; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user