diff --git a/course-mw/course-actors-common/src/main/java/org/sunbird/learner/actors/course/CourseManagementActor.java b/course-mw/course-actors-common/src/main/java/org/sunbird/learner/actors/course/CourseManagementActor.java index b0ecafa46..1726d1a71 100644 --- a/course-mw/course-actors-common/src/main/java/org/sunbird/learner/actors/course/CourseManagementActor.java +++ b/course-mw/course-actors-common/src/main/java/org/sunbird/learner/actors/course/CourseManagementActor.java @@ -8,11 +8,6 @@ import org.sunbird.actor.base.BaseActor; import org.sunbird.common.exception.ProjectCommonException; import org.sunbird.common.models.response.Response; -import org.sunbird.common.models.util.LoggerUtil; -import org.sunbird.common.models.util.JsonKey; -import org.sunbird.keys.*; -import org.sunbird.common.models.util.LoggerEnum; -import org.sunbird.common.models.util.ProjectLogger; import org.sunbird.common.models.util.TelemetryEnvKey; import org.sunbird.common.request.Request; import org.sunbird.common.responsecode.ResponseCode; @@ -26,7 +21,7 @@ import java.util.Optional; import java.util.stream.Collectors; -import static org.sunbird.common.models.util.JsonKey.EKSTEP_BASE_URL; +import static org.sunbird.common.models.util.JsonKey.CONTENT_SERVICE_BASE_URL; import static org.sunbird.common.models.util.ProjectUtil.getConfigValue; public class CourseManagementActor extends BaseActor { @@ -57,9 +52,9 @@ private void createCourse(Request request) throws Exception { if(!((Map) request.get(SunbirdKey.COURSE)).containsKey(SunbirdKey.COPY_SCHEME)) { contentMap.put(SunbirdKey.COPY_SCHEME, SunbirdKey.TEXT_BOOK_TO_COURSE); } - requestUrl = getConfigValue(EKSTEP_BASE_URL) + "/content/v3/copy/" + request.get(SunbirdKey.SOURCE) + "?type=deep"; + requestUrl = getConfigValue(CONTENT_SERVICE_BASE_URL) + "/content/v3/copy/" + request.get(SunbirdKey.SOURCE) + "?type=deep"; } else { - requestUrl = getConfigValue(EKSTEP_BASE_URL) + "/content/v3/create"; + requestUrl = getConfigValue(CONTENT_SERVICE_BASE_URL) + "/content/v3/create"; } Map headers = new HashMap() {{ put(SunbirdKey.CONTENT_TYPE_HEADER, SunbirdKey.APPLICATION_JSON); @@ -133,7 +128,7 @@ private void createCourse(Request request) throws Exception { private void handleHierarchyData(Request request, String identifier, Map headers) throws Exception { if (request.getRequest().containsKey(SunbirdKey.HIERARCHY)) { - String url = getConfigValue(EKSTEP_BASE_URL) + "/content/v3/hierarchy/update"; + String url = getConfigValue(CONTENT_SERVICE_BASE_URL) + "/content/v3/hierarchy/update"; HttpResponse updateResponse = Unirest.patch(url) .headers(headers) diff --git a/course-mw/course-actors-common/src/main/java/org/sunbird/learner/util/ContentUtil.java b/course-mw/course-actors-common/src/main/java/org/sunbird/learner/util/ContentUtil.java index f4be11786..02b1576ec 100644 --- a/course-mw/course-actors-common/src/main/java/org/sunbird/learner/util/ContentUtil.java +++ b/course-mw/course-actors-common/src/main/java/org/sunbird/learner/util/ContentUtil.java @@ -129,7 +129,7 @@ public static Map getContent(String courseId, List field Map headers = new HashMap<>(); try { String fieldsStr = StringUtils.join(fields, ","); - String baseContentreadUrl = ProjectUtil.getConfigValue(JsonKey.EKSTEP_BASE_URL) + PropertiesCache.getInstance().getProperty(JsonKey.CONTENT_READ_URL) + courseId + "?fields=" + fieldsStr; + String baseContentreadUrl = ProjectUtil.getConfigValue(JsonKey.CONTENT_SERVICE_BASE_URL) + PropertiesCache.getInstance().getProperty(JsonKey.CONTENT_READ_URL) + courseId + "?fields=" + fieldsStr; headers.put(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON); headers.put(JsonKey.AUTHORIZATION, PropertiesCache.getInstance().getProperty(JsonKey.EKSTEP_AUTHORIZATION)); @@ -183,7 +183,7 @@ public static Map getCourseObjectFromEkStep( public static boolean updateCollection(RequestContext requestContext, String collectionId, Map data) { String response = ""; try { - String contentUpdateBaseUrl = ProjectUtil.getConfigValue(JsonKey.LEARNING_SERVICE_BASE_URL); + String contentUpdateBaseUrl = ProjectUtil.getConfigValue(JsonKey.CONTENT_SERVICE_BASE_URL); Request request = new Request(); request.put("content", data); response = diff --git a/course-mw/course-actors-common/src/main/java/org/sunbird/learner/util/CourseBatchSchedulerUtil.java b/course-mw/course-actors-common/src/main/java/org/sunbird/learner/util/CourseBatchSchedulerUtil.java index f21397bf4..5cb30a944 100644 --- a/course-mw/course-actors-common/src/main/java/org/sunbird/learner/util/CourseBatchSchedulerUtil.java +++ b/course-mw/course-actors-common/src/main/java/org/sunbird/learner/util/CourseBatchSchedulerUtil.java @@ -16,7 +16,6 @@ import org.sunbird.helper.ServiceFactory; import scala.concurrent.Future; -import java.io.IOException; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -166,7 +165,7 @@ public static int getUpdatedBatchCount( public static boolean updateCourseContent(RequestContext requestContext, String courseId, String contentName, int val) { String response = ""; try { - String contentUpdateBaseUrl = ProjectUtil.getConfigValue(JsonKey.LEARNING_SERVICE_BASE_URL); + String contentUpdateBaseUrl = ProjectUtil.getConfigValue(JsonKey.CONTENT_SERVICE_BASE_URL); response = HttpUtil.sendPatchRequest( contentUpdateBaseUrl diff --git a/course-mw/course-actors-common/src/main/java/org/sunbird/learner/util/CourseBatchUtil.java b/course-mw/course-actors-common/src/main/java/org/sunbird/learner/util/CourseBatchUtil.java index 1650a4b95..a9785c501 100644 --- a/course-mw/course-actors-common/src/main/java/org/sunbird/learner/util/CourseBatchUtil.java +++ b/course-mw/course-actors-common/src/main/java/org/sunbird/learner/util/CourseBatchUtil.java @@ -145,7 +145,7 @@ private static Map getdefaultHeaders() { private static String readTemplate(RequestContext requestContext, String templateId) throws Exception { String templateRelativeUrl = ProjectUtil.getConfigValue("sunbird_cert_template_url"); String certTemplateReadUrl = ProjectUtil.getConfigValue("sunbird_cert_template_read_url"); - String contentServiceBaseUrl = ProjectUtil.getConfigValue("ekstep_api_base_url"); + String contentServiceBaseUrl = ProjectUtil.getConfigValue(JsonKey.CONTENT_SERVICE_BASE_URL); String certServiceBaseUrl = ProjectUtil.getConfigValue("sunbird_cert_service_base_url"); HttpResponse httpResponse = null; httpResponse = templateReadResponse(requestContext, contentServiceBaseUrl, templateRelativeUrl, templateId); diff --git a/course-mw/course-actors-common/src/test/java/org/sunbird/learner/actors/coursemanagement/CourseManagementActorTest.java b/course-mw/course-actors-common/src/test/java/org/sunbird/learner/actors/coursemanagement/CourseManagementActorTest.java index 2d941ba91..39a4c6fa5 100644 --- a/course-mw/course-actors-common/src/test/java/org/sunbird/learner/actors/coursemanagement/CourseManagementActorTest.java +++ b/course-mw/course-actors-common/src/test/java/org/sunbird/learner/actors/coursemanagement/CourseManagementActorTest.java @@ -52,8 +52,8 @@ public void setUp() { PowerMockito.mockStatic(ProjectUtil.class); PowerMockito.mockStatic(Unirest.class); system = ActorSystem.create("system"); - when(ProjectUtil.getConfigValue(JsonKey.EKSTEP_BASE_URL)) - .thenReturn("ekstep_api_base_url"); + when(ProjectUtil.getConfigValue(JsonKey.CONTENT_SERVICE_BASE_URL)) + .thenReturn("content_service_base_url"); when(ProjectUtil.getConfigValue(JsonKey.CONTENT_PROPS_TO_ADD)) .thenReturn("learning.content.props.to.add"); } diff --git a/course-mw/sunbird-util/sunbird-platform-core/common-util/src/main/java/org/sunbird/common/models/util/JsonKey.java b/course-mw/sunbird-util/sunbird-platform-core/common-util/src/main/java/org/sunbird/common/models/util/JsonKey.java index 11cc4bb68..17c42658f 100644 --- a/course-mw/sunbird-util/sunbird-platform-core/common-util/src/main/java/org/sunbird/common/models/util/JsonKey.java +++ b/course-mw/sunbird-util/sunbird-platform-core/common-util/src/main/java/org/sunbird/common/models/util/JsonKey.java @@ -116,7 +116,7 @@ public final class JsonKey { public static final String SEARCH_SERVICE_API_BASE_URL = "sunbird_search_service_api_base_url"; public static final String ANALYTICS_API_BASE_URL = "sunbird_analytics_api_base_url"; public static final String EKSTEP_AUTHORIZATION = "ekstep_authorization"; - public static final String EKSTEP_BASE_URL = "ekstep_api_base_url"; + public static final String CONTENT_SERVICE_BASE_URL = "content_service_base_url"; public static final String EKSTEP_CONTENT_SEARCH_URL = "ekstep_content_search_url"; public static final String EKSTEP_CONTENT_UPDATE_URL = "ekstep.content.update.url"; public static final String EKSTEP_SERVICE = "Content service"; @@ -521,7 +521,6 @@ public final class JsonKey { public static final String SUNBIRD_PASS_REGEX = "sunbird_pass_regex"; public static final String NESTED_EXISTS = "nested_exists"; public static final String NESTED_NOT_EXISTS = "nested_not_exists"; - public static final String LEARNING_SERVICE_BASE_URL = "learning_service_base_url"; public static final String CREATOR_DETAILS_FIELDS = "sunbird_user_search_cretordetails_fields"; public static final String SUNBIRD_QRCODE_COURSES_LIMIT ="sunbird_user_qrcode_courses_limit"; public static final String ACCESS_TOKEN_PUBLICKEY_BASEPATH = "accesstoken.publickey.basepath"; diff --git a/course-mw/sunbird-util/sunbird-platform-core/common-util/src/main/resources/externalresource.properties b/course-mw/sunbird-util/sunbird-platform-core/common-util/src/main/resources/externalresource.properties index 68e6a92b2..762ebb9bd 100644 --- a/course-mw/sunbird-util/sunbird-platform-core/common-util/src/main/resources/externalresource.properties +++ b/course-mw/sunbird-util/sunbird-platform-core/common-util/src/main/resources/externalresource.properties @@ -1,11 +1,11 @@ ekstep_content_search_url=/v3/search ekstep_authorization= ekstep.tag.api.url=/tag/register -ekstep.content.update.url=/system/v3/content/update/ +ekstep.content.update.url=/content/v4/system/update/ sunbird_installation=sunbird sunbird_analytics_api_base_url=https://dev.ekstep.in/api/data/v3 sunbird_search_service_api_base_url=https://dev.sunbirded.org/action -ekstep_api_base_url=https://dev.sunbirded.org/action +content_service_base_url=https://dev.sunbirded.org/action sunbird_user_org_api_base_url=https://dev.sunbirded.org/api sunbird_search_organisation_api=/v1/org/search sunbird_read_user_api=/private/user/v1/read diff --git a/course-mw/sunbird-util/sunbird-platform-core/common-util/src/test/java/org/sunbird/common/models/AppTest.java b/course-mw/sunbird-util/sunbird-platform-core/common-util/src/test/java/org/sunbird/common/models/AppTest.java index b56a09606..1c6d582b5 100644 --- a/course-mw/sunbird-util/sunbird-platform-core/common-util/src/test/java/org/sunbird/common/models/AppTest.java +++ b/course-mw/sunbird-util/sunbird-platform-core/common-util/src/test/java/org/sunbird/common/models/AppTest.java @@ -5,7 +5,6 @@ import org.apache.commons.lang3.StringUtils; import org.junit.Assert; import org.junit.Before; -import org.junit.BeforeClass; import org.junit.Test; import org.sunbird.common.models.util.BaseHttpTest; import org.sunbird.common.models.util.HttpUtil; @@ -32,9 +31,9 @@ public void setup() { @Test public void testSendPostRequestSuccess() throws Exception { - String ekStepBaseUrl = System.getenv(JsonKey.EKSTEP_BASE_URL); + String ekStepBaseUrl = System.getenv(JsonKey.CONTENT_SERVICE_BASE_URL); if (StringUtils.isBlank(ekStepBaseUrl)) { - ekStepBaseUrl = PropertiesCache.getInstance().getProperty(JsonKey.EKSTEP_BASE_URL); + ekStepBaseUrl = PropertiesCache.getInstance().getProperty(JsonKey.CONTENT_SERVICE_BASE_URL); } String response = HttpUtil.sendPostRequest(ekStepBaseUrl + "/content/v3/list", data, headers); Assert.assertNotNull(response); @@ -42,9 +41,9 @@ public void testSendPostRequestSuccess() throws Exception { @Test() public void testSendPostRequestFailureWithWrongUrl() { - String ekStepBaseUrl = System.getenv(JsonKey.EKSTEP_BASE_URL); + String ekStepBaseUrl = System.getenv(JsonKey.CONTENT_SERVICE_BASE_URL); if (StringUtils.isBlank(ekStepBaseUrl)) { - ekStepBaseUrl = PropertiesCache.getInstance().getProperty(JsonKey.EKSTEP_BASE_URL); + ekStepBaseUrl = PropertiesCache.getInstance().getProperty(JsonKey.CONTENT_SERVICE_BASE_URL); } String response = null; try { @@ -61,9 +60,9 @@ public void testSendPostRequestFailureWithWrongUrl() { public void testSendPatchRequestSuccess() { String response = null; try { - String ekStepBaseUrl = System.getenv(JsonKey.EKSTEP_BASE_URL); + String ekStepBaseUrl = System.getenv(JsonKey.CONTENT_SERVICE_BASE_URL); if (StringUtils.isBlank(ekStepBaseUrl)) { - ekStepBaseUrl = PropertiesCache.getInstance().getProperty(JsonKey.EKSTEP_BASE_URL); + ekStepBaseUrl = PropertiesCache.getInstance().getProperty(JsonKey.CONTENT_SERVICE_BASE_URL); } response = HttpUtil.sendPatchRequest( diff --git a/course-mw/sunbird-util/sunbird-platform-core/common-util/src/test/java/org/sunbird/common/models/util/ProjectUtilTest.java b/course-mw/sunbird-util/sunbird-platform-core/common-util/src/test/java/org/sunbird/common/models/util/ProjectUtilTest.java index 77d3d4199..18e2bddc8 100644 --- a/course-mw/sunbird-util/sunbird-platform-core/common-util/src/test/java/org/sunbird/common/models/util/ProjectUtilTest.java +++ b/course-mw/sunbird-util/sunbird-platform-core/common-util/src/test/java/org/sunbird/common/models/util/ProjectUtilTest.java @@ -408,9 +408,9 @@ public void testIsEmailValidSuccess() { @Test public void testSendGetRequestSuccessWithEkStepBaseUrl() throws Exception { - String ekStepBaseUrl = System.getenv(JsonKey.EKSTEP_BASE_URL); + String ekStepBaseUrl = System.getenv(JsonKey.CONTENT_SERVICE_BASE_URL); if (StringUtils.isBlank(ekStepBaseUrl)) { - ekStepBaseUrl = PropertiesCache.getInstance().getProperty(JsonKey.EKSTEP_BASE_URL); + ekStepBaseUrl = PropertiesCache.getInstance().getProperty(JsonKey.CONTENT_SERVICE_BASE_URL); } String response = HttpUtil.sendGetRequest(ekStepBaseUrl + "/search/health", headers); assertNotNull(response); diff --git a/scripts/lms-config.sh b/scripts/lms-config.sh index 0364a0fa1..897d09a86 100644 --- a/scripts/lms-config.sh +++ b/scripts/lms-config.sh @@ -4,10 +4,9 @@ export actor_hostname=actor-service export api_actor_provider=local export export background_actor_provider=local export bind_hostname=0.0.0.0 -export export ekstep_api_base_url="https://dev.lern.sunbird.org" +export content_service_base_url="https://dev.lern.sunbird.org" export content_read_url="/api/content/v1/read/" export learning_content_props_to_add=mimeType,contentType,name,code,description,keywords,framework,copyright,topic -export learning_service_base_url="https://dev.lern.sunbird.org" export redis_connection_idle_max=32 export redis_connection_idle_min=1 export redis_connection_max=64 diff --git a/setup.md b/setup.md index d3b9e0c6c..ed4a4c2cb 100644 --- a/setup.md +++ b/setup.md @@ -32,7 +32,7 @@ 15. sunbird_pg_user: postgres db user name 16. sunbird_pg_password: postgress db password 17. sunbird_installation - 18. ekstep_api_base_url + 18. content_service_base_url 19. sunbird_mail_server_host 20. sunbird_mail_server_port 21. sunbird_mail_server_username