Beispiel #1
0
        public void T08_Password()
        {
            CMISViewModel vm = getInitializedViewModel();

            // Test one: Direct Password set and get on the view model
            string pw = "Hello World!";

            vm.CT.Password = pw;
            Assert.AreEqual(pw, vm.CT.Password);
            string encryptedPW = vm.CMISSettings.Password;

            Assert.AreNotEqual(pw, encryptedPW);

            // Verify password in export
            StoreDocumentResult expectedtResult = StoreDocumentResult.DefaultResult();

            expectedtResult.Password = pw;

            CMISClientMock cmisClient = new CMISClientMock();
            CMISExport     export     = new CMISExport(cmisClient);
            SIEEBatch      batch      = createBatch(expectedtResult.Filename, expectedtResult.DocName);
            SIEEFieldlist  fieldlist  = batch[0].Fieldlist;

            // Default document export
            vm.LoadPropertiesHandler();
            Assert.IsTrue(vm.TT.PropertiesLoaded);
            Assert.AreEqual(6, vm.TT.Properties.Count);
            export.Init(vm.Settings);
            export.ExportBatch(vm.Settings, batch); Assert.IsTrue(batch[0].Succeeded);
            expectedtResult.Compare(cmisClient.SDR);
        }
Beispiel #2
0
        public void T03_FolderTab()
        {
            CMISViewModel       vm             = getInitializedViewModel();
            StoreDocumentResult expectedResult = StoreDocumentResult.DefaultResult();

            CMISClientMock cmisClient = new CMISClientMock();
            CMISExport     export     = new CMISExport(cmisClient);

            // Default values
            Assert.AreEqual("/" + cmisClient.GetRootFolder().DisplayName, vm.FT.SelectedFolderPath);
            Assert.IsFalse(vm.FT.UseSubFolderField);
            Assert.AreEqual("FolderField", vm.FT.SubFolderField);
            Assert.IsFalse(vm.FT.UseSubFolderType);
            Assert.IsTrue(vm.FT.SubFolderTypeFixed);
            Assert.AreEqual("cmis:folder", vm.FT.SubFolderType);
            Assert.IsFalse(vm.FT.SubFolderTypeFromField);
            Assert.AreEqual("FolderTypeField", vm.FT.SubFolderTypeField);
            Assert.AreEqual(CMISSettings.ConflictHandling.None, vm.FT.SelectedConflictHandling);
            Assert.AreEqual(4, vm.FT.NumberOfDigits);
            Assert.AreEqual("Collapsed", vm.FT.NumberOfDigitsVisible);
            Assert.IsTrue(vm.FT.Major);
            Assert.AreEqual("Collapsed", vm.FT.VersioningVisible);

            // Visibility checks and logic
            vm.FT.SubFolderTypeFromField = true;
            Assert.IsFalse(vm.FT.SubFolderTypeFixed);
            vm.FT.SubFolderTypeFixed = true;
            Assert.IsFalse(vm.FT.SubFolderTypeFromField);
            vm.FT.SelectedConflictHandling = CMISSettings.ConflictHandling.Replace;
            Assert.AreEqual("Collapsed", vm.FT.NumberOfDigitsVisible);
            Assert.AreEqual("Collapsed", vm.FT.VersioningVisible);
            vm.FT.SelectedConflictHandling = CMISSettings.ConflictHandling.AddBlurb;
            Assert.AreEqual("Collapsed", vm.FT.NumberOfDigitsVisible);
            Assert.AreEqual("Collapsed", vm.FT.VersioningVisible);
            vm.FT.SelectedConflictHandling = CMISSettings.ConflictHandling.AddNumber;
            Assert.AreEqual("Visible", vm.FT.NumberOfDigitsVisible);
            Assert.AreEqual("Collapsed", vm.FT.VersioningVisible);
            vm.FT.SelectedConflictHandling = CMISSettings.ConflictHandling.AddVersion;
            Assert.AreEqual("Collapsed", vm.FT.NumberOfDigitsVisible);
            Assert.AreEqual("Visible", vm.FT.VersioningVisible);
            vm.FT.SelectedConflictHandling = CMISSettings.ConflictHandling.None;

            // Default document export
            SIEEBatch     batch     = createBatch(expectedResult.Filename, expectedResult.DocName);
            SIEEFieldlist fieldlist = batch[0].Fieldlist;

            vm.LoadPropertiesHandler();
            export.Init(vm.Settings);
            export.ExportBatch(vm.Settings, batch); Assert.IsTrue(batch[0].Succeeded);
            expectedResult.Compare(cmisClient.SDR);

            // SubFolderField
            vm.FT.UseSubFolderField = true;
            fieldlist.Add(new SIEEField()
            {
                Name = "FolderField", Value = "subFolder", ExternalId = "FolderField"
            });
            expectedResult.FinalFolder += "/subFolder";
            export.Init(vm.Settings);
            export.ExportBatch(vm.Settings, batch); Assert.IsTrue(batch[0].Succeeded);
            expectedResult.UsedFolderType = vm.FT.SubFolderType; // Default is what export implements
            expectedResult.Compare(cmisClient.SDR);

            // SubFolderType
            vm.FT.UseSubFolderType = true;
            vm.FT.SubFolderType    = "cmis:myFolderType";
            export.Init(vm.Settings);
            export.ExportBatch(vm.Settings, batch); Assert.IsTrue(batch[0].Succeeded);
            expectedResult.UsedFolderType = "cmis:myFolderType";
            expectedResult.Compare(cmisClient.SDR);

            // SubFolderFieldType
            vm.FT.SubFolderTypeFromField = true;
            fieldlist.Add(new SIEEField()
            {
                Name       = vm.FT.SubFolderTypeField,
                Value      = "cmis:anotherFolderType",
                ExternalId = vm.FT.SubFolderTypeField,
            });
            export.Init(vm.Settings);
            export.ExportBatch(vm.Settings, batch);
            expectedResult.UsedFolderType = "cmis:anotherFolderType";
            expectedResult.Compare(cmisClient.SDR);

            // Conflict Handling : Replace
            cmisClient.ExistingDocument    = expectedResult.DocName + ".pdf";
            vm.FT.SelectedConflictHandling = CMISSettings.ConflictHandling.Replace;
            export.ExportBatch(vm.Settings, batch); Assert.IsTrue(batch[0].Succeeded);
            expectedResult.Compare(cmisClient.SDR);

            // Conflict Handling : None
            cmisClient.ExistingDocument    = expectedResult.DocName + ".pdf";
            vm.FT.SelectedConflictHandling = CMISSettings.ConflictHandling.None;
            export.ExportBatch(vm.Settings, batch);
            expectedResult.OverwrittenExistingDocument = true;
            expectedResult.Compare(cmisClient.SDR);
            expectedResult.OverwrittenExistingDocument = false;
            cmisClient.SDR.OverwrittenExistingDocument = false;

            // Conflict Handling : AddBlurb
            vm.FT.SelectedConflictHandling = CMISSettings.ConflictHandling.AddBlurb;
            export.ExportBatch(vm.Settings, batch); Assert.IsTrue(batch[0].Succeeded);
            expectedResult.ExpectBlurb = true;
            expectedResult.Compare(cmisClient.SDR);
            expectedResult.ExpectBlurb = false;

            // Conflict Handling : AddNumber
            vm.FT.SelectedConflictHandling = CMISSettings.ConflictHandling.AddNumber;
            vm.FT.NumberOfDigits           = 2;
            export.ExportBatch(vm.Settings, batch); Assert.IsTrue(batch[0].Succeeded);
            string save = expectedResult.DocName;

            expectedResult.DocName += "_01";
            expectedResult.Compare(cmisClient.SDR);
            expectedResult.DocName = save;

            // Conflict Handling : AddVersion
            vm.FT.SelectedConflictHandling = CMISSettings.ConflictHandling.AddVersion;
            vm.FT.Major = true;
            export.ExportBatch(vm.Settings, batch); Assert.IsTrue(batch[0].Succeeded);
            expectedResult.Updated        = true;
            expectedResult.Major          = true;
            expectedResult.CheckInComment = "OCC created version";
            expectedResult.Compare(cmisClient.SDR);
            vm.FT.Major = false;
            export.ExportBatch(vm.Settings, batch); Assert.IsTrue(batch[0].Succeeded);
            expectedResult.Major = false;
            expectedResult.Compare(cmisClient.SDR);
        }
