Add elasticsearch with searchguard Dockerfile 63/79463/1
authorLee, Tian (tl5884) <TianL@amdocs.com>
Fri, 1 Mar 2019 16:03:03 +0000 (16:03 +0000)
committerLee, Tian (tl5884) <TianL@amdocs.com>
Fri, 1 Mar 2019 16:03:03 +0000 (16:03 +0000)
Add Dockerfile that produces an image of ElasticSearch with SearchGuard
plugin pre-installed, and restructure the Maven project to build both
the old search-data-service Dockerfile and the new elasticsearch-sg
Dockerfile.

Change-Id: Iff7cb79e3c09da78b6233422f40cb03eeef5bfdb
Issue-ID: AAI-2203
Signed-off-by: Lee, Tian (tl5884) <TianL@amdocs.com>
123 files changed:
elasticsearch-sg/pom.xml [new file with mode: 0644]
elasticsearch-sg/src/main/docker/Dockerfile [new file with mode: 0644]
pom.xml
search-data-service/License.txt [moved from License.txt with 100% similarity]
search-data-service/bundleconfig-local/etc/logback.xml [moved from bundleconfig-local/etc/logback.xml with 100% similarity]
search-data-service/pom.xml [new file with mode: 0644]
search-data-service/src/main/bin/start.sh [moved from src/main/bin/start.sh with 100% similarity]
search-data-service/src/main/docker/Dockerfile [moved from src/main/docker/Dockerfile with 96% similarity]
search-data-service/src/main/java/org/onap/aai/sa/Application.java [moved from src/main/java/org/onap/aai/sa/Application.java with 98% similarity]
search-data-service/src/main/java/org/onap/aai/sa/auth/SearchDbServiceAuth.java [moved from src/main/java/org/onap/aai/sa/auth/SearchDbServiceAuth.java with 100% similarity]
search-data-service/src/main/java/org/onap/aai/sa/auth/SearchDbServiceAuthCore.java [moved from src/main/java/org/onap/aai/sa/auth/SearchDbServiceAuthCore.java with 100% similarity]
search-data-service/src/main/java/org/onap/aai/sa/rest/AnalysisConfiguration.java [moved from src/main/java/org/onap/aai/sa/rest/AnalysisConfiguration.java with 100% similarity]
search-data-service/src/main/java/org/onap/aai/sa/rest/AnalyzerApi.java [moved from src/main/java/org/onap/aai/sa/rest/AnalyzerApi.java with 100% similarity]
search-data-service/src/main/java/org/onap/aai/sa/rest/ApiUtils.java [moved from src/main/java/org/onap/aai/sa/rest/ApiUtils.java with 100% similarity]
search-data-service/src/main/java/org/onap/aai/sa/rest/BulkApi.java [moved from src/main/java/org/onap/aai/sa/rest/BulkApi.java with 100% similarity]
search-data-service/src/main/java/org/onap/aai/sa/rest/BulkMetaData.java [moved from src/main/java/org/onap/aai/sa/rest/BulkMetaData.java with 100% similarity]
search-data-service/src/main/java/org/onap/aai/sa/rest/BulkOperation.java [moved from src/main/java/org/onap/aai/sa/rest/BulkOperation.java with 100% similarity]
search-data-service/src/main/java/org/onap/aai/sa/rest/BulkRequest.java [moved from src/main/java/org/onap/aai/sa/rest/BulkRequest.java with 100% similarity]
search-data-service/src/main/java/org/onap/aai/sa/rest/Document.java [moved from src/main/java/org/onap/aai/sa/rest/Document.java with 100% similarity]
search-data-service/src/main/java/org/onap/aai/sa/rest/DocumentApi.java [moved from src/main/java/org/onap/aai/sa/rest/DocumentApi.java with 100% similarity]
search-data-service/src/main/java/org/onap/aai/sa/rest/IndexApi.java [moved from src/main/java/org/onap/aai/sa/rest/IndexApi.java with 100% similarity]
search-data-service/src/main/java/org/onap/aai/sa/rest/SearchServiceApi.java [moved from src/main/java/org/onap/aai/sa/rest/SearchServiceApi.java with 100% similarity]
search-data-service/src/main/java/org/onap/aai/sa/rest/SettingConfiguration.java [moved from src/main/java/org/onap/aai/sa/rest/SettingConfiguration.java with 100% similarity]
search-data-service/src/main/java/org/onap/aai/sa/searchdbabstraction/RestEchoService.java [moved from src/main/java/org/onap/aai/sa/searchdbabstraction/RestEchoService.java with 100% similarity]
search-data-service/src/main/java/org/onap/aai/sa/searchdbabstraction/elasticsearch/config/ElasticSearchConfig.java [moved from src/main/java/org/onap/aai/sa/searchdbabstraction/elasticsearch/config/ElasticSearchConfig.java with 100% similarity]
search-data-service/src/main/java/org/onap/aai/sa/searchdbabstraction/elasticsearch/dao/DocumentStoreDataEntity.java [moved from src/main/java/org/onap/aai/sa/searchdbabstraction/elasticsearch/dao/DocumentStoreDataEntity.java with 100% similarity]
search-data-service/src/main/java/org/onap/aai/sa/searchdbabstraction/elasticsearch/dao/DocumentStoreDataEntityImpl.java [moved from src/main/java/org/onap/aai/sa/searchdbabstraction/elasticsearch/dao/DocumentStoreDataEntityImpl.java with 100% similarity]
search-data-service/src/main/java/org/onap/aai/sa/searchdbabstraction/elasticsearch/dao/DocumentStoreInterface.java [moved from src/main/java/org/onap/aai/sa/searchdbabstraction/elasticsearch/dao/DocumentStoreInterface.java with 100% similarity]
search-data-service/src/main/java/org/onap/aai/sa/searchdbabstraction/elasticsearch/dao/ElasticSearchBulkOperationResult.java [moved from src/main/java/org/onap/aai/sa/searchdbabstraction/elasticsearch/dao/ElasticSearchBulkOperationResult.java with 100% similarity]
search-data-service/src/main/java/org/onap/aai/sa/searchdbabstraction/elasticsearch/dao/ElasticSearchCause.java [moved from src/main/java/org/onap/aai/sa/searchdbabstraction/elasticsearch/dao/ElasticSearchCause.java with 100% similarity]
search-data-service/src/main/java/org/onap/aai/sa/searchdbabstraction/elasticsearch/dao/ElasticSearchError.java [moved from src/main/java/org/onap/aai/sa/searchdbabstraction/elasticsearch/dao/ElasticSearchError.java with 100% similarity]
search-data-service/src/main/java/org/onap/aai/sa/searchdbabstraction/elasticsearch/dao/ElasticSearchHttpController.java [moved from src/main/java/org/onap/aai/sa/searchdbabstraction/elasticsearch/dao/ElasticSearchHttpController.java with 100% similarity]
search-data-service/src/main/java/org/onap/aai/sa/searchdbabstraction/elasticsearch/dao/ElasticSearchHttpsController.java [moved from src/main/java/org/onap/aai/sa/searchdbabstraction/elasticsearch/dao/ElasticSearchHttpsController.java with 100% similarity]
search-data-service/src/main/java/org/onap/aai/sa/searchdbabstraction/elasticsearch/dao/ElasticSearchOperationStatus.java [moved from src/main/java/org/onap/aai/sa/searchdbabstraction/elasticsearch/dao/ElasticSearchOperationStatus.java with 100% similarity]
search-data-service/src/main/java/org/onap/aai/sa/searchdbabstraction/elasticsearch/dao/ElasticSearchResultItem.java [moved from src/main/java/org/onap/aai/sa/searchdbabstraction/elasticsearch/dao/ElasticSearchResultItem.java with 100% similarity]
search-data-service/src/main/java/org/onap/aai/sa/searchdbabstraction/elasticsearch/dao/ElasticSearchShardStatus.java [moved from src/main/java/org/onap/aai/sa/searchdbabstraction/elasticsearch/dao/ElasticSearchShardStatus.java with 100% similarity]
search-data-service/src/main/java/org/onap/aai/sa/searchdbabstraction/elasticsearch/exception/DocumentStoreOperationException.java [moved from src/main/java/org/onap/aai/sa/searchdbabstraction/elasticsearch/exception/DocumentStoreOperationException.java with 100% similarity]
search-data-service/src/main/java/org/onap/aai/sa/searchdbabstraction/entity/AggregationBucket.java [moved from src/main/java/org/onap/aai/sa/searchdbabstraction/entity/AggregationBucket.java with 100% similarity]
search-data-service/src/main/java/org/onap/aai/sa/searchdbabstraction/entity/AggregationResult.java [moved from src/main/java/org/onap/aai/sa/searchdbabstraction/entity/AggregationResult.java with 100% similarity]
search-data-service/src/main/java/org/onap/aai/sa/searchdbabstraction/entity/AggregationResults.java [moved from src/main/java/org/onap/aai/sa/searchdbabstraction/entity/AggregationResults.java with 100% similarity]
search-data-service/src/main/java/org/onap/aai/sa/searchdbabstraction/entity/Document.java [moved from src/main/java/org/onap/aai/sa/searchdbabstraction/entity/Document.java with 100% similarity]
search-data-service/src/main/java/org/onap/aai/sa/searchdbabstraction/entity/DocumentOperationResult.java [moved from src/main/java/org/onap/aai/sa/searchdbabstraction/entity/DocumentOperationResult.java with 100% similarity]
search-data-service/src/main/java/org/onap/aai/sa/searchdbabstraction/entity/ErrorResult.java [moved from src/main/java/org/onap/aai/sa/searchdbabstraction/entity/ErrorResult.java with 100% similarity]
search-data-service/src/main/java/org/onap/aai/sa/searchdbabstraction/entity/OperationResult.java [moved from src/main/java/org/onap/aai/sa/searchdbabstraction/entity/OperationResult.java with 100% similarity]
search-data-service/src/main/java/org/onap/aai/sa/searchdbabstraction/entity/OperationResultBuilder.java [moved from src/main/java/org/onap/aai/sa/searchdbabstraction/entity/OperationResultBuilder.java with 100% similarity]
search-data-service/src/main/java/org/onap/aai/sa/searchdbabstraction/entity/SearchHit.java [moved from src/main/java/org/onap/aai/sa/searchdbabstraction/entity/SearchHit.java with 100% similarity]
search-data-service/src/main/java/org/onap/aai/sa/searchdbabstraction/entity/SearchHits.java [moved from src/main/java/org/onap/aai/sa/searchdbabstraction/entity/SearchHits.java with 100% similarity]
search-data-service/src/main/java/org/onap/aai/sa/searchdbabstraction/entity/SearchOperationResult.java [moved from src/main/java/org/onap/aai/sa/searchdbabstraction/entity/SearchOperationResult.java with 100% similarity]
search-data-service/src/main/java/org/onap/aai/sa/searchdbabstraction/entity/SuggestHit.java [moved from src/main/java/org/onap/aai/sa/searchdbabstraction/entity/SuggestHit.java with 100% similarity]
search-data-service/src/main/java/org/onap/aai/sa/searchdbabstraction/entity/SuggestHits.java [moved from src/main/java/org/onap/aai/sa/searchdbabstraction/entity/SuggestHits.java with 100% similarity]
search-data-service/src/main/java/org/onap/aai/sa/searchdbabstraction/logging/SearchDbMsgs.java [moved from src/main/java/org/onap/aai/sa/searchdbabstraction/logging/SearchDbMsgs.java with 100% similarity]
search-data-service/src/main/java/org/onap/aai/sa/searchdbabstraction/searchapi/AbstractAggregation.java [moved from src/main/java/org/onap/aai/sa/searchdbabstraction/searchapi/AbstractAggregation.java with 100% similarity]
search-data-service/src/main/java/org/onap/aai/sa/searchdbabstraction/searchapi/Aggregation.java [moved from src/main/java/org/onap/aai/sa/searchdbabstraction/searchapi/Aggregation.java with 100% similarity]
search-data-service/src/main/java/org/onap/aai/sa/searchdbabstraction/searchapi/AggregationStatement.java [moved from src/main/java/org/onap/aai/sa/searchdbabstraction/searchapi/AggregationStatement.java with 100% similarity]
search-data-service/src/main/java/org/onap/aai/sa/searchdbabstraction/searchapi/DateHistogramAggregation.java [moved from src/main/java/org/onap/aai/sa/searchdbabstraction/searchapi/DateHistogramAggregation.java with 100% similarity]
search-data-service/src/main/java/org/onap/aai/sa/searchdbabstraction/searchapi/DateRange.java [moved from src/main/java/org/onap/aai/sa/searchdbabstraction/searchapi/DateRange.java with 100% similarity]
search-data-service/src/main/java/org/onap/aai/sa/searchdbabstraction/searchapi/DateRangeAggregation.java [moved from src/main/java/org/onap/aai/sa/searchdbabstraction/searchapi/DateRangeAggregation.java with 100% similarity]
search-data-service/src/main/java/org/onap/aai/sa/searchdbabstraction/searchapi/Filter.java [moved from src/main/java/org/onap/aai/sa/searchdbabstraction/searchapi/Filter.java with 100% similarity]
search-data-service/src/main/java/org/onap/aai/sa/searchdbabstraction/searchapi/GroupByAggregation.java [moved from src/main/java/org/onap/aai/sa/searchdbabstraction/searchapi/GroupByAggregation.java with 100% similarity]
search-data-service/src/main/java/org/onap/aai/sa/searchdbabstraction/searchapi/ParsedQuery.java [moved from src/main/java/org/onap/aai/sa/searchdbabstraction/searchapi/ParsedQuery.java with 100% similarity]
search-data-service/src/main/java/org/onap/aai/sa/searchdbabstraction/searchapi/Query.java [moved from src/main/java/org/onap/aai/sa/searchdbabstraction/searchapi/Query.java with 100% similarity]
search-data-service/src/main/java/org/onap/aai/sa/searchdbabstraction/searchapi/QueryStatement.java [moved from src/main/java/org/onap/aai/sa/searchdbabstraction/searchapi/QueryStatement.java with 100% similarity]
search-data-service/src/main/java/org/onap/aai/sa/searchdbabstraction/searchapi/RangeQuery.java [moved from src/main/java/org/onap/aai/sa/searchdbabstraction/searchapi/RangeQuery.java with 100% similarity]
search-data-service/src/main/java/org/onap/aai/sa/searchdbabstraction/searchapi/SearchStatement.java [moved from src/main/java/org/onap/aai/sa/searchdbabstraction/searchapi/SearchStatement.java with 100% similarity]
search-data-service/src/main/java/org/onap/aai/sa/searchdbabstraction/searchapi/Sort.java [moved from src/main/java/org/onap/aai/sa/searchdbabstraction/searchapi/Sort.java with 100% similarity]
search-data-service/src/main/java/org/onap/aai/sa/searchdbabstraction/searchapi/SuggestionStatement.java [moved from src/main/java/org/onap/aai/sa/searchdbabstraction/searchapi/SuggestionStatement.java with 100% similarity]
search-data-service/src/main/java/org/onap/aai/sa/searchdbabstraction/searchapi/TermQuery.java [moved from src/main/java/org/onap/aai/sa/searchdbabstraction/searchapi/TermQuery.java with 100% similarity]
search-data-service/src/main/java/org/onap/aai/sa/searchdbabstraction/service/SearchService.java [moved from src/main/java/org/onap/aai/sa/searchdbabstraction/service/SearchService.java with 100% similarity]
search-data-service/src/main/java/org/onap/aai/sa/searchdbabstraction/util/AggregationParsingUtil.java [moved from src/main/java/org/onap/aai/sa/searchdbabstraction/util/AggregationParsingUtil.java with 100% similarity]
search-data-service/src/main/java/org/onap/aai/sa/searchdbabstraction/util/DocumentSchemaUtil.java [moved from src/main/java/org/onap/aai/sa/searchdbabstraction/util/DocumentSchemaUtil.java with 100% similarity]
search-data-service/src/main/java/org/onap/aai/sa/searchdbabstraction/util/ElasticSearchPayloadTranslator.java [moved from src/main/java/org/onap/aai/sa/searchdbabstraction/util/ElasticSearchPayloadTranslator.java with 100% similarity]
search-data-service/src/main/java/org/onap/aai/sa/searchdbabstraction/util/SearchDbConstants.java [moved from src/main/java/org/onap/aai/sa/searchdbabstraction/util/SearchDbConstants.java with 100% similarity]
search-data-service/src/main/resources/application.properties [moved from src/main/resources/application.properties with 97% similarity]
search-data-service/src/main/resources/banner.txt [moved from src/main/resources/banner.txt with 100% similarity]
search-data-service/src/main/resources/json/schema/analyzer.schema.json [moved from src/main/resources/json/schema/analyzer.schema.json with 100% similarity]
search-data-service/src/main/resources/json/schema/document-field.schema.json [moved from src/main/resources/json/schema/document-field.schema.json with 100% similarity]
search-data-service/src/main/resources/json/schema/document.schema.json [moved from src/main/resources/json/schema/document.schema.json with 100% similarity]
search-data-service/src/main/resources/json/schema/filter.schema.json [moved from src/main/resources/json/schema/filter.schema.json with 100% similarity]
search-data-service/src/main/resources/logging/SearchDbMsgs.properties [moved from src/main/resources/logging/SearchDbMsgs.properties with 100% similarity]
search-data-service/src/test/java/org/onap/aai/sa/auth/SearchDbServiceAuthTest.java [moved from src/test/java/org/onap/aai/sa/auth/SearchDbServiceAuthTest.java with 97% similarity]
search-data-service/src/test/java/org/onap/aai/sa/rest/ApiUtilsTest.java [moved from src/test/java/org/onap/aai/sa/rest/ApiUtilsTest.java with 100% similarity]
search-data-service/src/test/java/org/onap/aai/sa/rest/BulkApiTest.java [moved from src/test/java/org/onap/aai/sa/rest/BulkApiTest.java with 100% similarity]
search-data-service/src/test/java/org/onap/aai/sa/rest/BulkRequestTest.java [moved from src/test/java/org/onap/aai/sa/rest/BulkRequestTest.java with 97% similarity]
search-data-service/src/test/java/org/onap/aai/sa/rest/DocumentApiTest.java [moved from src/test/java/org/onap/aai/sa/rest/DocumentApiTest.java with 100% similarity]
search-data-service/src/test/java/org/onap/aai/sa/rest/DocumentSchemaTest.java [moved from src/test/java/org/onap/aai/sa/rest/DocumentSchemaTest.java with 100% similarity]
search-data-service/src/test/java/org/onap/aai/sa/rest/DocumentTest.java [moved from src/test/java/org/onap/aai/sa/rest/DocumentTest.java with 98% similarity]
search-data-service/src/test/java/org/onap/aai/sa/rest/IndexApiTest.java [moved from src/test/java/org/onap/aai/sa/rest/IndexApiTest.java with 100% similarity]
search-data-service/src/test/java/org/onap/aai/sa/rest/SearchServiceApiHarness.java [moved from src/test/java/org/onap/aai/sa/rest/SearchServiceApiHarness.java with 100% similarity]
search-data-service/src/test/java/org/onap/aai/sa/rest/SettingConfigurationTest.java [moved from src/test/java/org/onap/aai/sa/rest/SettingConfigurationTest.java with 100% similarity]
search-data-service/src/test/java/org/onap/aai/sa/rest/StubEsController.java [moved from src/test/java/org/onap/aai/sa/rest/StubEsController.java with 100% similarity]
search-data-service/src/test/java/org/onap/aai/sa/rest/TestUtils.java [moved from src/test/java/org/onap/aai/sa/rest/TestUtils.java with 100% similarity]
search-data-service/src/test/java/org/onap/aai/sa/searchdbabstraction/elasticsearch/config/ElasticSearchConfigTest.java [moved from src/test/java/org/onap/aai/sa/searchdbabstraction/elasticsearch/config/ElasticSearchConfigTest.java with 97% similarity]
search-data-service/src/test/java/org/onap/aai/sa/searchdbabstraction/elasticsearch/dao/AggregationResponseParsingTest.java [moved from src/test/java/org/onap/aai/sa/searchdbabstraction/elasticsearch/dao/AggregationResponseParsingTest.java with 100% similarity]
search-data-service/src/test/java/org/onap/aai/sa/searchdbabstraction/elasticsearch/dao/ElasticSearchHttpControllerTest.java [moved from src/test/java/org/onap/aai/sa/searchdbabstraction/elasticsearch/dao/ElasticSearchHttpControllerTest.java with 100% similarity]
search-data-service/src/test/java/org/onap/aai/sa/searchdbabstraction/elasticsearch/dao/ElasticSearchResultItemTest.java [moved from src/test/java/org/onap/aai/sa/searchdbabstraction/elasticsearch/dao/ElasticSearchResultItemTest.java with 97% similarity]
search-data-service/src/test/java/org/onap/aai/sa/searchdbabstraction/searchapi/AggregationStatementTest.java [moved from src/test/java/org/onap/aai/sa/searchdbabstraction/searchapi/AggregationStatementTest.java with 100% similarity]
search-data-service/src/test/java/org/onap/aai/sa/searchdbabstraction/searchapi/AggregationTest.java [moved from src/test/java/org/onap/aai/sa/searchdbabstraction/searchapi/AggregationTest.java with 100% similarity]
search-data-service/src/test/java/org/onap/aai/sa/searchdbabstraction/searchapi/DateHistogramAggregationTest.java [moved from src/test/java/org/onap/aai/sa/searchdbabstraction/searchapi/DateHistogramAggregationTest.java with 100% similarity]
search-data-service/src/test/java/org/onap/aai/sa/searchdbabstraction/searchapi/DateRangeAggregationTest.java [moved from src/test/java/org/onap/aai/sa/searchdbabstraction/searchapi/DateRangeAggregationTest.java with 100% similarity]
search-data-service/src/test/java/org/onap/aai/sa/searchdbabstraction/searchapi/DateRangeTest.java [moved from src/test/java/org/onap/aai/sa/searchdbabstraction/searchapi/DateRangeTest.java with 100% similarity]
search-data-service/src/test/java/org/onap/aai/sa/searchdbabstraction/searchapi/FilterTest.java [moved from src/test/java/org/onap/aai/sa/searchdbabstraction/searchapi/FilterTest.java with 100% similarity]
search-data-service/src/test/java/org/onap/aai/sa/searchdbabstraction/searchapi/GroupByAggregationTest.java [moved from src/test/java/org/onap/aai/sa/searchdbabstraction/searchapi/GroupByAggregationTest.java with 100% similarity]
search-data-service/src/test/java/org/onap/aai/sa/searchdbabstraction/searchapi/QueryTest.java [moved from src/test/java/org/onap/aai/sa/searchdbabstraction/searchapi/QueryTest.java with 100% similarity]
search-data-service/src/test/java/org/onap/aai/sa/searchdbabstraction/searchapi/RangeQueryTest.java [moved from src/test/java/org/onap/aai/sa/searchdbabstraction/searchapi/RangeQueryTest.java with 100% similarity]
search-data-service/src/test/java/org/onap/aai/sa/searchdbabstraction/searchapi/SearchStatementTest.java [moved from src/test/java/org/onap/aai/sa/searchdbabstraction/searchapi/SearchStatementTest.java with 100% similarity]
search-data-service/src/test/java/org/onap/aai/sa/searchdbabstraction/searchapi/SortTest.java [moved from src/test/java/org/onap/aai/sa/searchdbabstraction/searchapi/SortTest.java with 100% similarity]
search-data-service/src/test/java/org/onap/aai/sa/searchdbabstraction/searchapi/TermQueryTest.java [moved from src/test/java/org/onap/aai/sa/searchdbabstraction/searchapi/TermQueryTest.java with 98% similarity]
search-data-service/src/test/java/org/onap/aai/sa/searchdbabstraction/util/ElasticSearchPayloadTranslatorTest.java [moved from src/test/java/org/onap/aai/sa/searchdbabstraction/util/ElasticSearchPayloadTranslatorTest.java with 100% similarity]
search-data-service/src/test/resources/json/analysis-config.json [moved from src/test/resources/json/analysis-config.json with 100% similarity]
search-data-service/src/test/resources/json/bulk-ops-invalid.json [moved from src/test/resources/json/bulk-ops-invalid.json with 100% similarity]
search-data-service/src/test/resources/json/bulk-ops-valid.json [moved from src/test/resources/json/bulk-ops-valid.json with 100% similarity]
search-data-service/src/test/resources/json/dynamic-custom-template.json [moved from src/test/resources/json/dynamic-custom-template.json with 100% similarity]
search-data-service/src/test/resources/json/dynamicIndex.json [moved from src/test/resources/json/dynamicIndex.json with 100% similarity]
search-data-service/src/test/resources/json/es-payload-translation.json [moved from src/test/resources/json/es-payload-translation.json with 100% similarity]
search-data-service/src/test/resources/json/filter-config.json [moved from src/test/resources/json/filter-config.json with 100% similarity]
search-data-service/src/test/resources/json/index-mapping.json [moved from src/test/resources/json/index-mapping.json with 100% similarity]
search-data-service/src/test/resources/json/nested-document.json [moved from src/test/resources/json/nested-document.json with 100% similarity]
search-data-service/src/test/resources/json/queries/query-with-subrange.json [moved from src/test/resources/json/queries/query-with-subrange.json with 100% similarity]
search-data-service/src/test/resources/json/queries/simple-parsed-query.json [moved from src/test/resources/json/queries/simple-parsed-query.json with 100% similarity]
search-data-service/src/test/resources/json/search_policy.json [moved from src/test/resources/json/search_policy.json with 94% similarity]
search-data-service/src/test/resources/json/settings-config.json [moved from src/test/resources/json/settings-config.json with 100% similarity]
search-data-service/src/test/resources/json/simpleDocument.json [moved from src/test/resources/json/simpleDocument.json with 100% similarity]
search-data-service/src/test/resources/json/tier-support-document.json [moved from src/test/resources/json/tier-support-document.json with 100% similarity]

