Search in sources :

Example 1 with UserExt

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);
}
Also used : UserExt(com.furyviewer.domain.UserExt) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) Transactional(org.springframework.transaction.annotation.Transactional)

Example 2 with UserExt

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);
}
Also used : UserExt(com.furyviewer.domain.UserExt) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) Transactional(org.springframework.transaction.annotation.Transactional)

Example 3 with UserExt

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);
}
Also used : UserExt(com.furyviewer.domain.UserExt) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) Transactional(org.springframework.transaction.annotation.Transactional)

Example 4 with UserExt

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));
}
Also used : UserExt(com.furyviewer.domain.UserExt) Timed(com.codahale.metrics.annotation.Timed)

Example 5 with 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;
}
Also used : User(com.furyviewer.domain.User) Authority(com.furyviewer.domain.Authority) UserExt(com.furyviewer.domain.UserExt)

Aggregations

UserExt (com.furyviewer.domain.UserExt)7 Timed (com.codahale.metrics.annotation.Timed)3 Test (org.junit.Test)3 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)3 Transactional (org.springframework.transaction.annotation.Transactional)3 Authority (com.furyviewer.domain.Authority)1 User (com.furyviewer.domain.User)1 BadRequestAlertException (com.furyviewer.web.rest.errors.BadRequestAlertException)1 URI (java.net.URI)1