Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Dec 30, 2020. It is now read-only.

Commit 79653e7

Browse filesBrowse files
committed
added MongoFactory for creating connections from appsettings or defaults
1 parent 6c4dbe3 commit 79653e7
Copy full SHA for 79653e7
Expand file treeCollapse file tree

30 files changed

+221
-214
lines changed

‎MongoDB.Driver.Benchmark/Main.cs

Copy file name to clipboardExpand all lines: MongoDB.Driver.Benchmark/Main.cs
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public static void Main (string[] args)
2424
{
2525
SetupDocuments();
2626

27-
Mongo m = new Mongo();
27+
Mongo m = MongoFactory.CreateMongo();
2828
m.Connect();
2929
Database db = m["benchmark"];
3030

‎MongoDB.GridFS.Tests/App.config

Copy file name to clipboard
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<configuration>
3+
<appSettings>
4+
</appSettings>
5+
</configuration>

‎MongoDB.GridFS.Tests/GridFileInfoTest.cs

Copy file name to clipboardExpand all lines: MongoDB.GridFS.Tests/GridFileInfoTest.cs
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace MongoDB.GridFS
1010
[TestFixture]
1111
public class GridFileInfoTest
1212
{
13-
Mongo db = new Mongo();
13+
Mongo db = MongoFactory.CreateMongo();
1414
[Test]
1515
public void TestCreateNonExisting(){
1616
String filename = "newfile.txt";

‎MongoDB.GridFS.Tests/GridFileStreamTest.cs

Copy file name to clipboardExpand all lines: MongoDB.GridFS.Tests/GridFileStreamTest.cs
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace MongoDB.GridFS
1010
[TestFixture]
1111
public class GridFileStreamTest
1212
{
13-
Mongo db = new Mongo();
13+
Mongo db = MongoFactory.CreateMongo();
1414
GridFile fs;
1515

1616
String filesystem = "gfstream";

‎MongoDB.GridFS.Tests/GridFileTest.cs

Copy file name to clipboardExpand all lines: MongoDB.GridFS.Tests/GridFileTest.cs
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace MongoDB.GridFS
99
{
1010
[TestFixture]
1111
public class GridFileTest{
12-
Mongo db = new Mongo();
12+
Mongo db = MongoFactory.CreateMongo();
1313

1414
[Test]
1515
public void TestFileDoesNotExist(){
+58-55Lines changed: 58 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,59 @@
1-
<?xml version="1.0" encoding="utf-8"?>
2-
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
3-
<PropertyGroup>
4-
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5-
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
6-
<ProductVersion>9.0.21022</ProductVersion>
7-
<SchemaVersion>2.0</SchemaVersion>
8-
<ProjectGuid>{0C293FE9-F670-4FEF-A60F-20F8C978B1CD}</ProjectGuid>
9-
<OutputType>Library</OutputType>
10-
<AssemblyName>MongoDB.GridFS.Tests</AssemblyName>
11-
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
12-
<RootNamespace>MongoDB.GridFS.Tests</RootNamespace>
13-
</PropertyGroup>
14-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
15-
<DebugSymbols>true</DebugSymbols>
16-
<DebugType>full</DebugType>
17-
<Optimize>false</Optimize>
18-
<OutputPath>bin\Debug</OutputPath>
19-
<DefineConstants>DEBUG</DefineConstants>
20-
<ErrorReport>prompt</ErrorReport>
21-
<WarningLevel>4</WarningLevel>
22-
<ConsolePause>false</ConsolePause>
23-
</PropertyGroup>
24-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
25-
<DebugType>none</DebugType>
26-
<Optimize>false</Optimize>
27-
<OutputPath>bin\Release</OutputPath>
28-
<ErrorReport>prompt</ErrorReport>
29-
<WarningLevel>4</WarningLevel>
30-
<ConsolePause>false</ConsolePause>
31-
</PropertyGroup>
32-
<ItemGroup>
33-
<Reference Include="System" />
34-
<Reference Include="nunit.framework, Version=2.4.3.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77">
35-
<SpecificVersion>False</SpecificVersion>
36-
<HintPath>..\redist\nunit.framework.dll</HintPath>
37-
</Reference>
38-
</ItemGroup>
39-
<ItemGroup>
40-
<Compile Include="AssemblyInfo.cs" />
41-
<Compile Include="GridFileInfoTest.cs" />
42-
<Compile Include="GridFileStreamTest.cs" />
43-
<Compile Include="GridFileTest.cs" />
44-
</ItemGroup>
45-
<ItemGroup>
46-
<ProjectReference Include="..\MongoDBDriver\MongoDB.Driver.csproj">
47-
<Project>{B125BBA6-BFFD-44FA-9254-9B1754CD8AF3}</Project>
48-
<Name>MongoDB.Driver</Name>
49-
</ProjectReference>
50-
<ProjectReference Include="..\MongoDB.GridFS\MongoDB.GridFS.csproj">
51-
<Project>{B42DBBF9-0A1F-4749-9787-013BF8D8F435}</Project>
52-
<Name>MongoDB.GridFS</Name>
53-
</ProjectReference>
54-
</ItemGroup>
55-
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
3+
<PropertyGroup>
4+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
6+
<ProductVersion>9.0.30729</ProductVersion>
7+
<SchemaVersion>2.0</SchemaVersion>
8+
<ProjectGuid>{0C293FE9-F670-4FEF-A60F-20F8C978B1CD}</ProjectGuid>
9+
<OutputType>Library</OutputType>
10+
<AssemblyName>MongoDB.GridFS.Tests</AssemblyName>
11+
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
12+
<RootNamespace>MongoDB.GridFS.Tests</RootNamespace>
13+
</PropertyGroup>
14+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
15+
<DebugSymbols>true</DebugSymbols>
16+
<DebugType>full</DebugType>
17+
<Optimize>false</Optimize>
18+
<OutputPath>bin\Debug</OutputPath>
19+
<DefineConstants>DEBUG</DefineConstants>
20+
<ErrorReport>prompt</ErrorReport>
21+
<WarningLevel>4</WarningLevel>
22+
<ConsolePause>false</ConsolePause>
23+
</PropertyGroup>
24+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
25+
<DebugType>none</DebugType>
26+
<Optimize>false</Optimize>
27+
<OutputPath>bin\Release</OutputPath>
28+
<ErrorReport>prompt</ErrorReport>
29+
<WarningLevel>4</WarningLevel>
30+
<ConsolePause>false</ConsolePause>
31+
</PropertyGroup>
32+
<ItemGroup>
33+
<Reference Include="System" />
34+
<Reference Include="nunit.framework, Version=2.4.3.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77">
35+
<SpecificVersion>False</SpecificVersion>
36+
<HintPath>..\redist\nunit.framework.dll</HintPath>
37+
</Reference>
38+
</ItemGroup>
39+
<ItemGroup>
40+
<Compile Include="AssemblyInfo.cs" />
41+
<Compile Include="GridFileInfoTest.cs" />
42+
<Compile Include="GridFileStreamTest.cs" />
43+
<Compile Include="GridFileTest.cs" />
44+
</ItemGroup>
45+
<ItemGroup>
46+
<ProjectReference Include="..\MongoDBDriver\MongoDB.Driver.csproj">
47+
<Project>{B125BBA6-BFFD-44FA-9254-9B1754CD8AF3}</Project>
48+
<Name>MongoDB.Driver</Name>
49+
</ProjectReference>
50+
<ProjectReference Include="..\MongoDB.GridFS\MongoDB.GridFS.csproj">
51+
<Project>{B42DBBF9-0A1F-4749-9787-013BF8D8F435}</Project>
52+
<Name>MongoDB.GridFS</Name>
53+
</ProjectReference>
54+
</ItemGroup>
55+
<ItemGroup>
56+
<None Include="App.config" />
57+
</ItemGroup>
58+
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
5659
</Project>

‎MongoDB.Linq.Tests/App.config

Copy file name to clipboard
-5Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
<?xml version="1.0" encoding="utf-8" ?>
22
<configuration>
3-
<configSections>
4-
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/>
5-
</configSections>
63
<appSettings>
7-
<add key="mongo.host" value="dev01.notify.me"/>
8-
<add key="mongo.port" value="27017"/>
94
</appSettings>
105
</configuration>

‎MongoDB.Linq.Tests/AppSettingsFactory.cs

Copy file name to clipboardExpand all lines: MongoDB.Linq.Tests/AppSettingsFactory.cs
-21Lines changed: 0 additions & 21 deletions
This file was deleted.

‎MongoDB.Linq.Tests/MongoDB.Linq.Tests.csproj

Copy file name to clipboardExpand all lines: MongoDB.Linq.Tests/MongoDB.Linq.Tests.csproj
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?xml version="1.0" encoding="utf-8"?>
1+
<?xml version="1.0" encoding="utf-8"?>
22
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
33
<PropertyGroup>
44
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -54,7 +54,6 @@
5454
<Reference Include="System.Xml" />
5555
</ItemGroup>
5656
<ItemGroup>
57-
<Compile Include="AppSettingsFactory.cs" />
5857
<Compile Include="TestExpressions.cs" />
5958
<Compile Include="TestMongoDocumentQuerySyntax.cs" />
6059
<Compile Include="TestQueryExecution.cs" />

‎MongoDB.Linq.Tests/TestQueryExecution.cs

Copy file name to clipboardExpand all lines: MongoDB.Linq.Tests/TestQueryExecution.cs
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public class TestQueryExecution {
1212
[TestFixtureSetUp]
1313
public void GlobalSetup() {
1414
Debug.WriteLine("initiallizing connection");
15-
mongo = AppSettingsFactory.CreateMongo();
15+
mongo = MongoFactory.CreateMongo();
1616
mongo.Connect();
1717
}
1818

‎MongoDB.Net-Tests/App.config

Copy file name to clipboard
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<configuration>
3+
<appSettings>
4+
</appSettings>
5+
</configuration>

‎MongoDB.Net-Tests/MongoDB.Driver.Tests.csproj

Copy file name to clipboardExpand all lines: MongoDB.Net-Tests/MongoDB.Driver.Tests.csproj
+2-4Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?xml version="1.0" encoding="utf-8"?>
1+
<?xml version="1.0" encoding="utf-8"?>
22
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
33
<PropertyGroup>
44
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -72,6 +72,7 @@
7272
<Compile Include="TestConnection.cs" />
7373
<Compile Include="IO\TestMsgMessage.cs" />
7474
<Compile Include="TestB.cs" />
75+
<None Include="App.config" />
7576
<None Include="test-data\tests.charreads.txt" />
7677
<None Include="test-data\tests.reads.txt" />
7778
<None Include="test-data\tests.smallreads.txt" />
@@ -117,7 +118,4 @@
117118
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
118119
</EmbeddedResource>
119120
</ItemGroup>
120-
<ItemGroup>
121-
<Folder Include="Util\" />
122-
</ItemGroup>
123121
</Project>

‎MongoDB.Net-Tests/MongoTestBase.cs

Copy file name to clipboardExpand all lines: MongoDB.Net-Tests/MongoTestBase.cs
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ public Database DB{
2020

2121

2222
[TestFixtureSetUp]
23-
public virtual void Init(){
24-
this.Mongo = new Mongo();
23+
public virtual void Init(){
24+
this.Mongo = MongoFactory.CreateMongo();
2525
this.Mongo.Connect();
2626
cleanDB();
2727
}

‎MongoDB.Net-Tests/TestAuthentication.cs

Copy file name to clipboardExpand all lines: MongoDB.Net-Tests/TestAuthentication.cs
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ namespace MongoDB.Driver
1515
[TestFixture]
1616
public class TestAuthentication
1717
{
18-
Mongo mongo = new Mongo();
18+
Mongo mongo = MongoFactory.CreateMongo();
1919

2020
Database db;
2121
String testuser = "testuser";

‎MongoDB.Net-Tests/TestB.cs

Copy file name to clipboardExpand all lines: MongoDB.Net-Tests/TestB.cs
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ public class TestB
1717

1818
[Test()]
1919
public void TestCase(){
20-
TcpClient client = new TcpClient();
21-
client.Connect("localhost", 27017);
20+
TcpClient client = new TcpClient();
21+
client.Connect(MongoFactory.Host, MongoFactory.Port);
2222
BufferedStream buff = new BufferedStream(client.GetStream());
2323
BinaryWriter writer = new BinaryWriter(buff);
2424

‎MongoDB.Net-Tests/TestCollection.cs

Copy file name to clipboardExpand all lines: MongoDB.Net-Tests/TestCollection.cs
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ namespace MongoDB.Driver
77
[TestFixture]
88
public class TestCollection
99
{
10-
Mongo db = new Mongo();
10+
Mongo db = MongoFactory.CreateMongo();
11+
1112
private string pound = "\u00a3";
1213

1314
[Test]

‎MongoDB.Net-Tests/TestCollectionMetaData.cs

Copy file name to clipboardExpand all lines: MongoDB.Net-Tests/TestCollectionMetaData.cs
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ namespace MongoDB.Driver
88
{
99
[TestFixture]
1010
public class TestCollectionMetaData
11-
{
12-
Mongo db = new Mongo();
11+
{
12+
Mongo db = MongoFactory.CreateMongo();
1313

1414
[Test]
1515
public void TestGetOptions(){

‎MongoDB.Net-Tests/TestConcurrency.cs

Copy file name to clipboardExpand all lines: MongoDB.Net-Tests/TestConcurrency.cs
+8-8Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ public class TestConcurrency
1313
/*
1414
* Having all of these tests enabled will slow the test suite down a lot. In the future it may be better
1515
* to have them ifdef'ed so that the long running tests can be executed by just setting a compile flag.
16-
*/
17-
Mongo db = new Mongo();
16+
*/
17+
Mongo db = MongoFactory.CreateMongo();
1818

1919
//[Test]
20-
public void TestMultiThreadedWrites (){
21-
Mongo db = new Mongo();
20+
public void TestMultiThreadedWrites (){
21+
Mongo db = MongoFactory.CreateMongo();
2222
db.Connect();
2323

2424
IMongoCollection col = db["tests"]["threadinserts"];
@@ -44,8 +44,8 @@ public void TestMultiThreadedWrites (){
4444
}
4545

4646
//[Test]
47-
public void TestMultiThreadedReads(){
48-
Mongo db = new Mongo();
47+
public void TestMultiThreadedReads(){
48+
Mongo db = MongoFactory.CreateMongo();
4949
db.Connect();
5050

5151
List<string> colnames = new List<string>{"smallreads", "smallreads", "smallreads", "smallreads"};
@@ -73,8 +73,8 @@ public void TestMultiThreadedReads(){
7373
}
7474

7575
[Test]
76-
public void TestMultiThreadedReadsAndWrites(){
77-
Mongo db = new Mongo();
76+
public void TestMultiThreadedReadsAndWrites(){
77+
Mongo db = MongoFactory.CreateMongo();
7878
db.Connect();
7979

8080
IMongoCollection col = db["tests"]["threadreadinserts"];

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.