use of com.furyviewer.domain.UserExt in project FuryViewer by TheDoctor-95.
the class UserExtResourceIntTest method equalsVerifier.
@Test
@Transactional
public void equalsVerifier() throws Exception {
TestUtil.equalsVerifier(UserExt.class);
UserExt userExt1 = new UserExt();
userExt1.setId(1L);
UserExt userExt2 = new UserExt();
userExt2.setId(userExt1.getId());
assertThat(userExt1).isEqualTo(userExt2);
userExt2.setId(2L);
assertThat(userExt1).isNotEqualTo(userExt2);
userExt1.setId(null);
assertThat(userExt1).isNotEqualTo(userExt2);
}
use of com.furyviewer.domain.UserExt in project FuryViewer by TheDoctor-95.
the class UserExtResourceIntTest method createUserExt.
@Test
@Transactional
public void createUserExt() throws Exception {
int databaseSizeBeforeCreate = userExtRepository.findAll().size();
// Create the UserExt
restUserExtMockMvc.perform(post("/api/user-exts").contentType(TestUtil.APPLICATION_JSON_UTF8).content(TestUtil.convertObjectToJsonBytes(userExt))).andExpect(status().isCreated());
// Validate the UserExt in the database
List<UserExt> userExtList = userExtRepository.findAll();
assertThat(userExtList).hasSize(databaseSizeBeforeCreate + 1);
UserExt testUserExt = userExtList.get(userExtList.size() - 1);
assertThat(testUserExt.getImage()).isEqualTo(DEFAULT_IMAGE);
assertThat(testUserExt.getImageContentType()).isEqualTo(DEFAULT_IMAGE_CONTENT_TYPE);
assertThat(testUserExt.getLocationGoogleMaps()).isEqualTo(DEFAULT_LOCATION_GOOGLE_MAPS);
assertThat(testUserExt.getLatitude()).isEqualTo(DEFAULT_LATITUDE);
assertThat(testUserExt.getLongitude()).isEqualTo(DEFAULT_LONGITUDE);
assertThat(testUserExt.getBackground_img()).isEqualTo(DEFAULT_BACKGROUND_IMG);
assertThat(testUserExt.getBackground_imgContentType()).isEqualTo(DEFAULT_BACKGROUND_IMG_CONTENT_TYPE);
}
use of com.furyviewer.domain.UserExt in project FuryViewer by TheDoctor-95.
the class UserExtResourceIntTest method updateUserExt.
@Test
@Transactional
public void updateUserExt() throws Exception {
// Initialize the database
userExtRepository.saveAndFlush(userExt);
int databaseSizeBeforeUpdate = userExtRepository.findAll().size();
// Update the userExt
UserExt updatedUserExt = userExtRepository.findOne(userExt.getId());
updatedUserExt.image(UPDATED_IMAGE).imageContentType(UPDATED_IMAGE_CONTENT_TYPE).locationGoogleMaps(UPDATED_LOCATION_GOOGLE_MAPS).latitude(UPDATED_LATITUDE).longitude(UPDATED_LONGITUDE).background_img(UPDATED_BACKGROUND_IMG).background_imgContentType(UPDATED_BACKGROUND_IMG_CONTENT_TYPE);
restUserExtMockMvc.perform(put("/api/user-exts").contentType(TestUtil.APPLICATION_JSON_UTF8).content(TestUtil.convertObjectToJsonBytes(updatedUserExt))).andExpect(status().isOk());
// Validate the UserExt in the database
List<UserExt> userExtList = userExtRepository.findAll();
assertThat(userExtList).hasSize(databaseSizeBeforeUpdate);
UserExt testUserExt = userExtList.get(userExtList.size() - 1);
assertThat(testUserExt.getImage()).isEqualTo(UPDATED_IMAGE);
assertThat(testUserExt.getImageContentType()).isEqualTo(UPDATED_IMAGE_CONTENT_TYPE);
assertThat(testUserExt.getLocationGoogleMaps()).isEqualTo(UPDATED_LOCATION_GOOGLE_MAPS);
assertThat(testUserExt.getLatitude()).isEqualTo(UPDATED_LATITUDE);
assertThat(testUserExt.getLongitude()).isEqualTo(UPDATED_LONGITUDE);
assertThat(testUserExt.getBackground_img()).isEqualTo(UPDATED_BACKGROUND_IMG);
assertThat(testUserExt.getBackground_imgContentType()).isEqualTo(UPDATED_BACKGROUND_IMG_CONTENT_TYPE);
}
use of com.furyviewer.domain.UserExt in project FuryViewer by TheDoctor-95.
the class UserExtResource method getUserExt.
/**
* GET /user-exts/:id : get the "id" userExt.
*
* @param id the id of the userExt to retrieve
* @return the ResponseEntity with status 200 (OK) and with body the userExt, or with status 404 (Not Found)
*/
@GetMapping("/user-exts/{id}")
@Timed
public ResponseEntity<UserExt> getUserExt(@PathVariable Long id) {
log.debug("REST request to get UserExt : {}", id);
UserExt userExt = userExtRepository.findOne(id);
return ResponseUtil.wrapOrNotFound(Optional.ofNullable(userExt));
}
use of com.furyviewer.domain.UserExt in project FuryViewer by TheDoctor-95.
the class UserService method registerUser.
public User registerUser(ManagedUserVM userDTO) {
User newUser = new User();
Authority authority = authorityRepository.findOne(AuthoritiesConstants.USER);
Set<Authority> authorities = new HashSet<>();
String encryptedPassword = passwordEncoder.encode(userDTO.getPassword());
newUser.setLogin(userDTO.getLogin());
// new user gets initially a generated password
newUser.setPassword(encryptedPassword);
newUser.setFirstName(userDTO.getFirstName());
newUser.setLastName(userDTO.getLastName());
newUser.setEmail(userDTO.getEmail());
newUser.setImageUrl(userDTO.getImageUrl());
newUser.setLangKey(userDTO.getLangKey());
// new user is not active
newUser.setActivated(false);
// new user gets registration key
newUser.setActivationKey(RandomUtil.generateActivationKey());
authorities.add(authority);
newUser.setAuthorities(authorities);
userRepository.save(newUser);
log.debug("Created Information for User: {}", newUser);
UserExt newUserExt = new UserExt();
newUserExt.setLocationGoogleMaps(userDTO.getUrlMaps());
newUserExt.setUser(newUser);
userExtRepository.save(newUserExt);
return newUser;
}
Aggregations