Merge branch 'master' into Rollout_migrate_table_to_grid_final

Signed-off-by: asharani-murugesh <asharani.murugesh@in.bosch.com>
This commit is contained in:
asharani-murugesh
2016-03-09 09:34:41 +01:00
18 changed files with 276 additions and 188 deletions

View File

@@ -9,14 +9,12 @@
package org.eclipse.hawkbit.mgmt.client;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
/**
* Configuration bean which holds the configuration of the client e.g. the base
* URL of the hawkbit-server and the credentials to use the RESTful Management
* API.
*/
@Component
@ConfigurationProperties(prefix = "hawkbit")
public class ClientConfigurationProperties {

View File

@@ -1,6 +1,3 @@
<!-- 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 -->
<?xml version="1.0" encoding="UTF-8"?>
<!--

View File

@@ -58,8 +58,8 @@ public class BaseAmqpService {
* @return the converted object
*/
@SuppressWarnings("unchecked")
protected <T> T convertMessage(final Message message, final Class<T> clazz) {
if (message == null) {
public <T> T convertMessage(final Message message, final Class<T> clazz) {
if (message == null || message.getBody() == null) {
return null;
}
message.getMessageProperties().getHeaders().put(AbstractJavaTypeMapper.DEFAULT_CLASSID_FIELD_NAME,
@@ -78,8 +78,8 @@ public class BaseAmqpService {
* @return the list of converted objects
*/
@SuppressWarnings("unchecked")
protected <T> List<T> convertMessageList(final Message message, final Class<T> clazz) {
if (message == null) {
public <T> List<T> convertMessageList(final Message message, final Class<T> clazz) {
if (message == null || message.getBody() == null) {
return Collections.emptyList();
}
message.getMessageProperties().getHeaders().put(AbstractJavaTypeMapper.DEFAULT_CLASSID_FIELD_NAME,
@@ -99,6 +99,7 @@ public class BaseAmqpService {
final Object value = header.get(key);
if (value == null) {
logAndThrowMessageError(message, errorMessageIfNull);
return null;
}
return value.toString();
}

View File

@@ -116,6 +116,7 @@ public class AmqpMessageHandlerServiceTest {
}
@Test
@Description("Tests not allowed content-type in message")
public void testWrongContentType() {
final MessageProperties messageProperties = new MessageProperties();

View File

@@ -0,0 +1,103 @@
/**
* 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.amqp;
import static org.fest.assertions.api.Assertions.assertThat;
import static org.mockito.Mockito.when;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.hawkbit.dmf.json.model.ActionUpdateStatus;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.core.MessageProperties;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
import ru.yandex.qatools.allure.annotations.Description;
import ru.yandex.qatools.allure.annotations.Features;
import ru.yandex.qatools.allure.annotations.Stories;
@RunWith(MockitoJUnitRunner.class)
@Features("Component Tests - Device Management Federation API")
@Stories("Base Amqp Service Test")
public class BaseAmqpServiceTest {
@Mock
private RabbitTemplate rabbitTemplate;
private BaseAmqpService baseAmqpService;
@Before
public void setup() {
when(rabbitTemplate.getMessageConverter()).thenReturn(new Jackson2JsonMessageConverter());
baseAmqpService = new BaseAmqpService(rabbitTemplate);
}
@Test
@Description("Verify that the message conversion works")
public void convertMessageTest() {
final ActionUpdateStatus actionUpdateStatus = new ActionUpdateStatus();
actionUpdateStatus.setActionId(1L);
actionUpdateStatus.setSoftwareModuleId(2L);
final Message message = rabbitTemplate.getMessageConverter().toMessage(actionUpdateStatus,
new MessageProperties());
ActionUpdateStatus convertedActionUpdateStatus = baseAmqpService.convertMessage(message,
ActionUpdateStatus.class);
assertThat(convertedActionUpdateStatus).as("Converted Action Status is wrong")
.isEqualsToByComparingFields(actionUpdateStatus);
convertedActionUpdateStatus = baseAmqpService.convertMessage(null, ActionUpdateStatus.class);
assertThat(convertedActionUpdateStatus).as("Converted Object should be null when message is null").isNull();
convertedActionUpdateStatus = baseAmqpService.convertMessage(new Message(null, new MessageProperties()),
ActionUpdateStatus.class);
assertThat(convertedActionUpdateStatus).as("Converted Object should be null when message body is null")
.isNull();
}
@Test
@Description("Verify that a conversion of a list from a message works")
public void convertMessageListTest() {
final List<ActionUpdateStatus> actionUpdateStatusList = new ArrayList<>();
for (int i = 0; i < 5; i++) {
final ActionUpdateStatus actionUpdateStatus = new ActionUpdateStatus();
actionUpdateStatus.setActionId(Long.valueOf(i));
actionUpdateStatus.setSoftwareModuleId(Long.valueOf(i));
actionUpdateStatusList.add(actionUpdateStatus);
}
final Message message = rabbitTemplate.getMessageConverter().toMessage(actionUpdateStatusList,
new MessageProperties());
List<ActionUpdateStatus> convertedActionUpdateStatus = baseAmqpService.convertMessageList(message,
ActionUpdateStatus.class);
assertThat(convertedActionUpdateStatus).as("Converted Action Status list is wrong")
.hasSameClassAs(actionUpdateStatusList);
assertThat(convertedActionUpdateStatus).as("Converted Action Status list is wrong")
.hasSameSizeAs(actionUpdateStatusList);
convertedActionUpdateStatus = baseAmqpService.convertMessageList(null, ActionUpdateStatus.class);
assertThat(convertedActionUpdateStatus).as("Converted list should be empty when message is null").isEmpty();
convertedActionUpdateStatus = baseAmqpService.convertMessageList(new Message(null, new MessageProperties()),
ActionUpdateStatus.class);
assertThat(convertedActionUpdateStatus).as("Converted list should be empty when message body is null")
.isEmpty();
}
}

View File

@@ -50,7 +50,6 @@ import com.google.common.eventbus.Subscribe;
import ru.yandex.qatools.allure.annotations.Description;
import ru.yandex.qatools.allure.annotations.Features;
import ru.yandex.qatools.allure.annotations.Issue;
import ru.yandex.qatools.allure.annotations.Stories;
/**
@@ -781,12 +780,13 @@ public class DeploymentManagementTest extends AbstractIntegrationTest {
targ = targetManagement.findTargetByControllerID(targ.getControllerId());
assertEquals(0, deploymentManagement.findActiveActionsByTarget(targ).size());
assertEquals(1, deploymentManagement.findInActiveActionsByTarget(targ).size());
assertEquals("active target actions are wrong", 0, deploymentManagement.findActiveActionsByTarget(targ).size());
assertEquals("active actions are wrong", 1, deploymentManagement.findInActiveActionsByTarget(targ).size());
assertEquals(TargetUpdateStatus.IN_SYNC, targ.getTargetInfo().getUpdateStatus());
assertEquals(dsA, targ.getAssignedDistributionSet());
assertEquals(dsA, targ.getTargetInfo().getInstalledDistributionSet());
assertEquals("tagret update status is not correct", TargetUpdateStatus.IN_SYNC,
targ.getTargetInfo().getUpdateStatus());
assertEquals("wrong assigned ds", dsA, targ.getAssignedDistributionSet());
assertEquals("wrong installed ds", dsA, targ.getTargetInfo().getInstalledDistributionSet());
targs = deploymentManagement.assignDistributionSet(dsB.getId(), new String[] { "target-id-A" })
.getAssignedTargets();
@@ -796,7 +796,7 @@ public class DeploymentManagementTest extends AbstractIntegrationTest {
assertEquals("active actions are wrong", 1, deploymentManagement.findActiveActionsByTarget(targ).size());
assertEquals("target status is wrong", TargetUpdateStatus.PENDING,
targetManagement.findTargetByControllerID(targ.getControllerId()).getTargetInfo().getUpdateStatus());
assertEquals(dsB, targ.getAssignedDistributionSet());
assertEquals("wrong assigned ds", dsB, targ.getAssignedDistributionSet());
assertEquals("Installed ds is wrong", dsA.getId(),
targetManagement.findTargetByControllerIDWithDetails(targ.getControllerId()).getTargetInfo()
.getInstalledDistributionSet().getId());

View File

@@ -10,6 +10,7 @@ package org.eclipse.hawkbit.repository;
import static org.fest.assertions.api.Assertions.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
import java.util.List;
@@ -22,6 +23,7 @@ import org.eclipse.hawkbit.repository.model.DistributionSetTag;
import org.eclipse.hawkbit.repository.model.Tag;
import org.eclipse.hawkbit.repository.model.Target;
import org.eclipse.hawkbit.repository.model.TargetTag;
import org.junit.Before;
import org.junit.Test;
import org.slf4j.LoggerFactory;
@@ -42,6 +44,11 @@ public class TagManagementTest extends AbstractIntegrationTest {
LOG = LoggerFactory.getLogger(TagManagementTest.class);
}
@Before
public void setup() {
assertThat(targetTagRepository.findAll()).as("Not tags should be available").isEmpty();
}
@Test
@Description("Full DS tag lifecycle tested. Create tags, assign them to sets and delete the tags.")
public void createAndAssignAndDeleteDistributionSetTags() {
@@ -88,7 +95,7 @@ public class TagManagementTest extends AbstractIntegrationTest {
// search for not deleted
distributionSetFilterBuilder = getDistributionSetFilterBuilder().setIsComplete(true)
.setTagNames(Lists.newArrayList(tagA.getName()));
assertEquals(
assertEquals("filter works not correct",
dsAs.spliterator().getExactSizeIfKnown() + dsABs.spliterator().getExactSizeIfKnown()
+ dsACs.spliterator().getExactSizeIfKnown() + dsABCs.spliterator().getExactSizeIfKnown(),
distributionSetManagement.findDistributionSetsByFilters(pageReq, distributionSetFilterBuilder.build())
@@ -96,7 +103,7 @@ public class TagManagementTest extends AbstractIntegrationTest {
distributionSetFilterBuilder = getDistributionSetFilterBuilder().setIsComplete(true)
.setTagNames(Lists.newArrayList(tagB.getName()));
assertEquals(
assertEquals("filter works not correct",
dsBs.spliterator().getExactSizeIfKnown() + dsABs.spliterator().getExactSizeIfKnown()
+ dsBCs.spliterator().getExactSizeIfKnown() + dsABCs.spliterator().getExactSizeIfKnown(),
distributionSetManagement.findDistributionSetsByFilters(pageReq, distributionSetFilterBuilder.build())
@@ -104,7 +111,7 @@ public class TagManagementTest extends AbstractIntegrationTest {
distributionSetFilterBuilder = getDistributionSetFilterBuilder().setIsComplete(true)
.setTagNames(Lists.newArrayList(tagC.getName()));
assertEquals(
assertEquals("filter works not correct",
dsCs.spliterator().getExactSizeIfKnown() + dsACs.spliterator().getExactSizeIfKnown()
+ dsBCs.spliterator().getExactSizeIfKnown() + dsABCs.spliterator().getExactSizeIfKnown(),
distributionSetManagement.findDistributionSetsByFilters(pageReq, distributionSetFilterBuilder.build())
@@ -112,22 +119,22 @@ public class TagManagementTest extends AbstractIntegrationTest {
distributionSetFilterBuilder = getDistributionSetFilterBuilder().setIsComplete(true)
.setTagNames(Lists.newArrayList(tagX.getName()));
assertEquals(0, distributionSetManagement
assertEquals("filter works not correct", 0, distributionSetManagement
.findDistributionSetsByFilters(pageReq, distributionSetFilterBuilder.build()).getTotalElements());
assertEquals(5, distributionSetTagRepository.findAll().spliterator().getExactSizeIfKnown());
assertEquals("wrong tag size", 5, distributionSetTagRepository.findAll().spliterator().getExactSizeIfKnown());
tagManagement.deleteDistributionSetTag(tagY.getName());
assertEquals(4, distributionSetTagRepository.findAll().spliterator().getExactSizeIfKnown());
assertEquals("wrong tag size", 4, distributionSetTagRepository.findAll().spliterator().getExactSizeIfKnown());
tagManagement.deleteDistributionSetTag(tagX.getName());
assertEquals(3, distributionSetTagRepository.findAll().spliterator().getExactSizeIfKnown());
assertEquals("wrong tag size", 3, distributionSetTagRepository.findAll().spliterator().getExactSizeIfKnown());
tagManagement.deleteDistributionSetTag(tagB.getName());
assertEquals(2, distributionSetTagRepository.findAll().spliterator().getExactSizeIfKnown());
assertEquals("wrong tag size", 2, distributionSetTagRepository.findAll().spliterator().getExactSizeIfKnown());
distributionSetFilterBuilder = getDistributionSetFilterBuilder().setIsComplete(Boolean.TRUE)
.setTagNames(Lists.newArrayList(tagA.getName()));
assertEquals(
assertEquals("filter works not correct",
dsAs.spliterator().getExactSizeIfKnown() + dsABs.spliterator().getExactSizeIfKnown()
+ dsACs.spliterator().getExactSizeIfKnown() + dsABCs.spliterator().getExactSizeIfKnown(),
distributionSetManagement.findDistributionSetsByFilters(pageReq, distributionSetFilterBuilder.build())
@@ -135,12 +142,12 @@ public class TagManagementTest extends AbstractIntegrationTest {
distributionSetFilterBuilder = getDistributionSetFilterBuilder().setIsComplete(Boolean.TRUE)
.setTagNames(Lists.newArrayList(tagB.getName()));
assertEquals(0, distributionSetManagement
assertEquals("filter works not correct", 0, distributionSetManagement
.findDistributionSetsByFilters(pageReq, distributionSetFilterBuilder.build()).getTotalElements());
distributionSetFilterBuilder = getDistributionSetFilterBuilder().setIsComplete(Boolean.TRUE)
.setTagNames(Lists.newArrayList(tagC.getName()));
assertEquals(
assertEquals("filter works not correct",
dsCs.spliterator().getExactSizeIfKnown() + dsACs.spliterator().getExactSizeIfKnown()
+ dsBCs.spliterator().getExactSizeIfKnown() + dsABCs.spliterator().getExactSizeIfKnown(),
distributionSetManagement.findDistributionSetsByFilters(pageReq, distributionSetFilterBuilder.build())
@@ -154,30 +161,25 @@ public class TagManagementTest extends AbstractIntegrationTest {
@Test
@Description("Ensures that all tags are retrieved through repository.")
public void findAllTargetTags() {
assertThat(targetTagRepository.findAll()).isEmpty();
final List<TargetTag> tags = createTargetsWithTags();
assertThat(targetTagRepository.findAll()).isEqualTo(tagManagement.findAllTargetTags()).isEqualTo(tags)
.hasSize(20);
.as("Wrong tag size").hasSize(20);
}
@Test
@Description("Ensures that a created tag is persisted in the repository as defined.")
public void createTargetTag() {
assertThat(targetTagRepository.findAll()).isEmpty();
final Tag tag = tagManagement.createTargetTag(new TargetTag("kai1", "kai2", "colour"));
assertThat(targetTagRepository.findByNameEquals("kai1").getDescription()).isEqualTo("kai2");
assertThat(tagManagement.findTargetTag("kai1").getColour()).isEqualTo("colour");
assertThat(tagManagement.findTargetTagById(tag.getId()).getColour()).isEqualTo("colour");
assertThat(targetTagRepository.findByNameEquals("kai1").getDescription()).as("wrong tag ed").isEqualTo("kai2");
assertThat(tagManagement.findTargetTag("kai1").getColour()).as("wrong tag found").isEqualTo("colour");
assertThat(tagManagement.findTargetTagById(tag.getId()).getColour()).as("wrong tag found").isEqualTo("colour");
}
@Test
@Description("Ensures that a deleted tag is removed from the repository as defined.")
public void deleteTargetTas() {
assertThat(targetTagRepository.findAll()).isEmpty();
// create test data
final Iterable<TargetTag> tags = createTargetsWithTags();
@@ -196,16 +198,13 @@ public class TagManagementTest extends AbstractIntegrationTest {
assertThat(targetManagement.findTargetByControllerID(target.getControllerId()).getTags())
.doesNotContain(toDelete);
}
assertThat(targetTagRepository.findOne(toDelete.getId())).isNull();
assertThat(tagManagement.findAllTargetTags()).hasSize(19);
assertThat(targetTagRepository.findOne(toDelete.getId())).as("No tag should be found").isNull();
assertThat(tagManagement.findAllTargetTags()).as("Wrong target tag size").hasSize(19);
}
@Test
@Description("Tests the name update of a target tag.")
public void updateTargetTag() {
assertThat(targetTagRepository.findAll()).isEmpty();
// create test data
final List<TargetTag> tags = createTargetsWithTags();
// change data
@@ -216,95 +215,104 @@ public class TagManagementTest extends AbstractIntegrationTest {
tagManagement.updateTargetTag(savedAssigned);
// check data
assertThat(tagManagement.findAllTargetTags()).hasSize(tags.size());
assertThat(targetTagRepository.findOne(savedAssigned.getId()).getName()).isEqualTo("test123");
assertThat(targetTagRepository.findOne(savedAssigned.getId()).getOptLockRevision()).isEqualTo(2);
assertThat(tagManagement.findAllTargetTags()).as("Wrong target tag size").hasSize(tags.size());
assertThat(targetTagRepository.findOne(savedAssigned.getId()).getName()).as("wrong target tag is saved")
.isEqualTo("test123");
assertThat(targetTagRepository.findOne(savedAssigned.getId()).getOptLockRevision())
.as("wrong target tag is saved").isEqualTo(2);
}
@Test
@Description("Ensures that a created tag is persisted in the repository as defined.")
public void createDistributionSetTag() {
assertThat(distributionSetTagRepository.findAll()).isEmpty();
final Tag tag = tagManagement.createDistributionSetTag(new DistributionSetTag("kai1", "kai2", "colour"));
assertThat(distributionSetTagRepository.findByNameEquals("kai1").getDescription()).isEqualTo("kai2");
assertThat(tagManagement.findDistributionSetTag("kai1").getColour()).isEqualTo("colour");
assertThat(tagManagement.findDistributionSetTagById(tag.getId()).getColour()).isEqualTo("colour");
assertThat(distributionSetTagRepository.findByNameEquals("kai1").getDescription()).as("wrong tag found")
.isEqualTo("kai2");
assertThat(tagManagement.findDistributionSetTag("kai1").getColour()).as("wrong tag found").isEqualTo("colour");
assertThat(tagManagement.findDistributionSetTagById(tag.getId()).getColour()).as("wrong tag found")
.isEqualTo("colour");
}
@Test
@Description("Ensures that a created tags are persisted in the repository as defined.")
public void createDistributionSetTags() {
assertThat(distributionSetTagRepository.findAll()).isEmpty();
final List<DistributionSetTag> tags = createDsSetsWithTags();
assertThat(distributionSetTagRepository.findAll()).hasSize(tags.size());
assertThat(distributionSetTagRepository.findAll()).as("Wrong size of tags created").hasSize(tags.size());
}
@Test
@Description("Ensures that a deleted tag is removed from the repository as defined.")
public void deleteDistributionSetTag() {
assertThat(distributionSetTagRepository.findAll()).isEmpty();
// create test data
final Iterable<DistributionSetTag> tags = createDsSetsWithTags();
final DistributionSetTag toDelete = tags.iterator().next();
for (final DistributionSet set : distributionSetRepository.findAll()) {
assertThat(distributionSetManagement.findDistributionSetByIdWithDetails(set.getId()).getTags())
.contains(toDelete);
.as("Wrong tag found").contains(toDelete);
}
// delete
tagManagement.deleteDistributionSetTag(tags.iterator().next().getName());
// check
assertThat(distributionSetTagRepository.findOne(toDelete.getId())).isNull();
assertThat(tagManagement.findAllDistributionSetTags()).hasSize(19);
assertThat(distributionSetTagRepository.findOne(toDelete.getId())).as("Deleted tag should be null").isNull();
assertThat(tagManagement.findAllDistributionSetTags()).as("Wrong size of tags after deletion").hasSize(19);
for (final DistributionSet set : distributionSetRepository.findAll()) {
assertThat(distributionSetManagement.findDistributionSetByIdWithDetails(set.getId()).getTags())
.doesNotContain(toDelete);
.as("Wrong found tags").doesNotContain(toDelete);
}
}
@Test(expected = EntityAlreadyExistsException.class)
@Description("Ensures that a tag cannot be created if one exists already with that name (ecpects EntityAlreadyExistsException).")
public void failedDuplicateTargetTagNameException() {
tagManagement.createTargetTag(new TargetTag("A"));
tagManagement.createTargetTag(new TargetTag("A"));
try {
tagManagement.createTargetTag(new TargetTag("A"));
fail("Expected EntityAlreadyExistsException");
} catch (final EntityAlreadyExistsException e) {
}
}
@Test(expected = EntityAlreadyExistsException.class)
@Description("Ensures that a tag cannot be updated to a name that already exists on another tag (ecpects EntityAlreadyExistsException).")
public void failedDuplicateTargetTagNameExceptionAfterUpdate() {
tagManagement.createTargetTag(new TargetTag("A"));
final TargetTag tag = tagManagement.createTargetTag(new TargetTag("B"));
tag.setName("A");
tagManagement.updateTargetTag(tag);
try {
tagManagement.updateTargetTag(tag);
fail("Expected EntityAlreadyExistsException");
} catch (final EntityAlreadyExistsException e) {
}
}
@Test(expected = EntityAlreadyExistsException.class)
@Description("Ensures that a tag cannot be created if one exists already with that name (ecpects EntityAlreadyExistsException).")
public void failedDuplicateDsTagNameException() {
tagManagement.createDistributionSetTag(new DistributionSetTag("A"));
tagManagement.createDistributionSetTag(new DistributionSetTag("A"));
try {
tagManagement.createDistributionSetTag(new DistributionSetTag("A"));
fail("Expected EntityAlreadyExistsException");
} catch (final EntityAlreadyExistsException e) {
}
}
@Test(expected = EntityAlreadyExistsException.class)
@Description("Ensures that a tag cannot be updated to a name that already exists on another tag (ecpects EntityAlreadyExistsException).")
public void failedDuplicateDsTagNameExceptionAfterUpdate() {
tagManagement.createDistributionSetTag(new DistributionSetTag("A"));
final DistributionSetTag tag = tagManagement.createDistributionSetTag(new DistributionSetTag("B"));
tag.setName("A");
tagManagement.updateDistributionSetTag(tag);
try {
tagManagement.updateDistributionSetTag(tag);
fail("Expected EntityAlreadyExistsException");
} catch (final EntityAlreadyExistsException e) {
}
}
@Test
@Description("Tests the name update of a target tag.")
public void updateDistributionSetTag() {
assertThat(distributionSetTagRepository.findAll()).isEmpty();
// create test data
final List<DistributionSetTag> tags = createDsSetsWithTags();
@@ -317,20 +325,19 @@ public class TagManagementTest extends AbstractIntegrationTest {
tagManagement.updateDistributionSetTag(savedAssigned);
// check data
assertThat(tagManagement.findAllDistributionSetTags()).hasSize(tags.size());
assertThat(distributionSetTagRepository.findOne(savedAssigned.getId()).getName()).isEqualTo("test123");
assertThat(tagManagement.findAllDistributionSetTags()).as("Wrong size of ds tags").hasSize(tags.size());
assertThat(distributionSetTagRepository.findOne(savedAssigned.getId()).getName()).as("Wrong ds tag found")
.isEqualTo("test123");
}
@Test
@Description("Ensures that all tags are retrieved through repository.")
public void findDistributionSetTagsAll() {
assertThat(distributionSetTagRepository.findAll()).isEmpty();
final List<DistributionSetTag> tags = createDsSetsWithTags();
// test
assertThat(tagManagement.findAllDistributionSetTags()).hasSize(tags.size());
assertThat(distributionSetTagRepository.findAll()).hasSize(20);
assertThat(tagManagement.findAllDistributionSetTags()).as("Wrong size of tags").hasSize(tags.size());
assertThat(distributionSetTagRepository.findAll()).as("Wrong size of tags").hasSize(20);
}
private List<TargetTag> createTargetsWithTags() {

View File

@@ -98,7 +98,7 @@ public class RSQLDistributionSetFieldTest extends AbstractIntegrationTest {
assertRSQLQuery(DistributionSetFields.COMPLETE.name() + "==true", 4);
try {
assertRSQLQuery(DistributionSetFields.COMPLETE.name() + "==noExist*", 0);
fail();
fail("Expected RSQLParameterSyntaxException");
} catch (final RSQLParameterSyntaxException e) {
}
assertRSQLQuery(DistributionSetFields.COMPLETE.name() + "=in=(true)", 4);

View File

@@ -311,7 +311,7 @@ public class SoftwareModuleResourceTest extends AbstractIntegrationTestWithMongo
.andExpect(header().string("ETag", artifact.getSha1Hash()))
.andExpect(content().contentType(MediaType.APPLICATION_OCTET_STREAM)).andReturn();
assertTrue(Arrays.equals(result.getResponse().getContentAsByteArray(), random));
assertTrue("Wrong response content", Arrays.equals(result.getResponse().getContentAsByteArray(), random));
final MvcResult result2 = mvc
.perform(get("/rest/v1/softwaremodules/{smId}/artifacts/{artId}/download", sm.getId(),

View File

@@ -438,17 +438,17 @@ public class CreateUpdateSoftwareTypeLayout extends CustomComponent implements C
if (permChecker.hasUpdateDistributionPermission()) {
optionValues.add(updateType.getValue());
}
createOptionGroup(optionValues);
createOptionGroupByValues(optionValues);
}
private void singleMultiOptionGroup() {
final List<String> optionValues = new ArrayList<>();
optionValues.add(singleAssign.getValue());
optionValues.add(multiAssign.getValue());
assignOptionGroup(optionValues);
assignOptionGroupByValues(optionValues);
}
private void createOptionGroup(final List<String> tagOptions) {
private void createOptionGroupByValues(final List<String> tagOptions) {
createOptiongroup = new OptionGroup("", tagOptions);
createOptiongroup.setStyleName(ValoTheme.OPTIONGROUP_SMALL);
createOptiongroup.addStyleName("custom-option-group");
@@ -458,7 +458,7 @@ public class CreateUpdateSoftwareTypeLayout extends CustomComponent implements C
}
}
private void assignOptionGroup(final List<String> tagOptions) {
private void assignOptionGroupByValues(final List<String> tagOptions) {
assignOptiongroup = new OptionGroup("", tagOptions);
assignOptiongroup.setStyleName(ValoTheme.OPTIONGROUP_SMALL);
assignOptiongroup.addStyleName("custom-option-group");

View File

@@ -50,9 +50,9 @@ public class ArtifactUploadState implements Serializable {
private boolean swTypeFilterClosed = Boolean.FALSE;
private boolean isSwModuleTableMaximized = Boolean.FALSE;
private boolean swModuleTableMaximized = Boolean.FALSE;
private boolean isArtifactDetailsMaximized = Boolean.FALSE;
private boolean artifactDetailsMaximized = Boolean.FALSE;
private final Set<String> selectedDeleteSWModuleTypes = new HashSet<>();
@@ -152,15 +152,15 @@ public class ArtifactUploadState implements Serializable {
* @return the isSwModuleTableMaximized
*/
public boolean isSwModuleTableMaximized() {
return isSwModuleTableMaximized;
return swModuleTableMaximized;
}
/**
* @param isSwModuleTableMaximized
* the isSwModuleTableMaximized to set
*/
public void setSwModuleTableMaximized(final boolean isSwModuleTableMaximized) {
this.isSwModuleTableMaximized = isSwModuleTableMaximized;
public void setSwModuleTableMaximized(final boolean swModuleTableMaximized) {
this.swModuleTableMaximized = swModuleTableMaximized;
}
public Set<String> getSelectedDeleteSWModuleTypes() {
@@ -171,15 +171,15 @@ public class ArtifactUploadState implements Serializable {
* @return the isArtifactDetailsMaximized
*/
public boolean isArtifactDetailsMaximized() {
return isArtifactDetailsMaximized;
return artifactDetailsMaximized;
}
/**
* @param isArtifactDetailsMaximized
* the isArtifactDetailsMaximized to set
*/
public void setArtifactDetailsMaximized(final boolean isArtifactDetailsMaximized) {
this.isArtifactDetailsMaximized = isArtifactDetailsMaximized;
public void setArtifactDetailsMaximized(final boolean artifactDetailsMaximized) {
this.artifactDetailsMaximized = artifactDetailsMaximized;
}
/**

View File

@@ -38,11 +38,9 @@ public class ProxyTarget extends Target {
private TargetIdName targetIdName;
private Long createdAt;
private String assignedDistNameVersion;
private String assignedDistNameVersion = null;
private String installedDistNameVersion = null;
private String installedDistNameVersion;
private String pollStatusToolTip;
@@ -251,22 +249,6 @@ public class ProxyTarget extends Target {
this.installedDistributionSet = installedDistributionSet;
}
/**
* @return the createdAt
*/
@Override
public Long getCreatedAt() {
return createdAt;
}
/**
* @param createdAt
* the createdAt to set
*/
public void setCreatedAt(final Long createdAt) {
this.createdAt = createdAt;
}
/**
* @return the targetIdName
*/

View File

@@ -555,10 +555,10 @@ public class CreateUpdateDistSetTypeLayout extends CustomComponent implements Co
if (permChecker.hasUpdateDistributionPermission()) {
optionValues.add(updateDistType.getValue());
}
createOptionGroup(optionValues);
createOptionGroupByValues(optionValues);
}
private void createOptionGroup(final List<String> typeOptions) {
private void createOptionGroupByValues(final List<String> typeOptions) {
createOptiongroup = new OptionGroup("", typeOptions);
createOptiongroup.setId(SPUIDefinitions.CREATE_OPTION_GROUP_DISTRIBUTION_SET_TYPE_ID);
createOptiongroup.addStyleName(ValoTheme.OPTIONGROUP_SMALL);

View File

@@ -62,9 +62,9 @@ public class ManageDistUIState implements Serializable {
private final Map<Long, String> deleteSofwareModulesList = new HashMap<>();
private boolean isSwModuleTableMaximized = Boolean.FALSE;
private boolean swModuleTableMaximized = Boolean.FALSE;
private boolean isDsTableMaximized = Boolean.FALSE;
private boolean dsTableMaximized = Boolean.FALSE;
private final Map<String, SoftwareModuleIdName> assignedSoftwareModuleDetails = new HashMap<>();
@@ -219,7 +219,7 @@ public class ManageDistUIState implements Serializable {
* @return boolean
*/
public boolean isDsTableMaximized() {
return isDsTableMaximized;
return dsTableMaximized;
}
/***
@@ -227,8 +227,8 @@ public class ManageDistUIState implements Serializable {
*
* @param isDsModuleTableMaximized
*/
public void setDsTableMaximized(final boolean isDsModuleTableMaximized) {
isDsTableMaximized = isDsModuleTableMaximized;
public void setDsTableMaximized(final boolean dsModuleTableMaximized) {
dsTableMaximized = dsModuleTableMaximized;
}
public Map<String, SoftwareModuleIdName> getAssignedSoftwareModuleDetails() {
@@ -239,15 +239,15 @@ public class ManageDistUIState implements Serializable {
* @return the isSwModuleTableMaximized
*/
public boolean isSwModuleTableMaximized() {
return isSwModuleTableMaximized;
return swModuleTableMaximized;
}
/**
* @param isSwModuleTableMaximized
* the isSwModuleTableMaximized to set
*/
public void setSwModuleTableMaximized(final boolean isSwModuleTableMaximized) {
this.isSwModuleTableMaximized = isSwModuleTableMaximized;
public void setSwModuleTableMaximized(final boolean swModuleTableMaximized) {
this.swModuleTableMaximized = swModuleTableMaximized;
}
/**

View File

@@ -94,8 +94,8 @@ public class DistributionAddUpdateWindowLayout extends VerticalLayout {
@Autowired
private transient TenantMetaDataRepository tenantMetaDataRepository;
private Button saveDistribution;
private Button discardDistribution;
private Button saveDistributionBtn;
private Button discardDistributionBtn;
private TextField distNameTextField;
private TextField distVersionTextField;
private Label madatoryLabel;
@@ -103,7 +103,7 @@ public class DistributionAddUpdateWindowLayout extends VerticalLayout {
private CheckBox reqMigStepCheckbox;
private ComboBox distsetTypeNameComboBox;
private boolean editDistribution = Boolean.FALSE;
private Long editDistId = null;
private Long editDistId;
private Window addDistributionWindow;
private String originalDistName;
private String originalDistVersion;
@@ -131,9 +131,9 @@ public class DistributionAddUpdateWindowLayout extends VerticalLayout {
final HorizontalLayout buttonsLayout = new HorizontalLayout();
buttonsLayout.setSizeFull();
buttonsLayout.setStyleName("dist-buttons-horz-layout");
buttonsLayout.addComponents(saveDistribution, discardDistribution);
buttonsLayout.setComponentAlignment(saveDistribution, Alignment.BOTTOM_LEFT);
buttonsLayout.setComponentAlignment(discardDistribution, Alignment.BOTTOM_RIGHT);
buttonsLayout.addComponents(saveDistributionBtn, discardDistributionBtn);
buttonsLayout.setComponentAlignment(saveDistributionBtn, Alignment.BOTTOM_LEFT);
buttonsLayout.setComponentAlignment(discardDistributionBtn, Alignment.BOTTOM_RIGHT);
buttonsLayout.addStyleName("window-style");
/*
@@ -186,14 +186,14 @@ public class DistributionAddUpdateWindowLayout extends VerticalLayout {
reqMigStepCheckbox.setId(SPUIComponetIdProvider.DIST_ADD_MIGRATION_CHECK);
/* save or update button */
saveDistribution = SPUIComponentProvider.getButton(SPUIComponetIdProvider.DIST_ADD_SAVE, "", "", "", true,
saveDistributionBtn = SPUIComponentProvider.getButton(SPUIComponetIdProvider.DIST_ADD_SAVE, "", "", "", true,
FontAwesome.SAVE, SPUIButtonStyleSmallNoBorder.class);
saveDistribution.addClickListener(event -> saveDistribution());
saveDistributionBtn.addClickListener(event -> saveDistribution());
/* close button */
discardDistribution = SPUIComponentProvider.getButton(SPUIComponetIdProvider.DIST_ADD_DISCARD, "", "", "", true,
FontAwesome.TIMES, SPUIButtonStyleSmallNoBorder.class);
discardDistribution.addClickListener(event -> discardDistribution());
discardDistributionBtn = SPUIComponentProvider.getButton(SPUIComponetIdProvider.DIST_ADD_DISCARD, "", "", "",
true, FontAwesome.TIMES, SPUIButtonStyleSmallNoBorder.class);
discardDistributionBtn.addClickListener(event -> discardDistribution());
}
/**
@@ -216,7 +216,7 @@ public class DistributionAddUpdateWindowLayout extends VerticalLayout {
}
private void enableSaveButton() {
saveDistribution.setEnabled(true);
saveDistributionBtn.setEnabled(true);
}
private DistributionSetType getDefaultDistributionSetType() {
@@ -226,7 +226,7 @@ public class DistributionAddUpdateWindowLayout extends VerticalLayout {
}
private void disableSaveButton() {
saveDistribution.setEnabled(false);
saveDistributionBtn.setEnabled(false);
}
private void saveDistribution() {
@@ -415,7 +415,7 @@ public class DistributionAddUpdateWindowLayout extends VerticalLayout {
distsetTypeNameComboBox.removeStyleName(SPUIStyleDefinitions.SP_COMBOFIELD_ERROR);
descTextArea.clear();
reqMigStepCheckbox.clear();
saveDistribution.setEnabled(true);
saveDistributionBtn.setEnabled(true);
removeListeners();
changedComponents.clear();
}
@@ -497,7 +497,7 @@ public class DistributionAddUpdateWindowLayout extends VerticalLayout {
public void populateValuesOfDistribution(final Long editDistId) {
this.editDistId = editDistId;
editDistribution = Boolean.TRUE;
saveDistribution.setEnabled(false);
saveDistributionBtn.setEnabled(false);
final DistributionSet distSet = distributionSetManagement.findDistributionSetByIdWithDetails(editDistId);
if (distSet != null) {
distNameTextField.setValue(distSet.getName());

View File

@@ -62,20 +62,20 @@ public class ManagementUIState implements Serializable {
private boolean distTagFilterClosed = true;
private Long targetsTruncated = null;
private Long targetsTruncated;
private final AtomicLong targetsCountAll = new AtomicLong();
private boolean isDsTableMaximized = Boolean.FALSE;
private boolean dsTableMaximized = Boolean.FALSE;
// Contains ID and NAme of last selected target
private DistributionSetIdName lastSelectedDsIdName;
// Contains list of ID and Names of all the selected Targets
private Set<DistributionSetIdName> selectedDsIdName = Collections.emptySet();
private boolean isTargetTableMaximized = Boolean.FALSE;
private boolean targetTableMaximized = Boolean.FALSE;
private boolean isActionHistoryMaximized = Boolean.FALSE;
private boolean actionHistoryMaximized = Boolean.FALSE;
private boolean noDataAvilableTarget = Boolean.FALSE;
@@ -255,11 +255,11 @@ public class ManagementUIState implements Serializable {
}
public boolean isDsTableMaximized() {
return isDsTableMaximized;
return dsTableMaximized;
}
public void setDsTableMaximized(final boolean isDsTableMaximized) {
this.isDsTableMaximized = isDsTableMaximized;
this.dsTableMaximized = isDsTableMaximized;
}
public DistributionSetIdName getLastSelectedDsIdName() {
@@ -282,7 +282,7 @@ public class ManagementUIState implements Serializable {
* @return the isTargetTableMaximized
*/
public boolean isTargetTableMaximized() {
return isTargetTableMaximized;
return targetTableMaximized;
}
/**
@@ -290,14 +290,14 @@ public class ManagementUIState implements Serializable {
* the isTargetTableMaximized to set
*/
public void setTargetTableMaximized(final boolean isTargetTableMaximized) {
this.isTargetTableMaximized = isTargetTableMaximized;
this.targetTableMaximized = isTargetTableMaximized;
}
/**
* @return the isActionHistoryMaximized
*/
public boolean isActionHistoryMaximized() {
return isActionHistoryMaximized;
return actionHistoryMaximized;
}
/**
@@ -305,7 +305,7 @@ public class ManagementUIState implements Serializable {
* the isActionHistoryMaximized to set
*/
public void setActionHistoryMaximized(final boolean isActionHistoryMaximized) {
this.isActionHistoryMaximized = isActionHistoryMaximized;
this.actionHistoryMaximized = isActionHistoryMaximized;
}
/**

View File

@@ -128,9 +128,9 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent {
private TextArea description;
private Button saveRollout;
private Button saveRolloutBtn;
private Button discardRolllout;
private Button discardRollloutBtn;
private OptionGroup errorThresholdOptionGroup;
@@ -138,7 +138,7 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent {
private Window addUpdateRolloutWindow;
private Boolean editRollout;
private Boolean editRolloutEnabled;
private Rollout rolloutForEdit;
@@ -167,7 +167,7 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent {
* Reset the field values.
*/
public void resetComponents() {
editRollout = Boolean.FALSE;
editRolloutEnabled = Boolean.FALSE;
rolloutName.clear();
targetFilterQuery.clear();
resetFields();
@@ -212,7 +212,7 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent {
final HorizontalLayout groupLayout = new HorizontalLayout();
groupLayout.setSizeFull();
groupLayout.addComponents(noOfGroups, groupSizeLabel);
groupLayout.setExpandRatio(noOfGroups, 1.0f);
groupLayout.setExpandRatio(noOfGroups, 1.0F);
groupLayout.setComponentAlignment(groupSizeLabel, Alignment.MIDDLE_LEFT);
return groupLayout;
}
@@ -221,7 +221,7 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent {
final HorizontalLayout errorThresoldLayout = new HorizontalLayout();
errorThresoldLayout.setSizeFull();
errorThresoldLayout.addComponents(errorThreshold, errorThresholdOptionGroup);
errorThresoldLayout.setExpandRatio(errorThreshold, 1.0f);
errorThresoldLayout.setExpandRatio(errorThreshold, 1.0F);
return errorThresoldLayout;
}
@@ -229,9 +229,9 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent {
final HorizontalLayout targetFilterLayout = new HorizontalLayout();
targetFilterLayout.setSizeFull();
targetFilterLayout.addComponents(targetFilterQueryCombo, targetFilterQuery, totalTargetsLabel);
targetFilterLayout.setExpandRatio(targetFilterQueryCombo, 0.71f);
targetFilterLayout.setExpandRatio(targetFilterQuery, 0.70f);
targetFilterLayout.setExpandRatio(totalTargetsLabel, 0.29f);
targetFilterLayout.setExpandRatio(targetFilterQueryCombo, 0.71F);
targetFilterLayout.setExpandRatio(targetFilterQuery, 0.70F);
targetFilterLayout.setExpandRatio(totalTargetsLabel, 0.29F);
targetFilterLayout.setComponentAlignment(totalTargetsLabel, Alignment.MIDDLE_LEFT);
return targetFilterLayout;
}
@@ -240,7 +240,7 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent {
final HorizontalLayout triggerThresholdLayout = new HorizontalLayout();
triggerThresholdLayout.setSizeFull();
triggerThresholdLayout.addComponents(triggerThreshold, getPercentHintLabel());
triggerThresholdLayout.setExpandRatio(triggerThreshold, 1.0f);
triggerThresholdLayout.setExpandRatio(triggerThreshold, 1.0F);
return triggerThresholdLayout;
}
@@ -254,9 +254,9 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent {
private HorizontalLayout getSaveDiscardButtonLayout() {
final HorizontalLayout buttonsLayout = new HorizontalLayout();
buttonsLayout.setSizeFull();
buttonsLayout.addComponents(saveRollout, discardRolllout);
buttonsLayout.setComponentAlignment(saveRollout, Alignment.BOTTOM_LEFT);
buttonsLayout.setComponentAlignment(discardRolllout, Alignment.BOTTOM_RIGHT);
buttonsLayout.addComponents(saveRolloutBtn, discardRollloutBtn);
buttonsLayout.setComponentAlignment(saveRolloutBtn, Alignment.BOTTOM_LEFT);
buttonsLayout.setComponentAlignment(discardRollloutBtn, Alignment.BOTTOM_RIGHT);
buttonsLayout.addStyleName("window-style");
return buttonsLayout;
}
@@ -277,8 +277,8 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent {
description = createDescription();
errorThresholdOptionGroup = createErrorThresholdOptionGroup();
setDefaultSaveStartGroupOption();
saveRollout = createSaveButton();
discardRolllout = createDiscardButton();
saveRolloutBtn = createSaveButton();
discardRollloutBtn = createDiscardButton();
actionTypeOptionGroupLayout.selectDefaultOption();
totalTargetsLabel = createTotalTargetsLabel();
@@ -383,8 +383,9 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent {
private Container createTargetFilterComboContainer() {
final BeanQueryFactory<TargetFilterBeanQuery> targetFilterQF = new BeanQueryFactory<>(
TargetFilterBeanQuery.class);
return new LazyQueryContainer(new LazyQueryDefinition(true, SPUIDefinitions.PAGE_SIZE,
SPUILabelDefinitions.VAR_NAME), targetFilterQF);
return new LazyQueryContainer(
new LazyQueryDefinition(true, SPUIDefinitions.PAGE_SIZE, SPUILabelDefinitions.VAR_NAME),
targetFilterQF);
}
@@ -410,7 +411,7 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent {
}
private void onRolloutSave() {
if (editRollout) {
if (editRolloutEnabled) {
editRollout();
} else {
createRollout();
@@ -422,8 +423,8 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent {
rolloutForEdit.setName(rolloutName.getValue());
rolloutForEdit.setDescription(description.getValue());
final DistributionSetIdName distributionSetIdName = (DistributionSetIdName) distributionSet.getValue();
rolloutForEdit.setDistributionSet(distributionSetManagement.findDistributionSetById(distributionSetIdName
.getId()));
rolloutForEdit.setDistributionSet(
distributionSetManagement.findDistributionSetById(distributionSetIdName.getId()));
rolloutForEdit.setActionType(getActionType());
rolloutForEdit.setForcedTime(getForcedTimeStamp());
final int amountGroup = Integer.parseInt(noOfGroups.getValue());
@@ -453,8 +454,9 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent {
private long getForcedTimeStamp() {
return (((ActionTypeOptionGroupLayout.ActionTypeOption) actionTypeOptionGroupLayout.getActionTypeOptionGroup()
.getValue()) == ActionTypeOption.AUTO_FORCED) ? actionTypeOptionGroupLayout.getForcedTimeDateField()
.getValue().getTime() : Action.NO_FORCE_TIME;
.getValue()) == ActionTypeOption.AUTO_FORCED)
? actionTypeOptionGroupLayout.getForcedTimeDateField().getValue().getTime()
: Action.NO_FORCE_TIME;
}
private ActionType getActionType() {
@@ -487,8 +489,8 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent {
rolloutToCreate.setName(rolloutName.getValue());
rolloutToCreate.setDescription(description.getValue());
rolloutToCreate.setTargetFilterQuery(targetFilter);
rolloutToCreate.setDistributionSet(distributionSetManagement.findDistributionSetById(distributionSetIdName
.getId()));
rolloutToCreate
.setDistributionSet(distributionSetManagement.findDistributionSetById(distributionSetIdName.getId()));
rolloutToCreate.setActionType(getActionType());
rolloutToCreate.setForcedTime(getForcedTimeStamp());
@@ -499,8 +501,8 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent {
private String getTargetFilterQuery() {
if (null != targetFilterQueryCombo.getValue()
&& HawkbitCommonUtil.trimAndNullIfEmpty((String) targetFilterQueryCombo.getValue()) != null) {
final Item filterItem = targetFilterQueryCombo.getContainerDataSource().getItem(
targetFilterQueryCombo.getValue());
final Item filterItem = targetFilterQueryCombo.getContainerDataSource()
.getItem(targetFilterQueryCombo.getValue());
return (String) filterItem.getItemProperty("query").getValue();
}
return null;
@@ -568,8 +570,8 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent {
private boolean duplicateCheck() {
if (rolloutManagement.findRolloutByName(getRolloutName()) != null) {
uiNotification.displayValidationError(i18n.get("message.rollout.duplicate.check",
new Object[] { getRolloutName() }));
uiNotification.displayValidationError(
i18n.get("message.rollout.duplicate.check", new Object[] { getRolloutName() }));
return false;
}
return true;
@@ -580,9 +582,8 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent {
}
private TextArea createDescription() {
final TextArea descriptionField = SPUIComponentProvider.getTextArea("text-area-style",
ValoTheme.TEXTFIELD_TINY, false, null, i18n.get("textfield.description"),
SPUILabelDefinitions.TEXT_AREA_MAX_LENGTH);
final TextArea descriptionField = SPUIComponentProvider.getTextArea("text-area-style", ValoTheme.TEXTFIELD_TINY,
false, null, i18n.get("textfield.description"), SPUILabelDefinitions.TEXT_AREA_MAX_LENGTH);
descriptionField.setId(SPUIComponetIdProvider.ROLLOUT_DESCRIPTION_ID);
descriptionField.setNullRepresentation(HawkbitCommonUtil.SP_STRING_EMPTY);
descriptionField.setSizeFull();
@@ -646,9 +647,10 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent {
}
private Container createDsComboContainer() {
final BeanQueryFactory<DistributionBeanQuery> distributionQF = new BeanQueryFactory<>(DistributionBeanQuery.class);
return new LazyQueryContainer(new LazyQueryDefinition(true, SPUIDefinitions.PAGE_SIZE,
SPUILabelDefinitions.VAR_DIST_ID_NAME), distributionQF);
final BeanQueryFactory<DistBeanQuery> distributionQF = new BeanQueryFactory<>(DistBeanQuery.class);
return new LazyQueryContainer(
new LazyQueryDefinition(true, SPUIDefinitions.PAGE_SIZE, SPUILabelDefinitions.VAR_DIST_ID_NAME),
distributionQF);
}
@@ -682,8 +684,8 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent {
try {
if (HawkbitCommonUtil.trimAndNullIfEmpty(noOfGroups.getValue()) == null
|| HawkbitCommonUtil.trimAndNullIfEmpty((String) targetFilterQueryCombo.getValue()) == null) {
uiNotification.displayValidationError(i18n
.get("message.rollout.noofgroups.or.targetfilter.missing"));
uiNotification
.displayValidationError(i18n.get("message.rollout.noofgroups.or.targetfilter.missing"));
} else {
new RegexpValidator(NUMBER_REGEXP, i18n.get(MESSAGE_ENTER_NUMBER)).validate(value);
final int groupSize = getGroupSize();
@@ -708,8 +710,8 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent {
public void validate(final Object value) {
try {
new RegexpValidator(NUMBER_REGEXP, i18n.get(MESSAGE_ENTER_NUMBER)).validate(value);
new IntegerRangeValidator(i18n.get(MESSAGE_ROLLOUT_FIELD_VALUE_RANGE, 0, 100), 0, 100).validate(Integer
.valueOf(value.toString()));
new IntegerRangeValidator(i18n.get(MESSAGE_ROLLOUT_FIELD_VALUE_RANGE, 0, 100), 0, 100)
.validate(Integer.valueOf(value.toString()));
} catch (final InvalidValueException ex) {
throw ex;
}
@@ -723,8 +725,8 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent {
public void validate(final Object value) {
try {
new RegexpValidator(NUMBER_REGEXP, i18n.get(MESSAGE_ENTER_NUMBER)).validate(value);
new IntegerRangeValidator(i18n.get(MESSAGE_ROLLOUT_FIELD_VALUE_RANGE, 0, 500), 0, 500).validate(Integer
.valueOf(value.toString()));
new IntegerRangeValidator(i18n.get(MESSAGE_ROLLOUT_FIELD_VALUE_RANGE, 0, 500), 0, 500)
.validate(Integer.valueOf(value.toString()));
} catch (final InvalidValueException ex) {
throw ex;
}
@@ -740,7 +742,7 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent {
*/
public void populateData(final Long rolloutId) {
resetComponents();
editRollout = Boolean.TRUE;
editRolloutEnabled = Boolean.TRUE;
rolloutForEdit = rolloutManagement.findRolloutById(rolloutId);
rolloutName.setValue(rolloutForEdit.getName());
description.setValue(rolloutForEdit.getDescription());

View File

@@ -86,7 +86,7 @@ public class GatewaySecurityTokenAuthenticationConfigurationItem extends Abstrac
gatewayTokenNameTextField.setImmediate(true);
// hide text field until we support multiple gateway tokens for a tenan
gatewayTokenNameTextField.setVisible(false);
gatewayTokenNameTextField.addTextChangeListener(event -> keyNameChanged());
gatewayTokenNameTextField.addTextChangeListener(event -> doKeyNameChanged());
final Button gatewaytokenBtn = SPUIComponentProvider.getButton("TODO-ID", "Regenerate Key", "",
ValoTheme.BUTTON_TINY + " " + "redicon", true, null, SPUIButtonStyleSmall.class);
@@ -116,10 +116,7 @@ public class GatewaySecurityTokenAuthenticationConfigurationItem extends Abstrac
}
}
/**
* @return
*/
private void keyNameChanged() {
private void doKeyNameChanged() {
keyNameChanged = true;
notifyConfigurationChanged();
}