[tarantino] r167 committed - - Added logic to check for RuntimeException in remote console output t...

0 views
Skip to first unread message

codesite...@google.com

unread,
Jan 10, 2011, 2:35:09 PM1/10/11
to tarantino...@googlegroups.com
Revision: 167
Author: kwhurwitz
Date: Mon Jan 10 11:34:41 2011
Log: - Added logic to check for RuntimeException in remote console output
to determine build failure or success
- Added wait cursor while the package is downloading
- Added default config files for the deployer console application
http://code.google.com/p/tarantino/source/detail?r=167

Added:
/trunk/src/Tarantino.Deployer.Console/App.config
/trunk/src/Tarantino.Deployer.Console/deployer.hibernate.cfg.xml
Modified:
/trunk/src/Tarantino.Deployer/DeployPackage.cs
/trunk/src/Tarantino.Deployer.Core/Services/Impl/DeploymentFactory.cs

/trunk/src/Tarantino.Deployer.Core/Services/Impl/DeploymentResultCalculator.cs

/trunk/src/Tarantino.Deployer.UnitTests/Core/Services/DeploymentFactoryTester.cs

/trunk/src/Tarantino.Deployer.UnitTests/Core/Services/DeploymentResultCalculatorTester.cs

=======================================
--- /dev/null
+++ /trunk/src/Tarantino.Deployer.Console/App.config Mon Jan 10 11:34:41
2011
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<configuration>
+
+ <configSections>
+ <section name="DeployerSettings"
type="Tarantino.Deployer.Core.Services.Configuration.Impl.DeployerSettingsConfigurationHandler,
Tarantino.Deployer.Core"/>
+ </configSections>
+
+ <DeployerSettings>
+ <Applications>
+
+ <Application Name="SampleApp" ZipFile="SampleAppPackage"
Url="https://wush.net/svn/SampleApp/trunk/LatestVersion" Username="myUser"
Password="myPassword">
+ <Environments>
+ <Environment Name="Dev" />
+ <Environment Name="QA" Predecessor="Dev" />
+ </Environments>
+ </Application>
+
+ </Applications>
+ </DeployerSettings>
+
+</configuration>
=======================================
--- /dev/null
+++ /trunk/src/Tarantino.Deployer.Console/deployer.hibernate.cfg.xml Mon
Jan 10 11:34:41 2011
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<hibernate-configuration xmlns='urn:nhibernate-configuration-2.2' >
+ <session-factory>
+ <property
name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property>
+ <property name="connection.connection_string">Data
Source=.\SQLExpress;Initial Catalog=TarantinoDeployer;Integrated
Security=true</property>
+ <property name="show_sql">false</property>
+ <property name="dialect">NHibernate.Dialect.MsSql2005Dialect</property>
+
+ <mapping assembly="Tarantino.Deployer.Infrastructure" />
+ </session-factory>
+</hibernate-configuration>
=======================================
--- /trunk/src/Tarantino.Deployer/DeployPackage.cs Sat Jan 8 11:43:27 2011
+++ /trunk/src/Tarantino.Deployer/DeployPackage.cs Mon Jan 10 11:34:41 2011
@@ -82,12 +82,16 @@

private void btnDeploy_OnClick(object sender, EventArgs e)
{
+ Cursor = Cursors.WaitCursor;
+
var result =
PackageDownloader.DownloadAndExtract(SelectedApplication.Name,
SelectedEnvironment.Name, cboVersion.Text,

SelectedApplication.Url, SelectedApplication.ZipFile, txtUsername.Text,

txtPassword.Text);

_version = result.Version;

+ Cursor = Cursors.Arrow;
+
RunCommandLine(result.Executable, result.WorkingDirectory);
}

=======================================
--- /trunk/src/Tarantino.Deployer.Core/Services/Impl/DeploymentFactory.cs
Sat Jan 8 11:43:27 2011
+++ /trunk/src/Tarantino.Deployer.Core/Services/Impl/DeploymentFactory.cs
Mon Jan 10 11:34:41 2011
@@ -8,10 +8,12 @@
public class DeploymentFactory : IDeploymentFactory
{
private readonly ISystemClock _clock;
-
- public DeploymentFactory(ISystemClock clock)
+ private readonly IDeploymentResultCalculator _resultCalculator;
+
+ public DeploymentFactory(ISystemClock clock, IDeploymentResultCalculator
resultCalculator)
{
_clock = clock;
+ _resultCalculator = resultCalculator;
}

public Deployment CreateDeployment(string application, string
environment, string deployedBy, string output, string version, bool failed)
@@ -23,7 +25,7 @@
Version = version,
DeployedBy = deployedBy,
DeployedOn = _clock.GetCurrentDateTime(),
- Result = failed ? DeploymentResult.Failure :
DeploymentResult.Success
+ Result = (failed ||
(_resultCalculator.GetResult(output) == DeploymentResult.Failure)) ?
DeploymentResult.Failure : DeploymentResult.Success
};

deployment.SetOutput(new DeploymentOutput {Output = output});
=======================================
---
/trunk/src/Tarantino.Deployer.Core/Services/Impl/DeploymentResultCalculator.cs
Tue Dec 29 12:09:43 2009
+++
/trunk/src/Tarantino.Deployer.Core/Services/Impl/DeploymentResultCalculator.cs
Mon Jan 10 11:34:41 2011
@@ -7,7 +7,7 @@
{
public DeploymentResult GetResult(string output)
{
- bool buildFailed = output.Contains("BUILD FAILED");
+ bool buildFailed = output.Contains("RuntimeException");
DeploymentResult result = buildFailed ? DeploymentResult.Failure :
DeploymentResult.Success;
return result;
}
=======================================
---
/trunk/src/Tarantino.Deployer.UnitTests/Core/Services/DeploymentFactoryTester.cs
Sat Jan 8 11:43:27 2011
+++
/trunk/src/Tarantino.Deployer.UnitTests/Core/Services/DeploymentFactoryTester.cs
Mon Jan 10 11:34:41 2011
@@ -17,6 +17,7 @@
{
var mocks = new MockRepository();
var clock = mocks.CreateMock<ISystemClock>();
+ var resultCalculator = mocks.CreateMock<IDeploymentResultCalculator>();

using (mocks.Record())
{
@@ -25,7 +26,7 @@

using (mocks.Playback())
{
- IDeploymentFactory factory = new DeploymentFactory(clock);
+ IDeploymentFactory factory = new DeploymentFactory(clock,
resultCalculator);
Deployment deployment =
factory.CreateDeployment("A1", "E1", "jsmith", "Output...", "1.0", true);

Assert.That(deployment.Application, Is.EqualTo("A1"));
=======================================
---
/trunk/src/Tarantino.Deployer.UnitTests/Core/Services/DeploymentResultCalculatorTester.cs
Tue Dec 29 12:09:43 2009
+++
/trunk/src/Tarantino.Deployer.UnitTests/Core/Services/DeploymentResultCalculatorTester.cs
Mon Jan 10 11:34:41 2011
@@ -31,7 +31,7 @@
public void Correctly_determines_deployment_is_a_failure()
{
IDeploymentResultCalculator calculator = new
DeploymentResultCalculator();
- DeploymentResult result = calculator.GetResult("some text BUILD FAILED
some more text");
+ DeploymentResult result = calculator.GetResult("some text
RuntimeException some more text");

Assert.That(result, Is.SameAs(DeploymentResult.Failure));
}

Reply all
Reply to author
Forward
0 new messages