From fd2bb71bda4cb6da43533afd68a31fe37e6ee846 Mon Sep 17 00:00:00 2001
From: Martin Weise <martin.weise@tuwien.ac.at>
Date: Thu, 12 Dec 2024 15:46:30 +0100
Subject: [PATCH] WIP

---
 .../endpoint/SubsetEndpointUnitTest.java      | 587 +++++++++---------
 .../service/SubsetServiceIntegrationTest.java | 177 ------
 .../service/TableServiceIntegrationTest.java  |  79 ---
 .../service/ViewServiceIntegrationTest.java   |  30 -
 4 files changed, 303 insertions(+), 570 deletions(-)

diff --git a/dbrepo-data-service/rest-service/src/test/java/at/tuwien/endpoint/SubsetEndpointUnitTest.java b/dbrepo-data-service/rest-service/src/test/java/at/tuwien/endpoint/SubsetEndpointUnitTest.java
index e7aeaa48d7..c9e35bbabe 100644
--- a/dbrepo-data-service/rest-service/src/test/java/at/tuwien/endpoint/SubsetEndpointUnitTest.java
+++ b/dbrepo-data-service/rest-service/src/test/java/at/tuwien/endpoint/SubsetEndpointUnitTest.java
@@ -1,6 +1,7 @@
 package at.tuwien.endpoint;
 
 import at.tuwien.api.database.internal.PrivilegedDatabaseDto;
+import at.tuwien.api.database.query.ExecuteStatementDto;
 import at.tuwien.api.database.query.QueryDto;
 import at.tuwien.api.database.query.QueryPersistDto;
 import at.tuwien.endpoints.SubsetEndpoint;
@@ -10,6 +11,9 @@ import at.tuwien.service.SubsetService;
 import at.tuwien.test.AbstractUnitTest;
 import jakarta.servlet.http.HttpServletRequest;
 import lombok.extern.log4j.Log4j2;
+import org.apache.spark.sql.Dataset;
+import org.apache.spark.sql.Row;
+import org.apache.spark.sql.SparkSession;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.extension.ExtendWith;
@@ -17,6 +21,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.boot.test.mock.mockito.MockBean;
 import org.springframework.http.HttpStatus;
+import org.springframework.http.MediaType;
 import org.springframework.http.ResponseEntity;
 import org.springframework.mock.web.MockHttpServletRequest;
 import org.springframework.security.test.context.support.WithAnonymousUser;
@@ -24,6 +29,7 @@ import org.springframework.security.test.context.support.WithMockUser;
 import org.springframework.test.context.junit.jupiter.SpringExtension;
 
 import java.sql.SQLException;
+import java.time.Instant;
 import java.util.List;
 import java.util.Map;
 
@@ -38,6 +44,9 @@ public class SubsetEndpointUnitTest extends AbstractUnitTest {
     @Autowired
     private SubsetEndpoint subsetEndpoint;
 
+    @Autowired
+    private SparkSession sparkSession;
+
     @MockBean
     private SubsetService subsetService;
 
@@ -97,284 +106,294 @@ public class SubsetEndpointUnitTest extends AbstractUnitTest {
         });
     }
 
-//    @Test
-//    @WithAnonymousUser
-//    public void findById_succeeds() throws DatabaseNotFoundException, RemoteUnavailableException, UserNotFoundException,
-//            DatabaseUnavailableException, StorageUnavailableException, QueryMalformedException, QueryNotFoundException,
-//            FormatNotAvailableException, StorageNotFoundException, SQLException, MetadataServiceException,
-//            ViewNotFoundException, MalformedException, TableNotFoundException {
-//
-//        /* mock */
-//        when(metadataServiceGateway.getDatabaseById(DATABASE_3_ID))
-//                .thenReturn(DATABASE_3_PRIVILEGED_DTO);
-//        when(subsetService.findById(DATABASE_3_PRIVILEGED_DTO, QUERY_5_ID))
-//                .thenReturn(QUERY_5_DTO);
-//
-//        /* test */
-//        generic_findById(QUERY_5_ID, MediaType.APPLICATION_JSON, null);
-//    }
+    @Test
+    @WithAnonymousUser
+    public void findById_succeeds() throws DatabaseNotFoundException, RemoteUnavailableException, UserNotFoundException,
+            DatabaseUnavailableException, StorageUnavailableException, QueryMalformedException, QueryNotFoundException,
+            FormatNotAvailableException, TableNotFoundException, MetadataServiceException, SQLException,
+            ViewMalformedException {
 
-//    @Test
-//    @WithAnonymousUser
-//    public void findById_format_fails() throws DatabaseNotFoundException, RemoteUnavailableException, SQLException,
-//            UserNotFoundException, QueryNotFoundException, MetadataServiceException {
-//
-//        /* mock */
-//        when(metadataServiceGateway.getDatabaseById(DATABASE_3_ID))
-//                .thenReturn(DATABASE_3_PRIVILEGED_DTO);
-//        when(subsetService.findById(DATABASE_3_PRIVILEGED_DTO, QUERY_5_ID))
-//                .thenReturn(QUERY_5_DTO);
-//
-//        /* test */
-//        assertThrows(FormatNotAvailableException.class, () -> {
-//            generic_findById(QUERY_5_ID, MediaType.APPLICATION_PDF, null);
-//        });
-//    }
+        /* mock */
+        when(metadataServiceGateway.getDatabaseById(DATABASE_3_ID))
+                .thenReturn(DATABASE_3_PRIVILEGED_DTO);
+        when(subsetService.findById(DATABASE_3_PRIVILEGED_DTO, QUERY_5_ID))
+                .thenReturn(QUERY_5_DTO);
 
-//    @Test
-//    @WithAnonymousUser
-//    public void findById_acceptCsv_succeeds() throws DatabaseNotFoundException, RemoteUnavailableException,
-//            UserNotFoundException, DatabaseUnavailableException, StorageUnavailableException, QueryMalformedException,
-//            QueryNotFoundException, FormatNotAvailableException, StorageNotFoundException, SQLException,
-//            MetadataServiceException, ViewNotFoundException, MalformedException, TableNotFoundException {
-//        final ExportResourceDto mock = ExportResourceDto.builder()
-//                .filename("deadbeef")
-//                .resource(new InputStreamResource(InputStream.nullInputStream()))
-//                .build();
-//
-//        /* mock */
-//        when(metadataServiceGateway.getDatabaseById(DATABASE_3_ID))
-//                .thenReturn(DATABASE_3_PRIVILEGED_DTO);
-//        when(subsetService.findById(DATABASE_3_PRIVILEGED_DTO, QUERY_5_ID))
-//                .thenReturn(QUERY_5_DTO);
-//        when(subsetService.export(any(PrivilegedDatabaseDto.class), any(QueryDto.class), any(Instant.class)))
-//                .thenReturn(mock);
-//
-//        /* test */
-//        generic_findById(QUERY_5_ID, MediaType.parseMediaType("text/csv"), null);
-//    }
+        /* test */
+        generic_findById(QUERY_5_ID, MediaType.APPLICATION_JSON, null);
+    }
 
