diff --git a/packages/client/hmi-client/src/components/code/tera-code.vue b/packages/client/hmi-client/src/components/code/tera-code.vue index 5144626890..bfcb3f6894 100644 --- a/packages/client/hmi-client/src/components/code/tera-code.vue +++ b/packages/client/hmi-client/src/components/code/tera-code.vue @@ -508,7 +508,7 @@ watch( const code = await getCodeAsset(props.assetId); if (code && code.files && Object.keys(code.files)[0]) { codeAsset.value = code; - codeName.value = code.name; + codeName.value = code.name ?? ''; const filename = Object.keys(code.files)[0]; codeSelectedFile.value = filename; diff --git a/packages/client/hmi-client/src/components/workflow/ops/calibrate-ensemble-ciemss/tera-calibrate-ensemble-ciemss.vue b/packages/client/hmi-client/src/components/workflow/ops/calibrate-ensemble-ciemss/tera-calibrate-ensemble-ciemss.vue index 7c61ab5a99..d2f2826d23 100644 --- a/packages/client/hmi-client/src/components/workflow/ops/calibrate-ensemble-ciemss/tera-calibrate-ensemble-ciemss.vue +++ b/packages/client/hmi-client/src/components/workflow/ops/calibrate-ensemble-ciemss/tera-calibrate-ensemble-ciemss.vue @@ -373,7 +373,7 @@ onMounted(async () => { csvAsset.value = csv; datasetColumnNames.value = csv?.headers; - listModelLabels.value = allModelConfigurations.value.map((ele) => ele.name); + listModelLabels.value = allModelConfigurations.value.map((ele) => ele.name ?? ''); // initalize ensembleConfigs when its length is less than the amount of models provided to node (- 1 due to dataset, -1 due to last empty ) if (knobs.value.ensembleConfigs.length < props.node.inputs.length - 2) { diff --git a/packages/client/hmi-client/src/components/workflow/ops/model-config/tera-model-config.vue b/packages/client/hmi-client/src/components/workflow/ops/model-config/tera-model-config.vue index 89198dfb16..d149499f95 100644 --- a/packages/client/hmi-client/src/components/workflow/ops/model-config/tera-model-config.vue +++ b/packages/client/hmi-client/src/components/workflow/ops/model-config/tera-model-config.vue @@ -715,7 +715,7 @@ const createConfiguration = async (force: boolean = false) => { const data = await createModelConfiguration( model.value.id, - knobs.value?.transientModelConfig?.name, + knobs.value?.transientModelConfig?.name ?? '', knobs.value?.transientModelConfig?.description ?? '', knobs.value?.transientModelConfig?.configuration ); diff --git a/packages/client/hmi-client/src/components/workflow/ops/simulate-ensemble-ciemss/tera-simulate-ensemble-ciemss.vue b/packages/client/hmi-client/src/components/workflow/ops/simulate-ensemble-ciemss/tera-simulate-ensemble-ciemss.vue index 9c25f236c3..fba60658cf 100644 --- a/packages/client/hmi-client/src/components/workflow/ops/simulate-ensemble-ciemss/tera-simulate-ensemble-ciemss.vue +++ b/packages/client/hmi-client/src/components/workflow/ops/simulate-ensemble-ciemss/tera-simulate-ensemble-ciemss.vue @@ -351,7 +351,7 @@ onMounted(async () => { amr.semantics?.ode.observables?.forEach((element) => tempList.push(element.id)); allModelOptions.value[allModelConfigurations[i].id as string] = tempList; } - listModelLabels.value = allModelConfigurations.map((ele) => ele.name); + listModelLabels.value = allModelConfigurations.map((ele) => ele.name ?? ''); const state = _.cloneDeep(props.node.state); diff --git a/packages/client/hmi-client/src/page/Home.vue b/packages/client/hmi-client/src/page/Home.vue index 54dddd4591..26c97c4cfb 100644 --- a/packages/client/hmi-client/src/page/Home.vue +++ b/packages/client/hmi-client/src/page/Home.vue @@ -232,7 +232,9 @@ function sortProjectByDates(projects: Project[], dateType: DateType, sorting: 'A function filterAndSortProjects(projects: Project[]) { if (projects) { if (selectedSort.value === 'Alphabetical') { - return projects.sort((a, b) => a.name.toLowerCase().localeCompare(b.name.toLowerCase())); + return projects.sort((a, b) => + (a.name ?? '').toLowerCase().localeCompare((b.name ?? '').toLowerCase()) + ); } if (selectedSort.value === 'Last updated (descending)') { return sortProjectByDates(projects, 'updatedOn', 'DESC'); diff --git a/packages/client/hmi-client/src/page/data-explorer/components/tera-asset-card.vue b/packages/client/hmi-client/src/page/data-explorer/components/tera-asset-card.vue index a9c5f6963d..6f1389da28 100644 --- a/packages/client/hmi-client/src/page/data-explorer/components/tera-asset-card.vue +++ b/packages/client/hmi-client/src/page/data-explorer/components/tera-asset-card.vue @@ -228,7 +228,7 @@ const title = computed(() => { } else if (props.resourceType === ResourceType.MODEL) { value = (props.asset as Model).header.name; } else if (props.resourceType === ResourceType.DATASET) { - value = (props.asset as Dataset).name; + value = (props.asset as Dataset).name ?? ''; } return highlightSearchTerms(value); }); diff --git a/packages/client/hmi-client/src/page/data-explorer/components/tera-search-results-list.vue b/packages/client/hmi-client/src/page/data-explorer/components/tera-search-results-list.vue index 1fef7a6682..b1b74cad79 100644 --- a/packages/client/hmi-client/src/page/data-explorer/components/tera-search-results-list.vue +++ b/packages/client/hmi-client/src/page/data-explorer/components/tera-search-results-list.vue @@ -168,7 +168,7 @@ const projectOptions = computed(() => [ // then, link and store in the project assets if (datasetId) { response = await useProjects().addAsset(AssetType.Dataset, datasetId, project.id); - assetName = selectedAsset.value.name; + assetName = selectedAsset.value.name ?? ''; } } else if (isDocument(selectedAsset.value) && props.source === DocumentSource.XDD) { const document = selectedAsset.value as Document; diff --git a/packages/client/hmi-client/src/types/Types.ts b/packages/client/hmi-client/src/types/Types.ts index 2e3c5df738..fab1e308fb 100644 --- a/packages/client/hmi-client/src/types/Types.ts +++ b/packages/client/hmi-client/src/types/Types.ts @@ -25,6 +25,7 @@ export interface ClientLog { export interface TerariumAsset { id?: string; name?: string; + description?: string; createdOn?: Date; updatedOn?: Date; deletedOn?: Date; @@ -69,9 +70,7 @@ export interface GithubRepo { } export interface Artifact extends TerariumAsset { - name: string; userId: string; - description?: string; fileNames: string[]; metadata?: any; concepts?: OntologyConcept[]; @@ -122,8 +121,6 @@ export interface ResponseSuccess { } export interface Code extends TerariumAsset { - name: string; - description: string; files?: { [index: string]: CodeFile }; repoUrl?: string; metadata?: { [index: string]: string }; @@ -141,7 +138,6 @@ export interface Dynamics { } export interface ActiveConcept extends TerariumAsset { - name: string; curie: string; } @@ -158,10 +154,8 @@ export interface OntologyConcept { } export interface Dataset extends TerariumAsset { - name: string; userId?: string; esgfId?: string; - description?: string; dataSourceDate?: Date; fileNames?: string[]; datasetUrl?: string; @@ -195,7 +189,6 @@ export interface AddDocumentAssetFromXDDResponse { } export interface DocumentAsset extends TerariumAsset { - description?: string; userId?: string; fileNames?: string[]; documentUrl?: string; @@ -236,8 +229,6 @@ export interface Model extends TerariumAssetThatSupportsAdditionalProperties { } export interface ModelConfiguration extends TerariumAssetThatSupportsAdditionalProperties { - name: string; - description?: string; configuration: Model; model_id: string; } @@ -407,8 +398,6 @@ export interface DecapodesTerm { } export interface NotebookSession extends TerariumAsset { - name: string; - description?: string; data: any; } @@ -418,11 +407,9 @@ export interface PetriNetModel { } export interface Project extends TerariumAsset { - name: string; userId: string; userName?: string; authors?: string[]; - description?: string; overviewContent?: any; projectAssets: ProjectAsset[]; metadata?: { [index: string]: string }; @@ -504,7 +491,6 @@ export interface RegNetVertex { export interface Simulation extends TerariumAsset { executionPayload: any; - description?: string; resultFiles?: string[]; type: SimulationType; status: ProgressState; diff --git a/packages/server/src/main/java/software/uncharted/terarium/hmiserver/models/TerariumAsset.java b/packages/server/src/main/java/software/uncharted/terarium/hmiserver/models/TerariumAsset.java index 3f444deab3..502988f1e4 100644 --- a/packages/server/src/main/java/software/uncharted/terarium/hmiserver/models/TerariumAsset.java +++ b/packages/server/src/main/java/software/uncharted/terarium/hmiserver/models/TerariumAsset.java @@ -28,8 +28,15 @@ public abstract class TerariumAsset implements Serializable { private UUID id = UUID.randomUUID(); @TSOptional + @Column(length = 512) + @Schema(defaultValue = "Default Name") private String name; + @TSOptional + @Schema(defaultValue = "Default Description") + @Column(columnDefinition = "text") + private String description; + @TSOptional @Schema(accessMode = Schema.AccessMode.READ_ONLY) @Column(columnDefinition = "TIMESTAMP WITH TIME ZONE") @@ -78,6 +85,7 @@ public TerariumAsset clone() { protected TerariumAsset cloneSuperFields(final TerariumAsset asset) { asset.id = UUID.randomUUID(); // ensure we create a new id asset.name = name; + asset.description = description; asset.createdOn = this.createdOn != null ? new Timestamp(this.createdOn.getTime()) : null; asset.updatedOn = this.updatedOn != null ? new Timestamp(this.updatedOn.getTime()) : null; asset.deletedOn = this.deletedOn != null ? new Timestamp(this.deletedOn.getTime()) : null; diff --git a/packages/server/src/main/java/software/uncharted/terarium/hmiserver/models/dataservice/Artifact.java b/packages/server/src/main/java/software/uncharted/terarium/hmiserver/models/dataservice/Artifact.java index 74ca51bf26..db5b6a871c 100644 --- a/packages/server/src/main/java/software/uncharted/terarium/hmiserver/models/dataservice/Artifact.java +++ b/packages/server/src/main/java/software/uncharted/terarium/hmiserver/models/dataservice/Artifact.java @@ -29,13 +29,6 @@ public class Artifact extends TerariumAsset { /* UserId of who created this asset */ private String userId; - /* The name of the artifact. */ - private String name; - - /* A description of the artifact. */ - @TSOptional - private String description; - /* The name of the file(s) in this artifact */ @JsonAlias("file_names") private List fileNames; diff --git a/packages/server/src/main/java/software/uncharted/terarium/hmiserver/models/dataservice/code/Code.java b/packages/server/src/main/java/software/uncharted/terarium/hmiserver/models/dataservice/code/Code.java index bde50ceec8..9b45087da3 100644 --- a/packages/server/src/main/java/software/uncharted/terarium/hmiserver/models/dataservice/code/Code.java +++ b/packages/server/src/main/java/software/uncharted/terarium/hmiserver/models/dataservice/code/Code.java @@ -21,12 +21,6 @@ public class Code extends TerariumAsset { @Serial private static final long serialVersionUID = 3041175096070970227L; /* The name of the code. */ - @Schema(defaultValue = "Default Name") - private String name; - - /* The description of the code. */ - @Schema(defaultValue = "Default Description") - private String description; /* Files that contain dynamics */ @TSOptional diff --git a/packages/server/src/main/java/software/uncharted/terarium/hmiserver/models/dataservice/concept/ActiveConcept.java b/packages/server/src/main/java/software/uncharted/terarium/hmiserver/models/dataservice/concept/ActiveConcept.java index 370f4f8235..2a244369d5 100644 --- a/packages/server/src/main/java/software/uncharted/terarium/hmiserver/models/dataservice/concept/ActiveConcept.java +++ b/packages/server/src/main/java/software/uncharted/terarium/hmiserver/models/dataservice/concept/ActiveConcept.java @@ -21,6 +21,4 @@ public class ActiveConcept extends TerariumAsset { @Column(unique = true) private String curie; - - private String name; } diff --git a/packages/server/src/main/java/software/uncharted/terarium/hmiserver/models/dataservice/dataset/Dataset.java b/packages/server/src/main/java/software/uncharted/terarium/hmiserver/models/dataservice/dataset/Dataset.java index 1a8d199b8b..a3b53e1ae7 100644 --- a/packages/server/src/main/java/software/uncharted/terarium/hmiserver/models/dataservice/dataset/Dataset.java +++ b/packages/server/src/main/java/software/uncharted/terarium/hmiserver/models/dataservice/dataset/Dataset.java @@ -30,13 +30,6 @@ public class Dataset extends TerariumAsset { @TSOptional private String esgfId; - /** Name of the dataset */ - private String name; - - /** (Optional) textual description of the dataset */ - @TSOptional - private String description; - /** (Optional) data source date */ @TSOptional @JsonAlias("data_source_date") diff --git a/packages/server/src/main/java/software/uncharted/terarium/hmiserver/models/dataservice/document/DocumentAsset.java b/packages/server/src/main/java/software/uncharted/terarium/hmiserver/models/dataservice/document/DocumentAsset.java index 91478179bf..e386bd071c 100644 --- a/packages/server/src/main/java/software/uncharted/terarium/hmiserver/models/dataservice/document/DocumentAsset.java +++ b/packages/server/src/main/java/software/uncharted/terarium/hmiserver/models/dataservice/document/DocumentAsset.java @@ -24,12 +24,6 @@ public class DocumentAsset extends TerariumAsset { @Serial private static final long serialVersionUID = -8425680186002783351L; - @TSOptional - private String name; - - @TSOptional - private String description; - @TSOptional private String userId; diff --git a/packages/server/src/main/java/software/uncharted/terarium/hmiserver/models/dataservice/equation/Equation.java b/packages/server/src/main/java/software/uncharted/terarium/hmiserver/models/dataservice/equation/Equation.java index 6eba279cfe..2a118a1264 100644 --- a/packages/server/src/main/java/software/uncharted/terarium/hmiserver/models/dataservice/equation/Equation.java +++ b/packages/server/src/main/java/software/uncharted/terarium/hmiserver/models/dataservice/equation/Equation.java @@ -24,10 +24,6 @@ public class Equation extends TerariumAsset { @TSOptional private String userId; - /** (Optional) Display/human name for the equation * */ - @TSOptional - private String name; - /** The type of equation (mathml or latex) * */ @JsonAlias("equation_type") private EquationType equationType; diff --git a/packages/server/src/main/java/software/uncharted/terarium/hmiserver/models/dataservice/model/ModelConfiguration.java b/packages/server/src/main/java/software/uncharted/terarium/hmiserver/models/dataservice/model/ModelConfiguration.java index 242ba9c9cc..dfe9a9f4b3 100644 --- a/packages/server/src/main/java/software/uncharted/terarium/hmiserver/models/dataservice/model/ModelConfiguration.java +++ b/packages/server/src/main/java/software/uncharted/terarium/hmiserver/models/dataservice/model/ModelConfiguration.java @@ -19,8 +19,6 @@ public class ModelConfiguration extends TerariumAssetThatSupportsAdditionalPrope @Serial private static final long serialVersionUID = -4109896135386019667L; - private String name; - @TSOptional private String description; diff --git a/packages/server/src/main/java/software/uncharted/terarium/hmiserver/models/dataservice/notebooksession/NotebookSession.java b/packages/server/src/main/java/software/uncharted/terarium/hmiserver/models/dataservice/notebooksession/NotebookSession.java index 24a4f6589f..368369a38a 100644 --- a/packages/server/src/main/java/software/uncharted/terarium/hmiserver/models/dataservice/notebooksession/NotebookSession.java +++ b/packages/server/src/main/java/software/uncharted/terarium/hmiserver/models/dataservice/notebooksession/NotebookSession.java @@ -6,7 +6,6 @@ import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; import software.uncharted.terarium.hmiserver.annotations.TSModel; -import software.uncharted.terarium.hmiserver.annotations.TSOptional; import software.uncharted.terarium.hmiserver.models.TerariumAsset; @EqualsAndHashCode(callSuper = true) @@ -18,10 +17,5 @@ public class NotebookSession extends TerariumAsset { @Serial private static final long serialVersionUID = 9176019416379347233L; - private String name; - - @TSOptional - private String description; - private JsonNode data; } diff --git a/packages/server/src/main/java/software/uncharted/terarium/hmiserver/models/dataservice/project/Project.java b/packages/server/src/main/java/software/uncharted/terarium/hmiserver/models/dataservice/project/Project.java index 12abd1fb25..0f805696c4 100644 --- a/packages/server/src/main/java/software/uncharted/terarium/hmiserver/models/dataservice/project/Project.java +++ b/packages/server/src/main/java/software/uncharted/terarium/hmiserver/models/dataservice/project/Project.java @@ -31,9 +31,6 @@ public class Project extends TerariumAsset { @Serial private static final long serialVersionUID = -241733670076432802L; - @Schema(defaultValue = "My New Project") - private String name; - private String userId; @TSOptional @@ -46,10 +43,6 @@ public class Project extends TerariumAsset { @Schema(accessMode = Schema.AccessMode.READ_ONLY) private List authors; - @TSOptional - @Schema(defaultValue = "My Project Description") - private String description; - @TSOptional @Schema(defaultValue = "My Project Overview") @Lob diff --git a/packages/server/src/main/java/software/uncharted/terarium/hmiserver/models/dataservice/simulation/Simulation.java b/packages/server/src/main/java/software/uncharted/terarium/hmiserver/models/dataservice/simulation/Simulation.java index 6028815b6d..c01f5744e6 100644 --- a/packages/server/src/main/java/software/uncharted/terarium/hmiserver/models/dataservice/simulation/Simulation.java +++ b/packages/server/src/main/java/software/uncharted/terarium/hmiserver/models/dataservice/simulation/Simulation.java @@ -31,13 +31,9 @@ public class Simulation extends TerariumAsset { @Column(columnDefinition = "text") private JsonNode executionPayload; - @TSOptional - @Column(length = 1000) - private String description; - @JsonAlias("result_files") @TSOptional - @Column(length = 1000) + @Column(length = 1024) @Schema(accessMode = Schema.AccessMode.READ_ONLY) @ElementCollection private List resultFiles; @@ -73,6 +69,7 @@ public class Simulation extends TerariumAsset { @JsonAlias("user_id") @TSOptional + @Column(length = 255) private String userId; @JsonAlias("project_id") @@ -85,8 +82,6 @@ public Simulation clone() { cloneSuperFields(clone); - clone.setDescription(this.description); - clone.setResultFiles(new ArrayList<>(this.resultFiles)); clone.setType(SimulationType.valueOf(this.type.name())); clone.setStatus(ProgressState.valueOf(this.status.name())); diff --git a/packages/server/src/main/java/software/uncharted/terarium/hmiserver/models/dataservice/workflow/Workflow.java b/packages/server/src/main/java/software/uncharted/terarium/hmiserver/models/dataservice/workflow/Workflow.java index fdad4a98e0..b252a68923 100644 --- a/packages/server/src/main/java/software/uncharted/terarium/hmiserver/models/dataservice/workflow/Workflow.java +++ b/packages/server/src/main/java/software/uncharted/terarium/hmiserver/models/dataservice/workflow/Workflow.java @@ -25,8 +25,6 @@ public class Workflow extends TerariumAsset { @Serial private static final long serialVersionUID = -1565930053830366145L; - private String description; - private Transform transform; @Convert(converter = ObjectConverter.class) @@ -43,7 +41,6 @@ public Workflow clone() { cloneSuperFields(clone); - clone.description = this.description; if (this.transform != null) { clone.transform = new Transform() .setX(this.transform.getX()) diff --git a/packages/server/src/main/resources/db/migration/V4__Change_description_to_text.sql b/packages/server/src/main/resources/db/migration/V4__Change_description_to_text.sql new file mode 100644 index 0000000000..80e0a816f0 --- /dev/null +++ b/packages/server/src/main/resources/db/migration/V4__Change_description_to_text.sql @@ -0,0 +1,13 @@ +BEGIN; + +ALTER TABLE simulation ALTER COLUMN result_files TYPE VARCHAR(1024)[]; + +ALTER TABLE simulation ALTER COLUMN name TYPE VARCHAR(512); +ALTER TABLE workflow ALTER COLUMN name TYPE VARCHAR(512); +ALTER TABLE project ALTER COLUMN name TYPE VARCHAR(512); + +ALTER TABLE simulation ALTER COLUMN description TYPE text; +ALTER TABLE workflow ALTER COLUMN description TYPE text; +ALTER TABLE project ALTER COLUMN description TYPE text; + +COMMIT; diff --git a/packages/server/src/test/java/software/uncharted/terarium/hmiserver/controller/dataservice/ArtifactControllerTests.java b/packages/server/src/test/java/software/uncharted/terarium/hmiserver/controller/dataservice/ArtifactControllerTests.java index 0001ba4ef7..1a3b0a3038 100644 --- a/packages/server/src/test/java/software/uncharted/terarium/hmiserver/controller/dataservice/ArtifactControllerTests.java +++ b/packages/server/src/test/java/software/uncharted/terarium/hmiserver/controller/dataservice/ArtifactControllerTests.java @@ -50,7 +50,8 @@ public void teardown() throws IOException { @WithUserDetails(MockUser.URSULA) public void testItCanCreateArtifact() throws Exception { - final Artifact artifact = new Artifact().setName("test-artifact-name").setDescription("my description"); + final Artifact artifact = + (Artifact) new Artifact().setName("test-artifact-name").setDescription("my description"); mockMvc.perform(MockMvcRequestBuilders.post("/artifacts") .with(csrf()) @@ -64,7 +65,7 @@ public void testItCanCreateArtifact() throws Exception { public void testItCanGetArtifact() throws Exception { final Artifact artifact = artifactService.createAsset( - new Artifact().setName("test-artifact-name").setDescription("my description")); + (Artifact) new Artifact().setName("test-artifact-name").setDescription("my description")); mockMvc.perform(MockMvcRequestBuilders.get("/artifacts/" + artifact.getId()) .with(csrf())) @@ -75,9 +76,12 @@ public void testItCanGetArtifact() throws Exception { @WithUserDetails(MockUser.URSULA) public void testItCanGetArtifacts() throws Exception { - artifactService.createAsset(new Artifact().setName("test-artifact-name").setDescription("my description")); - artifactService.createAsset(new Artifact().setName("test-artifact-name").setDescription("my description")); - artifactService.createAsset(new Artifact().setName("test-artifact-name").setDescription("my description")); + artifactService.createAsset( + (Artifact) new Artifact().setName("test-artifact-name").setDescription("my description")); + artifactService.createAsset( + (Artifact) new Artifact().setName("test-artifact-name").setDescription("my description")); + artifactService.createAsset( + (Artifact) new Artifact().setName("test-artifact-name").setDescription("my description")); mockMvc.perform(MockMvcRequestBuilders.get("/artifacts").with(csrf())) .andExpect(status().isOk()) @@ -89,7 +93,7 @@ public void testItCanGetArtifacts() throws Exception { public void testItCanDeleteArtifact() throws Exception { final Artifact artifact = artifactService.createAsset( - new Artifact().setName("test-artifact-name").setDescription("my description")); + (Artifact) new Artifact().setName("test-artifact-name").setDescription("my description")); mockMvc.perform(MockMvcRequestBuilders.delete("/artifacts/" + artifact.getId()) .with(csrf())) @@ -103,7 +107,7 @@ public void testItCanDeleteArtifact() throws Exception { public void testItCanUploadArtifact() throws Exception { final Artifact artifact = artifactService.createAsset( - new Artifact().setName("test-artifact-name").setDescription("my description")); + (Artifact) new Artifact().setName("test-artifact-name").setDescription("my description")); // Create a MockMultipartFile object final MockMultipartFile file = new MockMultipartFile( @@ -131,7 +135,7 @@ public void testItCanUploadArtifact() throws Exception { public void testItCanUploadArtifactFromGithub() throws Exception { final Artifact artifact = artifactService.createAsset( - new Artifact().setName("test-artifact-name").setDescription("my description")); + (Artifact) new Artifact().setName("test-artifact-name").setDescription("my description")); mockMvc.perform(MockMvcRequestBuilders.put("/artifacts/" + artifact.getId() + "/upload-artifact-from-github") .with(csrf()) @@ -147,7 +151,7 @@ public void testItCanUploadArtifactFromGithub() throws Exception { public void testItCanDownloadArtifact() throws Exception { final Artifact artifact = artifactService.createAsset( - new Artifact().setName("test-artifact-name").setDescription("my description")); + (Artifact) new Artifact().setName("test-artifact-name").setDescription("my description")); final String content = "this is the file content for the testItCanDownloadArtifact test"; @@ -188,7 +192,7 @@ public void testItCanDownloadArtifact() throws Exception { public void testItCanDownloadArtifactAsText() throws Exception { final Artifact artifact = artifactService.createAsset( - new Artifact().setName("test-artifact-name").setDescription("my description")); + (Artifact) new Artifact().setName("test-artifact-name").setDescription("my description")); final String content = "this is the file content for the testItCanDownloadArtifact test"; diff --git a/packages/server/src/test/java/software/uncharted/terarium/hmiserver/controller/dataservice/AssetControllerTests.java b/packages/server/src/test/java/software/uncharted/terarium/hmiserver/controller/dataservice/AssetControllerTests.java index acbe41ab04..d47312d119 100644 --- a/packages/server/src/test/java/software/uncharted/terarium/hmiserver/controller/dataservice/AssetControllerTests.java +++ b/packages/server/src/test/java/software/uncharted/terarium/hmiserver/controller/dataservice/AssetControllerTests.java @@ -137,10 +137,10 @@ public void testItCanVerifyAssetNameAvailabilityInProjects() throws Exception { */ @BeforeEach public void setUpScenario() throws Exception { - project = projectService.createProject(new Project().setName("test-proj-1")); + project = projectService.createProject((Project) new Project().setName("test-proj-1")); final DocumentAsset documentAsset = documentAssetService.createAsset( - new DocumentAsset().setName(TEST_ASSET_NAME_1).setDescription("my description")); + (DocumentAsset) new DocumentAsset().setName(TEST_ASSET_NAME_1).setDescription("my description")); final ProjectAsset projectAsset = new ProjectAsset() .setAssetId(documentAsset.getId()) @@ -154,10 +154,10 @@ public void setUpScenario() throws Exception { .content(objectMapper.writeValueAsString(projectAsset))) .andExpect(status().isCreated()); - project2 = projectService.createProject(new Project().setName("test-proj-2")); + project2 = projectService.createProject((Project) new Project().setName("test-proj-2")); final DocumentAsset documentAsset2 = documentAssetService.createAsset( - new DocumentAsset().setName(TEST_ASSET_NAME_2).setDescription("my description")); + (DocumentAsset) new DocumentAsset().setName(TEST_ASSET_NAME_2).setDescription("my description")); final ProjectAsset projectAsset2 = new ProjectAsset() .setAssetId(documentAsset.getId()) diff --git a/packages/server/src/test/java/software/uncharted/terarium/hmiserver/controller/dataservice/DatasetControllerTests.java b/packages/server/src/test/java/software/uncharted/terarium/hmiserver/controller/dataservice/DatasetControllerTests.java index 216327cdf6..51add8e8bf 100644 --- a/packages/server/src/test/java/software/uncharted/terarium/hmiserver/controller/dataservice/DatasetControllerTests.java +++ b/packages/server/src/test/java/software/uncharted/terarium/hmiserver/controller/dataservice/DatasetControllerTests.java @@ -61,7 +61,8 @@ public void teardown() throws IOException { @WithUserDetails(MockUser.URSULA) public void testItCanCreateDataset() throws Exception { - final Dataset dataset = new Dataset().setName("test-dataset-name").setDescription("my description"); + final Dataset dataset = + (Dataset) new Dataset().setName("test-dataset-name").setDescription("my description"); mockMvc.perform(MockMvcRequestBuilders.post("/datasets") .with(csrf()) @@ -75,7 +76,7 @@ public void testItCanCreateDataset() throws Exception { public void testItCanGetDataset() throws Exception { final Dataset dataset = datasetService.createAsset( - new Dataset().setName("test-dataset-name").setDescription("my description")); + (Dataset) new Dataset().setName("test-dataset-name").setDescription("my description")); mockMvc.perform(MockMvcRequestBuilders.get("/datasets/" + dataset.getId()) .with(csrf())) @@ -86,11 +87,14 @@ public void testItCanGetDataset() throws Exception { @WithUserDetails(MockUser.URSULA) public void testItCanGetDatasets() throws Exception { - datasetService.createAsset(new Dataset().setName("test-dataset-name0").setDescription("my description")); + datasetService.createAsset( + (Dataset) new Dataset().setName("test-dataset-name0").setDescription("my description")); - datasetService.createAsset(new Dataset().setName("test-dataset-name1").setDescription("my description")); + datasetService.createAsset( + (Dataset) new Dataset().setName("test-dataset-name1").setDescription("my description")); - datasetService.createAsset(new Dataset().setName("test-dataset-name2").setDescription("my description")); + datasetService.createAsset( + (Dataset) new Dataset().setName("test-dataset-name2").setDescription("my description")); mockMvc.perform(MockMvcRequestBuilders.get("/datasets").with(csrf())) .andExpect(status().isOk()) @@ -102,7 +106,7 @@ public void testItCanGetDatasets() throws Exception { public void testItCanDeleteDataset() throws Exception { final Dataset dataset = datasetService.createAsset( - new Dataset().setName("test-dataset-name").setDescription("my description")); + (Dataset) new Dataset().setName("test-dataset-name").setDescription("my description")); mockMvc.perform(MockMvcRequestBuilders.delete("/datasets/" + dataset.getId()) .with(csrf())) @@ -116,7 +120,7 @@ public void testItCanDeleteDataset() throws Exception { public void testItCanUploadDatasetCSV() throws Exception { final Dataset dataset = datasetService.createAsset( - new Dataset().setName("test-dataset-name").setDescription("my description")); + (Dataset) new Dataset().setName("test-dataset-name").setDescription("my description")); final String content = "col0,col1,col2,col3\na,b,c,d\n"; @@ -146,7 +150,7 @@ public void testItCanUploadDatasetCSV() throws Exception { public void testItCanUploadDatasetFromGithub() throws Exception { final Dataset dataset = datasetService.createAsset( - new Dataset().setName("test-dataset-name").setDescription("my description")); + (Dataset) new Dataset().setName("test-dataset-name").setDescription("my description")); mockMvc.perform(MockMvcRequestBuilders.put("/datasets/" + dataset.getId() + "/upload-csv-from-github") .with(csrf()) @@ -162,7 +166,7 @@ public void testItCanUploadDatasetFromGithub() throws Exception { public void testItCanDownloadDatasetCSV() throws Exception { final Dataset dataset = datasetService.createAsset( - new Dataset().setName("test-dataset-name").setDescription("my description")); + (Dataset) new Dataset().setName("test-dataset-name").setDescription("my description")); final String content = "col0,col1,col2,col3\na,b,c,d\n"; @@ -203,7 +207,7 @@ public void testItCanDownloadDatasetCSV() throws Exception { public void testItCanUploadDataset() throws Exception { final Dataset dataset = datasetService.createAsset( - new Dataset().setName("test-dataset-name").setDescription("my description")); + (Dataset) new Dataset().setName("test-dataset-name").setDescription("my description")); final String content = "This is my small test dataset\n"; @@ -233,7 +237,7 @@ public void testItCanUploadDataset() throws Exception { public void testItCanDownloadDataset() throws Exception { final Dataset dataset = datasetService.createAsset( - new Dataset().setName("test-dataset-name").setDescription("my description")); + (Dataset) new Dataset().setName("test-dataset-name").setDescription("my description")); final String content = "col0,col1,col2,col3\na,b,c,d\n"; @@ -273,7 +277,7 @@ public void testItCanDownloadDataset() throws Exception { public void testItCanGetUploadUrl() throws Exception { final Dataset dataset = datasetService.createAsset( - new Dataset().setName("test-dataset-name").setDescription("my description")); + (Dataset) new Dataset().setName("test-dataset-name").setDescription("my description")); // Perform the multipart file upload request final MvcResult res = mockMvc.perform(MockMvcRequestBuilders.get("/datasets/" + dataset.getId() + "/upload-url") @@ -304,7 +308,7 @@ public void testItCanGetUploadUrl() throws Exception { public void testItCanGetDownloadUrl() throws Exception { final Dataset dataset = datasetService.createAsset( - new Dataset().setName("test-document-name").setDescription("my description")); + (Dataset) new Dataset().setName("test-document-name").setDescription("my description")); // Perform the multipart file upload request MvcResult res = mockMvc.perform(MockMvcRequestBuilders.get("/datasets/" + dataset.getId() + "/upload-url") diff --git a/packages/server/src/test/java/software/uncharted/terarium/hmiserver/controller/dataservice/DocumentControllerTests.java b/packages/server/src/test/java/software/uncharted/terarium/hmiserver/controller/dataservice/DocumentControllerTests.java index 32e764d333..a99f9e3ee8 100644 --- a/packages/server/src/test/java/software/uncharted/terarium/hmiserver/controller/dataservice/DocumentControllerTests.java +++ b/packages/server/src/test/java/software/uncharted/terarium/hmiserver/controller/dataservice/DocumentControllerTests.java @@ -50,7 +50,7 @@ public void teardown() throws IOException { @WithUserDetails(MockUser.URSULA) public void testItCanCreateDocument() throws Exception { - final DocumentAsset documentAsset = + final DocumentAsset documentAsset = (DocumentAsset) new DocumentAsset().setName("test-document-name").setDescription("my description"); mockMvc.perform(MockMvcRequestBuilders.post("/document-asset") @@ -64,7 +64,7 @@ public void testItCanCreateDocument() throws Exception { @WithUserDetails(MockUser.URSULA) public void testItCanGetDocument() throws Exception { - final DocumentAsset documentAsset = documentAssetService.createAsset( + final DocumentAsset documentAsset = documentAssetService.createAsset((DocumentAsset) new DocumentAsset().setName("test-document-name").setDescription("my description")); mockMvc.perform(MockMvcRequestBuilders.get("/document-asset/" + documentAsset.getId()) @@ -76,13 +76,13 @@ public void testItCanGetDocument() throws Exception { @WithUserDetails(MockUser.URSULA) public void testItCanGetDocuments() throws Exception { - documentAssetService.createAsset( + documentAssetService.createAsset((DocumentAsset) new DocumentAsset().setName("test-document-name").setDescription("my description")); - documentAssetService.createAsset( + documentAssetService.createAsset((DocumentAsset) new DocumentAsset().setName("test-document-name").setDescription("my description")); - documentAssetService.createAsset( + documentAssetService.createAsset((DocumentAsset) new DocumentAsset().setName("test-document-name").setDescription("my description")); mockMvc.perform(MockMvcRequestBuilders.get("/document-asset").with(csrf())) @@ -94,7 +94,7 @@ public void testItCanGetDocuments() throws Exception { @WithUserDetails(MockUser.URSULA) public void testItCanDeleteDocument() throws Exception { - final DocumentAsset documentAsset = documentAssetService.createAsset( + final DocumentAsset documentAsset = documentAssetService.createAsset((DocumentAsset) new DocumentAsset().setName("test-document-name").setDescription("my description")); mockMvc.perform(MockMvcRequestBuilders.delete("/document-asset/" + documentAsset.getId()) @@ -109,7 +109,7 @@ public void testItCanDeleteDocument() throws Exception { @WithUserDetails(MockUser.URSULA) public void testItCanUploadDocument() throws Exception { - final DocumentAsset documentAsset = documentAssetService.createAsset( + final DocumentAsset documentAsset = documentAssetService.createAsset((DocumentAsset) new DocumentAsset().setName("test-document-name").setDescription("my description")); // Create a MockMultipartFile object @@ -138,7 +138,7 @@ public void testItCanUploadDocument() throws Exception { @WithUserDetails(MockUser.URSULA) public void testItCanUploadDocumentFromGithub() throws Exception { - final DocumentAsset documentAsset = documentAssetService.createAsset( + final DocumentAsset documentAsset = documentAssetService.createAsset((DocumentAsset) new DocumentAsset().setName("test-document-name").setDescription("my description")); mockMvc.perform(MockMvcRequestBuilders.put( @@ -155,7 +155,7 @@ public void testItCanUploadDocumentFromGithub() throws Exception { @WithUserDetails(MockUser.URSULA) public void testItCanDownloadDocument() throws Exception { - final DocumentAsset documentAsset = documentAssetService.createAsset( + final DocumentAsset documentAsset = documentAssetService.createAsset((DocumentAsset) new DocumentAsset().setName("test-document-name").setDescription("my description")); final String content = "this is the file content for the testItCanDownloadDocument test"; @@ -197,7 +197,7 @@ public void testItCanDownloadDocument() throws Exception { @WithUserDetails(MockUser.URSULA) public void testItCanDownloadDocumentAsText() throws Exception { - final DocumentAsset documentAsset = documentAssetService.createAsset( + final DocumentAsset documentAsset = documentAssetService.createAsset((DocumentAsset) new DocumentAsset().setName("test-document-name").setDescription("my description")); final String content = "this is the file content for the testItCanDownloadDocument test"; diff --git a/packages/server/src/test/java/software/uncharted/terarium/hmiserver/controller/dataservice/EquationControllerTests.java b/packages/server/src/test/java/software/uncharted/terarium/hmiserver/controller/dataservice/EquationControllerTests.java index d335930b5d..47795be29a 100644 --- a/packages/server/src/test/java/software/uncharted/terarium/hmiserver/controller/dataservice/EquationControllerTests.java +++ b/packages/server/src/test/java/software/uncharted/terarium/hmiserver/controller/dataservice/EquationControllerTests.java @@ -47,7 +47,7 @@ public void teardown() throws IOException { @WithUserDetails(MockUser.URSULA) public void testItCanCreateEquation() throws Exception { - final Equation equation = new Equation().setName("test-equation-name"); + final Equation equation = (Equation) new Equation().setName("test-equation-name"); mockMvc.perform(MockMvcRequestBuilders.post("/equations") .with(csrf()) @@ -60,7 +60,7 @@ public void testItCanCreateEquation() throws Exception { @WithUserDetails(MockUser.URSULA) public void testItCanGetEquation() throws Exception { - final Equation equation = equationService.createAsset(new Equation().setName("test-equation-name")); + final Equation equation = equationService.createAsset((Equation) new Equation().setName("test-equation-name")); mockMvc.perform(MockMvcRequestBuilders.get("/equations/" + equation.getId()) .with(csrf())) @@ -71,9 +71,9 @@ public void testItCanGetEquation() throws Exception { @WithUserDetails(MockUser.URSULA) public void testItCanGetEquations() throws Exception { - equationService.createAsset(new Equation().setName("test-equation-name")); - equationService.createAsset(new Equation().setName("test-equation-name")); - equationService.createAsset(new Equation().setName("test-equation-name")); + equationService.createAsset((Equation) new Equation().setName("test-equation-name")); + equationService.createAsset((Equation) new Equation().setName("test-equation-name")); + equationService.createAsset((Equation) new Equation().setName("test-equation-name")); mockMvc.perform(MockMvcRequestBuilders.get("/equations").with(csrf())) .andExpect(status().isOk()) @@ -84,7 +84,7 @@ public void testItCanGetEquations() throws Exception { @WithUserDetails(MockUser.URSULA) public void testItCanDeleteEquation() throws Exception { - final Equation equation = equationService.createAsset(new Equation().setName("test-equation-name")); + final Equation equation = equationService.createAsset((Equation) new Equation().setName("test-equation-name")); mockMvc.perform(MockMvcRequestBuilders.delete("/equations/" + equation.getId()) .with(csrf())) diff --git a/packages/server/src/test/java/software/uncharted/terarium/hmiserver/controller/dataservice/ModelConfigurationControllerTests.java b/packages/server/src/test/java/software/uncharted/terarium/hmiserver/controller/dataservice/ModelConfigurationControllerTests.java index c8667e8e4f..3898526055 100644 --- a/packages/server/src/test/java/software/uncharted/terarium/hmiserver/controller/dataservice/ModelConfigurationControllerTests.java +++ b/packages/server/src/test/java/software/uncharted/terarium/hmiserver/controller/dataservice/ModelConfigurationControllerTests.java @@ -49,11 +49,12 @@ public void teardown() throws IOException { @WithUserDetails(MockUser.URSULA) public void testItCanGetModelConfiguration() throws Exception { - final ModelConfiguration modelConfiguration = modelConfigurationService.createAsset(new ModelConfiguration() - .setName("test-framework") - .setModelId(UUID.randomUUID()) - .setDescription("test-desc") - .setConfiguration(new Model())); + final ModelConfiguration modelConfiguration = + modelConfigurationService.createAsset((ModelConfiguration) new ModelConfiguration() + .setModelId(UUID.randomUUID()) + .setConfiguration(new Model()) + .setName("test-framework") + .setDescription("test-desc")); mockMvc.perform(MockMvcRequestBuilders.get("/model-configurations/" + modelConfiguration.getId()) .with(csrf())) @@ -64,11 +65,11 @@ public void testItCanGetModelConfiguration() throws Exception { @WithUserDetails(MockUser.URSULA) public void testItCanCreateModelConfiguration() throws Exception { - final ModelConfiguration modelConfiguration = new ModelConfiguration() - .setName("test-framework") + final ModelConfiguration modelConfiguration = (ModelConfiguration) new ModelConfiguration() .setModelId(UUID.randomUUID()) + .setConfiguration(new Model()) .setDescription("test-desc") - .setConfiguration(new Model()); + .setName("test-framework"); mockMvc.perform(MockMvcRequestBuilders.post("/model-configurations") .with(csrf()) @@ -81,11 +82,12 @@ public void testItCanCreateModelConfiguration() throws Exception { @WithUserDetails(MockUser.URSULA) public void testItCanUpdateModelConfiguration() throws Exception { - final ModelConfiguration modelConfiguration = modelConfigurationService.createAsset(new ModelConfiguration() - .setName("test-framework") - .setModelId(UUID.randomUUID()) - .setDescription("test-desc") - .setConfiguration(new Model())); + final ModelConfiguration modelConfiguration = + modelConfigurationService.createAsset((ModelConfiguration) new ModelConfiguration() + .setModelId(UUID.randomUUID()) + .setConfiguration(new Model()) + .setDescription("test-desc") + .setName("test-framework")); mockMvc.perform(MockMvcRequestBuilders.put("/model-configurations/" + modelConfiguration.getId()) .with(csrf()) @@ -98,11 +100,11 @@ public void testItCanUpdateModelConfiguration() throws Exception { @WithUserDetails(MockUser.URSULA) public void testItCanDeleteModelConfiguration() throws Exception { - final ModelConfiguration modelConfiguration = modelConfigurationService.createAsset(new ModelConfiguration() - .setName("test-framework") + final ModelConfiguration modelConfiguration = (ModelConfiguration) new ModelConfiguration() .setModelId(UUID.randomUUID()) + .setConfiguration(new Model()) .setDescription("test-desc") - .setConfiguration(new Model())); + .setName("test-framework"); mockMvc.perform(MockMvcRequestBuilders.delete("/model-configurations/" + modelConfiguration.getId()) .with(csrf())) diff --git a/packages/server/src/test/java/software/uncharted/terarium/hmiserver/controller/dataservice/NotebookSessionControllerTests.java b/packages/server/src/test/java/software/uncharted/terarium/hmiserver/controller/dataservice/NotebookSessionControllerTests.java index dbc3c92d5e..b6ee240ee8 100644 --- a/packages/server/src/test/java/software/uncharted/terarium/hmiserver/controller/dataservice/NotebookSessionControllerTests.java +++ b/packages/server/src/test/java/software/uncharted/terarium/hmiserver/controller/dataservice/NotebookSessionControllerTests.java @@ -47,7 +47,7 @@ public void teardown() throws IOException { @WithUserDetails(MockUser.URSULA) public void testItCanCreateNotebookSession() throws Exception { - final NotebookSession notebookSession = new NotebookSession().setName("test-notebook-name"); + final NotebookSession notebookSession = (NotebookSession) new NotebookSession().setName("test-notebook-name"); mockMvc.perform(MockMvcRequestBuilders.post("/sessions") .with(csrf()) @@ -60,8 +60,8 @@ public void testItCanCreateNotebookSession() throws Exception { @WithUserDetails(MockUser.URSULA) public void testItCanGetNotebookSession() throws Exception { - final NotebookSession notebookSession = - notebookSessionService.createAsset(new NotebookSession().setName("test-notebook-name")); + final NotebookSession notebookSession = notebookSessionService.createAsset( + (NotebookSession) new NotebookSession().setName("test-notebook-name")); mockMvc.perform(MockMvcRequestBuilders.get("/sessions/" + notebookSession.getId()) .with(csrf())) @@ -72,9 +72,9 @@ public void testItCanGetNotebookSession() throws Exception { @WithUserDetails(MockUser.URSULA) public void testItCanGetNotebookSessions() throws Exception { - notebookSessionService.createAsset(new NotebookSession().setName("test-notebook-name")); - notebookSessionService.createAsset(new NotebookSession().setName("test-notebook-name")); - notebookSessionService.createAsset(new NotebookSession().setName("test-notebook-name")); + notebookSessionService.createAsset((NotebookSession) new NotebookSession().setName("test-notebook-name")); + notebookSessionService.createAsset((NotebookSession) new NotebookSession().setName("test-notebook-name")); + notebookSessionService.createAsset((NotebookSession) new NotebookSession().setName("test-notebook-name")); mockMvc.perform(MockMvcRequestBuilders.get("/sessions").with(csrf())) .andExpect(status().isOk()) @@ -85,8 +85,8 @@ public void testItCanGetNotebookSessions() throws Exception { @WithUserDetails(MockUser.URSULA) public void testItCanDeleteNotebookSession() throws Exception { - final NotebookSession notebookSession = - notebookSessionService.createAsset(new NotebookSession().setName("test-notebook-name")); + final NotebookSession notebookSession = notebookSessionService.createAsset( + (NotebookSession) new NotebookSession().setName("test-notebook-name")); mockMvc.perform(MockMvcRequestBuilders.delete("/sessions/" + notebookSession.getId()) .with(csrf())) diff --git a/packages/server/src/test/java/software/uncharted/terarium/hmiserver/controller/dataservice/ProjectControllerTests.java b/packages/server/src/test/java/software/uncharted/terarium/hmiserver/controller/dataservice/ProjectControllerTests.java index 88be11def3..8ca53ffa28 100644 --- a/packages/server/src/test/java/software/uncharted/terarium/hmiserver/controller/dataservice/ProjectControllerTests.java +++ b/packages/server/src/test/java/software/uncharted/terarium/hmiserver/controller/dataservice/ProjectControllerTests.java @@ -60,7 +60,7 @@ public void teardown() throws IOException { @WithUserDetails(MockUser.URSULA) public void testItCanCreateProject() throws Exception { - final Project project = new Project().setName("test-name"); + final Project project = (Project) new Project().setName("test-name"); mockMvc.perform(MockMvcRequestBuilders.post("/projects") .with(csrf()) @@ -73,7 +73,7 @@ public void testItCanCreateProject() throws Exception { @WithUserDetails(MockUser.URSULA) public void testItCanGetProject() throws Exception { - final Project project = projectService.createProject(new Project().setName("test-name")); + final Project project = projectService.createProject((Project) new Project().setName("test-name")); mockMvc.perform(MockMvcRequestBuilders.get("/projects/" + project.getId()) .with(csrf())) @@ -84,7 +84,7 @@ public void testItCanGetProject() throws Exception { @WithUserDetails(MockUser.URSULA) public void testItCanUpdateProject() throws Exception { - final Project project = projectService.createProject(new Project().setName("test-name")); + final Project project = projectService.createProject((Project) new Project().setName("test-name")); mockMvc.perform(MockMvcRequestBuilders.put("/projects/" + project.getId()) .with(csrf()) @@ -97,7 +97,7 @@ public void testItCanUpdateProject() throws Exception { @WithUserDetails(MockUser.URSULA) public void testItCanDeleteProject() throws Exception { - final Project project = projectService.createProject(new Project().setName("test-name")); + final Project project = projectService.createProject((Project) new Project().setName("test-name")); mockMvc.perform(MockMvcRequestBuilders.delete("/projects/" + project.getId()) .with(csrf())) @@ -110,9 +110,9 @@ public void testItCanDeleteProject() throws Exception { @WithUserDetails(MockUser.URSULA) public void testItCanCreateProjectAsset() throws Exception { - final Project project = projectService.createProject(new Project().setName("test-name")); + final Project project = projectService.createProject((Project) new Project().setName("test-name")); - final DocumentAsset documentAsset = documentAssetService.createAsset( + final DocumentAsset documentAsset = documentAssetService.createAsset((DocumentAsset) new DocumentAsset().setName("test-document-name").setDescription("my description")); final ProjectAsset projectAsset = new ProjectAsset() @@ -143,9 +143,9 @@ public void testItCanCreateProjectAsset() throws Exception { @WithUserDetails(MockUser.URSULA) public void testItCanDeleteProjectAsset() throws Exception { - final Project project = projectService.createProject(new Project().setName("test-name")); + final Project project = projectService.createProject((Project) new Project().setName("test-name")); - final DocumentAsset documentAsset = documentAssetService.createAsset( + final DocumentAsset documentAsset = documentAssetService.createAsset((DocumentAsset) new DocumentAsset().setName("test-document-name").setDescription("my description")); projectAssetService.createProjectAsset(project, AssetType.DOCUMENT, documentAsset); diff --git a/packages/server/src/test/java/software/uncharted/terarium/hmiserver/controller/dataservice/TDSCodeControllerTests.java b/packages/server/src/test/java/software/uncharted/terarium/hmiserver/controller/dataservice/TDSCodeControllerTests.java index 83e4fa3a20..1d503179fc 100644 --- a/packages/server/src/test/java/software/uncharted/terarium/hmiserver/controller/dataservice/TDSCodeControllerTests.java +++ b/packages/server/src/test/java/software/uncharted/terarium/hmiserver/controller/dataservice/TDSCodeControllerTests.java @@ -50,7 +50,7 @@ public void teardown() throws IOException { @WithUserDetails(MockUser.URSULA) public void testItCanCreateCode() throws Exception { - final Code codeAsset = new Code().setName("test-code-name").setDescription("my description"); + final Code codeAsset = (Code) new Code().setName("test-code-name").setDescription("my description"); mockMvc.perform(MockMvcRequestBuilders.post("/code-asset") .with(csrf()) @@ -64,7 +64,7 @@ public void testItCanCreateCode() throws Exception { public void testItCanGetCode() throws Exception { final Code codeAsset = codeAssetService.createAsset( - new Code().setName("test-code-name").setDescription("my description")); + (Code) new Code().setName("test-code-name").setDescription("my description")); mockMvc.perform(MockMvcRequestBuilders.get("/code-asset/" + codeAsset.getId()) .with(csrf())) @@ -75,11 +75,11 @@ public void testItCanGetCode() throws Exception { @WithUserDetails(MockUser.URSULA) public void testItCanGetCodes() throws Exception { - codeAssetService.createAsset(new Code().setName("test-code-name").setDescription("my description")); + codeAssetService.createAsset((Code) new Code().setName("test-code-name").setDescription("my description")); - codeAssetService.createAsset(new Code().setName("test-code-name").setDescription("my description")); + codeAssetService.createAsset((Code) new Code().setName("test-code-name").setDescription("my description")); - codeAssetService.createAsset(new Code().setName("test-code-name").setDescription("my description")); + codeAssetService.createAsset((Code) new Code().setName("test-code-name").setDescription("my description")); mockMvc.perform(MockMvcRequestBuilders.get("/code-asset").with(csrf())) .andExpect(status().isOk()) @@ -91,7 +91,7 @@ public void testItCanGetCodes() throws Exception { public void testItCanDeleteCode() throws Exception { final Code codeAsset = codeAssetService.createAsset( - new Code().setName("test-code-name").setDescription("my description")); + (Code) new Code().setName("test-code-name").setDescription("my description")); mockMvc.perform(MockMvcRequestBuilders.delete("/code-asset/" + codeAsset.getId()) .with(csrf())) @@ -105,7 +105,7 @@ public void testItCanDeleteCode() throws Exception { public void testItCanUploadCode() throws Exception { final Code codeAsset = codeAssetService.createAsset( - new Code().setName("test-code-name").setDescription("my description")); + (Code) new Code().setName("test-code-name").setDescription("my description")); // Create a MockMultipartFile object final MockMultipartFile file = new MockMultipartFile( @@ -133,7 +133,7 @@ public void testItCanUploadCode() throws Exception { public void testItCanUploadCodeFromGithub() throws Exception { final Code codeAsset = codeAssetService.createAsset( - new Code().setName("test-code-name").setDescription("my description")); + (Code) new Code().setName("test-code-name").setDescription("my description")); mockMvc.perform(MockMvcRequestBuilders.put("/code-asset/" + codeAsset.getId() + "/upload-code-from-github") .with(csrf()) @@ -149,7 +149,7 @@ public void testItCanUploadCodeFromGithub() throws Exception { public void testItCanUploadCodeFromGithubRepo() throws Exception { final Code codeAsset = codeAssetService.createAsset( - new Code().setName("test-code-name").setDescription("my description")); + (Code) new Code().setName("test-code-name").setDescription("my description")); mockMvc.perform(MockMvcRequestBuilders.put("/code-asset/" + codeAsset.getId() + "/upload-code-from-github-repo") .with(csrf()) @@ -164,7 +164,7 @@ public void testItCanUploadCodeFromGithubRepo() throws Exception { public void testItCanDownloadCodeAsText() throws Exception { final Code codeAsset = codeAssetService.createAsset( - new Code().setName("test-code-name").setDescription("my description")); + (Code) new Code().setName("test-code-name").setDescription("my description")); final String content = "this is the file content for the testItCanDownloadCode test"; diff --git a/packages/server/src/test/java/software/uncharted/terarium/hmiserver/controller/knowledge/KnowledgeControllerTests.java b/packages/server/src/test/java/software/uncharted/terarium/hmiserver/controller/knowledge/KnowledgeControllerTests.java index f3098524b0..3fb7b87bf1 100644 --- a/packages/server/src/test/java/software/uncharted/terarium/hmiserver/controller/knowledge/KnowledgeControllerTests.java +++ b/packages/server/src/test/java/software/uncharted/terarium/hmiserver/controller/knowledge/KnowledgeControllerTests.java @@ -256,10 +256,10 @@ public void base64EquationsToLatexTests() throws Exception { @WithUserDetails(MockUser.URSULA) public void variableExtractionTests() throws Exception { - DocumentAsset documentAsset = new DocumentAsset() + DocumentAsset documentAsset = (DocumentAsset) new DocumentAsset() + .setText("x = 0. y = 1. I = Infected population.") .setName("test-document-name") - .setDescription("my description") - .setText("x = 0. y = 1. I = Infected population."); + .setDescription("my description"); documentAsset = documentAssetService.createAsset(documentAsset); @@ -275,10 +275,10 @@ public void variableExtractionTests() throws Exception { @WithUserDetails(MockUser.URSULA) public void variableExtractionWithModelTests() throws Exception { - DocumentAsset documentAsset = new DocumentAsset() + DocumentAsset documentAsset = (DocumentAsset) new DocumentAsset() + .setText("x = 0. y = 1. I = Infected population.") .setName("test-document-name") - .setDescription("my description") - .setText("x = 0. y = 1. I = Infected population."); + .setDescription("my description"); documentAsset = documentAssetService.createAsset(documentAsset); @@ -301,10 +301,10 @@ public void variableExtractionWithModelTests() throws Exception { @WithUserDetails(MockUser.URSULA) public void linkAmrTests() throws Exception { - DocumentAsset documentAsset = new DocumentAsset() + DocumentAsset documentAsset = (DocumentAsset) new DocumentAsset() + .setText("x = 0. y = 1. I = Infected population.") .setName("test-document-name") - .setDescription("my description") - .setText("x = 0. y = 1. I = Infected population."); + .setDescription("my description"); documentAsset = documentAssetService.createAsset(documentAsset); @@ -340,10 +340,10 @@ public void cosmosPdfExtraction() throws Exception { final HttpEntity pdfFileEntity = new ByteArrayEntity(content, ContentType.create("application/pdf")); - DocumentAsset documentAsset = new DocumentAsset() + DocumentAsset documentAsset = (DocumentAsset) new DocumentAsset() + .setFileNames(List.of("paper.pdf")) .setName("test-pdf-name") - .setDescription("my description") - .setFileNames(List.of("paper.pdf")); + .setDescription("my description"); documentAsset = documentAssetService.createAsset(documentAsset); @@ -361,30 +361,30 @@ public void cosmosPdfExtraction() throws Exception { @WithUserDetails(MockUser.URSULA) public void profileModel() throws Exception { - DocumentAsset documentAsset = new DocumentAsset() - .setName("test-pdf-name") - .setDescription("my description") + DocumentAsset documentAsset = (DocumentAsset) new DocumentAsset() .setText( """ - In this paper, we study the effectiveness of the modelling approach on the pandemic due to the spreading - of the novel COVID-19 disease and develop a susceptible-infected-removed (SIR) model that provides a - theoretical framework to investigate its spread within a community. Here, the model is based upon the - well-known susceptible-infected-removed (SIR) model with the difference that a total population is not - defined or kept constant per se and the number of susceptible individuals does not decline monotonically. - To the contrary, as we show herein, it can be increased in surge periods! In particular, we investigate - the time evolution of different populations and monitor diverse significant parameters for the spread - of the disease in various communities, represented by China, South Korea, India, Australia, USA, Italy - and the state of Texas in the USA. The SIR model can provide us with insights and predictions of the - spread of the virus in communities that the recorded data alone cannot. Our work shows the importance - of modelling the spread of COVID-19 by the SIR model that we propose here, as it can help to assess - the impact of the disease by offering valuable predictions. Our analysis takes into account data from - January to June, 2020, the period that contains the data before and during the implementation of strict - and control measures. We propose predictions on various parameters related to the spread of COVID-19 - and on the number of susceptible, infected and removed populations until September 2020. By comparing - the recorded data with the data from our modelling approaches, we deduce that the spread of COVID- - 19 can be under control in all communities considered, if proper restrictions and strong policies are - implemented to control the infection rates early from the spread of the disease. - """); + In this paper, we study the effectiveness of the modelling approach on the pandemic due to the spreading + of the novel COVID-19 disease and develop a susceptible-infected-removed (SIR) model that provides a + theoretical framework to investigate its spread within a community. Here, the model is based upon the + well-known susceptible-infected-removed (SIR) model with the difference that a total population is not + defined or kept constant per se and the number of susceptible individuals does not decline monotonically. + To the contrary, as we show herein, it can be increased in surge periods! In particular, we investigate + the time evolution of different populations and monitor diverse significant parameters for the spread + of the disease in various communities, represented by China, South Korea, India, Australia, USA, Italy + and the state of Texas in the USA. The SIR model can provide us with insights and predictions of the + spread of the virus in communities that the recorded data alone cannot. Our work shows the importance + of modelling the spread of COVID-19 by the SIR model that we propose here, as it can help to assess + the impact of the disease by offering valuable predictions. Our analysis takes into account data from + January to June, 2020, the period that contains the data before and during the implementation of strict + and control measures. We propose predictions on various parameters related to the spread of COVID-19 + and on the number of susceptible, infected and removed populations until September 2020. By comparing + the recorded data with the data from our modelling approaches, we deduce that the spread of COVID- + 19 can be under control in all communities considered, if proper restrictions and strong policies are + implemented to control the infection rates early from the spread of the disease. + """) + .setName("test-pdf-name") + .setDescription("my description"); documentAsset = documentAssetService.createAsset(documentAsset); @@ -413,7 +413,7 @@ public void profileDataset() throws Exception { final byte[] content = Files.readAllBytes(resource.getFile().toPath()); Dataset dataset = datasetService.createAsset( - new Dataset().setName("test-dataset-name").setDescription("my description")); + (Dataset) new Dataset().setName("test-dataset-name").setDescription("my description")); // Create a MockMultipartFile object final MockMultipartFile file = new MockMultipartFile( @@ -435,30 +435,30 @@ public void profileDataset() throws Exception { })) .andExpect(status().isOk()); - DocumentAsset documentAsset = new DocumentAsset() - .setName("test-pdf-name") - .setDescription("my description") + DocumentAsset documentAsset = (DocumentAsset) new DocumentAsset() .setText( """ - In this paper, we study the effectiveness of the modelling approach on the pandemic due to the spreading - of the novel COVID-19 disease and develop a susceptible-infected-removed (SIR) model that provides a - theoretical framework to investigate its spread within a community. Here, the model is based upon the - well-known susceptible-infected-removed (SIR) model with the difference that a total population is not - defined or kept constant per se and the number of susceptible individuals does not decline monotonically. - To the contrary, as we show herein, it can be increased in surge periods! In particular, we investigate - the time evolution of different populations and monitor diverse significant parameters for the spread - of the disease in various communities, represented by China, South Korea, India, Australia, USA, Italy - and the state of Texas in the USA. The SIR model can provide us with insights and predictions of the - spread of the virus in communities that the recorded data alone cannot. Our work shows the importance - of modelling the spread of COVID-19 by the SIR model that we propose here, as it can help to assess - the impact of the disease by offering valuable predictions. Our analysis takes into account data from - January to June, 2020, the period that contains the data before and during the implementation of strict - and control measures. We propose predictions on various parameters related to the spread of COVID-19 - and on the number of susceptible, infected and removed populations until September 2020. By comparing - the recorded data with the data from our modelling approaches, we deduce that the spread of COVID- - 19 can be under control in all communities considered, if proper restrictions and strong policies are - implemented to control the infection rates early from the spread of the disease. - """); + In this paper, we study the effectiveness of the modelling approach on the pandemic due to the spreading + of the novel COVID-19 disease and develop a susceptible-infected-removed (SIR) model that provides a + theoretical framework to investigate its spread within a community. Here, the model is based upon the + well-known susceptible-infected-removed (SIR) model with the difference that a total population is not + defined or kept constant per se and the number of susceptible individuals does not decline monotonically. + To the contrary, as we show herein, it can be increased in surge periods! In particular, we investigate + the time evolution of different populations and monitor diverse significant parameters for the spread + of the disease in various communities, represented by China, South Korea, India, Australia, USA, Italy + and the state of Texas in the USA. The SIR model can provide us with insights and predictions of the + spread of the virus in communities that the recorded data alone cannot. Our work shows the importance + of modelling the spread of COVID-19 by the SIR model that we propose here, as it can help to assess + the impact of the disease by offering valuable predictions. Our analysis takes into account data from + January to June, 2020, the period that contains the data before and during the implementation of strict + and control measures. We propose predictions on various parameters related to the spread of COVID-19 + and on the number of susceptible, infected and removed populations until September 2020. By comparing + the recorded data with the data from our modelling approaches, we deduce that the spread of COVID- + 19 can be under control in all communities considered, if proper restrictions and strong policies are + implemented to control the infection rates early from the spread of the disease. + """) + .setName("test-pdf-name") + .setDescription("my description"); documentAsset = documentAssetService.createAsset(documentAsset); @@ -488,10 +488,8 @@ public void codeToAmrTest() throws Exception { final Map files = new HashMap<>(); files.put(filename, codeFile); - final Code code = codeService.createAsset(new Code() - .setName("test-code-name") - .setDescription("my description") - .setFiles(files)); + final Code code = codeService.createAsset( + (Code) new Code().setFiles(files).setName("test-code-name").setDescription("my description")); final HttpEntity fileEntity = new ByteArrayEntity(content, ContentType.APPLICATION_OCTET_STREAM); codeService.uploadFile(code.getId(), filename, fileEntity, ContentType.TEXT_PLAIN); @@ -522,10 +520,8 @@ public void codeToAmrTestLLM() throws Exception { final Map files = new HashMap<>(); files.put(filename, codeFile); - final Code code = codeService.createAsset(new Code() - .setName("test-code-name") - .setDescription("my description") - .setFiles(files)); + final Code code = codeService.createAsset( + (Code) new Code().setFiles(files).setName("test-code-name").setDescription("my description")); final HttpEntity fileEntity = new ByteArrayEntity(content, ContentType.APPLICATION_OCTET_STREAM); codeService.uploadFile(code.getId(), filename, fileEntity, ContentType.TEXT_PLAIN); @@ -557,10 +553,8 @@ public void codeToAmrTestDynamicsOnly() throws Exception { final Map files = new HashMap<>(); files.put(filename, codeFile); - final Code code = codeService.createAsset(new Code() - .setName("test-code-name") - .setDescription("my description") - .setFiles(files)); + final Code code = codeService.createAsset( + (Code) new Code().setFiles(files).setName("test-code-name").setDescription("my description")); final HttpEntity fileEntity = new ByteArrayEntity(content, ContentType.APPLICATION_OCTET_STREAM); codeService.uploadFile(code.getId(), filename, fileEntity, ContentType.TEXT_PLAIN); diff --git a/packages/server/src/test/java/software/uncharted/terarium/hmiserver/service/ExtractionServiceTests.java b/packages/server/src/test/java/software/uncharted/terarium/hmiserver/service/ExtractionServiceTests.java index 2a61f54396..5e68c9ae82 100644 --- a/packages/server/src/test/java/software/uncharted/terarium/hmiserver/service/ExtractionServiceTests.java +++ b/packages/server/src/test/java/software/uncharted/terarium/hmiserver/service/ExtractionServiceTests.java @@ -58,10 +58,10 @@ public void teardown() throws IOException { @WithUserDetails(MockUser.URSULA) public void variableExtractionTests() throws Exception { - DocumentAsset documentAsset = new DocumentAsset() + DocumentAsset documentAsset = (DocumentAsset) new DocumentAsset() + .setText("x = 0. y = 1. I = Infected population.") .setName("test-document-name") - .setDescription("my description") - .setText("x = 0. y = 1. I = Infected population."); + .setDescription("my description"); documentAsset = documentAssetService.createAsset(documentAsset); @@ -77,10 +77,10 @@ public void variableExtractionWithModelTests() throws Exception { final ClassPathResource resource1 = new ClassPathResource("knowledge/extraction_text.txt"); final byte[] content1 = Files.readAllBytes(resource1.getFile().toPath()); - DocumentAsset documentAsset = new DocumentAsset() + DocumentAsset documentAsset = (DocumentAsset) new DocumentAsset() + .setText(new String(content1)) .setName("test-document-name") - .setDescription("my description") - .setText(new String(content1)); + .setDescription("my description"); documentAsset = documentAssetService.createAsset(documentAsset); @@ -99,10 +99,10 @@ public void variableExtractionWithModelTests() throws Exception { @WithUserDetails(MockUser.URSULA) public void linkAmrTests() throws Exception { - DocumentAsset documentAsset = new DocumentAsset() + DocumentAsset documentAsset = (DocumentAsset) new DocumentAsset() + .setText("x = 0. y = 1. I = Infected population.") .setName("test-document-name") - .setDescription("my description") - .setText("x = 0. y = 1. I = Infected population."); + .setDescription("my description"); documentAsset = documentAssetService.createAsset(documentAsset); @@ -128,10 +128,10 @@ public void cosmosPdfExtraction() throws Exception { final HttpEntity pdfFileEntity = new ByteArrayEntity(content, ContentType.create("application/pdf")); - DocumentAsset documentAsset = new DocumentAsset() + DocumentAsset documentAsset = (DocumentAsset) new DocumentAsset() + .setFileNames(List.of("paper.pdf")) .setName("test-pdf-name") - .setDescription("my description") - .setFileNames(List.of("paper.pdf")); + .setDescription("my description"); documentAsset = documentAssetService.createAsset(documentAsset); diff --git a/packages/server/src/test/java/software/uncharted/terarium/hmiserver/service/data/WorkflowServiceTests.java b/packages/server/src/test/java/software/uncharted/terarium/hmiserver/service/data/WorkflowServiceTests.java index 85180cd941..32a60f76f1 100644 --- a/packages/server/src/test/java/software/uncharted/terarium/hmiserver/service/data/WorkflowServiceTests.java +++ b/packages/server/src/test/java/software/uncharted/terarium/hmiserver/service/data/WorkflowServiceTests.java @@ -52,11 +52,11 @@ static Workflow createWorkflow() throws Exception { final WorkflowEdge cd = new WorkflowEdge().setSource(c.getId()).setTarget(d.getId()); return (Workflow) new Workflow() - .setDescription("test-workflow-description-0") .setTransform(new Transform().setX(1).setY(2).setK(3)) .setNodes(List.of(a, b, c, d)) .setEdges(List.of(ab, bc, cd)) .setPublicAsset(true) + .setDescription("test-workflow-description-0") .setName("test-workflow-name-0"); }