From 8a939f86d6ea6582fa257220021879fbbe14b3e9 Mon Sep 17 00:00:00 2001 From: Yevhen Zozulia Date: Fri, 22 Sep 2017 18:16:14 +0300 Subject: [PATCH] [SECIOTSRK-544] Fix Sonar issues. --- .../main/java/com/samsung/ci/basic/api/Cloud.java | 2 +- ...istrationAndUnregistrationWithoutCloudTest.java | 2 +- .../java/com/samsung/dsm/model/view/BaseView.java | 48 +++++++++++----------- .../dsm/policy/parser/PolicyParserFactory.java | 10 ++--- .../impl/OAuth2AuthorizationServiceImpl.java | 3 +- .../test/java/com/samsung/dsm/utils/JsonUtils.java | 2 +- 6 files changed, 33 insertions(+), 34 deletions(-) diff --git a/servers/api-integration-tests/src/main/java/com/samsung/ci/basic/api/Cloud.java b/servers/api-integration-tests/src/main/java/com/samsung/ci/basic/api/Cloud.java index a7a9a29..6e32922 100644 --- a/servers/api-integration-tests/src/main/java/com/samsung/ci/basic/api/Cloud.java +++ b/servers/api-integration-tests/src/main/java/com/samsung/ci/basic/api/Cloud.java @@ -80,7 +80,7 @@ public class Cloud { @Override public void onPostFailed(Throwable t) { - /**/ } + } @Override public void onPostCompleted(List arg0, OcRepresentation rep) { diff --git a/servers/api-integration-tests/src/test/java/com/samsung/ci/test/mq/DeviceRegistrationAndUnregistrationWithoutCloudTest.java b/servers/api-integration-tests/src/test/java/com/samsung/ci/test/mq/DeviceRegistrationAndUnregistrationWithoutCloudTest.java index dbab125..293b14c 100644 --- a/servers/api-integration-tests/src/test/java/com/samsung/ci/test/mq/DeviceRegistrationAndUnregistrationWithoutCloudTest.java +++ b/servers/api-integration-tests/src/test/java/com/samsung/ci/test/mq/DeviceRegistrationAndUnregistrationWithoutCloudTest.java @@ -118,7 +118,7 @@ public class DeviceRegistrationAndUnregistrationWithoutCloudTest extends BasicUs * @throws InterruptedException */ @Test - public void T01registerAndUnregisterDevice() throws InterruptedException { + public void testRegisterAndUnregisterDevice() throws InterruptedException { log("Authorized without cloud scenario"); Thread.sleep(TIMEOUT); createNewUser(); diff --git a/servers/dsm/src/main/java/com/samsung/dsm/model/view/BaseView.java b/servers/dsm/src/main/java/com/samsung/dsm/model/view/BaseView.java index b67e7ae..9c28f94 100644 --- a/servers/dsm/src/main/java/com/samsung/dsm/model/view/BaseView.java +++ b/servers/dsm/src/main/java/com/samsung/dsm/model/view/BaseView.java @@ -58,35 +58,35 @@ public class BaseView { */ private String parseDeviceType(String type, boolean forDisplaying) { switch (type) { - case "tv": - return forDisplaying ? "Smart TV" : "tv"; - case "phone": - return forDisplaying ? "Smartphone" : "smartphone"; - case "light": - return forDisplaying ? "Smart Lamp" : "lamp"; - case "robotcleaner": - return forDisplaying ? "Smart Robot Cleaner" : "robotcleaner"; - case "airconditioner": - return forDisplaying ? "Smart Airconditioner" : "airconditioner"; - case "refrigerator": - return forDisplaying ? "Smart Refrigerator" : "refrigerator"; - case "smartplug": - return forDisplaying ? "Smart Plug" : "smartplug"; - case "washer": - return forDisplaying ? "Smart Washer" : "washer"; - default: - return ""; + case "tv": + return forDisplaying ? "Smart TV" : "tv"; + case "phone": + return forDisplaying ? "Smartphone" : "smartphone"; + case "light": + return forDisplaying ? "Smart Lamp" : "lamp"; + case "robotcleaner": + return forDisplaying ? "Smart Robot Cleaner" : "robotcleaner"; + case "airconditioner": + return forDisplaying ? "Smart Airconditioner" : "airconditioner"; + case "refrigerator": + return forDisplaying ? "Smart Refrigerator" : "refrigerator"; + case "smartplug": + return forDisplaying ? "Smart Plug" : "smartplug"; + case "washer": + return forDisplaying ? "Smart Washer" : "washer"; + default: + return ""; } } public DeviceStatusView getDeviceStatus(int status) { switch (Device.Status.getStatus(status)) { - case DISCONNECTED: - return new DeviceStatusView("off", "Disconnected"); - case CONNECTED: - return new DeviceStatusView("on", "Connected"); - default: - return new DeviceStatusView("warning", "Issues"); + case DISCONNECTED: + return new DeviceStatusView("off", "Disconnected"); + case CONNECTED: + return new DeviceStatusView("on", "Connected"); + default: + return new DeviceStatusView("warning", "Issues"); } } diff --git a/servers/dsm/src/main/java/com/samsung/dsm/policy/parser/PolicyParserFactory.java b/servers/dsm/src/main/java/com/samsung/dsm/policy/parser/PolicyParserFactory.java index ac6f065..bcbcefa 100644 --- a/servers/dsm/src/main/java/com/samsung/dsm/policy/parser/PolicyParserFactory.java +++ b/servers/dsm/src/main/java/com/samsung/dsm/policy/parser/PolicyParserFactory.java @@ -22,11 +22,11 @@ public class PolicyParserFactory { PolicyConfigParser parser = null; switch (type) { - case JSON: - parser = new JSONPolicyConfigParser(); - break; - default: - break; + case JSON: + parser = new JSONPolicyConfigParser(); + break; + default: + break; } return parser; diff --git a/servers/dsm/src/main/java/com/samsung/dsm/service/impl/OAuth2AuthorizationServiceImpl.java b/servers/dsm/src/main/java/com/samsung/dsm/service/impl/OAuth2AuthorizationServiceImpl.java index 1003c8c..5674e39 100644 --- a/servers/dsm/src/main/java/com/samsung/dsm/service/impl/OAuth2AuthorizationServiceImpl.java +++ b/servers/dsm/src/main/java/com/samsung/dsm/service/impl/OAuth2AuthorizationServiceImpl.java @@ -31,8 +31,7 @@ import static java.lang.String.format; public class OAuth2AuthorizationServiceImpl implements OAuth2AuthorizationService { private static final Logger LOG = Logger.getLogger(OAuth2AuthorizationServiceImpl.class); - private static final String REDIRECT_URL = "http://localhost:8080/dsm/oauth/callback";// Don't - // change + private static final String REDIRECT_URL = "http://localhost:8080/dsm/oauth/callback"; @Autowired @Qualifier(value = "clientAuthenticationManager") diff --git a/servers/dsm/src/test/java/com/samsung/dsm/utils/JsonUtils.java b/servers/dsm/src/test/java/com/samsung/dsm/utils/JsonUtils.java index 0568715..1685c60 100644 --- a/servers/dsm/src/test/java/com/samsung/dsm/utils/JsonUtils.java +++ b/servers/dsm/src/test/java/com/samsung/dsm/utils/JsonUtils.java @@ -30,7 +30,7 @@ public class JsonUtils { log.warn(format("NE %s | %s", tuple.v1().toString(), tuple.v2().toString())); } return nonEqual; - }).count(); + }).count(); return !(count > 0); } catch (IllegalStateException e) { -- 2.7.4