本文整理汇总了Java中com.opensymphony.xwork2.ActionProxy.execute方法的典型用法代码示例。如果您正苦于以下问题:Java ActionProxy.execute方法的具体用法?Java ActionProxy.execute怎么用?Java ActionProxy.execute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.opensymphony.xwork2.ActionProxy
的用法示例。
在下文中一共展示了ActionProxy.execute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testUpload
import com.opensymphony.xwork2.ActionProxy; //导入方法依赖的package包/类
/**
* This method tests uploading MS. Project file.
* The file path: is set in MS_PROJECT_FILES_PATH constant
*/
@Test
public void testUpload() throws Exception {
File msProjectFolder = new File(MS_PROJECT_FILES_PATH);
File[] listOfFiles = msProjectFolder.listFiles();
for (File fileToUpload : listOfFiles) {
if (fileToUpload.isFile()) {
request.setParameter("uploadFileFileName", fileToUpload.getName());
request.setParameter("projectOrReleaseID", PROJECT_OR_RELEASE_ID.toString());
ActionProxy actionProxy = getActionProxy("/msProjectUpload.action") ;
MsProjectUploadAction action = (MsProjectUploadAction) actionProxy.getAction();
action.setUploadFile(fileToUpload);
actionProxy.getInvocation().getInvocationContext().setSession(sessionMap);
String result = actionProxy.execute();
String responseText = response.getContentAsString();
System.out.println("Test method name: msProjectUpload result: " + result + " response: " + responseText);
assertEquals(result, MsProjectUploadAction.MSPROJECT_IMPORT);
}
}
}
示例2: testExecute
import com.opensymphony.xwork2.ActionProxy; //导入方法依赖的package包/类
/**
* Run the String execute() method test
*/
@Test
public void testExecute() throws Exception{
File msProjectFolder = new File(MS_PROJECT_FILES_PATH);
File[] listOfFiles = msProjectFolder.listFiles();
for (File fileToUpload : listOfFiles) {
if (fileToUpload.isFile()) {
ActionProxy actionProxy = getActionProxy("/msProjectImport.action") ;
actionProxy.getInvocation().getInvocationContext().setSession(sessionMap);
MsProjectImportAction action = (MsProjectImportAction) actionProxy.getAction();
File uploadedFilesLocation = new File(AttachBL.getMsProjectImportDirBase() + PROJECT_OR_RELEASE_ID + "/" + fileToUpload.getName());
Files.copy(fileToUpload, uploadedFilesLocation);
action.setFileName(fileToUpload.getName());
action.setProjectOrReleaseID(PROJECT_OR_RELEASE_ID);
String result = actionProxy.execute();
String responseText = response.getContentAsString();
System.out.println("Test method name: msProjectImport result: " + result + " response: " + responseText);
assertTrue(responseText.length() > 0);
assertNotNull(responseText);
}
}
}
示例3: testExecute_2
import com.opensymphony.xwork2.ActionProxy; //导入方法依赖的package包/类
/**
* Run the String execute() method test.
*
* @throws Exception
*
* @generatedBy CodePro at 05.01.15 23:18
*/
@Test
public void testExecute_2()
throws Exception {
request.setParameter("j_username", "admin");
request.setParameter("password", "tissi");
request.setParameter("testMode", "true");
ActionProxy actionProxy = getActionProxy("/logon!login.action") ;
LogonAction action = (LogonAction) actionProxy.getAction();
assertNotNull("The action is null but should not be.", action);
String result = actionProxy.execute();
// System.err.println(result);
// assertEquals("The execute method did not return " + "forwardToLogin" + " but should have.", "forwardToLogin", result);
assertEquals("The execute method did not return " + "loading" + " but should have.", "loading", result);
}
示例4: testExecute_3
import com.opensymphony.xwork2.ActionProxy; //导入方法依赖的package包/类
/**
* Run the String execute() method test.
*
* @throws Exception
*
* @generatedBy CodePro at 05.01.15 23:18
*/
@Test
public void testExecute_3()
throws Exception {
request.setParameter("j_username", "admin");
request.setParameter("password", "tissi");
request.setParameter("testMode", "");
request.setParameter("isMobileApplication", "true");
request.setParameter("mobileApplicationVersionNo", "2");
ActionProxy actionProxy = getActionProxy("/logon!login.action") ;
LogonAction action = (LogonAction) actionProxy.getAction();
assertNotNull("The action is null but should not be.", action);
String result = actionProxy.execute();
assertEquals("The execute method did not return " + "loading" + " but should have.", "loading", result);
}
示例5: testFailLogin_1
import com.opensymphony.xwork2.ActionProxy; //导入方法依赖的package包/类
/**
* Run the String failLogin() method test.
*
* @throws Exception
*
* @generatedBy CodePro at 05.01.15 23:18
*/
@Test
public void testFailLogin_1()
throws Exception {
request.setParameter("j_username", "admin");
request.setParameter("password", "FFFFF");
request.setParameter("testMode", "true");
request.setParameter("isMobileApplication", "false");
request.setParameter("mobileApplicationVersionNo", "2");
ActionProxy actionProxy = getActionProxy("/logon!login.action") ;
LogonAction action = (LogonAction) actionProxy.getAction();
assertNotNull("The action is null but should not be.", action);
String result = actionProxy.execute();
assertEquals("The execute method did not return " + "loading" + " but should have.", "loading", result);
}
示例6: testSanity
import com.opensymphony.xwork2.ActionProxy; //导入方法依赖的package包/类
@Test
public void testSanity() throws Exception{
//pre requirements
request.setParameter("xml", "this is the xml");
//kinda of replay()
ActionProxy proxy = getActionProxy("/testing");
Testing testingAction = (Testing) proxy.getAction();
String result = proxy.execute();
assertEquals("XML entered should be the same in SESSION after execution", "this is the xml", request.getSession().getAttribute("xml"));
assertEquals("XML entered should be the same after execution", "this is the xml", testingAction.getXml());
assertNotNull("Request attribute 'res' shouldn't be null", request.getAttribute("res"));
assertTrue("There shouldn't be any field error.", testingAction.getFieldErrors().size() == 0);
assertEquals("Result returned when there is an XML should have been 'null'.", null, result);
//assertTrue("Problem field account.userName not present in fieldErrors but it should have been",
// testingAction.getFieldErrors().containsKey("xml") );
}
示例7: testNotActionFlowAction
import com.opensymphony.xwork2.ActionProxy; //导入方法依赖的package包/类
@Test
public void testNotActionFlowAction() throws Exception {
final Integer stepCount = 1;
ActionProxy ap = getActionProxy("/correctFlow/correctFlow");
Assert.assertNotNull(ap);
Assert.assertNotNull(ap.getAction());
Assert.assertTrue(ap.getAction() instanceof MockActionFlowAction);
Assert.assertTrue(ap.getAction() instanceof ActionFlowStepsAware);
MockActionFlowAction action = (MockActionFlowAction) ap.getAction();
ap.getInvocation().getInvocationContext()
.setSession(new HashMap<String, Object>());
ap.execute();
Assert.assertNotNull(action.getStepsData());
Assert.assertEquals(new Integer(1), action.getStepsData().getSteps()
.firstKey());
Assert.assertEquals(stepCount, action.getStepsData().getStepIndex());
}
示例8: testMsProjectUploadRender
import com.opensymphony.xwork2.ActionProxy; //导入方法依赖的package包/类
/**
* This method tests returning project tree as target form import.
*When importing was executed from toolbar menu not from drag drop.
*/
@Test
public void testMsProjectUploadRender() throws Exception {
ActionProxy actionProxy = getActionProxy("/msProjectUploadRender.action") ;
actionProxy.getInvocation().getInvocationContext().setSession(sessionMap);
String result = actionProxy.execute();
String responseText = response.getContentAsString();
System.out.println("Test method name: msProjectUploadRender result: " + result + " response: " + responseText);
assertNotNull(responseText);
assertTrue(responseText.length() > 0);
}
示例9: testExecute_1
import com.opensymphony.xwork2.ActionProxy; //导入方法依赖的package包/类
/**
* Run the String execute() method test.
*
* @throws Exception
*
* @generatedBy CodePro at 05.01.15 23:18
*/
@Test
public void testExecute_1()
throws Exception {
request.setParameter("j_username", "XXX");
request.setParameter("password", "XXX");
request.setParameter("testMode", "true");
ActionProxy actionProxy = getActionProxy("/logon!login.action") ;
LogonAction action = (LogonAction) actionProxy.getAction();
assertNotNull("The action is null but should not be.", action);
String result = actionProxy.execute();
assertEquals("The execute method did not return " + "loading" + " but should have.", "loading", result);
}
示例10: testExecute_1_1
import com.opensymphony.xwork2.ActionProxy; //导入方法依赖的package包/类
@Test
public void testExecute_1_1()
throws Exception {
request.setParameter("j_username", "");
request.setParameter("password", "");
request.setParameter("testMode", "");
ActionProxy actionProxy = getActionProxy("/logon.action") ;
LogonAction action = (LogonAction) actionProxy.getAction();
assertNotNull("The action is null but should not be.", action);
String result = actionProxy.execute();
assertEquals("The execute method did not return " + "forwardToLogin" + " but should have.", "forwardToLogin", result);
}
示例11: testInputResult
import com.opensymphony.xwork2.ActionProxy; //导入方法依赖的package包/类
@Test
public void testInputResult() throws Exception {
executeAction("/correctFlow/correctFlow");
initServletMockObjects();
final Integer stepCount = 2;
// for the input result
request.setParameter("date", "errorrr");
ActionProxy ap = getActionProxy("/correctFlow/savePhone-2");
Assert.assertNotNull(ap);
Assert.assertNotNull(ap.getAction());
Assert.assertTrue(ap.getAction() instanceof MockActionFlowAction);
Assert.assertTrue(ap.getAction() instanceof ActionFlowStepsAware);
MockActionFlowAction action = (MockActionFlowAction) ap.getAction();
Map<String, Object> sessionMap = new HashMap<String, Object>();
sessionMap.put(TestConstants.PREVIOUS_FLOW_ACTION, "saveName-1");
sessionMap.put(TestConstants.HIGHEST_CURRENT_ACTION_INDEX, 3);
ap.getInvocation().getInvocationContext().setSession(sessionMap);
String resultCode = ap.execute();
Assert.assertEquals(Action.INPUT, resultCode);
Assert.assertNotNull(action.getStepsData());
Assert.assertEquals(stepCount, action.getStepsData().getStepIndex());
}
示例12: testGettingFromScopeInViewAction
import com.opensymphony.xwork2.ActionProxy; //导入方法依赖的package包/类
/**
* Tests getting values from scope.
*
* @throws Exception
* When something goes wrong.
*/
@Test
public void testGettingFromScopeInViewAction() throws Exception {
executeAction("/correctFlow/correctFlow");
initServletMockObjects();
final String value = "phoneFromFlowScope";
ActionProxy ap = getActionProxy("/correctFlow/savePhone-2View");
Assert.assertNotNull(ap);
Assert.assertNotNull(ap.getAction());
Assert.assertTrue(ap.getAction() instanceof MockActionFlowAction);
Assert.assertTrue(MockActionFlowAction.class
.isAnnotationPresent(ActionFlowScope.class));
MockActionFlowAction action = (MockActionFlowAction) ap.getAction();
Map<String, Object> sessionMap = new HashMap<String, Object>();
Map<String, Object> scopeMap = new HashMap<String, Object>();
// key for 'phone' field
final String key = MockActionFlowAction.mockPropertyDescriptorPhone()
.getReadMethod().toString();
scopeMap.put(key, value);
sessionMap.put(TestConstants.FLOW_SCOPE_KEY, scopeMap);
ap.getInvocation().getInvocationContext().setSession(sessionMap);
ap.execute();
Assert.assertEquals(value, action.getPhone());
}
示例13: testGettingFromScopeInFlowAction
import com.opensymphony.xwork2.ActionProxy; //导入方法依赖的package包/类
/**
* Tests getting values from scope.
*
* @throws Exception
* When something goes wrong.
*/
@Test
public void testGettingFromScopeInFlowAction() throws Exception {
executeAction("/correctFlow/correctFlow");
initServletMockObjects();
final String value = "phoneFromFlowScope";
ActionProxy ap = getActionProxy("/correctFlow/saveEmail-3");
Assert.assertNotNull(ap);
Assert.assertNotNull(ap.getAction());
Assert.assertTrue(ap.getAction() instanceof MockActionFlowAction);
Assert.assertTrue(MockActionFlowAction.class
.isAnnotationPresent(ActionFlowScope.class));
MockActionFlowAction action = (MockActionFlowAction) ap.getAction();
Map<String, Object> sessionMap = new HashMap<String, Object>();
Map<String, Object> scopeMap = new HashMap<String, Object>();
// key for 'phone' field
final String key = MockActionFlowAction.mockPropertyDescriptorPhone()
.getReadMethod().toString();
scopeMap.put(key, value);
sessionMap.put(TestConstants.FLOW_SCOPE_KEY, scopeMap);
ap.getInvocation().getInvocationContext().setSession(sessionMap);
ap.execute();
Assert.assertEquals(value, action.getPhone());
}
示例14: testSettingToScope
import com.opensymphony.xwork2.ActionProxy; //导入方法依赖的package包/类
/**
* Tests setting values to scope.
*
* @throws Exception
* When something goes wrong.
*/
@SuppressWarnings("unchecked")
@Test
public void testSettingToScope() throws Exception {
executeAction("/correctFlow/correctFlow");
initServletMockObjects();
final String value = "phoneFromFlowScope";
ActionProxy ap = getActionProxy("/correctFlow/savePhone-2");
Assert.assertNotNull(ap);
Assert.assertNotNull(ap.getAction());
Assert.assertTrue(ap.getAction() instanceof MockActionFlowAction);
Assert.assertTrue(MockActionFlowAction.class
.isAnnotationPresent(ActionFlowScope.class));
MockActionFlowAction action = (MockActionFlowAction) ap.getAction();
action.setPhone(value);
Map<String, Object> sessionMap = new HashMap<String, Object>();
sessionMap.put(TestConstants.PREVIOUS_FLOW_ACTION, "saveName-1");
sessionMap.put(TestConstants.HIGHEST_CURRENT_ACTION_INDEX, 2);
ap.getInvocation().getInvocationContext().setSession(sessionMap);
ap.execute();
Assert.assertNotNull(sessionMap.get(TestConstants.FLOW_SCOPE_KEY));
Assert.assertTrue(sessionMap.get(TestConstants.FLOW_SCOPE_KEY) instanceof Map);
Assert.assertTrue(((Map<String, Object>) sessionMap
.get(TestConstants.FLOW_SCOPE_KEY)).containsValue(value));
}
示例15: testClearFlowScopeStart
import com.opensymphony.xwork2.ActionProxy; //导入方法依赖的package包/类
/**
* Tests clearing scope on start.
*
* @throws Exception
* When something goes wrong.
*/
@Test
public void testClearFlowScopeStart() throws Exception {
executeAction("/correctFlow/correctFlow");
initServletMockObjects();
executeAction("/correctFlow/next");
initServletMockObjects();
final String immutableValue = "immutableValue";
ActionProxy ap = getActionProxy("/correctFlow/correctFlow");
Assert.assertNotNull(ap);
Assert.assertNotNull(ap.getAction());
Assert.assertTrue(ap.getAction() instanceof MockActionFlowAction);
MockActionFlowAction action = (MockActionFlowAction) ap.getAction();
action.setPhone("someValue");
Map<String, Object> sessionMap = new HashMap<String, Object>();
sessionMap.put(immutableValue, immutableValue);
sessionMap.put(TestConstants.PREVIOUS_FLOW_ACTION, "savePhone-2");
sessionMap.put(TestConstants.FLOW_SCOPE_KEY,
new HashMap<String, Object>());
ap.getInvocation().getInvocationContext().setSession(sessionMap);
ap.execute();
Assert.assertEquals(null,
sessionMap.get(TestConstants.PREVIOUS_FLOW_ACTION));
Assert.assertNull(sessionMap.get(TestConstants.FLOW_SCOPE_KEY));
Assert.assertEquals(immutableValue, sessionMap.get(immutableValue));
}