Esempio n. 1
0
        public virtual void testCreateDeploymentPa()
        {
            // given
            EmbeddedProcessApplication application = new EmbeddedProcessApplication();

            // when
            Deployment deployment = repositoryService.createDeployment(application.Reference).name(DEPLOYMENT_NAME).addModelInstance(RESOURCE_NAME, createProcessWithServiceTask(PROCESS_KEY)).deploy();

            // then
            UserOperationLogEntry userOperationLogEntry = historyService.createUserOperationLogQuery().singleResult();

            assertNotNull(userOperationLogEntry);

            assertEquals(EntityTypes.DEPLOYMENT, userOperationLogEntry.EntityType);
            assertEquals(deployment.Id, userOperationLogEntry.DeploymentId);

            assertEquals(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.OPERATION_TYPE_CREATE, userOperationLogEntry.OperationType);

            assertEquals("duplicateFilterEnabled", userOperationLogEntry.Property);
            assertNull(userOperationLogEntry.OrgValue);
            assertFalse(Convert.ToBoolean(userOperationLogEntry.NewValue));

            assertEquals(USER_ID, userOperationLogEntry.UserId);

            assertEquals(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.CATEGORY_OPERATOR, userOperationLogEntry.Category);

            assertNull(userOperationLogEntry.JobDefinitionId);
            assertNull(userOperationLogEntry.ProcessInstanceId);
            assertNull(userOperationLogEntry.ProcessDefinitionId);
            assertNull(userOperationLogEntry.ProcessDefinitionKey);
            assertNull(userOperationLogEntry.CaseInstanceId);
            assertNull(userOperationLogEntry.CaseDefinitionId);
        }
        public virtual void testCreateDeploymentPa()
        {
            // given
            EmbeddedProcessApplication application = new EmbeddedProcessApplication();

            // when
            IDeployment deployment = repositoryService.CreateDeployment(application.Reference).Name(DEPLOYMENT_NAME).AddModelInstance(RESOURCE_NAME, createProcessWithServiceTask(PROCESS_KEY)).Deploy();

            // then
            IUserOperationLogEntry userOperationLogEntry = historyService.CreateUserOperationLogQuery().First();

            Assert.NotNull(userOperationLogEntry);

            Assert.AreEqual(EntityTypes.Deployment, userOperationLogEntry.EntityType);
            Assert.AreEqual(deployment.Id, userOperationLogEntry.DeploymentId);

            Assert.AreEqual(UserOperationLogEntryFields.OperationTypeCreate, userOperationLogEntry.OperationType);

            Assert.AreEqual("duplicateFilterEnabled", userOperationLogEntry.Property);
            Assert.IsNull(userOperationLogEntry.OrgValue);
            Assert.IsFalse(Convert.ToBoolean(userOperationLogEntry.NewValue));

            Assert.AreEqual(USER_ID, userOperationLogEntry.UserId);

            Assert.IsNull(userOperationLogEntry.JobDefinitionId);
            Assert.IsNull(userOperationLogEntry.ProcessInstanceId);
            Assert.IsNull(userOperationLogEntry.ProcessDefinitionId);
            Assert.IsNull(userOperationLogEntry.ProcessDefinitionKey);
            Assert.IsNull(userOperationLogEntry.CaseInstanceId);
            Assert.IsNull(userOperationLogEntry.CaseDefinitionId);
        }
Esempio n. 3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void init() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
        public virtual void init()
        {
            repositoryService          = engineRule.RepositoryService;
            processEngineConfiguration = engineRule.ProcessEngineConfiguration;

            processApplication = new EmbeddedProcessApplication();
        }
Esempio n. 4
0
        public virtual void testExecutionListenerNull()
        {
            // this test verifies that the process application can return a 'null'
            // execution listener
            EmbeddedProcessApplication processApplication = new EmbeddedProcessApplication();

            // register app so that it receives events
            managementService.registerProcessApplication(deploymentId, processApplication.Reference);
            // I can start a process event though the process app does not provide an
            // event listener.
            runtimeService.startProcessInstanceByKey("startToEnd");
        }
