diff options
author | 2017-10-14 18:20:39 +0800 | |
---|---|---|
committer | 2017-10-14 18:20:39 +0800 | |
commit | ab5c4b66233f7574af81a1e8f751ba70d538a8db (patch) | |
tree | 3569f0578310cc1e6e1da503e0c169c80fa6455d /nokia/vnfmdriver/vfcadaptorservice/vfcadaptor | |
parent | d3c40114e88bb9acf027fc5c046968c4c44b1a0a (diff) |
Modify service register part
Change-Id: Ie14599005868e60669a8a949dc5c8f23afa80a40
Issue-ID: VFC-53
Signed-off-by: yufei_zhou <yufei.zhou@nokia-sbell.com>
Diffstat (limited to 'nokia/vnfmdriver/vfcadaptorservice/vfcadaptor')
3 files changed, 42 insertions, 32 deletions
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/pom.xml b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/pom.xml index 827af562..3bdebb80 100644 --- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/pom.xml +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/pom.xml @@ -96,31 +96,36 @@ <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> - - - <dependency> - <groupId>org.apache.httpcomponents</groupId> - <artifactId>httpclient</artifactId> - </dependency> - <dependency> - <groupId>com.google.code.gson</groupId> - <artifactId>gson</artifactId> - </dependency> - <dependency> - <groupId>org.json</groupId> - <artifactId>json</artifactId> + + + <dependency> + <groupId>org.apache.httpcomponents</groupId> + <artifactId>httpclient</artifactId> + </dependency> + <dependency> + <groupId>com.google.code.gson</groupId> + <artifactId>gson</artifactId> + </dependency> + <dependency> + <groupId>org.json</groupId> + <artifactId>json</artifactId> + </dependency> + <dependency> + <groupId>com.alibaba</groupId> + <artifactId>fastjson</artifactId> + <version>1.2.39</version> </dependency> - - <dependency> - <groupId>org.onap.msb.java-sdk</groupId> - <artifactId>msb-java-sdk</artifactId> - <version>1.0.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>io.dropwizard</groupId> - <artifactId>dropwizard-core</artifactId> - <version>0.8.0</version> - </dependency> + + <dependency> + <groupId>org.onap.msb.java-sdk</groupId> + <artifactId>msb-java-sdk</artifactId> + <version>1.0.0-SNAPSHOT</version> + </dependency> + <dependency> + <groupId>io.dropwizard</groupId> + <artifactId>dropwizard-core</artifactId> + <version>0.8.0</version> + </dependency> </dependencies> <build> <!-- diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/VfcadaptorApplication.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/VfcadaptorApplication.java index dc2b8c0c..a7cab38a 100644 --- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/VfcadaptorApplication.java +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/VfcadaptorApplication.java @@ -28,10 +28,6 @@ import org.springframework.context.support.PropertySourcesPlaceholderConfigurer; @ComponentScan public class VfcadaptorApplication { - private VfcadaptorApplication() { - - } - public final static void main(String[] args) { SpringApplication.run(VfcadaptorApplication.class, args); } diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/msb/impl/MsbMgmrImpl.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/msb/impl/MsbMgmrImpl.java index 675229f1..5d488854 100644 --- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/msb/impl/MsbMgmrImpl.java +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/msb/impl/MsbMgmrImpl.java @@ -31,6 +31,7 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import com.alibaba.fastjson.JSON; import com.google.gson.Gson; @Component @@ -46,16 +47,19 @@ public class MsbMgmrImpl implements IMsbMgmr { public void register() { try { String vfcAdaptorInfoJsonStr = readVfcAdaptorInfoFromJsonFile(); - MicroServiceInfo msinfo = gson.fromJson(vfcAdaptorInfoJsonStr, MicroServiceInfo.class); +// MicroServiceInfo msinfo = gson.fromJson(vfcAdaptorInfoJsonStr, MicroServiceInfo.class); + + JSON json = com.alibaba.fastjson.JSON.parseObject(vfcAdaptorInfoJsonStr); + MicroServiceInfo msinfo = com.alibaba.fastjson.JSON.toJavaObject(json , MicroServiceInfo.class); MSBServiceClient msbClient = new MSBServiceClient(adaptorEnv.getMsbIp(), adaptorEnv.getMsbPort()); MicroServiceFullInfo microServiceInfo = msbClient.registerMicroServiceInfo(msinfo); logger.info("Registered service response info is " + microServiceInfo.toString()); - } catch (IOException e) { - logger.error("Failed to read vfcadaptor info! ", e); } catch (RouteException e) { - logger.error("Failed to register nokia vnfm driver! ", e); + logger.error("RouteException Failed to register nokia vnfm driver! ", e); + } catch (IOException e) { + logger.error("IOException Failed to register nokia vnfm driver! ", e); } } @@ -105,5 +109,10 @@ public class MsbMgmrImpl implements IMsbMgmr { public void setAdaptorEnv(AdaptorEnv env) { this.adaptorEnv = env; } + + public static final void main(String[] args) { + MsbMgmrImpl impl = new MsbMgmrImpl(); + impl.register(); + } } |