Improve the coverage 86/79686/1
authorKanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>
Tue, 5 Mar 2019 08:55:47 +0000 (14:25 +0530)
committerKanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>
Tue, 5 Mar 2019 09:08:10 +0000 (14:38 +0530)
Issue-ID: VNFSDK-352

Change-Id: If60d370a097e77bff3248fd56a60e2f6fd7fdf40
Signed-off-by: Kanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>
15 files changed:
vnfmarket-be/deployment/docker/docker-refrepo/pom.xml
vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/common/HttpServerPathConfigTest.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/db/common/MarketplaceResourceTypeTest.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/db/exception/ErrorCodeExceptionTest.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/db/exception/MarketplaceResourceExceptionTest.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/msb/MsbDetailsTest.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/msb/MsbServerTest.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/onboarding/hooks/functiontest/FunctionTestExceutorTest.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/onboarding/hooks/validatelifecycle/LifeCycleTestReqTest.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/onboarding/hooks/validatelifecycle/LifecycleTestExceutorTest.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/onboarding/hooks/validatelifecycle/LifecycleTestHookTest.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/onboarding/hooks/validatelifecycle/ValidateLifecycleTestResponseTest.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/onboarding/onboardmanager/OnBoardingHandlerTest.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/rest/RestResponseTest.java [new file with mode: 0644]
vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/rest/RestfulClientTest.java [new file with mode: 0644]

index 6426f64..4c784a3 100644 (file)
@@ -76,7 +76,7 @@
                             <skipDockerBuild>${skip.docker.build}</skipDockerBuild>
                         </configuration>
                     </execution>
