Package org.springframework.data.solr.core.query

Examples of org.springframework.data.solr.core.query.PartialUpdate$IdField


    Assert.assertNull(converter.convert(null));
  }

  @Test(expected = IllegalArgumentException.class)
  public void testConvertNullIdField() {
    converter.convert(new PartialUpdate((String) null, "1"));
  }
View Full Code Here


    converter.convert(new PartialUpdate((String) null, "1"));
  }

  @Test(expected = IllegalArgumentException.class)
  public void testConvertBlankIdField() {
    converter.convert(new PartialUpdate("  ", "1"));
  }
View Full Code Here

  }

  @Test
  @SuppressWarnings("unchecked")
  public void testConvertFieldWithEmtpyCollectionsAddsNullValueForUpdate() {
    PartialUpdate update = new PartialUpdate("id", "1");
    update.add("field_1", Collections.emptyList());

    SolrInputDocument document = converter.convert(update);
    Assert.assertThat((Map<String, Object>)document.getFieldValue("field_1"), IsMapContaining.hasEntry("set", null));
  }
View Full Code Here

  }

  @Test
  @SuppressWarnings("unchecked")
  public void testConvertFieldWithNullValueIsTransformedCorrectly() {
    PartialUpdate update = new PartialUpdate("id", "1");
    update.add("field_1", null);

    SolrInputDocument document = converter.convert(update);
    Assert.assertThat((Map<String, Object>)document.getFieldValue("field_1"), IsMapContaining.hasEntry("set", null));
  }
View Full Code Here

  @Test
  @SuppressWarnings("unchecked")
  public void testConvertFieldWithCollectionsIsTransformedCorrectlyToSolrInputDocument() {
    List<String> values = Arrays.asList("go", "pivotal");
    PartialUpdate update = new PartialUpdate("id", "1");
    update.add("field_1", values);

    SolrInputDocument document = converter.convert(update);
    Assert.assertThat((Map<String, List<String>>)document.getFieldValue("field_1"), IsMapContaining.hasEntry("set", values));
  }
View Full Code Here

  }

  @SuppressWarnings("unchecked")
  @Test
  public void testWriteUpdate() {
    PartialUpdate update = new PartialUpdate("id", "123");
    update.add("language", "java");
    update.add("since", 1995);

    SolrInputDocument solrDocument = new SolrInputDocument();
    converter.write(update, solrDocument);

    Assert.assertEquals(update.getIdField().getValue(), solrDocument.getFieldValue(update.getIdField().getName()));
    Assert.assertTrue(solrDocument.getFieldValue("since") instanceof Map);
    Assert.assertEquals(1995, ((Map<String, Object>) solrDocument.getFieldValue("since")).get("set"));
  }
View Full Code Here

TOP

Related Classes of org.springframework.data.solr.core.query.PartialUpdate$IdField

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.