public static void AnnotationDeploymentTearDown(IProcessEngine processEngine, string deploymentId, Type testClass, string methodName) { Debug.WriteLine("annotation Deployment deletes deployment for {0}.{1}", ClassNameUtil.GetClassNameWithoutPackage(testClass), methodName); DeleteDeployment(processEngine, deploymentId); }
public virtual void TestDeleteJobDefinitionWithParseListenerAndAsyncBothInXml() { //given the asyncBefore AND asyncAfter is set in the xml //var modelFileName = "jobexecutor/jobAsyncBothCreationWithinParseListener.bpmn20.xml"; //var @in = ReflectUtil.GetResourceAsStream(modelFileName); //var builder = EngineRule.RepositoryService.CreateDeployment().AddInputStream(modelFileName, @in); ////when the asyncBefore is set to false and the asyncAfter to true in the parse listener //var deployment = builder.Deploy(); var deployment = EngineRule.RepositoryService.CreateDeployment() .Name(ClassNameUtil.GetClassNameWithoutPackage(this.GetType()) + "." + TestContext.CurrentContext.Test.Name) .AddClasspathResource("resources/jobexecutor/jobAsyncBothCreationWithinParseListener.bpmn20.xml").Deploy(); EngineRule.ManageDeployment(deployment); //then there exists one job definition var query = EngineRule.ManagementService.CreateJobDefinitionQuery(); var jobDef = query.First(); Assert.NotNull(jobDef); Assert.AreEqual(jobDef.ProcessDefinitionKey, "oneTaskProcess"); Assert.AreEqual(jobDef.ActivityId, "servicetask1"); Assert.AreEqual(jobDef.JobConfiguration, MessageJobDeclaration.AsyncAfter); }
public virtual void TestCreateBothAsyncJobDefinitionWithParseListener() { //given //var modelFileName = "jobexecutor/jobCreationWithinParseListener.bpmn20.xml"; //var @in = ReflectUtil.GetResourceAsStream(modelFileName); //var builder = EngineRule.RepositoryService.CreateDeployment().AddInputStream(modelFileName, @in); ////when the asyncBefore and asyncAfter is set to true in the parse listener //var deployment = builder.Deploy(); var deployment = EngineRule.RepositoryService.CreateDeployment() .Name(ClassNameUtil.GetClassNameWithoutPackage(this.GetType()) + "." + TestContext.CurrentContext.Test.Name) .AddClasspathResource("resources/jobexecutor/jobCreationWithinParseListener.bpmn20.xml").Deploy(); EngineRule.ManageDeployment(deployment); //then there exists two job definitions var query = EngineRule.ManagementService.CreateJobDefinitionQuery(); var definitions = query.OrderBy(c => c.JobConfiguration).ToList(); Assert.AreEqual(definitions.Count, 2); //asyncAfter var asyncAfterAfter = definitions[0]; Assert.AreEqual(asyncAfterAfter.ProcessDefinitionKey, "oneTaskProcess"); Assert.AreEqual(asyncAfterAfter.ActivityId, "servicetask1"); Assert.AreEqual(asyncAfterAfter.JobConfiguration, MessageJobDeclaration.AsyncAfter); //asyncBefore var asyncAfterBefore = definitions[1]; Assert.AreEqual(asyncAfterBefore.ProcessDefinitionKey, "oneTaskProcess"); Assert.AreEqual(asyncAfterBefore.ActivityId, "servicetask1"); Assert.AreEqual(asyncAfterBefore.JobConfiguration, MessageJobDeclaration.AsyncBefore); }
public virtual void TestDeleteNonExistingJobDefinitionWithParseListener() { ////given //var modelFileName = "jobexecutor/jobCreationWithinParseListener.bpmn20.xml"; //var @in = ReflectUtil.GetResourceAsStream(modelFileName); //var builder = EngineRule.RepositoryService.CreateDeployment().AddInputStream(modelFileName, @in); ////when the asyncBefore is set to false in the parse listener //var deployment = builder.Deploy(); var deployment = EngineRule.RepositoryService.CreateDeployment() .Name(ClassNameUtil.GetClassNameWithoutPackage(this.GetType()) + "." + TestContext.CurrentContext.Test.Name) .AddClasspathResource("resources/jobexecutor/jobCreationWithinParseListener.bpmn20.xml").Deploy(); EngineRule.ManageDeployment(deployment); //then there exists no job definition var query = EngineRule.ManagementService.CreateJobDefinitionQuery(); Assert.IsNull(query.SingleOrDefault()); }
public virtual void ExecuteDatabaseOperation(string operationType, object parameter) { if (DebugEnabled) { string message; if (parameter != null) { message = parameter.ToString(); } else { message = "null"; } if (parameter is IDbEntity) { var dbEntity = (IDbEntity)parameter; message = ClassNameUtil.GetClassNameWithoutPackage(dbEntity) + "[id=" + dbEntity.Id + "]"; } LogDebug("009", "SQL operation: '{0}'; Entity: '{1}'", operationType, message); } }
public virtual void TestCreateJobDefinitionWithParseListener() { ////given //var modelFileName = "jobexecutor/jobCreationWithinParseListener.bpmn20.xml"; //var @in = ReflectUtil.GetResourceAsStream(modelFileName); //var builder = EngineRule.RepositoryService.CreateDeployment().AddInputStream(modelFileName, @in); ////when the asyncBefore is set in the parse listener //var deployment = builder.Deploy(); var deployment = EngineRule.RepositoryService.CreateDeployment() .Name(ClassNameUtil.GetClassNameWithoutPackage(this.GetType()) + "." + TestContext.CurrentContext.Test.Name) .AddClasspathResource("resources/jobexecutor/jobCreationWithinParseListener.bpmn20.xml").Deploy(); EngineRule.ManageDeployment(deployment); //then there exists a new job definition var query = EngineRule.ManagementService.CreateJobDefinitionQuery(); var jobDef = query.SingleOrDefault(); Assert.NotNull(jobDef); Assert.AreEqual(jobDef.ProcessDefinitionKey, "oneTaskProcess"); Assert.AreEqual(jobDef.ActivityId, "servicetask1"); }
public static string AnnotationDeploymentSetUp(IProcessEngine processEngine, Type testClass, string methodName, DeploymentAttribute deploymentAnnotation) { string deploymentId = null; MethodInfo method = null; var onMethod = true; try { method = GetMethod(testClass, methodName); } catch (System.Exception) { if (deploymentAnnotation == null) { return(null); } } if (deploymentAnnotation == null) { deploymentAnnotation = method.GetCustomAttribute <DeploymentAttribute>(true); } // if not found on method, try on class level if (deploymentAnnotation == null) { onMethod = false; var lookForAnnotationClass = testClass; while (lookForAnnotationClass != typeof(object)) { deploymentAnnotation = lookForAnnotationClass.GetCustomAttribute <DeploymentAttribute>(); if (deploymentAnnotation != null) { testClass = lookForAnnotationClass; break; } lookForAnnotationClass = lookForAnnotationClass.BaseType; } } if (deploymentAnnotation != null) { Debug.WriteLine("annotation Deployment creates deployment for {0}.{1}", ClassNameUtil.GetClassNameWithoutPackage(testClass), methodName); var resources = deploymentAnnotation.Resources; if ((resources.Length == 0) && (method != null)) { var name = onMethod ? method.Name : null; var resource = GetBpmnProcessDefinitionResource(testClass, name); resources = new[] { resource }; } if (methodName.IndexOf("_") > -1) { methodName = methodName.Split('_')[1]; } var deploymentBuilder = processEngine.RepositoryService.CreateDeployment() .Name(ClassNameUtil.GetClassNameWithoutPackage(testClass) + "." + methodName); foreach (var resource in resources) { Log.LogDebug("加载资源文件:", resource); deploymentBuilder.AddClasspathResource(resource); } deploymentId = deploymentBuilder.Deploy().Id; } return(deploymentId); }
public override string ToString() { return(operationType + " " + ClassNameUtil.GetClassNameWithoutPackage(entity) + "[" + entity.Id + "]"); }
public virtual void DebugFinishingCommand <T1>(ICommand <T1> cmd) { LogDebug("006", "Finishing command -------------------- {0} ----------------------", ClassNameUtil.GetClassNameWithoutPackage(cmd)); }