Skip to content

Commit

Permalink
Refactored registration infrastructure ready for full implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
martinlau committed Jul 15, 2013
1 parent aa091cb commit 5ed8471
Show file tree
Hide file tree
Showing 9 changed files with 101 additions and 12 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@
<executions>
<execution>
<id>generate</id>
<phase>verify</phase>
<phase>pre-site</phase>
<goals>
<goal>generate</goal>
</goals>
Expand Down
33 changes: 33 additions & 0 deletions src/main/kotlin/io/fixture/controller/RegistrationController.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* #%L
* fixture
* %%
* Copyright (C) 2013 Martin Lau
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/

package io.fixture.controller

import org.springframework.stereotype.Controller
import org.springframework.web.bind.annotation.RequestMapping

[Controller]
[RequestMapping(value = array("join"))]
public class RegistrationController {

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

}
3 changes: 2 additions & 1 deletion src/main/kotlin/io/fixture/controller/SecureController.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ import org.springframework.stereotype.Controller
import org.springframework.web.bind.annotation.RequestMapping

[Controller]
[RequestMapping(value = array("/secure"))]
public class SecureController {

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

}
3 changes: 0 additions & 3 deletions src/main/kotlin/io/fixture/controller/StaticController.kt
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ public class StaticController {
[RequestMapping(value = array("/contact"))]
fun contact() = ".static.contact"

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

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,14 @@ common.navigation.join=Join
common.navigation.login=Log in
common.navigation.logout=Log out

registration.title=Join

secure.index.title=Secure

static.about.title=About
static.access-denied.title=Access denied
static.contact.title=Contact
static.index.title=fixture.io
static.join.title=Join
static.login.title=Log in
static.login.error=Log in failed
static.login.username=Username
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
version="2.0">

<h2>
<spring:message code="static.join.title" />
<spring:message code="registration.title" />
</h2>

<p>
Expand Down
10 changes: 5 additions & 5 deletions src/main/webapp/WEB-INF/tiles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@

<definition name=".common.*" template="/WEB-INF/jspx/common/{1}.jspx"/>

<definition name=".registration.index" extends=".base.template">
<put-attribute name="body" type="template" value="/WEB-INF/jspx/registration/index.jspx"/>
<put-attribute name="title" type="string" value="fixture.io - Join"/>
</definition>

<definition name=".secure.index" extends=".base.template">
<put-attribute name="body" type="template" value="/WEB-INF/jspx/secure/index.jspx"/>
<put-attribute name="title" type="string" value="fixture.io - Secure"/>
Expand All @@ -78,11 +83,6 @@
<put-attribute name="title" type="string" value="fixture.io"/>
</definition>

<definition name=".static.join" extends=".base.template">
<put-attribute name="body" type="template" value="/WEB-INF/jspx/static/join.jspx"/>
<put-attribute name="title" type="string" value="fixture.io - Join"/>
</definition>

<definition name=".static.login" extends=".base.template">
<put-attribute name="body" type="template" value="/WEB-INF/jspx/static/login.jspx"/>
<put-attribute name="title" type="string" value="fixture.io - Login"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* #%L
* fixture
* %%
* Copyright (C) 2013 Martin Lau
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/

package io.fixture.controller

import kotlin.test.assertEquals
import org.junit.Test

class RegistrationControllerTest {

val subject = RegistrationController()

[Test]
fun testIndex() {

assertEquals(".registration.index", subject.index())
}

}
21 changes: 21 additions & 0 deletions src/test/resources/io/fixture/feature/registration.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
###
# #%L
# fixture
# %%
# Copyright (C) 2013 Martin Lau
# %%
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# #L%
###

Feature: User Registration

0 comments on commit 5ed8471

Please sign in to comment.