Beispiel #3
0
        public void T02_BasicExport()
        {
            CMISViewModel vm = getInitializedViewModel();

            vm.CMISSettings.SelectedCultureInfoName = "en-US";
            StoreDocumentResult expectedtResult = StoreDocumentResult.DefaultResult();

            CMISClientMock cmisClient = new CMISClientMock();
            CMISExport     export     = new CMISExport(cmisClient);
            SIEEBatch      batch      = createBatch(expectedtResult.Filename, expectedtResult.DocName);
            SIEEFieldlist  fieldlist  = batch[0].Fieldlist;

            // Default document export
            vm.LoadPropertiesHandler();
            Assert.IsTrue(vm.TT.PropertiesLoaded);
            Assert.AreEqual(6, vm.TT.Properties.Count);
            export.Init(vm.Settings);
            export.ExportBatch(vm.Settings, batch); Assert.IsTrue(batch[0].Succeeded);
            expectedtResult.Compare(cmisClient.SDR);

            foreach (CMISProperty p in vm.TT.Properties)
            {
                p.Selected = true;
                object objectValue;
                string stringValue;
                switch (p.Type)
                {
                case CMISClientType.Boolean:
                    stringValue = "true";
                    objectValue = true;
                    break;

                case CMISClientType.Integer:
                    stringValue = "4711";
                    objectValue = 4711;
                    break;

                case CMISClientType.Decimal:
                    stringValue = "1.8";
                    objectValue = 1.8M;
                    break;

                case CMISClientType.DateTime:
                    stringValue = "11.03.2017";
                    objectValue = DateTime.Parse(stringValue, new CultureInfo("en-US"));
                    break;

                default: objectValue = stringValue = "Some string"; break;
                }
                fieldlist.Add(new SIEEField(p.Id, p.Id, stringValue));
                expectedtResult.Properties[p.Id] = objectValue;
                export.Init(vm.Settings);
                export.ExportBatch(vm.Settings, batch); Assert.IsTrue(batch[0].Succeeded);
                expectedtResult.Compare(cmisClient.SDR);
                if (p.Type != CMISClientType.String)
                {
                    fieldlist.Where(n => n.ExternalId == p.Id).First().Value = "Illegal value";
                    export.Init(vm.Settings);
                    export.ExportBatch(vm.Settings, batch); Assert.IsFalse(batch[0].Succeeded);
                }
                expectedtResult.Compare(cmisClient.SDR);
                fieldlist.Remove(fieldlist.Where(n => n.ExternalId == p.Id).First());
                expectedtResult.Properties.Remove(p.Id);
            }

            CMISProperty pror = vm.TT.Properties.Where(n => n.Type == CMISClientType.Decimal).First();

            pror.Selected = true;
            fieldlist.Add(new SIEEField(pror.Id, pror.Id, "1,8"));
            expectedtResult.Properties[pror.Id]     = 1.8M;
            vm.CMISSettings.SelectedCultureInfoName = "de-DE";
            export.Init(vm.Settings);
            export.ExportBatch(vm.Settings, batch); Assert.IsTrue(batch[0].Succeeded);
            expectedtResult.Compare(cmisClient.SDR);
        }