Skip to content

Commit f3efa48

Browse files
Jithendar12Trianz-Akshay
authored andcommitted
Add unit tests in Synapse Connector.
1 parent 8ef7474 commit f3efa48

File tree

4 files changed

+984
-115
lines changed

4 files changed

+984
-115
lines changed
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/*-
2+
* #%L
3+
* athena-synapse
4+
* %%
5+
* Copyright (C) 2019 - 2025 Amazon Web Services
6+
* %%
7+
* Licensed under the Apache License, Version 2.0 (the "License");
8+
* you may not use this file except in compliance with the License.
9+
* You may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS,
15+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
* See the License for the specific language governing permissions and
17+
* limitations under the License.
18+
* #L%
19+
*/
20+
package com.amazonaws.athena.connectors.synapse;
21+
22+
import org.junit.Before;
23+
import org.junit.Test;
24+
25+
import java.util.HashMap;
26+
import java.util.Map;
27+
28+
import static com.amazonaws.athena.connector.lambda.connection.EnvironmentConstants.DATABASE;
29+
import static com.amazonaws.athena.connector.lambda.connection.EnvironmentConstants.DEFAULT;
30+
import static com.amazonaws.athena.connector.lambda.connection.EnvironmentConstants.HOST;
31+
import static com.amazonaws.athena.connector.lambda.connection.EnvironmentConstants.PORT;
32+
import static com.amazonaws.athena.connector.lambda.connection.EnvironmentConstants.SECRET_NAME;
33+
import static org.junit.Assert.assertEquals;
34+
35+
public class SynapseEnvironmentPropertiesTest
36+
{
37+
private Map<String, String> connectionProperties;
38+
private SynapseEnvironmentProperties synapseEnvironmentProperties;
39+
40+
@Before
41+
public void setUp()
42+
{
43+
connectionProperties = new HashMap<>();
44+
connectionProperties.put(HOST, "test.sql.azuresynapse.net");
45+
connectionProperties.put(PORT, "1433");
46+
connectionProperties.put(DATABASE, "testdb");
47+
connectionProperties.put(SECRET_NAME, "synapse-secret");
48+
49+
synapseEnvironmentProperties = new SynapseEnvironmentProperties();
50+
}
51+
52+
@Test
53+
public void connectionPropertiesToEnvironment_WithValidProperties_ReturnsCorrectConnectionString()
54+
{
55+
Map<String, String> synapseConnectionProperties = synapseEnvironmentProperties.connectionPropertiesToEnvironment(connectionProperties);
56+
57+
String expectedConnectionString = "synapse://jdbc:sqlserver://test.sql.azuresynapse.net:1433;databaseName=testdb;${synapse-secret}";
58+
assertEquals(expectedConnectionString, synapseConnectionProperties.get(DEFAULT));
59+
}
60+
}

0 commit comments

Comments
 (0)