chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r1575249 - in /chemistry/dotcmis/trunk/DotCMISUnitTest: AclTest.cs CacheTest.cs DotCMISUnitTest.csproj GetChildrenTest.cs SmokeTest.cs
Date Fri, 07 Mar 2014 12:47:40 GMT
Author: fmui
Date: Fri Mar  7 12:47:40 2014
New Revision: 1575249

URL: http://svn.apache.org/r1575249
Log:
DotCMIS unit test updates

Added:
    chemistry/dotcmis/trunk/DotCMISUnitTest/AclTest.cs
    chemistry/dotcmis/trunk/DotCMISUnitTest/GetChildrenTest.cs
Modified:
    chemistry/dotcmis/trunk/DotCMISUnitTest/CacheTest.cs
    chemistry/dotcmis/trunk/DotCMISUnitTest/DotCMISUnitTest.csproj
    chemistry/dotcmis/trunk/DotCMISUnitTest/SmokeTest.cs

Added: chemistry/dotcmis/trunk/DotCMISUnitTest/AclTest.cs
URL: http://svn.apache.org/viewvc/chemistry/dotcmis/trunk/DotCMISUnitTest/AclTest.cs?rev=1575249&view=auto
==============================================================================
--- chemistry/dotcmis/trunk/DotCMISUnitTest/AclTest.cs (added)
+++ chemistry/dotcmis/trunk/DotCMISUnitTest/AclTest.cs Fri Mar  7 12:47:40 2014
@@ -0,0 +1,48 @@
+using NUnit.Framework;
+using DotCMIS;
+using DotCMIS.Client;
+using DotCMIS.Client.Impl;
+using DotCMIS.Enums;
+using DotCMIS.Data;
+using System.Collections.Generic;
+using DotCMIS.Data.Impl;
+
+namespace DotCMISUnitTest
+{
+    [TestFixture]
+    class AclTest : TestFramework
+    {
+        [Test]
+        public void TestGetAcl()
+        {
+            //IObjectId id = Session.CreateObjectId(RepositoryInfo.RootFolderId);
+            //IAcl acl = Session.GetAcl(id, false);
+            //Assert.NotNull(acl);
+
+            string principalId = "admin";
+            string permission = "cmis:write";
+            Properties properties = new Properties();
+            IDictionary<string, object> dictionaryProperties = new Dictionary<string,
object>();
+            dictionaryProperties.Add("cmis:objectTypeId", "cmis:folder");
+            dictionaryProperties.Add("cmis:name", "ft2");
+
+            IObjectId newId = Session.CreateObjectId(RepositoryInfo.RootFolderId);
+            IObjectId newFolderId = Session.CreateFolder(dictionaryProperties, newId);
+            ICmisObject newFolder = Session.GetObject(newFolderId, new OperationContext()
{ IncludeAcls = true });
+            IAce ace = Session.ObjectFactory.CreateAce(principalId, new List<string>()
{ permission });
+
+            List<IAce> aceList = new List<IAce>();
+
+            aceList.Add(ace);
+
+
+            IAcl acl1 = newFolder.AddAcl(aceList, null);
+            Assert.NotNull(acl1);
+
+            IAcl acl2 = newFolder.RemoveAcl(aceList, null);
+            Assert.NotNull(acl2);
+
+            Session.Delete(newFolderId);
+        }
+    }
+}

Modified: chemistry/dotcmis/trunk/DotCMISUnitTest/CacheTest.cs
URL: http://svn.apache.org/viewvc/chemistry/dotcmis/trunk/DotCMISUnitTest/CacheTest.cs?rev=1575249&r1=1575248&r2=1575249&view=diff
==============================================================================
--- chemistry/dotcmis/trunk/DotCMISUnitTest/CacheTest.cs (original)
+++ chemistry/dotcmis/trunk/DotCMISUnitTest/CacheTest.cs Fri Mar  7 12:47:40 2014
@@ -193,6 +193,8 @@ namespace DotCMISUnitTest
         public void Delete(bool allVersions) { }
         public ICmisObject UpdateProperties(IDictionary<string, object> properties)
{ return null; }
         public IObjectId UpdateProperties(IDictionary<string, object> properties, bool
refresh) { return null; }
+        public ICmisObject Rename(string newName) { return null; }
+        public IObjectId Rename(string newName, bool refresh) { return null; }
         public IList<IRendition> Renditions { get { return null; } }
         public void ApplyPolicy(params IObjectId[] policyId) { }
         public void RemovePolicy(params IObjectId[] policyId) { }