-<execution>
+                    <execution>
                         <id>tag-image-timestamped-version</id>
                         <phase>deploy</phase>
                         <goals>
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/common/HttpServerPathConfigTest.java b/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/common/HttpServerPathConfigTest.java
new file mode 100644 (file)
index 0000000..cd74b4a
--- /dev/null
@@ -0,0 +1,35 @@
+/**
+ * Copyright 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.vnfsdk.marketplace.common;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+public class HttpServerPathConfigTest {
+
+    @Before
+    public void setUp() throws Exception {
+
+    }
+    @Test
+    public void testGetterSetter()
+    {
+        HttpServerPathConfig.setHttpServerPath("csi");
+        assertEquals(HttpServerPathConfig.getHttpServerPath(),"csi");
+    }
+}
\ No newline at end of file
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/db/common/MarketplaceResourceTypeTest.java b/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/db/common/MarketplaceResourceTypeTest.java
new file mode 100644 (file)
index 0000000..24c20eb
--- /dev/null
@@ -0,0 +1,28 @@
+/**
+ * Copyright 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.vnfsdk.marketplace.db.common;
+
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+public class MarketplaceResourceTypeTest {
+    @Test
+    public void testEnum() {
+        MarketplaceResourceType.getType("SERVICETEMPLATE");
+    }
+
+}
\ No newline at end of file
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/db/exception/ErrorCodeExceptionTest.java b/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/db/exception/ErrorCodeExceptionTest.java
new file mode 100644 (file)
index 0000000..01bd7c3
--- /dev/null
@@ -0,0 +1,42 @@
+/**
+ * Copyright 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.vnfsdk.marketplace.db.exception;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+public class ErrorCodeExceptionTest {
+    ErrorCodeException e1;
+
+    @Before
+    public void setUp() {
+        e1 = new ErrorCodeException(null, 0, 0, null, null);
+    }
+
+    @Test
+    public void testConstructor() {
+
+        ErrorCodeException e2 = new ErrorCodeException(0, null);
+
+    }
+
+    @Test
+    public void testGet() {
+        e1.getErrorCode();
+    }
+}
\ No newline at end of file
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/db/exception/MarketplaceResourceExceptionTest.java b/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/db/exception/MarketplaceResourceExceptionTest.java
new file mode 100644 (file)
index 0000000..df38606
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+ * Copyright 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.vnfsdk.marketplace.db.exception;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+public class MarketplaceResourceExceptionTest {
+    MarketplaceResourceException marketplaceResourceException;
+    @Before
+    public void setUp() throws Exception {
+        marketplaceResourceException= new MarketplaceResourceException(null,0,0,null,null);
+    }
+    @Test
+    public void testGetter()
+    {
+        marketplaceResourceException.getErrcode();
+    }
+}
\ No newline at end of file
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/msb/MsbDetailsTest.java b/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/msb/MsbDetailsTest.java
new file mode 100644 (file)
index 0000000..a154477
--- /dev/null
@@ -0,0 +1,30 @@
+/**
+ * Copyright 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.vnfsdk.marketplace.msb;
+
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+public class MsbDetailsTest {
+    MsbDetails msbDetails=new MsbDetails();
+    @Test
+    public void testGetDefaultServer()
+    {
+        msbDetails.getDefaultServer();
+    }
+
+}
\ No newline at end of file
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/msb/MsbServerTest.java b/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/msb/MsbServerTest.java
new file mode 100644 (file)
index 0000000..cac8557
--- /dev/null
@@ -0,0 +1,37 @@
+/**
+ * Copyright 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.vnfsdk.marketplace.msb;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+public class MsbServerTest {
+    MsbServer msbServer;
+    @Before
+    public void setUp() throws Exception {
+        msbServer= new MsbServer();
+    }
+    @Test
+    public void testSetterGetter()
+    {
+        msbServer.setHost("csi");
+        assertEquals(msbServer.getHost(),"csi");
+        msbServer.setPort("123");
+        assertEquals(msbServer.getPort(),"123");
+    }
+}
\ No newline at end of file
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/onboarding/hooks/functiontest/FunctionTestExceutorTest.java b/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/onboarding/hooks/functiontest/FunctionTestExceutorTest.java
new file mode 100644 (file)
index 0000000..dbcdfd9
--- /dev/null
@@ -0,0 +1,65 @@
+/**
+ * Copyright 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.vnfsdk.marketplace.onboarding.hooks.functiontest;
+
+import mockit.Mock;
+import mockit.MockUp;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.vnfsdk.marketplace.common.FileUtil;
+import org.onap.vnfsdk.marketplace.msb.MsbDetails;
+import org.onap.vnfsdk.marketplace.msb.MsbDetailsHolder;
+import org.onap.vnfsdk.marketplace.onboarding.entity.OnBoradingRequest;
+
+import static org.junit.Assert.*;
+import static org.mockito.Mockito.mock;
+
+public class FunctionTestExceutorTest {
+    FunctionTestExceutor functionTestExceutor;
+    OnBoradingRequest onBoradingRequest;
+    MsbDetails msbDetails;
+
+    @Before
+    public void setUp() throws Exception {
+        onBoradingRequest = mock(OnBoradingRequest.class);
+        msbDetails = mock(MsbDetails.class);
+    }
+
+    @Test
+    public void testExecFunctionTest() {
+        new MockUp<FileUtil>() {
+            @Mock
+            public boolean validatePath(String path) {
+                return true;
+            }
+        };
+        FunctionTestExceutor.execFunctionTest(onBoradingRequest);
+
+    }
+
+    @Test
+    public void testExecFunctionTest2() {
+        new MockUp<MsbDetailsHolder>() {
+            @Mock
+            public MsbDetails getMsbDetails() {
+                return msbDetails;
+            }
+        };
+        FunctionTestExceutor.execFunctionTest(onBoradingRequest);
+
+    }
+
+}
\ No newline at end of file
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/onboarding/hooks/validatelifecycle/LifeCycleTestReqTest.java b/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/onboarding/hooks/validatelifecycle/LifeCycleTestReqTest.java
new file mode 100644 (file)
index 0000000..bcbfcf2
--- /dev/null
@@ -0,0 +1,40 @@
+/**
+ * Copyright 2018 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.vnfsdk.marketplace.onboarding.hooks.validatelifecycle;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+public class LifeCycleTestReqTest {
+    LifeCycleTestReq lifeCycleTestReq;
+    @Before
+    public void setUp() throws Exception {
+        lifeCycleTestReq= new LifeCycleTestReq();
+    }
+
+    @Test
+    public void testEstterGetter()
+    {
+        lifeCycleTestReq.setCsarId("csi");
+        assertEquals(lifeCycleTestReq.getCsarId(),"csi");
+        lifeCycleTestReq.setLabVimId("csi");
+        assertEquals(lifeCycleTestReq.getLabVimId(),"csi");
+        lifeCycleTestReq.setVimIds(null);
+        assertEquals(lifeCycleTestReq.getVimIds(),null);
+    }
+}
\ No newline at end of file
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/onboarding/hooks/validatelifecycle/LifecycleTestExceutorTest.java b/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/onboarding/hooks/validatelifecycle/LifecycleTestExceutorTest.java
new file mode 100644 (file)
index 0000000..0418032
--- /dev/null
@@ -0,0 +1,49 @@
+/**
+ * Copyright 2018 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.vnfsdk.marketplace.onboarding.hooks.validatelifecycle;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.vnfsdk.marketplace.onboarding.entity.OnBoradingRequest;
+
+import static org.mockito.Mockito.mock;
+
+public class LifecycleTestExceutorTest {
+   private LifecycleTestExceutor lifecycleTestExceutor;
+    private OnBoradingRequest onBoradingRequest;
+    LifeCycleTestReq lifeCycleTestReq;
+    @Before
+    public void setUp()
+    {
+       // lifecycleTestExceutor = new LifecycleTestExceutor();
+        onBoradingRequest  = mock(OnBoradingRequest.class);
+        lifeCycleTestReq = mock(LifeCycleTestReq.class);
+    }
+
+    @Test
+    public void testupLoadPackageToCatalouge()
+    {
+       // LifecycleTestExceutor.uploadPackageToCatalouge(onBoradingRequest);
+    }
+    @Test
+    public void testExeclifecycleTest()
+    {
+        LifecycleTestExceutor.execlifecycleTest(onBoradingRequest,lifeCycleTestReq);
+
+    }
+
+
+}
\ No newline at end of file
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/onboarding/hooks/validatelifecycle/LifecycleTestHookTest.java b/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/onboarding/hooks/validatelifecycle/LifecycleTestHookTest.java
new file mode 100644 (file)
index 0000000..64dc19c
--- /dev/null
@@ -0,0 +1,40 @@
+/**
+ * Copyright 2018 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.vnfsdk.marketplace.onboarding.hooks.validatelifecycle;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.vnfsdk.marketplace.onboarding.entity.OnBoradingRequest;
+
+import static org.junit.Assert.*;
+import static org.mockito.Mockito.mock;
+
+public class LifecycleTestHookTest {
+
+    LifecycleTestHook lifecycleTestHook;
+    OnBoradingRequest onBoradingRequest;
+    @Before
+    public void setUp() throws Exception {
+        lifecycleTestHook= new LifecycleTestHook();
+        onBoradingRequest = mock(OnBoradingRequest.class);
+    }
+    @Test
+    public void testExec()
+    {
+       // lifecycleTestHook.exec(onBoradingRequest);
+
+    }
+}
\ No newline at end of file
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/onboarding/hooks/validatelifecycle/ValidateLifecycleTestResponseTest.java b/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/onboarding/hooks/validatelifecycle/ValidateLifecycleTestResponseTest.java
new file mode 100644 (file)
index 0000000..b6629cc
--- /dev/null
@@ -0,0 +1,40 @@
+/**
+ * Copyright 2018 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.vnfsdk.marketplace.onboarding.hooks.validatelifecycle;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+public class ValidateLifecycleTestResponseTest {
+
+    ValidateLifecycleTestResponse validateLifecycleTestResponse;
+    @Before
+    public void setUp() throws Exception {
+        validateLifecycleTestResponse= new ValidateLifecycleTestResponse();
+    }
+    @Test
+    public void testSetterGetter()
+    {
+        validateLifecycleTestResponse.setJobId("huawei");
+        assertEquals(validateLifecycleTestResponse.getJobId(),"huawei");
+        validateLifecycleTestResponse.setLifecycle_status("huawei");
+        assertEquals(validateLifecycleTestResponse.getLifecycle_status(),"huawei");
+        validateLifecycleTestResponse.setValidate_status("huawei");
+        assertEquals(validateLifecycleTestResponse.getValidate_status(),"huawei");
+    }
+}
\ No newline at end of file
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/onboarding/onboardmanager/OnBoardingHandlerTest.java b/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/onboarding/onboardmanager/OnBoardingHandlerTest.java
new file mode 100644 (file)
index 0000000..9377e36
--- /dev/null
@@ -0,0 +1,52 @@
+/**
+ * Copyright 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.vnfsdk.marketplace.onboarding.onboardmanager;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.vnfsdk.marketplace.onboarding.entity.OnBoradingRequest;
+import org.onap.vnfsdk.marketplace.onboarding.hooks.validatelifecycle.LifecycleTestHook;
+
+import static org.junit.Assert.*;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+public class OnBoardingHandlerTest {
+    private OnBoradingRequest onBoardingReq;
+    private OnBoardingHandler onboardinghandler;
+
+    @Before
+    public void setUp() {
+        onBoardingReq = mock(OnBoradingRequest.class);
+        onboardinghandler = new OnBoardingHandler();
+    }
+    @Test
+    public void testhandleOnBoardingReq() {
+        onboardinghandler.handleOnBoardingReq(null);
+        onboardinghandler.handleOnBoardingReq(onBoardingReq);
+        when(onBoardingReq.getPackageName()).thenReturn("abc");
+        when(onBoardingReq.getPackagePath()).thenReturn("com.java.snippets.core");
+        onboardinghandler.handleOnBoardingReq(onBoardingReq);
+        when(onBoardingReq.getCsarId()).thenReturn("com.java.snippets.core");
+        /*onboardinghandler.handleOnBoardingReq(onBoardingReq);
+        LifecycleTestHook lifecycleTestHook = mock(LifecycleTestHook.class);
+        when(lifecycleTestHook.exec(onBoardingReq)).thenReturn(200);
+        assertEquals(lifecycleTestHook.exec(onBoardingReq),200);*/
+    }
+
+}
\ No newline at end of file
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/rest/RestResponseTest.java b/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/rest/RestResponseTest.java
new file mode 100644 (file)
index 0000000..2e74b8f
--- /dev/null
@@ -0,0 +1,41 @@
+/**
+ * Copyright 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.vnfsdk.marketplace.rest;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.*;
+
+public class RestResponseTest {
+
+    private RestResponse restResponse;
+
+    @Before
+    public void setUp() {
+        restResponse = new RestResponse();
+    }
+
+    @Test
+    public void testSetterGetter() {
+        restResponse.setResult("huawei");
+        assertEquals(restResponse.getResult(), "huawei");
+        restResponse.setStatusCode(200);
+        assertThat(restResponse.getStatusCode(),is(200));
+    }
+}
\ No newline at end of file
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/rest/RestfulClientTest.java b/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/rest/RestfulClientTest.java
new file mode 100644 (file)
index 0000000..177baa9
--- /dev/null
@@ -0,0 +1,82 @@
+/**
+ * Copyright 2017 Huawei Technologies Co., Ltd.
+ * <p>
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.vnfsdk.marketplace.rest;
+
+import org.apache.http.HttpEntity;
+import org.apache.http.HttpHost;
+import org.apache.http.HttpRequest;
+import org.apache.http.HttpResponse;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+import static org.mockito.Mockito.mock;
+import static org.onap.vnfsdk.marketplace.rest.RestfulClient.HttpMethod.PUT;
+import static org.powermock.api.mockito.PowerMockito.when;
+
+public class RestfulClientTest {
+
+
+    private RestfulClient restfulClient;
+    private HttpEntity entity;
+
+    @Before
+    public void setUp() {
+        restfulClient = new RestfulClient();
+        entity = mock(HttpEntity.class);
+    }
+
+
+    @Test
+    public void testGet() {
+        RestfulClient.get("172.11.10.22,1212", 1211, "http://localhost");
+    }
+
+    @Test
+    public void testPost() {
+        RestfulClient.post("172.11.10.22,1212", 1211, "http://localhost", null);
+    }
+
+    @Test
+    public void testDelete() {
+        RestfulClient.delete("172.11.10.22,1212", 1211, "http://localhost");
+    }
+
+    @Test
+    public void testSendPostRequest() {
+        RestfulClient.sendPostRequest("172.11.10.22,1212", "1211", "http://www.engineering.uiowa.edu/~hawkeng//fall01/graphics/potato.gif", "jason");
+        HttpResponse httpResponse = mock(HttpResponse.class);
+        HttpEntity httpEntity = mock(HttpEntity.class);
+        when(httpResponse.getEntity()).thenReturn(httpEntity);
+        assertEquals(httpResponse.getEntity(), httpEntity);
+
+    }
+
+    @Test
+    public void testExecuteHttp() throws  Exception{
+        RestfulClient.executeHttp(PUT, "172.11.10.22,1212", 1211, "http://localhost", null);
+        /*HttpResponse httpResponse = mock(HttpResponse.class);
+        CloseableHttpClient httpclient= mock(CloseableHttpClient.class);
+        HttpEntity httpEntity= mock(HttpEntity.class);
+        when(httpResponse.getEntity()).thenReturn(null);
+        assertEquals(httpResponse.getEntity(), null);*/
+
+
+    }
+
+}
\ No newline at end of file