TSK-850: reconfigured taskana-spring-example
This commit is contained in:
parent
12bf92384e
commit
407f4db3e5
|
@ -1,50 +1,40 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>pro.taskana</groupId>
|
||||
<artifactId>taskana-spring-example</artifactId>
|
||||
<version>1.1.3-SNAPSHOT</version>
|
||||
|
||||
<name>${project.groupId}:${project.artifactId}</name>
|
||||
<description>The Taskana Spring sample application.</description>
|
||||
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.0.2.RELEASE</version>
|
||||
<relativePath/>
|
||||
<artifactId>taskana-lib-parent</artifactId>
|
||||
<groupId>pro.taskana</groupId>
|
||||
<version>1.1.2-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
<properties>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context</artifactId>
|
||||
<version>${version.spring-boot}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-jdbc</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-tx</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.h2database</groupId>
|
||||
<artifactId>h2</artifactId>
|
||||
<version>${version.spring-boot}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<version>${version.spring-boot}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>pro.taskana</groupId>
|
||||
<artifactId>taskana-spring</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
|
@ -57,17 +47,20 @@
|
|||
<version>1.3</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.h2database</groupId>
|
||||
<artifactId>h2</artifactId>
|
||||
<version>1.4.194</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<!-- Package as an executable jar/war -->
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>${version.spring-boot}</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<name>${project.groupId}:${project.artifactId}</name>
|
||||
<url>http://taskana.pro</url>
|
||||
<description>The Taskana Spring sample application.</description>
|
||||
</project>
|
||||
|
|
|
@ -19,6 +19,9 @@ import pro.taskana.exceptions.TaskNotFoundException;
|
|||
import pro.taskana.exceptions.WorkbasketAlreadyExistException;
|
||||
import pro.taskana.exceptions.WorkbasketNotFoundException;
|
||||
|
||||
/**
|
||||
* TODO.
|
||||
*/
|
||||
@Component
|
||||
@Transactional
|
||||
public class ExampleBootstrap {
|
||||
|
|
|
@ -18,7 +18,7 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
|
|||
import pro.taskana.configuration.SpringTaskanaEngineConfiguration;
|
||||
|
||||
/**
|
||||
* Class to set /load configuration for Taskana Library
|
||||
* Class to set /load configuration for Taskana Library.
|
||||
*
|
||||
*/
|
||||
@Configuration
|
||||
|
@ -28,6 +28,9 @@ public class TaskanaConfig {
|
|||
@Value("${taskana.schemaName:TASKANA}")
|
||||
private String schemaName;
|
||||
|
||||
/**
|
||||
* TODO.
|
||||
*/
|
||||
@Profile("inmemorydb")
|
||||
@Configuration
|
||||
@PropertySource("classpath:customdb.properties")
|
||||
|
@ -44,7 +47,8 @@ public class TaskanaConfig {
|
|||
@Bean
|
||||
@Primary
|
||||
public DataSource dataSource(DataSourceProperties properties) {
|
||||
DataSource dataSource = properties.initializeDataSourceBuilder().build();
|
||||
DataSource dataSource = properties.
|
||||
initializeDataSourceBuilder().build();
|
||||
// if TaskanaEngineImpl runs with SpringManagedTransactionFactory, then
|
||||
// there is no need to wrap the dataSource into TransactionAwareDataSourceProxy ...
|
||||
// return new TransactionAwareDataSourceProxy(dataSource);
|
||||
|
|
|
@ -5,14 +5,15 @@ import org.springframework.boot.builder.SpringApplicationBuilder;
|
|||
import org.springframework.context.annotation.Import;
|
||||
|
||||
/**
|
||||
* Class to start an Application to test Taskana
|
||||
* Class to start an Application to test Taskana.
|
||||
*
|
||||
*/
|
||||
@SpringBootApplication
|
||||
@Import(TaskanaConfig.class)
|
||||
@SuppressWarnings("checkstyle:hideutilityclassconstructor")
|
||||
public class TaskanaConfigTestApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
new SpringApplicationBuilder(TaskanaConfigTestApplication.class).run(args);
|
||||
}
|
||||
public static void main(String[] args) {
|
||||
new SpringApplicationBuilder(TaskanaConfigTestApplication.class).run(args);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@ import static org.junit.Assert.assertNotNull;
|
|||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.Mockito.times;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.internal.verification.VerificationModeFactory.atLeastOnce;
|
||||
|
||||
|
@ -35,6 +34,7 @@ import org.springframework.jdbc.core.JdbcTemplate;
|
|||
import org.springframework.test.context.ActiveProfiles;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import ch.qos.logback.classic.spi.ILoggingEvent;
|
||||
import ch.qos.logback.classic.spi.LoggingEvent;
|
||||
import ch.qos.logback.core.Appender;
|
||||
import pro.taskana.exceptions.DomainNotFoundException;
|
||||
|
@ -43,7 +43,6 @@ import pro.taskana.exceptions.NotAuthorizedException;
|
|||
import pro.taskana.exceptions.TaskanaException;
|
||||
import pro.taskana.exceptions.WorkbasketAlreadyExistException;
|
||||
import pro.taskana.exceptions.WorkbasketNotFoundException;
|
||||
import pro.taskana.history.HistoryEventProducer;
|
||||
import pro.taskana.impl.TaskImpl;
|
||||
import pro.taskana.impl.TaskanaEngineImpl;
|
||||
import pro.taskana.impl.WorkbasketImpl;
|
||||
|
@ -63,27 +62,31 @@ import pro.taskana.transaction.TaskanaTransactionProvider;
|
|||
public class TaskanaTransactionIntTest {
|
||||
|
||||
private static final int POOL_TIME_TO_WAIT = 50;
|
||||
|
||||
@Autowired
|
||||
private TestRestTemplate restTemplate;
|
||||
|
||||
@Autowired
|
||||
private DataSource dataSource;
|
||||
|
||||
@Autowired
|
||||
private JdbcTemplate jdbcTemplate;
|
||||
|
||||
@Autowired
|
||||
private TaskanaEngine taskanaEngine;
|
||||
|
||||
@Autowired
|
||||
TaskanaTransactionProvider<Object> springTransactionProvider;
|
||||
|
||||
@Autowired
|
||||
private TestRestTemplate restTemplate;
|
||||
@Autowired
|
||||
private DataSource dataSource;
|
||||
@Autowired
|
||||
private JdbcTemplate jdbcTemplate;
|
||||
@Autowired
|
||||
private TaskanaEngine taskanaEngine;
|
||||
@Captor
|
||||
private ArgumentCaptor<LoggingEvent> captorLoggingEvent;
|
||||
|
||||
@Mock
|
||||
private Appender mockAppender;
|
||||
private Appender<ILoggingEvent> mockAppender;
|
||||
|
||||
private static ObjectReference createDefaultObjRef() {
|
||||
ObjectReference objRef = new ObjectReference();
|
||||
objRef.setCompany("company");
|
||||
objRef.setSystem("system");
|
||||
objRef.setSystemInstance("instance");
|
||||
objRef.setType("type");
|
||||
objRef.setValue("value");
|
||||
return objRef;
|
||||
}
|
||||
|
||||
@Before
|
||||
public void before() {
|
||||
|
@ -324,14 +327,4 @@ public class TaskanaTransactionIntTest {
|
|||
task.setPrimaryObjRef(createDefaultObjRef());
|
||||
return task;
|
||||
}
|
||||
|
||||
private static ObjectReference createDefaultObjRef() {
|
||||
ObjectReference objRef = new ObjectReference();
|
||||
objRef.setCompany("company");
|
||||
objRef.setSystem("system");
|
||||
objRef.setSystemInstance("instance");
|
||||
objRef.setType("type");
|
||||
objRef.setValue("value");
|
||||
return objRef;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-tx</artifactId>
|
||||
<version>${version.spring}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
|
Loading…
Reference in New Issue