From: Henrik Andersson Date: Thu, 9 Apr 2020 12:59:26 +0000 (+0000) Subject: Merge "Added check in PUT policy" X-Git-Tag: 2.0.0~81 X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;ds=inline;h=1eeda7f570212b728bd18a5684d958bab76fa019;hp=-c;p=nonrtric.git Merge "Added check in PUT policy" --- 1eeda7f570212b728bd18a5684d958bab76fa019 diff --combined policy-agent/src/test/java/org/oransc/policyagent/ApplicationTest.java index 7015e81a,7ad2dc86..4e3fd0fa --- a/policy-agent/src/test/java/org/oransc/policyagent/ApplicationTest.java +++ b/policy-agent/src/test/java/org/oransc/policyagent/ApplicationTest.java @@@ -355,6 -355,7 +355,7 @@@ public class ApplicationTest this.addRic("ric1"); this.addRic("ricXXX"); this.addPolicy("instance1", "type1", "service1", "ric1"); + this.addPolicy("instance2", "type1", "service1", "ricXXX"); // Try change ric1 -> ricXXX String urlWrongRic = putPolicyUrl("service1", "ricXXX", "type1", "instance1"); @@@ -558,8 -559,6 +559,8 @@@ testErrorCode(restClient().put("/service", "crap"), HttpStatus.BAD_REQUEST); testErrorCode(restClient().put("/service", "{}"), HttpStatus.BAD_REQUEST); testErrorCode(restClient().put("/service", createServiceJson("name", -123)), HttpStatus.BAD_REQUEST); + testErrorCode(restClient().put("/service", createServiceJson("name", 0, "missing.portandprotocol.com")), + HttpStatus.BAD_REQUEST); // GET non existing servive testErrorCode(restClient().get("/services?name=XXX"), HttpStatus.NOT_FOUND); @@@ -613,11 -612,7 +614,11 @@@ } private String createServiceJson(String name, long keepAliveIntervalSeconds) { - ServiceRegistrationInfo service = new ServiceRegistrationInfo(name, keepAliveIntervalSeconds, "callbackUrl"); + return createServiceJson(name, keepAliveIntervalSeconds, "https://examples.javacodegeeks.com/core-java/"); + } + + private String createServiceJson(String name, long keepAliveIntervalSeconds, String url) { + ServiceRegistrationInfo service = new ServiceRegistrationInfo(name, keepAliveIntervalSeconds, url); String json = gson.toJson(service); return json;