-
Notifications
You must be signed in to change notification settings - Fork 209
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
Disable generator if an engine is not available at runtime #1507
Closed
Closed
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
db51220
Implement Generator.isEmpty() to skip generation when no resources ar…
danielezonca 9c05dc8
Fix test
danielezonca 2199e2a
Proper runtime check for disabling a generator
danielezonca b27c255
Merge remote-tracking branch 'upstream/main' into runtime-check
danielezonca 08ffd2d
Apply suggestions from code review
danielezonca 9bb5dbe
Merge remote-tracking branch 'upstream/main' into runtime-check
danielezonca 87157e2
Added integration test
danielezonca File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
drools/kogito-dmn/src/main/java/org/kie/kogito/dmn/KogitoDecisions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
* Copyright 2021 Red Hat, Inc. and/or its affiliates. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.kie.kogito.dmn; | ||
|
||
/** | ||
* Marker interface used to check DMN engine availability | ||
*/ | ||
public interface KogitoDecisions { | ||
} |
22 changes: 22 additions & 0 deletions
22
drools/kogito-drools/src/main/java/org/kie/kogito/KogitoDrools.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
* Copyright 2021 Red Hat, Inc. and/or its affiliates. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.kie.kogito; | ||
|
||
/** | ||
* Marker interface used to check Drools engine availability | ||
*/ | ||
public interface KogitoDrools { | ||
} |
22 changes: 22 additions & 0 deletions
22
drools/kogito-pmml/src/main/java/org/kie/kogito/pmml/KogitoPredictions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
* Copyright 2021 Red Hat, Inc. and/or its affiliates. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.kie.kogito.pmml; | ||
|
||
/** | ||
* Marker interface used to check PMML engine availability | ||
*/ | ||
public interface KogitoPredictions { | ||
} |
19 changes: 19 additions & 0 deletions
19
...ion-tests-springboot/src/it/integration-tests-springboot-noruntimes-it/invoker.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# | ||
# Copyright 2021 Red Hat, Inc. and/or its affiliates. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
# | ||
|
||
# disable verbose local download output | ||
invoker.mavenOpts=-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn |
132 changes: 132 additions & 0 deletions
132
...ts/integration-tests-springboot/src/it/integration-tests-springboot-noruntimes-it/pom.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>org.kie.kogito</groupId> | ||
<artifactId>integration-tests-springboot-norest-it</artifactId> | ||
<version>@project.version@</version> | ||
|
||
<dependencyManagement> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.kie.kogito</groupId> | ||
<artifactId>kogito-springboot-bom</artifactId> | ||
<version>${project.version}</version> | ||
<type>pom</type> | ||
<scope>import</scope> | ||
</dependency> | ||
</dependencies> | ||
</dependencyManagement> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter</artifactId> | ||
</dependency> | ||
|
||
<!-- No runtime dependencies provided --> | ||
<!-- <dependency>--> | ||
<!-- <groupId>org.kie.kogito</groupId>--> | ||
<!-- <artifactId>kogito-spring-boot-starter</artifactId>--> | ||
<!-- </dependency>--> | ||
|
||
<!-- this dependency is necessary to compile --> | ||
<dependency> | ||
<groupId>org.kie.kogito</groupId> | ||
<artifactId>kogito-api</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-test</artifactId> | ||
<scope>test</scope> | ||
<exclusions> | ||
<exclusion> | ||
<groupId>org.junit.vintage</groupId> | ||
<artifactId>junit-vintage-engine</artifactId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.junit.jupiter</groupId> | ||
<artifactId>junit-jupiter-engine</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>io.rest-assured</groupId> | ||
<artifactId>json-schema-validator</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>io.rest-assured</groupId> | ||
<artifactId>rest-assured</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.springdoc</groupId> | ||
<artifactId>springdoc-openapi-ui</artifactId> | ||
<version>@version.org.springdoc@</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.swagger.parser.v3</groupId> | ||
<artifactId>swagger-parser</artifactId> | ||
<version>@version.io.swagger.parser.v3@</version> | ||
<scope>test</scope> | ||
<exclusions> | ||
<exclusion> | ||
<groupId>io.swagger.parser.v3</groupId> | ||
<artifactId>swagger-parser-v2-converter</artifactId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency> | ||
|
||
</dependencies> | ||
|
||
<build> | ||
<finalName>${project.artifactId}</finalName> | ||
<plugins> | ||
<plugin> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>@version.compiler.plugin@</version> | ||
<configuration> | ||
<release>@maven.compiler.release@</release> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.kie.kogito</groupId> | ||
<artifactId>kogito-maven-plugin</artifactId> | ||
<version>${project.version}</version> <!-- Needed, otherwise it would use the latest release found on Maven central --> | ||
<extensions>true</extensions> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-maven-plugin</artifactId> | ||
<version>@version.org.springframework.boot@</version> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>repackage</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-surefire-plugin</artifactId> | ||
<version>@version.surefire.plugin@</version> | ||
<configuration> | ||
<includes> | ||
<include>org/kie/kogito/integrationtests/springboot/*</include> | ||
</includes> | ||
<systemPropertyVariables combine.children="append"> | ||
<container.image.kafka>@container.image.kafka@</container.image.kafka> | ||
</systemPropertyVariables> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
27 changes: 27 additions & 0 deletions
27
...boot-noruntimes-it/src/main/java/org/kie/kogito/examples/KogitoSpringbootApplication.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
* Copyright 2021 Red Hat, Inc. and/or its affiliates. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.kie.kogito.examples; | ||
|
||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
|
||
@SpringBootApplication(scanBasePackages={"org.kie.dmn.kogito.**", "org.kie.kogito.**", "http*.**"}) | ||
public class KogitoSpringbootApplication { | ||
|
||
public static void main(String[] args) { | ||
SpringApplication.run(KogitoSpringbootApplication.class, args); | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
.../src/it/integration-tests-springboot-noruntimes-it/src/main/resources/PMMLRegression.pmml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<PMML version="4.2" xsi:schemaLocation="http://www.dmg.org/PMML-4_2 http://www.dmg.org/v4-2-1/pmml-4-2.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.dmg.org/PMML-4_2"> | ||
<Header copyright="JBoss"/> | ||
<DataDictionary numberOfFields="5"> | ||
<DataField dataType="double" name="fld1" optype="continuous"/> | ||
<DataField dataType="double" name="fld2" optype="continuous"/> | ||
<DataField dataType="string" name="fld3" optype="categorical"> | ||
<Value value="x"/> | ||
<Value value="y"/> | ||
</DataField> | ||
<DataField dataType="double" name="fld4" optype="continuous"/> | ||
<DataField dataType="double" name="fld5" optype="continuous"/> | ||
</DataDictionary> | ||
<RegressionModel algorithmName="linearRegression" functionName="regression" modelName="LinReg" targetFieldName="fld4"> | ||
<MiningSchema> | ||
<MiningField name="fld1"/> | ||
<MiningField name="fld2"/> | ||
<MiningField name="fld3"/> | ||
<MiningField name="fld4" usageType="predicted"/> | ||
</MiningSchema> | ||
<Output> | ||
<OutputField name="result" targetField="fld4" /> | ||
</Output> | ||
<RegressionTable intercept="0.5"> | ||
<NumericPredictor coefficient="5" exponent="2" name="fld1"/> | ||
<NumericPredictor coefficient="2" exponent="1" name="fld2"/> | ||
<CategoricalPredictor coefficient="-3" name="fld3" value="x"/> | ||
<CategoricalPredictor coefficient="3" name="fld3" value="y"/> | ||
</RegressionTable> | ||
</RegressionModel> | ||
</PMML> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this is commented on purpose?