@Test void createExternalDataEngine() throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException { String methodName = "createExternalDataEngine"; when(repositoryHandler.createEntity(USER, DataEnginePropertiesMapper.SOFTWARE_SERVER_CAPABILITY_TYPE_GUID, DataEnginePropertiesMapper.SOFTWARE_SERVER_CAPABILITY_TYPE_NAME, null, methodName)).thenReturn(GUID); String response = registrationHandler.createOrUpdateExternalDataEngine(USER, getSoftwareServerCapability()); assertEquals(GUID, response); verify(invalidParameterHandler, times(1)).validateUserId(USER, methodName); verify(invalidParameterHandler, times(1)).validateName(QUALIFIED_NAME, DataEnginePropertiesMapper.QUALIFIED_NAME_PROPERTY_NAME, methodName); }
public String createOrUpdateExternalDataEngine(String userId, SoftwareServerCapability softwareServerCapability) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException { final String methodName = "createExternalDataEngine"; invalidParameterHandler.validateUserId(userId, methodName); invalidParameterHandler.validateName(softwareServerCapability.getQualifiedName(), DataEnginePropertiesMapper.QUALIFIED_NAME_PROPERTY_NAME, methodName); ExternalDataEnginePropertiesBuilder builder = new ExternalDataEnginePropertiesBuilder(softwareServerCapability.getQualifiedName(), softwareServerCapability.getDisplayName(), softwareServerCapability.getDescription(), softwareServerCapability.getEngineType(), softwareServerCapability.getEngineVersion(), softwareServerCapability.getPatchLevel(), softwareServerCapability.getSource(), null, null, repositoryHelper, serviceName, serverName); InstanceProperties properties = builder.getInstanceProperties(methodName); TypeDef entityTypeDef = repositoryHelper.getTypeDefByName(userId, DataEnginePropertiesMapper.SOFTWARE_SERVER_CAPABILITY_TYPE_NAME); String externalEngineGUID = getExternalDataEngineByQualifiedName(userId, softwareServerCapability.getQualifiedName()); if (externalEngineGUID == null) { externalEngineGUID = repositoryHandler.createEntity(userId, entityTypeDef.getGUID(), entityTypeDef.getName(), properties, methodName); } else { repositoryHandler.updateEntity(userId, externalEngineGUID, entityTypeDef.getGUID(), entityTypeDef.getName(), properties, methodName); } return externalEngineGUID; }
DataEngineRegistrationHandler { public String createOrUpdateExternalDataEngine(String userId, SoftwareServerCapability softwareServerCapability) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException { final String methodName = "createExternalDataEngine"; invalidParameterHandler.validateUserId(userId, methodName); invalidParameterHandler.validateName(softwareServerCapability.getQualifiedName(), DataEnginePropertiesMapper.QUALIFIED_NAME_PROPERTY_NAME, methodName); ExternalDataEnginePropertiesBuilder builder = new ExternalDataEnginePropertiesBuilder(softwareServerCapability.getQualifiedName(), softwareServerCapability.getDisplayName(), softwareServerCapability.getDescription(), softwareServerCapability.getEngineType(), softwareServerCapability.getEngineVersion(), softwareServerCapability.getPatchLevel(), softwareServerCapability.getSource(), null, null, repositoryHelper, serviceName, serverName); InstanceProperties properties = builder.getInstanceProperties(methodName); TypeDef entityTypeDef = repositoryHelper.getTypeDefByName(userId, DataEnginePropertiesMapper.SOFTWARE_SERVER_CAPABILITY_TYPE_NAME); String externalEngineGUID = getExternalDataEngineByQualifiedName(userId, softwareServerCapability.getQualifiedName()); if (externalEngineGUID == null) { externalEngineGUID = repositoryHandler.createEntity(userId, entityTypeDef.getGUID(), entityTypeDef.getName(), properties, methodName); } else { repositoryHandler.updateEntity(userId, externalEngineGUID, entityTypeDef.getGUID(), entityTypeDef.getName(), properties, methodName); } return externalEngineGUID; } }
DataEngineRegistrationHandler { public String createOrUpdateExternalDataEngine(String userId, SoftwareServerCapability softwareServerCapability) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException { final String methodName = "createExternalDataEngine"; invalidParameterHandler.validateUserId(userId, methodName); invalidParameterHandler.validateName(softwareServerCapability.getQualifiedName(), DataEnginePropertiesMapper.QUALIFIED_NAME_PROPERTY_NAME, methodName); ExternalDataEnginePropertiesBuilder builder = new ExternalDataEnginePropertiesBuilder(softwareServerCapability.getQualifiedName(), softwareServerCapability.getDisplayName(), softwareServerCapability.getDescription(), softwareServerCapability.getEngineType(), softwareServerCapability.getEngineVersion(), softwareServerCapability.getPatchLevel(), softwareServerCapability.getSource(), null, null, repositoryHelper, serviceName, serverName); InstanceProperties properties = builder.getInstanceProperties(methodName); TypeDef entityTypeDef = repositoryHelper.getTypeDefByName(userId, DataEnginePropertiesMapper.SOFTWARE_SERVER_CAPABILITY_TYPE_NAME); String externalEngineGUID = getExternalDataEngineByQualifiedName(userId, softwareServerCapability.getQualifiedName()); if (externalEngineGUID == null) { externalEngineGUID = repositoryHandler.createEntity(userId, entityTypeDef.getGUID(), entityTypeDef.getName(), properties, methodName); } else { repositoryHandler.updateEntity(userId, externalEngineGUID, entityTypeDef.getGUID(), entityTypeDef.getName(), properties, methodName); } return externalEngineGUID; } DataEngineRegistrationHandler(String serviceName, String serverName,
                                         InvalidParameterHandler invalidParameterHandler,
                                         RepositoryHandler repositoryHandler,
                                         OMRSRepositoryHelper repositoryHelper); }
