Overriding Grails datasource configuration during Integration testWhat's the difference between unit tests and integration tests?Integration test for a Grails 1.1 app not working in Grails 2.0.3. Could it be a GORM configuration issue?How do you create a sample datasource for a Grails integration test?Cannot get property 'config' on null object - Grails Service Spock TestingEnvironment Specific Grails Service ConfigurationGrails 2.3.5. Base URL changes in functional tests when using “test-app” as opposed to “test-app functional:”Grails doesn't allow GORM in setupSpec() of Spock, but setup() happens after whereDefine optional (multiple) datasource in GrailsGrails 3.0.9: Spock integration tests' @Rollback annotation is not workingA component required a bean named 'dataSource_dbCreate' that could not be found
Draw simple lines in Inkscape
What are these boxed doors outside store fronts in New York?
If Manufacturer spice model and Datasheet give different values which should I use?
I see my dog run
Non-Jewish family in an Orthodox Jewish Wedding
Why doesn't Newton's third law mean a person bounces back to where they started when they hit the ground?
Can an x86 CPU running in real mode be considered to be basically an 8086 CPU?
Closed subgroups of abelian groups
What do you call a Matrix-like slowdown and camera movement effect?
Why CLRS example on residual networks does not follows its formula?
A function which translates a sentence to title-case
How can I fix this gap between bookcases I made?
How is it possible for user's password to be changed after storage was encrypted? (on OS X, Android)
Is it possible to do 50 km distance without any previous training?
"which" command doesn't work / path of Safari?
How to make payment on the internet without leaving a money trail?
Example of a relative pronoun
What defenses are there against being summoned by the Gate spell?
Why is the design of haulage companies so “special”?
How do you conduct xenoanthropology after first contact?
Can a German sentence have two subjects?
Calculus Optimization - Point on graph closest to given point
Why did the Germans forbid the possession of pet pigeons in Rostov-on-Don in 1941?
declaring a variable twice in IIFE
Overriding Grails datasource configuration during Integration test
What's the difference between unit tests and integration tests?Integration test for a Grails 1.1 app not working in Grails 2.0.3. Could it be a GORM configuration issue?How do you create a sample datasource for a Grails integration test?Cannot get property 'config' on null object - Grails Service Spock TestingEnvironment Specific Grails Service ConfigurationGrails 2.3.5. Base URL changes in functional tests when using “test-app” as opposed to “test-app functional:”Grails doesn't allow GORM in setupSpec() of Spock, but setup() happens after whereDefine optional (multiple) datasource in GrailsGrails 3.0.9: Spock integration tests' @Rollback annotation is not workingA component required a bean named 'dataSource_dbCreate' that could not be found
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I am writing an integration test for a Grails application. The test creates a database schema and a db user dynamically for the test and tear it down at the end.
I would like to apply the newly created values to the application under test instead of the ones configured in application.yaml.
- I tried injecting grailsApplication, but it is null in Spock integration test.
defaultGrailsApp I am able to change the props, but the application doesn't take the new properties
My test looks like this (psedo code) :
@Integration
@Rollback
class MyServiceSpec extends Specification {
@Autowired
MyService mySvc
def setupSpec()
//create db user
// create db schema
//grant permissions
def cleanupSpec()
// delete test user
// delete schema
void 'Test MyService'()
when:
mySvc.createReport(job)
then:
// check db for valid state
Is there a way to override application.yml properties programmatically in Grails and override datasource configuration?
UPDATE 1:
Would it be possible to add a Spy to dataSource so I can provide my own implementation at run time? I'm a bit new to Grails/Groovy , does anybody have source code familiarity to figure this out?
grails groovy integration-testing spock spy
add a comment |
I am writing an integration test for a Grails application. The test creates a database schema and a db user dynamically for the test and tear it down at the end.
I would like to apply the newly created values to the application under test instead of the ones configured in application.yaml.
- I tried injecting grailsApplication, but it is null in Spock integration test.
defaultGrailsApp I am able to change the props, but the application doesn't take the new properties
My test looks like this (psedo code) :
@Integration
@Rollback
class MyServiceSpec extends Specification {
@Autowired
MyService mySvc
def setupSpec()
//create db user
// create db schema
//grant permissions
def cleanupSpec()
// delete test user
// delete schema
void 'Test MyService'()
when:
mySvc.createReport(job)
then:
// check db for valid state
Is there a way to override application.yml properties programmatically in Grails and override datasource configuration?
UPDATE 1:
Would it be possible to add a Spy to dataSource so I can provide my own implementation at run time? I'm a bit new to Grails/Groovy , does anybody have source code familiarity to figure this out?
grails groovy integration-testing spock spy
I think this solves your issue: grails.1312388.n4.nabble.com/… . Use environmental variables or use application.groovy where you can set values using groovy
– droggo
Mar 14 at 7:53
add a comment |
I am writing an integration test for a Grails application. The test creates a database schema and a db user dynamically for the test and tear it down at the end.
I would like to apply the newly created values to the application under test instead of the ones configured in application.yaml.
- I tried injecting grailsApplication, but it is null in Spock integration test.
defaultGrailsApp I am able to change the props, but the application doesn't take the new properties
My test looks like this (psedo code) :
@Integration
@Rollback
class MyServiceSpec extends Specification {
@Autowired
MyService mySvc
def setupSpec()
//create db user
// create db schema
//grant permissions
def cleanupSpec()
// delete test user
// delete schema
void 'Test MyService'()
when:
mySvc.createReport(job)
then:
// check db for valid state
Is there a way to override application.yml properties programmatically in Grails and override datasource configuration?
UPDATE 1:
Would it be possible to add a Spy to dataSource so I can provide my own implementation at run time? I'm a bit new to Grails/Groovy , does anybody have source code familiarity to figure this out?
grails groovy integration-testing spock spy
I am writing an integration test for a Grails application. The test creates a database schema and a db user dynamically for the test and tear it down at the end.
I would like to apply the newly created values to the application under test instead of the ones configured in application.yaml.
- I tried injecting grailsApplication, but it is null in Spock integration test.
defaultGrailsApp I am able to change the props, but the application doesn't take the new properties
My test looks like this (psedo code) :
@Integration
@Rollback
class MyServiceSpec extends Specification {
@Autowired
MyService mySvc
def setupSpec()
//create db user
// create db schema
//grant permissions
def cleanupSpec()
// delete test user
// delete schema
void 'Test MyService'()
when:
mySvc.createReport(job)
then:
// check db for valid state
Is there a way to override application.yml properties programmatically in Grails and override datasource configuration?
UPDATE 1:
Would it be possible to add a Spy to dataSource so I can provide my own implementation at run time? I'm a bit new to Grails/Groovy , does anybody have source code familiarity to figure this out?
grails groovy integration-testing spock spy
grails groovy integration-testing spock spy
edited Mar 11 at 14:58
JavaHead
asked Mar 9 at 3:51
JavaHeadJavaHead
384112
384112
I think this solves your issue: grails.1312388.n4.nabble.com/… . Use environmental variables or use application.groovy where you can set values using groovy
– droggo
Mar 14 at 7:53
add a comment |
I think this solves your issue: grails.1312388.n4.nabble.com/… . Use environmental variables or use application.groovy where you can set values using groovy
– droggo
Mar 14 at 7:53
I think this solves your issue: grails.1312388.n4.nabble.com/… . Use environmental variables or use application.groovy where you can set values using groovy
– droggo
Mar 14 at 7:53
I think this solves your issue: grails.1312388.n4.nabble.com/… . Use environmental variables or use application.groovy where you can set values using groovy
– droggo
Mar 14 at 7:53
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55073813%2foverriding-grails-datasource-configuration-during-integration-test%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55073813%2foverriding-grails-datasource-configuration-during-integration-test%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
I think this solves your issue: grails.1312388.n4.nabble.com/… . Use environmental variables or use application.groovy where you can set values using groovy
– droggo
Mar 14 at 7:53