aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuji7 <lu.ji3@zte.com.cn>2017-10-17 18:52:54 +0800
committerLuji7 <lu.ji3@zte.com.cn>2017-10-17 18:53:02 +0800
commit4f4ebfed7fc43e61966934ba1aafb53555e0dc09 (patch)
tree0ec02b7420455145c216bf298554b52c8e25c20c
parentd01024c14b4760c2c7d94112c009444859d42f92 (diff)
Fix aai response parse wrong.
Change-Id: Ib5d8a6be6f21b716078c691adbc682c996c7ccb8 Issue-id: USECASEUI-36 Signed-off-by: Luji7 <lu.ji3@zte.com.cn>
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/AAIService.java13
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/AAICustomerRsp.java31
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/ServiceInstanceRsp.java35
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/ServiceSubscriptionRsp.java35
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/VimInfoRsp.java35
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultCustomerService.java4
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceInstanceService.java2
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceTemplateService.java16
-rw-r--r--server/src/test/java/org/onap/usecaseui/server/service/lcm/impl/DefaultCustomerServiceTest.java7
-rw-r--r--server/src/test/java/org/onap/usecaseui/server/service/lcm/impl/DefaultPackageDistributionServiceTest.java6
-rw-r--r--server/src/test/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceInstanceServiceTest.java5
-rw-r--r--server/src/test/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceTemplateServiceTest.java6
12 files changed, 176 insertions, 19 deletions
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/AAIService.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/AAIService.java
index eb46596c..45b399b5 100644
--- a/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/AAIService.java
+++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/AAIService.java
@@ -15,10 +15,7 @@
*/
package org.onap.usecaseui.server.service.lcm.domain.aai;
-import org.onap.usecaseui.server.service.lcm.domain.aai.bean.AAICustomer;
-import org.onap.usecaseui.server.service.lcm.domain.aai.bean.AAIServiceSubscription;
-import org.onap.usecaseui.server.service.lcm.domain.aai.bean.ServiceInstance;
-import org.onap.usecaseui.server.service.lcm.domain.aai.bean.VimInfo;
+import org.onap.usecaseui.server.service.lcm.domain.aai.bean.*;
import retrofit2.Call;
import retrofit2.http.GET;
import retrofit2.http.Headers;
@@ -36,7 +33,7 @@ public interface AAIService {
})
// @GET("/api/aai-business/v11/customers")
@GET("/aai-business/v11/customers")
- Call<List<AAICustomer>> listCustomer();
+ Call<AAICustomerRsp> listCustomer();
@Headers({
"X-TransactionId: 7777",
@@ -46,7 +43,7 @@ public interface AAIService {
})
// @GET("/api/aai-business/v11/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}/service-instances")
@GET("/aai-business/v11/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}/service-instances")
- Call<List<ServiceInstance>> listServiceInstances(@Path("global-customer-id") String customerId, @Path("service-type") String serviceType);
+ Call<ServiceInstanceRsp> listServiceInstances(@Path("global-customer-id") String customerId, @Path("service-type") String serviceType);
@Headers({
"X-TransactionId: 7777",
@@ -56,7 +53,7 @@ public interface AAIService {
})
// @GET("/cloud-infrastructure/cloud-regions")
@GET("/aai-cloudInfrastructure/v11/cloud-regions")
- Call<List<VimInfo>> listVimInfo();
+ Call<VimInfoRsp> listVimInfo();
@Headers({
"X-TransactionId: 7777",
@@ -66,5 +63,5 @@ public interface AAIService {
})
// @GET("/api/aai-business/v11/customers/customer/{global-customer-id}/service-subscriptions")
@GET("/aai-business/v11/customers/customer/{global-customer-id}/service-subscriptions")
- Call<List<AAIServiceSubscription>> listServiceSubscriptions(@Path("global-customer-id") String customerId);
+ Call<ServiceSubscriptionRsp> listServiceSubscriptions(@Path("global-customer-id") String customerId);
}
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/AAICustomerRsp.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/AAICustomerRsp.java
new file mode 100644
index 00000000..7f3eb664
--- /dev/null
+++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/AAICustomerRsp.java
@@ -0,0 +1,31 @@
+/**
+ * Copyright 2016-2017 ZTE 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.usecaseui.server.service.lcm.domain.aai.bean;
+
+import java.util.List;
+
+public class AAICustomerRsp {
+
+ private List<AAICustomer> customer;
+
+ public List<AAICustomer> getCustomer() {
+ return customer;
+ }
+
+ public void setCustomer(List<AAICustomer> customer) {
+ this.customer = customer;
+ }
+}
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/ServiceInstanceRsp.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/ServiceInstanceRsp.java
new file mode 100644
index 00000000..8c3efb60
--- /dev/null
+++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/ServiceInstanceRsp.java
@@ -0,0 +1,35 @@
+/**
+ * Copyright 2016-2017 ZTE 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.usecaseui.server.service.lcm.domain.aai.bean;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+import java.util.List;
+
+public class ServiceInstanceRsp {
+
+ private List<ServiceInstance> serviceInstances;
+
+ @JsonProperty("service-instances")
+ public List<ServiceInstance> getServiceInstances() {
+ return serviceInstances;
+ }
+
+ @JsonProperty("service-instances")
+ public void setServiceInstances(List<ServiceInstance> serviceInstances) {
+ this.serviceInstances = serviceInstances;
+ }
+}
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/ServiceSubscriptionRsp.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/ServiceSubscriptionRsp.java
new file mode 100644
index 00000000..8ddbdf6e
--- /dev/null
+++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/ServiceSubscriptionRsp.java
@@ -0,0 +1,35 @@
+/**
+ * Copyright 2016-2017 ZTE 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.usecaseui.server.service.lcm.domain.aai.bean;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+import java.util.List;
+
+public class ServiceSubscriptionRsp {
+
+ private List<AAIServiceSubscription> serviceSubscriptions;
+
+ @JsonProperty("service-subscription")
+ public List<AAIServiceSubscription> getServiceSubscriptions() {
+ return serviceSubscriptions;
+ }
+
+ @JsonProperty("service-subscription")
+ public void setServiceSubscriptions(List<AAIServiceSubscription> serviceSubscriptions) {
+ this.serviceSubscriptions = serviceSubscriptions;
+ }
+}
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/VimInfoRsp.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/VimInfoRsp.java
new file mode 100644
index 00000000..bf43ab07
--- /dev/null
+++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/VimInfoRsp.java
@@ -0,0 +1,35 @@
+/**
+ * Copyright 2016-2017 ZTE 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.usecaseui.server.service.lcm.domain.aai.bean;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+import java.util.List;
+
+public class VimInfoRsp {
+
+ private List<VimInfo> cloudRegion;
+
+ @JsonProperty("cloud-region")
+ public List<VimInfo> getCloudRegion() {
+ return cloudRegion;
+ }
+
+ @JsonProperty("cloud-region")
+ public void setCloudRegion(List<VimInfo> cloudRegion) {
+ this.cloudRegion = cloudRegion;
+ }
+}
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultCustomerService.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultCustomerService.java
index 9ece03e6..fbd9db87 100644
--- a/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultCustomerService.java
+++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultCustomerService.java
@@ -49,7 +49,7 @@ public class DefaultCustomerService implements CustomerService {
@Override
public List<AAICustomer> listCustomer() {
try {
- return this.aaiService.listCustomer().execute().body();
+ return this.aaiService.listCustomer().execute().body().getCustomer();
} catch (IOException e) {
logger.error("list customers occur exception");
throw new AAIException("AAI is not available.", e);
@@ -59,7 +59,7 @@ public class DefaultCustomerService implements CustomerService {
@Override
public List<AAIServiceSubscription> listServiceSubscriptions(String customerId) {
try {
- return this.aaiService.listServiceSubscriptions(customerId).execute().body();
+ return this.aaiService.listServiceSubscriptions(customerId).execute().body().getServiceSubscriptions();
} catch (IOException e) {
logger.error("list customers occur exception");
throw new AAIException("AAI is not available.", e);
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceInstanceService.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceInstanceService.java
index 540a0dad..586135fa 100644
--- a/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceInstanceService.java
+++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceInstanceService.java
@@ -48,7 +48,7 @@ public class DefaultServiceInstanceService implements ServiceInstanceService {
@Override
public List<ServiceInstance> listServiceInstances(String customerId, String serviceType) {
try {
- return aaiService.listServiceInstances(customerId, serviceType).execute().body();
+ return aaiService.listServiceInstances(customerId, serviceType).execute().body().getServiceInstances();
} catch (IOException e) {
logger.error("list services instances occur exception");
throw new AAIException("AAI is not available.", e);
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceTemplateService.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceTemplateService.java
index c2644f82..111e45b8 100644
--- a/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceTemplateService.java
+++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceTemplateService.java
@@ -25,6 +25,7 @@ import org.onap.usecaseui.server.service.lcm.domain.aai.bean.VimInfo;
import org.onap.usecaseui.server.service.lcm.domain.aai.exceptions.AAIException;
import org.onap.usecaseui.server.service.lcm.domain.sdc.SDCCatalogService;
import org.onap.usecaseui.server.service.lcm.domain.sdc.bean.SDCServiceTemplate;
+import org.onap.usecaseui.server.service.lcm.domain.sdc.consts.SDCConsts;
import org.onap.usecaseui.server.service.lcm.domain.sdc.exceptions.SDCCatalogException;
import org.onap.usecaseui.server.util.RestfulServices;
import org.openecomp.sdc.toscaparser.api.NodeTemplate;
@@ -166,6 +167,19 @@ public class DefaultServiceTemplateService implements ServiceTemplateService {
String.valueOf(input.getDefault())
));
}
+ if (SDCConsts.CATEGORY_NS.equals(type)) {
+// templateInputs.add(new TemplateInput(
+//
+// ));
+ }
+ // sdn controller
+// templateInputs.add(new TemplateInput(
+// "sdncontroller",
+// "enum",
+// "sdn controller for the service",
+// "false",
+// ""
+// ));
return new ServiceTemplateInput(
invariantUUID,
uuid,
@@ -181,7 +195,7 @@ public class DefaultServiceTemplateService implements ServiceTemplateService {
@Override
public List<VimInfo> listVim() {
try {
- return aaiService.listVimInfo().execute().body();
+ return aaiService.listVimInfo().execute().body().getCloudRegion();
} catch (IOException e) {
logger.error("Visit AAI occur exception");
throw new AAIException("AAI is not available.", e);
diff --git a/server/src/test/java/org/onap/usecaseui/server/service/lcm/impl/DefaultCustomerServiceTest.java b/server/src/test/java/org/onap/usecaseui/server/service/lcm/impl/DefaultCustomerServiceTest.java
index ebe70c72..889ce021 100644
--- a/server/src/test/java/org/onap/usecaseui/server/service/lcm/impl/DefaultCustomerServiceTest.java
+++ b/server/src/test/java/org/onap/usecaseui/server/service/lcm/impl/DefaultCustomerServiceTest.java
@@ -20,6 +20,7 @@ import org.junit.Test;
import org.onap.usecaseui.server.service.lcm.CustomerService;
import org.onap.usecaseui.server.service.lcm.domain.aai.AAIService;
import org.onap.usecaseui.server.service.lcm.domain.aai.bean.AAICustomer;
+import org.onap.usecaseui.server.service.lcm.domain.aai.bean.AAICustomerRsp;
import org.onap.usecaseui.server.service.lcm.domain.aai.exceptions.AAIException;
import retrofit2.Call;
@@ -38,7 +39,9 @@ public class DefaultCustomerServiceTest {
List<AAICustomer> customers = singletonList(new AAICustomer("1", "name", "type"));
AAIService aaiService = mock(AAIService.class);
- Call<List<AAICustomer>> call = successfulCall(customers);
+ AAICustomerRsp rsp = new AAICustomerRsp();
+ rsp.setCustomer(customers);
+ Call<AAICustomerRsp> call = successfulCall(rsp);
when(aaiService.listCustomer()).thenReturn(call);
CustomerService customerService = new DefaultCustomerService(aaiService);
@@ -48,7 +51,7 @@ public class DefaultCustomerServiceTest {
@Test(expected = AAIException.class)
public void itWillThrowExceptionWhenAAIIsNotAvailable() {
AAIService aaiService = mock(AAIService.class);
- Call<List<AAICustomer>> call = failedCall("AAI is not available!");
+ Call<AAICustomerRsp> call = failedCall("AAI is not available!");
when(aaiService.listCustomer()).thenReturn(call);
CustomerService customerService = new DefaultCustomerService(aaiService);
diff --git a/server/src/test/java/org/onap/usecaseui/server/service/lcm/impl/DefaultPackageDistributionServiceTest.java b/server/src/test/java/org/onap/usecaseui/server/service/lcm/impl/DefaultPackageDistributionServiceTest.java
index 766aca7f..fd258793 100644
--- a/server/src/test/java/org/onap/usecaseui/server/service/lcm/impl/DefaultPackageDistributionServiceTest.java
+++ b/server/src/test/java/org/onap/usecaseui/server/service/lcm/impl/DefaultPackageDistributionServiceTest.java
@@ -21,6 +21,7 @@ import org.onap.usecaseui.server.bean.lcm.VfNsPackageInfo;
import org.onap.usecaseui.server.service.lcm.PackageDistributionService;
import org.onap.usecaseui.server.service.lcm.domain.aai.AAIService;
import org.onap.usecaseui.server.service.lcm.domain.aai.bean.VimInfo;
+import org.onap.usecaseui.server.service.lcm.domain.aai.bean.VimInfoRsp;
import org.onap.usecaseui.server.service.lcm.domain.sdc.SDCCatalogService;
import org.onap.usecaseui.server.service.lcm.domain.sdc.bean.SDCServiceTemplate;
import org.onap.usecaseui.server.service.lcm.domain.sdc.bean.Vnf;
@@ -61,8 +62,9 @@ public class DefaultPackageDistributionServiceTest {
private AAIService newAAIService(List<VimInfo> vim) {
AAIService aaiService = mock(AAIService.class);
-
- Call<List<VimInfo>> vimCall = successfulCall(vim);
+ VimInfoRsp rsp = new VimInfoRsp();
+ rsp.setCloudRegion(vim);
+ Call<VimInfoRsp> vimCall = successfulCall(rsp);
when(aaiService.listVimInfo()).thenReturn(vimCall);
return aaiService;
}
diff --git a/server/src/test/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceInstanceServiceTest.java b/server/src/test/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceInstanceServiceTest.java
index 6f193fb3..54555fa9 100644
--- a/server/src/test/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceInstanceServiceTest.java
+++ b/server/src/test/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceInstanceServiceTest.java
@@ -20,6 +20,7 @@ import org.junit.Test;
import org.onap.usecaseui.server.service.lcm.ServiceInstanceService;
import org.onap.usecaseui.server.service.lcm.domain.aai.AAIService;
import org.onap.usecaseui.server.service.lcm.domain.aai.bean.ServiceInstance;
+import org.onap.usecaseui.server.service.lcm.domain.aai.bean.ServiceInstanceRsp;
import org.onap.usecaseui.server.service.lcm.domain.aai.exceptions.AAIException;
import java.util.Collections;
@@ -38,7 +39,9 @@ public class DefaultServiceInstanceServiceTest {
String customerId = "1";
String serviceType = "service";
List<ServiceInstance> instances = Collections.singletonList(new ServiceInstance("1","service","1","VoLTE","e2eservice","abc","vim1"));
- when(aaiService.listServiceInstances(customerId, serviceType)).thenReturn(successfulCall(instances));
+ ServiceInstanceRsp rsp = new ServiceInstanceRsp();
+ rsp.setServiceInstances(instances);
+ when(aaiService.listServiceInstances(customerId, serviceType)).thenReturn(successfulCall(rsp));
ServiceInstanceService service = new DefaultServiceInstanceService(aaiService);
diff --git a/server/src/test/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceTemplateServiceTest.java b/server/src/test/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceTemplateServiceTest.java
index 9696a77e..acb12957 100644
--- a/server/src/test/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceTemplateServiceTest.java
+++ b/server/src/test/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceTemplateServiceTest.java
@@ -22,6 +22,7 @@ import org.onap.usecaseui.server.bean.lcm.TemplateInput;
import org.onap.usecaseui.server.service.lcm.ServiceTemplateService;
import org.onap.usecaseui.server.service.lcm.domain.aai.AAIService;
import org.onap.usecaseui.server.service.lcm.domain.aai.bean.VimInfo;
+import org.onap.usecaseui.server.service.lcm.domain.aai.bean.VimInfoRsp;
import org.onap.usecaseui.server.service.lcm.domain.sdc.SDCCatalogService;
import org.onap.usecaseui.server.service.lcm.domain.sdc.bean.SDCServiceTemplate;
import org.onap.usecaseui.server.service.lcm.domain.sdc.exceptions.SDCCatalogException;
@@ -170,8 +171,9 @@ public class DefaultServiceTemplateServiceTest {
private AAIService newAAIService(List<VimInfo> vim) {
AAIService aaiService = mock(AAIService.class);
-
- Call<List<VimInfo>> vimCall = successfulCall(vim);
+ VimInfoRsp rsp = new VimInfoRsp();
+ rsp.setCloudRegion(vim);
+ Call<VimInfoRsp> vimCall = successfulCall(rsp);
when(aaiService.listVimInfo()).thenReturn(vimCall);
return aaiService;
}