* This file is part of Ebean. - * + *
* Ebean is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. - * + *
* Ebean is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. - * + *
* You should have received a copy of the GNU Lesser General Public License * along with Ebean; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA @@ -31,47 +31,27 @@ import javax.persistence.OneToOne; @Entity public class Account { - /** The oid. */ - @Id - private long oid; + /** The id. */ + @Id + private Long id; - /** The user. */ - @OneToOne - private User user; + /** The user. */ + @OneToOne + private User user; - /** - * Gets the oid. - * - * @return the oid - */ - public long getOid() { - return oid; - } + public Long getId() { + return id; + } - /** - * Sets the oid. - * - * @param oid the oid to set - */ - public void setOid(long oid) { - this.oid = oid; - } + public void setId(Long id) { + this.id = id; + } - /** - * Gets the user. - * - * @return the user - */ - public User getUser() { - return user; - } + public User getUser() { + return user; + } - /** - * Sets the user. - * - * @param user the user to set - */ - public void setUser(User user) { - this.user = user; - } + public void setUser(User user) { + this.user = user; + } } diff --git a/src/test/java/com/avaje/test/springsupport/EbeanSpringModuleTest.java b/src/test/java/com/avaje/test/springsupport/EbeanSpringModuleTest.java index 2eecfd646..54f50f495 100644 --- a/src/test/java/com/avaje/test/springsupport/EbeanSpringModuleTest.java +++ b/src/test/java/com/avaje/test/springsupport/EbeanSpringModuleTest.java @@ -1,18 +1,18 @@ /** * Copyright (C) 2009 the original author or authors - * + *
* This file is part of Ebean. - * + *
* Ebean is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. - * + *
* Ebean is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. - * + *
* You should have received a copy of the GNU Lesser General Public License * along with Ebean; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA @@ -25,74 +25,79 @@ import static org.junit.Assert.assertTrue; import java.util.logging.Logger; import org.junit.Test; +import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; /** * Unit test for Ebean Spring Module. * @since 18.05.2009 * @author E Mc Greal */ -@ContextConfiguration(locations={"/init-database.xml"}) -public class EbeanSpringModuleTest extends AbstractJUnit4SpringContextTests { +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(locations = {"/init-database.xml"}) +public class EbeanSpringModuleTest { - /** The Constant logger. */ - private final static Logger logger = Logger.getLogger(EbeanSpringModuleTest.class.getName()); + /** The Constant logger. */ + private final static Logger logger = Logger.getLogger(EbeanSpringModuleTest.class.getName()); - /** The user service. */ - @Autowired - private UserService userService; + /** The user service. */ + @Autowired + private UserService userService; - /** - * Create the test case. - */ - public EbeanSpringModuleTest(){ - super(); - } + /** + * Create the test case. + */ + public EbeanSpringModuleTest() { + super(); + } - /** - * Test app. - */ - @Test - public void testSaveUser(){ - logger.info("Saving new User..."); - User user = new User(); - user.setName("ebean"); - userService.save(user); - logger.info("Saved new User"); - } + @Test + public void testBatchInsert() { - /** - * Test app. - */ - @Test - public void testFindUser(){ - logger.info("Finding User with OID = 1 ..."); - User user = userService.find(1); + userService.batchInsert(); + } - assertNotNull(user); - assertTrue("ebean".equals(user.getName())); - logger.info("Found User with OID = 1"); - } + /** + * Test app. + */ + @Test + public void testSaveUser() { + logger.info("Saving new User..."); + User user = new User(); + user.setName("ebean"); + userService.save(user); + logger.info("Saved new User"); + } - /** - * Gets the user service. - * - * @return the userService - */ - public UserService getUserService() { - return userService; - } + /** + * Test app. + */ + @Test + public void testFindUser() { + logger.info("Finding User with OID = 1 ..."); + User user = userService.find(1); + + assertNotNull(user); + assertTrue("ebean".equals(user.getName())); + logger.info("Found User with OID = 1"); + } + + /** + * Return the user service. + */ + public UserService getUserService() { + return userService; + } - /** - * Sets the user service. - * - * @param userService the userService to set - */ - public void setUserService(UserService userService) { - this.userService = userService; - } + /** + * Sets the user service. + */ + public void setUserService(UserService userService) { + this.userService = userService; + } } diff --git a/src/test/java/com/avaje/test/springsupport/Role.java b/src/test/java/com/avaje/test/springsupport/Role.java index e6fed39d2..02381291e 100644 --- a/src/test/java/com/avaje/test/springsupport/Role.java +++ b/src/test/java/com/avaje/test/springsupport/Role.java @@ -1,18 +1,18 @@ /** * Copyright (C) 2009 the original author or authors - * + *
* This file is part of Ebean. - * + *
* Ebean is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. - * + *
* Ebean is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. - * + *
* You should have received a copy of the GNU Lesser General Public License
* along with Ebean; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
@@ -34,40 +34,28 @@ import javax.persistence.ManyToMany;
*/
@Entity
public class Role {
- @Id
- long oid;
- @ManyToMany
- private Set