public void DeployPlugins() { CrmServiceClient crmSvc = new CrmServiceClient(ConfigurationManager.ConnectionStrings["integration_testing"].ConnectionString); var userId = crmSvc.GetMyCrmUserId(); var trace = new TraceLogger(); var task = new DeployPluginsTask(crmSvc, trace); var path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"..\..\..\TestPlugin"); task.Execute(path); }
public void DeployPluginsUnChangedActivities() { var fakeService = A.Fake <IOrganizationService>(a => a.Strict()); var trace = new TraceLogger(); var task = new DeployPluginsTask(fakeService, trace); var path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"..\..\..\TestPluginWorkflowCombined"); //var messageRequestBuilder = A.Fake<IUserMessagesCollectionRequestBuilder>(); var plugin = new PluginAssembly() { Id = Guid.NewGuid() }; var pluginTypeToBeRemoved = new PluginType { Id = Guid.NewGuid(), Name = "Type", PluginAssemblyId = plugin.ToEntityReference(), TypeName = "TypeName", IsWorkflowActivity = false }; var existingWFActivityNotToBeRemoved = new PluginType { Id = Guid.NewGuid(), Name = "Type", PluginAssemblyId = plugin.ToEntityReference(), TypeName = "WFActivity", IsWorkflowActivity = true }; A.CallTo(() => fakeService.Execute(A <OrganizationRequest> .Ignored)).ReturnsLazily((a) => { var response = new RetrieveMultipleResponse(); var logicalName = ((a.Arguments[0] as RetrieveMultipleRequest).Query as Microsoft.Xrm.Sdk.Query.QueryExpression).EntityName; switch (logicalName) { case PluginAssembly.EntityLogicalName: response["EntityCollection"] = new EntityCollection(new[] { plugin }); break; case PluginType.EntityLogicalName: response["EntityCollection"] = new EntityCollection(new[] { pluginTypeToBeRemoved, existingWFActivityNotToBeRemoved }); break; case SdkMessageProcessingStepImage.EntityLogicalName: case SdkMessageProcessingStep.EntityLogicalName: response["EntityCollection"] = new EntityCollection(); break; case SdkMessageFilter.EntityLogicalName: response["EntityCollection"] = new EntityCollection(new[] { new SdkMessageFilter() { SdkMessageFilterId = Guid.NewGuid(), SdkMessageId = new EntityReference(SdkMessage.EntityLogicalName, Guid.NewGuid()) } }); break; } return(response); }); A.CallTo(() => fakeService.Update(A <Entity> .Ignored)).DoesNothing(); A.CallTo(() => fakeService.Create(A <Entity> .Ignored)).ReturnsLazily((a) => { return(Guid.NewGuid()); }); A.CallTo(() => fakeService.Delete( A <string> .That.Matches(a => a == PluginType.EntityLogicalName), A <Guid> .That.Matches(a => a == pluginTypeToBeRemoved.Id))).DoesNothing(); task.Execute(path); }
private static void RunTask(CommandLineArgs arguments, IOrganizationService service, ITrace trace) { if (arguments.Path == null) { arguments.Path = Directory.GetCurrentDirectory(); } else { // Strip trailing \ arguments.Path = arguments.Path.TrimEnd('\\'); arguments.Path = Path.Combine(Directory.GetCurrentDirectory(), arguments.Path); } BaseTask task = null; string command = arguments.Task.ToLower(); switch (command) { case "plugins": trace.WriteLine("Deploying Plugins"); task = new DeployPluginsTask(service, trace); break; case "workflow": trace.WriteLine("Deploying Custom Workflow Activities"); task = new DeployWorkflowActivitiesTask(service, trace); break; case "webresources": trace.WriteLine("Deploying WebResources"); task = new DeployWebResourcesTask(service, trace); break; case "instrument": trace.WriteLine("Downloading Plugin/Workflow Activity Metadata"); task = new DownloadPluginMetadataTask(service, trace); break; case "download-webresources": trace.WriteLine("Downloading Webresources"); task = new DownloadWebresourceFileTask(service, trace) { Overwrite = arguments.Overwrite }; break; case "get-webresources": trace.WriteLine("Downloading Webresources"); task = new DownloadWebresourceConfigTask(service, trace); task.Prefix = arguments.Prefix; break; case "earlybound": trace.WriteLine("Generating early bound types"); var earlyBound = new EarlyBoundClassGeneratorTask(service, trace); task = earlyBound; earlyBound.ConectionString = arguments.Connection; break; case "unpack": trace.WriteLine("Unpacking solution"); var packager = new SolutionPackagerTask(service, trace); packager.command = command; task = packager; break; case "unpacksolution": trace.WriteLine("Unpacking solution Zip"); var unpackfromsolution = new SolutionPackagerTask(service, trace); unpackfromsolution.command = command; task = unpackfromsolution; break; case "pack": trace.WriteLine("Packing Solution"); var pack = new SolutionPackagerTask(service, trace); pack.command = command; task = pack; break; case "import": trace.WriteLine("Packing & Import Solution"); var import = new SolutionPackagerTask(service, trace); import.command = command; task = import; break; case "compare": trace.WriteLine("Comparing Solution"); var compare = new SolutionPackagerTask(service, trace); compare.command = command; task = compare; break; } if (task != null) { if (arguments.Profile != null) { task.Profile = arguments.Profile; } task.Execute(arguments.Path); } else { throw new SparkleTaskException(SparkleTaskException.ExceptionTypes.NO_TASK_SUPPLIED, String.Format("Task '{0}' not recognised. Please consult help!", arguments.Task.ToLower())); } }
private static void RunTask(CommandLineArgs arguments, IOrganizationService service, ITrace trace) { if (arguments.Path == null) { arguments.Path = Directory.GetCurrentDirectory(); } else { // Strip trailing \ arguments.Path = arguments.Path.TrimEnd('\\'); arguments.Path = Path.Combine(Directory.GetCurrentDirectory(), arguments.Path); } BaseTask task = null; switch (arguments.Task.ToLower()) { case "plugins": trace.WriteLine("Deploying Plugins"); task = new DeployPluginsTask(service, trace); break; case "workflow": trace.WriteLine("Deploying Custom Workflow Activities"); task = new DeployWorkflowActivitiesTask(service, trace); break; case "webresources": trace.WriteLine("Deploying WebResources"); task = new DeployWebResourcesTask(service, trace); break; case "instrument": trace.WriteLine("Downloading Plugin/Workflow Activity Metadata"); task = new DownloadPluginMetadataTask(service, trace); break; case "get-webresources": trace.WriteLine("Downloading Webresources"); task = new DownloadWebresourceConfigTask(service, trace); task.Prefix = arguments.Prefix; break; case "earlybound": trace.WriteLine("Generating early bound types"); var earlyBound = new EarlyBoundClassGeneratorTask(service, trace); task = earlyBound; earlyBound.ConectionString = arguments.Connection; break; } if (task != null) { if (arguments.Profile != null) { task.Profile = arguments.Profile; } task.Execute(arguments.Path); } else { throw new SparkleTaskException(SparkleTaskException.ExceptionTypes.NO_TASK_SUPPLIED, String.Format("Task '{0}' not recognised. Please consult help!", arguments.Task.ToLower())); } }