Beispiel #1
0
        public virtual void testDeleteProcessInstancesAsyncWithNullList()
        {
            thrown.expect(typeof(ProcessEngineException));
            thrown.expectMessage("processInstanceIds is empty");

            runtimeService.deleteProcessInstancesAsync(null, null, TESTING_INSTANCE_DELETE);
        }
Beispiel #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testWrongGlobalConfiguration()
        public virtual void testWrongGlobalConfiguration()
        {
            thrown.expect(typeof(ProcessEngineException));
            thrown.expectMessage("Invalid value");
            processEngineConfiguration.BatchOperationHistoryTimeToLive = "PD";
            processEngineConfiguration.initHistoryCleanup();
        }
Beispiel #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testSetJobsRetryAsyncWithEmptyJobList() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
        public virtual void testSetJobsRetryAsyncWithEmptyJobList()
        {
            //expect
            thrown.expect(typeof(ProcessEngineException));

            //when
            managementService.setJobRetriesAsync(new List <string>(), RETRIES);
        }
Beispiel #4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testDeleteHistoryProcessInstancesAsyncWithEmptyList() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
        public virtual void testDeleteHistoryProcessInstancesAsyncWithEmptyList()
        {
            //expect
            thrown.expect(typeof(ProcessEngineException));

            //when
            historyService.deleteHistoricProcessInstancesAsync(new List <string>(), TEST_REASON);
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void tooLongByteArrayIsNotAllowed()
        public virtual void TooLongByteArrayIsNotAllowed()
        {
            int length = MAX_BYTE_LENGTH * 2;

            ExpectedException.expect(typeof(System.ArgumentException));
            ExpectedException.expectMessage(containsString("Property value size is too large for index. Please see index documentation for limitations."));
            _validator.validate(RandomUtils.NextBytes(length));
        }
Beispiel #6
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void groupToRoleMappingShouldNotBeAbleToHaveInvalidFormat()
        public virtual void GroupToRoleMappingShouldNotBeAbleToHaveInvalidFormat()
        {
            when(Config.get(SecuritySettings.ldap_authorization_group_to_role_mapping)).thenReturn("group");

            ExpectedException.expect(typeof(System.ArgumentException));
            ExpectedException.expectMessage("wrong number of fields");

            new LdapRealm(Config, _securityLog, _secureHasher);
        }
Beispiel #7
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void pathToFileAfterMoveMustThrowIfFileNotSubPathToFromShorter()
        public virtual void PathToFileAfterMoveMustThrowIfFileNotSubPathToFromShorter()
        {
            File file = new File("/a");
            File from = new File("/a/b");
            File to   = new File("/a/c");

            Expected.expect(typeof(System.ArgumentException));
            pathToFileAfterMove(from, to, file);
        }
Beispiel #8
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void missingServerId()
        public virtual void MissingServerId()
        {
            // then
            Expected.expect(typeof(InvalidSettingException));
            Expected.expectMessage("Missing mandatory value for 'ha.server_id'");

            // when
            Config.fromSettings(stringMap(EnterpriseEditionSettings.mode.name(), Mode.name())).withValidator(new HaConfigurationValidator()).build();
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldFailIfMissingAnnotations() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldFailIfMissingAnnotations()
        {
            // Expect
            Exception.expect(typeof(ProcedureException));
            Exception.expectMessage(string.Format("Argument at position 0 in method `listCoolPeople` " + "is missing an `@Name` annotation.%n" + "Please add the annotation, recompile the class and try again."));

            // When
            Compile(typeof(ClassWithProcedureWithoutAnnotatedArgs));
        }
Beispiel #10
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldGiveHelpfulErrorOnUnmappable() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldGiveHelpfulErrorOnUnmappable()
        {
            // Expect
            Exception.expect(typeof(ProcedureException));
            Exception.expectMessage("Field `wat` in record `UnmappableRecord` cannot be converted to a Neo4j type:" + " Don't know how to map `org.neo4j.kernel.impl.proc.OutputMappersTest$UnmappableRecord`");

            // When
            Mapper(typeof(UnmappableRecord));
        }
Beispiel #11
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testSetJobRetriesWithNoAuthenticatedTenant()
        public virtual void testSetJobRetriesWithNoAuthenticatedTenant()
        {
            Job timerJob = managementService.createJobQuery().processInstanceId(processInstance.Id).singleResult();

            identityService.setAuthentication("aUserId", null);

            thrown.expect(typeof(ProcessEngineException));
            thrown.expectMessage("Cannot update the job '" + timerJob.Id + "' because it belongs to no authenticated tenant.");
            managementService.setJobRetries(timerJob.Id, 5);
        }
Beispiel #12
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void duplicateIdInDeployment()
        public virtual void duplicateIdInDeployment()
        {
            string resourceName1 = "org/camunda/bpm/engine/test/dmn/deployment/DecisionDefinitionDeployerTest.testDuplicateIdInDeployment.dmn11.xml";
            string resourceName2 = "org/camunda/bpm/engine/test/dmn/deployment/DecisionDefinitionDeployerTest.testDuplicateIdInDeployment2.dmn11.xml";

            thrown.expect(typeof(ProcessEngineException));
            thrown.expectMessage("duplicateDecision");

            repositoryService.createDeployment().addClasspathResource(resourceName1).addClasspathResource(resourceName2).name("duplicateIds").deploy();
        }
Beispiel #13
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void failToGetDecisionModelNoAuthenticatedTenants()
        public virtual void failToGetDecisionModelNoAuthenticatedTenants()
        {
            identityService.setAuthentication("user", null, null);

            // declare expected exception
            thrown.expect(typeof(ProcessEngineException));
            thrown.expectMessage("Cannot get the decision definition");

            repositoryService.getDecisionModel(decisionDefinitionId);
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void callGetBeforeNextShouldThrowIllegalStateException()
        public virtual void CallGetBeforeNextShouldThrowIllegalStateException()
        {
            // given
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: ContinuableArrayCursor<?> cursor = new ContinuableArrayCursor(supply(new System.Nullable<int>[0]));
            ContinuableArrayCursor <object> cursor = new ContinuableArrayCursor(Supply(new int?[0]));

            // then
            Thrown.expect(typeof(System.InvalidOperationException));
            cursor.Get();
        }
Beispiel #15
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void validatorsShouldBeCalledWhenBuilding()
        public virtual void ValidatorsShouldBeCalledWhenBuilding()
        {
            // Should not throw
            Config.Builder().withSetting(MySettingsWithDefaults.Hello, "neo4j").withValidator(new HelloHasToBeNeo4jConfigurationValidator()).withConfigClasses(Arrays.asList(_mySettingsWithDefaults, _myMigratingSettings)).build();

            Expect.expect(typeof(InvalidSettingException));
            Expect.expectMessage("Setting hello has to set to neo4j");

            // Should throw
            Config.Builder().withSetting(MySettingsWithDefaults.Hello, "not-neo4j").withValidator(new HelloHasToBeNeo4jConfigurationValidator()).withConfigClasses(Arrays.asList(_mySettingsWithDefaults, _myMigratingSettings)).build();
        }
Beispiel #16
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldFailIfNoRolesFileButManyUsersAndNoDefaultAdminOrNeo4j() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldFailIfNoRolesFileButManyUsersAndNoDefaultAdminOrNeo4j()
        {
            // Given
            Users.create(NewUser("jake", "abc123", false));
            Users.create(NewUser("jane", "123abc", false));

            Expect.expect(typeof(InvalidArgumentsException));
            Expect.expectMessage("No roles defined, and cannot determine which user should be admin. " + "Please use `neo4j-admin " + SetDefaultAdminCommand.COMMAND_NAME + "` to select an admin.");

            _manager.start();
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldGiveHelpfulErrorOnInvalidProcedure() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldGiveHelpfulErrorOnInvalidProcedure()
        {
            // Given
            URL jar = CreateJarFor(typeof(ClassWithOneProcedure), typeof(ClassWithInvalidProcedure));

            // Expect
            Exception.expect(typeof(ProcedureException));
            Exception.expectMessage(string.Format("Procedures must return a Stream of records, where a record is a concrete class%n" + "that you define, with public non-final fields defining the fields in the record.%n" + "If you''d like your procedure to return `boolean`, you could define a record class " + "like:%n" + "public class Output '{'%n" + "    public boolean out;%n" + "'}'%n" + "%n" + "And then define your procedure as returning `Stream<Output>`."));

            // When
            _jarloader.loadProceduresFromDir(ParentDir(jar));
        }
Beispiel #18
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void sentryTransformShouldFailWithMissingVariableEvent()
        public virtual void sentryTransformShouldFailWithMissingVariableEvent()
        {
            // given
            ExtensionElements     extensionElements = createElement(sentry, "extensionElements", typeof(ExtensionElements));
            CamundaVariableOnPart variableOnPart    = createElement(extensionElements, null, typeof(CamundaVariableOnPart));

            variableOnPart.VariableName = "aVariable";

            thrown.expect(typeof(CmmnTransformException));
            thrown.expectMessage("The variableOnPart of the sentry with id 'aSentry' must have one valid variable event.");
            sentryHandler.handleElement(sentry, context);
        }
Beispiel #19
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldFailWhenDuplicateKey()
        public virtual void ShouldFailWhenDuplicateKey()
        {
            // Given
            string mapString = "{k1: 2.718281828, k1: 'e'}";

            // Expect
            Exception.expect(typeof(System.ArgumentException));
            Exception.expectMessage("Multiple occurrences of key 'k1'");

            // When
            _converter.apply(mapString);
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void requiresTypeWhenNameIsNotHttpOrHttps()
        public virtual void RequiresTypeWhenNameIsNotHttpOrHttps()
        {
            string randomEnabled = "dbms.connector.bla.enabled";
            string randomType    = "dbms.connector.bla.type";

            assertEquals(stringMap(randomEnabled, "true", randomType, HTTP.name()), Cv.validate(stringMap(randomEnabled, "true", randomType, HTTP.name()), WarningConsumer));

            Expected.expect(typeof(InvalidSettingException));
            Expected.expectMessage("Missing mandatory value for 'dbms.connector.bla.type'");

            Cv.validate(stringMap(randomEnabled, "true"), WarningConsumer);
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldGiveHelpfulErrorOnUnmappable() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldGiveHelpfulErrorOnUnmappable()
        {
            // Given
            System.Reflection.MethodInfo echo = typeof(ClassWithProcedureWithSimpleArgs).GetMethod("echoWithInvalidType", typeof(UnmappableRecord));

            // Expect
            Exception.expect(typeof(ProcedureException));
            Exception.expectMessage(string.Format("Argument `name` at position 0 in `echoWithInvalidType` with%n" + "type `UnmappableRecord` cannot be converted to a Neo4j type: Don't know how to map " + "`org.neo4j.kernel.impl.proc.MethodSignatureCompilerTest$UnmappableRecord` to " + "the Neo4j Type System.%n" + "Please refer to to the documentation for full details.%n" + "For your reference, known types are:"));

            // When
            (new MethodSignatureCompiler(new TypeMappers())).SignatureFor(echo);
        }
Beispiel #22
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void nonExistingBackupDirectoryRaisesException() throws org.neo4j.commandline.admin.CommandFailed, org.neo4j.commandline.admin.IncorrectUsage, java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void NonExistingBackupDirectoryRaisesException()
        {
            // given backup directory is not a directory
            _fileSystemAbstraction.deleteRecursively(_backupDirectory.toFile());
            _fileSystemAbstraction.create(_backupDirectory.toFile()).close();

            // then
            Expected.expect(typeof(CommandFailed));
            Expected.expectMessage(stringContainsInOrder(asList("Directory '", "backupDirectory' does not exist.")));

            // when
            Execute();
        }
Beispiel #23
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void twoEncryptorsWithSamePrefixThrowError()
        public virtual void twoEncryptorsWithSamePrefixThrowError()
        {
            // given two algorithms with the same prefix
            IList <PasswordEncryptor> additionalEncryptorsForPasswordChecking = new LinkedList <PasswordEncryptor>();

            additionalEncryptorsForPasswordChecking.Add(new ShaHashDigest());
            PasswordEncryptor defaultEncryptor = new ShaHashDigest();

            // then
            thrown.expect(typeof(PasswordEncryptionException));
            thrown.expectMessage("Hash algorithm with the name 'SHA' was already added");

            // when
            setEncryptors(defaultEncryptor, additionalEncryptorsForPasswordChecking);
        }
Beispiel #24
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test @Resources.Life(STARTED) public void accessClosedStateShouldThrow() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void AccessClosedStateShouldThrow()
        {
            Store store = _resourceManager.managed(new Store(this));

            store.Put("test", "value");
            store.PrepareRotation(0).rotate();
            ProgressiveState <string> lookupState = store.State;

            store.PrepareRotation(0).rotate();

            _expectedException.expect(typeof(FileIsNotMappedException));
            _expectedException.expectMessage("File has been unmapped");

            lookupState.lookup("test", new ValueSinkAnonymousInnerClass(this));
        }
Beispiel #25
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testDeleteProcessDefinitionNullId()
        public virtual void testDeleteProcessDefinitionNullId()
        {
            // declare expected exception
            thrown.expect(typeof(NullValueException));
            thrown.expectMessage("processDefinitionId is null");

            repositoryService.deleteProcessDefinition(null);
        }
Beispiel #26
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testReceiveTaskMessageCorrelationFail()
        public virtual void testReceiveTaskMessageCorrelationFail()
        {
            //given
            BpmnModelInstance model = Bpmn.createExecutableProcess("Process_1").startEvent().subProcess("SubProcess_1").embeddedSubProcess().startEvent().receiveTask("MessageReceiver_1").message(TEST_MESSAGE_NAME).camundaInputParameter("localVar", "${loopVar}").camundaInputParameter("constVar", "someValue").userTask("UserTask_1").endEvent().subProcessDone().multiInstance().camundaCollection("${vars}").camundaElementVariable("loopVar").multiInstanceDone().endEvent().done();

            testHelper.deploy(model);

            IDictionary <string, object> variables = new Dictionary <string, object>();

            variables["vars"] = Arrays.asList(1, 2, 1);
            engineRule.RuntimeService.startProcessInstanceByKey("Process_1", variables);

            //when correlated by local variables
            string messageName = TEST_MESSAGE_NAME;
            IDictionary <string, object> correlationKeys = new Dictionary <string, object>();
            int correlationKey = 1;

            correlationKeys["localVar"] = correlationKey;
            correlationKeys["constVar"] = "someValue";

            // declare expected exception
            thrown.expect(typeof(MismatchingMessageCorrelationException));
            thrown.expectMessage(string.Format("Cannot correlate a message with name '{0}' to a single execution", TEST_MESSAGE_NAME));

            engineRule.RuntimeService.createMessageCorrelation(messageName).localVariablesEqual(correlationKeys).setVariables(Variables.createVariables().putValue("newVar", "newValue")).correlateWithResult();
        }
Beispiel #27
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void failForceIndexesWhenOneOfTheIndexesIsBroken() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void FailForceIndexesWhenOneOfTheIndexesIsBroken()
        {
            string constraintLabelPrefix    = "ConstraintLabel";
            string constraintPropertyPrefix = "ConstraintProperty";
            string indexLabelPrefix         = "Label";
            string indexPropertyPrefix      = "Property";

            for (int i = 0; i < 10; i++)
            {
                using (Transaction transaction = _database.beginTx())
                {
                    _database.schema().constraintFor(Label.label(constraintLabelPrefix + i)).assertPropertyIsUnique(constraintPropertyPrefix + i).create();
                    _database.schema().indexFor(Label.label(indexLabelPrefix + i)).on(indexPropertyPrefix + i).create();
                    transaction.Success();
                }
            }

            using (Transaction ignored = _database.beginTx())
            {
                _database.schema().awaitIndexesOnline(1, TimeUnit.MINUTES);
            }

            IndexingService indexingService = GetIndexingService(_database);

            int indexLabel7    = GetLabelId(indexLabelPrefix + 7);
            int indexProperty7 = GetPropertyKeyId(indexPropertyPrefix + 7);

            IndexProxy index = indexingService.GetIndexProxy(TestIndexDescriptorFactory.forLabel(indexLabel7, indexProperty7).schema());

            index.Drop();

            ExpectedException.expect(typeof(UnderlyingStorageException));
            ExpectedException.expectMessage("Unable to force");
            indexingService.ForceAll(Org.Neo4j.Io.pagecache.IOLimiter_Fields.Unlimited);
        }
Beispiel #28
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void failToSendSignalWithExecutionIdForTenant()
        public virtual void failToSendSignalWithExecutionIdForTenant()
        {
            thrown.expect(typeof(BadUserRequestException));
            thrown.expectMessage("Cannot specify a tenant-id when deliver a signal to a single execution.");

            engineRule.RuntimeService.createSignalEvent("signal").executionId("id").tenantId(TENANT_ONE).send();
        }
Beispiel #29
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void cannotDeleteNodeWithLoopStillAttached()
        public virtual void CannotDeleteNodeWithLoopStillAttached()
        {
            // Given
            GraphDatabaseService db = GraphDb;
            Node node;

            using (Transaction tx = Db.beginTx())
            {
                node = Db.createNode();
                node.CreateRelationshipTo(node, RelationshipType.withName("MAYOR_OF"));
                tx.Success();
            }

            // And given a transaction deleting just the node
            Transaction tx = NewTransaction();

            node.Delete();
            tx.Success();

            // Expect
            Exception.expect(typeof(ConstraintViolationException));
            Exception.expectMessage("Cannot delete node<" + node.Id + ">, because it still has relationships. " + "To delete this node, you must first delete its relationships.");

            // When I commit
            tx.Close();
        }
Beispiel #30
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void migrationShouldFailIfUpgradeNotAllowed() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void MigrationShouldFailIfUpgradeNotAllowed()
        {
            PrepareStore("explicit-index-db.zip");
            ExpectedException.expect(new NestedThrowableMatcher(typeof(UpgradeNotAllowedByConfigurationException)));

            StartDatabase(false);
        }