Class ArtifactInfoTest


  • public class ArtifactInfoTest
    extends java.lang.Object
    Tests the YAML descriptor implementation and the Validator.
    Author:
    Holger Eichelberger, SSE
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private static void assertEndpoint​(de.iip_ecosphere.platform.services.spring.yaml.YamlEndpoint endpoint, int port, java.lang.String host)
      Asserts properties of an YamlEndpoint.
      private static void assertProcess​(de.iip_ecosphere.platform.services.spring.yaml.YamlProcess process, java.lang.String artifact, java.lang.String executable, boolean started, int waitTime, java.lang.String... cmdArgs)
      Asserts YamlProcess information.
      private static void assertRelation​(de.iip_ecosphere.platform.services.spring.yaml.YamlRelation relation, java.lang.String channel, int port, java.lang.String host)
      Asserts properties of a YamlRelation.
      private static void assertServiceBasics​(de.iip_ecosphere.platform.services.spring.yaml.YamlService service, java.lang.String id, java.lang.String name, java.lang.String version, java.lang.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​(java.util.List<java.lang.String> list, java.lang.String... expected)
      Asserts a list of strings w.r.t.
      private static java.lang.Class<?> assertTypedData​(de.iip_ecosphere.platform.services.TypedDataConnectorDescriptor desc, java.lang.String id, java.lang.String name, java.lang.String description, java.lang.String type)
      Asserts properties of a typed connector descriptor.
      private static java.lang.Class<?> assertTypedData​(de.iip_ecosphere.platform.services.TypedDataDescriptor desc, java.lang.String name, java.lang.String description, java.lang.String type)
      Asserts properties of a typed data descriptor.
      void testFileDescriptorTest()
      void testInvalidYaml()
      Tests a structurally correct but invalid YAML file.
      void testResolution()
      Tests the class resolution.
      void testYaml()
      Tests the YAML reader.
      • Methods inherited from class java.lang.Object

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

      • ArtifactInfoTest

        public ArtifactInfoTest()
    • Method Detail

      • testYaml

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

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

        private static java.lang.Class<?> assertTypedData​(de.iip_ecosphere.platform.services.TypedDataConnectorDescriptor desc,
                                                          java.lang.String id,
                                                          java.lang.String name,
                                                          java.lang.String description,
                                                          java.lang.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 java.lang.Class<?> assertTypedData​(de.iip_ecosphere.platform.services.TypedDataDescriptor desc,
                                                          java.lang.String name,
                                                          java.lang.String description,
                                                          java.lang.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 java.io.IOException
        Tests a structurally correct but invalid YAML file.
        Throws:
        java.io.IOException - shall not occur
      • assertStringList

        private static void assertStringList​(java.util.List<java.lang.String> list,
                                             java.lang.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,
                                                java.lang.String id,
                                                java.lang.String name,
                                                java.lang.String version,
                                                java.lang.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,
                                           java.lang.String channel,
                                           int port,
                                           java.lang.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,
                                           java.lang.String host)
        Asserts properties of an YamlEndpoint.
        Parameters:
        port - the port number to be used/substituted
        host - the host name to be used/substituted
        endpoint - the endpoint to be asserted
      • assertProcess

        private static void assertProcess​(de.iip_ecosphere.platform.services.spring.yaml.YamlProcess process,
                                          java.lang.String artifact,
                                          java.lang.String executable,
                                          boolean started,
                                          int waitTime,
                                          java.lang.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 java.io.IOException
        Throws:
        java.io.IOException - in case that descriptors/files cannot be read