Class DeviceManagementAasTest

java.lang.Object
test.de.iip_ecosphere.platform.support.TestWithPlugin
test.de.iip_ecosphere.platform.support.aas.TestWithPlugin
de.iip_ecosphere.platform.deviceMgt.DeviceManagementAasTest

public class DeviceManagementAasTest extends test.de.iip_ecosphere.platform.support.aas.TestWithPlugin
Tests the DeviceManagementAas with respect to DeviceManagementAasClient.
Author:
Dennis Pidun, University of Hildesheim
  • Field Details

    • A_DEVICE_ID

      public static final String A_DEVICE_ID
      See Also:
    • A_DEVICE_IP

      public static final String A_DEVICE_IP
      See Also:
    • A_CONFIG_PATH

      public static final String A_CONFIG_PATH
      See Also:
    • A_CONFIG_DOWNLOAD_URI

      public static final String A_CONFIG_DOWNLOAD_URI
      See Also:
    • A_LOCATION

      public static final String A_LOCATION
      See Also:
    • A_DOWNLOADURL

      public static final String A_DOWNLOADURL
      See Also:
    • aas

      private static de.iip_ecosphere.platform.support.aas.Aas aas
    • implServer

      private static de.iip_ecosphere.platform.support.Server implServer
    • aasServer

      private static de.iip_ecosphere.platform.support.Server aasServer
    • serviceLoader

      private static org.mockito.MockedStatic<de.iip_ecosphere.platform.support.jsl.ServiceLoaderUtils> serviceLoader
    • interceptor

      private static MockInterceptor interceptor
  • Constructor Details

    • DeviceManagementAasTest

      public DeviceManagementAasTest()
  • Method Details

    • startup

      public static void startup() throws IOException
      Initializes the test.
      Throws:
      IOException - shouldn't be thrown
    • shutdown

      public static void shutdown()
      Shuts down the test.
    • tearDown

      public void tearDown() throws Exception
      Test teardown method, basically resets all mocks and the service loader mechanism.
      Throws:
      Exception - shouldn't be thrown
    • setUp

      public void setUp() throws Exception
      Test setup method.
      Throws:
      Exception - shouldn't be thrown
    • init_contributorClassLoads

      public void init_contributorClassLoads()
      Tests if the AasContributorClass is loaded.
    • init_contributedAasIsDeployed

      public void init_contributedAasIsDeployed() throws IOException
      Tests if the AasContributor is deployed.
      Throws:
      IOException - shouldn't be thrown
    • getKind_shouldBeActive

      public void getKind_shouldBeActive()
      Tests if the kind is set to active.
    • op_updateRuntime_withInvalidDeviceAndAasDevManager_wontUpdateRuntime

      public void op_updateRuntime_withInvalidDeviceAndAasDevManager_wontUpdateRuntime() throws IOException, ExecutionException
      Tests if the AAS Operation "updateRuntime" won't update the runtime on an invalid device through internal aas deviceManagement. It is using the default implementation for runtime management (eg. AAS connection).
      Throws:
      IOException - shouldn't be thrown
      ExecutionException - shouldn't be thrown
    • op_updateRuntime_withValidDeviceAndAasDevManager_updatesRuntimeOnDevice

      public void op_updateRuntime_withValidDeviceAndAasDevManager_updatesRuntimeOnDevice() throws IOException, ExecutionException
      Tests if the AAS Operation "updateRuntime" updates the runtime on a valid device through internal aas deviceManagement. It is using the default implementation for runtime management (eg. AAS connection)
      Throws:
      IOException - shouldn't be thrown
      ExecutionException - shouldn't be thrown
    • validRuntimesReducedListing

      private Set<String> validRuntimesReducedListing()
      Returns a listing of valid runtimes.
      Returns:
      the listing
    • op_updateRuntime_withInvalidDeviceAndLoadedDevManager_wontUpdateRuntime

      public void op_updateRuntime_withInvalidDeviceAndLoadedDevManager_wontUpdateRuntime() throws IOException, ExecutionException
      Tests if the AAS Operation "updateRuntime" won't update the runtime on an invalid device. It is using a third party implementation for runtime management
      Throws:
      IOException - shouldn't be thrown
      ExecutionException - shouldn't be thrown
    • op_updateRuntime_withValidDeviceAndLoadedDevManager_updatesRuntimeOnDevice

      public void op_updateRuntime_withValidDeviceAndLoadedDevManager_updatesRuntimeOnDevice() throws IOException, ExecutionException
      Tests if the AAS Operation "updateRuntime" updates the runtime on a valid device. It is using a third party implementation for runtime management
      Throws:
      IOException - shouldn't be thrown
      ExecutionException - shouldn't be thrown
    • op_setConfig_withInvalidDeviceAndAasDevManager_wontSetConfig

      public void op_setConfig_withInvalidDeviceAndAasDevManager_wontSetConfig() throws IOException, ExecutionException
      Tests if the AAS Operation "setConfig" won't set the config on an invalid device through internal aas DeviceManagement. It is using the default implementation for configuration management (eg. AAS connection)
      Throws:
      IOException - shouldn't be thrown
      ExecutionException - shouldn't be thrown
    • op_setConfig_withValidDeviceAndAasDevManager_setsConfigOnDevice

      public void op_setConfig_withValidDeviceAndAasDevManager_setsConfigOnDevice() throws IOException, ExecutionException
      Tests if the AAS Operation "setConfig" set the config on a valid device through internal aas DeviceManagement. It is using the default implementation for configuration management (eg. AAS connection)
      Throws:
      IOException - shouldn't be thrown
      ExecutionException - shouldn't be thrown
    • op_setConfig_withInvalidDeviceAndLoadedDevManager_wontSetConfig

      public void op_setConfig_withInvalidDeviceAndLoadedDevManager_wontSetConfig() throws IOException, ExecutionException
      Tests if the AAS Operation "setConfig" won't set the config on an invalid device. It is using a third party implementation for configuration management
      Throws:
      IOException - shouldn't be thrown
      ExecutionException - shouldn't be thrown
    • op_setConfig_withValidDeviceAndLoadedDevManager_setsConfigOnDevice

      public void op_setConfig_withValidDeviceAndLoadedDevManager_setsConfigOnDevice() throws IOException, ExecutionException
      Tests if the AAS Operation "setConfig" sets the config on a valid device. It is using a third party implementation for configuration management
      Throws:
      IOException - shouldn't be thrown
      ExecutionException - shouldn't be thrown
    • op_establishSsh_withValidDeviceAndLoadedDevManager_createsConnectionDetails

      public void op_establishSsh_withValidDeviceAndLoadedDevManager_createsConnectionDetails() throws IOException, ExecutionException
      Tests if the AAS Operation "establishSSH" returns valid ssh details under the condition that a real device is given, which responses with a valid result. It is using a third party implementation for ssh servers.
      Throws:
      IOException - shouldn't be thrown
      ExecutionException - shouldn't be thrown
    • op_establishSsh_withValidDeviceAndDefaultDevManager_letsDeviceCreateCredentials

      public void op_establishSsh_withValidDeviceAndDefaultDevManager_letsDeviceCreateCredentials() throws IOException, ExecutionException
      Tests if the AAS Operation "establishSSH" returns valid connection details under the condition that its a valid device and using the default implementation. It is using the default implementation for ssh servers (proxy <-> apachesshd)
      Throws:
      IOException - shouldn't be thrown
      ExecutionException - shouldn't be thrown
    • op_establishSsh_withValidDeviceAndInvalidDeviceResponse_returnsNull

      public void op_establishSsh_withValidDeviceAndInvalidDeviceResponse_returnsNull() throws IOException, ExecutionException
      Tests if the AAS Operation "establishSSH" returns null under the condition that a real device is given, which responses with an invalid result. It is using the default implementation for ssh servers (proxy <-> apachesshd)
      Throws:
      IOException - shouldn't be thrown
      ExecutionException - shouldn't be thrown
    • unloadFirmwareOperations

      static void unloadFirmwareOperations()
      Removes loaded FirmwareOperations from ServiceLoaderMechanism Uses static mocks for this process, which should be avoided, but needed in this case.
    • unloadResourceConfigOperations

      static void unloadResourceConfigOperations()
      Removes loaded ResourceConfigOperations from ServiceLoaderMechanism Uses static mocks for this process, which should be avoided, but needed in this case.
    • unloadRemoteAccessOperations

      static void unloadRemoteAccessOperations()
      Removes loaded RemoteAccessOperations from ServiceLoaderMechanism Uses static mocks for this process, which should be avoided, but needed in this case.
    • makeDeviceAvailable

      static void makeDeviceAvailable() throws ExecutionException, IOException
      Registers a device and turns it into a managed device Uses mock DeviceRegistry.
      Throws:
      ExecutionException - shouldn't be thrown
      IOException - shouldn't be thrown
    • resetDeviceManagement

      private static void resetDeviceManagement()
      Resets the device management.