-//    @Test
-//    @WithAnonymousUser
-//    public void findById_timestamp_succeeds() throws DatabaseNotFoundException, RemoteUnavailableException,
-//            UserNotFoundException, DatabaseUnavailableException, StorageUnavailableException, QueryMalformedException,
-//            QueryNotFoundException, FormatNotAvailableException, StorageNotFoundException, SQLException,
-//            MetadataServiceException, ViewNotFoundException, MalformedException, TableNotFoundException {
-//        final ExportResourceDto mock = ExportResourceDto.builder()
-//                .filename("deadbeef")
-//                .resource(new InputStreamResource(InputStream.nullInputStream()))
-//                .build();
-//
-//        /* mock */
-//        when(metadataServiceGateway.getDatabaseById(DATABASE_3_ID))
-//                .thenReturn(DATABASE_3_PRIVILEGED_DTO);
-//        when(subsetService.findById(DATABASE_3_PRIVILEGED_DTO, QUERY_5_ID))
-//                .thenReturn(QUERY_5_DTO);
-//        when(subsetService.export(any(PrivilegedDatabaseDto.class), any(QueryDto.class), any(Instant.class)))
-//                .thenReturn(mock);
-//
-//        /* test */
-//        generic_findById(QUERY_5_ID, MediaType.parseMediaType("text/csv"), Instant.now());
-//    }
+    @Test
+    @WithAnonymousUser
+    public void findById_format_fails() throws DatabaseNotFoundException, RemoteUnavailableException, SQLException,
+            UserNotFoundException, QueryNotFoundException, MetadataServiceException {
 
-//    @Test
-//    @WithAnonymousUser
-//    public void findById_notFound_fails() throws DatabaseNotFoundException, RemoteUnavailableException, MetadataServiceException {
-//
-//        /* mock */
-//        doThrow(DatabaseNotFoundException.class)
-//                .when(metadataServiceGateway)
-//                .getDatabaseById(DATABASE_3_ID);
-//
-//        /* test */
-//        assertThrows(DatabaseNotFoundException.class, () -> {
-//            generic_findById(QUERY_5_ID, MediaType.APPLICATION_JSON, null);
-//        });
-//    }
+        /* mock */
+        when(metadataServiceGateway.getDatabaseById(DATABASE_3_ID))
+                .thenReturn(DATABASE_3_PRIVILEGED_DTO);
+        when(subsetService.findById(DATABASE_3_PRIVILEGED_DTO, QUERY_5_ID))
+                .thenReturn(QUERY_5_DTO);
 
-//    @Test
-//    @WithAnonymousUser
-//    public void findById_unavailable_fails() throws DatabaseNotFoundException, RemoteUnavailableException,
-//            MetadataServiceException, SQLException, UserNotFoundException, QueryNotFoundException {
-//
-//        /* mock */
-//        when(metadataServiceGateway.getDatabaseById(DATABASE_3_ID))
-//                .thenReturn(DATABASE_3_PRIVILEGED_DTO);
-//        doThrow(SQLException.class)
-//                .when(subsetService)
-//                .findById(DATABASE_3_PRIVILEGED_DTO, QUERY_5_ID);
-//
-//        /* test */
-//        assertThrows(DatabaseUnavailableException.class, () -> {
-//            generic_findById(QUERY_5_ID, MediaType.APPLICATION_JSON, null);
-//        });
-//    }
+        /* test */
+        assertThrows(FormatNotAvailableException.class, () -> {
+            generic_findById(QUERY_5_ID, MediaType.APPLICATION_PDF, null);
+        });
+    }
 
