예제 #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unchecked") public void doWith(Method method) throws IllegalArgumentException, IllegalAccessException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
            public void doWith(System.Reflection.MethodInfo method)
            {
                State state = AnnotationUtils.getAnnotation(method, typeof(State));

                string processName = component.processKey();

                if (StringUtils.hasText(state.process()))
                {
                    processName = state.process();
                }

                string stateName = state.state();

                if (!StringUtils.hasText(stateName))
                {
                    stateName = state.value();
                }

                Assert.notNull(stateName, "You must provide a stateName!");

                IDictionary <int, string> vars = new Dictionary <int, string>();

                Annotation[][] paramAnnotationsArray = method.ParameterAnnotations;

                int ctr         = 0;
                int pvMapIndex  = -1;
                int procIdIndex = -1;

                foreach (Annotation[] paramAnnotations in paramAnnotationsArray)
                {
                    ctr += 1;

                    foreach (Annotation pa in paramAnnotations)
                    {
                        if (pa is ProcessVariable)
                        {
                            ProcessVariable pv     = (ProcessVariable)pa;
                            string          pvName = pv.value();
                            vars[ctr] = pvName;
                        }
                        else if (pa is ProcessVariables)
                        {
                            pvMapIndex = ctr;
                        }
                        else if (pa is ProcessId)
                        {
                            procIdIndex = ctr;
                        }
                    }
                }

                ActivitiStateHandlerRegistration registration = new ActivitiStateHandlerRegistration(vars, method, bean, stateName, beanName, pvMapIndex, procIdIndex, processName);

                outerInstance.registry.registerActivitiStateHandler(registration);
            }
예제 #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldHaveDetailledStringRepresentationWithNullValues() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
        public virtual void shouldHaveDetailledStringRepresentationWithNullValues()
        {
            IDictionary <int, string> processVariablesExpected = Collections.singletonMap(34, "testValue");

            System.Reflection.MethodInfo handlerMethod = null;
            object handler               = null;
            string stateName             = "running";
            string beanName              = "testBean";
            int    processVariablesIndex = 4;
            int    processIdIndex        = 2;
            string processName           = "testProcess";
            ActivitiStateHandlerRegistration registration = new ActivitiStateHandlerRegistration(processVariablesExpected, handlerMethod, handler, stateName, beanName, processVariablesIndex, processIdIndex, processName);

            assertEquals("org.camunda.bpm.engine.spring.components.registry.ActivitiStateHandlerRegistration@" + registration.GetHashCode().ToString("x") + "[" + "processVariablesExpected={34=testValue}, " + "handlerMethod=null, " + "handler=null, " + "stateName=running, " + "beanName=testBean, " + "processVariablesIndex=4, " + "processIdIndex=2, " + "processName=testProcess]", registration.ToString());
        }
예제 #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldHaveDetailledStringRepresentation() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
        public virtual void shouldHaveDetailledStringRepresentation()
        {
            IDictionary <int, string> processVariablesExpected = Collections.singletonMap(34, "testValue");

            System.Reflection.MethodInfo handlerMethod = this.GetType().GetMethod("shouldHaveDetailledStringRepresentation");
            object handler               = new ObjectAnonymousInnerClass(this);
            string stateName             = "running";
            string beanName              = "testBean";
            int    processVariablesIndex = 4;
            int    processIdIndex        = 2;
            string processName           = "testProcess";
            ActivitiStateHandlerRegistration registration = new ActivitiStateHandlerRegistration(processVariablesExpected, handlerMethod, handler, stateName, beanName, processVariablesIndex, processIdIndex, processName);

            assertEquals("org.camunda.bpm.engine.spring.components.registry.ActivitiStateHandlerRegistration@" + registration.GetHashCode().ToString("x") + "[" + "processVariablesExpected={34=testValue}, " + "handlerMethod=public void org.camunda.bpm.engine.spring.test.components.registry.ActivitiStateHandlerRegistrationTest.shouldHaveDetailledStringRepresentation() throws java.lang.Exception, " + "handler=org.camunda.bpm.engine.spring.test.components.registry.ActivitiStateHandlerRegistrationTest$1@" + handler.GetHashCode().ToString("x") + ", " + "stateName=running, " + "beanName=testBean, " + "processVariablesIndex=4, " + "processIdIndex=2, " + "processName=testProcess]", registration.ToString());
        }