Skip to content

Commit

Permalink
Follow test guideline
Browse files Browse the repository at this point in the history
  • Loading branch information
ebyhr committed Sep 30, 2024
1 parent df217a7 commit bb4fa87
Show file tree
Hide file tree
Showing 24 changed files with 146 additions and 146 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
import static org.testcontainers.utility.MountableFile.forClasspathResource;

@TestInstance(Lifecycle.PER_CLASS)
public class TestGatewayHaMultipleBackend
final class TestGatewayHaMultipleBackend
{
public static final String CUSTOM_RESPONSE = "123";
public static final String CUSTOM_PATH = "/v1/custom/extra";
Expand All @@ -70,7 +70,7 @@ public class TestGatewayHaMultipleBackend
private final OkHttpClient httpClient = new OkHttpClient();

@BeforeAll
public void setup()
void setup()
throws Exception
{
adhocTrino = new TrinoContainer("trinodb/trino");
Expand Down Expand Up @@ -109,7 +109,7 @@ public void setup()
}

@Test
public void testCustomPath()
void testCustomPath()
throws Exception
{
RequestBody requestBody = RequestBody.create("abc", MEDIA_TYPE);
Expand All @@ -133,7 +133,7 @@ public void testCustomPath()
}

@Test
public void testQueryDeliveryToMultipleRoutingGroups()
void testQueryDeliveryToMultipleRoutingGroups()
throws Exception
{
// Default request should be routed to adhoc backend
Expand All @@ -160,7 +160,7 @@ public void testQueryDeliveryToMultipleRoutingGroups()
}

@Test
public void testTrinoClusterHostCookie()
void testTrinoClusterHostCookie()
throws Exception
{
RequestBody requestBody = RequestBody.create("SELECT 1", MEDIA_TYPE);
Expand Down Expand Up @@ -197,7 +197,7 @@ public void testTrinoClusterHostCookie()
}

@Test
public void testDeleteQueryId()
void testDeleteQueryId()
throws IOException
{
RequestBody requestBody = RequestBody.create("SELECT 1", MEDIA_TYPE);
Expand All @@ -221,7 +221,7 @@ public void testDeleteQueryId()
}

@Test
public void testBackendConfiguration()
void testBackendConfiguration()
throws Exception
{
Request request = new Request.Builder()
Expand All @@ -248,7 +248,7 @@ public void testBackendConfiguration()
}

@Test
public void testCookieBasedRouting()
void testCookieBasedRouting()
throws IOException
{
// This simulates the Trino oauth handshake
Expand Down Expand Up @@ -297,7 +297,7 @@ public void testCookieBasedRouting()
}

@Test
public void testCookieSigning()
void testCookieSigning()
throws IOException
{
OkHttpClient httpClient = new OkHttpClient.Builder()
Expand Down Expand Up @@ -339,7 +339,7 @@ public void testCookieSigning()
}

@AfterAll
public void cleanup()
void cleanup()
{
adhocTrino.stop();
scheduledTrino.stop();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@
import static org.testcontainers.utility.MountableFile.forClasspathResource;

@TestInstance(Lifecycle.PER_CLASS)
public class TestGatewayHaSingleBackend
final class TestGatewayHaSingleBackend
{
private TrinoContainer trino;
int routerPort = 21001 + (int) (Math.random() * 1000);

@BeforeAll
public void setup()
void setup()
throws Exception
{
trino = new TrinoContainer("trinodb/trino");
Expand All @@ -64,7 +64,7 @@ public void setup()

@ParameterizedTest
@MethodSource("protocols")
public void testRequestDelivery(Protocol protocol)
void testRequestDelivery(Protocol protocol)
throws Exception
{
OkHttpClient httpClient = new OkHttpClient.Builder().protocols(ImmutableList.of(protocol)).build();
Expand All @@ -88,7 +88,7 @@ public void testRequestDelivery(Protocol protocol)

@ParameterizedTest
@MethodSource("protocols")
public void testBackendConfiguration(Protocol protocol)
void testBackendConfiguration(Protocol protocol)
throws Exception
{
OkHttpClient httpClient = new OkHttpClient.Builder().protocols(ImmutableList.of(protocol)).build();
Expand Down Expand Up @@ -116,7 +116,7 @@ List<Protocol> protocols()
}

@AfterAll
public void cleanup()
void cleanup()
{
trino.close();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@
import static org.testcontainers.utility.MountableFile.forClasspathResource;

@TestInstance(TestInstance.Lifecycle.PER_CLASS)
public class TestGatewayHaWithRoutingRulesSingleBackend
final class TestGatewayHaWithRoutingRulesSingleBackend
{
private final OkHttpClient httpClient = new OkHttpClient();
private TrinoContainer trino;
int routerPort = 21001 + (int) (Math.random() * 1000);

@BeforeAll
public void setup()
void setup()
throws Exception
{
trino = new TrinoContainer("trinodb/trino");
Expand All @@ -58,7 +58,7 @@ public void setup()
}

@Test
public void testRequestDelivery()
void testRequestDelivery()
throws Exception
{
RequestBody requestBody =
Expand All @@ -75,7 +75,7 @@ public void testRequestDelivery()

// Do not allow trino gateway to fall back to the adhoc routing group if the desired backend is not found
@Test
public void testVerifyNoAdhoc()
void testVerifyNoAdhoc()
throws Exception
{
Request request = new Request.Builder()
Expand All @@ -94,7 +94,7 @@ public void testVerifyNoAdhoc()
}

@AfterAll
public void cleanup()
void cleanup()
{
trino.close();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@
import static org.testcontainers.utility.MountableFile.forClasspathResource;

@TestInstance(Lifecycle.PER_CLASS)
public class TestNoXForwarded
final class TestNoXForwarded
{
private final OkHttpClient httpClient = new OkHttpClient();
private TrinoContainer trino;
int routerPort = 21001 + (int) (Math.random() * 1000);
int backendPort;

@BeforeAll
public void setup()
void setup()
throws Exception
{
trino = new TrinoContainer("trinodb/trino");
Expand All @@ -60,7 +60,7 @@ public void setup()
}

@Test
public void testRequestDelivery()
void testRequestDelivery()
throws Exception
{
RequestBody requestBody =
Expand All @@ -80,7 +80,7 @@ public void testRequestDelivery()
}

@AfterAll
public void cleanup()
void cleanup()
{
trino.close();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,20 @@

import static org.assertj.core.api.Assertions.assertThat;

public class TestObjectSerializable
final class TestObjectSerializable
{
private final ObjectMapper objectMapper = new ObjectMapperProvider().get();

@Test
public void testServerInfo()
void testServerInfo()
throws JsonProcessingException
{
assertThat(objectMapper.writeValueAsString(new ServerInfo(true)))
.contains("starting");
}

@Test
public void testProxyBackendConfiguration()
void testProxyBackendConfiguration()
throws JsonProcessingException
{
ProxyBackendConfiguration proxyBackendConfiguration = new ProxyBackendConfiguration();
Expand All @@ -65,7 +65,7 @@ public void testProxyBackendConfiguration()
}

@Test
public void testResult()
void testResult()
throws JsonProcessingException
{
assertThat(objectMapper.writeValueAsString(Result.ok()))
Expand All @@ -77,7 +77,7 @@ public void testResult()
}

@Test
public void testTableData()
void testTableData()
throws JsonProcessingException
{
TableData<String> tableData = new TableData<>(ImmutableList.of("t1", "t2"), 2);
Expand All @@ -86,7 +86,7 @@ public void testTableData()
}

@Test
public void testGlobalPropertyRequest()
void testGlobalPropertyRequest()
throws JsonProcessingException
{
ResourceGroupsManager.GlobalPropertiesDetail data = new ResourceGroupsManager.GlobalPropertiesDetail("cpu_quota_period");
Expand All @@ -97,7 +97,7 @@ public void testGlobalPropertyRequest()
}

@Test
public void testQueryDistributionRequest()
void testQueryDistributionRequest()
throws JsonProcessingException
{
assertThat(objectMapper.writeValueAsString(new QueryDistributionRequest(null)))
Expand All @@ -107,7 +107,7 @@ public void testQueryDistributionRequest()
}

@Test
public void testQueryGlobalPropertyRequest()
void testQueryGlobalPropertyRequest()
throws JsonProcessingException
{
assertThat(objectMapper.writeValueAsString(new QueryGlobalPropertyRequest(null, null)))
Expand All @@ -119,7 +119,7 @@ public void testQueryGlobalPropertyRequest()
}

@Test
public void testQueryHistoryRequest()
void testQueryHistoryRequest()
throws JsonProcessingException
{
assertThat(objectMapper.writeValueAsString(new QueryHistoryRequest(null, null, "user1", "url1", "query_id")))
Expand All @@ -129,7 +129,7 @@ public void testQueryHistoryRequest()
}

@Test
public void testQueryResourceGroupsRequest()
void testQueryResourceGroupsRequest()
throws JsonProcessingException
{
assertThat(objectMapper.writeValueAsString(new QueryResourceGroupsRequest(null, 123L)))
Expand All @@ -139,7 +139,7 @@ public void testQueryResourceGroupsRequest()
}

@Test
public void testQuerySelectorsRequest()
void testQuerySelectorsRequest()
throws JsonProcessingException
{
assertThat(objectMapper.writeValueAsString(new QuerySelectorsRequest(null, 123L)))
Expand All @@ -149,7 +149,7 @@ public void testQuerySelectorsRequest()
}

@Test
public void testResourceGroupsRequest()
void testResourceGroupsRequest()
throws JsonProcessingException
{
ResourceGroupsManager.ResourceGroupsDetail data = new ResourceGroupsManager.ResourceGroupsDetail();
Expand All @@ -160,15 +160,15 @@ public void testResourceGroupsRequest()
}

@Test
public void testRestLoginRequest()
void testRestLoginRequest()
throws JsonProcessingException
{
assertThat(objectMapper.writeValueAsString(new RestLoginRequest("user", "pass")))
.contains(ImmutableList.of("username", "password"));
}

@Test
public void testSelectorsRequest()
void testSelectorsRequest()
throws JsonProcessingException
{
ResourceGroupsManager.SelectorsDetail data = new ResourceGroupsManager.SelectorsDetail();
Expand All @@ -180,7 +180,7 @@ public void testSelectorsRequest()
}

@Test
public void testBackendResponse()
void testBackendResponse()
throws JsonProcessingException
{
BackendResponse backendResponse = new BackendResponse();
Expand All @@ -196,7 +196,7 @@ public void testBackendResponse()
}

@Test
public void testDistributionResponse()
void testDistributionResponse()
throws JsonProcessingException
{
DistributionResponse.LineChart lineChart = new DistributionResponse.LineChart();
Expand Down
Loading

0 comments on commit bb4fa87

Please sign in to comment.