Class ArtifactInfoTest

java.lang.Object
test.de.iip_ecosphere.platform.services.spring.AbstractTest
test.de.iip_ecosphere.platform.services.spring.ArtifactInfoTest

public class ArtifactInfoTest extends AbstractTest
Tests the YAML descriptor implementation and the Validator.
Author:
Holger Eichelberger, SSE
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    private static void
    assertEndpoint(de.iip_ecosphere.platform.services.spring.yaml.YamlEndpoint endpoint, int port, String host)
    Asserts properties of an YamlEndpoint.
    private static void
    assertProcess(de.iip_ecosphere.platform.services.spring.yaml.YamlProcess process, String artifact, String executable, boolean started, int waitTime, String... cmdArgs)
    Asserts YamlProcess information.
    private static void
    assertRelation(de.iip_ecosphere.platform.services.spring.yaml.YamlRelation relation, String channel, int port, String host)
    Asserts properties of a YamlRelation.
    private static void
    assertServiceBasics(de.iip_ecosphere.platform.services.spring.yaml.YamlService service, String id, String name, String version, String descr)
    Asserts basic properties of a YamlService.
    private static void
    assertServiceCharacteristics(de.iip_ecosphere.platform.services.spring.yaml.YamlService service, boolean deployable, de.iip_ecosphere.platform.services.environment.ServiceKind kind)
    Asserts additional characteristics of a YamlService.
    private static void
    assertStringList(List<String> list, String... expected)
    Asserts a list of strings w.r.t. the expected values.
    private static Class<?>
    assertTypedData(de.iip_ecosphere.platform.services.TypedDataConnectorDescriptor desc, String id, String name, String description, String type)
    Asserts properties of a typed connector descriptor.
    private static Class<?>
    assertTypedData(de.iip_ecosphere.platform.services.TypedDataDescriptor desc, String name, String description, String type)
    Asserts properties of a typed data descriptor.
    void
    void
    Tests a structurally correct but invalid YAML file.
    void
    Tests the class resolution.
    void
    Tests the YAML reader.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ArtifactInfoTest

      public ArtifactInfoTest()
  • Method Details

    • testYaml

      public void testYaml() throws IOException
      Tests the YAML reader.
      Throws:
      IOException - shall not occur
    • testResolution

      public void testResolution() throws IOException
      Tests the class resolution.
      Throws:
      IOException - shall not occur
    • assertTypedData

      private static Class<?> assertTypedData(de.iip_ecosphere.platform.services.TypedDataConnectorDescriptor desc, String id, String name, String description, String type)
      Asserts properties of a typed connector descriptor.
      Parameters:
      desc - the connector descriptor
      id - the identifier of the descriptor (not tested if null)
      name - the name of the parameter
      description - the description
      type - the type (not tested if null)
      Returns:
      the type of the typed data as class (may be null, but not if type was given and asserted)
    • assertTypedData

      private static Class<?> assertTypedData(de.iip_ecosphere.platform.services.TypedDataDescriptor desc, String name, String description, String type)
      Asserts properties of a typed data descriptor.
      Parameters:
      desc - the data descriptor
      name - the name of the parameter
      description - the description
      type - the type (not tested if null)
      Returns:
      the type of the typed data as class (may be null, but not if type was given and asserted)
    • testInvalidYaml

      public void testInvalidYaml() throws IOException
      Tests a structurally correct but invalid YAML file.
      Throws:
      IOException - shall not occur
    • assertStringList

      private static void assertStringList(List<String> list, String... expected)
      Asserts a list of strings w.r.t. the expected values.
      Parameters:
      list - the list
      expected - the expected values
    • assertServiceBasics

      private static void assertServiceBasics(de.iip_ecosphere.platform.services.spring.yaml.YamlService service, String id, String name, String version, String descr)
      Asserts basic properties of a YamlService.
      Parameters:
      service - the service instance to be asserted
      id - the expected service id
      name - the expected service name
      version - the expected service version
      descr - the expected description
    • assertServiceCharacteristics

      private static void assertServiceCharacteristics(de.iip_ecosphere.platform.services.spring.yaml.YamlService service, boolean deployable, de.iip_ecosphere.platform.services.environment.ServiceKind kind)
      Asserts additional characteristics of a YamlService.
      Parameters:
      service - the service instance to be asserted
      deployable - whether it is expected that the service is deployable
      kind - the expected service kind
    • assertRelation

      private static void assertRelation(de.iip_ecosphere.platform.services.spring.yaml.YamlRelation relation, String channel, int port, String host)
      Asserts properties of a YamlRelation.
      Parameters:
      relation - the relation to be asserted
      channel - the expected channel name/id
      port - the port number to be used/substituted
      host - the host name to be used/substituted
    • assertEndpoint

      private static void assertEndpoint(de.iip_ecosphere.platform.services.spring.yaml.YamlEndpoint endpoint, int port, String host)
      Asserts properties of an YamlEndpoint.
      Parameters:
      endpoint - the endpoint to be asserted
      port - the port number to be used/substituted
      host - the host name to be used/substituted
    • assertProcess

      private static void assertProcess(de.iip_ecosphere.platform.services.spring.yaml.YamlProcess process, String artifact, String executable, boolean started, int waitTime, String... cmdArgs)
      Asserts YamlProcess information.
      Parameters:
      process - the process to assert
      artifact - the expected artifact
      executable - the expected executable
      started - whether the process is marked as already started
      waitTime - the expected wait time
      cmdArgs - the expected command line arguments
    • testFileDescriptorTest

      public void testFileDescriptorTest() throws IOException
      Throws:
      IOException - in case that descriptors/files cannot be read