summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/gvnfm/jujuvnfmadapter/common/LocalComandUtilsTest.java31
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/gvnfm/jujuvnfmadapter/common/SpringContextHolderTest.java9
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/gvnfm/jujuvnfmadapter/common/VnfmExceptionTest.java37
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/gvnfm/jujuvnfmadapter/common/restclient/ExceptionArgsTest.java45
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/gvnfm/jujuvnfmadapter/common/restclient/HttpRestTest.java31
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/gvnfm/jujuvnfmadapter/common/restclient/ReaderHelperTest.java35
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/gvnfm/jujuvnfmadapter/common/restclient/ServiceExceptionTest.java58
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/gvnfm/jujuvnfmadapter/service/adapter/impl/JujuAdapter2DriverManagerTest.java48
8 files changed, 288 insertions, 6 deletions
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/gvnfm/jujuvnfmadapter/common/LocalComandUtilsTest.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/gvnfm/jujuvnfmadapter/common/LocalComandUtilsTest.java
index 4d2e259..df4a68c 100644
--- a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/gvnfm/jujuvnfmadapter/common/LocalComandUtilsTest.java
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/gvnfm/jujuvnfmadapter/common/LocalComandUtilsTest.java
@@ -22,6 +22,7 @@ import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.List;
+import org.junit.Before;
import org.junit.Test;
import org.onap.vfc.nfvo.vnfm.gvnfm.jujuvnfmadapter.common.LocalComandUtils;
import org.onap.vfc.nfvo.vnfm.gvnfm.jujuvnfmadapter.common.LocalComandUtils.ExeRes;
@@ -31,18 +32,19 @@ import mockit.MockUp;
public class LocalComandUtilsTest {
+
@Test
- public void testformatCommand(){
- new MockUp<LocalComandUtils>(){
+ public void testformatCommand() {
+ new MockUp<LocalComandUtils>() {
@Mock
- public String formatCommand(List<String> command){
- return null;
+ public String formatCommand(List<String> command) {
+ return null;
}
};
- List<String> command =new ArrayList<String> ();
+ List<String> command = new ArrayList<String>();
command.add("test1");
command.add("test2");
- String s=LocalComandUtils.formatCommand(command);
+ String s = LocalComandUtils.formatCommand(command);
}
@@ -55,4 +57,21 @@ public class LocalComandUtilsTest {
constructor.newInstance();
}
+ @Test
+ public void testExecute() {
+ LocalComandUtils.execute("/test/data", "csi");
+ }
+
+ @Test
+ public void testFormatCommand2() {
+
+ List<String> command = new ArrayList<String>();
+ command.add("test1");
+ command.add("test2");
+ LocalComandUtils.formatCommand(command);
+
+ }
+
+
+
}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/gvnfm/jujuvnfmadapter/common/SpringContextHolderTest.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/gvnfm/jujuvnfmadapter/common/SpringContextHolderTest.java
index 3a96a56..4b1f691 100644
--- a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/gvnfm/jujuvnfmadapter/common/SpringContextHolderTest.java
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/gvnfm/jujuvnfmadapter/common/SpringContextHolderTest.java
@@ -40,6 +40,15 @@ public class SpringContextHolderTest {
ctx.setApplicationContext(context);
contextholder.cleanApplicationContext();
+
+ }
+
+ @Test(expected = IllegalStateException.class)
+ public void testGetMethods()
+ {
+ SpringContextHolder.getApplicationContext();
+ SpringContextHolder.getSpringBean("huawei");
+ SpringContextHolder.getSpringBean("csi");
}
}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/gvnfm/jujuvnfmadapter/common/VnfmExceptionTest.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/gvnfm/jujuvnfmadapter/common/VnfmExceptionTest.java
new file mode 100644
index 0000000..f1c276f
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/gvnfm/jujuvnfmadapter/common/VnfmExceptionTest.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2016-2017 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.vfc.nfvo.vnfm.gvnfm.jujuvnfmadapter.common;
+
+import org.junit.Test;
+import org.mockito.Mock;
+
+import static org.junit.Assert.*;
+
+public class VnfmExceptionTest {
+ @Mock
+ Throwable throwable;
+
+ @Test
+ public void testConstructors()
+ {
+ VnfmException vnfmException= new VnfmException();
+ VnfmException vnfmException1= new VnfmException("huawei",null);
+ VnfmException vnfmException2= new VnfmException("huawei");
+ VnfmException vnfmException3= new VnfmException(throwable);
+ }
+
+} \ No newline at end of file
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/gvnfm/jujuvnfmadapter/common/restclient/ExceptionArgsTest.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/gvnfm/jujuvnfmadapter/common/restclient/ExceptionArgsTest.java
new file mode 100644
index 0000000..5e73018
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/gvnfm/jujuvnfmadapter/common/restclient/ExceptionArgsTest.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2016-2017 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.vfc.nfvo.vnfm.gvnfm.jujuvnfmadapter.common.restclient;
+
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+public class ExceptionArgsTest {
+ ExceptionArgs exceptionArgs =new ExceptionArgs();
+ @Test
+ public void testConstructors()
+ {
+
+ ExceptionArgs exceptionArgs1 =new ExceptionArgs(null,null,null,null);
+
+ }
+ @Test
+ public void testGetterSetters()
+ {
+ exceptionArgs.setAdviceArgs(null);
+ exceptionArgs.setDescArgs(null);
+ exceptionArgs.setDetailArgs(null);
+ exceptionArgs.setReasonArgs(null);
+ exceptionArgs.getAdviceArgs();
+ exceptionArgs.getDescArgs();
+ exceptionArgs.getDetailArgs();
+ exceptionArgs.getReasonArgs();
+ }
+
+} \ No newline at end of file
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/gvnfm/jujuvnfmadapter/common/restclient/HttpRestTest.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/gvnfm/jujuvnfmadapter/common/restclient/HttpRestTest.java
new file mode 100644
index 0000000..79f9008
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/gvnfm/jujuvnfmadapter/common/restclient/HttpRestTest.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2016-2017 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.vfc.nfvo.vnfm.gvnfm.jujuvnfmadapter.common.restclient;
+
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+public class HttpRestTest {
+ HttpRest httpRest= new HttpRest();
+
+ @Test(expected = Exception.class)
+ public void testInitHttpRest() throws Exception
+ {
+ httpRest.initHttpRest(null);
+ }
+
+} \ No newline at end of file
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/gvnfm/jujuvnfmadapter/common/restclient/ReaderHelperTest.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/gvnfm/jujuvnfmadapter/common/restclient/ReaderHelperTest.java
new file mode 100644
index 0000000..4923843
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/gvnfm/jujuvnfmadapter/common/restclient/ReaderHelperTest.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2016-2017 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.vfc.nfvo.vnfm.gvnfm.jujuvnfmadapter.common.restclient;
+
+import org.junit.Test;
+
+public class ReaderHelperTest {
+
+ @Test
+ public void testConstructors() {
+ ReaderHelper readerHelper = new ReaderHelper(null);
+ }
+
+ @Test
+ public void testGetLine() {
+ ReaderHelper readerHelper = new ReaderHelper(null);
+ readerHelper.getLine();
+
+
+ }
+} \ No newline at end of file
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/gvnfm/jujuvnfmadapter/common/restclient/ServiceExceptionTest.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/gvnfm/jujuvnfmadapter/common/restclient/ServiceExceptionTest.java
new file mode 100644
index 0000000..3fe4e10
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/gvnfm/jujuvnfmadapter/common/restclient/ServiceExceptionTest.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2016-2017 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.vfc.nfvo.vnfm.gvnfm.jujuvnfmadapter.common.restclient;
+
+import org.junit.Test;
+import org.mockito.Mock;
+
+import static org.junit.Assert.*;
+
+public class ServiceExceptionTest {
+ @Mock
+ Throwable throwable;
+ @Mock
+ ExceptionArgs exceptionArgs;
+ ServiceException serviceException = new ServiceException();
+
+ @Test
+ public void testConstructors()
+ {
+ Object object= new Object();
+ ServiceException serviceException1 = new ServiceException("huawei",throwable);
+ ServiceException serviceException2 = new ServiceException("huawei");
+ ServiceException serviceException3 = new ServiceException("huawei","huawei");
+ ServiceException serviceException4 = new ServiceException("huawei",200);
+ ServiceException serviceException5 = new ServiceException(200,"huawei");
+ ServiceException serviceException6 = new ServiceException("huawei",200,exceptionArgs);
+ ServiceException serviceException7 = new ServiceException("200","huawei",object);
+ ServiceException serviceException8 = new ServiceException("200","huawei",throwable,object);
+ ServiceException serviceException9 = new ServiceException("200","huawei",throwable);
+ ServiceException serviceException10 = new ServiceException(throwable);
+
+
+ }
+ @Test
+ public void testGettermethods()
+ {
+ serviceException.getArgs();
+ serviceException.getExceptionArgs();
+ serviceException.getId();
+ serviceException.setId(null);
+ serviceException.getId();
+ }
+
+} \ No newline at end of file
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/gvnfm/jujuvnfmadapter/service/adapter/impl/JujuAdapter2DriverManagerTest.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/gvnfm/jujuvnfmadapter/service/adapter/impl/JujuAdapter2DriverManagerTest.java
new file mode 100644
index 0000000..91f1141
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/gvnfm/jujuvnfmadapter/service/adapter/impl/JujuAdapter2DriverManagerTest.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2016-2017 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.onap.vfc.nfvo.vnfm.gvnfm.jujuvnfmadapter.service.adapter.impl;
+
+import net.sf.json.JSONObject;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+
+
+import java.util.HashMap;
+import java.util.Map;
+
+import static org.junit.Assert.*;
+
+public class JujuAdapter2DriverManagerTest {
+
+
+
+ @Test
+ public void testRegisterDriver()
+ {
+ JujuAdapter2DriverManager jujuAdapter2DriverManager =new JujuAdapter2DriverManager();
+ Map<String, String> map = new HashMap<String, String>();
+ map.put("a", "1");
+ JSONObject json = new JSONObject();
+ json.put("sun","yellow");
+ jujuAdapter2DriverManager.registerDriver(map,json);
+
+ jujuAdapter2DriverManager.unregisterDriver(map);
+
+ }
+} \ No newline at end of file