예제 #1
0
        private string getStatement(Type persistentObjectClass, IDictionary <Type, string> cachedStatements, string prefix)
        {
            string statement = cachedStatements[persistentObjectClass];

            if (!string.ReferenceEquals(statement, null))
            {
                return(statement);
            }
            statement = prefix + ClassNameUtil.getClassNameWithoutPackage(persistentObjectClass);
            statement = statement.Substring(0, statement.Length - 6);     // "Entity".length() = 6
            cachedStatements[persistentObjectClass] = statement;
            return(statement);
        }
예제 #2
0
        public virtual void executeDatabaseOperation(string operationType, object parameter)
        {
            if (DebugEnabled)
            {
                string message;
                if (parameter != null)
                {
                    message = parameter.ToString();
                }
                else
                {
                    message = "null";
                }

                if (parameter is DbEntity)
                {
                    DbEntity dbEntity = (DbEntity)parameter;
                    message = ClassNameUtil.getClassNameWithoutPackage(dbEntity) + "[id=" + dbEntity.Id + "]";
                }

                logDebug("009", "SQL operation: '{}'; Entity: '{}'", operationType, message);
            }
        }
예제 #3
0
 public virtual void debugFinishingCommand <T1>(Command <T1> cmd)
 {
     logDebug("006", "Finishing command -------------------- {} ----------------------", ClassNameUtil.getClassNameWithoutPackage(cmd));
 }
예제 #4
0
        public static string annotationDeploymentSetUp(ProcessEngine processEngine, Type testClass, string methodName, Deployment deploymentAnnotation)
        {
            string deploymentId = null;

            System.Reflection.MethodInfo method = null;
            bool onMethod = true;

            try
            {
                method = getMethod(testClass, methodName);
            }
            catch (Exception)
            {
                if (deploymentAnnotation == null)
                {
                    // we have neither the annotation, nor can look it up from the method
                    return(null);
                }
            }

            if (deploymentAnnotation == null)
            {
                deploymentAnnotation = method.getAnnotation(typeof(Deployment));
            }
            // if not found on method, try on class level
            if (deploymentAnnotation == null)
            {
                onMethod = false;
                Type lookForAnnotationClass = testClass;
                while (lookForAnnotationClass != typeof(object))
                {
                    deploymentAnnotation = lookForAnnotationClass.getAnnotation(typeof(Deployment));
                    if (deploymentAnnotation != null)
                    {
                        testClass = lookForAnnotationClass;
                        break;
                    }
                    lookForAnnotationClass = lookForAnnotationClass.BaseType;
                }
            }

            if (deploymentAnnotation != null)
            {
                LOG.debug("annotation @Deployment creates deployment for {}.{}", ClassNameUtil.getClassNameWithoutPackage(testClass), methodName);
                string[] resources = deploymentAnnotation.resources();
                if (resources.Length == 0 && method != null)
                {
                    string name     = onMethod ? method.Name : null;
                    string resource = getBpmnProcessDefinitionResource(testClass, name);
                    resources = new string[] { resource };
                }

                DeploymentBuilder deploymentBuilder = processEngine.RepositoryService.createDeployment().name(ClassNameUtil.getClassNameWithoutPackage(testClass) + "." + methodName);

                foreach (string resource in resources)
                {
                    deploymentBuilder.addClasspathResource(resource);
                }

                deploymentId = deploymentBuilder.deploy().Id;
            }

            return(deploymentId);
        }
예제 #5
0
 public static void annotationDeploymentTearDown(ProcessEngine processEngine, string deploymentId, Type testClass, string methodName)
 {
     LOG.debug("annotation @Deployment deletes deployment for {}.{}", ClassNameUtil.getClassNameWithoutPackage(testClass), methodName);
     deleteDeployment(processEngine, deploymentId);
 }
예제 #6
0
 public override string ToString()
 {
     return(operationType + " " + ClassNameUtil.getClassNameWithoutPackage(entity) + "[" + entity.Id + "]");
 }