Skip to content

Commit

Permalink
Addressing PR comments to simplify code use methods instead of abstra…
Browse files Browse the repository at this point in the history
…ctions
  • Loading branch information
BlueLort committed Jun 19, 2024
1 parent ad57f81 commit b468d57
Show file tree
Hide file tree
Showing 10 changed files with 344 additions and 514 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
import org.testcontainers.junit.jupiter.Testcontainers;
import software.amazon.opentelemetry.appsignals.test.jdbc.operationtests.DBOperation;

@Testcontainers(disabledWithoutDocker = true)
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
Expand All @@ -32,14 +31,14 @@ public class JdbcH2Test extends JdbcContractTestBase {
private static final String DB_PLATFORM = "org.hibernate.dialect.H2Dialect";

@Test
public void testSuccess() {
public void testSuccessSelect() {
assertSuccess(
DB_SYSTEM, DBOperation.SELECT, DB_USER, DB_NAME, DB_CONNECTION_STRING, null, null);
DB_SYSTEM, DB_SELECT_OPERATION, DB_USER, DB_NAME, DB_CONNECTION_STRING, null, null);
}

@Test
public void testFault() {
assertFault(DB_SYSTEM, DBOperation.SELECT, DB_USER, DB_NAME, DB_CONNECTION_STRING, null, null);
public void testFaultSelect() {
assertFault(DB_SYSTEM, DB_SELECT_OPERATION, DB_USER, DB_NAME, DB_CONNECTION_STRING, null, null);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,15 @@

import java.util.List;
import java.util.Map;
import java.util.stream.Stream;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
import org.junit.jupiter.api.TestInstance.Lifecycle;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;
import org.testcontainers.containers.MySQLContainer;
import org.testcontainers.containers.wait.strategy.Wait;
import org.testcontainers.images.PullPolicy;
import org.testcontainers.junit.jupiter.Testcontainers;
import org.testcontainers.lifecycle.Startable;
import software.amazon.opentelemetry.appsignals.test.jdbc.operationtests.DBOperation;

@Testcontainers(disabledWithoutDocker = true)
@TestInstance(Lifecycle.PER_CLASS)
Expand All @@ -52,16 +48,23 @@ public void afterEach() {
mySQLContainer.stop();
}

private static Stream<DBOperation> dbOperations() {
return Stream.of(DBOperation.SELECT, DBOperation.CREATE_DATABASE);
@Test
public void testSuccessCreateDatabase() {
assertSuccess(
DB_SYSTEM,
DB_CREATE_DATABASE_OPERATION,
DB_USER,
DB_NAME,
DB_CONNECTION_STRING,
DB_RESOURCE_TYPE,
MYSQL_IDENTIFIER);
}

@ParameterizedTest
@MethodSource("dbOperations")
public void testSuccess(DBOperation operation) {
@Test
public void testSuccessSelect() {
assertSuccess(
DB_SYSTEM,
operation,
DB_SELECT_OPERATION,
DB_USER,
DB_NAME,
DB_CONNECTION_STRING,
Expand All @@ -70,10 +73,10 @@ public void testSuccess(DBOperation operation) {
}

@Test
public void testFault() {
public void testFaultSelect() {
assertFault(
DB_SYSTEM,
DBOperation.SELECT,
DB_SELECT_OPERATION,
DB_USER,
DB_NAME,
DB_CONNECTION_STRING,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,14 @@

import java.util.List;
import java.util.Map;
import java.util.stream.Stream;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;
import org.testcontainers.containers.PostgreSQLContainer;
import org.testcontainers.containers.wait.strategy.Wait;
import org.testcontainers.images.PullPolicy;
import org.testcontainers.junit.jupiter.Testcontainers;
import org.testcontainers.lifecycle.Startable;
import software.amazon.opentelemetry.appsignals.test.jdbc.operationtests.DBOperation;

@Testcontainers(disabledWithoutDocker = true)
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
Expand All @@ -52,16 +48,23 @@ public void afterEach() {
postgreSqlContainer.stop();
}

private static Stream<DBOperation> dbOperations() {
return Stream.of(DBOperation.SELECT, DBOperation.CREATE_DATABASE);
@Test
public void testSuccessCreateDatabase() {
assertSuccess(
DB_SYSTEM,
DB_CREATE_DATABASE_OPERATION,
DB_USER,
DB_NAME,
DB_CONNECTION_STRING,
DB_RESOURCE_TYPE,
POSTGRES_IDENTIFIER);
}

@ParameterizedTest
@MethodSource("dbOperations")
public void testSuccess(DBOperation operation) {
@Test
public void testSuccessSelect() {
assertSuccess(
DB_SYSTEM,
operation,
DB_SELECT_OPERATION,
DB_USER,
DB_NAME,
DB_CONNECTION_STRING,
Expand All @@ -70,10 +73,10 @@ public void testSuccess(DBOperation operation) {
}

@Test
public void testFault() {
public void testFaultSelect() {
assertFault(
DB_SYSTEM,
DBOperation.SELECT,
DB_SELECT_OPERATION,
DB_USER,
DB_NAME,
DB_CONNECTION_STRING,
Expand Down

This file was deleted.

This file was deleted.

Loading

0 comments on commit b468d57

Please sign in to comment.