-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Framework set up for allowing testing of TIRS code, either directly or through Job Contexts (With setup to ignore these tests when not using the correct TIRS... this appears to be the only way to run these tests.)
- Loading branch information
1 parent
79f388b
commit e3e6940
Showing
3 changed files
with
69 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
service/src/integration-test/groovy/org/olf/tirs/TIRSSpec.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package org.olf.tirs | ||
|
||
import org.olf.BaseSpec | ||
|
||
import spock.lang.Stepwise | ||
import spock.lang.Ignore | ||
|
||
import spock.lang.* | ||
|
||
import groovy.util.logging.Slf4j | ||
|
||
@Slf4j | ||
@Stepwise | ||
abstract class TIRSSpec extends BaseSpec { | ||
// Place to house any shared TIRS testing methods etc | ||
@Ignore | ||
Boolean isWorkSourceTIRS() { | ||
injectedTIRS() == WORK_SOURCE_TIRS | ||
} | ||
|
||
@Ignore | ||
Boolean isIdTIRS() { | ||
injectedTIRS() == ID_TIRS | ||
} | ||
|
||
@Ignore | ||
Boolean isTitleTIRS() { | ||
injectedTIRS() == TITLE_TIRS | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
service/src/integration-test/groovy/org/olf/tirs/WorkSourceIdentifierTIRSSpec.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package org.olf.tirs | ||
|
||
import org.olf.dataimport.internal.PackageContentImpl | ||
import org.olf.kb.TitleInstance | ||
|
||
import com.k_int.okapi.OkapiTenantResolver | ||
|
||
import grails.gorm.transactions.Transactional | ||
import grails.gorm.multitenancy.Tenants | ||
import grails.testing.mixin.integration.Integration | ||
import grails.web.databinding.DataBindingUtils | ||
import groovy.transform.CompileStatic | ||
import spock.lang.* | ||
|
||
@Integration | ||
@Stepwise | ||
class WorkSourceIdentifierTIRSSpec extends TIRSSpec { | ||
// titleInstanceResolverService is injected in baseSpec now | ||
|
||
// Test directly | ||
// TODO actually fill this out | ||
void 'Test directly' () { | ||
when: 'Do a thing' | ||
String hw = "Hello world" | ||
then: 'test a thing' | ||
true == true | ||
} | ||
|
||
// Test within job runner context (only run when WorkSourceIdTIRS is the chosen TIRS) | ||
// TODO actually fill this out | ||
@Requires({ instance.isWorkSourceTIRS() }) | ||
void 'Test in job runner context' () { | ||
when: 'Do a thing 2' | ||
String hw = "Hello world 2" | ||
then: 'test a thing 2' | ||
true == true | ||
} | ||
} | ||
|