Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RoundhousE, NServiceBus, and MSMQ modifications #54

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
04b4f04
support RoundhousE to a LocalDb instance
rossbeehlerpg Nov 21, 2012
e80e17d
add ability to RoundhousE by connection string
rossbeehlerpg Nov 22, 2012
a9a6527
merge with chucknorris/dropkick
rossbeehlerpg Nov 28, 2012
17b291c
utilize a connection string setting in DbConnectionInfo
rossbeehlerpg Nov 28, 2012
5bfddfd
extract NServiceBusHostExeArgs
rossbeehlerpg Dec 10, 2012
eb8e40c
add ability to grant specific MessageQueueAccessRights
rossbeehlerpg Dec 10, 2012
f2d7e35
expose ability to grant specific MessageQueueAccessRights
rossbeehlerpg Dec 10, 2012
a03cd4e
add tests for granting specific MessageQueueAccessRights
rossbeehlerpg Dec 10, 2012
f890d64
add ability to create NServiceBus host's msmq queue
rossbeehlerpg Dec 10, 2012
a6c4cfa
add missing ChangeQueuePermissions access to NServiceBus queue to pre…
rossbeehlerpg Dec 10, 2012
2c57a92
set NServiceBus host user to have full control of all created queues
rossbeehlerpg Dec 10, 2012
43e7368
add ability to create NServiceBus retry, error, subscription, audit, …
rossbeehlerpg Dec 10, 2012
941b35c
add more NServiceBus queue options and clean up interface
rossbeehlerpg Dec 14, 2012
0bc4c73
Removing the NServiceBusHostQueues class and its usages. ReSharper cl…
janglin Feb 8, 2013
6f0e1f9
Merge pull request #1 from janglin/master
rossbeehler Feb 8, 2013
4c40beb
remove now dead NServiceBus/Msmq code
rossbeehlerpg Feb 8, 2013
ac52ca7
Removed dead code with NServiceBus queue permissions
janglin Feb 10, 2013
c81cc97
Quoted the user name for remote grant_queue tasks
janglin Feb 21, 2013
1d4aaeb
Added installInfrastruction support for NServiceBusHost tasks
janglin Mar 19, 2013
326c864
Added the command line to the NServiceBus local and remote task execu…
janglin Mar 19, 2013
b1dfd63
merge pull request #2 from janglin
rossbeehlerpg Mar 22, 2013
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions dropkick.sln.DotSettings
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@
<s:String x:Key="/Default/Environment/InjectedLayers/FileInjectedLayer/=02B920D5E6BDCC4DA01F4350C408666D/AbsolutePath/@EntryValue">C:\dev\dropkick\dropkick.DotSettings</s:String>
<s:String x:Key="/Default/Environment/InjectedLayers/FileInjectedLayer/=02B920D5E6BDCC4DA01F4350C408666D/RelativePath/@EntryValue">..\dropkick.DotSettings</s:String>
<s:Boolean x:Key="/Default/Environment/InjectedLayers/FileInjectedLayer/=02B920D5E6BDCC4DA01F4350C408666D/@KeyIndexDefined">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/InjectedLayers/InjectedLayerCustomization/=File02B920D5E6BDCC4DA01F4350C408666D/@KeyIndexDefined">True</s:Boolean>
<s:Double x:Key="/Default/Environment/InjectedLayers/InjectedLayerCustomization/=File02B920D5E6BDCC4DA01F4350C408666D/RelativePriority/@EntryValue">2</s:Double>
<s:Boolean x:Key="/Default/Environment/InjectedLayers/InjectedLayerCustomization/=File_003A_003AC_003A_005Cdev_005Cdropkick_005Cdropkick_002EDotSettings/@KeyIndexDefined">True</s:Boolean>
<s:Double x:Key="/Default/Environment/InjectedLayers/InjectedLayerCustomization/=File_003A_003AC_003A_005Cdev_005Cdropkick_005Cdropkick_002EDotSettings/RelativePriority/@EntryValue">1</s:Double></wpf:ResourceDictionary>
28 changes: 16 additions & 12 deletions product/dropkick.remote/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
// CONDITIONS OF ANY KIND, either express or implied. See the License for the
// specific language governing permissions and limitations under the License.
using System.Collections.Generic;

using System.Security.Cryptography.X509Certificates;
using dropkick.DeploymentModel;
using dropkick.FileSystem;
Expand Down Expand Up @@ -49,7 +49,7 @@ static void Main(string[] args)

//TODO:remote needs to become as awesome as the regular console

DeploymentResult result = new DeploymentResult();
var result = new DeploymentResult();

