Author: apetrelli
Date: Wed Feb 2 16:13:31 2011
New Revision: 1066512
URL: http://svn.apache.org/viewvc?rev=1066512&view=rev
Log:
TILESSB-38
Fixed tiles-request-velocity code style.
Added:
tiles/sandbox/trunk/tiles-request/tiles-request-velocity/src/main/java/org/apache/tiles/request/velocity/extractor/package-info.java
tiles/sandbox/trunk/tiles-request/tiles-request-velocity/src/main/java/org/apache/tiles/request/velocity/package-info.java
tiles/sandbox/trunk/tiles-request/tiles-request-velocity/src/main/java/org/apache/tiles/request/velocity/render/package-info.java
Modified:
tiles/sandbox/trunk/tiles-request/tiles-request-velocity/src/main/java/org/apache/tiles/request/velocity/VelocityRequest.java
tiles/sandbox/trunk/tiles-request/tiles-request-velocity/src/main/java/org/apache/tiles/request/velocity/extractor/VelocityScopeExtractor.java
tiles/sandbox/trunk/tiles-request/tiles-request-velocity/src/main/java/org/apache/tiles/request/velocity/render/ApplicationContextJeeConfig.java
tiles/sandbox/trunk/tiles-request/tiles-request-velocity/src/main/java/org/apache/tiles/request/velocity/render/VelocityRenderer.java
tiles/sandbox/trunk/tiles-request/tiles-request-velocity/src/main/java/org/apache/tiles/request/velocity/render/VelocityRendererBuilder.java
tiles/sandbox/trunk/tiles-request/tiles-request-velocity/src/test/java/org/apache/tiles/request/velocity/VelocityRequestTest.java
tiles/sandbox/trunk/tiles-request/tiles-request-velocity/src/test/java/org/apache/tiles/request/velocity/VelocityScopeMapTest.java
tiles/sandbox/trunk/tiles-request/tiles-request-velocity/src/test/java/org/apache/tiles/request/velocity/extractor/VelocityScopeExtractorTest.java
tiles/sandbox/trunk/tiles-request/tiles-request-velocity/src/test/java/org/apache/tiles/request/velocity/render/ApplicationContextJeeConfigTest.java
tiles/sandbox/trunk/tiles-request/tiles-request-velocity/src/test/java/org/apache/tiles/request/velocity/render/VelocityRendererTest.java
Modified:
tiles/sandbox/trunk/tiles-request/tiles-request-velocity/src/main/java/org/apache/tiles/request/velocity/VelocityRequest.java
URL:
http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles-request/tiles-request-velocity/src/main/java/org/apache/tiles/request/velocity/VelocityRequest.java?rev=1066512&r1=1066511&r2=1066512&view=diff
==============================================================================
---
tiles/sandbox/trunk/tiles-request/tiles-request-velocity/src/main/java/org/apache/tiles/request/velocity/VelocityRequest.java
(original)
+++
tiles/sandbox/trunk/tiles-request/tiles-request-velocity/src/main/java/org/apache/tiles/request/velocity/VelocityRequest.java
Wed Feb 2 16:13:31 2011
@@ -47,6 +47,9 @@ import org.apache.velocity.context.Conte
*/
public class VelocityRequest extends AbstractViewRequest {
+ /**
+ * The native available scopes, in fact only "page".
+ */
private static final String[] SCOPES = {"page"};
/**
@@ -64,8 +67,21 @@ public class VelocityRequest extends Abs
*/
private Writer writer;
+ /**
+ * The map of the page scope.
+ */
private Map<String, Object> pageScope;
+ /**
+ * Factory method to create a Velocity request.
+ *
+ * @param applicationContext The application context.
+ * @param request The request.
+ * @param response The response.
+ * @param velocityContext The Velocity context.
+ * @param writer The writer to write into.
+ * @return The request.
+ */
public static VelocityRequest createVelocityRequest(
ApplicationContext applicationContext, HttpServletRequest request,
HttpServletResponse response, Context velocityContext, Writer
writer) {
@@ -163,6 +179,11 @@ public class VelocityRequest extends Abs
return requestObjects;
}
+ /**
+ * Returns the page scope.
+ *
+ * @return The page scope.
+ */
public Map<String, Object> getPageScope() {
if (pageScope == null) {
pageScope = new VelocityScopeMap(ctx);
Modified:
tiles/sandbox/trunk/tiles-request/tiles-request-velocity/src/main/java/org/apache/tiles/request/velocity/extractor/VelocityScopeExtractor.java
URL:
http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles-request/tiles-request-velocity/src/main/java/org/apache/tiles/request/velocity/extractor/VelocityScopeExtractor.java?rev=1066512&r1=1066511&r2=1066512&view=diff
==============================================================================
---
tiles/sandbox/trunk/tiles-request/tiles-request-velocity/src/main/java/org/apache/tiles/request/velocity/extractor/VelocityScopeExtractor.java
(original)
+++
tiles/sandbox/trunk/tiles-request/tiles-request-velocity/src/main/java/org/apache/tiles/request/velocity/extractor/VelocityScopeExtractor.java
Wed Feb 2 16:13:31 2011
@@ -1,3 +1,23 @@
+/*
+ * $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
package org.apache.tiles.request.velocity.extractor;
import java.util.Enumeration;
@@ -5,10 +25,23 @@ import java.util.Enumeration;
import org.apache.tiles.request.attribute.AttributeExtractor;
import org.apache.velocity.context.Context;
+/**
+ * Extracts attributes from Velocity context..
+ *
+ * @version $Rev$ $Date$
+ */
public class VelocityScopeExtractor implements AttributeExtractor {
+ /**
+ * The Velocity context.
+ */
private Context context;
+ /**
+ * Constructor.
+ *
+ * @param context The Velocity context.
+ */
public VelocityScopeExtractor(Context context) {
this.context = context;
}
@@ -33,12 +66,26 @@ public class VelocityScopeExtractor impl
context.put(key, value);
}
+ /**
+ * Enumerates an array.
+ */
private static class KeyEnumeration implements Enumeration<String> {
+ /**
+ * The current index.
+ */
private int index = 0;
+ /**
+ * The array to enumerate.
+ */
private Object[] keys;
+ /**
+ * Constructor.
+ *
+ * @param keys The array to enumerate.
+ */
public KeyEnumeration(Object[] keys) {
this.keys = keys;
}
Added:
tiles/sandbox/trunk/tiles-request/tiles-request-velocity/src/main/java/org/apache/tiles/request/velocity/extractor/package-info.java
URL:
http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles-request/tiles-request-velocity/src/main/java/org/apache/tiles/request/velocity/extractor/package-info.java?rev=1066512&view=auto
==============================================================================
---
tiles/sandbox/trunk/tiles-request/tiles-request-velocity/src/main/java/org/apache/tiles/request/velocity/extractor/package-info.java
(added)
+++
tiles/sandbox/trunk/tiles-request/tiles-request-velocity/src/main/java/org/apache/tiles/request/velocity/extractor/package-info.java
Wed Feb 2 16:13:31 2011
@@ -0,0 +1,24 @@
+/*
+ * $Id: package-info.java 1049711 2010-12-15 21:12:00Z apetrelli $
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+/**
+ * Extractors to get info about Velocity-specific objects.
+ */
+package org.apache.tiles.request.velocity.extractor;
Added:
tiles/sandbox/trunk/tiles-request/tiles-request-velocity/src/main/java/org/apache/tiles/request/velocity/package-info.java
URL:
http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles-request/tiles-request-velocity/src/main/java/org/apache/tiles/request/velocity/package-info.java?rev=1066512&view=auto
==============================================================================
---
tiles/sandbox/trunk/tiles-request/tiles-request-velocity/src/main/java/org/apache/tiles/request/velocity/package-info.java
(added)
+++
tiles/sandbox/trunk/tiles-request/tiles-request-velocity/src/main/java/org/apache/tiles/request/velocity/package-info.java
Wed Feb 2 16:13:31 2011
@@ -0,0 +1,24 @@
+/*
+ * $Id: package-info.java 1049711 2010-12-15 21:12:00Z apetrelli $
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+/**
+ * Tiles request support for Velocity.
+ */
+package org.apache.tiles.request.velocity;
Modified:
tiles/sandbox/trunk/tiles-request/tiles-request-velocity/src/main/java/org/apache/tiles/request/velocity/render/ApplicationContextJeeConfig.java
URL:
http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles-request/tiles-request-velocity/src/main/java/org/apache/tiles/request/velocity/render/ApplicationContextJeeConfig.java?rev=1066512&r1=1066511&r2=1066512&view=diff
==============================================================================
---
tiles/sandbox/trunk/tiles-request/tiles-request-velocity/src/main/java/org/apache/tiles/request/velocity/render/ApplicationContextJeeConfig.java
(original)
+++
tiles/sandbox/trunk/tiles-request/tiles-request-velocity/src/main/java/org/apache/tiles/request/velocity/render/ApplicationContextJeeConfig.java
Wed Feb 2 16:13:31 2011
@@ -1,3 +1,23 @@
+/*
+ * $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
package org.apache.tiles.request.velocity.render;
import java.util.Enumeration;
@@ -30,6 +50,12 @@ public class ApplicationContextJeeConfig
*/
private Map<String, String> params;
+ /**
+ * Constructor.
+ *
+ * @param applicationContext The application context.
+ * @param params Configuration parameters.
+ */
public ApplicationContextJeeConfig(ApplicationContext applicationContext,
Map<String, String> params) {
this.applicationContext = applicationContext;
this.params = new HashMap<String, String>(params);
@@ -60,4 +86,4 @@ public class ApplicationContextJeeConfig
public ServletContext getServletContext() {
return ServletUtil.getServletContext(applicationContext);
}
-}
\ No newline at end of file
+}
Modified:
tiles/sandbox/trunk/tiles-request/tiles-request-velocity/src/main/java/org/apache/tiles/request/velocity/render/VelocityRenderer.java
URL:
http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles-request/tiles-request-velocity/src/main/java/org/apache/tiles/request/velocity/render/VelocityRenderer.java?rev=1066512&r1=1066511&r2=1066512&view=diff
==============================================================================
---
tiles/sandbox/trunk/tiles-request/tiles-request-velocity/src/main/java/org/apache/tiles/request/velocity/render/VelocityRenderer.java
(original)
+++
tiles/sandbox/trunk/tiles-request/tiles-request-velocity/src/main/java/org/apache/tiles/request/velocity/render/VelocityRenderer.java
Wed Feb 2 16:13:31 2011
@@ -49,6 +49,11 @@ public class VelocityRenderer implements
*/
private VelocityView velocityView;
+ /**
+ * Constructor.
+ *
+ * @param velocityView The Velocity view manager.
+ */
public VelocityRenderer(VelocityView velocityView) {
this.velocityView = velocityView;
}
Modified:
tiles/sandbox/trunk/tiles-request/tiles-request-velocity/src/main/java/org/apache/tiles/request/velocity/render/VelocityRendererBuilder.java
URL:
http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles-request/tiles-request-velocity/src/main/java/org/apache/tiles/request/velocity/render/VelocityRendererBuilder.java?rev=1066512&r1=1066511&r2=1066512&view=diff
==============================================================================
---
tiles/sandbox/trunk/tiles-request/tiles-request-velocity/src/main/java/org/apache/tiles/request/velocity/render/VelocityRendererBuilder.java
(original)
+++
tiles/sandbox/trunk/tiles-request/tiles-request-velocity/src/main/java/org/apache/tiles/request/velocity/render/VelocityRendererBuilder.java
Wed Feb 2 16:13:31 2011
@@ -1,3 +1,23 @@
+/*
+ * $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
package org.apache.tiles.request.velocity.render;
import java.util.HashMap;
@@ -7,7 +27,12 @@ import java.util.Map;
import org.apache.tiles.request.ApplicationContext;
import org.apache.velocity.tools.view.VelocityView;
-public class VelocityRendererBuilder {
+/**
+ * Builds a {@link VelocityRenderer}.
+ *
+ * @version $Rev$ $Date$
+ */
+public final class VelocityRendererBuilder {
/**
* The initialization parameters for VelocityView.
@@ -19,9 +44,17 @@ public class VelocityRendererBuilder {
*/
private ApplicationContext applicationContext;
+ /**
+ * Constructor.
+ */
private VelocityRendererBuilder() {
}
+ /**
+ * Returns a new instance of the builder.
+ *
+ * @return A new builder.
+ */
public static VelocityRendererBuilder createInstance() {
return new VelocityRendererBuilder();
}
@@ -31,6 +64,7 @@ public class VelocityRendererBuilder {
*
* @param key The name of the parameter.
* @param value The value of the parameter.
+ * @return This builder.
*/
public VelocityRendererBuilder setParameter(String key, String value) {
params.put(key, value);
@@ -41,12 +75,18 @@ public class VelocityRendererBuilder {
* Sets the application context.
*
* @param applicationContext The application context.
+ * @return This builder.
*/
public VelocityRendererBuilder setApplicationContext(ApplicationContext
applicationContext) {
this.applicationContext = applicationContext;
return this;
}
+ /**
+ * Creates the Velocity renderer.
+ *
+ * @return The Velocity renderer.
+ */
public VelocityRenderer build() {
VelocityView velocityView = new VelocityView(
new ApplicationContextJeeConfig(applicationContext, params));
Added:
tiles/sandbox/trunk/tiles-request/tiles-request-velocity/src/main/java/org/apache/tiles/request/velocity/render/package-info.java
URL:
http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles-request/tiles-request-velocity/src/main/java/org/apache/tiles/request/velocity/render/package-info.java?rev=1066512&view=auto
==============================================================================
---
tiles/sandbox/trunk/tiles-request/tiles-request-velocity/src/main/java/org/apache/tiles/request/velocity/render/package-info.java
(added)
+++
tiles/sandbox/trunk/tiles-request/tiles-request-velocity/src/main/java/org/apache/tiles/request/velocity/render/package-info.java
Wed Feb 2 16:13:31 2011
@@ -0,0 +1,24 @@
+/*
+ * $Id: package-info.java 1049711 2010-12-15 21:12:00Z apetrelli $
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+/**
+ * Renderering support for Velocity.
+ */
+package org.apache.tiles.request.velocity.render;
Modified:
tiles/sandbox/trunk/tiles-request/tiles-request-velocity/src/test/java/org/apache/tiles/request/velocity/VelocityRequestTest.java
URL:
http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles-request/tiles-request-velocity/src/test/java/org/apache/tiles/request/velocity/VelocityRequestTest.java?rev=1066512&r1=1066511&r2=1066512&view=diff
==============================================================================
---
tiles/sandbox/trunk/tiles-request/tiles-request-velocity/src/test/java/org/apache/tiles/request/velocity/VelocityRequestTest.java
(original)
+++
tiles/sandbox/trunk/tiles-request/tiles-request-velocity/src/test/java/org/apache/tiles/request/velocity/VelocityRequestTest.java
Wed Feb 2 16:13:31 2011
@@ -73,9 +73,7 @@ public class VelocityRequestTest {
/**
* Tests {@link VelocityRequest
- * #createVelocityRequest(org.apache.tiles.request.ApplicationContext,
HttpServletRequest, HttpServletResponse, Context, java.io.Writer)}.
- * @throws IOException If something goes wrong.
- * @throws ServletException If something goes wrong.
+ * #createVelocityRequest(ApplicationContext, HttpServletRequest,
HttpServletResponse, Context, Writer)}.
*/
@Test
public void testCreateVelocityRequest() {
@@ -84,7 +82,8 @@ public class VelocityRequestTest {
ApplicationContext applicationContext =
createMock(ApplicationContext.class);
replay(velocityContext, httpRequest, response, applicationContext);
- context = VelocityRequest.createVelocityRequest(applicationContext,
httpRequest, response, velocityContext, writer);
+ context = VelocityRequest.createVelocityRequest(applicationContext,
+ httpRequest, response, velocityContext, writer);
ServletRequest servletRequest = (ServletRequest)
context.getWrappedRequest();
assertEquals(httpRequest, servletRequest.getRequest());
assertEquals(response, servletRequest.getResponse());
@@ -134,9 +133,8 @@ public class VelocityRequestTest {
* Tests {@link VelocityRequest#doInclude(String)}.
*
* @throws IOException If something goes wrong.
- * @throws ServletException If something goes wrong.
*/
- @Test(expected=IOException.class)
+ @Test(expected = IOException.class)
public void testDoIncludeNoRequestDispatcher() throws IOException {
String path = "this way";
Request enclosedRequest = createMock(Request.class);
@@ -161,7 +159,7 @@ public class VelocityRequestTest {
* @throws IOException If something goes wrong.
* @throws ServletException If something goes wrong.
*/
- @Test(expected=IOException.class)
+ @Test(expected = IOException.class)
public void testDoIncludeServletException() throws IOException,
ServletException {
String path = "this way";
Request enclosedRequest = createMock(Request.class);
@@ -185,8 +183,6 @@ public class VelocityRequestTest {
/**
* Tests {@link VelocityRequest#getPrintWriter()}.
- *
- * @throws IOException If something goes wrong.
*/
@Test
public void testGetPrintWriter() {
@@ -200,8 +196,6 @@ public class VelocityRequestTest {
/**
* Tests {@link VelocityRequest#getPrintWriter()}.
- *
- * @throws IOException If something goes wrong.
*/
@Test
public void testGetPrintWriterPrintWriter() {
@@ -216,10 +210,8 @@ public class VelocityRequestTest {
/**
* Tests {@link VelocityRequest#getPrintWriter()}.
- *
- * @throws IOException If something goes wrong.
*/
- @Test(expected=IllegalStateException.class)
+ @Test(expected = IllegalStateException.class)
public void testGetPrintWriterNoWriter() {
Request enclosedRequest = createMock(Request.class);
@@ -231,8 +223,6 @@ public class VelocityRequestTest {
/**
* Tests {@link VelocityRequest#getWriter()}.
- *
- * @throws IOException If something goes wrong.
*/
@Test
public void testGetWriter() {
@@ -246,10 +236,8 @@ public class VelocityRequestTest {
/**
* Tests {@link VelocityRequest#getWriter()}.
- *
- * @throws IOException If something goes wrong.
*/
- @Test(expected=IllegalStateException.class)
+ @Test(expected = IllegalStateException.class)
public void testGetWriterNoWriter() {
Request enclosedRequest = createMock(Request.class);
@@ -261,8 +249,6 @@ public class VelocityRequestTest {
/**
* Tests {@link VelocityRequest#getRequestObjects()}.
- * @throws IOException If something goes wrong.
- * @throws ServletException If something goes wrong.
*/
@Test
public void testGetRequestObjects() {
@@ -284,8 +270,6 @@ public class VelocityRequestTest {
/**
* Tests {@link VelocityRequest#getRequestObjects()}.
- * @throws IOException If something goes wrong.
- * @throws ServletException If something goes wrong.
*/
@Test
public void testGetRequestObjectsNoWriter() {
Modified:
tiles/sandbox/trunk/tiles-request/tiles-request-velocity/src/test/java/org/apache/tiles/request/velocity/VelocityScopeMapTest.java
URL:
http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles-request/tiles-request-velocity/src/test/java/org/apache/tiles/request/velocity/VelocityScopeMapTest.java?rev=1066512&r1=1066511&r2=1066512&view=diff
==============================================================================
---
tiles/sandbox/trunk/tiles-request/tiles-request-velocity/src/test/java/org/apache/tiles/request/velocity/VelocityScopeMapTest.java
(original)
+++
tiles/sandbox/trunk/tiles-request/tiles-request-velocity/src/test/java/org/apache/tiles/request/velocity/VelocityScopeMapTest.java
Wed Feb 2 16:13:31 2011
@@ -1,5 +1,22 @@
-/**
+/*
+ * $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
*/
package org.apache.tiles.request.velocity;
@@ -19,8 +36,14 @@ import org.junit.Test;
*/
public class VelocityScopeMapTest {
+ /**
+ * The Velocity context.
+ */
private Context request;
+ /**
+ * The map to test.
+ */
private VelocityScopeMap map;
/**
@@ -96,7 +119,7 @@ public class VelocityScopeMapTest {
}
/**
- * Test method for {@link
org.apache.tiles.request.velocity.VelocityScopeMap#put(java.lang.String,
java.lang.Object)}.
+ * Test method for {@link VelocityScopeMap#put(String, Object)}.
*/
@Test
public void testPutStringObject() {
Modified:
tiles/sandbox/trunk/tiles-request/tiles-request-velocity/src/test/java/org/apache/tiles/request/velocity/extractor/VelocityScopeExtractorTest.java
URL:
http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles-request/tiles-request-velocity/src/test/java/org/apache/tiles/request/velocity/extractor/VelocityScopeExtractorTest.java?rev=1066512&r1=1066511&r2=1066512&view=diff
==============================================================================
---
tiles/sandbox/trunk/tiles-request/tiles-request-velocity/src/test/java/org/apache/tiles/request/velocity/extractor/VelocityScopeExtractorTest.java
(original)
+++
tiles/sandbox/trunk/tiles-request/tiles-request-velocity/src/test/java/org/apache/tiles/request/velocity/extractor/VelocityScopeExtractorTest.java
Wed Feb 2 16:13:31 2011
@@ -1,5 +1,22 @@
-/**
+/*
+ * $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
*/
package org.apache.tiles.request.velocity.extractor;
@@ -19,8 +36,14 @@ import org.junit.Test;
*/
public class VelocityScopeExtractorTest {
+ /**
+ * The Velocity context.
+ */
private Context request;
+ /**
+ * The extractor to test.
+ */
private VelocityScopeExtractor extractor;
/**
@@ -33,7 +56,7 @@ public class VelocityScopeExtractorTest
}
/**
- * Test method for {@link
org.apache.tiles.request.velocity.extractor.VelocityScopeExtractor#removeValue(java.lang.String)}.
+ * Test method for {@link
VelocityScopeExtractor#removeValue(java.lang.String)}.
*/
@Test
public void testRemoveValue() {
@@ -45,7 +68,7 @@ public class VelocityScopeExtractorTest
}
/**
- * Test method for {@link
org.apache.tiles.request.velocity.extractor.VelocityScopeExtractor#getKeys()}.
+ * Test method for {@link VelocityScopeExtractor#getKeys()}.
*/
@Test
public void testGetKeys() {
@@ -62,7 +85,7 @@ public class VelocityScopeExtractorTest
}
/**
- * Test method for {@link
org.apache.tiles.request.velocity.extractor.VelocityScopeExtractor#getValue(java.lang.String)}.
+ * Test method for {@link
VelocityScopeExtractor#getValue(java.lang.String)}.
*/
@Test
public void testGetValue() {
@@ -74,7 +97,7 @@ public class VelocityScopeExtractorTest
}
/**
- * Test method for {@link
org.apache.tiles.request.velocity.extractor.VelocityScopeExtractor#setValue(java.lang.String,
java.lang.Object)}.
+ * Test method for {@link
VelocityScopeExtractor#setValue(java.lang.String, java.lang.Object)}.
*/
@Test
public void testSetValue() {
Modified:
tiles/sandbox/trunk/tiles-request/tiles-request-velocity/src/test/java/org/apache/tiles/request/velocity/render/ApplicationContextJeeConfigTest.java
URL:
http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles-request/tiles-request-velocity/src/test/java/org/apache/tiles/request/velocity/render/ApplicationContextJeeConfigTest.java?rev=1066512&r1=1066511&r2=1066512&view=diff
==============================================================================
---
tiles/sandbox/trunk/tiles-request/tiles-request-velocity/src/test/java/org/apache/tiles/request/velocity/render/ApplicationContextJeeConfigTest.java
(original)
+++
tiles/sandbox/trunk/tiles-request/tiles-request-velocity/src/test/java/org/apache/tiles/request/velocity/render/ApplicationContextJeeConfigTest.java
Wed Feb 2 16:13:31 2011
@@ -1,3 +1,23 @@
+/*
+ * $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
package org.apache.tiles.request.velocity.render;
import static org.easymock.EasyMock.*;
@@ -14,27 +34,53 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Test;
+/**
+ * Tests {@link ApplicationContextJeeConfig}.
+ *
+ * @version $Rev$ $Date$
+ */
public class ApplicationContextJeeConfigTest {
+ /**
+ * The configuration to test.
+ */
private ApplicationContextJeeConfig config;
+ /**
+ * The application context.
+ */
private ServletApplicationContext applicationContext;
+ /**
+ * The servlet context.
+ */
private ServletContext servletContext;
+ /**
+ * Custom parameters.
+ */
private Map<String, String> params;
+ /**
+ * Sets up the test.
+ */
@Before
public void setUp() {
servletContext = createMock(ServletContext.class);
applicationContext = new ServletApplicationContext(servletContext);
}
+ /**
+ * Tears down the test.
+ */
@After
public void tearDown() {
verify(servletContext);
}
+ /**
+ * Tests {@link ApplicationContextJeeConfig#getInitParameter(String)}.
+ */
@Test
public void testGetInitParameter() {
params = new HashMap<String, String>();
@@ -44,6 +90,9 @@ public class ApplicationContextJeeConfig
assertEquals("value1", config.getInitParameter("one"));
}
+ /**
+ * Tests {@link ApplicationContextJeeConfig#findInitParameter(String)}.
+ */
@Test
public void testFindInitParameter() {
params = new HashMap<String, String>();
@@ -53,6 +102,9 @@ public class ApplicationContextJeeConfig
assertEquals("value1", config.findInitParameter("one"));
}
+ /**
+ * Tests {@link ApplicationContextJeeConfig#getInitParameterNames()}.
+ */
@Test
public void testGetInitParameterNames() {
params = new HashMap<String, String>();
@@ -66,6 +118,9 @@ public class ApplicationContextJeeConfig
assertFalse(names.hasMoreElements());
}
+ /**
+ * Tests {@link ApplicationContextJeeConfig#getName()}.
+ */
@Test
public void testGetName() {
params = new HashMap<String, String>();
@@ -75,6 +130,9 @@ public class ApplicationContextJeeConfig
assertEquals("Application Context JEE Config", config.getName());
}
+ /**
+ * Tests {@link ApplicationContextJeeConfig#getServletContext()}.
+ */
@Test
public void testGetServletContext() {
params = new HashMap<String, String>();
Modified:
tiles/sandbox/trunk/tiles-request/tiles-request-velocity/src/test/java/org/apache/tiles/request/velocity/render/VelocityRendererTest.java
URL:
http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles-request/tiles-request-velocity/src/test/java/org/apache/tiles/request/velocity/render/VelocityRendererTest.java?rev=1066512&r1=1066511&r2=1066512&view=diff
==============================================================================
---
tiles/sandbox/trunk/tiles-request/tiles-request-velocity/src/test/java/org/apache/tiles/request/velocity/render/VelocityRendererTest.java
(original)
+++
tiles/sandbox/trunk/tiles-request/tiles-request-velocity/src/test/java/org/apache/tiles/request/velocity/render/VelocityRendererTest.java
Wed Feb 2 16:13:31 2011
@@ -33,7 +33,6 @@ import javax.servlet.http.HttpServletRes
import org.apache.tiles.request.render.CannotRenderException;
import org.apache.tiles.request.render.TypeDetectingRenderer;
import org.apache.tiles.request.servlet.ServletRequest;
-import org.apache.tiles.request.velocity.render.VelocityRenderer;
import org.apache.velocity.Template;
import org.apache.velocity.tools.view.VelocityView;
import org.apache.velocity.tools.view.ViewToolContext;
@@ -77,7 +76,7 @@ public class VelocityRendererTest {
* Tests {@link VelocityRenderer#render(String,
org.apache.tiles.request.Request)}.
* @throws IOException If something goes wrong.
*/
- @Test(expected=CannotRenderException.class)
+ @Test(expected = CannotRenderException.class)
public void testRenderException() throws IOException {
VelocityView view = createMock(VelocityView.class);
ServletRequest request = createMock(ServletRequest.class);