Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Register
Sign in
Toggle navigation
Menu
UPSMF
sunbird-lms-service
Commits
deb089e9
Unverified
Commit
deb089e9
authored
3 years ago
by
reshmi-nair
Committed by
GitHub
3 years ago
Browse files
Options
Download
Patches
Plain Diff
SB-26289 Org create and update API is failing while updating org location (#917)
parent
b7e01931
release-4.2.0
release-4.2.0_RC13
release-4.2.0_RC12
release-4.2.0_RC11
release-4.2.0_RC10
release-4.2.0_RC9
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
service/src/main/java/org/sunbird/actor/organisation/validator/OrganisationRequestValidator.java
+2
-0
.../organisation/validator/OrganisationRequestValidator.java
service/src/test/java/org/sunbird/actor/organisation/OrganisationRequestValidatorTest.java
+34
-14
.../actor/organisation/OrganisationRequestValidatorTest.java
with
36 additions
and
14 deletions
+36
-14
service/src/main/java/org/sunbird/actor/organisation/validator/OrganisationRequestValidator.java
+
2
−
0
View file @
deb089e9
...
...
@@ -168,6 +168,8 @@ public class OrganisationRequestValidator {
locList
=
validator
.
getValidatedLocationIds
(
finalLocList
,
context
);
}
}
else
{
locList
=
finalLocList
;
}
}
List
<
String
>
locationIdsList
=
...
...
This diff is collapsed.
Click to expand it.
service/src/test/java/org/sunbird/actor/organisation/OrganisationRequestValidatorTest.java
+
34
−
14
View file @
deb089e9
...
...
@@ -95,19 +95,6 @@ public class OrganisationRequestValidatorTest {
validator
.
validateOrgLocation
(
requestMap
,
new
RequestContext
());
}
@Test
public
void
validateOrgLocationWithOrgLocationTest
()
{
OrganisationRequestValidator
validator
=
new
OrganisationRequestValidator
();
List
codeList
=
getOrgLocationLists
();
Map
requestMap
=
new
HashMap
<
String
,
Object
>();
requestMap
.
put
(
JsonKey
.
ORG_LOCATION
,
codeList
);
try
{
validator
.
validateOrgLocation
(
requestMap
,
new
RequestContext
());
}
catch
(
ProjectCommonException
ex
)
{
Assert
.
assertNotNull
(
ex
);
Assert
.
assertEquals
(
ex
.
getCode
(),
ResponseCode
.
invalidParameterValue
.
getErrorCode
());
}
}
@Test
public
void
validateChannelInvalidChannelTest
(){
...
...
@@ -135,6 +122,27 @@ public class OrganisationRequestValidatorTest {
Assert
.
assertEquals
(
ex
.
getCode
(),
ResponseCode
.
errorInactiveOrg
.
getErrorCode
());
}
}
@Test
public
void
validateOrgLocationWithInvalidOrgLocationTest
()
{
OrganisationRequestValidator
validator
=
new
OrganisationRequestValidator
();
List
codeList
=
getInvalidOrgLocationLists
();
Map
requestMap
=
new
HashMap
<
String
,
Object
>();
requestMap
.
put
(
JsonKey
.
ORG_LOCATION
,
codeList
);
try
{
validator
.
validateOrgLocation
(
requestMap
,
new
RequestContext
());
}
catch
(
ProjectCommonException
ex
)
{
Assert
.
assertNotNull
(
ex
);
Assert
.
assertEquals
(
ex
.
getCode
(),
ResponseCode
.
invalidParameterValue
.
getErrorCode
());
}
}
@Test
public
void
validateOrgLocationWithOrgLocationTest
()
{
OrganisationRequestValidator
validator
=
new
OrganisationRequestValidator
();
List
codeList
=
getOrgLocationLists
();
Map
requestMap
=
new
HashMap
<
String
,
Object
>();
requestMap
.
put
(
JsonKey
.
ORG_LOCATION
,
codeList
);
validator
.
validateOrgLocation
(
requestMap
,
new
RequestContext
());
}
public
static
List
<
String
>
getLocationIdsLists
()
{
List
<
String
>
locationIds
=
new
ArrayList
<>();
locationIds
.
add
(
"location1"
);
...
...
@@ -147,7 +155,19 @@ public class OrganisationRequestValidatorTest {
locationCodes
.
add
(
"code2"
);
return
locationCodes
;
}
public
static
List
<
Map
<
String
,
String
>>
getInvalidOrgLocationLists
()
{
List
<
Map
<
String
,
String
>>
locationCodes
=
new
ArrayList
<>();
Map
map
=
new
HashMap
<
String
,
Object
>();
map
.
put
(
JsonKey
.
ID
,
"location3"
);
map
.
put
(
JsonKey
.
TYPE
,
"state"
);
locationCodes
.
add
(
map
);
Map
map1
=
new
HashMap
<
String
,
Object
>();
map1
.
put
(
JsonKey
.
ID
,
"location5"
);
map1
.
put
(
JsonKey
.
TYPE
,
"district"
);
map1
.
put
(
JsonKey
.
PARENT_ID
,
"location4"
);
locationCodes
.
add
(
map1
);
return
locationCodes
;
}
public
static
List
<
Map
<
String
,
String
>>
getOrgLocationLists
()
{
List
<
Map
<
String
,
String
>>
locationCodes
=
new
ArrayList
<>();
Map
map
=
new
HashMap
<
String
,
Object
>();
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets