diff options
Diffstat (limited to 'vnfmarket-be/vnf-sdk-marketplace')
-rw-r--r-- | vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vtp/VTPResource.java | 24 | ||||
-rw-r--r-- | vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vtp/error/VTPError.java | 7 |
2 files changed, 16 insertions, 15 deletions
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vtp/VTPResource.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vtp/VTPResource.java index 83158ed9..7d408e4b 100644 --- a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vtp/VTPResource.java +++ b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vtp/VTPResource.java @@ -42,12 +42,12 @@ public class VTPResource { protected static final Logger LOG = LoggerFactory.getLogger(VTPResource.class); - public static String VTP_TEST_CENTER_IP = "localhost"; - public static int VTP_TEST_CENTER_PORT = 50051; - public static String VTP_ARTIFACT_STORE = "d:/temp/data/artifacts/"; - public static String VTP_EXECUTION_TEMP_STORE = "d:/temp/data/transient"; + protected static String VTP_TEST_CENTER_IP; // NOSONAR + protected static int VTP_TEST_CENTER_PORT; // NOSONAR + protected static String VTP_ARTIFACT_STORE; // NOSONAR + protected static String VTP_EXECUTION_TEMP_STORE; // NOSONAR - public static SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS", Locale.US); + protected static final SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS", Locale.US); // NOSONAR static { dateFormatter.setTimeZone(TimeZone.getTimeZone("UTC")); @@ -59,7 +59,7 @@ public class VTPResource { VTP_TEST_CENTER_PORT = Integer.parseInt(prp.getProperty("vtp.grpc.port")); VTP_ARTIFACT_STORE = prp.getProperty("vtp.artifact.store"); VTP_EXECUTION_TEMP_STORE = prp.getProperty("vtp.file.store"); - } catch (Exception e) { + } catch (Exception e) { // NOSONAR LOG.error(e.getMessage()); } } @@ -71,9 +71,9 @@ public class VTPResource { result = OpenRemoteCli.run( VTP_TEST_CENTER_IP, VTP_TEST_CENTER_PORT, requestId, args); -// } catch(OpenInterfaceGrpcClient.OpenInterfaceGrpcTimeoutExecption e) { -// throw new VTPException( -// new VTPError().setHttpStatus(HttpStatus.SC_GATEWAY_TIMEOUT).setMessage("Timeout.").setCode(VTPError.TIMEOUT)); + } catch(OpenInterfaceGrpcClient.OpenInterfaceGrpcTimeoutExecption e) { + throw new VTPException( + new VTPError().setHttpStatus(HttpStatus.SC_GATEWAY_TIMEOUT).setMessage("Timeout.").setCode(VTPError.TIMEOUT)); } catch (Exception e) { throw new VTPException(new VTPError().setMessage(e.getMessage())); } @@ -104,9 +104,9 @@ public class VTPResource { Map <String, String> args = mapper.convertValue(argsJsonNode, Map.class); try { output = OpenRemoteCli.invoke(VTP_TEST_CENTER_IP, VTP_TEST_CENTER_PORT, scenario, profile, testCase, requestId, args); -// } catch(OpenInterfaceGrpcClient.OpenInterfaceGrpcTimeoutExecption e) { -// throw new VTPException( -// new VTPError().setHttpStatus(HttpStatus.SC_GATEWAY_TIMEOUT).setMessage(e.getMessage()).setCode(VTPError.TIMEOUT)); + } catch(OpenInterfaceGrpcClient.OpenInterfaceGrpcTimeoutExecption e) { + throw new VTPException( + new VTPError().setHttpStatus(HttpStatus.SC_GATEWAY_TIMEOUT).setMessage(e.getMessage()).setCode(VTPError.TIMEOUT)); } catch (Exception e) { throw new VTPException( new VTPError().setMessage(e.getMessage())); diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vtp/error/VTPError.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vtp/error/VTPError.java index 0f0219ed..cfe23116 100644 --- a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vtp/error/VTPError.java +++ b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vtp/error/VTPError.java @@ -26,9 +26,9 @@ public class VTPError extends VTPModelBase { private int httpStatus = HttpStatus.INTERNAL_SERVER_ERROR_500; - public static String TIMEOUT = "0x9999"; + public static final String TIMEOUT = "0x9999"; - public static String []NOT_FOUND = new String []{ + public static final String []NOT_FOUND = new String []{ "0xc002", //Profile not found "0x6003", //Command not found "0x6009", //Execution not found @@ -74,12 +74,13 @@ public class VTPError extends VTPModelBase { public static class VTPException extends Exception { private static final long serialVersionUID = -2894780740467107391L; - VTPError error; + VTPError error; // NOSONAR public VTPException(VTPError error) { this.error = error; } + @Override public String getMessage() { return this.error.toJsonString(); } |