Modified: chemistry/dotcmis/trunk/DotCMISUnitTest/DotCMISUnitTest.csproj
URL: http://svn.apache.org/viewvc/chemistry/dotcmis/trunk/DotCMISUnitTest/DotCMISUnitTest.csproj?rev=1575249&r1=1575248&r2=1575249&view=diff
==============================================================================
--- chemistry/dotcmis/trunk/DotCMISUnitTest/DotCMISUnitTest.csproj (original)
+++ chemistry/dotcmis/trunk/DotCMISUnitTest/DotCMISUnitTest.csproj Fri Mar  7 12:47:40 2014
@@ -30,6 +30,17 @@
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
   </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'issues|AnyCPU'">
+    <DebugSymbols>true</DebugSymbols>
+    <OutputPath>bin\issues\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <DebugType>full</DebugType>
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <ErrorReport>prompt</ErrorReport>
+    <CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets>
+    <CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
+    <CodeAnalysisFailOnMissingRules>true</CodeAnalysisFailOnMissingRules>
+  </PropertyGroup>
   <ItemGroup>
     <Reference Include="nunit.framework, Version=2.5.9.10348, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77,
processorArchitecture=MSIL">
       <SpecificVersion>False</SpecificVersion>
@@ -38,15 +49,18 @@
     <Reference Include="System" />
     <Reference Include="System.configuration" />
     <Reference Include="System.Core" />
-    <Reference Include="System.Xml.Linq" />
+    <Reference Include="System.Data.Linq" />
+    <Reference Include="System.Web.Extensions" />
     <Reference Include="System.Data.DataSetExtensions" />
     <Reference Include="System.Data" />
     <Reference Include="System.Xml" />
   </ItemGroup>
   <ItemGroup>
+    <Compile Include="AclTest.cs" />
     <Compile Include="CacheTest.cs" />
     <Compile Include="CRUDTest.cs" />
     <Compile Include="EnumeratorTest.cs" />
+    <Compile Include="GetChildrenTest.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
     <Compile Include="SmokeTest.cs" />
     <Compile Include="TestFramework.cs" />

Added: chemistry/dotcmis/trunk/DotCMISUnitTest/GetChildrenTest.cs
URL: http://svn.apache.org/viewvc/chemistry/dotcmis/trunk/DotCMISUnitTest/GetChildrenTest.cs?rev=1575249&view=auto
==============================================================================
--- chemistry/dotcmis/trunk/DotCMISUnitTest/GetChildrenTest.cs (added)
+++ chemistry/dotcmis/trunk/DotCMISUnitTest/GetChildrenTest.cs Fri Mar  7 12:47:40 2014
@@ -0,0 +1,93 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using NUnit.Framework;
+using DotCMIS;
+using DotCMIS.Client.Impl;
+using DotCMIS.Client;
+
+namespace DotCMISUnitTest
+{
+    [TestFixture]
+    class GetChildrenTest
+    {
+        private static int numOfDocuments = 250;
+
+        [Test]
+        public void TestPaging()
+        {
+            Dictionary<string, string> parameters = new Dictionary<string, string>();
+
+            string baseUrlAtom = "http://localhost:8080/inmemory/atom";
+            //string baseUrlAtom = "http://cmis.alfresco.com/cmisatom";
+           
+            string baseUrlWS = "http://localhost:8080/inmemory/services";
+
+            parameters[SessionParameter.BindingType] = BindingType.AtomPub;
+            parameters[SessionParameter.AtomPubUrl] = baseUrlAtom;
+            parameters[SessionParameter.User] = "admin";
+            parameters[SessionParameter.Password] = "admin";
+
+            SessionFactory factory = SessionFactory.NewInstance();
+            ISession session = factory.GetRepositories(parameters)[0].CreateSession();
+
+            IOperationContext oc = session.CreateOperationContext();
+            oc.MaxItemsPerPage = 100;
+
+            IFolder folder = createData(session);
+            //IFolder folder = session.GetObjectByPath(@"/childrenTestFolder") as IFolder;
+
+            int counter = 0;
+            foreach (ICmisObject child in folder.GetChildren(oc))
+            {
+                Console.WriteLine("!" + counter + " " + child.Name);
+                counter++;
+            }
+
+            Assert.AreEqual(numOfDocuments, counter);
+
+            counter = 0;
+            foreach (ICmisObject child in folder.GetChildren(oc).GetPage(150))
+            {
+                Console.WriteLine("#" + counter + " " + child.Name);
+                counter++;
+            }
+
+            Assert.AreEqual(150, counter);
+
+            counter = 0;
+            foreach (ICmisObject child in folder.GetChildren(oc).SkipTo(20).GetPage(180))
+            {
+                Console.WriteLine("*" + counter + " " + child.Name);
+                counter++;
+            }
+
+            Assert.AreEqual(180, counter);
+
+            folder.DeleteTree(true, null, true);
+        }
+
+
+        private IFolder createData(ISession session)
+        {
+            Dictionary<string, object> properties = new Dictionary<string, object>();
+            properties[PropertyIds.Name] = "childrenTestFolder";
+            properties[PropertyIds.ObjectTypeId] = "cmis:folder";
+
+            IFolder folder = session.GetRootFolder().CreateFolder(properties);
+
+            for (int i = 0; i < numOfDocuments; i++)
+            {
+                Dictionary<string, object> docProps = new Dictionary<string, object>();
+                docProps[PropertyIds.Name] = "doc" + i;
+                docProps[PropertyIds.ObjectTypeId] = "cmis:document";
+
+                folder.CreateDocument(docProps, null, null);
+
+            }
+
+            return folder;
+        }
+    }
+}

