Merge branch 'master' into MECS-1277_clearing_the_search_field_should_keep_the_focus
This commit is contained in:
@@ -45,7 +45,7 @@ import ru.yandex.qatools.allure.annotations.Stories;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*
|
* Test Amqp controller authentfication.
|
||||||
*/
|
*/
|
||||||
@Features("AMQP Authenfication Test")
|
@Features("AMQP Authenfication Test")
|
||||||
@Stories("Tests the authenfication")
|
@Stories("Tests the authenfication")
|
||||||
@@ -86,24 +86,34 @@ public class AmqpControllerAuthentficationTest {
|
|||||||
amqpMessageHandlerService.setAuthenticationManager(authenticationManager);
|
amqpMessageHandlerService.setAuthenticationManager(authenticationManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = BadCredentialsException.class)
|
@Test
|
||||||
@Description("Tests authentication manager without principal")
|
@Description("Tests authentication manager without principal")
|
||||||
public void testAuthenticationeBadCredantialsWithoutPricipal() {
|
public void testAuthenticationeBadCredantialsWithoutPricipal() {
|
||||||
final TenantSecruityToken securityToken = new TenantSecruityToken(TENANT, CONTROLLLER_ID, "12345");
|
final TenantSecruityToken securityToken = new TenantSecruityToken(TENANT, CONTROLLLER_ID, "12345");
|
||||||
authenticationManager.doAuthenticate(securityToken);
|
try {
|
||||||
fail();
|
authenticationManager.doAuthenticate(securityToken);
|
||||||
|
fail("BadCredentialsException was excepeted since principal was missing");
|
||||||
|
} catch (final BadCredentialsException exception) {
|
||||||
|
// test ok - exception was excepted
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = BadCredentialsException.class)
|
@Test
|
||||||
@Description("Tests authentication manager without wrong credential")
|
@Description("Tests authentication manager without wrong credential")
|
||||||
public void testAuthenticationBadCredantialsWithWrongCredential() {
|
public void testAuthenticationBadCredantialsWithWrongCredential() {
|
||||||
final TenantSecruityToken securityToken = new TenantSecruityToken(TENANT, CONTROLLLER_ID, "12345");
|
final TenantSecruityToken securityToken = new TenantSecruityToken(TENANT, CONTROLLLER_ID, "12345");
|
||||||
when(systemManagement.getConfigurationValue(
|
when(systemManagement.getConfigurationValue(
|
||||||
eq(TenantConfigurationKey.AUTHENTICATION_MODE_TARGET_SECURITY_TOKEN_ENABLED), any()))
|
eq(TenantConfigurationKey.AUTHENTICATION_MODE_TARGET_SECURITY_TOKEN_ENABLED), any()))
|
||||||
.thenReturn(Boolean.TRUE);
|
.thenReturn(Boolean.TRUE);
|
||||||
securityToken.getHeaders().put(TenantSecruityToken.AUTHORIZATION_HEADER, "TargetToken 12" + CONTROLLLER_ID);
|
securityToken.getHeaders().put(TenantSecruityToken.AUTHORIZATION_HEADER, "TargetToken 12" + CONTROLLLER_ID);
|
||||||
authenticationManager.doAuthenticate(securityToken);
|
try {
|
||||||
fail();
|
authenticationManager.doAuthenticate(securityToken);
|
||||||
|
fail("BadCredentialsException was excepeted due to wrong credential");
|
||||||
|
} catch (final BadCredentialsException exception) {
|
||||||
|
// test ok - exception was excepted
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ import java.util.Map;
|
|||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
import javax.persistence.criteria.CriteriaBuilder;
|
import javax.persistence.criteria.CriteriaBuilder;
|
||||||
import javax.persistence.criteria.CriteriaQuery;
|
import javax.persistence.criteria.CriteriaQuery;
|
||||||
import javax.persistence.criteria.Predicate;
|
|
||||||
import javax.persistence.criteria.Root;
|
import javax.persistence.criteria.Root;
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
@@ -212,14 +211,9 @@ public class ControllerManagement implements EnvironmentAware {
|
|||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional
|
||||||
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
|
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
|
||||||
public Target findOrRegisterTargetIfItDoesNotexist(@NotNull final String targetid, final URI address) {
|
public Target findOrRegisterTargetIfItDoesNotexist(@NotEmpty final String targetid, final URI address) {
|
||||||
final Specification<Target> spec = new Specification<Target>() {
|
final Specification<Target> spec = (targetRoot, query, cb) -> cb.equal(targetRoot.get(Target_.controllerId),
|
||||||
@Override
|
targetid);
|
||||||
public Predicate toPredicate(final Root<Target> targetRoot, final CriteriaQuery<?> query,
|
|
||||||
final CriteriaBuilder cb) {
|
|
||||||
return cb.equal(targetRoot.get(Target_.controllerId), targetid);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
Target target = targetRepository.findOne(spec);
|
Target target = targetRepository.findOne(spec);
|
||||||
|
|
||||||
@@ -229,9 +223,9 @@ public class ControllerManagement implements EnvironmentAware {
|
|||||||
target.setName(targetid);
|
target.setName(targetid);
|
||||||
return targetManagement.createTarget(target, TargetUpdateStatus.REGISTERED, System.currentTimeMillis(),
|
return targetManagement.createTarget(target, TargetUpdateStatus.REGISTERED, System.currentTimeMillis(),
|
||||||
address);
|
address);
|
||||||
} else {
|
|
||||||
return updateLastTargetQuery(target.getTargetInfo(), address).getTarget();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return updateLastTargetQuery(target.getTargetInfo(), address).getTarget();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -32,6 +32,8 @@ import javax.persistence.PrimaryKeyJoinColumn;
|
|||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
import javax.persistence.Transient;
|
import javax.persistence.Transient;
|
||||||
import javax.persistence.UniqueConstraint;
|
import javax.persistence.UniqueConstraint;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import javax.validation.constraints.Size;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.im.authentication.SpPermission;
|
import org.eclipse.hawkbit.im.authentication.SpPermission;
|
||||||
import org.eclipse.hawkbit.repository.model.helper.SecurityChecker;
|
import org.eclipse.hawkbit.repository.model.helper.SecurityChecker;
|
||||||
@@ -74,6 +76,8 @@ public class Target extends NamedEntity implements Persistable<Long> {
|
|||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Column(name = "controller_id", length = 64)
|
@Column(name = "controller_id", length = 64)
|
||||||
|
@Size(min = 1)
|
||||||
|
@NotNull
|
||||||
private String controllerId;
|
private String controllerId;
|
||||||
|
|
||||||
@Transient
|
@Transient
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import java.util.stream.Collectors;
|
|||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
import javax.persistence.criteria.CriteriaBuilder;
|
import javax.persistence.criteria.CriteriaBuilder;
|
||||||
import javax.persistence.criteria.CriteriaQuery;
|
import javax.persistence.criteria.CriteriaQuery;
|
||||||
|
import javax.persistence.criteria.Expression;
|
||||||
import javax.persistence.criteria.MapJoin;
|
import javax.persistence.criteria.MapJoin;
|
||||||
import javax.persistence.criteria.Path;
|
import javax.persistence.criteria.Path;
|
||||||
import javax.persistence.criteria.Predicate;
|
import javax.persistence.criteria.Predicate;
|
||||||
@@ -101,7 +102,7 @@ public final class RSQLUtility {
|
|||||||
*/
|
*/
|
||||||
public static <A extends Enum<A> & FieldNameProvider, T> Specification<T> parse(final String rsql,
|
public static <A extends Enum<A> & FieldNameProvider, T> Specification<T> parse(final String rsql,
|
||||||
final Class<A> fieldNameProvider) {
|
final Class<A> fieldNameProvider) {
|
||||||
return new RSQLSpecification<>(rsql, fieldNameProvider);
|
return new RSQLSpecification<>(rsql.toLowerCase(), fieldNameProvider);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -460,16 +461,46 @@ public final class RSQLUtility {
|
|||||||
singleList.add(cb.lessThanOrEqualTo(pathOfString(fieldPath), value));
|
singleList.add(cb.lessThanOrEqualTo(pathOfString(fieldPath), value));
|
||||||
break;
|
break;
|
||||||
case "=in=":
|
case "=in=":
|
||||||
singleList.add(fieldPath.in(transformedValues));
|
singleList.add(getInPredicate(transformedValues, fieldPath));
|
||||||
break;
|
break;
|
||||||
case "=out=":
|
case "=out=":
|
||||||
singleList.add(cb.not(fieldPath.in(transformedValues)));
|
singleList.add(getOutPredicate(transformedValues, fieldPath));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
LOGGER.info("operator symbol {} is either not supported or not implemented");
|
LOGGER.info("operator symbol {} is either not supported or not implemented");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Predicate getInPredicate(final List<Object> transformedValues, final Path<Object> fieldPath) {
|
||||||
|
final List<String> inParams = new ArrayList<>();
|
||||||
|
for (final Object param : transformedValues) {
|
||||||
|
if (param instanceof String) {
|
||||||
|
inParams.add(((String) param).toUpperCase());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!inParams.isEmpty()) {
|
||||||
|
return cb.upper(pathOfString(fieldPath)).in(inParams);
|
||||||
|
} else {
|
||||||
|
return fieldPath.in(transformedValues);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private Predicate getOutPredicate(final List<Object> transformedValues, final Path<Object> fieldPath) {
|
||||||
|
final List<String> outParams = new ArrayList<>();
|
||||||
|
for (final Object param : transformedValues) {
|
||||||
|
if (param instanceof String) {
|
||||||
|
outParams.add(((String) param).toUpperCase());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!outParams.isEmpty()) {
|
||||||
|
return cb.not(cb.upper(pathOfString(fieldPath)).in(outParams));
|
||||||
|
} else {
|
||||||
|
return cb.not(fieldPath.in(transformedValues));
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private Path<Object> getMapValueFieldPath(final A enumField, final Path<Object> fieldPath) {
|
private Path<Object> getMapValueFieldPath(final A enumField, final Path<Object> fieldPath) {
|
||||||
if (!enumField.isMap() || enumField.getValueFieldName() == null) {
|
if (!enumField.isMap() || enumField.getValueFieldName() == null) {
|
||||||
return fieldPath;
|
return fieldPath;
|
||||||
@@ -477,6 +508,7 @@ public final class RSQLUtility {
|
|||||||
return fieldPath.get(enumField.getValueFieldName());
|
return fieldPath.get(enumField.getValueFieldName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
private Predicate mapToMapPredicate(final ComparisonNode node, final Path<Object> fieldPath,
|
private Predicate mapToMapPredicate(final ComparisonNode node, final Path<Object> fieldPath,
|
||||||
final A enumField) {
|
final A enumField) {
|
||||||
if (!enumField.isMap()) {
|
if (!enumField.isMap()) {
|
||||||
@@ -485,10 +517,12 @@ public final class RSQLUtility {
|
|||||||
final String[] graph = node.getSelector().split("\\" + FieldNameProvider.SUB_ATTRIBUTE_SEPERATOR);
|
final String[] graph = node.getSelector().split("\\" + FieldNameProvider.SUB_ATTRIBUTE_SEPERATOR);
|
||||||
final String keyValue = graph[graph.length - 1];
|
final String keyValue = graph[graph.length - 1];
|
||||||
if (fieldPath instanceof MapJoin) {
|
if (fieldPath instanceof MapJoin) {
|
||||||
return cb.equal(((MapJoin<?, ?, ?>) fieldPath).key(), keyValue);
|
// Currently we support only string key .So below cast is safe.
|
||||||
|
return cb.equal(cb.upper((Expression<String>) (((MapJoin<?, ?, ?>) fieldPath).key())),
|
||||||
|
keyValue.toUpperCase());
|
||||||
}
|
}
|
||||||
|
|
||||||
return cb.equal(fieldPath.get(enumField.getKeyFieldName()), keyValue);
|
return cb.equal(cb.upper(fieldPath.get(enumField.getKeyFieldName())), keyValue.toUpperCase());
|
||||||
}
|
}
|
||||||
|
|
||||||
private Predicate getEqualToPredicate(final Object transformedValue, final Path<Object> fieldPath) {
|
private Predicate getEqualToPredicate(final Object transformedValue, final Path<Object> fieldPath) {
|
||||||
|
|||||||
@@ -9,10 +9,13 @@
|
|||||||
package org.eclipse.hawkbit.repository;
|
package org.eclipse.hawkbit.repository;
|
||||||
|
|
||||||
import static org.fest.assertions.api.Assertions.assertThat;
|
import static org.fest.assertions.api.Assertions.assertThat;
|
||||||
|
import static org.junit.Assert.fail;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.validation.ConstraintViolationException;
|
||||||
|
|
||||||
import org.apache.commons.lang3.RandomStringUtils;
|
import org.apache.commons.lang3.RandomStringUtils;
|
||||||
import org.eclipse.hawkbit.AbstractIntegrationTest;
|
import org.eclipse.hawkbit.AbstractIntegrationTest;
|
||||||
import org.eclipse.hawkbit.TestDataUtil;
|
import org.eclipse.hawkbit.TestDataUtil;
|
||||||
@@ -71,6 +74,24 @@ public class ControllerManagementTest extends AbstractIntegrationTest {
|
|||||||
.getNumberOfElements()).isEqualTo(3);
|
.getNumberOfElements()).isEqualTo(3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Description("Register a controller which not exist")
|
||||||
|
public void testfindOrRegisterTargetIfItDoesNotexist() {
|
||||||
|
final Target target = controllerManagament.findOrRegisterTargetIfItDoesNotexist("AA", null);
|
||||||
|
assertThat(target).as("target should not be null").isNotNull();
|
||||||
|
|
||||||
|
final Target sameTarget = controllerManagament.findOrRegisterTargetIfItDoesNotexist("AA", null);
|
||||||
|
assertThat(target).as("Target should be the equals").isEqualTo(sameTarget);
|
||||||
|
assertThat(targetRepository.count()).as("Only 1 target should be registred").isEqualTo(1L);
|
||||||
|
|
||||||
|
try {
|
||||||
|
controllerManagament.findOrRegisterTargetIfItDoesNotexist("", null);
|
||||||
|
fail("target with empty controller id should not be registred");
|
||||||
|
} catch (final ConstraintViolationException e) {
|
||||||
|
// ok
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Controller trys to finish an update process after it has been finished by an error action status.")
|
@Description("Controller trys to finish an update process after it has been finished by an error action status.")
|
||||||
public void tryToFinishUpdateProcessMoreThenOnce() {
|
public void tryToFinishUpdateProcessMoreThenOnce() {
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ public class ReportManagementTest extends AbstractIntegrationTest {
|
|||||||
assertThat(targetsCreatedOverPeriod.getData()).hasSize(maxMonthBackAmountReportTargets + 1);
|
assertThat(targetsCreatedOverPeriod.getData()).hasSize(maxMonthBackAmountReportTargets + 1);
|
||||||
for (final DataReportSeriesItem<LocalDate> reportItem : targetsCreatedOverPeriod.getData()) {
|
for (final DataReportSeriesItem<LocalDate> reportItem : targetsCreatedOverPeriod.getData()) {
|
||||||
// only one target is created for each month
|
// only one target is created for each month
|
||||||
assertThat(reportItem.getData().intValue()).isEqualTo(1);
|
assertThat(reportItem.getData().intValue()).as("Target for each month").isEqualTo(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// check cache evict
|
// check cache evict
|
||||||
@@ -109,7 +109,7 @@ public class ReportManagementTest extends AbstractIntegrationTest {
|
|||||||
}
|
}
|
||||||
targetsCreatedOverPeriod = reportManagement.targetsCreatedOverPeriod(DateTypes.perMonth(), from, to);
|
targetsCreatedOverPeriod = reportManagement.targetsCreatedOverPeriod(DateTypes.perMonth(), from, to);
|
||||||
for (final DataReportSeriesItem<LocalDate> reportItem : targetsCreatedOverPeriod.getData()) {
|
for (final DataReportSeriesItem<LocalDate> reportItem : targetsCreatedOverPeriod.getData()) {
|
||||||
assertThat(reportItem.getData().intValue()).isEqualTo(2);
|
assertThat(reportItem.getData().intValue()).as("Target for each month").isEqualTo(2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -221,21 +221,26 @@ public class ReportManagementTest extends AbstractIntegrationTest {
|
|||||||
.getData()[0];
|
.getData()[0];
|
||||||
if (dataReportSeriesItem.getType().equals("ds1")) {
|
if (dataReportSeriesItem.getType().equals("ds1")) {
|
||||||
// total count of three because ds1 has two different versions
|
// total count of three because ds1 has two different versions
|
||||||
assertThat(dataReportSeriesItem.getData()).isEqualTo(3L);
|
assertThat(dataReportSeriesItem.getData()).as("Version/Item type of DistributionSet 1 in statistics")
|
||||||
|
.isEqualTo(3L);
|
||||||
final DataReportSeriesItem<String>[] outerData = innerOuterDataReportSeries.getOuterSeries().getData();
|
final DataReportSeriesItem<String>[] outerData = innerOuterDataReportSeries.getOuterSeries().getData();
|
||||||
assertThat(Arrays.stream(outerData).map(DataReportSeriesItem::getType).collect(Collectors.toList()))
|
assertThat(Arrays.stream(outerData).map(DataReportSeriesItem::getType).collect(Collectors.toList()))
|
||||||
.contains("0.0.0", "0.0.1");
|
.contains("0.0.0", "0.0.1");
|
||||||
} else if (dataReportSeriesItem.getType().equals("ds2")) {
|
} else if (dataReportSeriesItem.getType().equals("ds2")) {
|
||||||
assertThat(dataReportSeriesItem.getData()).isEqualTo(1L);
|
assertThat(dataReportSeriesItem.getData()).as("Version/Item type of DistributionSet 2 in statistics")
|
||||||
|
.isEqualTo(1L);
|
||||||
final DataReportSeriesItem<String>[] outerData = innerOuterDataReportSeries.getOuterSeries().getData();
|
final DataReportSeriesItem<String>[] outerData = innerOuterDataReportSeries.getOuterSeries().getData();
|
||||||
assertThat(outerData).hasSize(1);
|
assertThat(outerData).hasSize(1);
|
||||||
assertThat(outerData[0].getType()).isEqualTo("0.0.2");
|
assertThat(outerData[0].getType()).as("Version/Item type of DistributionSet 2 in statistics")
|
||||||
|
.isEqualTo("0.0.2");
|
||||||
} else if (dataReportSeriesItem.getType().equals("ds3")) {
|
} else if (dataReportSeriesItem.getType().equals("ds3")) {
|
||||||
assertThat(dataReportSeriesItem.getData()).isEqualTo(0L);
|
|
||||||
|
assertThat(dataReportSeriesItem.getData()).as("Version/Item type of DistributionSet 3 in statistics")
|
||||||
|
.isEqualTo(0L);
|
||||||
final DataReportSeriesItem<String>[] outerData = innerOuterDataReportSeries.getOuterSeries().getData();
|
final DataReportSeriesItem<String>[] outerData = innerOuterDataReportSeries.getOuterSeries().getData();
|
||||||
assertThat(outerData).hasSize(1);
|
assertThat(outerData).hasSize(1);
|
||||||
assertThat(outerData[0].getType()).isEqualTo("0.0.3");
|
assertThat(outerData[0].getType()).as("Version/Item type of DistributionSet 3 in statistics")
|
||||||
|
.isEqualTo("0.0.3");
|
||||||
} else {
|
} else {
|
||||||
fail("no assertion count for distribution set " + dataReportSeriesItem.getType());
|
fail("no assertion count for distribution set " + dataReportSeriesItem.getType());
|
||||||
}
|
}
|
||||||
@@ -251,8 +256,7 @@ public class ReportManagementTest extends AbstractIntegrationTest {
|
|||||||
final DataReportSeriesItem<String> dataReportSeriesItem = innerOuterDataReportSeries.getInnerSeries()
|
final DataReportSeriesItem<String> dataReportSeriesItem = innerOuterDataReportSeries.getInnerSeries()
|
||||||
.getData()[0];
|
.getData()[0];
|
||||||
if (dataReportSeriesItem.getType().equals("ds1")) {
|
if (dataReportSeriesItem.getType().equals("ds1")) {
|
||||||
assertThat(dataReportSeriesItem.getData()).isEqualTo(4L);
|
assertThat(dataReportSeriesItem.getData()).as("Data report item number").isEqualTo(4L);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -278,19 +282,23 @@ public class ReportManagementTest extends AbstractIntegrationTest {
|
|||||||
|
|
||||||
switch (reportItem.getType()) {
|
switch (reportItem.getType()) {
|
||||||
case ERROR:
|
case ERROR:
|
||||||
assertThat(reportItem.getData()).isEqualTo(knownErrorCount);
|
assertThat(reportItem.getData()).as("ERROR count for targets in statistics").isEqualTo(knownErrorCount);
|
||||||
break;
|
break;
|
||||||
case IN_SYNC:
|
case IN_SYNC:
|
||||||
assertThat(reportItem.getData()).isEqualTo(knownSyncCount);
|
assertThat(reportItem.getData()).as("IN_SYNC count for targets in statistics")
|
||||||
|
.isEqualTo(knownSyncCount);
|
||||||
break;
|
break;
|
||||||
case PENDING:
|
case PENDING:
|
||||||
assertThat(reportItem.getData()).isEqualTo(knownPendingCount);
|
assertThat(reportItem.getData()).as("PENDING count for targets in statistics")
|
||||||
|
.isEqualTo(knownPendingCount);
|
||||||
break;
|
break;
|
||||||
case REGISTERED:
|
case REGISTERED:
|
||||||
assertThat(reportItem.getData()).isEqualTo(knownRegCount);
|
assertThat(reportItem.getData()).as("REGISTERED count for targets in statistics")
|
||||||
|
.isEqualTo(knownRegCount);
|
||||||
break;
|
break;
|
||||||
case UNKNOWN:
|
case UNKNOWN:
|
||||||
assertThat(reportItem.getData()).isEqualTo(knownUnknownCount);
|
assertThat(reportItem.getData()).as("UNKNOWN count for targets in statistics")
|
||||||
|
.isEqualTo(knownUnknownCount);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fail("missing case for unknown target update status " + reportItem.getType());
|
fail("missing case for unknown target update status " + reportItem.getType());
|
||||||
@@ -309,19 +317,24 @@ public class ReportManagementTest extends AbstractIntegrationTest {
|
|||||||
|
|
||||||
switch (reportItem.getType()) {
|
switch (reportItem.getType()) {
|
||||||
case ERROR:
|
case ERROR:
|
||||||
assertThat(reportItem.getData()).isEqualTo(knownErrorCount * 2);
|
assertThat(reportItem.getData()).as("ERROR count for targets in statistics")
|
||||||
|
.isEqualTo(knownErrorCount * 2);
|
||||||
break;
|
break;
|
||||||
case IN_SYNC:
|
case IN_SYNC:
|
||||||
assertThat(reportItem.getData()).isEqualTo(knownSyncCount * 2);
|
assertThat(reportItem.getData()).as("IN_SYNC count for targets in statistics")
|
||||||
|
.isEqualTo(knownSyncCount * 2);
|
||||||
break;
|
break;
|
||||||
case PENDING:
|
case PENDING:
|
||||||
assertThat(reportItem.getData()).isEqualTo(knownPendingCount * 2);
|
assertThat(reportItem.getData()).as("PENDING count for targets in statistics")
|
||||||
|
.isEqualTo(knownPendingCount * 2);
|
||||||
break;
|
break;
|
||||||
case REGISTERED:
|
case REGISTERED:
|
||||||
assertThat(reportItem.getData()).isEqualTo(knownRegCount * 2);
|
assertThat(reportItem.getData()).as("REGISTERED count for targets in statistics")
|
||||||
|
.isEqualTo(knownRegCount * 2);
|
||||||
break;
|
break;
|
||||||
case UNKNOWN:
|
case UNKNOWN:
|
||||||
assertThat(reportItem.getData()).isEqualTo(knownUnknownCount * 2);
|
assertThat(reportItem.getData()).as("UNKNOWN count for targets in statistics")
|
||||||
|
.isEqualTo(knownUnknownCount * 2);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fail("missing case for unknown target update status " + reportItem.getType());
|
fail("missing case for unknown target update status " + reportItem.getType());
|
||||||
@@ -373,22 +386,30 @@ public class ReportManagementTest extends AbstractIntegrationTest {
|
|||||||
final DataReportSeriesItem<String> dataReportSeriesItem = innerOuterDataReportSeries.getInnerSeries()
|
final DataReportSeriesItem<String> dataReportSeriesItem = innerOuterDataReportSeries.getInnerSeries()
|
||||||
.getData()[0];
|
.getData()[0];
|
||||||
if (dataReportSeriesItem.getType().equals("ds1")) {
|
if (dataReportSeriesItem.getType().equals("ds1")) {
|
||||||
|
|
||||||
// total count of three because ds1 has two different versions
|
// total count of three because ds1 has two different versions
|
||||||
assertThat(dataReportSeriesItem.getData()).isEqualTo(3L);
|
assertThat(dataReportSeriesItem.getData()).as("Total count of DistributionSet 1 in statistics")
|
||||||
|
.isEqualTo(3L);
|
||||||
|
|
||||||
final DataReportSeriesItem<String>[] outerData = innerOuterDataReportSeries.getOuterSeries().getData();
|
final DataReportSeriesItem<String>[] outerData = innerOuterDataReportSeries.getOuterSeries().getData();
|
||||||
assertThat(Arrays.stream(outerData).map(DataReportSeriesItem::getType).collect(Collectors.toList()))
|
assertThat(Arrays.stream(outerData).map(DataReportSeriesItem::getType).collect(Collectors.toList()))
|
||||||
.contains("0.0.0", "0.0.1");
|
.contains("0.0.0", "0.0.1");
|
||||||
|
|
||||||
} else if (dataReportSeriesItem.getType().equals("ds2")) {
|
} else if (dataReportSeriesItem.getType().equals("ds2")) {
|
||||||
assertThat(dataReportSeriesItem.getData()).isEqualTo(1L);
|
assertThat(dataReportSeriesItem.getData()).as("Total count of DistributionSet 2 in statistics")
|
||||||
|
.isEqualTo(1L);
|
||||||
final DataReportSeriesItem<String>[] outerData = innerOuterDataReportSeries.getOuterSeries().getData();
|
final DataReportSeriesItem<String>[] outerData = innerOuterDataReportSeries.getOuterSeries().getData();
|
||||||
assertThat(outerData).hasSize(1);
|
assertThat(outerData).hasSize(1);
|
||||||
assertThat(outerData[0].getType()).isEqualTo("0.0.2");
|
assertThat(outerData[0].getType()).as("Version/Item type of DistributionSet 2 in statistics")
|
||||||
|
.isEqualTo("0.0.2");
|
||||||
|
|
||||||
} else if (dataReportSeriesItem.getType().equals("ds3")) {
|
} else if (dataReportSeriesItem.getType().equals("ds3")) {
|
||||||
assertThat(dataReportSeriesItem.getData()).isEqualTo(0L);
|
assertThat(dataReportSeriesItem.getData()).as("Total count of DistributionSet 3 in statistics")
|
||||||
|
.isEqualTo(0L);
|
||||||
final DataReportSeriesItem<String>[] outerData = innerOuterDataReportSeries.getOuterSeries().getData();
|
final DataReportSeriesItem<String>[] outerData = innerOuterDataReportSeries.getOuterSeries().getData();
|
||||||
assertThat(outerData).hasSize(1);
|
assertThat(outerData).hasSize(1);
|
||||||
assertThat(outerData[0].getType()).isEqualTo("0.0.3");
|
assertThat(outerData[0].getType()).as("Version/Item type of DistributionSet 3 in statistics")
|
||||||
|
.isEqualTo("0.0.3");
|
||||||
} else {
|
} else {
|
||||||
fail("no assertion count for distribution set " + dataReportSeriesItem.getType());
|
fail("no assertion count for distribution set " + dataReportSeriesItem.getType());
|
||||||
}
|
}
|
||||||
@@ -402,7 +423,8 @@ public class ReportManagementTest extends AbstractIntegrationTest {
|
|||||||
final DataReportSeriesItem<String> dataReportSeriesItem = innerOuterDataReportSeries.getInnerSeries()
|
final DataReportSeriesItem<String> dataReportSeriesItem = innerOuterDataReportSeries.getInnerSeries()
|
||||||
.getData()[0];
|
.getData()[0];
|
||||||
if (dataReportSeriesItem.getType().equals("ds1")) {
|
if (dataReportSeriesItem.getType().equals("ds1")) {
|
||||||
assertThat(dataReportSeriesItem.getData()).isEqualTo(4L);
|
assertThat(dataReportSeriesItem.getData()).as("Total count of DistributionSet 1 in statistics")
|
||||||
|
.isEqualTo(4L);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -435,29 +457,24 @@ public class ReportManagementTest extends AbstractIntegrationTest {
|
|||||||
DataReportSeries<SeriesTime> targetsNotLastPoll = reportManagement.targetsLastPoll();
|
DataReportSeries<SeriesTime> targetsNotLastPoll = reportManagement.targetsLastPoll();
|
||||||
DataReportSeriesItem<SeriesTime>[] data = targetsNotLastPoll.getData();
|
DataReportSeriesItem<SeriesTime>[] data = targetsNotLastPoll.getData();
|
||||||
|
|
||||||
// for( final DataReportSeriesItem<SeriesTime> dataReportSeriesItem :
|
|
||||||
// data ) {
|
|
||||||
// System.out.println( dataReportSeriesItem.getData() );
|
|
||||||
// }
|
|
||||||
|
|
||||||
// --- Verfiy ---
|
// --- Verfiy ---
|
||||||
|
|
||||||
// verify hour
|
// verify hour
|
||||||
assertThat(data[0].getType()).isEqualTo(SeriesTime.HOUR);
|
assertThat(data[0].getType()).as("Series time").isEqualTo(SeriesTime.HOUR);
|
||||||
assertThat(data[0].getData()).isEqualTo((long) knownTargetsPollLastHour);
|
assertThat(data[0].getData()).as("Targets poll last hour").isEqualTo((long) knownTargetsPollLastHour);
|
||||||
// verify day
|
// verify day
|
||||||
assertThat(data[1].getType()).isEqualTo(SeriesTime.DAY);
|
assertThat(data[1].getType()).as("Series time").isEqualTo(SeriesTime.DAY);
|
||||||
assertThat(data[1].getData()).isEqualTo((long) knownTargetsPollLastDay);
|
assertThat(data[1].getData()).as("Targets poll last day").isEqualTo((long) knownTargetsPollLastDay);
|
||||||
// verify week
|
// verify week
|
||||||
assertThat(data[2].getType()).isEqualTo(SeriesTime.WEEK);
|
assertThat(data[2].getType()).as("Series time").isEqualTo(SeriesTime.WEEK);
|
||||||
assertThat(data[2].getData()).isEqualTo((long) knownTargetsPollLastWeek);
|
assertThat(data[2].getData()).as("Targets poll last week").isEqualTo((long) knownTargetsPollLastWeek);
|
||||||
|
|
||||||
// test cache evict
|
// test cache evict
|
||||||
createTargets("hourPoll2", knownTargetsPollLastHour, now.minusMinutes(59));
|
createTargets("hourPoll2", knownTargetsPollLastHour, now.minusMinutes(59));
|
||||||
targetsNotLastPoll = reportManagement.targetsLastPoll();
|
targetsNotLastPoll = reportManagement.targetsLastPoll();
|
||||||
data = targetsNotLastPoll.getData();
|
data = targetsNotLastPoll.getData();
|
||||||
assertThat(data[0].getType()).isEqualTo(SeriesTime.HOUR);
|
assertThat(data[0].getType()).as("Series time").isEqualTo(SeriesTime.HOUR);
|
||||||
assertThat(data[0].getData()).isEqualTo((long) knownTargetsPollLastHour * 2);
|
assertThat(data[0].getData()).as("Targets poll last hour").isEqualTo((long) knownTargetsPollLastHour * 2);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ package org.eclipse.hawkbit.repository;
|
|||||||
|
|
||||||
import static org.fest.assertions.api.Assertions.assertThat;
|
import static org.fest.assertions.api.Assertions.assertThat;
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertNotEquals;
|
|
||||||
import static org.junit.Assert.assertNotNull;
|
import static org.junit.Assert.assertNotNull;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
import static org.junit.Assert.fail;
|
import static org.junit.Assert.fail;
|
||||||
@@ -26,6 +25,7 @@ import java.util.Set;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import javax.persistence.Query;
|
import javax.persistence.Query;
|
||||||
|
import javax.validation.ConstraintViolationException;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.AbstractIntegrationTest;
|
import org.eclipse.hawkbit.AbstractIntegrationTest;
|
||||||
import org.eclipse.hawkbit.TestDataUtil;
|
import org.eclipse.hawkbit.TestDataUtil;
|
||||||
@@ -65,6 +65,24 @@ public class TargetManagementTest extends AbstractIntegrationTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Description("Verify that a target with empty controller id cannot be created")
|
||||||
|
public void createTargetWithNoControllerId() {
|
||||||
|
try {
|
||||||
|
targetManagement.createTarget(new Target(""));
|
||||||
|
fail("target with empty controller id should not be created");
|
||||||
|
} catch (final ConstraintViolationException e) {
|
||||||
|
// ok
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
targetManagement.createTarget(new Target(null));
|
||||||
|
fail("target with empty controller id should not be created");
|
||||||
|
} catch (final ConstraintViolationException e) {
|
||||||
|
// ok
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Ensures that targets can assigned and unassigned to a target tag. Not exists target will be ignored for the assignment.")
|
@Description("Ensures that targets can assigned and unassigned to a target tag. Not exists target will be ignored for the assignment.")
|
||||||
public void assignAndUnassignTargetsToTag() {
|
public void assignAndUnassignTargetsToTag() {
|
||||||
@@ -226,10 +244,10 @@ public class TargetManagementTest extends AbstractIntegrationTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (strict) {
|
if (strict) {
|
||||||
fail();
|
fail("Target does not contain all tags");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fail();
|
fail("Target does not contain any tags or the expected tag was not found");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -240,7 +258,7 @@ public class TargetManagementTest extends AbstractIntegrationTest {
|
|||||||
for (final Tag tag : tags) {
|
for (final Tag tag : tags) {
|
||||||
for (final Tag tt : t.getTags()) {
|
for (final Tag tt : t.getTags()) {
|
||||||
if (tag.getName().equals(tt.getName())) {
|
if (tag.getName().equals(tt.getName())) {
|
||||||
fail();
|
fail("Target should have no tags");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -256,30 +274,33 @@ public class TargetManagementTest extends AbstractIntegrationTest {
|
|||||||
final Target target = TestDataUtil.buildTargetFixture(myCtrlID, "the description!");
|
final Target target = TestDataUtil.buildTargetFixture(myCtrlID, "the description!");
|
||||||
|
|
||||||
Target savedTarget = targetManagement.createTarget(target);
|
Target savedTarget = targetManagement.createTarget(target);
|
||||||
assertNotNull(savedTarget);
|
assertNotNull("The target should not be null", savedTarget);
|
||||||
final Long createdAt = savedTarget.getCreatedAt();
|
final Long createdAt = savedTarget.getCreatedAt();
|
||||||
Long modifiedAt = savedTarget.getLastModifiedAt();
|
Long modifiedAt = savedTarget.getLastModifiedAt();
|
||||||
assertEquals(createdAt, modifiedAt);
|
|
||||||
assertNotNull(savedTarget.getCreatedAt());
|
assertThat(createdAt).as("CreatedAt compared with modifiedAt").isEqualTo(modifiedAt);
|
||||||
assertNotNull(savedTarget.getLastModifiedAt());
|
assertNotNull("The createdAt attribut of the target should no be null", savedTarget.getCreatedAt());
|
||||||
assertEquals(target, savedTarget);
|
assertNotNull("The lastModifiedAt attribut of the target should no be null", savedTarget.getLastModifiedAt());
|
||||||
|
assertThat(target).as("Target compared with saved target").isEqualTo(savedTarget);
|
||||||
|
|
||||||
savedTarget.setDescription("changed description");
|
savedTarget.setDescription("changed description");
|
||||||
Thread.sleep(1);
|
Thread.sleep(1);
|
||||||
savedTarget = targetManagement.updateTarget(savedTarget);
|
savedTarget = targetManagement.updateTarget(savedTarget);
|
||||||
|
assertNotNull("The lastModifiedAt attribute of the target should not be null", savedTarget.getLastModifiedAt());
|
||||||
assertNotNull(savedTarget.getLastModifiedAt());
|
assertThat(createdAt).as("CreatedAt compared with saved modifiedAt")
|
||||||
assertNotEquals(createdAt, savedTarget.getLastModifiedAt());
|
.isNotEqualTo(savedTarget.getLastModifiedAt());
|
||||||
assertNotEquals(modifiedAt, savedTarget.getLastModifiedAt());
|
assertThat(modifiedAt).as("ModifiedAt compared with saved modifiedAt")
|
||||||
|
.isNotEqualTo(savedTarget.getLastModifiedAt());
|
||||||
modifiedAt = savedTarget.getLastModifiedAt();
|
modifiedAt = savedTarget.getLastModifiedAt();
|
||||||
|
|
||||||
final Target foundTarget = targetManagement.findTargetByControllerID(savedTarget.getControllerId());
|
final Target foundTarget = targetManagement.findTargetByControllerID(savedTarget.getControllerId());
|
||||||
|
assertNotNull("The target should not be null", foundTarget);
|
||||||
assertNotNull(foundTarget);
|
assertThat(myCtrlID).as("ControllerId compared with saved controllerId")
|
||||||
assertEquals(myCtrlID, foundTarget.getControllerId());
|
.isEqualTo(foundTarget.getControllerId());
|
||||||
assertEquals(savedTarget, foundTarget);
|
assertThat(savedTarget).as("Target compared with saved target").isEqualTo(foundTarget);
|
||||||
assertEquals(createdAt, foundTarget.getCreatedAt());
|
assertThat(createdAt).as("CreatedAt compared with saved createdAt").isEqualTo(foundTarget.getCreatedAt());
|
||||||
assertEquals(modifiedAt, foundTarget.getLastModifiedAt());
|
assertThat(modifiedAt).as("LastModifiedAt compared with saved lastModifiedAt")
|
||||||
|
.isEqualTo(foundTarget.getLastModifiedAt());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -296,8 +317,11 @@ public class TargetManagementTest extends AbstractIntegrationTest {
|
|||||||
final Target savedExtra = targetManagement.createTarget(extra);
|
final Target savedExtra = targetManagement.createTarget(extra);
|
||||||
|
|
||||||
Iterable<Target> allFound = targetRepository.findAll();
|
Iterable<Target> allFound = targetRepository.findAll();
|
||||||
assertEquals(firstList.size(), firstSaved.spliterator().getExactSizeIfKnown());
|
|
||||||
assertEquals(firstList.size() + 1, allFound.spliterator().getExactSizeIfKnown());
|
assertThat(Long.valueOf(firstList.size())).as("List size of targets")
|
||||||
|
.isEqualTo(firstSaved.spliterator().getExactSizeIfKnown());
|
||||||
|
assertThat(Long.valueOf(firstList.size() + 1)).as("LastModifiedAt compared with saved lastModifiedAt")
|
||||||
|
.isEqualTo(allFound.spliterator().getExactSizeIfKnown());
|
||||||
|
|
||||||
// change the objects and save to again to trigger a change on
|
// change the objects and save to again to trigger a change on
|
||||||
// lastModifiedAt
|
// lastModifiedAt
|
||||||
@@ -308,18 +332,23 @@ public class TargetManagementTest extends AbstractIntegrationTest {
|
|||||||
_founds: for (final Target foundTarget : allFound) {
|
_founds: for (final Target foundTarget : allFound) {
|
||||||
for (final Target changedTarget : firstSaved) {
|
for (final Target changedTarget : firstSaved) {
|
||||||
if (changedTarget.getControllerId().equals(foundTarget.getControllerId())) {
|
if (changedTarget.getControllerId().equals(foundTarget.getControllerId())) {
|
||||||
assertEquals(changedTarget.getDescription(), foundTarget.getDescription());
|
assertThat(changedTarget.getDescription())
|
||||||
assertTrue(changedTarget.getName().startsWith(foundTarget.getName()));
|
.as("Description of changed target compared with description saved target")
|
||||||
assertTrue(changedTarget.getName().endsWith("changed"));
|
.isEqualTo(foundTarget.getDescription());
|
||||||
assertEquals(changedTarget.getCreatedAt(), foundTarget.getCreatedAt());
|
assertThat(changedTarget.getName()).as("Name of changed target starts with name of saved target")
|
||||||
assertThat(changedTarget.getLastModifiedAt()).isNotEqualTo(changedTarget.getCreatedAt());
|
.startsWith(foundTarget.getName());
|
||||||
|
assertThat(changedTarget.getName()).as("Name of changed target ends with 'changed'")
|
||||||
|
.endsWith("changed");
|
||||||
|
assertThat(changedTarget.getCreatedAt()).as("CreatedAt compared with saved createdAt")
|
||||||
|
.isEqualTo(foundTarget.getCreatedAt());
|
||||||
|
assertThat(changedTarget.getLastModifiedAt()).as("LastModifiedAt compared with saved createdAt")
|
||||||
|
.isNotEqualTo(changedTarget.getCreatedAt());
|
||||||
continue _founds;
|
continue _founds;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!foundTarget.getControllerId().equals(savedExtra.getControllerId())) {
|
if (!foundTarget.getControllerId().equals(savedExtra.getControllerId())) {
|
||||||
fail();
|
fail("The controllerId of the found target is not equal to the controllerId of the saved target");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -341,8 +370,8 @@ public class TargetManagementTest extends AbstractIntegrationTest {
|
|||||||
targetManagement.deleteTargets(deletedTargetIDs);
|
targetManagement.deleteTargets(deletedTargetIDs);
|
||||||
|
|
||||||
allFound = targetManagement.findTargetsAll(new PageRequest(0, 200)).getContent();
|
allFound = targetManagement.findTargetsAll(new PageRequest(0, 200)).getContent();
|
||||||
assertEquals(firstSaved.spliterator().getExactSizeIfKnown() - nr2Del,
|
assertThat(firstSaved.spliterator().getExactSizeIfKnown() - nr2Del).as("Size of splited list")
|
||||||
allFound.spliterator().getExactSizeIfKnown());
|
.isEqualTo(allFound.spliterator().getExactSizeIfKnown());
|
||||||
|
|
||||||
// verify that all undeleted are still found
|
// verify that all undeleted are still found
|
||||||
assertThat(allFound).doesNotContain(deletedTargets);
|
assertThat(allFound).doesNotContain(deletedTargets);
|
||||||
@@ -376,15 +405,26 @@ public class TargetManagementTest extends AbstractIntegrationTest {
|
|||||||
}
|
}
|
||||||
final Query qry = entityManager.createNativeQuery("select * from sp_target_attributes ta");
|
final Query qry = entityManager.createNativeQuery("select * from sp_target_attributes ta");
|
||||||
final List result = qry.getResultList();
|
final List result = qry.getResultList();
|
||||||
assertEquals(attribs.size() * ts.spliterator().getExactSizeIfKnown(), result.size());
|
|
||||||
|
assertThat(attribs.size() * ts.spliterator().getExactSizeIfKnown()).as("Amount of all target attributes")
|
||||||
|
.isEqualTo(result.size());
|
||||||
|
|
||||||
for (final Target myT : ts) {
|
for (final Target myT : ts) {
|
||||||
final Target t = targetManagement.findTargetByControllerIDWithDetails(myT.getControllerId());
|
final Target t = targetManagement.findTargetByControllerIDWithDetails(myT.getControllerId());
|
||||||
assertEquals(attribs.size(), t.getTargetInfo().getControllerAttributes().size());
|
assertThat(attribs.size()).as("Amount of target attributes per target")
|
||||||
|
.isEqualTo(t.getTargetInfo().getControllerAttributes().size());
|
||||||
|
|
||||||
for (final Entry<String, String> ca : t.getTargetInfo().getControllerAttributes().entrySet()) {
|
for (final Entry<String, String> ca : t.getTargetInfo().getControllerAttributes().entrySet()) {
|
||||||
assertTrue(attribs.containsKey(ca.getKey()));
|
assertTrue("Attributes list does not contain target attribute key", attribs.containsKey(ca.getKey()));
|
||||||
// has the same value: see string concatenation above
|
// has the same value: see string concatenation above
|
||||||
assertEquals(String.format("%s-%s", attribs.get(ca.getKey()), t.getControllerId()), ca.getValue());
|
// assertThat(String.format("%s-%s",
|
||||||
|
// attribs.get(ca.getKey()))).as("Value of string
|
||||||
|
// concatenation")
|
||||||
|
// .isEqualTo(ca.getValue());
|
||||||
|
|
||||||
|
assertEquals("The value of the string concatenation is not equal to the value of the target attributes",
|
||||||
|
String.format("%s-%s", attribs.get(ca.getKey()), t.getControllerId()), ca.getValue());
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -656,9 +696,8 @@ public class TargetManagementTest extends AbstractIntegrationTest {
|
|||||||
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, Boolean.TRUE, tagNames).getContent();
|
||||||
|
|
||||||
// Total targets
|
assertThat(50).as("Total targets").isEqualTo(targetManagement.findAllTargetIds().size());
|
||||||
assertEquals(50, targetManagement.findAllTargetIds().size());
|
assertThat(25).as("Targets with no tag").isEqualTo(targetsListWithNoTag.size());
|
||||||
// Targets with no tag
|
|
||||||
assertEquals(25, targetsListWithNoTag.size());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -114,8 +114,9 @@ public class RSQLTargetFieldTest extends AbstractIntegrationTest {
|
|||||||
assertRSQLQuery(TargetFields.UPDATESTATUS.name() + "!=pending", 3);
|
assertRSQLQuery(TargetFields.UPDATESTATUS.name() + "!=pending", 3);
|
||||||
try {
|
try {
|
||||||
assertRSQLQuery(TargetFields.UPDATESTATUS.name() + "==noExist*", 0);
|
assertRSQLQuery(TargetFields.UPDATESTATUS.name() + "==noExist*", 0);
|
||||||
fail();
|
fail("RSQLParameterUnsupportedFieldException was expected since update status unknown");
|
||||||
} catch (final RSQLParameterUnsupportedFieldException e) {
|
} catch (final RSQLParameterUnsupportedFieldException e) {
|
||||||
|
// test ok - exception was excepted
|
||||||
}
|
}
|
||||||
assertRSQLQuery(TargetFields.UPDATESTATUS.name() + "=in=(pending,error)", 1);
|
assertRSQLQuery(TargetFields.UPDATESTATUS.name() + "=in=(pending,error)", 1);
|
||||||
assertRSQLQuery(TargetFields.UPDATESTATUS.name() + "=out=(pending,error)", 3);
|
assertRSQLQuery(TargetFields.UPDATESTATUS.name() + "=out=(pending,error)", 3);
|
||||||
|
|||||||
@@ -57,9 +57,6 @@ import ru.yandex.qatools.allure.annotations.Stories;
|
|||||||
/**
|
/**
|
||||||
* Test artifact downloads from the controller.
|
* Test artifact downloads from the controller.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ActiveProfiles({ "im", "test" })
|
@ActiveProfiles({ "im", "test" })
|
||||||
@@ -285,7 +282,8 @@ public class ArtifactDownloadTest extends AbstractIntegrationTestWithMongoDB {
|
|||||||
.andExpect(header().string("Content-Disposition", "attachment;filename=" + artifact.getFilename()))
|
.andExpect(header().string("Content-Disposition", "attachment;filename=" + artifact.getFilename()))
|
||||||
.andReturn();
|
.andReturn();
|
||||||
|
|
||||||
assertTrue(Arrays.equals(result.getResponse().getContentAsByteArray(), random));
|
assertTrue("The same file that was uploaded is expected when downloaded",
|
||||||
|
Arrays.equals(result.getResponse().getContentAsByteArray(), random));
|
||||||
|
|
||||||
// download complete
|
// download complete
|
||||||
assertThat(downLoadProgress).isEqualTo(10);
|
assertThat(downLoadProgress).isEqualTo(10);
|
||||||
@@ -393,7 +391,8 @@ public class ArtifactDownloadTest extends AbstractIntegrationTestWithMongoDB {
|
|||||||
.andExpect(header().longValue("Last-Modified", artifact.getCreatedAt()))
|
.andExpect(header().longValue("Last-Modified", artifact.getCreatedAt()))
|
||||||
.andExpect(header().string("Content-Disposition", "attachment;filename=file1")).andReturn();
|
.andExpect(header().string("Content-Disposition", "attachment;filename=file1")).andReturn();
|
||||||
|
|
||||||
assertTrue(Arrays.equals(result.getResponse().getContentAsByteArray(), random));
|
assertTrue("The same file that was uploaded is expected when downloaded",
|
||||||
|
Arrays.equals(result.getResponse().getContentAsByteArray(), random));
|
||||||
|
|
||||||
// one (update) action
|
// one (update) action
|
||||||
assertThat(actionRepository.findByTargetAndDistributionSet(pageReq, target, ds).getContent()).hasSize(1);
|
assertThat(actionRepository.findByTargetAndDistributionSet(pageReq, target, ds).getContent()).hasSize(1);
|
||||||
|
|||||||
@@ -8,7 +8,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.rest.resource;
|
package org.eclipse.hawkbit.rest.resource;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.fest.assertions.api.Assertions.assertThat;
|
||||||
|
import static org.junit.Assert.fail;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -16,9 +17,15 @@ import org.eclipse.hawkbit.repository.TargetFields;
|
|||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.springframework.data.domain.Sort.Order;
|
import org.springframework.data.domain.Sort.Order;
|
||||||
|
|
||||||
|
import ru.yandex.qatools.allure.annotations.Description;
|
||||||
|
import ru.yandex.qatools.allure.annotations.Features;
|
||||||
|
import ru.yandex.qatools.allure.annotations.Stories;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@Features("Component Tests - Management RESTful API")
|
||||||
|
@Stories("Sorting parameter")
|
||||||
public class SortUtilityTest {
|
public class SortUtilityTest {
|
||||||
private static final String SORT_PARAM_1 = "NAME:ASC";
|
private static final String SORT_PARAM_1 = "NAME:ASC";
|
||||||
private static final String SORT_PARAM_2 = "NAME:ASC, DESCRIPTION:DESC";
|
private static final String SORT_PARAM_2 = "NAME:ASC, DESCRIPTION:DESC";
|
||||||
@@ -29,36 +36,55 @@ public class SortUtilityTest {
|
|||||||
private static final String WRONG_FIELD_PARAM = "ASDF:ASC";
|
private static final String WRONG_FIELD_PARAM = "ASDF:ASC";
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@Description("Ascending sorting based on name.")
|
||||||
public void parseSortParam1() {
|
public void parseSortParam1() {
|
||||||
|
|
||||||
final List<Order> parse = SortUtility.parse(TargetFields.class, SORT_PARAM_1);
|
final List<Order> parse = SortUtility.parse(TargetFields.class, SORT_PARAM_1);
|
||||||
assertEquals(1, parse.size());
|
assertThat(1).as("Count of parsing parameter").isEqualTo(parse.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@Description("Ascending sorting based on name and descending sorting based on description.")
|
||||||
public void parseSortParam2() {
|
public void parseSortParam2() {
|
||||||
final List<Order> parse = SortUtility.parse(TargetFields.class, SORT_PARAM_2);
|
final List<Order> parse = SortUtility.parse(TargetFields.class, SORT_PARAM_2);
|
||||||
assertEquals(2, parse.size());
|
assertThat(2).as("Count of parsing parameter").isEqualTo(parse.size());
|
||||||
}
|
|
||||||
|
|
||||||
@Test(expected = SortParameterSyntaxErrorException.class)
|
|
||||||
public void parseWrongSyntaxParam() {
|
|
||||||
SortUtility.parse(TargetFields.class, SYNTAX_FAILURE_SORT_PARAM);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@Description("Sorting with wrong syntax leads to SortParameterSyntaxErrorException.")
|
||||||
|
public void parseWrongSyntaxParam() {
|
||||||
|
try {
|
||||||
|
SortUtility.parse(TargetFields.class, SYNTAX_FAILURE_SORT_PARAM);
|
||||||
|
fail("SortParameterSyntaxErrorException expected because of wrong syntax");
|
||||||
|
} catch (final SortParameterSyntaxErrorException e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Description("Sorting based on name with case sensitive is possible.")
|
||||||
public void parsingIsNotCaseSensitive() {
|
public void parsingIsNotCaseSensitive() {
|
||||||
SortUtility.parse(TargetFields.class, CASE_INSENSITIVE_DIRECTION_PARAM);
|
SortUtility.parse(TargetFields.class, CASE_INSENSITIVE_DIRECTION_PARAM);
|
||||||
SortUtility.parse(TargetFields.class, CASE_INSENSITIVE_DIRECTION_PARAM_1);
|
SortUtility.parse(TargetFields.class, CASE_INSENSITIVE_DIRECTION_PARAM_1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = SortParameterUnsupportedDirectionException.class)
|
@Test
|
||||||
|
@Description("Sorting with unknown direction order leads to SortParameterUnsupportedDirectionException.")
|
||||||
public void parseWrongDirectionParam() {
|
public void parseWrongDirectionParam() {
|
||||||
SortUtility.parse(TargetFields.class, WRONG_DIRECTION_PARAM);
|
try {
|
||||||
|
SortUtility.parse(TargetFields.class, WRONG_DIRECTION_PARAM);
|
||||||
|
fail("SortParameterUnsupportedDirectionException expected because of unknown direction order");
|
||||||
|
} catch (final SortParameterUnsupportedDirectionException e) {
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = SortParameterUnsupportedFieldException.class)
|
@Test
|
||||||
|
@Description("Sorting with unknown field leads to SortParameterUnsupportedFieldException.")
|
||||||
public void parseWrongFieldParam() {
|
public void parseWrongFieldParam() {
|
||||||
SortUtility.parse(TargetFields.class, WRONG_FIELD_PARAM);
|
try {
|
||||||
|
SortUtility.parse(TargetFields.class, WRONG_FIELD_PARAM);
|
||||||
|
fail("SortParameterUnsupportedFieldException expected because of unknown field");
|
||||||
|
} catch (final SortParameterUnsupportedFieldException e) {
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.ui.artifacts.footer;
|
package org.eclipse.hawkbit.ui.artifacts.footer;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
import javax.annotation.PostConstruct;
|
||||||
@@ -21,6 +22,7 @@ import org.eclipse.hawkbit.ui.common.footer.AbstractDeleteActionsLayout;
|
|||||||
import org.eclipse.hawkbit.ui.management.event.DragEvent;
|
import org.eclipse.hawkbit.ui.management.event.DragEvent;
|
||||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
import org.eclipse.hawkbit.ui.utils.I18N;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
|
import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
|
||||||
|
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
||||||
import org.eclipse.hawkbit.ui.utils.UINotification;
|
import org.eclipse.hawkbit.ui.utils.UINotification;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -36,6 +38,7 @@ import com.vaadin.ui.Component;
|
|||||||
import com.vaadin.ui.Label;
|
import com.vaadin.ui.Label;
|
||||||
import com.vaadin.ui.Table;
|
import com.vaadin.ui.Table;
|
||||||
import com.vaadin.ui.UI;
|
import com.vaadin.ui.UI;
|
||||||
|
import com.vaadin.ui.Table.TableTransferable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Upload view footer layout implementation.
|
* Upload view footer layout implementation.
|
||||||
@@ -196,7 +199,7 @@ public class SMDeleteActionsLayout extends AbstractDeleteActionsLayout {
|
|||||||
final Component sourceComponent = event.getTransferable().getSourceComponent();
|
final Component sourceComponent = event.getTransferable().getSourceComponent();
|
||||||
if (sourceComponent instanceof Table) {
|
if (sourceComponent instanceof Table) {
|
||||||
final Table sourceTable = (Table) event.getTransferable().getSourceComponent();
|
final Table sourceTable = (Table) event.getTransferable().getSourceComponent();
|
||||||
addToDeleteList(sourceTable);
|
addToDeleteList(sourceTable,(TableTransferable) event.getTransferable());
|
||||||
updateSWActionCount();
|
updateSWActionCount();
|
||||||
}
|
}
|
||||||
if (sourceComponent.getId().startsWith(SPUIComponetIdProvider.UPLOAD_TYPE_BUTTON_PREFIX)) {
|
if (sourceComponent.getId().startsWith(SPUIComponetIdProvider.UPLOAD_TYPE_BUTTON_PREFIX)) {
|
||||||
@@ -221,9 +224,16 @@ public class SMDeleteActionsLayout extends AbstractDeleteActionsLayout {
|
|||||||
artifactUploadState.getSelectedDeleteSWModuleTypes().add(swModuleTypeName);
|
artifactUploadState.getSelectedDeleteSWModuleTypes().add(swModuleTypeName);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addToDeleteList(final Table sourceTable) {
|
private void addToDeleteList(final Table sourceTable, final TableTransferable transferable) {
|
||||||
final Set<Long> swModuleIds = (Set<Long>) sourceTable.getValue();
|
@SuppressWarnings("unchecked")
|
||||||
swModuleIds.forEach(id -> {
|
final Set<Long> swModuleSelected = (Set<Long>) sourceTable.getValue();
|
||||||
|
final Set<Long> swModuleIdNameSet = new HashSet<Long>();
|
||||||
|
if (!swModuleSelected.contains(transferable.getData(SPUIDefinitions.ITEMID))) {
|
||||||
|
swModuleIdNameSet.add((Long) transferable.getData(SPUIDefinitions.ITEMID));
|
||||||
|
} else {
|
||||||
|
swModuleIdNameSet.addAll(swModuleSelected);
|
||||||
|
}
|
||||||
|
swModuleIdNameSet.forEach(id -> {
|
||||||
final String swModuleName = (String) sourceTable.getContainerDataSource().getItem(id)
|
final String swModuleName = (String) sourceTable.getContainerDataSource().getItem(id)
|
||||||
.getItemProperty(SPUILabelDefinitions.NAME_VERSION).getValue();
|
.getItemProperty(SPUILabelDefinitions.NAME_VERSION).getValue();
|
||||||
artifactUploadState.getDeleteSofwareModules().put(id, swModuleName);
|
artifactUploadState.getDeleteSofwareModules().put(id, swModuleName);
|
||||||
|
|||||||
@@ -8,8 +8,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.ui.filtermanagement;
|
package org.eclipse.hawkbit.ui.filtermanagement;
|
||||||
|
|
||||||
|
|
||||||
import java.awt.event.FocusListener;
|
|
||||||
import java.util.concurrent.Executor;
|
import java.util.concurrent.Executor;
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
import javax.annotation.PostConstruct;
|
||||||
@@ -149,19 +147,17 @@ public class CreateOrUpdateFilterHeader extends VerticalLayout implements Button
|
|||||||
}
|
}
|
||||||
|
|
||||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||||
void onEvent(final CustomFilterUIEvent custFUIEvent) {
|
void onEvent(final CustomFilterUIEvent custFUIEvent) {
|
||||||
if (custFUIEvent == CustomFilterUIEvent.TARGET_FILTER_DETAIL_VIEW) {
|
if (custFUIEvent == CustomFilterUIEvent.TARGET_FILTER_DETAIL_VIEW) {
|
||||||
populateComponents();
|
populateComponents();
|
||||||
eventBus.publish(this, CustomFilterUIEvent.TARGET_DETAILS_VIEW);
|
eventBus.publish(this, CustomFilterUIEvent.TARGET_DETAILS_VIEW);
|
||||||
} else if (custFUIEvent == CustomFilterUIEvent.CREATE_NEW_FILTER_CLICK) {
|
} else if (custFUIEvent == CustomFilterUIEvent.CREATE_NEW_FILTER_CLICK) {
|
||||||
setUpCaptionLayout(true);
|
setUpCaptionLayout(true);
|
||||||
resetComponents();
|
resetComponents();
|
||||||
} else if (custFUIEvent == CustomFilterUIEvent.TARGET_FILTER_STATUS_HIDE) {
|
} else if (custFUIEvent == CustomFilterUIEvent.UPDATE_TARGET_FILTER_SEARCH_ICON) {
|
||||||
this.getUI().access(() -> updateStatusIconAfterTablePopulated());
|
UI.getCurrent().access(() -> updateStatusIconAfterTablePopulated());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void populateComponents() {
|
private void populateComponents() {
|
||||||
if (filterManagementUIState.getTfQuery().isPresent()) {
|
if (filterManagementUIState.getTfQuery().isPresent()) {
|
||||||
@@ -221,7 +217,6 @@ public class CreateOrUpdateFilterHeader extends VerticalLayout implements Button
|
|||||||
closeIcon = createSearchResetIcon();
|
closeIcon = createSearchResetIcon();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private TextField createNameTextField() {
|
private TextField createNameTextField() {
|
||||||
final TextField nameField = SPUIComponentProvider.getTextField("", ValoTheme.TEXTFIELD_TINY, false, null,
|
final TextField nameField = SPUIComponentProvider.getTextField("", ValoTheme.TEXTFIELD_TINY, false, null,
|
||||||
i18n.get("textfield.customfiltername"), true, SPUILabelDefinitions.TEXT_FIELD_MAX_LENGTH);
|
i18n.get("textfield.customfiltername"), true, SPUILabelDefinitions.TEXT_FIELD_MAX_LENGTH);
|
||||||
@@ -331,22 +326,28 @@ public class CreateOrUpdateFilterHeader extends VerticalLayout implements Button
|
|||||||
validationIcon.addStyleName("show-status-label");
|
validationIcon.addStyleName("show-status-label");
|
||||||
showValidationInProgress();
|
showValidationInProgress();
|
||||||
onQueryChange(event.getText());
|
onQueryChange(event.getText());
|
||||||
executor.execute(new StatusCircledAsync());
|
executor.execute(new StatusCircledAsync(UI.getCurrent()));
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
class StatusCircledAsync implements Runnable {
|
class StatusCircledAsync implements Runnable {
|
||||||
|
private final UI current;
|
||||||
|
|
||||||
|
public StatusCircledAsync(final UI current) {
|
||||||
|
this.current = current;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
UI.setCurrent(current);
|
||||||
eventBus.publish(this, CustomFilterUIEvent.FILTER_TARGET_BY_QUERY);
|
eventBus.publish(this, CustomFilterUIEvent.FILTER_TARGET_BY_QUERY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onQueryChange(final String text) {
|
private void onQueryChange(final String input) {
|
||||||
if (!Strings.isNullOrEmpty(text)) {
|
if (!Strings.isNullOrEmpty(input)) {
|
||||||
final String input = text.toLowerCase();
|
|
||||||
final ValidationResult validationResult = FilterQueryValidation.getExpectedTokens(input);
|
final ValidationResult validationResult = FilterQueryValidation.getExpectedTokens(input);
|
||||||
if (!validationResult.getIsValidationFailed()) {
|
if (!validationResult.getIsValidationFailed()) {
|
||||||
filterManagementUIState.setFilterQueryValue(input);
|
filterManagementUIState.setFilterQueryValue(input);
|
||||||
@@ -361,17 +362,16 @@ public class CreateOrUpdateFilterHeader extends VerticalLayout implements Button
|
|||||||
}
|
}
|
||||||
enableDisableSaveButton(validationFailed, input);
|
enableDisableSaveButton(validationFailed, input);
|
||||||
} else {
|
} else {
|
||||||
setInitialStatusIconStyle(validationIcon);
|
setInitialStatusIconStyle(validationIcon);
|
||||||
filterManagementUIState.setFilterQueryValue(null);
|
filterManagementUIState.setFilterQueryValue(null);
|
||||||
filterManagementUIState.setIsFilterByInvalidFilterQuery(Boolean.TRUE);
|
filterManagementUIState.setIsFilterByInvalidFilterQuery(Boolean.TRUE);
|
||||||
}
|
}
|
||||||
queryTextField.setValue(text);
|
queryTextField.setValue(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void enableDisableSaveButton(final boolean validationFailed, final String query) {
|
private void enableDisableSaveButton(final boolean validationFailed, final String query) {
|
||||||
if (validationFailed
|
if (validationFailed || (isNameAndQueryEmpty(nameTextField.getValue(), query)
|
||||||
|| (isNameAndQueryEmpty(nameTextField.getValue(), query) || (query.equals(oldFilterQuery) && nameTextField
|
|| (query.equals(oldFilterQuery) && nameTextField.getValue().equals(oldFilterName)))) {
|
||||||
.getValue().equals(oldFilterName)))) {
|
|
||||||
saveButton.setEnabled(false);
|
saveButton.setEnabled(false);
|
||||||
} else {
|
} else {
|
||||||
if (hasSavePermission()) {
|
if (hasSavePermission()) {
|
||||||
@@ -387,10 +387,9 @@ public class CreateOrUpdateFilterHeader extends VerticalLayout implements Button
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void showValidationSuccesIcon() {
|
private void showValidationSuccesIcon() {
|
||||||
validationIcon.setValue(FontAwesome.CHECK_CIRCLE.getHtml());
|
validationIcon.setValue(FontAwesome.CHECK_CIRCLE.getHtml());
|
||||||
validationIcon.setStyleName(SPUIStyleDefinitions.SUCCESS_ICON);
|
validationIcon.setStyleName(SPUIStyleDefinitions.SUCCESS_ICON);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showValidationFailureIcon() {
|
private void showValidationFailureIcon() {
|
||||||
@@ -471,8 +470,8 @@ public class CreateOrUpdateFilterHeader extends VerticalLayout implements Button
|
|||||||
targetFilterQuery.setName(nameTextField.getValue());
|
targetFilterQuery.setName(nameTextField.getValue());
|
||||||
targetFilterQuery.setQuery(queryTextField.getValue());
|
targetFilterQuery.setQuery(queryTextField.getValue());
|
||||||
targetFilterQueryManagement.createTargetFilterQuery(targetFilterQuery);
|
targetFilterQueryManagement.createTargetFilterQuery(targetFilterQuery);
|
||||||
notification.displaySuccess(i18n.get("message.create.filter.success",
|
notification.displaySuccess(
|
||||||
new Object[] { targetFilterQuery.getName() }));
|
i18n.get("message.create.filter.success", new Object[] { targetFilterQuery.getName() }));
|
||||||
eventBus.publish(this, CustomFilterUIEvent.CREATE_TARGET_FILTER_QUERY);
|
eventBus.publish(this, CustomFilterUIEvent.CREATE_TARGET_FILTER_QUERY);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -514,11 +513,11 @@ public class CreateOrUpdateFilterHeader extends VerticalLayout implements Button
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateStatusIconAfterTablePopulated() {
|
private void updateStatusIconAfterTablePopulated() {
|
||||||
queryTextField.focus();
|
queryTextField.focus();
|
||||||
if (!validationFailed && !Strings.isNullOrEmpty(queryTextField.getValue())) {
|
if (!validationFailed && !Strings.isNullOrEmpty(queryTextField.getValue())) {
|
||||||
showValidationSuccesIcon();
|
showValidationSuccesIcon();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,6 @@ import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
|||||||
import com.google.common.base.Strings;
|
import com.google.common.base.Strings;
|
||||||
import com.vaadin.data.Item;
|
import com.vaadin.data.Item;
|
||||||
import com.vaadin.server.FontAwesome;
|
import com.vaadin.server.FontAwesome;
|
||||||
import com.vaadin.server.Sizeable.Unit;
|
|
||||||
import com.vaadin.shared.ui.label.ContentMode;
|
import com.vaadin.shared.ui.label.ContentMode;
|
||||||
import com.vaadin.spring.annotation.SpringComponent;
|
import com.vaadin.spring.annotation.SpringComponent;
|
||||||
import com.vaadin.spring.annotation.ViewScope;
|
import com.vaadin.spring.annotation.ViewScope;
|
||||||
@@ -101,18 +100,16 @@ public class CreateOrUpdateFilterTable extends Table {
|
|||||||
|| custFUIEvent == CustomFilterUIEvent.CREATE_NEW_FILTER_CLICK) {
|
|| custFUIEvent == CustomFilterUIEvent.CREATE_NEW_FILTER_CLICK) {
|
||||||
UI.getCurrent().access(() -> populateTableData());
|
UI.getCurrent().access(() -> populateTableData());
|
||||||
} else if (custFUIEvent == CustomFilterUIEvent.FILTER_TARGET_BY_QUERY) {
|
} else if (custFUIEvent == CustomFilterUIEvent.FILTER_TARGET_BY_QUERY) {
|
||||||
this.getUI().access(() -> onQuery());
|
UI.getCurrent().access(() -> onQuery());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void restoreOnLoad() {
|
||||||
|
|
||||||
private void restoreOnLoad() {
|
|
||||||
if (filterManagementUIState.isCreateFilterViewDisplayed()) {
|
if (filterManagementUIState.isCreateFilterViewDisplayed()) {
|
||||||
filterManagementUIState.setFilterQueryValue(null);
|
filterManagementUIState.setFilterQueryValue(null);
|
||||||
} else {
|
} else {
|
||||||
filterManagementUIState.getTfQuery().ifPresent(
|
filterManagementUIState.getTfQuery()
|
||||||
value -> filterManagementUIState.setFilterQueryValue(value.getQuery()));
|
.ifPresent(value -> filterManagementUIState.setFilterQueryValue(value.getQuery()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -128,8 +125,9 @@ public class CreateOrUpdateFilterTable extends Table {
|
|||||||
targetQF.setQueryConfiguration(queryConfig);
|
targetQF.setQueryConfiguration(queryConfig);
|
||||||
|
|
||||||
// create lazy query container with lazy defination and query
|
// create lazy query container with lazy defination and query
|
||||||
final LazyQueryContainer targetTableContainer = new LazyQueryContainer(new LazyQueryDefinition(true,
|
final LazyQueryContainer targetTableContainer = new LazyQueryContainer(
|
||||||
SPUIDefinitions.PAGE_SIZE, SPUILabelDefinitions.VAR_CONT_ID_NAME), targetQF);
|
new LazyQueryDefinition(true, SPUIDefinitions.PAGE_SIZE, SPUILabelDefinitions.VAR_CONT_ID_NAME),
|
||||||
|
targetQF);
|
||||||
targetTableContainer.getQueryView().getQueryDefinition().setMaxNestedPropertyDepth(PROPERTY_DEPT);
|
targetTableContainer.getQueryView().getQueryDefinition().setMaxNestedPropertyDepth(PROPERTY_DEPT);
|
||||||
|
|
||||||
return targetTableContainer;
|
return targetTableContainer;
|
||||||
@@ -182,16 +180,16 @@ public class CreateOrUpdateFilterTable extends Table {
|
|||||||
|
|
||||||
private List<TableColumn> getVisbleColumns() {
|
private List<TableColumn> getVisbleColumns() {
|
||||||
final List<TableColumn> columnList = new ArrayList<>();
|
final List<TableColumn> columnList = new ArrayList<>();
|
||||||
columnList.add(new TableColumn(SPUILabelDefinitions.NAME, i18n.get("header.name"),0.15f));
|
columnList.add(new TableColumn(SPUILabelDefinitions.NAME, i18n.get("header.name"), 0.15f));
|
||||||
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_CREATED_BY, i18n.get("header.createdBy"), 0.1f));
|
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_CREATED_BY, i18n.get("header.createdBy"), 0.1f));
|
||||||
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_CREATED_DATE, i18n.get("header.createdDate"), 0.1F));
|
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_CREATED_DATE, i18n.get("header.createdDate"), 0.1F));
|
||||||
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_LAST_MODIFIED_BY, i18n.get("header.modifiedBy"), 0.1F));
|
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_LAST_MODIFIED_BY, i18n.get("header.modifiedBy"), 0.1F));
|
||||||
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_LAST_MODIFIED_DATE, i18n.get("header.modifiedDate"),
|
columnList.add(
|
||||||
0.1F));
|
new TableColumn(SPUILabelDefinitions.VAR_LAST_MODIFIED_DATE, i18n.get("header.modifiedDate"), 0.1F));
|
||||||
columnList.add(new TableColumn(SPUILabelDefinitions.ASSIGNED_DISTRIBUTION_NAME_VER, i18n
|
columnList.add(new TableColumn(SPUILabelDefinitions.ASSIGNED_DISTRIBUTION_NAME_VER,
|
||||||
.get("header.assigned.ds"), 0.125F));
|
i18n.get("header.assigned.ds"), 0.125F));
|
||||||
columnList.add(new TableColumn(SPUILabelDefinitions.INSTALLED_DISTRIBUTION_NAME_VER, i18n
|
columnList.add(new TableColumn(SPUILabelDefinitions.INSTALLED_DISTRIBUTION_NAME_VER,
|
||||||
.get("header.installed.ds"), 0.125F));
|
i18n.get("header.installed.ds"), 0.125F));
|
||||||
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_DESC, i18n.get("header.description"), 0.1F));
|
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_DESC, i18n.get("header.description"), 0.1F));
|
||||||
columnList.add(new TableColumn(SPUILabelDefinitions.STATUS_ICON, i18n.get("header.status"), 0.1F));
|
columnList.add(new TableColumn(SPUILabelDefinitions.STATUS_ICON, i18n.get("header.status"), 0.1F));
|
||||||
return columnList;
|
return columnList;
|
||||||
@@ -199,8 +197,8 @@ public class CreateOrUpdateFilterTable extends Table {
|
|||||||
|
|
||||||
private Component getStatusIcon(final Object itemId) {
|
private Component getStatusIcon(final Object itemId) {
|
||||||
final Item row1 = getItem(itemId);
|
final Item row1 = getItem(itemId);
|
||||||
final TargetUpdateStatus targetStatus = (TargetUpdateStatus) row1.getItemProperty(
|
final TargetUpdateStatus targetStatus = (TargetUpdateStatus) row1
|
||||||
SPUILabelDefinitions.VAR_TARGET_STATUS).getValue();
|
.getItemProperty(SPUILabelDefinitions.VAR_TARGET_STATUS).getValue();
|
||||||
final Label label = SPUIComponentProvider.getLabel("", SPUILabelDefinitions.SP_LABEL_SIMPLE);
|
final Label label = SPUIComponentProvider.getLabel("", SPUILabelDefinitions.SP_LABEL_SIMPLE);
|
||||||
label.setContentMode(ContentMode.HTML);
|
label.setContentMode(ContentMode.HTML);
|
||||||
if (targetStatus == TargetUpdateStatus.PENDING) {
|
if (targetStatus == TargetUpdateStatus.PENDING) {
|
||||||
@@ -243,7 +241,7 @@ public class CreateOrUpdateFilterTable extends Table {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void onQuery() {
|
private void onQuery() {
|
||||||
populateTableData();
|
populateTableData();
|
||||||
eventBus.publish(this, CustomFilterUIEvent.TARGET_FILTER_STATUS_HIDE);
|
eventBus.publish(this, CustomFilterUIEvent.UPDATE_TARGET_FILTER_SEARCH_ICON);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,8 @@ import org.vaadin.addons.lazyquerycontainer.QueryDefinition;
|
|||||||
import com.google.common.base.Strings;
|
import com.google.common.base.Strings;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Simple implementation of generics bean query which dynamically loads
|
||||||
|
* {@link ProxyTarget} batch of beans.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class CustomTargetBeanQuery extends AbstractBeanQuery<ProxyTarget> {
|
public class CustomTargetBeanQuery extends AbstractBeanQuery<ProxyTarget> {
|
||||||
@@ -43,7 +44,6 @@ public class CustomTargetBeanQuery extends AbstractBeanQuery<ProxyTarget> {
|
|||||||
private FilterManagementUIState filterManagementUIState;
|
private FilterManagementUIState filterManagementUIState;
|
||||||
private transient I18N i18N;
|
private transient I18N i18N;
|
||||||
private String filterQuery;
|
private String filterQuery;
|
||||||
private Boolean isInvalidFilterQuery;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parametric Constructor.
|
* Parametric Constructor.
|
||||||
@@ -63,7 +63,6 @@ public class CustomTargetBeanQuery extends AbstractBeanQuery<ProxyTarget> {
|
|||||||
|
|
||||||
if (HawkbitCommonUtil.mapCheckStrKey(queryConfig)) {
|
if (HawkbitCommonUtil.mapCheckStrKey(queryConfig)) {
|
||||||
filterQuery = (String) queryConfig.get(SPUIDefinitions.FILTER_BY_QUERY);
|
filterQuery = (String) queryConfig.get(SPUIDefinitions.FILTER_BY_QUERY);
|
||||||
isInvalidFilterQuery = (Boolean) queryConfig.get(SPUIDefinitions.FILTER_BY_INVALID_QUERY);
|
|
||||||
}
|
}
|
||||||
if (HawkbitCommonUtil.checkBolArray(sortStates)) {
|
if (HawkbitCommonUtil.checkBolArray(sortStates)) {
|
||||||
// Initalize Sor
|
// Initalize Sor
|
||||||
@@ -164,16 +163,11 @@ public class CustomTargetBeanQuery extends AbstractBeanQuery<ProxyTarget> {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int size() {
|
public int size() {
|
||||||
final long totSize = getTargetManagement().countTargetsAll();
|
long size = 0;
|
||||||
long size;
|
|
||||||
if (!Strings.isNullOrEmpty(filterQuery)) {
|
if (!Strings.isNullOrEmpty(filterQuery)) {
|
||||||
size = getTargetManagement().countTargetByTargetFilterQuery(filterQuery);
|
size = getTargetManagement().countTargetByTargetFilterQuery(filterQuery);
|
||||||
} else if (getFilterManagementUIState().isCreateFilterViewDisplayed() || isInvalidFilterQuery) {
|
|
||||||
size = 0;
|
|
||||||
} else {
|
|
||||||
size = totSize;
|
|
||||||
}
|
}
|
||||||
getFilterManagementUIState().setTargetsCountAll(totSize);
|
getFilterManagementUIState().setTargetsCountAll(size);
|
||||||
if (size > SPUIDefinitions.MAX_TARGET_TABLE_ENTRIES) {
|
if (size > SPUIDefinitions.MAX_TARGET_TABLE_ENTRIES) {
|
||||||
getFilterManagementUIState().setTargetsTruncated(size - SPUIDefinitions.MAX_TARGET_TABLE_ENTRIES);
|
getFilterManagementUIState().setTargetsTruncated(size - SPUIDefinitions.MAX_TARGET_TABLE_ENTRIES);
|
||||||
size = SPUIDefinitions.MAX_TARGET_TABLE_ENTRIES;
|
size = SPUIDefinitions.MAX_TARGET_TABLE_ENTRIES;
|
||||||
|
|||||||
@@ -15,5 +15,5 @@ package org.eclipse.hawkbit.ui.filtermanagement.event;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public enum CustomFilterUIEvent {
|
public enum CustomFilterUIEvent {
|
||||||
FILTER_TARGET_BY_QUERY, FILTER_BY_CUST_FILTER_TEXT, FILTER_BY_CUST_FILTER_TEXT_REMOVE, CREATE_NEW_FILTER_CLICK, EXIT_CREATE_OR_UPDATE_FILTRER_VIEW, TARGET_FILTER_DETAIL_VIEW, TARGET_DETAILS_VIEW, CREATE_TARGET_FILTER_QUERY, UPDATED_TARGET_FILTER_QUERY, TARGET_FILTER_STATUS_HIDE
|
FILTER_TARGET_BY_QUERY, FILTER_BY_CUST_FILTER_TEXT, FILTER_BY_CUST_FILTER_TEXT_REMOVE, CREATE_NEW_FILTER_CLICK, EXIT_CREATE_OR_UPDATE_FILTRER_VIEW, TARGET_FILTER_DETAIL_VIEW, TARGET_DETAILS_VIEW, CREATE_TARGET_FILTER_QUERY, UPDATED_TARGET_FILTER_QUERY, UPDATE_TARGET_FILTER_SEARCH_ICON
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ package org.eclipse.hawkbit.ui.filtermanagement.footer;
|
|||||||
import javax.annotation.PostConstruct;
|
import javax.annotation.PostConstruct;
|
||||||
import javax.annotation.PreDestroy;
|
import javax.annotation.PreDestroy;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.repository.TargetManagement;
|
|
||||||
import org.eclipse.hawkbit.ui.filtermanagement.event.CustomFilterUIEvent;
|
import org.eclipse.hawkbit.ui.filtermanagement.event.CustomFilterUIEvent;
|
||||||
import org.eclipse.hawkbit.ui.filtermanagement.state.FilterManagementUIState;
|
import org.eclipse.hawkbit.ui.filtermanagement.state.FilterManagementUIState;
|
||||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||||
@@ -46,9 +45,6 @@ public class TargetFilterCountMessageLabel extends Label {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private FilterManagementUIState filterManagementUIState;
|
private FilterManagementUIState filterManagementUIState;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private transient TargetManagement targetManagement;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private I18N i18n;
|
private I18N i18n;
|
||||||
|
|
||||||
@@ -75,7 +71,7 @@ public class TargetFilterCountMessageLabel extends Label {
|
|||||||
if (custFUIEvent == CustomFilterUIEvent.TARGET_DETAILS_VIEW
|
if (custFUIEvent == CustomFilterUIEvent.TARGET_DETAILS_VIEW
|
||||||
|| custFUIEvent == CustomFilterUIEvent.CREATE_NEW_FILTER_CLICK
|
|| custFUIEvent == CustomFilterUIEvent.CREATE_NEW_FILTER_CLICK
|
||||||
|| custFUIEvent == CustomFilterUIEvent.EXIT_CREATE_OR_UPDATE_FILTRER_VIEW
|
|| custFUIEvent == CustomFilterUIEvent.EXIT_CREATE_OR_UPDATE_FILTRER_VIEW
|
||||||
|| custFUIEvent == CustomFilterUIEvent.FILTER_TARGET_BY_QUERY) {
|
|| custFUIEvent == CustomFilterUIEvent.UPDATE_TARGET_FILTER_SEARCH_ICON) {
|
||||||
UI.getCurrent().access(() -> displayTargetFilterMessage());
|
UI.getCurrent().access(() -> displayTargetFilterMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -90,8 +86,7 @@ public class TargetFilterCountMessageLabel extends Label {
|
|||||||
long totalTargets = 0;
|
long totalTargets = 0;
|
||||||
if (filterManagementUIState.isCreateFilterViewDisplayed() || filterManagementUIState.isEditViewDisplayed()) {
|
if (filterManagementUIState.isCreateFilterViewDisplayed() || filterManagementUIState.isEditViewDisplayed()) {
|
||||||
if (null != filterManagementUIState.getFilterQueryValue()) {
|
if (null != filterManagementUIState.getFilterQueryValue()) {
|
||||||
totalTargets = targetManagement
|
totalTargets = filterManagementUIState.getTargetsCountAll().get();
|
||||||
.countTargetByTargetFilterQuery(filterManagementUIState.getFilterQueryValue());
|
|
||||||
}
|
}
|
||||||
final StringBuilder targetMessage = new StringBuilder(i18n.get("label.target.filtered.total"));
|
final StringBuilder targetMessage = new StringBuilder(i18n.get("label.target.filtered.total"));
|
||||||
if (filterManagementUIState.getTargetsTruncated() != null) {
|
if (filterManagementUIState.getTargetsTruncated() != null) {
|
||||||
|
|||||||
@@ -19,24 +19,32 @@ import org.junit.Test;
|
|||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.mockito.Mock;
|
import org.mockito.Mock;
|
||||||
import org.mockito.runners.MockitoJUnitRunner;
|
import org.mockito.runners.MockitoJUnitRunner;
|
||||||
|
import org.springframework.context.annotation.Description;
|
||||||
|
|
||||||
|
import ru.yandex.qatools.allure.annotations.Features;
|
||||||
|
import ru.yandex.qatools.allure.annotations.Stories;
|
||||||
|
|
||||||
|
@Features("Component Tests - UI")
|
||||||
|
@Stories("Threads with NamingThreadFactory")
|
||||||
@RunWith(MockitoJUnitRunner.class)
|
@RunWith(MockitoJUnitRunner.class)
|
||||||
public class NamingThreadFactoryTest {
|
public class NamingThreadFactoryTest {
|
||||||
@Mock
|
@Mock
|
||||||
private final Runnable runnableMock = mock(Runnable.class);
|
private final Runnable runnableMock = mock(Runnable.class);
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@Description("Correct name of threads when created through NamingThreadFactory.")
|
||||||
public void setsNameForThreads() {
|
public void setsNameForThreads() {
|
||||||
final String knownName = "knownName";
|
final String knownName = "knownName";
|
||||||
final ThreadFactory threadFactory = new NamingThreadFactory(knownName);
|
final ThreadFactory threadFactory = new NamingThreadFactory(knownName);
|
||||||
final Thread newThread1 = threadFactory.newThread(runnableMock);
|
final Thread newThread1 = threadFactory.newThread(runnableMock);
|
||||||
final Thread newThread2 = threadFactory.newThread(runnableMock);
|
final Thread newThread2 = threadFactory.newThread(runnableMock);
|
||||||
|
|
||||||
assertThat(newThread1.getName()).isEqualTo(NamingThreadFactory.SP_PREFIX + knownName);
|
assertThat(newThread1.getName()).as("Name of the thread").isEqualTo(NamingThreadFactory.SP_PREFIX + knownName);
|
||||||
assertThat(newThread2.getName()).isEqualTo(NamingThreadFactory.SP_PREFIX + knownName);
|
assertThat(newThread2.getName()).as("Name of the thread").isEqualTo(NamingThreadFactory.SP_PREFIX + knownName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@Description("Correct name of threads when created through NamingThreadFactory with formated name.")
|
||||||
public void setsFormatedNameForThreads() {
|
public void setsFormatedNameForThreads() {
|
||||||
final String nameFormat = "knownName-%d";
|
final String nameFormat = "knownName-%d";
|
||||||
final String knownName1 = "knownName-0";
|
final String knownName1 = "knownName-0";
|
||||||
@@ -45,11 +53,12 @@ public class NamingThreadFactoryTest {
|
|||||||
final Thread newThread1 = threadFactory.newThread(runnableMock);
|
final Thread newThread1 = threadFactory.newThread(runnableMock);
|
||||||
final Thread newThread2 = threadFactory.newThread(runnableMock);
|
final Thread newThread2 = threadFactory.newThread(runnableMock);
|
||||||
|
|
||||||
assertThat(newThread1.getName()).isEqualTo(NamingThreadFactory.SP_PREFIX + knownName1);
|
assertThat(newThread1.getName()).as("Name of the thread").isEqualTo(NamingThreadFactory.SP_PREFIX + knownName1);
|
||||||
assertThat(newThread2.getName()).isEqualTo(NamingThreadFactory.SP_PREFIX + knownName2);
|
assertThat(newThread2.getName()).as("Name of the thread").isEqualTo(NamingThreadFactory.SP_PREFIX + knownName2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@Description("Created threads run are running.")
|
||||||
public void setsRunnableForThreads() {
|
public void setsRunnableForThreads() {
|
||||||
final String knownName = "knownName";
|
final String knownName = "knownName";
|
||||||
final ThreadFactory threadFactory = new NamingThreadFactory(knownName);
|
final ThreadFactory threadFactory = new NamingThreadFactory(knownName);
|
||||||
|
|||||||
Reference in New Issue
Block a user