Skip to content

Commit

Permalink
Fix build and tests
Browse files Browse the repository at this point in the history
Signed-off-by: Aleksandar Stanchev <[email protected]>
  • Loading branch information
alstanchev committed Aug 26, 2024
1 parent a2ae10c commit 1c45ffc
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 47 deletions.
4 changes: 0 additions & 4 deletions thingsearch/service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,6 @@
<scope>test</scope>
<type>test-jar</type>
</dependency>
<dependency>
<groupId>org.eclipse.ditto</groupId>
<artifactId>ditto-edge-service</artifactId>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,37 +183,31 @@ private boolean isPlaceHolder(final String value) {

@Override
public boolean equals(final Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
final DefaultCustomSearchMetricConfig that = (DefaultCustomSearchMetricConfig) o;
return enabled == that.enabled &&
Objects.equals(metricName, that.metricName) &&
return enabled == that.enabled && Objects.equals(metricName, that.metricName) &&
Objects.equals(scrapeInterval, that.scrapeInterval) &&
Objects.equals(namespaces, that.namespaces) &&
Objects.equals(tags, that.tags) &&
Objects.equals(filterConfigs, that.filterConfigs);
Objects.equals(namespaces, that.namespaces) && Objects.equals(groupBy, that.groupBy) &&
Objects.equals(tags, that.tags) && Objects.equals(filterConfigs, that.filterConfigs);
}

@Override
public int hashCode() {
return Objects.hash(metricName, enabled, scrapeInterval, namespaces, tags, filterConfigs);
return Objects.hash(metricName, enabled, scrapeInterval, namespaces, groupBy, tags, filterConfigs);
}

@Override
public String toString() {
return getClass().getSimpleName() + " [" +
"customMetricName=" + metricName +
return "DefaultCustomSearchMetricConfig{" +
"metricName='" + metricName + '\'' +
", enabled=" + enabled +
", scrapeInterval=" + scrapeInterval +
", namespaces=" + namespaces +
", groupBy=" + groupBy +
", tags=" + tags +
", filterConfig=" + filterConfigs +
"]";
", filterConfigs=" + filterConfigs +
'}';
}

@Immutable
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017 Contributors to the Eclipse Foundation
* Copyright (c) 2024 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017 Contributors to the Eclipse Foundation
* Copyright (c) 2024 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
Expand Down
4 changes: 2 additions & 2 deletions thingsearch/service/src/main/resources/search-dev.conf
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ ditto {
}
filters = {
online_filter = {
filter = "and(gt(features/ConnectionStatus/properties/status/readyUntil/,time:now),in(features/coffee-brewer/properties/brewed-coffees,0,1,2))"
filter = "gt(features/ConnectionStatus/properties/status/readyUntil/,time:now)"
inline-placeholder-values = {
"online_placeholder" = true
"health" = "good"
}
}
offline_filter = {
filter = "and(lt(features/ConnectionStatus/properties/status/readyUntil/,time:now),ilike(policyId,'*Eclipse*'))"
filter = "lt(features/ConnectionStatus/properties/status/readyUntil/,time:now)"
inline-placeholder-values = {
"online_placeholder" = false
"health" = "bad"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,10 @@ public void gettersReturnConfiguredValues() {
.hasSize(2);
softly.assertThat(underTest.getFilterConfigs().get(0).getFilterName())
.as("filter name")
.isEqualTo("online-filter");
.isEqualTo("online_filter");
softly.assertThat(underTest.getFilterConfigs().get(1).getFilterName())
.as("filter name")
.isEqualTo("offline-filter");
.isEqualTo("offline_filter");
softly.assertThat(underTest.getTags())
.as("tags")
.containsExactlyInAnyOrderEntriesOf(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import org.eclipse.ditto.base.model.namespaces.signals.commands.PurgeNamespace;
import org.eclipse.ditto.base.model.signals.commands.streaming.SubscribeForPersistedEvents;
import org.eclipse.ditto.base.service.cluster.ModifySplitBrainResolver;
import org.eclipse.ditto.connectivity.api.commands.sudo.SudoRetrieveConnectionTags;
import org.eclipse.ditto.connectivity.model.signals.commands.modify.ModifyConnection;
import org.eclipse.ditto.connectivity.model.signals.commands.query.RetrieveConnection;
import org.eclipse.ditto.internal.models.streaming.SudoStreamPids;
Expand Down Expand Up @@ -63,8 +62,7 @@ public ThingsSearchServiceGlobalCommandRegistryTest() {
ModifyConnection.class,
ModifySplitBrainResolver.class,
RetrieveConnection.class,
SubscribeForPersistedEvents.class,
SudoRetrieveConnectionTags.class
SubscribeForPersistedEvents.class
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
import org.eclipse.ditto.base.model.namespaces.signals.commands.PurgeNamespaceResponse;
import org.eclipse.ditto.base.model.signals.acks.Acknowledgement;
import org.eclipse.ditto.base.service.cluster.ModifySplitBrainResolverResponse;
import org.eclipse.ditto.connectivity.api.commands.sudo.ConnectivitySudoQueryCommandResponse;
import org.eclipse.ditto.connectivity.api.commands.sudo.SudoRetrieveConnectionTagsResponse;
import org.eclipse.ditto.connectivity.model.signals.commands.ConnectivityErrorResponse;
import org.eclipse.ditto.connectivity.model.signals.commands.modify.ModifyConnectionResponse;
import org.eclipse.ditto.connectivity.model.signals.commands.query.RetrieveConnectionResponse;
Expand Down Expand Up @@ -68,8 +66,7 @@ public ThingsSearchServiceGlobalCommandResponseRegistryTest() {
ModifyConnectionResponse.class,
RetrieveConnectionResponse.class,
ModifySplitBrainResolverResponse.class,
ConnectivityErrorResponse.class,
SudoRetrieveConnectionTagsResponse.class
ConnectivityErrorResponse.class
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,36 +37,34 @@ ditto {
custom-metrics {
}
custom-search-metrics {
online-status {
online_status {
enabled = true
scrape-interval = 20m # override scrape interval, run every 20 minute
scrape-interval = 1m # override scrape interval, run every 20 minute
namespaces = [
"org.eclipse.ditto.test.1"
"org.eclipse.ditto.test.2"
]
group-by:{
"location" = "features/Location/properties/location"
"altitude" = "features/Location/properties/altitude"
"location" = "attributes/Info/location"
"isGateway" = "attributes/Info/gateway"
}
tags: {
"online" = "{{online_placeholder}}"
"health" = "{{health}}"
"online" = "{{ inline:online_placeholder }}"
"health" = "{{ inline:health }}"
"hardcoded-tag" = "value"
"location" = "{{location}}"
"altitude" = "{{altitude}}"
"location" = "{{ group-by:location | fn:default('missing location') }}"
"altitude" = "{{ group-by:isGateway }}"
}
filters = {
online-filter = {
filter = "gt(features/ConnectionStatus/properties/status/readyUntil/,{{ time:now }})"
online_filter = {
filter = "gt(features/ConnectionStatus/properties/status/readyUntil/,time:now)"
inline-placeholder-values = {
// inline-placeholder-values are used to define hardcoded values to be used in the tags values if the placeholders are not json paths to an actual field in the thing
// this is used to define different tags values based on the filter that matched the thing
"online_placeholder" = true
"health" = "good"
}
}
offline-filter = {
filter = "lt(features/ConnectionStatus/properties/status/readyUntil/,{{ time:now }})"
offline_filter = {
filter = "lt(features/ConnectionStatus/properties/status/readyUntil/,time:now)"
inline-placeholder-values = {
"online_placeholder" = false
"health" = "bad"
Expand Down

0 comments on commit 1c45ffc

Please sign in to comment.