Merge branch 'master' into Multiple_VHost_Connection
Conflicts: hawkbit-dmf-amqp/src/test/java/org/eclipse/hawkbit/amqp/AmqpMessageHandlerServiceTest.java hawkbit-security-core/src/test/java/org/eclipse/hawkbit/util/IpUtilTest.java Signed-off-by: SirWayne <dennis.melzer@bosch-si.com>
This commit is contained in:
5
.gitignore
vendored
5
.gitignore
vendored
@@ -16,6 +16,11 @@
|
|||||||
*.jar
|
*.jar
|
||||||
*.war
|
*.war
|
||||||
|
|
||||||
|
######################
|
||||||
|
# Sonar
|
||||||
|
######################
|
||||||
|
.sonar_lock
|
||||||
|
|
||||||
# Eclipse IDE
|
# Eclipse IDE
|
||||||
|
|
||||||
*.pydevproject
|
*.pydevproject
|
||||||
|
|||||||
3
3rd-dependencies/README.md
Normal file
3
3rd-dependencies/README.md
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# 3rd Party Dependencies
|
||||||
|
|
||||||
|
Contains listing of all maven (transient) licenses of the project. Is primary used to identify all changes between eclipse releases.
|
||||||
@@ -15,8 +15,8 @@ hawkbit.server.controller.security.authentication.gatewaytoken.enabled=false
|
|||||||
|
|
||||||
spring.profiles.active=amqp
|
spring.profiles.active=amqp
|
||||||
|
|
||||||
vaadin.servlet.params.productionMode=false
|
vaadin.servlet.productionMode=false
|
||||||
vaadin.static.servlet.params.productionMode=false
|
vaadin.static.servlet.productionMode=false
|
||||||
|
|
||||||
## Configuration for RabbitMQ integration
|
## Configuration for RabbitMQ integration
|
||||||
hawkbit.server.amqp.username=guest
|
hawkbit.server.amqp.username=guest
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ public class MongoDBTestRule implements TestRule {
|
|||||||
System.setProperty("spring.data.mongodb.port", String.valueOf(port));
|
System.setProperty("spring.data.mongodb.port", String.valueOf(port));
|
||||||
}
|
}
|
||||||
|
|
||||||
Version version = Version.V3_1_0;
|
Version version = Version.V3_0_8;
|
||||||
if (System.getProperty("inf.mongodb.version") != null) {
|
if (System.getProperty("inf.mongodb.version") != null) {
|
||||||
version = Version.valueOf("V" + System.getProperty("inf.mongodb.version").trim().replaceAll("\\.", "_"));
|
version = Version.valueOf("V" + System.getProperty("inf.mongodb.version").trim().replaceAll("\\.", "_"));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,10 +29,8 @@ flyway.initOnMigrate=true
|
|||||||
flyway.sqlMigrationSuffix=${spring.jpa.database}.sql
|
flyway.sqlMigrationSuffix=${spring.jpa.database}.sql
|
||||||
|
|
||||||
# Vaadin Servlet
|
# Vaadin Servlet
|
||||||
vaadin.static.servlet.params.resourceCacheTime=${spring.resources.cache-period}
|
vaadin.static.servlet.productionMode=true
|
||||||
vaadin.static.servlet.params.productionMode=true
|
vaadin.servlet.productionMode=true
|
||||||
vaadin.servlet.params.productionMode=true
|
|
||||||
vaadin.servlet.params.resourceCacheTime=${spring.resources.cache-period}
|
|
||||||
vaadin.servlet.urlMapping=/UI/*
|
vaadin.servlet.urlMapping=/UI/*
|
||||||
vaadin.servlet.params.heartbeatInterval=60
|
vaadin.servlet.params.heartbeatInterval=60
|
||||||
vaadin.servlet.params.closeIdleSessions=false
|
vaadin.servlet.params.closeIdleSessions=false
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ public class RedisConfiguration {
|
|||||||
*/
|
*/
|
||||||
@Bean
|
@Bean
|
||||||
public RedisTemplate<String, Object> redisTemplate() {
|
public RedisTemplate<String, Object> redisTemplate() {
|
||||||
final RedisTemplate<String, Object> redisTemplate = new RedisTemplate<String, Object>();
|
final RedisTemplate<String, Object> redisTemplate = new RedisTemplate<>();
|
||||||
redisTemplate.setConnectionFactory(jedisConnectionFactory());
|
redisTemplate.setConnectionFactory(jedisConnectionFactory());
|
||||||
redisTemplate.setKeySerializer(new JdkSerializationRedisSerializer());
|
redisTemplate.setKeySerializer(new JdkSerializationRedisSerializer());
|
||||||
redisTemplate.setHashValueSerializer(new JdkSerializationRedisSerializer());
|
redisTemplate.setHashValueSerializer(new JdkSerializationRedisSerializer());
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ public class EventDistributor {
|
|||||||
* wants to subscribe
|
* wants to subscribe
|
||||||
*/
|
*/
|
||||||
public Collection<Topic> getTopics() {
|
public Collection<Topic> getTopics() {
|
||||||
final List<Topic> topics = new ArrayList<Topic>();
|
final List<Topic> topics = new ArrayList<>();
|
||||||
topics.add(new PatternTopic(SUB_DISTRIBUTION_CHANNEL));
|
topics.add(new PatternTopic(SUB_DISTRIBUTION_CHANNEL));
|
||||||
return topics;
|
return topics;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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")
|
||||||
@@ -82,24 +82,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
|
||||||
|
|||||||
@@ -93,7 +93,8 @@ public class AmqpMessageDispatcherServiceTest extends AbstractIntegrationTestWit
|
|||||||
amqpMessageDispatcherService.targetAssignDistributionSet(targetAssignDistributionSetEvent);
|
amqpMessageDispatcherService.targetAssignDistributionSet(targetAssignDistributionSetEvent);
|
||||||
final Message sendMessage = createArgumentCapture(targetAssignDistributionSetEvent.getTargetAdress());
|
final Message sendMessage = createArgumentCapture(targetAssignDistributionSetEvent.getTargetAdress());
|
||||||
final DownloadAndUpdateRequest downloadAndUpdateRequest = assertDownloadAndInstallMessage(sendMessage);
|
final DownloadAndUpdateRequest downloadAndUpdateRequest = assertDownloadAndInstallMessage(sendMessage);
|
||||||
assertTrue(downloadAndUpdateRequest.getSoftwareModules().isEmpty());
|
assertTrue("No softwaremmodule should be contained in the request",
|
||||||
|
downloadAndUpdateRequest.getSoftwareModules().isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -106,17 +107,22 @@ public class AmqpMessageDispatcherServiceTest extends AbstractIntegrationTestWit
|
|||||||
amqpMessageDispatcherService.targetAssignDistributionSet(targetAssignDistributionSetEvent);
|
amqpMessageDispatcherService.targetAssignDistributionSet(targetAssignDistributionSetEvent);
|
||||||
final Message sendMessage = createArgumentCapture(targetAssignDistributionSetEvent.getTargetAdress());
|
final Message sendMessage = createArgumentCapture(targetAssignDistributionSetEvent.getTargetAdress());
|
||||||
final DownloadAndUpdateRequest downloadAndUpdateRequest = assertDownloadAndInstallMessage(sendMessage);
|
final DownloadAndUpdateRequest downloadAndUpdateRequest = assertDownloadAndInstallMessage(sendMessage);
|
||||||
assertEquals(3, downloadAndUpdateRequest.getSoftwareModules().size());
|
assertEquals("Expecting a size of 3 software modules in the reuqest", 3,
|
||||||
|
downloadAndUpdateRequest.getSoftwareModules().size());
|
||||||
for (final org.eclipse.hawkbit.dmf.json.model.SoftwareModule softwareModule : downloadAndUpdateRequest
|
for (final org.eclipse.hawkbit.dmf.json.model.SoftwareModule softwareModule : downloadAndUpdateRequest
|
||||||
.getSoftwareModules()) {
|
.getSoftwareModules()) {
|
||||||
assertTrue(softwareModule.getArtifacts().isEmpty());
|
assertTrue("Artifact list for softwaremodule should be empty", softwareModule.getArtifacts().isEmpty());
|
||||||
for (final SoftwareModule softwareModule2 : dsA.getModules()) {
|
for (final SoftwareModule softwareModule2 : dsA.getModules()) {
|
||||||
assertNotNull(softwareModule.getModuleId());
|
assertNotNull("Sofware module ID should be set", softwareModule.getModuleId());
|
||||||
if (!softwareModule.getModuleId().equals(softwareModule2.getId())) {
|
if (!softwareModule.getModuleId().equals(softwareModule2.getId())) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
assertEquals(softwareModule.getModuleType(), softwareModule2.getType().getKey());
|
assertEquals(
|
||||||
assertEquals(softwareModule.getModuleVersion(), softwareModule2.getVersion());
|
"Software module type in event should be the same as the softwaremodule in the distribution set",
|
||||||
|
softwareModule.getModuleType(), softwareModule2.getType().getKey());
|
||||||
|
assertEquals(
|
||||||
|
"Software module version in event should be the same as the softwaremodule in the distribution set",
|
||||||
|
softwareModule.getModuleVersion(), softwareModule2.getVersion());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -140,13 +146,14 @@ public class AmqpMessageDispatcherServiceTest extends AbstractIntegrationTestWit
|
|||||||
amqpMessageDispatcherService.targetAssignDistributionSet(targetAssignDistributionSetEvent);
|
amqpMessageDispatcherService.targetAssignDistributionSet(targetAssignDistributionSetEvent);
|
||||||
final Message sendMessage = createArgumentCapture(targetAssignDistributionSetEvent.getTargetAdress());
|
final Message sendMessage = createArgumentCapture(targetAssignDistributionSetEvent.getTargetAdress());
|
||||||
final DownloadAndUpdateRequest downloadAndUpdateRequest = assertDownloadAndInstallMessage(sendMessage);
|
final DownloadAndUpdateRequest downloadAndUpdateRequest = assertDownloadAndInstallMessage(sendMessage);
|
||||||
assertEquals(3, downloadAndUpdateRequest.getSoftwareModules().size());
|
assertEquals("DownloadAndUpdateRequest event should contains 3 software modules", 3,
|
||||||
|
downloadAndUpdateRequest.getSoftwareModules().size());
|
||||||
for (final org.eclipse.hawkbit.dmf.json.model.SoftwareModule softwareModule : downloadAndUpdateRequest
|
for (final org.eclipse.hawkbit.dmf.json.model.SoftwareModule softwareModule : downloadAndUpdateRequest
|
||||||
.getSoftwareModules()) {
|
.getSoftwareModules()) {
|
||||||
if (!softwareModule.getModuleId().equals(module.getId())) {
|
if (!softwareModule.getModuleId().equals(module.getId())) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
assertFalse(softwareModule.getArtifacts().isEmpty());
|
assertFalse("The software module artifacts should not be empty", softwareModule.getArtifacts().isEmpty());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -165,8 +172,8 @@ public class AmqpMessageDispatcherServiceTest extends AbstractIntegrationTestWit
|
|||||||
private void assertCancelMessage(final Message sendMessage) {
|
private void assertCancelMessage(final Message sendMessage) {
|
||||||
assertEventMessage(sendMessage);
|
assertEventMessage(sendMessage);
|
||||||
final Long actionId = convertMessage(sendMessage, Long.class);
|
final Long actionId = convertMessage(sendMessage, Long.class);
|
||||||
assertEquals(actionId, Long.valueOf(1));
|
assertEquals("Action ID should be 1", actionId, Long.valueOf(1));
|
||||||
assertEquals(EventTopic.CANCEL_DOWNLOAD,
|
assertEquals("The topc in the message should be a CANCEL_DOWNLOAD value", EventTopic.CANCEL_DOWNLOAD,
|
||||||
sendMessage.getMessageProperties().getHeaders().get(MessageHeaderKey.TOPIC));
|
sendMessage.getMessageProperties().getHeaders().get(MessageHeaderKey.TOPIC));
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -175,8 +182,9 @@ public class AmqpMessageDispatcherServiceTest extends AbstractIntegrationTestWit
|
|||||||
assertEventMessage(sendMessage);
|
assertEventMessage(sendMessage);
|
||||||
final DownloadAndUpdateRequest downloadAndUpdateRequest = convertMessage(sendMessage,
|
final DownloadAndUpdateRequest downloadAndUpdateRequest = convertMessage(sendMessage,
|
||||||
DownloadAndUpdateRequest.class);
|
DownloadAndUpdateRequest.class);
|
||||||
assertEquals(downloadAndUpdateRequest.getActionId(), Long.valueOf(1));
|
assertEquals("The action ID of the downloadAndUpdateRequest event shuold be 1",
|
||||||
assertEquals(EventTopic.DOWNLOAD_AND_INSTALL,
|
downloadAndUpdateRequest.getActionId(), Long.valueOf(1));
|
||||||
|
assertEquals("The topic of the event shuold contain DOWNLOAD_AND_INSTALL", EventTopic.DOWNLOAD_AND_INSTALL,
|
||||||
sendMessage.getMessageProperties().getHeaders().get(MessageHeaderKey.TOPIC));
|
sendMessage.getMessageProperties().getHeaders().get(MessageHeaderKey.TOPIC));
|
||||||
return downloadAndUpdateRequest;
|
return downloadAndUpdateRequest;
|
||||||
|
|
||||||
@@ -186,11 +194,14 @@ public class AmqpMessageDispatcherServiceTest extends AbstractIntegrationTestWit
|
|||||||
* @param sendMessage
|
* @param sendMessage
|
||||||
*/
|
*/
|
||||||
private void assertEventMessage(final Message sendMessage) {
|
private void assertEventMessage(final Message sendMessage) {
|
||||||
assertNotNull(sendMessage);
|
assertNotNull("The message should not be null", sendMessage);
|
||||||
|
|
||||||
assertEquals(CONTROLLER_ID, sendMessage.getMessageProperties().getHeaders().get(MessageHeaderKey.THING_ID));
|
assertEquals("The value of the message header THING_ID should be " + CONTROLLER_ID, CONTROLLER_ID,
|
||||||
assertEquals(MessageType.EVENT, sendMessage.getMessageProperties().getHeaders().get(MessageHeaderKey.TYPE));
|
sendMessage.getMessageProperties().getHeaders().get(MessageHeaderKey.THING_ID));
|
||||||
assertEquals(MessageProperties.CONTENT_TYPE_JSON, sendMessage.getMessageProperties().getContentType());
|
assertEquals("The value of the message header TYPE should be EVENT", MessageType.EVENT,
|
||||||
|
sendMessage.getMessageProperties().getHeaders().get(MessageHeaderKey.TYPE));
|
||||||
|
assertEquals("The content type message should be " + MessageProperties.CONTENT_TYPE_JSON,
|
||||||
|
MessageProperties.CONTENT_TYPE_JSON, sendMessage.getMessageProperties().getContentType());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Message createArgumentCapture(final URI uri) {
|
protected Message createArgumentCapture(final URI uri) {
|
||||||
|
|||||||
@@ -133,18 +133,16 @@ public class AmqpMessageHandlerServiceTest {
|
|||||||
messageProperties.setHeader(MessageHeaderKey.THING_ID, "1");
|
messageProperties.setHeader(MessageHeaderKey.THING_ID, "1");
|
||||||
final Message message = messageConverter.toMessage(new byte[0], messageProperties);
|
final Message message = messageConverter.toMessage(new byte[0], messageProperties);
|
||||||
|
|
||||||
// mock
|
|
||||||
final ArgumentCaptor<String> targetIdCaptor = ArgumentCaptor.forClass(String.class);
|
final ArgumentCaptor<String> targetIdCaptor = ArgumentCaptor.forClass(String.class);
|
||||||
final ArgumentCaptor<URI> uriCaptor = ArgumentCaptor.forClass(URI.class);
|
final ArgumentCaptor<URI> uriCaptor = ArgumentCaptor.forClass(URI.class);
|
||||||
when(controllerManagementMock.findOrRegisterTargetIfItDoesNotexist(targetIdCaptor.capture(),
|
when(controllerManagementMock.findOrRegisterTargetIfItDoesNotexist(targetIdCaptor.capture(),
|
||||||
uriCaptor.capture())).thenReturn(null);
|
uriCaptor.capture())).thenReturn(null);
|
||||||
|
|
||||||
// test
|
|
||||||
amqpMessageHandlerService.onMessage(message, MessageType.THING_CREATED.name(), TENANT, "vHost");
|
amqpMessageHandlerService.onMessage(message, MessageType.THING_CREATED.name(), TENANT, "vHost");
|
||||||
|
|
||||||
// verify
|
// verify
|
||||||
assertThat(targetIdCaptor.getValue()).isEqualTo(knownThingId);
|
assertThat(targetIdCaptor.getValue()).as("Thing id is wrong").isEqualTo(knownThingId);
|
||||||
assertThat(uriCaptor.getValue().toString()).isEqualTo("amqp://vHost/MyTest");
|
assertThat(uriCaptor.getValue().toString()).as("Uri is not right").isEqualTo("amqp://vHost/MyTest");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -271,8 +269,9 @@ public class AmqpMessageHandlerServiceTest {
|
|||||||
|
|
||||||
// verify
|
// verify
|
||||||
final DownloadResponse downloadResponse = (DownloadResponse) messageConverter.fromMessage(onMessage);
|
final DownloadResponse downloadResponse = (DownloadResponse) messageConverter.fromMessage(onMessage);
|
||||||
assertThat(downloadResponse).isNotNull();
|
assertThat(downloadResponse).as("Message body should not null").isNotNull();
|
||||||
assertThat(downloadResponse.getResponseCode()).isEqualTo(HttpStatus.NOT_FOUND.value());
|
assertThat(downloadResponse.getResponseCode()).as("Message body response code is wrong")
|
||||||
|
.isEqualTo(HttpStatus.NOT_FOUND.value());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -294,8 +293,9 @@ public class AmqpMessageHandlerServiceTest {
|
|||||||
|
|
||||||
// verify
|
// verify
|
||||||
final DownloadResponse downloadResponse = (DownloadResponse) messageConverter.fromMessage(onMessage);
|
final DownloadResponse downloadResponse = (DownloadResponse) messageConverter.fromMessage(onMessage);
|
||||||
assertThat(downloadResponse).isNotNull();
|
assertThat(downloadResponse).as("Message body should not null").isNotNull();
|
||||||
assertThat(downloadResponse.getResponseCode()).isEqualTo(HttpStatus.NOT_FOUND.value());
|
assertThat(downloadResponse.getResponseCode()).as("Message body response code is wrong")
|
||||||
|
.isEqualTo(HttpStatus.NOT_FOUND.value());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -325,9 +325,10 @@ public class AmqpMessageHandlerServiceTest {
|
|||||||
|
|
||||||
// verify
|
// verify
|
||||||
final DownloadResponse downloadResponse = (DownloadResponse) messageConverter.fromMessage(onMessage);
|
final DownloadResponse downloadResponse = (DownloadResponse) messageConverter.fromMessage(onMessage);
|
||||||
assertThat(downloadResponse).isNotNull();
|
assertThat(downloadResponse).as("Message body should not null").isNotNull();
|
||||||
assertThat(downloadResponse.getResponseCode()).isEqualTo(HttpStatus.OK.value());
|
assertThat(downloadResponse.getResponseCode()).as("Message body response code is wrong")
|
||||||
assertThat(downloadResponse.getArtifact().getSize()).isEqualTo(1L);
|
.isEqualTo(HttpStatus.OK.value());
|
||||||
|
assertThat(downloadResponse.getArtifact().getSize()).as("Wrong artifact size in message body").isEqualTo(1L);
|
||||||
assertThat(downloadResponse.getDownloadUrl()).startsWith("http://localhost/api/v1/downloadserver/downloadId/");
|
assertThat(downloadResponse.getDownloadUrl()).startsWith("http://localhost/api/v1/downloadserver/downloadId/");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -364,9 +365,11 @@ public class AmqpMessageHandlerServiceTest {
|
|||||||
final TargetAssignDistributionSetEvent targetAssignDistributionSetEvent = captorTargetAssignDistributionSetEvent
|
final TargetAssignDistributionSetEvent targetAssignDistributionSetEvent = captorTargetAssignDistributionSetEvent
|
||||||
.getValue();
|
.getValue();
|
||||||
|
|
||||||
assertThat(targetAssignDistributionSetEvent.getControllerId()).isEqualTo("target1");
|
assertThat(targetAssignDistributionSetEvent.getControllerId()).as("event has wrong controller id")
|
||||||
assertThat(targetAssignDistributionSetEvent.getActionId()).isEqualTo(22L);
|
.isEqualTo("target1");
|
||||||
assertThat(targetAssignDistributionSetEvent.getSoftwareModules()).isEqualTo(softwareModuleList);
|
assertThat(targetAssignDistributionSetEvent.getActionId()).as("event has wrong action id").isEqualTo(22L);
|
||||||
|
assertThat(targetAssignDistributionSetEvent.getSoftwareModules()).as("event has wrong sofware modules")
|
||||||
|
.isEqualTo(softwareModuleList);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public class ListReportSeries extends AbstractReportSeries {
|
public class ListReportSeries extends AbstractReportSeries {
|
||||||
|
|
||||||
private final List<Number> data = new ArrayList<Number>();
|
private final List<Number> data = new ArrayList<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param name
|
* @param name
|
||||||
|
|||||||
@@ -37,19 +37,9 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
*/
|
*/
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true)
|
||||||
public interface ActionRepository extends BaseEntityRepository<Action, Long>, JpaSpecificationExecutor<Action> {
|
public interface ActionRepository extends BaseEntityRepository<Action, Long>, JpaSpecificationExecutor<Action> {
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.springframework.data.repository.CrudRepository#findAll()
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
@EntityGraph(value = "Action.all", type = EntityGraphType.LOAD)
|
|
||||||
Iterable<Action> findAll();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves an Action with all lazy attributes.
|
* Retrieves an Action with all lazy attributes.
|
||||||
*
|
*
|
||||||
* @param actionId
|
* @param actionId
|
||||||
* the ID of the action
|
* the ID of the action
|
||||||
* @return the found {@link Action}
|
* @return the found {@link Action}
|
||||||
@@ -67,13 +57,12 @@ public interface ActionRepository extends BaseEntityRepository<Action, Long>, Jp
|
|||||||
* the {@link DistributionSet} on which will be filtered
|
* the {@link DistributionSet} on which will be filtered
|
||||||
* @return the found {@link Action}s
|
* @return the found {@link Action}s
|
||||||
*/
|
*/
|
||||||
@EntityGraph(value = "Action.all", type = EntityGraphType.LOAD)
|
|
||||||
Page<Action> findByDistributionSet(final Pageable pageable, final DistributionSet ds);
|
Page<Action> findByDistributionSet(final Pageable pageable, final DistributionSet ds);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves all {@link Action}s which are referring the given
|
* Retrieves all {@link Action}s which are referring the given
|
||||||
* {@link Target}.
|
* {@link Target}.
|
||||||
*
|
*
|
||||||
* @param pageable
|
* @param pageable
|
||||||
* page parameters
|
* page parameters
|
||||||
* @param target
|
* @param target
|
||||||
@@ -84,8 +73,9 @@ public interface ActionRepository extends BaseEntityRepository<Action, Long>, Jp
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves all {@link Action}s which are active and referring the given
|
* Retrieves all {@link Action}s which are active and referring the given
|
||||||
* {@link Target} in a specified order.
|
* {@link Target} in a specified order. Loads also the lazy
|
||||||
*
|
* {@link Action#getDistributionSet()} field.
|
||||||
|
*
|
||||||
* @param pageable
|
* @param pageable
|
||||||
* page parameters
|
* page parameters
|
||||||
* @param target
|
* @param target
|
||||||
@@ -125,14 +115,13 @@ public interface ActionRepository extends BaseEntityRepository<Action, Long>, Jp
|
|||||||
* @return the found {@link UpdateAction}s
|
* @return the found {@link UpdateAction}s
|
||||||
*/
|
*/
|
||||||
@Query("Select a from Action a where a.target = :target and a.distributionSet = :ds order by a.id")
|
@Query("Select a from Action a where a.target = :target and a.distributionSet = :ds order by a.id")
|
||||||
@EntityGraph(value = "Action.all", type = EntityGraphType.LOAD)
|
|
||||||
Page<Action> findByTargetAndDistributionSet(final Pageable pageable, @Param("target") final Target target,
|
Page<Action> findByTargetAndDistributionSet(final Pageable pageable, @Param("target") final Target target,
|
||||||
@Param("ds") DistributionSet ds);
|
@Param("ds") DistributionSet ds);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves all {@link Action}s of a specific target, without pagination
|
* Retrieves all {@link Action}s of a specific target, without pagination
|
||||||
* ordered by action ID.
|
* ordered by action ID.
|
||||||
*
|
*
|
||||||
* @param target
|
* @param target
|
||||||
* to search for
|
* to search for
|
||||||
* @return a list of actions according to the searched target
|
* @return a list of actions according to the searched target
|
||||||
@@ -143,7 +132,7 @@ public interface ActionRepository extends BaseEntityRepository<Action, Long>, Jp
|
|||||||
/**
|
/**
|
||||||
* Retrieves all {@link Action}s of a specific target and given active flag
|
* Retrieves all {@link Action}s of a specific target and given active flag
|
||||||
* ordered by action ID.
|
* ordered by action ID.
|
||||||
*
|
*
|
||||||
* @param pageable
|
* @param pageable
|
||||||
* the pagination parameter
|
* the pagination parameter
|
||||||
* @param target
|
* @param target
|
||||||
@@ -159,8 +148,9 @@ public interface ActionRepository extends BaseEntityRepository<Action, Long>, Jp
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves all {@link Action}s of a specific target and given active flag
|
* Retrieves all {@link Action}s of a specific target and given active flag
|
||||||
* ordered by action ID.
|
* ordered by action ID. Loads also the lazy
|
||||||
*
|
* {@link Action#getDistributionSet()} field.
|
||||||
|
*
|
||||||
* @param target
|
* @param target
|
||||||
* to search for
|
* to search for
|
||||||
* @param active
|
* @param active
|
||||||
@@ -174,7 +164,7 @@ public interface ActionRepository extends BaseEntityRepository<Action, Long>, Jp
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates all {@link Action} to inactive for all targets with given ID.
|
* Updates all {@link Action} to inactive for all targets with given ID.
|
||||||
*
|
*
|
||||||
* @param keySet
|
* @param keySet
|
||||||
* the list of actions to set inactive
|
* the list of actions to set inactive
|
||||||
* @param targetsIds
|
* @param targetsIds
|
||||||
@@ -190,7 +180,7 @@ public interface ActionRepository extends BaseEntityRepository<Action, Long>, Jp
|
|||||||
* Switches the status of actions from one specific status into another,
|
* Switches the status of actions from one specific status into another,
|
||||||
* only if the actions are in a specific status. This should be a atomar
|
* only if the actions are in a specific status. This should be a atomar
|
||||||
* operation.
|
* operation.
|
||||||
*
|
*
|
||||||
* @param statusToSet
|
* @param statusToSet
|
||||||
* the new status the actions should get
|
* the new status the actions should get
|
||||||
* @param targetIds
|
* @param targetIds
|
||||||
@@ -210,7 +200,7 @@ public interface ActionRepository extends BaseEntityRepository<Action, Long>, Jp
|
|||||||
* Switches the status of actions from one specific status into another,
|
* Switches the status of actions from one specific status into another,
|
||||||
* only if the actions are in a specific status. This should be a atomar
|
* only if the actions are in a specific status. This should be a atomar
|
||||||
* operation.
|
* operation.
|
||||||
*
|
*
|
||||||
* @param statusToSet
|
* @param statusToSet
|
||||||
* the new status the actions should get
|
* the new status the actions should get
|
||||||
* @param rollout
|
* @param rollout
|
||||||
@@ -227,7 +217,7 @@ public interface ActionRepository extends BaseEntityRepository<Action, Long>, Jp
|
|||||||
@Param("active") boolean active, @Param("currentStatus") Action.Status currentStatus);
|
@Param("active") boolean active, @Param("currentStatus") Action.Status currentStatus);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Retrieves all {@link Action}s which are active and referring to the given
|
* Retrieves all {@link Action}s which are active and referring to the given
|
||||||
* target Ids and distribution set required migration step.
|
* target Ids and distribution set required migration step.
|
||||||
*
|
*
|
||||||
@@ -243,36 +233,24 @@ public interface ActionRepository extends BaseEntityRepository<Action, Long>, Jp
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Counts all {@link Action}s referring to the given target.
|
* Counts all {@link Action}s referring to the given target.
|
||||||
*
|
*
|
||||||
* @param target
|
* @param target
|
||||||
* the target to count the {@link Action}s
|
* the target to count the {@link Action}s
|
||||||
* @return the count of actions referring to the given target
|
* @return the count of actions referring to the given target
|
||||||
*/
|
*/
|
||||||
Long countByTarget(Target target);
|
Long countByTarget(Target target);
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.springframework.data.repository.CrudRepository#save(java.lang.
|
|
||||||
* Iterable)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
@CacheEvict(value = "feedbackReceivedOverTime", allEntries = true)
|
@CacheEvict(value = "feedbackReceivedOverTime", allEntries = true)
|
||||||
<S extends Action> List<S> save(Iterable<S> entities);
|
<S extends Action> List<S> save(Iterable<S> entities);
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.springframework.data.repository.CrudRepository#save(java.lang.Object)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
@CacheEvict(value = "feedbackReceivedOverTime", allEntries = true)
|
@CacheEvict(value = "feedbackReceivedOverTime", allEntries = true)
|
||||||
<S extends Action> S save(S entity);
|
<S extends Action> S save(S entity);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Counts all {@link Action}s referring to the given DistributionSet.
|
* Counts all {@link Action}s referring to the given DistributionSet.
|
||||||
*
|
*
|
||||||
* @param distributionSet
|
* @param distributionSet
|
||||||
* DistributionSet to count the {@link Action}s from
|
* DistributionSet to count the {@link Action}s from
|
||||||
* @return the count of actions referring to the given distributionSet
|
* @return the count of actions referring to the given distributionSet
|
||||||
@@ -281,7 +259,7 @@ public interface ActionRepository extends BaseEntityRepository<Action, Long>, Jp
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Counts all {@link Action}s referring to the given rollout.
|
* Counts all {@link Action}s referring to the given rollout.
|
||||||
*
|
*
|
||||||
* @param rollout
|
* @param rollout
|
||||||
* the rollout to count the {@link Action}s from
|
* the rollout to count the {@link Action}s from
|
||||||
* @return the count of actions referring to the given rollout
|
* @return the count of actions referring to the given rollout
|
||||||
@@ -293,7 +271,7 @@ public interface ActionRepository extends BaseEntityRepository<Action, Long>, Jp
|
|||||||
* are currently not in the given status. An in-clause statement does not
|
* are currently not in the given status. An in-clause statement does not
|
||||||
* work with the spring-data, so this is specific usecase regarding to the
|
* work with the spring-data, so this is specific usecase regarding to the
|
||||||
* rollout-management to find out actions which are not in specific states.
|
* rollout-management to find out actions which are not in specific states.
|
||||||
*
|
*
|
||||||
* @param rollout
|
* @param rollout
|
||||||
* the rollout the actions are belong to
|
* the rollout the actions are belong to
|
||||||
* @param rolloutGroup
|
* @param rolloutGroup
|
||||||
@@ -312,7 +290,7 @@ public interface ActionRepository extends BaseEntityRepository<Action, Long>, Jp
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Counts all actions referring to a given rollout and rolloutgroup.
|
* Counts all actions referring to a given rollout and rolloutgroup.
|
||||||
*
|
*
|
||||||
* @param rollout
|
* @param rollout
|
||||||
* the rollout the actions belong to
|
* the rollout the actions belong to
|
||||||
* @param rolloutGroup
|
* @param rolloutGroup
|
||||||
@@ -323,7 +301,7 @@ public interface ActionRepository extends BaseEntityRepository<Action, Long>, Jp
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Counts all actions referring to a given rollout, rolloutgroup and status.
|
* Counts all actions referring to a given rollout, rolloutgroup and status.
|
||||||
*
|
*
|
||||||
* @param rolloutId
|
* @param rolloutId
|
||||||
* the ID of rollout the actions belong to
|
* the ID of rollout the actions belong to
|
||||||
* @param rolloutGroupId
|
* @param rolloutGroupId
|
||||||
@@ -338,7 +316,7 @@ public interface ActionRepository extends BaseEntityRepository<Action, Long>, Jp
|
|||||||
/**
|
/**
|
||||||
* Retrieving all actions referring to a given rollout with a specific
|
* Retrieving all actions referring to a given rollout with a specific
|
||||||
* action as parent reference and a specific status.
|
* action as parent reference and a specific status.
|
||||||
*
|
*
|
||||||
* Finding all actions of a specific rolloutgroup parent relation.
|
* Finding all actions of a specific rolloutgroup parent relation.
|
||||||
*
|
*
|
||||||
* @param rollout
|
* @param rollout
|
||||||
@@ -355,7 +333,7 @@ public interface ActionRepository extends BaseEntityRepository<Action, Long>, Jp
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves all actions for a specific rollout and in a specific status.
|
* Retrieves all actions for a specific rollout and in a specific status.
|
||||||
*
|
*
|
||||||
* @param rollout
|
* @param rollout
|
||||||
* the rollout the actions beglong to
|
* the rollout the actions beglong to
|
||||||
* @param actionStatus
|
* @param actionStatus
|
||||||
@@ -367,7 +345,7 @@ public interface ActionRepository extends BaseEntityRepository<Action, Long>, Jp
|
|||||||
/**
|
/**
|
||||||
* Get list of objects which has details of status and count of targets in
|
* Get list of objects which has details of status and count of targets in
|
||||||
* each status in specified rollout.
|
* each status in specified rollout.
|
||||||
*
|
*
|
||||||
* @param rolloutId
|
* @param rolloutId
|
||||||
* id of {@link Rollout}
|
* id of {@link Rollout}
|
||||||
* @return list of objects with status and target count
|
* @return list of objects with status and target count
|
||||||
@@ -378,7 +356,7 @@ public interface ActionRepository extends BaseEntityRepository<Action, Long>, Jp
|
|||||||
/**
|
/**
|
||||||
* Get list of objects which has details of status and count of targets in
|
* Get list of objects which has details of status and count of targets in
|
||||||
* each status in specified rollout.
|
* each status in specified rollout.
|
||||||
*
|
*
|
||||||
* @param rolloutId
|
* @param rolloutId
|
||||||
* id of {@link Rollout}
|
* id of {@link Rollout}
|
||||||
* @return list of objects with status and target count
|
* @return list of objects with status and target count
|
||||||
@@ -389,7 +367,7 @@ public interface ActionRepository extends BaseEntityRepository<Action, Long>, Jp
|
|||||||
/**
|
/**
|
||||||
* Get list of objects which has details of status and count of targets in
|
* Get list of objects which has details of status and count of targets in
|
||||||
* each status in specified rollout group.
|
* each status in specified rollout group.
|
||||||
*
|
*
|
||||||
* @param rolloutGroupId
|
* @param rolloutGroupId
|
||||||
* id of {@link RolloutGroup}
|
* id of {@link RolloutGroup}
|
||||||
* @return list of objects with status and target count
|
* @return list of objects with status and target count
|
||||||
@@ -400,7 +378,7 @@ public interface ActionRepository extends BaseEntityRepository<Action, Long>, Jp
|
|||||||
/**
|
/**
|
||||||
* Get list of objects which has details of status and count of targets in
|
* Get list of objects which has details of status and count of targets in
|
||||||
* each status in specified rollout group.
|
* each status in specified rollout group.
|
||||||
*
|
*
|
||||||
* @param rolloutGroupId
|
* @param rolloutGroupId
|
||||||
* list of id of {@link RolloutGroup}
|
* list of id of {@link RolloutGroup}
|
||||||
* @return list of objects with status and target count
|
* @return list of objects with status and target count
|
||||||
|
|||||||
@@ -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();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -330,7 +330,7 @@ public class DeploymentManagement {
|
|||||||
// one we have been switched to canceling state because for targets
|
// one we have been switched to canceling state because for targets
|
||||||
// which we have changed to
|
// which we have changed to
|
||||||
// canceling we don't want to publish the new action update event.
|
// canceling we don't want to publish the new action update event.
|
||||||
final Set<Long> targetIdsCancellList = new HashSet<Long>();
|
final Set<Long> targetIdsCancellList = new HashSet<>();
|
||||||
targetIds.forEach(ids -> targetIdsCancellList.addAll(overrideObsoleteUpdateActions(ids)));
|
targetIds.forEach(ids -> targetIdsCancellList.addAll(overrideObsoleteUpdateActions(ids)));
|
||||||
|
|
||||||
// cancel all scheduled actions which are in-active, these actions were
|
// cancel all scheduled actions which are in-active, these actions were
|
||||||
@@ -378,11 +378,13 @@ public class DeploymentManagement {
|
|||||||
actionStatusRepository.save(actionStatus);
|
actionStatusRepository.save(actionStatus);
|
||||||
});
|
});
|
||||||
|
|
||||||
// select updated targets in order to return them
|
// flush to get action IDs
|
||||||
|
entityManager.flush();
|
||||||
|
// collect updated target and actions IDs in order to return them
|
||||||
final DistributionSetAssignmentResult result = new DistributionSetAssignmentResult(
|
final DistributionSetAssignmentResult result = new DistributionSetAssignmentResult(
|
||||||
targets.stream().map(target -> target.getControllerId()).collect(Collectors.toList()), targets.size(),
|
targets.stream().map(target -> target.getControllerId()).collect(Collectors.toList()), targets.size(),
|
||||||
controllerIDs.size() - targets.size(), Lists.newArrayList(targetIdsToActions.values()),
|
controllerIDs.size() - targets.size(),
|
||||||
targetManagement);
|
targetIdsToActions.values().stream().map(Action::getId).collect(Collectors.toList()), targetManagement);
|
||||||
|
|
||||||
LOG.debug("assignDistribution({}) finished {}", set, result);
|
LOG.debug("assignDistribution({}) finished {}", set, result);
|
||||||
|
|
||||||
@@ -391,13 +393,16 @@ public class DeploymentManagement {
|
|||||||
// detaching as it is not necessary to persist the set itself
|
// detaching as it is not necessary to persist the set itself
|
||||||
entityManager.detach(set);
|
entityManager.detach(set);
|
||||||
|
|
||||||
// send distribution set assignment event
|
sendDistributionSetAssignmentEvent(targets, targetIdsCancellList, targetIdsToActions, softwareModules);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void sendDistributionSetAssignmentEvent(final List<Target> targets, final Set<Long> targetIdsCancellList,
|
||||||
|
final Map<String, Action> targetIdsToActions, final List<SoftwareModule> softwareModules) {
|
||||||
targets.stream().filter(t -> !!!targetIdsCancellList.contains(t.getId()))
|
targets.stream().filter(t -> !!!targetIdsCancellList.contains(t.getId()))
|
||||||
.forEach(t -> assignDistributionSetEvent(t, targetIdsToActions.get(t.getControllerId()).getId(),
|
.forEach(t -> assignDistributionSetEvent(t, targetIdsToActions.get(t.getControllerId()).getId(),
|
||||||
softwareModules));
|
softwareModules));
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -430,7 +435,7 @@ public class DeploymentManagement {
|
|||||||
*/
|
*/
|
||||||
private Set<Long> overrideObsoleteUpdateActions(final List<Long> targetsIds) {
|
private Set<Long> overrideObsoleteUpdateActions(final List<Long> targetsIds) {
|
||||||
|
|
||||||
final Set<Long> cancelledTargetIds = new HashSet<Long>();
|
final Set<Long> cancelledTargetIds = new HashSet<>();
|
||||||
|
|
||||||
// Figure out if there are potential target/action combinations that
|
// Figure out if there are potential target/action combinations that
|
||||||
// need to be considered
|
// need to be considered
|
||||||
@@ -709,8 +714,8 @@ public class DeploymentManagement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the {@link Action} entity for given actionId with all lazy
|
* Get the {@link Action} entity for given actionId with all lazy attributes
|
||||||
* attributes.
|
* (i.e. distributionSet, target, target.assignedDs).
|
||||||
*
|
*
|
||||||
* @param actionId
|
* @param actionId
|
||||||
* to be id of the action
|
* to be id of the action
|
||||||
@@ -774,8 +779,7 @@ public class DeploymentManagement {
|
|||||||
multiselect.where(cb.equal(actionRoot.get(Action_.target), target));
|
multiselect.where(cb.equal(actionRoot.get(Action_.target), target));
|
||||||
multiselect.orderBy(cb.desc(actionRoot.get(Action_.id)));
|
multiselect.orderBy(cb.desc(actionRoot.get(Action_.id)));
|
||||||
multiselect.groupBy(actionRoot.get(Action_.id));
|
multiselect.groupBy(actionRoot.get(Action_.id));
|
||||||
final List<ActionWithStatusCount> resultList = entityManager.createQuery(multiselect).getResultList();
|
return entityManager.createQuery(multiselect).getResultList();
|
||||||
return resultList;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ package org.eclipse.hawkbit.repository;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.repository.model.Action;
|
|
||||||
import org.eclipse.hawkbit.repository.model.AssignmentResult;
|
import org.eclipse.hawkbit.repository.model.AssignmentResult;
|
||||||
import org.eclipse.hawkbit.repository.model.Target;
|
import org.eclipse.hawkbit.repository.model.Target;
|
||||||
|
|
||||||
@@ -19,14 +18,11 @@ import org.eclipse.hawkbit.repository.model.Target;
|
|||||||
* information of an assignment and how much of the assignment has been done and
|
* information of an assignment and how much of the assignment has been done and
|
||||||
* how much of the assignments had already been existed.
|
* how much of the assignments had already been existed.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class DistributionSetAssignmentResult extends AssignmentResult {
|
public class DistributionSetAssignmentResult extends AssignmentResult {
|
||||||
|
|
||||||
private final List<String> assignedTargets;
|
private final List<String> assignedTargets;
|
||||||
private final List<Action> actions;
|
private final List<Long> actions;
|
||||||
|
|
||||||
private final TargetManagement targetManagement;
|
private final TargetManagement targetManagement;
|
||||||
|
|
||||||
@@ -48,7 +44,7 @@ public class DistributionSetAssignmentResult extends AssignmentResult {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public DistributionSetAssignmentResult(final List<String> assignedTargets, final int assigned,
|
public DistributionSetAssignmentResult(final List<String> assignedTargets, final int assigned,
|
||||||
final int alreadyAssigned, final List<Action> actions, final TargetManagement targetManagement) {
|
final int alreadyAssigned, final List<Long> actions, final TargetManagement targetManagement) {
|
||||||
super(assigned, alreadyAssigned);
|
super(assigned, alreadyAssigned);
|
||||||
this.assignedTargets = assignedTargets;
|
this.assignedTargets = assignedTargets;
|
||||||
this.actions = actions;
|
this.actions = actions;
|
||||||
@@ -63,9 +59,9 @@ public class DistributionSetAssignmentResult extends AssignmentResult {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the actionId
|
* @return the actionIds
|
||||||
*/
|
*/
|
||||||
public List<Action> getActions() {
|
public List<Long> getActions() {
|
||||||
return actions;
|
return actions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ public class NoCountPagingRepository {
|
|||||||
*/
|
*/
|
||||||
public <T, I extends Serializable> Slice<T> findAll(final Specification<T> spec, final Pageable pageable,
|
public <T, I extends Serializable> Slice<T> findAll(final Specification<T> spec, final Pageable pageable,
|
||||||
final Class<T> domainClass) {
|
final Class<T> domainClass) {
|
||||||
final SimpleJpaNoCountRepository<T, I> noCountDao = new SimpleJpaNoCountRepository<T, I>(domainClass, em);
|
final SimpleJpaNoCountRepository<T, I> noCountDao = new SimpleJpaNoCountRepository<>(domainClass, em);
|
||||||
return noCountDao.findAll(spec, pageable);
|
return noCountDao.findAll(spec, pageable);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,7 +76,7 @@ public class NoCountPagingRepository {
|
|||||||
* org.springframework.data.domain.Pageable)
|
* org.springframework.data.domain.Pageable)
|
||||||
*/
|
*/
|
||||||
public <T, I extends Serializable> Slice<T> findAll(final Pageable pageable, final Class<T> domainClass) {
|
public <T, I extends Serializable> Slice<T> findAll(final Pageable pageable, final Class<T> domainClass) {
|
||||||
final SimpleJpaNoCountRepository<T, I> noCountDao = new SimpleJpaNoCountRepository<T, I>(domainClass, em);
|
final SimpleJpaNoCountRepository<T, I> noCountDao = new SimpleJpaNoCountRepository<>(domainClass, em);
|
||||||
return noCountDao.findAll(pageable);
|
return noCountDao.findAll(pageable);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -120,7 +120,7 @@ public class NoCountPagingRepository {
|
|||||||
|
|
||||||
final List<T> content = query.getResultList();
|
final List<T> content = query.getResultList();
|
||||||
|
|
||||||
return new PageImpl<T>(content, pageable, content.size());
|
return new PageImpl<>(content, pageable, content.size());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -245,8 +245,9 @@ public class RolloutGroupManagement {
|
|||||||
JoinType.LEFT);
|
JoinType.LEFT);
|
||||||
|
|
||||||
final Root<RolloutTargetGroup> countQueryFrom = countQuery.distinct(true).from(RolloutTargetGroup.class);
|
final Root<RolloutTargetGroup> countQueryFrom = countQuery.distinct(true).from(RolloutTargetGroup.class);
|
||||||
countQuery
|
countQueryFrom.join(RolloutTargetGroup_.target);
|
||||||
.select(cb.count(countQueryFrom.join(RolloutTargetGroup_.target).join(Target_.actions, JoinType.LEFT)))
|
countQueryFrom.join(RolloutTargetGroup_.actions, JoinType.LEFT);
|
||||||
|
countQuery.select(cb.count(countQueryFrom))
|
||||||
.where(cb.equal(countQueryFrom.get(RolloutTargetGroup_.rolloutGroup), rolloutGroup));
|
.where(cb.equal(countQueryFrom.get(RolloutTargetGroup_.rolloutGroup), rolloutGroup));
|
||||||
final Long totalCount = entityManager.createQuery(countQuery).getSingleResult();
|
final Long totalCount = entityManager.createQuery(countQuery).getSingleResult();
|
||||||
|
|
||||||
|
|||||||
@@ -552,7 +552,7 @@ public class RolloutManagement {
|
|||||||
if (updated == 0) {
|
if (updated == 0) {
|
||||||
// nothing to check, maybe another instance already checked in
|
// nothing to check, maybe another instance already checked in
|
||||||
// between
|
// between
|
||||||
LOGGER.info("No rolloutcheck necessary for current scheduled check {}, next check at {}", lastCheck,
|
LOGGER.debug("No rolloutcheck necessary for current scheduled check {}, next check at {}", lastCheck,
|
||||||
lastCheck + delayBetweenChecks);
|
lastCheck + delayBetweenChecks);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -160,7 +160,7 @@ public class TagManagement {
|
|||||||
public void deleteTargetTag(@NotEmpty final String targetTagName) {
|
public void deleteTargetTag(@NotEmpty final String targetTagName) {
|
||||||
final TargetTag tag = targetTagRepository.findByNameEquals(targetTagName);
|
final TargetTag tag = targetTagRepository.findByNameEquals(targetTagName);
|
||||||
|
|
||||||
final List<Target> changed = new LinkedList<Target>();
|
final List<Target> changed = new LinkedList<>();
|
||||||
for (final Target target : targetRepository.findByTag(tag)) {
|
for (final Target target : targetRepository.findByTag(tag)) {
|
||||||
target.getTags().remove(tag);
|
target.getTags().remove(tag);
|
||||||
changed.add(target);
|
changed.add(target);
|
||||||
@@ -311,7 +311,7 @@ public class TagManagement {
|
|||||||
public void deleteDistributionSetTag(@NotEmpty final String tagName) {
|
public void deleteDistributionSetTag(@NotEmpty final String tagName) {
|
||||||
final DistributionSetTag tag = distributionSetTagRepository.findByNameEquals(tagName);
|
final DistributionSetTag tag = distributionSetTagRepository.findByNameEquals(tagName);
|
||||||
|
|
||||||
final List<DistributionSet> changed = new LinkedList<DistributionSet>();
|
final List<DistributionSet> changed = new LinkedList<>();
|
||||||
for (final DistributionSet set : distributionSetRepository.findByTag(tag)) {
|
for (final DistributionSet set : distributionSetRepository.findByTag(tag)) {
|
||||||
set.getTags().remove(tag);
|
set.getTags().remove(tag);
|
||||||
changed.add(set);
|
changed.add(set);
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import javax.persistence.ManyToOne;
|
|||||||
import javax.persistence.NamedAttributeNode;
|
import javax.persistence.NamedAttributeNode;
|
||||||
import javax.persistence.NamedEntityGraph;
|
import javax.persistence.NamedEntityGraph;
|
||||||
import javax.persistence.NamedEntityGraphs;
|
import javax.persistence.NamedEntityGraphs;
|
||||||
|
import javax.persistence.NamedSubgraph;
|
||||||
import javax.persistence.OneToMany;
|
import javax.persistence.OneToMany;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
import javax.persistence.Transient;
|
import javax.persistence.Transient;
|
||||||
@@ -34,28 +35,22 @@ import org.eclipse.persistence.annotations.CascadeOnDelete;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* Applicable transition changes of the software {@link SoftwareModule} state of
|
* Applicable transition changes of the {@link SoftwareModule}s state of a
|
||||||
* a {@link Target}, e.g. install, uninstall, update, start, stop, and
|
* {@link Target}, e.g. install, uninstall, update and preparations for the
|
||||||
* preparations for the transition change, i.e. download.
|
* transition change, i.e. download.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* Actions are managed by the SP server (SPS) and applied to the edge controller
|
* Actions are managed by the SP server and applied to the targets by the
|
||||||
* by the SP controller (SPC). Actions may also be value added commands that are
|
* client.
|
||||||
* nor directly related to SP, e.g. factory reset.
|
|
||||||
* <p>
|
* <p>
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@Table(name = "sp_action", indexes = { @Index(name = "sp_idx_action_01", columnList = "tenant,distribution_set"),
|
@Table(name = "sp_action", indexes = { @Index(name = "sp_idx_action_01", columnList = "tenant,distribution_set"),
|
||||||
@Index(name = "sp_idx_action_02", columnList = "tenant,target,active"),
|
@Index(name = "sp_idx_action_02", columnList = "tenant,target,active"),
|
||||||
@Index(name = "sp_idx_action_prim", columnList = "tenant,id") })
|
@Index(name = "sp_idx_action_prim", columnList = "tenant,id") })
|
||||||
@NamedEntityGraphs({ @NamedEntityGraph(name = "Action.ds", attributeNodes = { @NamedAttributeNode("distributionSet") }),
|
@NamedEntityGraphs({ @NamedEntityGraph(name = "Action.ds", attributeNodes = { @NamedAttributeNode("distributionSet") }),
|
||||||
@NamedEntityGraph(name = "Action.all", attributeNodes = { @NamedAttributeNode("distributionSet"),
|
@NamedEntityGraph(name = "Action.all", attributeNodes = { @NamedAttributeNode("distributionSet"),
|
||||||
@NamedAttributeNode("target") }) })
|
@NamedAttributeNode(value = "target", subgraph = "target.ds") }, subgraphs = @NamedSubgraph(name = "target.ds", attributeNodes = @NamedAttributeNode("assignedDistributionSet") ) ) })
|
||||||
@Entity
|
@Entity
|
||||||
public class Action extends BaseEntity implements Comparable<Action> {
|
public class Action extends BaseEntity implements Comparable<Action> {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ public class ActionStatus extends BaseEntity {
|
|||||||
@CollectionTable(name = "sp_action_status_messages", joinColumns = @JoinColumn(name = "action_status_id", foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_stat_msg_act_stat") ) , indexes = {
|
@CollectionTable(name = "sp_action_status_messages", joinColumns = @JoinColumn(name = "action_status_id", foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_stat_msg_act_stat") ) , indexes = {
|
||||||
@Index(name = "sp_idx_action_status_msgs_01", columnList = "action_status_id") })
|
@Index(name = "sp_idx_action_status_msgs_01", columnList = "action_status_id") })
|
||||||
@Column(name = "detail_message", length = 512)
|
@Column(name = "detail_message", length = 512)
|
||||||
private final List<String> messages = new ArrayList<String>();
|
private final List<String> messages = new ArrayList<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new {@link ActionStatus} object.
|
* Creates a new {@link ActionStatus} object.
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -83,7 +87,7 @@ public class Target extends NamedEntity implements Persistable<Long> {
|
|||||||
@JoinTable(name = "sp_target_target_tag", joinColumns = {
|
@JoinTable(name = "sp_target_target_tag", joinColumns = {
|
||||||
@JoinColumn(name = "target", foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_targ_targtag_target") ) }, inverseJoinColumns = {
|
@JoinColumn(name = "target", foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_targ_targtag_target") ) }, inverseJoinColumns = {
|
||||||
@JoinColumn(name = "tag", foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_targ_targtag_tag") ) })
|
@JoinColumn(name = "tag", foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_targ_targtag_tag") ) })
|
||||||
private Set<TargetTag> tags = new HashSet<TargetTag>();
|
private Set<TargetTag> tags = new HashSet<>();
|
||||||
|
|
||||||
@CascadeOnDelete
|
@CascadeOnDelete
|
||||||
@OneToMany(fetch = FetchType.LAZY, orphanRemoval = true, cascade = { CascadeType.REMOVE })
|
@OneToMany(fetch = FetchType.LAZY, orphanRemoval = true, cascade = { CascadeType.REMOVE })
|
||||||
|
|||||||
@@ -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) {
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ public abstract class AbstractIntegrationTestWithMongoDB extends AbstractIntegra
|
|||||||
System.setProperty("spring.data.mongodb.port", String.valueOf(port));
|
System.setProperty("spring.data.mongodb.port", String.valueOf(port));
|
||||||
}
|
}
|
||||||
|
|
||||||
Version version = Version.V3_0_5;
|
Version version = Version.V3_0_8;
|
||||||
if (System.getProperty("inf.mongodb.version") != null) {
|
if (System.getProperty("inf.mongodb.version") != null) {
|
||||||
version = Version
|
version = Version
|
||||||
.valueOf("V" + System.getProperty("inf.mongodb.version").trim().replaceAll("\\.", "_"));
|
.valueOf("V" + System.getProperty("inf.mongodb.version").trim().replaceAll("\\.", "_"));
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ public class MethodSecurityUtil {
|
|||||||
if (!METHOD_SECURITY_EXCLUSION.contains(method.getName()) && !method.isSynthetic()
|
if (!METHOD_SECURITY_EXCLUSION.contains(method.getName()) && !method.isSynthetic()
|
||||||
&& Modifier.isPublic(method.getModifiers())) {
|
&& Modifier.isPublic(method.getModifiers())) {
|
||||||
final PreAuthorize annotation = method.getAnnotation(PreAuthorize.class);
|
final PreAuthorize annotation = method.getAnnotation(PreAuthorize.class);
|
||||||
assertThat(annotation).describedAs(
|
assertThat(annotation).as(
|
||||||
"The public method " + method.getName() + " is not annoated with @PreAuthorize, security leak?")
|
"The public method " + method.getName() + " is not annoated with @PreAuthorize, security leak?")
|
||||||
.isNotNull();
|
.isNotNull();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -150,14 +150,14 @@ public class ArtifactManagementTest extends AbstractIntegrationTestWithMongoDB {
|
|||||||
|
|
||||||
ExternalArtifact result = artifactManagement.createExternalArtifact(provider, null, sm.getId());
|
ExternalArtifact result = artifactManagement.createExternalArtifact(provider, null, sm.getId());
|
||||||
|
|
||||||
assertNotNull(result);
|
assertNotNull("The result of an external artifact should not be null", result);
|
||||||
assertThat(externalArtifactRepository.findAll()).contains(result).hasSize(1);
|
assertThat(externalArtifactRepository.findAll()).contains(result).hasSize(1);
|
||||||
assertThat(result.getSoftwareModule().getId()).isEqualTo(sm.getId());
|
assertThat(result.getSoftwareModule().getId()).isEqualTo(sm.getId());
|
||||||
assertThat(result.getUrl()).isEqualTo("https://fhghdfjgh/{version}/");
|
assertThat(result.getUrl()).isEqualTo("https://fhghdfjgh/{version}/");
|
||||||
assertThat(result.getExternalArtifactProvider()).isEqualTo(provider);
|
assertThat(result.getExternalArtifactProvider()).isEqualTo(provider);
|
||||||
|
|
||||||
result = artifactManagement.createExternalArtifact(provider, "/test", sm2.getId());
|
result = artifactManagement.createExternalArtifact(provider, "/test", sm2.getId());
|
||||||
assertNotNull(result);
|
assertNotNull("The newly created external artifact should not be null", result);
|
||||||
assertThat(externalArtifactRepository.findAll()).contains(result).hasSize(2);
|
assertThat(externalArtifactRepository.findAll()).contains(result).hasSize(2);
|
||||||
assertThat(result.getUrl()).isEqualTo("https://fhghdfjgh/test");
|
assertThat(result.getUrl()).isEqualTo("https://fhghdfjgh/test");
|
||||||
assertThat(result.getExternalArtifactProvider()).isEqualTo(provider);
|
assertThat(result.getExternalArtifactProvider()).isEqualTo(provider);
|
||||||
@@ -176,7 +176,7 @@ public class ArtifactManagementTest extends AbstractIntegrationTestWithMongoDB {
|
|||||||
"https://fhghdfjgh", "/{version}/");
|
"https://fhghdfjgh", "/{version}/");
|
||||||
|
|
||||||
final ExternalArtifact result = artifactManagement.createExternalArtifact(provider, null, sm.getId());
|
final ExternalArtifact result = artifactManagement.createExternalArtifact(provider, null, sm.getId());
|
||||||
assertNotNull(result);
|
assertNotNull("The newly created external artifact should not be null", result);
|
||||||
assertThat(externalArtifactRepository.findAll()).contains(result).hasSize(1);
|
assertThat(externalArtifactRepository.findAll()).contains(result).hasSize(1);
|
||||||
|
|
||||||
artifactManagement.deleteExternalArtifact(result.getId());
|
artifactManagement.deleteExternalArtifact(result.getId());
|
||||||
@@ -348,7 +348,7 @@ public class ArtifactManagementTest extends AbstractIntegrationTestWithMongoDB {
|
|||||||
final LocalArtifact result = artifactManagement.createLocalArtifact(new ByteArrayInputStream(random),
|
final LocalArtifact result = artifactManagement.createLocalArtifact(new ByteArrayInputStream(random),
|
||||||
sm.getId(), "file1", false);
|
sm.getId(), "file1", false);
|
||||||
|
|
||||||
assertTrue(IOUtils.contentEquals(new ByteArrayInputStream(random),
|
assertTrue("The stored binary matches the given binary", IOUtils.contentEquals(new ByteArrayInputStream(random),
|
||||||
artifactManagement.loadLocalArtifactBinary(result).getFileInputStream()));
|
artifactManagement.loadLocalArtifactBinary(result).getFileInputStream()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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() {
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ import java.util.LinkedList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.CountDownLatch;
|
import java.util.concurrent.CountDownLatch;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.function.Consumer;
|
|
||||||
|
|
||||||
import org.eclipse.hawkbit.AbstractIntegrationTest;
|
import org.eclipse.hawkbit.AbstractIntegrationTest;
|
||||||
import org.eclipse.hawkbit.Constants;
|
import org.eclipse.hawkbit.Constants;
|
||||||
@@ -66,6 +65,22 @@ public class DeploymentManagementTest extends AbstractIntegrationTest {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private EventBus eventBus;
|
private EventBus eventBus;
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Description("Test verifies that the repistory retrieves the action including all defined (lazy) details.")
|
||||||
|
public void findActionWithLazyDetails() {
|
||||||
|
final DistributionSet testDs = TestDataUtil.generateDistributionSet("TestDs", "1.0", softwareManagement,
|
||||||
|
distributionSetManagement, new ArrayList<DistributionSetTag>());
|
||||||
|
final List<Target> testTarget = targetManagement.createTargets(TestDataUtil.generateTargets(1));
|
||||||
|
// one action with one action status is generated
|
||||||
|
final Long actionId = deploymentManagement.assignDistributionSet(testDs, testTarget).getActions().get(0);
|
||||||
|
final Action action = deploymentManagement.findActionWithDetails(actionId);
|
||||||
|
|
||||||
|
assertThat(action.getDistributionSet()).as("DistributionSet in action").isNotNull();
|
||||||
|
assertThat(action.getTarget()).as("Target in action").isNotNull();
|
||||||
|
assertThat(action.getTarget().getAssignedDistributionSet()).as("AssignedDistributionSet of target in action")
|
||||||
|
.isNotNull();
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Test verifies that the custom query to find all actions include the count of action status is working correctly")
|
@Description("Test verifies that the custom query to find all actions include the count of action status is working correctly")
|
||||||
public void findActionsWithStatusCountByTarget() {
|
public void findActionsWithStatusCountByTarget() {
|
||||||
@@ -73,7 +88,8 @@ public class DeploymentManagementTest extends AbstractIntegrationTest {
|
|||||||
distributionSetManagement, new ArrayList<DistributionSetTag>());
|
distributionSetManagement, new ArrayList<DistributionSetTag>());
|
||||||
final List<Target> testTarget = targetManagement.createTargets(TestDataUtil.generateTargets(1));
|
final List<Target> testTarget = targetManagement.createTargets(TestDataUtil.generateTargets(1));
|
||||||
// one action with one action status is generated
|
// one action with one action status is generated
|
||||||
final Action action = deploymentManagement.assignDistributionSet(testDs, testTarget).getActions().get(0);
|
final Action action = deploymentManagement.findActionWithDetails(
|
||||||
|
deploymentManagement.assignDistributionSet(testDs, testTarget).getActions().get(0));
|
||||||
// save 2 action status
|
// save 2 action status
|
||||||
actionStatusRepository.save(new ActionStatus(action, Status.RETRIEVED, System.currentTimeMillis()));
|
actionStatusRepository.save(new ActionStatus(action, Status.RETRIEVED, System.currentTimeMillis()));
|
||||||
actionStatusRepository.save(new ActionStatus(action, Status.RUNNING, System.currentTimeMillis()));
|
actionStatusRepository.save(new ActionStatus(action, Status.RUNNING, System.currentTimeMillis()));
|
||||||
@@ -81,8 +97,9 @@ public class DeploymentManagementTest extends AbstractIntegrationTest {
|
|||||||
final List<ActionWithStatusCount> findActionsWithStatusCountByTarget = deploymentManagement
|
final List<ActionWithStatusCount> findActionsWithStatusCountByTarget = deploymentManagement
|
||||||
.findActionsWithStatusCountByTargetOrderByIdDesc(testTarget.get(0));
|
.findActionsWithStatusCountByTargetOrderByIdDesc(testTarget.get(0));
|
||||||
|
|
||||||
assertThat(findActionsWithStatusCountByTarget).hasSize(1);
|
assertThat(findActionsWithStatusCountByTarget).as("wrong action size").hasSize(1);
|
||||||
assertThat(findActionsWithStatusCountByTarget.get(0).getActionStatusCount()).isEqualTo(3L);
|
assertThat(findActionsWithStatusCountByTarget.get(0).getActionStatusCount()).as("wrong action status size")
|
||||||
|
.isEqualTo(3L);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -98,27 +115,32 @@ public class DeploymentManagementTest extends AbstractIntegrationTest {
|
|||||||
final DistributionSetTag tag = tagManagement.createDistributionSetTag(new DistributionSetTag("Tag1"));
|
final DistributionSetTag tag = tagManagement.createDistributionSetTag(new DistributionSetTag("Tag1"));
|
||||||
|
|
||||||
final List<DistributionSet> assignedDS = distributionSetManagement.assignTag(assignDS, tag);
|
final List<DistributionSet> assignedDS = distributionSetManagement.assignTag(assignDS, tag);
|
||||||
assertThat(assignedDS.size()).isEqualTo(4);
|
assertThat(assignedDS.size()).as("assigned ds has wrong size").isEqualTo(4);
|
||||||
assignedDS.forEach(ds -> assertThat(ds.getTags().size()).isEqualTo(1));
|
assignedDS.forEach(ds -> assertThat(ds.getTags().size()).as("ds has wrong tag size").isEqualTo(1));
|
||||||
|
|
||||||
DistributionSetTag findDistributionSetTag = tagManagement.findDistributionSetTag("Tag1");
|
DistributionSetTag findDistributionSetTag = tagManagement.findDistributionSetTag("Tag1");
|
||||||
assertThat(assignedDS.size()).isEqualTo(findDistributionSetTag.getAssignedToDistributionSet().size());
|
assertThat(assignedDS.size()).as("assigned ds has wrong size")
|
||||||
|
.isEqualTo(findDistributionSetTag.getAssignedToDistributionSet().size());
|
||||||
|
|
||||||
assertThat(distributionSetManagement.unAssignTag(Long.valueOf(100), findDistributionSetTag)).isNull();
|
assertThat(distributionSetManagement.unAssignTag(Long.valueOf(100), findDistributionSetTag))
|
||||||
|
.as("unassign tag result should be null").isNull();
|
||||||
|
|
||||||
final DistributionSet unAssignDS = distributionSetManagement.unAssignTag(assignDS.get(0),
|
final DistributionSet unAssignDS = distributionSetManagement.unAssignTag(assignDS.get(0),
|
||||||
findDistributionSetTag);
|
findDistributionSetTag);
|
||||||
assertThat(unAssignDS.getId()).isEqualTo(assignDS.get(0));
|
assertThat(unAssignDS.getId()).as("unassigned ds is wrong").isEqualTo(assignDS.get(0));
|
||||||
assertThat(unAssignDS.getTags().size()).isEqualTo(0);
|
assertThat(unAssignDS.getTags().size()).as("unassigned ds has wrong tag size").isEqualTo(0);
|
||||||
findDistributionSetTag = tagManagement.findDistributionSetTag("Tag1");
|
findDistributionSetTag = tagManagement.findDistributionSetTag("Tag1");
|
||||||
assertThat(findDistributionSetTag.getAssignedToDistributionSet().size()).isEqualTo(3);
|
assertThat(findDistributionSetTag.getAssignedToDistributionSet().size()).as("ds tag ds has wrong ds size")
|
||||||
|
.isEqualTo(3);
|
||||||
|
|
||||||
final List<DistributionSet> unAssignTargets = distributionSetManagement
|
final List<DistributionSet> unAssignTargets = distributionSetManagement
|
||||||
.unAssignAllDistributionSetsByTag(findDistributionSetTag);
|
.unAssignAllDistributionSetsByTag(findDistributionSetTag);
|
||||||
findDistributionSetTag = tagManagement.findDistributionSetTag("Tag1");
|
findDistributionSetTag = tagManagement.findDistributionSetTag("Tag1");
|
||||||
assertThat(findDistributionSetTag.getAssignedToDistributionSet().size()).isEqualTo(0);
|
assertThat(findDistributionSetTag.getAssignedToDistributionSet().size()).as("ds tag has wrong ds size")
|
||||||
assertThat(unAssignTargets.size()).isEqualTo(3);
|
.isEqualTo(0);
|
||||||
unAssignTargets.forEach(target -> assertThat(target.getTags().size()).isEqualTo(0));
|
assertThat(unAssignTargets.size()).as("unassigned target has wrong size").isEqualTo(3);
|
||||||
|
unAssignTargets
|
||||||
|
.forEach(target -> assertThat(target.getTags().size()).as("target has wrong tag size").isEqualTo(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -140,7 +162,8 @@ public class DeploymentManagementTest extends AbstractIntegrationTest {
|
|||||||
|
|
||||||
targetManagement.findAllTargetIds().forEach(targetIdName -> {
|
targetManagement.findAllTargetIds().forEach(targetIdName -> {
|
||||||
assertThat(deploymentManagement.findActiveActionsByTarget(
|
assertThat(deploymentManagement.findActiveActionsByTarget(
|
||||||
targetManagement.findTargetByControllerID(targetIdName.getControllerId()))).hasSize(2);
|
targetManagement.findTargetByControllerID(targetIdName.getControllerId())))
|
||||||
|
.as("active action has wrong size").hasSize(2);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -163,14 +186,14 @@ public class DeploymentManagementTest extends AbstractIntegrationTest {
|
|||||||
|
|
||||||
// check initial status
|
// check initial status
|
||||||
assertThat(targetManagement.findTargetByControllerID("4712").getTargetInfo().getUpdateStatus())
|
assertThat(targetManagement.findTargetByControllerID("4712").getTargetInfo().getUpdateStatus())
|
||||||
.isEqualTo(TargetUpdateStatus.UNKNOWN);
|
.as("target has update status").isEqualTo(TargetUpdateStatus.UNKNOWN);
|
||||||
|
|
||||||
// assign the two sets in a row
|
// assign the two sets in a row
|
||||||
Action firstAction = assignSet(target, dsFirst);
|
Action firstAction = assignSet(target, dsFirst);
|
||||||
Action secondAction = assignSet(target, dsSecond);
|
Action secondAction = assignSet(target, dsSecond);
|
||||||
|
|
||||||
assertThat(actionRepository.findAll()).hasSize(2);
|
assertThat(actionRepository.findAll()).as("wrong size of actions").hasSize(2);
|
||||||
assertThat(actionStatusRepository.findAll()).hasSize(2);
|
assertThat(actionStatusRepository.findAll()).as("wrong size of action status").hasSize(2);
|
||||||
|
|
||||||
// we cancel second -> back to first
|
// we cancel second -> back to first
|
||||||
deploymentManagement.cancelAction(secondAction,
|
deploymentManagement.cancelAction(secondAction,
|
||||||
@@ -180,10 +203,11 @@ public class DeploymentManagementTest extends AbstractIntegrationTest {
|
|||||||
secondAction.setStatus(Status.CANCELED);
|
secondAction.setStatus(Status.CANCELED);
|
||||||
controllerManagement.addCancelActionStatus(
|
controllerManagement.addCancelActionStatus(
|
||||||
new ActionStatus(secondAction, Status.CANCELED, System.currentTimeMillis()), secondAction);
|
new ActionStatus(secondAction, Status.CANCELED, System.currentTimeMillis()), secondAction);
|
||||||
assertThat(actionStatusRepository.findAll()).hasSize(4);
|
assertThat(actionStatusRepository.findAll()).as("wrong size of actions status").hasSize(4);
|
||||||
assertThat(targetManagement.findTargetByControllerID("4712").getAssignedDistributionSet()).isEqualTo(dsFirst);
|
assertThat(targetManagement.findTargetByControllerID("4712").getAssignedDistributionSet()).as("wrong ds")
|
||||||
|
.isEqualTo(dsFirst);
|
||||||
assertThat(targetManagement.findTargetByControllerID("4712").getTargetInfo().getUpdateStatus())
|
assertThat(targetManagement.findTargetByControllerID("4712").getTargetInfo().getUpdateStatus())
|
||||||
.isEqualTo(TargetUpdateStatus.PENDING);
|
.as("wrong update status").isEqualTo(TargetUpdateStatus.PENDING);
|
||||||
|
|
||||||
// we cancel first -> back to installed
|
// we cancel first -> back to installed
|
||||||
deploymentManagement.cancelAction(firstAction,
|
deploymentManagement.cancelAction(firstAction,
|
||||||
@@ -193,11 +217,11 @@ public class DeploymentManagementTest extends AbstractIntegrationTest {
|
|||||||
firstAction.setStatus(Status.CANCELED);
|
firstAction.setStatus(Status.CANCELED);
|
||||||
controllerManagement.addCancelActionStatus(
|
controllerManagement.addCancelActionStatus(
|
||||||
new ActionStatus(firstAction, Status.CANCELED, System.currentTimeMillis()), firstAction);
|
new ActionStatus(firstAction, Status.CANCELED, System.currentTimeMillis()), firstAction);
|
||||||
assertThat(actionStatusRepository.findAll()).hasSize(6);
|
assertThat(actionStatusRepository.findAll()).as("wrong size of action status").hasSize(6);
|
||||||
assertThat(targetManagement.findTargetByControllerID("4712").getAssignedDistributionSet())
|
assertThat(targetManagement.findTargetByControllerID("4712").getAssignedDistributionSet())
|
||||||
.isEqualTo(dsInstalled);
|
.as("wrong assigned ds").isEqualTo(dsInstalled);
|
||||||
assertThat(targetManagement.findTargetByControllerID("4712").getTargetInfo().getUpdateStatus())
|
assertThat(targetManagement.findTargetByControllerID("4712").getTargetInfo().getUpdateStatus())
|
||||||
.isEqualTo(TargetUpdateStatus.IN_SYNC);
|
.as("wrong update status").isEqualTo(TargetUpdateStatus.IN_SYNC);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -219,14 +243,14 @@ public class DeploymentManagementTest extends AbstractIntegrationTest {
|
|||||||
|
|
||||||
// check initial status
|
// check initial status
|
||||||
assertThat(targetManagement.findTargetByControllerID("4712").getTargetInfo().getUpdateStatus())
|
assertThat(targetManagement.findTargetByControllerID("4712").getTargetInfo().getUpdateStatus())
|
||||||
.isEqualTo(TargetUpdateStatus.UNKNOWN);
|
.as("wrong update status").isEqualTo(TargetUpdateStatus.UNKNOWN);
|
||||||
|
|
||||||
// assign the two sets in a row
|
// assign the two sets in a row
|
||||||
Action firstAction = assignSet(target, dsFirst);
|
Action firstAction = assignSet(target, dsFirst);
|
||||||
Action secondAction = assignSet(target, dsSecond);
|
Action secondAction = assignSet(target, dsSecond);
|
||||||
|
|
||||||
assertThat(actionRepository.findAll()).hasSize(2);
|
assertThat(actionRepository.findAll()).as("wrong size of actions").hasSize(2);
|
||||||
assertThat(actionStatusRepository.findAll()).hasSize(2);
|
assertThat(actionStatusRepository.findAll()).as("wrong size of action status").hasSize(2);
|
||||||
|
|
||||||
// we cancel first -> second is left
|
// we cancel first -> second is left
|
||||||
deploymentManagement.cancelAction(firstAction,
|
deploymentManagement.cancelAction(firstAction,
|
||||||
@@ -236,26 +260,28 @@ public class DeploymentManagementTest extends AbstractIntegrationTest {
|
|||||||
firstAction.setStatus(Status.CANCELED);
|
firstAction.setStatus(Status.CANCELED);
|
||||||
controllerManagement.addCancelActionStatus(
|
controllerManagement.addCancelActionStatus(
|
||||||
new ActionStatus(firstAction, Status.CANCELED, System.currentTimeMillis()), firstAction);
|
new ActionStatus(firstAction, Status.CANCELED, System.currentTimeMillis()), firstAction);
|
||||||
assertThat(actionStatusRepository.findAll()).hasSize(4);
|
assertThat(actionStatusRepository.findAll()).as("wrong size of action status").hasSize(4);
|
||||||
assertThat(targetManagement.findTargetByControllerID("4712").getAssignedDistributionSet()).isEqualTo(dsSecond);
|
assertThat(targetManagement.findTargetByControllerID("4712").getAssignedDistributionSet())
|
||||||
|
.as("wrong assigned ds").isEqualTo(dsSecond);
|
||||||
assertThat(targetManagement.findTargetByControllerID("4712").getTargetInfo().getUpdateStatus())
|
assertThat(targetManagement.findTargetByControllerID("4712").getTargetInfo().getUpdateStatus())
|
||||||
.isEqualTo(TargetUpdateStatus.PENDING);
|
.as("wrong target update status").isEqualTo(TargetUpdateStatus.PENDING);
|
||||||
|
|
||||||
// we cancel second -> remain assigned until finished cancellation
|
// we cancel second -> remain assigned until finished cancellation
|
||||||
deploymentManagement.cancelAction(secondAction,
|
deploymentManagement.cancelAction(secondAction,
|
||||||
targetManagement.findTargetByControllerID(target.getControllerId()));
|
targetManagement.findTargetByControllerID(target.getControllerId()));
|
||||||
secondAction = deploymentManagement.findActionWithDetails(secondAction.getId());
|
secondAction = deploymentManagement.findActionWithDetails(secondAction.getId());
|
||||||
assertThat(actionStatusRepository.findAll()).hasSize(5);
|
assertThat(actionStatusRepository.findAll()).as("wrong size of action status").hasSize(5);
|
||||||
assertThat(targetManagement.findTargetByControllerID("4712").getAssignedDistributionSet()).isEqualTo(dsSecond);
|
assertThat(targetManagement.findTargetByControllerID("4712").getAssignedDistributionSet())
|
||||||
|
.as("wrong assigned ds").isEqualTo(dsSecond);
|
||||||
// confirm cancellation
|
// confirm cancellation
|
||||||
secondAction.setStatus(Status.CANCELED);
|
secondAction.setStatus(Status.CANCELED);
|
||||||
controllerManagement.addCancelActionStatus(
|
controllerManagement.addCancelActionStatus(
|
||||||
new ActionStatus(secondAction, Status.CANCELED, System.currentTimeMillis()), secondAction);
|
new ActionStatus(secondAction, Status.CANCELED, System.currentTimeMillis()), secondAction);
|
||||||
// cancelled success -> back to dsInstalled
|
// cancelled success -> back to dsInstalled
|
||||||
assertThat(targetManagement.findTargetByControllerID("4712").getAssignedDistributionSet())
|
assertThat(targetManagement.findTargetByControllerID("4712").getAssignedDistributionSet())
|
||||||
.isEqualTo(dsInstalled);
|
.as("wrong installed ds").isEqualTo(dsInstalled);
|
||||||
assertThat(targetManagement.findTargetByControllerID("4712").getTargetInfo().getUpdateStatus())
|
assertThat(targetManagement.findTargetByControllerID("4712").getTargetInfo().getUpdateStatus())
|
||||||
.isEqualTo(TargetUpdateStatus.IN_SYNC);
|
.as("wrong target info update status").isEqualTo(TargetUpdateStatus.IN_SYNC);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -274,13 +300,13 @@ public class DeploymentManagementTest extends AbstractIntegrationTest {
|
|||||||
|
|
||||||
// verify initial status
|
// verify initial status
|
||||||
assertThat(targetManagement.findTargetByControllerID("4712").getTargetInfo().getUpdateStatus())
|
assertThat(targetManagement.findTargetByControllerID("4712").getTargetInfo().getUpdateStatus())
|
||||||
.isEqualTo(TargetUpdateStatus.UNKNOWN);
|
.as("wrong target info update status").isEqualTo(TargetUpdateStatus.UNKNOWN);
|
||||||
|
|
||||||
Action assigningAction = assignSet(target, ds);
|
Action assigningAction = assignSet(target, ds);
|
||||||
|
|
||||||
// verify assignment
|
// verify assignment
|
||||||
assertThat(actionRepository.findAll()).hasSize(1);
|
assertThat(actionRepository.findAll()).as("wrong size of action").hasSize(1);
|
||||||
assertThat(actionStatusRepository.findAll()).hasSize(1);
|
assertThat(actionStatusRepository.findAll()).as("wrong size of action status").hasSize(1);
|
||||||
|
|
||||||
target = targetManagement.findTargetByControllerID(target.getControllerId());
|
target = targetManagement.findTargetByControllerID(target.getControllerId());
|
||||||
|
|
||||||
@@ -293,11 +319,11 @@ public class DeploymentManagementTest extends AbstractIntegrationTest {
|
|||||||
assigningAction = deploymentManagement.findActionWithDetails(assigningAction.getId());
|
assigningAction = deploymentManagement.findActionWithDetails(assigningAction.getId());
|
||||||
|
|
||||||
// verify
|
// verify
|
||||||
assertThat(assigningAction.getStatus()).isEqualTo(Status.CANCELED);
|
assertThat(assigningAction.getStatus()).as("wrong size of status").isEqualTo(Status.CANCELED);
|
||||||
assertThat(targetManagement.findTargetByControllerID("4712").getAssignedDistributionSet())
|
assertThat(targetManagement.findTargetByControllerID("4712").getAssignedDistributionSet())
|
||||||
.isEqualTo(dsInstalled);
|
.as("wrong assigned ds").isEqualTo(dsInstalled);
|
||||||
assertThat(targetManagement.findTargetByControllerID("4712").getTargetInfo().getUpdateStatus())
|
assertThat(targetManagement.findTargetByControllerID("4712").getTargetInfo().getUpdateStatus())
|
||||||
.isEqualTo(TargetUpdateStatus.IN_SYNC);
|
.as("wrong target update status").isEqualTo(TargetUpdateStatus.IN_SYNC);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -316,13 +342,13 @@ public class DeploymentManagementTest extends AbstractIntegrationTest {
|
|||||||
|
|
||||||
// verify initial status
|
// verify initial status
|
||||||
assertThat(targetManagement.findTargetByControllerID("4712").getTargetInfo().getUpdateStatus())
|
assertThat(targetManagement.findTargetByControllerID("4712").getTargetInfo().getUpdateStatus())
|
||||||
.isEqualTo(TargetUpdateStatus.UNKNOWN);
|
.as("wrong update status").isEqualTo(TargetUpdateStatus.UNKNOWN);
|
||||||
|
|
||||||
final Action assigningAction = assignSet(target, ds);
|
final Action assigningAction = assignSet(target, ds);
|
||||||
|
|
||||||
// verify assignment
|
// verify assignment
|
||||||
assertThat(actionRepository.findAll()).hasSize(1);
|
assertThat(actionRepository.findAll()).as("wrong size of action").hasSize(1);
|
||||||
assertThat(actionStatusRepository.findAll()).hasSize(1);
|
assertThat(actionStatusRepository.findAll()).as("wrong size of action status").hasSize(1);
|
||||||
|
|
||||||
// force quit assignment
|
// force quit assignment
|
||||||
try {
|
try {
|
||||||
@@ -337,11 +363,11 @@ public class DeploymentManagementTest extends AbstractIntegrationTest {
|
|||||||
deploymentManagement.assignDistributionSet(ds.getId(), new String[] { target.getControllerId() });
|
deploymentManagement.assignDistributionSet(ds.getId(), new String[] { target.getControllerId() });
|
||||||
assertThat(
|
assertThat(
|
||||||
targetManagement.findTargetByControllerID(target.getControllerId()).getTargetInfo().getUpdateStatus())
|
targetManagement.findTargetByControllerID(target.getControllerId()).getTargetInfo().getUpdateStatus())
|
||||||
.isEqualTo(TargetUpdateStatus.PENDING);
|
.as("wrong update status").isEqualTo(TargetUpdateStatus.PENDING);
|
||||||
assertThat(targetManagement.findTargetByControllerID(target.getControllerId()).getAssignedDistributionSet())
|
assertThat(targetManagement.findTargetByControllerID(target.getControllerId()).getAssignedDistributionSet())
|
||||||
.isEqualTo(ds);
|
.as("wrong assigned ds").isEqualTo(ds);
|
||||||
final Action action = actionRepository.findByTargetAndDistributionSet(pageReq, target, ds).getContent().get(0);
|
final Action action = actionRepository.findByTargetAndDistributionSet(pageReq, target, ds).getContent().get(0);
|
||||||
assertThat(action).isNotNull();
|
assertThat(action).as("action should not be null").isNotNull();
|
||||||
return action;
|
return action;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -349,7 +375,7 @@ public class DeploymentManagementTest extends AbstractIntegrationTest {
|
|||||||
* test a simple deployment by calling the
|
* test a simple deployment by calling the
|
||||||
* {@link TargetRepository#assignDistributionSet(DistributionSet, Iterable)}
|
* {@link TargetRepository#assignDistributionSet(DistributionSet, Iterable)}
|
||||||
* and checking the active action and the action history of the targets.
|
* and checking the active action and the action history of the targets.
|
||||||
*
|
*
|
||||||
* @throws InterruptedException
|
* @throws InterruptedException
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
@@ -373,26 +399,30 @@ public class DeploymentManagementTest extends AbstractIntegrationTest {
|
|||||||
deploymentManagement.assignDistributionSet(ds, savedDeployedTargets);
|
deploymentManagement.assignDistributionSet(ds, savedDeployedTargets);
|
||||||
|
|
||||||
// verify that one Action for each assignDistributionSet
|
// verify that one Action for each assignDistributionSet
|
||||||
assertThat(actionRepository.findAll(pageReq).getNumberOfElements()).isEqualTo(20);
|
assertThat(actionRepository.findAll(pageReq).getNumberOfElements()).as("wrong size of actions").isEqualTo(20);
|
||||||
|
|
||||||
final Iterable<Target> allFoundTargets = targetManagement.findTargetsAll(pageReq).getContent();
|
final Iterable<Target> allFoundTargets = targetManagement.findTargetsAll(pageReq).getContent();
|
||||||
|
|
||||||
assertThat(allFoundTargets).containsAll(savedDeployedTargets).containsAll(savedNakedTargets);
|
assertThat(allFoundTargets).as("founded targets are wrong").containsAll(savedDeployedTargets)
|
||||||
assertThat(savedDeployedTargets).doesNotContain(Iterables.toArray(savedNakedTargets, Target.class));
|
.containsAll(savedNakedTargets);
|
||||||
assertThat(savedNakedTargets).doesNotContain(Iterables.toArray(savedDeployedTargets, Target.class));
|
assertThat(savedDeployedTargets).as("saved target are wrong")
|
||||||
|
.doesNotContain(Iterables.toArray(savedNakedTargets, Target.class));
|
||||||
|
assertThat(savedNakedTargets).as("saved target are wrong")
|
||||||
|
.doesNotContain(Iterables.toArray(savedDeployedTargets, Target.class));
|
||||||
|
|
||||||
for (final Target myt : savedNakedTargets) {
|
for (final Target myt : savedNakedTargets) {
|
||||||
final Target t = targetManagement.findTargetByControllerID(myt.getControllerId());
|
final Target t = targetManagement.findTargetByControllerID(myt.getControllerId());
|
||||||
assertThat(deploymentManagement.findActionsByTarget(t)).isEmpty();
|
assertThat(deploymentManagement.findActionsByTarget(t)).as("action should be empty").isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (final Target myt : savedDeployedTargets) {
|
for (final Target myt : savedDeployedTargets) {
|
||||||
final Target t = targetManagement.findTargetByControllerID(myt.getControllerId());
|
final Target t = targetManagement.findTargetByControllerID(myt.getControllerId());
|
||||||
final List<Action> activeActionsByTarget = deploymentManagement.findActiveActionsByTarget(t);
|
final List<Action> activeActionsByTarget = deploymentManagement.findActiveActionsByTarget(t);
|
||||||
assertThat(activeActionsByTarget).isNotEmpty();
|
assertThat(activeActionsByTarget).as("action should not be empty").isNotEmpty();
|
||||||
assertThat(t.getTargetInfo().getUpdateStatus()).isEqualTo(TargetUpdateStatus.PENDING);
|
assertThat(t.getTargetInfo().getUpdateStatus()).as("wrong target update status")
|
||||||
|
.isEqualTo(TargetUpdateStatus.PENDING);
|
||||||
for (final Action ua : activeActionsByTarget) {
|
for (final Action ua : activeActionsByTarget) {
|
||||||
assertThat(ua.getDistributionSet()).isEqualTo(ds);
|
assertThat(ua.getDistributionSet()).as("action has wrong ds").isEqualTo(ds);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -431,12 +461,13 @@ public class DeploymentManagementTest extends AbstractIntegrationTest {
|
|||||||
// give some chance to receive events asynchronously
|
// give some chance to receive events asynchronously
|
||||||
Thread.sleep(300);
|
Thread.sleep(300);
|
||||||
final List<TargetAssignDistributionSetEvent> events = eventHandlerMock.getEvents(1, TimeUnit.MILLISECONDS);
|
final List<TargetAssignDistributionSetEvent> events = eventHandlerMock.getEvents(1, TimeUnit.MILLISECONDS);
|
||||||
assertThat(events).isEmpty();
|
assertThat(events).as("events should be empty").isEmpty();
|
||||||
|
|
||||||
final EventHandlerMock eventHandlerMockAfterCompletionOfDs = new EventHandlerMock(10);
|
final EventHandlerMock eventHandlerMockAfterCompletionOfDs = new EventHandlerMock(10);
|
||||||
eventBus.register(eventHandlerMockAfterCompletionOfDs);
|
eventBus.register(eventHandlerMockAfterCompletionOfDs);
|
||||||
|
|
||||||
assertThat(deploymentManagement.assignDistributionSet(nowComplete, targets).getAssigned()).isEqualTo(10);
|
assertThat(deploymentManagement.assignDistributionSet(nowComplete, targets).getAssigned())
|
||||||
|
.as("assign ds doesn't work").isEqualTo(10);
|
||||||
assertTargetAssignDistributionSetEvents(targets, nowComplete,
|
assertTargetAssignDistributionSetEvents(targets, nowComplete,
|
||||||
eventHandlerMockAfterCompletionOfDs.getEvents(10, TimeUnit.SECONDS));
|
eventHandlerMockAfterCompletionOfDs.getEvents(10, TimeUnit.SECONDS));
|
||||||
}
|
}
|
||||||
@@ -476,7 +507,8 @@ public class DeploymentManagementTest extends AbstractIntegrationTest {
|
|||||||
// retrieving all Actions created by the assignDistributionSet call
|
// retrieving all Actions created by the assignDistributionSet call
|
||||||
final Page<Action> page = actionRepository.findAll(pageReq);
|
final Page<Action> page = actionRepository.findAll(pageReq);
|
||||||
// and verify the number
|
// and verify the number
|
||||||
assertThat(page.getTotalElements()).isEqualTo(noOfDeployedTargets * noOfDistributionSets);
|
assertThat(page.getTotalElements()).as("wrong size of actions")
|
||||||
|
.isEqualTo(noOfDeployedTargets * noOfDistributionSets);
|
||||||
|
|
||||||
// only records retrieved from the DB can be evaluated to be sure that
|
// only records retrieved from the DB can be evaluated to be sure that
|
||||||
// all fields are
|
// all fields are
|
||||||
@@ -487,17 +519,20 @@ public class DeploymentManagementTest extends AbstractIntegrationTest {
|
|||||||
final Iterable<Target> undeployedTargetsFromDB = targetRepository.findAll(undeployedTargetIDs);
|
final Iterable<Target> undeployedTargetsFromDB = targetRepository.findAll(undeployedTargetIDs);
|
||||||
|
|
||||||
// test that number of Targets
|
// test that number of Targets
|
||||||
assertThat(allFoundTargets.spliterator().getExactSizeIfKnown())
|
assertThat(allFoundTargets.spliterator().getExactSizeIfKnown()).as("number of target is wrong")
|
||||||
.isEqualTo(deployedTargetsFromDB.spliterator().getExactSizeIfKnown()
|
.isEqualTo(deployedTargetsFromDB.spliterator().getExactSizeIfKnown()
|
||||||
+ undeployedTargetsFromDB.spliterator().getExactSizeIfKnown());
|
+ undeployedTargetsFromDB.spliterator().getExactSizeIfKnown());
|
||||||
assertThat(deployedTargetsFromDB.spliterator().getExactSizeIfKnown()).isEqualTo(noOfDeployedTargets);
|
assertThat(deployedTargetsFromDB.spliterator().getExactSizeIfKnown()).as("number of target is wrong")
|
||||||
assertThat(undeployedTargetsFromDB.spliterator().getExactSizeIfKnown()).isEqualTo(noOfUndeployedTargets);
|
.isEqualTo(noOfDeployedTargets);
|
||||||
|
assertThat(undeployedTargetsFromDB.spliterator().getExactSizeIfKnown()).as("number of target is wrong")
|
||||||
|
.isEqualTo(noOfUndeployedTargets);
|
||||||
|
|
||||||
// test the content of different lists
|
// test the content of different lists
|
||||||
assertThat(allFoundTargets).containsAll(deployedTargetsFromDB).containsAll(undeployedTargetsFromDB);
|
assertThat(allFoundTargets).as("content of founded target is wrong").containsAll(deployedTargetsFromDB)
|
||||||
assertThat(deployedTargetsFromDB).containsAll(savedDeployedTargets)
|
.containsAll(undeployedTargetsFromDB);
|
||||||
|
assertThat(deployedTargetsFromDB).as("content of deployed target is wrong").containsAll(savedDeployedTargets)
|
||||||
.doesNotContain(Iterables.toArray(undeployedTargetsFromDB, Target.class));
|
.doesNotContain(Iterables.toArray(undeployedTargetsFromDB, Target.class));
|
||||||
assertThat(undeployedTargetsFromDB).containsAll(savedNakedTargets)
|
assertThat(undeployedTargetsFromDB).as("content of undeployed target is wrong").containsAll(savedNakedTargets)
|
||||||
.doesNotContain(Iterables.toArray(deployedTargetsFromDB, Target.class));
|
.doesNotContain(Iterables.toArray(deployedTargetsFromDB, Target.class));
|
||||||
|
|
||||||
// For each of the 4 targets 1 distribution sets gets assigned
|
// For each of the 4 targets 1 distribution sets gets assigned
|
||||||
@@ -525,42 +560,42 @@ public class DeploymentManagementTest extends AbstractIntegrationTest {
|
|||||||
final DistributionSet dsC = deployResWithDsC.getDistributionSets().get(0);
|
final DistributionSet dsC = deployResWithDsC.getDistributionSets().get(0);
|
||||||
|
|
||||||
// retrieving the UpdateActions created by the assignments
|
// retrieving the UpdateActions created by the assignments
|
||||||
final Action updActA = actionRepository.findByDistributionSet(pageRequest, dsA).getContent().get(0);
|
actionRepository.findByDistributionSet(pageRequest, dsA).getContent().get(0);
|
||||||
final Action updActB = actionRepository.findByDistributionSet(pageRequest, dsB).getContent().get(0);
|
actionRepository.findByDistributionSet(pageRequest, dsB).getContent().get(0);
|
||||||
final Action updActC = actionRepository.findByDistributionSet(pageRequest, dsC).getContent().get(0);
|
actionRepository.findByDistributionSet(pageRequest, dsC).getContent().get(0);
|
||||||
|
|
||||||
// verifying the correctness of the assignments
|
// verifying the correctness of the assignments
|
||||||
for (final Target t : deployResWithDsA.getDeployedTargets()) {
|
for (final Target t : deployResWithDsA.getDeployedTargets()) {
|
||||||
assertThat(t.getAssignedDistributionSet().getId()).isEqualTo(dsA.getId());
|
assertThat(t.getAssignedDistributionSet().getId()).as("assignment is not correct").isEqualTo(dsA.getId());
|
||||||
assertThat(targetManagement.findTargetByControllerID(t.getControllerId()).getTargetInfo()
|
assertThat(targetManagement.findTargetByControllerID(t.getControllerId()).getTargetInfo()
|
||||||
.getInstalledDistributionSet()).isNull();
|
.getInstalledDistributionSet()).as("installed ds should be null").isNull();
|
||||||
}
|
}
|
||||||
for (final Target t : deployResWithDsB.getDeployedTargets()) {
|
for (final Target t : deployResWithDsB.getDeployedTargets()) {
|
||||||
assertThat(t.getAssignedDistributionSet().getId()).isEqualTo(dsB.getId());
|
assertThat(t.getAssignedDistributionSet().getId()).as("assigned ds is wrong").isEqualTo(dsB.getId());
|
||||||
assertThat(targetManagement.findTargetByControllerID(t.getControllerId()).getTargetInfo()
|
assertThat(targetManagement.findTargetByControllerID(t.getControllerId()).getTargetInfo()
|
||||||
.getInstalledDistributionSet()).isNull();
|
.getInstalledDistributionSet()).as("installed ds should be null").isNull();
|
||||||
}
|
}
|
||||||
for (final Target t : deployResWithDsC.getDeployedTargets()) {
|
for (final Target t : deployResWithDsC.getDeployedTargets()) {
|
||||||
assertThat(t.getAssignedDistributionSet().getId()).isEqualTo(dsC.getId());
|
assertThat(t.getAssignedDistributionSet().getId()).isEqualTo(dsC.getId());
|
||||||
assertThat(targetManagement.findTargetByControllerID(t.getControllerId()).getTargetInfo()
|
assertThat(targetManagement.findTargetByControllerID(t.getControllerId()).getTargetInfo()
|
||||||
.getInstalledDistributionSet()).isNull();
|
.getInstalledDistributionSet()).as("installed ds should not be null").isNull();
|
||||||
assertThat(targetManagement.findTargetByControllerID(t.getControllerId()).getTargetInfo().getUpdateStatus())
|
assertThat(targetManagement.findTargetByControllerID(t.getControllerId()).getTargetInfo().getUpdateStatus())
|
||||||
.isEqualTo(TargetUpdateStatus.PENDING);
|
.as("wrong target info update status").isEqualTo(TargetUpdateStatus.PENDING);
|
||||||
}
|
}
|
||||||
|
|
||||||
final List<Target> updatedTsDsA = sendUpdateActionStatusToTargets(dsA, deployResWithDsA.getDeployedTargets(),
|
final List<Target> updatedTsDsA = sendUpdateActionStatusToTargets(dsA, deployResWithDsA.getDeployedTargets(),
|
||||||
Status.FINISHED, new String[] { "alles gut" });
|
Status.FINISHED, new String[] { "alles gut" });
|
||||||
|
|
||||||
// verify, that dsA is deployed correctly
|
// verify, that dsA is deployed correctly
|
||||||
assertThat(updatedTsDsA).isEqualTo(deployResWithDsA.getDeployedTargets());
|
assertThat(updatedTsDsA).as("ds is not deployed correctly").isEqualTo(deployResWithDsA.getDeployedTargets());
|
||||||
for (final Target t_ : updatedTsDsA) {
|
for (final Target t_ : updatedTsDsA) {
|
||||||
final Target t = targetManagement.findTargetByControllerID(t_.getControllerId());
|
final Target t = targetManagement.findTargetByControllerID(t_.getControllerId());
|
||||||
assertThat(t.getAssignedDistributionSet()).isEqualTo(dsA);
|
assertThat(t.getAssignedDistributionSet()).as("assigned ds is wrong").isEqualTo(dsA);
|
||||||
assertThat(targetManagement.findTargetByControllerID(t.getControllerId()).getTargetInfo()
|
assertThat(targetManagement.findTargetByControllerID(t.getControllerId()).getTargetInfo()
|
||||||
.getInstalledDistributionSet()).isEqualTo(dsA);
|
.getInstalledDistributionSet()).as("installed ds is wrong").isEqualTo(dsA);
|
||||||
assertThat(targetManagement.findTargetByControllerID(t.getControllerId()).getTargetInfo().getUpdateStatus())
|
assertThat(targetManagement.findTargetByControllerID(t.getControllerId()).getTargetInfo().getUpdateStatus())
|
||||||
.isEqualTo(TargetUpdateStatus.IN_SYNC);
|
.as("wrong target info update status").isEqualTo(TargetUpdateStatus.IN_SYNC);
|
||||||
assertThat(deploymentManagement.findActiveActionsByTarget(t)).hasSize(0);
|
assertThat(deploymentManagement.findActiveActionsByTarget(t)).as("no actions should be active").hasSize(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// deploy dsA to the target which already have dsB deployed -> must
|
// deploy dsA to the target which already have dsB deployed -> must
|
||||||
@@ -569,18 +604,18 @@ public class DeploymentManagementTest extends AbstractIntegrationTest {
|
|||||||
// UpdateAction for dsA
|
// UpdateAction for dsA
|
||||||
final Iterable<Target> deployed2DS = deploymentManagement
|
final Iterable<Target> deployed2DS = deploymentManagement
|
||||||
.assignDistributionSet(dsA, deployResWithDsB.getDeployedTargets()).getAssignedTargets();
|
.assignDistributionSet(dsA, deployResWithDsB.getDeployedTargets()).getAssignedTargets();
|
||||||
final Action updActA2 = actionRepository.findByDistributionSet(pageRequest, dsA).getContent().get(1);
|
actionRepository.findByDistributionSet(pageRequest, dsA).getContent().get(1);
|
||||||
|
|
||||||
assertThat(deployed2DS).containsAll(deployResWithDsB.getDeployedTargets());
|
assertThat(deployed2DS).as("deployed ds is wrong").containsAll(deployResWithDsB.getDeployedTargets());
|
||||||
assertThat(deployed2DS).hasSameSizeAs(deployResWithDsB.getDeployedTargets());
|
assertThat(deployed2DS).as("deployed ds is wrong").hasSameSizeAs(deployResWithDsB.getDeployedTargets());
|
||||||
|
|
||||||
for (final Target t_ : deployed2DS) {
|
for (final Target t_ : deployed2DS) {
|
||||||
final Target t = targetManagement.findTargetByControllerID(t_.getControllerId());
|
final Target t = targetManagement.findTargetByControllerID(t_.getControllerId());
|
||||||
assertThat(t.getAssignedDistributionSet()).isEqualTo(dsA);
|
assertThat(t.getAssignedDistributionSet()).as("assigned ds is wrong").isEqualTo(dsA);
|
||||||
assertThat(targetManagement.findTargetByControllerID(t.getControllerId()).getTargetInfo()
|
assertThat(targetManagement.findTargetByControllerID(t.getControllerId()).getTargetInfo()
|
||||||
.getInstalledDistributionSet()).isNull();
|
.getInstalledDistributionSet()).as("installed ds should be null").isNull();
|
||||||
assertThat(targetManagement.findTargetByControllerID(t.getControllerId()).getTargetInfo().getUpdateStatus())
|
assertThat(targetManagement.findTargetByControllerID(t.getControllerId()).getTargetInfo().getUpdateStatus())
|
||||||
.isEqualTo(TargetUpdateStatus.PENDING);
|
.as("wrong target info update status").isEqualTo(TargetUpdateStatus.PENDING);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -613,22 +648,22 @@ public class DeploymentManagementTest extends AbstractIntegrationTest {
|
|||||||
|
|
||||||
distributionSetManagement.deleteDistributionSet(dsA.getId());
|
distributionSetManagement.deleteDistributionSet(dsA.getId());
|
||||||
dsA = distributionSetManagement.findDistributionSetById(dsA.getId());
|
dsA = distributionSetManagement.findDistributionSetById(dsA.getId());
|
||||||
assertThat(dsA).isNull();
|
assertThat(dsA).as("ds should be null").isNull();
|
||||||
|
|
||||||
// // verify that the ds is not physically deleted
|
// // verify that the ds is not physically deleted
|
||||||
for (final DistributionSet ds : deploymentResult.getDistributionSets()) {
|
for (final DistributionSet ds : deploymentResult.getDistributionSets()) {
|
||||||
distributionSetManagement.deleteDistributionSet(ds.getId());
|
distributionSetManagement.deleteDistributionSet(ds.getId());
|
||||||
final DistributionSet foundDS = distributionSetManagement.findDistributionSetById(ds.getId());
|
final DistributionSet foundDS = distributionSetManagement.findDistributionSetById(ds.getId());
|
||||||
assertThat(foundDS).isNotNull();
|
assertThat(foundDS).as("founded should not be null").isNotNull();
|
||||||
assertThat(foundDS.isDeleted()).isTrue();
|
assertThat(foundDS.isDeleted()).as("founded ds should be deleted").isTrue();
|
||||||
}
|
}
|
||||||
|
|
||||||
// verify that deleted attribute is used correctly
|
// verify that deleted attribute is used correctly
|
||||||
List<DistributionSet> allFoundDS = distributionSetManagement.findDistributionSetsAll(pageReq, false, true)
|
List<DistributionSet> allFoundDS = distributionSetManagement.findDistributionSetsAll(pageReq, false, true)
|
||||||
.getContent();
|
.getContent();
|
||||||
assertThat(allFoundDS.size()).isEqualTo(0);
|
assertThat(allFoundDS.size()).as("no ds should be founded").isEqualTo(0);
|
||||||
allFoundDS = distributionSetManagement.findDistributionSetsAll(pageRequest, true, true).getContent();
|
allFoundDS = distributionSetManagement.findDistributionSetsAll(pageRequest, true, true).getContent();
|
||||||
assertThat(allFoundDS).hasSize(noOfDistributionSets);
|
assertThat(allFoundDS).as("wrong size of founded ds").hasSize(noOfDistributionSets);
|
||||||
|
|
||||||
for (final DistributionSet ds : deploymentResult.getDistributionSets()) {
|
for (final DistributionSet ds : deploymentResult.getDistributionSets()) {
|
||||||
sendUpdateActionStatusToTargets(ds, deploymentResult.getDeployedTargets(), Status.FINISHED,
|
sendUpdateActionStatusToTargets(ds, deploymentResult.getDeployedTargets(), Status.FINISHED,
|
||||||
@@ -642,9 +677,9 @@ public class DeploymentManagementTest extends AbstractIntegrationTest {
|
|||||||
// successfully and no activeAction is referring to created distribution
|
// successfully and no activeAction is referring to created distribution
|
||||||
// sets
|
// sets
|
||||||
allFoundDS = distributionSetManagement.findDistributionSetsAll(pageRequest, false, true).getContent();
|
allFoundDS = distributionSetManagement.findDistributionSetsAll(pageRequest, false, true).getContent();
|
||||||
assertThat(allFoundDS.size()).isEqualTo(0);
|
assertThat(allFoundDS.size()).as("no ds should be founded").isEqualTo(0);
|
||||||
allFoundDS = distributionSetManagement.findDistributionSetsAll(pageRequest, true, true).getContent();
|
allFoundDS = distributionSetManagement.findDistributionSetsAll(pageRequest, true, true).getContent();
|
||||||
assertThat(allFoundDS).hasSize(noOfDistributionSets);
|
assertThat(allFoundDS).as("size of founded ds is wrong").hasSize(noOfDistributionSets);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -668,15 +703,15 @@ public class DeploymentManagementTest extends AbstractIntegrationTest {
|
|||||||
"blabla alles gut");
|
"blabla alles gut");
|
||||||
}
|
}
|
||||||
|
|
||||||
assertThat(targetManagement.countTargetsAll()).isNotZero();
|
assertThat(targetManagement.countTargetsAll()).as("size of targets is wrong").isNotZero();
|
||||||
assertThat(actionStatusRepository.count()).isNotZero();
|
assertThat(actionStatusRepository.count()).as("size of action status is wrong").isNotZero();
|
||||||
|
|
||||||
targetManagement
|
targetManagement
|
||||||
.deleteTargets(deploymentResult.getUndeployedTargetIDs().toArray(new Long[noOfUndeployedTargets]));
|
.deleteTargets(deploymentResult.getUndeployedTargetIDs().toArray(new Long[noOfUndeployedTargets]));
|
||||||
targetManagement.deleteTargets(deploymentResult.getDeployedTargetIDs().toArray(new Long[noOfDeployedTargets]));
|
targetManagement.deleteTargets(deploymentResult.getDeployedTargetIDs().toArray(new Long[noOfDeployedTargets]));
|
||||||
|
|
||||||
assertThat(targetManagement.countTargetsAll()).isZero();
|
assertThat(targetManagement.countTargetsAll()).as("size of targets should be zero").isZero();
|
||||||
assertThat(actionStatusRepository.count()).isZero();
|
assertThat(actionStatusRepository.count()).as("size of action status is wrong").isZero();
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<Target> sendUpdateActionStatusToTargets(final DistributionSet dsA, final Iterable<Target> targs,
|
private List<Target> sendUpdateActionStatusToTargets(final DistributionSet dsA, final Iterable<Target> targs,
|
||||||
@@ -727,7 +762,7 @@ public class DeploymentManagementTest extends AbstractIntegrationTest {
|
|||||||
// checking the revisions of the created entities
|
// checking the revisions of the created entities
|
||||||
// verifying that the revision of the object and the revision within the
|
// verifying that the revision of the object and the revision within the
|
||||||
// DB has not changed
|
// DB has not changed
|
||||||
assertThat(dsA.getOptLockRevision()).isEqualTo(
|
assertThat(dsA.getOptLockRevision()).as("lock revision is wrong").isEqualTo(
|
||||||
distributionSetManagement.findDistributionSetByIdWithDetails(dsA.getId()).getOptLockRevision());
|
distributionSetManagement.findDistributionSetByIdWithDetails(dsA.getId()).getOptLockRevision());
|
||||||
|
|
||||||
// verifying that the assignment is correct
|
// verifying that the assignment is correct
|
||||||
@@ -778,12 +813,11 @@ public class DeploymentManagementTest extends AbstractIntegrationTest {
|
|||||||
public void checkThatDsRevisionsIsNotChangedWithTargetAssignment() {
|
public void checkThatDsRevisionsIsNotChangedWithTargetAssignment() {
|
||||||
final DistributionSet dsA = TestDataUtil.generateDistributionSet("a", softwareManagement,
|
final DistributionSet dsA = TestDataUtil.generateDistributionSet("a", softwareManagement,
|
||||||
distributionSetManagement);
|
distributionSetManagement);
|
||||||
final DistributionSet dsB = TestDataUtil.generateDistributionSet("b", softwareManagement,
|
TestDataUtil.generateDistributionSet("b", softwareManagement, distributionSetManagement);
|
||||||
distributionSetManagement);
|
|
||||||
Target targ = targetManagement
|
Target targ = targetManagement
|
||||||
.createTarget(TestDataUtil.buildTargetFixture("target-id-A", "first description"));
|
.createTarget(TestDataUtil.buildTargetFixture("target-id-A", "first description"));
|
||||||
|
|
||||||
assertThat(dsA.getOptLockRevision()).isEqualTo(
|
assertThat(dsA.getOptLockRevision()).as("lock revision is wrong").isEqualTo(
|
||||||
distributionSetManagement.findDistributionSetByIdWithDetails(dsA.getId()).getOptLockRevision());
|
distributionSetManagement.findDistributionSetByIdWithDetails(dsA.getId()).getOptLockRevision());
|
||||||
|
|
||||||
final List<Target> targs = new ArrayList<Target>();
|
final List<Target> targs = new ArrayList<Target>();
|
||||||
@@ -791,7 +825,7 @@ public class DeploymentManagementTest extends AbstractIntegrationTest {
|
|||||||
final Iterable<Target> savedTargs = deploymentManagement.assignDistributionSet(dsA, targs).getAssignedTargets();
|
final Iterable<Target> savedTargs = deploymentManagement.assignDistributionSet(dsA, targs).getAssignedTargets();
|
||||||
targ = savedTargs.iterator().next();
|
targ = savedTargs.iterator().next();
|
||||||
|
|
||||||
assertThat(dsA.getOptLockRevision()).isEqualTo(
|
assertThat(dsA.getOptLockRevision()).as("lock revision is wrong").isEqualTo(
|
||||||
distributionSetManagement.findDistributionSetByIdWithDetails(dsA.getId()).getOptLockRevision());
|
distributionSetManagement.findDistributionSetByIdWithDetails(dsA.getId()).getOptLockRevision());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -805,17 +839,17 @@ public class DeploymentManagementTest extends AbstractIntegrationTest {
|
|||||||
// assign ds to create an action
|
// assign ds to create an action
|
||||||
final DistributionSetAssignmentResult assignDistributionSet = deploymentManagement
|
final DistributionSetAssignmentResult assignDistributionSet = deploymentManagement
|
||||||
.assignDistributionSet(ds.getId(), ActionType.SOFT, Action.NO_FORCE_TIME, target.getControllerId());
|
.assignDistributionSet(ds.getId(), ActionType.SOFT, Action.NO_FORCE_TIME, target.getControllerId());
|
||||||
final Action action = assignDistributionSet.getActions().get(0);
|
final Action action = deploymentManagement.findActionWithDetails(assignDistributionSet.getActions().get(0));
|
||||||
// verify preparation
|
// verify preparation
|
||||||
Action findAction = deploymentManagement.findAction(action.getId());
|
Action findAction = deploymentManagement.findAction(action.getId());
|
||||||
assertThat(findAction.getActionType()).isEqualTo(ActionType.SOFT);
|
assertThat(findAction.getActionType()).as("action type is wrong").isEqualTo(ActionType.SOFT);
|
||||||
|
|
||||||
// test
|
// test
|
||||||
deploymentManagement.forceTargetAction(action.getId());
|
deploymentManagement.forceTargetAction(action.getId());
|
||||||
|
|
||||||
// verify test
|
// verify test
|
||||||
findAction = deploymentManagement.findAction(action.getId());
|
findAction = deploymentManagement.findAction(action.getId());
|
||||||
assertThat(findAction.getActionType()).isEqualTo(ActionType.FORCED);
|
assertThat(findAction.getActionType()).as("action type is wrong").isEqualTo(ActionType.FORCED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -828,18 +862,18 @@ public class DeploymentManagementTest extends AbstractIntegrationTest {
|
|||||||
// assign ds to create an action
|
// assign ds to create an action
|
||||||
final DistributionSetAssignmentResult assignDistributionSet = deploymentManagement
|
final DistributionSetAssignmentResult assignDistributionSet = deploymentManagement
|
||||||
.assignDistributionSet(ds.getId(), ActionType.FORCED, Action.NO_FORCE_TIME, target.getControllerId());
|
.assignDistributionSet(ds.getId(), ActionType.FORCED, Action.NO_FORCE_TIME, target.getControllerId());
|
||||||
final Action action = assignDistributionSet.getActions().get(0);
|
final Action action = deploymentManagement.findActionWithDetails(assignDistributionSet.getActions().get(0));
|
||||||
// verify perparation
|
// verify perparation
|
||||||
Action findAction = deploymentManagement.findAction(action.getId());
|
Action findAction = deploymentManagement.findAction(action.getId());
|
||||||
assertThat(findAction.getActionType()).isEqualTo(ActionType.FORCED);
|
assertThat(findAction.getActionType()).as("action type is wrong").isEqualTo(ActionType.FORCED);
|
||||||
|
|
||||||
// test
|
// test
|
||||||
final Action forceTargetAction = deploymentManagement.forceTargetAction(action.getId());
|
final Action forceTargetAction = deploymentManagement.forceTargetAction(action.getId());
|
||||||
|
|
||||||
// verify test
|
// verify test
|
||||||
assertThat(forceTargetAction.getActionType()).isEqualTo(ActionType.FORCED);
|
assertThat(forceTargetAction.getActionType()).as("action type is wrong").isEqualTo(ActionType.FORCED);
|
||||||
findAction = deploymentManagement.findAction(action.getId());
|
findAction = deploymentManagement.findAction(action.getId());
|
||||||
assertThat(findAction.getActionType()).isEqualTo(ActionType.FORCED);
|
assertThat(findAction.getActionType()).as("action type is wrong").isEqualTo(ActionType.FORCED);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -848,7 +882,7 @@ public class DeploymentManagementTest extends AbstractIntegrationTest {
|
|||||||
* <p>
|
* <p>
|
||||||
* <b>All created distribution sets are assigned to all targets of the
|
* <b>All created distribution sets are assigned to all targets of the
|
||||||
* target list deployedTargets.</b>
|
* target list deployedTargets.</b>
|
||||||
*
|
*
|
||||||
* @param undeployedTargetPrefix
|
* @param undeployedTargetPrefix
|
||||||
* prefix to be used as target controller prefix
|
* prefix to be used as target controller prefix
|
||||||
* @param noOfUndeployedTargets
|
* @param noOfUndeployedTargets
|
||||||
@@ -901,14 +935,14 @@ public class DeploymentManagementTest extends AbstractIntegrationTest {
|
|||||||
if (event.getControllerId().equals(myt.getControllerId())) {
|
if (event.getControllerId().equals(myt.getControllerId())) {
|
||||||
found = true;
|
found = true;
|
||||||
final List<Action> activeActionsByTarget = deploymentManagement.findActiveActionsByTarget(myt);
|
final List<Action> activeActionsByTarget = deploymentManagement.findActiveActionsByTarget(myt);
|
||||||
assertThat(activeActionsByTarget).isNotEmpty();
|
assertThat(activeActionsByTarget).as("size of active actions for target is wrong").isNotEmpty();
|
||||||
assertThat(event.getActionId()).isEqualTo(activeActionsByTarget.get(0).getId())
|
assertThat(event.getActionId()).as("Action id in database and event do not match")
|
||||||
.as("Action id in database and event do not match");
|
.isEqualTo(activeActionsByTarget.get(0).getId());
|
||||||
assertThat(event.getSoftwareModules())
|
assertThat(event.getSoftwareModules()).as("softwaremodule size is not correct")
|
||||||
.containsOnly(ds.getModules().toArray(new SoftwareModule[ds.getModules().size()]));
|
.containsOnly(ds.getModules().toArray(new SoftwareModule[ds.getModules().size()]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assertThat(found).isTrue().as("No event found for controller " + myt.getControllerId());
|
assertThat(found).as("No event found for controller " + myt.getControllerId()).isTrue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -927,42 +961,19 @@ public class DeploymentManagementTest extends AbstractIntegrationTest {
|
|||||||
private final List<Target> deployedTargets = new ArrayList<Target>();
|
private final List<Target> deployedTargets = new ArrayList<Target>();
|
||||||
private final List<DistributionSet> distributionSets = new ArrayList<DistributionSet>();
|
private final List<DistributionSet> distributionSets = new ArrayList<DistributionSet>();
|
||||||
|
|
||||||
private final String undeployedTargetPrefix;
|
|
||||||
private final String deployedTargetPrefix;
|
|
||||||
private final String distributionSetPrefix;
|
|
||||||
|
|
||||||
public DeploymentResult(final Iterable<Target> deployedTs, final Iterable<Target> undeployedTs,
|
public DeploymentResult(final Iterable<Target> deployedTs, final Iterable<Target> undeployedTs,
|
||||||
final Iterable<DistributionSet> dss, final String deployedTargetPrefix,
|
final Iterable<DistributionSet> dss, final String deployedTargetPrefix,
|
||||||
final String undeployedTargetPrefix, final String distributionSetPrefix) {
|
final String undeployedTargetPrefix, final String distributionSetPrefix) {
|
||||||
|
|
||||||
this.undeployedTargetPrefix = undeployedTargetPrefix;
|
|
||||||
this.deployedTargetPrefix = deployedTargetPrefix;
|
|
||||||
this.distributionSetPrefix = distributionSetPrefix;
|
|
||||||
|
|
||||||
Iterables.addAll(deployedTargets, deployedTs);
|
Iterables.addAll(deployedTargets, deployedTs);
|
||||||
Iterables.addAll(undeployedTargets, undeployedTs);
|
Iterables.addAll(undeployedTargets, undeployedTs);
|
||||||
Iterables.addAll(distributionSets, dss);
|
Iterables.addAll(distributionSets, dss);
|
||||||
|
|
||||||
deployedTargets.forEach(new Consumer<Target>() {
|
deployedTargets.forEach(t -> deployedTargetIDs.add(t.getId()));
|
||||||
@Override
|
|
||||||
public void accept(final Target t) {
|
|
||||||
deployedTargetIDs.add(t.getId());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
undeployedTargets.forEach(new Consumer<Target>() {
|
undeployedTargets.forEach(t -> undeployedTargetIDs.add(t.getId()));
|
||||||
@Override
|
|
||||||
public void accept(final Target t) {
|
|
||||||
undeployedTargetIDs.add(t.getId());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
distributionSets.forEach(new Consumer<DistributionSet>() {
|
distributionSets.forEach(ds -> distributionSetIDs.add(ds.getId()));
|
||||||
@Override
|
|
||||||
public void accept(final DistributionSet ds) {
|
|
||||||
distributionSetIDs.add(ds.getId());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1001,27 +1012,6 @@ public class DeploymentManagementTest extends AbstractIntegrationTest {
|
|||||||
return deployedTargets;
|
return deployedTargets;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the noOfUndeployedTargets
|
|
||||||
*/
|
|
||||||
public int getNoOfUndeployedTargets() {
|
|
||||||
return undeployedTargetIDs.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the noOfDeployedTargets
|
|
||||||
*/
|
|
||||||
public int getNoOfDeployedTargets() {
|
|
||||||
return deployedTargetIDs.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the noOfDistributionSets
|
|
||||||
*/
|
|
||||||
public int getNoOfDistributionSets() {
|
|
||||||
return distributionSets.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the undeployedTargetIDs
|
* @return the undeployedTargetIDs
|
||||||
*/
|
*/
|
||||||
@@ -1029,26 +1019,6 @@ public class DeploymentManagementTest extends AbstractIntegrationTest {
|
|||||||
return undeployedTargetIDs;
|
return undeployedTargetIDs;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the undeployedTargetPrefix
|
|
||||||
*/
|
|
||||||
public String getUndeployedTargetPrefix() {
|
|
||||||
return undeployedTargetPrefix;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the deployedTargetPrefix
|
|
||||||
*/
|
|
||||||
public String getDeployedTargetPrefix() {
|
|
||||||
return deployedTargetPrefix;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the distributionSetPrefix
|
|
||||||
*/
|
|
||||||
public String getDistributionSetPrefix() {
|
|
||||||
return distributionSetPrefix;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class EventHandlerMock {
|
private static class EventHandlerMock {
|
||||||
@@ -1073,9 +1043,9 @@ public class DeploymentManagementTest extends AbstractIntegrationTest {
|
|||||||
latch.await(timeout, unit);
|
latch.await(timeout, unit);
|
||||||
final List<TargetAssignDistributionSetEvent> handledEvents = new LinkedList<TargetAssignDistributionSetEvent>(
|
final List<TargetAssignDistributionSetEvent> handledEvents = new LinkedList<TargetAssignDistributionSetEvent>(
|
||||||
events);
|
events);
|
||||||
assertThat(handledEvents).hasSize(expectedNumberOfEvents)
|
assertThat(handledEvents).as("Did not receive the expected amount of events (" + expectedNumberOfEvents
|
||||||
.as("Did not receive the expected amount of events (" + expectedNumberOfEvents
|
+ ") within timeout. Received events are " + handledEvents).hasSize(expectedNumberOfEvents);
|
||||||
+ ") within timeout. Received events are " + handledEvents);
|
|
||||||
return handledEvents;
|
return handledEvents;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1101,9 +1071,8 @@ public class DeploymentManagementTest extends AbstractIntegrationTest {
|
|||||||
throws InterruptedException {
|
throws InterruptedException {
|
||||||
latch.await(timeout, unit);
|
latch.await(timeout, unit);
|
||||||
final List<CancelTargetAssignmentEvent> handledEvents = new LinkedList<CancelTargetAssignmentEvent>(events);
|
final List<CancelTargetAssignmentEvent> handledEvents = new LinkedList<CancelTargetAssignmentEvent>(events);
|
||||||
assertThat(handledEvents).hasSize(expectedNumberOfEvents)
|
assertThat(handledEvents).as("Did not receive the expected amount of events (" + expectedNumberOfEvents
|
||||||
.as("Did not receive the expected amount of events (" + expectedNumberOfEvents
|
+ ") within timeout. Received events are " + handledEvents).hasSize(expectedNumberOfEvents);
|
||||||
+ ") within timeout. Received events are " + handledEvents);
|
|
||||||
return handledEvents;
|
return handledEvents;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ import java.util.ArrayList;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.Callable;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.AbstractIntegrationTest;
|
import org.eclipse.hawkbit.AbstractIntegrationTest;
|
||||||
@@ -96,10 +95,11 @@ public class ReportManagementTest extends AbstractIntegrationTest {
|
|||||||
// +1 because we go back #maxMonthBackAmountReportTargets but in the
|
// +1 because we go back #maxMonthBackAmountReportTargets but in the
|
||||||
// report the current month
|
// report the current month
|
||||||
// is included for sure, so from this month we go back
|
// is included for sure, so from this month we go back
|
||||||
assertThat(targetsCreatedOverPeriod.getData()).hasSize(maxMonthBackAmountReportTargets + 1);
|
assertThat(targetsCreatedOverPeriod.getData()).as("created over period has wrong size")
|
||||||
|
.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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -138,7 +138,8 @@ public class ReportManagementTest extends AbstractIntegrationTest {
|
|||||||
final Target createTarget = targetManagement.createTarget(new Target("t" + month));
|
final Target createTarget = targetManagement.createTarget(new Target("t" + month));
|
||||||
final DistributionSetAssignmentResult result = deploymentManagement.assignDistributionSet(distributionSet,
|
final DistributionSetAssignmentResult result = deploymentManagement.assignDistributionSet(distributionSet,
|
||||||
Lists.newArrayList(createTarget));
|
Lists.newArrayList(createTarget));
|
||||||
controllerManagament.registerRetrieved(result.getActions().get(0),
|
controllerManagament.registerRetrieved(
|
||||||
|
deploymentManagement.findActionWithDetails(result.getActions().get(0)),
|
||||||
"Controller retrieved update action and should start now the download.");
|
"Controller retrieved update action and should start now the download.");
|
||||||
}
|
}
|
||||||
DataReportSeries<LocalDate> feedbackReceivedOverTime = reportManagement
|
DataReportSeries<LocalDate> feedbackReceivedOverTime = reportManagement
|
||||||
@@ -146,10 +147,11 @@ public class ReportManagementTest extends AbstractIntegrationTest {
|
|||||||
// +1 because we go back #maxMonthBackAmountReportTargets but in the
|
// +1 because we go back #maxMonthBackAmountReportTargets but in the
|
||||||
// report the current month
|
// report the current month
|
||||||
// is included for sure, so from this month we go back
|
// is included for sure, so from this month we go back
|
||||||
assertThat(feedbackReceivedOverTime.getData()).hasSize(maxMonthBackAmountReportTargets + 1);
|
assertThat(feedbackReceivedOverTime.getData()).as("feedback receiver has wrong data size")
|
||||||
|
.hasSize(maxMonthBackAmountReportTargets + 1);
|
||||||
for (final DataReportSeriesItem<LocalDate> reportItem : feedbackReceivedOverTime.getData()) {
|
for (final DataReportSeriesItem<LocalDate> reportItem : feedbackReceivedOverTime.getData()) {
|
||||||
// only one target feedback is created for each month
|
// only one target feedback is created for each month
|
||||||
assertThat(reportItem.getData().intValue()).isEqualTo(1);
|
assertThat(reportItem.getData().intValue()).as("data size is wrong").isEqualTo(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// check cache evict
|
// check cache evict
|
||||||
@@ -158,12 +160,13 @@ public class ReportManagementTest extends AbstractIntegrationTest {
|
|||||||
final Target createTarget = targetManagement.createTarget(new Target("t2" + month));
|
final Target createTarget = targetManagement.createTarget(new Target("t2" + month));
|
||||||
final DistributionSetAssignmentResult result = deploymentManagement.assignDistributionSet(distributionSet,
|
final DistributionSetAssignmentResult result = deploymentManagement.assignDistributionSet(distributionSet,
|
||||||
Lists.newArrayList(createTarget));
|
Lists.newArrayList(createTarget));
|
||||||
controllerManagament.registerRetrieved(result.getActions().get(0),
|
controllerManagament.registerRetrieved(
|
||||||
|
deploymentManagement.findActionWithDetails(result.getActions().get(0)),
|
||||||
"Controller retrieved update action and should start now the download.");
|
"Controller retrieved update action and should start now the download.");
|
||||||
}
|
}
|
||||||
feedbackReceivedOverTime = reportManagement.feedbackReceivedOverTime(DateTypes.perMonth(), from, to);
|
feedbackReceivedOverTime = reportManagement.feedbackReceivedOverTime(DateTypes.perMonth(), from, to);
|
||||||
for (final DataReportSeriesItem<LocalDate> reportItem : feedbackReceivedOverTime.getData()) {
|
for (final DataReportSeriesItem<LocalDate> reportItem : feedbackReceivedOverTime.getData()) {
|
||||||
assertThat(reportItem.getData().intValue()).isEqualTo(2);
|
assertThat(reportItem.getData().intValue()).as("report item has wrong data size").isEqualTo(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -221,21 +224,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");
|
.as("versio item contains wrong version").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).as("Version/Item type has wrong size").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).as("Version/Item type has wrong size").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 +259,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 +285,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 +320,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 +389,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");
|
.as("Out series contains wrong version").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).as("out series has wrong size").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).as("out series has wrong size").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 +426,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 +460,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);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -468,33 +488,26 @@ public class ReportManagementTest extends AbstractIntegrationTest {
|
|||||||
final int targetCreateAmount = 10;
|
final int targetCreateAmount = 10;
|
||||||
|
|
||||||
// create targets for another tenant
|
// create targets for another tenant
|
||||||
securityRule.runAs(WithSpringAuthorityRule.withUserAndTenant("user", "anotherTenant"), new Callable<Void>() {
|
securityRule.runAs(WithSpringAuthorityRule.withUserAndTenant("user", "anotherTenant"), () -> {
|
||||||
@Override
|
for (int index = 0; index < targetCreateAmount; index++) {
|
||||||
public Void call() throws Exception {
|
targetManagement.createTarget(new Target("t" + index));
|
||||||
for (int index = 0; index < targetCreateAmount; index++) {
|
|
||||||
targetManagement.createTarget(new Target("t" + index));
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
// ensure targets has been created for 'anotherTenant'
|
// ensure targets has been created for 'anotherTenant'
|
||||||
final Slice<Target> targetsForAnotherTenant = securityRule.runAs(
|
final Slice<Target> targetsForAnotherTenant = securityRule.runAs(
|
||||||
WithSpringAuthorityRule.withUserAndTenant("user", "anotherTenant"), new Callable<Slice<Target>>() {
|
WithSpringAuthorityRule.withUserAndTenant("user", "anotherTenant"),
|
||||||
@Override
|
() -> targetManagement.findTargetsAll(new PageRequest(0, 1000)));
|
||||||
public Slice<Target> call() throws Exception {
|
assertThat(targetsForAnotherTenant).as("targets has wrong size").hasSize(targetCreateAmount);
|
||||||
return targetManagement.findTargetsAll(new PageRequest(0, 1000));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
assertThat(targetsForAnotherTenant).hasSize(targetCreateAmount);
|
|
||||||
|
|
||||||
final LocalDateTime to = LocalDateTime.now();
|
final LocalDateTime to = LocalDateTime.now();
|
||||||
final LocalDateTime from = to.minusMonths(targetCreateAmount);
|
final LocalDateTime from = to.minusMonths(targetCreateAmount);
|
||||||
// now retrieve the report for the 'mytenant'
|
// now retrieve the report for the 'mytenant'
|
||||||
final DataReportSeries<LocalDate> targetsCreatedOverPeriod = reportManagement
|
final DataReportSeries<LocalDate> targetsCreatedOverPeriod = reportManagement
|
||||||
.targetsCreatedOverPeriod(DateTypes.perMonth(), from, to);
|
.targetsCreatedOverPeriod(DateTypes.perMonth(), from, to);
|
||||||
// final no targets should final be created for this tenant
|
assertThat(targetsCreatedOverPeriod.getData()).as("final no targets should final be created for this tenant")
|
||||||
assertThat(targetsCreatedOverPeriod.getData()).hasSize(0);
|
.hasSize(0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -555,7 +568,7 @@ public class ReportManagementTest extends AbstractIntegrationTest {
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
*
|
||||||
* @see org.springframework.data.auditing.DateTimeProvider#getNow()
|
* @see org.springframework.data.auditing.DateTimeProvider#getNow()
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -159,10 +159,10 @@ public class SoftwareManagementTest extends AbstractIntegrationTestWithMongoDB {
|
|||||||
public void hardDeleteOfNotAssignedArtifact() {
|
public void hardDeleteOfNotAssignedArtifact() {
|
||||||
|
|
||||||
// [STEP1]: Create SoftwareModuleX with Artifacts
|
// [STEP1]: Create SoftwareModuleX with Artifacts
|
||||||
SoftwareModule unassignedModule = createSoftwareModuleWithArtifacts(osType, "moduleX", "3.0.2", 2);
|
final SoftwareModule unassignedModule = createSoftwareModuleWithArtifacts(osType, "moduleX", "3.0.2", 2);
|
||||||
Iterator<Artifact> artifactsIt = unassignedModule.getArtifacts().iterator();
|
final Iterator<Artifact> artifactsIt = unassignedModule.getArtifacts().iterator();
|
||||||
Artifact artifact1 = artifactsIt.next();
|
final Artifact artifact1 = artifactsIt.next();
|
||||||
Artifact artifact2 = artifactsIt.next();
|
final Artifact artifact2 = artifactsIt.next();
|
||||||
|
|
||||||
// [STEP2]: Delete unassigned SoftwareModule
|
// [STEP2]: Delete unassigned SoftwareModule
|
||||||
softwareManagement.deleteSoftwareModule(unassignedModule);
|
softwareManagement.deleteSoftwareModule(unassignedModule);
|
||||||
@@ -185,7 +185,7 @@ public class SoftwareManagementTest extends AbstractIntegrationTestWithMongoDB {
|
|||||||
public void softDeleteOfAssignedArtifact() {
|
public void softDeleteOfAssignedArtifact() {
|
||||||
|
|
||||||
// Init DistributionSet
|
// Init DistributionSet
|
||||||
DistributionSet disSet = distributionSetManagement
|
final DistributionSet disSet = distributionSetManagement
|
||||||
.createDistributionSet(new DistributionSet("ds1", "v1.0", "test ds", standardDsType, null));
|
.createDistributionSet(new DistributionSet("ds1", "v1.0", "test ds", standardDsType, null));
|
||||||
|
|
||||||
// [STEP1]: Create SoftwareModuleX with ArtifactX
|
// [STEP1]: Create SoftwareModuleX with ArtifactX
|
||||||
@@ -200,14 +200,14 @@ public class SoftwareManagementTest extends AbstractIntegrationTestWithMongoDB {
|
|||||||
// [VERIFY EXPECTED RESULT]:
|
// [VERIFY EXPECTED RESULT]:
|
||||||
// verify: assignedModule is marked as deleted
|
// verify: assignedModule is marked as deleted
|
||||||
assignedModule = softwareManagement.findSoftwareModuleById(assignedModule.getId());
|
assignedModule = softwareManagement.findSoftwareModuleById(assignedModule.getId());
|
||||||
assertTrue(assignedModule.isDeleted());
|
assertTrue("The module should be flagged as deleted", assignedModule.isDeleted());
|
||||||
assertThat(softwareManagement.findSoftwareModulesAll(pageReq)).hasSize(0);
|
assertThat(softwareManagement.findSoftwareModulesAll(pageReq)).hasSize(0);
|
||||||
assertThat(softwareModuleRepository.findAll()).hasSize(1);
|
assertThat(softwareModuleRepository.findAll()).hasSize(1);
|
||||||
|
|
||||||
// verify: binary data is deleted
|
// verify: binary data is deleted
|
||||||
Iterator<Artifact> artifactsIt = assignedModule.getArtifacts().iterator();
|
final Iterator<Artifact> artifactsIt = assignedModule.getArtifacts().iterator();
|
||||||
Artifact artifact1 = artifactsIt.next();
|
final Artifact artifact1 = artifactsIt.next();
|
||||||
Artifact artifact2 = artifactsIt.next();
|
final Artifact artifact2 = artifactsIt.next();
|
||||||
assertArtfiactNull(artifact1, artifact2);
|
assertArtfiactNull(artifact1, artifact2);
|
||||||
|
|
||||||
// verify: artifact meta data is still available
|
// verify: artifact meta data is still available
|
||||||
@@ -221,7 +221,7 @@ public class SoftwareManagementTest extends AbstractIntegrationTestWithMongoDB {
|
|||||||
|
|
||||||
// Init target and DistributionSet
|
// Init target and DistributionSet
|
||||||
final Target target = targetManagement.createTarget(new Target("test123"));
|
final Target target = targetManagement.createTarget(new Target("test123"));
|
||||||
DistributionSet disSet = distributionSetManagement
|
final DistributionSet disSet = distributionSetManagement
|
||||||
.createDistributionSet(new DistributionSet("ds1", "v1.0", "test ds", standardDsType, null));
|
.createDistributionSet(new DistributionSet("ds1", "v1.0", "test ds", standardDsType, null));
|
||||||
|
|
||||||
// [STEP1]: Create SoftwareModuleX and include the new ArtifactX
|
// [STEP1]: Create SoftwareModuleX and include the new ArtifactX
|
||||||
@@ -242,14 +242,14 @@ public class SoftwareManagementTest extends AbstractIntegrationTestWithMongoDB {
|
|||||||
// [VERIFY EXPECTED RESULT]:
|
// [VERIFY EXPECTED RESULT]:
|
||||||
// verify: assignedModule is marked as deleted
|
// verify: assignedModule is marked as deleted
|
||||||
assignedModule = softwareManagement.findSoftwareModuleById(assignedModule.getId());
|
assignedModule = softwareManagement.findSoftwareModuleById(assignedModule.getId());
|
||||||
assertTrue(assignedModule.isDeleted());
|
assertTrue("The found module should be flagged deleted", assignedModule.isDeleted());
|
||||||
assertThat(softwareManagement.findSoftwareModulesAll(pageReq)).hasSize(0);
|
assertThat(softwareManagement.findSoftwareModulesAll(pageReq)).hasSize(0);
|
||||||
assertThat(softwareModuleRepository.findAll()).hasSize(1);
|
assertThat(softwareModuleRepository.findAll()).hasSize(1);
|
||||||
|
|
||||||
// verify: binary data is deleted
|
// verify: binary data is deleted
|
||||||
Iterator<Artifact> artifactsIt = assignedModule.getArtifacts().iterator();
|
final Iterator<Artifact> artifactsIt = assignedModule.getArtifacts().iterator();
|
||||||
Artifact artifact1 = artifactsIt.next();
|
final Artifact artifact1 = artifactsIt.next();
|
||||||
Artifact artifact2 = artifactsIt.next();
|
final Artifact artifact2 = artifactsIt.next();
|
||||||
assertArtfiactNull(artifact1, artifact2);
|
assertArtfiactNull(artifact1, artifact2);
|
||||||
|
|
||||||
// verify: artifact meta data is still available
|
// verify: artifact meta data is still available
|
||||||
@@ -265,7 +265,7 @@ public class SoftwareManagementTest extends AbstractIntegrationTestWithMongoDB {
|
|||||||
assertThat(operations.find(new Query())).hasSize(0);
|
assertThat(operations.find(new Query())).hasSize(0);
|
||||||
|
|
||||||
// Init artifact binary data, target and DistributionSets
|
// Init artifact binary data, target and DistributionSets
|
||||||
byte[] source = RandomUtils.nextBytes(1024);
|
final byte[] source = RandomUtils.nextBytes(1024);
|
||||||
|
|
||||||
// [STEP1]: Create SoftwareModuleX and add a new ArtifactX
|
// [STEP1]: Create SoftwareModuleX and add a new ArtifactX
|
||||||
SoftwareModule moduleX = createSoftwareModuleWithArtifacts(osType, "modulex", "v1.0", 0);
|
SoftwareModule moduleX = createSoftwareModuleWithArtifacts(osType, "modulex", "v1.0", 0);
|
||||||
@@ -273,7 +273,7 @@ public class SoftwareManagementTest extends AbstractIntegrationTestWithMongoDB {
|
|||||||
// [STEP2]: Create newArtifactX and add it to SoftwareModuleX
|
// [STEP2]: Create newArtifactX and add it to SoftwareModuleX
|
||||||
artifactManagement.createLocalArtifact(new ByteArrayInputStream(source), moduleX.getId(), "artifactx", false);
|
artifactManagement.createLocalArtifact(new ByteArrayInputStream(source), moduleX.getId(), "artifactx", false);
|
||||||
moduleX = softwareManagement.findSoftwareModuleWithDetails(moduleX.getId());
|
moduleX = softwareManagement.findSoftwareModuleWithDetails(moduleX.getId());
|
||||||
Artifact artifactX = moduleX.getArtifacts().iterator().next();
|
final Artifact artifactX = moduleX.getArtifacts().iterator().next();
|
||||||
|
|
||||||
// [STEP3]: Create SoftwareModuleY and add the same ArtifactX
|
// [STEP3]: Create SoftwareModuleY and add the same ArtifactX
|
||||||
SoftwareModule moduleY = createSoftwareModuleWithArtifacts(osType, "moduley", "v1.0", 0);
|
SoftwareModule moduleY = createSoftwareModuleWithArtifacts(osType, "moduley", "v1.0", 0);
|
||||||
@@ -281,7 +281,7 @@ public class SoftwareManagementTest extends AbstractIntegrationTestWithMongoDB {
|
|||||||
// [STEP4]: Assign the same ArtifactX to SoftwareModuleY
|
// [STEP4]: Assign the same ArtifactX to SoftwareModuleY
|
||||||
artifactManagement.createLocalArtifact(new ByteArrayInputStream(source), moduleY.getId(), "artifactx", false);
|
artifactManagement.createLocalArtifact(new ByteArrayInputStream(source), moduleY.getId(), "artifactx", false);
|
||||||
moduleY = softwareManagement.findSoftwareModuleWithDetails(moduleY.getId());
|
moduleY = softwareManagement.findSoftwareModuleWithDetails(moduleY.getId());
|
||||||
Artifact artifactY = moduleY.getArtifacts().iterator().next();
|
final Artifact artifactY = moduleY.getArtifacts().iterator().next();
|
||||||
|
|
||||||
// verify: that only one entry was created in mongoDB
|
// verify: that only one entry was created in mongoDB
|
||||||
assertThat(operations.find(new Query())).hasSize(1);
|
assertThat(operations.find(new Query())).hasSize(1);
|
||||||
@@ -325,14 +325,14 @@ public class SoftwareManagementTest extends AbstractIntegrationTestWithMongoDB {
|
|||||||
|
|
||||||
artifactManagement.createLocalArtifact(new ByteArrayInputStream(source), moduleX.getId(), "artifactx", false);
|
artifactManagement.createLocalArtifact(new ByteArrayInputStream(source), moduleX.getId(), "artifactx", false);
|
||||||
moduleX = softwareManagement.findSoftwareModuleWithDetails(moduleX.getId());
|
moduleX = softwareManagement.findSoftwareModuleWithDetails(moduleX.getId());
|
||||||
Artifact artifactX = moduleX.getArtifacts().iterator().next();
|
final Artifact artifactX = moduleX.getArtifacts().iterator().next();
|
||||||
|
|
||||||
// [STEP2]: Create SoftwareModuleY and add the same ArtifactX
|
// [STEP2]: Create SoftwareModuleY and add the same ArtifactX
|
||||||
SoftwareModule moduleY = createSoftwareModuleWithArtifacts(osType, "moduley", "v1.0", 0);
|
SoftwareModule moduleY = createSoftwareModuleWithArtifacts(osType, "moduley", "v1.0", 0);
|
||||||
|
|
||||||
artifactManagement.createLocalArtifact(new ByteArrayInputStream(source), moduleY.getId(), "artifactx", false);
|
artifactManagement.createLocalArtifact(new ByteArrayInputStream(source), moduleY.getId(), "artifactx", false);
|
||||||
moduleY = softwareManagement.findSoftwareModuleWithDetails(moduleY.getId());
|
moduleY = softwareManagement.findSoftwareModuleWithDetails(moduleY.getId());
|
||||||
Artifact artifactY = moduleY.getArtifacts().iterator().next();
|
final Artifact artifactY = moduleY.getArtifacts().iterator().next();
|
||||||
|
|
||||||
// verify: that only one entry was created in mongoDB
|
// verify: that only one entry was created in mongoDB
|
||||||
assertThat(operations.find(new Query())).hasSize(1);
|
assertThat(operations.find(new Query())).hasSize(1);
|
||||||
@@ -358,8 +358,8 @@ public class SoftwareManagementTest extends AbstractIntegrationTestWithMongoDB {
|
|||||||
// verify: SoftwareModuleX and SofwtareModule are marked as deleted
|
// verify: SoftwareModuleX and SofwtareModule are marked as deleted
|
||||||
assertThat(moduleX).isNotNull();
|
assertThat(moduleX).isNotNull();
|
||||||
assertThat(moduleY).isNotNull();
|
assertThat(moduleY).isNotNull();
|
||||||
assertTrue(moduleX.isDeleted());
|
assertTrue("The module should be flagged deleted", moduleX.isDeleted());
|
||||||
assertTrue(moduleY.isDeleted());
|
assertTrue("The module should be flagged deleted", moduleY.isDeleted());
|
||||||
assertThat(softwareManagement.findSoftwareModulesAll(pageReq)).hasSize(0);
|
assertThat(softwareManagement.findSoftwareModulesAll(pageReq)).hasSize(0);
|
||||||
assertThat(softwareModuleRepository.findAll()).hasSize(2);
|
assertThat(softwareModuleRepository.findAll()).hasSize(2);
|
||||||
|
|
||||||
@@ -370,10 +370,10 @@ public class SoftwareManagementTest extends AbstractIntegrationTestWithMongoDB {
|
|||||||
assertThat(artifactRepository.findOne(artifactY.getId())).isNotNull();
|
assertThat(artifactRepository.findOne(artifactY.getId())).isNotNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
private SoftwareModule createSoftwareModuleWithArtifacts(SoftwareModuleType type, String name, String version,
|
private SoftwareModule createSoftwareModuleWithArtifacts(final SoftwareModuleType type, final String name,
|
||||||
int numberArtifacts) {
|
final String version, final int numberArtifacts) {
|
||||||
|
|
||||||
long countSoftwareModule = softwareModuleRepository.count();
|
final long countSoftwareModule = softwareModuleRepository.count();
|
||||||
|
|
||||||
// create SoftwareModule
|
// create SoftwareModule
|
||||||
SoftwareModule softwareModule = softwareManagement
|
SoftwareModule softwareModule = softwareManagement
|
||||||
@@ -388,7 +388,7 @@ public class SoftwareManagementTest extends AbstractIntegrationTestWithMongoDB {
|
|||||||
softwareModule = softwareManagement.findSoftwareModuleWithDetails(softwareModule.getId());
|
softwareModule = softwareManagement.findSoftwareModuleWithDetails(softwareModule.getId());
|
||||||
assertThat(softwareModuleRepository.findAll()).hasSize((int) countSoftwareModule + 1);
|
assertThat(softwareModuleRepository.findAll()).hasSize((int) countSoftwareModule + 1);
|
||||||
|
|
||||||
List<Artifact> artifacts = softwareModule.getArtifacts();
|
final List<Artifact> artifacts = softwareModule.getArtifacts();
|
||||||
|
|
||||||
assertThat(artifacts).hasSize(numberArtifacts);
|
assertThat(artifacts).hasSize(numberArtifacts);
|
||||||
if (numberArtifacts != 0) {
|
if (numberArtifacts != 0) {
|
||||||
|
|||||||
@@ -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() {
|
||||||
@@ -156,7 +174,7 @@ public class TargetManagementTest extends AbstractIntegrationTest {
|
|||||||
|
|
||||||
final DistributionSetAssignmentResult result = deploymentManagement.assignDistributionSet(set.getId(), "4711");
|
final DistributionSetAssignmentResult result = deploymentManagement.assignDistributionSet(set.getId(), "4711");
|
||||||
|
|
||||||
final Action action = result.getActions().get(0);
|
final Action action = deploymentManagement.findActionWithDetails(result.getActions().get(0));
|
||||||
action.setStatus(Status.FINISHED);
|
action.setStatus(Status.FINISHED);
|
||||||
controllerManagament.addUpdateActionStatus(
|
controllerManagament.addUpdateActionStatus(
|
||||||
new ActionStatus(action, Status.FINISHED, System.currentTimeMillis(), "message"), action);
|
new ActionStatus(action, Status.FINISHED, System.currentTimeMillis(), "message"), action);
|
||||||
@@ -203,7 +221,7 @@ public class TargetManagementTest extends AbstractIntegrationTest {
|
|||||||
* verifies, that all {@link TargetTag} of parameter. NOTE: it's accepted
|
* verifies, that all {@link TargetTag} of parameter. NOTE: it's accepted
|
||||||
* that the target have additional tags assigned to them which are not
|
* that the target have additional tags assigned to them which are not
|
||||||
* contained within parameter tags.
|
* contained within parameter tags.
|
||||||
*
|
*
|
||||||
* @param strict
|
* @param strict
|
||||||
* if true, the given targets MUST contain EXACTLY ALL given
|
* if true, the given targets MUST contain EXACTLY ALL given
|
||||||
* tags, AND NO OTHERS. If false, the given targets MUST contain
|
* tags, AND NO OTHERS. If false, the given targets MUST contain
|
||||||
@@ -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());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ public class RSQLActionFieldsTest extends AbstractIntegrationTest {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
assertRSQLQuery(ActionFields.STATUS.name() + "==true", 5);
|
assertRSQLQuery(ActionFields.STATUS.name() + "==true", 5);
|
||||||
fail();
|
fail("Missing expected RSQLParameterUnsupportedFieldException because status cannot be compared with 'true'");
|
||||||
} catch (final RSQLParameterUnsupportedFieldException e) {
|
} catch (final RSQLParameterUnsupportedFieldException e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ public class RSQLUtilityTest {
|
|||||||
try {
|
try {
|
||||||
RSQLUtility.parse(wrongRSQL, SoftwareModuleFields.class).toPredicate(baseSoftwareModuleRootMock,
|
RSQLUtility.parse(wrongRSQL, SoftwareModuleFields.class).toPredicate(baseSoftwareModuleRootMock,
|
||||||
criteriaQueryMock, criteriaBuilderMock);
|
criteriaQueryMock, criteriaBuilderMock);
|
||||||
fail();
|
fail("Missing expected RSQLParameterSyntaxException because of wrong RSQL syntax");
|
||||||
} catch (final RSQLParameterSyntaxException e) {
|
} catch (final RSQLParameterSyntaxException e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -75,7 +75,7 @@ public class RSQLUtilityTest {
|
|||||||
try {
|
try {
|
||||||
RSQLUtility.parse(wrongRSQL, SoftwareModuleFields.class).toPredicate(baseSoftwareModuleRootMock,
|
RSQLUtility.parse(wrongRSQL, SoftwareModuleFields.class).toPredicate(baseSoftwareModuleRootMock,
|
||||||
criteriaQueryMock, criteriaBuilderMock);
|
criteriaQueryMock, criteriaBuilderMock);
|
||||||
fail();
|
fail("Missing an expected RSQLParameterUnsupportedFieldException because of unknown RSQL field");
|
||||||
} catch (final RSQLParameterUnsupportedFieldException e) {
|
} catch (final RSQLParameterUnsupportedFieldException e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -87,7 +87,7 @@ public class RSQLUtilityTest {
|
|||||||
try {
|
try {
|
||||||
RSQLUtility.parse(wrongRSQL, TargetFields.class).toPredicate(baseSoftwareModuleRootMock, criteriaQueryMock,
|
RSQLUtility.parse(wrongRSQL, TargetFields.class).toPredicate(baseSoftwareModuleRootMock, criteriaQueryMock,
|
||||||
criteriaBuilderMock);
|
criteriaBuilderMock);
|
||||||
fail();
|
fail("Missing expected RSQLParameterSyntaxException because of wrong RSQL syntax");
|
||||||
} catch (final RSQLParameterUnsupportedFieldException e) {
|
} catch (final RSQLParameterUnsupportedFieldException e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -95,7 +95,7 @@ public class RSQLUtilityTest {
|
|||||||
try {
|
try {
|
||||||
RSQLUtility.parse(wrongRSQL, TargetFields.class).toPredicate(baseSoftwareModuleRootMock, criteriaQueryMock,
|
RSQLUtility.parse(wrongRSQL, TargetFields.class).toPredicate(baseSoftwareModuleRootMock, criteriaQueryMock,
|
||||||
criteriaBuilderMock);
|
criteriaBuilderMock);
|
||||||
fail();
|
fail("Missing expected RSQLParameterSyntaxException because of wrong RSQL syntax");
|
||||||
} catch (final RSQLParameterUnsupportedFieldException e) {
|
} catch (final RSQLParameterUnsupportedFieldException e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -103,7 +103,7 @@ public class RSQLUtilityTest {
|
|||||||
try {
|
try {
|
||||||
RSQLUtility.parse(wrongRSQL, DistributionSetFields.class).toPredicate(baseSoftwareModuleRootMock,
|
RSQLUtility.parse(wrongRSQL, DistributionSetFields.class).toPredicate(baseSoftwareModuleRootMock,
|
||||||
criteriaQueryMock, criteriaBuilderMock);
|
criteriaQueryMock, criteriaBuilderMock);
|
||||||
fail();
|
fail("Missing expected RSQLParameterSyntaxException because of wrong RSQL syntax");
|
||||||
} catch (final RSQLParameterUnsupportedFieldException e) {
|
} catch (final RSQLParameterUnsupportedFieldException e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -115,7 +115,7 @@ public class RSQLUtilityTest {
|
|||||||
try {
|
try {
|
||||||
RSQLUtility.parse(wrongRSQL, TargetFields.class).toPredicate(baseSoftwareModuleRootMock, criteriaQueryMock,
|
RSQLUtility.parse(wrongRSQL, TargetFields.class).toPredicate(baseSoftwareModuleRootMock, criteriaQueryMock,
|
||||||
criteriaBuilderMock);
|
criteriaBuilderMock);
|
||||||
fail();
|
fail("Missing expected RSQLParameterSyntaxException because of wrong RSQL syntax");
|
||||||
} catch (final RSQLParameterUnsupportedFieldException e) {
|
} catch (final RSQLParameterUnsupportedFieldException e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -123,7 +123,7 @@ public class RSQLUtilityTest {
|
|||||||
try {
|
try {
|
||||||
RSQLUtility.parse(wrongRSQL, TargetFields.class).toPredicate(baseSoftwareModuleRootMock, criteriaQueryMock,
|
RSQLUtility.parse(wrongRSQL, TargetFields.class).toPredicate(baseSoftwareModuleRootMock, criteriaQueryMock,
|
||||||
criteriaBuilderMock);
|
criteriaBuilderMock);
|
||||||
fail();
|
fail("Missing expected RSQLParameterSyntaxException because of wrong RSQL syntax");
|
||||||
} catch (final RSQLParameterUnsupportedFieldException e) {
|
} catch (final RSQLParameterUnsupportedFieldException e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -131,7 +131,7 @@ public class RSQLUtilityTest {
|
|||||||
try {
|
try {
|
||||||
RSQLUtility.parse(wrongRSQL, TargetFields.class).toPredicate(baseSoftwareModuleRootMock, criteriaQueryMock,
|
RSQLUtility.parse(wrongRSQL, TargetFields.class).toPredicate(baseSoftwareModuleRootMock, criteriaQueryMock,
|
||||||
criteriaBuilderMock);
|
criteriaBuilderMock);
|
||||||
fail();
|
fail("Missing expected RSQLParameterSyntaxException because of wrong RSQL syntax");
|
||||||
} catch (final RSQLParameterUnsupportedFieldException e) {
|
} catch (final RSQLParameterUnsupportedFieldException e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -199,13 +199,14 @@ public final class RepositoryDataGenerator {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createActionStatusHistory(final List<Action> actions, final int sizeMultiplikator) {
|
private void createActionStatusHistory(final List<Long> actions, final int sizeMultiplikator) {
|
||||||
final AtomicInteger counter = new AtomicInteger();
|
final AtomicInteger counter = new AtomicInteger();
|
||||||
|
|
||||||
int index = 0;
|
int index = 0;
|
||||||
for (final Action actionGiven : actions) {
|
for (final Long actionGiven : actions) {
|
||||||
// retrieved
|
// retrieved
|
||||||
Action action = controllerManagement.registerRetrieved(actionGiven,
|
Action action = controllerManagement.registerRetrieved(
|
||||||
|
deploymentManagement.findActionWithDetails(actionGiven),
|
||||||
"Controller retrieved update action and should start now the download.");
|
"Controller retrieved update action and should start now the download.");
|
||||||
|
|
||||||
// download
|
// download
|
||||||
@@ -260,10 +261,11 @@ public final class RepositoryDataGenerator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createSimpleActionStatusHistory(final List<Action> actions) {
|
private void createSimpleActionStatusHistory(final List<Long> actions) {
|
||||||
for (final Action actionGiven : actions) {
|
for (final Long actionGiven : actions) {
|
||||||
// retrieved
|
// retrieved
|
||||||
Action action = controllerManagement.registerRetrieved(actionGiven,
|
Action action = controllerManagement.registerRetrieved(
|
||||||
|
deploymentManagement.findActionWithDetails(actionGiven),
|
||||||
"Controller retrieved update action and should start now the download.");
|
"Controller retrieved update action and should start now the download.");
|
||||||
|
|
||||||
// close
|
// close
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ final class DistributionSetTypeMapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static List<DistributionSetTypeRest> toListResponse(final List<DistributionSetType> types) {
|
static List<DistributionSetTypeRest> toListResponse(final List<DistributionSetType> types) {
|
||||||
final List<DistributionSetTypeRest> response = new ArrayList<DistributionSetTypeRest>();
|
final List<DistributionSetTypeRest> response = new ArrayList<>();
|
||||||
for (final DistributionSetType dsType : types) {
|
for (final DistributionSetType dsType : types) {
|
||||||
response.add(toResponse(dsType));
|
response.add(toResponse(dsType));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -99,52 +99,6 @@ public class SoftwareModuleResource implements SoftwareModuleRestAPI {
|
|||||||
return new ResponseEntity<>(SoftwareModuleMapper.artifactsToResponse(module.getArtifacts()), HttpStatus.OK);
|
return new ResponseEntity<>(SoftwareModuleMapper.artifactsToResponse(module.getArtifacts()), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Handles the GET request for downloading an artifact.
|
|
||||||
*
|
|
||||||
* @param softwareModuleId
|
|
||||||
* of the parent SoftwareModule
|
|
||||||
* @param artifactId
|
|
||||||
* of the related LocalArtifact
|
|
||||||
* @param servletResponse
|
|
||||||
* of the servlet
|
|
||||||
* @param request
|
|
||||||
* of the client
|
|
||||||
*
|
|
||||||
* @return responseEntity with status ok if successful
|
|
||||||
*/
|
|
||||||
// @RequestMapping(method = RequestMethod.GET, value =
|
|
||||||
// RestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING
|
|
||||||
// + "/{softwareModuleId}/artifacts/{artifactId}/download")
|
|
||||||
// @ResponseBody
|
|
||||||
// public ResponseEntity<Void> downloadArtifact(@PathVariable final Long
|
|
||||||
// softwareModuleId,
|
|
||||||
// @PathVariable final Long artifactId, final HttpServletResponse
|
|
||||||
// servletResponse,
|
|
||||||
// final HttpServletRequest request) {
|
|
||||||
// final SoftwareModule module =
|
|
||||||
// findSoftwareModuleWithExceptionIfNotFound(softwareModuleId, artifactId);
|
|
||||||
//
|
|
||||||
// if (null == module || !module.getLocalArtifact(artifactId).isPresent()) {
|
|
||||||
// return new ResponseEntity<>(HttpStatus.NOT_FOUND);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// final LocalArtifact artifact = module.getLocalArtifact(artifactId).get();
|
|
||||||
// final DbArtifact file =
|
|
||||||
// artifactManagement.loadLocalArtifactBinary(artifact);
|
|
||||||
//
|
|
||||||
// final String ifMatch = request.getHeader("If-Match");
|
|
||||||
// if (ifMatch != null &&
|
|
||||||
// !RestResourceConversionHelper.matchesHttpHeader(ifMatch,
|
|
||||||
// artifact.getSha1Hash())) {
|
|
||||||
// return new ResponseEntity<>(HttpStatus.PRECONDITION_FAILED);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// return RestResourceConversionHelper.writeFileResponse(artifact,
|
|
||||||
// servletResponse, request, file);
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResponseEntity<ArtifactRest> getArtifact(@PathVariable final Long softwareModuleId,
|
public ResponseEntity<ArtifactRest> getArtifact(@PathVariable final Long softwareModuleId,
|
||||||
@PathVariable final Long artifactId) {
|
@PathVariable final Long artifactId) {
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ final class SoftwareModuleTypeMapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static List<SoftwareModuleTypeRest> toListResponse(final Collection<SoftwareModuleType> types) {
|
static List<SoftwareModuleTypeRest> toListResponse(final Collection<SoftwareModuleType> types) {
|
||||||
final List<SoftwareModuleTypeRest> response = new ArrayList<SoftwareModuleTypeRest>();
|
final List<SoftwareModuleTypeRest> response = new ArrayList<>();
|
||||||
for (final SoftwareModuleType softwareModule : types) {
|
for (final SoftwareModuleType softwareModule : types) {
|
||||||
response.add(toResponse(softwareModule));
|
response.add(toResponse(softwareModule));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
@@ -56,7 +56,8 @@ public class CancelActionTest extends AbstractIntegrationTest {
|
|||||||
final List<Target> toAssign = new ArrayList<Target>();
|
final List<Target> toAssign = new ArrayList<Target>();
|
||||||
toAssign.add(savedTarget);
|
toAssign.add(savedTarget);
|
||||||
|
|
||||||
final Action updateAction = deploymentManagement.assignDistributionSet(ds, toAssign).getActions().get(0);
|
final Action updateAction = deploymentManagement
|
||||||
|
.findActionWithDetails(deploymentManagement.assignDistributionSet(ds, toAssign).getActions().get(0));
|
||||||
|
|
||||||
final Action cancelAction = deploymentManagement.cancelAction(updateAction,
|
final Action cancelAction = deploymentManagement.cancelAction(updateAction,
|
||||||
targetManagement.findTargetByControllerID(savedTarget.getControllerId()));
|
targetManagement.findTargetByControllerID(savedTarget.getControllerId()));
|
||||||
@@ -112,7 +113,8 @@ public class CancelActionTest extends AbstractIntegrationTest {
|
|||||||
final List<Target> toAssign = new ArrayList<Target>();
|
final List<Target> toAssign = new ArrayList<Target>();
|
||||||
toAssign.add(savedTarget);
|
toAssign.add(savedTarget);
|
||||||
|
|
||||||
final Action updateAction = deploymentManagement.assignDistributionSet(ds, toAssign).getActions().get(0);
|
final Action updateAction = deploymentManagement
|
||||||
|
.findActionWithDetails(deploymentManagement.assignDistributionSet(ds, toAssign).getActions().get(0));
|
||||||
|
|
||||||
long current = System.currentTimeMillis();
|
long current = System.currentTimeMillis();
|
||||||
mvc.perform(get("/{tenant}/controller/v1/4712", tenantAware.getCurrentTenant()))
|
mvc.perform(get("/{tenant}/controller/v1/4712", tenantAware.getCurrentTenant()))
|
||||||
@@ -227,7 +229,8 @@ public class CancelActionTest extends AbstractIntegrationTest {
|
|||||||
final Target savedTarget = targetManagement.createTarget(target);
|
final Target savedTarget = targetManagement.createTarget(target);
|
||||||
final List<Target> toAssign = new ArrayList<Target>();
|
final List<Target> toAssign = new ArrayList<Target>();
|
||||||
toAssign.add(savedTarget);
|
toAssign.add(savedTarget);
|
||||||
final Action updateAction = deploymentManagement.assignDistributionSet(ds, toAssign).getActions().get(0);
|
final Action updateAction = deploymentManagement
|
||||||
|
.findActionWithDetails(deploymentManagement.assignDistributionSet(ds, toAssign).getActions().get(0));
|
||||||
|
|
||||||
return deploymentManagement.cancelAction(updateAction,
|
return deploymentManagement.cancelAction(updateAction,
|
||||||
targetManagement.findTargetByControllerID(savedTarget.getControllerId()));
|
targetManagement.findTargetByControllerID(savedTarget.getControllerId()));
|
||||||
@@ -243,8 +246,8 @@ public class CancelActionTest extends AbstractIntegrationTest {
|
|||||||
|
|
||||||
final Target savedTarget = targetManagement.createTarget(target);
|
final Target savedTarget = targetManagement.createTarget(target);
|
||||||
|
|
||||||
final Action updateAction = deploymentManagement.assignDistributionSet(ds.getId(), new String[] { "4712" })
|
final Action updateAction = deploymentManagement.findActionWithDetails(
|
||||||
.getActions().get(0);
|
deploymentManagement.assignDistributionSet(ds.getId(), new String[] { "4712" }).getActions().get(0));
|
||||||
|
|
||||||
// cancel action manually
|
// cancel action manually
|
||||||
final Action cancelAction = deploymentManagement.cancelAction(updateAction,
|
final Action cancelAction = deploymentManagement.cancelAction(updateAction,
|
||||||
@@ -340,12 +343,12 @@ public class CancelActionTest extends AbstractIntegrationTest {
|
|||||||
|
|
||||||
final Target savedTarget = targetManagement.createTarget(target);
|
final Target savedTarget = targetManagement.createTarget(target);
|
||||||
|
|
||||||
final Action updateAction = deploymentManagement.assignDistributionSet(ds.getId(), new String[] { "4712" })
|
final Action updateAction = deploymentManagement.findActionWithDetails(
|
||||||
.getActions().get(0);
|
deploymentManagement.assignDistributionSet(ds.getId(), new String[] { "4712" }).getActions().get(0));
|
||||||
final Action updateAction2 = deploymentManagement.assignDistributionSet(ds2.getId(), new String[] { "4712" })
|
final Action updateAction2 = deploymentManagement.findActionWithDetails(
|
||||||
.getActions().get(0);
|
deploymentManagement.assignDistributionSet(ds2.getId(), new String[] { "4712" }).getActions().get(0));
|
||||||
final Action updateAction3 = deploymentManagement.assignDistributionSet(ds3.getId(), new String[] { "4712" })
|
final Action updateAction3 = deploymentManagement.findActionWithDetails(
|
||||||
.getActions().get(0);
|
deploymentManagement.assignDistributionSet(ds3.getId(), new String[] { "4712" }).getActions().get(0));
|
||||||
|
|
||||||
assertThat(actionStatusRepository.findAll()).hasSize(3);
|
assertThat(actionStatusRepository.findAll()).hasSize(3);
|
||||||
|
|
||||||
@@ -456,8 +459,8 @@ public class CancelActionTest extends AbstractIntegrationTest {
|
|||||||
final List<Target> toAssign = new ArrayList<Target>();
|
final List<Target> toAssign = new ArrayList<Target>();
|
||||||
toAssign.add(target);
|
toAssign.add(target);
|
||||||
|
|
||||||
final Action action = deploymentManagement.assignDistributionSet(ds.getId(), new String[] { "4712" })
|
final Action action = deploymentManagement.findActionWithDetails(
|
||||||
.getActions().get(0);
|
deploymentManagement.assignDistributionSet(ds.getId(), new String[] { "4712" }).getActions().get(0));
|
||||||
|
|
||||||
final Action cancelAction = deploymentManagement.cancelAction(action,
|
final Action cancelAction = deploymentManagement.cancelAction(action,
|
||||||
targetManagement.findTargetByControllerID(target.getControllerId()));
|
targetManagement.findTargetByControllerID(target.getControllerId()));
|
||||||
|
|||||||
@@ -484,7 +484,8 @@ public class DeploymentBaseTest extends AbstractIntegrationTestWithMongoDB {
|
|||||||
final DistributionSet savedSet = TestDataUtil.generateDistributionSet("", softwareManagement,
|
final DistributionSet savedSet = TestDataUtil.generateDistributionSet("", softwareManagement,
|
||||||
distributionSetManagement);
|
distributionSetManagement);
|
||||||
|
|
||||||
final Action action1 = deploymentManagement.assignDistributionSet(savedSet, toAssign).getActions().get(0);
|
final Action action1 = deploymentManagement.findActionWithDetails(
|
||||||
|
deploymentManagement.assignDistributionSet(savedSet, toAssign).getActions().get(0));
|
||||||
mvc.perform(
|
mvc.perform(
|
||||||
get("/{tenant}/controller/v1/4712/deploymentBase/" + action1.getId(), tenantAware.getCurrentTenant()))
|
get("/{tenant}/controller/v1/4712/deploymentBase/" + action1.getId(), tenantAware.getCurrentTenant()))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk());
|
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk());
|
||||||
@@ -544,12 +545,12 @@ public class DeploymentBaseTest extends AbstractIntegrationTestWithMongoDB {
|
|||||||
final List<Target> toAssign = new ArrayList<Target>();
|
final List<Target> toAssign = new ArrayList<Target>();
|
||||||
toAssign.add(savedTarget1);
|
toAssign.add(savedTarget1);
|
||||||
|
|
||||||
final Action action1 = deploymentManagement.assignDistributionSet(ds1.getId(), new String[] { "4712" })
|
final Action action1 = deploymentManagement.findActionWithDetails(
|
||||||
.getActions().get(0);
|
deploymentManagement.assignDistributionSet(ds1.getId(), new String[] { "4712" }).getActions().get(0));
|
||||||
final Action action2 = deploymentManagement.assignDistributionSet(ds2.getId(), new String[] { "4712" })
|
final Action action2 = deploymentManagement.findActionWithDetails(
|
||||||
.getActions().get(0);
|
deploymentManagement.assignDistributionSet(ds2.getId(), new String[] { "4712" }).getActions().get(0));
|
||||||
final Action action3 = deploymentManagement.assignDistributionSet(ds3.getId(), new String[] { "4712" })
|
final Action action3 = deploymentManagement.findActionWithDetails(
|
||||||
.getActions().get(0);
|
deploymentManagement.assignDistributionSet(ds3.getId(), new String[] { "4712" }).getActions().get(0));
|
||||||
|
|
||||||
Target myT = targetManagement.findTargetByControllerID("4712");
|
Target myT = targetManagement.findTargetByControllerID("4712");
|
||||||
assertThat(myT.getTargetInfo().getUpdateStatus()).isEqualTo(TargetUpdateStatus.PENDING);
|
assertThat(myT.getTargetInfo().getUpdateStatus()).isEqualTo(TargetUpdateStatus.PENDING);
|
||||||
|
|||||||
@@ -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) {
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,10 +32,15 @@ public class ExceptionInfoTest {
|
|||||||
underTest.setMessage(knownMessage);
|
underTest.setMessage(knownMessage);
|
||||||
underTest.setParameters(knownParameters);
|
underTest.setParameters(knownParameters);
|
||||||
|
|
||||||
assertThat(underTest.getErrorCode()).isEqualTo(knownErrorCode);
|
assertThat(underTest.getErrorCode()).as("The error code should match with the known error code in the test")
|
||||||
assertThat(underTest.getExceptionClass()).isEqualTo(knownExceptionClass);
|
.isEqualTo(knownErrorCode);
|
||||||
assertThat(underTest.getMessage()).isEqualTo(knownMessage);
|
assertThat(underTest.getExceptionClass())
|
||||||
assertThat(underTest.getParameters()).isEqualTo(knownParameters);
|
.as("The exception class should match with the known error code in the test")
|
||||||
|
.isEqualTo(knownExceptionClass);
|
||||||
|
assertThat(underTest.getMessage()).as("The message should match with the known error code in the test")
|
||||||
|
.isEqualTo(knownMessage);
|
||||||
|
assertThat(underTest.getParameters()).as("The parameters should match with the known error code in the test")
|
||||||
|
.isEqualTo(knownParameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,7 +56,8 @@ public class ExcludePathAwareShallowETagFilterTest {
|
|||||||
filterUnderTest.doFilterInternal(servletRequestMock, servletResponseMock, filterChainMock);
|
filterUnderTest.doFilterInternal(servletRequestMock, servletResponseMock, filterChainMock);
|
||||||
|
|
||||||
// verify no eTag header is set and response has not been changed
|
// verify no eTag header is set and response has not been changed
|
||||||
assertThat(servletResponseMock.getHeader("ETag")).isNull();
|
assertThat(servletResponseMock.getHeader("ETag"))
|
||||||
|
.as("ETag header should not be set during downloading, too expensive").isNull();
|
||||||
// the servlet response must be the same mock!
|
// the servlet response must be the same mock!
|
||||||
verify(filterChainMock, times(1)).doFilter(servletRequestMock, servletResponseMock);
|
verify(filterChainMock, times(1)).doFilter(servletRequestMock, servletResponseMock);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,7 +53,8 @@ public class IpUtilTest {
|
|||||||
final URI remoteAddr = IpUtil.getClientIpFromRequest(requestMock, "bumlux");
|
final URI remoteAddr = IpUtil.getClientIpFromRequest(requestMock, "bumlux");
|
||||||
|
|
||||||
// verify
|
// verify
|
||||||
assertThat(remoteAddr).isEqualTo(knownRemoteClientIP);
|
assertThat(remoteAddr).as("The remote address should be as the known client IP address")
|
||||||
|
.isEqualTo(knownRemoteClientIP);
|
||||||
verify(requestMock, times(1)).getHeader("bumlux");
|
verify(requestMock, times(1)).getHeader("bumlux");
|
||||||
verify(requestMock, times(1)).getRemoteAddr();
|
verify(requestMock, times(1)).getRemoteAddr();
|
||||||
}
|
}
|
||||||
@@ -71,7 +72,8 @@ public class IpUtilTest {
|
|||||||
final URI remoteAddr = IpUtil.getClientIpFromRequest(requestMock, "X-Forwarded-For");
|
final URI remoteAddr = IpUtil.getClientIpFromRequest(requestMock, "X-Forwarded-For");
|
||||||
|
|
||||||
// verify
|
// verify
|
||||||
assertThat(remoteAddr).isEqualTo(knownRemoteClientIP);
|
assertThat(remoteAddr).as("The remote address should be as the known client IP address")
|
||||||
|
.isEqualTo(knownRemoteClientIP);
|
||||||
verify(requestMock, times(1)).getHeader(HttpHeaders.X_FORWARDED_FOR);
|
verify(requestMock, times(1)).getHeader(HttpHeaders.X_FORWARDED_FOR);
|
||||||
verify(requestMock, times(0)).getRemoteAddr();
|
verify(requestMock, times(0)).getRemoteAddr();
|
||||||
}
|
}
|
||||||
@@ -94,10 +96,10 @@ public class IpUtilTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void assertHttpUri(final String host, final URI httpUri) {
|
private void assertHttpUri(final String host, final URI httpUri) {
|
||||||
assertTrue(IpUtil.isHttpUri(httpUri));
|
assertTrue("The given URI has an http scheme", IpUtil.isHttpUri(httpUri));
|
||||||
assertFalse(IpUtil.isAmqpUri(httpUri));
|
assertFalse("The given URI is not an AMQP scheme", IpUtil.isAmqpUri(httpUri));
|
||||||
assertEquals(host, httpUri.getHost());
|
assertEquals("The URI hosts matches the given host", host, httpUri.getHost());
|
||||||
assertEquals("http", httpUri.getScheme());
|
assertEquals("The given URI scheme is http", "http", httpUri.getScheme());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -117,23 +119,27 @@ public class IpUtilTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void assertAmqpUri(final String host, final URI amqpUri) {
|
private void assertAmqpUri(final String host, final URI amqpUri) {
|
||||||
assertTrue(IpUtil.isAmqpUri(amqpUri));
|
assertTrue("The given URI is an AMQP scheme", IpUtil.isAmqpUri(amqpUri));
|
||||||
assertFalse(IpUtil.isHttpUri(amqpUri));
|
assertFalse("The given URI is not an HTTP scheme", IpUtil.isHttpUri(amqpUri));
|
||||||
assertEquals(host, amqpUri.getHost());
|
assertEquals("The given host matches the URI host", host, amqpUri.getHost());
|
||||||
assertEquals("amqp", amqpUri.getScheme());
|
assertEquals("The given URI has an AMQP scheme", "amqp", amqpUri.getScheme());
|
||||||
assertEquals("/path", amqpUri.getRawPath());
|
assertEquals("The given URI has an AMQP path", "/path", amqpUri.getRawPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = IllegalArgumentException.class)
|
@Test
|
||||||
@Description("Tests create invalid uri")
|
@Description("Tests create invalid uri")
|
||||||
public void testCreateInvalidUri() {
|
public void testCreateInvalidUri() {
|
||||||
final String host = "10.99.99.1";
|
final String host = "10.99.99.1";
|
||||||
final URI testUri = IpUtil.createUri("test", host);
|
final URI testUri = IpUtil.createUri("test", host);
|
||||||
assertFalse(IpUtil.isAmqpUri(testUri));
|
assertFalse("The given URI is not an AMQP address", IpUtil.isAmqpUri(testUri));
|
||||||
assertFalse(IpUtil.isHttpUri(testUri));
|
assertFalse("The given URI is not an HTTP address", IpUtil.isHttpUri(testUri));
|
||||||
assertEquals(host, testUri.getHost());
|
assertEquals("The given host matches the URI host", host, testUri.getHost());
|
||||||
IpUtil.createUri(":/", host);
|
try {
|
||||||
fail();
|
IpUtil.createUri(":/", host);
|
||||||
|
fail("Missing expected IllegalArgumentException due invalid URI");
|
||||||
|
} catch (final IllegalArgumentException e) {
|
||||||
|
// expected
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -208,14 +208,13 @@ public class ArtifactDetailsLayout extends VerticalLayout {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Container createArtifactLazyQueryContainer() {
|
private Container createArtifactLazyQueryContainer() {
|
||||||
final Map<String, Object> queryConfiguration = new HashMap<String, Object>();
|
final Map<String, Object> queryConfiguration = new HashMap<>();
|
||||||
return getArtifactLazyQueryContainer(queryConfiguration);
|
return getArtifactLazyQueryContainer(queryConfiguration);
|
||||||
}
|
}
|
||||||
|
|
||||||
private LazyQueryContainer getArtifactLazyQueryContainer(final Map<String, Object> queryConfig) {
|
private LazyQueryContainer getArtifactLazyQueryContainer(final Map<String, Object> queryConfig) {
|
||||||
|
|
||||||
final BeanQueryFactory<ArtifactBeanQuery> artifactQF = new BeanQueryFactory<ArtifactBeanQuery>(
|
final BeanQueryFactory<ArtifactBeanQuery> artifactQF = new BeanQueryFactory<>(ArtifactBeanQuery.class);
|
||||||
ArtifactBeanQuery.class);
|
|
||||||
artifactQF.setQueryConfiguration(queryConfig);
|
artifactQF.setQueryConfiguration(queryConfig);
|
||||||
final LazyQueryContainer artifactCont = new LazyQueryContainer(new LazyQueryDefinition(true, 10, "id"),
|
final LazyQueryContainer artifactCont = new LazyQueryContainer(new LazyQueryDefinition(true, 10, "id"),
|
||||||
artifactQF);
|
artifactQF);
|
||||||
@@ -431,7 +430,7 @@ public class ArtifactDetailsLayout extends VerticalLayout {
|
|||||||
titleOfArtifactDetails.setContentMode(ContentMode.HTML);
|
titleOfArtifactDetails.setContentMode(ContentMode.HTML);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
final Map<String, Object> queryConfiguration = new HashMap<String, Object>();
|
final Map<String, Object> queryConfiguration = new HashMap<>();
|
||||||
if (baseSwModuleId != null) {
|
if (baseSwModuleId != null) {
|
||||||
queryConfiguration.put(SPUIDefinitions.BY_BASE_SOFTWARE_MODULE, baseSwModuleId);
|
queryConfiguration.put(SPUIDefinitions.BY_BASE_SOFTWARE_MODULE, baseSwModuleId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,12 +47,6 @@ public class UploadViewAcceptCriteria extends AbstractAcceptCriteria {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private transient EventBus.SessionEventBus eventBus;
|
private transient EventBus.SessionEventBus eventBus;
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see hawkbit.server.ui.common.AbstractAcceptCriteria#analyseDragComponent
|
|
||||||
* (com.vaadin.event .dd.DragAndDropEvent, com.vaadin.ui.Component)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void analyseDragComponent(final Component compsource) {
|
protected void analyseDragComponent(final Component compsource) {
|
||||||
final String sourceID = getComponentId(compsource);
|
final String sourceID = getComponentId(compsource);
|
||||||
@@ -60,24 +54,11 @@ public class UploadViewAcceptCriteria extends AbstractAcceptCriteria {
|
|||||||
eventBus.publish(this, event);
|
eventBus.publish(this, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.eclipse.hawkbit.server.ui.common.AbstractAcceptCriteria#hideDropHints
|
|
||||||
* ()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void hideDropHints() {
|
protected void hideDropHints() {
|
||||||
eventBus.publish(this, DragEvent.HIDE_DROP_HINT);
|
eventBus.publish(this, DragEvent.HIDE_DROP_HINT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.eclipse.hawkbit.server.ui.common.AbstractAcceptCriteria#invalidDrop()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void invalidDrop() {
|
protected void invalidDrop() {
|
||||||
uiNotification.displayValidationError(SPUILabelDefinitions.ACTION_NOT_ALLOWED);
|
uiNotification.displayValidationError(SPUILabelDefinitions.ACTION_NOT_ALLOWED);
|
||||||
@@ -92,41 +73,23 @@ public class UploadViewAcceptCriteria extends AbstractAcceptCriteria {
|
|||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.hawkbit.server.ui.common.AbstractAcceptCriteria#
|
|
||||||
* getDropHintConfigurations()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected Map<String, Object> getDropHintConfigurations() {
|
protected Map<String, Object> getDropHintConfigurations() {
|
||||||
return DROP_HINTS_CONFIGS;
|
return DROP_HINTS_CONFIGS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.hawkbit.server.ui.common.AbstractAcceptCriteria#
|
|
||||||
* publishDragStartEvent(java.lang.Object)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void publishDragStartEvent(final Object event) {
|
protected void publishDragStartEvent(final Object event) {
|
||||||
eventBus.publish(this, event);
|
eventBus.publish(this, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.hawkbit.server.ui.common.AbstractAcceptCriteria#
|
|
||||||
* getDropConfigurations()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected Map<String, List<String>> getDropConfigurations() {
|
protected Map<String, List<String>> getDropConfigurations() {
|
||||||
return DROP_CONFIGS;
|
return DROP_CONFIGS;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Map<String, List<String>> createDropConfigurations() {
|
private static Map<String, List<String>> createDropConfigurations() {
|
||||||
final Map<String, List<String>> config = new HashMap<String, List<String>>();
|
final Map<String, List<String>> config = new HashMap<>();
|
||||||
// Delete drop area droppable components
|
// Delete drop area droppable components
|
||||||
config.put(SPUIComponetIdProvider.DELETE_BUTTON_WRAPPER_ID, Arrays.asList(
|
config.put(SPUIComponetIdProvider.DELETE_BUTTON_WRAPPER_ID, Arrays.asList(
|
||||||
SPUIComponetIdProvider.UPLOAD_SOFTWARE_MODULE_TABLE, SPUIComponetIdProvider.UPLOAD_TYPE_BUTTON_PREFIX));
|
SPUIComponetIdProvider.UPLOAD_SOFTWARE_MODULE_TABLE, SPUIComponetIdProvider.UPLOAD_TYPE_BUTTON_PREFIX));
|
||||||
@@ -135,7 +98,7 @@ public class UploadViewAcceptCriteria extends AbstractAcceptCriteria {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static Map<String, Object> createDropHintConfigurations() {
|
private static Map<String, Object> createDropHintConfigurations() {
|
||||||
final Map<String, Object> config = new HashMap<String, Object>();
|
final Map<String, Object> config = new HashMap<>();
|
||||||
config.put(SPUIComponetIdProvider.UPLOAD_TYPE_BUTTON_PREFIX, UploadArtifactUIEvent.SOFTWARE_TYPE_DRAG_START);
|
config.put(SPUIComponetIdProvider.UPLOAD_TYPE_BUTTON_PREFIX, UploadArtifactUIEvent.SOFTWARE_TYPE_DRAG_START);
|
||||||
config.put(SPUIComponetIdProvider.UPLOAD_SOFTWARE_MODULE_TABLE, UploadArtifactUIEvent.SOFTWARE_DRAG_START);
|
config.put(SPUIComponetIdProvider.UPLOAD_SOFTWARE_MODULE_TABLE, UploadArtifactUIEvent.SOFTWARE_DRAG_START);
|
||||||
return config;
|
return config;
|
||||||
|
|||||||
@@ -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;
|
||||||
@@ -35,6 +37,7 @@ import com.vaadin.spring.annotation.ViewScope;
|
|||||||
import com.vaadin.ui.Component;
|
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.Table.TableTransferable;
|
||||||
import com.vaadin.ui.UI;
|
import com.vaadin.ui.UI;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -68,12 +71,7 @@ public class SMDeleteActionsLayout extends AbstractDeleteActionsLayout {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private UploadViewAcceptCriteria uploadViewAcceptCriteria;
|
private UploadViewAcceptCriteria uploadViewAcceptCriteria;
|
||||||
|
|
||||||
/*
|
@Override
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.eclipse.hawkbit.server.ui.common.footer.DeleteActionsLayout#init()
|
|
||||||
*/
|
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
protected void init() {
|
protected void init() {
|
||||||
super.init();
|
super.init();
|
||||||
@@ -131,23 +129,11 @@ public class SMDeleteActionsLayout extends AbstractDeleteActionsLayout {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.hawkbit.server.ui.common.footer.DeleteActionsLayout#
|
|
||||||
* hasDeletePermission()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean hasDeletePermission() {
|
protected boolean hasDeletePermission() {
|
||||||
return permChecker.hasDeleteDistributionPermission();
|
return permChecker.hasDeleteDistributionPermission();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.hawkbit.server.ui.common.footer.DeleteActionsLayout#
|
|
||||||
* hasUpdatePermission()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean hasUpdatePermission() {
|
protected boolean hasUpdatePermission() {
|
||||||
/**
|
/**
|
||||||
@@ -158,12 +144,6 @@ public class SMDeleteActionsLayout extends AbstractDeleteActionsLayout {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.hawkbit.server.ui.common.footer.DeleteActionsLayout#
|
|
||||||
* getDeleteAreaLabel()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected String getDeleteAreaLabel() {
|
protected String getDeleteAreaLabel() {
|
||||||
return i18n.get("label.software.module.drop.area");
|
return i18n.get("label.software.module.drop.area");
|
||||||
@@ -174,29 +154,17 @@ public class SMDeleteActionsLayout extends AbstractDeleteActionsLayout {
|
|||||||
return SPUIComponetIdProvider.DELETE_BUTTON_WRAPPER_ID;
|
return SPUIComponetIdProvider.DELETE_BUTTON_WRAPPER_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.hawkbit.server.ui.common.footer.DeleteActionsLayout#
|
|
||||||
* getDeleteLayoutAcceptCriteria()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected AcceptCriterion getDeleteLayoutAcceptCriteria() {
|
protected AcceptCriterion getDeleteLayoutAcceptCriteria() {
|
||||||
return uploadViewAcceptCriteria;
|
return uploadViewAcceptCriteria;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.hawkbit.server.ui.common.footer.DeleteActionsLayout#
|
|
||||||
* processDroppedComponent(com.vaadin .event.dd.DragAndDropEvent)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void processDroppedComponent(final DragAndDropEvent event) {
|
protected void processDroppedComponent(final DragAndDropEvent event) {
|
||||||
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,41 +189,33 @@ 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<>();
|
||||||
|
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);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Update the software module delete count.
|
|
||||||
*/
|
|
||||||
private void updateSWActionCount() {
|
private void updateSWActionCount() {
|
||||||
final int count = artifactUploadState.getDeleteSofwareModules().size()
|
final int count = artifactUploadState.getDeleteSofwareModules().size()
|
||||||
+ artifactUploadState.getSelectedDeleteSWModuleTypes().size();
|
+ artifactUploadState.getSelectedDeleteSWModuleTypes().size();
|
||||||
updateActionsCount(count);
|
updateActionsCount(count);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.hawkbit.server.ui.common.footer.DeleteActionsLayout#
|
|
||||||
* getNoActionsButtonLabel()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected String getNoActionsButtonLabel() {
|
protected String getNoActionsButtonLabel() {
|
||||||
return i18n.get("button.no.actions");
|
return i18n.get("button.no.actions");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.hawkbit.server.ui.common.footer.DeleteActionsLayout#
|
|
||||||
* getActionsButtonLabel()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected String getActionsButtonLabel() {
|
protected String getActionsButtonLabel() {
|
||||||
return i18n.get("button.actions");
|
return i18n.get("button.actions");
|
||||||
@@ -266,25 +226,11 @@ public class SMDeleteActionsLayout extends AbstractDeleteActionsLayout {
|
|||||||
updateSWActionCount();
|
updateSWActionCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.eclipse.hawkbit.server.ui.common.footer.AbstractDeleteActionsLayout#
|
|
||||||
* getUnsavedActionsWindowCaption ()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected String getUnsavedActionsWindowCaption() {
|
protected String getUnsavedActionsWindowCaption() {
|
||||||
return i18n.get("caption.save.window");
|
return i18n.get("caption.save.window");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.eclipse.hawkbit.server.ui.common.footer.AbstractDeleteActionsLayout#
|
|
||||||
* unsavedActionsWindowClosed()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void unsavedActionsWindowClosed() {
|
protected void unsavedActionsWindowClosed() {
|
||||||
final String message = uploadViewConfirmationWindowLayout.getConsolidatedMessage();
|
final String message = uploadViewConfirmationWindowLayout.getConsolidatedMessage();
|
||||||
@@ -293,26 +239,12 @@ public class SMDeleteActionsLayout extends AbstractDeleteActionsLayout {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.eclipse.hawkbit.server.ui.common.footer.AbstractDeleteActionsLayout#
|
|
||||||
* getUnsavedActionsWindowContent ()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected Component getUnsavedActionsWindowContent() {
|
protected Component getUnsavedActionsWindowContent() {
|
||||||
uploadViewConfirmationWindowLayout.init();
|
uploadViewConfirmationWindowLayout.init();
|
||||||
return uploadViewConfirmationWindowLayout;
|
return uploadViewConfirmationWindowLayout;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.eclipse.hawkbit.server.ui.common.footer.AbstractDeleteActionsLayout#
|
|
||||||
* hasUnsavedActions()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean hasUnsavedActions() {
|
protected boolean hasUnsavedActions() {
|
||||||
return !artifactUploadState.getDeleteSofwareModules().isEmpty()
|
return !artifactUploadState.getDeleteSofwareModules().isEmpty()
|
||||||
@@ -329,23 +261,11 @@ public class SMDeleteActionsLayout extends AbstractDeleteActionsLayout {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.hawkbit.ui.common.footer.AbstractDeleteActionsLayout#
|
|
||||||
* isBulkUploadAllowed()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean hasBulkUploadPermission() {
|
protected boolean hasBulkUploadPermission() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.hawkbit.ui.common.footer.AbstractDeleteActionsLayout#
|
|
||||||
* showBulkUploadWindow()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void showBulkUploadWindow() {
|
protected void showBulkUploadWindow() {
|
||||||
/**
|
/**
|
||||||
@@ -353,12 +273,6 @@ public class SMDeleteActionsLayout extends AbstractDeleteActionsLayout {
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.hawkbit.ui.common.footer.AbstractDeleteActionsLayout#
|
|
||||||
* restoreBulkUploadStatusCount()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void restoreBulkUploadStatusCount() {
|
protected void restoreBulkUploadStatusCount() {
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -32,10 +32,6 @@ import com.google.common.base.Strings;
|
|||||||
* Simple implementation of generics bean query which dynamically loads a batch
|
* Simple implementation of generics bean query which dynamically loads a batch
|
||||||
* of beans.
|
* of beans.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class BaseSwModuleBeanQuery extends AbstractBeanQuery<ProxyBaseSoftwareModuleItem> {
|
public class BaseSwModuleBeanQuery extends AbstractBeanQuery<ProxyBaseSoftwareModuleItem> {
|
||||||
private static final long serialVersionUID = 4362142538539335466L;
|
private static final long serialVersionUID = 4362142538539335466L;
|
||||||
@@ -76,7 +72,7 @@ public class BaseSwModuleBeanQuery extends AbstractBeanQuery<ProxyBaseSoftwareMo
|
|||||||
@Override
|
@Override
|
||||||
protected List<ProxyBaseSoftwareModuleItem> loadBeans(final int startIndex, final int count) {
|
protected List<ProxyBaseSoftwareModuleItem> loadBeans(final int startIndex, final int count) {
|
||||||
final Slice<SoftwareModule> swModuleBeans;
|
final Slice<SoftwareModule> swModuleBeans;
|
||||||
final List<ProxyBaseSoftwareModuleItem> proxyBeans = new ArrayList<ProxyBaseSoftwareModuleItem>();
|
final List<ProxyBaseSoftwareModuleItem> proxyBeans = new ArrayList<>();
|
||||||
|
|
||||||
if (type == null && Strings.isNullOrEmpty(searchText)) {
|
if (type == null && Strings.isNullOrEmpty(searchText)) {
|
||||||
swModuleBeans = getSoftwareManagementService()
|
swModuleBeans = getSoftwareManagementService()
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ public class SoftwareModuleDetails extends AbstractTableDetailsLayout {
|
|||||||
/**
|
/**
|
||||||
* Initialize the component.
|
* Initialize the component.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
protected void init() {
|
protected void init() {
|
||||||
super.init();
|
super.init();
|
||||||
|
|||||||
@@ -55,8 +55,6 @@ import com.vaadin.ui.UI;
|
|||||||
/**
|
/**
|
||||||
* Header of Software module table.
|
* Header of Software module table.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@SpringComponent
|
@SpringComponent
|
||||||
@ViewScope
|
@ViewScope
|
||||||
@@ -82,6 +80,7 @@ public class SoftwareModuleTable extends AbstractTable {
|
|||||||
/**
|
/**
|
||||||
* Initialize the filter layout.
|
* Initialize the filter layout.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
protected void init() {
|
protected void init() {
|
||||||
super.init();
|
super.init();
|
||||||
@@ -110,37 +109,30 @@ public class SoftwareModuleTable extends AbstractTable {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.hawkbit.server.ui.common.table.SPTable#getTableId()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected String getTableId() {
|
protected String getTableId() {
|
||||||
return SPUIComponetIdProvider.UPLOAD_SOFTWARE_MODULE_TABLE;
|
return SPUIComponetIdProvider.UPLOAD_SOFTWARE_MODULE_TABLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.hawkbit.server.ui.common.table.SPTable#createContainer()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected Container createContainer() {
|
protected Container createContainer() {
|
||||||
final Map<String, Object> queryConfiguration = new HashMap<String, Object>();
|
final Map<String, Object> queryConfiguration = prepareQueryConfigFilters();
|
||||||
artifactUploadState.getSoftwareModuleFilters().getSearchText()
|
|
||||||
.ifPresent(value -> queryConfiguration.put(SPUIDefinitions.FILTER_BY_TEXT, value));
|
|
||||||
|
|
||||||
artifactUploadState.getSoftwareModuleFilters().getSoftwareModuleType()
|
final BeanQueryFactory<BaseSwModuleBeanQuery> swQF = new BeanQueryFactory<>(BaseSwModuleBeanQuery.class);
|
||||||
.ifPresent(type -> queryConfiguration.put(SPUIDefinitions.BY_SOFTWARE_MODULE_TYPE, type));
|
|
||||||
|
|
||||||
final BeanQueryFactory<BaseSwModuleBeanQuery> swQF = new BeanQueryFactory<BaseSwModuleBeanQuery>(
|
|
||||||
BaseSwModuleBeanQuery.class);
|
|
||||||
swQF.setQueryConfiguration(queryConfiguration);
|
swQF.setQueryConfiguration(queryConfiguration);
|
||||||
|
|
||||||
final LazyQueryContainer container = new LazyQueryContainer(
|
return new LazyQueryContainer(new LazyQueryDefinition(true, SPUIDefinitions.PAGE_SIZE, "swId"), swQF);
|
||||||
new LazyQueryDefinition(true, SPUIDefinitions.PAGE_SIZE, "swId"), swQF);
|
}
|
||||||
return container;
|
|
||||||
|
private Map<String, Object> prepareQueryConfigFilters() {
|
||||||
|
final Map<String, Object> queryConfig = new HashMap<>();
|
||||||
|
artifactUploadState.getSoftwareModuleFilters().getSearchText()
|
||||||
|
.ifPresent(value -> queryConfig.put(SPUIDefinitions.FILTER_BY_TEXT, value));
|
||||||
|
|
||||||
|
artifactUploadState.getSoftwareModuleFilters().getSoftwareModuleType()
|
||||||
|
.ifPresent(type -> queryConfig.put(SPUIDefinitions.BY_SOFTWARE_MODULE_TYPE, type));
|
||||||
|
|
||||||
|
return queryConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -265,16 +257,9 @@ public class SoftwareModuleTable extends AbstractTable {
|
|||||||
select(swModule.getId());
|
select(swModule.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.eclipse.hawkbit.server.ui.common.table.SPTable#getTableVisibleColumns
|
|
||||||
* ()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected List<TableColumn> getTableVisibleColumns() {
|
protected List<TableColumn> getTableVisibleColumns() {
|
||||||
final List<TableColumn> columnList = new ArrayList<TableColumn>();
|
final List<TableColumn> columnList = new ArrayList<>();
|
||||||
if (isMaximized()) {
|
if (isMaximized()) {
|
||||||
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_NAME, i18n.get("header.name"), 0.2F));
|
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_NAME, i18n.get("header.name"), 0.2F));
|
||||||
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_VERSION, i18n.get("header.version"), 0.1F));
|
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_VERSION, i18n.get("header.version"), 0.1F));
|
||||||
|
|||||||
@@ -62,6 +62,7 @@ public class SoftwareModuleTableHeader extends AbstractTableHeader {
|
|||||||
/**
|
/**
|
||||||
* Initialize the components.
|
* Initialize the components.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
protected void init() {
|
protected void init() {
|
||||||
super.init();
|
super.init();
|
||||||
@@ -84,55 +85,26 @@ public class SoftwareModuleTableHeader extends AbstractTableHeader {
|
|||||||
eventbus.unsubscribe(this);
|
eventbus.unsubscribe(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.eclipse.hawkbit.server.ui.common.table.SPTableHeader#getHeaderCaption
|
|
||||||
* ()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected String getHeaderCaption() {
|
protected String getHeaderCaption() {
|
||||||
return i18n.get("upload.swModuleTable.header");
|
return i18n.get("upload.swModuleTable.header");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.eclipse.hawkbit.server.ui.common.table.SPTableHeader#getSearchBoxId()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected String getSearchBoxId() {
|
protected String getSearchBoxId() {
|
||||||
return SPUIComponetIdProvider.SW_MODULE_SEARCH_TEXT_FIELD;
|
return SPUIComponetIdProvider.SW_MODULE_SEARCH_TEXT_FIELD;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see hawkbit.server.ui.common.table.SPTableHeader#getSearchRestIconId()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected String getSearchRestIconId() {
|
protected String getSearchRestIconId() {
|
||||||
return SPUIComponetIdProvider.SW_MODULE_SEARCH_RESET_ICON;
|
return SPUIComponetIdProvider.SW_MODULE_SEARCH_RESET_ICON;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.eclipse.hawkbit.server.ui.common.table.SPTableHeader#getAddIconId()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected String getAddIconId() {
|
protected String getAddIconId() {
|
||||||
return SPUIComponetIdProvider.SW_MODULE_ADD_BUTTON;
|
return SPUIComponetIdProvider.SW_MODULE_ADD_BUTTON;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see hawkbit.server.ui.common.table.SPTableHeader#onLoadSearchBoxValue()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected String onLoadSearchBoxValue() {
|
protected String onLoadSearchBoxValue() {
|
||||||
if (artifactUploadState.getSoftwareModuleFilters().getSearchText().isPresent()) {
|
if (artifactUploadState.getSoftwareModuleFilters().getSearchText().isPresent()) {
|
||||||
@@ -141,68 +113,34 @@ public class SoftwareModuleTableHeader extends AbstractTableHeader {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.eclipse.hawkbit.server.ui.common.table.SPTableHeader#getDropFilterId(
|
|
||||||
* )
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected String getDropFilterId() {
|
protected String getDropFilterId() {
|
||||||
/* No dropping on software module table header in Upload View */
|
/* No dropping on software module table header in Upload View */
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see hawkbit.server.ui.common.table.SPTableHeader#hasCreatePermission()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean hasCreatePermission() {
|
protected boolean hasCreatePermission() {
|
||||||
return permChecker.hasCreateDistributionPermission();
|
return permChecker.hasCreateDistributionPermission();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see hawkbit.server.ui.common.table.SPTableHeader#isDropHintRequired()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean isDropHintRequired() {
|
protected boolean isDropHintRequired() {
|
||||||
/* No dropping on software module table header in Upload View */
|
/* No dropping on software module table header in Upload View */
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see hawkbit.server.ui.common.table.SPTableHeader#isDropFilterRequired()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean isDropFilterRequired() {
|
protected boolean isDropFilterRequired() {
|
||||||
/* No dropping on software module table header in Upload View */
|
/* No dropping on software module table header in Upload View */
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.hawkbit.server.ui.common.table.SPTableHeader#
|
|
||||||
* getShowFilterButtonLayoutId()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected String getShowFilterButtonLayoutId() {
|
protected String getShowFilterButtonLayoutId() {
|
||||||
return "show.type.icon";
|
return "show.type.icon";
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see hawkbit.server.ui.common.table.SPTableHeader#showFilterButtonsLayout
|
|
||||||
* ()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void showFilterButtonsLayout() {
|
protected void showFilterButtonsLayout() {
|
||||||
artifactUploadState.setSwTypeFilterClosed(false);
|
artifactUploadState.setSwTypeFilterClosed(false);
|
||||||
@@ -210,37 +148,19 @@ public class SoftwareModuleTableHeader extends AbstractTableHeader {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.eclipse.hawkbit.server.ui.common.table.SPTableHeader#resetSearchText(
|
|
||||||
* )
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void resetSearchText() {
|
protected void resetSearchText() {
|
||||||
artifactUploadState.getSoftwareModuleFilters().setSearchText(null);
|
if (artifactUploadState.getSoftwareModuleFilters().getSearchText().isPresent()) {
|
||||||
eventbus.publish(this, SMFilterEvent.REMOVER_FILTER_BY_TEXT);
|
artifactUploadState.getSoftwareModuleFilters().setSearchText(null);
|
||||||
|
eventbus.publish(this, SMFilterEvent.REMOVER_FILTER_BY_TEXT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.eclipse.hawkbit.server.ui.common.table.SPTableHeader#getMaxMinIconId(
|
|
||||||
* )
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected String getMaxMinIconId() {
|
protected String getMaxMinIconId() {
|
||||||
return SPUIComponetIdProvider.SW_MAX_MIN_TABLE_ICON;
|
return SPUIComponetIdProvider.SW_MAX_MIN_TABLE_ICON;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.eclipse.hawkbit.server.ui.common.table.SPTableHeader#maximizeTable()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void maximizeTable() {
|
public void maximizeTable() {
|
||||||
artifactUploadState.setSwModuleTableMaximized(Boolean.TRUE);
|
artifactUploadState.setSwModuleTableMaximized(Boolean.TRUE);
|
||||||
@@ -248,58 +168,28 @@ public class SoftwareModuleTableHeader extends AbstractTableHeader {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.eclipse.hawkbit.server.ui.common.table.SPTableHeader#minimizeTable()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void minimizeTable() {
|
public void minimizeTable() {
|
||||||
artifactUploadState.setSwModuleTableMaximized(Boolean.FALSE);
|
artifactUploadState.setSwModuleTableMaximized(Boolean.FALSE);
|
||||||
eventbus.publish(this, new SoftwareModuleEvent(SoftwareModuleEventType.MINIMIZED, null));
|
eventbus.publish(this, new SoftwareModuleEvent(SoftwareModuleEventType.MINIMIZED, null));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see hawkbit.server.ui.common.table.SPTableHeader#onLoadIsTableMaximized(
|
|
||||||
* )
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean onLoadIsTableMaximized() {
|
public Boolean onLoadIsTableMaximized() {
|
||||||
return artifactUploadState.isSwModuleTableMaximized();
|
return artifactUploadState.isSwModuleTableMaximized();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.hawkbit.server.ui.common.table.SPTableHeader#
|
|
||||||
* onLoadIsShowFilterButtonDisplayed()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean onLoadIsShowFilterButtonDisplayed() {
|
public Boolean onLoadIsShowFilterButtonDisplayed() {
|
||||||
return artifactUploadState.isSwTypeFilterClosed();
|
return artifactUploadState.isSwTypeFilterClosed();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see hawkbit.server.ui.common.table.SPTableHeader#searchBy(java.lang.
|
|
||||||
* String)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void searchBy(final String newSearchText) {
|
protected void searchBy(final String newSearchText) {
|
||||||
artifactUploadState.getSoftwareModuleFilters().setSearchText(newSearchText);
|
artifactUploadState.getSoftwareModuleFilters().setSearchText(newSearchText);
|
||||||
eventbus.publish(this, SMFilterEvent.FILTER_BY_TEXT);
|
eventbus.publish(this, SMFilterEvent.FILTER_BY_TEXT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see hawkbit.server.ui.common.table.SPTableHeader#addNewItem(com.vaadin.
|
|
||||||
* ui.Button.ClickEvent)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void addNewItem(final ClickEvent event) {
|
protected void addNewItem(final ClickEvent event) {
|
||||||
final Window addSoftwareModule = softwareModuleAddUpdateWindow.createAddSoftwareModuleWindow();
|
final Window addSoftwareModule = softwareModuleAddUpdateWindow.createAddSoftwareModuleWindow();
|
||||||
@@ -308,11 +198,6 @@ public class SoftwareModuleTableHeader extends AbstractTableHeader {
|
|||||||
addSoftwareModule.setVisible(Boolean.TRUE);
|
addSoftwareModule.setVisible(Boolean.TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see hawkbit.server.ui.common.table.AbstractTableHeader#canAddNewItem()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected Boolean isAddNewItemAllowed() {
|
protected Boolean isAddNewItemAllowed() {
|
||||||
return Boolean.TRUE;
|
return Boolean.TRUE;
|
||||||
@@ -333,47 +218,21 @@ public class SoftwareModuleTableHeader extends AbstractTableHeader {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.hawkbit.server.ui.common.table.AbstractTableHeader#
|
|
||||||
* getBulkUploadIconId()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected String getBulkUploadIconId() {
|
protected String getBulkUploadIconId() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see hawkbit.server.ui.common.table.AbstractTableHeader#bulkUpload(com.
|
|
||||||
* vaadin.ui.Button.ClickEvent )
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void bulkUpload(final ClickEvent event) {
|
protected void bulkUpload(final ClickEvent event) {
|
||||||
/**
|
// No implementation as no bulk upload is supported.
|
||||||
* No implementation as no bulk upload is supported.
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.hawkbit.server.ui.common.table.AbstractTableHeader#
|
|
||||||
* isBulkUploadAllowed()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected Boolean isBulkUploadAllowed() {
|
protected Boolean isBulkUploadAllowed() {
|
||||||
return Boolean.FALSE;
|
return Boolean.FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.hawkbit.ui.common.table.AbstractTableHeader#
|
|
||||||
* isBulkUploadInProgress()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean isBulkUploadInProgress() {
|
protected boolean isBulkUploadInProgress() {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -193,7 +193,7 @@ public class CreateUpdateSoftwareTypeLayout extends CustomComponent implements C
|
|||||||
getPreviewButtonColor(DEFAULT_COLOR);
|
getPreviewButtonColor(DEFAULT_COLOR);
|
||||||
tagColorPreviewBtn.setStyleName(TAG_DYNAMIC_STYLE);
|
tagColorPreviewBtn.setStyleName(TAG_DYNAMIC_STYLE);
|
||||||
|
|
||||||
selectors = new HashSet<ColorSelector>();
|
selectors = new HashSet<>();
|
||||||
selectedColor = new Color(44, 151, 32);
|
selectedColor = new Color(44, 151, 32);
|
||||||
selPreview = new SpColorPickerPreview(selectedColor);
|
selPreview = new SpColorPickerPreview(selectedColor);
|
||||||
|
|
||||||
@@ -741,38 +741,17 @@ public class CreateUpdateSoftwareTypeLayout extends CustomComponent implements C
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see com.vaadin.ui.components.colorpicker.HasColorChangeListener#
|
|
||||||
* addColorChangeListener(com.vaadin
|
|
||||||
* .ui.components.colorpicker.ColorChangeListener)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void addColorChangeListener(final ColorChangeListener listener) {
|
public void addColorChangeListener(final ColorChangeListener listener) {
|
||||||
LOG.debug("inside addColorChangeListener");
|
LOG.debug("inside addColorChangeListener");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see com.vaadin.ui.components.colorpicker.HasColorChangeListener#
|
|
||||||
* removeColorChangeListener(com.
|
|
||||||
* vaadin.ui.components.colorpicker.ColorChangeListener)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void removeColorChangeListener(final ColorChangeListener listener) {
|
public void removeColorChangeListener(final ColorChangeListener listener) {
|
||||||
LOG.debug("inside removeColorChangeListener");
|
LOG.debug("inside removeColorChangeListener");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* com.vaadin.ui.components.colorpicker.ColorSelector#setColor(com.vaadin.
|
|
||||||
* shared.ui.colorpicker .Color)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void setColor(final Color color) {
|
public void setColor(final Color color) {
|
||||||
if (color == null) {
|
if (color == null) {
|
||||||
@@ -788,23 +767,11 @@ public class CreateUpdateSoftwareTypeLayout extends CustomComponent implements C
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see com.vaadin.ui.components.colorpicker.ColorSelector#getColor()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public Color getColor() {
|
public Color getColor() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* com.vaadin.ui.components.colorpicker.ColorChangeListener#colorChanged(com
|
|
||||||
* .vaadin.ui.components .colorpicker.ColorChangeEvent)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void colorChanged(final ColorChangeEvent event) {
|
public void colorChanged(final ColorChangeEvent event) {
|
||||||
setColor(event.getColor());
|
setColor(event.getColor());
|
||||||
|
|||||||
@@ -35,8 +35,6 @@ import com.vaadin.spring.annotation.ViewScope;
|
|||||||
/**
|
/**
|
||||||
* Software module type filter buttons.
|
* Software module type filter buttons.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@SpringComponent
|
@SpringComponent
|
||||||
@ViewScope
|
@ViewScope
|
||||||
@@ -59,6 +57,7 @@ public class SMTypeFilterButtons extends AbstractFilterButtons {
|
|||||||
* @param filterButtonClickBehaviour
|
* @param filterButtonClickBehaviour
|
||||||
* the clickable behaviour.
|
* the clickable behaviour.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void init(final AbstractFilterButtonClickBehaviour filterButtonClickBehaviour) {
|
public void init(final AbstractFilterButtonClickBehaviour filterButtonClickBehaviour) {
|
||||||
super.init(filterButtonClickBehaviour);
|
super.init(filterButtonClickBehaviour);
|
||||||
eventBus.subscribe(this);
|
eventBus.subscribe(this);
|
||||||
@@ -86,58 +85,28 @@ public class SMTypeFilterButtons extends AbstractFilterButtons {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.eclipse.hawkbit.server.ui.layouts.SPFilterButtons#getButtonsTableId()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected String getButtonsTableId() {
|
protected String getButtonsTableId() {
|
||||||
return SPUIComponetIdProvider.SW_MODULE_TYPE_TABLE_ID;
|
return SPUIComponetIdProvider.SW_MODULE_TYPE_TABLE_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.hawkbit.server.ui.layouts.SPFilterButtons#
|
|
||||||
* createButtonsLazyQueryContainer()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected LazyQueryContainer createButtonsLazyQueryContainer() {
|
protected LazyQueryContainer createButtonsLazyQueryContainer() {
|
||||||
return HawkbitCommonUtil.createLazyQueryContainer(
|
return HawkbitCommonUtil.createLazyQueryContainer(
|
||||||
new BeanQueryFactory<SoftwareModuleTypeBeanQuery>(SoftwareModuleTypeBeanQuery.class));
|
new BeanQueryFactory<SoftwareModuleTypeBeanQuery>(SoftwareModuleTypeBeanQuery.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see hawkbit.server.ui.layouts.SPFilterButtons#isClickedByDefault(java.
|
|
||||||
* lang.Long)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean isClickedByDefault(final Long buttonId) {
|
protected boolean isClickedByDefault(final Long buttonId) {
|
||||||
return artifactUploadState.getSoftwareModuleFilters().getSoftwareModuleType().isPresent() && artifactUploadState
|
return artifactUploadState.getSoftwareModuleFilters().getSoftwareModuleType().isPresent() && artifactUploadState
|
||||||
.getSoftwareModuleFilters().getSoftwareModuleType().get().getId().equals(buttonId);
|
.getSoftwareModuleFilters().getSoftwareModuleType().get().getId().equals(buttonId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see hawkbit.server.ui.layouts.SPFilterButtons#createButtonId(java.lang.
|
|
||||||
* String)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected String createButtonId(final String name) {
|
protected String createButtonId(final String name) {
|
||||||
return SPUIComponetIdProvider.SM_TYPE_FILTER_BTN_ID + name;
|
return SPUIComponetIdProvider.SM_TYPE_FILTER_BTN_ID + name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.hawkbit.server.ui.common.filterlayout.SPFilterButtons#
|
|
||||||
* getFilterButtonDropHandler()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected DropHandler getFilterButtonDropHandler() {
|
protected DropHandler getFilterButtonDropHandler() {
|
||||||
return new DropHandler() {
|
return new DropHandler() {
|
||||||
@@ -155,13 +124,6 @@ public class SMTypeFilterButtons extends AbstractFilterButtons {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterButtons#
|
|
||||||
* getButttonWrapperId()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected String getButttonWrapperIdPrefix() {
|
protected String getButttonWrapperIdPrefix() {
|
||||||
return SPUIComponetIdProvider.UPLOAD_TYPE_BUTTON_PREFIX;
|
return SPUIComponetIdProvider.UPLOAD_TYPE_BUTTON_PREFIX;
|
||||||
|
|||||||
@@ -28,9 +28,6 @@ import com.vaadin.ui.Window;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Software module type filter buttons header.
|
* Software module type filter buttons header.
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@SpringComponent
|
@SpringComponent
|
||||||
@ViewScope
|
@ViewScope
|
||||||
@@ -53,6 +50,7 @@ public class SMTypeFilterHeader extends AbstractFilterHeader {
|
|||||||
/**
|
/**
|
||||||
* Initialize the components.
|
* Initialize the components.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
protected void init() {
|
protected void init() {
|
||||||
super.init();
|
super.init();
|
||||||
@@ -61,32 +59,16 @@ public class SMTypeFilterHeader extends AbstractFilterHeader {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see hawkbit.server.ui.layouts.SPFilterHeader#hasCreateUpdatePermission()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean hasCreateUpdatePermission() {
|
protected boolean hasCreateUpdatePermission() {
|
||||||
return permChecker.hasCreateDistributionPermission() || permChecker.hasUpdateDistributionPermission();
|
return permChecker.hasCreateDistributionPermission() || permChecker.hasUpdateDistributionPermission();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.hawkbit.server.ui.layouts.SPFilterHeader#getTitle()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected String getTitle() {
|
protected String getTitle() {
|
||||||
return SPUILabelDefinitions.TYPE;
|
return SPUILabelDefinitions.TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see hawkbit.server.ui.layouts.SPFilterHeader#settingsIconClicked(com.
|
|
||||||
* vaadin.ui.Button.ClickEvent )
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void settingsIconClicked(final ClickEvent event) {
|
protected void settingsIconClicked(final ClickEvent event) {
|
||||||
final Window addUpdateWindow = createUpdateSWTypeLayout.getWindow();
|
final Window addUpdateWindow = createUpdateSWTypeLayout.getWindow();
|
||||||
@@ -94,58 +76,27 @@ public class SMTypeFilterHeader extends AbstractFilterHeader {
|
|||||||
addUpdateWindow.setVisible(Boolean.TRUE);
|
addUpdateWindow.setVisible(Boolean.TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.eclipse.hawkbit.server.ui.layouts.SPFilterHeader#dropHitsRequired()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean dropHitsRequired() {
|
protected boolean dropHitsRequired() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.hawkbit.server.ui.common.filterlayout.SPFilterHeader#
|
|
||||||
* hideFilterButtonLayout()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void hideFilterButtonLayout() {
|
protected void hideFilterButtonLayout() {
|
||||||
artifactUploadState.setSwTypeFilterClosed(true);
|
artifactUploadState.setSwTypeFilterClosed(true);
|
||||||
eventbus.publish(this, UploadArtifactUIEvent.HIDE_FILTER_BY_TYPE);
|
eventbus.publish(this, UploadArtifactUIEvent.HIDE_FILTER_BY_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.hawkbit.server.ui.common.filterlayout.SPFilterHeader#
|
|
||||||
* getConfigureFilterButtonId()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected String getConfigureFilterButtonId() {
|
protected String getConfigureFilterButtonId() {
|
||||||
return SPUIDefinitions.ADD_SOFTWARE_MODULE_TYPE;
|
return SPUIDefinitions.ADD_SOFTWARE_MODULE_TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterHeader#
|
|
||||||
* getHideButtonId()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected String getHideButtonId() {
|
protected String getHideButtonId() {
|
||||||
return SPUIComponetIdProvider.SM_SHOW_FILTER_BUTTON_ID;
|
return SPUIComponetIdProvider.SM_SHOW_FILTER_BUTTON_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.hawkbit.ui.common.filterlayout.AbstractFilterHeader#
|
|
||||||
* isAddTagRequired()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean isAddTagRequired() {
|
protected boolean isAddTagRequired() {
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -56,11 +56,7 @@ import com.vaadin.ui.themes.ValoTheme;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Artifact upload confirmation popup.
|
* Artifact upload confirmation popup.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class UploadConfirmationwindow implements Button.ClickListener {
|
public class UploadConfirmationwindow implements Button.ClickListener {
|
||||||
|
|
||||||
@@ -106,7 +102,7 @@ public class UploadConfirmationwindow implements Button.ClickListener {
|
|||||||
|
|
||||||
private IndexedContainer tabelContainer;
|
private IndexedContainer tabelContainer;
|
||||||
|
|
||||||
private final List<UploadStatus> uploadResultList = new ArrayList<UploadStatus>();
|
private final List<UploadStatus> uploadResultList = new ArrayList<>();
|
||||||
|
|
||||||
private VerticalLayout uploadArtifactDetails;
|
private VerticalLayout uploadArtifactDetails;
|
||||||
|
|
||||||
|
|||||||
@@ -108,8 +108,10 @@ public class UploadHandler implements StreamVariable, Receiver, SucceededListene
|
|||||||
public OutputStream receiveUpload(final String fileName, final String mimeType) {
|
public OutputStream receiveUpload(final String fileName, final String mimeType) {
|
||||||
this.fileName = fileName;
|
this.fileName = fileName;
|
||||||
this.mimeType = mimeType;
|
this.mimeType = mimeType;
|
||||||
|
//reset has directory flag before upload
|
||||||
|
view.setHasDirectory(false);
|
||||||
try {
|
try {
|
||||||
if (view.validate()) {
|
if (view.checkIfSoftwareModuleIsSelected()) {
|
||||||
if (view.checkForDuplicate(fileName)) {
|
if (view.checkForDuplicate(fileName)) {
|
||||||
view.showDuplicateMessage();
|
view.showDuplicateMessage();
|
||||||
} else {
|
} else {
|
||||||
@@ -167,7 +169,7 @@ public class UploadHandler implements StreamVariable, Receiver, SucceededListene
|
|||||||
view.updateActionCount();
|
view.updateActionCount();
|
||||||
|
|
||||||
// display the duplicate message after streaming all files
|
// display the duplicate message after streaming all files
|
||||||
view.displayDuplicateMessageAfterStreamingAll();
|
view.displayDuplicateValidationMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -292,7 +294,7 @@ public class UploadHandler implements StreamVariable, Receiver, SucceededListene
|
|||||||
if (view.enableProcessBtn()) {
|
if (view.enableProcessBtn()) {
|
||||||
infoWindow.uploadSessionFinished();
|
infoWindow.uploadSessionFinished();
|
||||||
}
|
}
|
||||||
view.displayDuplicateMessageAfterStreamingAll();
|
view.displayDuplicateValidationMessage();
|
||||||
|
|
||||||
LOG.info("Streaming failed due to :{}", event.getException());
|
LOG.info("Streaming failed due to :{}", event.getException());
|
||||||
}
|
}
|
||||||
@@ -316,7 +318,6 @@ public class UploadHandler implements StreamVariable, Receiver, SucceededListene
|
|||||||
}
|
}
|
||||||
view.updateActionCount();
|
view.updateActionCount();
|
||||||
infoWindow.uploadFailed(event.getFilename(), failureReason);
|
infoWindow.uploadFailed(event.getFilename(), failureReason);
|
||||||
|
|
||||||
LOG.info("Upload failed for file :{}", event.getReason());
|
LOG.info("Upload failed for file :{}", event.getReason());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ import org.vaadin.spring.events.EventBus;
|
|||||||
import org.vaadin.spring.events.EventScope;
|
import org.vaadin.spring.events.EventScope;
|
||||||
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
||||||
|
|
||||||
|
import com.google.common.base.Strings;
|
||||||
import com.vaadin.event.dd.DragAndDropEvent;
|
import com.vaadin.event.dd.DragAndDropEvent;
|
||||||
import com.vaadin.event.dd.DropHandler;
|
import com.vaadin.event.dd.DropHandler;
|
||||||
import com.vaadin.event.dd.acceptcriteria.AcceptAll;
|
import com.vaadin.event.dd.acceptcriteria.AcceptAll;
|
||||||
@@ -69,8 +70,6 @@ import com.vaadin.ui.VerticalLayout;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Upload files layout.
|
* Upload files layout.
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@ViewScope
|
@ViewScope
|
||||||
@SpringComponent
|
@SpringComponent
|
||||||
@@ -102,7 +101,7 @@ public class UploadLayout extends VerticalLayout {
|
|||||||
|
|
||||||
private final AtomicInteger numberOfFilesActuallyUpload = new AtomicInteger();
|
private final AtomicInteger numberOfFilesActuallyUpload = new AtomicInteger();
|
||||||
|
|
||||||
private final List<String> duplicateFileNamesList = new ArrayList<String>();
|
private final List<String> duplicateFileNamesList = new ArrayList<>();
|
||||||
|
|
||||||
private Button processBtn;
|
private Button processBtn;
|
||||||
|
|
||||||
@@ -118,6 +117,8 @@ public class UploadLayout extends VerticalLayout {
|
|||||||
|
|
||||||
private DragAndDropWrapper dropAreaWrapper;
|
private DragAndDropWrapper dropAreaWrapper;
|
||||||
|
|
||||||
|
private Boolean hasDirectory = Boolean.FALSE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the upload layout.
|
* Initialize the upload layout.
|
||||||
*/
|
*/
|
||||||
@@ -184,27 +185,60 @@ public class UploadLayout extends VerticalLayout {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drop(final DragAndDropEvent event) {
|
public void drop(final DragAndDropEvent event) {
|
||||||
if (validate()) {
|
if (validate(event)) {
|
||||||
|
|
||||||
final Html5File[] files = ((WrapperTransferable) event.getTransferable()).getFiles();
|
final Html5File[] files = ((WrapperTransferable) event.getTransferable()).getFiles();
|
||||||
if (files != null) {
|
// reset the flag
|
||||||
for (final Html5File file : files) {
|
hasDirectory = Boolean.FALSE;
|
||||||
if (!checkForDuplicate(file.getFileName())) {
|
for (final Html5File file : files) {
|
||||||
numberOfFileUploadsExpected.incrementAndGet();
|
processFile(file);
|
||||||
file.setStreamVariable(createStreamVariable(file));
|
}
|
||||||
}
|
if (numberOfFileUploadsExpected.get() > 0) {
|
||||||
}
|
processBtn.setEnabled(false);
|
||||||
if (numberOfFileUploadsExpected.get() > 0) {
|
// reset before we start
|
||||||
processBtn.setEnabled(false);
|
uploadInfoWindow.uploadSessionStarted();
|
||||||
// reset before we start
|
} else {
|
||||||
uploadInfoWindow.uploadSessionStarted();
|
// If the upload is not started, it signifies all
|
||||||
}
|
// dropped files as either duplicate or directory.So
|
||||||
// in case if all selected files are duplicate ,then display
|
// display message accordingly
|
||||||
// message
|
displayCompositeMessage();
|
||||||
displayDuplicateMessageAfterStreamingAll();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void processFile(final Html5File file) {
|
||||||
|
if (!isDirectory(file)) {
|
||||||
|
if (!checkForDuplicate(file.getFileName())) {
|
||||||
|
numberOfFileUploadsExpected.incrementAndGet();
|
||||||
|
file.setStreamVariable(createStreamVariable(file));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
hasDirectory = Boolean.TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean isDirectory(final Html5File file) {
|
||||||
|
if (Strings.isNullOrEmpty(file.getType()) && file.getFileSize() % 4096 == 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void displayCompositeMessage() {
|
||||||
|
final String duplicateMessage = getDuplicateFileValidationMessage();
|
||||||
|
final StringBuilder compositeMessage = new StringBuilder();
|
||||||
|
if (!Strings.isNullOrEmpty(duplicateMessage)) {
|
||||||
|
compositeMessage.append(duplicateMessage);
|
||||||
|
}
|
||||||
|
if (hasDirectory) {
|
||||||
|
if (compositeMessage.length() > 0) {
|
||||||
|
compositeMessage.append("<br>");
|
||||||
|
}
|
||||||
|
compositeMessage.append(i18n.get("message.no.directory.upload"));
|
||||||
|
}
|
||||||
|
if (!compositeMessage.toString().isEmpty()) {
|
||||||
|
uiNotification.displayValidationError(compositeMessage.toString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private VerticalLayout createDropAreaLayout() {
|
private VerticalLayout createDropAreaLayout() {
|
||||||
@@ -315,10 +349,33 @@ public class UploadLayout extends VerticalLayout {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Boolean validate() {
|
Boolean validate(DragAndDropEvent event) {
|
||||||
|
// check if drop is valid.If valid ,check if software module is
|
||||||
|
// selected.
|
||||||
|
if(!isFilesDropped(event)){
|
||||||
|
uiNotification.displayValidationError(i18n.get("message.action.not.allowed"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return checkIfSoftwareModuleIsSelected();
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isFilesDropped(DragAndDropEvent event) {
|
||||||
|
if (event.getTransferable() instanceof WrapperTransferable) {
|
||||||
|
final Html5File[] files = ((WrapperTransferable) event.getTransferable()).getFiles();
|
||||||
|
// other components can also be wrapped in WrapperTransferable , so
|
||||||
|
// additional check on files
|
||||||
|
if (files == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Boolean checkIfSoftwareModuleIsSelected() {
|
||||||
if (!isSoftwareModuleSelected()) {
|
if (!isSoftwareModuleSelected()) {
|
||||||
uiNotification.displayValidationError(i18n.get("message.error.noSwModuleSelected"));
|
uiNotification.displayValidationError(i18n.get("message.error.noSwModuleSelected"));
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@@ -383,27 +440,30 @@ public class UploadLayout extends VerticalLayout {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void displayDuplicateMessageAfterStreamingAll() {
|
void displayDuplicateValidationMessage() {
|
||||||
// check if streaming of all dropped files are completed
|
// check if streaming of all dropped files are completed
|
||||||
if (numberOfFilesActuallyUpload.intValue() == numberOfFileUploadsExpected.intValue()) {
|
if (numberOfFilesActuallyUpload.intValue() == numberOfFileUploadsExpected.intValue()) {
|
||||||
showDuplicateMessage();
|
displayCompositeMessage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
private String getDuplicateFileValidationMessage() {
|
||||||
* Show duplicate file selected message.
|
StringBuilder message = new StringBuilder();
|
||||||
*/
|
|
||||||
public void showDuplicateMessage() {
|
|
||||||
if (!duplicateFileNamesList.isEmpty()) {
|
if (!duplicateFileNamesList.isEmpty()) {
|
||||||
final String fileNames = StringUtils.collectionToCommaDelimitedString(duplicateFileNamesList);
|
final String fileNames = StringUtils.collectionToCommaDelimitedString(duplicateFileNamesList);
|
||||||
if (duplicateFileNamesList.size() == 1) {
|
if (duplicateFileNamesList.size() == 1) {
|
||||||
uiNotification.displayValidationError(i18n.get("message.no.duplicateFile") + fileNames);
|
message.append(i18n.get("message.no.duplicateFile") + fileNames);
|
||||||
|
|
||||||
} else if (duplicateFileNamesList.size() > 1) {
|
} else if (duplicateFileNamesList.size() > 1) {
|
||||||
uiNotification.displayValidationError(i18n.get("message.no.duplicateFiles"));
|
message.append(i18n.get("message.no.duplicateFiles"));
|
||||||
}
|
}
|
||||||
duplicateFileNamesList.clear();
|
duplicateFileNamesList.clear();
|
||||||
}
|
}
|
||||||
|
return message.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void showDuplicateMessage() {
|
||||||
|
uiNotification.displayValidationError(getDuplicateFileValidationMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
void increaseNumberOfFileUploadsExpected() {
|
void increaseNumberOfFileUploadsExpected() {
|
||||||
@@ -595,4 +655,8 @@ public class UploadLayout extends VerticalLayout {
|
|||||||
return uiNotification;
|
return uiNotification;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setHasDirectory(Boolean hasDirectory) {
|
||||||
|
this.hasDirectory = hasDirectory;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ public class UploadResultWindow implements Button.ClickListener {
|
|||||||
|
|
||||||
private static final long serialVersionUID = 5205927189362269027L;
|
private static final long serialVersionUID = 5205927189362269027L;
|
||||||
|
|
||||||
private List<UploadStatus> uploadResultList = new ArrayList<UploadStatus>();
|
private List<UploadStatus> uploadResultList = new ArrayList<>();
|
||||||
|
|
||||||
private Button closeBtn;
|
private Button closeBtn;
|
||||||
|
|
||||||
|
|||||||
@@ -29,9 +29,6 @@ import com.vaadin.ui.themes.ValoTheme;
|
|||||||
*
|
*
|
||||||
* module.
|
* module.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class ConfirmationDialog implements Button.ClickListener {
|
public class ConfirmationDialog implements Button.ClickListener {
|
||||||
/** Serial version UID. */
|
/** Serial version UID. */
|
||||||
@@ -127,6 +124,7 @@ public class ConfirmationDialog implements Button.ClickListener {
|
|||||||
* @param event
|
* @param event
|
||||||
* the click event.
|
* the click event.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void buttonClick(final ClickEvent event) {
|
public void buttonClick(final ClickEvent event) {
|
||||||
if (window.getParent() != null) {
|
if (window.getParent() != null) {
|
||||||
UI.getCurrent().removeWindow(window);
|
UI.getCurrent().removeWindow(window);
|
||||||
@@ -146,6 +144,7 @@ public class ConfirmationDialog implements Button.ClickListener {
|
|||||||
/**
|
/**
|
||||||
* Interface for confirmation dialog callbacks.
|
* Interface for confirmation dialog callbacks.
|
||||||
*/
|
*/
|
||||||
|
@FunctionalInterface
|
||||||
public interface ConfirmationDialogCallback {
|
public interface ConfirmationDialogCallback {
|
||||||
/**
|
/**
|
||||||
* The user response.
|
* The user response.
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ public class DistributionSetTypeBeanQuery extends AbstractBeanQuery<Distribution
|
|||||||
@Override
|
@Override
|
||||||
protected List<DistributionSetType> loadBeans(final int startIndex, final int count) {
|
protected List<DistributionSetType> loadBeans(final int startIndex, final int count) {
|
||||||
Page<DistributionSetType> typeBeans;
|
Page<DistributionSetType> typeBeans;
|
||||||
final List<DistributionSetType> distSetTypeList = new ArrayList<DistributionSetType>();
|
final List<DistributionSetType> distSetTypeList = new ArrayList<>();
|
||||||
if (startIndex == 0 && firstPageDistSetType != null) {
|
if (startIndex == 0 && firstPageDistSetType != null) {
|
||||||
typeBeans = firstPageDistSetType;
|
typeBeans = firstPageDistSetType;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -45,8 +45,6 @@ import com.vaadin.ui.UI;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of target/ds tag token layout.
|
* Implementation of target/ds tag token layout.
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@SpringComponent
|
@SpringComponent
|
||||||
@@ -80,6 +78,7 @@ public class DistributionTagToken extends AbstractTagToken {
|
|||||||
// To Be Done : have to set this value based on view???
|
// To Be Done : have to set this value based on view???
|
||||||
private static final Boolean NOTAGS_SELECTED = Boolean.FALSE;
|
private static final Boolean NOTAGS_SELECTED = Boolean.FALSE;
|
||||||
|
|
||||||
|
@Override
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
protected void init() {
|
protected void init() {
|
||||||
super.init();
|
super.init();
|
||||||
@@ -88,34 +87,16 @@ public class DistributionTagToken extends AbstractTagToken {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see hawkbit.server.ui.common.tagDetails.AbstractTagToken#getTagStyleName
|
|
||||||
* ()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected String getTagStyleName() {
|
protected String getTagStyleName() {
|
||||||
return "distribution-tag-";
|
return "distribution-tag-";
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.hawkbit.server.ui.common.tagDetails.AbstractTagToken#
|
|
||||||
* getTokenInputPrompt()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected String getTokenInputPrompt() {
|
protected String getTokenInputPrompt() {
|
||||||
return i18n.get("combo.type.tag.name");
|
return i18n.get("combo.type.tag.name");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see hawkbit.server.ui.common.tagDetails.AbstractTagToken#assignTag(java.
|
|
||||||
* lang.String)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void assignTag(final String tagNameSelected) {
|
protected void assignTag(final String tagNameSelected) {
|
||||||
if (tagNameSelected != null) {
|
if (tagNameSelected != null) {
|
||||||
@@ -129,7 +110,7 @@ public class DistributionTagToken extends AbstractTagToken {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private DistributionSetTagAssigmentResult toggleAssignment(final String tagNameSelected) {
|
private DistributionSetTagAssigmentResult toggleAssignment(final String tagNameSelected) {
|
||||||
final Set<Long> distributionList = new HashSet<Long>();
|
final Set<Long> distributionList = new HashSet<>();
|
||||||
distributionList.add(selectedDS.getId());
|
distributionList.add(selectedDS.getId());
|
||||||
final DistributionSetTagAssigmentResult result = distributionSetManagement.toggleTagAssignment(distributionList,
|
final DistributionSetTagAssigmentResult result = distributionSetManagement.toggleTagAssignment(distributionList,
|
||||||
tagNameSelected);
|
tagNameSelected);
|
||||||
@@ -137,12 +118,6 @@ public class DistributionTagToken extends AbstractTagToken {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see hawkbit.server.ui.common.tagDetails.AbstractTagToken#unassignTag(
|
|
||||||
* java.lang.String)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void unassignTag(final String tagName) {
|
protected void unassignTag(final String tagName) {
|
||||||
final DistributionSetTagAssigmentResult result = toggleAssignment(tagName);
|
final DistributionSetTagAssigmentResult result = toggleAssignment(tagName);
|
||||||
@@ -160,26 +135,14 @@ public class DistributionTagToken extends AbstractTagToken {
|
|||||||
|
|
||||||
/* To Be Done : this implementation will vary in views */
|
/* To Be Done : this implementation will vary in views */
|
||||||
private List<String> getClickedTagList() {
|
private List<String> getClickedTagList() {
|
||||||
return new ArrayList<String>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.hawkbit.server.ui.common.tagDetails.AbstractTagToken#
|
|
||||||
* hasUpdatePermission()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected Boolean isToggleTagAssignmentAllowed() {
|
protected Boolean isToggleTagAssignmentAllowed() {
|
||||||
return spChecker.hasUpdateDistributionPermission();
|
return spChecker.hasUpdateDistributionPermission();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.hawkbit.server.ui.common.tagDetails.AbstractTagToken#
|
|
||||||
* displayAlreadyAssignedTags()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void displayAlreadyAssignedTags() {
|
public void displayAlreadyAssignedTags() {
|
||||||
removePreviouslyAddedTokens();
|
removePreviouslyAddedTokens();
|
||||||
@@ -190,12 +153,6 @@ public class DistributionTagToken extends AbstractTagToken {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.hawkbit.server.ui.common.tagDetails.AbstractTagToken#
|
|
||||||
* populateContainer()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void populateContainer() {
|
protected void populateContainer() {
|
||||||
container.removeAllItems();
|
container.removeAllItems();
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ package org.eclipse.hawkbit.ui.components;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||||
import org.eclipse.hawkbit.ui.decorators.SPUIButtonDecorator;
|
import org.eclipse.hawkbit.ui.decorators.SPUIButtonDecorator;
|
||||||
import org.eclipse.hawkbit.ui.decorators.SPUIComboBoxDecorator;
|
import org.eclipse.hawkbit.ui.decorators.SPUIComboBoxDecorator;
|
||||||
@@ -23,7 +24,6 @@ import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
|||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import com.vaadin.sass.internal.util.StringUtil;
|
|
||||||
import com.vaadin.server.ExternalResource;
|
import com.vaadin.server.ExternalResource;
|
||||||
import com.vaadin.server.FontAwesome;
|
import com.vaadin.server.FontAwesome;
|
||||||
import com.vaadin.server.Resource;
|
import com.vaadin.server.Resource;
|
||||||
@@ -108,16 +108,16 @@ public final class SPUIComponentProvider {
|
|||||||
final Class<? extends SPUIHeaderLayoutDecorator> tableHeaderLayoutDecorator) {
|
final Class<? extends SPUIHeaderLayoutDecorator> tableHeaderLayoutDecorator) {
|
||||||
// Do we really need this???
|
// Do we really need this???
|
||||||
HorizontalLayout hLayout = getHorizontalLayout(new SPUIHorizontalLayout().getUiHorizontalLayout().getClass());
|
HorizontalLayout hLayout = getHorizontalLayout(new SPUIHorizontalLayout().getUiHorizontalLayout().getClass());
|
||||||
|
|
||||||
|
if (tableHeaderLayoutDecorator == null) {
|
||||||
|
return hLayout;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
SPUIHeaderLayoutDecorator layoutDecorator = null;
|
final SPUIHeaderLayoutDecorator layoutDecorator = tableHeaderLayoutDecorator.newInstance();
|
||||||
if (tableHeaderLayoutDecorator != null) {
|
hLayout = layoutDecorator.decorate(hLayout);
|
||||||
layoutDecorator = tableHeaderLayoutDecorator.newInstance();
|
|
||||||
hLayout = layoutDecorator.decorate(hLayout);
|
} catch (final InstantiationException | IllegalAccessException exception) {
|
||||||
}
|
|
||||||
} catch (final InstantiationException exception) {
|
|
||||||
LOG.error("Error occured while creating horizontal decorator " + SPUIHeaderLayoutDecorator.class,
|
|
||||||
exception);
|
|
||||||
} catch (final IllegalAccessException exception) {
|
|
||||||
LOG.error("Error occured while creating horizontal decorator " + SPUIHeaderLayoutDecorator.class,
|
LOG.error("Error occured while creating horizontal decorator " + SPUIHeaderLayoutDecorator.class,
|
||||||
exception);
|
exception);
|
||||||
}
|
}
|
||||||
@@ -324,7 +324,7 @@ public final class SPUIComponentProvider {
|
|||||||
* @return Label
|
* @return Label
|
||||||
*/
|
*/
|
||||||
public static Label createNameValueLabel(final String label, final String... values) {
|
public static Label createNameValueLabel(final String label, final String... values) {
|
||||||
final String valueStr = StringUtil.collectionToDelimitedString(Arrays.asList(values), " ");
|
final String valueStr = StringUtils.join(Arrays.asList(values), " ");
|
||||||
final Label nameValueLabel = new Label(getBoldHTMLText(label) + valueStr, ContentMode.HTML);
|
final Label nameValueLabel = new Label(getBoldHTMLText(label) + valueStr, ContentMode.HTML);
|
||||||
nameValueLabel.setSizeFull();
|
nameValueLabel.setSizeFull();
|
||||||
nameValueLabel.addStyleName(SPUIDefinitions.TEXT_STYLE);
|
nameValueLabel.addStyleName(SPUIDefinitions.TEXT_STYLE);
|
||||||
|
|||||||
@@ -14,29 +14,11 @@ import com.vaadin.ui.themes.ValoTheme;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Style for button: Primary.
|
* Style for button: Primary.
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class SPUIButtonStylePrimarySmall implements SPUIButtonDecorator {
|
public class SPUIButtonStylePrimarySmall implements SPUIButtonDecorator {
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* Decorate Button and return.
|
public Button decorate(final Button button, final String style, final boolean setStyle, final Resource icon) {
|
||||||
*
|
|
||||||
* @param button
|
|
||||||
* as Button
|
|
||||||
* @param style
|
|
||||||
* as String
|
|
||||||
* @param setStyle
|
|
||||||
* as String
|
|
||||||
* @param icon
|
|
||||||
* as resource
|
|
||||||
* @return Button
|
|
||||||
*/
|
|
||||||
public Button decorate(Button button, String style, boolean setStyle, Resource icon) {
|
|
||||||
button.addStyleName(ValoTheme.BUTTON_PRIMARY + " " + ValoTheme.BUTTON_SMALL);
|
button.addStyleName(ValoTheme.BUTTON_PRIMARY + " " + ValoTheme.BUTTON_SMALL);
|
||||||
// Set Style
|
// Set Style
|
||||||
if (null != style) {
|
if (null != style) {
|
||||||
|
|||||||
@@ -14,29 +14,12 @@ import com.vaadin.ui.themes.ValoTheme;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Style for button: Small.
|
* Style for button: Small.
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class SPUIButtonStyleSmall implements SPUIButtonDecorator {
|
public class SPUIButtonStyleSmall implements SPUIButtonDecorator {
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* Decorate Button and return.
|
public Button decorate(final Button button, final String style, final boolean setStyle, final Resource icon) {
|
||||||
*
|
|
||||||
* @param button
|
|
||||||
* as Button
|
|
||||||
* @param style
|
|
||||||
* as String
|
|
||||||
* @param setStyle
|
|
||||||
* as String
|
|
||||||
* @param icon
|
|
||||||
* as resource
|
|
||||||
* @return Button
|
|
||||||
*/
|
|
||||||
public Button decorate(Button button, String style, boolean setStyle, Resource icon) {
|
|
||||||
button.addStyleName(ValoTheme.BUTTON_SMALL);
|
button.addStyleName(ValoTheme.BUTTON_SMALL);
|
||||||
// Set Style
|
// Set Style
|
||||||
if (null != style) {
|
if (null != style) {
|
||||||
|
|||||||
@@ -14,29 +14,12 @@ import com.vaadin.ui.themes.ValoTheme;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Style for button: Small NoBorder Height UnDefined.
|
* Style for button: Small NoBorder Height UnDefined.
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class SPUIButtonStyleSmallNoBorderUH implements SPUIButtonDecorator {
|
public class SPUIButtonStyleSmallNoBorderUH implements SPUIButtonDecorator {
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* Decorate Button and return.
|
public Button decorate(final Button button, final String style, final boolean setStyle, final Resource icon) {
|
||||||
*
|
|
||||||
* @param button
|
|
||||||
* as Button
|
|
||||||
* @param style
|
|
||||||
* as String
|
|
||||||
* @param setStyle
|
|
||||||
* as String
|
|
||||||
* @param icon
|
|
||||||
* as resource
|
|
||||||
* @return Button
|
|
||||||
*/
|
|
||||||
public Button decorate(Button button, String style, boolean setStyle, Resource icon) {
|
|
||||||
button.addStyleName(ValoTheme.BUTTON_SMALL);
|
button.addStyleName(ValoTheme.BUTTON_SMALL);
|
||||||
button.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED);
|
button.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED);
|
||||||
button.setHeightUndefined();
|
button.setHeightUndefined();
|
||||||
|
|||||||
@@ -14,29 +14,12 @@ import com.vaadin.ui.themes.ValoTheme;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Style for button: Small NoBorder Height and size UnDefined.
|
* Style for button: Small NoBorder Height and size UnDefined.
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class SPUIButtonStyleSmallNoBorderUHS implements SPUIButtonDecorator {
|
public class SPUIButtonStyleSmallNoBorderUHS implements SPUIButtonDecorator {
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* Decorate Button and return.
|
public Button decorate(final Button button, final String style, final boolean setStyle, final Resource icon) {
|
||||||
*
|
|
||||||
* @param button
|
|
||||||
* as Button
|
|
||||||
* @param style
|
|
||||||
* as String
|
|
||||||
* @param setStyle
|
|
||||||
* as String
|
|
||||||
* @param icon
|
|
||||||
* as resource
|
|
||||||
* @return Button
|
|
||||||
*/
|
|
||||||
public Button decorate(Button button, String style, boolean setStyle, Resource icon) {
|
|
||||||
button.addStyleName(ValoTheme.BUTTON_SMALL);
|
button.addStyleName(ValoTheme.BUTTON_SMALL);
|
||||||
button.addStyleName(ValoTheme.BUTTON_BORDERLESS);
|
button.addStyleName(ValoTheme.BUTTON_BORDERLESS);
|
||||||
button.setHeightUndefined();
|
button.setHeightUndefined();
|
||||||
|
|||||||
@@ -14,29 +14,12 @@ import com.vaadin.ui.themes.ValoTheme;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Style for button: Small.
|
* Style for button: Small.
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class SPUIButtonStyleTiny implements SPUIButtonDecorator {
|
public class SPUIButtonStyleTiny implements SPUIButtonDecorator {
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* Decorate Button and return.
|
public Button decorate(final Button button, final String style, final boolean setStyle, final Resource icon) {
|
||||||
*
|
|
||||||
* @param button
|
|
||||||
* as Button
|
|
||||||
* @param style
|
|
||||||
* as String
|
|
||||||
* @param setStyle
|
|
||||||
* as String
|
|
||||||
* @param icon
|
|
||||||
* as resource
|
|
||||||
* @return Button
|
|
||||||
*/
|
|
||||||
public Button decorate(Button button, String style, boolean setStyle, Resource icon) {
|
|
||||||
button.addStyleName(ValoTheme.BUTTON_TINY);
|
button.addStyleName(ValoTheme.BUTTON_TINY);
|
||||||
// Set Style
|
// Set Style
|
||||||
if (null != style) {
|
if (null != style) {
|
||||||
|
|||||||
@@ -16,27 +16,10 @@ import com.vaadin.ui.themes.ValoTheme;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Style for button: Tag.
|
* Style for button: Tag.
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class SPUITagButtonStyle implements SPUIButtonDecorator {
|
public class SPUITagButtonStyle implements SPUIButtonDecorator {
|
||||||
/**
|
|
||||||
* Decorate Button and return.
|
@Override
|
||||||
*
|
|
||||||
* @param button
|
|
||||||
* as Button
|
|
||||||
* @param style
|
|
||||||
* as String
|
|
||||||
* @param setStyle
|
|
||||||
* as String
|
|
||||||
* @param icon
|
|
||||||
* as resource
|
|
||||||
* @return Button
|
|
||||||
*/
|
|
||||||
public Button decorate(final Button button, final String style, final boolean setStyle, final Resource icon) {
|
public Button decorate(final Button button, final String style, final boolean setStyle, final Resource icon) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -79,8 +79,6 @@ import com.vaadin.ui.themes.ValoTheme;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Window for create update Distribution Set Type.
|
* Window for create update Distribution Set Type.
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@SpringComponent
|
@SpringComponent
|
||||||
@ViewScope
|
@ViewScope
|
||||||
@@ -221,7 +219,7 @@ public class CreateUpdateDistSetTypeLayout extends CustomComponent implements Co
|
|||||||
|
|
||||||
getPreviewButtonColor(DEFAULT_COLOR);
|
getPreviewButtonColor(DEFAULT_COLOR);
|
||||||
|
|
||||||
selectors = new HashSet<ColorSelector>();
|
selectors = new HashSet<>();
|
||||||
selectedColor = new Color(44, 151, 32);
|
selectedColor = new Color(44, 151, 32);
|
||||||
selPreview = new SpColorPickerPreview(selectedColor);
|
selPreview = new SpColorPickerPreview(selectedColor);
|
||||||
|
|
||||||
@@ -457,6 +455,7 @@ public class CreateUpdateDistSetTypeLayout extends CustomComponent implements Co
|
|||||||
sourceTable.setItemDescriptionGenerator(new ItemDescriptionGenerator() {
|
sourceTable.setItemDescriptionGenerator(new ItemDescriptionGenerator() {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Override
|
||||||
public String generateDescription(final Component source, final Object itemId, final Object propertyId) {
|
public String generateDescription(final Component source, final Object itemId, final Object propertyId) {
|
||||||
final Item item = sourceTable.getItem(itemId);
|
final Item item = sourceTable.getItem(itemId);
|
||||||
final String description = (String) item.getItemProperty(DIST_TYPE_DESCRIPTION).getValue();
|
final String description = (String) item.getItemProperty(DIST_TYPE_DESCRIPTION).getValue();
|
||||||
@@ -475,7 +474,7 @@ public class CreateUpdateDistSetTypeLayout extends CustomComponent implements Co
|
|||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
private void getSelectedTableItemData(final Long id) {
|
private void getSelectedTableItemData(final Long id) {
|
||||||
Item saveTblitem = null;
|
Item saveTblitem;
|
||||||
if (null != selectedTablecontainer) {
|
if (null != selectedTablecontainer) {
|
||||||
saveTblitem = selectedTablecontainer.addItem(id);
|
saveTblitem = selectedTablecontainer.addItem(id);
|
||||||
saveTblitem.getItemProperty(DIST_TYPE_NAME).setValue(
|
saveTblitem.getItemProperty(DIST_TYPE_NAME).setValue(
|
||||||
@@ -657,10 +656,10 @@ public class CreateUpdateDistSetTypeLayout extends CustomComponent implements Co
|
|||||||
DistributionSetType newDistType = new DistributionSetType(typeKeyValue, typeNameValue, typeDescValue);
|
DistributionSetType newDistType = new DistributionSetType(typeKeyValue, typeNameValue, typeDescValue);
|
||||||
for (final Long id : itemIds) {
|
for (final Long id : itemIds) {
|
||||||
final Item item = selectedTable.getItem(id);
|
final Item item = selectedTable.getItem(id);
|
||||||
final String dist_type_name = (String) item.getItemProperty(DIST_TYPE_NAME).getValue();
|
final String distTypeName = (String) item.getItemProperty(DIST_TYPE_NAME).getValue();
|
||||||
final CheckBox mandatoryCheckBox = (CheckBox) item.getItemProperty(DIST_TYPE_MANDATORY).getValue();
|
final CheckBox mandatoryCheckBox = (CheckBox) item.getItemProperty(DIST_TYPE_MANDATORY).getValue();
|
||||||
final Boolean isMandatory = mandatoryCheckBox.getValue();
|
final Boolean isMandatory = mandatoryCheckBox.getValue();
|
||||||
final SoftwareModuleType swModuleType = softwareManagement.findSoftwareModuleTypeByName(dist_type_name);
|
final SoftwareModuleType swModuleType = softwareManagement.findSoftwareModuleTypeByName(distTypeName);
|
||||||
if (isMandatory) {
|
if (isMandatory) {
|
||||||
newDistType.addMandatoryModuleType(swModuleType);
|
newDistType.addMandatoryModuleType(swModuleType);
|
||||||
|
|
||||||
@@ -1032,7 +1031,6 @@ public class CreateUpdateDistSetTypeLayout extends CustomComponent implements Co
|
|||||||
* as the selected tag from combo
|
* as the selected tag from combo
|
||||||
*/
|
*/
|
||||||
private void setTypeTagCombo(final String distSetTypeSelected) {
|
private void setTypeTagCombo(final String distSetTypeSelected) {
|
||||||
boolean mandatory = false;
|
|
||||||
typeName.setValue(distSetTypeSelected);
|
typeName.setValue(distSetTypeSelected);
|
||||||
getSourceTableData();
|
getSourceTableData();
|
||||||
selectedTable.getContainerDataSource().removeAllItems();
|
selectedTable.getContainerDataSource().removeAllItems();
|
||||||
@@ -1053,13 +1051,11 @@ public class CreateUpdateDistSetTypeLayout extends CustomComponent implements Co
|
|||||||
saveDistSetType.setEnabled(false);
|
saveDistSetType.setEnabled(false);
|
||||||
}
|
}
|
||||||
for (final SoftwareModuleType swModuleType : selectedTypeTag.getOptionalModuleTypes()) {
|
for (final SoftwareModuleType swModuleType : selectedTypeTag.getOptionalModuleTypes()) {
|
||||||
mandatory = false;
|
addTargetTableforUpdate(swModuleType, false);
|
||||||
addTargetTableforUpdate(swModuleType, mandatory);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (final SoftwareModuleType swModuleType : selectedTypeTag.getMandatoryModuleTypes()) {
|
for (final SoftwareModuleType swModuleType : selectedTypeTag.getMandatoryModuleTypes()) {
|
||||||
mandatory = true;
|
addTargetTableforUpdate(swModuleType, true);
|
||||||
addTargetTableforUpdate(swModuleType, mandatory);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (null == selectedTypeTag.getColour()) {
|
if (null == selectedTypeTag.getColour()) {
|
||||||
|
|||||||
@@ -60,44 +60,24 @@ public class DSTypeFilterButtons extends AbstractFilterButtons {
|
|||||||
* @param filterButtonClickBehaviour
|
* @param filterButtonClickBehaviour
|
||||||
* the clickable behaviour.
|
* the clickable behaviour.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void init(final AbstractFilterButtonClickBehaviour filterButtonClickBehaviour) {
|
public void init(final AbstractFilterButtonClickBehaviour filterButtonClickBehaviour) {
|
||||||
super.init(filterButtonClickBehaviour);
|
super.init(filterButtonClickBehaviour);
|
||||||
eventBus.subscribe(this);
|
eventBus.subscribe(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterButtons#
|
|
||||||
* getButtonsTableId()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected String getButtonsTableId() {
|
protected String getButtonsTableId() {
|
||||||
|
|
||||||
return SPUIComponetIdProvider.DISTRIBUTION_SET_TYPE_TABLE_ID;
|
return SPUIComponetIdProvider.DISTRIBUTION_SET_TYPE_TABLE_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterButtons#
|
|
||||||
* createButtonsLazyQueryContainer ()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected LazyQueryContainer createButtonsLazyQueryContainer() {
|
protected LazyQueryContainer createButtonsLazyQueryContainer() {
|
||||||
return HawkbitCommonUtil.createLazyQueryContainer(
|
return HawkbitCommonUtil.createLazyQueryContainer(
|
||||||
new BeanQueryFactory<DistributionSetTypeBeanQuery>(DistributionSetTypeBeanQuery.class));
|
new BeanQueryFactory<DistributionSetTypeBeanQuery>(DistributionSetTypeBeanQuery.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterButtons#
|
|
||||||
* isClickedByDefault(java.lang .Long)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean isClickedByDefault(final Long buttonId) {
|
protected boolean isClickedByDefault(final Long buttonId) {
|
||||||
|
|
||||||
@@ -105,26 +85,12 @@ public class DSTypeFilterButtons extends AbstractFilterButtons {
|
|||||||
&& manageDistUIState.getManageDistFilters().getClickedDistSetType().getId().equals(buttonId);
|
&& manageDistUIState.getManageDistFilters().getClickedDistSetType().getId().equals(buttonId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterButtons#
|
|
||||||
* createButtonId(java.lang. String)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected String createButtonId(final String name) {
|
protected String createButtonId(final String name) {
|
||||||
|
|
||||||
return SPUIComponetIdProvider.DS_TYPE_FILTER_BTN_ID + name;
|
return SPUIComponetIdProvider.DS_TYPE_FILTER_BTN_ID + name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterButtons#
|
|
||||||
* getFilterButtonDropHandler()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected DropHandler getFilterButtonDropHandler() {
|
protected DropHandler getFilterButtonDropHandler() {
|
||||||
|
|
||||||
@@ -148,13 +114,6 @@ public class DSTypeFilterButtons extends AbstractFilterButtons {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterButtons#
|
|
||||||
* getButttonWrapperId()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected String getButttonWrapperIdPrefix() {
|
protected String getButttonWrapperIdPrefix() {
|
||||||
|
|
||||||
|
|||||||
@@ -27,9 +27,6 @@ import com.vaadin.ui.Window;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Distribution Set Type filter buttons header.
|
* Distribution Set Type filter buttons header.
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@SpringComponent
|
@SpringComponent
|
||||||
@ViewScope
|
@ViewScope
|
||||||
@@ -49,9 +46,7 @@ public class DSTypeFilterHeader extends AbstractFilterHeader {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private CreateUpdateDistSetTypeLayout createUpdateDistSetTypeLayout;
|
private CreateUpdateDistSetTypeLayout createUpdateDistSetTypeLayout;
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* Initialize the components.
|
|
||||||
*/
|
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void init() {
|
public void init() {
|
||||||
super.init();
|
super.init();
|
||||||
@@ -60,37 +55,16 @@ public class DSTypeFilterHeader extends AbstractFilterHeader {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterHeader#
|
|
||||||
* hasCreateUpdatePermission()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean hasCreateUpdatePermission() {
|
protected boolean hasCreateUpdatePermission() {
|
||||||
|
|
||||||
return permChecker.hasCreateDistributionPermission() || permChecker.hasUpdateDistributionPermission();
|
return permChecker.hasCreateDistributionPermission() || permChecker.hasUpdateDistributionPermission();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see hawkbit.server.ui.common.filterlayout.AbstractFilterHeader#getTitle(
|
|
||||||
* )
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected String getTitle() {
|
protected String getTitle() {
|
||||||
return SPUILabelDefinitions.TYPE;
|
return SPUILabelDefinitions.TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterHeader#
|
|
||||||
* settingsIconClicked(com.vaadin .ui.Button.ClickEvent)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void settingsIconClicked(final ClickEvent event) {
|
protected void settingsIconClicked(final ClickEvent event) {
|
||||||
final Window addUpdateWindow = createUpdateDistSetTypeLayout.getWindow();
|
final Window addUpdateWindow = createUpdateDistSetTypeLayout.getWindow();
|
||||||
@@ -99,25 +73,11 @@ public class DSTypeFilterHeader extends AbstractFilterHeader {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterHeader#
|
|
||||||
* dropHitsRequired()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean dropHitsRequired() {
|
protected boolean dropHitsRequired() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterHeader#
|
|
||||||
* hideFilterButtonLayout()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void hideFilterButtonLayout() {
|
protected void hideFilterButtonLayout() {
|
||||||
manageDistUIState.setDistTypeFilterClosed(true);
|
manageDistUIState.setDistTypeFilterClosed(true);
|
||||||
@@ -125,38 +85,17 @@ public class DSTypeFilterHeader extends AbstractFilterHeader {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterHeader#
|
|
||||||
* getConfigureFilterButtonId()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected String getConfigureFilterButtonId() {
|
protected String getConfigureFilterButtonId() {
|
||||||
|
|
||||||
return SPUIDefinitions.ADD_DISTRIBUTION_TYPE_TAG;
|
return SPUIDefinitions.ADD_DISTRIBUTION_TYPE_TAG;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterHeader#
|
|
||||||
* getHideButtonId()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected String getHideButtonId() {
|
protected String getHideButtonId() {
|
||||||
|
|
||||||
return SPUIDefinitions.HIDE_FILTER_DIST_TYPE;
|
return SPUIDefinitions.HIDE_FILTER_DIST_TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.hawkbit.ui.common.filterlayout.AbstractFilterHeader#
|
|
||||||
* isAddTagRequired()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean isAddTagRequired() {
|
protected boolean isAddTagRequired() {
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -74,8 +74,6 @@ import com.vaadin.ui.UI;
|
|||||||
/**
|
/**
|
||||||
* Distribution set table.
|
* Distribution set table.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@SpringComponent
|
@SpringComponent
|
||||||
@ViewScope
|
@ViewScope
|
||||||
@@ -136,49 +134,36 @@ public class DistributionSetTable extends AbstractTable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.eclipse.hawkbit.server.ui.common.table.AbstractTable#getTableId()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected String getTableId() {
|
protected String getTableId() {
|
||||||
return SPUIComponetIdProvider.DIST_TABLE_ID;
|
return SPUIComponetIdProvider.DIST_TABLE_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.eclipse.hawkbit.server.ui.common.table.AbstractTable#createContainer(
|
|
||||||
* )
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected Container createContainer() {
|
protected Container createContainer() {
|
||||||
|
|
||||||
final Map<String, Object> queryConfiguration = new HashMap<>();
|
final Map<String, Object> queryConfiguration = prepareQueryConfigFilters();
|
||||||
manageDistUIState.getManageDistFilters().getSearchText()
|
|
||||||
.ifPresent(value -> queryConfiguration.put(SPUIDefinitions.FILTER_BY_TEXT, value));
|
|
||||||
|
|
||||||
if (null != manageDistUIState.getManageDistFilters().getClickedDistSetType()) {
|
|
||||||
queryConfiguration.put(SPUIDefinitions.FILTER_BY_DISTRIBUTION_SET_TYPE,
|
|
||||||
manageDistUIState.getManageDistFilters().getClickedDistSetType());
|
|
||||||
}
|
|
||||||
|
|
||||||
final BeanQueryFactory<ManageDistBeanQuery> distributionQF = new BeanQueryFactory<>(ManageDistBeanQuery.class);
|
final BeanQueryFactory<ManageDistBeanQuery> distributionQF = new BeanQueryFactory<>(ManageDistBeanQuery.class);
|
||||||
|
|
||||||
distributionQF.setQueryConfiguration(queryConfiguration);
|
distributionQF.setQueryConfiguration(queryConfiguration);
|
||||||
return new LazyQueryContainer(
|
return new LazyQueryContainer(
|
||||||
new LazyQueryDefinition(true, SPUIDefinitions.PAGE_SIZE, SPUILabelDefinitions.VAR_DIST_ID_NAME),
|
new LazyQueryDefinition(true, SPUIDefinitions.PAGE_SIZE, SPUILabelDefinitions.VAR_DIST_ID_NAME),
|
||||||
distributionQF);
|
distributionQF);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
private Map<String, Object> prepareQueryConfigFilters() {
|
||||||
* (non-Javadoc)
|
final Map<String, Object> queryConfig = new HashMap<>();
|
||||||
*
|
manageDistUIState.getManageDistFilters().getSearchText()
|
||||||
* @see hawkbit.server.ui.common.table.AbstractTable#addContainerProperties
|
.ifPresent(value -> queryConfig.put(SPUIDefinitions.FILTER_BY_TEXT, value));
|
||||||
* (com.vaadin.data.Container )
|
|
||||||
*/
|
if (null != manageDistUIState.getManageDistFilters().getClickedDistSetType()) {
|
||||||
|
queryConfig.put(SPUIDefinitions.FILTER_BY_DISTRIBUTION_SET_TYPE,
|
||||||
|
manageDistUIState.getManageDistFilters().getClickedDistSetType());
|
||||||
|
}
|
||||||
|
|
||||||
|
return queryConfig;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void addContainerProperties(final Container container) {
|
protected void addContainerProperties(final Container container) {
|
||||||
HawkbitCommonUtil.getDsTableColumnProperties(container);
|
HawkbitCommonUtil.getDsTableColumnProperties(container);
|
||||||
@@ -186,12 +171,6 @@ public class DistributionSetTable extends AbstractTable {
|
|||||||
Boolean.class, null, false, true);
|
Boolean.class, null, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.hawkbit.server.ui.common.table.AbstractTable#
|
|
||||||
* addCustomGeneratedColumns ()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void addCustomGeneratedColumns() {
|
protected void addCustomGeneratedColumns() {
|
||||||
/**
|
/**
|
||||||
@@ -199,23 +178,12 @@ public class DistributionSetTable extends AbstractTable {
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.hawkbit.server.ui.common.table.AbstractTable#
|
|
||||||
* isFirstRowSelectedOnLoad ()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean isFirstRowSelectedOnLoad() {
|
protected boolean isFirstRowSelectedOnLoad() {
|
||||||
return !manageDistUIState.getSelectedDistributions().isPresent()
|
return !manageDistUIState.getSelectedDistributions().isPresent()
|
||||||
|| manageDistUIState.getSelectedDistributions().get().isEmpty();
|
|| manageDistUIState.getSelectedDistributions().get().isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see hawkbit.server.ui.common.table.AbstractTable#getItemIdToSelect()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected Object getItemIdToSelect() {
|
protected Object getItemIdToSelect() {
|
||||||
if (manageDistUIState.getSelectedDistributions().isPresent()) {
|
if (manageDistUIState.getSelectedDistributions().isPresent()) {
|
||||||
@@ -224,12 +192,6 @@ public class DistributionSetTable extends AbstractTable {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.eclipse.hawkbit.server.ui.common.table.AbstractTable#onValueChange()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void onValueChange() {
|
protected void onValueChange() {
|
||||||
eventBus.publish(this, DragEvent.HIDE_DROP_HINT);
|
eventBus.publish(this, DragEvent.HIDE_DROP_HINT);
|
||||||
@@ -264,33 +226,16 @@ public class DistributionSetTable extends AbstractTable {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.eclipse.hawkbit.server.ui.common.table.AbstractTable#isMaximized()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean isMaximized() {
|
protected boolean isMaximized() {
|
||||||
return manageDistUIState.isDsTableMaximized();
|
return manageDistUIState.isDsTableMaximized();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see hawkbit.server.ui.common.table.AbstractTable#getTableVisibleColumns
|
|
||||||
* ()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected List<TableColumn> getTableVisibleColumns() {
|
protected List<TableColumn> getTableVisibleColumns() {
|
||||||
return HawkbitCommonUtil.getTableVisibleColumns(isMaximized(), false, i18n);
|
return HawkbitCommonUtil.getTableVisibleColumns(isMaximized(), false, i18n);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see hawkbit.server.ui.common.table.AbstractTable#getTableDropHandler()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected DropHandler getTableDropHandler() {
|
protected DropHandler getTableDropHandler() {
|
||||||
return new DropHandler() {
|
return new DropHandler() {
|
||||||
|
|||||||
@@ -36,8 +36,6 @@ import com.vaadin.ui.Window;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Distribution table header.
|
* Distribution table header.
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@SpringComponent
|
@SpringComponent
|
||||||
@ViewScope
|
@ViewScope
|
||||||
@@ -60,9 +58,7 @@ public class DistributionSetTableHeader extends AbstractTableHeader {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private DistributionAddUpdateWindowLayout addUpdateWindowLayout;
|
private DistributionAddUpdateWindowLayout addUpdateWindowLayout;
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* Initialize the component.
|
|
||||||
*/
|
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
protected void init() {
|
protected void init() {
|
||||||
super.init();
|
super.init();
|
||||||
@@ -76,54 +72,26 @@ public class DistributionSetTableHeader extends AbstractTableHeader {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see hawkbit.server.ui.common.table.AbstractTableHeader#getHeaderCaption(
|
|
||||||
* )
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected String getHeaderCaption() {
|
protected String getHeaderCaption() {
|
||||||
return i18n.get("header.dist.table");
|
return i18n.get("header.dist.table");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see hawkbit.server.ui.common.table.AbstractTableHeader#getSearchBoxId()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected String getSearchBoxId() {
|
protected String getSearchBoxId() {
|
||||||
return SPUIComponetIdProvider.DIST_SEARCH_TEXTFIELD;
|
return SPUIComponetIdProvider.DIST_SEARCH_TEXTFIELD;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.hawkbit.server.ui.common.table.AbstractTableHeader#
|
|
||||||
* getSearchRestIconId()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected String getSearchRestIconId() {
|
protected String getSearchRestIconId() {
|
||||||
return SPUIComponetIdProvider.DIST_SEARCH_ICON;
|
return SPUIComponetIdProvider.DIST_SEARCH_ICON;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see hawkbit.server.ui.common.table.AbstractTableHeader#getAddIconId()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected String getAddIconId() {
|
protected String getAddIconId() {
|
||||||
return SPUIComponetIdProvider.DIST_ADD_ICON;
|
return SPUIComponetIdProvider.DIST_ADD_ICON;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.hawkbit.server.ui.common.table.AbstractTableHeader#
|
|
||||||
* onLoadSearchBoxValue()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected String onLoadSearchBoxValue() {
|
protected String onLoadSearchBoxValue() {
|
||||||
if (manageDistUIstate.getManageDistFilters().getSearchText().isPresent()) {
|
if (manageDistUIstate.getManageDistFilters().getSearchText().isPresent()) {
|
||||||
@@ -132,11 +100,6 @@ public class DistributionSetTableHeader extends AbstractTableHeader {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see hawkbit.server.ui.common.table.AbstractTableHeader#getDropFilterId()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected String getDropFilterId() {
|
protected String getDropFilterId() {
|
||||||
return null;
|
return null;
|
||||||
@@ -170,9 +133,10 @@ public class DistributionSetTableHeader extends AbstractTableHeader {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void resetSearchText() {
|
protected void resetSearchText() {
|
||||||
manageDistUIstate.getManageDistFilters().setSearchText(null);
|
if (manageDistUIstate.getManageDistFilters().getSearchText().isPresent()) {
|
||||||
eventbus.publish(this, DistributionTableFilterEvent.REMOVE_FILTER_BY_TEXT);
|
manageDistUIstate.getManageDistFilters().setSearchText(null);
|
||||||
|
eventbus.publish(this, DistributionTableFilterEvent.REMOVE_FILTER_BY_TEXT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -222,11 +186,6 @@ public class DistributionSetTableHeader extends AbstractTableHeader {
|
|||||||
eventbus.unsubscribe(this);
|
eventbus.unsubscribe(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see hawkbit.server.ui.common.table.AbstractTableHeader#canAddNewItem()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected Boolean isAddNewItemAllowed() {
|
protected Boolean isAddNewItemAllowed() {
|
||||||
return Boolean.TRUE;
|
return Boolean.TRUE;
|
||||||
@@ -247,47 +206,21 @@ public class DistributionSetTableHeader extends AbstractTableHeader {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.hawkbit.server.ui.common.table.AbstractTableHeader#
|
|
||||||
* getBulkUploadIconId()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected String getBulkUploadIconId() {
|
protected String getBulkUploadIconId() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see hawkbit.server.ui.common.table.AbstractTableHeader#bulkUpload(com.
|
|
||||||
* vaadin.ui.Button.ClickEvent )
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void bulkUpload(final ClickEvent event) {
|
protected void bulkUpload(final ClickEvent event) {
|
||||||
/**
|
// No implementation as no bulk upload is supported.
|
||||||
* No implementation as no bulk upload is supported.
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.hawkbit.server.ui.common.table.AbstractTableHeader#
|
|
||||||
* isBulkUploadAllowed()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected Boolean isBulkUploadAllowed() {
|
protected Boolean isBulkUploadAllowed() {
|
||||||
return Boolean.FALSE;
|
return Boolean.FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.hawkbit.ui.common.table.AbstractTableHeader#
|
|
||||||
* isBulkUploadInProgress()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean isBulkUploadInProgress() {
|
protected boolean isBulkUploadInProgress() {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -37,8 +37,6 @@ import com.google.common.base.Strings;
|
|||||||
/**
|
/**
|
||||||
* Manage Distributions table bean query.
|
* Manage Distributions table bean query.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class ManageDistBeanQuery extends AbstractBeanQuery<ProxyDistribution> {
|
public class ManageDistBeanQuery extends AbstractBeanQuery<ProxyDistribution> {
|
||||||
|
|
||||||
@@ -83,28 +81,15 @@ public class ManageDistBeanQuery extends AbstractBeanQuery<ProxyDistribution> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.vaadin.addons.lazyquerycontainer.AbstractBeanQuery#constructBean()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected ProxyDistribution constructBean() {
|
protected ProxyDistribution constructBean() {
|
||||||
return new ProxyDistribution();
|
return new ProxyDistribution();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.vaadin.addons.lazyquerycontainer.AbstractBeanQuery#loadBeans(int,
|
|
||||||
* int)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected List<ProxyDistribution> loadBeans(final int startIndex, final int count) {
|
protected List<ProxyDistribution> loadBeans(final int startIndex, final int count) {
|
||||||
Page<DistributionSet> distBeans;
|
Page<DistributionSet> distBeans;
|
||||||
final List<ProxyDistribution> proxyDistributions = new ArrayList<ProxyDistribution>();
|
final List<ProxyDistribution> proxyDistributions = new ArrayList<>();
|
||||||
if (startIndex == 0 && firstPageDistributionSets != null) {
|
if (startIndex == 0 && firstPageDistributionSets != null) {
|
||||||
distBeans = firstPageDistributionSets;
|
distBeans = firstPageDistributionSets;
|
||||||
} else if (Strings.isNullOrEmpty(searchText)) {
|
} else if (Strings.isNullOrEmpty(searchText)) {
|
||||||
@@ -136,24 +121,12 @@ public class ManageDistBeanQuery extends AbstractBeanQuery<ProxyDistribution> {
|
|||||||
return proxyDistributions;
|
return proxyDistributions;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.vaadin.addons.lazyquerycontainer.AbstractBeanQuery#saveBeans(java.
|
|
||||||
* util.List, java.util.List, java.util.List)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void saveBeans(final List<ProxyDistribution> arg0, final List<ProxyDistribution> arg1,
|
protected void saveBeans(final List<ProxyDistribution> arg0, final List<ProxyDistribution> arg1,
|
||||||
final List<ProxyDistribution> arg2) {
|
final List<ProxyDistribution> arg2) {
|
||||||
// Add,Delete and Update are performed through repository methods
|
// Add,Delete and Update are performed through repository methods
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.vaadin.addons.lazyquerycontainer.AbstractBeanQuery#size()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public int size() {
|
public int size() {
|
||||||
if (Strings.isNullOrEmpty(searchText) && null == distributionSetType) {
|
if (Strings.isNullOrEmpty(searchText) && null == distributionSetType) {
|
||||||
|
|||||||
@@ -28,8 +28,6 @@ import com.vaadin.ui.Component;
|
|||||||
/**
|
/**
|
||||||
* Distributions View for Accept criteria.
|
* Distributions View for Accept criteria.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@SpringComponent
|
@SpringComponent
|
||||||
@ViewScope
|
@ViewScope
|
||||||
@@ -47,12 +45,6 @@ public class DistributionsViewAcceptCriteria extends AbstractAcceptCriteria {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private transient EventBus.SessionEventBus eventBus;
|
private transient EventBus.SessionEventBus eventBus;
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see hawkbit.server.ui.common.AbstractAcceptCriteria#analyseDragComponent
|
|
||||||
* (com.vaadin.event .dd.DragAndDropEvent, com.vaadin.ui.Component)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void analyseDragComponent(final Component compsource) {
|
protected void analyseDragComponent(final Component compsource) {
|
||||||
final String sourceID = getComponentId(compsource);
|
final String sourceID = getComponentId(compsource);
|
||||||
@@ -60,24 +52,11 @@ public class DistributionsViewAcceptCriteria extends AbstractAcceptCriteria {
|
|||||||
eventBus.publish(this, event);
|
eventBus.publish(this, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.eclipse.hawkbit.server.ui.common.AbstractAcceptCriteria#hideDropHints
|
|
||||||
* ()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void hideDropHints() {
|
protected void hideDropHints() {
|
||||||
eventBus.publish(this, DragEvent.HIDE_DROP_HINT);
|
eventBus.publish(this, DragEvent.HIDE_DROP_HINT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.eclipse.hawkbit.server.ui.common.AbstractAcceptCriteria#invalidDrop()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void invalidDrop() {
|
protected void invalidDrop() {
|
||||||
uiNotification.displayValidationError(SPUILabelDefinitions.ACTION_NOT_ALLOWED);
|
uiNotification.displayValidationError(SPUILabelDefinitions.ACTION_NOT_ALLOWED);
|
||||||
@@ -94,34 +73,16 @@ public class DistributionsViewAcceptCriteria extends AbstractAcceptCriteria {
|
|||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.hawkbit.server.ui.common.AbstractAcceptCriteria#
|
|
||||||
* getDropHintConfigurations()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected Map<String, Object> getDropHintConfigurations() {
|
protected Map<String, Object> getDropHintConfigurations() {
|
||||||
return DROP_HINTS_CONFIGS;
|
return DROP_HINTS_CONFIGS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.hawkbit.server.ui.common.AbstractAcceptCriteria#
|
|
||||||
* publishDragStartEvent(java.lang.Object)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void publishDragStartEvent(final Object event) {
|
protected void publishDragStartEvent(final Object event) {
|
||||||
eventBus.publish(this, event);
|
eventBus.publish(this, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.hawkbit.server.ui.common.AbstractAcceptCriteria#
|
|
||||||
* getDropConfigurations()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected Map<String, List<String>> getDropConfigurations() {
|
protected Map<String, List<String>> getDropConfigurations() {
|
||||||
return DROP_CONFIGS;
|
return DROP_CONFIGS;
|
||||||
@@ -137,7 +98,7 @@ public class DistributionsViewAcceptCriteria extends AbstractAcceptCriteria {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static Map<String, List<String>> createDropConfigurations() {
|
private static Map<String, List<String>> createDropConfigurations() {
|
||||||
final Map<String, List<String>> config = new HashMap<String, List<String>>();
|
final Map<String, List<String>> config = new HashMap<>();
|
||||||
|
|
||||||
// Delete drop area droppable components
|
// Delete drop area droppable components
|
||||||
config.put(SPUIComponetIdProvider.DELETE_BUTTON_WRAPPER_ID,
|
config.put(SPUIComponetIdProvider.DELETE_BUTTON_WRAPPER_ID,
|
||||||
@@ -153,7 +114,7 @@ public class DistributionsViewAcceptCriteria extends AbstractAcceptCriteria {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static Map<String, Object> createDropHintConfigurations() {
|
private static Map<String, Object> createDropHintConfigurations() {
|
||||||
final Map<String, Object> config = new HashMap<String, Object>();
|
final Map<String, Object> config = new HashMap<>();
|
||||||
config.put(SPUIDefinitions.DISTRIBUTION_TYPE_ID_PREFIXS, DragEvent.DISTRIBUTION_TYPE_DRAG);
|
config.put(SPUIDefinitions.DISTRIBUTION_TYPE_ID_PREFIXS, DragEvent.DISTRIBUTION_TYPE_DRAG);
|
||||||
config.put(SPUIComponetIdProvider.DIST_TABLE_ID, DragEvent.DISTRIBUTION_DRAG);
|
config.put(SPUIComponetIdProvider.DIST_TABLE_ID, DragEvent.DISTRIBUTION_DRAG);
|
||||||
config.put(SPUIComponetIdProvider.UPLOAD_SOFTWARE_MODULE_TABLE, DragEvent.SOFTWAREMODULE_DRAG);
|
config.put(SPUIComponetIdProvider.UPLOAD_SOFTWARE_MODULE_TABLE, DragEvent.SOFTWAREMODULE_DRAG);
|
||||||
|
|||||||
@@ -32,9 +32,6 @@ import com.google.common.base.Strings;
|
|||||||
/**
|
/**
|
||||||
* Simple implementation of generics bean query which dynamically loads a batch
|
* Simple implementation of generics bean query which dynamically loads a batch
|
||||||
* of beans.
|
* of beans.
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class SwModuleBeanQuery extends AbstractBeanQuery<ProxyBaseSwModuleItem> {
|
public class SwModuleBeanQuery extends AbstractBeanQuery<ProxyBaseSwModuleItem> {
|
||||||
@@ -77,17 +74,10 @@ public class SwModuleBeanQuery extends AbstractBeanQuery<ProxyBaseSwModuleItem>
|
|||||||
return new ProxyBaseSwModuleItem();
|
return new ProxyBaseSwModuleItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.vaadin.addons.lazyquerycontainer.AbstractBeanQuery#loadBeans(int,
|
|
||||||
* int)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected List<ProxyBaseSwModuleItem> loadBeans(final int startIndex, final int count) {
|
protected List<ProxyBaseSwModuleItem> loadBeans(final int startIndex, final int count) {
|
||||||
final Slice<CustomSoftwareModule> swModuleBeans;
|
final Slice<CustomSoftwareModule> swModuleBeans;
|
||||||
final List<ProxyBaseSwModuleItem> proxyBeans = new ArrayList<ProxyBaseSwModuleItem>();
|
final List<ProxyBaseSwModuleItem> proxyBeans = new ArrayList<>();
|
||||||
|
|
||||||
swModuleBeans = getSoftwareManagement().findSoftwareModuleOrderByDistribution(
|
swModuleBeans = getSoftwareManagement().findSoftwareModuleOrderByDistribution(
|
||||||
new OffsetBasedPageRequest(startIndex, count, new Sort(Direction.ASC, "name", "version")),
|
new OffsetBasedPageRequest(startIndex, count, new Sort(Direction.ASC, "name", "version")),
|
||||||
|
|||||||
@@ -39,9 +39,6 @@ import com.vaadin.ui.Window;
|
|||||||
/**
|
/**
|
||||||
* Implementation of software module details block using generic abstract
|
* Implementation of software module details block using generic abstract
|
||||||
* details style .
|
* details style .
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@SpringComponent
|
@SpringComponent
|
||||||
@ViewScope
|
@ViewScope
|
||||||
@@ -70,9 +67,7 @@ public class SwModuleDetails extends AbstractTableDetailsLayout {
|
|||||||
|
|
||||||
private SoftwareModule selectedSwModule;
|
private SoftwareModule selectedSwModule;
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* Initialize the component.
|
|
||||||
*/
|
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
protected void init() {
|
protected void init() {
|
||||||
super.init();
|
super.init();
|
||||||
@@ -133,49 +128,21 @@ public class SwModuleDetails extends AbstractTableDetailsLayout {
|
|||||||
detailsTab.addTab(createLogLayout(), i18n.get("caption.logs.tab"), null);
|
detailsTab.addTab(createLogLayout(), i18n.get("caption.logs.tab"), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.eclipse.hawkbit.server.ui.common.detailslayout.TableDetailsLayout#
|
|
||||||
* getDefaultCaption()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected String getDefaultCaption() {
|
protected String getDefaultCaption() {
|
||||||
return i18n.get("upload.swModuleTable.header");
|
return i18n.get("upload.swModuleTable.header");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.eclipse.hawkbit.server.ui.common.detailslayout.TableDetailsLayout#
|
|
||||||
* onLoadIsSwModuleSelected()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected Boolean onLoadIsTableRowSelected() {
|
protected Boolean onLoadIsTableRowSelected() {
|
||||||
return !manageDistUIState.getSelectedSoftwareModules().isEmpty();
|
return !manageDistUIState.getSelectedSoftwareModules().isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.eclipse.hawkbit.server.ui.common.detailslayout.TableDetailsLayout#
|
|
||||||
* onLoadIsTableMaximized()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected Boolean onLoadIsTableMaximized() {
|
protected Boolean onLoadIsTableMaximized() {
|
||||||
return manageDistUIState.isSwModuleTableMaximized();
|
return manageDistUIState.isSwModuleTableMaximized();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.eclipse.hawkbit.server.ui.common.detailslayout.TableDetailsLayout#
|
|
||||||
* populateDetailsWidget()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void populateDetailsWidget() {
|
protected void populateDetailsWidget() {
|
||||||
populateDetailsWidget(selectedSwModule);
|
populateDetailsWidget(selectedSwModule);
|
||||||
@@ -191,12 +158,6 @@ public class SwModuleDetails extends AbstractTableDetailsLayout {
|
|||||||
return permissionChecker.hasUpdateDistributionPermission();
|
return permissionChecker.hasUpdateDistributionPermission();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see hawkbit.server.ui.common.detailslayout.AbstractTableDetailsLayout#
|
|
||||||
* getTabSheetId()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected String getTabSheetId() {
|
protected String getTabSheetId() {
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -67,8 +67,6 @@ import com.vaadin.ui.Window;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of software module table using generic abstract table styles .
|
* Implementation of software module table using generic abstract table styles .
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@SpringComponent
|
@SpringComponent
|
||||||
@@ -98,6 +96,7 @@ public class SwModuleTable extends AbstractTable {
|
|||||||
/**
|
/**
|
||||||
* Initialize the filter layout.
|
* Initialize the filter layout.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
protected void init() {
|
protected void init() {
|
||||||
super.init();
|
super.init();
|
||||||
@@ -158,50 +157,35 @@ public class SwModuleTable extends AbstractTable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* All Override methods */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.hawkbit.server.ui.common.table.SPTable#getTableId()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected String getTableId() {
|
protected String getTableId() {
|
||||||
return SPUIComponetIdProvider.UPLOAD_SOFTWARE_MODULE_TABLE;
|
return SPUIComponetIdProvider.UPLOAD_SOFTWARE_MODULE_TABLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.hawkbit.server.ui.common.table.SPTable#createContainer()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected Container createContainer() {
|
protected Container createContainer() {
|
||||||
final Map<String, Object> queryConfiguration = new HashMap<String, Object>();
|
final Map<String, Object> queryConfiguration = prepareQueryConfigFilters();
|
||||||
manageDistUIState.getSoftwareModuleFilters().getSearchText()
|
|
||||||
.ifPresent(value -> queryConfiguration.put(SPUIDefinitions.FILTER_BY_TEXT, value));
|
|
||||||
|
|
||||||
manageDistUIState.getSoftwareModuleFilters().getSoftwareModuleType()
|
final BeanQueryFactory<SwModuleBeanQuery> swQF = new BeanQueryFactory<>(SwModuleBeanQuery.class);
|
||||||
.ifPresent(type -> queryConfiguration.put(SPUIDefinitions.BY_SOFTWARE_MODULE_TYPE, type));
|
|
||||||
|
|
||||||
manageDistUIState.getLastSelectedDistribution().ifPresent(
|
|
||||||
distIdName -> queryConfiguration.put(SPUIDefinitions.ORDER_BY_DISTRIBUTION, distIdName.getId()));
|
|
||||||
|
|
||||||
final BeanQueryFactory<SwModuleBeanQuery> swQF = new BeanQueryFactory<SwModuleBeanQuery>(
|
|
||||||
SwModuleBeanQuery.class);
|
|
||||||
swQF.setQueryConfiguration(queryConfiguration);
|
swQF.setQueryConfiguration(queryConfiguration);
|
||||||
|
|
||||||
final LazyQueryContainer container = new LazyQueryContainer(
|
return new LazyQueryContainer(new LazyQueryDefinition(true, SPUIDefinitions.PAGE_SIZE, "swId"), swQF);
|
||||||
new LazyQueryDefinition(true, SPUIDefinitions.PAGE_SIZE, "swId"), swQF);
|
}
|
||||||
return container;
|
|
||||||
|
private Map<String, Object> prepareQueryConfigFilters() {
|
||||||
|
final Map<String, Object> queryConfig = new HashMap<>();
|
||||||
|
manageDistUIState.getSoftwareModuleFilters().getSearchText()
|
||||||
|
.ifPresent(value -> queryConfig.put(SPUIDefinitions.FILTER_BY_TEXT, value));
|
||||||
|
|
||||||
|
manageDistUIState.getSoftwareModuleFilters().getSoftwareModuleType()
|
||||||
|
.ifPresent(type -> queryConfig.put(SPUIDefinitions.BY_SOFTWARE_MODULE_TYPE, type));
|
||||||
|
|
||||||
|
manageDistUIState.getLastSelectedDistribution()
|
||||||
|
.ifPresent(distIdName -> queryConfig.put(SPUIDefinitions.ORDER_BY_DISTRIBUTION, distIdName.getId()));
|
||||||
|
|
||||||
|
return queryConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see hawkbit.server.ui.common.table.SPTable#addContainerProperties(com.
|
|
||||||
* vaadin.data.Container)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void addContainerProperties(final Container container) {
|
protected void addContainerProperties(final Container container) {
|
||||||
final LazyQueryContainer lazyContainer = (LazyQueryContainer) container;
|
final LazyQueryContainer lazyContainer = (LazyQueryContainer) container;
|
||||||
@@ -220,11 +204,6 @@ public class SwModuleTable extends AbstractTable {
|
|||||||
lazyContainer.addContainerProperty(SPUILabelDefinitions.VAR_SOFT_TYPE_ID, Long.class, null, false, true);
|
lazyContainer.addContainerProperty(SPUILabelDefinitions.VAR_SOFT_TYPE_ID, Long.class, null, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see hawkbit.server.ui.common.table.SPTable#addCustomGeneratedColumns()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void addCustomGeneratedColumns() {
|
protected void addCustomGeneratedColumns() {
|
||||||
|
|
||||||
@@ -243,32 +222,16 @@ public class SwModuleTable extends AbstractTable {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see hawkbit.server.ui.common.table.SPTable#isFirstRowSelectedOnLoad()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean isFirstRowSelectedOnLoad() {
|
protected boolean isFirstRowSelectedOnLoad() {
|
||||||
return manageDistUIState.getSelectedSoftwareModules().isEmpty();
|
return manageDistUIState.getSelectedSoftwareModules().isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.eclipse.hawkbit.server.ui.common.table.SPTable#getItemIdToSelect()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected Object getItemIdToSelect() {
|
protected Object getItemIdToSelect() {
|
||||||
return manageDistUIState.getSelectedSoftwareModules();
|
return manageDistUIState.getSelectedSoftwareModules();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.hawkbit.server.ui.common.table.SPTable#isMaximized()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean isMaximized() {
|
protected boolean isMaximized() {
|
||||||
return manageDistUIState.isSwModuleTableMaximized();
|
return manageDistUIState.isSwModuleTableMaximized();
|
||||||
@@ -300,16 +263,9 @@ public class SwModuleTable extends AbstractTable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.eclipse.hawkbit.server.ui.common.table.SPTable#getTableVisibleColumns
|
|
||||||
* ()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected List<TableColumn> getTableVisibleColumns() {
|
protected List<TableColumn> getTableVisibleColumns() {
|
||||||
final List<TableColumn> columnList = new ArrayList<TableColumn>();
|
final List<TableColumn> columnList = new ArrayList<>();
|
||||||
if (isMaximized()) {
|
if (isMaximized()) {
|
||||||
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_NAME, i18n.get("header.name"), 0.2F));
|
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_NAME, i18n.get("header.name"), 0.2F));
|
||||||
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_VERSION, i18n.get("header.version"), 0.1F));
|
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_VERSION, i18n.get("header.version"), 0.1F));
|
||||||
@@ -364,11 +320,6 @@ public class SwModuleTable extends AbstractTable {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param color
|
|
||||||
* @param isAssigned
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private String getTableStyle(final Long typeId, final boolean isAssigned, final String color) {
|
private String getTableStyle(final Long typeId, final boolean isAssigned, final String color) {
|
||||||
if (isAssigned) {
|
if (isAssigned) {
|
||||||
addTypeStyle(typeId, color);
|
addTypeStyle(typeId, color);
|
||||||
@@ -385,11 +336,6 @@ public class SwModuleTable extends AbstractTable {
|
|||||||
+ "{background-color:" + color + " !important;background-image:none !important }")));
|
+ "{background-color:" + color + " !important;background-image:none !important }")));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param itemId
|
|
||||||
* @param propertyId
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private String createTableStyle(final Object itemId, final Object propertyId) {
|
private String createTableStyle(final Object itemId, final Object propertyId) {
|
||||||
if (null == propertyId) {
|
if (null == propertyId) {
|
||||||
final Item item = getItem(itemId);
|
final Item item = getItem(itemId);
|
||||||
@@ -423,12 +369,6 @@ public class SwModuleTable extends AbstractTable {
|
|||||||
return name + "." + version;
|
return name + "." + version;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Add new software module to table.
|
|
||||||
*
|
|
||||||
* @param swModule
|
|
||||||
* new software module
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
private void addSoftwareModule(final SoftwareModule swModule) {
|
private void addSoftwareModule(final SoftwareModule swModule) {
|
||||||
final Object addItem = addItem();
|
final Object addItem = addItem();
|
||||||
@@ -455,11 +395,6 @@ public class SwModuleTable extends AbstractTable {
|
|||||||
select(swModule.getId());
|
select(swModule.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param itemId
|
|
||||||
* @param nameVersionStr
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private void showArtifactDetailsWindow(final Long itemId, final String nameVersionStr) {
|
private void showArtifactDetailsWindow(final Long itemId, final String nameVersionStr) {
|
||||||
final Window atrifactDtlsWindow = new Window();
|
final Window atrifactDtlsWindow = new Window();
|
||||||
atrifactDtlsWindow.setCaption(HawkbitCommonUtil.getArtifactoryDetailsLabelId(nameVersionStr));
|
atrifactDtlsWindow.setCaption(HawkbitCommonUtil.getArtifactoryDetailsLabelId(nameVersionStr));
|
||||||
|
|||||||
@@ -36,9 +36,6 @@ import com.vaadin.ui.Window;
|
|||||||
/**
|
/**
|
||||||
* Implementation of software module Header block using generic abstract details
|
* Implementation of software module Header block using generic abstract details
|
||||||
* style .
|
* style .
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@SpringComponent
|
@SpringComponent
|
||||||
@ViewScope
|
@ViewScope
|
||||||
@@ -61,9 +58,7 @@ public class SwModuleTableHeader extends AbstractTableHeader {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private SoftwareModuleAddUpdateWindow softwareModuleAddUpdateWindow;
|
private SoftwareModuleAddUpdateWindow softwareModuleAddUpdateWindow;
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* Initialize the components.
|
|
||||||
*/
|
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
protected void init() {
|
protected void init() {
|
||||||
super.init();
|
super.init();
|
||||||
@@ -82,45 +77,21 @@ public class SwModuleTableHeader extends AbstractTableHeader {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.eclipse.hawkbit.server.ui.common.table.SPTableHeader#getHeaderCaption
|
|
||||||
* ()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected String getHeaderCaption() {
|
protected String getHeaderCaption() {
|
||||||
return i18n.get("upload.swModuleTable.header");
|
return i18n.get("upload.swModuleTable.header");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.eclipse.hawkbit.server.ui.common.table.SPTableHeader#getSearchBoxId()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected String getSearchBoxId() {
|
protected String getSearchBoxId() {
|
||||||
return SPUIComponetIdProvider.SW_MODULE_SEARCH_TEXT_FIELD;
|
return SPUIComponetIdProvider.SW_MODULE_SEARCH_TEXT_FIELD;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see hawkbit.server.ui.common.table.SPTableHeader#getSearchRestIconId()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected String getSearchRestIconId() {
|
protected String getSearchRestIconId() {
|
||||||
return SPUIComponetIdProvider.SW_MODULE_SEARCH_RESET_ICON;
|
return SPUIComponetIdProvider.SW_MODULE_SEARCH_RESET_ICON;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.eclipse.hawkbit.server.ui.common.table.SPTableHeader#getAddIconId()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected String getAddIconId() {
|
protected String getAddIconId() {
|
||||||
return SPUIComponetIdProvider.SW_MODULE_ADD_BUTTON;
|
return SPUIComponetIdProvider.SW_MODULE_ADD_BUTTON;
|
||||||
@@ -134,97 +105,47 @@ public class SwModuleTableHeader extends AbstractTableHeader {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.eclipse.hawkbit.server.ui.common.table.SPTableHeader#getDropFilterId(
|
|
||||||
* )
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected String getDropFilterId() {
|
protected String getDropFilterId() {
|
||||||
/* not required */
|
/* not required */
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.hawkbit.server.ui.common.table.AbstractTableHeader#
|
|
||||||
* isDropHintRequired()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean isDropHintRequired() {
|
protected boolean isDropHintRequired() {
|
||||||
/* not required */
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see hawkbit.server.ui.common.table.SPTableHeader#isDropFilterRequired()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean isDropFilterRequired() {
|
protected boolean isDropFilterRequired() {
|
||||||
/* Not Yet Implemented */
|
/* Not Yet Implemented */
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.hawkbit.server.ui.common.table.SPTableHeader#
|
|
||||||
* getShowFilterButtonLayoutId()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected String getShowFilterButtonLayoutId() {
|
protected String getShowFilterButtonLayoutId() {
|
||||||
return "show.type.icon";
|
return "show.type.icon";
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see hawkbit.server.ui.common.table.SPTableHeader#showFilterButtonsLayout
|
|
||||||
* ()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void showFilterButtonsLayout() {
|
protected void showFilterButtonsLayout() {
|
||||||
manageDistUIState.setSwTypeFilterClosed(false);
|
manageDistUIState.setSwTypeFilterClosed(false);
|
||||||
eventbus.publish(this, DistributionsUIEvent.SHOW_SM_FILTER_BY_TYPE);
|
eventbus.publish(this, DistributionsUIEvent.SHOW_SM_FILTER_BY_TYPE);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.eclipse.hawkbit.server.ui.common.table.SPTableHeader#resetSearchText(
|
|
||||||
* )
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void resetSearchText() {
|
protected void resetSearchText() {
|
||||||
manageDistUIState.getSoftwareModuleFilters().setSearchText(null);
|
if (manageDistUIState.getSoftwareModuleFilters().getSearchText().isPresent()) {
|
||||||
eventbus.publish(this, SMFilterEvent.REMOVER_FILTER_BY_TEXT);
|
manageDistUIState.getSoftwareModuleFilters().setSearchText(null);
|
||||||
|
eventbus.publish(this, SMFilterEvent.REMOVER_FILTER_BY_TEXT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.eclipse.hawkbit.server.ui.common.table.SPTableHeader#getMaxMinIconId(
|
|
||||||
* )
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected String getMaxMinIconId() {
|
protected String getMaxMinIconId() {
|
||||||
return SPUIComponetIdProvider.SW_MAX_MIN_TABLE_ICON;
|
return SPUIComponetIdProvider.SW_MAX_MIN_TABLE_ICON;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.eclipse.hawkbit.server.ui.common.table.SPTableHeader#maximizeTable()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void maximizeTable() {
|
public void maximizeTable() {
|
||||||
manageDistUIState.setSwModuleTableMaximized(Boolean.TRUE);
|
manageDistUIState.setSwModuleTableMaximized(Boolean.TRUE);
|
||||||
@@ -232,58 +153,28 @@ public class SwModuleTableHeader extends AbstractTableHeader {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.eclipse.hawkbit.server.ui.common.table.SPTableHeader#minimizeTable()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void minimizeTable() {
|
public void minimizeTable() {
|
||||||
manageDistUIState.setSwModuleTableMaximized(Boolean.FALSE);
|
manageDistUIState.setSwModuleTableMaximized(Boolean.FALSE);
|
||||||
eventbus.publish(this, new SoftwareModuleEvent(SoftwareModuleEventType.MINIMIZED, null));
|
eventbus.publish(this, new SoftwareModuleEvent(SoftwareModuleEventType.MINIMIZED, null));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see hawkbit.server.ui.common.table.SPTableHeader#onLoadIsTableMaximized(
|
|
||||||
* )
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean onLoadIsTableMaximized() {
|
public Boolean onLoadIsTableMaximized() {
|
||||||
return manageDistUIState.isSwModuleTableMaximized();
|
return manageDistUIState.isSwModuleTableMaximized();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.hawkbit.server.ui.common.table.SPTableHeader#
|
|
||||||
* onLoadIsShowFilterButtonDisplayed()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean onLoadIsShowFilterButtonDisplayed() {
|
public Boolean onLoadIsShowFilterButtonDisplayed() {
|
||||||
return manageDistUIState.isSwTypeFilterClosed();
|
return manageDistUIState.isSwTypeFilterClosed();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see hawkbit.server.ui.common.table.SPTableHeader#searchBy(java.lang.
|
|
||||||
* String)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void searchBy(final String newSearchText) {
|
protected void searchBy(final String newSearchText) {
|
||||||
manageDistUIState.getSoftwareModuleFilters().setSearchText(newSearchText);
|
manageDistUIState.getSoftwareModuleFilters().setSearchText(newSearchText);
|
||||||
eventbus.publish(this, SMFilterEvent.FILTER_BY_TEXT);
|
eventbus.publish(this, SMFilterEvent.FILTER_BY_TEXT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see hawkbit.server.ui.common.table.SPTableHeader#addNewItem(com.vaadin.
|
|
||||||
* ui.Button.ClickEvent)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void addNewItem(final ClickEvent event) {
|
protected void addNewItem(final ClickEvent event) {
|
||||||
final Window addSoftwareModule = softwareModuleAddUpdateWindow.createAddSoftwareModuleWindow();
|
final Window addSoftwareModule = softwareModuleAddUpdateWindow.createAddSoftwareModuleWindow();
|
||||||
@@ -292,22 +183,11 @@ public class SwModuleTableHeader extends AbstractTableHeader {
|
|||||||
addSoftwareModule.setVisible(Boolean.TRUE);
|
addSoftwareModule.setVisible(Boolean.TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see hawkbit.server.ui.common.table.SPTableHeader#hasCreatePermission()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean hasCreatePermission() {
|
protected boolean hasCreatePermission() {
|
||||||
return permChecker.hasCreateDistributionPermission();
|
return permChecker.hasCreateDistributionPermission();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.hawkbit.server.ui.common.table.AbstractTableHeader#
|
|
||||||
* isAddNewItemAllowed()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected Boolean isAddNewItemAllowed() {
|
protected Boolean isAddNewItemAllowed() {
|
||||||
return true;
|
return true;
|
||||||
@@ -328,47 +208,21 @@ public class SwModuleTableHeader extends AbstractTableHeader {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.hawkbit.server.ui.common.table.AbstractTableHeader#
|
|
||||||
* getBulkUploadIconId()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected String getBulkUploadIconId() {
|
protected String getBulkUploadIconId() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see hawkbit.server.ui.common.table.AbstractTableHeader#bulkUpload(com.
|
|
||||||
* vaadin.ui.Button.ClickEvent )
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void bulkUpload(final ClickEvent event) {
|
protected void bulkUpload(final ClickEvent event) {
|
||||||
/**
|
// No implementation as no bulk upload is supported.
|
||||||
* No implementation as no bulk upload is supported.
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.hawkbit.server.ui.common.table.AbstractTableHeader#
|
|
||||||
* isBulkUploadAllowed()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected Boolean isBulkUploadAllowed() {
|
protected Boolean isBulkUploadAllowed() {
|
||||||
return Boolean.FALSE;
|
return Boolean.FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.hawkbit.ui.common.table.AbstractTableHeader#
|
|
||||||
* isBulkUploadInProgress()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean isBulkUploadInProgress() {
|
protected boolean isBulkUploadInProgress() {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -40,8 +40,6 @@ import com.vaadin.spring.annotation.ViewScope;
|
|||||||
/**
|
/**
|
||||||
* Software Module Type filter buttons.
|
* Software Module Type filter buttons.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@SpringComponent
|
@SpringComponent
|
||||||
@ViewScope
|
@ViewScope
|
||||||
@@ -58,46 +56,24 @@ public class DistSMTypeFilterButtons extends AbstractFilterButtons {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private DistributionsViewAcceptCriteria distributionsViewAcceptCriteria;
|
private DistributionsViewAcceptCriteria distributionsViewAcceptCriteria;
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* Initialize component.
|
|
||||||
*
|
|
||||||
* @param filterButtonClickBehaviour
|
|
||||||
* the clickable behaviour.
|
|
||||||
*/
|
|
||||||
public void init(final AbstractFilterButtonClickBehaviour filterButtonClickBehaviour) {
|
public void init(final AbstractFilterButtonClickBehaviour filterButtonClickBehaviour) {
|
||||||
super.init(filterButtonClickBehaviour);
|
super.init(filterButtonClickBehaviour);
|
||||||
eventBus.subscribe(this);
|
eventBus.subscribe(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterButtons#
|
|
||||||
* getButtonsTableId()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected String getButtonsTableId() {
|
protected String getButtonsTableId() {
|
||||||
|
|
||||||
return SPUIComponetIdProvider.SW_MODULE_TYPE_TABLE_ID;
|
return SPUIComponetIdProvider.SW_MODULE_TYPE_TABLE_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterButtons#
|
|
||||||
* createButtonsLazyQueryContainer ()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected LazyQueryContainer createButtonsLazyQueryContainer() {
|
protected LazyQueryContainer createButtonsLazyQueryContainer() {
|
||||||
final Map<String, Object> queryConfig = new HashMap<String, Object>();
|
final Map<String, Object> queryConfig = new HashMap<>();
|
||||||
final BeanQueryFactory<SoftwareModuleTypeBeanQuery> typeQF = new BeanQueryFactory<SoftwareModuleTypeBeanQuery>(
|
final BeanQueryFactory<SoftwareModuleTypeBeanQuery> typeQF = new BeanQueryFactory<>(
|
||||||
SoftwareModuleTypeBeanQuery.class);
|
SoftwareModuleTypeBeanQuery.class);
|
||||||
typeQF.setQueryConfiguration(queryConfig);
|
typeQF.setQueryConfiguration(queryConfig);
|
||||||
final LazyQueryContainer lazyQueryContainer = new LazyQueryContainer(
|
return new LazyQueryContainer(new LazyQueryDefinition(true, 20, SPUILabelDefinitions.VAR_NAME), typeQF);
|
||||||
new LazyQueryDefinition(true, 20, SPUILabelDefinitions.VAR_NAME), typeQF);
|
|
||||||
return lazyQueryContainer;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -105,13 +81,6 @@ public class DistSMTypeFilterButtons extends AbstractFilterButtons {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterButtons#
|
|
||||||
* isClickedByDefault(java.lang .Long)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean isClickedByDefault(final Long buttonId) {
|
protected boolean isClickedByDefault(final Long buttonId) {
|
||||||
|
|
||||||
@@ -119,25 +88,11 @@ public class DistSMTypeFilterButtons extends AbstractFilterButtons {
|
|||||||
&& manageDistUIState.getSoftwareModuleFilters().getSoftwareModuleType().get().getId().equals(buttonId);
|
&& manageDistUIState.getSoftwareModuleFilters().getSoftwareModuleType().get().getId().equals(buttonId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterButtons#
|
|
||||||
* createButtonId(java.lang. String)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected String createButtonId(final String name) {
|
protected String createButtonId(final String name) {
|
||||||
return SPUIComponetIdProvider.SM_TYPE_FILTER_BTN_ID + name;
|
return SPUIComponetIdProvider.SM_TYPE_FILTER_BTN_ID + name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterButtons#
|
|
||||||
* getFilterButtonDropHandler()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected DropHandler getFilterButtonDropHandler() {
|
protected DropHandler getFilterButtonDropHandler() {
|
||||||
|
|
||||||
@@ -156,16 +111,8 @@ public class DistSMTypeFilterButtons extends AbstractFilterButtons {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterButtons#
|
|
||||||
* getButttonWrapperId()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected String getButttonWrapperIdPrefix() {
|
protected String getButttonWrapperIdPrefix() {
|
||||||
|
|
||||||
return SPUIDefinitions.SOFTWARE_MODULE_TAG_ID_PREFIXS;
|
return SPUIDefinitions.SOFTWARE_MODULE_TAG_ID_PREFIXS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,9 +29,6 @@ import com.vaadin.ui.Window;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Software Module Type filter buttons header.
|
* Software Module Type filter buttons header.
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@SpringComponent
|
@SpringComponent
|
||||||
@ViewScope
|
@ViewScope
|
||||||
@@ -51,9 +48,7 @@ public class DistSMTypeFilterHeader extends AbstractFilterHeader {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private CreateUpdateSoftwareTypeLayout createUpdateSWTypeLayout;
|
private CreateUpdateSoftwareTypeLayout createUpdateSWTypeLayout;
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* Initialize the components.
|
|
||||||
*/
|
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void init() {
|
public void init() {
|
||||||
super.init();
|
super.init();
|
||||||
@@ -62,50 +57,21 @@ public class DistSMTypeFilterHeader extends AbstractFilterHeader {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterHeader#
|
|
||||||
* getHideButtonId()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected String getHideButtonId() {
|
protected String getHideButtonId() {
|
||||||
return SPUIComponetIdProvider.SM_SHOW_FILTER_BUTTON_ID;
|
return SPUIComponetIdProvider.SM_SHOW_FILTER_BUTTON_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterHeader#
|
|
||||||
* hasCreateUpdatePermission()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean hasCreateUpdatePermission() {
|
protected boolean hasCreateUpdatePermission() {
|
||||||
|
|
||||||
return permChecker.hasCreateDistributionPermission() || permChecker.hasUpdateDistributionPermission();
|
return permChecker.hasCreateDistributionPermission() || permChecker.hasUpdateDistributionPermission();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see hawkbit.server.ui.common.filterlayout.AbstractFilterHeader#getTitle(
|
|
||||||
* )
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected String getTitle() {
|
protected String getTitle() {
|
||||||
|
|
||||||
return SPUILabelDefinitions.TYPE;
|
return SPUILabelDefinitions.TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterHeader#
|
|
||||||
* settingsIconClicked(com.vaadin .ui.Button.ClickEvent)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void settingsIconClicked(final ClickEvent event) {
|
protected void settingsIconClicked(final ClickEvent event) {
|
||||||
final Window addUpdateWindow = createUpdateSWTypeLayout.getWindow();
|
final Window addUpdateWindow = createUpdateSWTypeLayout.getWindow();
|
||||||
@@ -114,51 +80,22 @@ public class DistSMTypeFilterHeader extends AbstractFilterHeader {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterHeader#
|
|
||||||
* dropHitsRequired()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean dropHitsRequired() {
|
protected boolean dropHitsRequired() {
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterHeader#
|
|
||||||
* hideFilterButtonLayout()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void hideFilterButtonLayout() {
|
protected void hideFilterButtonLayout() {
|
||||||
manageDistUIState.setSwTypeFilterClosed(true);
|
manageDistUIState.setSwTypeFilterClosed(true);
|
||||||
eventBus.publish(this, DistributionsUIEvent.HIDE_SM_FILTER_BY_TYPE);
|
eventBus.publish(this, DistributionsUIEvent.HIDE_SM_FILTER_BY_TYPE);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterHeader#
|
|
||||||
* getConfigureFilterButtonId()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected String getConfigureFilterButtonId() {
|
protected String getConfigureFilterButtonId() {
|
||||||
return SPUIDefinitions.ADD_SOFTWARE_MODULE_TYPE;
|
return SPUIDefinitions.ADD_SOFTWARE_MODULE_TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.hawkbit.ui.common.filterlayout.AbstractFilterHeader#
|
|
||||||
* isAddTagRequired()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean isAddTagRequired() {
|
protected boolean isAddTagRequired() {
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -20,8 +20,6 @@ import com.vaadin.spring.annotation.VaadinSessionScope;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Distribution table filter state.
|
* Distribution table filter state.
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@SpringComponent
|
@SpringComponent
|
||||||
@VaadinSessionScope
|
@VaadinSessionScope
|
||||||
@@ -31,9 +29,9 @@ public class ManageDistFilters implements Serializable {
|
|||||||
|
|
||||||
private String searchText;
|
private String searchText;
|
||||||
|
|
||||||
private List<String> distSetTags = new ArrayList<String>();
|
private List<String> distSetTags = new ArrayList<>();
|
||||||
|
|
||||||
private List<String> clickedDistSetTags = new ArrayList<String>();
|
private List<String> clickedDistSetTags = new ArrayList<>();
|
||||||
|
|
||||||
private DistributionSetType clickedDistSetType;
|
private DistributionSetType clickedDistSetType;
|
||||||
|
|
||||||
@@ -61,17 +59,10 @@ public class ManageDistFilters implements Serializable {
|
|||||||
this.clickedDistSetTags = clickedDistSetTags;
|
this.clickedDistSetTags = clickedDistSetTags;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the searchText
|
|
||||||
*/
|
|
||||||
public Optional<String> getSearchText() {
|
public Optional<String> getSearchText() {
|
||||||
return searchText == null ? Optional.empty() : Optional.of(searchText);
|
return searchText == null ? Optional.empty() : Optional.of(searchText);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param searchText
|
|
||||||
* the searchText to set
|
|
||||||
*/
|
|
||||||
public void setSearchText(final String searchText) {
|
public void setSearchText(final String searchText) {
|
||||||
this.searchText = searchText;
|
this.searchText = searchText;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
@@ -123,7 +121,7 @@ public class CreateOrUpdateFilterHeader extends VerticalLayout implements Button
|
|||||||
private LayoutClickListener nameLayoutClickListner;
|
private LayoutClickListener nameLayoutClickListner;
|
||||||
|
|
||||||
private boolean validationFailed = false;
|
private boolean validationFailed = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the Campaign Status History Header.
|
* Initialize the Campaign Status History Header.
|
||||||
*/
|
*/
|
||||||
@@ -149,20 +147,18 @@ 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()) {
|
||||||
queryTextField.setValue(filterManagementUIState.getTfQuery().get().getQuery());
|
queryTextField.setValue(filterManagementUIState.getTfQuery().get().getQuery());
|
||||||
@@ -220,8 +216,7 @@ 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -513,12 +512,12 @@ 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) {
|
||||||
@@ -241,9 +239,9 @@ public class CreateOrUpdateFilterTable extends Table {
|
|||||||
protected void addCustomGeneratedColumns() {
|
protected void addCustomGeneratedColumns() {
|
||||||
addGeneratedColumn(SPUILabelDefinitions.STATUS_ICON, (source, itemId, columnId) -> getStatusIcon(itemId));
|
addGeneratedColumn(SPUILabelDefinitions.STATUS_ICON, (source, itemId, columnId) -> getStatusIcon(itemId));
|
||||||
}
|
}
|
||||||
|
|
||||||
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;
|
||||||
|
|||||||
@@ -34,7 +34,6 @@ import com.google.common.base.Strings;
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class TargetFilterBeanQuery extends AbstractBeanQuery<ProxyTargetFilter> {
|
public class TargetFilterBeanQuery extends AbstractBeanQuery<ProxyTargetFilter> {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1845964596238990987L;
|
private static final long serialVersionUID = 1845964596238990987L;
|
||||||
@@ -76,8 +75,8 @@ public class TargetFilterBeanQuery extends AbstractBeanQuery<ProxyTargetFilter>
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected List<ProxyTargetFilter> loadBeans(final int startIndex, final int count) {
|
protected List<ProxyTargetFilter> loadBeans(final int startIndex, final int count) {
|
||||||
Slice<TargetFilterQuery> targetFilterQuery = null;
|
Slice<TargetFilterQuery> targetFilterQuery;
|
||||||
final List<ProxyTargetFilter> proxyTargetFilter = new ArrayList<ProxyTargetFilter>();
|
final List<ProxyTargetFilter> proxyTargetFilter = new ArrayList<>();
|
||||||
if (startIndex == 0 && firstPageTargetFilter != null) {
|
if (startIndex == 0 && firstPageTargetFilter != null) {
|
||||||
targetFilterQuery = firstPageTargetFilter;
|
targetFilterQuery = firstPageTargetFilter;
|
||||||
} else if (Strings.isNullOrEmpty(searchText)) {
|
} else if (Strings.isNullOrEmpty(searchText)) {
|
||||||
|
|||||||
@@ -41,7 +41,6 @@ import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
|||||||
import com.vaadin.data.Container;
|
import com.vaadin.data.Container;
|
||||||
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.spring.annotation.SpringComponent;
|
import com.vaadin.spring.annotation.SpringComponent;
|
||||||
import com.vaadin.spring.annotation.ViewScope;
|
import com.vaadin.spring.annotation.ViewScope;
|
||||||
import com.vaadin.ui.Button;
|
import com.vaadin.ui.Button;
|
||||||
@@ -84,20 +83,20 @@ public class TargetFilterTable extends Table {
|
|||||||
* Initialize the Action History Table.
|
* Initialize the Action History Table.
|
||||||
*/
|
*/
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void init() {
|
public void init() {
|
||||||
setStyleName("sp-table");
|
setStyleName("sp-table");
|
||||||
setSizeFull();
|
setSizeFull();
|
||||||
setImmediate(true);
|
setImmediate(true);
|
||||||
setHeight(100.0f, Unit.PERCENTAGE);
|
setHeight(100.0f, Unit.PERCENTAGE);
|
||||||
addStyleName(ValoTheme.TABLE_NO_VERTICAL_LINES);
|
addStyleName(ValoTheme.TABLE_NO_VERTICAL_LINES);
|
||||||
addStyleName(ValoTheme.TABLE_SMALL);
|
addStyleName(ValoTheme.TABLE_SMALL);
|
||||||
addCustomGeneratedColumns();
|
addCustomGeneratedColumns();
|
||||||
populateTableData();
|
populateTableData();
|
||||||
setColumnCollapsingAllowed(true);
|
setColumnCollapsingAllowed(true);
|
||||||
setColumnProperties();
|
setColumnProperties();
|
||||||
setId(SPUIComponetIdProvider.TAEGET_FILTER_TABLE_ID);
|
setId(SPUIComponetIdProvider.TAEGET_FILTER_TABLE_ID);
|
||||||
eventBus.subscribe(this);
|
eventBus.subscribe(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PreDestroy
|
@PreDestroy
|
||||||
void destroy() {
|
void destroy() {
|
||||||
@@ -114,20 +113,14 @@ public class TargetFilterTable extends Table {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a empty HierarchicalContainer.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
private Container createContainer() {
|
private Container createContainer() {
|
||||||
final Map<String, Object> queryConfig = prepareQueryConfigFilters();
|
final Map<String, Object> queryConfig = prepareQueryConfigFilters();
|
||||||
final BeanQueryFactory<TargetFilterBeanQuery> targetQF = new BeanQueryFactory<TargetFilterBeanQuery>(
|
final BeanQueryFactory<TargetFilterBeanQuery> targetQF = new BeanQueryFactory<>(TargetFilterBeanQuery.class);
|
||||||
TargetFilterBeanQuery.class);
|
|
||||||
|
|
||||||
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 targetFilterContainer = new LazyQueryContainer(new LazyQueryDefinition(true,
|
final LazyQueryContainer targetFilterContainer = new LazyQueryContainer(
|
||||||
SPUIDefinitions.PAGE_SIZE, SPUILabelDefinitions.VAR_ID), targetQF);
|
new LazyQueryDefinition(true, SPUIDefinitions.PAGE_SIZE, SPUILabelDefinitions.VAR_ID), targetQF);
|
||||||
targetFilterContainer.getQueryView().getQueryDefinition().setMaxNestedPropertyDepth(PROPERTY_DEPT);
|
targetFilterContainer.getQueryView().getQueryDefinition().setMaxNestedPropertyDepth(PROPERTY_DEPT);
|
||||||
|
|
||||||
return targetFilterContainer;
|
return targetFilterContainer;
|
||||||
@@ -135,15 +128,12 @@ public class TargetFilterTable extends Table {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Map<String, Object> prepareQueryConfigFilters() {
|
private Map<String, Object> prepareQueryConfigFilters() {
|
||||||
final Map<String, Object> queryConfig = new HashMap<String, Object>();
|
final Map<String, Object> queryConfig = new HashMap<>();
|
||||||
filterManagementUIState.getCustomFilterSearchText().ifPresent(
|
filterManagementUIState.getCustomFilterSearchText()
|
||||||
value -> queryConfig.put(SPUIDefinitions.FILTER_BY_TEXT, value));
|
.ifPresent(value -> queryConfig.put(SPUIDefinitions.FILTER_BY_TEXT, value));
|
||||||
return queryConfig;
|
return queryConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a empty HierarchicalContainer.
|
|
||||||
*/
|
|
||||||
private void addContainerproperties() {
|
private void addContainerproperties() {
|
||||||
/* Create HierarchicalContainer container */
|
/* Create HierarchicalContainer container */
|
||||||
container.addContainerProperty(SPUILabelDefinitions.NAME, Link.class, null);
|
container.addContainerProperty(SPUILabelDefinitions.NAME, Link.class, null);
|
||||||
@@ -154,7 +144,7 @@ public class TargetFilterTable extends Table {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private List<TableColumn> getVisbleColumns() {
|
private List<TableColumn> getVisbleColumns() {
|
||||||
final List<TableColumn> columnList = new ArrayList<TableColumn>();
|
final List<TableColumn> columnList = new ArrayList<>();
|
||||||
columnList.add(new TableColumn(SPUILabelDefinitions.NAME, i18n.get("header.name"), 0.2F));
|
columnList.add(new TableColumn(SPUILabelDefinitions.NAME, i18n.get("header.name"), 0.2F));
|
||||||
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_CREATED_USER, i18n.get("header.createdBy"), 0.15F));
|
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_CREATED_USER, i18n.get("header.createdBy"), 0.15F));
|
||||||
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_CREATED_DATE, i18n.get("header.createdDate"), 0.2F));
|
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_CREATED_DATE, i18n.get("header.createdDate"), 0.2F));
|
||||||
@@ -165,7 +155,6 @@ public class TargetFilterTable extends Table {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* re -create the container and get the data and set it to the table */
|
|
||||||
private void refreshContainer() {
|
private void refreshContainer() {
|
||||||
populateTableData();
|
populateTableData();
|
||||||
|
|
||||||
@@ -187,10 +176,6 @@ public class TargetFilterTable extends Table {
|
|||||||
.toString();
|
.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param event
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private void onDelete(final ClickEvent event) {
|
private void onDelete(final ClickEvent event) {
|
||||||
/* Display the confirmation */
|
/* Display the confirmation */
|
||||||
final ConfirmationDialog confirmDialog = new ConfirmationDialog(i18n.get("caption.filter.delete.confirmbox"),
|
final ConfirmationDialog confirmDialog = new ConfirmationDialog(i18n.get("caption.filter.delete.confirmbox"),
|
||||||
@@ -206,8 +191,8 @@ public class TargetFilterTable extends Table {
|
|||||||
* of the deleted custom filter.
|
* of the deleted custom filter.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
notification.displaySuccess(i18n.get("message.delete.filter.success",
|
notification.displaySuccess(
|
||||||
new Object[] { deletedFilterName }));
|
i18n.get("message.delete.filter.success", new Object[] { deletedFilterName }));
|
||||||
refreshContainer();
|
refreshContainer();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -236,10 +221,6 @@ public class TargetFilterTable extends Table {
|
|||||||
return updateIcon;
|
return updateIcon;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param event
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private void onClickOfDetailButton(final ClickEvent event) {
|
private void onClickOfDetailButton(final ClickEvent event) {
|
||||||
final String targetFilterName = (String) ((Button) event.getComponent()).getData();
|
final String targetFilterName = (String) ((Button) event.getComponent()).getData();
|
||||||
final TargetFilterQuery targetFilterQuery = targetFilterQueryManagement
|
final TargetFilterQuery targetFilterQuery = targetFilterQueryManagement
|
||||||
|
|||||||
@@ -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) {
|
||||||
|
|||||||
@@ -202,16 +202,8 @@ public class ActionHistoryTable extends TreeTable implements Handler {
|
|||||||
hierarchicalContainer.addContainerProperty(SPUIDefinitions.ACTION_HIS_TBL_ROLLOUT_NAME, String.class, null);
|
hierarchicalContainer.addContainerProperty(SPUIDefinitions.ACTION_HIS_TBL_ROLLOUT_NAME, String.class, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get Action based on status.
|
|
||||||
*
|
|
||||||
* @param type
|
|
||||||
* as Action.Type
|
|
||||||
*
|
|
||||||
* @return List of Actions
|
|
||||||
*/
|
|
||||||
private List<Object> getVisbleColumns() {
|
private List<Object> getVisbleColumns() {
|
||||||
final List<Object> visibleColumnIds = new ArrayList<Object>();
|
final List<Object> visibleColumnIds = new ArrayList<>();
|
||||||
visibleColumnIds.add(SPUIDefinitions.ACTION_HIS_TBL_ACTIVE);
|
visibleColumnIds.add(SPUIDefinitions.ACTION_HIS_TBL_ACTIVE);
|
||||||
visibleColumnIds.add(SPUIDefinitions.ACTION_HIS_TBL_DIST);
|
visibleColumnIds.add(SPUIDefinitions.ACTION_HIS_TBL_DIST);
|
||||||
visibleColumnIds.add(SPUIDefinitions.ACTION_HIS_TBL_DATETIME);
|
visibleColumnIds.add(SPUIDefinitions.ACTION_HIS_TBL_DATETIME);
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ public class DistributionBeanQuery extends AbstractBeanQuery<ProxyDistribution>
|
|||||||
@Override
|
@Override
|
||||||
protected List<ProxyDistribution> loadBeans(final int startIndex, final int count) {
|
protected List<ProxyDistribution> loadBeans(final int startIndex, final int count) {
|
||||||
Page<DistributionSet> distBeans;
|
Page<DistributionSet> distBeans;
|
||||||
final List<ProxyDistribution> proxyDistributions = new ArrayList<ProxyDistribution>();
|
final List<ProxyDistribution> proxyDistributions = new ArrayList<>();
|
||||||
if (startIndex == 0 && firstPageDistributionSets != null) {
|
if (startIndex == 0 && firstPageDistributionSets != null) {
|
||||||
distBeans = firstPageDistributionSets;
|
distBeans = firstPageDistributionSets;
|
||||||
} else if (pinnedControllerId != null) {
|
} else if (pinnedControllerId != null) {
|
||||||
|
|||||||
@@ -39,9 +39,6 @@ import com.vaadin.ui.Window;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Distribution set details layout.
|
* Distribution set details layout.
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@SpringComponent
|
@SpringComponent
|
||||||
@ViewScope
|
@ViewScope
|
||||||
@@ -75,9 +72,7 @@ public class DistributionDetails extends AbstractTableDetailsLayout {
|
|||||||
|
|
||||||
private UI ui;
|
private UI ui;
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* softwareLayout Initialize the component.
|
|
||||||
*/
|
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
protected void init() {
|
protected void init() {
|
||||||
eventBus.subscribe(this);
|
eventBus.subscribe(this);
|
||||||
@@ -116,23 +111,11 @@ public class DistributionDetails extends AbstractTableDetailsLayout {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see hawkbit.server.ui.common.detailslayout.AbstractTableDetailsLayout#
|
|
||||||
* getDefaultCaption()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected String getDefaultCaption() {
|
protected String getDefaultCaption() {
|
||||||
return i18n.get("distribution.details.header");
|
return i18n.get("distribution.details.header");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see hawkbit.server.ui.common.detailslayout.AbstractTableDetailsLayout#
|
|
||||||
* addTabs(com.vaadin. ui.TabSheet)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void addTabs(final TabSheet detailsTab) {
|
protected void addTabs(final TabSheet detailsTab) {
|
||||||
detailsTab.addTab(createDetailsLayout(), i18n.get("caption.tab.details"), null);
|
detailsTab.addTab(createDetailsLayout(), i18n.get("caption.tab.details"), null);
|
||||||
@@ -142,12 +125,6 @@ public class DistributionDetails extends AbstractTableDetailsLayout {
|
|||||||
detailsTab.addTab(createLogLayout(), i18n.get("caption.logs.tab"), null);
|
detailsTab.addTab(createLogLayout(), i18n.get("caption.logs.tab"), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see hawkbit.server.ui.common.detailslayout.AbstractTableDetailsLayout#
|
|
||||||
* onEdit(com.vaadin.ui .Button.ClickEvent)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void onEdit(final ClickEvent event) {
|
protected void onEdit(final ClickEvent event) {
|
||||||
final Window newDistWindow = distributionAddUpdateWindowLayout.getWindow();
|
final Window newDistWindow = distributionAddUpdateWindowLayout.getWindow();
|
||||||
@@ -157,79 +134,37 @@ public class DistributionDetails extends AbstractTableDetailsLayout {
|
|||||||
newDistWindow.setVisible(Boolean.TRUE);
|
newDistWindow.setVisible(Boolean.TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see hawkbit.server.ui.common.detailslayout.AbstractTableDetailsLayout#
|
|
||||||
* getEditButtonId()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected String getEditButtonId() {
|
protected String getEditButtonId() {
|
||||||
return SPUIComponetIdProvider.DS_EDIT_BUTTON;
|
return SPUIComponetIdProvider.DS_EDIT_BUTTON;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see hawkbit.server.ui.common.detailslayout.AbstractTableDetailsLayout#
|
|
||||||
* onLoadIsTableRowSelected ()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected Boolean onLoadIsTableRowSelected() {
|
protected Boolean onLoadIsTableRowSelected() {
|
||||||
return !(managementUIState.getSelectedDsIdName().isPresent()
|
return !(managementUIState.getSelectedDsIdName().isPresent()
|
||||||
&& managementUIState.getSelectedDsIdName().get().isEmpty());
|
&& managementUIState.getSelectedDsIdName().get().isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see hawkbit.server.ui.common.detailslayout.AbstractTableDetailsLayout#
|
|
||||||
* onLoadIsTableMaximized ()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected Boolean onLoadIsTableMaximized() {
|
protected Boolean onLoadIsTableMaximized() {
|
||||||
return managementUIState.isDsTableMaximized();
|
return managementUIState.isDsTableMaximized();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see hawkbit.server.ui.common.detailslayout.AbstractTableDetailsLayout#
|
|
||||||
* populateDetailsWidget()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void populateDetailsWidget() {
|
protected void populateDetailsWidget() {
|
||||||
populateDetailsWidget(selectedDsModule);
|
populateDetailsWidget(selectedDsModule);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see hawkbit.server.ui.common.detailslayout.AbstractTableDetailsLayout#
|
|
||||||
* clearDetails()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void clearDetails() {
|
protected void clearDetails() {
|
||||||
populateDetailsWidget(null);
|
populateDetailsWidget(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see hawkbit.server.ui.common.detailslayout.AbstractTableDetailsLayout#
|
|
||||||
* hasEditPermission()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected Boolean hasEditPermission() {
|
protected Boolean hasEditPermission() {
|
||||||
return permissionChecker.hasUpdateDistributionPermission();
|
return permissionChecker.hasUpdateDistributionPermission();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see hawkbit.server.ui.common.detailslayout.AbstractTableDetailsLayout#
|
|
||||||
* getTabSheetId()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected String getTabSheetId() {
|
protected String getTabSheetId() {
|
||||||
return SPUIComponetIdProvider.DISTRIBUTION_DETAILS_TABSHEET;
|
return SPUIComponetIdProvider.DISTRIBUTION_DETAILS_TABSHEET;
|
||||||
|
|||||||
@@ -73,9 +73,6 @@ import com.vaadin.ui.UI;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Distribution set table.
|
* Distribution set table.
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@SpringComponent
|
@SpringComponent
|
||||||
@ViewScope
|
@ViewScope
|
||||||
@@ -113,9 +110,7 @@ public class DistributionTable extends AbstractTable {
|
|||||||
|
|
||||||
private Button distributinPinnedBtn;
|
private Button distributinPinnedBtn;
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* Initialize the distribution table.
|
|
||||||
*/
|
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
protected void init() {
|
protected void init() {
|
||||||
super.init();
|
super.init();
|
||||||
@@ -219,44 +214,37 @@ public class DistributionTable extends AbstractTable {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected Container createContainer() {
|
protected Container createContainer() {
|
||||||
final Map<String, Object> queryConfiguration = new HashMap<String, Object>();
|
final Map<String, Object> queryConfiguration = prepareQueryConfigFilters();
|
||||||
|
|
||||||
|
final BeanQueryFactory<DistributionBeanQuery> distributionQF = new BeanQueryFactory<>(
|
||||||
|
DistributionBeanQuery.class);
|
||||||
|
distributionQF.setQueryConfiguration(queryConfiguration);
|
||||||
|
return new LazyQueryContainer(
|
||||||
|
new LazyQueryDefinition(true, SPUIDefinitions.PAGE_SIZE, SPUILabelDefinitions.VAR_DIST_ID_NAME),
|
||||||
|
distributionQF);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Map<String, Object> prepareQueryConfigFilters() {
|
||||||
|
final Map<String, Object> queryConfig = new HashMap<>();
|
||||||
managementUIState.getDistributionTableFilters().getSearchText()
|
managementUIState.getDistributionTableFilters().getSearchText()
|
||||||
.ifPresent(value -> queryConfiguration.put(SPUIDefinitions.FILTER_BY_TEXT, value));
|
.ifPresent(value -> queryConfig.put(SPUIDefinitions.FILTER_BY_TEXT, value));
|
||||||
managementUIState.getDistributionTableFilters().getPinnedTargetId()
|
managementUIState.getDistributionTableFilters().getPinnedTargetId()
|
||||||
.ifPresent(value -> queryConfiguration.put(SPUIDefinitions.ORDER_BY_PINNED_TARGET, value));
|
.ifPresent(value -> queryConfig.put(SPUIDefinitions.ORDER_BY_PINNED_TARGET, value));
|
||||||
final List<String> list = new ArrayList<String>();
|
final List<String> list = new ArrayList<>();
|
||||||
queryConfiguration.put(SPUIDefinitions.FILTER_BY_NO_TAG,
|
queryConfig.put(SPUIDefinitions.FILTER_BY_NO_TAG,
|
||||||
managementUIState.getDistributionTableFilters().isNoTagSelected());
|
managementUIState.getDistributionTableFilters().isNoTagSelected());
|
||||||
if (!managementUIState.getDistributionTableFilters().getDistSetTags().isEmpty()) {
|
if (!managementUIState.getDistributionTableFilters().getDistSetTags().isEmpty()) {
|
||||||
list.addAll(managementUIState.getDistributionTableFilters().getDistSetTags());
|
list.addAll(managementUIState.getDistributionTableFilters().getDistSetTags());
|
||||||
}
|
}
|
||||||
queryConfiguration.put(SPUIDefinitions.FILTER_BY_TAG, list);
|
queryConfig.put(SPUIDefinitions.FILTER_BY_TAG, list);
|
||||||
final BeanQueryFactory<DistributionBeanQuery> distributionQF = new BeanQueryFactory<DistributionBeanQuery>(
|
return queryConfig;
|
||||||
DistributionBeanQuery.class);
|
|
||||||
distributionQF.setQueryConfiguration(queryConfiguration);
|
|
||||||
final LazyQueryContainer distributionContainer = new LazyQueryContainer(
|
|
||||||
new LazyQueryDefinition(true, SPUIDefinitions.PAGE_SIZE, SPUILabelDefinitions.VAR_DIST_ID_NAME),
|
|
||||||
distributionQF);
|
|
||||||
return distributionContainer;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see hawkbit.server.ui.common.table.AbstractTable#addContainerProperties(
|
|
||||||
* com.vaadin.data.Container )
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void addContainerProperties(final Container container) {
|
protected void addContainerProperties(final Container container) {
|
||||||
HawkbitCommonUtil.getDsTableColumnProperties(container);
|
HawkbitCommonUtil.getDsTableColumnProperties(container);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.hawkbit.server.ui.common.table.AbstractTable#
|
|
||||||
* addCustomGeneratedColumns()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void addCustomGeneratedColumns() {
|
protected void addCustomGeneratedColumns() {
|
||||||
addGeneratedColumn(SPUILabelDefinitions.PIN_COLUMN, new Table.ColumnGenerator() {
|
addGeneratedColumn(SPUILabelDefinitions.PIN_COLUMN, new Table.ColumnGenerator() {
|
||||||
@@ -269,23 +257,12 @@ public class DistributionTable extends AbstractTable {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.hawkbit.server.ui.common.table.AbstractTable#
|
|
||||||
* isFirstRowSelectedOnLoad()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean isFirstRowSelectedOnLoad() {
|
protected boolean isFirstRowSelectedOnLoad() {
|
||||||
return !managementUIState.getSelectedDsIdName().isPresent()
|
return !managementUIState.getSelectedDsIdName().isPresent()
|
||||||
|| managementUIState.getSelectedDsIdName().get().isEmpty();
|
|| managementUIState.getSelectedDsIdName().get().isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see hawkbit.server.ui.common.table.AbstractTable#getItemIdToSelect()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected Object getItemIdToSelect() {
|
protected Object getItemIdToSelect() {
|
||||||
if (managementUIState.getSelectedDsIdName().isPresent()) {
|
if (managementUIState.getSelectedDsIdName().isPresent()) {
|
||||||
@@ -294,16 +271,9 @@ public class DistributionTable extends AbstractTable {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.eclipse.hawkbit.server.ui.common.table.AbstractTable#onValueChange()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void onValueChange() {
|
protected void onValueChange() {
|
||||||
eventBus.publish(this, DragEvent.HIDE_DROP_HINT);
|
eventBus.publish(this, DragEvent.HIDE_DROP_HINT);
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
final Set<DistributionSetIdName> values = HawkbitCommonUtil.getSelectedDSDetails(this);
|
final Set<DistributionSetIdName> values = HawkbitCommonUtil.getSelectedDSDetails(this);
|
||||||
DistributionSetIdName value = null;
|
DistributionSetIdName value = null;
|
||||||
if (values != null && !values.isEmpty()) {
|
if (values != null && !values.isEmpty()) {
|
||||||
@@ -312,10 +282,7 @@ public class DistributionTable extends AbstractTable {
|
|||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
value = iterator.next();
|
value = iterator.next();
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* Adding null check to make to avoid NPE.Its weird that at times
|
|
||||||
* getValue returns null.
|
|
||||||
*/
|
|
||||||
if (null != value) {
|
if (null != value) {
|
||||||
managementUIState.setSelectedDsIdName(values);
|
managementUIState.setSelectedDsIdName(values);
|
||||||
managementUIState.setLastSelectedDsIdName(value);
|
managementUIState.setLastSelectedDsIdName(value);
|
||||||
@@ -332,33 +299,16 @@ public class DistributionTable extends AbstractTable {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.eclipse.hawkbit.server.ui.common.table.AbstractTable#isMaximized()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean isMaximized() {
|
protected boolean isMaximized() {
|
||||||
return managementUIState.isDsTableMaximized();
|
return managementUIState.isDsTableMaximized();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see hawkbit.server.ui.common.table.AbstractTable#getTableVisibleColumns(
|
|
||||||
* )
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected List<TableColumn> getTableVisibleColumns() {
|
protected List<TableColumn> getTableVisibleColumns() {
|
||||||
return HawkbitCommonUtil.getTableVisibleColumns(isMaximized(), true, i18n);
|
return HawkbitCommonUtil.getTableVisibleColumns(isMaximized(), true, i18n);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see hawkbit.server.ui.common.table.AbstractTable#getTableDropHandler()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected DropHandler getTableDropHandler() {
|
protected DropHandler getTableDropHandler() {
|
||||||
return new DropHandler() {
|
return new DropHandler() {
|
||||||
@@ -396,7 +346,7 @@ public class DistributionTable extends AbstractTable {
|
|||||||
final com.vaadin.event.dd.TargetDetails taregtDet = event.getTargetDetails();
|
final com.vaadin.event.dd.TargetDetails taregtDet = event.getTargetDetails();
|
||||||
final Table distTable = (Table) taregtDet.getTarget();
|
final Table distTable = (Table) taregtDet.getTarget();
|
||||||
final Set<DistributionSetIdName> distsSelected = HawkbitCommonUtil.getSelectedDSDetails(distTable);
|
final Set<DistributionSetIdName> distsSelected = HawkbitCommonUtil.getSelectedDSDetails(distTable);
|
||||||
final Set<Long> distList = new HashSet<Long>();
|
final Set<Long> distList = new HashSet<>();
|
||||||
|
|
||||||
final AbstractSelectTargetDetails dropData = (AbstractSelectTargetDetails) event.getTargetDetails();
|
final AbstractSelectTargetDetails dropData = (AbstractSelectTargetDetails) event.getTargetDetails();
|
||||||
final Object distItemId = dropData.getItemIdOver();
|
final Object distItemId = dropData.getItemIdOver();
|
||||||
@@ -428,7 +378,7 @@ public class DistributionTable extends AbstractTable {
|
|||||||
// assign dist to those targets
|
// assign dist to those targets
|
||||||
final List<Target> assignedTargets = targetService.findTargetsByTag(targetTagName);
|
final List<Target> assignedTargets = targetService.findTargetsByTag(targetTagName);
|
||||||
if (!assignedTargets.isEmpty()) {
|
if (!assignedTargets.isEmpty()) {
|
||||||
final Set<TargetIdName> targetDetailsList = new HashSet<TargetIdName>();
|
final Set<TargetIdName> targetDetailsList = new HashSet<>();
|
||||||
assignedTargets.forEach(target -> targetDetailsList
|
assignedTargets.forEach(target -> targetDetailsList
|
||||||
.add(new TargetIdName(target.getId(), target.getControllerId(), target.getName())));
|
.add(new TargetIdName(target.getId(), target.getControllerId(), target.getName())));
|
||||||
assignTargetToDs(getItem(distItemId), targetDetailsList);
|
assignTargetToDs(getItem(distItemId), targetDetailsList);
|
||||||
@@ -441,7 +391,7 @@ public class DistributionTable extends AbstractTable {
|
|||||||
final TableTransferable transferable = (TableTransferable) event.getTransferable();
|
final TableTransferable transferable = (TableTransferable) event.getTransferable();
|
||||||
final Table source = transferable.getSourceComponent();
|
final Table source = transferable.getSourceComponent();
|
||||||
final Set<TargetIdName> targetsSelected = HawkbitCommonUtil.getSelectedTargetDetails(source);
|
final Set<TargetIdName> targetsSelected = HawkbitCommonUtil.getSelectedTargetDetails(source);
|
||||||
final Set<TargetIdName> targetDetailsList = new HashSet<TargetIdName>();
|
final Set<TargetIdName> targetDetailsList = new HashSet<>();
|
||||||
|
|
||||||
if (!targetsSelected.contains(transferable.getData("itemId"))) {
|
if (!targetsSelected.contains(transferable.getData("itemId"))) {
|
||||||
targetDetailsList.add((TargetIdName) transferable.getData("itemId"));
|
targetDetailsList.add((TargetIdName) transferable.getData("itemId"));
|
||||||
@@ -467,13 +417,6 @@ public class DistributionTable extends AbstractTable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Validate event.
|
|
||||||
*
|
|
||||||
* @param dragEvent
|
|
||||||
* as event
|
|
||||||
* @return boolean as flag
|
|
||||||
*/
|
|
||||||
private Boolean doValidation(final DragAndDropEvent dragEvent) {
|
private Boolean doValidation(final DragAndDropEvent dragEvent) {
|
||||||
final Component compsource = dragEvent.getTransferable().getSourceComponent();
|
final Component compsource = dragEvent.getTransferable().getSourceComponent();
|
||||||
if (compsource instanceof Table) {
|
if (compsource instanceof Table) {
|
||||||
@@ -521,15 +464,6 @@ public class DistributionTable extends AbstractTable {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Validate the assignment.
|
|
||||||
*
|
|
||||||
* @param targetDetailsList
|
|
||||||
* @param source
|
|
||||||
* @param distId
|
|
||||||
* @param distName
|
|
||||||
* @return String as indicator
|
|
||||||
*/
|
|
||||||
private String validate(final Set<TargetIdName> targetDetailsList,
|
private String validate(final Set<TargetIdName> targetDetailsList,
|
||||||
final DistributionSetIdName distributionSetIdName) {
|
final DistributionSetIdName distributionSetIdName) {
|
||||||
String pendingActionMessage = null;
|
String pendingActionMessage = null;
|
||||||
@@ -548,17 +482,6 @@ public class DistributionTable extends AbstractTable {
|
|||||||
return pendingActionMessage;
|
return pendingActionMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Message for Pending Action.
|
|
||||||
*
|
|
||||||
* @param message
|
|
||||||
* as msg
|
|
||||||
* @param targId
|
|
||||||
* as ID
|
|
||||||
* @param distName
|
|
||||||
* as Dist Set Name
|
|
||||||
* @return String as message
|
|
||||||
*/
|
|
||||||
private String getPendingActionMessage(final String message, final String targId, final String distNameVersion) {
|
private String getPendingActionMessage(final String message, final String targId, final String distNameVersion) {
|
||||||
String pendActionMsg = i18n.get("message.target.assigned.pending");
|
String pendActionMsg = i18n.get("message.target.assigned.pending");
|
||||||
if (null == message) {
|
if (null == message) {
|
||||||
@@ -567,12 +490,6 @@ public class DistributionTable extends AbstractTable {
|
|||||||
return pendActionMsg;
|
return pendActionMsg;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Show or Hide Popup Notification Message.
|
|
||||||
*
|
|
||||||
* @param message
|
|
||||||
* as msg
|
|
||||||
*/
|
|
||||||
private void showOrHidePopupAndNotification(final String message) {
|
private void showOrHidePopupAndNotification(final String message) {
|
||||||
if (null != managementUIState.getAssignedList() && !managementUIState.getAssignedList().isEmpty()) {
|
if (null != managementUIState.getAssignedList() && !managementUIState.getAssignedList().isEmpty()) {
|
||||||
eventBus.publish(this, ManagementUIEvent.UPDATE_COUNT);
|
eventBus.publish(this, ManagementUIEvent.UPDATE_COUNT);
|
||||||
@@ -629,19 +546,6 @@ public class DistributionTable extends AbstractTable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Added by Saumya Get Pin style.
|
|
||||||
*
|
|
||||||
* @param itemId
|
|
||||||
* as item clicked
|
|
||||||
* @param propertyId
|
|
||||||
* as property
|
|
||||||
* @param installedDistItemIds
|
|
||||||
* as set
|
|
||||||
* @param assignedDistTableItemIds
|
|
||||||
* as set
|
|
||||||
* @return String as Style
|
|
||||||
*/
|
|
||||||
private String getPinnedDistributionStyle(final Long installedDistItemIds, final Long assignedDistTableItemIds,
|
private String getPinnedDistributionStyle(final Long installedDistItemIds, final Long assignedDistTableItemIds,
|
||||||
final Object itemId) {
|
final Object itemId) {
|
||||||
final Long distId = ((DistributionSetIdName) itemId).getId();
|
final Long distId = ((DistributionSetIdName) itemId).getId();
|
||||||
@@ -655,10 +559,6 @@ public class DistributionTable extends AbstractTable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param itemId
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private Object getPinButton(final Object itemId) {
|
private Object getPinButton(final Object itemId) {
|
||||||
final DistributionSetIdName dist = (DistributionSetIdName) getContainerDataSource().getItem(itemId)
|
final DistributionSetIdName dist = (DistributionSetIdName) getContainerDataSource().getItem(itemId)
|
||||||
.getItemProperty(SPUILabelDefinitions.VAR_DIST_ID_NAME).getValue();
|
.getItemProperty(SPUILabelDefinitions.VAR_DIST_ID_NAME).getValue();
|
||||||
@@ -677,12 +577,6 @@ public class DistributionTable extends AbstractTable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Add listener to pin.
|
|
||||||
*
|
|
||||||
* @param pinBtn
|
|
||||||
* as event
|
|
||||||
*/
|
|
||||||
private void addPinClickListener(final ClickEvent event) {
|
private void addPinClickListener(final ClickEvent event) {
|
||||||
eventBus.publish(this, DragEvent.HIDE_DROP_HINT);
|
eventBus.publish(this, DragEvent.HIDE_DROP_HINT);
|
||||||
checkifAlreadyPinned(event.getButton());
|
checkifAlreadyPinned(event.getButton());
|
||||||
@@ -694,12 +588,6 @@ public class DistributionTable extends AbstractTable {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Check already pinned.
|
|
||||||
*
|
|
||||||
* @param eventBtn
|
|
||||||
* as button
|
|
||||||
*/
|
|
||||||
private void checkifAlreadyPinned(final Button eventBtn) {
|
private void checkifAlreadyPinned(final Button eventBtn) {
|
||||||
final Long newPinnedDistItemId = ((DistributionSetIdName) eventBtn.getData()).getId();
|
final Long newPinnedDistItemId = ((DistributionSetIdName) eventBtn.getData()).getId();
|
||||||
Long pinnedDistId = null;
|
Long pinnedDistId = null;
|
||||||
@@ -751,9 +639,6 @@ public class DistributionTable extends AbstractTable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* set style to distribution set table.
|
|
||||||
*/
|
|
||||||
private void styleDistributionSetTable() {
|
private void styleDistributionSetTable() {
|
||||||
setCellStyleGenerator(new Table.CellStyleGenerator() {
|
setCellStyleGenerator(new Table.CellStyleGenerator() {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
@@ -765,12 +650,6 @@ public class DistributionTable extends AbstractTable {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Apply pin style to pin.
|
|
||||||
*
|
|
||||||
* @param eventBtn
|
|
||||||
* as button
|
|
||||||
*/
|
|
||||||
private void applyPinStyle(final Button eventBtn) {
|
private void applyPinStyle(final Button eventBtn) {
|
||||||
final StringBuilder style = new StringBuilder(SPUIComponentProvider.getPinButtonStyle());
|
final StringBuilder style = new StringBuilder(SPUIComponentProvider.getPinButtonStyle());
|
||||||
style.append(' ').append(SPUIStyleDefinitions.DIST_PIN).append(' ').append("tablePin").append(' ')
|
style.append(' ').append(SPUIStyleDefinitions.DIST_PIN).append(' ').append("tablePin").append(' ')
|
||||||
@@ -815,14 +694,9 @@ public class DistributionTable extends AbstractTable {
|
|||||||
* @param assignedDistTableItemIds
|
* @param assignedDistTableItemIds
|
||||||
* Item ids of assigned distribution set
|
* Item ids of assigned distribution set
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("serial")
|
|
||||||
public void styleDistributionSetTable(final Long installedDistItemId, final Long assignedDistTableItemId) {
|
public void styleDistributionSetTable(final Long installedDistItemId, final Long assignedDistTableItemId) {
|
||||||
setCellStyleGenerator(new Table.CellStyleGenerator() {
|
setCellStyleGenerator((source, itemId, propertyId) -> getPinnedDistributionStyle(installedDistItemId,
|
||||||
@Override
|
assignedDistTableItemId, itemId));
|
||||||
public String getStyle(final Table source, final Object itemId, final Object propertyId) {
|
|
||||||
return getPinnedDistributionStyle(installedDistItemId, assignedDistTableItemId, itemId);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDistributinPinnedBtn(final Button distributinPinnedBtn) {
|
public void setDistributinPinnedBtn(final Button distributinPinnedBtn) {
|
||||||
|
|||||||
@@ -58,9 +58,7 @@ public class DistributionTableHeader extends AbstractTableHeader {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private DistributionAddUpdateWindowLayout distributionAddUpdateWindowLayout;
|
private DistributionAddUpdateWindowLayout distributionAddUpdateWindowLayout;
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* Initialize the component.
|
|
||||||
*/
|
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
protected void init() {
|
protected void init() {
|
||||||
super.init();
|
super.init();
|
||||||
@@ -81,54 +79,26 @@ public class DistributionTableHeader extends AbstractTableHeader {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see hawkbit.server.ui.common.table.AbstractTableHeader#getHeaderCaption(
|
|
||||||
* )
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected String getHeaderCaption() {
|
protected String getHeaderCaption() {
|
||||||
return i18n.get("header.dist.table");
|
return i18n.get("header.dist.table");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see hawkbit.server.ui.common.table.AbstractTableHeader#getSearchBoxId()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected String getSearchBoxId() {
|
protected String getSearchBoxId() {
|
||||||
return SPUIComponetIdProvider.DIST_SEARCH_TEXTFIELD;
|
return SPUIComponetIdProvider.DIST_SEARCH_TEXTFIELD;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.hawkbit.server.ui.common.table.AbstractTableHeader#
|
|
||||||
* getSearchRestIconId()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected String getSearchRestIconId() {
|
protected String getSearchRestIconId() {
|
||||||
return SPUIComponetIdProvider.DIST_SEARCH_ICON;
|
return SPUIComponetIdProvider.DIST_SEARCH_ICON;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see hawkbit.server.ui.common.table.AbstractTableHeader#getAddIconId()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected String getAddIconId() {
|
protected String getAddIconId() {
|
||||||
return SPUIComponetIdProvider.DIST_ADD_ICON;
|
return SPUIComponetIdProvider.DIST_ADD_ICON;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.hawkbit.server.ui.common.table.AbstractTableHeader#
|
|
||||||
* onLoadSearchBoxValue()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected String onLoadSearchBoxValue() {
|
protected String onLoadSearchBoxValue() {
|
||||||
if (managementUIState.getDistributionTableFilters().getSearchText().isPresent()) {
|
if (managementUIState.getDistributionTableFilters().getSearchText().isPresent()) {
|
||||||
@@ -137,155 +107,78 @@ public class DistributionTableHeader extends AbstractTableHeader {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see hawkbit.server.ui.common.table.AbstractTableHeader#getDropFilterId()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected String getDropFilterId() {
|
protected String getDropFilterId() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.hawkbit.server.ui.common.table.AbstractTableHeader#
|
|
||||||
* hasCreatePermission()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean hasCreatePermission() {
|
protected boolean hasCreatePermission() {
|
||||||
return permChecker.hasCreateDistributionPermission();
|
return permChecker.hasCreateDistributionPermission();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.hawkbit.server.ui.common.table.AbstractTableHeader#
|
|
||||||
* isDropHintRequired()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean isDropHintRequired() {
|
protected boolean isDropHintRequired() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.hawkbit.server.ui.common.table.AbstractTableHeader#
|
|
||||||
* isDropFilterRequired()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean isDropFilterRequired() {
|
protected boolean isDropFilterRequired() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.hawkbit.server.ui.common.table.AbstractTableHeader#
|
|
||||||
* getShowFilterButtonLayoutId()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected String getShowFilterButtonLayoutId() {
|
protected String getShowFilterButtonLayoutId() {
|
||||||
return "show.dist.tags.icon";
|
return "show.dist.tags.icon";
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.hawkbit.server.ui.common.table.AbstractTableHeader#
|
|
||||||
* showFilterButtonsLayout()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void showFilterButtonsLayout() {
|
protected void showFilterButtonsLayout() {
|
||||||
managementUIState.setDistTagFilterClosed(false);
|
managementUIState.setDistTagFilterClosed(false);
|
||||||
eventbus.publish(this, ManagementUIEvent.SHOW_DISTRIBUTION_TAG_LAYOUT);
|
eventbus.publish(this, ManagementUIEvent.SHOW_DISTRIBUTION_TAG_LAYOUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see hawkbit.server.ui.common.table.AbstractTableHeader#resetSearchText()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void resetSearchText() {
|
protected void resetSearchText() {
|
||||||
managementUIState.getDistributionTableFilters().setSearchText(null);
|
if (managementUIState.getDistributionTableFilters().getSearchText().isPresent()) {
|
||||||
eventbus.publish(this, DistributionTableFilterEvent.REMOVE_FILTER_BY_TEXT);
|
managementUIState.getDistributionTableFilters().setSearchText(null);
|
||||||
|
eventbus.publish(this, DistributionTableFilterEvent.REMOVE_FILTER_BY_TEXT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see hawkbit.server.ui.common.table.AbstractTableHeader#getMaxMinIconId()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected String getMaxMinIconId() {
|
protected String getMaxMinIconId() {
|
||||||
return SPUIComponetIdProvider.DS_MAX_MIN_TABLE_ICON;
|
return SPUIComponetIdProvider.DS_MAX_MIN_TABLE_ICON;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see hawkbit.server.ui.common.table.AbstractTableHeader#maximizeTable()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void maximizeTable() {
|
public void maximizeTable() {
|
||||||
managementUIState.setDsTableMaximized(Boolean.TRUE);
|
managementUIState.setDsTableMaximized(Boolean.TRUE);
|
||||||
eventbus.publish(this, new DistributionTableEvent(DistributionComponentEvent.MAXIMIZED, null));
|
eventbus.publish(this, new DistributionTableEvent(DistributionComponentEvent.MAXIMIZED, null));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see hawkbit.server.ui.common.table.AbstractTableHeader#minimizeTable()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void minimizeTable() {
|
public void minimizeTable() {
|
||||||
managementUIState.setDsTableMaximized(Boolean.FALSE);
|
managementUIState.setDsTableMaximized(Boolean.FALSE);
|
||||||
eventbus.publish(this, new DistributionTableEvent(DistributionComponentEvent.MINIMIZED, null));
|
eventbus.publish(this, new DistributionTableEvent(DistributionComponentEvent.MINIMIZED, null));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.hawkbit.server.ui.common.table.AbstractTableHeader#
|
|
||||||
* onLoadIsTableMaximized()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean onLoadIsTableMaximized() {
|
public Boolean onLoadIsTableMaximized() {
|
||||||
return managementUIState.isDsTableMaximized();
|
return managementUIState.isDsTableMaximized();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.hawkbit.server.ui.common.table.AbstractTableHeader#
|
|
||||||
* onLoadIsShowFilterButtonDisplayed()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean onLoadIsShowFilterButtonDisplayed() {
|
public Boolean onLoadIsShowFilterButtonDisplayed() {
|
||||||
return managementUIState.isDistTagFilterClosed();
|
return managementUIState.isDistTagFilterClosed();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see hawkbit.server.ui.common.table.AbstractTableHeader#searchBy(java.
|
|
||||||
* lang.String)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void searchBy(final String newSearchText) {
|
protected void searchBy(final String newSearchText) {
|
||||||
managementUIState.getDistributionTableFilters().setSearchText(newSearchText);
|
managementUIState.getDistributionTableFilters().setSearchText(newSearchText);
|
||||||
eventbus.publish(this, DistributionTableFilterEvent.FILTER_BY_TEXT);
|
eventbus.publish(this, DistributionTableFilterEvent.FILTER_BY_TEXT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see hawkbit.server.ui.common.table.AbstractTableHeader#addNewItem(com.
|
|
||||||
* vaadin.ui.Button.ClickEvent )
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void addNewItem(final ClickEvent event) {
|
protected void addNewItem(final ClickEvent event) {
|
||||||
final Window newDistWindow = distributionAddUpdateWindowLayout.getWindow();
|
final Window newDistWindow = distributionAddUpdateWindowLayout.getWindow();
|
||||||
@@ -295,12 +188,6 @@ public class DistributionTableHeader extends AbstractTableHeader {
|
|||||||
eventbus.publish(this, DragEvent.HIDE_DROP_HINT);
|
eventbus.publish(this, DragEvent.HIDE_DROP_HINT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.hawkbit.server.ui.common.table.AbstractTableHeader#
|
|
||||||
* isAddNewItemAllowed()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected Boolean isAddNewItemAllowed() {
|
protected Boolean isAddNewItemAllowed() {
|
||||||
return Boolean.FALSE;
|
return Boolean.FALSE;
|
||||||
@@ -321,47 +208,21 @@ public class DistributionTableHeader extends AbstractTableHeader {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.hawkbit.server.ui.common.table.AbstractTableHeader#
|
|
||||||
* getBulkUploadIconId()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected String getBulkUploadIconId() {
|
protected String getBulkUploadIconId() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see hawkbit.server.ui.common.table.AbstractTableHeader#bulkUpload(com.
|
|
||||||
* vaadin.ui.Button.ClickEvent )
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void bulkUpload(final ClickEvent event) {
|
protected void bulkUpload(final ClickEvent event) {
|
||||||
/**
|
// No implementation as no bulk upload is supported.
|
||||||
* No implementation as no bulk upload is supported.
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.hawkbit.server.ui.common.table.AbstractTableHeader#
|
|
||||||
* isBulkUploadAllowed()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected Boolean isBulkUploadAllowed() {
|
protected Boolean isBulkUploadAllowed() {
|
||||||
return Boolean.FALSE;
|
return Boolean.FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.hawkbit.ui.common.table.AbstractTableHeader#
|
|
||||||
* isBulkUploadInProgress()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean isBulkUploadInProgress() {
|
protected boolean isBulkUploadInProgress() {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ public class DistributionTagBeanQuery extends AbstractBeanQuery<ProxyTag> {
|
|||||||
@Override
|
@Override
|
||||||
protected List<ProxyTag> loadBeans(final int startIndex, final int count) {
|
protected List<ProxyTag> loadBeans(final int startIndex, final int count) {
|
||||||
Page<DistributionSetTag> dsTagBeans;
|
Page<DistributionSetTag> dsTagBeans;
|
||||||
final List<ProxyTag> tagList = new ArrayList<ProxyTag>();
|
final List<ProxyTag> tagList = new ArrayList<>();
|
||||||
if (startIndex == 0 && firstPageDsTag != null) {
|
if (startIndex == 0 && firstPageDsTag != null) {
|
||||||
dsTagBeans = firstPageDsTag;
|
dsTagBeans = firstPageDsTag;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -64,12 +64,7 @@ public class DistributionTagButtons extends AbstractFilterButtons {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ManagementUIState managementUIState;
|
private ManagementUIState managementUIState;
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* Initialize component.
|
|
||||||
*
|
|
||||||
* @param filterButtonClickBehaviour
|
|
||||||
* the clickable behaviour.
|
|
||||||
*/
|
|
||||||
public void init(final AbstractFilterButtonClickBehaviour filterButtonClickBehaviour) {
|
public void init(final AbstractFilterButtonClickBehaviour filterButtonClickBehaviour) {
|
||||||
super.init(filterButtonClickBehaviour);
|
super.init(filterButtonClickBehaviour);
|
||||||
addNewTag(new DistributionSetTag("NO TAG"));
|
addNewTag(new DistributionSetTag("NO TAG"));
|
||||||
@@ -98,7 +93,6 @@ public class DistributionTagButtons extends AbstractFilterButtons {
|
|||||||
|
|
||||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||||
void onEvent(final DragEvent dragEvent) {
|
void onEvent(final DragEvent dragEvent) {
|
||||||
|
|
||||||
if (dragEvent == DragEvent.DISTRIBUTION_DRAG) {
|
if (dragEvent == DragEvent.DISTRIBUTION_DRAG) {
|
||||||
UI.getCurrent().access(() -> addStyleName(SPUIStyleDefinitions.SHOW_DROP_HINT_FILTER_BUTTON));
|
UI.getCurrent().access(() -> addStyleName(SPUIStyleDefinitions.SHOW_DROP_HINT_FILTER_BUTTON));
|
||||||
} else {
|
} else {
|
||||||
@@ -106,34 +100,18 @@ public class DistributionTagButtons extends AbstractFilterButtons {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterButtons#
|
|
||||||
* getButtonsTableId()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected String getButtonsTableId() {
|
protected String getButtonsTableId() {
|
||||||
return SPUIComponetIdProvider.DISTRIBUTION_TAG_TABLE_ID;
|
return SPUIComponetIdProvider.DISTRIBUTION_TAG_TABLE_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterButtons#
|
|
||||||
* createButtonsLazyQueryContainer ()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected LazyQueryContainer createButtonsLazyQueryContainer() {
|
protected LazyQueryContainer createButtonsLazyQueryContainer() {
|
||||||
final Map<String, Object> queryConfig = new HashMap<String, Object>();
|
final Map<String, Object> queryConfig = new HashMap<>();
|
||||||
final BeanQueryFactory<DistributionTagBeanQuery> tagQF = new BeanQueryFactory<DistributionTagBeanQuery>(
|
final BeanQueryFactory<DistributionTagBeanQuery> tagQF = new BeanQueryFactory<>(DistributionTagBeanQuery.class);
|
||||||
DistributionTagBeanQuery.class);
|
|
||||||
tagQF.setQueryConfiguration(queryConfig);
|
tagQF.setQueryConfiguration(queryConfig);
|
||||||
final LazyQueryContainer tagContainer = HawkbitCommonUtil.createDSLazyQueryContainer(
|
return HawkbitCommonUtil.createDSLazyQueryContainer(
|
||||||
new BeanQueryFactory<DistributionTagBeanQuery>(DistributionTagBeanQuery.class));
|
new BeanQueryFactory<DistributionTagBeanQuery>(DistributionTagBeanQuery.class));
|
||||||
return tagContainer;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -142,13 +120,6 @@ public class DistributionTagButtons extends AbstractFilterButtons {
|
|||||||
return SPUIDefinitions.DISTRIBUTION_TAG_BUTTON;
|
return SPUIDefinitions.DISTRIBUTION_TAG_BUTTON;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterButtons#
|
|
||||||
* isClickedByDefault(java.lang .Long)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean isClickedByDefault(final Long buttonId) {
|
protected boolean isClickedByDefault(final Long buttonId) {
|
||||||
final DistributionSetTag dsTagObject = tagMgmtService.findDistributionSetTagById(buttonId);
|
final DistributionSetTag dsTagObject = tagMgmtService.findDistributionSetTagById(buttonId);
|
||||||
@@ -161,37 +132,16 @@ public class DistributionTagButtons extends AbstractFilterButtons {
|
|||||||
return managementUIState.getDistributionTableFilters().isNoTagSelected();
|
return managementUIState.getDistributionTableFilters().isNoTagSelected();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterButtons#
|
|
||||||
* createButtonId(java.lang. String)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected String createButtonId(final String name) {
|
protected String createButtonId(final String name) {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterButtons#
|
|
||||||
* getFilterButtonDropHandler()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected DropHandler getFilterButtonDropHandler() {
|
protected DropHandler getFilterButtonDropHandler() {
|
||||||
return spDistTagDropEvent;
|
return spDistTagDropEvent;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterButtons#
|
|
||||||
* getButttonWrapperId()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected String getButttonWrapperIdPrefix() {
|
protected String getButttonWrapperIdPrefix() {
|
||||||
return SPUIDefinitions.DISTRIBUTION_TAG_ID_PREFIXS;
|
return SPUIDefinitions.DISTRIBUTION_TAG_ID_PREFIXS;
|
||||||
|
|||||||
@@ -50,9 +50,7 @@ public class DistributionTagHeader extends AbstractFilterHeader {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private CreateUpdateDistributionTagLayoutWindow createORUpdateDistributionTagLayout;
|
private CreateUpdateDistributionTagLayoutWindow createORUpdateDistributionTagLayout;
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* Initialize the components.
|
|
||||||
*/
|
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void init() {
|
public void init() {
|
||||||
super.init();
|
super.init();
|
||||||
@@ -61,100 +59,45 @@ public class DistributionTagHeader extends AbstractFilterHeader {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterHeader#
|
|
||||||
* getHideButtonId()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected String getHideButtonId() {
|
protected String getHideButtonId() {
|
||||||
return "hide.distribution.tags";
|
return "hide.distribution.tags";
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterHeader#
|
|
||||||
* hasCreateUpdatePermission()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean hasCreateUpdatePermission() {
|
protected boolean hasCreateUpdatePermission() {
|
||||||
return permChecker.hasCreateDistributionPermission() || permChecker.hasUpdateDistributionPermission();
|
return permChecker.hasCreateDistributionPermission() || permChecker.hasUpdateDistributionPermission();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see hawkbit.server.ui.common.filterlayout.AbstractFilterHeader#getTitle(
|
|
||||||
* )
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected String getTitle() {
|
protected String getTitle() {
|
||||||
return i18n.get("header.filter.tag", new Object[] {});
|
return i18n.get("header.filter.tag", new Object[] {});
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterHeader#
|
|
||||||
* settingsIconClicked(com.vaadin .ui.Button.ClickEvent)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void settingsIconClicked(final ClickEvent event) {
|
protected void settingsIconClicked(final ClickEvent event) {
|
||||||
final Window addUpdateWindow = createORUpdateDistributionTagLayout.getWindow();
|
final Window addUpdateWindow = createORUpdateDistributionTagLayout.getWindow();
|
||||||
UI.getCurrent().addWindow(addUpdateWindow);
|
UI.getCurrent().addWindow(addUpdateWindow);
|
||||||
addUpdateWindow.setModal(true);
|
addUpdateWindow.setModal(true);
|
||||||
addUpdateWindow.setVisible(Boolean.TRUE);
|
addUpdateWindow.setVisible(Boolean.TRUE);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterHeader#
|
|
||||||
* dropHitsRequired()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean dropHitsRequired() {
|
protected boolean dropHitsRequired() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterHeader#
|
|
||||||
* hideFilterButtonLayout()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void hideFilterButtonLayout() {
|
protected void hideFilterButtonLayout() {
|
||||||
managementUIState.setDistTagFilterClosed(true);
|
managementUIState.setDistTagFilterClosed(true);
|
||||||
eventbus.publish(this, ManagementUIEvent.HIDE_DISTRIBUTION_TAG_LAYOUT);
|
eventbus.publish(this, ManagementUIEvent.HIDE_DISTRIBUTION_TAG_LAYOUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterHeader#
|
|
||||||
* getConfigureFilterButtonId()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected String getConfigureFilterButtonId() {
|
protected String getConfigureFilterButtonId() {
|
||||||
return SPUIComponetIdProvider.ADD_DISTRIBUTION_TAG;
|
return SPUIComponetIdProvider.ADD_DISTRIBUTION_TAG;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.hawkbit.ui.common.filterlayout.AbstractFilterHeader#
|
|
||||||
* isAddTagRequired()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean isAddTagRequired() {
|
protected boolean isAddTagRequired() {
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -86,20 +86,13 @@ public class DistributionTagDropEvent implements DropHandler {
|
|||||||
private Boolean isNoTagAssigned(final DragAndDropEvent event) {
|
private Boolean isNoTagAssigned(final DragAndDropEvent event) {
|
||||||
final String tagName = ((DragAndDropWrapper) (event.getTargetDetails().getTarget())).getData().toString();
|
final String tagName = ((DragAndDropWrapper) (event.getTargetDetails().getTarget())).getData().toString();
|
||||||
if (tagName.equals(SPUIDefinitions.DISTRIBUTION_TAG_BUTTON)) {
|
if (tagName.equals(SPUIDefinitions.DISTRIBUTION_TAG_BUTTON)) {
|
||||||
notification.displayValidationError(i18n.get("message.tag.cannot.be.assigned",
|
notification.displayValidationError(
|
||||||
new Object[] { i18n.get("label.no.tag.assigned") }));
|
i18n.get("message.tag.cannot.be.assigned", new Object[] { i18n.get("label.no.tag.assigned") }));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Validate the drop.
|
|
||||||
*
|
|
||||||
* @param event
|
|
||||||
* DragAndDropEvent reference
|
|
||||||
* @return Boolean
|
|
||||||
*/
|
|
||||||
private Boolean validate(final DragAndDropEvent event) {
|
private Boolean validate(final DragAndDropEvent event) {
|
||||||
final Component compsource = event.getTransferable().getSourceComponent();
|
final Component compsource = event.getTransferable().getSourceComponent();
|
||||||
if (!(compsource instanceof Table)) {
|
if (!(compsource instanceof Table)) {
|
||||||
@@ -116,11 +109,6 @@ public class DistributionTagDropEvent implements DropHandler {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* validate the update permission.
|
|
||||||
*
|
|
||||||
* @return boolean
|
|
||||||
*/
|
|
||||||
private boolean checkForDSUpdatePermission() {
|
private boolean checkForDSUpdatePermission() {
|
||||||
if (!permChecker.hasUpdateDistributionPermission()) {
|
if (!permChecker.hasUpdateDistributionPermission()) {
|
||||||
|
|
||||||
@@ -131,13 +119,6 @@ public class DistributionTagDropEvent implements DropHandler {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* validate the source tables.
|
|
||||||
*
|
|
||||||
* @param source
|
|
||||||
* table
|
|
||||||
* @return boolean
|
|
||||||
*/
|
|
||||||
private boolean validateIfSourceIsDs(final Table source) {
|
private boolean validateIfSourceIsDs(final Table source) {
|
||||||
if (!source.getId().equals(SPUIComponetIdProvider.DIST_TABLE_ID)) {
|
if (!source.getId().equals(SPUIComponetIdProvider.DIST_TABLE_ID)) {
|
||||||
notification.displayValidationError(i18n.get(SPUILabelDefinitions.ACTION_NOT_ALLOWED));
|
notification.displayValidationError(i18n.get(SPUILabelDefinitions.ACTION_NOT_ALLOWED));
|
||||||
@@ -146,12 +127,6 @@ public class DistributionTagDropEvent implements DropHandler {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Process target Drop event.
|
|
||||||
*
|
|
||||||
* @param event
|
|
||||||
* DragAndDropEvent
|
|
||||||
*/
|
|
||||||
private void processDistributionDrop(final DragAndDropEvent event) {
|
private void processDistributionDrop(final DragAndDropEvent event) {
|
||||||
|
|
||||||
final com.vaadin.event.dd.TargetDetails targetDetails = event.getTargetDetails();
|
final com.vaadin.event.dd.TargetDetails targetDetails = event.getTargetDetails();
|
||||||
@@ -161,7 +136,7 @@ public class DistributionTagDropEvent implements DropHandler {
|
|||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
final Set<DistributionSetIdName> distSelected = (Set<DistributionSetIdName>) source.getValue();
|
final Set<DistributionSetIdName> distSelected = (Set<DistributionSetIdName>) source.getValue();
|
||||||
final Set<Long> distributionList = new HashSet<Long>();
|
final Set<Long> distributionList = new HashSet<>();
|
||||||
if (!distSelected.contains(transferable.getData(ITEMID))) {
|
if (!distSelected.contains(transferable.getData(ITEMID))) {
|
||||||
distributionList.add(((DistributionSetIdName) transferable.getData(ITEMID)).getId());
|
distributionList.add(((DistributionSetIdName) transferable.getData(ITEMID)).getId());
|
||||||
} else {
|
} else {
|
||||||
@@ -172,8 +147,8 @@ public class DistributionTagDropEvent implements DropHandler {
|
|||||||
SPUIDefinitions.DISTRIBUTION_TAG_ID_PREFIXS);
|
SPUIDefinitions.DISTRIBUTION_TAG_ID_PREFIXS);
|
||||||
|
|
||||||
final List<String> tagsClickedList = distFilterParameters.getDistSetTags();
|
final List<String> tagsClickedList = distFilterParameters.getDistSetTags();
|
||||||
final DistributionSetTagAssigmentResult result = distributionSetManagement.toggleTagAssignment(
|
final DistributionSetTagAssigmentResult result = distributionSetManagement.toggleTagAssignment(distributionList,
|
||||||
distributionList, distTagName);
|
distTagName);
|
||||||
|
|
||||||
notification.displaySuccess(HawkbitCommonUtil.getDistributionTagAssignmentMsg(distTagName, result, i18n));
|
notification.displaySuccess(HawkbitCommonUtil.getDistributionTagAssignmentMsg(distTagName, result, i18n));
|
||||||
if (result.getUnassigned() >= 1 && !tagsClickedList.isEmpty()) {
|
if (result.getUnassigned() >= 1 && !tagsClickedList.isEmpty()) {
|
||||||
|
|||||||
@@ -47,12 +47,6 @@ public class ManagementViewAcceptCriteria extends AbstractAcceptCriteria {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private transient EventBus.SessionEventBus eventBus;
|
private transient EventBus.SessionEventBus eventBus;
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see hawkbit.server.ui.common.AbstractAcceptCriteria#analyseDragComponent
|
|
||||||
* (com.vaadin.event .dd.DragAndDropEvent, com.vaadin.ui.Component)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void analyseDragComponent(final Component compsource) {
|
protected void analyseDragComponent(final Component compsource) {
|
||||||
final String sourceID = getComponentId(compsource);
|
final String sourceID = getComponentId(compsource);
|
||||||
@@ -60,24 +54,11 @@ public class ManagementViewAcceptCriteria extends AbstractAcceptCriteria {
|
|||||||
eventBus.publish(this, event);
|
eventBus.publish(this, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.eclipse.hawkbit.server.ui.common.AbstractAcceptCriteria#hideDropHints
|
|
||||||
* ()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void hideDropHints() {
|
protected void hideDropHints() {
|
||||||
eventBus.publish(this, DragEvent.HIDE_DROP_HINT);
|
eventBus.publish(this, DragEvent.HIDE_DROP_HINT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.eclipse.hawkbit.server.ui.common.AbstractAcceptCriteria#invalidDrop()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void invalidDrop() {
|
protected void invalidDrop() {
|
||||||
uiNotification.displayValidationError(SPUILabelDefinitions.ACTION_NOT_ALLOWED);
|
uiNotification.displayValidationError(SPUILabelDefinitions.ACTION_NOT_ALLOWED);
|
||||||
@@ -94,60 +75,31 @@ public class ManagementViewAcceptCriteria extends AbstractAcceptCriteria {
|
|||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.hawkbit.server.ui.common.AbstractAcceptCriteria#
|
|
||||||
* getDropHintConfigurations()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected Map<String, Object> getDropHintConfigurations() {
|
protected Map<String, Object> getDropHintConfigurations() {
|
||||||
return DROP_HINTS_CONFIGS;
|
return DROP_HINTS_CONFIGS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.hawkbit.server.ui.common.AbstractAcceptCriteria#
|
|
||||||
* publishDragStartEvent(java.lang.Object)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void publishDragStartEvent(final Object event) {
|
protected void publishDragStartEvent(final Object event) {
|
||||||
eventBus.publish(this, event);
|
eventBus.publish(this, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.hawkbit.server.ui.common.AbstractAcceptCriteria#
|
|
||||||
* getDropConfigurations()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected Map<String, List<String>> getDropConfigurations() {
|
protected Map<String, List<String>> getDropConfigurations() {
|
||||||
return DROP_CONFIGS;
|
return DROP_CONFIGS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param id
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private boolean isDistributionTagId(final String id) {
|
private boolean isDistributionTagId(final String id) {
|
||||||
return id != null && id.startsWith(SPUIDefinitions.DISTRIBUTION_TAG_ID_PREFIXS);
|
return id != null && id.startsWith(SPUIDefinitions.DISTRIBUTION_TAG_ID_PREFIXS);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param id
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private boolean isTargetTagId(final String id) {
|
private boolean isTargetTagId(final String id) {
|
||||||
return id != null && id.startsWith(SPUIDefinitions.TARGET_TAG_ID_PREFIXS);
|
return id != null && id.startsWith(SPUIDefinitions.TARGET_TAG_ID_PREFIXS);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private static Map<String, List<String>> createDropConfigurations() {
|
private static Map<String, List<String>> createDropConfigurations() {
|
||||||
final Map<String, List<String>> config = new HashMap<String, List<String>>();
|
final Map<String, List<String>> config = new HashMap<>();
|
||||||
|
|
||||||
// Delete drop area acceptable components
|
// Delete drop area acceptable components
|
||||||
config.put(SPUIComponetIdProvider.DELETE_BUTTON_WRAPPER_ID,
|
config.put(SPUIComponetIdProvider.DELETE_BUTTON_WRAPPER_ID,
|
||||||
@@ -174,7 +126,7 @@ public class ManagementViewAcceptCriteria extends AbstractAcceptCriteria {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static Map<String, Object> createDropHintConfigurations() {
|
private static Map<String, Object> createDropHintConfigurations() {
|
||||||
final Map<String, Object> config = new HashMap<String, Object>();
|
final Map<String, Object> config = new HashMap<>();
|
||||||
config.put(SPUIDefinitions.TARGET_TAG_ID_PREFIXS, DragEvent.TARGET_TAG_DRAG);
|
config.put(SPUIDefinitions.TARGET_TAG_ID_PREFIXS, DragEvent.TARGET_TAG_DRAG);
|
||||||
config.put(SPUIComponetIdProvider.TARGET_TABLE_ID, DragEvent.TARGET_DRAG);
|
config.put(SPUIComponetIdProvider.TARGET_TABLE_ID, DragEvent.TARGET_DRAG);
|
||||||
config.put(SPUIComponetIdProvider.DIST_TABLE_ID, DragEvent.DISTRIBUTION_DRAG);
|
config.put(SPUIComponetIdProvider.DIST_TABLE_ID, DragEvent.DISTRIBUTION_DRAG);
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user