Esempio n. 5
0
        public virtual void testRegisterProcessApplicationAsCamundaAdmin()
        {
            // given
            identityService.setAuthentication(userId, Collections.singletonList(org.camunda.bpm.engine.authorization.Groups_Fields.CAMUNDA_ADMIN));

            EmbeddedProcessApplication  processApplication = new EmbeddedProcessApplication();
            ProcessApplicationReference reference          = processApplication.Reference;
            string deploymentId = createDeployment(null, FIRST_RESOURCE).Id;

            // when
            ProcessApplicationRegistration registration = managementService.registerProcessApplication(deploymentId, reference);

            // then
            assertNotNull(registration);
            assertNotNull(getProcessApplicationForDeployment(deploymentId));

            deleteDeployment(deploymentId);
        }
        public virtual void testRegisterProcessApplicationAsCamundaAdmin()
        {
            // given
            identityService.SetAuthentication(userId, new List <string>()
            {
                GroupsFields.CamundaAdmin
            });

            EmbeddedProcessApplication   processApplication = new EmbeddedProcessApplication();
            IProcessApplicationReference reference          = processApplication.Reference;
            string deploymentId = createDeployment(null, FIRST_RESOURCE).Id;

            // when
            IProcessApplicationRegistration registration = managementService.RegisterProcessApplication(deploymentId, reference);

            // then
            Assert.NotNull(registration);
            Assert.NotNull(GetProcessApplicationForDeployment(deploymentId));

            DeleteDeployment(deploymentId);
        }
Esempio n. 7
0
        public virtual void testDisabledPaEnvScriptCaching()
        {
            // given
            processEngineConfiguration.EnableFetchScriptEngineFromProcessApplication = false;

            EmbeddedProcessApplication processApplication = new EmbeddedProcessApplication();

            ProcessApplicationDeployment deployment = repositoryService.createDeployment(processApplication.Reference).addClasspathResource(PROCESS_PATH).deploy();

            // when
            executeScript(processApplication);

            // then
            IDictionary <string, IList <ExecutableScript> > environmentScripts = processApplication.EnvironmentScripts;

            assertNotNull(environmentScripts);
            assertNull(environmentScripts[SCRIPT_LANGUAGE]);

            repositoryService.deleteDeployment(deployment.Id, true);

            processEngineConfiguration.EnableFetchScriptEngineFromProcessApplication = true;
        }
Esempio n. 8
0
        // register process application ///////////////////////////////////

        public virtual void testRegisterProcessApplicationWithoutAuthorization()
        {
            // given
            EmbeddedProcessApplication  processApplication = new EmbeddedProcessApplication();
            ProcessApplicationReference reference          = processApplication.Reference;
            string deploymentId = createDeployment(null, FIRST_RESOURCE).Id;

            try
            {
                // when
                managementService.registerProcessApplication(deploymentId, reference);
                fail("Exception expected: It should not be possible to register a process application");
            }
            catch (AuthorizationException e)
            {
                //then
                string message = e.Message;
                assertTextPresent(REQUIRED_ADMIN_AUTH_EXCEPTION, message);
            }

            deleteDeployment(deploymentId);
        }
        // register process application ///////////////////////////////////

        public virtual void testRegisterProcessApplicationWithoutAuthorization()
        {
            // given
            EmbeddedProcessApplication   processApplication = new EmbeddedProcessApplication();
            IProcessApplicationReference reference          = processApplication.Reference;
            string deploymentId = createDeployment(null, FIRST_RESOURCE).Id;

            try
            {
                // when
                managementService.RegisterProcessApplication(deploymentId, reference);
                Assert.Fail("Exception expected: It should not be possible to register a process application");
            }
            catch (AuthorizationException e)
            {
                //then
                string message = e.Message;
                AssertTextPresent("ENGINE-03029 Required authenticated group 'camunda-admin'", message);
            }

            DeleteDeployment(deploymentId);
        }
Esempio n. 10
0
        public virtual void testEnabledPaEnvScriptCaching()
        {
            // given
            EmbeddedProcessApplication processApplication = new EmbeddedProcessApplication();

            ProcessApplicationDeployment deployment = repositoryService.createDeployment(processApplication.Reference).addClasspathResource(PROCESS_PATH).deploy();

            // when
            executeScript(processApplication);

            // then
            IDictionary <string, IList <ExecutableScript> > environmentScripts = processApplication.EnvironmentScripts;

            assertNotNull(environmentScripts);

            IList <ExecutableScript> groovyEnvScripts = environmentScripts[SCRIPT_LANGUAGE];

            assertNotNull(groovyEnvScripts);
            assertFalse(groovyEnvScripts.Count == 0);
            assertEquals(processEngineConfiguration.EnvScriptResolvers.Count, groovyEnvScripts.Count);

            repositoryService.deleteDeployment(deployment.Id, true);
        }
Esempio n. 11
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: protected void setUp() throws Exception
        protected internal virtual void setUp()
        {
            processApplication = new EmbeddedProcessApplication();
            base.setUp();
        }
Esempio n. 12
0
 public EmbeddedProcessApplicationReferenceImpl(EmbeddedProcessApplication application)
 {
     this.application = application;
 }