Class XLReleaseIntegrationTest

java.lang.Object
com.xebialabs.deployit.plumbing.XLReleaseTest
com.xebialabs.xlrelease.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,com.xebialabs.xlrelease.spring.configuration.XlrBooterInitializer.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.

  • Field Details

    • 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 List<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
    • storageFacade

      @Autowired public StorageFacade storageFacade
    • configurationRepository

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

      @Autowired(required=false) protected 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 Details

    • XLReleaseIntegrationTest

      public XLReleaseIntegrationTest()
  • Method Details

    • 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 List<String> getCisForDeletion()
    • eventBus

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

      public void before()
    • tearDown

      public void tearDown() throws Exception
      Throws:
      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(String... ids)
    • markForDeletion

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

      public void markForDeletion(String ciId)
    • markForDeletion

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

      public void unmarkForDeletion(String id)
    • deleteOrder

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

      public void deleteRelease(List<String> releaseIds)
    • deleteRelease

      public void deleteRelease(String... releaseIds)
    • deleteRelease

      public void deleteRelease(String releaseId)
    • storeRelease

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

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

      public com.xebialabs.xlrelease.domain.Release insertArchivedRelease(com.xebialabs.xlrelease.domain.Release release, String releaseJson, 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(String releaseId)
    • storeChanges

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

      public <T extends com.xebialabs.xlrelease.domain.Task> T getTask(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(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:
    • 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)
    • storeRelease

      public 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.
      Parameters:
      release -
      Returns:
      See Also:
    • 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:
    • storeTemplate

      public 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.
      Parameters:
      releaseData -
      Returns:
      See Also:
    • 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:
    • 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:
    • storeConfiguration

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

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

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

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

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

      public String createRole(String roleName)
    • createRole

      public String createRole(String roleName, List<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(String parentId, com.xebialabs.xlrelease.domain.folder.Folder folder)
    • createFolder

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

      public String encrypt(String password)
    • registerCloseable

      public <T extends AutoCloseable> T registerCloseable(T closeable)
    • withAdmin

      protected void withAdmin(Callable<Void> callable)
    • captureLogs

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

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