diff --git a/elasticsearch-sg/pom.xml b/elasticsearch-sg/pom.xml
new file mode 100644 (file)
index 0000000..cd24333
--- /dev/null
@@ -0,0 +1,81 @@
+<!--
+
+    ============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>
+
+       <groupId>org.onap.aai.search-data-service</groupId>
+       <artifactId>elasticsearch-sg</artifactId>
+       <name>elasticsearch with searchguard</name>
+       <version>1.4.0-SNAPSHOT</version>
+       <packaging>pom</packaging>
+
+       <build>
+               <plugins>
+                       <plugin>
+                               <groupId>org.apache.maven.plugins</groupId>
+                               <artifactId>maven-resources-plugin</artifactId>
+                               <version>2.7</version>
+                               <executions>
+                                       <execution>
+                                               <id>copy-docker-file</id>
+                                               <phase>process-resources</phase>
+                                               <goals>
+                                                       <goal>copy-resources</goal>
+                                               </goals>
+                                               <configuration>
+                                                       <outputDirectory>target</outputDirectory>
+                                                       <overwrite>true</overwrite>
+                                                       <resources>
+                                                               <resource>
+                                                                       <directory>${basedir}/src/main/docker</directory>
+                                                                       <includes>
+                                                                               <include>**/*</include>
+                                                                       </includes>
+                                                               </resource>
+                                                       </resources>
+                                               </configuration>
+                                       </execution>
+                               </executions>
+                       </plugin>
+
+                       <plugin>
+                               <groupId>com.spotify</groupId>
+                               <artifactId>docker-maven-plugin</artifactId>
+                               <version>0.4.11</version>
+                               <configuration>
+                                       <verbose>true</verbose>
+                                       <serverId>docker-hub</serverId>
+                                       <imageName>${docker.push.registry}/onap/${project.artifactId}</imageName>
+                                       <dockerDirectory>${basedir}/target</dockerDirectory>
+                                       <imageTags>
+                                               <imageTag>latest</imageTag>
+                                       </imageTags>
+                                       <forceTags>true</forceTags>
+                               </configuration>
+                       </plugin>
+
+               </plugins>
+       </build>
+
+</project>
\ No newline at end of file
diff --git a/elasticsearch-sg/src/main/docker/Dockerfile b/elasticsearch-sg/src/main/docker/Dockerfile
new file mode 100644 (file)
index 0000000..0ccb31d
--- /dev/null
@@ -0,0 +1,10 @@
+# https://github.com/elastic/elasticsearch-docker
+FROM docker.elastic.co/elasticsearch/elasticsearch:6.1.2
+
+USER elasticsearch
+
+# Search Guard plugin
+RUN elasticsearch-plugin install --batch com.floragunn:search-guard-6:6.1.2-22.3 \
+       && chmod +x plugins/search-guard-6/tools/*.sh
+
+ENTRYPOINT ["/usr/share/elasticsearch/bin/run.sh"]
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 65c8d40..3eb4543 100644 (file)
--- a/pom.xml
+++ b/pom.xml
 
 -->
 <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>
-
-    <parent>
-      <artifactId>spring-boot-starter-parent</artifactId>
-      <groupId>org.springframework.boot</groupId>
-      <version>1.5.18.RELEASE</version>
-    </parent>
-    <groupId>org.onap.aai</groupId>
-    <artifactId>search-data-service</artifactId>
-    <version>1.4.0-SNAPSHOT</version>
-    <name>aai-search-data-service</name>
-
-    <properties>
-        <docker.location>${basedir}/target</docker.location>
-        <nexusproxy>https://nexus.onap.org</nexusproxy>
-        <java.version>1.8</java.version>
-        <generatedSourceDir>${basedir}/src/main/java-gen</generatedSourceDir>
-        <checkstyle.config.location>google_checks.xml</checkstyle.config.location>
-
-        <sonar.language>java</sonar.language>
-        <sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
-        <sonar.surefire.reportsPath>${project.build.directory}/surefire-reports
-        </sonar.surefire.reportsPath>
-        <sonar.jacoco.reportPath>${project.build.directory}/coverage-reports/jacoco.exec
-        </sonar.jacoco.reportPath>
-        <sonar.jacoco.reportMissing.force.zero>false</sonar.jacoco.reportMissing.force.zero>
-        <sonar.projectVersion>${project.version}</sonar.projectVersion>
-    </properties>
-
-    <dependencies>
-
-        <dependency>
-            <groupId>com.google.code.gson</groupId>
-            <artifactId>gson</artifactId>
-            <version>2.8.2</version>
-        </dependency>
-
-        <dependency>
-            <groupId>org.hamcrest</groupId>
-            <artifactId>hamcrest-library</artifactId>
-            <version>1.3</version>
-            <scope>test</scope>
-        </dependency>
-
-        <dependency>
-            <groupId>com.jayway.jsonpath</groupId>
-            <artifactId>json-path</artifactId>
-            <version>2.2.0</version>
-        </dependency>
-
-        <dependency>
-            <groupId>com.googlecode.json-simple</groupId>
-            <artifactId>json-simple</artifactId>
-            <version>1.1.1</version>
-        </dependency>
-
-        <dependency>
-            <groupId>org.dom4j</groupId>
-            <artifactId>dom4j</artifactId>
-            <version>2.1.1</version>
-            <scope>provided</scope>
-        </dependency>
-
-        <dependency>
-            <groupId>commons-io</groupId>
-            <artifactId>commons-io</artifactId>
-            <version>2.4</version>
-        </dependency>
-
-        <dependency>
-            <groupId>org.mockito</groupId>
-            <artifactId>mockito-all</artifactId>
-            <version>1.10.19</version>
-            <scope>test</scope>
-        </dependency>
-
-        <!-- Common logging framework -->
-        <dependency>
-          <groupId>org.onap.aai.logging-service</groupId>
-          <artifactId>common-logging</artifactId>
-          <version>1.2.2</version>
-        </dependency>
-
-        <dependency>
-            <groupId>org.onap.aai.logging-service</groupId>
-            <artifactId>logging-api</artifactId>
-            <version>1.2.2</version>
-        </dependency>
-
-        <dependency>
-            <groupId>org.onap.aai.logging-service</groupId>
-            <artifactId>eelf-logging</artifactId>
-            <version>1.2.2</version>
-        </dependency>
-
-        <!-- For JSON Mapping Support. -->
-        <dependency>
-            <groupId>com.fasterxml.jackson.core</groupId>
-            <artifactId>jackson-databind</artifactId>
-            <version>2.7.8</version>
-        </dependency>
-
-        <dependency>
-          <groupId>org.apache.directory.studio</groupId>
-          <artifactId>org.apache.commons.lang</artifactId>
-          <version>2.6</version>
-        </dependency>
-
-        <dependency>
-          <groupId>radeox</groupId>
-          <artifactId>radeox</artifactId>
-          <version>0.9</version>
-        </dependency>
-
-        <dependency>
-          <groupId>com.github.fge</groupId>
-          <artifactId>json-schema-validator</artifactId>
-          <version>2.0.0</version>
-        </dependency>
-
-        <dependency>
-          <groupId>org.json</groupId>
-          <artifactId>json</artifactId>
-          <version>20180130</version>
-        </dependency>
-
-       <dependency>
-          <groupId>org.springframework.boot</groupId>
-          <artifactId>spring-boot-starter-web</artifactId>
-         <exclusions>
-            <exclusion>
-              <groupId>org.springframework.boot</groupId>
-              <artifactId>spring-boot-starter-tomcat</artifactId>
-            </exclusion>
-          </exclusions>
-       </dependency>
-       
-       <dependency>
-                       <groupId>org.springframework.boot</groupId>
-                       <artifactId>spring-boot-starter-jetty</artifactId>
-               </dependency>
-               
-               <dependency>
-                       <groupId>org.springframework.boot</groupId>
-                       <artifactId>spring-boot-starter</artifactId>
-                       <exclusions>
-                               <exclusion>
-                                       <groupId>ch.qos.logback</groupId>
-                                       <artifactId>logback-classic</artifactId>
-                               </exclusion>
-                       </exclusions>
-               </dependency>
-               
-               <dependency>
-                 <groupId>org.springframework.boot</groupId>
-                 <artifactId>spring-boot-starter-jersey</artifactId>
-                 <exclusions>
-                    <exclusion>
-                      <groupId>org.springframework.boot</groupId>
-                      <artifactId>spring-boot-starter-tomcat</artifactId>
-                    </exclusion>
-                 </exclusions>
-               </dependency>
-
-        <dependency>
-          <groupId>org.springframework.boot</groupId>
-          <artifactId>spring-boot-starter-actuator</artifactId>
-        </dependency>
-
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-test</artifactId>
-            <scope>test</scope>
-        </dependency>
-        
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-security</artifactId>
-        </dependency>
-
-        <!--Logback classic-->
-        <dependency>
-            <groupId>ch.qos.logback</groupId>
-            <artifactId>logback-classic</artifactId>
-            <version>1.2.1</version>
-        </dependency>
-
-        <dependency>
-            <groupId>ch.qos.logback</groupId>
-            <artifactId>logback-core</artifactId>
-            <version>1.2.1</version>
-        </dependency>
-
-    </dependencies>
-
-    <repositories>
-        <repository>
-            <id>central</id>
-            <name>Maven 2 repository 2</name>
-            <url>http://repo2.maven.org/maven2/</url>
-        </repository>
-        <repository>
-            <id>ecomp-releases</id>
-            <name>ECOMP Release Repository</name>
-            <url>${nexusproxy}/content/repositories/releases/</url>
-        </repository>
-        <repository>
-            <id>ecomp-snapshots</id>
-            <name>ECOMP Snapshot Repository</name>
-            <url>${nexusproxy}/content/repositories/snapshots/</url>
-        </repository>
-        <repository>
-            <id>ecomp-staging</id>
-            <name>ECOMP Staging Repository</name>
-            <url>${nexusproxy}/content/repositories/staging/</url>
-        </repository>
-    </repositories>
-
-    <build>
-        <finalName>search-data-service-package</finalName>
-      <plugins>
-           <plugin>
-          <groupId>org.springframework.boot</groupId>
-          <artifactId>spring-boot-maven-plugin</artifactId>
-        </plugin>
-            <!-- Checkstyle plugin - used to report on compliance with -->
-            <!-- the Google style guide. -->
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-site-plugin</artifactId>
-                <configuration>
-                    <reportPlugins>
-                        <plugin>
-                            <groupId>org.apache.maven.plugins</groupId>
-                            <artifactId>maven-checkstyle-plugin</artifactId>
-                            <version>2.17</version>
-                            <reportSets>
-                                <reportSet>
-                                    <reports>
-                                        <report>checkstyle</report>
-                                    </reports>
-                                </reportSet>
-                            </reportSets>
-                        </plugin>
-                    </reportPlugins>
-                </configuration>
-            </plugin>
-            <!-- This plugin overrides the compiler settings to use java 1.8 -->
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-compiler-plugin</artifactId>
-                <version>3.1</version>
-                <configuration>
-                    <compilerId>groovy-eclipse-compiler</compilerId>
-                    <verbose>true</verbose>
-                    <source>1.8</source>
-                    <target>1.8</target>
-                </configuration>
-                <dependencies>
-                    <dependency>
-                        <groupId>org.codehaus.groovy</groupId>
-                        <artifactId>groovy-eclipse-compiler</artifactId>
-                        <version>2.9.0-01</version>
-                    </dependency>
-                    <dependency>
-                        <groupId>org.codehaus.groovy</groupId>
-                        <artifactId>groovy-eclipse-batch</artifactId>
-                        <version>2.3.4-01</version>
-                    </dependency>
-                </dependencies>
-            </plugin>
-            <plugin>
-                <groupId>com.spotify</groupId>
-                <artifactId>docker-maven-plugin</artifactId>
-                <version>0.4.11</version>
-                <configuration>
-                    <verbose>true</verbose>
-                    <serverId>docker-hub</serverId>
-                    <imageName>${docker.push.registry}/onap/${project.artifactId}</imageName>
-                    <dockerDirectory>${docker.location}</dockerDirectory>
-                    <imageTags>
-                        <imageTag>latest</imageTag>
-                    </imageTags>
-                    <forceTags>true</forceTags>
-                </configuration>
-            </plugin>
-            <plugin>
-                <groupId>org.sonatype.plugins</groupId>
-                <artifactId>nexus-staging-maven-plugin</artifactId>
-                <version>1.6.7</version>
-                <extensions>true</extensions>
-                <configuration>
-                    <nexusUrl>${nexusproxy}</nexusUrl>
-                    <stagingProfileId>176c31dfe190a</stagingProfileId>
-                    <serverId>ecomp-staging</serverId>
-                </configuration>
-            </plugin>
-
-            <!-- This plugin is used to generate Java POJO's from json format schema
-                file. -->
-            <plugin>
-                <groupId>org.jsonschema2pojo</groupId>
-                <artifactId>jsonschema2pojo-maven-plugin</artifactId>
-                <version>0.4.26</version>
-                <configuration>
-                    <addCompileSourceRoot>true</addCompileSourceRoot>
-                    <sourceDirectory>${basedir}/src/main/resources/json/schema</sourceDirectory>
-                    <outputDirectory>${generatedSourceDir}</outputDirectory>
-                    <targetPackage>org.onap.aai.sa.rest</targetPackage>
-                </configuration>
-                <executions>
-                    <execution>
-                        <goals>
-                            <goal>generate</goal>
-                        </goals>
-                    </execution>
-                </executions>
-            </plugin>
-
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-resources-plugin</artifactId>
-                <version>2.7</version>
-                <executions>
-                    <execution>
-                        <id>copy-docker-file</id>
-                        <phase>package</phase>
-                        <goals>
-                            <goal>copy-resources</goal>
-                        </goals>
-                        <configuration>
-                            <outputDirectory>target</outputDirectory>
-                            <overwrite>true</overwrite>
-                            <resources>
-                                <resource>
-                                    <directory>${basedir}/src/main/docker</directory>
-                                    <filtering>true</filtering>
-                                    <includes>
-                                        <include>**/*</include>
-                                    </includes>
-                                </resource>
-                                <resource>
-                                    <directory>${basedir}</directory>
-                                    <filtering>true</filtering>
-                                    <includes>
-                                        <include>bundleconfig-local/**</include>
-                                    </includes>
-                                </resource>
-                                <resource>
-                                    <directory>${basedir}/src/main/bin/</directory>
-                                </resource>
-                            </resources>
-                        </configuration>
-                    </execution>
-                </executions>
-            </plugin>
-            <!-- license plugin -->
-            <plugin>
-                <groupId>com.mycila</groupId>
-                <artifactId>license-maven-plugin</artifactId>
-                <version>3.0</version>
-                <configuration>
-                    <header>License.txt</header>
-                    <includes>
-                        <include>src/main/java/**</include>
-                        <include>src/test/java/**</include>
-                        <include>pom.xml</include>
-                    </includes>
-                    <skipExistingHeaders>true</skipExistingHeaders>
-                </configuration>
-                <executions>
-                    <execution>
-                        <goals>
-                            <goal>check</goal>
-                        </goals>
-                        <phase>validate</phase>
-                    </execution>
-                </executions>
-            </plugin>
-
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-deploy-plugin</artifactId>
-                <configuration>
-                    <skip>true</skip>
-                </configuration>
-            </plugin>
-            <plugin>
-                <groupId>org.codehaus.mojo</groupId>
-                <artifactId>sonar-maven-plugin</artifactId>
-                <version>3.2</version>
-            </plugin>
-            <plugin>
-                <groupId>org.jacoco</groupId>
-                <artifactId>jacoco-maven-plugin</artifactId>
-                <version>0.7.7.201606060606</version>
-                <configuration>
-                    <dumpOnExit>true</dumpOnExit>
-                </configuration>
-                <executions>
-                    <execution>
-                        <id>jacoco-initialize-unit-tests</id>
-                        <goals>
-                            <goal>prepare-agent</goal>
-                        </goals>
-                        <configuration>
-                            <destFile>${project.build.directory}/coverage-reports/jacoco.exec
-                            </destFile>
-                            <!-- <append>true</append> -->
-                        </configuration>
-                    </execution>
-                </executions>
-            </plugin>
-
-            <!-- This plugin adds the generated sources directory to the clean lifecycle
-                so that automatically generated code will get cleaned up properly. -->
-            <plugin>
-                <artifactId>maven-clean-plugin</artifactId>
-                <version>3.0.0</version>
-                <configuration>
-                    <filesets>
-                        <fileset>
-                            <directory>${generatedSourceDir}</directory>
-                        </fileset>
-                    </filesets>
-                </configuration>
-            </plugin>
-        </plugins>
-    </build>
-    <distributionManagement>
-        <repository>
-            <id>ecomp-releases</id>
-            <name>ECOMP Release Repository</name>
-            <url>${nexusproxy}/content/repositories/releases/</url>
-        </repository>
-        <snapshotRepository>
-            <id>ecomp-snapshots</id>
-            <name>ECOMP Snapshot Repository</name>
-            <url>${nexusproxy}/content/repositories/snapshots/</url>
-        </snapshotRepository>
-        <site>
-            <id>ecomp-javadoc</id>
-            <url>dav:https://ecomp-nexus:8443/repository/aai/search-data-service-javadoc/${project.version}</url>
-        </site>
-    </distributionManagement>
-</project>
+       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>
+
+       <groupId>org.onap.aai</groupId>
+       <artifactId>search-data-service-agg</artifactId>
+       <name>aai-search-data-service aggregate pom</name>
+       <version>1.4.0-SNAPSHOT</version>
+       <packaging>pom</packaging>
+
+       <modules>
+               <module>search-data-service</module>
+               <module>elasticsearch-sg</module>
+       </modules>
+
+       <build>
+               <plugins>
+                       <plugin>
+                               <groupId>com.spotify</groupId>
+                               <artifactId>docker-maven-plugin</artifactId>
+                               <version>0.4.11</version>
+                               <configuration>
+                                       <skipDockerBuild>true</skipDockerBuild>
+                               </configuration>
+                       </plugin>
+               </plugins>
+       </build>
+
+</project>
\ No newline at end of file
similarity index 100%
rename from License.txt
rename to search-data-service/License.txt
diff --git a/search-data-service/pom.xml b/search-data-service/pom.xml
new file mode 100644 (file)
index 0000000..a270914
--- /dev/null
@@ -0,0 +1,461 @@
+<!--
+
+    ============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>
+
+       <parent>
+               <artifactId>spring-boot-starter-parent</artifactId>
+               <groupId>org.springframework.boot</groupId>
+               <version>1.5.18.RELEASE</version>
+       </parent>
+
+       <groupId>org.onap.aai</groupId>
+       <artifactId>search-data-service</artifactId>
+       <version>1.4.0-SNAPSHOT</version>
+       <name>aai-search-data-service</name>
+
+       <properties>
+               <docker.location>${basedir}/target</docker.location>
+               <nexusproxy>https://nexus.onap.org</nexusproxy>
+               <java.version>1.8</java.version>
+               <generatedSourceDir>${basedir}/src/main/java-gen</generatedSourceDir>
+               <checkstyle.config.location>google_checks.xml</checkstyle.config.location>
+
+               <sonar.language>java</sonar.language>
+               <sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
+               <sonar.surefire.reportsPath>${project.build.directory}/surefire-reports
+               </sonar.surefire.reportsPath>
+               <sonar.jacoco.reportPath>${project.build.directory}/coverage-reports/jacoco.exec
+               </sonar.jacoco.reportPath>
+               <sonar.jacoco.reportMissing.force.zero>false</sonar.jacoco.reportMissing.force.zero>
+               <sonar.projectVersion>${project.version}</sonar.projectVersion>
+       </properties>
+
+       <dependencies>
+
+               <dependency>
+                       <groupId>com.google.code.gson</groupId>
+                       <artifactId>gson</artifactId>
+               </dependency>
+
+               <dependency>
+                       <groupId>org.hamcrest</groupId>
+                       <artifactId>hamcrest-library</artifactId>
+                       <scope>test</scope>
+               </dependency>
+
+               <dependency>
+                       <groupId>com.jayway.jsonpath</groupId>
+                       <artifactId>json-path</artifactId>
+               </dependency>
+
+               <dependency>
+                       <groupId>com.googlecode.json-simple</groupId>
+                       <artifactId>json-simple</artifactId>
+               </dependency>
+
+               <dependency>
+                       <groupId>org.dom4j</groupId>
+                       <artifactId>dom4j</artifactId>
+                       <version>2.1.1</version>
+                       <scope>provided</scope>
+               </dependency>
+
+               <dependency>
+                       <groupId>commons-io</groupId>
+                       <artifactId>commons-io</artifactId>
+                       <version>2.4</version>
+               </dependency>
+
+               <dependency>
+                       <groupId>org.mockito</groupId>
+                       <artifactId>mockito-all</artifactId>
+                       <version>1.10.19</version>
+                       <scope>test</scope>
+               </dependency>
+
+        <!-- Common logging framework -->
+               <dependency>
+                       <groupId>org.onap.aai.logging-service</groupId>
+                       <artifactId>common-logging</artifactId>
+                       <version>1.2.2</version>
+               </dependency>
+
+               <dependency>
+                       <groupId>org.onap.aai.logging-service</groupId>
+                       <artifactId>logging-api</artifactId>
+                       <version>1.2.2</version>
+               </dependency>
+
+               <dependency>
+                       <groupId>org.onap.aai.logging-service</groupId>
+                       <artifactId>eelf-logging</artifactId>
+                       <version>1.2.2</version>
+               </dependency>
+
+        <!-- For JSON Mapping Support. -->
+               <dependency>
+                       <groupId>com.fasterxml.jackson.core</groupId>
+                       <artifactId>jackson-databind</artifactId>
+               </dependency>
+
+               <dependency>
+                       <groupId>org.apache.directory.studio</groupId>
+                       <artifactId>org.apache.commons.lang</artifactId>
+                       <version>2.6</version>
+               </dependency>
+
+               <dependency>
+                       <groupId>radeox</groupId>
+                       <artifactId>radeox</artifactId>
+                       <version>0.9</version>
+               </dependency>
+
+               <dependency>
+                       <groupId>com.github.fge</groupId>
+                       <artifactId>json-schema-validator</artifactId>
+                       <version>2.0.0</version>
+               </dependency>
+
+               <dependency>
+                       <groupId>org.json</groupId>
+                       <artifactId>json</artifactId>
+                       <version>20180130</version>
+               </dependency>
+
+               <dependency>
+                       <groupId>org.springframework.boot</groupId>
+                       <artifactId>spring-boot-starter-web</artifactId>
+                       <exclusions>
+                               <exclusion>
+                                       <groupId>org.springframework.boot</groupId>
+                                       <artifactId>spring-boot-starter-tomcat</artifactId>
+                               </exclusion>
+                       </exclusions>
+               </dependency>
+
+               <dependency>
+                       <groupId>org.springframework.boot</groupId>
+                       <artifactId>spring-boot-starter-jetty</artifactId>
+               </dependency>
+
+               <dependency>
+                       <groupId>org.springframework.boot</groupId>
+                       <artifactId>spring-boot-starter</artifactId>
+                       <exclusions>
+                               <exclusion>
+                                       <groupId>ch.qos.logback</groupId>
+                                       <artifactId>logback-classic</artifactId>
+                               </exclusion>
+                       </exclusions>
+               </dependency>
+
+               <dependency>
+                       <groupId>org.springframework.boot</groupId>
+                       <artifactId>spring-boot-starter-jersey</artifactId>
+                       <exclusions>
+                               <exclusion>
+                                       <groupId>org.springframework.boot</groupId>
+                                       <artifactId>spring-boot-starter-tomcat</artifactId>
+                               </exclusion>
+                       </exclusions>
+               </dependency>
+
+               <dependency>
+                       <groupId>org.springframework.boot</groupId>
+                       <artifactId>spring-boot-starter-actuator</artifactId>
+               </dependency>
+
+               <dependency>
+                       <groupId>org.springframework.boot</groupId>
+                       <artifactId>spring-boot-starter-test</artifactId>
+                       <scope>test</scope>
+               </dependency>
+
+               <dependency>
+                       <groupId>org.springframework.boot</groupId>
+                       <artifactId>spring-boot-starter-security</artifactId>
+               </dependency>
+
+        <!--Logback classic-->
+               <dependency>
+                       <groupId>ch.qos.logback</groupId>
+                       <artifactId>logback-classic</artifactId>
+               </dependency>
+
+               <dependency>
+                       <groupId>ch.qos.logback</groupId>
+                       <artifactId>logback-core</artifactId>
+               </dependency>
+
+       </dependencies>
+
+       <repositories>
+               <repository>
+                       <id>central</id>
+                       <name>Maven 2 repository 2</name>
+                       <url>http://repo2.maven.org/maven2/</url>
+               </repository>
+               <repository>
+                       <id>ecomp-releases</id>
+                       <name>ECOMP Release Repository</name>
+                       <url>${nexusproxy}/content/repositories/releases/</url>
+               </repository>
+               <repository>
+                       <id>ecomp-snapshots</id>
+                       <name>ECOMP Snapshot Repository</name>
+                       <url>${nexusproxy}/content/repositories/snapshots/</url>
+               </repository>
+               <repository>
+                       <id>ecomp-staging</id>
+                       <name>ECOMP Staging Repository</name>
+                       <url>${nexusproxy}/content/repositories/staging/</url>
+               </repository>
+       </repositories>
+
+       <build>
+               <finalName>search-data-service-package</finalName>
+               <plugins>
+                       <plugin>
+                               <groupId>org.springframework.boot</groupId>
+                               <artifactId>spring-boot-maven-plugin</artifactId>
+                       </plugin>
+            <!-- Checkstyle plugin - used to report on compliance with -->
+            <!-- the Google style guide. -->
+                       <plugin>
+                               <groupId>org.apache.maven.plugins</groupId>
+                               <artifactId>maven-site-plugin</artifactId>
+                               <configuration>
+                                       <reportPlugins>
+                                               <plugin>
+                                                       <groupId>org.apache.maven.plugins</groupId>
+                                                       <artifactId>maven-checkstyle-plugin</artifactId>
+                                                       <version>2.17</version>
+                                                       <reportSets>
+                                                               <reportSet>
+                                                                       <reports>
+                                                                               <report>checkstyle</report>
+                                                                       </reports>
+                                                               </reportSet>
+                                                       </reportSets>
+                                               </plugin>
+                                       </reportPlugins>
+                               </configuration>
+                       </plugin>
+            <!-- This plugin overrides the compiler settings to use java 1.8 -->
+                       <plugin>
+                               <groupId>org.apache.maven.plugins</groupId>
+                               <artifactId>maven-compiler-plugin</artifactId>
+                               <configuration>
+                                       <compilerId>groovy-eclipse-compiler</compilerId>
+                                       <verbose>true</verbose>
+                                       <source>1.8</source>
+                                       <target>1.8</target>
+                               </configuration>
+                               <dependencies>
+                                       <dependency>
+                                               <groupId>org.codehaus.groovy</groupId>
+                                               <artifactId>groovy-eclipse-compiler</artifactId>
+                                               <version>2.9.0-01</version>
+                                       </dependency>
+                                       <dependency>
+                                               <groupId>org.codehaus.groovy</groupId>
+                                               <artifactId>groovy-eclipse-batch</artifactId>
+                                               <version>2.3.4-01</version>
+                                       </dependency>
+                               </dependencies>
+                       </plugin>
+                       <plugin>
+                               <groupId>com.spotify</groupId>
+                               <artifactId>docker-maven-plugin</artifactId>
+                               <version>0.4.11</version>
+                               <configuration>
+                                       <verbose>true</verbose>
+                                       <serverId>docker-hub</serverId>
+                                       <imageName>${docker.push.registry}/onap/${project.artifactId}</imageName>
+                                       <dockerDirectory>${docker.location}</dockerDirectory>
+                                       <imageTags>
+                                               <imageTag>latest</imageTag>
+                                       </imageTags>
+                                       <forceTags>true</forceTags>
+                               </configuration>
+                       </plugin>
+                       <plugin>
+                               <groupId>org.sonatype.plugins</groupId>
+                               <artifactId>nexus-staging-maven-plugin</artifactId>
+                               <version>1.6.7</version>
+                               <extensions>true</extensions>
+                               <configuration>
+                                       <nexusUrl>${nexusproxy}</nexusUrl>
+                                       <stagingProfileId>176c31dfe190a</stagingProfileId>
+                                       <serverId>ecomp-staging</serverId>
+                               </configuration>
+                       </plugin>
+
+            <!-- This plugin is used to generate Java POJO's from json format schema
+                file. -->
+                       <plugin>
+                               <groupId>org.jsonschema2pojo</groupId>
+                               <artifactId>jsonschema2pojo-maven-plugin</artifactId>
+                               <version>0.4.26</version>
+                               <configuration>
+                                       <addCompileSourceRoot>true</addCompileSourceRoot>
+                                       <sourceDirectory>${basedir}/src/main/resources/json/schema</sourceDirectory>
+                                       <outputDirectory>${generatedSourceDir}</outputDirectory>
+                                       <targetPackage>org.onap.aai.sa.rest</targetPackage>
+                               </configuration>
+                               <executions>
+                                       <execution>
+                                               <goals>
+                                                       <goal>generate</goal>
+                                               </goals>
+                                       </execution>
+                               </executions>
+                       </plugin>
+
+                       <plugin>
+                               <groupId>org.apache.maven.plugins</groupId>
+                               <artifactId>maven-resources-plugin</artifactId>
+                               <executions>
+                                       <execution>
+                                               <id>copy-docker-file</id>
+                                               <phase>package</phase>
+                                               <goals>
+                                                       <goal>copy-resources</goal>
+                                               </goals>
+                                               <configuration>
+                                                       <outputDirectory>target</outputDirectory>
+                                                       <overwrite>true</overwrite>
+                                                       <resources>
+                                                               <resource>
+                                                                       <directory>${basedir}/src/main/docker</directory>
+                                                                       <filtering>true</filtering>
+                                                                       <includes>
+                                                                               <include>**/*</include>
+                                                                       </includes>
+                                                               </resource>
+                                                               <resource>
+                                                                       <directory>${basedir}</directory>
+                                                                       <filtering>true</filtering>
+                                                                       <includes>
+                                                                               <include>bundleconfig-local/**</include>
+                                                                       </includes>
+                                                               </resource>
+                                                               <resource>
+                                                                       <directory>${basedir}/src/main/bin/</directory>
+                                                               </resource>
+                                                       </resources>
+                                               </configuration>
+                                       </execution>
+                               </executions>
+                       </plugin>
+            <!-- license plugin -->
+                       <plugin>
+                               <groupId>com.mycila</groupId>
+                               <artifactId>license-maven-plugin</artifactId>
+                               <version>3.0</version>
+                               <configuration>
+                                       <header>License.txt</header>
+                                       <includes>
+                                               <include>src/main/java/**</include>
+                                               <include>src/test/java/**</include>
+                                               <include>pom.xml</include>
+                                       </includes>
+                                       <skipExistingHeaders>true</skipExistingHeaders>
+                               </configuration>
+                               <executions>
+                                       <execution>
+                                               <goals>
+                                                       <goal>check</goal>
+                                               </goals>
+                                               <phase>validate</phase>
+                                       </execution>
+                               </executions>
+                       </plugin>
+
+                       <plugin>
+                               <groupId>org.apache.maven.plugins</groupId>
+                               <artifactId>maven-deploy-plugin</artifactId>
+                               <configuration>
+                                       <skip>true</skip>
+                               </configuration>
+                       </plugin>
+                       <plugin>
+                               <groupId>org.codehaus.mojo</groupId>
+                               <artifactId>sonar-maven-plugin</artifactId>
+                               <version>3.2</version>
+                       </plugin>
+                       <plugin>
+                               <groupId>org.jacoco</groupId>
+                               <artifactId>jacoco-maven-plugin</artifactId>
+                               <version>0.7.7.201606060606</version>
+                               <configuration>
+                                       <dumpOnExit>true</dumpOnExit>
+                               </configuration>
+                               <executions>
+                                       <execution>
+                                               <id>jacoco-initialize-unit-tests</id>
+                                               <goals>
+                                                       <goal>prepare-agent</goal>
+                                               </goals>
+                                               <configuration>
+                                                       <destFile>${project.build.directory}/coverage-reports/jacoco.exec
+                                                       </destFile>
+                            <!-- <append>true</append> -->
+                                               </configuration>
+                                       </execution>
+                               </executions>
+                       </plugin>
+
+            <!-- This plugin adds the generated sources directory to the clean lifecycle
+                so that automatically generated code will get cleaned up properly. -->
+                       <plugin>
+                               <artifactId>maven-clean-plugin</artifactId>
+                               <configuration>
+                                       <filesets>
+                                               <fileset>
+                                                       <directory>${generatedSourceDir}</directory>
+                                               </fileset>
+                                       </filesets>
+                               </configuration>
+                       </plugin>
+               </plugins>
+       </build>
+       <distributionManagement>
+               <repository>
+                       <id>ecomp-releases</id>
+                       <name>ECOMP Release Repository</name>
+                       <url>${nexusproxy}/content/repositories/releases/</url>
+               </repository>
+               <snapshotRepository>
+                       <id>ecomp-snapshots</id>
+                       <name>ECOMP Snapshot Repository</name>
+                       <url>${nexusproxy}/content/repositories/snapshots/</url>
+               </snapshotRepository>
+               <site>
+                       <id>ecomp-javadoc</id>
+                       <url>dav:https://ecomp-nexus:8443/repository/aai/search-data-service-javadoc/${project.version}</url>
+               </site>
+       </distributionManagement>
+</project>
similarity index 96%
rename from src/main/docker/Dockerfile
rename to search-data-service/src/main/docker/Dockerfile
index ad402b2..1a70fd7 100644 (file)
@@ -14,7 +14,7 @@ RUN export JAVA_HOME
 # Build up the deployment folder structure
 RUN mkdir -p $MICRO_HOME
 RUN mkdir -p $MICRO_HOME/bundleconfig/etc
-ADD search-data-service* $MICRO_HOME/
+ADD *.jar $MICRO_HOME/
 RUN mkdir -p $BIN_HOME
 COPY *.sh $BIN_HOME
 COPY bundleconfig-local $MICRO_HOME/bundleconfig
@@ -1,58 +1,58 @@
-/**\r
- * ============LICENSE_START=======================================================\r
- * org.onap.aai\r
- * ================================================================================\r
- * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.\r
- * Copyright © 2017-2018 Amdocs\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- *       http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-package org.onap.aai.sa;\r
-\r
-import java.util.HashMap;\r
-import org.eclipse.jetty.util.security.Password;\r
-import org.springframework.boot.autoconfigure.SpringBootApplication;\r
-import org.springframework.boot.builder.SpringApplicationBuilder;\r
-import org.springframework.boot.web.support.SpringBootServletInitializer;\r
-\r
-@SpringBootApplication\r
-public class Application extends SpringBootServletInitializer {\r
-\r
-    public static void main(String[] args) {\r
-        String keyStorePassword = System.getProperty("KEY_STORE_PASSWORD");\r
-        if (keyStorePassword == null || keyStorePassword.isEmpty()) {\r
-            throw new RuntimeException("Env property KEY_STORE_PASSWORD not set");\r
-        }\r
-        HashMap<String, Object> props = new HashMap<>();\r
-        String deobfuscatedKeyStorePassword = keyStorePassword.startsWith("OBF:") ? Password.deobfuscate(keyStorePassword) : keyStorePassword;\r
-        props.put("server.ssl.key-store-password", deobfuscatedKeyStorePassword);\r
-\r
-        String trustStoreLocation = System.getProperty("TRUST_STORE_LOCATION");\r
-        String trustStorePassword = System.getProperty("TRUST_STORE_PASSWORD");\r
-        if (trustStoreLocation != null && trustStorePassword != null) {\r
-            trustStorePassword = trustStorePassword.startsWith("OBF:") ? Password.deobfuscate(trustStorePassword) : trustStorePassword;\r
-            props.put("server.ssl.trust-store", trustStoreLocation);\r
-            props.put("server.ssl.trust-store-password", trustStorePassword);\r
-        }\r
-\r
-        String requireClientAuth = System.getenv("REQUIRE_CLIENT_AUTH");\r
-        if (requireClientAuth == null || requireClientAuth.isEmpty()) {\r
-            props.put("server.ssl.client-auth", "need");\r
-        }else {\r
-            props.put("server.ssl.client-auth", Boolean.valueOf(requireClientAuth)? "need" : "want");\r
-        }\r
-               \r
-        new Application().configure(new SpringApplicationBuilder(Application.class).properties(props)).run(args);\r
-    }\r
-}\r
+/**
+ * ============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=========================================================
+ */
+package org.onap.aai.sa;
+
+import java.util.HashMap;
+import org.eclipse.jetty.util.security.Password;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.builder.SpringApplicationBuilder;
+import org.springframework.boot.web.support.SpringBootServletInitializer;
+
+@SpringBootApplication
+public class Application extends SpringBootServletInitializer {
+
+    public static void main(String[] args) {
+        String keyStorePassword = System.getProperty("KEY_STORE_PASSWORD");
+        if (keyStorePassword == null || keyStorePassword.isEmpty()) {
+            throw new RuntimeException("Env property KEY_STORE_PASSWORD not set");
+        }
+        HashMap<String, Object> props = new HashMap<>();
+        String deobfuscatedKeyStorePassword = keyStorePassword.startsWith("OBF:") ? Password.deobfuscate(keyStorePassword) : keyStorePassword;
+        props.put("server.ssl.key-store-password", deobfuscatedKeyStorePassword);
+
+        String trustStoreLocation = System.getProperty("TRUST_STORE_LOCATION");
+        String trustStorePassword = System.getProperty("TRUST_STORE_PASSWORD");
+        if (trustStoreLocation != null && trustStorePassword != null) {
+            trustStorePassword = trustStorePassword.startsWith("OBF:") ? Password.deobfuscate(trustStorePassword) : trustStorePassword;
+            props.put("server.ssl.trust-store", trustStoreLocation);
+            props.put("server.ssl.trust-store-password", trustStorePassword);
+        }
+
+        String requireClientAuth = System.getenv("REQUIRE_CLIENT_AUTH");
+        if (requireClientAuth == null || requireClientAuth.isEmpty()) {
+            props.put("server.ssl.client-auth", "need");
+        }else {
+            props.put("server.ssl.client-auth", Boolean.valueOf(requireClientAuth)? "need" : "want");
+        }
+               
+        new Application().configure(new SpringApplicationBuilder(Application.class).properties(props)).run(args);
+    }
+}
@@ -1,4 +1,4 @@
-server.ssl.key-store=/opt/app/search-data-service/config/auth/tomcat_keystore\r
-server.ssl.enabled=true\r
-server.port=9509\r
-server.ssl.enabled-protocols=TLSv1.1,TLSv1.2\r
+server.ssl.key-store=/opt/app/search-data-service/config/auth/tomcat_keystore
+server.ssl.enabled=true
+server.port=9509
+server.ssl.enabled-protocols=TLSv1.1,TLSv1.2
@@ -1,86 +1,86 @@
-/**\r
- * ============LICENSE_START=======================================================\r
- * org.onap.aai\r
- * ================================================================================\r
- * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.\r
- * Copyright © 2017-2018 Amdocs\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- *       http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-package org.onap.aai.sa.auth;\r
-\r
-import java.io.File;\r
-import java.io.IOException;\r
-import java.lang.reflect.Field;\r
-import java.lang.reflect.Modifier;\r
-import org.junit.Assert;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-import org.mockito.Mock;\r
-import org.mockito.MockitoAnnotations;\r
-import org.onap.aai.sa.searchdbabstraction.util.SearchDbConstants;\r
-import org.springframework.http.HttpHeaders;\r
-\r
-// import javax.servlet.http.Cookie;\r
-\r
-public class SearchDbServiceAuthTest {\r
-\r
-    @Mock\r
-    HttpHeaders headers;\r
-\r
-    // @Mock\r
-    // Cookie mockedCookie;\r
-\r
-    @Before\r
-    public void setUp() throws NoSuchFieldException, IllegalAccessException, IOException {\r
-        MockitoAnnotations.initMocks(this);\r
-        System.setProperty("AJSC_HOME", new File(".").getCanonicalPath().replace('\\', '/'));\r
-        setFinalStatic(System.getProperty("AJSC_HOME") + "/src/test/resources/json/search_policy.json");\r
-    }\r
-\r
-    @Test\r
-    public void testAuthUser() {\r
-        SearchDbServiceAuth aaiAuth = new SearchDbServiceAuth();\r
-        String auth = aaiAuth.authUser(headers, "user-1", "function-1");\r
-        Assert.assertEquals(auth, "AAI_9101");\r
-    }\r
-\r
-    // @Test\r
-    // public void testAuthCookie_NullCookie(){\r
-    // SearchDbServiceAuth aaiAuth = new SearchDbServiceAuth();\r
-    // Cookie cookie = null;\r
-    // Assert.assertFalse(aaiAuth.authCookie(cookie, "function-1", new StringBuilder("user-1")));\r
-    // }\r
-\r
-    // @Test\r
-    // public void testAuthCookie_NotNullCookie(){\r
-    // SearchDbServiceAuth aaiAuth = new SearchDbServiceAuth();\r
-    // Cookie cookie = new Cookie ( "TestCookie", "TestValue");\r
-    // // Cookie cookie = new Cookie ( "TestCookie", "TestValue" );\r
-    // boolean retValue = aaiAuth.authCookie(cookie, "GET:testFunction", new StringBuilder("testuser"));\r
-    // Assert.assertTrue(retValue);\r
-    // }\r
-\r
-    static void setFinalStatic(String fieldValue)\r
-            throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {\r
-        Field configField = SearchDbConstants.class.getDeclaredField("SDB_AUTH_CONFIG_FILENAME");\r
-        configField.setAccessible(true);\r
-\r
-        Field modifiersField = Field.class.getDeclaredField("modifiers");\r
-        modifiersField.setAccessible(true);\r
-        modifiersField.setInt(configField, configField.getModifiers() & ~Modifier.FINAL);\r
-\r
-        configField.set(null, fieldValue);\r
-    }\r
-}\r
+/**
+ * ============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=========================================================
+ */
+package org.onap.aai.sa.auth;
+
+import java.io.File;
+import java.io.IOException;
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.onap.aai.sa.searchdbabstraction.util.SearchDbConstants;
+import org.springframework.http.HttpHeaders;
+
+// import javax.servlet.http.Cookie;
+
+public class SearchDbServiceAuthTest {
+
+    @Mock
+    HttpHeaders headers;
+
+    // @Mock
+    // Cookie mockedCookie;
+
+    @Before
+    public void setUp() throws NoSuchFieldException, IllegalAccessException, IOException {
+        MockitoAnnotations.initMocks(this);
+        System.setProperty("AJSC_HOME", new File(".").getCanonicalPath().replace('\\', '/'));
+        setFinalStatic(System.getProperty("AJSC_HOME") + "/src/test/resources/json/search_policy.json");
+    }
+
+    @Test
+    public void testAuthUser() {
+        SearchDbServiceAuth aaiAuth = new SearchDbServiceAuth();
+        String auth = aaiAuth.authUser(headers, "user-1", "function-1");
+        Assert.assertEquals(auth, "AAI_9101");
+    }
+
+    // @Test
+    // public void testAuthCookie_NullCookie(){
+    // SearchDbServiceAuth aaiAuth = new SearchDbServiceAuth();
+    // Cookie cookie = null;
+    // Assert.assertFalse(aaiAuth.authCookie(cookie, "function-1", new StringBuilder("user-1")));
+    // }
+
+    // @Test
+    // public void testAuthCookie_NotNullCookie(){
+    // SearchDbServiceAuth aaiAuth = new SearchDbServiceAuth();
+    // Cookie cookie = new Cookie ( "TestCookie", "TestValue");
+    // // Cookie cookie = new Cookie ( "TestCookie", "TestValue" );
+    // boolean retValue = aaiAuth.authCookie(cookie, "GET:testFunction", new StringBuilder("testuser"));
+    // Assert.assertTrue(retValue);
+    // }
+
+    static void setFinalStatic(String fieldValue)
+            throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
+        Field configField = SearchDbConstants.class.getDeclaredField("SDB_AUTH_CONFIG_FILENAME");
+        configField.setAccessible(true);
+
+        Field modifiersField = Field.class.getDeclaredField("modifiers");
+        modifiersField.setAccessible(true);
+        modifiersField.setInt(configField, configField.getModifiers() & ~Modifier.FINAL);
+
+        configField.set(null, fieldValue);
+    }
+}
-/**\r
- * ============LICENSE_START=======================================================\r
- * org.onap.aai\r
- * ================================================================================\r
- * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.\r
- * Copyright © 2017-2018 Amdocs\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- *       http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-package org.onap.aai.sa.rest;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.junit.runner.RunWith;\r
-import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;\r
-import org.springframework.boot.test.context.SpringBootTest;\r
-import org.springframework.test.context.junit4.SpringRunner;\r
-\r
-@RunWith(SpringRunner.class)\r
-@SpringBootTest\r
-@AutoConfigureMockMvc\r
-public class BulkRequestTest {\r
-\r
-    @Test\r
-    public void testBulkRequest_Delete() {\r
-        BulkRequest request = new BulkRequest();\r
-        BulkOperation operation = new BulkOperation();\r
-        Document document = new Document();\r
-        BulkMetaData metaData = getMetaData();\r
-        operation.setMetaData(metaData);\r
-        operation.setDocument(document);\r
-        Assert.assertNotNull(operation.getDocument());\r
-        Assert.assertNotNull(operation.getMetaData());\r
-        Assert.assertNotNull(operation.toString());\r
-\r
-        request.setDelete(operation);\r
-        Assert.assertNotNull(request.getDelete());\r
-        Assert.assertEquals(operation, request.getOperation());\r
-        Assert.assertEquals(BulkRequest.OperationType.DELETE, request.getOperationType());\r
-        Assert.assertTrue(request.toString().contains("delete:"));\r
-\r
-\r
-    }\r
-\r
-    @Test\r
-    public void testBulkRequest_Update() {\r
-        BulkRequest request = new BulkRequest();\r
-        BulkOperation operation = new BulkOperation();\r
-        Document document = new Document();\r
-        BulkMetaData metaData = getMetaData();\r
-        operation.setMetaData(metaData);\r
-        operation.setDocument(document);\r
-        Assert.assertNotNull(operation.getDocument());\r
-        Assert.assertNotNull(operation.getMetaData());\r
-        Assert.assertNotNull(operation.toString());\r
-\r
-        request.setUpdate(operation);\r
-        Assert.assertNotNull(request.getUpdate());\r
-        Assert.assertEquals(operation, request.getOperation());\r
-        Assert.assertEquals(BulkRequest.OperationType.UPDATE, request.getOperationType());\r
-        Assert.assertTrue(request.toString().contains("update:"));\r
-\r
-    }\r
-\r
-    @Test\r
-    public void testBulkRequest_Create() {\r
-        BulkRequest request = new BulkRequest();\r
-        BulkOperation operation = new BulkOperation();\r
-        Document document = new Document();\r
-        BulkMetaData metaData = getMetaData();\r
-        operation.setMetaData(metaData);\r
-        operation.setDocument(document);\r
-        Assert.assertNotNull(operation.getDocument());\r
-        Assert.assertNotNull(operation.getMetaData());\r
-        Assert.assertNotNull(operation.toString());\r
-\r
-        request.setCreate(operation);\r
-        Assert.assertNotNull(request.getCreate());\r
-        Assert.assertEquals(operation, request.getOperation());\r
-        Assert.assertEquals(BulkRequest.OperationType.CREATE, request.getOperationType());\r
-        Assert.assertTrue(request.toString().contains("create:"));\r
-\r
-    }\r
-\r
-    @Test\r
-    public void testBulkRequest_Undefined() {\r
-        BulkRequest request = new BulkRequest();\r
-        Assert.assertNull(request.getOperation());\r
-        Assert.assertNull(request.getOperationType());\r
-        Assert.assertEquals("UNDEFINED", request.toString());\r
-    }\r
-\r
-    @Test\r
-    public void testGetIndex() {\r
-        BulkRequest request = new BulkRequest();\r
-        BulkOperation operation = new BulkOperation();\r
-        BulkMetaData metaData = new BulkMetaData();\r
-        metaData.setUrl("/test/indexes/index1");\r
-        operation.setMetaData(metaData);\r
-        request.setCreate(operation);\r
-        String index = request.getIndex();\r
-        Assert.assertEquals(index, "index1");\r
-    }\r
-\r
-    @Test\r
-    public void testGetId() {\r
-        BulkRequest request = new BulkRequest();\r
-        BulkOperation operation = new BulkOperation();\r
-        BulkMetaData metaData = new BulkMetaData();\r
-        metaData.setUrl("/test/documents/document1");\r
-        operation.setMetaData(metaData);\r
-        request.setCreate(operation);\r
-        String index = request.getId();\r
-        Assert.assertEquals(index, "document1");\r
-    }\r
-\r
-    @Test\r
-    public void testApiUtils() {\r
-        Assert.assertEquals("services/search-data-service/v1/search/indexes/index1", ApiUtils.buildIndexUri("index1"));\r
-        Assert.assertEquals("services/search-data-service/v1/search/indexes/index1/documents/document1",\r
-                ApiUtils.buildDocumentUri("index1", "document1"));\r
-        Assert.assertTrue(ApiUtils.validateIndexUri("services/search-data-service/v1/search/indexes/index1"));\r
-        Assert.assertTrue(ApiUtils.validateDocumentUri(\r
-                "services/search-data-service/v1/search/indexes/index1/documents/document1", true));\r
-        Assert.assertTrue(ApiUtils.validateDocumentUri(\r
-                "services/search-data-service/v1/search/indexes/index1/documents/document1", false));\r
-    }\r
-\r
-    private BulkMetaData getMetaData() {\r
-        BulkMetaData metaData = new BulkMetaData();\r
-        metaData.setUrl("http://127.0.0.1");\r
-        metaData.setEtag("etag-1");\r
-        Assert.assertEquals(metaData.getUrl(), "http://127.0.0.1");\r
-        Assert.assertEquals(metaData.getEtag(), "etag-1");\r
-        Assert.assertNotNull(metaData.toString());\r
-        return metaData;\r
-    }\r
-}\r
+/**
+ * ============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=========================================================
+ */
+package org.onap.aai.sa.rest;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest
+@AutoConfigureMockMvc
+public class BulkRequestTest {
+
+    @Test
+    public void testBulkRequest_Delete() {
+        BulkRequest request = new BulkRequest();
+        BulkOperation operation = new BulkOperation();
+        Document document = new Document();
+        BulkMetaData metaData = getMetaData();
+        operation.setMetaData(metaData);
+        operation.setDocument(document);
+        Assert.assertNotNull(operation.getDocument());
+        Assert.assertNotNull(operation.getMetaData());
+        Assert.assertNotNull(operation.toString());
+
+        request.setDelete(operation);
+        Assert.assertNotNull(request.getDelete());
+        Assert.assertEquals(operation, request.getOperation());
+        Assert.assertEquals(BulkRequest.OperationType.DELETE, request.getOperationType());
+        Assert.assertTrue(request.toString().contains("delete:"));
+
+
+    }
+
+    @Test
+    public void testBulkRequest_Update() {
+        BulkRequest request = new BulkRequest();
+        BulkOperation operation = new BulkOperation();
+        Document document = new Document();
+        BulkMetaData metaData = getMetaData();
+        operation.setMetaData(metaData);
+        operation.setDocument(document);
+        Assert.assertNotNull(operation.getDocument());
+        Assert.assertNotNull(operation.getMetaData());
+        Assert.assertNotNull(operation.toString());
+
+        request.setUpdate(operation);
+        Assert.assertNotNull(request.getUpdate());
+        Assert.assertEquals(operation, request.getOperation());
+        Assert.assertEquals(BulkRequest.OperationType.UPDATE, request.getOperationType());
+        Assert.assertTrue(request.toString().contains("update:"));
+
+    }
+
+    @Test
+    public void testBulkRequest_Create() {
+        BulkRequest request = new BulkRequest();
+        BulkOperation operation = new BulkOperation();
+        Document document = new Document();
+        BulkMetaData metaData = getMetaData();
+        operation.setMetaData(metaData);
+        operation.setDocument(document);
+        Assert.assertNotNull(operation.getDocument());
+        Assert.assertNotNull(operation.getMetaData());
+        Assert.assertNotNull(operation.toString());
+
+        request.setCreate(operation);
+        Assert.assertNotNull(request.getCreate());
+        Assert.assertEquals(operation, request.getOperation());
+        Assert.assertEquals(BulkRequest.OperationType.CREATE, request.getOperationType());
+        Assert.assertTrue(request.toString().contains("create:"));
+
+    }
+
+    @Test
+    public void testBulkRequest_Undefined() {
+        BulkRequest request = new BulkRequest();
+        Assert.assertNull(request.getOperation());
+        Assert.assertNull(request.getOperationType());
+        Assert.assertEquals("UNDEFINED", request.toString());
+    }
+
+    @Test
+    public void testGetIndex() {
+        BulkRequest request = new BulkRequest();
+        BulkOperation operation = new BulkOperation();
+        BulkMetaData metaData = new BulkMetaData();
+        metaData.setUrl("/test/indexes/index1");
+        operation.setMetaData(metaData);
+        request.setCreate(operation);
+        String index = request.getIndex();
+        Assert.assertEquals(index, "index1");
+    }
+
+    @Test
+    public void testGetId() {
+        BulkRequest request = new BulkRequest();
+        BulkOperation operation = new BulkOperation();
+        BulkMetaData metaData = new BulkMetaData();
+        metaData.setUrl("/test/documents/document1");
+        operation.setMetaData(metaData);
+        request.setCreate(operation);
+        String index = request.getId();
+        Assert.assertEquals(index, "document1");
+    }
+
+    @Test
+    public void testApiUtils() {
+        Assert.assertEquals("services/search-data-service/v1/search/indexes/index1", ApiUtils.buildIndexUri("index1"));
+        Assert.assertEquals("services/search-data-service/v1/search/indexes/index1/documents/document1",
+                ApiUtils.buildDocumentUri("index1", "document1"));
+        Assert.assertTrue(ApiUtils.validateIndexUri("services/search-data-service/v1/search/indexes/index1"));
+        Assert.assertTrue(ApiUtils.validateDocumentUri(
+                "services/search-data-service/v1/search/indexes/index1/documents/document1", true));
+        Assert.assertTrue(ApiUtils.validateDocumentUri(
+                "services/search-data-service/v1/search/indexes/index1/documents/document1", false));
+    }
+
+    private BulkMetaData getMetaData() {
+        BulkMetaData metaData = new BulkMetaData();
+        metaData.setUrl("http://127.0.0.1");
+        metaData.setEtag("etag-1");
+        Assert.assertEquals(metaData.getUrl(), "http://127.0.0.1");
+        Assert.assertEquals(metaData.getEtag(), "etag-1");
+        Assert.assertNotNull(metaData.toString());
+        return metaData;
+    }
+}
-/**\r
- * ============LICENSE_START=======================================================\r
- * org.onap.aai\r
- * ================================================================================\r
- * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.\r
- * Copyright © 2017-2018 Amdocs\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- *       http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-package org.onap.aai.sa.rest;\r
-\r
-import com.fasterxml.jackson.core.JsonProcessingException;\r
-import javax.servlet.http.HttpServletRequest;\r
-import javax.servlet.http.HttpServletResponse;\r
-// import javax.ws.rs.core.HttpHeaders;\r
-import javax.ws.rs.core.MultivaluedMap;\r
-import org.junit.Assert;\r
-import org.junit.Before;\r
-import org.junit.Ignore;\r
-import org.junit.Test;\r
-import org.mockito.InjectMocks;\r
-import org.mockito.Mock;\r
-import org.mockito.Mockito;\r
-import org.mockito.MockitoAnnotations;\r
-import org.mockito.invocation.InvocationOnMock;\r
-import org.mockito.stubbing.Answer;\r
-import org.onap.aai.sa.searchdbabstraction.elasticsearch.config.ElasticSearchConfig;\r
-import org.onap.aai.sa.searchdbabstraction.elasticsearch.dao.DocumentStoreDataEntity;\r
-import org.onap.aai.sa.searchdbabstraction.elasticsearch.dao.DocumentStoreInterface;\r
-import org.onap.aai.sa.searchdbabstraction.elasticsearch.dao.ElasticSearchHttpController;\r
-import org.onap.aai.sa.searchdbabstraction.elasticsearch.exception.DocumentStoreOperationException;\r
-import org.onap.aai.sa.searchdbabstraction.entity.DocumentOperationResult;\r
-import org.onap.aai.sa.searchdbabstraction.entity.ErrorResult;\r
-import org.onap.aai.sa.searchdbabstraction.entity.SearchHits;\r
-import org.onap.aai.sa.searchdbabstraction.entity.SearchOperationResult;\r
-import org.springframework.http.HttpHeaders;\r
-import org.springframework.http.HttpStatus;\r
-import org.springframework.http.ResponseEntity;\r
-import java.util.Properties;\r
-\r
-\r
-public class DocumentTest {\r
-\r
-    @Mock\r
-    SearchServiceApi searchServiceApi;\r
-\r
-    @Mock\r
-    HttpServletRequest request;\r
-\r
-    @Mock\r
-    HttpHeaders headers;\r
-\r
-    @Mock\r
-    HttpServletResponse httpResponse;\r
-\r
-    @Mock\r
-    DocumentStoreInterface documentStore;\r
-\r
-    @Mock\r
-    MultivaluedMap<String, String> multivaluedMap;\r
-\r
-    @InjectMocks\r
-    IndexApi indexApi;\r
-\r
-    DocumentApi documentApi;\r
-\r
-    @Mock\r
-    ElasticSearchHttpController httpController;\r
-\r
-    @Before\r
-    public void setUp() {\r
-        MockitoAnnotations.initMocks(this);\r
-        documentApi = new DocumentApi(searchServiceApi);\r
-    }\r
-\r
-    @Test\r
-    public void testDocumentClass_AllMethods() throws JsonProcessingException {\r
-        Document doc = new Document();\r
-        doc.setField("name-1", "value-1");\r
-        Assert.assertTrue(doc.getFields().size() == 1);\r
-        Assert.assertTrue(doc.toJson().contains("value-1"));\r
-        Assert.assertNotNull(doc.toString());\r
-        Assert.assertTrue(doc.toString().contains("name-1"));\r
-    }\r
-\r
-    @Test\r
-    public void testProcessPost_NullContent() {\r
-        String transactionId = "transactionId-1";\r
-        String remoteAddr = "http://127.0.0.1";\r
-        String content = null;\r
-        // Mockito.when(headers.getRequestHeaders()).thenReturn(multivaluedMap);\r
-        Mockito.when(multivaluedMap.getFirst(Mockito.anyString())).thenReturn(transactionId);\r
-        Mockito.when(request.getRemoteAddr()).thenReturn(remoteAddr);\r
-        Mockito.when(request.getMethod()).thenReturn("testMethod");\r
-        Mockito.when(request.getRequestURL()).thenReturn(new StringBuffer("http://127.0.0.1"));\r
-        Mockito.when(request.getRemoteHost()).thenReturn("localhost");\r
-        ResponseEntity<String> response =\r
-                documentApi.processPost(content, request, headers, httpResponse, "index", documentStore);\r
-        Assert.assertNotNull(response);\r
-        Assert.assertTrue(HttpStatus.BAD_REQUEST.value() == response.getStatusCodeValue());\r
-    }\r
-\r
-    @SuppressWarnings("unchecked")\r
-    @Test\r
-    public void testProcessPost_NotNullContent() throws Exception {\r
-        String transactionId = "transactionId-1";\r
-        String remoteAddr = "http://127.0.0.1";\r
-        String content = "content";\r
-        // Mockito.when(headers.getRequestHeaders()).thenReturn(multivaluedMap);\r
-        Mockito.when(multivaluedMap.getFirst(Mockito.anyString())).thenReturn(transactionId);\r
-        Mockito.when(request.getRemoteAddr()).thenReturn(remoteAddr);\r
-        Mockito.when(request.getMethod()).thenReturn("testMethod");\r
-        Mockito.when(request.getRequestURL()).thenReturn(new StringBuffer("http://127.0.0.1"));\r
-        Mockito.when(request.getRemoteHost()).thenReturn("localhost");\r
-        Mockito.when(searchServiceApi.validateRequest(Mockito.any(HttpHeaders.class),\r
-                Mockito.any(HttpServletRequest.class), Mockito.any(ApiUtils.Action.class), Mockito.anyString()))\r
-                .thenThrow(IllegalArgumentException.class);\r
-        ResponseEntity<?> response =\r
-                documentApi.processPost(content, request, headers, httpResponse, "index", documentStore);\r
-        Assert.assertNotNull(response);\r
-        Assert.assertTrue(HttpStatus.FORBIDDEN.value() == response.getStatusCodeValue());\r
-    }\r
-\r
-    //\r
-    @Test\r
-    public void testProcessPost_ValidRequest() throws Exception {\r
-        String transactionId = "transactionId-1";\r
-        String remoteAddr = "http://127.0.0.1";\r
-        String content = "content";\r
-        DocumentOperationResult result = new DocumentOperationResult();\r
-        result.setResultCode(150);\r
-        result.setError(new ErrorResult("type-1", "reason-1"));\r
-        result.setFailureCause("test-failure");\r
-        // Mockito.when(headers.getRequestHeaders()).thenReturn(multivaluedMap);\r
-        Mockito.when(multivaluedMap.getFirst(Mockito.anyString())).thenReturn(transactionId);\r
-        Mockito.when(request.getRemoteAddr()).thenReturn(remoteAddr);\r
-        Mockito.when(request.getMethod()).thenReturn("testMethod");\r
-        Mockito.when(request.getRequestURL()).thenReturn(new StringBuffer("http://127.0.0.1"));\r
-        Mockito.when(request.getRemoteHost()).thenReturn("localhost");\r
-        Mockito.when(searchServiceApi.validateRequest(Mockito.any(HttpHeaders.class),\r
-                Mockito.any(HttpServletRequest.class), Mockito.any(ApiUtils.Action.class), Mockito.anyString()))\r
-                .thenReturn(true);\r
-        Mockito.when(documentStore.createDocument(Mockito.anyString(), Mockito.any(DocumentStoreDataEntity.class),\r
-                Mockito.anyBoolean())).thenReturn(result);\r
-        Mockito.doNothing().when(httpResponse).setHeader(Mockito.anyString(), Mockito.anyString());\r
-        ResponseEntity<String> response =\r
-                documentApi.processPost(content, request, headers, httpResponse, "index", documentStore);\r
-        Assert.assertNotNull(response);\r
-        Assert.assertTrue(HttpStatus.INTERNAL_SERVER_ERROR.value() == response.getStatusCodeValue());\r
-    }\r
-\r
-    //\r
-    @Test\r
-    public void testProcessSearchWithGet_Created() throws Exception {\r
-        String transactionId = "transactionId-1";\r
-        String remoteAddr = "http://127.0.0.1";\r
-        String content = "content";\r
-        SearchOperationResult result = new SearchOperationResult();\r
-        result.setResultCode(201);\r
-        SearchHits hits = new SearchHits();\r
-        hits.setTotalHits("2");\r
-        result.setSearchResult(hits);\r
-        // Mockito.when(headers.getRequestHeaders()).thenReturn(multivaluedMap);\r
-        Mockito.when(multivaluedMap.getFirst(Mockito.anyString())).thenReturn(transactionId);\r
-        Mockito.when(request.getRemoteAddr()).thenReturn(remoteAddr);\r
-        Mockito.when(request.getMethod()).thenReturn("testMethod");\r
-        Mockito.when(request.getRequestURL()).thenReturn(new StringBuffer("http://127.0.0.1"));\r
-        Mockito.when(request.getRemoteHost()).thenReturn("localhost");\r
-        Mockito.when(searchServiceApi.validateRequest(Mockito.any(HttpHeaders.class),\r
-                Mockito.any(HttpServletRequest.class), Mockito.any(ApiUtils.Action.class), Mockito.anyString()))\r
-                .thenReturn(true);\r
-        Mockito.when(documentStore.search(Mockito.anyString(), Mockito.anyString())).thenReturn(result);\r
-        ResponseEntity<String> response =\r
-                documentApi.processSearchWithGet(content, request, headers, "index-1", "query-text", documentStore);\r
-        Assert.assertNotNull(response);\r
-        Assert.assertTrue(HttpStatus.CREATED.value() == response.getStatusCodeValue());\r
-\r
-    }\r
-\r
-    @SuppressWarnings("unchecked")\r
-    @Test\r
-    public void testProcessSearchWithGet_ValidateThrowsException() throws Exception {\r
-        String transactionId = "transactionId-1";\r
-        String remoteAddr = "http://127.0.0.1";\r
-        String content = "content";\r
-        SearchOperationResult result = new SearchOperationResult();\r
-        result.setResultCode(201);\r
-        SearchHits hits = new SearchHits();\r
-        hits.setTotalHits("2");\r
-        result.setSearchResult(hits);\r
-        // Mockito.when(headers.getRequestHeaders()).thenReturn(multivaluedMap);\r
-        Mockito.when(multivaluedMap.getFirst(Mockito.anyString())).thenReturn(transactionId);\r
-        Mockito.when(request.getRemoteAddr()).thenReturn(remoteAddr);\r
-        Mockito.when(request.getMethod()).thenReturn("testMethod");\r
-        Mockito.when(request.getRequestURL()).thenReturn(new StringBuffer("http://127.0.0.1"));\r
-        Mockito.when(request.getRemoteHost()).thenReturn("localhost");\r
-        Mockito.when(searchServiceApi.validateRequest(Mockito.any(HttpHeaders.class),\r
-                Mockito.any(HttpServletRequest.class), Mockito.any(ApiUtils.Action.class), Mockito.anyString()))\r
-                .thenThrow(IllegalArgumentException.class);\r
-        Mockito.when(documentStore.search(Mockito.anyString(), Mockito.anyString())).thenReturn(result);\r
-        ResponseEntity<String> response =\r
-                documentApi.processSearchWithGet(content, request, headers, "index-1", "query-text", documentStore);\r
-        Assert.assertNotNull(response);\r
-        Assert.assertTrue(HttpStatus.FORBIDDEN.value() == response.getStatusCodeValue());\r
-\r
-    }\r
-\r
-    @Test\r
-    public void testProcessSearchWithGet_ValidateIsFalse() throws Exception {\r
-        String transactionId = "transactionId-1";\r
-        String remoteAddr = "http://127.0.0.1";\r
-        String content = "content";\r
-        SearchOperationResult result = new SearchOperationResult();\r
-        result.setResultCode(201);\r
-        SearchHits hits = new SearchHits();\r
-        hits.setTotalHits("2");\r
-        result.setSearchResult(hits);\r
-        // Mockito.when(headers.getRequestHeaders()).thenReturn(multivaluedMap);\r
-        Mockito.when(multivaluedMap.getFirst(Mockito.anyString())).thenReturn(transactionId);\r
-        Mockito.when(request.getRemoteAddr()).thenReturn(remoteAddr);\r
-        Mockito.when(request.getMethod()).thenReturn("testMethod");\r
-        Mockito.when(request.getRequestURL()).thenReturn(new StringBuffer("http://127.0.0.1"));\r
-        Mockito.when(request.getRemoteHost()).thenReturn("localhost");\r
-        Mockito.when(searchServiceApi.validateRequest(Mockito.any(HttpHeaders.class),\r
-                Mockito.any(HttpServletRequest.class), Mockito.any(ApiUtils.Action.class), Mockito.anyString()))\r
-                .thenReturn(false);\r
-        Mockito.when(documentStore.search(Mockito.anyString(), Mockito.anyString())).thenReturn(result);\r
-        ResponseEntity<String> response =\r
-                documentApi.processSearchWithGet(content, request, headers, "index-1", "query-text", documentStore);\r
-        Assert.assertNotNull(response);\r
-        Assert.assertTrue(HttpStatus.FORBIDDEN.value() == response.getStatusCodeValue());\r
-\r
-    }\r
-\r
-    @Test\r
-    public void testProcessSearchWithGet_InvalidResult() throws Exception {\r
-        String transactionId = "transactionId-1";\r
-        String remoteAddr = "http://127.0.0.1";\r
-        String content = "content";\r
-        SearchOperationResult result = new SearchOperationResult();\r
-        result.setResultCode(302);\r
-        SearchHits hits = new SearchHits();\r
-        hits.setTotalHits("2");\r
-        result.setSearchResult(hits);\r
-        // Mockito.when(headers.getRequestHeaders()).thenReturn(multivaluedMap);;\r
-        Mockito.when(multivaluedMap.getFirst(Mockito.anyString())).thenReturn(transactionId);\r
-        Mockito.when(request.getRemoteAddr()).thenReturn(remoteAddr);\r
-        Mockito.when(request.getMethod()).thenReturn("testMethod");\r
-        Mockito.when(request.getRequestURL()).thenReturn(new StringBuffer("http://127.0.0.1"));\r
-        Mockito.when(request.getRemoteHost()).thenReturn("localhost");\r
-        Mockito.when(searchServiceApi.validateRequest(Mockito.any(HttpHeaders.class),\r
-                Mockito.any(HttpServletRequest.class), Mockito.any(ApiUtils.Action.class), Mockito.anyString()))\r
-                .thenReturn(true);\r
-        Mockito.when(documentStore.search(Mockito.anyString(), Mockito.anyString())).thenReturn(result);\r
-        ResponseEntity<String> response =\r
-                documentApi.processSearchWithGet(content, request, headers, "index-1", "query-text", documentStore);\r
-        Assert.assertNotNull(response);\r
-        Assert.assertTrue(HttpStatus.FOUND.value() == response.getStatusCodeValue());\r
-\r
-    }\r
-\r
-    @Test\r
-    public void testProcessPut_NullContent() {\r
-        String transactionId = "transactionId-1";\r
-        String remoteAddr = "http://127.0.0.1";\r
-        String content = null;\r
-        // Mockito.when(headers.getRequestHeaders()).thenReturn(multivaluedMap);;\r
-        Mockito.when(multivaluedMap.getFirst(Mockito.anyString())).thenReturn(transactionId);\r
-        Mockito.when(request.getRemoteAddr()).thenReturn(remoteAddr);\r
-        Mockito.when(request.getMethod()).thenReturn("testMethod");\r
-        Mockito.when(request.getRequestURL()).thenReturn(new StringBuffer("http://127.0.0.1"));\r
-        Mockito.when(request.getRemoteHost()).thenReturn("localhost");\r
-        ResponseEntity<String> response =\r
-                documentApi.processPut(content, request, headers, httpResponse, "index", "id-1", documentStore);\r
-        Assert.assertNotNull(response);\r
-        Assert.assertTrue(HttpStatus.BAD_REQUEST.value() == response.getStatusCodeValue());\r
-    }\r
-\r
-    @SuppressWarnings("unchecked")\r
-    @Test\r
-    public void testProcessPut_RequestThrowsException() throws Exception {\r
-        String transactionId = "transactionId-1";\r
-        String remoteAddr = "http://127.0.0.1";\r
-        String content = "content";\r
-        // Mockito.when(headers.getRequestHeaders()).thenReturn(multivaluedMap);;\r
-        Mockito.when(multivaluedMap.getFirst(Mockito.anyString())).thenReturn(transactionId);\r
-        Mockito.when(request.getRemoteAddr()).thenReturn(remoteAddr);\r
-        Mockito.when(request.getMethod()).thenReturn("testMethod");\r
-        Mockito.when(request.getRequestURL()).thenReturn(new StringBuffer("http://127.0.0.1"));\r
-        Mockito.when(request.getRemoteHost()).thenReturn("localhost");\r
-        Mockito.when(searchServiceApi.validateRequest(Mockito.any(HttpHeaders.class),\r
-                Mockito.any(HttpServletRequest.class), Mockito.any(ApiUtils.Action.class), Mockito.anyString()))\r
-                .thenThrow(IllegalArgumentException.class);\r
-        ResponseEntity<String> response =\r
-                documentApi.processPut(content, request, headers, httpResponse, "index", "id-1", documentStore);\r
-        Assert.assertNotNull(response);\r
-        Assert.assertTrue(HttpStatus.FORBIDDEN.value() == response.getStatusCodeValue());\r
-    }\r
-\r
-    @Test\r
-    public void testProcessPut_RequestInvalid() throws Exception {\r
-        String transactionId = "transactionId-1";\r
-        String remoteAddr = "http://127.0.0.1";\r
-        String content = "content";\r
-        // Mockito.when(headers.getRequestHeaders()).thenReturn(multivaluedMap);;\r
-        Mockito.when(multivaluedMap.getFirst(Mockito.anyString())).thenReturn(transactionId);\r
-        Mockito.when(request.getRemoteAddr()).thenReturn(remoteAddr);\r
-        Mockito.when(request.getMethod()).thenReturn("testMethod");\r
-        Mockito.when(request.getRequestURL()).thenReturn(new StringBuffer("http://127.0.0.1"));\r
-        Mockito.when(request.getRemoteHost()).thenReturn("localhost");\r
-        Mockito.when(searchServiceApi.validateRequest(Mockito.any(HttpHeaders.class),\r
-                Mockito.any(HttpServletRequest.class), Mockito.any(ApiUtils.Action.class), Mockito.anyString()))\r
-                .thenReturn(false);\r
-        ResponseEntity<String> response =\r
-                documentApi.processPut(content, request, headers, httpResponse, "index", "id-1", documentStore);\r
-        Assert.assertNotNull(response);\r
-        Assert.assertTrue(HttpStatus.FORBIDDEN.value() == response.getStatusCodeValue());\r
-    }\r
-\r
-    @Test\r
-    public void testProcessPut_ResultInvalid() throws Exception {\r
-        String transactionId = "transactionId-1";\r
-        String remoteAddr = "http://127.0.0.1";\r
-        String content = "content";\r
-        DocumentOperationResult result = new DocumentOperationResult();\r
-        result.setResultCode(302);\r
-        result.setError(new ErrorResult("type-1", "reason-1"));\r
-        result.setFailureCause("test-failure");\r
-        // Mockito.when(headers.getRequestHeaders()).thenReturn(multivaluedMap);;\r
-        Mockito.when(multivaluedMap.getFirst(Mockito.anyString())).thenReturn(transactionId);\r
-        Mockito.when(request.getRemoteAddr()).thenReturn(remoteAddr);\r
-        Mockito.when(request.getMethod()).thenReturn("testMethod");\r
-        Mockito.when(request.getRequestURL()).thenReturn(new StringBuffer("http://127.0.0.1"));\r
-        Mockito.when(request.getRemoteHost()).thenReturn("localhost");\r
-        Mockito.when(searchServiceApi.validateRequest(Mockito.any(HttpHeaders.class),\r
-                Mockito.any(HttpServletRequest.class), Mockito.any(ApiUtils.Action.class), Mockito.anyString()))\r
-                .thenReturn(true);\r
-        Mockito.when(documentStore.createDocument(Mockito.anyString(), Mockito.any(DocumentStoreDataEntity.class),\r
-                Mockito.anyBoolean())).thenReturn(result);\r
-        ResponseEntity<String> response =\r
-                documentApi.processPut(content, request, headers, httpResponse, "index", "id-1", documentStore);\r
-        Assert.assertNotNull(response);\r
-        Assert.assertTrue(HttpStatus.FOUND.value() == response.getStatusCodeValue());\r
-    }\r
-\r
-    @SuppressWarnings("unchecked")\r
-    @Test\r
-    public void testProcessDelete_RequestThrowsException() throws Exception {\r
-        String transactionId = "transactionId-1";\r
-        String remoteAddr = "http://127.0.0.1";\r
-        String content = "content";\r
-        // Mockito.when(headers.getRequestHeaders()).thenReturn(multivaluedMap);;\r
-        Mockito.when(multivaluedMap.getFirst(Mockito.anyString())).thenReturn(transactionId);\r
-        Mockito.when(request.getRemoteAddr()).thenReturn(remoteAddr);\r
-        Mockito.when(request.getMethod()).thenReturn("testMethod");\r
-        Mockito.when(request.getRequestURL()).thenReturn(new StringBuffer("http://127.0.0.1"));\r
-        Mockito.when(request.getRemoteHost()).thenReturn("localhost");\r
-        Mockito.when(searchServiceApi.validateRequest(Mockito.any(HttpHeaders.class),\r
-                Mockito.any(HttpServletRequest.class), Mockito.any(ApiUtils.Action.class), Mockito.anyString()))\r
-                .thenThrow(IllegalArgumentException.class);\r
-        ResponseEntity<String> response =\r
-                documentApi.processDelete(content, request, headers, httpResponse, "index", "id-1", documentStore);\r
-        Assert.assertNotNull(response);\r
-        Assert.assertTrue(HttpStatus.FORBIDDEN.value() == response.getStatusCodeValue());\r
-    }\r
-\r
-    @Test\r
-    public void testProcessDelete_RequestInvalid() throws Exception {\r
-        String transactionId = "transactionId-1";\r
-        String remoteAddr = "http://127.0.0.1";\r
-        String content = "content";\r
-        // Mockito.when(headers.getRequestHeaders()).thenReturn(multivaluedMap);;\r
-        Mockito.when(multivaluedMap.getFirst(Mockito.anyString())).thenReturn(transactionId);\r
-        Mockito.when(request.getRemoteAddr()).thenReturn(remoteAddr);\r
-        Mockito.when(request.getMethod()).thenReturn("testMethod");\r
-        Mockito.when(request.getRequestURL()).thenReturn(new StringBuffer("http://127.0.0.1"));\r
-        Mockito.when(request.getRemoteHost()).thenReturn("localhost");\r
-        Mockito.when(searchServiceApi.validateRequest(Mockito.any(HttpHeaders.class),\r
-                Mockito.any(HttpServletRequest.class), Mockito.any(ApiUtils.Action.class), Mockito.anyString()))\r
-                .thenReturn(false);\r
-        ResponseEntity<String> response =\r
-                documentApi.processDelete(content, request, headers, httpResponse, "index", "id-1", documentStore);\r
-        Assert.assertNotNull(response);\r
-        Assert.assertTrue(HttpStatus.FORBIDDEN.value() == response.getStatusCodeValue());\r
-    }\r
-\r
-    @Ignore\r
-    @Test\r
-    public void testProcessDelete_ResultInvalid() throws Exception {\r
-        String transactionId = "transactionId-1";\r
-        String remoteAddr = "http://127.0.0.1";\r
-        String content = "content";\r
-        DocumentOperationResult result = new DocumentOperationResult();\r
-        result.setResultCode(302);\r
-        result.setError(new ErrorResult("type-1", "reason-1"));\r
-        result.setFailureCause("test-failure");\r
-        // Mockito.when(headers.getRequestHeaders()).thenReturn(multivaluedMap);;\r
-        Mockito.when(multivaluedMap.getFirst(Mockito.anyString())).thenReturn(transactionId);\r
-        Mockito.when(request.getRemoteAddr()).thenReturn(remoteAddr);\r
-        Mockito.when(request.getMethod()).thenReturn("testMethod");\r
-        Mockito.when(request.getRequestURL()).thenReturn(new StringBuffer("http://127.0.0.1"));\r
-        Mockito.when(request.getRemoteHost()).thenReturn("localhost");\r
-        Mockito.when(searchServiceApi.validateRequest(Mockito.any(HttpHeaders.class),\r
-                Mockito.any(HttpServletRequest.class), Mockito.any(ApiUtils.Action.class), Mockito.anyString()))\r
-                .thenReturn(true);\r
-        Mockito.when(documentStore.deleteDocument(Mockito.anyString(), Mockito.any(DocumentStoreDataEntity.class)))\r
-                .thenReturn(result);\r
-        ResponseEntity<String> response =\r
-                documentApi.processDelete(content, request, headers, httpResponse, "index", "id-1", documentStore);\r
-        Assert.assertNotNull(response);\r
-        Assert.assertTrue(HttpStatus.FOUND.value() == response.getStatusCodeValue());\r
-    }\r
-\r
-    @SuppressWarnings("unchecked")\r
-    @Test\r
-    public void testProcessGet_RequestThrowsException() throws Exception {\r
-        String transactionId = "transactionId-1";\r
-        String remoteAddr = "http://127.0.0.1";\r
-        String content = "content";\r
-        // Mockito.when(headers.getRequestHeaders()).thenReturn(multivaluedMap);;\r
-        Mockito.when(multivaluedMap.getFirst(Mockito.anyString())).thenReturn(transactionId);\r
-        Mockito.when(request.getRemoteAddr()).thenReturn(remoteAddr);\r
-        Mockito.when(request.getMethod()).thenReturn("testMethod");\r
-        Mockito.when(request.getRequestURL()).thenReturn(new StringBuffer("http://127.0.0.1"));\r
-        Mockito.when(request.getRemoteHost()).thenReturn("localhost");\r
-        Mockito.when(searchServiceApi.validateRequest(Mockito.any(HttpHeaders.class),\r
-                Mockito.any(HttpServletRequest.class), Mockito.any(ApiUtils.Action.class), Mockito.anyString()))\r
-                .thenThrow(IllegalArgumentException.class);\r
-        ResponseEntity<String> response =\r
-                documentApi.processGet(content, request, headers, httpResponse, "index", "id-1", documentStore);\r
-        Assert.assertNotNull(response);\r
-        Assert.assertTrue(HttpStatus.FORBIDDEN.value() == response.getStatusCodeValue());\r
-    }\r
-\r
-    @Test\r
-    public void testProcessGet_RequestInvalid() throws Exception {\r
-        String transactionId = "transactionId-1";\r
-        String remoteAddr = "http://127.0.0.1";\r
-        String content = "content";\r
-        // Mockito.when(headers.getRequestHeaders()).thenReturn(multivaluedMap);;\r
-        Mockito.when(multivaluedMap.getFirst(Mockito.anyString())).thenReturn(transactionId);\r
-        Mockito.when(request.getRemoteAddr()).thenReturn(remoteAddr);\r
-        Mockito.when(request.getMethod()).thenReturn("testMethod");\r
-        Mockito.when(request.getRequestURL()).thenReturn(new StringBuffer("http://127.0.0.1"));\r
-        Mockito.when(request.getRemoteHost()).thenReturn("localhost");\r
-        Mockito.when(searchServiceApi.validateRequest(Mockito.any(HttpHeaders.class),\r
-                Mockito.any(HttpServletRequest.class), Mockito.any(ApiUtils.Action.class), Mockito.anyString()))\r
-                .thenReturn(false);\r
-        ResponseEntity<String> response =\r
-                documentApi.processGet(content, request, headers, httpResponse, "index", "id-1", documentStore);\r
-        Assert.assertNotNull(response);\r
-        Assert.assertTrue(HttpStatus.FORBIDDEN.value() == response.getStatusCodeValue());\r
-    }\r
-\r
-    @Test\r
-    public void testProcessGet_ResultInvalid() throws Exception {\r
-        String transactionId = "transactionId-1";\r
-        String remoteAddr = "http://127.0.0.1";\r
-        String content = "content";\r
-        DocumentOperationResult result = new DocumentOperationResult();\r
-        result.setResultCode(302);\r
-        result.setError(new ErrorResult("type-1", "reason-1"));\r
-        result.setFailureCause("test-failure");\r
-        // Mockito.when(headers.getRequestHeaders()).thenReturn(multivaluedMap);;\r
-        Mockito.when(multivaluedMap.getFirst(Mockito.anyString())).thenReturn(transactionId);\r
-        Mockito.when(request.getRemoteAddr()).thenReturn(remoteAddr);\r
-        Mockito.when(request.getMethod()).thenReturn("testMethod");\r
-        Mockito.when(request.getRequestURL()).thenReturn(new StringBuffer("http://127.0.0.1"));\r
-        Mockito.when(request.getRemoteHost()).thenReturn("localhost");\r
-        Mockito.when(searchServiceApi.validateRequest(Mockito.any(HttpHeaders.class),\r
-                Mockito.any(HttpServletRequest.class), Mockito.any(ApiUtils.Action.class), Mockito.anyString()))\r
-                .thenReturn(true);\r
-        Mockito.when(documentStore.getDocument(Mockito.anyString(), Mockito.any(DocumentStoreDataEntity.class)))\r
-                .thenReturn(result);\r
-        ResponseEntity<String> response =\r
-                documentApi.processGet(content, request, headers, httpResponse, "index", "id-1", documentStore);\r
-        Assert.assertNotNull(response);\r
-        Assert.assertTrue(HttpStatus.FOUND.value() == response.getStatusCodeValue());\r
-    }\r
-\r
-    @Test\r
-    public void testQueryWithGetWithPayload_NullContent() {\r
-        String transactionId = "transactionId-1";\r
-        String remoteAddr = "http://127.0.0.1";\r
-        String content = null;\r
-        // Mockito.when(headers.getRequestHeaders()).thenReturn(multivaluedMap);;\r
-        Mockito.when(multivaluedMap.getFirst(Mockito.anyString())).thenReturn(transactionId);\r
-        Mockito.when(request.getRemoteAddr()).thenReturn(remoteAddr);\r
-        Mockito.when(request.getMethod()).thenReturn("testMethod");\r
-        Mockito.when(request.getRequestURL()).thenReturn(new StringBuffer("http://127.0.0.1"));\r
-        Mockito.when(request.getRemoteHost()).thenReturn("localhost");\r
-        ResponseEntity<String> response =\r
-                documentApi.queryWithGetWithPayload(content, request, headers, "index-1", documentStore);\r
-        Assert.assertNotNull(response);\r
-        Assert.assertTrue(HttpStatus.BAD_REQUEST.value() == response.getStatusCodeValue());\r
-    }\r
-\r
-    @SuppressWarnings("unchecked")\r
-    @Test\r
-    public void testQueryWithGetWithPayload_RequestThrowsException() throws Exception {\r
-        String transactionId = "transactionId-1";\r
-        String remoteAddr = "http://127.0.0.1";\r
-        String content = "content";\r
-        // Mockito.when(headers.getRequestHeaders()).thenReturn(multivaluedMap);;\r
-        Mockito.when(multivaluedMap.getFirst(Mockito.anyString())).thenReturn(transactionId);\r
-        Mockito.when(request.getRemoteAddr()).thenReturn(remoteAddr);\r
-        Mockito.when(request.getMethod()).thenReturn("testMethod");\r
-        Mockito.when(request.getRequestURL()).thenReturn(new StringBuffer("http://127.0.0.1"));\r
-        Mockito.when(request.getRemoteHost()).thenReturn("localhost");\r
-        Mockito.when(searchServiceApi.validateRequest(Mockito.any(HttpHeaders.class),\r
-                Mockito.any(HttpServletRequest.class), Mockito.any(ApiUtils.Action.class), Mockito.anyString()))\r
-                .thenThrow(IllegalArgumentException.class);\r
-        ResponseEntity<String> response =\r
-                documentApi.queryWithGetWithPayload(content, request, headers, "index-1", documentStore);\r
-        Assert.assertNotNull(response);\r
-        Assert.assertTrue(HttpStatus.FORBIDDEN.value() == response.getStatusCodeValue());\r
-    }\r
-\r
-    @Test\r
-    public void testQueryWithGetWithPayload_RequestInvalid() throws Exception {\r
-        String transactionId = "transactionId-1";\r
-        String remoteAddr = "http://127.0.0.1";\r
-        String content = "content";\r
-        // Mockito.when(headers.getRequestHeaders()).thenReturn(multivaluedMap);;\r
-        Mockito.when(multivaluedMap.getFirst(Mockito.anyString())).thenReturn(transactionId);\r
-        Mockito.when(request.getRemoteAddr()).thenReturn(remoteAddr);\r
-        Mockito.when(request.getMethod()).thenReturn("testMethod");\r
-        Mockito.when(request.getRequestURL()).thenReturn(new StringBuffer("http://127.0.0.1"));\r
-        Mockito.when(request.getRemoteHost()).thenReturn("localhost");\r
-        Mockito.when(searchServiceApi.validateRequest(Mockito.any(HttpHeaders.class),\r
-                Mockito.any(HttpServletRequest.class), Mockito.any(ApiUtils.Action.class), Mockito.anyString()))\r
-                .thenReturn(false);\r
-        ResponseEntity<String> response =\r
-                documentApi.queryWithGetWithPayload(content, request, headers, "index-1", documentStore);\r
-        Assert.assertNotNull(response);\r
-        Assert.assertTrue(HttpStatus.FORBIDDEN.value() == response.getStatusCodeValue());\r
-    }\r
-\r
-    @Test\r
-    public void testCreateProcessIndex_IndexApi_RequestInvalid() throws Exception {\r
-        String transactionId = "transactionId-1";\r
-        String remoteAddr = "http://127.0.0.1";\r
-        // Mockito.when(headers.getRequestHeaders()).thenReturn(multivaluedMap);;\r
-        Mockito.when(multivaluedMap.getFirst(Mockito.anyString())).thenReturn(transactionId);\r
-        Mockito.when(request.getRemoteAddr()).thenReturn(remoteAddr);\r
-        Mockito.when(request.getMethod()).thenReturn("testMethod");\r
-        Mockito.when(request.getRequestURL()).thenReturn(new StringBuffer("http://127.0.0.1"));\r
-        Mockito.when(request.getRemoteHost()).thenReturn("localhost");\r
-        Mockito.when(searchServiceApi.validateRequest(Mockito.any(HttpHeaders.class),\r
-                Mockito.any(HttpServletRequest.class), Mockito.any(ApiUtils.Action.class), Mockito.anyString()))\r
-                .thenReturn(false);\r
-        ResponseEntity<String> response =\r
-                indexApi.processCreateIndex("document-1", request, headers, "index-1", documentStore);\r
-        Assert.assertNotNull(response);\r
-        Assert.assertTrue(HttpStatus.FORBIDDEN.value() == response.getStatusCodeValue());\r
-    }\r
-\r
-    @SuppressWarnings("unchecked")\r
-    @Test\r
-    public void testCreateProcessIndex_IndexApi_RequestThrowsException() throws Exception {\r
-        String transactionId = "transactionId-1";\r
-        String remoteAddr = "http://127.0.0.1";\r
-        // Mockito.when(headers.getRequestHeaders()).thenReturn(multivaluedMap);;\r
-        Mockito.when(multivaluedMap.getFirst(Mockito.anyString())).thenReturn(transactionId);\r
-        Mockito.when(request.getRemoteAddr()).thenReturn(remoteAddr);\r
-        Mockito.when(request.getMethod()).thenReturn("testMethod");\r
-        Mockito.when(request.getRequestURL()).thenReturn(new StringBuffer("http://127.0.0.1"));\r
-        Mockito.when(request.getRemoteHost()).thenReturn("localhost");\r
-        Mockito.when(searchServiceApi.validateRequest(Mockito.any(HttpHeaders.class),\r
-                Mockito.any(HttpServletRequest.class), Mockito.any(ApiUtils.Action.class), Mockito.anyString()))\r
-                .thenThrow(IllegalArgumentException.class);\r
-        ResponseEntity<String> response =\r
-                indexApi.processCreateIndex("document-1", request, headers, "index-1", documentStore);\r
-        Assert.assertNotNull(response);\r
-        Assert.assertTrue(HttpStatus.FORBIDDEN.value() == response.getStatusCodeValue());\r
-    }\r
-\r
-    @Test\r
-    public void testCreateProcessIndex_IndexApi_NullDocument() throws Exception {\r
-        String transactionId = "transactionId-1";\r
-        String remoteAddr = "http://127.0.0.1";\r
-        String documentSchema = null;\r
-        // Mockito.when(headers.getRequestHeaders()).thenReturn(multivaluedMap);;\r
-        Mockito.when(multivaluedMap.getFirst(Mockito.anyString())).thenReturn(transactionId);\r
-        Mockito.when(request.getRemoteAddr()).thenReturn(remoteAddr);\r
-        Mockito.when(request.getMethod()).thenReturn("testMethod");\r
-        Mockito.when(request.getRequestURL()).thenReturn(new StringBuffer("http://127.0.0.1"));\r
-        Mockito.when(request.getRemoteHost()).thenReturn("localhost");\r
-        Mockito.when(searchServiceApi.validateRequest(Mockito.any(HttpHeaders.class),\r
-                Mockito.any(HttpServletRequest.class), Mockito.any(ApiUtils.Action.class), Mockito.anyString()))\r
-                .thenReturn(true);\r
-        ResponseEntity<String> response =\r
-                indexApi.processCreateIndex(documentSchema, request, headers, "index-1", documentStore);\r
-        Assert.assertNotNull(response);\r
-        Assert.assertTrue(HttpStatus.INTERNAL_SERVER_ERROR.value() == response.getStatusCodeValue());\r
-    }\r
-\r
-    @Test\r
-    public void testProcessDelete_IndexApi_RequestInvalid() throws Exception {\r
-        String transactionId = "transactionId-1";\r
-        String remoteAddr = "http://127.0.0.1";\r
-        // Mockito.when(headers.getRequestHeaders()).thenReturn(multivaluedMap);;\r
-        Mockito.when(multivaluedMap.getFirst(Mockito.anyString())).thenReturn(transactionId);\r
-        Mockito.when(request.getRemoteAddr()).thenReturn(remoteAddr);\r
-        Mockito.when(request.getMethod()).thenReturn("testMethod");\r
-        Mockito.when(request.getRequestURL()).thenReturn(new StringBuffer("http://127.0.0.1"));\r
-        Mockito.when(request.getRemoteHost()).thenReturn("localhost");\r
-        Mockito.when(searchServiceApi.validateRequest(Mockito.any(HttpHeaders.class),\r
-                Mockito.any(HttpServletRequest.class), Mockito.any(ApiUtils.Action.class), Mockito.anyString()))\r
-                .thenReturn(false);\r
-        ResponseEntity<String> response = indexApi.processDelete("document-1", request, headers, documentStore);\r
-        Assert.assertNotNull(response);\r
-        Assert.assertTrue(HttpStatus.FORBIDDEN.value() == response.getStatusCodeValue());\r
-    }\r
-\r
-    @SuppressWarnings("unchecked")\r
-    @Test\r
-    public void testProcessDelete_IndexApi_RequestThrowsException() throws Exception {\r
-        String transactionId = "transactionId-1";\r
-        String remoteAddr = "http://127.0.0.1";\r
-        // Mockito.when(headers.getRequestHeaders()).thenReturn(multivaluedMap);;\r
-        Mockito.when(multivaluedMap.getFirst(Mockito.anyString())).thenReturn(transactionId);\r
-        Mockito.when(request.getRemoteAddr()).thenReturn(remoteAddr);\r
-        Mockito.when(request.getMethod()).thenReturn("testMethod");\r
-        Mockito.when(request.getRequestURL()).thenReturn(new StringBuffer("http://127.0.0.1"));\r
-        Mockito.when(request.getRemoteHost()).thenReturn("localhost");\r
-        Mockito.when(searchServiceApi.validateRequest(Mockito.any(HttpHeaders.class),\r
-                Mockito.any(HttpServletRequest.class), Mockito.any(ApiUtils.Action.class), Mockito.anyString()))\r
-                .thenThrow(IllegalArgumentException.class);\r
-        ResponseEntity<String> response = indexApi.processDelete("document-1", request, headers, documentStore);\r
-        Assert.assertNotNull(response);\r
-        Assert.assertTrue(HttpStatus.FORBIDDEN.value() == response.getStatusCodeValue());\r
-    }\r
-\r
-    @SuppressWarnings("unchecked")\r
-    @Test\r
-    public void testProcessDelete_IndexApi_DeleteIndexException() throws Exception {\r
-        String transactionId = "transactionId-1";\r
-        String remoteAddr = "http://127.0.0.1";\r
-        // Mockito.when(headers.getRequestHeaders()).thenReturn(multivaluedMap);;\r
-        Mockito.when(multivaluedMap.getFirst(Mockito.anyString())).thenReturn(transactionId);\r
-        Mockito.when(request.getRemoteAddr()).thenReturn(remoteAddr);\r
-        Mockito.when(request.getMethod()).thenReturn("testMethod");\r
-        Mockito.when(request.getRequestURL()).thenReturn(new StringBuffer("http://127.0.0.1"));\r
-        Mockito.when(request.getRemoteHost()).thenReturn("localhost");\r
-        Mockito.when(searchServiceApi.validateRequest(Mockito.any(HttpHeaders.class),\r
-                Mockito.any(HttpServletRequest.class), Mockito.any(ApiUtils.Action.class), Mockito.anyString()))\r
-                .thenReturn(true);\r
-        Mockito.when(documentStore.deleteIndex(Mockito.anyString())).thenThrow(DocumentStoreOperationException.class);\r
-        ResponseEntity<String> response = indexApi.processDelete("document-1", request, headers, documentStore);\r
-        Assert.assertNotNull(response);\r
-        Assert.assertTrue(HttpStatus.INTERNAL_SERVER_ERROR.value() == response.getStatusCodeValue());\r
-    }\r
-\r
-    @Test\r
-    public void testUserAuthorization() throws Exception {\r
-        String transactionId = "transactionId-1";\r
-        String remoteAddr = "http://127.0.0.1";\r
-        String content = "content";\r
-        // Mockito.when(headers.getRequestHeaders()).thenReturn(multivaluedMap);;\r
-        Mockito.when(multivaluedMap.getFirst(Mockito.anyString())).thenReturn(transactionId);\r
-        Mockito.when(request.getRemoteAddr()).thenReturn(remoteAddr);\r
-        Mockito.when(request.getMethod()).thenReturn("testMethod");\r
-        Mockito.when(request.getRequestURL()).thenReturn(new StringBuffer("http://127.0.0.1"));\r
-        Mockito.when(request.getRemoteHost()).thenReturn("localhost");\r
-        Mockito.when(searchServiceApi.validateRequest(Mockito.any(HttpHeaders.class),\r
-                Mockito.any(HttpServletRequest.class), Mockito.any(ApiUtils.Action.class), Mockito.anyString()))\r
-                .thenCallRealMethod();\r
-\r
-        Mockito.doAnswer(new Answer<ElasticSearchConfig>() {\r
-            public ElasticSearchConfig answer(InvocationOnMock invocation) {\r
-                Properties properties = new Properties();\r
-                return new ElasticSearchConfig(properties);\r
-            }\r
-        }).when(httpController).getElasticSearchConfig();\r
-\r
-        searchServiceApi.documentStore = httpController;\r
-\r
-        ResponseEntity<String> response =\r
-                documentApi.processPut(content, request, headers, httpResponse, "index", "id-1", documentStore);\r
-        Assert.assertNotNull(response);\r
-        Assert.assertTrue(HttpStatus.FORBIDDEN.value() == response.getStatusCodeValue());\r
-\r
-        Mockito.doAnswer(new Answer<ElasticSearchConfig>() {\r
-            public ElasticSearchConfig answer(InvocationOnMock invocation) {\r
-                Properties properties = new Properties();\r
-                properties.put(ElasticSearchConfig.ES_AUTH_ENABLED, "true");\r
-                return new ElasticSearchConfig(properties);\r
-            }\r
-        }).when(httpController).getElasticSearchConfig();\r
-\r
-\r
-        response = documentApi.processPut(content, request, headers, httpResponse, "index", "id-1", documentStore);\r
-        Assert.assertNotNull(response);\r
-        Assert.assertTrue(HttpStatus.FORBIDDEN.value() == response.getStatusCodeValue());\r
-\r
-        Mockito.doAnswer(new Answer<ElasticSearchConfig>() {\r
-            public ElasticSearchConfig answer(InvocationOnMock invocation) {\r
-                Properties properties = new Properties();\r
-                properties.put(ElasticSearchConfig.ES_AUTH_ENABLED, "false");\r
-                return new ElasticSearchConfig(properties);\r
-            }\r
-        }).when(httpController).getElasticSearchConfig();\r
-\r
-        DocumentOperationResult result = new DocumentOperationResult();\r
-        result.setResultCode(302);\r
-        result.setError(new ErrorResult("type-1", "reason-1"));\r
-        result.setFailureCause("test-failure");\r
-        Mockito.when(documentStore.createDocument(Mockito.anyString(), Mockito.any(DocumentStoreDataEntity.class),\r
-                Mockito.anyBoolean())).thenReturn(result);\r
-        response = documentApi.processPut(content, request, headers, httpResponse, "index", "id-1", documentStore);\r
-        Assert.assertNotNull(response);\r
-        Assert.assertTrue(HttpStatus.FOUND.value() == response.getStatusCodeValue());\r
-\r
-    }\r
+/**
+ * ============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=========================================================
+ */
+package org.onap.aai.sa.rest;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+// import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.MultivaluedMap;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+import org.mockito.invocation.InvocationOnMock;
+import org.mockito.stubbing.Answer;
+import org.onap.aai.sa.searchdbabstraction.elasticsearch.config.ElasticSearchConfig;
+import org.onap.aai.sa.searchdbabstraction.elasticsearch.dao.DocumentStoreDataEntity;
+import org.onap.aai.sa.searchdbabstraction.elasticsearch.dao.DocumentStoreInterface;
+import org.onap.aai.sa.searchdbabstraction.elasticsearch.dao.ElasticSearchHttpController;
+import org.onap.aai.sa.searchdbabstraction.elasticsearch.exception.DocumentStoreOperationException;
+import org.onap.aai.sa.searchdbabstraction.entity.DocumentOperationResult;
+import org.onap.aai.sa.searchdbabstraction.entity.ErrorResult;
+import org.onap.aai.sa.searchdbabstraction.entity.SearchHits;
+import org.onap.aai.sa.searchdbabstraction.entity.SearchOperationResult;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import java.util.Properties;
+
+
+public class DocumentTest {
+
+    @Mock
+    SearchServiceApi searchServiceApi;
+
+    @Mock
+    HttpServletRequest request;
+
+    @Mock
+    HttpHeaders headers;
+
+    @Mock
+    HttpServletResponse httpResponse;
+
+    @Mock
+    DocumentStoreInterface documentStore;
+
+    @Mock
+    MultivaluedMap<String, String> multivaluedMap;
+
+    @InjectMocks
+    IndexApi indexApi;
+
+    DocumentApi documentApi;
+
+    @Mock
+    ElasticSearchHttpController httpController;
+
+    @Before
+    public void setUp() {
+        MockitoAnnotations.initMocks(this);
+        documentApi = new DocumentApi(searchServiceApi);
+    }
+
+    @Test
+    public void testDocumentClass_AllMethods() throws JsonProcessingException {
+        Document doc = new Document();
+        doc.setField("name-1", "value-1");
+        Assert.assertTrue(doc.getFields().size() == 1);
+        Assert.assertTrue(doc.toJson().contains("value-1"));
+        Assert.assertNotNull(doc.toString());
+        Assert.assertTrue(doc.toString().contains("name-1"));
+    }
+
+    @Test
+    public void testProcessPost_NullContent() {
+        String transactionId = "transactionId-1";
+        String remoteAddr = "http://127.0.0.1";
+        String content = null;
+        // Mockito.when(headers.getRequestHeaders()).thenReturn(multivaluedMap);
+        Mockito.when(multivaluedMap.getFirst(Mockito.anyString())).thenReturn(transactionId);
+        Mockito.when(request.getRemoteAddr()).thenReturn(remoteAddr);
+        Mockito.when(request.getMethod()).thenReturn("testMethod");
+        Mockito.when(request.getRequestURL()).thenReturn(new StringBuffer("http://127.0.0.1"));
+        Mockito.when(request.getRemoteHost()).thenReturn("localhost");
+        ResponseEntity<String> response =
+                documentApi.processPost(content, request, headers, httpResponse, "index", documentStore);
+        Assert.assertNotNull(response);
+        Assert.assertTrue(HttpStatus.BAD_REQUEST.value() == response.getStatusCodeValue());
+    }
+
+    @SuppressWarnings("unchecked")
+    @Test
+    public void testProcessPost_NotNullContent() throws Exception {
+        String transactionId = "transactionId-1";
+        String remoteAddr = "http://127.0.0.1";
+        String content = "content";
+        // Mockito.when(headers.getRequestHeaders()).thenReturn(multivaluedMap);
+        Mockito.when(multivaluedMap.getFirst(Mockito.anyString())).thenReturn(transactionId);
+        Mockito.when(request.getRemoteAddr()).thenReturn(remoteAddr);
+        Mockito.when(request.getMethod()).thenReturn("testMethod");
+        Mockito.when(request.getRequestURL()).thenReturn(new StringBuffer("http://127.0.0.1"));
+        Mockito.when(request.getRemoteHost()).thenReturn("localhost");
+        Mockito.when(searchServiceApi.validateRequest(Mockito.any(HttpHeaders.class),
+                Mockito.any(HttpServletRequest.class), Mockito.any(ApiUtils.Action.class), Mockito.anyString()))
+                .thenThrow(IllegalArgumentException.class);
+        ResponseEntity<?> response =
+                documentApi.processPost(content, request, headers, httpResponse, "index", documentStore);
+        Assert.assertNotNull(response);
+        Assert.assertTrue(HttpStatus.FORBIDDEN.value() == response.getStatusCodeValue());
+    }
+
+    //
+    @Test
+    public void testProcessPost_ValidRequest() throws Exception {
+        String transactionId = "transactionId-1";
+        String remoteAddr = "http://127.0.0.1";
+        String content = "content";
+        DocumentOperationResult result = new DocumentOperationResult();
+        result.setResultCode(150);
+        result.setError(new ErrorResult("type-1", "reason-1"));
+        result.setFailureCause("test-failure");
+        // Mockito.when(headers.getRequestHeaders()).thenReturn(multivaluedMap);
+        Mockito.when(multivaluedMap.getFirst(Mockito.anyString())).thenReturn(transactionId);
+        Mockito.when(request.getRemoteAddr()).thenReturn(remoteAddr);
+        Mockito.when(request.getMethod()).thenReturn("testMethod");
+        Mockito.when(request.getRequestURL()).thenReturn(new StringBuffer("http://127.0.0.1"));
+        Mockito.when(request.getRemoteHost()).thenReturn("localhost");
+        Mockito.when(searchServiceApi.validateRequest(Mockito.any(HttpHeaders.class),
+                Mockito.any(HttpServletRequest.class), Mockito.any(ApiUtils.Action.class), Mockito.anyString()))
+                .thenReturn(true);
+        Mockito.when(documentStore.createDocument(Mockito.anyString(), Mockito.any(DocumentStoreDataEntity.class),
+                Mockito.anyBoolean())).thenReturn(result);
+        Mockito.doNothing().when(httpResponse).setHeader(Mockito.anyString(), Mockito.anyString());
+        ResponseEntity<String> response =
+                documentApi.processPost(content, request, headers, httpResponse, "index", documentStore);
+        Assert.assertNotNull(response);
+        Assert.assertTrue(HttpStatus.INTERNAL_SERVER_ERROR.value() == response.getStatusCodeValue());
+    }
+
+    //
+    @Test
+    public void testProcessSearchWithGet_Created() throws Exception {
+        String transactionId = "transactionId-1";
+        String remoteAddr = "http://127.0.0.1";
+        String content = "content";
+        SearchOperationResult result = new SearchOperationResult();
+        result.setResultCode(201);
+        SearchHits hits = new SearchHits();
+        hits.setTotalHits("2");
+        result.setSearchResult(hits);
+        // Mockito.when(headers.getRequestHeaders()).thenReturn(multivaluedMap);
+        Mockito.when(multivaluedMap.getFirst(Mockito.anyString())).thenReturn(transactionId);
+        Mockito.when(request.getRemoteAddr()).thenReturn(remoteAddr);
+        Mockito.when(request.getMethod()).thenReturn("testMethod");
+        Mockito.when(request.getRequestURL()).thenReturn(new StringBuffer("http://127.0.0.1"));
+        Mockito.when(request.getRemoteHost()).thenReturn("localhost");
+        Mockito.when(searchServiceApi.validateRequest(Mockito.any(HttpHeaders.class),
+                Mockito.any(HttpServletRequest.class), Mockito.any(ApiUtils.Action.class), Mockito.anyString()))
+                .thenReturn(true);
+        Mockito.when(documentStore.search(Mockito.anyString(), Mockito.anyString())).thenReturn(result);
+        ResponseEntity<String> response =
+                documentApi.processSearchWithGet(content, request, headers, "index-1", "query-text", documentStore);
+        Assert.assertNotNull(response);
+        Assert.assertTrue(HttpStatus.CREATED.value() == response.getStatusCodeValue());
+
+    }
+
+    @SuppressWarnings("unchecked")
+    @Test
+    public void testProcessSearchWithGet_ValidateThrowsException() throws Exception {
+        String transactionId = "transactionId-1";
+        String remoteAddr = "http://127.0.0.1";
+        String content = "content";
+        SearchOperationResult result = new SearchOperationResult();
+        result.setResultCode(201);
+        SearchHits hits = new SearchHits();
+        hits.setTotalHits("2");
+        result.setSearchResult(hits);
+        // Mockito.when(headers.getRequestHeaders()).thenReturn(multivaluedMap);
+        Mockito.when(multivaluedMap.getFirst(Mockito.anyString())).thenReturn(transactionId);
+        Mockito.when(request.getRemoteAddr()).thenReturn(remoteAddr);
+        Mockito.when(request.getMethod()).thenReturn("testMethod");
+        Mockito.when(request.getRequestURL()).thenReturn(new StringBuffer("http://127.0.0.1"));
+        Mockito.when(request.getRemoteHost()).thenReturn("localhost");
+        Mockito.when(searchServiceApi.validateRequest(Mockito.any(HttpHeaders.class),
+                Mockito.any(HttpServletRequest.class), Mockito.any(ApiUtils.Action.class), Mockito.anyString()))
+                .thenThrow(IllegalArgumentException.class);
+        Mockito.when(documentStore.search(Mockito.anyString(), Mockito.anyString())).thenReturn(result);
+        ResponseEntity<String> response =
+                documentApi.processSearchWithGet(content, request, headers, "index-1", "query-text", documentStore);
+        Assert.assertNotNull(response);
+        Assert.assertTrue(HttpStatus.FORBIDDEN.value() == response.getStatusCodeValue());
+
+    }
+
+    @Test
+    public void testProcessSearchWithGet_ValidateIsFalse() throws Exception {
+        String transactionId = "transactionId-1";
+        String remoteAddr = "http://127.0.0.1";
+        String content = "content";
+        SearchOperationResult result = new SearchOperationResult();
+        result.setResultCode(201);
+        SearchHits hits = new SearchHits();
+        hits.setTotalHits("2");
+        result.setSearchResult(hits);
+        // Mockito.when(headers.getRequestHeaders()).thenReturn(multivaluedMap);
+        Mockito.when(multivaluedMap.getFirst(Mockito.anyString())).thenReturn(transactionId);
+        Mockito.when(request.getRemoteAddr()).thenReturn(remoteAddr);
+        Mockito.when(request.getMethod()).thenReturn("testMethod");
+        Mockito.when(request.getRequestURL()).thenReturn(new StringBuffer("http://127.0.0.1"));
+        Mockito.when(request.getRemoteHost()).thenReturn("localhost");
+        Mockito.when(searchServiceApi.validateRequest(Mockito.any(HttpHeaders.class),
+                Mockito.any(HttpServletRequest.class), Mockito.any(ApiUtils.Action.class), Mockito.anyString()))
+                .thenReturn(false);
+        Mockito.when(documentStore.search(Mockito.anyString(), Mockito.anyString())).thenReturn(result);
+        ResponseEntity<String> response =
+                documentApi.processSearchWithGet(content, request, headers, "index-1", "query-text", documentStore);
+        Assert.assertNotNull(response);
+        Assert.assertTrue(HttpStatus.FORBIDDEN.value() == response.getStatusCodeValue());
+
+    }
+
+    @Test
+    public void testProcessSearchWithGet_InvalidResult() throws Exception {
+        String transactionId = "transactionId-1";
+        String remoteAddr = "http://127.0.0.1";
+        String content = "content";
+        SearchOperationResult result = new SearchOperationResult();
+        result.setResultCode(302);
+        SearchHits hits = new SearchHits();
+        hits.setTotalHits("2");
+        result.setSearchResult(hits);
+        // Mockito.when(headers.getRequestHeaders()).thenReturn(multivaluedMap);;
+        Mockito.when(multivaluedMap.getFirst(Mockito.anyString())).thenReturn(transactionId);
+        Mockito.when(request.getRemoteAddr()).thenReturn(remoteAddr);
+        Mockito.when(request.getMethod()).thenReturn("testMethod");
+        Mockito.when(request.getRequestURL()).thenReturn(new StringBuffer("http://127.0.0.1"));
+        Mockito.when(request.getRemoteHost()).thenReturn("localhost");
+        Mockito.when(searchServiceApi.validateRequest(Mockito.any(HttpHeaders.class),
+                Mockito.any(HttpServletRequest.class), Mockito.any(ApiUtils.Action.class), Mockito.anyString()))
+                .thenReturn(true);
+        Mockito.when(documentStore.search(Mockito.anyString(), Mockito.anyString())).thenReturn(result);
+        ResponseEntity<String> response =
+                documentApi.processSearchWithGet(content, request, headers, "index-1", "query-text", documentStore);
+        Assert.assertNotNull(response);
+        Assert.assertTrue(HttpStatus.FOUND.value() == response.getStatusCodeValue());
+
+    }
+
+    @Test
+    public void testProcessPut_NullContent() {
+        String transactionId = "transactionId-1";
+        String remoteAddr = "http://127.0.0.1";
+        String content = null;
+        // Mockito.when(headers.getRequestHeaders()).thenReturn(multivaluedMap);;
+        Mockito.when(multivaluedMap.getFirst(Mockito.anyString())).thenReturn(transactionId);
+        Mockito.when(request.getRemoteAddr()).thenReturn(remoteAddr);
+        Mockito.when(request.getMethod()).thenReturn("testMethod");
+        Mockito.when(request.getRequestURL()).thenReturn(new StringBuffer("http://127.0.0.1"));
+        Mockito.when(request.getRemoteHost()).thenReturn("localhost");
+        ResponseEntity<String> response =
+                documentApi.processPut(content, request, headers, httpResponse, "index", "id-1", documentStore);
+        Assert.assertNotNull(response);
+        Assert.assertTrue(HttpStatus.BAD_REQUEST.value() == response.getStatusCodeValue());
+    }
+
+    @SuppressWarnings("unchecked")
+    @Test
+    public void testProcessPut_RequestThrowsException() throws Exception {
+        String transactionId = "transactionId-1";
+        String remoteAddr = "http://127.0.0.1";
+        String content = "content";
+        // Mockito.when(headers.getRequestHeaders()).thenReturn(multivaluedMap);;
+        Mockito.when(multivaluedMap.getFirst(Mockito.anyString())).thenReturn(transactionId);
+        Mockito.when(request.getRemoteAddr()).thenReturn(remoteAddr);
+        Mockito.when(request.getMethod()).thenReturn("testMethod");
+        Mockito.when(request.getRequestURL()).thenReturn(new StringBuffer("http://127.0.0.1"));
+        Mockito.when(request.getRemoteHost()).thenReturn("localhost");
+        Mockito.when(searchServiceApi.validateRequest(Mockito.any(HttpHeaders.class),
+                Mockito.any(HttpServletRequest.class), Mockito.any(ApiUtils.Action.class), Mockito.anyString()))
+                .thenThrow(IllegalArgumentException.class);
+        ResponseEntity<String> response =
+                documentApi.processPut(content, request, headers, httpResponse, "index", "id-1", documentStore);
+        Assert.assertNotNull(response);
+        Assert.assertTrue(HttpStatus.FORBIDDEN.value() == response.getStatusCodeValue());
+    }
+
+    @Test
+    public void testProcessPut_RequestInvalid() throws Exception {
+        String transactionId = "transactionId-1";
+        String remoteAddr = "http://127.0.0.1";
+        String content = "content";
+        // Mockito.when(headers.getRequestHeaders()).thenReturn(multivaluedMap);;
+        Mockito.when(multivaluedMap.getFirst(Mockito.anyString())).thenReturn(transactionId);
+        Mockito.when(request.getRemoteAddr()).thenReturn(remoteAddr);
+        Mockito.when(request.getMethod()).thenReturn("testMethod");
+        Mockito.when(request.getRequestURL()).thenReturn(new StringBuffer("http://127.0.0.1"));
+        Mockito.when(request.getRemoteHost()).thenReturn("localhost");
+        Mockito.when(searchServiceApi.validateRequest(Mockito.any(HttpHeaders.class),
+                Mockito.any(HttpServletRequest.class), Mockito.any(ApiUtils.Action.class), Mockito.anyString()))
+                .thenReturn(false);
+        ResponseEntity<String> response =
+                documentApi.processPut(content, request, headers, httpResponse, "index", "id-1", documentStore);
+        Assert.assertNotNull(response);
+        Assert.assertTrue(HttpStatus.FORBIDDEN.value() == response.getStatusCodeValue());
+    }
+
+    @Test
+    public void testProcessPut_ResultInvalid() throws Exception {
+        String transactionId = "transactionId-1";
+        String remoteAddr = "http://127.0.0.1";
+        String content = "content";
+        DocumentOperationResult result = new DocumentOperationResult();
+        result.setResultCode(302);
+        result.setError(new ErrorResult("type-1", "reason-1"));
+        result.setFailureCause("test-failure");
+        // Mockito.when(headers.getRequestHeaders()).thenReturn(multivaluedMap);;
+        Mockito.when(multivaluedMap.getFirst(Mockito.anyString())).thenReturn(transactionId);
+        Mockito.when(request.getRemoteAddr()).thenReturn(remoteAddr);
+        Mockito.when(request.getMethod()).thenReturn("testMethod");
+        Mockito.when(request.getRequestURL()).thenReturn(new StringBuffer("http://127.0.0.1"));
+        Mockito.when(request.getRemoteHost()).thenReturn("localhost");
+        Mockito.when(searchServiceApi.validateRequest(Mockito.any(HttpHeaders.class),
+                Mockito.any(HttpServletRequest.class), Mockito.any(ApiUtils.Action.class), Mockito.anyString()))
+                .thenReturn(true);
+        Mockito.when(documentStore.createDocument(Mockito.anyString(), Mockito.any(DocumentStoreDataEntity.class),
+                Mockito.anyBoolean())).thenReturn(result);
+        ResponseEntity<String> response =
+                documentApi.processPut(content, request, headers, httpResponse, "index", "id-1", documentStore);
+        Assert.assertNotNull(response);
+        Assert.assertTrue(HttpStatus.FOUND.value() == response.getStatusCodeValue());
+    }
+
+    @SuppressWarnings("unchecked")
+    @Test
+    public void testProcessDelete_RequestThrowsException() throws Exception {
+        String transactionId = "transactionId-1";
+        String remoteAddr = "http://127.0.0.1";
+        String content = "content";
+        // Mockito.when(headers.getRequestHeaders()).thenReturn(multivaluedMap);;
+        Mockito.when(multivaluedMap.getFirst(Mockito.anyString())).thenReturn(transactionId);
+        Mockito.when(request.getRemoteAddr()).thenReturn(remoteAddr);
+        Mockito.when(request.getMethod()).thenReturn("testMethod");
+        Mockito.when(request.getRequestURL()).thenReturn(new StringBuffer("http://127.0.0.1"));
+        Mockito.when(request.getRemoteHost()).thenReturn("localhost");
+        Mockito.when(searchServiceApi.validateRequest(Mockito.any(HttpHeaders.class),
+                Mockito.any(HttpServletRequest.class), Mockito.any(ApiUtils.Action.class), Mockito.anyString()))
+                .thenThrow(IllegalArgumentException.class);
+        ResponseEntity<String> response =
+                documentApi.processDelete(content, request, headers, httpResponse, "index", "id-1", documentStore);
+        Assert.assertNotNull(response);
+        Assert.assertTrue(HttpStatus.FORBIDDEN.value() == response.getStatusCodeValue());
+    }
+
+    @Test
+    public void testProcessDelete_RequestInvalid() throws Exception {
+        String transactionId = "transactionId-1";
+        String remoteAddr = "http://127.0.0.1";
+        String content = "content";
+        // Mockito.when(headers.getRequestHeaders()).thenReturn(multivaluedMap);;
+        Mockito.when(multivaluedMap.getFirst(Mockito.anyString())).thenReturn(transactionId);
+        Mockito.when(request.getRemoteAddr()).thenReturn(remoteAddr);
+        Mockito.when(request.getMethod()).thenReturn("testMethod");
+        Mockito.when(request.getRequestURL()).thenReturn(new StringBuffer("http://127.0.0.1"));
+        Mockito.when(request.getRemoteHost()).thenReturn("localhost");
+        Mockito.when(searchServiceApi.validateRequest(Mockito.any(HttpHeaders.class),
+                Mockito.any(HttpServletRequest.class), Mockito.any(ApiUtils.Action.class), Mockito.anyString()))
+                .thenReturn(false);
+        ResponseEntity<String> response =
+                documentApi.processDelete(content, request, headers, httpResponse, "index", "id-1", documentStore);
+        Assert.assertNotNull(response);
+        Assert.assertTrue(HttpStatus.FORBIDDEN.value() == response.getStatusCodeValue());
+    }
+
+    @Ignore
+    @Test
+    public void testProcessDelete_ResultInvalid() throws Exception {
+        String transactionId = "transactionId-1";
+        String remoteAddr = "http://127.0.0.1";
+        String content = "content";
+        DocumentOperationResult result = new DocumentOperationResult();
+        result.setResultCode(302);
+        result.setError(new ErrorResult("type-1", "reason-1"));
+        result.setFailureCause("test-failure");
+        // Mockito.when(headers.getRequestHeaders()).thenReturn(multivaluedMap);;
+        Mockito.when(multivaluedMap.getFirst(Mockito.anyString())).thenReturn(transactionId);
+        Mockito.when(request.getRemoteAddr()).thenReturn(remoteAddr);
+        Mockito.when(request.getMethod()).thenReturn("testMethod");
+        Mockito.when(request.getRequestURL()).thenReturn(new StringBuffer("http://127.0.0.1"));
+        Mockito.when(request.getRemoteHost()).thenReturn("localhost");
+        Mockito.when(searchServiceApi.validateRequest(Mockito.any(HttpHeaders.class),
+                Mockito.any(HttpServletRequest.class), Mockito.any(ApiUtils.Action.class), Mockito.anyString()))
+                .thenReturn(true);
+        Mockito.when(documentStore.deleteDocument(Mockito.anyString(), Mockito.any(DocumentStoreDataEntity.class)))
+                .thenReturn(result);
+        ResponseEntity<String> response =
+                documentApi.processDelete(content, request, headers, httpResponse, "index", "id-1", documentStore);
+        Assert.assertNotNull(response);
+        Assert.assertTrue(HttpStatus.FOUND.value() == response.getStatusCodeValue());
+    }
+
+    @SuppressWarnings("unchecked")
+    @Test
+    public void testProcessGet_RequestThrowsException() throws Exception {
+        String transactionId = "transactionId-1";
+        String remoteAddr = "http://127.0.0.1";
+        String content = "content";
+        // Mockito.when(headers.getRequestHeaders()).thenReturn(multivaluedMap);;
+        Mockito.when(multivaluedMap.getFirst(Mockito.anyString())).thenReturn(transactionId);
+        Mockito.when(request.getRemoteAddr()).thenReturn(remoteAddr);
+        Mockito.when(request.getMethod()).thenReturn("testMethod");
+        Mockito.when(request.getRequestURL()).thenReturn(new StringBuffer("http://127.0.0.1"));
+        Mockito.when(request.getRemoteHost()).thenReturn("localhost");
+        Mockito.when(searchServiceApi.validateRequest(Mockito.any(HttpHeaders.class),
+                Mockito.any(HttpServletRequest.class), Mockito.any(ApiUtils.Action.class), Mockito.anyString()))
+                .thenThrow(IllegalArgumentException.class);
+        ResponseEntity<String> response =
+                documentApi.processGet(content, request, headers, httpResponse, "index", "id-1", documentStore);
+        Assert.assertNotNull(response);
+        Assert.assertTrue(HttpStatus.FORBIDDEN.value() == response.getStatusCodeValue());
+    }
+
+    @Test
+    public void testProcessGet_RequestInvalid() throws Exception {
+        String transactionId = "transactionId-1";
+        String remoteAddr = "http://127.0.0.1";
+        String content = "content";
+        // Mockito.when(headers.getRequestHeaders()).thenReturn(multivaluedMap);;
+        Mockito.when(multivaluedMap.getFirst(Mockito.anyString())).thenReturn(transactionId);
+        Mockito.when(request.getRemoteAddr()).thenReturn(remoteAddr);
+        Mockito.when(request.getMethod()).thenReturn("testMethod");
+        Mockito.when(request.getRequestURL()).thenReturn(new StringBuffer("http://127.0.0.1"));
+        Mockito.when(request.getRemoteHost()).thenReturn("localhost");
+        Mockito.when(searchServiceApi.validateRequest(Mockito.any(HttpHeaders.class),
+                Mockito.any(HttpServletRequest.class), Mockito.any(ApiUtils.Action.class), Mockito.anyString()))
+                .thenReturn(false);
+        ResponseEntity<String> response =
+                documentApi.processGet(content, request, headers, httpResponse, "index", "id-1", documentStore);
+        Assert.assertNotNull(response);
+        Assert.assertTrue(HttpStatus.FORBIDDEN.value() == response.getStatusCodeValue());
+    }
+
+    @Test
+    public void testProcessGet_ResultInvalid() throws Exception {
+        String transactionId = "transactionId-1";
+        String remoteAddr = "http://127.0.0.1";
+        String content = "content";
+        DocumentOperationResult result = new DocumentOperationResult();
+        result.setResultCode(302);
+        result.setError(new ErrorResult("type-1", "reason-1"));
+        result.setFailureCause("test-failure");
+        // Mockito.when(headers.getRequestHeaders()).thenReturn(multivaluedMap);;
+        Mockito.when(multivaluedMap.getFirst(Mockito.anyString())).thenReturn(transactionId);
+        Mockito.when(request.getRemoteAddr()).thenReturn(remoteAddr);
+        Mockito.when(request.getMethod()).thenReturn("testMethod");
+        Mockito.when(request.getRequestURL()).thenReturn(new StringBuffer("http://127.0.0.1"));
+        Mockito.when(request.getRemoteHost()).thenReturn("localhost");
+        Mockito.when(searchServiceApi.validateRequest(Mockito.any(HttpHeaders.class),
+                Mockito.any(HttpServletRequest.class), Mockito.any(ApiUtils.Action.class), Mockito.anyString()))
+                .thenReturn(true);
+        Mockito.when(documentStore.getDocument(Mockito.anyString(), Mockito.any(DocumentStoreDataEntity.class)))
+                .thenReturn(result);
+        ResponseEntity<String> response =
+                documentApi.processGet(content, request, headers, httpResponse, "index", "id-1", documentStore);
+        Assert.assertNotNull(response);
+        Assert.assertTrue(HttpStatus.FOUND.value() == response.getStatusCodeValue());
+    }
+
+    @Test
+    public void testQueryWithGetWithPayload_NullContent() {
+        String transactionId = "transactionId-1";
+        String remoteAddr = "http://127.0.0.1";
+        String content = null;
+        // Mockito.when(headers.getRequestHeaders()).thenReturn(multivaluedMap);;
+        Mockito.when(multivaluedMap.getFirst(Mockito.anyString())).thenReturn(transactionId);
+        Mockito.when(request.getRemoteAddr()).thenReturn(remoteAddr);
+        Mockito.when(request.getMethod()).thenReturn("testMethod");
+        Mockito.when(request.getRequestURL()).thenReturn(new StringBuffer("http://127.0.0.1"));
+        Mockito.when(request.getRemoteHost()).thenReturn("localhost");
+        ResponseEntity<String> response =
+                documentApi.queryWithGetWithPayload(content, request, headers, "index-1", documentStore);
+        Assert.assertNotNull(response);
+        Assert.assertTrue(HttpStatus.BAD_REQUEST.value() == response.getStatusCodeValue());
+    }
+
+    @SuppressWarnings("unchecked")
+    @Test
+    public void testQueryWithGetWithPayload_RequestThrowsException() throws Exception {
+        String transactionId = "transactionId-1";
+        String remoteAddr = "http://127.0.0.1";
+        String content = "content";
+        // Mockito.when(headers.getRequestHeaders()).thenReturn(multivaluedMap);;
+        Mockito.when(multivaluedMap.getFirst(Mockito.anyString())).thenReturn(transactionId);
+        Mockito.when(request.getRemoteAddr()).thenReturn(remoteAddr);
+        Mockito.when(request.getMethod()).thenReturn("testMethod");
+        Mockito.when(request.getRequestURL()).thenReturn(new StringBuffer("http://127.0.0.1"));
+        Mockito.when(request.getRemoteHost()).thenReturn("localhost");
+        Mockito.when(searchServiceApi.validateRequest(Mockito.any(HttpHeaders.class),
+                Mockito.any(HttpServletRequest.class), Mockito.any(ApiUtils.Action.class), Mockito.anyString()))
+                .thenThrow(IllegalArgumentException.class);
+        ResponseEntity<String> response =
+                documentApi.queryWithGetWithPayload(content, request, headers, "index-1", documentStore);
+        Assert.assertNotNull(response);
+        Assert.assertTrue(HttpStatus.FORBIDDEN.value() == response.getStatusCodeValue());
+    }
+
+    @Test
+    public void testQueryWithGetWithPayload_RequestInvalid() throws Exception {
+        String transactionId = "transactionId-1";
+        String remoteAddr = "http://127.0.0.1";
+        String content = "content";
+        // Mockito.when(headers.getRequestHeaders()).thenReturn(multivaluedMap);;
+        Mockito.when(multivaluedMap.getFirst(Mockito.anyString())).thenReturn(transactionId);
+        Mockito.when(request.getRemoteAddr()).thenReturn(remoteAddr);
+        Mockito.when(request.getMethod()).thenReturn("testMethod");
+        Mockito.when(request.getRequestURL()).thenReturn(new StringBuffer("http://127.0.0.1"));
+        Mockito.when(request.getRemoteHost()).thenReturn("localhost");
+        Mockito.when(searchServiceApi.validateRequest(Mockito.any(HttpHeaders.class),
+                Mockito.any(HttpServletRequest.class), Mockito.any(ApiUtils.Action.class), Mockito.anyString()))
+                .thenReturn(false);
+        ResponseEntity<String> response =
+                documentApi.queryWithGetWithPayload(content, request, headers, "index-1", documentStore);
+        Assert.assertNotNull(response);
+        Assert.assertTrue(HttpStatus.FORBIDDEN.value() == response.getStatusCodeValue());
+    }
+
+    @Test
+    public void testCreateProcessIndex_IndexApi_RequestInvalid() throws Exception {
+        String transactionId = "transactionId-1";
+        String remoteAddr = "http://127.0.0.1";
+        // Mockito.when(headers.getRequestHeaders()).thenReturn(multivaluedMap);;
+        Mockito.when(multivaluedMap.getFirst(Mockito.anyString())).thenReturn(transactionId);
+        Mockito.when(request.getRemoteAddr()).thenReturn(remoteAddr);
+        Mockito.when(request.getMethod()).thenReturn("testMethod");
+        Mockito.when(request.getRequestURL()).thenReturn(new StringBuffer("http://127.0.0.1"));
+        Mockito.when(request.getRemoteHost()).thenReturn("localhost");
+        Mockito.when(searchServiceApi.validateRequest(Mockito.any(HttpHeaders.class),
+                Mockito.any(HttpServletRequest.class), Mockito.any(ApiUtils.Action.class), Mockito.anyString()))
+                .thenReturn(false);
+        ResponseEntity<String> response =
+                indexApi.processCreateIndex("document-1", request, headers, "index-1", documentStore);
+        Assert.assertNotNull(response);
+        Assert.assertTrue(HttpStatus.FORBIDDEN.value() == response.getStatusCodeValue());
+    }
+
+    @SuppressWarnings("unchecked")
+    @Test
+    public void testCreateProcessIndex_IndexApi_RequestThrowsException() throws Exception {
+        String transactionId = "transactionId-1";
+        String remoteAddr = "http://127.0.0.1";
+        // Mockito.when(headers.getRequestHeaders()).thenReturn(multivaluedMap);;
+        Mockito.when(multivaluedMap.getFirst(Mockito.anyString())).thenReturn(transactionId);
+        Mockito.when(request.getRemoteAddr()).thenReturn(remoteAddr);
+        Mockito.when(request.getMethod()).thenReturn("testMethod");
+        Mockito.when(request.getRequestURL()).thenReturn(new StringBuffer("http://127.0.0.1"));
+        Mockito.when(request.getRemoteHost()).thenReturn("localhost");
+        Mockito.when(searchServiceApi.validateRequest(Mockito.any(HttpHeaders.class),
+                Mockito.any(HttpServletRequest.class), Mockito.any(ApiUtils.Action.class), Mockito.anyString()))
+                .thenThrow(IllegalArgumentException.class);
+        ResponseEntity<String> response =
+                indexApi.processCreateIndex("document-1", request, headers, "index-1", documentStore);
+        Assert.assertNotNull(response);
+        Assert.assertTrue(HttpStatus.FORBIDDEN.value() == response.getStatusCodeValue());
+    }
+
+    @Test
+    public void testCreateProcessIndex_IndexApi_NullDocument() throws Exception {
+        String transactionId = "transactionId-1";
+        String remoteAddr = "http://127.0.0.1";
+        String documentSchema = null;
+        // Mockito.when(headers.getRequestHeaders()).thenReturn(multivaluedMap);;
+        Mockito.when(multivaluedMap.getFirst(Mockito.anyString())).thenReturn(transactionId);
+        Mockito.when(request.getRemoteAddr()).thenReturn(remoteAddr);
+        Mockito.when(request.getMethod()).thenReturn("testMethod");
+        Mockito.when(request.getRequestURL()).thenReturn(new StringBuffer("http://127.0.0.1"));
+        Mockito.when(request.getRemoteHost()).thenReturn("localhost");
+        Mockito.when(searchServiceApi.validateRequest(Mockito.any(HttpHeaders.class),
+                Mockito.any(HttpServletRequest.class), Mockito.any(ApiUtils.Action.class), Mockito.anyString()))
+                .thenReturn(true);
+        ResponseEntity<String> response =
+                indexApi.processCreateIndex(documentSchema, request, headers, "index-1", documentStore);
+        Assert.assertNotNull(response);
+        Assert.assertTrue(HttpStatus.INTERNAL_SERVER_ERROR.value() == response.getStatusCodeValue());
+    }
+
+    @Test
+    public void testProcessDelete_IndexApi_RequestInvalid() throws Exception {
+        String transactionId = "transactionId-1";
+        String remoteAddr = "http://127.0.0.1";
+        // Mockito.when(headers.getRequestHeaders()).thenReturn(multivaluedMap);;
+        Mockito.when(multivaluedMap.getFirst(Mockito.anyString())).thenReturn(transactionId);
+        Mockito.when(request.getRemoteAddr()).thenReturn(remoteAddr);
+        Mockito.when(request.getMethod()).thenReturn("testMethod");
+        Mockito.when(request.getRequestURL()).thenReturn(new StringBuffer("http://127.0.0.1"));
+        Mockito.when(request.getRemoteHost()).thenReturn("localhost");
+        Mockito.when(searchServiceApi.validateRequest(Mockito.any(HttpHeaders.class),
+                Mockito.any(HttpServletRequest.class), Mockito.any(ApiUtils.Action.class), Mockito.anyString()))
+                .thenReturn(false);
+        ResponseEntity<String> response = indexApi.processDelete("document-1", request, headers, documentStore);
+        Assert.assertNotNull(response);
+        Assert.assertTrue(HttpStatus.FORBIDDEN.value() == response.getStatusCodeValue());
+    }
+
+    @SuppressWarnings("unchecked")
+    @Test
+    public void testProcessDelete_IndexApi_RequestThrowsException() throws Exception {
+        String transactionId = "transactionId-1";
+        String remoteAddr = "http://127.0.0.1";
+        // Mockito.when(headers.getRequestHeaders()).thenReturn(multivaluedMap);;
+        Mockito.when(multivaluedMap.getFirst(Mockito.anyString())).thenReturn(transactionId);
+        Mockito.when(request.getRemoteAddr()).thenReturn(remoteAddr);
+        Mockito.when(request.getMethod()).thenReturn("testMethod");
+        Mockito.when(request.getRequestURL()).thenReturn(new StringBuffer("http://127.0.0.1"));
+        Mockito.when(request.getRemoteHost()).thenReturn("localhost");
+        Mockito.when(searchServiceApi.validateRequest(Mockito.any(HttpHeaders.class),
+                Mockito.any(HttpServletRequest.class), Mockito.any(ApiUtils.Action.class), Mockito.anyString()))
+                .thenThrow(IllegalArgumentException.class);
+        ResponseEntity<String> response = indexApi.processDelete("document-1", request, headers, documentStore);
+        Assert.assertNotNull(response);
+        Assert.assertTrue(HttpStatus.FORBIDDEN.value() == response.getStatusCodeValue());
+    }
+
+    @SuppressWarnings("unchecked")
+    @Test
+    public void testProcessDelete_IndexApi_DeleteIndexException() throws Exception {
+        String transactionId = "transactionId-1";
+        String remoteAddr = "http://127.0.0.1";
+        // Mockito.when(headers.getRequestHeaders()).thenReturn(multivaluedMap);;
+        Mockito.when(multivaluedMap.getFirst(Mockito.anyString())).thenReturn(transactionId);
+        Mockito.when(request.getRemoteAddr()).thenReturn(remoteAddr);
+        Mockito.when(request.getMethod()).thenReturn("testMethod");
+        Mockito.when(request.getRequestURL()).thenReturn(new StringBuffer("http://127.0.0.1"));
+        Mockito.when(request.getRemoteHost()).thenReturn("localhost");
+        Mockito.when(searchServiceApi.validateRequest(Mockito.any(HttpHeaders.class),
+                Mockito.any(HttpServletRequest.class), Mockito.any(ApiUtils.Action.class), Mockito.anyString()))
+                .thenReturn(true);
+        Mockito.when(documentStore.deleteIndex(Mockito.anyString())).thenThrow(DocumentStoreOperationException.class);
+        ResponseEntity<String> response = indexApi.processDelete("document-1", request, headers, documentStore);
+        Assert.assertNotNull(response);
+        Assert.assertTrue(HttpStatus.INTERNAL_SERVER_ERROR.value() == response.getStatusCodeValue());
+    }
+
+    @Test
+    public void testUserAuthorization() throws Exception {
+        String transactionId = "transactionId-1";
+        String remoteAddr = "http://127.0.0.1";
+        String content = "content";
+        // Mockito.when(headers.getRequestHeaders()).thenReturn(multivaluedMap);;
+        Mockito.when(multivaluedMap.getFirst(Mockito.anyString())).thenReturn(transactionId);
+        Mockito.when(request.getRemoteAddr()).thenReturn(remoteAddr);
+        Mockito.when(request.getMethod()).thenReturn("testMethod");
+        Mockito.when(request.getRequestURL()).thenReturn(new StringBuffer("http://127.0.0.1"));
+        Mockito.when(request.getRemoteHost()).thenReturn("localhost");
+        Mockito.when(searchServiceApi.validateRequest(Mockito.any(HttpHeaders.class),
+                Mockito.any(HttpServletRequest.class), Mockito.any(ApiUtils.Action.class), Mockito.anyString()))
+                .thenCallRealMethod();
+
+        Mockito.doAnswer(new Answer<ElasticSearchConfig>() {
+            public ElasticSearchConfig answer(InvocationOnMock invocation) {
+                Properties properties = new Properties();
+                return new ElasticSearchConfig(properties);
+            }
+        }).when(httpController).getElasticSearchConfig();
+
+        searchServiceApi.documentStore = httpController;
+
+        ResponseEntity<String> response =
+                documentApi.processPut(content, request, headers, httpResponse, "index", "id-1", documentStore);
+        Assert.assertNotNull(response);
+        Assert.assertTrue(HttpStatus.FORBIDDEN.value() == response.getStatusCodeValue());
+
+        Mockito.doAnswer(new Answer<ElasticSearchConfig>() {
+            public ElasticSearchConfig answer(InvocationOnMock invocation) {
+                Properties properties = new Properties();
+                properties.put(ElasticSearchConfig.ES_AUTH_ENABLED, "true");
+                return new ElasticSearchConfig(properties);
+            }
+        }).when(httpController).getElasticSearchConfig();
+
+
+        response = documentApi.processPut(content, request, headers, httpResponse, "index", "id-1", documentStore);
+        Assert.assertNotNull(response);
+        Assert.assertTrue(HttpStatus.FORBIDDEN.value() == response.getStatusCodeValue());
+
+        Mockito.doAnswer(new Answer<ElasticSearchConfig>() {
+            public ElasticSearchConfig answer(InvocationOnMock invocation) {
+                Properties properties = new Properties();
+                properties.put(ElasticSearchConfig.ES_AUTH_ENABLED, "false");
+                return new ElasticSearchConfig(properties);
+            }
+        }).when(httpController).getElasticSearchConfig();
+
+        DocumentOperationResult result = new DocumentOperationResult();
+        result.setResultCode(302);
+        result.setError(new ErrorResult("type-1", "reason-1"));
+        result.setFailureCause("test-failure");
+        Mockito.when(documentStore.createDocument(Mockito.anyString(), Mockito.any(DocumentStoreDataEntity.class),
+                Mockito.anyBoolean())).thenReturn(result);
+        response = documentApi.processPut(content, request, headers, httpResponse, "index", "id-1", documentStore);
+        Assert.assertNotNull(response);
+        Assert.assertTrue(HttpStatus.FOUND.value() == response.getStatusCodeValue());
+
+    }
 }
