public void DetermineRequiredAssetEntryUpdates_AssetWithoutDependenciesAndChangedHashInStaticGroup_ReturnsOnlyRevertToCachedState() { File.WriteAllText(k_ContentUpdateTestCachedBundlePath, "TestCachedAssetBundle"); File.WriteAllText(k_ContentUpdateTestNewBundleName, "TestNewBundle"); var group = Settings.CreateGroup("ContentUpdateTests", false, false, false, null, typeof(BundledAssetGroupSchema), typeof(ContentUpdateGroupSchema)); string contentUpdateTestGroupGuid = group.Guid; group.GetSchema <ContentUpdateGroupSchema>().StaticContent = true; var assetEntry = CreateAssetEntry(m_ContentUpdateTestAssetGUID, group); group.AddAssetEntry(assetEntry); var context = GetContentUpdateContext(m_ContentUpdateTestAssetGUID, k_ContentUpdateTestCachedAssetHash, k_ContentUpdateTestNewInternalBundleName, k_ContentUpdateTestNewBundleName, k_ContentUpdateTestCachedBundlePath, contentUpdateTestGroupGuid, k_ContentUpdateTestFileName); var ops = RevertUnchangedAssetsToPreviousAssetState.DetermineRequiredAssetEntryUpdates(group, context); Assert.AreEqual(assetEntry, ops[0].AssetEntry); Assert.AreEqual(k_ContentUpdateTestNewBundleName, ops[0].CurrentBuildPath); Assert.AreEqual(k_ContentUpdateTestCachedBundlePath, ops[0].PreviousBuildPath); File.Delete(k_ContentUpdateTestCachedBundlePath); File.Delete(k_ContentUpdateTestNewBundleName); Settings.RemoveGroup(group); }
public void DetermineRequiredAssetEntryUpdates_AssetWithMatchingCachedInternalBundleId_TakesNoAction() { string contentUpdateTestAssetGUID = GUID.Generate().ToString(); string contentUpdateTestCachedAssetHash = "8888"; string contentUpdateTestNewInternalBundleName = "bundle"; string contentUpdateTestNewBundleName = "fullbundlepath"; string contentUpdateTestCachedBundlePath = contentUpdateTestNewBundleName; string contentUpdateTestFileName = "testfile"; File.WriteAllText(contentUpdateTestCachedBundlePath, "TestCachedAssetBundle"); var group = Settings.CreateGroup("ContentUpdateTests", false, false, false, null, typeof(BundledAssetGroupSchema), typeof(ContentUpdateGroupSchema)); string contentUpdateTestGroupGuid = group.Guid; group.GetSchema <ContentUpdateGroupSchema>().StaticContent = true; var assetEntry = CreateAssetEntry(contentUpdateTestAssetGUID, group); group.AddAssetEntry(assetEntry); var context = GetContentUpdateContext(contentUpdateTestAssetGUID, contentUpdateTestCachedAssetHash, contentUpdateTestNewInternalBundleName, contentUpdateTestNewBundleName, contentUpdateTestCachedBundlePath, contentUpdateTestGroupGuid, contentUpdateTestFileName); var ops = RevertUnchangedAssetsToPreviousAssetState.DetermineRequiredAssetEntryUpdates(group, context); Assert.IsTrue(ops.Count == 0); File.Delete(contentUpdateTestCachedBundlePath); Settings.RemoveGroup(group); }
public void DetermineRequiredAssetEntryUpdates_WithMissingPreviousBundle_LogsWarningAndTakesNoAction() { string contentUpdateTestAssetGUID = GUID.Generate().ToString(); string contentUpdateTestCachedAssetHash = "8888"; string contentUpdateTestNewInternalBundleName = "bundle"; string contentUpdateTestNewBundleName = "fullbundlepath"; string contentUpdateTestCachedBundlePath = "cachedBundle"; string contentUpdateTestFileName = "testfile"; var group = Settings.CreateGroup("ContentUpdateTests", false, false, false, null, typeof(BundledAssetGroupSchema), typeof(ContentUpdateGroupSchema)); string contentUpdateTestGroupGuid = group.Guid; group.GetSchema <ContentUpdateGroupSchema>().StaticContent = true; var assetEntry = CreateAssetEntry(contentUpdateTestAssetGUID, group); group.AddAssetEntry(assetEntry); var context = GetContentUpdateContext(contentUpdateTestAssetGUID, contentUpdateTestCachedAssetHash, contentUpdateTestNewInternalBundleName, contentUpdateTestNewBundleName, contentUpdateTestCachedBundlePath, contentUpdateTestGroupGuid, contentUpdateTestFileName); var ops = RevertUnchangedAssetsToPreviousAssetState.DetermineRequiredAssetEntryUpdates(group, context); LogAssert.Expect(LogType.Warning, $"CachedAssetState found for {assetEntry.AssetPath} but the previous bundle at {contentUpdateTestCachedBundlePath} cannot be found. " + $"The modified assets will not be able to use the previously built bundle which will result in new bundles being created " + $"for these static content groups. This will point the Content Catalog to local bundles that do not exist on currently " + $"deployed versions of an application."); Assert.IsTrue(ops.Count == 0); Settings.RemoveGroup(group); }
public void DetermineRequiredAssetEntryUpdates_WithMissingBundleFileId_LogsErrorAndTakesNoAction() { string contentUpdateTestAssetGUID = GUID.Generate().ToString(); string contentUpdateTestCachedAssetHash = "8888"; string contentUpdateTestNewInternalBundleName = "bundle"; string contentUpdateTestNewBundleName = "fullbundlepath"; string contentUpdateTestCachedBundlePath = "cachedBundle"; string contentUpdateTestFileName = "testfile"; File.WriteAllText(contentUpdateTestCachedBundlePath, "TestCachedAssetBundle"); var group = Settings.CreateGroup("ContentUpdateTests", false, false, false, null, typeof(BundledAssetGroupSchema), typeof(ContentUpdateGroupSchema)); string contentUpdateTestGroupGuid = group.Guid; group.GetSchema <ContentUpdateGroupSchema>().StaticContent = true; var assetEntry = CreateAssetEntry(contentUpdateTestAssetGUID, group); group.AddAssetEntry(assetEntry); var context = GetContentUpdateContext(contentUpdateTestAssetGUID, contentUpdateTestCachedAssetHash, contentUpdateTestNewInternalBundleName, contentUpdateTestNewBundleName, "", contentUpdateTestGroupGuid, contentUpdateTestFileName); var ops = RevertUnchangedAssetsToPreviousAssetState.DetermineRequiredAssetEntryUpdates(group, context); LogAssert.Expect(LogType.Error, $"CachedAssetState found for {assetEntry.AssetPath} but the bundleFileId was never set on the previous build."); Assert.IsTrue(ops.Count == 0); File.Delete(contentUpdateTestCachedBundlePath); Settings.RemoveGroup(group); }
public void DetermineRequiredAssetEntryUpdates_AssetWithDependenciesAndChangedHashInStaticGroup_ReturnsRevertToCachedStateAndDependencies() { string contentUpdateTestAssetGUID = GUID.Generate().ToString(); string contentUpdateTestCachedAssetHash = "8888"; string contentUpdateTestNewInternalBundleName = "bundle"; string contentUpdateTestNewBundleName = "fullbundlepath"; string contentUpdateTestCachedBundlePath = "cachedBundle"; string contentUpdateTestFileName = "testfile"; File.WriteAllText(contentUpdateTestCachedBundlePath, "TestCachedAssetBundle"); File.WriteAllText(contentUpdateTestNewBundleName, "TestNewBundle"); var group = Settings.CreateGroup("ContentUpdateTests", false, false, false, null, typeof(BundledAssetGroupSchema), typeof(ContentUpdateGroupSchema)); string contentUpdateTestGroupGuid = group.Guid; group.GetSchema <ContentUpdateGroupSchema>().StaticContent = true; var assetEntry = CreateAssetEntry(contentUpdateTestAssetGUID, group); group.AddAssetEntry(assetEntry); var context = GetContentUpdateContext(contentUpdateTestAssetGUID, contentUpdateTestCachedAssetHash, contentUpdateTestNewInternalBundleName, contentUpdateTestNewBundleName, contentUpdateTestCachedBundlePath, contentUpdateTestGroupGuid, contentUpdateTestFileName); context.GuidToPreviousAssetStateMap[contentUpdateTestAssetGUID].dependencies = new AssetState[] { new AssetState() { guid = GUID.Generate(), hash = Hash128.Parse("00000000000000") } }; var ops = RevertUnchangedAssetsToPreviousAssetState.DetermineRequiredAssetEntryUpdates(group, context); Assert.AreEqual(assetEntry, ops[0].AssetEntry); Assert.AreEqual(contentUpdateTestNewBundleName, ops[0].CurrentBuildPath); Assert.AreEqual(contentUpdateTestCachedBundlePath, ops[0].PreviousBuildPath); File.Delete(contentUpdateTestCachedBundlePath); File.Delete(contentUpdateTestNewBundleName); Settings.RemoveGroup(group); }
public void DetermineRequiredAssetEntryUpdates_AssetWithChangedHashInNonStaticGroup_TakesNoAction() { File.WriteAllText(k_ContentUpdateTestCachedBundlePath, "TestCachedAssetBundle"); var group = Settings.CreateGroup("ContentUpdateTests", false, false, false, null, typeof(BundledAssetGroupSchema), typeof(ContentUpdateGroupSchema)); string contentUpdateTestGroupGuid = GUID.Generate().ToString(); group.GetSchema <ContentUpdateGroupSchema>().StaticContent = false; var assetEntry = CreateAssetEntry(m_ContentUpdateTestAssetGUID, group); group.AddAssetEntry(assetEntry); var context = GetContentUpdateContext(m_ContentUpdateTestAssetGUID, k_ContentUpdateTestCachedAssetHash, k_ContentUpdateTestNewInternalBundleName, k_ContentUpdateTestNewBundleName, k_ContentUpdateTestCachedBundlePath, contentUpdateTestGroupGuid, k_ContentUpdateTestFileName); var ops = RevertUnchangedAssetsToPreviousAssetState.DetermineRequiredAssetEntryUpdates(group, context); Assert.IsTrue(ops.Count == 0); File.Delete(k_ContentUpdateTestCachedBundlePath); Settings.RemoveGroup(group); }