-//    @Test
-//    @WithAnonymousUser
-//    public void findById_unavailableExport_fails() throws DatabaseNotFoundException, RemoteUnavailableException,
-//            MetadataServiceException, SQLException, StorageUnavailableException, QueryMalformedException,
-//            StorageNotFoundException, UserNotFoundException, QueryNotFoundException, ViewNotFoundException, MalformedException {
-//        final ExportResourceDto mock = ExportResourceDto.builder()
-//                .filename("deadbeef")
-//                .resource(new InputStreamResource(InputStream.nullInputStream()))
-//                .build();
-//
-//        /* mock */
-//        when(metadataServiceGateway.getDatabaseById(DATABASE_3_ID))
-//                .thenReturn(DATABASE_3_PRIVILEGED_DTO);
-//        when(subsetService.findById(DATABASE_3_PRIVILEGED_DTO, QUERY_5_ID))
-//                .thenReturn(QUERY_5_DTO);
-//        when(subsetService.export(any(PrivilegedDatabaseDto.class), any(QueryDto.class), any(Instant.class)))
-//                .thenReturn(mock);
-//        doThrow(SQLException.class)
-//                .when(subsetService)
-//                .export(eq(DATABASE_3_PRIVILEGED_DTO), eq(QUERY_5_DTO), any(Instant.class));
-//
-//        /* test */
-//        assertThrows(DatabaseUnavailableException.class, () -> {
-//            generic_findById(QUERY_5_ID, MediaType.parseMediaType("text/csv"), null);
-//        });
-//    }
-//
-//    @Test
-//    @WithMockUser(username = USER_1_USERNAME, authorities = {"execute-query"})
-//    public void create_noAccess_succeeds() throws UserNotFoundException, QueryStoreInsertException,
-//            TableMalformedException, NotAllowedException, QueryNotSupportedException, PaginationException,
-//            StorageNotFoundException, DatabaseUnavailableException, StorageUnavailableException,
-//            QueryMalformedException, QueryNotFoundException, DatabaseNotFoundException, RemoteUnavailableException,
-//            SQLException, MetadataServiceException {
-//        final ExecuteStatementDto request = ExecuteStatementDto.builder()
-//                .statement(QUERY_5_STATEMENT)
-//                .build();
-//
-//        /* mock */
-//        when(metadataServiceGateway.getDatabaseById(DATABASE_3_ID))
-//                .thenReturn(DATABASE_3_PRIVILEGED_DTO);
-//        when(subsetService.execute(eq(DATABASE_3_PRIVILEGED_DTO), anyString(), any(Instant.class), eq(USER_1_ID), eq(0L), eq(10L), eq(null), eq(null)))
-//                .thenReturn(QUERY_5_RESULT_DTO);
-//
-//        /* test */
-//        subsetEndpoint.create(DATABASE_3_ID, request, USER_1_PRINCIPAL, 0L, 10L, null);
-//    }
+    @Test
+    @WithAnonymousUser
+    public void findById_acceptCsv_succeeds() throws DatabaseNotFoundException, RemoteUnavailableException,
+            UserNotFoundException, DatabaseUnavailableException, StorageUnavailableException, QueryMalformedException,
+            QueryNotFoundException, FormatNotAvailableException, SQLException, MetadataServiceException,
+            TableNotFoundException, ViewMalformedException {
+        final Dataset<Row> mock = sparkSession.emptyDataFrame();
 
-//    @Test
-//    @WithMockUser(username = USER_1_USERNAME, authorities = {"execute-query"})
-//    public void create_forbiddenKeyword_fails() {
-//        final ExecuteStatementDto request = ExecuteStatementDto.builder()
-//                .statement("SELECT COUNT(id) FROM tbl")
-//                .build();
-//
-//        /* test */
-//        assertThrows(QueryNotSupportedException.class, () -> {
-//            subsetEndpoint.create(DATABASE_3_ID, request, USER_1_PRINCIPAL, 0L, 10L, null);
-//        });
-//    }
+        /* mock */
+        when(metadataServiceGateway.getDatabaseById(DATABASE_3_ID))
+                .thenReturn(DATABASE_3_PRIVILEGED_DTO);
+        when(subsetService.findById(DATABASE_3_PRIVILEGED_DTO, QUERY_5_ID))
+                .thenReturn(QUERY_5_DTO);
+        when(subsetService.getData(any(PrivilegedDatabaseDto.class), any(QueryDto.class), anyLong(), anyLong()))
+                .thenReturn(mock);
+
+        /* test */
+        generic_findById(QUERY_5_ID, MediaType.parseMediaType("text/csv"), null);
+    }
+
+    @Test
+    @WithAnonymousUser
+    public void findById_timestamp_succeeds() throws DatabaseNotFoundException, RemoteUnavailableException,
+            UserNotFoundException, DatabaseUnavailableException, StorageUnavailableException, QueryMalformedException,
+            QueryNotFoundException, FormatNotAvailableException, SQLException, MetadataServiceException,
+            TableNotFoundException, ViewMalformedException {
+        final Dataset<Row> mock = sparkSession.emptyDataFrame();
+
+        /* mock */
+        when(metadataServiceGateway.getDatabaseById(DATABASE_3_ID))
+                .thenReturn(DATABASE_3_PRIVILEGED_DTO);
+        when(subsetService.findById(DATABASE_3_PRIVILEGED_DTO, QUERY_5_ID))
+                .thenReturn(QUERY_5_DTO);
+        when(subsetService.getData(any(PrivilegedDatabaseDto.class), any(QueryDto.class), anyLong(), anyLong()))
+                .thenReturn(mock);
+
+        /* test */
+        generic_findById(QUERY_5_ID, MediaType.parseMediaType("text/csv"), Instant.now());
+    }
+
+    @Test
+    @WithAnonymousUser
+    public void findById_notFound_fails() throws DatabaseNotFoundException, RemoteUnavailableException, MetadataServiceException {
+
+        /* mock */
+        doThrow(DatabaseNotFoundException.class)
+                .when(metadataServiceGateway)
+                .getDatabaseById(DATABASE_3_ID);
+
+        /* test */
+        assertThrows(DatabaseNotFoundException.class, () -> {
+            generic_findById(QUERY_5_ID, MediaType.APPLICATION_JSON, null);
+        });
+    }
+
+    @Test
+    @WithAnonymousUser
+    public void findById_unavailable_fails() throws DatabaseNotFoundException, RemoteUnavailableException,
+            MetadataServiceException, SQLException, UserNotFoundException, QueryNotFoundException {
+
+        /* mock */
+        when(metadataServiceGateway.getDatabaseById(DATABASE_3_ID))
+                .thenReturn(DATABASE_3_PRIVILEGED_DTO);
+        doThrow(SQLException.class)
+                .when(subsetService)
+                .findById(DATABASE_3_PRIVILEGED_DTO, QUERY_5_ID);
+
+        /* test */
+        assertThrows(DatabaseUnavailableException.class, () -> {
+            generic_findById(QUERY_5_ID, MediaType.APPLICATION_JSON, null);
+        });
+    }
+
+    @Test
+    @WithAnonymousUser
+    public void findById_unavailableExport_fails() throws DatabaseNotFoundException, RemoteUnavailableException,
+            MetadataServiceException, SQLException, QueryMalformedException, UserNotFoundException,
+            QueryNotFoundException, TableNotFoundException, ViewMalformedException {
+        final Dataset<Row> mock = sparkSession.emptyDataFrame();
+
+        /* mock */
+        when(metadataServiceGateway.getDatabaseById(DATABASE_3_ID))
+                .thenReturn(DATABASE_3_PRIVILEGED_DTO);
+        when(subsetService.findById(DATABASE_3_PRIVILEGED_DTO, QUERY_5_ID))
+                .thenReturn(QUERY_5_DTO);
+        when(subsetService.getData(any(PrivilegedDatabaseDto.class), any(QueryDto.class), anyLong(), anyLong()))
+                .thenReturn(mock);
+        doThrow(SQLException.class)
+                .when(subsetService)
+                .getData(eq(DATABASE_3_PRIVILEGED_DTO), eq(QUERY_5_DTO), anyLong(), any());
+
+        /* test */
+        assertThrows(DatabaseUnavailableException.class, () -> {
+            generic_findById(QUERY_5_ID, MediaType.parseMediaType("text/csv"), null);
+        });
+    }
+
+    @Test
+    @WithMockUser(username = USER_1_USERNAME, authorities = {"execute-query"})
+    public void create_noAccess_succeeds() throws UserNotFoundException, QueryStoreInsertException,
+            TableMalformedException, NotAllowedException, QueryNotSupportedException, PaginationException,
+            StorageNotFoundException, DatabaseUnavailableException, StorageUnavailableException, SQLException,
+            QueryMalformedException, QueryNotFoundException, DatabaseNotFoundException, RemoteUnavailableException,
+            MetadataServiceException, TableNotFoundException, ViewMalformedException, ViewNotFoundException {
+        final Dataset<Row> mock = sparkSession.emptyDataFrame();
+        final ExecuteStatementDto request = ExecuteStatementDto.builder()
+                .statement(QUERY_5_STATEMENT)
+                .build();
+
+        /* mock */
+        when(metadataServiceGateway.getDatabaseById(DATABASE_3_ID))
+                .thenReturn(DATABASE_3_PRIVILEGED_DTO);
+        when(subsetService.getData(eq(DATABASE_3_PRIVILEGED_DTO), any(QueryDto.class), eq(0L), eq(10L)))
+                .thenReturn(mock);
+        when(httpServletRequest.getMethod())
+                .thenReturn("POST");
+
+        /* test */
+        subsetEndpoint.create(DATABASE_3_ID, request, USER_1_PRINCIPAL, httpServletRequest, null, 0L, 10L);
+    }
+
+    @Test
+    @WithMockUser(username = USER_1_USERNAME, authorities = {"execute-query"})
+    public void create_forbiddenKeyword_fails() {
+        final ExecuteStatementDto request = ExecuteStatementDto.builder()
+                .statement("SELECT COUNT(id) FROM tbl")
+                .build();
+
+        /* mock */
+        when(httpServletRequest.getMethod())
+                .thenReturn("POST");
+
+        /* test */
+        assertThrows(QueryNotSupportedException.class, () -> {
+            subsetEndpoint.create(DATABASE_3_ID, request, USER_1_PRINCIPAL, httpServletRequest, null, 0L, 10L);
+        });
+    }
+
+    @Test
+    @WithMockUser(username = USER_1_USERNAME, authorities = {"execute-query"})
+    public void create_noPageSize_succeeds() throws UserNotFoundException, QueryStoreInsertException,
+            TableMalformedException, NotAllowedException, QueryNotSupportedException,
+            PaginationException, StorageNotFoundException, DatabaseUnavailableException, StorageUnavailableException,
+            QueryMalformedException, QueryNotFoundException, DatabaseNotFoundException, RemoteUnavailableException,
+            SQLException, MetadataServiceException, TableNotFoundException, ViewMalformedException,
+            ViewNotFoundException {
+        final Dataset<Row> mock = sparkSession.emptyDataFrame();
+        final ExecuteStatementDto request = ExecuteStatementDto.builder()
+                .statement(QUERY_5_STATEMENT)
+                .build();
+
+        /* mock */
+        when(metadataServiceGateway.getDatabaseById(DATABASE_3_ID))
+                .thenReturn(DATABASE_3_PRIVILEGED_DTO);
+        when(subsetService.getData(eq(DATABASE_3_PRIVILEGED_DTO), any(QueryDto.class), eq(0L), eq(10L)))
+                .thenReturn(mock);
+
+        /* test */
+        subsetEndpoint.create(DATABASE_3_ID, request, USER_1_PRINCIPAL, httpServletRequest, null, null, null);
+    }
+
+    @Test
+    @WithMockUser(username = USER_1_USERNAME, authorities = {"execute-query"})
+    public void create_unavailable_succeeds() throws DatabaseNotFoundException, RemoteUnavailableException,
+            SQLException, MetadataServiceException, QueryMalformedException, TableNotFoundException,
+            ViewMalformedException {
+        final ExecuteStatementDto request = ExecuteStatementDto.builder()
+                .statement(QUERY_5_STATEMENT)
+                .build();
+
+        /* mock */
+        when(metadataServiceGateway.getDatabaseById(DATABASE_3_ID))
+                .thenReturn(DATABASE_3_PRIVILEGED_DTO);
+        doThrow(SQLException.class)
+                .when(subsetService)
+                .getData(eq(DATABASE_3_PRIVILEGED_DTO), any(QueryDto.class), eq(0L), eq(10L));
+        when(httpServletRequest.getMethod())
+                .thenReturn("POST");
+
+        /* test */
+        assertThrows(DatabaseUnavailableException.class, () -> {
+            subsetEndpoint.create(DATABASE_3_ID, request, USER_1_PRINCIPAL, httpServletRequest, null, null, null);
+        });
+    }
+
+    @Test
+    @WithMockUser(username = USER_1_USERNAME, authorities = {"execute-query"})
+    public void create_databaseNotFound_fails() throws RemoteUnavailableException,
+            DatabaseNotFoundException, MetadataServiceException {
+        final ExecuteStatementDto request = ExecuteStatementDto.builder()
+                .statement(QUERY_5_STATEMENT)
+                .build();
+
+        /* mock */
+        doThrow(DatabaseNotFoundException.class)
+                .when(metadataServiceGateway)
+                .getDatabaseById(DATABASE_3_ID);
+        when(httpServletRequest.getMethod())
+                .thenReturn("POST");
+
+        /* test */
+        assertThrows(DatabaseNotFoundException.class, () -> {
+            subsetEndpoint.create(DATABASE_3_ID, request, USER_1_PRINCIPAL, httpServletRequest, null, null, null);
+        });
+    }
+
+    @Test
+    @WithMockUser(username = USER_4_USERNAME)
+    public void create_noRole_fails() throws DatabaseNotFoundException, RemoteUnavailableException,
+            MetadataServiceException, UserNotFoundException, QueryStoreInsertException, TableMalformedException,
+            NotAllowedException, SQLException, QueryNotFoundException, DatabaseUnavailableException,
+            StorageUnavailableException, QueryMalformedException, QueryNotSupportedException, PaginationException,
+            StorageNotFoundException, TableNotFoundException, ViewMalformedException, ViewNotFoundException {
+        final Dataset<Row> mock = sparkSession.emptyDataFrame();
+        final ExecuteStatementDto request = ExecuteStatementDto.builder()
+                .statement(QUERY_5_STATEMENT)
+                .build();
+
+        /* mock */
+        when(metadataServiceGateway.getDatabaseById(DATABASE_3_ID))
+                .thenReturn(DATABASE_3_PRIVILEGED_DTO);
+        when(subsetService.getData(eq(DATABASE_3_PRIVILEGED_DTO), any(QueryDto.class), eq(0L), eq(10L)))
+                .thenReturn(mock);
+        when(httpServletRequest.getMethod())
+                .thenReturn("POST");
+
+        /* test */
+        subsetEndpoint.create(DATABASE_3_ID, request, USER_4_PRINCIPAL, httpServletRequest, null, null, null);
+    }
+
+    @Test
+    @WithAnonymousUser
+    public void create_anonymous_succeeds() throws DatabaseNotFoundException, RemoteUnavailableException,
+            MetadataServiceException, UserNotFoundException, QueryStoreInsertException, TableMalformedException,
+            NotAllowedException, SQLException, QueryNotFoundException, DatabaseUnavailableException,
+            StorageUnavailableException, QueryMalformedException, QueryNotSupportedException, PaginationException,
+            StorageNotFoundException, TableNotFoundException, ViewMalformedException, ViewNotFoundException {
+        final Dataset<Row> mock = sparkSession.emptyDataFrame();
+        final ExecuteStatementDto request = ExecuteStatementDto.builder()
+                .statement(QUERY_5_STATEMENT)
+                .build();
+
+        /* mock */
+        when(metadataServiceGateway.getDatabaseById(DATABASE_3_ID))
+                .thenReturn(DATABASE_3_PRIVILEGED_DTO);
+        when(subsetService.getData(eq(DATABASE_3_PRIVILEGED_DTO), any(QueryDto.class), eq(0L), eq(10L)))
+                .thenReturn(mock);
+        when(httpServletRequest.getMethod())
+                .thenReturn("POST");
+
+        /* test */
+        subsetEndpoint.create(DATABASE_3_ID, request, null, httpServletRequest, null, null, null);
+    }
 
