aboutsummaryrefslogtreecommitdiffstats
path: root/appc-inbound/appc-artifact-handler/provider/src/main
diff options
context:
space:
mode:
authorJoss Armstrong <joss.armstrong@ericsson.com>2019-01-21 20:29:19 +0000
committerTakamune Cho <takamune.cho@att.com>2019-01-22 15:07:14 +0000
commit27543757355a584901f8d2cb5ca0b2dffe31a628 (patch)
treef643e3d94a03e18468d84d4fe09bedb20286b871 /appc-inbound/appc-artifact-handler/provider/src/main
parent1f28945a3c5d1a4ffc74edc815cf502d715e33ac (diff)
Coverage for appc-artifact-handler package
Increased coverage from 0% to 95% Issue-ID: APPC-1335 Change-Id: I3c2e1f22009c47cda983e61eda7e98c48564ee98 Signed-off-by: Joss Armstrong <joss.armstrong@ericsson.com>
Diffstat (limited to 'appc-inbound/appc-artifact-handler/provider/src/main')
-rw-r--r--appc-inbound/appc-artifact-handler/provider/src/main/java/org/onap/appc/artifact/handler/ArtifactHandlerProvider.java31
-rw-r--r--appc-inbound/appc-artifact-handler/provider/src/main/java/org/onap/appc/artifact/handler/SdcArtifactHandlerActivator.java4
2 files changed, 20 insertions, 15 deletions
diff --git a/appc-inbound/appc-artifact-handler/provider/src/main/java/org/onap/appc/artifact/handler/ArtifactHandlerProvider.java b/appc-inbound/appc-artifact-handler/provider/src/main/java/org/onap/appc/artifact/handler/ArtifactHandlerProvider.java
index 5bfdf96b8..9ca1f44a4 100644
--- a/appc-inbound/appc-artifact-handler/provider/src/main/java/org/onap/appc/artifact/handler/ArtifactHandlerProvider.java
+++ b/appc-inbound/appc-artifact-handler/provider/src/main/java/org/onap/appc/artifact/handler/ArtifactHandlerProvider.java
@@ -5,6 +5,8 @@
* Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Copyright (C) 2017 Amdocs
+ * ================================================================================
+ * Modifications Copyright (C) 2019 Ericsson
* =============================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -145,19 +147,19 @@ public class ArtifactHandlerProvider implements AutoCloseable, ArtifactHandlerSe
String finalInd) {
UploadartifactOutputBuilder responseBuilder = new UploadartifactOutputBuilder();
- ConfigDocumentResponseBuilder configResponseBuilder=new ConfigDocumentResponseBuilder();
- configResponseBuilder.setRequestId(svcRequestId);
- configResponseBuilder.setStatus(code);
- configResponseBuilder.setErrorReason(message);
+ ConfigDocumentResponseBuilder configResponseBuilder=new ConfigDocumentResponseBuilder();
+ configResponseBuilder.setRequestId(svcRequestId);
+ configResponseBuilder.setStatus(code);
+ configResponseBuilder.setErrorReason(message);
RpcResult<UploadartifactOutput> rpcResult = RpcResultBuilder.<UploadartifactOutput> status(true)
.withResult(responseBuilder.build()).build();
- return rpcResult;
+ return rpcResult;
}
@Override
public Future<RpcResult<UploadartifactOutput>> uploadartifact(UploadartifactInput input) {
- if (input == null || input.getDocumentParameters() == null || input.getDocumentParameters().getArtifactContents() == null ) {
+ if (input == null || input.getDocumentParameters() == null || input.getDocumentParameters().getArtifactContents() == null ) {
RpcResult<UploadartifactOutput> rpcResult =
buildResponse1("N/A", "N/A", "INVALID_INPUT", "Invalid input, null or empty document information" , "Y");
return Futures.immediateFuture(rpcResult);
@@ -166,10 +168,9 @@ public class ArtifactHandlerProvider implements AutoCloseable, ArtifactHandlerSe
ConfigDocumentResponseBuilder configResponseBuilder = new ConfigDocumentResponseBuilder();
UploadartifactOutputBuilder responseBuilder = new UploadartifactOutputBuilder();
log.info("Received input = " + input );
- ArtifactHandlerProviderUtil designUtil = new ArtifactHandlerProviderUtil(input);
+ ArtifactHandlerProviderUtil designUtil = getArtifactHandlerProviderUtil(input);
configResponseBuilder.setRequestId(input.getRequestInformation().getRequestId());
try{
-
if(input.getRequestInformation().getSource() !=null){
if(input.getRequestInformation().getSource().equalsIgnoreCase(SdcArtifactHandlerConstants.DESIGN_TOOL)){
designUtil.processTemplate(designUtil.createDummyRequestData());
@@ -178,27 +179,29 @@ public class ArtifactHandlerProvider implements AutoCloseable, ArtifactHandlerSe
else
{
designUtil.processTemplate(designUtil.createRequestData());
- configResponseBuilder.setStatus(ArtifactHandlerProviderUtil.DistributionStatusEnum.DEPLOY_OK.toString());
+ configResponseBuilder.setStatus(ArtifactHandlerProviderUtil.DistributionStatusEnum.DEPLOY_OK.toString());
}
}
else
{
- throw new Exception("No Tempalte data found");
+ throw new Exception("No Template data found");
}
-
-
}
catch (Exception e) {
- configResponseBuilder.setErrorReason(e.getMessage());
+ configResponseBuilder.setErrorReason(e.getMessage());
configResponseBuilder.setStatus(ArtifactHandlerProviderUtil.DistributionStatusEnum.DEPLOY_ERROR.toString());
log.error("Caught exception looking for Artifact Handler", e);
log.info("Caught exception looking for Artifact Handler: ");
}
-
+
responseBuilder.setConfigDocumentResponse(configResponseBuilder.build());
RpcResult<UploadartifactOutput> rpcResult = RpcResultBuilder.<UploadartifactOutput> status(true).withResult(responseBuilder.build()).build();
return Futures.immediateFuture(rpcResult);
}
+
+ protected ArtifactHandlerProviderUtil getArtifactHandlerProviderUtil(UploadartifactInput input) {
+ return new ArtifactHandlerProviderUtil(input);
+ }
}
diff --git a/appc-inbound/appc-artifact-handler/provider/src/main/java/org/onap/appc/artifact/handler/SdcArtifactHandlerActivator.java b/appc-inbound/appc-artifact-handler/provider/src/main/java/org/onap/appc/artifact/handler/SdcArtifactHandlerActivator.java
index 5a62f7b23..58f4a12ed 100644
--- a/appc-inbound/appc-artifact-handler/provider/src/main/java/org/onap/appc/artifact/handler/SdcArtifactHandlerActivator.java
+++ b/appc-inbound/appc-artifact-handler/provider/src/main/java/org/onap/appc/artifact/handler/SdcArtifactHandlerActivator.java
@@ -5,6 +5,8 @@
* Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Copyright (C) 2017 Amdocs
+ * ================================================================================
+ * Modifications Copyright (C) 2019 Ericsson
* =============================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -38,7 +40,7 @@ public class SdcArtifactHandlerActivator implements BundleActivator {
private static final EELFLogger log = EELFManager.getInstance().getLogger(SdcArtifactHandlerActivator.class);
private List<ServiceRegistration> registrations = new LinkedList<ServiceRegistration>();
-
+
@Override
public void start(BundleContext ctx) throws Exception {
ArtifactHandlerNode artifactHandlerNode = new ArtifactHandlerNode();