Build optimization 1.08.2017 (#2351)

* Refactor Spring-activiti module

* Refactor vavr module
This commit is contained in:
Grzegorz Piwowarek 2017-08-01 17:00:03 +02:00 committed by GitHub
parent 0c60af8437
commit ed92182fbf
14 changed files with 189 additions and 142 deletions

View File

@ -28,7 +28,6 @@
</properties> </properties>
<modules> <modules>
<module>spring-activiti</module>
<module>aws</module> <module>aws</module>
<module>akka-streams</module> <module>akka-streams</module>
<module>algorithms</module> <module>algorithms</module>
@ -129,6 +128,7 @@
<module>spark-java</module> <module>spark-java</module>
<!-- <module>spring-5</module>--> <!-- <module>spring-5</module>-->
<module>spring-5-mvc</module> <module>spring-5-mvc</module>
<module>spring-activiti</module>
<module>spring-akka</module> <module>spring-akka</module>
<module>spring-amqp</module> <module>spring-amqp</module>
<module>spring-all</module> <module>spring-all</module>

View File

@ -53,6 +53,23 @@
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId> <artifactId>spring-boot-maven-plugin</artifactId>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
<configuration>
<forkCount>3</forkCount>
<reuseForks>true</reuseForks>
<excludes>
<exclude>**/*IntegrationTest.java</exclude>
<exclude>**/*LongRunningUnitTest.java</exclude>
<exclude>**/*ManualTest.java</exclude>
<exclude>**/JdbcTest.java</exclude>
<exclude>**/*LiveTest.java</exclude>
</excludes>
<testFailureIgnore>true</testFailureIgnore>
</configuration>
</plugin>
</plugins> </plugins>
</build> </build>

View File

@ -1,9 +1,5 @@
package com.example.activitiwithspring; package com.example.activitiwithspring;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import org.activiti.engine.RuntimeService; import org.activiti.engine.RuntimeService;
import org.activiti.engine.TaskService; import org.activiti.engine.TaskService;
import org.activiti.engine.task.Task; import org.activiti.engine.task.Task;
@ -12,12 +8,15 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.stream.Collectors;
@RestController @RestController
public class ActivitiController { public class ActivitiController {
private static final Logger logger = LoggerFactory.getLogger(ActivitiController.class); private static final Logger logger = LoggerFactory.getLogger(ActivitiController.class);
@Autowired @Autowired
private RuntimeService runtimeService; private RuntimeService runtimeService;
@ -37,11 +36,9 @@ public class ActivitiController {
.processInstanceId(processInstanceId) .processInstanceId(processInstanceId)
.list(); .list();
List<TaskRepresentation> tasks = usertasks.stream().map(task -> { return usertasks.stream()
TaskRepresentation taskRepresentation = new TaskRepresentation(task.getId(), task.getName(), task.getProcessInstanceId()); .map(task -> new TaskRepresentation(task.getId(), task.getName(), task.getProcessInstanceId()))
return taskRepresentation; .collect(Collectors.toList());
}).collect(Collectors.toList());
return tasks;
} }
@GetMapping("/complete-task-A/{processInstanceId}") @GetMapping("/complete-task-A/{processInstanceId}")

View File

@ -5,7 +5,6 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication @SpringBootApplication
public class ActivitiWithSpringApplication { public class ActivitiWithSpringApplication {
public static void main(String[] args) { public static void main(String[] args) {
SpringApplication.run(ActivitiWithSpringApplication.class, args); SpringApplication.run(ActivitiWithSpringApplication.class, args);
} }

View File

@ -1,10 +1,6 @@
package com.example.activitiwithspring; package com.example.activitiwithspring;
import static org.junit.Assert.assertEquals; import com.fasterxml.jackson.databind.ObjectMapper;
import java.util.Arrays;
import java.util.List;
import org.activiti.engine.RuntimeService; import org.activiti.engine.RuntimeService;
import org.activiti.engine.runtime.ProcessInstance; import org.activiti.engine.runtime.ProcessInstance;
import org.junit.Before; import org.junit.Before;
@ -21,13 +17,16 @@ import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
import org.springframework.test.web.servlet.setup.MockMvcBuilders; import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.web.context.WebApplicationContext; import org.springframework.web.context.WebApplicationContext;
import com.fasterxml.jackson.databind.ObjectMapper; import java.util.Arrays;
import java.util.List;
import static org.junit.Assert.assertEquals;
@RunWith(SpringJUnit4ClassRunner.class) @RunWith(SpringJUnit4ClassRunner.class)
@WebAppConfiguration @WebAppConfiguration
@SpringBootTest @SpringBootTest
public class ActivitiControllerTest { public class ActivitiControllerIntegrationTest {
private static final Logger logger = LoggerFactory.getLogger(ActivitiControllerTest.class); private static final Logger logger = LoggerFactory.getLogger(ActivitiControllerIntegrationTest.class);
private MockMvc mockMvc; private MockMvc mockMvc;
@Autowired @Autowired

View File

@ -7,7 +7,7 @@ import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@SpringBootTest @SpringBootTest
public class ActivitiWithSpringApplicationTests { public class ActivitiWithSpringApplicationIntegrationTest {
@Test @Test
public void contextLoads() { public void contextLoads() {

View File

@ -71,4 +71,26 @@
<junit.version>4.12</junit.version> <junit.version>4.12</junit.version>
</properties> </properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
<configuration>
<forkCount>3</forkCount>
<reuseForks>true</reuseForks>
<excludes>
<exclude>**/*IntegrationTest.java</exclude>
<exclude>**/*LongRunningUnitTest.java</exclude>
<exclude>**/*ManualTest.java</exclude>
<exclude>**/JdbcTest.java</exclude>
<exclude>**/*LiveTest.java</exclude>
</excludes>
<testFailureIgnore>true</testFailureIgnore>
</configuration>
</plugin>
</plugins>
</build>
</project> </project>

View File

@ -1,18 +1,24 @@
package com.baeldung.vavr; package com.baeldung.vavr;
import io.vavr.MatchError;
import io.vavr.control.Option;
import org.junit.Test;
import static io.vavr.API.$; import static io.vavr.API.$;
import static io.vavr.API.Case; import static io.vavr.API.Case;
import static io.vavr.API.Match; import static io.vavr.API.Match;
import static io.vavr.API.run; import static io.vavr.API.run;
import static io.vavr.Predicates.*; import static io.vavr.Predicates.allOf;
import static io.vavr.Predicates.anyOf;
import static io.vavr.Predicates.instanceOf;
import static io.vavr.Predicates.is;
import static io.vavr.Predicates.isIn;
import static io.vavr.Predicates.isNotNull;
import static io.vavr.Predicates.isNull;
import static io.vavr.Predicates.noneOf;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import org.junit.Test;
import io.vavr.MatchError;
import io.vavr.control.Option;
public class PatternMatchingUnitTest { public class PatternMatchingUnitTest {
@Test @Test
public void whenMatchesDefault_thenCorrect() { public void whenMatchesDefault_thenCorrect() {

View File

@ -9,7 +9,9 @@ import org.junit.Test;
import java.util.function.Predicate; import java.util.function.Predicate;
import static io.vavr.API.*; import static io.vavr.API.$;
import static io.vavr.API.Case;
import static io.vavr.API.Match;
public class PropertyBasedLongRunningUnitTest { public class PropertyBasedLongRunningUnitTest {

View File

@ -5,7 +5,9 @@ import io.vavr.Function1;
import io.vavr.Function2; import io.vavr.Function2;
import io.vavr.Function5; import io.vavr.Function5;
import io.vavr.Lazy; import io.vavr.Lazy;
import io.vavr.*; import io.vavr.Tuple;
import io.vavr.Tuple2;
import io.vavr.Tuple3;
import io.vavr.collection.List; import io.vavr.collection.List;
import io.vavr.collection.Seq; import io.vavr.collection.Seq;
import io.vavr.control.Option; import io.vavr.control.Option;
@ -13,17 +15,19 @@ import io.vavr.control.Try;
import io.vavr.control.Validation; import io.vavr.control.Validation;
import org.junit.Test; import org.junit.Test;
import com.baeldung.vavr.Person;
import com.baeldung.vavr.PersonValidator;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.function.BiFunction; import java.util.function.BiFunction;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.IntStream; import java.util.stream.IntStream;
import static io.vavr.API.*; import static io.vavr.API.$;
import static org.junit.Assert.*; import static io.vavr.API.Case;
import static io.vavr.API.Match;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
public class VavrUnitTest { public class VavrUnitTest {
@Test @Test

View File

@ -1,17 +1,5 @@
package com.baeldung.vavr.collections; package com.baeldung.vavr.collections;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotSame;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import java.util.Comparator;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import org.junit.Test;
import io.vavr.Tuple; import io.vavr.Tuple;
import io.vavr.Tuple2; import io.vavr.Tuple2;
import io.vavr.collection.Array; import io.vavr.collection.Array;
@ -28,6 +16,17 @@ import io.vavr.collection.Stream;
import io.vavr.collection.TreeMap; import io.vavr.collection.TreeMap;
import io.vavr.collection.TreeSet; import io.vavr.collection.TreeSet;
import io.vavr.collection.Vector; import io.vavr.collection.Vector;
import org.junit.Test;
import java.util.Comparator;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotSame;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
public class CollectionAPIUnitTest { public class CollectionAPIUnitTest {

View File

@ -3,16 +3,18 @@ package com.baeldung.vavr.exception.handling;
import com.baeldung.vavr.exception.handling.client.ClientException; import com.baeldung.vavr.exception.handling.client.ClientException;
import com.baeldung.vavr.exception.handling.client.HttpClient; import com.baeldung.vavr.exception.handling.client.HttpClient;
import com.baeldung.vavr.exception.handling.client.Response; import com.baeldung.vavr.exception.handling.client.Response;
import com.baeldung.vavr.exception.handling.VavrTry;
import io.vavr.collection.Stream; import io.vavr.collection.Stream;
import io.vavr.control.Option; import io.vavr.control.Option;
import io.vavr.control.Try; import io.vavr.control.Try;
import org.junit.Test; import org.junit.Test;
import static io.vavr.API.*; import static io.vavr.API.$;
import static io.vavr.API.Case;
import static io.vavr.API.Match;
import static io.vavr.Predicates.instanceOf; import static io.vavr.Predicates.instanceOf;
import static org.junit.Assert.*; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertTrue;
public class VavrTryUnitTest { public class VavrTryUnitTest {

View File

@ -3,18 +3,18 @@ package com.baeldung.vavr.repositories;
import com.baeldung.Application; import com.baeldung.Application;
import com.baeldung.repositories.VavrUserRepository; import com.baeldung.repositories.VavrUserRepository;
import com.baeldung.vavr.User; import com.baeldung.vavr.User;
import io.vavr.collection.Seq; import io.vavr.collection.Seq;
import io.vavr.control.Option; import io.vavr.control.Option;
import org.junit.Test;
import org.junit.Before; import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.context.junit4.SpringRunner;
import static org.junit.Assert.*; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@SpringBootTest(classes = Application.class) @SpringBootTest(classes = Application.class)