-//    @Test
-//    @WithMockUser(username = USER_1_USERNAME, authorities = {"execute-query"})
-//    public void create_noPageSize_succeeds() throws UserNotFoundException, QueryStoreInsertException,
-//            TableMalformedException, NotAllowedException, QueryNotSupportedException,
-//            PaginationException, StorageNotFoundException, DatabaseUnavailableException, StorageUnavailableException,
-//            QueryMalformedException, QueryNotFoundException, DatabaseNotFoundException, RemoteUnavailableException,
-//            SQLException, MetadataServiceException {
-//        final ExecuteStatementDto request = ExecuteStatementDto.builder()
-//                .statement(QUERY_5_STATEMENT)
-//                .build();
-//
-//        /* mock */
-//        when(metadataServiceGateway.getDatabaseById(DATABASE_3_ID))
-//                .thenReturn(DATABASE_3_PRIVILEGED_DTO);
-//        when(subsetService.execute(eq(DATABASE_3_PRIVILEGED_DTO), anyString(), any(Instant.class), eq(USER_1_ID), eq(0L), eq(10L), eq(null), eq(null)))
-//                .thenReturn(QUERY_5_RESULT_DTO);
-//
-//        /* test */
-//        subsetEndpoint.create(DATABASE_3_ID, request, USER_1_PRINCIPAL, null, null, null);
-//    }
-//
-//    @Test
-//    @WithMockUser(username = USER_1_USERNAME, authorities = {"execute-query"})
-//    public void create_unavailable_succeeds() throws UserNotFoundException, QueryStoreInsertException,
-//            TableMalformedException, NotAllowedException, QueryNotFoundException, DatabaseNotFoundException,
-//            RemoteUnavailableException, SQLException, MetadataServiceException, QueryMalformedException {
-//        final ExecuteStatementDto request = ExecuteStatementDto.builder()
-//                .statement(QUERY_5_STATEMENT)
-//                .build();
-//
-//        /* mock */
-//        when(metadataServiceGateway.getDatabaseById(DATABASE_3_ID))
-//                .thenReturn(DATABASE_3_PRIVILEGED_DTO);
-//        doThrow(SQLException.class)
-//                .when(subsetService)
-//                .execute(eq(DATABASE_3_PRIVILEGED_DTO), anyString(), any(Instant.class), eq(USER_1_ID), eq(0L), eq(10L), eq(null), eq(null));
-//
-//        /* test */
-//        assertThrows(DatabaseUnavailableException.class, () -> {
-//            subsetEndpoint.create(DATABASE_3_ID, request, USER_1_PRINCIPAL, null, null, null);
-//        });
-//    }
-//
-//    @Test
-//    @WithMockUser(username = USER_1_USERNAME, authorities = {"execute-query"})
-//    public void create_databaseNotFound_fails() throws RemoteUnavailableException,
-//            DatabaseNotFoundException, MetadataServiceException {
-//        final ExecuteStatementDto request = ExecuteStatementDto.builder()
-//                .statement(QUERY_5_STATEMENT)
-//                .build();
-//
-//        /* mock */
-//        doThrow(DatabaseNotFoundException.class)
-//                .when(metadataServiceGateway)
-//                .getDatabaseById(DATABASE_3_ID);
-//
-//        /* test */
-//        assertThrows(DatabaseNotFoundException.class, () -> {
-//            subsetEndpoint.create(DATABASE_3_ID, request, USER_1_PRINCIPAL, null, null, null);
-//        });
-//    }
-//
-//    @Test
-//    @WithMockUser(username = USER_4_USERNAME)
-//    public void create_noRole_fails() throws DatabaseNotFoundException, RemoteUnavailableException,
-//            MetadataServiceException, UserNotFoundException, QueryStoreInsertException, TableMalformedException,
-//            NotAllowedException, SQLException, QueryNotFoundException, DatabaseUnavailableException,
-//            StorageUnavailableException, QueryMalformedException, QueryNotSupportedException, PaginationException,
-//            StorageNotFoundException {
-//        final ExecuteStatementDto request = ExecuteStatementDto.builder()
-//                .statement(QUERY_5_STATEMENT)
-//                .build();
-//
-//        /* mock */
-//        when(metadataServiceGateway.getDatabaseById(DATABASE_3_ID))
-//                .thenReturn(DATABASE_3_PRIVILEGED_DTO);
-//        when(subsetService.execute(eq(DATABASE_3_PRIVILEGED_DTO), anyString(), any(Instant.class), eq(USER_4_ID), eq(0L), eq(10L), eq(null), eq(null)))
-//                .thenReturn(QUERY_5_RESULT_DTO);
-//
-//        /* test */
-//        subsetEndpoint.create(DATABASE_3_ID, request, USER_4_PRINCIPAL, null, null, null);
-//    }
-//
-//    @Test
-//    @WithAnonymousUser
-//    public void create_anonymous_succeeds() throws DatabaseNotFoundException, RemoteUnavailableException,
-//            MetadataServiceException, UserNotFoundException, QueryStoreInsertException, TableMalformedException,
-//            NotAllowedException, SQLException, QueryNotFoundException, DatabaseUnavailableException,
-//            StorageUnavailableException, QueryMalformedException, QueryNotSupportedException, PaginationException,
-//            StorageNotFoundException {
-//        final ExecuteStatementDto request = ExecuteStatementDto.builder()
-//                .statement(QUERY_5_STATEMENT)
-//                .build();
-//
-//        /* mock */
-//        when(metadataServiceGateway.getDatabaseById(DATABASE_3_ID))
-//                .thenReturn(DATABASE_3_PRIVILEGED_DTO);
-//        when(subsetService.execute(eq(DATABASE_3_PRIVILEGED_DTO), anyString(), any(Instant.class), eq(null), eq(0L), eq(10L), eq(null), eq(null)))
-//                .thenReturn(QUERY_5_RESULT_DTO);
-//
-//        /* test */
-//        subsetEndpoint.create(DATABASE_3_ID, request, null, null, null, null);
-//    }
-//
 //    @Test
 //    public void getData_succeeds() throws DatabaseNotFoundException, RemoteUnavailableException, UserNotFoundException,
 //            NotAllowedException, SQLException, QueryNotFoundException, TableMalformedException, QueryMalformedException,
