java.lang.Object
org.springframework.cloud.contract.stubrunner.util.StubsParser

public final class StubsParser extends Object
Utility to parse string into a list of configuration of stubs.
Author:
Marcin Grzejszczak
  • Method Details

    • fromString

      public static List<StubConfiguration> fromString(Collection<String> collection, String defaultClassifier)
      The string is expected to be a map with entry called "stubs" that contains a list of Strings in the format
      • groupid:artifactid:version:classifier:port
      • groupid:artifactid:version:classifier
      • groupid:artifactid:version
      • groupid:artifactid
      In the latter case the provided default stub classifier will be passed. Example: "a:b,c:d:e"
      Parameters:
      collection - collection of ids
      defaultClassifier - default classifier to append if one is missing
      Returns:
      parsed stub configurations
    • fromStringWithPort

      public static Map<StubConfiguration,Integer> fromStringWithPort(String notation)
      Parameters:
      notation - ivy notation of stubs with ports
      Returns:
      mapping of parsed stub configurations to ports on which the stub is running
    • ivyFromStringWithPort

      public static String ivyFromStringWithPort(String notation)
      Parameters:
      notation - ivy notation of stubs with ports
      Returns:
      colon seprated dependency notation with port or empty string if no port is present
    • hasPort

      public static boolean hasPort(String id)
      Parameters:
      id - string notation of a stub
      Returns:
      true if a port is there in the identifier