feat:Add the function of obtaining instance creation progress 38/125538/1
author’zhaoyh6‘ <zhaoyh6@asiainfo.com>
Wed, 3 Nov 2021 03:17:58 +0000 (11:17 +0800)
committer’zhaoyh6‘ <zhaoyh6@asiainfo.com>
Wed, 3 Nov 2021 03:18:46 +0000 (11:18 +0800)
Issue-ID: USECASEUI-605
Signed-off-by: ’zhaoyh6‘ <zhaoyh6@asiainfo.com>
Change-Id: I4458ba77b61ee95ffafac6e3595421a68f2594ac

server/src/main/java/org/onap/usecaseui/server/bean/intent/CCVPNInstance.java [moved from server/src/main/java/org/onap/usecaseui/server/bean/intent/IntentInstance.java with 96% similarity]
server/src/main/java/org/onap/usecaseui/server/conf/intent/IntentScheduleTask.java
server/src/main/java/org/onap/usecaseui/server/controller/IntentController.java
server/src/main/java/org/onap/usecaseui/server/service/intent/IntentApiService.java
server/src/main/java/org/onap/usecaseui/server/service/intent/IntentInstanceService.java
server/src/main/java/org/onap/usecaseui/server/service/intent/impl/IntentInstanceServiceImpl.java
server/src/test/java/org/onap/usecaseui/server/controller/IntentControllerTest.java
server/src/test/java/org/onap/usecaseui/server/service/intent/impl/IntentInstanceServiceImplTest.java
standalone/src/main/assembly/resources/dbscripts/postgres/uui_create_table.sql

@@ -18,8 +18,8 @@ import javax.persistence.*;
 import java.io.Serializable;
 
 @Entity
