use of model.Team in project jSqlBox by drinkjava2.
the class TeamControllerTest method test_team_listBigger.
// Test from show method
@Test
public void test_team_listBigger() {
MockPageContext mockPC = new MockPageContext();
mockPC.setPathParams("10");
team_list_bigger box = BeanBox.getPrototypeBean(team_list_bigger.class);
box.show(mockPC);
Assert.assertEquals(3, ((List<Team>) mockPC.getRequestAttribute("teams")).size());
Assert.assertEquals(box.getPage(), "/WEB-INF/pages/team_list.jsp");
}
use of model.Team in project jSqlBox by drinkjava2.
the class TeamControllerTest method test_team_equal.
// Test from dispatcher
@Test
public void test_team_equal() throws Exception {
MockPageContext mockPC = new MockPageContext();
mockPC.setRequestURI("/team/list_equal/10.html");
Dispatcher.dispach(mockPC);
Assert.assertEquals(1, ((List<Team>) mockPC.getRequestAttribute("teams")).size());
}
use of model.Team in project jSqlBox by drinkjava2.
the class Initializer method contextInitialized.
@Override
public void contextInitialized(ServletContextEvent context) {
// Initialize BeanBox
BeanBox.regAopAroundAnnotation(TX.class, TxBox.class);
BeanBox.regAopAroundAnnotation(Transaction.class, TxBox.class);
// Initialize Global SqlBoxContext
SqlBoxContextConfig config = new SqlBoxContextConfig();
config.setConnectionManager(TinyTxConnectionManager.instance());
SqlBoxContext ctx = new SqlBoxContext((DataSource) BeanBox.getBean(DataSourceBox.class), config);
SqlBoxContext.setGlobalSqlBoxContext(ctx);
// Initialize database
String[] ddls = ctx.toDropAndCreateDDL(Team.class);
for (String ddl : ddls) ctx.quiteExecute(ddl);
for (int i = 0; i < 5; i++) new Team().put("name", "Team" + i, "rating", i * 10).insert();
Assert.assertEquals(5, ctx.nQueryForLongValue("select count(*) from teams"));
System.out.println("========== com.jsqlboxdemo.init.Initializer initialized=====");
}
Aggregations