parent
09ecbf0e24
commit
00a2f7a430
|
@ -1,5 +1,8 @@
|
|||
package deploydb.dao
|
||||
|
||||
import deploydb.IntegrationModelHelper
|
||||
import deploydb.IntegrationTestAppHelper
|
||||
import deploydb.WebhooksModelConfigHelper
|
||||
import org.hibernate.Criteria
|
||||
import org.hibernate.SessionFactory
|
||||
import spock.lang.*
|
||||
|
@ -7,6 +10,20 @@ import spock.lang.*
|
|||
class DeploymentDAOSpec extends Specification {
|
||||
private DeploymentDAO dao
|
||||
private SessionFactory sessionFactory = Mock(SessionFactory)
|
||||
IntegrationTestAppHelper integAppHelper = new IntegrationTestAppHelper()
|
||||
IntegrationModelHelper integModelHelper = new IntegrationModelHelper(integAppHelper)
|
||||
private WebhooksModelConfigHelper mcfgHelper = new WebhooksModelConfigHelper()
|
||||
|
||||
def setup() {
|
||||
mcfgHelper.setup()
|
||||
integAppHelper.startAppWithConfiguration('deploydb.spock.yml')
|
||||
integAppHelper.runner.getApplication().configDirectory = mcfgHelper.baseCfgDirName
|
||||
}
|
||||
|
||||
def cleanup() {
|
||||
integAppHelper.stopApp()
|
||||
mcfgHelper.cleanup()
|
||||
}
|
||||
|
||||
def "ensure the constructor works"() {
|
||||
given:
|
||||
|
@ -31,4 +48,40 @@ class DeploymentDAOSpec extends Specification {
|
|||
dao.getByArtifactId(1).isEmpty()
|
||||
}
|
||||
|
||||
@Ignore
|
||||
def "getByEnvironmentIdent() should return null if there are no deployments"() {
|
||||
given:
|
||||
DeploymentDAO dao = new DeploymentDAO(integAppHelper.runner.getApplication().sessionFactory)
|
||||
|
||||
expect:
|
||||
integAppHelper.runner.getApplication().workflow.deploymentDAO
|
||||
.getByEnvironmentIdent("basicEnv", 1, 20).isEmpty()
|
||||
}
|
||||
|
||||
@Ignore
|
||||
def "getByEnvironmentIdent() should returns deployments for the environment ident"() {
|
||||
given:
|
||||
DeploymentDAO dao = new DeploymentDAO(integAppHelper.runner.getApplication().sessionFactory)
|
||||
|
||||
// Create the required config
|
||||
mcfgHelper.createServicePromoitionPipelineModelsConfigFiles()
|
||||
mcfgHelper.createDeploymentCompletedWebhookConfigFile()
|
||||
mcfgHelper.createEnvironmentNoWebhooksConfigFile()
|
||||
|
||||
// load up the configuration
|
||||
integAppHelper.runner.getApplication().loadModelConfiguration()
|
||||
|
||||
// setup the deployment for completed trigger
|
||||
integModelHelper.sendCreateArtifact()
|
||||
|
||||
expect:
|
||||
integAppHelper.runner.getApplication().workflow.deploymentDAO
|
||||
.getByEnvironmentIdent("basicEnv", 1, 20).size() == 1
|
||||
integAppHelper.runner.getApplication().workflow.deploymentDAO
|
||||
.getByPage(1, 20) ==
|
||||
integAppHelper.runner.getApplication().workflow.deploymentDAO
|
||||
.getByEnvironmentIdent("basicEnv", 1, 20).size() == 1
|
||||
integAppHelper.runner.getApplication().workflow.deploymentDAO
|
||||
.getByEnvironmentIdent("integ", 1, 20).isEmpty()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue