Merge pull request #64 from bsinno/mgmtapi-shows-wrong-status-content
👍 ok merging
This commit is contained in:
@@ -21,45 +21,47 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
/**
|
||||
* {@link ActionStatus} repository.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
@Transactional(readOnly = true)
|
||||
public interface ActionStatusRepository
|
||||
extends BaseEntityRepository<ActionStatus, Long>, JpaSpecificationExecutor<ActionStatus> {
|
||||
|
||||
/**
|
||||
* @param target
|
||||
* Counts {@link ActionStatus} entries of given {@link Action} in
|
||||
* repository.
|
||||
*
|
||||
* @param action
|
||||
* @return
|
||||
* to count status entries
|
||||
* @return number of actions in repository
|
||||
*/
|
||||
Long countByAction(Action action);
|
||||
|
||||
/**
|
||||
* Counts {@link ActionStatus} entries of given {@link Action} with given
|
||||
* {@link Status} in repository.
|
||||
*
|
||||
* @param action
|
||||
* @param retrieved
|
||||
* @return
|
||||
* to count status entries
|
||||
* @param status
|
||||
* to filter for
|
||||
* @return number of actions in repository
|
||||
*/
|
||||
Long countByActionAndStatus(Action action, Status retrieved);
|
||||
Long countByActionAndStatus(Action action, Status status);
|
||||
|
||||
/**
|
||||
* Retrieves all {@link ActionStatus} entries from repository of given
|
||||
* {@link Action}.
|
||||
*
|
||||
* @param pageReq
|
||||
* parameters
|
||||
* @param action
|
||||
* @return
|
||||
* of the status entries
|
||||
* @return pages list of {@link ActionStatus} entries
|
||||
*/
|
||||
Page<ActionStatus> findByAction(Pageable pageReq, Action action);
|
||||
|
||||
/**
|
||||
* @param pageReq
|
||||
* @param action
|
||||
* @return
|
||||
*/
|
||||
Page<ActionStatus> findByActionOrderByIdDesc(Pageable pageReq, Action action);
|
||||
|
||||
/**
|
||||
* Finds all status updates for the defined action and target order by
|
||||
* {@link ActionStatus#getId()} desc including
|
||||
* Finds all status updates for the defined action and target including
|
||||
* {@link ActionStatus#getMessages()}.
|
||||
*
|
||||
* @param pageReq
|
||||
@@ -71,6 +73,6 @@ public interface ActionStatusRepository
|
||||
* @return Page with found targets
|
||||
*/
|
||||
@EntityGraph(value = "ActionStatus.withMessages", type = EntityGraphType.LOAD)
|
||||
Page<ActionStatus> getByActionOrderByIdDesc(Pageable pageReq, Action action);
|
||||
Page<ActionStatus> getByAction(Pageable pageReq, Action action);
|
||||
|
||||
}
|
||||
|
||||
@@ -925,7 +925,7 @@ public class DeploymentManagement {
|
||||
|
||||
/**
|
||||
* retrieves all the {@link ActionStatus} entries of the given
|
||||
* {@link Action} and {@link Target} in the order latest first.
|
||||
* {@link Action} and {@link Target}.
|
||||
*
|
||||
* @param pageReq
|
||||
* pagination parameter
|
||||
@@ -937,12 +937,12 @@ public class DeploymentManagement {
|
||||
* @return the corresponding {@link Page} of {@link ActionStatus}
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
public Page<ActionStatus> findActionStatusMessagesByActionInDescOrder(final Pageable pageReq, final Action action,
|
||||
public Page<ActionStatus> findActionStatusByAction(final Pageable pageReq, final Action action,
|
||||
final boolean withMessages) {
|
||||
if (withMessages) {
|
||||
return actionStatusRepository.getByActionOrderByIdDesc(pageReq, action);
|
||||
return actionStatusRepository.getByAction(pageReq, action);
|
||||
} else {
|
||||
return actionStatusRepository.findByActionOrderByIdDesc(pageReq, action);
|
||||
return actionStatusRepository.findByAction(pageReq, action);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -70,8 +70,8 @@ public class ControllerManagementTest extends AbstractIntegrationTest {
|
||||
.isEqualTo(TargetUpdateStatus.IN_SYNC);
|
||||
|
||||
assertThat(actionStatusRepository.findAll(pageReq).getNumberOfElements()).isEqualTo(3);
|
||||
assertThat(deploymentManagement.findActionStatusMessagesByActionInDescOrder(pageReq, savedAction, false)
|
||||
.getNumberOfElements()).isEqualTo(3);
|
||||
assertThat(deploymentManagement.findActionStatusByAction(pageReq, savedAction, false).getNumberOfElements())
|
||||
.isEqualTo(3);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user