Skip to content

Commit

Permalink
Baseline validation (#93)
Browse files Browse the repository at this point in the history
* Update to ARCTokenisation 5.0

* add baseline Validation for ARCs

add baseline Validation for ARCs in case no specific validation package is referenced

* Adress the changes requested in #93

- Rename BaselineValidation -> ARCSpecification
- Rename isaLight -> V2_Draft
- Outsource the Expect functions from V2_Draft to the ValidateAPI
- Remove metadata section from ARCSpecification
- Remove the confusing checkForParam function
- Revert unneeded Changes to the arc-validate.fsproj

* Add arc Structure for testing purposes

* Update .gitignore

Add Mac specific DS_Store files

* Add test for ARCSpecification V2_Draft

Add test for ARCSpecification V2_Draft.

* Update ARCSpecification.fs

Fix test path

* Adress changes requested in #93

- Move ARCSpecification into ARCExpect
- Move Tests and relevant test files in respect
- Rename ARCValidate.ARCSpecification. V2_Draft. testCases ->  ARCExpect.ARCSpecification. V2_Draft .validationCases
- Remove internal keyword from V2_Draft modules
- Fixed typos

* Adress changes requested in #93

- Fix Error Message in tests
- Change Usage of Validation Pipeline to its components
- Removed redundant references in fsproj

* Remove redundant code

as seen in #93
  • Loading branch information
LibraChris authored Apr 24, 2024
1 parent b283580 commit 4d70e78
Show file tree
Hide file tree
Showing 22 changed files with 641 additions and 38 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -355,3 +355,6 @@ test/arc-validate-results.xml
!/tests/fixtures/arcs/invenio-test-arc/.gitkeep
/tmp/watch
/.fsdocs

# Mac specific files
**/.DS_Store
10 changes: 4 additions & 6 deletions src/ARCExpect/ARCExpect.fsproj
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>

<ItemGroup>
<None Include="packages.lock.json" />
<None Include="RELEASE_NOTES.md" />
Expand All @@ -23,20 +21,20 @@
<Compile Include="TopLevelAPI.fs" />
<Compile Include="Configs\PathConfig.fs" />
<Compile Include="Configs\ARCConfig.fs" />
<Compile Include="ARCSpecification.fs" />
<Compile Include="TestGeneration\NonCritical\ARCISA.fs" />
<Compile Include="TestGeneration\Critical\ARCFileSystem.fs" />
<Compile Include="TestGeneration\Critical\ARCISA.fs" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Expecto" Version="[9.0.4]" />
<PackageReference Include="FSharpAux" Version="[2.0.0]" />
<PackageReference Include="FsSpreadsheet" Version="[5.0.2]" />
<PackageReference Include="FsSpreadsheet.ExcelIO" Version="[5.0.2]" />
<PackageReference Include="ARCTokenization" Version="[3.0.0]" />
<PackageReference Include="ARCTokenization" Version="[5.0.0]" />
<PackageReference Include="Graphoscope" Version="[0.6.0-preview.1]" />
<PackageReference Include="OBO.NET" Version="[0.4.2]" />
<PackageReference Include="Cytoscape.NET" Version="[0.2.0]" />
<PackageReference Include="AnyBadge.NET" Version="[2.0.0]" />
</ItemGroup>
</Project>
</Project>
553 changes: 553 additions & 0 deletions src/ARCExpect/ARCSpecification.fs

Large diffs are not rendered by default.

34 changes: 34 additions & 0 deletions src/arc-validate/APIs/ValidateAPI.fs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,40 @@ module ValidateAPI =
" - run [green]arc-validate validate -p <your-desired-package-name>[/] to validate agaionst a validation package."
]
|> List.iter AnsiConsole.MarkupLine

let status = AnsiConsole.Status()
let mutable exitCode = ExitCode.Success

status.Start($"Performing validation against the ARC specification V2_Draft", fun ctx ->

if verbose then

AnsiConsole.MarkupLine("LOG: Running in:")
AnsiConsole.Write(TextPath(Path.GetFullPath(root)))
AnsiConsole.MarkupLine("")
AnsiConsole.MarkupLine($"LOG: running validation against [bold underline green]ARC specification V2_Draft[/].")
AnsiConsole.MarkupLine($"LOG: Output path is:")
AnsiConsole.Write(TextPath(Path.GetFullPath(outPath)))
AnsiConsole.MarkupLine("")

let cases = ARCSpecification.V2_Draft.validationCases root

let outDirBadge = System.IO.Path.Combine(root, "ARC_specification_V2_Draft.svg")
let outDirResXml =System.IO.Path.Combine(root, "ARC_specification_V2_Draft.xml")

let results = ARCExpect.Execute.Validation cases

results
|> Execute.JUnitSummaryCreation(outDirResXml)

results
|> Execute.BadgeCreation(outDirBadge, "ARC specification V2_Draft", "passing", DefaultColor=AnyBadge.NET.Color.GREEN)

if results.successful then
exitCode <- ExitCode.Success
else
exitCode <- ExitCode.CriticalTestFailure
)

