Skip to content

Commit d4f043c

Browse files
committed
added new functionality for demos including the addition of a strategy pattern
1 parent 90c0e3d commit d4f043c

10 files changed

+88
-16
lines changed

Elastacloud.FluentExamples/BuildGetBlobRequest.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,5 +71,10 @@ public void DoWork()
7171
#endregion
7272

7373
public string StorageKey { get; private set; }
74+
75+
public override string ToString()
76+
{
77+
return "BuildGetBlobRequest";
78+
}
7479
}
7580
}

Elastacloud.FluentExamples/BuildMobileService.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,5 +97,10 @@ public void DoSomething()
9797
public X509Certificate2 ManagementCertificate { get; private set; }
9898

9999
#endregion
100+
101+
public override string ToString()
102+
{
103+
return "BuildMobileService";
104+
}
100105
}
101106
}

Elastacloud.FluentExamples/BuildVirtualMachine.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,11 @@ string IBuilder.SubscriptionId
9292
{
9393
get { return _subscriptionId; }
9494
}
95+
96+
public override string ToString()
97+
{
98+
return "BuildVirtualMachine";
99+
}
95100
}
96101
}
97102

Elastacloud.FluentExamples/Program.cs

Lines changed: 43 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ namespace Elastacloud.FluentExamples
1111
{
1212
class Program
1313
{
14-
static readonly List<IBuilder> Builders = new List<IBuilder>();
15-
static readonly List<IWorkflow> Workflows = new List<IWorkflow>();
14+
static readonly Dictionary<string, IBuilder> Builders = new Dictionary<string, IBuilder>();
15+
static readonly Dictionary<string, IWorkflow> Workflows = new Dictionary<string, IWorkflow>();
1616
// args 0 - the subscription id
1717
// args 1 - the path to the publishsettings file
1818
// args 2 - the path to the rdp output file
@@ -23,42 +23,69 @@ static void Main(string[] args)
2323

2424
// manipulate and transform config files
2525
IWorkflow getConfig = new WorkflowLoadConfig(Path.Combine(Settings.DeploymentPath, "TestCloudInstall.cscfg"));
26-
getConfig.PreActionSteps();
26+
Workflows.Add(getConfig.ToString(), getConfig);
27+
ProcessWorkflow(getConfig.ToString());
2728

2829
// do the publishsettings
2930
IWorkflow getSettings = new WorkflowPublishSettings(args[0], Settings.PublishSettingsFilePath);
30-
getSettings.PreActionSteps();
31+
Workflows.Add(getSettings.ToString(), getSettings);
32+
ProcessWorkflow(getSettings.ToString());
3133

3234
// Add the test get blob API - before running this create a storage account using AMS called stackedstorage
3335
IWorkflow getBlob = new BuildGetBlobRequest(Settings.SubscriptionId, Settings.ManagementCertificate);
34-
Workflows.Add(getBlob);
36+
Workflows.Add(getBlob.ToString(), getBlob);
37+
ProcessWorkflow(getBlob.ToString());
38+
39+
// test paas deployment
40+
// test linq to azure with cloud services
41+
// test paas orchestration
42+
IWorkflow fluentDeployment = new WorkflowFluentDeployment(Settings.SubscriptionId, Settings.ManagementCertificate);
43+
Workflows.Add(fluentDeployment.ToString(), fluentDeployment);
44+
ProcessWorkflow(fluentDeployment.ToString());
3545

3646
// create a virtual machine
3747
IBuilder virtualMachine = new BuildVirtualMachine(args[0], Settings.ManagementCertificate);
38-
Builders.Add(virtualMachine);
48+
Builders.Add(virtualMachine.ToString(), virtualMachine);
49+
ProcessBuilder(virtualMachine.ToString());
3950

4051
// test linq to azure with storage
4152
IWorkflow linqToStorage = new WorkflowLinqToStorage(Settings.SubscriptionId, Settings.ManagementCertificate);
42-
Workflows.Add(linqToStorage);
53+
Workflows.Add(linqToStorage.ToString(), linqToStorage);
54+
ProcessWorkflow(linqToStorage.ToString());
4355

4456
// test create a mobile services deployment
4557
IBuilder mobileService = new BuildMobileService(Settings.SubscriptionId, Settings.ManagementCertificate);
46-
Builders.Add(mobileService);
47-
48-
// test paas deployment
49-
// test linq to azure with cloud services
50-
// test paas orchestration
51-
IWorkflow fluentDeployment = new WorkflowFluentDeployment(Settings.SubscriptionId, Settings.ManagementCertificate);
52-
Workflows.Add(fluentDeployment);
58+
Builders.Add(mobileService.ToString(), mobileService);
59+
ProcessBuilder(mobileService.ToString());
5360

5461
// test role system watcher
55-
var watcher = new WorkflowRoleSystemWatcher(virtualMachine.SubscriptionId, virtualMachine.ManagementCertificate);
56-
Workflows.Add(watcher);
62+
var watcher = new WorkflowRoleSystemWatcher(Settings.SubscriptionId, Settings.ManagementCertificate);
63+
Workflows.Add(watcher.ToString(), watcher);
64+
ProcessWorkflow(watcher.ToString());
5765

5866
// test paas build
67+
var workflowSSL = new WorkflowFluentDeploymentWithSSL(Settings.SubscriptionId, Settings.ManagementCertificate);
68+
Workflows.Add(workflowSSL.ToString(), workflowSSL);
69+
ProcessWorkflow(workflowSSL.ToString());
5970

6071
Console.WriteLine("Press [ENTER] to exit");
6172
Console.Read();
6273
}
74+
75+
static void ProcessWorkflow(string workflowName)
76+
{
77+
var workflow = Workflows[workflowName];
78+
workflow.PreActionSteps();
79+
workflow.DoWork();
80+
workflow.PostActionSteps();
81+
}
82+
83+
static void ProcessBuilder(string builderName)
84+
{
85+
var builder = Builders[builderName];
86+
builder.SpinUp();
87+
builder.DoSomething();
88+
builder.TearDown();
89+
}
6390
}
6491
}

