예제 #1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: @Override protected void performRuntime(OperationContext context, org.jboss.dmr.ModelNode operation, org.jboss.dmr.ModelNode model, ServiceVerificationHandler verificationHandler, java.util.List<org.jboss.msc.service.ServiceController<?>> newControllers) throws OperationFailedException
        protected internal override void performRuntime <T1>(OperationContext context, ModelNode operation, ModelNode model, ServiceVerificationHandler verificationHandler, IList <T1> newControllers)
        {
            string acquisitionName = PathAddress.pathAddress(operation.get(ModelDescriptionConstants.ADDRESS)).LastElement.Value;

            MscRuntimeContainerJobExecutor mscRuntimeContainerJobExecutor = new MscRuntimeContainerJobExecutor();

            if (model.hasDefined(SubsystemAttributeDefinitons.PROPERTIES.Name))
            {
                IList <Property> properties = SubsystemAttributeDefinitons.PROPERTIES.resolveModelAttribute(context, model).asPropertyList();
                foreach (Property property in properties)
                {
                    PropertyHelper.applyProperty(mscRuntimeContainerJobExecutor, property.Name, property.Value.asString());
                }
            }

            // start new service for job executor
            ServiceController <RuntimeContainerJobExecutor> serviceController = context.ServiceTarget.addService(ServiceNames.forMscRuntimeContainerJobExecutorService(acquisitionName), mscRuntimeContainerJobExecutor).addDependency(ServiceNames.forMscRuntimeContainerDelegate()).addDependency(ServiceNames.forMscExecutorService()).addListener(verificationHandler).setInitialMode(ServiceController.Mode.ACTIVE).install();

            newControllers.Add(serviceController);
        }
예제 #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testInstallSubsystemWithJobExecutorAndPropertiesXml() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
        public virtual void testInstallSubsystemWithJobExecutorAndPropertiesXml()
        {
            string subsystemXml = FileUtils.readFile(SUBSYSTEM_WITH_JOB_EXECUTOR_AND_PROPERTIES);

            KernelServices   services  = createKernelServicesBuilder(null).setSubsystemXml(subsystemXml).build();
            ServiceContainer container = services.Container;

            assertNotNull("platform service should be installed", container.getService(PLATFORM_SERVICE_NAME));
            assertNotNull("process engine service should be bound in JNDI", container.getService(processEngineServiceBindingServiceName));

            assertNotNull("platform jobexecutor service should be installed", container.getService(PLATFORM_JOBEXECUTOR_SERVICE_NAME));

            // "default" job acquisition ///////////////////////////////////////////////////////////
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: org.jboss.msc.service.ServiceController<?> defaultJobAcquisitionService = container.getService(org.camunda.bpm.container.impl.jboss.service.ServiceNames.forMscRuntimeContainerJobExecutorService("default"));
            ServiceController <object> defaultJobAcquisitionService = container.getService(ServiceNames.forMscRuntimeContainerJobExecutorService("default"));

            assertNotNull("platform job acquisition service 'default' should be installed", defaultJobAcquisitionService);

            object value = defaultJobAcquisitionService.Value;

            assertNotNull(value);
            assertTrue(value is JobExecutor);

            JobExecutor defaultJobExecutor = (JobExecutor)value;

            assertEquals(300000, defaultJobExecutor.LockTimeInMillis);
            assertEquals(5000, defaultJobExecutor.WaitTimeInMillis);
            assertEquals(3, defaultJobExecutor.MaxJobsPerAcquisition);

            // "anders" job acquisition /////////////////////////////////////////////////////////
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: org.jboss.msc.service.ServiceController<?> andersJobAcquisitionService = container.getService(org.camunda.bpm.container.impl.jboss.service.ServiceNames.forMscRuntimeContainerJobExecutorService("anders"));
            ServiceController <object> andersJobAcquisitionService = container.getService(ServiceNames.forMscRuntimeContainerJobExecutorService("anders"));

            assertNotNull("platform job acquisition service 'anders' should be installed", andersJobAcquisitionService);

            value = andersJobAcquisitionService.Value;
            assertNotNull(value);
            assertTrue(value is JobExecutor);

            JobExecutor andersJobExecutor = (JobExecutor)value;

            assertEquals(600000, andersJobExecutor.LockTimeInMillis);
            assertEquals(10000, andersJobExecutor.WaitTimeInMillis);
            assertEquals(5, andersJobExecutor.MaxJobsPerAcquisition);

            // "mixed" job acquisition /////////////////////////////////////////////////////////
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: org.jboss.msc.service.ServiceController<?> mixedJobAcquisitionService = container.getService(org.camunda.bpm.container.impl.jboss.service.ServiceNames.forMscRuntimeContainerJobExecutorService("mixed"));
            ServiceController <object> mixedJobAcquisitionService = container.getService(ServiceNames.forMscRuntimeContainerJobExecutorService("mixed"));

            assertNotNull("platform job acquisition service 'mixed' should be installed", mixedJobAcquisitionService);

            value = mixedJobAcquisitionService.Value;
            assertNotNull(value);
            assertTrue(value is JobExecutor);

            JobExecutor mixedJobExecutor = (JobExecutor)value;

            assertEquals(500000, mixedJobExecutor.LockTimeInMillis);
            // default values
            assertEquals(5000, mixedJobExecutor.WaitTimeInMillis);
            assertEquals(3, mixedJobExecutor.MaxJobsPerAcquisition);
        }