Skip to content

test: add unit tests for KosliTemplateParser, KosliPolicyParser, and PolicyExpressionEvaluator #110

@MaximumTrainer

Description

@MaximumTrainer

Background

KosliTemplateParser, KosliPolicyParser, and PolicyExpressionEvaluator are new Spring components with no tests. They are critical to compliance evaluation.

Tasks

KosliTemplateParser

  • Parse valid Kosli template YAML with trail-level and artifact-level attestations
  • Parse template with ifCondition on an attestation
  • Return null for blank/invalid YAML
  • Handle missing version field (default to 1)

KosliPolicyParser

  • Parse valid policy YAML with provenance.required: true
  • Parse policy with trail-compliance.required: true
  • Parse policy with attestations list including if condition
  • Return null for blank/invalid YAML

PolicyExpressionEvaluator

  • flow.name == "backend" matches correct flow name
  • matches(artifact.name, "^backend.*") regex match
  • exists(flow) returns true when flow name is set
  • not, and, or compound expressions
  • Malformed expression returns false (not exception)

Files

  • backend/src/main/kotlin/com/factstore/application/template/KosliTemplateParser.kt
  • backend/src/main/kotlin/com/factstore/application/policy/

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions