--[[----------------------------------------------------------------------------

WFCatFileConductorConstantsTest.lua

--------------------------------------------------------------------------------

ADOBE CONFIDENTIAL
------------------
Copyright 2022 Adobe Inc.
All Rights Reserved.

NOTICE: All information contained herein is, and remain the property of
Adobe Systems Incorporated and its suppliers, if any. The intellectual and
technical concepts contained herein are proprietary to Adobe Systems
Incorporated and its suppliers and may be covered by U.S. and Foreign
Patents, patents in process, and are protected by trade secret or copyright
law.  Dissemination of this information or reproduction of this material is
strictly forbidden unless prior written permission is obtained from
Adobe Systems Incorporated.

----------------------------------------------------------------------------]]--

	-- WF.core.self_test
local WFRxTestCase = require 'WFRxTestCase'

	-- WF.core.utils
local WFTableMerge = require 'WFTableMerge'
local WFFileUtils = require 'WFFileUtils'
local WFPlatformInfo = require 'WFPlatformInfo'

local KSTableUtils = require 'KSTableUtils'
local KSPathUtils = require 'KSPathUtils'

local WFCatMockCatalog = require "WFCatMockCatalog"

local WFCatFileConductorConstants = require 'WFCatFileConductorConstants'

local createFakeWFCatalog = WFCatMockCatalog.createFakeWFCatalog

--------------------------------------------------------------------------------

-- It would be nice if we could use WFCatAssetTestUtils here, but these are not suitable for fixed test data
-- (which we need for the renditionContentId tests)

