grails-2.0

Grails 2.0 integration test pollution?

假如想象 提交于 2020-01-21 07:36:26
问题 So i have a small integration test that houses 5 tests in total. Running that test exclusively results in all tests passed. However running my entire test suite results in 4 test failures of the 5. I've just recently upgraded to grails-2.0 from 1.3.7 and i switched from hsqldb to h2. Has anyone any pointers in which direction i should be looking in order to fix this (test-pollution) problem? Domain model Integration test: class SeriesIntegrationTests extends GrailsUnitTestCase { Series series

How to integrate angular js into grails 2.3.4?

时光毁灭记忆、已成空白 提交于 2020-01-21 01:47:28
问题 I am running on grails 2.3.4 and though about integrating angularjs in my next application. I think the best way from the server side is to use grails REST integration in the domain and controller classes. However here I am stuck. How to get grails to communicate with angularjs?(over the index.gsp ?, If so how to integrate it?) What would be a good architecture? I really appreciate your answers!!! PS.: I know that there is a grails angular js plugin. However I do see any reason for using that

Grails + Mongodb + Spock: NullPointerException being thrown when doing embedded field query

耗尽温柔 提交于 2020-01-15 11:34:33
问题 On one service I'm trying to do something like: Organization.withCriteria { eq( "active", true ) eq( "location.region", region) } which is working but when calling the method inside a unit test I get: java.lang.NullPointerException at org.grails.datastore.mapping.keyvalue.mapping.config.KeyValuePersistentEntity.getPropertyByName(KeyValuePersistentEntity.java:75) at grails.gorm.CriteriaBuilder.validatePropertyName(CriteriaBuilder.java:954) at grails.gorm.CriteriaBuilder.eq(CriteriaBuilder.java

Grails + Mongodb + Spock: NullPointerException being thrown when doing embedded field query

谁都会走 提交于 2020-01-15 11:34:05
问题 On one service I'm trying to do something like: Organization.withCriteria { eq( "active", true ) eq( "location.region", region) } which is working but when calling the method inside a unit test I get: java.lang.NullPointerException at org.grails.datastore.mapping.keyvalue.mapping.config.KeyValuePersistentEntity.getPropertyByName(KeyValuePersistentEntity.java:75) at grails.gorm.CriteriaBuilder.validatePropertyName(CriteriaBuilder.java:954) at grails.gorm.CriteriaBuilder.eq(CriteriaBuilder.java

Grails unit test verify mock method called

不羁岁月 提交于 2020-01-15 05:45:51
问题 In my unit test, I mock a service (which is a ref of the class under test). Like: given: def mockXxService = mockFor(XxService) mockXxService.demand.xxx(1) {->} service.xxService = mockXxService when: service.yyy() then: // verify mockXxService's xxx method is invoked. For my unit test, I want to verify that mockXxService.xxx() is called. But grails document's mockControl.verify() doesn't work for me. Not sure how to use it correctly. It is very similar to mockito's verify method. Anyone

Grails: Defining a JSON custom marshaller as static method in domain

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-14 19:21:27
问题 I'm using Grails 2.4.2. As can be seen here: https://grails.org/Converters+Reference You can create a static method in your domain with your custom marshaller to render the JSON in the controller. Like that: Domain: // a class to output in JSON package com.sample class User { String login String passwd // JSON definition of the User object static { grails.converters.JSON.registerObjectMarshaller(User) { return [ login: it.login ] } } Then in your controller: def user = new User(login:'bob',

Grails Url shortener plugin not getting installed

喜夏-厌秋 提交于 2020-01-11 06:47:07
问题 I am trying to add a new plugin mentioned here in my app but it is not been resolved and giving me a error i.e. :: problems summary :: :::: WARNINGS module not found: org.grails.plugins#url-shortener;0.2.1 ==== grailsPlugins: tried -- artifact org.grails.plugins#url-shortener;0.2.1!url-shortener.zip: ... ==== grailsHome: tried /opt/grails/lib/org.grails.plugins/url-shortener/ivy-0.2.1.xml -- artifact org.grails.plugins#url-shortener;0.2.1!url-shortener.zip: /opt/grails/lib/org.grails.plugins

Grails form creation for many-to-one belongsTo

若如初见. 提交于 2020-01-07 06:38:30
问题 I am a beginner in grails and I have a basic question. I want to display a list of instances of a parent class in the child class form creation. My Domain class are as follows. The Parent class is the Company. class Company { String name static constraints = { name(blank:false) } String toString(){name} } My Child Class is the Location of the company. class Location { String name String address static belongsTo= {companyLocation:Company} static constraints = { name(blank: false) address blank

grails config get data from context.xml

左心房为你撑大大i 提交于 2020-01-05 09:09:30
问题 im new to grails and im looking for a way to retrieve data from context.xml for the build version. my development environment config looks like this. grails { mail { host = "smtp.gmail.com" port = 25 username = "username@mail.com" password = 'password' props = ["mail.smtp.auth":"true", "mail.smtp.socketFactory.port":"25", "mail.debug":"false", "mail.smtp.from":"username@mail.com", "mail.smtp.socketFactory.class":"javax.net.ssl.SSLSocketFactory", "mail.smtp.socketFactory.fallback":"false"] }

grails config get data from context.xml

流过昼夜 提交于 2020-01-05 09:07:25
问题 im new to grails and im looking for a way to retrieve data from context.xml for the build version. my development environment config looks like this. grails { mail { host = "smtp.gmail.com" port = 25 username = "username@mail.com" password = 'password' props = ["mail.smtp.auth":"true", "mail.smtp.socketFactory.port":"25", "mail.debug":"false", "mail.smtp.from":"username@mail.com", "mail.smtp.socketFactory.class":"javax.net.ssl.SSLSocketFactory", "mail.smtp.socketFactory.fallback":"false"] }