Commit Graph

107 Commits

Author SHA1 Message Date
Avgustin Marinov
2e97d67489 Small Artifact storage refactoring (#2648)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2025-09-03 17:05:59 +03:00
Avgustin Marinov
2a636328a0 20250828 cleanup (#2639)
* Cleanup

* Refactor artifact management
2025-09-02 16:08:14 +03:00
Avgustin Marinov
bff77ac224 Cleanup TargetManagement (#2601)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2025-08-08 13:13:28 +03:00
Avgustin Marinov
43f717fc8d Improve JsonBuilder's (#2585)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2025-08-04 12:54:12 +03:00
Avgustin Marinov
a689733d4c TargetType management over common RepositoryManagement (#2581)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2025-08-01 19:24:49 +03:00
Avgustin Marinov
fd9c0fc50d Implement target tag management using common RepositoryManagement (and abstract JPA impl) (#2580)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2025-08-01 13:41:20 +03:00
Avgustin Marinov
2b66449ff1 Fine grained repository permissions (#2562)
1. Introduce @PrreAuthorize check based on hasPermission - allowing custom processing (compared with non-modifiable hasAuthority/Role processing)
2. Dedicated permissions could be implemented on management api level. Check is made by plugged in PermissionEvaluator
3. Thus common XXX_REPOSITORY permissions could differ for extending services
4. Change create/update entity builder pattern - not via EntityFactory but via clean static lombok based builders (with fine fluent api).
5. Implement abstract repository management jpa class that handles the boilerplate code from extending classes in single place consistently -> AbsreactJpaRepositoryManagement
6. Register management api-s as **Sevice**-s instead of **Bean**-s in order to make easier maintainable and get away from heavy argument forwading
7. Simplify custom hawkbit repository registration + adding proxy to handle exception mapping at lower level - thus not depending on Aspects for converting exceptions
8. Implemented general purpose 'copy' utility (ObjectCopyUtil) that using getter/setter patterns is able to copy (e.g. Create/Update) objects to other objects (e.g. JPA entity objects)
2025-07-28 14:57:33 +03:00
Avgustin Marinov
c3fdd9fcc8 Refactor permissions (#2544)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2025-07-11 16:50:01 +03:00
Avgustin Marinov
21581c4ea4 Fine-grained permissions (#2535)
* Fine-grained permissions

Adds support for permissions of type <permission>(/<rsql filter scope>)

Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>

* Apply review fixes

---------

Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2025-07-10 13:51:49 +03:00
Avgustin Marinov
edd6dabb90 Move artifact encryption to hawkbit-artifact-api where it does belong (#2540)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2025-07-10 11:57:44 +03:00
Avgustin Marinov
8c6d56f177 Make some test timeouts (await) configurable (#2525)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2025-07-02 12:45:26 +03:00
Avgustin Marinov
affae1026a Improve Spring Bus usage (remove stream direct use) (#2521)
* Improve Spring Bus usage (remove stream direct use)

Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>

* Remove getApplicaton when creating remote events

---------

Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2025-07-02 08:32:55 +03:00
Avgustin Marinov
ef25aa59f0 Fix new line after @Test (#2486)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2025-06-20 17:42:55 +03:00
Avgustin Marinov
cb7f1107fe Remove allure (phase2) (#2483)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2025-06-20 15:51:06 +03:00
Avgustin Marinov
3e1d6b6dca Remove OpenAPI registration (#2440)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2025-06-09 17:57:06 +03:00
Avgustin Marinov
5a304af165 Fix swagger config (#2437)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2025-06-09 13:21:24 +03:00
Stanislav Trailov
5e72ea4522 Set old sql translator as a fallback in eclipseLink (#2387)
* Set old sql translator as a fallback in eclipseLink

Signed-off-by: strailov <Stanislav.Trailov@bosch.io>

* small refactor

Signed-off-by: strailov <Stanislav.Trailov@bosch.io>

* fix minor code smell

Signed-off-by: strailov <Stanislav.Trailov@bosch.io>

---------

Signed-off-by: strailov <Stanislav.Trailov@bosch.io>
2025-05-02 12:18:00 +03:00
Stanislav Trailov
2a71f61cc2 Extend current SQL translator in EclipseLink (#2383)
* Extend current SQL translator in EclipseLink

* Initialize translator in static block

Signed-off-by: strailov <Stanislav.Trailov@bosch.io>

* translation methods to static

Signed-off-by: strailov <Stanislav.Trailov@bosch.io>

* handle DataIntegrityViolation in rest core

Signed-off-by: strailov <Stanislav.Trailov@bosch.io>

---------

Signed-off-by: strailov <Stanislav.Trailov@bosch.io>
2025-04-29 17:20:17 +03:00
Avgustin Marinov
70949769de Migrate to jdk 21 (#2295)
* docker containers using images with jre 21
* project is still building with target java 17 - so jar artifacts are java 17 compatible
* provided option to have different version for client libraries (e.g. ddi and management REST api)

Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2025-03-27 09:28:28 +02:00
Avgustin Marinov
406f420f4d [#1249] Don't create action statuses to log range downloads (#2261)
In case of range request:
* there could be too many action checks
* there could be too many action statuses - filling the db and hitting the quote

So, this PR skip action existing check and skip logging (following the approach
from #1331 PR by @zyga)

Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2025-01-31 13:04:11 +02:00
Avgustin Marinov
b108762d54 Simple UI: Streaming upload (#2254)
thus not loading whole artifact into memory

Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2025-01-29 13:44:31 +02:00
Avgustin Marinov
e3c41eb0b2 Fix CustomBaseRepositoryBean - not initialized in some cases (#2241)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2025-01-27 14:53:28 +02:00
Avgustin Marinov
ef4c0c6d18 Sonar Fixes (#2234)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2025-01-24 17:22:34 +02:00
Avgustin Marinov
a61e9cd6ae Sonar Fixes (#2233)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2025-01-24 15:41:06 +02:00
Avgustin Marinov
bbb5f40207 Sonar Fixes (6) (#2214)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2025-01-21 16:13:43 +02:00
Avgustin Marinov
567e8b38f1 Sonar Fixes (5) (#2211)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2025-01-21 11:20:50 +02:00
Avgustin Marinov
e317a38d6d Fix SonarQube issues (3) (#2206)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2025-01-20 17:04:07 +02:00
Avgustin Marinov
5dabe9117a Fix SonarQube issues (2) (#2205)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2025-01-20 16:29:45 +02:00
Avgustin Marinov
67c15b722a Add support for swagger tag ordering (deprecated moved to end) (#2178)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2025-01-09 12:38:13 +02:00
Avgustin Marinov
65ef31e702 Add logging for db execptons handling (#2155)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2024-12-19 16:37:57 +02:00
Avgustin Marinov
ed93d3fc7b Introduce pluggable tenant resolver (#2151)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2024-12-18 15:17:35 +02:00
Avgustin Marinov
a3468b2ba9 Fix some issues found by qodana (#2083)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2024-11-19 17:04:19 +02:00
Avgustin Marinov
9c8c82fd8b Switch from deprecated EnableGlobalMethodSecurity to EnableMethodSecurity (#2081)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2024-11-19 16:46:31 +02:00
Avgustin Marinov
c3bcc4371d Code formating and removing unused imports (#2072)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2024-11-18 09:13:58 +02:00
Avgustin Marinov
5182217745 Rename hawkbit-security-intenal -> hawkbit-security-controller (#2015)
as it is controller only related

* DmfTenantSecurityToken renamed to ControllerSecurityToken - as it is such
* hawkbit.security classes from http-security-internal moved to hawkbit.security.controller - as they are such and it is bad practice to have same package in multiple modules

_release_notes_

Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2024-11-12 12:45:09 +02:00
Avgustin Marinov
c85518be3c Split SecurityManagedConfiguration to mgmt and ddi starters (#2014)
* SecurityManagedConfiguration is moved to hawkbit-rest-core with commons for mgmt and ddi only
* Configurations for DDI and Management API are moved to respective starters
* hawkbit-http-security is removed - DosFilter (as common) is moved in hawkbit-rest-security, rest to the ddi starter as used only there
* some classes are moved into different packages - it is a bad practice to have same packet into multiple artifacts

_release_notes_

Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2024-11-12 12:06:56 +02:00
Avgustin Marinov
32acb44e31 Artifact modules moved in new hawkbit-artifact parent (#2012)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2024-11-12 09:40:44 +02:00
Avgustin Marinov
12b471464f Move FileStreamingUtil.writeMD5FileResponse in DdiRootController (#2009)
_release_notes_

Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2024-11-12 08:29:22 +02:00
Avgustin Marinov
4cc83cacbd Fix sonar finding for regex (#2004)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2024-11-11 16:11:23 +02:00
Avgustin Marinov
baab2fcf95 Move Mgmt artifacts into hawkbit-mgmt (#2003)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2024-11-11 15:57:56 +02:00
Kai Zimmermann
428e3af2bc hawkBit rest docs (management & DDI API) (#688)
* hawkBit REST docs.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Fiy gitignore.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Add to website.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Switch to generated docs.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Fix typos.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Review findings.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Otimizations.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Revert accidental checkin.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Add security link.
2018-05-24 16:10:01 +02:00
Dominic Schabel
1deb47a4db First preparation for JDK 9 (#674)
* First preparation to build HawkBit with JDK 9

Signed-off-by: Dominic Schabel <dominic.schabel@bosch-si.com>

* Reverted Mockito 2 update since it is not compiling under JDK 8 anymore

* Fix for JDK internal calls by old version

* Guava raised to 25.0-jre and CQ added.

Signed-off-by: Dominic Schabel <dominic.schabel@bosch-si.com>

* Add updated RabbitMQ http client

* Exclude test dependencies.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Exclusions for unnecessary Guava dependencies added

Signed-off-by: Dominic Schabel <dominic.schabel@bosch-si.com>

* Remove provided annotation dependency for maven plugin

Signed-off-by: Dominic Schabel <dominic.schabel@bosch-si.com>
2018-05-14 09:32:12 +02:00
Stefan Behl
607cf92a9e Feature Reset Target Attributes (#664)
* Enhance DDI putConfigData REST entry point with update mode

Signed-off-by: stefbehl <stefan.behl@bosch-si.com>

* ControllerManagement unit tests for new target attribute update modes

Signed-off-by: stefbehl <stefan.behl@bosch-si.com>

* Added DdiRootControllerRestApi test for new update mode

Signed-off-by: stefbehl <stefan.behl@bosch-si.com>

* Enhance DMF UPDATE_ATTRIBUTES message with update mode

Signed-off-by: stefbehl <stefan.behl@bosch-si.com>

* Enhance DMF integration tests

Signed-off-by: stefbehl <stefan.behl@bosch-si.com>

* Enhance DMF integration tests

Signed-off-by: stefbehl <stefan.behl@bosch-si.com>

* Fix DMF integration tests

* Fix failing tests

Signed-off-by: stefbehl <stefan.behl@bosch-si.com>

* Fix failing tests

Signed-off-by: stefbehl <stefan.behl@bosch-si.com>

* Fix Sonar findings

Signed-off-by: stefbehl <stefan.behl@bosch-si.com>

* Javadoc improvements

Signed-off-by: stefbehl <stefan.behl@bosch-si.com>

* Fix codacy findings

Signed-off-by: Stefan Behl <stefan.behl@bosch-si.com>

* Fix PR review findings

Signed-off-by: Stefan Behl <stefan.behl@bosch-si.com>

* Fix PR review findings

Signed-off-by: Stefan Behl <stefan.behl@bosch-si.com>

* Fix PR review findings

Signed-off-by: Stefan Behl <stefan.behl@bosch-si.com>

* Fix PR review findings

Signed-off-by: Stefan Behl <stefan.behl@bosch-si.com>

* Fix PR review findings

Signed-off-by: Stefan Behl <stefan.behl@bosch-si.com>

* Fix PR review findings

Signed-off-by: Stefan Behl <stefan.behl@bosch-si.com>

* Fix PR review findings

Signed-off-by: Stefan Behl <stefan.behl@bosch-si.com>
2018-03-26 17:50:20 +02:00
stormc
f4278c45ef 245 maintenance window (#535)
* Maintenance Window: Introduced dynamic update to polling time. (#245)

Resolves #245

Added new configuration parameters and controller handling that can be
used to enable reduction in polling time near to start of a maintenance
window.

- The device may only get to know of start of maintenance window when
the device polls the server. If a window is available, server responds
with maintenanceWindow as 'available' and the update as 'forced'. Hence,
as the time for start of a maintenance window approaches, the device
should poll the server more often in order to decrease the possibility
of missing the maintenance window start time due to non-alignment of
polling with the start time, or due to packet losses and other network
issues.

- Additional configuration parameter is introduced that will be used to
specify the minimum number of times the controller should poll between
current time and the start of maintenance window. Using this parameter,
an "inverse exponential back-off" scheme for reducing the polling time
is implemented.

- Implemented inverse exponential back-off for polling.
For example, considering default polling-time = 00:05:00,
min-polling-time = 00:00:30, maintenance-window-poll-count = 3, we
expect that controller should poll the server 3 times between current
time and start of a maintenance window. Thus in following scenario
controller will get to know of start of maintenance 3 secs after
scheduled start. Whereas without this scheme, delay may be as much as 4
minutes.
time until start: 00:21:00; polling time: 00:05:00
time until start: 00:16:00; polling time: 00:05:00
time until start: 00:11:00; polling time: 00:03:40
time until start: 00:07:20; polling time: 00:02:27
time until start: 00:04:53; polling time: 00:01:38
time until start: 00:02:10; polling time: 00:00:43
time until start: 00:01:27; polling time: 00:00:30
time until start: 00:00:57; polling time: 00:00:30
time until start: 00:00:27; polling time: 00:00:30
time until start: -00:00:03; polling time: 00:05:00

- Once a maintenance window starts, the polling time is reverted to
default. Polling time is not changed near the end of a maintenance
window.

Signed-off-by: Christian Storm <christian.storm@siemens.com>
Signed-off-by: Himanshu Kumar Singh <himanshu.singh@siemens.com>
Signed-off-by: Raju HS <raju.hs@siemens.com>

* Maintenance Window: Updated the DMF API.

Added maintenance window handling for DMF API. Currently no timer or
scheduler is used to send updates to devices when a maintenance window
becomes available. The device can simulate a poll behaviour by sending a
message on UPDATE_ACTION_STATUS topic. Depending on whether there is a
maintenance window available or not, server should send
DOWNLOAD_AND_INSTALL or DOWNLOAD_AND_SKIP.

- Additional action status (DOWNLOADED) and event topic
(DOWNLOAD_AND_SKIP)

- Server sends DOWNLOAD_AND_SKIP or DOWNLOAD_AND_INSTALL based on
maintenance window using ControllerManagement

Signed-off-by: Christian Storm <christian.storm@siemens.com>
Signed-off-by: Himanshu Kumar Singh <himanshu.singh@siemens.com>
Signed-off-by: Raju HS <raju.hs@siemens.com>

* Maintenance Window: Added tests for DDI and Management APIs.

Added test cases for DDI and Management API to test for maintenance
window related logic.

- Tests for Management API for DistributionSet assignment with and
without valid maintenance schedule specified.

- Tests for lapsed maintenance schedule.

- Additional test helper methods.

Signed-off-by: Christian Storm <christian.storm@siemens.com>
Signed-off-by: Himanshu Kumar Singh <himanshu.singh@siemens.com>
Signed-off-by: Raju HS <raju.hs@siemens.com>

* Maintenance Window: Added new fields, enums, APIs and helper classes.

Extended the data model and Action API to support maintenance schedule.
Also provided helper classes to parse cron expression and calculate
maintenance window based on the schedule.

- DOWNLOADED status added to Action interface for controller to record
action status.

- Extra fields and APIs are added to Action to set schedule, duration
and time zone of maintenance window.

- Maintenance schedule can be defined using: a cron expression (e.g. "0
30 10-13 ? * WED,FRI" for 30 minutes past the hour, between 10:00 AM
and 01:59 PM, only on Wednesday and Friday), a duration (e.g. "00:30:00"
for 30 minutes) and the time zone (e.g. "+02:00" for CET summer time or
"+00:00" for UTC) relative to which maintenance window start time is
calculated.

- Extra APIs added to check if a maintenance schedule is defined or
lapsed and if a maintenance window is available based on the schedule.

- Added database fields to store the schedule, duration and timezone of
maintenance window.

- Added helper classes to parse and calculate the maintenance window
schedule.

- Added exception handling classes to handle invalid maintenance window
schedule.

Signed-off-by: Christian Storm <christian.storm@siemens.com>
Signed-off-by: Himanshu Kumar Singh <himanshu.singh@siemens.com>
Signed-off-by: Raju HS <raju.hs@siemens.com>

* Maintenance Window: Extended JSON model for REST APIs.

Extended the JSON model to support defining and communicating the
maintenance window information using the REST APIs.

- Additional JSON objects are defined to extend request and response
bodies.

- When requesting a distribution set assignment to a target, the
maintenance schedule information can be specified. Example below
specifies a maintenance schedule at 11:00 PM, only on Saturday, only in
2017, for 30 minutes. Maintenance window start time is then calculated
relative to the time zone specified, in this case CET summer time.
$ curl 'http://127.0.0.1:8080/rest/v1/targets/2/assignedDS' -i -X POST
-H 'Content-Type: application/json;charset=UTF-8' -d '{
    "forcetime" : "0",
    "id" : "1",
    "type" : "forced",
    "maintenanceWindow": {
        "schedule": "0 0 23 ? * SAT 2017",
        "duration": "00:30:00",
        "timezone": "+02:00"
    }
}'

- When device requests the action information it gets to know if there
is a 'maintenance schedule' for this action or not based on presence of
maintenanceWindow field in the response. The value of maintenanceWindow
is either 'available' (i.e. the maintenance window is now available as
per defined schedule and the update can progress) or 'unavailable'
(implying that maintenance window is not available now and update should
not be attempted). If there is no 'maintenance schedule' defined, the
field is null or not present.
$ curl
'http://127.0.0.1:8080/default/controller/v1/2/deploymentBase/1?c=411629670'
-i -H 'Accept: application/hal+json'
HTTP/1.1 200 OK
Content-Type: application/hal+json;charset=UTF-8
Content-Length: 1665
{
    "id": "1",
    "deployment": {
        "download": "forced",
        "update": "forced",
        "chunks": [ {
            "part": "os",
            "version": "1",
            "name": "1",
            "artifacts" : [ {
                "filename" : "binary.tgz",
                "hashes" : {
                    "sha1" : "8b71973e835cd0718827238b1cf89f0079e44dae",
                    "md5" : "a90218782025c48e09ba0436cf30d029"
                },
                "size" : 5,
               "_links" : {
                    "download" : {
                        "href" :
"http://127.0.0.1:8080/api/v1/default/download/controller/2/softwaremodules/8/filename/binary.tgz"
                    },
                    "md5sum" : {
                        "href" :
"http://127.0.0.1:8080/api/v1/default/download/controller/2/softwaremodules/8/filename/binary.tgz.MD5SUM"
                    },
                    "download-http" : {
                        "href" :
"http://127.0.0.1:8080/api/v1/default/download/controller/2/softwaremodules/8/filename/binary.tgz"
                    },
                    "md5sum-http" : {
                        "href" :
"http://127.0.0.1:8080/api/v1/default/download/controller/2/softwaremodules/8/filename/binary.tgz.MD5SUM"
                    }
                }
            } ]
        } ],
        "maintenanceWindow": "available"
    }
}

Signed-off-by: Christian Storm <christian.storm@siemens.com>
Signed-off-by: Himanshu Kumar Singh <himanshu.singh@siemens.com>
Signed-off-by: Raju HS <raju.hs@siemens.com>

* Maintenance Window: Added additional UI elements.

Added additional UI elements to specify maintenance window schedule in
hawkBit UI while assigning distribution set(s) to target(s).

- Added UI control to hawkBit UI when distribution set assignment is
confirmed.

- Also added required theme updates and resource strings.

Signed-off-by: Christian Storm <christian.storm@siemens.com>
Signed-off-by: Himanshu Kumar Singh <himanshu.singh@siemens.com>
Signed-off-by: Raju HS <raju.hs@siemens.com>

* Maintenance Window: Modified DDI and Mgmt APIs for maintenance window.

Modified controller management and deployment management to handle
maintenance window schedule in Management API and DDI API.

- Modified REST endpoints to accept and respond with maintenance window
information.

$ curl 'http://127.0.0.1:8080/rest/v1/targets/2/assignedDS' -i -X POST
-H 'Content-Type: application/json;charset=UTF-8' -d '{
    "forcetime" : "0",
    "id" : "1",
    "type" : "forced",
    "maintenanceWindow": {
        "schedule": "0 0 23 ? * SAT 2017",
        "duration": "00:30:00",
        "timezone": "+02:00"
    }
}'

- Check for availability of a maintenance window based on the schedule.

- Device gets go-ahead to install by change in ETAG and 'update' status
to 'forced' when it polls during an available maintenance window.

$ curl
'http://127.0.0.1:8080/default/controller/v1/2/deploymentBase/1?c=411659461'
-i -H 'Accept: application/hal+json'
HTTP/1.1 200 OK
Content-Type: application/hal+json;charset=UTF-8
Content-Length: 1665
{
    "id": "1",
    "deployment": {
        "download": "forced",
        "update": "forced",
        "chunks": [ {
            "part": "os",
            "version": "1",
            "name": "1",
            "artifacts" : [ {
                "filename" : "binary.tgz",
                "hashes" : {
                    "sha1" : "8b71973e835cd0718827238b1cf89f0079e44dae",
                    "md5" : "a90218782025c48e09ba0436cf30d029"
                },
                "size" : 5,
                "_links" : {
                    "download" : {
                        "href" :
"http://127.0.0.1:8080/api/v1/default/download/controller/2/softwaremodules/8/filename/binary.tgz"
                    },
                    "md5sum" : {
                        "href" :
"http://127.0.0.1:8080/api/v1/default/download/controller/2/softwaremodules/8/filename/binary.tgz.MD5SUM"
                    },
                    "download-http" : {
                        "href" :
"http://127.0.0.1:8080/api/v1/default/download/controller/2/softwaremodules/8/filename/binary.tgz"
                    },
                    "md5sum-http" : {
                        "href" :
"http://127.0.0.1:8080/api/v1/default/download/controller/2/softwaremodules/8/filename/binary.tgz.MD5SUM"
                    }
                }
            } ]
        } ],
        "maintenanceWindow": "available"
    }
}

- In case the current available maintenance window lapses, the device is
again sent 'update' status as 'skip'. The device may choose then to
abort the update and restart during next available window.

$ curl
'http://127.0.0.1:8080/default/controller/v1/2/deploymentBase/1?c=411659455'
-i -H 'Accept: application/hal+json'
HTTP/1.1 200 OK
Content-Type: application/hal+json;charset=UTF-8
Content-Length: 1665
{
    "id": "1",
    "deployment": {
        "download": "forced",
        "update": "skip",
        "chunks": [ {
            "part": "os",
            "version": "1",
            "name": "1",
            "artifacts" : [ {
                "filename" : "binary.tgz",
                "hashes" : {
                    "sha1" : "8b71973e835cd0718827238b1cf89f0079e44dae",
                    "md5" : "a90218782025c48e09ba0436cf30d029"
                },
                "size" : 5,
                "_links" : {
                    "download" : {
                        "href" :
"http://127.0.0.1:8080/api/v1/default/download/controller/2/softwaremodules/8/filename/binary.tgz"
                    },
                    "md5sum" : {
                        "href" :
"http://127.0.0.1:8080/api/v1/default/download/controller/2/softwaremodules/8/filename/binary.tgz.MD5SUM"
                    },
                    "download-http" : {
                        "href" :
"http://127.0.0.1:8080/api/v1/default/download/controller/2/softwaremodules/8/filename/binary.tgz"
                    },
                    "md5sum-http" : {
                        "href" :
"http://127.0.0.1:8080/api/v1/default/download/controller/2/softwaremodules/8/filename/binary.tgz.MD5SUM"
                    }
                }
            } ]
        } ],
        "maintenanceWindow": "unavailable"
    }
}

- In case the entire maintenance schedule lapses, before device is able
to send the completed status, the action is canceled.

$ curl 'http://127.0.0.1:8080/default/controller/v1/2' -i -H 'Accept:
application/hal+json'
HTTP/1.1 200 OK
Content-Type: application/hal+json;charset=UTF-8
Content-Length: 340
{
    "config": {
        "polling": {
        "sleep": "00:05:00"
        }
    },
    "_links": {
        "cancelAction": {
            "href":
"http://127.0.0.1:8080/default/controller/v1/2/cancelAction/1"
        },
        "configData": {
            "href":
"http://127.0.0.1:8080/default/controller/v1/2/configData"
        }
    }
}

Signed-off-by: Christian Storm <christian.storm@siemens.com>
Signed-off-by: Himanshu Kumar Singh <himanshu.singh@siemens.com>
Signed-off-by: Raju HS <raju.hs@siemens.com>
2018-03-06 16:17:31 +01:00
Kai Zimmermann
d3cb9bb24d Improvements repository validation constraints (#626)
* Add html tag Validator on strings. Add string trim.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Revert unintended changes. Sonar issues.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Remove weired comment.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Raise EclipseLink due to validation problem.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Fix permission.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Colour field test.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Fix sonar issues.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>
2018-02-12 14:56:36 +01:00
Kai Zimmermann
96a8ad0461 Artefact last modified is returned my DMF auth call (#600)
* Last modified is stored as part of artifact and returns accordingly by
APIs.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Fixed tests.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Check value > 0

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Use created at.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Sonar issue fixed.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>
2018-02-06 08:32:36 +01:00
Kai Zimmermann
09b24fa97d Cleanup file streaming utilities (#559)
* Cleanup file streaming.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Added missing comments.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Fix typo.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Split utility class.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Dependency cleanup.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Add missing dependency,

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Remove repository api dependency from rest core.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Fix build and sonar issues.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Remove custom ConstraintViolationException

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* RequestMapping should be public.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Fix errors.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Removed dead code.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Not null

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Fix nullpointer.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Code cleanup.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>
2017-07-19 12:43:07 +02:00
Kai Zimmermann
66feae2756 DosFilter can be disabled. (#561)
* DosFilter can be disabled.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Moved filters our of security core.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Move caffeine dependency.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>
2017-07-13 12:52:00 +02:00
Kai Zimmermann
f142cb4142 Test and build performance improvements (#552)
* Small build perf improvements.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Remove dead code. Stabilize test.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Further optimizations

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Upgrade mariadb driver.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Raise timeouts for more robustness on slower build environments.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Move webappcontext into rest tests.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Raised timeout.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Remove test dependency on target to groups distribution order.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Code reuse.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Context available to tests.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Typos fixed.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Fix PollEvent send.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Fix typos.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Test log readability and removed unused method from CM.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Remove empty payload.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Stabilize tests.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Raised timeout.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Fixed fire directory change during one test class run.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>
2017-07-10 09:32:53 +02:00
Kai Zimmermann
352bfcff24 New repository quota on messages per ActionStatus (#531)
* New quotaexception for repository quota hit on DDI. Added actionstatus
messages quota.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Remove special log handling on the quota exception.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Raise time for slow machines.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Update allure to get rid of log spam in unit tests.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Typos fixed.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>
2017-06-08 06:34:47 +02:00