@@ -645,19 +664,19 @@ public class SubsetEndpointUnitTest extends AbstractUnitTest {
         return response.getBody();
     }
 
-//    protected void generic_findById(Long subsetId, MediaType accept, Instant timestamp) throws UserNotFoundException,
-//            DatabaseUnavailableException, StorageUnavailableException, QueryMalformedException, QueryNotFoundException,
-//            DatabaseNotFoundException, RemoteUnavailableException, FormatNotAvailableException, MalformedException,
-//            StorageNotFoundException, MetadataServiceException, ViewNotFoundException, TableNotFoundException {
-//
-//        /* mock */
-//        when(mockHttpServletRequest.getHeader("Accept"))
-//                .thenReturn(accept.toString());
-//
-//        /* test */
-//        final ResponseEntity<?> response = subsetEndpoint.findById(DATABASE_3_ID, subsetId, mockHttpServletRequest, timestamp);
-//        assertEquals(HttpStatus.OK, response.getStatusCode());
-//        assertNotNull(response.getBody());
-//    }
+    protected void generic_findById(Long subsetId, MediaType accept, Instant timestamp) throws UserNotFoundException,
+            DatabaseUnavailableException, StorageUnavailableException, QueryMalformedException, QueryNotFoundException,
+            DatabaseNotFoundException, RemoteUnavailableException, FormatNotAvailableException,
+            MetadataServiceException, TableNotFoundException, ViewMalformedException, SQLException {
+
+        /* mock */
+        when(mockHttpServletRequest.getHeader("Accept"))
+                .thenReturn(accept.toString());
+
+        /* test */
+        final ResponseEntity<?> response = subsetEndpoint.findById(DATABASE_3_ID, subsetId, mockHttpServletRequest, timestamp);
+        assertEquals(HttpStatus.OK, response.getStatusCode());
+        assertNotNull(response.getBody());
+    }
 
 }
