diff --git a/open-metadata-implementation/access-services/community-profile/community-profile-api/src/main/java/org/odpi/openmetadata/accessservices/communityprofile/api/ToDoManagementInterface.java b/open-metadata-implementation/access-services/community-profile/community-profile-api/src/main/java/org/odpi/openmetadata/accessservices/communityprofile/api/ToDoManagementInterface.java index 660ff3b5ef5..6b81a4515b1 100644 --- a/open-metadata-implementation/access-services/community-profile/community-profile-api/src/main/java/org/odpi/openmetadata/accessservices/communityprofile/api/ToDoManagementInterface.java +++ b/open-metadata-implementation/access-services/community-profile/community-profile-api/src/main/java/org/odpi/openmetadata/accessservices/communityprofile/api/ToDoManagementInterface.java @@ -23,8 +23,8 @@ public interface ToDoManagementInterface * * @param userId calling user * @param originatorGUID optional originator element (such as a person or Governance Service) - * @param actionOwnerGUID optional element that maintains the "To Do" on their list - * @param assignToActorGUID optional actor to assign the action to + * @param actionSponsorGUID optional element that maintains the "To Do" on their list + * @param assignToActorGUID optional actor to assign the action to * @param newActionTargetProperties optional list of elements that the action is to target * @param properties properties of the to do action * @@ -36,7 +36,7 @@ public interface ToDoManagementInterface */ String createToDo(String userId, String originatorGUID, - String actionOwnerGUID, + String actionSponsorGUID, String assignToActorGUID, List newActionTargetProperties, ToDoProperties properties) throws InvalidParameterException, diff --git a/open-metadata-implementation/access-services/community-profile/community-profile-api/src/main/java/org/odpi/openmetadata/accessservices/communityprofile/metadataelements/ToDoElement.java b/open-metadata-implementation/access-services/community-profile/community-profile-api/src/main/java/org/odpi/openmetadata/accessservices/communityprofile/metadataelements/ToDoElement.java index a40d6a6471e..2ceb1eb9896 100644 --- a/open-metadata-implementation/access-services/community-profile/community-profile-api/src/main/java/org/odpi/openmetadata/accessservices/communityprofile/metadataelements/ToDoElement.java +++ b/open-metadata-implementation/access-services/community-profile/community-profile-api/src/main/java/org/odpi/openmetadata/accessservices/communityprofile/metadataelements/ToDoElement.java @@ -26,8 +26,9 @@ public class ToDoElement implements MetadataElement { private ElementHeader elementHeader = null; private ToDoProperties properties = null; - private RelatedElement relatedElement = null; + private ElementStub toDoSource = null; private List assignedActors = null; + private List sponsors = null; private List actionTargets = null; /** @@ -48,11 +49,12 @@ public ToDoElement(ToDoElement template) { if (template != null) { - elementHeader = template.getElementHeader(); - properties = template.getProperties(); - relatedElement = template.getRelatedElement(); + elementHeader = template.getElementHeader(); + properties = template.getProperties(); + toDoSource = template.getToDoSource(); assignedActors = template.getAssignedActors(); - actionTargets = template.getActionTargets(); + sponsors = template.getSponsors(); + actionTargets = template.getActionTargets(); } } @@ -104,28 +106,27 @@ public void setProperties(ToDoProperties properties) /** - * Return details of the relationship used to retrieve this element. - * Will be null if the element was retrieved directly rather than via a relationship. + * Return the source of the To Do * - * @return list of element stubs + * @return element stub */ - public RelatedElement getRelatedElement() + public ElementStub getToDoSource() { - return relatedElement; + return toDoSource; } /** - * Set up details of the relationship used to retrieve this element. - * Will be null if the element was retrieved directly rather than via a relationship. + * Set up details of the To Do * - * @param relatedElement relationship details + * @param toDoSource element stub */ - public void setRelatedElement(RelatedElement relatedElement) + public void setToDoSource(ElementStub toDoSource) { - this.relatedElement = relatedElement; + this.toDoSource = toDoSource; } + /** * Return the list of actors assigned to this work item. * @@ -148,6 +149,28 @@ public void setAssignedActors(List assignedActors) } + /** + * Return the list of sponsors for this action. + * + * @return list of sponsors + */ + public List getSponsors() + { + return sponsors; + } + + + /** + * Set up the list of sponsors for this action. + * + * @param sponsors list of sponsors + */ + public void setSponsors(List sponsors) + { + this.sponsors = sponsors; + } + + /** * Return the list of action targets to work on. * @@ -181,8 +204,9 @@ public String toString() return "ToDoElement{" + "elementHeader=" + elementHeader + ", properties=" + properties + - ", relatedElement=" + relatedElement + + ", toDoSource=" + toDoSource + ", assignedActors=" + assignedActors + + ", sponsors=" + sponsors + ", actionTargets=" + actionTargets + '}'; } @@ -208,8 +232,9 @@ public boolean equals(Object objectToCompare) ToDoElement that = (ToDoElement) objectToCompare; return Objects.equals(elementHeader, that.elementHeader) && Objects.equals(properties, that.properties) && - Objects.equals(relatedElement, that.relatedElement) && + Objects.equals(toDoSource, that.toDoSource) && Objects.equals(assignedActors, that.assignedActors) && + Objects.equals(sponsors, that.sponsors) && Objects.equals(actionTargets, that.actionTargets); } @@ -222,6 +247,6 @@ public boolean equals(Object objectToCompare) @Override public int hashCode() { - return Objects.hash(super.hashCode(), elementHeader, properties, relatedElement, assignedActors, actionTargets); + return Objects.hash(super.hashCode(), elementHeader, properties, toDoSource, sponsors, assignedActors, actionTargets); } } diff --git a/open-metadata-implementation/access-services/community-profile/community-profile-api/src/main/java/org/odpi/openmetadata/accessservices/communityprofile/properties/ToDoProperties.java b/open-metadata-implementation/access-services/community-profile/community-profile-api/src/main/java/org/odpi/openmetadata/accessservices/communityprofile/properties/ToDoProperties.java index 225c4585a45..0928eae7ff7 100644 --- a/open-metadata-implementation/access-services/community-profile/community-profile-api/src/main/java/org/odpi/openmetadata/accessservices/communityprofile/properties/ToDoProperties.java +++ b/open-metadata-implementation/access-services/community-profile/community-profile-api/src/main/java/org/odpi/openmetadata/accessservices/communityprofile/properties/ToDoProperties.java @@ -27,7 +27,7 @@ public class ToDoProperties extends ReferenceableProperties private Date dueTime = null; private Date lastReviewTime = null; private Date completionTime = null; - private ToDoStatus status = null; + private ToDoStatus status = ToDoStatus.OPEN; diff --git a/open-metadata-implementation/access-services/community-profile/community-profile-client/src/main/java/org/odpi/openmetadata/accessservices/communityprofile/client/ToDoActionManagement.java b/open-metadata-implementation/access-services/community-profile/community-profile-client/src/main/java/org/odpi/openmetadata/accessservices/communityprofile/client/ToDoActionManagement.java index 527db8aba79..6d77c04159e 100644 --- a/open-metadata-implementation/access-services/community-profile/community-profile-client/src/main/java/org/odpi/openmetadata/accessservices/communityprofile/client/ToDoActionManagement.java +++ b/open-metadata-implementation/access-services/community-profile/community-profile-client/src/main/java/org/odpi/openmetadata/accessservices/communityprofile/client/ToDoActionManagement.java @@ -125,7 +125,7 @@ public ToDoActionManagement(String serverName, * * @param userId calling user * @param originatorGUID optional originator element (such as a person or Governance Service) - * @param actionOwnerGUID optional element that maintains the "To Do" on their list + * @param actionSponsorGUID optional element that maintains the "To Do" on their list * @param assignToActorGUID optional actor to assign the action to * @param newActionTargetProperties optional list of elements that the action is to target * @param properties properties of the to do action @@ -137,7 +137,7 @@ public ToDoActionManagement(String serverName, @Override public String createToDo(String userId, String originatorGUID, - String actionOwnerGUID, + String actionSponsorGUID, String assignToActorGUID, List newActionTargetProperties, ToDoProperties properties) throws InvalidParameterException, @@ -198,13 +198,13 @@ public String createToDo(String userId, null); } - if (actionOwnerGUID != null) + if (actionSponsorGUID != null) { openMetadataStoreClient.createRelatedElementsInStore(userId, null, null, OpenMetadataType.ACTION_SPONSOR_RELATIONSHIP_TYPE_NAME, - actionOwnerGUID, + actionSponsorGUID, toDoGUID, false, false, @@ -447,7 +447,17 @@ public ToDoElement getToDo(String userId, if ((openMetadataElement != null) && (propertyHelper.isTypeOf(openMetadataElement, OpenMetadataType.TO_DO_TYPE_NAME))) { - return toDoConverter.getNewBean(toDoBeanClass, openMetadataElement, methodName); + List relatedMetadataElements = openMetadataStoreClient.getRelatedMetadataElements(userId, + openMetadataElement.getElementGUID(), + 0, + null, + false, + false, + new Date(), + 0, + 0); + + return toDoConverter.getNewComplexBean(toDoBeanClass, openMetadataElement, relatedMetadataElements, methodName); } return null; @@ -491,7 +501,7 @@ public List getActionsForActionTarget(String userId, new Date(), startFrom, pageSize); - return this.convertRelatedToDos(relatedMetadataElements, toDoStatus, methodName); + return this.convertRelatedToDos(userId, relatedMetadataElements, toDoStatus, methodName); } @@ -534,7 +544,7 @@ public List getActionsForSponsor(String userId, new Date(), startFrom, pageSize); - return this.convertRelatedToDos(relatedMetadataElements, toDoStatus, methodName); + return this.convertRelatedToDos(userId, relatedMetadataElements, toDoStatus, methodName); } @@ -575,7 +585,7 @@ public List getAssignedActions(String userId, new Date(), startFrom, pageSize); - return this.convertRelatedToDos(relatedMetadataElements, toDoStatus, methodName); + return this.convertRelatedToDos(userId, relatedMetadataElements, toDoStatus, methodName); } @@ -618,7 +628,7 @@ public List findToDos(String userId, startFrom, pageSize); - return convertToDos(openMetadataElements, toDoStatus, methodName); + return convertToDos(userId, openMetadataElements, toDoStatus, methodName); } @@ -636,20 +646,20 @@ public List findToDos(String userId, * @throws UserNotAuthorizedException the calling user is not authorized to issue the call */ @Override - public List getToDosByType(String userId, - String toDoType, + public List getToDosByType(String userId, + String toDoType, ToDoStatus toDoStatus, - int startFrom, - int pageSize) throws InvalidParameterException, - PropertyServerException, - UserNotAuthorizedException + int startFrom, + int pageSize) throws InvalidParameterException, + PropertyServerException, + UserNotAuthorizedException { final String methodName = "getToDosByType"; invalidParameterHandler.validateUserId(userId, methodName); invalidParameterHandler.validatePaging(startFrom, pageSize, methodName); - List propertyNames = List.of(OpenMetadataType.TO_DO_TYPE_NAME); + List propertyNames = List.of(OpenMetadataType.TO_DO_TYPE_PROPERTY_NAME); List openMetadataElements = openMetadataStoreClient.findMetadataElements(userId, OpenMetadataType.TO_DO_TYPE_NAME, @@ -666,22 +676,28 @@ public List getToDosByType(String userId, startFrom, pageSize); - return convertToDos(openMetadataElements, toDoStatus, methodName); + return convertToDos(userId, openMetadataElements, toDoStatus, methodName); } /** * Convert to do objects from the OpenMetadataClient to local beans. * + * @param userId calling user * @param openMetadataElements retrieved elements * @param toDoStatus optional "To Do" status * @param methodName calling method * @return list of collection elements - * @throws PropertyServerException error in retrieved values + * @throws InvalidParameterException a parameter is invalid + * @throws PropertyServerException the server is not available + * @throws UserNotAuthorizedException the calling user is not authorized to issue the call */ - private List convertToDos(List openMetadataElements, - ToDoStatus toDoStatus, - String methodName) throws PropertyServerException + private List convertToDos(String userId, + List openMetadataElements, + ToDoStatus toDoStatus, + String methodName) throws PropertyServerException, + InvalidParameterException, + UserNotAuthorizedException { if (openMetadataElements != null) { @@ -691,7 +707,19 @@ private List convertToDos(List openMetadataEle { if (openMetadataElement != null) { - ToDoElement toDoElement = toDoConverter.getNewBean(toDoBeanClass, openMetadataElement, methodName); + List relatedMetadataElements = openMetadataStoreClient.getRelatedMetadataElements(userId, + openMetadataElement.getElementGUID(), + 0, + null, + false, + false, + new Date(), + 0, + 0); + ToDoElement toDoElement = toDoConverter.getNewComplexBean(toDoBeanClass, + openMetadataElement, + relatedMetadataElements, + methodName); if ((toDoStatus == null) || (toDoStatus == toDoElement.getProperties().getStatus())) { @@ -700,7 +728,10 @@ private List convertToDos(List openMetadataEle } } - return toDoElements; + if (! toDoElements.isEmpty()) + { + return toDoElements; + } } return null; @@ -710,15 +741,21 @@ private List convertToDos(List openMetadataEle /** * Convert to do objects from the OpenMetadataClient to local beans. * + * @param userId calling user * @param relatedMetadataElements retrieved elements * @param toDoStatus optional "To Do" status * @param methodName calling method * @return list of collection elements - * @throws PropertyServerException error in retrieved values + * @throws InvalidParameterException a parameter is invalid + * @throws PropertyServerException the server is not available + * @throws UserNotAuthorizedException the calling user is not authorized to issue the call */ - private List convertRelatedToDos(List relatedMetadataElements, + private List convertRelatedToDos(String userId, + List relatedMetadataElements, ToDoStatus toDoStatus, - String methodName) throws PropertyServerException + String methodName) throws PropertyServerException, + InvalidParameterException, + UserNotAuthorizedException { if (relatedMetadataElements != null) { @@ -728,7 +765,19 @@ private List convertRelatedToDos(List relat { if (relatedMetadataElement != null) { - ToDoElement toDoElement = toDoConverter.getNewBean(toDoBeanClass, relatedMetadataElement, methodName); + List relatedElements = openMetadataStoreClient.getRelatedMetadataElements(userId, + relatedMetadataElement.getElement().getElementGUID(), + 0, + null, + false, + false, + new Date(), + 0, + 0); + ToDoElement toDoElement = toDoConverter.getNewComplexBean(toDoBeanClass, + relatedMetadataElement.getElement(), + relatedElements, + methodName); if ((toDoStatus == null) || (toDoStatus == toDoElement.getProperties().getStatus())) { @@ -737,7 +786,10 @@ private List convertRelatedToDos(List relat } } - return toDoElements; + if (!toDoElements.isEmpty()) + { + return toDoElements; + } } return null; diff --git a/open-metadata-implementation/access-services/community-profile/community-profile-client/src/main/java/org/odpi/openmetadata/accessservices/communityprofile/client/converters/CollectionMemberConverter.java b/open-metadata-implementation/access-services/community-profile/community-profile-client/src/main/java/org/odpi/openmetadata/accessservices/communityprofile/client/converters/CollectionMemberConverter.java index 44a2824045a..ccfab61ab32 100644 --- a/open-metadata-implementation/access-services/community-profile/community-profile-client/src/main/java/org/odpi/openmetadata/accessservices/communityprofile/client/converters/CollectionMemberConverter.java +++ b/open-metadata-implementation/access-services/community-profile/community-profile-client/src/main/java/org/odpi/openmetadata/accessservices/communityprofile/client/converters/CollectionMemberConverter.java @@ -127,7 +127,7 @@ CollectionMembershipStatus removeCollectionMemberStatus(ElementProperties elemen if (elementProperties != null) { String retrievedProperty = propertyHelper.removeEnumProperty(serviceName, - OpenMetadataType.MEMBERSHIP_STATUS_ENUM_TYPE_NAME, + OpenMetadataType.STATUS_PROPERTY_NAME, elementProperties, methodName); diff --git a/open-metadata-implementation/access-services/community-profile/community-profile-client/src/main/java/org/odpi/openmetadata/accessservices/communityprofile/client/converters/CommunityProfileConverterBase.java b/open-metadata-implementation/access-services/community-profile/community-profile-client/src/main/java/org/odpi/openmetadata/accessservices/communityprofile/client/converters/CommunityProfileConverterBase.java index 2513f4b7cad..bb0910a7c62 100644 --- a/open-metadata-implementation/access-services/community-profile/community-profile-client/src/main/java/org/odpi/openmetadata/accessservices/communityprofile/client/converters/CommunityProfileConverterBase.java +++ b/open-metadata-implementation/access-services/community-profile/community-profile-client/src/main/java/org/odpi/openmetadata/accessservices/communityprofile/client/converters/CommunityProfileConverterBase.java @@ -130,19 +130,19 @@ public RelatedElement getRelatedElement(Class beanClass, /** - * Extract and delete the CollectionMemberStatus property from the supplied element properties. + * Extract and delete the ToDoStatus property from the supplied element properties. * * @param elementProperties properties from entity * @return KeyPattern enum */ ToDoStatus removeToDoStatus(ElementProperties elementProperties) { - final String methodName = "removeCollectionMemberStatus"; + final String methodName = "removeToDoStatus"; if (elementProperties != null) { String retrievedProperty = propertyHelper.removeEnumProperty(serviceName, - OpenMetadataType.TO_DO_STATUS_ENUM_TYPE_NAME, + OpenMetadataType.STATUS_PROPERTY_NAME, elementProperties, methodName); diff --git a/open-metadata-implementation/access-services/community-profile/community-profile-client/src/main/java/org/odpi/openmetadata/accessservices/communityprofile/client/converters/ToDoConverter.java b/open-metadata-implementation/access-services/community-profile/community-profile-client/src/main/java/org/odpi/openmetadata/accessservices/communityprofile/client/converters/ToDoConverter.java index a19d40f60ad..934ca39cc90 100644 --- a/open-metadata-implementation/access-services/community-profile/community-profile-client/src/main/java/org/odpi/openmetadata/accessservices/communityprofile/client/converters/ToDoConverter.java +++ b/open-metadata-implementation/access-services/community-profile/community-profile-client/src/main/java/org/odpi/openmetadata/accessservices/communityprofile/client/converters/ToDoConverter.java @@ -3,18 +3,14 @@ package org.odpi.openmetadata.accessservices.communityprofile.client.converters; import org.odpi.openmetadata.accessservices.communityprofile.metadataelements.ActionTargetElement; -import org.odpi.openmetadata.accessservices.communityprofile.metadataelements.CollectionElement; -import org.odpi.openmetadata.accessservices.communityprofile.metadataelements.RelatedElement; import org.odpi.openmetadata.accessservices.communityprofile.metadataelements.ToDoElement; import org.odpi.openmetadata.accessservices.communityprofile.properties.ActionTargetProperties; -import org.odpi.openmetadata.accessservices.communityprofile.properties.CollectionProperties; import org.odpi.openmetadata.accessservices.communityprofile.properties.ToDoProperties; import org.odpi.openmetadata.frameworks.connectors.ffdc.PropertyServerException; import org.odpi.openmetadata.frameworks.connectors.properties.beans.ElementStub; import org.odpi.openmetadata.frameworks.governanceaction.mapper.OpenMetadataType; import org.odpi.openmetadata.frameworks.governanceaction.properties.OpenMetadataElement; import org.odpi.openmetadata.frameworks.governanceaction.properties.RelatedMetadataElement; -import org.odpi.openmetadata.frameworks.governanceaction.properties.RelatedMetadataElements; import org.odpi.openmetadata.frameworks.governanceaction.search.ElementProperties; import org.odpi.openmetadata.frameworks.governanceaction.search.PropertyHelper; @@ -24,7 +20,7 @@ /** - * CollectionConverter generates a CollectionElement from a Collection entity + * ToDoConverter generates a ToDoElement from a "To Do" entity */ public class ToDoConverter extends CommunityProfileConverterBase { @@ -45,7 +41,7 @@ public ToDoConverter(PropertyHelper propertyHelper, /** * Using the supplied instances, return a new instance of the bean. It is used for beans such as - * an Annotation or DataField bean which combine knowledge from the element and its linked relationships. + * an Annotation or To Do bean which combine knowledge from the element and its linked relationships. * * @param beanClass name of the class to create * @param primaryElement element that is the root of the collection of entities that make up the @@ -109,6 +105,7 @@ public B getNewComplexBean(Class beanClass, if (relationships != null) { List assignedActors = new ArrayList<>(); + List sponsors = new ArrayList<>(); List actionTargets = new ArrayList<>(); for (RelatedMetadataElement relatedMetadataElement : relationships) @@ -117,12 +114,16 @@ public B getNewComplexBean(Class beanClass, { if (propertyHelper.isTypeOf(relatedMetadataElement, OpenMetadataType.TO_DO_SOURCE_RELATIONSHIP_TYPE_NAME)) { - bean.setRelatedElement(super.getRelatedElement(beanClass, relatedMetadataElement, methodName)); + bean.setToDoSource(super.getElementStub(beanClass, relatedMetadataElement.getElement(), methodName)); } else if (propertyHelper.isTypeOf(relatedMetadataElement, OpenMetadataType.ACTION_ASSIGNMENT_RELATIONSHIP_TYPE_NAME)) { assignedActors.add(super.getElementStub(beanClass, relatedMetadataElement.getElement(), methodName)); } + else if (propertyHelper.isTypeOf(relatedMetadataElement, OpenMetadataType.ACTION_SPONSOR_RELATIONSHIP_TYPE_NAME)) + { + sponsors.add(super.getElementStub(beanClass, relatedMetadataElement.getElement(), methodName)); + } else if (propertyHelper.isTypeOf(relatedMetadataElement, OpenMetadataType.ACTION_TARGET_RELATIONSHIP_TYPE_NAME)) { ActionTargetElement actionTargetElement = new ActionTargetElement(); @@ -155,6 +156,11 @@ else if (propertyHelper.isTypeOf(relatedMetadataElement, OpenMetadataType.ACTION bean.setAssignedActors(assignedActors); } + if (! sponsors.isEmpty()) + { + bean.setSponsors(sponsors); + } + if (! actionTargets.isEmpty()) { bean.setActionTargets(actionTargets); @@ -178,107 +184,4 @@ else if (propertyHelper.isTypeOf(relatedMetadataElement, OpenMetadataType.ACTION return null; } - - - - /** - * Using the supplied openMetadataElement, return a new instance of the bean. This is used for most beans that have - * a one to one correspondence with the repository instances. - * - * @param beanClass name of the class to create - * @param toDoRelatedMetadataElement the properties of an open metadata element plus details of the relationship used to navigate to it - * @param methodName calling method - * @return bean populated with properties from the instances supplied - * @throws PropertyServerException there is a problem instantiating the bean - */ - @Override - public B getNewBean(Class beanClass, - RelatedMetadataElement toDoRelatedMetadataElement, - String methodName) throws PropertyServerException - { - try - { - /* - * This is initial confirmation that the generic converter has been initialized with an appropriate bean class. - */ - B returnBean = beanClass.getDeclaredConstructor().newInstance(); - - if (returnBean instanceof CollectionElement bean) - { - CollectionProperties collectionProperties = new CollectionProperties(); - OpenMetadataElement openMetadataElement = toDoRelatedMetadataElement.getElement(); - - bean.setElementHeader(super.getMetadataElementHeader(beanClass, openMetadataElement, methodName)); - - ElementProperties elementProperties; - - /* - * The initial set of values come from the openMetadataElement. - */ - if (openMetadataElement != null) - { - elementProperties = new ElementProperties(openMetadataElement.getElementProperties()); - - collectionProperties.setQualifiedName(this.removeQualifiedName(elementProperties)); - collectionProperties.setAdditionalProperties(this.removeAdditionalProperties(elementProperties)); - collectionProperties.setName(this.removeName(elementProperties)); - collectionProperties.setDescription(this.removeDescription(elementProperties)); - collectionProperties.setCollectionType(this.removeCollectionType(elementProperties)); - collectionProperties.setEffectiveFrom(openMetadataElement.getEffectiveFromTime()); - collectionProperties.setEffectiveTo(openMetadataElement.getEffectiveToTime()); - - /* - * Any remaining properties are returned in the extended properties. They are - * assumed to be defined in a subtype. - */ - collectionProperties.setTypeName(bean.getElementHeader().getType().getTypeName()); - collectionProperties.setExtendedProperties(this.getRemainingExtendedProperties(elementProperties)); - } - else - { - handleMissingMetadataInstance(beanClass.getName(), OpenMetadataElement.class.getName(), methodName); - } - - bean.setProperties(collectionProperties); - - bean.setRelatedElement(super.getRelatedElement(beanClass, toDoRelatedMetadataElement, methodName)); - } - - return returnBean; - } - catch (IllegalAccessException | InstantiationException | ClassCastException | NoSuchMethodException | InvocationTargetException error) - { - super.handleInvalidBeanClass(beanClass.getName(), error, methodName); - } - - return null; - } - - - /** - * Using the supplied instances, return a new instance of the bean. This is used for beans that - * contain a combination of the properties from an element and that of a connected relationship. - * - * @param beanClass name of the class to create - * @param element element containing the properties - * @param relationship relationship containing the properties - * @param methodName calling method - * @return bean populated with properties from the instances supplied - * @throws PropertyServerException there is a problem instantiating the bean - */ - @SuppressWarnings(value = "unused") - public B getNewBean(Class beanClass, - OpenMetadataElement element, - RelatedMetadataElements relationship, - String methodName) throws PropertyServerException - { - B returnBean = this.getNewBean(beanClass, element, methodName); - - if (returnBean instanceof CollectionElement bean) - { - bean.setRelatedElement(super.getRelatedElement(beanClass, element, relationship, methodName)); - } - - return returnBean; - } } diff --git a/open-metadata-implementation/access-services/community-profile/community-profile-server/src/main/java/org/odpi/openmetadata/accessservices/communityprofile/converters/ToDoConverter.java b/open-metadata-implementation/access-services/community-profile/community-profile-server/src/main/java/org/odpi/openmetadata/accessservices/communityprofile/converters/ToDoConverter.java deleted file mode 100644 index d67e98f723f..00000000000 --- a/open-metadata-implementation/access-services/community-profile/community-profile-server/src/main/java/org/odpi/openmetadata/accessservices/communityprofile/converters/ToDoConverter.java +++ /dev/null @@ -1,199 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ -package org.odpi.openmetadata.accessservices.communityprofile.converters; - - -import org.odpi.openmetadata.accessservices.communityprofile.metadataelements.ToDoElement; -import org.odpi.openmetadata.accessservices.communityprofile.properties.ToDoProperties; -import org.odpi.openmetadata.accessservices.communityprofile.properties.ToDoStatus; -import org.odpi.openmetadata.frameworks.governanceaction.mapper.OpenMetadataType; -import org.odpi.openmetadata.frameworks.connectors.ffdc.PropertyServerException; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.EntityDetail; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.InstanceProperties; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.Relationship; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.typedefs.TypeDefCategory; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.repositoryconnector.OMRSRepositoryHelper; - -import java.lang.reflect.InvocationTargetException; - - -/** - * ToDoConverter generates a To Do bean from an To Do entity. - */ -public class ToDoConverter extends CommunityProfileOMASConverter -{ - /** - * Constructor - * - * @param repositoryHelper helper object to parse entity - * @param serviceName name of this component - * @param serverName local server name - */ - public ToDoConverter(OMRSRepositoryHelper repositoryHelper, - String serviceName, - String serverName) - { - super(repositoryHelper, serviceName, serverName); - } - - - /** - * Using the supplied entity, return a new instance of the bean. This is used for most beans that have - * a one to one correspondence with the repository instances. - * - * @param beanClass name of the class to create - * @param entity entity containing the properties - * @param methodName calling method - * @return bean populated with properties from the entity supplied - * @throws PropertyServerException there is a problem instantiating the bean - */ - @Override - public B getNewBean(Class beanClass, - EntityDetail entity, - String methodName) throws PropertyServerException - { - try - { - /* - * This is initial confirmation that the generic converter has been initialized with an appropriate bean class. - */ - B returnBean = beanClass.getDeclaredConstructor().newInstance(); - - if (returnBean instanceof ToDoElement) - { - ToDoElement bean = (ToDoElement) returnBean; - ToDoProperties toDoProperties = new ToDoProperties(); - - InstanceProperties instanceProperties; - - /* - * The initial set of values come from the entity. - */ - if (entity != null) - { - bean.setElementHeader(super.getMetadataElementHeader(beanClass, entity, methodName)); - - /* - * The initial set of values come from the entity. - */ - instanceProperties = new InstanceProperties(entity.getProperties()); - - toDoProperties.setQualifiedName(this.removeQualifiedName(instanceProperties)); - toDoProperties.setAdditionalProperties(this.removeAdditionalProperties(instanceProperties)); - toDoProperties.setName(this.removeName(instanceProperties)); - toDoProperties.setDescription(this.removeDescription(instanceProperties)); - toDoProperties.setCreationTime(this.removeCreationTime(instanceProperties)); - toDoProperties.setPriority(this.removeIntPriority(instanceProperties)); - toDoProperties.setLastReviewTime(this.removeLastReviewTime(instanceProperties)); - toDoProperties.setDueTime(this.removeDueTime(instanceProperties)); - toDoProperties.setCompletionTime(this.removeCompletionTime(instanceProperties)); - toDoProperties.setStatus(this.getToDoStatusFromProperties(instanceProperties)); - toDoProperties.setEffectiveFrom(instanceProperties.getEffectiveFromTime()); - toDoProperties.setEffectiveTo(instanceProperties.getEffectiveToTime()); - - /* - * Any remaining properties are returned in the extended properties. They are - * assumed to be defined in a subtype. - */ - toDoProperties.setTypeName(bean.getElementHeader().getType().getTypeName()); - toDoProperties.setExtendedProperties(this.getRemainingExtendedProperties(instanceProperties)); - - } - else - { - handleMissingMetadataInstance(beanClass.getName(), TypeDefCategory.ENTITY_DEF, methodName); - } - - bean.setProperties(toDoProperties); - } - - return returnBean; - } - catch (IllegalAccessException | InstantiationException | ClassCastException | NoSuchMethodException | InvocationTargetException error) - { - super.handleInvalidBeanClass(beanClass.getName(), error, methodName); - } - - return null; - } - - - - - /** - * Using the supplied instances, return a new instance of the bean. This is used for beans that - * contain a combination of the properties from an entity and that of a connected relationship. - * - * @param beanClass name of the class to create - * @param entity entity containing the properties - * @param relationship relationship containing the properties - * @param methodName calling method - * @return bean populated with properties from the instances supplied - * @throws PropertyServerException there is a problem instantiating the bean - */ - public B getNewBean(Class beanClass, - EntityDetail entity, - Relationship relationship, - String methodName) throws PropertyServerException - { - B returnBean = this.getNewBean(beanClass, entity, methodName); - - if (returnBean instanceof ToDoElement) - { - ToDoElement bean = (ToDoElement) returnBean; - - bean.setRelatedElement(super.getRelatedElement(beanClass, entity, relationship, methodName)); - } - - return returnBean; - } - - - /** - * Retrieve the ToDoStatus enum property from the instance properties of an entity - * - * @param properties entity properties - * @return ToDoStatus enum value - */ - private ToDoStatus getToDoStatusFromProperties(InstanceProperties properties) - { - final String methodName = "getToDoStatusFromProperties"; - - ToDoStatus toDoStatus = ToDoStatus.ABANDONED; - - if (properties != null) - { - int ordinal = repositoryHelper.removeEnumPropertyOrdinal(serviceName, - OpenMetadataType.STATUS_PROPERTY_NAME, - properties, - methodName); - - switch (ordinal) - { - case 0: - toDoStatus = ToDoStatus.OPEN; - break; - - case 1: - toDoStatus = ToDoStatus.IN_PROGRESS; - break; - - case 2: - toDoStatus = ToDoStatus.WAITING; - break; - - case 3: - toDoStatus = ToDoStatus.COMPLETE; - break; - - case 99: - toDoStatus = ToDoStatus.ABANDONED; - break; - - } - - } - - return toDoStatus; - } -} diff --git a/open-metadata-implementation/access-services/digital-service/digital-service-client/src/main/java/org/odpi/openmetadata/accessservices/digitalservice/client/converters/CollectionMemberConverter.java b/open-metadata-implementation/access-services/digital-service/digital-service-client/src/main/java/org/odpi/openmetadata/accessservices/digitalservice/client/converters/CollectionMemberConverter.java index 3d6436b6feb..71dd88feb10 100644 --- a/open-metadata-implementation/access-services/digital-service/digital-service-client/src/main/java/org/odpi/openmetadata/accessservices/digitalservice/client/converters/CollectionMemberConverter.java +++ b/open-metadata-implementation/access-services/digital-service/digital-service-client/src/main/java/org/odpi/openmetadata/accessservices/digitalservice/client/converters/CollectionMemberConverter.java @@ -127,7 +127,7 @@ CollectionMemberStatus removeCollectionMemberStatus(ElementProperties elementPro if (elementProperties != null) { String retrievedProperty = propertyHelper.removeEnumProperty(serviceName, - OpenMetadataType.MEMBERSHIP_STATUS_ENUM_TYPE_NAME, + OpenMetadataType.STATUS_PROPERTY_NAME, elementProperties, methodName); diff --git a/open-metadata-implementation/framework-services/gaf-metadata-management/gaf-metadata-client/src/main/java/org/odpi/openmetadata/frameworkservices/gaf/client/OpenMetadataClientBase.java b/open-metadata-implementation/framework-services/gaf-metadata-management/gaf-metadata-client/src/main/java/org/odpi/openmetadata/frameworkservices/gaf/client/OpenMetadataClientBase.java index 5d57b8fd7aa..a473dc28dc1 100644 --- a/open-metadata-implementation/framework-services/gaf-metadata-management/gaf-metadata-client/src/main/java/org/odpi/openmetadata/frameworkservices/gaf/client/OpenMetadataClientBase.java +++ b/open-metadata-implementation/framework-services/gaf-metadata-management/gaf-metadata-client/src/main/java/org/odpi/openmetadata/frameworkservices/gaf/client/OpenMetadataClientBase.java @@ -1865,7 +1865,7 @@ public void deleteMetadataElementInStore(String userId, requestBody.setForDuplicateProcessing(forDuplicateProcessing); requestBody.setEffectiveTime(effectiveTime); - restClient.callGUIDPostRESTCall(methodName, + restClient.callVoidPostRESTCall(methodName, urlTemplate, requestBody, serverName, diff --git a/open-metadata-implementation/framework-services/gaf-metadata-management/gaf-metadata-server/src/main/java/org/odpi/openmetadata/frameworkservices/gaf/handlers/MetadataElementBuilder.java b/open-metadata-implementation/framework-services/gaf-metadata-management/gaf-metadata-server/src/main/java/org/odpi/openmetadata/frameworkservices/gaf/handlers/MetadataElementBuilder.java index ec9184d81a9..07673af7138 100644 --- a/open-metadata-implementation/framework-services/gaf-metadata-management/gaf-metadata-server/src/main/java/org/odpi/openmetadata/frameworkservices/gaf/handlers/MetadataElementBuilder.java +++ b/open-metadata-implementation/framework-services/gaf-metadata-management/gaf-metadata-server/src/main/java/org/odpi/openmetadata/frameworkservices/gaf/handlers/MetadataElementBuilder.java @@ -56,7 +56,7 @@ public class MetadataElementBuilder extends OpenMetadataAPIGenericBuilder serviceName, serverName); - this.propertyMap = propertyMap; + this.propertyMap = propertyMap; } diff --git a/open-metadata-implementation/frameworks/governance-action-framework/src/main/java/org/odpi/openmetadata/frameworks/governanceaction/converters/OpenMetadataConverterBase.java b/open-metadata-implementation/frameworks/governance-action-framework/src/main/java/org/odpi/openmetadata/frameworks/governanceaction/converters/OpenMetadataConverterBase.java index 20d7080cea7..bcbcf3142c2 100644 --- a/open-metadata-implementation/frameworks/governance-action-framework/src/main/java/org/odpi/openmetadata/frameworks/governanceaction/converters/OpenMetadataConverterBase.java +++ b/open-metadata-implementation/frameworks/governance-action-framework/src/main/java/org/odpi/openmetadata/frameworks/governanceaction/converters/OpenMetadataConverterBase.java @@ -135,7 +135,7 @@ public B getNewBean(Class beanClass, /** * Using the supplied instances, return a new instance of the bean. It is used for beans such as - * an Annotation or DataField bean which combine knowledge from the element and its linked relationships. + * an Annotation or To Do bean which combine knowledge from the element and its linked relationships. * * @param beanClass name of the class to create * @param primaryElement element that is the root of the collection of entities that make up the diff --git a/open-metadata-implementation/frameworks/governance-action-framework/src/main/java/org/odpi/openmetadata/frameworks/governanceaction/search/PropertyHelper.java b/open-metadata-implementation/frameworks/governance-action-framework/src/main/java/org/odpi/openmetadata/frameworks/governanceaction/search/PropertyHelper.java index ff06de99a8e..0e7a5e13fc8 100644 --- a/open-metadata-implementation/frameworks/governance-action-framework/src/main/java/org/odpi/openmetadata/frameworks/governanceaction/search/PropertyHelper.java +++ b/open-metadata-implementation/frameworks/governance-action-framework/src/main/java/org/odpi/openmetadata/frameworks/governanceaction/search/PropertyHelper.java @@ -114,6 +114,7 @@ public SearchProperties getSearchPropertiesByName(List propertyNames, PrimitiveTypePropertyValue propertyValue = new PrimitiveTypePropertyValue(); propertyValue.setTypeName("string"); + propertyValue.setPrimitiveTypeCategory(PrimitiveTypeCategory.OM_PRIMITIVE_TYPE_STRING); propertyValue.setPrimitiveValue(name); List propertyConditions = new ArrayList<>(); @@ -148,9 +149,9 @@ public SearchProperties getSearchPropertiesByName(List propertyNames, * @param propertyCategory category of the property * @return element properties object. */ - private ElementProperties addPrimitivePropertyToInstance(ElementProperties properties, - String propertyName, - Object propertyValue, + private ElementProperties addPrimitivePropertyToInstance(ElementProperties properties, + String propertyName, + Object propertyValue, PrimitiveTypeCategory propertyCategory) { ElementProperties resultingProperties; diff --git a/open-metadata-resources/open-metadata-archives/open-metadata-types/src/main/java/org/odpi/openmetadata/opentypes/OpenMetadataTypesArchive1_2.java b/open-metadata-resources/open-metadata-archives/open-metadata-types/src/main/java/org/odpi/openmetadata/opentypes/OpenMetadataTypesArchive1_2.java index 2bf835f76a4..7a1bff52c97 100644 --- a/open-metadata-resources/open-metadata-archives/open-metadata-types/src/main/java/org/odpi/openmetadata/opentypes/OpenMetadataTypesArchive1_2.java +++ b/open-metadata-resources/open-metadata-archives/open-metadata-types/src/main/java/org/odpi/openmetadata/opentypes/OpenMetadataTypesArchive1_2.java @@ -5842,7 +5842,7 @@ private EnumDef getToDoStatusEnum() elementDefs.add(elementDef); final int element2Ordinal = 1; - final String element2Value = "InProgress"; + final String element2Value = "In Progress"; final String element2Description = "Work is underway to complete the action."; final String element2DescriptionGUID = null; diff --git a/open-metadata-test/open-metadata-fvt/access-services-fvt/community-profile-fvt/build.gradle b/open-metadata-test/open-metadata-fvt/access-services-fvt/community-profile-fvt/build.gradle index 6063ecab9d0..07ccdf8fea6 100644 --- a/open-metadata-test/open-metadata-fvt/access-services-fvt/community-profile-fvt/build.gradle +++ b/open-metadata-test/open-metadata-fvt/access-services-fvt/community-profile-fvt/build.gradle @@ -17,10 +17,12 @@ dependencies { implementation project(':open-metadata-implementation:access-services:community-profile:community-profile-client') implementation project(':open-metadata-implementation:frameworks:audit-log-framework') implementation project(':open-metadata-implementation:frameworks:open-connector-framework') + implementation project(':open-metadata-implementation:frameworks:governance-action-framework') implementation project(':open-metadata-implementation:repository-services:repository-services-apis') implementation project(':open-metadata-implementation:admin-services:admin-services-api') implementation project(':open-metadata-implementation:common-services:ffdc-services') implementation project(':open-metadata-implementation:framework-services:ocf-metadata-management:ocf-metadata-client') + implementation project(':open-metadata-implementation:framework-services:gaf-metadata-management:gaf-metadata-client') implementation project(':open-metadata-test:open-metadata-fvt:fvt-utilities') compileOnly 'com.fasterxml.jackson.core:jackson-annotations' testImplementation project(':open-metadata-distribution:open-metadata-assemblies') diff --git a/open-metadata-test/open-metadata-fvt/access-services-fvt/community-profile-fvt/src/main/java/org/odpi/openmetadata/accessservices/communityprofile/fvt/CommunityProfileOMASFVTSuite.java b/open-metadata-test/open-metadata-fvt/access-services-fvt/community-profile-fvt/src/main/java/org/odpi/openmetadata/accessservices/communityprofile/fvt/CommunityProfileOMASFVTSuite.java index 1309bf9b033..790472efb21 100644 --- a/open-metadata-test/open-metadata-fvt/access-services-fvt/community-profile-fvt/src/main/java/org/odpi/openmetadata/accessservices/communityprofile/fvt/CommunityProfileOMASFVTSuite.java +++ b/open-metadata-test/open-metadata-fvt/access-services-fvt/community-profile-fvt/src/main/java/org/odpi/openmetadata/accessservices/communityprofile/fvt/CommunityProfileOMASFVTSuite.java @@ -5,6 +5,7 @@ import org.odpi.openmetadata.accessservices.communityprofile.fvt.clientconstructors.ClientConstructorTest; import org.odpi.openmetadata.accessservices.communityprofile.fvt.profiles.CreateProfileTest; import org.odpi.openmetadata.accessservices.communityprofile.fvt.errorhandling.InvalidParameterTest; +import org.odpi.openmetadata.accessservices.communityprofile.fvt.todos.ToDosTest; import org.odpi.openmetadata.accessservices.communityprofile.fvt.validvalues.CreateValidValuesSetTest; import org.odpi.openmetadata.fvt.utilities.FVTResults; import org.odpi.openmetadata.fvt.utilities.FVTSuiteBase; @@ -98,6 +99,13 @@ public int performFVT(String serverName, } results.printResults(serverName); + results = ToDosTest.performFVT(serverName, serverPlatformRootURL, userId); + if (! results.isSuccessful()) + { + returnCode --; + } + results.printResults(serverName); + return returnCode; } } diff --git a/open-metadata-test/open-metadata-fvt/access-services-fvt/community-profile-fvt/src/main/java/org/odpi/openmetadata/accessservices/communityprofile/fvt/todos/ToDosTest.java b/open-metadata-test/open-metadata-fvt/access-services-fvt/community-profile-fvt/src/main/java/org/odpi/openmetadata/accessservices/communityprofile/fvt/todos/ToDosTest.java new file mode 100644 index 00000000000..59463cc151d --- /dev/null +++ b/open-metadata-test/open-metadata-fvt/access-services-fvt/community-profile-fvt/src/main/java/org/odpi/openmetadata/accessservices/communityprofile/fvt/todos/ToDosTest.java @@ -0,0 +1,888 @@ +/* SPDX-License-Identifier: Apache-2.0 */ +/* Copyright Contributors to the ODPi Egeria project. */ + +package org.odpi.openmetadata.accessservices.communityprofile.fvt.todos; + + +import org.odpi.openmetadata.accessservices.communityprofile.client.OpenMetadataStoreClient; +import org.odpi.openmetadata.accessservices.communityprofile.client.ToDoActionManagement; +import org.odpi.openmetadata.accessservices.communityprofile.metadataelements.ActionTargetElement; +import org.odpi.openmetadata.accessservices.communityprofile.metadataelements.ToDoElement; +import org.odpi.openmetadata.accessservices.communityprofile.properties.NewActionTargetProperties; +import org.odpi.openmetadata.accessservices.communityprofile.properties.ToDoProperties; +import org.odpi.openmetadata.accessservices.communityprofile.properties.ToDoStatus; +import org.odpi.openmetadata.adminservices.configuration.registration.AccessServiceDescription; +import org.odpi.openmetadata.frameworks.auditlog.AuditLog; +import org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException; +import org.odpi.openmetadata.frameworks.connectors.properties.beans.ElementStatus; +import org.odpi.openmetadata.frameworks.connectors.properties.beans.ElementStub; +import org.odpi.openmetadata.frameworks.governanceaction.client.OpenMetadataClient; +import org.odpi.openmetadata.frameworks.governanceaction.mapper.OpenMetadataProperty; +import org.odpi.openmetadata.frameworks.governanceaction.properties.OpenMetadataElement; +import org.odpi.openmetadata.frameworks.governanceaction.search.ElementProperties; +import org.odpi.openmetadata.frameworks.governanceaction.search.PropertyHelper; +import org.odpi.openmetadata.fvt.utilities.FVTResults; +import org.odpi.openmetadata.fvt.utilities.auditlog.FVTAuditLogDestination; +import org.odpi.openmetadata.fvt.utilities.exceptions.FVTUnexpectedCondition; + +import java.util.ArrayList; +import java.util.List; + +/** + * CreateToDoTest calls the ToDoManagementClient to create a "to do" + * and then retrieve the results. + */ +public class ToDosTest +{ + private final static String testCaseName = "ToDosTest"; + + private final static String toDoName = "TestToDo"; + private final static String toDoDisplayName = "ToDo displayName"; + private final static String toDoDescription = "ToDo description"; + private final static String toDoType = "ToDo Type"; + private final static String badToDoType = "ToDo Type Bad"; + + private static final String assetTypeName = "DataFile"; + private final static String assetQualifiedName = "TestAssetQName"; + private final static String actionTargetName = "Asset To Work On"; + + private static final String originatorTypeName = "GovernanceActionService"; + private final static String originatorQualifiedName = "GovernanceActionServiceQName"; + + private static final String sponsorTypeName = "Project"; + private final static String sponsorQualifiedName = "ProjectQName"; + + private static final String userTypeName = "UserIdentity"; + private static final String userQualifiedName = "TestUser Qualified Name"; + + + private final PropertyHelper propertyHelper = new PropertyHelper(); + + + /** + * Run all the defined tests and capture the results. + * + * @param serverName name of the server to connect to + * @param serverPlatformRootURL the network address of the server running the OMAS REST servers + * @param userId calling user + * @return results of running test + */ + public static FVTResults performFVT(String serverName, + String serverPlatformRootURL, + String userId) + { + FVTResults results = new FVTResults(testCaseName); + + results.incrementNumberOfTests(); + try + { + ToDosTest.runIt(serverPlatformRootURL, serverName, userId, results.getAuditLogDestination()); + results.incrementNumberOfSuccesses(); + } + catch (Exception error) + { + results.addCapturedError(error); + } + + return results; + } + + + /** + * Run all the tests in this class. + * + * @param serverPlatformRootURL root url of the server + * @param serverName name of the server + * @param userId calling user + * @param auditLogDestination logging destination + * @throws FVTUnexpectedCondition the test case failed + */ + private static void runIt(String serverPlatformRootURL, + String serverName, + String userId, + FVTAuditLogDestination auditLogDestination) throws FVTUnexpectedCondition + { + ToDosTest thisTest = new ToDosTest(); + + AuditLog auditLog = new AuditLog(auditLogDestination, + AccessServiceDescription.COMMUNITY_PROFILE_OMAS.getAccessServiceCode(), + AccessServiceDescription.COMMUNITY_PROFILE_OMAS.getAccessServiceDevelopmentStatus(), + AccessServiceDescription.COMMUNITY_PROFILE_OMAS.getAccessServiceName(), + AccessServiceDescription.COMMUNITY_PROFILE_OMAS.getAccessServiceDescription(), + AccessServiceDescription.COMMUNITY_PROFILE_OMAS.getAccessServiceWiki()); + + ToDoActionManagement toDoClient = thisTest.getToDoClient(serverName, serverPlatformRootURL, auditLog); + OpenMetadataClient openMetadataClient = thisTest.getOpenMetadataClient(serverName, serverPlatformRootURL); + + String assetGUID = thisTest.getAsset(openMetadataClient, userId); + String originatorGUID = thisTest.getOriginator(openMetadataClient, userId); + String actorGUID = thisTest.getActor(openMetadataClient, userId); + String sponsorGUID = thisTest.getSponsor(openMetadataClient, userId); + String toDoGUID = thisTest.getToDo(toDoClient, userId, assetGUID, sponsorGUID, originatorGUID, actorGUID); + + String activityName = "create"; + + thisTest.checkToDoOK(activityName, toDoClient, toDoGUID,0, ToDoStatus.OPEN, assetGUID, sponsorGUID, originatorGUID, actorGUID, userId); + + activityName = "update"; + + try + { + ToDoProperties toDoProperties = new ToDoProperties(); + + toDoProperties.setPriority(100); + toDoProperties.setStatus(ToDoStatus.IN_PROGRESS); + toDoClient.updateToDo(userId, toDoGUID, true, toDoProperties); + + thisTest.checkToDoOK(activityName, toDoClient, toDoGUID, 100, ToDoStatus.IN_PROGRESS, assetGUID, sponsorGUID, originatorGUID, actorGUID, userId); + + activityName = "delete"; + toDoClient.deleteToDo(userId, toDoGUID); + + thisTest.checkToDoGone(toDoClient, toDoGUID, userId); + } + catch (Exception unexpectedError) + { + throw new FVTUnexpectedCondition(testCaseName, activityName, unexpectedError); + } + } + + + /** + * Create and return a client. + * + * @param serverName name of the server to connect to + * @param serverPlatformRootURL the network address of the server running the OMAS REST servers + * @param auditLog logging destination + * @return client + * @throws FVTUnexpectedCondition the test case failed + */ + private ToDoActionManagement getToDoClient(String serverName, + String serverPlatformRootURL, + AuditLog auditLog) throws FVTUnexpectedCondition + { + final String activityName = "getToDoActionManagement"; + + try + { + return new ToDoActionManagement(serverName, serverPlatformRootURL, auditLog); + } + catch (Exception unexpectedError) + { + throw new FVTUnexpectedCondition(testCaseName, activityName, unexpectedError); + } + } + + + /** + * Create and return a client. + * + * @param serverName name of the server to connect to + * @param serverPlatformRootURL the network address of the server running the OMAS REST servers + * @return client + * @throws FVTUnexpectedCondition the test case failed + */ + private OpenMetadataClient getOpenMetadataClient(String serverName, + String serverPlatformRootURL) throws FVTUnexpectedCondition + { + final String activityName = "getOpenMetadataClient"; + + try + { + return new OpenMetadataStoreClient(serverName, serverPlatformRootURL); + } + catch (Exception unexpectedError) + { + throw new FVTUnexpectedCondition(testCaseName, activityName, unexpectedError); + } + } + + + /** + * Create an asset and return its GUID. + * + * @param client interface to Community Profile OMAS + * @param userId calling user + * @return GUID of asset + * @throws FVTUnexpectedCondition the test case failed + */ + private String getAsset(OpenMetadataClient client, + String userId) throws FVTUnexpectedCondition + { + final String activityName = "getAsset"; + + try + { + ElementProperties properties = propertyHelper.addStringProperty(null, + OpenMetadataProperty.QUALIFIED_NAME.name, + assetQualifiedName); + + String assetGUID = client.createMetadataElementInStore(userId, + assetTypeName, + ElementStatus.ACTIVE, + null, + null, + properties); + + if (assetGUID == null) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(no assetGUID for Create)"); + } + + return assetGUID; + } + catch (FVTUnexpectedCondition testCaseError) + { + throw testCaseError; + } + catch (Exception unexpectedError) + { + throw new FVTUnexpectedCondition(testCaseName, activityName, unexpectedError); + } + } + + + /** + * Create a governance action service and return its GUID. + * + * @param client interface to Community Profile OMAS + * @param userId calling user + * @return GUID of asset + * @throws FVTUnexpectedCondition the test case failed + */ + private String getOriginator(OpenMetadataClient client, + String userId) throws FVTUnexpectedCondition + { + final String activityName = "getOriginator"; + + try + { + ElementProperties properties = propertyHelper.addStringProperty(null, + OpenMetadataProperty.QUALIFIED_NAME.name, + originatorQualifiedName); + + String originatorGUID = client.createMetadataElementInStore(userId, + originatorTypeName, + ElementStatus.ACTIVE, + null, + null, + properties); + + if (originatorGUID == null) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(no originatorGUID for Create)"); + } + + return originatorGUID; + } + catch (FVTUnexpectedCondition testCaseError) + { + throw testCaseError; + } + catch (Exception unexpectedError) + { + throw new FVTUnexpectedCondition(testCaseName, activityName, unexpectedError); + } + } + + + /** + * Create an actor and return its GUID. + * + * @param client interface to Community Profile OMAS + * @param userId calling user + * @return GUID of asset + * @throws FVTUnexpectedCondition the test case failed + */ + private String getActor(OpenMetadataClient client, + String userId) throws FVTUnexpectedCondition + { + final String activityName = "getActor"; + + try + { + ElementProperties properties = propertyHelper.addStringProperty(null, + OpenMetadataProperty.QUALIFIED_NAME.name, + userQualifiedName); + + String actorGUID = client.createMetadataElementInStore(userId, + userTypeName, + ElementStatus.ACTIVE, + null, + null, + properties); + + if (actorGUID == null) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(no actorGUID for Create)"); + } + + return actorGUID; + } + catch (FVTUnexpectedCondition testCaseError) + { + throw testCaseError; + } + catch (Exception unexpectedError) + { + throw new FVTUnexpectedCondition(testCaseName, activityName, unexpectedError); + } + } + + + /** + * Create a sponsor and return its GUID. + * + * @param client interface to Community Profile OMAS + * @param userId calling user + * @return GUID of asset + * @throws FVTUnexpectedCondition the test case failed + */ + private String getSponsor(OpenMetadataClient client, + String userId) throws FVTUnexpectedCondition + { + final String activityName = "getSponsor"; + + try + { + ElementProperties properties = propertyHelper.addStringProperty(null, + OpenMetadataProperty.QUALIFIED_NAME.name, + sponsorQualifiedName); + + String sponsorGUID = client.createMetadataElementInStore(userId, + sponsorTypeName, + ElementStatus.ACTIVE, + null, + null, + properties); + + if (sponsorGUID == null) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(no sponsorGUID for Create)"); + } + + return sponsorGUID; + } + catch (FVTUnexpectedCondition testCaseError) + { + throw testCaseError; + } + catch (Exception unexpectedError) + { + throw new FVTUnexpectedCondition(testCaseName, activityName, unexpectedError); + } + } + + + /** + * Create a "to Do" and return its GUID. + * + * @param client interface to Community Profile OMAS + * @param userId calling user + * @param assetGUID asset action target + * @param sponsorGUID unique identifier of sponsor + * @param originatorGUID unique identifier of originator + * @param actorGUID unique identifier of actor assigned to work + * @return GUID of to Do + * @throws FVTUnexpectedCondition the test case failed + */ + private String getToDo(ToDoActionManagement client, + String userId, + String assetGUID, + String sponsorGUID, + String originatorGUID, + String actorGUID) throws FVTUnexpectedCondition + { + final String activityName = "getToDo"; + + try + { + ToDoProperties properties = new ToDoProperties(); + + properties.setQualifiedName(toDoName); + properties.setName(toDoDisplayName); + properties.setDescription(toDoDescription); + properties.setToDoType(toDoType); + + List actionTargetPropertiesList = new ArrayList<>(); + + NewActionTargetProperties newActionTargetProperties = new NewActionTargetProperties(); + newActionTargetProperties.setActionTargetGUID(assetGUID); + newActionTargetProperties.setActionTargetName(actionTargetName); + + actionTargetPropertiesList.add(newActionTargetProperties); + + + String toDoGUID = client.createToDo(userId, originatorGUID, sponsorGUID, actorGUID, actionTargetPropertiesList, properties); + + if (toDoGUID == null) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(no GUID for Create)"); + } + + return toDoGUID; + } + catch (FVTUnexpectedCondition testCaseError) + { + throw testCaseError; + } + catch (Exception unexpectedError) + { + throw new FVTUnexpectedCondition(testCaseName, activityName, unexpectedError); + } + } + + + /** + * Check to Do is ok. + * + * @param activityName name of caller + * @param client interface to Community Profile OMAS + * @param toDoGUID unique id of the to do + * @param priority priority of the to do + * @param toDoStatus expected status of to do + * @param assetGUID asset action target + * @param sponsorGUID unique identifier of sponsor + * @param originatorGUID unique identifier of originator + * @param actorGUID unique identifier of actor assigned to work + * @param userId calling user + * @throws FVTUnexpectedCondition the test case failed + */ + private void checkToDoOK(String activityName, + ToDoActionManagement client, + String toDoGUID, + int priority, + ToDoStatus toDoStatus, + String assetGUID, + String sponsorGUID, + String originatorGUID, + String actorGUID, + String userId) throws FVTUnexpectedCondition + { + try + { + ToDoElement retrievedElement = client.getToDo(userId, toDoGUID); + + System.out.println(activityName + " element: " + retrievedElement); + checkToDoElementOK(retrievedElement, + toDoGUID, + priority, + toDoStatus, + assetGUID, + sponsorGUID, + originatorGUID, + actorGUID); + + List toDoElements = client.getAssignedActions(userId, actorGUID, ToDoStatus.ABANDONED, 0, 0); + + if (toDoElements != null) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(Elements for actor retrieved from bad status) =>> " + toDoElements); + } + + toDoElements = client.getAssignedActions(userId, actorGUID, toDoStatus, 0, 0); + + if (toDoElements == null) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(No elements for actor retrieved from current status)"); + } + if (toDoElements.size() != 1) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(Wrong number of elements for actor retrieved from current status) =>> " + toDoElements); + } + + checkToDoElementOK(toDoElements.get(0), + toDoGUID, + priority, + toDoStatus, + assetGUID, + sponsorGUID, + originatorGUID, + actorGUID); + + toDoElements = client.getAssignedActions(userId, actorGUID, null, 0, 0); + + if (toDoElements == null) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(No elements for actor retrieved from no status)"); + } + if (toDoElements.size() != 1) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(Wrong number of elements for actor retrieved from no status) =>> " + toDoElements); + } + + checkToDoElementOK(toDoElements.get(0), + toDoGUID, + priority, + toDoStatus, + assetGUID, + sponsorGUID, + originatorGUID, + actorGUID); + + /*--*/ + + toDoElements = client.getActionsForSponsor(userId, sponsorGUID, ToDoStatus.ABANDONED, 0, 0); + + if (toDoElements != null) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(Elements for sponsor retrieved from bad status) =>> " + toDoElements); + } + + toDoElements = client.getActionsForSponsor(userId, sponsorGUID, toDoStatus, 0, 0); + + if (toDoElements == null) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(No elements for sponsor retrieved from current status)"); + } + if (toDoElements.size() != 1) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(Wrong number of elements for sponsor retrieved from current status) =>> " + toDoElements); + } + + checkToDoElementOK(toDoElements.get(0), + toDoGUID, + priority, + toDoStatus, + assetGUID, + sponsorGUID, + originatorGUID, + actorGUID); + + toDoElements = client.getActionsForSponsor(userId, sponsorGUID, null, 0, 0); + + if (toDoElements == null) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(No elements for sponsor retrieved from no status)"); + } + if (toDoElements.size() != 1) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(Wrong number of elements for sponsor retrieved from no status) =>> " + toDoElements); + } + + checkToDoElementOK(toDoElements.get(0), + toDoGUID, + priority, + toDoStatus, + assetGUID, + sponsorGUID, + originatorGUID, + actorGUID); + + /*--*/ + + toDoElements = client.getActionsForActionTarget(userId, assetGUID, ToDoStatus.ABANDONED, 0, 0); + + if (toDoElements != null) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(Elements for action target retrieved from bad status) =>> " + toDoElements); + } + + toDoElements = client.getActionsForActionTarget(userId, assetGUID, toDoStatus, 0, 0); + + if (toDoElements == null) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(No elements for action target retrieved from current status)"); + } + if (toDoElements.size() != 1) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(Wrong number of elements for action target retrieved from current status) =>> " + toDoElements); + } + + checkToDoElementOK(toDoElements.get(0), + toDoGUID, + priority, + toDoStatus, + assetGUID, + sponsorGUID, + originatorGUID, + actorGUID); + + toDoElements = client.getActionsForActionTarget(userId, assetGUID, null, 0, 0); + + if (toDoElements == null) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(No elements for action target retrieved from no status)"); + } + if (toDoElements.size() != 1) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(Wrong number of elements for action target retrieved from no status) =>> " + toDoElements); + } + + checkToDoElementOK(toDoElements.get(0), + toDoGUID, + priority, + toDoStatus, + assetGUID, + sponsorGUID, + originatorGUID, + actorGUID); + /*--*/ + + toDoElements = client.getToDosByType(userId, badToDoType, null, 0, 0); + + if (toDoElements != null) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(Elements for bad toDoType retrieved) =>> " + toDoElements); + } + + toDoElements = client.getToDosByType(userId, toDoType, ToDoStatus.ABANDONED, 0, 0); + + if (toDoElements != null) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(Elements for toDoType retrieved from bad status) =>> " + toDoElements); + } + + toDoElements = client.getToDosByType(userId, toDoType, toDoStatus, 0, 0); + + if (toDoElements == null) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(No elements for toDoType retrieved from current status)"); + } + if (toDoElements.size() != 1) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(Wrong number of elements for toDoType retrieved from current status) =>> " + toDoElements); + } + + checkToDoElementOK(toDoElements.get(0), + toDoGUID, + priority, + toDoStatus, + assetGUID, + sponsorGUID, + originatorGUID, + actorGUID); + + toDoElements = client.getToDosByType(userId, toDoType, null, 0, 0); + + if (toDoElements == null) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(No elements for toDoType retrieved from no status)"); + } + if (toDoElements.size() != 1) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(Wrong number of elements for toDoType retrieved from no status) =>> " + toDoElements); + } + + checkToDoElementOK(toDoElements.get(0), + toDoGUID, + priority, + toDoStatus, + assetGUID, + sponsorGUID, + originatorGUID, + actorGUID); + } + catch (FVTUnexpectedCondition testCaseError) + { + throw testCaseError; + } + catch (Exception unexpectedError) + { + throw new FVTUnexpectedCondition(testCaseName, activityName, unexpectedError); + } + } + + + /** + * Check to Do is ok. + * + * @param retrievedElement retrieved element + * @param toDoGUID unique id of the to Do + * @param priority priority of the to do + * @param toDoStatus status + * @param assetGUID asset action target + * @param sponsorGUID unique identifier of sponsor + * @param originatorGUID unique identifier of originator + * @param actorGUID unique identifier of actor assigned to work + * @throws FVTUnexpectedCondition the test case failed + */ + private void checkToDoElementOK(ToDoElement retrievedElement, + String toDoGUID, + int priority, + ToDoStatus toDoStatus, + String assetGUID, + String sponsorGUID, + String originatorGUID, + String actorGUID) throws FVTUnexpectedCondition + { + String activityName = "checkToDoElementOK"; + + try + { + if (retrievedElement == null) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(no ToDoElement from Retrieve)"); + } + + if (!toDoGUID.equals(retrievedElement.getElementHeader().getGUID())) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(Bad GUID from Retrieve) =>> " + retrievedElement.getElementHeader().getGUID()); + } + + ToDoProperties properties = retrievedElement.getProperties(); + + if (properties == null) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(no ToDoProperties from Retrieve)"); + } + + + if (!toDoName.equals(properties.getQualifiedName())) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(Bad qualifiedName from Retrieve) =>> " + properties); + } + if (!toDoDisplayName.equals(properties.getName())) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(Bad displayName from Retrieve) =>>" + properties); + } + if (!toDoDescription.equals(properties.getDescription())) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(Bad description from Retrieve) =>> " + properties); + } + if (priority != properties.getPriority()) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(Bad priority from Retrieve) =>> " + properties); + } + if (toDoStatus != properties.getStatus()) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(Bad status from Retrieve) =>> " + properties.getStatus() + " rather than " + toDoStatus + ": " + properties); + } + + if (retrievedElement.getToDoSource() == null) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(Null ToDoSource from Retrieve)"); + } + if (! originatorGUID.equals(retrievedElement.getToDoSource().getGUID())) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(Bad ToDoSource GUID from Retrieve) =>>" + retrievedElement.getToDoSource().getGUID()); + } + if (! originatorQualifiedName.equals(retrievedElement.getToDoSource().getUniqueName())) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(Bad ToDoSource Unique name from Retrieve) =>>" + retrievedElement.getToDoSource().getUniqueName()); + } + + if (retrievedElement.getAssignedActors() == null) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(Null AssignedActors from Retrieve)"); + } + if (retrievedElement.getAssignedActors().size() != 1) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(Bas Number of AssignedActors from Retrieve) =>> "); + } + + ElementStub assignedActor = retrievedElement.getAssignedActors().get(0); + + if (assignedActor == null) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(Null AssignedActor from Retrieve)"); + } + if (! actorGUID.equals(assignedActor.getGUID())) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(Bad AssignedActor GUID from Retrieve) =>> " + assignedActor.getGUID()); + } + if (! userQualifiedName.equals(assignedActor.getUniqueName())) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(Bad AssignedActor Unique Name from Retrieve) =>> " + assignedActor.getUniqueName()); + } + + + if (retrievedElement.getSponsors() == null) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(Null Sponsors from Retrieve)"); + } + if (retrievedElement.getSponsors().size() != 1) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(Bad number of Sponsors from Retrieve) =>> "); + } + + ElementStub sponsor = retrievedElement.getSponsors().get(0); + + if (sponsor == null) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(Null Sponsor from Retrieve)"); + } + if (! sponsorGUID.equals(sponsor.getGUID())) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(Bad Sponsor GUID from Retrieve) =>> " + sponsor.getGUID()); + } + if (! sponsorQualifiedName.equals(sponsor.getUniqueName())) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(Bad Sponsor Unique Name from Retrieve) =>> " + sponsor.getUniqueName()); + } + + if (retrievedElement.getActionTargets() == null) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(Null action targets from Retrieve)"); + } + if (retrievedElement.getActionTargets().size() != 1) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(Bad number of action targets from Retrieve) =>> "); + } + + ActionTargetElement actionTarget = retrievedElement.getActionTargets().get(0); + + if (actionTarget == null) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(Null action target from Retrieve)"); + } + if (! assetGUID.equals(actionTarget.getTargetElement().getElementGUID())) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(Bad action target GUID from Retrieve) =>> " + actionTarget.getTargetElement().getElementGUID()); + } + + if (! actionTargetName.equals(actionTarget.getRelationshipProperties().getActionTargetName())) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(Bad action target name from Retrieve) =>> " + actionTarget.getRelationshipProperties().getActionTargetName()); + } + } + catch (FVTUnexpectedCondition testCaseError) + { + throw testCaseError; + } + catch (Exception unexpectedError) + { + throw new FVTUnexpectedCondition(testCaseName, activityName, unexpectedError); + } + } + + + /** + * Check a "to Do" is gone. + * + * @param client interface to Community Profile OMAS + * @param toDoGUID unique id of the to Do to test + * @param userId calling user + * @throws FVTUnexpectedCondition the test case failed + */ + private void checkToDoGone(ToDoActionManagement client, + String toDoGUID, + String userId) throws FVTUnexpectedCondition + { + String activityName = "checkToDoGone"; + + try + { + ToDoElement retrievedElement = client.getToDo(userId, toDoGUID); + + if (retrievedElement != null) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(ToDo returned from Retrieve)"); + } + + throw new FVTUnexpectedCondition(testCaseName, activityName + "(Retrieve returned)"); + } + catch (InvalidParameterException expectedException) + { + // all ok + } + catch (FVTUnexpectedCondition testCaseError) + { + throw testCaseError; + } + catch (Exception unexpectedError) + { + throw new FVTUnexpectedCondition(testCaseName, activityName, unexpectedError); + } + } +} diff --git a/open-metadata-test/open-metadata-fvt/access-services-fvt/community-profile-fvt/src/main/java/org/odpi/openmetadata/accessservices/communityprofile/fvt/todos/package-info.java b/open-metadata-test/open-metadata-fvt/access-services-fvt/community-profile-fvt/src/main/java/org/odpi/openmetadata/accessservices/communityprofile/fvt/todos/package-info.java new file mode 100644 index 00000000000..9db3d4d6a29 --- /dev/null +++ b/open-metadata-test/open-metadata-fvt/access-services-fvt/community-profile-fvt/src/main/java/org/odpi/openmetadata/accessservices/communityprofile/fvt/todos/package-info.java @@ -0,0 +1,8 @@ +/* SPDX-License-Identifier: Apache-2.0 */ +/* Copyright Contributors to the ODPi Egeria project. */ + +/** + * This package contains tests for managing to do metadata. + */ + +package org.odpi.openmetadata.accessservices.communityprofile.fvt.todos; diff --git a/open-metadata-test/open-metadata-fvt/access-services-fvt/community-profile-fvt/src/test/java/org/odpi/openmetadata/accessservices/communityprofile/fvt/execution/CommunityProfileOMASCreateToDoIT.java b/open-metadata-test/open-metadata-fvt/access-services-fvt/community-profile-fvt/src/test/java/org/odpi/openmetadata/accessservices/communityprofile/fvt/execution/CommunityProfileOMASCreateToDoIT.java new file mode 100644 index 00000000000..79a425f3a8d --- /dev/null +++ b/open-metadata-test/open-metadata-fvt/access-services-fvt/community-profile-fvt/src/test/java/org/odpi/openmetadata/accessservices/communityprofile/fvt/execution/CommunityProfileOMASCreateToDoIT.java @@ -0,0 +1,36 @@ +/* SPDX-License-Identifier: Apache-2.0 */ +/* Copyright Contributors to the ODPi Egeria project. */ + +package org.odpi.openmetadata.accessservices.communityprofile.fvt.execution; + +import org.apache.commons.lang3.StringUtils; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.ValueSource; +import org.odpi.openmetadata.accessservices.communityprofile.fvt.todos.ToDosTest; +import org.odpi.openmetadata.fvt.utilities.FVTConstants; +import org.odpi.openmetadata.fvt.utilities.FVTResults; +import org.odpi.openmetadata.http.HttpHelper; + +import static org.junit.jupiter.api.Assertions.assertTrue; + +/** + * CommunityProfileOMASCreateToDoIT is the failsafe wrapper for ToDosTest. + */ +public class CommunityProfileOMASCreateToDoIT +{ + @BeforeAll + public static void disableStrictSSL(){ + HttpHelper.noStrictSSL(); + } + + @ParameterizedTest + @ValueSource(strings = {FVTConstants.IN_MEMORY_SERVER}) + public void testCreateToDo(String serverName) + { + FVTResults results = ToDosTest.performFVT(serverName, StringUtils.defaultIfEmpty(System.getProperty("fvt.url"), FVTConstants.SERVER_PLATFORM_URL_ROOT), FVTConstants.USERID); + + results.printResults(serverName); + assertTrue(results.isSuccessful()); + } +}