Fix file formatting issues 97/69097/2 1.3.1
authormark.j.leonard <mark.j.leonard@gmail.com>
Wed, 26 Sep 2018 11:30:56 +0000 (12:30 +0100)
committermark.j.leonard <mark.j.leonard@gmail.com>
Wed, 26 Sep 2018 13:38:06 +0000 (14:38 +0100)
Remove UTF-8 BOMs from the Java files and reformat License headers where
necessary (to conform with the License.txt content).

Change-Id: I74219db814ffc9b51dbf7273cbfde5847ff50ad3
Issue-ID: AAI-1650
Signed-off-by: mark.j.leonard <mark.j.leonard@gmail.com>
20 files changed:
pom.xml
src/main/java/org/onap/aai/sa/auth/SearchDbServiceAuthCore.java
src/main/java/org/onap/aai/sa/rest/AnalyzerApi.java
src/main/java/org/onap/aai/sa/rest/ApiUtils.java
src/main/java/org/onap/aai/sa/rest/BulkApi.java
src/main/java/org/onap/aai/sa/rest/DocumentApi.java
src/main/java/org/onap/aai/sa/rest/IndexApi.java
src/main/java/org/onap/aai/sa/rest/SearchServiceApi.java
src/main/java/org/onap/aai/sa/searchdbabstraction/searchapi/AbstractAggregation.java
src/main/java/org/onap/aai/sa/searchdbabstraction/service/SearchService.java
src/main/java/org/onap/aai/sa/searchdbabstraction/util/AggregationParsingUtil.java
src/main/java/org/onap/aai/sa/searchdbabstraction/util/DocumentSchemaUtil.java
src/main/java/org/onap/aai/sa/searchdbabstraction/util/SearchDbConstants.java
src/test/java/org/onap/aai/sa/rest/ApiUtilsTest.java
src/test/java/org/onap/aai/sa/rest/BulkApiTest.java
src/test/java/org/onap/aai/sa/rest/DocumentApiTest.java
src/test/java/org/onap/aai/sa/rest/TestUtils.java
src/test/java/org/onap/aai/sa/searchdbabstraction/elasticsearch/dao/ElasticSearchHttpControllerTest.java
src/test/java/org/onap/aai/sa/searchdbabstraction/searchapi/QueryTest.java
src/test/java/org/onap/aai/sa/searchdbabstraction/searchapi/RangeQueryTest.java

diff --git a/pom.xml b/pom.xml
index 4711142..5cba315 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -1,24 +1,25 @@
 <!--
-============LICENSE_START=======================================================
-org.onap.aai
-================================================================================
-Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
-Copyright © 2017-2018 Amdocs
-================================================================================
-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=========================================================
--->
 
+    ============LICENSE_START=======================================================
+    org.onap.aai
+    ================================================================================
+    Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
+    Copyright © 2017-2018 Amdocs
+    ================================================================================
+    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=========================================================
+
+-->
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
     <modelVersion>4.0.0</modelVersion>
@@ -375,14 +376,16 @@ limitations under the License.
                     <includes>
                         <include>src/main/java/**</include>
                         <include>src/test/java/**</include>
+                        <include>pom.xml</include>
                     </includes>
+                    <skipExistingHeaders>true</skipExistingHeaders>
                 </configuration>
                 <executions>
                     <execution>
                         <goals>
-                            <goal>format</goal>
+                            <goal>check</goal>
                         </goals>
-                        <phase>process-sources</phase>
+                        <phase>validate</phase>
                     </execution>
                 </executions>
             </plugin>
index 369caa1..5bab0c0 100644 (file)
@@ -1,4 +1,4 @@
-/**
+/**
  * ============LICENSE_START=======================================================
  * org.onap.aai
  * ================================================================================
index bf6f17c..3971920 100644 (file)
@@ -1,4 +1,4 @@
-/**
+/**
  * ============LICENSE_START=======================================================
  * org.onap.aai
  * ================================================================================
index f240561..db2fb93 100644 (file)
@@ -1,4 +1,4 @@
-/**
+/**
  * ============LICENSE_START=======================================================
  * org.onap.aai
  * ================================================================================
index 3a7b797..810f718 100644 (file)
@@ -1,4 +1,4 @@
-/**
+/**
  * ============LICENSE_START=======================================================
  * org.onap.aai
  * ================================================================================
@@ -39,7 +39,6 @@ import org.springframework.http.HttpStatus;
 import org.springframework.http.MediaType;
 import org.springframework.http.ResponseEntity;
 
-
 /**
  * This class encapsulates the REST end points associated with performing bulk operations against the document store.
  */