DataEngineRegistrationHandler { public String createOrUpdateExternalDataEngine(String userId, SoftwareServerCapability softwareServerCapability) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException { final String methodName = "createExternalDataEngine"; invalidParameterHandler.validateUserId(userId, methodName); invalidParameterHandler.validateName(softwareServerCapability.getQualifiedName(), DataEnginePropertiesMapper.QUALIFIED_NAME_PROPERTY_NAME, methodName); ExternalDataEnginePropertiesBuilder builder = new ExternalDataEnginePropertiesBuilder(softwareServerCapability.getQualifiedName(), softwareServerCapability.getDisplayName(), softwareServerCapability.getDescription(), softwareServerCapability.getEngineType(), softwareServerCapability.getEngineVersion(), softwareServerCapability.getPatchLevel(), softwareServerCapability.getSource(), null, null, repositoryHelper, serviceName, serverName); InstanceProperties properties = builder.getInstanceProperties(methodName); TypeDef entityTypeDef = repositoryHelper.getTypeDefByName(userId, DataEnginePropertiesMapper.SOFTWARE_SERVER_CAPABILITY_TYPE_NAME); String externalEngineGUID = getExternalDataEngineByQualifiedName(userId, softwareServerCapability.getQualifiedName()); if (externalEngineGUID == null) { externalEngineGUID = repositoryHandler.createEntity(userId, entityTypeDef.getGUID(), entityTypeDef.getName(), properties, methodName); } else { repositoryHandler.updateEntity(userId, externalEngineGUID, entityTypeDef.getGUID(), entityTypeDef.getName(), properties, methodName); } return externalEngineGUID; } 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 createOrUpdateExternalDataEngine(String userId, SoftwareServerCapability softwareServerCapability) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException { final String methodName = "createExternalDataEngine"; invalidParameterHandler.validateUserId(userId, methodName); invalidParameterHandler.validateName(softwareServerCapability.getQualifiedName(), DataEnginePropertiesMapper.QUALIFIED_NAME_PROPERTY_NAME, methodName); ExternalDataEnginePropertiesBuilder builder = new ExternalDataEnginePropertiesBuilder(softwareServerCapability.getQualifiedName(), softwareServerCapability.getDisplayName(), softwareServerCapability.getDescription(), softwareServerCapability.getEngineType(), softwareServerCapability.getEngineVersion(), softwareServerCapability.getPatchLevel(), softwareServerCapability.getSource(), null, null, repositoryHelper, serviceName, serverName); InstanceProperties properties = builder.getInstanceProperties(methodName); TypeDef entityTypeDef = repositoryHelper.getTypeDefByName(userId, DataEnginePropertiesMapper.SOFTWARE_SERVER_CAPABILITY_TYPE_NAME); String externalEngineGUID = getExternalDataEngineByQualifiedName(userId, softwareServerCapability.getQualifiedName()); if (externalEngineGUID == null) { externalEngineGUID = repositoryHandler.createEntity(userId, entityTypeDef.getGUID(), entityTypeDef.getName(), properties, methodName); } else { repositoryHandler.updateEntity(userId, externalEngineGUID, entityTypeDef.getGUID(), entityTypeDef.getName(), properties, methodName); } return externalEngineGUID; } DataEngineRegistrationHandler(String serviceName, String serverName,
                                         InvalidParameterHandler invalidParameterHandler,
                                         RepositoryHandler repositoryHandler,
                                         OMRSRepositoryHelper repositoryHelper); String createOrUpdateExternalDataEngine(String userId, SoftwareServerCapability softwareServerCapability); String getExternalDataEngineByQualifiedName(String userId, String qualifiedName);  }