local assetExample = {
	_changeCounter = 30,
	_id = "f47741bf0c494afc84b8146479427952",
	_docType = "asset",
	_revId = "c1b2764625282c145ba27bce13202755",
	_serverProvidedMetadata = {
		base = "https://photos.adobe.io/v2/catalogs/ee47bf5197544783b9e2f7948c1e6aee/",
		created = "2017-11-23T16:22:14.425212Z",
		links = {
			[ "/rels/master" ] = {
				content_type = "image/jpeg",
				href = "/v2/catalogs/ee47bf5197544783b9e2f7948c1e6aee/assets/f47741bf0c494afc84b8146479427952/revisions/abe63a9d597748c3b158b9e59edad5a0/master",
			},
			[ "/rels/master_create" ] = {
				href = "/v2/catalogs/ee47bf5197544783b9e2f7948c1e6aee/assets/f47741bf0c494afc84b8146479427952/revisions/{revision_id}/master",
				templated = true,
			},
			[ "/rels/proxy_create" ] = {
				href = "/v2/catalogs/ee47bf5197544783b9e2f7948c1e6aee/assets/f47741bf0c494afc84b8146479427952/revisions/{revision_id}/proxies/{proxy_id}",
				templated = true,
			},
			[ "/rels/proxy_type/2560" ] = {
				href = "/v2/catalogs/ee47bf5197544783b9e2f7948c1e6aee/assets/f47741bf0c494afc84b8146479427952/revisions/abe63a9d597748c3b158b9e59edad5a0/proxies/4dae07db087a82c45d4b88f07cec70c6",
			},
			[ "/rels/rendition_create" ] = {
				href = "/v2/catalogs/ee47bf5197544783b9e2f7948c1e6aee/assets/f47741bf0c494afc84b8146479427952/revisions/{revision_id}/renditions/{rendition_id}",
				templated = true,
			},
			[ "/rels/rendition_type/1280" ] = {
				href = "/v2/catalogs/ee47bf5197544783b9e2f7948c1e6aee/assets/f47741bf0c494afc84b8146479427952/revisions/abe63a9d597748c3b158b9e59edad5a0/renditions/7075d542aeb4b72e82696446e0210ff7",
			},
			[ "/rels/rendition_type/2048" ] = {
				href = "/v2/catalogs/ee47bf5197544783b9e2f7948c1e6aee/assets/f47741bf0c494afc84b8146479427952/revisions/abe63a9d597748c3b158b9e59edad5a0/renditions/7c615e30b485d91dd382797e1c009fe6",
			},
			[ "/rels/rendition_type/640" ] = {
				href = "/v2/catalogs/ee47bf5197544783b9e2f7948c1e6aee/assets/f47741bf0c494afc84b8146479427952/revisions/abe63a9d597748c3b158b9e59edad5a0/renditions/a87e0aafa89613cd661a06671e381b8b",
			},
			[ "/rels/rendition_generate/fullsize" ] =  {
				href = "/v2/catalogs/ee47bf5197544783b9e2f7948c1e6aee/assets/f47741bf0c494afc84b8146479427952/revisions/abe63a9d597748c3b158b9e59edad5a0/renditions/{rendition_id}?rendition_type=fullsize",
				templated = true
			},
			[ "/rels/rendition_type/thumbnail2x" ] = {
				href = "/v2/catalogs/ee47bf5197544783b9e2f7948c1e6aee/assets/f47741bf0c494afc84b8146479427952/revisions/abe63a9d597748c3b158b9e59edad5a0/renditions/7ecc9c3e707a2d09ea157d9f7c4670dd",
			},
			[ "/rels/xmp" ] = {
				href = "/v2/catalogs/ee47bf5197544783b9e2f7948c1e6aee/assets/f47741bf0c494afc84b8146479427952/revisions/abe63a9d597748c3b158b9e59edad5a0/xmp",
			},
			[ "/rels/xmp_develop_create" ] = {
				href = "/v2/catalogs/ee47bf5197544783b9e2f7948c1e6aee/assets/f47741bf0c494afc84b8146479427952/revisions/{revision_id}/xmp/develop",
				templated = true,
			},
			self = {
				href = "/v2/catalogs/ee47bf5197544783b9e2f7948c1e6aee/assets/f47741bf0c494afc84b8146479427952",
			},
		},
		revision_ids = {
			"abe63a9d597748c3b158b9e59edad5a0",
			"0b09a0598b7ea86980bd39b82e2f532e",
			"73644f28187ef1d445084e0170c3d4f5",
			"ac41994f42da323deb36209b7c24e8ce",
			"c1b2764625282c145ba27bce13202755",
		},
		updated = "2017-11-23T16:22:29.908045Z",
	},
	captureDate = "2017-10-13T18:23:05.852+01:00",
	develop = {
		croppedHeight = 3024,
		croppedWidth = 4032,
		processingModel = "lightroom",
		userOrientation = 1,
	},
	importSource = {
		contentType = "image/jpeg",
		fileName = "IMG_0014.JPG",
		fileSize = 2.6992e+06,
		importTimestamp = "2017-11-23T17:22:08.372+01:00",
		importedBy = "f9e358e68b7137a5d48d66b6e20f2d7a",
		importedOnDevice = "immisch-mp {3d9fa297a94157383b546ff302deb02085271e6f6ccc28ec3b7f630d0d5f3847}",
		localAssetId = "61BDB91E-A15A-4070-9E41-0903803BF196/L0/001",
		originalHeight = 3024,
		originalWidth = 4032,
		sha256 = "a97e791724857a969cbe0416b10f8e6828694d51060269e0db5d2279d3978693",
		uniqueDeviceId = "3d9fa297a94157383b546ff302deb02085271e6f6ccc28ec3b7f630d0d5f3847",
	},
	subtype = "image",
	type = "asset",
	xmp = {
		aux = {
			Lens = "iPhone 7 Plus back dual camera 3.99mm f/1.8",
		},
		exif = {
			ApertureValue = {
				1.69599e+06,
				1e+06,
			},
			BrightnessValue = {
				3504,
				979,
			},
			DateTimeOriginal = "2017-10-13T18:23:05.852+02:00",
			ExposureBiasValue = {
				0,
				1,
			},
			ExposureProgram = "normal program",
			ExposureTime = {
				1,
				35,
			},
			FNumber = {
				18,
				10,
			},
			FlashFired = false,
			FocalLength = {
				399,
				100,
			},
			FocalLengthIn35mmFilm = 28,
			ISOSpeedRatings = 40,
			MeteringMode = "pattern",
			ShutterSpeedValue = {
				5.12928e+06,
				1e+06,
			},
		},
		photoshop = {
			DateCreated = "2017-10-13T18:23:05.000+02:00",
		},
		tiff = {
			Make = "Apple",
			Model = "iPhone 7 Plus",
			Orientation = "top left",
		},
		xmp = {
			CreateDate = "2017-10-13T18:23:05.000+02:00",
			CreatorTool = "Photos 3.0",
			ModifyDate = "2017-10-13T18:23:05.000+02:00",
		},
	},
}