diff --git a/dbrepo-data-service/rest-service/src/test/java/at/tuwien/service/SubsetServiceIntegrationTest.java b/dbrepo-data-service/rest-service/src/test/java/at/tuwien/service/SubsetServiceIntegrationTest.java
index f4b6eee2ae..215e919844 100644
--- a/dbrepo-data-service/rest-service/src/test/java/at/tuwien/service/SubsetServiceIntegrationTest.java
+++ b/dbrepo-data-service/rest-service/src/test/java/at/tuwien/service/SubsetServiceIntegrationTest.java
@@ -4,9 +4,7 @@ import at.tuwien.api.database.query.QueryDto;
 import at.tuwien.api.identifier.IdentifierDto;
 import at.tuwien.config.MariaDbConfig;
 import at.tuwien.config.MariaDbContainerConfig;
-import at.tuwien.config.S3Config;
 import at.tuwien.exception.*;
-import at.tuwien.gateway.AnalyseServiceGateway;
 import at.tuwien.gateway.MetadataServiceGateway;
 import at.tuwien.test.AbstractUnitTest;
 import lombok.extern.log4j.Log4j2;
@@ -40,18 +38,9 @@ public class SubsetServiceIntegrationTest extends AbstractUnitTest {
     @MockBean
     private MetadataServiceGateway metadataServiceGateway;
 
-    @MockBean
-    private AnalyseServiceGateway dataDatabaseSidecarGateway;
-
-    @MockBean
-    private StorageService storageService;
-
     @Container
     private static MariaDBContainer<?> mariaDBContainer = MariaDbContainerConfig.getContainer();
 
-    @Autowired
-    private S3Config s3Config;
-
     @BeforeEach
     public void beforeEach() throws SQLException {
         genesis();
@@ -60,138 +49,6 @@ public class SubsetServiceIntegrationTest extends AbstractUnitTest {
         MariaDbConfig.createInitDatabase(CONTAINER_1_PRIVILEGED_DTO, DATABASE_1_DTO);
     }
 
-//    @Test
-//    public void execute_succeeds() throws QueryStoreInsertException, TableMalformedException, SQLException,
-//            QueryNotFoundException, UserNotFoundException, NotAllowedException, RemoteUnavailableException,
-//            MetadataServiceException, DatabaseNotFoundException, InterruptedException {
-//
-//        /* pre-condition */
-//        Thread.sleep(1000) /* wait for test container some more */;
-//
-//        /* mock */
-//        when(metadataServiceGateway.getUserById(QUERY_1_CREATED_BY))
-//                .thenReturn(QUERY_1_CREATOR);
-//
-//        /* test */
-//        final QueryResultDto response = queryService.execute(DATABASE_1_PRIVILEGED_DTO, QUERY_1_STATEMENT, Instant.now(), USER_1_ID, 0L, 10L, null, null);
-//        assertNotNull(response);
-//        assertNotNull(response.getId());
-//        assertNotNull(response.getHeaders());
-//        assertEquals(5, response.getHeaders().size());
-//        assertEquals(List.of(Map.of("id", 0), Map.of("date", 1), Map.of("location", 2), Map.of("mintemp", 3), Map.of("rainfall", 4)), response.getHeaders());
-//        assertNotNull(response.getResult());
-//        assertEquals(3, response.getResult().size());
-//        /* row 0 */
-//        assertEquals(BigInteger.valueOf(1L), response.getResult().get(0).get("id"));
-//        assertEquals(Instant.ofEpochSecond(1228089600), response.getResult().get(0).get("date"));
-//        assertEquals("Albury", response.getResult().get(0).get("location"));
-//        assertEquals(13.4, response.getResult().get(0).get("mintemp"));
-//        assertEquals(0.6, response.getResult().get(0).get("rainfall"));
-//        /* row 1 */
-//        assertEquals(BigInteger.valueOf(2L), response.getResult().get(1).get("id"));
-//        assertEquals(Instant.ofEpochSecond(1228176000), response.getResult().get(1).get("date"));
-//        assertEquals("Albury", response.getResult().get(1).get("location"));
-//        assertEquals(7.4, response.getResult().get(1).get("mintemp"));
-//        assertEquals(0.0, response.getResult().get(1).get("rainfall"));
-//        /* row 2 */
-//        assertEquals(BigInteger.valueOf(3L), response.getResult().get(2).get("id"));
-//        assertEquals(Instant.ofEpochSecond(1228262400), response.getResult().get(2).get("date"));
-//        assertEquals("Albury", response.getResult().get(2).get("location"));
-//        assertEquals(12.9, response.getResult().get(2).get("mintemp"));
-//        assertEquals(0.0, response.getResult().get(2).get("rainfall"));
-//    }
-//
-//    @Test
-//    public void execute_joinWithAlias_succeeds() throws QueryStoreInsertException, TableMalformedException,
-//            SQLException, QueryNotFoundException, UserNotFoundException, NotAllowedException,
-//            RemoteUnavailableException, MetadataServiceException, DatabaseNotFoundException, InterruptedException {
-//
-//        /* pre-condition */
-//        Thread.sleep(1000) /* wait for test container some more */;
-//
-//        /* mock */
-//        when(metadataServiceGateway.getUserById(QUERY_1_CREATED_BY))
-//                .thenReturn(QUERY_1_CREATOR);
-//
-//        /* test */
-//        final QueryResultDto response = queryService.execute(DATABASE_1_PRIVILEGED_DTO, QUERY_7_STATEMENT, Instant.now(), USER_1_ID, 0L, 10L, null, null);
-//        assertNotNull(response);
-//        assertNotNull(response.getId());
-//        assertNotNull(response.getHeaders());
-//        assertEquals(5, response.getHeaders().size());
-//        assertEquals(List.of(Map.of("id", 0), Map.of("date", 1), Map.of("location", 2), Map.of("lat", 3), Map.of("lng", 4)), response.getHeaders());
-//        assertNotNull(response.getResult());
-//        assertEquals(1, response.getResult().size());
-//        /* row 0 */
-//        assertEquals(BigInteger.valueOf(1L), response.getResult().get(0).get("id"));
-//        assertEquals(Instant.ofEpochSecond(1228089600), response.getResult().get(0).get("date"));
-//        assertEquals("Albury", response.getResult().get(0).get("location"));
-//        assertEquals(-36.0653583, response.getResult().get(0).get("lat"));
-//        assertEquals(146.9112214, response.getResult().get(0).get("lng"));
-//    }
-//
-//    @Test
-//    public void execute_oneResult_succeeds() throws QueryStoreInsertException, TableMalformedException, SQLException,
-//            QueryNotFoundException, UserNotFoundException, NotAllowedException, RemoteUnavailableException,
-//            MetadataServiceException, DatabaseNotFoundException, InterruptedException {
-//
-//        /* pre-condition */
-//        Thread.sleep(1000) /* wait for test container some more */;
-//
-//        /* mock */
-//        when(metadataServiceGateway.getIdentifiers(DATABASE_1_ID, QUERY_1_ID))
-//                .thenReturn(List.of(IDENTIFIER_2_DTO));
-//        when(metadataServiceGateway.getUserById(QUERY_1_CREATED_BY))
-//                .thenReturn(QUERY_1_CREATOR);
-//
-//        /* test */
-//        final QueryResultDto response = queryService.execute(DATABASE_1_PRIVILEGED_DTO, QUERY_1_STATEMENT, Instant.now(), USER_1_ID, 0L, 1L, null, null);
-//        assertNotNull(response);
-//        assertNotNull(response.getId());
-//        assertNotNull(response.getHeaders());
-//        assertEquals(5, response.getHeaders().size());
-//        assertEquals(List.of(Map.of("id", 0), Map.of("date", 1), Map.of("location", 2), Map.of("mintemp", 3), Map.of("rainfall", 4)), response.getHeaders());
-//        assertNotNull(response.getResult());
-//        assertEquals(1, response.getResult().size());
-//        /* row 0 */
-//        assertEquals(BigInteger.valueOf(1L), response.getResult().get(0).get("id"));
-//        assertEquals(Instant.ofEpochSecond(1228089600), response.getResult().get(0).get("date"));
-//        assertEquals("Albury", response.getResult().get(0).get("location"));
-//        assertEquals(13.4, response.getResult().get(0).get("mintemp"));
-//        assertEquals(0.6, response.getResult().get(0).get("rainfall"));
-//    }
-//
-//    @Test
-//    public void execute_oneResultPagination_succeeds() throws QueryStoreInsertException, TableMalformedException,
-//            SQLException, QueryNotFoundException, UserNotFoundException, NotAllowedException,
-//            RemoteUnavailableException, MetadataServiceException, DatabaseNotFoundException, InterruptedException {
-//
-//        /* pre-condition */
-//        Thread.sleep(1000) /* wait for test container some more */;
-//
-//        /* mock */
-//        when(metadataServiceGateway.getUserById(USER_1_ID))
-//                .thenReturn(USER_1_DTO);
-//        when(metadataServiceGateway.getIdentifiers(eq(DATABASE_1_ID), anyLong()))
-//                .thenReturn(List.of());
-//
-//        /* test */
-//        final QueryResultDto response = queryService.execute(DATABASE_1_PRIVILEGED_DTO, QUERY_1_STATEMENT, Instant.now(), USER_1_ID, 1L, 1L, null, null);
-//        assertNotNull(response);
-//        assertNotNull(response.getId());
-//        assertNotNull(response.getHeaders());
-//        assertEquals(5, response.getHeaders().size());
-//        assertEquals(List.of(Map.of("id", 0), Map.of("date", 1), Map.of("location", 2), Map.of("mintemp", 3), Map.of("rainfall", 4)), response.getHeaders());
-//        assertNotNull(response.getResult());
-//        assertEquals(1, response.getResult().size());
-//        /* row 1 */
-//        assertEquals(BigInteger.valueOf(2L), response.getResult().get(0).get("id"));
-//        assertEquals(Instant.ofEpochSecond(1228176000), response.getResult().get(0).get("date"));
-//        assertEquals("Albury", response.getResult().get(0).get("location"));
-//        assertEquals(7.4, response.getResult().get(0).get("mintemp"));
-//        assertEquals(0.0, response.getResult().get(0).get("rainfall"));
-//    }
-
     @Test
     public void findAll_succeeds() throws SQLException, QueryNotFoundException, RemoteUnavailableException,
             MetadataServiceException, DatabaseNotFoundException, InterruptedException {
@@ -291,18 +148,6 @@ public class SubsetServiceIntegrationTest extends AbstractUnitTest {
         });
     }
 
-//    @Test
-//    public void export_succeeds() throws SQLException, StorageUnavailableException, QueryMalformedException,
-//            RemoteUnavailableException, IOException, StorageNotFoundException, InterruptedException,
-//            AnalyseServiceException, ViewNotFoundException, MalformedException, TableNotFoundException {
-//
-//        /* mock */
-//        MariaDbConfig.dropQueryStore(DATABASE_1_PRIVILEGED_DTO);
-//
-//        /* test */
-//        export_generic();
-//    }
-
     protected void findById_generic(Long queryId) throws RemoteUnavailableException, SQLException,
             UserNotFoundException, QueryNotFoundException, MetadataServiceException, DatabaseNotFoundException,
             InterruptedException {
@@ -369,26 +214,4 @@ public class SubsetServiceIntegrationTest extends AbstractUnitTest {
         assertEquals(0, response.size());
     }
 
-//    protected void export_generic() throws StorageUnavailableException, SQLException, RemoteUnavailableException,
-//            QueryMalformedException, StorageNotFoundException, IOException, InterruptedException,
-//            AnalyseServiceException, ViewNotFoundException, MalformedException, TableNotFoundException {
-//        final String filename = RandomStringUtils.randomAlphanumeric(40).toLowerCase() + ".tmp";
-//        EXPORT_RESOURCE_DTO.setFilename(filename);
-//
-//        /* pre-condition */
-//        Thread.sleep(1000) /* wait for test container some more */;
-//
-//        /* mock */
-//        doNothing()
-//                .when(dataDatabaseSidecarGateway)
-//                .exportTable(anyLong(), anyLong());
-//        when(storageService.transformDataset(any(Dataset.class)))
-//                .thenReturn(EXPORT_RESOURCE_DTO);
-//
-//        /* test */
-//        final ExportResourceDto response = queryService.export(DATABASE_1_PRIVILEGED_DTO, QUERY_1_DTO, Instant.now());
-//        assertEquals(filename, response.getFilename());
-//        assertNotNull(response.getResource().getInputStream());
-//    }
-
 }
diff --git a/dbrepo-data-service/rest-service/src/test/java/at/tuwien/service/TableServiceIntegrationTest.java b/dbrepo-data-service/rest-service/src/test/java/at/tuwien/service/TableServiceIntegrationTest.java
index 950f5c0910..e2a48631d5 100644
--- a/dbrepo-data-service/rest-service/src/test/java/at/tuwien/service/TableServiceIntegrationTest.java
+++ b/dbrepo-data-service/rest-service/src/test/java/at/tuwien/service/TableServiceIntegrationTest.java
@@ -16,7 +16,6 @@ import at.tuwien.api.database.table.internal.TableCreateDto;
 import at.tuwien.config.MariaDbConfig;
 import at.tuwien.config.MariaDbContainerConfig;
 import at.tuwien.exception.*;
-import at.tuwien.gateway.AnalyseServiceGateway;
 import at.tuwien.gateway.MetadataServiceGateway;
 import at.tuwien.test.AbstractUnitTest;
 import lombok.extern.log4j.Log4j2;
@@ -51,9 +50,6 @@ public class TableServiceIntegrationTest extends AbstractUnitTest {
     @MockBean
     private MetadataServiceGateway metadataServiceGateway;
 
-    @MockBean
-    private AnalyseServiceGateway dataDatabaseSidecarGateway;
-
     @MockBean
     private StorageService storageService;
 
@@ -667,49 +663,6 @@ public class TableServiceIntegrationTest extends AbstractUnitTest {
         });
     }
 
