Class XLReleaseIntegrationTest

  • All Implemented Interfaces:
    org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware
    Direct Known Subclasses:
    BaseApiDocumentationTest

    @ContextConfiguration(locations={"/spring/xlrelease-context-test.xml","classpath:springmvc-resteasy.xml"},
                          initializers=com.xebialabs.xlrelease.spring.configuration.XlrWebApplicationInitializer.class)
    @WebAppConfiguration("src/test/resources")
    @ActiveProfiles("integrationTest")
    public abstract class XLReleaseIntegrationTest
    extends com.xebialabs.deployit.plumbing.XLReleaseTest
    implements org.springframework.context.ApplicationContextAware
    This is a base class for JUnit integration tests of XL Release. Inheritors of this class can define Autowired XL Release services in fields and use them to setup a test environment and assert conditions.

    A typical test would look like this:

         
     public class MyIntegrationTest extends XLReleaseIntegrationTest {
    
         @Test
         public void should_create_release_in_repository() {
             Release release = ReleaseBuilder.newRelease().withId(TestIds.RELEASE1).build();
    
             storeRelease(release);
    
             assertThat(getRelease(TestIds.RELEASE1)).isNotNull();
         }
     }
     
     

    Note: A test instance of XL Release is setup in a temporary folder and has some services mocked up for speed and easier testing. So you cannot test initializers or upgraders, for example.

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      com.xebialabs.xlrelease.domain.Release archiveRelease​(com.xebialabs.xlrelease.domain.Release release)  
      void before()  
      java.util.List<ch.qos.logback.classic.spi.ILoggingEvent> captureLogs​(java.lang.String... names)  
      com.xebialabs.xlrelease.domain.folder.Folder createFolder​(com.xebialabs.xlrelease.domain.folder.Folder folder, boolean createDefaultTeamsIfTopLevel)  
      com.xebialabs.xlrelease.domain.folder.Folder createFolder​(java.lang.String parentId, com.xebialabs.xlrelease.domain.folder.Folder folder)  
      com.xebialabs.xlrelease.domain.folder.Folder createFolder​(java.lang.String parentId, com.xebialabs.xlrelease.domain.folder.Folder folder, boolean createDefaultTeamsIfTopLevel)  
      java.lang.String createRole​(java.lang.String roleName)  
      java.lang.String createRole​(java.lang.String roleName, java.util.List<java.lang.String> principals)  
      void createTask​(com.xebialabs.xlrelease.domain.Task task)  
      int deleteFromArchive​(java.lang.String releaseId)  
      protected void deleteOnTearDown​(com.xebialabs.deployit.plugin.api.udm.ConfigurationItem... items)  
      protected void deleteOnTearDown​(java.lang.String... ids)  
      void deleteOrder​(com.xebialabs.deployit.plugin.api.udm.ConfigurationItem... items)  
      void deleteRelease​(java.lang.String releaseId)  
      void deleteRelease​(java.lang.String... releaseIds)  
      void deleteRelease​(java.util.List<java.lang.String> releaseIds)  
      java.lang.String encrypt​(java.lang.String password)  
      com.xebialabs.xlrelease.events.XLReleaseEventBus eventBus()  
      protected boolean featureServicesEnabled()  
      org.springframework.context.ApplicationContext getApplicationContext()  
      java.util.List<java.lang.String> getCisForDeletion()  
      com.xebialabs.xlrelease.domain.GateCondition getGateCondition​(java.lang.String conditionId)  
      com.xebialabs.xlrelease.domain.Phase getPhase​(java.lang.String phaseId)  
      com.xebialabs.xlrelease.domain.PlanItem getPlanItem​(java.lang.String planItemId)  
      com.xebialabs.xlrelease.domain.Release getRelease​(java.lang.String releaseId)  
      <T extends com.xebialabs.xlrelease.domain.Task>
      T
      getTask​(java.lang.String taskId)  
      com.xebialabs.xlrelease.domain.variables.Variable getVariable​(java.lang.String variableId)  
      void grantGlobalPermissions​(java.lang.String username, java.util.Set<com.xebialabs.deployit.security.permission.Permission> permissions)  
      com.xebialabs.xlrelease.domain.Release insertArchivedRelease​(com.xebialabs.xlrelease.domain.Release release, java.lang.String releaseJson, java.lang.String activityLogs)  
      protected boolean isRelaxedTest()  
      void markForDeletion​(com.xebialabs.deployit.plugin.api.udm.ConfigurationItem item)  
      void markForDeletion​(com.xebialabs.xlrelease.domain.Team team)  
      void markForDeletion​(java.lang.String ciId)  
      com.xebialabs.xlrelease.domain.Release preArchiveAndArchiveRelease​(com.xebialabs.xlrelease.domain.Release release)  
      <T extends java.lang.AutoCloseable>
      T
      registerCloseable​(T closeable)  
      void setApplicationContext​(org.springframework.context.ApplicationContext applicationContext)  
      void storeChanges​(com.xebialabs.xlrelease.domain.Changes changes)  
      <T extends com.xebialabs.xlrelease.domain.BaseConfiguration>
      T
      storeConfiguration​(T configurationItem)  
      com.xebialabs.xlrelease.domain.Release storeRelease​(com.xebialabs.xlrelease.domain.Release release)
      Safe method to store Release objects including of status TEMPLATE.
      void storeRelease​(com.xebialabs.xlrelease.domain.Release... releases)  
      com.xebialabs.xlrelease.domain.Release storeRelease​(com.xebialabs.xlrelease.domain.Release release, XLReleaseIntegrationTest.DeleteOption... deleteOptions)
      Safe method to store Release objects including of status TEMPLATE.
      void storeRelease​(java.util.List<com.xebialabs.xlrelease.domain.Release> releases)  
      com.xebialabs.xlrelease.domain.Release storeTemplate​(com.xebialabs.xlrelease.domain.folder.Folder parentFolder, com.xebialabs.xlrelease.domain.Release releaseData)
      Not a safe method to store Release objects of status TEMPLATE - the ID will change.
      com.xebialabs.xlrelease.domain.Release storeTemplate​(com.xebialabs.xlrelease.domain.folder.Folder parentFolder, com.xebialabs.xlrelease.domain.Release releaseData, XLReleaseIntegrationTest.DeleteOption... deleteOptions)
      Not a safe method to store Release objects of status TEMPLATE - the ID will change.
      com.xebialabs.xlrelease.domain.Release storeTemplate​(com.xebialabs.xlrelease.domain.Release releaseData)
      Not a safe method to store Release objects of status TEMPLATE - the ID will change.
      com.xebialabs.xlrelease.domain.Release storeTemplate​(com.xebialabs.xlrelease.domain.Release releaseData, XLReleaseIntegrationTest.DeleteOption... deleteOptions)
      Not a safe method to store Release objects of status TEMPLATE - the ID will change.
      com.xebialabs.xlrelease.domain.ReleaseTrigger storeTrigger​(com.xebialabs.xlrelease.domain.ReleaseTrigger trigger)  
      com.xebialabs.xlrelease.domain.Trigger storeTrigger​(com.xebialabs.xlrelease.domain.Trigger trigger)  
      void tearDown()  
      void unmarkForDeletion​(java.lang.String id)  
      void updatePhase​(com.xebialabs.xlrelease.domain.Phase phase)  
      void updateRelease​(com.xebialabs.xlrelease.domain.Release release)  
      void updateTask​(com.xebialabs.xlrelease.domain.Task task)  
      void updateTaskProperty​(com.xebialabs.xlrelease.domain.Task task)  
      protected void verifyRepositoryClean()  
      protected void verifyWorkdirClean()  
      protected void withAdmin​(java.util.concurrent.Callable<java.lang.Void> callable)  
      protected boolean workDirVerificationEnabled()  
      • Methods inherited from class com.xebialabs.deployit.plumbing.XLReleaseTest

        boot, setInternalState
      • Methods inherited from class java.lang.Object

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

      • applicationContext

        protected org.springframework.context.ApplicationContext applicationContext
      • SPRING_CLASS_RULE

        public static final org.springframework.test.context.junit4.rules.SpringClassRule SPRING_CLASS_RULE
      • springMethodRule

        public final org.springframework.test.context.junit4.rules.SpringMethodRule springMethodRule
      • cisForDeletion

        protected java.util.List<java.lang.String> cisForDeletion
        Some CIs can not be created inside the @{directory} which is deleted automatically. Those should be added to this collection to be purged after the test.
      • folderService

        @Autowired
        public com.xebialabs.xlrelease.service.FolderService folderService
      • gateConditionRepository

        @Autowired
        public com.xebialabs.xlrelease.repository.GateConditionRepository gateConditionRepository
      • commentRepository

        @Autowired
        public com.xebialabs.xlrelease.repository.CommentRepository commentRepository
      • configurationService

        @Autowired
        public com.xebialabs.xlrelease.service.ConfigurationService configurationService
      • releaseService

        @Autowired
        public com.xebialabs.xlrelease.service.ReleaseService releaseService
      • releaseRepository

        @Autowired
        public com.xebialabs.xlrelease.repository.ReleaseRepository releaseRepository
      • triggerRepository

        @Autowired
        public com.xebialabs.xlrelease.repository.TriggerRepository triggerRepository
      • phaseRepository

        @Autowired
        public com.xebialabs.xlrelease.repository.PhaseRepository phaseRepository
      • planItemRepository

        @Autowired
        public com.xebialabs.xlrelease.repository.PlanItemRepository planItemRepository
      • userProfileRepository

        @Autowired
        public com.xebialabs.xlrelease.repository.UserProfileRepository userProfileRepository
      • eventually

        @Autowired
        public Eventually eventually
      • teamService

        @Autowired
        public com.xebialabs.xlrelease.service.TeamService teamService
      • permissionsSnapshotService

        @Autowired
        public com.xebialabs.xlrelease.security.sql.snapshots.service.PermissionsSnapshotService permissionsSnapshotService
      • facetService

        @Autowired
        public com.xebialabs.xlrelease.service.FacetService facetService
      • folderPersistence

        @Autowired
        public com.xebialabs.xlrelease.repository.sql.persistence.FolderPersistence folderPersistence
      • permissionEditor

        @Autowired
        public com.xebialabs.deployit.security.PermissionEditor permissionEditor
      • releaseActorLifecycleUtils

        @Autowired
        protected com.xebialabs.xlrelease.actors.utils.ReleaseActorLifecycleUtils releaseActorLifecycleUtils
      • triggerActorLifecycleUtils

        @Autowired
        protected com.xebialabs.xlrelease.actors.utils.TriggerActorLifecycleUtils triggerActorLifecycleUtils
      • archivedReleases

        @Autowired
        protected com.xebialabs.xlrelease.db.ArchivedReleases archivedReleases
      • archivingService

        @Autowired
        protected com.xebialabs.xlrelease.service.ArchivingService archivingService
      • configurationRepository

        @Autowired
        protected com.xebialabs.xlrelease.repository.ConfigurationRepository configurationRepository
      • featureServices

        @Autowired(required=false)
        protected java.util.List<com.xebialabs.xlrelease.service.FeatureService> featureServices
      • txManager

        @Qualifier("xlrRepositoryTransactionManager")
        @Autowired
        protected org.springframework.transaction.PlatformTransactionManager txManager
      • reportingJdbcTemplate

        @Qualifier("reportingJdbcTemplate")
        @Autowired
        protected org.springframework.jdbc.core.JdbcTemplate reportingJdbcTemplate
      • userTokenService

        @Autowired
        public com.xebialabs.xlrelease.service.UserTokenService userTokenService
      • userTokenRepository

        @Autowired
        public com.xebialabs.xlrelease.repository.UserTokenRepository userTokenRepository
      • testName

        public org.junit.rules.TestName testName
    • Constructor Detail

      • XLReleaseIntegrationTest

        public XLReleaseIntegrationTest()
    • Method Detail

      • getApplicationContext

        public org.springframework.context.ApplicationContext getApplicationContext()
      • setApplicationContext

        public void setApplicationContext​(org.springframework.context.ApplicationContext applicationContext)
        Specified by:
        setApplicationContext in interface org.springframework.context.ApplicationContextAware
      • featureServicesEnabled

        protected boolean featureServicesEnabled()
      • isRelaxedTest

        protected boolean isRelaxedTest()
      • workDirVerificationEnabled

        protected boolean workDirVerificationEnabled()
      • getCisForDeletion

        public java.util.List<java.lang.String> getCisForDeletion()
      • eventBus

        public com.xebialabs.xlrelease.events.XLReleaseEventBus eventBus()
      • before

        public void before()
      • tearDown

        public void tearDown()
                      throws java.lang.Exception
        Throws:
        java.lang.Exception
      • verifyRepositoryClean

        protected void verifyRepositoryClean()
      • verifyWorkdirClean

        protected void verifyWorkdirClean()
      • deleteOnTearDown

        protected void deleteOnTearDown​(com.xebialabs.deployit.plugin.api.udm.ConfigurationItem... items)
      • deleteOnTearDown

        protected void deleteOnTearDown​(java.lang.String... ids)
      • markForDeletion

        public void markForDeletion​(com.xebialabs.deployit.plugin.api.udm.ConfigurationItem item)
      • markForDeletion

        public void markForDeletion​(java.lang.String ciId)
      • markForDeletion

        public void markForDeletion​(com.xebialabs.xlrelease.domain.Team team)
      • unmarkForDeletion

        public void unmarkForDeletion​(java.lang.String id)
      • deleteOrder

        public void deleteOrder​(com.xebialabs.deployit.plugin.api.udm.ConfigurationItem... items)
      • deleteRelease

        public void deleteRelease​(java.util.List<java.lang.String> releaseIds)
      • deleteRelease

        public void deleteRelease​(java.lang.String... releaseIds)
      • deleteRelease

        public void deleteRelease​(java.lang.String releaseId)
      • storeRelease

        public void storeRelease​(com.xebialabs.xlrelease.domain.Release... releases)
      • storeRelease

        public void storeRelease​(java.util.List<com.xebialabs.xlrelease.domain.Release> releases)
      • insertArchivedRelease

        public com.xebialabs.xlrelease.domain.Release insertArchivedRelease​(com.xebialabs.xlrelease.domain.Release release,
                                                                            java.lang.String releaseJson,
                                                                            java.lang.String activityLogs)
      • archiveRelease

        public com.xebialabs.xlrelease.domain.Release archiveRelease​(com.xebialabs.xlrelease.domain.Release release)
      • preArchiveAndArchiveRelease

        public com.xebialabs.xlrelease.domain.Release preArchiveAndArchiveRelease​(com.xebialabs.xlrelease.domain.Release release)
      • deleteFromArchive

        public int deleteFromArchive​(java.lang.String releaseId)
      • storeChanges

        public void storeChanges​(com.xebialabs.xlrelease.domain.Changes changes)
      • getTask

        public <T extends com.xebialabs.xlrelease.domain.Task> T getTask​(java.lang.String taskId)
      • createTask

        public void createTask​(com.xebialabs.xlrelease.domain.Task task)
      • updateTask

        public void updateTask​(com.xebialabs.xlrelease.domain.Task task)
      • updateTaskProperty

        public void updateTaskProperty​(com.xebialabs.xlrelease.domain.Task task)
      • getPhase

        public com.xebialabs.xlrelease.domain.Phase getPhase​(java.lang.String phaseId)
      • updatePhase

        public void updatePhase​(com.xebialabs.xlrelease.domain.Phase phase)
      • updateRelease

        public void updateRelease​(com.xebialabs.xlrelease.domain.Release release)
      • storeRelease

        public com.xebialabs.xlrelease.domain.Release storeRelease​(com.xebialabs.xlrelease.domain.Release release)
        Safe method to store Release objects including of status TEMPLATE.
        Parameters:
        release -
        Returns:
        See Also:
        storeTemplate(Release)
      • storeTrigger

        public com.xebialabs.xlrelease.domain.Trigger storeTrigger​(com.xebialabs.xlrelease.domain.Trigger trigger)
      • storeTrigger

        public com.xebialabs.xlrelease.domain.ReleaseTrigger storeTrigger​(com.xebialabs.xlrelease.domain.ReleaseTrigger trigger)
      • storeTemplate

        public com.xebialabs.xlrelease.domain.Release storeTemplate​(com.xebialabs.xlrelease.domain.Release releaseData)
        Not a safe method to store Release objects of status TEMPLATE - the ID will change.
        Parameters:
        releaseData -
        Returns:
        See Also:
        storeRelease(Release)
      • storeTemplate

        public com.xebialabs.xlrelease.domain.Release storeTemplate​(com.xebialabs.xlrelease.domain.folder.Folder parentFolder,
                                                                    com.xebialabs.xlrelease.domain.Release releaseData)
        Not a safe method to store Release objects of status TEMPLATE - the ID will change.
        Parameters:
        releaseData -
        Returns:
        See Also:
        storeRelease(Release)
      • storeTemplate

        public com.xebialabs.xlrelease.domain.Release storeTemplate​(com.xebialabs.xlrelease.domain.folder.Folder parentFolder,
                                                                    com.xebialabs.xlrelease.domain.Release releaseData,
                                                                    XLReleaseIntegrationTest.DeleteOption... deleteOptions)
        Not a safe method to store Release objects of status TEMPLATE - the ID will change.
        Parameters:
        releaseData -
        Returns:
        See Also:
        storeRelease(Release, DeleteOption...)
      • storeConfiguration

        public <T extends com.xebialabs.xlrelease.domain.BaseConfiguration> T storeConfiguration​(T configurationItem)
      • getVariable

        public com.xebialabs.xlrelease.domain.variables.Variable getVariable​(java.lang.String variableId)
      • getRelease

        public com.xebialabs.xlrelease.domain.Release getRelease​(java.lang.String releaseId)
      • getGateCondition

        public com.xebialabs.xlrelease.domain.GateCondition getGateCondition​(java.lang.String conditionId)
      • getPlanItem

        public com.xebialabs.xlrelease.domain.PlanItem getPlanItem​(java.lang.String planItemId)
      • createRole

        public java.lang.String createRole​(java.lang.String roleName)
      • createRole

        public java.lang.String createRole​(java.lang.String roleName,
                                           java.util.List<java.lang.String> principals)
      • createFolder

        public com.xebialabs.xlrelease.domain.folder.Folder createFolder​(com.xebialabs.xlrelease.domain.folder.Folder folder,
                                                                         boolean createDefaultTeamsIfTopLevel)
      • createFolder

        public com.xebialabs.xlrelease.domain.folder.Folder createFolder​(java.lang.String parentId,
                                                                         com.xebialabs.xlrelease.domain.folder.Folder folder)
      • createFolder

        public com.xebialabs.xlrelease.domain.folder.Folder createFolder​(java.lang.String parentId,
                                                                         com.xebialabs.xlrelease.domain.folder.Folder folder,
                                                                         boolean createDefaultTeamsIfTopLevel)
      • encrypt

        public java.lang.String encrypt​(java.lang.String password)
      • registerCloseable

        public <T extends java.lang.AutoCloseable> T registerCloseable​(T closeable)
      • withAdmin

        protected void withAdmin​(java.util.concurrent.Callable<java.lang.Void> callable)
      • captureLogs

        public java.util.List<ch.qos.logback.classic.spi.ILoggingEvent> captureLogs​(java.lang.String... names)
      • grantGlobalPermissions

        public void grantGlobalPermissions​(java.lang.String username,
                                           java.util.Set<com.xebialabs.deployit.security.permission.Permission> permissions)