Improved method naming

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>
This commit is contained in:
kaizimmerm
2016-09-07 12:17:50 +02:00
parent 8ce8d8e571
commit 47e3417f55
5 changed files with 8 additions and 8 deletions

View File

@@ -130,7 +130,7 @@ public class DdiRootController implements DdiRootControllerRestApi {
}
return new ResponseEntity<>(
DataConversionHelper.fromTarget(target, controllerManagement.findOldestActionByTargetAndActive(target),
DataConversionHelper.fromTarget(target, controllerManagement.findOldestActiveActionByTarget(target),
controllerManagement.getPollingTime(), tenantAware),
HttpStatus.OK);
}

View File

@@ -346,7 +346,7 @@ public class AmqpMessageHandlerService extends BaseAmqpService {
}
private void lookIfUpdateAvailable(final Target target) {
final Optional<Action> action = controllerManagement.findOldestActionByTargetAndActive(target);
final Optional<Action> action = controllerManagement.findOldestActiveActionByTarget(target);
if (!action.isPresent()) {
return;
}

View File

@@ -156,7 +156,7 @@ public class AmqpMessageHandlerServiceTest {
final ArgumentCaptor<URI> uriCaptor = ArgumentCaptor.forClass(URI.class);
when(controllerManagementMock.findOrRegisterTargetIfItDoesNotexist(targetIdCaptor.capture(),
uriCaptor.capture())).thenReturn(null);
when(controllerManagementMock.findOldestActionByTargetAndActive(Matchers.any())).thenReturn(Optional.empty());
when(controllerManagementMock.findOldestActiveActionByTarget(Matchers.any())).thenReturn(Optional.empty());
amqpMessageHandlerService.onMessage(message, MessageType.THING_CREATED.name(), TENANT, "vHost");
@@ -364,7 +364,7 @@ public class AmqpMessageHandlerServiceTest {
when(controllerManagementMock.addUpdateActionStatus(Matchers.any())).thenReturn(action);
when(entityFactoryMock.generateActionStatus()).thenReturn(new JpaActionStatus());
// for the test the same action can be used
when(controllerManagementMock.findOldestActionByTargetAndActive(Matchers.any()))
when(controllerManagementMock.findOldestActiveActionByTarget(Matchers.any()))
.thenReturn(Optional.of(action));
final List<SoftwareModule> softwareModuleList = createSoftwareModuleList();

View File

@@ -112,7 +112,7 @@ public interface ControllerManagement {
* @return a list of actions assigned to given target which are active
*/
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
List<Action> findActionByTargetAndActive(@NotNull Target target);
List<Action> findActiveActionByTarget(@NotNull Target target);
/**
* Retrieves oldest {@link Action} that is active and assigned to a
@@ -123,7 +123,7 @@ public interface ControllerManagement {
* @return a list of actions assigned to given target which are active
*/
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
Optional<Action> findOldestActionByTargetAndActive(@NotNull Target target);
Optional<Action> findOldestActiveActionByTarget(@NotNull Target target);
/**
* Get the {@link Action} entity for given actionId with all lazy

View File

@@ -157,12 +157,12 @@ public class JpaControllerManagement implements ControllerManagement {
}
@Override
public List<Action> findActionByTargetAndActive(final Target target) {
public List<Action> findActiveActionByTarget(final Target target) {
return actionRepository.findByTargetAndActiveOrderByIdAsc((JpaTarget) target, true);
}
@Override
public Optional<Action> findOldestActionByTargetAndActive(final Target target) {
public Optional<Action> findOldestActiveActionByTarget(final Target target) {
return actionRepository.findFirstByTargetAndActiveOrderByIdAsc((JpaTarget) target, true);
}