Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/delegate expression name extract #1065

Merged
merged 2 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.camunda.community.migration.converter.visitor;

import java.util.Set;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.camunda.community.migration.converter.DomElementVisitorContext;
Expand All @@ -10,6 +11,7 @@

public abstract class AbstractDelegateImplementationVisitor
extends AbstractSupportedAttributeVisitor {
public static final Pattern DELEGATE_NAME_EXTRACT = Pattern.compile("\\$\\{(.*)\\}");
private static final Set<String> IGNORE =
Stream.of("taskListener", "executionListener", "errorEventDefinition")
.collect(Collectors.toSet());
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package org.camunda.community.migration.converter;

import static org.assertj.core.api.Assertions.*;
import static org.camunda.community.migration.converter.visitor.AbstractDelegateImplementationVisitor.*;

import java.util.regex.Matcher;
import org.junit.jupiter.api.Test;

public class DelegateImplementationVisitorTest {
@Test
void shouldReturnDelegateName() {
String delegateExpression = "${someReallyCoolDelegate}";
Matcher matcher = DELEGATE_NAME_EXTRACT.matcher(delegateExpression);
String delegateName = matcher.find() ? matcher.group(1) : null;
assertThat(delegateName).isNotNull().isEqualTo("someReallyCoolDelegate");
}
}
Loading