local assetWithoutRenditions = {
	_changeCounter = 30,
	_id = "915f7236b26b462f8e5be20a3f78c05e",
	_docType = "asset",
	_localId = 11,
	_revId = "c1b2764625282c145ba27bce13202755",
	_spaceId = "s3p2764625282c145ba27bce13202755",
	captureDate = "2017-10-13T18:23:05.852+01:00",
	develop = {
		croppedHeight = 3024,
		croppedWidth = 4032,
		processingModel = "lightroom",
		userOrientation = 1,
	},
	importSource = {
		contentType = "image/jpeg",
		fileName = "IMG_0014.JPG",
		fileSize = 2.6992e+06,
		importTimestamp = "2017-11-23T17:22:08.372+01:00",
		importedBy = "f9e358e68b7137a5d48d66b6e20f2d7a",
		importedOnDevice = "immisch-mp {3d9fa297a94157383b546ff302deb02085271e6f6ccc28ec3b7f630d0d5f3847}",
		localAssetId = "61BDB91E-A15A-4070-9E41-0903803BF196/L0/001",
		originalHeight = 3024,
		originalWidth = 4032,
		sha256 = "a97e791724857a969cbe0416b10f8e6828694d51060269e0db5d2279d3978693",
		uniqueDeviceId = "3d9fa297a94157383b546ff302deb02085271e6f6ccc28ec3b7f630d0d5f3847",
	},
	subtype = "image",
	type = "asset",
	xmp = {
		aux = {
			Lens = "iPhone 7 Plus back dual camera 3.99mm f/1.8",
		},
		exif = {
			ApertureValue = {
				1.69599e+06,
				1e+06,
			},
			BrightnessValue = {
				3504,
				979,
			},
			DateTimeOriginal = "2017-10-13T18:23:05.852+02:00",
			ExposureBiasValue = {
				0,
				1,
			},
			ExposureProgram = "normal program",
			ExposureTime = {
				1,
				35,
			},
			FNumber = {
				18,
				10,
			},
			FlashFired = false,
			FocalLength = {
				399,
				100,
			},
			FocalLengthIn35mmFilm = 28,
			ISOSpeedRatings = 40,
			MeteringMode = "pattern",
			ShutterSpeedValue = {
				5.12928e+06,
				1e+06,
			},
		},
		photoshop = {
			DateCreated = "2017-10-13T18:23:05.000+02:00",
		},
		tiff = {
			Make = "Apple",
			Model = "iPhone 7 Plus",
			Orientation = "top left",
		},
		xmp = {
			CreateDate = "2017-10-13T18:23:05.000+02:00",
			CreatorTool = "Photos 3.0",
			ModifyDate = "2017-10-13T18:23:05.000+02:00",
		},
	},
}