index 14d430e..da8be98 100644 (file)
@@ -1,4 +1,4 @@
-/**
+/**
  * ============LICENSE_START=======================================================
  * org.onap.aai
  * ================================================================================
index 7d58fb3..04fbcf3 100644 (file)
@@ -1,4 +1,4 @@
-/**
+/**
  * ============LICENSE_START=======================================================
  * org.onap.aai
  * ================================================================================
@@ -42,7 +42,6 @@ import org.springframework.http.ResponseEntity;
  */
 public class IndexApi {
 
-
     private static final String UNKNOWN_LOG_FIELD_STR = "Unknown";
     private static final String MSG_UNEXPECTED_AUTHENTICATION_FAILURE_CAUSE =
             "Unexpected authentication failure - cause: ";
index 776e72b..5247baa 100644 (file)
@@ -1,4 +1,4 @@
-/**
+/**
  * ============LICENSE_START=======================================================
  * org.onap.aai
  * ================================================================================
index 46d6fa1..29be5ea 100644 (file)
@@ -1,4 +1,4 @@
-/**
+/**
  * ============LICENSE_START=======================================================
  * org.onap.aai
  * ================================================================================
@@ -22,55 +22,54 @@ package org.onap.aai.sa.searchdbabstraction.searchapi;
 
 import com.fasterxml.jackson.annotation.JsonProperty;
 
-
 /**
  * This is the common parent from which all aggregation types inherit. It defines the common fields that all
  * aggregations must include.
  */
 public abstract class AbstractAggregation {
 
-  /**
-   * The name of the field to apply the aggregation against.
-   */
-  protected String field;
+    /**
+     * The name of the field to apply the aggregation against.
+     */
+    protected String field;
 
-  /**
+    /**
      * Optionally allows the number of buckets for the aggregation to be specified.
-   */
-  protected Integer size;
+     */
+    protected Integer size;
 
-  /**
+    /**
      * Optionally sets the minimum number of matches that must occur before a particular bucket is included in the
      * aggregation result.
-   */
-  @JsonProperty("min-threshold")
-  protected Integer minThreshold;
+     */
+    @JsonProperty("min-threshold")
+    protected Integer minThreshold;
 
 
-  public String getField() {
-    return field;
-  }
+    public String getField() {
+        return field;
+    }
 
-  public void setField(String field) {
-    this.field = field;
-  }
+    public void setField(String field) {
+        this.field = field;
+    }
 
-  public Integer getSize() {
-    return size;
-  }
+    public Integer getSize() {
+        return size;
+    }
 
-  public void setSize(Integer size) {
-    this.size = size;
-  }
+    public void setSize(Integer size) {
+        this.size = size;
+    }
 
-  public Integer getMinThreshold() {
-    return minThreshold;
-  }
+    public Integer getMinThreshold() {
+        return minThreshold;
+    }
 
-  public void setMinThreshold(Integer minThreshold) {
-    this.minThreshold = minThreshold;
-  }
+    public void setMinThreshold(Integer minThreshold) {
+        this.minThreshold = minThreshold;
+    }
 
-  public abstract String toElasticSearch();
+    public abstract String toElasticSearch();
 
 }
index a35062b..3c4110b 100644 (file)
@@ -1,4 +1,4 @@
-/**
+/**
  * ============LICENSE_START=======================================================
  * org.onap.aai
  * ================================================================================
index 20fd027..b48588f 100644 (file)
@@ -1,4 +1,4 @@
-/**
+/**
  * ============LICENSE_START=======================================================
  * org.onap.aai
  * ================================================================================
index 1627ae2..ebc7ae9 100644 (file)
@@ -1,4 +1,4 @@
-/**
+/**
  * ============LICENSE_START=======================================================
  * org.onap.aai
  * ================================================================================
index 561f604..3ffcefc 100644 (file)
@@ -1,4 +1,4 @@
-/**
+/**
  * ============LICENSE_START=======================================================
  * org.onap.aai
  * ================================================================================
index f205fa8..df6ed0e 100644 (file)
@@ -1,4 +1,4 @@
-/**
+/**
  * ============LICENSE_START=======================================================
  * org.onap.aai
  * ================================================================================
index 23071eb..fcc5b77 100644 (file)
@@ -1,4 +1,4 @@
-/**
+/**
  * ============LICENSE_START=======================================================
  * org.onap.aai
  * ================================================================================
@@ -20,7 +20,6 @@
  */
 package org.onap.aai.sa.rest;
 
-
 import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
 import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
 
index dd1ad2f..865f981 100644 (file)
@@ -1,4 +1,4 @@
-/**
+/**
  * ============LICENSE_START=======================================================
  * org.onap.aai
  * ================================================================================
index e990438..0d2c615 100644 (file)
@@ -18,6 +18,7 @@
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
+
 package org.onap.aai.sa.rest;
 
 import static org.junit.Assert.fail;
index e229348..1f4887f 100644 (file)
@@ -1,4 +1,4 @@
-/**
+/**
  * ============LICENSE_START=======================================================
  * org.onap.aai
  * ================================================================================
@@ -29,185 +29,184 @@ import com.fasterxml.jackson.databind.ObjectMapper;
 import java.io.IOException;
 import org.junit.Test;
 
-
 public class QueryTest {
 
-  /**
+    /**
      * This test validates that we are able to marshal json structures representing term queries into POJOs and that we
      * can then unmarshal those POJOs into ElasticSearch syntax.
-   *
-   * @throws JsonParseException
-   * @throws JsonMappingException
-   * @throws IOException
-   */
-  @Test
-  public void termQueryTest() throws JsonParseException, JsonMappingException, IOException {
+     *
+     * @throws JsonParseException
+     * @throws JsonMappingException
+     * @throws IOException
+     */
+    @Test
+    public void termQueryTest() throws JsonParseException, JsonMappingException, IOException {
 
-    Integer intValue = 1;
-    String field = "searchTags";
-    String termQueryWithIntegerValueJson = "{\"field\": \"" + field + "\", \"value\": " + intValue + "}";
-    String termQueryWithIntegerValueExpectedES = "{\"term\": {\"" + field + "\" : " + intValue + "}}";
+        Integer intValue = 1;
+        String field = "searchTags";
+        String termQueryWithIntegerValueJson = "{\"field\": \"" + field + "\", \"value\": " + intValue + "}";
+        String termQueryWithIntegerValueExpectedES = "{\"term\": {\"" + field + "\" : " + intValue + "}}";
 
-    Double doubleValue = 5.7;
-    String termQueryWithDoubleValueJson = "{\"field\": \"" + field + "\", \"value\": " + doubleValue + "}";
-    String termQueryWithDoubleValueExpectedES = "{\"term\": {\"" + field + "\" : " + doubleValue + "}}";
+        Double doubleValue = 5.7;
+        String termQueryWithDoubleValueJson = "{\"field\": \"" + field + "\", \"value\": " + doubleValue + "}";
+        String termQueryWithDoubleValueExpectedES = "{\"term\": {\"" + field + "\" : " + doubleValue + "}}";
 
-    String stringValue = "theValue";
-    String termQueryWithStringValueJson = "{\"field\": \"" + field + "\", \"value\": \"" + stringValue + "\"}";
-    String termQueryWithStringValueExpectedES = "{\"term\": {\"" + field + "\" : \"" + stringValue + "\"}}";
+        String stringValue = "theValue";
+        String termQueryWithStringValueJson = "{\"field\": \"" + field + "\", \"value\": \"" + stringValue + "\"}";
+        String termQueryWithStringValueExpectedES = "{\"term\": {\"" + field + "\" : \"" + stringValue + "\"}}";
 
-    ObjectMapper mapper = new ObjectMapper();
+        ObjectMapper mapper = new ObjectMapper();
 
 
-    // Validate that we can marshal a term query where the supplied value
-    // is an Integer.
-    TermQuery integerTermQuery = mapper.readValue(termQueryWithIntegerValueJson, TermQuery.class);
+        // Validate that we can marshal a term query where the supplied value
+        // is an Integer.
+        TermQuery integerTermQuery = mapper.readValue(termQueryWithIntegerValueJson, TermQuery.class);
         assertTrue(
                 "Expected value to be of type Integer, but was type "
                         + integerTermQuery.getValue().getClass().getName(),
-        integerTermQuery.getValue() instanceof Integer);
-    assertEquals(intValue, integerTermQuery.getValue());
+                integerTermQuery.getValue() instanceof Integer);
+        assertEquals(intValue, integerTermQuery.getValue());
 
-    assertTrue("ElasticSearch term query translation does not match the expected result",
-        termQueryWithIntegerValueExpectedES.equals(integerTermQuery.toElasticSearch()));
+        assertTrue("ElasticSearch term query translation does not match the expected result",
+                termQueryWithIntegerValueExpectedES.equals(integerTermQuery.toElasticSearch()));
 
-    // Validate that we can marshal a term query where the supplied value
-    // is a Double.
-    TermQuery doubleTermQuery = mapper.readValue(termQueryWithDoubleValueJson, TermQuery.class);
+        // Validate that we can marshal a term query where the supplied value
+        // is a Double.
+        TermQuery doubleTermQuery = mapper.readValue(termQueryWithDoubleValueJson, TermQuery.class);
         assertTrue(
                 "Expected value to be of type Double, but was type " + doubleTermQuery.getValue().getClass().getName(),
-        doubleTermQuery.getValue() instanceof Double);
-    assertEquals(doubleValue, doubleTermQuery.getValue());
-    assertTrue("ElasticSearch term query translation does not match the expected result",
-        termQueryWithDoubleValueExpectedES.equals(doubleTermQuery.toElasticSearch()));
-
-    // Validate that we can marshal a term query where the supplied value
-    // is a String literal.
-    TermQuery stringTermQuery = mapper.readValue(termQueryWithStringValueJson, TermQuery.class);
+                doubleTermQuery.getValue() instanceof Double);
+        assertEquals(doubleValue, doubleTermQuery.getValue());
+        assertTrue("ElasticSearch term query translation does not match the expected result",
+                termQueryWithDoubleValueExpectedES.equals(doubleTermQuery.toElasticSearch()));
+
+        // Validate that we can marshal a term query where the supplied value
+        // is a String literal.
+        TermQuery stringTermQuery = mapper.readValue(termQueryWithStringValueJson, TermQuery.class);
         assertTrue(
                 "Expected value to be of type String, but was type " + stringTermQuery.getValue().getClass().getName(),
-        stringTermQuery.getValue() instanceof String);
-    assertEquals(stringValue, stringTermQuery.getValue());
-    assertTrue("ElasticSearch term query translation does not match the expected result",
-        termQueryWithStringValueExpectedES.equals(stringTermQuery.toElasticSearch()));
+                stringTermQuery.getValue() instanceof String);
+        assertEquals(stringValue, stringTermQuery.getValue());
+        assertTrue("ElasticSearch term query translation does not match the expected result",
+                termQueryWithStringValueExpectedES.equals(stringTermQuery.toElasticSearch()));
 
 
-  }
+    }
 
 
-  /**
+    /**
      * This test validates that we are able to marshal json structures representing parsed queries into POJOs and that
      * we can then unmarshal those POJOs into ElasticSearch syntax.
-   *
-   * @throws JsonParseException
-   * @throws JsonMappingException
-   * @throws IOException
-   */
-  @Test
-  public void parsedQueryTest() throws JsonParseException, JsonMappingException, IOException {
-
-    String field = "fieldname";
-    String queryString = "The query string";
-
-    String queryJson = "{\"field\": \"" + field + "\", \"query-string\": \"" + queryString + "\"}";
+     *
+     * @throws JsonParseException
+     * @throws JsonMappingException
+     * @throws IOException
+     */
+    @Test
+    public void parsedQueryTest() throws JsonParseException, JsonMappingException, IOException {
+
+        String field = "fieldname";
+        String queryString = "The query string";
+
+        String queryJson = "{\"field\": \"" + field + "\", \"query-string\": \"" + queryString + "\"}";
         String queryExpectedES =
                 "{\"query_string\": {\"default_field\": \"" + field + "\", \"query\": \"" + queryString + "\"}}";
 
-    ObjectMapper mapper = new ObjectMapper();
-    ParsedQuery pq = mapper.readValue(queryJson, ParsedQuery.class);
+        ObjectMapper mapper = new ObjectMapper();
+        ParsedQuery pq = mapper.readValue(queryJson, ParsedQuery.class);
 
-    assertTrue("Unexpected marshalled value for 'field' - expected: " + field + " actual: " + pq.getField(),
-        field.equals(pq.getField()));
+        assertTrue("Unexpected marshalled value for 'field' - expected: " + field + " actual: " + pq.getField(),
+                field.equals(pq.getField()));
         assertTrue("Unexpected marshalled value for 'query-string' - expected: " + queryString + " actual: "
                 + pq.getQueryString(), queryString.equals(pq.getQueryString()));
         assertTrue(
                 "Unexpected ElasticSearch syntax.  Expected: " + queryExpectedES + " Actual: " + pq.toElasticSearch(),
-        queryExpectedES.equals(pq.toElasticSearch()));
-  }
+                queryExpectedES.equals(pq.toElasticSearch()));
+    }
 
 
-  /**
+    /**
      * This test validates that a ranged query cannot be parsed with values for both the 'gte' and 'gt' fields or the
      * 'lte' and 'lt' fields, and that we do not allow mixing of numeric and date types in the same query.
-   *
-   * @throws JsonParseException
-   * @throws IOException
-   */
-  @Test
-  public void rangeQueryConflictingBoundsTest() throws JsonParseException, IOException {
+     *
+     * @throws JsonParseException
+     * @throws IOException
+     */
+    @Test
+    public void rangeQueryConflictingBoundsTest() throws JsonParseException, IOException {
 
         String invalidGTAndGTE =
                 "{ \"field\": \"timestamp\", \"gte\": \"2016-10-06T00:00:00.558+03:00\", \"gt\": \"2016-10-06T23:59:59.558+03:00\"}";
         String invalidLTAndLTE =
                 "{ \"field\": \"timestamp\", \"lte\": \"2016-10-06T00:00:00.558+03:00\", \"lt\": \"2016-10-06T23:59:59.558+03:00\"}";
-    String invalidTypes = "{ \"field\": \"timestamp\", \"lte\": 5, \"gte\": \"2016-10-06T23:59:59.558+03:00\"}";
+        String invalidTypes = "{ \"field\": \"timestamp\", \"lte\": 5, \"gte\": \"2016-10-06T23:59:59.558+03:00\"}";
 
-    ObjectMapper mapper = new ObjectMapper();
+        ObjectMapper mapper = new ObjectMapper();
 
-    // Attempt to parse a query where we are setting values for both the
-    // 'greater than' and 'greater than and equal to' operators.
-    boolean gotExpectedException = false;
-    try {
+        // Attempt to parse a query where we are setting values for both the
+        // 'greater than' and 'greater than and equal to' operators.
+        boolean gotExpectedException = false;
+        try {
             mapper.readValue(invalidGTAndGTE, RangeQuery.class);
-    } catch (JsonMappingException e) {
-      gotExpectedException = true;
-    }
-    assertTrue("Attempting to set both a 'gt' and 'gte' value on the same query should not have been allowed",
-        gotExpectedException);
-
-    // Attempt to parse a query where we are setting values for both the
-    // 'less than' and 'less than and equal to' operators.
-    gotExpectedException = false;
-    try {
+        } catch (JsonMappingException e) {
+            gotExpectedException = true;
+        }
+        assertTrue("Attempting to set both a 'gt' and 'gte' value on the same query should not have been allowed",
+                gotExpectedException);
+
+        // Attempt to parse a query where we are setting values for both the
+        // 'less than' and 'less than and equal to' operators.
+        gotExpectedException = false;
+        try {
             mapper.readValue(invalidLTAndLTE, RangeQuery.class);
-    } catch (JsonMappingException e) {
-      gotExpectedException = true;
-    }
-    assertTrue("Attempting to set both a 'lt' and 'lte' value on the same query should not have been allowed",
-        gotExpectedException);
-
-    // Attempt to parse a query where we are mixing numeric and date values
-    // in the same query.
-    gotExpectedException = false;
-    try {
+        } catch (JsonMappingException e) {
+            gotExpectedException = true;
+        }
+        assertTrue("Attempting to set both a 'lt' and 'lte' value on the same query should not have been allowed",
+                gotExpectedException);
+
+        // Attempt to parse a query where we are mixing numeric and date values
+        // in the same query.
+        gotExpectedException = false;
+        try {
             mapper.readValue(invalidTypes, RangeQuery.class);
-    } catch (JsonMappingException e) {
-      gotExpectedException = true;
-    }
-    assertTrue("Attempting to mix numeric and date values in the same query should not have been allowed",
-        gotExpectedException);
+        } catch (JsonMappingException e) {
+            gotExpectedException = true;
+        }
+        assertTrue("Attempting to mix numeric and date values in the same query should not have been allowed",
+                gotExpectedException);
 
 
-  }
+    }
 
 
-  /**
+    /**
      * This test validates that date range queries can be marshalled to a Java POJO and unmarshalled to ElasticSearch
      * syntax.
-   *
-   * @throws JsonParseException
-   * @throws JsonMappingException
-   * @throws IOException
-   */
-  @Test
-  public void dateRangeQueryTest() throws JsonParseException, JsonMappingException, IOException {
-
-    String field = "timestamp";
-    String greaterThanDate = "2016-10-06T00:00:00.558+03:00";
-    String lessThanDate = "2016-10-06T23:59:59.558+03:00";
-
-    ObjectMapper mapper = new ObjectMapper();
-
-    // Generate a date range query using 'greater than or equal' and 'less
-    // than or equal' operations.
+     *
+     * @throws JsonParseException
+     * @throws JsonMappingException
+     * @throws IOException
+     */
+    @Test
+    public void dateRangeQueryTest() throws JsonParseException, JsonMappingException, IOException {
+
+        String field = "timestamp";
+        String greaterThanDate = "2016-10-06T00:00:00.558+03:00";
+        String lessThanDate = "2016-10-06T23:59:59.558+03:00";
+
+        ObjectMapper mapper = new ObjectMapper();
+
+        // Generate a date range query using 'greater than or equal' and 'less
+        // than or equal' operations.
         String dateRangeJson = "{ \"field\": \"" + field + "\", \"gte\": \"" + greaterThanDate + "\", \"lte\": \""
                 + lessThanDate + "\"}";
-    String dateRangeExpectedES =
-        "{\"range\": {\"timestamp\": {\"gte\": \"2016-10-06T00:00:00.558+03:00\", \"lte\": \"2016-10-06T23:59:59.558+03:00\"}}}";
+        String dateRangeExpectedES =
+                "{\"range\": {\"timestamp\": {\"gte\": \"2016-10-06T00:00:00.558+03:00\", \"lte\": \"2016-10-06T23:59:59.558+03:00\"}}}";
 
-    // Validate that the query is marshalled correctly to the POJO and that
-    // the generated ElasticSearch syntax looks as expected.
-    RangeQuery dateRangeQuery = mapper.readValue(dateRangeJson, RangeQuery.class);
+        // Validate that the query is marshalled correctly to the POJO and that
+        // the generated ElasticSearch syntax looks as expected.
+        RangeQuery dateRangeQuery = mapper.readValue(dateRangeJson, RangeQuery.class);
 
         assertTrue("Unexpected marshalled value for 'field'.  Expected: " + field + " Actual: "
                 + dateRangeQuery.getField(), field.equals(dateRangeQuery.getField()));
@@ -222,19 +221,19 @@ public class QueryTest {
         assertTrue(
                 "Unexpected ElasticSearch syntax.  Expected: " + dateRangeExpectedES + " Actual: "
                         + dateRangeQuery.toElasticSearch(),
-        dateRangeExpectedES.equals(dateRangeQuery.toElasticSearch()));
+                dateRangeExpectedES.equals(dateRangeQuery.toElasticSearch()));
 
 
-    // Generate a date range query using 'greater than' and 'less than or
-    // equal' operations.
+        // Generate a date range query using 'greater than' and 'less than or
+        // equal' operations.
         dateRangeJson = "{ \"field\": \"" + field + "\", \"gt\": \"" + greaterThanDate + "\", \"lte\": \""
                 + lessThanDate + "\"}";
-    dateRangeExpectedES =
-        "{\"range\": {\"timestamp\": {\"gt\": \"2016-10-06T00:00:00.558+03:00\", \"lte\": \"2016-10-06T23:59:59.558+03:00\"}}}";
+        dateRangeExpectedES =
+                "{\"range\": {\"timestamp\": {\"gt\": \"2016-10-06T00:00:00.558+03:00\", \"lte\": \"2016-10-06T23:59:59.558+03:00\"}}}";
 
-    // Validate that the query is marshalled correctly to the POJO and that
-    // the generated ElasticSearch syntax looks as expected.
-    dateRangeQuery = mapper.readValue(dateRangeJson, RangeQuery.class);
+        // Validate that the query is marshalled correctly to the POJO and that
+        // the generated ElasticSearch syntax looks as expected.
+        dateRangeQuery = mapper.readValue(dateRangeJson, RangeQuery.class);
 
         assertTrue("Unexpected marshalled value for 'field'.  Expected: " + field + " Actual: "
                 + dateRangeQuery.getField(), field.equals(dateRangeQuery.getField()));
@@ -254,16 +253,16 @@ public class QueryTest {
         assertTrue(
                 "Unexpected ElasticSearch syntax.  Expected: " + dateRangeExpectedES + " Actual: "
                         + dateRangeQuery.toElasticSearch(),
-        dateRangeExpectedES.equals(dateRangeQuery.toElasticSearch()));
+                dateRangeExpectedES.equals(dateRangeQuery.toElasticSearch()));
 
 
-    // Generate a date range query using only a 'greater than' operation.
+        // Generate a date range query using only a 'greater than' operation.
         dateRangeJson = "{ \"field\": \"" + field + "\", \"gt\": \"" + greaterThanDate + "\"}";
         dateRangeExpectedES = "{\"range\": {\"timestamp\": {\"gt\": \"2016-10-06T00:00:00.558+03:00\"}}}";
 
-    // Validate that the query is marshalled correctly to the POJO and that
-    // the generated ElasticSearch syntax looks as expected.
-    dateRangeQuery = mapper.readValue(dateRangeJson, RangeQuery.class);
+        // Validate that the query is marshalled correctly to the POJO and that
+        // the generated ElasticSearch syntax looks as expected.
+        dateRangeQuery = mapper.readValue(dateRangeJson, RangeQuery.class);
 
         assertTrue("Unexpected marshalled value for 'field'.  Expected: " + field + " Actual: "
                 + dateRangeQuery.getField(), field.equals(dateRangeQuery.getField()));
@@ -277,48 +276,48 @@ public class QueryTest {
         assertTrue(
                 "Unexpected ElasticSearch syntax.  Expected: " + dateRangeExpectedES + " Actual: "
                         + dateRangeQuery.toElasticSearch(),
-        dateRangeExpectedES.equals(dateRangeQuery.toElasticSearch()));
+                dateRangeExpectedES.equals(dateRangeQuery.toElasticSearch()));
 
-  }
+    }
 
