From db816594c5bc8448f6ea9374b55b64faec2314b9 Mon Sep 17 00:00:00 2001 From: Rob Bygrave Date: Fri, 23 Feb 2018 10:50:51 +1300 Subject: [PATCH] No effective change - tidy tests --- src/test/java/org/example/Account.java | 26 ---------------- .../org/example/EbeanServerFactoryBean.java | 19 ------------ .../org/example/EbeanSpringModuleTest.java | 28 ++++------------- src/test/java/org/example/Role.java | 25 --------------- src/test/java/org/example/User.java | 31 ++++--------------- .../java/org/example/UserServiceImpl.java | 20 ------------ src/test/resources/logback-test.xml | 2 +- 7 files changed, 13 insertions(+), 138 deletions(-) diff --git a/src/test/java/org/example/Account.java b/src/test/java/org/example/Account.java index 944602524..6caf527e3 100644 --- a/src/test/java/org/example/Account.java +++ b/src/test/java/org/example/Account.java @@ -1,41 +1,15 @@ -/** - * 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 - */ package org.example; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.OneToOne; -/** - * The Class Account. - * @since 18.05.2009 - * @author E Mc Greal - */ @Entity public class Account { - /** The id. */ @Id private Long id; - /** The user. */ @OneToOne private User user; diff --git a/src/test/java/org/example/EbeanServerFactoryBean.java b/src/test/java/org/example/EbeanServerFactoryBean.java index 295e5e90b..b5dc172ea 100644 --- a/src/test/java/org/example/EbeanServerFactoryBean.java +++ b/src/test/java/org/example/EbeanServerFactoryBean.java @@ -1,22 +1,3 @@ -/** - * 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 - */ package org.example; import org.springframework.beans.factory.FactoryBean; diff --git a/src/test/java/org/example/EbeanSpringModuleTest.java b/src/test/java/org/example/EbeanSpringModuleTest.java index 54b1485af..58dcfd96d 100644 --- a/src/test/java/org/example/EbeanSpringModuleTest.java +++ b/src/test/java/org/example/EbeanSpringModuleTest.java @@ -1,30 +1,13 @@ -/** - * 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 - */ package org.example; -import java.util.logging.Logger; import org.junit.Test; import org.junit.runner.RunWith; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; @@ -38,7 +21,7 @@ import static org.junit.Assert.assertTrue; public class EbeanSpringModuleTest { /** The Constant logger. */ - private final static Logger logger = Logger.getLogger(EbeanSpringModuleTest.class.getName()); + private final static Logger logger = LoggerFactory.getLogger(EbeanSpringModuleTest.class); /** The user service. */ @Autowired @@ -93,7 +76,8 @@ public class EbeanSpringModuleTest { public void testFindNonTransactional() { logger.info("Finding User with OID = 1 ..."); User user = userService.find(1); - logger.info("nonTransactional find " + user); + User user2 = userService.findNoCurrentTransaction(2); + logger.info("nonTransactional find user1:{} user2:{}", user, user2); } /** diff --git a/src/test/java/org/example/Role.java b/src/test/java/org/example/Role.java index 41239de62..4f0a9434a 100644 --- a/src/test/java/org/example/Role.java +++ b/src/test/java/org/example/Role.java @@ -1,23 +1,3 @@ -/** - * 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 - */ - package org.example; import java.util.Set; @@ -25,11 +5,6 @@ import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.ManyToMany; -/** - * The Class Role. - * @since 18.05.2009 - * @author E Mc Greal - */ @Entity public class Role { diff --git a/src/test/java/org/example/User.java b/src/test/java/org/example/User.java index ec7bc2a1b..4cc235a9c 100644 --- a/src/test/java/org/example/User.java +++ b/src/test/java/org/example/User.java @@ -1,22 +1,3 @@ -/** - * 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 - */ package org.example; import javax.persistence.Entity; @@ -25,13 +6,9 @@ import javax.persistence.ManyToMany; import javax.persistence.OneToOne; import java.util.Set; -/** - * The Class User. - * @since 18.05.2009 - * @author E Mc Greal - */ @Entity public class User { + @Id long oid; @@ -40,9 +17,13 @@ public class User { @ManyToMany private Set roles; - @OneToOne(mappedBy="user") + @OneToOne(mappedBy = "user") private Account account; + public String toString() { + return "{user:" + oid + " name:" + name + "}"; + } + public long getOid() { return oid; } diff --git a/src/test/java/org/example/UserServiceImpl.java b/src/test/java/org/example/UserServiceImpl.java index ccd6764ea..3e3b42dab 100644 --- a/src/test/java/org/example/UserServiceImpl.java +++ b/src/test/java/org/example/UserServiceImpl.java @@ -1,23 +1,3 @@ -/** - * 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 - */ - package org.example; import io.ebean.Transaction; diff --git a/src/test/resources/logback-test.xml b/src/test/resources/logback-test.xml index e096c77e4..9bc1e1fa3 100644 --- a/src/test/resources/logback-test.xml +++ b/src/test/resources/logback-test.xml @@ -8,7 +8,7 @@ - +