summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRishi Chail <rishi.chail@est.tech>2020-10-09 09:00:24 +0100
committerToine Siebelink <toine.siebelink@est.tech>2020-10-09 08:11:42 +0000
commit21173da7370016c46a840e2595ecfe0a3d1558ac (patch)
treec5e1e8367cc5e8d5464647ad16620c7544d24961
parent8af414a6c52e2e0d5d6a87581122b8e4ae86cb00 (diff)
IS: Correct REST base Url
Issue-ID: CCSDK-2870 https://jira.onap.org/browse/CCSDK-2870 Signed-off-by: Rishi Chail <rishi.chail@est.tech> Change-Id: I72afa3057a06a5af2507f8e45fe53230603d45ac
-rw-r--r--cps/cps-rest/src/main/java/org/onap/cps/rest/config/JerseyConfig.java2
-rw-r--r--cps/cps-rest/src/main/java/org/onap/cps/rest/controller/RestController.java27
-rw-r--r--cps/cps-ri/src/main/resources/schema.sql (renamed from cps/cps-rest/src/main/resources/schema.sql)5
3 files changed, 13 insertions, 21 deletions
diff --git a/cps/cps-rest/src/main/java/org/onap/cps/rest/config/JerseyConfig.java b/cps/cps-rest/src/main/java/org/onap/cps/rest/config/JerseyConfig.java
index ea273986c..290ad5d9e 100644
--- a/cps/cps-rest/src/main/java/org/onap/cps/rest/config/JerseyConfig.java
+++ b/cps/cps-rest/src/main/java/org/onap/cps/rest/config/JerseyConfig.java
@@ -31,7 +31,7 @@ import org.glassfish.jersey.server.ResourceConfig;
import org.springframework.context.annotation.Configuration;
@Configuration
-@ApplicationPath("/api/v1")
+@ApplicationPath("/api/cps")
public class JerseyConfig extends ResourceConfig {
/**
diff --git a/cps/cps-rest/src/main/java/org/onap/cps/rest/controller/RestController.java b/cps/cps-rest/src/main/java/org/onap/cps/rest/controller/RestController.java
index 2cac690b1..68d101f3b 100644
--- a/cps/cps-rest/src/main/java/org/onap/cps/rest/controller/RestController.java
+++ b/cps/cps-rest/src/main/java/org/onap/cps/rest/controller/RestController.java
@@ -40,7 +40,8 @@ import org.opendaylight.yangtools.yang.model.parser.api.YangParserException;
import org.springframework.beans.factory.annotation.Autowired;
-@Path("cps")
+
+@Path("v1")
public class RestController {
@Autowired
@@ -53,7 +54,7 @@ public class RestController {
* @return a http response code.
*/
@POST
- @Path("upload-yang-model-file")
+ @Path("/upload-yang-model-file")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.MULTIPART_FORM_DATA)
public final Response uploadYangModelFile(@FormDataParam("file") File uploadedFile) throws IOException {
@@ -62,9 +63,9 @@ public class RestController {
final SchemaContext schemaContext = cpService.parseAndValidateModel(fileToParse);
cpService.storeSchemaContext(schemaContext);
return Response.status(Status.OK).entity("Yang File Parsed").build();
- } catch (YangParserException e) {
+ } catch (final YangParserException e) {
return Response.status(Status.BAD_REQUEST).entity(e.getMessage()).build();
- } catch (Exception e) {
+ } catch (final Exception e) {
return Response.status(Status.INTERNAL_SERVER_ERROR).entity(e.getMessage()).build();
}
}
@@ -76,7 +77,7 @@ public class RestController {
* @return a http response code.
*/
@POST
- @Path("upload-yang-json-data-file")
+ @Path("/upload-yang-json-data-file")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.MULTIPART_FORM_DATA)
public final Response uploadYangJsonDataFile(@FormDataParam("file") String uploadedFile) {
@@ -85,9 +86,9 @@ public class RestController {
final int persistenceObjectId = cpService.storeJsonStructure(uploadedFile);
return Response.status(Status.OK).entity("Object stored in CPS with identity: " + persistenceObjectId)
.build();
- } catch (JsonSyntaxException e) {
+ } catch (final JsonSyntaxException e) {
return Response.status(Status.BAD_REQUEST).entity(e.getMessage()).build();
- } catch (Exception e) {
+ } catch (final Exception e) {
return Response.status(Status.INTERNAL_SERVER_ERROR).entity(e.getMessage()).build();
}
}
@@ -99,13 +100,13 @@ public class RestController {
* @return a HTTP response.
*/
@GET
- @Path("json-object/{id}")
+ @Path("/json-object/{id}")
public final Response getJsonObjectById(@PathParam("id") int jsonObjectId) {
try {
return Response.status(Status.OK).entity(cpService.getJsonById(jsonObjectId)).build();
- } catch (PersistenceException e) {
+ } catch (final PersistenceException e) {
return Response.status(Status.NOT_FOUND).entity(e.getMessage()).build();
- } catch (Exception e) {
+ } catch (final Exception e) {
return Response.status(Status.INTERNAL_SERVER_ERROR).entity(e.getMessage()).build();
}
}
@@ -123,8 +124,4 @@ public class RestController {
originalFile.renameTo(renamedFile);
return renamedFile;
}
-}
-
-
-
-
+} \ No newline at end of file
diff --git a/cps/cps-rest/src/main/resources/schema.sql b/cps/cps-ri/src/main/resources/schema.sql
index 446d6e584..05d31d92f 100644
--- a/cps/cps-rest/src/main/resources/schema.sql
+++ b/cps/cps-ri/src/main/resources/schema.sql
@@ -1,8 +1,3 @@
-/* Initialisation script for CPS.
-
-To be moved to cps-ri in Honolulu. */
-
-
CREATE TABLE IF NOT EXISTS RELATION_TYPE
(
RELATION_TYPE TEXT NOT NULL,