- made unit test more flexible
- added a few sentences about strong names to the README file
git-svn-id: https://svn.apache.org/repos/asf/chemistry/dotcmis/trunk@1077914 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/DotCMISUnitTest/CRUDTest.cs b/DotCMISUnitTest/CRUDTest.cs
index 64c3cd3..d2f05fa 100644
--- a/DotCMISUnitTest/CRUDTest.cs
+++ b/DotCMISUnitTest/CRUDTest.cs
@@ -50,7 +50,7 @@
{
string content1 = "my content";
- IObjectData doc = CreateDocument(RepositoryInfo.RootFolderId, "dottest", content1);
+ IObjectData doc = CreateDocument(TestFolder.Id, "dottest", content1);
string content2 = GetTextContent(doc.Id);
Assert.AreEqual(content1, content2);
@@ -61,7 +61,7 @@
[Test]
public void TestCreateFolder()
{
- IObjectData folder0 = CreateFolder(RepositoryInfo.RootFolderId, "folder0");
+ IObjectData folder0 = CreateFolder(TestFolder.Id, "folder0");
IObjectData folder1 = CreateFolder(folder0.Id, "folder1");
IObjectData folder2 = CreateFolder(folder1.Id, "folder2");
IObjectData folder3 = CreateFolder(folder2.Id, "folder3");
diff --git a/DotCMISUnitTest/SmokeTest.cs b/DotCMISUnitTest/SmokeTest.cs
index b67d680..7dfc352 100644
--- a/DotCMISUnitTest/SmokeTest.cs
+++ b/DotCMISUnitTest/SmokeTest.cs
@@ -177,11 +177,9 @@
[Test]
public void SmokeTestCreateDocument()
{
- IFolder rootFolder = Session.GetRootFolder();
-
IDictionary<string, object> properties = new Dictionary<string, object>();
properties[PropertyIds.Name] = "test-smoke.txt";
- properties[PropertyIds.ObjectTypeId] = "cmis:document";
+ properties[PropertyIds.ObjectTypeId] = DefaultDocumentType;
byte[] content = UTF8Encoding.UTF8.GetBytes("Hello World!");
@@ -191,7 +189,7 @@
contentStream.Length = content.Length;
contentStream.Stream = new MemoryStream(content);
- IDocument doc = rootFolder.CreateDocument(properties, contentStream, null);
+ IDocument doc = TestFolder.CreateDocument(properties, contentStream, null);
// check doc
Assert.NotNull(doc);
@@ -260,13 +258,11 @@
[Test]
public void SmokeTestVersioning()
{
- IFolder rootFolder = Session.GetRootFolder();
-
IDictionary<string, object> properties = new Dictionary<string, object>();
properties[PropertyIds.Name] = "test-version-smoke.txt";
- properties[PropertyIds.ObjectTypeId] = "cmis:document";
+ properties[PropertyIds.ObjectTypeId] = DefaultDocumentType;
- IDocument doc = rootFolder.CreateDocument(properties, null, null);
+ IDocument doc = TestFolder.CreateDocument(properties, null, null);
Assert.NotNull(doc);
Assert.NotNull(doc.Id);
Assert.AreEqual(properties[PropertyIds.Name], doc.Name);
@@ -317,20 +313,18 @@
[Test]
public void SmokeTestCreateFolder()
{
- IFolder rootFolder = Session.GetRootFolder();
-
IDictionary<string, object> properties = new Dictionary<string, object>();
properties[PropertyIds.Name] = "test-smoke";
- properties[PropertyIds.ObjectTypeId] = "cmis:folder";
+ properties[PropertyIds.ObjectTypeId] = DefaultFolderType;
- IFolder folder = rootFolder.CreateFolder(properties);
+ IFolder folder = TestFolder.CreateFolder(properties);
// check folder
Assert.NotNull(folder);
Assert.NotNull(folder.Id);
Assert.AreEqual(properties[PropertyIds.Name], folder.Name);
Assert.AreEqual(BaseTypeId.CmisFolder, folder.BaseTypeId);
- Assert.AreEqual(rootFolder.Id, folder.FolderParent.Id);
+ Assert.AreEqual(TestFolder.Id, folder.FolderParent.Id);
Assert.False(folder.IsRootFolder);
Assert.True(folder.Path.StartsWith("/"));
Assert.True(folder.AllowableActions.Actions.Contains(Actions.CanGetProperties));
@@ -384,7 +378,7 @@
// check parents
IFolder parent = folder.FolderParent;
Assert.NotNull(parent);
- Assert.AreEqual(rootFolder.Id, parent.Id);
+ Assert.AreEqual(TestFolder.Id, parent.Id);
IList<IFolder> parents = folder.Parents;
Assert.NotNull(parents);
@@ -393,7 +387,7 @@
bool found = false;
foreach (IFolder p in parents)
{
- if (rootFolder.Id == p.Id)
+ if (TestFolder.Id == p.Id)
{
found = true;
break;
diff --git a/DotCMISUnitTest/TestFramework.cs b/DotCMISUnitTest/TestFramework.cs
index 50995c9..fcd7c7d 100644
--- a/DotCMISUnitTest/TestFramework.cs
+++ b/DotCMISUnitTest/TestFramework.cs
@@ -55,6 +55,7 @@
public string DefaultDocumentType { get; set; }
public string DefaultFolderType { get; set; }
+ public IFolder TestFolder { get; set; }
[SetUp]
public void Init()
@@ -66,7 +67,7 @@
Session = ConnectFromConfig();
}
-
+
public ISession ConnectFromConfig()
{
Dictionary<string, string> parameters = new Dictionary<string, string>();
@@ -76,6 +77,18 @@
parameters[key] = ConfigurationManager.AppSettings.Get(key);
}
+ string documentType = ConfigurationManager.AppSettings.Get("test.documenttype");
+ if (documentType != null)
+ {
+ DefaultDocumentType = documentType;
+ }
+
+ string folderType = ConfigurationManager.AppSettings.Get("test.foldertype");
+ if (folderType != null)
+ {
+ DefaultFolderType = folderType;
+ }
+
SessionFactory factory = SessionFactory.NewInstance();
ISession session = null;
@@ -93,6 +106,19 @@
Assert.NotNull(session.RepositoryInfo);
Assert.NotNull(session.RepositoryInfo.Id);
+ string testRootFolderPath = ConfigurationManager.AppSettings.Get("test.rootfolder");
+ if (testRootFolderPath == null)
+ {
+ TestFolder = session.GetRootFolder();
+ }
+ else
+ {
+ TestFolder = session.GetObjectByPath(testRootFolderPath) as IFolder;
+ }
+
+ Assert.NotNull(TestFolder);
+ Assert.NotNull(TestFolder.Id);
+
return session;
}
diff --git a/DotCMISUnitTest/app.config b/DotCMISUnitTest/app.config
index de735fa..a38b0d9 100644
--- a/DotCMISUnitTest/app.config
+++ b/DotCMISUnitTest/app.config
@@ -19,5 +19,9 @@
<add key="org.apache.chemistry.dotcmis.user" value="admin" />
<add key="org.apache.chemistry.dotcmis.password" value="admin" />
+
+ <add key="test.rootfolder" value="/"/>
+ <add key="test.documenttype" value="cmis:document"/>
+ <add key="test.foldertype" value="cmis:folder"/>
</appSettings>
</configuration>
\ No newline at end of file
diff --git a/README b/README
index 34d4832..d160cc6 100644
--- a/README
+++ b/README
@@ -6,7 +6,8 @@
See http://chemistry.apache.org/dotnet/dotcmis.html for more information.
-See http://chemistry.apache.org/dotnet/getting-started-with-dotcmis.html for code samples.
+See http://chemistry.apache.org/dotnet/getting-started-with-dotcmis.html for code samples
+and DotCMISDoc.chm for the API documentation.
This is the very first release of DotCMIS. All CMIS operations and both bindings have
@@ -28,3 +29,13 @@
- Not all CMIS Web Services endpoints are compatible with the .NET framework for a number
of reasons. Use the AtomPub binding if available. It's also faster.
+
+Strong-Name signing
+-------------------
+
+The DLL included in this release is signed with a public/private key pair that is also
+included in this package. This allows you to deploy it to the global assembly cache (GAC)
+and to make changes to the DotCMIS source code without recompiling your application.
+However, since the private key is publicly available, this strong name cannot be trusted.
+If a trust relationship between your application and the DotCMIS DLL is important to you,
+you have to rebuild the DLL from the source code and sign it yourself.