I am creating integration tests for flowable 6.4 and the engine is deploying but I don’t have any processes or endpoints where the normal deployed application does.
@WebAppConfiguration
@AutoConfigureMockMvc
@ContextConfiguration(classes = IntegrationConfiguration.class)
@Profile("dev")
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
@ExtendWith(FlowableSpringExtension.class)
public class FlowableIntegrationSmokeTest{
@Autowired
private WebApplicationContext wac;
private MockMvc mockMvc;
@Autowired
RepositoryService repoService;
@Autowired
ProcessEngine processEngine;
@Autowired
RuntimeService runtimeService;
@Autowired
HistoryService historyService;
@BeforeEach
public void servicesSetUp() throws Exception {
MockitoAnnotations.initMocks(this);
}
@Test
void testA() throws Exception {
this.mockMvc = webAppContextSetup(this.wac).build();
System.out.println("Definitions names : "
+ repoService.createProcessDefinitionQuery().list().stream().map(ProcessDefinition::getKey).collect(Collectors.joining()));
List<ProcessDefinition> processDefinitions = processEngine.getRepositoryService().createProcessDefinitionQuery().listPage(0,5);
System.out.println("Process Definition List size: "+ processDefinitions.size());
for (ProcessDefinition processDefinition : processDefinitions) {
String deploymentId = processDefinition.getDeploymentId();
System.out.println("Deployment ID for definition: "+ deploymentId);
}
MvcResult result = mockMvc.perform(get("/engine/provisioning/new").contentType(ApiVersion.V1)
.accept(ApiVersion.V1)
.content("{}")).andExpect(status().isAccepted()).andReturn();
System.out.println(result.getResponse().getContentAsString());
}
@Test
void testB() {
historyService.createHistoricProcessInstanceQuery().list().forEach(s -> {
System.out.println(s.getId());
});
}
}
This is my test file the output of the printed lines are:
Definitions names :
Process Definition List size: 0
The context configuration IntegrationConfiguration looks like:
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
import org.springframework.context.annotation.PropertySource;
import org.springframework.context.annotation.PropertySources;
import org.springframework.stereotype.Component;
import com.pgi.flowable.autoconfiguration.FlowzillaAutoConfiguration;
import com.pgi.flowzilla.boot.FlowzillaApplication;
import com.pgi.flowzilla.config.UnitTestConfiguration;
/**
*
*/
@Component
public class IntegrationConfiguration {
@Profile("dev")
@Configuration
@PropertySources({ @PropertySource("classpath:application-dev.properties")})
static class DevConfiguration implements TestConfiguration {
}
@Profile("qab")
@Configuration
@PropertySources({ @PropertySource("classpath:application-dev.properties")})
static class QabConfiguration implements TestConfiguration {
}
@SpringBootApplication(scanBasePackages = "com.pgi.flowzilla", exclude = {FlowzillaAutoConfiguration.class })
static class TestApplication {
public static void main(String[] args) {
SpringApplication.run(FlowzillaApplication.class, args);
}
}
}
the application-dev.properties looks like:
spring.liquibase.enabled=false
server.servlet.context-path=/engine