Skip to content

Commit

Permalink
feat: remove RelationshipController and related methods
Browse files Browse the repository at this point in the history
  • Loading branch information
giulia-tremolada committed May 8, 2024
1 parent c3c56de commit f1a7860
Show file tree
Hide file tree
Showing 10 changed files with 0 additions and 605 deletions.
168 changes: 0 additions & 168 deletions app/src/main/resources/swagger/api-docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -2151,174 +2151,6 @@
} ]
}
},
"/v1/relationships/{relationshipId}" : {
"delete" : {
"tags" : [ "relationships" ],
"summary" : "deleteRelationshipById",
"description" : "Delete the relationship",
"operationId" : "deleteRelationshipByIdUsingDELETE",
"parameters" : [ {
"name" : "relationshipId",
"in" : "path",
"description" : "Unique relationship identifier between User and Product",
"required" : true,
"style" : "simple",
"schema" : {
"type" : "string"
}
} ],
"responses" : {
"204" : {
"description" : "No Content"
},
"400" : {
"description" : "Bad Request",
"content" : {
"application/problem+json" : {
"schema" : {
"$ref" : "#/components/schemas/Problem"
}
}
}
},
"401" : {
"description" : "Unauthorized",
"content" : {
"application/problem+json" : {
"schema" : {
"$ref" : "#/components/schemas/Problem"
}
}
}
},
"500" : {
"description" : "Internal Server Error",
"content" : {
"application/problem+json" : {
"schema" : {
"$ref" : "#/components/schemas/Problem"
}
}
}
}
},
"security" : [ {
"bearerAuth" : [ "global" ]
} ]
}
},
"/v1/relationships/{relationshipId}/activate" : {
"post" : {
"tags" : [ "relationships" ],
"summary" : "activateRelationship",
"description" : "Activate the relationship",
"operationId" : "activateRelationshipUsingPOST",
"parameters" : [ {
"name" : "relationshipId",
"in" : "path",
"description" : "Unique relationship identifier between User and Product",
"required" : true,
"style" : "simple",
"schema" : {
"type" : "string"
}
} ],
"responses" : {
"204" : {
"description" : "No Content"
},
"400" : {
"description" : "Bad Request",
"content" : {
"application/problem+json" : {
"schema" : {
"$ref" : "#/components/schemas/Problem"
}
}
}
},
"401" : {
"description" : "Unauthorized",
"content" : {
"application/problem+json" : {
"schema" : {
"$ref" : "#/components/schemas/Problem"
}
}
}
},
"500" : {
"description" : "Internal Server Error",
"content" : {
"application/problem+json" : {
"schema" : {
"$ref" : "#/components/schemas/Problem"
}
}
}
}
},
"security" : [ {
"bearerAuth" : [ "global" ]
} ]
}
},
"/v1/relationships/{relationshipId}/suspend" : {
"post" : {
"tags" : [ "relationships" ],
"summary" : "suspendRelationship",
"description" : "Suspend the relationship",
"operationId" : "suspendRelationshipUsingPOST",
"parameters" : [ {
"name" : "relationshipId",
"in" : "path",
"description" : "Unique relationship identifier between User and Product",
"required" : true,
"style" : "simple",
"schema" : {
"type" : "string"
}
} ],
"responses" : {
"204" : {
"description" : "No Content"
},
"400" : {
"description" : "Bad Request",
"content" : {
"application/problem+json" : {
"schema" : {
"$ref" : "#/components/schemas/Problem"
}
}
}
},
"401" : {
"description" : "Unauthorized",
"content" : {
"application/problem+json" : {
"schema" : {
"$ref" : "#/components/schemas/Problem"
}
}
}
},
"500" : {
"description" : "Internal Server Error",
"content" : {
"application/problem+json" : {
"schema" : {
"$ref" : "#/components/schemas/Problem"
}
}
}
}
},
"security" : [ {
"bearerAuth" : [ "global" ]
} ]
}
},
"/v1/support" : {
"post" : {
"tags" : [ "external-v2", "support" ],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,6 @@ class SwaggerConfigTest {
@MockBean
private ProductService productServiceMock;

@MockBean
private RelationshipService relationshipServiceMock;

@MockBean
private UserService userServiceMock;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,5 @@ public interface MsCoreConnector {

void checkExistingRelationshipRoles(String institutionId, String productId, CreateUserDto userDto, String userId);

void suspend(String relationshipId);

void activate(String relationshipId);

void delete(String relationshipId);

Collection<UserInfo> getUsers(String institutionId, UserInfo.UserInfoFilter userInfoFilter);
}
Original file line number Diff line number Diff line change
Expand Up @@ -394,35 +394,6 @@ private Map<Person.RoleEnum, List<Person>> getPartyRoleListMap(String userId, Cr
}).collect(Collectors.groupingBy(Person::getRole));
}


@Override
public void suspend(String relationshipId) {
log.trace("suspend start");
log.debug("suspend relationshipId = {}", relationshipId);
Assert.hasText(relationshipId, REQUIRED_RELATIONSHIP_MESSAGE);
coreUserApiRestClient._suspendRelationshipUsingPOST(relationshipId);
log.trace("suspend end");
}


@Override
public void activate(String relationshipId) {
log.trace("activate start");
log.debug("activate relationshipId = {}", relationshipId);
Assert.hasText(relationshipId, REQUIRED_RELATIONSHIP_MESSAGE);
coreUserApiRestClient._activateRelationshipUsingPOST(relationshipId);
log.trace("activate end");
}

@Override
public void delete(String relationshipId) {
log.trace("delete start");
log.debug("delete relationshipId = {}", relationshipId);
Assert.hasText(relationshipId, REQUIRED_RELATIONSHIP_MESSAGE);
coreUserApiRestClient._deleteRelationshipUsingDELETE(relationshipId);
log.trace("delete end");
}

@Override
public List<PartyProduct> getInstitutionProducts(String institutionId) {
log.trace("getInstitutionProducts start");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1335,78 +1335,6 @@ private void verifyRequest(String institutionId, String productId, CreateUserDto
}));
}