-//    @Test
-//    public void getPaginatedData_succeeds() throws SQLException, TableMalformedException {
-//
-//        /* test */
-//        final QueryResultDto response = tableService.getPaginatedData(TABLE_1_PRIVILEGED_DTO, null, 0L, 10L);
-//        assertEquals(TABLE_1_ID, response.getId());
-//        final List<Map<String, Integer>> headers = response.getHeaders();
-//        assertEquals(5, headers.size());
-//        assertEquals(0, headers.get(0).get("id"));
-//        assertEquals(1, headers.get(1).get("date"));
-//        assertEquals(2, headers.get(2).get("location"));
-//        assertEquals(3, headers.get(3).get("mintemp"));
-//        assertEquals(4, headers.get(4).get("rainfall"));
-//        final List<Map<String, Object>> result = response.getResult();
-//        assertEquals(Instant.ofEpochSecond(1228089600), result.get(0).get("date"));
-//        assertEquals(0.6, result.get(0).get("rainfall"));
-//        assertEquals("Albury", result.get(0).get("location"));
-//        assertEquals(BigInteger.valueOf(1L), result.get(0).get("id"));
-//        assertEquals(13.4, result.get(0).get("mintemp"));
-//        assertEquals(Instant.ofEpochSecond(1228176000), result.get(1).get("date"));
-//        assertEquals(0.0, result.get(1).get("rainfall"));
-//        assertEquals("Albury", result.get(1).get("location"));
-//        assertEquals(BigInteger.valueOf(2L), result.get(1).get("id"));
-//        assertEquals(7.4, result.get(1).get("mintemp"));
-//        assertEquals(Instant.ofEpochSecond(1228262400), result.get(2).get("date"));
-//        assertEquals(0.0, result.get(2).get("rainfall"));
-//        assertEquals("Albury", result.get(2).get("location"));
-//        assertEquals(BigInteger.valueOf(3L), result.get(2).get("id"));
-//        assertEquals(12.9, result.get(2).get("mintemp"));
-//    }
-
-//    @Test
-//    public void getPaginatedData_notFound_fails() throws SQLException {
-//
-//        /* mock */
-//        MariaDbConfig.createDatabase(CONTAINER_1_PRIVILEGED_DTO, DATABASE_2_INTERNALNAME);
-//
-//        /* test */
-//        assertThrows(TableMalformedException.class, () -> {
-//            tableService.getPaginatedData(TABLE_5_PRIVILEGED_DTO, null, 0L, 10L);
-//        });
-//    }
-
     @Test
     public void history_succeeds() throws SQLException, TableNotFoundException {
 
@@ -734,36 +687,4 @@ public class TableServiceIntegrationTest extends AbstractUnitTest {
         });
     }
 
