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 66d33a8c3a767c37ec638382613a2cd80276ec97..9ab7082d0eb40da175947314c13b669de9f02476 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 @@ -368,7 +368,7 @@ public class SubsetEndpointUnitTest extends AbstractUnitTest { /* 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_LOCAL_ADMIN_ID), eq(0L), eq(10L), eq(null), eq(null))) + 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 */ diff --git a/dbrepo-data-service/rest-service/src/test/java/at/tuwien/gateway/MetadataServiceGatewayUnitTest.java b/dbrepo-data-service/rest-service/src/test/java/at/tuwien/gateway/MetadataServiceGatewayUnitTest.java index c224af4cb28604c2554da1942a782932db8d7390..44b01b1e9e2919721e446d7e183fbbcb739ea813 100644 --- a/dbrepo-data-service/rest-service/src/test/java/at/tuwien/gateway/MetadataServiceGatewayUnitTest.java +++ b/dbrepo-data-service/rest-service/src/test/java/at/tuwien/gateway/MetadataServiceGatewayUnitTest.java @@ -175,8 +175,12 @@ public class MetadataServiceGatewayUnitTest extends AbstractUnitTest { MetadataServiceException { /* mock */ + final HttpHeaders headers = new HttpHeaders(); + headers.set("X-Username", CONTAINER_1_PRIVILEGED_USERNAME); + headers.set("X-Password", CONTAINER_1_PRIVILEGED_PASSWORD); when(restTemplate.exchange(anyString(), eq(HttpMethod.GET), eq(HttpEntity.EMPTY), eq(PrivilegedDatabaseDto[].class))) .thenReturn(ResponseEntity.status(HttpStatus.OK) + .headers(headers) .body(new PrivilegedDatabaseDto[]{DATABASE_1_PRIVILEGED_DTO})); /* test */ @@ -221,7 +225,7 @@ public class MetadataServiceGatewayUnitTest extends AbstractUnitTest { .build()); /* test */ - assertThrows(MetadataServiceException.class, () -> { + assertThrows(DatabaseNotFoundException.class, () -> { metadataServiceGateway.getDatabaseByInternalName(DATABASE_1_INTERNALNAME); }); } 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 26251caa62a7e2806ba11cc0ad41e0fd002ca8c1..f21fc0e5399610af4d28d217d9866de9687a00d8 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 @@ -763,30 +763,6 @@ public class TableServiceIntegrationTest extends AbstractUnitTest { }); } - @Test - public void importDataset_malformedData_fails() throws RemoteUnavailableException, StorageNotFoundException, - IOException, SidecarImportException { - final ImportDto request = ImportDto.builder() - .location("weather_aus.csv") - .separator(';') - .quote('"') - .build(); - - /* mock */ - final File source = new File("src/test/resources/csv/weather_aus.csv"); - final File target = new File("/tmp/weather_aus.csv"); - log.trace("copy dataset from {} to {}", source.toPath().toAbsolutePath(), target.toPath().toAbsolutePath()); - FileUtils.copyFile(source, target); - doNothing() - .when(dataDatabaseSidecarGateway) - .importFile(anyString(), anyInt(), eq("weather_aus.csv")); - - /* test */ - assertThrows(QueryMalformedException.class, () -> { - tableService.importDataset(TABLE_1_PRIVILEGED_DTO, request); - }); - } - @Test public void exportDataset_succeeds() throws SQLException, QueryMalformedException, RemoteUnavailableException, StorageNotFoundException, StorageUnavailableException, SidecarExportException { diff --git a/dbrepo-data-service/services/src/main/java/at/tuwien/mapper/MariaDbMapper.java b/dbrepo-data-service/services/src/main/java/at/tuwien/mapper/MariaDbMapper.java index 607ada8d043fa8489b43fbe8d4e3855493b72c8a..0e0a94f4279b9be83f8ce660a9b5e6948228f4b4 100644 --- a/dbrepo-data-service/services/src/main/java/at/tuwien/mapper/MariaDbMapper.java +++ b/dbrepo-data-service/services/src/main/java/at/tuwien/mapper/MariaDbMapper.java @@ -1,19 +1,26 @@ package at.tuwien.mapper; import at.tuwien.api.database.query.ImportDto; -import at.tuwien.api.database.table.*; -import at.tuwien.api.database.table.columns.*; +import at.tuwien.api.database.table.TupleDeleteDto; +import at.tuwien.api.database.table.TupleDto; +import at.tuwien.api.database.table.TupleUpdateDto; +import at.tuwien.api.database.table.columns.ColumnCreateDto; +import at.tuwien.api.database.table.columns.ColumnDto; +import at.tuwien.api.database.table.columns.ColumnTypeDto; import at.tuwien.api.database.table.internal.PrivilegedTableDto; -import at.tuwien.exception.*; +import at.tuwien.exception.QueryMalformedException; +import at.tuwien.exception.TableMalformedException; import at.tuwien.utils.MariaDbUtil; import org.mapstruct.Mapper; import org.mapstruct.Named; -import java.io.*; -import java.sql.*; +import java.io.ByteArrayInputStream; +import java.io.InputStream; import java.sql.Date; +import java.sql.*; import java.text.Normalizer; -import java.time.*; +import java.time.Instant; +import java.time.ZoneId; import java.time.format.DateTimeFormatter; import java.util.*; import java.util.regex.Pattern; @@ -561,11 +568,17 @@ public interface MariaDbMapper { .append(data.getQuote()) .append("'"); } - statement.append(" LINES TERMINATED BY '") - .append(data.getLineTermination()) - .append("'") - .append(data.getSkipLines() != null ? (" IGNORE " + data.getSkipLines() + " LINES") : "") - .append(" ("); + if (data.getLineTermination() != null) { + statement.append(" LINES TERMINATED BY '") + .append(data.getLineTermination()) + .append("'"); + } + if (data.getSkipLines() != null) { + statement.append(" IGNORE") + .append(data.getSkipLines()) + .append(" LINES"); + } + statement.append(" ("); final StringBuilder set = new StringBuilder(); int[] idx = new int[]{0}; table.getColumns() diff --git a/dbrepo-ui/nuxt.config.ts b/dbrepo-ui/nuxt.config.ts index f07d9aa0dd42dbfa330c65f36ae361c859a2d3c4..1e725d621302b5416b9139642a773de9787c4c6e 100644 --- a/dbrepo-ui/nuxt.config.ts +++ b/dbrepo-ui/nuxt.config.ts @@ -104,11 +104,11 @@ export default defineNuxtConfig({ links: { keycloak: { text: 'Auth Service', - href: '/api/auth/' + href: 'http://localhost/api/auth/' }, grafana: { text: 'Dashboard Service', - href: '/dashboard/' + href: 'http://localhost:3000/dashboard/' } } }