//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void shouldFailToInsertTooLargeKeyAndValue(RawBytes key, RawBytes value) throws java.io.IOException
        private void ShouldFailToInsertTooLargeKeyAndValue(RawBytes key, RawBytes value)
        {
            Initialize();
            try
            {
                Insert(key, value);
            }
            catch (System.ArgumentException e)
            {
                assertThat(e.Message, CoreMatchers.containsString("Index key-value size it to large. Please see index documentation for limitations."));
            }
        }
예제 #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldFailWhenActivatingUsingUnknownId()
        public virtual void shouldFailWhenActivatingUsingUnknownId()
        {
            try
            {
                managementService.activateBatchById("unknown");
                fail("Exception expected");
            }
            catch (BadUserRequestException e)
            {
                assertThat(e.Message, CoreMatchers.containsString("Batch for id 'unknown' cannot be found"));
            }
        }
예제 #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldFailWhenActivatingUsingNullId()
        public virtual void shouldFailWhenActivatingUsingNullId()
        {
            try
            {
                managementService.activateBatchById(null);
                fail("Exception expected");
            }
            catch (BadUserRequestException e)
            {
                assertThat(e.Message, CoreMatchers.containsString("batch id is null"));
            }
        }
예제 #4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void readLevelFullfromDB() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
        public virtual void readLevelFullfromDB()
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl config = config("true", org.camunda.bpm.engine.ProcessEngineConfiguration.HISTORY_FULL);
            ProcessEngineConfigurationImpl config = config("true", ProcessEngineConfiguration.HISTORY_FULL);

            // init the db with level=full
            processEngineImpl = (ProcessEngineImpl)config.buildProcessEngine();

            HistoryLevel historyLevel = config.CommandExecutorSchemaOperations.execute(new DetermineHistoryLevelCmd(config.HistoryLevels));

            assertThat(historyLevel, CoreMatchers.equalTo(org.camunda.bpm.engine.impl.history.HistoryLevel_Fields.HISTORY_LEVEL_FULL));
        }
예제 #5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void useDefaultLevelAudit() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
        public virtual void useDefaultLevelAudit()
        {
            ProcessEngineConfigurationImpl config = config("true", ProcessEngineConfiguration.HISTORY_AUTO);

            // init the db with level=auto -> audit
            processEngineImpl = (ProcessEngineImpl)config.buildProcessEngine();
            // the history Level has been overwritten with audit
            assertThat(config.HistoryLevel, CoreMatchers.equalTo(org.camunda.bpm.engine.impl.history.HistoryLevel_Fields.HISTORY_LEVEL_AUDIT));

            // and this is written to the database
            HistoryLevel databaseLevel = config.CommandExecutorSchemaOperations.execute(new DetermineHistoryLevelCmd(config.HistoryLevels));

            assertThat(databaseLevel, CoreMatchers.equalTo(org.camunda.bpm.engine.impl.history.HistoryLevel_Fields.HISTORY_LEVEL_AUDIT));
        }
예제 #6
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void cannotCreateMigrationPlanBetweenDifferentTenants()
        public virtual void cannotCreateMigrationPlanBetweenDifferentTenants()
        {
            // given
            ProcessDefinition tenant1Definition = testHelper.deployForTenantAndGetDefinition(TENANT_ONE, ProcessModels.ONE_TASK_PROCESS);
            ProcessDefinition tenant2Definition = testHelper.deployForTenantAndGetDefinition(TENANT_TWO, ProcessModels.ONE_TASK_PROCESS);

            // when
            try
            {
                engineRule.RuntimeService.createMigrationPlan(tenant1Definition.Id, tenant2Definition.Id).mapEqualActivities().build();
                Assert.fail("exception expected");
            }
            catch (ProcessEngineException e)
            {
                // then
                Assert.assertThat(e.Message, CoreMatchers.containsString("Cannot migrate process instances between processes of different tenants ('tenant1' != 'tenant2')"));
            }
        }
