Skip to content

Commit ebfeee4

Browse files
authored
Merge pull request #221 from embulk/test-sqlserver-ubuntu-latest
Test sqlserver with ubuntu-latest
2 parents 9b91fd8 + 6f3fe0c commit ebfeee4

File tree

5 files changed

+24
-13
lines changed

5 files changed

+24
-13
lines changed

.github/workflows/build.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ jobs:
181181
name: redshift
182182
path: embulk-input-redshift/build/reports/tests/test
183183
sqlserver: # https://hub.docker.com/_/microsoft-mssql-server
184-
runs-on: ubuntu-16.04
184+
runs-on: ubuntu-latest
185185
services:
186186
sqlserver:
187187
# To run locallly:
@@ -195,6 +195,10 @@ jobs:
195195
SA_PASSWORD: "P@ssw0rd"
196196
steps:
197197
- uses: actions/checkout@v2
198+
- uses: actions/setup-java@v2
199+
with:
200+
java-version: 8
201+
distribution: 'zulu'
198202
# TODO: Find a better way to wait for completing setup.
199203
- name: Sleep for 30 seconds to complete all the SQL Server setup process
200204
run: sleep 30

embulk-input-sqlserver/src/main/java/org/embulk/input/SQLServerInputPlugin.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public class SQLServerInputPlugin
2626
extends AbstractJdbcInputPlugin
2727
{
2828
private static final Logger logger = LoggerFactory.getLogger(SQLServerInputPlugin.class);
29-
private static int DEFAULT_PORT = 1433;
29+
private static final int DEFAULT_PORT = 1433;
3030

3131
public interface SQLServerPluginTask
3232
extends PluginTask
@@ -81,7 +81,7 @@ public interface SQLServerPluginTask
8181

8282
@Config("application_name")
8383
@ConfigDefault("\"embulk-input-sqlserver\"")
84-
@Size(max=128)
84+
@Size(max = 128)
8585
public String getApplicationName();
8686
}
8787

@@ -132,15 +132,17 @@ protected JdbcInputConnection newConnection(PluginTask task) throws SQLException
132132
catch (Exception e) {
133133
throw new ConfigException("Can't load Microsoft SQLServerDriver from classpath", e);
134134
}
135-
} else if (sqlServerTask.getDriverType().equalsIgnoreCase("jtds")) {
135+
}
136+
else if (sqlServerTask.getDriverType().equalsIgnoreCase("jtds")) {
136137
useJtdsDriver = true;
137138
try {
138139
driver = (Driver) Class.forName("net.sourceforge.jtds.jdbc.Driver").newInstance();
139140
}
140141
catch (Exception e) {
141142
throw new ConfigException("Can't load jTDS Driver from classpath", e);
142143
}
143-
} else {
144+
}
145+
else {
144146
throw new ConfigException("Unknown driver_type : " + sqlServerTask.getDriverType());
145147
}
146148

embulk-input-sqlserver/src/main/java/org/embulk/input/sqlserver/SQLServerInputConnection.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
import java.sql.SQLException;
55
import org.embulk.input.jdbc.JdbcInputConnection;
66

7-
public class SQLServerInputConnection extends JdbcInputConnection {
8-
7+
public class SQLServerInputConnection extends JdbcInputConnection
8+
{
99
private String transactionIsolationLevel;
1010

1111
public SQLServerInputConnection(Connection connection, String schemaName) throws SQLException
@@ -39,5 +39,4 @@ protected String buildTableName(String tableName)
3939
}
4040
return sb.toString();
4141
}
42-
4342
}

embulk-input-sqlserver/src/main/java/org/embulk/input/sqlserver/getter/SQLServerColumnGetterFactory.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
import org.embulk.input.jdbc.getter.*;
99
import org.embulk.spi.PageBuilder;
1010

11-
public class SQLServerColumnGetterFactory extends ColumnGetterFactory {
12-
11+
public class SQLServerColumnGetterFactory extends ColumnGetterFactory
12+
{
1313
public SQLServerColumnGetterFactory(final PageBuilder to, final ZoneId defaultTimeZone)
1414
{
1515
super(to, defaultTimeZone);
@@ -36,5 +36,4 @@ public ColumnGetter newColumnGetter(JdbcInputConnection con, AbstractJdbcInputPl
3636
return super.newColumnGetter(con, task, column, option);
3737
}
3838
}
39-
4039
}

embulk-input-sqlserver/src/test/java/org/embulk/input/sqlserver/SQLServerTests.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@
2121

2222
public class SQLServerTests
2323
{
24+
private SQLServerTests()
25+
{
26+
// No instantiation.
27+
}
28+
2429
public static ConfigSource baseConfig()
2530
{
2631
return EmbulkTests.config("EMBULK_INPUT_SQLSERVER_TEST_CONFIG");
@@ -35,7 +40,8 @@ public static void execute(String sql, String... options)
3540
final String sqlcmdCommand = System.getenv("EMBULK_INPUT_SQLSERVER_TEST_SQLCMD_COMMAND");
3641
if (sqlcmdCommand == null || sqlcmdCommand.isEmpty()) {
3742
args.add("sqlcmd");
38-
} else {
43+
}
44+
else {
3945
args.addAll(Arrays.asList(sqlcmdCommand.split(" ")));
4046
}
4147

@@ -60,7 +66,8 @@ public static void execute(String sql, String... options)
6066
Process process = pb.start();
6167
ByteStreams.copy(process.getInputStream(), System.out);
6268
code = process.waitFor();
63-
} catch (IOException | InterruptedException ex) {
69+
}
70+
catch (IOException | InterruptedException ex) {
6471
throw Throwables.propagate(ex);
6572
}
6673
if (code != 0) {

0 commit comments

Comments
 (0)