diff --git a/dbrepo-metadata-service/repositories/src/main/java/at/tuwien/mapper/MetadataMapper.java b/dbrepo-metadata-service/repositories/src/main/java/at/tuwien/mapper/MetadataMapper.java index 8972f04ea4c39373c625dfbd627f3d884961ecda..71f52235cdcf5231b021095d926436548cd893b1 100644 --- a/dbrepo-metadata-service/repositories/src/main/java/at/tuwien/mapper/MetadataMapper.java +++ b/dbrepo-metadata-service/repositories/src/main/java/at/tuwien/mapper/MetadataMapper.java @@ -561,39 +561,41 @@ public interface MetadataMapper { table.setMaxDataLength(data.getMaxDataLength()); table.setDataLength(data.getDataLength()); table.setNumRows(data.getNumRows()); - table.getConstraints() - .getPrimaryKey() - .forEach(pk -> { - pk.getTable().setDatabaseId(data.getDatabase().getId()); - pk.getColumn().setTableId(data.getId()); - pk.getColumn().setDatabaseId(data.getDatabase().getId()); - }); - table.getConstraints() - .getForeignKeys() - .forEach(fk -> { - fk.getTable().setDatabaseId(table.getTdbid()); - fk.getReferencedTable().setDatabaseId(table.getTdbid()); - fk.getReferences() - .forEach(ref -> { - ref.setForeignKey(foreignKeyDtoToForeignKeyBriefDto(fk)); - ref.getColumn().setTableId(table.getId()); - ref.getColumn().setDatabaseId(table.getTdbid()); - ref.getReferencedColumn().setTableId(fk.getReferencedTable().getId()); - ref.getReferencedColumn().setDatabaseId(table.getTdbid()); - }); - }); - table.getConstraints() - .getUniques() - .forEach(uk -> { - uk.getTable().setDatabaseId(data.getDatabase().getId()); - uk.getColumns() - .forEach(column -> { - column.setTableId(data.getId()); - column.setDatabaseId(data.getDatabase().getId()); - }); - }); - if (data.getConstraints().getChecks() == null || data.getConstraints().getChecks().isEmpty()) { - table.getConstraints().setChecks(new LinkedHashSet<>()); + if (table.getConstraints() != null) { + table.getConstraints() + .getPrimaryKey() + .forEach(pk -> { + pk.getTable().setDatabaseId(data.getDatabase().getId()); + pk.getColumn().setTableId(data.getId()); + pk.getColumn().setDatabaseId(data.getDatabase().getId()); + }); + table.getConstraints() + .getForeignKeys() + .forEach(fk -> { + fk.getTable().setDatabaseId(table.getTdbid()); + fk.getReferencedTable().setDatabaseId(table.getTdbid()); + fk.getReferences() + .forEach(ref -> { + ref.setForeignKey(foreignKeyDtoToForeignKeyBriefDto(fk)); + ref.getColumn().setTableId(table.getId()); + ref.getColumn().setDatabaseId(table.getTdbid()); + ref.getReferencedColumn().setTableId(fk.getReferencedTable().getId()); + ref.getReferencedColumn().setDatabaseId(table.getTdbid()); + }); + }); + table.getConstraints() + .getUniques() + .forEach(uk -> { + uk.getTable().setDatabaseId(data.getDatabase().getId()); + uk.getColumns() + .forEach(column -> { + column.setTableId(data.getId()); + column.setDatabaseId(data.getDatabase().getId()); + }); + }); + if (data.getConstraints().getChecks() == null || data.getConstraints().getChecks().isEmpty()) { + table.getConstraints().setChecks(new LinkedHashSet<>()); + } } if (data.getColumns() != null) { table.setColumns(new LinkedList<>(data.getColumns() diff --git a/dbrepo-metadata-service/rest-service/src/test/java/at/tuwien/endpoints/TableEndpointUnitTest.java b/dbrepo-metadata-service/rest-service/src/test/java/at/tuwien/endpoints/TableEndpointUnitTest.java index 8f72fe57dc24b2a7f50201df3737f786aad47ee7..51e1548b486d98003009c217ebbe61dcc064de29 100644 --- a/dbrepo-metadata-service/rest-service/src/test/java/at/tuwien/endpoints/TableEndpointUnitTest.java +++ b/dbrepo-metadata-service/rest-service/src/test/java/at/tuwien/endpoints/TableEndpointUnitTest.java @@ -101,11 +101,21 @@ public class TableEndpointUnitTest extends AbstractUnitTest { @Test @WithAnonymousUser - public void list_publicAnonymous_succeeds() throws NotAllowedException, UserNotFoundException, + public void list_publicDataPrivateSchemaAnonymous_fails() { + + /* test */ + assertThrows(NotAllowedException.class, () -> { + generic_list(DATABASE_3_ID, DATABASE_3, null, null, null); + }); + } + + @Test + @WithAnonymousUser + public void list_publicDataPublicSchemaAnonymous_succeeds() throws UserNotFoundException, NotAllowedException, DatabaseNotFoundException, AccessNotFoundException { /* test */ - generic_list(DATABASE_3_ID, DATABASE_3, null, null, null); + generic_list(DATABASE_4_ID, DATABASE_4, null, null, null); } @Test @@ -132,10 +142,12 @@ public class TableEndpointUnitTest extends AbstractUnitTest { @Test @WithMockUser(username = USER_4_USERNAME) - public void list_publicNoRole_succeeds() throws NotAllowedException, UserNotFoundException, DatabaseNotFoundException, AccessNotFoundException { + public void list_publicDataPrivateSchemaNoRole_fails() { /* test */ - generic_list(DATABASE_3_ID, DATABASE_3, USER_4_PRINCIPAL, USER_4, null); + assertThrows(NotAllowedException.class, () -> { + generic_list(DATABASE_3_ID, DATABASE_3, USER_4_PRINCIPAL, USER_4, null); + }); } @Test @@ -511,12 +523,24 @@ public class TableEndpointUnitTest extends AbstractUnitTest { @Test @WithAnonymousUser - public void findById_publicAnonymous_succeeds() throws DataServiceException, DataServiceConnectionException, - TableNotFoundException, DatabaseNotFoundException, AccessNotFoundException, QueueNotFoundException, - UserNotFoundException, NotAllowedException { + public void findById_publicDatabasePrivateDataPrivateSchemaAnonymous_succeeds() throws UserNotFoundException, + TableNotFoundException, NotAllowedException, DataServiceException, DatabaseNotFoundException, AccessNotFoundException, QueueNotFoundException, DataServiceConnectionException { /* test */ - generic_findById(DATABASE_3_ID, DATABASE_3, TABLE_8_ID, TABLE_8, null, null, null); + final ResponseEntity<TableDto> response = generic_findById(DATABASE_3_ID, DATABASE_3, TABLE_8_ID, TABLE_8, null, null, null); + final TableDto body = response.getBody(); + assertNull(body.getConstraints()); + assertEquals(List.of(), body.getColumns()); + } + + @Test + @WithAnonymousUser + public void findById_publicDataPublicSchemaAnonymous_succeeds() throws DataServiceException, + DataServiceConnectionException, TableNotFoundException, DatabaseNotFoundException, AccessNotFoundException, + QueueNotFoundException, UserNotFoundException, NotAllowedException { + + /* test */ + generic_findById(DATABASE_4_ID, DATABASE_4, TABLE_9_ID, TABLE_9, null, null, null); } @Test @@ -898,12 +922,12 @@ public class TableEndpointUnitTest extends AbstractUnitTest { @Test @WithAnonymousUser - public void findById_privateAnonymous_succeeds() throws DataServiceException, DataServiceConnectionException, - TableNotFoundException, DatabaseNotFoundException, AccessNotFoundException, QueueNotFoundException, - UserNotFoundException, NotAllowedException { + public void findById_privateDatabasePrivateDataPublicSchemaAnonymous_fails() { /* test */ - generic_findById(DATABASE_1_ID, DATABASE_1, TABLE_1_ID, TABLE_1, null, null, null); + assertThrows(NotAllowedException.class, () -> { + generic_findById(DATABASE_1_ID, DATABASE_1, TABLE_2_ID, TABLE_2, null, null, null); + }); } @Test @@ -941,12 +965,12 @@ public class TableEndpointUnitTest extends AbstractUnitTest { @Test @WithMockUser(username = USER_4_USERNAME) - public void findById_privateNoRole_succeeds() throws DataServiceException, DataServiceConnectionException, - TableNotFoundException, DatabaseNotFoundException, AccessNotFoundException, QueueNotFoundException, - UserNotFoundException, NotAllowedException { + public void findById_privateNoRole_fails() { /* test */ - generic_findById(DATABASE_1_ID, DATABASE_1, TABLE_1_ID, TABLE_1, USER_4_PRINCIPAL, USER_4, null); + assertThrows(NotAllowedException.class, () -> { + generic_findById(DATABASE_1_ID, DATABASE_1, TABLE_1_ID, TABLE_1, USER_4_PRINCIPAL, USER_4, null); + }); } @Test @@ -1132,7 +1156,7 @@ public class TableEndpointUnitTest extends AbstractUnitTest { /* mock */ if (principal != null) { - when(userService.findByUsername(principal.getName())) + when(userService.findById(user.getId())) .thenReturn(user); } if (database != null) { @@ -1180,7 +1204,7 @@ public class TableEndpointUnitTest extends AbstractUnitTest { .findById(any(Database.class), eq(tableId)); } if (principal != null) { - when(userService.findByUsername(principal.getName())) + when(userService.findById(user.getId())) .thenReturn(user); when(accessService.find(any(Database.class), eq(user))) .thenReturn(access); @@ -1231,7 +1255,7 @@ public class TableEndpointUnitTest extends AbstractUnitTest { } if (principal != null) { log.trace("mock user {}", user); - when(userService.findByUsername(principal.getName())) + when(userService.findById(user.getId())) .thenReturn(user); } if (access != null) { diff --git a/dbrepo-metadata-service/rest-service/src/test/java/at/tuwien/endpoints/ViewEndpointUnitTest.java b/dbrepo-metadata-service/rest-service/src/test/java/at/tuwien/endpoints/ViewEndpointUnitTest.java index ccd8b067de4d002a5f358f47734b85f86ff6cfc8..68ea32083b8c8846845b10e459e098c5aa58342f 100644 --- a/dbrepo-metadata-service/rest-service/src/test/java/at/tuwien/endpoints/ViewEndpointUnitTest.java +++ b/dbrepo-metadata-service/rest-service/src/test/java/at/tuwien/endpoints/ViewEndpointUnitTest.java @@ -429,7 +429,7 @@ public class ViewEndpointUnitTest extends AbstractUnitTest { when(databaseService.findById(databaseId)) .thenReturn(database); if (principal != null) { - when(userService.findByUsername(user.getUsername())) + when(userService.findById(userId)) .thenReturn(user); } if (access != null) { @@ -471,7 +471,7 @@ public class ViewEndpointUnitTest extends AbstractUnitTest { when(databaseService.findById(databaseId)) .thenReturn(database); if (principal != null) { - when(userService.findByUsername(principal.getName())) + when(userService.findById(userId)) .thenReturn(user); } if (access != null) { @@ -511,7 +511,7 @@ public class ViewEndpointUnitTest extends AbstractUnitTest { .thenThrow(AccessNotFoundException.class); } if (principal != null) { - when(userService.findByUsername(principal.getName())) + when(userService.findById(userId)) .thenReturn(user); when(viewService.findById(any(Database.class), anyLong())) .thenReturn(VIEW_1); diff --git a/dbrepo-metadata-service/rest-service/src/test/resources/init/weather_at.sql b/dbrepo-metadata-service/rest-service/src/test/resources/init/weather_at.sql new file mode 100644 index 0000000000000000000000000000000000000000..d02e1945506e5d66bb17dd10582f81814b940ad1 --- /dev/null +++ b/dbrepo-metadata-service/rest-service/src/test/resources/init/weather_at.sql @@ -0,0 +1,11 @@ +CREATE +DATABASE weather_at; +USE +weather_at; + +CREATE TABLE weather_location +( + location VARCHAR(255) PRIMARY KEY, + lat DOUBLE PRECISION NULL, + lng DOUBLE PRECISION NULL +) WITH SYSTEM VERSIONING COMMENT 'Weather location'; \ No newline at end of file diff --git a/dbrepo-metadata-service/test/src/main/java/at/tuwien/test/AbstractUnitTest.java b/dbrepo-metadata-service/test/src/main/java/at/tuwien/test/AbstractUnitTest.java index 887c61501b3b4c40bfaebcfb11f8b9fc95be6adb..8a7db23fe064c8d88a656bdc0992250cb5b79522 100644 --- a/dbrepo-metadata-service/test/src/main/java/at/tuwien/test/AbstractUnitTest.java +++ b/dbrepo-metadata-service/test/src/main/java/at/tuwien/test/AbstractUnitTest.java @@ -138,6 +138,11 @@ public abstract class AbstractUnitTest extends BaseTest { VIEW_5_DTO.setColumns(VIEW_5_COLUMNS_DTO); IDENTIFIER_6.setDatabase(DATABASE_3); /* DATABASE 4 */ + TABLE_9.setDatabase(DATABASE_4); + TABLE_9.setColumns(TABLE_9_COLUMNS); + TABLE_9.setConstraints(TABLE_9_CONSTRAINTS); + TABLE_9_DTO.setColumns(TABLE_9_COLUMNS_DTO); + TABLE_9_DTO.setConstraints(TABLE_9_CONSTRAINTS_DTO); DATABASE_4.setSubsets(new LinkedList<>()); DATABASE_4.setAccesses(new LinkedList<>(List.of(DATABASE_4_USER_1_READ_ACCESS, DATABASE_4_USER_2_WRITE_OWN_ACCESS, DATABASE_4_USER_3_WRITE_ALL_ACCESS))); DATABASE_4.setIdentifiers(new LinkedList<>(List.of(IDENTIFIER_7))); diff --git a/dbrepo-metadata-service/test/src/main/java/at/tuwien/test/BaseTest.java b/dbrepo-metadata-service/test/src/main/java/at/tuwien/test/BaseTest.java index 2859a30a7134109b7db625d491b353a39ff9e5e2..13a68c4e3e207603b446219b9859bf0742939529 100644 --- a/dbrepo-metadata-service/test/src/main/java/at/tuwien/test/BaseTest.java +++ b/dbrepo-metadata-service/test/src/main/java/at/tuwien/test/BaseTest.java @@ -111,8 +111,8 @@ import static java.time.temporal.ChronoUnit.MINUTES; /** * Database 1 (Private Data, Private Schema, User 1) -> Container 1 * <ul> - * <li>Table 1</li> - * <li>Table 2</li> + * <li>Table 1 (Private Data, Private Schema)</li> + * <li>Table 2 (Private Data, Public Schema)</li> * <li>Table 3</li> * <li>Table 4</li> * <li>Query 1</li> @@ -147,6 +147,7 @@ import static java.time.temporal.ChronoUnit.MINUTES; * </ul> * <p> * Database 4 (Public Data, Public Schema, User 4) -> Container 4 + * <li>Table 9</li> * <li>Identifier 7 (Database=4)</li> * <ul> * </ul> @@ -424,6 +425,7 @@ public abstract class BaseTest { @SuppressWarnings("java:S2068") public final static String USER_LOCAL_ADMIN_PASSWORD = "admin"; public final static String USER_LOCAL_ADMIN_THEME = "dark"; + public final static Boolean USER_LOCAL_ADMIN_IS_INTERNAL = true; public final static String USER_LOCAL_ADMIN_EMAIL = "admin@local"; @SuppressWarnings("java:S2068") public final static String USER_LOCAL_ADMIN_MARIADB_PASSWORD = "*440BA4FD1A87A0999647DB67C0EE258198B247BA"; @@ -440,6 +442,7 @@ public abstract class BaseTest { .email(USER_LOCAL_ADMIN_EMAIL) .mariadbPassword(USER_LOCAL_ADMIN_MARIADB_PASSWORD) .theme(USER_LOCAL_ADMIN_THEME) + .isInternal(USER_LOCAL_ADMIN_IS_INTERNAL) .build(); public final static Principal USER_LOCAL_ADMIN_PRINCIPAL = new UsernamePasswordAuthenticationToken(USER_LOCAL_ADMIN_DETAILS, @@ -469,6 +472,7 @@ public abstract class BaseTest { public final static Boolean USER_1_TOTP = false; public final static Long USER_1_NOT_BEFORE = 0L; public final static Boolean USER_1_ENABLED = true; + public final static Boolean USER_1_IS_INTERNAL = false; public final static String USER_1_THEME = "light"; public final static String USER_1_LANGUAGE = "en"; public final static Instant USER_1_CREATED = Instant.ofEpochSecond(1677399441L) /* 2023-02-26 08:17:21 (UTC) */; @@ -531,6 +535,7 @@ public abstract class BaseTest { .theme(USER_1_THEME) .mariadbPassword(USER_1_DATABASE_PASSWORD) .language(USER_1_LANGUAGE) + .isInternal(USER_1_IS_INTERNAL) .build(); public final static UserDto USER_1_DTO = UserDto.builder() @@ -617,6 +622,7 @@ public abstract class BaseTest { public final static Boolean USER_2_TOTP = false; public final static Long USER_2_NOT_BEFORE = 0L; public final static Boolean USER_2_ENABLED = true; + public final static Boolean USER_2_IS_INTERNAL = false; public final static String USER_2_THEME = "light"; public final static String USER_2_LANGUAGE = "de"; public final static Instant USER_2_CREATED = Instant.ofEpochSecond(1677399528L) /* 2023-02-26 08:18:48 (UTC) */; @@ -642,6 +648,7 @@ public abstract class BaseTest { .theme(USER_2_THEME) .mariadbPassword(USER_2_DATABASE_PASSWORD) .language(USER_2_LANGUAGE) + .isInternal(USER_2_IS_INTERNAL) .build(); public final static UserDto USER_2_DTO = UserDto.builder() @@ -723,6 +730,7 @@ public abstract class BaseTest { public final static Boolean USER_3_TOTP = false; public final static Long USER_3_NOT_BEFORE = 0L; public final static Boolean USER_3_ENABLED = true; + public final static Boolean USER_3_IS_INTERNAL = false; public final static String USER_3_THEME = "light"; public final static Instant USER_3_CREATED = Instant.ofEpochSecond(1677399559L) /* 2023-02-26 08:19:19 (UTC) */; public final static UUID USER_3_REALM_ID = REALM_DBREPO_ID; @@ -744,6 +752,7 @@ public abstract class BaseTest { .orcid(USER_3_ORCID_URL) .theme(USER_3_THEME) .mariadbPassword(USER_3_DATABASE_PASSWORD) + .isInternal(USER_2_IS_INTERNAL) .build(); public final static UserDto USER_3_DTO = UserDto.builder() @@ -813,6 +822,7 @@ public abstract class BaseTest { public final static String USER_4_EMAIL = "junit4@ossdip.at"; public final static Boolean USER_4_VERIFIED = true; public final static Boolean USER_4_ENABLED = true; + public final static Boolean USER_4_IS_INTERNAL = false; public final static String USER_4_THEME = "light"; public final static Instant USER_4_CREATED = Instant.ofEpochSecond(1677399592L) /* 2023-02-26 08:19:52 (UTC) */; public final static UUID USER_4_REALM_ID = REALM_DBREPO_ID; @@ -834,6 +844,7 @@ public abstract class BaseTest { .orcid(USER_4_ORCID_URL) .theme(USER_4_THEME) .mariadbPassword(USER_4_DATABASE_PASSWORD) + .isInternal(USER_4_IS_INTERNAL) .build(); public final static UserDto USER_4_DTO = UserDto.builder() @@ -888,6 +899,7 @@ public abstract class BaseTest { public final static String USER_5_EMAIL = "system@ossdip.at"; public final static Boolean USER_5_VERIFIED = true; public final static Boolean USER_5_ENABLED = true; + public final static Boolean USER_5_IS_INTERNAL = false; public final static String USER_5_THEME = "dark"; public final static Instant USER_5_CREATED = Instant.ofEpochSecond(1677399592L) /* 2023-02-26 08:19:52 (UTC) */; public final static UUID USER_5_REALM_ID = REALM_DBREPO_ID; @@ -946,6 +958,7 @@ public abstract class BaseTest { .affiliation(USER_5_AFFILIATION) .theme(USER_5_THEME) .mariadbPassword(USER_5_DATABASE_PASSWORD) + .isInternal(USER_5_IS_INTERNAL) .build(); public final static UUID USER_6_ID = UUID.fromString("28ff851d-d7bc-4422-959c-edd7a5b15630"); @@ -962,6 +975,7 @@ public abstract class BaseTest { public final static String USER_6_EMAIL = "system@ossdip.at"; public final static Boolean USER_6_VERIFIED = true; public final static Boolean USER_6_ENABLED = true; + public final static Boolean USER_6_IS_INTERNAL = false; public final static Boolean USER_6_THEME_DARK = false; public final static Instant USER_6_CREATED = Instant.ofEpochSecond(1677399592L) /* 2023-02-26 08:19:52 (UTC) */; public final static UUID USER_6_REALM_ID = REALM_DBREPO_ID; @@ -1716,7 +1730,7 @@ public abstract class BaseTest { public final static String TABLE_2_INTERNALNAME = "weather_location"; public final static Boolean TABLE_2_VERSIONED = true; public final static Boolean TABLE_2_IS_PUBLIC = false; - public final static Boolean TABLE_2_SCHEMA_PUBLIC = false; + public final static Boolean TABLE_2_SCHEMA_PUBLIC = true; public final static Boolean TABLE_2_PROCESSED_CONSTRAINTS = true; public final static String TABLE_2_DESCRIPTION = "Weather location"; public final static String TABLE_2_QUEUE_NAME = TABLE_2_INTERNALNAME; @@ -2267,7 +2281,7 @@ public abstract class BaseTest { public final static Long TABLE_8_ID = 8L; public final static Long TABLE_8_DATABASE_ID = DATABASE_3_ID; - public final static String TABLE_8_NAME = "mfcc"; + public final static String TABLE_8_NAME = "location"; public final static String TABLE_8_INTERNAL_NAME = "mfcc"; public final static Boolean TABLE_8_VERSIONED = true; public final static Boolean TABLE_8_IS_PUBLIC = false; @@ -2340,6 +2354,202 @@ public abstract class BaseTest { .lastRetrieved(Instant.now()) .build(); + public final static Long TABLE_9_ID = 9L; + public final static Long TABLE_9_DATABASE_ID = DATABASE_4_ID; + public final static String TABLE_9_NAME = "mfcc"; + public final static String TABLE_9_INTERNAL_NAME = "mfcc"; + public final static Boolean TABLE_9_VERSIONED = true; + public final static Boolean TABLE_9_IS_PUBLIC = false; + public final static Boolean TABLE_9_SCHEMA_PUBLIC = true; + public final static Boolean TABLE_9_PROCESSED_CONSTRAINTS = true; + public final static String TABLE_9_DESCRIPTION = "Hello mfcc"; + public final static String TABLE_9_QUEUE_NAME = TABLE_9_INTERNAL_NAME; + public final static String TABLE_9_ROUTING_KEY = "dbrepo\\." + DATABASE_3_ID + "\\." + TABLE_9_ID; + public final static Instant TABLE_9_CREATED = Instant.ofEpochSecond(1688400185L) /* 2023-02-26 08:29:35 (UTC) */; + public final static Instant TABLE_9_LAST_MODIFIED = Instant.ofEpochSecond(1688400185L) /* 2023-02-26 08:29:35 (UTC) */; + + public final static Table TABLE_9 = Table.builder() + .id(TABLE_9_ID) + .tdbid(TABLE_9_DATABASE_ID) + .internalName(TABLE_9_INTERNAL_NAME) + .description(TABLE_9_DESCRIPTION) + .isVersioned(TABLE_9_VERSIONED) + .isPublic(TABLE_9_IS_PUBLIC) + .isSchemaPublic(TABLE_9_SCHEMA_PUBLIC) + .database(null /* DATABASE_1 */) + .name(TABLE_9_NAME) + .queueName(TABLE_9_QUEUE_NAME) + .columns(new LinkedList<>()) /* TABLE_9_COLUMNS */ + .constraints(null) /* TABLE_9_CONSTRAINTS */ + .ownedBy(USER_1_ID) + .owner(USER_1) + .created(TABLE_9_CREATED) + .lastModified(TABLE_9_LAST_MODIFIED) + .build(); + + public final static TableDto TABLE_9_DTO = TableDto.builder() + .id(TABLE_9_ID) + .tdbid(TABLE_9_DATABASE_ID) + .internalName(TABLE_9_INTERNAL_NAME) + .description(TABLE_9_DESCRIPTION) + .isVersioned(TABLE_9_VERSIONED) + .isPublic(TABLE_9_IS_PUBLIC) + .isSchemaPublic(TABLE_9_SCHEMA_PUBLIC) + .name(TABLE_9_NAME) + .queueName(TABLE_9_QUEUE_NAME) + .columns(new LinkedList<>()) /* TABLE_9_COLUMNS_DTO */ + .constraints(null) /* TABLE_9_CONSTRAINTS_DTO */ + .owner(USER_1_BRIEF_DTO) + .build(); + + public final static TableBriefDto TABLE_9_BRIEF_DTO = TableBriefDto.builder() + .id(TABLE_9_ID) + .internalName(TABLE_9_INTERNAL_NAME) + .description(TABLE_9_DESCRIPTION) + .isVersioned(TABLE_9_VERSIONED) + .isPublic(TABLE_9_IS_PUBLIC) + .isSchemaPublic(TABLE_9_SCHEMA_PUBLIC) + .name(TABLE_9_NAME) + .ownedBy(USER_1_ID) + .build(); + + public final static PrivilegedTableDto TABLE_9_PRIVILEGED_DTO = PrivilegedTableDto.builder() + .id(TABLE_9_ID) + .tdbid(TABLE_9_DATABASE_ID) + .internalName(TABLE_9_INTERNAL_NAME) + .description(TABLE_9_DESCRIPTION) + .isVersioned(TABLE_9_VERSIONED) + .isPublic(TABLE_9_IS_PUBLIC) + .isSchemaPublic(TABLE_9_SCHEMA_PUBLIC) + .name(TABLE_9_NAME) + .queueName(TABLE_9_QUEUE_NAME) + .columns(new LinkedList<>()) /* TABLE_9_COLUMNS_DTO */ + .owner(USER_1_BRIEF_DTO) + .isPublic(DATABASE_3_PUBLIC) + .lastRetrieved(Instant.now()) + .build(); + + public final static Long COLUMN_9_1_ID = 78L; + public final static String COLUMN_9_1_NAME = "location"; + public final static String COLUMN_9_1_INTERNAL_NAME = "location"; + + public final static ColumnBriefDto TABLE_9_COLUMNS_BRIEF_0_DTO = ColumnBriefDto.builder() + .id(COLUMN_9_1_ID) + .name(COLUMN_9_1_NAME) + .internalName(COLUMN_9_1_INTERNAL_NAME) + .columnType(ColumnTypeDto.BIGINT) + .build(); + + public final static Long COLUMN_9_2_ID = 79L; + + public final static Long COLUMN_9_3_ID = 80L; + + public final static List<TableColumn> TABLE_9_COLUMNS = List.of(TableColumn.builder() + .id(COLUMN_9_1_ID) + .ordinalPosition(0) + .table(TABLE_9) + .name(COLUMN_9_1_NAME) + .internalName(COLUMN_9_1_INTERNAL_NAME) + .ordinalPosition(0) + .columnType(TableColumnType.VARCHAR) + .size(255L) + .isNullAllowed(false) + .enums(null) + .sets(null) + .build(), + TableColumn.builder() + .id(COLUMN_9_2_ID) + .ordinalPosition(1) + .table(TABLE_9) + .name("lat") + .internalName("lat") + .ordinalPosition(1) + .columnType(TableColumnType.DECIMAL) + .size(10L) + .d(0L) + .isNullAllowed(true) + .enums(null) + .sets(null) + .build(), + TableColumn.builder() + .id(COLUMN_9_3_ID) + .ordinalPosition(2) + .table(TABLE_9) + .name("lng") + .internalName("lng") + .ordinalPosition(2) + .columnType(TableColumnType.DECIMAL) + .size(10L) + .d(0L) + .isNullAllowed(true) + .enums(null) + .sets(null) + .build()); + + public final static List<ColumnDto> TABLE_9_COLUMNS_DTO = List.of(ColumnDto.builder() + .id(COLUMN_9_1_ID) + .ordinalPosition(0) + .table(TABLE_9_DTO) + .name(COLUMN_9_1_NAME) + .internalName(COLUMN_9_1_INTERNAL_NAME) + .ordinalPosition(0) + .columnType(ColumnTypeDto.VARCHAR) + .size(255L) + .isNullAllowed(false) + .enums(null) + .sets(null) + .build(), + ColumnDto.builder() + .id(COLUMN_9_2_ID) + .ordinalPosition(1) + .table(TABLE_9_DTO) + .name("lat") + .internalName("lat") + .ordinalPosition(1) + .columnType(ColumnTypeDto.DECIMAL) + .size(10L) + .d(0L) + .isNullAllowed(true) + .enums(null) + .sets(null) + .build(), + ColumnDto.builder() + .id(COLUMN_9_3_ID) + .ordinalPosition(2) + .table(TABLE_9_DTO) + .name("lng") + .internalName("lng") + .ordinalPosition(2) + .columnType(ColumnTypeDto.DECIMAL) + .size(10L) + .d(0L) + .isNullAllowed(true) + .enums(null) + .sets(null) + .build()); + + public final static Constraints TABLE_9_CONSTRAINTS = Constraints.builder() + .checks(new LinkedHashSet<>()) + .foreignKeys(new LinkedList<>()) + .uniques(new LinkedList<>()) + .primaryKey(new LinkedList<>(List.of(PrimaryKey.builder() + .table(TABLE_9) + .column(TABLE_9_COLUMNS.get(0)) + .id(9L) + .build()))) + .build(); + + public final static ConstraintsDto TABLE_9_CONSTRAINTS_DTO = ConstraintsDto.builder() + .checks(new LinkedHashSet<>()) + .foreignKeys(new LinkedList<>()) + .uniques(new LinkedList<>()) + .primaryKey(new LinkedHashSet<>(Set.of(PrimaryKeyDto.builder() + .table(TABLE_9_BRIEF_DTO) + .column(TABLE_9_COLUMNS_BRIEF_0_DTO) + .id(9L) + .build()))) + .build(); + public final static String QUEUE_NAME = "dbrepo"; public final static String QUEUE_VHOST = "dbrepo"; public final static Boolean QUEUE_AUTO_DELETE = false;