| Some packageName -> // Validate against a specific package

Expand Down
20 changes: 7 additions & 13 deletions src/arc-validate/arc-validate.fsproj
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">

<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<!--<PublishSingleFile>true</PublishSingleFile>-->
<!--<PackAsTool>true</PackAsTool>-->
</PropertyGroup>

<ItemGroup>
<None Include="RELEASE_NOTES.md" />
<Compile Include="BadgeCreation.fs" />
Expand All @@ -19,34 +17,30 @@
<Compile Include="APIs\ValidateAPI.fs" />
<Compile Include="APIs\ARCValidateAPI.fs" />
<Compile Include="CommandHandling.fs" />
<Compile Include="Program.fs" />
<Compile Include="Program.fs" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Argu" Version="[6.1.4]" />
<PackageReference Include="Expecto" Version="[9.0.4]" />
<PackageReference Include="Spectre.Console" Version="0.48.0" />
<PackageReference Include="Spectre.Console.CLI" Version="0.48.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\ARCExpect\ARCExpect.fsproj" PackageVersion="[1.0.0, 2.0.0)" />
<ProjectReference Include="..\ARCValidationPackages\ARCValidationPackages.fsproj" PackageVersion="[1.0.0, 2.0.0)" />
</ItemGroup>

<Target Name="UseExplicitPackageVersions" BeforeTargets="GenerateNuspec">
<ItemGroup>
<_ProjectReferenceWithExplicitPackageVersion Include="@(ProjectReference->'%(FullPath)')" Condition="'%(ProjectReference.PackageVersion)' != ''" />
<_ProjectReferenceWithExactPackageVersion Include="@(ProjectReference->'%(FullPath)')" Condition="'%(ProjectReference.ExactVersion)' == 'true'" />
<_ProjectReferenceWithExplicitPackageVersion Include="@(ProjectReference-&gt;'%(FullPath)')" Condition="'%(ProjectReference.PackageVersion)' != ''" />
<_ProjectReferenceWithExactPackageVersion Include="@(ProjectReference-&gt;'%(FullPath)')" Condition="'%(ProjectReference.ExactVersion)' == 'true'" />
<_ProjectReferenceWithReassignedVersion Include="@(_ProjectReferencesWithVersions)" Condition="'%(Identity)' != '' And '@(_ProjectReferenceWithExplicitPackageVersion)' == '@(_ProjectReferencesWithVersions)'">
<ProjectVersion>@(_ProjectReferenceWithExplicitPackageVersion->'%(PackageVersion)')</ProjectVersion>
<ProjectVersion>@(_ProjectReferenceWithExplicitPackageVersion-&gt;'%(PackageVersion)')</ProjectVersion>
</_ProjectReferenceWithReassignedVersion>
<_ProjectReferenceWithReassignedVersion Include="@(_ProjectReferencesWithVersions)" Condition="'%(Identity)' != '' And '@(_ProjectReferenceWithExactPackageVersion)' == '@(_ProjectReferencesWithVersions)'">
<ProjectVersion>[@(_ProjectReferencesWithVersions->'%(ProjectVersion)')]</ProjectVersion>
<ProjectVersion>@(_ProjectReferenceWithExplicitPackageVersion->'%(PackageVersion)')</ProjectVersion>
</_ProjectReferenceWithReassignedVersion>
<_ProjectReferencesWithVersions Remove="@(_ProjectReferenceWithReassignedVersion)" />
<_ProjectReferencesWithVersions Include="@(_ProjectReferenceWithReassignedVersion)" />
</ItemGroup>
</Target>

</Project>
</Project>
8 changes: 3 additions & 5 deletions tests/ARCExpect.Tests/ARCExpect.Tests.fsproj
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">

<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<GenerateProgramFile>false</GenerateProgramFile>
</PropertyGroup>

