Search in sources :

Example 86 with XmEntity

use of com.icthh.xm.ms.entity.domain.XmEntity in project xm-ms-entity by xm-online.

the class AvatarUrlListenerUnitTest method testPostLoadWrongFormat.

@Test
public void testPostLoadWrongFormat() {
    XmEntity entity = new XmEntity().avatarUrl("http://s3.hello.amazonaws.com/hello/hello.jpg");
    target.postLoad(entity);
    assertEquals(null, entity.getAvatarUrl());
}
Also used : XmEntity(com.icthh.xm.ms.entity.domain.XmEntity) Test(org.junit.Test)

Example 87 with XmEntity

use of com.icthh.xm.ms.entity.domain.XmEntity in project xm-ms-entity by xm-online.

the class AvatarUrlListenerUnitTest method testPrePersistSuccessNginx.

@Test
public void testPrePersistSuccessNginx() {
    XmEntity entity = new XmEntity().avatarUrl("https://hello-rgw.icthh.test/hello.jpg");
    target.prePersist(entity);
    assertEquals("hello.jpg", entity.getAvatarUrl());
}
Also used : XmEntity(com.icthh.xm.ms.entity.domain.XmEntity) Test(org.junit.Test)

Example 88 with XmEntity

use of com.icthh.xm.ms.entity.domain.XmEntity in project xm-ms-entity by xm-online.

the class AvatarUrlListenerUnitTest method testPostLoadEmpty.

@Test
public void testPostLoadEmpty() {
    XmEntity entity = new XmEntity().avatarUrl(null);
    target.postLoad(entity);
    assertEquals(null, entity.getAvatarUrl());
}
Also used : XmEntity(com.icthh.xm.ms.entity.domain.XmEntity) Test(org.junit.Test)

Example 89 with XmEntity

use of com.icthh.xm.ms.entity.domain.XmEntity in project xm-ms-entity by xm-online.

the class XmEntityResource method searchByTypeKeyAndQuery.

@GetMapping("/_search-with-typekey/xm-entities")
@Timed
public ResponseEntity<List<XmEntity>> searchByTypeKeyAndQuery(@RequestParam String typeKey, @RequestParam(required = false) String query, @ApiParam Pageable pageable) {
    Page<XmEntity> page = xmEntityService.searchByQueryAndTypeKey(query, typeKey, pageable, null);
    HttpHeaders headers = PaginationUtil.generateSearchPaginationHttpHeaders(typeKey, page, "/api/_search-with-typekey/xm-entities");
    return new ResponseEntity<>(page.getContent(), headers, HttpStatus.OK);
}
Also used : HttpHeaders(org.springframework.http.HttpHeaders) ResponseEntity(org.springframework.http.ResponseEntity) XmEntity(com.icthh.xm.ms.entity.domain.XmEntity) GetMapping(org.springframework.web.bind.annotation.GetMapping) Timed(com.codahale.metrics.annotation.Timed)

Example 90 with XmEntity

use of com.icthh.xm.ms.entity.domain.XmEntity in project xm-ms-entity by xm-online.

the class XmEntityResource method getAllXmEntities.

/**
 * GET  /xm-entities : get all the xmEntities.
 *
 * @param pageable the pagination information
 * @return the ResponseEntity with status 200 (OK) and the list of xmEntities in body
 */
@GetMapping("/xm-entities")
@Timed
public ResponseEntity<List<XmEntity>> getAllXmEntities(@ApiParam Pageable pageable, @RequestParam(required = false) String typeKey) {
    Page<XmEntity> page = xmEntityService.findAll(pageable, typeKey, null);
    HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, "/api/xm-entities");
    return new ResponseEntity<>(page.getContent(), headers, HttpStatus.OK);
}
Also used : HttpHeaders(org.springframework.http.HttpHeaders) ResponseEntity(org.springframework.http.ResponseEntity) XmEntity(com.icthh.xm.ms.entity.domain.XmEntity) GetMapping(org.springframework.web.bind.annotation.GetMapping) Timed(com.codahale.metrics.annotation.Timed)

Aggregations

XmEntity (com.icthh.xm.ms.entity.domain.XmEntity)102 Test (org.junit.Test)60 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)46 Transactional (org.springframework.transaction.annotation.Transactional)32 Link (com.icthh.xm.ms.entity.domain.Link)22 Tag (com.icthh.xm.ms.entity.domain.Tag)10 ConstraintViolation (javax.validation.ConstraintViolation)9 WithMockUser (org.springframework.security.test.context.support.WithMockUser)9 MvcResult (org.springframework.test.web.servlet.MvcResult)9 HashMap (java.util.HashMap)8 Map (java.util.Map)8 SneakyThrows (lombok.SneakyThrows)8 Attachment (com.icthh.xm.ms.entity.domain.Attachment)7 Location (com.icthh.xm.ms.entity.domain.Location)7 lombok.val (lombok.val)7 Calendar (com.icthh.xm.ms.entity.domain.Calendar)6 Profile (com.icthh.xm.ms.entity.domain.Profile)6 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)5 Rating (com.icthh.xm.ms.entity.domain.Rating)5 Timed (com.codahale.metrics.annotation.Timed)4