You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by hu...@apache.org on 2006/02/10 15:50:59 UTC
svn commit: r376714 - in
/struts/action/trunk/src/test/org/apache/struts/chain/commands: generic/
servlet/
Author: husted
Date: Fri Feb 10 06:50:57 2006
New Revision: 376714
URL: http://svn.apache.org/viewcvs?rev=376714&view=rev
Log:
Checkstyle Roundup
* Action package reformatted with latest Jalopy settings. Stylistic changes only.
Modified:
struts/action/trunk/src/test/org/apache/struts/chain/commands/generic/TestCopyFormToContext.java
struts/action/trunk/src/test/org/apache/struts/chain/commands/generic/TestWrappingLookupCommand.java
struts/action/trunk/src/test/org/apache/struts/chain/commands/servlet/TestAuthorizeAction.java
struts/action/trunk/src/test/org/apache/struts/chain/commands/servlet/TestPerformForward.java
struts/action/trunk/src/test/org/apache/struts/chain/commands/servlet/TestSetOriginalURI.java
Modified: struts/action/trunk/src/test/org/apache/struts/chain/commands/generic/TestCopyFormToContext.java
URL: http://svn.apache.org/viewcvs/struts/action/trunk/src/test/org/apache/struts/chain/commands/generic/TestCopyFormToContext.java?rev=376714&r1=376713&r2=376714&view=diff
==============================================================================
--- struts/action/trunk/src/test/org/apache/struts/chain/commands/generic/TestCopyFormToContext.java (original)
+++ struts/action/trunk/src/test/org/apache/struts/chain/commands/generic/TestCopyFormToContext.java Fri Feb 10 06:50:57 2006
@@ -18,6 +18,7 @@
package org.apache.struts.chain.commands.generic;
import junit.framework.TestCase;
+
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.DynaActionForm;
import org.apache.struts.chain.contexts.MockActionContext;
@@ -75,12 +76,11 @@
testActionConfig.setScope("request");
moduleConfig.addActionConfig(testActionConfig);
- moduleConfig
- .freeze(); // otherwise, ActionConfigMatcher will be null and we'll get an NPE...
+ moduleConfig.freeze(); // otherwise, ActionConfigMatcher will be null and we'll get an NPE...
}
public void testLookupByNameAndRequestScope()
- throws Exception {
+ throws Exception {
CopyFormToContext command = new CopyFormToContext();
String formName = "foo";
@@ -99,23 +99,22 @@
assertNull(context.getSessionScope().get(formName));
assertSame(context.get(POST_EXECUTION_CONTEXT_KEY),
- context.getRequestScope().get(formName));
+ context.getRequestScope().get(formName));
ActionForm theForm =
- (ActionForm) context.get(POST_EXECUTION_CONTEXT_KEY);
+ (ActionForm) context.get(POST_EXECUTION_CONTEXT_KEY);
assertTrue(theForm instanceof MockFormBean);
}
public void testLookupByActionPath()
- throws Exception {
+ throws Exception {
CopyFormToContext command = new CopyFormToContext();
command.setActionPath("/Test");
command.setToKey(POST_EXECUTION_CONTEXT_KEY);
- String formName =
- "foo"; // we know this, even though it's not being used for the lookup.
+ String formName = "foo"; // we know this, even though it's not being used for the lookup.
assertNull(context.get(POST_EXECUTION_CONTEXT_KEY));
assertNull(context.getRequestScope().get(formName));
@@ -128,16 +127,16 @@
assertNull(context.getSessionScope().get(formName));
assertSame(context.get(POST_EXECUTION_CONTEXT_KEY),
- context.getRequestScope().get(formName));
+ context.getRequestScope().get(formName));
ActionForm theForm =
- (ActionForm) context.get(POST_EXECUTION_CONTEXT_KEY);
+ (ActionForm) context.get(POST_EXECUTION_CONTEXT_KEY);
assertTrue(theForm instanceof MockFormBean);
}
public void testLookupByNameAndSessionScope()
- throws Exception {
+ throws Exception {
CopyFormToContext command = new CopyFormToContext();
String formName = "bar";
@@ -156,10 +155,10 @@
assertNotNull(context.getSessionScope().get(formName));
assertSame(context.get(POST_EXECUTION_CONTEXT_KEY),
- context.getSessionScope().get(formName));
+ context.getSessionScope().get(formName));
ActionForm theForm =
- (ActionForm) context.get(POST_EXECUTION_CONTEXT_KEY);
+ (ActionForm) context.get(POST_EXECUTION_CONTEXT_KEY);
assertTrue(theForm instanceof DynaActionForm);
@@ -169,7 +168,7 @@
}
public void testExceptionHandlingWithNullFormName()
- throws Exception {
+ throws Exception {
CopyFormToContext command = new CopyFormToContext();
String formName = "bar";
@@ -185,15 +184,14 @@
try {
command.execute(context);
fail(
- "Execution should throw an exception when form name is not set.");
- }
- catch (IllegalStateException e) {
+ "Execution should throw an exception when form name is not set.");
+ } catch (IllegalStateException e) {
; // expected.
}
}
public void testExceptionHandlingWithNullEverything()
- throws Exception {
+ throws Exception {
CopyFormToContext command = new CopyFormToContext();
String formName = "bar";
@@ -208,15 +206,14 @@
try {
command.execute(context);
fail(
- "Execution should throw an exception when no properties are set.");
- }
- catch (IllegalStateException e) {
+ "Execution should throw an exception when no properties are set.");
+ } catch (IllegalStateException e) {
; // expected.
}
}
public void testCopyToDefaultContextKey()
- throws Exception {
+ throws Exception {
CopyFormToContext command = new CopyFormToContext();
String formName = "foo";
@@ -234,7 +231,7 @@
assertNull(context.getSessionScope().get(formName));
assertSame(context.getActionForm(),
- context.getRequestScope().get(formName));
+ context.getRequestScope().get(formName));
ActionForm theForm = (ActionForm) context.getActionForm();
Modified: struts/action/trunk/src/test/org/apache/struts/chain/commands/generic/TestWrappingLookupCommand.java
URL: http://svn.apache.org/viewcvs/struts/action/trunk/src/test/org/apache/struts/chain/commands/generic/TestWrappingLookupCommand.java?rev=376714&r1=376713&r2=376714&view=diff
==============================================================================
--- struts/action/trunk/src/test/org/apache/struts/chain/commands/generic/TestWrappingLookupCommand.java (original)
+++ struts/action/trunk/src/test/org/apache/struts/chain/commands/generic/TestWrappingLookupCommand.java Fri Feb 10 06:50:57 2006
@@ -18,13 +18,13 @@
package org.apache.struts.chain.commands.generic;
import junit.framework.TestCase;
+
import org.apache.commons.chain.Context;
import org.apache.commons.chain.impl.ContextBase;
import org.apache.commons.chain.web.servlet.ServletWebContext;
import org.apache.struts.chain.contexts.ServletActionContext;
/* JUnitTest case for class: org.apache.struts.chain.commands.generic.WrappingLookupCommand */
-
public class TestWrappingLookupCommand extends TestCase {
public TestWrappingLookupCommand(String _name) {
super(_name);
@@ -49,7 +49,7 @@
}
public void testWrapContextSubclass()
- throws Exception {
+ throws Exception {
WrappingLookupCommand command = new WrappingLookupCommand();
command.setWrapperClassName(ServletActionContext.class.getName());
@@ -64,7 +64,7 @@
/* Executes the test case */
public static void main(String[] argv) {
- String[] testCaseList = {TestWrappingLookupCommand.class.getName()};
+ String[] testCaseList = { TestWrappingLookupCommand.class.getName() };
junit.textui.TestRunner.main(testCaseList);
}
Modified: struts/action/trunk/src/test/org/apache/struts/chain/commands/servlet/TestAuthorizeAction.java
URL: http://svn.apache.org/viewcvs/struts/action/trunk/src/test/org/apache/struts/chain/commands/servlet/TestAuthorizeAction.java?rev=376714&r1=376713&r2=376714&view=diff
==============================================================================
--- struts/action/trunk/src/test/org/apache/struts/chain/commands/servlet/TestAuthorizeAction.java (original)
+++ struts/action/trunk/src/test/org/apache/struts/chain/commands/servlet/TestAuthorizeAction.java Fri Feb 10 06:50:57 2006
@@ -1,6 +1,7 @@
package org.apache.struts.chain.commands.servlet;
import junit.framework.TestCase;
+
import org.apache.commons.chain.web.servlet.ServletWebContext;
import org.apache.struts.chain.commands.UnauthorizedActionException;
import org.apache.struts.chain.contexts.ServletActionContext;
@@ -13,7 +14,6 @@
import org.apache.struts.mock.MockServletContext;
/* JUnitTest case for class: org.apache.struts.chain.commands.servlet.AuthorizeAction */
-
public class TestAuthorizeAction extends TestCase {
MockHttpServletRequest request = null;
MockPrincipal principal = null;
@@ -28,18 +28,19 @@
/* setUp method for test case */
protected void setUp() throws Exception {
this.request = new MockHttpServletRequest();
- this.principal = new MockPrincipal("Mr. Macri",
- new String[]{"administrator"});
+ this.principal =
+ new MockPrincipal("Mr. Macri", new String[] { "administrator" });
this.request.setUserPrincipal(principal);
MockServletConfig servletConfig = new MockServletConfig();
MockServletContext servletContext = new MockServletContext();
- MockActionServlet servlet = new MockActionServlet(servletContext,
- servletConfig);
+ MockActionServlet servlet =
+ new MockActionServlet(servletContext, servletConfig);
servlet.initInternal();
- this.saContext = new ServletActionContext(servletContext, request,
+ this.saContext =
+ new ServletActionContext(servletContext, request,
new MockHttpServletResponse());
this.saContext.setActionServlet(servlet);
@@ -51,7 +52,7 @@
}
public void testAuthorizeOneRole()
- throws Exception {
+ throws Exception {
ActionConfig config = new ActionConfig();
config.setPath("/testAuthorizeOneRole");
@@ -64,7 +65,7 @@
}
public void testAuthorizeOneOfManyRoles()
- throws Exception {
+ throws Exception {
ActionConfig config = new ActionConfig();
config.setPath("/testAuthorizeOneOfManyRoles");
@@ -77,7 +78,7 @@
}
public void testAuthorizeNoRoles()
- throws Exception {
+ throws Exception {
ActionConfig config = new ActionConfig();
config.setPath("/testAuthorizeNoRoles");
@@ -89,7 +90,7 @@
}
public void testNotAuthorizedOneRole()
- throws Exception {
+ throws Exception {
ActionConfig config = new ActionConfig();
config.setPath("/testNotAuthorizedOneRole");
@@ -98,13 +99,12 @@
try {
boolean result = command.execute(saContext);
- }
- catch (UnauthorizedActionException ex) {
+ } catch (UnauthorizedActionException ex) {
}
}
public void testNotAuthorizedOneOfManyRoles()
- throws Exception {
+ throws Exception {
ActionConfig config = new ActionConfig();
config.setPath("/testNotAuthorizedOneOfManyRoles");
@@ -113,14 +113,13 @@
try {
boolean result = command.execute(saContext);
- }
- catch (UnauthorizedActionException ex) {
+ } catch (UnauthorizedActionException ex) {
}
}
/* Executes the test case */
public static void main(String[] argv) {
- String[] testCaseList = {TestAuthorizeAction.class.getName()};
+ String[] testCaseList = { TestAuthorizeAction.class.getName() };
junit.textui.TestRunner.main(testCaseList);
}
Modified: struts/action/trunk/src/test/org/apache/struts/chain/commands/servlet/TestPerformForward.java
URL: http://svn.apache.org/viewcvs/struts/action/trunk/src/test/org/apache/struts/chain/commands/servlet/TestPerformForward.java?rev=376714&r1=376713&r2=376714&view=diff
==============================================================================
--- struts/action/trunk/src/test/org/apache/struts/chain/commands/servlet/TestPerformForward.java (original)
+++ struts/action/trunk/src/test/org/apache/struts/chain/commands/servlet/TestPerformForward.java Fri Feb 10 06:50:57 2006
@@ -1,6 +1,7 @@
package org.apache.struts.chain.commands.servlet;
import junit.framework.TestCase;
+
import org.apache.commons.chain.web.servlet.ServletWebContext;
import org.apache.struts.chain.contexts.ServletActionContext;
import org.apache.struts.config.ForwardConfig;
@@ -12,7 +13,6 @@
import org.apache.struts.mock.MockServletContext;
/* JUnitTest case for class: org.apache.struts.chain.commands.servlet.PerformForward */
-
public class TestPerformForward extends TestCase {
MockHttpServletRequest request = null;
MockPrincipal principal = null;
@@ -27,18 +27,19 @@
/* setUp method for test case */
protected void setUp() throws Exception {
this.request = new MockHttpServletRequest();
- this.principal = new MockPrincipal("Mr. Macri",
- new String[]{"administrator"});
+ this.principal =
+ new MockPrincipal("Mr. Macri", new String[] { "administrator" });
this.request.setUserPrincipal(principal);
MockServletConfig servletConfig = new MockServletConfig();
MockServletContext servletContext = new MockServletContext();
- MockActionServlet servlet = new MockActionServlet(servletContext,
- servletConfig);
+ MockActionServlet servlet =
+ new MockActionServlet(servletContext, servletConfig);
servlet.initInternal();
- this.saContext = new ServletActionContext(servletContext, request,
+ this.saContext =
+ new ServletActionContext(servletContext, request,
new MockHttpServletResponse());
this.saContext.setActionServlet(servlet);
@@ -50,7 +51,7 @@
}
public void testNullForwardPath()
- throws Exception {
+ throws Exception {
ForwardConfig config = new ForwardConfig();
config.setPath(null);
@@ -58,9 +59,8 @@
try {
command.perform(saContext, config);
fail(
- "Didn't throw an illegal argument exception on null forward path");
- }
- catch (IllegalArgumentException ex) {
+ "Didn't throw an illegal argument exception on null forward path");
+ } catch (IllegalArgumentException ex) {
System.out.println("exception: " + ex.getMessage());
// Do nothing, the test passed
@@ -69,7 +69,7 @@
/* Executes the test case */
public static void main(String[] argv) {
- String[] testCaseList = {TestPerformForward.class.getName()};
+ String[] testCaseList = { TestPerformForward.class.getName() };
junit.textui.TestRunner.main(testCaseList);
}
Modified: struts/action/trunk/src/test/org/apache/struts/chain/commands/servlet/TestSetOriginalURI.java
URL: http://svn.apache.org/viewcvs/struts/action/trunk/src/test/org/apache/struts/chain/commands/servlet/TestSetOriginalURI.java?rev=376714&r1=376713&r2=376714&view=diff
==============================================================================
--- struts/action/trunk/src/test/org/apache/struts/chain/commands/servlet/TestSetOriginalURI.java (original)
+++ struts/action/trunk/src/test/org/apache/struts/chain/commands/servlet/TestSetOriginalURI.java Fri Feb 10 06:50:57 2006
@@ -1,6 +1,7 @@
package org.apache.struts.chain.commands.servlet;
import junit.framework.TestCase;
+
import org.apache.struts.Globals;
import org.apache.struts.chain.contexts.ServletActionContext;
import org.apache.struts.mock.MockActionServlet;
@@ -10,7 +11,6 @@
import org.apache.struts.mock.MockServletContext;
/* JUnitTest case for class: org.apache.struts.chain.commands.servlet.SetOriginalURI */
-
public class TestSetOriginalURI extends TestCase {
SetOriginalURI command = null;
@@ -28,19 +28,19 @@
}
public void testSetOriginalURI()
- throws Exception {
- MockHttpServletRequest request = new MockHttpServletRequest("foo/",
- "bar.do", null, null);
+ throws Exception {
+ MockHttpServletRequest request =
+ new MockHttpServletRequest("foo/", "bar.do", null, null);
MockServletConfig servletConfig = new MockServletConfig();
MockServletContext servletContext = new MockServletContext();
- MockActionServlet servlet = new MockActionServlet(servletContext,
- servletConfig);
+ MockActionServlet servlet =
+ new MockActionServlet(servletContext, servletConfig);
servlet.initInternal();
ServletActionContext saContext =
- new ServletActionContext(servletContext,
- request, new MockHttpServletResponse());
+ new ServletActionContext(servletContext, request,
+ new MockHttpServletResponse());
saContext.setActionServlet(servlet);
@@ -59,7 +59,7 @@
/* Executes the test case */
public static void main(String[] argv) {
- String[] testCaseList = {TestSetOriginalURI.class.getName()};
+ String[] testCaseList = { TestSetOriginalURI.class.getName() };
junit.textui.TestRunner.main(testCaseList);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org