Modified: chemistry/dotcmis/trunk/DotCMISUnitTest/SmokeTest.cs
URL: http://svn.apache.org/viewvc/chemistry/dotcmis/trunk/DotCMISUnitTest/SmokeTest.cs?rev=1575249&r1=1575248&r2=1575249&view=diff
==============================================================================
--- chemistry/dotcmis/trunk/DotCMISUnitTest/SmokeTest.cs (original)
+++ chemistry/dotcmis/trunk/DotCMISUnitTest/SmokeTest.cs Fri Mar  7 12:47:40 2014
@@ -1,4 +1,5 @@
-/*
+using System;
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -17,17 +18,17 @@
  * under the License.
  */
 using System.Collections.Generic;
+using System.IO;
+using System.Text;
+using System.Linq;
 using DotCMIS;
 using DotCMIS.Client;
 using DotCMIS.Client.Impl;
-using DotCMIS.Enums;
-using NUnit.Framework;
-using System;
 using DotCMIS.Data;
 using DotCMIS.Data.Impl;
-using System.Text;
-using System.IO;
+using DotCMIS.Enums;
 using DotCMIS.Exceptions;
+using NUnit.Framework;
 
 namespace DotCMISUnitTest
 {
@@ -285,7 +286,7 @@ namespace DotCMISUnitTest
             properties[PropertyIds.Name] = "test-version-smoke.txt";
             properties[PropertyIds.ObjectTypeId] = DefaultDocumentType;
 
-            IDocument doc = TestFolder.CreateDocument(properties, null, null);
+            IDocument doc = TestFolder.CreateDocument(properties, null, VersioningState.Major);
             Assert.NotNull(doc);
             Assert.NotNull(doc.Id);
             Assert.AreEqual(properties[PropertyIds.Name], doc.Name);
@@ -316,13 +317,21 @@ namespace DotCMISUnitTest
             // check new version
             Assert.NotNull(doc2);
             Assert.NotNull(doc2.Id);
-            Assert.AreEqual(newProperties[PropertyIds.Name], doc2.Name);
+            // Assert.AreEqual(newProperties[PropertyIds.Name], doc2.Name);
             Assert.AreEqual(BaseTypeId.CmisDocument, doc2.BaseTypeId);
 
             versions = doc2.GetAllVersions();
             Assert.NotNull(versions);
             Assert.AreEqual(2, versions.Count);
 
+            IDocument last1 = doc.GetObjectOfLatestVersion(false);
+            Assert.AreEqual(doc2.Id, last1.Id);
+
+            IOperationContext oc = Session.CreateOperationContext();
+            oc.CacheEnabled = false;
+            IDocument last2 = Session.GetLatestDocumentVersion(doc.Id, oc);
+            Assert.AreEqual(doc2.Id, last2.Id);
+
             doc2.DeleteAllVersions();
 
             try
@@ -354,6 +363,10 @@ namespace DotCMISUnitTest
             Assert.True(folder.AllowableActions.Actions.Contains(Actions.CanGetChildren));
             Assert.False(folder.AllowableActions.Actions.Contains(Actions.CanGetContentStream));
 
+            // rename folder
+            folder.Rename("test-smoke-renamed");
+            Assert.AreEqual("test-smoke-renamed", folder.Name);
+
             // check children
             foreach (ICmisObject cmisObject in folder.GetChildren())
             {
@@ -448,5 +461,13 @@ namespace DotCMISUnitTest
                 Console.WriteLine("ChangesCapability not set!");
             }
         }
+
+        [Test]
+        public void SmokeTestCMIS609()
+        {
+            IFolder rootFolder = Session.GetRootFolder();
+            IEnumerable<ICmisObject> children = rootFolder.GetChildren();
+            List<ICmisObject> childrenList = children.ToList();
+        }
     }
 }



Mime
View raw message