Skip to content

Commit

Permalink
fix: unify naming
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Laprun <claprun@redhat.com>
  • Loading branch information
metacosm committed Jan 25, 2025
1 parent 1280bf7 commit 4be1a89
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class InformerConfiguration<R extends HasMetadata> {
private final String resourceTypeName;
private String name;
private Set<String> namespaces;
private Boolean followsControllerNamespaceChanges;
private Boolean followControllerNamespaceChanges;
private String labelSelector;
private OnAddFilter<? super R> onAddFilter;
private OnUpdateFilter<? super R> onUpdateFilter;
Expand All @@ -39,14 +39,14 @@ public class InformerConfiguration<R extends HasMetadata> {
private Long informerListLimit;

protected InformerConfiguration(Class<R> resourceClass, String name, Set<String> namespaces,
boolean followControllerNamespacesOnChange,
boolean followControllerNamespaceChanges,
String labelSelector, OnAddFilter<? super R> onAddFilter,
OnUpdateFilter<? super R> onUpdateFilter, OnDeleteFilter<? super R> onDeleteFilter,
GenericFilter<? super R> genericFilter, ItemStore<R> itemStore, Long informerListLimit) {
this(resourceClass);
this.name = name;
this.namespaces = namespaces;
this.followsControllerNamespaceChanges = followControllerNamespacesOnChange;
this.followControllerNamespaceChanges = followControllerNamespaceChanges;
this.labelSelector = labelSelector;
this.onAddFilter = onAddFilter;
this.onUpdateFilter = onUpdateFilter;
Expand Down Expand Up @@ -75,7 +75,7 @@ public static <R extends HasMetadata> InformerConfiguration<R>.Builder builder(
public static <R extends HasMetadata> InformerConfiguration<R>.Builder builder(
InformerConfiguration<R> original) {
return new InformerConfiguration(original.resourceClass, original.name, original.namespaces,
original.followsControllerNamespaceChanges, original.labelSelector, original.onAddFilter,
original.followControllerNamespaceChanges, original.labelSelector, original.onAddFilter,
original.onUpdateFilter, original.onDeleteFilter, original.genericFilter,
original.itemStore, original.informerListLimit).builder;
}
Expand Down Expand Up @@ -184,8 +184,8 @@ public Set<String> getEffectiveNamespaces(ControllerConfiguration<?> controllerC
*
* @return if namespace changes should be followed
*/
public boolean getFollowsControllerNamespaceChanges() {
return followsControllerNamespaceChanges;
public boolean getFollowControllerNamespaceChanges() {
return followControllerNamespaceChanges;
}

/**
Expand Down Expand Up @@ -258,7 +258,7 @@ public InformerConfiguration<R> buildForController() {
namespaces = Constants.DEFAULT_NAMESPACES_SET;
}
// to avoid potential NPE
followsControllerNamespaceChanges = false;
followControllerNamespaceChanges = false;
return InformerConfiguration.this;
}

Expand All @@ -267,8 +267,8 @@ public InformerConfiguration<R> build() {
if (namespaces == null || namespaces.isEmpty()) {
namespaces = Constants.SAME_AS_CONTROLLER_NAMESPACES_SET;
}
if (followsControllerNamespaceChanges == null) {
followsControllerNamespaceChanges =
if (followControllerNamespaceChanges == null) {
followControllerNamespaceChanges =
DEFAULT_FOLLOW_CONTROLLER_NAMESPACE_CHANGES;
}
return InformerConfiguration.this;
Expand Down Expand Up @@ -373,7 +373,7 @@ public Builder withWatchCurrentNamespace() {
* @return the builder instance so that calls can be chained fluently
*/
public Builder withFollowControllerNamespacesChanges(boolean followChanges) {
InformerConfiguration.this.followsControllerNamespaceChanges =
InformerConfiguration.this.followControllerNamespaceChanges =
followChanges;
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ static Builder<GenericKubernetesResource> from(
* @return if namespace changes should be followed
*/
default boolean followControllerNamespaceChanges() {
return getInformerConfig().getFollowsControllerNamespaceChanges();
return getInformerConfig().getFollowControllerNamespaceChanges();
}

/**
Expand Down Expand Up @@ -195,7 +195,7 @@ public void updateFrom(InformerConfiguration<R> informerConfig) {
}
config.withNamespaces(informerConfig.getNamespaces())
.withFollowControllerNamespacesChanges(
informerConfig.getFollowsControllerNamespaceChanges())
informerConfig.getFollowControllerNamespaceChanges())
.withLabelSelector(informerConfig.getLabelSelector())
.withItemStore(informerConfig.getItemStore())
.withOnAddFilter(informerConfig.getOnAddFilter())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ void shouldWatchAllNamespacesByDefaultForControllers() {
@Test
void shouldFollowControllerNamespacesByDefaultForInformerEventSource() {
final var informerConfig = InformerConfiguration.builder(ConfigMap.class).build();
assertTrue(informerConfig.getFollowsControllerNamespaceChanges());
assertTrue(informerConfig.getFollowControllerNamespaceChanges());
}

@Test
Expand Down

0 comments on commit 4be1a89

Please sign in to comment.