Entity Classes not found when Testing

12 views
Skip to first unread message

Peter Kelley

unread,
Jul 14, 2015, 5:59:45 PM7/14/15
to gae...@googlegroups.com
I am getting compilation failures when trying to compile tests that reference groovy entity classes and I'm stumped for where to look next. I have a class com.appspot.yourapp.Person that the test compile does not find whether I put it in src/main/groovy or src/main/webapp/WEB-INF/groovy. I have other tests that work successfully against groovlets in the root package of src/main/webapp/groovy and the class file is in build/main/classes correctly.

Any ideas about where to look next? This has all the markings of a stupid user error but I just can't see it at the moment.

Vladimír Oraný

unread,
Jul 15, 2015, 3:42:42 AM7/15/15
to gae...@googlegroups.com
Hi,

can you provide your build.gradle file?

Cheers,
Vlad

On Tue, Jul 14, 2015 at 11:59 PM Peter Kelley <yell...@gmail.com> wrote:
I am getting compilation failures when trying to compile tests that reference groovy entity classes and I'm stumped for where to look next. I have a class com.appspot.yourapp.Person that the test compile does not find whether I put it in src/main/groovy or src/main/webapp/WEB-INF/groovy. I have other tests that work successfully against groovlets in the root package of src/main/webapp/groovy and the class file is in build/main/classes correctly.

Any ideas about where to look next? This has all the markings of a stupid user error but I just can't see it at the moment.

--
--
You've received this message because you've subscribed to the Gaelyk Google Group.
To send an email to the group, please write to: gae...@googlegroups.com
To unsuscribe from this group: gaelyk+un...@googlegroups.com
To show more options: http://groups.google.fr/group/gaelyk?hl=en

---
You received this message because you are subscribed to the Google Groups "Gaelyk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gaelyk+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Peter Kelley

unread,
Jul 15, 2015, 7:01:58 AM7/15/15
to gae...@googlegroups.com, vlad...@orany.cz
apply plugin: 'war'
apply plugin: 'gaelyk'
apply plugin: 'appengine-geb'
apply plugin: 'eclipse'

def compatibilityVersion = 1.7
sourceCompatibility = compatibilityVersion
targetCompatibility = compatibilityVersion

buildscript {
    repositories {
        mavenCentral()
        jcenter()
    }

    dependencies {
        classpath 'org.gradle.api.plugins:gradle-gaelyk-plugin:0.6'
        classpath 'org.gradle.api.plugins:gradle-appengine-geb-plugin:0.4'
    }
}

repositories {
    mavenCentral()
    jcenter()
}

dependencies {
    def gaeVersion = '1.9.4'
    def groovyVersion = '2.3.0'

    compile "org.codehaus.groovy:groovy-all:${groovyVersion}"

    compile "com.google.appengine:appengine-api-1.0-sdk:$gaeVersion",
            "com.google.appengine:appengine-api-labs:$gaeVersion",
            "org.apache.httpcomponents:httpclient:4.5"

    compile 'org.sitemesh:sitemesh:3.0-alpha-2'

    compile 'org.gaelyk:gaelyk:2.1.2'


    testCompile 'org.gaelyk:gaelyk-spock:0.4'
    testCompile "com.google.appengine:appengine-api-stubs:$gaeVersion",
            "com.google.appengine:appengine-testing:$gaeVersion"

    functionalTestCompile 'org.seleniumhq.selenium:selenium-firefox-driver:2.40.0'
    functionalTestCompile 'org.gebish:geb-spock:0.9.2'

    appengineSdk "com.google.appengine:appengine-java-sdk:$gaeVersion"


    /**
     * To add binary plugin just declare it as a dependency. For example,
     * uncomment following to add GPars support to your Gaelyk project.
     */
    // compile 'org.codehaus.gpars:gpars-appengine:0.1'

    /**
     * Gaelyk console serves as playground or key-hole surgery tool for
     * your application
     */
    // compile 'org.gaelyk:gaelyk-console:2.0'

}

task copyPolymer(type: Copy) {
from 'src/bower_components'
into 'src/main/webapp/webcomponents'
exclude '**/demo/**'
exclude '**/test/**'
exclude '**/readme.md'
}

build.gradle

and here is the test:

import groovyx.gaelyk.spock.*
import com.google.appengine.api.datastore.*
import static com.google.appengine.api.datastore.FetchOptions.Builder.*
import com.appengine.yourapp.Person

class PersonListSpec extends GaelykUnitSpec {

def setup() {
groovlet 'personList.groovy'
}
    def "people are retrieved by the groovlet"() {
        given: "3 people in the database and the initialised groovlet is invoked"
        new Person(['firstName':'First','lastName':'Person','description':'The first person']).save()
        new Person(['firstName':'Second','lastName':'Person','description':'The second person']).save()
        new Person(['firstName':'Third','lastName':'Person','description':'The third person']).save()
        groovletInstance.get()

        when: "the groovlet personList variable is retrieved"
        def result = request.getAttribute('personList')
        
        then: "the result is not null and contains 3 items"
        result != null
        result.size == 3
    }

}

Reply all
Reply to author
Forward
0 new messages