Added support for cdn download url for mgmt API and tests
Signed-off-by: Shruthi Manavalli Ramanna <shruthimanavalli.ramanna@bosch-si.com>
This commit is contained in:
@@ -22,5 +22,10 @@ public enum ApiType {
|
||||
/**
|
||||
* Support for Direct Device Integration API.
|
||||
*/
|
||||
DDI
|
||||
DDI,
|
||||
|
||||
/**
|
||||
* Support for Management API.
|
||||
*/
|
||||
MGMT
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ public class ArtifactUrlHandlerProperties {
|
||||
* artifactFileName,artifactSHA1,
|
||||
* artifactIdBase62,artifactId,tenant,softwareModuleId,
|
||||
* softwareModuleIdBase62.
|
||||
*
|
||||
*
|
||||
* The update server itself supports
|
||||
*/
|
||||
private String ref = "{protocol}://{hostname}:{port}/{tenant}/controller/v1/{controllerId}/softwaremodules/{softwareModuleId}/artifacts/{artifactFileName}";
|
||||
@@ -84,7 +84,7 @@ public class ArtifactUrlHandlerProperties {
|
||||
/**
|
||||
* Support for the following hawkBit API.
|
||||
*/
|
||||
private List<ApiType> supports = Arrays.asList(ApiType.DDI, ApiType.DMF);
|
||||
private List<ApiType> supports = Arrays.asList(ApiType.DDI, ApiType.DMF, ApiType.MGMT);
|
||||
|
||||
public boolean isEnabled() {
|
||||
return enabled;
|
||||
|
||||
@@ -104,7 +104,9 @@ public class PropertyBasedArtifactUrlHandler implements ArtifactUrlHandler {
|
||||
urlPattern = urlPattern.replace(":{" + entry.getKey() + "}",
|
||||
StringUtils.isEmpty(entry.getValue()) ? "" : (":" + entry.getValue()));
|
||||
} else {
|
||||
urlPattern = urlPattern.replace("{" + entry.getKey() + "}", entry.getValue());
|
||||
if(entry.getValue() != null) {
|
||||
urlPattern = urlPattern.replace("{" + entry.getKey() + "}", entry.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
return urlPattern;
|
||||
@@ -135,7 +137,9 @@ public class PropertyBasedArtifactUrlHandler implements ArtifactUrlHandler {
|
||||
replaceMap.put(TENANT_ID_BASE62_PLACEHOLDER, Base62Util.fromBase10(placeholder.getTenantId()));
|
||||
replaceMap.put(CONTROLLER_ID_PLACEHOLDER, placeholder.getControllerId());
|
||||
replaceMap.put(TARGET_ID_BASE10_PLACEHOLDER, String.valueOf(placeholder.getTargetId()));
|
||||
replaceMap.put(TARGET_ID_BASE62_PLACEHOLDER, Base62Util.fromBase10(placeholder.getTargetId()));
|
||||
if(placeholder.getTargetId() != null) {
|
||||
replaceMap.put(TARGET_ID_BASE62_PLACEHOLDER, Base62Util.fromBase10(placeholder.getTargetId()));
|
||||
}
|
||||
replaceMap.put(ARTIFACT_ID_BASE62_PLACEHOLDER,
|
||||
Base62Util.fromBase10(placeholder.getSoftwareData().getArtifactId()));
|
||||
replaceMap.put(ARTIFACT_ID_BASE10_PLACEHOLDER, String.valueOf(placeholder.getSoftwareData().getArtifactId()));
|
||||
|
||||
Reference in New Issue
Block a user