Package org.springframework.data.gemfire.repository.sample

Examples of org.springframework.data.gemfire.repository.sample.Person


  PersonRepository repository;

  @Before
  public void setUp() {

    dave = new Person(1L, "Dave", "Matthews");
    carter = new Person(2L, "Carter", "Beauford");
    boyd = new Person(3L, "Boyd", "Tinsley");
    stefan = new Person(4L, "Stefan", "Lessard");
    leroi = new Person(5L, "Leroi", "Moore");
    jeff = new Person(6L, "Jeff", "Coffin");
    oliverAugust = new Person(7L, "Oliver August", "Matthews");

    GemfireMappingContext context = new GemfireMappingContext();

    Regions regions = new Regions(this.regions, context);
    GemfireTemplate template = new GemfireTemplate(regions.getRegion(Person.class));
View Full Code Here


  }

  @Test
  public void storeAndDeleteEntity() {

    Person person = new Person(1L, "Oliver", "Gierke");

    repository.save(person);

    assertThat(repository.count(), is(1L));
    assertThat(repository.findOne(person.id), is(person));
View Full Code Here

  }

  @Test
  public void queryRegion() throws Exception {

    Person person = new Person(1L, "Oliver", "Gierke");

    template.put(1L, person);

    SelectResults<Person> persons = template.find("SELECT * FROM /simple s WHERE s.firstname = $1",
        person.firstname);
View Full Code Here

  }

  @Test
  public void findAllWithGivenIds() {

    Person dave = new Person(1L, "Dave", "Matthews");
    Person carter = new Person(2L, "Carter", "Beauford");
    Person leroi = new Person(3L, "Leroi", "Moore");

    template.put(dave.id, dave);
    template.put(carter.id, carter);
    template.put(leroi.id, leroi);
View Full Code Here

  @Test
  public void testSaveEntities() {
    assertTrue(template.getRegion().isEmpty());

    Person johnBlum = new Person(1l, "John", "Blum");
    Person jonBloom = new Person(2l, "Jon", "Bloom");
    Person juanBlume = new Person(3l, "Juan", "Blume");

    repository.save(Arrays.asList(johnBlum, jonBloom, juanBlume));

    assertFalse(template.getRegion().isEmpty());
    assertEquals(3, template.getRegion().size());
View Full Code Here

  public void usesRegisteredInstantiator() {
    Address address = new Address();
    address.zipCode = "01234";
    address.city = "London";

    Person person = new Person(1L, "Oliver", "Gierke");
    person.address = address;
   
    ParameterValueProvider<GemfirePersistentProperty> provider = any(ParameterValueProvider.class);
    GemfirePersistentEntity<?> entity = any(GemfirePersistentEntity.class);
    when(instantiator.createInstance(entity, provider)).thenReturn(person);
View Full Code Here

    Address address = new Address();
    address.zipCode = "01234";
    address.city = "London";

    Person person = new Person(1L, "Oliver", "Gierke");
    person.address = address;

    region.put(1L, person);
    Object result = region.get(1L);

    assertThat(result instanceof Person, is(true));

    Person reference = person;
    assertThat(reference.getFirstname(), is(person.getFirstname()));
    assertThat(reference.getLastname(), is(person.getLastname()));
    assertThat(reference.address, is(person.address));
  }
View Full Code Here

  }

  @Test
  public void testRepositoryCreated() {
    PersonRepository repo = ctx.getBean(PersonRepository.class);
    Person dave = new Person(1L, "Dave", "Mathhews");
    repo.save(dave);
    Person saved = repo.findOne(1L);
    assertEquals("Dave", saved.getFirstname());
  }
View Full Code Here

    assertEquals("{\"hello2\":\"world2\"}", results.get("key2"));
  }

  @Test
  public void testObjectToJSon() throws IOException {
    Person dave = new Person(1L, "Dave", "Turanski");
    jsonRegion.put("dave", dave);
    String json = (String) jsonRegion.get("dave");
    assertEquals(json, "{\"id\":1,\"firstname\":\"Dave\",\"lastname\":\"Turanski\",\"address\":null}", json);
    Object result = jsonRegion.put("dave", dave);
    assertEquals("{\"id\":1,\"firstname\":\"Dave\",\"lastname\":\"Turanski\",\"address\":null}", result);
View Full Code Here

    assertEquals("{\"id\":1,\"firstname\":\"Dave\",\"lastname\":\"Turanski\",\"address\":null}", result);
  }

  @Test
  public void testTemplateFindUnique() {
    Person dave = new Person(1L, "Dave", "Turanski");
    jsonRegion.put("dave", dave);
    String json = (String) template.findUnique("SELECT * FROM /jsonRegion WHERE firstname=$1", "Dave");
    assertEquals("{\"id\":1,\"firstname\":\"Dave\",\"lastname\":\"Turanski\",\"address\":null}", json);
  }
View Full Code Here

TOP

Related Classes of org.springframework.data.gemfire.repository.sample.Person

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.