Raible's Wiki

Raible Designs
Wiki Home
News
Recent Changes

AppFuse

Homepage
  - Korean
  - Chinese
  - Italian
  - Japanese

QuickStart Guide
  - Chinese
  - French
  - German
  - Italian
  - Korean
  - Portuguese
  - Spanish
  - Japanese

User Guide
  - Korean
  - Chinese

Tutorials
  - Chinese
  - German
  - Italian
  - Korean
  - Portuguese
  - Spanish

FAQ
  - Korean

Latest Downloads

Other Applications

Struts Resume
Security Example
Struts Menu

Set your name in
UserPreferences


Referenced by
Main
TextFormattingRules
WhatIsWiki




JSPWiki v2.2.33

[RSS]


Hide Menu

SandBox


Difference between version 318 and version 222:

At line 1 changed 1 line.
[{Java2HtmlPlugin
[this mailing list thread|http://nagoya.apache.org/eyebrowse/[email protected]&msgNo=451].
At line 3 changed 6 lines.
public class UserWebTest extends WebTestCase {
public UserWebTest(String name) {
super(name);
getTestContext().setBaseUrl("http://localhost:8080/myusers");
}
[What is this SandBox?|WhatIsThisSandBox]
At line 10 changed 2 lines.
// should there be a setup method that adds a user
// before each test/method is called?
[{Java2HtmlPlugin
At line 13 changed 19 lines.
public void testWelcomePage() {
beginAt("/");
assertTitleEquals("MyUsers ~ Welcome");
}
public void testAddUser() {
beginAt("/editUser.html");
assertTitleEquals("MyUsers ~ User Details");
setFormElement("firstName", "Spring");
setFormElement("lastName", "User");
submit("save");
assertTextPresent("saved successfully");
}
public void testListUsers() {
beginAt("/users.html");
// check that table is present
assertTablePresent("userList");
import javax.naming.Context;
import javax.naming.InitialContext;
At line 33 changed 18 lines.
// check that a set of strings are present somewhere in table
assertTextInTable("userList",
new String[] {"Spring", "User"});
}
public void testEditUser() {
beginAt("/editUser.html?id=1");
assertFormElementEquals("firstName", "Spring");
submit("save");
assertTitleEquals("MyUsers ~ User List");
}
public void testDeleteUser() {
beginAt("/editUser.html?id=1");
assertTitleEquals("MyUsers ~ User Details");
submit("delete");
assertTitleEquals("MyUsers ~ User List");
}
import junit.framework.TestCase;
import org.mockejb.MockContainer;
import org.mockejb.SessionBeanDescriptor;
import org.mockejb.jndi.MockContextFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
/**
* Parent TestCase class for testing EJBs using MockEJB
*
* @author mraible
*
*/
public abstract class MockEJBTestCase extends TestCase {
/**
* This method sets up a MockContainer and allows you to deploy an EJB to
* it. Override <code>onSetUp()</code> to add custom set-up behavior.
*
* @see #onSetUp()
*/
protected final void setUp() throws Exception {
MockContextFactory.setAsInitial();
Context ctx = new InitialContext();
ApplicationContext appCtx =
new ClassPathXmlApplicationContext(getConfigLocations());
ctx.bind("java:comp/env/jdbc/appDS", appCtx.getBean("dataSource"));
MockContainer mc = new MockContainer(ctx);
SessionBeanDescriptor dd = getDeploymentDescriptor();
mc.deploy(dd);
onSetUp();
}
protected String[] getConfigLocations() {
return new String[] { "classpath:/applicationContext.xml" };
}
protected void onSetUp() throws Exception {}
protected abstract SessionBeanDescriptor getDeploymentDescriptor();
At line 55 added 1 line.
At line 54 changed 1 line.
[quaker parrots|http://www.iza.net/1/50-17] [pacific parrotlet|http://www.iza.net/1/52-5] [scarlet macaw|http://www.iza.net/1/50-18] [cockatiels|http://www.iza.net/1/51-7] [blue and gold macaw|http://www.iza.net/1/50-19]
[CreateDAO_zh]
[CreateDAO_sp]
At line 61 added 8 lines.
[CreateManager_es]
[QuickStart Guide_es]
[SpringControllerUnitTest]
[δΈ­ζ–‡ζŒ‡ε—|Articles_zh]

Back to SandBox, or to the Page History.