From 68d5b4b6b8037da030673633707d6f171c920cc5 Mon Sep 17 00:00:00 2001 From: mikemirzayanov Date: Fri, 22 Mar 2024 15:44:00 +0300 Subject: [PATCH] Deleted demo subproject --- demo/pom.xml | 49 ------------- .../java/com/jacuzzi/test/JacuzziTest.java | 72 ------------------- .../java/com/jacuzzi/test/dao/UserDao.java | 54 -------------- .../java/com/jacuzzi/test/model/User.java | 28 -------- 4 files changed, 203 deletions(-) delete mode 100644 demo/pom.xml delete mode 100644 demo/src/test/java/com/jacuzzi/test/JacuzziTest.java delete mode 100644 demo/src/test/java/com/jacuzzi/test/dao/UserDao.java delete mode 100644 demo/src/test/java/com/jacuzzi/test/model/User.java diff --git a/demo/pom.xml b/demo/pom.xml deleted file mode 100644 index 9fe4690..0000000 --- a/demo/pom.xml +++ /dev/null @@ -1,49 +0,0 @@ - - 4.0.0 - jacuzzi - jacuzzi-demo - jar - 0.0.28-SNAPSHOT - jacuzzi-demo - http://code.google.com/p/jacuzzi - - - The GNU General Public License, Version 2 - http://www.gnu.org/licenses/gpl.txt - repo - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 2.0.2 - - 1.8 - 1.8 - - - - - - - jacuzzi - jacuzzi - 0.1.0-SNAPSHOT - test - - - junit - junit - 3.8.1 - test - - - mysql - mysql-connector-java - 5.1.27 - - - diff --git a/demo/src/test/java/com/jacuzzi/test/JacuzziTest.java b/demo/src/test/java/com/jacuzzi/test/JacuzziTest.java deleted file mode 100644 index d153535..0000000 --- a/demo/src/test/java/com/jacuzzi/test/JacuzziTest.java +++ /dev/null @@ -1,72 +0,0 @@ -/* Copyright by Mike Mirzayanov. */ - -package com.jacuzzi.test; - -import junit.framework.TestCase; -import com.jacuzzi.test.dao.UserDao; -import com.jacuzzi.test.model.User; - -/** @author Mike Mirzayanov */ -public class JacuzziTest extends TestCase { - private UserDao userDao; - private static final int ITERATION_COUNT = 20; - - protected void setUp() { - userDao = new UserDao(); - userDao.createStorage(); - } - - protected void tearDown() { - userDao.deleteStorage(); - } - - public void testInitialization() { - // No operations. - } - - public void testInsertAndFind() { - User user = new User(); - user.setLogin("jacuzzi"); - userDao.insert(user); - assertEquals(1, userDao.findBy("login=?", "jacuzzi").size()); - } - - public void testManyInsertsAndFinds() { - for (int i = 0; i < ITERATION_COUNT; i++) { - User user = new User(); - user.setLogin("jacuzzi" + i); - userDao.insert(user); - assertEquals(1, userDao.findBy("login=?", "jacuzzi" + i).size()); - } - for (int i = 0; i < ITERATION_COUNT; i++) { - User user = new User(); - user.setLogin("jacuzzi"); - userDao.insert(user); - assertEquals(i + 1, userDao.findBy("login=?", "jacuzzi").size()); - } - } - - public void testTransaction() { - userDao.returnJacuzzi().beginTransaction(); - - for (int i = 0; i < ITERATION_COUNT; i++) { - User user = new User(); - user.setLogin("jacuzzi"); - userDao.insert(user); - } - - userDao.returnJacuzzi().commit(); - assertEquals(ITERATION_COUNT, userDao.findBy("login=?", "jacuzzi").size()); - - userDao.returnJacuzzi().beginTransaction(); - - for (int i = 0; i < ITERATION_COUNT; i++) { - User user = new User(); - user.setLogin("jacuzzi"); - userDao.insert(user); - } - - userDao.returnJacuzzi().rollback(); - assertEquals(ITERATION_COUNT, userDao.findBy("login=?", "jacuzzi").size()); - } -} diff --git a/demo/src/test/java/com/jacuzzi/test/dao/UserDao.java b/demo/src/test/java/com/jacuzzi/test/dao/UserDao.java deleted file mode 100644 index 26898e1..0000000 --- a/demo/src/test/java/com/jacuzzi/test/dao/UserDao.java +++ /dev/null @@ -1,54 +0,0 @@ -/* Copyright by Mike Mirzayanov. */ - -package com.jacuzzi.test.dao; - -import org.jacuzzi.core.GenericDaoImpl; -import org.jacuzzi.core.Jacuzzi; - -import javax.sql.DataSource; - -import com.jacuzzi.test.model.User; -import com.mysql.jdbc.jdbc2.optional.MysqlDataSource; - -/** @author Mike Mirzayanov */ -public class UserDao extends GenericDaoImpl { - public static final String CREATE_USER_TABLE_SQL = "CREATE TABLE User (" + - "id BIGINT NOT NULL AUTO_INCREMENT, " + - "login VARCHAR( 255 ) NOT NULL, " + - "PRIMARY KEY (id)" + - ") ENGINE = InnoDB CHARACTER SET = utf8"; - - private static final String DELETE_USER_TABLE_SQL = "DROP TABLE User"; - - public UserDao() { - super(newDataSource()); - } - - private static DataSource newDataSource() { - MysqlDataSource dataSource = new MysqlDataSource(); - dataSource.setURL("jdbc:mysql://localhost:3307/jacuzzi?useUnicode=true&characterSetResults=UTF-8&characterEncoding=UTF-8"); - dataSource.setUser("jacuzzi"); - dataSource.setPassword("jacuzzi"); - return dataSource; - } - - public void createStorage() { - getJacuzzi().execute(CREATE_USER_TABLE_SQL); - } - - public void deleteStorage() { - getJacuzzi().execute(DELETE_USER_TABLE_SQL); - } - - public Jacuzzi returnJacuzzi() { - return getJacuzzi(); - } - - static { - try { - Class.forName("com.mysql.jdbc.Driver"); - } catch (ClassNotFoundException e) { - throw new RuntimeException(e); - } - } -} diff --git a/demo/src/test/java/com/jacuzzi/test/model/User.java b/demo/src/test/java/com/jacuzzi/test/model/User.java deleted file mode 100644 index 53aa732..0000000 --- a/demo/src/test/java/com/jacuzzi/test/model/User.java +++ /dev/null @@ -1,28 +0,0 @@ -/* Copyright by Mike Mirzayanov. */ - -package com.jacuzzi.test.model; - -import org.jacuzzi.mapping.Id; - -/** @author Mike Mirzayanov */ -public class User { - @Id - private long id; - private String login; - - public long getId() { - return id; - } - - public void setId(long id) { - this.id = id; - } - - public String getLogin() { - return login; - } - - public void setLogin(String login) { - this.login = login; - } -}