コード例 #1
0
        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);
        }
コード例 #2
0
ファイル: DeployCmd.cs プロジェクト: zf321/ESS.FW.Bpm
        /// <summary>
        /// 部署执行
        /// </summary>
        /// <param name="commandContext"></param>
        /// <returns></returns>
        protected internal virtual IDeploymentWithDefinitions DoExecute(CommandContext commandContext)
        {
            IDeploymentManager deploymentManager = commandContext.DeploymentManager;

            var deploymentIds = GetAllDeploymentIds(deploymentBuilder);

            if (deploymentIds.Count > 0)
            {
                var deploymentIdArray = deploymentIds.ToArray();
                IList <DeploymentEntity> deployments = deploymentManager.FindDeploymentsByIds(deploymentIdArray);
                EnsureDeploymentsWithIdsExists(deploymentIds, deployments);
            }

            CheckCreateAndReadDeployments(commandContext, deploymentIds);

            // set deployment name if it should retrieved from an existing deployment
            var nameFromDeployment = deploymentBuilder.GetNameFromDeployment();

            SetDeploymentName(nameFromDeployment, deploymentBuilder, commandContext);
            //TODO 加载resources到上下文
            // get resources to re-deploy
            var resources = GetResources(deploymentBuilder, commandContext);

            // .. and add them the builder
            AddResources(resources, deploymentBuilder);

            var resourceNames = deploymentBuilder.ResourceNames;

            if ((resourceNames == null) || (resourceNames.Count == 0))
            {
                throw new NotValidException("No deployment resources contained to deploy.");
            }
            IDeploymentWithDefinitions dep = commandContext.RunWithoutAuthorization <IDeploymentWithDefinitions>(() =>
            {
                AcquireExclusiveLock(commandContext);
                DeploymentEntity deployment = InitDeployment();
                //准备部署的xml数据源 byte[]
                IDictionary <string, ResourceEntity> resourcesToDeploy = ResolveResourcesToDeploy(commandContext, deployment);
                //准备忽略的resource
                IDictionary <string, ResourceEntity> resourcesToIgnore = new Dictionary <string, ResourceEntity>(deployment.Resources);
                foreach (var key in resourcesToDeploy.Keys)
                {
                    if (resourcesToIgnore.ContainsKey(key))
                    {
                        resourcesToIgnore.Remove(key);
                    }
                }

                if (resourcesToDeploy.Count > 0)
                {
                    Log.DebugCreatingNewDeployment();
                    deployment.Resources = resourcesToDeploy;
                    Deploy(deployment);
                }
                else
                {
                    Log.UsingExistingDeployment();
                    deployment = GetExistingDeployment(commandContext, deployment.Name);
                }

                ScheduleProcessDefinitionActivation(commandContext, deployment);

                if (deploymentBuilder is IProcessApplicationDeploymentBuilder)
                {
                    // for process application deployments, job executor registration is managed by
                    // process application manager
                    ISet <string> processesToRegisterFor         = RetrieveProcessKeysFromResources(resourcesToIgnore);
                    IProcessApplicationRegistration registration = RegisterProcessApplication(commandContext, deployment, processesToRegisterFor);
                    return(new ProcessApplicationDeploymentImpl(deployment, registration));
                }
                else
                {
                    RegisterWithJobExecutor(commandContext, deployment);
                }

                return(deployment);
            });

            CreateUserOperationLog(deploymentBuilder, dep, commandContext);

            return(dep);
        }
コード例 #3
0
 public ProcessApplicationDeploymentImpl(IDeploymentWithDefinitions deployment, IProcessApplicationRegistration registration)
 {
     this.Deployment   = deployment;
     this.Registration = registration;
 }