Skip to content

Commit

Permalink
added explicit annotation field names where appropriate
Browse files Browse the repository at this point in the history
  • Loading branch information
martinlau committed Jul 15, 2013
1 parent f01500f commit 04535d9
Show file tree
Hide file tree
Showing 16 changed files with 96 additions and 90 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import org.springframework.stereotype.Controller
import org.springframework.web.bind.annotation.RequestMapping

[Controller]
[RequestMapping(array("/administration"))]
[RequestMapping(value = array("/administration"))]
public class AdministrationController {

[RequestMapping]
fun index() = ".administration.index"

[RequestMapping(array("/users"))]
[RequestMapping(value = array("/users"))]
fun users() = ".administration.users"

}
2 changes: 1 addition & 1 deletion src/main/kotlin/io/fixture/controller/SecureController.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import org.springframework.web.bind.annotation.RequestMapping
[Controller]
public class SecureController {

[RequestMapping(array("/secure"))]
[RequestMapping(value = array("/secure"))]
fun index() = ".secure.index"

}
16 changes: 8 additions & 8 deletions src/main/kotlin/io/fixture/controller/StaticController.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,28 @@ import org.springframework.web.bind.annotation.RequestMapping
[Controller]
public class StaticController {

[RequestMapping(array("/"))]
[RequestMapping(value = array("/"))]
fun index() = ".static.index"

[RequestMapping(array("/about"))]
[RequestMapping(value = array("/about"))]
fun about() = ".static.about"

[RequestMapping(array("/access-denied"))]
[RequestMapping(value = array("/access-denied"))]
fun accessDenied() = ".static.access-denied"

[RequestMapping(array("/contact"))]
[RequestMapping(value = array("/contact"))]
fun contact() = ".static.contact"

[RequestMapping(array("/join"))]
[RequestMapping(value = array("/join"))]
fun join() = ".static.join"

[RequestMapping(array("/login"))]
[RequestMapping(value = array("/login"))]
fun login() = ".static.login"

[RequestMapping(array("/terms"))]
[RequestMapping(value = array("/terms"))]
fun terms() = ".static.terms"

[RequestMapping(array("/privacy"))]
[RequestMapping(value = array("/privacy"))]
fun privacy() = ".static.privacy"

}
2 changes: 1 addition & 1 deletion src/main/kotlin/io/fixture/domain/PersistentLogin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class PersistentLogin: BasePersistable() {
)]
[NotNull]
[Past]
[Temporal(TemporalType.TIMESTAMP)]
[Temporal(value = TemporalType.TIMESTAMP)]
var lastUsed: Date = Date(0)

[Column(
Expand Down
6 changes: 3 additions & 3 deletions src/main/kotlin/io/fixture/domain/User.kt
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ public class User : BasePersistable() {
)]
[Column(name = "token")]
[ElementCollection(targetClass = javaClass<UUID>())]
[MapKeyClass(javaClass<User.TokenType>())]
[MapKeyClass(value = javaClass<User.TokenType>())]
[MapKeyColumn(
name = "token_type",
unique = true
)]
[MapKeyEnumerated(EnumType.STRING)]
[MapKeyEnumerated(value = EnumType.STRING)]
[Type(`type` = "uuid-char")]
var accountTokens: MutableMap<User.TokenType, UUID> = HashMap()

Expand Down Expand Up @@ -97,7 +97,7 @@ public class User : BasePersistable() {
mappedBy = "user",
targetEntity = javaClass<PersistentLogin>()
)]
[MapKeyClass(javaClass<String>())]
[MapKeyClass(value = javaClass<String>())]
[MapKeyColumn(name = "series")]
var persistentLogins: MutableMap<String, PersistentLogin> = HashMap()

