[tarantino] r151 committed - Added exit code to the batch runner ....

0 views
Skip to first unread message

codesite...@google.com

unread,
Dec 15, 2009, 10:56:57 AM12/15/09
to tarantino...@googlegroups.com
Revision: 151
Author: eric.hexter
Date: Tue Dec 15 07:56:03 2009
Log: Added exit code to the batch runner .
The batch runner now enumerates the instance names when a command line arg
is not specified.
http://code.google.com/p/tarantino/source/detail?r=151

Modified:
/trunk/LatestVersion/BatchJobs.zip
/trunk/LatestVersion/DatabaseManagement.zip
/trunk/LatestVersion/Deployer.zip
/trunk/LatestVersion/Tarantino.zip
/trunk/src/BatchJobs.Console/App.config
/trunk/src/BatchJobs.Console/Program.cs
/trunk/src/BatchJobs.Core/IJobAgentFactory.cs
/trunk/src/BatchJobs.UnitTests/ProgramTester.cs

=======================================
--- /trunk/LatestVersion/BatchJobs.zip Wed Dec 9 12:00:36 2009
+++ /trunk/LatestVersion/BatchJobs.zip Tue Dec 15 07:56:03 2009
Binary file, no diff available.
=======================================
--- /trunk/LatestVersion/DatabaseManagement.zip Wed Dec 9 12:00:36 2009
+++ /trunk/LatestVersion/DatabaseManagement.zip Tue Dec 15 07:56:03 2009
Binary file, no diff available.
=======================================
--- /trunk/LatestVersion/Deployer.zip Wed Dec 9 12:00:36 2009
+++ /trunk/LatestVersion/Deployer.zip Tue Dec 15 07:56:03 2009
File is too large to display a diff.
=======================================
--- /trunk/LatestVersion/Tarantino.zip Wed Dec 9 12:00:36 2009
+++ /trunk/LatestVersion/Tarantino.zip Tue Dec 15 07:56:03 2009
File is too large to display a diff.
=======================================
--- /trunk/src/BatchJobs.Console/App.config Wed Dec 9 12:00:36 2009
+++ /trunk/src/BatchJobs.Console/App.config Tue Dec 15 07:56:03 2009
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
- <add key="JobAgentFactoryType"
value="BatchJobs.Console.DebugerJobAgentFactory"/>
+ <add key="JobAgentFactoryType"
value="BatchJobs.Console.DebugerJobAgentFactory, BatchJobs.Console"/>
</appSettings>
</configuration>
=======================================
--- /trunk/src/BatchJobs.Console/Program.cs Wed Dec 9 12:00:36 2009
+++ /trunk/src/BatchJobs.Console/Program.cs Tue Dec 15 07:56:03 2009
@@ -1,9 +1,9 @@
using System;
+using System.Collections.Generic;
using System.Configuration;
using System.IO;
using System.Reflection;
using BatchJobs.Core;
-using BatchJobs.UnitTests;

namespace BatchJobs.Console
{
@@ -21,22 +21,42 @@
}
catch (Exception e)
{
- System.Console.WriteLine(e);
- }
-
+ System.Console.WriteLine(e.Message);
+ Environment.ExitCode = 100;
+ }
}

public virtual void Run(string[] args)
{
- IJobAgent jobAgent = Factory().Create(args[0]);
- jobAgent.Execute();
+ if(args.Length==0)
+ {
+ System.Console.WriteLine("One of the following instance
names must be specified:");
+ foreach(var name in Factory().GetInstanceNames())
+ {
+ System.Console.WriteLine(name);
+ }
+ }
+ else
+ {
+ IJobAgent jobAgent = Factory().Create(args[0]);
+ jobAgent.Execute();
+ }
}

public virtual IJobAgentFactory Factory()
{
string typename = GetFactoryTypeName();
- string assemblyname = typename.Split(',')[1].Trim();
- typename = typename.Split(',')[0].Trim();
+ string assemblyname;
+
+ try
+ {
+ assemblyname = typename.Split(',')[1].Trim();
+ typename = typename.Split(',')[0].Trim();
+ }
+ catch(Exception)
+ {
+ throw new InvalidOperationException("Could not parse the
typename from the application configuration.");
+ }

Assembly a = null;
try
@@ -58,6 +78,11 @@
System.Console.WriteLine(name);
return new DebugerJobAgent();
}
+
+ public IEnumerable<string> GetInstanceNames()
+ {
+ return new string[]{"Foo","Bar"};
+ }
}

public class DebugerJobAgent : IJobAgent
=======================================
--- /trunk/src/BatchJobs.Core/IJobAgentFactory.cs Wed Dec 9 12:00:36 2009
+++ /trunk/src/BatchJobs.Core/IJobAgentFactory.cs Tue Dec 15 07:56:03 2009
@@ -1,9 +1,10 @@
-using BatchJobs.Core;
-
-namespace BatchJobs.UnitTests
+using System.Collections.Generic;
+
+namespace BatchJobs.Core
{
public interface IJobAgentFactory
{
IJobAgent Create(string name);
+ IEnumerable<string> GetInstanceNames();
}
}
=======================================
--- /trunk/src/BatchJobs.UnitTests/ProgramTester.cs Wed Dec 9 12:00:36 2009
+++ /trunk/src/BatchJobs.UnitTests/ProgramTester.cs Tue Dec 15 07:56:03 2009
@@ -1,3 +1,5 @@
+using System;
+using System.Collections.Generic;
using BatchJobs.Console;
using BatchJobs.Core;
using NUnit.Framework;
@@ -63,5 +65,9 @@
return JobAgent;
}

+ public IEnumerable<string> GetInstanceNames()
+ {
+ return new string[0];
+ }
}
}
Reply all
Reply to author
Forward
0 new messages