Class AbstractEc2InstanceLaunchingFactoryBean

java.lang.Object
org.springframework.beans.factory.config.AbstractFactoryBean
org.springframework.ldap.test.AbstractEc2InstanceLaunchingFactoryBean
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanClassLoaderAware, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.FactoryBean, org.springframework.beans.factory.InitializingBean
Direct Known Subclasses:
ContextSourceEc2InstanceLaunchingFactoryBean

@Deprecated(since="4.2.1", forRemoval=true) public abstract class AbstractEc2InstanceLaunchingFactoryBean extends org.springframework.beans.factory.config.AbstractFactoryBean
Deprecated, for removal: This API element is subject to removal in a future version.
as of 4.2.1 with no replacement in Spring LDAP; use Testcontainers to run a real LDAP server for integration tests. This class is scheduled for removal.
Abstract FactoryBean superclass to use for automatically launching an EC2 instance before creating the actual target object. This approach is particularly useful for integration testing purposes - the idea is to have particular EC2 images prepared for running integration tests against certain server configurations, enabling integration tests aimed at e.g. a particular DB server to run transparently at the computer of each individual developer without having to have the actual server software installed on their computers.

Public AMIs will need to be created, bundled and registered for each server setup. A subclass of this FactoryBean is then added to create the actual target object (e.g. a DataSource), implementing the {link #doCreateInstance} method. This method will be supplied the IP address of the instance that was created, enabling the subclass to configure the created instance appropriately.

  • Field Summary

    Fields inherited from class org.springframework.beans.factory.config.AbstractFactoryBean

    logger

    Fields inherited from interface org.springframework.beans.factory.FactoryBean

    OBJECT_TYPE_ATTRIBUTE
  • Constructor Summary

    Constructors
    Constructor
    Description
    Deprecated, for removal: This API element is subject to removal in a future version.
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected final Object
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    protected void
    destroyInstance(@Nullable Object ignored)
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    protected abstract Object
    Deprecated, for removal: This API element is subject to removal in a future version.
    Implement to create the actual target object.
    void
    setAwsKey(String awsKey)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Set the AWS key.
    void
    setAwsSecretKey(String awsSecretKey)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Set the AWS secret key.
    void
    setGroupName(String groupName)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Set the name of the access group.
    void
    setImageName(String imageName)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Set the name of the AMI image to be launched.
    void
    setKeypairName(String keypairName)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Set the name of the keypair.

    Methods inherited from class org.springframework.beans.factory.config.AbstractFactoryBean

    afterPropertiesSet, destroy, getBeanFactory, getBeanTypeConverter, getEarlySingletonInterfaces, getObject, getObjectType, isSingleton, setBeanClassLoader, setBeanFactory, setSingleton

    Methods inherited from class Object

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

    • AbstractEc2InstanceLaunchingFactoryBean

      public AbstractEc2InstanceLaunchingFactoryBean()
      Deprecated, for removal: This API element is subject to removal in a future version.
  • Method Details

    • setImageName

      public void setImageName(String imageName)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Set the name of the AMI image to be launched.
      Parameters:
      imageName - the AMI image name.
    • setAwsKey

      public void setAwsKey(String awsKey)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Set the AWS key.
      Parameters:
      awsKey - the AWS key.
    • setAwsSecretKey

      public void setAwsSecretKey(String awsSecretKey)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Set the AWS secret key.
      Parameters:
      awsSecretKey - the aws secret key.
    • setKeypairName

      public void setKeypairName(String keypairName)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Set the name of the keypair.
      Parameters:
      keypairName - The keypair name.
    • setGroupName

      public void setGroupName(String groupName)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Set the name of the access group. This group should be configured with the appropriate ports open for this test case to execute.
      Parameters:
      groupName - the group name.
    • createInstance

      protected final Object createInstance() throws Exception
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      createInstance in class org.springframework.beans.factory.config.AbstractFactoryBean
      Throws:
      Exception
    • doCreateInstance

      protected abstract Object doCreateInstance(String ip) throws Exception
      Deprecated, for removal: This API element is subject to removal in a future version.
      Implement to create the actual target object.
      Parameters:
      ip - the ip address of the launched EC2 image.
      Returns:
      the object to be returned by this FactoryBean.
      Throws:
      Exception - if an error occurs during initialization.
    • destroyInstance

      protected void destroyInstance(@Nullable Object ignored) throws Exception
      Deprecated, for removal: This API element is subject to removal in a future version.
      Overrides:
      destroyInstance in class org.springframework.beans.factory.config.AbstractFactoryBean
      Throws:
      Exception