@Test void createProcess_throwsUserNotAuthorizedException() throws UserNotAuthorizedException, PropertyServerException, InvocationTargetException, NoSuchMethodException, InstantiationException, IllegalAccessException, InvalidParameterException { String methodName = "createProcess"; UserNotAuthorizedException mockedException = mockException(UserNotAuthorizedException.class, methodName); when(dataEngineCommonHandler.createExternalEntity(USER, null, InstanceStatus.DRAFT, ProcessPropertiesMapper.PROCESS_TYPE_NAME, EXTERNAL_SOURCE_DE_QUALIFIED_NAME)).thenThrow(mockedException); UserNotAuthorizedException thrown = assertThrows(UserNotAuthorizedException.class, () -> processHandler.createProcess(USER, getProcess(), EXTERNAL_SOURCE_DE_QUALIFIED_NAME)); assertTrue(thrown.getMessage().contains("OMAS-DATA-ENGINE-404-001 ")); }
public String createProcess(String userId, Process process, String externalSourceName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException { final String methodName = "createProcess"; initializeAssetZoneMembership(process); securityVerifier.validateUserForAssetCreate(userId, process); validateProcessParameters(userId, process.getQualifiedName(), methodName); ProcessPropertiesBuilder builder = new ProcessPropertiesBuilder(process.getQualifiedName(), process.getName(), process.getDisplayName(), process.getDescription(), process.getOwner(), process.getOwnerType(), process.getZoneMembership(), process.getLatestChange(), process.getFormula(), null, null, repositoryHelper, serverName, serviceName); String processGUID = dataEngineCommonHandler.createExternalEntity(userId, builder.getInstanceProperties(methodName), InstanceStatus.DRAFT, ProcessPropertiesMapper.PROCESS_TYPE_NAME, externalSourceName); classifyAsset(userId, process, processGUID); return processGUID; }
ProcessHandler { public String createProcess(String userId, Process process, String externalSourceName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException { final String methodName = "createProcess"; initializeAssetZoneMembership(process); securityVerifier.validateUserForAssetCreate(userId, process); validateProcessParameters(userId, process.getQualifiedName(), methodName); ProcessPropertiesBuilder builder = new ProcessPropertiesBuilder(process.getQualifiedName(), process.getName(), process.getDisplayName(), process.getDescription(), process.getOwner(), process.getOwnerType(), process.getZoneMembership(), process.getLatestChange(), process.getFormula(), null, null, repositoryHelper, serverName, serviceName); String processGUID = dataEngineCommonHandler.createExternalEntity(userId, builder.getInstanceProperties(methodName), InstanceStatus.DRAFT, ProcessPropertiesMapper.PROCESS_TYPE_NAME, externalSourceName); classifyAsset(userId, process, processGUID); return processGUID; } }
ProcessHandler { public String createProcess(String userId, Process process, String externalSourceName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException { final String methodName = "createProcess"; initializeAssetZoneMembership(process); securityVerifier.validateUserForAssetCreate(userId, process); validateProcessParameters(userId, process.getQualifiedName(), methodName); ProcessPropertiesBuilder builder = new ProcessPropertiesBuilder(process.getQualifiedName(), process.getName(), process.getDisplayName(), process.getDescription(), process.getOwner(), process.getOwnerType(), process.getZoneMembership(), process.getLatestChange(), process.getFormula(), null, null, repositoryHelper, serverName, serviceName); String processGUID = dataEngineCommonHandler.createExternalEntity(userId, builder.getInstanceProperties(methodName), InstanceStatus.DRAFT, ProcessPropertiesMapper.PROCESS_TYPE_NAME, externalSourceName); classifyAsset(userId, process, processGUID); return processGUID; } ProcessHandler(String serviceName, String serverName, InvalidParameterHandler invalidParameterHandler,
                          RepositoryHandler repositoryHandler, OMRSRepositoryHelper repositoryHelper, AssetHandler assetHandler,
                          DataEngineCommonHandler dataEngineCommonHandler, List<String> defaultZones, List<String> supportedZones); }
ProcessHandler { public String createProcess(String userId, Process process, String externalSourceName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException { final String methodName = "createProcess"; initializeAssetZoneMembership(process); securityVerifier.validateUserForAssetCreate(userId, process); validateProcessParameters(userId, process.getQualifiedName(), methodName); ProcessPropertiesBuilder builder = new ProcessPropertiesBuilder(process.getQualifiedName(), process.getName(), process.getDisplayName(), process.getDescription(), process.getOwner(), process.getOwnerType(), process.getZoneMembership(), process.getLatestChange(), process.getFormula(), null, null, repositoryHelper, serverName, serviceName); String processGUID = dataEngineCommonHandler.createExternalEntity(userId, builder.getInstanceProperties(methodName), InstanceStatus.DRAFT, ProcessPropertiesMapper.PROCESS_TYPE_NAME, externalSourceName); classifyAsset(userId, process, processGUID); return processGUID; } ProcessHandler(String serviceName, String serverName, InvalidParameterHandler invalidParameterHandler,
                          RepositoryHandler repositoryHandler, OMRSRepositoryHelper repositoryHelper, AssetHandler assetHandler,
                          DataEngineCommonHandler dataEngineCommonHandler, List<String> defaultZones, List<String> supportedZones); void setSecurityVerifier(OpenMetadataServerSecurityVerifier securityVerifier); String createProcess(String userId, Process process, String externalSourceName); void updateProcess(String userId, EntityDetail originalProcessEntity, Process updatedProcess); Optional<EntityDetail> findProcessEntity(String userId, String qualifiedName); void addProcessPortRelationship(String userId, String processGUID, String portGUID, String externalSourceName); void updateProcessStatus(String userId, String guid, InstanceStatus instanceStatus); Set<String> getPortsForProcess(String userId, String processGUID, String portTypeName); void createOrUpdateProcessHierarchyRelationship(String userId, ParentProcess parentProcess, String processGUID,
                                                           String externalSourceName); }
ProcessHandler { public String createProcess(String userId, Process process, String externalSourceName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException { final String methodName = "createProcess"; initializeAssetZoneMembership(process); securityVerifier.validateUserForAssetCreate(userId, process); validateProcessParameters(userId, process.getQualifiedName(), methodName); ProcessPropertiesBuilder builder = new ProcessPropertiesBuilder(process.getQualifiedName(), process.getName(), process.getDisplayName(), process.getDescription(), process.getOwner(), process.getOwnerType(), process.getZoneMembership(), process.getLatestChange(), process.getFormula(), null, null, repositoryHelper, serverName, serviceName); String processGUID = dataEngineCommonHandler.createExternalEntity(userId, builder.getInstanceProperties(methodName), InstanceStatus.DRAFT, ProcessPropertiesMapper.PROCESS_TYPE_NAME, externalSourceName); classifyAsset(userId, process, processGUID); return processGUID; } ProcessHandler(String serviceName, String serverName, InvalidParameterHandler invalidParameterHandler,
                          RepositoryHandler repositoryHandler, OMRSRepositoryHelper repositoryHelper, AssetHandler assetHandler,
                          DataEngineCommonHandler dataEngineCommonHandler, List<String> defaultZones, List<String> supportedZones); void setSecurityVerifier(OpenMetadataServerSecurityVerifier securityVerifier); String createProcess(String userId, Process process, String externalSourceName); void updateProcess(String userId, EntityDetail originalProcessEntity, Process updatedProcess); Optional<EntityDetail> findProcessEntity(String userId, String qualifiedName); void addProcessPortRelationship(String userId, String processGUID, String portGUID, String externalSourceName); void updateProcessStatus(String userId, String guid, InstanceStatus instanceStatus); Set<String> getPortsForProcess(String userId, String processGUID, String portTypeName); void createOrUpdateProcessHierarchyRelationship(String userId, ParentProcess parentProcess, String processGUID,
                                                           String externalSourceName);  }