Skip to content

Commit

Permalink
#175: modifies test to check that the "sculptor-generator.properties"…
Browse files Browse the repository at this point in the history
… settings of "cascade.aggregate" and "cascade.aggregate.oneToMany" are working as expected
  • Loading branch information
tjuerge committed May 10, 2015
1 parent 5e7bc28 commit 11bef26
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
import org.sculptor.dsl.SculptordslInjectorProvider
import org.sculptor.generator.configuration.Configuration
import org.sculptor.generator.test.GeneratorModelTestFixtures

import static org.junit.Assert.*
Expand All @@ -41,6 +42,8 @@ class DomainObjectReferenceAnnotationTmplTest extends XtextTest {

@Before
def void setup() {
System.setProperty(Configuration.PROPERTIES_LOCATION_PROPERTY,
"generator-tests/helloworld/sculptor-generator.properties")
generatorModelTestFixtures.setupInjector(typeof(DomainObjectReferenceAnnotationTmpl))
generatorModelTestFixtures.setupModel("generator-tests/helloworld/model.btdesign")

Expand All @@ -57,7 +60,7 @@ class DomainObjectReferenceAnnotationTmplTest extends XtextTest {
}

@Test
def void assertOneToManyWithCascadeTypeAllInPlanetBaseForReferenceMoons() {
def void assertOneToManyWithCascadeTypeRemoveInPlanetBaseForReferenceMoons() {
val app = generatorModelTestFixtures.app
assertNotNull(app)

Expand All @@ -71,7 +74,7 @@ class DomainObjectReferenceAnnotationTmplTest extends XtextTest {
val code = domainObjectReferenceAnnotationTmpl.oneToManyJpaAnnotation(moons)
assertNotNull(code)
assertContains(code, '@javax.persistence.OneToMany')
assertContains(code, 'cascade=javax.persistence.CascadeType.ALL')
assertContains(code, 'cascade=javax.persistence.CascadeType.REMOVE')
assertContains(code, 'orphanRemoval=true')
assertContains(code, 'mappedBy="planet"')
assertContains(code, 'fetch=javax.persistence.FetchType.EAGER')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ generate.repository.finders=true
jpa.provider=hibernate

cartridges=builder

cascade.aggregate.oneToMany=remove

0 comments on commit 11bef26

Please sign in to comment.