Skip to content

Commit

Permalink
ISSUE-1942 Jobs Service Embedded Addon do not allow to override the k…
Browse files Browse the repository at this point in the history
…ogito.service.url parameter (apache#1943)

* ISSUE-1942 Jobs Service Embedded Addon do not allow to override the kogito.service.url parameter
  • Loading branch information
tiagodolphine authored and rgdoliveira committed Jan 18, 2024
1 parent 0274f3d commit 84ec2f1
Show file tree
Hide file tree
Showing 12 changed files with 6 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
# under the License.
#

kogito.service.url=http://localhost:8080

# Disable the KSinkInjectionHealthCheck since the K_SINK env variable is not passed in this context.
quarkus.smallrye-health.check."org.kie.kogito.addons.quarkus.knative.eventing.KSinkInjectionHealthCheck".enabled=false

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
# under the License.
#

kogito.service.url=http://localhost:8080

quarkus.log.category."org.kie.kogito.jobs.management.quarkus".level=DEBUG

quarkus.kafka.devservices.enabled=false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
# under the License.
#

kogito.service.url=http://localhost:8080

quarkus.log.category."org.kie.kogito.jobs.messaging.quarkus".level=DEBUG

quarkus.kafka.devservices.enabled=false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ mp.openapi.filter=org.kie.kogito.jobs.service.openapi.JobServiceModelFilter
# Job Service
kogito.jobs-service.maxIntervalLimitToRetryMillis=60000
kogito.jobs-service.backoffRetryMillis=1000
kogito.service.url=http://localhost:8080
kogito.jobs-service.schedulerChunkInMinutes=10
kogito.jobs-service.loadJobIntervalInMinutes=10
kogito.jobs-service.loadJobFromCurrentTimeIntervalInMinutes=60
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

kogito.jobs-service.maxIntervalLimitToRetryMillis=60000
kogito.jobs-service.backoffRetryMillis=1000
kogito.service.url=http://localhost:8080
kogito.jobs-service.schedulerChunkInMinutes=10
kogito.jobs-service.loadJobIntervalInMinutes=10
kogito.jobs-service.loadJobFromCurrentTimeIntervalInMinutes=0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

kogito.jobs-service.maxIntervalLimitToRetryMillis=60000
kogito.jobs-service.backoffRetryMillis=1000
kogito.service.url=http://localhost:8080
kogito.jobs-service.schedulerChunkInMinutes=10
kogito.jobs-service.loadJobIntervalInMinutes=10
kogito.jobs-service.loadJobFromCurrentTimeIntervalInMinutes=0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

kogito.jobs-service.maxIntervalLimitToRetryMillis=60000
kogito.jobs-service.backoffRetryMillis=1000
kogito.service.url=http://localhost:8080
kogito.jobs-service.schedulerChunkInMinutes=10
kogito.jobs-service.loadJobIntervalInMinutes=10
kogito.jobs-service.loadJobFromCurrentTimeIntervalInMinutes=0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

kogito.jobs-service.maxIntervalLimitToRetryMillis=60000
kogito.jobs-service.backoffRetryMillis=1000
kogito.service.url=http://localhost:8080
kogito.jobs-service.schedulerChunkInMinutes=10
kogito.jobs-service.loadJobIntervalInMinutes=10
kogito.jobs-service.loadJobFromCurrentTimeIntervalInMinutes=0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

kogito.jobs-service.maxIntervalLimitToRetryMillis=60000
kogito.jobs-service.backoffRetryMillis=1000
kogito.service.url=http://localhost:8080
kogito.jobs-service.schedulerChunkInMinutes=10
kogito.jobs-service.loadJobIntervalInMinutes=10
kogito.jobs-service.loadJobFromCurrentTimeIntervalInMinutes=0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@

class KogitoAddonsQuarkusJobsServiceEmbeddedProcessor extends OneOfCapabilityKogitoAddOnProcessor {
private static final String FEATURE = "kogito-addons-quarkus-jobs-service-embedded";
private static final String JOBS_SERVICE_URL = "kogito.jobs-service.url";
private static final String SERVICE_URL = "kogito.service.url";
private static final String DATA_SOURCE_NAME = "jobs_service";
private static final String DATA_SOURCE_NAME_KEY = "datasource.name";

Expand All @@ -56,8 +54,6 @@ FeatureBuildItem feature() {

@BuildStep
void buildConfiguration(BuildProducer<SystemPropertyBuildItem> systemProperties) {
systemProperties.produce(new SystemPropertyBuildItem(SERVICE_URL, "http://${quarkus.http.host}:${quarkus.http.port}"));
systemProperties.produce(new SystemPropertyBuildItem(JOBS_SERVICE_URL, "${" + SERVICE_URL + "}"));
systemProperties.produce(new SystemPropertyBuildItem(DATA_SOURCE_NAME_KEY, DATA_SOURCE_NAME));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,7 @@
@ExtendWith(MockitoExtension.class)
class KogitoAddonsQuarkusJobsServiceEmbeddedProcessorTest {

private static final String JOBS_SERVICE_URL = "kogito.jobs-service.url";
private static final String SERVICE_URL = "kogito.service.url";

private KogitoAddonsQuarkusJobsServiceEmbeddedProcessor processor;

@Mock
private BuildProducer<SystemPropertyBuildItem> systemPropertyBuildItemBuildProducer;
@Captor
Expand Down Expand Up @@ -77,11 +73,10 @@ void feature() {
@Test
void buildConfiguration() {
processor.buildConfiguration(systemPropertyBuildItemBuildProducer);
verify(systemPropertyBuildItemBuildProducer, times(3)).produce(systemPropertyBuildItemCaptor.capture());
verify(systemPropertyBuildItemBuildProducer, times(1)).produce(systemPropertyBuildItemCaptor.capture());
List<SystemPropertyBuildItem> items = systemPropertyBuildItemCaptor.getAllValues();
assertThat(items)
.anyMatch(item -> JOBS_SERVICE_URL.equals(item.getKey()) && ("${" + SERVICE_URL + "}").equals(item.getValue()))
.anyMatch(item -> SERVICE_URL.equals(item.getKey()) && "http://${quarkus.http.host}:${quarkus.http.port}".equals(item.getValue()));
.anyMatch(item -> "datasource.name".equals(item.getKey()) && ("jobs_service").equals(item.getValue()));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,15 @@ public class KogitoAddonsQuarkusJobsServiceEmbeddedConfigSource implements Confi

private static final String KAFKA_DEV_SERVICES = "quarkus.kafka.devservices.enabled";
private static final String DATASOURCE_DEV_SERVICES = "quarkus.datasource.devservices.enabled";

private static final String JOBS_SERVICE_URL = "kogito.jobs-service.url";
private static final String SERVICE_URL = "kogito.service.url";
private static final Map<String, String> DEFAULT_CONFIG = new HashMap<>();

static {
DEFAULT_CONFIG.put(KAFKA_DEV_SERVICES, "false");
DEFAULT_CONFIG.put(DATASOURCE_DEV_SERVICES, "false");
DEFAULT_CONFIG.put(SERVICE_URL, "http://localhost:${quarkus.http.port}");
DEFAULT_CONFIG.put(JOBS_SERVICE_URL, "${" + SERVICE_URL + "}");
}

@Override
Expand Down

0 comments on commit 84ec2f1

Please sign in to comment.