\ No newline at end of file
@@ -1,53 +1,53 @@
-/**\r
- * ============LICENSE_START=======================================================\r
- * org.onap.aai\r
- * ================================================================================\r
- * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.\r
- * Copyright © 2017-2018 Amdocs\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- *       http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-package org.onap.aai.sa.searchdbabstraction.elasticsearch.config;\r
-\r
-import java.util.Properties;\r
-import org.junit.Assert;\r
-import org.junit.Before;\r
-import org.junit.Ignore;\r
-import org.junit.Test;\r
-import org.springframework.beans.factory.annotation.Autowired;\r
-\r
-public class ElasticSearchConfigTest {\r
-\r
-    @Autowired\r
-    ElasticSearchConfig elasticSearchConfig;\r
-\r
-    @Before\r
-    public void setUp() {\r
-        Properties prop = new Properties();\r
-        prop.put("es.cluster-name", "cluster-1");\r
-        prop.put("es.ip-address", "127.0.0.1");\r
-        prop.put("es.http-port", "9001");\r
-        // elasticSearchConfig = new ElasticSearchConfig(prop);\r
-    }\r
-\r
-    @Ignore\r
-    @Test\r
-    public void testAllGetMethods() {\r
-        Assert.assertEquals(elasticSearchConfig.getClusterName(), "cluster-1");\r
-        Assert.assertEquals(elasticSearchConfig.getIpAddress(), "127.0.0.1");\r
-        Assert.assertEquals(elasticSearchConfig.getHttpPort(), "9001");\r
-        Assert.assertEquals(elasticSearchConfig.getJavaApiPort(), "9300");\r
-        Assert.assertNotNull(elasticSearchConfig.toString());\r
-    }\r
-}\r
+/**
+ * ============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=========================================================
+ */
+package org.onap.aai.sa.searchdbabstraction.elasticsearch.config;
+
+import java.util.Properties;
+import org.junit.Assert;
+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() {
+        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);
+    }
+
+    @Ignore
+    @Test
+    public void testAllGetMethods() {
+        Assert.assertEquals(elasticSearchConfig.getClusterName(), "cluster-1");
+        Assert.assertEquals(elasticSearchConfig.getIpAddress(), "127.0.0.1");
+        Assert.assertEquals(elasticSearchConfig.getHttpPort(), "9001");
+        Assert.assertEquals(elasticSearchConfig.getJavaApiPort(), "9300");
+        Assert.assertNotNull(elasticSearchConfig.toString());
+    }
+}
-/**\r
- * ============LICENSE_START=======================================================\r
- * org.onap.aai\r
- * ================================================================================\r
- * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.\r
- * Copyright © 2017-2018 Amdocs\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- *       http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-package org.onap.aai.sa.searchdbabstraction.elasticsearch.dao;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-\r
-public class ElasticSearchResultItemTest {\r
-\r
-    @Test\r
-    public void testAllMethods() {\r
-        ElasticSearchShardStatus shardStatus = new ElasticSearchShardStatus();\r
-        shardStatus.setTotal(10);\r
-        shardStatus.setSuccessful(0);\r
-        shardStatus.setFailed(1);\r
-        Assert.assertEquals(shardStatus.getTotal(), 10);\r
-        Assert.assertEquals(shardStatus.getSuccessful(), 0);\r
-        Assert.assertEquals(shardStatus.getFailed(), 1);\r
-\r
-        ElasticSearchCause cause = new ElasticSearchCause();\r
-        cause.setType("type-1");\r
-        cause.setReason("reason-1");\r
-        Assert.assertEquals(cause.getType(), "type-1");\r
-        Assert.assertEquals(cause.getReason(), "reason-1");\r
-\r
-        ElasticSearchError error = new ElasticSearchError();\r
-        error.setType("type-1");\r
-        error.setReason("reason-1");\r
-        error.setCausedBy(cause);\r
-        Assert.assertEquals(error.getType(), "type-1");\r
-        Assert.assertEquals(error.getReason(), "reason-1");\r
-        Assert.assertNotNull(error.getCausedBy());\r
-        error.setAdditionalProperties("name-1", "value-1");\r
-        Assert.assertNotNull(error.getAdditionalProperties());\r
-\r
-        // Create Status\r
-        ElasticSearchResultItem resultItem1 = new ElasticSearchResultItem();\r
-        resultItem1.setCreate(getStatus(shardStatus, error));\r
-        Assert.assertNotNull(resultItem1.getCreate());\r
-        Assert.assertEquals(resultItem1.operationType(), "create");\r
-        Assert.assertEquals(resultItem1.operationStatus(), resultItem1.getCreate());\r
-        Assert.assertTrue(resultItem1.toString().contains("create"));\r
-        Assert.assertNotNull(resultItem1.toJson());\r
-\r
-        // Index Status\r
-        ElasticSearchResultItem resultItem2 = new ElasticSearchResultItem();\r
-        resultItem2.setIndex(getStatus(shardStatus, error));\r
-        Assert.assertNotNull(resultItem2.getIndex());\r
-        Assert.assertEquals(resultItem2.operationType(), "update");\r
-        Assert.assertEquals(resultItem2.operationStatus(), resultItem2.getIndex());\r
-        Assert.assertTrue(resultItem2.toString().contains("index"));\r
-        Assert.assertNotNull(resultItem2.toJson());\r
-\r
-        // Delete Status\r
-        ElasticSearchResultItem resultItem3 = new ElasticSearchResultItem();\r
-        resultItem3.setDelete(getStatus(shardStatus, error));\r
-        Assert.assertNotNull(resultItem3.getDelete());\r
-        Assert.assertEquals(resultItem3.operationType(), "delete");\r
-        Assert.assertEquals(resultItem3.operationStatus(), resultItem3.getDelete());\r
-        Assert.assertTrue(resultItem3.toString().contains("delete"));\r
-        Assert.assertNotNull(resultItem3.toJson());\r
-\r
-        // Unknown Status\r
-        ElasticSearchResultItem resultItem4 = new ElasticSearchResultItem();\r
-        Assert.assertEquals(resultItem4.operationType(), "unknown");\r
-        Assert.assertNull(resultItem4.operationStatus());\r
-\r
-        // ElasticSearchBulkOperationResult\r
-        ElasticSearchResultItem[] resultItems = {resultItem1, resultItem2, resultItem3};\r
-        ElasticSearchBulkOperationResult result = new ElasticSearchBulkOperationResult();\r
-        result.setErrors(true);\r
-        result.setTook(new Integer(10));\r
-        result.setItems(resultItems);\r
-        Assert.assertTrue(result.getErrors());\r
-        Assert.assertEquals(result.getTook(), new Integer(10));\r
-        Assert.assertNotNull(result.getItems());\r
-        Assert.assertNotNull(result.toString());\r
-    }\r
-\r
-    private ElasticSearchOperationStatus getStatus(ElasticSearchShardStatus shardStatus, ElasticSearchError error) {\r
-        ElasticSearchOperationStatus status = new ElasticSearchOperationStatus();\r
-        status.setIndex("index-1");\r
-        status.setType("type-1");\r
-        status.setId("id-1");\r
-        status.setVersion("1.0");\r
-        status.setShards(shardStatus);\r
-        status.setStatus(new Integer(1));\r
-        status.setError(error);\r
-        status.setAdditionalProperties("REQUEST_URL", "http://127.0.0.1");\r
-        Assert.assertEquals(status.getIndex(), "index-1");\r
-        Assert.assertEquals(status.getType(), "type-1");\r
-        Assert.assertEquals(status.getId(), "id-1");\r
-        Assert.assertEquals(status.getVersion(), "1.0");\r
-        Assert.assertEquals(status.getStatus(), new Integer(1));\r
-        Assert.assertNotNull(status.getShards());\r
-        Assert.assertNotNull(status.getError());\r
-        Assert.assertNotNull(status.getAdditionalProperties());\r
-        return status;\r
-    }\r
-\r
-}\r
+/**
+ * ============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=========================================================
+ */
+package org.onap.aai.sa.searchdbabstraction.elasticsearch.dao;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class ElasticSearchResultItemTest {
+
+    @Test
+    public void testAllMethods() {
+        ElasticSearchShardStatus shardStatus = new ElasticSearchShardStatus();
+        shardStatus.setTotal(10);
+        shardStatus.setSuccessful(0);
+        shardStatus.setFailed(1);
+        Assert.assertEquals(shardStatus.getTotal(), 10);
+        Assert.assertEquals(shardStatus.getSuccessful(), 0);
+        Assert.assertEquals(shardStatus.getFailed(), 1);
+
+        ElasticSearchCause cause = new ElasticSearchCause();
+        cause.setType("type-1");
+        cause.setReason("reason-1");
+        Assert.assertEquals(cause.getType(), "type-1");
+        Assert.assertEquals(cause.getReason(), "reason-1");
+
+        ElasticSearchError error = new ElasticSearchError();
+        error.setType("type-1");
+        error.setReason("reason-1");
+        error.setCausedBy(cause);
+        Assert.assertEquals(error.getType(), "type-1");
+        Assert.assertEquals(error.getReason(), "reason-1");
+        Assert.assertNotNull(error.getCausedBy());
+        error.setAdditionalProperties("name-1", "value-1");
+        Assert.assertNotNull(error.getAdditionalProperties());
+
+        // Create Status
+        ElasticSearchResultItem resultItem1 = new ElasticSearchResultItem();
+        resultItem1.setCreate(getStatus(shardStatus, error));
+        Assert.assertNotNull(resultItem1.getCreate());
+        Assert.assertEquals(resultItem1.operationType(), "create");
+        Assert.assertEquals(resultItem1.operationStatus(), resultItem1.getCreate());
+        Assert.assertTrue(resultItem1.toString().contains("create"));
+        Assert.assertNotNull(resultItem1.toJson());
+
+        // Index Status
+        ElasticSearchResultItem resultItem2 = new ElasticSearchResultItem();
+        resultItem2.setIndex(getStatus(shardStatus, error));
+        Assert.assertNotNull(resultItem2.getIndex());
+        Assert.assertEquals(resultItem2.operationType(), "update");
+        Assert.assertEquals(resultItem2.operationStatus(), resultItem2.getIndex());
+        Assert.assertTrue(resultItem2.toString().contains("index"));
+        Assert.assertNotNull(resultItem2.toJson());
+
+        // Delete Status
+        ElasticSearchResultItem resultItem3 = new ElasticSearchResultItem();
+        resultItem3.setDelete(getStatus(shardStatus, error));
+        Assert.assertNotNull(resultItem3.getDelete());
+        Assert.assertEquals(resultItem3.operationType(), "delete");
+        Assert.assertEquals(resultItem3.operationStatus(), resultItem3.getDelete());
+        Assert.assertTrue(resultItem3.toString().contains("delete"));
+        Assert.assertNotNull(resultItem3.toJson());
+
+        // Unknown Status
+        ElasticSearchResultItem resultItem4 = new ElasticSearchResultItem();
+        Assert.assertEquals(resultItem4.operationType(), "unknown");
+        Assert.assertNull(resultItem4.operationStatus());
+
+        // ElasticSearchBulkOperationResult
+        ElasticSearchResultItem[] resultItems = {resultItem1, resultItem2, resultItem3};
+        ElasticSearchBulkOperationResult result = new ElasticSearchBulkOperationResult();
+        result.setErrors(true);
+        result.setTook(new Integer(10));
+        result.setItems(resultItems);
+        Assert.assertTrue(result.getErrors());
+        Assert.assertEquals(result.getTook(), new Integer(10));
+        Assert.assertNotNull(result.getItems());
+        Assert.assertNotNull(result.toString());
+    }
+
+    private ElasticSearchOperationStatus getStatus(ElasticSearchShardStatus shardStatus, ElasticSearchError error) {
+        ElasticSearchOperationStatus status = new ElasticSearchOperationStatus();
+        status.setIndex("index-1");
+        status.setType("type-1");
+        status.setId("id-1");
+        status.setVersion("1.0");
+        status.setShards(shardStatus);
+        status.setStatus(new Integer(1));
+        status.setError(error);
+        status.setAdditionalProperties("REQUEST_URL", "http://127.0.0.1");
+        Assert.assertEquals(status.getIndex(), "index-1");
+        Assert.assertEquals(status.getType(), "type-1");
+        Assert.assertEquals(status.getId(), "id-1");
+        Assert.assertEquals(status.getVersion(), "1.0");
+        Assert.assertEquals(status.getStatus(), new Integer(1));
+        Assert.assertNotNull(status.getShards());
+        Assert.assertNotNull(status.getError());
+        Assert.assertNotNull(status.getAdditionalProperties());
+        return status;
+    }
+
+}
@@ -1,63 +1,63 @@
-/**\r
- * ============LICENSE_START=======================================================\r
- * org.onap.aai\r
- * ================================================================================\r
- * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.\r
- * Copyright © 2017-2018 Amdocs\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- *       http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-package org.onap.aai.sa.searchdbabstraction.searchapi;\r
-\r
-import com.fasterxml.jackson.databind.ObjectMapper;\r
-import java.io.IOException;\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-\r
-public class TermQueryTest {\r
-\r
-    @Test\r
-    public void testAllMethods() throws IOException {\r
-        String field = "searchTags.nested";\r
-        String stringValue = "theValue.nested";\r
-        String termQueryWithStringValueJson = "{\"field\": \"" + field + "\", \"value\": \"" + stringValue + "\"}";\r
-\r
-        ObjectMapper mapper = new ObjectMapper();\r
-        TermQuery stringTermQuery = mapper.readValue(termQueryWithStringValueJson, TermQuery.class);\r
-        Assert.assertEquals(stringValue, stringTermQuery.getValue());\r
-        Assert.assertEquals("searchTags.nested", stringTermQuery.getField());\r
-        stringTermQuery.setOperator("operator-1");\r
-        Assert.assertEquals("operator-1", stringTermQuery.getOperator());\r
-        stringTermQuery.setSearchAnalyzer("search-1");\r
-        Assert.assertEquals("search-1", stringTermQuery.getSearchAnalyzer());\r
-\r
-        String field1 = "searchTags-1 searchTags.second";\r
-        String stringValue1 = "theValue-1 theValue.second";\r
-        String multiFieldTermQueryJSon = "{\"field\": \"" + field1 + "\", \"value\": \"" + stringValue1 + "\"}";\r
-        TermQuery multiFieldTermQuery = mapper.readValue(multiFieldTermQueryJSon, TermQuery.class);\r
-        multiFieldTermQuery.setOperator("and");\r
-        multiFieldTermQuery.setSearchAnalyzer("search-1");\r
-        Assert.assertNotNull(multiFieldTermQuery.toElasticSearch());\r
-        Assert.assertNotNull(multiFieldTermQuery.pathForNestedField(field1));\r
-\r
-        String field2 = "search11 search2";\r
-        String stringValue2 = "theValue1 theValue2";\r
-        String multiFieldTermJSon = "{\"field\": \"" + field2 + "\", \"value\": \"" + stringValue2 + "\"}";\r
-        TermQuery multiFieldTerm = mapper.readValue(multiFieldTermJSon, TermQuery.class);\r
-        multiFieldTerm.setOperator("or");\r
-        multiFieldTerm.setSearchAnalyzer("search-1");\r
-        Assert.assertNotNull(multiFieldTerm.toElasticSearch());\r
-    }\r
-\r
-}\r
+/**
+ * ============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=========================================================
+ */
+package org.onap.aai.sa.searchdbabstraction.searchapi;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import java.io.IOException;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class TermQueryTest {
+
+    @Test
+    public void testAllMethods() throws IOException {
+        String field = "searchTags.nested";
+        String stringValue = "theValue.nested";
+        String termQueryWithStringValueJson = "{\"field\": \"" + field + "\", \"value\": \"" + stringValue + "\"}";
+
+        ObjectMapper mapper = new ObjectMapper();
+        TermQuery stringTermQuery = mapper.readValue(termQueryWithStringValueJson, TermQuery.class);
+        Assert.assertEquals(stringValue, stringTermQuery.getValue());
+        Assert.assertEquals("searchTags.nested", stringTermQuery.getField());
+        stringTermQuery.setOperator("operator-1");
+        Assert.assertEquals("operator-1", stringTermQuery.getOperator());
+        stringTermQuery.setSearchAnalyzer("search-1");
+        Assert.assertEquals("search-1", stringTermQuery.getSearchAnalyzer());
+
+        String field1 = "searchTags-1 searchTags.second";
+        String stringValue1 = "theValue-1 theValue.second";
+        String multiFieldTermQueryJSon = "{\"field\": \"" + field1 + "\", \"value\": \"" + stringValue1 + "\"}";
+        TermQuery multiFieldTermQuery = mapper.readValue(multiFieldTermQueryJSon, TermQuery.class);
+        multiFieldTermQuery.setOperator("and");
+        multiFieldTermQuery.setSearchAnalyzer("search-1");
+        Assert.assertNotNull(multiFieldTermQuery.toElasticSearch());
+        Assert.assertNotNull(multiFieldTermQuery.pathForNestedField(field1));
+
+        String field2 = "search11 search2";
+        String stringValue2 = "theValue1 theValue2";
+        String multiFieldTermJSon = "{\"field\": \"" + field2 + "\", \"value\": \"" + stringValue2 + "\"}";
+        TermQuery multiFieldTerm = mapper.readValue(multiFieldTermJSon, TermQuery.class);
+        multiFieldTerm.setOperator("or");
+        multiFieldTerm.setSearchAnalyzer("search-1");
+        Assert.assertNotNull(multiFieldTerm.toElasticSearch());
+    }
+
+}
@@ -1,63 +1,63 @@
-{\r
-  "roles": [\r
-    {\r
-    "name": "testRole",\r
-    "functions": [{\r
-      "name": "testFunction",\r
-      "methods": [{\r
-        "name": "GET"\r
-      }, {\r
-        "name": "DELETE"\r
-      }, {\r
-        "name": "PUT"\r
-      }\r
-      ]\r
-    }\r
-    ],\r
-    "users": [{\r
-      "username": "testUser"\r
-    }\r
-\r
-    ]\r
-  },\r
-\r
-    {\r
-      "name": "devRole",\r
-      "functions": [{\r
-        "name": "search",\r
-        "methods": [{\r
-          "name": "GET"\r
-        }, {\r
-          "name": "DELETE"\r
-        }, {\r
-          "name": "PUT"\r
-        }\r
-        ]\r
-      }\r
-      ],\r
-      "users": [\r
-        {\r
-          "username": "cn=onap, ou=onap, o=onap, l=ottawa, st=ontario, c=ca"\r
-        }\r
-\r
-      ]\r
-    },\r
-\r
-    {\r
-    "name": "testBasicAuth",\r
-    "functions": [{\r
-      "name": "testBasicAuthFuncyion",\r
-      "methods": [{\r
-        "name": "GET"\r
-      }\r
-      ]\r
-    }\r
-    ],\r
-    "users": [{\r
-      "user": "testBasicAuthUser",\r
-      "pass": "OBF:1ytc1vu91v2p1rxf1mqh1v8s1z0d1msn1san1mqf1z0h1v9u1msl1rvf1v1p1vv11yta"\r
-    }\r
-    ]\r
-  }\r
-  ]\r
+{
+  "roles": [
+    {
+    "name": "testRole",
+    "functions": [{
+      "name": "testFunction",
+      "methods": [{
+        "name": "GET"
+      }, {
+        "name": "DELETE"
+      }, {
+        "name": "PUT"
+      }
+      ]
+    }
+    ],
+    "users": [{
+      "username": "testUser"
+    }
+
+    ]
+  },
+
+    {
+      "name": "devRole",
+      "functions": [{
+        "name": "search",
+        "methods": [{
+          "name": "GET"
+        }, {
+          "name": "DELETE"
+        }, {
+          "name": "PUT"
+        }
+        ]
+      }
+      ],
+      "users": [
+        {
+          "username": "cn=onap, ou=onap, o=onap, l=ottawa, st=ontario, c=ca"
+        }
+
+      ]
+    },
+
+    {
+    "name": "testBasicAuth",
+    "functions": [{
+      "name": "testBasicAuthFuncyion",
+      "methods": [{
+        "name": "GET"
+      }
+      ]
+    }
+    ],
+    "users": [{
+      "user": "testBasicAuthUser",
+      "pass": "OBF:1ytc1vu91v2p1rxf1mqh1v8s1z0d1msn1san1mqf1z0h1v9u1msl1rvf1v1p1vv11yta"
+    }
+    ]
+  }
+  ]
 }
\ No newline at end of file