Skip to content

Commit

Permalink
Fix : Travis 배포 안되는 문제 해결
Browse files Browse the repository at this point in the history
  • Loading branch information
cheese10yun committed Feb 4, 2018
1 parent bc5a08b commit 86083b2
Show file tree
Hide file tree
Showing 9 changed files with 67 additions and 94 deletions.
3 changes: 3 additions & 0 deletions .travis.yml
Expand Up @@ -16,6 +16,9 @@ branches:
only:
- master

after_success:
- mvn clean cobertura:cobertura coveralls:report

notifications:
email:
recipients:
Expand Down
9 changes: 9 additions & 0 deletions pom.xml
Expand Up @@ -90,10 +90,19 @@

<build>
<plugins>

<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>

<plugin>
<groupId>org.eluder.coveralls</groupId>
<artifactId>coveralls-maven-plugin</artifactId>
<configuration>
<repoToken>Fr73GVmRTTdhJpUhvabjwxLztMqVfB5p5</repoToken>
</configuration>
</plugin>
</plugins>
</build>

Expand Down
16 changes: 4 additions & 12 deletions src/main/java/com/cheese/demo/user/User.java
@@ -1,7 +1,10 @@
package com.cheese.demo.user;

import com.cheese.demo.commons.EntityBaseDateTime;
import lombok.*;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import javax.persistence.*;
import java.sql.Date;
Expand Down Expand Up @@ -33,15 +36,4 @@ public class User extends EntityBaseDateTime {

@Column(name = "dob", columnDefinition = "DATE")
private Date dob;

@Builder
public User(Long id, String email, String password, String lastName, String firstName, String mobile, Date dob) {
this.id = id;
this.email = email;
this.password = password;
this.lastName = lastName;
this.firstName = firstName;
this.mobile = mobile;
this.dob = dob;
}
}
10 changes: 5 additions & 5 deletions src/main/java/com/cheese/demo/user/UserController.java
Expand Up @@ -25,9 +25,9 @@ public UserDto.SignUp signUp(@RequestBody @Valid UserDto.SignUp dto) {
return modelMapper.map(userService.create(dto), UserDto.SignUp.class);
}

@RequestMapping(value = "/{id}", method = RequestMethod.PUT)
@ResponseStatus(value = HttpStatus.OK)
public UserDto.MyAccount update(@PathVariable Long id, @RequestBody UserDto.MyAccount dto) {
return modelMapper.map(userService.update(id, dto), UserDto.MyAccount.class);
}
// @RequestMapping(value = "/{id}", method = RequestMethod.PUT)
// @ResponseStatus(value = HttpStatus.OK)
// public UserDto.MyAccount update(@PathVariable Long id, @RequestBody UserDto.MyAccount dto) {
// return modelMapper.map(userService.update(id, dto), UserDto.MyAccount.class);
// }
}
17 changes: 8 additions & 9 deletions src/main/java/com/cheese/demo/user/UserDto.java
Expand Up @@ -6,7 +6,6 @@
import org.hibernate.validator.constraints.NotEmpty;

import javax.validation.constraints.Size;
import java.sql.Date;

public class UserDto {

Expand All @@ -24,12 +23,12 @@ static class SignUp {
private String rePassword;
}

@Getter
@Setter
static class MyAccount {
private String lastName;
private String firstName;
private String mobile;
private Date dob;
}
// @Getter
// @Setter
// static class MyAccount {
// private String lastName;
// private String firstName;
// private String mobile;
// private Date dob;
// }
}
35 changes: 17 additions & 18 deletions src/main/java/com/cheese/demo/user/UserService.java
@@ -1,7 +1,6 @@
package com.cheese.demo.user;

import com.cheese.demo.user.exception.EmailDuplicationException;
import com.cheese.demo.user.exception.UserNotFoundException;
import org.modelmapper.ModelMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
Expand Down Expand Up @@ -29,23 +28,23 @@ public User create(UserDto.SignUp dto) {
return userRepository.save(modelMapper.map(dto, User.class));
}

public User update(Long id, UserDto.MyAccount dto) {
return userRepository.save(User.builder()
.id(findById(id).getId())
.lastName(dto.getLastName())
.firstName(dto.getFirstName())
.mobile(dto.getMobile())
.dob(dto.getDob())
.build());
}

public User findById(Long id) {
User user = userRepository.findOne(id);
if (user != null)
return user;
else
throw new UserNotFoundException(id);
}
// public User update(Long id, UserDto.MyAccount dto) {
// return userRepository.save(User.builder()
// .id(findById(id).getId())
// .lastName(dto.getLastName())
// .firstName(dto.getFirstName())
// .mobile(dto.getMobile())
// .dob(dto.getDob())
// .build());
// }
//
// public User findById(Long id) {
// User user = userRepository.findOne(id);
// if (user != null)
// return user;
// else
// throw new UserNotFoundException(id);
// }

private boolean isDuplicatedEmail(String email) {
return userRepository.findByEmail(email) != null;
Expand Down

This file was deleted.

Expand Up @@ -6,16 +6,8 @@
@Slf4j
public class EmailDuplicationException extends RuntimeException {

private String email;

public EmailDuplicationException(String email) {
super(String.valueOf(ErrorCodeEnum.EMAIL_DUPLICATION));
log.error(ErrorCodeEnum.EMAIL_DUPLICATION.getMessage(), email);
this.email = email;
}

public String getEmail() {
return email;
}

}
@@ -1,21 +1,21 @@
package com.cheese.demo.user.exception;

import com.cheese.demo.commons.ErrorCodeEnum;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class UserNotFoundException extends RuntimeException {

private Long id;

public UserNotFoundException(Long id) {
super(String.valueOf(ErrorCodeEnum.USER_NOT_FOUND));
log.error(ErrorCodeEnum.USER_NOT_FOUND.getMessage(), id);
this.id = id;
}

public Long getId() {
return id;
}
}

//package com.cheese.demo.user.exception;
//
//import com.cheese.demo.commons.ErrorCodeEnum;
//import lombok.extern.slf4j.Slf4j;
//
//@Slf4j
//public class UserNotFoundException extends RuntimeException {
//
// private Long id;
//
// public UserNotFoundException(Long id) {
// super(String.valueOf(ErrorCodeEnum.USER_NOT_FOUND));
// log.error(ErrorCodeEnum.USER_NOT_FOUND.getMessage(), id);
// this.id = id;
// }
//
// public Long getId() {
// return id;
// }
//}
//

0 comments on commit 86083b2

Please sign in to comment.