File tree Expand file tree Collapse file tree 10 files changed +55
-72
lines changed Expand file tree Collapse file tree 10 files changed +55
-72
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ public class AlwaysSucceed : AbstractCommand
99 {
1010 public override void Run ( )
1111 {
12+ Info ( "Ths command always succeeds." ) ;
1213 }
1314 }
1415}
Original file line number Diff line number Diff line change 1- using CommandLine ;
1+ using System ;
2+ using System . Collections . Generic ;
3+ using CommandLine ;
24using InEngine . Core ;
5+ using InEngine . Core . Commands ;
6+ using InEngine . Core . Scheduling ;
37
48namespace InEngine . Commands
59{
@@ -10,5 +14,29 @@ public class CommandsPlugin : AbstractPlugin
1014
1115 [ VerbOption ( "succeed" , HelpText = "A null operation command. Literally does nothing." ) ]
1216 public AlwaysSucceed Null { get ; set ; }
17+
18+ public override void Schedule ( ISchedule schedule )
19+ {
20+ schedule . Command ( new Echo { VerbatimText = "Core Echo command." } )
21+ . EverySecond ( )
22+ . Before ( x => Console . WriteLine ( "Before" ) )
23+ . After ( x => Console . WriteLine ( "After" ) )
24+ . PingBefore ( "http://www.google.com" )
25+ . PingAfter ( "http://www.google.com" )
26+ . WriteOutputTo ( "AlwaysSucceedWrite.log" )
27+ . AppendOutputTo ( "AlwaysSucceedAppend.log" )
28+ . EmailOutputTo ( "example@inengine.net" ) ;
29+
30+ schedule . Command ( new [ ] {
31+ new Echo { VerbatimText = "Chain Link 1" } ,
32+ new Echo { VerbatimText = "Chain Link 2" } ,
33+ } ) . EverySecond ( ) ;
34+
35+ schedule . Command ( new List < AbstractCommand > {
36+ new Echo { VerbatimText = "Chain Link A" } ,
37+ new AlwaysFail ( ) ,
38+ new Echo { VerbatimText = "Chain Link C" } ,
39+ } ) . EverySecond ( ) ;
40+ }
1341 }
1442}
Original file line number Diff line number Diff line change 11using System ;
2+ using InEngine . Core . IO ;
23using InEngine . Core . Queuing ;
34using InEngine . Core . Scheduling ;
45
56namespace InEngine . Core
67{
7- public class ServerHost : IDisposable
8+ public class ServerHost : IDisposable , IHasMailSettings , IHasQueueSettings
89 {
910 public SuperScheduler SuperScheduler { get ; set ; }
1011 public Dequeue Dequeue { get ; set ; }
11- public InEngineSettings InEngineSettings { get ; set ; }
12+ public MailSettings MailSettings { get ; set ; }
13+ public QueueSettings QueueSettings { get ; set ; }
1214
13- public ServerHost ( )
15+ public void Start ( )
1416 {
1517 SuperScheduler = new SuperScheduler ( ) ;
16- SuperScheduler . Initialize ( InEngineSettings . Mail ) ;
18+ SuperScheduler . Initialize ( MailSettings ) ;
1719 Dequeue = new Dequeue ( ) {
18- QueueSettings = InEngineSettings . Queue ,
19- MailSettings = InEngineSettings . Mail ,
20+ QueueSettings = QueueSettings ,
21+ MailSettings = MailSettings ,
2022 } ;
21- }
2223
23- public void Start ( )
24- {
2524 SuperScheduler . Start ( ) ;
2625 StartDequeueAsync ( ) ;
2726 }
Original file line number Diff line number Diff line change 4343 <Compile Include =" Program.cs" />
4444 <Compile Include =" Properties\AssemblyInfo.cs" />
4545 <Compile Include =" QueuingTest.cs" />
46- <Compile Include =" SchedulingTest.cs" />
4746 </ItemGroup >
4847 <ItemGroup >
4948 <ProjectReference Include =" ..\InEngine.Core\InEngine.Core.csproj" >
Original file line number Diff line number Diff line change 11using System ;
2+ using InEngine . Core ;
23
34namespace InEngine . IntegrationTest
45{
@@ -7,14 +8,21 @@ class MainClass
78 public static void Main ( string [ ] args )
89 {
910 Console . WriteLine ( "------------------------------------------------------------" ) ;
10- Console . WriteLine ( "Queuing Integration Tests" ) ;
11+ Console . WriteLine ( "Queue Integration Tests" ) ;
1112 Console . WriteLine ( "------------------------------------------------------------" ) ;
1213 new QueuingTest ( ) . Run ( ) ;
1314
1415 Console . WriteLine ( "------------------------------------------------------------" ) ;
15- Console . WriteLine ( "Scheduling Integration Tests " ) ;
16+ Console . WriteLine ( "Start Server... " ) ;
1617 Console . WriteLine ( "------------------------------------------------------------" ) ;
17- new SchedulingTest ( ) . Run ( ) ;
18+ var settings = InEngineSettings . Make ( ) ;
19+ var serverHost = new ServerHost ( ) {
20+ MailSettings = settings . Mail ,
21+ QueueSettings = settings . Queue ,
22+ } ;
23+ serverHost . Start ( ) ;
24+ Console . ReadLine ( ) ;
25+ serverHost . Dispose ( ) ;
1826 }
1927 }
2028}
Original file line number Diff line number Diff line change @@ -29,11 +29,7 @@ public override void Run()
2929 QueueSettings = settings . Queue ,
3030 MailSettings = settings . Mail ,
3131 } . Run ( ) ;
32- var consume = new Consume {
33- Count = 1000 ,
34- QueueSettings = settings . Queue ,
35- MailSettings = settings . Mail ,
36- } ;
32+
3733
3834 Enqueue . Command ( ( ) => Console . WriteLine ( "Core lambda command." ) )
3935 . Dispatch ( ) ;
@@ -82,8 +78,6 @@ public override void Run()
8278 Enqueue . Commands ( Enumerable . Range ( 0 , 10 ) . Select ( x => new AlwaysSucceed ( ) as AbstractCommand ) . ToList ( ) )
8379 . Dispatch ( ) ;
8480
85- consume . Run ( ) ;
86-
8781 var queueWriteIntegrationTest = "queueWriteIntegrationTest.txt" ;
8882 var queueAppendIntegrationTest = "queueAppendIntegrationTest.txt" ;
8983 File . Delete ( queueWriteIntegrationTest ) ;
@@ -98,8 +92,6 @@ public override void Run()
9892 . WriteOutputTo ( queueWriteIntegrationTest )
9993 . AppendOutputTo ( queueAppendIntegrationTest )
10094 . Dispatch ( ) ;
101-
102- consume . Run ( ) ;
10395 }
10496 }
10597}
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 11{
22 "InEngine" : {
33 "Plugins" : {
4+ "InEngine.Commands" : " "
45 },
56 "ExecWhitelist" : {
7+ "ls" : " /bin/ls"
68 },
79 "Mail" : {
810 "Host" : " localhost" ,
Original file line number Diff line number Diff line change @@ -27,8 +27,10 @@ static void Main(string[] args)
2727 /// </summary>
2828 public static void RunServer ( )
2929 {
30+ var settings = InEngineSettings . Make ( ) ;
3031 ServerHost = new ServerHost ( ) {
31- InEngineSettings = InEngineSettings . Make ( )
32+ MailSettings = settings . Mail ,
33+ QueueSettings = settings . Queue ,
3234 } ;
3335 if ( Type . GetType ( "Mono.Runtime" ) != null ) {
3436 ServerHost . Start ( ) ;
Original file line number Diff line number Diff line change 11{
22 "InEngine" : {
33 "Plugins" : {
4- "InEngine.Commands" : " "
54 },
65 "ExecWhitelist" : {
7- "ls" : " /bin/ls"
86 },
97 "Mail" : {
108 "Host" : " localhost" ,
You can’t perform that action at this time.
0 commit comments