@Test
void suspend_nullRelationshipId() {
// given
String relationshipId = null;
// when
Executable executable = () -> msCoreConnector.suspend(relationshipId);
// then
IllegalArgumentException e = assertThrows(IllegalArgumentException.class, executable);
assertEquals("A Relationship id is required", e.getMessage());
verifyNoInteractions(coreUserApiRestClientMock);
}

@Test
void suspend() {
// given
String relationshipId = "relationshipId";
// when
msCoreConnector.suspend(relationshipId);
// then
verify(coreUserApiRestClientMock, times(1))
._suspendRelationshipUsingPOST(relationshipId);
verifyNoMoreInteractions(coreUserApiRestClientMock);
}

@Test
void activate_nullRelationshipId() {
// given
String relationshipId = null;
// when
Executable executable = () -> msCoreConnector.activate(relationshipId);
// then
IllegalArgumentException e = assertThrows(IllegalArgumentException.class, executable);
assertEquals("A Relationship id is required", e.getMessage());
verifyNoInteractions(coreUserApiRestClientMock);
}

@Test
void activate() {
// given
String relationshipId = "relationshipId";
// when
msCoreConnector.activate(relationshipId);
// then
verify(coreUserApiRestClientMock, times(1))
._activateRelationshipUsingPOST(relationshipId);
verifyNoMoreInteractions(coreUserApiRestClientMock);
}

@Test
void delete_nullRelationshipId() {
// given
String relationshipId = null;
// when
Executable executable = () -> msCoreConnector.delete(relationshipId);
// then
IllegalArgumentException e = assertThrows(IllegalArgumentException.class, executable);
assertEquals("A Relationship id is required", e.getMessage());
verifyNoInteractions(coreUserApiRestClientMock);
}

@Test
void delete() {
// given
String relationshipId = "relationshipId";
// when
msCoreConnector.delete(relationshipId);
// then
verify(coreUserApiRestClientMock, times(1))
._deleteRelationshipUsingDELETE(relationshipId);
verifyNoMoreInteractions(coreUserApiRestClientMock);
}


@Test
void getGeographicTaxonomyList_nullInstitutionId() {
Expand Down

This file was deleted.

This file was deleted.

Loading

0 comments on commit f1a7860

Please sign in to comment.