diff options
author | 2018-09-21 16:16:04 +0100 | |
---|---|---|
committer | 2018-09-21 16:16:04 +0100 | |
commit | 15af66b115f3e8046b2d0f2634fb77b3d835f730 (patch) | |
tree | 9ed2889e541c0f24214becb6b82726e4bf8c319c /src/test/java/org/onap/aai/sa/searchdbabstraction/elasticsearch | |
parent | 71393bb2bf9fb10962723e61cf0e70d9aa202645 (diff) |
Format Java code to ONAP standard
Use the Eclipse formatter to automatically format the code to adhere
to the defined standards.
Change-Id: I42a8c90c5b272facc4cc2a0c85233061ed64ba3f
Issue-ID: AAI-1650
Signed-off-by: mark.j.leonard <mark.j.leonard@gmail.com>
Diffstat (limited to 'src/test/java/org/onap/aai/sa/searchdbabstraction/elasticsearch')
3 files changed, 64 insertions, 63 deletions
diff --git a/src/test/java/org/onap/aai/sa/searchdbabstraction/elasticsearch/config/ElasticSearchConfigTest.java b/src/test/java/org/onap/aai/sa/searchdbabstraction/elasticsearch/config/ElasticSearchConfigTest.java index 8c4de81..b976f17 100644 --- a/src/test/java/org/onap/aai/sa/searchdbabstraction/elasticsearch/config/ElasticSearchConfigTest.java +++ b/src/test/java/org/onap/aai/sa/searchdbabstraction/elasticsearch/config/ElasticSearchConfigTest.java @@ -26,23 +26,24 @@ import org.junit.Before; import org.junit.Ignore;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
+
public class ElasticSearchConfigTest {
@Autowired
ElasticSearchConfig elasticSearchConfig;
@Before
- public void setUp(){
+ public void setUp() {
Properties prop = new Properties();
prop.put("es.cluster-name", "cluster-1");
prop.put("es.ip-address", "127.0.0.1");
prop.put("es.http-port", "9001");
-// elasticSearchConfig = new ElasticSearchConfig(prop);
+ // elasticSearchConfig = new ElasticSearchConfig(prop);
}
@Ignore
@Test
- public void testAllGetMethods(){
+ public void testAllGetMethods() {
Assert.assertEquals(elasticSearchConfig.getClusterName(), "cluster-1");
Assert.assertEquals(elasticSearchConfig.getIpAddress(), "127.0.0.1");
Assert.assertEquals(elasticSearchConfig.getHttpPort(), "9001");
diff --git a/src/test/java/org/onap/aai/sa/searchdbabstraction/elasticsearch/dao/AggregationResponseParsingTest.java b/src/test/java/org/onap/aai/sa/searchdbabstraction/elasticsearch/dao/AggregationResponseParsingTest.java index 61e64f5..fbc077d 100644 --- a/src/test/java/org/onap/aai/sa/searchdbabstraction/elasticsearch/dao/AggregationResponseParsingTest.java +++ b/src/test/java/org/onap/aai/sa/searchdbabstraction/elasticsearch/dao/AggregationResponseParsingTest.java @@ -31,69 +31,69 @@ import org.onap.aai.sa.searchdbabstraction.util.AggregationParsingUtil; public class AggregationResponseParsingTest { - @Test - public void testParseAggregationResponse() { - JSONParser parser = new JSONParser(); - JSONObject root; + @Test + public void testParseAggregationResponse() { + JSONParser parser = new JSONParser(); + JSONObject root; - String input = - "{\r\n \"aggregations\": {\r\n \"violations\": {\r\n \"doc_count\": 2,\r\n \"by_Timestamp\": {\r\n \"doc_count_error_upper_bound\": 0,\r\n \"sum_other_doc_count\": 0,\r\n \"buckets\": [\r\n {\r\n \"key\": 7199992,\r\n \"key_as_string\": \"Jan 1 1970 01:59:59\",\r\n \"doc_count\": 2\r\n }\r\n ]\r\n }\r\n }\r\n }\r\n}"; + String input = + "{\r\n \"aggregations\": {\r\n \"violations\": {\r\n \"doc_count\": 2,\r\n \"by_Timestamp\": {\r\n \"doc_count_error_upper_bound\": 0,\r\n \"sum_other_doc_count\": 0,\r\n \"buckets\": [\r\n {\r\n \"key\": 7199992,\r\n \"key_as_string\": \"Jan 1 1970 01:59:59\",\r\n \"doc_count\": 2\r\n }\r\n ]\r\n }\r\n }\r\n }\r\n}"; - try { - root = (JSONObject) parser.parse(input); - JSONObject aggregations = (JSONObject) root.get("aggregations"); - AggregationResult[] results = AggregationParsingUtil.parseAggregationResults(aggregations); - AggregationResults aggs = new AggregationResults(); - ObjectMapper mapper = new ObjectMapper(); - aggs.setAggregations(results); - System.out.println(mapper.setSerializationInclusion(Include.NON_NULL) - .writerWithDefaultPrettyPrinter().writeValueAsString(aggs)); - } catch (Exception e) { - e.printStackTrace(); + try { + root = (JSONObject) parser.parse(input); + JSONObject aggregations = (JSONObject) root.get("aggregations"); + AggregationResult[] results = AggregationParsingUtil.parseAggregationResults(aggregations); + AggregationResults aggs = new AggregationResults(); + ObjectMapper mapper = new ObjectMapper(); + aggs.setAggregations(results); + System.out.println(mapper.setSerializationInclusion(Include.NON_NULL).writerWithDefaultPrettyPrinter() + .writeValueAsString(aggs)); + } catch (Exception e) { + e.printStackTrace(); + } } - } - @Test - public void testParseAggregationResponse2() { - JSONParser parser = new JSONParser(); - JSONObject root; + @Test + public void testParseAggregationResponse2() { + JSONParser parser = new JSONParser(); + JSONObject root; - String input = - "{\r\n \"aggregations\": {\r\n \"entityType\": {\r\n \"doc_count_error_upper_bound\": 0,\r\n \"sum_other_doc_count\": 0,\r\n \"buckets\": [\r\n {\r\n \"key\": \"entity1\",\r\n \"doc_count\": 5,\r\n \"byVersion\": {\r\n \"doc_count_error_upper_bound\": 0,\r\n \"sum_other_doc_count\": 0,\r\n \"buckets\": [\r\n {\r\n \"key\": \"0\",\r\n \"doc_count\": 5\r\n }\r\n ]\r\n }\r\n }\r\n ]\r\n }\r\n }\r\n}"; + String input = + "{\r\n \"aggregations\": {\r\n \"entityType\": {\r\n \"doc_count_error_upper_bound\": 0,\r\n \"sum_other_doc_count\": 0,\r\n \"buckets\": [\r\n {\r\n \"key\": \"entity1\",\r\n \"doc_count\": 5,\r\n \"byVersion\": {\r\n \"doc_count_error_upper_bound\": 0,\r\n \"sum_other_doc_count\": 0,\r\n \"buckets\": [\r\n {\r\n \"key\": \"0\",\r\n \"doc_count\": 5\r\n }\r\n ]\r\n }\r\n }\r\n ]\r\n }\r\n }\r\n}"; - try { - root = (JSONObject) parser.parse(input); - JSONObject aggregations = (JSONObject) root.get("aggregations"); - AggregationResult[] results = AggregationParsingUtil.parseAggregationResults(aggregations); - AggregationResults aggs = new AggregationResults(); - ObjectMapper mapper = new ObjectMapper(); - aggs.setAggregations(results); - System.out.println(mapper.setSerializationInclusion(Include.NON_NULL) - .writerWithDefaultPrettyPrinter().writeValueAsString(aggs)); - } catch (Exception e) { - e.printStackTrace(); + try { + root = (JSONObject) parser.parse(input); + JSONObject aggregations = (JSONObject) root.get("aggregations"); + AggregationResult[] results = AggregationParsingUtil.parseAggregationResults(aggregations); + AggregationResults aggs = new AggregationResults(); + ObjectMapper mapper = new ObjectMapper(); + aggs.setAggregations(results); + System.out.println(mapper.setSerializationInclusion(Include.NON_NULL).writerWithDefaultPrettyPrinter() + .writeValueAsString(aggs)); + } catch (Exception e) { + e.printStackTrace(); + } } - } - @Test - public void testParseAggregationResponse3() { - JSONParser parser = new JSONParser(); - JSONObject root; + @Test + public void testParseAggregationResponse3() { + JSONParser parser = new JSONParser(); + JSONObject root; - String input = - "{\r\n \"aggregations\": {\r\n \"validateTimes\": {\r\n \"buckets\": [\r\n {\r\n \"key\": \"Jan 10 2017 21:6:6-Jan 24 2017 13:43:5\",\r\n \"from\": 1484082366000,\r\n \"from_as_string\": \"Jan 10 2017 21:6:6\",\r\n \"to\": 1485265385000,\r\n \"to_as_string\": \"Jan 24 2017 13:43:5\",\r\n \"doc_count\": 95\r\n },\r\n {\r\n \"key\": \"Feb 3 2017 18:27:39-*\",\r\n \"from\": 1486146459000,\r\n \"from_as_string\": \"Feb 3 2017 18:27:39\",\r\n \"doc_count\": 2\r\n }\r\n ]\r\n }\r\n }\r\n}"; + String input = + "{\r\n \"aggregations\": {\r\n \"validateTimes\": {\r\n \"buckets\": [\r\n {\r\n \"key\": \"Jan 10 2017 21:6:6-Jan 24 2017 13:43:5\",\r\n \"from\": 1484082366000,\r\n \"from_as_string\": \"Jan 10 2017 21:6:6\",\r\n \"to\": 1485265385000,\r\n \"to_as_string\": \"Jan 24 2017 13:43:5\",\r\n \"doc_count\": 95\r\n },\r\n {\r\n \"key\": \"Feb 3 2017 18:27:39-*\",\r\n \"from\": 1486146459000,\r\n \"from_as_string\": \"Feb 3 2017 18:27:39\",\r\n \"doc_count\": 2\r\n }\r\n ]\r\n }\r\n }\r\n}"; - try { - root = (JSONObject) parser.parse(input); - JSONObject aggregations = (JSONObject) root.get("aggregations"); - AggregationResult[] results = AggregationParsingUtil.parseAggregationResults(aggregations); - AggregationResults aggs = new AggregationResults(); - ObjectMapper mapper = new ObjectMapper(); - aggs.setAggregations(results); - System.out.println(mapper.setSerializationInclusion(Include.NON_NULL) - .writerWithDefaultPrettyPrinter().writeValueAsString(aggs)); - } catch (Exception e) { - e.printStackTrace(); + try { + root = (JSONObject) parser.parse(input); + JSONObject aggregations = (JSONObject) root.get("aggregations"); + AggregationResult[] results = AggregationParsingUtil.parseAggregationResults(aggregations); + AggregationResults aggs = new AggregationResults(); + ObjectMapper mapper = new ObjectMapper(); + aggs.setAggregations(results); + System.out.println(mapper.setSerializationInclusion(Include.NON_NULL).writerWithDefaultPrettyPrinter() + .writeValueAsString(aggs)); + } catch (Exception e) { + e.printStackTrace(); + } } - } } diff --git a/src/test/java/org/onap/aai/sa/searchdbabstraction/elasticsearch/dao/ElasticSearchResultItemTest.java b/src/test/java/org/onap/aai/sa/searchdbabstraction/elasticsearch/dao/ElasticSearchResultItemTest.java index 89e75cd..43203c9 100644 --- a/src/test/java/org/onap/aai/sa/searchdbabstraction/elasticsearch/dao/ElasticSearchResultItemTest.java +++ b/src/test/java/org/onap/aai/sa/searchdbabstraction/elasticsearch/dao/ElasticSearchResultItemTest.java @@ -26,7 +26,7 @@ import org.junit.Test; public class ElasticSearchResultItemTest {
@Test
- public void testAllMethods(){
+ public void testAllMethods() {
ElasticSearchShardStatus shardStatus = new ElasticSearchShardStatus();
shardStatus.setTotal(10);
shardStatus.setSuccessful(0);
@@ -51,7 +51,7 @@ public class ElasticSearchResultItemTest { error.setAdditionalProperties("name-1", "value-1");
Assert.assertNotNull(error.getAdditionalProperties());
- //Create Status
+ // Create Status
ElasticSearchResultItem resultItem1 = new ElasticSearchResultItem();
resultItem1.setCreate(getStatus(shardStatus, error));
Assert.assertNotNull(resultItem1.getCreate());
@@ -60,7 +60,7 @@ public class ElasticSearchResultItemTest { Assert.assertTrue(resultItem1.toString().contains("create"));
Assert.assertNotNull(resultItem1.toJson());
- //Index Status
+ // Index Status
ElasticSearchResultItem resultItem2 = new ElasticSearchResultItem();
resultItem2.setIndex(getStatus(shardStatus, error));
Assert.assertNotNull(resultItem2.getIndex());
@@ -69,7 +69,7 @@ public class ElasticSearchResultItemTest { Assert.assertTrue(resultItem2.toString().contains("index"));
Assert.assertNotNull(resultItem2.toJson());
- //Delete Status
+ // Delete Status
ElasticSearchResultItem resultItem3 = new ElasticSearchResultItem();
resultItem3.setDelete(getStatus(shardStatus, error));
Assert.assertNotNull(resultItem3.getDelete());
@@ -78,12 +78,12 @@ public class ElasticSearchResultItemTest { Assert.assertTrue(resultItem3.toString().contains("delete"));
Assert.assertNotNull(resultItem3.toJson());
- //Unknown Status
+ // Unknown Status
ElasticSearchResultItem resultItem4 = new ElasticSearchResultItem();
Assert.assertEquals(resultItem4.operationType(), "unknown");
Assert.assertNull(resultItem4.operationStatus());
- //ElasticSearchBulkOperationResult
+ // ElasticSearchBulkOperationResult
ElasticSearchResultItem[] resultItems = {resultItem1, resultItem2, resultItem3};
ElasticSearchBulkOperationResult result = new ElasticSearchBulkOperationResult();
result.setErrors(true);
|