2 * ============LICENSE_START=======================================================
3 * SPARKY (AAI UI service)
4 * ================================================================================
5 * Copyright © 2017 AT&T Intellectual Property.
6 * Copyright © 2017 Amdocs
8 * ================================================================================
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
20 * ============LICENSE_END=========================================================
22 * ECOMP and OpenECOMP are trademarks
23 * and service marks of AT&T Intellectual Property.
26 package org.onap.aai.sparky.inventory;
28 import static org.junit.Assert.assertFalse;
29 import static org.junit.Assert.assertTrue;
31 import org.junit.Before;
32 import org.junit.Test;
33 import org.junit.runner.RunWith;
34 import org.mockito.runners.MockitoJUnitRunner;
35 import org.onap.aai.sparky.inventory.entity.GeoIndexDocument;
38 * The Class GeoIndexDocumentTest.
40 @RunWith(MockitoJUnitRunner.class)
41 public class GeoIndexDocumentTest {
46 * @throws Exception the exception
49 public void init() throws Exception {}
52 * Checks if is valid geo index document success path.
55 public void isValidGeoIndexDocument_successPath() {
57 GeoIndexDocument geoDoc = new GeoIndexDocument();
59 geoDoc.setEntityPrimaryKeyName("pkeyName");
60 geoDoc.setEntityPrimaryKeyValue("pkeyValue");
61 geoDoc.setEntityType("type");
62 geoDoc.setId("12312");
63 geoDoc.setLatitude("-45.123");
64 geoDoc.setLongitude("181.321");
65 geoDoc.setSelfLink("https://server.somewhere.com:8443/aai/v7/id");
67 assertTrue(geoDoc.isValidGeoDocument());
72 * Checks if is valid geo index document fail no geo coordinates.
75 public void isValidGeoIndexDocument_fail_no_geoCoordinates() {
77 GeoIndexDocument geoIndexDoc = new GeoIndexDocument();
79 geoIndexDoc.setEntityPrimaryKeyName("pkeyName");
80 geoIndexDoc.setEntityPrimaryKeyValue("pkeyValue");
81 geoIndexDoc.setEntityType("type");
82 geoIndexDoc.setId("12312");
83 geoIndexDoc.setSelfLink("https://server.somewhere.com:8443/aai/v7/id");
85 assertFalse(geoIndexDoc.isValidGeoDocument());
90 * Checks if is valid geo index document fail invalid geo coordinates.
93 public void isValidGeoIndexDocument_fail_invalid_geoCoordinates() {
95 GeoIndexDocument geoIndexDoc = new GeoIndexDocument();
97 geoIndexDoc.setEntityPrimaryKeyName("pkeyName");
98 geoIndexDoc.setEntityPrimaryKeyValue("pkeyValue");
99 geoIndexDoc.setEntityType("type");
100 geoIndexDoc.setId("12312");
101 geoIndexDoc.setLatitude("not_a_valid");
102 geoIndexDoc.setLongitude("geo point");
104 geoIndexDoc.setSelfLink("https://server.somewhere.com:8443/aai/v7/id");
106 assertFalse(geoIndexDoc.isValidGeoDocument());
111 * Checks if is valid geo index document fail nothing set.
114 public void isValidGeoIndexDocument_fail_nothing_set() {
116 GeoIndexDocument geoIndexDoc = new GeoIndexDocument();
118 assertFalse(geoIndexDoc.isValidGeoDocument());