summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/onap/nbi/Application.java1
-rw-r--r--src/main/java/org/onap/nbi/OnapComponentsUrlPaths.java42
-rw-r--r--src/main/java/org/onap/nbi/ServiceRegisterRunner.java29
-rwxr-xr-xsrc/main/java/org/onap/nbi/apis/hub/HubResource.java184
-rwxr-xr-xsrc/main/java/org/onap/nbi/apis/hub/model/Event.java2
-rw-r--r--src/main/java/org/onap/nbi/apis/hub/model/EventType.java55
-rw-r--r--src/main/java/org/onap/nbi/apis/hub/model/ServiceInstanceEvent.java98
-rwxr-xr-xsrc/main/java/org/onap/nbi/apis/hub/model/Subscriber.java10
-rwxr-xr-xsrc/main/java/org/onap/nbi/apis/hub/model/Subscription.java19
-rwxr-xr-xsrc/main/java/org/onap/nbi/apis/hub/repository/SubscriberFinder.java1
-rwxr-xr-xsrc/main/java/org/onap/nbi/apis/hub/repository/SubscriberRepository.java1
-rwxr-xr-xsrc/main/java/org/onap/nbi/apis/hub/repository/SubscriberRepositoryImpl.java1
-rwxr-xr-xsrc/main/java/org/onap/nbi/apis/hub/service/CriteriaBuilder.java1
-rwxr-xr-xsrc/main/java/org/onap/nbi/apis/hub/service/CriteriaBuilderServiceOrder.java13
-rw-r--r--src/main/java/org/onap/nbi/apis/hub/service/EventFactory.java10
-rwxr-xr-xsrc/main/java/org/onap/nbi/apis/hub/service/NotificationAspect.java34
-rwxr-xr-xsrc/main/java/org/onap/nbi/apis/hub/service/NotifierService.java25
-rw-r--r--src/main/java/org/onap/nbi/apis/hub/service/SubscriptionService.java6
-rw-r--r--src/main/java/org/onap/nbi/apis/hub/service/dmaap/CheckDMaaPEventsManager.java329
-rw-r--r--src/main/java/org/onap/nbi/apis/hub/service/dmaap/DMaaPEventsScheduler.java6
-rw-r--r--src/main/java/org/onap/nbi/apis/listener/ListenerResourceTarget.java9
-rw-r--r--src/main/java/org/onap/nbi/apis/servicecatalog/SdcClient.java41
-rw-r--r--src/main/java/org/onap/nbi/apis/servicecatalog/ServiceSpecificationDBManager.java35
-rw-r--r--src/main/java/org/onap/nbi/apis/servicecatalog/ServiceSpecificationResource.java8
-rw-r--r--src/main/java/org/onap/nbi/apis/servicecatalog/ServiceSpecificationService.java107
-rw-r--r--src/main/java/org/onap/nbi/apis/servicecatalog/ToscaInfosProcessor.java260
-rw-r--r--src/main/java/org/onap/nbi/apis/servicecatalog/jolt/FindServiceSpecJsonTransformer.java3
-rw-r--r--src/main/java/org/onap/nbi/apis/servicecatalog/jolt/GetServiceSpecJsonTransformer.java2
-rw-r--r--src/main/java/org/onap/nbi/apis/servicecatalog/model/ServiceSpecification.java1
-rw-r--r--src/main/java/org/onap/nbi/apis/servicecatalog/model/SpecificationInputSchema.java59
-rw-r--r--src/main/java/org/onap/nbi/apis/servicecatalog/repositories/ServiceSpecificationRepository.java1
-rw-r--r--src/main/java/org/onap/nbi/apis/servicecatalog/repositories/SpecificationInputSchemaRepository.java2
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceinventory/AaiClient.java19
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceinventory/BaseClient.java37
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceinventory/NbiClient.java1
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceinventory/ServiceInventoryResource.java2
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceinventory/ServiceInventoryService.java286
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceinventory/jolt/FindServiceInventoryJsonTransformer.java3
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceinventory/jolt/GetServiceInventoryJsonTransformer.java2
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/MultiClient.java72
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/ServiceCatalogUrl.java4
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/ServiceInventoryUrl.java4
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/ServiceOrderResource.java12
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/SoClient.java500
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/model/ActionType.java3
-rwxr-xr-xsrc/main/java/org/onap/nbi/apis/serviceorder/model/OrderItemRelationship.java12
-rwxr-xr-xsrc/main/java/org/onap/nbi/apis/serviceorder/model/OrderMessage.java33
-rwxr-xr-xsrc/main/java/org/onap/nbi/apis/serviceorder/model/OrderRelationship.java9
-rwxr-xr-xsrc/main/java/org/onap/nbi/apis/serviceorder/model/RelatedParty.java11
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/model/RelationshipType.java4
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/model/ResourceSpecification.java100
-rwxr-xr-xsrc/main/java/org/onap/nbi/apis/serviceorder/model/Service.java7
-rwxr-xr-xsrc/main/java/org/onap/nbi/apis/serviceorder/model/ServiceCharacteristic.java9
-rwxr-xr-xsrc/main/java/org/onap/nbi/apis/serviceorder/model/ServiceOrder.java22
-rwxr-xr-xsrc/main/java/org/onap/nbi/apis/serviceorder/model/ServiceOrderItem.java30
-rwxr-xr-xsrc/main/java/org/onap/nbi/apis/serviceorder/model/ServiceRelationship.java10
-rwxr-xr-xsrc/main/java/org/onap/nbi/apis/serviceorder/model/ServiceSpecificationRef.java9
-rwxr-xr-xsrc/main/java/org/onap/nbi/apis/serviceorder/model/SeverityMessage.java3
-rwxr-xr-xsrc/main/java/org/onap/nbi/apis/serviceorder/model/StateType.java18
-rwxr-xr-xsrc/main/java/org/onap/nbi/apis/serviceorder/model/TargetServiceSchema.java11
-rwxr-xr-xsrc/main/java/org/onap/nbi/apis/serviceorder/model/Value.java7
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/CloudConfiguration.java8
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/CreateE2EServiceInstanceResponse.java27
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/CreateServiceInstanceResponse.java7
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/DeleteE2EServiceInstanceResponse.java24
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/GetE2ERequestStatusResponse.java7
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/GetRequestStatusResponse.java5
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/LocationConstraintsModel.java48
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/MSODeleteE2EPayload.java50
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/MSOE2EPayload.java6
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/MSOPayload.java5
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/ModelInfo.java16
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/OperationStatus.java69
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/OwningEntity.java1
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/ParametersModel.java66
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/Project.java1
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/Request.java4
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/RequestDetails.java13
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/RequestInfo.java9
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/RequestParameters.java9
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/RequestReferences.java1
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/RequestState.java3
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/RequestStatus.java4
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/ResourceModel.java131
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/ServiceModel.java149
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/ServiceResponse.java6
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/SubscriberInfo.java1
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/UserParams.java1
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/VnfLocationConstraintsModel.java25
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/model/orchestrator/ExecutionTask.java23
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/model/orchestrator/ServiceOrderInfo.java8
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/model/orchestrator/ServiceOrderItemInfo.java2
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/repositories/ExecutionTaskRepository.java1
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/repositories/ServiceOrderRepository.java1
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/service/ServiceOrderService.java9
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/serviceordervalidator/ServiceOrderValidator.java3
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/serviceordervalidator/ValidServiceOrder.java2
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/utils/E2EServiceUtils.java16
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/utils/JsonEntityConverter.java1
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/workflow/CheckOrderConsistenceManager.java92
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/workflow/CreateAAICustomerManager.java19
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/workflow/CreateAAIOwningEntityManager.java16
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/workflow/CreateAAIServiceTypeManager.java18
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/workflow/ExecutionTaskProcessorScheduler.java23
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/workflow/PostSoProcessor.java492
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/workflow/SOGetStatusManager.java17
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/workflow/SOTaskManager.java24
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/workflow/SOTaskProcessor.java83
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/workflow/ServiceOrderCheckScheduler.java23
-rw-r--r--src/main/java/org/onap/nbi/apis/status/OnapClient.java14
-rw-r--r--src/main/java/org/onap/nbi/apis/status/StatusResource.java16
-rw-r--r--src/main/java/org/onap/nbi/apis/status/StatusService.java3
-rw-r--r--src/main/java/org/onap/nbi/apis/status/StatusServiceImpl.java3
-rw-r--r--src/main/java/org/onap/nbi/apis/status/model/ApplicationStatus.java1
-rw-r--r--src/main/java/org/onap/nbi/apis/status/model/OnapModuleType.java3
-rw-r--r--src/main/java/org/onap/nbi/apis/status/model/StatusType.java1
-rw-r--r--src/main/java/org/onap/nbi/commons/BeanUtils.java1
-rw-r--r--src/main/java/org/onap/nbi/commons/EWInterfaceUtils.java11
-rw-r--r--src/main/java/org/onap/nbi/commons/JacksonFilter.java1
-rw-r--r--src/main/java/org/onap/nbi/commons/JsonRepresentation.java4
-rw-r--r--src/main/java/org/onap/nbi/commons/MultiCriteriaRequestBuilder.java4
-rw-r--r--src/main/java/org/onap/nbi/commons/Query.java3
-rw-r--r--src/main/java/org/onap/nbi/commons/QueryParserUtils.java4
-rw-r--r--src/main/java/org/onap/nbi/commons/ReservedKeys.java4
-rw-r--r--src/main/java/org/onap/nbi/commons/Resource.java2
-rw-r--r--src/main/java/org/onap/nbi/commons/ResourceManagement.java6
-rw-r--r--src/main/java/org/onap/nbi/configuration/AppContext.java8
-rw-r--r--src/main/java/org/onap/nbi/configuration/HubConfig.java1
-rwxr-xr-xsrc/main/java/org/onap/nbi/configuration/MongoConfig.java3
-rw-r--r--src/main/java/org/onap/nbi/configuration/RestConfiguration.java2
-rw-r--r--src/main/java/org/onap/nbi/exceptions/ApiError.java5
-rw-r--r--src/main/java/org/onap/nbi/exceptions/ApiException.java1
-rw-r--r--src/main/java/org/onap/nbi/exceptions/ApiExceptionHandler.java2
-rw-r--r--src/main/java/org/onap/nbi/exceptions/BackendErrorHandler.java7
-rw-r--r--src/main/java/org/onap/nbi/exceptions/BackendFunctionalException.java1
-rw-r--r--src/main/java/org/onap/nbi/exceptions/TechnicalException.java3
-rw-r--r--src/main/java/org/onap/nbi/exceptions/ValidationException.java1
-rw-r--r--src/test/java/org/onap/nbi/api/listener/ListenerResourceTest.java140
-rw-r--r--src/test/java/org/onap/nbi/apis/assertions/ServiceOrderExecutionTaskAssertions.java780
-rw-r--r--src/test/java/org/onap/nbi/apis/servicecatalog/ToscaInfosProcessorTest.java403
-rw-r--r--src/test/java/org/onap/nbi/test/Context.java112
-rw-r--r--src/test/java/org/onap/nbi/test/ExecutionTaskTest.java907
-rw-r--r--src/test/java/org/onap/nbi/test/KarateApiTest.java9
-rw-r--r--src/test/java/org/onap/nbi/test/ServiceOrderRepositoryTest.java5
144 files changed, 3176 insertions, 3499 deletions
diff --git a/src/main/java/org/onap/nbi/Application.java b/src/main/java/org/onap/nbi/Application.java
index 9f77ffe..b63641f 100644
--- a/src/main/java/org/onap/nbi/Application.java
+++ b/src/main/java/org/onap/nbi/Application.java
@@ -11,6 +11,7 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
+
package org.onap.nbi;
import org.springframework.boot.SpringApplication;
diff --git a/src/main/java/org/onap/nbi/OnapComponentsUrlPaths.java b/src/main/java/org/onap/nbi/OnapComponentsUrlPaths.java
index 602b88c..c01b04c 100644
--- a/src/main/java/org/onap/nbi/OnapComponentsUrlPaths.java
+++ b/src/main/java/org/onap/nbi/OnapComponentsUrlPaths.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.nbi;
/**
@@ -21,16 +22,15 @@ package org.onap.nbi;
*/
public final class OnapComponentsUrlPaths {
- private OnapComponentsUrlPaths() {}
+ private OnapComponentsUrlPaths() {
+ }
// NBI
- public static final String SERVICE_ORDER_PATH= "/serviceOrder";
- public static final String SERVICE_INVENTORY_PATH= "/service";
- public static final String SERVICE_SPECIFICATION_PATH= "/serviceSpecification";
- public static final String HUB_PATH= "/hub";
- public static final String LISTENER_PATH= "/listener";
-
-
+ public static final String SERVICE_ORDER_PATH = "/serviceOrder";
+ public static final String SERVICE_INVENTORY_PATH = "/service";
+ public static final String SERVICE_SPECIFICATION_PATH = "/serviceSpecification";
+ public static final String HUB_PATH = "/hub";
+ public static final String LISTENER_PATH = "/listener";
// SDC
public static final String SDC_ROOT_URL = "/sdc/v1/catalog/services";
@@ -38,7 +38,6 @@ public final class OnapComponentsUrlPaths {
public static final String SDC_TOSCA_PATH = "/toscaModel";
public static final String SDC_HEALTH_CHECK = "/sdc2/rest/healthCheck";
-
// AAI
public static final String AAI_GET_TENANTS_PATH =
"/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/$onap.cloudOwner/$onap.lcpCloudRegionId/tenants";
@@ -47,30 +46,29 @@ public final class OnapComponentsUrlPaths {
"/aai/v14/business/customers/customer/$customerId/service-subscriptions";
public static final String AAI_PUT_SERVICE_FOR_CUSTOMER_PATH =
"/aai/v14/business/customers/customer/$customerId/service-subscriptions/service-subscription/";
- public static final String AAI_HEALTH_CHECK =
- "/aai/util/echo?action=long";
- public static final String AAI_GET_SERVICE =
- "/aai/v14/nodes/service-instances/service-instance/$serviceId";
+ public static final String AAI_HEALTH_CHECK = "/aai/util/echo?action=long";
+ public static final String AAI_GET_SERVICE = "/aai/v14/nodes/service-instances/service-instance/$serviceId";
public static final String AAI_GET_SERVICE_CUSTOMER =
"/aai/v14/nodes/service-instances/service-instance/$serviceId?format=resource_and_url";
public static final String AAI_GET_SERVICE_INSTANCES_PATH =
"/aai/v14/business/customers/customer/$customerId/service-subscriptions/service-subscription/$serviceSpecName/service-instances/";
- public static final String AAI_GET_OWNING_ENTITIES =
- "/aai/v14/business/owning-entities";
+ public static final String AAI_GET_OWNING_ENTITIES = "/aai/v14/business/owning-entities";
public static final String AAI_PUT_OWNING_ENTITIES =
- "/aai/v14/business/owning-entities/owning-entity/$onap.owning.entity.id";
+ "/aai/v14/business/owning-entities/owning-entity/$onap.owning.entity.id";
// MSO
- public static final String MSO_CREATE_SERVICE_INSTANCE_PATH = "/onap/so/infra/serviceInstantiation/v7/serviceInstances/";
+ public static final String MSO_CREATE_SERVICE_INSTANCE_PATH =
+ "/onap/so/infra/serviceInstantiation/v7/serviceInstances/";
public static final String MSO_GET_REQUEST_STATUS_PATH = "/onap/so/infra/orchestrationRequests/v7/";
- public static final String MSO_DELETE_REQUEST_STATUS_PATH = "/onap/so/infra/serviceInstantiation/v7/serviceInstances/";
+ public static final String MSO_DELETE_REQUEST_STATUS_PATH =
+ "/onap/so/infra/serviceInstantiation/v7/serviceInstances/";
public static final String MSO_CREATE_E2ESERVICE_INSTANCE_PATH = "/onap/so/infra/e2eServiceInstances/v3";
public static final String MSO_DELETE_E2ESERVICE_INSTANCE_PATH = "/onap/so/infra/e2eServiceInstances/v3/";
- public static final String MSO_GET_E2EREQUEST_STATUS_PATH = "/onap/so/infra/e2eServiceInstances/v3/$serviceId/operations/$operationId";
+ public static final String MSO_GET_E2EREQUEST_STATUS_PATH =
+ "/onap/so/infra/e2eServiceInstances/v3/$serviceId/operations/$operationId";
public static final String MSO_HEALTH_CHECK = "/globalhealthcheck";
// DMaaP Message Router REST Client
- public static final String DMAAP_CONSUME_EVENTS =
- "/events/$topic/$consumergroup/$consumerid?timeout=$timeout";
+ public static final String DMAAP_CONSUME_EVENTS = "/events/$topic/$consumergroup/$consumerid?timeout=$timeout";
-} \ No newline at end of file
+}
diff --git a/src/main/java/org/onap/nbi/ServiceRegisterRunner.java b/src/main/java/org/onap/nbi/ServiceRegisterRunner.java
index 05072c1..23fdb25 100644
--- a/src/main/java/org/onap/nbi/ServiceRegisterRunner.java
+++ b/src/main/java/org/onap/nbi/ServiceRegisterRunner.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.nbi;
import com.google.common.base.Strings;
@@ -99,38 +100,34 @@ public class ServiceRegisterRunner implements CommandLineRunner {
Set<Node> nodes = new HashSet<>();
Node thisNode = new Node();
- thisNode.setIp(Strings.isNullOrEmpty(SERVICE_HOST) ? InetAddress.getLocalHost().getHostAddress() : SERVICE_HOST);
+ thisNode.setIp(
+ Strings.isNullOrEmpty(SERVICE_HOST) ? InetAddress.getLocalHost().getHostAddress() : SERVICE_HOST);
thisNode.setPort(SERVICE_PORT);
thisNode.setCheckType("HTTP");
thisNode.setCheckUrl(SERVICE_URL + "/status");
nodes.add(thisNode);
msinfo.setNodes(nodes);
- logger.info(
- "Registering with msb discovery (" + DISCOVERY_HOST + ":" + DISCOVERY_PORT + "):\n"
- + " - host: [" + thisNode.getIp() + "]\n"
- + " - port: [" + thisNode.getPort() + "]\n"
- + " - name: [" + msinfo.getServiceName() + "]\n"
- + " - version: [" + msinfo.getVersion() + "]\n"
- + " - url: [" + msinfo.getUrl() + "]\n"
- + " - path: [" + msinfo.getPath() + "]\n"
- + " - protocol: [" + msinfo.getProtocol() + "]g\n"
- + " - visualRange: [" + msinfo.getVisualRange() + "]\n"
- + " - enableSSL: [" + SERVICE_ENABLE_SSL + "]\n"
- );
+ logger.info("Registering with msb discovery (" + DISCOVERY_HOST + ":" + DISCOVERY_PORT + "):\n" + " - host: ["
+ + thisNode.getIp() + "]\n" + " - port: [" + thisNode.getPort() + "]\n" + " - name: ["
+ + msinfo.getServiceName() + "]\n" + " - version: [" + msinfo.getVersion() + "]\n" + " - url: ["
+ + msinfo.getUrl() + "]\n" + " - path: [" + msinfo.getPath() + "]\n" + " - protocol: ["
+ + msinfo.getProtocol() + "]g\n" + " - visualRange: [" + msinfo.getVisualRange() + "]\n"
+ + " - enableSSL: [" + SERVICE_ENABLE_SSL + "]\n");
int attempt = 1;
- while (attempt<=RETRY) {
+ while (attempt <= RETRY) {
try {
logger.info("Registration with msb discovery (attempt {}/{})", attempt, RETRY);
MSBServiceClient msbClient = new MSBServiceClient(DISCOVERY_HOST, DISCOVERY_PORT);
MicroServiceFullInfo microServiceFullInfo = msbClient.registerMicroServiceInfo(msinfo);
- logger.debug("Registration with msb discovery done, microServiceFullInfo = {}", microServiceFullInfo.toString());
+ logger.debug("Registration with msb discovery done, microServiceFullInfo = {}",
+ microServiceFullInfo.toString());
break;
} catch (Exception ex) {
logger.warn("Registration with msb discovery (attempt {}/{}) FAILED.", attempt, RETRY);
attempt += 1;
- if(attempt<=RETRY) {
+ if (attempt <= RETRY) {
logger.warn("Sleep {}ms", RETRY_INTERVAL);
Thread.sleep(RETRY_INTERVAL);
}
diff --git a/src/main/java/org/onap/nbi/apis/hub/HubResource.java b/src/main/java/org/onap/nbi/apis/hub/HubResource.java
index 3f14b8a..0eebb71 100755
--- a/src/main/java/org/onap/nbi/apis/hub/HubResource.java
+++ b/src/main/java/org/onap/nbi/apis/hub/HubResource.java
@@ -11,6 +11,7 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
+
package org.onap.nbi.apis.hub;
import java.util.LinkedHashMap;
@@ -54,105 +55,102 @@ import org.springframework.web.bind.annotation.RestController;
@EnableScheduling
public class HubResource extends ResourceManagement {
- Logger logger = LoggerFactory.getLogger(HubResource.class);
-
- @Autowired
- MongoTemplate mongoTemplate;
-
- @Autowired
- SubscriptionService subscriptionService;
-
- @Autowired
- MultiCriteriaRequestBuilder multiCriteriaRequestBuilder;
-
- @Autowired
- CheckDMaaPEventsManager checkDMaaPEventMAnager;
-
- @Autowired
- EWInterfaceUtils ewInterfaceUtils;
-
- @Value("${nbi.public.url}")
- private String nbiPublicUrl;
-
- @PostMapping(consumes = MediaType.APPLICATION_JSON_VALUE)
- public ResponseEntity<Object> createEventSubscription(@RequestBody Subscription subscription,
- @RequestParam MultiValueMap<String, String> params, @RequestHeader(value="Target",required = false)String targetUrl) {
- logger.debug("POST request for subscription : {}", subscription);
- if (targetUrl != null) {
- targetUrl = targetUrl + OnapComponentsUrlPaths.HUB_PATH;
- String originalCallback = subscription.getCallback();
- subscription.setCallback(nbiPublicUrl + OnapComponentsUrlPaths.LISTENER_PATH);
- ResponseEntity ewResponse = ewInterfaceUtils.callPostRequestTarget(subscription, targetUrl);
- if (ewResponse.getStatusCode() == HttpStatus.CREATED) {
- subscription.setCallback(originalCallback);
- subscription.setEwHost(targetUrl);
- subscription.setEwId(((LinkedHashMap)ewResponse.getBody()).get( "id" ).toString());
- } else {
- return ewResponse;
- }
+ Logger logger = LoggerFactory.getLogger(HubResource.class);
+
+ @Autowired
+ MongoTemplate mongoTemplate;
+
+ @Autowired
+ SubscriptionService subscriptionService;
+
+ @Autowired
+ MultiCriteriaRequestBuilder multiCriteriaRequestBuilder;
+
+ @Autowired
+ CheckDMaaPEventsManager checkDMaaPEventMAnager;
+
+ @Autowired
+ EWInterfaceUtils ewInterfaceUtils;
+
+ @Value("${nbi.public.url}")
+ private String nbiPublicUrl;
+
+ @PostMapping(consumes = MediaType.APPLICATION_JSON_VALUE)
+ public ResponseEntity<Object> createEventSubscription(@RequestBody Subscription subscription,
+ @RequestParam MultiValueMap<String, String> params,
+ @RequestHeader(value = "Target", required = false) String targetUrl) {
+ logger.debug("POST request for subscription : {}", subscription);
+ if (targetUrl != null) {
+ targetUrl = targetUrl + OnapComponentsUrlPaths.HUB_PATH;
+ String originalCallback = subscription.getCallback();
+ subscription.setCallback(nbiPublicUrl + OnapComponentsUrlPaths.LISTENER_PATH);
+ ResponseEntity ewResponse = ewInterfaceUtils.callPostRequestTarget(subscription, targetUrl);
+ if (ewResponse.getStatusCode() == HttpStatus.CREATED) {
+ subscription.setCallback(originalCallback);
+ subscription.setEwHost(targetUrl);
+ subscription.setEwId(((LinkedHashMap) ewResponse.getBody()).get("id").toString());
+ } else {
+ return ewResponse;
+ }
+ }
+ Subscriber subscriber = subscriptionService.createSubscription(subscription);
+ JsonRepresentation filter = new JsonRepresentation(params);
+ return this.createResponse(Subscription.createFromSubscriber(subscriber), filter);
+
+ }
+
+ @GetMapping(value = "/{subscriptionId}", produces = MediaType.APPLICATION_JSON_VALUE)
+ public ResponseEntity<Subscription> getSubscription(@PathVariable String subscriptionId) {
+
+ Optional<Subscriber> optionalSubscriber = subscriptionService.findSubscriptionById(subscriptionId);
+ if (!optionalSubscriber.isPresent()) {
+ return ResponseEntity.notFound().build();
+ }
+ return ResponseEntity.ok(Subscription.createFromSubscriber(optionalSubscriber.get()));
}
- Subscriber subscriber = subscriptionService.createSubscription(subscription);
- JsonRepresentation filter = new JsonRepresentation(params);
- return this.createResponse(Subscription.createFromSubscriber(subscriber), filter);
- }
+ @GetMapping(value = "", produces = MediaType.APPLICATION_JSON_VALUE)
+ public ResponseEntity<Object> findSubscribers(@RequestParam MultiValueMap<String, String> params) {
+
+ Query query = multiCriteriaRequestBuilder.buildRequest(params);
+ List<Subscriber> subscribers = mongoTemplate.find(query, Subscriber.class);
+ JsonRepresentation filter = new JsonRepresentation(params);
+ long totalCount = subscriptionService.countSubscription();
+ HttpHeaders headers = new HttpHeaders();
+ headers.add("X-Total-Count", String.valueOf(totalCount));
+ headers.add("X-Result-Count", String.valueOf(subscribers.size()));
+ List<Subscription> subscriptions =
+ subscribers.stream().map(Subscription::createFromSubscriber).collect(Collectors.toList());
- @GetMapping(value = "/{subscriptionId}", produces = MediaType.APPLICATION_JSON_VALUE)
- public ResponseEntity<Subscription> getSubscription(@PathVariable String subscriptionId) {
+ return this.findResponse(subscriptions, filter, headers);
+ }
- Optional<Subscriber> optionalSubscriber =
- subscriptionService.findSubscriptionById(subscriptionId);
- if (!optionalSubscriber.isPresent()) {
- return ResponseEntity.notFound().build();
+ /*
+ * Resource to test for DMaaP Integration for subscribing to AAI-EVENTs
+ */
+ @GetMapping("/testaaievents")
+ @ResponseStatus(HttpStatus.OK)
+ public void testAAIEventListener() {
+ checkDMaaPEventMAnager.checkForDMaaPAAIEvents();
}
- return ResponseEntity.ok(Subscription.createFromSubscriber(optionalSubscriber.get()));
- }
-
- @GetMapping(value = "", produces = MediaType.APPLICATION_JSON_VALUE)
- public ResponseEntity<Object> findSubscribers(
- @RequestParam MultiValueMap<String, String> params) {
-
- Query query = multiCriteriaRequestBuilder.buildRequest(params);
- List<Subscriber> subscribers = mongoTemplate.find(query, Subscriber.class);
- JsonRepresentation filter = new JsonRepresentation(params);
- long totalCount = subscriptionService.countSubscription();
- HttpHeaders headers = new HttpHeaders();
- headers.add("X-Total-Count", String.valueOf(totalCount));
- headers.add("X-Result-Count", String.valueOf(subscribers.size()));
- List<Subscription> subscriptions =
- subscribers.stream().map(Subscription::createFromSubscriber).collect(Collectors.toList());
-
- return this.findResponse(subscriptions, filter, headers);
-
- }
-
- /*
- * Resource to test for DMaaP Integration for subscribing to AAI-EVENTs
- */
- @GetMapping("/testaaievents")
- @ResponseStatus(HttpStatus.OK)
- public void testAAIEventListener() {
- checkDMaaPEventMAnager.checkForDMaaPAAIEvents();
- }
-
- @DeleteMapping("/{subscriptionId}")
- @ResponseStatus(HttpStatus.NO_CONTENT)
- public void deleteSubscription(@PathVariable String subscriptionId) {
- logger.debug("DELETE request for subscription id #{}", subscriptionId);
- Optional<Subscriber> optionalSubscriber= subscriptionService.findSubscriptionById(subscriptionId);
- subscriptionService.deleteSubscription(subscriptionId);
- String ewHost=optionalSubscriber.get().getEwHost();
- String ewId=optionalSubscriber.get().getEwId();
- logger.info("POST delete for ewHost : {}", ewHost);
- logger.info("POST delete for ewId : {}", ewId);
- if ( ewHost !=null && ewId !=null )
- {
- logger.info("POST deleteIF for ewHost : {}", ewHost);
- String targetUrl = ewHost+ "/" + ewId;
- ewInterfaceUtils.callDeleteRequestTarget(targetUrl);
- logger.info("POST deleteIF for ewHost is : {}", targetUrl);
+
+ @DeleteMapping("/{subscriptionId}")
+ @ResponseStatus(HttpStatus.NO_CONTENT)
+ public void deleteSubscription(@PathVariable String subscriptionId) {
+ logger.debug("DELETE request for subscription id #{}", subscriptionId);
+ Optional<Subscriber> optionalSubscriber = subscriptionService.findSubscriptionById(subscriptionId);
+ subscriptionService.deleteSubscription(subscriptionId);
+ String ewHost = optionalSubscriber.get().getEwHost();
+ String ewId = optionalSubscriber.get().getEwId();
+ logger.info("POST delete for ewHost : {}", ewHost);
+ logger.info("POST delete for ewId : {}", ewId);
+ if (ewHost != null && ewId != null) {
+ logger.info("POST deleteIF for ewHost : {}", ewHost);
+ String targetUrl = ewHost + "/" + ewId;
+ ewInterfaceUtils.callDeleteRequestTarget(targetUrl);
+ logger.info("POST deleteIF for ewHost is : {}", targetUrl);
+ }
}
- }
}
diff --git a/src/main/java/org/onap/nbi/apis/hub/model/Event.java b/src/main/java/org/onap/nbi/apis/hub/model/Event.java
index 8540167..f9fb2a1 100755
--- a/src/main/java/org/onap/nbi/apis/hub/model/Event.java
+++ b/src/main/java/org/onap/nbi/apis/hub/model/Event.java
@@ -10,6 +10,7 @@
* 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.nbi.apis.hub.model;
import com.fasterxml.jackson.annotation.JsonFormat;
@@ -17,7 +18,6 @@ import com.fasterxml.jackson.databind.JsonNode;
import java.util.Date;
import javax.validation.constraints.NotNull;
-
public class Event {
private java.lang.String eventId;
diff --git a/src/main/java/org/onap/nbi/apis/hub/model/EventType.java b/src/main/java/org/onap/nbi/apis/hub/model/EventType.java
index 5db21f3..5e4adbb 100644
--- a/src/main/java/org/onap/nbi/apis/hub/model/EventType.java
+++ b/src/main/java/org/onap/nbi/apis/hub/model/EventType.java
@@ -11,6 +11,7 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
+
package org.onap.nbi.apis.hub.model;
import com.fasterxml.jackson.annotation.JsonCreator;
@@ -18,44 +19,44 @@ import com.fasterxml.jackson.annotation.JsonValue;
public enum EventType {
- SERVICE_ORDER_CREATION("ServiceOrderCreationNotification"),
+ SERVICE_ORDER_CREATION("ServiceOrderCreationNotification"),
- SERVICE_ORDER_STATE_CHANGE("ServiceOrderStateChangeNotification"),
+ SERVICE_ORDER_STATE_CHANGE("ServiceOrderStateChangeNotification"),
- SERVICE_ORDER_ITEM_STATE_CHANGE("ServiceOrderItemStateChangeNotification"),
+ SERVICE_ORDER_ITEM_STATE_CHANGE("ServiceOrderItemStateChangeNotification"),
- SERVICE_CREATION("ServiceCreationNotification"),
+ SERVICE_CREATION("ServiceCreationNotification"),
- SERVICE_ATTRIBUTE_VALUE_CHANGE("ServiceAttributeValueChangeNotification"),
+ SERVICE_ATTRIBUTE_VALUE_CHANGE("ServiceAttributeValueChangeNotification"),
- SERVICE_REMOVE("ServiceRemoveNotification"),
+ SERVICE_REMOVE("ServiceRemoveNotification"),
- SDC_DISTRIBUTION("SdcDistributionNotification");
+ SDC_DISTRIBUTION("SdcDistributionNotification");
- private String value;
+ private String value;
- EventType(String value) {
- this.value = value;
- }
+ EventType(String value) {
+ this.value = value;
+ }
- @Override
- public String toString() {
- return String.valueOf(value);
- }
+ @Override
+ public String toString() {
+ return String.valueOf(value);
+ }
- @JsonCreator
- public static EventType fromValue(String text) {
- for (EventType b : EventType.values()) {
- if (String.valueOf(b.value).equals(text)) {
- return b;
- }
+ @JsonCreator
+ public static EventType fromValue(String text) {
+ for (EventType b : EventType.values()) {
+ if (String.valueOf(b.value).equals(text)) {
+ return b;
+ }
+ }
+ return null;
}
- return null;
- }
- @JsonValue
- public String value() {
- return this.value;
- }
+ @JsonValue
+ public String value() {
+ return this.value;
+ }
}
diff --git a/src/main/java/org/onap/nbi/apis/hub/model/ServiceInstanceEvent.java b/src/main/java/org/onap/nbi/apis/hub/model/ServiceInstanceEvent.java
index 4bbafdc..cb3c275 100644
--- a/src/main/java/org/onap/nbi/apis/hub/model/ServiceInstanceEvent.java
+++ b/src/main/java/org/onap/nbi/apis/hub/model/ServiceInstanceEvent.java
@@ -20,71 +20,71 @@ import com.fasterxml.jackson.annotation.JsonProperty;
public class ServiceInstanceEvent {
- @Id
- @JsonProperty("id")
- private String id = null;
+ @Id
+ @JsonProperty("id")
+ private String id = null;
- @JsonProperty("href")
- private String href = null;
+ @JsonProperty("href")
+ private String href = null;
- @JsonProperty("name")
- private String name = null;
+ @JsonProperty("name")
+ private String name = null;
- @JsonProperty("type")
- private String type = "service-instance";
+ @JsonProperty("type")
+ private String type = "service-instance";
- @JsonProperty("state")
- private String state = null;
+ @JsonProperty("state")
+ private String state = null;
- @JsonProperty("relatedParty")
- private RelatedParty relatedParty = null;
+ @JsonProperty("relatedParty")
+ private RelatedParty relatedParty = null;
- public String getId() {
- return id;
- }
+ public String getId() {
+ return id;
+ }
- public void setId(String id) {
- this.id = id;
- }
+ public void setId(String id) {
+ this.id = id;
+ }
- public String getHref() {
- return href;
- }
+ public String getHref() {
+ return href;
+ }
- public void setHref(String href) {
- this.href = href;
- }
+ public void setHref(String href) {
+ this.href = href;
+ }
- public String getName() {
- return name;
- }
+ public String getName() {
+ return name;
+ }
- public void setName(String name) {
- this.name = name;
- }
+ public void setName(String name) {
+ this.name = name;
+ }
- public String getType() {
- return type;
- }
+ public String getType() {
+ return type;
+ }
- public void setType(String type) {
- this.type = type;
- }
+ public void setType(String type) {
+ this.type = type;
+ }
- public String getState() {
- return state;
- }
+ public String getState() {
+ return state;
+ }
- public void setState(String state) {
- this.state = state;
- }
+ public void setState(String state) {
+ this.state = state;
+ }
- public RelatedParty getRelatedParty() {
- return relatedParty;
- }
+ public RelatedParty getRelatedParty() {
+ return relatedParty;
+ }
- public void setRelatedParty(RelatedParty relatedParty) {
- this.relatedParty = relatedParty;
- }
+ public void setRelatedParty(RelatedParty relatedParty) {
+ this.relatedParty = relatedParty;
+ }
}
diff --git a/src/main/java/org/onap/nbi/apis/hub/model/Subscriber.java b/src/main/java/org/onap/nbi/apis/hub/model/Subscriber.java
index 582b14b..018dd9f 100755
--- a/src/main/java/org/onap/nbi/apis/hub/model/Subscriber.java
+++ b/src/main/java/org/onap/nbi/apis/hub/model/Subscriber.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.nbi.apis.hub.model;
import org.onap.nbi.commons.Resource;
@@ -25,7 +26,6 @@ import java.util.HashMap;
import java.util.Map;
import java.util.stream.Stream;
-
@Document
public class Subscriber implements Resource {
private static final Logger logger = LoggerFactory.getLogger(Subscriber.class);
@@ -79,12 +79,10 @@ public class Subscriber implements Resource {
public static Subscriber createFromSubscription(Subscription request) {
Subscriber sub = new Subscriber();
sub.setCallback(request.getCallback());
- sub.setEwId( request.getEwId());
- sub.setEwHost( request.getEwHost());
+ sub.setEwId(request.getEwId());
+ sub.setEwHost(request.getEwHost());
- Stream.of(request.getQuery().split("&"))
- .map(q -> q.split("="))
- .filter(q -> q.length == 2)
+ Stream.of(request.getQuery().split("&")).map(q -> q.split("=")).filter(q -> q.length == 2)
.forEach(q -> sub.getQuery().put(q[0].trim(), q[1].trim().split(",")));
return sub;
diff --git a/src/main/java/org/onap/nbi/apis/hub/model/Subscription.java b/src/main/java/org/onap/nbi/apis/hub/model/Subscription.java
index 646d39b..9f47a7e 100755
--- a/src/main/java/org/onap/nbi/apis/hub/model/Subscription.java
+++ b/src/main/java/org/onap/nbi/apis/hub/model/Subscription.java
@@ -13,13 +13,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.nbi.apis.hub.model;
import java.util.stream.Collectors;
import org.onap.nbi.commons.Resource;
-public class Subscription implements Resource{
-
+public class Subscription implements Resource {
private String id;
@@ -41,13 +41,11 @@ public class Subscription implements Resource{
this.ewId = ewId;
}
-
-
public String getEwHost() {
return ewHost;
}
- public Subscription(){
+ public Subscription() {
}
@@ -85,14 +83,11 @@ public class Subscription implements Resource{
Subscription sub = new Subscription();
sub.setId(subscriber.getId());
sub.setCallback(subscriber.getCallback());
- sub.setEwId( subscriber.getEwId());
- sub.setEwHost( subscriber.getEwHost());
-
+ sub.setEwId(subscriber.getEwId());
+ sub.setEwHost(subscriber.getEwHost());
- String query = subscriber.getQuery().entrySet()
- .stream()
- .map(entry -> entry.getKey()+ "=" + String.join(" ",entry.getValue()))
- .collect(Collectors.joining());
+ String query = subscriber.getQuery().entrySet().stream()
+ .map(entry -> entry.getKey() + "=" + String.join(" ", entry.getValue())).collect(Collectors.joining());
sub.setQuery(query);
return sub;
diff --git a/src/main/java/org/onap/nbi/apis/hub/repository/SubscriberFinder.java b/src/main/java/org/onap/nbi/apis/hub/repository/SubscriberFinder.java
index ab23a3c..bd7fe0a 100755
--- a/src/main/java/org/onap/nbi/apis/hub/repository/SubscriberFinder.java
+++ b/src/main/java/org/onap/nbi/apis/hub/repository/SubscriberFinder.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.nbi.apis.hub.repository;
import org.onap.nbi.apis.hub.model.Event;
diff --git a/src/main/java/org/onap/nbi/apis/hub/repository/SubscriberRepository.java b/src/main/java/org/onap/nbi/apis/hub/repository/SubscriberRepository.java
index b80effb..0b05d5f 100755
--- a/src/main/java/org/onap/nbi/apis/hub/repository/SubscriberRepository.java
+++ b/src/main/java/org/onap/nbi/apis/hub/repository/SubscriberRepository.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.nbi.apis.hub.repository;
import org.onap.nbi.apis.hub.model.Subscriber;
diff --git a/src/main/java/org/onap/nbi/apis/hub/repository/SubscriberRepositoryImpl.java b/src/main/java/org/onap/nbi/apis/hub/repository/SubscriberRepositoryImpl.java
index 9799e48..8618105 100755
--- a/src/main/java/org/onap/nbi/apis/hub/repository/SubscriberRepositoryImpl.java
+++ b/src/main/java/org/onap/nbi/apis/hub/repository/SubscriberRepositoryImpl.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.nbi.apis.hub.repository;
import org.onap.nbi.apis.hub.model.Event;
diff --git a/src/main/java/org/onap/nbi/apis/hub/service/CriteriaBuilder.java b/src/main/java/org/onap/nbi/apis/hub/service/CriteriaBuilder.java
index 4d4872d..153cb5c 100755
--- a/src/main/java/org/onap/nbi/apis/hub/service/CriteriaBuilder.java
+++ b/src/main/java/org/onap/nbi/apis/hub/service/CriteriaBuilder.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.nbi.apis.hub.service;
import org.onap.nbi.apis.hub.model.Event;
diff --git a/src/main/java/org/onap/nbi/apis/hub/service/CriteriaBuilderServiceOrder.java b/src/main/java/org/onap/nbi/apis/hub/service/CriteriaBuilderServiceOrder.java
index 4a780a5..8b3e7d4 100755
--- a/src/main/java/org/onap/nbi/apis/hub/service/CriteriaBuilderServiceOrder.java
+++ b/src/main/java/org/onap/nbi/apis/hub/service/CriteriaBuilderServiceOrder.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.nbi.apis.hub.service;
import com.fasterxml.jackson.databind.JsonNode;
@@ -32,19 +33,15 @@ public class CriteriaBuilderServiceOrder implements CriteriaBuilder {
case "ServiceOrderStateChangeNotification":
JsonNode stateNode = event.getEvent().path("state");
if (stateNode.isValueNode())
- return base.orOperator(
- Criteria.where("query.serviceOrder__state").exists(false),
- Criteria.where("query.serviceOrder__state").in(stateNode.textValue())
- );
+ return base.orOperator(Criteria.where("query.serviceOrder__state").exists(false),
+ Criteria.where("query.serviceOrder__state").in(stateNode.textValue()));
break;
case "ServiceOrderItemStateChangeNotification":
Object[] states = getStates(event);
if (states.length > 0)
- return base.orOperator(
- Criteria.where("query.serviceOrder__serviceOrderItem__state").exists(false),
- Criteria.where("query.serviceOrder__serviceOrderItem__state").in(states)
- );
+ return base.orOperator(Criteria.where("query.serviceOrder__serviceOrderItem__state").exists(false),
+ Criteria.where("query.serviceOrder__serviceOrderItem__state").in(states));
break;
}
diff --git a/src/main/java/org/onap/nbi/apis/hub/service/EventFactory.java b/src/main/java/org/onap/nbi/apis/hub/service/EventFactory.java
index 2fe533b..0284f0b 100644
--- a/src/main/java/org/onap/nbi/apis/hub/service/EventFactory.java
+++ b/src/main/java/org/onap/nbi/apis/hub/service/EventFactory.java
@@ -10,6 +10,7 @@
* 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.nbi.apis.hub.service;
import com.fasterxml.jackson.databind.JsonNode;
@@ -36,8 +37,7 @@ public class EventFactory {
private static final ObjectMapper mapper = new ObjectMapper(new MappingJsonFactory());
private static final Logger logger = LoggerFactory.getLogger(EventFactory.class);
- public static Event getEvent(EventType eventType, ServiceOrder serviceOrder,
- ServiceOrderItem serviceOrderItem) {
+ public static Event getEvent(EventType eventType, ServiceOrder serviceOrder, ServiceOrderItem serviceOrderItem) {
Event event = new Event();
event.setEventId(UUID.randomUUID().toString());
event.setEventDate(new Date());
@@ -87,13 +87,11 @@ public class EventFactory {
event.setEvent(serviceInstanceJson);
return event;
} catch (IOException e) {
- logger.error("IO Error when parsing Event JSON String {} ", eventString,
- e.getMessage());
+ logger.error("IO Error when parsing Event JSON String {} ", eventString, e.getMessage());
}
return null;
}
-
/**
* Filter ServiceOrderObject to produce a lightweight object that fit the eventBody specification
*
@@ -107,7 +105,7 @@ public class EventFactory {
if (serviceOrder != null) {
JsonRepresentation jsonRepresentation = new JsonRepresentation();
jsonRepresentation.add("id").add("href").add("externalId").add("state").add("orderDate")
- .add("completionDateTime").add("orderItem");
+ .add("completionDateTime").add("orderItem");
filteredServiceOrder = JacksonFilter.createNode(serviceOrder, jsonRepresentation);
}
diff --git a/src/main/java/org/onap/nbi/apis/hub/service/NotificationAspect.java b/src/main/java/org/onap/nbi/apis/hub/service/NotificationAspect.java
index cd242e8..7d85ef0 100755
--- a/src/main/java/org/onap/nbi/apis/hub/service/NotificationAspect.java
+++ b/src/main/java/org/onap/nbi/apis/hub/service/NotificationAspect.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.nbi.apis.hub.service;
import org.aspectj.lang.JoinPoint;
@@ -39,46 +40,49 @@ public class NotificationAspect {
@Autowired
private NotifierService notifier;
- @AfterReturning(value = "execution(* org.onap.nbi.apis.serviceorder.service.ServiceOrderService" +
- ".createServiceOrder(..))", returning = "serviceOrderCreated")
+ @AfterReturning(
+ value = "execution(* org.onap.nbi.apis.serviceorder.service.ServiceOrderService"
+ + ".createServiceOrder(..))",
+ returning = "serviceOrderCreated")
public void whenCreateServiceOrder(ServiceOrder serviceOrderCreated) {
- if(StateType.ACKNOWLEDGED.equals(serviceOrderCreated.getState())) {
+ if (StateType.ACKNOWLEDGED.equals(serviceOrderCreated.getState())) {
processEvent(EventFactory.getEvent(EventType.SERVICE_ORDER_CREATION, serviceOrderCreated, null));
}
}
- @AfterReturning(value = "execution(* org.onap.nbi.apis.serviceorder.service.ServiceOrderService" +
- ".updateOrderState(..))", returning = "serviceOrderUpdated")
+ @AfterReturning(
+ value = "execution(* org.onap.nbi.apis.serviceorder.service.ServiceOrderService" + ".updateOrderState(..))",
+ returning = "serviceOrderUpdated")
public void whenUpdateServiceOrderState(ServiceOrder serviceOrderUpdated) {
- if(StateType.COMPLETED.equals(serviceOrderUpdated.getState())||
- StateType.FAILED.equals(serviceOrderUpdated.getState())) {
+ if (StateType.COMPLETED.equals(serviceOrderUpdated.getState())
+ || StateType.FAILED.equals(serviceOrderUpdated.getState())) {
processEvent(EventFactory.getEvent(EventType.SERVICE_ORDER_STATE_CHANGE, serviceOrderUpdated, null));
}
}
- @AfterReturning(value = "execution(* org.onap.nbi.apis.serviceorder.service.ServiceOrderService" +
- ".updateOrderItemState(..))")
+ @AfterReturning(
+ value = "execution(* org.onap.nbi.apis.serviceorder.service.ServiceOrderService"
+ + ".updateOrderItemState(..))")
public void whenUpdateServiceOrderItemState(JoinPoint joinPoint) {
Object[] signatureArgs = joinPoint.getArgs();
- if(signatureArgs != null && signatureArgs.length == 3) {
+ if (signatureArgs != null && signatureArgs.length == 3) {
ServiceOrder serviceOrder = (ServiceOrder) signatureArgs[0];
ServiceOrderItem serviceOrderItem = (ServiceOrderItem) signatureArgs[1];
StateType serviceOrderItemState = (StateType) signatureArgs[2];
- processEvent(EventFactory.getEvent(EventType.SERVICE_ORDER_ITEM_STATE_CHANGE, serviceOrder,
- serviceOrderItem));
+ processEvent(
+ EventFactory.getEvent(EventType.SERVICE_ORDER_ITEM_STATE_CHANGE, serviceOrder, serviceOrderItem));
}
}
/**
* Retreive subscribers that match an event and fire notification
* asynchronously
+ *
* @param event
*/
private void processEvent(Event event) {
- subscriberRepository
- .findSubscribersUsingEvent(event)
- .forEach(sub -> notifier.run(sub, event));
+ subscriberRepository.findSubscribersUsingEvent(event).forEach(sub -> notifier.run(sub, event));
}
}
diff --git a/src/main/java/org/onap/nbi/apis/hub/service/NotifierService.java b/src/main/java/org/onap/nbi/apis/hub/service/NotifierService.java
index 80b6331..c717d2b 100755
--- a/src/main/java/org/onap/nbi/apis/hub/service/NotifierService.java
+++ b/src/main/java/org/onap/nbi/apis/hub/service/NotifierService.java
@@ -11,6 +11,7 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
+
package org.onap.nbi.apis.hub.service;
import javax.validation.Valid;
@@ -27,19 +28,19 @@ import org.springframework.web.client.RestTemplate;
@Service
public class NotifierService {
- private final Logger logger = LoggerFactory.getLogger(NotifierService.class);
+ private final Logger logger = LoggerFactory.getLogger(NotifierService.class);
- @Autowired
- RestTemplate restTemplate;
+ @Autowired
+ RestTemplate restTemplate;
- @Async
- public void run(Subscriber subscriber, @Valid Event event) {
- try {
- restTemplate.postForEntity(subscriber.getCallback(), event, Object.class);
- } catch (BackendFunctionalException e) {
- logger.error(" unable to post event to {} , receive {}, {}", subscriber.getCallback(),
- e.getHttpStatus(), e.getBodyResponse());
- }
+ @Async
+ public void run(Subscriber subscriber, @Valid Event event) {
+ try {
+ restTemplate.postForEntity(subscriber.getCallback(), event, Object.class);
+ } catch (BackendFunctionalException e) {
+ logger.error(" unable to post event to {} , receive {}, {}", subscriber.getCallback(), e.getHttpStatus(),
+ e.getBodyResponse());
+ }
- }
+ }
}
diff --git a/src/main/java/org/onap/nbi/apis/hub/service/SubscriptionService.java b/src/main/java/org/onap/nbi/apis/hub/service/SubscriptionService.java
index 3507d63..36d9a75 100644
--- a/src/main/java/org/onap/nbi/apis/hub/service/SubscriptionService.java
+++ b/src/main/java/org/onap/nbi/apis/hub/service/SubscriptionService.java
@@ -10,6 +10,7 @@
* 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.nbi.apis.hub.service;
import com.google.common.collect.Lists;
@@ -39,9 +40,8 @@ public class SubscriptionService {
subscription.setId(null);
Subscriber subscriber = Subscriber.createFromSubscription(subscription);
if (isSubscriberAlreadyExisting(subscriber)) {
- String message = MessageFormat
- .format("subscription with callback {0} and query {1} already exists", subscription.getCallback(),
- subscription.getQuery());
+ String message = MessageFormat.format("subscription with callback {0} and query {1} already exists",
+ subscription.getCallback(), subscription.getQuery());
ObjectError error = new ObjectError("subscription", message);
List<ObjectError> errors = Lists.newArrayList(error);
throw new ValidationException(errors);
diff --git a/src/main/java/org/onap/nbi/apis/hub/service/dmaap/CheckDMaaPEventsManager.java b/src/main/java/org/onap/nbi/apis/hub/service/dmaap/CheckDMaaPEventsManager.java
index ec9e8d1..4e6131c 100644
--- a/src/main/java/org/onap/nbi/apis/hub/service/dmaap/CheckDMaaPEventsManager.java
+++ b/src/main/java/org/onap/nbi/apis/hub/service/dmaap/CheckDMaaPEventsManager.java
@@ -45,198 +45,191 @@ import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
-
@Service
public class CheckDMaaPEventsManager {
- public static final String RESPONSE_STATUS = "response status : ";
- public static final String RETURNS = " returns ";
- public static final String ERROR_ON_CALLING = "error on calling ";
- private final Logger logger = LoggerFactory.getLogger(CheckDMaaPEventsManager.class);
- @Autowired
- private RestTemplate restTemplate;
- @Autowired
- private SubscriberRepository subscriberRepository;
- @Autowired
- private NotifierService notifier;
- @Value("${dmaap.host}")
- private String dmaapHostname;
- @Value("${dmaap.aai.topic}")
- private String aaiTopic;
- @Value("${dmaap.sdc.topic}")
- private String sdcTopic;
- @Value("${dmaap.consumergroup}")
- private String consumerGroup;
- @Value("${dmaap.consumerid}")
- private String consumerId;
- @Value("${dmaap.timeout}")
- private String timeout;
- private String dmaapGetEventsUrl;
-
- @PostConstruct
- private void setUpAndLogDMaaPUrl() {
- dmaapGetEventsUrl = new StringBuilder().append(dmaapHostname)
- .append(OnapComponentsUrlPaths.DMAAP_CONSUME_EVENTS).toString();
- logger.info("DMaaP Get Events url : " + dmaapGetEventsUrl);
- }
-
- public void checkForDMaaPAAIEvents() {
- ObjectMapper mapper = new ObjectMapper();
- List<String> dmaapResponse = callDMaaPGetEvents(aaiTopic);
- if (!CollectionUtils.isEmpty(dmaapResponse)) {
- for (int i = 0; i < dmaapResponse.size(); i++) {
- String aaiEventString = dmaapResponse.get(i);
- if (logger.isDebugEnabled()) {
- logger.debug("aai event returned was {}", aaiEventString);
- }
- try {
- JsonNode jsonNode = mapper.readValue(aaiEventString, JsonNode.class);
- JsonNode eventHeader = jsonNode.get("event-header");
- String aaiEventEntityType = eventHeader.get("entity-type").asText();
- String action = eventHeader.get("action").asText();
- if (logger.isDebugEnabled()) {
- logger.debug("aaiEventEntityType is {} and action is {}", aaiEventEntityType, action);
- }
- if (aaiEventEntityType.equals("service-instance")) {
- {
- // parse the AAI-EVENT service-instance tree
- ServiceInstanceEvent serviceInstanceEvent = new ServiceInstanceEvent();
- RelatedParty relatedParty = new RelatedParty();
- JsonNode entity = jsonNode.get("entity");
- relatedParty.setId(entity.get("global-customer-id").asText());
- relatedParty.setName(entity.get("subscriber-name").asText());
- serviceInstanceEvent.setRelatedParty(relatedParty);
- JsonNode childServiceSubscription = entity.get("service-subscriptions");
- JsonNode serviceSubscriptions = childServiceSubscription.get("service-subscription");
- JsonNode serviceSubscription = serviceSubscriptions.get(0);
- String serviceSubscriptionPrint = serviceSubscription.toString();
- JsonNode childserviceInstances = serviceSubscription.get("service-instances");
- JsonNode serviceInstances = childserviceInstances.get("service-instance");
- JsonNode serviceInstance = serviceInstances.get(0);
- serviceInstanceEvent.setId(serviceInstance.get("service-instance-id").asText());
- serviceInstanceEvent
- .setHref("service/" + serviceInstance.get("service-instance-id").asText());
- if (serviceInstance.get("orchestration-status") != null) {
- serviceInstanceEvent.setState(serviceInstance.get("orchestration-status").asText());
- }
- if (action.equals("CREATE")) {
+ public static final String RESPONSE_STATUS = "response status : ";
+ public static final String RETURNS = " returns ";
+ public static final String ERROR_ON_CALLING = "error on calling ";
+ private final Logger logger = LoggerFactory.getLogger(CheckDMaaPEventsManager.class);
+ @Autowired
+ private RestTemplate restTemplate;
+ @Autowired
+ private SubscriberRepository subscriberRepository;
+ @Autowired
+ private NotifierService notifier;
+ @Value("${dmaap.host}")
+ private String dmaapHostname;
+ @Value("${dmaap.aai.topic}")
+ private String aaiTopic;
+ @Value("${dmaap.sdc.topic}")
+ private String sdcTopic;
+ @Value("${dmaap.consumergroup}")
+ private String consumerGroup;
+ @Value("${dmaap.consumerid}")
+ private String consumerId;
+ @Value("${dmaap.timeout}")
+ private String timeout;
+ private String dmaapGetEventsUrl;
+
+ @PostConstruct
+ private void setUpAndLogDMaaPUrl() {
+ dmaapGetEventsUrl = new StringBuilder().append(dmaapHostname)
+ .append(OnapComponentsUrlPaths.DMAAP_CONSUME_EVENTS).toString();
+ logger.info("DMaaP Get Events url : " + dmaapGetEventsUrl);
+ }
+
+ public void checkForDMaaPAAIEvents() {
+ ObjectMapper mapper = new ObjectMapper();
+ List<String> dmaapResponse = callDMaaPGetEvents(aaiTopic);
+ if (!CollectionUtils.isEmpty(dmaapResponse)) {
+ for (int i = 0; i < dmaapResponse.size(); i++) {
+ String aaiEventString = dmaapResponse.get(i);
if (logger.isDebugEnabled()) {
- logger.debug("sending service inventory event to listeners");
+ logger.debug("aai event returned was {}", aaiEventString);
+ }
+ try {
+ JsonNode jsonNode = mapper.readValue(aaiEventString, JsonNode.class);
+ JsonNode eventHeader = jsonNode.get("event-header");
+ String aaiEventEntityType = eventHeader.get("entity-type").asText();
+ String action = eventHeader.get("action").asText();
+ if (logger.isDebugEnabled()) {
+ logger.debug("aaiEventEntityType is {} and action is {}", aaiEventEntityType, action);
+ }
+ if (aaiEventEntityType.equals("service-instance")) {
+ {
+ // parse the AAI-EVENT service-instance tree
+ ServiceInstanceEvent serviceInstanceEvent = new ServiceInstanceEvent();
+ RelatedParty relatedParty = new RelatedParty();
+ JsonNode entity = jsonNode.get("entity");
+ relatedParty.setId(entity.get("global-customer-id").asText());
+ relatedParty.setName(entity.get("subscriber-name").asText());
+ serviceInstanceEvent.setRelatedParty(relatedParty);
+ JsonNode childServiceSubscription = entity.get("service-subscriptions");
+ JsonNode serviceSubscriptions = childServiceSubscription.get("service-subscription");
+ JsonNode serviceSubscription = serviceSubscriptions.get(0);
+ String serviceSubscriptionPrint = serviceSubscription.toString();
+ JsonNode childserviceInstances = serviceSubscription.get("service-instances");
+ JsonNode serviceInstances = childserviceInstances.get("service-instance");
+ JsonNode serviceInstance = serviceInstances.get(0);
+ serviceInstanceEvent.setId(serviceInstance.get("service-instance-id").asText());
+ serviceInstanceEvent
+ .setHref("service/" + serviceInstance.get("service-instance-id").asText());
+ if (serviceInstance.get("orchestration-status") != null) {
+ serviceInstanceEvent.setState(serviceInstance.get("orchestration-status").asText());
+ }
+ if (action.equals("CREATE")) {
+ if (logger.isDebugEnabled()) {
+ logger.debug("sending service inventory event to listeners");
+ }
+ processEvent(EventFactory.getEvent(EventType.SERVICE_CREATION, serviceInstanceEvent));
+ } else if (action.equals("DELETE")) {
+ processEvent(EventFactory.getEvent(EventType.SERVICE_REMOVE, serviceInstanceEvent));
+ } else if (action.equals("UPDATE")) {
+ processEvent(EventFactory.getEvent(EventType.SERVICE_ATTRIBUTE_VALUE_CHANGE,
+ serviceInstanceEvent));
+ }
+
+ }
+
+ }
+
+ } catch (JsonParseException e) {
+ logger.error(" unable to Parse AAI Event JSON String {}, exception is", aaiEventString,
+ e.getMessage());
+ } catch (JsonMappingException e) {
+ logger.error(" unable to Map AAI Event JSON String {} to Java Pojo, exception is", aaiEventString,
+ e.getMessage());
+ } catch (IOException e) {
+ logger.error("IO Error when parsing AAI Event JSON String {} ", aaiEventString, e.getMessage());
}
- processEvent(
- EventFactory.getEvent(EventType.SERVICE_CREATION, serviceInstanceEvent));
- } else if (action.equals("DELETE")) {
- processEvent(EventFactory.getEvent(EventType.SERVICE_REMOVE, serviceInstanceEvent));
- } else if (action.equals("UPDATE")) {
- processEvent(EventFactory.getEvent(EventType.SERVICE_ATTRIBUTE_VALUE_CHANGE,
- serviceInstanceEvent));
- }
-
-
}
-
- }
-
- } catch (JsonParseException e) {
- logger.error(" unable to Parse AAI Event JSON String {}, exception is", aaiEventString,
- e.getMessage());
- } catch (JsonMappingException e) {
- logger.error(" unable to Map AAI Event JSON String {} to Java Pojo, exception is",
- aaiEventString, e.getMessage());
- } catch (IOException e) {
- logger.error("IO Error when parsing AAI Event JSON String {} ", aaiEventString,
- e.getMessage());
}
- }
}
- }
- public void checkForDMaaPSDCEvents() {
- List<String> dmaapResponse = callDMaaPGetEvents(sdcTopic);
- if (!CollectionUtils.isEmpty(dmaapResponse)) {
- for (int i = 0; i < dmaapResponse.size(); i++) {
- String sdcEventString = dmaapResponse.get(i);
- if (logger.isDebugEnabled()) {
- logger.debug("sdc event returned was {}", sdcEventString);
+ public void checkForDMaaPSDCEvents() {
+ List<String> dmaapResponse = callDMaaPGetEvents(sdcTopic);
+ if (!CollectionUtils.isEmpty(dmaapResponse)) {
+ for (int i = 0; i < dmaapResponse.size(); i++) {
+ String sdcEventString = dmaapResponse.get(i);
+ if (logger.isDebugEnabled()) {
+ logger.debug("sdc event returned was {}", sdcEventString);
+ }
+ processEvent(EventFactory.getEvent(EventType.SDC_DISTRIBUTION, sdcEventString));
+ }
}
- processEvent(EventFactory.getEvent(EventType.SDC_DISTRIBUTION, sdcEventString));
- }
}
- }
+ public List<String> callDMaaPGetEvents(String topic) {
- public List<String> callDMaaPGetEvents(String topic) {
+ URI callURI = buildRequest(topic);
+ ResponseEntity<Object> response = callDMaaP(callURI);
+ if (response != null) {
+ return (List<String>) response.getBody();
- URI callURI = buildRequest(topic);
- ResponseEntity<Object> response = callDMaaP(callURI);
- if (response != null) {
- return (List<String>) response.getBody();
-
- } else {
- return null;
+ } else {
+ return null;
+ }
}
- }
- public ResponseEntity<Object> callCheckConnectivity() {
- URI callURI = buildRequest(null);
+ public ResponseEntity<Object> callCheckConnectivity() {
+ URI callURI = buildRequest(null);
- ResponseEntity<Object> response =
- restTemplate.exchange(callURI, HttpMethod.GET, buildRequestHeader(), Object.class);
-
- if (logger.isDebugEnabled()) {
- logger.debug("response body : {} ", response.getBody().toString());
- logger.debug("response status : {}", response.getStatusCodeValue());
- }
- return response;
-
- }
+ ResponseEntity<Object> response =
+ restTemplate.exchange(callURI, HttpMethod.GET, buildRequestHeader(), Object.class);
+ if (logger.isDebugEnabled()) {
+ logger.debug("response body : {} ", response.getBody().toString());
+ logger.debug("response status : {}", response.getStatusCodeValue());
+ }
+ return response;
- private URI buildRequest(String topic) {
- if (StringUtils.isEmpty(topic)) {
- topic = aaiTopic;
- }
- String dmaapGetEventsUrlFormated = dmaapGetEventsUrl.replace("$topic", topic);
- dmaapGetEventsUrlFormated = dmaapGetEventsUrlFormated.replace("$consumergroup", consumerGroup);
- dmaapGetEventsUrlFormated = dmaapGetEventsUrlFormated.replace("$consumerid", consumerId);
- dmaapGetEventsUrlFormated = dmaapGetEventsUrlFormated.replace("$timeout", timeout);
- if (logger.isDebugEnabled()) {
- logger.debug("Calling DMaaP Url : " + dmaapGetEventsUrlFormated);
}
- UriComponentsBuilder callURI = UriComponentsBuilder.fromHttpUrl(dmaapGetEventsUrlFormated);
- return callURI.build().encode().toUri();
- }
-
- private ResponseEntity<Object> callDMaaP(URI callURI) {
- try {
- ResponseEntity<Object> response =
- restTemplate.exchange(callURI, HttpMethod.GET, buildRequestHeader(), Object.class);
- if (logger.isDebugEnabled()) {
- logger.debug("response body : {} ", response.getBody().toString());
- logger.debug("response status : {}", response.getStatusCodeValue());
- }
- return response;
- } catch (Exception e) {
- String message = MessageFormat.format("Exception while calling dmaap : {0}", callURI);
- logger.error(message);
- return null;
+
+ private URI buildRequest(String topic) {
+ if (StringUtils.isEmpty(topic)) {
+ topic = aaiTopic;
+ }
+ String dmaapGetEventsUrlFormated = dmaapGetEventsUrl.replace("$topic", topic);
+ dmaapGetEventsUrlFormated = dmaapGetEventsUrlFormated.replace("$consumergroup", consumerGroup);
+ dmaapGetEventsUrlFormated = dmaapGetEventsUrlFormated.replace("$consumerid", consumerId);
+ dmaapGetEventsUrlFormated = dmaapGetEventsUrlFormated.replace("$timeout", timeout);
+ if (logger.isDebugEnabled()) {
+ logger.debug("Calling DMaaP Url : " + dmaapGetEventsUrlFormated);
+ }
+ UriComponentsBuilder callURI = UriComponentsBuilder.fromHttpUrl(dmaapGetEventsUrlFormated);
+ return callURI.build().encode().toUri();
}
- }
+ private ResponseEntity<Object> callDMaaP(URI callURI) {
+ try {
+ ResponseEntity<Object> response =
+ restTemplate.exchange(callURI, HttpMethod.GET, buildRequestHeader(), Object.class);
+ if (logger.isDebugEnabled()) {
+ logger.debug("response body : {} ", response.getBody().toString());
+ logger.debug("response status : {}", response.getStatusCodeValue());
+ }
+ return response;
+ } catch (Exception e) {
+ String message = MessageFormat.format("Exception while calling dmaap : {0}", callURI);
+ logger.error(message);
+ return null;
+ }
+ }
- private HttpEntity<String> buildRequestHeader() {
- HttpHeaders httpHeaders = new HttpHeaders();
- httpHeaders.add("Accept", "application/json");
- httpHeaders.add("Content-Type", "application/json");
- return new HttpEntity<>("parameters", httpHeaders);
- }
+ private HttpEntity<String> buildRequestHeader() {
+ HttpHeaders httpHeaders = new HttpHeaders();
+ httpHeaders.add("Accept", "application/json");
+ httpHeaders.add("Content-Type", "application/json");
+ return new HttpEntity<>("parameters", httpHeaders);
+ }
- /**
- * Retrieve subscribers that match an event and fire notification asynchronously
- */
- private void processEvent(Event event) {
- subscriberRepository.findSubscribersUsingEvent(event).forEach(sub -> notifier.run(sub, event));
- }
+ /**
+ * Retrieve subscribers that match an event and fire notification asynchronously
+ */
+ private void processEvent(Event event) {
+ subscriberRepository.findSubscribersUsingEvent(event).forEach(sub -> notifier.run(sub, event));
+ }
}
diff --git a/src/main/java/org/onap/nbi/apis/hub/service/dmaap/DMaaPEventsScheduler.java b/src/main/java/org/onap/nbi/apis/hub/service/dmaap/DMaaPEventsScheduler.java
index 448b32c..cccdfac 100644
--- a/src/main/java/org/onap/nbi/apis/hub/service/dmaap/DMaaPEventsScheduler.java
+++ b/src/main/java/org/onap/nbi/apis/hub/service/dmaap/DMaaPEventsScheduler.java
@@ -27,13 +27,11 @@ public class DMaaPEventsScheduler {
@Autowired
CheckDMaaPEventsManager checkDMaaPEventsManager;
- @Scheduled(fixedDelayString = "${dmaapCheck.schedule}",
- initialDelayString = "${dmaapCheck.initial}")
+ @Scheduled(fixedDelayString = "${dmaapCheck.schedule}", initialDelayString = "${dmaapCheck.initial}")
private void processDMaaPEvents() {
checkDMaaPEventsManager.checkForDMaaPAAIEvents();
// Comment out until we discover how to check with Authenticated topic
- //checkDMaaPEventsManager.checkForDMaaPSDCEvents();
+ // checkDMaaPEventsManager.checkForDMaaPSDCEvents();
}
}
-
diff --git a/src/main/java/org/onap/nbi/apis/listener/ListenerResourceTarget.java b/src/main/java/org/onap/nbi/apis/listener/ListenerResourceTarget.java
index 8b8e50f..55d2175 100644
--- a/src/main/java/org/onap/nbi/apis/listener/ListenerResourceTarget.java
+++ b/src/main/java/org/onap/nbi/apis/listener/ListenerResourceTarget.java
@@ -46,7 +46,7 @@ public class ListenerResourceTarget {
static Map<String, JsonNode> events = new ConcurrentHashMap<>();
/*
- listener resource test for hub resource
+ * listener resource test for hub resource
*/
@PostMapping(consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Object> postListenerResource(@RequestBody JsonNode event) {
@@ -56,11 +56,9 @@ public class ListenerResourceTarget {
}
try {
Event eventListener = mapper.treeToValue(event, Event.class);
- subscriberRepository
- .findSubscribersUsingEvent(eventListener)
+ subscriberRepository.findSubscribersUsingEvent(eventListener)
.forEach(sub -> notifier.run(sub, eventListener));
- }
- catch(Exception e){
+ } catch (Exception e) {
logger.error("listener not called " + " ," + e.getMessage());
return ResponseEntity.badRequest().build();
}
@@ -68,4 +66,3 @@ public class ListenerResourceTarget {
return ResponseEntity.ok().build();
}
}
-
diff --git a/src/main/java/org/onap/nbi/apis/servicecatalog/SdcClient.java b/src/main/java/org/onap/nbi/apis/servicecatalog/SdcClient.java
index 0eb9da9..e362903 100644
--- a/src/main/java/org/onap/nbi/apis/servicecatalog/SdcClient.java
+++ b/src/main/java/org/onap/nbi/apis/servicecatalog/SdcClient.java
@@ -11,6 +11,7 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
+
package org.onap.nbi.apis.servicecatalog;
import java.io.File;
@@ -68,27 +69,23 @@ public class SdcClient {
private static final Logger LOGGER = LoggerFactory.getLogger(SdcClient.class);
-
-
private String sdcGetUrl;
private String sdcFindUrl;
private String sdcHealthCheck;
@PostConstruct
private void setUpAndLogSDCUrl() {
- sdcGetUrl= new StringBuilder().append(sdcHost).append(OnapComponentsUrlPaths.SDC_ROOT_URL+"/{id}"+OnapComponentsUrlPaths.SDC_GET_PATH).toString();
+ sdcGetUrl = new StringBuilder().append(sdcHost)
+ .append(OnapComponentsUrlPaths.SDC_ROOT_URL + "/{id}" + OnapComponentsUrlPaths.SDC_GET_PATH).toString();
sdcFindUrl = new StringBuilder().append(sdcHost).append(OnapComponentsUrlPaths.SDC_ROOT_URL).toString();
sdcHealthCheck = new StringBuilder().append(sdcHost).append(OnapComponentsUrlPaths.SDC_HEALTH_CHECK).toString();
-
-
- LOGGER.info("SDC GET url : "+sdcGetUrl);
- LOGGER.info("SDC FIND url : "+ sdcFindUrl);
- LOGGER.info("SDC HealthCheck : "+ sdcHealthCheck);
+ LOGGER.info("SDC GET url : " + sdcGetUrl);
+ LOGGER.info("SDC FIND url : " + sdcFindUrl);
+ LOGGER.info("SDC HealthCheck : " + sdcHealthCheck);
}
-
public Map callGet(String id) {
String callUrl = sdcGetUrl.replace("{id}", id);
@@ -123,19 +120,17 @@ public class SdcClient {
}
-
-
public File callGetWithAttachment(String toscaModelUrl) {
StringBuilder urlBuilder = new StringBuilder().append(sdcHost).append(toscaModelUrl);
UriComponentsBuilder callURI = UriComponentsBuilder.fromHttpUrl(urlBuilder.toString());
File directory = new File("temptoscafile");
- if (! directory.exists()){
+ if (!directory.exists()) {
directory.mkdir();
}
- String fileName = "temptoscafile/"+System.currentTimeMillis() + "tosca.csar";
+ String fileName = "temptoscafile/" + System.currentTimeMillis() + "tosca.csar";
ResponseEntity<byte[]> response = callSdcWithAttachment(callURI.build().encode().toUri());
File toscaFile = new File(fileName);
try {
@@ -150,7 +145,7 @@ public class SdcClient {
return toscaFile;
}
-
+
public Path getServiceToscaModel(String uuid) throws IOException {
StringBuilder urlBuilder = new StringBuilder().append(sdcHost).append(OnapComponentsUrlPaths.SDC_ROOT_URL)
.append("/").append(uuid).append(OnapComponentsUrlPaths.SDC_TOSCA_PATH);
@@ -161,7 +156,7 @@ public class SdcClient {
return createTmpFile(inputStream);
}
-
+
private Path createTmpFile(InputStream csarInputStream) throws IOException {
Path csarFile = Files.createTempFile("csar", ".zip");
Files.copy(csarInputStream, csarFile, StandardCopyOption.REPLACE_EXISTING);
@@ -179,42 +174,38 @@ public class SdcClient {
return new HttpEntity<>("parameters", httpHeaders);
}
-
private ResponseEntity<Object> callSdc(URI callURI) {
ResponseEntity<Object> response =
restTemplate.exchange(callURI, HttpMethod.GET, buildRequestHeader(), Object.class);
- if(LOGGER.isDebugEnabled()) {
- LOGGER.debug("response body : {} ",response.getBody().toString());
+ if (LOGGER.isDebugEnabled()) {
+ LOGGER.debug("response body : {} ", response.getBody().toString());
}
LOGGER.info("response status : {}", response.getStatusCodeValue());
loggDebugIfResponseKo(callURI.toString(), response);
return response;
}
-
private ResponseEntity<byte[]> callSdcWithAttachment(URI callURI) {
try {
ResponseEntity<byte[]> response =
restTemplate.exchange(callURI, HttpMethod.GET, buildRequestHeader(), byte[].class);
LOGGER.info("response status : " + response.getStatusCodeValue());
if (LOGGER.isWarnEnabled() && !response.getStatusCode().equals(HttpStatus.OK)) {
- LOGGER.warn("HTTP call SDC on {} returns {} ", callURI.toString() , response.getStatusCodeValue());
+ LOGGER.warn("HTTP call SDC on {} returns {} ", callURI.toString(), response.getStatusCodeValue());
}
return response;
} catch (BackendFunctionalException e) {
- LOGGER.error("HTTP call SDC on {} error : {}", callURI.toString() , e);
+ LOGGER.error("HTTP call SDC on {} error : {}", callURI.toString(), e);
return null;
}
}
-
private void loggDebugIfResponseKo(String callURI, ResponseEntity<Object> response) {
if (LOGGER.isWarnEnabled() && !response.getStatusCode().equals(HttpStatus.OK)) {
- LOGGER.warn("HTTP call SDC on {} returns {} , {}", callURI , response.getStatusCodeValue() , response.getBody().toString());
+ LOGGER.warn("HTTP call SDC on {} returns {} , {}", callURI, response.getStatusCodeValue(),
+ response.getBody().toString());
}
}
}
-
-
diff --git a/src/main/java/org/onap/nbi/apis/servicecatalog/ServiceSpecificationDBManager.java b/src/main/java/org/onap/nbi/apis/servicecatalog/ServiceSpecificationDBManager.java
index 466611d..316c967 100644
--- a/src/main/java/org/onap/nbi/apis/servicecatalog/ServiceSpecificationDBManager.java
+++ b/src/main/java/org/onap/nbi/apis/servicecatalog/ServiceSpecificationDBManager.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.nbi.apis.servicecatalog;
import org.onap.nbi.apis.servicecatalog.model.ServiceSpecification;
@@ -47,7 +48,7 @@ public class ServiceSpecificationDBManager {
serviceSpecification.setCatalogResponse(serviceCatalogResponse);
serviceSpecificationRepository.save(serviceSpecification);
- }
+ }
public boolean checkServiceSpecExistence(String serviceSpecId) {
@@ -56,32 +57,34 @@ public class ServiceSpecificationDBManager {
public Map getServiceSpecification(String serviceSpecId) {
- Optional<ServiceSpecification> optionalServiceSpecification = serviceSpecificationRepository.findById(serviceSpecId);
- if(!optionalServiceSpecification.isPresent()) {
- throw new TechnicalException("Unable get service specification");
- }else {
- return optionalServiceSpecification.get().getCatalogResponse();
- }
+ Optional<ServiceSpecification> optionalServiceSpecification =
+ serviceSpecificationRepository.findById(serviceSpecId);
+ if (!optionalServiceSpecification.isPresent()) {
+ throw new TechnicalException("Unable get service specification");
+ } else {
+ return optionalServiceSpecification.get().getCatalogResponse();
+ }
}
public boolean checkInputSchemaExistence(String serviceSpecId) {
- return specificationInputSchemaRepository.existsById(serviceSpecId);
+ return specificationInputSchemaRepository.existsById(serviceSpecId);
}
public String getInputSchema(String serviceSpecId) {
- Optional<SpecificationInputSchema> optionalSpecificationInputSchema = specificationInputSchemaRepository.findById(serviceSpecId);
- if(!optionalSpecificationInputSchema.isPresent()) {
+ Optional<SpecificationInputSchema> optionalSpecificationInputSchema =
+ specificationInputSchemaRepository.findById(serviceSpecId);
+ if (!optionalSpecificationInputSchema.isPresent()) {
throw new TechnicalException("Unable get specification input schema");
- }else {
- return optionalSpecificationInputSchema.get().getSpecificationSchemaJson();
+ } else {
+ return optionalSpecificationInputSchema.get().getSpecificationSchemaJson();
}
}
public void saveSpecificationInputSchema(String svcCharacteristicsJson, Map serviceCatalogResponse) {
- SpecificationInputSchema specificationInputSchema = new SpecificationInputSchema();
- specificationInputSchema.setId((String) serviceCatalogResponse.get("id"));
- specificationInputSchema.setSpecificationSchemaJson(svcCharacteristicsJson);
- specificationInputSchemaRepository.save(specificationInputSchema);
+ SpecificationInputSchema specificationInputSchema = new SpecificationInputSchema();
+ specificationInputSchema.setId((String) serviceCatalogResponse.get("id"));
+ specificationInputSchema.setSpecificationSchemaJson(svcCharacteristicsJson);
+ specificationInputSchemaRepository.save(specificationInputSchema);
}
}
diff --git a/src/main/java/org/onap/nbi/apis/servicecatalog/ServiceSpecificationResource.java b/src/main/java/org/onap/nbi/apis/servicecatalog/ServiceSpecificationResource.java
index 49b9f08..3651ec8 100644
--- a/src/main/java/org/onap/nbi/apis/servicecatalog/ServiceSpecificationResource.java
+++ b/src/main/java/org/onap/nbi/apis/servicecatalog/ServiceSpecificationResource.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.nbi.apis.servicecatalog;
import java.util.LinkedHashMap;
@@ -35,13 +36,12 @@ import org.springframework.web.bind.annotation.RestController;
@RequestMapping(OnapComponentsUrlPaths.SERVICE_SPECIFICATION_PATH)
public class ServiceSpecificationResource extends ResourceManagement {
-
@Autowired
ServiceSpecificationService serviceSpecificationService;
@GetMapping(value = "/{serviceSpecId}", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Object> getServiceSpecification(@PathVariable String serviceSpecId,
- @RequestParam MultiValueMap<String, String> params) {
+ @RequestParam MultiValueMap<String, String> params) {
Map response = serviceSpecificationService.get(serviceSpecId);
JsonRepresentation filter = new JsonRepresentation(params);
if (response.get("serviceSpecCharacteristic") != null) {
@@ -59,9 +59,9 @@ public class ServiceSpecificationResource extends ResourceManagement {
return this.findResponse(response, filter, null);
}
- @GetMapping(value = "/{serviceSpecId}/specificationInputSchema", produces = MediaType.APPLICATION_JSON_VALUE)
+ @GetMapping(value = "/{serviceSpecId}/specificationInputSchema", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Object> findSpecificationInputSchema(@PathVariable String serviceSpecId,
- @RequestParam MultiValueMap<String,String> params) {
+ @RequestParam MultiValueMap<String, String> params) {
String response = serviceSpecificationService.getInputSchema(serviceSpecId);
JsonRepresentation filter = new JsonRepresentation(params);
return this.getResponse(response, filter);
diff --git a/src/main/java/org/onap/nbi/apis/servicecatalog/ServiceSpecificationService.java b/src/main/java/org/onap/nbi/apis/servicecatalog/ServiceSpecificationService.java
index 8f0829b..9fc0ec0 100644
--- a/src/main/java/org/onap/nbi/apis/servicecatalog/ServiceSpecificationService.java
+++ b/src/main/java/org/onap/nbi/apis/servicecatalog/ServiceSpecificationService.java
@@ -11,6 +11,7 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
+
package org.onap.nbi.apis.servicecatalog;
import java.io.File;
@@ -35,69 +36,69 @@ import org.springframework.util.MultiValueMap;
@Service
public class ServiceSpecificationService {
- @Autowired
- SdcClient sdcClient;
+ @Autowired
+ SdcClient sdcClient;
- @Autowired
- GetServiceSpecJsonTransformer getServiceSpecJsonTransformer;
+ @Autowired
+ GetServiceSpecJsonTransformer getServiceSpecJsonTransformer;
- @Autowired
- FindServiceSpecJsonTransformer findServiceSpecJsonTransformer;
+ @Autowired
+ FindServiceSpecJsonTransformer findServiceSpecJsonTransformer;
- @Autowired
- ToscaInfosProcessor toscaInfosProcessor;
+ @Autowired
+ ToscaInfosProcessor toscaInfosProcessor;
- @Autowired
- private ServiceCatalogUrl serviceCatalogUrl;
+ @Autowired
+ private ServiceCatalogUrl serviceCatalogUrl;
- @Autowired
- ServiceSpecificationDBManager serviceSpecificationDBManager;
+ @Autowired
+ ServiceSpecificationDBManager serviceSpecificationDBManager;
- private static final Logger LOGGER = LoggerFactory.getLogger(ServiceSpecificationService.class);
+ private static final Logger LOGGER = LoggerFactory.getLogger(ServiceSpecificationService.class);
- public Map get(String serviceSpecId) {
- if(serviceSpecificationDBManager.checkServiceSpecExistence(serviceSpecId)) {
- return serviceSpecificationDBManager.getServiceSpecification(serviceSpecId);
- }else {
- Map sdcResponse = sdcClient.callGet(serviceSpecId);
- LinkedHashMap serviceCatalogResponse =
- (LinkedHashMap) getServiceSpecJsonTransformer.transform(sdcResponse);
- String toscaModelUrl = (String) sdcResponse.get("toscaModelURL");
- String serviceId = (String) sdcResponse.get("id");
- File toscaFile = sdcClient.callGetWithAttachment(toscaModelUrl);
- Path pathToToscaCsar = toscaFile.toPath().toAbsolutePath();
- try {
- toscaInfosProcessor.buildAndSaveResponseWithSdcToscaParser(pathToToscaCsar, serviceCatalogResponse);
- serviceSpecificationDBManager.saveCatalogResponse(serviceCatalogResponse);
- } catch (SdcToscaParserException e) {
- LOGGER.debug("unable to build response from tosca csar using sdc-parser, partial response : "
- + pathToToscaCsar.toString() + " " + e.getMessage());
- }
- try {
- if (toscaFile != null) {
- LOGGER.debug("deleting tosca archive : " + toscaFile.getName());
- FileUtils.forceDelete(toscaFile);
+ public Map get(String serviceSpecId) {
+ if (serviceSpecificationDBManager.checkServiceSpecExistence(serviceSpecId)) {
+ return serviceSpecificationDBManager.getServiceSpecification(serviceSpecId);
+ } else {
+ Map sdcResponse = sdcClient.callGet(serviceSpecId);
+ LinkedHashMap serviceCatalogResponse = (LinkedHashMap) getServiceSpecJsonTransformer.transform(sdcResponse);
+ String toscaModelUrl = (String) sdcResponse.get("toscaModelURL");
+ String serviceId = (String) sdcResponse.get("id");
+ File toscaFile = sdcClient.callGetWithAttachment(toscaModelUrl);
+ Path pathToToscaCsar = toscaFile.toPath().toAbsolutePath();
+ try {
+ toscaInfosProcessor.buildAndSaveResponseWithSdcToscaParser(pathToToscaCsar, serviceCatalogResponse);
+ serviceSpecificationDBManager.saveCatalogResponse(serviceCatalogResponse);
+ } catch (SdcToscaParserException e) {
+ LOGGER.debug("unable to build response from tosca csar using sdc-parser, partial response : "
+ + pathToToscaCsar.toString() + " " + e.getMessage());
+ }
+ try {
+ if (toscaFile != null) {
+ LOGGER.debug("deleting tosca archive : " + toscaFile.getName());
+ FileUtils.forceDelete(toscaFile);
+ }
+ } catch (IOException e) {
+ LOGGER.error("unable to delete temp directory tosca file for id : " + serviceId, e);
+ }
+ return serviceCatalogResponse;
}
- } catch (IOException e) {
- LOGGER.error("unable to delete temp directory tosca file for id : " + serviceId, e);
- }
- return serviceCatalogResponse;
}
- }
- public List<LinkedHashMap> find(MultiValueMap<String, String> parametersMap) {
- List<LinkedHashMap> sdcResponse = sdcClient.callFind(parametersMap);
- List<LinkedHashMap> serviceCatalogResponse = new ArrayList<>();
- if (!CollectionUtils.isEmpty(sdcResponse)) {
- serviceCatalogResponse = findServiceSpecJsonTransformer.transform(sdcResponse);
+ public List<LinkedHashMap> find(MultiValueMap<String, String> parametersMap) {
+ List<LinkedHashMap> sdcResponse = sdcClient.callFind(parametersMap);
+ List<LinkedHashMap> serviceCatalogResponse = new ArrayList<>();
+ if (!CollectionUtils.isEmpty(sdcResponse)) {
+ serviceCatalogResponse = findServiceSpecJsonTransformer.transform(sdcResponse);
+ }
+ return serviceCatalogResponse;
}
- return serviceCatalogResponse;
- }
- public String getInputSchema(String serviceSpecId) {
- if(serviceSpecificationDBManager.checkInputSchemaExistence(serviceSpecId)) {
- return serviceSpecificationDBManager.getInputSchema(serviceSpecId);
- } else {
- return null;
+
+ public String getInputSchema(String serviceSpecId) {
+ if (serviceSpecificationDBManager.checkInputSchemaExistence(serviceSpecId)) {
+ return serviceSpecificationDBManager.getInputSchema(serviceSpecId);
+ } else {
+ return null;
+ }
}
- }
}
diff --git a/src/main/java/org/onap/nbi/apis/servicecatalog/ToscaInfosProcessor.java b/src/main/java/org/onap/nbi/apis/servicecatalog/ToscaInfosProcessor.java
index 97bcd9c..14b2541 100644
--- a/src/main/java/org/onap/nbi/apis/servicecatalog/ToscaInfosProcessor.java
+++ b/src/main/java/org/onap/nbi/apis/servicecatalog/ToscaInfosProcessor.java
@@ -11,6 +11,7 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
+
package org.onap.nbi.apis.servicecatalog;
import java.nio.file.Path;
@@ -39,153 +40,150 @@ import io.swagger.util.Json;
@Service
public class ToscaInfosProcessor {
- @Autowired
- SdcClient sdcClient;
-
- @Autowired
- private ServiceSpecificationDBManager serviceSpecificationDBManager;
-
- final ObjectMapper mapper = new ObjectMapper(new YAMLFactory()); // jackson databind
-
- private static final Logger LOGGER = LoggerFactory.getLogger(ToscaInfosProcessor.class);
-
- public void buildResponseWithSdcToscaParser(Path path, Map serviceCatalogResponse)
- throws SdcToscaParserException {
-
- SdcToscaParserFactory factory = SdcToscaParserFactory.getInstance();
- ISdcCsarHelper sdcCsarHelper = factory.getSdcCsarHelper(path.toFile().getAbsolutePath(), false);
- List<Input> inputs = sdcCsarHelper.getServiceInputs();
- if (inputs != null && inputs.size() > 0) {
- ArrayList serviceSpecCharacteristic = new ArrayList();
- for (Input input : inputs) {
- LinkedHashMap mapParameter = new LinkedHashMap();
- mapParameter.put("name", input.getName());
- mapParameter.put("description", input.getDescription());
- mapParameter.put("valueType", input.getType());
- mapParameter.put("@type", "ONAPserviceCharacteristic");
- mapParameter.put("required", input.isRequired());
- mapParameter.put("status", null);
- mapParameter.put("serviceSpecCharacteristicValue", null);
- // If this Input has a default value, then put it in serviceSpecCharacteristicValue
- if (input.getDefault() != null) {
- List<LinkedHashMap> serviceSpecCharacteristicValues =
- buildServiceSpecCharacteristicsValuesFromSdc(input);
- mapParameter.put("serviceSpecCharacteristicValue", serviceSpecCharacteristicValues);
+ @Autowired
+ SdcClient sdcClient;
+
+ @Autowired
+ private ServiceSpecificationDBManager serviceSpecificationDBManager;
+
+ final ObjectMapper mapper = new ObjectMapper(new YAMLFactory()); // jackson databind
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(ToscaInfosProcessor.class);
+
+ public void buildResponseWithSdcToscaParser(Path path, Map serviceCatalogResponse) throws SdcToscaParserException {
+
+ SdcToscaParserFactory factory = SdcToscaParserFactory.getInstance();
+ ISdcCsarHelper sdcCsarHelper = factory.getSdcCsarHelper(path.toFile().getAbsolutePath(), false);
+ List<Input> inputs = sdcCsarHelper.getServiceInputs();
+ if (inputs != null && inputs.size() > 0) {
+ ArrayList serviceSpecCharacteristic = new ArrayList();
+ for (Input input : inputs) {
+ LinkedHashMap mapParameter = new LinkedHashMap();
+ mapParameter.put("name", input.getName());
+ mapParameter.put("description", input.getDescription());
+ mapParameter.put("valueType", input.getType());
+ mapParameter.put("@type", "ONAPserviceCharacteristic");
+ mapParameter.put("required", input.isRequired());
+ mapParameter.put("status", null);
+ mapParameter.put("serviceSpecCharacteristicValue", null);
+ // If this Input has a default value, then put it in serviceSpecCharacteristicValue
+ if (input.getDefault() != null) {
+ List<LinkedHashMap> serviceSpecCharacteristicValues =
+ buildServiceSpecCharacteristicsValuesFromSdc(input);
+ mapParameter.put("serviceSpecCharacteristicValue", serviceSpecCharacteristicValues);
+ }
+ serviceSpecCharacteristic.add(mapParameter);
+ }
+ serviceCatalogResponse.put("serviceSpecCharacteristic", serviceSpecCharacteristic);
}
- serviceSpecCharacteristic.add(mapParameter);
- }
- serviceCatalogResponse.put("serviceSpecCharacteristic", serviceSpecCharacteristic);
- }
- List<NodeTemplate> nodeTemplates = sdcCsarHelper.getServiceNodeTemplates();
-
- List<LinkedHashMap> resourceSpecifications =
- (List<LinkedHashMap>) serviceCatalogResponse.get("resourceSpecification");
- for (LinkedHashMap resourceSpecification : resourceSpecifications) {
- if (resourceSpecification.get("id") != null) {
- String id = (String) resourceSpecification.get("id");
- LOGGER.debug("get tosca infos for service id: {}", id);
- NodeTemplate nodeTemplate = null;
- for (NodeTemplate node : nodeTemplates) {
- if (node.getMetaData().getValue("UUID").equals(id)) {
- nodeTemplate = node;
- break;
- }
+ List<NodeTemplate> nodeTemplates = sdcCsarHelper.getServiceNodeTemplates();
+
+ List<LinkedHashMap> resourceSpecifications =
+ (List<LinkedHashMap>) serviceCatalogResponse.get("resourceSpecification");
+ for (LinkedHashMap resourceSpecification : resourceSpecifications) {
+ if (resourceSpecification.get("id") != null) {
+ String id = (String) resourceSpecification.get("id");
+ LOGGER.debug("get tosca infos for service id: {}", id);
+ NodeTemplate nodeTemplate = null;
+ for (NodeTemplate node : nodeTemplates) {
+ if (node.getMetaData().getValue("UUID").equals(id)) {
+ nodeTemplate = node;
+ break;
+ }
+ }
+ if (nodeTemplate == null)
+ continue;
+ resourceSpecification.put("modelCustomizationId",
+ sdcCsarHelper.getNodeTemplateCustomizationUuid(nodeTemplate));
+ }
}
- if (nodeTemplate == null)
- continue;
- resourceSpecification.put("modelCustomizationId",
- sdcCsarHelper.getNodeTemplateCustomizationUuid(nodeTemplate));
- }
}
- }
- private List<LinkedHashMap> buildServiceSpecCharacteristicsValuesFromSdc(Input input) {
+ private List<LinkedHashMap> buildServiceSpecCharacteristicsValuesFromSdc(Input input) {
+
+ List<LinkedHashMap> serviceSpecCharacteristicValues = new ArrayList<>();
+ LinkedHashMap serviceSpecCharacteristicValue = new LinkedHashMap();
- List<LinkedHashMap> serviceSpecCharacteristicValues = new ArrayList<>();
- LinkedHashMap serviceSpecCharacteristicValue = new LinkedHashMap();
+ serviceSpecCharacteristicValue.put("isDefault", true);
+ serviceSpecCharacteristicValue.put("value", input.getDefault());
+ serviceSpecCharacteristicValue.put("valueType", input.getType());
+ serviceSpecCharacteristicValues.add(serviceSpecCharacteristicValue);
- serviceSpecCharacteristicValue.put("isDefault", true);
- serviceSpecCharacteristicValue.put("value", input.getDefault());
- serviceSpecCharacteristicValue.put("valueType", input.getType());
- serviceSpecCharacteristicValues.add(serviceSpecCharacteristicValue);
+ return serviceSpecCharacteristicValues;
+ }
- return serviceSpecCharacteristicValues;
- }
+ public void buildAndSaveResponseWithSdcToscaParser(Path path, Map serviceCatalogResponse)
+ throws SdcToscaParserException {
- public void buildAndSaveResponseWithSdcToscaParser(Path path, Map serviceCatalogResponse)
- throws SdcToscaParserException {
+ SdcToscaParserFactory factory = SdcToscaParserFactory.getInstance();
+ ISdcCsarHelper sdcCsarHelper = factory.getSdcCsarHelper(path.toFile().getAbsolutePath(), false);
+ List<Input> inputs = sdcCsarHelper.getServiceInputs();
- SdcToscaParserFactory factory = SdcToscaParserFactory.getInstance();
- ISdcCsarHelper sdcCsarHelper = factory.getSdcCsarHelper(path.toFile().getAbsolutePath(), false);
- List<Input> inputs = sdcCsarHelper.getServiceInputs();
+ Map<String, Model> definitions = new HashMap<String, Model>();
+ Model model = new ModelImpl();
- Map<String, Model> definitions = new HashMap<String, Model>();
- Model model = new ModelImpl();
+ if (inputs != null && inputs.size() > 0) {
+ for (Input input : inputs) {
+ Property property = null;
+ if (input.getType().equals("list") || input.getType().equals("map"))
+ property = PropertyBuilder.build("array", null, null);
+ else
+ property = PropertyBuilder.build(input.getType(), null, null);
- if (inputs != null && inputs.size() > 0) {
- for (Input input : inputs) {
- Property property = null;
- if (input.getType().equals("list") || input.getType().equals("map"))
- property = PropertyBuilder.build("array", null, null);
- else
- property = PropertyBuilder.build(input.getType(), null, null);
+ property.setDescription(input.getDescription());
+ property.setRequired(input.isRequired());
- property.setDescription(input.getDescription());
- property.setRequired(input.isRequired());
+ if (input.getDefault() != null) {
+ property.setDefault(input.getDefault().toString());
+ }
+ ((ModelImpl) model).addProperty(input.getName(), property);
+ }
+ definitions.put("ServiceCharacteristics", model);
- if (input.getDefault() != null) {
- property.setDefault(input.getDefault().toString());
}
- ((ModelImpl) model).addProperty(input.getName(), property);
- }
- definitions.put("ServiceCharacteristics", model);
-
- }
- String svcCharacteristicsJson = Json.pretty(definitions);
- serviceSpecificationDBManager.saveSpecificationInputSchema(svcCharacteristicsJson,
- serviceCatalogResponse);
-
- LinkedHashMap inputSchemaRef = new LinkedHashMap();
- // use object to match examples in Specifications
- inputSchemaRef.put("valueType", "object");
- inputSchemaRef.put("@schemaLocation",
- "/serviceSpecification/" + serviceCatalogResponse.get("id") + "/specificationInputSchema");
- inputSchemaRef.put("@type", serviceCatalogResponse.get("name") + "_ServiceCharacteristic");
-
- LinkedHashMap serviceSpecCharacteristic = new LinkedHashMap();
- serviceSpecCharacteristic.put("name",
- serviceCatalogResponse.get("name") + "_ServiceCharacteristics");
- serviceSpecCharacteristic.put("description",
- "This object describes all the inputs needed from the client to interact with the "
- + serviceCatalogResponse.get("name") + " Service Topology");
- serviceSpecCharacteristic.put("valueType", "object");
- serviceSpecCharacteristic.put("@type", "ONAPServiceCharacteristic");
- serviceSpecCharacteristic.put("@schemaLocation", "null");
- serviceSpecCharacteristic.put("serviceSpecCharacteristicValue", inputSchemaRef);
-
- serviceCatalogResponse.put("serviceSpecCharacteristic", serviceSpecCharacteristic);
-
- List<NodeTemplate> nodeTemplates = sdcCsarHelper.getServiceNodeTemplates();
- List<LinkedHashMap> resourceSpecifications =
- (List<LinkedHashMap>) serviceCatalogResponse.get("resourceSpecification");
- for (LinkedHashMap resourceSpecification : resourceSpecifications) {
- if (resourceSpecification.get("id") != null) {
- String id = (String) resourceSpecification.get("id");
- LOGGER.debug("get tosca infos for service id: {}", id);
- NodeTemplate nodeTemplate = null;
- for (NodeTemplate node : nodeTemplates) {
- if (node.getMetaData().getValue("UUID").equals(id)) {
- nodeTemplate = node;
- break;
- }
+ String svcCharacteristicsJson = Json.pretty(definitions);
+ serviceSpecificationDBManager.saveSpecificationInputSchema(svcCharacteristicsJson, serviceCatalogResponse);
+
+ LinkedHashMap inputSchemaRef = new LinkedHashMap();
+ // use object to match examples in Specifications
+ inputSchemaRef.put("valueType", "object");
+ inputSchemaRef.put("@schemaLocation",
+ "/serviceSpecification/" + serviceCatalogResponse.get("id") + "/specificationInputSchema");
+ inputSchemaRef.put("@type", serviceCatalogResponse.get("name") + "_ServiceCharacteristic");
+
+ LinkedHashMap serviceSpecCharacteristic = new LinkedHashMap();
+ serviceSpecCharacteristic.put("name", serviceCatalogResponse.get("name") + "_ServiceCharacteristics");
+ serviceSpecCharacteristic.put("description",
+ "This object describes all the inputs needed from the client to interact with the "
+ + serviceCatalogResponse.get("name") + " Service Topology");
+ serviceSpecCharacteristic.put("valueType", "object");
+ serviceSpecCharacteristic.put("@type", "ONAPServiceCharacteristic");
+ serviceSpecCharacteristic.put("@schemaLocation", "null");
+ serviceSpecCharacteristic.put("serviceSpecCharacteristicValue", inputSchemaRef);
+
+ serviceCatalogResponse.put("serviceSpecCharacteristic", serviceSpecCharacteristic);
+
+ List<NodeTemplate> nodeTemplates = sdcCsarHelper.getServiceNodeTemplates();
+ List<LinkedHashMap> resourceSpecifications =
+ (List<LinkedHashMap>) serviceCatalogResponse.get("resourceSpecification");
+ for (LinkedHashMap resourceSpecification : resourceSpecifications) {
+ if (resourceSpecification.get("id") != null) {
+ String id = (String) resourceSpecification.get("id");
+ LOGGER.debug("get tosca infos for service id: {}", id);
+ NodeTemplate nodeTemplate = null;
+ for (NodeTemplate node : nodeTemplates) {
+ if (node.getMetaData().getValue("UUID").equals(id)) {
+ nodeTemplate = node;
+ break;
+ }
+ }
+ if (nodeTemplate == null)
+ continue;
+ resourceSpecification.put("modelCustomizationId",
+ sdcCsarHelper.getNodeTemplateCustomizationUuid(nodeTemplate));
+ }
}
- if (nodeTemplate == null)
- continue;
- resourceSpecification.put("modelCustomizationId",
- sdcCsarHelper.getNodeTemplateCustomizationUuid(nodeTemplate));
- }
}
- }
}
diff --git a/src/main/java/org/onap/nbi/apis/servicecatalog/jolt/FindServiceSpecJsonTransformer.java b/src/main/java/org/onap/nbi/apis/servicecatalog/jolt/FindServiceSpecJsonTransformer.java
index 9ec59ea..2aecc3a 100644
--- a/src/main/java/org/onap/nbi/apis/servicecatalog/jolt/FindServiceSpecJsonTransformer.java
+++ b/src/main/java/org/onap/nbi/apis/servicecatalog/jolt/FindServiceSpecJsonTransformer.java
@@ -11,6 +11,7 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
+
package org.onap.nbi.apis.servicecatalog.jolt;
import com.bazaarvoice.jolt.Chainr;
@@ -37,7 +38,7 @@ public class FindServiceSpecJsonTransformer {
public List<LinkedHashMap> transform(Object serviceSpec) {
try {
- return (List<LinkedHashMap>)chainr.transform(serviceSpec);
+ return (List<LinkedHashMap>) chainr.transform(serviceSpec);
} catch (JoltException joE) {
LOGGER.error("Unable to transform SDC response with JOLT Transformer", joE);
throw new TechnicalException("Error while parsing ONAP response");
diff --git a/src/main/java/org/onap/nbi/apis/servicecatalog/jolt/GetServiceSpecJsonTransformer.java b/src/main/java/org/onap/nbi/apis/servicecatalog/jolt/GetServiceSpecJsonTransformer.java
index 2032e52..cf80f42 100644
--- a/src/main/java/org/onap/nbi/apis/servicecatalog/jolt/GetServiceSpecJsonTransformer.java
+++ b/src/main/java/org/onap/nbi/apis/servicecatalog/jolt/GetServiceSpecJsonTransformer.java
@@ -11,6 +11,7 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
+
package org.onap.nbi.apis.servicecatalog.jolt;
import java.util.List;
@@ -29,7 +30,6 @@ public class GetServiceSpecJsonTransformer {
private static final Logger LOGGER = LoggerFactory.getLogger(GetServiceSpecJsonTransformer.class);
-
public GetServiceSpecJsonTransformer() {
List<Object> specs = JsonUtils.classpathToList("/jolt/getServiceCatalog.json");
this.chainr = Chainr.fromSpec(specs);
diff --git a/src/main/java/org/onap/nbi/apis/servicecatalog/model/ServiceSpecification.java b/src/main/java/org/onap/nbi/apis/servicecatalog/model/ServiceSpecification.java
index c88cc65..7f7c23f 100644
--- a/src/main/java/org/onap/nbi/apis/servicecatalog/model/ServiceSpecification.java
+++ b/src/main/java/org/onap/nbi/apis/servicecatalog/model/ServiceSpecification.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.nbi.apis.servicecatalog.model;
import com.fasterxml.jackson.annotation.JsonProperty;
diff --git a/src/main/java/org/onap/nbi/apis/servicecatalog/model/SpecificationInputSchema.java b/src/main/java/org/onap/nbi/apis/servicecatalog/model/SpecificationInputSchema.java
index e4e85d7..0fc61e2 100644
--- a/src/main/java/org/onap/nbi/apis/servicecatalog/model/SpecificationInputSchema.java
+++ b/src/main/java/org/onap/nbi/apis/servicecatalog/model/SpecificationInputSchema.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.nbi.apis.servicecatalog.model;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -22,33 +23,33 @@ import org.onap.nbi.commons.Resource;
import org.springframework.data.annotation.Id;
@ApiModel
- public class SpecificationInputSchema implements Resource {
-
-
- @Id
- @JsonProperty("id")
- private String id = null;
-
- @JsonProperty("schema")
- private String specificationSchemaJson = null;
-
- @Override
- @JsonProperty("id")
- @ApiModelProperty(required = true, value = "uuid for the specification input schema")
- public String getId() {
- return id;
- }
- public void setId(String id) {
- this.id = id;
- }
-
- @JsonProperty("schema")
- @ApiModelProperty(required = true, value = "Input schema for the service")
- public String getSpecificationSchemaJson() {
- return specificationSchemaJson;
- }
-
- public void setSpecificationSchemaJson(String specificationSchemaJson) {
- this.specificationSchemaJson = specificationSchemaJson;
- }
+public class SpecificationInputSchema implements Resource {
+
+ @Id
+ @JsonProperty("id")
+ private String id = null;
+
+ @JsonProperty("schema")
+ private String specificationSchemaJson = null;
+
+ @Override
+ @JsonProperty("id")
+ @ApiModelProperty(required = true, value = "uuid for the specification input schema")
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ @JsonProperty("schema")
+ @ApiModelProperty(required = true, value = "Input schema for the service")
+ public String getSpecificationSchemaJson() {
+ return specificationSchemaJson;
+ }
+
+ public void setSpecificationSchemaJson(String specificationSchemaJson) {
+ this.specificationSchemaJson = specificationSchemaJson;
+ }
}
diff --git a/src/main/java/org/onap/nbi/apis/servicecatalog/repositories/ServiceSpecificationRepository.java b/src/main/java/org/onap/nbi/apis/servicecatalog/repositories/ServiceSpecificationRepository.java
index f46e008..f652b0d 100644
--- a/src/main/java/org/onap/nbi/apis/servicecatalog/repositories/ServiceSpecificationRepository.java
+++ b/src/main/java/org/onap/nbi/apis/servicecatalog/repositories/ServiceSpecificationRepository.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.nbi.apis.servicecatalog.repositories;
import org.onap.nbi.apis.servicecatalog.model.ServiceSpecification;
diff --git a/src/main/java/org/onap/nbi/apis/servicecatalog/repositories/SpecificationInputSchemaRepository.java b/src/main/java/org/onap/nbi/apis/servicecatalog/repositories/SpecificationInputSchemaRepository.java
index 56adbd3..b850e25 100644
--- a/src/main/java/org/onap/nbi/apis/servicecatalog/repositories/SpecificationInputSchemaRepository.java
+++ b/src/main/java/org/onap/nbi/apis/servicecatalog/repositories/SpecificationInputSchemaRepository.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.nbi.apis.servicecatalog.repositories;
import org.onap.nbi.apis.servicecatalog.model.SpecificationInputSchema;
@@ -20,5 +21,4 @@ import org.springframework.data.mongodb.repository.MongoRepository;
public interface SpecificationInputSchemaRepository extends MongoRepository<SpecificationInputSchema, String> {
-
}
diff --git a/src/main/java/org/onap/nbi/apis/serviceinventory/AaiClient.java b/src/main/java/org/onap/nbi/apis/serviceinventory/AaiClient.java
index 0becb02..8682d84 100644
--- a/src/main/java/org/onap/nbi/apis/serviceinventory/AaiClient.java
+++ b/src/main/java/org/onap/nbi/apis/serviceinventory/AaiClient.java
@@ -10,6 +10,7 @@
* 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.nbi.apis.serviceinventory;
import java.util.LinkedHashMap;
@@ -48,26 +49,23 @@ public class AaiClient extends BaseClient {
private static final Logger LOGGER = LoggerFactory.getLogger(AaiClient.class);
private static final String X_TRANSACTION_ID = "X-TransactionId";
-
private String aaiServiceUrl;
private String aaiServiceCustomerUrl;
private String aaiServicesUrl;
private String aaiServicesInstancesUrl;
private String aaiHealthCheckUrl;
-
@PostConstruct
private void setUpAndlogAAIUrl() {
- aaiServiceUrl = new StringBuilder().append(aaiHost)
- .append(OnapComponentsUrlPaths.AAI_GET_SERVICE).toString();
- aaiServiceCustomerUrl = new StringBuilder().append(aaiHost)
- .append(OnapComponentsUrlPaths.AAI_GET_SERVICE_CUSTOMER).toString();
+ aaiServiceUrl = new StringBuilder().append(aaiHost).append(OnapComponentsUrlPaths.AAI_GET_SERVICE).toString();
+ aaiServiceCustomerUrl =
+ new StringBuilder().append(aaiHost).append(OnapComponentsUrlPaths.AAI_GET_SERVICE_CUSTOMER).toString();
aaiServicesUrl = new StringBuilder().append(aaiHost)
- .append(OnapComponentsUrlPaths.AAI_GET_SERVICES_FOR_CUSTOMER_PATH).toString();
+ .append(OnapComponentsUrlPaths.AAI_GET_SERVICES_FOR_CUSTOMER_PATH).toString();
aaiServicesInstancesUrl = new StringBuilder().append(aaiHost)
- .append(OnapComponentsUrlPaths.AAI_GET_SERVICE_INSTANCES_PATH).toString();
- aaiHealthCheckUrl = new StringBuilder().append(aaiHost)
- .append(OnapComponentsUrlPaths.AAI_HEALTH_CHECK).toString();
+ .append(OnapComponentsUrlPaths.AAI_GET_SERVICE_INSTANCES_PATH).toString();
+ aaiHealthCheckUrl =
+ new StringBuilder().append(aaiHost).append(OnapComponentsUrlPaths.AAI_HEALTH_CHECK).toString();
LOGGER.info("AAI service url : " + aaiServiceUrl);
LOGGER.info("AAI services url : " + aaiServicesUrl);
@@ -76,7 +74,6 @@ public class AaiClient extends BaseClient {
}
-
private HttpHeaders buildRequestHeaderForAAI() {
HttpHeaders httpHeaders = new HttpHeaders();
diff --git a/src/main/java/org/onap/nbi/apis/serviceinventory/BaseClient.java b/src/main/java/org/onap/nbi/apis/serviceinventory/BaseClient.java
index adae4ec..1a72a29 100644
--- a/src/main/java/org/onap/nbi/apis/serviceinventory/BaseClient.java
+++ b/src/main/java/org/onap/nbi/apis/serviceinventory/BaseClient.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.nbi.apis.serviceinventory;
import org.slf4j.Logger;
@@ -30,51 +31,47 @@ public abstract class BaseClient {
private static final Logger LOGGER = LoggerFactory.getLogger(BaseClient.class);
-
@Autowired
private RestTemplate restTemplate;
-
-
protected ResponseEntity<Object> callApiGet(String callURL, HttpHeaders httpHeaders) {
-
- if(LOGGER.isDebugEnabled()){
- LOGGER.debug("log request : "+callURL+ " "+httpHeaders);
+ if (LOGGER.isDebugEnabled()) {
+ LOGGER.debug("log request : " + callURL + " " + httpHeaders);
}
ResponseEntity<Object> response = null;
- response = restTemplate.exchange(callURL, HttpMethod.GET,
- new HttpEntity<>("parameters", httpHeaders), Object.class);
+ response = restTemplate.exchange(callURL, HttpMethod.GET, new HttpEntity<>("parameters", httpHeaders),
+ Object.class);
- if(LOGGER.isDebugEnabled()){
- LOGGER.debug("response body : {}",response.getBody().toString());
+ if (LOGGER.isDebugEnabled()) {
+ LOGGER.debug("response body : {}", response.getBody().toString());
}
LOGGER.info("response status : {}", response.getStatusCodeValue());
if (LOGGER.isWarnEnabled() && !response.getStatusCode().equals(HttpStatus.OK)) {
- LOGGER.warn("HTTP call on {} returns {}, {}", callURL , response.getStatusCodeValue() ,response.getBody().toString());
+ LOGGER.warn("HTTP call on {} returns {}, {}", callURL, response.getStatusCodeValue(),
+ response.getBody().toString());
}
return response;
}
-
protected ResponseEntity<String> callApiGetHealthCheck(String callURL, HttpHeaders httpHeaders) {
-
- if(LOGGER.isDebugEnabled()){
- LOGGER.debug("log request : "+callURL+ " "+httpHeaders);
+ if (LOGGER.isDebugEnabled()) {
+ LOGGER.debug("log request : " + callURL + " " + httpHeaders);
}
ResponseEntity<String> response = null;
- response = restTemplate.exchange(callURL, HttpMethod.GET,
- new HttpEntity<>("parameters", httpHeaders), String.class);
+ response = restTemplate.exchange(callURL, HttpMethod.GET, new HttpEntity<>("parameters", httpHeaders),
+ String.class);
- if(LOGGER.isDebugEnabled()){
- LOGGER.debug("response body : {}",response.getBody().toString());
+ if (LOGGER.isDebugEnabled()) {
+ LOGGER.debug("response body : {}", response.getBody().toString());
}
LOGGER.info("response status : {}", response.getStatusCodeValue());
if (LOGGER.isWarnEnabled() && !response.getStatusCode().equals(HttpStatus.OK)) {
- LOGGER.warn("HTTP call on {} returns {}, {}", callURL , response.getStatusCodeValue() ,response.getBody().toString());
+ LOGGER.warn("HTTP call on {} returns {}, {}", callURL, response.getStatusCodeValue(),
+ response.getBody().toString());
}
return response;
}
diff --git a/src/main/java/org/onap/nbi/apis/serviceinventory/NbiClient.java b/src/main/java/org/onap/nbi/apis/serviceinventory/NbiClient.java
index 7da073d..52f19cc 100644
--- a/src/main/java/org/onap/nbi/apis/serviceinventory/NbiClient.java
+++ b/src/main/java/org/onap/nbi/apis/serviceinventory/NbiClient.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.nbi.apis.serviceinventory;
import java.util.LinkedHashMap;
diff --git a/src/main/java/org/onap/nbi/apis/serviceinventory/ServiceInventoryResource.java b/src/main/java/org/onap/nbi/apis/serviceinventory/ServiceInventoryResource.java
index eda6f96..19ffac5 100644
--- a/src/main/java/org/onap/nbi/apis/serviceinventory/ServiceInventoryResource.java
+++ b/src/main/java/org/onap/nbi/apis/serviceinventory/ServiceInventoryResource.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.nbi.apis.serviceinventory;
import java.util.LinkedHashMap;
@@ -58,5 +59,4 @@ public class ServiceInventoryResource extends ResourceManagement {
}
-
}
diff --git a/src/main/java/org/onap/nbi/apis/serviceinventory/ServiceInventoryService.java b/src/main/java/org/onap/nbi/apis/serviceinventory/ServiceInventoryService.java
index 4abc3e8..7936d37 100644
--- a/src/main/java/org/onap/nbi/apis/serviceinventory/ServiceInventoryService.java
+++ b/src/main/java/org/onap/nbi/apis/serviceinventory/ServiceInventoryService.java
@@ -11,6 +11,7 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
+
package org.onap.nbi.apis.serviceinventory;
import java.util.ArrayList;
@@ -32,182 +33,169 @@ import org.springframework.util.StringUtils;
@Service
public class ServiceInventoryService {
- @Autowired
- NbiClient nbiClient;
+ @Autowired
+ NbiClient nbiClient;
- @Autowired
- AaiClient aaiClient;
+ @Autowired
+ AaiClient aaiClient;
- @Autowired
- GetServiceInventoryJsonTransformer getServiceInventoryJsonTransformer;
+ @Autowired
+ GetServiceInventoryJsonTransformer getServiceInventoryJsonTransformer;
- @Autowired
- FindServiceInventoryJsonTransformer findServiceInventoryJsonTransformer;
+ @Autowired
+ FindServiceInventoryJsonTransformer findServiceInventoryJsonTransformer;
- private static final Logger LOGGER = LoggerFactory.getLogger(ServiceInventoryService.class);
+ private static final Logger LOGGER = LoggerFactory.getLogger(ServiceInventoryService.class);
+ public Map get(String serviceId, MultiValueMap<String, String> params) {
- public Map get(String serviceId, MultiValueMap<String, String> params) {
+ Map serviceResponse = aaiClient.getService(serviceId);
+ if (serviceResponse != null) {
+ addVnfsToResponse(serviceResponse);
+ LinkedHashMap serviceInventoryResponse =
+ (LinkedHashMap) getServiceInventoryJsonTransformer.transform(serviceResponse);
+ addrelatedPartyIdIdandSpecName(serviceId, serviceInventoryResponse);
+ String href = "service/" + serviceId;
+ serviceInventoryResponse.put("href", href);
+ return serviceInventoryResponse;
+ } else {
+ throw new BackendFunctionalException(HttpStatus.NOT_FOUND, "no catalog service found",
+ "no catalog service found");
+ }
- Map serviceResponse = aaiClient.getService(serviceId);
- if (serviceResponse != null) {
- addVnfsToResponse(serviceResponse);
- LinkedHashMap serviceInventoryResponse =
- (LinkedHashMap) getServiceInventoryJsonTransformer.transform(serviceResponse);
- addrelatedPartyIdIdandSpecName(serviceId, serviceInventoryResponse);
- String href = "service/" + serviceId;
- serviceInventoryResponse.put("href", href );
- return serviceInventoryResponse;
- } else {
- throw new BackendFunctionalException(HttpStatus.NOT_FOUND, "no catalog service found",
- "no catalog service found");
}
- }
+ private String getCustomerId(String clientId) {
+ if (StringUtils.isEmpty(clientId)) {
+ return "generic";
+ } else {
+ return clientId;
+ }
- private String getCustomerId(String clientId) {
-
- if (StringUtils.isEmpty(clientId)) {
- return "generic";
- } else {
- return clientId;
}
- }
+ private String getServiceName(String serviceSpecificationName, String serviceSpecificationId) {
- private String getServiceName(String serviceSpecificationName, String serviceSpecificationId) {
+ if (StringUtils.isEmpty(serviceSpecificationName)) {
+ Map serviceSpecification = nbiClient.getServiceSpecification(serviceSpecificationId);
+ return (String) serviceSpecification.get("name");
+ } else {
+ return serviceSpecificationName;
+ }
- if (StringUtils.isEmpty(serviceSpecificationName)) {
- Map serviceSpecification = nbiClient.getServiceSpecification(serviceSpecificationId);
- return (String) serviceSpecification.get("name");
- } else {
- return serviceSpecificationName;
}
- }
-
- private void addrelatedPartyIdIdandSpecName(String serviceId,
- LinkedHashMap serviceInventoryResponse) {
-
- String customerId;
- String serviceSpecName;
- LinkedHashMap relatedParty = (LinkedHashMap) serviceInventoryResponse.get("relatedParty");
- LinkedHashMap serviceSpecification =
- (LinkedHashMap) serviceInventoryResponse.get("serviceSpecification");
- Map servicecustomerResponse = aaiClient.getServiceCustomer(serviceId);
- if (servicecustomerResponse != null) {
- List<LinkedHashMap> serviceCustomerResults =
- (List<LinkedHashMap>) servicecustomerResponse.get("results");
-
- if (!CollectionUtils.isEmpty(serviceCustomerResults)) {
- for (LinkedHashMap serviceCustomerResult : serviceCustomerResults) {
- String url = (String) serviceCustomerResult.get("url");
- String[] pathObjects = url.split("/");
- customerId = pathObjects[6];
- serviceSpecName = pathObjects[9];
- relatedParty.put("id", customerId);
- serviceSpecification.put("name", serviceSpecName);
+ private void addrelatedPartyIdIdandSpecName(String serviceId, LinkedHashMap serviceInventoryResponse) {
+
+ String customerId;
+ String serviceSpecName;
+ LinkedHashMap relatedParty = (LinkedHashMap) serviceInventoryResponse.get("relatedParty");
+ LinkedHashMap serviceSpecification = (LinkedHashMap) serviceInventoryResponse.get("serviceSpecification");
+ Map servicecustomerResponse = aaiClient.getServiceCustomer(serviceId);
+ if (servicecustomerResponse != null) {
+ List<LinkedHashMap> serviceCustomerResults = (List<LinkedHashMap>) servicecustomerResponse.get("results");
+
+ if (!CollectionUtils.isEmpty(serviceCustomerResults)) {
+ for (LinkedHashMap serviceCustomerResult : serviceCustomerResults) {
+ String url = (String) serviceCustomerResult.get("url");
+ String[] pathObjects = url.split("/");
+ customerId = pathObjects[6];
+ serviceSpecName = pathObjects[9];
+ relatedParty.put("id", customerId);
+ serviceSpecification.put("name", serviceSpecName);
+ }
+ } else {
+ LOGGER.warn("no service instance found for serviceId {}", serviceId);
+ }
+ } else {
+ LOGGER.warn("no service instance found for serviceId {}", serviceId);
}
- } else {
- LOGGER.warn("no service instance found for serviceId {}", serviceId);
- }
- } else {
- LOGGER.warn("no service instance found for serviceId {}", serviceId);
}
- }
-
- private void addVnfsToResponse(Map serviceResponse) {
-
- List<Map> vnfs = new ArrayList<>();
- LinkedHashMap relationShip = (LinkedHashMap) serviceResponse.get("relationship-list");
- if (relationShip != null) {
- List<LinkedHashMap> relationsList = (List<LinkedHashMap>) relationShip.get("relationship");
- if (relationsList != null) {
- for (LinkedHashMap relation : relationsList) {
- String relatedLink = (String) relation.get("related-link");
- Map vnf = aaiClient.getVNF(relatedLink);
- if (vnf != null) {
- vnfs.add(vnf);
- }
+
+ private void addVnfsToResponse(Map serviceResponse) {
+
+ List<Map> vnfs = new ArrayList<>();
+ LinkedHashMap relationShip = (LinkedHashMap) serviceResponse.get("relationship-list");
+ if (relationShip != null) {
+ List<LinkedHashMap> relationsList = (List<LinkedHashMap>) relationShip.get("relationship");
+ if (relationsList != null) {
+ for (LinkedHashMap relation : relationsList) {
+ String relatedLink = (String) relation.get("related-link");
+ Map vnf = aaiClient.getVNF(relatedLink);
+ if (vnf != null) {
+ vnfs.add(vnf);
+ }
+ }
+ serviceResponse.put("vnfs", vnfs);
+ }
}
- serviceResponse.put("vnfs", vnfs);
- }
- }
- }
-
-
- public List<LinkedHashMap> find(MultiValueMap<String, String> params) {
-
- String clientId = params.getFirst("relatedParty.id");
- String serviceSpecId = params.getFirst("serviceSpecification.id");
- String serviceSpecName = params.getFirst("serviceSpecification.name");
- String customerId = getCustomerId(clientId);
- String serviceName;
- List<LinkedHashMap> serviceInstances = new ArrayList<>();
- if (StringUtils.isEmpty(serviceSpecId) && StringUtils.isEmpty(serviceSpecName)) {
- handleFindWithNoServiceParam(customerId, serviceInstances);
- } else {
- serviceName = getServiceName(serviceSpecName, serviceSpecId);
- buildServiceInstances(serviceInstances, customerId, serviceName);
}
- List<LinkedHashMap> serviceInventoryResponse = new ArrayList<>();
- if (!CollectionUtils.isEmpty(serviceInstances)) {
- serviceInventoryResponse = findServiceInventoryJsonTransformer.transform(serviceInstances);
- for (LinkedHashMap serviceInventory : serviceInventoryResponse) {
- String href = "service/" + serviceInventory.get("id");
- serviceInventory.put("href", href);
- LinkedHashMap party = (LinkedHashMap) serviceInventory.get("relatedParty");
- party.put("id", customerId);
- }
- } else {
- LOGGER.warn("no service instance found for customer {} ", customerId);
- }
- return serviceInventoryResponse;
-
-
- }
-
- private void handleFindWithNoServiceParam(String customerId,
- List<LinkedHashMap> serviceInstances) {
- Map servicesInAaiForCustomer = aaiClient.getServicesInAaiForCustomer(customerId);
- if (servicesInAaiForCustomer != null) {
- List<LinkedHashMap> servicesInAAI =
- (List<LinkedHashMap>) servicesInAaiForCustomer.get("service-subscription");
- for (LinkedHashMap service : servicesInAAI) {
- String serviceType = (String) service.get("service-type");
- buildServiceInstances(serviceInstances, customerId, serviceType);
- }
- } else {
- LOGGER.warn("no service instance found for customer {} ", customerId);
- }
- }
- private void buildServiceInstances(List<LinkedHashMap> serviceInstances, String customerId,
- String serviceType) {
+ public List<LinkedHashMap> find(MultiValueMap<String, String> params) {
+
+ String clientId = params.getFirst("relatedParty.id");
+ String serviceSpecId = params.getFirst("serviceSpecification.id");
+ String serviceSpecName = params.getFirst("serviceSpecification.name");
+ String customerId = getCustomerId(clientId);
+ String serviceName;
+ List<LinkedHashMap> serviceInstances = new ArrayList<>();
+ if (StringUtils.isEmpty(serviceSpecId) && StringUtils.isEmpty(serviceSpecName)) {
+ handleFindWithNoServiceParam(customerId, serviceInstances);
+ } else {
+ serviceName = getServiceName(serviceSpecName, serviceSpecId);
+ buildServiceInstances(serviceInstances, customerId, serviceName);
+ }
+ List<LinkedHashMap> serviceInventoryResponse = new ArrayList<>();
+ if (!CollectionUtils.isEmpty(serviceInstances)) {
+ serviceInventoryResponse = findServiceInventoryJsonTransformer.transform(serviceInstances);
+ for (LinkedHashMap serviceInventory : serviceInventoryResponse) {
+ String href = "service/" + serviceInventory.get("id");
+ serviceInventory.put("href", href);
+ LinkedHashMap party = (LinkedHashMap) serviceInventory.get("relatedParty");
+ party.put("id", customerId);
+ }
+ } else {
+ LOGGER.warn("no service instance found for customer {} ", customerId);
+ }
+ return serviceInventoryResponse;
- Map serviceInstancesInAaiForCustomer =
- aaiClient.getServiceInstancesInAaiForCustomer(customerId, serviceType);
- if (serviceInstancesInAaiForCustomer != null) {
- List<LinkedHashMap> serviceInstancesForServiceType =
- (List<LinkedHashMap>) serviceInstancesInAaiForCustomer.get("service-instance");
+ }
- if (!CollectionUtils.isEmpty(serviceInstancesForServiceType)) {
- // add service type for jolt
- for (LinkedHashMap serviceInstanceForServiceType : serviceInstancesForServiceType) {
- serviceInstanceForServiceType.put("service-type", serviceType);
+ private void handleFindWithNoServiceParam(String customerId, List<LinkedHashMap> serviceInstances) {
+ Map servicesInAaiForCustomer = aaiClient.getServicesInAaiForCustomer(customerId);
+ if (servicesInAaiForCustomer != null) {
+ List<LinkedHashMap> servicesInAAI =
+ (List<LinkedHashMap>) servicesInAaiForCustomer.get("service-subscription");
+ for (LinkedHashMap service : servicesInAAI) {
+ String serviceType = (String) service.get("service-type");
+ buildServiceInstances(serviceInstances, customerId, serviceType);
+ }
+ } else {
+ LOGGER.warn("no service instance found for customer {} ", customerId);
}
- serviceInstances.addAll(serviceInstancesForServiceType);
- } else {
- LOGGER.warn("no service instance found for customer {} and service type {}", customerId,
- serviceType);
- }
- } else {
- LOGGER.warn("no service instance found for customer {} and service type {}", customerId,
- serviceType);
}
+ private void buildServiceInstances(List<LinkedHashMap> serviceInstances, String customerId, String serviceType) {
+
+ Map serviceInstancesInAaiForCustomer = aaiClient.getServiceInstancesInAaiForCustomer(customerId, serviceType);
+ if (serviceInstancesInAaiForCustomer != null) {
+ List<LinkedHashMap> serviceInstancesForServiceType =
+ (List<LinkedHashMap>) serviceInstancesInAaiForCustomer.get("service-instance");
+
+ if (!CollectionUtils.isEmpty(serviceInstancesForServiceType)) {
+ // add service type for jolt
+ for (LinkedHashMap serviceInstanceForServiceType : serviceInstancesForServiceType) {
+ serviceInstanceForServiceType.put("service-type", serviceType);
+ }
+ serviceInstances.addAll(serviceInstancesForServiceType);
+ } else {
+ LOGGER.warn("no service instance found for customer {} and service type {}", customerId, serviceType);
+ }
+ } else {
+ LOGGER.warn("no service instance found for customer {} and service type {}", customerId, serviceType);
+ }
- }
+ }
}
diff --git a/src/main/java/org/onap/nbi/apis/serviceinventory/jolt/FindServiceInventoryJsonTransformer.java b/src/main/java/org/onap/nbi/apis/serviceinventory/jolt/FindServiceInventoryJsonTransformer.java
index 70fe0c8..122dffe 100644
--- a/src/main/java/org/onap/nbi/apis/serviceinventory/jolt/FindServiceInventoryJsonTransformer.java
+++ b/src/main/java/org/onap/nbi/apis/serviceinventory/jolt/FindServiceInventoryJsonTransformer.java
@@ -11,6 +11,7 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
+
package org.onap.nbi.apis.serviceinventory.jolt;
import com.bazaarvoice.jolt.Chainr;
@@ -37,7 +38,7 @@ public class FindServiceInventoryJsonTransformer {
public List<LinkedHashMap> transform(List<LinkedHashMap> serviceSpec) {
try {
- return (List<LinkedHashMap>)chainr.transform(serviceSpec);
+ return (List<LinkedHashMap>) chainr.transform(serviceSpec);
} catch (JoltException joE) {
LOGGER.error("Unable to transform SDC response with JOLT Transformer", joE);
throw new TechnicalException("Error while parsing ONAP response");
diff --git a/src/main/java/org/onap/nbi/apis/serviceinventory/jolt/GetServiceInventoryJsonTransformer.java b/src/main/java/org/onap/nbi/apis/serviceinventory/jolt/GetServiceInventoryJsonTransformer.java
index b1d2566..09acd54 100644
--- a/src/main/java/org/onap/nbi/apis/serviceinventory/jolt/GetServiceInventoryJsonTransformer.java
+++ b/src/main/java/org/onap/nbi/apis/serviceinventory/jolt/GetServiceInventoryJsonTransformer.java
@@ -11,6 +11,7 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
+
package org.onap.nbi.apis.serviceinventory.jolt;
import java.util.List;
@@ -29,7 +30,6 @@ public class GetServiceInventoryJsonTransformer {
private static final Logger LOGGER = LoggerFactory.getLogger(GetServiceInventoryJsonTransformer.class);
-
public GetServiceInventoryJsonTransformer() {
List<Object> specs = JsonUtils.classpathToList("/jolt/getServiceInventory.json");
this.chainr = Chainr.fromSpec(specs);
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/MultiClient.java b/src/main/java/org/onap/nbi/apis/serviceorder/MultiClient.java
index 6a38fbc..9729202 100644
--- a/src/main/java/org/onap/nbi/apis/serviceorder/MultiClient.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/MultiClient.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.nbi.apis.serviceorder;
import java.net.URI;
@@ -59,7 +60,6 @@ public class MultiClient {
@Value("${aai.header.transaction.id}")
private String aaiTransactionId;
-
@Value("${onap.lcpCloudRegionId}")
private String lcpCloudRegionId;
@@ -84,21 +84,20 @@ public class MultiClient {
@Autowired
private ServiceOrderService serviceOrderService;
-
private static final String HEADER_AUTHORIZATION = "Authorization";
private static final String X_FROM_APP_ID = "X-FromAppId";
private static final String X_TRANSACTION_ID = "X-TransactionId";
private static final Logger LOGGER = LoggerFactory.getLogger(MultiClient.class);
- public Map getServiceCatalog(String id,ServiceOrder serviceOrder, ServiceOrderItem serviceOrderItem){
+ public Map getServiceCatalog(String id, ServiceOrder serviceOrder, ServiceOrderItem serviceOrderItem) {
StringBuilder callURL = new StringBuilder().append(serviceCatalogUrl.getServiceCatalogUrl()).append(id);
ResponseEntity<Object> response = callApiGet(callURL.toString(), new HttpHeaders(), null);
- if(response.getStatusCode().equals(HttpStatus.INTERNAL_SERVER_ERROR)) {
+ if (response.getStatusCode().equals(HttpStatus.INTERNAL_SERVER_ERROR)) {
serviceOrderService.addOrderMessage(serviceOrder, "500");
LOGGER.warn("unable to retrieve catalog information for service {}",
- serviceOrderItem.getService().getServiceSpecification().getId());
+ serviceOrderItem.getService().getServiceSpecification().getId());
}
if (response.getStatusCode().is2xxSuccessful()) {
return (LinkedHashMap) response.getBody();
@@ -107,21 +106,21 @@ public class MultiClient {
}
- public boolean doesServiceExistInServiceInventory(String id, String serviceName, String globalSubscriberId, ServiceOrder serviceOrder) {
+ public boolean doesServiceExistInServiceInventory(String id, String serviceName, String globalSubscriberId,
+ ServiceOrder serviceOrder) {
StringBuilder callURL = new StringBuilder().append(serviceInventoryUrl.getServiceInventoryUrl()).append(id);
Map<String, String> param = new HashMap<>();
param.put("serviceSpecification.name", serviceName);
param.put("relatedParty.id", globalSubscriberId);
ResponseEntity<Object> response = callApiGet(callURL.toString(), new HttpHeaders(), param);
- if(response.getStatusCode().equals(HttpStatus.INTERNAL_SERVER_ERROR)) {
+ if (response.getStatusCode().equals(HttpStatus.INTERNAL_SERVER_ERROR)) {
serviceOrderService.addOrderMessage(serviceOrder, "501");
return false;
}
return response.getStatusCode().equals(HttpStatus.OK);
}
-
private HttpHeaders buildRequestHeaderForAAI() {
HttpHeaders httpHeaders = new HttpHeaders();
httpHeaders.add(HEADER_AUTHORIZATION, aaiHeaderAuthorization);
@@ -133,7 +132,6 @@ public class MultiClient {
return httpHeaders;
}
-
public boolean isTenantIdPresentInAAI(ServiceOrder serviceOrder) {
StringBuilder callURL = new StringBuilder().append(aaiHost).append(OnapComponentsUrlPaths.AAI_GET_TENANTS_PATH);
String callUrlFormated = callURL.toString().replace("$onap.lcpCloudRegionId", lcpCloudRegionId);
@@ -154,9 +152,9 @@ public class MultiClient {
return false;
}
-
public String getOwningEntityIdInAAI(ServiceOrder serviceOrder) {
- StringBuilder callURL = new StringBuilder().append(aaiHost).append(OnapComponentsUrlPaths.AAI_GET_OWNING_ENTITIES);
+ StringBuilder callURL =
+ new StringBuilder().append(aaiHost).append(OnapComponentsUrlPaths.AAI_GET_OWNING_ENTITIES);
String callUrlFormated = callURL.toString();
ResponseEntity<Object> response = callApiGet(callUrlFormated, buildRequestHeaderForAAI(), null);
@@ -174,38 +172,32 @@ public class MultiClient {
return null;
}
-
- public boolean isCustomerPresentInAAI(String customerId,
- ServiceOrder serviceOrder) {
+ public boolean isCustomerPresentInAAI(String customerId, ServiceOrder serviceOrder) {
StringBuilder callURL = new StringBuilder().append(aaiHost).append(OnapComponentsUrlPaths.AAI_GET_CUSTOMER_PATH)
.append(customerId);
ResponseEntity<Object> response = callApiGet(callURL.toString(), buildRequestHeaderForAAI(), null);
- if(response.getStatusCode().equals(HttpStatus.INTERNAL_SERVER_ERROR)) {
+ if (response.getStatusCode().equals(HttpStatus.INTERNAL_SERVER_ERROR)) {
serviceOrderService.addOrderMessage(serviceOrder, "501");
return false;
}
return response.getStatusCode().equals(HttpStatus.OK);
}
-
public boolean putOwningEntity(ServiceOrder serviceOrder) {
Map<String, String> param = new HashMap<>();
param.put("owning-entity-id", owningEntityId);
param.put("owning-entity-name", owningEntityName);
- String callURL =
- aaiHost + OnapComponentsUrlPaths.AAI_PUT_OWNING_ENTITIES;
+ String callURL = aaiHost + OnapComponentsUrlPaths.AAI_PUT_OWNING_ENTITIES;
String callUrlFormated = callURL.replace("$onap.owning.entity.id", owningEntityId);
ResponseEntity<Object> response = putRequest(param, callUrlFormated, buildRequestHeaderForAAI());
- if(response.getStatusCode().equals(HttpStatus.INTERNAL_SERVER_ERROR)) {
+ if (response.getStatusCode().equals(HttpStatus.INTERNAL_SERVER_ERROR)) {
serviceOrderService.addOrderMessage(serviceOrder, "501");
return false;
}
return response.getStatusCode().equals(HttpStatus.CREATED);
}
-
- public boolean putCustomer(SubscriberInfo subscriberInfo,
- ServiceOrder serviceOrder) {
+ public boolean putCustomer(SubscriberInfo subscriberInfo, ServiceOrder serviceOrder) {
Map<String, String> param = new HashMap<>();
param.put("global-customer-id", subscriberInfo.getGlobalSubscriberId());
param.put("subscriber-name", subscriberInfo.getSubscriberName());
@@ -214,58 +206,54 @@ public class MultiClient {
aaiHost + OnapComponentsUrlPaths.AAI_GET_CUSTOMER_PATH + subscriberInfo.getGlobalSubscriberId();
ResponseEntity<Object> response = putRequest(param, callURL, buildRequestHeaderForAAI());
- if(response.getStatusCode().equals(HttpStatus.INTERNAL_SERVER_ERROR)) {
+ if (response.getStatusCode().equals(HttpStatus.INTERNAL_SERVER_ERROR)) {
serviceOrderService.addOrderMessage(serviceOrder, "501");
return false;
}
return response.getStatusCode().equals(HttpStatus.CREATED);
}
-
- public Map getServicesInAaiForCustomer(String customerId,
- ServiceOrder serviceOrder) {
+ public Map getServicesInAaiForCustomer(String customerId, ServiceOrder serviceOrder) {
StringBuilder callURL =
new StringBuilder().append(aaiHost).append(OnapComponentsUrlPaths.AAI_GET_SERVICES_FOR_CUSTOMER_PATH);
String callUrlFormated = callURL.toString().replace("$customerId", customerId);
ResponseEntity<Object> response = callApiGet(callUrlFormated, buildRequestHeaderForAAI(), null);
- if(response.getStatusCode().equals(HttpStatus.INTERNAL_SERVER_ERROR)) {
+ if (response.getStatusCode().equals(HttpStatus.INTERNAL_SERVER_ERROR)) {
serviceOrderService.addOrderMessage(serviceOrder, "501");
return null;
- }
- else if (response.getStatusCode().is2xxSuccessful()) {
+ } else if (response.getStatusCode().is2xxSuccessful()) {
return (LinkedHashMap) response.getBody();
}
return null;
}
- public boolean putServiceType(String globalSubscriberId, String serviceName,
- ServiceOrder serviceOrder) {
+ public boolean putServiceType(String globalSubscriberId, String serviceName, ServiceOrder serviceOrder) {
Map<String, String> param = new HashMap<>();
param.put("service-type", serviceName);
String callURL = aaiHost + OnapComponentsUrlPaths.AAI_PUT_SERVICE_FOR_CUSTOMER_PATH + serviceName;
String callUrlFormated = callURL.replace("$customerId", globalSubscriberId);
- ResponseEntity<Object> response = putRequest(param, callUrlFormated, buildRequestHeaderForAAI());
- if(response.getStatusCode().equals(HttpStatus.INTERNAL_SERVER_ERROR)) {
+ ResponseEntity<Object> response = putRequest(param, callUrlFormated, buildRequestHeaderForAAI());
+ if (response.getStatusCode().equals(HttpStatus.INTERNAL_SERVER_ERROR)) {
serviceOrderService.addOrderMessage(serviceOrder, "501");
}
return response.getStatusCode().is2xxSuccessful();
}
-
- private ResponseEntity<Object> putRequest(Map<String, String> param, String callUrl, HttpHeaders httpHeaders) {
+ private ResponseEntity<Object> putRequest(Map<String, String> param, String callUrl, HttpHeaders httpHeaders) {
try {
ResponseEntity<Object> response =
restTemplate.exchange(callUrl, HttpMethod.PUT, new HttpEntity<>(param, httpHeaders), Object.class);
LOGGER.info("response status : " + response.getStatusCodeValue());
if (LOGGER.isWarnEnabled() && !response.getStatusCode().equals(HttpStatus.CREATED)) {
- LOGGER.warn("HTTP call on {} returns {} , {}", callUrl , response.getStatusCodeValue(), response.getBody().toString());
+ LOGGER.warn("HTTP call on {} returns {} , {}", callUrl, response.getStatusCodeValue(),
+ response.getBody().toString());
}
return response;
} catch (BackendFunctionalException e) {
LOGGER.error("error on calling " + callUrl + " ," + e);
return new ResponseEntity<>("problem calling onap services", e.getHttpStatus());
- }catch (ResourceAccessException e) {
+ } catch (ResourceAccessException e) {
LOGGER.error("error on calling " + callUrl + " ," + e);
return new ResponseEntity<>("unable to reach onap services", HttpStatus.INTERNAL_SERVER_ERROR);
}
@@ -283,12 +271,13 @@ public class MultiClient {
URI uri = builder.build().encode().toUri();
ResponseEntity<Object> response =
restTemplate.exchange(uri, HttpMethod.GET, new HttpEntity<>(httpHeaders), Object.class);
- if(LOGGER.isDebugEnabled()){
+ if (LOGGER.isDebugEnabled()) {
LOGGER.debug("response body : {}", response.getBody().toString());
}
LOGGER.info("response status : {}", response.getStatusCodeValue());
if (LOGGER.isWarnEnabled() && !response.getStatusCode().equals(HttpStatus.OK)) {
- LOGGER.warn("HTTP call on {} returns {} , {}", callURL , response.getStatusCodeValue(), response.getBody().toString());
+ LOGGER.warn("HTTP call on {} returns {} , {}", callURL, response.getStatusCodeValue(),
+ response.getBody().toString());
}
return response;
@@ -296,12 +285,11 @@ public class MultiClient {
} catch (BackendFunctionalException e) {
LOGGER.error("error on calling " + callURL + " ," + e);
return new ResponseEntity<>("problem calling onap services", e.getHttpStatus());
- }catch (ResourceAccessException e) {
+ } catch (ResourceAccessException e) {
LOGGER.error("error on calling " + callURL + " ," + e);
return new ResponseEntity<>("unable to reach onap services", HttpStatus.INTERNAL_SERVER_ERROR);
}
}
-
-} \ No newline at end of file
+}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/ServiceCatalogUrl.java b/src/main/java/org/onap/nbi/apis/serviceorder/ServiceCatalogUrl.java
index 9831b67..069b491 100644
--- a/src/main/java/org/onap/nbi/apis/serviceorder/ServiceCatalogUrl.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/ServiceCatalogUrl.java
@@ -13,8 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.onap.nbi.apis.serviceorder;
+package org.onap.nbi.apis.serviceorder;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
@@ -22,7 +22,6 @@ import org.springframework.stereotype.Service;
@Service
public class ServiceCatalogUrl {
-
@Value("${nbi.url}")
private String nbiUrl;
@@ -32,5 +31,4 @@ public class ServiceCatalogUrl {
}
-
}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/ServiceInventoryUrl.java b/src/main/java/org/onap/nbi/apis/serviceorder/ServiceInventoryUrl.java
index 69b8f42..d057da7 100644
--- a/src/main/java/org/onap/nbi/apis/serviceorder/ServiceInventoryUrl.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/ServiceInventoryUrl.java
@@ -13,8 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.onap.nbi.apis.serviceorder;
+package org.onap.nbi.apis.serviceorder;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
@@ -25,12 +25,10 @@ public class ServiceInventoryUrl {
@Value("${nbi.url}")
private String nbiUrl;
-
public String getServiceInventoryUrl() {
return new StringBuilder().append(nbiUrl).append("/service/").toString();
}
-
}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/ServiceOrderResource.java b/src/main/java/org/onap/nbi/apis/serviceorder/ServiceOrderResource.java
index c48965a..2f0717d 100644
--- a/src/main/java/org/onap/nbi/apis/serviceorder/ServiceOrderResource.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/ServiceOrderResource.java
@@ -10,6 +10,7 @@
* 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.nbi.apis.serviceorder;
import java.util.List;
@@ -80,10 +81,10 @@ public class ServiceOrderResource extends ResourceManagement {
@Autowired
EWInterfaceUtils eWInterfaceUtils;
-
@GetMapping(value = "/{serviceOrderId}", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Object> getServiceOrder(@PathVariable String serviceOrderId,
- @RequestParam MultiValueMap<String, String> params,@RequestHeader(value="Target",required = false)String targetUrl) {
+ @RequestParam MultiValueMap<String, String> params,
+ @RequestHeader(value = "Target", required = false) String targetUrl) {
if (targetUrl != null) {
targetUrl = targetUrl + OnapComponentsUrlPaths.SERVICE_ORDER_PATH + "/" + serviceOrderId;
return eWInterfaceUtils.callGetRequestTarget(targetUrl);
@@ -124,7 +125,8 @@ public class ServiceOrderResource extends ResourceManagement {
@PostMapping(consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Object> createServiceOrder(@Valid @RequestBody ServiceOrder serviceOrder, Errors errors,
- @RequestParam MultiValueMap<String, String> params, @RequestHeader(value="Target",required = false)String targetUrl) {
+ @RequestParam MultiValueMap<String, String> params,
+ @RequestHeader(value = "Target", required = false) String targetUrl) {
if (targetUrl != null) {
targetUrl = targetUrl + OnapComponentsUrlPaths.SERVICE_ORDER_PATH;
return eWInterfaceUtils.callPostRequestTarget(serviceOrder, targetUrl);
@@ -140,10 +142,9 @@ public class ServiceOrderResource extends ResourceManagement {
}
-
@PutMapping(value = "/test/{serviceOrderId}", consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Object> checkServiceOrderRessource(@PathVariable String serviceOrderId,
- @RequestParam MultiValueMap<String, String> params) {
+ @RequestParam MultiValueMap<String, String> params) {
Optional<ServiceOrder> optionalServiceOrder = serviceOrderService.findServiceOrderById(serviceOrderId);
if (!optionalServiceOrder.isPresent()) {
return ResponseEntity.notFound().build();
@@ -153,7 +154,6 @@ public class ServiceOrderResource extends ResourceManagement {
return this.createResponse(serviceOrder, filter);
}
-
public ServiceOrder checkServiceOrder(ServiceOrder serviceOrder) {
ServiceOrderInfo serviceOrderInfo = checkOrderConsistenceManager.checkServiceOrder(serviceOrder);
if (serviceOrderInfo.isServiceOrderRejected()) {
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/SoClient.java b/src/main/java/org/onap/nbi/apis/serviceorder/SoClient.java
index 6800626..e92f2c3 100644
--- a/src/main/java/org/onap/nbi/apis/serviceorder/SoClient.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/SoClient.java
@@ -11,6 +11,7 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
+
package org.onap.nbi.apis.serviceorder;
import javax.annotation.PostConstruct;
@@ -41,303 +42,290 @@ import org.springframework.web.client.RestTemplate;
@Service
public class SoClient {
- public static final String RESPONSE_STATUS = "response status : ";
- public static final String RETURNS = " returns ";
- public static final String ERROR_ON_CALLING = "error on calling ";
- @Autowired
- private RestTemplate restTemplate;
-
- @Value("${so.host}")
- private String soHostname;
-
- @Value("${so.onap.partner.name}")
- private String soOnapPartnerName;
-
- @Value("${so.header.authorization}")
- private String soHeaderAuthorization;
-
- private static final String HEADER_AUTHORIZATION = "Authorization";
- private static final String X_ONAP_PARTNER_HEADER = "X-ONAP-PartnerName";
-
- private static final Logger LOGGER = LoggerFactory.getLogger(SoClient.class);
-
- private String createSoUrl;
- private String createE2ESoUrl;
- private String getSoStatus;
- private String getE2ESoStatus;
- private String deleteE2ESoUrl;
- private String deleteSoUrl;
- private String SoHealthCheck;
-
-
- @PostConstruct
- private void setUpAndLogSOUrl() {
- createSoUrl = new StringBuilder().append(soHostname)
- .append(OnapComponentsUrlPaths.MSO_CREATE_SERVICE_INSTANCE_PATH).toString();
- createE2ESoUrl = new StringBuilder().append(soHostname)
- .append(OnapComponentsUrlPaths.MSO_CREATE_E2ESERVICE_INSTANCE_PATH).toString();
- deleteSoUrl = new StringBuilder().append(soHostname)
- .append(OnapComponentsUrlPaths.MSO_DELETE_REQUEST_STATUS_PATH).toString();
- deleteE2ESoUrl = new StringBuilder().append(soHostname)
- .append(OnapComponentsUrlPaths.MSO_DELETE_E2ESERVICE_INSTANCE_PATH).toString();
- getSoStatus = new StringBuilder().append(soHostname)
- .append(OnapComponentsUrlPaths.MSO_GET_REQUEST_STATUS_PATH).toString();
- getE2ESoStatus = new StringBuilder().append(soHostname)
- .append(OnapComponentsUrlPaths.MSO_GET_E2EREQUEST_STATUS_PATH).toString();
- SoHealthCheck = new StringBuilder().append(soHostname)
- .append(OnapComponentsUrlPaths.MSO_HEALTH_CHECK).toString();
-
- LOGGER.info("SO create service url : " + createSoUrl);
- LOGGER.info("SO create e2e service url : " + createE2ESoUrl);
- LOGGER.info("SO delete service url : " + deleteSoUrl);
- LOGGER.info("SO delete e2e service url : " + deleteE2ESoUrl);
- LOGGER.info("SO get so status url : " + getSoStatus);
- LOGGER.info("SO get e2e so status url : " + getE2ESoStatus);
- LOGGER.info("SO healthCheck : " + SoHealthCheck);
-
- }
-
-
- public ResponseEntity<CreateServiceInstanceResponse> callCreateServiceInstance(
- MSOPayload msoPayload) {
-
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("Calling SO CreateServiceInstance with msoPayload : " + msoPayload.toString());
- }
+ public static final String RESPONSE_STATUS = "response status : ";
+ public static final String RETURNS = " returns ";
+ public static final String ERROR_ON_CALLING = "error on calling ";
+ @Autowired
+ private RestTemplate restTemplate;
+
+ @Value("${so.host}")
+ private String soHostname;
+
+ @Value("${so.onap.partner.name}")
+ private String soOnapPartnerName;
+
+ @Value("${so.header.authorization}")
+ private String soHeaderAuthorization;
+
+ private static final String HEADER_AUTHORIZATION = "Authorization";
+ private static final String X_ONAP_PARTNER_HEADER = "X-ONAP-PartnerName";
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(SoClient.class);
+
+ private String createSoUrl;
+ private String createE2ESoUrl;
+ private String getSoStatus;
+ private String getE2ESoStatus;
+ private String deleteE2ESoUrl;
+ private String deleteSoUrl;
+ private String SoHealthCheck;
+
+ @PostConstruct
+ private void setUpAndLogSOUrl() {
+ createSoUrl = new StringBuilder().append(soHostname)
+ .append(OnapComponentsUrlPaths.MSO_CREATE_SERVICE_INSTANCE_PATH).toString();
+ createE2ESoUrl = new StringBuilder().append(soHostname)
+ .append(OnapComponentsUrlPaths.MSO_CREATE_E2ESERVICE_INSTANCE_PATH).toString();
+ deleteSoUrl = new StringBuilder().append(soHostname)
+ .append(OnapComponentsUrlPaths.MSO_DELETE_REQUEST_STATUS_PATH).toString();
+ deleteE2ESoUrl = new StringBuilder().append(soHostname)
+ .append(OnapComponentsUrlPaths.MSO_DELETE_E2ESERVICE_INSTANCE_PATH).toString();
+ getSoStatus = new StringBuilder().append(soHostname).append(OnapComponentsUrlPaths.MSO_GET_REQUEST_STATUS_PATH)
+ .toString();
+ getE2ESoStatus = new StringBuilder().append(soHostname)
+ .append(OnapComponentsUrlPaths.MSO_GET_E2EREQUEST_STATUS_PATH).toString();
+ SoHealthCheck =
+ new StringBuilder().append(soHostname).append(OnapComponentsUrlPaths.MSO_HEALTH_CHECK).toString();
+
+ LOGGER.info("SO create service url : " + createSoUrl);
+ LOGGER.info("SO create e2e service url : " + createE2ESoUrl);
+ LOGGER.info("SO delete service url : " + deleteSoUrl);
+ LOGGER.info("SO delete e2e service url : " + deleteE2ESoUrl);
+ LOGGER.info("SO get so status url : " + getSoStatus);
+ LOGGER.info("SO get e2e so status url : " + getE2ESoStatus);
+ LOGGER.info("SO healthCheck : " + SoHealthCheck);
- try {
- ResponseEntity<CreateServiceInstanceResponse> response = restTemplate.exchange(createSoUrl,
- HttpMethod.POST, new HttpEntity<>(msoPayload, buildRequestHeader()),
- CreateServiceInstanceResponse.class);
-
- logResponsePost(createSoUrl, response);
- return response;
-
- } catch (BackendFunctionalException e) {
- LOGGER.error(
- ERROR_ON_CALLING + createSoUrl + " ," + e.getHttpStatus() + " , " + e.getBodyResponse());
- return new ResponseEntity(e.getBodyResponse(), e.getHttpStatus());
- } catch (ResourceAccessException e) {
- LOGGER.error(ERROR_ON_CALLING + createSoUrl + " ," + e.getMessage());
- return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
}
- }
- public ResponseEntity<CreateE2EServiceInstanceResponse> callE2ECreateServiceInstance(
- MSOE2EPayload msoPayloadE2E) {
+ public ResponseEntity<CreateServiceInstanceResponse> callCreateServiceInstance(MSOPayload msoPayload) {
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug(
- "Calling SO CreateServiceInstanceE2E with msoPayload : " + msoPayloadE2E.toString());
- }
+ if (LOGGER.isDebugEnabled()) {
+ LOGGER.debug("Calling SO CreateServiceInstance with msoPayload : " + msoPayload.toString());
+ }
- try {
- ResponseEntity<CreateE2EServiceInstanceResponse> response = restTemplate.exchange(
- createE2ESoUrl, HttpMethod.POST, new HttpEntity<>(msoPayloadE2E, buildRequestHeader()),
- CreateE2EServiceInstanceResponse.class);
-
- logE2EResponsePost(createE2ESoUrl, response);
- return response;
-
- } catch (BackendFunctionalException e) {
- LOGGER.error(
- ERROR_ON_CALLING + createSoUrl + " ," + e.getHttpStatus() + " , " + e.getBodyResponse());
- return new ResponseEntity(e.getBodyResponse(), e.getHttpStatus());
- } catch (ResourceAccessException e) {
- LOGGER.error(ERROR_ON_CALLING + createE2ESoUrl + " ," + e.getMessage());
- return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
- }
- }
+ try {
+ ResponseEntity<CreateServiceInstanceResponse> response = restTemplate.exchange(createSoUrl, HttpMethod.POST,
+ new HttpEntity<>(msoPayload, buildRequestHeader()), CreateServiceInstanceResponse.class);
- public ResponseEntity<CreateServiceInstanceResponse> callDeleteServiceInstance(
- MSOPayload msoPayload, String serviceId) {
+ logResponsePost(createSoUrl, response);
+ return response;
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("Calling SO DeleteServiceInstance with msoPayload : " + msoPayload.toString());
+ } catch (BackendFunctionalException e) {
+ LOGGER.error(ERROR_ON_CALLING + createSoUrl + " ," + e.getHttpStatus() + " , " + e.getBodyResponse());
+ return new ResponseEntity(e.getBodyResponse(), e.getHttpStatus());
+ } catch (ResourceAccessException e) {
+ LOGGER.error(ERROR_ON_CALLING + createSoUrl + " ," + e.getMessage());
+ return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
+ }
}
- String url = deleteSoUrl + serviceId;
+ public ResponseEntity<CreateE2EServiceInstanceResponse> callE2ECreateServiceInstance(MSOE2EPayload msoPayloadE2E) {
- try {
- ResponseEntity<CreateServiceInstanceResponse> response = restTemplate.exchange(url,
- HttpMethod.DELETE, new HttpEntity<>(msoPayload, buildRequestHeader()),
- CreateServiceInstanceResponse.class);
+ if (LOGGER.isDebugEnabled()) {
+ LOGGER.debug("Calling SO CreateServiceInstanceE2E with msoPayload : " + msoPayloadE2E.toString());
+ }
- logResponsePost(url, response);
- return response;
+ try {
+ ResponseEntity<CreateE2EServiceInstanceResponse> response = restTemplate.exchange(createE2ESoUrl,
+ HttpMethod.POST, new HttpEntity<>(msoPayloadE2E, buildRequestHeader()),
+ CreateE2EServiceInstanceResponse.class);
- } catch (BackendFunctionalException e) {
- LOGGER.error(ERROR_ON_CALLING + url + " ," + e);
- return new ResponseEntity<>(e.getHttpStatus());
- } catch (ResourceAccessException e) {
- LOGGER.error(ERROR_ON_CALLING + url + " ," + e);
- return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
+ logE2EResponsePost(createE2ESoUrl, response);
+ return response;
+
+ } catch (BackendFunctionalException e) {
+ LOGGER.error(ERROR_ON_CALLING + createSoUrl + " ," + e.getHttpStatus() + " , " + e.getBodyResponse());
+ return new ResponseEntity(e.getBodyResponse(), e.getHttpStatus());
+ } catch (ResourceAccessException e) {
+ LOGGER.error(ERROR_ON_CALLING + createE2ESoUrl + " ," + e.getMessage());
+ return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
+ }
}
- }
+ public ResponseEntity<CreateServiceInstanceResponse> callDeleteServiceInstance(MSOPayload msoPayload,
+ String serviceId) {
- public ResponseEntity<CreateE2EServiceInstanceResponse> callE2EDeleteServiceInstance(
- String globalSubscriberId, String serviceType, String serviceInstanceId) {
+ if (LOGGER.isDebugEnabled()) {
+ LOGGER.debug("Calling SO DeleteServiceInstance with msoPayload : " + msoPayload.toString());
+ }
- String url = deleteE2ESoUrl + serviceInstanceId;
- MSODeleteE2EPayload msoDeleteE2EPayload = new MSODeleteE2EPayload();
- msoDeleteE2EPayload.setGlobalSubscriberId(globalSubscriberId);
- msoDeleteE2EPayload.setServiceType(serviceType);
+ String url = deleteSoUrl + serviceId;
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("Calling SO DeleteE2EServiceInstance with url : " + url
- + " MSODeleteE2EPayload : " + msoDeleteE2EPayload.toString());
- }
+ try {
+ ResponseEntity<CreateServiceInstanceResponse> response = restTemplate.exchange(url, HttpMethod.DELETE,
+ new HttpEntity<>(msoPayload, buildRequestHeader()), CreateServiceInstanceResponse.class);
- try {
- ResponseEntity<DeleteE2EServiceInstanceResponse> deleteresponse = restTemplate.exchange(url,
- HttpMethod.DELETE, new HttpEntity<>(msoDeleteE2EPayload, buildRequestHeader()),
- DeleteE2EServiceInstanceResponse.class);
-
- // For E2E Services , Create and Delete Service responses are different, to maintain
- // consistentcy with ServiceInstances
- // Copy contents of DeleteE2EServiceInstanceResponse to CreateE2EServiceInstanceResponse
- CreateE2EServiceInstanceResponse dummyresponse = new CreateE2EServiceInstanceResponse();
- ServiceResponse serviceResponse = new ServiceResponse();
- dummyresponse.setService(serviceResponse);
- dummyresponse.getService().setOperationId(deleteresponse.getBody().getOperationId());
- dummyresponse.getService().setServiceId(serviceInstanceId);
-
- ResponseEntity<CreateE2EServiceInstanceResponse> response =
- new ResponseEntity(dummyresponse, deleteresponse.getStatusCode());
- logE2EResponsePost(url, response);
- return response;
-
- } catch (BackendFunctionalException e) {
- LOGGER.error(ERROR_ON_CALLING + url + " ," + e);
- return new ResponseEntity<>(e.getHttpStatus());
- } catch (ResourceAccessException e) {
- LOGGER.error(ERROR_ON_CALLING + url + " ," + e);
- return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
- }
- }
+ logResponsePost(url, response);
+ return response;
+
+ } catch (BackendFunctionalException e) {
+ LOGGER.error(ERROR_ON_CALLING + url + " ," + e);
+ return new ResponseEntity<>(e.getHttpStatus());
+ } catch (ResourceAccessException e) {
+ LOGGER.error(ERROR_ON_CALLING + url + " ," + e);
+ return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
+ }
- private void logResponsePost(String url, ResponseEntity<CreateServiceInstanceResponse> response) {
- LOGGER.info(RESPONSE_STATUS + response.getStatusCodeValue());
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("response body : {}", response.getBody().toString());
}
- if (LOGGER.isWarnEnabled() && !response.getStatusCode().equals(HttpStatus.CREATED)) {
- LOGGER.warn("HTTP call SO on {} returns {} , {}", url, response.getStatusCodeValue(),
- response.getBody().toString());
+ public ResponseEntity<CreateE2EServiceInstanceResponse> callE2EDeleteServiceInstance(String globalSubscriberId,
+ String serviceType, String serviceInstanceId) {
+
+ String url = deleteE2ESoUrl + serviceInstanceId;
+ MSODeleteE2EPayload msoDeleteE2EPayload = new MSODeleteE2EPayload();
+ msoDeleteE2EPayload.setGlobalSubscriberId(globalSubscriberId);
+ msoDeleteE2EPayload.setServiceType(serviceType);
+
+ if (LOGGER.isDebugEnabled()) {
+ LOGGER.debug("Calling SO DeleteE2EServiceInstance with url : " + url + " MSODeleteE2EPayload : "
+ + msoDeleteE2EPayload.toString());
+ }
+
+ try {
+ ResponseEntity<DeleteE2EServiceInstanceResponse> deleteresponse = restTemplate.exchange(url,
+ HttpMethod.DELETE, new HttpEntity<>(msoDeleteE2EPayload, buildRequestHeader()),
+ DeleteE2EServiceInstanceResponse.class);
+
+ // For E2E Services , Create and Delete Service responses are different, to maintain
+ // consistentcy with ServiceInstances
+ // Copy contents of DeleteE2EServiceInstanceResponse to CreateE2EServiceInstanceResponse
+ CreateE2EServiceInstanceResponse dummyresponse = new CreateE2EServiceInstanceResponse();
+ ServiceResponse serviceResponse = new ServiceResponse();
+ dummyresponse.setService(serviceResponse);
+ dummyresponse.getService().setOperationId(deleteresponse.getBody().getOperationId());
+ dummyresponse.getService().setServiceId(serviceInstanceId);
+
+ ResponseEntity<CreateE2EServiceInstanceResponse> response =
+ new ResponseEntity(dummyresponse, deleteresponse.getStatusCode());
+ logE2EResponsePost(url, response);
+ return response;
+
+ } catch (BackendFunctionalException e) {
+ LOGGER.error(ERROR_ON_CALLING + url + " ," + e);
+ return new ResponseEntity<>(e.getHttpStatus());
+ } catch (ResourceAccessException e) {
+ LOGGER.error(ERROR_ON_CALLING + url + " ," + e);
+ return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
+ }
}
- }
- private void logE2EResponsePost(String url,
- ResponseEntity<CreateE2EServiceInstanceResponse> response) {
- LOGGER.info(RESPONSE_STATUS + response.getStatusCodeValue());
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("response body : {}", response.getBody().toString());
+ private void logResponsePost(String url, ResponseEntity<CreateServiceInstanceResponse> response) {
+ LOGGER.info(RESPONSE_STATUS + response.getStatusCodeValue());
+ if (LOGGER.isDebugEnabled()) {
+ LOGGER.debug("response body : {}", response.getBody().toString());
+ }
+
+ if (LOGGER.isWarnEnabled() && !response.getStatusCode().equals(HttpStatus.CREATED)) {
+ LOGGER.warn("HTTP call SO on {} returns {} , {}", url, response.getStatusCodeValue(),
+ response.getBody().toString());
+ }
}
- if (LOGGER.isWarnEnabled() && !response.getStatusCode().equals(HttpStatus.CREATED)) {
- LOGGER.warn("HTTP call SO on {} returns {} , {}", url, response.getStatusCodeValue(),
- response.getBody().toString());
+ private void logE2EResponsePost(String url, ResponseEntity<CreateE2EServiceInstanceResponse> response) {
+ LOGGER.info(RESPONSE_STATUS + response.getStatusCodeValue());
+ if (LOGGER.isDebugEnabled()) {
+ LOGGER.debug("response body : {}", response.getBody().toString());
+ }
+
+ if (LOGGER.isWarnEnabled() && !response.getStatusCode().equals(HttpStatus.CREATED)) {
+ LOGGER.warn("HTTP call SO on {} returns {} , {}", url, response.getStatusCodeValue(),
+ response.getBody().toString());
+ }
}
- }
- public GetRequestStatusResponse callGetRequestStatus(String requestId) {
- String url = getSoStatus + requestId;
+ public GetRequestStatusResponse callGetRequestStatus(String requestId) {
+ String url = getSoStatus + requestId;
- try {
+ try {
- ResponseEntity<GetRequestStatusResponse> response = restTemplate.exchange(url, HttpMethod.GET,
- new HttpEntity<>(buildRequestHeader()), GetRequestStatusResponse.class);
- logResponseGet(url, response);
- if (null == response) {
- return null;
- } else {
- return response.getBody();
- }
+ ResponseEntity<GetRequestStatusResponse> response = restTemplate.exchange(url, HttpMethod.GET,
+ new HttpEntity<>(buildRequestHeader()), GetRequestStatusResponse.class);
+ logResponseGet(url, response);
+ if (null == response) {
+ return null;
+ } else {
+ return response.getBody();
+ }
- } catch (BackendFunctionalException | ResourceAccessException e) {
- LOGGER.error(ERROR_ON_CALLING + url + " ," + e);
- return null;
+ } catch (BackendFunctionalException | ResourceAccessException e) {
+ LOGGER.error(ERROR_ON_CALLING + url + " ," + e);
+ return null;
+ }
}
- }
+ public void callCheckConnectivity() {
+ String url = SoHealthCheck;
+ restTemplate.exchange(url, HttpMethod.GET, new HttpEntity<>(buildRequestHeader()), String.class);
+
+ }
- public void callCheckConnectivity() {
- String url = SoHealthCheck;
- restTemplate.exchange(url, HttpMethod.GET, new HttpEntity<>(buildRequestHeader()),
- String.class);
+ public GetE2ERequestStatusResponse callE2EGetRequestStatus(String operationId, String serviceId) {
- }
+ String callUrlFormated = getE2ESoStatus.replace("$serviceId", serviceId);
+ callUrlFormated = callUrlFormated.replace("$operationId", operationId);
- public GetE2ERequestStatusResponse callE2EGetRequestStatus(String operationId, String serviceId) {
+ if (LOGGER.isDebugEnabled()) {
+ LOGGER.debug("Calling SO callE2EGetRequestStatus with url : " + callUrlFormated);
+ }
- String callUrlFormated = getE2ESoStatus.replace("$serviceId", serviceId);
- callUrlFormated = callUrlFormated.replace("$operationId", operationId);
+ try {
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("Calling SO callE2EGetRequestStatus with url : " + callUrlFormated);
+ ResponseEntity<GetE2ERequestStatusResponse> response = restTemplate.exchange(callUrlFormated,
+ HttpMethod.GET, new HttpEntity<>(buildRequestHeader()), GetE2ERequestStatusResponse.class);
+ logE2EResponseGet(callUrlFormated, response);
+ if (null == response) {
+ return null;
+ } else {
+ return response.getBody();
+ }
+
+ } catch (BackendFunctionalException | ResourceAccessException e) {
+ LOGGER.error(ERROR_ON_CALLING + callUrlFormated + " ," + e);
+ return null;
+ }
}
- try {
-
- ResponseEntity<GetE2ERequestStatusResponse> response =
- restTemplate.exchange(callUrlFormated, HttpMethod.GET,
- new HttpEntity<>(buildRequestHeader()), GetE2ERequestStatusResponse.class);
- logE2EResponseGet(callUrlFormated, response);
- if (null == response) {
- return null;
- } else {
- return response.getBody();
- }
-
- } catch (BackendFunctionalException | ResourceAccessException e) {
- LOGGER.error(ERROR_ON_CALLING + callUrlFormated + " ," + e);
- return null;
+ private void logResponseGet(String url, ResponseEntity<GetRequestStatusResponse> response) {
+ if (response != null) {
+ if (LOGGER.isDebugEnabled()) {
+ LOGGER.debug("response status : {} , response body : {}", response.getStatusCodeValue(),
+ response.getBody().toString());
+ }
+ if (LOGGER.isWarnEnabled() && !response.getStatusCode().equals(HttpStatus.OK)) {
+ LOGGER.warn("HTTP call SO on {} returns {} , {}", url, response.getStatusCodeValue(),
+ response.getBody().toString());
+ }
+ } else {
+ if (LOGGER.isWarnEnabled()) {
+ LOGGER.warn("no response calling url {}", url);
+ }
+ }
}
- }
-
- private void logResponseGet(String url, ResponseEntity<GetRequestStatusResponse> response) {
- if (response != null) {
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("response status : {} , response body : {}", response.getStatusCodeValue(),
- response.getBody().toString());
- }
- if (LOGGER.isWarnEnabled() && !response.getStatusCode().equals(HttpStatus.OK)) {
- LOGGER.warn("HTTP call SO on {} returns {} , {}", url, response.getStatusCodeValue(),
- response.getBody().toString());
- }
- } else {
- if (LOGGER.isWarnEnabled()) {
- LOGGER.warn("no response calling url {}", url);
- }
+
+ private void logE2EResponseGet(String url, ResponseEntity<GetE2ERequestStatusResponse> response) {
+ if (response != null) {
+ if (LOGGER.isDebugEnabled()) {
+ LOGGER.debug("response status : {} , response body : {}", response.getStatusCodeValue(),
+ response.getBody().toString());
+ }
+ if (LOGGER.isWarnEnabled() && !response.getStatusCode().equals(HttpStatus.OK)) {
+ LOGGER.warn("HTTP call SO on {} returns {} , {}", url, response.getStatusCodeValue(),
+ response.getBody().toString());
+ }
+ } else {
+ if (LOGGER.isWarnEnabled()) {
+ LOGGER.warn("no response calling url {}", url);
+ }
+ }
}
- }
-
- private void logE2EResponseGet(String url, ResponseEntity<GetE2ERequestStatusResponse> response) {
- if (response != null) {
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("response status : {} , response body : {}", response.getStatusCodeValue(),
- response.getBody().toString());
- }
- if (LOGGER.isWarnEnabled() && !response.getStatusCode().equals(HttpStatus.OK)) {
- LOGGER.warn("HTTP call SO on {} returns {} , {}", url, response.getStatusCodeValue(),
- response.getBody().toString());
- }
- } else {
- if (LOGGER.isWarnEnabled()) {
- LOGGER.warn("no response calling url {}", url);
- }
+
+ private HttpHeaders buildRequestHeader() {
+ HttpHeaders httpHeaders = new HttpHeaders();
+ httpHeaders.add(HEADER_AUTHORIZATION, soHeaderAuthorization);
+ httpHeaders.add(X_ONAP_PARTNER_HEADER, soOnapPartnerName);
+ httpHeaders.add("Accept", "application/json");
+ httpHeaders.add("Content-Type", "application/json");
+ return httpHeaders;
}
- }
-
- private HttpHeaders buildRequestHeader() {
- HttpHeaders httpHeaders = new HttpHeaders();
- httpHeaders.add(HEADER_AUTHORIZATION, soHeaderAuthorization);
- httpHeaders.add(X_ONAP_PARTNER_HEADER, soOnapPartnerName);
- httpHeaders.add("Accept", "application/json");
- httpHeaders.add("Content-Type", "application/json");
- return httpHeaders;
- }
}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/ActionType.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/ActionType.java
index 7cf4a06..9df2b4d 100644
--- a/src/main/java/org/onap/nbi/apis/serviceorder/model/ActionType.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/ActionType.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.nbi.apis.serviceorder.model;
/*
* API ServiceOrder serviceOrder API designed for ONAP Beijing Release. This API is build from TMF
@@ -35,7 +36,6 @@ package org.onap.nbi.apis.serviceorder.model;
* the License.
*/
-
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
@@ -78,4 +78,3 @@ public enum ActionType {
return this.value;
}
}
-
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/OrderItemRelationship.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/OrderItemRelationship.java
index bcf776f..7b219d7 100755
--- a/src/main/java/org/onap/nbi/apis/serviceorder/model/OrderItemRelationship.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/OrderItemRelationship.java
@@ -34,7 +34,6 @@
* the License.
*/
-
package org.onap.nbi.apis.serviceorder.model;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -48,7 +47,8 @@ import javax.validation.constraints.Pattern;
* Linked order item to the one containing this attribute
*/
@ApiModel(description = "Linked order item to the one containing this attribute")
-@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen",
+@javax.annotation.Generated(
+ value = "io.swagger.codegen.languages.JavaJerseyServerCodegen",
date = "2018-02-19T14:00:30.767Z")
public class OrderItemRelationship {
@JsonProperty("type")
@@ -69,7 +69,8 @@ public class OrderItemRelationship {
* @return type
**/
@JsonProperty("type")
- @ApiModelProperty(required = true,
+ @ApiModelProperty(
+ required = true,
value = "The type of related order item, can be : dependancy if the order item needs to be “not started” until another order item is complete")
@NotNull(message = "RelationshipType type cannot be null")
public RelationshipType getType() {
@@ -93,7 +94,7 @@ public class OrderItemRelationship {
@JsonProperty("id")
@ApiModelProperty(required = true, value = "Unique identifier of an order item")
@NotNull(message = "RelationshipType id cannot be null")
- @Pattern(regexp="^(?!\\s*$).+", message="RelationshipType id cannot be empty")
+ @Pattern(regexp = "^(?!\\s*$).+", message = "RelationshipType id cannot be empty")
public String getId() {
return id;
}
@@ -102,7 +103,6 @@ public class OrderItemRelationship {
this.id = id;
}
-
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
@@ -121,7 +121,6 @@ public class OrderItemRelationship {
return Objects.hash(type, id);
}
-
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
@@ -144,4 +143,3 @@ public class OrderItemRelationship {
return o.toString().replace("\n", "\n ");
}
}
-
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/OrderMessage.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/OrderMessage.java
index 305be15..cdc67ad 100755
--- a/src/main/java/org/onap/nbi/apis/serviceorder/model/OrderMessage.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/OrderMessage.java
@@ -34,7 +34,6 @@
* the License.
*/
-
package org.onap.nbi.apis.serviceorder.model;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -47,11 +46,11 @@ import javax.validation.constraints.NotNull;
* An optional array of messages associated with the Order
*/
@ApiModel(description = "An optional array of messages associated with the Order")
-@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen",
+@javax.annotation.Generated(
+ value = "io.swagger.codegen.languages.JavaJerseyServerCodegen",
date = "2018-07-12T11:46:30.345Z")
public class OrderMessage {
-
@JsonProperty("code")
private String code = null;
@@ -67,9 +66,6 @@ public class OrderMessage {
@JsonProperty("correctionRequired")
private boolean correctionRequired;
-
-
-
/**
* A code associated to this message
*
@@ -90,7 +86,6 @@ public class OrderMessage {
return this;
}
-
/**
* Service Order attribute related to this error message
*
@@ -111,7 +106,6 @@ public class OrderMessage {
return this;
}
-
/**
* Message related to this order
*
@@ -132,14 +126,13 @@ public class OrderMessage {
return this;
}
-
/**
* Gravity of this message
*
* @return severity
**/
@JsonProperty("severity")
- @ApiModelProperty(required = true,value = "Gravity of this message")
+ @ApiModelProperty(required = true, value = "Gravity of this message")
@NotNull(message = "OrderMessage severity cannot be null")
public SeverityMessage getSeverity() {
return severity;
@@ -154,14 +147,15 @@ public class OrderMessage {
return this;
}
-
/**
* Indicator that an action is required to allow service order fullfilment to follow up
*
* @return correctionRequired
**/
@JsonProperty("correctionRequired")
- @ApiModelProperty(required = true,value = "Indicator that an action is required to allow service order fullfilment to follow up")
+ @ApiModelProperty(
+ required = true,
+ value = "Indicator that an action is required to allow service order fullfilment to follow up")
@NotNull(message = "OrderMessage correctionRequired cannot be null")
public boolean getCorrectionRequired() {
return correctionRequired;
@@ -176,7 +170,6 @@ public class OrderMessage {
return this;
}
-
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -186,20 +179,17 @@ public class OrderMessage {
return false;
}
OrderMessage orderMessage = (OrderMessage) o;
- return Objects.equals(this.code, orderMessage.code)
- && Objects.equals(this.field, orderMessage.field)
- && Objects.equals(this.messageInformation, orderMessage.messageInformation)
- && Objects.equals(this.severity, orderMessage.severity)
- && Objects.equals(this.correctionRequired, orderMessage.correctionRequired);
+ return Objects.equals(this.code, orderMessage.code) && Objects.equals(this.field, orderMessage.field)
+ && Objects.equals(this.messageInformation, orderMessage.messageInformation)
+ && Objects.equals(this.severity, orderMessage.severity)
+ && Objects.equals(this.correctionRequired, orderMessage.correctionRequired);
}
-
@Override
public int hashCode() {
- return Objects.hash(code, field, messageInformation,severity);
+ return Objects.hash(code, field, messageInformation, severity);
}
-
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
@@ -224,4 +214,3 @@ public class OrderMessage {
return o.toString().replace("\n", "\n ");
}
}
-
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/OrderRelationship.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/OrderRelationship.java
index a6d77d7..7c9f8e7 100755
--- a/src/main/java/org/onap/nbi/apis/serviceorder/model/OrderRelationship.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/OrderRelationship.java
@@ -34,7 +34,6 @@
* the License.
*/
-
package org.onap.nbi.apis.serviceorder.model;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -49,7 +48,8 @@ import javax.validation.constraints.Pattern;
* Linked order to the one containing this attribute
*/
@ApiModel(description = "Linked order to the one containing this attribute")
-@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen",
+@javax.annotation.Generated(
+ value = "io.swagger.codegen.languages.JavaJerseyServerCodegen",
date = "2018-02-19T14:00:30.767Z")
public class OrderRelationship {
@JsonProperty("type")
@@ -100,7 +100,7 @@ public class OrderRelationship {
@JsonProperty("id")
@ApiModelProperty(required = true, value = "The id of the related order")
@NotNull(message = "OrderRelationship id cannot be null")
- @Pattern(regexp="^(?!\\s*$).+", message="OrderRelationship id cannot be empty")
+ @Pattern(regexp = "^(?!\\s*$).+", message = "OrderRelationship id cannot be empty")
public String getId() {
return id;
}
@@ -147,7 +147,6 @@ public class OrderRelationship {
this.referredType = referredType;
}
-
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
@@ -167,7 +166,6 @@ public class OrderRelationship {
return Objects.hash(type, id, href, referredType);
}
-
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
@@ -192,4 +190,3 @@ public class OrderRelationship {
return o.toString().replace("\n", "\n ");
}
}
-
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/RelatedParty.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/RelatedParty.java
index ba97162..9900443 100755
--- a/src/main/java/org/onap/nbi/apis/serviceorder/model/RelatedParty.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/RelatedParty.java
@@ -34,7 +34,6 @@
* the License.
*/
-
package org.onap.nbi.apis.serviceorder.model;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -48,7 +47,8 @@ import javax.validation.constraints.Pattern;
* A related party defines party which are involved in this order and the role they are playing
*/
@ApiModel(description = "A related party defines party which are involved in this order and the role they are playing")
-@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen",
+@javax.annotation.Generated(
+ value = "io.swagger.codegen.languages.JavaJerseyServerCodegen",
date = "2018-02-19T14:00:30.767Z")
public class RelatedParty {
@JsonProperty("id")
@@ -79,7 +79,7 @@ public class RelatedParty {
@JsonProperty("id")
@ApiModelProperty(required = true, value = "Unique identifier of a related party")
@NotNull(message = "RelatedParty Id cannot be null")
- @Pattern(regexp="^(?!\\s*$).+", message="RelatedParty Id cannot be empty")
+ @Pattern(regexp = "^(?!\\s*$).+", message = "RelatedParty Id cannot be empty")
public String getId() {
return id;
}
@@ -121,7 +121,7 @@ public class RelatedParty {
@JsonProperty("role")
@ApiModelProperty(required = true, value = "The role of the related party (e.g. Owner, requester, fullfiller etc)")
@NotNull(message = "RelatedParty role cannot be null")
- @Pattern(regexp="^(?!\\s*$).+", message="RelatedParty role cannot be empty")
+ @Pattern(regexp = "^(?!\\s*$).+", message = "RelatedParty role cannot be empty")
public String getRole() {
return role;
}
@@ -168,7 +168,6 @@ public class RelatedParty {
this.referredType = referredType;
}
-
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
@@ -188,7 +187,6 @@ public class RelatedParty {
return Objects.hash(id, href, role, name, referredType);
}
-
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
@@ -214,4 +212,3 @@ public class RelatedParty {
return o.toString().replace("\n", "\n ");
}
}
-
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/RelationshipType.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/RelationshipType.java
index 93c5006..4891bec 100644
--- a/src/main/java/org/onap/nbi/apis/serviceorder/model/RelationshipType.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/RelationshipType.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.nbi.apis.serviceorder.model;
/*
@@ -36,7 +37,6 @@ package org.onap.nbi.apis.serviceorder.model;
* the License.
*/
-
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
@@ -73,5 +73,3 @@ public enum RelationshipType {
return this.value;
}
}
-
-
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/ResourceSpecification.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/ResourceSpecification.java
index 61473b9..3496788 100644
--- a/src/main/java/org/onap/nbi/apis/serviceorder/model/ResourceSpecification.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/ResourceSpecification.java
@@ -16,8 +16,8 @@ package org.onap.nbi.apis.serviceorder.model;
import com.fasterxml.jackson.annotation.JsonProperty;
public class ResourceSpecification {
-
- @JsonProperty("id")
+
+ @JsonProperty("id")
private String id = null;
@JsonProperty("name")
@@ -28,74 +28,70 @@ public class ResourceSpecification {
@JsonProperty("instanceName")
private String instanceName = null;
-
+
@JsonProperty("resourceInvariantUUID")
private String resourceInvariantUUID = null;
-
- @JsonProperty("resourceType")
+
+ @JsonProperty("resourceType")
private String resourceType = null;
-
+
@JsonProperty("@type")
private String type = null;
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
+ public String getId() {
+ return id;
+ }
- public String getVersion() {
- return version;
- }
+ public void setId(String id) {
+ this.id = id;
+ }
- public void setVersion(String version) {
- this.version = version;
- }
+ public String getName() {
+ return name;
+ }
- public String getInstanceName() {
- return instanceName;
- }
+ public void setName(String name) {
+ this.name = name;
+ }
- public void setInstanceName(String instanceName) {
- this.instanceName = instanceName;
- }
+ public String getVersion() {
+ return version;
+ }
- public String getResourceInvariantUUID() {
- return resourceInvariantUUID;
- }
+ public void setVersion(String version) {
+ this.version = version;
+ }
- public void setResourceInvariantUUID(String resourceInvariantUUID) {
- this.resourceInvariantUUID = resourceInvariantUUID;
- }
+ public String getInstanceName() {
+ return instanceName;
+ }
- public String getResourceType() {
- return resourceType;
- }
+ public void setInstanceName(String instanceName) {
+ this.instanceName = instanceName;
+ }
- public void setResourceType(String resourceType) {
- this.resourceType = resourceType;
- }
+ public String getResourceInvariantUUID() {
+ return resourceInvariantUUID;
+ }
- public String getType() {
- return type;
- }
+ public void setResourceInvariantUUID(String resourceInvariantUUID) {
+ this.resourceInvariantUUID = resourceInvariantUUID;
+ }
- public void setType(String type) {
- this.type = type;
- }
+ public String getResourceType() {
+ return resourceType;
+ }
+ public void setResourceType(String resourceType) {
+ this.resourceType = resourceType;
+ }
+ public String getType() {
+ return type;
+ }
-
+ public void setType(String type) {
+ this.type = type;
+ }
}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/Service.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/Service.java
index 50bd2af..6ecb77a 100755
--- a/src/main/java/org/onap/nbi/apis/serviceorder/model/Service.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/Service.java
@@ -34,7 +34,6 @@
* the License.
*/
-
package org.onap.nbi.apis.serviceorder.model;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -52,7 +51,8 @@ import java.util.Objects;
*/
@ApiModel(
description = "Service attributes description (these are as per the Service ODE model as used in the Service Inventory specification)")
-@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen",
+@javax.annotation.Generated(
+ value = "io.swagger.codegen.languages.JavaJerseyServerCodegen",
date = "2018-02-19T14:00:30.767Z")
public class Service {
@JsonProperty("id")
@@ -317,7 +317,6 @@ public class Service {
this.serviceSpecification = serviceSpecification;
}
-
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
@@ -343,7 +342,6 @@ public class Service {
serviceRelationship, relatedParty, serviceSpecification);
}
-
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
@@ -374,4 +372,3 @@ public class Service {
return o.toString().replace("\n", "\n ");
}
}
-
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/ServiceCharacteristic.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/ServiceCharacteristic.java
index f639f80..ecbdd0f 100755
--- a/src/main/java/org/onap/nbi/apis/serviceorder/model/ServiceCharacteristic.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/ServiceCharacteristic.java
@@ -34,7 +34,6 @@
* the License.
*/
-
package org.onap.nbi.apis.serviceorder.model;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -49,7 +48,8 @@ import javax.validation.constraints.Pattern;
* ServiceCharacteristic
*/
@ApiModel(description = "ServiceCharacteristic")
-@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen",
+@javax.annotation.Generated(
+ value = "io.swagger.codegen.languages.JavaJerseyServerCodegen",
date = "2018-02-19T14:00:30.767Z")
public class ServiceCharacteristic {
@JsonProperty("name")
@@ -74,7 +74,7 @@ public class ServiceCharacteristic {
@JsonProperty("name")
@ApiModelProperty(required = true, value = "Name of characteristic")
@NotNull(message = "ServiceCharacteristic name cannot be null")
- @Pattern(regexp="^(?!\\s*$).+", message="ServiceCharacteristic name cannot be empty")
+ @Pattern(regexp = "^(?!\\s*$).+", message = "ServiceCharacteristic name cannot be empty")
public String getName() {
return name;
}
@@ -120,7 +120,6 @@ public class ServiceCharacteristic {
this.value = value;
}
-
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
@@ -140,7 +139,6 @@ public class ServiceCharacteristic {
return Objects.hash(name, valueType, value);
}
-
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
@@ -164,4 +162,3 @@ public class ServiceCharacteristic {
return o.toString().replace("\n", "\n ");
}
}
-
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/ServiceOrder.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/ServiceOrder.java
index 4306834..4278fac 100755
--- a/src/main/java/org/onap/nbi/apis/serviceorder/model/ServiceOrder.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/ServiceOrder.java
@@ -34,7 +34,6 @@
* the License.
*/
-
package org.onap.nbi.apis.serviceorder.model;
import java.util.ArrayList;
@@ -59,7 +58,8 @@ import io.swagger.annotations.ApiModelProperty;
*/
@ApiModel(
description = "A Service Order is a type of order which can be used to place an order between a customer and a service provider or between a service provider and a partner and vice versa")
-@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen",
+@javax.annotation.Generated(
+ value = "io.swagger.codegen.languages.JavaJerseyServerCodegen",
date = "2018-02-19T14:00:30.767Z")
@Document
@ValidServiceOrder
@@ -131,7 +131,6 @@ public class ServiceOrder implements Resource {
return this;
}
-
/**
* ID created on repository side
*
@@ -312,7 +311,6 @@ public class ServiceOrder implements Resource {
this.completionDateTime = completionDateTime;
}
-
/**
* @return expectedCompletionDate
**/
@@ -533,7 +531,6 @@ public class ServiceOrder implements Resource {
this.orderItem = orderItem;
}
-
public ServiceOrder orderMessage(List<OrderMessage> orderMessage) {
this.orderMessage = orderMessage;
return this;
@@ -543,14 +540,14 @@ public class ServiceOrder implements Resource {
if (this.orderMessage == null) {
this.orderMessage = new ArrayList<OrderMessage>();
}
- boolean mesageAlreadyExist=false;
+ boolean mesageAlreadyExist = false;
for (OrderMessage message : this.orderMessage) {
- if(message.getCode().equals(orderMessageItem.getCode())){
- mesageAlreadyExist=true;
+ if (message.getCode().equals(orderMessageItem.getCode())) {
+ mesageAlreadyExist = true;
}
}
- if(!mesageAlreadyExist) {
+ if (!mesageAlreadyExist) {
this.orderMessage.add(orderMessageItem);
}
return this;
@@ -571,10 +568,6 @@ public class ServiceOrder implements Resource {
this.orderMessage = orderMessage;
}
-
-
-
-
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
@@ -604,7 +597,6 @@ public class ServiceOrder implements Resource {
&& Objects.equals(this.orderMessage, serviceOrder.orderMessage);
}
-
@Override
public int hashCode() {
return Objects.hash(id, href, externalId, priority, description, category, state, orderDate, completionDateTime,
@@ -612,7 +604,6 @@ public class ServiceOrder implements Resource {
schemaLocation, relatedParty, orderRelationship, orderItem, orderMessage);
}
-
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
@@ -653,4 +644,3 @@ public class ServiceOrder implements Resource {
return o.toString().replace("\n", "\n ");
}
}
-
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/ServiceOrderItem.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/ServiceOrderItem.java
index 830ee4e..f147bc3 100755
--- a/src/main/java/org/onap/nbi/apis/serviceorder/model/ServiceOrderItem.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/ServiceOrderItem.java
@@ -34,7 +34,6 @@
* the License.
*/
-
package org.onap.nbi.apis.serviceorder.model;
import com.fasterxml.jackson.annotation.JsonIgnore;
@@ -52,7 +51,8 @@ import javax.validation.constraints.Pattern;
* An identified part of the order. A service order is decomposed into one or more order items.
*/
@ApiModel(description = "An identified part of the order. A service order is decomposed into one or more order items.")
-@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen",
+@javax.annotation.Generated(
+ value = "io.swagger.codegen.languages.JavaJerseyServerCodegen",
date = "2018-02-19T14:00:30.767Z")
public class ServiceOrderItem {
@JsonProperty("id")
@@ -85,11 +85,9 @@ public class ServiceOrderItem {
@JsonProperty("service")
private Service service = null;
-
@JsonProperty("orderMessage")
private List<OrderMessage> orderItemMessage = new ArrayList<>();
-
public ServiceOrderItem id(String id) {
this.id = id;
return this;
@@ -101,10 +99,9 @@ public class ServiceOrderItem {
* @return id
**/
@JsonProperty("id")
- @ApiModelProperty(
- value = "Identifier of the line item (generally it is a sequence number 01, 02, 03, …)")
+ @ApiModelProperty(value = "Identifier of the line item (generally it is a sequence number 01, 02, 03, …)")
@NotNull(message = "order item id cannot be null")
- @Pattern(regexp="^(?!\\s*$).+", message="order item id cannot be empty")
+ @Pattern(regexp = "^(?!\\s*$).+", message = "order item id cannot be empty")
public String getId() {
return id;
}
@@ -277,7 +274,6 @@ public class ServiceOrderItem {
this.service = service;
}
-
public String getRequestId() {
return requestId;
}
@@ -286,7 +282,6 @@ public class ServiceOrderItem {
this.requestId = requestId;
}
-
public ServiceOrderItem orderItemMessage(List<OrderMessage> orderItemMessage) {
this.orderItemMessage = orderItemMessage;
return this;
@@ -296,14 +291,14 @@ public class ServiceOrderItem {
if (this.orderItemMessage == null) {
this.orderItemMessage = new ArrayList<OrderMessage>();
}
- boolean mesageAlreadyExist=false;
+ boolean mesageAlreadyExist = false;
for (OrderMessage message : this.orderItemMessage) {
- if(message.getCode().equals(orderItemMessageItem.getCode())){
- mesageAlreadyExist=true;
+ if (message.getCode().equals(orderItemMessageItem.getCode())) {
+ mesageAlreadyExist = true;
}
}
- if(!mesageAlreadyExist) {
+ if (!mesageAlreadyExist) {
this.orderItemMessage.add(orderItemMessageItem);
}
return this;
@@ -324,9 +319,6 @@ public class ServiceOrderItem {
this.orderItemMessage = orderItemMessage;
}
-
-
-
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
@@ -351,11 +343,10 @@ public class ServiceOrderItem {
@Override
public int hashCode() {
- return Objects.hash(id, action, state, percentProgress, type, schemaLocation, baseType, orderItemRelationship, service,
- requestId,orderItemMessage);
+ return Objects.hash(id, action, state, percentProgress, type, schemaLocation, baseType, orderItemRelationship,
+ service, requestId, orderItemMessage);
}
-
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
@@ -386,4 +377,3 @@ public class ServiceOrderItem {
return o.toString().replace("\n", "\n ");
}
}
-
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/ServiceRelationship.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/ServiceRelationship.java
index 867ae1a..2a27ce3 100755
--- a/src/main/java/org/onap/nbi/apis/serviceorder/model/ServiceRelationship.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/ServiceRelationship.java
@@ -34,7 +34,6 @@
* the License.
*/
-
package org.onap.nbi.apis.serviceorder.model;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -48,7 +47,8 @@ import java.util.Objects;
* Linked Services to the one instantiate
*/
@ApiModel(description = "Linked Services to the one instantiate")
-@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen",
+@javax.annotation.Generated(
+ value = "io.swagger.codegen.languages.JavaJerseyServerCodegen",
date = "2018-02-19T14:00:30.767Z")
public class ServiceRelationship {
@JsonProperty("type")
@@ -71,7 +71,8 @@ public class ServiceRelationship {
* @return type
**/
@JsonProperty("type")
- @ApiModelProperty(required = true,
+ @ApiModelProperty(
+ required = true,
value = "Relationship type. It can be : “reliesOn” if the Service needs another already owned Service to rely on (e.g. an option on an already owned mobile access Service) or “targets” or “isTargeted” (depending on the way of expressing the link) for any other kind of links that may be useful")
@NotNull(message = "Relationship type cannot be null")
@Valid
@@ -105,7 +106,6 @@ public class ServiceRelationship {
this.service = service;
}
-
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
@@ -124,7 +124,6 @@ public class ServiceRelationship {
return Objects.hash(type, service);
}
-
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
@@ -147,4 +146,3 @@ public class ServiceRelationship {
return o.toString().replace("\n", "\n ");
}
}
-
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/ServiceSpecificationRef.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/ServiceSpecificationRef.java
index f4ec4e2..98b4e5b 100755
--- a/src/main/java/org/onap/nbi/apis/serviceorder/model/ServiceSpecificationRef.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/ServiceSpecificationRef.java
@@ -34,7 +34,6 @@
* the License.
*/
-
package org.onap.nbi.apis.serviceorder.model;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -49,7 +48,8 @@ import javax.validation.constraints.Pattern;
* The service specification (default values, etc. are fetched from the catalogue).
*/
@ApiModel(description = "The service specification (default values, etc. are fetched from the catalogue).")
-@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen",
+@javax.annotation.Generated(
+ value = "io.swagger.codegen.languages.JavaJerseyServerCodegen",
date = "2018-02-19T14:00:30.767Z")
public class ServiceSpecificationRef {
@JsonProperty("id")
@@ -89,7 +89,7 @@ public class ServiceSpecificationRef {
@JsonProperty("id")
@ApiModelProperty(required = true, value = "Unique identifier of the service specification")
@NotNull(message = "ServiceSpecification id cannot be null")
- @Pattern(regexp="^(?!\\s*$).+", message="ServiceSpecification id cannot be empty")
+ @Pattern(regexp = "^(?!\\s*$).+", message = "ServiceSpecification id cannot be empty")
public String getId() {
return id;
}
@@ -227,7 +227,6 @@ public class ServiceSpecificationRef {
this.baseType = baseType;
}
-
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
@@ -252,7 +251,6 @@ public class ServiceSpecificationRef {
return Objects.hash(id, href, name, version, targetServiceSchema, type, schemaLocation, baseType);
}
-
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
@@ -281,4 +279,3 @@ public class ServiceSpecificationRef {
return o.toString().replace("\n", "\n ");
}
}
-
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/SeverityMessage.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/SeverityMessage.java
index be6836f..fcc5dc6 100755
--- a/src/main/java/org/onap/nbi/apis/serviceorder/model/SeverityMessage.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/SeverityMessage.java
@@ -33,8 +33,8 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-package org.onap.nbi.apis.serviceorder.model;
+package org.onap.nbi.apis.serviceorder.model;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
@@ -75,4 +75,3 @@ public enum SeverityMessage {
}
}
-
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/StateType.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/StateType.java
index 9f51eac..c308fc6 100755
--- a/src/main/java/org/onap/nbi/apis/serviceorder/model/StateType.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/StateType.java
@@ -34,10 +34,8 @@
* the License.
*/
-
package org.onap.nbi.apis.serviceorder.model;
-
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.ArrayList;
@@ -74,7 +72,6 @@ public enum StateType {
INPROGRESS_MODIFY_REQUEST_CREATE_SEND("inProgressModifyRequestCreateSend");
-
private String value;
StateType(String value) {
@@ -96,11 +93,11 @@ public enum StateType {
return null;
}
- public static List<StateType> fromValueSearch(String text){
+ public static List<StateType> fromValueSearch(String text) {
List<StateType> values = new ArrayList<>();
for (StateType b : StateType.values()) {
if (String.valueOf(b.value).equals(text)) {
- if(b.equals(StateType.INPROGRESS)) {
+ if (b.equals(StateType.INPROGRESS)) {
values.add(INPROGRESS_TASK_CREATED);
values.add(INPROGRESS_MODIFY_REQUEST_DELETE_SEND);
values.add(INPROGRESS_MODIFY_ITEM_TO_CREATE);
@@ -113,15 +110,14 @@ public enum StateType {
}
@JsonValue
- public String value()
- {
- if("inProgressModifyRequestDeleteSend".equalsIgnoreCase(this.value) || "inProgressModifyItemToCreate".equalsIgnoreCase(this.value)
- || "inProgressTaskCreated".equalsIgnoreCase(this.value)
- || "inProgressModifyRequestCreateSend".equalsIgnoreCase(this.value)) {
+ public String value() {
+ if ("inProgressModifyRequestDeleteSend".equalsIgnoreCase(this.value)
+ || "inProgressModifyItemToCreate".equalsIgnoreCase(this.value)
+ || "inProgressTaskCreated".equalsIgnoreCase(this.value)
+ || "inProgressModifyRequestCreateSend".equalsIgnoreCase(this.value)) {
return INPROGRESS.value;
}
return this.value;
}
}
-
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/TargetServiceSchema.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/TargetServiceSchema.java
index 42bdf9e..3013659 100755
--- a/src/main/java/org/onap/nbi/apis/serviceorder/model/TargetServiceSchema.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/TargetServiceSchema.java
@@ -34,7 +34,6 @@
* the License.
*/
-
package org.onap.nbi.apis.serviceorder.model;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -48,7 +47,8 @@ import javax.validation.constraints.Pattern;
*
*/
@ApiModel(description = "")
-@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen",
+@javax.annotation.Generated(
+ value = "io.swagger.codegen.languages.JavaJerseyServerCodegen",
date = "2018-02-19T14:00:30.767Z")
public class TargetServiceSchema {
@JsonProperty("@type")
@@ -68,7 +68,7 @@ public class TargetServiceSchema {
@JsonProperty("@type")
@ApiModelProperty(required = true, value = "")
@NotNull(message = "TargetServiceSchema @type cannot be null")
- @Pattern(regexp="^(?!\\s*$).+", message="TargetServiceSchema @type cannot be empty")
+ @Pattern(regexp = "^(?!\\s*$).+", message = "TargetServiceSchema @type cannot be empty")
public String getType() {
return type;
}
@@ -88,7 +88,7 @@ public class TargetServiceSchema {
@JsonProperty("@schemaLocation")
@ApiModelProperty(required = true, value = "")
@NotNull(message = "TargetServiceSchema @schemaLocation cannot be null")
- @Pattern(regexp="^(?!\\s*$).+", message="TargetServiceSchema @schemaLocation cannot be empty")
+ @Pattern(regexp = "^(?!\\s*$).+", message = "TargetServiceSchema @schemaLocation cannot be empty")
public String getSchemaLocation() {
return schemaLocation;
}
@@ -97,7 +97,6 @@ public class TargetServiceSchema {
this.schemaLocation = schemaLocation;
}
-
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
@@ -116,7 +115,6 @@ public class TargetServiceSchema {
return Objects.hash(type, schemaLocation);
}
-
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
@@ -139,4 +137,3 @@ public class TargetServiceSchema {
return o.toString().replace("\n", "\n ");
}
}
-
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/Value.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/Value.java
index 2f1fa7f..950d43b 100755
--- a/src/main/java/org/onap/nbi/apis/serviceorder/model/Value.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/Value.java
@@ -34,7 +34,6 @@
* the License.
*/
-
package org.onap.nbi.apis.serviceorder.model;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -46,7 +45,8 @@ import java.util.Objects;
* Value is a descriptive structure for service characteristic
*/
@ApiModel(description = "Value is a descriptive structure for service characteristic")
-@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen",
+@javax.annotation.Generated(
+ value = "io.swagger.codegen.languages.JavaJerseyServerCodegen",
date = "2018-02-19T14:00:30.767Z")
public class Value {
@JsonProperty("@type")
@@ -112,7 +112,6 @@ public class Value {
this.serviceCharacteristicValue = serviceCharacteristicValue;
}
-
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
@@ -131,7 +130,6 @@ public class Value {
return Objects.hash(type, schemaLocation, serviceCharacteristicValue);
}
-
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
@@ -155,4 +153,3 @@ public class Value {
return o.toString().replace("\n", "\n ");
}
}
-
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/CloudConfiguration.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/CloudConfiguration.java
index 0dca118..c742eb7 100644
--- a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/CloudConfiguration.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/CloudConfiguration.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.nbi.apis.serviceorder.model.consumer;
public class CloudConfiguration {
@@ -55,10 +56,7 @@ public class CloudConfiguration {
@Override
public String toString() {
- return "CloudConfiguration{" +
- "lcpCloudRegionId='" + lcpCloudRegionId + '\'' +
- ", tenantId='" + tenantId + '\'' +
- ", cloudOwner='" + cloudOwner + '\'' +
- '}';
+ return "CloudConfiguration{" + "lcpCloudRegionId='" + lcpCloudRegionId + '\'' + ", tenantId='" + tenantId + '\''
+ + ", cloudOwner='" + cloudOwner + '\'' + '}';
}
}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/CreateE2EServiceInstanceResponse.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/CreateE2EServiceInstanceResponse.java
index 7c75eca..de909cc 100644
--- a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/CreateE2EServiceInstanceResponse.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/CreateE2EServiceInstanceResponse.java
@@ -13,24 +13,23 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.nbi.apis.serviceorder.model.consumer;
public class CreateE2EServiceInstanceResponse {
- private ServiceResponse service;
+ private ServiceResponse service;
- public ServiceResponse getService() {
- return service;
- }
+ public ServiceResponse getService() {
+ return service;
+ }
- public void setService(ServiceResponse service) {
- this.service = service;
- }
+ public void setService(ServiceResponse service) {
+ this.service = service;
+ }
- @Override
- public String toString() {
- return "CreateE2EServiceInstanceResponse{" +
- "service=" + service +
- '}';
- }
-} \ No newline at end of file
+ @Override
+ public String toString() {
+ return "CreateE2EServiceInstanceResponse{" + "service=" + service + '}';
+ }
+}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/CreateServiceInstanceResponse.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/CreateServiceInstanceResponse.java
index 3389e32..0f0c0a2 100644
--- a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/CreateServiceInstanceResponse.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/CreateServiceInstanceResponse.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.nbi.apis.serviceorder.model.consumer;
public class CreateServiceInstanceResponse {
@@ -29,8 +30,6 @@ public class CreateServiceInstanceResponse {
@Override
public String toString() {
- return "CreateServiceInstanceResponse{" +
- "requestReferences=" + requestReferences +
- '}';
+ return "CreateServiceInstanceResponse{" + "requestReferences=" + requestReferences + '}';
}
-} \ No newline at end of file
+}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/DeleteE2EServiceInstanceResponse.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/DeleteE2EServiceInstanceResponse.java
index ab74338..b9266ef 100644
--- a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/DeleteE2EServiceInstanceResponse.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/DeleteE2EServiceInstanceResponse.java
@@ -14,22 +14,20 @@
package org.onap.nbi.apis.serviceorder.model.consumer;
public class DeleteE2EServiceInstanceResponse {
-
- private String operationId;
- public String getOperationId() {
- return operationId;
- }
+ private String operationId;
- public void setOperationId(String operationId) {
- this.operationId = operationId;
- }
-
- @Override
+ public String getOperationId() {
+ return operationId;
+ }
+
+ public void setOperationId(String operationId) {
+ this.operationId = operationId;
+ }
+
+ @Override
public String toString() {
- return "DeleteE2EServiceInstanceResponse{" +
- "operationId='" + operationId + '\'' +
- '}';
+ return "DeleteE2EServiceInstanceResponse{" + "operationId='" + operationId + '\'' + '}';
}
}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/GetE2ERequestStatusResponse.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/GetE2ERequestStatusResponse.java
index 9e16181..9341483 100644
--- a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/GetE2ERequestStatusResponse.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/GetE2ERequestStatusResponse.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.nbi.apis.serviceorder.model.consumer;
public class GetE2ERequestStatusResponse {
@@ -29,8 +30,6 @@ public class GetE2ERequestStatusResponse {
@Override
public String toString() {
- return "GetE2ERequestStatusResponse{" +
- "operation=" + operation +
- '}';
+ return "GetE2ERequestStatusResponse{" + "operation=" + operation + '}';
}
-} \ No newline at end of file
+}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/GetRequestStatusResponse.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/GetRequestStatusResponse.java
index 0f95e8d..198b60d 100644
--- a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/GetRequestStatusResponse.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/GetRequestStatusResponse.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.nbi.apis.serviceorder.model.consumer;
import java.util.Objects;
@@ -21,7 +22,6 @@ public class GetRequestStatusResponse {
private Request request;
-
public Request getRequest() {
return request;
@@ -36,7 +36,8 @@ public class GetRequestStatusResponse {
this.request = request;
}
- public GetRequestStatusResponse() {}
+ public GetRequestStatusResponse() {
+ }
@Override
public boolean equals(Object o) {
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/LocationConstraintsModel.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/LocationConstraintsModel.java
index 4b604ae..0fff44a 100644
--- a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/LocationConstraintsModel.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/LocationConstraintsModel.java
@@ -10,36 +10,34 @@
* 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.nbi.apis.serviceorder.model.consumer;
public class LocationConstraintsModel {
- private String vnfProfileId;
-
- private VnfLocationConstraintsModel locationConstraints;
-
-
- public String getVnfProfileId() {
- return vnfProfileId;
- }
-
- public void setVnfProfileId(String vnfProfileId) {
- this.vnfProfileId = vnfProfileId;
- }
-
- public VnfLocationConstraintsModel getLocationConstraints() {
- return locationConstraints;
- }
-
- public void setLocationConstraints(VnfLocationConstraintsModel locationConstraints) {
- this.locationConstraints = locationConstraints;
- }
-
- @Override
+ private String vnfProfileId;
+
+ private VnfLocationConstraintsModel locationConstraints;
+
+ public String getVnfProfileId() {
+ return vnfProfileId;
+ }
+
+ public void setVnfProfileId(String vnfProfileId) {
+ this.vnfProfileId = vnfProfileId;
+ }
+
+ public VnfLocationConstraintsModel getLocationConstraints() {
+ return locationConstraints;
+ }
+
+ public void setLocationConstraints(VnfLocationConstraintsModel locationConstraints) {
+ this.locationConstraints = locationConstraints;
+ }
+
+ @Override
public String toString() {
- return "LocationConstraintsModel{" +
- "vnfProfileId='" + vnfProfileId + '\'' +
- locationConstraints + '}';
+ return "LocationConstraintsModel{" + "vnfProfileId='" + vnfProfileId + '\'' + locationConstraints + '}';
}
}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/MSODeleteE2EPayload.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/MSODeleteE2EPayload.java
index 3ab4eb6..7d8e13b 100644
--- a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/MSODeleteE2EPayload.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/MSODeleteE2EPayload.java
@@ -14,32 +14,30 @@
package org.onap.nbi.apis.serviceorder.model.consumer;
public class MSODeleteE2EPayload {
-
- private String globalSubscriberId;
-
- private String serviceType;
-
- public String getGlobalSubscriberId() {
- return globalSubscriberId;
- }
-
- public void setGlobalSubscriberId(String globalSubscriberId) {
- this.globalSubscriberId = globalSubscriberId;
- }
-
- public String getServiceType() {
- return serviceType;
- }
-
- public void setServiceType(String serviceType) {
- this.serviceType = serviceType;
- }
-
- @Override
+
+ private String globalSubscriberId;
+
+ private String serviceType;
+
+ public String getGlobalSubscriberId() {
+ return globalSubscriberId;
+ }
+
+ public void setGlobalSubscriberId(String globalSubscriberId) {
+ this.globalSubscriberId = globalSubscriberId;
+ }
+
+ public String getServiceType() {
+ return serviceType;
+ }
+
+ public void setServiceType(String serviceType) {
+ this.serviceType = serviceType;
+ }
+
+ @Override
public String toString() {
- return "MSODeleteE2EPayload{" +
- "globalSubscriberId='" + globalSubscriberId+ '\'' +
- ", serviceType='" + serviceType + '\'' +
- '}';
+ return "MSODeleteE2EPayload{" + "globalSubscriberId='" + globalSubscriberId + '\'' + ", serviceType='"
+ + serviceType + '\'' + '}';
}
}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/MSOE2EPayload.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/MSOE2EPayload.java
index 69ce398..6926d72 100644
--- a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/MSOE2EPayload.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/MSOE2EPayload.java
@@ -28,11 +28,9 @@ public class MSOE2EPayload {
public void setService(ServiceModel service) {
this.service = service;
}
-
+
@Override
public String toString() {
- return "MSOPayloadE2E{" +
- "service=" + service +
- '}';
+ return "MSOPayloadE2E{" + "service=" + service + '}';
}
}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/MSOPayload.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/MSOPayload.java
index 76415c3..27f0649 100644
--- a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/MSOPayload.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/MSOPayload.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.nbi.apis.serviceorder.model.consumer;
public class MSOPayload {
@@ -33,8 +34,6 @@ public class MSOPayload {
@Override
public String toString() {
- return "MSOPayload{" +
- "requestDetails=" + requestDetails +
- '}';
+ return "MSOPayload{" + "requestDetails=" + requestDetails + '}';
}
}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/ModelInfo.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/ModelInfo.java
index bef4183..1d5cc6e 100644
--- a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/ModelInfo.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/ModelInfo.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.nbi.apis.serviceorder.model.consumer;
public class ModelInfo {
@@ -99,15 +100,10 @@ public class ModelInfo {
@Override
public String toString() {
- return "ModelInfo{" +
- "modelType='" + modelType + '\'' +
- ", modelInvariantId='" + modelInvariantId + '\'' +
- ", modelVersionId='" + modelVersionId + '\'' +
- ", modelNameVersionId='" + modelNameVersionId + '\'' +
- ", modelName='" + modelName + '\'' +
- ", modelVersion='" + modelVersion + '\'' +
- ", modelCustomizationName='" + modelCustomizationName + '\'' +
- ", modelCustomizationId='" + modelCustomizationId + '\'' +
- '}';
+ return "ModelInfo{" + "modelType='" + modelType + '\'' + ", modelInvariantId='" + modelInvariantId + '\''
+ + ", modelVersionId='" + modelVersionId + '\'' + ", modelNameVersionId='" + modelNameVersionId + '\''
+ + ", modelName='" + modelName + '\'' + ", modelVersion='" + modelVersion + '\''
+ + ", modelCustomizationName='" + modelCustomizationName + '\'' + ", modelCustomizationId='"
+ + modelCustomizationId + '\'' + '}';
}
}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/OperationStatus.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/OperationStatus.java
index 4d00e41..8fdb112 100644
--- a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/OperationStatus.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/OperationStatus.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.nbi.apis.serviceorder.model.consumer;
import java.io.Serializable;
@@ -47,108 +48,86 @@ public class OperationStatus implements Serializable {
private Timestamp finishedAt = null;
-
public String getServiceId() {
return serviceId;
}
-
public void setServiceId(String serviceId) {
this.serviceId = serviceId;
}
-
public String getOperationId() {
return operationId;
}
-
public void setOperationId(String operationId) {
this.operationId = operationId;
}
-
public String getOperation() {
return operation;
}
-
public void setOperation(String operation) {
this.operation = operation;
}
-
public String getUserId() {
return userId;
}
-
public void setUserId(String userId) {
this.userId = userId;
}
-
public String getResult() {
return result;
}
-
public void setResult(String result) {
this.result = result;
}
-
public String getOperationContent() {
return operationContent;
}
-
public void setOperationContent(String operationContent) {
this.operationContent = operationContent;
}
-
public String getProgress() {
return progress;
}
-
public void setProgress(String progress) {
this.progress = progress;
}
-
public String getReason() {
return reason;
}
-
public void setReason(String reason) {
this.reason = reason;
}
-
public Timestamp getOperateAt() {
return operateAt;
}
-
public void setOperateAt(Timestamp operateAt) {
this.operateAt = operateAt;
}
-
public Timestamp getFinishedAt() {
return finishedAt;
}
-
public void setFinishedAt(Timestamp finishedAt) {
this.finishedAt = finishedAt;
}
-
-
/**
* @return Returns the serviceName.
*/
@@ -156,8 +135,6 @@ public class OperationStatus implements Serializable {
return serviceName;
}
-
-
/**
* @param serviceName The serviceName to set.
*/
@@ -165,7 +142,6 @@ public class OperationStatus implements Serializable {
this.serviceName = serviceName;
}
-
/**
* <br>
*
@@ -180,7 +156,6 @@ public class OperationStatus implements Serializable {
return result;
}
-
/**
* <br>
*
@@ -189,40 +164,32 @@ public class OperationStatus implements Serializable {
*/
@Override
public boolean equals(Object obj) {
- if(this == obj)
+ if (this == obj)
return true;
- if(obj == null)
+ if (obj == null)
return false;
- if(getClass() != obj.getClass())
+ if (getClass() != obj.getClass())
return false;
- OperationStatus other = (OperationStatus)obj;
- if(operationId == null) {
- if(other.operationId != null)
+ OperationStatus other = (OperationStatus) obj;
+ if (operationId == null) {
+ if (other.operationId != null)
return false;
- } else if(!operationId.equals(other.operationId))
+ } else if (!operationId.equals(other.operationId))
return false;
- if(serviceId == null) {
- if(other.serviceId != null)
+ if (serviceId == null) {
+ if (other.serviceId != null)
return false;
- } else if(!serviceId.equals(other.serviceId))
+ } else if (!serviceId.equals(other.serviceId))
return false;
return true;
}
@Override
public String toString() {
- return "OperationStatus{" +
- "serviceId='" + serviceId + '\'' +
- ", operationId='" + operationId + '\'' +
- ", serviceName='" + serviceName + '\'' +
- ", operation='" + operation + '\'' +
- ", userId='" + userId + '\'' +
- ", result='" + result + '\'' +
- ", operationContent='" + operationContent + '\'' +
- ", progress='" + progress + '\'' +
- ", reason='" + reason + '\'' +
- ", operateAt=" + operateAt +
- ", finishedAt=" + finishedAt +
- '}';
- }
-} \ No newline at end of file
+ return "OperationStatus{" + "serviceId='" + serviceId + '\'' + ", operationId='" + operationId + '\''
+ + ", serviceName='" + serviceName + '\'' + ", operation='" + operation + '\'' + ", userId='" + userId
+ + '\'' + ", result='" + result + '\'' + ", operationContent='" + operationContent + '\''
+ + ", progress='" + progress + '\'' + ", reason='" + reason + '\'' + ", operateAt=" + operateAt
+ + ", finishedAt=" + finishedAt + '}';
+ }
+}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/OwningEntity.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/OwningEntity.java
index fb80d2d..2a099ff 100644
--- a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/OwningEntity.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/OwningEntity.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.nbi.apis.serviceorder.model.consumer;
public class OwningEntity {
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/ParametersModel.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/ParametersModel.java
index 8a49c9c..9a3b212 100644
--- a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/ParametersModel.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/ParametersModel.java
@@ -18,39 +18,39 @@ import java.util.Map;
public class ParametersModel {
- private List<LocationConstraintsModel> locationConstraints;
-
- private List<ResourceModel> resources;
-
- private Map<String, String> requestInputs;
-
- public List<LocationConstraintsModel> getLocationConstraints(){
- return locationConstraints;
- }
-
- public void setLocationConstraints(List<LocationConstraintsModel> locationConstraints) {
- this.locationConstraints = locationConstraints;
- }
-
- public List<ResourceModel> getResources(){
- return resources;
- }
-
- public void setResources(List<ResourceModel> resources) {
- this.resources = resources;
- }
-
- public Map<String, String> getRequestInputs() {
- return requestInputs;
- }
-
- public void setRequestInputs(Map<String, String> requestInputs) {
- this.requestInputs = requestInputs;
- }
-
- @Override
+ private List<LocationConstraintsModel> locationConstraints;
+
+ private List<ResourceModel> resources;
+
+ private Map<String, String> requestInputs;
+
+ public List<LocationConstraintsModel> getLocationConstraints() {
+ return locationConstraints;
+ }
+
+ public void setLocationConstraints(List<LocationConstraintsModel> locationConstraints) {
+ this.locationConstraints = locationConstraints;
+ }
+
+ public List<ResourceModel> getResources() {
+ return resources;
+ }
+
+ public void setResources(List<ResourceModel> resources) {
+ this.resources = resources;
+ }
+
+ public Map<String, String> getRequestInputs() {
+ return requestInputs;
+ }
+
+ public void setRequestInputs(Map<String, String> requestInputs) {
+ this.requestInputs = requestInputs;
+ }
+
+ @Override
public String toString() {
- return "ParametersModel{" + "locationConstraints=" + locationConstraints + ", resources=" + resources + ", requestInputs="
- + requestInputs + '}';
+ return "ParametersModel{" + "locationConstraints=" + locationConstraints + ", resources=" + resources
+ + ", requestInputs=" + requestInputs + '}';
}
}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/Project.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/Project.java
index fca5391..da362b8 100644
--- a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/Project.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/Project.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.nbi.apis.serviceorder.model.consumer;
public class Project {
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/Request.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/Request.java
index 11298b9..d4a93f3 100644
--- a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/Request.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/Request.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.nbi.apis.serviceorder.model.consumer;
import java.util.Objects;
@@ -21,7 +22,8 @@ public class Request {
private RequestStatus requestStatus;
- public Request() {}
+ public Request() {
+ }
public Request(RequestStatus requestStatus) {
this.requestStatus = requestStatus;
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/RequestDetails.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/RequestDetails.java
index 748af0d..4a38369 100644
--- a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/RequestDetails.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/RequestDetails.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.nbi.apis.serviceorder.model.consumer;
public class RequestDetails {
@@ -89,14 +90,8 @@ public class RequestDetails {
@Override
public String toString() {
- return "RequestDetails{" +
- "modelInfo=" + modelInfo +
- ", subscriberInfo=" + subscriberInfo +
- ", requestInfo=" + requestInfo +
- ", requestParameters=" + requestParameters +
- ", cloudConfiguration=" + cloudConfiguration +
- ", owningEntity=" + owningEntity +
- ", project=" + project +
- '}';
+ return "RequestDetails{" + "modelInfo=" + modelInfo + ", subscriberInfo=" + subscriberInfo + ", requestInfo="
+ + requestInfo + ", requestParameters=" + requestParameters + ", cloudConfiguration="
+ + cloudConfiguration + ", owningEntity=" + owningEntity + ", project=" + project + '}';
}
}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/RequestInfo.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/RequestInfo.java
index 82fb2c7..3aa54cc 100644
--- a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/RequestInfo.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/RequestInfo.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.nbi.apis.serviceorder.model.consumer;
public class RequestInfo {
@@ -59,11 +60,7 @@ public class RequestInfo {
@Override
public String toString() {
- return "RequestInfo{" +
- "instanceName='" + instanceName + '\'' +
- ", source='" + source + '\'' +
- ", suppressRollback=" + suppressRollback +
- ", requestorId='" + requestorId + '\'' +
- '}';
+ return "RequestInfo{" + "instanceName='" + instanceName + '\'' + ", source='" + source + '\''
+ + ", suppressRollback=" + suppressRollback + ", requestorId='" + requestorId + '\'' + '}';
}
}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/RequestParameters.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/RequestParameters.java
index 147ad71..6df6843 100644
--- a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/RequestParameters.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/RequestParameters.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.nbi.apis.serviceorder.model.consumer;
import java.util.List;
@@ -78,11 +79,7 @@ public class RequestParameters {
@Override
public String toString() {
- return "RequestParameters{" +
- "subscriptionServiceType='" + subscriptionServiceType + '\'' +
- ", userParams=" + userParams +
- ", aLaCarte=" + aLaCarte +
- ", testApi='" + testApi + '\'' +
- '}';
+ return "RequestParameters{" + "subscriptionServiceType='" + subscriptionServiceType + '\'' + ", userParams="
+ + userParams + ", aLaCarte=" + aLaCarte + ", testApi='" + testApi + '\'' + '}';
}
}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/RequestReferences.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/RequestReferences.java
index 2f74f73..965c88b 100644
--- a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/RequestReferences.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/RequestReferences.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.nbi.apis.serviceorder.model.consumer;
public class RequestReferences {
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/RequestState.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/RequestState.java
index 90059db..804fd29 100644
--- a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/RequestState.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/RequestState.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.nbi.apis.serviceorder.model.consumer;
import com.fasterxml.jackson.annotation.JsonCreator;
@@ -50,6 +51,4 @@ public enum RequestState {
return this.value;
}
-
-
}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/RequestStatus.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/RequestStatus.java
index 27cfc96..de42c71 100644
--- a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/RequestStatus.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/RequestStatus.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.nbi.apis.serviceorder.model.consumer;
import java.util.Objects;
@@ -28,7 +29,8 @@ public class RequestStatus {
this.percentProgress = percentProgress;
}
- public RequestStatus() {}
+ public RequestStatus() {
+ }
public RequestState getRequestState() {
return requestState;
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/ResourceModel.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/ResourceModel.java
index 9faef49..f47d768 100644
--- a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/ResourceModel.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/ResourceModel.java
@@ -17,71 +17,68 @@ import java.util.*;
public class ResourceModel {
- private String resourceName;
-
- private String resourceInvariantUuid;
-
- private String resourceUuid;
-
- private String resourceCustomizationUuid;
-
- private ParametersModel parameters;
-
-
- public ResourceModel (Map<String, Object> info) {
- setResourceName((String)info.get("name"));
- setResourceInvariantUuid((String)info.get("resourceInvariantUUID"));
- setResourceUuid((String)info.get("id"));
- setResourceCustomizationUuid((String)info.get("modelCustomizationId"));
- }
-
- public String getResourceName() {
- return resourceName;
- }
-
- public void setResourceName(String resourceName) {
- this.resourceName = resourceName;
- }
-
- public String getResourceInvariantUuid() {
- return resourceInvariantUuid;
- }
-
- public void setResourceInvariantUuid(String resourceInvariantUuid) {
- this.resourceInvariantUuid = resourceInvariantUuid;
- }
-
- public String getResourceUuid() {
- return resourceUuid;
- }
-
- public void setResourceUuid(String resourceUuid) {
- this.resourceUuid = resourceUuid;
- }
-
- public String getResourceCustomizationUuid() {
- return resourceCustomizationUuid;
- }
-
- public void setResourceCustomizationUuid(String resourceCustomizationUuid) {
- this.resourceCustomizationUuid = resourceCustomizationUuid;
- }
-
- public ParametersModel getParameters() {
- return parameters;
- }
-
- public void setParameters(ParametersModel parameters) {
- this.parameters = parameters;
- }
-
- @Override
- public String toString() {
- return "ResourceModel{" +
- "resourceName='" + resourceName + '\'' +
- ", resourceInvariantUuid='" + resourceInvariantUuid + '\'' +
- ", resourceUuid='" + resourceUuid + '\'' +
- ", resourceCustomizationUuid='" + resourceCustomizationUuid + '\'' +
- ", parameters='" + parameters + '}';
- }
+ private String resourceName;
+
+ private String resourceInvariantUuid;
+
+ private String resourceUuid;
+
+ private String resourceCustomizationUuid;
+
+ private ParametersModel parameters;
+
+ public ResourceModel(Map<String, Object> info) {
+ setResourceName((String) info.get("name"));
+ setResourceInvariantUuid((String) info.get("resourceInvariantUUID"));
+ setResourceUuid((String) info.get("id"));
+ setResourceCustomizationUuid((String) info.get("modelCustomizationId"));
+ }
+
+ public String getResourceName() {
+ return resourceName;
+ }
+
+ public void setResourceName(String resourceName) {
+ this.resourceName = resourceName;
+ }
+
+ public String getResourceInvariantUuid() {
+ return resourceInvariantUuid;
+ }
+
+ public void setResourceInvariantUuid(String resourceInvariantUuid) {
+ this.resourceInvariantUuid = resourceInvariantUuid;
+ }
+
+ public String getResourceUuid() {
+ return resourceUuid;
+ }
+
+ public void setResourceUuid(String resourceUuid) {
+ this.resourceUuid = resourceUuid;
+ }
+
+ public String getResourceCustomizationUuid() {
+ return resourceCustomizationUuid;
+ }
+
+ public void setResourceCustomizationUuid(String resourceCustomizationUuid) {
+ this.resourceCustomizationUuid = resourceCustomizationUuid;
+ }
+
+ public ParametersModel getParameters() {
+ return parameters;
+ }
+
+ public void setParameters(ParametersModel parameters) {
+ this.parameters = parameters;
+ }
+
+ @Override
+ public String toString() {
+ return "ResourceModel{" + "resourceName='" + resourceName + '\'' + ", resourceInvariantUuid='"
+ + resourceInvariantUuid + '\'' + ", resourceUuid='" + resourceUuid + '\''
+ + ", resourceCustomizationUuid='" + resourceCustomizationUuid + '\'' + ", parameters='" + parameters
+ + '}';
+ }
}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/ServiceModel.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/ServiceModel.java
index f9d475d..982cbfa 100644
--- a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/ServiceModel.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/ServiceModel.java
@@ -14,87 +14,82 @@
package org.onap.nbi.apis.serviceorder.model.consumer;
public class ServiceModel {
-
- private String name;
-
- private String description;
-
- private String serviceInvariantUuid;
-
- private String serviceUuid;
-
- private String globalSubscriberId;
-
- private String serviceType;
-
- private ParametersModel parameters;
-
-
- public String getName() {
+
+ private String name;
+
+ private String description;
+
+ private String serviceInvariantUuid;
+
+ private String serviceUuid;
+
+ private String globalSubscriberId;
+
+ private String serviceType;
+
+ private ParametersModel parameters;
+
+ public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public String getServiceInvariantUuid() {
- return serviceInvariantUuid;
- }
-
- public void setServiceInvariantUuid(String serviceInvariantUuid) {
- this.serviceInvariantUuid = serviceInvariantUuid;
- }
-
- public String getServiceUuid() {
- return serviceUuid;
- }
-
- public void setServiceUuid(String serviceUuid) {
- this.serviceUuid = serviceUuid;
- }
-
- public String getGlobalSubscriberId() {
- return globalSubscriberId;
- }
-
- public void setGlobalSubscriberId(String globalSubscriberId) {
- this.globalSubscriberId = globalSubscriberId;
- }
-
- public String getServiceType() {
- return serviceType;
- }
-
- public void setServiceType(String serviceType) {
- this.serviceType = serviceType;
- }
-
- public ParametersModel getParameters() {
- return parameters;
- }
-
- public void setParameters(ParametersModel parameters) {
- this.parameters = parameters;
- }
-
- @Override
- public String toString() {
- return "ServiceModel{" +
- "name='" + name + '\'' +
- ", description='" + description + '\'' +
- ", serviceInvariantUuid='" + serviceInvariantUuid + '\'' +
- ", serviceUuid='" + serviceUuid + '\'' +
- ", globalSubscriberId='" + globalSubscriberId + '\'' +
- ", serviceType='" + serviceType + '\'' +
- ", parameters='" + parameters + '}';
- }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getServiceInvariantUuid() {
+ return serviceInvariantUuid;
+ }
+
+ public void setServiceInvariantUuid(String serviceInvariantUuid) {
+ this.serviceInvariantUuid = serviceInvariantUuid;
+ }
+
+ public String getServiceUuid() {
+ return serviceUuid;
+ }
+
+ public void setServiceUuid(String serviceUuid) {
+ this.serviceUuid = serviceUuid;
+ }
+
+ public String getGlobalSubscriberId() {
+ return globalSubscriberId;
+ }
+
+ public void setGlobalSubscriberId(String globalSubscriberId) {
+ this.globalSubscriberId = globalSubscriberId;
+ }
+
+ public String getServiceType() {
+ return serviceType;
+ }
+
+ public void setServiceType(String serviceType) {
+ this.serviceType = serviceType;
+ }
+
+ public ParametersModel getParameters() {
+ return parameters;
+ }
+
+ public void setParameters(ParametersModel parameters) {
+ this.parameters = parameters;
+ }
+
+ @Override
+ public String toString() {
+ return "ServiceModel{" + "name='" + name + '\'' + ", description='" + description + '\''
+ + ", serviceInvariantUuid='" + serviceInvariantUuid + '\'' + ", serviceUuid='" + serviceUuid + '\''
+ + ", globalSubscriberId='" + globalSubscriberId + '\'' + ", serviceType='" + serviceType + '\''
+ + ", parameters='" + parameters + '}';
+ }
}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/ServiceResponse.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/ServiceResponse.java
index 18ecc19..661faee 100644
--- a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/ServiceResponse.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/ServiceResponse.java
@@ -14,8 +14,8 @@
package org.onap.nbi.apis.serviceorder.model.consumer;
public class ServiceResponse {
-
- private String operationId = null;
+
+ private String operationId = null;
private String serviceId = null;
public String getOperationId() {
@@ -33,7 +33,7 @@ public class ServiceResponse {
public void setServiceId(String serviceId) {
this.serviceId = serviceId;
}
-
+
@Override
public String toString() {
return "service{" + "operationId='" + operationId + '\'' + ", serviceId='" + serviceId + '\'' + '}';
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/SubscriberInfo.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/SubscriberInfo.java
index 3e0ce49..53d3156 100644
--- a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/SubscriberInfo.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/SubscriberInfo.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.nbi.apis.serviceorder.model.consumer;
public class SubscriberInfo {
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/UserParams.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/UserParams.java
index 4bcdcb6..230b9d1 100644
--- a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/UserParams.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/UserParams.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.nbi.apis.serviceorder.model.consumer;
public class UserParams {
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/VnfLocationConstraintsModel.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/VnfLocationConstraintsModel.java
index 99f5a7c..4f0ae74 100644
--- a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/VnfLocationConstraintsModel.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/VnfLocationConstraintsModel.java
@@ -15,21 +15,18 @@ package org.onap.nbi.apis.serviceorder.model.consumer;
public class VnfLocationConstraintsModel {
- private String vimId;
-
-
- public String getVimId() {
- return vimId;
- }
-
- public void setVimId(String vimId) {
- this.vimId = vimId;
- }
+ private String vimId;
- @Override
+ public String getVimId() {
+ return vimId;
+ }
+
+ public void setVimId(String vimId) {
+ this.vimId = vimId;
+ }
+
+ @Override
public String toString() {
- return "VnfLocationConstraintsModel{" +
- "vimId='" + vimId + '\'' +
- '}';
+ return "VnfLocationConstraintsModel{" + "vimId='" + vimId + '\'' + '}';
}
}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/orchestrator/ExecutionTask.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/orchestrator/ExecutionTask.java
index 1580cba..ccf7aa3 100644
--- a/src/main/java/org/onap/nbi/apis/serviceorder/model/orchestrator/ExecutionTask.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/orchestrator/ExecutionTask.java
@@ -10,6 +10,7 @@
* 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.nbi.apis.serviceorder.model.orchestrator;
import java.util.Date;
@@ -23,7 +24,6 @@ import javax.persistence.Lob;
@Entity
public class ExecutionTask {
-
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long internalId;
@@ -96,12 +96,10 @@ public class ExecutionTask {
return false;
}
ExecutionTask that = (ExecutionTask) o;
- return Objects.equals(internalId, that.internalId) &&
- Objects.equals(orderItemId, that.orderItemId) &&
- Objects.equals(reliedTasks, that.reliedTasks) &&
- Objects.equals(createDate, that.createDate) &&
- Objects.equals(lastAttemptDate, that.lastAttemptDate) &&
- Objects.equals(serviceOrderInfoJson, that.serviceOrderInfoJson);
+ return Objects.equals(internalId, that.internalId) && Objects.equals(orderItemId, that.orderItemId)
+ && Objects.equals(reliedTasks, that.reliedTasks) && Objects.equals(createDate, that.createDate)
+ && Objects.equals(lastAttemptDate, that.lastAttemptDate)
+ && Objects.equals(serviceOrderInfoJson, that.serviceOrderInfoJson);
}
@Override
@@ -111,13 +109,8 @@ public class ExecutionTask {
@Override
public String toString() {
- return "ExecutionTask{" +
- "internalId=" + internalId +
- ", orderItemId='" + orderItemId + '\'' +
- ", reliedTasks='" + reliedTasks + '\'' +
- ", createDate=" + createDate +
- ", lastAttemptDate=" + lastAttemptDate +
- ", serviceOrderInfoJson='" + serviceOrderInfoJson + '\'' +
- '}';
+ return "ExecutionTask{" + "internalId=" + internalId + ", orderItemId='" + orderItemId + '\''
+ + ", reliedTasks='" + reliedTasks + '\'' + ", createDate=" + createDate + ", lastAttemptDate="
+ + lastAttemptDate + ", serviceOrderInfoJson='" + serviceOrderInfoJson + '\'' + '}';
}
}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/orchestrator/ServiceOrderInfo.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/orchestrator/ServiceOrderInfo.java
index 2068fdf..61a744e 100644
--- a/src/main/java/org/onap/nbi/apis/serviceorder/model/orchestrator/ServiceOrderInfo.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/orchestrator/ServiceOrderInfo.java
@@ -13,8 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.onap.nbi.apis.serviceorder.model.orchestrator;
+package org.onap.nbi.apis.serviceorder.model.orchestrator;
import org.onap.nbi.apis.serviceorder.model.consumer.SubscriberInfo;
import java.util.HashMap;
@@ -25,9 +25,9 @@ public class ServiceOrderInfo {
private boolean useServiceOrderCustomer;
private SubscriberInfo subscriberInfo;
private Map<String, ServiceOrderItemInfo> serviceOrderItemInfos = new HashMap<>();
- private boolean allItemsInAdd= true;
+ private boolean allItemsInAdd = true;
private boolean allItemsCompleted;
- private boolean serviceOrderRejected= false;
+ private boolean serviceOrderRejected = false;
private String serviceOrderId;
private String owningEntityId;
@@ -87,7 +87,6 @@ public class ServiceOrderInfo {
this.subscriberInfo = subscriberInfo;
}
-
public boolean isUseServiceOrderCustomer() {
return useServiceOrderCustomer;
}
@@ -96,5 +95,4 @@ public class ServiceOrderInfo {
this.useServiceOrderCustomer = useServiceOrderCustomer;
}
-
}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/orchestrator/ServiceOrderItemInfo.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/orchestrator/ServiceOrderItemInfo.java
index 71f36a6..3316d8e 100644
--- a/src/main/java/org/onap/nbi/apis/serviceorder/model/orchestrator/ServiceOrderItemInfo.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/orchestrator/ServiceOrderItemInfo.java
@@ -13,8 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.onap.nbi.apis.serviceorder.model.orchestrator;
+package org.onap.nbi.apis.serviceorder.model.orchestrator;
import java.util.Map;
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/repositories/ExecutionTaskRepository.java b/src/main/java/org/onap/nbi/apis/serviceorder/repositories/ExecutionTaskRepository.java
index 31f395a..a9dd8e7 100644
--- a/src/main/java/org/onap/nbi/apis/serviceorder/repositories/ExecutionTaskRepository.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/repositories/ExecutionTaskRepository.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.nbi.apis.serviceorder.repositories;
import org.onap.nbi.apis.serviceorder.model.orchestrator.ExecutionTask;
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/repositories/ServiceOrderRepository.java b/src/main/java/org/onap/nbi/apis/serviceorder/repositories/ServiceOrderRepository.java
index aff55f9..97b96d0 100644
--- a/src/main/java/org/onap/nbi/apis/serviceorder/repositories/ServiceOrderRepository.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/repositories/ServiceOrderRepository.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.nbi.apis.serviceorder.repositories;
import org.onap.nbi.apis.serviceorder.model.ServiceOrder;
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/service/ServiceOrderService.java b/src/main/java/org/onap/nbi/apis/serviceorder/service/ServiceOrderService.java
index 2b0f22c..968d7f7 100644
--- a/src/main/java/org/onap/nbi/apis/serviceorder/service/ServiceOrderService.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/service/ServiceOrderService.java
@@ -10,6 +10,7 @@
* 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.nbi.apis.serviceorder.service;
import java.util.Date;
@@ -73,7 +74,6 @@ public class ServiceOrderService {
return serviceOrderRepository.count();
}
-
public void addOrderMessage(ServiceOrder serviceOrder, String code) {
OrderMessage orderMessage = new OrderMessage();
orderMessage.setCode(code);
@@ -118,13 +118,13 @@ public class ServiceOrderService {
if ("102".equalsIgnoreCase(code)) {
orderMessage.setField("serviceSpecification.id");
orderMessage
- .setMessageInformation("Incorrect serviceSpecification.id provided – not found in Catalog (SDC");
+ .setMessageInformation("Incorrect serviceSpecification.id provided – not found in Catalog (SDC");
serviceOrderItem.addOrderItemMessageItem(orderMessage);
}
if ("103".equalsIgnoreCase(code)) {
orderMessage.setField(SERVICE_ID);
orderMessage.setMessageInformation(
- "Inconsistence information provided. service.id must not be provided for add action");
+ "Inconsistence information provided. service.id must not be provided for add action");
serviceOrderItem.addOrderItemMessageItem(orderMessage);
}
if ("105".equalsIgnoreCase(code)) {
@@ -144,9 +144,8 @@ public class ServiceOrderService {
serviceOrderRepository.save(serviceOrder);
}
-
public void addOrderItemMessageRequestSo(ServiceOrder serviceOrder, ServiceOrderItem serviceOrderItem,
- String message) {
+ String message) {
OrderMessage orderMessage = new OrderMessage();
orderMessage.setCode("105");
orderMessage.setSeverity(SeverityMessage.ERROR);
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/serviceordervalidator/ServiceOrderValidator.java b/src/main/java/org/onap/nbi/apis/serviceorder/serviceordervalidator/ServiceOrderValidator.java
index 92955e3..9bd58c8 100644
--- a/src/main/java/org/onap/nbi/apis/serviceorder/serviceordervalidator/ServiceOrderValidator.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/serviceordervalidator/ServiceOrderValidator.java
@@ -13,8 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.onap.nbi.apis.serviceorder.serviceordervalidator;
+package org.onap.nbi.apis.serviceorder.serviceordervalidator;
import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
@@ -25,7 +25,6 @@ import org.springframework.util.StringUtils;
public class ServiceOrderValidator implements ConstraintValidator<ValidServiceOrder, ServiceOrder> {
-
@Override
public boolean isValid(ServiceOrder serviceOrder, ConstraintValidatorContext context) {
for (ServiceOrderItem serviceOrderItem : serviceOrder.getOrderItem()) {
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/serviceordervalidator/ValidServiceOrder.java b/src/main/java/org/onap/nbi/apis/serviceorder/serviceordervalidator/ValidServiceOrder.java
index eeb0bfc..a963f8d 100644
--- a/src/main/java/org/onap/nbi/apis/serviceorder/serviceordervalidator/ValidServiceOrder.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/serviceordervalidator/ValidServiceOrder.java
@@ -13,13 +13,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.nbi.apis.serviceorder.serviceordervalidator;
import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.*;
-
@Target({ElementType.TYPE, ElementType.ANNOTATION_TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Constraint(validatedBy = ServiceOrderValidator.class)
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/utils/E2EServiceUtils.java b/src/main/java/org/onap/nbi/apis/serviceorder/utils/E2EServiceUtils.java
index d667ad8..f675428 100644
--- a/src/main/java/org/onap/nbi/apis/serviceorder/utils/E2EServiceUtils.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/utils/E2EServiceUtils.java
@@ -18,14 +18,16 @@ import java.util.Map;
import org.onap.nbi.apis.serviceorder.model.orchestrator.ServiceOrderItemInfo;
public class E2EServiceUtils {
- public static boolean isE2EService(ServiceOrderItemInfo serviceOrderItemInfo){
- Map<String,Object> sdcInfos = serviceOrderItemInfo.getCatalogResponse();
+ public static boolean isE2EService(ServiceOrderItemInfo serviceOrderItemInfo) {
+ Map<String, Object> sdcInfos = serviceOrderItemInfo.getCatalogResponse();
boolean e2eService = false;
- if(sdcInfos.get("category")!=null){
- String category = ((String)sdcInfos.get("category")).toLowerCase();
- // Until SO comes up with one consolidated API for Service CRUD, ExtAPI has to be handle SO (serviceInstance and e2eServiceInstances )APIs for service CRUD
- // All E2E Services are required to be created in SDC under category "E2E Services" until SO fixes the multiple API issue.
- if(category.startsWith("e2e")) {
+ if (sdcInfos.get("category") != null) {
+ String category = ((String) sdcInfos.get("category")).toLowerCase();
+ // Until SO comes up with one consolidated API for Service CRUD, ExtAPI has to be handle SO (serviceInstance
+ // and e2eServiceInstances )APIs for service CRUD
+ // All E2E Services are required to be created in SDC under category "E2E Services" until SO fixes the
+ // multiple API issue.
+ if (category.startsWith("e2e")) {
e2eService = true;
}
}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/utils/JsonEntityConverter.java b/src/main/java/org/onap/nbi/apis/serviceorder/utils/JsonEntityConverter.java
index 1821f0a..2bca722 100644
--- a/src/main/java/org/onap/nbi/apis/serviceorder/utils/JsonEntityConverter.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/utils/JsonEntityConverter.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.nbi.apis.serviceorder.utils;
import com.fasterxml.jackson.databind.MappingJsonFactory;
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/workflow/CheckOrderConsistenceManager.java b/src/main/java/org/onap/nbi/apis/serviceorder/workflow/CheckOrderConsistenceManager.java
index 4ef802e..3ec1196 100644
--- a/src/main/java/org/onap/nbi/apis/serviceorder/workflow/CheckOrderConsistenceManager.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/workflow/CheckOrderConsistenceManager.java
@@ -6,6 +6,7 @@
* either express or implied. See the License for the specific language governing permissions and limitations under the
* License.
*/
+
package org.onap.nbi.apis.serviceorder.workflow;
import java.util.Map;
@@ -28,14 +29,12 @@ import org.springframework.util.StringUtils;
@Service
public class CheckOrderConsistenceManager {
-
@Autowired
private MultiClient serviceOrderConsumerService;
@Autowired
private ServiceOrderService serviceOrderService;
-
private static final Logger LOGGER = LoggerFactory.getLogger(CheckOrderConsistenceManager.class);
public ServiceOrderInfo checkServiceOrder(ServiceOrder serviceOrder) {
@@ -46,25 +45,25 @@ public class CheckOrderConsistenceManager {
for (ServiceOrderItem serviceOrderItem : serviceOrder.getOrderItem()) {
ServiceOrderItemInfo serviceOrderItemInfo = new ServiceOrderItemInfo();
- handleServiceFromCatalog(serviceOrderItem,serviceOrder, serviceOrderItemInfo);
+ handleServiceFromCatalog(serviceOrderItem, serviceOrder, serviceOrderItemInfo);
if (!existServiceInCatalog(serviceOrderItemInfo)) {
serviceOrderInfo.setIsServiceOrderRejected(true);
serviceOrderService.updateOrderItemState(serviceOrder, serviceOrderItem, StateType.REJECTED);
LOGGER.warn(
- "service order item {} of service order {} rejected cause no service catalog found for id {}",
- serviceOrderItem.getId(), serviceOrder.getId(),
- serviceOrderItem.getService().getServiceSpecification().getId());
- serviceOrderService.addOrderItemMessage(serviceOrder,serviceOrderItem, "102");
+ "service order item {} of service order {} rejected cause no service catalog found for id {}",
+ serviceOrderItem.getId(), serviceOrder.getId(),
+ serviceOrderItem.getService().getServiceSpecification().getId());
+ serviceOrderService.addOrderItemMessage(serviceOrder, serviceOrderItem, "102");
} else {
switch (serviceOrderItem.getAction()) {
case ADD:
handleServiceOrderItemInAdd(serviceOrderInfo, serviceOrder, serviceOrderItem,
- serviceOrderItemInfo);
+ serviceOrderItemInfo);
break;
case MODIFY:
case DELETE:
handleServiceOrderItemInChange(serviceOrderInfo, serviceOrder, serviceOrderItem,
- serviceOrderItemInfo);
+ serviceOrderItemInfo);
break;
case NOCHANGE:
serviceOrderInfo.setAllItemsInAdd(false);
@@ -86,12 +85,11 @@ public class CheckOrderConsistenceManager {
}
- private void handleServiceOrderItemInChange(ServiceOrderInfo serviceOrderInfo,
- ServiceOrder serviceOrder, ServiceOrderItem serviceOrderItem,
- ServiceOrderItemInfo serviceOrderItemInfo) {
+ private void handleServiceOrderItemInChange(ServiceOrderInfo serviceOrderInfo, ServiceOrder serviceOrder,
+ ServiceOrderItem serviceOrderItem, ServiceOrderItemInfo serviceOrderItemInfo) {
serviceOrderInfo.setAllItemsInAdd(false);
if (shouldAcceptServiceOrderItemToChange(serviceOrderInfo, serviceOrder, serviceOrderItem,
- serviceOrderItemInfo)) {
+ serviceOrderItemInfo)) {
serviceOrderInfo.addServiceOrderItemInfos(serviceOrderItem.getId(), serviceOrderItemInfo);
} else {
serviceOrderInfo.setIsServiceOrderRejected(true);
@@ -99,11 +97,11 @@ public class CheckOrderConsistenceManager {
}
}
- private void handleServiceOrderItemInAdd(ServiceOrderInfo serviceOrderInfo,
- ServiceOrder serviceOrder, ServiceOrderItem serviceOrderItem,
- ServiceOrderItemInfo serviceOrderItemInfo) {
- boolean e2eService= E2EServiceUtils.isE2EService(serviceOrderItemInfo);
- if (shouldAcceptServiceOrderItemToAdd(serviceOrderItem, serviceOrder, serviceOrderInfo.getServiceOrderId(), e2eService)) {
+ private void handleServiceOrderItemInAdd(ServiceOrderInfo serviceOrderInfo, ServiceOrder serviceOrder,
+ ServiceOrderItem serviceOrderItem, ServiceOrderItemInfo serviceOrderItemInfo) {
+ boolean e2eService = E2EServiceUtils.isE2EService(serviceOrderItemInfo);
+ if (shouldAcceptServiceOrderItemToAdd(serviceOrderItem, serviceOrder, serviceOrderInfo.getServiceOrderId(),
+ e2eService)) {
serviceOrderInfo.addServiceOrderItemInfos(serviceOrderItem.getId(), serviceOrderItemInfo);
} else {
serviceOrderInfo.setIsServiceOrderRejected(true);
@@ -111,47 +109,43 @@ public class CheckOrderConsistenceManager {
}
}
- private boolean shouldAcceptServiceOrderItemToAdd(ServiceOrderItem serviceOrderItem,
- ServiceOrder serviceOrder, String serviceOrderId, Boolean e2eService) {
+ private boolean shouldAcceptServiceOrderItemToAdd(ServiceOrderItem serviceOrderItem, ServiceOrder serviceOrder,
+ String serviceOrderId, Boolean e2eService) {
if (!StringUtils.isEmpty(serviceOrderItem.getService().getId())) {
- LOGGER
- .warn("serviceOrderItem {} for serviceorder {} rejected cause service.id must be empty in add action",
+ LOGGER.warn("serviceOrderItem {} for serviceorder {} rejected cause service.id must be empty in add action",
serviceOrderItem.getId(), serviceOrderId);
- serviceOrderService.addOrderItemMessage(serviceOrder,serviceOrderItem, "103");
+ serviceOrderService.addOrderItemMessage(serviceOrder, serviceOrderItem, "103");
return false;
} else if (!e2eService && !serviceOrderConsumerService.isTenantIdPresentInAAI(serviceOrder)) {
LOGGER.warn("serviceOrderItem {} for serviceOrder {} rejected cause tenantId not found in AAI",
- serviceOrderItem.getId(), serviceOrderId);
- serviceOrderService.addOrderMessage(serviceOrder,"503");
+ serviceOrderItem.getId(), serviceOrderId);
+ serviceOrderService.addOrderMessage(serviceOrder, "503");
return false;
}
return true;
}
- private boolean shouldAcceptServiceOrderItemToChange(ServiceOrderInfo serviceOrderInfo,
- ServiceOrder serviceOrder, ServiceOrderItem serviceOrderItem,
- ServiceOrderItemInfo serviceOrderItemInfo) {
+ private boolean shouldAcceptServiceOrderItemToChange(ServiceOrderInfo serviceOrderInfo, ServiceOrder serviceOrder,
+ ServiceOrderItem serviceOrderItem, ServiceOrderItemInfo serviceOrderItemInfo) {
if (StringUtils.isEmpty(serviceOrderItem.getService().getId())) {
LOGGER.warn(
- "serviceOrderItem {} for serviceOrder {} rejected cause service.id is mandatory in delete/change action",
- serviceOrderItem.getId(), serviceOrderInfo.getServiceOrderId());
- serviceOrderService.addOrderItemMessage(serviceOrder,serviceOrderItem, "101");
+ "serviceOrderItem {} for serviceOrder {} rejected cause service.id is mandatory in delete/change action",
+ serviceOrderItem.getId(), serviceOrderInfo.getServiceOrderId());
+ serviceOrderService.addOrderItemMessage(serviceOrder, serviceOrderItem, "101");
return false;
- } else if (!isCustomerFromServiceOrderPresentInInventory(serviceOrderInfo,serviceOrder)) {
- LOGGER
- .warn("serviceOrderItem {} for serviceOrder {} rejected cause customer not found in inventory",
+ } else if (!isCustomerFromServiceOrderPresentInInventory(serviceOrderInfo, serviceOrder)) {
+ LOGGER.warn("serviceOrderItem {} for serviceOrder {} rejected cause customer not found in inventory",
serviceOrderItem.getId(), serviceOrderInfo.getServiceOrderId());
serviceOrderService.addOrderMessage(serviceOrder, "104");
return false;
} else if (!existServiceInInventory(serviceOrderItem, serviceOrder, serviceOrderItemInfo,
- serviceOrderInfo.getSubscriberInfo().getGlobalSubscriberId())) {
- LOGGER
- .warn("serviceOrderItem {} for serviceOrder {} rejected cause service id {} not found in inventory",
+ serviceOrderInfo.getSubscriberInfo().getGlobalSubscriberId())) {
+ LOGGER.warn("serviceOrderItem {} for serviceOrder {} rejected cause service id {} not found in inventory",
serviceOrderItem.getId(), serviceOrderInfo.getServiceOrderId(),
serviceOrderItem.getService().getId());
- serviceOrderService.addOrderItemMessage(serviceOrder,serviceOrderItem, "106");
+ serviceOrderService.addOrderItemMessage(serviceOrder, serviceOrderItem, "106");
return false;
}
return true;
@@ -173,7 +167,6 @@ public class CheckOrderConsistenceManager {
}
-
private RelatedParty getCustomerFromServiceOrder(ServiceOrder serviceOrder) {
if (serviceOrder.getRelatedParty() != null) {
for (RelatedParty relatedParty : serviceOrder.getRelatedParty()) {
@@ -186,31 +179,30 @@ public class CheckOrderConsistenceManager {
}
private boolean isCustomerFromServiceOrderPresentInInventory(ServiceOrderInfo serviceOrderInfo,
- ServiceOrder serviceOrder) {
+ ServiceOrder serviceOrder) {
if (serviceOrderInfo.isUseServiceOrderCustomer()) {
return serviceOrderConsumerService
- .isCustomerPresentInAAI(serviceOrderInfo.getSubscriberInfo().getGlobalSubscriberId(),serviceOrder);
+ .isCustomerPresentInAAI(serviceOrderInfo.getSubscriberInfo().getGlobalSubscriberId(), serviceOrder);
}
return true;
}
- private boolean existServiceInInventory(ServiceOrderItem serviceOrderItem,
- ServiceOrder serviceOrder, ServiceOrderItemInfo serviceOrderItemInfo,
- String globalSubscriberId) {
+ private boolean existServiceInInventory(ServiceOrderItem serviceOrderItem, ServiceOrder serviceOrder,
+ ServiceOrderItemInfo serviceOrderItemInfo, String globalSubscriberId) {
String serviceName = (String) serviceOrderItemInfo.getCatalogResponse().get("name");
- return serviceOrderConsumerService.doesServiceExistInServiceInventory(
- serviceOrderItem.getService().getId(), serviceName, globalSubscriberId,serviceOrder);
+ return serviceOrderConsumerService.doesServiceExistInServiceInventory(serviceOrderItem.getService().getId(),
+ serviceName, globalSubscriberId, serviceOrder);
}
private boolean existServiceInCatalog(ServiceOrderItemInfo serviceOrderItemInfo) {
return serviceOrderItemInfo.getCatalogResponse() != null;
}
- private void handleServiceFromCatalog(ServiceOrderItem serviceOrderItem,
- ServiceOrder serviceOrder, ServiceOrderItemInfo serviceOrderItemInfo) {
- Map body = serviceOrderConsumerService
- .getServiceCatalog(serviceOrderItem.getService().getServiceSpecification().getId(),serviceOrder,serviceOrderItem);
+ private void handleServiceFromCatalog(ServiceOrderItem serviceOrderItem, ServiceOrder serviceOrder,
+ ServiceOrderItemInfo serviceOrderItemInfo) {
+ Map body = serviceOrderConsumerService.getServiceCatalog(
+ serviceOrderItem.getService().getServiceSpecification().getId(), serviceOrder, serviceOrderItem);
serviceOrderItemInfo.setCatalogResponse(body);
}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/workflow/CreateAAICustomerManager.java b/src/main/java/org/onap/nbi/apis/serviceorder/workflow/CreateAAICustomerManager.java
index d3710a9..a0ca00b 100644
--- a/src/main/java/org/onap/nbi/apis/serviceorder/workflow/CreateAAICustomerManager.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/workflow/CreateAAICustomerManager.java
@@ -10,6 +10,7 @@
* 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.nbi.apis.serviceorder.workflow;
import org.onap.nbi.apis.serviceorder.MultiClient;
@@ -25,7 +26,6 @@ import org.springframework.stereotype.Service;
@Service
public class CreateAAICustomerManager {
-
@Autowired
private MultiClient serviceOrderConsumerService;
@@ -34,25 +34,20 @@ public class CreateAAICustomerManager {
private static final Logger LOGGER = LoggerFactory.getLogger(CreateAAICustomerManager.class);
-
-
- public void createAAICustomer(ServiceOrder serviceOrder,
- ServiceOrderInfo serviceOrderInfo) {
+ public void createAAICustomer(ServiceOrder serviceOrder, ServiceOrderInfo serviceOrderInfo) {
if (serviceOrderInfo.isUseServiceOrderCustomer() && serviceOrderInfo.isAllItemsInAdd()
- && !serviceOrderConsumerService
- .isCustomerPresentInAAI(serviceOrderInfo.getSubscriberInfo().getGlobalSubscriberId(), serviceOrder)) {
+ && !serviceOrderConsumerService.isCustomerPresentInAAI(
+ serviceOrderInfo.getSubscriberInfo().getGlobalSubscriberId(), serviceOrder)) {
- boolean customerCreated = serviceOrderConsumerService.putCustomer(serviceOrderInfo.getSubscriberInfo(), serviceOrder);
+ boolean customerCreated =
+ serviceOrderConsumerService.putCustomer(serviceOrderInfo.getSubscriberInfo(), serviceOrder);
if (!customerCreated) {
- serviceOrderService.updateOrderState(serviceOrder,StateType.REJECTED);
+ serviceOrderService.updateOrderState(serviceOrder, StateType.REJECTED);
LOGGER.warn("serviceOrder {} rejected : cannot create customer", serviceOrder.getId());
serviceOrderService.addOrderMessage(serviceOrder, "501");
}
}
}
-
}
-
-
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/workflow/CreateAAIOwningEntityManager.java b/src/main/java/org/onap/nbi/apis/serviceorder/workflow/CreateAAIOwningEntityManager.java
index 27cb6c8..3d1d291 100644
--- a/src/main/java/org/onap/nbi/apis/serviceorder/workflow/CreateAAIOwningEntityManager.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/workflow/CreateAAIOwningEntityManager.java
@@ -10,6 +10,7 @@
* 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.nbi.apis.serviceorder.workflow;
import org.onap.nbi.apis.serviceorder.MultiClient;
@@ -26,7 +27,6 @@ import org.springframework.stereotype.Service;
@Service
public class CreateAAIOwningEntityManager {
-
@Autowired
private MultiClient serviceOrderConsumerService;
@@ -36,16 +36,13 @@ public class CreateAAIOwningEntityManager {
@Value("${so.owning.entity.id}")
private String owningEntityId;
-
private static final Logger LOGGER = LoggerFactory.getLogger(CreateAAIOwningEntityManager.class);
+ public void createAAIOwningEntity(ServiceOrder serviceOrder, ServiceOrderInfo serviceOrderInfo) {
- public void createAAIOwningEntity(ServiceOrder serviceOrder,
- ServiceOrderInfo serviceOrderInfo) {
-
- String owningEntityIdToSo=serviceOrderConsumerService.getOwningEntityIdInAAI(serviceOrder);
- if (owningEntityIdToSo==null) {
- owningEntityIdToSo=owningEntityId;
+ String owningEntityIdToSo = serviceOrderConsumerService.getOwningEntityIdInAAI(serviceOrder);
+ if (owningEntityIdToSo == null) {
+ owningEntityIdToSo = owningEntityId;
boolean owningEntity = serviceOrderConsumerService.putOwningEntity(serviceOrder);
if (!owningEntity) {
serviceOrderService.updateOrderState(serviceOrder, StateType.REJECTED);
@@ -56,7 +53,4 @@ public class CreateAAIOwningEntityManager {
serviceOrderInfo.setOwningEntityId(owningEntityIdToSo);
}
-
}
-
-
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/workflow/CreateAAIServiceTypeManager.java b/src/main/java/org/onap/nbi/apis/serviceorder/workflow/CreateAAIServiceTypeManager.java
index baf7e7f..a8e4047 100644
--- a/src/main/java/org/onap/nbi/apis/serviceorder/workflow/CreateAAIServiceTypeManager.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/workflow/CreateAAIServiceTypeManager.java
@@ -10,6 +10,7 @@
* 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.nbi.apis.serviceorder.workflow;
import org.onap.nbi.apis.serviceorder.MultiClient;
@@ -38,27 +39,26 @@ public class CreateAAIServiceTypeManager {
@Autowired
ServiceOrderService serviceOrderService;
-
private static final Logger LOGGER = LoggerFactory.getLogger(CreateAAIServiceTypeManager.class);
public void createAAIServiceType(ServiceOrder serviceOrder, ServiceOrderInfo serviceOrderInfo) {
- Map servicesInAaiForCustomer = serviceOrderConsumerService
- .getServicesInAaiForCustomer(serviceOrderInfo.getSubscriberInfo().getGlobalSubscriberId(), serviceOrder);
+ Map servicesInAaiForCustomer = serviceOrderConsumerService.getServicesInAaiForCustomer(
+ serviceOrderInfo.getSubscriberInfo().getGlobalSubscriberId(), serviceOrder);
for (ServiceOrderItem serviceOrderItem : serviceOrder.getOrderItem()) {
if (ActionType.ADD == serviceOrderItem.getAction()) {
ServiceOrderItemInfo serviceOrderItemInfo =
- serviceOrderInfo.getServiceOrderItemInfos().get(serviceOrderItem.getId());
+ serviceOrderInfo.getServiceOrderItemInfos().get(serviceOrderItem.getId());
String sdcServiceName = (String) serviceOrderItemInfo.getCatalogResponse().get("name");
if (!serviceNameExistsInAAI(servicesInAaiForCustomer, sdcServiceName)) {
boolean serviceCreated = serviceOrderConsumerService.putServiceType(
- serviceOrderInfo.getSubscriberInfo().getGlobalSubscriberId(), sdcServiceName, serviceOrder);
+ serviceOrderInfo.getSubscriberInfo().getGlobalSubscriberId(), sdcServiceName, serviceOrder);
if (!serviceCreated) {
- serviceOrderService.updateOrderState(serviceOrder,StateType.REJECTED);
+ serviceOrderService.updateOrderState(serviceOrder, StateType.REJECTED);
LOGGER.warn("serviceOrder {} rejected : cannot create service type {} for customer {}",
- serviceOrder.getId(), sdcServiceName,
- serviceOrderInfo.getSubscriberInfo().getGlobalSubscriberId());
+ serviceOrder.getId(), sdcServiceName,
+ serviceOrderInfo.getSubscriberInfo().getGlobalSubscriberId());
serviceOrderService.addOrderMessage(serviceOrder, "501");
}
@@ -72,7 +72,7 @@ public class CreateAAIServiceTypeManager {
if (servicesInAaiForCustomer != null && servicesInAaiForCustomer.get("service-subscription") != null) {
List<LinkedHashMap> servicesInAAI =
- (List<LinkedHashMap>) servicesInAaiForCustomer.get("service-subscription");
+ (List<LinkedHashMap>) servicesInAaiForCustomer.get("service-subscription");
for (LinkedHashMap service : servicesInAAI) {
String serviceType = (String) service.get("service-type");
if (sdcServiceName.equalsIgnoreCase(serviceType)) {
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/workflow/ExecutionTaskProcessorScheduler.java b/src/main/java/org/onap/nbi/apis/serviceorder/workflow/ExecutionTaskProcessorScheduler.java
index ee72515..b7c03e7 100644
--- a/src/main/java/org/onap/nbi/apis/serviceorder/workflow/ExecutionTaskProcessorScheduler.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/workflow/ExecutionTaskProcessorScheduler.java
@@ -11,6 +11,7 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
+
package org.onap.nbi.apis.serviceorder.workflow;
import java.util.List;
@@ -27,18 +28,18 @@ import org.springframework.stereotype.Service;
@EnableScheduling
public class ExecutionTaskProcessorScheduler {
- @Autowired
- ExecutionTaskRepository executionTaskRepository;
+ @Autowired
+ ExecutionTaskRepository executionTaskRepository;
- @Autowired
- SOTaskProcessor soTaskProcessor;
+ @Autowired
+ SOTaskProcessor soTaskProcessor;
- // Using fixedDelay to mitigate against Scheduler queue backlog with fixedRate
- @Scheduled(fixedDelayString = "${executionTask.schedule}", initialDelayString = "${executionTask.initial}")
- private void processExecutionPlan() throws InterruptedException {
- List<ExecutionTask> taskToExecute = executionTaskRepository.findByReliedTasksIsEmpty();
- for (ExecutionTask executionTask : taskToExecute) {
- soTaskProcessor.processOrderItem(executionTask);
+ // Using fixedDelay to mitigate against Scheduler queue backlog with fixedRate
+ @Scheduled(fixedDelayString = "${executionTask.schedule}", initialDelayString = "${executionTask.initial}")
+ private void processExecutionPlan() throws InterruptedException {
+ List<ExecutionTask> taskToExecute = executionTaskRepository.findByReliedTasksIsEmpty();
+ for (ExecutionTask executionTask : taskToExecute) {
+ soTaskProcessor.processOrderItem(executionTask);
+ }
}
- }
}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/workflow/PostSoProcessor.java b/src/main/java/org/onap/nbi/apis/serviceorder/workflow/PostSoProcessor.java
index 7fdcdaa..5694cfe 100644
--- a/src/main/java/org/onap/nbi/apis/serviceorder/workflow/PostSoProcessor.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/workflow/PostSoProcessor.java
@@ -11,6 +11,7 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
+
package org.onap.nbi.apis.serviceorder.workflow;
import java.io.IOException;
@@ -57,281 +58,264 @@ import com.fasterxml.jackson.databind.node.ObjectNode;
@Service
public class PostSoProcessor {
- private static final Logger LOGGER = LoggerFactory.getLogger(PostSoProcessor.class);
-
- @Value("${onap.lcpCloudRegionId}")
- private String lcpCloudRegionId;
-
- @Value("${onap.tenantId}")
- private String tenantId;
+ private static final Logger LOGGER = LoggerFactory.getLogger(PostSoProcessor.class);
- @Value("${so.owning.entity.id}")
- private String soOwningEntityId;
+ @Value("${onap.lcpCloudRegionId}")
+ private String lcpCloudRegionId;
- @Value("${so.owning.entity.name}")
- private String soOwningEntityName;
+ @Value("${onap.tenantId}")
+ private String tenantId;
- @Value("${so.project.name}")
- private String soProjectName;
+ @Value("${so.owning.entity.id}")
+ private String soOwningEntityId;
- @Value("${onap.cloudOwner}")
- private String cloudOwner;
+ @Value("${so.owning.entity.name}")
+ private String soOwningEntityName;
- @Autowired
- private ServiceOrderService serviceOrderService;
+ @Value("${so.project.name}")
+ private String soProjectName;
- @Autowired
- private SoClient soClient;
+ @Value("${onap.cloudOwner}")
+ private String cloudOwner;
+ @Autowired
+ private ServiceOrderService serviceOrderService;
+ @Autowired
+ private SoClient soClient;
- public ResponseEntity<CreateServiceInstanceResponse> postServiceOrderItem(
- ServiceOrderInfo serviceOrderInfo, ServiceOrderItem serviceOrderItem) {
- ResponseEntity<CreateServiceInstanceResponse> response = null;
- try {
- response = postSORequest(serviceOrderItem, serviceOrderInfo);
- } catch (NullPointerException e) {
- LOGGER.error(
- "Unable to create service instance for serviceOrderItem.id=" + serviceOrderItem.getId(),
- e);
- response = null;
- }
- return response;
- }
-
- public ResponseEntity<CreateE2EServiceInstanceResponse> postE2EServiceOrderItem(
- ServiceOrderInfo serviceOrderInfo, ServiceOrderItem serviceOrderItem,
- ServiceOrder serviceOrder) {
- ResponseEntity<CreateE2EServiceInstanceResponse> response;
- try {
- response = postE2ESORequest(serviceOrderItem, serviceOrderInfo, serviceOrder);
- } catch (NullPointerException e) {
- LOGGER.error(
- "Unable to create service instance for serviceOrderItem.id=" + serviceOrderItem.getId(),
- e);
- response = null;
- }
- return response;
- }
-
- private ResponseEntity<CreateServiceInstanceResponse> postSORequest(
- ServiceOrderItem serviceOrderItem, ServiceOrderInfo serviceOrderInfo) {
- RequestDetails requestDetails =
- buildSoRequest(serviceOrderItem,serviceOrderInfo);
- MSOPayload msoPayload = new MSOPayload(requestDetails);
- ResponseEntity<CreateServiceInstanceResponse> response = null;
-
- switch (serviceOrderItem.getAction()) {
- case ADD:
- response = soClient.callCreateServiceInstance(msoPayload);
- break;
- case DELETE:
- response =
- soClient.callDeleteServiceInstance(msoPayload, serviceOrderItem.getService().getId());
- break;
- case MODIFY:
- if (StateType.INPROGRESS_MODIFY_ITEM_TO_CREATE == serviceOrderItem.getState()) {
- response = soClient.callCreateServiceInstance(msoPayload);
+ public ResponseEntity<CreateServiceInstanceResponse> postServiceOrderItem(ServiceOrderInfo serviceOrderInfo,
+ ServiceOrderItem serviceOrderItem) {
+ ResponseEntity<CreateServiceInstanceResponse> response = null;
+ try {
+ response = postSORequest(serviceOrderItem, serviceOrderInfo);
+ } catch (NullPointerException e) {
+ LOGGER.error("Unable to create service instance for serviceOrderItem.id=" + serviceOrderItem.getId(), e);
+ response = null;
}
- if (StateType.ACKNOWLEDGED == serviceOrderItem.getState()) {
- response =
- soClient.callDeleteServiceInstance(msoPayload, serviceOrderItem.getService().getId());
- }
- break;
- default:
- break;
+ return response;
}
- return response;
- }
-
- private ResponseEntity<CreateE2EServiceInstanceResponse> postE2ESORequest(
- ServiceOrderItem serviceOrderItem, ServiceOrderInfo serviceOrderInfo,
- ServiceOrder serviceOrder) {
- ServiceModel service =
- buildE2ESoRequest(
- serviceOrderItem, serviceOrderInfo.getServiceOrderItemInfos()
- .get(serviceOrderItem.getId()).getCatalogResponse(),
- serviceOrderInfo.getSubscriberInfo(), serviceOrder);
- MSOE2EPayload msoE2EPayload = new MSOE2EPayload(service);
- ResponseEntity<CreateE2EServiceInstanceResponse> response = null;
- switch (serviceOrderItem.getAction()) {
- case ADD:
- response = soClient.callE2ECreateServiceInstance(msoE2EPayload);
- break;
- case DELETE:
- response = soClient.callE2EDeleteServiceInstance(service.getGlobalSubscriberId(),
- service.getServiceType(), serviceOrderItem.getService().getId());
- break;
- case MODIFY:
- if (StateType.INPROGRESS_MODIFY_ITEM_TO_CREATE == serviceOrderItem.getState()) {
- response = soClient.callE2ECreateServiceInstance(msoE2EPayload);
+
+ public ResponseEntity<CreateE2EServiceInstanceResponse> postE2EServiceOrderItem(ServiceOrderInfo serviceOrderInfo,
+ ServiceOrderItem serviceOrderItem, ServiceOrder serviceOrder) {
+ ResponseEntity<CreateE2EServiceInstanceResponse> response;
+ try {
+ response = postE2ESORequest(serviceOrderItem, serviceOrderInfo, serviceOrder);
+ } catch (NullPointerException e) {
+ LOGGER.error("Unable to create service instance for serviceOrderItem.id=" + serviceOrderItem.getId(), e);
+ response = null;
}
- if (StateType.ACKNOWLEDGED == serviceOrderItem.getState()) {
- response = soClient.callE2EDeleteServiceInstance(service.getGlobalSubscriberId(),
- service.getServiceType(), serviceOrderItem.getService().getId());
+ return response;
+ }
+
+ private ResponseEntity<CreateServiceInstanceResponse> postSORequest(ServiceOrderItem serviceOrderItem,
+ ServiceOrderInfo serviceOrderInfo) {
+ RequestDetails requestDetails = buildSoRequest(serviceOrderItem, serviceOrderInfo);
+ MSOPayload msoPayload = new MSOPayload(requestDetails);
+ ResponseEntity<CreateServiceInstanceResponse> response = null;
+
+ switch (serviceOrderItem.getAction()) {
+ case ADD:
+ response = soClient.callCreateServiceInstance(msoPayload);
+ break;
+ case DELETE:
+ response = soClient.callDeleteServiceInstance(msoPayload, serviceOrderItem.getService().getId());
+ break;
+ case MODIFY:
+ if (StateType.INPROGRESS_MODIFY_ITEM_TO_CREATE == serviceOrderItem.getState()) {
+ response = soClient.callCreateServiceInstance(msoPayload);
+ }
+ if (StateType.ACKNOWLEDGED == serviceOrderItem.getState()) {
+ response = soClient.callDeleteServiceInstance(msoPayload, serviceOrderItem.getService().getId());
+ }
+ break;
+ default:
+ break;
}
- break;
- default:
- break;
+ return response;
}
- return response;
- }
-
-
-
- /**
- * Build SO CREATE request from the ServiceOrder and catalog informations from SDC
- *
- * @param orderItem
- * @param serviceOrderInfo
- * @return
- */
- private RequestDetails buildSoRequest(ServiceOrderItem orderItem,ServiceOrderInfo serviceOrderInfo) {
- RequestDetails requestDetails = new RequestDetails();
-
- requestDetails.setSubscriberInfo( serviceOrderInfo.getSubscriberInfo());
- Map<String, Object> sdcInfos=serviceOrderInfo.getServiceOrderItemInfos()
- .get(orderItem.getId()).getCatalogResponse();
- ModelInfo modelInfo = new ModelInfo();
- modelInfo.setModelType("service");
- modelInfo.setModelInvariantId((String) sdcInfos.get("invariantUUID"));
- modelInfo.setModelNameVersionId(orderItem.getService().getServiceSpecification().getId());
- modelInfo.setModelVersionId(orderItem.getService().getServiceSpecification().getId());
- modelInfo.setModelName((String) sdcInfos.get("name"));
- modelInfo.setModelVersion((String) sdcInfos.get("version"));
- requestDetails.setModelInfo(modelInfo);
-
- RequestInfo requestInfo = new RequestInfo();
- requestInfo.setInstanceName(orderItem.getService().getName());
- requestInfo.setSource("VID");
- requestInfo.setSuppressRollback(false);
- requestInfo.setRequestorId("NBI");
- requestDetails.setRequestInfo(requestInfo);
-
- RequestParameters requestParameters = new RequestParameters();
- requestParameters.setSubscriptionServiceType((String) sdcInfos.get("name"));
- requestParameters.setUserParams(retrieveUserParamsFromServiceCharacteristics(
- orderItem.getService().getServiceCharacteristic()));
- requestParameters.setaLaCarte(true);
- requestParameters.setTestApi("GR_API");
- requestDetails.setRequestParameters(requestParameters);
-
- CloudConfiguration cloudConfiguration = new CloudConfiguration(lcpCloudRegionId, tenantId, cloudOwner);
- requestDetails.setCloudConfiguration(cloudConfiguration);
-
- OwningEntity owningEntity = new OwningEntity();
- owningEntity.setOwningEntityId(serviceOrderInfo.getOwningEntityId());
- owningEntity.setOwningEntityName(soOwningEntityName);
- requestDetails.setOwningEntity(owningEntity);
-
- Project project = new Project();
- project.setProjectName(soProjectName);
-
- requestDetails.setProject(project);
-
- return requestDetails;
- }
-
- /**
- * Build E2E SO CREATE request from the ServiceOrder and catalog informations from SDC
- *
- * @param serviceOrderItem
- * @param serviceOrder
- * @param sdcInfos
- * @return
- */
- // ServiceOrderItem serviceOrderItem --> orderItem?
- private ServiceModel buildE2ESoRequest(ServiceOrderItem serviceOrderItem,
- Map<String, Object> sdcInfos, SubscriberInfo subscriberInfo, ServiceOrder serviceOrder) {
-
- subscriberInfo.getGlobalSubscriberId();
- ServiceModel service = new ServiceModel();
- service.setName(serviceOrderItem.getService().getName());
- service.setDescription(serviceOrder.getDescription());
- service.setServiceUuid(serviceOrderItem.getService().getServiceSpecification().getId());
- service.setServiceInvariantUuid((String) sdcInfos.get("invariantUUID"));
- service.setGlobalSubscriberId(subscriberInfo.getGlobalSubscriberId());
- service.setServiceType((String) sdcInfos.get("name"));
-
- ParametersModel parameters = new ParametersModel();
- ArrayList<ResourceModel> resources = new ArrayList();
-
- ArrayList<Object> resourceObjects = (ArrayList<Object>) sdcInfos.get("resourceSpecification");
-
- for (int i = 0; i < resourceObjects.size(); i++) {
-
- ResourceModel resourceModel = new ResourceModel((Map<String, Object>) resourceObjects.get(i));
- ParametersModel resourceParameters = new ParametersModel();
- resourceModel.setParameters(resourceParameters);
- resources.add(resourceModel);
+ private ResponseEntity<CreateE2EServiceInstanceResponse> postE2ESORequest(ServiceOrderItem serviceOrderItem,
+ ServiceOrderInfo serviceOrderInfo, ServiceOrder serviceOrder) {
+ ServiceModel service = buildE2ESoRequest(serviceOrderItem,
+ serviceOrderInfo.getServiceOrderItemInfos().get(serviceOrderItem.getId()).getCatalogResponse(),
+ serviceOrderInfo.getSubscriberInfo(), serviceOrder);
+ MSOE2EPayload msoE2EPayload = new MSOE2EPayload(service);
+ ResponseEntity<CreateE2EServiceInstanceResponse> response = null;
+ switch (serviceOrderItem.getAction()) {
+ case ADD:
+ response = soClient.callE2ECreateServiceInstance(msoE2EPayload);
+ break;
+ case DELETE:
+ response = soClient.callE2EDeleteServiceInstance(service.getGlobalSubscriberId(),
+ service.getServiceType(), serviceOrderItem.getService().getId());
+ break;
+ case MODIFY:
+ if (StateType.INPROGRESS_MODIFY_ITEM_TO_CREATE == serviceOrderItem.getState()) {
+ response = soClient.callE2ECreateServiceInstance(msoE2EPayload);
+ }
+ if (StateType.ACKNOWLEDGED == serviceOrderItem.getState()) {
+ response = soClient.callE2EDeleteServiceInstance(service.getGlobalSubscriberId(),
+ service.getServiceType(), serviceOrderItem.getService().getId());
+ }
+ break;
+ default:
+ break;
+ }
+ return response;
}
- parameters.setResources(resources);
- List<UserParams> userParams = retrieveUserParamsFromServiceCharacteristics(
- serviceOrderItem.getService().getServiceCharacteristic());
-
- // If there are ServiceCharacteristics add them to requestInputs
- if (!userParams.isEmpty()) {
- Map<String, String> requestInputs = new HashMap<String, String>();
- for (int i = 0; i < userParams.size(); i++) {
- requestInputs.put(userParams.get(i).getName(), userParams.get(i).getValue());
- }
-
- parameters.setRequestInputs(requestInputs);
+
+ /**
+ * Build SO CREATE request from the ServiceOrder and catalog informations from SDC
+ *
+ * @param orderItem
+ * @param serviceOrderInfo
+ * @return
+ */
+ private RequestDetails buildSoRequest(ServiceOrderItem orderItem, ServiceOrderInfo serviceOrderInfo) {
+ RequestDetails requestDetails = new RequestDetails();
+
+ requestDetails.setSubscriberInfo(serviceOrderInfo.getSubscriberInfo());
+ Map<String, Object> sdcInfos =
+ serviceOrderInfo.getServiceOrderItemInfos().get(orderItem.getId()).getCatalogResponse();
+ ModelInfo modelInfo = new ModelInfo();
+ modelInfo.setModelType("service");
+ modelInfo.setModelInvariantId((String) sdcInfos.get("invariantUUID"));
+ modelInfo.setModelNameVersionId(orderItem.getService().getServiceSpecification().getId());
+ modelInfo.setModelVersionId(orderItem.getService().getServiceSpecification().getId());
+ modelInfo.setModelName((String) sdcInfos.get("name"));
+ modelInfo.setModelVersion((String) sdcInfos.get("version"));
+ requestDetails.setModelInfo(modelInfo);
+
+ RequestInfo requestInfo = new RequestInfo();
+ requestInfo.setInstanceName(orderItem.getService().getName());
+ requestInfo.setSource("VID");
+ requestInfo.setSuppressRollback(false);
+ requestInfo.setRequestorId("NBI");
+ requestDetails.setRequestInfo(requestInfo);
+
+ RequestParameters requestParameters = new RequestParameters();
+ requestParameters.setSubscriptionServiceType((String) sdcInfos.get("name"));
+ requestParameters.setUserParams(
+ retrieveUserParamsFromServiceCharacteristics(orderItem.getService().getServiceCharacteristic()));
+ requestParameters.setaLaCarte(true);
+ requestParameters.setTestApi("GR_API");
+ requestDetails.setRequestParameters(requestParameters);
+
+ CloudConfiguration cloudConfiguration = new CloudConfiguration(lcpCloudRegionId, tenantId, cloudOwner);
+ requestDetails.setCloudConfiguration(cloudConfiguration);
+
+ OwningEntity owningEntity = new OwningEntity();
+ owningEntity.setOwningEntityId(serviceOrderInfo.getOwningEntityId());
+ owningEntity.setOwningEntityName(soOwningEntityName);
+ requestDetails.setOwningEntity(owningEntity);
+
+ Project project = new Project();
+ project.setProjectName(soProjectName);
+
+ requestDetails.setProject(project);
+
+ return requestDetails;
}
- service.setParameters(parameters);
-
- return service;
- }
-
- /**
- * Build a list of UserParams for the SO request by browsing a list of ServiceCharacteristics from
- * SDC
- */
- private List<UserParams> retrieveUserParamsFromServiceCharacteristics(
- List<ServiceCharacteristic> characteristics) {
- List<UserParams> userParams = new ArrayList<>();
- UserParams userParam;
-
- if (!CollectionUtils.isEmpty(characteristics)) {
- for (ServiceCharacteristic characteristic : characteristics) {
- // Check is the characteristic is of type object, if proceed as before to allow for
- // backwards compatibility.
- if (characteristic.getValueType() != null && !characteristic.getValueType().isEmpty()
- && characteristic.getValueType().equals("object")) {
- ObjectMapper mapper = new ObjectMapper();
- JsonNode jsonNode = null;
- try {
- jsonNode = mapper.readTree(characteristic.getValue().getServiceCharacteristicValue());
- } catch (IOException e) {
- LOGGER.error("Failed to read object json {} , exception is ",
- characteristic.getValue().getServiceCharacteristicValue(), e.getMessage());
- }
- ObjectNode objectNode = (ObjectNode) jsonNode;
- Iterator<Map.Entry<String, JsonNode>> iter = objectNode.fields();
- while (iter.hasNext()) {
- Map.Entry<String, JsonNode> entry = iter.next();
- if (!entry.getValue().isArray()) {
- userParam = new UserParams(entry.getKey(), entry.getValue().asText());
- } else {
- ArrayNode arrayNode = (ArrayNode) entry.getValue();
- String arrayNodeValueString = arrayNode.toString();
- userParam = new UserParams(entry.getKey(), arrayNodeValueString);
- }
- userParams.add(userParam);
- }
+
+ /**
+ * Build E2E SO CREATE request from the ServiceOrder and catalog informations from SDC
+ *
+ * @param serviceOrderItem
+ * @param serviceOrder
+ * @param sdcInfos
+ * @return
+ */
+ // ServiceOrderItem serviceOrderItem --> orderItem?
+ private ServiceModel buildE2ESoRequest(ServiceOrderItem serviceOrderItem, Map<String, Object> sdcInfos,
+ SubscriberInfo subscriberInfo, ServiceOrder serviceOrder) {
+
+ subscriberInfo.getGlobalSubscriberId();
+ ServiceModel service = new ServiceModel();
+ service.setName(serviceOrderItem.getService().getName());
+ service.setDescription(serviceOrder.getDescription());
+ service.setServiceUuid(serviceOrderItem.getService().getServiceSpecification().getId());
+ service.setServiceInvariantUuid((String) sdcInfos.get("invariantUUID"));
+ service.setGlobalSubscriberId(subscriberInfo.getGlobalSubscriberId());
+ service.setServiceType((String) sdcInfos.get("name"));
+
+ ParametersModel parameters = new ParametersModel();
+ ArrayList<ResourceModel> resources = new ArrayList();
+
+ ArrayList<Object> resourceObjects = (ArrayList<Object>) sdcInfos.get("resourceSpecification");
+
+ for (int i = 0; i < resourceObjects.size(); i++) {
+
+ ResourceModel resourceModel = new ResourceModel((Map<String, Object>) resourceObjects.get(i));
+ ParametersModel resourceParameters = new ParametersModel();
+ resourceModel.setParameters(resourceParameters);
+ resources.add(resourceModel);
+
}
- // as UserParams for all other types, boolean, string, integer etc
- else {
- userParam = new UserParams(characteristic.getName(),
- characteristic.getValue().getServiceCharacteristicValue());
- userParams.add(userParam);
+ parameters.setResources(resources);
+ List<UserParams> userParams =
+ retrieveUserParamsFromServiceCharacteristics(serviceOrderItem.getService().getServiceCharacteristic());
+
+ // If there are ServiceCharacteristics add them to requestInputs
+ if (!userParams.isEmpty()) {
+ Map<String, String> requestInputs = new HashMap<String, String>();
+ for (int i = 0; i < userParams.size(); i++) {
+ requestInputs.put(userParams.get(i).getName(), userParams.get(i).getValue());
+ }
+
+ parameters.setRequestInputs(requestInputs);
}
- }
+ service.setParameters(parameters);
+
+ return service;
}
- return userParams;
- }
+ /**
+ * Build a list of UserParams for the SO request by browsing a list of ServiceCharacteristics from
+ * SDC
+ */
+ private List<UserParams> retrieveUserParamsFromServiceCharacteristics(List<ServiceCharacteristic> characteristics) {
+ List<UserParams> userParams = new ArrayList<>();
+ UserParams userParam;
+
+ if (!CollectionUtils.isEmpty(characteristics)) {
+ for (ServiceCharacteristic characteristic : characteristics) {
+ // Check is the characteristic is of type object, if proceed as before to allow for
+ // backwards compatibility.
+ if (characteristic.getValueType() != null && !characteristic.getValueType().isEmpty()
+ && characteristic.getValueType().equals("object")) {
+ ObjectMapper mapper = new ObjectMapper();
+ JsonNode jsonNode = null;
+ try {
+ jsonNode = mapper.readTree(characteristic.getValue().getServiceCharacteristicValue());
+ } catch (IOException e) {
+ LOGGER.error("Failed to read object json {} , exception is ",
+ characteristic.getValue().getServiceCharacteristicValue(), e.getMessage());
+ }
+ ObjectNode objectNode = (ObjectNode) jsonNode;
+ Iterator<Map.Entry<String, JsonNode>> iter = objectNode.fields();
+ while (iter.hasNext()) {
+ Map.Entry<String, JsonNode> entry = iter.next();
+ if (!entry.getValue().isArray()) {
+ userParam = new UserParams(entry.getKey(), entry.getValue().asText());
+ } else {
+ ArrayNode arrayNode = (ArrayNode) entry.getValue();
+ String arrayNodeValueString = arrayNode.toString();
+ userParam = new UserParams(entry.getKey(), arrayNodeValueString);
+ }
+ userParams.add(userParam);
+ }
+ }
+ // as UserParams for all other types, boolean, string, integer etc
+ else {
+ userParam = new UserParams(characteristic.getName(),
+ characteristic.getValue().getServiceCharacteristicValue());
+ userParams.add(userParam);
+ }
+ }
+ }
+ return userParams;
+ }
}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/workflow/SOGetStatusManager.java b/src/main/java/org/onap/nbi/apis/serviceorder/workflow/SOGetStatusManager.java
index df233d5..bbe1160 100644
--- a/src/main/java/org/onap/nbi/apis/serviceorder/workflow/SOGetStatusManager.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/workflow/SOGetStatusManager.java
@@ -10,6 +10,7 @@
* 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.nbi.apis.serviceorder.workflow;
import org.onap.nbi.apis.serviceorder.SoClient;
@@ -37,8 +38,6 @@ public class SOGetStatusManager {
@Autowired
private SoClient soClient;
-
-
public void pollRequestStatus(ServiceOrder serviceOrder, ServiceOrderItem serviceOrderItem, boolean e2eService) {
if (e2eService) {
pollE2ESoRequestStatus(serviceOrder, serviceOrderItem);
@@ -51,8 +50,7 @@ public class SOGetStatusManager {
/**
* * @param orderItem
*/
- private void pollSoRequestStatus(ServiceOrder serviceOrder,
- ServiceOrderItem orderItem) {
+ private void pollSoRequestStatus(ServiceOrder serviceOrder, ServiceOrderItem orderItem) {
String requestId = orderItem.getRequestId();
GetRequestStatusResponse response = null;
@@ -64,7 +62,7 @@ public class SOGetStatusManager {
} else if (RequestState.COMPLETE != response.getRequest().getRequestStatus().getRequestState()) {
serviceOrderService.updateOrderItemState(serviceOrder, orderItem, StateType.FAILED);
LOGGER.debug("orderitem id {} failed, response from request status {}", orderItem.getId(),
- response.getRequest().getRequestStatus().getRequestState());
+ response.getRequest().getRequestStatus().getRequestState());
} else {
updateOrderItemIfStatusCompleted(serviceOrder, orderItem);
LOGGER.debug("orderitem id {} completed");
@@ -76,13 +74,14 @@ public class SOGetStatusManager {
}
private void updateOrderItemIfStatusCompleted(ServiceOrder serviceOrder, ServiceOrderItem orderItem) {
- if(orderItem.getAction()!= ActionType.MODIFY){
+ if (orderItem.getAction() != ActionType.MODIFY) {
serviceOrderService.updateOrderItemState(serviceOrder, orderItem, StateType.COMPLETED);
} else {
- if(StateType.INPROGRESS_MODIFY_REQUEST_CREATE_SEND ==orderItem.getState()){
+ if (StateType.INPROGRESS_MODIFY_REQUEST_CREATE_SEND == orderItem.getState()) {
serviceOrderService.updateOrderItemState(serviceOrder, orderItem, StateType.COMPLETED);
} else {
- serviceOrderService.updateOrderItemState(serviceOrder,orderItem,StateType.INPROGRESS_MODIFY_ITEM_TO_CREATE);
+ serviceOrderService.updateOrderItemState(serviceOrder, orderItem,
+ StateType.INPROGRESS_MODIFY_ITEM_TO_CREATE);
}
}
}
@@ -104,7 +103,7 @@ public class SOGetStatusManager {
} else if (ERROR.equals(result)) {
serviceOrderService.updateOrderItemState(serviceOrder, orderItem, StateType.FAILED);
LOGGER.debug("orderitem id {} failed, response from request status {}", orderItem.getId(),
- response.getOperation().getResult());
+ response.getOperation().getResult());
} else if (FINISHED.equals(result)) {
updateOrderItemIfStatusCompleted(serviceOrder, orderItem);
LOGGER.debug("orderitem id {} completed");
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/workflow/SOTaskManager.java b/src/main/java/org/onap/nbi/apis/serviceorder/workflow/SOTaskManager.java
index 26569f6..8cabd97 100644
--- a/src/main/java/org/onap/nbi/apis/serviceorder/workflow/SOTaskManager.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/workflow/SOTaskManager.java
@@ -10,6 +10,7 @@
* 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.nbi.apis.serviceorder.workflow;
import org.onap.nbi.apis.serviceorder.model.OrderItemRelationship;
@@ -44,8 +45,7 @@ public class SOTaskManager {
* @param orderItems
* @param serviceOrderInfoJson
*/
- private void registerOrderItemExecutionPlan(List<ServiceOrderItem> orderItems,
- String serviceOrderInfoJson) {
+ private void registerOrderItemExecutionPlan(List<ServiceOrderItem> orderItems, String serviceOrderInfoJson) {
List<ExecutionTask> executionTasksSaved = new ArrayList<>();
Map<String, Long> internalIdOrderItemsMap = new HashMap<>();
if (orderItems != null) {
@@ -67,17 +67,20 @@ public class SOTaskManager {
}
// then we replace all orderitem ids in reliedtasks field with internalid of the tasks
for (ExecutionTask executionTask : executionTasksSaved) {
- List<String> reliedOrderItemsIds = new ArrayList<String>(Arrays.asList(executionTask.getReliedTasks().split(" ")));
+ List<String> reliedOrderItemsIds =
+ new ArrayList<String>(Arrays.asList(executionTask.getReliedTasks().split(" ")));
List<String> reliedTasksInternalIds = new ArrayList<String>();
- for (Entry<String, Long> entry : internalIdOrderItemsMap.entrySet()){
- if(reliedOrderItemsIds.contains(entry.getKey())) {
- reliedTasksInternalIds.add(entry.getValue().toString());
+ for (Entry<String, Long> entry : internalIdOrderItemsMap.entrySet()) {
+ if (reliedOrderItemsIds.contains(entry.getKey())) {
+ reliedTasksInternalIds.add(entry.getValue().toString());
}
}
- String reliedTasksString = String.join(" ", reliedTasksInternalIds);
- executionTask.setReliedTasks(reliedTasksString);
- if(LOGGER.isDebugEnabled()) {
- LOGGER.debug("saving task with id {} , orderItemId {} , reliedtasks {}", executionTask.getInternalId(), executionTask.getOrderItemId(), executionTask.getReliedTasks());
+ String reliedTasksString = String.join(" ", reliedTasksInternalIds);
+ executionTask.setReliedTasks(reliedTasksString);
+ if (LOGGER.isDebugEnabled()) {
+ LOGGER.debug("saving task with id {} , orderItemId {} , reliedtasks {}",
+ executionTask.getInternalId(), executionTask.getOrderItemId(),
+ executionTask.getReliedTasks());
}
executionTaskRepository.save(executionTask);
}
@@ -94,5 +97,4 @@ public class SOTaskManager {
registerOrderItemExecutionPlan(serviceOrder.getOrderItem(), serviceOrderInfoJson);
}
-
}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/workflow/SOTaskProcessor.java b/src/main/java/org/onap/nbi/apis/serviceorder/workflow/SOTaskProcessor.java
index 67f3a86..843f599 100644
--- a/src/main/java/org/onap/nbi/apis/serviceorder/workflow/SOTaskProcessor.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/workflow/SOTaskProcessor.java
@@ -10,6 +10,7 @@
* 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.nbi.apis.serviceorder.workflow;
import java.io.IOException;
@@ -43,7 +44,6 @@ import org.springframework.util.CollectionUtils;
@Service
public class SOTaskProcessor {
-
@Autowired
private ServiceOrderService serviceOrderService;
@@ -71,34 +71,32 @@ public class SOTaskProcessor {
ServiceOrderInfo serviceOrderInfo = getServiceOrderInfo(executionTask);
- Optional<ServiceOrder> optionalServiceOrder = serviceOrderService
- .findServiceOrderById(serviceOrderInfo.getServiceOrderId());
+ Optional<ServiceOrder> optionalServiceOrder =
+ serviceOrderService.findServiceOrderById(serviceOrderInfo.getServiceOrderId());
if (!optionalServiceOrder.isPresent()) {
throw new TechnicalException(
- "Unable to retrieve service order for id " + serviceOrderInfo.getServiceOrderId());
+ "Unable to retrieve service order for id " + serviceOrderInfo.getServiceOrderId());
}
ServiceOrder serviceOrder = optionalServiceOrder.get();
ServiceOrderItem serviceOrderItem = getServiceOrderItem(executionTask, serviceOrder);
- boolean e2eService = E2EServiceUtils
- .isE2EService(serviceOrderInfo.getServiceOrderItemInfos().get(serviceOrderItem.getId()));
+ boolean e2eService =
+ E2EServiceUtils.isE2EService(serviceOrderInfo.getServiceOrderItemInfos().get(serviceOrderItem.getId()));
if (shouldPostSo(serviceOrderItem)) {
if (e2eService) {
- ResponseEntity<CreateE2EServiceInstanceResponse> response = postSoProcessor
- .postE2EServiceOrderItem(serviceOrderInfo,
- serviceOrderItem, serviceOrder);
+ ResponseEntity<CreateE2EServiceInstanceResponse> response =
+ postSoProcessor.postE2EServiceOrderItem(serviceOrderInfo, serviceOrderItem, serviceOrder);
updateE2EServiceOrderItem(response, serviceOrderItem, serviceOrder);
} else {
- ResponseEntity<CreateServiceInstanceResponse> response = postSoProcessor
- .postServiceOrderItem(serviceOrderInfo, serviceOrderItem);
+ ResponseEntity<CreateServiceInstanceResponse> response =
+ postSoProcessor.postServiceOrderItem(serviceOrderInfo, serviceOrderItem);
updateServiceOrderItem(response, serviceOrderItem, serviceOrder);
}
}
boolean shouldStopPolling = shouldStopPolling(executionTask);
- if (!shouldStopPolling && StateType.FAILED != serviceOrderItem.getState()
- ) {
+ if (!shouldStopPolling && StateType.FAILED != serviceOrderItem.getState()) {
// TODO lancer en asynchrone
sOGetStatusManager.pollRequestStatus(serviceOrder, serviceOrderItem, e2eService);
@@ -117,7 +115,7 @@ public class SOTaskProcessor {
private boolean shouldPostSo(ServiceOrderItem serviceOrderItem) {
return StateType.ACKNOWLEDGED == serviceOrderItem.getState()
- || StateType.INPROGRESS_MODIFY_ITEM_TO_CREATE == serviceOrderItem.getState();
+ || StateType.INPROGRESS_MODIFY_ITEM_TO_CREATE == serviceOrderItem.getState();
}
private ServiceOrderItem getServiceOrderItem(ExecutionTask executionTask, ServiceOrder serviceOrder) {
@@ -127,25 +125,23 @@ public class SOTaskProcessor {
}
}
throw new TechnicalException(
- "Unable to retrieve serviceOrderItem for executionTaskId " + executionTask.getInternalId());
+ "Unable to retrieve serviceOrderItem for executionTaskId " + executionTask.getInternalId());
}
private ServiceOrderInfo getServiceOrderInfo(ExecutionTask executionTask) {
String serviceOrderInfoJson = executionTask.getServiceOrderInfoJson();
ServiceOrderInfo serviceOrderInfo = null;
try {
- serviceOrderInfo =
- JsonEntityConverter.convertJsonToServiceOrderInfo(serviceOrderInfoJson);
+ serviceOrderInfo = JsonEntityConverter.convertJsonToServiceOrderInfo(serviceOrderInfoJson);
} catch (IOException e) {
- LOGGER
- .error("Unable to read ServiceOrderInfo Json for executionTaskId " + executionTask.getInternalId(), e);
+ LOGGER.error("Unable to read ServiceOrderInfo Json for executionTaskId " + executionTask.getInternalId(),
+ e);
throw new TechnicalException(
- "Unable to read ServiceOrderInfo Json for executionTaskId " + executionTask.getInternalId());
+ "Unable to read ServiceOrderInfo Json for executionTaskId " + executionTask.getInternalId());
}
return serviceOrderInfo;
}
-
private void updateServiceOrder(ServiceOrder serviceOrder) {
boolean atLeastOneCompleted = false;
boolean atLeastOneNotFinished = false;
@@ -185,12 +181,11 @@ public class SOTaskProcessor {
}
}
-
/**
* Update ServiceOrderItem with SO response by using serviceOrderRepository with the serviceOrderId
*/
private void updateServiceOrderItem(ResponseEntity<CreateServiceInstanceResponse> response,
- ServiceOrderItem orderItem, ServiceOrder serviceOrder) {
+ ServiceOrderItem orderItem, ServiceOrder serviceOrder) {
if (response == null || !response.getStatusCode().is2xxSuccessful()) {
LOGGER.warn("response ko for serviceOrderItem.id=" + orderItem.getId());
@@ -204,35 +199,32 @@ public class SOTaskProcessor {
}
if (!response.getStatusCode().is2xxSuccessful() || response.getBody() == null
- || response.getBody().getRequestReferences() == null) {
+ || response.getBody().getRequestReferences() == null) {
serviceOrderService.updateOrderItemState(serviceOrder, orderItem, StateType.FAILED);
- LOGGER
- .warn("order item {} failed , status {} , response {}", orderItem.getId(), response.getStatusCode(),
- response.getBody());
+ LOGGER.warn("order item {} failed , status {} , response {}", orderItem.getId(),
+ response.getStatusCode(), response.getBody());
} else {
updateOrderItemToInProgress(serviceOrder, orderItem);
}
}
}
-
private void updateOrderItemToInProgress(ServiceOrder serviceOrder, ServiceOrderItem serviceOrderItem) {
if (serviceOrderItem.getAction() != ActionType.MODIFY) {
serviceOrderService.updateOrderItemState(serviceOrder, serviceOrderItem, StateType.INPROGRESS);
} else {
if (StateType.ACKNOWLEDGED == serviceOrderItem.getState()) {
serviceOrderService.updateOrderItemState(serviceOrder, serviceOrderItem,
- StateType.INPROGRESS_MODIFY_REQUEST_DELETE_SEND);
+ StateType.INPROGRESS_MODIFY_REQUEST_DELETE_SEND);
} else {
serviceOrderService.updateOrderItemState(serviceOrder, serviceOrderItem,
- StateType.INPROGRESS_MODIFY_REQUEST_CREATE_SEND);
+ StateType.INPROGRESS_MODIFY_REQUEST_CREATE_SEND);
}
}
}
-
private void buildOrderMessageIfNeeded(ServiceOrderItem serviceOrderItem, ServiceOrder serviceOrder,
- ResponseEntity<?> response) {
+ ResponseEntity<?> response) {
if (response != null) {
if (response.getStatusCode() == HttpStatus.INTERNAL_SERVER_ERROR) {
serviceOrderService.addOrderMessage(serviceOrder, "502");
@@ -242,7 +234,7 @@ public class SOTaskProcessor {
serviceOrderService.addOrderItemMessage(serviceOrder, serviceOrderItem, "105");
} else {
serviceOrderService.addOrderItemMessageRequestSo(serviceOrder, serviceOrderItem,
- messageError.getBody().toString());
+ messageError.getBody().toString());
}
}
}
@@ -252,7 +244,7 @@ public class SOTaskProcessor {
* Update E2EServiceOrderItem with SO response by using serviceOrderRepository with the serviceOrderId
*/
private void updateE2EServiceOrderItem(ResponseEntity<CreateE2EServiceInstanceResponse> response,
- ServiceOrderItem orderItem, ServiceOrder serviceOrder) {
+ ServiceOrderItem orderItem, ServiceOrder serviceOrder) {
if (response == null || !response.getStatusCode().is2xxSuccessful()) {
LOGGER.warn("response ko for serviceOrderItem.id=" + orderItem.getId());
@@ -265,12 +257,11 @@ public class SOTaskProcessor {
}
if (!response.getStatusCode().is2xxSuccessful() || response.getBody() == null
- || response.getBody().getService().getOperationId() == null
- || response.getBody().getService().getServiceId() == null) {
+ || response.getBody().getService().getOperationId() == null
+ || response.getBody().getService().getServiceId() == null) {
serviceOrderService.updateOrderItemState(serviceOrder, orderItem, StateType.FAILED);
- LOGGER
- .warn("order item {} failed , status {} , response {}", orderItem.getId(), response.getStatusCode(),
- response.getBody());
+ LOGGER.warn("order item {} failed , status {} , response {}", orderItem.getId(),
+ response.getStatusCode(), response.getBody());
} else {
serviceOrderService.updateOrderItemState(serviceOrder, orderItem, StateType.INPROGRESS);
}
@@ -295,14 +286,15 @@ public class SOTaskProcessor {
for (ExecutionTask taskId : executionTasksToDelete) {
executionTaskRepository.delete(taskId);
LOGGER.warn("task {} with orderitem id {} deleted cause orderitem id {} failed ", taskId.getInternalId(),
- taskId.getOrderItemId(), executionTask.getOrderItemId());
+ taskId.getOrderItemId(), executionTask.getOrderItemId());
}
for (ServiceOrderItem item : serviceOrder.getOrderItem()) {
for (ExecutionTask taskToDelete : executionTasksToDelete) {
if (taskToDelete.getOrderItemId().equals(item.getId())) {
serviceOrderService.updateOrderItemState(serviceOrder, item, StateType.FAILED);
LOGGER.warn("task {} with orderitem id {} failed cause orderitem id {} failed ",
- taskToDelete.getInternalId(), taskToDelete.getOrderItemId(), executionTask.getOrderItemId());
+ taskToDelete.getInternalId(), taskToDelete.getOrderItemId(),
+ executionTask.getOrderItemId());
}
}
@@ -318,7 +310,7 @@ public class SOTaskProcessor {
List<ExecutionTask> executionTasks = new ArrayList<>();
List<ExecutionTask> tasksReliedToAnOrderItemId =
- executionTaskRepository.findTasksReliedToAnOrderItemId(executionTask.getInternalId());
+ executionTaskRepository.findTasksReliedToAnOrderItemId(executionTask.getInternalId());
if (CollectionUtils.isEmpty(tasksReliedToAnOrderItemId)) {
return Arrays.asList(executionTask);
@@ -337,10 +329,9 @@ public class SOTaskProcessor {
long differenceInMillis = lastAttemptTimeInMillis - createTimeinMillis;
float pollingDurationInMillis = pollingDurationInMins * 60000;
LOGGER.debug("Task {} with orderitem id {}: Task create date: {} Task last attempt date: {}",
- executionTask.getInternalId(), executionTask.getOrderItemId(), createTimeinMillis,
- lastAttemptTimeInMillis);
- LOGGER.debug("Difference {} and Polling Duration {}",
- differenceInMillis, pollingDurationInMins);
+ executionTask.getInternalId(), executionTask.getOrderItemId(), createTimeinMillis,
+ lastAttemptTimeInMillis);
+ LOGGER.debug("Difference {} and Polling Duration {}", differenceInMillis, pollingDurationInMins);
return (differenceInMillis > pollingDurationInMillis);
}
}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/workflow/ServiceOrderCheckScheduler.java b/src/main/java/org/onap/nbi/apis/serviceorder/workflow/ServiceOrderCheckScheduler.java
index 0d9f050..1a96ee1 100644
--- a/src/main/java/org/onap/nbi/apis/serviceorder/workflow/ServiceOrderCheckScheduler.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/workflow/ServiceOrderCheckScheduler.java
@@ -11,6 +11,7 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
+
package org.onap.nbi.apis.serviceorder.workflow;
import java.util.List;
@@ -29,20 +30,18 @@ import org.springframework.stereotype.Service;
@EnableScheduling
public class ServiceOrderCheckScheduler {
- @Autowired
- ServiceOrderService serviceOrderService;
-
- @Autowired
- ServiceOrderResource serviceOrderResource;
+ @Autowired
+ ServiceOrderService serviceOrderService;
+ @Autowired
+ ServiceOrderResource serviceOrderResource;
- @Scheduled(fixedDelayString = "${serviceOrder.schedule}", initialDelayString = "${serviceOrder.initial}")
- public void scheduleCheckServiceOrders() {
- List<ServiceOrder> acknowledgedOrders = serviceOrderService
- .findServiceOrdersByState(StateType.ACKNOWLEDGED);
- for (ServiceOrder serviceOrder : acknowledgedOrders) {
- serviceOrderResource.checkServiceOrder(serviceOrder);
+ @Scheduled(fixedDelayString = "${serviceOrder.schedule}", initialDelayString = "${serviceOrder.initial}")
+ public void scheduleCheckServiceOrders() {
+ List<ServiceOrder> acknowledgedOrders = serviceOrderService.findServiceOrdersByState(StateType.ACKNOWLEDGED);
+ for (ServiceOrder serviceOrder : acknowledgedOrders) {
+ serviceOrderResource.checkServiceOrder(serviceOrder);
+ }
}
- }
}
diff --git a/src/main/java/org/onap/nbi/apis/status/OnapClient.java b/src/main/java/org/onap/nbi/apis/status/OnapClient.java
index c3eb746..0d07d16 100644
--- a/src/main/java/org/onap/nbi/apis/status/OnapClient.java
+++ b/src/main/java/org/onap/nbi/apis/status/OnapClient.java
@@ -10,6 +10,7 @@
* 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.nbi.apis.status;
import java.text.MessageFormat;
@@ -44,7 +45,6 @@ public class OnapClient {
private static final Logger LOGGER = LoggerFactory.getLogger(OnapClient.class);
-
public ApplicationStatus checkConnectivity(OnapModuleType onapModuleType) {
try {
@@ -63,19 +63,17 @@ public class OnapClient {
break;
}
} catch (BackendFunctionalException e) {
- String message = MessageFormat
- .format("backend exception for {0}, status code {1}, body response {2}", onapModuleType,
- e.getHttpStatus(), e.getBodyResponse());
+ String message = MessageFormat.format("backend exception for {0}, status code {1}, body response {2}",
+ onapModuleType, e.getHttpStatus(), e.getBodyResponse());
LOGGER.error(message);
return new ApplicationStatus(onapModuleType.getValue() + " connectivity", StatusType.KO, null);
} catch (ResourceAccessException e) {
- String message = MessageFormat
- .format("resource access exception for {0}, response {1}", onapModuleType, e.getMessage());
+ String message = MessageFormat.format("resource access exception for {0}, response {1}", onapModuleType,
+ e.getMessage());
LOGGER.error(message);
return new ApplicationStatus(onapModuleType.getValue() + " connectivity", StatusType.KO, null);
}
return new ApplicationStatus(onapModuleType.getValue() + " connectivity", StatusType.OK, null);
}
-
-} \ No newline at end of file
+}
diff --git a/src/main/java/org/onap/nbi/apis/status/StatusResource.java b/src/main/java/org/onap/nbi/apis/status/StatusResource.java
index e1510cc..89567e1 100644
--- a/src/main/java/org/onap/nbi/apis/status/StatusResource.java
+++ b/src/main/java/org/onap/nbi/apis/status/StatusResource.java
@@ -10,6 +10,7 @@
* 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.nbi.apis.status;
import org.onap.nbi.apis.status.model.ApplicationStatus;
@@ -29,7 +30,6 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
-
@RestController
@RequestMapping("/status")
public class StatusResource extends ResourceManagement {
@@ -41,17 +41,18 @@ public class StatusResource extends ResourceManagement {
private String version;
private JsonRepresentation fullRepresentation = new JsonRepresentation().add("name").add("status").add("version")
- .add("components.name").add("components.status");
+ .add("components.name").add("components.status");
@GetMapping(value = "", produces = MediaType.APPLICATION_JSON_VALUE)
- public ResponseEntity<Object> status(HttpServletRequest request, @RequestParam MultiValueMap<String, String> params) {
+ public ResponseEntity<Object> status(HttpServletRequest request,
+ @RequestParam MultiValueMap<String, String> params) {
ResponseEntity<Object> responseEntity = null;
final String[] splitPath = request.getRequestURI().split("/");
final String applicationName = splitPath[1];
boolean fullStatus = Boolean.valueOf(params.getFirst("fullStatus"));
- final ApplicationStatus applicationStatus = buildNbiStatus(applicationName,fullStatus);
+ final ApplicationStatus applicationStatus = buildNbiStatus(applicationName, fullStatus);
// filter object
Object response = this.getEntity(applicationStatus, fullRepresentation);
@@ -64,13 +65,14 @@ public class StatusResource extends ResourceManagement {
private ApplicationStatus buildNbiStatus(String applicationName, boolean fullStatus) {
final ApplicationStatus applicationStatus = this.statusService.get(applicationName, version);
- if(fullStatus) {
+ if (fullStatus) {
final ApplicationStatus sdcConnectivityStatus = this.statusService.getOnapConnectivity(OnapModuleType.SDC);
final ApplicationStatus aaiConnectivityStatus = this.statusService.getOnapConnectivity(OnapModuleType.AAI);
final ApplicationStatus soConnectivityStatus = this.statusService.getOnapConnectivity(OnapModuleType.SO);
- final ApplicationStatus dmaapConnectivityStatus = this.statusService.getOnapConnectivity(OnapModuleType.DMAAP);
+ final ApplicationStatus dmaapConnectivityStatus =
+ this.statusService.getOnapConnectivity(OnapModuleType.DMAAP);
applicationStatus.addComponent(sdcConnectivityStatus).addComponent(aaiConnectivityStatus)
- .addComponent(soConnectivityStatus).addComponent(dmaapConnectivityStatus);
+ .addComponent(soConnectivityStatus).addComponent(dmaapConnectivityStatus);
}
return applicationStatus;
diff --git a/src/main/java/org/onap/nbi/apis/status/StatusService.java b/src/main/java/org/onap/nbi/apis/status/StatusService.java
index 35eba3a..b8880d3 100644
--- a/src/main/java/org/onap/nbi/apis/status/StatusService.java
+++ b/src/main/java/org/onap/nbi/apis/status/StatusService.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.nbi.apis.status;
import org.onap.nbi.apis.status.model.ApplicationStatus;
@@ -22,8 +23,6 @@ public interface StatusService {
ApplicationStatus get(String serviceName, String serviceVersion);
-
ApplicationStatus getOnapConnectivity(OnapModuleType onapModuleType);
-
}
diff --git a/src/main/java/org/onap/nbi/apis/status/StatusServiceImpl.java b/src/main/java/org/onap/nbi/apis/status/StatusServiceImpl.java
index 1ee9fc6..8d6f1de 100644
--- a/src/main/java/org/onap/nbi/apis/status/StatusServiceImpl.java
+++ b/src/main/java/org/onap/nbi/apis/status/StatusServiceImpl.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.nbi.apis.status;
import org.onap.nbi.apis.status.model.ApplicationStatus;
@@ -27,7 +28,6 @@ public class StatusServiceImpl implements StatusService {
@Autowired
private OnapClient onapClient;
-
@Override
public ApplicationStatus get(final String serviceName, final String serviceVersion) {
@@ -41,5 +41,4 @@ public class StatusServiceImpl implements StatusService {
return onapClient.checkConnectivity(onapModuleType);
}
-
}
diff --git a/src/main/java/org/onap/nbi/apis/status/model/ApplicationStatus.java b/src/main/java/org/onap/nbi/apis/status/model/ApplicationStatus.java
index 6d8e0c1..2fd3797 100644
--- a/src/main/java/org/onap/nbi/apis/status/model/ApplicationStatus.java
+++ b/src/main/java/org/onap/nbi/apis/status/model/ApplicationStatus.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.nbi.apis.status.model;
import java.util.HashSet;
diff --git a/src/main/java/org/onap/nbi/apis/status/model/OnapModuleType.java b/src/main/java/org/onap/nbi/apis/status/model/OnapModuleType.java
index 2013147..efada4a 100644
--- a/src/main/java/org/onap/nbi/apis/status/model/OnapModuleType.java
+++ b/src/main/java/org/onap/nbi/apis/status/model/OnapModuleType.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.nbi.apis.status.model;
import com.fasterxml.jackson.annotation.JsonCreator;
@@ -20,7 +21,7 @@ import com.fasterxml.jackson.annotation.JsonValue;
public enum OnapModuleType {
- SDC("sdc"), AAI("aai"),SO("so"), DMAAP("dmaap");
+ SDC("sdc"), AAI("aai"), SO("so"), DMAAP("dmaap");
private final String value;
diff --git a/src/main/java/org/onap/nbi/apis/status/model/StatusType.java b/src/main/java/org/onap/nbi/apis/status/model/StatusType.java
index 4b577d2..18d5ec6 100644
--- a/src/main/java/org/onap/nbi/apis/status/model/StatusType.java
+++ b/src/main/java/org/onap/nbi/apis/status/model/StatusType.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.nbi.apis.status.model;
import com.fasterxml.jackson.annotation.JsonCreator;
diff --git a/src/main/java/org/onap/nbi/commons/BeanUtils.java b/src/main/java/org/onap/nbi/commons/BeanUtils.java
index 06ec2f5..edcf2d0 100644
--- a/src/main/java/org/onap/nbi/commons/BeanUtils.java
+++ b/src/main/java/org/onap/nbi/commons/BeanUtils.java
@@ -11,6 +11,7 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
+
package org.onap.nbi.commons;
import org.apache.commons.beanutils.PropertyUtilsBean;
diff --git a/src/main/java/org/onap/nbi/commons/EWInterfaceUtils.java b/src/main/java/org/onap/nbi/commons/EWInterfaceUtils.java
index 24bf1fc..85845f3 100644
--- a/src/main/java/org/onap/nbi/commons/EWInterfaceUtils.java
+++ b/src/main/java/org/onap/nbi/commons/EWInterfaceUtils.java
@@ -15,6 +15,7 @@
*/
package org.onap.nbi.commons;
+
import org.onap.nbi.exceptions.BackendFunctionalException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -25,14 +26,13 @@ import org.springframework.stereotype.Service;
import org.springframework.web.client.ResourceAccessException;
import org.springframework.web.client.RestTemplate;
-
@Service
public class EWInterfaceUtils {
public static final String RESPONSE_STATUS = "response status : ";
public static final String RETURNS = " returns ";
public static final String ERROR_ON_CALLING = "error on calling ";
- private static final Logger LOGGER = LoggerFactory.getLogger( EWInterfaceUtils.class);
+ private static final Logger LOGGER = LoggerFactory.getLogger(EWInterfaceUtils.class);
@Autowired
private RestTemplate restTemplate;
@Value("${so.host}")
@@ -47,7 +47,6 @@ public class EWInterfaceUtils {
private static final String HEADER_AUTHORIZATION = "Authorization";
private static final String X_FROM_APP_ID = "X-FromAppId";
-
public ResponseEntity<Object> callPostRequestTarget(Object obj, String targetUrl) {
try {
@@ -62,12 +61,11 @@ public class EWInterfaceUtils {
}
} catch (BackendFunctionalException | ResourceAccessException e) {
- LOGGER.error(ERROR_ON_CALLING + " ," + e.getMessage());
+ LOGGER.error(ERROR_ON_CALLING + " ," + e.getMessage());
return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
}
}
-
public ResponseEntity<Object> callGetRequestTarget(String targetUrl) {
try {
ResponseEntity<Object> response = restTemplate.exchange(targetUrl, HttpMethod.GET,
@@ -103,12 +101,13 @@ public class EWInterfaceUtils {
return null;
}
}
+
private void logResponseGet(String url, ResponseEntity<Object> response) {
if (response != null) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("response body : {}", response.getBody().toString());
}
- if (LOGGER.isWarnEnabled() && !response.getStatusCode().equals( HttpStatus.OK)) {
+ if (LOGGER.isWarnEnabled() && !response.getStatusCode().equals(HttpStatus.OK)) {
LOGGER.warn("HTTP call EWInterface on {} returns {} , {}", url, response.getStatusCodeValue(),
response.getBody().toString());
}
diff --git a/src/main/java/org/onap/nbi/commons/JacksonFilter.java b/src/main/java/org/onap/nbi/commons/JacksonFilter.java
index 97f6cf2..55ae45c 100644
--- a/src/main/java/org/onap/nbi/commons/JacksonFilter.java
+++ b/src/main/java/org/onap/nbi/commons/JacksonFilter.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.nbi.commons;
import com.fasterxml.jackson.databind.MappingJsonFactory;
diff --git a/src/main/java/org/onap/nbi/commons/JsonRepresentation.java b/src/main/java/org/onap/nbi/commons/JsonRepresentation.java
index 7f1f1db..eccbf70 100644
--- a/src/main/java/org/onap/nbi/commons/JsonRepresentation.java
+++ b/src/main/java/org/onap/nbi/commons/JsonRepresentation.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.nbi.commons;
import java.util.LinkedHashSet;
@@ -23,7 +24,8 @@ public class JsonRepresentation {
private Set<String> attributes = new LinkedHashSet<>();
- public JsonRepresentation() {}
+ public JsonRepresentation() {
+ }
public JsonRepresentation(MultiValueMap<String, String> queryParameters) {
this.attributes = QueryParserUtils.getFields(queryParameters);
diff --git a/src/main/java/org/onap/nbi/commons/MultiCriteriaRequestBuilder.java b/src/main/java/org/onap/nbi/commons/MultiCriteriaRequestBuilder.java
index 36902fe..3b83bb1 100644
--- a/src/main/java/org/onap/nbi/commons/MultiCriteriaRequestBuilder.java
+++ b/src/main/java/org/onap/nbi/commons/MultiCriteriaRequestBuilder.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.nbi.commons;
import org.onap.nbi.apis.serviceorder.model.StateType;
@@ -36,7 +37,6 @@ public class MultiCriteriaRequestBuilder {
private static final Logger LOGGER = LoggerFactory.getLogger(MultiCriteriaRequestBuilder.class);
-
public Query buildRequest(MultiValueMap<String, String> params) {
Query query = new Query();
@@ -62,7 +62,7 @@ public class MultiCriteriaRequestBuilder {
}
List<String> eventTypes = params.get("query.eventType");
if (!CollectionUtils.isEmpty(eventTypes)) {
- Object[] eventType = new String[]{eventTypes.get(0)};
+ Object[] eventType = new String[] {eventTypes.get(0)};
LOGGER.debug("add criterion query.eventType {}", eventType);
query.addCriteria(Criteria.where("query.eventType").in(eventType));
diff --git a/src/main/java/org/onap/nbi/commons/Query.java b/src/main/java/org/onap/nbi/commons/Query.java
index 9821606..e41c010 100644
--- a/src/main/java/org/onap/nbi/commons/Query.java
+++ b/src/main/java/org/onap/nbi/commons/Query.java
@@ -13,12 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.nbi.commons;
import org.springframework.util.MultiValueMap;
-
-
public class Query {
private MultiValueMap<String, String> parameters;
diff --git a/src/main/java/org/onap/nbi/commons/QueryParserUtils.java b/src/main/java/org/onap/nbi/commons/QueryParserUtils.java
index a43b5bb..5ae4b26 100644
--- a/src/main/java/org/onap/nbi/commons/QueryParserUtils.java
+++ b/src/main/java/org/onap/nbi/commons/QueryParserUtils.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.nbi.commons;
import java.util.ArrayList;
@@ -29,7 +30,8 @@ import org.springframework.util.MultiValueMap;
*/
public class QueryParserUtils {
- private QueryParserUtils() {}
+ private QueryParserUtils() {
+ }
/**
*
diff --git a/src/main/java/org/onap/nbi/commons/ReservedKeys.java b/src/main/java/org/onap/nbi/commons/ReservedKeys.java
index e0fc952..0f79f65 100644
--- a/src/main/java/org/onap/nbi/commons/ReservedKeys.java
+++ b/src/main/java/org/onap/nbi/commons/ReservedKeys.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.nbi.commons;
/**
@@ -28,6 +29,7 @@ public class ReservedKeys {
public static final String QUERY_KEY_FIELD_ESCAPE = ":";
- private ReservedKeys() {}
+ private ReservedKeys() {
+ }
}
diff --git a/src/main/java/org/onap/nbi/commons/Resource.java b/src/main/java/org/onap/nbi/commons/Resource.java
index 768a771..c7f706b 100644
--- a/src/main/java/org/onap/nbi/commons/Resource.java
+++ b/src/main/java/org/onap/nbi/commons/Resource.java
@@ -13,8 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.onap.nbi.commons;
+package org.onap.nbi.commons;
public interface Resource {
diff --git a/src/main/java/org/onap/nbi/commons/ResourceManagement.java b/src/main/java/org/onap/nbi/commons/ResourceManagement.java
index 82d9ebe..000e9da 100644
--- a/src/main/java/org/onap/nbi/commons/ResourceManagement.java
+++ b/src/main/java/org/onap/nbi/commons/ResourceManagement.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.nbi.commons;
import java.net.URI;
@@ -44,7 +45,6 @@ public class ResourceManagement {
location = URI.create("/");
}
-
// Get entity representation
final Object entity = this.getEntity(resource, jsonRepresentation);
@@ -68,8 +68,6 @@ public class ResourceManagement {
}
-
-
/**
* Build default 206 filtered partial response for resource
*
@@ -87,7 +85,6 @@ public class ResourceManagement {
}
-
/**
* Build default 200 filtered response for resource collection
*
@@ -106,7 +103,6 @@ public class ResourceManagement {
}
-
/**
* Build 204 Empty response
*
diff --git a/src/main/java/org/onap/nbi/configuration/AppContext.java b/src/main/java/org/onap/nbi/configuration/AppContext.java
index fb26799..d8c3292 100644
--- a/src/main/java/org/onap/nbi/configuration/AppContext.java
+++ b/src/main/java/org/onap/nbi/configuration/AppContext.java
@@ -24,8 +24,8 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupp
@Configuration
@EnableAsync
public class AppContext extends WebMvcConfigurationSupport {
- @Bean
- public Executor taskExecutor() {
- return new SimpleAsyncTaskExecutor();
- }
+ @Bean
+ public Executor taskExecutor() {
+ return new SimpleAsyncTaskExecutor();
+ }
}
diff --git a/src/main/java/org/onap/nbi/configuration/HubConfig.java b/src/main/java/org/onap/nbi/configuration/HubConfig.java
index 9d86dd6..c8f1f7f 100644
--- a/src/main/java/org/onap/nbi/configuration/HubConfig.java
+++ b/src/main/java/org/onap/nbi/configuration/HubConfig.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.nbi.configuration;
import org.onap.nbi.apis.hub.service.CriteriaBuilder;
diff --git a/src/main/java/org/onap/nbi/configuration/MongoConfig.java b/src/main/java/org/onap/nbi/configuration/MongoConfig.java
index f4e78dc..6a6e08a 100755
--- a/src/main/java/org/onap/nbi/configuration/MongoConfig.java
+++ b/src/main/java/org/onap/nbi/configuration/MongoConfig.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.nbi.configuration;
import org.springframework.beans.BeansException;
@@ -36,4 +37,4 @@ public class MongoConfig implements BeanPostProcessor {
public Object postProcessBeforeInitialization(Object o, String s) throws BeansException {
return o;
}
-} \ No newline at end of file
+}
diff --git a/src/main/java/org/onap/nbi/configuration/RestConfiguration.java b/src/main/java/org/onap/nbi/configuration/RestConfiguration.java
index 92108a4..0966c50 100644
--- a/src/main/java/org/onap/nbi/configuration/RestConfiguration.java
+++ b/src/main/java/org/onap/nbi/configuration/RestConfiguration.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.nbi.configuration;
import org.onap.nbi.exceptions.BackendErrorHandler;
@@ -21,7 +22,6 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;
-
@Configuration
public class RestConfiguration {
diff --git a/src/main/java/org/onap/nbi/exceptions/ApiError.java b/src/main/java/org/onap/nbi/exceptions/ApiError.java
index 71111ea..dd54b6f 100644
--- a/src/main/java/org/onap/nbi/exceptions/ApiError.java
+++ b/src/main/java/org/onap/nbi/exceptions/ApiError.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.nbi.exceptions;
import javax.xml.bind.annotation.XmlAccessType;
@@ -32,7 +33,8 @@ public class ApiError {
@XmlElement(required = true)
protected String infoURL;
- public ApiError() {}
+ public ApiError() {
+ }
public ApiError(String code, String message, String description, String infoURL) {
this.code = code;
@@ -73,4 +75,3 @@ public class ApiError {
this.infoURL = infoURL;
}
}
-
diff --git a/src/main/java/org/onap/nbi/exceptions/ApiException.java b/src/main/java/org/onap/nbi/exceptions/ApiException.java
index f51d9d2..7455c54 100644
--- a/src/main/java/org/onap/nbi/exceptions/ApiException.java
+++ b/src/main/java/org/onap/nbi/exceptions/ApiException.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.nbi.exceptions;
import java.io.Serializable;
diff --git a/src/main/java/org/onap/nbi/exceptions/ApiExceptionHandler.java b/src/main/java/org/onap/nbi/exceptions/ApiExceptionHandler.java
index e008f09..c68e6d3 100644
--- a/src/main/java/org/onap/nbi/exceptions/ApiExceptionHandler.java
+++ b/src/main/java/org/onap/nbi/exceptions/ApiExceptionHandler.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.nbi.exceptions;
import org.springframework.http.HttpStatus;
@@ -25,7 +26,6 @@ import org.springframework.web.client.RestClientException;
@ControllerAdvice
public class ApiExceptionHandler {
-
@ExceptionHandler(BackendFunctionalException.class)
@ResponseBody
public ResponseEntity<ApiError> backendExceptionHandler(final BackendFunctionalException exception) {
diff --git a/src/main/java/org/onap/nbi/exceptions/BackendErrorHandler.java b/src/main/java/org/onap/nbi/exceptions/BackendErrorHandler.java
index 637cbdd..48bf630 100644
--- a/src/main/java/org/onap/nbi/exceptions/BackendErrorHandler.java
+++ b/src/main/java/org/onap/nbi/exceptions/BackendErrorHandler.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.nbi.exceptions;
import java.io.IOException;
@@ -34,12 +35,12 @@ public class BackendErrorHandler implements ResponseErrorHandler {
@Override
public void handleError(ClientHttpResponse response) throws IOException {
if (response.getStatusCode() != null) {
- String body=null;
- if(response.getBody()!=null) {
+ String body = null;
+ if (response.getBody() != null) {
body = IOUtils.toString(response.getBody(), StandardCharsets.UTF_8.name());
}
- throw new BackendFunctionalException(response.getStatusCode(), response.getStatusText(),body);
+ throw new BackendFunctionalException(response.getStatusCode(), response.getStatusText(), body);
}
}
}
diff --git a/src/main/java/org/onap/nbi/exceptions/BackendFunctionalException.java b/src/main/java/org/onap/nbi/exceptions/BackendFunctionalException.java
index 43cb502..0e13d9c 100644
--- a/src/main/java/org/onap/nbi/exceptions/BackendFunctionalException.java
+++ b/src/main/java/org/onap/nbi/exceptions/BackendFunctionalException.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.nbi.exceptions;
import org.springframework.http.HttpStatus;
diff --git a/src/main/java/org/onap/nbi/exceptions/TechnicalException.java b/src/main/java/org/onap/nbi/exceptions/TechnicalException.java
index 14d6321..f6cdd88 100644
--- a/src/main/java/org/onap/nbi/exceptions/TechnicalException.java
+++ b/src/main/java/org/onap/nbi/exceptions/TechnicalException.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.nbi.exceptions;
import org.springframework.http.HttpStatus;
@@ -26,10 +27,8 @@ public class TechnicalException extends ApiException {
this.httpStatus = HttpStatus.INTERNAL_SERVER_ERROR;
}
-
public HttpStatus getHttpStatus() {
return httpStatus;
}
-
}
diff --git a/src/main/java/org/onap/nbi/exceptions/ValidationException.java b/src/main/java/org/onap/nbi/exceptions/ValidationException.java
index 1cf7d36..f7483ff 100644
--- a/src/main/java/org/onap/nbi/exceptions/ValidationException.java
+++ b/src/main/java/org/onap/nbi/exceptions/ValidationException.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.nbi.exceptions;
import org.springframework.validation.FieldError;
diff --git a/src/test/java/org/onap/nbi/api/listener/ListenerResourceTest.java b/src/test/java/org/onap/nbi/api/listener/ListenerResourceTest.java
index 691592a..d8dc38b 100644
--- a/src/test/java/org/onap/nbi/api/listener/ListenerResourceTest.java
+++ b/src/test/java/org/onap/nbi/api/listener/ListenerResourceTest.java
@@ -11,6 +11,7 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
+
package org.onap.nbi.api.listener;
import java.net.URI;
@@ -40,91 +41,88 @@ import com.fasterxml.jackson.databind.JsonNode;
@RequestMapping("/test/listener")
public class ListenerResourceTest extends ResourceManagement {
- Logger logger = LoggerFactory.getLogger(ListenerResourceTest.class);
+ Logger logger = LoggerFactory.getLogger(ListenerResourceTest.class);
- static Map<String, JsonNode> events = new ConcurrentHashMap<>();
+ static Map<String, JsonNode> events = new ConcurrentHashMap<>();
- /*
- * listener resource test for hub resource
- */
- @PostMapping(consumes = MediaType.APPLICATION_JSON_VALUE)
- public ResponseEntity<JsonNode> postListener(@RequestBody JsonNode event) {
- if (logger.isDebugEnabled()) {
- logger.debug("POST event from nbi : {}", event.toString());
- }
- String eventId = event.get("eventId").asText();
- logger.info("putting eventId {} in the events map", eventId);
- events.put(eventId, event);
-
- URI location = ServletUriComponentsBuilder.fromCurrentRequest().path("/{id}")
- .buildAndExpand(eventId).toUri();
-
- return ResponseEntity.created(location).body(event);
- }
-
-
- @GetMapping(value = "", produces = MediaType.APPLICATION_JSON_VALUE)
- public ResponseEntity<Collection<JsonNode>> findEvents(
- @RequestParam MultiValueMap<String, String> params) {
- logger.info("called listener get with params {} : " + params.toString());
- Collection<JsonNode> values = new ArrayList<>();
- String serviceOrderId = params.getFirst("serviceOrderId");
- String serviceInstanceId = params.getFirst("serviceInstanceId");
- if (StringUtils.isNotEmpty(serviceOrderId)) {
- for (JsonNode jsonNode : events.values()) {
- String id = jsonNode.get("event").get("id").asText();
- logger.info("found event with service order id : " + id);
- if (id.equals(serviceOrderId)) {
- values.add(jsonNode);
+ /*
+ * listener resource test for hub resource
+ */
+ @PostMapping(consumes = MediaType.APPLICATION_JSON_VALUE)
+ public ResponseEntity<JsonNode> postListener(@RequestBody JsonNode event) {
+ if (logger.isDebugEnabled()) {
+ logger.debug("POST event from nbi : {}", event.toString());
}
- }
- if (!values.isEmpty()) {
- return ResponseEntity.ok(values);
- } else {
- logger.error("cannot found events with service order id : " + serviceOrderId);
- return ResponseEntity.notFound().build();
- }
- } else if (StringUtils.isNotEmpty(serviceInstanceId)) {
- for (JsonNode jsonNode : events.values()) {
- String id = jsonNode.get("event").get("id").asText();
- logger.info("found event with service Instance id : " + id);
- if (id.equals(serviceInstanceId)) {
- values.add(jsonNode);
+ String eventId = event.get("eventId").asText();
+ logger.info("putting eventId {} in the events map", eventId);
+ events.put(eventId, event);
+
+ URI location = ServletUriComponentsBuilder.fromCurrentRequest().path("/{id}").buildAndExpand(eventId).toUri();
+
+ return ResponseEntity.created(location).body(event);
+ }
+
+ @GetMapping(value = "", produces = MediaType.APPLICATION_JSON_VALUE)
+ public ResponseEntity<Collection<JsonNode>> findEvents(@RequestParam MultiValueMap<String, String> params) {
+ logger.info("called listener get with params {} : " + params.toString());
+ Collection<JsonNode> values = new ArrayList<>();
+ String serviceOrderId = params.getFirst("serviceOrderId");
+ String serviceInstanceId = params.getFirst("serviceInstanceId");
+ if (StringUtils.isNotEmpty(serviceOrderId)) {
+ for (JsonNode jsonNode : events.values()) {
+ String id = jsonNode.get("event").get("id").asText();
+ logger.info("found event with service order id : " + id);
+ if (id.equals(serviceOrderId)) {
+ values.add(jsonNode);
+ }
+ }
+ if (!values.isEmpty()) {
+ return ResponseEntity.ok(values);
+ } else {
+ logger.error("cannot found events with service order id : " + serviceOrderId);
+ return ResponseEntity.notFound().build();
+ }
+ } else if (StringUtils.isNotEmpty(serviceInstanceId)) {
+ for (JsonNode jsonNode : events.values()) {
+ String id = jsonNode.get("event").get("id").asText();
+ logger.info("found event with service Instance id : " + id);
+ if (id.equals(serviceInstanceId)) {
+ values.add(jsonNode);
+ }
+ }
+ if (!values.isEmpty()) {
+ return ResponseEntity.ok(values);
+ } else {
+ logger.error("cannot found events with service instance id : " + serviceInstanceId);
+ return ResponseEntity.notFound().build();
+ }
+ } else {
+ values = events.values();
}
- }
- if (!values.isEmpty()) {
return ResponseEntity.ok(values);
- } else {
- logger.error("cannot found events with service instance id : " + serviceInstanceId);
- return ResponseEntity.notFound().build();
- }
- } else {
- values = events.values();
}
- return ResponseEntity.ok(values);
- }
- @GetMapping(value = "/{eventId}", produces = MediaType.APPLICATION_JSON_VALUE)
- public ResponseEntity<Object> getEvent(@PathVariable String eventId) {
+ @GetMapping(value = "/{eventId}", produces = MediaType.APPLICATION_JSON_VALUE)
+ public ResponseEntity<Object> getEvent(@PathVariable String eventId) {
- return ResponseEntity.ok(events.get(eventId));
+ return ResponseEntity.ok(events.get(eventId));
- }
+ }
- @DeleteMapping(value = "/{eventId}", produces = MediaType.APPLICATION_JSON_VALUE)
- public ResponseEntity<Object> deleteEvent(@PathVariable String eventId) {
+ @DeleteMapping(value = "/{eventId}", produces = MediaType.APPLICATION_JSON_VALUE)
+ public ResponseEntity<Object> deleteEvent(@PathVariable String eventId) {
- events.remove(eventId);
- return ResponseEntity.noContent().build();
+ events.remove(eventId);
+ return ResponseEntity.noContent().build();
- }
+ }
- @DeleteMapping(produces = MediaType.APPLICATION_JSON_VALUE)
- public ResponseEntity<Object> deleteEvents() {
+ @DeleteMapping(produces = MediaType.APPLICATION_JSON_VALUE)
+ public ResponseEntity<Object> deleteEvents() {
- events.clear();
- return ResponseEntity.noContent().build();
+ events.clear();
+ return ResponseEntity.noContent().build();
- }
+ }
}
diff --git a/src/test/java/org/onap/nbi/apis/assertions/ServiceOrderExecutionTaskAssertions.java b/src/test/java/org/onap/nbi/apis/assertions/ServiceOrderExecutionTaskAssertions.java
index 5dc261a..b09cf1d 100644
--- a/src/test/java/org/onap/nbi/apis/assertions/ServiceOrderExecutionTaskAssertions.java
+++ b/src/test/java/org/onap/nbi/apis/assertions/ServiceOrderExecutionTaskAssertions.java
@@ -11,6 +11,7 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
+
package org.onap.nbi.apis.assertions;
import java.util.ArrayList;
@@ -38,407 +39,402 @@ import org.onap.nbi.apis.serviceorder.repositories.ExecutionTaskRepository;
import org.onap.nbi.apis.serviceorder.repositories.ServiceOrderRepository;
import org.onap.nbi.apis.serviceorder.utils.JsonEntityConverter;
-
public class ServiceOrderExecutionTaskAssertions {
- public static ServiceOrder createTestServiceOrderRejected() {
- ServiceOrder serviceOrder = new ServiceOrder();
- serviceOrder.setExternalId("LudONAP001");
- serviceOrder.setPriority("1");
- serviceOrder.setDescription("Ludo first ONAP Order");
- serviceOrder.setCategory("Consumer");
- serviceOrder.setRequestedStartDate(new Date());
- serviceOrder.setRequestedCompletionDate(new Date());
-
- RelatedParty party = new RelatedParty();
- party.setId("6490");
- party.setRole("ONAPcustomer");
- party.setReferredType("individual");
- party.setName("Jean Pontus");
- List<RelatedParty> relatedPartyList = new ArrayList<>();
- relatedPartyList.add(party);
- serviceOrder.setRelatedParty(relatedPartyList);
-
- List<ServiceOrderItem> items = new ArrayList<>();
-
- ServiceOrderItem itemA = new ServiceOrderItem();
- itemA.id("A");
- itemA.action(ActionType.ADD);
- Service serviceA = new Service();
- serviceA.setServiceState("active");
- ServiceSpecificationRef serviceSpecificationRefA = new ServiceSpecificationRef();
- serviceSpecificationRefA.setId("333");
- serviceA.setServiceSpecification(serviceSpecificationRefA);
- itemA.setService(serviceA);
- items.add(itemA);
-
- ServiceOrderItem itemB = new ServiceOrderItem();
- itemB.id("B");
- itemB.action(ActionType.ADD);
- Service serviceB = new Service();
- serviceB.setServiceState("active");
- ServiceSpecificationRef serviceSpecificationRefB = new ServiceSpecificationRef();
- serviceSpecificationRefB.setId("1e3feeb0-8e36-46c6-862c-236d9c626439");
- serviceB.setServiceSpecification(serviceSpecificationRefB);
- itemB.setService(serviceB);
- List<OrderItemRelationship> orderItemRelationships = new ArrayList<>();
- OrderItemRelationship orderItemRelationship = new OrderItemRelationship();
- orderItemRelationship.setId("A");
- orderItemRelationships.add(orderItemRelationship);
- itemB.setOrderItemRelationship(orderItemRelationships);
- items.add(itemB);
- serviceOrder.setOrderItem(items);
- return serviceOrder;
-
- }
-
-
- public static ServiceOrder createTestServiceOrder(ActionType actionType) {
- ServiceOrder serviceOrder = new ServiceOrder();
- serviceOrder.setExternalId("LudONAP001");
- serviceOrder.setPriority("1");
- serviceOrder.setDescription("Ludo first ONAP Order");
- serviceOrder.setCategory("Consumer");
- serviceOrder.setRequestedStartDate(new Date());
- serviceOrder.setRequestedCompletionDate(new Date());
- serviceOrder.setBaseType("toto");
- serviceOrder.setCompletionDateTime(new Date());
- serviceOrder.setExpectedCompletionDate(new Date());
- serviceOrder.setSchemaLocation("/tutu");
-
- OrderRelationship orderRelationship = new OrderRelationship();
- orderRelationship.setId("test");
- orderRelationship.setHref("test");
- orderRelationship.setReferredType("test");
- orderRelationship.setType("type");
- List<OrderRelationship> relationships = new ArrayList<>();
- serviceOrder.setOrderRelationship(relationships);
-
- RelatedParty party = new RelatedParty();
- party.setId("6490");
- party.setRole("ONAPcustomer");
- party.setReferredType("individual");
- party.setName("Jean Pontus");
- List<RelatedParty> relatedPartyList = new ArrayList<>();
- relatedPartyList.add(party);
- serviceOrder.setRelatedParty(relatedPartyList);
-
- List<ServiceOrderItem> items = new ArrayList<>();
-
- ServiceOrderItem itemA = new ServiceOrderItem();
- itemA.id("A");
- itemA.action(actionType);
- Service serviceA = new Service();
- if (actionType != ActionType.ADD) {
- serviceA.setId("e4688e5f-61a0-4f8b-ae02-a2fbde623bcb");
- }
- serviceA.setServiceState("active");
- ServiceSpecificationRef serviceSpecificationRefA = new ServiceSpecificationRef();
- serviceSpecificationRefA.setId("1e3feeb0-8e36-46c6-862c-236d9c626439");
- serviceA.setServiceSpecification(serviceSpecificationRefA);
- itemA.setService(serviceA);
- items.add(itemA);
-
- ServiceOrderItem itemB = new ServiceOrderItem();
- itemB.id("B");
- itemB.action(actionType);
- Service serviceB = new Service();
- if (actionType != ActionType.ADD) {
- serviceB.setId("e4688e5f-61a0-4f8b-ae02-a2fbde623bcb");
+ public static ServiceOrder createTestServiceOrderRejected() {
+ ServiceOrder serviceOrder = new ServiceOrder();
+ serviceOrder.setExternalId("LudONAP001");
+ serviceOrder.setPriority("1");
+ serviceOrder.setDescription("Ludo first ONAP Order");
+ serviceOrder.setCategory("Consumer");
+ serviceOrder.setRequestedStartDate(new Date());
+ serviceOrder.setRequestedCompletionDate(new Date());
+
+ RelatedParty party = new RelatedParty();
+ party.setId("6490");
+ party.setRole("ONAPcustomer");
+ party.setReferredType("individual");
+ party.setName("Jean Pontus");
+ List<RelatedParty> relatedPartyList = new ArrayList<>();
+ relatedPartyList.add(party);
+ serviceOrder.setRelatedParty(relatedPartyList);
+
+ List<ServiceOrderItem> items = new ArrayList<>();
+
+ ServiceOrderItem itemA = new ServiceOrderItem();
+ itemA.id("A");
+ itemA.action(ActionType.ADD);
+ Service serviceA = new Service();
+ serviceA.setServiceState("active");
+ ServiceSpecificationRef serviceSpecificationRefA = new ServiceSpecificationRef();
+ serviceSpecificationRefA.setId("333");
+ serviceA.setServiceSpecification(serviceSpecificationRefA);
+ itemA.setService(serviceA);
+ items.add(itemA);
+
+ ServiceOrderItem itemB = new ServiceOrderItem();
+ itemB.id("B");
+ itemB.action(ActionType.ADD);
+ Service serviceB = new Service();
+ serviceB.setServiceState("active");
+ ServiceSpecificationRef serviceSpecificationRefB = new ServiceSpecificationRef();
+ serviceSpecificationRefB.setId("1e3feeb0-8e36-46c6-862c-236d9c626439");
+ serviceB.setServiceSpecification(serviceSpecificationRefB);
+ itemB.setService(serviceB);
+ List<OrderItemRelationship> orderItemRelationships = new ArrayList<>();
+ OrderItemRelationship orderItemRelationship = new OrderItemRelationship();
+ orderItemRelationship.setId("A");
+ orderItemRelationships.add(orderItemRelationship);
+ itemB.setOrderItemRelationship(orderItemRelationships);
+ items.add(itemB);
+ serviceOrder.setOrderItem(items);
+ return serviceOrder;
+
}
- serviceB.setServiceState("active");
- ServiceSpecificationRef serviceSpecificationRefB = new ServiceSpecificationRef();
- serviceSpecificationRefB.setId("1e3feeb0-8e36-46c6-862c-236d9c626439");
- serviceB.setServiceSpecification(serviceSpecificationRefB);
- itemB.setService(serviceB);
- List<OrderItemRelationship> orderItemRelationships = new ArrayList<>();
- OrderItemRelationship orderItemRelationship = new OrderItemRelationship();
- orderItemRelationship.setId("A");
- orderItemRelationship.setType(RelationshipType.RELIESON);
- orderItemRelationships.add(orderItemRelationship);
- itemB.setOrderItemRelationship(orderItemRelationships);
- items.add(itemB);
- serviceOrder.setOrderItem(items);
- return serviceOrder;
-
- }
-
-
- public static ExecutionTask setUpBddForExecutionTaskSucess(
- ServiceOrderRepository serviceOrderRepository,
- ExecutionTaskRepository executionTaskRepository, ActionType actionType) {
- ServiceOrder testServiceOrder = createTestServiceOrder(actionType);
-
- for (ServiceOrderItem serviceOrderItem : testServiceOrder.getOrderItem()) {
- serviceOrderItem.setState(StateType.ACKNOWLEDGED);
+
+ public static ServiceOrder createTestServiceOrder(ActionType actionType) {
+ ServiceOrder serviceOrder = new ServiceOrder();
+ serviceOrder.setExternalId("LudONAP001");
+ serviceOrder.setPriority("1");
+ serviceOrder.setDescription("Ludo first ONAP Order");
+ serviceOrder.setCategory("Consumer");
+ serviceOrder.setRequestedStartDate(new Date());
+ serviceOrder.setRequestedCompletionDate(new Date());
+ serviceOrder.setBaseType("toto");
+ serviceOrder.setCompletionDateTime(new Date());
+ serviceOrder.setExpectedCompletionDate(new Date());
+ serviceOrder.setSchemaLocation("/tutu");
+
+ OrderRelationship orderRelationship = new OrderRelationship();
+ orderRelationship.setId("test");
+ orderRelationship.setHref("test");
+ orderRelationship.setReferredType("test");
+ orderRelationship.setType("type");
+ List<OrderRelationship> relationships = new ArrayList<>();
+ serviceOrder.setOrderRelationship(relationships);
+
+ RelatedParty party = new RelatedParty();
+ party.setId("6490");
+ party.setRole("ONAPcustomer");
+ party.setReferredType("individual");
+ party.setName("Jean Pontus");
+ List<RelatedParty> relatedPartyList = new ArrayList<>();
+ relatedPartyList.add(party);
+ serviceOrder.setRelatedParty(relatedPartyList);
+
+ List<ServiceOrderItem> items = new ArrayList<>();
+
+ ServiceOrderItem itemA = new ServiceOrderItem();
+ itemA.id("A");
+ itemA.action(actionType);
+ Service serviceA = new Service();
+ if (actionType != ActionType.ADD) {
+ serviceA.setId("e4688e5f-61a0-4f8b-ae02-a2fbde623bcb");
+ }
+ serviceA.setServiceState("active");
+ ServiceSpecificationRef serviceSpecificationRefA = new ServiceSpecificationRef();
+ serviceSpecificationRefA.setId("1e3feeb0-8e36-46c6-862c-236d9c626439");
+ serviceA.setServiceSpecification(serviceSpecificationRefA);
+ itemA.setService(serviceA);
+ items.add(itemA);
+
+ ServiceOrderItem itemB = new ServiceOrderItem();
+ itemB.id("B");
+ itemB.action(actionType);
+ Service serviceB = new Service();
+ if (actionType != ActionType.ADD) {
+ serviceB.setId("e4688e5f-61a0-4f8b-ae02-a2fbde623bcb");
+ }
+ serviceB.setServiceState("active");
+ ServiceSpecificationRef serviceSpecificationRefB = new ServiceSpecificationRef();
+ serviceSpecificationRefB.setId("1e3feeb0-8e36-46c6-862c-236d9c626439");
+ serviceB.setServiceSpecification(serviceSpecificationRefB);
+ itemB.setService(serviceB);
+ List<OrderItemRelationship> orderItemRelationships = new ArrayList<>();
+ OrderItemRelationship orderItemRelationship = new OrderItemRelationship();
+ orderItemRelationship.setId("A");
+ orderItemRelationship.setType(RelationshipType.RELIESON);
+ orderItemRelationships.add(orderItemRelationship);
+ itemB.setOrderItemRelationship(orderItemRelationships);
+ items.add(itemB);
+ serviceOrder.setOrderItem(items);
+ return serviceOrder;
+
}
- testServiceOrder.setState(StateType.ACKNOWLEDGED);
- testServiceOrder.setId("test");
- serviceOrderRepository.save(testServiceOrder);
-
- LinkedHashMap<String, String> sdcResponse = new LinkedHashMap<>();
- sdcResponse.put("invariantUUID", "uuid");
- sdcResponse.put("name", "vFW");
- sdcResponse.put("version", "v1");
- sdcResponse.put("category", "NonE2E");
-
- ServiceOrderInfo serviceOrderInfo = new ServiceOrderInfo();
- serviceOrderInfo.setServiceOrderId("test");
- SubscriberInfo subscriberInfo = new SubscriberInfo();
- subscriberInfo.setGlobalSubscriberId("6490");
- subscriberInfo.setSubscriberName("edgar");
- serviceOrderInfo.setSubscriberInfo(subscriberInfo);
-
- ServiceOrderItemInfo serviceOrderItemInfoA = new ServiceOrderItemInfo();
- serviceOrderItemInfoA.setId("A");
- serviceOrderItemInfoA.setCatalogResponse(sdcResponse);
-
- ServiceOrderItemInfo serviceOrderItemInfoB = new ServiceOrderItemInfo();
- serviceOrderItemInfoB.setId("B");
- serviceOrderItemInfoB.setCatalogResponse(sdcResponse);
- serviceOrderInfo.addServiceOrderItemInfos("A", serviceOrderItemInfoA);
- serviceOrderInfo.addServiceOrderItemInfos("B", serviceOrderItemInfoB);
-
- String json = JsonEntityConverter.convertServiceOrderInfoToJson(serviceOrderInfo);
-
- ExecutionTask executionTaskA = new ExecutionTask();
- executionTaskA.setCreateDate(new Date());
- executionTaskA.setOrderItemId("A");
- executionTaskA.setServiceOrderInfoJson(json);
- executionTaskA = executionTaskRepository.save(executionTaskA);
- ExecutionTask executionTaskB = new ExecutionTask();
- executionTaskB.setCreateDate(new Date());
- executionTaskB.setOrderItemId("B");
- executionTaskB.setReliedTasks(String.valueOf(executionTaskA.getInternalId()));
- executionTaskB.setServiceOrderInfoJson(json);
- executionTaskRepository.save(executionTaskB);
- return executionTaskA;
- }
-
- public static ExecutionTask setUpBddForE2EExecutionTaskSucess(
- ServiceOrderRepository serviceOrderRepository,
- ExecutionTaskRepository executionTaskRepository, ActionType actionType) {
- ServiceOrder testServiceOrder = createTestServiceOrder(actionType);
-
- for (ServiceOrderItem serviceOrderItem : testServiceOrder.getOrderItem()) {
- serviceOrderItem.setState(StateType.ACKNOWLEDGED);
- List<ServiceCharacteristic> serviceCharacteristics = new ArrayList();
- ServiceCharacteristic serviceCharacteristic1 = new ServiceCharacteristic();
- serviceCharacteristic1.setName("access-site-id");
- Value value1 = new Value();
- value1.setServiceCharacteristicValue("1234765");
- serviceCharacteristic1.setValue(value1);
- serviceCharacteristics.add(serviceCharacteristic1);
- ServiceCharacteristic serviceCharacteristic2 = new ServiceCharacteristic();
- serviceCharacteristic2.setName("provider-site-id");
- Value value2 = new Value();
- value2.setServiceCharacteristicValue("654321");
- serviceCharacteristic2.setValue(value2);
- serviceCharacteristics.add(serviceCharacteristic2);
- serviceOrderItem.getService().setServiceCharacteristic(serviceCharacteristics);
+ public static ExecutionTask setUpBddForExecutionTaskSucess(ServiceOrderRepository serviceOrderRepository,
+ ExecutionTaskRepository executionTaskRepository, ActionType actionType) {
+ ServiceOrder testServiceOrder = createTestServiceOrder(actionType);
+
+ for (ServiceOrderItem serviceOrderItem : testServiceOrder.getOrderItem()) {
+ serviceOrderItem.setState(StateType.ACKNOWLEDGED);
+ }
+
+ testServiceOrder.setState(StateType.ACKNOWLEDGED);
+ testServiceOrder.setId("test");
+ serviceOrderRepository.save(testServiceOrder);
+
+ LinkedHashMap<String, String> sdcResponse = new LinkedHashMap<>();
+ sdcResponse.put("invariantUUID", "uuid");
+ sdcResponse.put("name", "vFW");
+ sdcResponse.put("version", "v1");
+ sdcResponse.put("category", "NonE2E");
+
+ ServiceOrderInfo serviceOrderInfo = new ServiceOrderInfo();
+ serviceOrderInfo.setServiceOrderId("test");
+ SubscriberInfo subscriberInfo = new SubscriberInfo();
+ subscriberInfo.setGlobalSubscriberId("6490");
+ subscriberInfo.setSubscriberName("edgar");
+ serviceOrderInfo.setSubscriberInfo(subscriberInfo);
+
+ ServiceOrderItemInfo serviceOrderItemInfoA = new ServiceOrderItemInfo();
+ serviceOrderItemInfoA.setId("A");
+ serviceOrderItemInfoA.setCatalogResponse(sdcResponse);
+
+ ServiceOrderItemInfo serviceOrderItemInfoB = new ServiceOrderItemInfo();
+ serviceOrderItemInfoB.setId("B");
+ serviceOrderItemInfoB.setCatalogResponse(sdcResponse);
+ serviceOrderInfo.addServiceOrderItemInfos("A", serviceOrderItemInfoA);
+ serviceOrderInfo.addServiceOrderItemInfos("B", serviceOrderItemInfoB);
+
+ String json = JsonEntityConverter.convertServiceOrderInfoToJson(serviceOrderInfo);
+
+ ExecutionTask executionTaskA = new ExecutionTask();
+ executionTaskA.setCreateDate(new Date());
+ executionTaskA.setOrderItemId("A");
+ executionTaskA.setServiceOrderInfoJson(json);
+ executionTaskA = executionTaskRepository.save(executionTaskA);
+ ExecutionTask executionTaskB = new ExecutionTask();
+ executionTaskB.setCreateDate(new Date());
+ executionTaskB.setOrderItemId("B");
+ executionTaskB.setReliedTasks(String.valueOf(executionTaskA.getInternalId()));
+ executionTaskB.setServiceOrderInfoJson(json);
+ executionTaskRepository.save(executionTaskB);
+ return executionTaskA;
}
- testServiceOrder.setState(StateType.ACKNOWLEDGED);
- testServiceOrder.setId("test");
- serviceOrderRepository.save(testServiceOrder);
-
- LinkedHashMap<String, Object> sdcResponse = new LinkedHashMap<>();
- sdcResponse.put("invariantUUID", "uuid");
- sdcResponse.put("name", "vFW");
- sdcResponse.put("version", "v1");
- sdcResponse.put("category", "E2E Service");
-
- List<ResourceSpecification> resourceSpecs = new ArrayList<>();
- ResourceSpecification resourceSpecificationA = new ResourceSpecification();
- resourceSpecificationA.setId("2e3feeb0-8e36-46c6-862c-236d9c626438");
- resourceSpecificationA.setInstanceName("vFW-vSINK");
- resourceSpecificationA.setName("vFW-SINK");
- resourceSpecificationA.setType("ONAPresource");
- resourceSpecificationA.setVersion("2.0");
- resourceSpecificationA.setResourceInvariantUUID("6e3feeb0-8e36-46c6-862c-236d9c626438");
- resourceSpecs.add(resourceSpecificationA);
-
- sdcResponse.put("resourceSpecification", resourceSpecs);
-
- ServiceOrderInfo serviceOrderInfo = new ServiceOrderInfo();
- serviceOrderInfo.setServiceOrderId("test");
- SubscriberInfo subscriberInfo = new SubscriberInfo();
- subscriberInfo.setGlobalSubscriberId("6490");
- subscriberInfo.setSubscriberName("edgar");
- serviceOrderInfo.setSubscriberInfo(subscriberInfo);
-
- ServiceOrderItemInfo serviceOrderItemInfoA = new ServiceOrderItemInfo();
- serviceOrderItemInfoA.setId("A");
- serviceOrderItemInfoA.setCatalogResponse(sdcResponse);
-
- ServiceOrderItemInfo serviceOrderItemInfoB = new ServiceOrderItemInfo();
- serviceOrderItemInfoB.setId("B");
- serviceOrderItemInfoB.setCatalogResponse(sdcResponse);
- serviceOrderInfo.addServiceOrderItemInfos("A", serviceOrderItemInfoA);
- serviceOrderInfo.addServiceOrderItemInfos("B", serviceOrderItemInfoB);
-
- String json = JsonEntityConverter.convertServiceOrderInfoToJson(serviceOrderInfo);
-
- ExecutionTask executionTaskA = new ExecutionTask();
- executionTaskA.setCreateDate(new Date());
- executionTaskA.setOrderItemId("A");
- executionTaskA.setServiceOrderInfoJson(json);
- executionTaskA = executionTaskRepository.save(executionTaskA);
- ExecutionTask executionTaskB = new ExecutionTask();
- executionTaskB.setCreateDate(new Date());
- executionTaskB.setOrderItemId("B");
- executionTaskB.setReliedTasks(String.valueOf(executionTaskA.getInternalId()));
- executionTaskB.setServiceOrderInfoJson(json);
- executionTaskRepository.save(executionTaskB);
- return executionTaskA;
- }
-
- public static ExecutionTask setUpBddForE2EExecutionTaskSucessWithObject(
- ServiceOrderRepository serviceOrderRepository,
- ExecutionTaskRepository executionTaskRepository, ActionType actionType) {
- ServiceOrder testServiceOrder = createTestServiceOrder(actionType);
-
- for (ServiceOrderItem serviceOrderItem : testServiceOrder.getOrderItem()) {
- serviceOrderItem.setState(StateType.ACKNOWLEDGED);
- List<ServiceCharacteristic> serviceCharacteristics = new ArrayList();
- ServiceCharacteristic serviceCharacteristic1 = new ServiceCharacteristic();
- serviceCharacteristic1.setName("EPL_ServiceCharacteristics");
- serviceCharacteristic1.setValueType("object");
- Value value1 = new Value();
- value1.setServiceCharacteristicValue("{ \"key1\":\"value1\", \"key2\":\"value2\"}");
- serviceCharacteristic1.setValue(value1);
- serviceCharacteristics.add(serviceCharacteristic1);
- serviceOrderItem.getService().setServiceCharacteristic(serviceCharacteristics);
+ public static ExecutionTask setUpBddForE2EExecutionTaskSucess(ServiceOrderRepository serviceOrderRepository,
+ ExecutionTaskRepository executionTaskRepository, ActionType actionType) {
+ ServiceOrder testServiceOrder = createTestServiceOrder(actionType);
+
+ for (ServiceOrderItem serviceOrderItem : testServiceOrder.getOrderItem()) {
+ serviceOrderItem.setState(StateType.ACKNOWLEDGED);
+ List<ServiceCharacteristic> serviceCharacteristics = new ArrayList();
+ ServiceCharacteristic serviceCharacteristic1 = new ServiceCharacteristic();
+ serviceCharacteristic1.setName("access-site-id");
+ Value value1 = new Value();
+ value1.setServiceCharacteristicValue("1234765");
+ serviceCharacteristic1.setValue(value1);
+ serviceCharacteristics.add(serviceCharacteristic1);
+ ServiceCharacteristic serviceCharacteristic2 = new ServiceCharacteristic();
+ serviceCharacteristic2.setName("provider-site-id");
+ Value value2 = new Value();
+ value2.setServiceCharacteristicValue("654321");
+ serviceCharacteristic2.setValue(value2);
+ serviceCharacteristics.add(serviceCharacteristic2);
+ serviceOrderItem.getService().setServiceCharacteristic(serviceCharacteristics);
+ }
+
+ testServiceOrder.setState(StateType.ACKNOWLEDGED);
+ testServiceOrder.setId("test");
+ serviceOrderRepository.save(testServiceOrder);
+
+ LinkedHashMap<String, Object> sdcResponse = new LinkedHashMap<>();
+ sdcResponse.put("invariantUUID", "uuid");
+ sdcResponse.put("name", "vFW");
+ sdcResponse.put("version", "v1");
+ sdcResponse.put("category", "E2E Service");
+
+ List<ResourceSpecification> resourceSpecs = new ArrayList<>();
+ ResourceSpecification resourceSpecificationA = new ResourceSpecification();
+ resourceSpecificationA.setId("2e3feeb0-8e36-46c6-862c-236d9c626438");
+ resourceSpecificationA.setInstanceName("vFW-vSINK");
+ resourceSpecificationA.setName("vFW-SINK");
+ resourceSpecificationA.setType("ONAPresource");
+ resourceSpecificationA.setVersion("2.0");
+ resourceSpecificationA.setResourceInvariantUUID("6e3feeb0-8e36-46c6-862c-236d9c626438");
+ resourceSpecs.add(resourceSpecificationA);
+
+ sdcResponse.put("resourceSpecification", resourceSpecs);
+
+ ServiceOrderInfo serviceOrderInfo = new ServiceOrderInfo();
+ serviceOrderInfo.setServiceOrderId("test");
+ SubscriberInfo subscriberInfo = new SubscriberInfo();
+ subscriberInfo.setGlobalSubscriberId("6490");
+ subscriberInfo.setSubscriberName("edgar");
+ serviceOrderInfo.setSubscriberInfo(subscriberInfo);
+
+ ServiceOrderItemInfo serviceOrderItemInfoA = new ServiceOrderItemInfo();
+ serviceOrderItemInfoA.setId("A");
+ serviceOrderItemInfoA.setCatalogResponse(sdcResponse);
+
+ ServiceOrderItemInfo serviceOrderItemInfoB = new ServiceOrderItemInfo();
+ serviceOrderItemInfoB.setId("B");
+ serviceOrderItemInfoB.setCatalogResponse(sdcResponse);
+ serviceOrderInfo.addServiceOrderItemInfos("A", serviceOrderItemInfoA);
+ serviceOrderInfo.addServiceOrderItemInfos("B", serviceOrderItemInfoB);
+
+ String json = JsonEntityConverter.convertServiceOrderInfoToJson(serviceOrderInfo);
+
+ ExecutionTask executionTaskA = new ExecutionTask();
+ executionTaskA.setCreateDate(new Date());
+ executionTaskA.setOrderItemId("A");
+ executionTaskA.setServiceOrderInfoJson(json);
+ executionTaskA = executionTaskRepository.save(executionTaskA);
+ ExecutionTask executionTaskB = new ExecutionTask();
+ executionTaskB.setCreateDate(new Date());
+ executionTaskB.setOrderItemId("B");
+ executionTaskB.setReliedTasks(String.valueOf(executionTaskA.getInternalId()));
+ executionTaskB.setServiceOrderInfoJson(json);
+ executionTaskRepository.save(executionTaskB);
+ return executionTaskA;
}
- testServiceOrder.setState(StateType.ACKNOWLEDGED);
- testServiceOrder.setId("test");
- serviceOrderRepository.save(testServiceOrder);
-
- LinkedHashMap<String, Object> sdcResponse = new LinkedHashMap<>();
- sdcResponse.put("invariantUUID", "uuid");
- sdcResponse.put("name", "vFW");
- sdcResponse.put("version", "v1");
- sdcResponse.put("category", "E2E Service");
-
- List<ResourceSpecification> resourceSpecs = new ArrayList<>();
- ResourceSpecification resourceSpecificationA = new ResourceSpecification();
- resourceSpecificationA.setId("2e3feeb0-8e36-46c6-862c-236d9c626438");
- resourceSpecificationA.setInstanceName("vFW-vSINK");
- resourceSpecificationA.setName("vFW-SINK");
- resourceSpecificationA.setType("ONAPresource");
- resourceSpecificationA.setVersion("2.0");
- resourceSpecificationA.setResourceInvariantUUID("6e3feeb0-8e36-46c6-862c-236d9c626438");
- resourceSpecs.add(resourceSpecificationA);
-
- sdcResponse.put("resourceSpecification", resourceSpecs);
-
- ServiceOrderInfo serviceOrderInfo = new ServiceOrderInfo();
- serviceOrderInfo.setServiceOrderId("test");
- SubscriberInfo subscriberInfo = new SubscriberInfo();
- subscriberInfo.setGlobalSubscriberId("6490");
- subscriberInfo.setSubscriberName("edgar");
- serviceOrderInfo.setSubscriberInfo(subscriberInfo);
-
- ServiceOrderItemInfo serviceOrderItemInfoA = new ServiceOrderItemInfo();
- serviceOrderItemInfoA.setId("A");
- serviceOrderItemInfoA.setCatalogResponse(sdcResponse);
-
- ServiceOrderItemInfo serviceOrderItemInfoB = new ServiceOrderItemInfo();
- serviceOrderItemInfoB.setId("B");
- serviceOrderItemInfoB.setCatalogResponse(sdcResponse);
- serviceOrderInfo.addServiceOrderItemInfos("A", serviceOrderItemInfoA);
- serviceOrderInfo.addServiceOrderItemInfos("B", serviceOrderItemInfoB);
-
- String json = JsonEntityConverter.convertServiceOrderInfoToJson(serviceOrderInfo);
-
- ExecutionTask executionTaskA = new ExecutionTask();
- executionTaskA.setCreateDate(new Date());
- executionTaskA.setOrderItemId("A");
- executionTaskA.setServiceOrderInfoJson(json);
- executionTaskA = executionTaskRepository.save(executionTaskA);
- ExecutionTask executionTaskB = new ExecutionTask();
- executionTaskB.setCreateDate(new Date());
- executionTaskB.setOrderItemId("B");
- executionTaskB.setReliedTasks(String.valueOf(executionTaskA.getInternalId()));
- executionTaskB.setServiceOrderInfoJson(json);
- executionTaskRepository.save(executionTaskB);
- return executionTaskA;
- }
-
- public static ExecutionTask setUpBddForE2EExecutionTaskSucessWithComplexObject(
- ServiceOrderRepository serviceOrderRepository,
- ExecutionTaskRepository executionTaskRepository, ActionType actionType) {
- ServiceOrder testServiceOrder = createTestServiceOrder(actionType);
-
- for (ServiceOrderItem serviceOrderItem : testServiceOrder.getOrderItem()) {
- serviceOrderItem.setState(StateType.ACKNOWLEDGED);
- List<ServiceCharacteristic> serviceCharacteristics = new ArrayList();
- ServiceCharacteristic serviceCharacteristic1 = new ServiceCharacteristic();
- serviceCharacteristic1.setName("EPL_ServiceCharacteristics");
- serviceCharacteristic1.setValueType("object");
- Value value1 = new Value();
- // Three parameters , one is an array of child objects
- value1.setServiceCharacteristicValue(
- "{\"key1\":\"value1\", \"key2\":\"value2\", \"key3\":[ {\"lat1\":\"value1\",\"lon1\":\"value1\"}, { \"lat2\":\"value2\", \"lon2\":\"value2\"}]}");
- serviceCharacteristic1.setValue(value1);
- serviceCharacteristics.add(serviceCharacteristic1);
- serviceOrderItem.getService().setServiceCharacteristic(serviceCharacteristics);
+ public static ExecutionTask setUpBddForE2EExecutionTaskSucessWithObject(
+ ServiceOrderRepository serviceOrderRepository, ExecutionTaskRepository executionTaskRepository,
+ ActionType actionType) {
+ ServiceOrder testServiceOrder = createTestServiceOrder(actionType);
+
+ for (ServiceOrderItem serviceOrderItem : testServiceOrder.getOrderItem()) {
+ serviceOrderItem.setState(StateType.ACKNOWLEDGED);
+ List<ServiceCharacteristic> serviceCharacteristics = new ArrayList();
+ ServiceCharacteristic serviceCharacteristic1 = new ServiceCharacteristic();
+ serviceCharacteristic1.setName("EPL_ServiceCharacteristics");
+ serviceCharacteristic1.setValueType("object");
+ Value value1 = new Value();
+ value1.setServiceCharacteristicValue("{ \"key1\":\"value1\", \"key2\":\"value2\"}");
+ serviceCharacteristic1.setValue(value1);
+ serviceCharacteristics.add(serviceCharacteristic1);
+ serviceOrderItem.getService().setServiceCharacteristic(serviceCharacteristics);
+ }
+
+ testServiceOrder.setState(StateType.ACKNOWLEDGED);
+ testServiceOrder.setId("test");
+ serviceOrderRepository.save(testServiceOrder);
+
+ LinkedHashMap<String, Object> sdcResponse = new LinkedHashMap<>();
+ sdcResponse.put("invariantUUID", "uuid");
+ sdcResponse.put("name", "vFW");
+ sdcResponse.put("version", "v1");
+ sdcResponse.put("category", "E2E Service");
+
+ List<ResourceSpecification> resourceSpecs = new ArrayList<>();
+ ResourceSpecification resourceSpecificationA = new ResourceSpecification();
+ resourceSpecificationA.setId("2e3feeb0-8e36-46c6-862c-236d9c626438");
+ resourceSpecificationA.setInstanceName("vFW-vSINK");
+ resourceSpecificationA.setName("vFW-SINK");
+ resourceSpecificationA.setType("ONAPresource");
+ resourceSpecificationA.setVersion("2.0");
+ resourceSpecificationA.setResourceInvariantUUID("6e3feeb0-8e36-46c6-862c-236d9c626438");
+ resourceSpecs.add(resourceSpecificationA);
+
+ sdcResponse.put("resourceSpecification", resourceSpecs);
+
+ ServiceOrderInfo serviceOrderInfo = new ServiceOrderInfo();
+ serviceOrderInfo.setServiceOrderId("test");
+ SubscriberInfo subscriberInfo = new SubscriberInfo();
+ subscriberInfo.setGlobalSubscriberId("6490");
+ subscriberInfo.setSubscriberName("edgar");
+ serviceOrderInfo.setSubscriberInfo(subscriberInfo);
+
+ ServiceOrderItemInfo serviceOrderItemInfoA = new ServiceOrderItemInfo();
+ serviceOrderItemInfoA.setId("A");
+ serviceOrderItemInfoA.setCatalogResponse(sdcResponse);
+
+ ServiceOrderItemInfo serviceOrderItemInfoB = new ServiceOrderItemInfo();
+ serviceOrderItemInfoB.setId("B");
+ serviceOrderItemInfoB.setCatalogResponse(sdcResponse);
+ serviceOrderInfo.addServiceOrderItemInfos("A", serviceOrderItemInfoA);
+ serviceOrderInfo.addServiceOrderItemInfos("B", serviceOrderItemInfoB);
+
+ String json = JsonEntityConverter.convertServiceOrderInfoToJson(serviceOrderInfo);
+
+ ExecutionTask executionTaskA = new ExecutionTask();
+ executionTaskA.setCreateDate(new Date());
+ executionTaskA.setOrderItemId("A");
+ executionTaskA.setServiceOrderInfoJson(json);
+ executionTaskA = executionTaskRepository.save(executionTaskA);
+ ExecutionTask executionTaskB = new ExecutionTask();
+ executionTaskB.setCreateDate(new Date());
+ executionTaskB.setOrderItemId("B");
+ executionTaskB.setReliedTasks(String.valueOf(executionTaskA.getInternalId()));
+ executionTaskB.setServiceOrderInfoJson(json);
+ executionTaskRepository.save(executionTaskB);
+ return executionTaskA;
}
- testServiceOrder.setState(StateType.ACKNOWLEDGED);
- testServiceOrder.setId("test");
- serviceOrderRepository.save(testServiceOrder);
-
- LinkedHashMap<String, Object> sdcResponse = new LinkedHashMap<>();
- sdcResponse.put("invariantUUID", "uuid");
- sdcResponse.put("name", "vFW");
- sdcResponse.put("version", "v1");
- sdcResponse.put("category", "E2E Service");
-
- List<ResourceSpecification> resourceSpecs = new ArrayList<>();
- ResourceSpecification resourceSpecificationA = new ResourceSpecification();
- resourceSpecificationA.setId("2e3feeb0-8e36-46c6-862c-236d9c626438");
- resourceSpecificationA.setInstanceName("vFW-vSINK");
- resourceSpecificationA.setName("vFW-SINK");
- resourceSpecificationA.setType("ONAPresource");
- resourceSpecificationA.setVersion("2.0");
- resourceSpecificationA.setResourceInvariantUUID("6e3feeb0-8e36-46c6-862c-236d9c626438");
- resourceSpecs.add(resourceSpecificationA);
-
- sdcResponse.put("resourceSpecification", resourceSpecs);
-
- ServiceOrderInfo serviceOrderInfo = new ServiceOrderInfo();
- serviceOrderInfo.setServiceOrderId("test");
- SubscriberInfo subscriberInfo = new SubscriberInfo();
- subscriberInfo.setGlobalSubscriberId("6490");
- subscriberInfo.setSubscriberName("edgar");
- serviceOrderInfo.setSubscriberInfo(subscriberInfo);
-
- ServiceOrderItemInfo serviceOrderItemInfoA = new ServiceOrderItemInfo();
- serviceOrderItemInfoA.setId("A");
- serviceOrderItemInfoA.setCatalogResponse(sdcResponse);
-
- ServiceOrderItemInfo serviceOrderItemInfoB = new ServiceOrderItemInfo();
- serviceOrderItemInfoB.setId("B");
- serviceOrderItemInfoB.setCatalogResponse(sdcResponse);
- serviceOrderInfo.addServiceOrderItemInfos("A", serviceOrderItemInfoA);
- serviceOrderInfo.addServiceOrderItemInfos("B", serviceOrderItemInfoB);
-
- String json = JsonEntityConverter.convertServiceOrderInfoToJson(serviceOrderInfo);
-
- ExecutionTask executionTaskA = new ExecutionTask();
- executionTaskA.setCreateDate(new Date());
- executionTaskA.setOrderItemId("A");
- executionTaskA.setServiceOrderInfoJson(json);
- executionTaskA = executionTaskRepository.save(executionTaskA);
- ExecutionTask executionTaskB = new ExecutionTask();
- executionTaskB.setCreateDate(new Date());
- executionTaskB.setOrderItemId("B");
- executionTaskB.setReliedTasks(String.valueOf(executionTaskA.getInternalId()));
- executionTaskB.setServiceOrderInfoJson(json);
- executionTaskRepository.save(executionTaskB);
- return executionTaskA;
- }
+ public static ExecutionTask setUpBddForE2EExecutionTaskSucessWithComplexObject(
+ ServiceOrderRepository serviceOrderRepository, ExecutionTaskRepository executionTaskRepository,
+ ActionType actionType) {
+ ServiceOrder testServiceOrder = createTestServiceOrder(actionType);
+
+ for (ServiceOrderItem serviceOrderItem : testServiceOrder.getOrderItem()) {
+ serviceOrderItem.setState(StateType.ACKNOWLEDGED);
+ List<ServiceCharacteristic> serviceCharacteristics = new ArrayList();
+ ServiceCharacteristic serviceCharacteristic1 = new ServiceCharacteristic();
+ serviceCharacteristic1.setName("EPL_ServiceCharacteristics");
+ serviceCharacteristic1.setValueType("object");
+ Value value1 = new Value();
+ // Three parameters , one is an array of child objects
+ value1.setServiceCharacteristicValue(
+ "{\"key1\":\"value1\", \"key2\":\"value2\", \"key3\":[ {\"lat1\":\"value1\",\"lon1\":\"value1\"}, { \"lat2\":\"value2\", \"lon2\":\"value2\"}]}");
+ serviceCharacteristic1.setValue(value1);
+ serviceCharacteristics.add(serviceCharacteristic1);
+ serviceOrderItem.getService().setServiceCharacteristic(serviceCharacteristics);
+ }
+
+ testServiceOrder.setState(StateType.ACKNOWLEDGED);
+ testServiceOrder.setId("test");
+ serviceOrderRepository.save(testServiceOrder);
+
+ LinkedHashMap<String, Object> sdcResponse = new LinkedHashMap<>();
+ sdcResponse.put("invariantUUID", "uuid");
+ sdcResponse.put("name", "vFW");
+ sdcResponse.put("version", "v1");
+ sdcResponse.put("category", "E2E Service");
+
+ List<ResourceSpecification> resourceSpecs = new ArrayList<>();
+ ResourceSpecification resourceSpecificationA = new ResourceSpecification();
+ resourceSpecificationA.setId("2e3feeb0-8e36-46c6-862c-236d9c626438");
+ resourceSpecificationA.setInstanceName("vFW-vSINK");
+ resourceSpecificationA.setName("vFW-SINK");
+ resourceSpecificationA.setType("ONAPresource");
+ resourceSpecificationA.setVersion("2.0");
+ resourceSpecificationA.setResourceInvariantUUID("6e3feeb0-8e36-46c6-862c-236d9c626438");
+ resourceSpecs.add(resourceSpecificationA);
+
+ sdcResponse.put("resourceSpecification", resourceSpecs);
+
+ ServiceOrderInfo serviceOrderInfo = new ServiceOrderInfo();
+ serviceOrderInfo.setServiceOrderId("test");
+ SubscriberInfo subscriberInfo = new SubscriberInfo();
+ subscriberInfo.setGlobalSubscriberId("6490");
+ subscriberInfo.setSubscriberName("edgar");
+ serviceOrderInfo.setSubscriberInfo(subscriberInfo);
+
+ ServiceOrderItemInfo serviceOrderItemInfoA = new ServiceOrderItemInfo();
+ serviceOrderItemInfoA.setId("A");
+ serviceOrderItemInfoA.setCatalogResponse(sdcResponse);
+
+ ServiceOrderItemInfo serviceOrderItemInfoB = new ServiceOrderItemInfo();
+ serviceOrderItemInfoB.setId("B");
+ serviceOrderItemInfoB.setCatalogResponse(sdcResponse);
+ serviceOrderInfo.addServiceOrderItemInfos("A", serviceOrderItemInfoA);
+ serviceOrderInfo.addServiceOrderItemInfos("B", serviceOrderItemInfoB);
+
+ String json = JsonEntityConverter.convertServiceOrderInfoToJson(serviceOrderInfo);
+
+ ExecutionTask executionTaskA = new ExecutionTask();
+ executionTaskA.setCreateDate(new Date());
+ executionTaskA.setOrderItemId("A");
+ executionTaskA.setServiceOrderInfoJson(json);
+ executionTaskA = executionTaskRepository.save(executionTaskA);
+ ExecutionTask executionTaskB = new ExecutionTask();
+ executionTaskB.setCreateDate(new Date());
+ executionTaskB.setOrderItemId("B");
+ executionTaskB.setReliedTasks(String.valueOf(executionTaskA.getInternalId()));
+ executionTaskB.setServiceOrderInfoJson(json);
+ executionTaskRepository.save(executionTaskB);
+ return executionTaskA;
+ }
}
diff --git a/src/test/java/org/onap/nbi/apis/servicecatalog/ToscaInfosProcessorTest.java b/src/test/java/org/onap/nbi/apis/servicecatalog/ToscaInfosProcessorTest.java
index 9742d88..e02cdc0 100644
--- a/src/test/java/org/onap/nbi/apis/servicecatalog/ToscaInfosProcessorTest.java
+++ b/src/test/java/org/onap/nbi/apis/servicecatalog/ToscaInfosProcessorTest.java
@@ -11,6 +11,7 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
+
package org.onap.nbi.apis.servicecatalog;
import static org.assertj.core.api.Assertions.assertThat;
@@ -31,223 +32,209 @@ import org.springframework.test.context.junit4.SpringRunner;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
-
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)
@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_CLASS)
@ActiveProfiles("test")
public class ToscaInfosProcessorTest {
- @Autowired
- ToscaInfosProcessor toscaInfosProcessor;
- final ObjectMapper mapper = new ObjectMapper(new YAMLFactory()); // jackson databind
-
-
- @Test
- public void buildResponseWithSdcToscaParser() {
-
- ClassLoader classLoader = getClass().getClassLoader();
- Path path = new File(
- classLoader.getResource("toscafile/service-Sdwanvpninfraservice-csar.csar").getFile())
- .toPath().toAbsolutePath();
- List<LinkedHashMap> resources = new ArrayList<>();
- LinkedHashMap resource1 = new LinkedHashMap();
- resource1.put("id", "7baa7742-3a13-4288-8330-868015adc340");
- resources.add(resource1);
- LinkedHashMap resource2 = new LinkedHashMap();
- resource2.put("id", "81b9430b-8abe-45d6-8bf9-f41a8f5c735f");
- resources.add(resource2);
- LinkedHashMap response = new LinkedHashMap();
- response.put("resourceSpecification", resources);
-
- try {
- toscaInfosProcessor.buildResponseWithSdcToscaParser(path, response);
- } catch (SdcToscaParserException e) {
- throw new TechnicalException("unable to build response from tosca csar using sdc-parser : "
- + path.toString() + " " + e.getMessage());
+ @Autowired
+ ToscaInfosProcessor toscaInfosProcessor;
+ final ObjectMapper mapper = new ObjectMapper(new YAMLFactory()); // jackson databind
+
+ @Test
+ public void buildResponseWithSdcToscaParser() {
+
+ ClassLoader classLoader = getClass().getClassLoader();
+ Path path = new File(classLoader.getResource("toscafile/service-Sdwanvpninfraservice-csar.csar").getFile())
+ .toPath().toAbsolutePath();
+ List<LinkedHashMap> resources = new ArrayList<>();
+ LinkedHashMap resource1 = new LinkedHashMap();
+ resource1.put("id", "7baa7742-3a13-4288-8330-868015adc340");
+ resources.add(resource1);
+ LinkedHashMap resource2 = new LinkedHashMap();
+ resource2.put("id", "81b9430b-8abe-45d6-8bf9-f41a8f5c735f");
+ resources.add(resource2);
+ LinkedHashMap response = new LinkedHashMap();
+ response.put("resourceSpecification", resources);
+
+ try {
+ toscaInfosProcessor.buildResponseWithSdcToscaParser(path, response);
+ } catch (SdcToscaParserException e) {
+ throw new TechnicalException("unable to build response from tosca csar using sdc-parser : "
+ + path.toString() + " " + e.getMessage());
+ }
+ resources = (List<LinkedHashMap>) response.get("resourceSpecification");
+ List<LinkedHashMap> serviceSpecCharacteristic = new ArrayList<>();
+ serviceSpecCharacteristic = (List<LinkedHashMap>) response.get("serviceSpecCharacteristic");
+ assertThat(serviceSpecCharacteristic.get(0).get("name")).isEqualTo("sdwanconnectivity0_topology");
+ assertThat(serviceSpecCharacteristic.get(1).get("valueType")).isEqualTo("string");
+ assertThat(serviceSpecCharacteristic.get(0).get("required")).isEqualTo(true);
+ assertThat(serviceSpecCharacteristic.get(1).get("name")).isEqualTo("sdwanconnectivity0_name");
+ assertThat(serviceSpecCharacteristic.get(1).get("valueType")).isEqualTo("string");
+ assertThat(serviceSpecCharacteristic.get(1).get("required")).isEqualTo(true);
+ assertThat(resources.get(0).get("modelCustomizationId")).isEqualTo("94ec574b-2306-4cbd-8214-09662b040f73");
+ assertThat(resources.get(1).get("modelCustomizationId")).isEqualTo("a7baba5d-6ac3-42b5-b47d-070841303ab1");
+
}
- resources = (List<LinkedHashMap>) response.get("resourceSpecification");
- List<LinkedHashMap> serviceSpecCharacteristic = new ArrayList<>();
- serviceSpecCharacteristic = (List<LinkedHashMap>) response.get("serviceSpecCharacteristic");
- assertThat(serviceSpecCharacteristic.get(0).get("name"))
- .isEqualTo("sdwanconnectivity0_topology");
- assertThat(serviceSpecCharacteristic.get(1).get("valueType")).isEqualTo("string");
- assertThat(serviceSpecCharacteristic.get(0).get("required")).isEqualTo(true);
- assertThat(serviceSpecCharacteristic.get(1).get("name")).isEqualTo("sdwanconnectivity0_name");
- assertThat(serviceSpecCharacteristic.get(1).get("valueType")).isEqualTo("string");
- assertThat(serviceSpecCharacteristic.get(1).get("required")).isEqualTo(true);
- assertThat(resources.get(0).get("modelCustomizationId"))
- .isEqualTo("94ec574b-2306-4cbd-8214-09662b040f73");
- assertThat(resources.get(1).get("modelCustomizationId"))
- .isEqualTo("a7baba5d-6ac3-42b5-b47d-070841303ab1");
-
- }
-
- @Test
- public void buildResponseWithSdcToscaParserWithDefaultInputs() {
-
- ClassLoader classLoader = getClass().getClassLoader();
- Path path = new File(
- classLoader.getResource("toscafile/service-Sotnvpninfraservice-csar.csar").getFile())
- .toPath().toAbsolutePath();
- List<LinkedHashMap> resources = new ArrayList<>();
- LinkedHashMap resource1 = new LinkedHashMap();
- resource1.put("id", "218df3c3-50dd-4c26-9e36-4771387bb771");
- resources.add(resource1);
- LinkedHashMap resource2 = new LinkedHashMap();
- resource2.put("id", "81b9430b-8abe-45d6-8bf9-f41a8f5c735f");
- resources.add(resource2);
- LinkedHashMap response = new LinkedHashMap();
- response.put("resourceSpecification", resources);
-
- try {
- toscaInfosProcessor.buildResponseWithSdcToscaParser(path, response);
- } catch (SdcToscaParserException e) {
- throw new TechnicalException("unable to build response from tosca csar using sdc-parser : "
- + path.toString() + " " + e.getMessage());
+
+ @Test
+ public void buildResponseWithSdcToscaParserWithDefaultInputs() {
+
+ ClassLoader classLoader = getClass().getClassLoader();
+ Path path = new File(classLoader.getResource("toscafile/service-Sotnvpninfraservice-csar.csar").getFile())
+ .toPath().toAbsolutePath();
+ List<LinkedHashMap> resources = new ArrayList<>();
+ LinkedHashMap resource1 = new LinkedHashMap();
+ resource1.put("id", "218df3c3-50dd-4c26-9e36-4771387bb771");
+ resources.add(resource1);
+ LinkedHashMap resource2 = new LinkedHashMap();
+ resource2.put("id", "81b9430b-8abe-45d6-8bf9-f41a8f5c735f");
+ resources.add(resource2);
+ LinkedHashMap response = new LinkedHashMap();
+ response.put("resourceSpecification", resources);
+
+ try {
+ toscaInfosProcessor.buildResponseWithSdcToscaParser(path, response);
+ } catch (SdcToscaParserException e) {
+ throw new TechnicalException("unable to build response from tosca csar using sdc-parser : "
+ + path.toString() + " " + e.getMessage());
+ }
+ resources = (List<LinkedHashMap>) response.get("resourceSpecification");
+ List<LinkedHashMap> serviceSpecCharacteristic = new ArrayList<>();
+ serviceSpecCharacteristic = (List<LinkedHashMap>) response.get("serviceSpecCharacteristic");
+ assertThat(resources.get(0).get("modelCustomizationId")).isEqualTo("b44071c8-04fd-4d6b-b6af-772cbfaa1129");
+ assertThat(resources.get(1).get("modelCustomizationId")).isEqualTo("c3612284-6c67-4d8c-8b41-b699cc90e76d");
+ assertThat(serviceSpecCharacteristic.get(12).get("serviceSpecCharacteristicValue")).isNull();
+ assertThat(serviceSpecCharacteristic.get(13).get("serviceSpecCharacteristicValue")).isNotNull();
}
- resources = (List<LinkedHashMap>) response.get("resourceSpecification");
- List<LinkedHashMap> serviceSpecCharacteristic = new ArrayList<>();
- serviceSpecCharacteristic = (List<LinkedHashMap>) response.get("serviceSpecCharacteristic");
- assertThat(resources.get(0).get("modelCustomizationId"))
- .isEqualTo("b44071c8-04fd-4d6b-b6af-772cbfaa1129");
- assertThat(resources.get(1).get("modelCustomizationId"))
- .isEqualTo("c3612284-6c67-4d8c-8b41-b699cc90e76d");
- assertThat(serviceSpecCharacteristic.get(12).get("serviceSpecCharacteristicValue")).isNull();
- assertThat(serviceSpecCharacteristic.get(13).get("serviceSpecCharacteristicValue")).isNotNull();
- }
-
- @Test
- public void buildResponseWithSdcToscaParserwithMetaDataMisMatch() {
-
- ClassLoader classLoader = getClass().getClassLoader();
- Path path = new File(
- classLoader.getResource("toscafile/service-Sdwanvpninfraservice-csar.csar").getFile())
- .toPath().toAbsolutePath();
- List<LinkedHashMap> resources = new ArrayList<>();
- LinkedHashMap resource1 = new LinkedHashMap();
- resource1.put("id", "some bad resource id no in TOSCA CSAR");
- resources.add(resource1);
- LinkedHashMap resource2 = new LinkedHashMap();
- resource2.put("id", "some bad resource id no in TOSCA CSAR");
- resources.add(resource2);
- LinkedHashMap response = new LinkedHashMap();
- response.put("resourceSpecification", resources);
-
- try {
- toscaInfosProcessor.buildResponseWithSdcToscaParser(path, response);
- } catch (SdcToscaParserException e) {
- throw new TechnicalException("unable to build response from tosca csar using sdc-parser : "
- + path.toString() + " " + e.getMessage());
+
+ @Test
+ public void buildResponseWithSdcToscaParserwithMetaDataMisMatch() {
+
+ ClassLoader classLoader = getClass().getClassLoader();
+ Path path = new File(classLoader.getResource("toscafile/service-Sdwanvpninfraservice-csar.csar").getFile())
+ .toPath().toAbsolutePath();
+ List<LinkedHashMap> resources = new ArrayList<>();
+ LinkedHashMap resource1 = new LinkedHashMap();
+ resource1.put("id", "some bad resource id no in TOSCA CSAR");
+ resources.add(resource1);
+ LinkedHashMap resource2 = new LinkedHashMap();
+ resource2.put("id", "some bad resource id no in TOSCA CSAR");
+ resources.add(resource2);
+ LinkedHashMap response = new LinkedHashMap();
+ response.put("resourceSpecification", resources);
+
+ try {
+ toscaInfosProcessor.buildResponseWithSdcToscaParser(path, response);
+ } catch (SdcToscaParserException e) {
+ throw new TechnicalException("unable to build response from tosca csar using sdc-parser : "
+ + path.toString() + " " + e.getMessage());
+ }
+ resources = (List<LinkedHashMap>) response.get("resourceSpecification");
+ List<LinkedHashMap> serviceSpecCharacteristic = new ArrayList<>();
+ serviceSpecCharacteristic = (List<LinkedHashMap>) response.get("serviceSpecCharacteristic");
+ assertThat(serviceSpecCharacteristic.get(0).get("name")).isEqualTo("sdwanconnectivity0_topology");
+ assertThat(serviceSpecCharacteristic.get(1).get("valueType")).isEqualTo("string");
+ assertThat(serviceSpecCharacteristic.get(0).get("required")).isEqualTo(true);
+ assertThat(serviceSpecCharacteristic.get(1).get("name")).isEqualTo("sdwanconnectivity0_name");
+ assertThat(serviceSpecCharacteristic.get(1).get("valueType")).isEqualTo("string");
+ assertThat(serviceSpecCharacteristic.get(1).get("required")).isEqualTo(true);
+ // Check that resources cannot be found in the TOSCA template
+ assertThat(resources.get(0).get("modelCustomizationId")).isNull();
+ assertThat(resources.get(1).get("modelCustomizationId")).isNull();
+
}
- resources = (List<LinkedHashMap>) response.get("resourceSpecification");
- List<LinkedHashMap> serviceSpecCharacteristic = new ArrayList<>();
- serviceSpecCharacteristic = (List<LinkedHashMap>) response.get("serviceSpecCharacteristic");
- assertThat(serviceSpecCharacteristic.get(0).get("name"))
- .isEqualTo("sdwanconnectivity0_topology");
- assertThat(serviceSpecCharacteristic.get(1).get("valueType")).isEqualTo("string");
- assertThat(serviceSpecCharacteristic.get(0).get("required")).isEqualTo(true);
- assertThat(serviceSpecCharacteristic.get(1).get("name")).isEqualTo("sdwanconnectivity0_name");
- assertThat(serviceSpecCharacteristic.get(1).get("valueType")).isEqualTo("string");
- assertThat(serviceSpecCharacteristic.get(1).get("required")).isEqualTo(true);
- // Check that resources cannot be found in the TOSCA template
- assertThat(resources.get(0).get("modelCustomizationId")).isNull();
- assertThat(resources.get(1).get("modelCustomizationId")).isNull();
-
- }
-
- @Test
- public void testBuildAndSaveResponseWithSdcToscaParser() {
-
- ClassLoader classLoader = getClass().getClassLoader();
- Path path = new File(
- classLoader.getResource("toscafile/service-Sotnvpninfraservice-csar.csar").getFile())
- .toPath().toAbsolutePath();
-
- LinkedHashMap response = new LinkedHashMap();
- response.put("version", "1.0");
- response.put("name", "Service_vMME");
- response.put("description", "some service characteristics schema");
- response.put("id", "7f5e5139-768d-4410-a871-c41430785214");
-
- List<LinkedHashMap> resources = new ArrayList<>();
- LinkedHashMap resource1 = new LinkedHashMap();
- resource1.put("id", "7baa7742-3a13-4288-8330-868015adc340");
- resources.add(resource1);
- LinkedHashMap resource2 = new LinkedHashMap();
- resource2.put("id", "81b9430b-8abe-45d6-8bf9-f41a8f5c735f");
- resources.add(resource2);
-
- response.put("resourceSpecification", resources);
-
- LinkedHashMap serviceSpecCharacteristicValue = new LinkedHashMap();
- serviceSpecCharacteristicValue.put("valueType", "object");
- serviceSpecCharacteristicValue.put("@schemaLocation",
- "/serviceSpecification/7f5e5139-768d-4410-a871-c41430785214/specificationInputSchema");
- serviceSpecCharacteristicValue.put("@type", "Service_vMME_ServiceCharacteristic");
-
- LinkedHashMap serviceSpecCharacteristic = new LinkedHashMap();
- serviceSpecCharacteristic.put("name", "Service_vMME_ServiceCharacteristics");
- serviceSpecCharacteristic.put("description",
- "This object describes all the inputs needed from the client to interact with the Service_vMME Service Topology");
- // using object to match examples in specifications
- serviceSpecCharacteristic.put("valueType", "object");
- serviceSpecCharacteristic.put("@type", "ONAPServiceCharacteristic");
- serviceSpecCharacteristic.put("@schemaLocation", "null");
- serviceSpecCharacteristic.put("serviceSpecCharacteristicValue", serviceSpecCharacteristicValue);
- try {
- toscaInfosProcessor.buildAndSaveResponseWithSdcToscaParser(path, response);
- } catch (SdcToscaParserException ex) {
- throw new TechnicalException("unable to build response " + ex.getMessage());
+
+ @Test
+ public void testBuildAndSaveResponseWithSdcToscaParser() {
+
+ ClassLoader classLoader = getClass().getClassLoader();
+ Path path = new File(classLoader.getResource("toscafile/service-Sotnvpninfraservice-csar.csar").getFile())
+ .toPath().toAbsolutePath();
+
+ LinkedHashMap response = new LinkedHashMap();
+ response.put("version", "1.0");
+ response.put("name", "Service_vMME");
+ response.put("description", "some service characteristics schema");
+ response.put("id", "7f5e5139-768d-4410-a871-c41430785214");
+
+ List<LinkedHashMap> resources = new ArrayList<>();
+ LinkedHashMap resource1 = new LinkedHashMap();
+ resource1.put("id", "7baa7742-3a13-4288-8330-868015adc340");
+ resources.add(resource1);
+ LinkedHashMap resource2 = new LinkedHashMap();
+ resource2.put("id", "81b9430b-8abe-45d6-8bf9-f41a8f5c735f");
+ resources.add(resource2);
+
+ response.put("resourceSpecification", resources);
+
+ LinkedHashMap serviceSpecCharacteristicValue = new LinkedHashMap();
+ serviceSpecCharacteristicValue.put("valueType", "object");
+ serviceSpecCharacteristicValue.put("@schemaLocation",
+ "/serviceSpecification/7f5e5139-768d-4410-a871-c41430785214/specificationInputSchema");
+ serviceSpecCharacteristicValue.put("@type", "Service_vMME_ServiceCharacteristic");
+
+ LinkedHashMap serviceSpecCharacteristic = new LinkedHashMap();
+ serviceSpecCharacteristic.put("name", "Service_vMME_ServiceCharacteristics");
+ serviceSpecCharacteristic.put("description",
+ "This object describes all the inputs needed from the client to interact with the Service_vMME Service Topology");
+ // using object to match examples in specifications
+ serviceSpecCharacteristic.put("valueType", "object");
+ serviceSpecCharacteristic.put("@type", "ONAPServiceCharacteristic");
+ serviceSpecCharacteristic.put("@schemaLocation", "null");
+ serviceSpecCharacteristic.put("serviceSpecCharacteristicValue", serviceSpecCharacteristicValue);
+ try {
+ toscaInfosProcessor.buildAndSaveResponseWithSdcToscaParser(path, response);
+ } catch (SdcToscaParserException ex) {
+ throw new TechnicalException("unable to build response " + ex.getMessage());
+ }
+ assertThat(response.get("serviceSpecCharacteristic")).isEqualTo(serviceSpecCharacteristic);
}
- assertThat(response.get("serviceSpecCharacteristic")).isEqualTo(serviceSpecCharacteristic);
- }
-
-
- @Test
- public void testBuildAndSaveResponseWithSdcToscaParserWithInputListType() {
-
- ClassLoader classLoader = getClass().getClassLoader();
- Path path = new File(
- classLoader.getResource("toscafile/service-MscmEvplService-csar.csar").getFile())
- .toPath().toAbsolutePath();
-
- LinkedHashMap response = new LinkedHashMap();
- response.put("version", "1.0");
- response.put("name", "MSCM-EVPL-Service");
- response.put("description", "MSCM EVPL Service");
- response.put("id", "66a66cc3-178c-45fd-82c2-494336cb3665");
-
- List<LinkedHashMap> resources = new ArrayList<>();
- LinkedHashMap resource1 = new LinkedHashMap();
- resource1.put("id", "f5f487df-8c02-4485-81d4-695c50e24b22");
- resources.add(resource1);
- LinkedHashMap resource2 = new LinkedHashMap();
- resource2.put("id", "65c34b35-e8ab-426a-b048-d707467f68b2");
- resources.add(resource2);
-
- response.put("resourceSpecification", resources);
-
- LinkedHashMap serviceSpecCharacteristicValue = new LinkedHashMap();
- serviceSpecCharacteristicValue.put("valueType", "object");
- serviceSpecCharacteristicValue.put("@schemaLocation",
- "/serviceSpecification/66a66cc3-178c-45fd-82c2-494336cb3665/specificationInputSchema");
- serviceSpecCharacteristicValue.put("@type", "MSCM-EVPL-Service_ServiceCharacteristic");
-
- LinkedHashMap serviceSpecCharacteristic = new LinkedHashMap();
- serviceSpecCharacteristic.put("name", "MSCM-EVPL-Service_ServiceCharacteristics");
- serviceSpecCharacteristic.put("description",
- "This object describes all the inputs needed from the client to interact with the MSCM-EVPL-Service Service Topology");
- // using object to match examples in specifications
- serviceSpecCharacteristic.put("valueType", "object");
- serviceSpecCharacteristic.put("@type", "ONAPServiceCharacteristic");
- serviceSpecCharacteristic.put("@schemaLocation", "null");
- serviceSpecCharacteristic.put("serviceSpecCharacteristicValue", serviceSpecCharacteristicValue);
- try {
- toscaInfosProcessor.buildAndSaveResponseWithSdcToscaParser(path, response);
- } catch (SdcToscaParserException ex) {
- throw new TechnicalException("unable to build response " + ex.getMessage());
+
+ @Test
+ public void testBuildAndSaveResponseWithSdcToscaParserWithInputListType() {
+
+ ClassLoader classLoader = getClass().getClassLoader();
+ Path path = new File(classLoader.getResource("toscafile/service-MscmEvplService-csar.csar").getFile()).toPath()
+ .toAbsolutePath();
+
+ LinkedHashMap response = new LinkedHashMap();
+ response.put("version", "1.0");
+ response.put("name", "MSCM-EVPL-Service");
+ response.put("description", "MSCM EVPL Service");
+ response.put("id", "66a66cc3-178c-45fd-82c2-494336cb3665");
+
+ List<LinkedHashMap> resources = new ArrayList<>();
+ LinkedHashMap resource1 = new LinkedHashMap();
+ resource1.put("id", "f5f487df-8c02-4485-81d4-695c50e24b22");
+ resources.add(resource1);
+ LinkedHashMap resource2 = new LinkedHashMap();
+ resource2.put("id", "65c34b35-e8ab-426a-b048-d707467f68b2");
+ resources.add(resource2);
+
+ response.put("resourceSpecification", resources);
+
+ LinkedHashMap serviceSpecCharacteristicValue = new LinkedHashMap();
+ serviceSpecCharacteristicValue.put("valueType", "object");
+ serviceSpecCharacteristicValue.put("@schemaLocation",
+ "/serviceSpecification/66a66cc3-178c-45fd-82c2-494336cb3665/specificationInputSchema");
+ serviceSpecCharacteristicValue.put("@type", "MSCM-EVPL-Service_ServiceCharacteristic");
+
+ LinkedHashMap serviceSpecCharacteristic = new LinkedHashMap();
+ serviceSpecCharacteristic.put("name", "MSCM-EVPL-Service_ServiceCharacteristics");
+ serviceSpecCharacteristic.put("description",
+ "This object describes all the inputs needed from the client to interact with the MSCM-EVPL-Service Service Topology");
+ // using object to match examples in specifications
+ serviceSpecCharacteristic.put("valueType", "object");
+ serviceSpecCharacteristic.put("@type", "ONAPServiceCharacteristic");
+ serviceSpecCharacteristic.put("@schemaLocation", "null");
+ serviceSpecCharacteristic.put("serviceSpecCharacteristicValue", serviceSpecCharacteristicValue);
+ try {
+ toscaInfosProcessor.buildAndSaveResponseWithSdcToscaParser(path, response);
+ } catch (SdcToscaParserException ex) {
+ throw new TechnicalException("unable to build response " + ex.getMessage());
+ }
+ assertThat(response.get("serviceSpecCharacteristic")).isEqualTo(serviceSpecCharacteristic);
}
- assertThat(response.get("serviceSpecCharacteristic")).isEqualTo(serviceSpecCharacteristic);
- }
}
diff --git a/src/test/java/org/onap/nbi/test/Context.java b/src/test/java/org/onap/nbi/test/Context.java
index 10ad2c2..e1066fd 100644
--- a/src/test/java/org/onap/nbi/test/Context.java
+++ b/src/test/java/org/onap/nbi/test/Context.java
@@ -11,6 +11,7 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
+
package org.onap.nbi.test;
import com.github.tomakehurst.wiremock.WireMockServer;
@@ -25,81 +26,80 @@ import org.springframework.web.context.request.ServletRequestAttributes;
public class Context {
+ public static ConfigurableApplicationContext nbiServer;
- public static ConfigurableApplicationContext nbiServer;
+ public static WireMockServer wireMockServer;
- public static WireMockServer wireMockServer;
+ public static void startServers() throws Exception {
+ startWiremock();
- public static void startServers() throws Exception {
- startWiremock();
+ // NBI
+ if (nbiServer == null) {
+ String[] args = new String[1];
+ args[0] = "--spring.profiles.active=test";
+ nbiServer = Application.run(args);
+ MockHttpServletRequest request = new MockHttpServletRequest();
+ RequestContextHolder.setRequestAttributes(new ServletRequestAttributes(request));
+ }
- // NBI
- if (nbiServer == null) {
- String[] args = new String[1];
- args[0] = "--spring.profiles.active=test";
- nbiServer = Application.run(args);
- MockHttpServletRequest request = new MockHttpServletRequest();
- RequestContextHolder.setRequestAttributes(new ServletRequestAttributes(request));
}
- }
-
- public static void startWiremock() {
- // Wiremock
- // If wireMockServer was previously created
- if (wireMockServer != null) {
- wireMockServer.stop();
- wireMockServer.resetToDefaultMappings();
- } else {
- wireMockServer =
- new WireMockServer(
- WireMockConfiguration.wireMockConfig().port(8091).jettyStopTimeout(1000L));
+ public static void startWiremock() {
+ // Wiremock
+ // If wireMockServer was previously created
+ if (wireMockServer != null) {
+ wireMockServer.stop();
+ wireMockServer.resetToDefaultMappings();
+ } else {
+ wireMockServer =
+ new WireMockServer(WireMockConfiguration.wireMockConfig().port(8091).jettyStopTimeout(1000L));
+ }
+
+ wireMockServer.start();
}
- wireMockServer.start();
- }
+ public static void removeWireMockMapping(String mappingToBeRemoved) {
- public static void removeWireMockMapping(String mappingToBeRemoved) {
+ if (mappingToBeRemoved == null) {
+ return;
+ }
- if (mappingToBeRemoved == null) {
- return;
- }
+ // Get current mappings
+ List<StubMapping> mappings = wireMockServer.listAllStubMappings().getMappings();
- // Get current mappings
- List<StubMapping> mappings = wireMockServer.listAllStubMappings().getMappings();
+ StubMapping mappingToDelete = null;
+ for (StubMapping mapping : mappings) {
+ if (mapping.getRequest().getUrl().equals(mappingToBeRemoved)) {
+ mappingToDelete = mapping;
+ }
+ }
- StubMapping mappingToDelete = null;
- for (StubMapping mapping : mappings) {
- if (mapping.getRequest().getUrl().equals(mappingToBeRemoved)) {
- mappingToDelete = mapping;
- }
+ if (mappingToDelete != null) {
+ wireMockServer.removeStubMapping(mappingToDelete);
+ }
}
- if (mappingToDelete != null) {
- wireMockServer.removeStubMapping(mappingToDelete);
- }
- }
+ public static void stopServers() throws Exception {
- public static void stopServers() throws Exception {
+ // NBI
+ if (nbiServer != null) { // keep spring boot side alive for all tests including package
+ // 'mock'
+ nbiServer.close();
+ }
- // NBI
- if (nbiServer != null) { // keep spring boot side alive for all tests including package
- // 'mock'
- nbiServer.close();
- }
+ // Wiremock
+ if (wireMockServer != null) {
+ wireMockServer.stop();
+ }
- // Wiremock
- if (wireMockServer != null) {
- wireMockServer.stop();
}
- }
- public static void stopWiremock() throws Exception {
+ public static void stopWiremock() throws Exception {
- // Wiremock
- if (wireMockServer != null) {
- wireMockServer.stop();
- }
+ // Wiremock
+ if (wireMockServer != null) {
+ wireMockServer.stop();
+ }
- }
+ }
}
diff --git a/src/test/java/org/onap/nbi/test/ExecutionTaskTest.java b/src/test/java/org/onap/nbi/test/ExecutionTaskTest.java
index 4d32672..ca33c39 100644
--- a/src/test/java/org/onap/nbi/test/ExecutionTaskTest.java
+++ b/src/test/java/org/onap/nbi/test/ExecutionTaskTest.java
@@ -11,8 +11,8 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-package org.onap.nbi.test;
+package org.onap.nbi.test;
import static org.assertj.core.api.Assertions.assertThat;
import java.util.Calendar;
@@ -56,615 +56,550 @@ import com.github.tomakehurst.wiremock.stubbing.StubMapping;
@DirtiesContext(classMode = ClassMode.AFTER_CLASS)
public class ExecutionTaskTest {
- @Autowired
- ServiceOrderRepository serviceOrderRepository;
-
- @Autowired
- ExecutionTaskRepository executionTaskRepository;
-
- @Autowired
- SOTaskProcessor SoTaskProcessor;
-
-
- static Validator validator;
-
- @Before
- public void before() {
- MockHttpServletRequest request = new MockHttpServletRequest();
- RequestContextHolder.setRequestAttributes(new ServletRequestAttributes(request));
- }
-
- @BeforeClass
- public static void setUp() throws Exception {
- ValidatorFactory factory = Validation.buildDefaultValidatorFactory();
- validator = factory.getValidator();
- Context.startWiremock();
- }
-
- @AfterClass
- public static void tearsDown() throws Exception {
- Context.stopServers();
+ @Autowired
+ ServiceOrderRepository serviceOrderRepository;
- }
+ @Autowired
+ ExecutionTaskRepository executionTaskRepository;
- @After
- public void tearsDownUpPort() throws Exception {
- executionTaskRepository.deleteAll();
- serviceOrderRepository.deleteAll();
- Context.wireMockServer.resetToDefaultMappings();
+ @Autowired
+ SOTaskProcessor SoTaskProcessor;
- }
+ static Validator validator;
-
- public ExecutionTask getExecutionTask(String orderItemId) {
- for (ExecutionTask executionTask : executionTaskRepository.findAll()) {
- if (executionTask.getOrderItemId().equalsIgnoreCase(orderItemId)) {
- return executionTask;
- }
-
- }
- return null;
- }
-
- private void changeWireMockResponse(String s, int statusCode, String bodyContent) {
- ListStubMappingsResult listStubMappingsResult = Context.wireMockServer.listAllStubMappings();
- ResponseDefinition responseDefinition = new ResponseDefinition(statusCode, bodyContent);
- List<StubMapping> mappings = listStubMappingsResult.getMappings();
- for (StubMapping mapping : mappings) {
- if (mapping.getRequest().getUrl().equals(s)) {
- mapping.setResponse(responseDefinition);
- }
+ @Before
+ public void before() {
+ MockHttpServletRequest request = new MockHttpServletRequest();
+ RequestContextHolder.setRequestAttributes(new ServletRequestAttributes(request));
}
- }
-
-
- private ServiceOrder getServiceOrder(String serviceOrderId) {
- Optional<ServiceOrder> serviceOrderChecked = serviceOrderRepository.findById(serviceOrderId);
- return serviceOrderChecked.get();
- }
-
-
-
- @Test
- public void testExecutionTaskSuccess() throws Exception {
-
- ExecutionTask executionTaskA =
- ServiceOrderExecutionTaskAssertions.setUpBddForExecutionTaskSucess(serviceOrderRepository,
- executionTaskRepository, ActionType.ADD);
- ExecutionTask executionTaskB;
-
- SoTaskProcessor.processOrderItem(executionTaskA);
- ServiceOrder serviceOrderChecked = getServiceOrder("test");
- assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.INPROGRESS);
- for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) {
- if (serviceOrderItem.getId().equals("A")) {
- assertThat(serviceOrderItem.getState()).isEqualTo(StateType.COMPLETED);
- } else {
- assertThat(serviceOrderItem.getState()).isEqualTo(StateType.ACKNOWLEDGED);
- }
+ @BeforeClass
+ public static void setUp() throws Exception {
+ ValidatorFactory factory = Validation.buildDefaultValidatorFactory();
+ validator = factory.getValidator();
+ Context.startWiremock();
}
- executionTaskB = getExecutionTask("B");
- assertThat(executionTaskB.getReliedTasks()).isNullOrEmpty();
- executionTaskA = getExecutionTask("A");
- assertThat(executionTaskA).isNull();
-
- SoTaskProcessor.processOrderItem(executionTaskB);
- serviceOrderChecked = getServiceOrder("test");
- assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.COMPLETED);
- for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) {
- assertThat(serviceOrderItem.getState()).isEqualTo(StateType.COMPLETED);
+ @AfterClass
+ public static void tearsDown() throws Exception {
+ Context.stopServers();
}
- assertThat(executionTaskRepository.count()).isEqualTo(0);
-
-
-
- }
+ @After
+ public void tearsDownUpPort() throws Exception {
+ executionTaskRepository.deleteAll();
+ serviceOrderRepository.deleteAll();
+ Context.wireMockServer.resetToDefaultMappings();
- @Test
- public void testE2EExecutionTaskSuccess() throws Exception {
-
- ExecutionTask executionTaskA =
- ServiceOrderExecutionTaskAssertions.setUpBddForE2EExecutionTaskSucess(
- serviceOrderRepository, executionTaskRepository, ActionType.ADD);
- ExecutionTask executionTaskB;
-
-
- SoTaskProcessor.processOrderItem(executionTaskA);
- ServiceOrder serviceOrderChecked = getServiceOrder("test");
- assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.INPROGRESS);
- for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) {
- if (serviceOrderItem.getId().equals("A")) {
- assertThat(serviceOrderItem.getState()).isEqualTo(StateType.COMPLETED);
- } else {
- assertThat(serviceOrderItem.getState()).isEqualTo(StateType.ACKNOWLEDGED);
- }
}
- executionTaskB = getExecutionTask("B");
- assertThat(executionTaskB.getReliedTasks()).isNullOrEmpty();
- executionTaskA = getExecutionTask("A");
- assertThat(executionTaskA).isNull();
-
- SoTaskProcessor.processOrderItem(executionTaskB);
- serviceOrderChecked = getServiceOrder("test");
- assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.COMPLETED);
- for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) {
- assertThat(serviceOrderItem.getState()).isEqualTo(StateType.COMPLETED);
+ public ExecutionTask getExecutionTask(String orderItemId) {
+ for (ExecutionTask executionTask : executionTaskRepository.findAll()) {
+ if (executionTask.getOrderItemId().equalsIgnoreCase(orderItemId)) {
+ return executionTask;
+ }
+ }
+ return null;
}
- assertThat(executionTaskRepository.count()).isEqualTo(0);
-
-
-
- }
-
- @Test
- public void testE2EExecutionTaskSuccessWithObject() throws Exception {
-
- ExecutionTask executionTaskA =
- ServiceOrderExecutionTaskAssertions.setUpBddForE2EExecutionTaskSucessWithObject(
- serviceOrderRepository, executionTaskRepository, ActionType.ADD);
- ExecutionTask executionTaskB;
-
-
- SoTaskProcessor.processOrderItem(executionTaskA);
- ServiceOrder serviceOrderChecked = getServiceOrder("test");
- assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.INPROGRESS);
- for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) {
- if (serviceOrderItem.getId().equals("A")) {
- assertThat(serviceOrderItem.getState()).isEqualTo(StateType.COMPLETED);
- } else {
- assertThat(serviceOrderItem.getState()).isEqualTo(StateType.ACKNOWLEDGED);
- }
+ private void changeWireMockResponse(String s, int statusCode, String bodyContent) {
+ ListStubMappingsResult listStubMappingsResult = Context.wireMockServer.listAllStubMappings();
+ ResponseDefinition responseDefinition = new ResponseDefinition(statusCode, bodyContent);
+ List<StubMapping> mappings = listStubMappingsResult.getMappings();
+ for (StubMapping mapping : mappings) {
+ if (mapping.getRequest().getUrl().equals(s)) {
+ mapping.setResponse(responseDefinition);
+ }
+ }
}
- executionTaskB = getExecutionTask("B");
- assertThat(executionTaskB.getReliedTasks()).isNullOrEmpty();
- executionTaskA = getExecutionTask("A");
- assertThat(executionTaskA).isNull();
-
- SoTaskProcessor.processOrderItem(executionTaskB);
- serviceOrderChecked = getServiceOrder("test");
- assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.COMPLETED);
- for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) {
- assertThat(serviceOrderItem.getState()).isEqualTo(StateType.COMPLETED);
-
+ private ServiceOrder getServiceOrder(String serviceOrderId) {
+ Optional<ServiceOrder> serviceOrderChecked = serviceOrderRepository.findById(serviceOrderId);
+ return serviceOrderChecked.get();
}
- assertThat(executionTaskRepository.count()).isEqualTo(0);
-
+ @Test
+ public void testExecutionTaskSuccess() throws Exception {
+ ExecutionTask executionTaskA = ServiceOrderExecutionTaskAssertions
+ .setUpBddForExecutionTaskSucess(serviceOrderRepository, executionTaskRepository, ActionType.ADD);
+ ExecutionTask executionTaskB;
- }
+ SoTaskProcessor.processOrderItem(executionTaskA);
+ ServiceOrder serviceOrderChecked = getServiceOrder("test");
+ assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.INPROGRESS);
+ for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) {
+ if (serviceOrderItem.getId().equals("A")) {
+ assertThat(serviceOrderItem.getState()).isEqualTo(StateType.COMPLETED);
+ } else {
+ assertThat(serviceOrderItem.getState()).isEqualTo(StateType.ACKNOWLEDGED);
+ }
+ }
- @Test
- public void testE2EExecutionTaskSuccessWithComplexObject() throws Exception {
- // A Service Order with complex object including arrays
- ExecutionTask executionTaskA =
- ServiceOrderExecutionTaskAssertions.setUpBddForE2EExecutionTaskSucessWithComplexObject(
- serviceOrderRepository, executionTaskRepository, ActionType.ADD);
- ExecutionTask executionTaskB;
+ executionTaskB = getExecutionTask("B");
+ assertThat(executionTaskB.getReliedTasks()).isNullOrEmpty();
+ executionTaskA = getExecutionTask("A");
+ assertThat(executionTaskA).isNull();
+ SoTaskProcessor.processOrderItem(executionTaskB);
+ serviceOrderChecked = getServiceOrder("test");
+ assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.COMPLETED);
+ for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) {
+ assertThat(serviceOrderItem.getState()).isEqualTo(StateType.COMPLETED);
- SoTaskProcessor.processOrderItem(executionTaskA);
- ServiceOrder serviceOrderChecked = getServiceOrder("test");
- assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.INPROGRESS);
- for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) {
- if (serviceOrderItem.getId().equals("A")) {
- assertThat(serviceOrderItem.getState()).isEqualTo(StateType.COMPLETED);
- } else {
- assertThat(serviceOrderItem.getState()).isEqualTo(StateType.ACKNOWLEDGED);
- }
- }
+ }
- executionTaskB = getExecutionTask("B");
- assertThat(executionTaskB.getReliedTasks()).isNullOrEmpty();
- executionTaskA = getExecutionTask("A");
- assertThat(executionTaskA).isNull();
-
- SoTaskProcessor.processOrderItem(executionTaskB);
- serviceOrderChecked = getServiceOrder("test");
- assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.COMPLETED);
- for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) {
- assertThat(serviceOrderItem.getState()).isEqualTo(StateType.COMPLETED);
+ assertThat(executionTaskRepository.count()).isEqualTo(0);
}
- assertThat(executionTaskRepository.count()).isEqualTo(0);
+ @Test
+ public void testE2EExecutionTaskSuccess() throws Exception {
+ ExecutionTask executionTaskA = ServiceOrderExecutionTaskAssertions
+ .setUpBddForE2EExecutionTaskSucess(serviceOrderRepository, executionTaskRepository, ActionType.ADD);
+ ExecutionTask executionTaskB;
+ SoTaskProcessor.processOrderItem(executionTaskA);
+ ServiceOrder serviceOrderChecked = getServiceOrder("test");
+ assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.INPROGRESS);
+ for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) {
+ if (serviceOrderItem.getId().equals("A")) {
+ assertThat(serviceOrderItem.getState()).isEqualTo(StateType.COMPLETED);
+ } else {
+ assertThat(serviceOrderItem.getState()).isEqualTo(StateType.ACKNOWLEDGED);
+ }
+ }
- }
+ executionTaskB = getExecutionTask("B");
+ assertThat(executionTaskB.getReliedTasks()).isNullOrEmpty();
+ executionTaskA = getExecutionTask("A");
+ assertThat(executionTaskA).isNull();
- @Test
- public void testExecutionTaskDeleteSuccess() throws Exception {
+ SoTaskProcessor.processOrderItem(executionTaskB);
+ serviceOrderChecked = getServiceOrder("test");
+ assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.COMPLETED);
+ for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) {
+ assertThat(serviceOrderItem.getState()).isEqualTo(StateType.COMPLETED);
- ExecutionTask executionTaskA =
- ServiceOrderExecutionTaskAssertions.setUpBddForExecutionTaskSucess(serviceOrderRepository,
- executionTaskRepository, ActionType.DELETE);
- ExecutionTask executionTaskB;
+ }
+ assertThat(executionTaskRepository.count()).isEqualTo(0);
- SoTaskProcessor.processOrderItem(executionTaskA);
- ServiceOrder serviceOrderChecked = getServiceOrder("test");
- assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.INPROGRESS);
- for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) {
- if (serviceOrderItem.getId().equals("A")) {
- assertThat(serviceOrderItem.getState()).isEqualTo(StateType.COMPLETED);
- } else {
- assertThat(serviceOrderItem.getState()).isEqualTo(StateType.ACKNOWLEDGED);
- }
}
- executionTaskB = getExecutionTask("B");
- assertThat(executionTaskB.getReliedTasks()).isNullOrEmpty();
- executionTaskA = getExecutionTask("A");
- assertThat(executionTaskA).isNull();
+ @Test
+ public void testE2EExecutionTaskSuccessWithObject() throws Exception {
- SoTaskProcessor.processOrderItem(executionTaskB);
- serviceOrderChecked = getServiceOrder("test");
- assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.COMPLETED);
- for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) {
- assertThat(serviceOrderItem.getState()).isEqualTo(StateType.COMPLETED);
+ ExecutionTask executionTaskA = ServiceOrderExecutionTaskAssertions.setUpBddForE2EExecutionTaskSucessWithObject(
+ serviceOrderRepository, executionTaskRepository, ActionType.ADD);
+ ExecutionTask executionTaskB;
- }
+ SoTaskProcessor.processOrderItem(executionTaskA);
+ ServiceOrder serviceOrderChecked = getServiceOrder("test");
+ assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.INPROGRESS);
+ for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) {
+ if (serviceOrderItem.getId().equals("A")) {
+ assertThat(serviceOrderItem.getState()).isEqualTo(StateType.COMPLETED);
+ } else {
+ assertThat(serviceOrderItem.getState()).isEqualTo(StateType.ACKNOWLEDGED);
+ }
+ }
- assertThat(executionTaskRepository.count()).isEqualTo(0);
+ executionTaskB = getExecutionTask("B");
+ assertThat(executionTaskB.getReliedTasks()).isNullOrEmpty();
+ executionTaskA = getExecutionTask("A");
+ assertThat(executionTaskA).isNull();
+ SoTaskProcessor.processOrderItem(executionTaskB);
+ serviceOrderChecked = getServiceOrder("test");
+ assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.COMPLETED);
+ for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) {
+ assertThat(serviceOrderItem.getState()).isEqualTo(StateType.COMPLETED);
+ }
- }
+ assertThat(executionTaskRepository.count()).isEqualTo(0);
- @Test
- public void testE2EExecutionTaskDeleteSuccess() throws Exception {
-
- ExecutionTask executionTaskA =
- ServiceOrderExecutionTaskAssertions.setUpBddForE2EExecutionTaskSucess(
- serviceOrderRepository, executionTaskRepository, ActionType.DELETE);
- ExecutionTask executionTaskB;
+ }
+ @Test
+ public void testE2EExecutionTaskSuccessWithComplexObject() throws Exception {
+ // A Service Order with complex object including arrays
+ ExecutionTask executionTaskA =
+ ServiceOrderExecutionTaskAssertions.setUpBddForE2EExecutionTaskSucessWithComplexObject(
+ serviceOrderRepository, executionTaskRepository, ActionType.ADD);
+ ExecutionTask executionTaskB;
+
+ SoTaskProcessor.processOrderItem(executionTaskA);
+ ServiceOrder serviceOrderChecked = getServiceOrder("test");
+ assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.INPROGRESS);
+ for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) {
+ if (serviceOrderItem.getId().equals("A")) {
+ assertThat(serviceOrderItem.getState()).isEqualTo(StateType.COMPLETED);
+ } else {
+ assertThat(serviceOrderItem.getState()).isEqualTo(StateType.ACKNOWLEDGED);
+ }
+ }
+
+ executionTaskB = getExecutionTask("B");
+ assertThat(executionTaskB.getReliedTasks()).isNullOrEmpty();
+ executionTaskA = getExecutionTask("A");
+ assertThat(executionTaskA).isNull();
+
+ SoTaskProcessor.processOrderItem(executionTaskB);
+ serviceOrderChecked = getServiceOrder("test");
+ assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.COMPLETED);
+ for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) {
+ assertThat(serviceOrderItem.getState()).isEqualTo(StateType.COMPLETED);
+
+ }
+
+ assertThat(executionTaskRepository.count()).isEqualTo(0);
- SoTaskProcessor.processOrderItem(executionTaskA);
- ServiceOrder serviceOrderChecked = getServiceOrder("test");
- assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.INPROGRESS);
- for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) {
- if (serviceOrderItem.getId().equals("A")) {
- assertThat(serviceOrderItem.getState()).isEqualTo(StateType.COMPLETED);
- } else {
- assertThat(serviceOrderItem.getState()).isEqualTo(StateType.ACKNOWLEDGED);
- }
}
- executionTaskB = getExecutionTask("B");
- assertThat(executionTaskB.getReliedTasks()).isNullOrEmpty();
- executionTaskA = getExecutionTask("A");
- assertThat(executionTaskA).isNull();
+ @Test
+ public void testExecutionTaskDeleteSuccess() throws Exception {
- SoTaskProcessor.processOrderItem(executionTaskB);
- serviceOrderChecked = getServiceOrder("test");
- assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.COMPLETED);
- for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) {
- assertThat(serviceOrderItem.getState()).isEqualTo(StateType.COMPLETED);
+ ExecutionTask executionTaskA = ServiceOrderExecutionTaskAssertions
+ .setUpBddForExecutionTaskSucess(serviceOrderRepository, executionTaskRepository, ActionType.DELETE);
+ ExecutionTask executionTaskB;
- }
+ SoTaskProcessor.processOrderItem(executionTaskA);
+ ServiceOrder serviceOrderChecked = getServiceOrder("test");
+ assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.INPROGRESS);
+ for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) {
+ if (serviceOrderItem.getId().equals("A")) {
+ assertThat(serviceOrderItem.getState()).isEqualTo(StateType.COMPLETED);
+ } else {
+ assertThat(serviceOrderItem.getState()).isEqualTo(StateType.ACKNOWLEDGED);
+ }
+ }
- assertThat(executionTaskRepository.count()).isEqualTo(0);
+ executionTaskB = getExecutionTask("B");
+ assertThat(executionTaskB.getReliedTasks()).isNullOrEmpty();
+ executionTaskA = getExecutionTask("A");
+ assertThat(executionTaskA).isNull();
+ SoTaskProcessor.processOrderItem(executionTaskB);
+ serviceOrderChecked = getServiceOrder("test");
+ assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.COMPLETED);
+ for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) {
+ assertThat(serviceOrderItem.getState()).isEqualTo(StateType.COMPLETED);
+ }
- }
+ assertThat(executionTaskRepository.count()).isEqualTo(0);
+ }
- @Test
- public void testExecutionTaskFailed() throws Exception {
+ @Test
+ public void testE2EExecutionTaskDeleteSuccess() throws Exception {
- ExecutionTask executionTaskA =
- ServiceOrderExecutionTaskAssertions.setUpBddForExecutionTaskSucess(serviceOrderRepository,
- executionTaskRepository, ActionType.ADD);
+ ExecutionTask executionTaskA = ServiceOrderExecutionTaskAssertions
+ .setUpBddForE2EExecutionTaskSucess(serviceOrderRepository, executionTaskRepository, ActionType.DELETE);
+ ExecutionTask executionTaskB;
- Context.removeWireMockMapping("/onap/so/infra/orchestrationRequests/v7/requestId");
+ SoTaskProcessor.processOrderItem(executionTaskA);
+ ServiceOrder serviceOrderChecked = getServiceOrder("test");
+ assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.INPROGRESS);
+ for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) {
+ if (serviceOrderItem.getId().equals("A")) {
+ assertThat(serviceOrderItem.getState()).isEqualTo(StateType.COMPLETED);
+ } else {
+ assertThat(serviceOrderItem.getState()).isEqualTo(StateType.ACKNOWLEDGED);
+ }
+ }
+ executionTaskB = getExecutionTask("B");
+ assertThat(executionTaskB.getReliedTasks()).isNullOrEmpty();
+ executionTaskA = getExecutionTask("A");
+ assertThat(executionTaskA).isNull();
- SoTaskProcessor.processOrderItem(executionTaskA);
- ServiceOrder serviceOrderChecked = getServiceOrder("test");
- assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.INPROGRESS);
- for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) {
- if (serviceOrderItem.getId().equals("A")) {
- assertThat(serviceOrderItem.getState()).isEqualTo(StateType.INPROGRESS);
- } else {
- assertThat(serviceOrderItem.getState()).isEqualTo(StateType.ACKNOWLEDGED);
- }
- }
- executionTaskA = getExecutionTask("A");
- Date createDate = executionTaskA.getCreateDate();
- assertThat(executionTaskA.getLastAttemptDate().getTime() > createDate.getTime()).isTrue();
+ SoTaskProcessor.processOrderItem(executionTaskB);
+ serviceOrderChecked = getServiceOrder("test");
+ assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.COMPLETED);
+ for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) {
+ assertThat(serviceOrderItem.getState()).isEqualTo(StateType.COMPLETED);
- changeCreationDate(executionTaskA);
- SoTaskProcessor.processOrderItem(executionTaskA);
+ }
- serviceOrderChecked = getServiceOrder("test");
- assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.FAILED);
- for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) {
- assertThat(serviceOrderItem.getState()).isEqualTo(StateType.FAILED);
+ assertThat(executionTaskRepository.count()).isEqualTo(0);
}
- assertThat(executionTaskRepository.count()).isEqualTo(0);
-
+ @Test
+ public void testExecutionTaskFailed() throws Exception {
- }
+ ExecutionTask executionTaskA = ServiceOrderExecutionTaskAssertions
+ .setUpBddForExecutionTaskSucess(serviceOrderRepository, executionTaskRepository, ActionType.ADD);
- private void changeCreationDate(ExecutionTask executionTaskA) {
- Calendar cal = Calendar.getInstance();
- cal.setTime(executionTaskA.getCreateDate());
- cal.add(Calendar.SECOND, -30);
- executionTaskA.setCreateDate(cal.getTime());
- }
+ Context.removeWireMockMapping("/onap/so/infra/orchestrationRequests/v7/requestId");
+ SoTaskProcessor.processOrderItem(executionTaskA);
+ ServiceOrder serviceOrderChecked = getServiceOrder("test");
+ assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.INPROGRESS);
+ for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) {
+ if (serviceOrderItem.getId().equals("A")) {
+ assertThat(serviceOrderItem.getState()).isEqualTo(StateType.INPROGRESS);
+ } else {
+ assertThat(serviceOrderItem.getState()).isEqualTo(StateType.ACKNOWLEDGED);
+ }
+ }
+ executionTaskA = getExecutionTask("A");
+ Date createDate = executionTaskA.getCreateDate();
+ assertThat(executionTaskA.getLastAttemptDate().getTime() > createDate.getTime()).isTrue();
- @Test
- public void testE2EExecutionTaskFailed() throws Exception {
+ changeCreationDate(executionTaskA);
+ SoTaskProcessor.processOrderItem(executionTaskA);
- ExecutionTask executionTaskA =
- ServiceOrderExecutionTaskAssertions.setUpBddForE2EExecutionTaskSucess(
- serviceOrderRepository, executionTaskRepository, ActionType.ADD);
+ serviceOrderChecked = getServiceOrder("test");
+ assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.FAILED);
+ for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) {
+ assertThat(serviceOrderItem.getState()).isEqualTo(StateType.FAILED);
- Context.removeWireMockMapping(
- "/onap/so/infra/e2eServiceInstances/v3/serviceId/operations/operationId");
+ }
+ assertThat(executionTaskRepository.count()).isEqualTo(0);
- SoTaskProcessor.processOrderItem(executionTaskA);
- ServiceOrder serviceOrderChecked = getServiceOrder("test");
- assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.INPROGRESS);
- for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) {
- if (serviceOrderItem.getId().equals("A")) {
- assertThat(serviceOrderItem.getState()).isEqualTo(StateType.INPROGRESS);
- } else {
- assertThat(serviceOrderItem.getState()).isEqualTo(StateType.ACKNOWLEDGED);
- }
}
- executionTaskA = getExecutionTask("A");
- assertThat(
- executionTaskA.getLastAttemptDate().getTime() > executionTaskA.getCreateDate().getTime())
- .isTrue();
- changeCreationDate(executionTaskA);
- SoTaskProcessor.processOrderItem(executionTaskA);
-
- serviceOrderChecked = getServiceOrder("test");
- assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.FAILED);
- for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) {
- assertThat(serviceOrderItem.getState()).isEqualTo(StateType.FAILED);
+ private void changeCreationDate(ExecutionTask executionTaskA) {
+ Calendar cal = Calendar.getInstance();
+ cal.setTime(executionTaskA.getCreateDate());
+ cal.add(Calendar.SECOND, -30);
+ executionTaskA.setCreateDate(cal.getTime());
}
- assertThat(executionTaskRepository.count()).isEqualTo(0);
+ @Test
+ public void testE2EExecutionTaskFailed() throws Exception {
+ ExecutionTask executionTaskA = ServiceOrderExecutionTaskAssertions
+ .setUpBddForE2EExecutionTaskSucess(serviceOrderRepository, executionTaskRepository, ActionType.ADD);
- }
+ Context.removeWireMockMapping("/onap/so/infra/e2eServiceInstances/v3/serviceId/operations/operationId");
- @Test
- public void testExecutionTaskFailedNoSoResponse() throws Exception {
+ SoTaskProcessor.processOrderItem(executionTaskA);
+ ServiceOrder serviceOrderChecked = getServiceOrder("test");
+ assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.INPROGRESS);
+ for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) {
+ if (serviceOrderItem.getId().equals("A")) {
+ assertThat(serviceOrderItem.getState()).isEqualTo(StateType.INPROGRESS);
+ } else {
+ assertThat(serviceOrderItem.getState()).isEqualTo(StateType.ACKNOWLEDGED);
+ }
+ }
+ executionTaskA = getExecutionTask("A");
+ assertThat(executionTaskA.getLastAttemptDate().getTime() > executionTaskA.getCreateDate().getTime()).isTrue();
+ changeCreationDate(executionTaskA);
+ SoTaskProcessor.processOrderItem(executionTaskA);
- ExecutionTask executionTaskA =
- ServiceOrderExecutionTaskAssertions.setUpBddForExecutionTaskSucess(serviceOrderRepository,
- executionTaskRepository, ActionType.ADD);
+ serviceOrderChecked = getServiceOrder("test");
+ assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.FAILED);
+ for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) {
+ assertThat(serviceOrderItem.getState()).isEqualTo(StateType.FAILED);
- Context.removeWireMockMapping("/onap/so/infra/serviceInstantiation/v7/serviceInstances/");
+ }
+ assertThat(executionTaskRepository.count()).isEqualTo(0);
- SoTaskProcessor.processOrderItem(executionTaskA);
- ServiceOrder serviceOrderChecked = getServiceOrder("test");
- assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.FAILED);
- for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) {
- assertThat(serviceOrderItem.getState()).isEqualTo(StateType.FAILED);
}
- assertThat(executionTaskRepository.count()).isEqualTo(0);
-
-
-
- }
+ @Test
+ public void testExecutionTaskFailedNoSoResponse() throws Exception {
- @Test
- public void testExecutionTaskFailedNoSoAndStatusResponse() throws Exception {
+ ExecutionTask executionTaskA = ServiceOrderExecutionTaskAssertions
+ .setUpBddForExecutionTaskSucess(serviceOrderRepository, executionTaskRepository, ActionType.ADD);
- ExecutionTask executionTaskA =
- ServiceOrderExecutionTaskAssertions.setUpBddForExecutionTaskSucess(serviceOrderRepository,
- executionTaskRepository, ActionType.ADD);
+ Context.removeWireMockMapping("/onap/so/infra/serviceInstantiation/v7/serviceInstances/");
- Context.removeWireMockMapping("/onap/so/infra/serviceInstantiation/v7/serviceInstances/");
- Context.removeWireMockMapping("/onap/so/infra/orchestrationRequests/v7/requestId");
+ SoTaskProcessor.processOrderItem(executionTaskA);
+ ServiceOrder serviceOrderChecked = getServiceOrder("test");
+ assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.FAILED);
+ for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) {
+ assertThat(serviceOrderItem.getState()).isEqualTo(StateType.FAILED);
+ }
+ assertThat(executionTaskRepository.count()).isEqualTo(0);
- SoTaskProcessor.processOrderItem(executionTaskA);
- ServiceOrder serviceOrderChecked = getServiceOrder("test");
- assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.FAILED);
- for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) {
- assertThat(serviceOrderItem.getState()).isEqualTo(StateType.FAILED);
}
- assertThat(executionTaskRepository.count()).isEqualTo(0);
+ @Test
+ public void testExecutionTaskFailedNoSoAndStatusResponse() throws Exception {
- }
+ ExecutionTask executionTaskA = ServiceOrderExecutionTaskAssertions
+ .setUpBddForExecutionTaskSucess(serviceOrderRepository, executionTaskRepository, ActionType.ADD);
- @Test
- public void testE2EExecutionTaskFailedNoSoAndStatusResponse() throws Exception {
+ Context.removeWireMockMapping("/onap/so/infra/serviceInstantiation/v7/serviceInstances/");
+ Context.removeWireMockMapping("/onap/so/infra/orchestrationRequests/v7/requestId");
- ExecutionTask executionTaskA =
- ServiceOrderExecutionTaskAssertions.setUpBddForE2EExecutionTaskSucess(
- serviceOrderRepository, executionTaskRepository, ActionType.ADD);
+ SoTaskProcessor.processOrderItem(executionTaskA);
+ ServiceOrder serviceOrderChecked = getServiceOrder("test");
+ assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.FAILED);
+ for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) {
+ assertThat(serviceOrderItem.getState()).isEqualTo(StateType.FAILED);
+ }
- Context.removeWireMockMapping("/onap/so/infra/e2eServiceInstances/v3");
- Context.removeWireMockMapping(
- "/onap/so/infra/e2eServiceInstances/v3/serviceId/operations/operationId");
+ assertThat(executionTaskRepository.count()).isEqualTo(0);
-
- SoTaskProcessor.processOrderItem(executionTaskA);
- ServiceOrder serviceOrderChecked = getServiceOrder("test");
- assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.FAILED);
- for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) {
- assertThat(serviceOrderItem.getState()).isEqualTo(StateType.FAILED);
}
- assertThat(executionTaskRepository.count()).isEqualTo(0);
-
- }
-
-
- @Test
- public void testExecutionTaskFailedBadRequestSo() throws Exception {
+ @Test
+ public void testE2EExecutionTaskFailedNoSoAndStatusResponse() throws Exception {
- ExecutionTask executionTaskA =
- ServiceOrderExecutionTaskAssertions.setUpBddForExecutionTaskSucess(serviceOrderRepository,
- executionTaskRepository, ActionType.ADD);
+ ExecutionTask executionTaskA = ServiceOrderExecutionTaskAssertions
+ .setUpBddForE2EExecutionTaskSucess(serviceOrderRepository, executionTaskRepository, ActionType.ADD);
+ Context.removeWireMockMapping("/onap/so/infra/e2eServiceInstances/v3");
+ Context.removeWireMockMapping("/onap/so/infra/e2eServiceInstances/v3/serviceId/operations/operationId");
- changeWireMockResponse("/onap/so/infra/serviceInstantiation/v7/serviceInstances/", 400,
- "\"serviceException\": {\n" + " \"messageId\": \"SVC0002\",\n"
- + " \"text\": \"Error parsing request. org.openecomp.mso.apihandler.common.ValidationException: serviceInstance already existsd\"\n"
- + " }");
+ SoTaskProcessor.processOrderItem(executionTaskA);
+ ServiceOrder serviceOrderChecked = getServiceOrder("test");
+ assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.FAILED);
+ for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) {
+ assertThat(serviceOrderItem.getState()).isEqualTo(StateType.FAILED);
+ }
+ assertThat(executionTaskRepository.count()).isEqualTo(0);
- SoTaskProcessor.processOrderItem(executionTaskA);
- ServiceOrder serviceOrderChecked = getServiceOrder("test");
- assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.FAILED);
- for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) {
- assertThat(serviceOrderItem.getState()).isEqualTo(StateType.FAILED);
}
- assertThat(executionTaskRepository.count()).isEqualTo(0);
+ @Test
+ public void testExecutionTaskFailedBadRequestSo() throws Exception {
- for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) {
- if (serviceOrderItem.getId().equals("A")) {
- assertThat(serviceOrderItem.getOrderItemMessage().size()).isEqualTo(1);
- assertThat(serviceOrderItem.getOrderItemMessage().get(0).getCode()).isEqualTo("105");
- assertThat(serviceOrderItem.getOrderItemMessage().get(0).getField())
- .isEqualTo("service.name");
- }
- }
-
- }
+ ExecutionTask executionTaskA = ServiceOrderExecutionTaskAssertions
+ .setUpBddForExecutionTaskSucess(serviceOrderRepository, executionTaskRepository, ActionType.ADD);
+ changeWireMockResponse("/onap/so/infra/serviceInstantiation/v7/serviceInstances/", 400,
+ "\"serviceException\": {\n" + " \"messageId\": \"SVC0002\",\n"
+ + " \"text\": \"Error parsing request. org.openecomp.mso.apihandler.common.ValidationException: serviceInstance already existsd\"\n"
+ + " }");
- @Test
- public void testExecutionTaskModifySuccess() throws Exception {
+ SoTaskProcessor.processOrderItem(executionTaskA);
+ ServiceOrder serviceOrderChecked = getServiceOrder("test");
+ assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.FAILED);
+ for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) {
+ assertThat(serviceOrderItem.getState()).isEqualTo(StateType.FAILED);
+ }
- ExecutionTask executionTaskA =
- ServiceOrderExecutionTaskAssertions.setUpBddForExecutionTaskSucess(serviceOrderRepository,
- executionTaskRepository, ActionType.MODIFY);
- ExecutionTask executionTaskB;
+ assertThat(executionTaskRepository.count()).isEqualTo(0);
+ for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) {
+ if (serviceOrderItem.getId().equals("A")) {
+ assertThat(serviceOrderItem.getOrderItemMessage().size()).isEqualTo(1);
+ assertThat(serviceOrderItem.getOrderItemMessage().get(0).getCode()).isEqualTo("105");
+ assertThat(serviceOrderItem.getOrderItemMessage().get(0).getField()).isEqualTo("service.name");
+ }
+ }
- SoTaskProcessor.processOrderItem(executionTaskA);
- ServiceOrder serviceOrderChecked = getServiceOrder("test");
- assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.INPROGRESS);
- for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) {
- if (serviceOrderItem.getId().equals("A")) {
- // assertThat(serviceOrderItem.getState()).isEqualTo(StateType.INPROGRESS);
- assertThat(serviceOrderItem.getState())
- .isEqualTo(StateType.INPROGRESS_MODIFY_ITEM_TO_CREATE);
- } else {
- assertThat(serviceOrderItem.getState()).isEqualTo(StateType.ACKNOWLEDGED);
- }
- }
- SoTaskProcessor.processOrderItem(executionTaskA);
- serviceOrderChecked = getServiceOrder("test");
- assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.INPROGRESS);
- for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) {
- if (serviceOrderItem.getId().equals("A")) {
- assertThat(serviceOrderItem.getState()).isEqualTo(StateType.COMPLETED);
- } else {
- assertThat(serviceOrderItem.getState()).isEqualTo(StateType.ACKNOWLEDGED);
- }
}
- executionTaskB = getExecutionTask("B");
- assertThat(executionTaskB.getReliedTasks()).isNullOrEmpty();
- executionTaskA = getExecutionTask("A");
- assertThat(executionTaskA).isNull();
-
- SoTaskProcessor.processOrderItem(executionTaskB);
- SoTaskProcessor.processOrderItem(executionTaskB);
-
- serviceOrderChecked = getServiceOrder("test");
- assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.COMPLETED);
- for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) {
- assertThat(serviceOrderItem.getState()).isEqualTo(StateType.COMPLETED);
+ @Test
+ public void testExecutionTaskModifySuccess() throws Exception {
+
+ ExecutionTask executionTaskA = ServiceOrderExecutionTaskAssertions
+ .setUpBddForExecutionTaskSucess(serviceOrderRepository, executionTaskRepository, ActionType.MODIFY);
+ ExecutionTask executionTaskB;
+
+ SoTaskProcessor.processOrderItem(executionTaskA);
+ ServiceOrder serviceOrderChecked = getServiceOrder("test");
+ assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.INPROGRESS);
+ for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) {
+ if (serviceOrderItem.getId().equals("A")) {
+ // assertThat(serviceOrderItem.getState()).isEqualTo(StateType.INPROGRESS);
+ assertThat(serviceOrderItem.getState()).isEqualTo(StateType.INPROGRESS_MODIFY_ITEM_TO_CREATE);
+ } else {
+ assertThat(serviceOrderItem.getState()).isEqualTo(StateType.ACKNOWLEDGED);
+ }
+ }
+ SoTaskProcessor.processOrderItem(executionTaskA);
+ serviceOrderChecked = getServiceOrder("test");
+ assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.INPROGRESS);
+ for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) {
+ if (serviceOrderItem.getId().equals("A")) {
+ assertThat(serviceOrderItem.getState()).isEqualTo(StateType.COMPLETED);
+ } else {
+ assertThat(serviceOrderItem.getState()).isEqualTo(StateType.ACKNOWLEDGED);
+ }
+ }
+
+ executionTaskB = getExecutionTask("B");
+ assertThat(executionTaskB.getReliedTasks()).isNullOrEmpty();
+ executionTaskA = getExecutionTask("A");
+ assertThat(executionTaskA).isNull();
+
+ SoTaskProcessor.processOrderItem(executionTaskB);
+ SoTaskProcessor.processOrderItem(executionTaskB);
+
+ serviceOrderChecked = getServiceOrder("test");
+ assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.COMPLETED);
+ for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) {
+ assertThat(serviceOrderItem.getState()).isEqualTo(StateType.COMPLETED);
+
+ }
+
+ assertThat(executionTaskRepository.count()).isEqualTo(0);
}
- assertThat(executionTaskRepository.count()).isEqualTo(0);
-
- }
-
-
-
- @Test
- public void testExecutionTaskModifyFailed() throws Exception {
-
- ExecutionTask executionTaskA =
- ServiceOrderExecutionTaskAssertions.setUpBddForExecutionTaskSucess(serviceOrderRepository,
- executionTaskRepository, ActionType.MODIFY);
- ExecutionTask executionTaskB;
- Context.removeWireMockMapping("/onap/so/infra/orchestrationRequests/v7/requestId");
-
-
- SoTaskProcessor.processOrderItem(executionTaskA);
- ServiceOrder serviceOrderChecked = getServiceOrder("test");
- assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.INPROGRESS);
- for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) {
- if (serviceOrderItem.getId().equals("A")) {
- // assertThat(serviceOrderItem.getState()).isEqualTo(StateType.INPROGRESS);
- assertThat(serviceOrderItem.getState())
- .isEqualTo(StateType.INPROGRESS_MODIFY_REQUEST_DELETE_SEND);
- } else {
- assertThat(serviceOrderItem.getState()).isEqualTo(StateType.ACKNOWLEDGED);
- }
- }
- executionTaskA = getExecutionTask("A");
- assertThat(
- executionTaskA.getLastAttemptDate().getTime() > executionTaskA.getCreateDate().getTime())
- .isTrue();
- changeCreationDate(executionTaskA);
- SoTaskProcessor.processOrderItem(executionTaskA);
-
- serviceOrderChecked = getServiceOrder("test");
- assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.FAILED);
- for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) {
- assertThat(serviceOrderItem.getState()).isEqualTo(StateType.FAILED);
+ @Test
+ public void testExecutionTaskModifyFailed() throws Exception {
+
+ ExecutionTask executionTaskA = ServiceOrderExecutionTaskAssertions
+ .setUpBddForExecutionTaskSucess(serviceOrderRepository, executionTaskRepository, ActionType.MODIFY);
+ ExecutionTask executionTaskB;
+ Context.removeWireMockMapping("/onap/so/infra/orchestrationRequests/v7/requestId");
+
+ SoTaskProcessor.processOrderItem(executionTaskA);
+ ServiceOrder serviceOrderChecked = getServiceOrder("test");
+ assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.INPROGRESS);
+ for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) {
+ if (serviceOrderItem.getId().equals("A")) {
+ // assertThat(serviceOrderItem.getState()).isEqualTo(StateType.INPROGRESS);
+ assertThat(serviceOrderItem.getState()).isEqualTo(StateType.INPROGRESS_MODIFY_REQUEST_DELETE_SEND);
+ } else {
+ assertThat(serviceOrderItem.getState()).isEqualTo(StateType.ACKNOWLEDGED);
+ }
+ }
+ executionTaskA = getExecutionTask("A");
+ assertThat(executionTaskA.getLastAttemptDate().getTime() > executionTaskA.getCreateDate().getTime()).isTrue();
+ changeCreationDate(executionTaskA);
+ SoTaskProcessor.processOrderItem(executionTaskA);
+
+ serviceOrderChecked = getServiceOrder("test");
+ assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.FAILED);
+ for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) {
+ assertThat(serviceOrderItem.getState()).isEqualTo(StateType.FAILED);
+
+ }
+
+ assertThat(executionTaskRepository.count()).isEqualTo(0);
}
- assertThat(executionTaskRepository.count()).isEqualTo(0);
+ @Test
+ public void testExecutionTaskWithoutOnap() throws Exception {
+ Context.stopWiremock();
+ ExecutionTask executionTaskA = ServiceOrderExecutionTaskAssertions
+ .setUpBddForExecutionTaskSucess(serviceOrderRepository, executionTaskRepository, ActionType.ADD);
+
+ SoTaskProcessor.processOrderItem(executionTaskA);
+ ServiceOrder serviceOrderChecked = getServiceOrder("test");
+ assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.FAILED);
+ for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) {
+ assertThat(serviceOrderItem.getState()).isEqualTo(StateType.FAILED);
+ }
+ assertThat(serviceOrderChecked.getOrderMessage().size()).isGreaterThan(0);
+ assertThat(serviceOrderChecked.getOrderMessage().get(0).getCode()).isEqualTo("502");
+ assertThat(serviceOrderChecked.getOrderMessage().get(0).getMessageInformation())
+ .isEqualTo("Problem with SO API");
+
+ assertThat(executionTaskRepository.count()).isEqualTo(0);
+ Context.startWiremock();
- }
-
- @Test
- public void testExecutionTaskWithoutOnap() throws Exception {
- Context.stopWiremock();
- ExecutionTask executionTaskA =
- ServiceOrderExecutionTaskAssertions.setUpBddForExecutionTaskSucess(serviceOrderRepository,
- executionTaskRepository, ActionType.ADD);
-
- SoTaskProcessor.processOrderItem(executionTaskA);
- ServiceOrder serviceOrderChecked = getServiceOrder("test");
- assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.FAILED);
- for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) {
- assertThat(serviceOrderItem.getState()).isEqualTo(StateType.FAILED);
}
- assertThat(serviceOrderChecked.getOrderMessage().size()).isGreaterThan(0);
- assertThat(serviceOrderChecked.getOrderMessage().get(0).getCode()).isEqualTo("502");
- assertThat(serviceOrderChecked.getOrderMessage().get(0).getMessageInformation())
- .isEqualTo("Problem with SO API");
-
- assertThat(executionTaskRepository.count()).isEqualTo(0);
- Context.startWiremock();
-
- }
}
diff --git a/src/test/java/org/onap/nbi/test/KarateApiTest.java b/src/test/java/org/onap/nbi/test/KarateApiTest.java
index e5845f3..ee2a993 100644
--- a/src/test/java/org/onap/nbi/test/KarateApiTest.java
+++ b/src/test/java/org/onap/nbi/test/KarateApiTest.java
@@ -11,6 +11,7 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
+
package org.onap.nbi.test;
import com.intuit.karate.junit4.Karate;
@@ -22,9 +23,9 @@ import org.junit.runner.RunWith;
@CucumberOptions(features = "src/test/resources/karatetest/features")
public class KarateApiTest {
- @AfterClass
- public static void stop() throws Exception {
- Context.stopServers();
- }
+ @AfterClass
+ public static void stop() throws Exception {
+ Context.stopServers();
+ }
}
diff --git a/src/test/java/org/onap/nbi/test/ServiceOrderRepositoryTest.java b/src/test/java/org/onap/nbi/test/ServiceOrderRepositoryTest.java
index fd83ec0..61bf59d 100644
--- a/src/test/java/org/onap/nbi/test/ServiceOrderRepositoryTest.java
+++ b/src/test/java/org/onap/nbi/test/ServiceOrderRepositoryTest.java
@@ -13,8 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.onap.nbi.test;
+package org.onap.nbi.test;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
@@ -37,14 +37,13 @@ import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
-@DirtiesContext(classMode= ClassMode.AFTER_CLASS)
+@DirtiesContext(classMode = ClassMode.AFTER_CLASS)
@ActiveProfiles("test")
public class ServiceOrderRepositoryTest {
@Autowired
ServiceOrderRepository serviceOrderRepository;
-
@Before
public void setUp() {
ServiceOrder serviceOrder = new ServiceOrder();