Ejemplo n.º 1
0
        public virtual void testFetchAndLockIgnoreRead()
        {
            // given
            IList <string> permissions = new List <string>();

            permissions.Add(READ.name());
            permissions.Add(READ_INSTANCE.name());
            processEngineConfiguration.DisabledPermissions = permissions;
            ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("oneExternalTaskProcess");

            authRule.createGrantAuthorization(PROCESS_INSTANCE, "*", USER_ID, UPDATE);

            authRule.enableAuthorization(USER_ID);

            // when
            IList <LockedExternalTask> externalTasks = engineRule.ExternalTaskService.fetchAndLock(1, "aWorkerId").topic("externalTaskTopic", 10000L).execute();

            // then
            assertEquals(1, externalTasks.Count);

            LockedExternalTask task = externalTasks[0];

            assertNotNull(task.Id);
            assertEquals(processInstance.Id, task.ProcessInstanceId);
            assertEquals(processInstance.ProcessDefinitionId, task.ProcessDefinitionId);
            assertEquals("externalTask", task.ActivityId);
            assertEquals("oneExternalTaskProcess", task.ProcessDefinitionKey);
        }
        private void RefreshTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            refreshTimer.Stop();

            port.WriteLine("POS");
            reading_decode = READ.POSITON;
            while (reading_decode == READ.POSITON)
            {
            }

            port.WriteLine("V");
            reading_decode = READ.VELOCITY;
            while (reading_decode == READ.VELOCITY)
            {
            }
            reading_decode = READ.GENERAL;
            if (recording_to_file)
            {
                string tmp_string = txtActualPosition.Text + "; " + txtActualVelocity.Text + "; "
                                    + DateTime.Now.Minute.ToString() + ":" + DateTime.Now.Second.ToString()
                                    + ":" + DateTime.Now.Millisecond.ToString();
                file_lines[count_lines] = tmp_string;
                count_lines++;
            }

            refreshTimer.Start();
        }
Ejemplo n.º 3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testIsUserAuthorizedForIgnoredPermission()
        public virtual void testIsUserAuthorizedForIgnoredPermission()
        {
            // given
            processEngineConfiguration.DisabledPermissions = Arrays.asList(READ.name());

            authRule.createGrantAuthorization(PROCESS_INSTANCE, ANY, USER_ID, ProcessInstancePermissions.RETRY_JOB);

            authRule.enableAuthorization(USER_ID);

            // expected exception
            exceptionRule.expect(typeof(BadUserRequestException));
            exceptionRule.expectMessage("The 'READ' permission is disabled, please check your process engine configuration.");

            // when
            authorizationService.isUserAuthorized(USER_ID, null, READ, PROCESS_DEFINITION);
        }
Ejemplo n.º 4
0
        internal static object[] Build(Org.Neo4j.causalclustering.routing.load_balancing.LoadBalancingProcessor_Result result)
        {
//JAVA TO C# CONVERTER TODO TASK: Method reference arbitrary object instance method syntax is not converted by Java to C# Converter:
            object[] routers = result.RouteEndpoints().Select(Endpoint::address).Select(SocketAddress::toString).ToArray();
//JAVA TO C# CONVERTER TODO TASK: Method reference arbitrary object instance method syntax is not converted by Java to C# Converter:
            object[] readers = result.ReadEndpoints().Select(Endpoint::address).Select(SocketAddress::toString).ToArray();
//JAVA TO C# CONVERTER TODO TASK: Method reference arbitrary object instance method syntax is not converted by Java to C# Converter:
            object[] writers = result.WriteEndpoints().Select(Endpoint::address).Select(SocketAddress::toString).ToArray();

            IList <IDictionary <string, object> > servers = new List <IDictionary <string, object> >();

            if (writers.Length > 0)
            {
                IDictionary <string, object> map = new SortedDictionary <string, object>();

                map[ROLE_KEY]      = WRITE.name();
                map[ADDRESSES_KEY] = writers;

                servers.Add(map);
            }

            if (readers.Length > 0)
            {
                IDictionary <string, object> map = new SortedDictionary <string, object>();

                map[ROLE_KEY]      = READ.name();
                map[ADDRESSES_KEY] = readers;

                servers.Add(map);
            }

            if (routers.Length > 0)
            {
                IDictionary <string, object> map = new SortedDictionary <string, object>();

                map[ROLE_KEY]      = ROUTE.name();
                map[ADDRESSES_KEY] = routers;

                servers.Add(map);
            }

            long timeToLiveSeconds = MILLISECONDS.toSeconds(result.TtlMillis());

            return(new object[] { timeToLiveSeconds, servers });
        }
 //check the arduino code timely
 private void timer1_Tick(object sender, EventArgs e)
 {
     try
     {
         if (!serialPort1.IsOpen)
         {
             connectPort();
         }
         string READ;
         READ = serialPort1.ReadLine();
         addInfoToLog("STATUS", READ.ToString());
         listBox1.SelectedIndex = listBox1.Items.Count - 1;   //continue rolling scroll bar.
     }
     catch (Exception ex)
     {
         addInfoToLog("error", ex.Message);
         listBox1.SelectedIndex = listBox1.Items.Count - 1;
     }
 }
