Class ServiceMgrAndDescriptorTest.MockServiceManager

  • All Implemented Interfaces:
    de.iip_ecosphere.platform.services.ServiceManager, de.iip_ecosphere.platform.services.ServiceOperations
    Enclosing class:
    ServiceMgrAndDescriptorTest

    private static class ServiceMgrAndDescriptorTest.MockServiceManager
    extends java.lang.Object
    implements de.iip_ecosphere.platform.services.ServiceManager
    A mocking service manager for a given service artifact. Only selected functions are implemented!
    Author:
    Holger Eichelberger, SSE
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.Map<java.lang.String,​de.iip_ecosphere.platform.services.spring.SpringCloudArtifactDescriptor> arts  
      private java.util.Map<java.lang.String,​de.iip_ecosphere.platform.services.spring.SpringCloudServiceDescriptor> svc  
      • Fields inherited from interface de.iip_ecosphere.platform.services.ServiceOperations

        EXC_ALREADY_KNOWN, OPTION_ARGS, OPTION_ENSEMBLE, OPTION_PARAMS, OPTION_SERVERS
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private MockServiceManager​(de.iip_ecosphere.platform.services.spring.SpringCloudArtifactDescriptor aDesc)
      Creates a service manager instance for the given artifact descriptor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void activateService​(java.lang.String serviceId)  
      java.lang.String addArtifact​(java.net.URI location)  
      void cloneArtifact​(java.lang.String artifactId, java.net.URI location)  
      de.iip_ecosphere.platform.services.ArtifactDescriptor getArtifact​(java.lang.String artifactId)  
      java.util.Set<java.lang.String> getArtifactIds()  
      java.util.Collection<? extends de.iip_ecosphere.platform.services.ArtifactDescriptor> getArtifacts()  
      java.util.List<de.iip_ecosphere.platform.services.TypedDataConnectorDescriptor> getInputDataConnectors​(java.lang.String serviceId)  
      java.util.List<de.iip_ecosphere.platform.services.TypedDataConnectorDescriptor> getOutputDataConnectors​(java.lang.String serviceId)  
      java.util.List<de.iip_ecosphere.platform.services.TypedDataDescriptor> getParameters​(java.lang.String serviceId)  
      de.iip_ecosphere.platform.services.ServiceDescriptor getService​(java.lang.String serviceId)  
      java.util.Set<java.lang.String> getServiceIds()  
      int getServiceInstanceCount​(java.lang.String serviceId)  
      java.util.Collection<? extends de.iip_ecosphere.platform.services.ServiceDescriptor> getServices()  
      de.iip_ecosphere.platform.services.environment.ServiceState getServiceState​(java.lang.String serviceId)  
      void migrateService​(java.lang.String serviceId, java.lang.String resourceId)  
      void passivateService​(java.lang.String serviceId)  
      void reconfigureService​(java.lang.String serviceId, java.util.Map<java.lang.String,​java.lang.String> values)  
      void removeArtifact​(java.lang.String artifactId)  
      void setServiceState​(java.lang.String serviceId, de.iip_ecosphere.platform.services.environment.ServiceState state)  
      void startService​(java.lang.String... serviceId)  
      void startService​(java.util.Map<java.lang.String,​java.lang.String> options, java.lang.String... serviceId)  
      void stopService​(java.lang.String... serviceId)  
      void switchToService​(java.lang.String serviceId, java.lang.String targetId)  
      void updateService​(java.lang.String serviceId, java.net.URI location)  
      • Methods inherited from class java.lang.Object

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

      • arts

        private java.util.Map<java.lang.String,​de.iip_ecosphere.platform.services.spring.SpringCloudArtifactDescriptor> arts
      • svc

        private java.util.Map<java.lang.String,​de.iip_ecosphere.platform.services.spring.SpringCloudServiceDescriptor> svc
    • Constructor Detail

      • MockServiceManager

        private MockServiceManager​(de.iip_ecosphere.platform.services.spring.SpringCloudArtifactDescriptor aDesc)
        Creates a service manager instance for the given artifact descriptor.
        Parameters:
        aDesc - the artifact descriptor to analyze
    • Method Detail

      • updateService

        public void updateService​(java.lang.String serviceId,
                                  java.net.URI location)
                           throws java.util.concurrent.ExecutionException
        Specified by:
        updateService in interface de.iip_ecosphere.platform.services.ServiceOperations
        Throws:
        java.util.concurrent.ExecutionException
      • switchToService

        public void switchToService​(java.lang.String serviceId,
                                    java.lang.String targetId)
                             throws java.util.concurrent.ExecutionException
        Specified by:
        switchToService in interface de.iip_ecosphere.platform.services.ServiceOperations
        Throws:
        java.util.concurrent.ExecutionException
      • stopService

        public void stopService​(java.lang.String... serviceId)
                         throws java.util.concurrent.ExecutionException
        Specified by:
        stopService in interface de.iip_ecosphere.platform.services.ServiceOperations
        Throws:
        java.util.concurrent.ExecutionException
      • startService

        public void startService​(java.lang.String... serviceId)
                          throws java.util.concurrent.ExecutionException
        Specified by:
        startService in interface de.iip_ecosphere.platform.services.ServiceOperations
        Throws:
        java.util.concurrent.ExecutionException
      • startService

        public void startService​(java.util.Map<java.lang.String,​java.lang.String> options,
                                 java.lang.String... serviceId)
                          throws java.util.concurrent.ExecutionException
        Specified by:
        startService in interface de.iip_ecosphere.platform.services.ServiceOperations
        Throws:
        java.util.concurrent.ExecutionException
      • setServiceState

        public void setServiceState​(java.lang.String serviceId,
                                    de.iip_ecosphere.platform.services.environment.ServiceState state)
                             throws java.util.concurrent.ExecutionException
        Specified by:
        setServiceState in interface de.iip_ecosphere.platform.services.ServiceOperations
        Throws:
        java.util.concurrent.ExecutionException
      • removeArtifact

        public void removeArtifact​(java.lang.String artifactId)
                            throws java.util.concurrent.ExecutionException
        Specified by:
        removeArtifact in interface de.iip_ecosphere.platform.services.ServiceOperations
        Throws:
        java.util.concurrent.ExecutionException
      • reconfigureService

        public void reconfigureService​(java.lang.String serviceId,
                                       java.util.Map<java.lang.String,​java.lang.String> values)
                                throws java.util.concurrent.ExecutionException
        Specified by:
        reconfigureService in interface de.iip_ecosphere.platform.services.ServiceOperations
        Throws:
        java.util.concurrent.ExecutionException
      • passivateService

        public void passivateService​(java.lang.String serviceId)
                              throws java.util.concurrent.ExecutionException
        Specified by:
        passivateService in interface de.iip_ecosphere.platform.services.ServiceOperations
        Throws:
        java.util.concurrent.ExecutionException
      • migrateService

        public void migrateService​(java.lang.String serviceId,
                                   java.lang.String resourceId)
                            throws java.util.concurrent.ExecutionException
        Specified by:
        migrateService in interface de.iip_ecosphere.platform.services.ServiceOperations
        Throws:
        java.util.concurrent.ExecutionException
      • getServiceState

        public de.iip_ecosphere.platform.services.environment.ServiceState getServiceState​(java.lang.String serviceId)
        Specified by:
        getServiceState in interface de.iip_ecosphere.platform.services.ServiceOperations
      • addArtifact

        public java.lang.String addArtifact​(java.net.URI location)
                                     throws java.util.concurrent.ExecutionException
        Specified by:
        addArtifact in interface de.iip_ecosphere.platform.services.ServiceOperations
        Throws:
        java.util.concurrent.ExecutionException
      • activateService

        public void activateService​(java.lang.String serviceId)
                             throws java.util.concurrent.ExecutionException
        Specified by:
        activateService in interface de.iip_ecosphere.platform.services.ServiceOperations
        Throws:
        java.util.concurrent.ExecutionException
      • getServices

        public java.util.Collection<? extends de.iip_ecosphere.platform.services.ServiceDescriptor> getServices()
        Specified by:
        getServices in interface de.iip_ecosphere.platform.services.ServiceManager
      • getServiceIds

        public java.util.Set<java.lang.String> getServiceIds()
        Specified by:
        getServiceIds in interface de.iip_ecosphere.platform.services.ServiceManager
      • getService

        public de.iip_ecosphere.platform.services.ServiceDescriptor getService​(java.lang.String serviceId)
        Specified by:
        getService in interface de.iip_ecosphere.platform.services.ServiceManager
      • getParameters

        public java.util.List<de.iip_ecosphere.platform.services.TypedDataDescriptor> getParameters​(java.lang.String serviceId)
        Specified by:
        getParameters in interface de.iip_ecosphere.platform.services.ServiceManager
      • getOutputDataConnectors

        public java.util.List<de.iip_ecosphere.platform.services.TypedDataConnectorDescriptor> getOutputDataConnectors​(java.lang.String serviceId)
        Specified by:
        getOutputDataConnectors in interface de.iip_ecosphere.platform.services.ServiceManager
      • getInputDataConnectors

        public java.util.List<de.iip_ecosphere.platform.services.TypedDataConnectorDescriptor> getInputDataConnectors​(java.lang.String serviceId)
        Specified by:
        getInputDataConnectors in interface de.iip_ecosphere.platform.services.ServiceManager
      • getArtifacts

        public java.util.Collection<? extends de.iip_ecosphere.platform.services.ArtifactDescriptor> getArtifacts()
        Specified by:
        getArtifacts in interface de.iip_ecosphere.platform.services.ServiceManager
      • getArtifactIds

        public java.util.Set<java.lang.String> getArtifactIds()
        Specified by:
        getArtifactIds in interface de.iip_ecosphere.platform.services.ServiceManager
      • getArtifact

        public de.iip_ecosphere.platform.services.ArtifactDescriptor getArtifact​(java.lang.String artifactId)
        Specified by:
        getArtifact in interface de.iip_ecosphere.platform.services.ServiceManager
      • cloneArtifact

        public void cloneArtifact​(java.lang.String artifactId,
                                  java.net.URI location)
                           throws java.util.concurrent.ExecutionException
        Specified by:
        cloneArtifact in interface de.iip_ecosphere.platform.services.ServiceManager
        Throws:
        java.util.concurrent.ExecutionException
      • getServiceInstanceCount

        public int getServiceInstanceCount​(java.lang.String serviceId)
        Specified by:
        getServiceInstanceCount in interface de.iip_ecosphere.platform.services.ServiceOperations