Skip to content

Commit

Permalink
odpi#5399 fix termanchor and categoryanchor tests to remove restore r…
Browse files Browse the repository at this point in the history
…elationship tests

Signed-off-by: David Radley <david_radley@uk.ibm.com>
  • Loading branch information
davidradl committed Jul 26, 2021
1 parent 654ea1a commit 299b113
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4272,6 +4272,8 @@ public void restoreRelationship(String userId,

try
{
// check each end is active prior to attempting the restore

Relationship relationship = metadataCollection.restoreRelationship(userId, deletedRelationshipGUID);
if (relationship != null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import org.odpi.openmetadata.accessservices.subjectarea.client.SubjectAreaNodeClient;
import org.odpi.openmetadata.accessservices.subjectarea.client.SubjectAreaRestClient;
import org.odpi.openmetadata.accessservices.subjectarea.client.nodes.categories.SubjectAreaCategoryClient;
import org.odpi.openmetadata.accessservices.subjectarea.client.nodes.terms.SubjectAreaTermClient;
import org.odpi.openmetadata.accessservices.subjectarea.client.relationships.SubjectAreaRelationshipClients;
import org.odpi.openmetadata.accessservices.subjectarea.client.relationships.SubjectAreaRelationship;
import org.odpi.openmetadata.accessservices.subjectarea.properties.objects.category.Category;
Expand Down Expand Up @@ -37,6 +38,7 @@ public class RelationshipsFVT {
private static final String DEFAULT_TEST_PROJECT_NAME = "Test Project for relationships FVT";
private SubjectAreaRelationshipClients subjectAreaRelationship = null;
private SubjectAreaNodeClient<Category> subjectAreaCategory = null;
private SubjectAreaNodeClient<Term> subjectAreaTerm = null;
private GlossaryFVT glossaryFVT = null;
private TermFVT termFVT = null;
private CategoryFVT catFVT = null;
Expand All @@ -50,6 +52,7 @@ public RelationshipsFVT(String url, String serverName, String userId) throws Inv
SubjectAreaRestClient client = new SubjectAreaRestClient(serverName, url);
subjectAreaRelationship = new SubjectAreaRelationship(client);
subjectAreaCategory = new SubjectAreaCategoryClient(client);
subjectAreaTerm = new SubjectAreaTermClient<>(client);
termFVT = new TermFVT(url, serverName, userId);
catFVT = new CategoryFVT(url, serverName, userId);
glossaryFVT = new GlossaryFVT(url, serverName, userId);
Expand Down Expand Up @@ -1266,7 +1269,11 @@ private void termAnchorFVT(Term term) throws SubjectAreaFVTCheckedException, Inv
// no update or replace as this relationship has no properties

subjectAreaRelationship.termAnchor().delete(this.userId, relationshipGuid);
///FVTUtils.validateLine(gotTermAnchorRelationship);

// deletion of a term anchor deletes the Term - because the Term as an anchored object.
// So we need to restore the Term before we can restore the term anchor relationship
subjectAreaTerm.restore(userId, termGuid);

System.out.println("Deleted TermAnchorRelationship with relationshipGuid=" + relationshipGuid);
gotTermAnchorRelationship = subjectAreaRelationship.termAnchor().restore(this.userId, relationshipGuid);
FVTUtils.validateRelationship(gotTermAnchorRelationship);
Expand Down Expand Up @@ -1294,6 +1301,11 @@ private void categoryAnchorFVT(Category category) throws SubjectAreaFVTCheckedEx
subjectAreaRelationship.categoryAnchor().delete(this.userId, relationshipGuid);
//FVTUtils.validateLine(gotCategoryAnchorRelationship);
System.out.println("Deleted CategoryAnchorRelationship with relationshipGuid=" + relationshipGuid);

// deletion of a category anchor deletes the Category - because the Category as an anchored object.
// So we need to restore the Category before we can restore the category anchor relationship
subjectAreaCategory.restore(userId, categoryGuid);

gotCategoryAnchorRelationship = subjectAreaRelationship.categoryAnchor().restore(this.userId, relationshipGuid);
FVTUtils.validateRelationship(gotCategoryAnchorRelationship);
System.out.println("Restored CategoryAnchorRelationship with relationshipGuid=" + relationshipGuid);
Expand Down

0 comments on commit 299b113

Please sign in to comment.