Skip to content

Commit

Permalink
merge: #9028
Browse files Browse the repository at this point in the history
9028: [Backport release-8.0.0] Do not generate ImmutableProcessInstanceRelated r=npepinpe a=github-actions[bot]

# Description
Backport of #9014 to `release-8.0.0`.

relates to 

Co-authored-by: Nicolas Pepin-Perreault <[email protected]>
  • Loading branch information
zeebe-bors-camunda[bot] and npepinpe authored Mar 30, 2022
2 parents d60f1f7 + a5db015 commit bddd216
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@
*/
package io.camunda.zeebe.protocol.record.value;

import io.camunda.zeebe.protocol.record.ImmutableProtocol;
import org.immutables.value.Value;

@Value.Immutable
@ImmutableProtocol
public interface ProcessInstanceRelated {

/** @return the key of the corresponding process instance */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,6 @@ final class ImmutableProtocolTest {
@ArchTest
void shouldAnnotateImmutableProtocolValues(final JavaClasses importedClasses) {
// given
// exclude certain interfaces for which we won't be generating any immutable variants
final DescribedPredicate<JavaClass> excludedClasses =
Predicates.equivalentTo(ProcessInstanceRelated.class);
final ArchRule rule =
ArchRuleDefinition.classes()
.that()
Expand All @@ -59,7 +56,7 @@ void shouldAnnotateImmutableProtocolValues(final JavaClasses importedClasses) {
// also check the Record interface itself
.or(Predicates.equivalentTo(Record.class))
// exclude certain interfaces
.and(DescribedPredicate.not(excludedClasses))
.and(DescribedPredicate.not(getExcludedClasses()))
.should()
.beAnnotatedWith(ImmutableProtocol.class)
.andShould()
Expand All @@ -68,4 +65,24 @@ void shouldAnnotateImmutableProtocolValues(final JavaClasses importedClasses) {
// then
rule.check(importedClasses);
}

@ArchTest
void shouldNotAnnotateExcludedClasses(final JavaClasses importedClasses) {
// given
final ArchRule rule =
ArchRuleDefinition.classes()
.that(getExcludedClasses())
.should()
.notBeAnnotatedWith(ImmutableProtocol.class)
.orShould()
.notBeAnnotatedWith(Value.Immutable.class);

// then
rule.check(importedClasses);
}

// exclude certain interfaces for which we won't be generating any immutable variants
private DescribedPredicate<JavaClass> getExcludedClasses() {
return Predicates.equivalentTo(ProcessInstanceRelated.class);
}
}

0 comments on commit bddd216

Please sign in to comment.