@Test public void matchDefaultBT() { StringMatchingExpression stringMatchingExpression = new StringMatchingExpression(PatternMatchingType.CONTAINS, "root"); stringMatchingExpression.setStringValueSource(stringValueSource); stringMatchingExpression.setSearchNodeInTrace(false); StringMatchingExpression stringMatchingExpression_2 = new StringMatchingExpression(PatternMatchingType.CONTAINS, "nothing"); stringMatchingExpression_2.setStringValueSource(stringValueSource); stringMatchingExpression_2.setSearchNodeInTrace(false); applicationDefinition.setMatchingRuleExpression(stringMatchingExpression); applicationDefinition_empty.setMatchingRuleExpression(stringMatchingExpression_2); businessTxDefinition_1.setMatchingRuleExpression(stringMatchingExpression_2); businessTxDefinition_2.setMatchingRuleExpression(stringMatchingExpression_2); processor.process(root, entityManager); assertThat(root.getApplicationId(), equalTo(application.getId())); assertThat(root.getBusinessTransactionId(), equalTo(businessTx_unknown.getId())); }
@Test public void matchDefaultAppAndBT() { StringMatchingExpression stringMatchingExpression = new StringMatchingExpression(PatternMatchingType.CONTAINS, "nothing"); stringMatchingExpression.setStringValueSource(stringValueSource); stringMatchingExpression.setSearchNodeInTrace(false); StringMatchingExpression stringMatchingExpression_2 = new StringMatchingExpression(PatternMatchingType.CONTAINS, "nothing"); stringMatchingExpression_2.setStringValueSource(stringValueSource); stringMatchingExpression_2.setSearchNodeInTrace(false); applicationDefinition.setMatchingRuleExpression(stringMatchingExpression); applicationDefinition_empty.setMatchingRuleExpression(stringMatchingExpression_2); businessTxDefinition_1.setMatchingRuleExpression(stringMatchingExpression_2); businessTxDefinition_2.setMatchingRuleExpression(stringMatchingExpression_2); processor.process(root, entityManager); assertThat(root.getApplicationId(), equalTo(application_unknown.getId())); assertThat(root.getBusinessTransactionId(), equalTo(businessTx_unknown.getId())); }
@Test public void match() { StringMatchingExpression stringMatchingExpression = new StringMatchingExpression(PatternMatchingType.CONTAINS, "root"); stringMatchingExpression.setStringValueSource(stringValueSource); stringMatchingExpression.setSearchNodeInTrace(false); StringMatchingExpression stringMatchingExpression_2 = new StringMatchingExpression(PatternMatchingType.CONTAINS, "nothing"); stringMatchingExpression_2.setStringValueSource(stringValueSource); stringMatchingExpression_2.setSearchNodeInTrace(false); applicationDefinition.setMatchingRuleExpression(stringMatchingExpression); applicationDefinition_empty.setMatchingRuleExpression(stringMatchingExpression_2); businessTxDefinition_1.setMatchingRuleExpression(stringMatchingExpression_2); businessTxDefinition_2.setMatchingRuleExpression(stringMatchingExpression); processor.process(root, entityManager); assertThat(root.getApplicationId(), equalTo(application.getId())); assertThat(root.getBusinessTransactionId(), equalTo(businessTx_2.getId())); }
@Test public void matchWithSearchInTrace() { StringMatchingExpression stringMatchingExpression = new StringMatchingExpression(PatternMatchingType.CONTAINS, "multiple"); stringMatchingExpression.setStringValueSource(stringValueSource); stringMatchingExpression.setSearchNodeInTrace(true); stringMatchingExpression.setMaxSearchDepth(2); StringMatchingExpression stringMatchingExpression_2 = new StringMatchingExpression(PatternMatchingType.CONTAINS, "nothing"); stringMatchingExpression_2.setStringValueSource(stringValueSource); stringMatchingExpression_2.setSearchNodeInTrace(false); applicationDefinition.setMatchingRuleExpression(stringMatchingExpression); applicationDefinition_empty.setMatchingRuleExpression(stringMatchingExpression_2); businessTxDefinition_1.setMatchingRuleExpression(stringMatchingExpression_2); businessTxDefinition_2.setMatchingRuleExpression(stringMatchingExpression); processor.process(root, entityManager); assertThat(root.getApplicationId(), equalTo(application.getId())); assertThat(root.getBusinessTransactionId(), equalTo(businessTx_2.getId())); }
/** * {@inheritDoc} */ @Override public boolean performFinish() { String name = newItemWizardPage.getName(); String description = newItemWizardPage.getDescription(); int insertBeforeIndex = newItemWizardPage.getInsertedBeforeIndex(); AbstractExpression matchingRuleExpression = new BooleanExpression(false); newBusinessTransaction = new BusinessTransactionDefinition(name); if (StringUtils.isNotBlank(description)) { newBusinessTransaction.setDescription(description); } newBusinessTransaction.setMatchingRuleExpression(matchingRuleExpression); try { application.addBusinessTransactionDefinition(newBusinessTransaction, insertBeforeIndex); } catch (BusinessException e) { InspectIT.getDefault().createErrorDialog( "Adding the business transaction definition '" + newBusinessTransaction.getBusinessTransactionDefinitionName() + "' failed due to the following exception.", e, -1); return false; } return true; }
@Test public void businessContextChanged() throws InterruptedException { StringMatchingExpression stringMatchingExpression = new StringMatchingExpression(PatternMatchingType.CONTAINS, "root"); stringMatchingExpression.setStringValueSource(stringValueSource); stringMatchingExpression.setSearchNodeInTrace(false); StringMatchingExpression stringMatchingExpression_2 = new StringMatchingExpression(PatternMatchingType.CONTAINS, "node"); stringMatchingExpression_2.setStringValueSource(stringValueSource); stringMatchingExpression_2.setSearchNodeInTrace(false); applicationDefinition.setMatchingRuleExpression(stringMatchingExpression); businessTxDefinition_1.setMatchingRuleExpression(stringMatchingExpression_2); processor.onApplicationEvent(event); assertThat(root.getApplicationId(), equalTo(application.getId())); assertThat(root.getBusinessTransactionId(), equalTo(businessTx_1.getId())); }