public void DeleteWorkflowSuccessCantDeleteDeletedWorkflow() { //---------Setup------------------------------- IEnvironmentConnection connection = new ServerProxy(new Uri(_webserverUri)); connection.Connect(Guid.Empty); const string ServiceName = "DeleteWorkflowTest2"; const string ResourceType = "WorkflowService"; //----------Execute----------------------------- var coms = new CommunicationController { ServiceName = "DeleteResourceService" }; coms.AddPayloadArgument("ResourceName", ServiceName); coms.AddPayloadArgument("ResourceType", ResourceType); coms.AddPayloadArgument("ResourceID", "f2b78836-91dd-44f0-a43f-b3ecf4c53cd5"); // Execute var result = coms.ExecuteCommand <ExecuteMessage>(connection, Guid.Empty); // Assert Assert.IsTrue(result.Message.Contains("Success"), "Got [ " + result.Message + " ]"); result = coms.ExecuteCommand <ExecuteMessage>(connection, Guid.Empty); StringAssert.Contains(result.Message.ToString(), "WorkflowService 'f2b78836-91dd-44f0-a43f-b3ecf4c53cd5' was not found."); }
public SharepointServerSourceViewModel(SharepointServerSource serverSource, IEnvironmentModel environment) { IsLoading = false; TestComplete = false; _environment = environment; ServerName = ""; AuthenticationType = AuthenticationType.Windows; IsWindows = true; SaveCommand = new RelayCommand(o => { serverSource.DialogResult = true; serverSource.Close(); }, o => TestComplete); CancelCommand = new RelayCommand(o => { serverSource.DialogResult = false; serverSource.Close(); }); TestCommand = new RelayCommand(o => { IsLoading = true; Dev2JsonSerializer serializer = new Dev2JsonSerializer(); var source = CreateSharepointServerSource(); var comsController = new CommunicationController { ServiceName = "TestSharepointServerService" }; comsController.AddPayloadArgument("SharepointServer", serializer.SerializeToBuilder(source)); var sharepointSourceTo = comsController.ExecuteCommand <SharepointSourceTo>(environment.Connection, GlobalConstants.ServerWorkspaceID); TestResult = sharepointSourceTo.TestMessage; IsSharepointOnline = sharepointSourceTo.IsSharepointOnline; IsLoading = false; }, o => !TestComplete); }
public SharepointServerSourceViewModel(SharepointServerSource serverSource, IEnvironmentModel environment) { IsLoading = false; TestComplete = false; _environment = environment; ServerName = ""; AuthenticationType = AuthenticationType.Windows; IsWindows = true; SaveCommand = new RelayCommand(o => { serverSource.DialogResult = true; serverSource.Close(); }, o => TestComplete); CancelCommand = new RelayCommand(o => { serverSource.DialogResult = false; serverSource.Close(); }); TestCommand = new RelayCommand(o => { IsLoading = true; Dev2JsonSerializer serializer = new Dev2JsonSerializer(); var source = CreateSharepointServerSource(); var comsController = new CommunicationController { ServiceName = "TestSharepointServerService" }; comsController.AddPayloadArgument("SharepointServer", serializer.SerializeToBuilder(source)); TestResult = comsController.ExecuteCommand<string>(environment.Connection, GlobalConstants.ServerWorkspaceID); IsLoading = false; }, o => !TestComplete); }
public static void Send(IContextualResourceModel resourceModel, string payload, IAsyncWorker asyncWorker) { if (resourceModel?.Environment == null || !resourceModel.Environment.IsConnected) { return; } var clientContext = resourceModel.Environment.Connection; if (clientContext == null) { return; } asyncWorker.Start(() => { var controller = new CommunicationController { ServiceName = string.IsNullOrEmpty(resourceModel.Category) ? resourceModel.ResourceName : resourceModel.Category, ServicePayload = { ResourceID = resourceModel.ID }, }; controller.AddPayloadArgument("DebugPayload", payload); controller.ExecuteCommand <string>(clientContext, clientContext.WorkspaceID); }, () => { }); }
public void ExecuteCommand_GivenReturnExploreAuthorizationError_ShouldShowCorrectPopup() { //---------------Set up test pack------------------- var mock = new Mock <IPopupController>(); mock.Setup(c => c.Show(It.IsAny <string>(), It.IsAny <string>(), MessageBoxButton.OK, MessageBoxImage.Error, "", false, false, true, false, false, false)); CustomContainer.Register(mock.Object); var connection = new Mock <IEnvironmentConnection>(); connection.Setup(environmentConnection => environmentConnection.IsConnected).Returns(true); var serializer = new Dev2JsonSerializer(); var message = new ExecuteMessage { HasError = true, Message = new StringBuilder(ErrorResource.NotAuthorizedToExecuteException) }; var serializeToBuilder = serializer.SerializeToBuilder(message); connection.Setup(environmentConnection => environmentConnection.ExecuteCommand(It.IsAny <StringBuilder>(), GlobalConstants.ServerWorkspaceID)) .Returns(serializeToBuilder); var controller = new CommunicationController(); //---------------Assert Precondition---------------- //---------------Execute Test ---------------------- controller.ExecuteCommand <ExplorerRepositoryResult>(connection.Object, GlobalConstants.ServerWorkspaceID); //---------------Test Result ----------------------- mock.Verify(c => c.Show(It.IsAny <string>(), It.IsAny <string>(), MessageBoxButton.OK, MessageBoxImage.Error, "", false, false, true, false, false, false), Times.Once); }
public IServiceTestModelTO ExecuteTest(IContextualResourceModel resourceModel, string testName) { if (resourceModel?.Environment == null || !resourceModel.Environment.IsConnected) { var testRunReuslt = new ServiceTestModelTO { TestFailing = true }; return(testRunReuslt); } var clientContext = resourceModel.Environment.Connection; if (clientContext == null) { var testRunReuslt = new ServiceTestModelTO { TestFailing = true }; return(testRunReuslt); } var controller = new CommunicationController { ServiceName = string.IsNullOrEmpty(resourceModel.Category) ? resourceModel.ResourceName : resourceModel.Category, ServicePayload = { ResourceID = resourceModel.ID } }; controller.AddPayloadArgument("ResourceID", resourceModel.ID.ToString()); controller.AddPayloadArgument("IsDebug", true.ToString()); controller.ServicePayload.TestName = testName; var res = controller.ExecuteCommand <IServiceTestModelTO>(clientContext, GlobalConstants.ServerWorkspaceID); return(res); }
public void DeleteWorkflowSuccessCantCallDeletedWorkflow() { //---------Setup------------------------------- IEnvironmentConnection connection = new ServerProxy(new Uri(_webserverUri)); connection.Connect(Guid.Empty); const string ServiceName = "DeleteWorkflowTest3"; const string ResourceType = "WorkflowService"; //----------Execute----------------------------- var coms = new CommunicationController { ServiceName = "DeleteResourceService" }; coms.AddPayloadArgument("ResourceName", ServiceName); coms.AddPayloadArgument("ResourceType", ResourceType); var result = coms.ExecuteCommand <ExecuteMessage>(connection, Guid.Empty); //---------Call Workflow Failure------- // ReSharper disable InconsistentNaming const string serviceName = "DeleteWorkflowTest3"; // ReSharper restore InconsistentNaming var servicecall = String.Format("{0}{1}", ServerSettings.WebserverURI, serviceName); var result2 = TestHelper.PostDataToWebserver(servicecall); Assert.IsTrue(result2.Contains("Service [ DeleteWorkflowTest3 ] not found."), "Got [ " + result + " ]"); }
public ExecuteMessage GetDependenciesXml(IContextualResourceModel resourceModel, bool getDependsOnMe) { if (resourceModel == null) { return(new ExecuteMessage { HasError = false }); } var comsController = new CommunicationController { ServiceName = "FindDependencyService" }; comsController.AddPayloadArgument("ResourceId", resourceModel.ID.ToString()); comsController.AddPayloadArgument("GetDependsOnMe", getDependsOnMe.ToString()); var workspaceId = resourceModel.Environment.Connection.WorkspaceID; var payload = comsController.ExecuteCommand <ExecuteMessage>(resourceModel.Environment.Connection, workspaceId); if (payload == null) { throw new Exception(string.Format(GlobalConstants.NetworkCommunicationErrorTextFormat, "FindDependencyService")); } return(payload); }
public void DeployResource(IResourceModel resource, string savePath) { if (resource == null) { throw new ArgumentNullException(nameof(resource)); } Dev2Logger.Info($"Deploy Resource. Resource:{resource.DisplayName} Environment:{_server.Name}"); var theResource = FindSingle(c => c.ResourceName.Equals(resource.ResourceName, StringComparison.CurrentCultureIgnoreCase)); if (theResource != null) { _resourceModels.Remove(theResource); } theResource = new ResourceModel(_server); theResource.Update(resource); _resourceModels.Add(theResource); var comsController = new CommunicationController { ServiceName = "DeployResourceService" }; comsController.AddPayloadArgument("savePath", savePath); comsController.AddPayloadArgument("ResourceDefinition", resource.ToServiceDefinition(true)); comsController.AddPayloadArgument("Roles", "*"); var con = _server.Connection; var executeCommand = comsController.ExecuteCommand <ExecuteMessage>(con, GlobalConstants.ServerWorkspaceID); if (executeCommand != null && executeCommand.HasError) { throw new Exception(executeCommand.Message.ToString()); } }
public ExecuteMessage DeleteResource(IResourceModel resource) { Dev2Logger.Info($"DeleteResource Resource: {resource.DisplayName} Environment:{_server.Name}"); IResourceModel res = _resourceModels.FirstOrDefault(c => c.ID == resource.ID); if (res == null) { var msg = new ExecuteMessage { HasError = true }; msg.SetMessage("Failure"); return(msg); } int index = _resourceModels.IndexOf(res); if (index != -1) { _resourceModels.RemoveAt(index); } else { throw new KeyNotFoundException(); } var comsController = new CommunicationController { ServiceName = "DeleteResourceService" }; if (resource.ResourceName.Contains("Unsaved")) { comsController.AddPayloadArgument("ResourceID", resource.ID.ToString()); comsController.AddPayloadArgument("ResourceType", resource.ResourceType.ToString()); return(comsController.ExecuteCommand <ExecuteMessage>(_server.Connection, _server.Connection.WorkspaceID)); } comsController.AddPayloadArgument("ResourceID", resource.ID.ToString()); comsController.AddPayloadArgument("ResourceType", resource.ResourceType.ToString()); var result = comsController.ExecuteCommand <ExecuteMessage>(_server.Connection, GlobalConstants.ServerWorkspaceID); if (result.HasError) { HandleDeleteResourceError(result, resource); return(null); } return(result); }
public Data.Settings.Settings ReadSettings(IServer currentEnv) { var comController = new CommunicationController { ServiceName = "SettingsReadService" }; return(comController.ExecuteCommand <Data.Settings.Settings>(currentEnv.Connection, GlobalConstants.ServerWorkspaceID)); }
public ObservableCollection <IScheduledResource> GetScheduledResources() { var controller = new CommunicationController { ServiceName = "GetScheduledResources" }; return(controller.ExecuteCommand <ObservableCollection <IScheduledResource> >(_model.Connection, _model.Connection.WorkspaceID)); }
public void DeleteSchedule(IScheduledResource resource) { Dev2JsonSerializer jsonSerializer = new Dev2JsonSerializer(); var builder = jsonSerializer.SerializeToBuilder(resource); var controller = new CommunicationController { ServiceName = "DeleteScheduledResourceService" }; controller.AddPayloadArgument("Resource", builder); controller.ExecuteCommand<string>(_model.Connection, _model.Connection.WorkspaceID); }
public IList <T> GetResourceList <T>(IServer targetEnvironment) where T : new() { var comController = new CommunicationController { ServiceName = CreateServiceName(typeof(T)) }; var sources = comController.ExecuteCommand <List <T> >(targetEnvironment.Connection, GlobalConstants.ServerWorkspaceID); return(sources); }
public ExecuteMessage WriteSettings(IServer currentEnv, Data.Settings.Settings settings) { var comController = new CommunicationController { ServiceName = "SettingsWriteService" }; comController.AddPayloadArgument("Settings", settings.ToString()); return(comController.ExecuteCommand <ExecuteMessage>(currentEnv.Connection, GlobalConstants.ServerWorkspaceID)); }
public IList <IResourceHistory> CreateHistory(IScheduledResource resource) { Dev2JsonSerializer jsonSerializer = new Dev2JsonSerializer(); var builder = jsonSerializer.SerializeToBuilder(resource); var controller = new CommunicationController { ServiceName = "GetScheduledResourceHistoryService" }; controller.AddPayloadArgument("Resource", builder); return(controller.ExecuteCommand <IList <IResourceHistory> >(_model.Connection, _model.Connection.WorkspaceID)); }
public void DeleteSchedule(IScheduledResource resource) { Dev2JsonSerializer jsonSerializer = new Dev2JsonSerializer(); var builder = jsonSerializer.SerializeToBuilder(resource); var controller = new CommunicationController { ServiceName = "DeleteScheduledResourceService" }; controller.AddPayloadArgument("Resource", builder); controller.ExecuteCommand <string>(_model.Connection, _model.Connection.WorkspaceID); }
public DbTableList GetDatabaseTables(DbSource dbSource) { var comController = new CommunicationController { ServiceName = "GetDatabaseTablesService" }; comController.AddPayloadArgument("Database", _serializer.Serialize(dbSource)); var tables = comController.ExecuteCommand <DbTableList>(_server.Connection, GlobalConstants.ServerWorkspaceID); return(tables); }
public override void DragEnd(int button) { if (button == 1) { Coords tile = InputController.GetCoordsUnderMouse(); if (WorldGraphics.ValidCoords(tile)) { CommunicationController.ExecuteCommand(ClientController.activePlayer, new CommandMove(tile)); } InputController.ChangeState(new DefaultState()); } }
public List <SharepointListTo> GetSharepointLists(SharepointSource source) { var comController = new CommunicationController { ServiceName = "GetSharepointListService" }; comController.AddPayloadArgument("SharepointServer", _serializer.Serialize(source)); var lists = comController.ExecuteCommand <List <SharepointListTo> >(_server.Connection, GlobalConstants.ServerWorkspaceID); return(lists); }
public CompileMessageList GetCompileMessagesFromServer(IContextualResourceModel resourceModel) { var comsController = new CommunicationController { ServiceName = "FetchDependantCompileMessagesService" }; var workspaceID = GlobalConstants.ServerWorkspaceID; comsController.AddPayloadArgument("ServiceID", resourceModel.ID.ToString()); comsController.AddPayloadArgument("WorkspaceID", workspaceID.ToString()); var con = resourceModel.Environment.Connection; var result = comsController.ExecuteCommand<CompileMessageList>(con, GlobalConstants.ServerWorkspaceID); return result; }
public T GetResourceById <T>(Guid workspaceId, Guid resourceId) where T : class { var communicationController = new CommunicationController { ServiceName = nameof(Service.GetResourceById) }; communicationController.AddPayloadArgument(Service.GetResourceById.WorkspaceId, workspaceId.ToString()); communicationController.AddPayloadArgument(Service.GetResourceById.ResourceId, resourceId.ToString()); var result = communicationController.ExecuteCommand <T>(_environmentConnection, workspaceId); return(result); }
public void Save(IScheduledResource resource, string userName, string password) { Dev2JsonSerializer jsonSerializer = new Dev2JsonSerializer(); var builder = jsonSerializer.SerializeToBuilder(resource); var controller = new CommunicationController { ServiceName = "SaveScheduledResourceService" }; controller.AddPayloadArgument("Resource", builder); controller.AddPayloadArgument("UserName", userName); controller.AddPayloadArgument("Password", password); controller.ExecuteCommand <string>(_model.Connection, _model.Connection.WorkspaceID); }
public ObservableCollection <IScheduledResource> GetScheduledResources() { var controller = new CommunicationController { ServiceName = "GetScheduledResources" }; var resources = controller.ExecuteCommand <ObservableCollection <IScheduledResource> >(_model.Connection, _model.Connection.WorkspaceID); if (resources != null) { return(resources); } return(new ObservableCollection <IScheduledResource>()); }
public ExecuteMessage DeleteResourceFromWorkspace(IResourceModel resource) { if (resource == null) { var msg = new ExecuteMessage { HasError = true }; msg.SetMessage("Failure"); return(msg); } var comsController = new CommunicationController { ServiceName = "DeleteResourceService" }; if (!string.IsNullOrEmpty(resource.ResourceName) && resource.ResourceName.Contains("Unsaved")) { comsController.AddPayloadArgument("ResourceID", resource.ID.ToString()); comsController.AddPayloadArgument("ResourceType", resource.ResourceType.ToString()); ExecuteMessage deleteResourceFromWorkspace = comsController.ExecuteCommand <ExecuteMessage>(_server.Connection, _server.Connection.WorkspaceID); return(deleteResourceFromWorkspace); } var res = _resourceModels.FirstOrDefault(c => c.ID == resource.ID); if (res == null) { var msg = new ExecuteMessage { HasError = true }; msg.SetMessage("Failure"); return(msg); } comsController.AddPayloadArgument("ResourceID", resource.ID.ToString()); comsController.AddPayloadArgument("ResourceType", resource.ResourceType.ToString()); return(comsController.ExecuteCommand <ExecuteMessage>(_server.Connection, _server.Connection.WorkspaceID)); }
public DbColumnList GetDatabaseTableColumns(DbSource dbSource, DbTable dbTable) { var comController = new CommunicationController { ServiceName = "GetDatabaseColumnsForTableService" }; comController.AddPayloadArgument("Database", _serializer.Serialize(dbSource)); comController.AddPayloadArgument("TableName", _serializer.Serialize(dbTable.TableName)); comController.AddPayloadArgument("Schema", _serializer.Serialize(dbTable.Schema)); var columns = comController.ExecuteCommand <DbColumnList>(_server.Connection, GlobalConstants.ServerWorkspaceID); return(columns); }
public List <ISharepointFieldTo> GetSharepointListFields(ISharepointSource source, SharepointListTo list, bool onlyEditableFields) { var comController = new CommunicationController { ServiceName = "GetSharepointListFields" }; comController.AddPayloadArgument("SharepointServer", _serializer.Serialize(source)); comController.AddPayloadArgument("ListName", _serializer.Serialize(list.FullName)); comController.AddPayloadArgument("OnlyEditable", _serializer.Serialize(onlyEditableFields)); var fields = comController.ExecuteCommand <List <ISharepointFieldTo> >(_server.Connection, GlobalConstants.ServerWorkspaceID); return(fields); }
public CompileMessageList GetCompileMessagesFromServer(IContextualResourceModel resourceModel) { var comsController = new CommunicationController { ServiceName = "FetchDependantCompileMessagesService" }; var workspaceID = GlobalConstants.ServerWorkspaceID; comsController.AddPayloadArgument("ServiceID", resourceModel.ID.ToString()); comsController.AddPayloadArgument("WorkspaceID", workspaceID.ToString()); var con = resourceModel.Environment.Connection; var result = comsController.ExecuteCommand <CompileMessageList>(con, GlobalConstants.ServerWorkspaceID); return(result); }
public ExecuteMessage ResumeWorkflowExecution(string resourceId, string environment, string startActivityId, string versionNumber, string currentUserPrincipal) { var comController = new CommunicationController { ServiceName = "WorkflowResume" }; comController.AddPayloadArgument("resourceID", resourceId); comController.AddPayloadArgument("environment", environment); comController.AddPayloadArgument("startActivityId", startActivityId); comController.AddPayloadArgument("versionNumber", versionNumber); comController.AddPayloadArgument("currentuserprincipal", currentUserPrincipal); var result = comController.ExecuteCommand <ExecuteMessage>(_environmentConnection, GlobalConstants.ServerWorkspaceID); return(result); }
public override void Update() { base.Update(); if (Input.GetKeyDown(KeyCode.Space)) { CommunicationController.ExecuteCommand(ClientController.activePlayer, new CommandWait()); } if (Input.GetKeyDown(KeyCode.S)) { CommunicationController.ExecuteCommand(ClientController.activePlayer, new CommandSleep()); } if (Input.GetKeyDown(KeyCode.U)) { CommunicationController.ExecuteCommand(ClientController.activePlayer, new CommandUnload()); } }
/// <summary> /// Fetches the resource definition. /// </summary> /// <param name="targetEnv">The target env.</param> /// <param name="workspaceId">The workspace unique identifier.</param> /// <param name="resourceModelId">The resource model unique identifier.</param> /// <param name="prepaireForDeployment"></param> /// <returns></returns> public ExecuteMessage FetchResourceDefinition(IServer targetEnv, Guid workspaceId, Guid resourceModelId, bool prepaireForDeployment) { var comsController = new CommunicationController { ServiceName = "FetchResourceDefinitionService" }; comsController.AddPayloadArgument("ResourceID", resourceModelId.ToString()); comsController.AddPayloadArgument("PrepairForDeployment", prepaireForDeployment.ToString()); var result = comsController.ExecuteCommand <ExecuteMessage>(targetEnv.Connection, workspaceId); // log the trace for fetch ;) if (result != null) { Dev2Logger.Debug($"Fetched Definition For {resourceModelId} From Workspace {workspaceId}"); } return(result); }
public bool Save(IScheduledResource resource, out string errorMessage) { Dev2JsonSerializer jsonSerializer = new Dev2JsonSerializer(); var builder = jsonSerializer.SerializeToBuilder(resource); var controller = new CommunicationController { ServiceName = "SaveScheduledResourceService" }; controller.AddPayloadArgument("Resource", builder); controller.AddPayloadArgument("PreviousResource", resource.OldName); controller.AddPayloadArgument("UserName", resource.UserName); controller.AddPayloadArgument("Password", resource.Password); var executeCommand = controller.ExecuteCommand<ExecuteMessage>(_model.Connection, _model.Connection.WorkspaceID); errorMessage = ""; if(executeCommand != null) { resource.IsDirty = executeCommand.HasError; errorMessage = executeCommand.Message.ToString(); return !executeCommand.HasError; } return true; }
public List <T> FindSourcesByType <T>(IServer targetEnvironment, enSourceType sourceType) { var result = new List <T>(); if (targetEnvironment == null) { return(result); } var comsController = new CommunicationController { ServiceName = "FindSourcesByType" }; comsController.AddPayloadArgument("Type", Enum.GetName(typeof(enSourceType), sourceType)); result = comsController.ExecuteCommand <List <T> >(targetEnvironment.Connection, GlobalConstants.ServerWorkspaceID); return(result); }
public static void Send(WebServerMethod method, IContextualResourceModel resourceModel, string payload, IAsyncWorker asyncWorker) { if(resourceModel == null || resourceModel.Environment == null || !resourceModel.Environment.IsConnected) { return; } var clientContext = resourceModel.Environment.Connection; if(clientContext == null) { return; } asyncWorker.Start(() => { var controller = new CommunicationController { ServiceName = resourceModel.Category }; controller.AddPayloadArgument("DebugPayload", payload); controller.ExecuteCommand<string>(clientContext, clientContext.WorkspaceID); }, () => { }); }
public void AppServer_SaveResource_WhenSavingWorkerService_ExpectSaved() { //------------Setup for test-------------------------- CommunicationController coms = new CommunicationController { ServiceName = "SaveResourceService" }; var id = Guid.NewGuid().ToString(); var tmp = new StringBuilder(CreateService(id, "[[Id]]")); coms.AddPayloadArgument("ResourceXml", tmp); coms.AddPayloadArgument("WorkspaceID", Guid.Empty.ToString()); string expected = string.Format("Added DbService '{0}'", id); //------------Execute Test--------------------------- var result = coms.ExecuteCommand <ExecuteMessage>(_connection, Guid.Empty); //------------Assert Results------------------------- StringAssert.Contains(result.Message.ToString(), expected, "Got [ " + result.Message + " ]"); }
public ExecuteMessage UpdateWorkspaceItem(IContextualResourceModel resource, bool isLocalSave) { // BUG 9492 - 2013.06.08 - TWR : added null check if(resource == null) { throw new ArgumentNullException("resource"); } var workspaceItem = WorkspaceItems.FirstOrDefault(wi => wi.ID == resource.ID && wi.EnvironmentID == resource.Environment.ID); if(workspaceItem == null) { var msg = new ExecuteMessage { HasError = false }; msg.SetMessage(string.Empty); return msg; } workspaceItem.Action = WorkspaceItemAction.Commit; var comsController = new CommunicationController { ServiceName = "UpdateWorkspaceItemService" }; comsController.AddPayloadArgument("Roles", String.Join(",", "Test")); var xml = workspaceItem.ToXml(); comsController.AddPayloadArgument("ItemXml", xml.ToString(SaveOptions.DisableFormatting)); comsController.AddPayloadArgument("IsLocalSave", isLocalSave.ToString()); var con = resource.Environment.Connection; var result = comsController.ExecuteCommand<ExecuteMessage>(con, con.WorkspaceID); return result; }
public void AppServer_Update_Resource_Correctly() { CommunicationController coms = new CommunicationController { ServiceName = "SaveResourceService" }; var tmp = new StringBuilder(TestResource.Service_Update_Request_String); var xe = tmp.ToXElement(); var xml = xe.Element("ResourceXml"); var wtf = xml.ToStringBuilder().Unescape(); wtf = wtf.Replace("<XmlData>", "").Replace("</XmlData>", "").Replace("<ResourceXml>", "").Replace("</ResourceXml>", ""); coms.AddPayloadArgument("ResourceXml", wtf); coms.AddPayloadArgument("WorkspaceID", Guid.Empty.ToString()); const string expected = @"Updated WorkflowService 'ServiceToBindFrom'"; var result = coms.ExecuteCommand<ExecuteMessage>(_connection, Guid.Empty); StringAssert.Contains(result.Message.ToString(), expected); }
public void AppServer_SaveResource_WhenSavingWorkerService_ExpectSaved() { //------------Setup for test-------------------------- CommunicationController coms = new CommunicationController { ServiceName = "SaveResourceService" }; var id = Guid.NewGuid().ToString(); var tmp = new StringBuilder(CreateService(id, "[[Id]]")); coms.AddPayloadArgument("ResourceXml", tmp); coms.AddPayloadArgument("WorkspaceID", Guid.Empty.ToString()); string expected = string.Format("Added DbService '{0}'", id); //------------Execute Test--------------------------- var result = coms.ExecuteCommand<ExecuteMessage>(_connection, Guid.Empty); //------------Assert Results------------------------- StringAssert.Contains(result.Message.ToString(), expected, "Got [ " + result.Message + " ]"); }
public IList<IResourceHistory> CreateHistory(IScheduledResource resource) { Dev2JsonSerializer jsonSerializer = new Dev2JsonSerializer(); var builder = jsonSerializer.SerializeToBuilder(resource); var controller = new CommunicationController { ServiceName = "GetScheduledResourceHistoryService" }; controller.AddPayloadArgument("Resource", builder); return controller.ExecuteCommand<IList<IResourceHistory>>(_model.Connection, _model.Connection.WorkspaceID); }
public void Save(IScheduledResource resource, string userName, string password) { Dev2JsonSerializer jsonSerializer = new Dev2JsonSerializer(); var builder = jsonSerializer.SerializeToBuilder(resource); var controller = new CommunicationController { ServiceName = "SaveScheduledResourceService" }; controller.AddPayloadArgument("Resource", builder); controller.AddPayloadArgument("UserName", userName); controller.AddPayloadArgument("Password", password); controller.ExecuteCommand<string>(_model.Connection, _model.Connection.WorkspaceID); resource.IsDirty = false; }
public ObservableCollection<IScheduledResource> GetScheduledResources() { var controller = new CommunicationController { ServiceName = "GetScheduledResources" }; return controller.ExecuteCommand<ObservableCollection<IScheduledResource>>(_model.Connection, _model.Connection.WorkspaceID); }