Skip to content
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 @@ -975,15 +975,7 @@ class DatasetControllerTests : ControllerTestBase() {
sourceName = TEST_FILE_NAME,
description = newPartDescription,
tags = newPartTags,
type = DatasetPartTypeEnum.File)),
security =
DatasetSecurity(
default = ROLE_NONE,
accessControlList =
mutableListOf(
DatasetAccessControl(id = PLATFORM_ADMIN_EMAIL, role = ROLE_ADMIN),
DatasetAccessControl(
id = ORGANIZATION_USER_EMAIL, role = ROLE_VIEWER))))
type = DatasetPartTypeEnum.File)))

val datasetUpdateRequestMultipartFile =
MockMultipartFile(
Expand Down Expand Up @@ -1039,7 +1031,7 @@ class DatasetControllerTests : ControllerTestBase() {
.andExpect(jsonPath("$.security.default").value(ROLE_NONE))
.andExpect(jsonPath("$.security.accessControlList[0].role").value(ROLE_ADMIN))
.andExpect(jsonPath("$.security.accessControlList[0].id").value(PLATFORM_ADMIN_EMAIL))
.andExpect(jsonPath("$.security.accessControlList[1].role").value(ROLE_VIEWER))
.andExpect(jsonPath("$.security.accessControlList[1].role").value(ROLE_EDITOR))
.andExpect(jsonPath("$.security.accessControlList[1].id").value(ORGANIZATION_USER_EMAIL))
.andDo(MockMvcResultHandlers.print())
.andDo(
Expand Down Expand Up @@ -1070,18 +1062,7 @@ class DatasetControllerTests : ControllerTestBase() {
val newTags = mutableListOf("tag1_updated", "tag2_updated")

val datasetUpdateRequest =
DatasetUpdateRequest(
name = newName,
description = newDescription,
tags = newTags,
security =
DatasetSecurity(
default = ROLE_NONE,
accessControlList =
mutableListOf(
DatasetAccessControl(id = PLATFORM_ADMIN_EMAIL, role = ROLE_ADMIN),
DatasetAccessControl(
id = ORGANIZATION_USER_EMAIL, role = ROLE_VIEWER))))
DatasetUpdateRequest(name = newName, description = newDescription, tags = newTags)

val datasetUpdateRequestMultipartFile =
MockMultipartFile(
Expand Down Expand Up @@ -1129,7 +1110,7 @@ class DatasetControllerTests : ControllerTestBase() {
.andExpect(jsonPath("$.security.default").value(ROLE_NONE))
.andExpect(jsonPath("$.security.accessControlList[0].role").value(ROLE_ADMIN))
.andExpect(jsonPath("$.security.accessControlList[0].id").value(PLATFORM_ADMIN_EMAIL))
.andExpect(jsonPath("$.security.accessControlList[1].role").value(ROLE_VIEWER))
.andExpect(jsonPath("$.security.accessControlList[1].role").value(ROLE_EDITOR))
.andExpect(jsonPath("$.security.accessControlList[1].id").value(ORGANIZATION_USER_EMAIL))
.andDo(MockMvcResultHandlers.print())
}
Expand Down Expand Up @@ -1158,18 +1139,7 @@ class DatasetControllerTests : ControllerTestBase() {

val datasetUpdateRequest =
DatasetUpdateRequest(
name = newName,
description = newDescription,
tags = newTags,
parts = mutableListOf(),
security =
DatasetSecurity(
default = ROLE_NONE,
accessControlList =
mutableListOf(
DatasetAccessControl(id = PLATFORM_ADMIN_EMAIL, role = ROLE_ADMIN),
DatasetAccessControl(
id = ORGANIZATION_USER_EMAIL, role = ROLE_VIEWER))))
name = newName, description = newDescription, tags = newTags, parts = mutableListOf())

val datasetUpdateRequestMultipartFile =
MockMultipartFile(
Expand Down Expand Up @@ -1205,7 +1175,7 @@ class DatasetControllerTests : ControllerTestBase() {
.andExpect(jsonPath("$.security.default").value(ROLE_NONE))
.andExpect(jsonPath("$.security.accessControlList[0].role").value(ROLE_ADMIN))
.andExpect(jsonPath("$.security.accessControlList[0].id").value(PLATFORM_ADMIN_EMAIL))
.andExpect(jsonPath("$.security.accessControlList[1].role").value(ROLE_VIEWER))
.andExpect(jsonPath("$.security.accessControlList[1].role").value(ROLE_EDITOR))
.andExpect(jsonPath("$.security.accessControlList[1].id").value(ORGANIZATION_USER_EMAIL))
.andDo(MockMvcResultHandlers.print())
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2304,13 +2304,22 @@ class DatasetServiceIntegrationTest() : CsmTestBase() {
val datasetTags = mutableListOf("dataset", "public", "customers")
val datasetAdditionalData =
mutableMapOf("dataset" to "data", "complex" to mutableMapOf("nested" to "data"))

val datasetSecurity =
DatasetSecurity(
default = ROLE_NONE,
accessControlList =
mutableListOf(
DatasetAccessControl(CONNECTED_ADMIN_USER, ROLE_ADMIN),
DatasetAccessControl(CONNECTED_DEFAULT_USER, ROLE_EDITOR)))
val datasetCreateRequest =
DatasetCreateRequest(
name = datasetName,
description = datasetDescription,
tags = datasetTags,
additionalData = datasetAdditionalData,
parts = mutableListOf(datasetPartCreateRequest))
parts = mutableListOf(datasetPartCreateRequest),
security = datasetSecurity)

val resourceTestFile = resourceLoader.getResource("classpath:/$CUSTOMER_SOURCE_FILE_NAME").file

Expand Down Expand Up @@ -2348,21 +2357,13 @@ class DatasetServiceIntegrationTest() : CsmTestBase() {
val newDatasetDescription = "Dataset for shop"
val newDatasetTags = mutableListOf("dataset", "public", "shop")
val newDatasetAdditionalData = mutableMapOf<String, Any>("dataset" to "new data")
val newDatasetSecurity =
DatasetSecurity(
default = ROLE_NONE,
accessControlList =
mutableListOf(
DatasetAccessControl(CONNECTED_ADMIN_USER, ROLE_ADMIN),
DatasetAccessControl(CONNECTED_DEFAULT_USER, ROLE_EDITOR)))
val datasetUpdateRequest =
DatasetUpdateRequest(
name = newDatasetName,
description = newDatasetDescription,
tags = newDatasetTags,
additionalData = newDatasetAdditionalData,
parts = mutableListOf(newDatasetPartCreateRequest),
security = newDatasetSecurity)
parts = mutableListOf(newDatasetPartCreateRequest))

val newDatasetPartTestFile =
resourceLoader.getResource("classpath:/$INVENTORY_SOURCE_FILE_NAME").file
Expand All @@ -2389,7 +2390,7 @@ class DatasetServiceIntegrationTest() : CsmTestBase() {
assertEquals(newDatasetName, updatedDataset.name)
assertEquals(newDatasetDescription, updatedDataset.description)
assertEquals(newDatasetTags, updatedDataset.tags)
assertEquals(newDatasetSecurity, updatedDataset.security)
assertEquals(datasetSecurity, updatedDataset.security)
assertEquals(createdDataset.createInfo, updatedDataset.createInfo)
assertEquals(createdDataset.updateInfo.userId, updatedDataset.updateInfo.userId)
assertTrue(createdDataset.updateInfo.timestamp < updatedDataset.updateInfo.timestamp)
Expand Down Expand Up @@ -2509,8 +2510,7 @@ class DatasetServiceIntegrationTest() : CsmTestBase() {
description = newDatasetDescription,
tags = newDatasetTags,
additionalData = newDatasetAdditionalData,
parts = mutableListOf(newDatasetPartCreateRequest),
security = newDatasetSecurity)
parts = mutableListOf(newDatasetPartCreateRequest))

val newDatasetPartTestFile =
resourceLoader.getResource("classpath:/$CUSTOMER_ZIPPED_SOURCE_FILE_NAME").file
Expand Down Expand Up @@ -2708,12 +2708,21 @@ class DatasetServiceIntegrationTest() : CsmTestBase() {
tags = mutableListOf("part", "public", "customers"),
type = DatasetPartTypeEnum.File)

val datasetSecurity =
DatasetSecurity(
default = ROLE_NONE,
accessControlList =
mutableListOf(
DatasetAccessControl(CONNECTED_ADMIN_USER, ROLE_ADMIN),
DatasetAccessControl(CONNECTED_DEFAULT_USER, ROLE_EDITOR)))

val datasetCreateRequest =
DatasetCreateRequest(
name = "Customer Dataset",
description = "Dataset for customers",
tags = mutableListOf("dataset", "public", "customers"),
parts = mutableListOf(datasetPartCreateRequest))
parts = mutableListOf(datasetPartCreateRequest),
security = datasetSecurity)

val resourceTestFile = resourceLoader.getResource("classpath:/$CUSTOMER_SOURCE_FILE_NAME").file

Expand Down Expand Up @@ -2747,14 +2756,7 @@ class DatasetServiceIntegrationTest() : CsmTestBase() {
name = "Shop Dataset",
description = "Dataset for shop",
tags = mutableListOf("dataset", "public", "shop"),
parts = mutableListOf(newDatasetPartCreateRequest),
security =
DatasetSecurity(
default = ROLE_NONE,
accessControlList =
mutableListOf(
DatasetAccessControl(CONNECTED_ADMIN_USER, ROLE_ADMIN),
DatasetAccessControl(CONNECTED_DEFAULT_USER, ROLE_EDITOR))))
parts = mutableListOf(newDatasetPartCreateRequest))

val wrongTypeTestFile =
resourceLoader.getResource("classpath:/$UNALLOWED_MIME_TYPE_SOURCE_FILE_NAME").file
Expand Down Expand Up @@ -2799,7 +2801,14 @@ class DatasetServiceIntegrationTest() : CsmTestBase() {
name = "Customer Dataset",
description = "Dataset for customers",
tags = mutableListOf("dataset", "public", "customers"),
parts = mutableListOf(datasetPartCreateRequest))
parts = mutableListOf(datasetPartCreateRequest),
security =
DatasetSecurity(
default = ROLE_NONE,
accessControlList =
mutableListOf(
DatasetAccessControl(CONNECTED_ADMIN_USER, ROLE_ADMIN),
DatasetAccessControl(CONNECTED_DEFAULT_USER, ROLE_EDITOR))))

val resourceTestFile = resourceLoader.getResource("classpath:/$CUSTOMER_SOURCE_FILE_NAME").file

Expand Down Expand Up @@ -2833,14 +2842,7 @@ class DatasetServiceIntegrationTest() : CsmTestBase() {
name = "Shop Dataset",
description = "Dataset for shop",
tags = mutableListOf("dataset", "public", "shop"),
parts = mutableListOf(newDatasetPartCreateRequest),
security =
DatasetSecurity(
default = ROLE_NONE,
accessControlList =
mutableListOf(
DatasetAccessControl(CONNECTED_ADMIN_USER, ROLE_ADMIN),
DatasetAccessControl(CONNECTED_DEFAULT_USER, ROLE_EDITOR))))
parts = mutableListOf(newDatasetPartCreateRequest))

val wrongTypeMockMultipartFile =
MockMultipartFile(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ class DatasetServiceImpl(
DatasetEditInfo(
timestamp = Instant.now().toEpochMilli(),
userId = getCurrentAccountIdentifier(csmPlatformProperties)),
security = datasetUpdateRequest.security ?: previousDataset.security)
security = previousDataset.security)

logger.debug("New Dataset info to register: {}", updatedDataset)

Expand Down
2 changes: 0 additions & 2 deletions dataset/src/main/openapi/dataset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -875,8 +875,6 @@ components:
type: array
items:
$ref: '#/components/schemas/DatasetPartCreateRequest'
security:
$ref: '#/components/schemas/DatasetSecurity'

# main Dataset Part object
DatasetPart:
Expand Down
1 change: 0 additions & 1 deletion doc/Models/DatasetUpdateRequest.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
| **tags** | **List** | | [optional] [default to null] |
| **additionalData** | [**Map**](AnyType.md) | Free form additional data | [optional] [default to null] |
| **parts** | [**List**](DatasetPartCreateRequest.md) | | [optional] [default to null] |
| **security** | [**DatasetSecurity**](DatasetSecurity.md) | | [optional] [default to null] |

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

2 changes: 0 additions & 2 deletions openapi/plantuml/schemas.plantuml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ entity DatasetUpdateRequest {
tags: List<String>
additionalData: Map
parts: List<DatasetPartCreateRequest>
security: DatasetSecurity
}

entity LastRunInfo {
Expand Down Expand Up @@ -618,7 +617,6 @@ RunStatus -- RunEditInfo : createInfo
RunStatus -- "0..*" RunStatusNode : nodes
RunTemplate -- RunTemplateResourceSizing : runSizing
DatasetUpdateRequest -- "0..*" DatasetPartCreateRequest : parts
DatasetUpdateRequest -- DatasetSecurity : security
RunTemplateCreateRequest -- RunTemplateResourceSizing : runSizing
RunnerSecurity -- "0..*" RunnerAccessControl : accessControlList
RunStatusNode -- RunResourceRequested : resourcesDuration
Expand Down
Loading