-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added simple test to check for index writer hashmap usage. Scope appears to be as intended!
- Loading branch information
Bill Smith
committed
Aug 22, 2018
1 parent
d8e2830
commit b9259cf
Showing
1 changed file
with
37 additions
and
0 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
...test/groovy/edu/internet2/tier/shibboleth/admin/ui/service/IndexWriterServiceTests.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,37 @@ | ||
package edu.internet2.tier.shibboleth.admin.ui.service | ||
|
||
import edu.internet2.tier.shibboleth.admin.ui.configuration.CoreShibUiConfiguration | ||
import edu.internet2.tier.shibboleth.admin.ui.configuration.InternationalizationConfiguration | ||
import edu.internet2.tier.shibboleth.admin.ui.configuration.SearchConfiguration | ||
import edu.internet2.tier.shibboleth.admin.ui.configuration.TestConfiguration | ||
import org.springframework.beans.factory.annotation.Autowired | ||
import org.springframework.boot.autoconfigure.domain.EntityScan | ||
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest | ||
import org.springframework.data.jpa.repository.config.EnableJpaRepositories | ||
import org.springframework.test.context.ContextConfiguration | ||
import spock.lang.Specification | ||
|
||
/** | ||
* @author Bill Smith (wsmith@unicon.net) | ||
*/ | ||
@DataJpaTest | ||
@ContextConfiguration(classes=[CoreShibUiConfiguration, SearchConfiguration, TestConfiguration, InternationalizationConfiguration]) | ||
@EnableJpaRepositories(basePackages = ["edu.internet2.tier.shibboleth.admin.ui"]) | ||
@EntityScan("edu.internet2.tier.shibboleth.admin.ui") | ||
class IndexWriterServiceTests extends Specification { | ||
|
||
@Autowired | ||
IndexWriterService service | ||
|
||
def "retrieving index writer for the same resource id multiple times results in the same index writer being returned"() { | ||
given: | ||
def resourceId = "12345" | ||
|
||
when: | ||
def firstIndexWriter = service.getIndexWriter(resourceId) // causes new index writer to be created and added to map | ||
def secondIndexWriter = service.getIndexWriter(resourceId) // retrieves the same index writer from above | ||
|
||
then: | ||
firstIndexWriter == secondIndexWriter | ||
} | ||
} |