IS: Correct REST base Url
authorRishi Chail <rishi.chail@est.tech>
Fri, 9 Oct 2020 08:00:24 +0000 (09:00 +0100)
committerToine Siebelink <toine.siebelink@est.tech>
Fri, 9 Oct 2020 08:11:42 +0000 (08:11 +0000)
Issue-ID: CCSDK-2870
https://jira.onap.org/browse/CCSDK-2870

Signed-off-by: Rishi Chail <rishi.chail@est.tech>
Change-Id: I72afa3057a06a5af2507f8e45fe53230603d45ac

cps/cps-rest/src/main/java/org/onap/cps/rest/config/JerseyConfig.java
cps/cps-rest/src/main/java/org/onap/cps/rest/controller/RestController.java
cps/cps-ri/src/main/resources/schema.sql [moved from cps/cps-rest/src/main/resources/schema.sql with 93% similarity]

index ea27398..290ad5d 100644 (file)
@@ -31,7 +31,7 @@ import org.glassfish.jersey.server.ResourceConfig;
 import org.springframework.context.annotation.Configuration;\r
 \r
 @Configuration\r
-@ApplicationPath("/api/v1")\r
+@ApplicationPath("/api/cps")\r
 public class JerseyConfig extends ResourceConfig {\r
 \r
     /**\r
index 2cac690..68d101f 100644 (file)
@@ -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
similarity index 93%
rename from cps/cps-rest/src/main/resources/schema.sql
rename to cps/cps-ri/src/main/resources/schema.sql
index 446d6e5..05d31d9 100644 (file)
@@ -1,8 +1,3 @@
-/*  Initialisation script for CPS.\r
-\r
-To be moved to cps-ri in Honolulu.  */\r
-\r
-\r
 CREATE TABLE IF NOT EXISTS RELATION_TYPE\r
 (\r
     RELATION_TYPE TEXT NOT NULL,\r