Skip to content

Commit

Permalink
Merge tag '20240727-1' into develop
Browse files Browse the repository at this point in the history
   20240727-1
  • Loading branch information
dragontaek-lee committed Jul 26, 2024
2 parents 84b858f + c4798e5 commit bfcfb63
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 105 deletions.
96 changes: 0 additions & 96 deletions .github/workflows/cd-develop.yml

This file was deleted.

10 changes: 1 addition & 9 deletions scripts/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,4 @@ CURRENT_PORT=8080
CURRENT_PID=$(lsof -Fp -i TCP:${CURRENT_PORT} | grep -Po 'p[0-9]+' | grep -Po '[0-9]+')
sudo kill ${CURRENT_PID}

if [ "$DEPLOYMENT_GROUP_NAME" == "prod" ]
then
nohup java -jar -Duser.timezone=Asia/Seoul -Dserver.port=${TARGET_PORT} -Dspring.profiles.active=prod $IDLE_APPLICATION_PATH >> /home/ubuntu/app/nohup.out 2>&1 &
fi

if [ "$DEPLOYMENT_GROUP_NAME" == "dev" ]
then
nohup java -jar -Duser.timezone=Asia/Seoul -Dserver.port=${TARGET_PORT} -Dspring.profiles.active=dev $IDLE_APPLICATION_PATH >> /home/ubuntu/app/nohup.out 2>&1 &
fi
nohup java -jar -Duser.timezone=Asia/Seoul -Dserver.port=${TARGET_PORT} -Dspring.profiles.active=prod $IDLE_APPLICATION_PATH >> /home/ubuntu/app/nohup.out 2>&1 &
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ public void editMagazine(Long magazineId, MagazineRequestDTO request) {

val magazinePhotos = request.magazinePhotos().toArray(new String[request.magazinePhotos().size()]);
magazine.setMagazine_photos(magazinePhotos);
magazine.setThumbNail(request.magazinePhotos().get(0));
magazineRepository.save(magazine);

List<Question> currentQuestions = new ArrayList<>(magazine.getQuestions());
Expand Down
48 changes: 48 additions & 0 deletions src/test/java/com/gam/api/MagazineRepositoryTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package com.gam.api;

import com.gam.api.domain.magazine.entity.Magazine;
import com.gam.api.domain.magazine.repository.MagazineRepository;
import com.gam.api.domain.user.entity.MagazineScrap;
import com.gam.api.domain.user.entity.Role;
import com.gam.api.domain.user.entity.User;
import com.gam.api.domain.user.entity.UserStatus;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase;
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;
import org.springframework.boot.test.autoconfigure.orm.jpa.TestEntityManager;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.test.context.ActiveProfiles;

import java.util.List;

import static org.junit.jupiter.api.Assertions.assertEquals;

@DataJpaTest
@AutoConfigureTestDatabase(replace = AutoConfigureTestDatabase.Replace.NONE)
@ActiveProfiles("dev")
public class MagazineRepositoryTest {

@Autowired
private TestEntityManager entityManager;

@Autowired
private MagazineRepository magazineRepository;

@Test
public void testFindTopMagazinesWithScrapStatus() {
long startTime = System.nanoTime();

// 페이징 처리
Pageable pageable = PageRequest.of(0, 3);

// 테스트 실행
List<Magazine> results = magazineRepository.findTop3ByOrderByViewCountDesc();

long endTime = System.nanoTime(); // 쿼리 완료 시간
System.out.println("Query execution time: " + (endTime - startTime) / 1_000_000_000.0 + " seconds");
// 검증
assertEquals(3, results.size());
}
}

0 comments on commit bfcfb63

Please sign in to comment.