conformance

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 15, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package conformance provides shared helpers for porting message-level OCPP conformance tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MustValidator

func MustValidator(t *testing.T, reg *schema.Registry, version, action, kind string) *schema.Validator

MustValidator returns the registered validator or fails the test immediately.

func RoundTripCP

func RoundTripCP[Req, Resp any](
	t *testing.T,
	subprotocol string,
	reg *schema.Registry,
	register func(*cp.Client),
	msg ocppj.Message[Req, Resp],
	req Req,
) (Resp, error)

RoundTripCP starts a CSMS, connects a CP (which registers handlers via register), waits for the connection to appear, then sends one CSMS-originated request to the charge point and returns the typed response. Use this for SentByCSMS messages (the mirror of RoundTripCSMS).

func RoundTripCSMS

func RoundTripCSMS[Req, Resp any](
	t *testing.T,
	subprotocol string,
	reg *schema.Registry,
	register func(*csms.Server),
	msg ocppj.Message[Req, Resp],
	req Req,
) (Resp, error)

RoundTripCSMS starts a CSMS, connects a CP, sends one CP-originated request, and returns the typed response.

func RunValidationTable

func RunValidationTable(t *testing.T, v *schema.Validator, cases []ValidationCase)

RunValidationTable marshals and validates each case as a named subtest.

Types

type ValidationCase

type ValidationCase struct {
	Name    string
	Message any
	Valid   bool
}

ValidationCase is one named JSON Schema validation scenario.

Directories

Path Synopsis
Package conf16a contains OCPP 1.6 per-message conformance tests.
Package conf16a contains OCPP 1.6 per-message conformance tests.
Package conf16b contains OCPP 1.6 Group B conformance tests.
Package conf16b contains OCPP 1.6 Group B conformance tests.
Package conf16c contains OCPP 1.6 per-message conformance tests for group C.
Package conf16c contains OCPP 1.6 per-message conformance tests for group C.
Package conf201a contains OCPP 2.0.1 per-message conformance tests.
Package conf201a contains OCPP 2.0.1 per-message conformance tests.
Package conf201b contains OCPP 2.0.1 per-message conformance tests.
Package conf201b contains OCPP 2.0.1 per-message conformance tests.
Package conf201c contains OCPP 2.0.1 message-level conformance tests.
Package conf201c contains OCPP 2.0.1 message-level conformance tests.
Package conf201d contains OCPP 2.0.1 per-message conformance tests for group 201-D.
Package conf201d contains OCPP 2.0.1 per-message conformance tests for group 201-D.
Package conf201e contains OCPP 2.0.1 group 201-E message-level conformance tests.
Package conf201e contains OCPP 2.0.1 group 201-E message-level conformance tests.
Package conf201f contains OCPP 2.0.1 per-message conformance tests for group 201-F.
Package conf201f contains OCPP 2.0.1 per-message conformance tests for group 201-F.
Package conf21a contains GROUP 21-A per-message conformance tests for OCPP 2.1.
Package conf21a contains GROUP 21-A per-message conformance tests for OCPP 2.1.
Package conf21b contains OCPP 2.1 GROUP 21-B per-message conformance tests.
Package conf21b contains OCPP 2.1 GROUP 21-B per-message conformance tests.
Package conf21c contains OCPP 2.1 per-message conformance tests for group 21-C.
Package conf21c contains OCPP 2.1 per-message conformance tests for group 21-C.
Package conf21d contains OCPP 2.1 group D conformance tests.
Package conf21d contains OCPP 2.1 group D conformance tests.
Package conf21e contains OCPP 2.1 GROUP 21-E per-message conformance tests.
Package conf21e contains OCPP 2.1 GROUP 21-E per-message conformance tests.
Package conf21f contains OCPP 2.1 per-message conformance tests (GROUP 21-F).
Package conf21f contains OCPP 2.1 per-message conformance tests (GROUP 21-F).
Package conf21g contains OCPP 2.1 group G per-message conformance tests.
Package conf21g contains OCPP 2.1 group G per-message conformance tests.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL