public void SCFileScopeWithSharedContextGetInsideException() { string aFileName = this.ClearEnvironmentForTest(); var sharedContextScopeActivity = new ClientScopeActivity { ContextName = Test_ContextName, ContextType = Test_ContextType, Retries = Test_Retries }; var getContextActivity = new GetVariableActivity { VariableName = Test_SetVariableName, RaiseException = true }; sharedContextScopeActivity.Body.Handler = new Sequence() { Activities = { getContextActivity } }; try { var output = WorkflowInvoker.Invoke(sharedContextScopeActivity); } catch (Exception e) { Assert.IsTrue(e.Message == "[SharedContext Client] Variable Name " + Test_SetVariableName + " does not exist in context " + Test_ContextName); } }
public void NewThread() { Console.WriteLine("In thread > " + DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss.fffff tt")); string aFileName = ClearEnvironmentForTest(true); var sharedContextScopeActivity = new ClientScopeActivity { ContextName = Test_ContextName, ContextType = Test_ContextType, Retries = Test_Retries }; var setContextActivity = new SetVariableActivity { VariableName = Test_SetVariableName, VariableValue = Test_SetVariableValue }; sharedContextScopeActivity.Body.Handler = new Sequence() { Activities = { setContextActivity } }; Console.WriteLine("In thread : about to execute > " + DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss.fffff tt")); var output = WorkflowInvoker.Invoke(sharedContextScopeActivity); }
public void SCFileScopeWithSharedContextSetInside() { string aFileName = this.ClearEnvironmentForTest(); var sharedContextScopeActivity = new ClientScopeActivity { ContextName = Test_ContextName, ContextType = Test_ContextType, Retries = Test_Retries }; var setContextActivity = new SetVariableActivity { VariableName = Test_SetVariableName, VariableValue = Test_SetVariableValue }; sharedContextScopeActivity.Body.Handler = new Sequence() { Activities = { setContextActivity } }; var output = WorkflowInvoker.Invoke(sharedContextScopeActivity); Assert.IsTrue(File.Exists(aFileName)); string fileContents = File.ReadAllText(aFileName); Assert.IsTrue(fileContents == "{\"GlobalVariables\":{\"aVariable123\":\"aValue456\"},\"Messages\":{}}"); }
public void SCFileScopeWithSharedContextGetInside() { string aFileName = this.ClearEnvironmentForTest(); var sharedContextScopeActivity = new ClientScopeActivity { ContextName = Test_ContextName, ContextType = Test_ContextType, Retries = Test_Retries }; var getContextActivity = new GetVariableActivity { VariableName = Test_SetVariableName, RaiseException = false }; sharedContextScopeActivity.Body.Handler = new Sequence() { Activities = { getContextActivity } }; var output = WorkflowInvoker.Invoke(sharedContextScopeActivity); Assert.IsTrue(output["OutputContextFile"].ToString() == aFileName); }
public void NewThread() { Console.WriteLine("In thread > " + DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss.fffff tt")); var aContextServer = this.SetUpContextServer(); var sharedContextScopeActivity = new ClientScopeActivity { ContextName = Test_ContextName, ContextType = Test_ContextType, ClearContext = true, Retries = Test_Retries }; var setContextActivity = new SetVariableActivity { VariableName = Test_SetVariableName, VariableValue = Test_SetVariableValue }; sharedContextScopeActivity.Body.Handler = new Sequence() { Activities = { setContextActivity } }; Console.WriteLine("In thread : about to execute > " + DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss.fffff tt")); WorkflowInvoker.Invoke(sharedContextScopeActivity); aContextServer.MyDispose(); }
public void SCNamedPipeTryToOpenLockedContext() { Thread thread1 = new Thread(NewThread); thread1.Start(); for (int i = 0; i < 5; i++) { Console.WriteLine("In main. i=" + i.ToString() + " > " + DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss.fffff tt")); if (i == 0 || i == 3) { try { var sharedContextScopeActivity = new ClientScopeActivity { ContextName = Test_ContextName, ContextType = Test_ContextType, Retries = Test_Retries }; var setContextActivity = new SetVariableActivity { VariableName = Test_SetVariableName, VariableValue = Test_SetVariableValue }; sharedContextScopeActivity.Body.Handler = new Sequence() { Activities = { setContextActivity } }; var output = WorkflowInvoker.Invoke(sharedContextScopeActivity); Console.WriteLine("File locked! > " + DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss.fffff tt")); Thread.Sleep(200); } catch (Exception) { Console.WriteLine("Could not lock File > " + DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss.fffff tt")); Thread.Sleep(50); } } Thread.Sleep(200); } }
public void SCNamedPipeScopeWithSharedContextSetGetInside() { var sharedContextServerScope = new ServerScopeActivity { ContextName = Test_ContextName }; var sharedContextScopeActivity = new ClientScopeActivity { ContextName = Test_ContextName, ContextType = Test_ContextType, ClearContext = true, Retries = Test_Retries }; var setContextActivity = new SetVariableActivity { VariableName = Test_SetVariableName, VariableValue = Test_SetVariableValue }; var getContextActivity = new GetVariableActivity { VariableName = Test_SetVariableName }; sharedContextServerScope.Body.Handler = new Sequence() { Activities = { sharedContextScopeActivity } }; sharedContextScopeActivity.Body.Handler = new Sequence() { Activities = { setContextActivity, getContextActivity } }; var output = WorkflowInvoker.Invoke(sharedContextServerScope); }
public void SCNamedPipeTryToOpenTwoContextScopes() { var aContextServer = this.SetUpContextServer(); var sharedContextScopeActivityInner = new ClientScopeActivity { ContextName = Test_ContextName, ContextType = Test_ContextType, ClearContext = true, Retries = Test_Retries }; var sharedContextScopeActivityOuter = new ClientScopeActivity { ContextName = Test_ContextName, ContextType = Test_ContextType, ClearContext = true, Retries = Test_Retries }; sharedContextScopeActivityOuter.Body.Handler = new Sequence() { Activities = { sharedContextScopeActivityInner } }; try { var output = WorkflowInvoker.Invoke(sharedContextScopeActivityOuter); } catch (Exception e) { Assert.IsTrue(e.Message == "[SharedContext Client] Could not open resource within the retries."); } aContextServer.MyDispose(); }
public void SCFileScopeWithClearInside() { string aFileName = this.ClearEnvironmentForTest(); var sharedContextScopeActivity = new ClientScopeActivity { ContextName = Test_ContextName, ContextType = Test_ContextType, Retries = Test_Retries, ClearContext = true }; sharedContextScopeActivity.Body.Handler = new Sequence() { Activities = { } }; var output = WorkflowInvoker.Invoke(sharedContextScopeActivity); Assert.IsTrue(output["OutputContextFile"].ToString() == aFileName); Assert.IsTrue(File.ReadAllText(aFileName) == "{\"GlobalVariables\":{},\"Messages\":{}}"); }