Package org.springframework.data.elasticsearch

Examples of org.springframework.data.elasticsearch.IntegerIDEntity


  @Test
  public void shouldReturnCountOfDocuments(){
      //given
      Integer documentId = RandomUtils.nextInt();
      IntegerIDEntity sampleEntity = new IntegerIDEntity();
      sampleEntity.setId(documentId);
      sampleEntity.setMessage("some message");
      sampleEntity.setVersion(System.currentTimeMillis());
      repository.save(sampleEntity);
      //when
      Long count = repository.count();
      //then
      assertThat(count, is(greaterThanOrEqualTo(1L)));
View Full Code Here


  @Test
  public void shouldDeleteDocument(){
      //given
      Integer documentId = RandomUtils.nextInt();
      IntegerIDEntity sampleEntity = new IntegerIDEntity();
      sampleEntity.setId(documentId);
      sampleEntity.setMessage("some message");
      sampleEntity.setVersion(System.currentTimeMillis());
      repository.save(sampleEntity);
      //when
      repository.delete(documentId);
      //then
      IntegerIDEntity entityFromElasticSearch = repository.findOne(documentId);
      assertThat(entityFromElasticSearch, is(nullValue()));
  }
View Full Code Here

  @Test
  public void shouldSearchDocumentsGivenSearchQuery(){
      //given
      Integer documentId = RandomUtils.nextInt();
      IntegerIDEntity sampleEntity = new IntegerIDEntity();
      sampleEntity.setId(documentId);
      sampleEntity.setMessage("some test message");
      sampleEntity.setVersion(System.currentTimeMillis());
      repository.save(sampleEntity);

      SearchQuery query = new NativeSearchQueryBuilder()
              .withQuery(termQuery("message", "test"))
              .build();
View Full Code Here

  @Test
  public void shouldSearchDocumentsGivenElasticsearchQuery(){
      //given
      Integer documentId = RandomUtils.nextInt();
      IntegerIDEntity sampleEntity = new IntegerIDEntity();
      sampleEntity.setId(documentId);
      sampleEntity.setMessage("hello world.");
      sampleEntity.setVersion(System.currentTimeMillis());
      repository.save(sampleEntity);
      //when
      Page<IntegerIDEntity> page = repository.search(termQuery("message", "world"), new PageRequest(0,50));
      //then
      assertThat(page, is(notNullValue()));
View Full Code Here

  @Ignore
  public  void shouldFindAllByIdQuery(){
      //todo : find solution for findAll(Iterable<Ids> ids)
      //given
      Integer documentId = RandomUtils.nextInt();
      IntegerIDEntity sampleEntity = new IntegerIDEntity();
      sampleEntity.setId(documentId);
      sampleEntity.setMessage("hello world.");
      sampleEntity.setVersion(System.currentTimeMillis());
      repository.save(sampleEntity);

      Integer documentId2 = RandomUtils.nextInt();
      IntegerIDEntity sampleEntity2 = new IntegerIDEntity();
      sampleEntity2.setId(documentId2);
      sampleEntity2.setMessage("hello world.");
      sampleEntity2.setVersion(System.currentTimeMillis());
      repository.save(sampleEntity2);

      //when
      Iterable<IntegerIDEntity> sampleEntities=repository.findAll(Arrays.asList(documentId,documentId2));
View Full Code Here

  @Test
  public void shouldSaveIterableEntities(){
      //given
      Integer documentId = RandomUtils.nextInt();
      IntegerIDEntity sampleEntity1 = new IntegerIDEntity();
      sampleEntity1.setId(documentId);
      sampleEntity1.setMessage("hello world.");
      sampleEntity1.setVersion(System.currentTimeMillis());

      Integer documentId2 = RandomUtils.nextInt();
      IntegerIDEntity sampleEntity2 = new IntegerIDEntity();
      sampleEntity2.setId(documentId2);
      sampleEntity2.setMessage("hello world.");
      sampleEntity2.setVersion(System.currentTimeMillis());

      Iterable<IntegerIDEntity> sampleEntities = Arrays.asList(sampleEntity1,sampleEntity2);
      //when
      repository.save(sampleEntities);
      //then
View Full Code Here

  @Test
  public void shouldReturnTrueGivenDocumentWithIdExists(){
      //given
      Integer documentId = RandomUtils.nextInt();
      IntegerIDEntity sampleEntity = new IntegerIDEntity();
      sampleEntity.setId(documentId);
      sampleEntity.setMessage("hello world.");
      sampleEntity.setVersion(System.currentTimeMillis());
      repository.save(sampleEntity);

      //when
      boolean exist = repository.exists(documentId);
View Full Code Here

  @Test
  public void shouldReturnResultsForGivenSearchQuery(){
      //given
      Integer documentId = RandomUtils.nextInt();
      IntegerIDEntity sampleEntity = new IntegerIDEntity();
      sampleEntity.setId(documentId);
      sampleEntity.setMessage("hello world.");
      sampleEntity.setVersion(System.currentTimeMillis());
      repository.save(sampleEntity);
      //when
      SearchQuery searchQuery = new NativeSearchQueryBuilder()
              .withQuery(fieldQuery("id",documentId))
              .build();
View Full Code Here

  @Test
  public void shouldDeleteEntity(){
      //given
      Integer documentId = RandomUtils.nextInt();
      IntegerIDEntity sampleEntity = new IntegerIDEntity();
      sampleEntity.setId(documentId);
      sampleEntity.setMessage("hello world.");
      sampleEntity.setVersion(System.currentTimeMillis());
      repository.save(sampleEntity);
      //when
      repository.delete(sampleEntity);
      //then
      SearchQuery searchQuery = new NativeSearchQueryBuilder()
View Full Code Here

  @Test
  public void shouldReturnIterableEntities(){
      //given
      Integer documentId1 = RandomUtils.nextInt();
      IntegerIDEntity sampleEntity1 = new IntegerIDEntity();
      sampleEntity1.setId(documentId1);
      sampleEntity1.setMessage("hello world.");
      sampleEntity1.setVersion(System.currentTimeMillis());
      repository.save(sampleEntity1);

      Integer documentId2 = RandomUtils.nextInt();
      IntegerIDEntity sampleEntity2 = new IntegerIDEntity();
      sampleEntity2.setId(documentId2);
      sampleEntity2.setMessage("hello world.");
      sampleEntity2.setVersion(System.currentTimeMillis());
      repository.save(sampleEntity2);

      //when
      Iterable<IntegerIDEntity> sampleEntities = repository.search(fieldQuery("id",documentId1));
      //then
View Full Code Here

TOP

Related Classes of org.springframework.data.elasticsearch.IntegerIDEntity

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.