예제 #7
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void cannotMigrateInstanceWithoutTenantIdToDifferentTenant()
        public virtual void cannotMigrateInstanceWithoutTenantIdToDifferentTenant()
        {
            // given
            ProcessDefinition sourceDefinition = testHelper.deployAndGetDefinition(ProcessModels.ONE_TASK_PROCESS);
            ProcessDefinition targetDefinition = testHelper.deployForTenantAndGetDefinition(TENANT_ONE, ProcessModels.ONE_TASK_PROCESS);

            ProcessInstance processInstance = engineRule.RuntimeService.startProcessInstanceById(sourceDefinition.Id);
            MigrationPlan   migrationPlan   = engineRule.RuntimeService.createMigrationPlan(sourceDefinition.Id, targetDefinition.Id).mapEqualActivities().build();

            // when
            try
            {
                engineRule.RuntimeService.newMigration(migrationPlan).processInstanceIds(Arrays.asList(processInstance.Id)).execute();
                Assert.fail("exception expected");
            }
            catch (ProcessEngineException e)
            {
                Assert.assertThat(e.Message, CoreMatchers.containsString("Cannot migrate process instance '" + processInstance.Id + "' without tenant to a process definition with a tenant ('tenant1')"));
            }
        }
예제 #8
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testGetBinaryDataForFileVariable()
        public virtual void testGetBinaryDataForFileVariable()
        {
            string filename = "test.txt";

            sbyte[]   byteContent   = "test".GetBytes();
            string    encoding      = "UTF-8";
            FileValue variableValue = Variables.fileValue(filename).file(byteContent).mimeType(ContentType.TEXT.ToString()).encoding(encoding).create();
            HistoricVariableInstance variableInstanceMock = MockProvider.mockHistoricVariableInstance().typedValue(variableValue).build();

            when(variableInstanceQueryMock.variableId(variableInstanceMock.Id)).thenReturn(variableInstanceQueryMock);
            when(variableInstanceQueryMock.disableCustomObjectDeserialization()).thenReturn(variableInstanceQueryMock);
            when(variableInstanceQueryMock.singleResult()).thenReturn(variableInstanceMock);

            Response response = given().pathParam("id", MockProvider.EXAMPLE_VARIABLE_INSTANCE_ID).then().expect().statusCode(Status.OK.StatusCode).and().body(@is(equalTo(StringHelper.NewString(byteContent)))).header("Content-Disposition", "attachment; filename=" + filename).when().get(VARIABLE_INSTANCE_BINARY_DATA_URL);
            //due to some problems with wildfly we gotta check this separately
            string contentType = response.ContentType;

            assertThat(contentType, @is(either(CoreMatchers.equalTo <object>(ContentType.TEXT.ToString() + "; charset=UTF-8")).or(CoreMatchers.equalTo <object>(ContentType.TEXT.ToString() + ";charset=UTF-8"))));

            verify(variableInstanceQueryMock, never()).disableBinaryFetching();
        }
예제 #9
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void cannotMigrateInstanceWithoutTenantIdToDifferentTenant()
        public virtual void cannotMigrateInstanceWithoutTenantIdToDifferentTenant()
        {
            // given
            ProcessDefinition sourceDefinition = defaultTestRule.deployAndGetDefinition(ProcessModels.ONE_TASK_PROCESS);
            ProcessDefinition targetDefinition = defaultTestRule.deployForTenantAndGetDefinition(TENANT_ONE, ProcessModels.ONE_TASK_PROCESS);

            ProcessInstance processInstance = defaultEngineRule.RuntimeService.startProcessInstanceById(sourceDefinition.Id);
            MigrationPlan   migrationPlan   = defaultEngineRule.RuntimeService.createMigrationPlan(sourceDefinition.Id, targetDefinition.Id).mapEqualActivities().build();

            Batch batch = defaultEngineRule.RuntimeService.newMigration(migrationPlan).processInstanceIds(Arrays.asList(processInstance.Id)).executeAsync();

            batchHelper.executeSeedJob(batch);

            // when
            batchHelper.executeJobs(batch);

            // then
            Job migrationJob = batchHelper.getExecutionJobs(batch)[0];

            Assert.assertThat(migrationJob.ExceptionMessage, CoreMatchers.containsString("Cannot migrate process instance '" + processInstance.Id + "' without tenant to a process definition with a tenant ('tenant1')"));
        }
