Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into dev-mikemirzayanov
Browse files Browse the repository at this point in the history
# Conflicts:
#	code/pom.xml
  • Loading branch information
MikeMirzayanov committed Mar 22, 2024
2 parents 0003270 + 0f775f7 commit 2f394a0
Show file tree
Hide file tree
Showing 6 changed files with 86 additions and 21 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: CI
on:
push:
pull_request:
workflow_dispatch:

env:
JDK_JAVA_OPTIONS: "--add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
test:
# Docker actions only work on linux
# strategy:
# matrix:
# os: [ubuntu-latest, windows-latest, macos-latest]
# java-version: [8, 11, 17]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v2
with:
java-version: 17
distribution: "adopt"
- name: Install
run: |
cd code
mvn --batch-mode install
- name: Test Demo
run: |
cd demo
mvn --batch-mode test
services:
mariadb:
image: mariadb
ports:
- 3307:3306
env:
MARIADB_DATABASE: jacuzzi
MARIADB_USER: jacuzzi
MARIADB_PASSWORD: jacuzzi
MARIADB_RANDOM_ROOT_PASSWORD: true
deploy:
if: github.ref == 'refs/heads/master' && github.repository_owner == 'Codeforces'
needs: test
runs-on: windows-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v2
with:
java-version: "17"
distribution: "adopt"
- name: Deploy
run: |
cd code
mvn --batch-mode deploy -DskipTests
17 changes: 8 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
.classpath
.project
.settings/

/code/jacuzzi.iml
/code/jacuzzi.ipr
/code/jacuzzi.iws
/code/target
/code/.idea
.classpath
.project
.settings/
*.iml
*.ipr
*.iws
.idea/
target/
7 changes: 7 additions & 0 deletions code/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@
<properties/>
</developer>
</developers>
<distributionManagement>
<repository>
<id>github</id>
<name>GitHub Packages</name>
<url>https://maven.pkg.github.com/Codeforces/jacuzzi</url>
</repository>
</distributionManagement>
<issueManagement>
<system>GitHub Issues</system>
<url>https://github.com/Codeforces/jacuzzi/issues</url>
Expand Down
8 changes: 4 additions & 4 deletions demo/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<artifactId>jacuzzi-demo</artifactId>
<packaging>jar</packaging>
<version>0.0.28-SNAPSHOT</version>
<name>jacuzzi</name>
<name>jacuzzi-demo</name>
<url>http://code.google.com/p/jacuzzi</url>
<licenses>
<license>
Expand All @@ -21,8 +21,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
Expand All @@ -31,7 +31,7 @@
<dependency>
<groupId>jacuzzi</groupId>
<artifactId>jacuzzi</artifactId>
<version>0.0.28-SNAPSHOT</version>
<version>0.1.0-SNAPSHOT</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
14 changes: 7 additions & 7 deletions demo/src/test/java/com/jacuzzi/test/JacuzziTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ public class JacuzziTest extends TestCase {
private UserDao userDao;
private static final int ITERATION_COUNT = 20;

protected void setUp() throws Exception {
protected void setUp() {
userDao = new UserDao();
userDao.createStorage();
}

protected void tearDown() throws Exception {
protected void tearDown() {
userDao.deleteStorage();
}

Expand All @@ -27,21 +27,21 @@ public void testInitialization() {
public void testInsertAndFind() {
User user = new User();
user.setLogin("jacuzzi");
assertTrue(userDao.insert(user));
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);
assertTrue(userDao.insert(user));
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");
assertTrue(userDao.insert(user));
userDao.insert(user);
assertEquals(i + 1, userDao.findBy("login=?", "jacuzzi").size());
}
}
Expand All @@ -52,7 +52,7 @@ public void testTransaction() {
for (int i = 0; i < ITERATION_COUNT; i++) {
User user = new User();
user.setLogin("jacuzzi");
assertTrue(userDao.insert(user));
userDao.insert(user);
}

userDao.returnJacuzzi().commit();
Expand All @@ -63,7 +63,7 @@ public void testTransaction() {
for (int i = 0; i < ITERATION_COUNT; i++) {
User user = new User();
user.setLogin("jacuzzi");
assertTrue(userDao.insert(user));
userDao.insert(user);
}

userDao.returnJacuzzi().rollback();
Expand Down
2 changes: 1 addition & 1 deletion demo/src/test/java/com/jacuzzi/test/dao/UserDao.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class UserDao extends GenericDaoImpl<User, Long> {
"id BIGINT NOT NULL AUTO_INCREMENT, " +
"login VARCHAR( 255 ) NOT NULL, " +
"PRIMARY KEY (id)" +
") TYPE = INNODB CHARACTER SET = utf8";
") ENGINE = InnoDB CHARACTER SET = utf8";

private static final String DELETE_USER_TABLE_SQL = "DROP TABLE User";

Expand Down

0 comments on commit 2f394a0

Please sign in to comment.