Class SpringStartup

java.lang.Object
de.iip_ecosphere.platform.examples.SpringStartup

public class SpringStartup extends Object
Spring Cloud Stream emulating startup code. Considers system properties ("iip.test.java8" and "iip.springStart.args") as well as command line arguments "iip.test.brokerPort" (broker port to use) and ARG_STOP (auto-stop time in ms). In contrast to a startup of an application with the platform and the service manager, services are started here in default startup sequence (sinks, transformers/monitors, sources) without considering their dependencies. Testing input shall consider a certain startup time before causing actions.
Author:
Holger Eichelberger, SSE
  • Field Details

  • Constructor Details

    • SpringStartup

      public SpringStartup()
  • Method Details

    • main

      public static void main(String[] args)
      Main program to start the application. Takes into account additional args via system property "iip.springStart.args" to allow for maven basic execution with fixed parameters in POM and additional arguments passed in via "iip.springStart.args".
      Parameters:
      args - the command line arguments; the first is the artifact file to start, the remaining is passed on to Spring
    • start

      public static final void start(String... args)
      Starts the application. Used from generated templates. Do not change signature.
      Parameters:
      args - the command line arguments; the first is the artifact file to start, the remaining is passed on to Spring
    • start

      public static void start(File artifact, String... args)
      Starts the application. Used from examples. Do not change signature.
      Parameters:
      artifact - the artifact file (JAR/ZIP) containing the application
      args - the command line arguments
    • addAasNotificationMode

      private static void addAasNotificationMode(String[] args, List<String> cmdArgs)
      Retrieves the AAS notification mode from cmd line argument Starter.ARG_AAS_NOTIFICATION and adds it to cmdArgs.
      Parameters:
      args - the command line arguments
      cmdArgs - the command line arguments to be modified as a side effect
      See Also:
      • Starter.setAasNotificationMode(String[], NotificationMode)
    • addAppId

      private static void addAppId(String[] args, List<String> cmdArgs)
      If given in args, adds Starter.PARAM_IIP_APP_ID to cmdArgs.
      Parameters:
      args - the command line arguments
      cmdArgs - the command line arguments to be modified as a side effect
    • addNoAas

      private static void addNoAas(String[] args, List<String> cmdArgs)
      If given in args, adds Starter.IIP_APP_NOAAS to cmdArgs.
      Parameters:
      args - the command line arguments
      cmdArgs - the command line arguments to be modified as a side effect
    • start

      public static void start(File artifact, boolean doExit, Consumer<ProcessBuilder> procCfg, String... args)
      Starts the application. Considers system property "iip.test.java8" as java binary for Java 8 if not running under Java 8.
      Parameters:
      artifact - the artifact file (JAR/ZIP) containing the application
      doExit - whether at the end of the timing if a timeout is given by args the JVM shall be shut down
      procCfg - a configurer for the process being generated, may be null for none
      args - the command line arguments
    • relocateForUpdates

      private static File relocateForUpdates(File artifact)
      Relocates the artifacts to enable updates, i.e., copies the app artifact so that updates through build processes are not blocked by the running app. No executed if enableUpdates is false. May disable enableUpdates if copying the artifact fails.
      Parameters:
      artifact - the artifact to be relocated
      Returns:
      artifact if no relocation is needed or relocation fails, a temporary copy of the artifact else
    • addFileTracker

      private static void addFileTracker(File artifact, List<String> cmdArgs)
      Adds file tracking folder Starter.PARAM_IIP_TEST_WATCH to cmdArgs.
      Parameters:
      artifact - the app artifact used for starting
      cmdArgs - the command line arguments to be modified as a side effect
    • loadPlugins

      private static void loadPlugins(File artifact, String[] args)
      Loads the oktoflow plugins.
      Parameters:
      artifact - the artifact to execute
      args - the command line arguments
    • getArtifacts

      private static Collection<de.iip_ecosphere.platform.services.spring.SpringCloudArtifactDescriptor> getArtifacts(File file)
      Returns the artifact descriptor(s) from the deployment descriptor in file.
      Parameters:
      file - the file to read the artifact from
      Returns:
      the artifact descriptor(s), may be empty