Ejemplo n.º 6
0
        public virtual void testStartableInTasklistIgnoreRead()
        {
            // given
            processEngineConfiguration.DisabledPermissions = Arrays.asList(READ.name());
            authRule.createGrantAuthorization(PROCESS_DEFINITION, "oneTaskProcess", USER_ID, CREATE_INSTANCE);
            authRule.createGrantAuthorization(PROCESS_INSTANCE, "*", USER_ID, CREATE);

            authRule.disableAuthorization();
            ProcessDefinition definition = repositoryService.createProcessDefinitionQuery().processDefinitionKey("oneTaskProcess").singleResult();

            authRule.enableAuthorization(USER_ID);

            // when
            IList <ProcessDefinition> processDefinitions = repositoryService.createProcessDefinitionQuery().startablePermissionCheck().startableInTasklist().list();

            // then
            assertNotNull(processDefinitions);
            assertEquals(1, repositoryService.createProcessDefinitionQuery().startablePermissionCheck().startableInTasklist().count());
            assertEquals(definition.Id, processDefinitions[0].Id);
            assertTrue(processDefinitions[0].StartableInTasklist);
        }
        /// <summary>
        /// Handle received messages from serial port!
        /// Synchronized from the client.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="Se"></param>
        private void Port_DataReceived(object sender, SerialDataReceivedEventArgs Se)
        {
            string generalData = port.ReadTo("\n");

            switch (reading_decode)
            {
            case READ.POSITON:
                this.Dispatcher.Invoke(() =>
                {
                    txtActualPosition.Text = generalData;
                });
                reading_decode = READ.VELOCITY;
                break;

            case READ.VELOCITY:
                this.Dispatcher.Invoke(() =>
                {
                    txtActualVelocity.Text = generalData;
                });
                reading_decode = READ.GENERAL;
                break;

            case READ.GENERAL:
                this.Dispatcher.Invoke(() =>
                {
                    txtRx.Text = generalData;
                });
                reading_decode = READ.POSITON;
                break;

            default:
                this.Dispatcher.Invoke(() =>
                {
                    txtRx.Text = generalData;
                });
                reading_decode = READ.POSITON;
                break;
            }
        }
Ejemplo n.º 8
0
        public virtual void testActivityStatisticsIgnoreRead()
        {
            // given
            IList <string> permissions = new List <string>();

            permissions.Add(READ.name());
            permissions.Add(READ_INSTANCE.name());
            processEngineConfiguration.DisabledPermissions = permissions;
            string processDefinitionId = runtimeService.startProcessInstanceByKey("timerBoundaryProcess").ProcessDefinitionId;

            authRule.enableAuthorization(USER_ID);

            // when
            ActivityStatistics statistics = managementService.createActivityStatisticsQuery(processDefinitionId).singleResult();

            // then
            assertNotNull(statistics);
            assertEquals("task", statistics.Id);
            assertEquals(1, statistics.Instances);
            assertEquals(0, statistics.FailedJobs);
            assertTrue(statistics.IncidentStatistics.Count == 0);
        }
Ejemplo n.º 9
0
        public virtual void testQueryDeploymentIgnoreRead()
        {
            // given
            engineRule.ProcessEngineConfiguration.DisabledPermissions = Arrays.asList(READ.name());

            // when
            authRule.enableAuthorization(USER_ID);
            IList <org.camunda.bpm.engine.repository.Deployment> deployments = engineRule.RepositoryService.createDeploymentQuery().list();

            // then
            assertEquals(1, deployments.Count);
        }