예제 #10
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void cannotMigrateInstanceBetweenDifferentTenants()
        public virtual void cannotMigrateInstanceBetweenDifferentTenants()
        {
            // given
            ProcessDefinition sharedDefinition = testHelper.deployAndGetDefinition(ProcessModels.ONE_TASK_PROCESS);
            ProcessDefinition tenantDefinition = testHelper.deployForTenantAndGetDefinition(TENANT_TWO, ProcessModels.ONE_TASK_PROCESS);

            ProcessInstance processInstance = startInstanceForTenant(sharedDefinition, TENANT_ONE);
            MigrationPlan   migrationPlan   = engineRule.RuntimeService.createMigrationPlan(sharedDefinition.Id, tenantDefinition.Id).mapEqualActivities().build();

            // when
            try
            {
                engineRule.RuntimeService.newMigration(migrationPlan).processInstanceIds(Arrays.asList(processInstance.Id)).execute();
                Assert.fail("exception expected");
            }
            catch (ProcessEngineException e)
            {
                Assert.assertThat(e.Message, CoreMatchers.containsString("Cannot migrate process instance '" + processInstance.Id + "' " + "to a process definition of a different tenant ('tenant1' != 'tenant2')"));
            }

            // then
            Assert.assertNotNull(migrationPlan);
        }
예제 #11
0
        /* This is somewhat difficult to test since dropping an index while it's populating forces it to be cancelled
         * first (and also awaiting cancellation to complete). So this is a best-effort to have the timing as close
         * as possible. If this proves to be flaky, remove it right away.
         */
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldBeAbleToDropIndexWhileItIsPopulating()
        public virtual void ShouldBeAbleToDropIndexWhileItIsPopulating()
        {
            // GIVEN
            StartDb();
            DoubleLatch     populationCompletionLatch = _provider.installPopulationJobCompletionLatch();
            IndexDefinition index = CreateIndex();

            populationCompletionLatch.WaitForAllToStart();               // await population job to start

            // WHEN
            DropIndex(index, populationCompletionLatch);

            // THEN
            assertThat(getIndexes(_db, _myLabel), inTx(_db, hasSize(0)));
            try
            {
                getIndexState(_db, index);
                fail("This index should have been deleted");
            }
            catch (NotFoundException e)
            {
                assertThat(e.Message, CoreMatchers.containsString(_myLabel.name()));
            }
        }
예제 #12
0
 public virtual void requiredHistoryLevelActivity()
 {
     assertThat(currentHistoryLevel(), CoreMatchers.either <string>(@is(ProcessEngineConfiguration.HISTORY_ACTIVITY)).or(@is(ProcessEngineConfiguration.HISTORY_AUDIT)).or(@is(ProcessEngineConfiguration.HISTORY_FULL)));
 }
예제 #13
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void ensureCorrectToString()
        public virtual void ensureCorrectToString()
        {
            Assert.assertThat((new MyHistoryLevel()).ToString(), CoreMatchers.@is("MyHistoryLevel(name=myName, id=4711)"));
        }
예제 #14
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldNotBeAbleToParsePointsWithConflictingDuplicateFields()
        internal virtual void ShouldNotBeAbleToParsePointsWithConflictingDuplicateFields()
        {
            assertThat(AssertCannotParse("{latitude: 2.0, longitude: 1.0, latitude: 3.0}").Message, CoreMatchers.containsString("Duplicate field"));
            assertThat(AssertCannotParse("{latitude: 2.0, longitude: 1.0, latitude: 3.0}").Message, CoreMatchers.containsString("Duplicate field"));
            assertThat(AssertCannotParse("{crs: 'cartesian', x: 2.0, x: 1.0, y: 3}").Message, CoreMatchers.containsString("Duplicate field"));
            assertThat(AssertCannotParse("{crs: 'invalid crs', x: 1.0, y: 3, crs: 'cartesian'}").Message, CoreMatchers.containsString("Duplicate field"));
        }