{"action":"created","comment":{"url":"https://api.github.com/repos/project-sunbird/sunbird-utils/pulls/comments/222589089","pull_request_review_id":161509910,"id":222589089,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyMjU4OTA4OQ==","diff_hunk":"@@ -4,687 +4,902 @@\n import static org.junit.Assert.assertFalse;\n import static org.junit.Assert.assertNotNull;\n import static org.junit.Assert.assertTrue;\n+import static org.powermock.api.mockito.PowerMockito.doNothing;\n+import static org.powermock.api.mockito.PowerMockito.doReturn;\n+import static org.powermock.api.mockito.PowerMockito.mock;\n+import static org.powermock.api.mockito.PowerMockito.when;\n \n-import com.typesafe.config.Config;\n import java.util.ArrayList;\n import java.util.Arrays;\n+import java.util.Collections;\n import java.util.Date;\n import java.util.HashMap;\n import java.util.List;\n import java.util.Map;\n+import java.util.concurrent.ExecutionException;\n+\n+import org.elasticsearch.action.ActionFuture;\n+import org.elasticsearch.action.DocWriteResponse.Result;\n+import org.elasticsearch.action.ListenableActionFuture;\n+import org.elasticsearch.action.admin.indices.create.CreateIndexRequestBuilder;\n+import org.elasticsearch.action.admin.indices.create.CreateIndexResponse;\n+import org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsRequest;\n+import org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsResponse;\n+import org.elasticsearch.action.admin.indices.exists.types.TypesExistsRequest;\n+import org.elasticsearch.action.admin.indices.exists.types.TypesExistsResponse;\n+import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequestBuilder;\n+import org.elasticsearch.action.admin.indices.mapping.put.PutMappingResponse;\n+import org.elasticsearch.action.admin.indices.refresh.RefreshRequestBuilder;\n+import org.elasticsearch.action.admin.indices.refresh.RefreshResponse;\n+import org.elasticsearch.action.bulk.BulkProcessor;\n+import org.elasticsearch.action.bulk.BulkProcessor.Listener;\n+import org.elasticsearch.action.delete.DeleteRequestBuilder;\n+import org.elasticsearch.action.delete.DeleteResponse;\n+import org.elasticsearch.action.get.GetRequestBuilder;\n+import org.elasticsearch.action.get.GetResponse;\n+import org.elasticsearch.action.index.IndexRequest;\n+import org.elasticsearch.action.index.IndexRequestBuilder;\n+import org.elasticsearch.action.index.IndexResponse;\n+import org.elasticsearch.action.search.SearchRequestBuilder;\n+import org.elasticsearch.action.search.SearchResponse;\n+import org.elasticsearch.action.support.master.AcknowledgedResponse;\n+import org.elasticsearch.action.update.UpdateRequest;\n+import org.elasticsearch.action.update.UpdateRequestBuilder;\n+import org.elasticsearch.action.update.UpdateResponse;\n+import org.elasticsearch.client.AdminClient;\n+import org.elasticsearch.client.Client;\n+import org.elasticsearch.client.IndicesAdminClient;\n import org.elasticsearch.client.transport.TransportClient;\n-import org.junit.AfterClass;\n+import org.elasticsearch.search.SearchHit;\n+import org.elasticsearch.search.SearchHits;\n+import org.elasticsearch.search.aggregations.Aggregations;\n+import org.elasticsearch.search.aggregations.bucket.histogram.Histogram;\n+import org.elasticsearch.search.aggregations.bucket.terms.Terms;\n+import org.elasticsearch.search.sort.SortOrder;\n+import org.junit.Assert;\n+import org.junit.Before;\n import org.junit.BeforeClass;\n import org.junit.FixMethodOrder;\n import org.junit.Test;\n+import org.junit.runner.RunWith;\n import org.junit.runners.MethodSorters;\n+import org.mockito.Mockito;\n+import org.powermock.api.mockito.PowerMockito;\n+import org.powermock.core.classloader.annotations.PowerMockIgnore;\n+import org.powermock.core.classloader.annotations.PrepareForTest;\n+import org.powermock.core.classloader.annotations.SuppressStaticInitializationFor;\n+import org.powermock.modules.junit4.PowerMockRunner;\n import org.sunbird.common.exception.ProjectCommonException;\n import org.sunbird.common.models.response.Response;\n+import org.sunbird.common.models.util.HttpUtil;\n import org.sunbird.common.models.util.JsonKey;\n import org.sunbird.common.models.util.ProjectLogger;\n import org.sunbird.common.responsecode.ResponseCode;\n import org.sunbird.common.util.ConfigUtil;\n import org.sunbird.dto.SearchDTO;\n import org.sunbird.helper.ConnectionManager;\n-import org.sunbird.helper.ConnectionManager.ResourceCleanUp;\n import org.sunbird.helper.ElasticSearchMapping;\n import org.sunbird.helper.ElasticSearchSettings;\n \n+import com.typesafe.config.Config;\n+\n @FixMethodOrder(MethodSorters.NAME_ASCENDING)\n+@RunWith(PowerMockRunner.class)\n+@PowerMockIgnore({ \"javax.management.*\", \"javax.net.ssl.*\", \"javax.security.*\" })\n+@PrepareForTest({ ConnectionManager.class, TransportClient.class, AcknowledgedResponse.class, GetRequestBuilder.class,\n+\t\tHttpUtil.class, BulkProcessor.class })\n+@SuppressStaticInitializationFor({ \"org.sunbird.common.ConnectionManager\" })\n public class ElasticSearchUtilTest {\n-  private static Map<String, Object> map = null;\n-  private static Map<String, Object> map1 = null;\n-  private static TransportClient client = null;\n-  private static final String indexName = \"sbtestindex\";\n-  private static final String typeName = \"sbtesttype\";\n-  private static final String STARTS_WITH = \"startsWith\";\n-  private static final String ENDS_WITH = \"endsWith\";\n-  private static long startTime = System.currentTimeMillis();\n-\n-  @BeforeClass\n-  public static void init() {\n-    map = intitialiseMap(5);\n-    map1 = intitialiseMap1(60);\n-    client = ConnectionManager.getClient();\n-  }\n-\n-  @Test\n-  public void testConnectionSuccess() {\n-    client = ConnectionManager.getClient();\n-    assertNotNull(client);\n-  }\n-\n-  @Test\n-  public void acreateIndex() {\n-    boolean response =\n-        ElasticSearchUtil.createIndex(\n-            indexName,\n-            typeName,\n-            ElasticSearchMapping.createMapping(),\n-            ElasticSearchSettings.createSettingsForIndex());\n-    try {\n-      Thread.sleep(2000);\n-    } catch (InterruptedException e) {\n-      ProjectLogger.log(\"Index creation time out\");\n-    }\n-    assertTrue(response);\n-  }\n-\n-  @Test\n-  public void createDataTest() {\n-    String responseId =\n-        ElasticSearchUtil.createData(indexName, typeName, (String) map.get(\"courseId\"), map);\n-    // inserting second record\n-    ElasticSearchUtil.createData(indexName, typeName, (String) map1.get(\"courseId\"), map1);\n-    assertEquals(responseId, map.get(\"courseId\"));\n-    // wait for 1 second since the created data will reflect after some time\n-    try {\n-      Thread.sleep(1000);\n-    } catch (InterruptedException e) {\n-      ProjectLogger.log(e.getMessage(), e);\n-    }\n-  }\n-\n-  @Test\n-  public void getByIdentifier() {\n-    Map<String, Object> responseMap =\n-        ElasticSearchUtil.getDataByIdentifier(indexName, typeName, (String) map.get(\"courseId\"));\n-    assertEquals(responseMap.get(\"courseId\"), map.get(\"courseId\"));\n-  }\n-\n-  @Test\n-  public void updateByIdentifier() {\n-    Map<String, Object> innermap = new HashMap<>();\n-    innermap.put(\"courseName\", \"updatedCourese name\");\n-    innermap.put(\"organisationId\", \"updatedOrgId\");\n-    boolean response =\n-        ElasticSearchUtil.updateData(indexName, typeName, (String) map.get(\"courseId\"), innermap);\n-    assertTrue(response);\n-  }\n-\n-  @Test\n-  public void updateByIdentifierTest() {\n-    Map<String, Object> responseMap =\n-        ElasticSearchUtil.getDataByIdentifier(indexName, typeName, (String) map.get(\"courseId\"));\n-    assertEquals(responseMap.get(\"courseName\"), \"updatedCourese name\");\n-  }\n-\n-  @Test\n-  public void testComplexSearch() {\n-    SearchDTO searchDTO = new SearchDTO();\n-    List<String> fields = new ArrayList<String>();\n-    fields.add(\"courseId\");\n-    fields.add(\"courseType\");\n-    fields.add(\"createdOn\");\n-    fields.add(\"description\");\n-    List<String> excludefields = new ArrayList<String>();\n-    excludefields.add(\"createdOn\");\n-    Map<String, String> sortMap = new HashMap<>();\n-    sortMap.put(\"courseType\", \"ASC\");\n-    searchDTO.setSortBy(sortMap);\n-    searchDTO.setExcludedFields(excludefields);\n-    searchDTO.setLimit(20);\n-    searchDTO.setOffset(0);\n-    Map<String, Object> additionalPro = new HashMap<String, Object>();\n-    searchDTO.addAdditionalProperty(\"test\", additionalPro);\n-    Map<String, Object> additionalProperties = new HashMap<String, Object>();\n-\n-    List<String> existsList = new ArrayList<String>();\n-    existsList.add(\"pkgVersion\");\n-    existsList.add(\"size\");\n-\n-    additionalProperties.put(JsonKey.EXISTS, existsList);\n-    List<String> description = new ArrayList<String>();\n-    description.add(\"This is for chemistry\");\n-    description.add(\"Hindi Jii\");\n-    List<Integer> sizes = new ArrayList<Integer>();\n-    sizes.add(10);\n-    sizes.add(20);\n-    Map<String, Object> filterMap = new HashMap<String, Object>();\n-    filterMap.put(\"description\", description);\n-    filterMap.put(\"size\", sizes);\n-    additionalProperties.put(JsonKey.FILTERS, filterMap);\n-    Map<String, Object> rangeMap = new HashMap<String, Object>();\n-    rangeMap.put(\">\", 0);\n-    filterMap.put(\"pkgVersion\", rangeMap);\n-    Map<String, Object> lexicalMap = new HashMap<>();\n-    lexicalMap.put(STARTS_WITH, \"type\");\n-    filterMap.put(\"courseType\", lexicalMap);\n-    Map<String, Object> lexicalMap1 = new HashMap<>();\n-    lexicalMap1.put(ENDS_WITH, \"sunbird\");\n-    filterMap.put(\"courseAddedByName\", lexicalMap1);\n-    // for exact math key value pair\n-    filterMap.put(\"orgName\", \"Name of the organisation\");\n-\n-    searchDTO.setAdditionalProperties(additionalProperties);\n-    searchDTO.setFields(fields);\n-    searchDTO.setQuery(\"organisation\");\n-    // facets\n-    List<Map<String, String>> facets = new ArrayList<>();\n-    Map<String, String> m1 = new HashMap<>();\n-    m1.put(\"description\", null);\n-    m1.put(\"createdOn\", JsonKey.DATE_HISTOGRAM);\n-    facets.add(m1);\n-    searchDTO.setFacets(facets);\n-\n-    // soft constraints\n-    List<String> mode = Arrays.asList(\"soft\");\n-    searchDTO.setMode(mode);\n-    Map<String, Integer> constraintMap = new HashMap<String, Integer>();\n-    constraintMap.put(\"grades\", 10);\n-    constraintMap.put(\"pkgVersion\", 5);\n-    searchDTO.setSoftConstraints(constraintMap);\n-    searchDTO.setQuery(\"organisation Name published\");\n-\n-    Map map = ElasticSearchUtil.complexSearch(searchDTO, indexName, typeName);\n-\n-    assertEquals(3, map.size());\n-  }\n-\n-  @Test\n-  public void testComplexSearchWithRangeGreater() {\n-    SearchDTO searchDTO = new SearchDTO();\n-    Map<String, Object> additionalProperties = new HashMap<String, Object>();\n-    List<Integer> sizes = new ArrayList<Integer>();\n-    sizes.add(10);\n-    sizes.add(20);\n-    Map<String, Object> filterMap = new HashMap<String, Object>();\n-    filterMap.put(\"size\", sizes);\n-    Map<String, String> innerMap = new HashMap<>();\n-    innerMap.put(\"createdOn\", \"2017-11-06\");\n-    filterMap.put(\">=\", innerMap);\n-    additionalProperties.put(JsonKey.FILTERS, filterMap);\n-    Map<String, Object> rangeMap = new HashMap<String, Object>();\n-    rangeMap.put(\">\", 0);\n-    filterMap.put(\"pkgVersion\", rangeMap);\n-    Map<String, Object> lexicalMap = new HashMap<>();\n-    lexicalMap.put(STARTS_WITH, \"type\");\n-    filterMap.put(\"courseType\", lexicalMap);\n-    Map<String, Object> lexicalMap1 = new HashMap<>();\n-    lexicalMap1.put(ENDS_WITH, \"sunbird\");\n-    filterMap.put(\"courseAddedByName\", lexicalMap1);\n-    // for exact math key value pair\n-    filterMap.put(\"orgName\", \"Name of the organisation\");\n-\n-    searchDTO.setAdditionalProperties(additionalProperties);\n-    searchDTO.setQuery(\"organisation\");\n-    Map map = ElasticSearchUtil.complexSearch(searchDTO, indexName, typeName);\n-    assertEquals(2, map.size());\n-  }\n-\n-  @Test\n-  public void testComplexSearchWithRangeLessThan() {\n-    SearchDTO searchDTO = new SearchDTO();\n-    Map<String, Object> additionalProperties = new HashMap<String, Object>();\n-    List<Integer> sizes = new ArrayList<Integer>();\n-    sizes.add(10);\n-    sizes.add(20);\n-    Map<String, Object> filterMap = new HashMap<String, Object>();\n-    filterMap.put(\"size\", sizes);\n-    Map<String, String> innerMap = new HashMap<>();\n-    innerMap.put(\"createdOn\", \"2017-11-06\");\n-    filterMap.put(\"<=\", innerMap);\n-    additionalProperties.put(JsonKey.FILTERS, filterMap);\n-    Map<String, Object> rangeMap = new HashMap<String, Object>();\n-    rangeMap.put(\">\", 0);\n-    filterMap.put(\"pkgVersion\", rangeMap);\n-    Map<String, Object> lexicalMap = new HashMap<>();\n-    lexicalMap.put(STARTS_WITH, \"type\");\n-    filterMap.put(\"courseType\", lexicalMap);\n-    Map<String, Object> lexicalMap1 = new HashMap<>();\n-    lexicalMap1.put(ENDS_WITH, \"sunbird\");\n-    filterMap.put(\"courseAddedByName\", lexicalMap1);\n-    // for exact math key value pair\n-    filterMap.put(\"orgName\", \"Name of the organisation\");\n-\n-    searchDTO.setAdditionalProperties(additionalProperties);\n-    searchDTO.setQuery(\"organisation\");\n-    Map map = ElasticSearchUtil.complexSearch(searchDTO, indexName, typeName);\n-    assertEquals(2, map.size());\n-  }\n-\n-  @Test\n-  public void getByIdentifierWithOutIndex() {\n-    Map<String, Object> responseMap =\n-        ElasticSearchUtil.getDataByIdentifier(null, typeName, (String) map.get(\"courseId\"));\n-    assertEquals(0, responseMap.size());\n-  }\n-\n-  @Test\n-  public void getByIdentifierWithOutType() {\n-    Map<String, Object> responseMap =\n-        ElasticSearchUtil.getDataByIdentifier(indexName, null, \"testcourse123\");\n-    assertEquals(0, responseMap.size());\n-  }\n-\n-  @Test\n-  public void getByIdentifierWithOutTypeIndexIdentifier() {\n-    Map<String, Object> responseMap = ElasticSearchUtil.getDataByIdentifier(null, null, \"\");\n-    assertEquals(0, responseMap.size());\n-  }\n-\n-  @Test\n-  public void getDataWithOutIdentifier() {\n-    Map<String, Object> responseMap =\n-        ElasticSearchUtil.getDataByIdentifier(indexName, typeName, \"\");\n-    assertEquals(0, responseMap.size());\n-  }\n-\n-  @Test\n-  public void updateDataWithOutIdentifier() {\n-    Map<String, Object> innermap = new HashMap<>();\n-    innermap.put(\"courseName\", \"updatedCourese name\");\n-    innermap.put(\"organisationId\", \"updatedOrgId\");\n-    boolean response = ElasticSearchUtil.updateData(indexName, typeName, null, innermap);\n-    assertFalse(response);\n-  }\n-\n-  @Test\n-  public void updateWithEmptyMap() {\n-    Map<String, Object> innermap = new HashMap<>();\n-    boolean response =\n-        ElasticSearchUtil.updateData(indexName, typeName, (String) map.get(\"courseId\"), innermap);\n-    assertFalse(response);\n-  }\n-\n-  @Test\n-  public void updateWithNullMap() {\n-    boolean response =\n-        ElasticSearchUtil.updateData(indexName, typeName, (String) map.get(\"courseId\"), null);\n-    assertFalse(response);\n-  }\n-\n-  @Test\n-  public void upsertDataWithOutIdentifier() {\n-    Map<String, Object> innermap = new HashMap<>();\n-    innermap.put(\"courseName\", \"updatedCourese name\");\n-    innermap.put(\"organisationId\", \"updatedOrgId\");\n-    boolean response = ElasticSearchUtil.upsertData(indexName, typeName, null, innermap);\n-    assertFalse(response);\n-  }\n-\n-  @Test\n-  public void upsertDataWithOutIndex() {\n-    Map<String, Object> innermap = new HashMap<>();\n-    innermap.put(\"courseName\", \"updatedCourese name\");\n-    innermap.put(\"organisationId\", \"updatedOrgId\");\n-    boolean response =\n-        ElasticSearchUtil.upsertData(null, typeName, (String) map.get(\"courseId\"), innermap);\n-    assertFalse(response);\n-  }\n-\n-  @Test\n-  public void upsertDataWithOutIndexType() {\n-    Map<String, Object> innermap = new HashMap<>();\n-    innermap.put(\"courseName\", \"updatedCourese name\");\n-    innermap.put(\"organisationId\", \"updatedOrgId\");\n-    boolean response =\n-        ElasticSearchUtil.upsertData(null, null, (String) map.get(\"courseId\"), innermap);\n-    assertFalse(response);\n-  }\n-\n-  @Test\n-  public void upsertDataWithEmptyMap() {\n-    Map<String, Object> innermap = new HashMap<>();\n-    boolean response =\n-        ElasticSearchUtil.upsertData(indexName, typeName, (String) map.get(\"courseId\"), innermap);\n-    assertFalse(response);\n-  }\n-\n-  @Test\n-  public void createIndexWithEmptyIndexName() {\n-    boolean response =\n-        ElasticSearchUtil.createIndex(\n-            \"\",\n-            typeName,\n-            ElasticSearchMapping.createMapping(),\n-            ElasticSearchSettings.createSettingsForIndex());\n-    assertFalse(response);\n-  }\n-\n-  @Test\n-  public void createIndexWithEmptyIndexNameAndType() {\n-    boolean response =\n-        ElasticSearchUtil.createIndex(\n-            \"\",\n-            null,\n-            ElasticSearchMapping.createMapping(),\n-            ElasticSearchSettings.createSettingsForIndex());\n-    assertFalse(response);\n-  }\n-\n-  @Test\n-  public void createIndexWithEmptyMapping() {\n-    boolean response =\n-        ElasticSearchUtil.createIndex(\n-            indexName, typeName, null, ElasticSearchSettings.createSettingsForIndex());\n-    assertFalse(response);\n-  }\n-\n-  @Test\n-  public void createIndexWithEmptySettings() {\n-    boolean response =\n-        ElasticSearchUtil.createIndex(\n-            indexName, typeName, ElasticSearchMapping.createMapping(), null);\n-    assertFalse(response);\n-  }\n-\n-  @AfterClass\n-  public static void destroy() {\n-    ElasticSearchUtil.deleteIndex(indexName);\n-    map = null;\n-    ConnectionManager.closeClient();\n-    ConnectionManager.ResourceCleanUp clean = new ResourceCleanUp();\n-    clean.start();\n-  }\n-\n-  private static Map<String, Object> intitialiseMap(int val) {\n-    Map<String, Object> map = new HashMap<>();\n-    map.put(\"courseType\", \"type of the course. all , private\");\n-    map.put(\"description\", \"This is for chemistry\");\n-    map.put(\"size\", 10);\n-    map.put(\"objectType\", \"course\");\n-    map.put(\"courseId\", \"course id_\" + val);\n-    map.put(\"courseName\", \"NTP course_\" + val);\n-    map.put(\"courseDuration\", val);\n-    map.put(\"noOfLecture\", 30 + val);\n-    map.put(\"organisationId\", \"org id\");\n-    map.put(\"orgName\", \"Name of the organisation\");\n-    map.put(\"courseAddedById\", \"who added the course in NTP\");\n-    map.put(\"courseAddedByName\", \"Name of the person who added the course under sunbird\");\n-    map.put(\"coursePublishedById\", \"who published the course\");\n-    map.put(\"coursePublishedByName\", \"who published the course\");\n-    map.put(\"enrollementStartDate\", new Date());\n-    map.put(\"publishedDate\", new Date());\n-    map.put(\"updatedDate\", new Date());\n-    map.put(\"updatedById\", \"last updated by id\");\n-    map.put(\"updatedByName\", \"last updated person name\");\n-\n-    map.put(\"facultyId\", \"faculty for this course\");\n-    map.put(\"facultyName\", \"name of the faculty\");\n-    map.put(\n-        \"CoursecontentType\",\n-        \"list of course content type as comma separated , pdf, video, wordDoc\");\n-    map.put(\"availableFor\", \"[\\\"C.B.S.C\\\",\\\"I.C.S.C\\\",\\\"all\\\"]\");\n-    map.put(\"tutor\", \"[{\\\"id\\\":\\\"name\\\"},{\\\"id\\\":\\\"name\\\"}]\");\n-    map.put(\"operationType\", \"add/updated/delete\");\n-    map.put(\"owner\", \"EkStep\");\n-    // map.put(\"identifier\",\"do_112228048362078208130\");\n-    map.put(\"visibility\", \"Default\");\n-    map.put(\n-        \"downloadUrl\",\n-        \"https://ekstep-public-dev.s3-ap-south-1.amazonaws.com/ecar_files/do_112228048362078208130/test-content-1_1493905653021_do_112228048362078208130_5.0.ecar\");\n-\n-    map.put(\"language\", \"[\\\"Hindi\\\"]\");\n-    map.put(\"mediaType\", \"content\");\n-    map.put(\n-        \"variants\",\n-        \"{\\\"spine\\\": {\\\"ecarUrl\\\": \\\"https://ekstep-public-dev.s3-ap-south-1.amazonaws.com/ecar_files/do_112228048362078208130/test-content-1_1493905655272_do_112228048362078208130_5.0_spine.ecar\\\",\\\"size\\\": 863}}\");\n-    map.put(\"mimeType\", \"application/vnd.ekstep.html-archive\");\n-    map.put(\"osId\", \"org.ekstep.quiz.app\");\n-    map.put(\"languageCode\", \"hi\");\n-    map.put(\"createdOn\", \"2017-05-04T13:47:32.676+0000\");\n-    map.put(\"pkgVersion\", val);\n-    map.put(\"versionKey\", \"1495646809112\");\n-\n-    map.put(\"lastPublishedOn\", \"2017-05-04T13:47:33.000+0000\");\n-    map.put(\n-        \"collections\",\n-        \"[{\\\"identifier\\\": \\\"do_1121912573615472641169\\\",\\\"name\\\": \\\"A\\\",\\\"objectType\\\": \\\"Content\\\",\\\"relation\\\": \\\"hasSequenceMember\\\",\\\"description\\\": \\\"A.\\\",\\\"index\\\": null}]\");\n-    map.put(\"name\", \"Test Content 1\");\n-    map.put(\n-        \"artifactUrl\",\n-        \"https://ekstep-public-dev.s3-ap-south-1.amazonaws.com/content/do_112228048362078208130/artifact/advancedenglishassessment1_1533_1489654074_1489653812104_1492681721669.zip\");\n-    map.put(\"lastUpdatedOn\", \"2017-05-24T17:26:49.112+0000\");\n-    map.put(\"contentType\", \"Story\");\n-    map.put(\"status\", \"Live\");\n-    map.put(\"channel\", \"NTP\");\n-    return map;\n-  }\n-\n-  private static Map<String, Object> intitialiseMap1(int val) {\n-    Map<String, Object> map = new HashMap<>();\n-    map.put(\"courseType\", \"type of the course. all , private\");\n-    map.put(\"description\", \"This is for physics\");\n-    map.put(\"size\", 20);\n-    map.put(\"objectType\", \"course\");\n-    map.put(\"courseId\", \"course id_\" + val);\n-    map.put(\"courseName\", \"NTP course_\" + val);\n-    map.put(\"courseDuration\", val);\n-    map.put(\"noOfLecture\", 30 + val);\n-    map.put(\"organisationId\", \"org id\");\n-    map.put(\"orgName\", \"Name of the organisation\");\n-    map.put(\"courseAddedById\", \"who added the course in NTP\");\n-    map.put(\"courseAddedByName\", \"Name of the person who added the course under sunbird\");\n-    map.put(\"coursePublishedById\", \"who published the course\");\n-    map.put(\"coursePublishedByName\", \"who published the course\");\n-    map.put(\"enrollementStartDate\", new Date());\n-    map.put(\"publishedDate\", new Date());\n-    map.put(\"updatedDate\", new Date());\n-    map.put(\"updatedById\", \"last updated by id\");\n-    map.put(\"updatedByName\", \"last updated person name\");\n-\n-    map.put(\"facultyId\", \"faculty for this course\");\n-    map.put(\"facultyName\", \"name of the faculty\");\n-    map.put(\n-        \"CoursecontentType\",\n-        \"list of course content type as comma separated , pdf, video, wordDoc\");\n-    map.put(\"availableFor\", \"[\\\"C.B.S.C\\\",\\\"I.C.S.C\\\",\\\"all\\\"]\");\n-    map.put(\"tutor\", \"[{\\\"id\\\":\\\"name\\\"},{\\\"id\\\":\\\"name\\\"}]\");\n-    map.put(\"operationType\", \"add/updated/delete\");\n-    map.put(\"owner\", \"EkStep\");\n-    // map.put(\"identifier\",\"do_112228048362078208130\");\n-    map.put(\"visibility\", \"Default\");\n-    map.put(\n-        \"downloadUrl\",\n-        \"https://ekstep-public-dev.s3-ap-south-1.amazonaws.com/ecar_files/do_112228048362078208130/test-content-1_1493905653021_do_112228048362078208130_5.0.ecar\");\n-\n-    map.put(\"language\", \"[\\\"Hindi\\\"]\");\n-    map.put(\"mediaType\", \"content\");\n-    map.put(\n-        \"variants\",\n-        \"{\\\"spine\\\": {\\\"ecarUrl\\\": \\\"https://ekstep-public-dev.s3-ap-south-1.amazonaws.com/ecar_files/do_112228048362078208130/test-content-1_1493905655272_do_112228048362078208130_5.0_spine.ecar\\\",\\\"size\\\": 863}}\");\n-    map.put(\"mimeType\", \"application/vnd.ekstep.html-archive\");\n-    map.put(\"osId\", \"org.ekstep.quiz.app\");\n-    map.put(\"languageCode\", \"hi\");\n-    map.put(\"createdOn\", \"2017-06-04T13:47:32.676+0000\");\n-    map.put(\"pkgVersion\", val);\n-    map.put(\"versionKey\", \"1495646809112\");\n-\n-    map.put(\"lastPublishedOn\", \"2017-05-04T13:47:33.000+0000\");\n-    map.put(\n-        \"collections\",\n-        \"[{\\\"identifier\\\": \\\"do_1121912573615472641169\\\",\\\"name\\\": \\\"A\\\",\\\"objectType\\\": \\\"Content\\\",\\\"relation\\\": \\\"hasSequenceMember\\\",\\\"description\\\": \\\"A.\\\",\\\"index\\\": null}]\");\n-    map.put(\"name\", \"Test Content 1\");\n-    map.put(\n-        \"artifactUrl\",\n-        \"https://ekstep-public-dev.s3-ap-south-1.amazonaws.com/content/do_112228048362078208130/artifact/advancedenglishassessment1_1533_1489654074_1489653812104_1492681721669.zip\");\n-    map.put(\"lastUpdatedOn\", \"2017-05-24T17:26:49.112+0000\");\n-    map.put(\"contentType\", \"Story\");\n-    map.put(\"status\", \"Live\");\n-    map.put(\"channel\", \"NTP\");\n-    return map;\n-  }\n-\n-  @Test\n-  public void saveDataWithOutIndexname() {\n-    String responseMap =\n-        ElasticSearchUtil.createData(\"\", typeName, (String) map.get(\"courseId\"), map);\n-    assertEquals(\"ERROR\", responseMap);\n-  }\n-\n-  @Test\n-  public void saveDataWithOutTypeName() {\n-    String responseMap =\n-        ElasticSearchUtil.createData(indexName, \"\", (String) map.get(\"courseId\"), map);\n-    assertEquals(\"ERROR\", responseMap);\n-  }\n-\n-  @Test\n-  public void getDataByEmptyIdentifier() {\n-    Map<String, Object> responseMap =\n-        ElasticSearchUtil.getDataByIdentifier(indexName, typeName, \"\");\n-    assertEquals(0, responseMap.size());\n-  }\n-\n-  @Test\n-  public void searchDtoGetQueryTest() {\n-    SearchDTO dto = new SearchDTO();\n-    List<Map<String, Object>> list = new ArrayList<>();\n-    Map<String, Object> map = new HashMap<>();\n-    map.put(\"name\", \"test1\");\n-    list.add(map);\n-    dto.setGroupQuery(list);\n-    list = dto.getGroupQuery();\n-    assertEquals(1, list.size());\n-    dto.setOperation(\"add\");\n-    assertEquals(\"add\", dto.getOperation());\n-    dto.setFuzzySearch(true);\n-    assertTrue(dto.isFuzzySearch());\n-  }\n-\n-  @Test\n-  public void searchDtoArgumentedConst() {\n-    List<Map> list = new ArrayList<>();\n-    Map map = new HashMap();\n-    map.put(\"name\", \"test1\");\n-    list.add(map);\n-    SearchDTO dto = new SearchDTO(list, \"add\", 5);\n-    assertEquals(1, dto.getProperties().size());\n-    map.put(\"city\", \"mycity\");\n-    list.add(map);\n-    dto.setProperties(list);\n-    assertEquals(2, dto.getProperties().get(0).size());\n-  }\n-\n-  @Test\n-  public void zRemoveDataByIdentifier() {\n-    boolean response =\n-        ElasticSearchUtil.removeData(indexName, typeName, (String) map.get(\"courseId\"));\n-    assertEquals(true, response);\n-  }\n-\n-  @Test\n-  public void zyRemoveDataByIdentifierFailure() {\n-    boolean response = ElasticSearchUtil.removeData(indexName, typeName, \"\");\n-    assertEquals(false, response);\n-  }\n-\n-  @Test\n-  public void checkMappingObject() {\n-    ElasticSearchMapping mapping = new ElasticSearchMapping();\n-    assertTrue(mapping != null);\n-  }\n-\n-  @Test\n-  public void checkSettingsObject() {\n-    ElasticSearchSettings settings = new ElasticSearchSettings();\n-    assertTrue(settings != null);\n-  }\n-\n-  // @Test\n-  public void zzyTestWhenClusterisNull() {\n-    ElasticSearchUtil.deleteIndex(indexName);\n-    ConnectionManager.closeClient();\n-    ConnectionManager.getClient();\n-  }\n-\n-  @Test\n-  public void failureConnectionTestFromProperties() {\n-    boolean response =\n-        ConnectionManager.initialiseConnectionFromPropertiesFile(\n-            \"Test\", \"localhost1,128.0.0.1\", \"9200,9300\");\n-    assertFalse(response);\n-  }\n-\n-  @Test\n-  public void checkHealth() {\n-    boolean response = false;\n-    try {\n-      response = ElasticSearchUtil.healthCheck();\n-    } catch (Exception e) {\n-\n-    }\n-    assertEquals(true, response);\n-  }\n-\n-  @Test\n-  public void upsertDataTest() {\n-    Map<String, Object> data = new HashMap<String, Object>();\n-    data.put(\"test\", \"test\");\n-    boolean response = ElasticSearchUtil.upsertData(indexName, typeName, \"test-12349\", data);\n-    assertEquals(true, response);\n-  }\n-\n-  @Test\n-  public void bulkInsertTest() {\n-    Map<String, Object> data = new HashMap<String, Object>();\n-    data.put(\"test1\", \"test\");\n-    data.put(\"test2\", \"manzarul\");\n-    List<Map<String, Object>> listOfMap = new ArrayList<Map<String, Object>>();\n-    listOfMap.add(data);\n-    boolean response = ElasticSearchUtil.bulkInsertData(indexName, typeName, listOfMap);\n-    assertEquals(true, response);\n-  }\n-\n-  @Test\n-  public void search() {\n-    Map<String, Object> data = new HashMap<String, Object>();\n-    data.put(\"test1\", \"test\");\n-    try {\n-      Map<String, Object> map = ElasticSearchUtil.searchData(indexName, typeName, data);\n-      assertTrue(map != null);\n-      assertTrue(map.size() == 0);\n-    } catch (Exception e) {\n-    }\n-  }\n-\n-  @Test\n-  public void mappingAddOrUpdateTest() {\n-    boolean bool =\n-        ElasticSearchUtil.addOrUpdateMapping(\n-            indexName, typeName, ElasticSearchMapping.createMapping());\n-    assertTrue(bool);\n-  }\n-\n-  @Test\n-  public void searchMetricsDataTestSuccess() {\n-    String index = \"searchindex\";\n-    String type = \"user\";\n-    String rawQuery = \"{\\\"query\\\":{\\\"match_none\\\":{}}}\";\n-    Response response = ElasticSearchUtil.searchMetricsData(index, type, rawQuery);\n-    assertEquals(ResponseCode.OK, response.getResponseCode());\n-  }\n-\n-  @Test\n-  public void searchMetricsDataTestException() {\n-    String index = \"searchtest\";\n-    String type = \"usertest\";\n-    String rawQuery = \"{\\\"query\\\":{\\\"match_none\\\":{}}}\";\n-    try {\n-      ElasticSearchUtil.searchMetricsData(index, type, rawQuery);\n-    } catch (ProjectCommonException e) {\n-      assertEquals(ResponseCode.unableToConnectToES.getErrorCode(), e.getCode());\n-    }\n-  }\n-\n-  public void testcalculateEndTime() {\n-    long endTime = ElasticSearchUtil.calculateEndTime(startTime);\n-    assertTrue(endTime > startTime);\n-  }\n-\n-  @Test\n-  public void testVerifyAndCreateIndicesAndTypes() {\n-    Config config = ConfigUtil.getConfig(ElasticSearchUtil.ES_CONFIG_FILE);\n-    List<Object> list = (List) config.getAnyRefList(\"elasticsearch.indices\");\n-    for (Object obj : list) {\n-      Map<String, Object> map = (Map) obj;\n-      String indexName = (String) map.get(JsonKey.NAME);\n-      List<String> types = (List<String>) map.get(JsonKey.ES_TYPES);\n-      assertEquals(ElasticSearchUtil.indexMap.get(indexName), true);\n-      for (String type : types) {\n-        assertEquals(ElasticSearchUtil.typeMap.get(type), true);\n-      }\n-    }\n-  }\n+\tprivate static Map<String, Object> chemistryMap = null;\n+\tprivate static Map<String, Object> physicsMap = null;\n+\tprivate static TransportClient client = null;\n+\tprivate static final String INDEX_NAME = \"sbtestindex\";\n+\tprivate static final String TYPE_NAME = \"sbtesttype\";\n+\tprivate static final String STARTS_WITH = \"startsWith\";\n+\tprivate static final String ENDS_WITH = \"endsWith\";\n+\tprivate static final long START_TIME = System.currentTimeMillis();\n+\n+\t@BeforeClass\n+\tpublic static void initClass() throws Exception {\n+\t\tchemistryMap = initializeChemistryCourse(5);\n+\t\tphysicsMap = intitializePhysicsCourse(60);\n+\t\t\n+\n+\t}\n+\n+\t@Before\n+\tpublic void initBeforeTest()  {\n+\t\t\n+\t\t//Initialize mock objects before the tests.\n+\t\tmockBaseRules();\n+\t\tmockRulesForGet();\n+\t\tmockRulesForInsert();\n+\t\tmockRulesForUpdate();\n+\t\tmockRulesForDelete();\n+\t\t\n+\t\tmockRulesForIndexes();\n+\t\tmockRulesHttpRequest();\n+\t\tmockRulesBulkInsert();\n+\n+\t}\n+\t\n+\t@Test\n+\tpublic void testConnectionSuccess() {\n+\t\tTransportClient client = mock(TransportClient.class);\n+\t\tassertNotNull(client);\n+\t}\n+\n+\t@Test\n+\tpublic void testCreateIndexSuccess() {\n+\t\tboolean response = ElasticSearchUtil.createIndex(INDEX_NAME, TYPE_NAME, ElasticSearchMapping.createMapping(),\n+\t\t\t\tElasticSearchSettings.createSettingsForIndex());\n+\t\ttry {\n+\t\t\tThread.sleep(2000);\n+\t\t} catch (InterruptedException e) {\n+\t\t\tProjectLogger.log(\"Index creation time out\");\n+\t\t}\n+\t\tassertTrue(response);\n+\t}\n+\n+\t@Test\n+\tpublic void testCreateDataSuccess() {\n+\n+\t\tString responseId = ElasticSearchUtil.createData(INDEX_NAME, TYPE_NAME, (String) chemistryMap.get(\"courseId\"), chemistryMap);\n+\t\t// inserting second record\n+\t\tElasticSearchUtil.createData(INDEX_NAME, TYPE_NAME, (String) physicsMap.get(\"courseId\"), physicsMap);\n+\t\tassertEquals(responseId, chemistryMap.get(\"courseId\"));\n+\t\t// wait for 1 second since the created data will reflect after some time\n+\t\ttry {\n+\t\t\tThread.sleep(1000);\n+\t\t} catch (InterruptedException e) {\n+\t\t\tProjectLogger.log(e.getMessage(), e);\n+\t\t}\n+\t}\n+\n+\t@Test\n+\tpublic void testGetByIdentifierSuccess() {\n+\t\tMap<String, Object> responseMap = ElasticSearchUtil.getDataByIdentifier(INDEX_NAME, TYPE_NAME,\n+\t\t\t\t(String) chemistryMap.get(\"courseId\"));\n+\t\tassertEquals(responseMap.get(\"courseId\"), chemistryMap.get(\"courseId\"));\n+\t}\n+\n+\t@Test\n+\tpublic void testUpdateByIdentifierSuccess() {\n+\t\tMap<String, Object> innermap = new HashMap<>();\n+\t\tinnermap.put(\"courseName\", \"updatedCourese name\");\n+\t\tinnermap.put(\"organisationId\", \"updatedOrgId\");\n+\t\t\n+\t\tGetRequestBuilder grb = mock(GetRequestBuilder.class);\n+\t\tGetResponse getResponse = mock(GetResponse.class);\n+\t\twhen(client.prepareGet(Mockito.anyString(), Mockito.anyString(), Mockito.eq((String) chemistryMap.get(\"courseId\"))))\n+\t\t\t\t.thenReturn(grb);\n+\t\twhen(grb.get()).thenReturn(getResponse);\n+\t\twhen(getResponse.getSource()).thenReturn(innermap);\n+\t\t\n+\t\t\n+\t\tboolean response = ElasticSearchUtil.updateData(INDEX_NAME, TYPE_NAME, (String) chemistryMap.get(\"courseId\"), innermap);\n+\t\tassertTrue(response);\n+\t\tMap<String, Object> responseMap = ElasticSearchUtil.getDataByIdentifier(INDEX_NAME, TYPE_NAME,\n+\t\t\t\t(String) chemistryMap.get(\"courseId\"));\n+\t\tassertEquals(responseMap.get(\"courseName\"), \"updatedCourese name\");\n+\t}\n+\n+\t@Test\n+\tpublic void testComplexSearchSuccess() throws Exception {\n+\t\tSearchDTO searchDTO = new SearchDTO();\n+\t\tList<String> fields = new ArrayList<String>();\n+\t\tfields.add(\"courseId\");\n+\t\tfields.add(\"courseType\");\n+\t\tfields.add(\"createdOn\");\n+\t\tfields.add(\"description\");\n+\t\tList<String> excludefields = new ArrayList<String>();\n+\t\texcludefields.add(\"createdOn\");\n+\t\tMap<String, String> sortMap = new HashMap<>();\n+\t\tsortMap.put(\"courseType\", \"ASC\");\n+\t\tsearchDTO.setSortBy(sortMap);\n+\t\tsearchDTO.setExcludedFields(excludefields);\n+\t\tsearchDTO.setLimit(20);\n+\t\tsearchDTO.setOffset(0);\n+\t\tMap<String, Object> additionalPro = new HashMap<String, Object>();\n+\t\tsearchDTO.addAdditionalProperty(\"test\", additionalPro);\n+\t\tMap<String, Object> additionalProperties = new HashMap<String, Object>();\n+\n+\t\tList<String> existsList = new ArrayList<String>();\n+\t\texistsList.add(\"pkgVersion\");\n+\t\texistsList.add(\"size\");\n+\n+\t\tadditionalProperties.put(JsonKey.EXISTS, existsList);\n+\t\tList<String> description = new ArrayList<String>();\n+\t\tdescription.add(\"This is for chemistry\");\n+\t\tdescription.add(\"Hindi Jii\");\n+\t\tList<Integer> sizes = new ArrayList<Integer>();\n+\t\tsizes.add(10);\n+\t\tsizes.add(20);\n+\t\tMap<String, Object> filterMap = new HashMap<String, Object>();\n+\t\tfilterMap.put(\"description\", description);\n+\t\tfilterMap.put(\"size\", sizes);\n+\t\tadditionalProperties.put(JsonKey.FILTERS, filterMap);\n+\t\tMap<String, Object> rangeMap = new HashMap<String, Object>();\n+\t\trangeMap.put(\">\", 0);\n+\t\tfilterMap.put(\"pkgVersion\", rangeMap);\n+\t\tMap<String, Object> lexicalMap = new HashMap<>();\n+\t\tlexicalMap.put(STARTS_WITH, \"type\");\n+\t\tfilterMap.put(\"courseType\", lexicalMap);\n+\t\tMap<String, Object> lexicalMap1 = new HashMap<>();\n+\t\tlexicalMap1.put(ENDS_WITH, \"sunbird\");\n+\t\tfilterMap.put(\"courseAddedByName\", lexicalMap1);\n+\t\t// for exact math key value pair\n+\t\tfilterMap.put(\"orgName\", \"Name of the organisation\");\n+\n+\t\tsearchDTO.setAdditionalProperties(additionalProperties);\n+\t\tsearchDTO.setFields(fields);\n+\t\tsearchDTO.setQuery(\"organisation\");\n+\t\t// facets\n+\t\tList<Map<String, String>> facets = new ArrayList<>();\n+\t\tMap<String, String> m1 = new HashMap<>();\n+\t\tm1.put(\"description\", null);\n+\t\tm1.put(\"createdOn\", JsonKey.DATE_HISTOGRAM);\n+\t\tfacets.add(m1);\n+\t\tsearchDTO.setFacets(facets);\n+\n+\t\t// soft constraints\n+\t\tList<String> mode = Arrays.asList(\"soft\");\n+\t\tsearchDTO.setMode(mode);\n+\t\tMap<String, Integer> constraintMap = new HashMap<String, Integer>();\n+\t\tconstraintMap.put(\"grades\", 10);\n+\t\tconstraintMap.put(\"pkgVersion\", 5);\n+\t\tsearchDTO.setSoftConstraints(constraintMap);\n+\t\tsearchDTO.setQuery(\"organisation Name published\");\n+\t\tmockRulesForSearch(3);\n+\t\tMap map = ElasticSearchUtil.complexSearch(searchDTO, INDEX_NAME, TYPE_NAME);\n+\n+\t\tassertEquals(3, map.size());\n+\t}\n+\n+\t@Test\n+\tpublic void testComplexSearchWithRangeGreaterThanSuccess() {\n+\t\tSearchDTO searchDTO = new SearchDTO();\n+\t\tMap<String, Object> additionalProperties = new HashMap<String, Object>();\n+\t\tList<Integer> sizes = new ArrayList<Integer>();\n+\t\tsizes.add(10);\n+\t\tsizes.add(20);\n+\t\tMap<String, Object> filterMap = new HashMap<String, Object>();\n+\t\tfilterMap.put(\"size\", sizes);\n+\t\tMap<String, String> innerMap = new HashMap<>();\n+\t\tinnerMap.put(\"createdOn\", \"2017-11-06\");\n+\t\tfilterMap.put(\">=\", innerMap);\n+\t\tadditionalProperties.put(JsonKey.FILTERS, filterMap);\n+\t\tMap<String, Object> rangeMap = new HashMap<String, Object>();\n+\t\trangeMap.put(\">\", 0);\n+\t\tfilterMap.put(\"pkgVersion\", rangeMap);\n+\t\tMap<String, Object> lexicalMap = new HashMap<>();\n+\t\tlexicalMap.put(STARTS_WITH, \"type\");\n+\t\tfilterMap.put(\"courseType\", lexicalMap);\n+\t\tMap<String, Object> lexicalMap1 = new HashMap<>();\n+\t\tlexicalMap1.put(ENDS_WITH, \"sunbird\");\n+\t\tfilterMap.put(\"courseAddedByName\", lexicalMap1);\n+\t\t// for exact math key value pair\n+\t\tfilterMap.put(\"orgName\", \"Name of the organisation\");\n+\n+\t\tsearchDTO.setAdditionalProperties(additionalProperties);\n+\t\tsearchDTO.setQuery(\"organisation\");\n+\t\tmockRulesForSearch(3);\n+\n+\t\tMap map = ElasticSearchUtil.complexSearch(searchDTO, INDEX_NAME, TYPE_NAME);\n+\t\tassertEquals(2, map.size());\n+\t}\n+\n+\t@Test\n+\tpublic void testComplexSearchWithRangeLessThanSuccess() {\n+\t\tSearchDTO searchDTO = new SearchDTO();\n+\t\tMap<String, Object> additionalProperties = new HashMap<String, Object>();\n+\t\tList<Integer> sizes = new ArrayList<Integer>();\n+\t\tsizes.add(10);\n+\t\tsizes.add(20);\n+\t\tMap<String, Object> filterMap = new HashMap<String, Object>();\n+\t\tfilterMap.put(\"size\", sizes);\n+\t\tMap<String, String> innerMap = new HashMap<>();\n+\t\tinnerMap.put(\"createdOn\", \"2017-11-06\");\n+\t\tfilterMap.put(\"<=\", innerMap);\n+\t\tadditionalProperties.put(JsonKey.FILTERS, filterMap);\n+\t\tMap<String, Object> rangeMap = new HashMap<String, Object>();\n+\t\trangeMap.put(\">\", 0);\n+\t\tfilterMap.put(\"pkgVersion\", rangeMap);\n+\t\tMap<String, Object> lexicalMap = new HashMap<>();\n+\t\tlexicalMap.put(STARTS_WITH, \"type\");\n+\t\tfilterMap.put(\"courseType\", lexicalMap);\n+\t\tMap<String, Object> lexicalMap1 = new HashMap<>();\n+\t\tlexicalMap1.put(ENDS_WITH, \"sunbird\");\n+\t\tfilterMap.put(\"courseAddedByName\", lexicalMap1);\n+\t\t// for exact math key value pair\n+\t\tfilterMap.put(\"orgName\", \"Name of the organisation\");\n+\n+\t\tsearchDTO.setAdditionalProperties(additionalProperties);\n+\t\tsearchDTO.setQuery(\"organisation\");\n+\t\tmockRulesForSearch(3);\n+\t\tMap map = ElasticSearchUtil.complexSearch(searchDTO, INDEX_NAME, TYPE_NAME);\n+\t\tassertEquals(2, map.size());\n+\t}\n+\n+\t@Test\n+\tpublic void testGetByIdentifierWithoutIndexFailure() {\n+\t\tMap<String, Object> responseMap = ElasticSearchUtil.getDataByIdentifier(null, TYPE_NAME,\n+\t\t\t\t(String) chemistryMap.get(\"courseId\"));\n+\t\tassertEquals(0, responseMap.size());\n+\t}\n+\n+\t@Test\n+\tpublic void testGetByIdentifierWithoutTypeFailure() {\n+\t\tmockRulesForGet(true);\n+\t\tMap<String, Object> responseMap = ElasticSearchUtil.getDataByIdentifier(INDEX_NAME, null, \"testcourse123\");\n+\n+\t\tassertEquals(0, responseMap.size());\n+\t}\n+\n+\t@Test\n+\tpublic void testGetByIdentifierWithoutTypeAndIndexIdentifierFailure() {\n+\t\tMap<String, Object> responseMap = ElasticSearchUtil.getDataByIdentifier(null, null, \"\");\n+\t\tassertEquals(0, responseMap.size());\n+\t}\n+\n+\t@Test\n+\tpublic void testGetDataWithoutIdentifierFailure() {\n+\t\tMap<String, Object> responseMap = ElasticSearchUtil.getDataByIdentifier(INDEX_NAME, TYPE_NAME, \"\");\n+\t\tassertEquals(0, responseMap.size());\n+\t}\n+\n+\t@Test\n+\tpublic void testUpdateDataWithutIdentifierFailure() {\n+\t\tMap<String, Object> innermap = new HashMap<>();\n+\t\tinnermap.put(\"courseName\", \"updatedCourese name\");","path":"elasticsearch-util/src/test/java/org/sunbird/common/ElasticSearchUtilTest.java","position":1009,"original_position":1009,"commit_id":"21abb3e0aa337d17f86261882ebf612a7b53ada6","original_commit_id":"21abb3e0aa337d17f86261882ebf612a7b53ada6","user":{"login":"bvinayakumar","id":36028332,"node_id":"MDQ6VXNlcjM2MDI4MzMy","avatar_url":"https://avatars3.githubusercontent.com/u/36028332?v=4","gravatar_id":"","url":"https://api.github.com/users/bvinayakumar","html_url":"https://github.com/bvinayakumar","followers_url":"https://api.github.com/users/bvinayakumar/followers","following_url":"https://api.github.com/users/bvinayakumar/following{/other_user}","gists_url":"https://api.github.com/users/bvinayakumar/gists{/gist_id}","starred_url":"https://api.github.com/users/bvinayakumar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bvinayakumar/subscriptions","organizations_url":"https://api.github.com/users/bvinayakumar/orgs","repos_url":"https://api.github.com/users/bvinayakumar/repos","events_url":"https://api.github.com/users/bvinayakumar/events{/privacy}","received_events_url":"https://api.github.com/users/bvinayakumar/received_events","type":"User","site_admin":false},"body":"Updated course name","created_at":"2018-10-04T09:00:23Z","updated_at":"2018-10-04T09:00:23Z","html_url":"https://github.com/project-sunbird/sunbird-utils/pull/157#discussion_r222589089","pull_request_url":"https://api.github.com/repos/project-sunbird/sunbird-utils/pulls/157","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/project-sunbird/sunbird-utils/pulls/comments/222589089"},"html":{"href":"https://github.com/project-sunbird/sunbird-utils/pull/157#discussion_r222589089"},"pull_request":{"href":"https://api.github.com/repos/project-sunbird/sunbird-utils/pulls/157"}}},"pull_request":{"url":"https://api.github.com/repos/project-sunbird/sunbird-utils/pulls/157","id":219920800,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE5OTIwODAw","html_url":"https://github.com/project-sunbird/sunbird-utils/pull/157","diff_url":"https://github.com/project-sunbird/sunbird-utils/pull/157.diff","patch_url":"https://github.com/project-sunbird/sunbird-utils/pull/157.patch","issue_url":"https://api.github.com/repos/project-sunbird/sunbird-utils/issues/157","number":157,"state":"open","locked":false,"title":"Merging the changes for elast-search-unit by switching to latest branch.","user":{"login":"amolnin","id":42316446,"node_id":"MDQ6VXNlcjQyMzE2NDQ2","avatar_url":"https://avatars0.githubusercontent.com/u/42316446?v=4","gravatar_id":"","url":"https://api.github.com/users/amolnin","html_url":"https://github.com/amolnin","followers_url":"https://api.github.com/users/amolnin/followers","following_url":"https://api.github.com/users/amolnin/following{/other_user}","gists_url":"https://api.github.com/users/amolnin/gists{/gist_id}","starred_url":"https://api.github.com/users/amolnin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amolnin/subscriptions","organizations_url":"https://api.github.com/users/amolnin/orgs","repos_url":"https://api.github.com/users/amolnin/repos","events_url":"https://api.github.com/users/amolnin/events{/privacy}","received_events_url":"https://api.github.com/users/amolnin/received_events","type":"User","site_admin":false},"body":"Merge request along with all the requestsed changes","created_at":"2018-10-03T05:43:48Z","updated_at":"2018-10-04T09:00:23Z","closed_at":null,"merged_at":null,"merge_commit_sha":"045175cc4ad37b20ece07d1a31884ca3472d294e","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/project-sunbird/sunbird-utils/pulls/157/commits","review_comments_url":"https://api.github.com/repos/project-sunbird/sunbird-utils/pulls/157/comments","review_comment_url":"https://api.github.com/repos/project-sunbird/sunbird-utils/pulls/comments{/number}","comments_url":"https://api.github.com/repos/project-sunbird/sunbird-utils/issues/157/comments","statuses_url":"https://api.github.com/repos/project-sunbird/sunbird-utils/statuses/21abb3e0aa337d17f86261882ebf612a7b53ada6","head":{"label":"project-sunbird:elastic-search-unit2","ref":"elastic-search-unit2","sha":"21abb3e0aa337d17f86261882ebf612a7b53ada6","user":{"login":"project-sunbird","id":26705730,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI2NzA1NzMw","avatar_url":"https://avatars1.githubusercontent.com/u/26705730?v=4","gravatar_id":"","url":"https://api.github.com/users/project-sunbird","html_url":"https://github.com/project-sunbird","followers_url":"https://api.github.com/users/project-sunbird/followers","following_url":"https://api.github.com/users/project-sunbird/following{/other_user}","gists_url":"https://api.github.com/users/project-sunbird/gists{/gist_id}","starred_url":"https://api.github.com/users/project-sunbird/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/project-sunbird/subscriptions","organizations_url":"https://api.github.com/users/project-sunbird/orgs","repos_url":"https://api.github.com/users/project-sunbird/repos","events_url":"https://api.github.com/users/project-sunbird/events{/privacy}","received_events_url":"https://api.github.com/users/project-sunbird/received_events","type":"Organization","site_admin":false},"repo":{"id":96123627,"node_id":"MDEwOlJlcG9zaXRvcnk5NjEyMzYyNw==","name":"sunbird-utils","full_name":"project-sunbird/sunbird-utils","private":false,"owner":{"login":"project-sunbird","id":26705730,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI2NzA1NzMw","avatar_url":"https://avatars1.githubusercontent.com/u/26705730?v=4","gravatar_id":"","url":"https://api.github.com/users/project-sunbird","html_url":"https://github.com/project-sunbird","followers_url":"https://api.github.com/users/project-sunbird/followers","following_url":"https://api.github.com/users/project-sunbird/following{/other_user}","gists_url":"https://api.github.com/users/project-sunbird/gists{/gist_id}","starred_url":"https://api.github.com/users/project-sunbird/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/project-sunbird/subscriptions","organizations_url":"https://api.github.com/users/project-sunbird/orgs","repos_url":"https://api.github.com/users/project-sunbird/repos","events_url":"https://api.github.com/users/project-sunbird/events{/privacy}","received_events_url":"https://api.github.com/users/project-sunbird/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/project-sunbird/sunbird-utils","description":"Common java utilities used by other Sunbird components","fork":false,"url":"https://api.github.com/repos/project-sunbird/sunbird-utils","forks_url":"https://api.github.com/repos/project-sunbird/sunbird-utils/forks","keys_url":"https://api.github.com/repos/project-sunbird/sunbird-utils/keys{/key_id}","collaborators_url":"https://api.github.com/repos/project-sunbird/sunbird-utils/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/project-sunbird/sunbird-utils/teams","hooks_url":"https://api.github.com/repos/project-sunbird/sunbird-utils/hooks","issue_events_url":"https://api.github.com/repos/project-sunbird/sunbird-utils/issues/events{/number}","events_url":"https://api.github.com/repos/project-sunbird/sunbird-utils/events","assignees_url":"https://api.github.com/repos/project-sunbird/sunbird-utils/assignees{/user}","branches_url":"https://api.github.com/repos/project-sunbird/sunbird-utils/branches{/branch}","tags_url":"https://api.github.com/repos/project-sunbird/sunbird-utils/tags","blobs_url":"https://api.github.com/repos/project-sunbird/sunbird-utils/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/project-sunbird/sunbird-utils/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/project-sunbird/sunbird-utils/git/refs{/sha}","trees_url":"https://api.github.com/repos/project-sunbird/sunbird-utils/git/trees{/sha}","statuses_url":"https://api.github.com/repos/project-sunbird/sunbird-utils/statuses/{sha}","languages_url":"https://api.github.com/repos/project-sunbird/sunbird-utils/languages","stargazers_url":"https://api.github.com/repos/project-sunbird/sunbird-utils/stargazers","contributors_url":"https://api.github.com/repos/project-sunbird/sunbird-utils/contributors","subscribers_url":"https://api.github.com/repos/project-sunbird/sunbird-utils/subscribers","subscription_url":"https://api.github.com/repos/project-sunbird/sunbird-utils/subscription","commits_url":"https://api.github.com/repos/project-sunbird/sunbird-utils/commits{/sha}","git_commits_url":"https://api.github.com/repos/project-sunbird/sunbird-utils/git/commits{/sha}","comments_url":"https://api.github.com/repos/project-sunbird/sunbird-utils/comments{/number}","issue_comment_url":"https://api.github.com/repos/project-sunbird/sunbird-utils/issues/comments{/number}","contents_url":"https://api.github.com/repos/project-sunbird/sunbird-utils/contents/{+path}","compare_url":"https://api.github.com/repos/project-sunbird/sunbird-utils/compare/{base}...{head}","merges_url":"https://api.github.com/repos/project-sunbird/sunbird-utils/merges","archive_url":"https://api.github.com/repos/project-sunbird/sunbird-utils/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/project-sunbird/sunbird-utils/downloads","issues_url":"https://api.github.com/repos/project-sunbird/sunbird-utils/issues{/number}","pulls_url":"https://api.github.com/repos/project-sunbird/sunbird-utils/pulls{/number}","milestones_url":"https://api.github.com/repos/project-sunbird/sunbird-utils/milestones{/number}","notifications_url":"https://api.github.com/repos/project-sunbird/sunbird-utils/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/project-sunbird/sunbird-utils/labels{/name}","releases_url":"https://api.github.com/repos/project-sunbird/sunbird-utils/releases{/id}","deployments_url":"https://api.github.com/repos/project-sunbird/sunbird-utils/deployments","created_at":"2017-07-03T15:10:45Z","updated_at":"2018-09-10T03:43:08Z","pushed_at":"2018-10-03T13:51:17Z","git_url":"git://github.com/project-sunbird/sunbird-utils.git","ssh_url":"git@github.com:project-sunbird/sunbird-utils.git","clone_url":"https://github.com/project-sunbird/sunbird-utils.git","svn_url":"https://github.com/project-sunbird/sunbird-utils","homepage":null,"size":16246,"stargazers_count":3,"watchers_count":3,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":8,"mirror_url":null,"archived":false,"open_issues_count":4,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":8,"open_issues":4,"watchers":3,"default_branch":"master"}},"base":{"label":"project-sunbird:release-1.11","ref":"release-1.11","sha":"a95afeeb0525808ba6de42cf67c9b61eb51b0db1","user":{"login":"project-sunbird","id":26705730,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI2NzA1NzMw","avatar_url":"https://avatars1.githubusercontent.com/u/26705730?v=4","gravatar_id":"","url":"https://api.github.com/users/project-sunbird","html_url":"https://github.com/project-sunbird","followers_url":"https://api.github.com/users/project-sunbird/followers","following_url":"https://api.github.com/users/project-sunbird/following{/other_user}","gists_url":"https://api.github.com/users/project-sunbird/gists{/gist_id}","starred_url":"https://api.github.com/users/project-sunbird/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/project-sunbird/subscriptions","organizations_url":"https://api.github.com/users/project-sunbird/orgs","repos_url":"https://api.github.com/users/project-sunbird/repos","events_url":"https://api.github.com/users/project-sunbird/events{/privacy}","received_events_url":"https://api.github.com/users/project-sunbird/received_events","type":"Organization","site_admin":false},"repo":{"id":96123627,"node_id":"MDEwOlJlcG9zaXRvcnk5NjEyMzYyNw==","name":"sunbird-utils","full_name":"project-sunbird/sunbird-utils","private":false,"owner":{"login":"project-sunbird","id":26705730,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI2NzA1NzMw","avatar_url":"https://avatars1.githubusercontent.com/u/26705730?v=4","gravatar_id":"","url":"https://api.github.com/users/project-sunbird","html_url":"https://github.com/project-sunbird","followers_url":"https://api.github.com/users/project-sunbird/followers","following_url":"https://api.github.com/users/project-sunbird/following{/other_user}","gists_url":"https://api.github.com/users/project-sunbird/gists{/gist_id}","starred_url":"https://api.github.com/users/project-sunbird/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/project-sunbird/subscriptions","organizations_url":"https://api.github.com/users/project-sunbird/orgs","repos_url":"https://api.github.com/users/project-sunbird/repos","events_url":"https://api.github.com/users/project-sunbird/events{/privacy}","received_events_url":"https://api.github.com/users/project-sunbird/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/project-sunbird/sunbird-utils","description":"Common java utilities used by other Sunbird components","fork":false,"url":"https://api.github.com/repos/project-sunbird/sunbird-utils","forks_url":"https://api.github.com/repos/project-sunbird/sunbird-utils/forks","keys_url":"https://api.github.com/repos/project-sunbird/sunbird-utils/keys{/key_id}","collaborators_url":"https://api.github.com/repos/project-sunbird/sunbird-utils/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/project-sunbird/sunbird-utils/teams","hooks_url":"https://api.github.com/repos/project-sunbird/sunbird-utils/hooks","issue_events_url":"https://api.github.com/repos/project-sunbird/sunbird-utils/issues/events{/number}","events_url":"https://api.github.com/repos/project-sunbird/sunbird-utils/events","assignees_url":"https://api.github.com/repos/project-sunbird/sunbird-utils/assignees{/user}","branches_url":"https://api.github.com/repos/project-sunbird/sunbird-utils/branches{/branch}","tags_url":"https://api.github.com/repos/project-sunbird/sunbird-utils/tags","blobs_url":"https://api.github.com/repos/project-sunbird/sunbird-utils/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/project-sunbird/sunbird-utils/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/project-sunbird/sunbird-utils/git/refs{/sha}","trees_url":"https://api.github.com/repos/project-sunbird/sunbird-utils/git/trees{/sha}","statuses_url":"https://api.github.com/repos/project-sunbird/sunbird-utils/statuses/{sha}","languages_url":"https://api.github.com/repos/project-sunbird/sunbird-utils/languages","stargazers_url":"https://api.github.com/repos/project-sunbird/sunbird-utils/stargazers","contributors_url":"https://api.github.com/repos/project-sunbird/sunbird-utils/contributors","subscribers_url":"https://api.github.com/repos/project-sunbird/sunbird-utils/subscribers","subscription_url":"https://api.github.com/repos/project-sunbird/sunbird-utils/subscription","commits_url":"https://api.github.com/repos/project-sunbird/sunbird-utils/commits{/sha}","git_commits_url":"https://api.github.com/repos/project-sunbird/sunbird-utils/git/commits{/sha}","comments_url":"https://api.github.com/repos/project-sunbird/sunbird-utils/comments{/number}","issue_comment_url":"https://api.github.com/repos/project-sunbird/sunbird-utils/issues/comments{/number}","contents_url":"https://api.github.com/repos/project-sunbird/sunbird-utils/contents/{+path}","compare_url":"https://api.github.com/repos/project-sunbird/sunbird-utils/compare/{base}...{head}","merges_url":"https://api.github.com/repos/project-sunbird/sunbird-utils/merges","archive_url":"https://api.github.com/repos/project-sunbird/sunbird-utils/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/project-sunbird/sunbird-utils/downloads","issues_url":"https://api.github.com/repos/project-sunbird/sunbird-utils/issues{/number}","pulls_url":"https://api.github.com/repos/project-sunbird/sunbird-utils/pulls{/number}","milestones_url":"https://api.github.com/repos/project-sunbird/sunbird-utils/milestones{/number}","notifications_url":"https://api.github.com/repos/project-sunbird/sunbird-utils/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/project-sunbird/sunbird-utils/labels{/name}","releases_url":"https://api.github.com/repos/project-sunbird/sunbird-utils/releases{/id}","deployments_url":"https://api.github.com/repos/project-sunbird/sunbird-utils/deployments","created_at":"2017-07-03T15:10:45Z","updated_at":"2018-09-10T03:43:08Z","pushed_at":"2018-10-03T13:51:17Z","git_url":"git://github.com/project-sunbird/sunbird-utils.git","ssh_url":"git@github.com:project-sunbird/sunbird-utils.git","clone_url":"https://github.com/project-sunbird/sunbird-utils.git","svn_url":"https://github.com/project-sunbird/sunbird-utils","homepage":null,"size":16246,"stargazers_count":3,"watchers_count":3,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":8,"mirror_url":null,"archived":false,"open_issues_count":4,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":8,"open_issues":4,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/project-sunbird/sunbird-utils/pulls/157"},"html":{"href":"https://github.com/project-sunbird/sunbird-utils/pull/157"},"issue":{"href":"https://api.github.com/repos/project-sunbird/sunbird-utils/issues/157"},"comments":{"href":"https://api.github.com/repos/project-sunbird/sunbird-utils/issues/157/comments"},"review_comments":{"href":"https://api.github.com/repos/project-sunbird/sunbird-utils/pulls/157/comments"},"review_comment":{"href":"https://api.github.com/repos/project-sunbird/sunbird-utils/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/project-sunbird/sunbird-utils/pulls/157/commits"},"statuses":{"href":"https://api.github.com/repos/project-sunbird/sunbird-utils/statuses/21abb3e0aa337d17f86261882ebf612a7b53ada6"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"bvinayakumar"}}