From 922df3a7c9257a94754367cb012f2595da3a467a Mon Sep 17 00:00:00 2001 From: ramyaranganathan-1775 Date: Fri, 17 Apr 2026 17:02:50 +0530 Subject: [PATCH 1/5] Cbrelease 4.8.35 (#199) * KB-13035 : Update build configuration for scala 2.12.21 for assessment service,content service, search service, taxonomy service * KB-13035 : Update build configuration for scala 2.12.21 for assessment service,content service, search service, taxonomy service * KB-13035 : Update build configuration for scala 2.12.21 for assessment service,content service, search service, taxonomy service * KB-13035 : Update build configuration for scala 2.12.21 for assessment service,content service, search service, taxonomy service- revert directory rename * KB-13035 : Update build configuration for scala 2.12.21 for assessment service,content service, search service, taxonomy service- revert directory rename * KB-13035 : Update build configuration for scala 2.12.21 - code review changes * KB-13035 : Update build configuration for scala 2.12.21 - code review changes --- .github/pull_request_template.md | 2 +- .github/pull_request_template.md.yaml | 2 +- assessment-api/assessment-actors/pom.xml | 2 +- .../scala/org/sunbird/actors/BaseSpec.scala | 6 +- .../sunbird/actors/QuestionActorTest.scala | 27 +++--- .../sunbird/actors/QuestionSetActorTest.scala | 85 +++++++++---------- assessment-api/assessment-service/pom.xml | 2 +- assessment-api/pom.xml | 2 +- assessment-api/qs-hierarchy-manager/pom.xml | 24 +++++- .../sunbird/managers/HierarchyManager.scala | 16 ++-- .../managers/UpdateHierarchyManager.scala | 6 +- .../scala/org/sunbird/managers/BaseSpec.scala | 10 ++- .../managers/HierarchyManagerTest.scala | 12 +-- .../managers/UpdateHierarchyManagerTest.scala | 1 + content-api/collection-csv-actors/pom.xml | 4 +- .../TestCollectionCSVActor.scala | 5 +- content-api/content-actors/pom.xml | 4 +- .../sunbird/channel/TestChannelManager.scala | 9 +- .../org/sunbird/content/actors/BaseSpec.scala | 6 +- .../content/dial/DIALManagerTest.scala | 5 +- .../upload/mgr/UploadManagerTest.scala | 9 +- .../content/util/CopyManagerTest.scala | 13 ++- .../content/util/FlagManagerTest.scala | 6 +- .../content/util/RequestUtilTest.scala | 6 +- .../content/util/TestAssetManager.scala | 6 +- content-api/content-service/pom.xml | 6 +- content-api/hierarchy-manager/pom.xml | 18 +++- .../scala/org/sunbird/managers/BaseSpec.scala | 7 +- .../org/sunbird/managers/TestHierarchy.scala | 9 +- .../managers/TestUpdateHierarchy.scala | 2 + content-api/pom.xml | 2 +- ontology-engine/graph-core_2.11/pom.xml | 42 ++++++++- .../scala/org/sunbird/graph/BaseSpec.scala | 6 +- ontology-engine/graph-dac-api/pom.xml | 14 +++ ontology-engine/graph-engine_2.11/pom.xml | 37 +++++++- .../org/sunbird/graph/utils/NodeUtil.scala | 4 +- .../scala/org/sunbird/graph/BaseSpec.scala | 7 +- .../graph/health/TestHealthCheckManager.scala | 6 +- .../sunbird/graph/nodes/TestDataNode.scala | 7 +- .../TestObjectCategoryDefinitionMap.scala | 2 + .../validator/TestSchemaValidator.scala | 3 +- .../sunbird/graph/utils/NodeUtilTest.scala | 7 +- .../graph/utils/ScalaJsonUtilsTest.scala | 6 +- ontology-engine/parseq/pom.xml | 2 +- platform-core/kafka-client/pom.xml | 4 +- .../org/sunbird/kafka/test/BaseTest.scala | 6 +- platform-core/platform-cache/pom.xml | 2 +- .../sunbird/cache/impl/RedisCacheTest.scala | 7 +- platform-core/platform-common/pom.xml | 2 +- platform-core/schema-validator/pom.xml | 2 +- .../schema/impl/TestBaseSchemaValidator.java | 2 +- platform-modules/import-manager/pom.xml | 6 +- .../object/importer/ImportManagerTest.scala | 10 +-- platform-modules/mimetype-manager/pom.xml | 6 +- pom.xml | 7 +- search-api/pom.xml | 2 +- search-api/search-core/pom.xml | 4 +- .../controllers/SearchBaseController.scala | 3 +- search-api/search-service/pom.xml | 4 +- taxonomy-api/pom.xml | 2 +- taxonomy-api/taxonomy-actors/pom.xml | 4 +- .../scala/org/sunbird/actors/BaseSpec.scala | 6 +- taxonomy-api/taxonomy-service/pom.xml | 4 +- 63 files changed, 350 insertions(+), 190 deletions(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 920b32a49..47899c885 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -17,7 +17,7 @@ Please describe the tests that you ran to verify your changes in the below check - [ ] Ran Test B **Test Configuration**: -* Software versions: Java 11, scala-2.11, play-2.7.2 +* Software versions: Java 11, scala-2.12, play-2.7.9 * Hardware versions: 2 CPU/ 4GB RAM ### Checklist: diff --git a/.github/pull_request_template.md.yaml b/.github/pull_request_template.md.yaml index f1826648e..1393afde0 100644 --- a/.github/pull_request_template.md.yaml +++ b/.github/pull_request_template.md.yaml @@ -17,7 +17,7 @@ Please describe the tests that you ran to verify your changes in the below check - [ ] Ran Test B **Test Configuration**: -* Software versions: Java 11, scala-2.11, play-2.7.2 +* Software versions: Java 11, scala-2.12, play-2.7.9 * Hardware versions: ### Checklist: diff --git a/assessment-api/assessment-actors/pom.xml b/assessment-api/assessment-actors/pom.xml index d56dd0a67..2c7267ab0 100644 --- a/assessment-api/assessment-actors/pom.xml +++ b/assessment-api/assessment-actors/pom.xml @@ -70,7 +70,7 @@ net.alchim31.maven scala-maven-plugin - 4.4.0 + 4.8.1 ${scala.version} false diff --git a/assessment-api/assessment-actors/src/test/scala/org/sunbird/actors/BaseSpec.scala b/assessment-api/assessment-actors/src/test/scala/org/sunbird/actors/BaseSpec.scala index b1abb5a29..938b58b62 100644 --- a/assessment-api/assessment-actors/src/test/scala/org/sunbird/actors/BaseSpec.scala +++ b/assessment-api/assessment-actors/src/test/scala/org/sunbird/actors/BaseSpec.scala @@ -2,17 +2,17 @@ package org.sunbird.actors import java.util import java.util.concurrent.TimeUnit - import akka.actor.{ActorSystem, Props} import akka.testkit.TestKit -import org.scalatest.{FlatSpec, Matchers} +import org.scalatest.flatspec.AnyFlatSpec +import org.scalatest.matchers.should.Matchers import org.sunbird.common.dto.{Request, Response} import org.sunbird.graph.OntologyEngineContext import org.sunbird.graph.dac.model.Node import scala.concurrent.duration.FiniteDuration -class BaseSpec extends FlatSpec with Matchers { +class BaseSpec extends AnyFlatSpec with Matchers { val system = ActorSystem.create("system") def testUnknownOperation(props: Props, request: Request)(implicit oec: OntologyEngineContext) = { diff --git a/assessment-api/assessment-actors/src/test/scala/org/sunbird/actors/QuestionActorTest.scala b/assessment-api/assessment-actors/src/test/scala/org/sunbird/actors/QuestionActorTest.scala index 67c2f62af..638279768 100644 --- a/assessment-api/assessment-actors/src/test/scala/org/sunbird/actors/QuestionActorTest.scala +++ b/assessment-api/assessment-actors/src/test/scala/org/sunbird/actors/QuestionActorTest.scala @@ -12,6 +12,7 @@ import org.sunbird.graph.{GraphService, OntologyEngineContext} import org.sunbird.kafka.client.KafkaClient import scala.collection.JavaConversions._ +import scala.collection.JavaConverters import scala.collection.JavaConverters._ import scala.concurrent.Future import scala.concurrent.ExecutionContext.Implicits.global @@ -35,7 +36,7 @@ class QuestionActorTest extends BaseSpec with MockFactory { val request = getQuestionRequest() request.getContext.put("identifier", "do1234") - request.putAll(mapAsJavaMap(Map("channel"-> "in.ekstep","name" -> "New Content", "code" -> "1234", "mimeType"-> "application/vnd.sunbird.question", "primaryCategory" -> "Multiple Choice Question", "visibility" -> "Default"))) + request.putAll(JavaConverters.mapAsJavaMap(Map("channel"-> "in.ekstep","name" -> "New Content", "code" -> "1234", "mimeType"-> "application/vnd.sunbird.question", "primaryCategory" -> "Multiple Choice Question", "visibility" -> "Default"))) request.setOperation("createQuestion") val response = callActor(request, Props(new QuestionActor())) assert("successful".equals(response.getParams.getStatus)) @@ -49,7 +50,7 @@ class QuestionActorTest extends BaseSpec with MockFactory { (graphDB.getNodeByUniqueId(_: String, _: String, _: Boolean, _: Request)).expects(*, *, *, *).returns(Future(node)) val request = getQuestionRequest() request.getContext.put("identifier", "do1234") - request.putAll(mapAsJavaMap(Map("identifier" -> "do_1234", "fields" -> ""))) + request.putAll(JavaConverters.mapAsJavaMap(Map("identifier" -> "do_1234", "fields" -> ""))) request.setOperation("readQuestion") val response = callActor(request, Props(new QuestionActor())) assert("successful".equals(response.getParams.getStatus)) @@ -70,7 +71,7 @@ class QuestionActorTest extends BaseSpec with MockFactory { val request = getQuestionRequest() request.getContext.put("identifier","do1234") request.getRequest.put("channel", "abc-123") - request.putAll(mapAsJavaMap(Map("identifier" -> "do_1234", "fields" -> ""))) + request.putAll(JavaConverters.mapAsJavaMap(Map("identifier" -> "do_1234", "fields" -> ""))) request.setOperation("readPrivateQuestion") val response = callActor(request, Props(new QuestionActor())) assert("successful".equals(response.getParams.getStatus)) @@ -81,7 +82,7 @@ class QuestionActorTest extends BaseSpec with MockFactory { val graphDB = mock[GraphService] val request = getQuestionRequest() request.getContext.put("identifier","do1234") - request.putAll(mapAsJavaMap(Map("identifier" -> "do_1234", "fields" -> ""))) + request.putAll(JavaConverters.mapAsJavaMap(Map("identifier" -> "do_1234", "fields" -> ""))) request.setOperation("readPrivateQuestion") val response = callActor(request, Props(new QuestionActor())) assert(response.getResponseCode == ResponseCode.CLIENT_ERROR) @@ -104,7 +105,7 @@ class QuestionActorTest extends BaseSpec with MockFactory { val request = getQuestionRequest() request.getContext.put("identifier","do1234") request.getRequest.put("channel", "abc") - request.putAll(mapAsJavaMap(Map("identifier" -> "do_1234", "fields" -> ""))) + request.putAll(JavaConverters.mapAsJavaMap(Map("identifier" -> "do_1234", "fields" -> ""))) request.setOperation("readPrivateQuestion") val response = callActor(request, Props(new QuestionActor())) assert(response.getResponseCode == ResponseCode.CLIENT_ERROR) @@ -125,7 +126,7 @@ class QuestionActorTest extends BaseSpec with MockFactory { (graphDB.getNodeByUniqueId(_: String, _: String, _: Boolean, _: Request)).expects(*, *, *, *).returns(Future(node)) val request = getQuestionRequest() request.getContext.put("identifier", "do1234") - request.putAll(mapAsJavaMap(Map("identifier" -> "do_1234", "fields" -> ""))) + request.putAll(JavaConverters.mapAsJavaMap(Map("identifier" -> "do_1234", "fields" -> ""))) request.setOperation("readQuestion") val response = callActor(request, Props(new QuestionActor())) assert(response.getResponseCode == ResponseCode.CLIENT_ERROR) @@ -145,7 +146,7 @@ class QuestionActorTest extends BaseSpec with MockFactory { val request = getQuestionRequest() request.getContext.put("identifier", "do1234") - request.putAll(mapAsJavaMap(Map( "versionKey" -> "1234", "description" -> "updated desc"))) + request.putAll(JavaConverters.mapAsJavaMap(Map( "versionKey" -> "1234", "description" -> "updated desc"))) request.setOperation("updateQuestion") val response = callActor(request, Props(new QuestionActor())) assert("successful".equals(response.getParams.getStatus)) @@ -165,7 +166,7 @@ class QuestionActorTest extends BaseSpec with MockFactory { val request = getQuestionRequest() request.getContext.put("identifier", "do1234") - request.putAll(mapAsJavaMap(Map( "versionKey" -> "1234", "description" -> "updated desc"))) + request.putAll(JavaConverters.mapAsJavaMap(Map( "versionKey" -> "1234", "description" -> "updated desc"))) request.setOperation("reviewQuestion") val response = callActor(request, Props(new QuestionActor())) assert("successful".equals(response.getParams.getStatus)) @@ -181,7 +182,7 @@ class QuestionActorTest extends BaseSpec with MockFactory { (graphDB.updateNodes(_: String, _: util.List[String], _: util.HashMap[String, AnyRef])).expects(*, *, *).returns(Future(new util.HashMap[String, Node])) val request = getQuestionRequest() request.getContext.put("identifier", "do1234") - request.putAll(mapAsJavaMap(Map( "versionKey" -> "1234", "description" -> "updated desc"))) + request.putAll(JavaConverters.mapAsJavaMap(Map( "versionKey" -> "1234", "description" -> "updated desc"))) request.setOperation("retireQuestion") val response = callActor(request, Props(new QuestionActor())) assert("successful".equals(response.getParams.getStatus)) @@ -199,7 +200,7 @@ class QuestionActorTest extends BaseSpec with MockFactory { (kfClient.send(_:String, _:String)).expects(*,*).once() val request = getQuestionRequest() request.getContext.put("identifier", "do1234") - request.putAll(mapAsJavaMap(Map( "versionKey" -> "1234", "description" -> "updated desc"))) + request.putAll(JavaConverters.mapAsJavaMap(Map( "versionKey" -> "1234", "description" -> "updated desc"))) request.setOperation("publishQuestion") val response = callActor(request, Props(new QuestionActor())) assert("successful".equals(response.getParams.getStatus)) @@ -252,7 +253,7 @@ class QuestionActorTest extends BaseSpec with MockFactory { (graphDB.getNodeProperty(_: String, _: String, _: String)).expects(*, *, *).returns(Future(new Property("versionKey", new org.neo4j.driver.internal.value.StringValue("1234")))) val request = getQuestionRequest() request.getContext.put("identifier", "test_id") - request.putAll(mapAsJavaMap(Map("versionKey" -> "1234", "description" -> "updated desc"))) + request.putAll(JavaConverters.mapAsJavaMap(Map("versionKey" -> "1234", "description" -> "updated desc"))) request.setOperation("systemUpdateQuestion") val response = callActor(request, Props(new QuestionActor())) assert("successful".equals(response.getParams.getStatus)) @@ -309,7 +310,7 @@ class QuestionActorTest extends BaseSpec with MockFactory { val request = getQuestionRequest() request.getContext.put("identifier", "do1234") - request.putAll(mapAsJavaMap(Map( "versionKey" -> "1234", "description" -> "updated description","rejectComment" -> "Rejected for testing"))) + request.putAll(JavaConverters.mapAsJavaMap(Map( "versionKey" -> "1234", "description" -> "updated description","rejectComment" -> "Rejected for testing"))) request.setOperation("rejectQuestion") val response = callActor(request, Props(new QuestionActor())) assert("successful".equals(response.getParams.getStatus)) @@ -335,7 +336,7 @@ class QuestionActorTest extends BaseSpec with MockFactory { node.setNodeType("DATA_NODE") node.setObjectType("ObjectCategoryDefinition") node.setGraphId("domain") - node.setMetadata(mapAsJavaMap( + node.setMetadata(JavaConverters.mapAsJavaMap( ScalaJsonUtils.deserialize[Map[String,AnyRef]]("{\n \"objectCategoryDefinition\": {\n \"name\": \"Learning Resource\",\n \"description\": \"Content Playlist\",\n \"categoryId\": \"obj-cat:practice_question_set\",\n \"targetObjectType\": \"Content\",\n \"objectMetadata\": {\n \"config\": {},\n \"schema\": {\n \"required\": [\n \"author\",\n \"copyright\",\n \"license\",\n \"audience\"\n ],\n \"properties\": {\n \"audience\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\",\n \"enum\": [\n \"Student\",\n \"Teacher\"\n ]\n },\n \"default\": [\n \"Student\"\n ]\n },\n \"mimeType\": {\n \"type\": \"string\",\n \"enum\": [\n \"application/pdf\"\n ]\n }\n }\n }\n }\n }\n }"))) node } diff --git a/assessment-api/assessment-actors/src/test/scala/org/sunbird/actors/QuestionSetActorTest.scala b/assessment-api/assessment-actors/src/test/scala/org/sunbird/actors/QuestionSetActorTest.scala index 3f94322b8..7704109f4 100644 --- a/assessment-api/assessment-actors/src/test/scala/org/sunbird/actors/QuestionSetActorTest.scala +++ b/assessment-api/assessment-actors/src/test/scala/org/sunbird/actors/QuestionSetActorTest.scala @@ -14,7 +14,6 @@ import org.sunbird.kafka.client.KafkaClient import org.sunbird.utils.JavaJsonUtils import java.util -import scala.collection.JavaConversions._ import scala.collection.JavaConverters._ import scala.concurrent.ExecutionContext.Implicits.global import scala.concurrent.Future @@ -38,7 +37,7 @@ class QuestionSetActorTest extends BaseSpec with MockFactory { val request = getQuestionSetRequest() request.getContext.put("identifier", "do1234") - request.putAll(mapAsJavaMap(Map("name" -> "question_1", + request.putAll(Map[String, Object]("name" -> "question_1", "visibility" -> "Default", "code" -> "finemanfine", "navigationMode" -> "linear", @@ -50,7 +49,7 @@ class QuestionSetActorTest extends BaseSpec with MockFactory { "showHints" -> "Yes", "summaryType" -> "Complete", "mimeType" -> "application/vnd.sunbird.questionset", - "primaryCategory" -> "Practice Question Set"))) + "primaryCategory" -> "Practice Question Set").asJava) request.setOperation("createQuestionSet") val response = callActor(request, Props(new QuestionSetActor())) assert("successful".equals(response.getParams.getStatus)) @@ -69,7 +68,7 @@ class QuestionSetActorTest extends BaseSpec with MockFactory { (graphDB.getNodeByUniqueId(_: String, _: String, _: Boolean, _: Request)).expects(*, *, *, *).returns(Future(node)) val request = getQuestionSetRequest() request.getContext.put("identifier", "do1234") - request.putAll(mapAsJavaMap(Map("identifier" -> "do_1234", "fields" -> ""))) + request.putAll(Map[String, Object]("identifier" -> "do_1234", "fields" -> "").asJava) request.setOperation("readQuestionSet") val response = callActor(request, Props(new QuestionSetActor())) assert("successful".equals(response.getParams.getStatus)) @@ -90,7 +89,7 @@ class QuestionSetActorTest extends BaseSpec with MockFactory { (graphDB.getNodeByUniqueId(_: String, _: String, _: Boolean, _: Request)).expects(*, *, *, *).returns(Future(node)) val request = getQuestionSetRequest() request.getContext.put("identifier", "do1234") - request.putAll(mapAsJavaMap(Map("identifier" -> "do_1234", "fields" -> ""))) + request.putAll(Map[String, Object]("identifier" -> "do_1234", "fields" -> "").asJava) request.setOperation("readQuestionSet") val response = callActor(request, Props(new QuestionSetActor())) assert(response.getResponseCode == ResponseCode.CLIENT_ERROR) @@ -111,7 +110,7 @@ class QuestionSetActorTest extends BaseSpec with MockFactory { val request = getQuestionSetRequest() request.getContext.put("identifier","do1234") request.getRequest.put("channel", "abc-123") - request.putAll(mapAsJavaMap(Map("identifier" -> "do_1234", "fields" -> ""))) + request.putAll(Map[String, Object]("identifier" -> "do_1234", "fields" -> "").asJava) request.setOperation("readPrivateQuestionSet") val response = callActor(request, Props(new QuestionSetActor())) assert("successful".equals(response.getParams.getStatus)) @@ -122,7 +121,7 @@ class QuestionSetActorTest extends BaseSpec with MockFactory { val graphDB = mock[GraphService] val request = getQuestionSetRequest() request.getContext.put("identifier","do1234") - request.putAll(mapAsJavaMap(Map("identifier" -> "do_1234", "fields" -> ""))) + request.putAll(Map[String, Object]("identifier" -> "do_1234", "fields" -> "").asJava) request.setOperation("readPrivateQuestionSet") val response = callActor(request, Props(new QuestionSetActor())) assert(response.getResponseCode == ResponseCode.CLIENT_ERROR) @@ -145,7 +144,7 @@ class QuestionSetActorTest extends BaseSpec with MockFactory { val request = getQuestionSetRequest() request.getContext.put("identifier","do1234") request.getRequest.put("channel", "abc") - request.putAll(mapAsJavaMap(Map("identifier" -> "do_1234", "fields" -> ""))) + request.putAll(Map[String, Object]("identifier" -> "do_1234", "fields" -> ""). asJava) request.setOperation("readPrivateQuestionSet") val response = callActor(request, Props(new QuestionSetActor())) assert(response.getResponseCode == ResponseCode.CLIENT_ERROR) @@ -161,7 +160,7 @@ class QuestionSetActorTest extends BaseSpec with MockFactory { (graphDB.getNodeByUniqueIds(_: String, _: SearchCriteria)).expects(*, *).returns(Future(nodes)).anyNumberOfTimes() val node = getNode("QuestionSet", None) - node.getMetadata.putAll(mapAsJavaMap(Map("name" -> "question_1", + node.getMetadata.putAll(Map[String, Object]("name" -> "question_1", "visibility" -> "Default", "code" -> "finemanfine", "description" -> "Updated description", @@ -174,12 +173,12 @@ class QuestionSetActorTest extends BaseSpec with MockFactory { "showHints" -> "Yes", "summaryType" -> "Complete", "mimeType" -> "application/vnd.sunbird.questionset", - "primaryCategory" -> "Practice Question Set"))) + "primaryCategory" -> "Practice Question Set").asJava) (graphDB.upsertNode(_: String, _: Node, _: Request)).expects(*, *, *).returns(Future(node)) (graphDB.getNodeByUniqueId(_: String, _: String, _: Boolean, _: Request)).expects(*, *, *, *).returns(Future(node)).atLeastOnce() val request = getQuestionSetRequest() request.getContext.put("identifier", "do1234") - request.putAll(mapAsJavaMap(Map("versionKey" -> "1234", "description" -> "updated desc"))) + request.putAll(Map[String, Object]("versionKey" -> "1234", "description" -> "updated desc").asJava) request.setOperation("updateQuestionSet") val response = callActor(request, Props(new QuestionSetActor())) assert("successful".equals(response.getParams.getStatus)) @@ -193,7 +192,7 @@ class QuestionSetActorTest extends BaseSpec with MockFactory { (graphDB.getNodeByUniqueIds(_: String, _: SearchCriteria)).expects(*, *).returns(Future(nodes)).anyNumberOfTimes() val node = getNode("QuestionSet", None) - node.getMetadata.putAll(mapAsJavaMap(Map("name" -> "question_1", + node.getMetadata.putAll(Map[String, Object]("name" -> "question_1", "visibility" -> "Default", "code" -> "finemanfine", "navigationMode" -> "linear", @@ -206,7 +205,7 @@ class QuestionSetActorTest extends BaseSpec with MockFactory { "summaryType" -> "Complete", "versionKey" -> "1234", "mimeType" -> "application/vnd.sunbird.questionset", - "primaryCategory" -> "Practice Question Set"))) + "primaryCategory" -> "Practice Question Set").asJava) (graphDB.upsertNode(_: String, _: Node, _: Request)).expects(*, *, *).returns(Future(node)) (graphDB.getNodeByUniqueId(_: String, _: String, _: Boolean, _: Request)).expects(*, *, *, *).returns(Future(node)).atLeastOnce() (graphDB.readExternalProps(_: Request, _: List[String])).expects(*, *).returns(Future(getCassandraHierarchy())).anyNumberOfTimes @@ -214,7 +213,7 @@ class QuestionSetActorTest extends BaseSpec with MockFactory { (graphDB.updateNodes(_:String, _:util.List[String], _: util.Map[String, AnyRef])).expects(*, *, *).returns(Future(Map[String, Node]().asJava)).anyNumberOfTimes val request = getQuestionSetRequest() request.getContext.put("identifier", "do1234") - request.putAll(mapAsJavaMap(Map("versionKey" -> "1234", "description" -> "updated desc"))) + request.putAll(Map[String, Object]("versionKey" -> "1234", "description" -> "updated desc").asJava) request.setOperation("reviewQuestionSet") val response = callActor(request, Props(new QuestionSetActor())) assert("successful".equals(response.getParams.getStatus)) @@ -226,7 +225,7 @@ class QuestionSetActorTest extends BaseSpec with MockFactory { val graphDB = mock[GraphService] (oec.graphService _).expects().returns(graphDB).anyNumberOfTimes() val node = getNode("QuestionSet", None) - node.getMetadata.putAll(mapAsJavaMap(Map("name" -> "question_1", + node.getMetadata.putAll(Map[String, Object]("name" -> "question_1", "visibility" -> "Default", "code" -> "finemanfine", "navigationMode" -> "linear", @@ -238,12 +237,12 @@ class QuestionSetActorTest extends BaseSpec with MockFactory { "showHints" -> "Yes", "summaryType" -> "Complete", "mimeType" -> "application/vnd.sunbird.questionset", - "primaryCategory" -> "Practice Question Set"))) + "primaryCategory" -> "Practice Question Set").asJava) (graphDB.getNodeByUniqueId(_: String, _: String, _: Boolean, _: Request)).expects(*, *, *, *).returns(Future(node)).atLeastOnce() (graphDB.updateNodes(_: String, _: util.List[String], _: util.HashMap[String, AnyRef])).expects(*, *, *).returns(Future(new util.HashMap[String, Node])) val request = getQuestionSetRequest() request.getContext.put("identifier", "do1234") - request.putAll(mapAsJavaMap(Map("versionKey" -> "1234", "description" -> "updated desc"))) + request.putAll(Map[String, Object]("versionKey" -> "1234", "description" -> "updated desc").asJava) request.setOperation("retireQuestionSet") val response = callActor(request, Props(new QuestionSetActor())) assert("successful".equals(response.getParams.getStatus)) @@ -256,7 +255,7 @@ class QuestionSetActorTest extends BaseSpec with MockFactory { (oec.kafkaClient _).expects().returns(kfClient).anyNumberOfTimes() (oec.graphService _).expects().returns(graphDB).anyNumberOfTimes() val node = getNode("do_11348469558523494411","QuestionSet", None) - node.getMetadata.putAll(mapAsJavaMap(Map("name" -> "question_1", + node.getMetadata.putAll(Map[String, Object]("name" -> "question_1", "visibility" -> "Default", "code" -> "finemanfine", "navigationMode" -> "linear", @@ -269,10 +268,10 @@ class QuestionSetActorTest extends BaseSpec with MockFactory { "summaryType" -> "Complete", "mimeType" -> "application/vnd.sunbird.questionset", "createdBy" -> "g-001", - "primaryCategory" -> "Practice Question Set"))) + "primaryCategory" -> "Practice Question Set").asJava) val nodeList = new util.ArrayList[Node]() {{ - add(getNode("do_11348469662446387212","Question", Some(Map("visibility"-> "Parent", "createdBy"-> "g-001")))) - add(getNode("do_11348469662607769614","Question", Some(Map("visibility"-> "Default", "createdBy"-> "g-002")))) + add(getNode("do_11348469662446387212","Question", Some(Map[String, AnyRef]("visibility"-> "Parent", "createdBy"-> "g-001").asJava))) + add(getNode("do_11348469662607769614","Question", Some(Map[String, AnyRef]("visibility"-> "Default", "createdBy"-> "g-002").asJava))) }} (graphDB.getNodeByUniqueId(_: String, _: String, _: Boolean, _: Request)).expects(*, *, *, *).returns(Future(node)).atLeastOnce() (graphDB.getNodeByUniqueIds(_ :String, _: SearchCriteria)).expects(*, *).returns(Future(nodeList)).atLeastOnce() @@ -280,7 +279,7 @@ class QuestionSetActorTest extends BaseSpec with MockFactory { (kfClient.send(_: String, _: String)).expects(*, *).once() val request = getQuestionSetRequest() request.getContext.put("identifier", "do1234") - request.putAll(mapAsJavaMap(Map("versionKey" -> "1234", "description" -> "updated desc"))) + request.putAll(Map[String, Object]("versionKey" -> "1234", "description" -> "updated desc").asJava) request.setOperation("publishQuestionSet") val response = callActor(request, Props(new QuestionSetActor())) assert("successful".equals(response.getParams.getStatus)) @@ -292,7 +291,7 @@ class QuestionSetActorTest extends BaseSpec with MockFactory { (oec.graphService _).expects().returns(graphDB).anyNumberOfTimes() val node = getNode("QuestionSet", None) node.setIdentifier("do_1234") - node.getMetadata.putAll(mapAsJavaMap(Map("name" -> "question_1", + node.getMetadata.putAll(Map[String, Object]("name" -> "question_1", "visibility" -> "Default", "code" -> "finemanfine", "navigationMode" -> "linear", @@ -305,7 +304,7 @@ class QuestionSetActorTest extends BaseSpec with MockFactory { "summaryType" -> "Complete", "versionKey" -> "1234", "mimeType" -> "application/vnd.sunbird.questionset", - "primaryCategory" -> "Practice Question Set"))) + "primaryCategory" -> "Practice Question Set").asJava) (graphDB.upsertNode(_: String, _: Node, _: Request)).expects(*, *, *).returns(Future(node)) (graphDB.getNodeByUniqueId(_: String, _: String, _: Boolean, _: Request)).expects(*, *, *, *).returns(Future(node)).anyNumberOfTimes() (graphDB.getNodeByUniqueIds(_: String, _: SearchCriteria)).expects(*, *).returns(Future(List(node).asJava)).anyNumberOfTimes() @@ -325,7 +324,7 @@ class QuestionSetActorTest extends BaseSpec with MockFactory { (oec.graphService _).expects().returns(graphDB).anyNumberOfTimes() val node = getNode("QuestionSet", None) node.setIdentifier("do_1234") - node.getMetadata.putAll(mapAsJavaMap(Map("name" -> "question_1", + node.getMetadata.putAll(Map[String, Object]("name" -> "question_1", "visibility" -> "Default", "code" -> "finemanfine", "navigationMode" -> "linear", @@ -338,7 +337,7 @@ class QuestionSetActorTest extends BaseSpec with MockFactory { "summaryType" -> "Complete", "versionKey" -> "1234", "mimeType" -> "application/vnd.sunbird.questionset", - "primaryCategory" -> "Practice Question Set"))) + "primaryCategory" -> "Practice Question Set").asJava) (graphDB.upsertNode(_: String, _: Node, _: Request)).expects(*, *, *).returns(Future(node)) (graphDB.getNodeByUniqueId(_: String, _: String, _: Boolean, _: Request)).expects(*, *, *, *).returns(Future(node)).anyNumberOfTimes() (graphDB.getNodeByUniqueIds(_: String, _: SearchCriteria)).expects(*, *).returns(Future(List(node).asJava)).anyNumberOfTimes() @@ -387,7 +386,7 @@ class QuestionSetActorTest extends BaseSpec with MockFactory { val graphDB = mock[GraphService] (oec.graphService _).expects().returns(graphDB).anyNumberOfTimes() val node = getNode("QuestionSet", None) - node.getMetadata.putAll(mapAsJavaMap(Map("name" -> "question_1", + node.getMetadata.putAll(Map[String, Object]("name" -> "question_1", "visibility" -> "Default", "code" -> "finemanfine", "navigationMode" -> "linear", @@ -401,7 +400,7 @@ class QuestionSetActorTest extends BaseSpec with MockFactory { "summaryType" -> "Complete", "versionKey" -> "1234", "mimeType" -> "application/vnd.sunbird.questionset", - "primaryCategory" -> "Practice Question Set"))) + "primaryCategory" -> "Practice Question Set").asJava) (graphDB.upsertNode(_: String, _: Node, _: Request)).expects(*, *, *).returns(Future(node)) (graphDB.getNodeByUniqueId(_: String, _: String, _: Boolean, _: Request)).expects(*, *, *, *).returns(Future(node)).atLeastOnce() (graphDB.readExternalProps(_: Request, _: List[String])).expects(*, *).returns(Future(getCassandraHierarchy())).anyNumberOfTimes @@ -412,7 +411,7 @@ class QuestionSetActorTest extends BaseSpec with MockFactory { val request = getQuestionSetRequest() request.getContext.put("identifier", "do1234") - request.putAll(mapAsJavaMap(Map("versionKey" -> "1234", "description" -> "updated desc"))) + request.putAll(Map[String, Object]("versionKey" -> "1234", "description" -> "updated desc").asJava) request.setOperation("rejectQuestionSet") val response = callActor(request, Props(new QuestionSetActor())) assert("successful".equals(response.getParams.getStatus)) @@ -455,7 +454,7 @@ class QuestionSetActorTest extends BaseSpec with MockFactory { (oec.graphService _).expects().returns(graphDB).anyNumberOfTimes() val node = getNode("QuestionSet", None) node.setIdentifier("test_id") - node.getMetadata.putAll(mapAsJavaMap(Map("name" -> "question_1", + node.getMetadata.putAll(Map[String, Object]("name" -> "question_1", "visibility" -> "Default", "code" -> "finemanfine", "description" -> "Updated description", @@ -469,17 +468,17 @@ class QuestionSetActorTest extends BaseSpec with MockFactory { "showHints" -> "Yes", "summaryType" -> "Complete", "mimeType" -> "application/vnd.sunbird.questionset", - "primaryCategory" -> "Practice Question Set"))) + "primaryCategory" -> "Practice Question Set").asJava) (graphDB.upsertNode(_: String, _: Node, _: Request)).expects(*, *, *).returns(Future(node)) (graphDB.getNodeByUniqueId(_: String, _: String, _: Boolean, _: Request)).expects(*, *, *, *).returns(Future(node)).atLeastOnce() - (graphDB.getNodeByUniqueIds(_: String, _: SearchCriteria)).expects(*, *).returns(Future(List(node))).once() + (graphDB.getNodeByUniqueIds(_: String, _: SearchCriteria)).expects(*, *).returns(Future(List(node).asJava)).once() val nodes: util.List[Node] = getCategoryNode() (graphDB.getNodeByUniqueIds(_: String, _: SearchCriteria)).expects(*, *).returns(Future(nodes)).noMoreThanOnce() (graphDB.readExternalProps(_: Request, _: List[String])).expects(*, *).returns(Future(getCassandraHierarchy())).anyNumberOfTimes val request = getQuestionSetRequest() request.getContext.put("identifier", "test_id") - request.putAll(mapAsJavaMap(Map("versionKey" -> "1234", "description" -> "updated desc"))) + request.putAll(Map[String, Object]("versionKey" -> "1234", "description" -> "updated desc").asJava) request.setOperation("systemUpdateQuestionSet") val response = callActor(request, Props(new QuestionSetActor())) assert("successful".equals(response.getParams.getStatus)) @@ -493,7 +492,7 @@ class QuestionSetActorTest extends BaseSpec with MockFactory { val imageNode = getNode("QuestionSet", None) node.setIdentifier("test_id") imageNode.setIdentifier("test_id.img") - node.getMetadata.putAll(mapAsJavaMap(Map("name" -> "question_1", + node.getMetadata.putAll(Map[String, Object]("name" -> "question_1", "visibility" -> "Default", "code" -> "finemanfine", "description" -> "Updated description", @@ -507,8 +506,8 @@ class QuestionSetActorTest extends BaseSpec with MockFactory { "showHints" -> "Yes", "summaryType" -> "Complete", "mimeType" -> "application/vnd.sunbird.questionset", - "primaryCategory" -> "Practice Question Set"))) - imageNode.getMetadata.putAll(mapAsJavaMap(Map("name" -> "question_1", + "primaryCategory" -> "Practice Question Set").asJava) + imageNode.getMetadata.putAll(Map[String, Object]("name" -> "question_1", "visibility" -> "Default", "code" -> "finemanfine", "description" -> "Updated description", @@ -522,9 +521,9 @@ class QuestionSetActorTest extends BaseSpec with MockFactory { "summaryType" -> "Complete", "status" -> "Draft", "mimeType" -> "application/vnd.sunbird.questionset", - "primaryCategory" -> "Practice Question Set"))) + "primaryCategory" -> "Practice Question Set").asJava) (graphDB.getNodeByUniqueId(_: String, _: String, _: Boolean, _: Request)).expects(*, *, *, *).returns(Future(node)).atLeastOnce() - (graphDB.getNodeByUniqueIds(_: String, _: SearchCriteria)).expects(*, *).returns(Future(List(node, imageNode))).once() + (graphDB.getNodeByUniqueIds(_: String, _: SearchCriteria)).expects(*, *).returns(Future(List(node, imageNode).asJava)).once() val nodes: util.List[Node] = getCategoryNode() (graphDB.getNodeByUniqueIds(_: String, _: SearchCriteria)).expects(*, *).returns(Future(nodes)).anyNumberOfTimes() @@ -533,7 +532,7 @@ class QuestionSetActorTest extends BaseSpec with MockFactory { (graphDB.upsertNode(_: String, _: Node, _: Request)).expects(*, *, *).returns(Future(node)).anyNumberOfTimes() val request = getQuestionSetRequest() request.getContext.put("identifier", "test_id") - request.putAll(mapAsJavaMap(Map("versionKey" -> "1234", "description" -> "updated desc"))) + request.putAll(Map[String, Object]("versionKey" -> "1234", "description" -> "updated desc").asJava) request.setOperation("systemUpdateQuestionSet") val response = callActor(request, Props(new QuestionSetActor())) assert("successful".equals(response.getParams.getStatus)) @@ -664,7 +663,7 @@ class QuestionSetActorTest extends BaseSpec with MockFactory { def getRootNode(): Node = { val node = getNode("QuestionSet", None) node.setIdentifier("do_1234") - node.getMetadata.putAll(mapAsJavaMap(Map("name" -> "question_1", + node.getMetadata.putAll(Map[String, Object]("name" -> "question_1", "visibility" -> "Default", "code" -> "finemanfine", "navigationMode" -> "linear", @@ -679,19 +678,19 @@ class QuestionSetActorTest extends BaseSpec with MockFactory { "mimeType" -> "application/vnd.sunbird.questionset", "primaryCategory" -> "Practice Question Set", "channel" -> "in.ekstep" - ))) + ).asJava) node } def getQuestionSetNode(identifier:String): Node = { val node = getNode("QuestionSet", None) node.setIdentifier(identifier) - node.getMetadata.putAll(mapAsJavaMap(Map("name" -> "question_1", + node.getMetadata.putAll(Map[String, Object]("name" -> "question_1", "visibility" -> "Default", "code" -> "finemanfine", "versionKey" -> "1234", "mimeType" -> "application/vnd.sunbird.questionset", - "primaryCategory" -> "Practice Question Set"))) + "primaryCategory" -> "Practice Question Set").asJava) node } } diff --git a/assessment-api/assessment-service/pom.xml b/assessment-api/assessment-service/pom.xml index b60eabf21..f00cb149c 100644 --- a/assessment-api/assessment-service/pom.xml +++ b/assessment-api/assessment-service/pom.xml @@ -31,7 +31,7 @@ - 2.7.2 + 2.7.9 1.0.0-rc5 1.0.0 diff --git a/assessment-api/pom.xml b/assessment-api/pom.xml index b1bb913ed..7c55ee4d4 100644 --- a/assessment-api/pom.xml +++ b/assessment-api/pom.xml @@ -20,7 +20,7 @@ UTF-8 UTF-8 - 2.11 + 2.12 diff --git a/assessment-api/qs-hierarchy-manager/pom.xml b/assessment-api/qs-hierarchy-manager/pom.xml index e4de07f22..5f4da12bb 100644 --- a/assessment-api/qs-hierarchy-manager/pom.xml +++ b/assessment-api/qs-hierarchy-manager/pom.xml @@ -31,14 +31,33 @@ org.scalatest scalatest_${scala.maj.version} - 3.1.2 + 3.2.18 test + + org.scalactic + scalactic_${scala.maj.version} + 3.2.18 + org.neo4j neo4j-bolt 3.5.0 test + + + org.scala-lang + scala-library + + + org.scalatest + scalatest_2.11 + + + org.scalactic + scalactic_2.11 + + org.neo4j @@ -73,6 +92,7 @@ unirest-java 1.4.9 + @@ -83,7 +103,7 @@ net.alchim31.maven scala-maven-plugin - 4.4.0 + 4.8.1 ${scala.version} false diff --git a/assessment-api/qs-hierarchy-manager/src/main/scala/org/sunbird/managers/HierarchyManager.scala b/assessment-api/qs-hierarchy-manager/src/main/scala/org/sunbird/managers/HierarchyManager.scala index 125489648..7b2fea8e7 100644 --- a/assessment-api/qs-hierarchy-manager/src/main/scala/org/sunbird/managers/HierarchyManager.scala +++ b/assessment-api/qs-hierarchy-manager/src/main/scala/org/sunbird/managers/HierarchyManager.scala @@ -216,7 +216,7 @@ object HierarchyManager { val redisHierarchy = if(Platform.getBoolean("questionset.cache.enable", false)) RedisCache.get(hierarchyPrefix + request.get("rootId")) else "" val hierarchyFuture = if (StringUtils.isNotEmpty(redisHierarchy)) { - Future(mapAsJavaMap(Map("questionSet" -> JsonUtils.deserialize(redisHierarchy, classOf[java.util.Map[String, AnyRef]])))) + Future(JavaConverters.mapAsJavaMap(Map("questionSet" -> JsonUtils.deserialize(redisHierarchy, classOf[java.util.Map[String, AnyRef]])))) } else getCassandraHierarchy(request) hierarchyFuture.map(result => { if (!result.isEmpty) { @@ -429,7 +429,7 @@ object HierarchyManager { existingLeafNodes.map(en => { leafNodeMap.get(en._1).put("index", en._2.get("index").asInstanceOf[Integer]) }) - filteredLeafNodes = bufferAsJavaList(childList.filter(existingLeafNode => { + filteredLeafNodes = JavaConverters.bufferAsJavaList(childList.filter(existingLeafNode => { !leafNodeIds.contains(existingLeafNode.get("identifier").asInstanceOf[String]) })) maxIndex = childMap.values.toList.map(child => child.get("index").asInstanceOf[Integer]).toList.max.asInstanceOf[Integer] @@ -487,7 +487,7 @@ object HierarchyManager { hierarchy.map(hierarchy => { if (!hierarchy.isEmpty) { if (StringUtils.isNotEmpty(hierarchy.getOrDefault("status", "").asInstanceOf[String]) && statusList.contains(hierarchy.getOrDefault("status", "").asInstanceOf[String])) { - val hierarchyMap = mapAsJavaMap(hierarchy) + val hierarchyMap = JavaConverters.mapAsJavaMap(hierarchy) rootHierarchy.put("questionSet", hierarchyMap) RedisCache.set(hierarchyPrefix + request.get("rootId"), JsonUtils.serialize(hierarchyMap)) Future(rootHierarchy) @@ -502,8 +502,8 @@ object HierarchyManager { val parentHierarchy = fetchHierarchy(request, response.get("identifier").asInstanceOf[String]) parentHierarchy.map(hierarchy => { if (!hierarchy.isEmpty) { - if (StringUtils.isNoneEmpty(hierarchy.getOrDefault("status", "").asInstanceOf[String]) && statusList.contains(hierarchy.getOrDefault("status", "").asInstanceOf[String]) && CollectionUtils.isNotEmpty(mapAsJavaMap(hierarchy).get("children").asInstanceOf[util.ArrayList[util.HashMap[String, AnyRef]]])) { - val bookmarkHierarchy = filterBookmarkHierarchy(mapAsJavaMap(hierarchy).get("children").asInstanceOf[util.ArrayList[util.Map[String, AnyRef]]], request.get("rootId").asInstanceOf[String]) + if (StringUtils.isNoneEmpty(hierarchy.getOrDefault("status", "").asInstanceOf[String]) && statusList.contains(hierarchy.getOrDefault("status", "").asInstanceOf[String]) && CollectionUtils.isNotEmpty(JavaConverters.mapAsJavaMap(hierarchy).get("children").asInstanceOf[util.ArrayList[util.HashMap[String, AnyRef]]])) { + val bookmarkHierarchy = filterBookmarkHierarchy(JavaConverters.mapAsJavaMap(hierarchy).get("children").asInstanceOf[util.ArrayList[util.Map[String, AnyRef]]], request.get("rootId").asInstanceOf[String]) if (!bookmarkHierarchy.isEmpty) { rootHierarchy.put("questionSet", hierarchy) RedisCache.set(hierarchyPrefix + request.get("rootId"), JsonUtils.serialize(hierarchy)) @@ -569,7 +569,7 @@ object HierarchyManager { if (CollectionUtils.isNotEmpty(response)) { response.get(0) } else { - val nextChildren = bufferAsJavaList(children.flatMap(child => { + val nextChildren = JavaConverters.bufferAsJavaList(children.flatMap(child => { if (!child.isEmpty && CollectionUtils.isNotEmpty(child.get("children").asInstanceOf[util.List[util.Map[String, AnyRef]]])) child.get("children").asInstanceOf[util.List[util.Map[String, AnyRef]]] else new util.ArrayList[util.Map[String, AnyRef]] @@ -585,8 +585,8 @@ object HierarchyManager { if (StringUtils.isNotEmpty(identifier)) { val parentHierarchy = fetchHierarchy(request, identifier + imgSuffix) parentHierarchy.map(hierarchy => { - if (!hierarchy.isEmpty && CollectionUtils.isNotEmpty(mapAsJavaMap(hierarchy).get("children").asInstanceOf[util.ArrayList[util.Map[String, AnyRef]]])) { - val bookmarkHierarchy = filterBookmarkHierarchy(mapAsJavaMap(hierarchy).get("children").asInstanceOf[util.ArrayList[util.Map[String, AnyRef]]], request.get("rootId").asInstanceOf[String]) + if (!hierarchy.isEmpty && CollectionUtils.isNotEmpty(JavaConverters.mapAsJavaMap(hierarchy).get("children").asInstanceOf[util.ArrayList[util.Map[String, AnyRef]]])) { + val bookmarkHierarchy = filterBookmarkHierarchy(JavaConverters.mapAsJavaMap(hierarchy).get("children").asInstanceOf[util.ArrayList[util.Map[String, AnyRef]]], request.get("rootId").asInstanceOf[String]) if (!bookmarkHierarchy.isEmpty) { bookmarkHierarchy } else { diff --git a/assessment-api/qs-hierarchy-manager/src/main/scala/org/sunbird/managers/UpdateHierarchyManager.scala b/assessment-api/qs-hierarchy-manager/src/main/scala/org/sunbird/managers/UpdateHierarchyManager.scala index 59cdd1810..5e030b53b 100644 --- a/assessment-api/qs-hierarchy-manager/src/main/scala/org/sunbird/managers/UpdateHierarchyManager.scala +++ b/assessment-api/qs-hierarchy-manager/src/main/scala/org/sunbird/managers/UpdateHierarchyManager.scala @@ -20,7 +20,7 @@ import org.sunbird.utils.{HierarchyConstants, HierarchyErrorCodes} import scala.collection.JavaConversions._ import scala.collection.JavaConverters._ -import scala.collection.mutable +import scala.collection.{JavaConverters, mutable} import scala.concurrent.{ExecutionContext, Future} object UpdateHierarchyManager { @@ -50,7 +50,7 @@ object UpdateHierarchyManager { val response = ResponseHandler.OK() response.put(HierarchyConstants.IDENTIFIER, rootId) idMap.remove(rootId) - response.put(HierarchyConstants.IDENTIFIERS, mapAsJavaMap(idMap)) + response.put(HierarchyConstants.IDENTIFIERS, JavaConverters.mapAsJavaMap(idMap)) if (request.getContext.getOrDefault("shouldImageDelete", false.asInstanceOf[AnyRef]).asInstanceOf[Boolean]) deleteHierarchy(request) Future(response) @@ -502,7 +502,7 @@ object UpdateHierarchyManager { def sortByIndex(childrenMaps: java.util.List[java.util.Map[String, AnyRef]]): java.util.List[java.util.Map[String, AnyRef]] = { - bufferAsJavaList(childrenMaps.sortBy(_.get("index").asInstanceOf[Int])) + JavaConverters.bufferAsJavaList(childrenMaps.sortBy(_.get("index").asInstanceOf[Int])) } diff --git a/assessment-api/qs-hierarchy-manager/src/test/scala/org/sunbird/managers/BaseSpec.scala b/assessment-api/qs-hierarchy-manager/src/test/scala/org/sunbird/managers/BaseSpec.scala index 01bad4b13..215dc298d 100644 --- a/assessment-api/qs-hierarchy-manager/src/test/scala/org/sunbird/managers/BaseSpec.scala +++ b/assessment-api/qs-hierarchy-manager/src/test/scala/org/sunbird/managers/BaseSpec.scala @@ -1,7 +1,6 @@ package org.sunbird.managers import java.io.{File, IOException} - import com.datastax.driver.core.{ResultSet, Session} import org.apache.commons.io.FileUtils import org.cassandraunit.utils.EmbeddedCassandraServerHelper @@ -9,11 +8,16 @@ import org.neo4j.graphdb.GraphDatabaseService import org.neo4j.graphdb.factory.GraphDatabaseFactory import org.neo4j.graphdb.factory.GraphDatabaseSettings.Connector.ConnectorType import org.neo4j.kernel.configuration.BoltConnector -import org.scalatest.{AsyncFlatSpec, BeforeAndAfterAll, BeforeAndAfterEach, Matchers} +import org.scalatest.flatspec.{AnyFlatSpec} +import org.scalatest.matchers.should.Matchers import org.sunbird.cassandra.CassandraConnector import org.sunbird.common.Platform +import org.scalatest.BeforeAndAfterEach +import org.scalatest.BeforeAndAfterAll + -class BaseSpec extends AsyncFlatSpec with Matchers with BeforeAndAfterAll with BeforeAndAfterEach{ +class BaseSpec extends AnyFlatSpec with Matchers with BeforeAndAfterAll + with BeforeAndAfterEach { var graphDb: GraphDatabaseService = null var session: Session = null diff --git a/assessment-api/qs-hierarchy-manager/src/test/scala/org/sunbird/managers/HierarchyManagerTest.scala b/assessment-api/qs-hierarchy-manager/src/test/scala/org/sunbird/managers/HierarchyManagerTest.scala index baaaeadb8..97030f8a3 100644 --- a/assessment-api/qs-hierarchy-manager/src/test/scala/org/sunbird/managers/HierarchyManagerTest.scala +++ b/assessment-api/qs-hierarchy-manager/src/test/scala/org/sunbird/managers/HierarchyManagerTest.scala @@ -1,15 +1,15 @@ package org.sunbird.managers import java.util - import org.sunbird.common.JsonUtils import org.sunbird.common.dto.Request import org.sunbird.common.exception.ClientException import org.sunbird.graph.OntologyEngineContext import org.sunbird.utils.HierarchyConstants -import scala.collection.JavaConversions._ +import scala.collection.JavaConverters import scala.collection.JavaConverters._ +import scala.concurrent.ExecutionContext.Implicits.global class HierarchyManagerTest extends BaseSpec { @@ -74,7 +74,7 @@ class HierarchyManagerTest extends BaseSpec { "addLeafNodesToHierarchy" should "add leaf node under root" in { val request = new Request() request.setContext(getContext(HierarchyConstants.QUESTIONSET_OBJECT_TYPE)) - request.putAll(mapAsJavaMap(Map(HierarchyConstants.ROOT_ID -> "do_obs_123", "mode" -> "edit", "children" -> List("do_textq_live_123").asJava))) + request.putAll(JavaConverters.mapAsJavaMap(Map(HierarchyConstants.ROOT_ID -> "do_obs_123", "mode" -> "edit", "children" -> List("do_textq_live_123").asJava))) val future = HierarchyManager.addLeafNodesToHierarchy(request) future.map(response => { assert(response.getResponseCode.code() == 200) @@ -89,7 +89,7 @@ class HierarchyManagerTest extends BaseSpec { val request = new Request() request.setContext(getContext(HierarchyConstants.QUESTIONSET_OBJECT_TYPE)) val branchingLogicStr = "{\"do_textq_live_123\":{\"target\":[],\"preCondition\":{\"and\":[{\"eq\":[{\"var\":\"do_textq_draft_123.response1.value\",\"type\":\"responseDeclaration\"},\"0\"]}]},\"source\":[\"do_textq_draft_123\"]}}" - request.putAll(mapAsJavaMap(Map(HierarchyConstants.ROOT_ID -> "do_obs_with_section_123", "mode" -> "edit", "collectionId" -> "do_section_1", "children" -> List("do_textq_live_123").asJava, "branchingLogic" -> JsonUtils.deserialize(branchingLogicStr, classOf[util.HashMap[String, AnyRef]])))) + request.putAll(JavaConverters.mapAsJavaMap(Map(HierarchyConstants.ROOT_ID -> "do_obs_with_section_123", "mode" -> "edit", "collectionId" -> "do_section_1", "children" -> List("do_textq_live_123").asJava, "branchingLogic" -> JsonUtils.deserialize(branchingLogicStr, classOf[util.HashMap[String, AnyRef]])))) val future = HierarchyManager.addLeafNodesToHierarchy(request) future.map(response => { assert(response.getResponseCode.code() == 200) @@ -104,7 +104,7 @@ class HierarchyManagerTest extends BaseSpec { val request = new Request() request.setContext(getContext(HierarchyConstants.QUESTIONSET_OBJECT_TYPE)) val branchingLogicStr = "{\"do_text_live_123\":{\"target\":[],\"preCondition\":{\"and\":[{\"eq\":[{\"var\":\"do_textq_draft_123.response1.value\",\"type\":\"responseDeclaration\"},\"0\"]}]},\"source\":[\"do_textq_draft_123\"]}}" - request.putAll(mapAsJavaMap(Map(HierarchyConstants.ROOT_ID -> "do_obs_with_section_123", "mode" -> "edit", "collectionId" -> "do_section_1", "children" -> List("do_textq_live_123").asJava, "branchingLogic" -> JsonUtils.deserialize(branchingLogicStr, classOf[util.HashMap[String, AnyRef]])))) + request.putAll(JavaConverters.mapAsJavaMap(Map(HierarchyConstants.ROOT_ID -> "do_obs_with_section_123", "mode" -> "edit", "collectionId" -> "do_section_1", "children" -> List("do_textq_live_123").asJava, "branchingLogic" -> JsonUtils.deserialize(branchingLogicStr, classOf[util.HashMap[String, AnyRef]])))) val exception = intercept[ClientException] { HierarchyManager.addLeafNodesToHierarchy(request) } @@ -116,7 +116,7 @@ class HierarchyManagerTest extends BaseSpec { executeCassandraQuery(HIERARCHY_QS_3) val request = new Request() request.setContext(getContext(HierarchyConstants.QUESTIONSET_OBJECT_TYPE)) - request.putAll(mapAsJavaMap(Map(HierarchyConstants.ROOT_ID -> "do_obs_with_section_234", "mode" -> "edit", "collectionId" -> "do_section_1", "children" -> List("do_mcqq_draft_123").asJava))) + request.putAll(JavaConverters.mapAsJavaMap(Map(HierarchyConstants.ROOT_ID -> "do_obs_with_section_234", "mode" -> "edit", "collectionId" -> "do_section_1", "children" -> List("do_mcqq_draft_123").asJava))) HierarchyManager.removeLeafNodesFromHierarchy(request).map(response => { assert(response.getResponseCode.code() == 200) val hierarchy = readFromCassandra("Select hierarchy from hierarchy_store.questionset_hierarchy where identifier='do_obs_with_section_234'") diff --git a/assessment-api/qs-hierarchy-manager/src/test/scala/org/sunbird/managers/UpdateHierarchyManagerTest.scala b/assessment-api/qs-hierarchy-manager/src/test/scala/org/sunbird/managers/UpdateHierarchyManagerTest.scala index 8ea1a7029..37cb1b5d8 100644 --- a/assessment-api/qs-hierarchy-manager/src/test/scala/org/sunbird/managers/UpdateHierarchyManagerTest.scala +++ b/assessment-api/qs-hierarchy-manager/src/test/scala/org/sunbird/managers/UpdateHierarchyManagerTest.scala @@ -8,6 +8,7 @@ import org.sunbird.common.JsonUtils import org.sunbird.common.dto.Request import org.sunbird.graph.OntologyEngineContext import org.sunbird.utils.HierarchyConstants +import scala.concurrent.ExecutionContext.Implicits.global class UpdateHierarchyManagerTest extends BaseSpec { diff --git a/content-api/collection-csv-actors/pom.xml b/content-api/collection-csv-actors/pom.xml index 45e1060f9..b74bbb4b0 100644 --- a/content-api/collection-csv-actors/pom.xml +++ b/content-api/collection-csv-actors/pom.xml @@ -47,7 +47,7 @@ org.scalatest scalatest_${scala.maj.version} - 3.0.8 + 3.2.18 test @@ -93,7 +93,7 @@ net.alchim31.maven scala-maven-plugin - 4.4.0 + 4.8.1 ${scala.version} false diff --git a/content-api/collection-csv-actors/src/test/scala/org/sunbird/collectioncsv/TestCollectionCSVActor.scala b/content-api/collection-csv-actors/src/test/scala/org/sunbird/collectioncsv/TestCollectionCSVActor.scala index 15ff789b0..6f874cb5e 100644 --- a/content-api/collection-csv-actors/src/test/scala/org/sunbird/collectioncsv/TestCollectionCSVActor.scala +++ b/content-api/collection-csv-actors/src/test/scala/org/sunbird/collectioncsv/TestCollectionCSVActor.scala @@ -2,8 +2,9 @@ package org.sunbird.collectioncsv import akka.actor.{ActorSystem, Props} import akka.testkit.TestKit +import org.scalamock.matchers.Matchers import org.scalamock.scalatest.MockFactory -import org.scalatest.{FlatSpec, Matchers} +import org.scalatest.flatspec.AnyFlatSpec import org.sunbird.cloudstore.StorageService import org.sunbird.collectioncsv.actors.CollectionCSVActor import org.sunbird.collectioncsv.util.CollectionTOCConstants @@ -19,7 +20,7 @@ import scala.concurrent.{ExecutionContext, Future} import scala.concurrent.duration.FiniteDuration -class TestCollectionCSVActor extends FlatSpec with Matchers with MockFactory { +class TestCollectionCSVActor extends AnyFlatSpec with Matchers with MockFactory { implicit val ec: ExecutionContext = ExecutionContext.global val system: ActorSystem = ActorSystem.create("system") diff --git a/content-api/content-actors/pom.xml b/content-api/content-actors/pom.xml index a429dc8f9..c7f7b75fc 100644 --- a/content-api/content-actors/pom.xml +++ b/content-api/content-actors/pom.xml @@ -47,7 +47,7 @@ org.scalatest scalatest_${scala.maj.version} - 3.0.8 + 3.2.18 test @@ -81,7 +81,7 @@ net.alchim31.maven scala-maven-plugin - 4.4.0 + 4.8.1 ${scala.version} false diff --git a/content-api/content-actors/src/test/scala/org/sunbird/channel/TestChannelManager.scala b/content-api/content-actors/src/test/scala/org/sunbird/channel/TestChannelManager.scala index 4d58324f9..b61d3ed6a 100644 --- a/content-api/content-actors/src/test/scala/org/sunbird/channel/TestChannelManager.scala +++ b/content-api/content-actors/src/test/scala/org/sunbird/channel/TestChannelManager.scala @@ -1,18 +1,21 @@ package org.sunbird.channel -import org.scalatest.{AsyncFlatSpec, Matchers} import org.sunbird.common.dto.Request import java.util import org.apache.commons.collections.CollectionUtils +import org.scalactic.Prettifier.default +import org.scalamock.matchers.Matchers import org.scalamock.scalatest.MockFactory +import org.scalatest.flatspec.AnyFlatSpec +import org.scalatest.matchers.should.Matchers.convertToAnyShouldWrapper import org.sunbird.cache.impl.RedisCache import org.sunbird.util.{ChannelConstants, HTTPResponse, HttpUtil} import org.sunbird.channel.managers.ChannelManager -import org.sunbird.common.exception.{ClientException} +import org.sunbird.common.exception.ClientException -class TestChannelManager extends AsyncFlatSpec with Matchers with MockFactory { +class TestChannelManager extends AnyFlatSpec with Matchers with MockFactory { implicit val httpUtil: HttpUtil = mock[HttpUtil] diff --git a/content-api/content-actors/src/test/scala/org/sunbird/content/actors/BaseSpec.scala b/content-api/content-actors/src/test/scala/org/sunbird/content/actors/BaseSpec.scala index 30c4742de..3d2dcb213 100644 --- a/content-api/content-actors/src/test/scala/org/sunbird/content/actors/BaseSpec.scala +++ b/content-api/content-actors/src/test/scala/org/sunbird/content/actors/BaseSpec.scala @@ -2,10 +2,10 @@ package org.sunbird.content.actors import java.util import java.util.concurrent.TimeUnit - import akka.actor.{ActorSystem, Props} import akka.testkit.TestKit -import org.scalatest.{FlatSpec, Matchers} +import org.scalatest.flatspec.AnyFlatSpec +import org.scalatest.matchers.should.Matchers import org.sunbird.common.dto.{Request, Response} import org.sunbird.graph.OntologyEngineContext import org.sunbird.graph.dac.model.Node @@ -13,7 +13,7 @@ import org.sunbird.graph.schema.FrameworkMasterCategoryMap import scala.concurrent.duration.FiniteDuration -class BaseSpec extends FlatSpec with Matchers { +class BaseSpec extends AnyFlatSpec with Matchers { val system = ActorSystem.create("system") diff --git a/content-api/content-actors/src/test/scala/org/sunbird/content/dial/DIALManagerTest.scala b/content-api/content-actors/src/test/scala/org/sunbird/content/dial/DIALManagerTest.scala index 6cfa80930..35ab9acb0 100644 --- a/content-api/content-actors/src/test/scala/org/sunbird/content/dial/DIALManagerTest.scala +++ b/content-api/content-actors/src/test/scala/org/sunbird/content/dial/DIALManagerTest.scala @@ -1,10 +1,9 @@ package org.sunbird.content.dial import java.util - import org.scalamock.matchers.Matchers import org.scalamock.scalatest.AsyncMockFactory -import org.scalatest.AsyncFlatSpec +import org.scalatest.flatspec.AnyFlatSpec import org.sunbird.common.{HttpUtil, JsonUtils} import org.sunbird.common.dto.{Request, Response} import org.sunbird.common.exception.{ClientException, ResourceNotFoundException, ResponseCode, ServerException} @@ -13,7 +12,7 @@ import org.sunbird.graph.{GraphService, OntologyEngineContext} import scala.concurrent.Future -class DIALManagerTest extends AsyncFlatSpec with Matchers with AsyncMockFactory { +class DIALManagerTest extends AnyFlatSpec with Matchers with AsyncMockFactory { implicit val oec: OntologyEngineContext = mock[OntologyEngineContext] val graphDB = mock[GraphService] diff --git a/content-api/content-actors/src/test/scala/org/sunbird/content/upload/mgr/UploadManagerTest.scala b/content-api/content-actors/src/test/scala/org/sunbird/content/upload/mgr/UploadManagerTest.scala index 44ac88da3..55a98c0e0 100644 --- a/content-api/content-actors/src/test/scala/org/sunbird/content/upload/mgr/UploadManagerTest.scala +++ b/content-api/content-actors/src/test/scala/org/sunbird/content/upload/mgr/UploadManagerTest.scala @@ -1,11 +1,14 @@ package org.sunbird.content.upload.mgr -import java.util +import org.scalatest.flatspec.AnyFlatSpec +import org.scalatest.matchers.should.Matchers -import org.scalatest.{AsyncFlatSpec, Matchers} +import java.util import org.sunbird.graph.dac.model.Node +import scala.concurrent.ExecutionContext.Implicits.global + -class UploadManagerTest extends AsyncFlatSpec with Matchers { +class UploadManagerTest extends AnyFlatSpec with Matchers { "getUploadResponse with valid node object" should "return response with artifactUrl" in { val node = new Node() diff --git a/content-api/content-actors/src/test/scala/org/sunbird/content/util/CopyManagerTest.scala b/content-api/content-actors/src/test/scala/org/sunbird/content/util/CopyManagerTest.scala index 5830e52c3..c694f33dc 100644 --- a/content-api/content-actors/src/test/scala/org/sunbird/content/util/CopyManagerTest.scala +++ b/content-api/content-actors/src/test/scala/org/sunbird/content/util/CopyManagerTest.scala @@ -1,10 +1,12 @@ package org.sunbird.content.util import java.util - import org.apache.commons.collections.MapUtils +import org.scalactic.Prettifier.default +import org.scalamock.matchers.Matchers import org.scalamock.scalatest.AsyncMockFactory -import org.scalatest.{AsyncFlatSpec, Matchers} +import org.scalatest.flatspec.AnyFlatSpec +import org.scalatest.matchers.should.Matchers.convertToAnyShouldWrapper import org.sunbird.cloud.storage.util.JSONUtils import org.sunbird.cloudstore.StorageService import org.sunbird.common.dto.{Property, Request} @@ -14,9 +16,12 @@ import org.sunbird.graph.dac.model.Node import org.sunbird.graph.utils.ScalaJsonUtils import scala.collection.JavaConversions.mapAsJavaMap +import scala.collection.JavaConverters +import scala.collection.JavaConverters.asJavaIterableConverter +import scala.collection.immutable.HashMap import scala.concurrent.Future -class CopyManagerTest extends AsyncFlatSpec with Matchers with AsyncMockFactory { +class CopyManagerTest extends AnyFlatSpec with Matchers with AsyncMockFactory { "CopyManager" should "return copied node identifier when content is copied" ignore { implicit val oec: OntologyEngineContext = mock[OntologyEngineContext] @@ -46,7 +51,7 @@ class CopyManagerTest extends AsyncFlatSpec with Matchers with AsyncMockFactory implicit val ss = mock[StorageService] val request = getInvalidCopyRequest_2() request.getContext.put("identifier","do_1234") - request.getRequest.putAll(mapAsJavaMap(Map("identifier" -> "do_1234"))) + request.getRequest.putAll(JavaConverters.mapAsJavaMap(Map("identifier" -> "do_1234"))) val exception = intercept[ClientException] { CopyManager.validateRequest(request) } diff --git a/content-api/content-actors/src/test/scala/org/sunbird/content/util/FlagManagerTest.scala b/content-api/content-actors/src/test/scala/org/sunbird/content/util/FlagManagerTest.scala index 06344afbb..3b79c268c 100644 --- a/content-api/content-actors/src/test/scala/org/sunbird/content/util/FlagManagerTest.scala +++ b/content-api/content-actors/src/test/scala/org/sunbird/content/util/FlagManagerTest.scala @@ -1,10 +1,10 @@ package org.sunbird.content.util import java.util - import org.scalamock.scalatest.MockFactory -import org.scalatest.{FlatSpec, Matchers} -class FlagManagerTest extends FlatSpec with Matchers with MockFactory { +import org.scalatest.flatspec.AnyFlatSpec +import org.scalatest.matchers.should.Matchers +class FlagManagerTest extends AnyFlatSpec with Matchers with MockFactory { "addFlagReasons with metadata metadata without flagReasons" should "return flaggedList with only list with request flagReasons value" in { val requestFlagReasons = java.util.Arrays.asList("Not a valid content") diff --git a/content-api/content-actors/src/test/scala/org/sunbird/content/util/RequestUtilTest.scala b/content-api/content-actors/src/test/scala/org/sunbird/content/util/RequestUtilTest.scala index b3cff3429..0462bc2f7 100644 --- a/content-api/content-actors/src/test/scala/org/sunbird/content/util/RequestUtilTest.scala +++ b/content-api/content-actors/src/test/scala/org/sunbird/content/util/RequestUtilTest.scala @@ -1,16 +1,16 @@ package org.sunbird.content.util import java.util - import org.scalamock.scalatest.AsyncMockFactory -import org.scalatest.{FlatSpec, Matchers} +import org.scalatest.flatspec.AnyFlatSpec +import org.scalatest.matchers.should.Matchers import org.sunbird.common.dto.Request import org.sunbird.common.exception.ClientException import org.sunbird.graph.OntologyEngineContext import org.sunbird.util.RequestUtil -class RequestUtilTest extends FlatSpec with Matchers with AsyncMockFactory { +class RequestUtilTest extends AnyFlatSpec with Matchers with AsyncMockFactory { it should "throw clientException for invalid request" in { diff --git a/content-api/content-actors/src/test/scala/org/sunbird/content/util/TestAssetManager.scala b/content-api/content-actors/src/test/scala/org/sunbird/content/util/TestAssetManager.scala index 62dc10c11..9055bd2f5 100644 --- a/content-api/content-actors/src/test/scala/org/sunbird/content/util/TestAssetManager.scala +++ b/content-api/content-actors/src/test/scala/org/sunbird/content/util/TestAssetManager.scala @@ -1,9 +1,9 @@ package org.sunbird.content.util import java.util - import org.scalamock.scalatest.AsyncMockFactory -import org.scalatest.{AsyncFlatSpec, Matchers} +import org.scalatest.flatspec.AnyFlatSpec +import org.scalatest.matchers.should.Matchers import org.sunbird.common.dto.{Property, Request} import org.sunbird.common.exception.ResponseCode import org.sunbird.graph.{GraphService, OntologyEngineContext} @@ -13,7 +13,7 @@ import org.sunbird.graph.utils.ScalaJsonUtils import scala.collection.JavaConversions.mapAsJavaMap import scala.concurrent.Future -class TestAssetManager extends AsyncFlatSpec with Matchers with AsyncMockFactory { +class TestAssetManager extends AnyFlatSpec with Matchers with AsyncMockFactory { "AssetCopyManager" should "return copied node identifier when asset is copied" ignore { implicit val oec: OntologyEngineContext = mock[OntologyEngineContext] val graphDB = mock[GraphService] diff --git a/content-api/content-service/pom.xml b/content-api/content-service/pom.xml index 77e6eabf5..fff732413 100755 --- a/content-api/content-service/pom.xml +++ b/content-api/content-service/pom.xml @@ -29,10 +29,10 @@ - 2.7.2 + 2.7.9 1.0.0-rc5 1.0.0 - 2.11 + 2.12 @@ -122,7 +122,7 @@ org.scalatest scalatest_${scala.maj.version} - 3.1.2 + 3.2.18 test diff --git a/content-api/hierarchy-manager/pom.xml b/content-api/hierarchy-manager/pom.xml index 828dac9fc..73dcacbc2 100644 --- a/content-api/hierarchy-manager/pom.xml +++ b/content-api/hierarchy-manager/pom.xml @@ -31,7 +31,7 @@ org.scalatest scalatest_${scala.maj.version} - 3.1.2 + 3.2.18 test @@ -39,6 +39,20 @@ neo4j-bolt 3.5.0 test + + + org.scala-lang + scala-library + + + org.scalatest + scalatest_2.11 + + + org.scalactic + scalactic_2.11 + + org.neo4j @@ -83,7 +97,7 @@ net.alchim31.maven scala-maven-plugin - 4.4.0 + 4.8.1 ${scala.version} false diff --git a/content-api/hierarchy-manager/src/test/scala/org/sunbird/managers/BaseSpec.scala b/content-api/hierarchy-manager/src/test/scala/org/sunbird/managers/BaseSpec.scala index 361d12c04..b564110b0 100644 --- a/content-api/hierarchy-manager/src/test/scala/org/sunbird/managers/BaseSpec.scala +++ b/content-api/hierarchy-manager/src/test/scala/org/sunbird/managers/BaseSpec.scala @@ -1,7 +1,6 @@ package org.sunbird.managers import java.io.{File, IOException} - import com.datastax.driver.core.{ResultSet, Session} import org.apache.commons.io.FileUtils import org.cassandraunit.utils.EmbeddedCassandraServerHelper @@ -9,11 +8,13 @@ import org.neo4j.graphdb.GraphDatabaseService import org.neo4j.graphdb.factory.GraphDatabaseFactory import org.neo4j.graphdb.factory.GraphDatabaseSettings.Connector.ConnectorType import org.neo4j.kernel.configuration.BoltConnector -import org.scalatest.{AsyncFlatSpec, BeforeAndAfterAll, BeforeAndAfterEach, Matchers} +import org.scalatest.flatspec.AnyFlatSpec +import org.scalatest.matchers.should.Matchers +import org.scalatest.{BeforeAndAfterAll, BeforeAndAfterEach} import org.sunbird.cassandra.CassandraConnector import org.sunbird.common.Platform -class BaseSpec extends AsyncFlatSpec with Matchers with BeforeAndAfterAll with BeforeAndAfterEach { +class BaseSpec extends AnyFlatSpec with Matchers with BeforeAndAfterAll with BeforeAndAfterEach { var graphDb: GraphDatabaseService = null var session: Session = null diff --git a/content-api/hierarchy-manager/src/test/scala/org/sunbird/managers/TestHierarchy.scala b/content-api/hierarchy-manager/src/test/scala/org/sunbird/managers/TestHierarchy.scala index b32920743..ff32a3b0a 100644 --- a/content-api/hierarchy-manager/src/test/scala/org/sunbird/managers/TestHierarchy.scala +++ b/content-api/hierarchy-manager/src/test/scala/org/sunbird/managers/TestHierarchy.scala @@ -8,7 +8,12 @@ import org.sunbird.common.JsonUtils import org.sunbird.common.dto.Request import org.sunbird.common.exception.ClientException import org.sunbird.graph.OntologyEngineContext -import scala.collection.JavaConversions._ + +import scala.concurrent.ExecutionContext.Implicits.global +import org.scalatest.RecoverMethods.recoverToSucceededIf + +import scala.collection.JavaConverters +import scala.collection.JavaConverters._ class TestHierarchy extends BaseSpec { @@ -53,7 +58,7 @@ class TestHierarchy extends BaseSpec { request.put("rootId", "do_11283193441064550414") request.put("unitId", "do_11283193463014195215") request.put("children", util.Arrays.asList("do_11340096165525094411")) - request.put("relationalMetadata",mapAsJavaMap(Map("do_11340096165525094411" -> Map("relName" -> "Test Name RM", "keywords" -> Array("Overwriting content Keywords") )))) + request.put("relationalMetadata",JavaConverters.mapAsJavaMap(Map("do_11340096165525094411" -> Map("relName" -> "Test Name RM", "keywords" -> Array("Overwriting content Keywords") )))) request.put("mode","edit") val future = HierarchyManager.addLeafNodesToHierarchy(request) future.map(response => { diff --git a/content-api/hierarchy-manager/src/test/scala/org/sunbird/managers/TestUpdateHierarchy.scala b/content-api/hierarchy-manager/src/test/scala/org/sunbird/managers/TestUpdateHierarchy.scala index 205f71858..c6ae39093 100644 --- a/content-api/hierarchy-manager/src/test/scala/org/sunbird/managers/TestUpdateHierarchy.scala +++ b/content-api/hierarchy-manager/src/test/scala/org/sunbird/managers/TestUpdateHierarchy.scala @@ -9,6 +9,8 @@ import org.sunbird.common.dto.Request import org.sunbird.common.exception.{ClientException, ResourceNotFoundException} import org.sunbird.graph.OntologyEngineContext import org.sunbird.utils.HierarchyConstants +import scala.concurrent.ExecutionContext.Implicits.global +import org.scalatest.RecoverMethods.recoverToSucceededIf class TestUpdateHierarchy extends BaseSpec { diff --git a/content-api/pom.xml b/content-api/pom.xml index 4340d17fb..3f1830f59 100755 --- a/content-api/pom.xml +++ b/content-api/pom.xml @@ -14,7 +14,7 @@ UTF-8 UTF-8 - 2.11.12 + 2.12.21 content-service diff --git a/ontology-engine/graph-core_2.11/pom.xml b/ontology-engine/graph-core_2.11/pom.xml index 9a0f5f9b1..99128e68f 100644 --- a/ontology-engine/graph-core_2.11/pom.xml +++ b/ontology-engine/graph-core_2.11/pom.xml @@ -41,9 +41,14 @@ org.scalatest scalatest_${scala.maj.version} - 3.0.8 + 3.2.18 test + + org.scalactic + scalactic_2.12 + 3.2.18 + org.sunbird cassandra-connector @@ -54,8 +59,16 @@ neo4j-bolt - org.apache.commons - commons-lang3 + org.scalatest + scalatest_2.11 + + + org.scalactic + scalactic_2.11 + + + org.scala-lang + scala-library 3.5.0 @@ -66,12 +79,28 @@ neo4j-graphdb-api 3.5.0 test + + + org.scala-lang + scala-library + + org.neo4j neo4j 3.5.0 test + + + org.apache.commons + commons-lang3 + + + org.scala-lang + scala-library + + org.cassandraunit @@ -85,6 +114,11 @@ + + org.scala-lang + scala-library + ${scala.version} + @@ -94,7 +128,7 @@ net.alchim31.maven scala-maven-plugin - 4.4.0 + 4.8.1 ${scala.version} false diff --git a/ontology-engine/graph-core_2.11/src/test/scala/org/sunbird/graph/BaseSpec.scala b/ontology-engine/graph-core_2.11/src/test/scala/org/sunbird/graph/BaseSpec.scala index db9e90ceb..a84fbf47e 100644 --- a/ontology-engine/graph-core_2.11/src/test/scala/org/sunbird/graph/BaseSpec.scala +++ b/ontology-engine/graph-core_2.11/src/test/scala/org/sunbird/graph/BaseSpec.scala @@ -9,11 +9,13 @@ import org.neo4j.graphdb.GraphDatabaseService import org.neo4j.graphdb.factory.GraphDatabaseFactory import org.neo4j.graphdb.factory.GraphDatabaseSettings.Connector.ConnectorType import org.neo4j.kernel.configuration.BoltConnector -import org.scalatest.{AsyncFlatSpec, BeforeAndAfterAll, Matchers} +import org.scalatest.flatspec.AsyncFlatSpec +import org.scalatest.matchers.should.Matchers +import org.scalatest.BeforeAndAfterAll import org.sunbird.cassandra.CassandraConnector import org.sunbird.common.Platform -class BaseSpec extends AsyncFlatSpec with Matchers with BeforeAndAfterAll { +class BaseSpec extends AsyncFlatSpec with Matchers with BeforeAndAfterAll{ var graphDb: GraphDatabaseService = null var session: Session = null diff --git a/ontology-engine/graph-dac-api/pom.xml b/ontology-engine/graph-dac-api/pom.xml index 62669e72e..33ff34bc1 100644 --- a/ontology-engine/graph-dac-api/pom.xml +++ b/ontology-engine/graph-dac-api/pom.xml @@ -63,6 +63,20 @@ neo4j-cypher 3.5.0 test + + + org.apache.commons + commons-lang3 + + + org.scalatest + scalatest_2.11 + + + org.scalactic + scalactic_2.11 + + diff --git a/ontology-engine/graph-engine_2.11/pom.xml b/ontology-engine/graph-engine_2.11/pom.xml index a85149bf0..3da1c2899 100644 --- a/ontology-engine/graph-engine_2.11/pom.xml +++ b/ontology-engine/graph-engine_2.11/pom.xml @@ -36,11 +36,17 @@ com.twitter storehaus-cache_${scala.maj.version} 0.15.0 + + + org.scala-lang + scala-library + + org.scalatest scalatest_${scala.maj.version} - 3.0.8 + 3.2.18 test @@ -48,24 +54,51 @@ neo4j-bolt 3.5.0 test + + + org.scala-lang + scala-library + + + org.scalatest + scalatest_2.11 + + + org.scalactic + scalactic_2.11 + + org.neo4j neo4j-graphdb-api 3.5.0 test + + + org.scala-lang + scala-library + + org.neo4j neo4j 3.5.0 test + + + org.scala-lang + scala-library + + org.cassandraunit cassandra-unit 3.11.2.0 test + @@ -75,7 +108,7 @@ net.alchim31.maven scala-maven-plugin - 4.4.0 + 4.8.1 ${scala.version} false diff --git a/ontology-engine/graph-engine_2.11/src/main/scala/org/sunbird/graph/utils/NodeUtil.scala b/ontology-engine/graph-engine_2.11/src/main/scala/org/sunbird/graph/utils/NodeUtil.scala index 79c672cc9..d41a32773 100644 --- a/ontology-engine/graph-engine_2.11/src/main/scala/org/sunbird/graph/utils/NodeUtil.scala +++ b/ontology-engine/graph-engine_2.11/src/main/scala/org/sunbird/graph/utils/NodeUtil.scala @@ -164,14 +164,14 @@ object NodeUtil { "name" -> rel.getEndNodeName, "objectType" -> objectType, "relation" -> rel.getRelationType) ++ relationObjectAttributes(objectType).map(key => (key -> rel.getEndNodeMetadata.get(key))).toMap - mapAsJavaMap(relData) + relData.asJava } else { val objectType = rel.getStartNodeObjectType.replace("Image", "") val relData = Map("identifier" -> rel.getStartNodeId.replace(".img", ""), "name" -> rel.getStartNodeName, "objectType" -> objectType, "relation" -> rel.getRelationType) ++ relationObjectAttributes(objectType).map(key => (key -> rel.getStartNodeMetadata.get(key))).toMap - mapAsJavaMap(relData) + relData.asJava } } diff --git a/ontology-engine/graph-engine_2.11/src/test/scala/org/sunbird/graph/BaseSpec.scala b/ontology-engine/graph-engine_2.11/src/test/scala/org/sunbird/graph/BaseSpec.scala index 830e612c5..098161a5f 100644 --- a/ontology-engine/graph-engine_2.11/src/test/scala/org/sunbird/graph/BaseSpec.scala +++ b/ontology-engine/graph-engine_2.11/src/test/scala/org/sunbird/graph/BaseSpec.scala @@ -2,7 +2,6 @@ package org.sunbird.graph import java.io.File import java.util - import com.datastax.driver.core.Session import org.apache.commons.io.FileUtils import org.cassandraunit.utils.EmbeddedCassandraServerHelper @@ -10,13 +9,15 @@ import org.neo4j.graphdb.GraphDatabaseService import org.neo4j.graphdb.factory.GraphDatabaseFactory import org.neo4j.graphdb.factory.GraphDatabaseSettings.Connector.ConnectorType import org.neo4j.kernel.configuration.BoltConnector -import org.scalatest.{AsyncFlatSpec, BeforeAndAfterAll, Matchers} +import org.scalatest.BeforeAndAfterAll +import org.scalatest.flatspec.AnyFlatSpec +import org.scalatest.matchers.should.Matchers import org.sunbird.cassandra.CassandraConnector import org.sunbird.common.Platform import org.sunbird.graph.dac.model.Node import org.sunbird.graph.schema.FrameworkMasterCategoryMap -class BaseSpec extends AsyncFlatSpec with Matchers with BeforeAndAfterAll { +class BaseSpec extends AnyFlatSpec with Matchers with BeforeAndAfterAll { var graphDb: GraphDatabaseService = null var session: Session = null diff --git a/ontology-engine/graph-engine_2.11/src/test/scala/org/sunbird/graph/health/TestHealthCheckManager.scala b/ontology-engine/graph-engine_2.11/src/test/scala/org/sunbird/graph/health/TestHealthCheckManager.scala index 26e759a8f..7a4254812 100644 --- a/ontology-engine/graph-engine_2.11/src/test/scala/org/sunbird/graph/health/TestHealthCheckManager.scala +++ b/ontology-engine/graph-engine_2.11/src/test/scala/org/sunbird/graph/health/TestHealthCheckManager.scala @@ -4,12 +4,14 @@ import org.sunbird.common.dto.Response import org.sunbird.common.exception.ResponseCode import org.sunbird.graph.BaseSpec +import scala.concurrent.ExecutionContext.Implicits.global import scala.concurrent.Future + class TestHealthCheckManager extends BaseSpec { "check health api" should "return true" in { - val future: Future[Response] = HealthCheckManager.checkAllSystemHealth() + implicit val future: Future[Response] = HealthCheckManager.checkAllSystemHealth() future map { response => { assert(ResponseCode.OK == response.getResponseCode) assert(response.get("healthy") == true) @@ -18,7 +20,7 @@ class TestHealthCheckManager extends BaseSpec { } "check generate check with status false" should "return service unavailable map" in { - val check: Map[String, Any] = HealthCheckManager.generateCheck(false, "redis cache") + implicit val check: Map[String, Any] = HealthCheckManager.generateCheck(false, "redis cache") assert(Some(false) == check.get("healthy")) assert(Some("redis cache") == check.get("name")) assert(Some("503") == check.get("err")) diff --git a/ontology-engine/graph-engine_2.11/src/test/scala/org/sunbird/graph/nodes/TestDataNode.scala b/ontology-engine/graph-engine_2.11/src/test/scala/org/sunbird/graph/nodes/TestDataNode.scala index e8aaf9029..852731576 100644 --- a/ontology-engine/graph-engine_2.11/src/test/scala/org/sunbird/graph/nodes/TestDataNode.scala +++ b/ontology-engine/graph-engine_2.11/src/test/scala/org/sunbird/graph/nodes/TestDataNode.scala @@ -1,8 +1,8 @@ package org.sunbird.graph.nodes import java.util - import org.neo4j.graphdb.Result +import org.scalatest.RecoverMethods.recoverToSucceededIf import org.sunbird.cache.impl.RedisCache import org.sunbird.common.JsonUtils import org.sunbird.common.dto.{Request, Response, ResponseHandler} @@ -11,6 +11,7 @@ import org.sunbird.graph.BaseSpec import org.sunbird.graph.dac.model.Node import org.sunbird.graph.utils.ScalaJsonUtils +import scala.concurrent.ExecutionContext.Implicits.global import scala.concurrent.Future @@ -714,11 +715,11 @@ class TestDataNode extends BaseSpec { request.put("identifier", util.Arrays.asList("do_12345")) request.put("fields", util.Arrays.asList()) val future: Future[List[Node]] = DataNode.search(request) - future map { nodeList => { + + future.map { nodeList => assert(nodeList.length == 1) assert(nodeList.head.getIdentifier.equalsIgnoreCase("do_12345")) } - } flatMap (f => f) } "search" should "throw Exception for invalid identifier" in { diff --git a/ontology-engine/graph-engine_2.11/src/test/scala/org/sunbird/graph/schema/TestObjectCategoryDefinitionMap.scala b/ontology-engine/graph-engine_2.11/src/test/scala/org/sunbird/graph/schema/TestObjectCategoryDefinitionMap.scala index e73483caa..8550bac8c 100644 --- a/ontology-engine/graph-engine_2.11/src/test/scala/org/sunbird/graph/schema/TestObjectCategoryDefinitionMap.scala +++ b/ontology-engine/graph-engine_2.11/src/test/scala/org/sunbird/graph/schema/TestObjectCategoryDefinitionMap.scala @@ -1,5 +1,7 @@ package org.sunbird.graph.schema +import org.scalactic.Prettifier.default +import org.scalatest.matchers.should.Matchers.convertToAnyShouldWrapper import org.sunbird.graph.BaseSpec class TestObjectCategoryDefinitionMap extends BaseSpec { diff --git a/ontology-engine/graph-engine_2.11/src/test/scala/org/sunbird/graph/schema/validator/TestSchemaValidator.scala b/ontology-engine/graph-engine_2.11/src/test/scala/org/sunbird/graph/schema/validator/TestSchemaValidator.scala index d63a3f395..2804da1b8 100644 --- a/ontology-engine/graph-engine_2.11/src/test/scala/org/sunbird/graph/schema/validator/TestSchemaValidator.scala +++ b/ontology-engine/graph-engine_2.11/src/test/scala/org/sunbird/graph/schema/validator/TestSchemaValidator.scala @@ -5,6 +5,7 @@ import java.util import org.sunbird.graph.BaseSpec import org.sunbird.graph.dac.model.Node import org.sunbird.graph.schema.DefinitionFactory +import scala.concurrent.ExecutionContext.Implicits.global import scala.concurrent.Future @@ -45,7 +46,7 @@ class TestSchemaValidator extends BaseSpec { node.setGraphId("domain") node.setMetadata(metaData) - val future: Future[Node] = definition.validate(node, "create") + implicit val future: Future[Node] = definition.validate(node, "create") future map { node => assert(null != node) } } } diff --git a/ontology-engine/graph-engine_2.11/src/test/scala/org/sunbird/graph/utils/NodeUtilTest.scala b/ontology-engine/graph-engine_2.11/src/test/scala/org/sunbird/graph/utils/NodeUtilTest.scala index 7a5fb5241..87780f81e 100644 --- a/ontology-engine/graph-engine_2.11/src/test/scala/org/sunbird/graph/utils/NodeUtilTest.scala +++ b/ontology-engine/graph-engine_2.11/src/test/scala/org/sunbird/graph/utils/NodeUtilTest.scala @@ -2,13 +2,16 @@ package org.sunbird.graph.utils import java.util -import org.scalatest.{FlatSpec, Matchers} +import org.scalatest.flatspec.AnyFlatSpec +import org.scalatest.matchers.should.Matchers import org.sunbird.graph.OntologyEngineContext import org.sunbird.graph.dac.model.Node +import org.scalatest.matchers.should.Matchers +import org.scalatest.flatspec.AnyFlatSpec import scala.concurrent.ExecutionContext -class NodeUtilTest extends FlatSpec with Matchers { +class NodeUtilTest extends AnyFlatSpec with Matchers { implicit val oec: OntologyEngineContext = new OntologyEngineContext implicit val ec: ExecutionContext = ExecutionContext.global diff --git a/ontology-engine/graph-engine_2.11/src/test/scala/org/sunbird/graph/utils/ScalaJsonUtilsTest.scala b/ontology-engine/graph-engine_2.11/src/test/scala/org/sunbird/graph/utils/ScalaJsonUtilsTest.scala index 8cc1ce192..d7f70a562 100644 --- a/ontology-engine/graph-engine_2.11/src/test/scala/org/sunbird/graph/utils/ScalaJsonUtilsTest.scala +++ b/ontology-engine/graph-engine_2.11/src/test/scala/org/sunbird/graph/utils/ScalaJsonUtilsTest.scala @@ -5,9 +5,11 @@ import java.util import com.fasterxml.jackson.databind.exc.{InvalidDefinitionException, MismatchedInputException} import org.apache.commons.lang3.StringUtils import org.codehaus.jackson.JsonProcessingException -import org.scalatest.{FlatSpec, Matchers} +import org.scalatest.matchers.should.Matchers +import org.scalatest.flatspec.AnyFlatSpec -class ScalaJsonUtilsTest extends FlatSpec with Matchers { + +class ScalaJsonUtilsTest extends AnyFlatSpec with Matchers { "serializing an empty object" should "Throw InvalidDefinitionException" in { assertThrows[InvalidDefinitionException] { // Result type: Assertion diff --git a/ontology-engine/parseq/pom.xml b/ontology-engine/parseq/pom.xml index 781dd655a..61d5eb026 100644 --- a/ontology-engine/parseq/pom.xml +++ b/ontology-engine/parseq/pom.xml @@ -26,7 +26,7 @@ net.alchim31.maven scala-maven-plugin - 4.4.0 + 4.8.1 ${scala.version} false diff --git a/platform-core/kafka-client/pom.xml b/platform-core/kafka-client/pom.xml index 3bb49cd4b..2c619ad25 100644 --- a/platform-core/kafka-client/pom.xml +++ b/platform-core/kafka-client/pom.xml @@ -38,7 +38,7 @@ org.scalatest scalatest_${scala.maj.version} - 3.0.8 + 3.2.18 test @@ -56,7 +56,7 @@ net.alchim31.maven scala-maven-plugin - 4.4.0 + 4.8.1 ${scala.version} false diff --git a/platform-core/kafka-client/src/test/scala/org/sunbird/kafka/test/BaseTest.scala b/platform-core/kafka-client/src/test/scala/org/sunbird/kafka/test/BaseTest.scala index aae895d3f..51479fe75 100644 --- a/platform-core/kafka-client/src/test/scala/org/sunbird/kafka/test/BaseTest.scala +++ b/platform-core/kafka-client/src/test/scala/org/sunbird/kafka/test/BaseTest.scala @@ -1,9 +1,11 @@ package org.sunbird.kafka.test import net.manub.embeddedkafka.{EmbeddedKafka, EmbeddedKafkaConfig} -import org.scalatest.{BeforeAndAfterAll, FlatSpec, Matchers} +import org.scalatest.flatspec.AnyFlatSpec +import org.scalatest.BeforeAndAfterAll +import org.scalatest.matchers.should.Matchers -class BaseTest extends FlatSpec with Matchers with BeforeAndAfterAll with EmbeddedKafka { +class BaseTest extends AnyFlatSpec with Matchers with BeforeAndAfterAll with EmbeddedKafka { implicit val config = EmbeddedKafkaConfig(kafkaPort = 9092) diff --git a/platform-core/platform-cache/pom.xml b/platform-core/platform-cache/pom.xml index 4238e298c..d69607988 100644 --- a/platform-core/platform-cache/pom.xml +++ b/platform-core/platform-cache/pom.xml @@ -38,7 +38,7 @@ org.scalatest scalatest_${scala.maj.version} - 3.1.2 + 3.2.18 test diff --git a/platform-core/platform-cache/src/test/scala/org/sunbird/cache/impl/RedisCacheTest.scala b/platform-core/platform-cache/src/test/scala/org/sunbird/cache/impl/RedisCacheTest.scala index 212a515d4..d9b7376a7 100644 --- a/platform-core/platform-cache/src/test/scala/org/sunbird/cache/impl/RedisCacheTest.scala +++ b/platform-core/platform-cache/src/test/scala/org/sunbird/cache/impl/RedisCacheTest.scala @@ -1,12 +1,15 @@ package org.sunbird.cache.impl -import org.scalatest.{AsyncFlatSpec, BeforeAndAfterAll, Matchers} +import org.scalatest.flatspec.AnyFlatSpec +import org.scalatest.BeforeAndAfterAll +import org.scalatest.matchers.should.Matchers import scala.collection.immutable.Stream.Empty import scala.concurrent.Future +import scala.concurrent.ExecutionContext.Implicits.global -class RedisCacheTest extends AsyncFlatSpec with Matchers with BeforeAndAfterAll { +class RedisCacheTest extends AnyFlatSpec with Matchers with BeforeAndAfterAll { var cons_message: String = "" diff --git a/platform-core/platform-common/pom.xml b/platform-core/platform-common/pom.xml index fbfc44f9d..73e45a709 100644 --- a/platform-core/platform-common/pom.xml +++ b/platform-core/platform-common/pom.xml @@ -99,7 +99,7 @@ org.jacoco jacoco-maven-plugin - 0.8.5 + 0.8.11 default-prepare-agent diff --git a/platform-core/schema-validator/pom.xml b/platform-core/schema-validator/pom.xml index 42ebafdfb..5fe5150a0 100644 --- a/platform-core/schema-validator/pom.xml +++ b/platform-core/schema-validator/pom.xml @@ -60,7 +60,7 @@ org.jacoco jacoco-maven-plugin - 0.8.5 + 0.8.11 default-prepare-agent diff --git a/platform-core/schema-validator/src/test/java/org/sunbird/schema/impl/TestBaseSchemaValidator.java b/platform-core/schema-validator/src/test/java/org/sunbird/schema/impl/TestBaseSchemaValidator.java index d72b11025..82afea416 100644 --- a/platform-core/schema-validator/src/test/java/org/sunbird/schema/impl/TestBaseSchemaValidator.java +++ b/platform-core/schema-validator/src/test/java/org/sunbird/schema/impl/TestBaseSchemaValidator.java @@ -12,8 +12,8 @@ import org.mockito.Mockito; import org.mockito.MockitoAnnotations; +import org.mockito.internal.util.reflection.Whitebox; import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.reflect.Whitebox; import org.sunbird.schema.ISchemaValidator; import org.sunbird.schema.SchemaValidatorFactory; import org.sunbird.schema.dto.ValidationResult; diff --git a/platform-modules/import-manager/pom.xml b/platform-modules/import-manager/pom.xml index 13c5fa70c..496c863c6 100644 --- a/platform-modules/import-manager/pom.xml +++ b/platform-modules/import-manager/pom.xml @@ -41,13 +41,13 @@ org.scalatest scalatest_${scala.maj.version} - 3.0.8 + 3.2.18 test org.scalamock scalamock_${scala.maj.version} - 4.4.0 + 5.2.0 test @@ -59,7 +59,7 @@ net.alchim31.maven scala-maven-plugin - 4.4.0 + 4.8.1 ${scala.version} false diff --git a/platform-modules/import-manager/src/test/scala/org/sunbird/object/importer/ImportManagerTest.scala b/platform-modules/import-manager/src/test/scala/org/sunbird/object/importer/ImportManagerTest.scala index 8cf27c05b..b545a6d6c 100644 --- a/platform-modules/import-manager/src/test/scala/org/sunbird/object/importer/ImportManagerTest.scala +++ b/platform-modules/import-manager/src/test/scala/org/sunbird/object/importer/ImportManagerTest.scala @@ -3,18 +3,18 @@ package org.sunbird.`object`.importer import java.util import org.apache.commons.collections4.{CollectionUtils, MapUtils} import org.apache.commons.lang3.{BooleanUtils, StringUtils} -import org.scalatest.AsyncFlatSpec -import org.scalamock.matchers.Matchers -import org.scalamock.scalatest.AsyncMockFactory import org.sunbird.common.{HttpUtil, JsonUtils} import org.sunbird.common.dto.{Request, Response, ResponseHandler} import org.sunbird.common.exception.ClientException import org.sunbird.graph.OntologyEngineContext import org.sunbird.kafka.client.KafkaClient - +import org.scalatest.flatspec.AnyFlatSpec +import org.scalatest.matchers.should.Matchers +import org.scalamock.scalatest.MockFactory +import scala.concurrent.ExecutionContext.Implicits.global import scala.collection.JavaConverters._ -class ImportManagerTest extends AsyncFlatSpec with Matchers with AsyncMockFactory { +class ImportManagerTest extends AnyFlatSpec with Matchers with MockFactory { implicit val oec: OntologyEngineContext = mock[OntologyEngineContext] val REQUEST_LIMIT = 300 diff --git a/platform-modules/mimetype-manager/pom.xml b/platform-modules/mimetype-manager/pom.xml index a7a80d411..e1f492e26 100644 --- a/platform-modules/mimetype-manager/pom.xml +++ b/platform-modules/mimetype-manager/pom.xml @@ -10,8 +10,8 @@ 4.0.0 mimetype-manager - 2.11 - 2.7.2 + 2.12 + 2.7.9 @@ -93,7 +93,7 @@ net.alchim31.maven scala-maven-plugin - 4.4.0 + 4.8.1 ${scala.version} false diff --git a/pom.xml b/pom.xml index f3f14193a..fb5740fe8 100644 --- a/pom.xml +++ b/pom.xml @@ -12,10 +12,11 @@ UTF-8 1.4.1 - 2.11 - 2.11.12 - 3.0.8 + 2.12 + 2.12.21 + 3.2.18 2.9.8 + true platform-core diff --git a/search-api/pom.xml b/search-api/pom.xml index 0ffe3c713..95915182b 100644 --- a/search-api/pom.xml +++ b/search-api/pom.xml @@ -11,7 +11,7 @@ UTF-8 UTF-8 - 2.11 + 2.12 search-api diff --git a/search-api/search-core/pom.xml b/search-api/search-core/pom.xml index a68a641e4..c45578b06 100644 --- a/search-api/search-core/pom.xml +++ b/search-api/search-core/pom.xml @@ -13,8 +13,8 @@ UTF-8 - 2.5.22 - 2.11 + 2.5.31 + 2.12 diff --git a/search-api/search-service/app/controllers/SearchBaseController.scala b/search-api/search-service/app/controllers/SearchBaseController.scala index 5938c93ac..72615afdf 100644 --- a/search-api/search-service/app/controllers/SearchBaseController.scala +++ b/search-api/search-service/app/controllers/SearchBaseController.scala @@ -12,6 +12,7 @@ import play.api.mvc._ import java.util import java.util.UUID import scala.collection.JavaConversions._ +import scala.collection.JavaConverters import scala.concurrent.{ExecutionContext, Future} abstract class SearchBaseController(protected val cc: ControllerComponents)(implicit exec: ExecutionContext) extends AbstractController(cc) { @@ -34,7 +35,7 @@ abstract class SearchBaseController(protected val cc: ControllerComponents)(impl appHeaders else appHeaders + ("CHANNEL_ID"-> DEFAULT_CHANNEL_ID) } - mapAsJavaMap(contextMap) + JavaConverters.mapAsJavaMap(contextMap) } def getRequest(input: java.util.Map[String, AnyRef], context: java.util.Map[String, AnyRef], operation: String): org.sunbird.common.dto.Request = { diff --git a/search-api/search-service/pom.xml b/search-api/search-service/pom.xml index 10a883e4a..05cfba19f 100644 --- a/search-api/search-service/pom.xml +++ b/search-api/search-service/pom.xml @@ -34,7 +34,7 @@ - 2.7.2 + 2.7.9 1.0.0-rc5 1.0.0 @@ -87,7 +87,7 @@ org.scalatest scalatest_${scala.maj.version} - 3.1.2 + 3.2.18 test diff --git a/taxonomy-api/pom.xml b/taxonomy-api/pom.xml index f0c74ceaf..021ae730a 100644 --- a/taxonomy-api/pom.xml +++ b/taxonomy-api/pom.xml @@ -19,7 +19,7 @@ UTF-8 UTF-8 - 2.11 + 2.12 diff --git a/taxonomy-api/taxonomy-actors/pom.xml b/taxonomy-api/taxonomy-actors/pom.xml index e4fb38295..9f2d6c47c 100644 --- a/taxonomy-api/taxonomy-actors/pom.xml +++ b/taxonomy-api/taxonomy-actors/pom.xml @@ -30,7 +30,7 @@ org.scalatest scalatest_${scala.maj.version} - 3.0.8 + 3.2.18 test @@ -54,7 +54,7 @@ net.alchim31.maven scala-maven-plugin - 4.4.0 + 4.8.1 ${scala.version} false diff --git a/taxonomy-api/taxonomy-actors/src/test/scala/org/sunbird/actors/BaseSpec.scala b/taxonomy-api/taxonomy-actors/src/test/scala/org/sunbird/actors/BaseSpec.scala index 3c7b95d98..a9d2f6226 100644 --- a/taxonomy-api/taxonomy-actors/src/test/scala/org/sunbird/actors/BaseSpec.scala +++ b/taxonomy-api/taxonomy-actors/src/test/scala/org/sunbird/actors/BaseSpec.scala @@ -2,17 +2,17 @@ package org.sunbird.actors import java.util import java.util.concurrent.TimeUnit - import akka.actor.{ActorSystem, Props} import akka.testkit.TestKit -import org.scalatest.{FlatSpec, Matchers} +import org.scalatest.flatspec.AnyFlatSpec +import org.scalatest.matchers.should.Matchers import org.sunbird.common.dto.{Request, Response} import org.sunbird.graph.OntologyEngineContext import org.sunbird.graph.dac.model.Node import scala.concurrent.duration.FiniteDuration -class BaseSpec extends FlatSpec with Matchers { +class BaseSpec extends AnyFlatSpec with Matchers { val system = ActorSystem.create("system") diff --git a/taxonomy-api/taxonomy-service/pom.xml b/taxonomy-api/taxonomy-service/pom.xml index 57c2f7c74..38bb06afc 100644 --- a/taxonomy-api/taxonomy-service/pom.xml +++ b/taxonomy-api/taxonomy-service/pom.xml @@ -31,7 +31,7 @@ - 2.7.2 + 2.7.9 1.0.0-rc5 1.0.0 @@ -78,7 +78,7 @@ org.scalatest scalatest_${scala.maj.version} - 3.1.2 + 3.2.18 test From 83865211cd8196d7fb0cd64bcdcace0d59f8ef37 Mon Sep 17 00:00:00 2001 From: ramyaranganathan-1775 Date: Mon, 20 Apr 2026 16:38:12 +0530 Subject: [PATCH 2/5] Cbrelease 4.8.35 (#200) * KB-13035 : Update build configuration for scala 2.12.21 for assessment service,content service, search service, taxonomy service * KB-13035 : Update build configuration for scala 2.12.21 for assessment service,content service, search service, taxonomy service * KB-13035 : Update build configuration for scala 2.12.21 for assessment service,content service, search service, taxonomy service * KB-13035 : Update build configuration for scala 2.12.21 for assessment service,content service, search service, taxonomy service- revert directory rename * KB-13035 : Update build configuration for scala 2.12.21 for assessment service,content service, search service, taxonomy service- revert directory rename * KB-13035 : Update build configuration for scala 2.12.21 - code review changes * KB-13035 : Update build configuration for scala 2.12.21 - code review changes * KB-13035 : Update build configuration for scala/ akka version change --- platform-core/actor-core/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform-core/actor-core/pom.xml b/platform-core/actor-core/pom.xml index 1eee0fb0f..a703d975f 100644 --- a/platform-core/actor-core/pom.xml +++ b/platform-core/actor-core/pom.xml @@ -12,7 +12,7 @@ actor-core - 2.5.22 + 2.5.31 From 8de727a3a109a2a87dd03461ee108e0d6c30b4ad Mon Sep 17 00:00:00 2001 From: ramyaranganathan-1775 Date: Tue, 21 Apr 2026 15:02:32 +0530 Subject: [PATCH 3/5] Cbrelease 4.8.35 (#201) * KB-13035 : Update build configuration for scala 2.12.21 for assessment service,content service, search service, taxonomy service * KB-13035 : Update build configuration for scala 2.12.21 for assessment service,content service, search service, taxonomy service * KB-13035 : Update build configuration for scala 2.12.21 for assessment service,content service, search service, taxonomy service * KB-13035 : Update build configuration for scala 2.12.21 for assessment service,content service, search service, taxonomy service- revert directory rename * KB-13035 : Update build configuration for scala 2.12.21 for assessment service,content service, search service, taxonomy service- revert directory rename * KB-13035 : Update build configuration for scala 2.12.21 - code review changes * KB-13035 : Update build configuration for scala 2.12.21 - code review changes * KB-13035 : Update build configuration for scala/ akka version change * KB-13035 : Update build configuration for scala/ cloud sdk version change --- platform-modules/mimetype-manager/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform-modules/mimetype-manager/pom.xml b/platform-modules/mimetype-manager/pom.xml index e1f492e26..6945a2362 100644 --- a/platform-modules/mimetype-manager/pom.xml +++ b/platform-modules/mimetype-manager/pom.xml @@ -29,7 +29,7 @@ net.karmayogibharat - cloud-store-sdk_2.11 + cloud-store-sdk_2.12 1.4.6 From 4f2339405d9913f2f817cb83cce6a895ee7c0f44 Mon Sep 17 00:00:00 2001 From: ramyaranganathan-1775 Date: Tue, 21 Apr 2026 18:34:49 +0530 Subject: [PATCH 4/5] Cbrelease 4.8.35 (#202) * KB-13035 : Update build configuration for scala 2.12.21 for assessment service,content service, search service, taxonomy service * KB-13035 : Update build configuration for scala 2.12.21 for assessment service,content service, search service, taxonomy service * KB-13035 : Update build configuration for scala 2.12.21 for assessment service,content service, search service, taxonomy service * KB-13035 : Update build configuration for scala 2.12.21 for assessment service,content service, search service, taxonomy service- revert directory rename * KB-13035 : Update build configuration for scala 2.12.21 for assessment service,content service, search service, taxonomy service- revert directory rename * KB-13035 : Update build configuration for scala 2.12.21 - code review changes * KB-13035 : Update build configuration for scala 2.12.21 - code review changes * KB-13035 : Update build configuration for scala/ akka version change * KB-13035 : Update build configuration for scala/ cloud sdk version change * KB-13035 : Update build configuration for scala/ cloud sdk version change * KB-13035 : Update build configuration for scala/ cloud sdk version change --- assessment-api/assessment-service/pom.xml | 16 ++++++++++++++ content-api/content-service/pom.xml | 12 ++++++++++ ontology-engine/graph-core_2.11/pom.xml | 5 ----- platform-core/actor-core/pom.xml | 10 +++++++++ pom.xml | 4 ++-- search-api/search-service/pom.xml | 27 +++++++++++++++++++++++ taxonomy-api/taxonomy-service/pom.xml | 27 +++++++++++++++++++++++ 7 files changed, 94 insertions(+), 7 deletions(-) diff --git a/assessment-api/assessment-service/pom.xml b/assessment-api/assessment-service/pom.xml index f00cb149c..4d2021162 100644 --- a/assessment-api/assessment-service/pom.xml +++ b/assessment-api/assessment-service/pom.xml @@ -61,6 +61,22 @@ guava com.google.guava + + com.fasterxml.jackson.core + jackson-core + + + com.fasterxml.jackson.core + jackson-databind + + + com.fasterxml.jackson.core + jackson-annotations + + + com.fasterxml.jackson.dataformat + jackson-dataformat-yaml + diff --git a/content-api/content-service/pom.xml b/content-api/content-service/pom.xml index fff732413..d6491ea1d 100755 --- a/content-api/content-service/pom.xml +++ b/content-api/content-service/pom.xml @@ -60,6 +60,18 @@ guava com.google.guava + + com.fasterxml.jackson.core + jackson-core + + + com.fasterxml.jackson.core + jackson-databind + + + com.fasterxml.jackson.core + jackson-annotations + diff --git a/ontology-engine/graph-core_2.11/pom.xml b/ontology-engine/graph-core_2.11/pom.xml index 99128e68f..9ae182bc5 100644 --- a/ontology-engine/graph-core_2.11/pom.xml +++ b/ontology-engine/graph-core_2.11/pom.xml @@ -114,11 +114,6 @@ - - org.scala-lang - scala-library - ${scala.version} - diff --git a/platform-core/actor-core/pom.xml b/platform-core/actor-core/pom.xml index a703d975f..7f0a4b226 100644 --- a/platform-core/actor-core/pom.xml +++ b/platform-core/actor-core/pom.xml @@ -31,6 +31,16 @@ akka-slf4j_${scala.maj.version} ${typesafe.akka.version} + + com.typesafe.akka + akka-stream_${scala.maj.version} + ${typesafe.akka.version} + + + com.typesafe.akka + akka-protobuf_${scala.maj.version} + ${typesafe.akka.version} + org.reflections reflections diff --git a/pom.xml b/pom.xml index fb5740fe8..5c754e5b6 100644 --- a/pom.xml +++ b/pom.xml @@ -15,8 +15,8 @@ 2.12 2.12.21 3.2.18 - 2.9.8 - true + 2.15.2 + platform-core diff --git a/search-api/search-service/pom.xml b/search-api/search-service/pom.xml index 05cfba19f..8ad924078 100644 --- a/search-api/search-service/pom.xml +++ b/search-api/search-service/pom.xml @@ -40,10 +40,37 @@ + + com.google.guava + guava + 18.0 + com.typesafe.play play_${scala.major.version} ${play2.version} + + + guava + com.google.guava + + + com.fasterxml.jackson.core + jackson-core + + + com.fasterxml.jackson.core + jackson-databind + + + com.fasterxml.jackson.core + jackson-annotations + + + com.fasterxml.jackson.dataformat + jackson-dataformat-yaml + + com.typesafe.play diff --git a/taxonomy-api/taxonomy-service/pom.xml b/taxonomy-api/taxonomy-service/pom.xml index 38bb06afc..bf26218dd 100644 --- a/taxonomy-api/taxonomy-service/pom.xml +++ b/taxonomy-api/taxonomy-service/pom.xml @@ -37,10 +37,37 @@ + + com.google.guava + guava + 18.0 + com.typesafe.play play_${scala.major.version} ${play2.version} + + + guava + com.google.guava + + + com.fasterxml.jackson.core + jackson-core + + + com.fasterxml.jackson.core + jackson-databind + + + com.fasterxml.jackson.core + jackson-annotations + + + com.fasterxml.jackson.dataformat + jackson-dataformat-yaml + + com.typesafe.play From c2d853930686ac7f57d1954b1cb15eb1c67245d6 Mon Sep 17 00:00:00 2001 From: ramyaranganathan-1775 Date: Mon, 4 May 2026 15:59:06 +0530 Subject: [PATCH 5/5] scala version upgrade - search service & taxonomy service (#204) * KB-13035 : Update build configuration for scala 2.12.21 for assessment service,content service, search service, taxonomy service * KB-13035 : Update build configuration for scala 2.12.21 for assessment service,content service, search service, taxonomy service * KB-13035 : Update build configuration for scala 2.12.21 for assessment service,content service, search service, taxonomy service * KB-13035 : Update build configuration for scala 2.12.21 for assessment service,content service, search service, taxonomy service- revert directory rename * KB-13035 : Update build configuration for scala 2.12.21 for assessment service,content service, search service, taxonomy service- revert directory rename * KB-13035 : Update build configuration for scala 2.12.21 - code review changes * KB-13035 : Update build configuration for scala 2.12.21 - code review changes * KB-13035 : Update build configuration for scala/ akka version change * KB-13035 : Update build configuration for scala/ cloud sdk version change * KB-13035 : Update build configuration for scala/ cloud sdk version change * KB-13035 : Update build configuration for scala/ cloud sdk version change * KB-13035 : Update build configuration for scala-jackson dependency update --- search-api/search-service/pom.xml | 31 ++++++++++++++++++++++++++- taxonomy-api/taxonomy-service/pom.xml | 19 +++++++++++++++- 2 files changed, 48 insertions(+), 2 deletions(-) diff --git a/search-api/search-service/pom.xml b/search-api/search-service/pom.xml index 8ad924078..8694c7746 100644 --- a/search-api/search-service/pom.xml +++ b/search-api/search-service/pom.xml @@ -43,7 +43,7 @@ com.google.guava guava - 18.0 + 30.1-jre com.typesafe.play @@ -70,12 +70,27 @@ com.fasterxml.jackson.dataformat jackson-dataformat-yaml + + slf4j-api + org.slf4j + com.typesafe.play play-guice_${scala.major.version} ${play2.version} + + + com.google.inject + guice + + + + + com.google.inject + guice + 5.1.0 com.typesafe.play @@ -87,6 +102,12 @@ play-logback_${scala.major.version} ${play2.version} runtime + + + slf4j-api + org.slf4j + + com.typesafe.play @@ -199,6 +220,14 @@ + + org.apache.maven.plugins + maven-compiler-plugin + + 8 + 8 + + diff --git a/taxonomy-api/taxonomy-service/pom.xml b/taxonomy-api/taxonomy-service/pom.xml index bf26218dd..4a3877772 100644 --- a/taxonomy-api/taxonomy-service/pom.xml +++ b/taxonomy-api/taxonomy-service/pom.xml @@ -40,7 +40,7 @@ com.google.guava guava - 18.0 + 30.1-jre com.typesafe.play @@ -73,6 +73,17 @@ com.typesafe.play play-guice_${scala.major.version} ${play2.version} + + + com.google.inject + guice + + + + + com.google.inject + guice + 5.1.0 com.typesafe.play @@ -84,6 +95,12 @@ play-logback_${scala.major.version} ${play2.version} runtime + + + slf4j-api + org.slf4j + + com.typesafe.play