-  /**
+    /**
      * This test validates that numeric range queries can be marshalled to a Java POJO and unmarshalled to ElasticSearch
      * syntax.
-   *
-   * @throws JsonParseException
-   * @throws JsonMappingException
-   * @throws IOException
-   */
-  @Test
-  public void numericRangeQueryTest() throws JsonParseException, JsonMappingException, IOException {
-
-    String field = "version";
-    Integer greaterThanInt = 5;
-    Integer lessThanInt = 100;
-
-    ObjectMapper mapper = new ObjectMapper();
-
-    // Generate a numeric range query using 'greater than or equal' and 'less
-    // than or equal' operations.
-    String numericRangeJson =
-        "{ \"field\": \"" + field + "\", \"gte\": " + greaterThanInt + ", \"lte\": " + lessThanInt + "}";
-    String numericRangeExpectedES =
-        "{\"range\": {\"" + field + "\": {\"gte\": " + greaterThanInt + ", \"lte\": " + lessThanInt + "}}}";
-
-    // Validate that the query is marshalled correctly to the POJO and that
-    // the generated ElasticSearch syntax looks as expected.
-    RangeQuery numericRangeQuery = mapper.readValue(numericRangeJson, RangeQuery.class);
+     *
+     * @throws JsonParseException
+     * @throws JsonMappingException
+     * @throws IOException
+     */
+    @Test
+    public void numericRangeQueryTest() throws JsonParseException, JsonMappingException, IOException {
+
+        String field = "version";
+        Integer greaterThanInt = 5;
+        Integer lessThanInt = 100;
+
+        ObjectMapper mapper = new ObjectMapper();
+
+        // Generate a numeric range query using 'greater than or equal' and 'less
+        // than or equal' operations.
+        String numericRangeJson =
+                "{ \"field\": \"" + field + "\", \"gte\": " + greaterThanInt + ", \"lte\": " + lessThanInt + "}";
+        String numericRangeExpectedES =
+                "{\"range\": {\"" + field + "\": {\"gte\": " + greaterThanInt + ", \"lte\": " + lessThanInt + "}}}";
+
+        // Validate that the query is marshalled correctly to the POJO and that
+        // the generated ElasticSearch syntax looks as expected.
+        RangeQuery numericRangeQuery = mapper.readValue(numericRangeJson, RangeQuery.class);
 
         assertTrue("Unexpected marshalled value for 'field'.  Expected: " + field + " Actual: "
                 + numericRangeQuery.getField(), field.equals(numericRangeQuery.getField()));
         assertTrue(
                 "Unexpected type for 'gte' value.  Expected: Integer  Actual: "
                         + numericRangeQuery.getGte().getClass().getName(),
-        numericRangeQuery.getGte() instanceof Integer);
+                numericRangeQuery.getGte() instanceof Integer);
         assertTrue(
                 "Unexpected type for 'lte' value.  Expected: Integer  Actual: "
                         + numericRangeQuery.getLte().getClass().getName(),
-        numericRangeQuery.getLte() instanceof Integer);
+                numericRangeQuery.getLte() instanceof Integer);
         assertEquals("Unexpected marshalled value for 'gte'.  Expected: " + greaterThanInt + " Actual: "
                 + numericRangeQuery.getGte(), greaterThanInt, numericRangeQuery.getGte());
         assertEquals("Unexpected marshalled value for 'lte'.  Expected: " + lessThanInt + " Actual: "
@@ -326,22 +325,22 @@ public class QueryTest {
         assertTrue(
                 "Unexpected ElasticSearch syntax.  Expected: " + numericRangeExpectedES + " Actual: "
                         + numericRangeQuery.toElasticSearch(),
-        numericRangeExpectedES.equals(numericRangeQuery.toElasticSearch()));
+                numericRangeExpectedES.equals(numericRangeQuery.toElasticSearch()));
 
 
-    Double greaterThanDouble = 5.0;
-    Double lessThanDouble = 100.0;
+        Double greaterThanDouble = 5.0;
+        Double lessThanDouble = 100.0;
 
-    // Generate a date range query using 'greater than' and 'less than or
-    // equal' operations.
-    numericRangeJson =
-        "{ \"field\": \"" + field + "\", \"gt\": " + greaterThanDouble + ", \"lte\": " + lessThanDouble + "}";
+        // Generate a date range query using 'greater than' and 'less than or
+        // equal' operations.
+        numericRangeJson =
+                "{ \"field\": \"" + field + "\", \"gt\": " + greaterThanDouble + ", \"lte\": " + lessThanDouble + "}";
         numericRangeExpectedES = "{\"range\": {\"" + field + "\": {\"gt\": " + greaterThanDouble + ", \"lte\": "
                 + lessThanDouble + "}}}";
 
-    // Validate that the query is marshalled correctly to the POJO and that
-    // the generated ElasticSearch syntax looks as expected.
-    numericRangeQuery = mapper.readValue(numericRangeJson, RangeQuery.class);
+        // Validate that the query is marshalled correctly to the POJO and that
+        // the generated ElasticSearch syntax looks as expected.
+        numericRangeQuery = mapper.readValue(numericRangeJson, RangeQuery.class);
 
         assertTrue("Unexpected marshalled value for 'field'.  Expected: " + field + " Actual: "
                 + numericRangeQuery.getField(), field.equals(numericRangeQuery.getField()));
@@ -352,7 +351,7 @@ public class QueryTest {
         assertTrue(
                 "Unexpected type for 'lte' value.  Expected: Double  Actual: "
                         + numericRangeQuery.getLte().getClass().getName(),
-        numericRangeQuery.getLte() instanceof Double);
+                numericRangeQuery.getLte() instanceof Double);
 
         assertEquals("Unexpected marshalled value for 'gt'.  Expected: " + greaterThanDouble + " Actual: "
                 + numericRangeQuery.getGt(), greaterThanDouble, numericRangeQuery.getGt());
@@ -363,7 +362,7 @@ public class QueryTest {
         assertTrue(
                 "Unexpected ElasticSearch syntax.  Expected: " + numericRangeExpectedES + " Actual: "
                         + numericRangeQuery.toElasticSearch(),
-        numericRangeExpectedES.equals(numericRangeQuery.toElasticSearch()));
-  }
+                numericRangeExpectedES.equals(numericRangeQuery.toElasticSearch()));
+    }
 
 }
index f048cee..e58e545 100644 (file)
@@ -1,4 +1,4 @@
-/**
+/**
  * ============LICENSE_START=======================================================
  * org.onap.aai
  * ================================================================================