Overdue filter: Add simple filter for overdue in UI

Signed-off-by: Marcel Mager (INST-IOT/ESB) <Marcel.Mager@bosch-si.com>
This commit is contained in:
Marcel Mager (INST-IOT/ESB)
2016-09-07 11:29:01 +02:00
parent 1d69026184
commit 2433742abf
23 changed files with 1328 additions and 183 deletions

View File

@@ -67,7 +67,11 @@ public interface TargetManagement {
* Count {@link Target}s for all the given filter parameters. * Count {@link Target}s for all the given filter parameters.
* *
* @param status * @param status
* find targets having on of these {@link TargetUpdateStatus}s. * find targets having one of these {@link TargetUpdateStatus}s.
* Set to <code>null</code> in case this is not required.
* @param overdueState
* find targets that are overdue (targets that did not respond
* during the configured intervals: poll_itvl + overdue_itvl).
* Set to <code>null</code> in case this is not required. * Set to <code>null</code> in case this is not required.
* @param searchText * @param searchText
* to find targets having the text anywhere in name or * to find targets having the text anywhere in name or
@@ -86,7 +90,7 @@ public interface TargetManagement {
* @return the found number {@link Target}s * @return the found number {@link Target}s
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
Long countTargetByFilters(Collection<TargetUpdateStatus> status, String searchText, Long countTargetByFilters(Collection<TargetUpdateStatus> status, Boolean overdueState, String searchText,
Long installedOrAssignedDistributionSetId, Boolean selectTargetWithNoTag, String... tagNames); Long installedOrAssignedDistributionSetId, Boolean selectTargetWithNoTag, String... tagNames);
/** /**
@@ -203,10 +207,12 @@ public interface TargetManagement {
* *
* @param pageRequest * @param pageRequest
* the pageRequest to enhance the query for paging and sorting * the pageRequest to enhance the query for paging and sorting
*
* @param filterByStatus * @param filterByStatus
* find targets having this {@link TargetUpdateStatus}s. Set to * find targets having this {@link TargetUpdateStatus}s. Set to
* <code>null</code> in case this is not required. * <code>null</code> in case this is not required.
* @param overdueState
* find targets that are overdue (targets that did not respond
* during the configured intervals: poll_itvl + overdue_itvl).
* @param filterBySearchText * @param filterBySearchText
* to find targets having the text anywhere in name or * to find targets having the text anywhere in name or
* description. Set <code>null</code> in case this is not * description. Set <code>null</code> in case this is not
@@ -225,7 +231,7 @@ public interface TargetManagement {
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
List<TargetIdName> findAllTargetIdsByFilters(@NotNull Pageable pageRequest, List<TargetIdName> findAllTargetIdsByFilters(@NotNull Pageable pageRequest,
Collection<TargetUpdateStatus> filterByStatus, String filterBySearchText, Collection<TargetUpdateStatus> filterByStatus, Boolean overdueState, String filterBySearchText,
Long installedOrAssignedDistributionSetId, Boolean selectTargetWithNoTag, String... filterByTagNames); Long installedOrAssignedDistributionSetId, Boolean selectTargetWithNoTag, String... filterByTagNames);
/** /**
@@ -274,7 +280,7 @@ public interface TargetManagement {
* given {@code fieldNameProvider} * given {@code fieldNameProvider}
* @throws RSQLParameterSyntaxException * @throws RSQLParameterSyntaxException
* if the RSQL syntax is wrong * if the RSQL syntax is wrong
* *
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY_AND_READ_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY_AND_READ_TARGET)
Page<Target> findTargetByAssignedDistributionSet(@NotNull Long distributionSetID, @NotNull String rsqlParam, Page<Target> findTargetByAssignedDistributionSet(@NotNull Long distributionSetID, @NotNull String rsqlParam,
@@ -328,6 +334,9 @@ public interface TargetManagement {
* @param status * @param status
* find targets having this {@link TargetUpdateStatus}s. Set to * find targets having this {@link TargetUpdateStatus}s. Set to
* <code>null</code> in case this is not required. * <code>null</code> in case this is not required.
* @param overdueState
* find targets that are overdue (targets that did not respond
* during the configured intervals: poll_itvl + overdue_itvl).
* @param searchText * @param searchText
* to find targets having the text anywhere in name or * to find targets having the text anywhere in name or
* description. Set <code>null</code> in case this is not * description. Set <code>null</code> in case this is not
@@ -346,7 +355,7 @@ public interface TargetManagement {
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
Slice<Target> findTargetByFilters(@NotNull Pageable pageable, Collection<TargetUpdateStatus> status, Slice<Target> findTargetByFilters(@NotNull Pageable pageable, Collection<TargetUpdateStatus> status,
String searchText, Long installedOrAssignedDistributionSetId, Boolean selectTargetWithNoTag, Boolean overdueState, String searchText, Long installedOrAssignedDistributionSetId, Boolean selectTargetWithNoTag,
String... tagNames); String... tagNames);
/** /**
@@ -375,7 +384,7 @@ public interface TargetManagement {
* @param pageable * @param pageable
* page parameter * page parameter
* @return the found {@link Target}s, never {@code null} * @return the found {@link Target}s, never {@code null}
* *
* @throws RSQLParameterUnsupportedFieldException * @throws RSQLParameterUnsupportedFieldException
* if a field in the RSQL string is used but not provided by the * if a field in the RSQL string is used but not provided by the
* given {@code fieldNameProvider} * given {@code fieldNameProvider}
@@ -420,9 +429,9 @@ public interface TargetManagement {
* in string notation * in string notation
* @param pageable * @param pageable
* pagination parameter * pagination parameter
* *
* @return the found {@link Target}s, never {@code null} * @return the found {@link Target}s, never {@code null}
* *
* @throws RSQLParameterUnsupportedFieldException * @throws RSQLParameterUnsupportedFieldException
* if a field in the RSQL string is used but not provided by the * if a field in the RSQL string is used but not provided by the
* given {@code fieldNameProvider} * given {@code fieldNameProvider}
@@ -441,9 +450,9 @@ public interface TargetManagement {
* the specification for the query * the specification for the query
* @param pageable * @param pageable
* pagination parameter * pagination parameter
* *
* @return the found {@link Target}s, never {@code null} * @return the found {@link Target}s, never {@code null}
* *
* @throws RSQLParameterUnsupportedFieldException * @throws RSQLParameterUnsupportedFieldException
* if a field in the RSQL string is used but not provided by the * if a field in the RSQL string is used but not provided by the
* given {@code fieldNameProvider} * given {@code fieldNameProvider}
@@ -477,6 +486,9 @@ public interface TargetManagement {
* @param filterByStatus * @param filterByStatus
* find targets having this {@link TargetUpdateStatus}s. Set to * find targets having this {@link TargetUpdateStatus}s. Set to
* <code>null</code> in case this is not required. * <code>null</code> in case this is not required.
* @param overdueState
* find targets that are overdue (targets that did not respond
* during the configured intervals: poll_itvl + overdue_itvl).
* @param filterBySearchText * @param filterBySearchText
* to find targets having the text anywhere in name or * to find targets having the text anywhere in name or
* description. Set <code>null</code> in case this is not * description. Set <code>null</code> in case this is not
@@ -496,8 +508,8 @@ public interface TargetManagement {
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
Slice<Target> findTargetsAllOrderByLinkedDistributionSet(@NotNull Pageable pageable, Slice<Target> findTargetsAllOrderByLinkedDistributionSet(@NotNull Pageable pageable,
@NotNull Long orderByDistributionId, Long filterByDistributionId, @NotNull Long orderByDistributionId, Long filterByDistributionId,
Collection<TargetUpdateStatus> filterByStatus, String filterBySearchText, Boolean selectTargetWithNoTag, Collection<TargetUpdateStatus> filterByStatus, Boolean overdueState, String filterBySearchText,
String... filterByTagNames); Boolean selectTargetWithNoTag, String... filterByTagNames);
/** /**
* retrieves a list of {@link Target}s by their controller ID with details, * retrieves a list of {@link Target}s by their controller ID with details,

View File

@@ -279,29 +279,33 @@ public class JpaTargetManagement implements TargetManagement {
@Override @Override
public Slice<Target> findTargetByFilters(final Pageable pageable, final Collection<TargetUpdateStatus> status, public Slice<Target> findTargetByFilters(final Pageable pageable, final Collection<TargetUpdateStatus> status,
final String searchText, final Long installedOrAssignedDistributionSetId, final Boolean overdueState, final String searchText, final Long installedOrAssignedDistributionSetId,
final Boolean selectTargetWithNoTag, final String... tagNames) { final Boolean selectTargetWithNoTag, final String... tagNames) {
final List<Specification<JpaTarget>> specList = buildSpecificationList(status, searchText, final List<Specification<JpaTarget>> specList = buildSpecificationList(status, overdueState, searchText,
installedOrAssignedDistributionSetId, selectTargetWithNoTag, true, tagNames); installedOrAssignedDistributionSetId, selectTargetWithNoTag, true, tagNames);
return findByCriteriaAPI(pageable, specList); return findByCriteriaAPI(pageable, specList);
} }
@Override @Override
public Long countTargetByFilters(final Collection<TargetUpdateStatus> status, final String searchText, public Long countTargetByFilters(final Collection<TargetUpdateStatus> status, final Boolean overdueState,
final Long installedOrAssignedDistributionSetId, final Boolean selectTargetWithNoTag, final String searchText, final Long installedOrAssignedDistributionSetId,
final String... tagNames) { final Boolean selectTargetWithNoTag, final String... tagNames) {
final List<Specification<JpaTarget>> specList = buildSpecificationList(status, searchText, final List<Specification<JpaTarget>> specList = buildSpecificationList(status, overdueState, searchText,
installedOrAssignedDistributionSetId, selectTargetWithNoTag, true, tagNames); installedOrAssignedDistributionSetId, selectTargetWithNoTag, true, tagNames);
return countByCriteriaAPI(specList); return countByCriteriaAPI(specList);
} }
private static List<Specification<JpaTarget>> buildSpecificationList(final Collection<TargetUpdateStatus> status, private static List<Specification<JpaTarget>> buildSpecificationList(final Collection<TargetUpdateStatus> status,
final String searchText, final Long installedOrAssignedDistributionSetId, final Boolean overdueState, final String searchText, final Long installedOrAssignedDistributionSetId,
final Boolean selectTargetWithNoTag, final boolean fetch, final String... tagNames) { final Boolean selectTargetWithNoTag, final boolean fetch, final String... tagNames) {
final List<Specification<JpaTarget>> specList = new ArrayList<>(); final List<Specification<JpaTarget>> specList = new ArrayList<>();
if (status != null && !status.isEmpty()) { if (status != null && !status.isEmpty()) {
specList.add(TargetSpecifications.hasTargetUpdateStatus(status, fetch)); specList.add(TargetSpecifications.hasTargetUpdateStatus(status, fetch));
} }
if (overdueState != null) {
specList.add(
TargetSpecifications.isOverdue(new VirtualPropertyMakroResolver().calculateOverdueTimestamp()));
}
if (installedOrAssignedDistributionSetId != null) { if (installedOrAssignedDistributionSetId != null) {
specList.add( specList.add(
TargetSpecifications.hasInstalledOrAssignedDistributionSet(installedOrAssignedDistributionSetId)); TargetSpecifications.hasInstalledOrAssignedDistributionSet(installedOrAssignedDistributionSetId));
@@ -425,7 +429,8 @@ public class JpaTargetManagement implements TargetManagement {
@Override @Override
public Slice<Target> findTargetsAllOrderByLinkedDistributionSet(final Pageable pageable, public Slice<Target> findTargetsAllOrderByLinkedDistributionSet(final Pageable pageable,
final Long orderByDistributionId, final Long filterByDistributionId, final Long orderByDistributionId, final Long filterByDistributionId,
final Collection<TargetUpdateStatus> filterByStatus, final String filterBySearchText, final Collection<TargetUpdateStatus> filterByStatus, final Boolean overdueState,
final String filterBySearchText,
final Boolean selectTargetWithNoTag, final String... filterByTagNames) { final Boolean selectTargetWithNoTag, final String... filterByTagNames) {
final CriteriaBuilder cb = entityManager.getCriteriaBuilder(); final CriteriaBuilder cb = entityManager.getCriteriaBuilder();
final CriteriaQuery<JpaTarget> query = cb.createQuery(JpaTarget.class); final CriteriaQuery<JpaTarget> query = cb.createQuery(JpaTarget.class);
@@ -449,7 +454,7 @@ public class JpaTargetManagement implements TargetManagement {
// build the specifications and then to predicates necessary by the // build the specifications and then to predicates necessary by the
// given filters // given filters
final Predicate[] specificationsForMultiSelect = specificationsToPredicate( final Predicate[] specificationsForMultiSelect = specificationsToPredicate(
buildSpecificationList(filterByStatus, filterBySearchText, filterByDistributionId, buildSpecificationList(filterByStatus, overdueState, filterBySearchText, filterByDistributionId,
selectTargetWithNoTag, true, filterByTagNames), selectTargetWithNoTag, true, filterByTagNames),
targetRoot, query, cb); targetRoot, query, cb);
@@ -506,7 +511,8 @@ public class JpaTargetManagement implements TargetManagement {
@Override @Override
public List<TargetIdName> findAllTargetIdsByFilters(final Pageable pageRequest, public List<TargetIdName> findAllTargetIdsByFilters(final Pageable pageRequest,
final Collection<TargetUpdateStatus> filterByStatus, final String filterBySearchText, final Collection<TargetUpdateStatus> filterByStatus, final Boolean overdueState,
final String filterBySearchText,
final Long installedOrAssignedDistributionSetId, final Boolean selectTargetWithNoTag, final Long installedOrAssignedDistributionSetId, final Boolean selectTargetWithNoTag,
final String... filterByTagNames) { final String... filterByTagNames) {
final CriteriaBuilder cb = entityManager.getCriteriaBuilder(); final CriteriaBuilder cb = entityManager.getCriteriaBuilder();
@@ -523,7 +529,8 @@ public class JpaTargetManagement implements TargetManagement {
targetRoot.get(JpaTarget_.controllerId), targetRoot.get(JpaTarget_.name), targetRoot.get(sortProperty)); targetRoot.get(JpaTarget_.controllerId), targetRoot.get(JpaTarget_.name), targetRoot.get(sortProperty));
final Predicate[] specificationsForMultiSelect = specificationsToPredicate( final Predicate[] specificationsForMultiSelect = specificationsToPredicate(
buildSpecificationList(filterByStatus, filterBySearchText, installedOrAssignedDistributionSetId, buildSpecificationList(filterByStatus, overdueState, filterBySearchText,
installedOrAssignedDistributionSetId,
selectTargetWithNoTag, false, filterByTagNames), selectTargetWithNoTag, false, filterByTagNames),
targetRoot, multiselect, cb); targetRoot, multiselect, cb);

View File

@@ -48,13 +48,18 @@ public class VirtualPropertyMakroResolver extends StrLookup<String> {
if ("now_ts".equals(rhs.toLowerCase())) { if ("now_ts".equals(rhs.toLowerCase())) {
resolved = String.valueOf(Instant.now().toEpochMilli()); resolved = String.valueOf(Instant.now().toEpochMilli());
} else if ("overdue_ts".equals(rhs.toLowerCase())) { } else if ("overdue_ts".equals(rhs.toLowerCase())) {
resolved = String.valueOf(Instant.now().toEpochMilli() // resolved = String.valueOf(calculateOverdueTimestamp());
- getDurationForKey(TenantConfigurationKey.POLLING_TIME_INTERVAL).toMillis() //
- getDurationForKey(TenantConfigurationKey.POLLING_OVERDUE_TIME_INTERVAL).toMillis());
} }
return resolved; return resolved;
} }
public long calculateOverdueTimestamp() {
long overdueTs = Instant.now().toEpochMilli() //
- getDurationForKey(TenantConfigurationKey.POLLING_TIME_INTERVAL).toMillis() //
- getDurationForKey(TenantConfigurationKey.POLLING_OVERDUE_TIME_INTERVAL).toMillis();
return overdueTs;
}
private Duration getDurationForKey(TenantConfigurationKey key) { private Duration getDurationForKey(TenantConfigurationKey key) {
return DurationHelper.formattedStringToDuration(getRawStringForKey(key)); return DurationHelper.formattedStringToDuration(getRawStringForKey(key));
} }

View File

@@ -86,7 +86,7 @@ public final class TargetSpecifications {
/** /**
* {@link Specification} for retrieving {@link Target}s by "equal to given * {@link Specification} for retrieving {@link Target}s by "equal to given
* {@link TargetUpdateStatus}". * {@link TargetUpdateStatus}".
* *
* @param updateStatus * @param updateStatus
* to be filtered on * to be filtered on
* @param fetch * @param fetch
@@ -110,10 +110,34 @@ public final class TargetSpecifications {
}; };
} }
/**
* {@link Specification} for retrieving {@link Target}s that are overdue. A
* target is overdue if it did not respond during the configured
* intervals:<br>
* <em>poll_itvl + overdue_itvl</em>
*
* @param overdueTimestamp
* the calculated timestamp to compare with the last respond of a
* target (lastTargetQuery).<br>
* The <code>overdueTimestamp</code> has to be calculated with
* the following expression:<br>
* <em>overdueTimestamp = nowTimestamp - poll_itvl -
* overdue_itvl</em>
*
* @return the {@link Target} {@link Specification}
*/
public static Specification<JpaTarget> isOverdue(final long overdueTimestamp) {
return (targetRoot, query, cb) -> {
final Join<JpaTarget, JpaTargetInfo> targetInfoJoin = targetRoot.join(JpaTarget_.targetInfo);
return cb.lessThanOrEqualTo(
targetInfoJoin.get(JpaTargetInfo_.lastTargetQuery), overdueTimestamp);
};
}
/** /**
* {@link Specification} for retrieving {@link Target}s by * {@link Specification} for retrieving {@link Target}s by
* "like controllerId or like description or like ip address". * "like controllerId or like description or like ip address".
* *
* @param searchText * @param searchText
* to be filtered on * to be filtered on
* @return the {@link Target} {@link Specification} * @return the {@link Target} {@link Specification}
@@ -129,7 +153,7 @@ public final class TargetSpecifications {
/** /**
* {@link Specification} for retrieving {@link Target}s by * {@link Specification} for retrieving {@link Target}s by
* "like controllerId". * "like controllerId".
* *
* @param distributionId * @param distributionId
* to be filtered on * to be filtered on
* @return the {@link Target} {@link Specification} * @return the {@link Target} {@link Specification}
@@ -166,7 +190,7 @@ public final class TargetSpecifications {
/** /**
* {@link Specification} for retrieving {@link Target}s by * {@link Specification} for retrieving {@link Target}s by
* "has no tag names"or "has at least on of the given tag names". * "has no tag names"or "has at least on of the given tag names".
* *
* @param tagNames * @param tagNames
* to be filtered on * to be filtered on
* @param selectTargetWithNoTag * @param selectTargetWithNoTag
@@ -199,7 +223,7 @@ public final class TargetSpecifications {
/** /**
* {@link Specification} for retrieving {@link Target}s by assigned * {@link Specification} for retrieving {@link Target}s by assigned
* distribution set. * distribution set.
* *
* @param distributionSetId * @param distributionSetId
* the ID of the distribution set which must be assigned * the ID of the distribution set which must be assigned
* @return the {@link Target} {@link Specification} * @return the {@link Target} {@link Specification}
@@ -213,7 +237,7 @@ public final class TargetSpecifications {
/** /**
* {@link Specification} for retrieving {@link Target}s by assigned * {@link Specification} for retrieving {@link Target}s by assigned
* distribution set. * distribution set.
* *
* @param distributionSetId * @param distributionSetId
* the ID of the distribution set which must be assigned * the ID of the distribution set which must be assigned
* @return the {@link Target} {@link Specification} * @return the {@link Target} {@link Specification}

View File

@@ -10,20 +10,27 @@ package org.eclipse.hawkbit.repository.jpa;
import static org.fest.assertions.api.Assertions.assertThat; import static org.fest.assertions.api.Assertions.assertThat;
import java.time.Instant;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collector;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.IntStream;
import org.eclipse.hawkbit.ControllerPollProperties;
import org.eclipse.hawkbit.repository.jpa.model.JpaAction; import org.eclipse.hawkbit.repository.jpa.model.JpaAction;
import org.eclipse.hawkbit.repository.jpa.model.JpaActionStatus; import org.eclipse.hawkbit.repository.jpa.model.JpaActionStatus;
import org.eclipse.hawkbit.repository.jpa.model.JpaTarget; import org.eclipse.hawkbit.repository.jpa.model.JpaTarget;
import org.eclipse.hawkbit.repository.jpa.model.JpaTargetFilterQuery; import org.eclipse.hawkbit.repository.jpa.model.JpaTargetFilterQuery;
import org.eclipse.hawkbit.repository.jpa.model.JpaTargetTag; import org.eclipse.hawkbit.repository.jpa.model.JpaTargetTag;
import org.eclipse.hawkbit.repository.jpa.model.helper.TenantConfigurationManagementHolder;
import org.eclipse.hawkbit.repository.model.Action; import org.eclipse.hawkbit.repository.model.Action;
import org.eclipse.hawkbit.repository.model.Action.Status; import org.eclipse.hawkbit.repository.model.Action.Status;
import org.eclipse.hawkbit.tenancy.configuration.TenantConfigurationKey;
import org.eclipse.hawkbit.repository.model.ActionStatus; import org.eclipse.hawkbit.repository.model.ActionStatus;
import org.eclipse.hawkbit.repository.model.DistributionSet; import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.repository.model.Target; import org.eclipse.hawkbit.repository.model.Target;
@@ -32,6 +39,7 @@ import org.eclipse.hawkbit.repository.model.TargetTag;
import org.eclipse.hawkbit.repository.model.TargetUpdateStatus; import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
import org.eclipse.hawkbit.repository.model.TenantAwareBaseEntity; import org.eclipse.hawkbit.repository.model.TenantAwareBaseEntity;
import org.junit.Test; import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Slice; import org.springframework.data.domain.Slice;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
@@ -60,26 +68,42 @@ public class TargetManagementSearchTest extends AbstractJpaIntegrationTest {
final DistributionSet installedSet = testdataFactory.createDistributionSet("another"); final DistributionSet installedSet = testdataFactory.createDistributionSet("another");
final Long lastTargetQueryNotOverdue = Instant.now().toEpochMilli();
final Long lastTargetQueryAlwaysOverdue = 0L;
final Long lastTargetNull = null;
final String targetDsAIdPref = "targ-A"; final String targetDsAIdPref = "targ-A";
List<Target> targAs = targetManagement.createTargets( List<Target> targAs = new ArrayList<Target>();
testdataFactory.generateTargets(100, targetDsAIdPref, targetDsAIdPref.concat(" description"))); for (Target t : testdataFactory.generateTargets(100, targetDsAIdPref, targetDsAIdPref.concat(" description"))) {
targAs.add(targetManagement.createTarget(t, TargetUpdateStatus.UNKNOWN, lastTargetQueryNotOverdue,
t.getTargetInfo().getAddress()));
}
targAs = targetManagement.toggleTagAssignment(targAs, targTagX).getAssignedEntity(); targAs = targetManagement.toggleTagAssignment(targAs, targTagX).getAssignedEntity();
final String targetDsBIdPref = "targ-B"; final String targetDsBIdPref = "targ-B";
List<Target> targBs = targetManagement.createTargets( List<Target> targBs = new ArrayList<Target>();
testdataFactory.generateTargets(100, targetDsBIdPref, targetDsBIdPref.concat(" description"))); for (Target t : testdataFactory.generateTargets(100, targetDsBIdPref, targetDsBIdPref.concat(" description"))) {
targBs.add(targetManagement.createTarget(t, TargetUpdateStatus.UNKNOWN, lastTargetQueryAlwaysOverdue,
t.getTargetInfo().getAddress()));
}
targBs = targetManagement.toggleTagAssignment(targBs, targTagY).getAssignedEntity(); targBs = targetManagement.toggleTagAssignment(targBs, targTagY).getAssignedEntity();
targBs = targetManagement.toggleTagAssignment(targBs, targTagW).getAssignedEntity(); targBs = targetManagement.toggleTagAssignment(targBs, targTagW).getAssignedEntity();
final String targetDsCIdPref = "targ-C"; final String targetDsCIdPref = "targ-C";
List<Target> targCs = targetManagement.createTargets( List<Target> targCs = new ArrayList<Target>();
testdataFactory.generateTargets(100, targetDsCIdPref, targetDsCIdPref.concat(" description"))); for (Target t : testdataFactory.generateTargets(100, targetDsCIdPref, targetDsCIdPref.concat(" description"))) {
targCs.add(targetManagement.createTarget(t, TargetUpdateStatus.UNKNOWN, lastTargetQueryAlwaysOverdue,
t.getTargetInfo().getAddress()));
}
targCs = targetManagement.toggleTagAssignment(targCs, targTagZ).getAssignedEntity(); targCs = targetManagement.toggleTagAssignment(targCs, targTagZ).getAssignedEntity();
targCs = targetManagement.toggleTagAssignment(targCs, targTagW).getAssignedEntity(); targCs = targetManagement.toggleTagAssignment(targCs, targTagW).getAssignedEntity();
final String targetDsDIdPref = "targ-D"; final String targetDsDIdPref = "targ-D";
final List<Target> targDs = targetManagement.createTargets( List<Target> targDs = new ArrayList<Target>();
testdataFactory.generateTargets(100, targetDsDIdPref, targetDsDIdPref.concat(" description"))); for (Target t : testdataFactory.generateTargets(100, targetDsDIdPref, targetDsDIdPref.concat(" description"))) {
targDs.add(targetManagement.createTarget(t, TargetUpdateStatus.UNKNOWN, lastTargetNull,
t.getTargetInfo().getAddress()));
}
final String assignedC = targCs.iterator().next().getControllerId(); final String assignedC = targCs.iterator().next().getControllerId();
deploymentManagement.assignDistributionSet(setA.getId(), assignedC); deploymentManagement.assignDistributionSet(setA.getId(), assignedC);
@@ -155,6 +179,10 @@ public class TargetManagementSearchTest extends AbstractJpaIntegrationTest {
verifyThat200targetsWithGivenTagAreInStatusPendingorUnknown(targTagW, both, concat(targBs, targCs)); verifyThat200targetsWithGivenTagAreInStatusPendingorUnknown(targTagW, both, concat(targBs, targCs));
verfiyThat1TargetAIsInStatusPendingAndHasDSInstalled(installedSet, pending, verfiyThat1TargetAIsInStatusPendingAndHasDSInstalled(installedSet, pending,
targetManagement.findTargetByControllerID(installedC)); targetManagement.findTargetByControllerID(installedC));
expected = concat(targBs, targCs);
expected.removeAll(targetManagement.findTargetByControllerID(Lists.newArrayList(assignedB, assignedC)));
verifyThat198TargetsAreInStatusUnknownAndOverdue(unknown, expected);
} }
@Step @Step
@@ -164,10 +192,10 @@ public class TargetManagementSearchTest extends AbstractJpaIntegrationTest {
final String query = "updatestatus==pending and installedds.name==" + installedSet.getName(); final String query = "updatestatus==pending and installedds.name==" + installedSet.getName();
assertThat(targetManagement assertThat(targetManagement
.findTargetByFilters(pageReq, pending, null, installedSet.getId(), Boolean.FALSE, new String[0]) .findTargetByFilters(pageReq, pending, null, null, installedSet.getId(), Boolean.FALSE, new String[0])
.getContent()).as("has number of elements").hasSize(1) .getContent()).as("has number of elements").hasSize(1)
.as("that number is also returned by count query") .as("that number is also returned by count query")
.hasSize(Ints.saturatedCast(targetManagement.countTargetByFilters(pending, null, .hasSize(Ints.saturatedCast(targetManagement.countTargetByFilters(pending, null, null,
installedSet.getId(), Boolean.FALSE, new String[0]))) installedSet.getId(), Boolean.FALSE, new String[0])))
.as("and contains the following elements").containsExactly(expected) .as("and contains the following elements").containsExactly(expected)
.as("and filter query returns the same result") .as("and filter query returns the same result")
@@ -175,7 +203,7 @@ public class TargetManagementSearchTest extends AbstractJpaIntegrationTest {
.as("and NAMED filter query returns the same result").containsAll(targetManagement .as("and NAMED filter query returns the same result").containsAll(targetManagement
.findTargetsAll(new JpaTargetFilterQuery("test", query), pageReq).getContent()); .findTargetsAll(new JpaTargetFilterQuery("test", query), pageReq).getContent());
assertThat(targetManagement.findAllTargetIdsByFilters(pageReq, pending, null, installedSet.getId(), assertThat(targetManagement.findAllTargetIdsByFilters(pageReq, pending, null, null, installedSet.getId(),
Boolean.FALSE, new String[0])).as("has number of elements").hasSize(1) Boolean.FALSE, new String[0])).as("has number of elements").hasSize(1)
.as("and contains the following elements").containsExactly(expectedIdName) .as("and contains the following elements").containsExactly(expectedIdName)
.as("and NAMED filter query returns the same result").containsAll(targetManagement .as("and NAMED filter query returns the same result").containsAll(targetManagement
@@ -190,10 +218,10 @@ public class TargetManagementSearchTest extends AbstractJpaIntegrationTest {
final String query = "(updatestatus==pending or updatestatus==unknown) and tag==" + targTagW.getName(); final String query = "(updatestatus==pending or updatestatus==unknown) and tag==" + targTagW.getName();
assertThat(targetManagement.findTargetByFilters(pageReq, both, null, null, Boolean.FALSE, targTagW.getName()) assertThat(targetManagement
.getContent()).as("has number of elements").hasSize(200) .findTargetByFilters(pageReq, both, null, null, null, Boolean.FALSE, targTagW.getName()).getContent())
.as("that number is also returned by count query") .as("has number of elements").hasSize(200).as("that number is also returned by count query")
.hasSize(Ints.saturatedCast(targetManagement.countTargetByFilters(both, null, null, .hasSize(Ints.saturatedCast(targetManagement.countTargetByFilters(both, null, null, null,
Boolean.FALSE, targTagW.getName()))) Boolean.FALSE, targTagW.getName())))
.as("and contains the following elements").containsAll(expected) .as("and contains the following elements").containsAll(expected)
.as("and filter query returns the same result") .as("and filter query returns the same result")
@@ -201,7 +229,7 @@ public class TargetManagementSearchTest extends AbstractJpaIntegrationTest {
.as("and NAMED filter query returns the same result").containsAll(targetManagement .as("and NAMED filter query returns the same result").containsAll(targetManagement
.findTargetsAll(new JpaTargetFilterQuery("test", query), pageReq).getContent()); .findTargetsAll(new JpaTargetFilterQuery("test", query), pageReq).getContent());
assertThat(targetManagement.findAllTargetIdsByFilters(pageReq, both, null, null, Boolean.FALSE, assertThat(targetManagement.findAllTargetIdsByFilters(pageReq, both, null, null, null, Boolean.FALSE,
targTagW.getName())).as("has number of elements").hasSize(200).as("and contains the following elements") targTagW.getName())).as("has number of elements").hasSize(200).as("and contains the following elements")
.containsAll(expectedIdNames).as("and NAMED filter query returns the same result") .containsAll(expectedIdNames).as("and NAMED filter query returns the same result")
.containsAll(targetManagement.findAllTargetIdsByTargetFilterQuery(pageReq, .containsAll(targetManagement.findAllTargetIdsByTargetFilterQuery(pageReq,
@@ -224,10 +252,11 @@ public class TargetManagementSearchTest extends AbstractJpaIntegrationTest {
final List<TargetIdName> expectedIdNames = convertToIdNames(expected); final List<TargetIdName> expectedIdNames = convertToIdNames(expected);
final String query = "updatestatus==pending and tag==" + targTagW.getName(); final String query = "updatestatus==pending and tag==" + targTagW.getName();
assertThat(targetManagement.findTargetByFilters(pageReq, pending, null, null, Boolean.FALSE, targTagW.getName()) assertThat(targetManagement
.findTargetByFilters(pageReq, pending, null, null, null, Boolean.FALSE, targTagW.getName())
.getContent()).as("has number of elements").hasSize(2) .getContent()).as("has number of elements").hasSize(2)
.as("that number is also returned by count query") .as("that number is also returned by count query")
.hasSize(Ints.saturatedCast(targetManagement.countTargetByFilters(pending, null, null, .hasSize(Ints.saturatedCast(targetManagement.countTargetByFilters(pending, null, null, null,
Boolean.FALSE, targTagW.getName()))) Boolean.FALSE, targTagW.getName())))
.as("and contains the following elements").containsAll(expected) .as("and contains the following elements").containsAll(expected)
.as("and filter query returns the same result") .as("and filter query returns the same result")
@@ -235,7 +264,7 @@ public class TargetManagementSearchTest extends AbstractJpaIntegrationTest {
.as("and NAMED filter query returns the same result").containsAll(targetManagement .as("and NAMED filter query returns the same result").containsAll(targetManagement
.findTargetsAll(new JpaTargetFilterQuery("test", query), pageReq).getContent()); .findTargetsAll(new JpaTargetFilterQuery("test", query), pageReq).getContent());
assertThat(targetManagement.findAllTargetIdsByFilters(pageReq, pending, null, null, Boolean.FALSE, assertThat(targetManagement.findAllTargetIdsByFilters(pageReq, pending, null, null, null, Boolean.FALSE,
targTagW.getName())).as("has number of elements").hasSize(2).as("and contains the following elements") targTagW.getName())).as("has number of elements").hasSize(2).as("and contains the following elements")
.containsAll(expectedIdNames).as("and NAMED filter query returns the same result") .containsAll(expectedIdNames).as("and NAMED filter query returns the same result")
.containsAll(targetManagement.findAllTargetIdsByTargetFilterQuery(pageReq, .containsAll(targetManagement.findAllTargetIdsByTargetFilterQuery(pageReq,
@@ -250,18 +279,18 @@ public class TargetManagementSearchTest extends AbstractJpaIntegrationTest {
+ setA.getName() + ") and tag==" + targTagW.getName(); + setA.getName() + ") and tag==" + targTagW.getName();
assertThat(targetManagement assertThat(targetManagement
.findTargetByFilters(pageReq, pending, null, setA.getId(), Boolean.FALSE, targTagW.getName()) .findTargetByFilters(pageReq, pending, null, null, setA.getId(), Boolean.FALSE, targTagW.getName())
.getContent()).as("has number of elements").hasSize(2) .getContent()).as("has number of elements").hasSize(2)
.as("that number is also returned by count query") .as("that number is also returned by count query")
.hasSize(Ints.saturatedCast(targetManagement.countTargetByFilters(pending, null, setA.getId(), .hasSize(Ints.saturatedCast(targetManagement.countTargetByFilters(pending, null, null,
Boolean.FALSE, targTagW.getName()))) setA.getId(), Boolean.FALSE, targTagW.getName())))
.as("and contains the following elements").containsAll(expected) .as("and contains the following elements").containsAll(expected)
.as("and filter query returns the same result") .as("and filter query returns the same result")
.containsAll(targetManagement.findTargetsAll(query, pageReq).getContent()) .containsAll(targetManagement.findTargetsAll(query, pageReq).getContent())
.as("and NAMED filter query returns the same result").containsAll(targetManagement .as("and NAMED filter query returns the same result").containsAll(targetManagement
.findTargetsAll(new JpaTargetFilterQuery("test", query), pageReq).getContent()); .findTargetsAll(new JpaTargetFilterQuery("test", query), pageReq).getContent());
assertThat(targetManagement.findAllTargetIdsByFilters(pageReq, pending, null, null, Boolean.FALSE, assertThat(targetManagement.findAllTargetIdsByFilters(pageReq, pending, null, null, null, Boolean.FALSE,
targTagW.getName())).as("has number of elements").hasSize(2).as("and contains the following elements") targTagW.getName())).as("has number of elements").hasSize(2).as("and contains the following elements")
.containsAll(expectedIdNames).as("and NAMED filter query returns the same result") .containsAll(expectedIdNames).as("and NAMED filter query returns the same result")
.containsAll(targetManagement.findAllTargetIdsByTargetFilterQuery(pageReq, .containsAll(targetManagement.findAllTargetIdsByTargetFilterQuery(pageReq,
@@ -275,11 +304,10 @@ public class TargetManagementSearchTest extends AbstractJpaIntegrationTest {
final String query = "updatestatus==pending and (assignedds.name==" + setA.getName() + " or installedds.name==" final String query = "updatestatus==pending and (assignedds.name==" + setA.getName() + " or installedds.name=="
+ setA.getName() + ") and (name==*targ-B* or description==*targ-B*) and tag==" + targTagW.getName(); + setA.getName() + ") and (name==*targ-B* or description==*targ-B*) and tag==" + targTagW.getName();
assertThat(targetManagement assertThat(targetManagement.findTargetByFilters(pageReq, pending, null, "%targ-B%", setA.getId(), Boolean.FALSE,
.findTargetByFilters(pageReq, pending, "%targ-B%", setA.getId(), Boolean.FALSE, targTagW.getName()) targTagW.getName()).getContent()).as("has number of elements").hasSize(1)
.getContent()).as("has number of elements").hasSize(1)
.as("that number is also returned by count query") .as("that number is also returned by count query")
.hasSize(Ints.saturatedCast(targetManagement.countTargetByFilters(pending, "%targ-B%", .hasSize(Ints.saturatedCast(targetManagement.countTargetByFilters(pending, null, "%targ-B%",
setA.getId(), Boolean.FALSE, targTagW.getName()))) setA.getId(), Boolean.FALSE, targTagW.getName())))
.as("and contains the following elements").containsExactly(expected) .as("and contains the following elements").containsExactly(expected)
.as("and filter query returns the same result") .as("and filter query returns the same result")
@@ -287,11 +315,11 @@ public class TargetManagementSearchTest extends AbstractJpaIntegrationTest {
.as("and NAMED filter query returns the same result").containsAll(targetManagement .as("and NAMED filter query returns the same result").containsAll(targetManagement
.findTargetsAll(new JpaTargetFilterQuery("test", query), pageReq).getContent()); .findTargetsAll(new JpaTargetFilterQuery("test", query), pageReq).getContent());
assertThat(targetManagement.findAllTargetIdsByFilters(pageReq, pending, "%targ-B%", setA.getId(), Boolean.FALSE, assertThat(targetManagement.findAllTargetIdsByFilters(pageReq, pending, null, "%targ-B%", setA.getId(),
targTagW.getName())).as("has number of elements").hasSize(1).as("and contains the following elements") Boolean.FALSE, targTagW.getName())).as("has number of elements").hasSize(1)
.containsExactly(expectedIdName).as("and NAMED filter query returns the same result") .as("and contains the following elements").containsExactly(expectedIdName)
.containsAll(targetManagement.findAllTargetIdsByTargetFilterQuery(pageReq, .as("and NAMED filter query returns the same result").containsAll(targetManagement
new JpaTargetFilterQuery("test", query))); .findAllTargetIdsByTargetFilterQuery(pageReq, new JpaTargetFilterQuery("test", query)));
} }
@Step @Step
@@ -302,10 +330,10 @@ public class TargetManagementSearchTest extends AbstractJpaIntegrationTest {
+ setA.getName() + ") and (name==*targ-A* or description==*targ-A*)"; + setA.getName() + ") and (name==*targ-A* or description==*targ-A*)";
assertThat(targetManagement assertThat(targetManagement
.findTargetByFilters(pageReq, pending, "%targ-A%", setA.getId(), Boolean.FALSE, new String[0]) .findTargetByFilters(pageReq, pending, null, "%targ-A%", setA.getId(), Boolean.FALSE, new String[0])
.getContent()).as("has number of elements").hasSize(1) .getContent()).as("has number of elements").hasSize(1)
.as("that number is also returned by count query") .as("that number is also returned by count query")
.hasSize(Ints.saturatedCast(targetManagement.countTargetByFilters(pending, "%targ-A%", .hasSize(Ints.saturatedCast(targetManagement.countTargetByFilters(pending, null, "%targ-A%",
setA.getId(), Boolean.FALSE, new String[0]))) setA.getId(), Boolean.FALSE, new String[0])))
.as("and contains the following elements").containsExactly(expected) .as("and contains the following elements").containsExactly(expected)
.as("and filter query returns the same result") .as("and filter query returns the same result")
@@ -313,11 +341,11 @@ public class TargetManagementSearchTest extends AbstractJpaIntegrationTest {
.as("and NAMED filter query returns the same result").containsAll(targetManagement .as("and NAMED filter query returns the same result").containsAll(targetManagement
.findTargetsAll(new JpaTargetFilterQuery("test", query), pageReq).getContent()); .findTargetsAll(new JpaTargetFilterQuery("test", query), pageReq).getContent());
assertThat(targetManagement.findAllTargetIdsByFilters(pageReq, pending, "%targ-A%", setA.getId(), Boolean.FALSE, assertThat(targetManagement.findAllTargetIdsByFilters(pageReq, pending, null, "%targ-A%", setA.getId(),
new String[0])).as("has number of elements").hasSize(1).as("and contains the following elements") Boolean.FALSE, new String[0])).as("has number of elements").hasSize(1)
.containsExactly(expectedIdName).as("and NAMED filter query returns the same result") .as("and contains the following elements").containsExactly(expectedIdName)
.containsAll(targetManagement.findAllTargetIdsByTargetFilterQuery(pageReq, .as("and NAMED filter query returns the same result").containsAll(targetManagement
new JpaTargetFilterQuery("test", query))); .findAllTargetIdsByTargetFilterQuery(pageReq, new JpaTargetFilterQuery("test", query)));
} }
@Step @Step
@@ -328,17 +356,17 @@ public class TargetManagementSearchTest extends AbstractJpaIntegrationTest {
+ setA.getName() + ")"; + setA.getName() + ")";
assertThat(targetManagement assertThat(targetManagement
.findTargetByFilters(pageReq, pending, null, setA.getId(), Boolean.FALSE, new String[0]).getContent()) .findTargetByFilters(pageReq, pending, null, null, setA.getId(), Boolean.FALSE, new String[0])
.as("has number of elements").hasSize(3).as("that number is also returned by count query") .getContent()).as("has number of elements").hasSize(3).as("that number is also returned by count query")
.hasSize(Ints.saturatedCast(targetManagement.countTargetByFilters(pending, null, setA.getId(), .hasSize(Ints.saturatedCast(targetManagement.countTargetByFilters(pending, null, null,
Boolean.FALSE, new String[0]))) setA.getId(), Boolean.FALSE, new String[0])))
.as("and contains the following elements").containsAll(expected) .as("and contains the following elements").containsAll(expected)
.as("and filter query returns the same result") .as("and filter query returns the same result")
.containsAll(targetManagement.findTargetsAll(query, pageReq).getContent()) .containsAll(targetManagement.findTargetsAll(query, pageReq).getContent())
.as("and NAMED filter query returns the same result").containsAll(targetManagement .as("and NAMED filter query returns the same result").containsAll(targetManagement
.findTargetsAll(new JpaTargetFilterQuery("test", query), pageReq).getContent()); .findTargetsAll(new JpaTargetFilterQuery("test", query), pageReq).getContent());
assertThat(targetManagement.findAllTargetIdsByFilters(pageReq, pending, null, setA.getId(), Boolean.FALSE, assertThat(targetManagement.findAllTargetIdsByFilters(pageReq, pending, null, null, setA.getId(), Boolean.FALSE,
new String[0])).as("has number of elements").hasSize(3).as("and contains the following elements") new String[0])).as("has number of elements").hasSize(3).as("and contains the following elements")
.containsAll(expectedIdNames).as("and NAMED filter query returns the same result") .containsAll(expectedIdNames).as("and NAMED filter query returns the same result")
.containsAll(targetManagement.findAllTargetIdsByTargetFilterQuery(pageReq, .containsAll(targetManagement.findAllTargetIdsByTargetFilterQuery(pageReq,
@@ -351,10 +379,10 @@ public class TargetManagementSearchTest extends AbstractJpaIntegrationTest {
final List<TargetIdName> expectedIdNames = convertToIdNames(expected); final List<TargetIdName> expectedIdNames = convertToIdNames(expected);
final String query = "updatestatus==pending"; final String query = "updatestatus==pending";
assertThat(targetManagement.findTargetByFilters(pageReq, pending, null, null, Boolean.FALSE, new String[0]) assertThat(targetManagement
.getContent()).as("has number of elements").hasSize(3) .findTargetByFilters(pageReq, pending, null, null, null, Boolean.FALSE, new String[0]).getContent())
.as("that number is also returned by count query") .as("has number of elements").hasSize(3).as("that number is also returned by count query")
.hasSize(Ints.saturatedCast(targetManagement.countTargetByFilters(pending, null, null, .hasSize(Ints.saturatedCast(targetManagement.countTargetByFilters(pending, null, null, null,
Boolean.FALSE, new String[0]))) Boolean.FALSE, new String[0])))
.as("and contains the following elements").containsAll(expected) .as("and contains the following elements").containsAll(expected)
.as("and filter query returns the same result") .as("and filter query returns the same result")
@@ -362,9 +390,8 @@ public class TargetManagementSearchTest extends AbstractJpaIntegrationTest {
.as("and NAMED filter query returns the same result").containsAll(targetManagement .as("and NAMED filter query returns the same result").containsAll(targetManagement
.findTargetsAll(new JpaTargetFilterQuery("test", query), pageReq).getContent()); .findTargetsAll(new JpaTargetFilterQuery("test", query), pageReq).getContent());
assertThat( assertThat(targetManagement.findAllTargetIdsByFilters(pageReq, pending, null, null, null, Boolean.FALSE,
targetManagement.findAllTargetIdsByFilters(pageReq, pending, null, null, Boolean.FALSE, new String[0])) new String[0])).as("has number of elements").hasSize(3).as("and contains the following elements")
.as("has number of elements").hasSize(3).as("and contains the following elements")
.containsAll(expectedIdNames).as("and NAMED filter query returns the same result") .containsAll(expectedIdNames).as("and NAMED filter query returns the same result")
.containsAll(targetManagement.findAllTargetIdsByTargetFilterQuery(pageReq, .containsAll(targetManagement.findAllTargetIdsByTargetFilterQuery(pageReq,
new JpaTargetFilterQuery("test", query))); new JpaTargetFilterQuery("test", query)));
@@ -378,18 +405,18 @@ public class TargetManagementSearchTest extends AbstractJpaIntegrationTest {
+ targTagW.getName(); + targTagW.getName();
assertThat(targetManagement assertThat(targetManagement
.findTargetByFilters(pageReq, unknown, "%targ-B%", null, Boolean.FALSE, targTagW.getName()) .findTargetByFilters(pageReq, unknown, null, "%targ-B%", null, Boolean.FALSE, targTagW.getName())
.getContent()).as("has number of elements").hasSize(99) .getContent()).as("has number of elements").hasSize(99)
.as("that number is also returned by count query") .as("that number is also returned by count query")
.hasSize(Ints.saturatedCast(targetManagement.countTargetByFilters(unknown, "%targ-B%", null, .hasSize(Ints.saturatedCast(targetManagement.countTargetByFilters(unknown, null, "%targ-B%",
Boolean.FALSE, targTagW.getName()))) null, Boolean.FALSE, targTagW.getName())))
.as("and contains the following elements").containsAll(expected) .as("and contains the following elements").containsAll(expected)
.as("and filter query returns the same result") .as("and filter query returns the same result")
.containsAll(targetManagement.findTargetsAll(query, pageReq).getContent()) .containsAll(targetManagement.findTargetsAll(query, pageReq).getContent())
.as("and NAMED filter query returns the same result").containsAll(targetManagement .as("and NAMED filter query returns the same result").containsAll(targetManagement
.findTargetsAll(new JpaTargetFilterQuery("test", query), pageReq).getContent()); .findTargetsAll(new JpaTargetFilterQuery("test", query), pageReq).getContent());
assertThat(targetManagement.findAllTargetIdsByFilters(pageReq, unknown, "%targ-B%", null, Boolean.FALSE, assertThat(targetManagement.findAllTargetIdsByFilters(pageReq, unknown, null, "%targ-B%", null, Boolean.FALSE,
targTagW.getName())).as("has number of elements").hasSize(99).as("and contains the following elements") targTagW.getName())).as("has number of elements").hasSize(99).as("and contains the following elements")
.containsAll(expectedIdNames).as("and NAMED filter query returns the same result") .containsAll(expectedIdNames).as("and NAMED filter query returns the same result")
.containsAll(targetManagement.findAllTargetIdsByTargetFilterQuery(pageReq, .containsAll(targetManagement.findAllTargetIdsByTargetFilterQuery(pageReq,
@@ -403,17 +430,17 @@ public class TargetManagementSearchTest extends AbstractJpaIntegrationTest {
final String query = "updatestatus==unknown and (name==*targ-A* or description==*targ-A*)"; final String query = "updatestatus==unknown and (name==*targ-A* or description==*targ-A*)";
assertThat(targetManagement assertThat(targetManagement
.findTargetByFilters(pageReq, unknown, "%targ-A%", null, Boolean.FALSE, new String[0]).getContent()) .findTargetByFilters(pageReq, unknown, null, "%targ-A%", null, Boolean.FALSE, new String[0])
.as("has number of elements").hasSize(99).as("that number is also returned by count query") .getContent()).as("has number of elements").hasSize(99)
.hasSize(Ints.saturatedCast(targetManagement.countTargetByFilters(unknown, "%targ-A%", null, .as("that number is also returned by count query").hasSize(Ints.saturatedCast(targetManagement
Boolean.FALSE, new String[0]))) .countTargetByFilters(unknown, null, "%targ-A%", null, Boolean.FALSE, new String[0])))
.as("and contains the following elements").containsAll(expected) .as("and contains the following elements").containsAll(expected)
.as("and filter query returns the same result") .as("and filter query returns the same result")
.containsAll(targetManagement.findTargetsAll(query, pageReq).getContent()) .containsAll(targetManagement.findTargetsAll(query, pageReq).getContent())
.as("and NAMED filter query returns the same result").containsAll(targetManagement .as("and NAMED filter query returns the same result").containsAll(targetManagement
.findTargetsAll(new JpaTargetFilterQuery("test", query), pageReq).getContent()); .findTargetsAll(new JpaTargetFilterQuery("test", query), pageReq).getContent());
assertThat(targetManagement.findAllTargetIdsByFilters(pageReq, unknown, "%targ-A%", null, Boolean.FALSE, assertThat(targetManagement.findAllTargetIdsByFilters(pageReq, unknown, null, "%targ-A%", null, Boolean.FALSE,
new String[0])).as("has number of elements").hasSize(99).as("and contains the following elements") new String[0])).as("has number of elements").hasSize(99).as("and contains the following elements")
.containsAll(expectedIdNames).as("and NAMED filter query returns the same result") .containsAll(expectedIdNames).as("and NAMED filter query returns the same result")
.containsAll(targetManagement.findAllTargetIdsByTargetFilterQuery(pageReq, .containsAll(targetManagement.findAllTargetIdsByTargetFilterQuery(pageReq,
@@ -427,16 +454,16 @@ public class TargetManagementSearchTest extends AbstractJpaIntegrationTest {
+ setA.getName() + ")"; + setA.getName() + ")";
assertThat(targetManagement assertThat(targetManagement
.findTargetByFilters(pageReq, unknown, null, setA.getId(), Boolean.FALSE, new String[0]).getContent()) .findTargetByFilters(pageReq, unknown, null, null, setA.getId(), Boolean.FALSE, new String[0])
.as("has number of elements").hasSize(0).as("that number is also returned by count query") .getContent()).as("has number of elements").hasSize(0).as("that number is also returned by count query")
.hasSize(Ints.saturatedCast(targetManagement.countTargetByFilters(unknown, null, setA.getId(), .hasSize(Ints.saturatedCast(targetManagement.countTargetByFilters(unknown, null, null,
Boolean.FALSE, new String[0]))) setA.getId(), Boolean.FALSE, new String[0])))
.as("and filter query returns the same result") .as("and filter query returns the same result")
.hasSize(targetManagement.findTargetsAll(query, pageReq).getContent().size()) .hasSize(targetManagement.findTargetsAll(query, pageReq).getContent().size())
.as("and NAMED filter query returns the same result").hasSize(targetManagement .as("and NAMED filter query returns the same result").hasSize(targetManagement
.findTargetsAll(new JpaTargetFilterQuery("test", query), pageReq).getContent().size()); .findTargetsAll(new JpaTargetFilterQuery("test", query), pageReq).getContent().size());
assertThat(targetManagement.findAllTargetIdsByFilters(pageReq, unknown, null, setA.getId(), Boolean.FALSE, assertThat(targetManagement.findAllTargetIdsByFilters(pageReq, unknown, null, null, setA.getId(), Boolean.FALSE,
new String[0])).as("has number of elements").hasSize(0) new String[0])).as("has number of elements").hasSize(0)
.as("and NAMED filter query returns the same result").containsAll(targetManagement .as("and NAMED filter query returns the same result").containsAll(targetManagement
.findAllTargetIdsByTargetFilterQuery(pageReq, new JpaTargetFilterQuery("test", query))); .findAllTargetIdsByTargetFilterQuery(pageReq, new JpaTargetFilterQuery("test", query)));
@@ -449,10 +476,10 @@ public class TargetManagementSearchTest extends AbstractJpaIntegrationTest {
final String query = "updatestatus==unknown and (tag==" + targTagY.getName() + " or tag==" + targTagW.getName() final String query = "updatestatus==unknown and (tag==" + targTagY.getName() + " or tag==" + targTagW.getName()
+ ")"; + ")";
assertThat(targetManagement.findTargetByFilters(pageReq, unknown, null, null, Boolean.FALSE, targTagY.getName(), assertThat(targetManagement.findTargetByFilters(pageReq, unknown, null, null, null, Boolean.FALSE,
targTagW.getName()).getContent()).as("has number of elements").hasSize(198) targTagY.getName(), targTagW.getName()).getContent()).as("has number of elements").hasSize(198)
.as("that number is also returned by count query") .as("that number is also returned by count query")
.hasSize(Ints.saturatedCast(targetManagement.countTargetByFilters(unknown, null, null, .hasSize(Ints.saturatedCast(targetManagement.countTargetByFilters(unknown, null, null, null,
Boolean.FALSE, targTagY.getName(), targTagW.getName()))) Boolean.FALSE, targTagY.getName(), targTagW.getName())))
.as("and contains the following elements").containsAll(expected) .as("and contains the following elements").containsAll(expected)
.as("and filter query returns the same result") .as("and filter query returns the same result")
@@ -460,7 +487,7 @@ public class TargetManagementSearchTest extends AbstractJpaIntegrationTest {
.as("and NAMED filter query returns the same result").containsAll(targetManagement .as("and NAMED filter query returns the same result").containsAll(targetManagement
.findTargetsAll(new JpaTargetFilterQuery("test", query), pageReq).getContent()); .findTargetsAll(new JpaTargetFilterQuery("test", query), pageReq).getContent());
assertThat(targetManagement.findAllTargetIdsByFilters(pageReq, unknown, null, null, Boolean.FALSE, assertThat(targetManagement.findAllTargetIdsByFilters(pageReq, unknown, null, null, null, Boolean.FALSE,
targTagY.getName(), targTagW.getName())).as("has number of elements").hasSize(198) targTagY.getName(), targTagW.getName())).as("has number of elements").hasSize(198)
.as("and contains the following elements").containsAll(expectedIdNames) .as("and contains the following elements").containsAll(expectedIdNames)
.as("and NAMED filter query returns the same result").containsAll(targetManagement .as("and NAMED filter query returns the same result").containsAll(targetManagement
@@ -473,10 +500,10 @@ public class TargetManagementSearchTest extends AbstractJpaIntegrationTest {
final List<TargetIdName> expectedIdNames = convertToIdNames(expected); final List<TargetIdName> expectedIdNames = convertToIdNames(expected);
final String query = "updatestatus==unknown"; final String query = "updatestatus==unknown";
assertThat(targetManagement.findTargetByFilters(pageReq, unknown, null, null, Boolean.FALSE, new String[0]) assertThat(targetManagement
.getContent()).as("has number of elements").hasSize(397) .findTargetByFilters(pageReq, unknown, null, null, null, Boolean.FALSE, new String[0]).getContent())
.as("that number is also returned by count query") .as("has number of elements").hasSize(397).as("that number is also returned by count query")
.hasSize(Ints.saturatedCast(targetManagement.countTargetByFilters(unknown, null, null, .hasSize(Ints.saturatedCast(targetManagement.countTargetByFilters(unknown, null, null, null,
Boolean.FALSE, new String[0]))) Boolean.FALSE, new String[0])))
.as("and contains the following elements").containsAll(expected) .as("and contains the following elements").containsAll(expected)
.as("and filter query returns the same result") .as("and filter query returns the same result")
@@ -484,9 +511,34 @@ public class TargetManagementSearchTest extends AbstractJpaIntegrationTest {
.as("and NAMED filter query returns the same result").containsAll(targetManagement .as("and NAMED filter query returns the same result").containsAll(targetManagement
.findTargetsAll(new JpaTargetFilterQuery("test", query), pageReq).getContent()); .findTargetsAll(new JpaTargetFilterQuery("test", query), pageReq).getContent());
assertThat( assertThat(targetManagement.findAllTargetIdsByFilters(pageReq, unknown, null, null, null, Boolean.FALSE,
targetManagement.findAllTargetIdsByFilters(pageReq, unknown, null, null, Boolean.FALSE, new String[0])) new String[0])).as("has number of elements").hasSize(397).as("and contains the following elements")
.as("has number of elements").hasSize(397).as("and contains the following elements") .containsAll(expectedIdNames).as("and NAMED filter query returns the same result")
.containsAll(targetManagement.findAllTargetIdsByTargetFilterQuery(pageReq,
new JpaTargetFilterQuery("test", query)));
}
@Step
private void verifyThat198TargetsAreInStatusUnknownAndOverdue(final List<TargetUpdateStatus> unknown,
final List<Target> expected) {
final List<TargetIdName> expectedIdNames = convertToIdNames(expected);
// be careful: simple filters are concatenated using AND-gating
final String query = "lastcontrollerrequestat=le=${overdue_ts};updatestatus==UNKNOWN";
assertThat(targetManagement
.findTargetByFilters(pageReq, unknown, Boolean.TRUE, null, null, Boolean.FALSE, new String[0])
.getContent()).as("has number of elements").hasSize(198)
.as("that number is also returned by count query")
.hasSize(Ints.saturatedCast(targetManagement.countTargetByFilters(unknown, Boolean.TRUE, null,
null, Boolean.FALSE, new String[0])))
.as("and contains the following elements").containsAll(expected)
.as("and filter query returns the same result")
.containsAll(targetManagement.findTargetsAll(query, pageReq).getContent())
.as("and NAMED filter query returns the same result").containsAll(targetManagement
.findTargetsAll(new JpaTargetFilterQuery("test", query), pageReq).getContent());
assertThat(targetManagement.findAllTargetIdsByFilters(pageReq, unknown, Boolean.TRUE, null, null, Boolean.FALSE,
new String[0])).as("has number of elements").hasSize(198).as("and contains the following elements")
.containsAll(expectedIdNames).as("and NAMED filter query returns the same result") .containsAll(expectedIdNames).as("and NAMED filter query returns the same result")
.containsAll(targetManagement.findAllTargetIdsByTargetFilterQuery(pageReq, .containsAll(targetManagement.findAllTargetIdsByTargetFilterQuery(pageReq,
new JpaTargetFilterQuery("test", query))); new JpaTargetFilterQuery("test", query)));
@@ -499,10 +551,10 @@ public class TargetManagementSearchTest extends AbstractJpaIntegrationTest {
+ " or installedds.name==" + setA.getName() + ")"; + " or installedds.name==" + setA.getName() + ")";
assertThat(targetManagement assertThat(targetManagement
.findTargetByFilters(pageReq, null, "%targ-A%", setA.getId(), Boolean.FALSE, new String[0]) .findTargetByFilters(pageReq, null, null, "%targ-A%", setA.getId(), Boolean.FALSE, new String[0])
.getContent()).as("has number of elements").hasSize(1) .getContent()).as("has number of elements").hasSize(1)
.as("that number is also returned by count query") .as("that number is also returned by count query")
.hasSize(Ints.saturatedCast(targetManagement.countTargetByFilters(null, "%targ-A%", .hasSize(Ints.saturatedCast(targetManagement.countTargetByFilters(null, null, "%targ-A%",
setA.getId(), Boolean.FALSE, new String[0]))) setA.getId(), Boolean.FALSE, new String[0])))
.as("and contains the following elements").containsExactly(expected) .as("and contains the following elements").containsExactly(expected)
.as("and filter query returns the same result") .as("and filter query returns the same result")
@@ -510,11 +562,11 @@ public class TargetManagementSearchTest extends AbstractJpaIntegrationTest {
.as("and NAMED filter query returns the same result").containsAll(targetManagement .as("and NAMED filter query returns the same result").containsAll(targetManagement
.findTargetsAll(new JpaTargetFilterQuery("test", query), pageReq).getContent()); .findTargetsAll(new JpaTargetFilterQuery("test", query), pageReq).getContent());
assertThat(targetManagement.findAllTargetIdsByFilters(pageReq, null, "%targ-A%", setA.getId(), Boolean.FALSE, assertThat(targetManagement.findAllTargetIdsByFilters(pageReq, null, null, "%targ-A%", setA.getId(),
new String[0])).as("has number of elements").hasSize(1).as("and contains the following elements") Boolean.FALSE, new String[0])).as("has number of elements").hasSize(1)
.containsExactly(expectedIdName).as("and NAMED filter query returns the same result") .as("and contains the following elements").containsExactly(expectedIdName)
.containsAll(targetManagement.findAllTargetIdsByTargetFilterQuery(pageReq, .as("and NAMED filter query returns the same result").containsAll(targetManagement
new JpaTargetFilterQuery("test", query))); .findAllTargetIdsByTargetFilterQuery(pageReq, new JpaTargetFilterQuery("test", query)));
} }
@Step @Step
@@ -522,18 +574,19 @@ public class TargetManagementSearchTest extends AbstractJpaIntegrationTest {
final List<TargetIdName> expectedIdNames = convertToIdNames(expected); final List<TargetIdName> expectedIdNames = convertToIdNames(expected);
final String query = "assignedds.name==" + setA.getName() + " or installedds.name==" + setA.getName(); final String query = "assignedds.name==" + setA.getName() + " or installedds.name==" + setA.getName();
assertThat(targetManagement.findTargetByFilters(pageReq, null, null, setA.getId(), Boolean.FALSE, new String[0]) assertThat(targetManagement
.findTargetByFilters(pageReq, null, null, null, setA.getId(), Boolean.FALSE, new String[0])
.getContent()).as("has number of elements").hasSize(3) .getContent()).as("has number of elements").hasSize(3)
.as("that number is also returned by count query") .as("that number is also returned by count query")
.hasSize(Ints.saturatedCast(targetManagement.countTargetByFilters(null, null, setA.getId(), .hasSize(Ints.saturatedCast(targetManagement.countTargetByFilters(null, null, null,
Boolean.FALSE, new String[0]))) setA.getId(), Boolean.FALSE, new String[0])))
.as("and contains the following elements").containsAll(expected) .as("and contains the following elements").containsAll(expected)
.as("and filter query returns the same result") .as("and filter query returns the same result")
.containsAll(targetManagement.findTargetsAll(query, pageReq).getContent()) .containsAll(targetManagement.findTargetsAll(query, pageReq).getContent())
.as("and NAMED filter query returns the same result").containsAll(targetManagement .as("and NAMED filter query returns the same result").containsAll(targetManagement
.findTargetsAll(new JpaTargetFilterQuery("test", query), pageReq).getContent()); .findTargetsAll(new JpaTargetFilterQuery("test", query), pageReq).getContent());
assertThat(targetManagement.findAllTargetIdsByFilters(pageReq, null, null, setA.getId(), Boolean.FALSE, assertThat(targetManagement.findAllTargetIdsByFilters(pageReq, null, null, null, setA.getId(), Boolean.FALSE,
new String[0])).as("has number of elements").hasSize(3).as("and contains the following elements") new String[0])).as("has number of elements").hasSize(3).as("and contains the following elements")
.containsAll(expectedIdNames).as("and NAMED filter query returns the same result") .containsAll(expectedIdNames).as("and NAMED filter query returns the same result")
.containsAll(targetManagement.findAllTargetIdsByTargetFilterQuery(pageReq, .containsAll(targetManagement.findAllTargetIdsByTargetFilterQuery(pageReq,
@@ -545,18 +598,18 @@ public class TargetManagementSearchTest extends AbstractJpaIntegrationTest {
final String query = "(name==*targ-C* or description==*targ-C*) and tag==" + targTagX.getName() final String query = "(name==*targ-C* or description==*targ-C*) and tag==" + targTagX.getName()
+ " and (assignedds.name==" + setA.getName() + " or installedds.name==" + setA.getName() + ")"; + " and (assignedds.name==" + setA.getName() + " or installedds.name==" + setA.getName() + ")";
assertThat(targetManagement assertThat(targetManagement
.findTargetByFilters(pageReq, null, "%targ-C%", setA.getId(), Boolean.FALSE, targTagX.getName()) .findTargetByFilters(pageReq, null, null, "%targ-C%", setA.getId(), Boolean.FALSE, targTagX.getName())
.getContent()).as("has number of elements").hasSize(0) .getContent()).as("has number of elements").hasSize(0)
.as("that number is also returned by count query") .as("that number is also returned by count query")
.hasSize(Ints.saturatedCast(targetManagement.countTargetByFilters(null, "%targ-C%", .hasSize(Ints.saturatedCast(targetManagement.countTargetByFilters(null, null, "%targ-C%",
setA.getId(), Boolean.FALSE, targTagX.getName()))) setA.getId(), Boolean.FALSE, targTagX.getName())))
.as("and filter query returns the same result") .as("and filter query returns the same result")
.hasSize(targetManagement.findTargetsAll(query, pageReq).getContent().size()) .hasSize(targetManagement.findTargetsAll(query, pageReq).getContent().size())
.as("and NAMED filter query returns the same result").hasSize(targetManagement .as("and NAMED filter query returns the same result").hasSize(targetManagement
.findTargetsAll(new JpaTargetFilterQuery("test", query), pageReq).getContent().size()); .findTargetsAll(new JpaTargetFilterQuery("test", query), pageReq).getContent().size());
assertThat(targetManagement.findAllTargetIdsByFilters(pageReq, null, "%targ-C%", setA.getId(), Boolean.FALSE, assertThat(targetManagement.findAllTargetIdsByFilters(pageReq, null, null, "%targ-C%", setA.getId(),
targTagX.getName())).as("has number of elements").hasSize(0) Boolean.FALSE, targTagX.getName())).as("has number of elements").hasSize(0)
.as("and NAMED filter query returns the same result").containsAll(targetManagement .as("and NAMED filter query returns the same result").containsAll(targetManagement
.findAllTargetIdsByTargetFilterQuery(pageReq, new JpaTargetFilterQuery("test", query))); .findAllTargetIdsByTargetFilterQuery(pageReq, new JpaTargetFilterQuery("test", query)));
} }
@@ -566,18 +619,18 @@ public class TargetManagementSearchTest extends AbstractJpaIntegrationTest {
final String query = "(name==*targ-A* or description==*targ-A*) and tag==" + targTagW.getName() final String query = "(name==*targ-A* or description==*targ-A*) and tag==" + targTagW.getName()
+ " and (assignedds.name==" + setA.getName() + " or installedds.name==" + setA.getName() + ")"; + " and (assignedds.name==" + setA.getName() + " or installedds.name==" + setA.getName() + ")";
assertThat(targetManagement assertThat(targetManagement
.findTargetByFilters(pageReq, null, "%targ-A%", setA.getId(), Boolean.FALSE, targTagW.getName()) .findTargetByFilters(pageReq, null, null, "%targ-A%", setA.getId(), Boolean.FALSE, targTagW.getName())
.getContent()).as("has number of elements").hasSize(0) .getContent()).as("has number of elements").hasSize(0)
.as("that number is also returned by count query") .as("that number is also returned by count query")
.hasSize(Ints.saturatedCast(targetManagement.countTargetByFilters(null, "%targ-A%", .hasSize(Ints.saturatedCast(targetManagement.countTargetByFilters(null, null, "%targ-A%",
setA.getId(), Boolean.FALSE, targTagW.getName()))) setA.getId(), Boolean.FALSE, targTagW.getName())))
.as("and filter query returns the same result") .as("and filter query returns the same result")
.hasSize(targetManagement.findTargetsAll(query, pageReq).getContent().size()) .hasSize(targetManagement.findTargetsAll(query, pageReq).getContent().size())
.as("and NAMED filter query returns the same result").hasSize(targetManagement .as("and NAMED filter query returns the same result").hasSize(targetManagement
.findTargetsAll(new JpaTargetFilterQuery("test", query), pageReq).getContent().size()); .findTargetsAll(new JpaTargetFilterQuery("test", query), pageReq).getContent().size());
assertThat(targetManagement.findAllTargetIdsByFilters(pageReq, null, "%targ-A%", setA.getId(), Boolean.FALSE, assertThat(targetManagement.findAllTargetIdsByFilters(pageReq, null, null, "%targ-A%", setA.getId(),
targTagW.getName())).as("has number of elements").hasSize(0) Boolean.FALSE, targTagW.getName())).as("has number of elements").hasSize(0)
.as("and NAMED filter query returns the same result").containsAll(targetManagement .as("and NAMED filter query returns the same result").containsAll(targetManagement
.findAllTargetIdsByTargetFilterQuery(pageReq, new JpaTargetFilterQuery("test", query))); .findAllTargetIdsByTargetFilterQuery(pageReq, new JpaTargetFilterQuery("test", query)));
} }
@@ -589,10 +642,10 @@ public class TargetManagementSearchTest extends AbstractJpaIntegrationTest {
final String query = "(name==*targ-c* or description==*targ-C*) and tag==" + targTagW.getName() final String query = "(name==*targ-c* or description==*targ-C*) and tag==" + targTagW.getName()
+ " and (assignedds.name==" + setA.getName() + " or installedds.name==" + setA.getName() + ")"; + " and (assignedds.name==" + setA.getName() + " or installedds.name==" + setA.getName() + ")";
assertThat(targetManagement assertThat(targetManagement
.findTargetByFilters(pageReq, null, "%targ-C%", setA.getId(), Boolean.FALSE, targTagW.getName()) .findTargetByFilters(pageReq, null, null, "%targ-C%", setA.getId(), Boolean.FALSE, targTagW.getName())
.getContent()).as("has number of elements").hasSize(1) .getContent()).as("has number of elements").hasSize(1)
.as("that number is also returned by count query") .as("that number is also returned by count query")
.hasSize(Ints.saturatedCast(targetManagement.countTargetByFilters(null, "%targ-C%", .hasSize(Ints.saturatedCast(targetManagement.countTargetByFilters(null, null, "%targ-C%",
setA.getId(), Boolean.FALSE, targTagW.getName()))) setA.getId(), Boolean.FALSE, targTagW.getName())))
.as("and contains the following elements").containsExactly(expected) .as("and contains the following elements").containsExactly(expected)
.as("and filter query returns the same result") .as("and filter query returns the same result")
@@ -600,11 +653,11 @@ public class TargetManagementSearchTest extends AbstractJpaIntegrationTest {
.as("and NAMED filter query returns the same result").containsAll(targetManagement .as("and NAMED filter query returns the same result").containsAll(targetManagement
.findTargetsAll(new JpaTargetFilterQuery("test", query), pageReq).getContent()); .findTargetsAll(new JpaTargetFilterQuery("test", query), pageReq).getContent());
assertThat(targetManagement.findAllTargetIdsByFilters(pageReq, null, "%targ-C%", setA.getId(), Boolean.FALSE, assertThat(targetManagement.findAllTargetIdsByFilters(pageReq, null, null, "%targ-C%", setA.getId(),
targTagW.getName())).as("has number of elements").hasSize(1).as("and contains the following elements") Boolean.FALSE, targTagW.getName())).as("has number of elements").hasSize(1)
.containsExactly(expectedIdName).as("and NAMED filter query returns the same result") .as("and contains the following elements").containsExactly(expectedIdName)
.containsAll(targetManagement.findAllTargetIdsByTargetFilterQuery(pageReq, .as("and NAMED filter query returns the same result").containsAll(targetManagement
new JpaTargetFilterQuery("test", query))); .findAllTargetIdsByTargetFilterQuery(pageReq, new JpaTargetFilterQuery("test", query)));
} }
@Step @Step
@@ -613,10 +666,10 @@ public class TargetManagementSearchTest extends AbstractJpaIntegrationTest {
final List<TargetIdName> expectedIdNames = convertToIdNames(expected); final List<TargetIdName> expectedIdNames = convertToIdNames(expected);
final String query = "(name==*targ-B* or description==*targ-B*) and (tag==" + targTagY.getName() + " or tag==" final String query = "(name==*targ-B* or description==*targ-B*) and (tag==" + targTagY.getName() + " or tag=="
+ targTagW.getName() + ")"; + targTagW.getName() + ")";
assertThat(targetManagement.findTargetByFilters(pageReq, null, "%targ-B%", null, Boolean.FALSE, assertThat(targetManagement.findTargetByFilters(pageReq, null, null, "%targ-B%", null, Boolean.FALSE,
targTagY.getName(), targTagW.getName()).getContent()).as("has number of elements").hasSize(100) targTagY.getName(), targTagW.getName()).getContent()).as("has number of elements").hasSize(100)
.as("that number is also returned by count query") .as("that number is also returned by count query")
.hasSize(Ints.saturatedCast(targetManagement.countTargetByFilters(null, "%targ-B%", null, .hasSize(Ints.saturatedCast(targetManagement.countTargetByFilters(null, null, "%targ-B%", null,
Boolean.FALSE, targTagY.getName(), targTagW.getName()))) Boolean.FALSE, targTagY.getName(), targTagW.getName())))
.as("and contains the following elements").containsAll(expected) .as("and contains the following elements").containsAll(expected)
.as("and filter query returns the same result") .as("and filter query returns the same result")
@@ -624,7 +677,7 @@ public class TargetManagementSearchTest extends AbstractJpaIntegrationTest {
.as("and NAMED filter query returns the same result").containsAll(targetManagement .as("and NAMED filter query returns the same result").containsAll(targetManagement
.findTargetsAll(new JpaTargetFilterQuery("test", query), pageReq).getContent()); .findTargetsAll(new JpaTargetFilterQuery("test", query), pageReq).getContent());
assertThat(targetManagement.findAllTargetIdsByFilters(pageReq, null, "%targ-B%", null, Boolean.FALSE, assertThat(targetManagement.findAllTargetIdsByFilters(pageReq, null, null, "%targ-B%", null, Boolean.FALSE,
targTagY.getName(), targTagW.getName())).as("has number of elements").hasSize(100) targTagY.getName(), targTagW.getName())).as("has number of elements").hasSize(100)
.as("and contains the following elements").containsAll(expectedIdNames) .as("and contains the following elements").containsAll(expectedIdNames)
.as("and NAMED filter query returns the same result").containsAll(targetManagement .as("and NAMED filter query returns the same result").containsAll(targetManagement
@@ -643,10 +696,11 @@ public class TargetManagementSearchTest extends AbstractJpaIntegrationTest {
private void verifyThat200TargetsHaveTagD(final TargetTag targTagD, final List<Target> expected) { private void verifyThat200TargetsHaveTagD(final TargetTag targTagD, final List<Target> expected) {
final List<TargetIdName> expectedIdNames = convertToIdNames(expected); final List<TargetIdName> expectedIdNames = convertToIdNames(expected);
final String query = "tag==" + targTagD.getName(); final String query = "tag==" + targTagD.getName();
assertThat(targetManagement.findTargetByFilters(pageReq, null, null, null, Boolean.FALSE, targTagD.getName()) assertThat(targetManagement
.getContent()).as("Expected number of results is").hasSize(200) .findTargetByFilters(pageReq, null, null, null, null, Boolean.FALSE, targTagD.getName()).getContent())
.as("Expected number of results is").hasSize(200)
.as("and is expected number of results is equal to ") .as("and is expected number of results is equal to ")
.hasSize(Ints.saturatedCast(targetManagement.countTargetByFilters(null, null, null, .hasSize(Ints.saturatedCast(targetManagement.countTargetByFilters(null, null, null, null,
Boolean.FALSE, targTagD.getName()))) Boolean.FALSE, targTagD.getName())))
.as("and contains the following elements").containsAll(expected) .as("and contains the following elements").containsAll(expected)
.as("and filter query returns the same result") .as("and filter query returns the same result")
@@ -654,7 +708,7 @@ public class TargetManagementSearchTest extends AbstractJpaIntegrationTest {
.as("and NAMED filter query returns the same result").containsAll(targetManagement .as("and NAMED filter query returns the same result").containsAll(targetManagement
.findTargetsAll(new JpaTargetFilterQuery("test", query), pageReq).getContent()); .findTargetsAll(new JpaTargetFilterQuery("test", query), pageReq).getContent());
assertThat(targetManagement.findAllTargetIdsByFilters(pageReq, null, null, null, Boolean.FALSE, assertThat(targetManagement.findAllTargetIdsByFilters(pageReq, null, null, null, null, Boolean.FALSE,
targTagD.getName())).as("has number of elements").hasSize(200).as("and contains the following elements") targTagD.getName())).as("has number of elements").hasSize(200).as("and contains the following elements")
.containsAll(expectedIdNames).as("and NAMED filter query returns the same result") .containsAll(expectedIdNames).as("and NAMED filter query returns the same result")
.containsAll(targetManagement.findAllTargetIdsByTargetFilterQuery(pageReq, .containsAll(targetManagement.findAllTargetIdsByTargetFilterQuery(pageReq,
@@ -664,12 +718,13 @@ public class TargetManagementSearchTest extends AbstractJpaIntegrationTest {
@Step @Step
private void verifyThatRepositoryContains400Targets() { private void verifyThatRepositoryContains400Targets() {
assertThat(targetManagement.findTargetByFilters(pageReq, null, null, null, null, new String[0]).getContent()) assertThat(
.as("Overall we expect that many targets in the repository").hasSize(400) targetManagement.findTargetByFilters(pageReq, null, null, null, null, null, new String[0]).getContent())
.as("which is also reflected by repository count") .as("Overall we expect that many targets in the repository").hasSize(400)
.hasSize(Ints.saturatedCast(targetManagement.countTargetsAll())) .as("which is also reflected by repository count")
.as("which is also reflected by call without specification") .hasSize(Ints.saturatedCast(targetManagement.countTargetsAll()))
.containsAll(targetManagement.findTargetsAll(pageReq).getContent()); .as("which is also reflected by call without specification")
.containsAll(targetManagement.findTargetsAll(pageReq).getContent());
} }
@@ -691,7 +746,7 @@ public class TargetManagementSearchTest extends AbstractJpaIntegrationTest {
targInstalled = sendUpdateActionStatusToTargets(ds, targInstalled, Status.FINISHED, "installed"); targInstalled = sendUpdateActionStatusToTargets(ds, targInstalled, Status.FINISHED, "installed");
final Slice<Target> result = targetManagement.findTargetsAllOrderByLinkedDistributionSet(pageReq, ds.getId(), final Slice<Target> result = targetManagement.findTargetsAllOrderByLinkedDistributionSet(pageReq, ds.getId(),
null, null, null, Boolean.FALSE, new String[0]); null, null, null, null, Boolean.FALSE, new String[0]);
final Comparator<TenantAwareBaseEntity> byId = (e1, e2) -> Long.compare(e2.getId(), e1.getId()); final Comparator<TenantAwareBaseEntity> byId = (e1, e2) -> Long.compare(e2.getId(), e1.getId());
@@ -708,6 +763,64 @@ public class TargetManagementSearchTest extends AbstractJpaIntegrationTest {
} }
@Test
@Description("Tests the correct order of targets with applied overdue filter based on selected distribution set. The system expects to have an order based on installed, assigned DS.")
public void targetSearchWithOverdueFilterAndOrderByDistributionSet() {
final Long lastTargetQueryAlwaysOverdue = 0L;
final Long lastTargetQueryNotOverdue = Instant.now().toEpochMilli();
final Long lastTargetNull = null;
final Long[] overdueMix = { lastTargetQueryAlwaysOverdue, lastTargetQueryNotOverdue,
lastTargetQueryAlwaysOverdue, lastTargetNull, lastTargetQueryAlwaysOverdue };
List<Target> notAssignedToBeCreated = testdataFactory.generateTargets(overdueMix.length, "not",
"first description");
List<Target> targAssignedToBeCreated = testdataFactory.generateTargets(overdueMix.length, "assigned",
"first description");
List<Target> targInstalledToBeCreated = testdataFactory.generateTargets(overdueMix.length, "installed",
"first description");
List<Target> notAssigned = new ArrayList<>();
List<Target> targAssigned = new ArrayList<>();
List<Target> targInstalled = new ArrayList<>();
for (int i = 0; i < overdueMix.length; i++) {
notAssigned.add(targetManagement.createTarget(notAssignedToBeCreated.get(i), TargetUpdateStatus.UNKNOWN,
overdueMix[i], notAssignedToBeCreated.get(i).getTargetInfo().getAddress()));
targAssigned.add(targetManagement.createTarget(targAssignedToBeCreated.get(i), TargetUpdateStatus.UNKNOWN,
overdueMix[i], targAssignedToBeCreated.get(i).getTargetInfo().getAddress()));
targInstalled.add(targetManagement.createTarget(targInstalledToBeCreated.get(i), TargetUpdateStatus.UNKNOWN,
overdueMix[i], targInstalledToBeCreated.get(i).getTargetInfo().getAddress()));
}
final DistributionSet ds = testdataFactory.createDistributionSet("a");
targAssigned = deploymentManagement.assignDistributionSet(ds, targAssigned).getAssignedEntity();
targInstalled = deploymentManagement.assignDistributionSet(ds, targInstalled).getAssignedEntity();
targInstalled = sendUpdateActionStatusToTargets(ds, targInstalled, Status.FINISHED, "installed");
final Slice<Target> result = targetManagement.findTargetsAllOrderByLinkedDistributionSet(pageReq, ds.getId(),
null, null, Boolean.TRUE, null, Boolean.FALSE, new String[0]);
final Comparator<TenantAwareBaseEntity> byId = (e1, e2) -> Long.compare(e2.getId(), e1.getId());
assertThat(result.getNumberOfElements()).isEqualTo(9);
final List<Target> expected = new ArrayList<>();
expected.addAll(targInstalled.stream().sorted(byId)
.filter(item -> lastTargetQueryAlwaysOverdue.equals(item.getTargetInfo().getLastTargetQuery()))
.collect(Collectors.toList()));
expected.addAll(targAssigned.stream().sorted(byId)
.filter(item -> lastTargetQueryAlwaysOverdue.equals(item.getTargetInfo().getLastTargetQuery()))
.collect(Collectors.toList()));
expected.addAll(notAssigned.stream().sorted(byId)
.filter(item -> lastTargetQueryAlwaysOverdue.equals(item.getTargetInfo().getLastTargetQuery()))
.collect(Collectors.toList()));
assertThat(result.getContent()).containsExactly(expected.toArray(new Target[0]));
}
@Test @Test
@Description("Verfies that targets with given assigned DS are returned from repository.") @Description("Verfies that targets with given assigned DS are returned from repository.")
public void findTargetByAssignedDistributionSet() { public void findTargetByAssignedDistributionSet() {

View File

@@ -599,7 +599,7 @@ public class TargetManagementTest extends AbstractJpaIntegrationTest {
targetManagement.toggleTagAssignment(tagABCTargets, tagB); targetManagement.toggleTagAssignment(tagABCTargets, tagB);
targetManagement.toggleTagAssignment(tagABCTargets, tagC); targetManagement.toggleTagAssignment(tagABCTargets, tagC);
assertThat(targetManagement.countTargetByFilters(null, null, null, Boolean.FALSE, "X")) assertThat(targetManagement.countTargetByFilters(null, null, null, null, Boolean.FALSE, "X"))
.as("Target count is wrong").isEqualTo(0); .as("Target count is wrong").isEqualTo(0);
// search for targets with tag tagA // search for targets with tag tagA
@@ -629,11 +629,11 @@ public class TargetManagementTest extends AbstractJpaIntegrationTest {
checkTargetHasNotTags(tagCTargets, tagA, tagB); checkTargetHasNotTags(tagCTargets, tagA, tagB);
// check again target lists refreshed from DB // check again target lists refreshed from DB
assertThat(targetManagement.countTargetByFilters(null, null, null, Boolean.FALSE, "A")) assertThat(targetManagement.countTargetByFilters(null, null, null, null, Boolean.FALSE, "A"))
.as("Target count is wrong").isEqualTo(targetWithTagA.size()); .as("Target count is wrong").isEqualTo(targetWithTagA.size());
assertThat(targetManagement.countTargetByFilters(null, null, null, Boolean.FALSE, "B")) assertThat(targetManagement.countTargetByFilters(null, null, null, null, Boolean.FALSE, "B"))
.as("Target count is wrong").isEqualTo(targetWithTagB.size()); .as("Target count is wrong").isEqualTo(targetWithTagB.size());
assertThat(targetManagement.countTargetByFilters(null, null, null, Boolean.FALSE, "C")) assertThat(targetManagement.countTargetByFilters(null, null, null, null, Boolean.FALSE, "C"))
.as("Target count is wrong").isEqualTo(targetWithTagC.size()); .as("Target count is wrong").isEqualTo(targetWithTagC.size());
} }
@@ -750,7 +750,8 @@ public class TargetManagementTest extends AbstractJpaIntegrationTest {
final String[] tagNames = null; final String[] tagNames = null;
final List<Target> targetsListWithNoTag = targetManagement final List<Target> targetsListWithNoTag = targetManagement
.findTargetByFilters(new PageRequest(0, 500), null, null, null, Boolean.TRUE, tagNames).getContent(); .findTargetByFilters(new PageRequest(0, 500), null, null, null, null, Boolean.TRUE, tagNames)
.getContent();
assertThat(50).as("Total targets").isEqualTo(targetManagement.findAllTargetIds().size()); assertThat(50).as("Total targets").isEqualTo(targetManagement.findAllTargetIds().size());
assertThat(25).as("Targets with no tag").isEqualTo(targetsListWithNoTag.size()); assertThat(25).as("Targets with no tag").isEqualTo(targetsListWithNoTag.size());

View File

@@ -370,7 +370,7 @@ public class DistributionSetTable extends AbstractNamedVersionTable<Distribution
} }
private boolean validateSoftwareModule(final SoftwareModule sm, final DistributionSet ds) { private boolean validateSoftwareModule(final SoftwareModule sm, final DistributionSet ds) {
if (targetManagement.countTargetByFilters(null, null, ds.getId(), Boolean.FALSE, new String[] {}) > 0) { if (targetManagement.countTargetByFilters(null, null, null, ds.getId(), Boolean.FALSE, new String[] {}) > 0) {
/* Distribution is already assigned */ /* Distribution is already assigned */
notification.displayValidationError(i18n.get("message.dist.inuse", notification.displayValidationError(i18n.get("message.dist.inuse",
HawkbitCommonUtil.concatStrings(":", ds.getName(), ds.getVersion()))); HawkbitCommonUtil.concatStrings(":", ds.getName(), ds.getVersion())));

View File

@@ -14,5 +14,22 @@ package org.eclipse.hawkbit.ui.management.event;
* *
*/ */
public enum ManagementUIEvent { public enum ManagementUIEvent {
SHOW_COUNT_MESSAGE, UPDATE_COUNT, UPDATE_FILTERCOUNT_MESSAGE, HIDE_TARGET_TAG_LAYOUT, SHOW_TARGET_TAG_LAYOUT, HIDE_DISTRIBUTION_TAG_LAYOUT, SHOW_DISTRIBUTION_TAG_LAYOUT, MAX_ACTION_HISTORY, MIN_ACTION_HISTORY, CLOSE_SAVE_ACTIONS_WINDOW, UNASSIGN_TARGET_TAG, UNASSIGN_DISTRIBUTION_TAG, ASSIGN_TARGET_TAG, ASSIGN_DISTRIBUTION_TAG, TARGET_TABLE_FILTER, RESET_SIMPLE_FILTERS, RESET_TARGET_FILTER_QUERY SHOW_COUNT_MESSAGE, //
UPDATE_COUNT, //
UPDATE_FILTERCOUNT_MESSAGE, //
HIDE_TARGET_TAG_LAYOUT, //
SHOW_TARGET_TAG_LAYOUT, //
HIDE_DISTRIBUTION_TAG_LAYOUT, //
SHOW_DISTRIBUTION_TAG_LAYOUT, //
MAX_ACTION_HISTORY, //
MIN_ACTION_HISTORY, //
CLOSE_SAVE_ACTIONS_WINDOW, //
UNASSIGN_TARGET_TAG, //
UNASSIGN_DISTRIBUTION_TAG, //
ASSIGN_TARGET_TAG, //
ASSIGN_DISTRIBUTION_TAG, //
TARGET_TABLE_FILTER, //
RESET_SIMPLE_FILTERS, //
RESET_TARGET_FILTER_QUERY
} }

View File

@@ -14,5 +14,14 @@ package org.eclipse.hawkbit.ui.management.event;
* *
*/ */
public enum TargetFilterEvent { public enum TargetFilterEvent {
FILTER_BY_TEXT, FILTER_BY_TAG, REMOVE_FILTER_BY_TEXT, REMOVE_FILTER_BY_TAG, FILTER_BY_STATUS, FILTER_BY_DISTRIBUTION, REMOVE_FILTER_BY_STATUS, REMOVE_FILTER_BY_DISTRIBUTION, FILTER_BY_TARGET_FILTER_QUERY, REMOVE_FILTER_BY_TARGET_FILTER_QUERY FILTER_BY_TEXT, //
FILTER_BY_TAG, //
REMOVE_FILTER_BY_TEXT, //
REMOVE_FILTER_BY_TAG, //
FILTER_BY_STATUS, //
FILTER_BY_DISTRIBUTION, //
REMOVE_FILTER_BY_STATUS, //
REMOVE_FILTER_BY_DISTRIBUTION, //
FILTER_BY_TARGET_FILTER_QUERY, //
REMOVE_FILTER_BY_TARGET_FILTER_QUERY
} }

View File

@@ -143,6 +143,7 @@ public class CountMessageLabel extends Label {
} }
message.append(HawkbitCommonUtil.SP_STRING_SPACE); message.append(HawkbitCommonUtil.SP_STRING_SPACE);
final String status = i18n.get("label.filter.status"); final String status = i18n.get("label.filter.status");
final String overdue = i18n.get("label.filter.overdue");
final String tags = i18n.get("label.filter.tags"); final String tags = i18n.get("label.filter.tags");
final String text = i18n.get("label.filter.text"); final String text = i18n.get("label.filter.text");
final String dists = i18n.get("label.filter.dist"); final String dists = i18n.get("label.filter.dist");
@@ -150,6 +151,7 @@ public class CountMessageLabel extends Label {
final StringBuilder filterMesgBuf = new StringBuilder(i18n.get("label.filter")); final StringBuilder filterMesgBuf = new StringBuilder(i18n.get("label.filter"));
filterMesgBuf.append(HawkbitCommonUtil.SP_STRING_SPACE); filterMesgBuf.append(HawkbitCommonUtil.SP_STRING_SPACE);
filterMesgBuf.append(getStatusMsg(targFilParams.getClickedStatusTargetTags(), status)); filterMesgBuf.append(getStatusMsg(targFilParams.getClickedStatusTargetTags(), status));
filterMesgBuf.append(getOverdueStateMsg(targFilParams.isOverdueFilterEnabled(), overdue));
filterMesgBuf filterMesgBuf
.append(getTagsMsg(targFilParams.isNoTagSelected(), targFilParams.getClickedTargetTags(), tags)); .append(getTagsMsg(targFilParams.isNoTagSelected(), targFilParams.getClickedTargetTags(), tags));
filterMesgBuf.append(getSerachMsg( filterMesgBuf.append(getSerachMsg(
@@ -230,6 +232,17 @@ public class CountMessageLabel extends Label {
return status.isEmpty() ? HawkbitCommonUtil.SP_STRING_SPACE : param; return status.isEmpty() ? HawkbitCommonUtil.SP_STRING_SPACE : param;
} }
/**
* Get Overdue State Message.
*
* @param overdueState
* as flag
* @return String as msg.
*/
private static String getOverdueStateMsg(final boolean overdueState, final String param) {
return !overdueState ? HawkbitCommonUtil.SP_STRING_SPACE : param;
}
/** /**
* Get Tags Message. * Get Tags Message.
* *

View File

@@ -31,6 +31,8 @@ public class TargetTableFilters implements Serializable {
private final List<String> clickedTargetTags = new ArrayList<>(); private final List<String> clickedTargetTags = new ArrayList<>();
private final List<TargetUpdateStatus> clickedStatusTargetTags = new ArrayList<>(); private final List<TargetUpdateStatus> clickedStatusTargetTags = new ArrayList<>();
private boolean isOverdueFilterEnabled = Boolean.FALSE;
private String searchText; private String searchText;
private DistributionSetIdName distributionSet; private DistributionSetIdName distributionSet;
private Long pinnedDistId; private Long pinnedDistId;
@@ -130,7 +132,8 @@ public class TargetTableFilters implements Serializable {
* {@code false} * {@code false}
*/ */
public boolean hasFilter() { public boolean hasFilter() {
return isFilteredByTextOrDs() || hasTagsSelected() || isFilteredByStatusOrCustomFilter(); return isFilteredByTextOrDs() || hasTagsSelected() || isFilteredByStatusOrCustomFilter()
|| isOverdueFilterEnabled();
} }
private boolean hasTagsSelected() { private boolean hasTagsSelected() {
@@ -160,4 +163,12 @@ public class TargetTableFilters implements Serializable {
this.targetFilterQuery = targetFilterQuery; this.targetFilterQuery = targetFilterQuery;
} }
public boolean isOverdueFilterEnabled() {
return isOverdueFilterEnabled;
}
public void setOverdueFilterEnabled(boolean isOverdueFilterEnabled) {
this.isOverdueFilterEnabled = isOverdueFilterEnabled;
}
} }

View File

@@ -51,6 +51,7 @@ public class TargetBeanQuery extends AbstractBeanQuery<ProxyTarget> {
private Sort sort = new Sort(TARGET_TABLE_CREATE_AT_SORT_ORDER, "createdAt"); private Sort sort = new Sort(TARGET_TABLE_CREATE_AT_SORT_ORDER, "createdAt");
private transient Collection<TargetUpdateStatus> status = null; private transient Collection<TargetUpdateStatus> status = null;
private transient Boolean overdueState = null;
private String[] targetTags = null; private String[] targetTags = null;
private Long distributionId = null; private Long distributionId = null;
private String searchText = null; private String searchText = null;
@@ -80,6 +81,7 @@ public class TargetBeanQuery extends AbstractBeanQuery<ProxyTarget> {
if (isNotNullOrEmpty(queryConfig)) { if (isNotNullOrEmpty(queryConfig)) {
status = (Collection<TargetUpdateStatus>) queryConfig.get(SPUIDefinitions.FILTER_BY_STATUS); status = (Collection<TargetUpdateStatus>) queryConfig.get(SPUIDefinitions.FILTER_BY_STATUS);
overdueState = (Boolean) queryConfig.get(SPUIDefinitions.FILTER_BY_OVERDUE_STATE);
targetTags = (String[]) queryConfig.get(SPUIDefinitions.FILTER_BY_TAG); targetTags = (String[]) queryConfig.get(SPUIDefinitions.FILTER_BY_TAG);
noTagClicked = (Boolean) queryConfig.get(SPUIDefinitions.FILTER_BY_NO_TAG); noTagClicked = (Boolean) queryConfig.get(SPUIDefinitions.FILTER_BY_NO_TAG);
distributionId = (Long) queryConfig.get(SPUIDefinitions.FILTER_BY_DISTRIBUTION); distributionId = (Long) queryConfig.get(SPUIDefinitions.FILTER_BY_DISTRIBUTION);
@@ -113,7 +115,7 @@ public class TargetBeanQuery extends AbstractBeanQuery<ProxyTarget> {
if (pinnedDistId != null) { if (pinnedDistId != null) {
targetBeans = getTargetManagement().findTargetsAllOrderByLinkedDistributionSet( targetBeans = getTargetManagement().findTargetsAllOrderByLinkedDistributionSet(
new OffsetBasedPageRequest(startIndex, SPUIDefinitions.PAGE_SIZE, sort), pinnedDistId, new OffsetBasedPageRequest(startIndex, SPUIDefinitions.PAGE_SIZE, sort), pinnedDistId,
distributionId, status, searchText, noTagClicked, targetTags); distributionId, status, overdueState, searchText, noTagClicked, targetTags);
} else if (null != targetFilterQuery) { } else if (null != targetFilterQuery) {
targetBeans = getTargetManagement().findTargetsAll(targetFilterQuery, targetBeans = getTargetManagement().findTargetsAll(targetFilterQuery,
new PageRequest(startIndex / SPUIDefinitions.PAGE_SIZE, SPUIDefinitions.PAGE_SIZE, sort)); new PageRequest(startIndex / SPUIDefinitions.PAGE_SIZE, SPUIDefinitions.PAGE_SIZE, sort));
@@ -123,7 +125,7 @@ public class TargetBeanQuery extends AbstractBeanQuery<ProxyTarget> {
} else { } else {
targetBeans = getTargetManagement().findTargetByFilters( targetBeans = getTargetManagement().findTargetByFilters(
new PageRequest(startIndex / SPUIDefinitions.PAGE_SIZE, SPUIDefinitions.PAGE_SIZE, sort), status, new PageRequest(startIndex / SPUIDefinitions.PAGE_SIZE, SPUIDefinitions.PAGE_SIZE, sort), status,
searchText, distributionId, noTagClicked, targetTags); overdueState, searchText, distributionId, noTagClicked, targetTags);
} }
for (final Target targ : targetBeans) { for (final Target targ : targetBeans) {
final ProxyTarget prxyTarget = new ProxyTarget(); final ProxyTarget prxyTarget = new ProxyTarget();
@@ -169,6 +171,13 @@ public class TargetBeanQuery extends AbstractBeanQuery<ProxyTarget> {
return true; return true;
} }
private Boolean isOverdueFilterEnabled() {
if (Boolean.TRUE.equals(overdueState)) {
return Boolean.TRUE;
}
return Boolean.FALSE;
}
@Override @Override
protected void saveBeans(final List<ProxyTarget> addedTargets, final List<ProxyTarget> modifiedTargets, protected void saveBeans(final List<ProxyTarget> addedTargets, final List<ProxyTarget> modifiedTargets,
final List<ProxyTarget> removedTargets) { final List<ProxyTarget> removedTargets) {
@@ -176,7 +185,8 @@ public class TargetBeanQuery extends AbstractBeanQuery<ProxyTarget> {
} }
private Boolean anyFilterSelected() { private Boolean anyFilterSelected() {
if (status == null && distributionId == null && Strings.isNullOrEmpty(searchText) && !isTagSelected()) { if (status == null && distributionId == null && Strings.isNullOrEmpty(searchText) && !isTagSelected()
&& !isOverdueFilterEnabled()) {
return false; return false;
} }
return true; return true;
@@ -191,8 +201,8 @@ public class TargetBeanQuery extends AbstractBeanQuery<ProxyTarget> {
} else if (!anyFilterSelected()) { } else if (!anyFilterSelected()) {
size = totSize; size = totSize;
} else { } else {
size = getTargetManagement().countTargetByFilters(status, searchText, distributionId, noTagClicked, size = getTargetManagement().countTargetByFilters(status, overdueState, searchText, distributionId,
targetTags); noTagClicked, targetTags);
} }
final ManagementUIState tmpManagementUIState = getManagementUIState(); final ManagementUIState tmpManagementUIState = getManagementUIState();

View File

@@ -369,6 +369,9 @@ public class TargetTable extends AbstractTable<Target, TargetIdName> {
.getClickedStatusTargetTags(); .getClickedStatusTargetTags();
queryConfig.put(SPUIDefinitions.FILTER_BY_STATUS, statusList); queryConfig.put(SPUIDefinitions.FILTER_BY_STATUS, statusList);
} }
if (managementUIState.getTargetTableFilters().isOverdueFilterEnabled()) {
queryConfig.put(SPUIDefinitions.FILTER_BY_OVERDUE_STATE, Boolean.TRUE);
}
return queryConfig; return queryConfig;
} }
@@ -873,6 +876,7 @@ public class TargetTable extends AbstractTable<Target, TargetIdName> {
managementUIState.setTargetsCountAll(totalTargetsCount); managementUIState.setTargetsCountAll(totalTargetsCount);
Collection<TargetUpdateStatus> status = null; Collection<TargetUpdateStatus> status = null;
Boolean overdueState = null;
String[] targetTags = null; String[] targetTags = null;
Long distributionId = null; Long distributionId = null;
String searchText = null; String searchText = null;
@@ -884,6 +888,9 @@ public class TargetTable extends AbstractTable<Target, TargetIdName> {
if (isFilteredByStatus()) { if (isFilteredByStatus()) {
status = managementUIState.getTargetTableFilters().getClickedStatusTargetTags(); status = managementUIState.getTargetTableFilters().getClickedStatusTargetTags();
} }
if (managementUIState.getTargetTableFilters().isOverdueFilterEnabled()) {
overdueState = managementUIState.getTargetTableFilters().isOverdueFilterEnabled();
}
if (managementUIState.getTargetTableFilters().getDistributionSet().isPresent()) { if (managementUIState.getTargetTableFilters().getDistributionSet().isPresent()) {
distributionId = managementUIState.getTargetTableFilters().getDistributionSet().get().getId(); distributionId = managementUIState.getTargetTableFilters().getDistributionSet().get().getId();
} }
@@ -895,8 +902,8 @@ public class TargetTable extends AbstractTable<Target, TargetIdName> {
pinnedDistId = managementUIState.getTargetTableFilters().getPinnedDistId().get(); pinnedDistId = managementUIState.getTargetTableFilters().getPinnedDistId().get();
} }
final long size = getTargetsCountWithFilter(totalTargetsCount, status, targetTags, distributionId, searchText, final long size = getTargetsCountWithFilter(totalTargetsCount, status, overdueState, targetTags, distributionId,
noTagClicked, pinnedDistId); searchText, noTagClicked, pinnedDistId);
if (size > SPUIDefinitions.MAX_TABLE_ENTRIES) { if (size > SPUIDefinitions.MAX_TABLE_ENTRIES) {
managementUIState.setTargetsTruncated(size - SPUIDefinitions.MAX_TABLE_ENTRIES); managementUIState.setTargetsTruncated(size - SPUIDefinitions.MAX_TABLE_ENTRIES);
@@ -904,8 +911,8 @@ public class TargetTable extends AbstractTable<Target, TargetIdName> {
} }
private long getTargetsCountWithFilter(final long totalTargetsCount, final Collection<TargetUpdateStatus> status, private long getTargetsCountWithFilter(final long totalTargetsCount, final Collection<TargetUpdateStatus> status,
final String[] targetTags, final Long distributionId, final String searchText, final Boolean noTagClicked, final Boolean overdueState, final String[] targetTags, final Long distributionId, final String searchText,
final Long pinnedDistId) { final Boolean noTagClicked, final Long pinnedDistId) {
final long size; final long size;
if (managementUIState.getTargetTableFilters().getTargetFilterQuery().isPresent()) { if (managementUIState.getTargetTableFilters().getTargetFilterQuery().isPresent()) {
size = targetManagement.countTargetByTargetFilterQuery( size = targetManagement.countTargetByTargetFilterQuery(
@@ -913,7 +920,8 @@ public class TargetTable extends AbstractTable<Target, TargetIdName> {
} else if (!anyFilterSelected(status, pinnedDistId, noTagClicked, targetTags, searchText)) { } else if (!anyFilterSelected(status, pinnedDistId, noTagClicked, targetTags, searchText)) {
size = totalTargetsCount; size = totalTargetsCount;
} else { } else {
size = targetManagement.countTargetByFilters(status, searchText, distributionId, noTagClicked, targetTags); size = targetManagement.countTargetByFilters(status, overdueState, searchText, distributionId, noTagClicked,
targetTags);
} }
return size; return size;
} }

View File

@@ -54,16 +54,20 @@ public class FilterByStatusLayout extends VerticalLayout implements Button.Click
@Autowired @Autowired
private ManagementUIState managementUIState; private ManagementUIState managementUIState;
private static final String overdueCaption = "overdue";
private Button unknown; private Button unknown;
private Button inSync; private Button inSync;
private Button pending; private Button pending;
private Button error; private Button error;
private Button registered; private Button registered;
private Button overdue;
private Boolean unknownBtnClicked = false; private Boolean unknownBtnClicked = false;
private Boolean errorBtnClicked = false; private Boolean errorBtnClicked = false;
private Boolean pendingBtnClicked = false; private Boolean pendingBtnClicked = false;
private Boolean inSyncBtnClicked = false; private Boolean inSyncBtnClicked = false;
private Boolean registeredBtnClicked = false; private Boolean registeredBtnClicked = false;
private Boolean overdueBtnClicked = false;
private Button buttonClicked; private Button buttonClicked;
private static final String BTN_CLICKED = "btnClicked"; private static final String BTN_CLICKED = "btnClicked";
@@ -105,6 +109,15 @@ public class FilterByStatusLayout extends VerticalLayout implements Button.Click
addComponent(buttonLayout); addComponent(buttonLayout);
setComponentAlignment(buttonLayout, Alignment.MIDDLE_CENTER); setComponentAlignment(buttonLayout, Alignment.MIDDLE_CENTER);
final HorizontalLayout overdueLayout = new HorizontalLayout();
final Label overdueLabel = new LabelBuilder().name(i18n.get("label.filter.by.overdue")).buildLabel();
overdueLayout.setStyleName("overdue-button-layout");
overdueLayout.addComponent(overdue);
overdueLayout.setComponentAlignment(overdue, Alignment.MIDDLE_LEFT);
overdueLayout.addComponent(overdueLabel);
overdueLayout.setComponentAlignment(overdueLabel, Alignment.MIDDLE_LEFT);
addComponent(overdueLayout);
} }
private void restorePreviousState() { private void restorePreviousState() {
@@ -129,6 +142,10 @@ public class FilterByStatusLayout extends VerticalLayout implements Button.Click
} }
} }
} }
if (managementUIState.getTargetTableFilters().isOverdueFilterEnabled()) {
overdue.addStyleName(BTN_CLICKED);
overdueBtnClicked = Boolean.TRUE;
}
} }
/** /**
@@ -150,18 +167,23 @@ public class FilterByStatusLayout extends VerticalLayout implements Button.Click
registered = SPUIComponentProvider.getButton(UIComponentIdProvider.REGISTERED_STATUS_ICON, registered = SPUIComponentProvider.getButton(UIComponentIdProvider.REGISTERED_STATUS_ICON,
TargetUpdateStatus.REGISTERED.toString(), i18n.get("tooltip.status.registered"), TargetUpdateStatus.REGISTERED.toString(), i18n.get("tooltip.status.registered"),
SPUIButtonDefinitions.SP_BUTTON_STATUS_STYLE, false, FontAwesome.SQUARE, SPUIButtonStyleSmall.class); SPUIButtonDefinitions.SP_BUTTON_STATUS_STYLE, false, FontAwesome.SQUARE, SPUIButtonStyleSmall.class);
overdue = SPUIComponentProvider.getButton(SPUIComponentIdProvider.OVERDUE_STATUS_ICON,
overdueCaption, i18n.get("tooltip.status.overdue"),
SPUIButtonDefinitions.SP_BUTTON_STATUS_STYLE, false, FontAwesome.SQUARE, SPUIButtonStyleSmall.class);
applyStatusBtnStyle(); applyStatusBtnStyle();
unknown.setData("filterStatusOne"); unknown.setData("filterStatusOne");
inSync.setData("filterStatusTwo"); inSync.setData("filterStatusTwo");
pending.setData("filterStatusThree"); pending.setData("filterStatusThree");
error.setData("filterStatusFour"); error.setData("filterStatusFour");
registered.setData("filterStatusFive"); registered.setData("filterStatusFive");
overdue.setData("filterStatusSix");
unknown.addClickListener(this); unknown.addClickListener(this);
inSync.addClickListener(this); inSync.addClickListener(this);
pending.addClickListener(this); pending.addClickListener(this);
error.addClickListener(this); error.addClickListener(this);
registered.addClickListener(this); registered.addClickListener(this);
overdue.addClickListener(this);
} }
/** /**
@@ -173,6 +195,7 @@ public class FilterByStatusLayout extends VerticalLayout implements Button.Click
pending.addStyleName("pendingBtn"); pending.addStyleName("pendingBtn");
error.addStyleName("errorBtn"); error.addStyleName("errorBtn");
registered.addStyleName("registeredBtn"); registered.addStyleName("registeredBtn");
overdue.addStyleName("overdueBtn");
} }
@Override @Override
@@ -188,6 +211,8 @@ public class FilterByStatusLayout extends VerticalLayout implements Button.Click
processErrorFilterStatus(); processErrorFilterStatus();
} else if (event.getButton().getCaption().equalsIgnoreCase(TargetUpdateStatus.REGISTERED.toString())) { } else if (event.getButton().getCaption().equalsIgnoreCase(TargetUpdateStatus.REGISTERED.toString())) {
processRegisteredFilterStatus(); processRegisteredFilterStatus();
} else if (event.getButton().getCaption().equalsIgnoreCase(overdueCaption)) {
processOverdueFilterStatus();
} }
} }
@@ -231,9 +256,26 @@ public class FilterByStatusLayout extends VerticalLayout implements Button.Click
processCommonFilterStatus(TargetUpdateStatus.REGISTERED, registeredBtnClicked); processCommonFilterStatus(TargetUpdateStatus.REGISTERED, registeredBtnClicked);
} }
/**
* Process - OVERDUE.
*/
private void processOverdueFilterStatus() {
overdueBtnClicked = !overdueBtnClicked;
managementUIState.getTargetTableFilters().setOverdueFilterEnabled(overdueBtnClicked);
if (overdueBtnClicked) {
buttonClicked.addStyleName(BTN_CLICKED);
eventBus.publish(this, TargetFilterEvent.FILTER_BY_STATUS);
} else {
buttonClicked.removeStyleName(BTN_CLICKED);
eventBus.publish(this, TargetFilterEvent.REMOVE_FILTER_BY_STATUS);
}
}
/** /**
* Process - COMMON PROCESS. * Process - COMMON PROCESS.
* *
* @param status * @param status
* as enum * as enum
* @param buttonReset * @param buttonReset
@@ -268,11 +310,12 @@ public class FilterByStatusLayout extends VerticalLayout implements Button.Click
inSync.removeStyleName(BTN_CLICKED); inSync.removeStyleName(BTN_CLICKED);
error.removeStyleName(BTN_CLICKED); error.removeStyleName(BTN_CLICKED);
pending.removeStyleName(BTN_CLICKED); pending.removeStyleName(BTN_CLICKED);
overdue.removeStyleName(BTN_CLICKED);
} }
/** /**
* Check if any status button in clicked. * Check if any status button in clicked.
* *
* @return * @return
*/ */
private boolean isStatusFilterApplied() { private boolean isStatusFilterApplied() {

View File

@@ -0,0 +1,846 @@
/**
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.hawkbit.ui.utils;
/**
* Interface to provide the unchanged constants.
*
*
*
*
*
*/
public final class SPUIComponentIdProvider {
/**
* ID-Target.
*/
public static final String TARGET_TABLE_ID = "target.tableId";
/**
* ID- Targ.Cont ID.
*/
public static final String TARGET_ADD_CONTROLLER_ID = "target.add.ctrlId";
/**
* ID-Targ.Name.
*/
public static final String TARGET_ADD_NAME = "target.add.name";
/**
* ID-Targ.Disc.
*/
public static final String TARGET_ADD_DESC = "target.add.desc";
/**
* ID-Targ.DEL.
*/
public static final String TARGET_DELETE_ALL = "target.delete.all";
/**
* ID-SW.DEL.
*/
public static final String SW_DELETE_ALL = "swmodule.delete.all";
/**
* ID-Targ.Edit.icon.
*/
public static final String TARGET_EDIT_ICON = "target.edit.icon";
/**
* ID-Targ.PIN.
*/
public static final String TARGET_PIN_ICON = "target.pin.icon";
/**
* Target search text id.
*/
public static final String TARGET_TEXT_FIELD = "target.search.textfield";
/**
* ID for add target filter icon
*/
public static final String TARGET_FILTER_ADD_ICON_ID = "target.filter.add.id";
/**
* ID-Dist.
*/
public static final String DIST_TABLE_ID = "dist.tableId";
/**
* ID-Dist.Name.
*/
public static final String DIST_ADD_NAME = "dist.add.name";
/**
* ID-Dist.Version.
*/
public static final String DIST_ADD_VERSION = "dist.add.version";
/**
* ID-Dist.DistSetType.
*/
public static final String DIST_ADD_DISTSETTYPE = "dist.add.distsettype";
/**
* ID-Dist.desc.
*/
public static final String DIST_ADD_DESC = "dist.add.desc";
/**
* /** ID-Dist.DELETE.
*/
public static final String DIST_DELETE_ALL = "dist.delete.all";
/**
* ID-Dist.MigCheck.
*/
public static final String DIST_ADD_MIGRATION_CHECK = "dist.add.required.migration";
/**
* ID-Dist.Search.icon.
*/
public static final String DIST_SEARCH_ICON = "dist.search.rest.icon";
/**
* ID-Dist.Search.txt.
*/
public static final String DIST_SEARCH_TEXTFIELD = "dist.search.textfield";
/**
* ID - Dist.Add.
*/
public static final String DIST_ADD_ICON = "dist.add.icon";
/**
* ID for Distribution Tag ComboBox
*/
public static final String DIST_TAG_COMBO = "dist.tag.combo";
/**
* ID-Dist.PIN.
*/
public static final String DIST_PIN_BUTTON = "dist.pin.button";
/**
* ID - soft.module.name.
*/
public static final String SOFT_MODULE_NAME = "soft.module.name";
/**
* ID - soft.module.version.
*/
public static final String SOFT_MODULE_VERSION = "soft.module.version";
/**
* ID - soft.module.vendor.
*/
public static final String SOFT_MODULE_VENDOR = "soft.module.vendor";
/**
* ID - Save Assign.
*/
public static final String SAVE_ASSIGNMENT = "save.actions.popup.assign";
/**
* ID - Discard Assign.
*/
public static final String DISCARD_ASSIGNMENT = "discard.actions.popup.assign";
/**
* ID - Delete Distribution SetType Save.
*/
public static final String SAVE_DELETE_DIST_SET_TYPE = "save.actions.popup.delete.dist.set.type";
/**
* ID - Discard Distribution SetType.
*/
public static final String DISCARD_DIST_SET_TYPE = "save.actions.popup.discard.dist.set.type";
/**
* ID Delete Software Module Type save.
*/
public static final String SAVE_DELETE_SW_MODULE_TYPE = "save.actions.popup.delete.sw.module.type";
/**
* ID - Discard SW Module Type.
*/
public static final String DISCARD_SW_MODULE_TYPE = "save.actions.popup.discard.sw.module.type";
/**
* Action history table cancel Id.
*/
public static final String ACTION_DETAILS_SOFT_ID = "action.details.soft.group";
/**
* ID - Label.
*/
public static final String ACTION_LABEL = "save.actions.popup.actionMsg";
/**
* ID - Count.
*/
public static final String COUNT_LABEL = "count.message.label";
/**
* UNKNOWN_STATUS_ICON ID.
*/
public static final String UNKNOWN_STATUS_ICON = "unknown.status.icon";
/**
* INSYNCH_STATUS_ICON ID.
*/
public static final String INSYNCH_STATUS_ICON = "insynch.status.icon";
/**
* PENDING_STATUS_ICON ID.
*/
public static final String PENDING_STATUS_ICON = "pending.status.icon";
/**
* ERROR_STATUS_ICON ID.
*/
public static final String ERROR_STATUS_ICON = "error.status.icon";
/**
* REGISTERED_STATUS_ICON ID.
*/
public static final String REGISTERED_STATUS_ICON = "registered.status.icon";
/**
* OVERDUE_STATUS_ICON ID.
*/
public static final String OVERDUE_STATUS_ICON = "overdue.status.icon";
/**
* DROP filter icon id.
*/
public static final String TARGET_DROP_FILTER_ICON = "target.drop.filter.icon";
/**
* Pending action button id.
*/
public static final String PENDING_ACTION_BUTTON = "pending.action.button";
/**
* Action history table Id.
*/
public static final String ACTION_HISTORY_TABLE_ID = "action.history.tableId";
/**
* Action history table cancel Id.
*/
public static final String ACTION_HISTORY_TABLE_CANCEL_ID = "action.history.table.action.cancel";
/**
* Action history table force Id.
*/
public static final String ACTION_HISTORY_TABLE_FORCE_ID = "action.history.table.action.force";
/**
* Action history table force quit Id.
*/
public static final String ACTION_HISTORY_TABLE_FORCE_QUIT_ID = "action.history.table.action.force.quit";
/**
* Target filter wrapper id.
*/
public static final String TARGET_FILTER_WRAPPER_ID = "target-drop-filter";
/**
* Delete button wrapper id.
*/
public static final String DELETE_BUTTON_WRAPPER_ID = "delete.button";
/**
* tag color preview button id.
*/
public static final String TAG_COLOR_PREVIEW_ID = "tag.color.preview";
/**
* Id for ColorPickerLayout
*/
public static final String COLOR_PICKER_LAYOUT = "color.picker.layout";
/**
* Id for ColorPickerLayout's red slider
*/
public static final String COLOR_PICKER_RED_SLIDER = "color.picker.red.slider";
/**
* Id for Color preview field with the color code
*/
public static final String COLOR_PREVIEW_FIELD = "color-preview-field";
/**
* Id for OptionGroup Create/Update tag
*/
public static final String OPTION_GROUP = "create.update.tag";
/**
* Confirmation dialogue OK button id.
*/
public static final String OK_BUTTON = "ok.button";
/**
* Upload - type button id.
*/
public static final String UPLOAD_TYPE_BUTTON_PREFIX = "upload.type.button.";
/**
* Upload - process button id.
*/
public static final String UPLOAD_PROCESS_BUTTON = "upload.process.button";
/**
* Upload - discard button id.
*/
public static final String UPLOAD_DISCARD_BUTTON = "upload.discard.button";
/**
* Upload - artifact detail close button.
*/
public static final String UPLOAD_ARTIFACT_DETAILS_CLOSE = "upload.artifactdetails.close.button";
/**
* Upload - artifact detail table.
*/
public static final String UPLOAD_ARTIFACT_DETAILS_TABLE = "upload.artifactdetails.table";
/**
* Upload - artifact upload button.
*/
public static final String UPLOAD_BUTTON = "artifact.upload.button";
/**
* Upload - process button id.
*/
public static final String UPLOAD_DISCARD_DETAILS_BUTTON = "upload.discard.details.button";
/**
* Upload - delete button id.
*/
public static final String UPLOAD_DELETE_ICON = "upload.delete.button";
/**
* Upload- file delete button id.
*/
public static final String UPLOAD_FILE_DELETE_ICON = "upload.file.delete.button";
/**
* ID-Dist.
*/
public static final String UPLOAD_SOFTWARE_MODULE_TABLE = "upload.swModule.table";
/**
* Upload result popup close button.
*/
public static final String UPLOAD_ARTIFACT_RESULT_POPUP_CLOSE = "upload.resultwindow.close.button";
/**
* Upload result popup close button.
*/
public static final String UPLOAD_ARTIFACT_RESULT_CLOSE = "upload.results.close.button";
/**
* Upload - artifact result table.
*/
public static final String UPLOAD_RESULT_TABLE = "upload.result.table";
/**
* Upload - software module search text id.
*/
public static final String SW_MODULE_SEARCH_TEXT_FIELD = "swmodule.search.textfield";
/**
* Upload - software module search reset icon id.
*/
public static final String SW_MODULE_SEARCH_RESET_ICON = "sw.search.reset.icon";
/**
* Upload - artifact upload error reason.
*/
public static final String UPLOAD_ERROR_REASON = "upload-error-reason";
/**
* Upload - artifact upload - Software module add button.
*/
public static final String SW_MODULE_ADD_BUTTON = "sw.module.add.button";
/**
* Upload - artifact upload - Software module type combo id.
*/
public static final String SW_MODULE_TYPE = "sw.module.select.type";
/**
* Upload - artifact upload - Software module description.
*/
public static final String ADD_SW_MODULE_DESCRIPTION = "sw.module.description";
/**
* ID-Targ.Detail.icon.
*/
public static final String SW_TABLE_ATRTIFACT_DETAILS_ICON = "swmodule.artifact.details.icon";
/**
* Artifact upload - sw module edit button id.
*/
public static final String UPLOAD_SW_MODULE_EDIT_BUTTON = "swmodule.edit.button";
/**
* Ds edit button id.
*/
public static final String DS_EDIT_BUTTON = "ds.edit.button";
/**
* Upload Artifact details max table Id.
*/
public static final String UPLOAD_ARTIFACT_DETAILS_TABLE_MAX = "upload.artifactdetails.table.max";
/**
* Target tag close button.
*/
public static final String HIDE_TARGET_TAGS = "hide.target.tags";
/**
* Show target tag layout icon.
*/
public static final String SHOW_TARGET_TAGS = "show.target.tags.icon";
/**
* ID-Target tag table.
*/
public static final String TARGET_TAG_TABLE_ID = "target.tag.tableId";
/**
* ID-Distibution tag table.
*/
public static final String DISTRIBUTION_TAG_TABLE_ID = "distriution.tag.tableId";
/**
* ID-Software module type table.
*/
public static final String SW_MODULE_TYPE_TABLE_ID = "sw.module.type.table";
/**
* ID-Target tag table.
*/
public static final String DISTRIBUTION_SET_TYPE_TABLE_ID = "dist.set.type.tableId";
/**
* Tab sheet id.
*/
public static final String TARGET_DETAILS_TABSHEET = "target.details.tabsheet";
/**
* Tab sheet id.
*/
public static final String DISTRIBUTION_DETAILS_TABSHEET = "distribution.details.tabsheet.";
/**
* Combobox id.
*/
public static final String SYSTEM_CONFIGURATION_DEFAULTDIS_COMBOBOX = "default.disset.combobox";
/**
* Button save id.
*/
public static final String SYSTEM_CONFIGURATION_SAVE = "system.configuration.save";
/**
* ID for save button in pop-up-windows instance of commonDialogWindow
*/
public static final String SAVE_BUTTON = "common.dialog.window.save";
/**
* ID for cancel button in pop-up-windows instance of commonDialogWindow
*/
public static final String CANCEL_BUTTON = "common.dialog.window.cancel";
/**
* Cancel button is.
*/
public static final String SYSTEM_CONFIGURATION_CANCEL = "system.configuration.cancel";
/**
* Id of maximize/minimize icon of table - Software module table.
*/
public static final String SW_MAX_MIN_TABLE_ICON = "sw.max.min.table.icon";
/**
* Id of maximize/minimize icon of table - Distribution table.
*/
public static final String DS_MAX_MIN_TABLE_ICON = "ds.max.min.table.icon";
/**
* Software module table in upload UI.
*/
public static final String SM_TYPE_FILTER_BTN_ID = "sm.type.filter.btn.";
/**
* Software module table details header caption id.
*/
public static final String TARGET_DETAILS_HEADER_LABEL_ID = "target.details.header.caption";
/**
* Software module table details header caption id.
*/
public static final String DISTRIBUTION_DETAILS_HEADER_LABEL_ID = "distribution.details.header.caption";
/**
* Software module table details vendor label id.
*/
public static final String DETAILS_VENDOR_LABEL_ID = "details.vendor";
/**
* Software module table details description label id.
*/
public static final String DETAILS_DESCRIPTION_LABEL_ID = "details.description";
/**
* Software module table details type label id.
*/
public static final String DETAILS_TYPE_LABEL_ID = "details.type";
/**
* Id of show filter button in software module table.
*/
public static final String SM_SHOW_FILTER_BUTTON_ID = "show.filter.layout";
/**
* Software module table in upload UI.
*/
public static final String DS_TYPE_FILTER_BTN_ID = "ds.type.filter.btn.";
/**
* Id of target table search reset Icon.
*/
public static final String TARGET_TBL_SEARCH_RESET_ID = "target.search.rest.icon";
/**
* Id of the target table add Icon.
*/
public static final String TARGET_TBL_ADD_ICON_ID = "target.add";
/**
* Id of IP address label in target details.
*/
public static final String TARGET_IP_ADDRESS = "target.ip.address";
/**
* Id of Last query date label in target details.
*/
public static final String TARGET_LAST_QUERY_DT = "target.last.query.date";
/**
* Id of Controller Id label in target details.
*/
public static final String TARGET_CONTROLLER_ID = "target.controller.id";
/**
* Id of security token label in target details.
*/
public static final String TARGET_SECURITY_TOKEN = "target.security.token";
/**
* Id of maximize/minimize icon of table - Software module table.
*/
public static final String TARGET_MAX_MIN_TABLE_ICON = "target.max.min.table.icon";
/**
* Software module table in upload UI.
*/
public static final String SWM_DTLS_MAX_ASSIGN = "max.assign";
/**
* Documentation Link in Login view and menu.
*/
public static final String LINK_DOCUMENTATION = "link.documentation";
/**
* Demo Link in Login view and menu.
*/
public static final String LINK_DEMO = "link.demo";
/**
* Request account Link in Login view and menu.
*/
public static final String LINK_REQUESTACCOUNT = "link.requestaccount";
/**
* Support Link in Login view and menu.
*/
public static final String LINK_SUPPORT = "link.support";
/**
* User management Link in Login view and menu.
*/
public static final String LINK_USERMANAGEMENT = "link.usermanagement";
/**
* New Target tag add icon id.
*/
public static final String ADD_TARGET_TAG = "target.tag.add";
/**
* New distribution set tag add icon id.
*/
public static final String ADD_DISTRIBUTION_TAG = "distribution.tag.add";
/**
* Bulk target upload - distribution set combo.
*/
public static final String BULK_UPLOAD_DS_COMBO = "bulkupload.ds.combo";
/**
* Bulk target upload - description.
*/
public static final String BULK_UPLOAD_DESC = "bulkupload.description";
/**
* Bulk target upload - tag field.
*/
public static final String BULK_UPLOAD_TAG = "bulkupload.tag";
/**
* Bulk target upload - count label.
*/
public static final String BULK_UPLOAD_COUNT = "bulkupload.upload.count";
/**
* Id of the target table bulk upload Icon.
*/
public static final String TARGET_TBL_BULK_UPLOAD_ICON_ID = "target.bulk.upload";
/**
* Id of target filter table search reset Icon.
*/
public static final String TARGET_FILTER_TBL_SEARCH_RESET_ID = "target.filter.search.rest.icon";
/**
* ID- Customfilter.Name.
*/
public static final String CUSTOM_FILTER_ADD_NAME = "custom.filter.add.name";
/**
* custom filter - delete button id.
*/
public static final String CUSTOM_FILTER_DELETE_ICON = "custom.filter.delete.button";
/**
* custom filter - update button id.
*/
public static final String CUSTOM_FILTER_DETAIL_LINK = "custom.filter.detail.link";
/**
* custom filter - save button id.
*/
public static final String CUSTOM_FILTER_SAVE_ICON = "custom.filter.save.button.Id";
/**
* ID-Custom target tag table.
*/
public static final String CUSTOM_TARGET_TAG_TABLE_ID = "custom.target.tag.tableId";
/**
* Target filter table id.
*/
public static final String TAEGET_FILTER_TABLE_ID = "target.query.filter.table.Id";
/**
* create or update target filter query - name label id.
*/
public static final String TARGET_FILTER_QUERY_NAME_LABEL_ID = "target.filter.name.label.id";
/**
* create or update target filter query - name layout id.
*/
public static final String TARGET_FILTER_QUERY_NAME_LAYOUT_ID = "target.filter.name.layout.id";
/**
* * create or update target filter query - target table id.
*/
public static final String CUSTOM_FILTER_TARGET_TABLE_ID = "custom.filter.target.table.id";
/**
* Bulk upload notification button id.
*/
public static final String BULK_UPLOAD_STATUS_BUTTON = "bulk.upload.notification.id";
/**
* Target bulk upload minimize button id.
*/
public static final String BULK_UPLOAD_MINIMIZE_BUTTON_ID = "bulk.upload.minimize.button.id";
/**
* Target bulk upload minimize button id.
*/
public static final String BULK_UPLOAD_CLOSE_BUTTON_ID = "bulk.upload.close.button.id";
/**
* Rollout list view - search box id.
*/
public static final String ROLLOUT_LIST_SEARCH_BOX_ID = "rollout.list.search.id";
/**
* Rollout list view - search reset icon id.
*/
public static final String ROLLOUT_LIST_SEARCH_RESET_ICON_ID = "rollout.list.search.reset.icon.id";
/**
* Rollout list view - add icon id.
*/
public static final String ROLLOUT_ADD_ICON_ID = "rollout.add.button.id";
/**
* Rollout list grid id.
*/
public static final String ROLLOUT_LIST_GRID_ID = "rollout.grid.id";
/**
* Rollout group list grid id.
*/
public static final String ROLLOUT_GROUP_LIST_GRID_ID = "rollout.group.grid.id";
/**
* Rollout group list grid id.
*/
public static final String ROLLOUT_GROUP_TARGETS_LIST_GRID_ID = "rollout.group.targets.grid.id";
/**
* Rollout text field name id.
*/
public static final String ROLLOUT_NAME_FIELD_ID = "rollout.name.field.id";
/**
* Rollout number of groups id.
*/
public static final String ROLLOUT_NO_OF_GROUPS_ID = "rollout.no.ofgroups.id";
/**
* Rollout trigger threshold field if.
*/
public static final String ROLLOUT_TRIGGER_THRESOLD_ID = "rollout.trigger.thresold.id";
/**
* Rollout error thresold field id.
*/
public static final String ROLLOUT_ERROR_THRESOLD_ID = "rollout.error.thresold.id";
/**
* Rollout distribution set combo id.
*/
public static final String ROLLOUT_DS_ID = "rollout.ds.id";
/**
* Rollout description field id.
*/
public static final String ROLLOUT_DESCRIPTION_ID = "rollout.description.id";
/**
* Rollout target filter query combo id.
*/
public static final String ROLLOUT_TARGET_FILTER_COMBO_ID = "rollout.target.filter.combo.id";
/**
* Rollout action button id.
*/
public static final String ROLLOUT_ACTION_ID = "rollout.action.button.id";
/**
* Rollout start button id.
*/
public static final String ROLLOUT_RUN_BUTTON_ID = ROLLOUT_ACTION_ID + ".9";
/**
* Rollout pause button id.
*/
public static final String ROLLOUT_PAUSE_BUTTON_ID = ROLLOUT_ACTION_ID + ".10";
/**
* Rollout resume button id.
*/
public static final String ROLLOUT_UPDATE_BUTTON_ID = ROLLOUT_ACTION_ID + ".11";
/**
* Rollout status label id.
*/
public static final String ROLLOUT_STATUS_LABEL_ID = "rollout.status.id";
/**
* Rollout group status label id.
*/
public static final String ROLLOUT_GROUP_STATUS_LABEL_ID = "rollout.group.status.id";
/**
* Rollout % or count option group id.
*/
public static final String ROLLOUT_ERROR_THRESOLD_OPTION_ID = "rollout.error.thresold.option.id";
/**
* Rollout target filter query value text area id.
*/
public static final String ROLLOUT_TARGET_FILTER_QUERY_FIELD = "rollout.target.filter.query.field.id";
/**
* Rollout target view- close button id.
*/
public static final String ROLLOUT_TARGET_VIEW_CLOSE_BUTTON_ID = "rollout.group.target.close.id";
/**
* Rollout group header caption.
*/
public static final String ROLLOUT_GROUP_HEADER_CAPTION = "rollout.group.header.caption";
/**
* Rollout group close id.
*/
public static final String ROLLOUT_GROUP_CLOSE = "rollout.group.close.id";
/**
* Rollout group targets count message label.
*/
public static final String ROLLOUT_GROUP_TARGET_LABEL = "rollout.group.target.label";
/**
* Action confirmation popup id.
*/
public static final String CONFIRMATION_POPUP_ID = "action.confirmation.popup.id";
/**
* Validation status icon .
*/
public static final String VALIDATION_STATUS_ICON_ID = "validation.status.icon";
/**
* Artifact upload status popup - minimize button id.
*/
public static final String UPLOAD_STATUS_POPUP_MINIMIZE_BUTTON_ID = "artifact.upload.minimize.button.id";
/**
* Artifact upload status popup - close button id.
*/
public static final String UPLOAD_STATUS_POPUP_CLOSE_BUTTON_ID = "artifact.upload.close.button.id";
/**
* Artifact upload status popup - resize button id.
*/
public static final String UPLOAD_STATUS_POPUP_RESIZE_BUTTON_ID = "artifact.upload.resize.button.id";
/**
* Artifact upload view - upload status button id.
*/
public static final String UPLOAD_STATUS_BUTTON = "artficat.upload.status.button.id";
/**
* Artifact uplaod view - uplod status popup id.
*/
public static final String UPLOAD_STATUS_POPUP_ID = "artifact.upload.status.popup.id";
/**
* Software module table - Manage metadata id.
*/
public static final String SW_TABLE_MANAGE_METADATA_ID = "swtable.manage.metadata.id";
/**
* Metadata key id.
*/
public static final String METADATA_KEY_FIELD_ID = "metadata.key.id";
/**
* Metadata value id.
*/
public static final String METADATA_VALUE_ID = "metadata.value.id";
/**
* Metadata add icon id.
*/
public static final String METADTA_ADD_ICON_ID = "metadata.add.icon.id";
/**
* Metadata table id.
*/
public static final String METDATA_TABLE_ID = "metadata.table.id";
/**
* Distribution set table - Manage metadata id.
*/
public static final String DS_TABLE_MANAGE_METADATA_ID = "dstable.manage.metadata.id";
/**
* DistributionSet - Metadata button id.
*/
public static final String DS_METADATA_DETAIL_LINK = "distributionset.metadata.detail.link";
/**
* Metadata popup id.
*/
public static final String METADATA_POPUP_ID = "metadata.popup.id";
/**
* DistributionSet table details tab id in Distributions .
*/
public static final String DISTRIBUTIONSET_DETAILS_TABSHEET_ID = "distributionset.details.tabsheet";
/**
* Software module table details tab id in Distributions .
*/
public static final String DIST_SW_MODULE_DETAILS_TABSHEET_ID = "dist.sw.module.details.tabsheet";
/**
* Software Module - Metadata button id.
*/
public static final String SW_METADATA_DETAIL_LINK = "softwaremodule.metadata.detail.link";
/**
* /* Private Constructor.
*/
private SPUIComponentIdProvider() {
}
}

View File

@@ -205,6 +205,12 @@ public final class SPUIDefinitions {
* Filter by status key. * Filter by status key.
*/ */
public static final String FILTER_BY_STATUS = "FilterByStatus"; public static final String FILTER_BY_STATUS = "FilterByStatus";
/**
* Filter by overdue state key.
*/
public static final String FILTER_BY_OVERDUE_STATE = "FilterByOverdueState";
/** /**
* Filter by tag key. * Filter by tag key.
*/ */
@@ -407,7 +413,7 @@ public final class SPUIDefinitions {
/** /**
* Filter by type layout width. * Filter by type layout width.
*/ */
public static final float FILTER_BY_TYPE_WIDTH = 150.0F; public static final float FILTER_BY_TYPE_WIDTH = 190.0F;
/** /**
* Confirmation jukebox type. * Confirmation jukebox type.

View File

@@ -13,8 +13,9 @@
$unknown-color: $status-unknown-color; $unknown-color: $status-unknown-color;
$in-sync-color: $signal-green-color; $in-sync-color: $signal-green-color;
$pending-color: $signal-yellow-color; $pending-color: $signal-yellow-color;
$error-color: $signal-red-color; $error-color: $signal-red-color;
$registered-color: $bosch-color-light-blue; $overdue-color: $signal-black-color;
$registered-color: $signal-light-blue-color;
//Filter by status buttons group alignment //Filter by status buttons group alignment
.target-status-filters { .target-status-filters {
@@ -27,6 +28,10 @@
.status-button-layout { .status-button-layout {
height: 40px !important; height: 40px !important;
} }
.overdue-button-layout {
height: 40px !important;
}
//Filter Button applied with below styles based on the color //Filter Button applied with below styles based on the color
.unknownBtn { .unknownBtn {
@@ -68,6 +73,16 @@
.errorBtn:active:after { .errorBtn:active:after {
border-color: $error-color; border-color: $error-color;
} }
.overdueBtn {
background: $overdue-color;
border: solid 3px $overdue-color;
}
.overdueBtn:focus:after,
.overdueBtn:active:after {
border-color: $overdue-color;
}
.registeredBtn { .registeredBtn {
background: $registered-color; background: $registered-color;

View File

@@ -101,10 +101,12 @@ $details-tab-caption-font-scale: .8;
//Generic text style //Generic text style
$generic-text-font-scale: .85; $generic-text-font-scale: .85;
$status-unknown-color: #3085cb; $status-unknown-color: #d5d5d5;
$signal-green-color: #6eb553; $signal-green-color: #6eb553;
$signal-yellow-color: #ff0; $signal-yellow-color: #ff0;
$signal-light-blue-color: #3085cb;
$signal-red-color: #f00; $signal-red-color: #f00;
$signal-black-color: #000;
$signal-orange-color: #ffa500; $signal-orange-color: #ffa500;
$grey-light: #d5d5d5; $grey-light: #d5d5d5;

View File

@@ -178,7 +178,7 @@
} }
.statusIconLightBlue { .statusIconLightBlue {
color: $bosch-color-light-blue; color: $signal-light-blue-color;
} }
.v-button-statusIconLightBlue:after { .v-button-statusIconLightBlue:after {
@@ -219,7 +219,7 @@
pointer-events: auto !important; pointer-events: auto !important;
} }
.blueSpinner{ .blueSpinner{
@include valo-spinner($size: $v-font-size--small,$color: $bosch-color-light-blue); @include valo-spinner($size: $v-font-size--small,$color: $signal-light-blue-color);
pointer-events: auto !important; pointer-events: auto !important;
} }

View File

@@ -44,7 +44,7 @@
.target-filter-spinner{ .target-filter-spinner{
@include valo-spinner( @include valo-spinner(
$size: $v-font-size--small, $size: $v-font-size--small,
$color: $bosch-color-light-blue $color: $signal-light-blue-color
); );
} }

View File

@@ -128,8 +128,6 @@ label.combobox.type = Select Type
label.combobox.tag = Select Tag label.combobox.tag = Select Tag
label.choose.tag = Choose Tag to update label.choose.tag = Choose Tag to update
label.choose.tag.color = Choose Tag Color label.choose.tag.color = Choose Tag Color
label.filter = Filter:
label.target.filter.count = Total Targets:
label.target.filtered.total = Total filtered targets : label.target.filtered.total = Total filtered targets :
label.filter.selected = Selected: label.filter.selected = Selected:
label.filter.shown = Shown: label.filter.shown = Shown:
@@ -139,6 +137,7 @@ label.filter.selected = Selected :
label.filter.shown = Shown : label.filter.shown = Shown :
label.filter.targets = Filtered targets : label.filter.targets = Filtered targets :
label.filter.status = Status, label.filter.status = Status,
label.filter.overdue = Overdue,
label.filter.tags = Tags, label.filter.tags = Tags,
label.filter.text = Search Text label.filter.text = Search Text
label.filter.dist = Distribution, label.filter.dist = Distribution,
@@ -159,6 +158,7 @@ label.target.id = Controller Id :
label.target.ip = Controller IP : label.target.ip = Controller IP :
label.target.security.token = Security token : label.target.security.token = Security token :
label.filter.by.status = Filter by Status label.filter.by.status = Filter by Status
label.filter.by.overdue = Filter by Overdue State
label.target.controller.attrs = <b>Controller attributes</b> label.target.controller.attrs = <b>Controller attributes</b>
label.target.lastpolldate = Last poll : label.target.lastpolldate = Last poll :
label.no.tag.assigned = NO TAG label.no.tag.assigned = NO TAG
@@ -192,6 +192,7 @@ tooltip.status.registered = Registered
tooltip.status.pending = Pending tooltip.status.pending = Pending
tooltip.status.error = Error tooltip.status.error = Error
tooltip.status.insync = In-sync tooltip.status.insync = In-sync
tooltip.status.overdue = Overdue
tooltip.delete.module = Select and delete Software Module tooltip.delete.module = Select and delete Software Module
tooltip.forced.item=Forced update action tooltip.forced.item=Forced update action
tooltip.soft.item=Soft update action which interacts with an user as a attempt update action for example tooltip.soft.item=Soft update action which interacts with an user as a attempt update action for example

View File

@@ -128,8 +128,6 @@ label.combobox.type = Select Type
label.combobox.tag = Select Tag label.combobox.tag = Select Tag
label.choose.tag = Choose Tag to update label.choose.tag = Choose Tag to update
label.choose.tag.color = Choose Tag Color label.choose.tag.color = Choose Tag Color
label.filter = Filter:
label.target.filter.count = Total Targets:
label.target.filtered.total = Total filtered targets : label.target.filtered.total = Total filtered targets :
label.filter.selected = Selected: label.filter.selected = Selected:
label.filter.shown = Shown: label.filter.shown = Shown:
@@ -138,6 +136,7 @@ label.target.filter.count = Total Targets :
label.filter.selected = Selected : label.filter.selected = Selected :
label.filter.shown = Shown : label.filter.shown = Shown :
label.filter.status = Status, label.filter.status = Status,
label.filter.overdue = Overdue,
label.filter.tags = Tags, label.filter.tags = Tags,
label.filter.text = Search Text label.filter.text = Search Text
label.filter.dist = Distribution, label.filter.dist = Distribution,
@@ -158,6 +157,7 @@ label.target.id = Controller Id :
label.target.ip = Controller IP : label.target.ip = Controller IP :
label.target.security.token = Security token : label.target.security.token = Security token :
label.filter.by.status = Filter by Status label.filter.by.status = Filter by Status
label.filter.by.overdue = Filter by Overdue State
label.target.controller.attrs = <b>Controller attributes</b> label.target.controller.attrs = <b>Controller attributes</b>
label.target.lastpolldate = Last poll : label.target.lastpolldate = Last poll :
label.no.tag.assigned = NO TAG label.no.tag.assigned = NO TAG
@@ -191,6 +191,7 @@ tooltip.status.registered = Registered
tooltip.status.pending = Pending tooltip.status.pending = Pending
tooltip.status.error = Error tooltip.status.error = Error
tooltip.status.insync = In-sync tooltip.status.insync = In-sync
tooltip.status.overdue = Overdue
tooltip.delete.module = Select and delete Software Module tooltip.delete.module = Select and delete Software Module
tooltip.forced.item=Forced update action tooltip.forced.item=Forced update action
tooltip.soft.item=Soft update action which interacts with an user as a attempt update action for example tooltip.soft.item=Soft update action which interacts with an user as a attempt update action for example

View File

@@ -127,8 +127,6 @@ label.combobox.type = Select Type
label.combobox.tag = Select Tag label.combobox.tag = Select Tag
label.choose.tag = Choose Tag to update label.choose.tag = Choose Tag to update
label.choose.tag.color = Choose Tag Color label.choose.tag.color = Choose Tag Color
label.filter = Filter:
label.target.filter.count = Total Targets:
label.target.filtered.total = Total filtered targets : label.target.filtered.total = Total filtered targets :
label.filter.selected = Selected: label.filter.selected = Selected:
label.filter.shown = Shown: label.filter.shown = Shown:
@@ -138,6 +136,7 @@ label.target.filter.count = Total Targets :
label.filter.selected = Selected : label.filter.selected = Selected :
label.filter.shown = Shown : label.filter.shown = Shown :
label.filter.status = Status, label.filter.status = Status,
label.filter.overdue = Overdue,
label.filter.tags = Tags, label.filter.tags = Tags,
label.filter.text = Search Text label.filter.text = Search Text
label.filter.dist = Distribution, label.filter.dist = Distribution,
@@ -158,6 +157,7 @@ label.target.id = Controller Id :
label.target.ip = Controller IP : label.target.ip = Controller IP :
label.target.security.token = Security token : label.target.security.token = Security token :
label.filter.by.status = Filter by Status label.filter.by.status = Filter by Status
label.filter.by.overdue = Filter by Overdue State
label.target.controller.attrs = <b>Controller attributes</b> label.target.controller.attrs = <b>Controller attributes</b>
label.target.lastpolldate = Last poll : label.target.lastpolldate = Last poll :
label.no.tag.assigned = NO TAG label.no.tag.assigned = NO TAG
@@ -191,6 +191,7 @@ tooltip.status.registered = Registered
tooltip.status.pending = Pending tooltip.status.pending = Pending
tooltip.status.error = Error tooltip.status.error = Error
tooltip.status.insync = In-sync tooltip.status.insync = In-sync
tooltip.status.overdue = Overdue
tooltip.delete.module = Select and delete Software Module tooltip.delete.module = Select and delete Software Module
tooltip.forced.item=Forced update action tooltip.forced.item=Forced update action
tooltip.soft.item=Soft update action which interacts with an user as a attempt update action for example tooltip.soft.item=Soft update action which interacts with an user as a attempt update action for example