aboutsummaryrefslogtreecommitdiffstats
path: root/appc-dg
diff options
context:
space:
mode:
authorwejs <maciej.wejs@nokia.com>2018-01-25 12:41:33 +0100
committerwejs <maciej.wejs@nokia.com>2018-02-01 12:18:18 +0100
commit46150f8ef3cf60716cb5d02eab8e595052c628f5 (patch)
treed2e309bd164e1445a3749c19d3233486714973d6 /appc-dg
parent03f48c7ea7de11d7c7d0933a0438afa4280e3bf7 (diff)
Sonar fixes in "appc-netconf-adapter-bundle"
Change-Id: Ib5842a5f43c9437fee464e9a35e3120a11d1c6b1 Issue-ID: APPC-494 Signed-off-by: wejs <maciej.wejs@nokia.com>
Diffstat (limited to 'appc-dg')
-rw-r--r--appc-dg/appc-dg-shared/appc-dg-netconf/src/main/java/org/onap/appc/dg/netconf/impl/NetconfClientPluginImpl.java12
-rw-r--r--appc-dg/appc-dg-shared/appc-dg-netconf/src/test/java/org/onap/appc/dg/netconf/impl/NetconfClientFactoryMock.java2
-rw-r--r--appc-dg/appc-dg-shared/appc-dg-netconf/src/test/java/org/onap/appc/dg/netconf/impl/NetconfClientPluginImplTest.java27
-rw-r--r--appc-dg/appc-dg-shared/appc-dg-netconf/src/test/java/org/onap/appc/dg/netconf/impl/OperationStateValidatorFactoryMock.java4
4 files changed, 21 insertions, 24 deletions
diff --git a/appc-dg/appc-dg-shared/appc-dg-netconf/src/main/java/org/onap/appc/dg/netconf/impl/NetconfClientPluginImpl.java b/appc-dg/appc-dg-shared/appc-dg-netconf/src/main/java/org/onap/appc/dg/netconf/impl/NetconfClientPluginImpl.java
index 174226473..1684f1cf5 100644
--- a/appc-dg/appc-dg-shared/appc-dg-netconf/src/main/java/org/onap/appc/dg/netconf/impl/NetconfClientPluginImpl.java
+++ b/appc-dg/appc-dg-shared/appc-dg-netconf/src/main/java/org/onap/appc/dg/netconf/impl/NetconfClientPluginImpl.java
@@ -69,8 +69,8 @@ public class NetconfClientPluginImpl implements NetconfClientPlugin {
public void configure(Map<String, String> params, SvcLogicContext ctx) throws APPCException {
try {
- // by default, it uses the jsch Netconf Adapter implementation by calling GetNetconfClient(NetconfClientType.SSH).
- NetconfClient client = clientFactory.GetNetconfClient(NetconfClientType.SSH);
+ // by default, it uses the jsch Netconf Adapter implementation by calling getNetconfClient(NetconfClientType.SSH).
+ NetconfClient client = clientFactory.getNetconfClient(NetconfClientType.SSH);
try {
NetconfConnectionDetails connectionDetails = mapper.readValue(params.get("connection-details"), NetconfConnectionDetails.class);
String netconfMessage = params.get("file-content");
@@ -127,7 +127,7 @@ public class NetconfClientPluginImpl implements NetconfClientPlugin {
}
//connect checK Opertaions state and dissconnect
- NetconfClient client = clientFactory.GetNetconfClient(NetconfClientType.SSH);
+ NetconfClient client = clientFactory.getNetconfClient(NetconfClientType.SSH);
try {
client.connect(connectionDetails);
String response = null;
@@ -164,7 +164,7 @@ public class NetconfClientPluginImpl implements NetconfClientPlugin {
logger.debug("Entered backup to DEVICE_INTERFACE_LOG");
}
- client = clientFactory.GetNetconfClient(NetconfClientType.SSH);
+ client = clientFactory.getNetconfClient(NetconfClientType.SSH);
//get connection details
NetconfConnectionDetails connectionDetails = mapper.readValue(params.get("connection-details"), NetconfConnectionDetails.class);
//connect the client and get configuration
@@ -199,7 +199,7 @@ public class NetconfClientPluginImpl implements NetconfClientPlugin {
BundleContext bctx = FrameworkUtil.getBundle(this.getClass()).getBundleContext();
ServiceReference sref = bctx.getServiceReference(NETCONF_CLIENT_FACTORY_NAME);
NetconfClientFactory clientFactory = (NetconfClientFactory) bctx.getService(sref);
- client = clientFactory.GetNetconfClient(NetconfClientType.SSH);
+ client = clientFactory.getNetconfClient(NetconfClientType.SSH);
//get connection details
NetconfConnectionDetails connectionDetails = mapper.readValue(params.get("connection-details"), NetconfConnectionDetails.class);
//connect the client and get configuration
@@ -245,7 +245,7 @@ public class NetconfClientPluginImpl implements NetconfClientPlugin {
BundleContext bctx = FrameworkUtil.getBundle(this.getClass()).getBundleContext();
ServiceReference sref = bctx.getServiceReference(NETCONF_CLIENT_FACTORY_NAME);
NetconfClientFactory clientFactory = (NetconfClientFactory) bctx.getService(sref);
- client = clientFactory.GetNetconfClient(NetconfClientType.SSH);
+ client = clientFactory.getNetconfClient(NetconfClientType.SSH);
//get connection details
NetconfConnectionDetails connectionDetails = new NetconfConnectionDetails();
connectionDetails.setHost(params.get("host-ip-address"));
diff --git a/appc-dg/appc-dg-shared/appc-dg-netconf/src/test/java/org/onap/appc/dg/netconf/impl/NetconfClientFactoryMock.java b/appc-dg/appc-dg-shared/appc-dg-netconf/src/test/java/org/onap/appc/dg/netconf/impl/NetconfClientFactoryMock.java
index f61d188d9..52307b9bd 100644
--- a/appc-dg/appc-dg-shared/appc-dg-netconf/src/test/java/org/onap/appc/dg/netconf/impl/NetconfClientFactoryMock.java
+++ b/appc-dg/appc-dg-shared/appc-dg-netconf/src/test/java/org/onap/appc/dg/netconf/impl/NetconfClientFactoryMock.java
@@ -36,7 +36,7 @@ public class NetconfClientFactoryMock extends NetconfClientFactory {
private final NetconfClientJschMock jschClient = new NetconfClientJschMock();
@Override
- public NetconfClient GetNetconfClient(NetconfClientType type){
+ public NetconfClient getNetconfClient(NetconfClientType type){
return jschClient;
diff --git a/appc-dg/appc-dg-shared/appc-dg-netconf/src/test/java/org/onap/appc/dg/netconf/impl/NetconfClientPluginImplTest.java b/appc-dg/appc-dg-shared/appc-dg-netconf/src/test/java/org/onap/appc/dg/netconf/impl/NetconfClientPluginImplTest.java
index 0becff701..220328c45 100644
--- a/appc-dg/appc-dg-shared/appc-dg-netconf/src/test/java/org/onap/appc/dg/netconf/impl/NetconfClientPluginImplTest.java
+++ b/appc-dg/appc-dg-shared/appc-dg-netconf/src/test/java/org/onap/appc/dg/netconf/impl/NetconfClientPluginImplTest.java
@@ -34,7 +34,6 @@ import org.mockito.Matchers;
import org.mockito.Mockito;
import org.onap.appc.adapter.netconf.*;
import org.onap.appc.adapter.netconf.util.Constants;
-import org.onap.appc.dg.netconf.impl.NetconfClientPluginImpl;
import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
@@ -129,7 +128,7 @@ public class NetconfClientPluginImplTest {
netconfClientPlugin.configure(params, ctx);
- NetconfClientJschMock client = (NetconfClientJschMock) clientFactory.GetNetconfClient(NetconfClientType.SSH);
+ NetconfClientJschMock client = (NetconfClientJschMock) clientFactory.getNetconfClient(NetconfClientType.SSH);
try {
Assert.assertEquals("wrong configuration", fileContent, client.getConf());
@@ -154,7 +153,7 @@ public class NetconfClientPluginImplTest {
params = new HashMap<>();
params.put(Constants.CONNECTION_DETAILS_FIELD_NAME, "{" + connectionDetails);
params.put(Constants.FILE_CONTENT_FIELD_NAME, fileContent);
- NetconfClientJschMock client = (NetconfClientJschMock) clientFactory.GetNetconfClient(NetconfClientType.SSH);
+ NetconfClientJschMock client = (NetconfClientJschMock) clientFactory.getNetconfClient(NetconfClientType.SSH);
try {
@@ -174,7 +173,7 @@ public class NetconfClientPluginImplTest {
DAOServiceMock daoServiceMock = (DAOServiceMock) dao;
daoServiceMock.setConfigFile(fileContent);
- NetconfClientJschMock client = (NetconfClientJschMock) clientFactory.GetNetconfClient(NetconfClientType.SSH);
+ NetconfClientJschMock client = (NetconfClientJschMock) clientFactory.getNetconfClient(NetconfClientType.SSH);
client.setAnswer(operationalState);
@@ -202,7 +201,7 @@ public class NetconfClientPluginImplTest {
DAOServiceMock daoServiceMock = (DAOServiceMock) dao;
daoServiceMock.setConfigFile(fileContent);
- NetconfClientJschMock client = (NetconfClientJschMock) clientFactory.GetNetconfClient(NetconfClientType.SSH);
+ NetconfClientJschMock client = (NetconfClientJschMock) clientFactory.getNetconfClient(NetconfClientType.SSH);
client.setAnswer(operationalState);
params = new HashMap<>();
@@ -234,7 +233,7 @@ public class NetconfClientPluginImplTest {
DAOServiceMock daoServiceMock = (DAOServiceMock) dao;
daoServiceMock.setConfigFile(fileContent);
- NetconfClientJschMock client = (NetconfClientJschMock) clientFactory.GetNetconfClient(NetconfClientType.SSH);
+ NetconfClientJschMock client = (NetconfClientJschMock) clientFactory.getNetconfClient(NetconfClientType.SSH);
client.setAnswer(operationalState);
@@ -270,7 +269,7 @@ public class NetconfClientPluginImplTest {
DAOServiceMock daoServiceMock = (DAOServiceMock) dao;
daoServiceMock.setConfigFile(fileContent);
- NetconfClientJschMock client = (NetconfClientJschMock) clientFactory.GetNetconfClient(NetconfClientType.SSH);
+ NetconfClientJschMock client = (NetconfClientJschMock) clientFactory.getNetconfClient(NetconfClientType.SSH);
client.setAnswer("wrong");
@@ -303,7 +302,7 @@ public class NetconfClientPluginImplTest {
DAOServiceMock daoServiceMock = (DAOServiceMock) dao;
daoServiceMock.setConfigFile(fileContent);
- NetconfClientJschMock client = (NetconfClientJschMock) clientFactory.GetNetconfClient(NetconfClientType.SSH);
+ NetconfClientJschMock client = (NetconfClientJschMock) clientFactory.getNetconfClient(NetconfClientType.SSH);
client.setAnswer(operationalState);
((DAOServiceMock) dao).setConnection(getConnectionDetails());
@@ -331,7 +330,7 @@ public class NetconfClientPluginImplTest {
DAOServiceMock daoServiceMock = (DAOServiceMock) dao;
daoServiceMock.setConfigFile(fileContent);
- NetconfClientJschMock client = (NetconfClientJschMock) clientFactory.GetNetconfClient(NetconfClientType.SSH);
+ NetconfClientJschMock client = (NetconfClientJschMock) clientFactory.getNetconfClient(NetconfClientType.SSH);
client.setAnswer(operationalState);
((DAOServiceMock) dao).setConnection(getConnectionDetails());
@@ -359,7 +358,7 @@ public class NetconfClientPluginImplTest {
SvcLogicContext ctx = new SvcLogicContext();
params = new HashMap<>();
params.put(Constants.CONNECTION_DETAILS_FIELD_NAME, connectionDetails);
- NetconfClientJschMock client = (NetconfClientJschMock) clientFactory.GetNetconfClient(NetconfClientType.SSH);
+ NetconfClientJschMock client = (NetconfClientJschMock) clientFactory.getNetconfClient(NetconfClientType.SSH);
client.setConf(fileContent);
netconfClientPlugin.backupConfiguration(params, ctx);
@@ -383,7 +382,7 @@ public class NetconfClientPluginImplTest {
SvcLogicContext ctx = new SvcLogicContext();
params = new HashMap<>();
params.put(Constants.CONNECTION_DETAILS_FIELD_NAME, "{" + connectionDetails);
- NetconfClientJschMock client = (NetconfClientJschMock) clientFactory.GetNetconfClient(NetconfClientType.SSH);
+ NetconfClientJschMock client = (NetconfClientJschMock) clientFactory.getNetconfClient(NetconfClientType.SSH);
client.setConf(fileContent);
try {
netconfClientPlugin.backupConfiguration(params, ctx);
@@ -408,7 +407,7 @@ public class NetconfClientPluginImplTest {
params = new HashMap<>();
params.put("conf-id", "current");
params.put(Constants.CONNECTION_DETAILS_FIELD_NAME, connectionDetails);
- NetconfClientJschMock client = (NetconfClientJschMock) clientFactory.GetNetconfClient(NetconfClientType.SSH);
+ NetconfClientJschMock client = (NetconfClientJschMock) clientFactory.getNetconfClient(NetconfClientType.SSH);
client.setConf(fileContent);
@@ -500,7 +499,7 @@ public class NetconfClientPluginImplTest {
params.put("password", password);
params.put("port-number", String.valueOf(port));
- NetconfClientJschMock client = (NetconfClientJschMock) clientFactory.GetNetconfClient(NetconfClientType.SSH);
+ NetconfClientJschMock client = (NetconfClientJschMock) clientFactory.getNetconfClient(NetconfClientType.SSH);
client.setConf(fileContent);
netconfClientPlugin.getRunningConfig(params, ctx);
@@ -519,7 +518,7 @@ public class NetconfClientPluginImplTest {
params.put("user-name", username);
params.put("password", password);
- NetconfClientJschMock client = (NetconfClientJschMock) clientFactory.GetNetconfClient(NetconfClientType.SSH);
+ NetconfClientJschMock client = (NetconfClientJschMock) clientFactory.getNetconfClient(NetconfClientType.SSH);
client.setConf(fileContent);
try {
diff --git a/appc-dg/appc-dg-shared/appc-dg-netconf/src/test/java/org/onap/appc/dg/netconf/impl/OperationStateValidatorFactoryMock.java b/appc-dg/appc-dg-shared/appc-dg-netconf/src/test/java/org/onap/appc/dg/netconf/impl/OperationStateValidatorFactoryMock.java
index 2194fc14c..9472b69a1 100644
--- a/appc-dg/appc-dg-shared/appc-dg-netconf/src/test/java/org/onap/appc/dg/netconf/impl/OperationStateValidatorFactoryMock.java
+++ b/appc-dg/appc-dg-shared/appc-dg-netconf/src/test/java/org/onap/appc/dg/netconf/impl/OperationStateValidatorFactoryMock.java
@@ -30,7 +30,7 @@ import org.onap.appc.adapter.netconf.*;
public class OperationStateValidatorFactoryMock extends OperationalStateValidatorFactory {
public static OperationalStateValidator getOperationalStateValidator(String vnfType) {
- VnfType vnfTypeEnum = null;
+ VnfType vnfTypeEnum;
try {
vnfTypeEnum = VnfType.getVnfType(vnfType);
} catch (IllegalArgumentException e) {
@@ -45,6 +45,4 @@ public class OperationStateValidatorFactoryMock extends OperationalStateValidato
}
-
-
}