<ItemGroup>
<None Include="fixtures\**" CopyToOutputDirectory="Always" />
<EmbeddedResource Remove="CLITests\**" />
Expand All @@ -19,9 +17,9 @@
<Compile Include="ParamCollectionTests.fs" />
<Compile Include="ARCExpectTests.fs" />
<Compile Include="ARCGraphTests.fs" />
<Compile Include="ARCSpecification.fs" />
<Compile Include="Main.fs" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Expecto" Version="9.*" />
<PackageReference Include="YoloDev.Expecto.TestSdk" Version="0.*" />
Expand All @@ -30,4 +28,4 @@
<ProjectReference Include="..\..\src\ARCExpect\ARCExpect.fsproj" />
<ProjectReference Include="..\Common\Common.fsproj" />
</ItemGroup>
</Project>
</Project>
19 changes: 11 additions & 8 deletions tests/ARCExpect.Tests/ARCGraphTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ let mockInv =
let userComment1 = CvParam(Terms.StructuralTerms.userComment, CvValue Terms.StructuralTerms.metadataSectionKey) :> IParam
let userComment2 = CvParam(Terms.StructuralTerms.userComment, Value "Keywords") :> IParam
ARCMock.InvestigationMetadataTokens(
false,
Investigation_Identifier = ["ArcPrototype"],
Investigation_Title = ["ArcPrototype"],
Investigation_Description = ["A prototypic ARC that implements all specification standards accordingly"],
Expand All @@ -35,6 +36,7 @@ let mockInv =

let mockStu =
ARCMock.StudyMetadataTokens(
false,
Study_Identifier = ["experiment1_material"],
Study_Title = ["Prototype for experimental data"],
Study_Description = ["In this a devised study to have an exemplary experimental material description."],
Expand All @@ -45,15 +47,16 @@ let mockStu =

let mockAss =
ARCMock.AssayMetadataTokens(
false,
Assay_File_Name = ["measurement1/isa.assay.xlsx"],
Assay_Performer_Last_Name = ["Maus"; "Katz"],
Assay_Performer_First_Name = ["Oliver"; "Marius"],
Assay_Performer_Mid_Initials = [""; "G."],
Assay_Performer_Email = ["maus@nfdi4plants.org"],
Assay_Performer_Affiliation = ["RPTU University of Kaiserslautern"],
Assay_Performer_Roles = ["research assistant"],
Assay_Performer_Roles_Term_Accession_Number = ["http://purl.org/spar/scoro/research-assistant"],
Assay_Performer_Roles_Term_Source_REF = ["scoro"]
Assay_Person_Last_Name = ["Maus"; "Katz"],
Assay_Person_First_Name = ["Oliver"; "Marius"],
Assay_Person_Mid_Initials = [""; "G."],
Assay_Person_Email = ["maus@nfdi4plants.org"],
Assay_Person_Affiliation = ["RPTU University of Kaiserslautern"],
Assay_Person_Roles = ["research assistant"],
Assay_Person_Roles_Term_Accession_Number = ["http://purl.org/spar/scoro/research-assistant"],
Assay_Person_Roles_Term_Source_REF = ["scoro"]
)
|> List.concat // use flat list
|> Seq.map (fun cvp -> cvp :> IParam)
Expand Down
24 changes: 24 additions & 0 deletions tests/ARCExpect.Tests/ARCSpecification.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
module ARCSpecification

open Expecto


[<Tests>]
let tests =
testList "ARCValidationPackage tests" [
test "V2_Draft" {

let testPath: string = @"../../../../fixtures/arcs/testingArc"

let cases = ARCExpect.ARCSpecification.V2_Draft.validationCases testPath

let runSummary = ARCExpect.Execute.Validation cases

//false None (ParseResults<ARCValidate.CLIArguments.ValidateArgs>.Empty)
Expect.isTrue
runSummary.successful
"The validation cases for ARCSpecification.V2_Draft do not validate a structurally correct ARC."

}

]
8 changes: 2 additions & 6 deletions tests/arc-validate.Tests/arc-validate.Tests.fsproj
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">

<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<GenerateProgramFile>false</GenerateProgramFile>
</PropertyGroup>

<ItemGroup>
<None Include="fixtures\**" CopyToOutputDirectory="Always" />
<Compile Include="JUnit.fs" />
Expand All @@ -16,16 +14,14 @@
<Compile Include="CLITests/CLITests.fs" />
<Compile Include="Main.fs" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Expecto" Version="9.*" />
<PackageReference Include="YoloDev.Expecto.TestSdk" Version="0.*" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.*" />
<PackageReference Update="FSharp.Core" Version="8.*" />
<PackageReference Include="Fake.Core.Process" Version="6.0.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Common\Common.fsproj" />
</ItemGroup>
</Project>
</Project>
Empty file.
Empty file.
Empty file.
Binary file not shown.
Empty file.
Binary file not shown.
Empty file.
Empty file.
Empty file.
Binary file not shown.
Empty file.
Empty file.
Empty file.

0 comments on commit 4d70e78

Please sign in to comment.