local videoExample = {
	_id = "e3b2f9925bdf4b77be4a8391ca77a3c0",
	subtype = "video",
	type = "asset",
	_serverProvidedMetadata = {
		links = {
			["/rels/master"] = {
				href = "/href/bogus/testing",
			},
			["/rels/proxy_type/1080p"] = {
				href = "/href/bogus/1080p",
			},
			["/rels/proxy_type/1080p709"] = {
				href = "/href/bogus/1080p709",
			},
			["/rels/proxy_type/360p"] = {
				href = "/href/bogus/360p",
			},
			["/rels/proxy_type/360p_bt709"] = {
				href = "/href/bogus/360p_bt709",
			},
			["/rels/rendition_type/2048"] = {
				href = "/href/bogus/2048",
			},
			["/rels/rendition_type/360p"] = {
				href = "/href/bogus/360p",
			},
			["/rels/rendition_type/720p"] = {
				href = "/href/bogus/720p",
			},
			["/rels/rendition_type/thumbnail2x"] = {
				href = "/href/bogus/thumbnail2x",
			},
			["/rels/xmp"] = {
				exists = true,
				href = "/href/bogus/xmp",
			},
		},
	},
	captureDate = "2022-03-17T12:03:04.734Z",
	develop = {
		croppedHeight = 1000,
		croppedWidth = 1000,
		userOrientation = 1,
	},
	importSource = {
		sha256 = "a60913c4a334ceb67135b85d08d1f609e745e84e121ccc8eaa7364fa77c272d4",
	}
}

local videoDevelopSection = {
	version = 1,
	processVersion = 1,
	croppedWidth = 1000,
	croppedHeight = 1000,
	adjustments = {
		userUpdated = "2020-09-15T12:18:38.23Z",
		device = "Samsung SM-G950F {56f0b1a0d4144bb48d8abccf19a2173ed64dd41281d44392aa8c0de932484024}",
		adjustmentsFraction = 1000,
		exposure2012 = 0,
		contrast2012 = 0,
		highlights2012 = 0,
		shadows2012 = 0,
		whites2012 = 0,
		blacks2012 = 0,
		incrementalTemperature = 0,
		incrementalTint = 0,
		vibrance = 0,
		saturation = 0,
		hueAdjustmentRed = 0,
		hueAdjustmentOrange = 0,
		hueAdjustmentYellow = 0,
		hueAdjustmentGreen = 0,
		hueAdjustmentAqua = 0,
		hueAdjustmentBlue = 0,
		hueAdjustmentPurple = 0,
		hueAdjustmentMagenta = 0,
		saturationAdjustmentRed = 0,
		saturationAdjustmentOrange = 0,
		saturationAdjustmentYellow = 0,
		saturationAdjustmentGreen = 0,
		saturationAdjustmentAqua = 0,
		saturationAdjustmentBlue = 0,
		saturationAdjustmentPurple = 0,
		saturationAdjustmentMagenta = 0,
		luminanceAdjustmentRed = 0,
		luminanceAdjustmentOrange = 0,
		luminanceAdjustmentYellow = 0,
		luminanceAdjustmentGreen = 0,
		luminanceAdjustmentAqua = 0,
		luminanceAdjustmentBlue = 0,
		luminanceAdjustmentPurple = 0,
		luminanceAdjustmentMagenta = 0,
		splitToningHighlightHue = 0,
		splitToningHighlightSaturation = 0,
		splitToningBalance = 0,
		splitToningShadowHue = 0,
		splitToningShadowSaturation = 0,
		colorGradeMidtoneHue = 0,
		colorGradeMidtoneSat = 0,
		colorGradeShadowLum = 50000,
		colorGradeMidtoneLum = 50000,
		colorGradeHighlightLum = 50000,
		colorGradeBlending = 50000,
		colorGradeGlobalHue = 0,
		colorGradeGlobalSat = 0,
		colorGradeGlobalLum = 50000,
		grayMixerRed = 0,
		grayMixerOrange = 0,
		grayMixerYellow = 0,
		grayMixerGreen = 0,
		grayMixerAqua = 0,
		grayMixerBlue = 0,
		grayMixerPurple = 0,
		grayMixerMagenta = 0,
		convertToGrayscale = true,
		postCropVignetteAmount = 0,
		postCropVignetteRoundness = 0,
		postCropVignetteMidpoint = 50000,
		postCropVignetteFeather = 50000,
		postCropVignetteHighlightContrast = 0,
		grainAmount = 0,
		grainSize = 25000,
		grainFrequency = 50000,
		lutAmount = 100000,
		profile = "neutral",
		geometric = {
			cropZoom = 100000,
			cropOffsetX = 0,
			cropOffsetY = 0,
			cropRectTop = 0,
			cropRectLeft = 0,
			cropRectBottom = 100000,
			cropRectRight = 100000,
			cropRotation = 0,
			cropFraction = 100000,
			orientation = "normal"
		}
	},
	temporal = {
		userUpdated = "2020-07-25T00:00:42.12Z",
		device = "Jeff's IPhone {7e3f70b5f54749ae8d87a4d28b5ba2672027371becf44e258b92e810d71ef0d2}",
		temporalFraction = 100000000,
		inPoint = 0,
		duration = 10000000
	}
}

