Skip to content
This repository has been archived by the owner on Dec 30, 2020. It is now read-only.

Commit

Permalink
Fix some warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
lanwin committed Mar 23, 2010
1 parent a19dfb5 commit 4a0cc9b
Show file tree
Hide file tree
Showing 16 changed files with 43 additions and 46 deletions.
6 changes: 3 additions & 3 deletions MongoDB.Driver.Benchmark/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public static void Main (string[] args)
m.Connect();
MongoDatabase db = m["benchmark"];

db.MetaData.DropDatabase();
db.Metadata.DropDatabase();
Console.WriteLine("Starting Tests");

RunEncodeTest("encode (small)",small);
Expand All @@ -39,7 +39,7 @@ public static void Main (string[] args)
RunDecodeTest("decode (medium)", medium);
RunDecodeTest("decode (large)", large);

db.MetaData.DropDatabase();
db.Metadata.DropDatabase();
RunInsertTest("insert (small, no index)", db, "small_none",small,false,false);
RunInsertTest("insert (medium, no index)", db, "medium_none",medium,false,false);
RunInsertTest("insert (large, no index)", db, "large_none",large,false,false);
Expand Down Expand Up @@ -117,7 +117,7 @@ static void RunInsertTest(string name, MongoDatabase db, string col, Document do

static void SetupInsert(MongoDatabase db, string col, bool index){
try{
db.MetaData.DropCollection(col);
db.Metadata.DropCollection(col);
if(index){
Document idx = new Document().Add("x", IndexOrder.Ascending);
db[col].MetaData.CreateIndex(idx,false);
Expand Down
6 changes: 2 additions & 4 deletions MongoDB.GridFS/GridFileStream.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System;
using System.IO;

using MongoDB.Driver;
Expand Down Expand Up @@ -197,7 +195,7 @@ private void ValidateReadState (byte[] array, int offset, int count)
/// <summary>
/// Copies from the source array into the grid file.
/// </summary>
/// <param name="array">A <see cref="System.Byte[]"/> The source array to copy from.</param>
/// <param name="array">The array.</param>
/// <param name="offset">A <see cref="System.Int32"/> The offset within the source array.</param>
/// <param name="count">A <see cref="System.Int32"/> The number of bytes from within the source array to copy.</param>
public override void Write (byte[] array, int offset, int count)
Expand Down
12 changes: 6 additions & 6 deletions MongoDB.Net-Tests/TestAuthentication.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ public void SetUp()
mongo.Connect();

var testDatabase = mongo[testDatabaseName];
if(testDatabase.MetaData.FindUser(testuser) == null)
testDatabase.MetaData.AddUser(testuser, testpass);
if(testDatabase.Metadata.FindUser(testuser) == null)
testDatabase.Metadata.AddUser(testuser, testpass);

var adminDatabase = mongo["admin"];
if(adminDatabase.MetaData.FindUser(adminuser) == null)
adminDatabase.MetaData.AddUser(adminuser, adminpass);
if(adminDatabase.Metadata.FindUser(adminuser) == null)
adminDatabase.Metadata.AddUser(adminuser, adminpass);
}
}

Expand Down Expand Up @@ -108,8 +108,8 @@ public void TestTearDown(){
*/
using(var mongo = ConnectAndAuthenticatedMongo(adminuser, adminuser))
{
mongo[testDatabaseName].MetaData.RemoveUser(testuser);
mongo["admin"].MetaData.RemoveUser(adminuser);
mongo[testDatabaseName].Metadata.RemoveUser(testuser);
mongo["admin"].Metadata.RemoveUser(adminuser);
}

// clean connections
Expand Down
12 changes: 6 additions & 6 deletions MongoDB.Net-Tests/TestCollectionMetaData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ public override void OnDispose (){

[Test]
public void TestGetOptions(){
CollectionMetaData cmd = DB["reads"].MetaData;
CollectionMetadata cmd = DB["reads"].MetaData;
Document options = cmd.Options;
Assert.IsNotNull(options);
}

[Test]
public void TestGetIndexes(){
CollectionMetaData cmd = DB["indextests"].MetaData;
CollectionMetadata cmd = DB["indextests"].MetaData;
Dictionary<string, Document> indexes = cmd.Indexes;

Assert.IsNotNull(indexes);
Expand All @@ -54,23 +54,23 @@ public void TestGetIndexes(){

[Test]
public void TestCreateIndex(){
CollectionMetaData cmd = DB["indextests"].MetaData;
CollectionMetadata cmd = DB["indextests"].MetaData;
cmd.CreateIndex("lastnames", new Document().Add("lname", IndexOrder.Ascending), false);
Dictionary<string, Document> indexes = cmd.Indexes;
Assert.IsNotNull(indexes["lastnames"]);
}

[Test]
public void TestCreateIndexNoNames(){
CollectionMetaData cmd = DB["indextests"].MetaData;
CollectionMetadata cmd = DB["indextests"].MetaData;
cmd.CreateIndex(new Document().Add("lname", IndexOrder.Ascending).Add("fname", IndexOrder.Ascending), true);
Dictionary<string, Document> indexes = cmd.Indexes;
Assert.IsNotNull(indexes["_lname_fname_unique_"]);
}

[Test]
public void TestDropIndex(){
CollectionMetaData cmd = DB["indextests"].MetaData;
CollectionMetadata cmd = DB["indextests"].MetaData;
cmd.CreateIndex("firstnames", new Document().Add("fname", IndexOrder.Ascending), false);
Dictionary<string, Document> indexes = cmd.Indexes;
Assert.IsNotNull(indexes["firstnames"]);
Expand All @@ -82,7 +82,7 @@ public void TestDropIndex(){
public void TestRename(){
DB["rename"].Insert(new Document(){{"test", "rename"}});
Assert.AreEqual(1, DB["rename"].Count());
CollectionMetaData cmd = DB["rename"].MetaData;
CollectionMetadata cmd = DB["rename"].MetaData;
cmd.Rename("renamed");
Assert.IsFalse(DB.GetCollectionNames().Contains(DB.Name + ".rename"), "Shouldn't have found collection");
Assert.IsTrue(DB.GetCollectionNames().Contains(DB.Name + ".renamed"),"Should have found collection");
Expand Down
10 changes: 5 additions & 5 deletions MongoDB.Net-Tests/TestDatabaseMetaData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public override void OnInit () {

[Test]
public void TestCreateCollectionNoOptions(){
DB.MetaData.CreateCollection("creatednoopts");
DB.Metadata.CreateCollection("creatednoopts");

List<String> names = DB.GetCollectionNames();
Assert.IsTrue(names.Contains("tests.creatednoopts"));
Expand All @@ -31,7 +31,7 @@ public void TestCreateCollectionNoOptions(){
[Test]
public void TestCreateCollectionWithOptions(){
Document options = new Document().Add("capped", true).Add("size", 10000);
DB.MetaData.CreateCollection("createdcapped",options);
DB.Metadata.CreateCollection("createdcapped",options);

List<String> names = DB.GetCollectionNames();
Assert.IsTrue(names.Contains("tests.createdcapped"));
Expand All @@ -41,7 +41,7 @@ public void TestCreateCollectionWithOptions(){
[Test]
public void TestCreateCollectionWithInvalidOptions(){
Document options = new Document().Add("invalidoption", true);
DB.MetaData.CreateCollection("createdinvalid",options);
DB.Metadata.CreateCollection("createdinvalid",options);

List<String> names = DB.GetCollectionNames();
Assert.IsTrue(names.Contains("tests.createdinvalid"));
Expand All @@ -50,7 +50,7 @@ public void TestCreateCollectionWithInvalidOptions(){

[Test]
public void TestDropCollection(){
bool dropped = DB.MetaData.DropCollection("todrop");
bool dropped = DB.Metadata.DropCollection("todrop");

Assert.IsTrue(dropped,"Dropped was false");

Expand All @@ -63,7 +63,7 @@ public void TestDropCollection(){
public void TestDropInvalidCollection(){
bool thrown = false;
try{
DB.MetaData.DropCollection("todrop_notexists");
DB.Metadata.DropCollection("todrop_notexists");
}catch(MongoCommandException){
thrown = true;
}
Expand Down
10 changes: 5 additions & 5 deletions MongoDBDriver/CollectionMetaData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace MongoDB.Driver
/// <summary>
/// Lazily loaded meta data on the collection.
/// </summary>
public class CollectionMetaData
public class CollectionMetadata
{
private readonly MongoDatabase _database;
private readonly string _fullName;
Expand All @@ -19,13 +19,13 @@ public class CollectionMetaData
private Document _options;

/// <summary>
/// Initializes a new instance of the <see cref="CollectionMetaData"/> class.
/// Initializes a new instance of the <see cref="CollectionMetadata"/> class.
/// </summary>
/// <param name="serializationFactory">The serialization factory.</param>
/// <param name="databaseName">Name of the db.</param>
/// <param name="databaseName">Name of the database.</param>
/// <param name="name">The name.</param>
/// <param name="connection">The conn.</param>
public CollectionMetaData(ISerializationFactory serializationFactory, string databaseName, string name, Connection connection)
/// <param name="connection">The connection.</param>
public CollectionMetadata(ISerializationFactory serializationFactory, string databaseName, string name, Connection connection)
{
_fullName = databaseName + "." + name;
this._name = name;
Expand Down
6 changes: 3 additions & 3 deletions MongoDBDriver/DatabaseMetaData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@ namespace MongoDB.Driver
/// <summary>
/// Administration of metadata for a database.
/// </summary>
public class DatabaseMetaData
public class DatabaseMetadata
{
private readonly Connection _connection;
private readonly MongoDatabase _database;
private readonly string _name;
private readonly ISerializationFactory _serializationFactory;

/// <summary>
/// Initializes a new instance of the <see cref = "DatabaseMetaData" /> class.
/// Initializes a new instance of the <see cref = "DatabaseMetadata" /> class.
/// </summary>
/// <param name = "serializationFactory">The serialization factory.</param>
/// <param name = "name">The name.</param>
/// <param name = "conn">The conn.</param>
public DatabaseMetaData(ISerializationFactory serializationFactory, string name, Connection conn)
public DatabaseMetadata(ISerializationFactory serializationFactory, string name, Connection conn)
{
this._serializationFactory = serializationFactory;
_connection = conn;
Expand Down
2 changes: 1 addition & 1 deletion MongoDBDriver/IMongoCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public interface IMongoCollection {
/// Gets the meta data.
/// </summary>
/// <value>The meta data.</value>
CollectionMetaData MetaData { get; }
CollectionMetadata MetaData { get; }

/// <summary>
/// Finds the one.
Expand Down
2 changes: 1 addition & 1 deletion MongoDBDriver/IMongoCollection`1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public interface IMongoCollection<T> where T : class
/// <summary>
/// Metadata about the collection such as indexes.
/// </summary>
CollectionMetaData MetaData { get; }
CollectionMetadata MetaData { get; }

/// <summary>
/// Finds and returns the first document in a query.
Expand Down
2 changes: 1 addition & 1 deletion MongoDBDriver/IMongoDatabase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public interface IMongoDatabase
/// Gets the meta data.
/// </summary>
/// <value>The meta data.</value>
DatabaseMetaData MetaData { get; }
DatabaseMetadata Metadata { get; }

/// <summary>
/// Gets the javascript.
Expand Down
2 changes: 1 addition & 1 deletion MongoDBDriver/MapReduce.cs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ public void Dispose(){
return; //Nothing to do.

//Drop the temporary collection that was created as part of results.
database.MetaData.DropCollection(Result.CollectionName);
database.Metadata.DropCollection(Result.CollectionName);
}

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion MongoDBDriver/MongoCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public string FullName {
/// Gets the meta data.
/// </summary>
/// <value>The meta data.</value>
public CollectionMetaData MetaData {
public CollectionMetadata MetaData {
get { return _collection.MetaData; }
}

Expand Down
6 changes: 3 additions & 3 deletions MongoDBDriver/MongoCollection`1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class MongoCollection<T> : IMongoCollection<T> where T : class
{
private readonly Connection _connection;
private MongoDatabase _database;
private CollectionMetaData _metaData;
private CollectionMetadata _metaData;
private readonly ISerializationFactory _serializationFactory;

/// <summary>
Expand Down Expand Up @@ -65,8 +65,8 @@ public string FullName {
/// Gets the meta data.
/// </summary>
/// <value>The meta data.</value>
public CollectionMetaData MetaData {
get { return _metaData ?? (_metaData = new CollectionMetaData(_serializationFactory, DatabaseName, Name, _connection)); }
public CollectionMetadata MetaData {
get { return _metaData ?? (_metaData = new CollectionMetadata(_serializationFactory, DatabaseName, Name, _connection)); }
}

/// <summary>
Expand Down
4 changes: 2 additions & 2 deletions MongoDBDriver/MongoDB.Driver.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
<Compile Include="CommandResults\CommandResultBase.cs" />
<Compile Include="Connections\RawConnection.cs" />
<Compile Include="IMongoDatabase.cs" />
<Compile Include="CollectionMetaData.cs" />
<Compile Include="CollectionMetadata.cs" />
<Compile Include="Connections\Connection.cs" />
<Compile Include="Connections\ConnectionFactory.cs" />
<Compile Include="Connections\ConnectionFactoryBase.cs" />
Expand All @@ -95,7 +95,7 @@
<Compile Include="Connections\SimpleConnectionFactory.cs" />
<Compile Include="AssemblyInfo.cs" />
<Compile Include="Bson\BsonWriter.cs" />
<Compile Include="DatabaseMetaData.cs" />
<Compile Include="DatabaseMetadata.cs" />
<Compile Include="DBRef.cs" />
<Compile Include="Document.cs" />
<Compile Include="Exceptions\MongoCommandException.cs" />
Expand Down
6 changes: 3 additions & 3 deletions MongoDBDriver/MongoDatabase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class MongoDatabase : IMongoDatabase
private readonly ISerializationFactory _serializationFactory;
private readonly Connection _connection;
private DatabaseJavascript _javascript;
private DatabaseMetaData _metaData;
private DatabaseMetadata _metadata;

/// <summary>
/// Initializes a new instance of the <see cref="MongoDatabase"/> class.
Expand Down Expand Up @@ -57,8 +57,8 @@ public MongoDatabase(ISerializationFactory serializationFactory, Connection conn
/// Gets the meta data.
/// </summary>
/// <value>The meta data.</value>
public DatabaseMetaData MetaData{
get { return _metaData ?? (_metaData = new DatabaseMetaData(_serializationFactory, Name, _connection)); }
public DatabaseMetadata Metadata{
get { return _metadata ?? (_metadata = new DatabaseMetadata(_serializationFactory, Name, _connection)); }
}

/// <summary>
Expand Down
1 change: 0 additions & 1 deletion examples/SimpleVB/Application.vb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ Namespace Simple

Public Shared Sub Main()
Dim app As New Application()
Dim c As Collection

app.Setup()
app.Run()
Expand Down

0 comments on commit 4a0cc9b

Please sign in to comment.