Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update query with created state #1233

Merged
merged 3 commits into from
May 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ List<Object[]> findAllRecordsCountForTeamId(

@Query(
value =
"select count(*) from kwaclrequests where (requestor = :userId or approver = :userId) and tenantid = :tenantId",
"select count(*) from kwaclrequests where (requestor = :userId) and tenantid = :tenantId and topicstatus='created'",
nativeQuery = true)
List<Object[]> findAllRecordsCountForUserId(
@Param("userId") String userId, @Param("tenantId") Integer tenantId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ List<Object[]> findAllRecordsCountForTeamId(

@Query(
value =
"select count(*) from kwkafkaconnectorrequests where (requestor = :userId or approver = :userId) and tenantid = :tenantId",
"select count(*) from kwkafkaconnectorrequests where (requestor = :userId) and tenantid = :tenantId and connectorstatus='created'",
nativeQuery = true)
List<Object[]> findAllRecordsCountForUserId(
@Param("userId") String userId, @Param("tenantId") Integer tenantId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ List<Object[]> findAllRecordsCountForTeamId(

@Query(
value =
"select count(*) from kwschemarequests where (requestor = :userId or approver = :userId) and tenantid = :tenantId",
"select count(*) from kwschemarequests where (requestor = :userId) and tenantid = :tenantId and topicstatus='created'",
nativeQuery = true)
List<Object[]> findAllRecordsCountForUserId(
@Param("userId") String userId, @Param("tenantId") Integer tenantId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ List<Object[]> findAllRecordsCountForTeamId(

@Query(
value =
"select count(*) from kwtopicrequests where (requestor = :userId or approver = :userId) and tenantid = :tenantId",
"select count(*) from kwtopicrequests where (requestor = :userId) and tenantid = :tenantId and topicstatus='created'",
nativeQuery = true)
List<Object[]> findAllRecordsCountForUserId(
@Param("userId") String userId, @Param("tenantId") Integer tenantId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
import io.aiven.klaw.model.enums.RequestOperationType;
import io.aiven.klaw.model.enums.RequestStatus;
import io.aiven.klaw.repository.AclRequestsRepo;
import io.aiven.klaw.repository.KwKafkaConnectorRequestsRepo;
import io.aiven.klaw.repository.SchemaRequestRepo;
import io.aiven.klaw.repository.TopicRequestsRepo;
import io.aiven.klaw.repository.UserInfoRepo;
import java.util.List;
import java.util.Map;
Expand All @@ -34,6 +37,13 @@
public class AclRequestsIntegrationTest {

@Autowired private AclRequestsRepo repo;

@Autowired private SchemaRequestRepo schemaRequestRepo;

@Autowired private KwKafkaConnectorRequestsRepo kafkaConnectorRequestsRepo;

@Autowired private TopicRequestsRepo topicRequestsRepo;

@Autowired private UserInfoRepo userInfoRepo;

@Autowired TestEntityManager entityManager;
Expand Down Expand Up @@ -123,6 +133,10 @@ public void setUp() {
selectDataJdbc = new SelectDataJdbc();
utilMethods = new UtilMethods();
ReflectionTestUtils.setField(selectDataJdbc, "aclRequestsRepo", repo);
ReflectionTestUtils.setField(selectDataJdbc, "schemaRequestRepo", schemaRequestRepo);
ReflectionTestUtils.setField(
selectDataJdbc, "kafkaConnectorRequestsRepo", kafkaConnectorRequestsRepo);
ReflectionTestUtils.setField(selectDataJdbc, "topicRequestsRepo", topicRequestsRepo);
ReflectionTestUtils.setField(selectDataJdbc, "userInfoRepo", userInfoRepo);
loadData();
}
Expand Down Expand Up @@ -611,6 +625,15 @@ public void getAclRequestsCountsForMyApprovalsJohnCreatedNone() {
assertThat(operationTypeCount.get(RequestOperationType.DELETE.value)).isEqualTo(0L);
}

@Test
@Order(24)
public void getRequestsCountForCreatedStatus() {
int count = selectDataJdbc.findAllComponentsCountForUser("Jackie", 101);
assertThat(count).isEqualTo(21);
count = selectDataJdbc.findAllComponentsCountForUser("Jackie", 103);
assertThat(count).isEqualTo(10);
}

@Order(24)
@ParameterizedTest
@CsvSource({
Expand Down