Skip to content

Commit

Permalink
adding profile and feature toggle for spring web apis
Browse files Browse the repository at this point in the history
  • Loading branch information
tiagodolphine committed Nov 16, 2020
1 parent 9154162 commit f8894b9
Show file tree
Hide file tree
Showing 9 changed files with 128 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
package org.kie.kogito.conf;public class FeatureToggle {
}
31 changes: 30 additions & 1 deletion integration-tests/integration-tests-springboot/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<artifactId>kogito-springboot-starter</artifactId>
<version>${project.version}</version>
</dependency>

<!-- Force resolving dependencies in local Maven repo, needed for it tests -->
<dependency>
<groupId>org.infinispan</groupId>
Expand Down Expand Up @@ -121,5 +121,34 @@
</plugins>
</build>
</profile>
<profile>
<id>spring-web</id>
<activation>
<property>
<name>spring-web</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<artifactId>maven-invoker-plugin</artifactId>
<configuration>
<profiles>
<profile>spring-web</profile>
</profiles>
<properties>
<SPRING_WEB_API_ENABLED>true</SPRING_WEB_API_ENABLED>
<spring.mvc.servlet.path></spring.mvc.servlet.path>
</properties>
</configuration>
<executions>
<execution>
<id>integration-test</id>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -195,5 +195,46 @@
</testResources>
</build>
</profile>

<profile>
<id>spring-web</id>
<activation>
<property>
<name>spring-web</name>
</property>
</activation>
<dependencies>
<dependency>
<groupId>org.kie.kogito</groupId>
<artifactId>kogito-springboot-starter</artifactId>
<version>@project.version@</version>
<exclusions>
<exclusion>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-spring-boot-starter</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>@version.springboot@</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemProperties>
<SPRING_WEB_API_ENABLED>${SPRING_WEB_API_ENABLED}</SPRING_WEB_API_ENABLED>
<spring.mvc.servlet.path>${spring.mvc.servlet.path}</spring.mvc.servlet.path>
</systemProperties>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
server.address=0.0.0.0

#spring.mvc.servlet.path=/
spring.mvc.servlet.path=/docs

#resteasy.jaxrs.scan-packages=org.kie.kogito.**,http*
resteasy.jaxrs.scan-packages=org.kie.kogito.**,http*

# for these tests, we do NOT want stronglytyped to be enabled, leave it as default disabled.
# kogito.decisions.stronglytyped=false
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
server.address=0.0.0.0

#spring.mvc.servlet.path=/docs
spring.mvc.servlet.path=/docs

#resteasy.jaxrs.scan-packages=org.kie.kogito.**,http*
resteasy.jaxrs.scan-packages=org.kie.kogito.**,http*

# Used for persistence profile
infinispan.remote.sasl-mechanism=PLAIN
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.kie.kogito.testcontainers.springboot.InfinispanSpringBootTestResource;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.test.context.ContextConfiguration;
Expand All @@ -49,10 +50,13 @@ class OASTest extends BaseRestTest {
RestAssured.enableLoggingOfRequestAndResponseIfValidationFails();
}

@Value("${spring.mvc.servlet.path}")
private String path;

@Test
public void testOASdmnDefinitions() {
RestAssured.given()
.get("/dmnDefinitions.json")
.get(path + "/dmnDefinitions.json")
.then()
.statusCode(200)
.body("definitions", aMapWithSize(greaterThan(0)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
</parent>

<groupId>org.kie.kogito</groupId>
<artifactId>integration-tests-springboot-it</artifactId>
<artifactId>integration-tests-springboot-kakfa-it</artifactId>
<version>@project.version@</version>

<properties>
Expand Down Expand Up @@ -199,5 +199,46 @@
</testResources>
</build>
</profile>

<profile>
<id>spring-web</id>
<activation>
<property>
<name>spring-web</name>
</property>
</activation>
<dependencies>
<dependency>
<groupId>org.kie.kogito</groupId>
<artifactId>kogito-springboot-starter</artifactId>
<version>@project.version@</version>
<exclusions>
<exclusion>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-spring-boot-starter</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>@version.springboot@</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemProperties>
<SPRING_WEB_API_ENABLED>${SPRING_WEB_API_ENABLED}</SPRING_WEB_API_ENABLED>
<spring.mvc.servlet.path>${spring.mvc.servlet.path}</spring.mvc.servlet.path>
</systemProperties>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
server.address=0.0.0.0

#spring.mvc.servlet.path=/docs
spring.mvc.servlet.path=/docs

#resteasy.jaxrs.scan-packages=org.kie.kogito.**,http*
resteasy.jaxrs.scan-packages=org.kie.kogito.**,http*

spring.kafka.consumer.group-id=kogito-group
spring.kafka.consumer.key-deserializer=org.apache.kafka.common.serialization.StringDeserializer
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
server.address=0.0.0.0

#spring.mvc.servlet.path=/docs
spring.mvc.servlet.path=/docs

#resteasy.jaxrs.scan-packages=org.kie.kogito.**,http*
resteasy.jaxrs.scan-packages=org.kie.kogito.**,http*

# Used for persistence profile
infinispan.remote.sasl-mechanism=PLAIN
Expand Down

0 comments on commit f8894b9

Please sign in to comment.