-@Table(name="intent_instance")
-public class IntentInstance implements Serializable {
+@Table(name="ccvpn_instance")
+public class CCVPNInstance implements Serializable {
 
     @Id
     @GeneratedValue(strategy=GenerationType.IDENTITY)
@@ -59,7 +59,7 @@ public class IntentInstance implements Serializable {
     @Column(name = "delete_state")
     private int deleteState;
 
-    public IntentInstance() {
+    public CCVPNInstance() {
 
     }
 
index 4f16880..f84ad49 100644 (file)
@@ -33,7 +33,7 @@ public class IntentScheduleTask {
 
     @Scheduled(cron = "0/20 * * * * ?")
     public void getIntentInstanceCompleteness() {
-        intentInstanceService.getIntentInstanceCreateStatus();
+        intentInstanceService.getIntentInstanceProgress();
     }
     @Scheduled(cron = "0/20 * * * * ?")
     public void getIntentInstanceBandwidth() throws IOException {
index 4dbed7b..3dd3572 100644 (file)
@@ -24,7 +24,7 @@ import javax.annotation.Resource;
 import com.alibaba.fastjson.JSONArray;
 import org.apache.commons.collections.MapUtils;
 import org.onap.usecaseui.server.bean.HttpResponseResult;
-import org.onap.usecaseui.server.bean.intent.IntentInstance;
+import org.onap.usecaseui.server.bean.intent.CCVPNInstance;
 import org.onap.usecaseui.server.bean.intent.IntentModel;
 import org.onap.usecaseui.server.bean.intent.IntentResponseBody;
 import org.onap.usecaseui.server.service.csmf.SlicingService;
@@ -362,16 +362,16 @@ public class IntentController {
         String accessPointOneName = MapUtils.getString(accessPointOne, "name");
         int accessPointOneBandWidth = MapUtils.getIntValue(accessPointOne, "bandwidth");
 
-        IntentInstance intentInstance = new IntentInstance();
-        intentInstance.setInstanceId(intentInstanceId);
-        intentInstance.setName(name);
-        intentInstance.setLineNum(lineNum);
-        intentInstance.setCloudPointName(cloudPointName);
-        intentInstance.setAccessPointOneName(accessPointOneName);
-        intentInstance.setAccessPointOneBandWidth(accessPointOneBandWidth);
-        intentInstance.setStatus("0");
+        CCVPNInstance instance = new CCVPNInstance();
+        instance.setInstanceId(intentInstanceId);
+        instance.setName(name);
+        instance.setLineNum(lineNum);
+        instance.setCloudPointName(cloudPointName);
+        instance.setAccessPointOneName(accessPointOneName);
+        instance.setAccessPointOneBandWidth(accessPointOneBandWidth);
+        instance.setStatus("0");
 
-        int flag = intentInstanceService.createIntentInstance(intentInstance);
+        int flag = intentInstanceService.createIntentInstance(instance);
 
         if(flag == 1) {
             return "OK";
@@ -385,9 +385,9 @@ public class IntentController {
     @GetMapping(value = {"/getFinishedInstanceInfo"},
             produces = "application/json")
     public Object getFinishedInstanceInfo() {
-        List<IntentInstance> instanceList = intentInstanceService.getFinishedInstanceInfo();
+        List<CCVPNInstance> instanceList = intentInstanceService.getFinishedInstanceInfo();
         List<Map<String, Object>> result = new ArrayList<>();
-        for (IntentInstance instance : instanceList) {
+        for (CCVPNInstance instance : instanceList) {
             Map<String, Object> instanceInfo = new HashMap<>();
             instanceInfo.put("instanceId", instance.getInstanceId());
             instanceInfo.put("name", instance.getName());
index 62f2381..4d52638 100644 (file)
@@ -30,6 +30,15 @@ public interface IntentApiService {
     @POST("/so/infra/serviceIntent/v1/create")
     Call<JSONObject> createIntentInstance(@Body RequestBody body);
 
+//    curl -X GET -H "content-type:application/json" http://so:8080/onap/so/infra/e2eServiceInstances/v3/cll-101/operations/0d698405-9109-49f2-9939-fd02ead31660 --user 'InfraPortalClient:password1$'
+
+    @Headers({
+            "Authorization: Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA==",
+            "Accept: application/json"
+    })
+    @GET("/so/infra/e2eServiceInstances/v3/{serviceId}/operations/{operationId}")
+    Call<JSONObject> queryOperationProgress(@Path("serviceId") String serviceId, @Path("operationId") String operationId);
+
     @Headers({
             "X-TransactionId: 9999",
             "X-FromAppId: MSO",
index ddbcb6e..2491cc2 100644 (file)
@@ -17,7 +17,7 @@ package org.onap.usecaseui.server.service.intent;
 
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
-import org.onap.usecaseui.server.bean.intent.IntentInstance;
+import org.onap.usecaseui.server.bean.intent.CCVPNInstance;
 import org.onap.usecaseui.server.util.Page;
 
 import java.io.IOException;
@@ -25,11 +25,11 @@ import java.util.List;
 import java.util.Map;
 
 public interface IntentInstanceService {
-    Page<IntentInstance> queryIntentInstance(IntentInstance intentInstance, int currentPage, int pageSize);
-    int createIntentInstance(IntentInstance intentInstance);
+    Page<CCVPNInstance> queryIntentInstance(CCVPNInstance instance, int currentPage, int pageSize);
+    int createIntentInstance(CCVPNInstance instance);
     void getIntentInstanceProgress();
     void getIntentInstanceCreateStatus();
-    List<IntentInstance> getFinishedInstanceInfo();
+    List<CCVPNInstance> getFinishedInstanceInfo();
     void getIntentInstanceBandwidth() throws IOException;
 
     void deleteIntentInstance(String instanceId);
index 6b1e96c..2e3c961 100644 (file)
@@ -23,11 +23,10 @@ import org.hibernate.Session;
 import org.hibernate.SessionFactory;
 import org.hibernate.Transaction;
 import org.onap.usecaseui.server.bean.intent.InstancePerformance;
-import org.onap.usecaseui.server.bean.intent.IntentInstance;
+import org.onap.usecaseui.server.bean.intent.CCVPNInstance;
 import org.onap.usecaseui.server.service.intent.IntentApiService;
 import org.onap.usecaseui.server.service.intent.IntentInstanceService;
 import org.onap.usecaseui.server.service.lcm.domain.so.SOService;
-import org.onap.usecaseui.server.service.lcm.domain.so.bean.OperationProgressInformation;
 import org.onap.usecaseui.server.util.Page;
 import org.onap.usecaseui.server.util.RestfulServices;
 import org.onap.usecaseui.server.util.UuiCommonUtil;
@@ -79,33 +78,33 @@ public class IntentInstanceServiceImpl implements IntentInstanceService {
     }
 
     @Override
-    public Page<IntentInstance> queryIntentInstance(IntentInstance intentInstance, int currentPage, int pageSize) {
-        Page<IntentInstance> page = new Page<IntentInstance>();
-        int allRow =this.getAllCount(intentInstance,currentPage,pageSize);
+    public Page<CCVPNInstance> queryIntentInstance(CCVPNInstance instance, int currentPage, int pageSize) {
+        Page<CCVPNInstance> page = new Page<CCVPNInstance>();
+        int allRow =this.getAllCount(instance,currentPage,pageSize);
         int offset = page.countOffset(currentPage, pageSize);
         Session session = getSession();
         try{
-            StringBuffer hql =new StringBuffer("from IntentInstance a where deleteState = 0");
-            if (null != intentInstance) {
-                if(UuiCommonUtil.isNotNullOrEmpty(intentInstance.getInstanceId())) {
-                    String ver =intentInstance.getInstanceId();
+            StringBuffer hql =new StringBuffer("from CCVPNInstance a where deleteState = 0");
+            if (null != instance) {
+                if(UuiCommonUtil.isNotNullOrEmpty(instance.getInstanceId())) {
+                    String ver =instance.getInstanceId();
                     hql.append(" and a.instance_id = '"+ver+"'");
                 }
-                if(UuiCommonUtil.isNotNullOrEmpty(intentInstance.getJobId())) {
-                    String ver =intentInstance.getJobId();
+                if(UuiCommonUtil.isNotNullOrEmpty(instance.getJobId())) {
+                    String ver =instance.getJobId();
                     hql.append(" and a.job_id = '"+ver+"'");
                 }
-                if(UuiCommonUtil.isNotNullOrEmpty(intentInstance.getStatus())) {
-                    String ver =intentInstance.getStatus();
+                if(UuiCommonUtil.isNotNullOrEmpty(instance.getStatus())) {
+                    String ver =instance.getStatus();
                     hql.append(" and a.status = '"+ver+"'");
                 }
             }
             hql.append(" order by id");
-            logger.info("AlarmsHeaderServiceImpl queryIntentInstance: intentInstance={}", intentInstance);
+            logger.info("AlarmsHeaderServiceImpl queryIntentInstance: instance={}", instance);
             Query query = session.createQuery(hql.toString());
             query.setFirstResult(offset);
             query.setMaxResults(pageSize);
-            List<IntentInstance> list= query.list();
+            List<CCVPNInstance> list= query.list();
             page.setPageNo(currentPage);
             page.setPageSize(pageSize);
             page.setTotalRecords(allRow);
@@ -120,21 +119,21 @@ public class IntentInstanceServiceImpl implements IntentInstanceService {
     }
 
 
-    public int getAllCount(IntentInstance intentInstance,int currentPage,int pageSize) {
+    public int getAllCount(CCVPNInstance instance, int currentPage, int pageSize) {
         Session session = getSession();
         try{
-            StringBuffer count=new StringBuffer("select count(*) from IntentInstance a where deleteState = 0");
-            if (null != intentInstance) {
-                if(UuiCommonUtil.isNotNullOrEmpty(intentInstance.getInstanceId())) {
-                    String ver =intentInstance.getInstanceId();
+            StringBuffer count=new StringBuffer("select count(*) from CCVPNInstance a where deleteState = 0");
+            if (null != instance) {
+                if(UuiCommonUtil.isNotNullOrEmpty(instance.getInstanceId())) {
+                    String ver =instance.getInstanceId();
                     count.append(" and a.instance_id = '"+ver+"'");
                 }
-                if(UuiCommonUtil.isNotNullOrEmpty(intentInstance.getJobId())) {
-                    String ver =intentInstance.getJobId();
+                if(UuiCommonUtil.isNotNullOrEmpty(instance.getJobId())) {
+                    String ver =instance.getJobId();
                     count.append(" and a.job_id = '"+ver+"'");
                 }
-                if(UuiCommonUtil.isNotNullOrEmpty(intentInstance.getStatus())) {
-                    String ver =intentInstance.getStatus();
+                if(UuiCommonUtil.isNotNullOrEmpty(instance.getStatus())) {
+                    String ver =instance.getStatus();
                     count.append(" and a.status = '"+ver+"'");
                 }
             }
@@ -150,25 +149,25 @@ public class IntentInstanceServiceImpl implements IntentInstanceService {
     }
 
     @Override
-    public int createIntentInstance(IntentInstance intentInstance) {
+    public int createIntentInstance(CCVPNInstance instance) {
         Session session = getSession();
         Transaction tx = null;
         try{
 
-            if (null == intentInstance){
-                logger.error("intentInstance is null!");
+            if (null == instance){
+                logger.error("instance is null!");
                 return 0;
             }
-            String jobId = createIntentInstanceToSO(intentInstance);
+            String jobId = createIntentInstanceToSO(instance);
             if (null == jobId){
                 logger.error("create Instance error:jobId is null");
                 return 0;
             }
-            intentInstance.setJobId(jobId);
-            intentInstance.setResourceInstanceId("cll-"+intentInstance.getInstanceId());
+            instance.setJobId(jobId);
+            instance.setResourceInstanceId("cll-"+instance.getInstanceId());
 
             tx = session.beginTransaction();
-            session.save(intentInstance);
+            session.save(instance);
             tx.commit();
             return 1;
         } catch (Exception e) {
@@ -182,9 +181,9 @@ public class IntentInstanceServiceImpl implements IntentInstanceService {
         }
     }
 
-    private String createIntentInstanceToSO(IntentInstance intentInstance) throws IOException {
+    private String createIntentInstanceToSO(CCVPNInstance instance) throws IOException {
         Map<String, Object> params = new HashMap<>();
-        params.put("name", intentInstance.getName());
+        params.put("name", instance.getName());
         params.put("modelInvariantUuid", "6790ab0e-034f-11eb-adc1-0242ac120002");
         params.put("modelUuid", "6790ab0e-034f-11eb-adc1-0242ac120002");
         params.put("globalSubscriberId", "IBNCustomer");
@@ -192,18 +191,18 @@ public class IntentInstanceServiceImpl implements IntentInstanceService {
         params.put("serviceType", "CLL");
         Map<String, Object> additionalProperties = new HashMap<>();
         additionalProperties.put("enableSdnc", "false");
-        additionalProperties.put("serviceInstanceID", "cll-" + intentInstance.getInstanceId());
+        additionalProperties.put("serviceInstanceID", "cll-" + instance.getInstanceId());
         List<Map<String, Object>> transportNetworks = new ArrayList<>();
         Map<String, Object> transportNetwork = new HashMap<>();
         transportNetwork.put("id", "");
         Map<String, Object> sla = new HashMap<>();
         sla.put("latency", "2");
-        sla.put("maxBandwidth", intentInstance.getAccessPointOneBandWidth());
+        sla.put("maxBandwidth", instance.getAccessPointOneBandWidth());
         List<Map<String, Object>> connectionLinks = new ArrayList<>();
         Map<String, Object> connectionLink = new HashMap<>();
         connectionLink.put("name", "");
-        connectionLink.put("transportEndpointA", intentInstance.getAccessPointOneName());
-        connectionLink.put("transportEndpointB", intentInstance.getCloudPointName());
+        connectionLink.put("transportEndpointA", instance.getAccessPointOneName());
+        connectionLink.put("transportEndpointB", instance.getCloudPointName());
         connectionLinks.add(connectionLink);
         transportNetwork.put("sla", sla);
         transportNetwork.put("connectionLinks", connectionLinks);
@@ -221,11 +220,12 @@ public class IntentInstanceServiceImpl implements IntentInstanceService {
 
     @Override
     public void getIntentInstanceProgress() {
-        List<IntentInstance> instanceList = getInstanceByFinishedFlag("0");
-        for (IntentInstance instance: instanceList) {
+        List<CCVPNInstance> instanceList = getInstanceByFinishedFlag("0");
+        for (CCVPNInstance instance: instanceList) {
             try {
 
                 int progress = getProgressByJobId(instance);
+                instance.setProgress(progress);
                 if (progress >=100) {
                     instance.setStatus("1");
                 }
@@ -239,8 +239,8 @@ public class IntentInstanceServiceImpl implements IntentInstanceService {
     }
     @Override
     public void getIntentInstanceCreateStatus() {
-        List<IntentInstance> instanceList = getInstanceByFinishedFlag("0");
-        for (IntentInstance instance: instanceList) {
+        List<CCVPNInstance> instanceList = getInstanceByFinishedFlag("0");
+        for (CCVPNInstance instance: instanceList) {
             try {
 
                 int flag = getCreateStatusByJobId(instance);
@@ -256,7 +256,7 @@ public class IntentInstanceServiceImpl implements IntentInstanceService {
 
     }
 
-    private void saveProgress(List<IntentInstance> instanceList) {
+    private void saveProgress(List<CCVPNInstance> instanceList) {
         if(instanceList == null || instanceList.isEmpty()) {
             return;
         }
@@ -264,7 +264,7 @@ public class IntentInstanceServiceImpl implements IntentInstanceService {
         Transaction tx = null;
         try {
             tx = session.beginTransaction();
-            for (IntentInstance instance : instanceList) {
+            for (CCVPNInstance instance : instanceList) {
                 session.update(instance);
                 session.flush();
             }
@@ -282,16 +282,18 @@ public class IntentInstanceServiceImpl implements IntentInstanceService {
         }
     }
 
-    private int getProgressByJobId(IntentInstance instance) throws IOException {
-        Response<OperationProgressInformation> response = soService.queryOperationProgress(instance.getResourceInstanceId(), instance.getJobId()).execute();
+    private int getProgressByJobId(CCVPNInstance instance) throws IOException {
+        Response<JSONObject> response = intentApiService.queryOperationProgress(instance.getResourceInstanceId(), instance.getJobId()).execute();
         logger.debug(response.toString());
         if (response.isSuccessful()) {
-            return response.body().getOperationStatus().getProgress();
+            if (response.body().containsKey("operation")) {
+                return response.body().getJSONObject("operation").getInteger("progress");
+            }
         }
         return -1;
     }
 
-    private int getCreateStatusByJobId(IntentInstance instance) throws IOException {
+    private int getCreateStatusByJobId(CCVPNInstance instance) throws IOException {
         if (instance == null || instance.getResourceInstanceId() == null) {
             return -1;
         }
@@ -308,13 +310,13 @@ public class IntentInstanceServiceImpl implements IntentInstanceService {
         return -1;
     }
 
-    private List<IntentInstance> getInstanceByFinishedFlag(String flag) {
+    private List<CCVPNInstance> getInstanceByFinishedFlag(String flag) {
         Session session = getSession();
         try{
-            StringBuffer sql=new StringBuffer("from IntentInstance where deleteState = 0 and status = '" + flag + "'");
+            StringBuffer sql=new StringBuffer("from CCVPNInstance where deleteState = 0 and status = '" + flag + "'");
 
             Query query = session.createQuery(sql.toString());
-            List<IntentInstance> q=(List<IntentInstance>) query.list();
+            List<CCVPNInstance> q=(List<CCVPNInstance>) query.list();
             logger.debug(q.toString());
             return q;
         } catch (Exception e) {
@@ -327,13 +329,13 @@ public class IntentInstanceServiceImpl implements IntentInstanceService {
 
 
     @Override
-    public List<IntentInstance> getFinishedInstanceInfo() {
+    public List<CCVPNInstance> getFinishedInstanceInfo() {
         Session session = getSession();
         try{
-            StringBuffer count=new StringBuffer("from IntentInstance where status = '1' and deleteState = 0");
+            StringBuffer count=new StringBuffer("from CCVPNInstance where status = '1' and deleteState = 0");
 
             Query query = session.createQuery(count.toString());
-            List<IntentInstance> q=(List<IntentInstance>) query.list();
+            List<CCVPNInstance> q=(List<CCVPNInstance>) query.list();
             logger.debug(q.toString());
             return q;
         } catch (Exception e) {
@@ -346,8 +348,8 @@ public class IntentInstanceServiceImpl implements IntentInstanceService {
 
     @Override
     public void getIntentInstanceBandwidth() throws IOException {
-        List<IntentInstance> instanceList = getInstanceByFinishedFlag("1");
-        for (IntentInstance instance : instanceList) {
+        List<CCVPNInstance> instanceList = getInstanceByFinishedFlag("1");
+        for (CCVPNInstance instance : instanceList) {
             String serviceInstanceId = instance.getResourceInstanceId();
             Response<JSONObject> response = intentApiService.getInstanceNetworkInfo(serviceInstanceId).execute();
             if (!response.isSuccessful()) {
@@ -418,13 +420,13 @@ public class IntentInstanceServiceImpl implements IntentInstanceService {
 
     @Override
     public void deleteIntentInstance(String instanceId) {
-        IntentInstance result = null;
+        CCVPNInstance result = null;
         Session session = getSession();
         try {
 
-            result = (IntentInstance)session.createQuery("from IntentInstance where deleteState = 0 and instanceId = :instanceId")
+            result = (CCVPNInstance)session.createQuery("from CCVPNInstance where deleteState = 0 and instanceId = :instanceId")
                     .setParameter("instanceId", instanceId).uniqueResult();
-            logger.info("get IntentInstance OK, id=" + instanceId);
+            logger.info("get CCVPNInstance OK, id=" + instanceId);
 
         } catch (Exception e) {
             logger.error("getodel occur exception:"+e);
@@ -454,7 +456,7 @@ public class IntentInstanceServiceImpl implements IntentInstanceService {
         okhttp3.RequestBody requestBody = okhttp3.RequestBody.create(okhttp3.MediaType.parse("application/json"), JSON.toJSONString(params));
         intentApiService.deleteIntentInstance(requestBody).execute();
     }
-    private String deleteInstance(IntentInstance instance) {
+    private String deleteInstance(CCVPNInstance instance) {
         Transaction tx = null;
         String result="0";
         Session session = getSession();
@@ -480,17 +482,17 @@ public class IntentInstanceServiceImpl implements IntentInstanceService {
 
     @Override
     public void activeIntentInstance(String instanceId) {
-        IntentInstance instance = null;
+        CCVPNInstance instance = null;
         Session session = getSession();
         Transaction tx = null;
         try {
 
-            instance = (IntentInstance)session.createQuery("from IntentInstance where deleteState = 0 and instanceId = :instanceId and status = :status")
+            instance = (CCVPNInstance)session.createQuery("from CCVPNInstance where deleteState = 0 and instanceId = :instanceId and status = :status")
                     .setParameter("instanceId", instanceId).setParameter("status", "3").uniqueResult();
             logger.info("get instance OK, id=" + instanceId);
 
             if (null == instance) {
-                logger.error("intentInstance is null!");
+                logger.error("instance is null!");
                 return;
             }
 
@@ -512,16 +514,16 @@ public class IntentInstanceServiceImpl implements IntentInstanceService {
     }
 
     public void invalidIntentInstance(String instanceId) {
-        IntentInstance instance = null;
+        CCVPNInstance instance = null;
         Session session = getSession();
         Transaction tx = null;
         try {
-            instance = (IntentInstance)session.createQuery("from IntentInstance where deleteState = 0 and instanceId = :instanceId")
+            instance = (CCVPNInstance)session.createQuery("from CCVPNInstance where deleteState = 0 and instanceId = :instanceId")
                     .setParameter("instanceId", instanceId).uniqueResult();
             logger.info("get instance OK, id=" + instanceId);
 
             if (null == instance) {
-                logger.error("intentInstance is null!");
+                logger.error("instance is null!");
                 return;
             }
             deleteInstanceToSO(instance.getInstanceId());
@@ -545,7 +547,7 @@ public class IntentInstanceServiceImpl implements IntentInstanceService {
     public Map<String, Object> queryInstancePerformanceData(String instanceId) {
         Session session = getSession();
         try {
-            String hql = "from IntentInstance i, InstancePerformance p where i.resourceInstanceId = p.resourceInstanceId and  i.instanceId = :instanceId and i.deleteState = 0 order by p.date";
+            String hql = "from CCVPNInstance i, InstancePerformance p where i.resourceInstanceId = p.resourceInstanceId and  i.instanceId = :instanceId and i.deleteState = 0 order by p.date";
             Query query = session.createQuery(hql).setParameter("instanceId", instanceId);
             List<Object[]> queryResult= query.list();
             List<String> date = new ArrayList<>();
@@ -614,11 +616,11 @@ public class IntentInstanceServiceImpl implements IntentInstanceService {
         try {
             JSONObject result = new JSONObject();
             JSONArray instanceInfos = new JSONArray();
-            String hql = "from IntentInstance i where i.instanceId in (:ids)";
+            String hql = "from CCVPNInstance i where i.instanceId in (:ids)";
             Query query = session.createQuery(hql).setParameter("ids", ids);
-            List<IntentInstance> queryResult= query.list();
+            List<CCVPNInstance> queryResult= query.list();
             if (queryResult != null && queryResult.size() > 0) {
-                for (IntentInstance instance : queryResult) {
+                for (CCVPNInstance instance : queryResult) {
                     JSONObject instanceInfo = new JSONObject();
                     instanceInfo.put("id", instance.getInstanceId());
                     instanceInfo.put("status", instance.getStatus());
index 4093d56..e82ed0a 100644 (file)
@@ -24,7 +24,7 @@ import org.mockito.InjectMocks;
 import org.mockito.Mock;
 import org.mockito.Mockito;
 import org.onap.usecaseui.server.bean.HttpResponseResult;
-import org.onap.usecaseui.server.bean.intent.IntentInstance;
+import org.onap.usecaseui.server.bean.intent.CCVPNInstance;
 import org.onap.usecaseui.server.bean.intent.IntentModel;
 import org.onap.usecaseui.server.service.intent.IntentInstanceService;
 import org.onap.usecaseui.server.service.intent.IntentService;
@@ -159,8 +159,8 @@ public class IntentControllerTest {
     }
     @Test
     public void getFinishedInstanceInfo() {
-        List<IntentInstance> instanceList = new ArrayList<>();
-        IntentInstance instance = new IntentInstance();
+        List<CCVPNInstance> instanceList = new ArrayList<>();
+        CCVPNInstance instance = new CCVPNInstance();
         instance.setInstanceId("instanceId");
         instance.setName("name");
         instanceList.add(instance);
index c1e7bdd..8e591ea 100644 (file)
@@ -32,7 +32,7 @@ import org.junit.runner.RunWith;
 import org.mockito.InjectMocks;
 import org.mockito.Mock;
 import org.mockito.Mockito;
-import org.onap.usecaseui.server.bean.intent.IntentInstance;
+import org.onap.usecaseui.server.bean.intent.CCVPNInstance;
 import org.onap.usecaseui.server.bean.intent.IntentModel;
 import org.onap.usecaseui.server.service.intent.IntentApiService;
 import org.onap.usecaseui.server.service.lcm.domain.so.SOService;
@@ -81,7 +81,7 @@ public class IntentInstanceServiceImplTest {
 
     @Test
     public void queryIntentInstance() {
-        IntentInstance instance = new IntentInstance();
+        CCVPNInstance instance = new CCVPNInstance();
         instance.setInstanceId("1");
         instance.setJobId("1");
         instance.setStatus("1");
@@ -95,7 +95,7 @@ public class IntentInstanceServiceImplTest {
     }
     @Test
     public void createIntentInstance() throws IOException {
-        IntentInstance instance = new IntentInstance();
+        CCVPNInstance instance = new CCVPNInstance();
         instance.setInstanceId("1");
         instance.setJobId("1");
         instance.setStatus("1");
@@ -119,9 +119,9 @@ public class IntentInstanceServiceImplTest {
     public void getIntentInstanceProgress() throws IOException {
 
         Query query1 = Mockito.mock(Query.class);
-        when(session.createQuery("from IntentInstance where deleteState = 0 and status = '0'")).thenReturn(query1);
-        List<IntentInstance> q = new ArrayList<>();
-        IntentInstance instance = new IntentInstance();
+        when(session.createQuery("from CCVPNInstance where deleteState = 0 and status = '0'")).thenReturn(query1);
+        List<CCVPNInstance> q = new ArrayList<>();
+        CCVPNInstance instance = new CCVPNInstance();
         instance.setInstanceId("1");
         q.add(instance);
         when(query1.list()).thenReturn(q);
@@ -155,9 +155,9 @@ public class IntentInstanceServiceImplTest {
     @Test
     public void getIntentInstanceBandwidth() throws IOException {
         Query query1 = Mockito.mock(Query.class);
-        when(session.createQuery("from IntentInstance where deleteState = 0 and status = '1'")).thenReturn(query1);
-        List<IntentInstance> q = new ArrayList<>();
-        IntentInstance instance = new IntentInstance();
+        when(session.createQuery("from CCVPNInstance where deleteState = 0 and status = '1'")).thenReturn(query1);
+        List<CCVPNInstance> q = new ArrayList<>();
+        CCVPNInstance instance = new CCVPNInstance();
         instance.setInstanceId("1");
         instance.setResourceInstanceId("1");
         q.add(instance);
@@ -301,7 +301,7 @@ public class IntentInstanceServiceImplTest {
 
     @Test
     public void deleteIntentInstance() throws IOException {
-        IntentInstance instance = new IntentInstance();
+        CCVPNInstance instance = new CCVPNInstance();
         instance.setResourceInstanceId("1");
 
         Query query = Mockito.mock(Query.class);
@@ -324,7 +324,7 @@ public class IntentInstanceServiceImplTest {
 
     @Test
     public void activeIntentInstance() throws IOException {
-        IntentInstance instance = new IntentInstance();
+        CCVPNInstance instance = new CCVPNInstance();
         instance.setInstanceId("1");
         instance.setJobId("1");
         instance.setStatus("1");
index e6a4c1e..6a3cf87 100644 (file)
@@ -164,10 +164,10 @@ CREATE TABLE instance_performance
 );
 
 -- ----------------------------
--- Table structure for intent_instance
+-- Table structure for ccvpn_instance
 -- ----------------------------
-DROP TABLE IF EXISTS intent_instance;
-CREATE TABLE intent_instance
+DROP TABLE IF EXISTS ccvpn_instance;
+CREATE TABLE ccvpn_instance
 (
     id                          serial not null
         constraint intent_instance_pk