switch (args[0])
{
Expand Down Expand Up @@ -93,7 +93,7 @@ private static void DisplayResults(DeploymentResult results)

private static DeploymentResult VerifyMsmqExists(string[] args)
{
DeploymentResult result = new DeploymentResult();
var result = new DeploymentResult();
var queuename = args[1];
var queueAddress = new QueueAddress(queuename);
var formattedName = queueAddress.LocalName;
Expand All @@ -106,29 +106,33 @@ private static DeploymentResult VerifyMsmqExists(string[] args)

private static DeploymentResult CreateMsmq(string[] args)
{
DeploymentResult result = new DeploymentResult();

var queuename = args[1];
var queueAddress = new QueueAddress(queuename);
var transactional = false;
if (args.Length > 2)
bool.TryParse(args[2], out transactional);

result = new CreateLocalMsmqQueueTask(_server, queueAddress, transactional).Execute();
var result = new CreateLocalMsmqQueueTask(_server, queueAddress, transactional).Execute();

return result;
}

private static DeploymentResult GrantMsmqPermissions(string[] args)
{
DeploymentResult result = new DeploymentResult();
var result = new DeploymentResult();

var perm = args[1];
var user = args[2];
var queue = args[3];

var queueAddress = new QueueAddress(queue);

int accessRights;
if (int.TryParse(perm, out accessRights))
{
return new LocalMsmqGrantAccessRightsTask(queueAddress, user, (MessageQueueAccessRights)accessRights).Execute();
}

switch (perm)
{
case "r":
Expand All @@ -150,18 +154,18 @@ private static DeploymentResult GrantMsmqPermissions(string[] args)

private static DeploymentResult GrantCertificatePermissions(string[] args)
{
DeploymentResult result = new DeploymentResult();
var result = new DeploymentResult();

var perm = args[1];
var groupArray = args[2];
var thumbprint = args[3];
string s_storeName = args[4];
var s_storeLocation = args[5];
var storeNameArg = args[4];
var storeLocationArg = args[5];

var groups = groupArray.Split(new[]{"|"},StringSplitOptions.RemoveEmptyEntries);

StoreName storeName = (StoreName)Enum.Parse(typeof(StoreName), s_storeName,true);
StoreLocation storeLocation = (StoreLocation)Enum.Parse(typeof(StoreLocation), s_storeLocation,true);
var storeName = (StoreName)Enum.Parse(typeof(StoreName), storeNameArg,true);
var storeLocation = (StoreLocation)Enum.Parse(typeof(StoreLocation), storeLocationArg,true);

switch (perm)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public override void Context()
{
base.Context();
RemoveLocalQueueIfExistsAndCreate(address.LocalName);

task = new LocalMsmqGrantReadTask(address, user);
}

Expand Down Expand Up @@ -243,5 +243,83 @@ public void should_not_contain_any_errors()
Assert.IsFalse(result.ContainsError(), "Errors occured during permission setting.{0}{1}".FormatWith(Environment.NewLine, result.ToString()));
}
}

[ConcernFor("MSMQ Tasks")]
[Category("Integration")]
public class when_granting_access_rights_to_a_local_queue_for_a_user : MsmqGrantSecuritySpecsBase
{
protected LocalMsmqGrantAccessRightsTask task;

public override void Context()
{
base.Context();
RemoveLocalQueueIfExistsAndCreate(address.LocalName);

task = new LocalMsmqGrantAccessRightsTask(address, user, MessageQueueAccessRights.DeleteMessage);
}

public override void Because()
{
result = task.Execute();
}

[Fact]
public void should_complete_successfully()
{
//no code issues
}

[Fact]
public void should_return_a_result()
{
Assert.IsNotNull(result);
}

[Fact]
public void should_not_contain_any_errors()
{
Assert.IsFalse(result.ContainsError(), "Errors occured during permission setting.{0}{1}".FormatWith(Environment.NewLine, result.ToString()));
}
}

[ConcernFor("MSMQ Tasks")]
[Category("Integration")]
public class when_granting_access_rights_to_a_local_queue_for_a_group : MsmqGrantSecuritySpecsBase
{
protected LocalMsmqGrantAccessRightsTask task;

public override void Context()
{
base.Context();
RemoveLocalQueueIfExistsAndCreate(address.LocalName);

task = new LocalMsmqGrantAccessRightsTask(address, @"Everyone", MessageQueueAccessRights.FullControl);
}

public override void Because()
{
result = task.Execute();
}


[Fact]
public void should_complete_successfully()
{
//no code issues
}

[Fact]
public void should_return_a_result()
{
Assert.IsNotNull(result);
}

[Fact]
public void should_not_contain_any_errors()
{
Assert.IsFalse(result.ContainsError(), "Errors occured during permission setting.{0}{1}".FormatWith(Environment.NewLine, result.ToString()));
}
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,15 @@ public class NServiceBusHostConfigurator :
BaseProtoTask,
NServiceBusHostOptions
{
readonly NServiceBusHostExeArgs _args;
readonly Path _path;
string _serviceName;
string _displayName;
string _description;
string _instanceName;
string _location;
string _exeName;
string _password;
string _username;
string _profiles;

public NServiceBusHostConfigurator(Path path)
{
_path = path;
_args = new NServiceBusHostExeArgs();
}

public void ExeName(string name)
Expand All @@ -44,7 +39,7 @@ public void ExeName(string name)

public void Instance(string name)
{
_instanceName = name;
_args.InstanceName = name;
}

public void LocatedAt(string location)
Expand All @@ -54,40 +49,57 @@ public void LocatedAt(string location)

public void PassCredentials(string username, string password)
{
_username = username;
_password = password;
_args.Username = username;
_args.Password = password;
}

public void ServiceName(string name)
{
_serviceName = name;
_args.ServiceName = name;
}

public void ServiceDisplayName(string name)
{
_displayName = name;
_args.DisplayName = name;
}

public void ServiceDescription(string description)
{
_description = description;
_args.Description = description;
}

public void EndpointConfigurationType(string iConfigureThisEndpointTypeFullName, string assembly)
{
_args.EndpointConfigurationType = iConfigureThisEndpointTypeFullName + ", " + assembly;
}

public void EndpointName(string name)
{
_args.EndpointName = name;
}

public void Profiles(string profiles)
{
_profiles = profiles;
_args.Profiles = profiles;
}

public void InstallInfrastructure()
{
_args.InstallInfrastructure = true;
}

public override void RegisterRealTasks(PhysicalServer site)
{
_args.PromptForUsernameAndPasswordIfNecessary(_exeName);

var location = _path.GetPhysicalPath(site, _location, true);
if (site.IsLocal)
{
site.AddTask(new LocalNServiceBusHostTask(_exeName, location, _instanceName, _username, _password, _serviceName, _displayName, _description, _profiles));
site.AddTask(new LocalNServiceBusHostTask(_exeName, location, _args));
}
else
{
site.AddTask(new RemoteNServiceBusHostTask(_exeName, location, _instanceName, site, _username, _password, _serviceName, _displayName, _description, _profiles));
site.AddTask(new RemoteNServiceBusHostTask(_exeName, location, site, _args));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ public interface NServiceBusHostOptions
void ServiceName(string name);
void ServiceDisplayName(string name);
void ServiceDescription(string description);
void EndpointName(string name);
void EndpointConfigurationType(string iConfigureThisEndpointTypeFullName, string assembly);
void Profiles(string profiles);
void InstallInfrastructure();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public interface RoundhousEOptions
// RoundhousEOptions ForDatabaseType(string type);
RoundhousEOptions OnInstance(string name);
RoundhousEOptions OnDatabase(string name);
RoundhousEOptions OnConnectionString(string connectionString);
RoundhousEOptions WithUserName(string userName);
RoundhousEOptions WithPassword(string password);
RoundhousEOptions WithRoundhousEMode(RoundhousEMode roundhouseMode);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,21 @@
// CONDITIONS OF ANY KIND, either express or implied. See the License for the
// specific language governing permissions and limitations under the License.

using dropkick.FileSystem;

namespace dropkick.Configuration.Dsl.RoundhousE
{
using System;
using DeploymentModel;
using Magnum.Extensions;
using Tasks.RoundhousE;
using Tasks;

public class RoundhousEProtoTask :
BaseProtoTask,
RoundhousEOptions
{
private readonly Path _path = new DotNetPath();

string _environmentName;
string _instanceName;
string _databaseName;
string _connectionString;
string _scriptsLocation;
private RoundhousEMode _roundhouseMode;
private DatabaseRecoveryMode _recoveryMode;
Expand Down Expand Up @@ -66,6 +63,12 @@ public RoundhousEOptions OnDatabase(string name)
return this;
}

public RoundhousEOptions OnConnectionString(string connectionString)
{
_connectionString = ReplaceTokens(connectionString);
return this;
}

public RoundhousEOptions WithRoundhousEMode(RoundhousEMode roundhouseMode)
{
_roundhouseMode = roundhouseMode;
Expand Down Expand Up @@ -213,14 +216,22 @@ public RoundhousEOptions WithOutputPath(string outputPath)

public override void RegisterRealTasks(PhysicalServer site)
{
var connectionInfo = new DbConnectionInfo{
Server = site.Name,
Instance = _instanceName,
DatabaseName = _databaseName,
UserName = _userName,
Password = _password
};
// string scriptsLocation = PathConverter.Convert(site, _path.GetFullPath(_scriptsLocation));
DbConnectionInfo connectionInfo;
if (_connectionString.IsNotEmpty())
{
connectionInfo = new DbConnectionInfo(_connectionString);
}
else
{
connectionInfo = new DbConnectionInfo
{
Server = site.Name,
Instance = _instanceName,
DatabaseName = _databaseName,
UserName = _userName,
Password = _password
};
}

var task = new RoundhousETask(connectionInfo, _scriptsLocation,
_environmentName, _roundhouseMode,
Expand Down
Loading