diff options
author | pramod.jamkhedkar <pramod@research.att.com> | 2019-11-13 13:21:16 -0500 |
---|---|---|
committer | pramod.jamkhedkar <pramod@research.att.com> | 2019-11-13 15:41:00 -0500 |
commit | 6de5a0c9e2acf3a799f53c9fedf8a40861b6ddbe (patch) | |
tree | 8acb76dd6de88cef955ce0914046d072c3a6d1a0 /models-interactions/model-impl | |
parent | c34a4b6b2e111462cde7f5663b8fbbc4ad86fc7e (diff) |
Removing Named Query.
Removing all the related files and necessary modifications for removing named query. The code now only supports Custom Query
Issue-ID: POLICY-2125
Change-Id: Ifa5ccb74142aa424359c0dea85b90bbcf70147cb
Signed-off-by: pramod.jamkhedkar <pramod@research.att.com>
Diffstat (limited to 'models-interactions/model-impl')
58 files changed, 1 insertions, 3893 deletions
diff --git a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiGetResponse.java b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiGetResponse.java deleted file mode 100644 index 61dde9270..000000000 --- a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiGetResponse.java +++ /dev/null @@ -1,34 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.aai; - -import java.io.Serializable; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@NoArgsConstructor -public class AaiGetResponse implements Serializable { - private static final long serialVersionUID = 7311418432051756162L; - - private AaiNqRequestError requestError; -} diff --git a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiGetVnfResponse.java b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiGetVnfResponse.java deleted file mode 100644 index dc587f2c7..000000000 --- a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiGetVnfResponse.java +++ /dev/null @@ -1,69 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file excthe License at - * ept in compliance with the License. - * You may obtain a copy of - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.aai; - -import com.google.gson.annotations.SerializedName; -import java.io.Serializable; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.NoArgsConstructor; - -@Data -@EqualsAndHashCode(callSuper = true) -@NoArgsConstructor -public class AaiGetVnfResponse extends AaiGetResponse implements Serializable { - - private static final long serialVersionUID = -6247505944905898871L; - - @SerializedName("vnf-id") - private String vnfId; - - @SerializedName("vnf-name") - private String vnfName; - - @SerializedName("vnf-type") - private String vnfType; - - @SerializedName("service-id") - private String serviceId; - - @SerializedName("orchestration-status") - private String orchestrationStatus; - - @SerializedName("in-maint") - private boolean inMaint; - - @SerializedName("is-closed-loop-disabled") - private boolean isClosedLoopDisabled; - - @SerializedName("model-invariant-id") - private String modelInvariantId; - - @SerializedName("prov-status") - private String provStatus; - - @SerializedName("resource-version") - private String resourceVersion; - - @SerializedName("relationship-list") - private RelationshipList relationshipList; -} diff --git a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiGetVserverResponse.java b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiGetVserverResponse.java deleted file mode 100644 index c79f72c9f..000000000 --- a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiGetVserverResponse.java +++ /dev/null @@ -1,39 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.aai; - -import java.io.Serializable; -import java.util.LinkedList; -import java.util.List; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.NoArgsConstructor; - -@Data -@EqualsAndHashCode(callSuper = true) -@NoArgsConstructor -public class AaiGetVserverResponse extends AaiGetResponse implements Serializable { - - private static final long serialVersionUID = -6247505944905898871L; - - private List<AaiNqVServer> vserver = new LinkedList<>(); -} diff --git a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiManager.java b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiManager.java index d95068b2b..5b484243a 100644 --- a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiManager.java +++ b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiManager.java @@ -217,142 +217,6 @@ public final class AaiManager { return null; } - /** - * Post a query to A&AI. - * - * @param url the A&AI URL - * @param username the user name for authentication - * @param password the password for authentication - * @param request the request to issue towards A&AI - * @param requestId the UUID of the request - * @return the response from A&AI - */ - public AaiNqResponse postQuery(String url, String username, String password, AaiNqRequest request, UUID requestId) { - - final Map<String, String> headers = createHeaders(requestId); - - url = url + "/aai/search/named-query"; - - logger.debug("RestManager.post before"); - String requestJson = Serialization.gsonPretty.toJson(request); - NetLoggerUtil.log(EventType.OUT, CommInfrastructure.REST, url, requestJson); - Pair<Integer, String> httpDetails = - restManager.post(url, username, password, headers, APPLICATION_JSON, requestJson); - logger.debug("RestManager.post after"); - - if (httpDetails == null) { - logger.info("AAI POST Null Response to {}", url); - return null; - } - - int httpResponseCode = httpDetails.first; - - logger.info(url); - logger.info("{}", httpResponseCode); - logger.info(httpDetails.second); - - if (httpDetails.second != null) { - return composeResponse(httpDetails, url, AaiNqResponse.class); - } - return null; - } - - /** - * Perform a GET request for a particular virtual server towards A&AI. - * - * @param urlGet the A&AI URL - * @param username the user name for authentication - * @param password the password for authentication - * @param requestId the UUID of the request - * @param key the key of the virtual server - * @return the response for the virtual server from A&AI - */ - public AaiGetVserverResponse getQueryByVserverName(String urlGet, String username, String password, UUID requestId, - String key) { - return getQuery(urlGet, username, password, requestId, key, AaiGetVserverResponse.class); - } - - /** - * Perform a GET request for a particular VNF by VNF ID towards A&AI. - * - * @param urlGet the A&AI URL - * @param username the user name for authentication - * @param password the password for authentication - * @param requestId the UUID of the request - * @param key the ID of the VNF - * @return the response for the virtual server from A&AI - */ - public AaiGetVnfResponse getQueryByVnfId(String urlGet, String username, String password, UUID requestId, - String key) { - return getQuery(urlGet, username, password, requestId, key, AaiGetVnfResponse.class); - } - - /** - * Perform a GET request for a particular VNF by VNF name towards A&AI. - * - * @param urlGet the A&AI URL - * @param username the user name for authentication - * @param password the password for authentication - * @param requestId the UUID of the request - * @param key the name of the VNF - * @return the response for the virtual server from A&AI - */ - public AaiGetVnfResponse getQueryByVnfName(String urlGet, String username, String password, UUID requestId, - String key) { - return getQuery(urlGet, username, password, requestId, key, AaiGetVnfResponse.class); - } - - /** - * Perform a GET query for a particular entity towards A&AI. - * - * @param <T> the generic type for the response - * @param url the A&AI URL - * @param username the user name for authentication - * @param password the password for authentication - * @param requestId the UUID of the request - * @param key the name of the VNF - * @param classOfResponse the class of the response to return - * @return the response for the virtual server from A&AI - */ - private <T> T getQuery(final String url, final String username, final String password, final UUID requestId, - final String key, final Class<T> classOfResponse) { - - Map<String, String> headers = createHeaders(requestId); - - String urlGet = url + key; - - int attemptsLeft = 3; - - while (attemptsLeft-- > 0) { - NetLoggerUtil.getNetworkLogger().info("[OUT|{}|{}|]", CommInfrastructure.REST, urlGet); - Pair<Integer, String> httpDetailsGet = restManager.get(urlGet, username, password, headers); - if (httpDetailsGet == null) { - logger.info("AAI GET Null Response to {}", urlGet); - return null; - } - - int httpResponseCode = httpDetailsGet.first; - - logger.info(urlGet); - logger.info("{}", httpResponseCode); - logger.info(httpDetailsGet.second); - - if (httpResponseCode == 200) { - T responseGet = composeResponse(httpDetailsGet, urlGet, classOfResponse); - if (responseGet != null) { - return responseGet; - } - } - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - } - - } - - return null; - } /** * Create the headers for the HTTP request. @@ -371,28 +235,6 @@ public final class AaiManager { } /** - * This method uses Google's GSON to create a response object from a JSON string. - * - * @param <T> the generic type - * @param httpDetails the HTTP response - * @param url the URL from which the response came - * @param classOfResponse The response class - * @return an instance of the response class - * @throws JsonSyntaxException on GSON errors instantiating the response - */ - private <T> T composeResponse(final Pair<Integer, String> httpDetails, final String url, - final Class<T> classOfResponse) { - try { - T response = Serialization.gsonPretty.fromJson(httpDetails.second, classOfResponse); - NetLoggerUtil.log(EventType.IN, CommInfrastructure.REST, url, httpDetails.second); - return response; - } catch (JsonSyntaxException e) { - logger.error("postQuery threw: ", e); - return null; - } - } - - /** * Perform a GET request for a particular PNF by PNF ID towards A&AI. * * @param url the A&AI URL diff --git a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqCloudRegion.java b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqCloudRegion.java deleted file mode 100644 index 851c4f6af..000000000 --- a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqCloudRegion.java +++ /dev/null @@ -1,50 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.aai; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@NoArgsConstructor -public class AaiNqCloudRegion implements Serializable { - - private static final long serialVersionUID = -897231529157222683L; - - @SerializedName("cloud-owner") - private String cloudOwner; - - @SerializedName("cloud-region-id") - private String cloudRegionId; - - @SerializedName("cloud-region-version") - private String cloudRegionVersion; - - @SerializedName("complex-name") - private String complexName; - - @SerializedName("resource-version") - private String resourceVersion; -} diff --git a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqExtraProperties.java b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqExtraProperties.java deleted file mode 100644 index f33d10ca9..000000000 --- a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqExtraProperties.java +++ /dev/null @@ -1,39 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.aai; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; -import java.util.LinkedList; -import java.util.List; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@NoArgsConstructor -public class AaiNqExtraProperties implements Serializable { - private static final long serialVersionUID = 4109625574744702319L; - - @SerializedName("extra-property") - private List<AaiNqExtraProperty> extraProperty = new LinkedList<>(); -} diff --git a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqExtraProperty.java b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqExtraProperty.java deleted file mode 100644 index acab811d0..000000000 --- a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqExtraProperty.java +++ /dev/null @@ -1,43 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.aai; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@AllArgsConstructor -@NoArgsConstructor -public class AaiNqExtraProperty implements Serializable { - - private static final long serialVersionUID = -3861240617222397736L; - - @SerializedName("property-name") - private String propertyName; - - @SerializedName("property-value") - private String propertyValue; -} diff --git a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqGenericVnf.java b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqGenericVnf.java deleted file mode 100644 index 72b27779f..000000000 --- a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqGenericVnf.java +++ /dev/null @@ -1,88 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.aai; - -import com.google.gson.annotations.SerializedName; -import java.io.Serializable; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@NoArgsConstructor -public class AaiNqGenericVnf implements Serializable { - - private static final long serialVersionUID = 834322706248060560L; - - @SerializedName("vnf-id") - private String vnfId; - - @SerializedName("vnf-name") - private String vnfName; - - @SerializedName("vnf-name2") - private String vnfName2; - - @SerializedName("vnf-type") - private String vnfType; - - @SerializedName("service-id") - private String serviceId; - - @SerializedName("prov-status") - private String provStatus; - - @SerializedName("operational-state") - private String operationalState; - - @SerializedName("ipv4-oam-address") - private String ipv4OamAddress; - - @SerializedName("ipv4-loopback0-address") - private String ipv4Loopback0Address; - - @SerializedName("in-maint") - private Boolean inMaint; - - @SerializedName("is-closed-loop-disabled") - private Boolean isClosedLoopDisabled; - - @SerializedName("resource-version") - private String resourceVersion; - - @SerializedName("encrypted-access-flag") - private Boolean encrypedAccessFlag; - - @SerializedName("persona-model-id") - private String personaModelId; - - @SerializedName("persona-model-version") - private String personaModelVersion; - - @SerializedName("model-invariant-id") - private String modelInvariantId; - - @SerializedName("model-version-id") - private String modelVersionId; - - @SerializedName("model-customization-id") - private String modelCustomizationId = null; -} diff --git a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqInstanceFilters.java b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqInstanceFilters.java deleted file mode 100644 index 90e0668b4..000000000 --- a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqInstanceFilters.java +++ /dev/null @@ -1,41 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.aai; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@NoArgsConstructor -public class AaiNqInstanceFilters implements Serializable { - - private static final long serialVersionUID = 8993824591338121185L; - - @SerializedName("instance-filter") - private List<Map<String, Map<String, String>>> instanceFilter = new LinkedList<>(); -} diff --git a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqInventoryResponseItem.java b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqInventoryResponseItem.java deleted file mode 100644 index 50f101e27..000000000 --- a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqInventoryResponseItem.java +++ /dev/null @@ -1,62 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.aai; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@NoArgsConstructor -public class AaiNqInventoryResponseItem implements Serializable { - - private static final long serialVersionUID = 7142072567154675183L; - - @SerializedName("model-name") - private String modelName; - - @SerializedName("vf-module") - private AaiNqVfModule vfModule; - - @SerializedName("service-instance") - private AaiNqServiceInstance serviceInstance; - - @SerializedName("vserver") - private AaiNqVServer vserver; - - @SerializedName("tenant") - private AaiNqTenant tenant; - - @SerializedName("cloud-region") - private AaiNqCloudRegion cloudRegion; - - @SerializedName("generic-vnf") - private AaiNqGenericVnf genericVnf; - - @SerializedName("extra-properties") - private AaiNqExtraProperties extraProperties; - - @SerializedName("inventory-response-items") - private AaiNqInventoryResponseItems items; -} diff --git a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqInventoryResponseItems.java b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqInventoryResponseItems.java deleted file mode 100644 index 51b3e9067..000000000 --- a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqInventoryResponseItems.java +++ /dev/null @@ -1,39 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.aai; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; -import java.util.LinkedList; -import java.util.List; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@NoArgsConstructor -public class AaiNqInventoryResponseItems implements Serializable { - private static final long serialVersionUID = 7602807659381179004L; - - @SerializedName("inventory-response-item") - private List<AaiNqInventoryResponseItem> inventoryResponseItems = new LinkedList<>(); -} diff --git a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqNamedQuery.java b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqNamedQuery.java deleted file mode 100644 index 3847dcf6e..000000000 --- a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqNamedQuery.java +++ /dev/null @@ -1,38 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.aai; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; -import java.util.UUID; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@NoArgsConstructor -public class AaiNqNamedQuery implements Serializable { - private static final long serialVersionUID = -3277980060302645333L; - - @SerializedName("named-query-uuid") - private UUID namedQueryUuid; -} diff --git a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqQueryParameters.java b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqQueryParameters.java deleted file mode 100644 index 873f836eb..000000000 --- a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqQueryParameters.java +++ /dev/null @@ -1,37 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.aai; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@NoArgsConstructor -public class AaiNqQueryParameters implements Serializable { - private static final long serialVersionUID = -4291227193197126982L; - - @SerializedName("named-query") - private AaiNqNamedQuery namedQuery; -} diff --git a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqRequest.java b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqRequest.java deleted file mode 100644 index d99244782..000000000 --- a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqRequest.java +++ /dev/null @@ -1,40 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.aai; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@NoArgsConstructor -public class AaiNqRequest implements Serializable { - private static final long serialVersionUID = -3283942659786236032L; - - @SerializedName("query-parameters") - private AaiNqQueryParameters queryParameters; - - @SerializedName("instance-filters") - private AaiNqInstanceFilters instanceFilters; -} diff --git a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqRequestError.java b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqRequestError.java deleted file mode 100644 index c4222b422..000000000 --- a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqRequestError.java +++ /dev/null @@ -1,37 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.aai; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@NoArgsConstructor -public class AaiNqRequestError implements Serializable { - private static final long serialVersionUID = -7742674155387022932L; - - @SerializedName("serviceException") - private AaiNqServiceExcept serviceExcept; -} diff --git a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqResponse.java b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqResponse.java deleted file mode 100644 index 3c42a0d96..000000000 --- a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqResponse.java +++ /dev/null @@ -1,42 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.aai; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; -import java.util.LinkedList; -import java.util.List; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@NoArgsConstructor -public class AaiNqResponse implements Serializable { - private static final long serialVersionUID = 8411407444051746101L; - - @SerializedName("inventory-response-item") - private List<AaiNqInventoryResponseItem> inventoryResponseItems = new LinkedList<>(); - - @SerializedName("requestError") - private AaiNqRequestError requestError; -} diff --git a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqResponseWrapper.java b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqResponseWrapper.java deleted file mode 100644 index 68d07270a..000000000 --- a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqResponseWrapper.java +++ /dev/null @@ -1,153 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.aai; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.UUID; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class AaiNqResponseWrapper implements Serializable { - private static final long serialVersionUID = 8411407444051746101L; - - private static final Logger logger = LoggerFactory.getLogger(AaiNqResponseWrapper.class); - - private static final Pattern VF_MODULE_NAME_PAT = Pattern.compile("(.*_)(\\d+)"); - - private UUID requestId; - private AaiNqResponse aaiNqResponse; - - public AaiNqResponseWrapper() {} - - public AaiNqResponseWrapper(UUID requestId, AaiNqResponse aaiNqResponse) { - this.requestId = requestId; - this.aaiNqResponse = aaiNqResponse; - } - - public UUID getRequestId() { - return requestId; - } - - public void setRequestId(UUID requestId) { - this.requestId = requestId; - } - - public AaiNqResponse getAaiNqResponse() { - return aaiNqResponse; - } - - public void setAaiNqResponse(AaiNqResponse aaiNqResponse) { - this.aaiNqResponse = aaiNqResponse; - } - - /** - * Counts the number of VF modules, if any, in the response. - * - * @return the number of VF modules, or {@code 0} if there are none - */ - public int countVfModules() { - return getVfModuleItems(false).size(); - } - - /** - * Generates the name for the next VF module. - * - * @return the name of the next VF module, or {@code null} if the name could not be - * generated (i.e., because the response has no matching VF module names on - * which to model it) - */ - public String genVfModuleName() { - /* - * Loop through the VF modules, extracting the name prefix and the largest number - * suffix - */ - String prefix = null; - int maxSuffix = -1; - - for (AaiNqInventoryResponseItem item : getVfModuleItems(false)) { - String name = item.getVfModule().getVfModuleName(); - Matcher matcher = VF_MODULE_NAME_PAT.matcher(name); - if (matcher.matches()) { - int suffix = Integer.parseInt(matcher.group(2)); - if (suffix > maxSuffix) { - maxSuffix = suffix; - prefix = matcher.group(1); - } - } - } - - ++maxSuffix; - - return (prefix == null ? null : prefix + maxSuffix); - } - - /** - * Gets a list of VF modules. If the non-base VF modules are requested, then only - * those whose names match the name pattern, {@link #VF_MODULE_NAME_PAT}, are - * returned. - * - * @param wantBaseModule {@code true} if the the base VF module(s) is desired, - * {@code false} otherwise - * @return the list of VF module items - */ - public List<AaiNqInventoryResponseItem> getVfModuleItems(boolean wantBaseModule) { - // get the list of items - List<AaiNqInventoryResponseItem> itemList; - try { - itemList = aaiNqResponse.getInventoryResponseItems().get(0).getItems().getInventoryResponseItems().get(0) - .getItems().getInventoryResponseItems(); - - } catch (NullPointerException | IndexOutOfBoundsException e) { - logger.debug("no VF modules in AAI response", e); - return Collections.emptyList(); - } - - if (itemList == null) { - return Collections.emptyList(); - } - - /* - * Walk the items looking for VF modules, allocating the list only when an item is - * found. - */ - List<AaiNqInventoryResponseItem> vfModuleItems = new ArrayList<>(itemList.size()); - - for (AaiNqInventoryResponseItem inventoryResponseItem : itemList) { - AaiNqVfModule vfmod = inventoryResponseItem.getVfModule(); - if (vfmod == null) { - continue; - } - - if (vfmod.getIsBaseVfModule() == wantBaseModule - && (wantBaseModule || VF_MODULE_NAME_PAT.matcher(vfmod.getVfModuleName()).matches())) { - vfModuleItems.add(inventoryResponseItem); - } - } - - return vfModuleItems; - } -} diff --git a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqServiceExcept.java b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqServiceExcept.java deleted file mode 100644 index 27751e776..000000000 --- a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqServiceExcept.java +++ /dev/null @@ -1,43 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.aai; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@NoArgsConstructor -public class AaiNqServiceExcept implements Serializable { - private static final long serialVersionUID = 2858343404484338546L; - - @SerializedName("messageId") - private String messageId; - - @SerializedName("text") - private String text; - - @SerializedName("variables") - private String[] variables; -} diff --git a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqServiceInstance.java b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqServiceInstance.java deleted file mode 100644 index 79213c354..000000000 --- a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqServiceInstance.java +++ /dev/null @@ -1,58 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.aai; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@NoArgsConstructor -public class AaiNqServiceInstance implements Serializable { - private static final long serialVersionUID = -8000944396593889586L; - - @SerializedName("service-instance-id") - private String serviceInstanceId; - - @SerializedName("service-instance-name") - private String serviceInstanceName; - - @SerializedName("persona-model-id") - private String personaModelId; - - @SerializedName("persona-model-version") - private String personaModelVersion; - - @SerializedName("service-instance-location-id") - private String serviceInstanceLocationId; - - @SerializedName("resource-version") - private String resourceVersion; - - @SerializedName("model-invariant-id") - private String modelInvariantId; - - @SerializedName("model-version-id") - private String modelVersionId; -} diff --git a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqTenant.java b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqTenant.java deleted file mode 100644 index 5e68f4109..000000000 --- a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqTenant.java +++ /dev/null @@ -1,43 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.aai; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@NoArgsConstructor -public class AaiNqTenant implements Serializable { - private static final long serialVersionUID = 4702784101671984364L; - - @SerializedName("tenant-id") - private String tenantId; - - @SerializedName("tenant-name") - private String tenantName; - - @SerializedName("resource-version") - private String resourceVersion; -} diff --git a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqVServer.java b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqVServer.java deleted file mode 100644 index 68917137c..000000000 --- a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqVServer.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.aai; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@NoArgsConstructor -public class AaiNqVServer implements Serializable { - private static final long serialVersionUID = -6718526692734215643L; - - @SerializedName("vserver-id") - private String vserverId; - - @SerializedName("vserver-name") - private String vserverName; - - @SerializedName("vserver-name2") - private String vserverName2; - - @SerializedName("prov-status") - private String provStatus; - - @SerializedName("vserver-selflink") - private String vserverSelflink; - - @SerializedName("in-maint") - private Boolean inMaint; - - @SerializedName("is-closed-loop-disabled") - private Boolean isClosedLoopDisabled; - - @SerializedName("resource-version") - private String resourceVersion; - - @SerializedName("relationship-list") - private RelationshipList relationshipList; -} diff --git a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqVfModule.java b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqVfModule.java deleted file mode 100644 index ce38a3e3b..000000000 --- a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqVfModule.java +++ /dev/null @@ -1,75 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.aai; - -import com.google.gson.annotations.SerializedName; -import java.io.Serializable; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@NoArgsConstructor -public class AaiNqVfModule implements Serializable { - private static final long serialVersionUID = 8019133081429638232L; - - @SerializedName("vf-module-id") - private String vfModuleId; - - @SerializedName("vf-module-name") - private String vfModuleName; - - @SerializedName("heat-stack-id") - private String heatStackId; - - @SerializedName("orchestration-status") - private String orchestrationStatus; - - @SerializedName("is-base-vf-module") - private Boolean isBaseVfModule; - - @SerializedName("resource-version") - private String resourceVersion; - - @SerializedName("persona-model-id") - private String personaModelId; - - @SerializedName("persona-model-version") - private String personaModelVersion; - - @SerializedName("widget-model-id") - private String widgetModelId; - - @SerializedName("widget-model-version") - private String widgetModelVersion; - - @SerializedName("contrail-service-instance-fqdn") - private String contrailServiceInstanceFqdn; - - @SerializedName("model-invariant-id") - private String modelInvariantId; - - @SerializedName("model-version-id") - private String modelVersionId; - - @SerializedName("model-customization-id") - private String modelCustomizationId = null; -} diff --git a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/Pnf.java b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/Pnf.java deleted file mode 100644 index ae6b97970..000000000 --- a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/Pnf.java +++ /dev/null @@ -1,40 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.aai; - -import java.io.Serializable; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@NoArgsConstructor -public class Pnf implements Serializable { - private static final long serialVersionUID = -3535108358668248501L; - - private String pnfName; - private PnfType pnfType; - - public Pnf(Pnf pnf) { - this.pnfName = pnf.pnfName; - this.pnfType = pnf.pnfType; - } -} diff --git a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/PnfInstance.java b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/PnfInstance.java deleted file mode 100644 index 6a7ad83c5..000000000 --- a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/PnfInstance.java +++ /dev/null @@ -1,53 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.aai; - -import java.io.Serializable; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@NoArgsConstructor -public class PnfInstance implements Serializable { - - private static final long serialVersionUID = -3694152433472165034L; - - private String pnfName; - private String pnfInstanceName; - private PnfType pnfType; - private String pnfSerial; - - /** - * Create an instance from a given instance. - * - * @param instance the instance - */ - public PnfInstance(PnfInstance instance) { - if (instance == null) { - return; - } - this.pnfName = instance.pnfName; - this.pnfInstanceName = instance.pnfInstanceName; - this.pnfType = instance.pnfType; - this.pnfSerial = instance.pnfSerial; - } -} diff --git a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/PnfType.java b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/PnfType.java deleted file mode 100644 index a549d7b9d..000000000 --- a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/PnfType.java +++ /dev/null @@ -1,37 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.aai; - -public enum PnfType { - ENODEB("eNodeB"), PSERVER("pserver"); - - private String type; - - private PnfType(String type) { - this.type = type; - } - - @Override - public String toString() { - return this.type; - } -} diff --git a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/RelatedToProperty.java b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/RelatedToProperty.java deleted file mode 100644 index f65b642ed..000000000 --- a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/RelatedToProperty.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.aai; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@NoArgsConstructor -public class RelatedToProperty implements Serializable { - private static final long serialVersionUID = 5644372985092588638L; - - @SerializedName("property-key") - private String propertyKey; - @SerializedName("property-value") - private String propertyValue; -} diff --git a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/Relationship.java b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/Relationship.java deleted file mode 100644 index 78421b0f2..000000000 --- a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/Relationship.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.aai; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; -import java.util.LinkedList; -import java.util.List; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@NoArgsConstructor -public class Relationship implements Serializable { - private static final long serialVersionUID = -68508443869003055L; - - @SerializedName("related-to") - private String relatedTo; - - @SerializedName("related-link") - private String relatedLink; - - @SerializedName("relationship-data") - private List<RelationshipData> relationshipData = new LinkedList<>(); - - @SerializedName("related-to-property") - private List<RelatedToProperty> relatedToProperty = new LinkedList<>(); -} diff --git a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipData.java b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipData.java deleted file mode 100644 index 9119bf6ac..000000000 --- a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipData.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.aai; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@NoArgsConstructor -public class RelationshipData implements Serializable { - private static final long serialVersionUID = 550450041634939768L; - - @SerializedName("relationship-key") - private String relationshipKey; - @SerializedName("relationship-value") - private String relationshipValue; -} diff --git a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipList.java b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipList.java deleted file mode 100644 index 91bc32844..000000000 --- a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipList.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.aai; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; -import java.util.LinkedList; -import java.util.List; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@NoArgsConstructor -public class RelationshipList implements Serializable { - private static final long serialVersionUID = 6115655704973981990L; - - @SerializedName("relationship") - private List<Relationship> relationships = new LinkedList<>(); -} diff --git a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiGetResponseTest.java b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiGetResponseTest.java deleted file mode 100644 index 8c2cd5fb6..000000000 --- a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiGetResponseTest.java +++ /dev/null @@ -1,62 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= -*/ - -package org.onap.policy.aai; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; - -import java.io.File; -import java.nio.file.Files; -import org.junit.Test; -import org.onap.policy.aai.util.Serialization; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class AaiGetResponseTest { - private static final Logger logger = LoggerFactory.getLogger(AaiGetResponseTest.class); - - @Test - public void test() throws Exception { - // deserialize json and verify fields are populated properly - String json = new String(Files.readAllBytes( - new File("src/test/resources/org/onap/policy/aai/AaiGetResponseError.json").toPath())); - - AaiGetResponse resp = Serialization.gsonPretty.fromJson(json, AaiGetResponse.class); - - // don't need to verify this in depth, as it has its own tests that do that - assertNotNull(resp.getRequestError()); - assertNotNull(resp.getRequestError().getServiceExcept()); - assertEquals("SVC3001", resp.getRequestError().getServiceExcept().getMessageId()); - - logger.info(Serialization.gsonPretty.toJson(resp)); - - // verify that setXxx methods work - resp.setRequestError(null); - assertNull(resp.getRequestError()); - - AaiNqRequestError err = new AaiNqRequestError(); - resp.setRequestError(err); - assertEquals(err, resp.getRequestError()); - } - -} diff --git a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiGetVnfResponseTest.java b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiGetVnfResponseTest.java deleted file mode 100644 index 47ee5ba6f..000000000 --- a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiGetVnfResponseTest.java +++ /dev/null @@ -1,110 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.aai; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -import java.io.File; -import java.nio.file.Files; -import java.util.List; -import org.junit.Test; -import org.onap.policy.aai.util.Serialization; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class AaiGetVnfResponseTest { - private static final Logger logger = LoggerFactory.getLogger(AaiGetVnfResponseTest.class); - - @Test - public void test() throws Exception { - // deserialize json and verify fields are populated properly - String json = new String(Files.readAllBytes( - new File("src/test/resources/org/onap/policy/aai/AaiGetVnfResponse.json").toPath())); - - AaiGetVnfResponse resp = Serialization.gsonPretty.fromJson(json, AaiGetVnfResponse.class); - - assertEquals("807a3f02-f878-436b-870c-f0e91e81570d", resp.getVnfId()); - assertEquals("vLoadBalancerMS-Vnf-0809-2", resp.getVnfName()); - assertEquals("vLoadBalancerMS/vLoadBalancerMS 0", resp.getVnfType()); - assertEquals("1533850960381", resp.getResourceVersion()); - assertFalse(resp.isInMaint()); - assertTrue(resp.isClosedLoopDisabled()); - assertEquals("53638a85-361a-437d-8830-4b0d5329225e", resp.getModelInvariantId()); - assertEquals("PROV", resp.getProvStatus()); - assertEquals("Active", resp.getOrchestrationStatus()); - assertEquals("50e1b0be-e0c9-48e2-9f42-15279a783ee8", resp.getServiceId()); - - // don't need to verify this in depth, as it has its own tests that do that - RelationshipList relationshipList = resp.getRelationshipList(); - assertNotNull(relationshipList); - - List<Relationship> lst = relationshipList.getRelationships(); - assertNotNull(lst); - - assertEquals(5, lst.size()); - assertEquals("service-instance", lst.get(0).getRelatedTo()); - assertEquals("line-of-business", lst.get(1).getRelatedTo()); - - logger.info(Serialization.gsonPretty.toJson(resp)); - - // verify that setXxx methods work - relationshipList = new RelationshipList(); - - resp.setInMaint(true); - resp.setClosedLoopDisabled(false); - resp.setModelInvariantId("modiv"); - resp.setOrchestrationStatus("orch"); - resp.setProvStatus("mystatus"); - resp.setRelationshipList(relationshipList); - resp.setResourceVersion("vers"); - resp.setServiceId("svc"); - resp.setVnfId("vnfid"); - resp.setVnfName("vnfname"); - resp.setVnfType("vnftype"); - - assertEquals("vnfid", resp.getVnfId()); - assertEquals("vnfname", resp.getVnfName()); - assertEquals("vnftype", resp.getVnfType()); - assertEquals("vers", resp.getResourceVersion()); - assertTrue(resp.isInMaint()); - assertFalse(resp.isClosedLoopDisabled()); - assertEquals("modiv", resp.getModelInvariantId()); - assertEquals("mystatus", resp.getProvStatus()); - assertEquals("orch", resp.getOrchestrationStatus()); - assertEquals("svc", resp.getServiceId()); - assertEquals(relationshipList, resp.getRelationshipList()); - - - // test error case - json = new String(Files.readAllBytes( - new File("src/test/resources/org/onap/policy/aai/AaiGetResponseError.json").toPath())); - resp = Serialization.gsonPretty.fromJson(json, AaiGetVnfResponse.class); - - // don't need to verify this in depth, as it has its own tests that do that - assertNotNull(resp.getRequestError()); - assertNotNull(resp.getRequestError().getServiceExcept()); - assertEquals("SVC3001", resp.getRequestError().getServiceExcept().getMessageId()); - } -} diff --git a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiGetVserverResponseTest.java b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiGetVserverResponseTest.java deleted file mode 100644 index 6f063ecf9..000000000 --- a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiGetVserverResponseTest.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.aai; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -import java.io.File; -import java.nio.file.Files; -import java.util.LinkedList; -import java.util.List; -import org.junit.Test; -import org.onap.policy.aai.util.Serialization; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class AaiGetVserverResponseTest { - private static final Logger logger = LoggerFactory.getLogger(AaiGetVserverResponseTest.class); - - @Test - public void test() throws Exception { - // deserialize json and verify fields are populated properly - String json = new String(Files.readAllBytes( - new File("src/test/resources/org/onap/policy/aai/AaiGetVserverResponse.json").toPath())); - - AaiGetVserverResponse resp = Serialization.gsonPretty.fromJson(json, AaiGetVserverResponse.class); - - // don't need to verify this in depth, as it has its own tests that do that - List<AaiNqVServer> lst = resp.getVserver(); - assertEquals(1, lst.size()); - - AaiNqVServer svr = lst.get(0); - assertNotNull(svr); - assertEquals("1c94da3f-16f1-4fc7-9ed1-e018dfa62774", svr.getVserverId()); - - logger.info(Serialization.gsonPretty.toJson(resp)); - - // verify that setXxx methods work - lst = new LinkedList<>(); - lst.add(new AaiNqVServer()); - lst.add(new AaiNqVServer()); - - resp.setVserver(lst); - - assertEquals(lst, resp.getVserver()); - - - // test error case - json = new String(Files.readAllBytes( - new File("src/test/resources/org/onap/policy/aai/AaiGetResponseError.json").toPath())); - resp = Serialization.gsonPretty.fromJson(json, AaiGetVserverResponse.class); - - // don't need to verify this in depth, as it has its own tests that do that - assertNotNull(resp.getRequestError()); - assertNotNull(resp.getRequestError().getServiceExcept()); - assertEquals("SVC3001", resp.getRequestError().getServiceExcept().getMessageId()); - } - -} diff --git a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiManagerTest.java b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiManagerTest.java index ff86577b9..8a007fb4a 100644 --- a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiManagerTest.java +++ b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiManagerTest.java @@ -28,7 +28,6 @@ import static org.mockito.ArgumentMatchers.anyMap; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.ArgumentMatchers.contains; import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.ArgumentMatchers.isNull; import static org.mockito.ArgumentMatchers.startsWith; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -40,26 +39,19 @@ import java.util.Map; import java.util.UUID; import org.junit.Before; import org.junit.Test; -import org.onap.policy.aai.util.Serialization; import org.onap.policy.rest.RestManager; import org.onap.policy.rest.RestManager.Pair; public class AaiManagerTest { - private static final String VSERVER_NAME = "vserverName"; private static final String CQ_QUERY_URL = "http://testing.cq.query"; - private static final String WITCH = "Witch"; private static final String DOROTHY = "Dorothy"; private static final String SOME_URL = "http://somewhere.over.the.rainbow"; - private static final String ANOTHER_URL = "http://somewhere.under.the.rainbow"; private static final String TENANT_RESPONSE_SAMPLE = "src/test/resources/org/onap/policy/aai/AaiTenantResponse.json"; private RestManager restManagerMock; - private UUID aaiNqRequestUuid = UUID.randomUUID(); - private Pair<Integer, String> httpResponseOk; private Pair<Integer, String> httpResponseErr0; private Pair<Integer, String> httpResponseErr1; - private Pair<Integer, String> httpResponseWait; private Pair<Integer, String> httpTenantResponseOk; private Pair<Integer, String> httpCqResponseOk; @@ -76,11 +68,8 @@ public class AaiManagerTest { String tenantResponse = this.getTenantQueryResponse(); httpCqResponseOk = restManagerMock.new Pair<>(200, aaiCqResponse); httpTenantResponseOk = restManagerMock.new Pair<>(200, tenantResponse); - AaiNqResponse aaiNqResponse = new AaiNqResponseTest().getAaiNqResponse(); - httpResponseOk = restManagerMock.new Pair<>(200, Serialization.gsonPretty.toJson(aaiNqResponse)); httpResponseErr0 = restManagerMock.new Pair<>(200, null); httpResponseErr1 = restManagerMock.new Pair<>(200, "{"); - httpResponseWait = restManagerMock.new Pair<>(503, null); } @@ -130,105 +119,6 @@ public class AaiManagerTest { return responseString; } - @Test - public void testAaiManagerAaiNqRequest() { - - AaiManager aaiManager = new AaiManager(restManagerMock); - assertNotNull(aaiManager); - - UUID aaiNqUuid = UUID.randomUUID(); - - AaiNqQueryParameters aaiNqQueryParameters = new AaiNqQueryParameters(); - AaiNqNamedQuery aaiNqNamedQuery = new AaiNqNamedQuery(); - aaiNqNamedQuery.setNamedQueryUuid(aaiNqUuid); - aaiNqQueryParameters.setNamedQuery(aaiNqNamedQuery); - - AaiNqRequest aaiNqRequest = new AaiNqRequest(); - aaiNqRequest.setQueryParameters(aaiNqQueryParameters); - - when(restManagerMock.post(startsWith(SOME_URL), eq(DOROTHY), eq("Gale"), anyMap(), - anyString(), anyString())).thenReturn(httpResponseOk); - - AaiNqResponse aaiNqOkResponse = aaiManager.postQuery(SOME_URL, DOROTHY, "Gale", - aaiNqRequest, aaiNqRequestUuid); - assertNotNull(aaiNqOkResponse); - - when(restManagerMock.post(isNull(), eq(DOROTHY), anyString(), anyMap(), anyString(), anyString())) - .thenReturn(null); - - AaiNqResponse aaiNqNullResponse = aaiManager.postQuery(null, DOROTHY, "Gale", null, aaiNqRequestUuid); - assertNull(aaiNqNullResponse); - - when(restManagerMock.post(startsWith(SOME_URL), eq(WITCH), eq("West"), anyMap(), - anyString(), anyString())).thenReturn(httpResponseErr0); - - AaiNqResponse aaiNqNotOkResponse0 = aaiManager.postQuery(SOME_URL, WITCH, "West", - aaiNqRequest, aaiNqRequestUuid); - assertNull(aaiNqNotOkResponse0); - - when(restManagerMock.post(startsWith(ANOTHER_URL), eq(WITCH), eq("West"), anyMap(), - anyString(), anyString())).thenReturn(httpResponseErr1); - - AaiNqResponse aaiNqNotOkResponse1 = aaiManager.postQuery(ANOTHER_URL, WITCH, "West", - aaiNqRequest, aaiNqRequestUuid); - assertNull(aaiNqNotOkResponse1); - } - - @Test - public void testAaiManagerQueryByVserverName() { - AaiManager aaiManager = new AaiManager(restManagerMock); - assertNotNull(aaiManager); - - UUID vserverNameRequestId = UUID.randomUUID(); - - when(restManagerMock.get(startsWith(SOME_URL), eq(DOROTHY), eq("Gale"), anyMap())) - .thenReturn(httpResponseOk); - - AaiGetVserverResponse vserverResponse = aaiManager.getQueryByVserverName(SOME_URL, - DOROTHY, "Gale", vserverNameRequestId, VSERVER_NAME); - assertNotNull(vserverResponse); - - AaiGetVserverResponse vserverNullResponse = - aaiManager.getQueryByVserverName(null, DOROTHY, "Gale", vserverNameRequestId, VSERVER_NAME); - assertNull(vserverNullResponse); - - when(restManagerMock.get(startsWith(ANOTHER_URL), eq(WITCH), eq("West"), anyMap())) - .thenReturn(httpResponseErr0); - - AaiGetVserverResponse vserverNotOkResponse0 = aaiManager.getQueryByVserverName( - ANOTHER_URL, WITCH, "West", vserverNameRequestId, VSERVER_NAME); - assertNull(vserverNotOkResponse0); - } - - @Test - public void testAaiManagerQueryByVnfId() { - AaiManager aaiManager = new AaiManager(restManagerMock); - assertNotNull(aaiManager); - - UUID vserverNameRequestId = UUID.randomUUID(); - - when(restManagerMock.get(startsWith(SOME_URL), eq(DOROTHY), eq("Gale"), anyMap())) - .thenReturn(httpResponseOk); - - AaiGetVnfResponse vnfResponse = aaiManager.getQueryByVnfId(SOME_URL, DOROTHY, - "Gale", vserverNameRequestId, "vnfID"); - assertNotNull(vnfResponse); - } - - @Test - public void testAaiManagerQueryByVnfName() { - AaiManager aaiManager = new AaiManager(restManagerMock); - assertNotNull(aaiManager); - - UUID vserverNameRequestId = UUID.randomUUID(); - - when(restManagerMock.get(startsWith(SOME_URL), eq(DOROTHY), eq("Gale"), anyMap())) - .thenReturn(httpResponseOk); - - AaiGetVnfResponse vnfResponse = aaiManager.getQueryByVnfId(SOME_URL, DOROTHY, - "Gale", vserverNameRequestId, "vnfName"); - assertNotNull(vnfResponse); - } @Test public void testAaiManagerGetPnf() { diff --git a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqCloudRegionTest.java b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqCloudRegionTest.java deleted file mode 100644 index 9bdc758ed..000000000 --- a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqCloudRegionTest.java +++ /dev/null @@ -1,46 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.aai; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -import org.junit.Test; - -public class AaiNqCloudRegionTest { - - @Test - public void test() { - AaiNqCloudRegion aaiNqCloudRegion = new AaiNqCloudRegion(); - aaiNqCloudRegion.setCloudOwner("Rackspace"); - aaiNqCloudRegion.setCloudRegionId("DFW"); - aaiNqCloudRegion.setCloudRegionVersion("v1"); - aaiNqCloudRegion.setComplexName("SharedNode"); - aaiNqCloudRegion.setResourceVersion("1504789196021"); - assertNotNull(aaiNqCloudRegion); - assertEquals("Rackspace", aaiNqCloudRegion.getCloudOwner()); - assertEquals("DFW", aaiNqCloudRegion.getCloudRegionId()); - assertEquals("v1", aaiNqCloudRegion.getCloudRegionVersion()); - assertEquals("SharedNode", aaiNqCloudRegion.getComplexName()); - assertEquals("1504789196021", aaiNqCloudRegion.getResourceVersion()); - } -} diff --git a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqExtraPropertiesTest.java b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqExtraPropertiesTest.java deleted file mode 100644 index ed76f8a12..000000000 --- a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqExtraPropertiesTest.java +++ /dev/null @@ -1,43 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.aai; - -import static org.junit.Assert.assertNotNull; - -import org.junit.Test; - -public class AaiNqExtraPropertiesTest { - - @Test - public void test() { - AaiNqExtraProperties aaiNqExtraProperties = new AaiNqExtraProperties(); - aaiNqExtraProperties.getExtraProperty().add(new AaiNqExtraProperty("model.model-name", "service-instance")); - aaiNqExtraProperties.getExtraProperty().add(new AaiNqExtraProperty("model.model-type", "widget")); - aaiNqExtraProperties.getExtraProperty().add(new AaiNqExtraProperty("model.model-version", "1.0")); - aaiNqExtraProperties.getExtraProperty() - .add(new AaiNqExtraProperty("model.model-id", "82194af1-3c2c-485a-8f44-420e22a9eaa4")); - aaiNqExtraProperties.getExtraProperty() - .add(new AaiNqExtraProperty("model.model-name", "46b92144-923a-4d20-b85a-3cbd847668a9")); - assertNotNull(aaiNqExtraProperties); - } - -} diff --git a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqExtraPropertyTest.java b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqExtraPropertyTest.java deleted file mode 100644 index 483753679..000000000 --- a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqExtraPropertyTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.aai; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -import org.junit.Test; - -public class AaiNqExtraPropertyTest { - - @Test - public void test() { - AaiNqExtraProperty aaiNqExtraProperty = new AaiNqExtraProperty(); - aaiNqExtraProperty.setPropertyName("model.model-name"); - aaiNqExtraProperty.setPropertyValue("service-instance"); - assertNotNull(aaiNqExtraProperty); - - assertEquals("model.model-name", aaiNqExtraProperty.getPropertyName()); - assertEquals("service-instance", aaiNqExtraProperty.getPropertyValue()); - } -} diff --git a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqGenericVnfTest.java b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqGenericVnfTest.java deleted file mode 100644 index 93119c73e..000000000 --- a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqGenericVnfTest.java +++ /dev/null @@ -1,77 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.aai; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -import org.junit.Test; - -public class AaiNqGenericVnfTest { - - private static final String VERSION_ID = "98f410f6-4c63-447b-97d2-42508437cec0"; - private static final String INVARIANT_ID = "653d2caa-7e47-4614-95b3-26c8d82755b8"; - - @Test - public void test() { - AaiNqGenericVnf aaiNqGenericVnf = new AaiNqGenericVnf(); - aaiNqGenericVnf.setEncrypedAccessFlag(true); - aaiNqGenericVnf.setInMaint(false); - aaiNqGenericVnf.setIpv4Loopback0Address("aa"); - aaiNqGenericVnf.setIpv4OamAddress("oamAddress"); - aaiNqGenericVnf.setIsClosedLoopDisabled(false); - aaiNqGenericVnf.setModelInvariantId(INVARIANT_ID); - aaiNqGenericVnf.setModelVersionId(VERSION_ID); - aaiNqGenericVnf.setModelCustomizationId("SomeCustomizationId"); - aaiNqGenericVnf.setOperationalState("active"); - aaiNqGenericVnf.setPersonaModelId(INVARIANT_ID); - aaiNqGenericVnf.setPersonaModelVersion(VERSION_ID); - aaiNqGenericVnf.setProvStatus("complete"); - aaiNqGenericVnf.setResourceVersion("1505056714553"); - aaiNqGenericVnf.setServiceId("e8cb8968-5411-478b-906a-f28747de72cd"); - aaiNqGenericVnf.setVnfId("ed8b2bce-6b27-4089-992c-4a2c66024bcd"); - aaiNqGenericVnf.setVnfName("vCPEInfraVNF14a"); - aaiNqGenericVnf.setVnfName2("malumabb12"); - aaiNqGenericVnf.setVnfType("vCPEInfraService10/vCPEInfraService10 0"); - assertNotNull(aaiNqGenericVnf); - - assertEquals(true, aaiNqGenericVnf.getEncrypedAccessFlag()); - assertEquals(false, aaiNqGenericVnf.getInMaint()); - assertEquals("aa", aaiNqGenericVnf.getIpv4Loopback0Address()); - assertEquals("oamAddress", aaiNqGenericVnf.getIpv4OamAddress()); - assertEquals(false, aaiNqGenericVnf.getIsClosedLoopDisabled()); - assertEquals(INVARIANT_ID, aaiNqGenericVnf.getModelInvariantId()); - assertEquals(VERSION_ID, aaiNqGenericVnf.getModelVersionId()); - assertEquals("SomeCustomizationId", aaiNqGenericVnf.getModelCustomizationId()); - assertEquals("active", aaiNqGenericVnf.getOperationalState()); - assertEquals(INVARIANT_ID, aaiNqGenericVnf.getPersonaModelId()); - assertEquals(VERSION_ID, aaiNqGenericVnf.getPersonaModelVersion()); - assertEquals("complete", aaiNqGenericVnf.getProvStatus()); - assertEquals("1505056714553", aaiNqGenericVnf.getResourceVersion()); - assertEquals("e8cb8968-5411-478b-906a-f28747de72cd", aaiNqGenericVnf.getServiceId()); - assertEquals("ed8b2bce-6b27-4089-992c-4a2c66024bcd", aaiNqGenericVnf.getVnfId()); - assertEquals("vCPEInfraVNF14a", aaiNqGenericVnf.getVnfName()); - assertEquals("malumabb12", aaiNqGenericVnf.getVnfName2()); - assertEquals("vCPEInfraService10/vCPEInfraService10 0", aaiNqGenericVnf.getVnfType()); - } - -} diff --git a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqInstanceFiltersTest.java b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqInstanceFiltersTest.java deleted file mode 100644 index 4b4cc6a6a..000000000 --- a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqInstanceFiltersTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.aai; - -import static org.junit.Assert.assertNotNull; - -import org.junit.Test; - -public class AaiNqInstanceFiltersTest { - - @Test - public void test() { - AaiNqInstanceFilters aaiNqInstanceFilters = new AaiNqInstanceFilters(); - assertNotNull(aaiNqInstanceFilters); - - aaiNqInstanceFilters.setInstanceFilter(aaiNqInstanceFilters.getInstanceFilter());; - assertNotNull(aaiNqInstanceFilters); - assertNotNull(aaiNqInstanceFilters.getInstanceFilter()); - } - -} diff --git a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqInventoryResponseItemTest.java b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqInventoryResponseItemTest.java deleted file mode 100644 index 79f23b629..000000000 --- a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqInventoryResponseItemTest.java +++ /dev/null @@ -1,171 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.aai; - -import static org.junit.Assert.assertNotNull; - -import java.util.LinkedList; -import org.junit.Test; -import org.onap.policy.aai.util.Serialization; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class AaiNqInventoryResponseItemTest { - private static final String WIDGET = "widget"; - private static final String SERVICE_INSTANCE = "service-instance"; - private static final String MODEL_VERSION_KEY = "model.model-version"; - private static final String MODEL_TYPE_KEY = "model.model-type"; - private static final String MODEL_NAME_KEY = "model.model-name"; - private static final String MODEL_ID_KEY = "model.model-id"; - private static final String PERSONA_MODEL_ID2 = "ef86f9c5-2165-44f3-8fc3-96018b609ea5"; - private static final String PERSONA_MODEL_ID = "82194af1-3c2c-485a-8f44-420e22a9eaa4"; - private static final String RESOURCE_VERSION = "1485366450"; - private static final Logger logger = LoggerFactory.getLogger(AaiNqInventoryResponseItemTest.class); - - @Test - public void test() { - AaiNqInventoryResponseItem aaiNqInventoryResponseItem = new AaiNqInventoryResponseItem(); - aaiNqInventoryResponseItem.setModelName(SERVICE_INSTANCE); - AaiNqCloudRegion aaiNqCloudRegion = new AaiNqCloudRegion(); - aaiNqCloudRegion.setCloudOwner("OWNER"); - aaiNqCloudRegion.setCloudRegionId("REGIONID"); - aaiNqCloudRegion.setCloudRegionVersion("2.5"); - aaiNqCloudRegion.setComplexName("COMPLEXNAME"); - aaiNqCloudRegion.setResourceVersion("1485365988"); - aaiNqInventoryResponseItem.setCloudRegion(aaiNqCloudRegion); - AaiNqExtraProperties aaiNqExtraProperties = new AaiNqExtraProperties(); - aaiNqExtraProperties.setExtraProperty(new LinkedList<>()); - aaiNqExtraProperties.getExtraProperty().add(new AaiNqExtraProperty(MODEL_NAME_KEY, "generic-vnf")); - aaiNqExtraProperties.getExtraProperty().add(new AaiNqExtraProperty(MODEL_TYPE_KEY, WIDGET)); - aaiNqExtraProperties.getExtraProperty().add(new AaiNqExtraProperty(MODEL_VERSION_KEY, "1.0")); - aaiNqExtraProperties.getExtraProperty() - .add(new AaiNqExtraProperty(MODEL_ID_KEY, "acc6edd8-a8d4-4b93-afaa-0994068be14c")); - aaiNqExtraProperties.getExtraProperty() - .add(new AaiNqExtraProperty("model.model-name-version-id", "93a6166f-b3d5-4f06-b4ba-aed48d009ad9")); - aaiNqInventoryResponseItem.setExtraProperties(aaiNqExtraProperties); - AaiNqGenericVnf aaiNqGenericVnf = new AaiNqGenericVnf(); - aaiNqGenericVnf.setVnfId("dhv-test-gvnf"); - aaiNqGenericVnf.setVnfName("dhv-test-gvnf-name"); - aaiNqGenericVnf.setVnfName2("dhv-test-gvnf-name2"); - aaiNqGenericVnf.setVnfType("SW"); - aaiNqGenericVnf.setServiceId("d7bb0a21-66f2-4e6d-87d9-9ef3ced63ae4"); - aaiNqGenericVnf.setProvStatus("PREPROV"); - aaiNqGenericVnf.setOperationalState("dhv-test-operational-state"); - aaiNqGenericVnf.setIpv4OamAddress("dhv-test-gvnf-ipv4-oam-address"); - aaiNqGenericVnf.setIpv4Loopback0Address("dhv-test-gvnfipv4-loopback0-address"); - aaiNqGenericVnf.setInMaint(false); - aaiNqGenericVnf.setIsClosedLoopDisabled(false); - aaiNqGenericVnf.setResourceVersion(RESOURCE_VERSION); - aaiNqGenericVnf.setEncrypedAccessFlag(true); - aaiNqGenericVnf.setPersonaModelId("acc6edd8-a8d4-4b93-afaa-0994068be14c"); - aaiNqGenericVnf.setPersonaModelVersion("1.0"); - aaiNqInventoryResponseItem.setGenericVnf(aaiNqGenericVnf); - AaiNqInventoryResponseItem serviceItem = new AaiNqInventoryResponseItem(); - serviceItem.setModelName(SERVICE_INSTANCE); - serviceItem.setServiceInstance(new AaiNqServiceInstance()); - serviceItem.getServiceInstance().setServiceInstanceId("dhv-test-vhnfportal-service-instance-id"); - serviceItem.getServiceInstance().setServiceInstanceName("dhv-test-service-instance-name1"); - serviceItem.getServiceInstance().setPersonaModelId(PERSONA_MODEL_ID); - serviceItem.getServiceInstance().setPersonaModelVersion("1.0"); - serviceItem.getServiceInstance().setServiceInstanceLocationId("dhv-test-service-instance-location-id1"); - serviceItem.getServiceInstance().setResourceVersion("1485366092"); - serviceItem.setExtraProperties(new AaiNqExtraProperties()); - serviceItem.getExtraProperties().getExtraProperty() - .add(new AaiNqExtraProperty(MODEL_NAME_KEY, SERVICE_INSTANCE)); - serviceItem.getExtraProperties().getExtraProperty().add(new AaiNqExtraProperty(MODEL_TYPE_KEY, WIDGET)); - serviceItem.getExtraProperties().getExtraProperty().add(new AaiNqExtraProperty(MODEL_VERSION_KEY, "1.0")); - serviceItem.getExtraProperties().getExtraProperty() - .add(new AaiNqExtraProperty(MODEL_ID_KEY, PERSONA_MODEL_ID)); - serviceItem.getExtraProperties().getExtraProperty() - .add(new AaiNqExtraProperty(MODEL_NAME_KEY, "46b92144-923a-4d20-b85a-3cbd847668a9")); - - AaiNqInventoryResponseItem vfModuleItem = new AaiNqInventoryResponseItem(); - vfModuleItem.setModelName("vf-module"); - vfModuleItem.setVfModule(new AaiNqVfModule()); - vfModuleItem.getVfModule().setVfModuleId("example-vf-module-id-val-49261"); - vfModuleItem.getVfModule().setVfModuleName("example-vf-module-name-val-73074"); - vfModuleItem.getVfModule().setHeatStackId("example-heat-stack-id-val-86300"); - vfModuleItem.getVfModule().setOrchestrationStatus("example-orchestration-status-val-56523"); - vfModuleItem.getVfModule().setIsBaseVfModule(true); - vfModuleItem.getVfModule().setResourceVersion(RESOURCE_VERSION); - vfModuleItem.getVfModule().setPersonaModelId(PERSONA_MODEL_ID2); - vfModuleItem.getVfModule().setPersonaModelVersion("1.0"); - vfModuleItem.getVfModule().setWidgetModelId("example-widget-model-id-val-92571"); - vfModuleItem.getVfModule().setWidgetModelVersion("example-widget-model-version-val-83317"); - vfModuleItem.getVfModule().setContrailServiceInstanceFqdn("example-contrail-service-instance-fqdn-val-86796"); - vfModuleItem.setExtraProperties(new AaiNqExtraProperties()); - vfModuleItem.getExtraProperties().getExtraProperty() - .add(new AaiNqExtraProperty(MODEL_NAME_KEY, "vf-module")); - vfModuleItem.getExtraProperties().getExtraProperty().add(new AaiNqExtraProperty(MODEL_TYPE_KEY, WIDGET)); - vfModuleItem.getExtraProperties().getExtraProperty().add(new AaiNqExtraProperty(MODEL_VERSION_KEY, "1.0")); - vfModuleItem.getExtraProperties().getExtraProperty() - .add(new AaiNqExtraProperty(MODEL_ID_KEY, PERSONA_MODEL_ID2)); - vfModuleItem.getExtraProperties().getExtraProperty() - .add(new AaiNqExtraProperty(MODEL_NAME_KEY, "c00563ae-812b-4e62-8330-7c4d0f47088a")); - - AaiNqInventoryResponseItems aaiNqInventoryResponseItems = new AaiNqInventoryResponseItems(); - aaiNqInventoryResponseItems.getInventoryResponseItems().add(serviceItem); - aaiNqInventoryResponseItems.getInventoryResponseItems().add(vfModuleItem); - aaiNqInventoryResponseItem.setItems(aaiNqInventoryResponseItems); - aaiNqInventoryResponseItem.setModelName("model-name"); - AaiNqServiceInstance serviceInstance = new AaiNqServiceInstance(); - serviceInstance.setServiceInstanceId("dhv-test-vhnfportal-service-instance-id"); - serviceInstance.setServiceInstanceName("dhv-test-service-instance-name1"); - serviceInstance.setPersonaModelId(PERSONA_MODEL_ID); - serviceInstance.setPersonaModelVersion("1.0"); - serviceInstance.setServiceInstanceLocationId("dhv-test-service-instance-location-id1"); - serviceInstance.setResourceVersion("1485366092"); - aaiNqInventoryResponseItem.setServiceInstance(serviceInstance); - AaiNqTenant aaiNqTenant = new AaiNqTenant(); - aaiNqTenant.setTenantId("dhv-test-tenant"); - aaiNqTenant.setTenantName("dhv-test-tenant-name"); - aaiNqTenant.setResourceVersion("1485366334"); - aaiNqInventoryResponseItem.setTenant(aaiNqTenant); - AaiNqVfModule aaiNqVfModule = new AaiNqVfModule(); - aaiNqVfModule.setVfModuleId("example-vf-module-id-val-49261"); - aaiNqVfModule.setVfModuleName("example-vf-module-name-val-73074"); - aaiNqVfModule.setHeatStackId("example-heat-stack-id-val-86300"); - aaiNqVfModule.setOrchestrationStatus("example-orchestration-status-val-56523"); - aaiNqVfModule.setIsBaseVfModule(true); - aaiNqVfModule.setResourceVersion(RESOURCE_VERSION); - aaiNqVfModule.setPersonaModelId(PERSONA_MODEL_ID2); - aaiNqVfModule.setPersonaModelVersion("1.0"); - aaiNqVfModule.setWidgetModelId("example-widget-model-id-val-92571"); - aaiNqVfModule.setWidgetModelVersion("example-widget-model-version-val-83317"); - aaiNqVfModule.setContrailServiceInstanceFqdn("example-contrail-service-instance-fqdn-val-86796"); - aaiNqInventoryResponseItem.setVfModule(aaiNqVfModule); - AaiNqVServer aaiNqVServer = new AaiNqVServer(); - aaiNqVServer.setVserverId("dhv-test-vserver"); - aaiNqVServer.setVserverName("dhv-test-vserver-name"); - aaiNqVServer.setVserverName2("dhv-test-vserver-name2"); - aaiNqVServer.setProvStatus("PREPROV"); - aaiNqVServer.setVserverSelflink("dhv-test-vserver-selflink"); - aaiNqVServer.setInMaint(false); - aaiNqVServer.setIsClosedLoopDisabled(false); - aaiNqVServer.setResourceVersion("1485366417"); - aaiNqInventoryResponseItem.setVserver(aaiNqVServer); - assertNotNull(aaiNqInventoryResponseItem); - - logger.info(Serialization.gsonPretty.toJson(aaiNqInventoryResponseItem)); - } - -} diff --git a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqInventoryResponseItemsTest.java b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqInventoryResponseItemsTest.java deleted file mode 100644 index ef1dd4e09..000000000 --- a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqInventoryResponseItemsTest.java +++ /dev/null @@ -1,161 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.aai; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -import java.util.LinkedList; -import org.junit.Test; -import org.onap.policy.aai.util.Serialization; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class AaiNqInventoryResponseItemsTest { - private static final String WIDGET = "widget"; - private static final String SERVICE_INSTANCE = "service-instance"; - private static final String MODEL_VERSION_KEY = "model.model-version"; - private static final String MODEL_TYPE_KEY = "model.model-type"; - private static final String MODEL_NAME_KEY = "model.model-name"; - private static final String MODEL_ID_KEY = "model.model-id"; - private static final Logger logger = LoggerFactory.getLogger(AaiNqInventoryResponseItemsTest.class); - - @Test - public void test() { - AaiNqInventoryResponseItem serviceItem = new AaiNqInventoryResponseItem(); - serviceItem.setModelName(SERVICE_INSTANCE); - assertEquals(SERVICE_INSTANCE, serviceItem.getModelName()); - - serviceItem.setServiceInstance(new AaiNqServiceInstance()); - serviceItem.getServiceInstance().setServiceInstanceId("dhv-test-vhnfportal-service-instance-id"); - serviceItem.getServiceInstance().setServiceInstanceName("dhv-test-service-instance-name1"); - serviceItem.getServiceInstance().setPersonaModelId("82194af1-3c2c-485a-8f44-420e22a9eaa4"); - serviceItem.getServiceInstance().setPersonaModelVersion("1.0"); - serviceItem.getServiceInstance().setServiceInstanceLocationId("dhv-test-service-instance-location-id1"); - serviceItem.getServiceInstance().setResourceVersion("1485366092"); - serviceItem.setExtraProperties(new AaiNqExtraProperties()); - serviceItem.getExtraProperties().getExtraProperty() - .add(new AaiNqExtraProperty(MODEL_NAME_KEY, SERVICE_INSTANCE)); - serviceItem.getExtraProperties().getExtraProperty().add(new AaiNqExtraProperty(MODEL_TYPE_KEY, WIDGET)); - serviceItem.getExtraProperties().getExtraProperty().add(new AaiNqExtraProperty(MODEL_VERSION_KEY, "1.0")); - serviceItem.getExtraProperties().getExtraProperty() - .add(new AaiNqExtraProperty(MODEL_ID_KEY, "82194af1-3c2c-485a-8f44-420e22a9eaa4")); - serviceItem.getExtraProperties().getExtraProperty() - .add(new AaiNqExtraProperty(MODEL_NAME_KEY, "46b92144-923a-4d20-b85a-3cbd847668a9")); - - AaiNqInventoryResponseItem vfModuleItem = new AaiNqInventoryResponseItem(); - vfModuleItem.setModelName("vf-module"); - vfModuleItem.setVfModule(new AaiNqVfModule()); - vfModuleItem.getVfModule().setVfModuleId("example-vf-module-id-val-49261"); - vfModuleItem.getVfModule().setVfModuleName("example-vf-module-name-val-73074"); - vfModuleItem.getVfModule().setHeatStackId("example-heat-stack-id-val-86300"); - vfModuleItem.getVfModule().setOrchestrationStatus("example-orchestration-status-val-56523"); - vfModuleItem.getVfModule().setIsBaseVfModule(true); - vfModuleItem.getVfModule().setResourceVersion("1485366450"); - vfModuleItem.getVfModule().setPersonaModelId("ef86f9c5-2165-44f3-8fc3-96018b609ea5"); - vfModuleItem.getVfModule().setPersonaModelVersion("1.0"); - vfModuleItem.getVfModule().setWidgetModelId("example-widget-model-id-val-92571"); - vfModuleItem.getVfModule().setWidgetModelVersion("example-widget-model-version-val-83317"); - vfModuleItem.getVfModule().setContrailServiceInstanceFqdn("example-contrail-service-instance-fqdn-val-86796"); - vfModuleItem.setExtraProperties(new AaiNqExtraProperties()); - vfModuleItem.getExtraProperties().getExtraProperty() - .add(new AaiNqExtraProperty(MODEL_NAME_KEY, "vf-module")); - vfModuleItem.getExtraProperties().getExtraProperty().add(new AaiNqExtraProperty(MODEL_TYPE_KEY, WIDGET)); - vfModuleItem.getExtraProperties().getExtraProperty().add(new AaiNqExtraProperty(MODEL_VERSION_KEY, "1.0")); - vfModuleItem.getExtraProperties().getExtraProperty() - .add(new AaiNqExtraProperty(MODEL_ID_KEY, "ef86f9c5-2165-44f3-8fc3-96018b609ea5")); - vfModuleItem.getExtraProperties().getExtraProperty() - .add(new AaiNqExtraProperty(MODEL_NAME_KEY, "c00563ae-812b-4e62-8330-7c4d0f47088a")); - - AaiNqInventoryResponseItem genericVnfItem = new AaiNqInventoryResponseItem(); - genericVnfItem.setModelName("generic-vnf"); - genericVnfItem.setGenericVnf(new AaiNqGenericVnf()); - genericVnfItem.getGenericVnf().setVnfId("dhv-test-gvnf"); - genericVnfItem.getGenericVnf().setVnfName("dhv-test-gvnf-name"); - genericVnfItem.getGenericVnf().setVnfName2("dhv-test-gvnf-name2"); - genericVnfItem.getGenericVnf().setVnfType("SW"); - genericVnfItem.getGenericVnf().setServiceId("d7bb0a21-66f2-4e6d-87d9-9ef3ced63ae4"); - genericVnfItem.getGenericVnf().setProvStatus("PREPROV"); - genericVnfItem.getGenericVnf().setOperationalState("dhv-test-operational-state"); - genericVnfItem.getGenericVnf().setIpv4OamAddress("dhv-test-gvnf-ipv4-oam-address"); - genericVnfItem.getGenericVnf().setIpv4Loopback0Address("dhv-test-gvnfipv4-loopback0-address"); - genericVnfItem.getGenericVnf().setInMaint(false); - genericVnfItem.getGenericVnf().setIsClosedLoopDisabled(false); - genericVnfItem.getGenericVnf().setResourceVersion("1485366450"); - genericVnfItem.getGenericVnf().setEncrypedAccessFlag(true); - genericVnfItem.getGenericVnf().setPersonaModelId("acc6edd8-a8d4-4b93-afaa-0994068be14c"); - genericVnfItem.getGenericVnf().setPersonaModelVersion("1.0"); - genericVnfItem.setExtraProperties(new AaiNqExtraProperties()); - genericVnfItem.getExtraProperties().setExtraProperty(new LinkedList<>()); - genericVnfItem.getExtraProperties().getExtraProperty() - .add(new AaiNqExtraProperty(MODEL_NAME_KEY, "generic-vnf")); - genericVnfItem.getExtraProperties().getExtraProperty() - .add(new AaiNqExtraProperty(MODEL_TYPE_KEY, WIDGET)); - genericVnfItem.getExtraProperties().getExtraProperty() - .add(new AaiNqExtraProperty(MODEL_VERSION_KEY, "1.0")); - genericVnfItem.getExtraProperties().getExtraProperty() - .add(new AaiNqExtraProperty(MODEL_ID_KEY, "acc6edd8-a8d4-4b93-afaa-0994068be14c")); - genericVnfItem.getExtraProperties().getExtraProperty() - .add(new AaiNqExtraProperty("model.model-name-version-id", "93a6166f-b3d5-4f06-b4ba-aed48d009ad9")); - genericVnfItem.setItems(new AaiNqInventoryResponseItems()); - genericVnfItem.getItems().setInventoryResponseItems(new LinkedList<>()); - genericVnfItem.getItems().getInventoryResponseItems().add(serviceItem); - genericVnfItem.getItems().getInventoryResponseItems().add(vfModuleItem); - - AaiNqInventoryResponseItem cloudItem = new AaiNqInventoryResponseItem(); - cloudItem.setCloudRegion(new AaiNqCloudRegion()); - cloudItem.getCloudRegion().setCloudOwner("OWNER"); - cloudItem.getCloudRegion().setCloudRegionId("REGIONID"); - cloudItem.getCloudRegion().setCloudRegionVersion("2.5"); - cloudItem.getCloudRegion().setComplexName("COMPLEXNAME"); - cloudItem.getCloudRegion().setResourceVersion("1485365988"); - - AaiNqInventoryResponseItem tenantItem = new AaiNqInventoryResponseItem(); - tenantItem.setTenant(new AaiNqTenant()); - tenantItem.getTenant().setTenantId("dhv-test-tenant"); - tenantItem.getTenant().setTenantName("dhv-test-tenant-name"); - tenantItem.getTenant().setResourceVersion("1485366334"); - tenantItem.setItems(new AaiNqInventoryResponseItems()); - tenantItem.getItems().setInventoryResponseItems(new LinkedList<>()); - tenantItem.getItems().getInventoryResponseItems().add(cloudItem); - AaiNqInventoryResponseItem vserverItem = new AaiNqInventoryResponseItem(); - vserverItem.setVserver(new AaiNqVServer()); - vserverItem.getVserver().setVserverId("dhv-test-vserver"); - vserverItem.getVserver().setVserverName("dhv-test-vserver-name"); - vserverItem.getVserver().setVserverName2("dhv-test-vserver-name2"); - vserverItem.getVserver().setProvStatus("PREPROV"); - vserverItem.getVserver().setVserverSelflink("dhv-test-vserver-selflink"); - vserverItem.getVserver().setInMaint(false); - vserverItem.getVserver().setIsClosedLoopDisabled(false); - vserverItem.getVserver().setResourceVersion("1485366417"); - vserverItem.setItems(new AaiNqInventoryResponseItems()); - vserverItem.getItems().setInventoryResponseItems(new LinkedList<>()); - vserverItem.getItems().getInventoryResponseItems().add(genericVnfItem); - vserverItem.getItems().getInventoryResponseItems().add(tenantItem); - - AaiNqInventoryResponseItems aaiNqInventoryResponseItems = new AaiNqInventoryResponseItems(); - aaiNqInventoryResponseItems.getInventoryResponseItems().add(vserverItem); - assertNotNull(aaiNqInventoryResponseItems); - logger.info(Serialization.gsonPretty.toJson(aaiNqInventoryResponseItems)); - } - -} diff --git a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqNamedQueryTest.java b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqNamedQueryTest.java deleted file mode 100644 index a4344d8e6..000000000 --- a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqNamedQueryTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= -*/ - -package org.onap.policy.aai; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -import java.util.UUID; -import org.junit.Test; - -public class AaiNqNamedQueryTest { - - @Test - public void test() { - AaiNqNamedQuery aaiNqNamedQuery = new AaiNqNamedQuery(); - UUID uuid = UUID.randomUUID(); - aaiNqNamedQuery.setNamedQueryUuid(uuid); - assertNotNull(aaiNqNamedQuery); - assertEquals(aaiNqNamedQuery.getNamedQueryUuid(), uuid); - } -} diff --git a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqQueryParametersTest.java b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqQueryParametersTest.java deleted file mode 100644 index f304713f9..000000000 --- a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqQueryParametersTest.java +++ /dev/null @@ -1,42 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= -*/ - -package org.onap.policy.aai; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -import java.util.UUID; -import org.junit.Test; - -public class AaiNqQueryParametersTest { - - @Test - public void test() { - AaiNqQueryParameters aaiNqQueryParameters = new AaiNqQueryParameters(); - AaiNqNamedQuery aaiNqNamedQuery = new AaiNqNamedQuery(); - aaiNqNamedQuery.setNamedQueryUuid(UUID.randomUUID()); - aaiNqQueryParameters.setNamedQuery(aaiNqNamedQuery); - assertNotNull(aaiNqNamedQuery); - assertEquals(aaiNqQueryParameters.getNamedQuery(), aaiNqNamedQuery); - } - -} diff --git a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqRequestErrorTest.java b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqRequestErrorTest.java deleted file mode 100644 index 029cc59f3..000000000 --- a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqRequestErrorTest.java +++ /dev/null @@ -1,42 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.aai; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; - -import org.junit.Test; - -public class AaiNqRequestErrorTest { - - @Test - public void test() { - AaiNqRequestError aainqRequestError = new AaiNqRequestError(); - AaiNqServiceExcept serviceExcept = new AaiNqServiceExcept(); - aainqRequestError.setServiceExcept(serviceExcept); - assertEquals(aainqRequestError.getServiceExcept(), serviceExcept); - - assertNull(serviceExcept.getMessageId()); - assertNull(serviceExcept.getText()); - assertNull(serviceExcept.getVariables()); - } -} diff --git a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqRequestTest.java b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqRequestTest.java deleted file mode 100644 index 35108a03a..000000000 --- a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqRequestTest.java +++ /dev/null @@ -1,60 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= -*/ - -package org.onap.policy.aai; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -import java.util.UUID; -import org.junit.Test; -import org.onap.policy.aai.util.Serialization; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class AaiNqRequestTest { - private static final Logger logger = LoggerFactory.getLogger(AaiNqRequestTest.class); - - @Test - public void test() { - AaiNqRequest aaiNqRequest = new AaiNqRequest(); - AaiNqInstanceFilters aaiNqInstanceFilters = new AaiNqInstanceFilters(); - - aaiNqRequest.setInstanceFilters(aaiNqInstanceFilters); - assertNotNull(aaiNqRequest.getInstanceFilters()); - AaiNqNamedQuery aaiNqNamedQuery = new AaiNqNamedQuery(); - UUID uuid = UUID.randomUUID(); - aaiNqNamedQuery.setNamedQueryUuid(uuid); - - AaiNqQueryParameters aaiNqQueryParameters = new AaiNqQueryParameters(); - aaiNqQueryParameters.setNamedQuery(aaiNqNamedQuery); - aaiNqRequest.setQueryParameters(aaiNqQueryParameters); - - assertNotNull(aaiNqRequest); - - assertEquals(aaiNqNamedQuery.getNamedQueryUuid(), uuid); - assertEquals(aaiNqQueryParameters.getNamedQuery(), aaiNqNamedQuery); - assertEquals(aaiNqRequest.getQueryParameters(), aaiNqQueryParameters); - - logger.info(Serialization.gsonPretty.toJson(aaiNqRequest)); - } - -} diff --git a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqResponseTest.java b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqResponseTest.java deleted file mode 100644 index ba160e2c7..000000000 --- a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqResponseTest.java +++ /dev/null @@ -1,166 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.aai; - -import java.util.LinkedList; - -import org.junit.Test; -import org.onap.policy.aai.util.Serialization; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class AaiNqResponseTest { - private static final String WIDGET = "widget"; - private static final String MODEL_VERSION_KEY = "model.model-version"; - private static final String MODEL_TYPE_KEY = "model.model-type"; - private static final String MODEL_NAME_KEY = "model.model-name"; - private static final String MODEL_ID_KEY = "model.model-id"; - private static final Logger logger = LoggerFactory.getLogger(AaiNqResponseTest.class); - - @Test - public void test() { - getAaiNqResponse(); - } - - /** - * Get A&AI NQ response. - * - * @return the A&AI NG response - */ - public AaiNqResponse getAaiNqResponse() { - AaiNqInventoryResponseItem serviceItem = new AaiNqInventoryResponseItem(); - serviceItem.setModelName("service-instance"); - serviceItem.setServiceInstance(new AaiNqServiceInstance()); - serviceItem.getServiceInstance().setServiceInstanceId("dhv-test-vhnfportal-service-instance-id"); - serviceItem.getServiceInstance().setServiceInstanceName("dhv-test-service-instance-name1"); - serviceItem.getServiceInstance().setPersonaModelId("82194af1-3c2c-485a-8f44-420e22a9eaa4"); - serviceItem.getServiceInstance().setPersonaModelVersion("1.0"); - serviceItem.getServiceInstance().setServiceInstanceLocationId("dhv-test-service-instance-location-id1"); - serviceItem.getServiceInstance().setResourceVersion("1485366092"); - serviceItem.setExtraProperties(new AaiNqExtraProperties()); - serviceItem.getExtraProperties().getExtraProperty() - .add(new AaiNqExtraProperty(MODEL_NAME_KEY, "service-instance")); - serviceItem.getExtraProperties().getExtraProperty().add(new AaiNqExtraProperty(MODEL_TYPE_KEY, WIDGET)); - serviceItem.getExtraProperties().getExtraProperty().add(new AaiNqExtraProperty(MODEL_VERSION_KEY, "1.0")); - serviceItem.getExtraProperties().getExtraProperty() - .add(new AaiNqExtraProperty(MODEL_ID_KEY, "82194af1-3c2c-485a-8f44-420e22a9eaa4")); - serviceItem.getExtraProperties().getExtraProperty() - .add(new AaiNqExtraProperty(MODEL_NAME_KEY, "46b92144-923a-4d20-b85a-3cbd847668a9")); - - AaiNqInventoryResponseItem vfModuleItem = new AaiNqInventoryResponseItem(); - vfModuleItem.setModelName("vf-module"); - vfModuleItem.setVfModule(new AaiNqVfModule()); - vfModuleItem.getVfModule().setVfModuleId("example-vf-module-id-val-49261"); - vfModuleItem.getVfModule().setVfModuleName("example-vf-module-name-val-73074"); - vfModuleItem.getVfModule().setHeatStackId("example-heat-stack-id-val-86300"); - vfModuleItem.getVfModule().setOrchestrationStatus("example-orchestration-status-val-56523"); - vfModuleItem.getVfModule().setIsBaseVfModule(true); - vfModuleItem.getVfModule().setResourceVersion("1485366450"); - vfModuleItem.getVfModule().setPersonaModelId("ef86f9c5-2165-44f3-8fc3-96018b609ea5"); - vfModuleItem.getVfModule().setPersonaModelVersion("1.0"); - vfModuleItem.getVfModule().setWidgetModelId("example-widget-model-id-val-92571"); - vfModuleItem.getVfModule().setWidgetModelVersion("example-widget-model-version-val-83317"); - vfModuleItem.getVfModule().setContrailServiceInstanceFqdn("example-contrail-service-instance-fqdn-val-86796"); - vfModuleItem.setExtraProperties(new AaiNqExtraProperties()); - vfModuleItem.getExtraProperties().getExtraProperty() - .add(new AaiNqExtraProperty(MODEL_NAME_KEY, "vf-module")); - vfModuleItem.getExtraProperties().getExtraProperty().add(new AaiNqExtraProperty(MODEL_TYPE_KEY, WIDGET)); - vfModuleItem.getExtraProperties().getExtraProperty().add(new AaiNqExtraProperty(MODEL_VERSION_KEY, "1.0")); - vfModuleItem.getExtraProperties().getExtraProperty() - .add(new AaiNqExtraProperty(MODEL_ID_KEY, "ef86f9c5-2165-44f3-8fc3-96018b609ea5")); - vfModuleItem.getExtraProperties().getExtraProperty() - .add(new AaiNqExtraProperty(MODEL_NAME_KEY, "c00563ae-812b-4e62-8330-7c4d0f47088a")); - - AaiNqInventoryResponseItem genericVnfItem = new AaiNqInventoryResponseItem(); - genericVnfItem.setModelName("generic-vnf"); - genericVnfItem.setGenericVnf(new AaiNqGenericVnf()); - genericVnfItem.getGenericVnf().setVnfId("dhv-test-gvnf"); - genericVnfItem.getGenericVnf().setVnfName("dhv-test-gvnf-name"); - genericVnfItem.getGenericVnf().setVnfName2("dhv-test-gvnf-name2"); - genericVnfItem.getGenericVnf().setVnfType("SW"); - genericVnfItem.getGenericVnf().setServiceId("d7bb0a21-66f2-4e6d-87d9-9ef3ced63ae4"); - genericVnfItem.getGenericVnf().setProvStatus("PREPROV"); - genericVnfItem.getGenericVnf().setOperationalState("dhv-test-operational-state"); - genericVnfItem.getGenericVnf().setIpv4OamAddress("dhv-test-gvnf-ipv4-oam-address"); - genericVnfItem.getGenericVnf().setIpv4Loopback0Address("dhv-test-gvnfipv4-loopback0-address"); - genericVnfItem.getGenericVnf().setInMaint(false); - genericVnfItem.getGenericVnf().setIsClosedLoopDisabled(false); - genericVnfItem.getGenericVnf().setResourceVersion("1485366450"); - genericVnfItem.getGenericVnf().setEncrypedAccessFlag(true); - genericVnfItem.getGenericVnf().setPersonaModelId("acc6edd8-a8d4-4b93-afaa-0994068be14c"); - genericVnfItem.getGenericVnf().setPersonaModelVersion("1.0"); - genericVnfItem.setExtraProperties(new AaiNqExtraProperties()); - genericVnfItem.getExtraProperties().setExtraProperty(new LinkedList<>()); - genericVnfItem.getExtraProperties().getExtraProperty() - .add(new AaiNqExtraProperty(MODEL_NAME_KEY, "generic-vnf")); - genericVnfItem.getExtraProperties().getExtraProperty() - .add(new AaiNqExtraProperty(MODEL_TYPE_KEY, WIDGET)); - genericVnfItem.getExtraProperties().getExtraProperty() - .add(new AaiNqExtraProperty(MODEL_VERSION_KEY, "1.0")); - genericVnfItem.getExtraProperties().getExtraProperty() - .add(new AaiNqExtraProperty(MODEL_ID_KEY, "acc6edd8-a8d4-4b93-afaa-0994068be14c")); - genericVnfItem.getExtraProperties().getExtraProperty() - .add(new AaiNqExtraProperty("model.model-name-version-id", "93a6166f-b3d5-4f06-b4ba-aed48d009ad9")); - genericVnfItem.setItems(new AaiNqInventoryResponseItems()); - genericVnfItem.getItems().setInventoryResponseItems(new LinkedList<>()); - genericVnfItem.getItems().getInventoryResponseItems().add(serviceItem); - genericVnfItem.getItems().getInventoryResponseItems().add(vfModuleItem); - - AaiNqInventoryResponseItem cloudItem = new AaiNqInventoryResponseItem(); - cloudItem.setCloudRegion(new AaiNqCloudRegion()); - cloudItem.getCloudRegion().setCloudOwner("OWNER"); - cloudItem.getCloudRegion().setCloudRegionId("REGIONID"); - cloudItem.getCloudRegion().setCloudRegionVersion("2.5"); - cloudItem.getCloudRegion().setComplexName("COMPLEXNAME"); - cloudItem.getCloudRegion().setResourceVersion("1485365988"); - - AaiNqInventoryResponseItem tenantItem = new AaiNqInventoryResponseItem(); - tenantItem.setTenant(new AaiNqTenant()); - tenantItem.getTenant().setTenantId("dhv-test-tenant"); - tenantItem.getTenant().setTenantName("dhv-test-tenant-name"); - tenantItem.getTenant().setResourceVersion("1485366334"); - tenantItem.setItems(new AaiNqInventoryResponseItems()); - tenantItem.getItems().setInventoryResponseItems(new LinkedList<>()); - tenantItem.getItems().getInventoryResponseItems().add(cloudItem); - - AaiNqInventoryResponseItem vserverItem = new AaiNqInventoryResponseItem(); - vserverItem.setVserver(new AaiNqVServer()); - vserverItem.getVserver().setVserverId("dhv-test-vserver"); - vserverItem.getVserver().setVserverName("dhv-test-vserver-name"); - vserverItem.getVserver().setVserverName2("dhv-test-vserver-name2"); - vserverItem.getVserver().setProvStatus("PREPROV"); - vserverItem.getVserver().setVserverSelflink("dhv-test-vserver-selflink"); - vserverItem.getVserver().setInMaint(false); - vserverItem.getVserver().setIsClosedLoopDisabled(false); - vserverItem.getVserver().setResourceVersion("1485366417"); - vserverItem.setItems(new AaiNqInventoryResponseItems()); - vserverItem.getItems().setInventoryResponseItems(new LinkedList<>()); - vserverItem.getItems().getInventoryResponseItems().add(genericVnfItem); - vserverItem.getItems().getInventoryResponseItems().add(tenantItem); - - AaiNqResponse aaiResponse = new AaiNqResponse(); - aaiResponse.getInventoryResponseItems().add(vserverItem); - logger.info(Serialization.gsonPretty.toJson(aaiResponse)); - - return aaiResponse; - } -} diff --git a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqResponseWrapperTest.java b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqResponseWrapperTest.java deleted file mode 100644 index f80fd82bd..000000000 --- a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqResponseWrapperTest.java +++ /dev/null @@ -1,269 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= -*/ - -package org.onap.policy.aai; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -import java.io.IOException; -import java.nio.charset.StandardCharsets; -import java.util.LinkedList; -import java.util.List; -import java.util.UUID; -import org.apache.commons.io.IOUtils; -import org.junit.Test; -import org.onap.policy.aai.util.Serialization; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class AaiNqResponseWrapperTest { - private static final String WIDGET = "widget"; - private static final String MODEL_VERSION_KEY = "model.model-version"; - private static final String MODEL_TYPE_KEY = "model.model-type"; - private static final String MODEL_NAME_KEY = "model.model-name"; - private static final String MODEL_ID_KEY = "model.model-id"; - private static final String VERSION_JSON = "AaiNqResponseWrapper-Vserver.json"; - private static final String NO_NAMES_JSON = "AaiNqResponseWrapper-NoNames.json"; - private static final Logger logger = LoggerFactory.getLogger(AaiNqResponseWrapperTest.class); - - @Test - public void test() { - AaiNqInventoryResponseItem serviceItem = new AaiNqInventoryResponseItem(); - serviceItem.setModelName("service-instance"); - serviceItem.setServiceInstance(new AaiNqServiceInstance()); - serviceItem.getServiceInstance().setServiceInstanceId("dhv-test-vhnfportal-service-instance-id"); - serviceItem.getServiceInstance().setServiceInstanceName("dhv-test-service-instance-name1"); - serviceItem.getServiceInstance().setPersonaModelId("82194af1-3c2c-485a-8f44-420e22a9eaa4"); - serviceItem.getServiceInstance().setPersonaModelVersion("1.0"); - serviceItem.getServiceInstance().setServiceInstanceLocationId("dhv-test-service-instance-location-id1"); - serviceItem.getServiceInstance().setResourceVersion("1485366092"); - serviceItem.setExtraProperties(new AaiNqExtraProperties()); - serviceItem.getExtraProperties().getExtraProperty() - .add(new AaiNqExtraProperty(MODEL_NAME_KEY, "service-instance")); - serviceItem.getExtraProperties().getExtraProperty().add(new AaiNqExtraProperty(MODEL_TYPE_KEY, WIDGET)); - serviceItem.getExtraProperties().getExtraProperty().add(new AaiNqExtraProperty(MODEL_VERSION_KEY, "1.0")); - serviceItem.getExtraProperties().getExtraProperty() - .add(new AaiNqExtraProperty(MODEL_ID_KEY, "82194af1-3c2c-485a-8f44-420e22a9eaa4")); - serviceItem.getExtraProperties().getExtraProperty() - .add(new AaiNqExtraProperty(MODEL_NAME_KEY, "46b92144-923a-4d20-b85a-3cbd847668a9")); - - AaiNqInventoryResponseItem vfModuleItem = new AaiNqInventoryResponseItem(); - vfModuleItem.setModelName("vf-module"); - vfModuleItem.setVfModule(new AaiNqVfModule()); - vfModuleItem.getVfModule().setVfModuleId("example-vf-module-id-val-49261"); - vfModuleItem.getVfModule().setVfModuleName("example-vf-module-name-val-73074"); - vfModuleItem.getVfModule().setHeatStackId("example-heat-stack-id-val-86300"); - vfModuleItem.getVfModule().setOrchestrationStatus("example-orchestration-status-val-56523"); - vfModuleItem.getVfModule().setIsBaseVfModule(true); - vfModuleItem.getVfModule().setResourceVersion("1485366450"); - vfModuleItem.getVfModule().setPersonaModelId("ef86f9c5-2165-44f3-8fc3-96018b609ea5"); - vfModuleItem.getVfModule().setPersonaModelVersion("1.0"); - vfModuleItem.getVfModule().setWidgetModelId("example-widget-model-id-val-92571"); - vfModuleItem.getVfModule().setWidgetModelVersion("example-widget-model-version-val-83317"); - vfModuleItem.getVfModule().setContrailServiceInstanceFqdn("example-contrail-service-instance-fqdn-val-86796"); - vfModuleItem.setExtraProperties(new AaiNqExtraProperties()); - vfModuleItem.getExtraProperties().getExtraProperty() - .add(new AaiNqExtraProperty(MODEL_NAME_KEY, "vf-module")); - vfModuleItem.getExtraProperties().getExtraProperty().add(new AaiNqExtraProperty(MODEL_TYPE_KEY, WIDGET)); - vfModuleItem.getExtraProperties().getExtraProperty().add(new AaiNqExtraProperty(MODEL_VERSION_KEY, "1.0")); - vfModuleItem.getExtraProperties().getExtraProperty() - .add(new AaiNqExtraProperty(MODEL_ID_KEY, "ef86f9c5-2165-44f3-8fc3-96018b609ea5")); - vfModuleItem.getExtraProperties().getExtraProperty() - .add(new AaiNqExtraProperty(MODEL_NAME_KEY, "c00563ae-812b-4e62-8330-7c4d0f47088a")); - - AaiNqInventoryResponseItem genericVnfItem = new AaiNqInventoryResponseItem(); - genericVnfItem.setModelName("generic-vnf"); - genericVnfItem.setGenericVnf(new AaiNqGenericVnf()); - genericVnfItem.getGenericVnf().setVnfId("dhv-test-gvnf"); - genericVnfItem.getGenericVnf().setVnfName("dhv-test-gvnf-name"); - genericVnfItem.getGenericVnf().setVnfName2("dhv-test-gvnf-name2"); - genericVnfItem.getGenericVnf().setVnfType("SW"); - genericVnfItem.getGenericVnf().setServiceId("d7bb0a21-66f2-4e6d-87d9-9ef3ced63ae4"); - genericVnfItem.getGenericVnf().setProvStatus("PREPROV"); - genericVnfItem.getGenericVnf().setOperationalState("dhv-test-operational-state"); - genericVnfItem.getGenericVnf().setIpv4OamAddress("dhv-test-gvnf-ipv4-oam-address"); - genericVnfItem.getGenericVnf().setIpv4Loopback0Address("dhv-test-gvnfipv4-loopback0-address"); - genericVnfItem.getGenericVnf().setInMaint(false); - genericVnfItem.getGenericVnf().setIsClosedLoopDisabled(false); - genericVnfItem.getGenericVnf().setResourceVersion("1485366450"); - genericVnfItem.getGenericVnf().setEncrypedAccessFlag(true); - genericVnfItem.getGenericVnf().setPersonaModelId("acc6edd8-a8d4-4b93-afaa-0994068be14c"); - genericVnfItem.getGenericVnf().setPersonaModelVersion("1.0"); - genericVnfItem.setExtraProperties(new AaiNqExtraProperties()); - genericVnfItem.getExtraProperties().setExtraProperty(new LinkedList<>()); - genericVnfItem.getExtraProperties().getExtraProperty() - .add(new AaiNqExtraProperty(MODEL_NAME_KEY, "generic-vnf")); - genericVnfItem.getExtraProperties().getExtraProperty() - .add(new AaiNqExtraProperty(MODEL_TYPE_KEY, WIDGET)); - genericVnfItem.getExtraProperties().getExtraProperty() - .add(new AaiNqExtraProperty(MODEL_VERSION_KEY, "1.0")); - genericVnfItem.getExtraProperties().getExtraProperty() - .add(new AaiNqExtraProperty(MODEL_ID_KEY, "acc6edd8-a8d4-4b93-afaa-0994068be14c")); - genericVnfItem.getExtraProperties().getExtraProperty() - .add(new AaiNqExtraProperty("model.model-name-version-id", "93a6166f-b3d5-4f06-b4ba-aed48d009ad9")); - genericVnfItem.setItems(new AaiNqInventoryResponseItems()); - genericVnfItem.getItems().setInventoryResponseItems(new LinkedList<>()); - genericVnfItem.getItems().getInventoryResponseItems().add(serviceItem); - genericVnfItem.getItems().getInventoryResponseItems().add(vfModuleItem); - - AaiNqInventoryResponseItem cloudItem = new AaiNqInventoryResponseItem(); - cloudItem.setCloudRegion(new AaiNqCloudRegion()); - cloudItem.getCloudRegion().setCloudOwner("OWNER"); - cloudItem.getCloudRegion().setCloudRegionId("REGIONID"); - cloudItem.getCloudRegion().setCloudRegionVersion("2.5"); - cloudItem.getCloudRegion().setComplexName("COMPLEXNAME"); - cloudItem.getCloudRegion().setResourceVersion("1485365988"); - - AaiNqInventoryResponseItem tenantItem = new AaiNqInventoryResponseItem(); - tenantItem.setTenant(new AaiNqTenant()); - tenantItem.getTenant().setTenantId("dhv-test-tenant"); - tenantItem.getTenant().setTenantName("dhv-test-tenant-name"); - tenantItem.getTenant().setResourceVersion("1485366334"); - tenantItem.setItems(new AaiNqInventoryResponseItems()); - tenantItem.getItems().setInventoryResponseItems(new LinkedList<>()); - tenantItem.getItems().getInventoryResponseItems().add(cloudItem); - - AaiNqInventoryResponseItem vserverItem = new AaiNqInventoryResponseItem(); - vserverItem.setVserver(new AaiNqVServer()); - vserverItem.getVserver().setVserverId("dhv-test-vserver"); - vserverItem.getVserver().setVserverName("dhv-test-vserver-name"); - vserverItem.getVserver().setVserverName2("dhv-test-vserver-name2"); - vserverItem.getVserver().setProvStatus("PREPROV"); - vserverItem.getVserver().setVserverSelflink("dhv-test-vserver-selflink"); - vserverItem.getVserver().setInMaint(false); - vserverItem.getVserver().setIsClosedLoopDisabled(false); - vserverItem.getVserver().setResourceVersion("1485366417"); - vserverItem.setItems(new AaiNqInventoryResponseItems()); - vserverItem.getItems().setInventoryResponseItems(new LinkedList<>()); - vserverItem.getItems().getInventoryResponseItems().add(genericVnfItem); - vserverItem.getItems().getInventoryResponseItems().add(tenantItem); - - AaiNqResponse aaiResponse = new AaiNqResponse(); - aaiResponse.getInventoryResponseItems().add(vserverItem); - AaiNqResponseWrapper aaiNqResponseWarapper = new AaiNqResponseWrapper(); - aaiNqResponseWarapper.setAaiNqResponse(aaiResponse); - aaiNqResponseWarapper.setRequestId(UUID.randomUUID()); - assertNotNull(aaiNqResponseWarapper); - logger.info(Serialization.gsonPretty.toJson(aaiNqResponseWarapper)); - - AaiNqResponse aaiResponse2 = new AaiNqResponse(); - aaiResponse2.getInventoryResponseItems().add(vserverItem); - AaiNqResponseWrapper aaiNqResponseWarapper2 = new AaiNqResponseWrapper(UUID.randomUUID(), aaiResponse); - assertNotNull(aaiNqResponseWarapper2); - assertNotNull(aaiNqResponseWarapper2.getRequestId()); - assertNotNull(aaiNqResponseWarapper2.getAaiNqResponse()); - logger.info(Serialization.gsonPretty.toJson(aaiNqResponseWarapper2)); - } - - @Test - public void testCountVfModules() throws Exception { - AaiNqResponseWrapper resp; - - // null item - resp = new AaiNqResponseWrapper(); - assertEquals(0, resp.countVfModules()); - - // no names - resp.setAaiNqResponse(load(NO_NAMES_JSON)); - assertEquals(0, resp.countVfModules()); - - // has VF modules - resp.setAaiNqResponse(load(VERSION_JSON)); - assertEquals(3, resp.countVfModules()); - } - - @Test - public void testGenVfModuleName() throws Exception { - AaiNqResponseWrapper resp; - - // null item - resp = new AaiNqResponseWrapper(); - assertEquals(null, resp.genVfModuleName()); - - // no names - resp.setAaiNqResponse(load(NO_NAMES_JSON)); - assertEquals(null, resp.genVfModuleName()); - - // has VF modules - resp.setAaiNqResponse(load(VERSION_JSON)); - assertEquals("my-module-abc_124", resp.genVfModuleName()); - } - - @Test - public void testGetVfModules() throws Exception { - AaiNqResponseWrapper resp; - - // null item - resp = new AaiNqResponseWrapper(); - assertTrue(resp.getVfModuleItems(true).isEmpty()); - - // missing item - resp = new AaiNqResponseWrapper(); - resp.setAaiNqResponse(new AaiNqResponse()); - assertTrue(resp.getVfModuleItems(false).isEmpty()); - - // null item list - resp.setAaiNqResponse(load("AaiNqResponseWrapper-NoItems.json")); - resp.getAaiNqResponse().getInventoryResponseItems().get(0).getItems().getInventoryResponseItems().get(0) - .getItems().setInventoryResponseItems(null); - assertTrue(resp.getVfModuleItems(false).isEmpty()); - - // no modules - resp.setAaiNqResponse(load("AaiNqResponseWrapper-NoModules.json")); - assertTrue(resp.getVfModuleItems(false).isEmpty()); - - // no names - resp.setAaiNqResponse(load(NO_NAMES_JSON)); - List<AaiNqInventoryResponseItem> lst; - lst = resp.getVfModuleItems(false); - assertEquals(0, lst.size()); - - // base VF modules - resp.setAaiNqResponse(load(VERSION_JSON)); - lst = resp.getVfModuleItems(true); - assertEquals(1, lst.size()); - assertEquals("Vfmodule_vLBMS-0809-1", lst.get(0).getVfModule().getVfModuleName()); - - // non base VF modules - resp.setAaiNqResponse(load(VERSION_JSON)); - lst = resp.getVfModuleItems(false); - assertEquals(3, lst.size()); - int index; - index = 0; - assertEquals("my-module-abc_1", lst.get(index++).getVfModule().getVfModuleName()); - assertEquals("my-module-abc_123", lst.get(index++).getVfModule().getVfModuleName()); - assertEquals("my-module-abc_34", lst.get(index++).getVfModule().getVfModuleName()); - } - - /** - * Loads a response from a JSON file. - * - * @param fileName name of the file containing the JSON response - * @return the response - * @throws IOException if the file cannot be read - */ - private AaiNqResponse load(String fileName) throws IOException { - String json = IOUtils.toString(getClass().getResource(fileName), StandardCharsets.UTF_8); - return Serialization.gsonPretty.fromJson(json, AaiNqResponse.class); - } -} diff --git a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqServiceInstanceTest.java b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqServiceInstanceTest.java deleted file mode 100644 index 45a55c99b..000000000 --- a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqServiceInstanceTest.java +++ /dev/null @@ -1,58 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= -*/ - -package org.onap.policy.aai; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -import org.junit.Test; -import org.onap.policy.aai.util.Serialization; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class AaiNqServiceInstanceTest { - private static final Logger logger = LoggerFactory.getLogger(AaiNqServiceInstanceTest.class); - - @Test - public void test() { - AaiNqServiceInstance aaiNqServiceInstance = new AaiNqServiceInstance(); - aaiNqServiceInstance.setServiceInstanceId("dhv-test-vhnfportal-service-instance-id"); - aaiNqServiceInstance.setServiceInstanceName("dhv-test-service-instance-name1"); - aaiNqServiceInstance.setPersonaModelId("82194af1-3c2c-485a-8f44-420e22a9eaa4"); - aaiNqServiceInstance.setPersonaModelVersion("1.0"); - aaiNqServiceInstance.setServiceInstanceLocationId("dhv-test-service-instance-location-id1"); - aaiNqServiceInstance.setResourceVersion("1485366092"); - aaiNqServiceInstance.setModelInvariantId("SomeID"); - aaiNqServiceInstance.setModelVersionId("SomeVersion"); - assertNotNull(aaiNqServiceInstance); - assertEquals("dhv-test-vhnfportal-service-instance-id", aaiNqServiceInstance.getServiceInstanceId()); - assertEquals("dhv-test-service-instance-name1", aaiNqServiceInstance.getServiceInstanceName()); - assertEquals("82194af1-3c2c-485a-8f44-420e22a9eaa4", aaiNqServiceInstance.getPersonaModelId()); - assertEquals("1.0", aaiNqServiceInstance.getPersonaModelVersion()); - assertEquals("dhv-test-service-instance-location-id1", aaiNqServiceInstance.getServiceInstanceLocationId()); - assertEquals("1485366092", aaiNqServiceInstance.getResourceVersion()); - assertEquals("SomeID", aaiNqServiceInstance.getModelInvariantId()); - assertEquals("SomeVersion", aaiNqServiceInstance.getModelVersionId()); - logger.info(Serialization.gsonPretty.toJson(aaiNqServiceInstance)); - } - -} diff --git a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqTenantTest.java b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqTenantTest.java deleted file mode 100644 index ed4cdb705..000000000 --- a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqTenantTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= -*/ - -package org.onap.policy.aai; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -import org.junit.Test; -import org.onap.policy.aai.util.Serialization; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class AaiNqTenantTest { - private static final Logger logger = LoggerFactory.getLogger(AaiNqTenantTest.class); - - @Test - public void test() { - AaiNqTenant aaiNqTenant = new AaiNqTenant(); - aaiNqTenant.setTenantId("dhv-test-tenant"); - aaiNqTenant.setTenantName("dhv-test-tenant-name"); - aaiNqTenant.setResourceVersion("1485366334"); - assertNotNull(aaiNqTenant); - assertEquals("dhv-test-tenant", aaiNqTenant.getTenantId()); - assertEquals("dhv-test-tenant-name", aaiNqTenant.getTenantName()); - assertEquals("1485366334", aaiNqTenant.getResourceVersion()); - - logger.info(Serialization.gsonPretty.toJson(aaiNqTenant)); - } - -} diff --git a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqVServerTest.java b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqVServerTest.java deleted file mode 100644 index c613a0223..000000000 --- a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqVServerTest.java +++ /dev/null @@ -1,93 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= -*/ - -package org.onap.policy.aai; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -import java.io.File; -import java.nio.file.Files; -import java.util.List; -import org.junit.Test; -import org.onap.policy.aai.util.Serialization; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class AaiNqVServerTest { - private static final Logger logger = LoggerFactory.getLogger(AaiNqVServerTest.class); - - @Test - public void test() throws Exception { - // deserialize json and verify fields are populated properly - String json = new String(Files - .readAllBytes(new File("src/test/resources/org/onap/policy/aai/AaiNqVServer.json").toPath())); - - AaiNqVServer resp = Serialization.gsonPretty.fromJson(json, AaiNqVServer.class); - - assertEquals(false, resp.getInMaint()); - assertEquals(true, resp.getIsClosedLoopDisabled()); - assertEquals("ACTIVE", resp.getProvStatus()); - assertEquals("1533850964910", resp.getResourceVersion()); - assertEquals("1c94da3f-16f1-4fc7-9ed1-e018dfa62774", resp.getVserverId()); - assertEquals("vlb-ms-0809-1", resp.getVserverName()); - assertEquals("vlb-ms-0809-7", resp.getVserverName2()); - assertEquals("http://localhost:8774/v2.1/4086f396c5e04caf9502c5fdeca575c4/servers/1c94da3f-16f1-4fc7-9ed1-e018dfa62774", - resp.getVserverSelflink()); - - // don't need to verify this in depth, as it has its own tests that do that - RelationshipList relationshipList = resp.getRelationshipList(); - assertNotNull(relationshipList); - - List<Relationship> lst = relationshipList.getRelationships(); - assertNotNull(lst); - - assertEquals(3, lst.size()); - assertEquals("generic-vnf", lst.get(0).getRelatedTo()); - assertEquals("image", lst.get(1).getRelatedTo()); - - logger.info(Serialization.gsonPretty.toJson(resp)); - - // verify that setXxx methods work - relationshipList = new RelationshipList(); - - resp.setInMaint(true); - resp.setIsClosedLoopDisabled(false); - resp.setProvStatus("inactive"); - resp.setRelationshipList(relationshipList); - resp.setResourceVersion("vers"); - resp.setVserverId("vid"); - resp.setVserverName("vname"); - resp.setVserverName2("vname2"); - resp.setVserverSelflink("link"); - - assertEquals(true, resp.getInMaint()); - assertEquals(false, resp.getIsClosedLoopDisabled()); - assertEquals("inactive", resp.getProvStatus()); - assertEquals("vers", resp.getResourceVersion()); - assertEquals("vid", resp.getVserverId()); - assertEquals("vname", resp.getVserverName()); - assertEquals("vname2", resp.getVserverName2()); - assertEquals("link", resp.getVserverSelflink()); - assertEquals(relationshipList, resp.getRelationshipList()); - } - -} diff --git a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqVfModuleTest.java b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqVfModuleTest.java deleted file mode 100644 index 65bde98c2..000000000 --- a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqVfModuleTest.java +++ /dev/null @@ -1,71 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.aai; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -import org.junit.Test; -import org.onap.policy.aai.util.Serialization; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class AaiNqVfModuleTest { - private static final Logger logger = LoggerFactory.getLogger(AaiNqVfModuleTest.class); - - @Test - public void test() { - AaiNqVfModule aaiNqVfModule = new AaiNqVfModule(); - aaiNqVfModule.setVfModuleId("example-vf-module-id-val-49261"); - aaiNqVfModule.setVfModuleName("example-vf-module-name-val-73074"); - aaiNqVfModule.setHeatStackId("example-heat-stack-id-val-86300"); - aaiNqVfModule.setOrchestrationStatus("example-orchestration-status-val-56523"); - aaiNqVfModule.setIsBaseVfModule(true); - aaiNqVfModule.setResourceVersion("1485366450"); - aaiNqVfModule.setPersonaModelId("ef86f9c5-2165-44f3-8fc3-96018b609ea5"); - aaiNqVfModule.setPersonaModelVersion("1.0"); - aaiNqVfModule.setWidgetModelId("example-widget-model-id-val-92571"); - aaiNqVfModule.setWidgetModelVersion("example-widget-model-version-val-83317"); - aaiNqVfModule.setContrailServiceInstanceFqdn("example-contrail-service-instance-fqdn-val-86796"); - aaiNqVfModule.setModelInvariantId("SomeId"); - aaiNqVfModule.setModelVersionId("SomeVersion"); - aaiNqVfModule.setModelCustomizationId("SomeCustomizationId"); - assertNotNull(aaiNqVfModule); - assertEquals("example-vf-module-id-val-49261", aaiNqVfModule.getVfModuleId()); - assertEquals("example-vf-module-name-val-73074", aaiNqVfModule.getVfModuleName()); - assertEquals("example-heat-stack-id-val-86300", aaiNqVfModule.getHeatStackId()); - assertEquals("example-orchestration-status-val-56523", aaiNqVfModule.getOrchestrationStatus()); - assertEquals(true, aaiNqVfModule.getIsBaseVfModule()); - assertEquals("1485366450", aaiNqVfModule.getResourceVersion()); - assertEquals("ef86f9c5-2165-44f3-8fc3-96018b609ea5", aaiNqVfModule.getPersonaModelId()); - assertEquals("1.0", aaiNqVfModule.getPersonaModelVersion()); - assertEquals("example-widget-model-id-val-92571", aaiNqVfModule.getWidgetModelId()); - assertEquals("example-widget-model-version-val-83317", aaiNqVfModule.getWidgetModelVersion()); - assertEquals("example-contrail-service-instance-fqdn-val-86796", - aaiNqVfModule.getContrailServiceInstanceFqdn()); - assertEquals("SomeId", aaiNqVfModule.getModelInvariantId()); - assertEquals("SomeVersion", aaiNqVfModule.getModelVersionId()); - assertEquals("SomeCustomizationId", aaiNqVfModule.getModelCustomizationId()); - logger.info(Serialization.gsonPretty.toJson(aaiNqVfModule)); - } - -} diff --git a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/PnfInstanceTest.java b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/PnfInstanceTest.java deleted file mode 100644 index db3e90ed0..000000000 --- a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/PnfInstanceTest.java +++ /dev/null @@ -1,98 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= -*/ - -package org.onap.policy.aai; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -import org.junit.Test; -import org.onap.policy.aai.util.Serialization; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class PnfInstanceTest { - private static final String PNF_NAME_TEST = "pnf-name-test"; - private static final Logger logger = LoggerFactory.getLogger(PnfInstanceTest.class); - - @Test - public void test() { - PnfInstance pnfInstance = new PnfInstance(); - pnfInstance.setPnfInstanceName("pnf-instance-name-test"); - pnfInstance.setPnfName(PNF_NAME_TEST); - pnfInstance.setPnfType(PnfType.ENODEB); - pnfInstance.setPnfSerial("pnf-serial-test"); - assertNotNull(pnfInstance); - assertEquals("pnf-instance-name-test", pnfInstance.getPnfInstanceName()); - - PnfInstance pnfInstanceNull = new PnfInstance(null); - assertNotNull(pnfInstanceNull); - - PnfInstance pnfInstanceClone = new PnfInstance(pnfInstance); - assertNotNull(pnfInstanceClone); - - assertEquals(PNF_NAME_TEST, pnfInstanceClone.getPnfName()); - assertEquals(PnfType.ENODEB, pnfInstanceClone.getPnfType()); - assertEquals("pnf-serial-test", pnfInstanceClone.getPnfSerial()); - - assertNotNull(pnfInstanceClone.toString()); - assertNotEquals(0, pnfInstanceClone.hashCode()); - assertNotEquals(0, new Pnf().hashCode()); - - PnfInstance pnfInstanceOther0 = new PnfInstance(); - pnfInstanceOther0.setPnfName(PNF_NAME_TEST); - - PnfInstance pnfInstanceOther1 = new PnfInstance(pnfInstance); - pnfInstanceOther1.setPnfName("pnf-name-test-diff"); - - PnfInstance pnfInstanceOther2 = new PnfInstance(pnfInstance); - pnfInstanceOther2.setPnfInstanceName("pnf-instance-name-test-diff"); - - PnfInstance pnfInstanceOther3 = new PnfInstance(pnfInstance); - pnfInstanceOther3.setPnfName(null); - - PnfInstance pnfInstanceOther4 = new PnfInstance(pnfInstance); - pnfInstanceOther4.setPnfSerial(null); - - PnfInstance pnfInstanceOther5 = new PnfInstance(pnfInstance); - pnfInstanceOther5.setPnfSerial("pnf-serial-test-diff"); - - assertEquals(pnfInstance, pnfInstance); - assertNotEquals(null, pnfInstance); - assertNotEquals("hello", pnfInstance); - assertEquals(pnfInstance, pnfInstanceClone); - assertNotEquals(pnfInstance, new Pnf()); - assertNotEquals(new Pnf(), pnfInstance); - assertNotEquals(new Pnf(), pnfInstanceOther0); - assertNotEquals(pnfInstanceOther0, pnfInstance); - assertNotEquals(pnfInstanceOther1, pnfInstance); - assertNotEquals(pnfInstanceOther2, pnfInstance); - assertNotEquals(pnfInstanceOther3, pnfInstance); - assertNotEquals(pnfInstanceOther4, pnfInstance); - assertNotEquals(pnfInstanceOther5, pnfInstance); - - logger.info(Serialization.gsonPretty.toJson(pnfInstance)); - } - -} diff --git a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/PnfTest.java b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/PnfTest.java deleted file mode 100644 index d7fc0d2b7..000000000 --- a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/PnfTest.java +++ /dev/null @@ -1,70 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= -*/ - -package org.onap.policy.aai; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -import org.junit.Test; -import org.onap.policy.aai.util.Serialization; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class PnfTest { - private static final String PNF_NAME_TEST = "pnf-name-test"; - private static final Logger logger = LoggerFactory.getLogger(PnfTest.class); - - @Test - public void test() { - Pnf pnf = new Pnf(); - pnf.setPnfName(PNF_NAME_TEST); - pnf.setPnfType(PnfType.ENODEB); - assertNotNull(pnf); - - Pnf pnfClone = new Pnf(pnf); - assertNotNull(pnfClone); - - assertEquals(PNF_NAME_TEST, pnfClone.getPnfName()); - assertEquals(PnfType.ENODEB, pnfClone.getPnfType()); - - assertNotNull(pnfClone.toString()); - assertNotEquals(0, pnfClone.hashCode()); - assertNotEquals(0, new Pnf().hashCode()); - - Pnf pnfOther = new Pnf(); - pnfOther.setPnfName(PNF_NAME_TEST); - - assertEquals(pnf, pnf); - assertNotNull(pnf); - assertNotEquals("hello", pnf); - assertEquals(pnf, pnfClone); - assertNotEquals(pnf, new Pnf()); - assertNotEquals(new Pnf(), pnf); - assertNotEquals(new Pnf(), pnfOther); - assertNotEquals(pnfOther, pnf); - - logger.info(Serialization.gsonPretty.toJson(pnf)); - } -} diff --git a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/PnfTypeTest.java b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/PnfTypeTest.java deleted file mode 100644 index d3236904d..000000000 --- a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/PnfTypeTest.java +++ /dev/null @@ -1,42 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= -*/ - -package org.onap.policy.aai; - -import static org.junit.Assert.assertNotNull; - -import org.junit.Test; -import org.onap.policy.aai.util.Serialization; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class PnfTypeTest { - private static final Logger logger = LoggerFactory.getLogger(PnfTypeTest.class); - - @Test - public void test() { - PnfType pnfType = PnfType.ENODEB; - assertNotNull(pnfType); - assertNotNull(pnfType.toString()); - logger.info(Serialization.gsonPretty.toJson(pnfType)); - } - -} diff --git a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/RelatedToPropertyTest.java b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/RelatedToPropertyTest.java deleted file mode 100644 index 4d40a1eb7..000000000 --- a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/RelatedToPropertyTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= -*/ - -package org.onap.policy.aai; - -import static org.junit.Assert.assertEquals; - -import java.io.File; -import java.nio.file.Files; -import org.junit.Test; -import org.onap.policy.aai.util.Serialization; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class RelatedToPropertyTest { - private static final Logger logger = LoggerFactory.getLogger(RelatedToPropertyTest.class); - - @Test - public void test() throws Exception { - // deserialize json and verify fields are populated properly - String json = new String(Files.readAllBytes( - new File("src/test/resources/org/onap/policy/aai/RelatedToProperty.json").toPath())); - - RelatedToProperty relatedToProperty = Serialization.gsonPretty.fromJson(json, RelatedToProperty.class); - - assertEquals("generic-vnf.vnf-name", relatedToProperty.getPropertyKey()); - assertEquals("vLoadBalancerMS-Vnf-0809-1", relatedToProperty.getPropertyValue()); - - logger.info(Serialization.gsonPretty.toJson(relatedToProperty)); - - // verify that setXxx methods work - relatedToProperty.setPropertyKey("a key"); - relatedToProperty.setPropertyValue("a value"); - - assertEquals("a key", relatedToProperty.getPropertyKey()); - assertEquals("a value", relatedToProperty.getPropertyValue()); - } - -} diff --git a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipDataTest.java b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipDataTest.java deleted file mode 100644 index d5c11d9e4..000000000 --- a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipDataTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= -*/ - -package org.onap.policy.aai; - -import static org.junit.Assert.assertEquals; - -import java.io.File; -import java.nio.file.Files; -import org.junit.Test; -import org.onap.policy.aai.util.Serialization; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class RelationshipDataTest { - private static final Logger logger = LoggerFactory.getLogger(RelationshipDataTest.class); - - @Test - public void test() throws Exception { - // deserialize json and verify fields are populated properly - String json = new String(Files.readAllBytes( - new File("src/test/resources/org/onap/policy/aai/RelationshipData.json").toPath())); - - RelationshipData relationshipData = Serialization.gsonPretty.fromJson(json, RelationshipData.class); - - assertEquals("generic-vnf.vnf-id", relationshipData.getRelationshipKey()); - assertEquals("807a3f02-f878-436b-870c-f0e91e81570d", relationshipData.getRelationshipValue()); - - logger.info(Serialization.gsonPretty.toJson(relationshipData)); - - // verify that setXxx methods work - relationshipData.setRelationshipKey("a key"); - relationshipData.setRelationshipValue("a value"); - - assertEquals("a key", relationshipData.getRelationshipKey()); - assertEquals("a value", relationshipData.getRelationshipValue()); - } - -} diff --git a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipListTest.java b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipListTest.java deleted file mode 100644 index 2104c1898..000000000 --- a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipListTest.java +++ /dev/null @@ -1,67 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= -*/ - -package org.onap.policy.aai; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -import java.io.File; -import java.nio.file.Files; -import java.util.LinkedList; -import java.util.List; -import org.junit.Test; -import org.onap.policy.aai.util.Serialization; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class RelationshipListTest { - private static final Logger logger = LoggerFactory.getLogger(RelationshipListTest.class); - - @Test - public void test() throws Exception { - // deserialize json and verify fields are populated properly - String json = new String(Files.readAllBytes( - new File("src/test/resources/org/onap/policy/aai/RelationshipList.json").toPath())); - - RelationshipList relationshipList = Serialization.gsonPretty.fromJson(json, RelationshipList.class); - - List<Relationship> lst = relationshipList.getRelationships(); - assertNotNull(lst); - assertEquals(3, lst.size()); - - // don't need to verify this in depth, as it has its own tests that do that - assertEquals("generic-vnf", lst.get(0).getRelatedTo()); - assertEquals("image", lst.get(1).getRelatedTo()); - assertEquals("flavor", lst.get(2).getRelatedTo()); - - logger.info(Serialization.gsonPretty.toJson(relationshipList)); - - // verify that setXxx methods work - lst = new LinkedList<>(); - lst.add(new Relationship()); - lst.add(new Relationship()); - - relationshipList.setRelationships(lst); - assertEquals(lst, relationshipList.getRelationships()); - } - -} diff --git a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipTest.java b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipTest.java deleted file mode 100644 index acc6243d6..000000000 --- a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipTest.java +++ /dev/null @@ -1,89 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= -*/ - -package org.onap.policy.aai; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -import java.io.File; -import java.nio.file.Files; -import java.util.LinkedList; -import java.util.List; -import org.junit.Test; -import org.onap.policy.aai.util.Serialization; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class RelationshipTest { - private static final Logger logger = LoggerFactory.getLogger(RelationshipTest.class); - - @Test - public void test() throws Exception { - // deserialize json and verify fields are populated properly - String json = new String(Files - .readAllBytes(new File("src/test/resources/org/onap/policy/aai/Relationship.json").toPath())); - - Relationship relationship = Serialization.gsonPretty.fromJson(json, Relationship.class); - - assertEquals("/aai/v11/network/generic-vnfs/generic-vnf/807a3f02-f878-436b-870c-f0e91e81570d", - relationship.getRelatedLink()); - assertEquals("generic-vnf", relationship.getRelatedTo()); - - // don't need to verify this in depth, as it has its own tests that do that - List<RelatedToProperty> relatedToProperty = relationship.getRelatedToProperty(); - assertNotNull(relatedToProperty); - assertEquals(2, relatedToProperty.size()); - assertEquals("vLoadBalancerMS-Vnf-0809-1", relatedToProperty.get(0).getPropertyValue()); - assertEquals("vLoadBalancerMS-Vnf-0809-2", relatedToProperty.get(1).getPropertyValue()); - - // don't need to verify this in depth, as it has its own tests that do that - List<RelationshipData> relationshipData = relationship.getRelationshipData(); - assertNotNull(relationshipData); - assertEquals(2, relationshipData.size()); - assertEquals("807a3f02-f878-436b-870c-f0e91e81570d", relationshipData.get(0).getRelationshipValue()); - assertEquals("907a3f02-f878-436b-870c-f0e91e81570e", relationshipData.get(1).getRelationshipValue()); - - logger.info(Serialization.gsonPretty.toJson(relationship)); - - // verify that setXxx methods work - relatedToProperty = new LinkedList<>(); - relatedToProperty.add(new RelatedToProperty()); - relatedToProperty.add(new RelatedToProperty()); - relatedToProperty.add(new RelatedToProperty()); - - relationshipData = new LinkedList<>(); - relationshipData.add(new RelationshipData()); - relationshipData.add(new RelationshipData()); - relationshipData.add(new RelationshipData()); - - relationship.setRelatedLink("related-link"); - relationship.setRelatedTo("related-to"); - relationship.setRelatedToProperty(relatedToProperty); - relationship.setRelationshipData(relationshipData); - - assertEquals("related-link", relationship.getRelatedLink()); - assertEquals("related-to", relationship.getRelatedTo()); - assertEquals(relatedToProperty, relationship.getRelatedToProperty()); - assertEquals(relationshipData, relationship.getRelationshipData()); - } - -} diff --git a/models-interactions/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/AppcLcmCommonHeader.java b/models-interactions/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/AppcLcmCommonHeader.java index 33a3c1f23..363ea35a5 100644 --- a/models-interactions/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/AppcLcmCommonHeader.java +++ b/models-interactions/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/AppcLcmCommonHeader.java @@ -71,6 +71,7 @@ public class AppcLcmCommonHeader implements Serializable { this.originatorId = commonHeader.originatorId; this.requestId = commonHeader.requestId; this.subRequestId = commonHeader.subRequestId; + this.timeStamp = commonHeader.timeStamp; if (commonHeader.flags != null) { this.flags.putAll(commonHeader.flags); } |