[SECIOTSRK-686] Fix REST Api for DSM & MQ
authorm.dalakov <m.dalakov@samsung.com>
Wed, 8 Nov 2017 17:22:32 +0000 (19:22 +0200)
committerm.dalakov <m.dalakov@samsung.com>
Wed, 8 Nov 2017 17:22:32 +0000 (19:22 +0200)
servers/api-integration-tests/src/test/java/com/samsung/ci/test/mq/PolicyWitoutCloudTest.java
servers/api-integration-tests/src/test/java/com/samsung/ci/test/mq/ReportsWithOutCloudTest.java
servers/api-integration-tests/src/test/java/com/samsung/ci/test/reports/RestRuleReportsTest.java
servers/dsm/src/main/java/com/samsung/dsm/rest/policy/PolicyApi.java
servers/dsm/src/main/java/com/samsung/dsm/rest/report/ReportApi.java
servers/mq/src/main/java/com/samsung/servermq/utils/rest/DsmApiImpl.java

index c7e093d..1225fef 100644 (file)
@@ -38,8 +38,6 @@ import com.samsung.ci.test.useractions.BasicUserAction;
  * @par LLC "Samsung Electronics Co", Ltd (Seoul, Republic of Korea)
  * @par Copyright : (c) Samsung Electronics Co, Ltd 2017. All rights reserved.
  */
-@Disabled
-@Ignore
 public class PolicyWitoutCloudTest extends BasicUserAction {
 
     private static final String DEVICE_DUID = "00000000-1111-2222-3333-4444444444444";
@@ -118,7 +116,7 @@ public class PolicyWitoutCloudTest extends BasicUserAction {
     //CHECKSTYLE_OFF:Magic Number
     private void checkPolicy(KafkaConsumer<byte[], byte[]> consumer, String policy) {
         List<byte[]> policyList = new ArrayList<>();
-        int attemptCounts = 10;
+        int attemptCounts = 0;
         while (policyList.isEmpty() && attemptCounts >= 0) {
             policyList = MQListenerAPI.getMessages(consumer);
             attemptCounts--;
index 5a0a565..3df07bf 100644 (file)
@@ -40,8 +40,7 @@ import static org.junit.Assert.assertEquals;
  * @par LLC "Samsung Electronics Co", Ltd (Seoul, Republic of Korea)
  * @par Copyright : (c) Samsung Electronics Co, Ltd 2017. All rights reserved.
  */
-@Disabled
-@Ignore
+
 public class ReportsWithOutCloudTest extends BasicUserAction {
 
     private static final String SMACK = "smack";
@@ -129,7 +128,7 @@ public class ReportsWithOutCloudTest extends BasicUserAction {
     //CHECKSTYLE_OFF:Magic Number
     private void checkNotification(KafkaConsumer<byte[], byte[]> consumer) {
         List<byte[]> notificationList = new ArrayList<>();
-        int attemptCounts = 10;
+        int attemptCounts = 0;
         while (notificationList.isEmpty() && attemptCounts >= 0) {
             notificationList = MQListenerAPI.getMessages(consumer);
             attemptCounts--;
index b9141d2..76e6ed8 100644 (file)
@@ -38,8 +38,7 @@ import io.restassured.response.Response;
  * @par LLC "Samsung Electronics Co", Ltd (Seoul, Republic of Korea)
  * @par Copyright : (c) Samsung Electronics Co, Ltd 2017. All rights reserved.
  */
-@Disabled
-@Ignore
+
 public class RestRuleReportsTest extends BasicUserAction {
 
     private static final String SYSCALL = "syscall";
@@ -117,7 +116,7 @@ public class RestRuleReportsTest extends BasicUserAction {
     //CHECKSTYLE_OFF:Magic Number
     private void checkNotification(KafkaConsumer<byte[], byte[]> consumer) {
         List<byte[]> notificationList = new ArrayList<>();
-        int attemptCounts = 10;
+        int attemptCounts = 0;
         while (notificationList.isEmpty() && attemptCounts >= 0) {
             notificationList = MQListenerAPI.getMessages(consumer);
             attemptCounts--;
index 4d492c4..3ab5cda 100644 (file)
@@ -14,6 +14,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.ResponseEntity;
 import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 
 import com.samsung.commons.domain.Agent;
@@ -76,7 +77,7 @@ public class PolicyApi {
      * @param deviceId the device id
      * @return the response entity
      */
-    @RequestMapping(value = "/request/{policyId}/device/{deviceId}")
+    @RequestMapping(value = "/request/{policyId}/device/{deviceId}", method = RequestMethod.POST)
     public ResponseEntity<String> requestPolicy(@PathVariable Long policyId, @PathVariable String deviceId) {
         LOG.info("Request policy - " + policyId);
         // TODO add check for policy
index 5c9e64a..213a1e7 100644 (file)
@@ -126,7 +126,7 @@ public class ReportApi {
      * @param reportId report ID
      * @return the response entity
      */
-    @RequestMapping(value = "/newreport/{reportId}")
+    @RequestMapping(value = "/newreport/{reportId}", method = RequestMethod.POST)
     public ResponseEntity<String> newReportNotification(@PathVariable Long reportId) {
         LOG.info("Get new report " + reportId);
 
index 1f63c7c..aee03f2 100644 (file)
@@ -29,9 +29,9 @@ public class DsmApiImpl implements DsmApi {
 
     private static final Logger LOG = Logger.getLogger(DsmApiImpl.class);
 
-    private static final String REST_FOR_NOTIFICATION = "restapi/report/newreport/";
+    private static final String REST_FOR_NOTIFICATION = "dsm/restapi/report/newreport/";
 
-    private static final String REST_FOR_REQUEST_POLICY = "restapi/policy/request/";
+    private static final String REST_FOR_REQUEST_POLICY = "dsm/restapi/policy/request/";
 
     /**
      * Http Sender