Browse Source
This adds MS-SQL-Server via Testcontainers to the set of databases available for integration testing. For this purpose it accepts the EULA of MS SQL Server. Failing tests are ignored to be fixed in separate issues. Original pull request: #98.pull/99/head
21 changed files with 189 additions and 18 deletions
@ -0,0 +1,56 @@
@@ -0,0 +1,56 @@
|
||||
/* |
||||
* Copyright 2017-2018 the original author or authors. |
||||
* |
||||
* 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.springframework.data.jdbc.testing; |
||||
|
||||
import com.microsoft.sqlserver.jdbc.SQLServerDataSource; |
||||
import org.springframework.context.annotation.Configuration; |
||||
import org.springframework.context.annotation.Profile; |
||||
import org.testcontainers.containers.MSSQLServerContainer; |
||||
|
||||
import javax.sql.DataSource; |
||||
|
||||
|
||||
/** |
||||
* {@link DataSource} setup for PostgreSQL. |
||||
* <p> |
||||
* Configuration for a MSSQL Datasource. |
||||
* |
||||
* @author Thomas Lang |
||||
* @see <a href="https://github.com/testcontainers/testcontainers-java/tree/master/modules/mssqlserver"></a> |
||||
*/ |
||||
@Configuration |
||||
@Profile({"mssql"}) |
||||
public class MsSqlDataSourceConfiguration extends DataSourceConfiguration { |
||||
|
||||
private static final MSSQLServerContainer mssqlserver = new MSSQLServerContainer(); |
||||
|
||||
static { |
||||
mssqlserver.start(); |
||||
} |
||||
|
||||
/* |
||||
* (non-Javadoc) |
||||
* @see org.springframework.data.jdbc.testing.DataSourceConfiguration#createDataSource() |
||||
*/ |
||||
@Override |
||||
protected DataSource createDataSource() { |
||||
SQLServerDataSource sqlServerDataSource = new SQLServerDataSource(); |
||||
sqlServerDataSource.setURL(mssqlserver.getJdbcUrl()); |
||||
sqlServerDataSource.setUser(mssqlserver.getUsername()); |
||||
sqlServerDataSource.setPassword(mssqlserver.getPassword()); |
||||
return sqlServerDataSource; |
||||
} |
||||
} |
||||
@ -0,0 +1 @@
@@ -0,0 +1 @@
|
||||
microsoft/mssql-server-linux:2017-CU6 |
||||
@ -0,0 +1,15 @@
@@ -0,0 +1,15 @@
|
||||
DROP TABLE IF EXISTS LEGO_SET; |
||||
DROP TABLE IF EXISTS MANUAL; |
||||
CREATE TABLE LEGO_SET ( id BIGINT IDENTITY PRIMARY KEY, NAME VARCHAR(30)); |
||||
CREATE TABLE MANUAL ( id BIGINT IDENTITY PRIMARY KEY, LEGO_SET BIGINT, ALTERNATIVE BIGINT, CONTENT VARCHAR(2000)); |
||||
ALTER TABLE MANUAL ADD FOREIGN KEY (LEGO_SET) REFERENCES LEGO_SET(id); |
||||
|
||||
DROP TABLE IF EXISTS ONE_TO_ONE_PARENT; |
||||
DROP TABLE IF EXISTS Child_No_Id; |
||||
CREATE TABLE ONE_TO_ONE_PARENT ( id BIGINT IDENTITY PRIMARY KEY, content VARCHAR(30)); |
||||
CREATE TABLE Child_No_Id (ONE_TO_ONE_PARENT BIGINT PRIMARY KEY, content VARCHAR(30)); |
||||
|
||||
DROP TABLE IF EXISTS LIST_PARENT; |
||||
DROP TABLE IF EXISTS element_no_id; |
||||
CREATE TABLE LIST_PARENT ( id BIGINT IDENTITY PRIMARY KEY, NAME VARCHAR(100)); |
||||
CREATE TABLE element_no_id ( content VARCHAR(100), LIST_PARENT_key BIGINT, LIST_PARENT BIGINT); |
||||
@ -0,0 +1,2 @@
@@ -0,0 +1,2 @@
|
||||
DROP TABLE IF EXISTS Dummy_Entity; |
||||
CREATE TABLE Dummy_Entity ( id BIGINT IDENTITY PRIMARY KEY); |
||||
@ -0,0 +1,5 @@
@@ -0,0 +1,5 @@
|
||||
DROP TABLE IF EXISTS ReadOnlyIdEntity; |
||||
DROP TABLE IF EXISTS PrimitiveIdEntity; |
||||
|
||||
CREATE TABLE ReadOnlyIdEntity (ID BIGINT IDENTITY PRIMARY KEY, NAME VARCHAR(100)); |
||||
CREATE TABLE PrimitiveIdEntity (ID BIGINT IDENTITY PRIMARY KEY, NAME VARCHAR(100)); |
||||
@ -0,0 +1,2 @@
@@ -0,0 +1,2 @@
|
||||
DROP TABLE IF EXISTS dummy_entity; |
||||
CREATE TABLE dummy_entity (id_Prop BIGINT IDENTITY PRIMARY KEY, NAME VARCHAR(100)); |
||||
@ -0,0 +1,4 @@
@@ -0,0 +1,4 @@
|
||||
DROP TABLE IF EXISTS dummy_entity; |
||||
DROP TABLE IF EXISTS log; |
||||
CREATE TABLE dummy_entity ( id BIGINT IDENTITY PRIMARY KEY, NAME VARCHAR(100), DELETED CHAR(1), log BIGINT); |
||||
CREATE TABLE log ( id BIGINT, TEXT VARCHAR(100)); |
||||
@ -0,0 +1,2 @@
@@ -0,0 +1,2 @@
|
||||
DROP TABLE IF EXISTS ENTITY_WITH_COLUMNS_REQUIRING_CONVERSIONS; |
||||
CREATE TABLE ENTITY_WITH_COLUMNS_REQUIRING_CONVERSIONS ( id_Timestamp DATETIME PRIMARY KEY, bool bit, SOME_ENUM VARCHAR(100), big_Decimal DECIMAL(38), big_Integer DECIMAL(20), date DATETIME, local_Date_Time DATETIME, zoned_Date_Time VARCHAR(30)); |
||||
@ -0,0 +1,4 @@
@@ -0,0 +1,4 @@
|
||||
DROP TABLE IF EXISTS dummy_entity; |
||||
DROP TABLE IF EXISTS element; |
||||
CREATE TABLE dummy_entity ( id BIGINT identity PRIMARY KEY, NAME VARCHAR(100)); |
||||
CREATE TABLE element (id BIGINT identity PRIMARY KEY, content VARCHAR(100), dummy_entity BIGINT); |
||||
@ -0,0 +1,4 @@
@@ -0,0 +1,4 @@
|
||||
DROP TABLE IF EXISTS dummy_entity; |
||||
DROP TABLE IF EXISTS element; |
||||
CREATE TABLE dummy_entity ( id BIGINT identity PRIMARY KEY, NAME VARCHAR(100)); |
||||
CREATE TABLE element (content VARCHAR(100), dummy_entity BIGINT); |
||||
@ -0,0 +1,4 @@
@@ -0,0 +1,4 @@
|
||||
DROP TABLE IF EXISTS dummy_entity; |
||||
DROP TABLE IF EXISTS element; |
||||
CREATE TABLE dummy_entity ( id BIGINT IDENTITY PRIMARY KEY, NAME VARCHAR(100)); |
||||
CREATE TABLE element (id BIGINT IDENTITY PRIMARY KEY, content VARCHAR(100), Dummy_Entity_key BIGINT,dummy_entity BIGINT); |
||||
@ -0,0 +1,4 @@
@@ -0,0 +1,4 @@
|
||||
DROP TABLE IF EXISTS dummy_entity; |
||||
DROP TABLE IF EXISTS element; |
||||
CREATE TABLE dummy_entity ( id BIGINT IDENTITY PRIMARY KEY, NAME VARCHAR(100)); |
||||
CREATE TABLE element (id BIGINT IDENTITY PRIMARY KEY, content VARCHAR(100), Dummy_Entity_key VARCHAR(100),dummy_entity BIGINT); |
||||
Loading…
Reference in new issue