Elastacloud.FluentExamples/WorkflowFluentDeployment.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,5 +107,10 @@ public void PostActionSteps()
107107
}
108108

109109
#endregion
110+
111+
public override string ToString()
112+
{
113+
return "WorkflowFluentDeployment";
114+
}
110115
}
111116
}

Elastacloud.FluentExamples/WorkflowFluentDeploymentWithSSL.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,5 +62,10 @@ public void PostActionSteps()
6262
}
6363

6464
#endregion
65+
66+
public override string ToString()
67+
{
68+
return "WorkflowFluentDeploymentWithSSL";
69+
}
6570
}
6671
}

Elastacloud.FluentExamples/WorkflowLinqToStorage.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,5 +78,10 @@ public void PostActionSteps()
7878
}
7979

8080
#endregion
81+
82+
public override string ToString()
83+
{
84+
return "WorkflowLinqToStorage";
85+
}
8186
}
8287
}

Elastacloud.FluentExamples/WorkflowLoadConfig.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,10 @@ public void PostActionSteps()
4545
}
4646

4747
#endregion
48+
49+
public override string ToString()
50+
{
51+
return "WorkflowLoadConfig";
52+
}
4853
}
4954
}

Elastacloud.FluentExamples/WorkflowPublishSettings.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,10 @@ public void PostActionSteps()
4949
}
5050

5151
#endregion
52+
53+
public override string ToString()
54+
{
55+
return "WorkflowPublishSettings";
56+
}
5257
}
5358
}

Elastacloud.FluentExamples/WorkflowRoleSystemWatcher.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,5 +56,10 @@ public void PostActionSteps()
5656
}
5757

5858
#endregion
59+
60+
public override string ToString()
61+
{
62+
return "WorkflowRoleSystemWatcher";
63+
}
5964
}
6065
}

0 commit comments

Comments
 (0)