@Test void getExternalDataEngineByQualifiedName_throwsUserNotAuthorizedException() throws UserNotAuthorizedException, PropertyServerException, InvocationTargetException, NoSuchMethodException, InstantiationException, IllegalAccessException { String methodName = "getExternalDataEngineByQualifiedName"; UserNotAuthorizedException mockedException = mockException(UserNotAuthorizedException.class, methodName); when(repositoryHandler.getUniqueEntityByName(USER, QUALIFIED_NAME, DataEnginePropertiesMapper.QUALIFIED_NAME_PROPERTY_NAME, null, DataEnginePropertiesMapper.SOFTWARE_SERVER_CAPABILITY_TYPE_GUID, DataEnginePropertiesMapper.SOFTWARE_SERVER_CAPABILITY_TYPE_NAME, methodName)).thenThrow(mockedException); UserNotAuthorizedException thrown = assertThrows(UserNotAuthorizedException.class, () -> registrationHandler.getExternalDataEngineByQualifiedName(USER, QUALIFIED_NAME)); assertTrue(thrown.getMessage().contains("OMAS-DATA-ENGINE-404-001 ")); }
public String getExternalDataEngineByQualifiedName(String userId, String qualifiedName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException { final String methodName = "getExternalDataEngineByQualifiedName"; qualifiedName = repositoryHelper.getExactMatchRegex(qualifiedName); invalidParameterHandler.validateUserId(userId, methodName); invalidParameterHandler.validateName(qualifiedName, DataEnginePropertiesMapper.QUALIFIED_NAME_PROPERTY_NAME, methodName); InstanceProperties properties = repositoryHelper.addStringPropertyToInstance(serviceName, null, DataEnginePropertiesMapper.QUALIFIED_NAME_PROPERTY_NAME, qualifiedName, methodName); TypeDef entityTypeDef = repositoryHelper.getTypeDefByName(userId, DataEnginePropertiesMapper.SOFTWARE_SERVER_CAPABILITY_TYPE_NAME); EntityDetail retrievedEntity = repositoryHandler.getUniqueEntityByName(userId, qualifiedName, DataEnginePropertiesMapper.QUALIFIED_NAME_PROPERTY_NAME, properties, entityTypeDef.getGUID(), entityTypeDef.getName(), methodName); if (retrievedEntity == null) { return null; } return retrievedEntity.getGUID(); }
DataEngineRegistrationHandler { public String getExternalDataEngineByQualifiedName(String userId, String qualifiedName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException { final String methodName = "getExternalDataEngineByQualifiedName"; qualifiedName = repositoryHelper.getExactMatchRegex(qualifiedName); invalidParameterHandler.validateUserId(userId, methodName); invalidParameterHandler.validateName(qualifiedName, DataEnginePropertiesMapper.QUALIFIED_NAME_PROPERTY_NAME, methodName); InstanceProperties properties = repositoryHelper.addStringPropertyToInstance(serviceName, null, DataEnginePropertiesMapper.QUALIFIED_NAME_PROPERTY_NAME, qualifiedName, methodName); TypeDef entityTypeDef = repositoryHelper.getTypeDefByName(userId, DataEnginePropertiesMapper.SOFTWARE_SERVER_CAPABILITY_TYPE_NAME); EntityDetail retrievedEntity = repositoryHandler.getUniqueEntityByName(userId, qualifiedName, DataEnginePropertiesMapper.QUALIFIED_NAME_PROPERTY_NAME, properties, entityTypeDef.getGUID(), entityTypeDef.getName(), methodName); if (retrievedEntity == null) { return null; } return retrievedEntity.getGUID(); } }
DataEngineRegistrationHandler { public String getExternalDataEngineByQualifiedName(String userId, String qualifiedName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException { final String methodName = "getExternalDataEngineByQualifiedName"; qualifiedName = repositoryHelper.getExactMatchRegex(qualifiedName); invalidParameterHandler.validateUserId(userId, methodName); invalidParameterHandler.validateName(qualifiedName, DataEnginePropertiesMapper.QUALIFIED_NAME_PROPERTY_NAME, methodName); InstanceProperties properties = repositoryHelper.addStringPropertyToInstance(serviceName, null, DataEnginePropertiesMapper.QUALIFIED_NAME_PROPERTY_NAME, qualifiedName, methodName); TypeDef entityTypeDef = repositoryHelper.getTypeDefByName(userId, DataEnginePropertiesMapper.SOFTWARE_SERVER_CAPABILITY_TYPE_NAME); EntityDetail retrievedEntity = repositoryHandler.getUniqueEntityByName(userId, qualifiedName, DataEnginePropertiesMapper.QUALIFIED_NAME_PROPERTY_NAME, properties, entityTypeDef.getGUID(), entityTypeDef.getName(), methodName); if (retrievedEntity == null) { return null; } return retrievedEntity.getGUID(); } DataEngineRegistrationHandler(String serviceName, String serverName,
                                         InvalidParameterHandler invalidParameterHandler,
                                         RepositoryHandler repositoryHandler,
                                         OMRSRepositoryHelper repositoryHelper); }
DataEngineRegistrationHandler { public String getExternalDataEngineByQualifiedName(String userId, String qualifiedName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException { final String methodName = "getExternalDataEngineByQualifiedName"; qualifiedName = repositoryHelper.getExactMatchRegex(qualifiedName); invalidParameterHandler.validateUserId(userId, methodName); invalidParameterHandler.validateName(qualifiedName, DataEnginePropertiesMapper.QUALIFIED_NAME_PROPERTY_NAME, methodName); InstanceProperties properties = repositoryHelper.addStringPropertyToInstance(serviceName, null, DataEnginePropertiesMapper.QUALIFIED_NAME_PROPERTY_NAME, qualifiedName, methodName); TypeDef entityTypeDef = repositoryHelper.getTypeDefByName(userId, DataEnginePropertiesMapper.SOFTWARE_SERVER_CAPABILITY_TYPE_NAME); EntityDetail retrievedEntity = repositoryHandler.getUniqueEntityByName(userId, qualifiedName, DataEnginePropertiesMapper.QUALIFIED_NAME_PROPERTY_NAME, properties, entityTypeDef.getGUID(), entityTypeDef.getName(), methodName); if (retrievedEntity == null) { return null; } return retrievedEntity.getGUID(); } DataEngineRegistrationHandler(String serviceName, String serverName,
                                         InvalidParameterHandler invalidParameterHandler,
                                         RepositoryHandler repositoryHandler,
                                         OMRSRepositoryHelper repositoryHelper); String createOrUpdateExternalDataEngine(String userId, SoftwareServerCapability softwareServerCapability); String getExternalDataEngineByQualifiedName(String userId, String qualifiedName); }
DataEngineRegistrationHandler { public String getExternalDataEngineByQualifiedName(String userId, String qualifiedName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException { final String methodName = "getExternalDataEngineByQualifiedName"; qualifiedName = repositoryHelper.getExactMatchRegex(qualifiedName); invalidParameterHandler.validateUserId(userId, methodName); invalidParameterHandler.validateName(qualifiedName, DataEnginePropertiesMapper.QUALIFIED_NAME_PROPERTY_NAME, methodName); InstanceProperties properties = repositoryHelper.addStringPropertyToInstance(serviceName, null, DataEnginePropertiesMapper.QUALIFIED_NAME_PROPERTY_NAME, qualifiedName, methodName); TypeDef entityTypeDef = repositoryHelper.getTypeDefByName(userId, DataEnginePropertiesMapper.SOFTWARE_SERVER_CAPABILITY_TYPE_NAME); EntityDetail retrievedEntity = repositoryHandler.getUniqueEntityByName(userId, qualifiedName, DataEnginePropertiesMapper.QUALIFIED_NAME_PROPERTY_NAME, properties, entityTypeDef.getGUID(), entityTypeDef.getName(), methodName); if (retrievedEntity == null) { return null; } return retrievedEntity.getGUID(); } DataEngineRegistrationHandler(String serviceName, String serverName,
                                         InvalidParameterHandler invalidParameterHandler,
                                         RepositoryHandler repositoryHandler,
                                         OMRSRepositoryHelper repositoryHelper); String createOrUpdateExternalDataEngine(String userId, SoftwareServerCapability softwareServerCapability); String getExternalDataEngineByQualifiedName(String userId, String qualifiedName);  }