Class BenchmarkTestCaseLoader

java.lang.Object
software.amazon.awssdk.benchmark.serde.BenchmarkTestCaseLoader

public final class BenchmarkTestCaseLoader extends Object
Loads protocol test case JSON files and extracts test case data for benchmarks.

The test data files use the c2j protocol test format, where the top-level structure is an array of operation-group objects. Each group contains a cases array with individual test cases.

  • Method Details

    • loadMarshallTestCases

      public static List<BenchmarkTestCaseLoader.MarshallTestCase> loadMarshallTestCases(String resourcePath)
      Load all marshall test cases from the given resource path.

      Iterates through the top-level array of operation groups, then through each group's cases array. Extracts id from the case, operationName from case.given.name, and inputData from case.params.

      Parameters:
      resourcePath - classpath resource path to the input test JSON file
      Returns:
      list of marshall test cases
      Throws:
      IllegalStateException - if the resource is not found
      IllegalArgumentException - if the JSON is malformed or missing required fields
    • loadUnmarshallTestCases

      public static List<BenchmarkTestCaseLoader.UnmarshallTestCase> loadUnmarshallTestCases(String resourcePath)
      Load all unmarshall test cases from the given resource path.

      Iterates through the top-level array of operation groups, then through each group's cases array. Extracts id from the case, operationName from case.given.name, responseBody from case.response.body, statusCode from case.response.status_code (defaults to 200 if absent), and headers from case.response.headers (null if absent).

      Parameters:
      resourcePath - classpath resource path to the output test JSON file
      Returns:
      list of unmarshall test cases
      Throws:
      IllegalStateException - if the resource is not found
      IllegalArgumentException - if the JSON is malformed or missing required fields
    • loadIntermediateModel

      public static IntermediateModel loadIntermediateModel(String resourcePath)
      Load an IntermediateModel from the classpath and patch member names so that ShapeModelReflector resolves the correct fluent setter method names.

      The codegen-generated fluent setter for a member named "SS" is ss(), but ShapeModelReflector derives the setter name by calling StringUtils.uncapitalize(member.getName()) which produces "sS". This method patches each member's name to be the capitalized form of fluentSetterMethodName so that uncapitalize produces the correct result.

      Parameters:
      resourcePath - classpath resource path to the intermediate model JSON
      Returns:
      the loaded and patched IntermediateModel
    • buildOperationInfo

      public static OperationInfo buildOperationInfo(IntermediateModel model, BenchmarkTestCaseLoader.MarshallTestCase testCase)
      Build an OperationInfo for the given operation by inspecting the intermediate model's input shape to determine payload flags. This replicates the logic the codegen uses when generating per-operation marshallers.
      Parameters:
      model - the loaded IntermediateModel
      testCase - the test case (provides operationName, httpMethod, requestUri)
      Returns:
      correctly configured OperationInfo