Expand Down
22 changes: 11 additions & 11 deletions src/main/kotlin/io/fixture/repository/GroupRepository.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,28 @@ import org.springframework.data.jpa.repository.QueryHints
public trait GroupRepository: JpaRepository<Group, UUID> {

[Modifying]
[Query("DELETE FROM Group g WHERE g.name = :name")]
[QueryHints(array(
[Query(value = "DELETE FROM Group g WHERE g.name = :name")]
[QueryHints(value = array(
QueryHint(name = "org.hibernate.cacheable", value = "true")
))]
fun delete([Param("name")] name: String)
fun delete([Param(value = "name")] name: String)

[Query("SELECT g.name FROM Group g")]
[QueryHints(array(
[Query(value = "SELECT g.name FROM Group g")]
[QueryHints(value = array(
QueryHint(name = "org.hibernate.cacheable", value = "true")
))]
fun findAllNames(): List<String>

[Query("SELECT u.username FROM User u INNER JOIN u.groups g WHERE g.name = :name")]
[QueryHints(array(
[Query(value = "SELECT u.username FROM User u INNER JOIN u.groups g WHERE g.name = :name")]
[QueryHints(value = array(
QueryHint(name = "org.hibernate.cacheable", value = "true")
))]
fun findAllUsernames([Param("name")] name: String): List<String>
fun findAllUsernames([Param(value = "name")] name: String): List<String>

[Query("SELECT g FROM Group g WHERE g.name = :name")]
[QueryHints(array(
[Query(value = "SELECT g FROM Group g WHERE g.name = :name")]
[QueryHints(value = array(
QueryHint(name = "org.hibernate.cacheable", value = "true")
))]
fun findOne([Param("name")] name: String): Group?
fun findOne([Param(value = "name")] name: String): Group?

}
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ import org.springframework.data.jpa.repository.QueryHints
public trait PersistentLoginRepository: JpaRepository<PersistentLogin, UUID> {

[Modifying]
[Query("DELETE FROM PersistentLogin pl WHERE pl.user = (SELECT u FROM User u WHERE u.username = :username)")]
[QueryHints(array(
[Query(value = "DELETE FROM PersistentLogin pl WHERE pl.user = (SELECT u FROM User u WHERE u.username = :username)")]
[QueryHints(value = array(
QueryHint(name = "org.hibernate.cacheable", value = "true")
))]
fun deleteAllForUsername([Param("username")] username: String)
fun deleteAllForUsername([Param(value = "username")] username: String)

[Query("SELECT pl FROM PersistentLogin pl WHERE pl.series = :series")]
[QueryHints(array(
[Query(value = "SELECT pl FROM PersistentLogin pl WHERE pl.series = :series")]
[QueryHints(value = array(
QueryHint(name = "org.hibernate.cacheable", value = "true")
))]
fun findOne([Param("series")] series: String): PersistentLogin?
fun findOne([Param(value = "series")] series: String): PersistentLogin?

}
18 changes: 9 additions & 9 deletions src/main/kotlin/io/fixture/repository/UserRepository.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,22 @@ import org.springframework.data.jpa.repository.QueryHints
public trait UserRepository : JpaRepository<User, UUID> {

[Modifying]
[Query("DELETE FROM User u WHERE u.username = :username")]
[QueryHints(array(
[Query(value = "DELETE FROM User u WHERE u.username = :username")]
[QueryHints(value = array(
QueryHint(name = "org.hibernate.cacheable", value = "true")
))]
fun delete([Param("username")] username: String)
fun delete([Param(value = "username")] username: String)

[Query("SELECT CASE WHEN (count(u) > 0) THEN true ELSE false END FROM User u WHERE u.username = :username")]
[QueryHints(array(
[Query(value = "SELECT CASE WHEN (count(u) > 0) THEN true ELSE false END FROM User u WHERE u.username = :username")]
[QueryHints(value = array(
QueryHint(name = "org.hibernate.cacheable", value = "true")
))]
fun exists([Param("username")] username: String): Boolean
fun exists([Param(value = "username")] username: String): Boolean

[Query("SELECT u FROM User u WHERE u.username = :username")]
[QueryHints(array(
[Query(value = "SELECT u FROM User u WHERE u.username = :username")]
[QueryHints(value = array(
QueryHint(name = "org.hibernate.cacheable", value = "true")
))]
fun findOne([Param("username")] username: String): User?
fun findOne([Param(value = "username")] username: String): User?

}
2 changes: 1 addition & 1 deletion src/test/kotlin/io/fixture/feature/FixtureFeatureIT.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import cucumber.api.junit.Cucumber
import org.junit.runner.RunWith
import org.junit.Ignore

[RunWith(javaClass<Cucumber>())]
[RunWith(value = javaClass<Cucumber>())]
[Cucumber.Options(
format = array(
// "junit:target/failsafe-reports/TEST-io.fixture.feature.FixtureFeatureIT-Cucumber.xml",
Expand Down
18 changes: 9 additions & 9 deletions src/test/kotlin/io/fixture/feature/step/StepDefs.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,53 +16,53 @@ class StepDefs [Autowired] (
val driver: WebDriver
) {

[Value("#{systemProperties['fixture.base.url']}")]
[Value(value = "#{systemProperties['fixture.base.url']}")]
var baseUri: String? = null

[Given("""^I open any page""")]
[Given(value = """^I open any page""")]
fun I_open_any_page() {
driver.get("${baseUri}")
}

[Given("""^I select the theme "([^"]*)"$""")]
[Given(value = """^I select the theme "([^"]*)"$""")]
fun I_select_the_theme(theme: String) {
driver.get(driver.getCurrentUrl() + "?theme=${theme}")
}

[When("""^I go to the page "([^"]*)"$""")]
[When(value = """^I go to the page "([^"]*)"$""")]
fun I_go_to_the_page(page: String) {
driver.get("${baseUri}${page}")
}

[When("""^I click on the link "([^"]*)"$""")]
[When(value = """^I click on the link "([^"]*)"$""")]
fun I_click_on_the_link(link: String) {
driver.findElement(By.linkText(link))!!.click()
}

[When("""^I log in with the credentials "([^"]*)" and "([^"]*)"$""")]
[When(value = """^I log in with the credentials "([^"]*)" and "([^"]*)"$""")]
fun I_log_in_with_the_credentials(username: String, password: String) {
driver.findElement(By.id("username"))!!.sendKeys(username)
driver.findElement(By.id("password"))!!.sendKeys(password)
driver.findElement(By.id("submit"))!!.click()
}

[Then("""^the theme should change to "([^"]*)"$""")]
[Then(value = """^the theme should change to "([^"]*)"$""")]
fun the_theme_should_change_to(theme: String) {
// HACK: drone.io seems to need some time to load the page - this allows that
driver.getCurrentUrl()

assertTrue(driver.getPageSource().contains("href=\"/fixture/static/bootswatch/2.3.1/${theme}/bootstrap.min.css\""))
}

[Then("""^I should see the page "([^"]*)"$""")]
[Then(value = """^I should see the page "([^"]*)"$""")]
fun I_should_see_the_page(title: String) {
// HACK: drone.io seems to need some time to load the page - this allows that
driver.getCurrentUrl()

assertEquals(title, driver.getTitle())
}

[Then("""^I should see the alert "([^"]*)"$""")]
[Then(value = """^I should see the alert "([^"]*)"$""")]
fun I_should_see_the_alert(message: String) {
assertTrue(driver.findElement(By.className("alert"))!!.getText()!!.contains(message))
}
Expand Down
13 changes: 7 additions & 6 deletions src/test/kotlin/io/fixture/repository/GroupRepositoryTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@ import org.springframework.test.context.ContextHierarchy
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner
import org.springframework.transaction.annotation.Transactional

[ContextHierarchy(
ContextConfiguration(array("classpath:/META-INF/spring/fixture-domain.xml")),
ContextConfiguration(array("classpath:/META-INF/spring/fixture-repository.xml")),
ContextConfiguration(array("classpath:/META-INF/spring/fixture-domain-test.xml"))
)]
[RunWith(javaClass<SpringJUnit4ClassRunner>())]
// TODO Reinstantiate when kotlin > 0.5.748
[ContextHierarchy(/*value = array(*/
ContextConfiguration(value = array("classpath:/META-INF/spring/fixture-domain.xml")),
ContextConfiguration(value = array("classpath:/META-INF/spring/fixture-repository.xml")),
ContextConfiguration(value = array("classpath:/META-INF/spring/fixture-domain-test.xml"))
/*)*/)]
[RunWith(value = javaClass<SpringJUnit4ClassRunner>())]
[Transactional]
class GroupRepositoryTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@ import org.springframework.test.context.ContextHierarchy
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner
import org.springframework.transaction.annotation.Transactional

[ContextHierarchy(
ContextConfiguration(array("classpath:/META-INF/spring/fixture-domain.xml")),
ContextConfiguration(array("classpath:/META-INF/spring/fixture-repository.xml")),
ContextConfiguration(array("classpath:/META-INF/spring/fixture-domain-test.xml"))
)]
[RunWith(javaClass<SpringJUnit4ClassRunner>())]
// TODO Reinstantiate when kotlin > 0.5.748
[ContextHierarchy(/*value = array(*/
ContextConfiguration(value = array("classpath:/META-INF/spring/fixture-domain.xml")),
ContextConfiguration(value = array("classpath:/META-INF/spring/fixture-repository.xml")),
ContextConfiguration(value = array("classpath:/META-INF/spring/fixture-domain-test.xml"))
/*)*/)]
[RunWith(value = javaClass<SpringJUnit4ClassRunner>())]
[Transactional]
class PersistentLoginRepositoryTest {

Expand Down
13 changes: 7 additions & 6 deletions src/test/kotlin/io/fixture/repository/UserRepositoryTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@ import org.springframework.test.context.ContextHierarchy
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner
import org.springframework.transaction.annotation.Transactional

[ContextHierarchy(
ContextConfiguration(array("classpath:/META-INF/spring/fixture-domain.xml")),
ContextConfiguration(array("classpath:/META-INF/spring/fixture-repository.xml")),
ContextConfiguration(array("classpath:/META-INF/spring/fixture-domain-test.xml"))
)]
[RunWith(javaClass<SpringJUnit4ClassRunner>())]
// TODO Reinstantiate when kotlin > 0.5.748
[ContextHierarchy(/*value = array(*/
ContextConfiguration(value = array("classpath:/META-INF/spring/fixture-domain.xml")),
ContextConfiguration(value = array("classpath:/META-INF/spring/fixture-repository.xml")),
ContextConfiguration(value = array("classpath:/META-INF/spring/fixture-domain-test.xml"))
/*)*/)]
[RunWith(value = javaClass<SpringJUnit4ClassRunner>())]
[Transactional]
class UserRepositoryTest {

Expand Down
15 changes: 8 additions & 7 deletions src/test/kotlin/io/fixture/security/GroupManagerImplTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner
import org.springframework.transaction.annotation.Transactional
import org.springframework.test.context.ContextHierarchy

[ContextHierarchy(
ContextConfiguration(array("classpath:/META-INF/spring/fixture-domain.xml")),
ContextConfiguration(array("classpath:/META-INF/spring/fixture-repository.xml")),
ContextConfiguration(array("classpath:/META-INF/spring/fixture-domain-test.xml")),
ContextConfiguration(array("classpath:/META-INF/spring/fixture-security.xml"))
)]
[RunWith(javaClass<SpringJUnit4ClassRunner>())]
// TODO Reinstantiate when kotlin > 0.5.748
[ContextHierarchy(/*value = array(*/
ContextConfiguration(value = array("classpath:/META-INF/spring/fixture-domain.xml")),
ContextConfiguration(value = array("classpath:/META-INF/spring/fixture-repository.xml")),
ContextConfiguration(value = array("classpath:/META-INF/spring/fixture-domain-test.xml")),
ContextConfiguration(value = array("classpath:/META-INF/spring/fixture-security.xml"))
/*)*/)]
[RunWith(value = javaClass<SpringJUnit4ClassRunner>())]
[Transactional]
class GroupManagerImplTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@ import org.springframework.test.context.ContextHierarchy
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner
import org.springframework.transaction.annotation.Transactional

[ContextHierarchy(
ContextConfiguration(array("classpath:/META-INF/spring/fixture-domain.xml")),
ContextConfiguration(array("classpath:/META-INF/spring/fixture-repository.xml")),
ContextConfiguration(array("classpath:/META-INF/spring/fixture-domain-test.xml")),
ContextConfiguration(array("classpath:/META-INF/spring/fixture-security.xml"))
)]
[RunWith(javaClass<SpringJUnit4ClassRunner>())]
// TODO Reinstantiate when kotlin > 0.5.748
[ContextHierarchy(/*value = array(*/
ContextConfiguration(value = array("classpath:/META-INF/spring/fixture-domain.xml")),
ContextConfiguration(value = array("classpath:/META-INF/spring/fixture-repository.xml")),
ContextConfiguration(value = array("classpath:/META-INF/spring/fixture-domain-test.xml")),
ContextConfiguration(value = array("classpath:/META-INF/spring/fixture-security.xml"))
/*)*/)]
[RunWith(value = javaClass<SpringJUnit4ClassRunner>())]
[Transactional]
public class PersistentTokenRepositoryImplTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,14 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner
import org.springframework.test.util.ReflectionTestUtils
import org.springframework.transaction.annotation.Transactional

[ContextHierarchy(
ContextConfiguration(array("classpath:/META-INF/spring/fixture-domain.xml")),
ContextConfiguration(array("classpath:/META-INF/spring/fixture-repository.xml")),
ContextConfiguration(array("classpath:/META-INF/spring/fixture-domain-test.xml")),
ContextConfiguration(array("classpath:/META-INF/spring/fixture-security.xml"))
)]
[RunWith(javaClass<SpringJUnit4ClassRunner>())]
// TODO Reinstantiate when kotlin > 0.5.748
[ContextHierarchy(/*value = array(*/
ContextConfiguration(value = array("classpath:/META-INF/spring/fixture-domain.xml")),
ContextConfiguration(value = array("classpath:/META-INF/spring/fixture-repository.xml")),
ContextConfiguration(value = array("classpath:/META-INF/spring/fixture-domain-test.xml")),
ContextConfiguration(value = array("classpath:/META-INF/spring/fixture-security.xml"))
/*)*/)]
[RunWith(value = javaClass<SpringJUnit4ClassRunner>())]
[Transactional]
class UserDetailsManagerImplTest {

Expand Down

0 comments on commit 04535d9

Please sign in to comment.