summaryrefslogtreecommitdiffstats
path: root/nokia
diff options
context:
space:
mode:
authoryufei_zhou <yufei.zhou@nokia-sbell.com>2018-04-02 16:28:04 +0800
committeryunlong ying <ying.yunlong@zte.com.cn>2018-04-03 01:30:48 +0000
commit6f37b2926e216487b44d7b25cdae7a9bbfd8160d (patch)
treed407ff7e106fe2ca216dbe958ed356e248bc03c6 /nokia
parent5e215a3436f04145bf12814a21fb2031c4daa4dd (diff)
Fix nexus-iq commons-httpclient issues
Change-Id: I96c6140accfb8a1c35f08eb9ac66a4a8ff27e88f Issue-ID: VFC-863 Signed-off-by: yufei_zhou <yufei.zhou@nokia-sbell.com>
Diffstat (limited to 'nokia')
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/pom.xml150
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/VnfmDriverMgmrImpl.java7
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/db/bean/VnfmResourceInfo.java88
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/db/bean/VnfmSubscriptionInfo.java24
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/db/mapper/VnfmSubscriptionsMapper.java14
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/db/repository/VnfmJobExecutionRepository.java21
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/db/repository/VnfmResourceRepository.java21
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/db/repository/VnfmSubscriptionsRepository.java24
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/http/client/HttpClientUtils.java2
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/vnfmdriver/controller/VnfmDriverController.java35
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/VnfmDriverMgmrImplTest.java3
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/vnfmdriver/controller/VnfmDriverControllerTest.java27
12 files changed, 97 insertions, 319 deletions
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/pom.xml b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/pom.xml
index 52ebd0e5..283a2cc3 100644
--- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/pom.xml
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/pom.xml
@@ -41,12 +41,7 @@
</properties>
<dependencies>
- <!--
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-data-jpa</artifactId>
- </dependency>
- -->
+
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
@@ -54,47 +49,13 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
- <!--
- <exclusions>
- <exclusion>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-logging</artifactId>
- </exclusion>
- </exclusions>
- -->
+
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</dependency>
-<!--
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-log4j2</artifactId>
- <exclusions>
- <exclusion>
- <groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-slf4j-impl</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>mysql</groupId>
- <artifactId>mysql-connector-java</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-tomcat</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.tomcat.embed</groupId>
- <artifactId>tomcat-embed-jasper</artifactId>
- <scope>provided</scope>
- </dependency>
- -->
+
<dependency>
<groupId>org.mariadb.jdbc</groupId>
@@ -118,11 +79,7 @@
<artifactId>httpclient</artifactId>
<version>4.5.5</version>
</dependency>
- <dependency>
- <groupId>commons-httpclient</groupId>
- <artifactId>commons-httpclient</artifactId>
- <version>3.1</version>
- </dependency>
+
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
@@ -161,68 +118,18 @@
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>1.3.2</version>
</dependency>
+
+ <dependency>
+ <groupId>com.alibaba</groupId>
+ <artifactId>dubbo</artifactId>
+ <version>2.6.1</version>
+ </dependency>
-<dependency>
- <groupId>ca.juliusdavies</groupId>
- <artifactId>not-yet-commons-ssl</artifactId>
- <version>0.3.11</version>
-</dependency>
</dependencies>
<build>
- <!--
- <pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.jacoco</groupId>
- <artifactId>jacoco-maven-plugin</artifactId>
- <version>0.7.9</version>
- </plugin>
- </plugins>
- </pluginManagement>
--->
+
<plugins>
- <!--
- <plugin>
- <groupId>org.jacoco</groupId>
- <artifactId>jacoco-maven-plugin</artifactId>
- <configuration>
- <includes>org.onap.vfc.nfvo.driver.vnfm.svnfm.*</includes>
- </configuration>
- <executions>
- <execution>
- <id>default-prepare-agent</id>
- <goals>
- <goal>prepare-agent</goal>
- </goals>
- </execution>
- <execution>
- <id>default-report</id>
- <phase>prepare-package</phase>
- <goals>
- <goal>report</goal>
- </goals>
- </execution>
- <execution>
- <id>default-prepare-agent-integration</id>
- <goals>
- <goal>prepare-agent-integration</goal>
- </goals>
- </execution>
- <execution>
- <id>default-check</id>
- <goals>
- <goal>check</goal>
- </goals>
- </execution>
- <execution>
- <id>default-report-integration</id>
- <goals>
- <goal>report-integration</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- -->
+
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
@@ -242,38 +149,7 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>2.21.0</version>
</plugin>
- <!--
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-failsafe-plugin</artifactId>
- <executions>
- <execution>
- <id>default-integration-test</id>
- <goals>
- <goal>integration-test</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- -->
</plugins>
</build>
- <!--
- <reporting>
- <plugins>
- <plugin>
- <groupId>org.jacoco</groupId>
- <artifactId>jacoco-maven-plugin</artifactId>
- <reportSets>
- <reportSet>
- <reports>
- <report>report</report>
- </reports>
- </reportSet>
- </reportSets>
- </plugin>
- </plugins>
- </reporting>
-
- -->
+
</project>
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/VnfmDriverMgmrImpl.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/VnfmDriverMgmrImpl.java
index 028f6152..e2e349d9 100644
--- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/VnfmDriverMgmrImpl.java
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/VnfmDriverMgmrImpl.java
@@ -37,6 +37,7 @@ import org.onap.vfc.nfvo.driver.vnfm.svnfm.constant.CommonConstants;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.constant.CommonEnum;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.constant.ScaleType;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.db.bean.VnfmJobExecutionInfo;
+import org.onap.vfc.nfvo.driver.vnfm.svnfm.db.bean.VnfmSubscriptionInfo;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.db.mapper.VnfcResourceInfoMapper;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.db.mapper.VnfmJobExecutionMapper;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.db.mapper.VnfmSubscriptionsMapper;
@@ -363,7 +364,11 @@ public class VnfmDriverMgmrImpl implements VnfmDriverMgmrInf {
cbamRequest.setFilter(request.getFilter());
CBAMCreateSubscriptionResponse cbamResponse = cbamMgmr.createSubscription(cbamRequest);
driverResponse = responseConverter.queryRspConvert(cbamResponse);
- subscriptionsMapper.insert(cbamResponse.getId());
+ VnfmSubscriptionInfo subscriptionInfo = new VnfmSubscriptionInfo();
+ subscriptionInfo.setId(cbamResponse.getId());
+ subscriptionInfo.setDriverCallbackUrl(cbamResponse.getId());
+ subscriptionInfo.setNslcmCallbackUrl(request.getCallbackUri());
+ subscriptionsMapper.insert(subscriptionInfo);
} catch (Exception e) {
logger.error("error VnfmDriverMgmrImpl --> createSubscripiton. ", e);
throw new VnfmDriverException(HttpStatus.SC_INTERNAL_SERVER_ERROR, CommonConstants.HTTP_ERROR_DESC_500);
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/db/bean/VnfmResourceInfo.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/db/bean/VnfmResourceInfo.java
deleted file mode 100644
index c40fe91d..00000000
--- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/db/bean/VnfmResourceInfo.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
-* Copyright 2016-2017, Nokia Corporation
-*
-* 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.driver.vnfm.svnfm.db.bean;
-
-import java.io.Serializable;
-
-//import javax.persistence.Column;
-//import javax.persistence.Entity;
-//import javax.persistence.GeneratedValue;
-//import javax.persistence.GenerationType;
-//import javax.persistence.Id;
-//import javax.persistence.Table;
-
-//@Entity
-//@Table(name="vnfm_resource_info")
-public class VnfmResourceInfo implements Serializable {
- private static final long serialVersionUID = -288015953900428312L;
-// @Id
-// @GeneratedValue(strategy = GenerationType.AUTO)
- private int id;
-
-// @Column(name = "type")
- private ResourceType type;
-
-// @Column(name = "resource_definition_id")
- private String resourceDefinitionId;
-
-// @Column(name = "vdu")
- private String vdu;
-
-// @Column(name = "status")
- private String status;
-
- public int getId() {
- return id;
- }
-
- public void setId(int id) {
- this.id = id;
- }
-
- public ResourceType getType() {
- return type;
- }
-
- public void setType(ResourceType type) {
- this.type = type;
- }
-
- public String getResourceDefinitionId() {
- return resourceDefinitionId;
- }
-
- public void setResourceDefinitionId(String resourceDefinitionId) {
- this.resourceDefinitionId = resourceDefinitionId;
- }
-
- public String getVdu() {
- return vdu;
- }
-
- public void setVdu(String vdu) {
- this.vdu = vdu;
- }
-
- public String getStatus() {
- return status;
- }
-
- public void setStatus(String status) {
- this.status = status;
- }
-
-}
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/db/bean/VnfmSubscriptionInfo.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/db/bean/VnfmSubscriptionInfo.java
index b517657d..f2753115 100644
--- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/db/bean/VnfmSubscriptionInfo.java
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/db/bean/VnfmSubscriptionInfo.java
@@ -33,6 +33,10 @@ public class VnfmSubscriptionInfo implements Serializable {
// @Id
// @Column(name = "id")
private String id;
+
+ private String driverCallbackUrl;
+
+ private String nslcmCallbackUrl;
public static long getSerialversionuid() {
return serialVersionUID;
@@ -46,10 +50,24 @@ public class VnfmSubscriptionInfo implements Serializable {
this.id = id;
}
- @Override
- public String toString() {
- return " VnfmSubscriptionInfo: [ " + super.toString() + ", id = " + id + "]";
+ public String getDriverCallbackUrl() {
+ return driverCallbackUrl;
+ }
+
+ public void setDriverCallbackUrl(String driverCallbackUrl) {
+ this.driverCallbackUrl = driverCallbackUrl;
+ }
+ public String getNslcmCallbackUrl() {
+ return nslcmCallbackUrl;
}
+ public void setNslcmCallbackUrl(String nslcmCallbackUrl) {
+ this.nslcmCallbackUrl = nslcmCallbackUrl;
+ }
+
+ @Override
+ public String toString() {
+ return " VnfmSubscriptionInfo: [ " + super.toString() + ", id = " + id + ", driverCallbackUrl = " + driverCallbackUrl +", nslcmCallbackUrl = " + nslcmCallbackUrl + "]";
+ }
}
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/db/mapper/VnfmSubscriptionsMapper.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/db/mapper/VnfmSubscriptionsMapper.java
index 6840cf39..8b2a26d4 100644
--- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/db/mapper/VnfmSubscriptionsMapper.java
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/db/mapper/VnfmSubscriptionsMapper.java
@@ -24,7 +24,6 @@ import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
-import org.onap.vfc.nfvo.driver.vnfm.svnfm.db.bean.VnfmJobExecutionInfo;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.db.bean.VnfmSubscriptionInfo;
@Mapper
@@ -32,20 +31,25 @@ public interface VnfmSubscriptionsMapper {
@Select("SELECT * FROM vnfm_subscription_info")
@Results({
@Result(property = "id", column = "id"),
+ @Result(property = "driverCallbackUrl", column = "driver_callback_url"),
+ @Result(property = "nslcmCallbackUrl", column = "nslcm_callback_url")
})
List<VnfmSubscriptionInfo> getAll();
@Select("SELECT * FROM vnfm_subscription_info WHERE id = #{id}")
@Results({
@Result(property = "id", column = "id"),
+ @Result(property = "driverCallbackUrl", column = "driver_callback_url"),
+ @Result(property = "nslcmCallbackUrl", column = "nslcm_callback_url")
})
VnfmSubscriptionInfo findOne(String id);
-// @Insert("INSERT INTO vnfm_subscription_info(id) VALUES(#{id})")
-// void insert(VnfmJobExecutionInfo user);
+ @Insert("INSERT IGNORE INTO vnfm_subscription_info(id, driver_callback_url, nslcm_callback_url) VALUES(#{id}, #{driverCallbackUrl}, #{nslcmCallbackUrl})")
+ void insert(VnfmSubscriptionInfo info);
+
+ @Insert("update vnfm_subscription_info set driver_callback_url = #{driverCallbackUrl}, nslcm_callback_url = #{nslcmCallbackUrl}) WHERE id = #{id}")
+ void update(VnfmSubscriptionInfo info);
- @Insert("INSERT INTO vnfm_subscription_info(id) VALUES(#{id})")
- void insert(String id);
@Delete("DELETE FROM vnfm_subscription_info WHERE id =#{id}")
void delete(String id);
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/db/repository/VnfmJobExecutionRepository.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/db/repository/VnfmJobExecutionRepository.java
deleted file mode 100644
index 4726d9c2..00000000
--- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/db/repository/VnfmJobExecutionRepository.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright 2016-2017, Nokia Corporation
- *
- * 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.driver.vnfm.svnfm.db.repository;
-
-public interface VnfmJobExecutionRepository //extends CrudRepository< VnfmJobExecutionInfo, Long>
-{
-
-}
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/db/repository/VnfmResourceRepository.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/db/repository/VnfmResourceRepository.java
deleted file mode 100644
index 1c8456bd..00000000
--- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/db/repository/VnfmResourceRepository.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright 2016-2017, Nokia Corporation
- *
- * 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.driver.vnfm.svnfm.db.repository;
-
-public interface VnfmResourceRepository //extends CrudRepository<VnfmResourceInfo, Integer>
-{
-
-}
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/db/repository/VnfmSubscriptionsRepository.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/db/repository/VnfmSubscriptionsRepository.java
deleted file mode 100644
index e5d3bd7d..00000000
--- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/db/repository/VnfmSubscriptionsRepository.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright 2016-2017, Nokia Corporation
- *
- * 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.driver.vnfm.svnfm.db.repository;
-
-import org.onap.vfc.nfvo.driver.vnfm.svnfm.db.bean.VnfmSubscriptionInfo;
-//import org.springframework.data.repository.CrudRepository;
-
-public interface VnfmSubscriptionsRepository //extends CrudRepository<VnfmSubscriptionInfo, Integer>
-{
-
-}
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/http/client/HttpClientUtils.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/http/client/HttpClientUtils.java
index 0d3d5a1e..cbd56f42 100644
--- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/http/client/HttpClientUtils.java
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/http/client/HttpClientUtils.java
@@ -52,7 +52,7 @@ public class HttpClientUtils {
@Bean
public static HttpClientBuilder createHttpClientBuilder() {
- org.apache.commons.httpclient.protocol.Protocol.unregisterProtocol("https");
+// org.apache.commons.httpclient.protocol.Protocol.unregisterProtocol("https");
SSLContext sslcontext = null;
try {
sslcontext = createIgnoreVerifySSL();
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/vnfmdriver/controller/VnfmDriverController.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/vnfmdriver/controller/VnfmDriverController.java
index 99c06b2c..fa7eb46d 100644
--- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/vnfmdriver/controller/VnfmDriverController.java
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/vnfmdriver/controller/VnfmDriverController.java
@@ -16,12 +16,15 @@
package org.onap.vfc.nfvo.driver.vnfm.svnfm.vnfmdriver.controller;
+import java.io.BufferedReader;
import java.io.IOException;
+import java.io.InputStreamReader;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import org.apache.commons.io.IOUtils;
+//import org.apache.commons.io.IOUtils;
+import com.alibaba.dubbo.common.utils.IOUtils;
import org.apache.http.HttpStatus;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.cbam.inf.CbamMgmrInf;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.exception.VnfmDriverException;
@@ -60,9 +63,6 @@ public class VnfmDriverController {
@Autowired
private VnfmDriverMgmrInf vnfmDriverMgmr;
- @Autowired
- private CbamMgmrInf cbamMgmr;
-
private Gson gson = new Gson();
@RequestMapping(value = "/swagger.json", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@@ -70,7 +70,7 @@ public class VnfmDriverController {
public String apidoc() throws IOException {
// String client = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest().getRemoteAddr();
ClassLoader classLoader = getClass().getClassLoader();
- return IOUtils.toString(classLoader.getResourceAsStream("swagger.json"));
+ return IOUtils.read(new BufferedReader(new InputStreamReader(classLoader.getResourceAsStream("swagger.json"))));
}
@RequestMapping(value = "/{vnfmId}/vnfs", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
@@ -197,29 +197,30 @@ public class VnfmDriverController {
return null;
}
-// @RequestMapping(value = "/notifications", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
-// public CBAMVnfNotificationResponse notificationVnf(@RequestBody CBAMVnfNotificationRequest request, HttpServletResponse httpResponse) throws ClientProtocolException, Exception
@RequestMapping(value = "/notifications")
-// @ResponseBody
- public void notificationVnf(HttpServletRequest request, HttpServletResponse httpResponse)
+ public void notificationVnf(HttpServletRequest request, HttpServletResponse httpResponse) throws IOException
{
-// String jsonString = gson.toJson(request);
-// logger.info("notificationVnf request: bodyMessage is " + jsonString);
- logger.info("notificationVnf request: bodyMessage is " + request.getMethod() + ",");
+ logger.info("VnfmDriverController -> notificationVnf request: request method is " + request.getMethod() + ",");
try {
-// CBAMVnfNotificationResponse response = cbamMgmr.getNotification(request);
- httpResponse.setStatus(204);
-// logger.info("cbamController --> notificationVnf response is " + gson.toJson(response));
-// return response;
+ if("GET".equalsIgnoreCase(request.getMethod())) // this is for link test
+ {
+ httpResponse.setStatus(HttpStatus.SC_NO_CONTENT);
+ }
+ else if("POST".equalsIgnoreCase(request.getMethod()))
+ {
+ httpResponse.setStatus(HttpStatus.SC_NO_CONTENT);
+ BufferedReader reader = new BufferedReader(new InputStreamReader(request.getInputStream()));
+ String bodyString = IOUtils.read(reader);
+ logger.info("VnfmDriverController -> notificationVnf request: bodyMessage is " + bodyString);
+ }
}
catch(VnfmDriverException e)
{
processControllerException(httpResponse, e);
}
-// return null;
}
private void processControllerException(HttpServletResponse httpResponse, VnfmDriverException e) {
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/VnfmDriverMgmrImplTest.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/VnfmDriverMgmrImplTest.java
index 8a2090fd..beb70763 100644
--- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/VnfmDriverMgmrImplTest.java
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/VnfmDriverMgmrImplTest.java
@@ -52,6 +52,7 @@ import org.onap.vfc.nfvo.driver.vnfm.svnfm.common.bo.AdaptorEnv;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.constant.CommonEnum;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.constant.ScaleType;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.db.bean.VnfmJobExecutionInfo;
+import org.onap.vfc.nfvo.driver.vnfm.svnfm.db.bean.VnfmSubscriptionInfo;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.db.mapper.VnfmJobExecutionMapper;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.db.mapper.VnfmSubscriptionsMapper;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.exception.VnfmDriverException;
@@ -239,7 +240,7 @@ public class VnfmDriverMgmrImplTest {
mockCbamResponse.setId("subscriptionId_001");
mockCbamResponse.setCallbackUrl("callbackUrl");
when(cbamMgmr.createSubscription(Mockito.any(CBAMCreateSubscriptionRequest.class))).thenReturn(mockCbamResponse);
- doNothing().when(subscriptionsMapper).insert(Mockito.anyString());
+ doNothing().when(subscriptionsMapper).insert(Mockito.any(VnfmSubscriptionInfo.class));
CreateSubscriptionRequest request = new CreateSubscriptionRequest();
CreateSubscriptionResponse response = vnfmDriverMgmr.createSubscription(request);
Assert.assertEquals("callbackUrl", response.getCallbackUri());
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/vnfmdriver/controller/VnfmDriverControllerTest.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/vnfmdriver/controller/VnfmDriverControllerTest.java
index 103b394b..9bacde42 100644
--- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/vnfmdriver/controller/VnfmDriverControllerTest.java
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/vnfmdriver/controller/VnfmDriverControllerTest.java
@@ -305,5 +305,32 @@ public class VnfmDriverControllerTest {
JSONObject jsonObj = new JSONObject(responseString);
Assert.assertEquals("jobId is ", mockResponse.getCallbackUri(), jsonObj.get("callbackUri"));
}
+
+ @Test
+ public void testNotificationVnfCreateSubscripitonPost() throws Exception {
+ CreateSubscriptionResponse mockResponse = new CreateSubscriptionResponse();
+ mockResponse.setCallbackUri("callbackUri");
+ String jsonString = "{\"callbackUri\":\"callbackUri\"," + "\"authentication\":{\"userName\":\"userName\",\"password\":\"password\",\"clientName\":\"clientName\"}}";
+
+ when(vnfmDriverMgmr.createSubscription(Mockito.any(CreateSubscriptionRequest.class))).thenReturn(mockResponse);
+
+ mockMvc.perform(
+ post("/api/nokiavnfmdriver/v1/notifications").
+ characterEncoding("UTF-8").
+ accept(MediaType.APPLICATION_JSON).
+ contentType(MediaType.APPLICATION_JSON).
+ content(jsonString))
+ .andDo(print())
+ .andExpect(status().isNoContent())
+ .andReturn().getResponse().getContentAsString();
+ }
+
+ @Test
+ public void testNotificationVnfCreateSubscripitonGet() throws Exception {
+ mockMvc.perform(
+ get("/api/nokiavnfmdriver/v1/notifications"))
+ .andDo(print())
+ .andExpect(status().isNoContent());
+ }
}