Skip to content

Commit b26a2f7

Browse files
committed
IT fixes
1 parent a738a83 commit b26a2f7

25 files changed

+136
-71
lines changed

v2/spanner-common/src/main/java/com/google/cloud/teleport/v2/spanner/migrations/utils/SchemaUtils.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,9 @@ public static SourceSchema buildSourceSchemaFromSessionFile(String sessionFile)
122122
Map<String, Object> colMap = (Map<String, Object>) colDefs.get(colId);
123123
Map<String, Object> typeMap = (Map<String, Object>) colMap.get("Type");
124124
String typeName = (String) typeMap.get("Name");
125-
Integer size = null;
125+
Long size = null;
126126
if (typeMap.get("Len") instanceof Number) {
127-
size = ((Number) typeMap.get("Len")).intValue();
127+
size = ((Number) typeMap.get("Len")).longValue();
128128
}
129129
SourceColumn.Builder colBuilder =
130130
SourceColumn.builder(dbType)

v2/spanner-common/src/main/java/com/google/cloud/teleport/v2/spanner/sourceddl/MySqlInformationSchemaScanner.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ protected List<SourceColumn> scanColumns(String tableName, String schema) throws
6969
// Handle size/precision/scale
7070
String maxLength = rs.getString("character_maximum_length");
7171
if (maxLength != null) {
72-
columnBuilder.size(Integer.parseInt(maxLength));
72+
columnBuilder.size(Long.parseLong(maxLength));
7373
}
7474

7575
String precision = rs.getString("numeric_precision");

v2/spanner-common/src/main/java/com/google/cloud/teleport/v2/spanner/sourceddl/SourceColumn.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public abstract class SourceColumn implements Serializable {
3535
public abstract boolean isPrimaryKey();
3636

3737
@Nullable
38-
public abstract Integer size();
38+
public abstract Long size();
3939

4040
@Nullable
4141
public abstract Integer precision();
@@ -68,7 +68,7 @@ public abstract static class Builder {
6868

6969
public abstract Builder isPrimaryKey(boolean isPrimaryKey);
7070

71-
public abstract Builder size(Integer size);
71+
public abstract Builder size(Long size);
7272

7373
public abstract Builder precision(Integer precision);
7474

v2/spanner-common/src/test/java/com/google/cloud/teleport/v2/spanner/sourceddl/MySqlInformationSchemaScannerTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public void testScanSingleTable() throws SQLException {
9191
assertEquals("INT", column.type());
9292
assertEquals(false, column.isNullable());
9393
assertEquals(true, column.isPrimaryKey());
94-
assertEquals(Integer.valueOf(10), column.size());
94+
assertEquals(Long.valueOf(10L), column.size());
9595
assertEquals(1, table.primaryKeyColumns().size());
9696
assertEquals("id", table.primaryKeyColumns().get(0));
9797
}

v2/spanner-common/src/test/java/com/google/cloud/teleport/v2/spanner/sourceddl/SourceColumnTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public void testBuilderAndProperties() {
3131
.type("INT")
3232
.isNullable(false)
3333
.isPrimaryKey(true)
34-
.size(10)
34+
.size(10L)
3535
.precision(5)
3636
.scale(0)
3737
.columnOptions(ImmutableList.of("AUTO_INCREMENT"))
@@ -40,7 +40,7 @@ public void testBuilderAndProperties() {
4040
assertEquals("INT", column.type());
4141
assertEquals(false, column.isNullable());
4242
assertEquals(true, column.isPrimaryKey());
43-
assertEquals(Integer.valueOf(10), column.size());
43+
assertEquals(Long.valueOf(10L), column.size());
4444
assertEquals(Integer.valueOf(5), column.precision());
4545
assertEquals(Integer.valueOf(0), column.scale());
4646
assertEquals(ImmutableList.of("AUTO_INCREMENT"), column.columnOptions());

v2/spanner-to-sourcedb/src/main/java/com/google/cloud/teleport/v2/templates/SpannerToSourceDb.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -600,6 +600,8 @@ public static PipelineResult run(Options options) {
600600
}
601601
SourceInformationSchemaScanner scanner = null;
602602
try {
603+
SourceProcessorFactory.initializeConnectionHelper(
604+
options.getSourceType(), shards, connectionPoolSizePerWorker);
603605
if (options.getSourceType().equals(MYSQL_SOURCE_TYPE)) {
604606
Connection connection =
605607
(Connection)

v2/spanner-to-sourcedb/src/main/java/com/google/cloud/teleport/v2/templates/dbutils/processor/SourceProcessorFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ private static IConnectionHelper getConnectionHelper(String source)
140140
"Invalid source type for connection helper: " + source));
141141
}
142142

143-
private static void initializeConnectionHelper(
143+
public static void initializeConnectionHelper(
144144
String source, List<Shard> shards, int maxConnections) throws UnsupportedSourceException {
145145
IConnectionHelper connectionHelper = getConnectionHelper(source);
146146
if (!connectionHelper.isConnectionPoolInitialized()) {

v2/spanner-to-sourcedb/src/test/java/com/google/cloud/teleport/v2/templates/SpannerToCassandraSourceDBCustomTransformationIT.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,8 @@ public void setUp() throws IOException, InterruptedException {
114114
null,
115115
null,
116116
customTransformation,
117-
CASSANDRA_SOURCE_TYPE);
117+
CASSANDRA_SOURCE_TYPE,
118+
null);
118119
}
119120
}
120121
}

v2/spanner-to-sourcedb/src/test/java/com/google/cloud/teleport/v2/templates/SpannerToCassandraSourceDbIT.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,8 @@ public void setUp() throws IOException {
142142
null,
143143
null,
144144
null,
145-
CASSANDRA_SOURCE_TYPE);
145+
CASSANDRA_SOURCE_TYPE,
146+
null);
146147
}
147148
}
148149
}

v2/spanner-to-sourcedb/src/test/java/com/google/cloud/teleport/v2/templates/SpannerToCassandraSourceDbMaxColumnsIT.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import java.util.HashMap;
3434
import java.util.HashSet;
3535
import java.util.List;
36+
import java.util.Map;
3637
import org.apache.beam.it.cassandra.CassandraResourceManager;
3738
import org.apache.beam.it.common.PipelineLauncher;
3839
import org.apache.beam.it.common.PipelineOperator;
@@ -102,14 +103,14 @@ public void setUp() throws Exception {
102103
pubsubResourceManager,
103104
getGcsPath("dlq", gcsResourceManager).replace("gs://" + artifactBucketName, ""),
104105
gcsResourceManager);
105-
ADDITIONAL_JOB_PARAMS.putAll(
106+
Map<String, String> jobParameters =
106107
new HashMap<>() {
107108
{
108109
put("network", VPC_NAME);
109110
put("subnetwork", SUBNET_NAME);
110111
put("workerRegion", VPC_REGION);
111112
}
112-
});
113+
};
113114
jobInfo =
114115
launchDataflowJob(
115116
gcsResourceManager,
@@ -121,7 +122,8 @@ public void setUp() throws Exception {
121122
null,
122123
null,
123124
null,
124-
CASSANDRA_SOURCE_TYPE);
125+
CASSANDRA_SOURCE_TYPE,
126+
jobParameters);
125127
}
126128
}
127129
}

0 commit comments

Comments
 (0)