--------------------------------------------------------------------------------

local WFCatFileConductorConstantsTest = {}

--------------------------------------------------------------------------------

-- These three tests need to be kept in sync with the ComputeContentId tests in TIBlobProviderTests.mm

function WFCatFileConductorConstantsTest.rxTestComputeContentId( rxTest )

	local contentId = WFCatFileConductorConstants.renditionContentId( assetExample )

	rxTest:expectEqual( 'fb4fe699845e71c7544d649024d8f949', contentId )

end

--------------------------------------------------------------------------------

function WFCatFileConductorConstantsTest.rxTestComputeVideoContentId( rxTest )

	local example = KSTableUtils.deepCopy( videoExample )

	local contentId = WFCatFileConductorConstants.renditionContentId( example )
	rxTest:expectEqual( 'bad31acab636bc35d0272fb14fa7eba6', contentId )

	-- set an actual develop section (from http://apidocs.adbecrsl.com/v2/data-model/asset/video_develop.html)
	example.develop = videoDevelopSection

	contentId = WFCatFileConductorConstants.renditionContentId( example )
	rxTest:expectEqual( '5987a1d6269d60f826c6bbe4e3ca5756', contentId )

	-- this should not change the contentId
	example.develop.adjustments.vibrance = 0.0

	contentId = WFCatFileConductorConstants.renditionContentId( example )
	rxTest:expectEqual( '5987a1d6269d60f826c6bbe4e3ca5756', contentId )

	-- but this should
	example.develop.adjustments.vibrance = 10

	contentId = WFCatFileConductorConstants.renditionContentId( example )
	rxTest:expectEqual( '0e24d21d13aa7e0e114a67ba1d2a441f', contentId )
	
	example.develop = nil

	contentId = WFCatFileConductorConstants.renditionContentId( example )
	rxTest:expectEqual( 'd41d8cd98f00b204e9800998ecf8427e', contentId )

	example.develop = {
        adjustments = {
            adjustmentsFraction = 1000,
            postCropVignetteAmount = -100000,
            userUpdated = "2022-10-18T03:59:51.156Z"
        },
        processVersion = 1,
        version = 1
    }

	contentId = WFCatFileConductorConstants.renditionContentId( example )
	rxTest:expectEqual( 'c43f593236ae44f19d49aef56cfd5ab0', contentId )	

end

--------------------------------------------------------------------------------

function WFCatFileConductorConstantsTest.rxTestComputeContentIdContributed( rxTest )

	-- assetWithoutRenditions models a SWY asset
	local contentId = WFCatFileConductorConstants.renditionContentId( assetWithoutRenditions )

	rxTest:expectEqual( '3ebfb2cb0d1e213654f2f9ff823134e2', contentId )

	local newRev = KSTableUtils.deepCopy( assetWithoutRenditions )

	newRev._revId = '14d4737738d44891829a2d5bbf904303'

	contentId = WFCatFileConductorConstants.renditionContentId( newRev )

	rxTest:expectEqual( '1615e8ecce49d6868c3efa12c6d8b626', contentId )

	-- now the same for video

	newRev = KSTableUtils.deepCopy( videoExample )

	newRev._spaceId = 'ec8c17c794924f6c8b7bee3d8828893d'
	newRev._revId = '14d4737738d44891829a2d5bbf904303'

	contentId = WFCatFileConductorConstants.renditionContentId( newRev )

	rxTest:expectEqual( '14d4737738d44891829a2d5bbf904303', contentId )


end

--------------------------------------------------------------------------------

function WFCatFileConductorConstantsTest.rxTestComputeContentIdSha256Missing( rxTest )

	-- simulate asset with missing importSource.sha256

	local assetWithMissingSha256 = KSTableUtils.deepCopy( assetExample )

	WFTableMerge.applyOverlay( assetWithMissingSha256, {
			importSource = {
				sha256 = {
					_delete = true
				}
			},
		} )

	local contentId = WFCatFileConductorConstants.renditionContentId( assetWithMissingSha256 )

	rxTest:expectEqual( 'c41195fbdb8801a1af708008f3b768ca', contentId )

	end

--------------------------------------------------------------------------------

function WFCatFileConductorConstantsTest.rxTestGenerateRelativeBlobPath( rxTest )

	local path = WFCatFileConductorConstants.TEST_getRelativeBlobPath( '2dfdbfd3c83547d38e2589376ea61ac4' )
	path = path:gsub( '\\', '/' )

	local catalogId = '1d991bf18bf64f5abb2fc4558cccc9b2'

	rxTest:expectEqual( 'blobs/2d/2dfdbfd3c83547d38e2589376ea61ac4', path )

	path = WFCatFileConductorConstants.TEST_getRelativeBlobPath( '2dfdbfd3c83547d38e2589376ea61ac4', catalogId )

	local basePath = WFCatFileConductorConstants.TEST_getCatalogBasePath( catalogId )
	rxTest:expectEqual( 'directory', WFFileUtils.exists( KSPathUtils.child( basePath, path ) ) )

end

--------------------------------------------------------------------------------

local layoutConventions = WFCatFileConductorConstants.layoutConventions

local function getContentIdAndPath( linkKey, docValue, fileSpec )

	local layout = layoutConventions[ linkKey ]

	local contentId = layout.contentIdFn( layout, docValue )

	local relPath = layout.relPathFn( layout, docValue, contentId, fileSpec )

	return contentId, relPath

end

--------------------------------------------------------------------------------

local function lastNComponents( path, count )

	local components = {}

	for i = 1, count do

		components[ count - i + 1 ] = KSPathUtils.leafName( path )
		path = KSPathUtils.parent( path )

	end

	local strippedPath = components[ 1 ]

	for i = 2, count do
		strippedPath = KSPathUtils.child( strippedPath, components[ i ] )
	end

	return strippedPath:gsub("\\","/")

end

--------------------------------------------------------------------------------

if WFPlatformInfo.isMobile() then

	function WFCatFileConductorConstantsTest.rxTestRelativePaths( rxTest )

		local contentId, relPath = getContentIdAndPath( '/rels/rendition_type/thumbnail2x', assetExample )
		rxTest:expectEqual( 'fb4fe699845e71c7544d649024d8f949', contentId )
		rxTest:expectEqual( 'blobs/f4/f47741bf0c494afc84b8146479427952/th_fb4fe699845e71c7544d649024d8f949.jpg', relPath )

		contentId, relPath = getContentIdAndPath( '/rels/rendition_type/2048', assetExample )
		rxTest:expectEqual( 'fb4fe699845e71c7544d649024d8f949', contentId )
		rxTest:expectEqual( 'blobs/f4/f47741bf0c494afc84b8146479427952/pv_fb4fe699845e71c7544d649024d8f949.jpg', relPath )

		contentId, relPath = getContentIdAndPath( '/rels/proxy_type/2560', assetExample )
		rxTest:expectEqual( 'a97e791724857a969cbe0416b10f8e6828694d51060269e0db5d2279d3978693', contentId )
		rxTest:expectEqual( 'Originals/2017/2017-10/2017-10-13/IMG_0014_f47741bf0c494afc84b8146479427952_proxy.dng', relPath )

		local externalXmpDevelop = KSTableUtils.deepCopy( assetExample )

		KSTableUtils.setNested( externalXmpDevelop, {
				sha256 = 'a1995385bbf482b91edc7ae55d76a920e87da3c9e0c386b8b0633573983e757c'
			}, 'develop', 'xmpCameraRaw' )

		contentId, relPath = getContentIdAndPath( '/rels/xmp/develop', externalXmpDevelop )
		rxTest:expectEqual( 'a1995385bbf482b91edc7ae55d76a920e87da3c9e0c386b8b0633573983e757c', contentId )
		rxTest:expectEqual( 'xmp_develop/a1/a1995385bbf482b91edc7ae55d76a920e87da3c9e0c386b8b0633573983e757c.rdf', relPath )

		-- video renditions
		contentId, relPath = getContentIdAndPath( '/rels/rendition_type/360p', videoExample )
		rxTest:expectEqual( 'bad31acab636bc35d0272fb14fa7eba6', contentId )
		rxTest:expectEqual( 'blobs/e3/e3b2f9925bdf4b77be4a8391ca77a3c0/360p_bad31acab636bc35d0272fb14fa7eba6.mp4', relPath )

		contentId, relPath = getContentIdAndPath( '/rels/rendition_type/1080p', videoExample )
		rxTest:expectEqual( 'bad31acab636bc35d0272fb14fa7eba6', contentId )
		rxTest:expectEqual( 'blobs/e3/e3b2f9925bdf4b77be4a8391ca77a3c0/1080p_bad31acab636bc35d0272fb14fa7eba6.mp4', relPath )

		contentId, relPath = getContentIdAndPath( '/rels/rendition_type/1080p709', videoExample )
		rxTest:expectEqual( 'bad31acab636bc35d0272fb14fa7eba6', contentId )
		rxTest:expectEqual( 'blobs/e3/e3b2f9925bdf4b77be4a8391ca77a3c0/1080p709_bad31acab636bc35d0272fb14fa7eba6.mp4', relPath )

		-- video proxies
		contentId, relPath = getContentIdAndPath( '/rels/rendition_type/720p', videoExample )
		rxTest:expectEqual( 'a60913c4a334ceb67135b85d08d1f609e745e84e121ccc8eaa7364fa77c272d4', contentId )
		rxTest:expectEqual( 'Originals/2022/2022-03/2022-03-17/12:03:04_e3b2f9925bdf4b77be4a8391ca77a3c0_720p.mp4', relPath )

	end

else

	function WFCatFileConductorConstantsTest.rxTestRelativePaths( rxTest )

		local catalog = createFakeWFCatalog( rxTest )
		local fileSpec = catalog:fileSpec()

		local contentId, relPath = getContentIdAndPath( '/rels/rendition_type/thumbnail2x', assetExample, fileSpec )
		rxTest:expectEqual( 'fb4fe699845e71c7544d649024d8f949', contentId )

		rxTest:expectEqual( 'previews/hx/r7a58dckkn8jkraxpu6xe8mvh5k9wkwbc8rhdyjwnevavqu8mkafa',
			lastNComponents( relPath, 3 ) )

		contentId, relPath = getContentIdAndPath( '/rels/rendition_type/2048', assetExample, fileSpec )
		rxTest:expectEqual( 'fb4fe699845e71c7544d649024d8f949', contentId )
		rxTest:expectEqual( 'previews/hx/r7a58dckkn8jkraxpu6xe8mvh5k9wkwbc8rhdyjwnevavqu8mkbaa',
			lastNComponents( relPath, 3 ) )

		contentId, relPath = getContentIdAndPath( '/rels/proxy_type/2560', assetExample, fileSpec )
		rxTest:expectEqual( 'a97e791724857a969cbe0416b10f8e6828694d51060269e0db5d2279d3978693', contentId )
		rxTest:expectEqual( 'proxies/2560/f47/741bf0c494afc84b8146479427952',
			lastNComponents( relPath, 4 ) )

		contentId, relPath = getContentIdAndPath( '/rels/master', assetExample, fileSpec )
		rxTest:expectEqual( 'a97e791724857a969cbe0416b10f8e6828694d51060269e0db5d2279d3978693', contentId )
		rxTest:expectEqual( 'originals/2017/2017-10-13/f47741bf0c494afc84b8146479427952',
			lastNComponents( relPath, 4 ) )

		local externalXmpDevelop = KSTableUtils.deepCopy( assetExample )

		KSTableUtils.setNested( externalXmpDevelop, {
				sha256 = 'a1995385bbf482b91edc7ae55d76a920e87da3c9e0c386b8b0633573983e757c'
			}, 'develop', 'xmpCameraRaw' )

		contentId, relPath = getContentIdAndPath( '/rels/xmp/develop', externalXmpDevelop, fileSpec )
		rxTest:expectEqual( 'a1995385bbf482b91edc7ae55d76a920e87da3c9e0c386b8b0633573983e757c', contentId )
		rxTest:expectEqual( 'renditionsPath/settings/a1995385bbf482b91edc7ae55d76a920e87da3c9e0c386b8b0633573983e757c',
			lastNComponents( relPath, 3 ) )

		-- video renditions
		contentId, relPath = getContentIdAndPath( '/rels/rendition_type/360p', videoExample, fileSpec )
		rxTest:expectEqual( 'bad31acab636bc35d0272fb14fa7eba6', contentId )
		rxTest:expectEqual( 'previews/hd/zn63ez89kq556vxdvhfhsj8af44pqpyquz1t47ak3szfh4s47gafx',
			lastNComponents( relPath, 3 ) )

		contentId, relPath = getContentIdAndPath( '/rels/rendition_type/1080p', videoExample, fileSpec )
		rxTest:expectEqual( 'bad31acab636bc35d0272fb14fa7eba6', contentId )
		rxTest:expectEqual( 'previews/hd/zn63ez89kq556vxdvhfhsj8af44pqpyquz1t47ak3szfh4s47gat6',
			lastNComponents( relPath, 3 ) )

		contentId, relPath = getContentIdAndPath( '/rels/rendition_type/1080p709', videoExample, fileSpec )
		rxTest:expectEqual( 'bad31acab636bc35d0272fb14fa7eba6', contentId )
		rxTest:expectEqual( 'previews/hd/zn63ez89kq556vxdvhfhsj8af44pqpyquz1t47ak3szfh4s47gat6',
			lastNComponents( relPath, 3 ) )

		-- video proxies
		contentId, relPath = getContentIdAndPath( '/rels/rendition_type/720p', videoExample, fileSpec )
		rxTest:expectEqual( 'a60913c4a334ceb67135b85d08d1f609e745e84e121ccc8eaa7364fa77c272d4', contentId )
		rxTest:expectEqual( '720p/e3b/2f9925bdf4b77be4a8391ca77a3c0',
			lastNComponents( relPath, 3 ) )

		contentId, relPath = getContentIdAndPath( '/rels/proxy_type/1080p', videoExample, fileSpec )
		rxTest:expectEqual( 'a60913c4a334ceb67135b85d08d1f609e745e84e121ccc8eaa7364fa77c272d4', contentId )
		rxTest:expectEqual( '1080p/e3b/2f9925bdf4b77be4a8391ca77a3c0',
			lastNComponents( relPath, 3 ) )
	end

end

return WFRxTestCase.wrapSuite( 'WFCatFileConductorConstantsTest',  WFCatFileConductorConstantsTest )