-//    @Test
-//    public void exportTable_succeeds() throws QueryMalformedException, RemoteUnavailableException,
-//            StorageNotFoundException, StorageUnavailableException, AnalyseServiceException, TableNotFoundException,
-//            MalformedException {
-//        final ExportResourceDto mock = ExportResourceDto.builder()
-//                .filename("weather_aus.csv")
-//                .resource(new InputStreamResource(InputStream.nullInputStream()))
-//                .build();
-//
-//        /* mock */
-//        doNothing()
-//                .when(dataDatabaseSidecarGateway)
-//                .exportTable(anyLong(), anyLong());
-//        when(storageService.getResource("weather_aus.csv"))
-//                .thenReturn(mock);
-//
-//        /* test */
-//        final ExportResourceDto response = tableService.exportDataset(TABLE_1_PRIVILEGED_DTO, null);
-//    }
-//
-//    @Test
-//    public void exportDataset_malformedData_fails() throws SQLException {
-//
-//        /* mock */
-//        MariaDbConfig.createDatabase(CONTAINER_1_PRIVILEGED_DTO, DATABASE_2_INTERNALNAME);
-//
-//        /* test */
-//        assertThrows(QueryMalformedException.class, () -> {
-//            tableService.exportDataset(TABLE_5_PRIVILEGED_DTO, null);
-//        });
-//    }
-
 }
diff --git a/dbrepo-data-service/rest-service/src/test/java/at/tuwien/service/ViewServiceIntegrationTest.java b/dbrepo-data-service/rest-service/src/test/java/at/tuwien/service/ViewServiceIntegrationTest.java
index b1958a8bac..f3b309cba4 100644
--- a/dbrepo-data-service/rest-service/src/test/java/at/tuwien/service/ViewServiceIntegrationTest.java
+++ b/dbrepo-data-service/rest-service/src/test/java/at/tuwien/service/ViewServiceIntegrationTest.java
@@ -72,36 +72,6 @@ public class ViewServiceIntegrationTest extends AbstractUnitTest {
 
     }
 
-//    @Test
-//    public void data_succeeds() throws SQLException, ViewMalformedException {
-//
-//        /* test */
-//        final QueryResultDto response = viewService.data(VIEW_2_PRIVILEGED_DTO, Instant.now(), 0L, 10L);
-//        assertNotNull(response);
-//        assertNotNull(response.getId());
-//        assertEquals(VIEW_2_ID, response.getId());
-//        assertNotNull(response.getHeaders());
-//        assertEquals(4, response.getHeaders().size());
-//        assertEquals(List.of(Map.of("date", 0), Map.of("loc", 1), Map.of("mintemp", 2), Map.of("rainfall", 3)), response.getHeaders());
-//        assertNotNull(response.getResult());
-//        assertEquals(3, response.getResult().size());
-//        /* row 0 */
-//        assertEquals(Instant.ofEpochSecond(1228089600), response.getResult().get(0).get("date"));
-//        assertEquals("Albury", response.getResult().get(0).get("loc"));
-//        assertEquals(13.4, response.getResult().get(0).get("mintemp"));
-//        assertEquals(0.6, response.getResult().get(0).get("rainfall"));
-//        /* row 1 */
-//        assertEquals(Instant.ofEpochSecond(1228176000), response.getResult().get(1).get("date"));
-//        assertEquals("Albury", response.getResult().get(1).get("loc"));
-//        assertEquals(7.4, response.getResult().get(1).get("mintemp"));
-//        assertEquals(0.0, response.getResult().get(1).get("rainfall"));
-//        /* row 2 */
-//        assertEquals(Instant.ofEpochSecond(1228262400), response.getResult().get(2).get("date"));
-//        assertEquals("Albury", response.getResult().get(2).get("loc"));
-//        assertEquals(12.9, response.getResult().get(2).get("mintemp"));
-//        assertEquals(0.0, response.getResult().get(2).get("rainfall"));
-//    }
-
     @Test
     public void getSchemas_succeeds() throws SQLException, ViewNotFoundException, DatabaseMalformedException {
 
-- 
GitLab